svn commit: r366136 - in head/sys/dev: amdsmn amdtemp

2020-09-24 Thread Conrad Meyer
Author: cem
Date: Fri Sep 25 04:16:28 2020
New Revision: 366136
URL: https://svnweb.freebsd.org/changeset/base/366136

Log:
  amdtemp(4), amdsmn(4): Attach to Ryzen 4000 APU (Zen 2, "Renoir")
  
  PR:   249864
  Reported by:  Florian Millet 
  Tested by:Florian Millet

Modified:
  head/sys/dev/amdsmn/amdsmn.c
  head/sys/dev/amdtemp/amdtemp.c

Modified: head/sys/dev/amdsmn/amdsmn.c
==
--- head/sys/dev/amdsmn/amdsmn.cFri Sep 25 01:16:01 2020
(r366135)
+++ head/sys/dev/amdsmn/amdsmn.cFri Sep 25 04:16:28 2020
(r366136)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2017-2019 Conrad Meyer 
+ * Copyright (c) 2017-2020 Conrad Meyer 
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -60,6 +60,7 @@ __FBSDID("$FreeBSD$");
 #definePCI_DEVICE_ID_AMD_17H_ROOT  0x1450
 #definePCI_DEVICE_ID_AMD_17H_M10H_ROOT 0x15d0
 #definePCI_DEVICE_ID_AMD_17H_M30H_ROOT 0x1480  /* Also M70H. */
+#definePCI_DEVICE_ID_AMD_17H_M60H_ROOT 0x1630
 
 struct pciid;
 struct amdsmn_softc {
@@ -94,6 +95,12 @@ static const struct pciid {
{
.amdsmn_vendorid = CPU_VENDOR_AMD,
.amdsmn_deviceid = PCI_DEVICE_ID_AMD_17H_M30H_ROOT,
+   .amdsmn_addr_reg = F17H_SMN_ADDR_REG,
+   .amdsmn_data_reg = F17H_SMN_DATA_REG,
+   },
+   {
+   .amdsmn_vendorid = CPU_VENDOR_AMD,
+   .amdsmn_deviceid = PCI_DEVICE_ID_AMD_17H_M60H_ROOT,
.amdsmn_addr_reg = F17H_SMN_ADDR_REG,
.amdsmn_data_reg = F17H_SMN_DATA_REG,
},

Modified: head/sys/dev/amdtemp/amdtemp.c
==
--- head/sys/dev/amdtemp/amdtemp.c  Fri Sep 25 01:16:01 2020
(r366135)
+++ head/sys/dev/amdtemp/amdtemp.c  Fri Sep 25 04:16:28 2020
(r366136)
@@ -107,6 +107,7 @@ struct amdtemp_softc {
 #defineDEVICEID_AMD_HOSTB17H_ROOT  0x1450
 #defineDEVICEID_AMD_HOSTB17H_M10H_ROOT 0x15d0
 #defineDEVICEID_AMD_HOSTB17H_M30H_ROOT 0x1480  /* Also M70h. */
+#defineDEVICEID_AMD_HOSTB17H_M60H_ROOT 0x1630
 
 static const struct amdtemp_product {
uint16_tamdtemp_vendorid;
@@ -130,6 +131,7 @@ static const struct amdtemp_product {
{ VENDORID_AMD, DEVICEID_AMD_HOSTB17H_ROOT, false },
{ VENDORID_AMD, DEVICEID_AMD_HOSTB17H_M10H_ROOT, false },
{ VENDORID_AMD, DEVICEID_AMD_HOSTB17H_M30H_ROOT, false },
+   { VENDORID_AMD, DEVICEID_AMD_HOSTB17H_M60H_ROOT, false },
 };
 
 /*
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r363700 - in head/sys: arm/ti arm/ti/am335x arm/ti/clk arm/ti/cpsw arm/ti/omap4 arm/ti/usb dev/uart modules

2020-09-24 Thread Ed Maste
On Tue, 22 Sep 2020 at 12:50, Ed Maste  wrote:
>
> On Thu, 30 Jul 2020 at 10:45, Michal Meloun  wrote:
> >
> > Author: mmel
> > Date: Thu Jul 30 14:45:05 2020
> > New Revision: 363700
> > URL: https://svnweb.freebsd.org/changeset/base/363700
> >
> > Log:
> >   Move Ti AM335x to dev/extres/clk framework.
>
> It looks like BeagleBone Black is indeed broken after this commit
> https://ci.freebsd.org/hwlab/job/FreeBSD-device-head-beaglebone-test/6131/
> https://ci.freebsd.org/hwlab/job/FreeBSD-device-head-beaglebone-test/6131/artifact/device_tests/beaglebone.boot.log

It seems this was because we weren't using an up-to-date dtb - at
various times during my investigation of the CI setup we were using
either uboot's built-in dtb or were tftp fetching an old copy of
am335x-boneblack.dtb. With bootcmd including "run findfdt" and making
sure there are no old copies in the tftproot directory the CI
environment is booting again.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366132 - head/lib/libc/tests/iconv

2020-09-24 Thread Alan Somers
Author: asomers
Date: Thu Sep 24 21:42:44 2020
New Revision: 366132
URL: https://svnweb.freebsd.org/changeset/base/366132

Log:
  lib/libc/tests/iconv: raise WARNS to 6
  
  MFC after:2 weeks

Modified:
  head/lib/libc/tests/iconv/Makefile
  head/lib/libc/tests/iconv/iconvctl_test.c

Modified: head/lib/libc/tests/iconv/Makefile
==
--- head/lib/libc/tests/iconv/Makefile  Thu Sep 24 21:39:09 2020
(r366131)
+++ head/lib/libc/tests/iconv/Makefile  Thu Sep 24 21:42:44 2020
(r366132)
@@ -3,6 +3,5 @@
 TESTSDIR=  ${TESTSBASE}/lib/libc/iconv
 
 ATF_TESTS_C+=  iconvctl_test
-WARNS?=2
 
 .include 

Modified: head/lib/libc/tests/iconv/iconvctl_test.c
==
--- head/lib/libc/tests/iconv/iconvctl_test.c   Thu Sep 24 21:39:09 2020
(r366131)
+++ head/lib/libc/tests/iconv/iconvctl_test.c   Thu Sep 24 21:42:44 2020
(r366132)
@@ -30,7 +30,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
-void
+static void
 test_trivialp(const char *src, const char *dst, int expected)
 {
iconv_t ic;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366131 - head/lib/libc/tests/sys

2020-09-24 Thread Alan Somers
Author: asomers
Date: Thu Sep 24 21:39:09 2020
New Revision: 366131
URL: https://svnweb.freebsd.org/changeset/base/366131

Log:
  lib/libc/tests/sys: raise WARNS to 6
  
  MFC after:2 weeks

Modified:
  head/lib/libc/tests/sys/Makefile

Modified: head/lib/libc/tests/sys/Makefile
==
--- head/lib/libc/tests/sys/MakefileThu Sep 24 20:01:31 2020
(r366130)
+++ head/lib/libc/tests/sys/MakefileThu Sep 24 21:39:09 2020
(r366131)
@@ -78,12 +78,6 @@ LIBADD.timer_create_test+=   rt
 SRCS.mlock_test+=  mlock_helper.c
 SRCS.setrlimit_test+=  mlock_helper.c
 
-.if ${COMPILER_TYPE} == "gcc"
-WARNS?=3
-.else
-WARNS?=4
-.endif
-
 FILESGROUPS+=  truncate_test_FILES
 
 truncate_test_FILES=   truncate_test.root_owned
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366129 - head/share/man/man4

2020-09-24 Thread Gordon Bergling
Author: gbe (doc committer)
Date: Thu Sep 24 19:59:29 2020
New Revision: 366129
URL: https://svnweb.freebsd.org/changeset/base/366129

Log:
  tcp(4): Add a reference for tcp_bbr(4) man page

Modified:
  head/share/man/man4/tcp.4

Modified: head/share/man/man4/tcp.4
==
--- head/share/man/man4/tcp.4   Thu Sep 24 19:35:34 2020(r366128)
+++ head/share/man/man4/tcp.4   Thu Sep 24 19:59:29 2020(r366129)
@@ -773,6 +773,7 @@ when trying to use a TCP function block that is not av
 .Xr mod_cc 4 ,
 .Xr siftr 4 ,
 .Xr syncache 4 ,
+.Xr tcp_bbr 4 ,
 .Xr setkey 8 ,
 .Xr tcp_functions 9
 .Rs
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366128 - head/share/man/man4

2020-09-24 Thread Gordon Bergling
Author: gbe (doc committer)
Date: Thu Sep 24 19:35:34 2020
New Revision: 366128
URL: https://svnweb.freebsd.org/changeset/base/366128

Log:
  Add missing file (tcp_bbr.4) from r366127
  
  Reviewed by:  bcr
  Approved by:  bcr
  Differential Revision:https://reviews.freebsd.org/D24915

Added:
  head/share/man/man4/tcp_bbr.4   (contents, props changed)

Added: head/share/man/man4/tcp_bbr.4
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/share/man/man4/tcp_bbr.4   Thu Sep 24 19:35:34 2020
(r366128)
@@ -0,0 +1,168 @@
+.\"
+.\" Copyright (c) 2020, Gordon Bergling
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"notice, this list of conditions and the following disclaimer in the
+.\"documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
+.\" ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 24, 2020
+.Dt TCP_BBR 4
+.Os
+.Sh NAME
+.Nm tcp_bbr
+.Nd TCP Bottleneck Bandwidth and Round-Trip Time Algorithm
+.Sh SYNOPSIS
+To use this TCP stack you have to place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "options TCPHPTS"
+.Ed
+.Pp
+To load the driver as a module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+tcp_bbr_load="YES"
+.Ed
+.Pp
+To enable the TCP stack you must place the following line in the
+.Xr sysctl.conf 5 :
+.Bd -literal -offset indent
+net.inet.tcp.functions_default=bbr
+.Ed
+.Sh DESCRIPTION
+Bottleneck bandwidth and round-trip time (BBR) is a congestion control 
algorithm which
+seeks high throughput with a small queue by probing BW and RTT.
+It is a round-up redesign of congestion control, which is not loss-based, 
delay-based,
+ECN-based or AIMD-based.
+.Pp
+The core design of BBR is about creating a model graph of the network path by
+estimating the maximum BW and minimum RTT on each ACK.
+.Sh MIB Variables
+The algorithm exposes the following scopes in the
+.Va net.inet.tcp.bbr
+branch of the
+.Xr sysctl 3
+MIB:
+.Bl -tag -width ".Va exp_backoff_scale"
+.It Va cwnd
+Cwnd controls, for example "target cwnd rtt measurment" and "BBR initial 
window".
+.It Va measure
+Measurement controls.
+.It Va pacing
+Connection pacing controls.
+.It Va policer
+Policer controls, for example "false detection threshold" and "loss threshold".
+.It Va probertt
+Probe RTT controls.
+.It Va startup
+Startup controls.
+.It Va states
+State controls.
+.It Va timeout
+Time out controls.
+.El
+.Pp
+Besides the variables within the above scopes the following
+variables are also exposed in the
+.Va net.inet.tcp.bbr
+branch:
+.Bl -tag -width ".Va exp_backoff_scale"
+.It Va clrlost
+Clear lost counters.
+.It Va software_pacing
+Total number of software paced flows.
+.It Va hdwr_pacing
+Total number of hardware paced flows.
+.It Va enob_no_hdwr_pacing
+Total number of enobufs for non-hardware paced flows.
+.It Va enob_hdwr_pacing
+Total number of enobufs for hardware paced flows.
+.It Va rtt_tlp_thresh
+What divisor for TLP rtt/retran will be added (1=rtt, 2=1/2 rtt etc).
+.It Va reorder_fade
+Does reorder detection fade, if so how many ms (0 means never).
+.It Va reorder_thresh
+What factor for rack will be added when seeing reordering (shift right).
+.It Va bb_verbose
+Should BBR black box logging be verbose.
+.It Va sblklimit
+When do we start ignoring small sack blocks.
+.It Va resend_use_tso
+Can resends use TSO?
+.It Va data_after_close
+Do we hold off sending a RST until all pending data is ack'd.
+.It Va kill_paceout
+When we hit this many errors in a row, kill the session?
+.It Va error_paceout
+When we hit an error what is the min to pace out in usec's?
+.It Va cheat_rxt
+Do we burst 1ms between sends on retransmissions (like rack)?
+.It Va minrto
+Minimum RTO in ms.
+.El
+.Sh SEE ALSO

svn commit: r366127 - head/share/man/man4

2020-09-24 Thread Gordon Bergling
Author: gbe (doc committer)
Date: Thu Sep 24 19:33:48 2020
New Revision: 366127
URL: https://svnweb.freebsd.org/changeset/base/366127

Log:
  Add a manual page for TCP BBR
  
  Reviewed by:  bcr
  Approved by:  bcr
  Differential Revision:https://reviews.freebsd.org/D24915

Modified:
  head/share/man/man4/Makefile

Modified: head/share/man/man4/Makefile
==
--- head/share/man/man4/MakefileThu Sep 24 19:12:03 2020
(r366126)
+++ head/share/man/man4/MakefileThu Sep 24 19:33:48 2020
(r366127)
@@ -524,6 +524,7 @@ MAN=aac.4 \
tap.4 \
targ.4 \
tcp.4 \
+   tcp_bbr.4 \
tdfx.4 \
terasic_mtl.4 \
termios.4 \
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366126 - head/usr.sbin/daemon

2020-09-24 Thread Maxim Sobolev
Author: sobomax
Date: Thu Sep 24 19:12:03 2020
New Revision: 366126
URL: https://svnweb.freebsd.org/changeset/base/366126

Log:
  Fix a typo in the 366098.
  
  Reported by:  0mp
  MFC after:2 weeks
(along with 366098)

Modified:
  head/usr.sbin/daemon/daemon.8

Modified: head/usr.sbin/daemon/daemon.8
==
--- head/usr.sbin/daemon/daemon.8   Thu Sep 24 18:36:31 2020
(r366125)
+++ head/usr.sbin/daemon/daemon.8   Thu Sep 24 19:12:03 2020
(r366126)
@@ -74,7 +74,7 @@ Close
 and re-open it when signal SIGHUP is received, for interoperability with
 .Xr newsyslog 1
 and similar log rotation / archival mechanisms.  If
-.Fa o
+.Fl o
 is not specified, this flag is ignored.
 .It Fl S
 Enable syslog output.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366123 - head/share/man/man9

2020-09-24 Thread Gordon Bergling
Author: gbe (doc committer)
Date: Thu Sep 24 16:50:14 2020
New Revision: 366123
URL: https://svnweb.freebsd.org/changeset/base/366123

Log:
  crypto_buffer(9): Add a HISTORY and a AUTHORS section
  
  Reviewed by:  jhb
  Approved by:  jhb
  Differential Revision:https://reviews.freebsd.org/D26487

Modified:
  head/share/man/man9/crypto_buffer.9

Modified: head/share/man/man9/crypto_buffer.9
==
--- head/share/man/man9/crypto_buffer.9 Thu Sep 24 16:42:17 2020
(r366122)
+++ head/share/man/man9/crypto_buffer.9 Thu Sep 24 16:50:14 2020
(r366123)
@@ -30,7 +30,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd August 12, 2020
+.Dd September 24, 2020
 .Dt CRYPTO_BUFFER 9
 .Os
 .Sh NAME
@@ -325,3 +325,13 @@ returns true if the request uses a separate output buf
 .Xr crypto_session 9 ,
 .Xr mbuf 9 ,
 .Xr uio 9
+.Sh HISTORY
+The
+.Nm
+functions first appeared in
+.Fx 13 .
+.Sh AUTHORS
+The
+.Nm
+functions and this manual page were written by
+.An John Baldwin Aq Mt j...@freebsd.org .
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r366119 - head/usr.bin/which

2020-09-24 Thread Fernando Apesteguía
On Thu, Sep 24, 2020 at 6:32 PM  wrote:
>
> Fernando Apesteguía wrote:
> > Author: fernape (ports committer)
> > Date: Thu Sep 24 16:11:53 2020
> > New Revision: 366119
> > URL: https://svnweb.freebsd.org/changeset/base/366119
> >
> > Log:
> >which(1): Add EXAMPLES section to manpage
> >
> >Add EXAMPLES section showing the use of -a and -s flags and how which(1)
> >treates duplicates.
> >
> >Approved by:   manpages (gbe@)
> >Differential Revision: https://reviews.freebsd.org/D26182
> >
> > Modified:
> >head/usr.bin/which/which.1
> >
> > Modified: head/usr.bin/which/which.1
> > ==
> > --- head/usr.bin/which/which.1Thu Sep 24 15:38:01 2020
> > (r366118)
> > +++ head/usr.bin/which/which.1Thu Sep 24 16:11:53 2020
> > (r366119)
> > @@ -29,7 +29,7 @@
> >   .\"
> >   .\" $FreeBSD$
> >   .\"
> > -.Dd December 13, 2006
> > +.Dd September 24, 2020
> >   .Dt WHICH 1
> >   .Os
> >   .Sh NAME
> > @@ -62,6 +62,48 @@ command which is similar or identical to this utility.
> >   Consult the
> >   .Xr builtin 1
> >   manual page.
> > +.Sh EXAMPLES
> > +Locate the
> > +.Xr ls 1
> > +and
> > +.Xr cp 1
> > +commands:
> > +.Bd -literal -offset indent
> > +$ /usr/bin/which ls cp
> > +/bin/ls
> > +/bin/cp
> > +.Ed
> > +.Pp
> > +Same as above with a specific
> > +.Va PATH
>
> .Ev ?
>
> > +and showing all occurrences:
> > +.Bd -literal -offset indent
> > +$ PATH=/bin:/rescue /usr/bin/which -a ls cp
> > +/bin/ls
> > +/rescue/ls
> > +/bin/cp
> > +/rescue/cp
> > +.Ed
> > +.Pp
> > +.Nm which
> > +will show duplicates if the same executable is find more than once:
>
> found?

Sorry for that. Fixed in r366122.

Thanks!

>
> > +.Bd -literal -offset indent
> > +$ PATH=/bin:/bin /usr/bin/which -a ls
> > +/bin/ls
> > +/bin/ls
> > +.Ed
> > +.Pp
> > +Do not show output.
> > +Just exit with an appropriate return code:
> > +.Bd -literal -offset indent
> > +$ /usr/bin/which -s ls cp
> > +$ echo $?
> > +0
> > +
> > +$ /usr/bin/which -s fakecommand
> > +$ echo $?
> > +1
> > +.Ed
> >   .Sh SEE ALSO
> >   .Xr builtin 1 ,
> >   .Xr csh 1 ,
>
>
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366122 - head/usr.bin/which

2020-09-24 Thread Fernando Apesteguía
Author: fernape (ports committer)
Date: Thu Sep 24 16:42:17 2020
New Revision: 366122
URL: https://svnweb.freebsd.org/changeset/base/366122

Log:
  Fix typo and environment variable macro
  
  Follow up for r366119
  
  Reported by:  xto...@mm.st
  Differential Revision:https://reviews.freebsd.org/D26182

Modified:
  head/usr.bin/which/which.1

Modified: head/usr.bin/which/which.1
==
--- head/usr.bin/which/which.1  Thu Sep 24 16:27:53 2020(r366121)
+++ head/usr.bin/which/which.1  Thu Sep 24 16:42:17 2020(r366122)
@@ -75,7 +75,7 @@ $ /usr/bin/which ls cp
 .Ed
 .Pp
 Same as above with a specific
-.Va PATH
+.Ev PATH
 and showing all occurrences:
 .Bd -literal -offset indent
 $ PATH=/bin:/rescue /usr/bin/which -a ls cp
@@ -86,7 +86,7 @@ $ PATH=/bin:/rescue /usr/bin/which -a ls cp
 .Ed
 .Pp
 .Nm which
-will show duplicates if the same executable is find more than once:
+will show duplicates if the same executable is found more than once:
 .Bd -literal -offset indent
 $ PATH=/bin:/bin /usr/bin/which -a ls
 /bin/ls
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r366119 - head/usr.bin/which

2020-09-24 Thread xtouqh

Fernando Apesteguía wrote:

Author: fernape (ports committer)
Date: Thu Sep 24 16:11:53 2020
New Revision: 366119
URL: https://svnweb.freebsd.org/changeset/base/366119

Log:
   which(1): Add EXAMPLES section to manpage
   
   Add EXAMPLES section showing the use of -a and -s flags and how which(1)

   treates duplicates.
   
   Approved by:	manpages (gbe@)

   Differential Revision:   https://reviews.freebsd.org/D26182

Modified:
   head/usr.bin/which/which.1

Modified: head/usr.bin/which/which.1
==
--- head/usr.bin/which/which.1  Thu Sep 24 15:38:01 2020(r366118)
+++ head/usr.bin/which/which.1  Thu Sep 24 16:11:53 2020(r366119)
@@ -29,7 +29,7 @@
  .\"
  .\" $FreeBSD$
  .\"
-.Dd December 13, 2006
+.Dd September 24, 2020
  .Dt WHICH 1
  .Os
  .Sh NAME
@@ -62,6 +62,48 @@ command which is similar or identical to this utility.
  Consult the
  .Xr builtin 1
  manual page.
+.Sh EXAMPLES
+Locate the
+.Xr ls 1
+and
+.Xr cp 1
+commands:
+.Bd -literal -offset indent
+$ /usr/bin/which ls cp
+/bin/ls
+/bin/cp
+.Ed
+.Pp
+Same as above with a specific
+.Va PATH


.Ev ?


+and showing all occurrences:
+.Bd -literal -offset indent
+$ PATH=/bin:/rescue /usr/bin/which -a ls cp
+/bin/ls
+/rescue/ls
+/bin/cp
+/rescue/cp
+.Ed
+.Pp
+.Nm which
+will show duplicates if the same executable is find more than once:


found?


+.Bd -literal -offset indent
+$ PATH=/bin:/bin /usr/bin/which -a ls
+/bin/ls
+/bin/ls
+.Ed
+.Pp
+Do not show output.
+Just exit with an appropriate return code:
+.Bd -literal -offset indent
+$ /usr/bin/which -s ls cp
+$ echo $?
+0
+
+$ /usr/bin/which -s fakecommand
+$ echo $?
+1
+.Ed
  .Sh SEE ALSO
  .Xr builtin 1 ,
  .Xr csh 1 ,



___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366121 - in head: sys/fs/fuse tests/sys/fs/fusefs

2020-09-24 Thread Alan Somers
Author: asomers
Date: Thu Sep 24 16:27:53 2020
New Revision: 366121
URL: https://svnweb.freebsd.org/changeset/base/366121

Log:
  fusefs: fix mmap'd writes in direct_io mode
  
  If a FUSE server returns FOPEN_DIRECT_IO in response to FUSE_OPEN, that
  instructs the kernel to bypass the page cache for that file. This feature
  is also known by libfuse's name: "direct_io".
  
  However, when accessing a file via mmap, there is no possible way to bypass
  the cache completely. This change fixes a deadlock that would happen when
  an mmap'd write tried to invalidate a portion of the cache, wrongly assuming
  that a write couldn't possibly come from cache if direct_io were set.
  
  Arguably, we could instead disable mmap for files with FOPEN_DIRECT_IO set.
  But allowing it is less likely to cause user complaints, and is more in
  keeping with the spirit of open(2), where O_DIRECT instructs the kernel to
  "reduce", not "eliminate" cache effects.
  
  PR:   247276
  Reported by:  trape...@spawn.link
  Reviewed by:  cem
  MFC after:3 days
  Differential Revision:https://reviews.freebsd.org/D26485

Modified:
  head/sys/fs/fuse/fuse_io.c
  head/tests/sys/fs/fusefs/write.cc

Modified: head/sys/fs/fuse/fuse_io.c
==
--- head/sys/fs/fuse/fuse_io.c  Thu Sep 24 16:21:30 2020(r366120)
+++ head/sys/fs/fuse/fuse_io.c  Thu Sep 24 16:27:53 2020(r366121)
@@ -291,6 +291,7 @@ fuse_io_dispatch(struct vnode *vp, struct uio *uio, in
fuse_vnode_update(vp, FN_MTIMECHANGE | FN_CTIMECHANGE);
if (directio) {
off_t start, end, filesize;
+   bool pages = (ioflag & IO_VMIO) != 0;
 
SDT_PROBE2(fusefs, , io, trace, 1,
"direct write of vnode");
@@ -301,15 +302,14 @@ fuse_io_dispatch(struct vnode *vp, struct uio *uio, in
 
start = uio->uio_offset;
end = start + uio->uio_resid;
-   KASSERT((ioflag & (IO_VMIO | IO_DIRECT)) !=
-   (IO_VMIO | IO_DIRECT),
-   ("IO_DIRECT used for a cache flush?"));
-   /* Invalidate the write cache when writing directly */
-   err = fuse_inval_buf_range(vp, filesize, start, end);
-   if (err)
-   return (err);
+   if (!pages) {
+   err = fuse_inval_buf_range(vp, filesize, start,
+   end);
+   if (err)
+   return (err);
+   }
err = fuse_write_directbackend(vp, uio, cred, fufh,
-   filesize, ioflag, false);
+   filesize, ioflag, pages);
} else {
SDT_PROBE2(fusefs, , io, trace, 1,
"buffered write of vnode");

Modified: head/tests/sys/fs/fusefs/write.cc
==
--- head/tests/sys/fs/fusefs/write.cc   Thu Sep 24 16:21:30 2020
(r366120)
+++ head/tests/sys/fs/fusefs/write.cc   Thu Sep 24 16:27:53 2020
(r366121)
@@ -923,6 +923,76 @@ TEST_F(WriteBack, o_direct)
leak(fd);
 }
 
+TEST_F(WriteBack, direct_io)
+{
+   const char FULLPATH[] = "mountpoint/some_file.txt";
+   const char RELPATH[] = "some_file.txt";
+   const char *CONTENTS = "abcdefgh";
+   uint64_t ino = 42;
+   int fd;
+   ssize_t bufsize = strlen(CONTENTS);
+   uint8_t readbuf[bufsize];
+
+   expect_lookup(RELPATH, ino, 0);
+   expect_open(ino, FOPEN_DIRECT_IO, 1);
+   FuseTest::expect_write(ino, 0, bufsize, bufsize, 0, FUSE_WRITE_CACHE,
+   CONTENTS);
+   expect_read(ino, 0, bufsize, bufsize, CONTENTS);
+
+   fd = open(FULLPATH, O_RDWR);
+   EXPECT_LE(0, fd) << strerror(errno);
+
+   ASSERT_EQ(bufsize, write(fd, CONTENTS, bufsize)) << strerror(errno);
+   /* A subsequent read must query the daemon because cache is empty */
+   ASSERT_EQ(0, lseek(fd, 0, SEEK_SET)) << strerror(errno);
+   ASSERT_EQ(0, fcntl(fd, F_SETFL, 0)) << strerror(errno);
+   ASSERT_EQ(bufsize, read(fd, readbuf, bufsize)) << strerror(errno);
+   leak(fd);
+}
+
+/*
+ * mmap should still be possible even if the server used direct_io.  Mmap will
+ * still use the cache, though.
+ *
+ * Regression test for bug 247276
+ * https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=247276
+ */
+TEST_F(WriteBack, mmap_direct_io)
+{
+   const char FULLPATH[] = "mountpoint/some_file.txt";
+   const char RELPATH[] = "some_file.txt";
+   const char *CONTENTS = "abcdefgh";
+   uint64_t ino = 42;
+   int fd;
+   size_t len;
+   ssize_t bufsize = 

svn commit: r366119 - head/usr.bin/which

2020-09-24 Thread Fernando Apesteguía
Author: fernape (ports committer)
Date: Thu Sep 24 16:11:53 2020
New Revision: 366119
URL: https://svnweb.freebsd.org/changeset/base/366119

Log:
  which(1): Add EXAMPLES section to manpage
  
  Add EXAMPLES section showing the use of -a and -s flags and how which(1)
  treates duplicates.
  
  Approved by:  manpages (gbe@)
  Differential Revision:https://reviews.freebsd.org/D26182

Modified:
  head/usr.bin/which/which.1

Modified: head/usr.bin/which/which.1
==
--- head/usr.bin/which/which.1  Thu Sep 24 15:38:01 2020(r366118)
+++ head/usr.bin/which/which.1  Thu Sep 24 16:11:53 2020(r366119)
@@ -29,7 +29,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd December 13, 2006
+.Dd September 24, 2020
 .Dt WHICH 1
 .Os
 .Sh NAME
@@ -62,6 +62,48 @@ command which is similar or identical to this utility.
 Consult the
 .Xr builtin 1
 manual page.
+.Sh EXAMPLES
+Locate the
+.Xr ls 1
+and
+.Xr cp 1
+commands:
+.Bd -literal -offset indent
+$ /usr/bin/which ls cp
+/bin/ls
+/bin/cp
+.Ed
+.Pp
+Same as above with a specific
+.Va PATH
+and showing all occurrences:
+.Bd -literal -offset indent
+$ PATH=/bin:/rescue /usr/bin/which -a ls cp
+/bin/ls
+/rescue/ls
+/bin/cp
+/rescue/cp
+.Ed
+.Pp
+.Nm which
+will show duplicates if the same executable is find more than once:
+.Bd -literal -offset indent
+$ PATH=/bin:/bin /usr/bin/which -a ls
+/bin/ls
+/bin/ls
+.Ed
+.Pp
+Do not show output.
+Just exit with an appropriate return code:
+.Bd -literal -offset indent
+$ /usr/bin/which -s ls cp
+$ echo $?
+0
+
+$ /usr/bin/which -s fakecommand
+$ echo $?
+1
+.Ed
 .Sh SEE ALSO
 .Xr builtin 1 ,
 .Xr csh 1 ,
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366118 - head/sys/kern

2020-09-24 Thread Alan Somers
Author: asomers
Date: Thu Sep 24 15:38:01 2020
New Revision: 366118
URL: https://svnweb.freebsd.org/changeset/base/366118

Log:
  Fix some signed/unsigned comparison warnings in NFS
  
  Reviewed by:  rmacklem
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D26533

Modified:
  head/sys/kern/subr_acl_nfs4.c

Modified: head/sys/kern/subr_acl_nfs4.c
==
--- head/sys/kern/subr_acl_nfs4.c   Thu Sep 24 15:34:47 2020
(r366117)
+++ head/sys/kern/subr_acl_nfs4.c   Thu Sep 24 15:38:01 2020
(r366118)
@@ -342,9 +342,9 @@ _acl_append(struct acl *aclp, acl_tag_t tag, acl_perm_
 }
 
 static struct acl_entry *
-_acl_duplicate_entry(struct acl *aclp, int entry_index)
+_acl_duplicate_entry(struct acl *aclp, unsigned entry_index)
 {
-   int i;
+   unsigned i;
 
KASSERT(aclp->acl_cnt + 1 <= ACL_MAX_ENTRIES,
("aclp->acl_cnt + 1 <= ACL_MAX_ENTRIES"));
@@ -361,7 +361,8 @@ static void
 acl_nfs4_sync_acl_from_mode_draft(struct acl *aclp, mode_t mode,
 int file_owner_id)
 {
-   int i, meets, must_append;
+   int meets, must_append;
+   unsigned i;
struct acl_entry *entry, *copy, *previous,
*a1, *a2, *a3, *a4, *a5, *a6;
mode_t amode;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366115 - head/share/man/man4

2020-09-24 Thread Ed Maste
Author: emaste
Date: Thu Sep 24 14:42:22 2020
New Revision: 366115
URL: https://svnweb.freebsd.org/changeset/base/366115

Log:
  mgb.4: add note about experimental status
  
  Also remove HISTORY section until it is connected to the build.

Modified:
  head/share/man/man4/mgb.4

Modified: head/share/man/man4/mgb.4
==
--- head/share/man/man4/mgb.4   Thu Sep 24 12:26:06 2020(r366114)
+++ head/share/man/man4/mgb.4   Thu Sep 24 14:42:22 2020(r366115)
@@ -38,6 +38,10 @@ if_mgb_load="YES"
 .Sh DESCRIPTION
 The
 .Nm
+driver is experimental, and is not yet connected to the build.
+.Pp
+The
+.Nm
 device driver provides support for PCIe Gigabit Ethernet adapters based on
 Microchip's LAN7430 and LAN7431.
 .Pp
@@ -79,8 +83,3 @@ RSS
 .El
 .Pp
 LAN7431 support is completely untested.
-.Sh HISTORY
-The
-.Nm
-device driver first appeared in
-.Fx 13.0 .
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366114 - head/sys/netinet

2020-09-24 Thread Michael Tuexen
Author: tuexen
Date: Thu Sep 24 12:26:06 2020
New Revision: 366114
URL: https://svnweb.freebsd.org/changeset/base/366114

Log:
  Whitespace changes.
  
  MFC after:3 days

Modified:
  head/sys/netinet/sctp_cc_functions.c
  head/sys/netinet/sctp_header.h
  head/sys/netinet/sctp_indata.c
  head/sys/netinet/sctp_lock_bsd.h
  head/sys/netinet/sctp_output.c
  head/sys/netinet/sctp_output.h
  head/sys/netinet/sctp_pcb.c
  head/sys/netinet/sctp_usrreq.c

Modified: head/sys/netinet/sctp_cc_functions.c
==
--- head/sys/netinet/sctp_cc_functions.cThu Sep 24 12:14:25 2020
(r366113)
+++ head/sys/netinet/sctp_cc_functions.cThu Sep 24 12:26:06 2020
(r366114)
@@ -1313,8 +1313,7 @@ sctp_cwnd_update_rtcc_after_ecn_echo(struct sctp_tcb *
sctp_cwnd_update_after_ecn_echo_common(stcb, net, in_window, 
num_pkt_lost, 1);
 }
 
-static
-void
+static void
 sctp_cwnd_update_rtcc_tsn_acknowledged(struct sctp_nets *net,
 struct sctp_tmit_chunk *tp1)
 {
@@ -1431,7 +1430,6 @@ sctp_set_rtcc_initial_cc_param(struct sctp_tcb *stcb,
net->cc_mod.rtcc.use_dccc_ecn = SCTP_BASE_SYSCTL(sctp_use_dccc_ecn);
net->cc_mod.rtcc.step_cnt = 0;
net->cc_mod.rtcc.last_step_state = 0;
-
 }
 
 static int
@@ -2041,7 +2039,7 @@ htcp_cong_avoid(struct sctp_tcb *stcb, struct sctp_net
 {
/*-
 * How to handle these functions?
- * if (!tcp_is_cwnd_limited(sk, in_flight)) RRS - good question.
+*  if (!tcp_is_cwnd_limited(sk, in_flight)) RRS - good question.
 *  return;
 */
if (net->cwnd <= net->ssthresh) {

Modified: head/sys/netinet/sctp_header.h
==
--- head/sys/netinet/sctp_header.h  Thu Sep 24 12:14:25 2020
(r366113)
+++ head/sys/netinet/sctp_header.h  Thu Sep 24 12:26:06 2020
(r366114)
@@ -530,41 +530,41 @@ struct sctp_auth_chunk {
 #ifndef SCTP_MAX_OVERHEAD
 #ifdef INET6
 #define SCTP_MAX_OVERHEAD (sizeof(struct sctp_data_chunk) + \
-  sizeof(struct sctphdr) + \
-  sizeof(struct sctp_ecne_chunk) + \
-  sizeof(struct sctp_sack_chunk) + \
-  sizeof(struct ip6_hdr))
+   sizeof(struct sctphdr) + \
+   sizeof(struct sctp_ecne_chunk) + \
+   sizeof(struct sctp_sack_chunk) + \
+   sizeof(struct ip6_hdr))
 
 #define SCTP_MED_OVERHEAD (sizeof(struct sctp_data_chunk) + \
-  sizeof(struct sctphdr) + \
-  sizeof(struct ip6_hdr))
+   sizeof(struct sctphdr) + \
+   sizeof(struct ip6_hdr))
 
 #define SCTP_MIN_OVERHEAD (sizeof(struct ip6_hdr) + \
-  sizeof(struct sctphdr))
+   sizeof(struct sctphdr))
 
 #else
 #define SCTP_MAX_OVERHEAD (sizeof(struct sctp_data_chunk) + \
-  sizeof(struct sctphdr) + \
-  sizeof(struct sctp_ecne_chunk) + \
-  sizeof(struct sctp_sack_chunk) + \
-  sizeof(struct ip))
+   sizeof(struct sctphdr) + \
+   sizeof(struct sctp_ecne_chunk) + \
+   sizeof(struct sctp_sack_chunk) + \
+   sizeof(struct ip))
 
 #define SCTP_MED_OVERHEAD (sizeof(struct sctp_data_chunk) + \
-  sizeof(struct sctphdr) + \
-  sizeof(struct ip))
+   sizeof(struct sctphdr) + \
+   sizeof(struct ip))
 
 #define SCTP_MIN_OVERHEAD (sizeof(struct ip) + \
-  sizeof(struct sctphdr))
+   sizeof(struct sctphdr))
 
 #endif /* INET6 */
 #endif /* !SCTP_MAX_OVERHEAD */
 
 #define SCTP_MED_V4_OVERHEAD (sizeof(struct sctp_data_chunk) + \
- sizeof(struct sctphdr) + \
- sizeof(struct ip))
+  sizeof(struct sctphdr) + \
+  sizeof(struct ip))
 
 #define SCTP_MIN_V4_OVERHEAD (sizeof(struct ip) + \
- sizeof(struct sctphdr))
+  sizeof(struct sctphdr))
 
 #undef SCTP_PACKED
 #endif /* !__sctp_header_h__ */

Modified: head/sys/netinet/sctp_indata.c
==
--- head/sys/netinet/sctp_indata.c  Thu Sep 24 12:14:25 2020
(r366113)
+++ head/sys/netinet/sctp_indata.c  Thu Sep 24 12:26:06 2020
(r366114)
@@ -2532,7 +2532,6 @@ sctp_slide_mapping_arrays(struct sctp_tcb *stcb)
 * 

Re: svn commit: r365643 - head/bin/cp

2020-09-24 Thread Kyle Evans
On Thu, Sep 24, 2020 at 3:08 AM Stefan Esser  wrote:
>
> Am 24.09.20 um 08:54 schrieb Warner Losh:
> >
> >
> > On Thu, Sep 24, 2020 at 12:41 AM Stefan Esser  > > wrote:
> >
> > Am 23.09.20 um 19:23 schrieb Warner Losh> But for this issue, we're not
> > mounting devfs early enough.  We should
> >  > fix that. Removing /dev/null from the boot process likely is
> > never going
> >  > to happen because we use it all over the place to discard output...
> >  > There's ~200 instances of it in the boot rc scripts, so getting
> > rid of
> >  > it there would also be quite the effort, with the same question.
> >
> > Removal of /dev/null from rc.d scripts should be quite simple,
> > since most cases could just use ">-" (close file descriptor)
> > instead. Other usage could be substituted with ":>" followed
> > by chown.
> >
> >
> > So closing fd1 and fd2 doesn't cause them to be available for these
> > programs to get as an fd on open, causing other issues?
> >
> > But >- isn't documented in sh(1) as doing the close thing. On a whim I
> > did the following:
> > $ echo fred >-
> > $ ls -last ./-
> > 4 -rw-r--r--  1 imp  imp  5 Sep 24 00:50 ./-
> > $ cat ./-
> > fred
> > $
> > which suggests maybe you now have a lot of files named - instead...
>
> Yes, sorry, please ignore what I wrote - I was thinking of ">&-" of
> course, but that is not gracefully accepted by many commands (they
> are aborted when trying to write to the closed file descriptor).
>
> I had thought about piping into a command that ignores STDIN, first,
> e.g. "| :", but that generates a SIGPIPE when trying to flush the
> FILE buffer (i.e. after 4 KB, which might be sufficient for most
> cases, but it is not a general solution).
>
> A program that reads from STDIN and generates no output could be used,
> though, e.g. "| sed d".
>
> But this would cause lots of extra forked processes and increase the
> start-up time and is not acceptable.
>
> > but e.g. rc.d/syscons
> > uses ${kbddev} (i.e. /dev/ttyv0) and rc.d/zvol performs swapon
> > on /dev/zvol/${name}, rc.d/random uses /dev/random and so on.
> >
> > So those interactions should be disaled by rc variables...  Or we should
> > be failing the operation...
>
> Going multi-user should not be stopped by any of the rc scripts
> failing due to lack of /dev. But since most developers will only
> test with /dev available, there is a risk that changes to rc files
> will not gracefully handle a missing /dev.
>

I was under the impression from previous reading and kib's response
that this is a complete non-issue, there's no way you can go
multi-user without a mounted /dev and we go to somewhat great lengths
to make sure we're good.

I agree with the previous goal of ripping the /dev dependency out of
the build, but this is also much, much easier said than done.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366113 - head/sys/kern

2020-09-24 Thread Konstantin Belousov
Author: kib
Date: Thu Sep 24 12:14:25 2020
New Revision: 366113
URL: https://svnweb.freebsd.org/changeset/base/366113

Log:
  Remove pointless local variable.
  
  Reported by:  alc
  Sponsored by: The FreeBSD Foundation
  MFC after:6 days

Modified:
  head/sys/kern/kern_exec.c

Modified: head/sys/kern/kern_exec.c
==
--- head/sys/kern/kern_exec.c   Thu Sep 24 10:57:39 2020(r366112)
+++ head/sys/kern/kern_exec.c   Thu Sep 24 12:14:25 2020(r366113)
@@ -968,11 +968,8 @@ exec_fail:
 void
 exec_cleanup(struct thread *td, struct vmspace *oldvmspace)
 {
-   struct proc *p;
-
-   p = td->td_proc;
if ((td->td_pflags & TDP_EXECVMSPC) != 0) {
-   KASSERT(p->p_vmspace != oldvmspace,
+   KASSERT(td->td_proc->p_vmspace != oldvmspace,
("oldvmspace still used"));
vmspace_free(oldvmspace);
td->td_pflags &= ~TDP_EXECVMSPC;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366112 - in head/sys: dev/ath dev/bwn dev/iwn dev/malo dev/mwl net80211

2020-09-24 Thread Bjoern A. Zeeb
Author: bz
Date: Thu Sep 24 10:57:39 2020
New Revision: 366112
URL: https://svnweb.freebsd.org/changeset/base/366112

Log:
  Provide MS() and SM() macros for 80211 and wireless drivers.
  
  We have (two versions) of MS() and SM() macros which we use throughout
  the wireless code.  Change all but three places (ath_hal, rtwn, and rsu)
  to the newly provided _IEEE80211_MASKSHIFT() and _IEEE80211_SHIFTMASK()
  macros.  Also change one internal case using both _S and _M instead of
  just _S away from _M (one of the reasons rtwn and rsu were not changed).
  
  This was done semi-mechanically.  No functional changes intended.
  
  Requested by: gnn (D26091)
  Reviewed by:  adrian (pre line wrap)
  MFC after:2 weeks
  Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate")
  Differential Revision:https://reviews.freebsd.org/D26539

Modified:
  head/sys/dev/ath/if_ath_tx.c
  head/sys/dev/ath/if_ath_tx_ht.c
  head/sys/dev/bwn/if_bwn.c
  head/sys/dev/iwn/if_iwn.c
  head/sys/dev/malo/if_malo.c
  head/sys/dev/mwl/if_mwl.c
  head/sys/net80211/ieee80211_freebsd.c
  head/sys/net80211/ieee80211_ht.c
  head/sys/net80211/ieee80211_ioctl.c
  head/sys/net80211/ieee80211_output.c
  head/sys/net80211/ieee80211_regdomain.c
  head/sys/net80211/ieee80211_sta.c
  head/sys/net80211/ieee80211_superg.c
  head/sys/net80211/ieee80211_var.h
  head/sys/net80211/ieee80211_vht.c

Modified: head/sys/dev/ath/if_ath_tx.c
==
--- head/sys/dev/ath/if_ath_tx.cThu Sep 24 10:42:28 2020
(r366111)
+++ head/sys/dev/ath/if_ath_tx.cThu Sep 24 10:57:39 2020
(r366112)
@@ -2598,7 +2598,6 @@ ieee80211_is_action(struct ieee80211_frame *wh)
return 1;
 }
 
-#defineMS(_v, _f)  (((_v) & _f) >> _f##_S)
 /*
  * Return an alternate TID for ADDBA request frames.
  *
@@ -2637,11 +2636,10 @@ ath_tx_action_frame_override_queue(struct ath_softc *s
 
/* Extract TID, return it */
baparamset = le16toh(ia->rq_baparamset);
-   *tid = (int) MS(baparamset, IEEE80211_BAPS_TID);
+   *tid = (int) _IEEE80211_MASKSHIFT(baparamset, IEEE80211_BAPS_TID);
 
return 1;
 }
-#undef MS
 
 /* Per-node software queue operations */
 

Modified: head/sys/dev/ath/if_ath_tx_ht.c
==
--- head/sys/dev/ath/if_ath_tx_ht.c Thu Sep 24 10:42:28 2020
(r366111)
+++ head/sys/dev/ath/if_ath_tx_ht.c Thu Sep 24 10:57:39 2020
(r366112)
@@ -406,7 +406,6 @@ static int
 ath_compute_num_delims(struct ath_softc *sc, struct ath_buf *first_bf,
 uint16_t pktlen, int is_first)
 {
-#defineMS(_v, _f)  (((_v) & _f) >> _f##_S)
const HAL_RATE_TABLE *rt = sc->sc_currates;
struct ieee80211_node *ni = first_bf->bf_node;
struct ieee80211vap *vap = ni->ni_vap;
@@ -421,7 +420,8 @@ ath_compute_num_delims(struct ath_softc *sc, struct at
/*
 * Get the advertised density from the node.
 */
-   peer_mpdudensity = MS(ni->ni_htparam, IEEE80211_HTCAP_MPDUDENSITY);
+   peer_mpdudensity =
+   _IEEE80211_MASKSHIFT(ni->ni_htparam, IEEE80211_HTCAP_MPDUDENSITY);
 
/*
 * vap->iv_ampdu_density is a net80211 value, rather than the actual
@@ -528,7 +528,6 @@ ath_compute_num_delims(struct ath_softc *sc, struct at
__func__, pktlen, minlen, rix, rc, width, half_gi, ndelim);
 
return ndelim;
-#undef MS
 }
 
 /*
@@ -568,7 +567,6 @@ ath_get_aggr_limit(struct ath_softc *sc, struct ieee80
 {
struct ieee80211vap *vap = ni->ni_vap;
 
-#defineMS(_v, _f)  (((_v) & _f) >> _f##_S)
int amin = ATH_AGGR_MAXSIZE;
int i;
 
@@ -583,8 +581,8 @@ ath_get_aggr_limit(struct ath_softc *sc, struct ieee80
 * Check the HTCAP field for the maximum size the node has
 * negotiated.  If it's smaller than what we have, cap it there.
 */
-   amin = MIN(amin, ath_rx_ampdu_to_byte(MS(ni->ni_htparam,
-   IEEE80211_HTCAP_MAXRXAMPDU)));
+   amin = MIN(amin, ath_rx_ampdu_to_byte(
+   _IEEE80211_MASKSHIFT(ni->ni_htparam, IEEE80211_HTCAP_MAXRXAMPDU)));
 
for (i = 0; i < ATH_RC_NUM; i++) {
if (bf->bf_state.bfs_rc[i].tries == 0)
@@ -598,11 +596,10 @@ ath_get_aggr_limit(struct ath_softc *sc, struct ieee80
__func__,
sc->sc_aggr_limit,
vap->iv_ampdu_limit,
-   MS(ni->ni_htparam, IEEE80211_HTCAP_MAXRXAMPDU),
+   _IEEE80211_MASKSHIFT(ni->ni_htparam, IEEE80211_HTCAP_MAXRXAMPDU),
amin);
 
return amin;
-#undef MS
 }
 
 /*

Modified: head/sys/dev/bwn/if_bwn.c
==
--- head/sys/dev/bwn/if_bwn.c   Thu Sep 24 10:42:28 2020(r366111)
+++ head/sys/dev/bwn/if_bwn.c   Thu Sep 24 10:57:39 2020(r366112)
@@ -2122,7 +2122,6 @@ bwn_stop(struct bwn_softc *sc)
 

svn commit: r366111 - head/sys/arm64/arm64

2020-09-24 Thread Andrew Turner
Author: andrew
Date: Thu Sep 24 10:42:28 2020
New Revision: 366111
URL: https://svnweb.freebsd.org/changeset/base/366111

Log:
  Clean up the arm64 bus_dma_run_filter
  
   - We can exit the loop as soon as the filter check passes.
   - The alignment check has already passed so there is no need to also run
 it here.
  
  Sponsored by: Innovate UK

Modified:
  head/sys/arm64/arm64/busdma_machdep.c

Modified: head/sys/arm64/arm64/busdma_machdep.c
==
--- head/sys/arm64/arm64/busdma_machdep.c   Thu Sep 24 10:40:49 2020
(r366110)
+++ head/sys/arm64/arm64/busdma_machdep.c   Thu Sep 24 10:42:28 2020
(r366111)
@@ -99,19 +99,17 @@ bus_dma_dflt_lock(void *arg, bus_dma_lock_op_t op)
 int
 bus_dma_run_filter(struct bus_dma_tag_common *tc, bus_addr_t paddr)
 {
-   int retval;
 
-   retval = 0;
-   do {
-   if (((paddr > tc->lowaddr && paddr <= tc->highaddr) ||
-   ((paddr & (tc->alignment - 1)) != 0)) &&
+   while (tc != NULL) {
+   if ((paddr > tc->lowaddr && paddr <= tc->highaddr) &&
(tc->filter == NULL ||
(*tc->filter)(tc->filterarg, paddr) != 0))
-   retval = 1;
+   return (1);
 
tc = tc->parent;
-   } while (retval == 0 && tc != NULL);
-   return (retval);
+   }
+
+   return (0);
 }
 
 int
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366110 - head/sys/arm64/arm64

2020-09-24 Thread Andrew Turner
Author: andrew
Date: Thu Sep 24 10:40:49 2020
New Revision: 366110
URL: https://svnweb.freebsd.org/changeset/base/366110

Log:
  Ensure arm64 DMA alignment is passed from parents to children
  
  This ensures the alignment check will take these alignments into account.
  
  Sponsored by: Innovate UK

Modified:
  head/sys/arm64/arm64/busdma_machdep.c

Modified: head/sys/arm64/arm64/busdma_machdep.c
==
--- head/sys/arm64/arm64/busdma_machdep.c   Thu Sep 24 09:06:04 2020
(r366109)
+++ head/sys/arm64/arm64/busdma_machdep.c   Thu Sep 24 10:40:49 2020
(r366110)
@@ -167,6 +167,7 @@ common_bus_dma_tag_create(struct bus_dma_tag_common *p
common->impl = parent->impl;
common->lowaddr = MIN(parent->lowaddr, common->lowaddr);
common->highaddr = MAX(parent->highaddr, common->highaddr);
+   common->alignment = MAX(parent->alignment, common->alignment);
if (common->boundary == 0)
common->boundary = parent->boundary;
else if (parent->boundary != 0) {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366109 - in head/share/syscons: fonts keymaps

2020-09-24 Thread Stefan Eßer
Author: se
Date: Thu Sep 24 09:06:04 2020
New Revision: 366109
URL: https://svnweb.freebsd.org/changeset/base/366109

Log:
  Add danish translations provided by GitHub user scootergriesen
  
  These translations did already exist in the index files for "vt".
  
  Obtained from:https://github.com/scootergrisen/freebsd/

Modified:
  head/share/syscons/fonts/INDEX.fonts
  head/share/syscons/keymaps/INDEX.keymaps

Modified: head/share/syscons/fonts/INDEX.fonts
==
--- head/share/syscons/fonts/INDEX.fontsThu Sep 24 08:51:23 2020
(r366108)
+++ head/share/syscons/fonts/INDEX.fontsThu Sep 24 09:06:04 2020
(r366109)
@@ -49,6 +49,7 @@
 # Language support: MENU, FONT
 #
 MENU:en:Choose your keyboard font
+MENU:da:V�lg din skrifttype for tastaturet
 MENU:de:W�hlen Sie Ihre Schrift
 MENU:fr:Choisissez votre fonte �cran
 MENU:pl:Wybierz czcionk� ekranow�
@@ -71,109 +72,128 @@ FONT:hy:armscii8-8x16.fnt
 armscii8-8x16.fnt:hy:ARMSCII-8 �ṳ���ٳ� �۳�, 8x16
 armscii8-8x16.fnt:ru:� ARMSCII-8, 8x16
 armscii8-8x16.fnt:en:ARMSCII-8 Character set, 8x16
+armscii8-8x16.fnt:da:ARMSCII-8-tegns�t, 8x16
 armscii8-8x16.fnt:de:ARMSCII-8 Zeichensatz, 8x16
 
 armscii8-8x14.fnt:hy:ARMSCII-8 �ṳ���ٳ� �۳�, 8x14
 armscii8-8x14.fnt:ru:� ARMSCII-8, 8x14
 armscii8-8x14.fnt:en:ARMSCII-8 Character set, 8x14
+armscii8-8x14.fnt:da:ARMSCII-8-tegns�t, 8x14
 armscii8-8x14.fnt:de:ARMSCII-8 Zeichensatz, 8x14
 
 armscii8-8x8.fnt:hy:ARMSCII-8 �ṳ���ٳ� �۳�, 8x8
 armscii8-8x8.fnt:ru:� ARMSCII-8, 8x8
 armscii8-8x8.fnt:en:ARMSCII-8 Character set, 8x8
+armscii8-8x8.fnt:da:ARMSCII-8-tegns�t, 8x8
 armscii8-8x8.fnt:de:ARMSCII-8 Zeichensatz, 8x8
 
 cp437-8x14.fnt:en:Codepage 437 English, 8x14
+cp437-8x14.fnt:da:Codepage 437 engelsk, 8x14
 cp437-8x14.fnt:de:Codeseite 437 Englisch, 8x14
 cp437-8x14.fnt:fr:Code page 437 Anglais, 8x14
 cp437-8x14.fnt:es:P�gina de c�digos 437 ingl�s, 8x14
 cp437-8x14.fnt:uk:� 437 ���̦��, 8x14
 
 cp437-8x16.fnt:en:Codepage 437 English, 8x16
+cp437-8x16.fnt:da:Codepage 437 engelsk, 8x16
 cp437-8x16.fnt:de:Codeseite 437 Englisch, 8x16
 cp437-8x16.fnt:fr:Code page 437 Anglais, 8x16
 cp437-8x16.fnt:es:P�gina de c�digos 437 ingl�s, 8x16
 cp437-8x16.fnt:uk:� 437 ���̦��, 8x16
 
 cp437-thin-8x16.fnt:en:Codepage 437 English, 8x16 (thin)
+cp437-thin-8x16.fnt:da:Codepage 437 engelsk, 8x16 (smal)
 cp437-thin-8x16.fnt:de:Codeseite 437 Englisch, 8x16 (d�nn)
 cp437-thin-8x16.fnt:fr:Code page 437 Anglais, 8x16 (d�nn)
 cp437-thin-8x16.fnt:es:P�gina de c�digos 437 ingl�s, 8x16 (fina)
 cp437-thin-8x16.fnt:uk:� 437 ���̦��, 8x16 (��)
 
 cp437-8x8.fnt:en:Codepage 437 English, 8x8
+cp437-8x8.fnt:da:Codepage 437 engelsk, 8x8
 cp437-8x8.fnt:de:Codeseite 437 Englisch, 8x8
 cp437-8x8.fnt:fr:Code page 437 Anglais, 8x8
 cp437-8x8.fnt:es:P�gina de c�digos 437 ingl�s, 8x8
 cp437-8x8.fnt:uk:� 437 ���̦��, 8x8
 
 cp437-thin-8x8.fnt:en:Codepage 437 English, 8x8 (thin)
+cp437-thin-8x8.fnt:da:Codepage 437 engelsk, 8x8 (smal)
 cp437-thin-8x8.fnt:de:Codeseite 437 Englisch, 8x8 (d�nn)
 cp437-thin-8x8.fnt:fr:Code page 437 Anglais, 8x8 (d�nn)
 cp437-thin-8x8.fnt:es:P�gina de c�digos 437 ingl�s, 8x8 (fina)
 cp437-thin-8x8.fnt:uk:� 437 ���̦��, 8x8 (��)
 
 cp850-8x14.fnt:en:Codepage 850 Multilingual Latin I, 8x14
+cp850-8x14.fnt:da:Codepage 850 flersproget latinsk I, 8x14
 cp850-8x14.fnt:de:Codeseite 850 Mehrsprachig (Lateinisch I), 8x14
 cp850-8x14.fnt:fr:Latin multilingual I, 8x14
 cp850-8x14.fnt:es:P�gina de c�digos 850 multiling�e, 8x14
 cp850-8x14.fnt:uk:� 850  I, 8x14
 
 cp850-8x16.fnt:en:Codepage 850 Multilingual Latin I, 8x16
+cp850-8x16.fnt:da:Codepage 850 flersproget latinsk I, 8x16
 cp850-8x16.fnt:de:Codeseite 850 Mehrsprachig (Lateinisch I), 8x16
 cp850-8x16.fnt:fr:Latin multilingual I, 8x16
 cp850-8x16.fnt:es:P�gina de c�digos 850 multiling�e, 8x16
 cp850-8x16.fnt:uk:� 850  I, 8x16
 
 cp850-thin-8x16.fnt:en:Codepage 850 Multilingual Latin I, 8x16 (thin)
+cp850-thin-8x16.fnt:da:Codepage 850 flersproget latinsk I, 8x16 (smal)
 cp850-thin-8x16.fnt:de:Codeseite 850 Mehrsprachig (Lateinisch I), 8x16 (d�nn)
 cp850-thin-8x16.fnt:fr:Latin multilingual I, 8x16 (fine)
 cp850-thin-8x16.fnt:es:P�gina de c�digos 850 multiling�e, 8x16 (fina)
 cp850-thin-8x16.fnt:uk:� 850  I, 8x16 (��)
 
 cp850-8x8.fnt:en:Codepage 850 Multilingual Latin I, 8x8
+cp850-8x8.fnt:da:Codepage 850 flersproget latinsk I, 8x8
 cp850-8x8.fnt:de:Codeseite 850 Mehrsprachig (Lateinisch I), 8x8
 cp850-8x8.fnt:fr:Latin multilingual I, 8x8
 cp850-8x8.fnt:es:P�gina de c�digos 850 multiling�e, 8x8
 cp850-8x8.fnt:uk:� 850  I, 8x8
 
 cp850-thin-8x8.fnt:en:Codepage 850 Multilingual Latin I, 8x8 (thin)
+cp850-thin-8x8.fnt:da:Codepage 850 flersproget latinsk I, 8x8 (smal)
 cp850-thin-8x8.fnt:de:Codeseite 850 Mehrsprachig (Lateinisch I), 8x8 (d�nn)
 cp850-thin-8x8.fnt:fr:Latin 

Re: svn commit: r365899 - in head: share/man/man9 sys/arm/include sys/arm64/arm64 sys/arm64/include sys/kern sys/mips/include sys/powerpc/include sys/riscv/include sys/sys sys/tools sys/x86/include

2020-09-24 Thread Michal Meloun


On 22.09.2020 7:18, Ravi Pokala wrote:
> This breaks amd64.GENERIC-KCSAN:
I’m sorry, seems that I forgotten to  run GENERIC-KCSAN build
additionally to universe  build also for the final version of  this
change. Thanks for report and sorry for troubles.
Fixed in r366107.

Michal

> 
> ${SRCTOP}/sys/kern/subr_csan.c:895:1: error: implicit declaration of function 
> 'bus_space_peek_8' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
> CSAN_BUS_PEEK_FUNC(8, uint64_t)
> ^
> ${SRCTOP}/sys/kern/subr_csan.c:888:11: note: expanded from macro 
> 'CSAN_BUS_PEEK_FUNC'
> return (bus_space_peek_##width(tag, hnd, offset, value)); \
> ^
> :56:1: note: expanded from here
> bus_space_peek_8
> ^
> ${SRCTOP}/sys/kern/subr_csan.c:909:1: error: implicit declaration of function 
> 'bus_space_poke_8' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
> CSAN_BUS_POKE_FUNC(8, uint64_t)
> ^
> ${SRCTOP}/sys/kern/subr_csan.c:902:11: note: expanded from macro 
> 'CSAN_BUS_POKE_FUNC'
> return (bus_space_poke_##width(tag, hnd, offset, value)); \
> ^
> :64:1: note: expanded from here
> bus_space_poke_8
> ^
> 2 errors generated.
> --- subr_csan.o ---
> *** [subr_csan.o] Error code 1
> 
> 
> Thanks,
> 
> Ravi (rpokala@)
> 
> -Original Message-
> From:  on behalf of Michal Meloun 
> 
> Date: 2020-09-19, Saturday at 04:06
> To: , , 
> 
> Subject: svn commit: r365899 - in head: share/man/man9 sys/arm/include 
> sys/arm64/arm64 sys/arm64/include sys/kern sys/mips/include 
> sys/powerpc/include sys/riscv/include sys/sys sys/tools sys/x86/include
> 
> Author: mmel
> Date: Sat Sep 19 11:06:41 2020
> New Revision: 365899
> URL: https://svnweb.freebsd.org/changeset/base/365899
> 
> Log:
>   Add NetBSD compatible bus_space_peek_N() and bus_space_poke_N() 
> functions.
>   One problem with the bus_space_read_N() and bus_space_write_N() family 
> of
>   functions is that they provide no protection against exceptions which 
> can
>   occur when no physical hardware or device responds to the read or write
>   cycles. In such a situation, the system typically would panic due to a
>   kernel-mode bus error. The bus_space_peek_N() and bus_space_poke_N() 
> family
>   of functions provide a mechanism to handle these exceptions gracefully
>   without the risk of crashing the system.
> 
>   Typical example is access to PCI(e) configuration space in bus 
> enumeration
>   function on badly implemented PCI(e) root complexes (RK3399 or Neoverse
>   N1 N1SDP and/or access to PCI(e) register when device is in deep sleep 
> state.
> 
>   This commit adds a real implementation for arm64 only. The remaining
>   architectures have bus_space_peek()/bus_space_poke() emulated by using
>   bus_space_read()/bus_space_write() (without exception handling).
> 
>   MFC after:  1 month
>   Reviewed by:kib
>   Differential Revision:  https://reviews.freebsd.org/D25371
> 
> Modified:
>   head/share/man/man9/bus_space.9
>   head/sys/arm/include/bus.h
>   head/sys/arm64/arm64/bus_machdep.c
>   head/sys/arm64/arm64/bus_space_asm.S
>   head/sys/arm64/arm64/trap.c
>   head/sys/arm64/include/bus.h
>   head/sys/arm64/include/md_var.h
>   head/sys/kern/subr_csan.c
>   head/sys/mips/include/bus.h
>   head/sys/powerpc/include/bus.h
>   head/sys/riscv/include/bus.h
>   head/sys/sys/_cscan_bus.h
>   head/sys/sys/bus.h
>   head/sys/tools/bus_macro.sh
>   head/sys/x86/include/bus.h
> 
> Modified: head/share/man/man9/bus_space.9
> 
> ==
> --- head/share/man/man9/bus_space.9   Sat Sep 19 02:15:56 2020
> (r365898)
> +++ head/share/man/man9/bus_space.9   Sat Sep 19 11:06:41 2020
> (r365899)
> @@ -52,7 +52,7 @@
>  .\"
>  .\" $FreeBSD$
>  .\"
> -.Dd January 15, 2017
> +.Dd July 7, 2020
>  .Dt BUS_SPACE 9
>  .Os
>  .Sh NAME
> @@ -68,6 +68,14 @@
>  .Nm bus_space_copy_region_stream_8 ,
>  .Nm bus_space_free ,
>  .Nm bus_space_map ,
> +.Nm bus_space_peek_1 ,
> +.Nm bus_space_peek_2 ,
> +.Nm bus_space_peek_4 ,
> +.Nm bus_space_peek_8 ,
> +.Nm bus_space_poke_1 ,
> +.Nm bus_space_poke_2 ,
> +.Nm bus_space_poke_4 ,
> +.Nm bus_space_poke_8 ,
>  .Nm bus_space_read_1 ,
>  .Nm bus_space_read_2 ,
>  .Nm bus_space_read_4 ,
> @@ -161,6 +169,46 @@
>  .Fo bus_space_free
>  .Fa "bus_space_tag_t space" "bus_space_handle_t handle" "bus_size_t size"
>  .Fc
> +.Ft int
> +.Fo bus_space_peek_1
> +.Fa "bus_space_tag_t space" "bus_space_handle_t handle" "bus_size_t 
> offset"
> +.Fa "uint8_t 

svn commit: r366108 - head/share/man/man5

2020-09-24 Thread Li-Wen Hsu
Author: lwhsu
Date: Thu Sep 24 08:51:23 2020
New Revision: 366108
URL: https://svnweb.freebsd.org/changeset/base/366108

Log:
  Regen after r365903
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/share/man/man5/src.conf.5

Modified: head/share/man/man5/src.conf.5
==
--- head/share/man/man5/src.conf.5  Thu Sep 24 08:40:32 2020
(r366107)
+++ head/share/man/man5/src.conf.5  Thu Sep 24 08:51:23 2020
(r366108)
@@ -987,8 +987,8 @@ Enable building
 with support for verification based on certificates obtained from UEFI.
 .Pp
 .It Va WITH_LOADER_FIREWIRE
-Enable firewire support in /boot/loader on x86. This option is a nop
-on all other platforms.
+Enable firewire support in /boot/loader on x86.
+This option is a nop on all other platforms.
 .It Va WITHOUT_LOADER_GELI
 Disable inclusion of GELI crypto support in the boot chain binaries.
 .Pp
@@ -1033,7 +1033,6 @@ arm/armv6, arm/armv7, mips/mips, mips/mips64, powerpc/
 Set to build with extra verbose debugging in the loader.
 May explode already nearly too large loader over the limit.
 Use with care.
-
 .It Va WITH_LOADER_VERIEXEC
 Enable building
 .Xr loader 8
@@ -1270,7 +1269,6 @@ This is a default setting on
 arm/armv6, arm/armv7, mips/mips, mips/mips64, powerpc/powerpc, riscv/riscv64 
and riscv/riscv64sf.
 .It Va WITH_NVME
 Set to build nvme related tools and kernel modules.
-
 .Pp
 This is a default setting on
 amd64/amd64, arm64/aarch64, i386/i386 and powerpc/powerpc64.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366107 - head/sys/x86/include

2020-09-24 Thread Michal Meloun
Author: mmel
Date: Thu Sep 24 08:40:32 2020
New Revision: 366107
URL: https://svnweb.freebsd.org/changeset/base/366107

Log:
  Add missing declarations of 64-bit variants of bus_peek/bus_poke on amd64.
  It fixes GENERIC-KCSAN build.
  
  Reported by:  rpokala
  MFC after:1 month
  MFC with: r365899

Modified:
  head/sys/x86/include/bus.h

Modified: head/sys/x86/include/bus.h
==
--- head/sys/x86/include/bus.h  Thu Sep 24 07:17:05 2020(r366106)
+++ head/sys/x86/include/bus.h  Thu Sep 24 08:40:32 2020(r366107)
@@ -1102,6 +1102,9 @@ bus_space_barrier(bus_space_tag_t tag __unused, bus_sp
 BUS_PEEK_FUNC(1, uint8_t)
 BUS_PEEK_FUNC(2, uint16_t)
 BUS_PEEK_FUNC(4, uint32_t)
+#ifdef __amd64__
+BUS_PEEK_FUNC(8, uint64_t)
+#endif
 
 #define BUS_POKE_FUNC(width, type) \
static inline int   \
@@ -1114,6 +1117,9 @@ BUS_PEEK_FUNC(4, uint32_t)
 BUS_POKE_FUNC(1, uint8_t)
 BUS_POKE_FUNC(2, uint16_t)
 BUS_POKE_FUNC(4, uint32_t)
+#ifdef __amd64__
+BUS_POKE_FUNC(8, uint64_t)
+#endif
 
 #endif /* KCSAN && !KCSAN_RUNTIME */
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r365643 - head/bin/cp

2020-09-24 Thread Stefan Esser

Am 24.09.20 um 08:54 schrieb Warner Losh:



On Thu, Sep 24, 2020 at 12:41 AM Stefan Esser > wrote:


Am 23.09.20 um 19:23 schrieb Warner Losh> But for this issue, we're not
mounting devfs early enough.  We should
 > fix that. Removing /dev/null from the boot process likely is
never going
 > to happen because we use it all over the place to discard output...
 > There's ~200 instances of it in the boot rc scripts, so getting
rid of
 > it there would also be quite the effort, with the same question.

Removal of /dev/null from rc.d scripts should be quite simple,
since most cases could just use ">-" (close file descriptor)
instead. Other usage could be substituted with ":>" followed
by chown.


So closing fd1 and fd2 doesn't cause them to be available for these 
programs to get as an fd on open, causing other issues?


But >- isn't documented in sh(1) as doing the close thing. On a whim I 
did the following:

$ echo fred >-
$ ls -last ./-
4 -rw-r--r--  1 imp  imp  5 Sep 24 00:50 ./-
$ cat ./-
fred
$
which suggests maybe you now have a lot of files named - instead...


Yes, sorry, please ignore what I wrote - I was thinking of ">&-" of
course, but that is not gracefully accepted by many commands (they
are aborted when trying to write to the closed file descriptor).

I had thought about piping into a command that ignores STDIN, first,
e.g. "| :", but that generates a SIGPIPE when trying to flush the
FILE buffer (i.e. after 4 KB, which might be sufficient for most
cases, but it is not a general solution).

A program that reads from STDIN and generates no output could be used,
though, e.g. "| sed d".

But this would cause lots of extra forked processes and increase the
start-up time and is not acceptable.


but e.g. rc.d/syscons
uses ${kbddev} (i.e. /dev/ttyv0) and rc.d/zvol performs swapon
on /dev/zvol/${name}, rc.d/random uses /dev/random and so on.

So those interactions should be disaled by rc variables...  Or we should 
be failing the operation...


Going multi-user should not be stopped by any of the rc scripts
failing due to lack of /dev. But since most developers will only
test with /dev available, there is a risk that changes to rc files
will not gracefully handle a missing /dev.


But those further references to /dev nodes will in general be
NOPs if /dev is not available (some test for existence of the
node they rely on, other just fail trying to access them, but
without negative effect on going multi-user).


Yea, that's more minor, but if /dev/ isn't there, they likely should 
fail, or shouldn't proceed... But in a way that allows the rest of the 
rc scripts to continue...


Since the issue of no devfs mounted it not typical, tests will be
required to prevent regressions. If a failure in such a case stops
the multi-user start-up, then it will most likely be in situations
where there is no good way to provide diagnostics (e.g. no console
that works for user land programs, no known writable file system
locations, ...).

Regards, STefan


OpenPGP_signature
Description: OpenPGP digital signature


Re: svn commit: r366098 - head/usr.sbin/daemon

2020-09-24 Thread Mateusz Piotrowski

Hi,

On 9/24/20 4:44 AM, Maxim Sobolev wrote:

Author: sobomax
Date: Thu Sep 24 02:44:58 2020
New Revision: 366098
URL: https://svnweb.freebsd.org/changeset/base/366098

Log:
   dd a new option (-H) to daemon(8) to catch SIGHUP and re-open output_file 
file when
   received.

...

Modified: head/usr.sbin/daemon/daemon.8
==
--- head/usr.sbin/daemon/daemon.8   Wed Sep 23 23:56:49 2020
(r366097)
+++ head/usr.sbin/daemon/daemon.8   Thu Sep 24 02:44:58 2020
(r366098)

...

@@ -68,6 +68,14 @@ or syslog output, the standard file descriptors are fi
  .Pa /dev/null ,
  then stdout and/or stderr is redirected to a file or to syslog as
  specified by the other options.
+.It Fl H
+Close
+.Pa output_file
+and re-open it when signal SIGHUP is received, for interoperability with
+.Xr newsyslog 1
+and similar log rotation / archival mechanisms.  If
+.Fa o


Fa should be Fl

Cheers,

Mateusz

___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366106 - head/sys/arm64/arm64

2020-09-24 Thread Andrew Turner
Author: andrew
Date: Thu Sep 24 07:17:05 2020
New Revision: 366106
URL: https://svnweb.freebsd.org/changeset/base/366106

Log:
  Bounce in more cases in the arm64 busdma
  
  We need to use a bounce buffer when the memory we are operating on is not
  aligned to a cacheline, and not aligned to the maps alignment.
  
  The former is to stop other threads from dirtying the cacheline while we
  are performing DMA operations with it. The latter is to check memory
  passed in by a driver is correctly aligned for the device.
  
  Reviewed by:  mmel
  Sponsored by: Innovate UK
  Differential Revision:https://reviews.freebsd.org/D26496

Modified:
  head/sys/arm64/arm64/busdma_bounce.c

Modified: head/sys/arm64/arm64/busdma_bounce.c
==
--- head/sys/arm64/arm64/busdma_bounce.cThu Sep 24 07:13:13 2020
(r366105)
+++ head/sys/arm64/arm64/busdma_bounce.cThu Sep 24 07:17:05 2020
(r366106)
@@ -139,6 +139,7 @@ struct bus_dmamap {
u_int   flags;
 #defineDMAMAP_COHERENT (1 << 0)
 #defineDMAMAP_FROM_DMAMEM  (1 << 1)
+#defineDMAMAP_MBUF (1 << 2)
int sync_count;
struct sync_listslist[];
 };
@@ -155,8 +156,8 @@ static bus_addr_t add_bounce_page(bus_dma_tag_t dmat, 
 vm_offset_t vaddr, bus_addr_t addr, bus_size_t size);
 static void free_bounce_page(bus_dma_tag_t dmat, struct bounce_page *bpage);
 int run_filter(bus_dma_tag_t dmat, bus_addr_t paddr);
-static bool _bus_dmamap_pagesneeded(bus_dma_tag_t dmat, vm_paddr_t buf,
-bus_size_t buflen, int *pagesneeded);
+static bool _bus_dmamap_pagesneeded(bus_dma_tag_t dmat, bus_dmamap_t map,
+vm_paddr_t buf, bus_size_t buflen, int *pagesneeded);
 static void _bus_dmamap_count_pages(bus_dma_tag_t dmat, bus_dmamap_t map,
 pmap_t pmap, void *buf, bus_size_t buflen, int flags);
 static void _bus_dmamap_count_phys(bus_dma_tag_t dmat, bus_dmamap_t map,
@@ -164,20 +165,70 @@ static void _bus_dmamap_count_phys(bus_dma_tag_t dmat,
 static int _bus_dmamap_reserve_pages(bus_dma_tag_t dmat, bus_dmamap_t map,
 int flags);
 
+/*
+ * Return true if the DMA should bounce because the start or end does not fall
+ * on a cacheline boundary (which would require a partial cacheline flush).
+ * COHERENT memory doesn't trigger cacheline flushes.  Memory allocated by
+ * bus_dmamem_alloc() is always aligned to cacheline boundaries, and there's a
+ * strict rule that such memory cannot be accessed by the CPU while DMA is in
+ * progress (or by multiple DMA engines at once), so that it's always safe to 
do
+ * full cacheline flushes even if that affects memory outside the range of a
+ * given DMA operation that doesn't involve the full allocated buffer.  If 
we're
+ * mapping an mbuf, that follows the same rules as a buffer we allocated.
+ */
 static bool
-might_bounce(bus_dma_tag_t dmat)
+cacheline_bounce(bus_dma_tag_t dmat, bus_dmamap_t map, bus_addr_t paddr,
+bus_size_t size)
 {
 
+#defineDMAMAP_CACHELINE_FLAGS  
\
+(DMAMAP_FROM_DMAMEM | DMAMAP_COHERENT | DMAMAP_MBUF)
+   if ((dmat->bounce_flags & BF_COHERENT) != 0)
+   return (false);
+   if (map != NULL && (map->flags & DMAMAP_CACHELINE_FLAGS) != 0)
+   return (false);
+   return (((paddr | size) & (dcache_line_size - 1)) != 0);
+#undef DMAMAP_CACHELINE_FLAGS
+}
+
+/*
+ * Return true if the given address does not fall on the alignment boundary.
+ */
+static bool
+alignment_bounce(bus_dma_tag_t dmat, bus_addr_t addr)
+{
+
+   return ((addr & (dmat->common.alignment - 1)) != 0);
+}
+
+static bool
+might_bounce(bus_dma_tag_t dmat, bus_dmamap_t map, bus_addr_t paddr,
+bus_size_t size)
+{
+
if ((dmat->bounce_flags & BF_COULD_BOUNCE) != 0)
return (true);
 
+   if (cacheline_bounce(dmat, map, paddr, size))
+   return (true);
+
+   if (alignment_bounce(dmat, paddr))
+   return (true);
+
return (false);
 }
 
 static bool
-must_bounce(bus_dma_tag_t dmat, bus_addr_t paddr)
+must_bounce(bus_dma_tag_t dmat, bus_dmamap_t map, bus_addr_t paddr,
+bus_size_t size)
 {
 
+   if (cacheline_bounce(dmat, map, paddr, size))
+   return (true);
+
+   if (alignment_bounce(dmat, paddr))
+   return (true);
+
if ((dmat->bounce_flags & BF_COULD_BOUNCE) != 0 &&
bus_dma_run_filter(>common, paddr))
return (true);
@@ -240,8 +291,7 @@ bounce_bus_dma_tag_create(bus_dma_tag_t parent, bus_si
newtag->common.alignment > 1)
newtag->bounce_flags |= BF_COULD_BOUNCE;
 
-   if (((newtag->bounce_flags & BF_COULD_BOUNCE) != 0) &&
-   (flags & BUS_DMA_ALLOCNOW) != 0) {
+   if ((flags & BUS_DMA_ALLOCNOW) != 0) {
struct bounce_zone *bz;
 
/* Must bounce 

svn commit: r366105 - head/sys/arm64/arm64

2020-09-24 Thread Andrew Turner
Author: andrew
Date: Thu Sep 24 07:13:13 2020
New Revision: 366105
URL: https://svnweb.freebsd.org/changeset/base/366105

Log:
  Ensure we always align and size arm64 busdma allocations to a cacheline
  
  This will ensure nothing modifies the cacheline while DMA is in progress
  so we won't need to bounce the data.
  
  Reviewed by:  mmel
  Sponsored by: Innovate UK
  Differential Revision:https://reviews.freebsd.org/D26495

Modified:
  head/sys/arm64/arm64/busdma_bounce.c

Modified: head/sys/arm64/arm64/busdma_bounce.c
==
--- head/sys/arm64/arm64/busdma_bounce.cThu Sep 24 07:10:34 2020
(r366104)
+++ head/sys/arm64/arm64/busdma_bounce.cThu Sep 24 07:13:13 2020
(r366105)
@@ -72,6 +72,8 @@ struct bounce_zone;
 
 struct bus_dma_tag {
struct bus_dma_tag_common common;
+   size_t  alloc_size;
+   size_t  alloc_alignment;
int map_count;
int bounce_flags;
bus_dma_segment_t   *segments;
@@ -208,8 +210,22 @@ bounce_bus_dma_tag_create(bus_dma_tag_t parent, bus_si
newtag->map_count = 0;
newtag->segments = NULL;
 
-   if ((flags & BUS_DMA_COHERENT) != 0)
+   if ((flags & BUS_DMA_COHERENT) != 0) {
newtag->bounce_flags |= BF_COHERENT;
+   newtag->alloc_alignment = newtag->common.alignment;
+   newtag->alloc_size = newtag->common.maxsize;
+   } else {
+   /*
+* Ensure the buffer is aligned to a cacheline when allocating
+* a non-coherent buffer. This is so we don't have any data
+* that another CPU may be accessing around DMA buffer
+* causing the cache to become dirty.
+*/
+   newtag->alloc_alignment = MAX(newtag->common.alignment,
+   dcache_line_size);
+   newtag->alloc_size = roundup2(newtag->common.maxsize,
+   dcache_line_size);
+   }
 
if (parent != NULL) {
if ((newtag->common.filter != NULL ||
@@ -520,23 +536,23 @@ bounce_bus_dmamem_alloc(bus_dma_tag_t dmat, void** vad
 *
 * In the meantime warn the user if malloc gets it wrong.
 */
-   if ((dmat->common.maxsize <= PAGE_SIZE) &&
-  (dmat->common.alignment <= dmat->common.maxsize) &&
+   if ((dmat->alloc_size <= PAGE_SIZE) &&
+  (dmat->alloc_alignment <= dmat->alloc_size) &&
dmat->common.lowaddr >= ptoa((vm_paddr_t)Maxmem) &&
attr == VM_MEMATTR_DEFAULT) {
-   *vaddr = malloc(dmat->common.maxsize, M_DEVBUF, mflags);
+   *vaddr = malloc(dmat->alloc_size, M_DEVBUF, mflags);
} else if (dmat->common.nsegments >=
-   howmany(dmat->common.maxsize, MIN(dmat->common.maxsegsz, 
PAGE_SIZE)) &&
-   dmat->common.alignment <= PAGE_SIZE &&
+   howmany(dmat->alloc_size, MIN(dmat->common.maxsegsz, PAGE_SIZE)) &&
+   dmat->alloc_alignment <= PAGE_SIZE &&
(dmat->common.boundary % PAGE_SIZE) == 0) {
/* Page-based multi-segment allocations allowed */
-   *vaddr = (void *)kmem_alloc_attr(dmat->common.maxsize, mflags,
+   *vaddr = (void *)kmem_alloc_attr(dmat->alloc_size, mflags,
0ul, dmat->common.lowaddr, attr);
dmat->bounce_flags |= BF_KMEM_ALLOC;
} else {
-   *vaddr = (void *)kmem_alloc_contig(dmat->common.maxsize, mflags,
-   0ul, dmat->common.lowaddr, dmat->common.alignment != 0 ?
-   dmat->common.alignment : 1ul, dmat->common.boundary, attr);
+   *vaddr = (void *)kmem_alloc_contig(dmat->alloc_size, mflags,
+   0ul, dmat->common.lowaddr, dmat->alloc_alignment != 0 ?
+   dmat->alloc_alignment : 1ul, dmat->common.boundary, attr);
dmat->bounce_flags |= BF_KMEM_ALLOC;
}
if (*vaddr == NULL) {
@@ -544,7 +560,7 @@ bounce_bus_dmamem_alloc(bus_dma_tag_t dmat, void** vad
__func__, dmat, dmat->common.flags, ENOMEM);
free(*mapp, M_DEVBUF);
return (ENOMEM);
-   } else if (vtophys(*vaddr) & (dmat->common.alignment - 1)) {
+   } else if (vtophys(*vaddr) & (dmat->alloc_alignment - 1)) {
printf("bus_dmamem_alloc failed to align memory properly.\n");
}
dmat->map_count++;
@@ -571,7 +587,7 @@ bounce_bus_dmamem_free(bus_dma_tag_t dmat, void *vaddr
if ((dmat->bounce_flags & BF_KMEM_ALLOC) == 0)
free(vaddr, M_DEVBUF);
else
-   kmem_free((vm_offset_t)vaddr, dmat->common.maxsize);
+   kmem_free((vm_offset_t)vaddr, dmat->alloc_size);
free(map, M_DEVBUF);
dmat->map_count--;
CTR3(KTR_BUSDMA, "%s: tag %p flags 0x%x", __func__, 

svn commit: r366104 - head/sys/modules/mrsas

2020-09-24 Thread Warner Losh
Author: imp
Date: Thu Sep 24 07:10:34 2020
New Revision: 366104
URL: https://svnweb.freebsd.org/changeset/base/366104

Log:
  Don't define _STANDALONE when building kernel modules.
  
  _STANDALONE is only for the bootloader, not kernel modules. Remove it
  from the build. This was harmless before, but sys/malloc.h now does
  different things for the standalone environment, triggering the issue.

Modified:
  head/sys/modules/mrsas/Makefile

Modified: head/sys/modules/mrsas/Makefile
==
--- head/sys/modules/mrsas/Makefile Thu Sep 24 07:07:54 2020
(r366103)
+++ head/sys/modules/mrsas/Makefile Thu Sep 24 07:10:34 2020
(r366104)
@@ -17,7 +17,7 @@ CFLAGS+= -fgnu89-inline
 
 TARGET_ARCH = ${MACHINE_ARCH}
 .if ${TARGET_ARCH} == "amd64"
-CFLAGS+= -DCOMPAT_FREEBSD32 -D_STANDALONE
+CFLAGS+= -DCOMPAT_FREEBSD32
 .endif
 
 clean_cscope:
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366103 - head/sys/arm64/arm64

2020-09-24 Thread Andrew Turner
Author: andrew
Date: Thu Sep 24 07:07:54 2020
New Revision: 366103
URL: https://svnweb.freebsd.org/changeset/base/366103

Log:
  Add a coherent flag on the arm64 dma map struct
  
  Use it to decide if we can skip cache management.
  
  While here remove the DMAMAP_COULD_BOUNCE flag as it's unneeded.
  
  Reviewed by:  mmel
  Sponsored by: Innovate UK
  Differential Revision:https://reviews.freebsd.org/D26494

Modified:
  head/sys/arm64/arm64/busdma_bounce.c

Modified: head/sys/arm64/arm64/busdma_bounce.c
==
--- head/sys/arm64/arm64/busdma_bounce.cThu Sep 24 07:03:26 2020
(r366102)
+++ head/sys/arm64/arm64/busdma_bounce.cThu Sep 24 07:07:54 2020
(r366103)
@@ -135,7 +135,7 @@ struct bus_dmamap {
void  *callback_arg;
STAILQ_ENTRY(bus_dmamap) links;
u_int   flags;
-#defineDMAMAP_COULD_BOUNCE (1 << 0)
+#defineDMAMAP_COHERENT (1 << 0)
 #defineDMAMAP_FROM_DMAMEM  (1 << 1)
int sync_count;
struct sync_listslist[];
@@ -367,8 +367,6 @@ bounce_bus_dmamap_create(bus_dma_tag_t dmat, int flags
}
bz = dmat->bounce_zone;
 
-   (*mapp)->flags = DMAMAP_COULD_BOUNCE;
-
/*
 * Attempt to add pages to our pool on a per-instance
 * basis up to a sane limit.
@@ -396,10 +394,13 @@ bounce_bus_dmamap_create(bus_dma_tag_t dmat, int flags
}
bz->map_count++;
}
-   if (error == 0)
+   if (error == 0) {
dmat->map_count++;
-   else
+   if ((dmat->bounce_flags & BF_COHERENT) != 0)
+   (*mapp)->flags |= DMAMAP_COHERENT;
+   } else {
free(*mapp, M_DEVBUF);
+   }
CTR4(KTR_BUSDMA, "%s: tag %p tag flags 0x%x error %d",
__func__, dmat, dmat->common.flags, error);
return (error);
@@ -421,11 +422,8 @@ bounce_bus_dmamap_destroy(bus_dma_tag_t dmat, bus_dmam
CTR3(KTR_BUSDMA, "%s: tag %p error %d", __func__, dmat, EBUSY);
return (EBUSY);
}
-   if (dmat->bounce_zone) {
-   KASSERT((map->flags & DMAMAP_COULD_BOUNCE) != 0,
-   ("%s: Bounce zone when cannot bounce", __func__));
+   if (dmat->bounce_zone)
dmat->bounce_zone->map_count--;
-   }
free(map, M_DEVBUF);
dmat->map_count--;
CTR2(KTR_BUSDMA, "%s: tag %p error 0", __func__, dmat);
@@ -490,9 +488,18 @@ bounce_bus_dmamem_alloc(bus_dma_tag_t dmat, void** vad
__func__, dmat, dmat->common.flags, ENOMEM);
return (ENOMEM);
}
-   (*mapp)->flags = DMAMAP_FROM_DMAMEM;
 
/*
+* Mark the map as coherent if we used uncacheable memory or the
+* tag was already marked as coherent.
+*/
+   if (attr == VM_MEMATTR_UNCACHEABLE ||
+   (dmat->bounce_flags & BF_COHERENT) != 0)
+   (*mapp)->flags |= DMAMAP_COHERENT;
+
+   (*mapp)->flags |= DMAMAP_FROM_DMAMEM;
+
+   /*
 * Allocate the buffer from the malloc(9) allocator if...
 *  - It's small enough to fit into a single power of two sized bucket.
 *  - The alignment is less than or equal to the maximum size
@@ -760,7 +767,7 @@ bounce_bus_dmamap_load_phys(bus_dma_tag_t dmat, bus_dm
sgsize = MIN(sgsize, PAGE_SIZE - (curaddr & PAGE_MASK));
curaddr = add_bounce_page(dmat, map, 0, curaddr,
sgsize);
-   } else if ((dmat->bounce_flags & BF_COHERENT) == 0) {
+   } else if ((map->flags & DMAMAP_COHERENT) == 0) {
if (map->sync_count > 0)
sl_end = sl->paddr + sl->datacount;
 
@@ -846,7 +853,7 @@ bounce_bus_dmamap_load_buffer(bus_dma_tag_t dmat, bus_
sgsize = MIN(sgsize, max_sgsize);
curaddr = add_bounce_page(dmat, map, kvaddr, curaddr,
sgsize);
-   } else if ((dmat->bounce_flags & BF_COHERENT) == 0) {
+   } else if ((map->flags & DMAMAP_COHERENT) == 0) {
sgsize = MIN(sgsize, max_sgsize);
if (map->sync_count > 0) {
sl_pend = sl->paddr + sl->datacount;
@@ -896,8 +903,6 @@ bounce_bus_dmamap_waitok(bus_dma_tag_t dmat, bus_dmama
 struct memdesc *mem, bus_dmamap_callback_t *callback, void *callback_arg)
 {
 
-   if ((map->flags & DMAMAP_COULD_BOUNCE) == 0)
-   return;
map->mem = *mem;
map->dmat = dmat;
map->callback = callback;
@@ -1042,7 +1047,7 @@ bounce_bus_dmamap_sync(bus_dma_tag_t dmat, bus_dmamap_
(void *)bpage->vaddr, 

svn commit: r366102 - head/sys/arm64/arm64

2020-09-24 Thread Andrew Turner
Author: andrew
Date: Thu Sep 24 07:03:26 2020
New Revision: 366102
URL: https://svnweb.freebsd.org/changeset/base/366102

Log:
  Add bounce helpers to the arm64 busdma
  
  Add helper functions to the arm64 busdma for common cases of checking if
  we may need to bounce, and if we must bounce for a given address.
  
  These will be expanded later as we handle cache-misaligned memory.
  
  Reported by:  mmel
  Sponsored by: Innovate UK
  Differential Revision:https://reviews.freebsd.org/D26493

Modified:
  head/sys/arm64/arm64/busdma_bounce.c

Modified: head/sys/arm64/arm64/busdma_bounce.c
==
--- head/sys/arm64/arm64/busdma_bounce.cThu Sep 24 06:40:35 2020
(r366101)
+++ head/sys/arm64/arm64/busdma_bounce.cThu Sep 24 07:03:26 2020
(r366102)
@@ -162,6 +162,27 @@ static void _bus_dmamap_count_phys(bus_dma_tag_t dmat,
 static int _bus_dmamap_reserve_pages(bus_dma_tag_t dmat, bus_dmamap_t map,
 int flags);
 
+static bool
+might_bounce(bus_dma_tag_t dmat)
+{
+
+   if ((dmat->bounce_flags & BF_COULD_BOUNCE) != 0)
+   return (true);
+
+   return (false);
+}
+
+static bool
+must_bounce(bus_dma_tag_t dmat, bus_addr_t paddr)
+{
+
+   if ((dmat->bounce_flags & BF_COULD_BOUNCE) != 0 &&
+   bus_dma_run_filter(>common, paddr))
+   return (true);
+
+   return (false);
+}
+
 /*
  * Allocate a device specific dma_tag.
  */
@@ -278,7 +299,7 @@ static bool
 bounce_bus_dma_id_mapped(bus_dma_tag_t dmat, vm_paddr_t buf, bus_size_t buflen)
 {
 
-   if ((dmat->bounce_flags & BF_COULD_BOUNCE) == 0)
+   if (!might_bounce(dmat))
return (true);
return (!_bus_dmamap_pagesneeded(dmat, buf, buflen, NULL));
 }
@@ -566,7 +587,7 @@ _bus_dmamap_pagesneeded(bus_dma_tag_t dmat, vm_paddr_t
curaddr = buf;
while (buflen != 0) {
sgsize = MIN(buflen, dmat->common.maxsegsz);
-   if (bus_dma_run_filter(>common, curaddr)) {
+   if (must_bounce(dmat, curaddr)) {
sgsize = MIN(sgsize,
PAGE_SIZE - (curaddr & PAGE_MASK));
if (pagesneeded == NULL)
@@ -587,7 +608,7 @@ _bus_dmamap_count_phys(bus_dma_tag_t dmat, bus_dmamap_
 bus_size_t buflen, int flags)
 {
 
-   if ((map->flags & DMAMAP_COULD_BOUNCE) != 0 && map->pagesneeded == 0) {
+   if (map->pagesneeded == 0) {
_bus_dmamap_pagesneeded(dmat, buf, buflen, >pagesneeded);
CTR1(KTR_BUSDMA, "pagesneeded= %d\n", map->pagesneeded);
}
@@ -602,7 +623,7 @@ _bus_dmamap_count_pages(bus_dma_tag_t dmat, bus_dmamap
bus_addr_t paddr;
bus_size_t sg_len;
 
-   if ((map->flags & DMAMAP_COULD_BOUNCE) != 0 && map->pagesneeded == 0) {
+   if (map->pagesneeded == 0) {
CTR4(KTR_BUSDMA, "lowaddr= %d Maxmem= %d, boundary= %d, "
"alignment= %d", dmat->common.lowaddr,
ptoa((vm_paddr_t)Maxmem),
@@ -622,7 +643,7 @@ _bus_dmamap_count_pages(bus_dma_tag_t dmat, bus_dmamap
paddr = pmap_kextract(vaddr);
else
paddr = pmap_extract(pmap, vaddr);
-   if (bus_dma_run_filter(>common, paddr) != 0) {
+   if (must_bounce(dmat, paddr)) {
sg_len = roundup2(sg_len,
dmat->common.alignment);
map->pagesneeded++;
@@ -720,7 +741,7 @@ bounce_bus_dmamap_load_phys(bus_dma_tag_t dmat, bus_dm
if (segs == NULL)
segs = dmat->segments;
 
-   if ((dmat->bounce_flags & BF_COULD_BOUNCE) != 0) {
+   if (might_bounce(dmat)) {
_bus_dmamap_count_phys(dmat, map, buf, buflen, flags);
if (map->pagesneeded != 0) {
error = _bus_dmamap_reserve_pages(dmat, map, flags);
@@ -735,9 +756,7 @@ bounce_bus_dmamap_load_phys(bus_dma_tag_t dmat, bus_dm
while (buflen > 0) {
curaddr = buf;
sgsize = MIN(buflen, dmat->common.maxsegsz);
-   if (((dmat->bounce_flags & BF_COULD_BOUNCE) != 0) &&
-   map->pagesneeded != 0 &&
-   bus_dma_run_filter(>common, curaddr)) {
+   if (map->pagesneeded != 0 && must_bounce(dmat, curaddr)) {
sgsize = MIN(sgsize, PAGE_SIZE - (curaddr & PAGE_MASK));
curaddr = add_bounce_page(dmat, map, 0, curaddr,
sgsize);
@@ -791,7 +810,7 @@ bounce_bus_dmamap_load_buffer(bus_dma_tag_t dmat, bus_
if (segs == NULL)
segs = dmat->segments;
 
-   if ((dmat->bounce_flags & BF_COULD_BOUNCE) != 0) {
+   if (might_bounce(dmat)) {
_bus_dmamap_count_pages(dmat, map, pmap, buf, buflen, flags);

Re: svn commit: r365643 - head/bin/cp

2020-09-24 Thread Warner Losh
On Thu, Sep 24, 2020 at 12:41 AM Stefan Esser  wrote:

> Am 23.09.20 um 19:23 schrieb Warner Losh> But for this issue, we're not
> mounting devfs early enough.  We should
> > fix that. Removing /dev/null from the boot process likely is never going
> > to happen because we use it all over the place to discard output...
> > There's ~200 instances of it in the boot rc scripts, so getting rid of
> > it there would also be quite the effort, with the same question.
>
> Removal of /dev/null from rc.d scripts should be quite simple,
> since most cases could just use ">-" (close file descriptor)
> instead. Other usage could be substituted with ":>" followed
> by chown.
>

So closing fd1 and fd2 doesn't cause them to be available for these
programs to get as an fd on open, causing other issues?

But >- isn't documented in sh(1) as doing the close thing. On a whim I did
the following:
$ echo fred >-
$ ls -last ./-
4 -rw-r--r--  1 imp  imp  5 Sep 24 00:50 ./-
$ cat ./-
fred
$
which suggests maybe you now have a lot of files named - instead...


> I'd be willing to generate patches for review, if there is any
> chance such a change might be accepted into -CURRENT.
>
> I could not find any use of /dev/zero,


Yea, I'd thought we used it in libc, but I can't find any evidence of that
with grep now that I've gone looking for it. For get that specific one :)


> but e.g. rc.d/syscons
> uses ${kbddev} (i.e. /dev/ttyv0) and rc.d/zvol performs swapon
> on /dev/zvol/${name}, rc.d/random uses /dev/random and so on.
>

So those interactions should be disaled by rc variables...  Or we should be
failing the operation...


> But those further references to /dev nodes will in general be
> NOPs if /dev is not available (some test for existence of the
> node they rely on, other just fail trying to access them, but
> without negative effect on going multi-user).
>

Yea, that's more minor, but if /dev/ isn't there, they likely should fail,
or shouldn't proceed... But in a way that allows the rest of the rc scripts
to continue...

Warner
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r365643 - head/bin/cp

2020-09-24 Thread Stefan Esser
Am 23.09.20 um 19:23 schrieb Warner Losh> But for this issue, we're not 
mounting devfs early enough.  We should
fix that. Removing /dev/null from the boot process likely is never going 
to happen because we use it all over the place to discard output... 
There's ~200 instances of it in the boot rc scripts, so getting rid of 
it there would also be quite the effort, with the same question.


Removal of /dev/null from rc.d scripts should be quite simple,
since most cases could just use ">-" (close file descriptor)
instead. Other usage could be substituted with ":>" followed
by chown.

I'd be willing to generate patches for review, if there is any
chance such a change might be accepted into -CURRENT.

I could not find any use of /dev/zero, but e.g. rc.d/syscons
uses ${kbddev} (i.e. /dev/ttyv0) and rc.d/zvol performs swapon
on /dev/zvol/${name}, rc.d/random uses /dev/random and so on.

But those further references to /dev nodes will in general be
NOPs if /dev is not available (some test for existence of the
node they rely on, other just fail trying to access them, but
without negative effect on going multi-user).

Regards, STefan


OpenPGP_signature
Description: OpenPGP digital signature


svn commit: r366101 - head/sys/sys

2020-09-24 Thread Warner Losh
Author: imp
Date: Thu Sep 24 06:40:35 2020
New Revision: 366101
URL: https://svnweb.freebsd.org/changeset/base/366101

Log:
  Create a standalone version of sys/malloc.h
  
  The ZSTD support for the boot loader will need to include files that
  use the kernel's malloc interface. Create a standalone stub version
  that's functional enough to allow this to work. There's some
  limitations in this interface, and it's not quite a perfect
  match. Specifically, M_WAITOK allocations can fail because there's
  nothing that can be done we no memory is available.

Modified:
  head/sys/sys/malloc.h

Modified: head/sys/sys/malloc.h
==
--- head/sys/sys/malloc.h   Thu Sep 24 06:12:57 2020(r366100)
+++ head/sys/sys/malloc.h   Thu Sep 24 06:40:35 2020(r366101)
@@ -37,6 +37,7 @@
 #ifndef _SYS_MALLOC_H_
 #define_SYS_MALLOC_H_
 
+#ifndef _STANDALONE
 #include 
 #ifdef _KERNEL
 #include 
@@ -267,4 +268,34 @@ WOULD_OVERFLOW(size_t nmemb, size_t size)
 #undef MUL_NO_OVERFLOW
 #endif /* _KERNEL */
 
+#else
+/*
+ * The native stand malloc / free interface we're mapping to
+ */
+extern void Free(void *p, const char *file, int line);
+extern void *Malloc(size_t bytes, const char *file, int line);
+
+/*
+ * Minimal standalone malloc implementation / environment. None of the
+ * flags mean anything and there's no need declare malloc types.
+ * Define the simple alloc / free routines in terms of Malloc and
+ * Free. None of the kernel features that this stuff disables are needed.
+ *
+ * XXX we are setting ourselves up for a potential crash if we can't allocate
+ * memory for a M_WAITOK call.
+ */
+#define M_WAITOK 0
+#define M_ZERO 0
+#define M_NOWAIT 0
+#define MALLOC_DECLARE(x)
+
+#define kmem_zalloc(size, flags) Malloc((size), __FILE__, __LINE__)
+#define kmem_free(p, size) Free(p, __FILE__, __LINE__)
+
+/*
+ * ZFS mem.h define that's the OpenZFS porting layer way of saying
+ * M_WAITOK. Given the above, it will also be a nop.
+ */
+#define KM_SLEEP M_WAITOK
+#endif /* _STANDALONE */
 #endif /* !_SYS_MALLOC_H_ */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366100 - in head: share/man/man5 tools/build/options

2020-09-24 Thread Stefan Eßer
Author: se
Date: Thu Sep 24 06:12:57 2020
New Revision: 366100
URL: https://svnweb.freebsd.org/changeset/base/366100

Log:
  Slightly modify wording to better match nearby entries.
  
  MFC after:3 days

Modified:
  head/share/man/man5/src.conf.5
  head/tools/build/options/WITHOUT_GH_BC
  head/tools/build/options/WITH_GH_BC

Modified: head/share/man/man5/src.conf.5
==
--- head/share/man/man5/src.conf.5  Thu Sep 24 03:38:32 2020
(r366099)
+++ head/share/man/man5/src.conf.5  Thu Sep 24 06:12:57 2020
(r366100)
@@ -669,10 +669,10 @@ Set to build
 This is a default setting on
 amd64/amd64, arm/armv6, arm/armv7, i386/i386, mips/mips, mips/mips64, 
powerpc/powerpc and powerpc/powerpc64.
 .It Va WITHOUT_GH_BC
-Do not install the enhanced
-.Xr bc
+Set to not build and install the enhanced
+.Xr bc 1
 and
-.Xr dc
+.Xr dc 1
 programs instead of the traditional FreeBSD versions.
 .It Va WITHOUT_GNU_DIFF
 Set to not build GNU

Modified: head/tools/build/options/WITHOUT_GH_BC
==
--- head/tools/build/options/WITHOUT_GH_BC  Thu Sep 24 03:38:32 2020
(r366099)
+++ head/tools/build/options/WITHOUT_GH_BC  Thu Sep 24 06:12:57 2020
(r366100)
@@ -1,6 +1,6 @@
 .\" $FreeBSD$
-Do not install the enhanced
-.Xr bc
+Set to not build and install the enhanced
+.Xr bc 1
 and
-.Xr dc
+.Xr dc 1
 programs instead of the traditional FreeBSD versions.

Modified: head/tools/build/options/WITH_GH_BC
==
--- head/tools/build/options/WITH_GH_BC Thu Sep 24 03:38:32 2020
(r366099)
+++ head/tools/build/options/WITH_GH_BC Thu Sep 24 06:12:57 2020
(r366100)
@@ -1,6 +1,6 @@
 .\" $FreeBSD$
-Install the enhanced
-.Xr bc
+Set this option to install the enhanced
+.Xr bc 1
 and
-.Xr dc
+.Xr dc 1
 programs instead of the traditional FreeBSD versions.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"