git: a2c88e0d47ac - main - git-arc: Use a helper function to fetch boolean config variables

2024-06-06 Thread John Baldwin
The branch main has been updated by jhb:

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

commit a2c88e0d47acb1a33016cbb7a821465fa1e357a6
Author: John Baldwin 
AuthorDate: 2024-06-06 21:45:30 +
Commit: John Baldwin 
CommitDate: 2024-06-06 21:45:30 +

git-arc: Use a helper function to fetch boolean config variables

Requested by:   markj
Reviewed by:imp
Differential Revision:  https://reviews.freebsd.org/D45104
---
 tools/tools/git/git-arc.sh | 18 ++
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/tools/tools/git/git-arc.sh b/tools/tools/git/git-arc.sh
index e8da1f1ed32a..e9398a60d2f7 100644
--- a/tools/tools/git/git-arc.sh
+++ b/tools/tools/git/git-arc.sh
@@ -147,6 +147,16 @@ __EOF__
 exit 1
 }
 
+#
+# Fetch the value of a boolean config variable ($1) and return true
+# (0) if the variable is true.  The default value to use if the
+# variable is not set is passed in $2.
+#
+get_bool_config()
+{
+test "$(git config --bool --get $1 2>/dev/null || echo $2)" != "false"
+}
+
 #
 # Filter the output of call-conduit to remove the warnings that are generated
 # for some installations where openssl module is mysteriously installed twice 
so
@@ -378,7 +388,7 @@ gitarc__create()
 
 list=
 prev=""
-if [ "$(git config --bool --get arc.list 2>/dev/null || echo false)" != 
"false" ]; then
+if get_bool_config arc.list false; then
 list=1
 fi
 doprompt=1
@@ -672,7 +682,7 @@ gitarc__update()
 local commit commits diff doprompt have_msg list o msg
 
 list=
-if [ "$(git config --bool --get arc.list 2>/dev/null || echo false)" != 
"false" ]; then
+if get_bool_config arc.list false; then
 list=1
 fi
 doprompt=1
@@ -727,7 +737,7 @@ gitarc__update()
 set -e
 
 ASSUME_YES=
-if [ "$(git config --bool --get arc.assume-yes 2>/dev/null || echo false)" != 
"false" ]; then
+if get_bool_config arc.assume-yes false; then
 ASSUME_YES=1
 fi
 
@@ -801,7 +811,7 @@ list|patch)
 ;;
 esac
 
-if [ "$(git config --bool --get arc.browse 2>/dev/null || echo false)" != 
"false" ]; then
+if get_bool_config arc.browse false; then
 BROWSE=--browse
 fi
 



git: b0e7358bf8b9 - main - cryptocheck: Don't treat OpenSSL errors as fatal

2024-06-06 Thread John Baldwin
The branch main has been updated by jhb:

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

commit b0e7358bf8b9791aaaf38807c841953946b88785
Author: John Baldwin 
AuthorDate: 2024-06-06 21:47:04 +
Commit: John Baldwin 
CommitDate: 2024-06-06 21:48:38 +

cryptocheck: Don't treat OpenSSL errors as fatal

Abort the current test but keep running additional tests if OpenSSL
reports an error during a test.  This matches the behavior for other
tests such as an error from OCF.

Reviewed by:markj
Sponsored by:   AFRL, DARPA
Differential Revision:  https://reviews.freebsd.org/D45279
---
 tools/tools/crypto/cryptocheck.c | 322 ++-
 1 file changed, 220 insertions(+), 102 deletions(-)

diff --git a/tools/tools/crypto/cryptocheck.c b/tools/tools/crypto/cryptocheck.c
index ef3e225e94f6..6506671455ac 100644
--- a/tools/tools/crypto/cryptocheck.c
+++ b/tools/tools/crypto/cryptocheck.c
@@ -537,7 +537,7 @@ ocf_hash(const struct alg *alg, const char *buffer, size_t 
size, char *digest,
return (true);
 }
 
-static void
+static bool
 openssl_hash(const struct alg *alg, const EVP_MD *md, const void *buffer,
 size_t size, void *digest_out, unsigned *digest_sz_out)
 {
@@ -564,11 +564,12 @@ openssl_hash(const struct alg *alg, const EVP_MD *md, 
const void *buffer,
goto err_out;
 
EVP_MD_CTX_destroy(mdctx);
-   return;
+   return (true);
 
 err_out:
-   errx(1, "OpenSSL %s HASH failed%s: %s", alg->name, errs,
+   warnx("OpenSSL %s HASH failed%s: %s", alg->name, errs,
ERR_error_string(ERR_get_error(), NULL));
+   return (false);
 }
 
 static void
@@ -590,7 +591,8 @@ run_hash_test(const struct alg *alg, size_t size)
 
/* OpenSSL HASH. */
digest_len = sizeof(control_digest);
-   openssl_hash(alg, md, buffer, size, control_digest, &digest_len);
+   if (!openssl_hash(alg, md, buffer, size, control_digest, &digest_len))
+   goto out;
 
/* cryptodev HASH. */
if (!ocf_hash(alg, buffer, size, test_digest, &crid))
@@ -671,9 +673,11 @@ run_hmac_test(const struct alg *alg, size_t size)
/* OpenSSL HMAC. */
digest_len = sizeof(control_digest);
if (HMAC(md, key, key_len, (u_char *)buffer, size,
-   (u_char *)control_digest, &digest_len) == NULL)
-   errx(1, "OpenSSL %s (%zu) HMAC failed: %s", alg->name,
+   (u_char *)control_digest, &digest_len) == NULL) {
+   warnx("OpenSSL %s (%zu) HMAC failed: %s", alg->name,
size, ERR_error_string(ERR_get_error(), NULL));
+   goto out;
+   }
 
/* cryptodev HMAC. */
if (!ocf_hmac(alg, buffer, size, key, key_len, test_digest, &crid))
@@ -700,7 +704,7 @@ out:
free(key);
 }
 
-static void
+static bool
 openssl_cipher(const struct alg *alg, const EVP_CIPHER *cipher, const char 
*key,
 const char *iv, const char *input, char *output, size_t size, int enc)
 {
@@ -708,27 +712,42 @@ openssl_cipher(const struct alg *alg, const EVP_CIPHER 
*cipher, const char *key,
int outl, total;
 
ctx = EVP_CIPHER_CTX_new();
-   if (ctx == NULL)
-   errx(1, "OpenSSL %s (%zu) ctx new failed: %s", alg->name,
+   if (ctx == NULL) {
+   warnx("OpenSSL %s (%zu) ctx new failed: %s", alg->name,
size, ERR_error_string(ERR_get_error(), NULL));
+   return (false);
+   }
if (EVP_CipherInit_ex(ctx, cipher, NULL, (const u_char *)key,
-   (const u_char *)iv, enc) != 1)
-   errx(1, "OpenSSL %s (%zu) ctx init failed: %s", alg->name,
+   (const u_char *)iv, enc) != 1) {
+   warnx("OpenSSL %s (%zu) ctx init failed: %s", alg->name,
size, ERR_error_string(ERR_get_error(), NULL));
+   goto error;
+   }
EVP_CIPHER_CTX_set_padding(ctx, 0);
if (EVP_CipherUpdate(ctx, (u_char *)output, &outl,
-   (const u_char *)input, size) != 1)
-   errx(1, "OpenSSL %s (%zu) cipher update failed: %s", alg->name,
+   (const u_char *)input, size) != 1) {
+   warnx("OpenSSL %s (%zu) cipher update failed: %s", alg->name,
size, ERR_error_string(ERR_get_error(), NULL));
+   goto error;
+   }
total = outl;
-   if (EVP_CipherFinal_ex(ctx, (u_char *)output + outl, &outl) != 1)
-   errx(1, "OpenSSL %s (%zu) cipher final failed: %s", alg->name,
+   if (EVP_CipherFinal_ex(ctx, (u_char *)output + outl, &outl) != 1) {
+   warnx("OpenSSL %s (%zu) cipher final failed: %s", alg->name,
size, ERR_error_string(ER

Re: git: edbd489d09ba - main - ctladm: don't require the use of "-p" with "port -r"

2024-07-01 Thread John Baldwin

On 6/10/24 9:01 AM, Alan Somers wrote:

The branch main has been updated by asomers:

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

commit edbd489d09babebdc6c03924a912013be584c409
Author: Alan Somers 
AuthorDate: 2024-06-06 19:14:43 +
Commit: Alan Somers 
CommitDate: 2024-06-10 16:01:25 +

 ctladm: don't require the use of "-p" with "port -r"
 
 When removing a port, the ioctl frontend requires the "-p" argument.

 But other frontends, like cfiscsi, do not.  So don't require that
 argument in the ctladm command.  The frontend driver will report an
 error if any required argument is missing.

 MFC after:  2 weeks
 Sponsored by:   Axcient
 Reviewed by:mav
 Pull Request:   https://github.com/freebsd/freebsd-src/pull/1279
---
  sys/cam/ctl/ctl_frontend_ioctl.c |  2 +-
  usr.sbin/ctladm/ctladm.8 |  3 +--
  usr.sbin/ctladm/ctladm.c | 10 +++---
  usr.sbin/ctladm/tests/port.sh| 28 +++-
  4 files changed, 28 insertions(+), 15 deletions(-)

diff --git a/usr.sbin/ctladm/ctladm.c b/usr.sbin/ctladm/ctladm.c
index 14951797ddf1..46b7b88547dd 100644
--- a/usr.sbin/ctladm/ctladm.c
+++ b/usr.sbin/ctladm/ctladm.c
@@ -580,11 +580,6 @@ cctl_port(int fd, int argc, char **argv, char *combinedopt)
break;
}
case CCTL_PORT_MODE_REMOVE:
-   if (targ_port == -1) {
-   warnx("%s: -r requires -p", __func__);
-   retval = 1;
-   goto bailout;
-   }
/* FALLTHROUGH */


Should we just remove the FALLTHOUGH now?


case CCTL_PORT_MODE_CREATE: {
bzero(&req, sizeof(req));
diff --git a/usr.sbin/ctladm/tests/port.sh b/usr.sbin/ctladm/tests/port.sh
index 1f2c9aaed5c1..139e1a7d29a0 100644
--- a/usr.sbin/ctladm/tests/port.sh
+++ b/usr.sbin/ctladm/tests/port.sh
@@ -37,8 +37,6 @@ cleanup() {
;;
"iscsi")
TARGET=`awk '/target:/ {print $2}' port-create.txt`
-   # PORTNUM is ignored, but must be set
-   PORTNUM=
ctladm port -r -d $driver -p "$PORTNUM" -O 
cfiscsi_portal_group_tag=$PGTAG -O cfiscsi_target=$TARGET


You still use PORTNUM here even though you don't define it?


;;
esac

--
John Baldwin




Re: git: 2508372b7b46 - main - cdefs.h: Assume the compiler supports at least GNU C 3.0 extensions

2024-07-01 Thread John Baldwin

On 6/20/24 7:41 PM, Warner Losh wrote:

The branch main has been updated by imp:

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

commit 2508372b7b46117a9fb801b50624265d30888442
Author: Warner Losh 
AuthorDate: 2024-06-20 23:02:42 +
Commit: Warner Losh 
CommitDate: 2024-06-21 02:41:08 +

 cdefs.h: Assume the compiler supports at least GNU C 3.0 extensions
 
 All compilers that can build FreeBSD binaries (as opposed to the entire

 system) support at least gcc 9 (gcc, clang, tcc). Even pcc supports most
 of the gcc 4.3 attributes. Make this file simpler by removing support
 for pre-3.0 compilers.
 
 Reviewed by:brooks

 Differential Revision:  https://reviews.freebsd.org/D45653
 Sponsored by:   Netflix
---
  sys/sys/cdefs.h | 79 +
  1 file changed, 1 insertion(+), 78 deletions(-)

diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h
index 476c89d1dddb..88019819eb35 100644
--- a/sys/sys/cdefs.h
+++ b/sys/sys/cdefs.h
@@ -389,45 +367,10 @@
   */
  #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901
  #define   __restrict  restrict
-#elif !__GNUC_PREREQ__(2, 95)
-#define__restrict
  #endif
  
-/*

- * GNU C version 2.96 adds explicit branch prediction so that
- * the CPU back-end can hint the processor and also so that
- * code blocks can be reordered such that the predicted path
- * sees a more linear flow, thus improving cache behavior, etc.
- *
- * The following two macros provide us with a way to utilize this
- * compiler feature.  Use __predict_true() if you expect the expression
- * to evaluate to true, and __predict_false() if you expect the
- * expression to evaluate to false.
- *
- * A few notes about usage:
- *
- * * Generally, __predict_false() error condition checks (unless
- *   you have some _strong_ reason to do otherwise, in which case
- *   document it), and/or __predict_true() `no-error' condition
- *   checks, assuming you want to optimize for the no-error case.
- *
- * * Other than that, if you don't know the likelihood of a test
- *   succeeding from empirical or other `hard' evidence, don't
- *   make predictions.
- *
- * * These are meant to be used in places that are run `a lot'.
- *   It is wasteful to make predictions in code that is run
- *   seldomly (e.g. at subsystem initialization time) as the
- *   basic block reordering that this affects can often generate
- *   larger code.
- */
-#if __GNUC_PREREQ__(2, 96)
  #define   __predict_true(exp) __builtin_expect((exp), 1)
  #define   __predict_false(exp)__builtin_expect((exp), 0)
-#else
-#define__predict_true(exp) (exp)
-#define__predict_false(exp)(exp)
-#endif


I think the comment was worth keeping around.  You just need to modify
the start of it to "Modern compilers include explicit branch prediction..."
In particular, I think our current practice is still to apply prediction
hints rather conservatively.

--
John Baldwin




Re: git: 67d1a1cd9e77 - main - cdefs.h: Remove support for pre gcc 4.0

2024-07-01 Thread John Baldwin

On 6/20/24 7:41 PM, Warner Losh wrote:

The branch main has been updated by imp:

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

commit 67d1a1cd9e772e2ef94003579f4fbc271d38be7d
Author: Warner Losh 
AuthorDate: 2024-06-20 23:02:56 +
Commit: Warner Losh 
CommitDate: 2024-06-21 02:41:08 +

 cdefs.h: Remove support for pre gcc 4.0
 
 All supported compilers support the gcc 3 attribute extensions. Remove

 the #else clauses for this. Also, latter-day pcc compilers also define
 __GNUC__, so there's not need to also test for __PCC__.
 
 Reviewed by:brooks

 Differential Revision:  https://reviews.freebsd.org/D45654
 Sponsored by:   Netflix
---
  sys/sys/cdefs.h | 42 --
  1 file changed, 4 insertions(+), 38 deletions(-)

diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h
index 88019819eb35..a6ecdca5d8b9 100644
--- a/sys/sys/cdefs.h
+++ b/sys/sys/cdefs.h
@@ -408,15 +389,10 @@
   * assign pointer x to a local variable, to check that its type is
   * compatible with member m.
   */
-#if __GNUC_PREREQ__(3, 1)
  #define   __containerof(x, s, m) ({   
\
const volatile __typeof(((s *)0)->m) *__x = (x); \
__DEQUALIFY(s *, (const volatile char *)__x - __offsetof(s, m));\
  })
-#else
-#define__containerof(x, s, m)  
\
-   __DEQUALIFY(s *, (const volatile char *)(x) - __offsetof(s, m))
-#endif
  
  /*

   * Compiler-dependent macros to declare that functions take printf-like
@@ -434,14 +410,8 @@
  #define   __strftimelike(fmtarg, firstvararg) \
__attribute__((__format__ (__strftime__, fmtarg, firstvararg)))
  
-/* Compiler-dependent macros that rely on FreeBSD-specific extensions. */

-#if defined(__FreeBSD_cc_version) && __FreeBSD_cc_version >= 31 && \
-defined(__GNUC__)
  #define   __printf0like(fmtarg, firstvararg) \
__attribute__((__format__ (__printf0__, fmtarg, firstvararg)))
-#else
-#define__printf0like(fmtarg, firstvararg)
-#endif


Does this still work with external GCC?  I didn't think printf0 was supported
by external GCC (or maybe I had to readd it in the port and that's what I
remember).  Ah, yes, printf0 is a local patch in the devel/freebsd-gccX
ports, but is not available in stock GCC (e.g. lang/gcc does not support it).

--
John Baldwin




Re: git: 7cae020b9c97 - main - Simplify signal handling code in libthr by removing use of SYS_sigreturn

2024-07-01 Thread John Baldwin

On 6/6/24 2:50 PM, Warner Losh wrote:

The branch main has been updated by imp:

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

commit 7cae020b9c977c11881363d726b13d1cd2feec5e
Author: Dapeng Gao 
AuthorDate: 2024-06-03 18:18:13 +
Commit: Warner Losh 
CommitDate: 2024-06-06 21:48:39 +

 Simplify signal handling code in libthr by removing use of SYS_sigreturn
 
 The use of SYS_sigreturn is unnecessary here.
 
 If handle_signal is called when a signal is delivered, it can just

 return normally back to sigcode which will call sigreturn anyway.
 
 In case handle_signal is called by check_deferred_signal, using

 setcontext is better than SYS_sigreturn because that is the correct
 system call to pair with the earlier getcontext.
 
 Reviewed by:imp, kib

 Differential Revision:  https://reviews.freebsd.org/D44893
---
  lib/libthr/thread/thr_sig.c | 8 +++-
  1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/lib/libthr/thread/thr_sig.c b/lib/libthr/thread/thr_sig.c
index ad291d106001..b953c430158c 100644
--- a/lib/libthr/thread/thr_sig.c
+++ b/lib/libthr/thread/thr_sig.c
@@ -247,7 +247,6 @@ static void
  handle_signal(struct sigaction *actp, int sig, siginfo_t *info, ucontext_t 
*ucp)
  {
struct pthread *curthread = _get_curthread();
-   ucontext_t uc2;
__siginfohandler_t *sigfunc;
int cancel_point;
int cancel_async;
@@ -307,13 +306,11 @@ handle_signal(struct sigaction *actp, int sig, siginfo_t 
*info, ucontext_t *ucp)
curthread->cancel_point = cancel_point;
curthread->cancel_enable = cancel_enable;
  
-	memcpy(&uc2, ucp, sizeof(uc2));

-   SIGDELSET(uc2.uc_sigmask, SIGCANCEL);
+   SIGDELSET(ucp->uc_sigmask, SIGCANCEL);
  
  	/* reschedule cancellation */

-   check_cancel(curthread, &uc2);
+   check_cancel(curthread, ucp);
errno = err;
-   syscall(SYS_sigreturn, &uc2);
  }
  
  void

@@ -400,6 +397,7 @@ check_deferred_signal(struct pthread *curthread)
/* remove signal */
curthread->deferred_siginfo.si_signo = 0;
handle_signal(&act, info.si_signo, &info, uc);
+   syscall(SYS_sigreturn, uc);


The commit log implies this should be calling setcontext() instead of
syscall()?  Was that a stale part of the commit log?  I thought I
remember discussing this at one point.  Maybe the issue was that
you couldn't pre-resolve the PLT for setcontext()?

--
John Baldwin




Re: git: 67d1a1cd9e77 - main - cdefs.h: Remove support for pre gcc 4.0

2024-07-02 Thread John Baldwin

On 7/1/24 4:09 PM, Warner Losh wrote:

On Mon, Jul 1, 2024, 3:53 PM John Baldwin  wrote:


On 6/20/24 7:41 PM, Warner Losh wrote:

The branch main has been updated by imp:

URL:

https://cgit.FreeBSD.org/src/commit/?id=67d1a1cd9e772e2ef94003579f4fbc271d38be7d


commit 67d1a1cd9e772e2ef94003579f4fbc271d38be7d
Author: Warner Losh 
AuthorDate: 2024-06-20 23:02:56 +
Commit: Warner Losh 
CommitDate: 2024-06-21 02:41:08 +

  cdefs.h: Remove support for pre gcc 4.0

  All supported compilers support the gcc 3 attribute extensions.

Remove

  the #else clauses for this. Also, latter-day pcc compilers also

define

  __GNUC__, so there's not need to also test for __PCC__.

  Reviewed by:brooks
  Differential Revision:  https://reviews.freebsd.org/D45654
  Sponsored by:   Netflix
---
   sys/sys/cdefs.h | 42 --
   1 file changed, 4 insertions(+), 38 deletions(-)

diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h
index 88019819eb35..a6ecdca5d8b9 100644
--- a/sys/sys/cdefs.h
+++ b/sys/sys/cdefs.h
@@ -408,15 +389,10 @@
* assign pointer x to a local variable, to check that its type is
* compatible with member m.
*/
-#if __GNUC_PREREQ__(3, 1)
   #define __containerof(x, s, m) ({

  \

   const volatile __typeof(((s *)0)->m) *__x = (x);\
   __DEQUALIFY(s *, (const volatile char *)__x - __offsetof(s, m));\
   })
-#else
-#define  __containerof(x, s, m)

   \

- __DEQUALIFY(s *, (const volatile char *)(x) - __offsetof(s, m))
-#endif

   /*
* Compiler-dependent macros to declare that functions take printf-like
@@ -434,14 +410,8 @@
   #define __strftimelike(fmtarg, firstvararg) \
   __attribute__((__format__ (__strftime__, fmtarg, firstvararg)))

-/* Compiler-dependent macros that rely on FreeBSD-specific extensions.

*/

-#if defined(__FreeBSD_cc_version) && __FreeBSD_cc_version >= 31 && \
-defined(__GNUC__)
   #define __printf0like(fmtarg, firstvararg) \
   __attribute__((__format__ (__printf0__, fmtarg, firstvararg)))
-#else
-#define  __printf0like(fmtarg, firstvararg)
-#endif


Does this still work with external GCC?  I didn't think printf0 was
supported
by external GCC (or maybe I had to readd it in the port and that's what I
remember).  Ah, yes, printf0 is a local patch in the devel/freebsd-gccX
ports, but is not available in stock GCC (e.g. lang/gcc does not support
it).



Ah. That would explain why it just worked for me. That's what I tested
with. Clang also seemed happy with it. But that was the in tree clang. Is
there a similar issue? Gnuc is defined for both.


So we don't support building the base system with lang/gcc, only
devel/freebsd-gccX (which has a local patch to add printf0 support).
The only question might be, do we support using __printf0like for things
that aren't in the base system that could be built with lang/gcc.  If so,
we might need to guard this somehow.  I'm not sure though that we care
about random software not in base using a FreeBSD-specific keyword from
.

--
John Baldwin




Re: git: 67d1a1cd9e77 - main - cdefs.h: Remove support for pre gcc 4.0

2024-07-02 Thread John Baldwin

On 7/2/24 12:30, Warner Losh wrote:

Hey John,

On Tue, Jul 2, 2024 at 9:44 AM John Baldwin  wrote:


On 7/1/24 4:09 PM, Warner Losh wrote:

On Mon, Jul 1, 2024, 3:53 PM John Baldwin  wrote:


On 6/20/24 7:41 PM, Warner Losh wrote:

The branch main has been updated by imp:

URL:



https://cgit.FreeBSD.org/src/commit/?id=67d1a1cd9e772e2ef94003579f4fbc271d38be7d


commit 67d1a1cd9e772e2ef94003579f4fbc271d38be7d
Author: Warner Losh 
AuthorDate: 2024-06-20 23:02:56 +
Commit: Warner Losh 
CommitDate: 2024-06-21 02:41:08 +

   cdefs.h: Remove support for pre gcc 4.0

   All supported compilers support the gcc 3 attribute extensions.

Remove

   the #else clauses for this. Also, latter-day pcc compilers also

define

   __GNUC__, so there's not need to also test for __PCC__.

   Reviewed by:brooks
   Differential Revision:  https://reviews.freebsd.org/D45654
   Sponsored by:   Netflix
---
sys/sys/cdefs.h | 42 --
1 file changed, 4 insertions(+), 38 deletions(-)

diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h
index 88019819eb35..a6ecdca5d8b9 100644
--- a/sys/sys/cdefs.h
+++ b/sys/sys/cdefs.h
@@ -408,15 +389,10 @@
 * assign pointer x to a local variable, to check that its type is
 * compatible with member m.
 */
-#if __GNUC_PREREQ__(3, 1)
#define __containerof(x, s, m) ({

   \

const volatile __typeof(((s *)0)->m) *__x = (x);

\

__DEQUALIFY(s *, (const volatile char *)__x - __offsetof(s,

m));\

})
-#else
-#define  __containerof(x, s, m)

\

- __DEQUALIFY(s *, (const volatile char *)(x) - __offsetof(s, m))
-#endif

/*
 * Compiler-dependent macros to declare that functions take

printf-like

@@ -434,14 +410,8 @@
#define __strftimelike(fmtarg, firstvararg) \
__attribute__((__format__ (__strftime__, fmtarg,

firstvararg)))


-/* Compiler-dependent macros that rely on FreeBSD-specific extensions.

*/

-#if defined(__FreeBSD_cc_version) && __FreeBSD_cc_version >= 31

&& \

-defined(__GNUC__)
#define __printf0like(fmtarg, firstvararg) \
__attribute__((__format__ (__printf0__, fmtarg,

firstvararg)))

-#else
-#define  __printf0like(fmtarg, firstvararg)
-#endif


Does this still work with external GCC?  I didn't think printf0 was
supported
by external GCC (or maybe I had to readd it in the port and that's what

I

remember).  Ah, yes, printf0 is a local patch in the devel/freebsd-gccX
ports, but is not available in stock GCC (e.g. lang/gcc does not support
it).



Ah. That would explain why it just worked for me. That's what I tested
with. Clang also seemed happy with it. But that was the in tree clang. Is
there a similar issue? Gnuc is defined for both.


So we don't support building the base system with lang/gcc, only
devel/freebsd-gccX (which has a local patch to add printf0 support).
The only question might be, do we support using __printf0like for things
that aren't in the base system that could be built with lang/gcc.  If so,
we might need to guard this somehow.  I'm not sure though that we care
about random software not in base using a FreeBSD-specific keyword from
.



Yes. The question is "do we use __printf0like  in our headers" since we
definitely
can't build FreeBSD itself w/o at least some of the extensions for other
things...
and the answer is "yes". err.h uses it, for example, as does setproctitle
in stdlib.h

The interesting thing for me is that gcc13 will produce no warnings if I
include errr.h
because -Wsystem-header is off. With it on, warnings crop up too. This is
why my testing
didn't see it...

It looks like clang has it as a builtin for all versions we care about, so
I'll create a phab to add some
of this back. Maybe we should upstream what we have, for this and
freebsd_printf since that's also
in clang and one of the small number of patches we have for the lang/gcc*
family?


Yeah, I should do my FSF paperwork for GCC sometime and try to upstream at
least the printf changes and a few others (i386 defaulting to i686 on
recent releases as well)

--
John Baldwin




git: 1edf61f395d9 - main - cxgbe: Add a 'show t4 memdump' DDB command

2024-07-03 Thread John Baldwin
The branch main has been updated by jhb:

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

commit 1edf61f395d98a5abb7d6f38e5e64722b4ddf351
Author: John Baldwin 
AuthorDate: 2024-07-03 15:05:11 +
Commit: John Baldwin 
CommitDate: 2024-07-03 15:05:11 +

cxgbe: Add a 'show t4 memdump' DDB command

Reviewed by:np
Sponsored by:   Chelsio Communications
Differential Revision:  https://reviews.freebsd.org/D45187
---
 sys/dev/cxgbe/t4_main.c | 76 ++---
 1 file changed, 66 insertions(+), 10 deletions(-)

diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c
index 14799b3eeb18..c142fa93166d 100644
--- a/sys/dev/cxgbe/t4_main.c
+++ b/sys/dev/cxgbe/t4_main.c
@@ -12737,30 +12737,26 @@ tweak_tunables(void)
 
 #ifdef DDB
 static void
-t4_dump_tcb(struct adapter *sc, int tid)
+t4_dump_mem(struct adapter *sc, u_int addr, u_int len)
 {
-   uint32_t base, i, j, off, pf, reg, save, tcb_addr, win_pos;
+   uint32_t base, j, off, pf, reg, save, win_pos;
 
reg = PCIE_MEM_ACCESS_REG(A_PCIE_MEM_ACCESS_OFFSET, 2);
save = t4_read_reg(sc, reg);
base = sc->memwin[2].mw_base;
 
-   /* Dump TCB for the tid */
-   tcb_addr = t4_read_reg(sc, A_TP_CMM_TCB_BASE);
-   tcb_addr += tid * TCB_SIZE;
-
if (is_t4(sc)) {
pf = 0;
-   win_pos = tcb_addr & ~0xf;  /* start must be 16B aligned */
+   win_pos = addr & ~0xf;  /* start must be 16B aligned */
} else {
pf = V_PFNUM(sc->pf);
-   win_pos = tcb_addr & ~0x7f; /* start must be 128B aligned */
+   win_pos = addr & ~0x7f; /* start must be 128B aligned */
}
+   off = addr - win_pos;
t4_write_reg(sc, reg, win_pos | pf);
t4_read_reg(sc, reg);
 
-   off = tcb_addr - win_pos;
-   for (i = 0; i < 4; i++) {
+   while (len > 0 && !db_pager_quit) {
uint32_t buf[8];
for (j = 0; j < 8; j++, off += 4)
buf[j] = htonl(t4_read_reg(sc, base + off));
@@ -12768,12 +12764,27 @@ t4_dump_tcb(struct adapter *sc, int tid)
db_printf("%08x %08x %08x %08x %08x %08x %08x %08x\n",
buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6],
buf[7]);
+   if (len <= sizeof(buf))
+   len = 0;
+   else
+   len -= sizeof(buf);
}
 
t4_write_reg(sc, reg, save);
t4_read_reg(sc, reg);
 }
 
+static void
+t4_dump_tcb(struct adapter *sc, int tid)
+{
+   uint32_t tcb_addr;
+
+   /* Dump TCB for the tid */
+   tcb_addr = t4_read_reg(sc, A_TP_CMM_TCB_BASE);
+   tcb_addr += tid * TCB_SIZE;
+   t4_dump_mem(sc, tcb_addr, TCB_SIZE);
+}
+
 static void
 t4_dump_devlog(struct adapter *sc)
 {
@@ -12905,6 +12916,51 @@ DB_TABLE_COMMAND_FLAGS(show_t4, tcb, db_show_t4tcb, 
CS_OWN)
 
t4_dump_tcb(device_get_softc(dev), tid);
 }
+
+DB_TABLE_COMMAND_FLAGS(show_t4, memdump, db_show_memdump, CS_OWN)
+{
+   device_t dev;
+   int radix, t;
+   bool valid;
+
+   valid = false;
+   radix = db_radix;
+   db_radix = 10;
+   t = db_read_token();
+   if (t == tIDENT) {
+   dev = device_lookup_by_name(db_tok_string);
+   t = db_read_token();
+   if (t == tNUMBER) {
+   addr = db_tok_number;
+   t = db_read_token();
+   if (t == tNUMBER) {
+   count = db_tok_number;
+   valid = true;
+   }
+   }
+   }
+   db_radix = radix;
+   db_skip_to_eol();
+   if (!valid) {
+   db_printf("usage: show t4 memdump   \n");
+   return;
+   }
+
+   if (dev == NULL) {
+   db_printf("device not found\n");
+   return;
+   }
+   if (addr < 0) {
+   db_printf("invalid address\n");
+   return;
+   }
+   if (count <= 0) {
+   db_printf("invalid length\n");
+   return;
+   }
+
+   t4_dump_mem(device_get_softc(dev), addr, count);
+}
 #endif
 
 static eventhandler_tag vxlan_start_evtag;



git: 61089df8147e - main - cxgbe: Remove most uses of sysctl_wire_old_buffer

2024-07-03 Thread John Baldwin
The branch main has been updated by jhb:

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

commit 61089df8147eb7109696476c891514296d543bad
Author: John Baldwin 
AuthorDate: 2024-07-03 15:04:52 +
Commit: John Baldwin 
CommitDate: 2024-07-03 15:04:52 +

cxgbe: Remove most uses of sysctl_wire_old_buffer

Most of these sysctls don't call sbuf_* while holding any locks.  Of
the ones that do hold locks, all but one can be fixed to drop the lock
before calling sbuf_*.

Reviewed by:np
Sponsored by:   Chelsio Communications
Differential Revision:  https://reviews.freebsd.org/D45186
---
 sys/dev/cxgbe/t4_main.c | 167 
 1 file changed, 27 insertions(+), 140 deletions(-)

diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c
index ab477595bdb9..14799b3eeb18 100644
--- a/sys/dev/cxgbe/t4_main.c
+++ b/sys/dev/cxgbe/t4_main.c
@@ -8140,10 +8140,6 @@ sysctl_bitfield_8b(SYSCTL_HANDLER_ARGS)
int rc;
struct sbuf *sb;
 
-   rc = sysctl_wire_old_buffer(req, 0);
-   if (rc != 0)
-   return(rc);
-
sb = sbuf_new_for_sysctl(NULL, NULL, 128, req);
if (sb == NULL)
return (ENOMEM);
@@ -8161,10 +8157,6 @@ sysctl_bitfield_16b(SYSCTL_HANDLER_ARGS)
int rc;
struct sbuf *sb;
 
-   rc = sysctl_wire_old_buffer(req, 0);
-   if (rc != 0)
-   return(rc);
-
sb = sbuf_new_for_sysctl(NULL, NULL, 128, req);
if (sb == NULL)
return (ENOMEM);
@@ -8422,10 +8414,6 @@ sysctl_pause_settings(SYSCTL_HANDLER_ARGS)
struct sbuf *sb;
static char *bits = "\20\1RX\2TX\3AUTO";
 
-   rc = sysctl_wire_old_buffer(req, 0);
-   if (rc != 0)
-   return(rc);
-
sb = sbuf_new_for_sysctl(NULL, NULL, 128, req);
if (sb == NULL)
return (ENOMEM);
@@ -8487,10 +8475,6 @@ sysctl_link_fec(SYSCTL_HANDLER_ARGS)
struct sbuf *sb;
static char *bits = "\20\1RS-FEC\2FC-FEC\3NO-FEC\4RSVD1\5RSVD2";
 
-   rc = sysctl_wire_old_buffer(req, 0);
-   if (rc != 0)
-   return(rc);
-
sb = sbuf_new_for_sysctl(NULL, NULL, 128, req);
if (sb == NULL)
return (ENOMEM);
@@ -8518,10 +8502,6 @@ sysctl_requested_fec(SYSCTL_HANDLER_ARGS)
static char *bits = "\20\1RS-FEC\2FC-FEC\3NO-FEC\4RSVD2"
"\5RSVD3\6auto\7module";
 
-   rc = sysctl_wire_old_buffer(req, 0);
-   if (rc != 0)
-   return(rc);
-
sb = sbuf_new_for_sysctl(NULL, NULL, 128, req);
if (sb == NULL)
return (ENOMEM);
@@ -8597,10 +8577,6 @@ sysctl_module_fec(SYSCTL_HANDLER_ARGS)
struct sbuf *sb;
static char *bits = "\20\1RS-FEC\2FC-FEC\3NO-FEC\4RSVD2\5RSVD3";
 
-   rc = sysctl_wire_old_buffer(req, 0);
-   if (rc != 0)
-   return (rc);
-
sb = sbuf_new_for_sysctl(NULL, NULL, 128, req);
if (sb == NULL)
return (ENOMEM);
@@ -8627,14 +8603,15 @@ sysctl_module_fec(SYSCTL_HANDLER_ARGS)
fec = lc->fec_hint;
if (pi->mod_type == FW_PORT_MOD_TYPE_NONE ||
!fec_supported(lc->pcaps)) {
+   PORT_UNLOCK(pi);
sbuf_printf(sb, "n/a");
} else {
if (fec == 0)
fec = FEC_NONE;
+   PORT_UNLOCK(pi);
sbuf_printf(sb, "%b", fec & M_FW_PORT_CAP32_FEC, bits);
}
rc = sbuf_finish(sb);
-   PORT_UNLOCK(pi);
 done:
sbuf_delete(sb);
end_synchronized_op(sc, 0);
@@ -8854,10 +8831,6 @@ sysctl_loadavg(SYSCTL_HANDLER_ARGS)
if (rc)
return (rc);
 
-   rc = sysctl_wire_old_buffer(req, 0);
-   if (rc != 0)
-   return (rc);
-
sb = sbuf_new_for_sysctl(NULL, NULL, 4096, req);
if (sb == NULL)
return (ENOMEM);
@@ -8887,14 +8860,11 @@ sysctl_cctrl(SYSCTL_HANDLER_ARGS)
"0.9375"
};
 
-   rc = sysctl_wire_old_buffer(req, 0);
-   if (rc != 0)
-   return (rc);
-
sb = sbuf_new_for_sysctl(NULL, NULL, 4096, req);
if (sb == NULL)
return (ENOMEM);
 
+   rc = 0;
mtx_lock(&sc->reg_lock);
if (hw_off_limits(sc))
rc = ENXIO;
@@ -8970,10 +8940,6 @@ sysctl_cim_ibq_obq(SYSCTL_HANDLER_ARGS)
}
n = rc * sizeof(uint32_t);  /* rc has # of words actually read */
 
-   rc = sysctl_wire_old_buffer(req, 0);
-   if (rc != 0)
-   goto done;
-
sb = sbuf_new_for_sysctl(NULL, NULL, PAGE_SIZE, req);
if (sb == NULL) {
rc = ENOMEM;
@@ -9

Re: git: 6677621bad00 - main - cdefs.h: Fallback to printf0 for __printf0like

2024-07-06 Thread John Baldwin

On 7/6/24 15:44, Warner Losh wrote:

The branch main has been updated by imp:

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

commit 6677621bad00191dfec1b0a20ae1618b92745d9b
Author: Warner Losh 
AuthorDate: 2024-07-06 19:42:37 +
Commit: Warner Losh 
CommitDate: 2024-07-06 19:45:03 +

 cdefs.h: Fallback to printf0 for __printf0like
 
 For some reason, my tests were fine with this like it was, but CI for

 gcc12 and gcc13 is complaining. Revert to the old form until that can be
 worked out why the mismatch.
 
 Fixes: 0b82dac337e7

 Sponsored by:   Netflix
---
  sys/sys/cdefs.h | 7 +--
  1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h
index 6b861b1903f6..a56839d57c7a 100644
--- a/sys/sys/cdefs.h
+++ b/sys/sys/cdefs.h
@@ -356,9 +356,12 @@
   * Clang has always had printf and printf0 as aliases. gcc 11.0 now follows
   * clang. So now this is an alias for __printflike, or nothing. In the future
   * _Nullable or _Nonnull will replace this.
+ * XXX Except that doesn't work, so for now revert to printf0 for clang and
+ * the FreeBSD gcc until I can work this out.
   */
-#if defined(__clang__) || __GNUC_PREREQ__(11, 0)
-#define__printf0like(fmtarg, firstvararg) __printflike(fmtarg, 
firstvararg)
+#if defined(__clang__) || (defined(__GNUC__) && defined (__FreeBSD_cc_version))
+#define__printf0like(fmtarg, firstvararg) \
+   __attribute__((__format__ (__printf0__, fmtarg, firstvararg)))
  #else
  #define   __printf0like(fmtarg, firstvararg)
  #endif


It's because my patch for devel/freebsd-gcc{12,13} is kind of wrong.  I had a 
mismerge
when updating the printf0 patch from gcc9 to gcc12 that ended up re-adding the
warn on NULL.  I need to update the ports to remove that part of the patch.  I 
will
probably leave printf0 working for now in the ports just as an alias for regular
printf to give us some transition time.

--
John Baldwin




Re: git: 4122295afcbf - main - cdefs(9): Start to document what sys/cdefs.h does

2024-07-09 Thread John Baldwin

On 7/8/24 18:54, Warner Losh wrote:

The branch main has been updated by imp:

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

commit 4122295afcbf4b7ad0623bbf35f36dc3278ac028
Author: Warner Losh 
AuthorDate: 2024-07-02 22:45:49 +
Commit: Warner Losh 
CommitDate: 2024-07-08 22:54:02 +

 cdefs(9): Start to document what sys/cdefs.h does
 
---

  share/man/man9/Makefile |   1 +
  share/man/man9/cdefs.9  | 405 
  2 files changed, 406 insertions(+)

diff --git a/share/man/man9/cdefs.9 b/share/man/man9/cdefs.9
new file mode 100644
index ..a065e0bd7d1d
--- /dev/null
+++ b/share/man/man9/cdefs.9
@@ -0,0 +1,405 @@
+.Sh Supported Compilers
+.Bl -tag -offset 2n -width 0
+.It Compilers supported for building programs on Fx :
+.Bl -column -offset 0n indent-two
+.It Sy Compiler Ta Sy Versions
+.It gcc Ta 9, 10, 11, 12, 13, 14
+.It clang Ta 10, 11, 12, 13, 14, 15, 16, 17, 18
+.It TinyC (tcc) Ta 0.9
+.It pcc Ta 1.1
+.El
+.Pp
+Due to testing constraints, tcc and pcc may not always work.
+.It Compilers supported for building Fx itself:
+.Bl -column -offset 0n indent-two
+.It Sy Compiler Ta Sy Versions
+.It gcc Ta 12, 13
+.It clang Ta 16, 17, 19


s/19/18/?

--
John Baldwin




Re: git: 6677621bad00 - main - cdefs.h: Fallback to printf0 for __printf0like

2024-07-10 Thread John Baldwin

On 7/6/24 17:56, John Baldwin wrote:

On 7/6/24 15:44, Warner Losh wrote:

The branch main has been updated by imp:

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

commit 6677621bad00191dfec1b0a20ae1618b92745d9b
Author: Warner Losh 
AuthorDate: 2024-07-06 19:42:37 +
Commit: Warner Losh 
CommitDate: 2024-07-06 19:45:03 +

  cdefs.h: Fallback to printf0 for __printf0like
  
  For some reason, my tests were fine with this like it was, but CI for

  gcc12 and gcc13 is complaining. Revert to the old form until that can be
  worked out why the mismatch.
  
  Fixes: 0b82dac337e7

  Sponsored by:   Netflix
---
   sys/sys/cdefs.h | 7 +--
   1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h
index 6b861b1903f6..a56839d57c7a 100644
--- a/sys/sys/cdefs.h
+++ b/sys/sys/cdefs.h
@@ -356,9 +356,12 @@
* Clang has always had printf and printf0 as aliases. gcc 11.0 now follows
* clang. So now this is an alias for __printflike, or nothing. In the future
* _Nullable or _Nonnull will replace this.
+ * XXX Except that doesn't work, so for now revert to printf0 for clang and
+ * the FreeBSD gcc until I can work this out.
*/
-#if defined(__clang__) || __GNUC_PREREQ__(11, 0)
-#define__printf0like(fmtarg, firstvararg) __printflike(fmtarg, 
firstvararg)
+#if defined(__clang__) || (defined(__GNUC__) && defined (__FreeBSD_cc_version))
+#define__printf0like(fmtarg, firstvararg) \
+   __attribute__((__format__ (__printf0__, fmtarg, firstvararg)))
   #else
   #define  __printf0like(fmtarg, firstvararg)
   #endif


It's because my patch for devel/freebsd-gcc{12,13} is kind of wrong.  I had a 
mismerge
when updating the printf0 patch from gcc9 to gcc12 that ended up re-adding the
warn on NULL.  I need to update the ports to remove that part of the patch.  I 
will
probably leave printf0 working for now in the ports just as an alias for regular
printf to give us some transition time.


FYI, I have merged this fix to the ports, but not sure how we want to manage 
doing
the patch to cdefs.h.  I kind of think we should apply the change to cdefs.h in
main in another week or so.  I'm less certain of what to do for stable branches.

--
John Baldwin




git: e5a18aa2373b - main - splash(4): Subject/verb agreement

2024-07-15 Thread John Baldwin
The branch main has been updated by jhb:

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

commit e5a18aa2373b9446fd93622acf6a8a7ba10e2589
Author: John Baldwin 
AuthorDate: 2024-07-15 13:59:57 +
Commit: John Baldwin 
CommitDate: 2024-07-15 13:59:57 +

splash(4): Subject/verb agreement
---
 share/man/man4/splash.4 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/share/man/man4/splash.4 b/share/man/man4/splash.4
index af2ae2e4369a..b001663c4fa5 100644
--- a/share/man/man4/splash.4
+++ b/share/man/man4/splash.4
@@ -304,7 +304,7 @@ and
 modules were written by
 .An Dag-Erling Sm\(/orgrav Aq Mt d...@freebsd.org .
 .Sh CAVEATS
-The screen saver work with
+The screen saver works with
 .Xr syscons 4
 only.
 .Sh BUGS



git: 480cc750a2a8 - main - amd64 GENERIC: Drop hints for fdc0 and ppc0

2024-07-15 Thread John Baldwin
The branch main has been updated by jhb:

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

commit 480cc750a2a8f92d078803f15eecb1f8a084a1ea
Author: John Baldwin 
AuthorDate: 2024-07-15 14:16:39 +
Commit: John Baldwin 
CommitDate: 2024-07-15 14:16:48 +

amd64 GENERIC: Drop hints for fdc0 and ppc0

Modern x86 systems do not ship with ISA floppy disk controllers or LPT
ports.

Reviewed by:imp
Differential Revision:  https://reviews.freebsd.org/D45946
---
 sys/amd64/conf/GENERIC.hints | 10 --
 1 file changed, 10 deletions(-)

diff --git a/sys/amd64/conf/GENERIC.hints b/sys/amd64/conf/GENERIC.hints
index be3f59cd1950..7c2a3f28b9ce 100644
--- a/sys/amd64/conf/GENERIC.hints
+++ b/sys/amd64/conf/GENERIC.hints
@@ -1,11 +1,3 @@
-hint.fdc.0.at="isa"
-hint.fdc.0.port="0x3F0"
-hint.fdc.0.irq="6"
-hint.fdc.0.drq="2"
-hint.fd.0.at="fdc0"
-hint.fd.0.drive="0"
-hint.fd.1.at="fdc0"
-hint.fd.1.drive="1"
 hint.atkbdc.0.at="isa"
 hint.atkbdc.0.port="0x060"
 hint.atkbd.0.at="atkbdc"
@@ -21,8 +13,6 @@ hint.uart.0.irq="4"
 hint.uart.1.at="isa"
 hint.uart.1.port="0x2F8"
 hint.uart.1.irq="3"
-hint.ppc.0.at="isa"
-hint.ppc.0.irq="7"
 hint.atrtc.0.at="isa"
 hint.atrtc.0.port="0x70"
 hint.atrtc.0.irq="8"



Re: git: 87ee63bac69d - main - locks: add a runtime check for missing turnstile

2024-07-15 Thread John Baldwin

On 7/11/24 07:07, Mateusz Guzik wrote:

The branch main has been updated by mjg:

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

commit 87ee63bac69dc49291f55590b8baa57cad6c7d85
Author: Mateusz Guzik 
AuthorDate: 2024-07-11 00:17:27 +
Commit: Mateusz Guzik 
CommitDate: 2024-07-11 11:06:52 +

 locks: add a runtime check for missing turnstile
 
 There are sometimes bugs which result in the unlock fast path failing,

 which in turns causes a not-helpful crash report when dereferencing a
 NULL turnstile. Help debugging such cases by pointing out what happened
 along with some debug.
 
 Sponsored by:   Rubicon Communications, LLC ("Netgate")

---
  sys/kern/kern_mutex.c  |  4 +++-
  sys/kern/kern_rwlock.c | 16 
  2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/sys/kern/kern_mutex.c b/sys/kern/kern_mutex.c
index 90361b23c09a..0fa624cc4bb1 100644
--- a/sys/kern/kern_mutex.c
+++ b/sys/kern/kern_mutex.c
@@ -1053,7 +1053,9 @@ __mtx_unlock_sleep(volatile uintptr_t *c, uintptr_t v)
turnstile_chain_lock(&m->lock_object);
_mtx_release_lock_quick(m);
ts = turnstile_lookup(&m->lock_object);
-   MPASS(ts != NULL);
+   if (__predict_false(ts == NULL)) {
+   panic("got NULL turnstile on mutex %p v %zx", m, v);
+   }


Hmm, this is just an expanded KASSERT() but always on rather than conditional 
on INVARIANTS?

Do you have examples of the type of bugs that cause this?  (Is it unlocking a 
freed mutex
or the like?)  We generally hide all these types of checks under INVARIANTS 
rather than
shipping them in release kernels.

--
John Baldwin




Re: git: 87ee63bac69d - main - locks: add a runtime check for missing turnstile

2024-07-15 Thread John Baldwin

On 7/15/24 13:59, Mateusz Guzik wrote:

On Mon, Jul 15, 2024 at 6:22 PM John Baldwin  wrote:


On 7/11/24 07:07, Mateusz Guzik wrote:

The branch main has been updated by mjg:

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

commit 87ee63bac69dc49291f55590b8baa57cad6c7d85
Author: Mateusz Guzik 
AuthorDate: 2024-07-11 00:17:27 +
Commit: Mateusz Guzik 
CommitDate: 2024-07-11 11:06:52 +

  locks: add a runtime check for missing turnstile

  There are sometimes bugs which result in the unlock fast path failing,
  which in turns causes a not-helpful crash report when dereferencing a
  NULL turnstile. Help debugging such cases by pointing out what happened
  along with some debug.

  Sponsored by:   Rubicon Communications, LLC ("Netgate")
---
   sys/kern/kern_mutex.c  |  4 +++-
   sys/kern/kern_rwlock.c | 16 
   2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/sys/kern/kern_mutex.c b/sys/kern/kern_mutex.c
index 90361b23c09a..0fa624cc4bb1 100644
--- a/sys/kern/kern_mutex.c
+++ b/sys/kern/kern_mutex.c
@@ -1053,7 +1053,9 @@ __mtx_unlock_sleep(volatile uintptr_t *c, uintptr_t v)
   turnstile_chain_lock(&m->lock_object);
   _mtx_release_lock_quick(m);
   ts = turnstile_lookup(&m->lock_object);
- MPASS(ts != NULL);
+ if (__predict_false(ts == NULL)) {
+ panic("got NULL turnstile on mutex %p v %zx", m, v);
+ }


Hmm, this is just an expanded KASSERT() but always on rather than conditional 
on INVARIANTS?

Do you have examples of the type of bugs that cause this?  (Is it unlocking a 
freed mutex
or the like?)  We generally hide all these types of checks under INVARIANTS 
rather than
shipping them in release kernels.



Use-after-free, overflow, underflow, bitflip or what have you all can
fail the fast path.

Once that happens and the kernel crashes with a null pointer deref,
here is a crash at netgate which prodded this:
calltrap() at calltrap+0x8/frame 0xfe0106720920
--- trap 0xc, rip = 0x80d5ab70, rsp = 0xfe01067209f0, rbp
= 0xfe0106720a00 ---
turnstile_broadcast() at turnstile_broadcast+0x40/frame 0xfe0106720a00
__rw_wunlock_hard() at __rw_wunlock_hard+0x9e/frame 0xfe0106720a30
nd6_resolve_slow() at nd6_resolve_slow+0x2d7/frame 0xfe0106720aa0
nd6_resolve() at nd6_resolve+0x125/frame 0xfe0106720b10
ether_output() at ether_output+0x4e7/frame 0xfe0106720ba0
ip_output_send() at ip_output_send+0xdc/frame 0xfe0106720be0
ip_output() at ip_output+0x1295/frame 0xfe0106720ce0
ip_forward() at ip_forward+0x3c2/frame 0xfe0106720d90
ip_input() at ip_input+0x705/frame 0xfe0106720df0
swi_net() at swi_net+0x138/frame 0xfe0106720e60
ithread_loop() at ithread_loop+0x257/frame 0xfe0106720ef0
fork_exit() at fork_exit+0x7f/frame 0xfe0106720f30
fork_trampoline() at fork_trampoline+0xe/frame 0xfe0106720f30
--- trap 0, rip = 0, rsp = 0, rbp = 0 ---

Neither the register dump nor anything in the backtrace indicate what happened.

Since the kernel is going down anyway, one may as well get some debug from it.


If you don't mind the extra branches for sanity checks, why not just run with
INVARIANTS?  That is, what makes these particular assertions different from
other assertions such that they should be on unconditionally?  The last line 
below
applies to pretty much every other assertion in the tree.

--
John Baldwin




git: 0a34d050ae8e - main - acpi: Narrow workaround for broken interrupt settings on x86

2024-07-15 Thread John Baldwin
The branch main has been updated by jhb:

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

commit 0a34d050ae8ea14feddd3d2a62fd2f612613b2c5
Author: John Baldwin 
AuthorDate: 2024-07-15 19:13:08 +
Commit: John Baldwin 
CommitDate: 2024-07-15 19:13:51 +

acpi: Narrow workaround for broken interrupt settings on x86

Commit 9a7bf07ccdc1 from 2016 introduced a workaround for some broken
BIOSes that specified active-lo instead of active-hi polarity for ISA
IRQs for UARTs.  The workaround assumed that edge-sensitive ISA IRQs
on x86 should always be active-hi.  However, some recent AMD systems
actually use active-lo edge-sensitive ISA IRQs (and not just for
UARTs, but also for the keyboard and PS/2 mouse devices) and the
override causes interrupts to be dropped resulting in boot time hangs,
non-working keyboards, etc.

Add a hw.acpi.override_isa_irq_polarity tunable (readable as a sysctl
post-boot) to control this quirk.  It can be set to 1 to force enable
the override and 0 to disable it.  The log of original message
mentions an Intel motherboard as the sample case, so default the
tunable to 1 on systems with an Intel CPU and 0 otherwise.

Special thanks to Matthias Lanter  for tracking
down boot time issues on recent AMD systems to mismatched interrupt
polarity.

PR: 270707
Reported by:aixdroix_...@protonmail.com, Michael Dexter
Reported by:mfw_b...@pm.me, Hannes Hfauswedell 
Reported by:Matthias Lanter 
Reported by:William Bulley 
Reviewed by:imp, emaste
MFC after:  1 week
Differential Revision:  https://reviews.freebsd.org/D45554
---
 share/man/man4/acpi.4  |  8 +++-
 sys/dev/acpica/acpi.c  | 19 +++
 sys/dev/acpica/acpi_resource.c | 11 ---
 sys/dev/acpica/acpivar.h   | 12 
 4 files changed, 42 insertions(+), 8 deletions(-)

diff --git a/share/man/man4/acpi.4 b/share/man/man4/acpi.4
index 434e97d529f5..cdad3ceeedfc 100644
--- a/share/man/man4/acpi.4
+++ b/share/man/man4/acpi.4
@@ -23,7 +23,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd October 12, 2021
+.Dd July 15, 2024
 .Dt ACPI 4
 .Os
 .Sh NAME
@@ -256,6 +256,12 @@ is a valid list of two interfaces
 .Qq Li FreeBSD
 and
 .Qq Li Linux .
+.It Va hw.acpi.hw.acpi.override_isa_irq_polarity (x86)
+Forces active-lo polarity for edge-triggered ISA interrupts.
+Some older systems incorrectly specify active-lo polarity for ISA
+interrupts and this override fixes those systems.
+This override is enabled by default on systems with Intel CPUs,
+but can be enabled or disabled by setting the tunable explicitly.
 .It Va hw.acpi.reset_video
 Enables calling the VESA reset BIOS vector on the resume path.
 This can fix some graphics cards that have problems such as LCD white-out
diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c
index 24d7027f165d..91a1636f2808 100644
--- a/sys/dev/acpica/acpi.c
+++ b/sys/dev/acpica/acpi.c
@@ -55,6 +55,8 @@
 #if defined(__i386__) || defined(__amd64__)
 #include 
 #include 
+#include 
+#include 
 #endif
 #include 
 #include 
@@ -297,6 +299,10 @@ int acpi_susp_bounce;
 SYSCTL_INT(_debug_acpi, OID_AUTO, suspend_bounce, CTLFLAG_RW,
 &acpi_susp_bounce, 0, "Don't actually suspend, just test devices.");
 
+#if defined(__amd64__) || defined(__i386__)
+int acpi_override_isa_irq_polarity;
+#endif
+
 /*
  * ACPI standard UUID for Device Specific Data Package
  * "Device Properties UUID for _DSD" Rev. 2.0
@@ -611,6 +617,19 @@ acpi_attach(device_t dev)
OID_AUTO, "handle_reboot", CTLFLAG_RW,
&sc->acpi_handle_reboot, 0, "Use ACPI Reset Register to reboot");
 
+#if defined(__amd64__) || defined(__i386__)
+/*
+ * Enable workaround for incorrect ISA IRQ polarity by default on
+ * systems with Intel CPUs.
+ */
+if (cpu_vendor_id == CPU_VENDOR_INTEL)
+   acpi_override_isa_irq_polarity = 1;
+SYSCTL_ADD_INT(&sc->acpi_sysctl_ctx, SYSCTL_CHILDREN(sc->acpi_sysctl_tree),
+   OID_AUTO, "override_isa_irq_polarity", CTLFLAG_RDTUN,
+   &acpi_override_isa_irq_polarity, 0,
+   "Force active-hi polarity for edge-triggered ISA IRQs");
+#endif
+
 /*
  * Default to 1 second before sleeping to give some machines time to
  * stabilize.
diff --git a/sys/dev/acpica/acpi_resource.c b/sys/dev/acpica/acpi_resource.c
index 87b82a574beb..1257ed30cc65 100644
--- a/sys/dev/acpica/acpi_resource.c
+++ b/sys/dev/acpica/acpi_resource.c
@@ -159,14 +159,11 @@ acpi_config_intr(device_t dev, ACPI_RESOURCE *res)
 }
 
 #if defined(__amd64__) || defined(__i386__)
-/*
- * XXX: Certain BIOSes have buggy AML that specify an IRQ that is
- * edge-sensitive and active-lo.  However, e

git: 9cc06bf7aa28 - main - amd64 GENERIC: Switch uart hints from "isa" to "acpi"

2024-07-15 Thread John Baldwin
The branch main has been updated by jhb:

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

commit 9cc06bf7aa2846c35483de567779bb8afc289f53
Author: John Baldwin 
AuthorDate: 2024-07-15 19:14:01 +
Commit: John Baldwin 
CommitDate: 2024-07-15 19:15:29 +

amd64 GENERIC: Switch uart hints from "isa" to "acpi"

This causes these hints to be only used to wire device unit numbers
for serial ports enumerated by ACPI but will not create ISA device
nodes if ACPI doesn't enumerate them.  Note that IRQ hints are not
used for wiring so have been removed.

PR: 270707
Reported by:aixdroix_...@protonmail.com, Michael Dexter
Reported by:mfw_b...@pm.me, Hannes Hfauswedell 
Reported by:Matthias Lanter 
Reported by:William Bulley 
Reviewed by:imp
MFC after:  1 week
Differential Revision:  https://reviews.freebsd.org/D45945
---
 sys/amd64/conf/GENERIC.hints | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/sys/amd64/conf/GENERIC.hints b/sys/amd64/conf/GENERIC.hints
index 7c2a3f28b9ce..4f6121c7cf77 100644
--- a/sys/amd64/conf/GENERIC.hints
+++ b/sys/amd64/conf/GENERIC.hints
@@ -6,13 +6,11 @@ hint.psm.0.at="atkbdc"
 hint.psm.0.irq="12"
 hint.sc.0.at="isa"
 hint.sc.0.flags="0x100"
-hint.uart.0.at="isa"
+hint.uart.0.at="acpi"
 hint.uart.0.port="0x3F8"
 hint.uart.0.flags="0x10"
-hint.uart.0.irq="4"
-hint.uart.1.at="isa"
+hint.uart.1.at="acpi"
 hint.uart.1.port="0x2F8"
-hint.uart.1.irq="3"
 hint.atrtc.0.at="isa"
 hint.atrtc.0.port="0x70"
 hint.atrtc.0.irq="8"



Re: git: 9cc06bf7aa28 - main - amd64 GENERIC: Switch uart hints from "isa" to "acpi"

2024-07-15 Thread John Baldwin

On 7/15/24 15:15, John Baldwin wrote:

The branch main has been updated by jhb:

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

commit 9cc06bf7aa2846c35483de567779bb8afc289f53
Author: John Baldwin 
AuthorDate: 2024-07-15 19:14:01 +
Commit: John Baldwin 
CommitDate: 2024-07-15 19:15:29 +

 amd64 GENERIC: Switch uart hints from "isa" to "acpi"
 
 This causes these hints to be only used to wire device unit numbers

 for serial ports enumerated by ACPI but will not create ISA device
 nodes if ACPI doesn't enumerate them.  Note that IRQ hints are not
 used for wiring so have been removed.
 
 PR: 270707

 Reported by:aixdroix_...@protonmail.com, Michael Dexter
 Reported by:mfw_b...@pm.me, Hannes Hfauswedell 
 Reported by:Matthias Lanter 
 Reported by:William Bulley 
 Reviewed by:imp
 MFC after:  1 week
 Differential Revision:  https://reviews.freebsd.org/D45945
---
  sys/amd64/conf/GENERIC.hints | 6 ++
  1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/sys/amd64/conf/GENERIC.hints b/sys/amd64/conf/GENERIC.hints
index 7c2a3f28b9ce..4f6121c7cf77 100644
--- a/sys/amd64/conf/GENERIC.hints
+++ b/sys/amd64/conf/GENERIC.hints
@@ -6,13 +6,11 @@ hint.psm.0.at="atkbdc"
  hint.psm.0.irq="12"
  hint.sc.0.at="isa"
  hint.sc.0.flags="0x100"
-hint.uart.0.at="isa"
+hint.uart.0.at="acpi"
  hint.uart.0.port="0x3F8"
  hint.uart.0.flags="0x10"
-hint.uart.0.irq="4"
-hint.uart.1.at="isa"
+hint.uart.1.at="acpi"
  hint.uart.1.port="0x2F8"
-hint.uart.1.irq="3"
  hint.atrtc.0.at="isa"
  hint.atrtc.0.port="0x70"
  hint.atrtc.0.irq="8"


Warner would like to purge more of this file (almost all of it) which is
probably correct.  Warner believes that the uart0 flags to set serial
console aren't needed for loaders from FreeBSD 9+ due to the hw.uart.*
tunables modern loaders set.  I'm less certain about hints for "fixed"
devices such as attimer0, atrtc0, and atkbdc0.  I feel like some systems
have failed to enumerate those in the past, though such systems may be
i386-only.  The sc0 hints I think can go away once we fully deprecate
sc(4) in favor of only vt(4).

I've chosen to leave i386 alone as there's still some ancient i386 cruft,
but on amd64 we have a higher bar (e.g. ACPI is de facto required for
amd64).  Also, i386 kernels have one foot in the grave already.

This commit is also somewhat narrow in scope as I plan to merge it back
to 13 and 14.

--
John Baldwin




Re: git: 87ee63bac69d - main - locks: add a runtime check for missing turnstile

2024-07-15 Thread John Baldwin

On 7/15/24 14:40, Mateusz Guzik wrote:

On Mon, Jul 15, 2024 at 8:33 PM Mateusz Guzik  wrote:


On Mon, Jul 15, 2024 at 8:21 PM John Baldwin  wrote:


On 7/15/24 13:59, Mateusz Guzik wrote:

On Mon, Jul 15, 2024 at 6:22 PM John Baldwin  wrote:


On 7/11/24 07:07, Mateusz Guzik wrote:

The branch main has been updated by mjg:

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

commit 87ee63bac69dc49291f55590b8baa57cad6c7d85
Author: Mateusz Guzik 
AuthorDate: 2024-07-11 00:17:27 +
Commit: Mateusz Guzik 
CommitDate: 2024-07-11 11:06:52 +

   locks: add a runtime check for missing turnstile

   There are sometimes bugs which result in the unlock fast path failing,
   which in turns causes a not-helpful crash report when dereferencing a
   NULL turnstile. Help debugging such cases by pointing out what happened
   along with some debug.

   Sponsored by:   Rubicon Communications, LLC ("Netgate")
---
sys/kern/kern_mutex.c  |  4 +++-
sys/kern/kern_rwlock.c | 16 
2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/sys/kern/kern_mutex.c b/sys/kern/kern_mutex.c
index 90361b23c09a..0fa624cc4bb1 100644
--- a/sys/kern/kern_mutex.c
+++ b/sys/kern/kern_mutex.c
@@ -1053,7 +1053,9 @@ __mtx_unlock_sleep(volatile uintptr_t *c, uintptr_t v)
turnstile_chain_lock(&m->lock_object);
_mtx_release_lock_quick(m);
ts = turnstile_lookup(&m->lock_object);
- MPASS(ts != NULL);
+ if (__predict_false(ts == NULL)) {
+ panic("got NULL turnstile on mutex %p v %zx", m, v);
+ }


Hmm, this is just an expanded KASSERT() but always on rather than conditional 
on INVARIANTS?

Do you have examples of the type of bugs that cause this?  (Is it unlocking a 
freed mutex
or the like?)  We generally hide all these types of checks under INVARIANTS 
rather than
shipping them in release kernels.



Use-after-free, overflow, underflow, bitflip or what have you all can
fail the fast path.

Once that happens and the kernel crashes with a null pointer deref,
here is a crash at netgate which prodded this:
calltrap() at calltrap+0x8/frame 0xfe0106720920
--- trap 0xc, rip = 0x80d5ab70, rsp = 0xfe01067209f0, rbp
= 0xfe0106720a00 ---
turnstile_broadcast() at turnstile_broadcast+0x40/frame 0xfe0106720a00
__rw_wunlock_hard() at __rw_wunlock_hard+0x9e/frame 0xfe0106720a30
nd6_resolve_slow() at nd6_resolve_slow+0x2d7/frame 0xfe0106720aa0
nd6_resolve() at nd6_resolve+0x125/frame 0xfe0106720b10
ether_output() at ether_output+0x4e7/frame 0xfe0106720ba0
ip_output_send() at ip_output_send+0xdc/frame 0xfe0106720be0
ip_output() at ip_output+0x1295/frame 0xfe0106720ce0
ip_forward() at ip_forward+0x3c2/frame 0xfe0106720d90
ip_input() at ip_input+0x705/frame 0xfe0106720df0
swi_net() at swi_net+0x138/frame 0xfe0106720e60
ithread_loop() at ithread_loop+0x257/frame 0xfe0106720ef0
fork_exit() at fork_exit+0x7f/frame 0xfe0106720f30
fork_trampoline() at fork_trampoline+0xe/frame 0xfe0106720f30
--- trap 0, rip = 0, rsp = 0, rbp = 0 ---

Neither the register dump nor anything in the backtrace indicate what happened.

Since the kernel is going down anyway, one may as well get some debug from it.


If you don't mind the extra branches for sanity checks, why not just run with
INVARIANTS?  That is, what makes these particular assertions different from
other assertions such that they should be on unconditionally?  The last line 
below
applies to pretty much every other assertion in the tree.



This adds a branch in the slowpath, a spot which should relatively
rarely execute compared to the fast path. On top of that the branch at
hand does not do any extra memory accesses or complex arithmetic.

So no, I don't think I may as well run with INVARIANTS.


How about this: if you strongly about this branch, feel free to revert
the commit, I'm just going to keep the change at Netgate.

But should you do it, make sure to not add avoidable branches in your stuff.


It's more that I think this is an unusual case (unconditional assertions rather
than conditional on INVARIANTS) such that it's probably worth being a bit more
explicit about that in the log with the rationale, etc.  That is, I don't think
"runtime check" quite communicates that you are intentionally doing an
unconditional assertion, and a bit more detail about the specific types of
bugs might have been useful in the log as well.  I think it's fine if we want
to have some checks that are always on, but it's currently quite rare so
needs a bit more rationale in the log than other changes is all.

--
John Baldwin




Re: git: 838b6caababb - main - openssl: use getrandom(2) instead of probing for getentropy(2)

2024-07-17 Thread John Baldwin
sctl_random() defined (but unused) on FreeBSD.


---
  .../openssl/providers/implementations/rands/seeding/rand_unix.c  | 9 +
  1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/crypto/openssl/providers/implementations/rands/seeding/rand_unix.c 
b/crypto/openssl/providers/implementations/rands/seeding/rand_unix.c
index 750afca58ed7..eadacedbe40c 100644
--- a/crypto/openssl/providers/implementations/rands/seeding/rand_unix.c
+++ b/crypto/openssl/providers/implementations/rands/seeding/rand_unix.c
@@ -356,7 +356,7 @@ static ssize_t syscall_random(void *buf, size_t buflen)
   * Note: Sometimes getentropy() can be provided but not implemented
   * internally. So we need to check errno for ENOSYS
   */
-#  if !defined(__DragonFly__) && !defined(__NetBSD__)
+#  if !defined(__DragonFly__) && !defined(__NetBSD__) && !defined(__FreeBSD__)
  #if defined(__GNUC__) && __GNUC__>=2 && defined(__ELF__) && 
!defined(__hpux)
  extern int getentropy(void *buffer, size_t length) __attribute__((weak));
  
@@ -393,11 +393,12 @@ static ssize_t syscall_random(void *buf, size_t buflen)

  /* Linux supports this since version 3.17 */
  #  if defined(__linux) && defined(__NR_getrandom)
  return syscall(__NR_getrandom, buf, buflen, 0);
-#  elif (defined(__FreeBSD__) || defined(__NetBSD__)) && defined(KERN_ARND)
-return sysctl_random(buf, buflen);
  #  elif (defined(__DragonFly__)  && __DragonFly_version >= 500700) \
- || (defined(__NetBSD__) && __NetBSD_Version >= 10)
+ || (defined(__NetBSD__) && __NetBSD_Version >= 10) \
+     || defined(__FreeBSD__)
  return getrandom(buf, buflen, 0);
+#  elif defined(__NetBSD__) && defined(KERN_ARND)
+return sysctl_random(buf, buflen);
  #  else
  errno = ENOSYS;
  return -1;


--
John Baldwin



Re: git: c24e5fcca9c2 - main - mvs: Fix to use rman_get_rid rather than non-existent rid argument

2024-07-17 Thread John Baldwin

On 7/17/24 09:00, Jessica Clarke wrote:

The branch main has been updated by jrtc27:

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

commit c24e5fcca9c2f2cacaf3d7883f0ecb4d5a4747cc
Author: Jessica Clarke 
AuthorDate: 2024-07-17 12:59:13 +
Commit: Jessica Clarke 
CommitDate: 2024-07-17 12:59:13 +

 mvs: Fix to use rman_get_rid rather than non-existent rid argument
 
 This got missed as it's not built in a normal tinderbox build.
 
 This fixes building arm.armv7 ARMADAXP (marked NO_UNIVERSE).
 
 Fixes:  9dbf5b0e6876 ("new-bus: Remove the 'rid' and 'type' arguments from BUS_RELEASE_RESOURCE")


Oops, thanks

--
John Baldwin




git: 03248b3f5079 - main - NOTES: Correct swapped descriptions of virtio_scmi and virtio_scsi

2024-07-18 Thread John Baldwin
The branch main has been updated by jhb:

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

commit 03248b3f5079c490d949f4e8725a37624d707e14
Author: John Baldwin 
AuthorDate: 2024-07-18 17:28:57 +
Commit: John Baldwin 
CommitDate: 2024-07-18 17:28:57 +

NOTES: Correct swapped descriptions of virtio_scmi and virtio_scsi

Sponsored by:   Chelsio Communications
---
 sys/conf/NOTES | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/conf/NOTES b/sys/conf/NOTES
index ecfa7aa5b33a..685125b782ca 100644
--- a/sys/conf/NOTES
+++ b/sys/conf/NOTES
@@ -2433,8 +2433,8 @@ devicevirtio_blk  # VirtIO Block device
 device virtio_console  # VirtIO Console device
 device virtio_gpu  # VirtIO GPU device
 device virtio_random   # VirtIO Entropy device
-device virtio_scmi # VirtIO SCSI device
-device virtio_scsi # VirtIO SCMI device
+device virtio_scmi # VirtIO SCMI device
+device virtio_scsi # VirtIO SCSI device
 
 #
 # HID support



git: ee912ee57a21 - main - nvmecontrol: Treat requested KeepAlive timeout as seconds

2024-07-18 Thread John Baldwin
The branch main has been updated by jhb:

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

commit ee912ee57a213b25fc9e559054e5869b4a6b2f61
Author: John Baldwin 
AuthorDate: 2024-07-18 18:54:43 +
Commit: John Baldwin 
CommitDate: 2024-07-18 18:54:43 +

nvmecontrol: Treat requested KeepAlive timeout as seconds

The internal KATO is stored in milliseconds, so convert the command
line argument (given in seconds) to milliseconds before passing to
nvmf_connect().

Sponsored by:   Chelsio Communications
---
 sbin/nvmecontrol/connect.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sbin/nvmecontrol/connect.c b/sbin/nvmecontrol/connect.c
index 14bd0cce1f8f..ef614eca2e2a 100644
--- a/sbin/nvmecontrol/connect.c
+++ b/sbin/nvmecontrol/connect.c
@@ -82,7 +82,7 @@ connect_nvm_controller(enum nvmf_trtype trtype, int adrfam, 
const char *address,
 
io = calloc(opt.num_io_queues, sizeof(*io));
error = connect_nvm_queues(&aparams, trtype, adrfam, address, port,
-   cntlid, subnqn, opt.hostnqn, opt.kato, &admin, io,
+   cntlid, subnqn, opt.hostnqn, opt.kato * 1000, &admin, io,
opt.num_io_queues, opt.queue_size, &cdata);
if (error != 0) {
free(io);



git: 680f40f38343 - main - stdatomic: Only use clang atomics if __clang__ is defined

2024-07-19 Thread John Baldwin
The branch main has been updated by jhb:

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

commit 680f40f38343de118d5b973129683804e496faaf
Author: John Baldwin 
AuthorDate: 2024-07-19 17:01:07 +
Commit: John Baldwin 
CommitDate: 2024-07-19 17:05:52 +

stdatomic: Only use clang atomics if __clang__ is defined

GCC 14 defines __has_extension(c_atomic) but does not support
__c11_atomic_*, so require __clang__ for the CLANG_ATOMICS case.

Reviewed by:imp, emaste
Differential Revision:  https://reviews.freebsd.org/D46001
---
 sys/sys/stdatomic.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sys/sys/stdatomic.h b/sys/sys/stdatomic.h
index e05606b1ead8..099097ea84a4 100644
--- a/sys/sys/stdatomic.h
+++ b/sys/sys/stdatomic.h
@@ -33,7 +33,8 @@
 #include 
 #include 
 
-#if __has_extension(c_atomic) || __has_extension(cxx_atomic)
+#if (__has_extension(c_atomic) || __has_extension(cxx_atomic)) && \
+defined(__clang__)
 #define__CLANG_ATOMICS
 #elif __GNUC_PREREQ__(4, 7)
 #define__GNUC_ATOMICS



git: 5275d1ddb42d - main - libcasper: Consistently use item count as the first argument to calloc

2024-07-19 Thread John Baldwin
The branch main has been updated by jhb:

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

commit 5275d1ddb42dc70fb87925e59445059068c08271
Author: John Baldwin 
AuthorDate: 2024-07-19 17:01:40 +
Commit: John Baldwin 
CommitDate: 2024-07-19 17:05:58 +

libcasper: Consistently use item count as the first argument to calloc

Reported by:GCC 14 -Wcalloc-transposed-args
Reviewed by:rlibby, emaste
Differential Revision:  https://reviews.freebsd.org/D46005
---
 lib/libcasper/services/cap_dns/cap_dns.c | 4 ++--
 lib/libcasper/services/cap_net/cap_net.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/libcasper/services/cap_dns/cap_dns.c 
b/lib/libcasper/services/cap_dns/cap_dns.c
index 8548715a6978..32cbf973ad45 100644
--- a/lib/libcasper/services/cap_dns/cap_dns.c
+++ b/lib/libcasper/services/cap_dns/cap_dns.c
@@ -85,7 +85,7 @@ hostent_unpack(const nvlist_t *nvl, struct hostent *hp)
hp->h_length = (int)nvlist_get_number(nvl, "length");
 
nitems = (unsigned int)nvlist_get_number(nvl, "naliases");
-   hp->h_aliases = calloc(sizeof(hp->h_aliases[0]), nitems + 1);
+   hp->h_aliases = calloc(nitems + 1, sizeof(hp->h_aliases[0]));
if (hp->h_aliases == NULL)
goto fail;
for (ii = 0; ii < nitems; ii++) {
@@ -99,7 +99,7 @@ hostent_unpack(const nvlist_t *nvl, struct hostent *hp)
hp->h_aliases[ii] = NULL;
 
nitems = (unsigned int)nvlist_get_number(nvl, "naddrs");
-   hp->h_addr_list = calloc(sizeof(hp->h_addr_list[0]), nitems + 1);
+   hp->h_addr_list = calloc(nitems + 1, sizeof(hp->h_addr_list[0]));
if (hp->h_addr_list == NULL)
goto fail;
for (ii = 0; ii < nitems; ii++) {
diff --git a/lib/libcasper/services/cap_net/cap_net.c 
b/lib/libcasper/services/cap_net/cap_net.c
index a8f039f81843..40d18319ae28 100644
--- a/lib/libcasper/services/cap_net/cap_net.c
+++ b/lib/libcasper/services/cap_net/cap_net.c
@@ -105,7 +105,7 @@ hostent_unpack(const nvlist_t *nvl, struct hostent *hp)
hp->h_length = (int)nvlist_get_number(nvl, "length");
 
nitems = (unsigned int)nvlist_get_number(nvl, "naliases");
-   hp->h_aliases = calloc(sizeof(hp->h_aliases[0]), nitems + 1);
+   hp->h_aliases = calloc(nitems + 1, sizeof(hp->h_aliases[0]));
if (hp->h_aliases == NULL)
goto fail;
for (ii = 0; ii < nitems; ii++) {
@@ -119,7 +119,7 @@ hostent_unpack(const nvlist_t *nvl, struct hostent *hp)
hp->h_aliases[ii] = NULL;
 
nitems = (unsigned int)nvlist_get_number(nvl, "naddrs");
-   hp->h_addr_list = calloc(sizeof(hp->h_addr_list[0]), nitems + 1);
+   hp->h_addr_list = calloc(nitems + 1, sizeof(hp->h_addr_list[0]));
if (hp->h_addr_list == NULL)
goto fail;
for (ii = 0; ii < nitems; ii++) {



git: b73445a32f8a - main - elftoolchain: Consistently use item count as the first argument to calloc

2024-07-19 Thread John Baldwin
The branch main has been updated by jhb:

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

commit b73445a32f8a3648372c0042ef633fe61b38d135
Author: John Baldwin 
AuthorDate: 2024-07-19 17:02:45 +
Commit: John Baldwin 
CommitDate: 2024-07-19 17:06:11 +

elftoolchain: Consistently use item count as the first argument to calloc

Reported by:GCC 14 -Wcalloc-transposed-args
Reviewed by:rlibby, emaste
Differential Revision:  https://reviews.freebsd.org/D46007
---
 contrib/elftoolchain/libdwarf/libdwarf_init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/elftoolchain/libdwarf/libdwarf_init.c 
b/contrib/elftoolchain/libdwarf/libdwarf_init.c
index b85c87c59af0..95ed6147ba89 100644
--- a/contrib/elftoolchain/libdwarf/libdwarf_init.c
+++ b/contrib/elftoolchain/libdwarf/libdwarf_init.c
@@ -302,7 +302,7 @@ _dwarf_alloc(Dwarf_Debug *ret_dbg, int mode, Dwarf_Error 
*error)
 {
Dwarf_Debug dbg;
 
-   if ((dbg = calloc(sizeof(struct _Dwarf_Debug), 1)) == NULL) {
+   if ((dbg = calloc(1, sizeof(struct _Dwarf_Debug))) == NULL) {
DWARF_SET_ERROR(dbg, error, DW_DLE_MEMORY);
return (DW_DLE_MEMORY);
}



git: bf3b889a5be1 - main - libgeom: Consistently use item count as the first argument to calloc

2024-07-19 Thread John Baldwin
The branch main has been updated by jhb:

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

commit bf3b889a5be141f3abadcfc5a1d1cbdc50273d72
Author: John Baldwin 
AuthorDate: 2024-07-19 17:02:05 +
Commit: John Baldwin 
CommitDate: 2024-07-19 17:06:03 +

libgeom: Consistently use item count as the first argument to calloc

Reported by:GCC 14 -Wcalloc-transposed-args
Reviewed by:rlibby, imp, emaste
Differential Revision:  https://reviews.freebsd.org/D46006
---
 lib/libgeom/geom_xml2tree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/libgeom/geom_xml2tree.c b/lib/libgeom/geom_xml2tree.c
index 49cbb0385770..2d2c43e29e77 100644
--- a/lib/libgeom/geom_xml2tree.c
+++ b/lib/libgeom/geom_xml2tree.c
@@ -407,7 +407,7 @@ geom_xml2tree(struct gmesh *gmp, char *p)
free(mt);
return (error);
}
-   gmp->lg_ident = calloc(sizeof *gmp->lg_ident, mt->nident + 1);
+   gmp->lg_ident = calloc(mt->nident + 1, sizeof(*gmp->lg_ident));
free(mt);
if (gmp->lg_ident == NULL)
return (ENOMEM);



git: e8e2ab3c5522 - main - md5: Consistently use item count as the first argument to calloc

2024-07-19 Thread John Baldwin
The branch main has been updated by jhb:

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

commit e8e2ab3c55228d66388a0b33de8c5ac4b3d6dbe9
Author: John Baldwin 
AuthorDate: 2024-07-19 17:04:27 +
Commit: John Baldwin 
CommitDate: 2024-07-19 17:06:20 +

md5: Consistently use item count as the first argument to calloc

Reported by:GCC 14 -Wcalloc-transposed-args
Reviewed by:rlibby
Differential Revision:  https://reviews.freebsd.org/D46009
---
 sbin/md5/md5.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sbin/md5/md5.c b/sbin/md5/md5.c
index 70fc7cb7eef1..10ffae53c775 100644
--- a/sbin/md5/md5.c
+++ b/sbin/md5/md5.c
@@ -592,7 +592,7 @@ main(int argc, char *argv[])
while (argc--)
gnu_check(*argv++);
argc = 0;
-   argv = calloc(sizeof(char *), numrecs + 1);
+   argv = calloc(numrecs + 1, sizeof(char *));
for (rec = head; rec != NULL; rec = rec->next) {
argv[argc] = rec->filename;
argc++;



git: 8aadd10a65b1 - main - lib80211: Consistently use item count as the first argument to calloc

2024-07-19 Thread John Baldwin
The branch main has been updated by jhb:

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

commit 8aadd10a65b11f18950118a10569233e1420ab45
Author: John Baldwin 
AuthorDate: 2024-07-19 17:03:19 +
Commit: John Baldwin 
CommitDate: 2024-07-19 17:06:16 +

lib80211: Consistently use item count as the first argument to calloc

Reported by:GCC 14 -Wcalloc-transposed-args
Reviewed by:rlibby, emaste
Differential Revision:  https://reviews.freebsd.org/D46008
---
 lib/lib80211/lib80211_regdomain.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/lib80211/lib80211_regdomain.c 
b/lib/lib80211/lib80211_regdomain.c
index 189d4661c78b..db353a69f4d9 100644
--- a/lib/lib80211/lib80211_regdomain.c
+++ b/lib/lib80211/lib80211_regdomain.c
@@ -441,7 +441,7 @@ lib80211_regdomain_readconfig(struct regdata *rdp, const 
void *p, size_t len)
XML_ParserFree(mt->parser);
 
/* setup the identifer table */
-   rdp->ident = calloc(sizeof(struct ident), mt->nident + 1);
+   rdp->ident = calloc(mt->nident + 1, sizeof(struct ident));
if (rdp->ident == NULL)
return ENOMEM;
free(mt);



git: 6991cb36f52a - main - recoverdisk: Consistently use item count as the first argument to calloc

2024-07-19 Thread John Baldwin
The branch main has been updated by jhb:

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

commit 6991cb36f52a35043132f349a60748eeb382ff32
Author: John Baldwin 
AuthorDate: 2024-07-19 17:04:50 +
Commit: John Baldwin 
CommitDate: 2024-07-19 17:06:25 +

recoverdisk: Consistently use item count as the first argument to calloc

Reported by:GCC 14 -Wcalloc-transposed-args
Reviewed by:rlibby, imp, emaste
Differential Revision:  https://reviews.freebsd.org/D46010
---
 sbin/recoverdisk/recoverdisk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sbin/recoverdisk/recoverdisk.c b/sbin/recoverdisk/recoverdisk.c
index 43b62fc142f3..91f42c904c52 100644
--- a/sbin/recoverdisk/recoverdisk.c
+++ b/sbin/recoverdisk/recoverdisk.c
@@ -82,7 +82,7 @@ report_good_read2(time_t now, size_t bytes, struct 
period_head *ph, time_t dt)
 
pp = TAILQ_FIRST(ph);
if (pp == NULL || pp->t1 < now) {
-   pp = calloc(sizeof *pp, 1L);
+   pp = calloc(1, sizeof(*pp));
assert(pp != NULL);
pp->t0 = (now / dt) * dt;
pp->t1 = (now / dt + 1) * dt;



git: a971c6045622 - main - ministat: Consistently use item count as the first argument to calloc

2024-07-19 Thread John Baldwin
The branch main has been updated by jhb:

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

commit a971c60456223b22c0b3c557d712b36660dbcff9
Author: John Baldwin 
AuthorDate: 2024-07-19 17:05:12 +
Commit: John Baldwin 
CommitDate: 2024-07-19 17:06:38 +

ministat: Consistently use item count as the first argument to calloc

Reported by:GCC 14 -Wcalloc-transposed-args
Reviewed by:rlibby, emaste
Differential Revision:  https://reviews.freebsd.org/D46011
---
 usr.bin/ministat/ministat.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/usr.bin/ministat/ministat.c b/usr.bin/ministat/ministat.c
index 6508ce3f2533..6967841a339f 100644
--- a/usr.bin/ministat/ministat.c
+++ b/usr.bin/ministat/ministat.c
@@ -152,7 +152,7 @@ NewSet(void)
ds = calloc(1, sizeof *ds);
assert(ds != NULL);
ds->lpoints = 10;
-   ds->points = calloc(sizeof *ds->points, ds->lpoints);
+   ds->points = calloc(ds->lpoints, sizeof(*ds->points));
assert(ds->points != NULL);
ds->syy = NAN;
return(ds);
@@ -166,7 +166,7 @@ AddPoint(struct dataset *ds, double a)
if (ds->n >= ds->lpoints) {
dp = ds->points;
ds->lpoints *= 4;
-   ds->points = calloc(sizeof *ds->points, ds->lpoints);
+   ds->points = calloc(ds->lpoints, sizeof(*ds->points));
assert(ds->points != NULL);
memcpy(ds->points, dp, sizeof *dp * ds->n);
free(dp);
@@ -355,7 +355,7 @@ PlotSet(struct dataset *ds, int val)
bar = 0;
 
if (pl->bar == NULL) {
-   pl->bar = calloc(sizeof(char *), pl->num_datasets);
+   pl->bar = calloc(pl->num_datasets, sizeof(char *));
assert(pl->bar != NULL);
}
 



git: 7cd0a4c85dbe - main - bsdinstall: Consistently use item count as the first argument to calloc

2024-07-19 Thread John Baldwin
The branch main has been updated by jhb:

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

commit 7cd0a4c85dbe5e8cd000f6b293ef2d579d22edfb
Author: John Baldwin 
AuthorDate: 2024-07-19 17:07:00 +
Commit: John Baldwin 
CommitDate: 2024-07-19 17:07:00 +

bsdinstall: Consistently use item count as the first argument to calloc

Reported by:GCC 14 -Wcalloc-transposed-args
Reviewed by:rlibby, imp, emaste
Differential Revision:  https://reviews.freebsd.org/D46012
---
 usr.sbin/bsdinstall/distfetch/distfetch.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/usr.sbin/bsdinstall/distfetch/distfetch.c 
b/usr.sbin/bsdinstall/distfetch/distfetch.c
index c431e187799d..ddb8a8361d6b 100644
--- a/usr.sbin/bsdinstall/distfetch/distfetch.c
+++ b/usr.sbin/bsdinstall/distfetch/distfetch.c
@@ -130,8 +130,8 @@ fetch_files(int nfiles, char **urls)
struct bsddialog_conf mgconf;
 
/* Make the transfer list for mixedgauge */
-   minilabel = calloc(sizeof(char *), nfiles);
-   miniperc = calloc(sizeof(int), nfiles);
+   minilabel = calloc(nfiles, sizeof(char *));
+   miniperc = calloc(nfiles, sizeof(int));
if (minilabel == NULL || miniperc == NULL)
errx(EXIT_FAILURE, "Error: distfetch minibars out of memory!");
 



git: 2ba12978f674 - main - ctld: Consistently use item count as the first argument to calloc

2024-07-19 Thread John Baldwin
The branch main has been updated by jhb:

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

commit 2ba12978f67432a3f88b17704391d28e1fc0e788
Author: John Baldwin 
AuthorDate: 2024-07-19 17:07:22 +
Commit: John Baldwin 
CommitDate: 2024-07-19 17:07:22 +

ctld: Consistently use item count as the first argument to calloc

Reported by:GCC 14 -Wcalloc-transposed-args
Reviewed by:rlibby, imp, emaste
Differential Revision:  https://reviews.freebsd.org/D46013
---
 usr.sbin/ctld/isns.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/usr.sbin/ctld/isns.c b/usr.sbin/ctld/isns.c
index 71150a8ae06f..0b836324ff47 100644
--- a/usr.sbin/ctld/isns.c
+++ b/usr.sbin/ctld/isns.c
@@ -48,14 +48,14 @@ isns_req_alloc(void)
 {
struct isns_req *req;
 
-   req = calloc(sizeof(struct isns_req), 1);
+   req = calloc(1, sizeof(struct isns_req));
if (req == NULL) {
log_err(1, "calloc");
return (NULL);
}
req->ir_buflen = sizeof(struct isns_hdr);
req->ir_usedlen = 0;
-   req->ir_buf = calloc(req->ir_buflen, 1);
+   req->ir_buf = calloc(1, req->ir_buflen);
if (req->ir_buf == NULL) {
free(req);
log_err(1, "calloc");



git: 9494dfe1b3fa - main - fwcontrol: Allocate full fw_asyreq structures passed to the kernel

2024-07-19 Thread John Baldwin
The branch main has been updated by jhb:

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

commit 9494dfe1b3faf5c48abaa9be4ec87e4669963942
Author: John Baldwin 
AuthorDate: 2024-07-19 17:08:14 +
Commit: John Baldwin 
CommitDate: 2024-07-19 17:09:32 +

fwcontrol: Allocate full fw_asyreq structures passed to the kernel

The FW_ASYREQ ioctl accepts a struct fw_asyreq object as its argument,
meaning that the kernel always copies in the full structure in
sys_ioctl before passing the request down to the driver.  However,
fwcontrol was allocating smaller objects that contained only the
request header and a variable-sized payload.  This means that the
kernel copy in sys_ioctl was reading off the end of this buffer.  On
current architectures this happened to be ok, but it is UB.

Instead, allocate a full structure.

Reported by:GCC 14 -Walloc-size
Reviewed by:rlibby, brooks
Differential Revision:  https://reviews.freebsd.org/D46014
---
 usr.sbin/fwcontrol/fwcontrol.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/usr.sbin/fwcontrol/fwcontrol.c b/usr.sbin/fwcontrol/fwcontrol.c
index 94478259606d..ce908341a42a 100644
--- a/usr.sbin/fwcontrol/fwcontrol.c
+++ b/usr.sbin/fwcontrol/fwcontrol.c
@@ -207,7 +207,7 @@ read_write_quad(int fd, struct fw_eui64 eui, u_int32_t 
addr_lo, int readmode, u_
 struct fw_asyreq *asyreq;
u_int32_t *qld, res;
 
-asyreq = (struct fw_asyreq *)malloc(sizeof(struct fw_asyreq_t) + 16);
+   asyreq = malloc(sizeof(*asyreq));
if (asyreq == NULL)
err(EX_SOFTWARE, "%s:asyreq malloc", __func__);
asyreq->req.len = 16;
@@ -262,7 +262,7 @@ send_phy_config(int fd, int root_node, int gap_count)
 {
 struct fw_asyreq *asyreq;
 
-   asyreq = (struct fw_asyreq *)malloc(sizeof(struct fw_asyreq_t) + 12);
+   asyreq = malloc(sizeof(*asyreq));
if (asyreq == NULL)
err(EX_SOFTWARE, "%s:asyreq malloc", __func__);
asyreq->req.len = 12;
@@ -289,7 +289,7 @@ link_on(int fd, int node)
 {
 struct fw_asyreq *asyreq;
 
-   asyreq = (struct fw_asyreq *)malloc(sizeof(struct fw_asyreq_t) + 12);
+   asyreq = malloc(sizeof(*asyreq));
if (asyreq == NULL)
err(EX_SOFTWARE, "%s:asyreq malloc", __func__);
asyreq->req.len = 12;
@@ -308,7 +308,7 @@ reset_start(int fd, int node)
 {
 struct fw_asyreq *asyreq;
 
-   asyreq = (struct fw_asyreq *)malloc(sizeof(struct fw_asyreq_t) + 16);
+   asyreq = malloc(sizeof(*asyreq));
if (asyreq == NULL)
err(EX_SOFTWARE, "%s:asyreq malloc", __func__);
asyreq->req.len = 16;



git: e0649a35a670 - main - libnvmf: Zero controller data template for I/O controllers

2024-07-19 Thread John Baldwin
The branch main has been updated by jhb:

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

commit e0649a35a670c4b625d1de289b3886d9b3c9654f
Author: John Baldwin 
AuthorDate: 2024-07-19 21:06:47 +
Commit: John Baldwin 
CommitDate: 2024-07-19 21:06:47 +

libnvmf: Zero controller data template for I/O controllers

This prevents stack garbage from leaking into the cdata used for the
userspace I/O controller in nvmfd(8).

Sponsored by:   Chelsio Communications
---
 lib/libnvmf/nvmf_controller.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/libnvmf/nvmf_controller.c b/lib/libnvmf/nvmf_controller.c
index 554e5e769ded..0e0126040ee4 100644
--- a/lib/libnvmf/nvmf_controller.c
+++ b/lib/libnvmf/nvmf_controller.c
@@ -425,6 +425,7 @@ nvmf_init_io_controller_data(struct nvmf_qpair *qp, const 
char *serial,
 
uname(&utsname);
 
+   memset(cdata, 0, sizeof(*cdata));
_nvmf_init_io_controller_data(qp->nq_cntlid, na->na_params.max_io_qsize,
serial, utsname.sysname, utsname.release, subnqn, nn, ioccsz,
sizeof(struct nvme_completion), cdata);



Re: git: 6677621bad00 - main - cdefs.h: Fallback to printf0 for __printf0like

2024-07-22 Thread John Baldwin

On 7/19/24 17:20, Warner Losh wrote:

On Wed, Jul 10, 2024 at 12:19 PM John Baldwin  wrote:


On 7/6/24 17:56, John Baldwin wrote:

On 7/6/24 15:44, Warner Losh wrote:

The branch main has been updated by imp:

URL:

https://cgit.FreeBSD.org/src/commit/?id=6677621bad00191dfec1b0a20ae1618b92745d9b


commit 6677621bad00191dfec1b0a20ae1618b92745d9b
Author: Warner Losh 
AuthorDate: 2024-07-06 19:42:37 +
Commit: Warner Losh 
CommitDate: 2024-07-06 19:45:03 +

   cdefs.h: Fallback to printf0 for __printf0like

   For some reason, my tests were fine with this like it was, but CI

for

   gcc12 and gcc13 is complaining. Revert to the old form until that

can be

   worked out why the mismatch.

   Fixes: 0b82dac337e7
   Sponsored by:   Netflix
---
sys/sys/cdefs.h | 7 +--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h
index 6b861b1903f6..a56839d57c7a 100644
--- a/sys/sys/cdefs.h
+++ b/sys/sys/cdefs.h
@@ -356,9 +356,12 @@
 * Clang has always had printf and printf0 as aliases. gcc 11.0 now

follows

 * clang. So now this is an alias for __printflike, or nothing. In

the future

 * _Nullable or _Nonnull will replace this.
+ * XXX Except that doesn't work, so for now revert to printf0 for

clang and

+ * the FreeBSD gcc until I can work this out.
 */
-#if defined(__clang__) || __GNUC_PREREQ__(11, 0)
-#define __printf0like(fmtarg, firstvararg) __printflike(fmtarg,

firstvararg)

+#if defined(__clang__) || (defined(__GNUC__) && defined

(__FreeBSD_cc_version))

+#define __printf0like(fmtarg, firstvararg) \
+__attribute__((__format__ (__printf0__, fmtarg, firstvararg)))
#else
#define   __printf0like(fmtarg, firstvararg)
#endif


It's because my patch for devel/freebsd-gcc{12,13} is kind of wrong.  I

had a mismerge

when updating the printf0 patch from gcc9 to gcc12 that ended up

re-adding the

warn on NULL.  I need to update the ports to remove that part of the

patch.  I will

probably leave printf0 working for now in the ports just as an alias for

regular

printf to give us some transition time.


FYI, I have merged this fix to the ports, but not sure how we want to
manage doing
the patch to cdefs.h.  I kind of think we should apply the change to
cdefs.h in
main in another week or so.  I'm less certain of what to do for stable
branches.



I hadn't planned on merging this to stable branches. Is that your concern?


Yes, just if we wanted to merge the printf0 change in sys/cdefs.h to stable
branches.  I think it's fine to fix cdefs.h in main now.

--
John Baldwin




git: 43d45f26413a - main - nvmf_tcp: Don't require a data digest for PDUs without data

2024-07-22 Thread John Baldwin
The branch main has been updated by jhb:

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

commit 43d45f26413aa98e41994d0d0f06c49c7eca430e
Author: John Baldwin 
AuthorDate: 2024-07-22 19:38:12 +
Commit: John Baldwin 
CommitDate: 2024-07-22 21:05:55 +

nvmf_tcp: Don't require a data digest for PDUs without data

If a PDU (such as a Command Capsule PDU) on a connection that has
enabled data digests does not have a data section, it will not have
the the PDU data digest flag set.  The previous check was requiring
this flag to be present on all PDU types that support data sections
even if no data was included in the PDU.

Sponsored by:   Chelsio Communications
---
 sys/dev/nvmf/nvmf_tcp.h | 24 ++--
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/sys/dev/nvmf/nvmf_tcp.h b/sys/dev/nvmf/nvmf_tcp.h
index 78d6cf17a977..c60be0bc1024 100644
--- a/sys/dev/nvmf/nvmf_tcp.h
+++ b/sys/dev/nvmf/nvmf_tcp.h
@@ -41,6 +41,13 @@ nvmf_tcp_validate_pdu_header(const struct 
nvme_tcp_common_pdu_hdr *ch,
uint8_t digest_flags, valid_flags;
 
plen = le32toh(ch->plen);
+   full_hlen = ch->hlen;
+   if ((ch->flags & NVME_TCP_CH_FLAGS_HDGSTF) != 0)
+   full_hlen += sizeof(uint32_t);
+   if (plen == full_hlen)
+   data_len = 0;
+   else
+   data_len = plen - ch->pdo;
 
/*
 * Errors must be reported for the lowest incorrect field
@@ -125,11 +132,15 @@ nvmf_tcp_validate_pdu_header(const struct 
nvme_tcp_common_pdu_hdr *ch,
return (EBADMSG);
}
 
-   /* Verify that digests are present iff enabled. */
+   /*
+* Verify that digests are present iff enabled.  Note that the
+* data digest will not be present if there is no data
+* payload.
+*/
digest_flags = 0;
if (header_digests)
digest_flags |= NVME_TCP_CH_FLAGS_HDGSTF;
-   if (data_digests)
+   if (data_digests && data_len != 0)
digest_flags |= NVME_TCP_CH_FLAGS_DDGSTF;
if ((digest_flags & valid_flags) !=
(ch->flags & (NVME_TCP_CH_FLAGS_HDGSTF |
@@ -184,9 +195,6 @@ nvmf_tcp_validate_pdu_header(const struct 
nvme_tcp_common_pdu_hdr *ch,
}
 
/* Validate pdo. */
-   full_hlen = ch->hlen;
-   if ((ch->flags & NVME_TCP_CH_FLAGS_HDGSTF) != 0)
-   full_hlen += sizeof(uint32_t);
switch (ch->pdu_type) {
default:
__assert_unreachable();
@@ -207,7 +215,7 @@ nvmf_tcp_validate_pdu_header(const struct 
nvme_tcp_common_pdu_hdr *ch,
case NVME_TCP_PDU_TYPE_H2C_DATA:
case NVME_TCP_PDU_TYPE_C2H_DATA:
/* Permit PDO of 0 if there is no data. */
-   if (full_hlen == plen && ch->pdo == 0)
+   if (data_len == 0 && ch->pdo == 0)
break;
 
if (ch->pdo < full_hlen || ch->pdo > plen ||
@@ -229,10 +237,6 @@ nvmf_tcp_validate_pdu_header(const struct 
nvme_tcp_common_pdu_hdr *ch,
return (EBADMSG);
}
 
-   if (plen == full_hlen)
-   data_len = 0;
-   else
-   data_len = plen - ch->pdo;
switch (ch->pdu_type) {
default:
__assert_unreachable();



git: dcfa6669a33f - main - nvmft: Handle qpair allocation failures during handoff

2024-07-23 Thread John Baldwin
The branch main has been updated by jhb:

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

commit dcfa6669a33f1bf3dd347f3ab3bef79b5625b4b3
Author: John Baldwin 
AuthorDate: 2024-07-23 15:46:19 +
Commit: John Baldwin 
CommitDate: 2024-07-23 15:46:19 +

nvmft: Handle qpair allocation failures during handoff

If the transport fails to create a queue pair, fail with an error
rather than dereferencing a NULL pointer.

Sponsored by:   Chelsio Communications
---
 sys/dev/nvmf/controller/nvmft_controller.c | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/sys/dev/nvmf/controller/nvmft_controller.c 
b/sys/dev/nvmf/controller/nvmft_controller.c
index f3783eac1275..dee4d8c92d3d 100644
--- a/sys/dev/nvmf/controller/nvmft_controller.c
+++ b/sys/dev/nvmf/controller/nvmft_controller.c
@@ -122,6 +122,11 @@ nvmft_handoff_admin_queue(struct nvmft_port *np,
 
qp = nvmft_qpair_init(handoff->trtype, &handoff->params, 0,
"admin queue");
+   if (qp == NULL) {
+   printf("NVMFT: Failed to setup admin queue from %.*s\n",
+   (int)sizeof(data->hostnqn), data->hostnqn);
+   return (ENXIO);
+   }
 
sx_xlock(&np->lock);
cntlid = alloc_unr(np->ids);
@@ -187,6 +192,11 @@ nvmft_handoff_io_queue(struct nvmft_port *np,
 
snprintf(name, sizeof(name), "I/O queue %u", qid);
qp = nvmft_qpair_init(handoff->trtype, &handoff->params, qid, name);
+   if (qp == NULL) {
+   printf("NVMFT: Failed to setup I/O queue %u from %.*s\n", qid,
+   (int)sizeof(data->hostnqn), data->hostnqn);
+   return (ENXIO);
+   }
 
sx_slock(&np->lock);
TAILQ_FOREACH(ctrlr, &np->controllers, link) {



git: 5d0498db4782 - main - nvmf_tcp: Rename max_c2hdata sysctl to max_transmit_data

2024-07-25 Thread John Baldwin
The branch main has been updated by jhb:

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

commit 5d0498db478253c42b5e4140b9aff8596a797464
Author: John Baldwin 
AuthorDate: 2024-07-25 19:29:43 +
Commit: John Baldwin 
CommitDate: 2024-07-25 19:29:43 +

nvmf_tcp: Rename max_c2hdata sysctl to max_transmit_data

This sysctl sets a cap on the maximum payload of transmitted data PDUs
including both C2H_DATA and H2C_DATA PDUs, not just C2H_DATA PDUs.

Sponsored by:   Chelsio Communications
---
 share/man/man4/nvmf_tcp.4 | 15 +++
 sys/dev/nvmf/nvmf_tcp.c   |  2 +-
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/share/man/man4/nvmf_tcp.4 b/share/man/man4/nvmf_tcp.4
index 4d77997c19a2..0a650e342f0e 100644
--- a/share/man/man4/nvmf_tcp.4
+++ b/share/man/man4/nvmf_tcp.4
@@ -3,7 +3,7 @@
 .\"
 .\" Copyright (c) 2024 Chelsio Communications, Inc.
 .\"
-.Dd May 2, 2024
+.Dd July 25, 2024
 .Dt NVMF_TCP 4
 .Os
 .Sh NAME
@@ -35,10 +35,17 @@ variables and
 .Xr loader 8
 tunables:
 .Bl -tag -width indent
-.It Va kern.nvmf.tcp.max_c2hdata
-The maximum data payload size of a
+.It Va kern.nvmf.tcp.max_transmit_data
+The maximum data payload size of
 .Va C2H_DATA
-PDU sent by the controller to a remote host.
+and
+.Va H2C_DATA
+PDUs.
+A remote controller may enforce a lower limit on the size of
+.Va H2C_DATA
+PDUs via the
+.Va MAXH2CDATA
+parameter.
 The default size is 256 kilobytes.
 .El
 .Sh SEE ALSO
diff --git a/sys/dev/nvmf/nvmf_tcp.c b/sys/dev/nvmf/nvmf_tcp.c
index 57c81eceee02..8f1b3bf01e39 100644
--- a/sys/dev/nvmf/nvmf_tcp.c
+++ b/sys/dev/nvmf/nvmf_tcp.c
@@ -138,7 +138,7 @@ static void tcp_free_qpair(struct nvmf_qpair *nq);
 SYSCTL_NODE(_kern_nvmf, OID_AUTO, tcp, CTLFLAG_RD | CTLFLAG_MPSAFE, 0,
 "TCP transport");
 static u_int tcp_max_transmit_data = 256 * 1024;
-SYSCTL_UINT(_kern_nvmf_tcp, OID_AUTO, max_c2hdata, CTLFLAG_RWTUN,
+SYSCTL_UINT(_kern_nvmf_tcp, OID_AUTO, max_transmit_data, CTLFLAG_RWTUN,
 &tcp_max_transmit_data, 0,
 "Maximum size of data payload in a transmitted PDU");
 



git: 6549718b70f0 - main - nvmfd: Stop setting MAXR2T in association parameters

2024-07-25 Thread John Baldwin
The branch main has been updated by jhb:

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

commit 6549718b70f0e660a15685369afb4f9caf2215ce
Author: John Baldwin 
AuthorDate: 2024-07-25 19:30:52 +
Commit: John Baldwin 
CommitDate: 2024-07-25 19:30:52 +

nvmfd: Stop setting MAXR2T in association parameters

This is only used for the host side of an association.  The controller
obtains this value from the host during connection negotiation.

Sponsored by:   Chelsio Communications
---
 usr.sbin/nvmfd/discovery.c | 1 -
 usr.sbin/nvmfd/io.c| 1 -
 usr.sbin/nvmfd/nvmfd.8 | 7 +++
 3 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/usr.sbin/nvmfd/discovery.c b/usr.sbin/nvmfd/discovery.c
index 985c77620a62..1cee8755c65c 100644
--- a/usr.sbin/nvmfd/discovery.c
+++ b/usr.sbin/nvmfd/discovery.c
@@ -109,7 +109,6 @@ init_discovery(void)
aparams.tcp.pda = 0;
aparams.tcp.header_digests = header_digests;
aparams.tcp.data_digests = data_digests;
-   aparams.tcp.maxr2t = 1;
aparams.tcp.maxh2cdata = 256 * 1024;
discovery_na = nvmf_allocate_association(NVMF_TRTYPE_TCP, true,
&aparams);
diff --git a/usr.sbin/nvmfd/io.c b/usr.sbin/nvmfd/io.c
index be845a8ed784..3c25d1944eb8 100644
--- a/usr.sbin/nvmfd/io.c
+++ b/usr.sbin/nvmfd/io.c
@@ -57,7 +57,6 @@ init_io(const char *subnqn)
aparams.tcp.pda = 0;
aparams.tcp.header_digests = header_digests;
aparams.tcp.data_digests = data_digests;
-   aparams.tcp.maxr2t = 1;
aparams.tcp.maxh2cdata = 256 * 1024;
io_na = nvmf_allocate_association(NVMF_TRTYPE_TCP, true,
&aparams);
diff --git a/usr.sbin/nvmfd/nvmfd.8 b/usr.sbin/nvmfd/nvmfd.8
index 689ac6d4dda1..40b1c0e2ebe0 100644
--- a/usr.sbin/nvmfd/nvmfd.8
+++ b/usr.sbin/nvmfd/nvmfd.8
@@ -3,7 +3,7 @@
 .\"
 .\" Copyright (c) 2024 Chelsio Communications, Inc.
 .\"
-.Dd May 2, 2024
+.Dd July 25, 2024
 .Dt NVMFD 8
 .Os
 .Sh NAME
@@ -120,7 +120,6 @@ The discovery controller and kernel mode functionality of
 should be merged into
 .Xr ctld 8 .
 .Pp
-Additional paramters such as
-.Va MAXR2T ,
-.Va MAXH2CDATA ,
+Additional parameters such as
+.Va MAXH2CDATA
 and queue sizes should be configurable.



git: fd0e6af5e49c - main - libnvmf: Require MAXH2CDATA to be a multiple of 4

2024-07-25 Thread John Baldwin
The branch main has been updated by jhb:

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

commit fd0e6af5e49c3db034f1c45ff3f053f282e758c3
Author: John Baldwin 
AuthorDate: 2024-07-25 19:32:38 +
Commit: John Baldwin 
CommitDate: 2024-07-25 19:32:38 +

libnvmf: Require MAXH2CDATA to be a multiple of 4

The spec says MAXH2CDATA to is "a multiple of dwords and should be no
less than 4,096".

Sponsored by:   Chelsio Communications
---
 lib/libnvmf/nvmf_tcp.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/lib/libnvmf/nvmf_tcp.c b/lib/libnvmf/nvmf_tcp.c
index b9bf8153ab1b..89fc65bf6c43 100644
--- a/lib/libnvmf/nvmf_tcp.c
+++ b/lib/libnvmf/nvmf_tcp.c
@@ -956,6 +956,7 @@ tcp_connect(struct nvmf_tcp_qpair *qp, struct 
nvmf_association *na, bool admin)
struct nvmf_tcp_association *ta = TASSOC(na);
struct nvme_tcp_ic_req ic_req;
struct nvme_tcp_ic_resp ic_resp;
+   uint32_t maxh2cdata;
int error;
 
if (!admin) {
@@ -1007,9 +1008,9 @@ tcp_connect(struct nvmf_tcp_qpair *qp, struct 
nvmf_association *na, bool admin)
 * some large value and report larger values as an unsupported
 * parameter?
 */
-   if (le32toh(ic_resp.maxh2cdata) < 4096) {
-   na_error(na, "Invalid MAXH2CDATA %u",
-   le32toh(ic_resp.maxh2cdata));
+   maxh2cdata = le32toh(ic_resp.maxh2cdata);
+   if (maxh2cdata < 4096 || maxh2cdata % 4 != 0) {
+   na_error(na, "Invalid MAXH2CDATA %u", maxh2cdata);
nvmf_tcp_report_error(na, qp,
NVME_TCP_TERM_REQ_FES_INVALID_HEADER_FIELD, 12, &ic_resp,
sizeof(ic_resp), sizeof(ic_resp));
@@ -1021,7 +1022,7 @@ tcp_connect(struct nvmf_tcp_qpair *qp, struct 
nvmf_association *na, bool admin)
qp->header_digests = ic_resp.dgst.bits.hdgst_enable != 0;
qp->data_digests = ic_resp.dgst.bits.ddgst_enable != 0;
qp->maxr2t = params->tcp.maxr2t;
-   qp->maxh2cdata = le32toh(ic_resp.maxh2cdata);
+   qp->maxh2cdata = maxh2cdata;
if (admin)
/* 7.4.3 */
qp->max_icd = 8192;



git: 846d702f234b - main - libnvmf: Reject invalid values of MAXH2CDATA for new associations

2024-07-25 Thread John Baldwin
The branch main has been updated by jhb:

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

commit 846d702f234b80881dc6641057b623308917b66a
Author: John Baldwin 
AuthorDate: 2024-07-25 19:32:42 +
Commit: John Baldwin 
CommitDate: 2024-07-25 19:32:42 +

libnvmf: Reject invalid values of MAXH2CDATA for new associations

Sponsored by:   Chelsio Communications
---
 lib/libnvmf/nvmf_tcp.c | 11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/lib/libnvmf/nvmf_tcp.c b/lib/libnvmf/nvmf_tcp.c
index 89fc65bf6c43..93948b9b5fd0 100644
--- a/lib/libnvmf/nvmf_tcp.c
+++ b/lib/libnvmf/nvmf_tcp.c
@@ -924,11 +924,18 @@ nvmf_tcp_read_ic_resp(struct nvmf_association *na, struct 
nvmf_tcp_qpair *qp,
 }
 
 static struct nvmf_association *
-tcp_allocate_association(bool controller __unused,
-const struct nvmf_association_params *params __unused)
+tcp_allocate_association(bool controller,
+const struct nvmf_association_params *params)
 {
struct nvmf_tcp_association *ta;
 
+   if (controller) {
+   /* 7.4.10.3 */
+   if (params->tcp.maxh2cdata < 4096 ||
+   params->tcp.maxh2cdata % 4 != 0)
+   return (NULL);
+   }
+
ta = calloc(1, sizeof(*ta));
 
return (&ta->na);



git: 7f73c0489508 - main - nvmfd: Correct usage description

2024-07-25 Thread John Baldwin
The branch main has been updated by jhb:

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

commit 7f73c048950852e6088fa1aaa0a91c41ddcef3a1
Author: John Baldwin 
AuthorDate: 2024-07-25 19:32:44 +
Commit: John Baldwin 
CommitDate: 2024-07-25 19:32:44 +

nvmfd: Correct usage description

During development the command line options for PDU digests for
nvmecontrol(8) and nvmfd(8) were renamed to align with Linux's nvme(1)
command, but the usage description in nvmfd(8) had a mix of the old
and new options.

Sponsored by:   Chelsio Communications
---
 usr.sbin/nvmfd/nvmfd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/usr.sbin/nvmfd/nvmfd.c b/usr.sbin/nvmfd/nvmfd.c
index 6fce21b07b74..cce7a88706d2 100644
--- a/usr.sbin/nvmfd/nvmfd.c
+++ b/usr.sbin/nvmfd/nvmfd.c
@@ -36,8 +36,8 @@ static volatile bool quit = false;
 static void
 usage(void)
 {
-   fprintf(stderr, "nvmfd -K [-FGg] [-P port] [-p port] [-t transport] [-n 
subnqn]\n"
-   "nvmfd [-dDFH] [-P port] [-p port] [-t transport] [-n subnqn]\n"
+   fprintf(stderr, "nvmfd -K [-dFGg] [-P port] [-p port] [-t transport] 
[-n subnqn]\n"
+   "nvmfd [-dFGg] [-P port] [-p port] [-t transport] [-n subnqn]\n"
"\tdevice [device [...]]\n"
"\n"
"Devices use one of the following syntaxes:\n"



git: 399362bac312 - main - nvmfd: Permit setting the MAXH2CDATA value via -H

2024-07-25 Thread John Baldwin
The branch main has been updated by jhb:

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

commit 399362bac312d4fa77a3fd918ea002c0782bc315
Author: John Baldwin 
AuthorDate: 2024-07-25 19:33:15 +
Commit: John Baldwin 
CommitDate: 2024-07-25 19:33:15 +

nvmfd: Permit setting the MAXH2CDATA value via -H

This value is advertised to the remote host for TCP associations and
determines the maximum data payload size the remote host is permitted
to transmit in a single PDU.

Sponsored by:   Chelsio Communications
---
 usr.sbin/nvmfd/discovery.c |  2 +-
 usr.sbin/nvmfd/internal.h  |  1 +
 usr.sbin/nvmfd/io.c|  2 +-
 usr.sbin/nvmfd/nvmfd.8 | 10 --
 usr.sbin/nvmfd/nvmfd.c | 17 ++---
 5 files changed, 25 insertions(+), 7 deletions(-)

diff --git a/usr.sbin/nvmfd/discovery.c b/usr.sbin/nvmfd/discovery.c
index 1cee8755c65c..2cfe56731d7c 100644
--- a/usr.sbin/nvmfd/discovery.c
+++ b/usr.sbin/nvmfd/discovery.c
@@ -109,7 +109,7 @@ init_discovery(void)
aparams.tcp.pda = 0;
aparams.tcp.header_digests = header_digests;
aparams.tcp.data_digests = data_digests;
-   aparams.tcp.maxh2cdata = 256 * 1024;
+   aparams.tcp.maxh2cdata = maxh2cdata;
discovery_na = nvmf_allocate_association(NVMF_TRTYPE_TCP, true,
&aparams);
if (discovery_na == NULL)
diff --git a/usr.sbin/nvmfd/internal.h b/usr.sbin/nvmfd/internal.h
index 5ddbc1cf89f0..f70dc78881c6 100644
--- a/usr.sbin/nvmfd/internal.h
+++ b/usr.sbin/nvmfd/internal.h
@@ -24,6 +24,7 @@ extern bool data_digests;
 extern bool header_digests;
 extern bool flow_control_disable;
 extern bool kernel_io;
+extern uint32_t maxh2cdata;
 
 /* controller.c */
 void   controller_handle_admin_commands(struct controller *c,
diff --git a/usr.sbin/nvmfd/io.c b/usr.sbin/nvmfd/io.c
index 3c25d1944eb8..4407360257a2 100644
--- a/usr.sbin/nvmfd/io.c
+++ b/usr.sbin/nvmfd/io.c
@@ -57,7 +57,7 @@ init_io(const char *subnqn)
aparams.tcp.pda = 0;
aparams.tcp.header_digests = header_digests;
aparams.tcp.data_digests = data_digests;
-   aparams.tcp.maxh2cdata = 256 * 1024;
+   aparams.tcp.maxh2cdata = maxh2cdata;
io_na = nvmf_allocate_association(NVMF_TRTYPE_TCP, true,
&aparams);
if (io_na == NULL)
diff --git a/usr.sbin/nvmfd/nvmfd.8 b/usr.sbin/nvmfd/nvmfd.8
index 40b1c0e2ebe0..1076583c417c 100644
--- a/usr.sbin/nvmfd/nvmfd.8
+++ b/usr.sbin/nvmfd/nvmfd.8
@@ -13,12 +13,14 @@
 .Nm
 .Fl K
 .Op Fl dFGg
+.Op Fl H Ar MAXH2CDATA
 .Op Fl P Ar port
 .Op Fl p Ar port
 .Op Fl t Ar transport
 .Op Fl n Ar subnqn
 .Nm
 .Op Fl dFGg
+.Op Fl H Ar MAXH2CDATA
 .Op Fl P Ar port
 .Op Fl p Ar port
 .Op Fl t Ar transport
@@ -42,6 +44,11 @@ Permit remote hosts to disable SQ flow control.
 Permit remote hosts to enable PDU data digests for the TCP transport.
 .It Fl g
 Permit remote hosts to enable PDU header digests for the TCP transport.
+.It Fl H
+Set the MAXH2CDATA value advertised to the remote host for the TCP transport.
+This value is in bytes and determines the maximum data payload size for
+data PDUs sent by the remote host.
+The value must be at least 4096 and defaults to 256KiB.
 .It Fl K
 Enable kernel mode which hands off incoming I/O controller connections to
 .Xr nvmft 4 .
@@ -121,5 +128,4 @@ should be merged into
 .Xr ctld 8 .
 .Pp
 Additional parameters such as
-.Va MAXH2CDATA
-and queue sizes should be configurable.
+queue sizes should be configurable.
diff --git a/usr.sbin/nvmfd/nvmfd.c b/usr.sbin/nvmfd/nvmfd.c
index cce7a88706d2..df6f400b40e5 100644
--- a/usr.sbin/nvmfd/nvmfd.c
+++ b/usr.sbin/nvmfd/nvmfd.c
@@ -18,6 +18,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -29,6 +30,7 @@ bool data_digests = false;
 bool header_digests = false;
 bool flow_control_disable = false;
 bool kernel_io = false;
+uint32_t maxh2cdata = 256 * 1024;
 
 static const char *subnqn;
 static volatile bool quit = false;
@@ -36,8 +38,8 @@ static volatile bool quit = false;
 static void
 usage(void)
 {
-   fprintf(stderr, "nvmfd -K [-dFGg] [-P port] [-p port] [-t transport] 
[-n subnqn]\n"
-   "nvmfd [-dFGg] [-P port] [-p port] [-t transport] [-n subnqn]\n"
+   fprintf(stderr, "nvmfd -K [-dFGg] [-H MAXH2CDATA] [-P port] [-p port] 
[-t transport] [-n subnqn]\n"
+   "nvmfd [-dFGg] [-H MAXH2CDATA] [-P port] [-p port] [-t transport] 
[-n subnqn]\n"
"\tdevice [device [...]]\n"
"\n"
"Devices use one of the following syntaxes:\n"
@@ -150,6 +152,7 @@ main(int ac, char **av)
struct pidfh *pfh;
const char *dport, *ioport, *transport;
pid_t pid;
+   uint64_t value;
int ch, error, kqfd;
bool daemonize;
static char nqn[NVMF_NQN_MAX_LEN];
@@ -162,7 +165,7 @@ main(int ac, char **av)
ioport = &quo

Re: git: 801c452795ac - main - man9: Really complete the removal of MD5.9

2024-07-29 Thread John Baldwin

On 7/29/24 13:40, Warner Losh wrote:

On Mon, Jul 29, 2024 at 10:39 AM Mark Johnston  wrote:


On Mon, Jul 29, 2024 at 11:31:19PM +0700, Yuri Pankov wrote:

Mark Johnston wrote:

The branch main has been updated by markj:

URL:

https://cgit.FreeBSD.org/src/commit/?id=801c452795ac441523655eb3277051b7b034becf


commit 801c452795ac441523655eb3277051b7b034becf
Author: Mark Johnston 
AuthorDate: 2024-07-29 14:12:40 +
Commit: Mark Johnston 
CommitDate: 2024-07-29 14:17:04 +

 man9: Really complete the removal of MD5.9

 Fixes:  46b0db2dbe9f ("Remove unnecessary and now inaccurate

kernel side manual page.")

 Fixes:  36d68cb2ddd2 ("Complete the removal of the MD5 manual page

from section 9.")

---
  ObsoleteFiles.inc   | 2 ++
  share/man/man9/Makefile | 2 --
  2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc
index b21778466800..01b4824e8692 100644
--- a/ObsoleteFiles.inc
+++ b/ObsoleteFiles.inc
@@ -56,6 +56,8 @@ OLD_FILES+=usr/share/man/man9/ifaddr_byindex.9.gz

  # 20240729: remove MD5(9)
  OLD_FILES+=usr/share/man/man9/MD5.9.gz
+OLD_FILES+=usr/share/man/man9/MD5Init.9
+OLD_FILES+=usr/share/man/man9/MD5Transform.9


This really needs to be smarter, but you have to specify .gz suffix for
man entries as we have compression enabled by default.


Sigh, who knew it was so difficult to remove a man page.



There is a pull request being worked on that will be smarter about what's
removed since we have compress (UFS) and uncompress (ZFS) setups
now.


Does it just add an OLD_MAN helper variable to use instead of OLD_FILES
and then try the various extension combinations for each OLD_MAN?

--
John Baldwin




git: 0244e0a177a6 - main - openssl: Add include for getrandom()

2024-07-29 Thread John Baldwin
The branch main has been updated by jhb:

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

commit 0244e0a177a68fc8ff7e8a58fa7a9553956232ec
Author: John Baldwin 
AuthorDate: 2024-07-29 20:38:49 +
Commit: John Baldwin 
CommitDate: 2024-07-29 20:38:49 +

openssl: Add  include for getrandom()

GCC 14 (but not earlier versions) warns about a missing prototype
for getrandom().  Include  explicitly to bring in the
prototype rather than depending on a nested include.  While here,
stop defining sysctl_random() since it is no longer used.

Reviewed by:brooks
Fixes:  838b6caababb openssl: use getrandom(2) instead of probing 
for getentropy(2)
Differential Revision:  https://reviews.freebsd.org/D45995
---
 crypto/openssl/providers/implementations/rands/seeding/rand_unix.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/crypto/openssl/providers/implementations/rands/seeding/rand_unix.c 
b/crypto/openssl/providers/implementations/rands/seeding/rand_unix.c
index eadacedbe40c..f8e73a02daf4 100644
--- a/crypto/openssl/providers/implementations/rands/seeding/rand_unix.c
+++ b/crypto/openssl/providers/implementations/rands/seeding/rand_unix.c
@@ -28,7 +28,7 @@
 #  include 
 # endif
 #endif
-#if (defined(__FreeBSD__) || defined(__NetBSD__)) && !defined(OPENSSL_SYS_UEFI)
+#if defined(__NetBSD__)
 # include 
 # include 
 # include 
@@ -36,7 +36,8 @@
 #if defined(__OpenBSD__)
 # include 
 #endif
-#if defined(__DragonFly__)
+#if (defined(__DragonFly__) || defined(__FreeBSD__)) \
+ && !defined(OPENSSL_SYS_UEFI)
 # include 
 # include 
 #endif
@@ -212,7 +213,7 @@ void ossl_rand_pool_keep_random_devices_open(int keep)
 #   error "librandom not (yet) supported"
 #  endif
 
-#  if (defined(__FreeBSD__) || defined(__NetBSD__)) && defined(KERN_ARND)
+#  if defined(__NetBSD__) && defined(KERN_ARND)
 /*
  * sysctl_random(): Use sysctl() to read a random number from the kernel
  * Returns the number of bytes returned in buf on success, -1 on failure.



Re: git: 801c452795ac - main - man9: Really complete the removal of MD5.9

2024-07-30 Thread John Baldwin

On 7/29/24 15:18, Warner Losh wrote:

Hey John,

On Mon, Jul 29, 2024 at 11:55 AM John Baldwin  wrote:


On 7/29/24 13:40, Warner Losh wrote:

On Mon, Jul 29, 2024 at 10:39 AM Mark Johnston 

wrote:



On Mon, Jul 29, 2024 at 11:31:19PM +0700, Yuri Pankov wrote:

Mark Johnston wrote:

The branch main has been updated by markj:

URL:



https://cgit.FreeBSD.org/src/commit/?id=801c452795ac441523655eb3277051b7b034becf


commit 801c452795ac441523655eb3277051b7b034becf
Author: Mark Johnston 
AuthorDate: 2024-07-29 14:12:40 +
Commit: Mark Johnston 
CommitDate: 2024-07-29 14:17:04 +

  man9: Really complete the removal of MD5.9

  Fixes:  46b0db2dbe9f ("Remove unnecessary and now inaccurate

kernel side manual page.")

  Fixes:  36d68cb2ddd2 ("Complete the removal of the MD5 manual

page

from section 9.")

---
   ObsoleteFiles.inc   | 2 ++
   share/man/man9/Makefile | 2 --
   2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc
index b21778466800..01b4824e8692 100644
--- a/ObsoleteFiles.inc
+++ b/ObsoleteFiles.inc
@@ -56,6 +56,8 @@ OLD_FILES+=usr/share/man/man9/ifaddr_byindex.9.gz

   # 20240729: remove MD5(9)
   OLD_FILES+=usr/share/man/man9/MD5.9.gz
+OLD_FILES+=usr/share/man/man9/MD5Init.9
+OLD_FILES+=usr/share/man/man9/MD5Transform.9


This really needs to be smarter, but you have to specify .gz suffix for
man entries as we have compression enabled by default.


Sigh, who knew it was so difficult to remove a man page.



There is a pull request being worked on that will be smarter about what's
removed since we have compress (UFS) and uncompress (ZFS) setups
now.


Does it just add an OLD_MAN helper variable to use instead of OLD_FILES
and then try the various extension combinations for each OLD_MAN?



https://github.com/freebsd/freebsd-src/pull/1295

was submitted a bit ago. the repetition is why I've not committed it. Is an
approach
like that good, or should we move all the old man pages to OLD_MAN?


This is solving a different problem.  This is dealing with removing duplicate
copies e.g. when switching from WITH_MANCOMPRESS=yes to WITHOUT_MANCOMPRESS=yes.

OLD_MAN would be orthogonal.  It would be similar to how we use extra logic
for OLD_LIBS where we look for debug symbols in /usr/lib/debug to remove along
with the library.  For OLD_MAN we would try to remove both $f and $f.gz.

--
John Baldwin




Re: git: 801c452795ac - main - man9: Really complete the removal of MD5.9

2024-07-30 Thread John Baldwin

On 7/30/24 10:00, Jessica Clarke wrote:

On 30 Jul 2024, at 14:52, John Baldwin  wrote:


On 7/29/24 15:18, Warner Losh wrote:

Hey John,
On Mon, Jul 29, 2024 at 11:55 AM John Baldwin  wrote:

On 7/29/24 13:40, Warner Losh wrote:

On Mon, Jul 29, 2024 at 10:39 AM Mark Johnston 

wrote:



On Mon, Jul 29, 2024 at 11:31:19PM +0700, Yuri Pankov wrote:

Mark Johnston wrote:

The branch main has been updated by markj:

URL:



https://cgit.FreeBSD.org/src/commit/?id=801c452795ac441523655eb3277051b7b034becf


commit 801c452795ac441523655eb3277051b7b034becf
Author: Mark Johnston 
AuthorDate: 2024-07-29 14:12:40 +
Commit: Mark Johnston 
CommitDate: 2024-07-29 14:17:04 +

  man9: Really complete the removal of MD5.9

  Fixes:  46b0db2dbe9f ("Remove unnecessary and now inaccurate

kernel side manual page.")

  Fixes:  36d68cb2ddd2 ("Complete the removal of the MD5 manual

page

from section 9.")

---
   ObsoleteFiles.inc   | 2 ++
   share/man/man9/Makefile | 2 --
   2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc
index b21778466800..01b4824e8692 100644
--- a/ObsoleteFiles.inc
+++ b/ObsoleteFiles.inc
@@ -56,6 +56,8 @@ OLD_FILES+=usr/share/man/man9/ifaddr_byindex.9.gz

   # 20240729: remove MD5(9)
   OLD_FILES+=usr/share/man/man9/MD5.9.gz
+OLD_FILES+=usr/share/man/man9/MD5Init.9
+OLD_FILES+=usr/share/man/man9/MD5Transform.9


This really needs to be smarter, but you have to specify .gz suffix for
man entries as we have compression enabled by default.


Sigh, who knew it was so difficult to remove a man page.



There is a pull request being worked on that will be smarter about what's
removed since we have compress (UFS) and uncompress (ZFS) setups
now.


Does it just add an OLD_MAN helper variable to use instead of OLD_FILES
and then try the various extension combinations for each OLD_MAN?


https://github.com/freebsd/freebsd-src/pull/1295
was submitted a bit ago. the repetition is why I've not committed it. Is an
approach
like that good, or should we move all the old man pages to OLD_MAN?


This is solving a different problem.  This is dealing with removing duplicate
copies e.g. when switching from WITH_MANCOMPRESS=yes to WITHOUT_MANCOMPRESS=yes.

OLD_MAN would be orthogonal.  It would be similar to how we use extra logic
for OLD_LIBS where we look for debug symbols in /usr/lib/debug to remove along
with the library.  For OLD_MAN we would try to remove both $f and $f.gz.


list-old-files already has:

 -V "OLD_FILES:ts\n" -V "OLD_FILES:Musr/share/*.gz:R:ts\n”

So as long as you list the manpages with a .gz suffix it’ll already
handle the uncompressed version.


Ah, ok.  Perhaps part of the goal of OLD_MAN would be to avoid the need to
include the .gz suffix since it gets forgotten periodically, but that would
be the only goal given the above snippet.

--
John Baldwin




git: a14de491e031 - main - nvmf_tcp: Use min() to simplify a few statements

2024-07-30 Thread John Baldwin
The branch main has been updated by jhb:

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

commit a14de491e031338c6b939e31c423078b36b8c2f3
Author: John Baldwin 
AuthorDate: 2024-07-30 14:26:14 +
Commit: John Baldwin 
CommitDate: 2024-07-30 14:26:14 +

nvmf_tcp: Use min() to simplify a few statements

Sponsored by:   Chelsio Communications
---
 sys/dev/nvmf/nvmf_tcp.c | 12 +++-
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/sys/dev/nvmf/nvmf_tcp.c b/sys/dev/nvmf/nvmf_tcp.c
index 8f1b3bf01e39..6c84a40611c3 100644
--- a/sys/dev/nvmf/nvmf_tcp.c
+++ b/sys/dev/nvmf/nvmf_tcp.c
@@ -623,10 +623,7 @@ mbuf_copyto_io(struct mbuf *m, u_int skip, u_int len,
while (len != 0) {
MPASS((m->m_flags & M_EXTPG) == 0);
 
-   todo = m->m_len - skip;
-   if (todo > len)
-   todo = len;
-
+   todo = min(m->m_len - skip, len);
memdesc_copyback(&io->io_mem, io_offset, todo, mtodo(m, skip));
skip = 0;
io_offset += todo;
@@ -1000,9 +997,7 @@ nvmf_tcp_handle_r2t(struct nvmf_tcp_qpair *qp, struct 
nvmf_tcp_rxpdu *pdu)
struct mbuf *m;
uint32_t sent, todo;
 
-   todo = data_len;
-   if (todo > qp->max_tx_data)
-   todo = qp->max_tx_data;
+   todo = min(data_len, qp->max_tx_data);
m = nvmf_tcp_command_buffer_mbuf(cb, data_offset, todo, &sent,
todo < data_len);
tcp_send_h2c_pdu(qp, r2t->cccid, r2t->ttag, data_offset, m,
@@ -1458,8 +1453,7 @@ tcp_allocate_qpair(bool controller,
qp->maxh2cdata = params->tcp.maxh2cdata;
qp->max_tx_data = tcp_max_transmit_data;
if (!controller) {
-   if (qp->max_tx_data > params->tcp.maxh2cdata)
-   qp->max_tx_data = params->tcp.maxh2cdata;
+   qp->max_tx_data = min(qp->max_tx_data, params->tcp.maxh2cdata);
}
qp->max_icd = params->tcp.max_icd;
 



git: 6df040ea6e4a - main - nvmf_tcp: Avoid setting some unused parameters in tcp_allocate_qpair

2024-07-30 Thread John Baldwin
The branch main has been updated by jhb:

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

commit 6df040ea6e4a533d4010b810c8aa74a3c3979d9a
Author: John Baldwin 
AuthorDate: 2024-07-30 14:27:47 +
Commit: John Baldwin 
CommitDate: 2024-07-30 14:27:47 +

nvmf_tcp: Avoid setting some unused parameters in tcp_allocate_qpair

Specifically, some parameters only apply to either controller or host
queue pairs but not both.

Sponsored by:   Chelsio Communications
---
 sys/dev/nvmf/nvmf_tcp.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/sys/dev/nvmf/nvmf_tcp.c b/sys/dev/nvmf/nvmf_tcp.c
index 6c84a40611c3..80c75e02c9b5 100644
--- a/sys/dev/nvmf/nvmf_tcp.c
+++ b/sys/dev/nvmf/nvmf_tcp.c
@@ -1450,12 +1450,13 @@ tcp_allocate_qpair(bool controller,
qp->header_digests = params->tcp.header_digests;
qp->data_digests = params->tcp.data_digests;
qp->maxr2t = params->tcp.maxr2t;
-   qp->maxh2cdata = params->tcp.maxh2cdata;
+   if (controller)
+   qp->maxh2cdata = params->tcp.maxh2cdata;
qp->max_tx_data = tcp_max_transmit_data;
if (!controller) {
qp->max_tx_data = min(qp->max_tx_data, params->tcp.maxh2cdata);
+   qp->max_icd = params->tcp.max_icd;
}
-   qp->max_icd = params->tcp.max_icd;
 
if (controller) {
/* Use the SUCCESS flag if SQ flow control is disabled. */



git: 8ebacb9daa9e - main - nvmf_tcp: Correct calculation of number of TTAGs to allocate

2024-07-30 Thread John Baldwin
The branch main has been updated by jhb:

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

commit 8ebacb9daa9ee3f3b6beed56477024009b84edc1
Author: John Baldwin 
AuthorDate: 2024-07-30 14:28:54 +
Commit: John Baldwin 
CommitDate: 2024-07-30 14:28:54 +

nvmf_tcp: Correct calculation of number of TTAGs to allocate

The increment of 1 was intended to convert qp->maxr2t from 0's based
to 1 based before multiplying by the queue length.

Sponsored by:   Chelsio Communications
---
 sys/dev/nvmf/nvmf_tcp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/dev/nvmf/nvmf_tcp.c b/sys/dev/nvmf/nvmf_tcp.c
index 135c9968d8eb..67d239b63faf 100644
--- a/sys/dev/nvmf/nvmf_tcp.c
+++ b/sys/dev/nvmf/nvmf_tcp.c
@@ -1464,7 +1464,7 @@ tcp_allocate_qpair(bool controller,
 
/* NB: maxr2t is 0's based. */
qp->num_ttags = MIN((u_int)UINT16_MAX + 1,
-   (uint64_t)params->qsize * (uint64_t)qp->maxr2t + 1);
+   (uint64_t)params->qsize * ((uint64_t)qp->maxr2t + 1));
qp->open_ttags = mallocarray(qp->num_ttags,
sizeof(*qp->open_ttags), M_NVMF_TCP, M_WAITOK | M_ZERO);
}



git: 19c15e41c6cd - main - nvmf_tcp: Update R2T accounting stats when aborting command buffers

2024-07-30 Thread John Baldwin
The branch main has been updated by jhb:

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

commit 19c15e41c6cdf7bb5abd89ff0ebd11c620409256
Author: John Baldwin 
AuthorDate: 2024-07-30 14:28:19 +
Commit: John Baldwin 
CommitDate: 2024-07-30 14:28:19 +

nvmf_tcp: Update R2T accounting stats when aborting command buffers

If a queue pair is destroyed (e.g. due to the TCP connection dropping)
while a host to controller data transfer is in progress, the
pending_r2ts counter can be non-zero.  This can later trigger an
assertion failure when the capsule is freed.  To fix, update the
relevant R2T accounting stats when aborting active command buffers
during queue pair destruction.

Sponsored by:   Chelsio Communications
---
 sys/dev/nvmf/nvmf_tcp.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/sys/dev/nvmf/nvmf_tcp.c b/sys/dev/nvmf/nvmf_tcp.c
index 80c75e02c9b5..135c9968d8eb 100644
--- a/sys/dev/nvmf/nvmf_tcp.c
+++ b/sys/dev/nvmf/nvmf_tcp.c
@@ -1553,6 +1553,7 @@ tcp_free_qpair(struct nvmf_qpair *nq)
for (u_int i = 0; i < qp->num_ttags; i++) {
cb = qp->open_ttags[i];
if (cb != NULL) {
+   cb->tc->active_r2ts--;
cb->error = ECONNABORTED;
tcp_release_command_buffer(cb);
}
@@ -1564,6 +1565,10 @@ tcp_free_qpair(struct nvmf_qpair *nq)
TAILQ_FOREACH_SAFE(cb, &qp->rx_buffers.head, link, ncb) {
tcp_remove_command_buffer(&qp->rx_buffers, cb);
mtx_unlock(&qp->rx_buffers.lock);
+#ifdef INVARIANTS
+   if (cb->tc != NULL)
+   cb->tc->pending_r2ts--;
+#endif
cb->error = ECONNABORTED;
tcp_release_command_buffer(cb);
mtx_lock(&qp->rx_buffers.lock);



git: f44ff2aba2d6 - main - bhyve: Treat the COMMAND register for PCI passthru devices as emulated

2024-07-31 Thread John Baldwin
The branch main has been updated by jhb:

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

commit f44ff2aba2d64d1d9312cb55008dc90275ccdc04
Author: John Baldwin 
AuthorDate: 2024-07-31 14:50:33 +
Commit: John Baldwin 
CommitDate: 2024-07-31 14:50:33 +

bhyve: Treat the COMMAND register for PCI passthru devices as emulated

Don't pass through writes of the command register through to the
physical device.  These registers do not need to be in sync, and in
some cases (e.g. when the guest is sizing the BAR and temporarily
disables decoding), the states need to diverge.

PR: 205549
Reviewed by:corvink
Sponsored by:   Chelsio Communications
Differential Revision:  https://reviews.freebsd.org/D46179
---
 usr.sbin/bhyve/pci_passthru.c | 46 +++
 1 file changed, 20 insertions(+), 26 deletions(-)

diff --git a/usr.sbin/bhyve/pci_passthru.c b/usr.sbin/bhyve/pci_passthru.c
index 13d422eaa59c..b8ac782bd7be 100644
--- a/usr.sbin/bhyve/pci_passthru.c
+++ b/usr.sbin/bhyve/pci_passthru.c
@@ -607,6 +607,7 @@ cfginit(struct pci_devinst *pi, int bus, int slot, int func)
 {
int error;
struct passthru_softc *sc;
+   uint16_t cmd;
uint8_t intline, intpin;
 
error = 1;
@@ -618,16 +619,18 @@ cfginit(struct pci_devinst *pi, int bus, int slot, int 
func)
sc->psc_sel.pc_func = func;
 
/*
-* Copy physical PCI header to virtual config space. INTLINE and INTPIN
-* shouldn't be aligned with their physical value and they are already 
set by
-* pci_emul_init().
+* Copy physical PCI header to virtual config space.  COMMAND,
+* INTLINE, and INTPIN shouldn't be aligned with their
+* physical value and they are already set by pci_emul_init().
 */
+   cmd = pci_get_cfgdata16(pi, PCIR_COMMAND);
intline = pci_get_cfgdata8(pi, PCIR_INTLINE);
intpin = pci_get_cfgdata8(pi, PCIR_INTPIN);
for (int i = 0; i <= PCIR_MAXLAT; i += 4) {
pci_set_cfgdata32(pi, i,
pci_host_read_config(&sc->psc_sel, i, 4));
}
+   pci_set_cfgdata16(pi, PCIR_COMMAND, cmd);
pci_set_cfgdata8(pi, PCIR_INTLINE, intline);
pci_set_cfgdata8(pi, PCIR_INTPIN, intpin);
 
@@ -643,13 +646,6 @@ cfginit(struct pci_devinst *pi, int bus, int slot, int 
func)
goto done;
}
 
-   pci_host_write_config(&sc->psc_sel, PCIR_COMMAND, 2,
-   pci_get_cfgdata16(pi, PCIR_COMMAND));
-
-   /*
-* We need to do this after PCIR_COMMAND got possibly updated, e.g.,
-* a BAR was enabled, as otherwise the PCIOCBARMMAP might fail on us.
-*/
if (pci_msix_table_bar(pi) >= 0) {
error = init_msix_table(sc);
if (error != 0) {
@@ -919,7 +915,7 @@ passthru_init(struct pci_devinst *pi, nvlist_t *nvl)
passthru_cfgread_emulate, passthru_cfgwrite_emulate)) != 0)
goto done;
 
-   /* Allow access to the physical command and status register. */
+   /* Allow access to the physical status register. */
if ((error = set_pcir_handler(sc, PCIR_COMMAND, 0x04, NULL, NULL)) != 0)
goto done;
 
@@ -1073,28 +1069,26 @@ passthru_cfgwrite_default(struct passthru_softc *sc, 
struct pci_devinst *pi,
return (0);
}
 
-#ifdef LEGACY_SUPPORT
/*
-* If this device does not support MSI natively then we cannot let
-* the guest disable legacy interrupts from the device. It is the
-* legacy interrupt that is triggering the virtual MSI to the guest.
+* The command register is emulated, but the status register
+* is passed through.
 */
-   if (sc->psc_msi.emulated && pci_msi_enabled(pi)) {
-   if (coff == PCIR_COMMAND && bytes == 2)
-   val &= ~PCIM_CMD_INTxDIS;
-   }
-#endif
-
-   pci_host_write_config(&sc->psc_sel, coff, bytes, val);
if (coff == PCIR_COMMAND) {
+   if (bytes <= 2)
+   return (-1);
+
+   /* Update the physical status register. */
+   pci_host_write_config(&sc->psc_sel, PCIR_STATUS, val >> 16, 2);
+
+   /* Update the virtual command register. */
cmd_old = pci_get_cfgdata16(pi, PCIR_COMMAND);
-   if (bytes == 1)
-   pci_set_cfgdata8(pi, PCIR_COMMAND, val);
-   else if (bytes == 2)
-   pci_set_cfgdata16(pi, PCIR_COMMAND, val);
+   pci_set_cfgdata16(pi, PCIR_COMMAND, val & 0x);
pci_emul_cmd_changed(pi, cmd_old);
+   return (0);
}
 
+   pci_host_write_config(&sc->psc_sel, coff, bytes, val);
+
return (0);
 }
 



git: b313bf154a5a - main - ObsoleteFiles.inc: Remove /rescue/gbde

2024-07-31 Thread John Baldwin
The branch main has been updated by jhb:

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

commit b313bf154a5afe5b07da7dd3d5c2efc87348a737
Author: John Baldwin 
AuthorDate: 2024-07-31 16:11:04 +
Commit: John Baldwin 
CommitDate: 2024-07-31 19:25:27 +

ObsoleteFiles.inc: Remove /rescue/gbde

Reported by:Mark Millard 
Fixes:  6ac1f02be34a Add GBDE to ObsoleteFiles.inc
---
 ObsoleteFiles.inc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc
index 3ca9d410cb29..79d0f315b17b 100644
--- a/ObsoleteFiles.inc
+++ b/ObsoleteFiles.inc
@@ -101,6 +101,7 @@ OLD_DIRS+=var/db/portsnap
 # 20240507: remove gbde
 OLD_FILES+=boot/kernel/geom_bde.ko
 OLD_FILES+=etc/rc.d/gbde
+OLD_FILES+=rescue/gbde
 OLD_FILES+=sbin/gbde
 OLD_FILES+=usr/share/man/man4/gbde.4.gz
 OLD_FILES+=usr/share/man/man8/gbde.8.gz



git: 66158bda905e - main - ObsoleteFiles.inc: Remove CAM.4 MLINK

2024-07-31 Thread John Baldwin
The branch main has been updated by jhb:

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

commit 66158bda905eea447d2f8beef92556c090c41dbb
Author: John Baldwin 
AuthorDate: 2024-07-31 16:12:25 +
Commit: John Baldwin 
CommitDate: 2024-07-31 19:25:40 +

ObsoleteFiles.inc: Remove CAM.4 MLINK

Reported by:Mark Millard 
Fixes:  a00f9e4e8181 scsi: Stop installing both cam.4 and CAM.4
---
 ObsoleteFiles.inc | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc
index 79d0f315b17b..eeea036390d0 100644
--- a/ObsoleteFiles.inc
+++ b/ObsoleteFiles.inc
@@ -562,6 +562,9 @@ OLD_FILES+=usr/include/c++/v1/setjmp.h
 # 20240321: remove empty /usr/libdata/gcc directory
 OLD_DIRS+=usr/libdata/gcc
 
+# 20240315: stop installing CAM.4 link to scsi.4
+OLD_FILES+=usr/share/man/man4/CAM.4.gz
+
 # 20240307: Improperly installed awk tests removed
 OLD_FILES+=usr/tests/usr.bin/awk/bugs-fixed/missing-precision.ok
 OLD_FILES+=usr/tests/usr.bin/awk/bugs-fixed/negative-nf.ok



git: 20cd6bbc1048 - main - ObsoleteFiles.inc: Remove dtrace/amd64/kinst test directory

2024-07-31 Thread John Baldwin
The branch main has been updated by jhb:

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

commit 20cd6bbc1048d985ac75667c23fcae5f5fe98001
Author: John Baldwin 
AuthorDate: 2024-07-31 18:36:41 +
Commit: John Baldwin 
CommitDate: 2024-07-31 19:25:47 +

ObsoleteFiles.inc: Remove dtrace/amd64/kinst test directory

Reported by:Mark Millard 
Fixes:  911f0260390e dtrace: move kinst tests to common
---
 ObsoleteFiles.inc | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc
index eeea036390d0..5a05bae7f4d2 100644
--- a/ObsoleteFiles.inc
+++ b/ObsoleteFiles.inc
@@ -1086,6 +1086,9 @@ OLD_FILES+=usr/include/machine/swi.h
 # 20230714: gsignal
 OLD_FILES+=usr/share/man/man9/gsignal.9.gz
 
+# 20230704: kinst dtrace tests moved to common
+OLD_DIRS+=usr/tests/cddl/usr.sbin/dtrace/amd64/kinst
+
 # 20230626: Only install sys/dev/nvme/nvme.h to /usr/include
 OLD_FILES+=usr/include/dev/nvme/nvme_private.h
 



git: c04ef1bfb461 - main - ObsoleteFiles.inc: Add missing .gz suffix to various manpage entries

2024-07-31 Thread John Baldwin
The branch main has been updated by jhb:

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

commit c04ef1bfb461a1c8d426b16532d85af5637727c9
Author: John Baldwin 
AuthorDate: 2024-07-31 18:48:24 +
Commit: John Baldwin 
CommitDate: 2024-07-31 19:25:51 +

ObsoleteFiles.inc: Add missing .gz suffix to various manpage entries

Reported by:Mark Millard 
---
 ObsoleteFiles.inc | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc
index 5a05bae7f4d2..01e612bfaf66 100644
--- a/ObsoleteFiles.inc
+++ b/ObsoleteFiles.inc
@@ -581,7 +581,7 @@ 
OLD_FILES+=usr/share/certs/trusted/Security_Communication_Root_CA.pem
 OLD_FILES+=usr/share/man/man9/callout_async_drain.9.gz
 
 # 20240114: Removal of geom_map(4)
-OLD_FILES+=usr/share/man/man4/geom_map.4
+OLD_FILES+=usr/share/man/man4/geom_map.4.gz
 
 # 20240112: remove pmap_init2()
 OLD_FILES+=usr/share/man/man9/pmap_init2.9.gz
@@ -1060,9 +1060,9 @@ 
OLD_FILES+=usr/tests/lib/googletest/gmock_main/gmock-matchers_test
 OLD_FILES+=usr/tests/lib/googletest/gtest_main/googletest-linked-ptr-test
 
 # 20230807: Removal of the ath(4) AHB bus-frontend for MIPS
-OLD_FILES+=usr/share/man/man4/ath_ahb.4
-OLD_FILES+=usr/share/man/man4/ath_pci.4
-OLD_FILES+=usr/share/man/man4/if_ath_pci.4
+OLD_FILES+=usr/share/man/man4/ath_ahb.4.gz
+OLD_FILES+=usr/share/man/man4/ath_pci.4.gz
+OLD_FILES+=usr/share/man/man4/if_ath_pci.4.gz
 
 # 20230803: Removal of support for cloning pseudo interfaces from iflib(9)
 OLD_FILES+=usr/include/net/iflib_private.h
@@ -2096,8 +2096,8 @@ OLD_FILES+=usr/include/netinet/tcp_debug.h
 
 # 20221213: remove sync serial drivers and utilities
 OLD_FILES+=sbin/sconfig
-OLD_FILES+=usr/share/man/man4/ce.4
-OLD_FILES+=usr/share/man/man4/cp.4
+OLD_FILES+=usr/share/man/man4/ce.4.gz
+OLD_FILES+=usr/share/man/man4/cp.4.gz
 OLD_FILES+=usr/share/man/man8/sconfig.8.gz
 
 # 20221202: remove trpt(8)
@@ -12541,8 +12541,8 @@ OLD_DIRS+=usr/lib/clang/3.9.1/lib
 OLD_DIRS+=usr/lib/clang/3.9.1
 # 20170226: SVR4 compatibility removed
 .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386"
-OLD_FILES+=usr/share/man/man4/streams.4
-OLD_FILES+=usr/share/man/man4/svr4.4
+OLD_FILES+=usr/share/man/man4/streams.4.gz
+OLD_FILES+=usr/share/man/man4/svr4.4.gz
 .endif
 # 20170219: OpenPAM RADULA upgrade removed the libpam tests
 OLD_FILES+=usr/tests/lib/libpam/Kyuafile



git: a4b248b883cc - main - ObsoleteFiles.inc: Remove usr/share/examples/IPv6

2024-07-31 Thread John Baldwin
The branch main has been updated by jhb:

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

commit a4b248b883cc2ade1a394a21ad108b851b4d454c
Author: John Baldwin 
AuthorDate: 2024-07-31 19:00:11 +
Commit: John Baldwin 
CommitDate: 2024-07-31 19:25:55 +

ObsoleteFiles.inc: Remove usr/share/examples/IPv6

Reported by:Mark Millard 
Fixes:  4339f1e667ff share/examples/IPv6/USAGE: remove
---
 ObsoleteFiles.inc  | 4 
 etc/mtree/BSD.usr.dist | 2 --
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc
index 01e612bfaf66..d1851d2d5d33 100644
--- a/ObsoleteFiles.inc
+++ b/ObsoleteFiles.inc
@@ -577,6 +577,10 @@ 
OLD_FILES+=usr/tests/usr.bin/awk/bugs-fixed/system-status.ok2
 # 20240211: caroot bundle updated
 OLD_FILES+=usr/share/certs/trusted/Security_Communication_Root_CA.pem
 
+# 20240202: remove obsolete share/examples/IPv6/USAGE
+OLD_FILES+=usr/share/examples/IPv6/USAGE
+OLD_DIRS+=usr/share/examples/IPv6
+
 # 20240122: callout_async_drain() removed
 OLD_FILES+=usr/share/man/man9/callout_async_drain.9.gz
 
diff --git a/etc/mtree/BSD.usr.dist b/etc/mtree/BSD.usr.dist
index 193184c3a134..13541aac1dd4 100644
--- a/etc/mtree/BSD.usr.dist
+++ b/etc/mtree/BSD.usr.dist
@@ -254,8 +254,6 @@
 ..
 FreeBSD_version
 ..
-IPv6
-..
 bhyve
 ..
 bootforth



git: 09ed116dc5b8 - main - ObsoleteFiles.inc: Don't remove recently added mixer(8) tests

2024-07-31 Thread John Baldwin
The branch main has been updated by jhb:

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

commit 09ed116dc5b84e6b3478b42e5b1076604e92f676
Author: John Baldwin 
AuthorDate: 2024-07-31 19:09:19 +
Commit: John Baldwin 
CommitDate: 2024-07-31 19:26:00 +

ObsoleteFiles.inc: Don't remove recently added mixer(8) tests

An earlier set of mixer(8) tests were removed leading to this entry,
but now the entry is removing the new tests.

Fixes:  94a86f3f6920 mixer(8): Add tests
---
 ObsoleteFiles.inc | 5 -
 1 file changed, 5 deletions(-)

diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc
index d1851d2d5d33..f6984b49711c 100644
--- a/ObsoleteFiles.inc
+++ b/ObsoleteFiles.inc
@@ -3737,11 +3737,6 @@ OLD_FILES+=usr/share/man/man4/ng_h4.4.gz
 # 20210923: rename boot(9) to kern_reboot(9)
 OLD_FILES+=usr/share/man/man9/boot.9.gz
 
-# 20210922: Old mixer(8) tests removed
-OLD_FILES+=usr/tests/usr.sbin/mixer/Kyuafile
-OLD_FILES+=usr/tests/usr.sbin/mixer/mixer_test
-OLD_DIRS+=usr/tests/usr.sbin/mixer
-
 # 20210921: remove cloudabi
 OLD_FILES+=usr/share/man/man4/cloudabi.4.gz
 OLD_FILES+=usr/share/man/man4/cloudabi32.4.gz



Re: git: c04ef1bfb461 - main - ObsoleteFiles.inc: Add missing .gz suffix to various manpage entries

2024-07-31 Thread John Baldwin

On 7/31/24 15:26, John Baldwin wrote:

The branch main has been updated by jhb:

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

commit c04ef1bfb461a1c8d426b16532d85af5637727c9
Author: John Baldwin 
AuthorDate: 2024-07-31 18:48:24 +
Commit: John Baldwin 
CommitDate: 2024-07-31 19:25:51 +

 ObsoleteFiles.inc: Add missing .gz suffix to various manpage entries
 
 Reported by:Mark Millard 


There are a bunch of entries without .gz for OpenSSL manpages, but they seem to
be dubious (e.g. in /usr/share/man instead of /usr/share/openssl/man, or
removing list.1.gz for openssl-list that still seems valid).

--
John Baldwin




Re: git: 66158bda905e - main - ObsoleteFiles.inc: Remove CAM.4 MLINK

2024-08-01 Thread John Baldwin

On 7/31/24 17:16, Warner Losh wrote:

Thanks!

I'd thought about removing it, but didn't want to always remove CAM.4.gz on
a filesystem that's case insensitive, which will remove cam.4.gz...


While true, I think that's the far less common case where 'make delete-old'
is used.  The only case I can think of where you would install a world
onto a case sensitive filesystem and then do a delete-old is if you are
cross-building images on a mac (and running makefs, etc. there as well).
However, those cases don't always use make delete-old.  cheribuild just
installs a new DESTDIR each time for example.

--
John Baldwin




git: 8da89a177d71 - main - libsys: Add MLINKs for recvmmsg.2 and sendmmsg.2

2024-08-03 Thread John Baldwin
The branch main has been updated by jhb:

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

commit 8da89a177d7197e985157cc230fa9e401c6efd01
Author: John Baldwin 
AuthorDate: 2024-08-03 14:57:57 +
Commit: John Baldwin 
CommitDate: 2024-08-03 14:57:57 +

libsys: Add MLINKs for recvmmsg.2 and sendmmsg.2

These were accidentally lost when moving recvmmsg and sendmmsg back
from libc to libsys.

Reported by:Mark Millard 
Reviewed by:brooks, imp
Fixes:  29d079c96491 libsys: move __libsys_interposer consumers
Differential Revision:  https://reviews.freebsd.org/D46200
---
 lib/libsys/Makefile.sys | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/libsys/Makefile.sys b/lib/libsys/Makefile.sys
index 205f6bc1a5eb..d18f4bc23227 100644
--- a/lib/libsys/Makefile.sys
+++ b/lib/libsys/Makefile.sys
@@ -487,6 +487,7 @@ MLINKS+=read.2 pread.2 \
read.2 readv.2
 MLINKS+=readlink.2 readlinkat.2
 MLINKS+=recv.2 recvfrom.2 \
+   recv.2 recvmmsg.2 \
recv.2 recvmsg.2
 MLINKS+=rename.2 renameat.2
 MLINKS+=rtprio.2 rtprio_thread.2
@@ -499,7 +500,8 @@ MLINKS+=select.2 FD_CLR.3 \
select.2 FD_ISSET.3 \
select.2 FD_SET.3 \
select.2 FD_ZERO.3
-MLINKS+=send.2 sendmsg.2 \
+MLINKS+=send.2 sendmmsg.2 \
+   send.2 sendmsg.2 \
send.2 sendto.2
 MLINKS+=setpgid.2 setpgrp.2
 MLINKS+=setresuid.2 getresgid.2 \



git: 102b4e33acef - main - imgact_elf: Rewrap function declaration

2024-08-03 Thread John Baldwin
The branch main has been updated by jhb:

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

commit 102b4e33acef74da5b1e5aee43a324fd395342c8
Author: John Baldwin 
AuthorDate: 2024-08-03 15:01:10 +
Commit: John Baldwin 
CommitDate: 2024-08-03 15:01:10 +

imgact_elf: Rewrap function declaration

This was a style regression I missed when merging an earlier commit.

Fixes:  169641f7dd9f imgact_elf: Add const to a few struct 
image_params pointers
Sponsored by:   AFRL, DARPA
---
 sys/kern/imgact_elf.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c
index 28ffdd03dd6d..494456ceeeae 100644
--- a/sys/kern/imgact_elf.c
+++ b/sys/kern/imgact_elf.c
@@ -617,9 +617,9 @@ __elfN(map_insert)(const struct image_params *imgp, 
vm_map_t map,
return (KERN_SUCCESS);
 }
 
-static int __elfN(load_section)(const struct image_params *imgp,
-vm_ooffset_t offset, caddr_t vmaddr, size_t memsz, size_t filsz,
-vm_prot_t prot)
+static int
+__elfN(load_section)(const struct image_params *imgp, vm_ooffset_t offset,
+caddr_t vmaddr, size_t memsz, size_t filsz, vm_prot_t prot)
 {
struct sf_buf *sf;
size_t map_len;



git: 9bc300465e48 - main - Merge commit cb7a03b41fff from llvm git (by Nikolas Klauser):

2024-08-05 Thread John Baldwin
The branch main has been updated by jhb:

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

commit 9bc300465e48e19d794d88d0c158a2adb92c7197
Author: John Baldwin 
AuthorDate: 2024-08-05 19:19:30 +
Commit: John Baldwin 
CommitDate: 2024-08-05 19:19:30 +

Merge commit cb7a03b41fff from llvm git (by Nikolas Klauser):

 [libc++] Fix failures with GCC 14 (#92663)

Fixes #91831

Reviewed by:dim
Differential Revision:  https://reviews.freebsd.org/D46003
---
 contrib/llvm-project/libcxx/include/__string/constexpr_c_functions.h | 2 +-
 contrib/llvm-project/libcxx/include/__type_traits/remove_pointer.h   | 5 +
 contrib/llvm-project/libcxx/include/bitset   | 3 +++
 3 files changed, 9 insertions(+), 1 deletion(-)

diff --git 
a/contrib/llvm-project/libcxx/include/__string/constexpr_c_functions.h 
b/contrib/llvm-project/libcxx/include/__string/constexpr_c_functions.h
index 198f0f5e6809..46ad388ec2ea 100644
--- a/contrib/llvm-project/libcxx/include/__string/constexpr_c_functions.h
+++ b/contrib/llvm-project/libcxx/include/__string/constexpr_c_functions.h
@@ -108,7 +108,7 @@ __constexpr_memcmp_equal(const _Tp* __lhs, const _Up* 
__rhs, __element_count __n
 }
 return true;
   } else {
-return __builtin_memcmp(__lhs, __rhs, __count * sizeof(_Tp)) == 0;
+return ::__builtin_memcmp(__lhs, __rhs, __count * sizeof(_Tp)) == 0;
   }
 }
 
diff --git a/contrib/llvm-project/libcxx/include/__type_traits/remove_pointer.h 
b/contrib/llvm-project/libcxx/include/__type_traits/remove_pointer.h
index 54390a1939f7..1048f67055a2 100644
--- a/contrib/llvm-project/libcxx/include/__type_traits/remove_pointer.h
+++ b/contrib/llvm-project/libcxx/include/__type_traits/remove_pointer.h
@@ -23,8 +23,13 @@ struct remove_pointer {
   using type _LIBCPP_NODEBUG = __remove_pointer(_Tp);
 };
 
+#  ifdef _LIBCPP_COMPILER_GCC
+template 
+using __remove_pointer_t = typename remove_pointer<_Tp>::type;
+#  else
 template 
 using __remove_pointer_t = __remove_pointer(_Tp);
+#  endif
 #else
 // clang-format off
 template  struct _LIBCPP_TEMPLATE_VIS remove_pointer
  {typedef _LIBCPP_NODEBUG _Tp type;};
diff --git a/contrib/llvm-project/libcxx/include/bitset 
b/contrib/llvm-project/libcxx/include/bitset
index 308c58995dc3..5ea48d491303 100644
--- a/contrib/llvm-project/libcxx/include/bitset
+++ b/contrib/llvm-project/libcxx/include/bitset
@@ -376,8 +376,11 @@ template 
 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long
 __bitset<_N_words, _Size>::to_ullong(true_type, true_type) const {
   unsigned long long __r = __first_[0];
+  _LIBCPP_DIAGNOSTIC_PUSH
+  _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wshift-count-overflow")
   for (size_t __i = 1; __i < sizeof(unsigned long long) / 
sizeof(__storage_type); ++__i)
 __r |= static_cast(__first_[__i]) << 
(sizeof(__storage_type) * CHAR_BIT);
+  _LIBCPP_DIAGNOSTIC_POP
   return __r;
 }
 



git: 3a4b04e82df6 - main - depend-cleanup.sh: Simplify handling for stale syscall.S

2024-08-05 Thread John Baldwin
The branch main has been updated by jhb:

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

commit 3a4b04e82df6bb9b28aa0c3c670c19063843d644
Author: John Baldwin 
AuthorDate: 2024-08-05 19:49:06 +
Commit: John Baldwin 
CommitDate: 2024-08-05 19:49:06 +

depend-cleanup.sh: Simplify handling for stale syscall.S

Remove the outer grep and depend on the greps in clean_dep instead.

Reviewed by:brooks, imp
Obtained from:  CheriBSD
Sponsored by:   AFRL, DARPA
Differential Revision:  https://reviews.freebsd.org/D46103
---
 tools/build/depend-cleanup.sh | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/tools/build/depend-cleanup.sh b/tools/build/depend-cleanup.sh
index b93d50a57ff4..b7231422c5ed 100755
--- a/tools/build/depend-cleanup.sh
+++ b/tools/build/depend-cleanup.sh
@@ -171,9 +171,7 @@ clean_dep   lib/libcstatfsc
 # 20240308  e6ffc7669a56Remove pointless MD syscall(2)
 # 20240308  0ee0ae237324Remove pointless MD syscall(2)
 # 20240308  7b3836c28188Remove pointless MD syscall(2)
-if [ ${MACHINE} != i386 -a -f "$OBJTOP"/lib/libsys/.depend.syscall.o ] && \
-grep -q -e 'libsys/[^ /]*/syscall.S' 
"$OBJTOP"/lib/libsys/.depend.syscall.*; then
-   echo "Removing stale /syscall.S depends"
+if [ ${MACHINE} != i386 ]; then
clean_dep   lib/libsys  syscall S
clean_dep   lib/libcsyscall S
 fi



git: 971c9f57d7e6 - main - pci: Narrow the scope of recently-added PCI_IOV #ifdefs

2024-08-08 Thread John Baldwin
The branch main has been updated by jhb:

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

commit 971c9f57d7e6b55161fecc008e19f00ccaba8060
Author: John Baldwin 
AuthorDate: 2024-08-08 19:05:23 +
Commit: John Baldwin 
CommitDate: 2024-08-08 19:05:23 +

pci: Narrow the scope of recently-added PCI_IOV #ifdefs

Push the #ifdefs down into the function body instead of defining
functions conditionally for ease of readability.  These aren't
critical paths, so one extra branch in the !PCI_IOV case is not a big
deal.

Requested by:   jrtc27
Differential Revision:  https://reviews.freebsd.org/D45877
---
 sys/dev/pci/pci.c | 14 ++
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c
index a2912f2a93ae..843f70a594a0 100644
--- a/sys/dev/pci/pci.c
+++ b/sys/dev/pci/pci.c
@@ -164,18 +164,12 @@ static device_method_t pci_methods[] = {
DEVMETHOD(bus_get_resource, bus_generic_rl_get_resource),
DEVMETHOD(bus_delete_resource,  pci_delete_resource),
DEVMETHOD(bus_alloc_resource,   pci_alloc_resource),
-#ifdef PCI_IOV
DEVMETHOD(bus_adjust_resource,  pci_adjust_resource),
-#else
-   DEVMETHOD(bus_adjust_resource,  bus_generic_adjust_resource),
-#endif
DEVMETHOD(bus_release_resource, pci_release_resource),
DEVMETHOD(bus_activate_resource, pci_activate_resource),
DEVMETHOD(bus_deactivate_resource, pci_deactivate_resource),
-#ifdef PCI_IOV
DEVMETHOD(bus_map_resource, pci_map_resource),
DEVMETHOD(bus_unmap_resource,   pci_unmap_resource),
-#endif
DEVMETHOD(bus_child_deleted,pci_child_deleted),
DEVMETHOD(bus_child_detached,   pci_child_detached),
DEVMETHOD(bus_child_pnpinfo,pci_child_pnpinfo_method),
@@ -5754,11 +5748,11 @@ pci_deactivate_resource(device_t dev, device_t child, 
struct resource *r)
return (0);
 }
 
-#ifdef PCI_IOV
 int
 pci_adjust_resource(device_t dev, device_t child, struct resource *r,
 rman_res_t start, rman_res_t end)
 {
+#ifdef PCI_IOV
struct pci_devinfo *dinfo;
 
if (device_get_parent(child) != dev)
@@ -5778,6 +5772,7 @@ pci_adjust_resource(device_t dev, device_t child, struct 
resource *r,
 
/* Fall through for other types of resource allocations. */
}
+#endif
 
return (bus_generic_adjust_resource(dev, child, r, start, end));
 }
@@ -5786,6 +5781,7 @@ int
 pci_map_resource(device_t dev, device_t child, struct resource *r,
 struct resource_map_request *argsp, struct resource_map *map)
 {
+#ifdef PCI_IOV
struct pci_devinfo *dinfo;
 
if (device_get_parent(child) != dev)
@@ -5805,6 +5801,7 @@ pci_map_resource(device_t dev, device_t child, struct 
resource *r,
 
/* Fall through for other types of resource allocations. */
}
+#endif
 
return (bus_generic_map_resource(dev, child, r, argsp, map));
 }
@@ -5813,6 +5810,7 @@ int
 pci_unmap_resource(device_t dev, device_t child, struct resource *r,
 struct resource_map *map)
 {
+#ifdef PCI_IOV
struct pci_devinfo *dinfo;
 
if (device_get_parent(child) != dev)
@@ -5830,10 +5828,10 @@ pci_unmap_resource(device_t dev, device_t child, struct 
resource *r,
 
/* Fall through for other types of resource allocations. */
}
+#endif
 
return (bus_generic_unmap_resource(dev, child, r, map));
 }
-#endif
 
 void
 pci_child_deleted(device_t dev, device_t child)



Re: git: 104ee24349c0 - main - pci: Renove #ifdef PCI_IOV from declarations now used unconditionally

2024-08-09 Thread John Baldwin

On 8/8/24 18:36, Jessica Clarke wrote:

The branch main has been updated by jrtc27:

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

commit 104ee24349c033b63a50bd89ddc431a0d3ef9902
Author: Jessica Clarke 
AuthorDate: 2024-08-08 22:35:09 +
Commit: Jessica Clarke 
CommitDate: 2024-08-08 22:35:09 +

 pci: Renove #ifdef PCI_IOV from declarations now used unconditionally
 
 Fixes:  971c9f57d7e6 ("pci: Narrow the scope of recently-added PCI_IOV #ifdefs")

---
  sys/dev/pci/pci_private.h | 4 
  1 file changed, 4 deletions(-)


Oops, thanks for fixing.

--
John Baldwin




Re: git: f44ff2aba2d6 - main - bhyve: Treat the COMMAND register for PCI passthru devices as emulated

2024-08-19 Thread John Baldwin

On 8/13/24 21:17, Navdeep Parhar wrote:

On 7/31/24 7:50 AM, John Baldwin wrote:

The branch main has been updated by jhb:

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

commit f44ff2aba2d64d1d9312cb55008dc90275ccdc04
Author: John Baldwin 
AuthorDate: 2024-07-31 14:50:33 +
Commit: John Baldwin 
CommitDate: 2024-07-31 14:50:33 +

  bhyve: Treat the COMMAND register for PCI passthru devices as emulated
  
  Don't pass through writes of the command register through to the

  physical device.  These registers do not need to be in sync, and in
  some cases (e.g. when the guest is sizing the BAR and temporarily
  disables decoding), the states need to diverge.


This seems to break MSI-X interrupts for a device that is passed through
to a VM.  That is, the device generates an interrupt but the driver in
the VM never receives it.  Reverting this change fixes the problem.


Yes, https://reviews.freebsd.org/D46245 is what I have been using.  It turns
out the ppt(4) driver wasn't fully managing the command register.

--
John Baldwin




git: 0a5996443b61 - main - src.conf.5: Fix spelling typo

2024-08-20 Thread John Baldwin
The branch main has been updated by jhb:

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

commit 0a5996443b61861d6658ac216699b6717f05930d
Author: John Baldwin 
AuthorDate: 2024-08-20 11:54:12 +
Commit: John Baldwin 
CommitDate: 2024-08-20 11:54:12 +

src.conf.5: Fix spelling typo

Sponsored by:   AFRL, DARPA
---
 share/man/man5/src.conf.5  | 4 ++--
 tools/build/options/WITH_UNDEFINED_VERSION | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/share/man/man5/src.conf.5 b/share/man/man5/src.conf.5
index 200ce8211e17..afdf3ee51619 100644
--- a/share/man/man5/src.conf.5
+++ b/share/man/man5/src.conf.5
@@ -1,5 +1,5 @@
 .\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman.
-.Dd August 6, 2024
+.Dd August 20, 2024
 .Dt SRC.CONF 5
 .Os
 .Sh NAME
@@ -1759,7 +1759,7 @@ and related programs.
 .It Va WITH_UNDEFINED_VERSION
 Link libraries with --undefined-version which permits version maps to
 contain symbols that are not present in the library.
-If this is necessicary to build a particular configuration, a bug is
+If this is necessary to build a particular configuration, a bug is
 present and the configuration should be reported.
 .It Va WITHOUT_UNIFIED_OBJDIR
 Use the historical object directory format for
diff --git a/tools/build/options/WITH_UNDEFINED_VERSION 
b/tools/build/options/WITH_UNDEFINED_VERSION
index 71b048349a6f..99f687d37bcf 100644
--- a/tools/build/options/WITH_UNDEFINED_VERSION
+++ b/tools/build/options/WITH_UNDEFINED_VERSION
@@ -1,4 +1,4 @@
 Link libraries with --undefined-version which permits version maps to
 contain symbols that are not present in the library.
-If this is necessicary to build a particular configuration, a bug is
+If this is necessary to build a particular configuration, a bug is
 present and the configuration should be reported.



Re: git: 43e8849bc294 - main - conf: Enable BTI checking in the arm64 kernel

2024-08-21 Thread John Baldwin

On 8/20/24 05:02, Andrew Turner wrote:

The branch main has been updated by andrew:

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

commit 43e8849bc29414036ccaef7788de95a07ad32ab5
Author: Andrew Turner 
AuthorDate: 2024-08-19 12:59:49 +
Commit: Andrew Turner 
CommitDate: 2024-08-20 08:49:15 +

 conf: Enable BTI checking in the arm64 kernel
 
 To ensure new code has BTI support make it an error to not have the

 BTI ELF note when linking the kernel and kernel modules.
 
 Reviewed by:kib, emaste

 Sponsored by:   Arm Ltd
 Differential Revision:  https://reviews.freebsd.org/D45469


This has broken two of the GitHub CI actions using clang 12 and clang 13.
Please fix this to be conditional on a supported linker version (or perhaps
add a new linker feature to bsd.linker.mk).

--
John Baldwin




git: 297a9e552b9a - main - libcxxrt: Add a stub implementation of __cxa_call_terminate

2024-08-21 Thread John Baldwin
The branch main has been updated by jhb:

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

commit 297a9e552b9a5adf07d195eae9649b0758f395af
Author: John Baldwin 
AuthorDate: 2024-08-21 17:37:48 +
Commit: John Baldwin 
CommitDate: 2024-08-21 17:37:48 +

libcxxrt: Add a stub implementation of __cxa_call_terminate

This function is called by GCC 14 if a destructor invoked during
exception unwinding throws an exception.

Reviewed by:emaste
Obtained from:  libcxxrt commit 391a3dcc1054e18c2f0dff4e14d6d79ac95399d7
Differential Revision:  https://reviews.freebsd.org/D46004
---
 contrib/libcxxrt/exception.cc | 13 +
 lib/libcxxrt/Version.map  |  4 
 lib/libcxxrt/Version.map.arm  |  4 
 3 files changed, 21 insertions(+)

diff --git a/contrib/libcxxrt/exception.cc b/contrib/libcxxrt/exception.cc
index 35ff997dd445..b56333e979a2 100644
--- a/contrib/libcxxrt/exception.cc
+++ b/contrib/libcxxrt/exception.cc
@@ -1433,6 +1433,19 @@ extern "C" void __cxa_call_unexpected(void*exception)
abort();
 }
 
+/**
+ * ABI function, called when an object destructor exits due to an
+ * exception during stack unwinding.
+ *
+ * This function does not return.
+ */
+extern "C" void __cxa_call_terminate(void *exception) throw()
+{
+   std::terminate();
+   // Should not be reached.
+   abort();
+}
+
 /**
  * ABI function, returns the adjusted pointer to the exception object.
  */
diff --git a/lib/libcxxrt/Version.map b/lib/libcxxrt/Version.map
index 012026079e33..02cce34c234f 100644
--- a/lib/libcxxrt/Version.map
+++ b/lib/libcxxrt/Version.map
@@ -253,6 +253,10 @@ CXXABI_1.3.11 {
 __cxa_init_primary_exception;
 } CXXABI_1.3.9;
 
+CXXABI_1.3.15 {
+__cxa_call_terminate;
+} CXXABI_1.3.11;
+
 CXXRT_1.0 {
 
 extern "C++" {
diff --git a/lib/libcxxrt/Version.map.arm b/lib/libcxxrt/Version.map.arm
index bc4cf68a3654..aef918149b79 100644
--- a/lib/libcxxrt/Version.map.arm
+++ b/lib/libcxxrt/Version.map.arm
@@ -254,6 +254,10 @@ CXXABI_1.3.11 {
 __cxa_init_primary_exception;
 } CXXABI_1.3.9;
 
+CXXABI_1.3.15 {
+__cxa_call_terminate;
+} CXXABI_1.3.11;
+
 CXXRT_1.0 {
 
 extern "C++" {



git: c0c1b1cd899a - main - freebsd32: Fix a few typos in syscalls.conf comments

2024-08-21 Thread John Baldwin
The branch main has been updated by jhb:

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

commit c0c1b1cd899aae5712786ce73469422fd5d3918a
Author: John Baldwin 
AuthorDate: 2024-08-21 21:14:56 +
Commit: John Baldwin 
CommitDate: 2024-08-21 21:14:56 +

freebsd32: Fix a few typos in syscalls.conf comments

Sponsored by:   AFRL, DARPA
---
 sys/compat/freebsd32/syscalls.conf | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/compat/freebsd32/syscalls.conf 
b/sys/compat/freebsd32/syscalls.conf
index 055a041cf72a..a6e47cf470f1 100644
--- a/sys/compat/freebsd32/syscalls.conf
+++ b/sys/compat/freebsd32/syscalls.conf
@@ -18,7 +18,7 @@ abi_ptr_array_t="uint32_t"
 abi_headers="#include "
 
 #
-# Variables below this line are exceptions to the ABI changes programatically
+# Variables below this line are exceptions to the ABI changes programmatically
 # detected by makesyscalls.lua.  New system calls should not require an entry
 # here in nearly virtually all cases.  New entries are almost certainly
 # representative of badly designed interfaces.
@@ -53,5 +53,5 @@ obsol="getkerninfo"
 # nlm_syscall - requires significant porting, probably doesn't make sense
 # nnpfs_syscall - requires significant porting, probably doesn't make sense
 # ntp_gettime - should be implemented
-# thr_create - was unimplemented and appears to be unnecessicary
+# thr_create - was unimplemented and appears to be unnecessary
 unimpl="afs3_syscall kldsym __mac_get_proc __mac_set_proc __mac_get_fd 
__mac_get_file __mac_set_fd __mac_set_file __mac_get_pid __mac_get_link 
__mac_set_link __mac_execve nfssvc nlm_syscall ntp_gettime lgetfh nnpfs_syscall 
thr_create"



Re: git: 297a9e552b9a - main - libcxxrt: Add a stub implementation of __cxa_call_terminate

2024-08-22 Thread John Baldwin

On 8/21/24 13:38, John Baldwin wrote:

The branch main has been updated by jhb:

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

commit 297a9e552b9a5adf07d195eae9649b0758f395af
Author: John Baldwin 
AuthorDate: 2024-08-21 17:37:48 +
Commit: John Baldwin 
CommitDate: 2024-08-21 17:37:48 +

 libcxxrt: Add a stub implementation of __cxa_call_terminate
 
 This function is called by GCC 14 if a destructor invoked during

 exception unwinding throws an exception.
 
 Reviewed by:emaste

 Obtained from:  libcxxrt commit 391a3dcc1054e18c2f0dff4e14d6d79ac95399d7
 Differential Revision:  https://reviews.freebsd.org/D46004


This should be the last commit needed to build amd64 with GCC 14 via the
amd64-gcc14 package.

--
John Baldwin




git: 776cd02b891c - main - vmm ppt: Enable busmastering and BAR decoding while a device is assigned

2024-08-22 Thread John Baldwin
The branch main has been updated by jhb:

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

commit 776cd02b891ccd984963c9ec26f9748d213f0b9b
Author: John Baldwin 
AuthorDate: 2024-08-22 18:40:48 +
Commit: John Baldwin 
CommitDate: 2024-08-22 18:40:48 +

vmm ppt: Enable busmastering and BAR decoding while a device is assigned

Reviewed by:corvink, markj
Fixes:  f44ff2aba2d6 bhyve: Treat the COMMAND register for PCI 
passthru devices as emulated
Sponsored by:   Chelsio Communications
Differential Revision:  https://reviews.freebsd.org/D46245
---
 sys/amd64/vmm/io/ppt.c | 29 -
 1 file changed, 28 insertions(+), 1 deletion(-)

diff --git a/sys/amd64/vmm/io/ppt.c b/sys/amd64/vmm/io/ppt.c
index 3451e91d9de1..9fcfdc7cb441 100644
--- a/sys/amd64/vmm/io/ppt.c
+++ b/sys/amd64/vmm/io/ppt.c
@@ -151,9 +151,13 @@ static int
 ppt_attach(device_t dev)
 {
struct pptdev *ppt;
+   uint16_t cmd;
 
ppt = device_get_softc(dev);
 
+   cmd = pci_read_config(dev, PCIR_COMMAND, 2);
+   cmd &= ~(PCIM_CMD_PORTEN | PCIM_CMD_MEMEN | PCIM_CMD_BUSMASTEREN);
+   pci_write_config(dev, PCIR_COMMAND, cmd, 2);
iommu_remove_device(iommu_host_domain(), pci_get_rid(dev));
num_pptdevs++;
TAILQ_INSERT_TAIL(&pptdev_list, ppt, next);
@@ -176,7 +180,6 @@ ppt_detach(device_t dev)
return (EBUSY);
num_pptdevs--;
TAILQ_REMOVE(&pptdev_list, ppt, next);
-   pci_disable_busmaster(dev);
 
if (iommu_host_domain() != NULL)
iommu_add_device(iommu_host_domain(), pci_get_rid(dev));
@@ -376,11 +379,28 @@ ppt_pci_reset(device_t dev)
pci_power_reset(dev);
 }
 
+static uint16_t
+ppt_bar_enables(struct pptdev *ppt)
+{
+   struct pci_map *pm;
+   uint16_t cmd;
+
+   cmd = 0;
+   for (pm = pci_first_bar(ppt->dev); pm != NULL; pm = pci_next_bar(pm)) {
+   if (PCI_BAR_IO(pm->pm_value))
+   cmd |= PCIM_CMD_PORTEN;
+   if (PCI_BAR_MEM(pm->pm_value))
+   cmd |= PCIM_CMD_MEMEN;
+   }
+   return (cmd);
+}
+
 int
 ppt_assign_device(struct vm *vm, int bus, int slot, int func)
 {
struct pptdev *ppt;
int error;
+   uint16_t cmd;
 
/* Passing NULL requires the device to be unowned. */
error = ppt_find(NULL, bus, slot, func, &ppt);
@@ -392,6 +412,9 @@ ppt_assign_device(struct vm *vm, int bus, int slot, int 
func)
pci_restore_state(ppt->dev);
ppt->vm = vm;
iommu_add_device(vm_iommu_domain(vm), pci_get_rid(ppt->dev));
+   cmd = pci_read_config(ppt->dev, PCIR_COMMAND, 2);
+   cmd |= PCIM_CMD_BUSMASTEREN | ppt_bar_enables(ppt);
+   pci_write_config(ppt->dev, PCIR_COMMAND, cmd, 2);
return (0);
 }
 
@@ -400,11 +423,15 @@ ppt_unassign_device(struct vm *vm, int bus, int slot, int 
func)
 {
struct pptdev *ppt;
int error;
+   uint16_t cmd;
 
error = ppt_find(vm, bus, slot, func, &ppt);
if (error)
return (error);
 
+   cmd = pci_read_config(ppt->dev, PCIR_COMMAND, 2);
+   cmd &= ~(PCIM_CMD_PORTEN | PCIM_CMD_MEMEN | PCIM_CMD_BUSMASTEREN);
+   pci_write_config(ppt->dev, PCIR_COMMAND, cmd, 2);
pci_save_state(ppt->dev);
ppt_pci_reset(ppt->dev);
pci_restore_state(ppt->dev);



Re: git: 43e8849bc294 - main - conf: Enable BTI checking in the arm64 kernel

2024-08-30 Thread John Baldwin

On 8/30/24 04:55, Andrew Turner wrote:




On 29 Aug 2024, at 17:02, Jessica Clarke  wrote:

On 21 Aug 2024, at 15:28, John Baldwin  wrote:


On 8/20/24 05:02, Andrew Turner wrote:

The branch main has been updated by andrew:
URL: 
https://cgit.FreeBSD.org/src/commit/?id=43e8849bc29414036ccaef7788de95a07ad32ab5
commit 43e8849bc29414036ccaef7788de95a07ad32ab5
Author: Andrew Turner 
AuthorDate: 2024-08-19 12:59:49 +
Commit: Andrew Turner 
CommitDate: 2024-08-20 08:49:15 +
conf: Enable BTI checking in the arm64 kernel
 To ensure new code has BTI support make it an error to not have the
BTI ELF note when linking the kernel and kernel modules.
 Reviewed by:kib, emaste
Sponsored by:   Arm Ltd
Differential Revision:  https://reviews.freebsd.org/D45469


This has broken two of the GitHub CI actions using clang 12 and clang 13.
Please fix this to be conditional on a supported linker version (or perhaps
add a new linker feature to bsd.linker.mk).


This is still broken. If it’s not fixed promptly I will just revert
this change; we can’t leave CI broken, especially when it gets used to
test GitHub PRs. Please stop breaking building with older toolchains,
this isn’t the first time it’s happened.


See https://github.com/freebsd/freebsd-src/pull/1393 and 
https://github.com/freebsd/freebsd-src/pull/1399


I do think we probably want to flesh out a bit more what kind of policy
we want for the range of compiler versions to support.  E.g. in the GDB
project the policy is something like "will not use a version of C++ newer
than a compiler from 10 years ago" (IIRC).  There they will also look back
to whatever LTS distros are active and what is the newest compiler that
can be installed on those LTS via the equivalent of ports.

Traditionally we used to only support compiling FreeBSD N on FreeBSD N-1
(though we have often supported older versions of FreeBSD).  However, we
now also support cross-compiling from Linux and macOS, so we probably want
to widen the support base a bit.  I would say a first stab perhaps is that
main and any supported stable and release branches should be buildable on
a host running any of those versions.  That is, FreeBSD 13 is still
supported so we should keep main building on it directly without requiring
a jump to FreeBSD 14 first.  Once 13 EOLs then we can stop supporting 13,
and that would gives folks on 13 a way to step up to the supported version
of 14 at the time of the EOL.  That said, presuambly fairly recent versions
of LLVM (and GCC for that matter) will be available in ports for supported
versions, so that doesn't necessarily require a very wide range of supported
compiler versions.  Supporting the "native" compiler on those releases
would be a nice goal that I think is probably achievable with minimal
effort.

Today our oldest supported release is 14.0 which shipped with clang 16, and
13.3 shipped with clang 17.  Both of those are quite a bit newer than clang 12
that is current oldest version in CI.  I have no idea what version range
might be sensible for Linux and macOS.  Presumably we'd want to settle on
some range of ubuntu LTS versions and whatever is the newest version you can
install on the oldest LTS as the minimum.

clang 12 might have been used in 13.1 (not mentioned in the release notes,
13.0 used clang 11, 13.2 used clang 14) and 12.3 (12.4 used clang 13,
12.2 used clang 10, 12.3 didn't mention it).

I know CHERI LLVM is still on LLVM 15 (though moving to LLVM 16 soon, but
Morello LLVM is 14 still I think).  libc++ is also making this more
complicated as they are providing very little compatability at all.  They've
already ripped out support for GCC 14 I believe, so you can't build current
libc++ with a released version of GCC or something crazy.

--
John Baldwin




git: f5541f9f4734 - main - nvmfd/nvmft: Fix a typo "whiled" -> "while"

2024-09-03 Thread John Baldwin
The branch main has been updated by jhb:

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

commit f5541f9f473430a3e608e07f623294322853d25a
Author: John Baldwin 
AuthorDate: 2024-09-03 20:12:04 +
Commit: John Baldwin 
CommitDate: 2024-09-03 20:12:04 +

nvmfd/nvmft: Fix a typo "whiled" -> "while"

Sponsored by:   Chelsio Communications
---
 sys/dev/nvmf/controller/nvmft_controller.c | 2 +-
 usr.sbin/nvmfd/controller.c| 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/dev/nvmf/controller/nvmft_controller.c 
b/sys/dev/nvmf/controller/nvmft_controller.c
index dee4d8c92d3d..3c10fea75c9d 100644
--- a/sys/dev/nvmf/controller/nvmft_controller.c
+++ b/sys/dev/nvmf/controller/nvmft_controller.c
@@ -954,7 +954,7 @@ nvmft_handle_admin_command(struct nvmft_controller *ctrlr,
if (NVMEV(NVME_CC_REG_EN, ctrlr->cc) == 0 &&
cmd->opc != NVME_OPC_FABRICS_COMMANDS) {
nvmft_printf(ctrlr,
-   "Unsupported admin opcode %#x whiled disabled\n", cmd->opc);
+   "Unsupported admin opcode %#x while disabled\n", cmd->opc);
nvmft_send_generic_error(ctrlr->admin, nc,
NVME_SC_COMMAND_SEQUENCE_ERROR);
nvmf_free_capsule(nc);
diff --git a/usr.sbin/nvmfd/controller.c b/usr.sbin/nvmfd/controller.c
index 09baaea74ab4..e9435bce69da 100644
--- a/usr.sbin/nvmfd/controller.c
+++ b/usr.sbin/nvmfd/controller.c
@@ -192,7 +192,7 @@ controller_handle_admin_commands(struct controller *c, 
handle_command *cb,
 */
if (NVMEV(NVME_CC_REG_EN, c->cc) == 0 &&
cmd->opc != NVME_OPC_FABRICS_COMMANDS) {
-   warnx("Unsupported admin opcode %#x whiled disabled\n",
+   warnx("Unsupported admin opcode %#x while disabled\n",
cmd->opc);
nvmf_send_generic_error(nc,
NVME_SC_COMMAND_SEQUENCE_ERROR);



git: fcef359272fd - main - uart: Use uintptr_t instead of vm_offset_t for pointer arithmetic

2024-09-04 Thread John Baldwin
The branch main has been updated by jhb:

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

commit fcef359272fdda27eef770a512b15bb40232cbd2
Author: John Baldwin 
AuthorDate: 2024-09-04 13:56:21 +
Commit: John Baldwin 
CommitDate: 2024-09-04 13:56:21 +

uart: Use uintptr_t instead of vm_offset_t for pointer arithmetic

Reviewed by:imp
Obtained from:  CheriBSD
Sponsored by:   AFRL, DARPA
Differential Revision:  https://reviews.freebsd.org/D46490
---
 sys/dev/uart/uart_cpu_acpi.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/sys/dev/uart/uart_cpu_acpi.c b/sys/dev/uart/uart_cpu_acpi.c
index 53fe459e64a1..7892437e11de 100644
--- a/sys/dev/uart/uart_cpu_acpi.c
+++ b/sys/dev/uart/uart_cpu_acpi.c
@@ -235,10 +235,10 @@ uart_cpu_acpi_dbg2(struct uart_devinfo *di)
 
error = ENXIO;
 
-   dbg2_dev = (ACPI_DBG2_DEVICE *)((vm_offset_t)dbg2 + dbg2->InfoOffset);
+   dbg2_dev = (ACPI_DBG2_DEVICE *)((uintptr_t)dbg2 + dbg2->InfoOffset);
found = false;
-   while ((vm_offset_t)dbg2_dev + dbg2_dev->Length <=
-   (vm_offset_t)dbg2 + dbg2->Header.Length) {
+   while ((uintptr_t)dbg2_dev + dbg2_dev->Length <=
+   (uintptr_t)dbg2 + dbg2->Header.Length) {
if (dbg2_dev->PortType != ACPI_DBG2_SERIAL_PORT)
goto next;
 
@@ -252,7 +252,7 @@ uart_cpu_acpi_dbg2(struct uart_devinfo *di)
 
class = cd->cd_class;
base_address = (ACPI_GENERIC_ADDRESS *)
-   ((vm_offset_t)dbg2_dev + dbg2_dev->BaseAddressOffset);
+   ((uintptr_t)dbg2_dev + dbg2_dev->BaseAddressOffset);
 
error = uart_cpu_acpi_init_devinfo(di, class, base_address);
if (error == 0) {
@@ -262,7 +262,7 @@ uart_cpu_acpi_dbg2(struct uart_devinfo *di)
 
 next:
dbg2_dev = (ACPI_DBG2_DEVICE *)
-   ((vm_offset_t)dbg2_dev + dbg2_dev->Length);
+   ((uintptr_t)dbg2_dev + dbg2_dev->Length);
}
if (!found)
goto out;



git: 77eb877714d6 - main - grep: Fix various bugs in recursive tree handling

2024-09-04 Thread John Baldwin
The branch main has been updated by jhb:

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

commit 77eb877714d69ee0279d70eb3331920fba90db95
Author: John Baldwin 
AuthorDate: 2024-09-04 19:53:17 +
Commit: John Baldwin 
CommitDate: 2024-09-04 19:53:17 +

grep: Fix various bugs in recursive tree handling

The -OpS options were effectively ignored due to a collection of
bugs in the use of fts(3):

- fts_open(3) requires one of FTS_PHYSICAL or FTS_LOGICAL to be
  specified, but in the -O case, only FTS_COMFOLLOW was given.  Fix
  this to use FTS_COMFOLLOW | FTS_PHYSICAL.

- The switch on the entry type returned by fts_read() did not check
  for symbolic links, so symbolic links fell into the default case and
  were always passed to procfile() even when -p was given.  Fix this
  by adding cases in the switch statement to explicitly ignore FTS_SL.

- FTS_NOSTAT was passed to fts_open(), so fts_open() couldn't detect
  symbolic links when FTS_PHYSICAL was passed, instead both regular
  files and symbolic links were returned as FTS_NSOK entries.  Fix
  by only using FTS_NOSTAT with FTS_LOGICAL.

While here, fix a few other nits:

- Treat FTS_NS as an error like FTS_DNR and FTS_ERR.

- Just ignore FTS_DP.  The logic to skip descending into skipped
  directories is only relevant when a directory is first visited, not
  after the directory has been visited.

- Use warnc instead of warnx + strerror.

PR: 280676
Reviewed by:kevans
MFC after:  1 week
Differential Revision:  https://reviews.freebsd.org/D46255
---
 usr.bin/grep/util.c | 23 ---
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/usr.bin/grep/util.c b/usr.bin/grep/util.c
index 936abc41b3ef..4e1c44b442f2 100644
--- a/usr.bin/grep/util.c
+++ b/usr.bin/grep/util.c
@@ -136,16 +136,16 @@ grep_tree(char **argv)
/* This switch effectively initializes 'fts_flags' */
switch(linkbehave) {
case LINK_EXPLICIT:
-   fts_flags = FTS_COMFOLLOW;
+   fts_flags = FTS_COMFOLLOW | FTS_PHYSICAL;
break;
case LINK_SKIP:
fts_flags = FTS_PHYSICAL;
break;
default:
-   fts_flags = FTS_LOGICAL;
+   fts_flags = FTS_LOGICAL | FTS_NOSTAT;
}
 
-   fts_flags |= FTS_NOSTAT | FTS_NOCHDIR;
+   fts_flags |= FTS_NOCHDIR;
 
fts = fts_open((argv[0] == NULL) ?
__DECONST(char * const *, wd) : argv, fts_flags, NULL);
@@ -154,15 +154,13 @@ grep_tree(char **argv)
while (errno = 0, (p = fts_read(fts)) != NULL) {
switch (p->fts_info) {
case FTS_DNR:
-   /* FALLTHROUGH */
case FTS_ERR:
+   case FTS_NS:
file_err = true;
if(!sflag)
-   warnx("%s: %s", p->fts_path, 
strerror(p->fts_errno));
+   warnc(p->fts_errno, "%s", p->fts_path);
break;
case FTS_D:
-   /* FALLTHROUGH */
-   case FTS_DP:
if (dexclude || dinclude)
if (!dir_matching(p->fts_name) ||
!dir_matching(p->fts_path))
@@ -173,6 +171,17 @@ grep_tree(char **argv)
warnx("warning: %s: recursive directory loop",
p->fts_path);
break;
+   case FTS_DP:
+   break;
+   case FTS_SL:
+   /*
+* Skip symlinks for LINK_EXPLICIT and
+* LINK_SKIP.  Note that due to FTS_COMFOLLOW,
+* symlinks on the command line are followed
+* for LINK_EXPLICIT and not reported as
+* symlinks.
+*/
+   break;
default:
/* Check for file exclusion/inclusion */
ok = true;



git: fc12c191c087 - main - grep: Default to -p instead of -S.

2024-09-04 Thread John Baldwin
The branch main has been updated by jhb:

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

commit fc12c191c087b63e1204fee210ba76082ea40b96
Author: John Baldwin 
AuthorDate: 2024-09-04 19:53:22 +
Commit: John Baldwin 
CommitDate: 2024-09-04 19:53:22 +

grep: Default to -p instead of -S.

This matches the documented behavior in the manpage as well as the
default behavior on macOS.

PR: 280676
Reported by:Radosław Piliszek 
Reviewed by:kevans
MFC after:  1 week
Differential Revision:  https://reviews.freebsd.org/D46256
---
 usr.bin/grep/grep.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/usr.bin/grep/grep.c b/usr.bin/grep/grep.c
index 9f960f74dbb6..feaf17d7c1e1 100644
--- a/usr.bin/grep/grep.c
+++ b/usr.bin/grep/grep.c
@@ -112,7 +112,7 @@ int  binbehave = BINFILE_BIN;   /* -aIU: handling of 
binary files */
 int filebehave = FILE_STDIO;
 int devbehave = DEV_READ;  /* -D: handling of devices */
 int dirbehave = DIR_READ;  /* -dRr: handling of directories */
-int linkbehave = LINK_READ;/* -OpS: handling of symlinks */
+int linkbehave = LINK_SKIP;/* -OpS: handling of symlinks */
 
 booldexclude, dinclude;/* --exclude-dir and --include-dir */
 boolfexclude, finclude;/* --exclude and --include */



git: bedfac1f026f - main - nvmf_tcp: Fully honor kern.nvmf.tcp.max_transmit_data for C2H_DATA PDUs

2024-09-05 Thread John Baldwin
The branch main has been updated by jhb:

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

commit bedfac1f026fa8e2e6572ca380d89d74a01d5def
Author: John Baldwin 
AuthorDate: 2024-09-05 21:14:36 +
Commit: John Baldwin 
CommitDate: 2024-09-05 21:14:36 +

nvmf_tcp: Fully honor kern.nvmf.tcp.max_transmit_data for C2H_DATA PDUs

The previous version of tcp_send_controller_data avoided sending a
chain of multiple mbufs that exceeded the limit, but if an individual
mbuf was larger than the limit it was sent as a single, over-sized
PDU.  Fix by using m_split() to split individual mbufs larger than the
limit.

Note that this is not a protocol error, per se, as there is no limit
on C2H_DATA PDU lengths (unlike the MAXH2CDATA parameter).  This fix
just honors the administrative limit more faithfully.  This case is
also very unlikely with the default limit of 256k.

Sponsored by:   Chelsio Communications
---
 sys/dev/nvmf/nvmf_tcp.c | 31 +++
 1 file changed, 19 insertions(+), 12 deletions(-)

diff --git a/sys/dev/nvmf/nvmf_tcp.c b/sys/dev/nvmf/nvmf_tcp.c
index 67d239b63faf..22275aaa835b 100644
--- a/sys/dev/nvmf/nvmf_tcp.c
+++ b/sys/dev/nvmf/nvmf_tcp.c
@@ -1784,7 +1784,6 @@ tcp_send_controller_data(struct nvmf_capsule *nc, 
uint32_t data_offset,
 {
struct nvmf_tcp_qpair *qp = TQP(nc->nc_qpair);
struct nvme_sgl_descriptor *sgl;
-   struct mbuf *n, *p;
uint32_t data_len;
bool last_pdu, last_xfer;
 
@@ -1813,21 +1812,29 @@ tcp_send_controller_data(struct nvmf_capsule *nc, 
uint32_t data_offset,
 
/* Queue one more C2H_DATA PDUs containing the data from 'm'. */
while (m != NULL) {
+   struct mbuf *n;
uint32_t todo;
 
-   todo = m->m_len;
-   p = m;
-   n = p->m_next;
-   while (n != NULL) {
-   if (todo + n->m_len > qp->max_tx_data) {
-   p->m_next = NULL;
-   break;
-   }
-   todo += n->m_len;
-   p = n;
+   if (m->m_len > qp->max_tx_data) {
+   n = m_split(m, qp->max_tx_data, M_WAITOK);
+   todo = m->m_len;
+   } else {
+   struct mbuf *p;
+
+   todo = m->m_len;
+   p = m;
n = p->m_next;
+   while (n != NULL) {
+   if (todo + n->m_len > qp->max_tx_data) {
+   p->m_next = NULL;
+   break;
+   }
+   todo += n->m_len;
+   p = n;
+   n = p->m_next;
+   }
+   MPASS(m_length(m, NULL) == todo);
}
-   MPASS(m_length(m, NULL) == todo);
 
last_pdu = (n == NULL && last_xfer);
tcp_send_c2h_pdu(qp, nc->nc_sqe.cid, data_offset, m, todo,



Re: git: e962b37bf0ff - main - bhyve: Do not enable PCI BAR decoding if a boot ROM is present

2024-09-06 Thread John Baldwin

On 9/5/24 22:10, Shawn Webb wrote:

Hey Mark,

This commit seems to force me to now pass "-o pci.enable_bars=true" to
all my VMs on amd64. I wonder if that might be a POLA violation. I
didn't realize that I needed to set that until I bisected the src
tree, looking for the commit that broke bhyve for me.

Is changing the default here really worth it for amd64? If so, I'm
thinking this should be in both RELNOTES and UPDATING. I now have to
propigate re-enabling this across my entire infrastructure.

Thanks,


That should only be true if you are using an older UEFI firmware that did
not program BARs.  Are you seeing this on stock FreeBSD, and which version
of the UEFI ROM are you using?

--
John Baldwin




Re: git: f08247fd888e - main - Assert that mbufs are writable if we write to them

2024-09-12 Thread John Baldwin

I think part of the motivation for marking M_EXTPG as read-only is that you can't 
"write"
to m_data via mtod() or the like.  That said, M_EXTPG aren't really read-only.  
It
depends on the backing store.  M_EXTPG were first merged into FreeBSD prior to 
KTLS to
support sendfile, and in that case, they should be M_RDONLY because they alias 
pages
from the file's VM object.  However, M_EXTPG mbufs allocated via functions like
m_uiotombuf_nomap should not be M_RDONLY.  I think this originated in the 
original
import of KTLS which doesn't push setting M_RDONLY out to the callers of 
mb_alloc_extpgs,
and a few other places that hardcode M_RDONLY with M_EXTPG (_mb_unmapped_to_ext 
should
preserve M_RDONLY from the original mbuf instead of forcing M_RDONLY).

I can take a stab at a patch but won't have time to really test it until after 
Euro.

On 9/11/24 16:56, Drew Gallatin wrote:

M_EXTPGS mbufs are marked read-only because they refer to external data.   The 
original crypto code, (before kTLS was converted to OCF), used to just build an 
iovec using PHYS_TO_DMAP() on the page array.  I think this case was missed 
during the conversion to OCF.

I'm not sure what the best thing to do is, as they should be read only, except 
this one specific case I'd be tempted to just nerf the KASSERT for EXTPGS.

On Wed, Sep 11, 2024, at 11:02 AM, Kristof Provost wrote:

On 11 Sep 2024, at 16:45, Mark Johnston wrote:

On Wed, Sep 11, 2024 at 11:18:26AM +, Kristof Provost wrote:

The branch main has been updated by kp:

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

commit f08247fd888e6f7db0ecf2aaa39377144ac40b4c
Author: Kristof Provost 
AuthorDate: 2024-09-10 20:15:31 +
Commit: Kristof Provost 
CommitDate: 2024-09-11 11:17:48 +

 Assert that mbufs are writable if we write to them

 m_copyback() modifies the mbuf, so it must be a writable mbuf.


This change still triggers a panic for me when running KTLS tests.  I
note that EXTPG mbufs always have M_RDONLY set, but I'm not quite sure
why.  I suspect such mbufs need special handling with respect to the new
assertion.

syzbot also triggered this panic:
https://syzkaller.appspot.com/bug?extid=58c918369f9dc323409d


Yeah, I saw that one before I went out for a bike ride.

Clearly something is wrong. Either ktls is using read-only buffers or the 
M_WRITABLE() macro isn’t quite smart enough to spot this specific case.

I’m not familiar enough with ktls to easily tell which.

I’ll back this assertion change out for now, so we’re not panicing test 
machines while we figure this out.

Best regards,
Kristof





--
John Baldwin




Re: git: f08247fd888e - main - Assert that mbufs are writable if we write to them

2024-09-12 Thread John Baldwin

On 9/12/24 05:03, John Baldwin wrote:

I think part of the motivation for marking M_EXTPG as read-only is that you can't 
"write"
to m_data via mtod() or the like.  That said, M_EXTPG aren't really read-only.  
It
depends on the backing store.  M_EXTPG were first merged into FreeBSD prior to 
KTLS to
support sendfile, and in that case, they should be M_RDONLY because they alias 
pages
from the file's VM object.  However, M_EXTPG mbufs allocated via functions like
m_uiotombuf_nomap should not be M_RDONLY.  I think this originated in the 
original
import of KTLS which doesn't push setting M_RDONLY out to the callers of 
mb_alloc_extpgs,
and a few other places that hardcode M_RDONLY with M_EXTPG (_mb_unmapped_to_ext 
should
preserve M_RDONLY from the original mbuf instead of forcing M_RDONLY).

I can take a stab at a patch but won't have time to really test it until after 
Euro.


Patch available below.  Compile tested but not run-tested:

https://github.com/freebsd/freebsd-src/compare/main...bsdjhb:freebsd:m_extpg_rdonly


On 9/11/24 16:56, Drew Gallatin wrote:

M_EXTPGS mbufs are marked read-only because they refer to external data.   The 
original crypto code, (before kTLS was converted to OCF), used to just build an 
iovec using PHYS_TO_DMAP() on the page array.  I think this case was missed 
during the conversion to OCF.

I'm not sure what the best thing to do is, as they should be read only, except 
this one specific case I'd be tempted to just nerf the KASSERT for EXTPGS.

On Wed, Sep 11, 2024, at 11:02 AM, Kristof Provost wrote:

On 11 Sep 2024, at 16:45, Mark Johnston wrote:

On Wed, Sep 11, 2024 at 11:18:26AM +, Kristof Provost wrote:

The branch main has been updated by kp:

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

commit f08247fd888e6f7db0ecf2aaa39377144ac40b4c
Author: Kristof Provost 
AuthorDate: 2024-09-10 20:15:31 +
Commit: Kristof Provost 
CommitDate: 2024-09-11 11:17:48 +

  Assert that mbufs are writable if we write to them

  m_copyback() modifies the mbuf, so it must be a writable mbuf.


This change still triggers a panic for me when running KTLS tests.  I
note that EXTPG mbufs always have M_RDONLY set, but I'm not quite sure
why.  I suspect such mbufs need special handling with respect to the new
assertion.

syzbot also triggered this panic:
https://syzkaller.appspot.com/bug?extid=58c918369f9dc323409d


Yeah, I saw that one before I went out for a bike ride.

Clearly something is wrong. Either ktls is using read-only buffers or the 
M_WRITABLE() macro isn’t quite smart enough to spot this specific case.

I’m not familiar enough with ktls to easily tell which.

I’ll back this assertion change out for now, so we’re not panicing test 
machines while we figure this out.

Best regards,
Kristof







--
John Baldwin




git: 03713f805a91 - main - pci_host_generic: Tolerate range resource allocation failures

2024-04-09 Thread John Baldwin
The branch main has been updated by jhb:

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

commit 03713f805a91749eabcfb2e23e86489b2d4034df
Author: John Baldwin 
AuthorDate: 2024-04-09 21:55:40 +
Commit: John Baldwin 
CommitDate: 2024-04-09 21:55:40 +

pci_host_generic: Tolerate range resource allocation failures

QEMU for armv7 includes a PCI memory range whose CPU address is
greater than 4GB.  This falls outside the range of armv7's global
mem_rman used by the nexus driver.  As a result, pcib0 fails to
attach blocking all PCI devices.

Instead, change the driver to be a bit more tolerant.  If allocating a
resource for a range fails, don't fail attaching the entire driver,
but do skip adding the associated PCI range to the relevant rman in
the pcib driver.  This will prevent child devices from using BARs that
allocate from this range.  In the case of QEMU on armv7 devices can
still allocate from an earlier PCI memory range that is within the
32-bit address space (and in fact none of the firmware-assigned memory
BARs use addresses from the upper range).

While here, reorder the operations on I/O ranges a bit: 1) print the
range under bootverbose first (rather than last) so that the range is
printed before any relevant errors for the range, 2) move
rman_manage_region last after the parent resource has been set and
allocated.

Reported by:markj, Jenkins
Reviewed by:markj
Fixes:  d79b6b8ec267 pci_host_generic: Don't rewrite resource start 
address for translation
Differential Revision:  https://reviews.freebsd.org/D44698
---
 sys/dev/pci/pci_host_generic.c | 55 --
 1 file changed, 16 insertions(+), 39 deletions(-)

diff --git a/sys/dev/pci/pci_host_generic.c b/sys/dev/pci/pci_host_generic.c
index 0bdc121f9727..82ed51460621 100644
--- a/sys/dev/pci/pci_host_generic.c
+++ b/sys/dev/pci/pci_host_generic.c
@@ -80,6 +80,7 @@ pci_host_generic_core_attach(device_t dev)
struct resource_map map;
 #endif
struct generic_pcie_core_softc *sc;
+   struct rman *rm;
uint64_t phys_base;
uint64_t pci_base;
uint64_t size;
@@ -183,75 +184,51 @@ pci_host_generic_core_attach(device_t dev)
range_descr = "prefetch";
flags = RF_PREFETCHABLE;
type = SYS_RES_MEMORY;
-   error = rman_manage_region(&sc->pmem_rman,
-  pci_base, pci_base + size - 1);
+   rm = &sc->pmem_rman;
break;
case FLAG_TYPE_MEM:
range_descr = "memory";
flags = 0;
type = SYS_RES_MEMORY;
-   error = rman_manage_region(&sc->mem_rman,
-  pci_base, pci_base + size - 1);
+   rm = &sc->mem_rman;
break;
case FLAG_TYPE_IO:
range_descr = "I/O port";
flags = 0;
type = SYS_RES_IOPORT;
-   error = rman_manage_region(&sc->io_rman,
-  pci_base, pci_base + size - 1);
+   rm = &sc->io_rman;
break;
default:
continue;
}
-   if (error) {
-   device_printf(dev, "rman_manage_region() failed."
-   "error = %d\n", error);
-   goto err_rman_manage;
-   }
+   if (bootverbose)
+   device_printf(dev,
+   "PCI addr: 0x%jx, CPU addr: 0x%jx, Size: 0x%jx, 
Type: %s\n",
+   pci_base, phys_base, size, range_descr);
error = bus_set_resource(dev, type, rid, phys_base, size);
if (error != 0) {
device_printf(dev,
"failed to set resource for range %d: %d\n", tuple,
error);
-   goto err_rman_manage;
+   continue;
}
sc->ranges[tuple].res = bus_alloc_resource_any(dev, type, &rid,
RF_ACTIVE | RF_UNMAPPED | flags);
if (sc->ranges[tuple].res == NULL) {
device_printf(dev,
"failed to allocate resource for range %d\n", 
tuple);
-   error = ENXIO;
-   goto err_rman_manage;
+   continue;
+   }
+   error = rman_man

git: 973d3a82096b - main - NOTES: Move OFED options to MI NOTES

2024-04-09 Thread John Baldwin
The branch main has been updated by jhb:

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

commit 973d3a82096bc135f6c230e348e2f33c382096bc
Author: John Baldwin 
AuthorDate: 2024-04-09 22:02:58 +
Commit: John Baldwin 
CommitDate: 2024-04-09 22:02:58 +

NOTES: Move OFED options to MI NOTES

Disable in armv7 NOTES to match sys/modules/Makefile

Reviewed by:imp
Sponsored by:   Chelsio Communications
Differential Revision:  https://reviews.freebsd.org/D44686
---
 sys/amd64/conf/NOTES | 13 -
 sys/arm/conf/NOTES   |  5 +
 sys/conf/NOTES   | 13 +
 sys/i386/conf/NOTES  | 13 -
 4 files changed, 18 insertions(+), 26 deletions(-)

diff --git a/sys/amd64/conf/NOTES b/sys/amd64/conf/NOTES
index 9c91a4fa9bbb..761728337ac2 100644
--- a/sys/amd64/conf/NOTES
+++ b/sys/amd64/conf/NOTES
@@ -90,19 +90,6 @@ options  DEVICE_POLLING
 
 optionsBPF_JITTER
 
-# OpenFabrics Enterprise Distribution (Infiniband).
-optionsOFED
-optionsOFED_DEBUG_INIT
-
-# Sockets Direct Protocol
-optionsSDP
-optionsSDP_DEBUG
-
-# IP over Infiniband
-optionsIPOIB
-optionsIPOIB_DEBUG
-optionsIPOIB_CM
-
 
 #
 # CLOCK OPTIONS
diff --git a/sys/arm/conf/NOTES b/sys/arm/conf/NOTES
index 1eecd2534977..9d084096e66f 100644
--- a/sys/arm/conf/NOTES
+++ b/sys/arm/conf/NOTES
@@ -74,6 +74,11 @@ nooptionsCOMPAT_FREEBSD9
 nooptions  PPC_PROBE_CHIPSET
 nooptions  MAXCPU  # value is set in machine/param.h
 
+nooptions  OFED
+nooptions  SDP
+nooptions  IPOIB
+nooptions  IPOIB_CM
+
 nodevice   sym
 
 nodevice   ccr
diff --git a/sys/conf/NOTES b/sys/conf/NOTES
index b12d5def2d57..e41e89c30130 100644
--- a/sys/conf/NOTES
+++ b/sys/conf/NOTES
@@ -771,6 +771,19 @@ optionsSCTP_PACKET_LOGGING
 optionsSCTP_LTRACE_CHUNKS
 optionsSCTP_LTRACE_ERRORS
 
+# OpenFabrics Enterprise Distribution (Infiniband).
+optionsOFED
+optionsOFED_DEBUG_INIT
+
+# Sockets Direct Protocol
+optionsSDP
+optionsSDP_DEBUG
+
+# IP over Infiniband
+optionsIPOIB
+optionsIPOIB_DEBUG
+optionsIPOIB_CM
+
 # altq(9). Enable the base part of the hooks with the ALTQ option.
 # Individual disciplines must be built into the base system and can not be
 # loaded as modules at this point. ALTQ requires a stable TSC so if yours is
diff --git a/sys/i386/conf/NOTES b/sys/i386/conf/NOTES
index ce115b1640e0..45613c10c583 100644
--- a/sys/i386/conf/NOTES
+++ b/sys/i386/conf/NOTES
@@ -238,19 +238,6 @@ optionsDEVICE_POLLING
 
 optionsBPF_JITTER
 
-# OpenFabrics Enterprise Distribution (Infiniband).
-optionsOFED
-optionsOFED_DEBUG_INIT
-
-# Sockets Direct Protocol
-optionsSDP
-optionsSDP_DEBUG
-
-# IP over Infiniband
-optionsIPOIB
-optionsIPOIB_DEBUG
-optionsIPOIB_CM
-
 
 #
 # CLOCK OPTIONS



git: 60bb979b3c32 - main - iser: Add kernel build glue

2024-04-09 Thread John Baldwin
The branch main has been updated by jhb:

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

commit 60bb979b3c3224f01e96f7e3c92a270977d2587b
Author: John Baldwin 
AuthorDate: 2024-04-09 22:02:58 +
Commit: John Baldwin 
CommitDate: 2024-04-09 22:02:58 +

iser: Add kernel build glue

'device iser' is documented in iser(4) but not supported.  Hook it up
to the build.

Reviewed by:imp
Sponsored by:   Chelsio Communications
Differential Revision:  https://reviews.freebsd.org/D44687
---
 sys/conf/files | 8 
 1 file changed, 8 insertions(+)

diff --git a/sys/conf/files b/sys/conf/files
index 549a3590f76b..68f8060e61ad 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -1891,6 +1891,14 @@ dev/iscsi/icl_conn_if.m  optional cfiscsi | iscsi
 dev/iscsi/icl_soft.c   optional iscsi
 dev/iscsi/icl_soft_proxy.c optional iscsi
 dev/iscsi/iscsi.c  optional iscsi scbus
+dev/iser/icl_iser.coptional iser   \
+   compile-with "${OFED_C} -DICL_KERNEL_PROXY"
+dev/iser/iser_initiator.c  optional iser   \
+   compile-with "${OFED_C} -DICL_KERNEL_PROXY"
+dev/iser/iser_memory.c optional iser   \
+   compile-with "${OFED_C} -DICL_KERNEL_PROXY"
+dev/iser/iser_verbs.c  optional iser   \
+   compile-with "${OFED_C} -DICL_KERNEL_PROXY"
 dev/ismt/ismt.coptional ismt
 dev/isl/isl.c  optional isl iicbus
 dev/isp/isp.c  optional isp



git: 76f22e353f66 - main - NOTES: Add devices for iSCSI support

2024-04-09 Thread John Baldwin
The branch main has been updated by jhb:

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

commit 76f22e353f66d9ec1c1bea1d72eeec56078d4728
Author: John Baldwin 
AuthorDate: 2024-04-09 22:02:58 +
Commit: John Baldwin 
CommitDate: 2024-04-09 22:02:58 +

NOTES: Add devices for iSCSI support

Reviewed by:imp
Sponsored by:   Chelsio Communications
Differential Revision:  https://reviews.freebsd.org/D44688
---
 sys/arm/conf/NOTES |  1 +
 sys/conf/NOTES | 17 +
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/sys/arm/conf/NOTES b/sys/arm/conf/NOTES
index 9d084096e66f..db7da3ff1ea6 100644
--- a/sys/arm/conf/NOTES
+++ b/sys/arm/conf/NOTES
@@ -79,6 +79,7 @@ nooptions SDP
 nooptions  IPOIB
 nooptions  IPOIB_CM
 
+nodevice   iser
 nodevice   sym
 
 nodevice   ccr
diff --git a/sys/conf/NOTES b/sys/conf/NOTES
index e41e89c30130..b15f2fdd22f5 100644
--- a/sys/conf/NOTES
+++ b/sys/conf/NOTES
@@ -1461,6 +1461,19 @@ options  SCSI_PT_DEFAULT_TIMEOUT=60
 # a topology with the SES device that's on the box these drives are in
 optionsSES_ENABLE_PASSTHROUGH
 
+# iSCSI
+#
+# iSCSI permits access to SCSI peripherals over a network connection
+# (e.g. via a TCP/IP socket)
+
+device cfiscsi # CAM Target Layer iSCSI target frontend
+device iscsi   # iSCSI initiator
+device iser# iSCSI Extensions for RDMA (iSER) initiator
+
+# Options used in dev/iscsi (Software iSCSI stack)
+#
+optionsISCSI_INITIATOR_DEBUG=9
+
 
 #
 # MISCELLANEOUS DEVICES AND OPTIONS
@@ -1620,10 +1633,6 @@ options  AHD_REG_PRETTY_PRINT
 # Bitmap of units to enable targetmode operations.
 optionsAHD_TMODE_ENABLE
 
-# Options used in dev/iscsi (Software iSCSI stack)
-#
-optionsISCSI_INITIATOR_DEBUG=9
-
 # Options used in dev/isp/ (Qlogic SCSI/FC driver).
 #
 #  ISP_TARGET_MODE -   enable target mode operation



git: a508f5d92a93 - main - NOTES: Tidy entries for SATA controllers

2024-04-09 Thread John Baldwin
The branch main has been updated by jhb:

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

commit a508f5d92a93cda11b0c68084dbb181f97e7f5f7
Author: John Baldwin 
AuthorDate: 2024-04-09 22:02:58 +
Commit: John Baldwin 
CommitDate: 2024-04-09 22:02:58 +

NOTES: Tidy entries for SATA controllers

- Add typical comments after device entries (copied from amd64
  GENERIC)

- Add an entry for 'device ada'.  Normally this is pulled in via
  'device sd', but is documented in ada(4) and can be used to include
  ATA/SATA disk support in a kernel without SCSI disk support.

Reviewed by:imp
Sponsored by:   Chelsio Communications
Differential Revision:  https://reviews.freebsd.org/D44689
---
 sys/conf/NOTES | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/sys/conf/NOTES b/sys/conf/NOTES
index b15f2fdd22f5..cf447004cb92 100644
--- a/sys/conf/NOTES
+++ b/sys/conf/NOTES
@@ -1685,9 +1685,10 @@ device   mrsas   # LSI/Avago MegaRAID 
SAS/SATA, 6Gb/s and 12Gb/s
 # These drivers are part of cam(4) subsystem. They supersede less featured
 # ata(4) subsystem drivers, supporting same hardware.
 
-device ahci
-device mvs
-device siis
+device ahci# AHCI-compatible SATA controllers
+device mvs # Marvell 88SX50XX/88SX60XX/88SX70XX/SoC SATA
+device siis# SiliconImage SiI3124/SiI3132/SiI3531 SATA
+device ada # ATA/SATA direct access devices (aka disks)
 
 #
 # The 'ATA' driver supports all legacy ATA/ATAPI controllers, including
@@ -1697,7 +1698,7 @@ devicesiis
 # the 'atacore' driver then selecting the drivers on a per vendor basis.
 # For example to build a system which only supports a VIA chipset,
 # omit 'ata' and include the 'atacore', 'atapci' and 'atavia' drivers.
-device ata
+device ata # Legacy ATA/SATA controllers
 
 # Modular ATA
 #deviceatacore # Core ATA functionality



git: 16e846fa1ed3 - main - sys: Enable NVMe drivers on all architectures

2024-04-09 Thread John Baldwin
The branch main has been updated by jhb:

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

commit 16e846fa1ed3c97419b55b292f77b0f4209f0875
Author: John Baldwin 
AuthorDate: 2024-04-09 22:02:58 +
Commit: John Baldwin 
CommitDate: 2024-04-09 22:02:58 +

sys: Enable NVMe drivers on all architectures

The NVMe drivers are portable and are already included statically in
GENERIC on other architectures such as aarch64 and riscv64.

Reviewed by:imp
Sponsored by:   Chelsio Communications
Differential Revision:  https://reviews.freebsd.org/D44690
---
 share/man/man4/Makefile | 11 ++-
 sys/modules/Makefile|  8 ++--
 2 files changed, 4 insertions(+), 15 deletions(-)

diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile
index c3f5e3223bf9..b668cccf50ae 100644
--- a/share/man/man4/Makefile
+++ b/share/man/man4/Makefile
@@ -404,9 +404,9 @@ MAN=aac.4 \
${_if_ntb.4} \
null.4 \
numa.4 \
-   ${_nvd.4} \
+   nvd.4 \
${_nvdimm.4} \
-   ${_nvme.4} \
+   nvme.4 \
${_nvram.4} \
oce.4 \
ocs_fc.4\
@@ -836,8 +836,6 @@ _ntb_hw_amd.4=  ntb_hw_amd.4
 _ntb_hw_intel.4=   ntb_hw_intel.4
 _ntb_hw_plx.4= ntb_hw_plx.4
 _ntb_transport.4=ntb_transport.4
-_nvd.4=nvd.4
-_nvme.4=   nvme.4
 _nvram.4=  nvram.4
 _padlock.4=padlock.4
 _pchtherm.4=   pchtherm.4
@@ -885,11 +883,6 @@ _vmm.4=vmm.4
 .endif
 .endif
 
-.if ${MACHINE_CPUARCH} == "powerpc"
-_nvd.4=nvd.4
-_nvme.4=   nvme.4
-.endif
-
 .if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" || \
 ${MACHINE_CPUARCH} == "aarch64"
 _gve.4=gve.4
diff --git a/sys/modules/Makefile b/sys/modules/Makefile
index 748b0b18a14d..aab0865a842d 100644
--- a/sys/modules/Makefile
+++ b/sys/modules/Makefile
@@ -290,9 +290,9 @@ SUBDIR= \
nmdm \
nullfs \
${_ntb} \
-   ${_nvd} \
+   nvd \
${_nvdimm} \
-   ${_nvme} \
+   nvme \
${_nvram} \
oce \
${_ocs_fc} \
@@ -795,8 +795,6 @@ _iwmfw= iwmfw
 _iwnfw=iwnfw
 .endif
 _nfe=  nfe
-_nvd=  nvd
-_nvme= nvme
 _nvram=nvram
 .if ${MK_CRYPT} != "no" || defined(ALL_MODULES)
 _padlock=  padlock
@@ -880,8 +878,6 @@ _cfi=   cfi
 _cpufreq=  cpufreq
 _exca= exca
 _ffec= ffec
-_nvd=  nvd
-_nvme= nvme
 .endif
 
 .if ${MACHINE_ARCH:Mpowerpc64*} != ""



git: 8f7105a20697 - main - NOTES: Move NVMe entries to MI file

2024-04-09 Thread John Baldwin
The branch main has been updated by jhb:

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

commit 8f7105a20697d47060dbedc966cf085a64aeced6
Author: John Baldwin 
AuthorDate: 2024-04-09 22:02:58 +
Commit: John Baldwin 
CommitDate: 2024-04-09 22:02:58 +

NOTES: Move NVMe entries to MI file

While here, adjust the sample setting for NVME_USE_NVD to use a
non-default setting as is typical in entries in NOTES.

Discussed with: imp
Reviewed by:manu
Sponsored by:   Chelsio Communications
Differential Revision:  https://reviews.freebsd.org/D44691
---
 sys/amd64/conf/NOTES |  5 -
 sys/arm64/conf/NOTES |  5 -
 sys/conf/NOTES   | 11 +++
 sys/i386/conf/NOTES  |  5 -
 sys/riscv/conf/NOTES |  5 -
 5 files changed, 11 insertions(+), 20 deletions(-)

diff --git a/sys/amd64/conf/NOTES b/sys/amd64/conf/NOTES
index 761728337ac2..39ecfb529be5 100644
--- a/sys/amd64/conf/NOTES
+++ b/sys/amd64/conf/NOTES
@@ -439,11 +439,6 @@ device imcsmb
 device isci
 optionsISCI_LOGGING# enable debugging in isci HAL
 
-#
-# NVM Express (NVMe) support
-device nvme# base NVMe driver
-device nvd # expose NVMe namespaces as disks, depends on nvme
-
 #
 # Intel Volume Management Device (VMD) support
 device vmd
diff --git a/sys/arm64/conf/NOTES b/sys/arm64/conf/NOTES
index 21b1b22a5f01..91455d6032b9 100644
--- a/sys/arm64/conf/NOTES
+++ b/sys/arm64/conf/NOTES
@@ -102,11 +102,6 @@ device ice_ddp # Intel 800 Series DDP 
Package
 # Etherswitch devices
 device e6000sw # Marvell mv88e6085 based switches
 
-# NVM Express (NVMe) support
-device nvme# base NVMe driver
-optionsNVME_USE_NVD=0  # prefer the cam(4) based nda(4) driver
-device nvd # expose NVMe namespaces as disks, depends on 
nvme
-
 # MMC/SD/SDIO Card slot support
 device sdhci_xenon # Marvell Xenon SD/MMC controller
 device aw_mmc  # Allwinner SD/MMC controller
diff --git a/sys/conf/NOTES b/sys/conf/NOTES
index cf447004cb92..e3332ee20120 100644
--- a/sys/conf/NOTES
+++ b/sys/conf/NOTES
@@ -1675,6 +1675,17 @@ device   mfip# LSI MegaRAID SAS 
passthrough, requires CAM
 optionsMFI_DEBUG
 device mrsas   # LSI/Avago MegaRAID SAS/SATA, 6Gb/s and 12Gb/s
 
+# NVM Express
+#
+# nvme:PCI-express NVM Express host controllers
+# nda: CAM NVMe disk driver
+# nvd: non-CAM NVMe disk driver
+
+device nvme# base NVMe driver
+optionsNVME_USE_NVD=1  # Use nvd(4) instead of the CAM nda(4) driver
+device nda # NVMe direct access devices (aka disks)
+device nvd # expose NVMe namespaces as disks, depends on 
nvme
+
 #
 # Serial ATA host controllers:
 #
diff --git a/sys/i386/conf/NOTES b/sys/i386/conf/NOTES
index 45613c10c583..6692a9dba10e 100644
--- a/sys/i386/conf/NOTES
+++ b/sys/i386/conf/NOTES
@@ -634,11 +634,6 @@ device ips
 device isci
 optionsISCI_LOGGING# enable debugging in isci HAL
 
-#
-# NVM Express (NVMe) support
-device nvme# base NVMe driver
-device nvd # expose NVMe namespaces as disks, depends on nvme
-
 #
 # Intel Volume Management Device (VMD) support
 device vmd
diff --git a/sys/riscv/conf/NOTES b/sys/riscv/conf/NOTES
index f6b27a626dfb..d818fd0581c3 100644
--- a/sys/riscv/conf/NOTES
+++ b/sys/riscv/conf/NOTES
@@ -40,11 +40,6 @@ device   virtio_blk  # VirtIO Block 
device
 device virtio_mmio # VirtIO MMIO bus
 device virtio_random   # VirtIO Entropy device
 
-# NVM Express (NVMe) support
-device nvme# base NVMe driver
-optionsNVME_USE_NVD=0  # prefer the cam(4) based nda(4) driver
-device nvd # expose NVMe namespaces as disks, depends on 
nvme
-
 # MMC/SD/SDIO Card slot support
 device dwmmc
 



Re: git: 65c603ed65c7 - main - release: distributekernel before packagekernel

2024-04-10 Thread John Baldwin

On 4/9/24 11:29 PM, Colin Percival wrote:

The branch main has been updated by cperciva:

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

commit 65c603ed65c700d6eacdf9e1e94dc42fd70fb0b7
Author: Colin Percival 
AuthorDate: 2024-04-10 03:26:51 +
Commit: Colin Percival 
CommitDate: 2024-04-10 03:29:16 +

 release: distributekernel before packagekernel
 
 With these as a single make command, `make -j` breaks when it tries to

 package up a kernel which hasn't been distributed yet.
 
 MFC after:  1 week


Hmm, should this section of the toplevel Makefile be updated instead?

ORDER: buildworld installworld
ORDER: buildworld distrib-dirs
ORDER: buildworld distribution
ORDER: buildworld distribute
ORDER: buildworld distributeworld
ORDER: buildworld buildkernel
ORDER: distrib-dirs distribute
ORDER: distrib-dirs distributeworld
ORDER: distrib-dirs installworld
ORDER: distribution distribute
ORDER: distributeworld distribute
ORDER: distributeworld distribution
ORDER: installworld distribute
ORDER: installworld distribution
ORDER: installworld installkernel
ORDER: buildkernel installkernel
ORDER: buildkernel installkernel.debug
ORDER: buildkernel reinstallkernel
ORDER: buildkernel reinstallkernel.debug
ORDER: kernel-toolchain buildkernel

Seems like explicit .ORDER's for the various package* targets might be useful in
general.

--
John Baldwin




Re: git: 65c603ed65c7 - main - release: distributekernel before packagekernel

2024-04-10 Thread John Baldwin

On 4/10/24 11:51 AM, Colin Percival wrote:

On 4/10/24 08:29, John Baldwin wrote:

On 4/9/24 11:29 PM, Colin Percival wrote:

  release: distributekernel before packagekernel
  With these as a single make command, `make -j` breaks when it tries to
  package up a kernel which hasn't been distributed yet.
  MFC after:  1 week


Hmm, should this section of the toplevel Makefile be updated instead?
[...]

Seems like explicit .ORDER's for the various package* targets might be useful in
general.


I tried that, but the release build was still breaking.  I wanted to make sure
that I got this into the tree before we start 14.1 builds so I went with the
option which was guaranteed to work rather than tracking down why.


Sounds reasonable.

--
John Baldwin




git: 7c7299df76e2 - main - libc: Remove support for pre-C99 C standards

2024-04-12 Thread John Baldwin
The branch main has been updated by jhb:

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

commit 7c7299df76e2c4b43a2a52d0df66ee977bb6773b
Author: Minsoo Choo 
AuthorDate: 2024-04-12 19:05:09 +
Commit: John Baldwin 
CommitDate: 2024-04-12 19:05:09 +

libc: Remove support for pre-C99 C standards

Reviewed by:jhb
Differential Revision:  https://reviews.freebsd.org/D43254
---
 lib/libc/stdlib/div.c | 30 +-
 lib/libc/stdlib/imaxdiv.c |  7 +--
 lib/libc/stdlib/ldiv.c|  7 +--
 lib/libc/stdlib/lldiv.c   |  7 +--
 4 files changed, 4 insertions(+), 47 deletions(-)

diff --git a/lib/libc/stdlib/div.c b/lib/libc/stdlib/div.c
index af6f95553435..351dca870553 100644
--- a/lib/libc/stdlib/div.c
+++ b/lib/libc/stdlib/div.c
@@ -41,34 +41,6 @@ div(int num, int denom)
 
r.quot = num / denom;
r.rem = num % denom;
-#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L)
-   /*
-* The ANSI standard says that |r.quot| <= |n/d|, where
-* n/d is to be computed in infinite precision.  In other
-* words, we should always truncate the quotient towards
-* 0, never -infinity.
-*
-* Machine division and remainer may work either way when
-* one or both of n or d is negative.  If only one is
-* negative and r.quot has been truncated towards -inf,
-* r.rem will have the same sign as denom and the opposite
-* sign of num; if both are negative and r.quot has been
-* truncated towards -inf, r.rem will be positive (will
-* have the opposite sign of num).  These are considered
-* `wrong'.
-*
-* If both are num and denom are positive, r will always
-* be positive.
-*
-* This all boils down to:
-*  if num >= 0, but r.rem < 0, we got the wrong answer.
-* In that case, to get the right answer, add 1 to r.quot and
-* subtract denom from r.rem.
-*/
-   if (num >= 0 && r.rem < 0) {
-   r.quot++;
-   r.rem -= denom;
-   }
-#endif
+
return (r);
 }
diff --git a/lib/libc/stdlib/imaxdiv.c b/lib/libc/stdlib/imaxdiv.c
index de72ead031d5..bf9737a3c47a 100644
--- a/lib/libc/stdlib/imaxdiv.c
+++ b/lib/libc/stdlib/imaxdiv.c
@@ -36,11 +36,6 @@ imaxdiv(intmax_t numer, intmax_t denom)
 
retval.quot = numer / denom;
retval.rem = numer % denom;
-#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L)
-   if (numer >= 0 && retval.rem < 0) {
-   retval.quot++;
-   retval.rem -= denom;
-   }
-#endif
+
return (retval);
 }
diff --git a/lib/libc/stdlib/ldiv.c b/lib/libc/stdlib/ldiv.c
index 999e8472042d..4c73bcc14af4 100644
--- a/lib/libc/stdlib/ldiv.c
+++ b/lib/libc/stdlib/ldiv.c
@@ -43,11 +43,6 @@ ldiv(long num, long denom)
 
r.quot = num / denom;
r.rem = num % denom;
-#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L)
-   if (num >= 0 && r.rem < 0) {
-   r.quot++;
-   r.rem -= denom;
-   }
-#endif
+
return (r);
 }
diff --git a/lib/libc/stdlib/lldiv.c b/lib/libc/stdlib/lldiv.c
index f7030e7ae1ff..6feeb74bacd6 100644
--- a/lib/libc/stdlib/lldiv.c
+++ b/lib/libc/stdlib/lldiv.c
@@ -36,11 +36,6 @@ lldiv(long long numer, long long denom)
 
retval.quot = numer / denom;
retval.rem = numer % denom;
-#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L)
-   if (numer >= 0 && retval.rem < 0) {
-   retval.quot++;
-   retval.rem -= denom;
-   }
-#endif
+
return (retval);
 }



git: e6e38bc522e2 - main - rc.d/ldconfig: Compute ldconfig paths in a function

2024-04-12 Thread John Baldwin
The branch main has been updated by jhb:

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

commit e6e38bc522e29de6299536b547bf11dab11e9679
Author: Konrad Witaszczyk 
AuthorDate: 2024-04-12 21:34:59 +
Commit: John Baldwin 
CommitDate: 2024-04-12 21:34:59 +

rc.d/ldconfig: Compute ldconfig paths in a function

Move logic that computes paths passed to ldconfig(8) to a
ldconfig_paths() function that can be called for multiple ABIs.

Reviewed by:olce, kib
Obtained from:  CheriBSD
Differential Revision:  https://reviews.freebsd.org/D44751
---
 libexec/rc/rc.d/ldconfig | 55 +---
 1 file changed, 29 insertions(+), 26 deletions(-)

diff --git a/libexec/rc/rc.d/ldconfig b/libexec/rc/rc.d/ldconfig
index 5c404a823dbb..fd54b2d3444e 100755
--- a/libexec/rc/rc.d/ldconfig
+++ b/libexec/rc/rc.d/ldconfig
@@ -14,6 +14,31 @@ ldconfig_command="/sbin/ldconfig"
 start_cmd="ldconfig_start"
 stop_cmd=":"
 
+ldconfig_paths()
+{
+   local _dirs _files _ii _ldpaths _paths
+
+   _dirs="${1}"
+   _paths="${2}"
+   _ldpaths="${3}"
+
+   for _ii in ${_dirs}; do
+   if [ -d "${_ii}" ]; then
+   _files=`find ${_ii} -type f`
+   if [ -n "${_files}" ]; then
+   _paths="${_paths} `cat ${_files} | sort -u`"
+   fi
+   fi
+   done
+   for _ii in ${_paths}; do
+   if [ -r "${_ii}" ]; then
+   _ldpaths="${_ldpaths} ${_ii}"
+   fi
+   done
+
+   echo "${_ldpaths}"
+}
+
 ldconfig_start()
 {
local _files _ins
@@ -23,31 +48,12 @@ ldconfig_start()
checkyesno ldconfig_insecure && _ins="-i"
if [ -x "${ldconfig_command}" ]; then
_LDC=$(/libexec/ld-elf.so.1 -v | sed -n -e '/^Default lib path 
/s///p' | tr : ' ')
-   for i in ${ldconfig_local_dirs}; do
-   if [ -d "${i}" ]; then
-   _files=`find ${i} -type f`
-   if [ -n "${_files}" ]; then
-   ldconfig_paths="${ldconfig_paths} `cat 
${_files} | sort -u`"
-   fi
-   fi
-   done
-   for i in ${ldconfig_paths} /etc/ld-elf.so.conf; do
-   if [ -r "${i}" ]; then
-   _LDC="${_LDC} ${i}"
-   fi
-   done
+   _LDC=$(ldconfig_paths "${ldconfig_local_dirs}" \
+   "${ldconfig_paths} /etc/ld-elf.so.conf" "$_LDC")
startmsg 'ELF ldconfig path:' ${_LDC}
${ldconfig} -elf ${_ins} ${_LDC}
 
if check_kern_features compat_freebsd32; then
-   for i in ${ldconfig_local32_dirs}; do
-   if [ -d "${i}" ]; then
-   _files=`find ${i} -type f`
-   if [ -n "${_files}" ]; then
-   
ldconfig32_paths="${ldconfig32_paths} `cat ${_files} | sort -u`"
-   fi
-   fi
-   done
_LDC=""
if [ -x /libexec/ld-elf32.so.1 ]; then
for x in $(/libexec/ld-elf32.so.1 -v | sed -n 
-e '/^Default lib path /s///p' | tr : ' '); do
@@ -56,11 +62,8 @@ ldconfig_start()
fi
done
fi
-   for i in ${ldconfig32_paths}; do
-   if [ -r "${i}" ]; then
-   _LDC="${_LDC} ${i}"
-   fi
-   done
+   _LDC=$(ldconfig_paths "${ldconfig_local32_dirs}" \
+   "${ldconfig32_paths}" "$_LDC")
startmsg '32-bit compatibility ldconfig path:' ${_LDC}
${ldconfig} -32 ${_ins} ${_LDC}
fi



git: 4bf5db113f76 - main - defaults/rc.conf: Remove /usr/lib32 from ldconfig32_paths

2024-04-12 Thread John Baldwin
The branch main has been updated by jhb:

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

commit 4bf5db113f760619bf754c22864b1d7e2acdeabd
Author: John Baldwin 
AuthorDate: 2024-04-12 21:35:23 +
Commit: John Baldwin 
CommitDate: 2024-04-12 21:35:23 +

defaults/rc.conf: Remove /usr/lib32 from ldconfig32_paths

Commit 99132daf6f70cb0cc969c555d3612547fa3cf1db prepends /usr/lib32 to
the list of paths in ldconfig32_paths since it is a standard library
path in ld-elf32.so.1.  Remove /usr/lib32 from the value in rc.conf so
that it is not listed twice.

Reviewed by:olce, kib
Sponsored by:   University of Cambridge, Google, Inc.
Differential Revision:  https://reviews.freebsd.org/D44752
---
 libexec/rc/rc.conf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libexec/rc/rc.conf b/libexec/rc/rc.conf
index 2fa3b676cb38..96dd0c534dc2 100644
--- a/libexec/rc/rc.conf
+++ b/libexec/rc/rc.conf
@@ -674,7 +674,7 @@ clear_tmp_X="YES"   # Clear and recreate X11-related 
directories in /tmp
 ldconfig_insecure="NO" # Set to YES to disable ldconfig security checks
 ldconfig_paths="/usr/lib/compat ${_localbase}/lib ${_localbase}/lib/compat/pkg"
# shared library search paths
-ldconfig32_paths="/usr/lib32 /usr/lib32/compat"
+ldconfig32_paths="/usr/lib32/compat"
# 32-bit compatibility shared library search paths
 ldconfig_local_dirs="${_localbase}/libdata/ldconfig"
# Local directories with ldconfig configuration files.



git: b9c6fa339d9c - main - files.x86: Pull in some more duplicate lines from files.{amd64,i386}

2024-04-12 Thread John Baldwin
The branch main has been updated by jhb:

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

commit b9c6fa339d9c7c90a1c0f9ebc000ecbde8873508
Author: John Baldwin 
AuthorDate: 2024-04-12 21:35:45 +
Commit: John Baldwin 
CommitDate: 2024-04-12 21:35:45 +

files.x86: Pull in some more duplicate lines from files.{amd64,i386}

Reviewed by:imp
Differential Revision:  https://reviews.freebsd.org/D44759
---
 sys/conf/files.amd64 | 32 +---
 sys/conf/files.i386  | 32 
 sys/conf/files.x86   | 32 
 3 files changed, 33 insertions(+), 63 deletions(-)

diff --git a/sys/conf/files.amd64 b/sys/conf/files.amd64
index 09478599efc5..6322837c887b 100644
--- a/sys/conf/files.amd64
+++ b/sys/conf/files.amd64
@@ -109,10 +109,6 @@ crypto/openssl/amd64/sha1-x86_64.S optional ossl
 crypto/openssl/amd64/sha256-x86_64.S   optional ossl
 crypto/openssl/amd64/sha512-x86_64.S   optional ossl
 crypto/openssl/amd64/ossl_aes_gcm.coptional ossl
-dev/acpi_support/acpi_wmi_if.m standard
-dev/agp/agp_amd64.coptionalagp
-dev/agp/agp_i810.c optionalagp
-dev/agp/agp_via.c  optionalagp
 dev/amdgpio/amdgpio.c  optionalamdgpio
 dev/axgbe/if_axgbe_pci.c   optionalaxp
 dev/axgbe/xgbe-desc.c  optionalaxp
@@ -239,20 +235,7 @@ dev/ixl/i40e_adminq.c  optionalixl pci 
\
compile-with "${NORMAL_C} -I$S/dev/ixl"
 dev/ixl/i40e_dcb.c optionalixl pci \
compile-with "${NORMAL_C} -I$S/dev/ixl"
-dev/nctgpio/nctgpio.c  optionalnctgpio
 dev/ncthwm/ncthwm.coptionalncthwm superio
-dev/nfe/if_nfe.c   optionalnfe pci
-dev/ntb/if_ntb/if_ntb.coptionalif_ntb
-dev/ntb/ntb_transport.coptionalntb_transport | if_ntb
-dev/ntb/ntb.c  optionalntb | ntb_transport | if_ntb | 
ntb_hw_amd | ntb_hw_intel | ntb_hw_plx | ntb_hw
-dev/ntb/ntb_if.m   optionalntb | ntb_transport | if_ntb | 
ntb_hw_amd | ntb_hw_intel | ntb_hw_plx | ntb_hw
-dev/ntb/ntb_hw/ntb_hw_amd.coptionalntb_hw_amd | ntb_hw
-dev/ntb/ntb_hw/ntb_hw_intel.c  optionalntb_hw_intel | ntb_hw
-dev/ntb/ntb_hw/ntb_hw_plx.coptionalntb_hw_plx | ntb_hw
-dev/ntb/test/ntb_tool.coptionalntb_tool
-dev/nvram/nvram.c  optionalnvram isa
-dev/random/ivy.c   optionalrdrand_rng !random_loadable
-dev/random/nehemiah.c  optionalpadlock_rng !random_loadable
 dev/qlxge/qls_dbg.coptionalqlxge pci
 dev/qlxge/qls_dump.c   optionalqlxge pci
 dev/qlxge/qls_hw.c optionalqlxge pci
@@ -387,29 +370,16 @@ dev/smartpqi/smartpqi_request.c optional  smartpqi
 dev/smartpqi/smartpqi_response.c   optionalsmartpqi
 dev/smartpqi/smartpqi_sis.c optional   smartpqi
 dev/smartpqi/smartpqi_tag.c optional   smartpqi
-dev/speaker/spkr.c optionalspeaker
 dev/sume/if_sume.c optionalsume
-dev/superio/superio.c  optionalsuperio isa
 dev/syscons/apm/apm_saver.coptionalapm_saver apm
-dev/syscons/scvesactl.coptionalsc vga vesa
-dev/syscons/scvgarndr.coptionalsc vga
-dev/tpm/tpm.c  optionaltpm
-dev/tpm/tpm20.coptionaltpm
+dev/tpm/tpm20.coptionaltpm
 dev/tpm/tpm_crb.c  optionaltpm acpi
 dev/tpm/tpm_tis.c  optionaltpm acpi
 dev/tpm/tpm_acpi.c optionaltpm acpi
 dev/tpm/tpm_isa.c  optionaltpm isa
-dev/uart/uart_cpu_x86.coptionaluart
-dev/viawd/viawd.c  optionalviawd
-dev/vmd/vmd.c  optionalvmd | vmd_bus
-dev/wbwd/wbwd.coptionalwbwd
-dev/wdatwd/wdatwd.coptionalwdatwd
 dev/p2sb/p2sb.coptionalp2sb pci
 dev/p2sb/lewisburg_gpiocm.coptionallbggpiocm p2sb
 dev/p2sb/lewisburg_gpio.c  optionallbggpio lbggpiocm
-isa/syscons_isa.c  optionalsc
-isa/vga_isa.c  optionalvga
-kern/imgact_aout.c optional compat_aout
 kern/link_elf_obj.cstandard
 #
 # IA32 binary support
diff --git a/sys/conf/files.i386 b/sys/conf/files.i386
index a55d5302b3e1..41c51a7aa9c5 100644
--- a/sys/conf/files.i386
+++ b/sys/conf/files.i386
@@ -22,49 +22,20 @@ crypto/openssl/i386/sha256-586.Soptional ossl
 crypto/openssl/i386/sha512-586.S   optional ossl
 dev/agp/agp_ali.c  optional agp
 dev/agp/agp_amd.c   

git: 9c3fd2c1c7b8 - main - NOTES: Move IEEE80211_DEBUG_REFCNT to the MI NOTES file

2024-04-13 Thread John Baldwin
The branch main has been updated by jhb:

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

commit 9c3fd2c1c7b8887d2ffaf14c61b04c55657d68bf
Author: John Baldwin 
AuthorDate: 2024-04-14 02:09:38 +
Commit: John Baldwin 
CommitDate: 2024-04-14 02:09:38 +

NOTES: Move IEEE80211_DEBUG_REFCNT to the MI NOTES file

This option is not specific to amd64

Reviewed by:imp
Differential Revision:  https://reviews.freebsd.org/D44779
---
 sys/amd64/conf/NOTES | 3 ---
 sys/conf/NOTES   | 1 +
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/sys/amd64/conf/NOTES b/sys/amd64/conf/NOTES
index 426db398a4ae..6eaed3fa7f52 100644
--- a/sys/amd64/conf/NOTES
+++ b/sys/amd64/conf/NOTES
@@ -368,9 +368,6 @@ device  iwn6000g2bfw
 device iwn6050fw
 device wpifw
 
-# net80211 options
-optionsIEEE80211_DEBUG_REFCNT
-
 #
 # Non-Transparent Bridge (NTB) drivers
 #
diff --git a/sys/conf/NOTES b/sys/conf/NOTES
index e3332ee20120..a4c62dac873a 100644
--- a/sys/conf/NOTES
+++ b/sys/conf/NOTES
@@ -886,6 +886,7 @@ device  vxlan
 #  and ath drivers and will eventually be required by all 802.11 drivers.
 device wlan
 optionsIEEE80211_DEBUG #enable debugging msgs
+optionsIEEE80211_DEBUG_REFCNT
 optionsIEEE80211_SUPPORT_MESH  #enable 802.11s D3.0 support
 optionsIEEE80211_SUPPORT_TDMA  #enable TDMA support
 



git: ff3569be6fe0 - main - NOTES: Move safe(4) to the MI NOTES file

2024-04-13 Thread John Baldwin
The branch main has been updated by jhb:

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

commit ff3569be6fe01839affdefa14f55cc03a1f4f9d0
Author: John Baldwin 
AuthorDate: 2024-04-14 02:09:57 +
Commit: John Baldwin 
CommitDate: 2024-04-14 02:09:57 +

NOTES: Move safe(4) to the MI NOTES file

Reviewed by:imp
Differential Revision:  https://reviews.freebsd.org/D44780
---
 sys/amd64/conf/NOTES | 8 
 sys/conf/NOTES   | 4 
 sys/i386/conf/NOTES  | 7 ---
 3 files changed, 4 insertions(+), 15 deletions(-)

diff --git a/sys/amd64/conf/NOTES b/sys/amd64/conf/NOTES
index 6eaed3fa7f52..0cabacb45dd7 100644
--- a/sys/amd64/conf/NOTES
+++ b/sys/amd64/conf/NOTES
@@ -450,14 +450,6 @@ device pmspcv
 # Only for legacy Atom C2XXX chipsets.
 device qat_c2xxx
 
-#
-# SafeNet crypto driver: can be moved to the MI NOTES as soon as
-# it's tested on a big-endian machine
-#
-device safe# SafeNet 1141
-optionsSAFE_DEBUG  # enable debugging support: hw.safe.debug
-optionsSAFE_RNDTEST# enable rndtest support
-
 #
 # VirtIO support
 #
diff --git a/sys/conf/NOTES b/sys/conf/NOTES
index a4c62dac873a..85cd1a307c14 100644
--- a/sys/conf/NOTES
+++ b/sys/conf/NOTES
@@ -2635,6 +2635,10 @@ device   hifn# Hifn 7951, 7781, etc.
 optionsHIFN_DEBUG  # enable debugging support: hw.hifn.debug
 optionsHIFN_RNDTEST# enable rndtest support
 
+device safe# SafeNet 1141
+optionsSAFE_DEBUG  # enable debugging support: hw.safe.debug
+optionsSAFE_RNDTEST# enable rndtest support
+
 #
 
 
diff --git a/sys/i386/conf/NOTES b/sys/i386/conf/NOTES
index 6692a9dba10e..eee1424b2118 100644
--- a/sys/i386/conf/NOTES
+++ b/sys/i386/conf/NOTES
@@ -641,13 +641,6 @@ device vmd
 #
 # PMC-Sierra SAS/SATA controller
 device pmspcv
-#
-# SafeNet crypto driver: can be moved to the MI NOTES as soon as
-# it's tested on a big-endian machine
-#
-device safe# SafeNet 1141
-optionsSAFE_DEBUG  # enable debugging support: hw.safe.debug
-optionsSAFE_RNDTEST# enable rndtest support
 
 #
 # glxiic is an I2C driver for the AMD Geode LX CS5536 System Management Bus



  1   2   3   4   5   6   7   8   9   10   >