git: 2fe85640b2a3 - main - efirt(9): Correct efi_var_set definition in the manpage

2021-11-02 Thread Guangyuan Yang
The branch main has been updated by ygy (doc, ports committer):

URL: 
https://cgit.FreeBSD.org/src/commit/?id=2fe85640b2a3bf5c377dd180e40cd3d6e1a4f1f4

commit 2fe85640b2a3bf5c377dd180e40cd3d6e1a4f1f4
Author: Lakshman 
AuthorDate: 2021-11-02 07:17:38 +
Commit: Guangyuan Yang 
CommitDate: 2021-11-02 07:17:38 +

efirt(9): Correct efi_var_set definition in the manpage

PR: 257531
MFC after:  3 days
---
 share/man/man9/efirt.9 | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/share/man/man9/efirt.9 b/share/man/man9/efirt.9
index fd5aee83656b..cdf0ea21ad8d 100644
--- a/share/man/man9/efirt.9
+++ b/share/man/man9/efirt.9
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd December 11, 2018
+.Dd November 2, 2021
 .Dt EFIRT 9
 .Os
 .Sh NAME
@@ -63,8 +63,8 @@
 .Ft int
 .Fn efi_var_nextname "size_t *namesize" "uint16_t *name" "struct uuid *vendor"
 .Ft int
-.Fn efi_var_set "uint16_t *name" "struct uuid *vendor" "uint32_t *attrib" \
-"size_t *datasize" "void *data"
+.Fn efi_var_set "uint16_t *name" "struct uuid *vendor" "uint32_t attrib" \
+"size_t datasize" "void *data"
 .Sh DESCRIPTION
 All of the following calls will return
 .Dv ENXIO



git: f7c7a6ac00f1 - main - dpv.1: Fix an example

2021-11-02 Thread Mateusz Piotrowski
The branch main has been updated by 0mp (doc, ports committer):

URL: 
https://cgit.FreeBSD.org/src/commit/?id=f7c7a6ac00f13e2d47d50844dd92071933c33a56

commit f7c7a6ac00f13e2d47d50844dd92071933c33a56
Author: Mateusz Piotrowski <0...@freebsd.org>
AuthorDate: 2021-11-02 07:11:50 +
Commit: Mateusz Piotrowski <0...@freebsd.org>
CommitDate: 2021-11-02 07:30:11 +

dpv.1: Fix an example

dpv(1) requires a label to be specified.

MFC after:  3 days
---
 usr.bin/dpv/dpv.1 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/usr.bin/dpv/dpv.1 b/usr.bin/dpv/dpv.1
index d571addfa7c9..dd5829f6829c 100644
--- a/usr.bin/dpv/dpv.1
+++ b/usr.bin/dpv/dpv.1
@@ -374,7 +374,7 @@ dpv -o /dev/ada0 -m label disk-image.img
 .Pp
 Zeroing a disk:
 .Bd -literal -offset indent
-dpv -o /dev/md42 < /dev/zero
+dpv -o /dev/md42 "Zeroing md42" < /dev/zero
 .Ed
 .Sh SEE ALSO
 .Xr dialog 1 ,



git: a85aa7f9d3bf - main - dpv: Fix synopsis formatting & sort options

2021-11-02 Thread Mateusz Piotrowski
The branch main has been updated by 0mp (doc, ports committer):

URL: 
https://cgit.FreeBSD.org/src/commit/?id=a85aa7f9d3bfd26f5dc07f70cb7ba281bfc69f20

commit a85aa7f9d3bfd26f5dc07f70cb7ba281bfc69f20
Author: Mateusz Piotrowski <0...@freebsd.org>
AuthorDate: 2021-11-02 07:05:48 +
Commit: Mateusz Piotrowski <0...@freebsd.org>
CommitDate: 2021-11-02 07:30:11 +

dpv: Fix synopsis formatting & sort options

MFC after:  3 days
---
 usr.bin/dpv/dpv.1 | 97 +++
 usr.bin/dpv/dpv.c | 30 -
 2 files changed, 70 insertions(+), 57 deletions(-)

diff --git a/usr.bin/dpv/dpv.1 b/usr.bin/dpv/dpv.1
index 8c0dce79d2d1..d571addfa7c9 100644
--- a/usr.bin/dpv/dpv.1
+++ b/usr.bin/dpv/dpv.1
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd January 26, 2016
+.Dd November 2, 2021
 .Dt DPV 1
 .Os
 .Sh NAME
@@ -33,13 +33,26 @@
 .Sh SYNOPSIS
 .Nm
 .Op options
-.Ar [bytes:]label
+.Sm off
+.Op Ar bytes Cm \&:
+.Ar label
+.Sm on
 .Nm
 .Op options
 .Fl m
-.Ar [bytes1:]label1
+.Sm off
+.Op Ar bytes1 Cm \& :
+. Ar label1
+.Sm on
 .Ar path1
-.Op Ar [bytes2:]label2 path2 ...
+.Oo
+.Sm off
+.Op Ar bytes2 Cm \&:
+.Ar label2
+.Sm on
+.Ar path2
+.Ar ...
+.Oc
 .Sh DESCRIPTION
 .Nm
 provides a dialog progress view, allowing a user to see current throughput rate
@@ -95,10 +108,6 @@ When using
 this is displayed inside the window
 .Pq at the top
 followed by a separator line.
-.It Fl d
-Debug mode.
-Print dialog prompt data to standard out and provide additional debugging on
-standard error.
 .It Fl D
 Do not use the default interface of
 .Xr dialog 3 ,
@@ -111,11 +120,15 @@ is taken from the
 environment variable or simply
 .Dq Li dialog
 if unset or NULL.
+.It Fl d
+Debug mode.
+Print dialog prompt data to standard out and provide additional debugging on
+standard error.
 .It Fl h
 Produce a short syntax usage with brief option descriptions and exit.
 Output is produced on standard error.
-.It Fl i Ar format
-Customize the single-file format string used to update the status line.
+.It Fl I Ar format
+Customize the multi-file format string used to update the status line.
 Ignored when using either
 .Ql Fl D
 or
@@ -124,10 +137,10 @@ which lack the ability to display the status line
 .Pq containing bytes/rate/thread information .
 Default value
 is
-.Dq Li %'10lli bytes read @ %'9.1f bytes/sec. .
-This format is used when handling one file.
-.It Fl I Ar format
-Customize the multi-file format string used to update the status line.
+.Dq Li %'10lli bytes read @ %'9.1f bytes/sec. [%i/%i busy/wait] .
+This format is used when handling more than one file.
+.It Fl i Ar format
+Customize the single-file format string used to update the status line.
 Ignored when using either
 .Ql Fl D
 or
@@ -136,24 +149,27 @@ which lack the ability to display the status line
 .Pq containing bytes/rate/thread information .
 Default value
 is
-.Dq Li %'10lli bytes read @ %'9.1f bytes/sec. [%i/%i busy/wait] .
-This format is used when handling more than one file.
+.Dq Li %'10lli bytes read @ %'9.1f bytes/sec. .
+This format is used when handling one file.
 .It Fl k
 Keep tite.
 Prevent visually distracting initialization/exit routines for scripts running
 .Xr dialog 1
 several times.
-.It Fl l
-Line mode.
-Read lines from input instead of bytes.
 .It Fl L Ar size
 Label size.
 If negative, shrink to longest label width.
+.It Fl l
+Line mode.
+Read lines from input instead of bytes.
 .It Fl m
 Multi-input mode.
 Instead of reading bytes from standard input, read from a set of paths
 .Pq one for each label .
 By default, each path is processed sequentially in the order given.
+.It Fl N
+No overrun.
+If enabled, stop reading known-length inputs when input reaches stated length.
 .It Fl n Ar num
 Display at-most
 .Ar num
@@ -162,9 +178,6 @@ If zero, display as many as possible.
 If negative, only display the main progress indicator.
 Default is 0.
 Maximum value is 10.
-.It Fl N
-No overrun.
-If enabled, stop reading known-length inputs when input reaches stated length.
 .It Fl o Ar file
 Output data to
 .Ar file .
@@ -176,10 +189,6 @@ in
 will be replaced with the
 .Ar label
 text.
-.It Fl p Ar text
-Display
-.Ar text
-above the file progress indicator(s).
 .It Fl P Ar size
 Mini-progressbar size.
 If negative, don't display mini-progressbars
@@ -187,6 +196,19 @@ If negative, don't display mini-progressbars
 If zero, auto-adjust based on number of files to read.
 When zero and only one file to read, defaults to -1.
 When zero and more than one file to read, defaults to 17.
+.It Fl p Ar text
+Display
+.Ar text
+above the file progress indicator(s).
+.It Fl T
+Test mode.
+Simulate reading a number of bytes, divided evenly across the number of files,
+while stepping through each percent value of each file to process.
+Appends
+.Dq Li [TEST MODE]
+to the status line
+.Pq to override, use Ql Fl u Ar format .
+No data is actually read.
 .It Fl t Ar title
 Display
 .Ar title
@@ -201,15 +22

git: 3693250e8a74 - main - dpv.1: Do not use mdoc macros for Bl width

2021-11-02 Thread Mateusz Piotrowski
The branch main has been updated by 0mp (doc, ports committer):

URL: 
https://cgit.FreeBSD.org/src/commit/?id=3693250e8a746053291849d8442f912336f0bf1b

commit 3693250e8a746053291849d8442f912336f0bf1b
Author: Mateusz Piotrowski <0...@freebsd.org>
AuthorDate: 2021-11-02 07:17:19 +
Commit: Mateusz Piotrowski <0...@freebsd.org>
CommitDate: 2021-11-02 07:30:11 +

dpv.1: Do not use mdoc macros for Bl width

Macros do not expand there.

MFC after:  3 days
---
 usr.bin/dpv/dpv.1 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/usr.bin/dpv/dpv.1 b/usr.bin/dpv/dpv.1
index dd5829f6829c..801389529946 100644
--- a/usr.bin/dpv/dpv.1
+++ b/usr.bin/dpv/dpv.1
@@ -94,7 +94,7 @@ or instead
 .Pq see Ql Fl X .
 .Pp
 The following options are available:
-.Bl -tag -width ".Fl b Ar backtitle"
+.Bl -tag -width "-b backtitle"
 .It Fl a Ar text
 Display
 .Ar text
@@ -323,7 +323,7 @@ If using
 .Xr Xdialog 1
 is required.
 .Sh FILES
-.Bl -tag -width ".Pa $HOME/.dialogrc" -compact
+.Bl -tag -width "$HOME/.dialogrc" -compact
 .It Pa $HOME/.dialogrc
 .El
 .Sh EXAMPLES



git: 3dd5760aa5f8 - main - if_epair: rework

2021-11-02 Thread Kristof Provost
The branch main has been updated by kp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=3dd5760aa5f876f8a3f0735afeebdf9ee414e1f5

commit 3dd5760aa5f876f8a3f0735afeebdf9ee414e1f5
Author: Bjoern A. Zeeb 
AuthorDate: 2021-10-09 14:09:04 +
Commit: Kristof Provost 
CommitDate: 2021-11-02 08:23:46 +

if_epair: rework

Rework if_epair(4) to no longer use netisr and dpcpu.
Instead use mbufq and swi_net.
This simplifies the code and seems to make it work better and
no longer hang.

Work largely by bz@, with minor tweaks by kp@.

Reviewed by:bz, kp
MFC after:  3 weeks
Differential Revision:  https://reviews.freebsd.org/D31077
---
 sys/net/if_epair.c | 746 +
 1 file changed, 240 insertions(+), 506 deletions(-)

diff --git a/sys/net/if_epair.c b/sys/net/if_epair.c
index a62fbfad8771..e46c5271cc0f 100644
--- a/sys/net/if_epair.c
+++ b/sys/net/if_epair.c
@@ -2,8 +2,8 @@
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
  *
  * Copyright (c) 2008 The FreeBSD Foundation
- * Copyright (c) 2009-2010 Bjoern A. Zeeb 
  * All rights reserved.
+ * Copyright (c) 2009-2021 Bjoern A. Zeeb 
  *
  * This software was developed by CK Software GmbH under sponsorship
  * from the FreeBSD Foundation.
@@ -37,17 +37,6 @@
  * This is mostly intended to be used to provide connectivity between
  * different virtual network stack instances.
  */
-/*
- * Things to re-think once we have more experience:
- * - ifp->if_reassign function once we can test with vimage. Depending on
- *   how if_vmove() is going to be improved.
- * - Real random etheraddrs that are checked to be uniquish; we would need
- *   to re-do them in case we move the interface between network stacks
- *   in a private if_reassign function.
- *   In case we bridge to a real interface/network or between indepedent
- *   epairs on multiple stacks/machines, we may need this.
- *   For now let the user handle that case.
- */
 
 #include 
 __FBSDID("$FreeBSD$");
@@ -61,13 +50,15 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
 
 #include 
 #include 
@@ -80,122 +71,41 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-SYSCTL_DECL(_net_link);
-static SYSCTL_NODE(_net_link, OID_AUTO, epair, CTLFLAG_RW | CTLFLAG_MPSAFE, 0,
-"epair sysctl");
-
-#ifdef EPAIR_DEBUG
-static int epair_debug = 0;
-SYSCTL_INT(_net_link_epair, OID_AUTO, epair_debug, CTLFLAG_RW,
-&epair_debug, 0, "if_epair(4) debugging.");
-#defineDPRINTF(fmt, arg...)
\
-   if (epair_debug)\
-   printf("[%s:%d] " fmt, __func__, __LINE__, ##arg)
-#else
-#defineDPRINTF(fmt, arg...)
-#endif
-
-static void epair_nh_sintr(struct mbuf *);
-static struct mbuf *epair_nh_m2cpuid(struct mbuf *, uintptr_t, u_int *);
-static void epair_nh_drainedcpu(u_int);
-
-static void epair_start_locked(struct ifnet *);
-static int epair_media_change(struct ifnet *);
-static void epair_media_status(struct ifnet *, struct ifmediareq *);
-
 static int epair_clone_match(struct if_clone *, const char *);
 static int epair_clone_create(struct if_clone *, char *, size_t, caddr_t);
 static int epair_clone_destroy(struct if_clone *, struct ifnet *);
 
 static const char epairname[] = "epair";
-static unsigned int next_index = 0;
+#defineRXRSIZE 4096/* Probably overkill by 4-8x. */
 
-/* Netisr related definitions and sysctl. */
-static struct netisr_handler epair_nh = {
-   .nh_name= epairname,
-   .nh_proto   = NETISR_EPAIR,
-   .nh_policy  = NETISR_POLICY_CPU,
-   .nh_handler = epair_nh_sintr,
-   .nh_m2cpuid = epair_nh_m2cpuid,
-   .nh_drainedcpu  = epair_nh_drainedcpu,
-};
+static MALLOC_DEFINE(M_EPAIR, epairname,
+"Pair of virtual cross-over connected Ethernet-like interfaces");
 
-static int
-sysctl_epair_netisr_maxqlen(SYSCTL_HANDLER_ARGS)
-{
-   int error, qlimit;
+VNET_DEFINE_STATIC(struct if_clone *, epair_cloner);
+#defineV_epair_cloner  VNET(epair_cloner)
 
-   netisr_getqlimit(&epair_nh, &qlimit);
-   error = sysctl_handle_int(oidp, &qlimit, 0, req);
-   if (error || !req->newptr)
-   return (error);
-   if (qlimit < 1)
-   return (EINVAL);
-   return (netisr_setqlimit(&epair_nh, qlimit));
-}
-SYSCTL_PROC(_net_link_epair, OID_AUTO, netisr_maxqlen,
-CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, 0, 0,
-sysctl_epair_netisr_maxqlen, "I",
-"Maximum if_epair(4) netisr \"hw\" queue length");
+static unsigned int next_index = 0;
+#defineEPAIR_LOCK_INIT()   mtx_init(&epair_n_index_mtx, 
"epairidx", \
+   NULL, MTX_DEF)
+#defineEPAIR_LOCK_DESTROY()mtx_destroy(&epair_n_index_mtx)
+#de

git: f8b998c73058 - stable/13 - usb(4): Fix for use after free in combination with EVDEV_SUPPORT.

2021-11-02 Thread Hans Petter Selasky
The branch stable/13 has been updated by hselasky:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=f8b998c73058412eb5d3111ba5784bf3ae11534c

commit f8b998c73058412eb5d3111ba5784bf3ae11534c
Author: Hans Petter Selasky 
AuthorDate: 2021-10-24 11:38:04 +
Commit: Hans Petter Selasky 
CommitDate: 2021-11-02 08:37:25 +

usb(4): Fix for use after free in combination with EVDEV_SUPPORT.

When EVDEV_SUPPORT was introduced, the USB transfers may be running
after the main FIFO is closed. In connection to this a race may appear
which can lead to use-after-free scenarios. Fix this for all FIFO
consumers by initializing and resetting the FIFO queues under the
lock used by the client. Then the client driver will see an empty
queue in all cases a race may appear.

Found by:   pho@
Sponsored by:   NVIDIA Networking

(cherry picked from commit aad0c65d6b37364d8ba92ecb8c85e004398a5194)
---
 sys/dev/usb/usb_dev.c | 47 ++-
 1 file changed, 34 insertions(+), 13 deletions(-)

diff --git a/sys/dev/usb/usb_dev.c b/sys/dev/usb/usb_dev.c
index 88b36e68976b..99b243464f6c 100644
--- a/sys/dev/usb/usb_dev.c
+++ b/sys/dev/usb/usb_dev.c
@@ -1938,18 +1938,30 @@ int
 usb_fifo_alloc_buffer(struct usb_fifo *f, usb_size_t bufsize,
 uint16_t nbuf)
 {
+   struct usb_ifqueue temp_q = {};
+   void *queue_data;
+
usb_fifo_free_buffer(f);
 
-   /* allocate an endpoint */
-   f->free_q.ifq_maxlen = nbuf;
-   f->used_q.ifq_maxlen = nbuf;
+   temp_q.ifq_maxlen = nbuf;
 
-   f->queue_data = usb_alloc_mbufs(
-   M_USBDEV, &f->free_q, bufsize, nbuf);
+   queue_data = usb_alloc_mbufs(
+   M_USBDEV, &temp_q, bufsize, nbuf);
 
-   if ((f->queue_data == NULL) && bufsize && nbuf) {
+   if (queue_data == NULL && bufsize != 0 && nbuf != 0)
return (ENOMEM);
-   }
+
+   mtx_lock(f->priv_mtx);
+
+   /*
+* Setup queues and sizes under lock to avoid early use by
+* concurrent FIFO access:
+*/
+   f->free_q = temp_q;
+   f->used_q.ifq_maxlen = nbuf;
+   f->queue_data = queue_data;
+   mtx_unlock(f->priv_mtx);
+
return (0); /* success */
 }
 
@@ -1962,15 +1974,24 @@ usb_fifo_alloc_buffer(struct usb_fifo *f, usb_size_t 
bufsize,
 void
 usb_fifo_free_buffer(struct usb_fifo *f)
 {
-   if (f->queue_data) {
-   /* free old buffer */
-   free(f->queue_data, M_USBDEV);
-   f->queue_data = NULL;
-   }
-   /* reset queues */
+   void *queue_data;
+
+   mtx_lock(f->priv_mtx);
+
+   /* Get and clear pointer to free, if any. */
+   queue_data = f->queue_data;
+   f->queue_data = NULL;
 
+   /*
+* Reset queues under lock to avoid use of freed buffers by
+* concurrent FIFO activity:
+*/
memset(&f->free_q, 0, sizeof(f->free_q));
memset(&f->used_q, 0, sizeof(f->used_q));
+   mtx_unlock(f->priv_mtx);
+
+   /* Free old buffer, if any. */
+   free(queue_data, M_USBDEV);
 }
 
 void



git: bb9bee1ffbb2 - stable/12 - usb(4): Fix for use after free in combination with EVDEV_SUPPORT.

2021-11-02 Thread Hans Petter Selasky
The branch stable/12 has been updated by hselasky:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=bb9bee1ffbb27f903bfd2c11d681d331bea727ea

commit bb9bee1ffbb27f903bfd2c11d681d331bea727ea
Author: Hans Petter Selasky 
AuthorDate: 2021-10-24 11:38:04 +
Commit: Hans Petter Selasky 
CommitDate: 2021-11-02 08:43:44 +

usb(4): Fix for use after free in combination with EVDEV_SUPPORT.

When EVDEV_SUPPORT was introduced, the USB transfers may be running
after the main FIFO is closed. In connection to this a race may appear
which can lead to use-after-free scenarios. Fix this for all FIFO
consumers by initializing and resetting the FIFO queues under the
lock used by the client. Then the client driver will see an empty
queue in all cases a race may appear.

Found by:   pho@
Sponsored by:   NVIDIA Networking

(cherry picked from commit aad0c65d6b37364d8ba92ecb8c85e004398a5194)
---
 sys/dev/usb/usb_dev.c | 47 ++-
 1 file changed, 34 insertions(+), 13 deletions(-)

diff --git a/sys/dev/usb/usb_dev.c b/sys/dev/usb/usb_dev.c
index 9cd54bf0032c..d1a65bf8561b 100644
--- a/sys/dev/usb/usb_dev.c
+++ b/sys/dev/usb/usb_dev.c
@@ -1951,18 +1951,30 @@ int
 usb_fifo_alloc_buffer(struct usb_fifo *f, usb_size_t bufsize,
 uint16_t nbuf)
 {
+   struct usb_ifqueue temp_q = {};
+   void *queue_data;
+
usb_fifo_free_buffer(f);
 
-   /* allocate an endpoint */
-   f->free_q.ifq_maxlen = nbuf;
-   f->used_q.ifq_maxlen = nbuf;
+   temp_q.ifq_maxlen = nbuf;
 
-   f->queue_data = usb_alloc_mbufs(
-   M_USBDEV, &f->free_q, bufsize, nbuf);
+   queue_data = usb_alloc_mbufs(
+   M_USBDEV, &temp_q, bufsize, nbuf);
 
-   if ((f->queue_data == NULL) && bufsize && nbuf) {
+   if (queue_data == NULL && bufsize != 0 && nbuf != 0)
return (ENOMEM);
-   }
+
+   mtx_lock(f->priv_mtx);
+
+   /*
+* Setup queues and sizes under lock to avoid early use by
+* concurrent FIFO access:
+*/
+   f->free_q = temp_q;
+   f->used_q.ifq_maxlen = nbuf;
+   f->queue_data = queue_data;
+   mtx_unlock(f->priv_mtx);
+
return (0); /* success */
 }
 
@@ -1975,15 +1987,24 @@ usb_fifo_alloc_buffer(struct usb_fifo *f, usb_size_t 
bufsize,
 void
 usb_fifo_free_buffer(struct usb_fifo *f)
 {
-   if (f->queue_data) {
-   /* free old buffer */
-   free(f->queue_data, M_USBDEV);
-   f->queue_data = NULL;
-   }
-   /* reset queues */
+   void *queue_data;
+
+   mtx_lock(f->priv_mtx);
+
+   /* Get and clear pointer to free, if any. */
+   queue_data = f->queue_data;
+   f->queue_data = NULL;
 
+   /*
+* Reset queues under lock to avoid use of freed buffers by
+* concurrent FIFO activity:
+*/
memset(&f->free_q, 0, sizeof(f->free_q));
memset(&f->used_q, 0, sizeof(f->used_q));
+   mtx_unlock(f->priv_mtx);
+
+   /* Free old buffer, if any. */
+   free(queue_data, M_USBDEV);
 }
 
 void



git: 6d04e1422e70 - main - cosl(): fix polynomial approximation coefficients for ld128 version

2021-11-02 Thread Konstantin Belousov
The branch main has been updated by kib:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=6d04e1422e70ca0a77552782c01c291f90716773

commit 6d04e1422e70ca0a77552782c01c291f90716773
Author: Steve Kargl 
AuthorDate: 2021-11-02 08:54:10 +
Commit: Konstantin Belousov 
CommitDate: 2021-11-02 08:54:10 +

cosl(): fix polynomial approximation coefficients for ld128 version

As mention previously, the minmax polynomial approximation
in the kernel for cosl() seem to have a bad set of coefficients.

In testing, cosl() in the interval [0.785, pi/4] for 1 million
values and pi/4 written to 37 decimal digits.  The old version
on an aarch64 system gave

% tlibm/tlibm_lmath -l -x 0.78 -X
7.85398163397448309615660845819875721e-1L cos
Interval tested for cosl: [0.78,0.785398]
count: 100
  xm =  7.80213913234863919029058821396125599e-01L
  libm =  7.10763080972549562455058499280609083e-01L
  mpfr =  7.10763080972549562455058499280608983e-01L
  ULP = 1.04431

The max ULP exceeds 1, which is not good.  So, I rinsed off a 10
year code and recomputed coefficients.  The new minmax polynomial
now yields

% tlibm/tlibm_lmath -l -x 0.78 -X
7.85398163397448309615660845819875721e-1L cos
Interval tested for cosl: [0.78,0.785398]
count: 100
  xm =  7.82916198746768272588844890973704219e-01L
  libm =  7.08859615479571058183956453286628396e-01L
  mpfr =  7.08859615479571058183956453286628469e-01L
  ULP = 0.75407

which is very good.

PR: 218514
MFC after:  1 week
---
 lib/msun/ld128/k_cosl.c | 32 +++-
 1 file changed, 15 insertions(+), 17 deletions(-)

diff --git a/lib/msun/ld128/k_cosl.c b/lib/msun/ld128/k_cosl.c
index fe57773a1348..422357bf8a6c 100644
--- a/lib/msun/ld128/k_cosl.c
+++ b/lib/msun/ld128/k_cosl.c
@@ -21,8 +21,8 @@ __FBSDID("$FreeBSD$");
 #include "math_private.h"
 
 /*
- * Domain [-0.7854, 0.7854], range ~[-1.80e-37, 1.79e-37]:
- * |cos(x) - c(x))| < 2**-122.0
+ * Domain [-0.7854, 0.7854], range ~[-1.17e-39, 1.19e-39]:
+ * |cos(x) - c(x))| < 2**-129.3
  *
  * 113-bit precision requires more care than 64-bit precision, since
  * simple methods give a minimax polynomial with coefficient for x^2
@@ -31,21 +31,19 @@ __FBSDID("$FreeBSD$");
  */
 static const double
 one = 1.0;
-
 static const long double
-C1 =  0.0416658424671L,
-C2 = -0.001388863490893732L,
-C3 =  0.2480158730158730158730158600795304914210L,
-C4 = -0.2755731922398589065255474947078934284324e-6L,
-C5 =  0.2087675698786809897659225313136400793948e-8L,
-C6 = -0.1147074559772972315817149986812031204775e-10L,
-C7 =  0.4779477332386808976875457937252120293400e-13L;
-
-static const double
-C8 = -0.1561920696721507929516718307820958119868e-15,
-C9 =  0.4110317413744594971475941557607804508039e-18,
-C10 = -0.8896592467191938803288521958313920156409e-21,
-C11 =  0.1601061435794535138244346256065192782581e-23;
+C1 =  4.167e-02L,
+C2 = -1.334e-03L,
+C3 =  2.48015873015873015873015873015446795e-05L,
+C4 = -2.75573192239858906525573190949988493e-07L,
+C5 =  2.08767569878680989792098886701451072e-09L,
+C6 = -1.1470745597729724713665739971865e-11L,
+C7 =  4.77947733238738518870113294139830239e-14L,
+C8 = -1.56192069685858079920640872925306403e-16L,
+C9 =  4.11031762320473354032038893429515732e-19L,
+C10= -8.89679121027589608738005163931958096e-22L,
+C11=  1.61171797801314301767074036661901531e-24L,
+C12= -2.46748624357670948912574279501044295e-27L;
 
 long double
 __kernel_cosl(long double x, long double y)
@@ -54,7 +52,7 @@ __kernel_cosl(long double x, long double y)
 
z  = x*x;
r  = z*(C1+z*(C2+z*(C3+z*(C4+z*(C5+z*(C6+z*(C7+
-   z*(C8+z*(C9+z*(C10+z*C11));
+   z*(C8+z*(C9+z*(C10+z*(C11+z*C12)));
hz = 0.5*z;
w  = one-hz;
return w + (((one-w)-hz) + (z*r-x*y));



git: a670e1c13a52 - main - arm: Fix handling of undefined instruction aborts in THUMB2 mode.

2021-11-02 Thread Michal Meloun
The branch main has been updated by mmel:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=a670e1c13a522df4fb8c63bb023b88b1d65de797

commit a670e1c13a522df4fb8c63bb023b88b1d65de797
Author: Michal Meloun 
AuthorDate: 2021-10-17 17:36:33 +
Commit: Michal Meloun 
CommitDate: 2021-11-02 10:11:44 +

arm: Fix handling of undefined instruction aborts in THUMB2 mode.

Correctly recognize NEON/SIMD and VFP instructions in THUMB2 mode and pass
these to the appropriate handler. Note that it is not necessary to filter
all undefined instruction variant or register combinations, this is a job
for given handler.

Reported by:Robert Clausecker 
PR: 259187
MFC after:  2 weks
---
 sys/arm/arm/undefined.c | 39 +++
 1 file changed, 23 insertions(+), 16 deletions(-)

diff --git a/sys/arm/arm/undefined.c b/sys/arm/arm/undefined.c
index 4e9a5295d338..d95b02e2bbb4 100644
--- a/sys/arm/arm/undefined.c
+++ b/sys/arm/arm/undefined.c
@@ -90,13 +90,25 @@ __FBSDID("$FreeBSD$");
 
 #defineARM_COPROC_INSN(insn)   (((insn) & (1 << 27)) != 0)
 #defineARM_VFP_INSN(insn)  insn) & 0xfe00) == 0xf200) 
|| \
-(((insn) & 0xff10) == 0xf400))
+(((insn) & 0xff10) == 0xf400))
 #defineARM_COPROC(insn)(((insn) >> 8) & 0xf)
 
-#defineTHUMB_32BIT_INSN(insn)  ((insn) >= 0xe800)
+#defineTHUMB_32BIT_INSN(insn)  insn) & 0xe000) == 0xe000) && \
+(((insn) & 0x1800) != 0))
+/*
+ * Coprocessor, Advanced SIMD, and
+ * Floating-point instructions on page A6-251
+ * OP1 == 01 OR 11
+ * OP2 == 1xx
+ */
 #defineTHUMB_COPROC_INSN(insn) (((insn) & (3 << 26)) == (3 << 26))
-#defineTHUMB_COPROC_UNDEFINED(insn) (((insn) & 0x3e << 20) == 0)
-#defineTHUMB_VFP_INSN(insn)(((insn) & (3 << 24)) == (3 << 24))
+/*
+ * Advanced SIMD element or structure
+ * load/store instructions on page A7-275
+ * OP1 == 11
+ * OP2 == 001xxx0
+*/
+#defineTHUMB_VFP_INSN(insn)(((insn) & (0x1F1 << 20)) == (0x190 << 
20))
 #defineTHUMB_COPROC(insn)  (((insn) >> 8) & 0xf)
 
 #defineCOPROC_VFP  10
@@ -278,18 +290,13 @@ undefinedinstruction(struct trapframe *frame)
fault_instruction <<= 16;
fault_instruction |= *(uint16_t *)(fault_pc + 2);
 
-   /*
-* Is it a Coprocessor, Advanced SIMD, or
-* Floating-point instruction.
-*/
-   if (THUMB_COPROC_INSN(fault_instruction)) {
-   if (THUMB_COPROC_UNDEFINED(fault_instruction)) {
-   /* undefined insn */
-   } else if (THUMB_VFP_INSN(fault_instruction))
-   coprocessor = COPROC_VFP;
-   else
-   coprocessor =
-   THUMB_COPROC(fault_instruction);
+   /* Coprocessor, Advanced SIMD and Floating-point */
+   if (THUMB_COPROC_INSN(fault_instruction))
+   coprocessor = THUMB_COPROC(fault_instruction);
+   else {
+   /* Advanced SIMD load/store */
+   if (THUMB_VFP_INSN(fault_instruction))
+   coprocessor = COPROC_VFP; /* SIMD */
}
}
 #else



git: bdc677eec9e1 - internal/admin - Safekeep src bit of roberto@ Approved by: core

2021-11-02 Thread Muhammad Moinur Rahman
The branch internal/admin has been updated by bofh (ports committer):

URL: 
https://cgit.FreeBSD.org/src/commit/?id=bdc677eec9e151c045a83434d95ce39b6ef3323d

commit bdc677eec9e151c045a83434d95ce39b6ef3323d
Author: Muhammad Moinur Rahman 
AuthorDate: 2021-11-02 14:05:31 +
Commit: Muhammad Moinur Rahman 
CommitDate: 2021-11-02 14:05:31 +

Safekeep src bit of roberto@
Approved by: core
---
 access | 1 -
 1 file changed, 1 deletion(-)

diff --git a/access b/access
index 275def0e150c..8f9707566697 100644
--- a/access
+++ b/access
@@ -163,7 +163,6 @@ rew
 rgrimes
 rlibby
 rmacklem
-roberto
 royger
 rpokala
 rrs



git: 795a65fbf16c - internal/admin - Safekeep src bit of slavash@ Approved by: core

2021-11-02 Thread Muhammad Moinur Rahman
The branch internal/admin has been updated by bofh (ports committer):

URL: 
https://cgit.FreeBSD.org/src/commit/?id=795a65fbf16c631e8eb8289273d527e432207334

commit 795a65fbf16c631e8eb8289273d527e432207334
Author: Muhammad Moinur Rahman 
AuthorDate: 2021-11-02 14:07:00 +
Commit: Muhammad Moinur Rahman 
CommitDate: 2021-11-02 14:07:00 +

Safekeep src bit of slavash@
Approved by: core
---
 access | 1 -
 1 file changed, 1 deletion(-)

diff --git a/access b/access
index 8f9707566697..a8e60b829068 100644
--- a/access
+++ b/access
@@ -178,7 +178,6 @@ sef
 sgalabov
 shurd
 sjg
-slavash
 sobomax
 stevek
 syrinx



git: fb63cce0b7d1 - internal/admin - Safekeep src bit of shurd@ Approved by: core

2021-11-02 Thread Muhammad Moinur Rahman
The branch internal/admin has been updated by bofh (ports committer):

URL: 
https://cgit.FreeBSD.org/src/commit/?id=fb63cce0b7d1eacd8cda31eda4f916c97b74302c

commit fb63cce0b7d1eacd8cda31eda4f916c97b74302c
Author: Muhammad Moinur Rahman 
AuthorDate: 2021-11-02 14:08:52 +
Commit: Muhammad Moinur Rahman 
CommitDate: 2021-11-02 14:08:52 +

Safekeep src bit of shurd@
Approved by: core
---
 access | 1 -
 1 file changed, 1 deletion(-)

diff --git a/access b/access
index a8e60b829068..675a528f933e 100644
--- a/access
+++ b/access
@@ -176,7 +176,6 @@ scottph
 se
 sef
 sgalabov
-shurd
 sjg
 sobomax
 stevek



git: d65c68dbcfeb - internal/admin - Safekeep src bit of arybchik@ Approved by: core

2021-11-02 Thread Muhammad Moinur Rahman
The branch internal/admin has been updated by bofh (ports committer):

URL: 
https://cgit.FreeBSD.org/src/commit/?id=d65c68dbcfeb75c3bd78e78b551ebaee4d80837f

commit d65c68dbcfeb75c3bd78e78b551ebaee4d80837f
Author: Muhammad Moinur Rahman 
AuthorDate: 2021-11-02 14:10:27 +
Commit: Muhammad Moinur Rahman 
CommitDate: 2021-11-02 14:10:27 +

Safekeep src bit of arybchik@
Approved by: core
---
 access | 1 -
 1 file changed, 1 deletion(-)

diff --git a/access b/access
index 675a528f933e..5acad8056e59 100644
--- a/access
+++ b/access
@@ -27,7 +27,6 @@ andrew
 anish
 antoine
 arichardson
-arybchik
 asomers
 avatar
 avg



git: 81f03b19c556 - internal/admin - Safekeep src bit of avos@ Approved by: core

2021-11-02 Thread Muhammad Moinur Rahman
The branch internal/admin has been updated by bofh (ports committer):

URL: 
https://cgit.FreeBSD.org/src/commit/?id=81f03b19c556f08c683ca02b9be2465a04dd06f5

commit 81f03b19c556f08c683ca02b9be2465a04dd06f5
Author: Muhammad Moinur Rahman 
AuthorDate: 2021-11-02 14:12:16 +
Commit: Muhammad Moinur Rahman 
CommitDate: 2021-11-02 14:12:16 +

Safekeep src bit of avos@
Approved by: core
---
 access | 1 -
 1 file changed, 1 deletion(-)

diff --git a/access b/access
index 5acad8056e59..4380d7731ea2 100644
--- a/access
+++ b/access
@@ -30,7 +30,6 @@ arichardson
 asomers
 avatar
 avg
-avos
 bapt
 bcran
 bdragon



git: c9c160773a15 - internal/admin - Safekeep src bit of emax@ Approved by: core

2021-11-02 Thread Muhammad Moinur Rahman
The branch internal/admin has been updated by bofh (ports committer):

URL: 
https://cgit.FreeBSD.org/src/commit/?id=c9c160773a15d25e35791076f899eb67c946195b

commit c9c160773a15d25e35791076f899eb67c946195b
Author: Muhammad Moinur Rahman 
AuthorDate: 2021-11-02 14:13:33 +
Commit: Muhammad Moinur Rahman 
CommitDate: 2021-11-02 14:13:33 +

Safekeep src bit of emax@
Approved by: core
---
 access | 1 -
 1 file changed, 1 deletion(-)

diff --git a/access b/access
index 4380d7731ea2..d9d703671c83 100644
--- a/access
+++ b/access
@@ -60,7 +60,6 @@ dteske
 dwmalone   dwmalone=freebsd-committ...@maths.tcd.ie
 eadler
 emaste
-emax
 erj
 eugen
 fabient



git: 87a496bd9aa7 - internal/admin - Safekeep src bit of fabient@ Approved by: core

2021-11-02 Thread Muhammad Moinur Rahman
The branch internal/admin has been updated by bofh (ports committer):

URL: 
https://cgit.FreeBSD.org/src/commit/?id=87a496bd9aa7d018f823da2fca151e8067f4d866

commit 87a496bd9aa7d018f823da2fca151e8067f4d866
Author: Muhammad Moinur Rahman 
AuthorDate: 2021-11-02 14:28:46 +
Commit: Muhammad Moinur Rahman 
CommitDate: 2021-11-02 14:28:46 +

Safekeep src bit of fabient@
Approved by: core
---
 access | 1 -
 1 file changed, 1 deletion(-)

diff --git a/access b/access
index d9d703671c83..365d86c9c74c 100644
--- a/access
+++ b/access
@@ -62,7 +62,6 @@ eadler
 emaste
 erj
 eugen
-fabient
 freqlabs
 fsu
 gad



git: a24e639bc747 - internal/admin - Safekeep src bit of jchandra@ Approved by: core

2021-11-02 Thread Muhammad Moinur Rahman
The branch internal/admin has been updated by bofh (ports committer):

URL: 
https://cgit.FreeBSD.org/src/commit/?id=a24e639bc747d926f88464633afc5af132c39f8a

commit a24e639bc747d926f88464633afc5af132c39f8a
Author: Muhammad Moinur Rahman 
AuthorDate: 2021-11-02 14:31:02 +
Commit: Muhammad Moinur Rahman 
CommitDate: 2021-11-02 14:31:02 +

Safekeep src bit of jchandra@
Approved by: core
---
 access | 1 -
 1 file changed, 1 deletion(-)

diff --git a/access b/access
index 365d86c9c74c..0a4489b4419c 100644
--- a/access
+++ b/access
@@ -85,7 +85,6 @@ jah
 jamie
 jasone
 jceel
-jchandra
 jeff
 jhb
 jhibbits



git: d5948cb481cb - internal/admin - Safekeep src bit of jlh@

2021-11-02 Thread Muhammad Moinur Rahman
The branch internal/admin has been updated by bofh (ports committer):

URL: 
https://cgit.FreeBSD.org/src/commit/?id=d5948cb481cb9e923cff67d31f0dbc6a6537c180

commit d5948cb481cb9e923cff67d31f0dbc6a6537c180
Author: Muhammad Moinur Rahman 
AuthorDate: 2021-11-02 14:32:45 +
Commit: Muhammad Moinur Rahman 
CommitDate: 2021-11-02 14:32:45 +

Safekeep src bit of jlh@

Approved by: core
---
 access | 1 -
 1 file changed, 1 deletion(-)

diff --git a/access b/access
index 0a4489b4419c..fe9ee04601ba 100644
--- a/access
+++ b/access
@@ -90,7 +90,6 @@ jhb
 jhibbits
 jilles
 jkim
-jlh
 jmallett
 jmg
 joerg  freebsd-de...@uriah.heep.sax.de



git: fffbb3ff6693 - internal/admin - Safekeep src bit of jasone@

2021-11-02 Thread Muhammad Moinur Rahman
The branch internal/admin has been updated by bofh (ports committer):

URL: 
https://cgit.FreeBSD.org/src/commit/?id=fffbb3ff669378159f41d814c7216924fd378c84

commit fffbb3ff669378159f41d814c7216924fd378c84
Author: Muhammad Moinur Rahman 
AuthorDate: 2021-11-02 14:34:01 +
Commit: Muhammad Moinur Rahman 
CommitDate: 2021-11-02 14:34:01 +

Safekeep src bit of jasone@

Approved by: core
---
 access | 1 -
 1 file changed, 1 deletion(-)

diff --git a/access b/access
index fe9ee04601ba..36b2c0c22180 100644
--- a/access
+++ b/access
@@ -83,7 +83,6 @@ ian
 imp
 jah
 jamie
-jasone
 jceel
 jeff
 jhb



git: fa3d3d9471d7 - internal/admin - Safekeep src bit of anish@

2021-11-02 Thread Muhammad Moinur Rahman
The branch internal/admin has been updated by bofh (ports committer):

URL: 
https://cgit.FreeBSD.org/src/commit/?id=fa3d3d9471d78f8d9d8480b29668bd8f482f038f

commit fa3d3d9471d78f8d9d8480b29668bd8f482f038f
Author: Muhammad Moinur Rahman 
AuthorDate: 2021-11-02 14:35:17 +
Commit: Muhammad Moinur Rahman 
CommitDate: 2021-11-02 14:35:17 +

Safekeep src bit of anish@

Approved by: core
---
 access | 1 -
 1 file changed, 1 deletion(-)

diff --git a/access b/access
index 36b2c0c22180..079f920d5720 100644
--- a/access
+++ b/access
@@ -24,7 +24,6 @@ allanjude
 ambrisko
 andreast
 andrew
-anish
 antoine
 arichardson
 asomers



git: c777f7fa744c - internal/admin - Safekeep src bit of sgalabov@

2021-11-02 Thread Muhammad Moinur Rahman
The branch internal/admin has been updated by bofh (ports committer):

URL: 
https://cgit.FreeBSD.org/src/commit/?id=c777f7fa744c1ff64ec423697b8149c68a7de0a9

commit c777f7fa744c1ff64ec423697b8149c68a7de0a9
Author: Muhammad Moinur Rahman 
AuthorDate: 2021-11-02 14:56:25 +
Commit: Muhammad Moinur Rahman 
CommitDate: 2021-11-02 14:56:25 +

Safekeep src bit of sgalabov@

Approved by: core
---
 access | 1 -
 1 file changed, 1 deletion(-)

diff --git a/access b/access
index 079f920d5720..df4ee3849fdf 100644
--- a/access
+++ b/access
@@ -167,7 +167,6 @@ scottl
 scottph
 se
 sef
-sgalabov
 sjg
 sobomax
 stevek



git: a5252029fbbd - internal/admin - Safekeep src bit of gavin@

2021-11-02 Thread Muhammad Moinur Rahman
The branch internal/admin has been updated by bofh (ports committer):

URL: 
https://cgit.FreeBSD.org/src/commit/?id=a5252029fbbdf6bb98ecfb5aa54870a34939bde0

commit a5252029fbbdf6bb98ecfb5aa54870a34939bde0
Author: Muhammad Moinur Rahman 
AuthorDate: 2021-11-02 14:57:56 +
Commit: Muhammad Moinur Rahman 
CommitDate: 2021-11-02 14:57:56 +

Safekeep src bit of gavin@

Approved by: core
---
 access | 1 -
 1 file changed, 1 deletion(-)

diff --git a/access b/access
index df4ee3849fdf..45fb87fde6ba 100644
--- a/access
+++ b/access
@@ -66,7 +66,6 @@ fsu
 gad
 gallatin
 ganbold
-gavin
 gjb
 glebius
 gnn



git: 6d1e52462979 - internal/admin - Safekeep src bit of pjd@

2021-11-02 Thread Muhammad Moinur Rahman
The branch internal/admin has been updated by bofh (ports committer):

URL: 
https://cgit.FreeBSD.org/src/commit/?id=6d1e52462979149ac33f5d7e11a3786d3dcb1853

commit 6d1e52462979149ac33f5d7e11a3786d3dcb1853
Author: Muhammad Moinur Rahman 
AuthorDate: 2021-11-02 14:59:10 +
Commit: Muhammad Moinur Rahman 
CommitDate: 2021-11-02 14:59:10 +

Safekeep src bit of pjd@

Approved by: core
---
 access | 1 -
 1 file changed, 1 deletion(-)

diff --git a/access b/access
index 45fb87fde6ba..a1eb7d2e987d 100644
--- a/access
+++ b/access
@@ -142,7 +142,6 @@ phil
 philip
 phk
 pho
-pjd
 pkelsey
 pluknet
 pstef



git: 2390a1441eff - main - LinuxKPI: Add sysctl(8) knob to control verbosity of WARN_ON's.

2021-11-02 Thread Hans Petter Selasky
The branch main has been updated by hselasky:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=2390a1441effaba0e3d0f2f447f448aaf20428f1

commit 2390a1441effaba0e3d0f2f447f448aaf20428f1
Author: Hans Petter Selasky 
AuthorDate: 2021-11-02 15:52:46 +
Commit: Hans Petter Selasky 
CommitDate: 2021-11-02 15:53:34 +

LinuxKPI: Add sysctl(8) knob to control verbosity of WARN_ON's.

The purpose of this change is to reduce the amount of dmesg(8) noise when
VT switching after a panic.

Submitted by:   Greg V 
MFC after:  1 week
Differential Revision:  https://reviews.freebsd.org/D30174
Sponsored by:   NVIDIA Networking
---
 sys/compat/linuxkpi/common/include/linux/kernel.h | 25 +--
 sys/compat/linuxkpi/common/src/linux_compat.c |  5 +
 2 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/sys/compat/linuxkpi/common/include/linux/kernel.h 
b/sys/compat/linuxkpi/common/include/linux/kernel.h
index 6cbd95c4ac64..94af8f29c4d7 100644
--- a/sys/compat/linuxkpi/common/include/linux/kernel.h
+++ b/sys/compat/linuxkpi/common/include/linux/kernel.h
@@ -121,28 +121,31 @@ extern const volatile int lkpi_build_bug_on_zero;
}   \
 } while (0)
 
+extern int linuxkpi_warn_dump_stack;
 #defineWARN_ON(cond) ({\
-  bool __ret = (cond); \
-  if (__ret) { \
+   bool __ret = (cond);\
+   if (__ret) {\
printf("WARNING %s failed at %s:%d\n",  \
__stringify(cond), __FILE__, __LINE__); \
-   linux_dump_stack(); \
-  }\
-  unlikely(__ret); \
+   if (linuxkpi_warn_dump_stack)   \
+   linux_dump_stack(); \
+   }   \
+   unlikely(__ret);\
 })
 
 #defineWARN_ON_SMP(cond)   WARN_ON(cond)
 
 #defineWARN_ON_ONCE(cond) ({   \
-  static bool __warn_on_once;  \
-  bool __ret = (cond); \
-  if (__ret && !__warn_on_once) {  \
+   static bool __warn_on_once; \
+   bool __ret = (cond);\
+   if (__ret && !__warn_on_once) { \
__warn_on_once = 1; \
printf("WARNING %s failed at %s:%d\n",  \
__stringify(cond), __FILE__, __LINE__); \
-   linux_dump_stack(); \
-  }\
-  unlikely(__ret); \
+   if (linuxkpi_warn_dump_stack)   \
+   linux_dump_stack(); \
+   }   \
+   unlikely(__ret);\
 })
 
 #defineoops_in_progressSCHEDULER_STOPPED()
diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c 
b/sys/compat/linuxkpi/common/src/linux_compat.c
index a62cf93dbd82..6440f7bdcff4 100644
--- a/sys/compat/linuxkpi/common/src/linux_compat.c
+++ b/sys/compat/linuxkpi/common/src/linux_compat.c
@@ -103,6 +103,11 @@ int linuxkpi_debug;
 SYSCTL_INT(_compat_linuxkpi, OID_AUTO, debug, CTLFLAG_RWTUN,
 &linuxkpi_debug, 0, "Set to enable pr_debug() prints. Clear to disable.");
 
+int linuxkpi_warn_dump_stack = 0;
+SYSCTL_INT(_compat_linuxkpi, OID_AUTO, warn_dump_stack, CTLFLAG_RWTUN,
+&linuxkpi_warn_dump_stack, 0,
+"Set to enable stack traces from WARN_ON(). Clear to disable.");
+
 static struct timeval lkpi_net_lastlog;
 static int lkpi_net_curpps;
 static int lkpi_net_maxpps = 99;



git: d30dc78f798a - main - llvm BPF target: add missed source files

2021-11-02 Thread Dimitry Andric
The branch main has been updated by dim:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=d30dc78f798adebda488d2b8e21290268d2fb501

commit d30dc78f798adebda488d2b8e21290268d2fb501
Author: Dimitry Andric 
AuthorDate: 2021-11-02 16:49:34 +
Commit: Dimitry Andric 
CommitDate: 2021-11-02 16:49:50 +

llvm BPF target: add missed source files

Otherwise, linking llvm binaries with this target enabled (which is not
the default) will fail with a number of undefined symbol errors:

  ld: error: undefined symbol: 
llvm::initializeBPFAdjustOptPass(llvm::PassRegistry&)
  ld: error: undefined symbol: 
llvm::initializeBPFCheckAndAdjustIRPass(llvm::PassRegistry&)
  ld: error: undefined symbol: llvm::createBPFCheckAndAdjustIR()
  ld: error: undefined symbol: llvm::createBPFAdjustOpt()
  ld: error: undefined symbol: llvm::BPFAdjustOptPass::run(llvm::Module&, 
llvm::AnalysisManager&)

Reported by:Michael Dexter 
MFC after:  3 days
---
 lib/clang/libllvm/Makefile | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/clang/libllvm/Makefile b/lib/clang/libllvm/Makefile
index bd0aee918ef3..43f6cfa9302d 100644
--- a/lib/clang/libllvm/Makefile
+++ b/lib/clang/libllvm/Makefile
@@ -1163,7 +1163,9 @@ SRCS_MIN+=Target/ARM/Utils/ARMBaseInfo.cpp
 .if ${MK_LLVM_TARGET_BPF} != "no"
 SRCS_MIN+= Target/BPF/AsmParser/BPFAsmParser.cpp
 SRCS_MIN+= Target/BPF/BPFAbstractMemberAccess.cpp
+SRCS_MIN+= Target/BPF/BPFAdjustOpt.cpp
 SRCS_MIN+= Target/BPF/BPFAsmPrinter.cpp
+SRCS_MIN+= Target/BPF/BPFCheckAndAdjustIR.cpp
 SRCS_MIN+= Target/BPF/BPFFrameLowering.cpp
 SRCS_MIN+= Target/BPF/BPFISelDAGToDAG.cpp
 SRCS_MIN+= Target/BPF/BPFISelLowering.cpp



git: 1a8f198fa665 - main - epair: remove "All rights reserved"

2021-11-02 Thread Bjoern A. Zeeb
The branch main has been updated by bz:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=1a8f198fa66518e6d249fa8aa765ec6e50a4fbab

commit 1a8f198fa66518e6d249fa8aa765ec6e50a4fbab
Author: Bjoern A. Zeeb 
AuthorDate: 2021-11-02 16:48:07 +
Commit: Bjoern A. Zeeb 
CommitDate: 2021-11-02 16:50:26 +

epair: remove "All rights reserved"

Remove "All rights reserved" from The FreeBSD Foundation owned
copyrights on epair code and documentation.

Approved by:emaste (FreeBSD Foundation)
---
 share/man/man4/epair.4 | 1 -
 sys/net/if_epair.c | 1 -
 2 files changed, 2 deletions(-)

diff --git a/share/man/man4/epair.4 b/share/man/man4/epair.4
index 3ea706cb02ac..e1018e4b177f 100644
--- a/share/man/man4/epair.4
+++ b/share/man/man4/epair.4
@@ -1,6 +1,5 @@
 .\"-
 .\" Copyright (c) 2008 The FreeBSD Foundation
-.\" All rights reserved.
 .\"
 .\" This software was developed by CK Software GmbH under sponsorship
 .\" from the FreeBSD Foundation.
diff --git a/sys/net/if_epair.c b/sys/net/if_epair.c
index e46c5271cc0f..89483db46337 100644
--- a/sys/net/if_epair.c
+++ b/sys/net/if_epair.c
@@ -2,7 +2,6 @@
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
  *
  * Copyright (c) 2008 The FreeBSD Foundation
- * All rights reserved.
  * Copyright (c) 2009-2021 Bjoern A. Zeeb 
  *
  * This software was developed by CK Software GmbH under sponsorship



git: 3513df4bcc17 - main - fstyp: fix build WITHOUT_ICONV

2021-11-02 Thread Ed Maste
The branch main has been updated by emaste:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=3513df4bcc172b2b7b923ba62591490d5df1bf5a

commit 3513df4bcc172b2b7b923ba62591490d5df1bf5a
Author: Ed Maste 
AuthorDate: 2021-11-02 13:43:56 +
Commit: Ed Maste 
CommitDate: 2021-11-02 18:54:45 +

fstyp: fix build WITHOUT_ICONV

Reported by:Michael Dexter, Build Option Survey
Sponsored by:   The FreeBSD Foundation
---
 usr.sbin/fstyp/exfat.c | 5 +
 usr.sbin/fstyp/ntfs.c  | 5 +
 2 files changed, 10 insertions(+)

diff --git a/usr.sbin/fstyp/exfat.c b/usr.sbin/fstyp/exfat.c
index 3f10cb6a9e5a..d92d9c828427 100644
--- a/usr.sbin/fstyp/exfat.c
+++ b/usr.sbin/fstyp/exfat.c
@@ -365,6 +365,11 @@ fstyp_exfat(FILE *fp, char *label, size_t size)
 #ifdef WITH_ICONV
if (show_label)
exfat_find_label(fp, ev, bytespersec, label, size);
+#else
+   if (show_label) {
+   warnx("label not available without iconv support");
+   memset(label, 0, size);
+   }
 #endif
 
 out:
diff --git a/usr.sbin/fstyp/ntfs.c b/usr.sbin/fstyp/ntfs.c
index 0ce1fa81181a..c286d950dc2b 100644
--- a/usr.sbin/fstyp/ntfs.c
+++ b/usr.sbin/fstyp/ntfs.c
@@ -179,6 +179,11 @@ fstyp_ntfs(FILE *fp, char *label, size_t size)
}
 
 ok:
+#else
+   if (show_label) {
+   warnx("label not available without iconv support");
+   memset(label, 0, size);
+   }
 #endif /* WITH_ICONV */
free(bf);
free(filerecp);



git: 717857819223 - main - crypto: Use a single "crypto" kproc for all of the OCF kthreads.

2021-11-02 Thread John Baldwin
The branch main has been updated by jhb:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=717857819223d9c0f81eb38abd0df200532e1cdc

commit 717857819223d9c0f81eb38abd0df200532e1cdc
Author: John Baldwin 
AuthorDate: 2021-11-02 18:26:21 +
Commit: John Baldwin 
CommitDate: 2021-11-02 19:18:05 +

crypto: Use a single "crypto" kproc for all of the OCF kthreads.

Reported by:julian
Reviewed by:markj
MFC after:  1 week
Sponsored by:   Chelsio Communications
Differential Revision:  https://reviews.freebsd.org/D32739
---
 sys/opencrypto/crypto.c | 50 -
 1 file changed, 25 insertions(+), 25 deletions(-)

diff --git a/sys/opencrypto/crypto.c b/sys/opencrypto/crypto.c
index 85c22fd51ee2..436444869e90 100644
--- a/sys/opencrypto/crypto.c
+++ b/sys/opencrypto/crypto.c
@@ -168,7 +168,7 @@ struct crypto_ret_worker {
uint32_t reorder_ops;   /* total ordered sym jobs received */
uint32_t reorder_cur_seq;   /* current sym job dispatched */
 
-   struct proc *cryptoretproc;
+   struct thread *td;
 };
 static struct crypto_ret_worker *crypto_ret_workers = NULL;
 
@@ -204,9 +204,9 @@ SYSCTL_INT(_kern, OID_AUTO, cryptodevallowsoft, 
CTLFLAG_RWTUN,
 
 MALLOC_DEFINE(M_CRYPTO_DATA, "crypto", "crypto session records");
 
-static void crypto_proc(void);
-static struct proc *cryptoproc;
-static void crypto_ret_proc(struct crypto_ret_worker *ret_worker);
+static void crypto_dispatch_thread(void *arg);
+static struct thread *cryptotd;
+static void crypto_ret_thread(void *arg);
 static void crypto_destroy(void);
 static int crypto_invoke(struct cryptocap *cap, struct cryptop *crp, int hint);
 static void crypto_task_invoke(void *ctx, int pending);
@@ -296,6 +296,7 @@ static int
 crypto_init(void)
 {
struct crypto_ret_worker *ret_worker;
+   struct proc *p;
int error;
 
mtx_init(&crypto_drivers_mtx, "crypto", "crypto driver table",
@@ -321,8 +322,9 @@ crypto_init(void)
taskqueue_start_threads(&crypto_tq, crypto_workers_num, PRI_MIN_KERN,
"crypto");
 
-   error = kproc_create((void (*)(void *)) crypto_proc, NULL,
-   &cryptoproc, 0, 0, "crypto");
+   p = NULL;
+   error = kproc_kthread_add(crypto_dispatch_thread, NULL, &p, &cryptotd,
+   0, 0, "crypto", "crypto");
if (error) {
printf("crypto_init: cannot start crypto thread; error %d",
error);
@@ -341,8 +343,9 @@ crypto_init(void)
 
mtx_init(&ret_worker->crypto_ret_mtx, "crypto", "crypto return 
queues", MTX_DEF);
 
-   error = kproc_create((void (*)(void *)) crypto_ret_proc, 
ret_worker,
-   &ret_worker->cryptoretproc, 0, 0, "crypto 
returns %td", CRYPTO_RETW_ID(ret_worker));
+   error = kthread_add(crypto_ret_thread, ret_worker, p,
+   &ret_worker->td, 0, 0, "crypto returns %td",
+   CRYPTO_RETW_ID(ret_worker));
if (error) {
printf("crypto_init: cannot start cryptoret thread; 
error %d",
error);
@@ -366,20 +369,16 @@ bad:
  * for the other half of this song-and-dance.
  */
 static void
-crypto_terminate(struct proc **pp, void *q)
+crypto_terminate(struct thread **tdp, void *q)
 {
-   struct proc *p;
+   struct thread *td;
 
mtx_assert(&crypto_drivers_mtx, MA_OWNED);
-   p = *pp;
-   *pp = NULL;
-   if (p) {
+   td = *tdp;
+   *tdp = NULL;
+   if (td != NULL) {
wakeup_one(q);
-   PROC_LOCK(p);   /* NB: insure we don't miss wakeup */
-   CRYPTO_DRIVER_UNLOCK(); /* let crypto_finis progress */
-   msleep(p, &p->p_mtx, PWAIT, "crypto_destroy", 0);
-   PROC_UNLOCK(p);
-   CRYPTO_DRIVER_LOCK();
+   mtx_sleep(td, &crypto_drivers_mtx, PWAIT, "crypto_destroy", 0);
}
 }
 
@@ -442,9 +441,9 @@ crypto_destroy(void)
if (crypto_tq != NULL)
taskqueue_drain_all(crypto_tq);
CRYPTO_DRIVER_LOCK();
-   crypto_terminate(&cryptoproc, &crp_q);
+   crypto_terminate(&cryptotd, &crp_q);
FOREACH_CRYPTO_RETW(ret_worker)
-   crypto_terminate(&ret_worker->cryptoretproc, 
&ret_worker->crp_ret_q);
+   crypto_terminate(&ret_worker->td, &ret_worker->crp_ret_q);
CRYPTO_DRIVER_UNLOCK();
 
/* XXX flush queues??? */
@@ -1708,14 +1707,14 @@ crypto_finis(void *chan)
CRYPTO_DRIVER_LOCK();
wakeup_one(chan);
CRYPTO_DRIVER_UNLOCK();
-   kproc_exit(0);
+   kthread_exit();
 }
 
 /*
  * Crypto thread, dispatches crypto requests.
  */
 static void
-crypto_proc(void)
+crypto_dispatch_thread(void *arg __unused)
 {
struct cryptop *crp, *submit;
struct cryptocap *cap;
@@ -1804,7 +1803,7 @@ crypto_proc(void)
c

git: 4e057806cf56 - main - crypto: Cleanup mtx_init() calls.

2021-11-02 Thread John Baldwin
The branch main has been updated by jhb:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=4e057806cf56b238a0a3ef7af140f447d7b67ab5

commit 4e057806cf56b238a0a3ef7af140f447d7b67ab5
Author: John Baldwin 
AuthorDate: 2021-11-02 18:27:20 +
Commit: John Baldwin 
CommitDate: 2021-11-02 19:18:05 +

crypto: Cleanup mtx_init() calls.

Don't pass the same name to multiple mutexes while using unique types
for WITNESS.  Just use the unique types as the mutex names.

Reviewed by:markj
MFC after:  1 week
Sponsored by:   Chelsio Communications
Differential Revision:  https://reviews.freebsd.org/D32740
---
 sys/opencrypto/crypto.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sys/opencrypto/crypto.c b/sys/opencrypto/crypto.c
index 436444869e90..8c5457a48f65 100644
--- a/sys/opencrypto/crypto.c
+++ b/sys/opencrypto/crypto.c
@@ -299,11 +299,10 @@ crypto_init(void)
struct proc *p;
int error;
 
-   mtx_init(&crypto_drivers_mtx, "crypto", "crypto driver table",
-   MTX_DEF|MTX_QUIET);
+   mtx_init(&crypto_drivers_mtx, "crypto driver table", NULL, MTX_DEF);
 
TAILQ_INIT(&crp_q);
-   mtx_init(&crypto_q_mtx, "crypto", "crypto op queues", MTX_DEF);
+   mtx_init(&crypto_q_mtx, "crypto op queues", NULL, MTX_DEF);
 
cryptop_zone = uma_zcreate("cryptop",
sizeof(struct cryptop), NULL, NULL, NULL, NULL,
@@ -341,7 +340,8 @@ crypto_init(void)
ret_worker->reorder_ops = 0;
ret_worker->reorder_cur_seq = 0;
 
-   mtx_init(&ret_worker->crypto_ret_mtx, "crypto", "crypto return 
queues", MTX_DEF);
+   mtx_init(&ret_worker->crypto_ret_mtx, "crypto return queues",
+   NULL, MTX_DEF);
 
error = kthread_add(crypto_ret_thread, ret_worker, p,
&ret_worker->td, 0, 0, "crypto returns %td",



git: 4bb6991531b5 - main - arm/pmu: add ACPI attachment.

2021-11-02 Thread Ruslan Bukin
The branch main has been updated by br:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=4bb6991531b528c89fdadd3316d80b885a7f9bdb

commit 4bb6991531b528c89fdadd3316d80b885a7f9bdb
Author: Ruslan Bukin 
AuthorDate: 2021-11-02 19:35:29 +
Commit: Ruslan Bukin 
CommitDate: 2021-11-02 19:35:29 +

arm/pmu: add ACPI attachment.

This makes hwpmc(4) sampling work on ACPI-based AArch64 systems.
Tested on ARM Neoverse N1.

Submitted by: Greg V 
Reviewed by: jrtc27, mhorne
Differential Revision: https://reviews.freebsd.org/D24423
---
 sys/arm/arm/pmu.h  |   2 +-
 sys/arm/arm/pmu_acpi.c | 195 +
 sys/conf/files.arm64   |   1 +
 3 files changed, 197 insertions(+), 1 deletion(-)

diff --git a/sys/arm/arm/pmu.h b/sys/arm/arm/pmu.h
index bfad6d9da282..657faba28e74 100644
--- a/sys/arm/arm/pmu.h
+++ b/sys/arm/arm/pmu.h
@@ -33,7 +33,7 @@
 #ifndef _ARM_PMU_H_
 #define _ARM_PMU_H_
 
-#defineMAX_RLEN8
+#defineMAX_RLENMAXCPU
 
 struct pmu_intr {
struct resource *res;
diff --git a/sys/arm/arm/pmu_acpi.c b/sys/arm/arm/pmu_acpi.c
new file mode 100644
index ..b1378c24e833
--- /dev/null
+++ b/sys/arm/arm/pmu_acpi.c
@@ -0,0 +1,195 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2020 Greg V 
+ * Copyright (c) 2021 Ruslan Bukin 
+ *
+ * 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.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include "acpi_bus_if.h"
+#include "pmu.h"
+
+struct madt_ctx {
+   struct pmu_softc *sc;
+   int error;
+   int i;
+};
+
+static void
+madt_handler(ACPI_SUBTABLE_HEADER *entry, void *arg)
+{
+   ACPI_MADT_GENERIC_INTERRUPT *intr;
+   struct intr_map_data_acpi *ad;
+   struct intr_map_data *data;
+   struct madt_ctx *ctx;
+   struct pmu_softc *sc;
+   struct pcpu *pcpu;
+   int rid;
+   int cpuid;
+   int i;
+
+   ctx = arg;
+   sc = ctx->sc;
+   rid = ctx->i;
+   cpuid = -1;
+
+   if (ctx->error)
+   return;
+
+   if (entry->Type != ACPI_MADT_TYPE_GENERIC_INTERRUPT)
+   return;
+   intr = (ACPI_MADT_GENERIC_INTERRUPT *)entry;
+
+   for (i = 0; i < MAXCPU; i++) {
+   pcpu = pcpu_find(i);
+   if (pcpu != NULL && pcpu->pc_mpidr == intr->ArmMpidr) {
+   cpuid = i;
+   break;
+   }
+   }
+
+   if (cpuid == -1) {
+   /* pcpu not found. */
+   device_printf(sc->dev, "MADT: could not find pcpu, "
+   "ArmMpidr %lx\n", intr->ArmMpidr);
+   ctx->error = ENODEV;
+   return;
+   }
+
+   if (bootverbose)
+   device_printf(sc->dev, "MADT: cpu %d (mpidr %lu) irq %d "
+   "%s-triggered\n", cpuid, intr->ArmMpidr,
+   intr->PerformanceInterrupt,
+   (intr->Flags & ACPI_MADT_PERFORMANCE_IRQ_MODE) ?
+   "edge" : "level");
+
+   bus_set_resource(sc->dev, SYS_RES_IRQ, ctx->i,
+   intr->PerformanceInterrupt, 1);
+
+   sc->irq[ctx->i].res = bus_alloc_resource_any(sc->dev, SYS_RES_IRQ,
+   &rid, RF_ACTIVE | RF_SHAREABLE);
+   if (sc->irq[ctx->i].res == NULL) {
+   device_printf(sc->dev, "Failed to allocate IRQ %d\n", ctx->i);
+   ctx->error = ENXIO;
+   return;
+   }
+
+   /*
+* BUS_CONFIG_INTR does nothing on arm64, so we manually set trigger
+* mode.
+*/
+   data = rman_get_virtual(sc->irq[ctx->i].res);
+   KASSERT(data->type == INTR_MAP_DATA_A

git: e3ab141fda6a - main - gpart: Move GPT efimedia reporting to a separate routine

2021-11-02 Thread Warner Losh
The branch main has been updated by imp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=e3ab141fda6a999d6fcdf050e07174199eea5557

commit e3ab141fda6a999d6fcdf050e07174199eea5557
Author: Warner Losh 
AuthorDate: 2021-11-02 23:08:37 +
Commit: Warner Losh 
CommitDate: 2021-11-02 23:09:17 +

gpart: Move GPT efimedia reporting to a separate routine

Move the efimedia reporting to g_part_gpt_efimedia and use that from
g_part_gpt_dumpconf to report it.

Sponsored by:   Netflix
Reviewed by:mav
Differential Revision:  https://reviews.freebsd.org/D32780
---
 sys/geom/part/g_part_gpt.c | 14 ++
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/sys/geom/part/g_part_gpt.c b/sys/geom/part/g_part_gpt.c
index 89a92977dff6..1f6d3dff249d 100644
--- a/sys/geom/part/g_part_gpt.c
+++ b/sys/geom/part/g_part_gpt.c
@@ -734,6 +734,15 @@ g_part_gpt_destroy(struct g_part_table *basetable, struct 
g_part_parms *gpp)
return (0);
 }
 
+static void
+g_part_gpt_efimedia(struct g_part_gpt_entry *entry, struct sbuf *sb)
+{
+   sbuf_printf(sb, "HD(%d,GPT,", entry->base.gpe_index);
+   sbuf_printf_uuid(sb, &entry->ent.ent_uuid);
+   sbuf_printf(sb, ",%#jx,%#jx)", (intmax_t)entry->base.gpe_start,
+   (intmax_t)(entry->base.gpe_end - entry->base.gpe_start + 1));
+}
+
 static void
 g_part_gpt_dumpconf(struct g_part_table *table, struct g_part_entry *baseentry,
 struct sbuf *sb, const char *indent)
@@ -768,10 +777,7 @@ g_part_gpt_dumpconf(struct g_part_table *table, struct 
g_part_entry *baseentry,
sbuf_printf_uuid(sb, &entry->ent.ent_uuid);
sbuf_cat(sb, "\n");
sbuf_printf(sb, "%s", indent);
-   sbuf_printf(sb, "HD(%d,GPT,", entry->base.gpe_index);
-   sbuf_printf_uuid(sb, &entry->ent.ent_uuid);
-   sbuf_printf(sb, ",%#jx,%#jx)", (intmax_t)entry->base.gpe_start,
-   (intmax_t)(entry->base.gpe_end - entry->base.gpe_start + 
1));
+   g_part_gpt_efimedia(entry, sb);
sbuf_cat(sb, "\n");
} else {
/* confxml: scheme information */



git: edfbbfd541ab - main - gpart: Move MBR efimedia reporting to a separate routine

2021-11-02 Thread Warner Losh
The branch main has been updated by imp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=edfbbfd541ab9f7ba13b246d86bd0c36757ec660

commit edfbbfd541ab9f7ba13b246d86bd0c36757ec660
Author: Warner Losh 
AuthorDate: 2021-11-02 23:08:48 +
Commit: Warner Losh 
CommitDate: 2021-11-02 23:09:17 +

gpart: Move MBR efimedia reporting to a separate routine

Move the efimedia reporting to g_part_mbr_efimedia and use that from
g_part_mbr_dumpconf to report it.

Sponsored by:   Netflix
Reviewed by:mav
Differential Revision:  https://reviews.freebsd.org/D32781
---
 sys/geom/part/g_part_mbr.c | 19 ++-
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/sys/geom/part/g_part_mbr.c b/sys/geom/part/g_part_mbr.c
index 750d417bba5d..d5d18e52456d 100644
--- a/sys/geom/part/g_part_mbr.c
+++ b/sys/geom/part/g_part_mbr.c
@@ -308,13 +308,24 @@ g_part_mbr_destroy(struct g_part_table *basetable, struct 
g_part_parms *gpp)
return (0);
 }
 
+static void
+g_part_mbr_efimedia(struct g_part_mbr_table *table, struct g_part_mbr_entry 
*entry,
+struct sbuf *sb)
+{
+   uint32_t dsn;
+
+   dsn = le32dec(table->mbr + DOSDSNOFF);
+   sbuf_printf(sb, "HD(%d,MBR,%#08x,%#jx,%#jx)",
+   entry->base.gpe_index, dsn, (intmax_t)entry->base.gpe_start,
+   (intmax_t)(entry->base.gpe_end - entry->base.gpe_start + 1));
+}
+
 static void
 g_part_mbr_dumpconf(struct g_part_table *basetable, struct g_part_entry 
*baseentry,
 struct sbuf *sb, const char *indent)
 {
struct g_part_mbr_entry *entry;
struct g_part_mbr_table *table;
-   uint32_t dsn;
 
table = (struct g_part_mbr_table *)basetable;
entry = (struct g_part_mbr_entry *)baseentry;
@@ -327,10 +338,8 @@ g_part_mbr_dumpconf(struct g_part_table *basetable, struct 
g_part_entry *baseent
entry->ent.dp_typ);
if (entry->ent.dp_flag & 0x80)
sbuf_printf(sb, "%sactive\n", indent);
-   dsn = le32dec(table->mbr + DOSDSNOFF);
-   sbuf_printf(sb, "%sHD(%d,MBR,%#08x,%#jx,%#jx)", 
indent,
-   entry->base.gpe_index, dsn, (intmax_t)entry->base.gpe_start,
-   (intmax_t)(entry->base.gpe_end - entry->base.gpe_start + 
1));
+   sbuf_printf(sb, "%s", indent);
+   g_part_mbr_efimedia(table, entry, sb);
sbuf_cat(sb, "\n");
} else {
/* confxml: scheme information */



git: 331883a2f2e9 - main - nfscl: Check for a forced dismount in nfscl_getref()

2021-11-02 Thread Rick Macklem
The branch main has been updated by rmacklem:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=331883a2f2e9ae5567085e4cd3a7ae3db2a2b022

commit 331883a2f2e9ae5567085e4cd3a7ae3db2a2b022
Author: Rick Macklem 
AuthorDate: 2021-11-03 00:28:13 +
Commit: Rick Macklem 
CommitDate: 2021-11-03 00:28:13 +

nfscl: Check for a forced dismount in nfscl_getref()

The nfscl_getref() function is called within nfscl_doiods() when
the NFSv4.1/4.2 pNFS client is doing I/O on a DS.  As such,
nfscl_getref() needs to check for a forced dismount.
This patch adds that check.

Found during a recent IETF NFSv4 working group testing event.

MFC after:  2 weeks
---
 sys/fs/nfsclient/nfs_clstate.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c
index 523cc59039af..22c0da1bcef8 100644
--- a/sys/fs/nfsclient/nfs_clstate.c
+++ b/sys/fs/nfsclient/nfs_clstate.c
@@ -4907,6 +4907,7 @@ int
 nfscl_getref(struct nfsmount *nmp)
 {
struct nfsclclient *clp;
+   int ret;
 
NFSLOCKCLSTATE();
clp = nfscl_findcl(nmp);
@@ -4914,9 +4915,12 @@ nfscl_getref(struct nfsmount *nmp)
NFSUNLOCKCLSTATE();
return (0);
}
-   nfsv4_getref(&clp->nfsc_lock, NULL, NFSCLSTATEMUTEXPTR, NULL);
+   nfsv4_getref(&clp->nfsc_lock, NULL, NFSCLSTATEMUTEXPTR, nmp->nm_mountp);
+   ret = 1;
+   if (NFSCL_FORCEDISM(nmp->nm_mountp))
+   ret = 0;
NFSUNLOCKCLSTATE();
-   return (1);
+   return (ret);
 }
 
 /*