From owner-dev-commits-src-main@freebsd.org Mon Jul 5 00:23:40 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9D06D650428; Mon, 5 Jul 2021 00:23:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GJ5yN3rtlz4t0d; Mon, 5 Jul 2021 00:23:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6C5CA1C60D; Mon, 5 Jul 2021 00:23:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1650Ne9M022480; Mon, 5 Jul 2021 00:23:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1650NeHO022479; Mon, 5 Jul 2021 00:23:40 GMT (envelope-from git) Date: Mon, 5 Jul 2021 00:23:40 GMT Message-Id: <202107050023.1650NeHO022479@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: a2b83b59db36 - main - LinuxKPI: Allow kmem_cache_free() to be called from critical sections MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a2b83b59db365255461a50ff8fa5e5e4e92e4d51 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 00:23:40 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=a2b83b59db365255461a50ff8fa5e5e4e92e4d51 commit a2b83b59db365255461a50ff8fa5e5e4e92e4d51 Author: Vladimir Kondratyev AuthorDate: 2021-07-05 00:18:14 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-07-05 00:18:14 +0000 LinuxKPI: Allow kmem_cache_free() to be called from critical sections as it is required by i915kms driver from Linux kernel v 5.5. This is done with asynchronous freeing of requested memory areas from taskqueue thread. As memory to be freed is reused to store linked list entry, backing UMA zone item size is rounded up to pointer size. While here, make struct linux_kmem_cache private to LKPI to reduce amount of BSD headers included by linux/slab.h and switch RCU code to usage of LKPI's linux_irq_work_tq taskqueue to avoid injection of current into system-wide taskqueue_fast thread context. Submitted by: nc (initial version for drm-kmod) Reviewed by: manu, nc Differential revision: https://reviews.freebsd.org/D30760 --- sys/compat/linuxkpi/common/include/linux/slab.h | 46 +++------------ sys/compat/linuxkpi/common/src/linux_rcu.c | 50 ++++++----------- sys/compat/linuxkpi/common/src/linux_slab.c | 75 ++++++++++++++++++++++++- 3 files changed, 99 insertions(+), 72 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/slab.h b/sys/compat/linuxkpi/common/include/linux/slab.h index 8d5eb3e85e96..ecd39d711eb4 100644 --- a/sys/compat/linuxkpi/common/include/linux/slab.h +++ b/sys/compat/linuxkpi/common/include/linux/slab.h @@ -31,12 +31,9 @@ #ifndef _LINUX_SLAB_H_ #define _LINUX_SLAB_H_ -#include -#include +#include #include #include -#include -#include #include #include @@ -65,8 +62,9 @@ MALLOC_DECLARE(M_KMALLOC); */ #define kmem_cache linux_kmem_cache #define kmem_cache_create(...) linux_kmem_cache_create(__VA_ARGS__) -#define kmem_cache_alloc(...) linux_kmem_cache_alloc(__VA_ARGS__) -#define kmem_cache_free(...) linux_kmem_cache_free(__VA_ARGS__) +#define kmem_cache_alloc(...) lkpi_kmem_cache_alloc(__VA_ARGS__) +#define kmem_cache_zalloc(...) lkpi_kmem_cache_zalloc(__VA_ARGS__) +#define kmem_cache_free(...) lkpi_kmem_cache_free(__VA_ARGS__) #define kmem_cache_destroy(...) linux_kmem_cache_destroy(__VA_ARGS__) #define KMEM_CACHE(__struct, flags) \ @@ -75,12 +73,7 @@ MALLOC_DECLARE(M_KMALLOC); typedef void linux_kmem_ctor_t (void *); -struct linux_kmem_cache { - uma_zone_t cache_zone; - linux_kmem_ctor_t *cache_ctor; - unsigned cache_flags; - unsigned cache_size; -}; +struct linux_kmem_cache; #define SLAB_HWCACHE_ALIGN (1 << 0) #define SLAB_TYPESAFE_BY_RCU (1 << 1) @@ -212,32 +205,9 @@ ksize(const void *ptr) extern struct linux_kmem_cache *linux_kmem_cache_create(const char *name, size_t size, size_t align, unsigned flags, linux_kmem_ctor_t *ctor); - -static inline void * -linux_kmem_cache_alloc(struct linux_kmem_cache *c, gfp_t flags) -{ - return (uma_zalloc_arg(c->cache_zone, c, - linux_check_m_flags(flags))); -} - -static inline void * -kmem_cache_zalloc(struct linux_kmem_cache *c, gfp_t flags) -{ - return (uma_zalloc_arg(c->cache_zone, c, - linux_check_m_flags(flags | M_ZERO))); -} - -extern void linux_kmem_cache_free_rcu(struct linux_kmem_cache *, void *); - -static inline void -linux_kmem_cache_free(struct linux_kmem_cache *c, void *m) -{ - if (unlikely(c->cache_flags & SLAB_TYPESAFE_BY_RCU)) - linux_kmem_cache_free_rcu(c, m); - else - uma_zfree(c->cache_zone, m); -} - +extern void *lkpi_kmem_cache_alloc(struct linux_kmem_cache *, gfp_t); +extern void *lkpi_kmem_cache_zalloc(struct linux_kmem_cache *, gfp_t); +extern void lkpi_kmem_cache_free(struct linux_kmem_cache *, void *); extern void linux_kmem_cache_destroy(struct linux_kmem_cache *); void linux_kfree_async(void *); diff --git a/sys/compat/linuxkpi/common/src/linux_rcu.c b/sys/compat/linuxkpi/common/src/linux_rcu.c index 404c5cec4ae4..a39949cf5013 100644 --- a/sys/compat/linuxkpi/common/src/linux_rcu.c +++ b/sys/compat/linuxkpi/common/src/linux_rcu.c @@ -48,6 +48,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include /* * By defining CONFIG_NO_RCU_SKIP LinuxKPI RCU locks and asserts will @@ -60,13 +62,15 @@ __FBSDID("$FreeBSD$"); #endif struct callback_head { - STAILQ_ENTRY(callback_head) entry; + union { + STAILQ_ENTRY(callback_head) entry; + struct llist_node node; + }; rcu_callback_t func; }; struct linux_epoch_head { - STAILQ_HEAD(, callback_head) cb_head; - struct mtx lock; + struct llist_head cb_head; struct task task; } __aligned(CACHE_LINE_SIZE); @@ -120,9 +124,8 @@ linux_rcu_runtime_init(void *arg __unused) head = &linux_epoch_head[j]; - mtx_init(&head->lock, "LRCU-HEAD", NULL, MTX_DEF); TASK_INIT(&head->task, 0, linux_rcu_cleaner_func, head); - STAILQ_INIT(&head->cb_head); + init_llist_head(&head->cb_head); CPU_FOREACH(i) { struct linux_epoch_record *record; @@ -139,37 +142,22 @@ linux_rcu_runtime_init(void *arg __unused) } SYSINIT(linux_rcu_runtime, SI_SUB_CPU, SI_ORDER_ANY, linux_rcu_runtime_init, NULL); -static void -linux_rcu_runtime_uninit(void *arg __unused) -{ - struct linux_epoch_head *head; - int j; - - for (j = 0; j != RCU_TYPE_MAX; j++) { - head = &linux_epoch_head[j]; - - mtx_destroy(&head->lock); - } -} -SYSUNINIT(linux_rcu_runtime, SI_SUB_LOCK, SI_ORDER_SECOND, linux_rcu_runtime_uninit, NULL); - static void linux_rcu_cleaner_func(void *context, int pending __unused) { - struct linux_epoch_head *head; + struct linux_epoch_head *head = context; struct callback_head *rcu; STAILQ_HEAD(, callback_head) tmp_head; + struct llist_node *node, *next; uintptr_t offset; - linux_set_current(curthread); - - head = context; - /* move current callbacks into own queue */ - mtx_lock(&head->lock); STAILQ_INIT(&tmp_head); - STAILQ_CONCAT(&tmp_head, &head->cb_head); - mtx_unlock(&head->lock); + llist_for_each_safe(node, next, llist_del_all(&head->cb_head)) { + rcu = container_of(node, struct callback_head, node); + /* re-reverse list to restore chronological order */ + STAILQ_INSERT_HEAD(&tmp_head, rcu, entry); + } /* synchronize */ linux_synchronize_rcu(head - linux_epoch_head); @@ -384,7 +372,7 @@ linux_rcu_barrier(unsigned type) head = &linux_epoch_head[type]; /* wait for callbacks to complete */ - taskqueue_drain(taskqueue_fast, &head->task); + taskqueue_drain(linux_irq_work_tq, &head->task); } void @@ -398,11 +386,9 @@ linux_call_rcu(unsigned type, struct rcu_head *context, rcu_callback_t func) rcu = (struct callback_head *)context; head = &linux_epoch_head[type]; - mtx_lock(&head->lock); rcu->func = func; - STAILQ_INSERT_TAIL(&head->cb_head, rcu, entry); - taskqueue_enqueue(taskqueue_fast, &head->task); - mtx_unlock(&head->lock); + llist_add(&rcu->node, &head->cb_head); + taskqueue_enqueue(linux_irq_work_tq, &head->task); } int diff --git a/sys/compat/linuxkpi/common/src/linux_slab.c b/sys/compat/linuxkpi/common/src/linux_slab.c index 3304c34b1dee..5dbd87b66d1a 100644 --- a/sys/compat/linuxkpi/common/src/linux_slab.c +++ b/sys/compat/linuxkpi/common/src/linux_slab.c @@ -35,12 +35,22 @@ __FBSDID("$FreeBSD$"); #include #include +#include struct linux_kmem_rcu { struct rcu_head rcu_head; struct linux_kmem_cache *cache; }; +struct linux_kmem_cache { + uma_zone_t cache_zone; + linux_kmem_ctor_t *cache_ctor; + unsigned cache_flags; + unsigned cache_size; + struct llist_head cache_items; + struct task cache_task; +}; + #define LINUX_KMEM_TO_RCU(c, m) \ ((struct linux_kmem_rcu *)((char *)(m) + \ (c)->cache_size - sizeof(struct linux_kmem_rcu))) @@ -51,6 +61,22 @@ struct linux_kmem_rcu { static LLIST_HEAD(linux_kfree_async_list); +static void lkpi_kmem_cache_free_async_fn(void *, int); + +void * +lkpi_kmem_cache_alloc(struct linux_kmem_cache *c, gfp_t flags) +{ + return (uma_zalloc_arg(c->cache_zone, c, + linux_check_m_flags(flags))); +} + +void * +lkpi_kmem_cache_zalloc(struct linux_kmem_cache *c, gfp_t flags) +{ + return (uma_zalloc_arg(c->cache_zone, c, + linux_check_m_flags(flags | M_ZERO))); +} + static int linux_kmem_ctor(void *mem, int size, void *arg, int flags) { @@ -102,6 +128,9 @@ linux_kmem_cache_create(const char *name, size_t size, size_t align, linux_kmem_ctor, NULL, NULL, NULL, align, UMA_ZONE_ZINIT); } else { + /* make room for async task list items */ + size = MAX(size, sizeof(struct llist_node)); + /* create cache_zone */ c->cache_zone = uma_zcreate(name, size, ctor ? linux_kmem_ctor : NULL, NULL, @@ -111,17 +140,56 @@ linux_kmem_cache_create(const char *name, size_t size, size_t align, c->cache_flags = flags; c->cache_ctor = ctor; c->cache_size = size; + init_llist_head(&c->cache_items); + TASK_INIT(&c->cache_task, 0, lkpi_kmem_cache_free_async_fn, c); return (c); } -void -linux_kmem_cache_free_rcu(struct linux_kmem_cache *c, void *m) +static inline void +lkpi_kmem_cache_free_rcu(struct linux_kmem_cache *c, void *m) { struct linux_kmem_rcu *rcu = LINUX_KMEM_TO_RCU(c, m); call_rcu(&rcu->rcu_head, linux_kmem_cache_free_rcu_callback); } +static inline void +lkpi_kmem_cache_free_sync(struct linux_kmem_cache *c, void *m) +{ + uma_zfree(c->cache_zone, m); +} + +static void +lkpi_kmem_cache_free_async_fn(void *context, int pending) +{ + struct linux_kmem_cache *c = context; + struct llist_node *freed, *next; + + llist_for_each_safe(freed, next, llist_del_all(&c->cache_items)) + lkpi_kmem_cache_free_sync(c, freed); +} + +static inline void +lkpi_kmem_cache_free_async(struct linux_kmem_cache *c, void *m) +{ + if (m == NULL) + return; + + llist_add(m, &c->cache_items); + taskqueue_enqueue(linux_irq_work_tq, &c->cache_task); +} + +void +lkpi_kmem_cache_free(struct linux_kmem_cache *c, void *m) +{ + if (unlikely(c->cache_flags & SLAB_TYPESAFE_BY_RCU)) + lkpi_kmem_cache_free_rcu(c, m); + else if (unlikely(curthread->td_critnest != 0)) + lkpi_kmem_cache_free_async(c, m); + else + lkpi_kmem_cache_free_sync(c, m); +} + void linux_kmem_cache_destroy(struct linux_kmem_cache *c) { @@ -130,6 +198,9 @@ linux_kmem_cache_destroy(struct linux_kmem_cache *c) rcu_barrier(); } + if (!llist_empty(&c->cache_items)) + taskqueue_enqueue(linux_irq_work_tq, &c->cache_task); + taskqueue_drain(linux_irq_work_tq, &c->cache_task); uma_zdestroy(c->cache_zone); free(c, M_KMALLOC); } From owner-dev-commits-src-main@freebsd.org Mon Jul 5 00:23:41 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C410C64FC5C; Mon, 5 Jul 2021 00:23:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GJ5yP4yqJz4tBK; Mon, 5 Jul 2021 00:23:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8ED871C0FC; Mon, 5 Jul 2021 00:23:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1650NfZ8022510; Mon, 5 Jul 2021 00:23:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1650Nf6N022509; Mon, 5 Jul 2021 00:23:41 GMT (envelope-from git) Date: Mon, 5 Jul 2021 00:23:41 GMT Message-Id: <202107050023.1650Nf6N022509@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 78a02d8b332c - main - LinuxKPI: Add #defines required by drm-kmod v5.5 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 78a02d8b332cd46e26e1a8088cd0ba5220cd1f18 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 00:23:41 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=78a02d8b332cd46e26e1a8088cd0ba5220cd1f18 commit 78a02d8b332cd46e26e1a8088cd0ba5220cd1f18 Author: Vladimir Kondratyev AuthorDate: 2021-07-05 00:18:47 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-07-05 00:18:47 +0000 LinuxKPI: Add #defines required by drm-kmod v5.5 Reviewed by: hselasky, manu MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D30767 --- sys/compat/linuxkpi/common/include/linux/pci.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/pci.h b/sys/compat/linuxkpi/common/include/linux/pci.h index 85278356dfea..4784799d82b5 100644 --- a/sys/compat/linuxkpi/common/include/linux/pci.h +++ b/sys/compat/linuxkpi/common/include/linux/pci.h @@ -130,6 +130,14 @@ struct pci_device_id { #define PCI_EXP_LNKCAP2_SLS_5_0GB 0x04 /* Supported Link Speed 5.0GT/s */ #define PCI_EXP_LNKCAP2_SLS_8_0GB 0x08 /* Supported Link Speed 8.0GT/s */ #define PCI_EXP_LNKCAP2_SLS_16_0GB 0x10 /* Supported Link Speed 16.0GT/s */ +#define PCI_EXP_LNKCTL2_TLS 0x000f +#define PCI_EXP_LNKCTL2_TLS_2_5GT 0x0001 /* Supported Speed 2.5GT/s */ +#define PCI_EXP_LNKCTL2_TLS_5_0GT 0x0002 /* Supported Speed 5GT/s */ +#define PCI_EXP_LNKCTL2_TLS_8_0GT 0x0003 /* Supported Speed 8GT/s */ +#define PCI_EXP_LNKCTL2_TLS_16_0GT 0x0004 /* Supported Speed 16GT/s */ +#define PCI_EXP_LNKCTL2_TLS_32_0GT 0x0005 /* Supported Speed 32GT/s */ +#define PCI_EXP_LNKCTL2_ENTER_COMP 0x0010 /* Enter Compliance */ +#define PCI_EXP_LNKCTL2_TX_MARGIN 0x0380 /* Transmit Margin */ #define PCI_EXP_LNKCTL_HAWD PCIEM_LINK_CTL_HAWD #define PCI_EXP_LNKCAP_CLKPM 0x00040000 From owner-dev-commits-src-main@freebsd.org Mon Jul 5 00:23:43 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1AEDC65049A; Mon, 5 Jul 2021 00:23:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GJ5yQ73T9z4t6p; Mon, 5 Jul 2021 00:23:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B63861C0FD; Mon, 5 Jul 2021 00:23:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1650Ngk3022535; Mon, 5 Jul 2021 00:23:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1650NgF4022534; Mon, 5 Jul 2021 00:23:42 GMT (envelope-from git) Date: Mon, 5 Jul 2021 00:23:42 GMT Message-Id: <202107050023.1650NgF4022534@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: c77ec79b57aa - main - LinuxKPI: Change flags parameter type of atomic_dec_and_lock_irqsave MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c77ec79b57aa92b428b940ed550a4a14ed44da48 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 00:23:43 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=c77ec79b57aa92b428b940ed550a4a14ed44da48 commit c77ec79b57aa92b428b940ed550a4a14ed44da48 Author: Vladimir Kondratyev AuthorDate: 2021-07-05 00:19:01 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-07-05 00:19:01 +0000 LinuxKPI: Change flags parameter type of atomic_dec_and_lock_irqsave On Linux atomic_dec_and_lock_irqsave is a wrapper macro which provides a reference to third parameter rather than parameter value itself to implementation routine called _atomic_dec_and_lock_irqsave [1]. While here, implement a fast path. [1] https://github.com/torvalds/linux/blob/master/include/linux/spinlock.h#L476 Reviewed by: hselasky Differential revision: https://reviews.freebsd.org/D30781 --- sys/compat/linuxkpi/common/include/linux/spinlock.h | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/spinlock.h b/sys/compat/linuxkpi/common/include/linux/spinlock.h index ca51fd23434c..46b1f8b9a180 100644 --- a/sys/compat/linuxkpi/common/include/linux/spinlock.h +++ b/sys/compat/linuxkpi/common/include/linux/spinlock.h @@ -163,15 +163,20 @@ spin_lock_destroy(spinlock_t *lock) mtx_assert(&(_l)->m, MA_OWNED); \ } while (0) +#define atomic_dec_and_lock_irqsave(cnt, lock, flags) \ + _atomic_dec_and_lock_irqsave(cnt, lock, &(flags)) static inline int -atomic_dec_and_lock_irqsave(atomic_t *cnt, spinlock_t *lock, - unsigned long flags) +_atomic_dec_and_lock_irqsave(atomic_t *cnt, spinlock_t *lock, + unsigned long *flags) { - spin_lock_irqsave(lock, flags); + if (atomic_add_unless(cnt, -1, 1)) + return (0); + + spin_lock_irqsave(lock, *flags); if (atomic_dec_and_test(cnt)) - return 1; - spin_unlock_irqrestore(lock, flags); - return 0; + return (1); + spin_unlock_irqrestore(lock, *flags); + return (0); } #endif /* _LINUX_SPINLOCK_H_ */ From owner-dev-commits-src-main@freebsd.org Mon Jul 5 00:23:44 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6E68565061B; Mon, 5 Jul 2021 00:23:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GJ5yS0LC5z4t0s; Mon, 5 Jul 2021 00:23:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D1FD11C39D; Mon, 5 Jul 2021 00:23:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1650NhI1022559; Mon, 5 Jul 2021 00:23:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1650Nh6L022558; Mon, 5 Jul 2021 00:23:43 GMT (envelope-from git) Date: Mon, 5 Jul 2021 00:23:43 GMT Message-Id: <202107050023.1650Nh6L022558@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: c0862b2b1fa9 - main - LinuxKPI: Add compiler barriers to list_for_each_entry_lockless macro MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c0862b2b1fa91636d308a1a41d8dc370691d656e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 00:23:44 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=c0862b2b1fa91636d308a1a41d8dc370691d656e commit c0862b2b1fa91636d308a1a41d8dc370691d656e Author: Vladimir Kondratyev AuthorDate: 2021-07-05 00:19:35 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-07-05 00:19:35 +0000 LinuxKPI: Add compiler barriers to list_for_each_entry_lockless macro so this list-traversal primitive may safely run concurrently with the _rcu list-mutation primitives such as list_add_rcu() as long as the traversal is guarded by rcu_read_lock(). Do it by reusing the "list_for_each_entry_rcu" macro which does the same. On Linux it implements some additional lockdep stuff which we skip. Also move the macro to linux/rculist.h where it resides on Linux. Reviewed by: hselasky Differential revision: https://reviews.freebsd.org/D30795 --- sys/compat/linuxkpi/common/include/linux/list.h | 2 -- sys/compat/linuxkpi/common/include/linux/rculist.h | 3 +++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/list.h b/sys/compat/linuxkpi/common/include/linux/list.h index 93db449a4473..37b5b751d21b 100644 --- a/sys/compat/linuxkpi/common/include/linux/list.h +++ b/sys/compat/linuxkpi/common/include/linux/list.h @@ -202,8 +202,6 @@ list_del_init(struct list_head *entry) for (p = list_entry((h)->next, typeof(*p), field); &(p)->field != (h); \ p = list_entry((p)->field.next, typeof(*p), field)) -#define list_for_each_entry_lockless(...) list_for_each_entry(__VA_ARGS__) - #define list_for_each_entry_safe(p, n, h, field) \ for (p = list_entry((h)->next, typeof(*p), field), \ n = list_entry((p)->field.next, typeof(*p), field); &(p)->field != (h);\ diff --git a/sys/compat/linuxkpi/common/include/linux/rculist.h b/sys/compat/linuxkpi/common/include/linux/rculist.h index bff2f7e13184..6c21a6943f98 100644 --- a/sys/compat/linuxkpi/common/include/linux/rculist.h +++ b/sys/compat/linuxkpi/common/include/linux/rculist.h @@ -44,6 +44,9 @@ &(pos)->member != (head); \ pos = list_entry_rcu((pos)->member.next, typeof(*(pos)), member)) +#define list_for_each_entry_lockless(pos, head, member) \ + list_for_each_entry_rcu(pos, head, member) + static inline void linux_list_add_rcu(struct list_head *new, struct list_head *prev, struct list_head *next) From owner-dev-commits-src-main@freebsd.org Mon Jul 5 00:23:45 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5C8306504B5; Mon, 5 Jul 2021 00:23:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GJ5yT0c7Qz4tBX; Mon, 5 Jul 2021 00:23:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E4D8B1C31A; Mon, 5 Jul 2021 00:23:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1650NimU022583; Mon, 5 Jul 2021 00:23:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1650Ni4I022582; Mon, 5 Jul 2021 00:23:44 GMT (envelope-from git) Date: Mon, 5 Jul 2021 00:23:44 GMT Message-Id: <202107050023.1650Ni4I022582@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 1ab61a193241 - main - LinuxKPI: Do not wait for a grace period in rcu_barrier() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1ab61a193241f832e63f97ca37880b010469cb38 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 00:23:45 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=1ab61a193241f832e63f97ca37880b010469cb38 commit 1ab61a193241f832e63f97ca37880b010469cb38 Author: Vladimir Kondratyev AuthorDate: 2021-07-05 00:19:50 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-07-05 00:19:50 +0000 LinuxKPI: Do not wait for a grace period in rcu_barrier() Linux docs explicitly state that this is not required [1]: "Important note: The rcu_barrier() function is not, repeat, not, obligated to wait for a grace period. It is instead only required to wait for RCU callbacks that have already been posted. Therefore, if there are no RCU callbacks posted anywhere in the system, rcu_barrier() is within its rights to return immediately. Even if there are callbacks posted, rcu_barrier() does not necessarily need to wait for a grace period." [1] https://www.kernel.org/doc/Documentation/RCU/Design/Requirements/Requirements.html Reviewed by: emaste, hselasky, manu MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D30809 --- sys/compat/linuxkpi/common/src/linux_rcu.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_rcu.c b/sys/compat/linuxkpi/common/src/linux_rcu.c index a39949cf5013..2179faa2c05e 100644 --- a/sys/compat/linuxkpi/common/src/linux_rcu.c +++ b/sys/compat/linuxkpi/common/src/linux_rcu.c @@ -367,8 +367,12 @@ linux_rcu_barrier(unsigned type) MPASS(type < RCU_TYPE_MAX); - linux_synchronize_rcu(type); - + /* + * This function is not obligated to wait for a grace period. + * It only waits for RCU callbacks that have already been posted. + * If there are no RCU callbacks posted, rcu_barrier() can return + * immediately. + */ head = &linux_epoch_head[type]; /* wait for callbacks to complete */ From owner-dev-commits-src-main@freebsd.org Mon Jul 5 00:23:46 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 466F4650620; Mon, 5 Jul 2021 00:23:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GJ5yV1Jt6z4svq; Mon, 5 Jul 2021 00:23:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 123111C1E8; Mon, 5 Jul 2021 00:23:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1650Nj7V022607; Mon, 5 Jul 2021 00:23:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1650NjRN022606; Mon, 5 Jul 2021 00:23:45 GMT (envelope-from git) Date: Mon, 5 Jul 2021 00:23:45 GMT Message-Id: <202107050023.1650NjRN022606@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 864b11007ab3 - main - LinuxKPI: Implement irq_work_sync() routine. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 864b11007ab3de9f65f28b730507225396c38b9e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 00:23:46 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=864b11007ab3de9f65f28b730507225396c38b9e commit 864b11007ab3de9f65f28b730507225396c38b9e Author: Vladimir Kondratyev AuthorDate: 2021-07-05 00:20:06 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-07-05 00:20:06 +0000 LinuxKPI: Implement irq_work_sync() routine. irq_work_sync() performs draining of irq_work task. Required by drm-kmod. Reviewed by: hselasky MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D30818 --- sys/compat/linuxkpi/common/include/linux/irq_work.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/irq_work.h b/sys/compat/linuxkpi/common/include/linux/irq_work.h index eb1798a4e450..1b376b829818 100644 --- a/sys/compat/linuxkpi/common/include/linux/irq_work.h +++ b/sys/compat/linuxkpi/common/include/linux/irq_work.h @@ -64,4 +64,10 @@ irq_work_queue(struct irq_work *irqw) taskqueue_enqueue(linux_irq_work_tq, &irqw->irq_task); } +static inline void +irq_work_sync(struct irq_work *irqw) +{ + taskqueue_drain(linux_irq_work_tq, &irqw->irq_task); +} + #endif /* __LINUX_IRQ_WORK_H__ */ From owner-dev-commits-src-main@freebsd.org Mon Jul 5 00:23:47 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F186B6504B9; Mon, 5 Jul 2021 00:23:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GJ5yW563Yz4t82; Mon, 5 Jul 2021 00:23:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 38FB21C0FE; Mon, 5 Jul 2021 00:23:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1650NlPn022633; Mon, 5 Jul 2021 00:23:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1650Nlil022632; Mon, 5 Jul 2021 00:23:47 GMT (envelope-from git) Date: Mon, 5 Jul 2021 00:23:47 GMT Message-Id: <202107050023.1650Nlil022632@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 98a6984a9e10 - main - LinuxKPI: Use macro for implementation of some dma_map_* functions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 98a6984a9e10c5c1677643eb4d9a758e3af131da Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 00:23:48 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=98a6984a9e10c5c1677643eb4d9a758e3af131da commit 98a6984a9e10c5c1677643eb4d9a758e3af131da Author: Vladimir Kondratyev AuthorDate: 2021-07-05 00:20:23 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-07-05 00:20:23 +0000 LinuxKPI: Use macro for implementation of some dma_map_* functions This allows to remove unimplemented attrs parameter which type differs between Linux kernel versions and to compile both drm-kmod and ofed callers unmodified. Also convert it to 'unsigned long' type to match modern Linuxes. Reviewed by: hselasky Differential revision: https://reviews.freebsd.org/D30932 --- .../linuxkpi/common/include/linux/dma-mapping.h | 59 ++++++++-------------- sys/compat/linuxkpi/common/src/linux_pci.c | 5 +- 2 files changed, 24 insertions(+), 40 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/dma-mapping.h b/sys/compat/linuxkpi/common/include/linux/dma-mapping.h index d074b563cd41..5b5bc9e90815 100644 --- a/sys/compat/linuxkpi/common/include/linux/dma-mapping.h +++ b/sys/compat/linuxkpi/common/include/linux/dma-mapping.h @@ -63,13 +63,13 @@ struct dma_map_ops { void *vaddr, dma_addr_t dma_handle); dma_addr_t (*map_page)(struct device *dev, struct page *page, unsigned long offset, size_t size, enum dma_data_direction dir, - struct dma_attrs *attrs); + unsigned long attrs); void (*unmap_page)(struct device *dev, dma_addr_t dma_handle, - size_t size, enum dma_data_direction dir, struct dma_attrs *attrs); + size_t size, enum dma_data_direction dir, unsigned long attrs); int (*map_sg)(struct device *dev, struct scatterlist *sg, - int nents, enum dma_data_direction dir, struct dma_attrs *attrs); + int nents, enum dma_data_direction dir, unsigned long attrs); void (*unmap_sg)(struct device *dev, struct scatterlist *sg, int nents, - enum dma_data_direction dir, struct dma_attrs *attrs); + enum dma_data_direction dir, unsigned long attrs); void (*sync_single_for_cpu)(struct device *dev, dma_addr_t dma_handle, size_t size, enum dma_data_direction dir); void (*sync_single_for_device)(struct device *dev, @@ -97,9 +97,11 @@ void *linux_dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t linux_dma_map_phys(struct device *dev, vm_paddr_t phys, size_t len); void linux_dma_unmap(struct device *dev, dma_addr_t dma_addr, size_t size); int linux_dma_map_sg_attrs(struct device *dev, struct scatterlist *sgl, - int nents, enum dma_data_direction dir, struct dma_attrs *attrs); + int nents, enum dma_data_direction dir __unused, + unsigned long attrs __unused); void linux_dma_unmap_sg_attrs(struct device *dev, struct scatterlist *sg, - int nents, enum dma_data_direction dir, struct dma_attrs *attrs); + int nents __unused, enum dma_data_direction dir __unused, + unsigned long attrs __unused); static inline int dma_supported(struct device *dev, u64 mask) @@ -164,21 +166,11 @@ dma_free_coherent(struct device *dev, size_t size, void *cpu_addr, kmem_free((vm_offset_t)cpu_addr, size); } -static inline dma_addr_t -dma_map_single_attrs(struct device *dev, void *ptr, size_t size, - enum dma_data_direction dir, struct dma_attrs *attrs) -{ +#define dma_map_single_attrs(dev, ptr, size, dir, attrs) \ + linux_dma_map_phys(dev, vtophys(ptr), size) - return (linux_dma_map_phys(dev, vtophys(ptr), size)); -} - -static inline void -dma_unmap_single_attrs(struct device *dev, dma_addr_t dma_addr, size_t size, - enum dma_data_direction dir, struct dma_attrs *attrs) -{ - - linux_dma_unmap(dev, dma_addr, size); -} +#define dma_unmap_single_attrs(dev, dma_addr, size, dir, attrs) \ + linux_dma_unmap(dev, dma_addr, size) static inline dma_addr_t dma_map_page_attrs(struct device *dev, struct page *page, size_t offset, @@ -188,21 +180,12 @@ dma_map_page_attrs(struct device *dev, struct page *page, size_t offset, return (linux_dma_map_phys(dev, VM_PAGE_TO_PHYS(page) + offset, size)); } -static inline int -dma_map_sg_attrs(struct device *dev, struct scatterlist *sgl, int nents, - enum dma_data_direction dir, struct dma_attrs *attrs) -{ - - return (linux_dma_map_sg_attrs(dev, sgl, nents, dir, attrs)); -} +/* linux_dma_(un)map_sg_attrs does not support attrs yet */ +#define dma_map_sg_attrs(dev, sgl, nents, dir, attrs) \ + linux_dma_map_sg_attrs(dev, sgl, nents, dir, 0) -static inline void -dma_unmap_sg_attrs(struct device *dev, struct scatterlist *sg, int nents, - enum dma_data_direction dir, struct dma_attrs *attrs) -{ - - linux_dma_unmap_sg_attrs(dev, sg, nents, dir, attrs); -} +#define dma_unmap_sg_attrs(dev, sg, nents, dir, attrs) \ + linux_dma_unmap_sg_attrs(dev, sg, nents, dir, 0) static inline dma_addr_t dma_map_page(struct device *dev, struct page *page, @@ -276,10 +259,10 @@ static inline unsigned int dma_set_max_seg_size(struct device *dev, return (0); } -#define dma_map_single(d, a, s, r) dma_map_single_attrs(d, a, s, r, NULL) -#define dma_unmap_single(d, a, s, r) dma_unmap_single_attrs(d, a, s, r, NULL) -#define dma_map_sg(d, s, n, r) dma_map_sg_attrs(d, s, n, r, NULL) -#define dma_unmap_sg(d, s, n, r) dma_unmap_sg_attrs(d, s, n, r, NULL) +#define dma_map_single(d, a, s, r) dma_map_single_attrs(d, a, s, r, 0) +#define dma_unmap_single(d, a, s, r) dma_unmap_single_attrs(d, a, s, r, 0) +#define dma_map_sg(d, s, n, r) dma_map_sg_attrs(d, s, n, r, 0) +#define dma_unmap_sg(d, s, n, r) dma_unmap_sg_attrs(d, s, n, r, 0) #define DEFINE_DMA_UNMAP_ADDR(name) dma_addr_t name #define DEFINE_DMA_UNMAP_LEN(name) __u32 name diff --git a/sys/compat/linuxkpi/common/src/linux_pci.c b/sys/compat/linuxkpi/common/src/linux_pci.c index c35d259a45be..ae45df9c6514 100644 --- a/sys/compat/linuxkpi/common/src/linux_pci.c +++ b/sys/compat/linuxkpi/common/src/linux_pci.c @@ -881,7 +881,7 @@ linux_dma_unmap(struct device *dev, dma_addr_t dma_addr, size_t len) int linux_dma_map_sg_attrs(struct device *dev, struct scatterlist *sgl, int nents, - enum dma_data_direction dir, struct dma_attrs *attrs) + enum dma_data_direction dir __unused, unsigned long attrs __unused) { struct linux_dma_priv *priv; struct scatterlist *sg; @@ -921,7 +921,8 @@ linux_dma_map_sg_attrs(struct device *dev, struct scatterlist *sgl, int nents, void linux_dma_unmap_sg_attrs(struct device *dev, struct scatterlist *sgl, - int nents, enum dma_data_direction dir, struct dma_attrs *attrs) + int nents __unused, enum dma_data_direction dir __unused, + unsigned long attrs __unused) { struct linux_dma_priv *priv; From owner-dev-commits-src-main@freebsd.org Mon Jul 5 00:23:48 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D0ED4650151; Mon, 5 Jul 2021 00:23:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GJ5yX4Czlz4tGy; Mon, 5 Jul 2021 00:23:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5B4FD1C1E9; Mon, 5 Jul 2021 00:23:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1650NmMi022661; Mon, 5 Jul 2021 00:23:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1650Nmn3022660; Mon, 5 Jul 2021 00:23:48 GMT (envelope-from git) Date: Mon, 5 Jul 2021 00:23:48 GMT Message-Id: <202107050023.1650Nmn3022660@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 019391bf8527 - main - LinuxKPI: Implement strscpy MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 019391bf852771070cb739900f9e20ae6c41c746 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 00:23:49 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=019391bf852771070cb739900f9e20ae6c41c746 commit 019391bf852771070cb739900f9e20ae6c41c746 Author: Vladimir Kondratyev AuthorDate: 2021-07-05 00:20:42 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-07-05 00:20:42 +0000 LinuxKPI: Implement strscpy strscpy copies the src string, or as much of it as fits, into the dst buffer. The dst buffer is always NUL terminated, unless it's zero-sized. strscpy returns the number of characters copied (not including the trailing NUL) or -E2BIG if len is 0 or src was truncated. Currently drm-kmod replaces strscpy with strncpy that is not quite correct as strncpy does not NUL-terminate truncated strings and returns different values on exit. Reviewed by: hselasky, imp, manu MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D31005 --- sys/compat/linuxkpi/common/include/linux/string.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/string.h b/sys/compat/linuxkpi/common/include/linux/string.h index 39201e203162..659a48d93596 100644 --- a/sys/compat/linuxkpi/common/include/linux/string.h +++ b/sys/compat/linuxkpi/common/include/linux/string.h @@ -167,4 +167,20 @@ str_has_prefix(const char *str, const char *prefix) return (strncmp(str, prefix, len) == 0 ? len : 0); } +static inline ssize_t +strscpy(char* dst, const char* src, size_t len) +{ + size_t i; + + if (len <= INT_MAX) { + for (i = 0; i < len; i++) + if ('\0' == (dst[i] = src[i])) + return ((ssize_t)i); + if (i != 0) + dst[--i] = '\0'; + } + + return (-E2BIG); +} + #endif /* _LINUX_STRING_H_ */ From owner-dev-commits-src-main@freebsd.org Mon Jul 5 00:23:50 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4DA096504BC; Mon, 5 Jul 2021 00:23:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GJ5yZ083Hz4t14; Mon, 5 Jul 2021 00:23:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7D09C1C168; Mon, 5 Jul 2021 00:23:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1650Nn0a022685; Mon, 5 Jul 2021 00:23:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1650Nn2O022684; Mon, 5 Jul 2021 00:23:49 GMT (envelope-from git) Date: Mon, 5 Jul 2021 00:23:49 GMT Message-Id: <202107050023.1650Nn2O022684@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 8b33cb8303d3 - main - LinuxKPI: Implement sequence counters and sequential locks MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8b33cb8303d3d7ff12e34327a872ef9fdb29eab9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 00:23:50 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=8b33cb8303d3d7ff12e34327a872ef9fdb29eab9 commit 8b33cb8303d3d7ff12e34327a872ef9fdb29eab9 Author: Vladimir Kondratyev AuthorDate: 2021-07-05 00:20:55 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-07-05 00:20:55 +0000 LinuxKPI: Implement sequence counters and sequential locks as a thin wrapper around native version found in sys/seqc.h. This replaces out-of-base GPLv2-licensed code used by drm-kmod. Reviewed by: hselasky Differential revision: https://reviews.freebsd.org/D31006 --- sys/compat/linuxkpi/common/include/linux/seqlock.h | 137 +++++++++++++++++++++ 1 file changed, 137 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/seqlock.h b/sys/compat/linuxkpi/common/include/linux/seqlock.h new file mode 100644 index 000000000000..b7ae6e32ae69 --- /dev/null +++ b/sys/compat/linuxkpi/common/include/linux/seqlock.h @@ -0,0 +1,137 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2021 Vladimir Kondratyev + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _LINUX_SEQLOCK_H__ +#define _LINUX_SEQLOCK_H__ + +#include +#include +#include +#include + +struct lock_class_key; + +struct seqcount { + seqc_t seqc; +}; +typedef struct seqcount seqcount_t; + +struct seqlock { + struct mtx seql_lock; + struct seqcount seql_count; +}; +typedef struct seqlock seqlock_t; + +static inline void +__seqcount_init(struct seqcount *seqcount, const char *name __unused, + struct lock_class_key *key __unused) +{ + seqcount->seqc = 0; +} +#define seqcount_init(seqcount) __seqcount_init(seqcount, NULL, NULL) + +static inline void +write_seqcount_begin(struct seqcount *seqcount) +{ + seqc_sleepable_write_begin(&seqcount->seqc); +} + +static inline void +write_seqcount_end(struct seqcount *seqcount) +{ + seqc_sleepable_write_end(&seqcount->seqc); +} + +/* + * XXX: Are predicts from inline functions still not honored by clang? + */ +#define __read_seqcount_retry(seqcount, gen) \ + (!seqc_consistent_nomb(&(seqcount)->seqc, gen)) +#define read_seqcount_retry(seqcount, gen) \ + (!seqc_consistent(&(seqcount)->seqc, gen)) + +static inline unsigned +read_seqcount_begin(const struct seqcount *seqcount) +{ + return (seqc_read(&seqcount->seqc)); +} + +static inline unsigned +raw_read_seqcount(const struct seqcount *seqcount) +{ + return (seqc_read_any(&seqcount->seqc)); +} + +static inline void +seqlock_init(struct seqlock *seqlock) +{ + /* + * Don't enroll to witness(4) to avoid orphaned references after struct + * seqlock has been freed. There is no seqlock destructor exists so we + * can't expect automatic mtx_destroy() execution before free(). + */ + mtx_init(&seqlock->seql_lock, "seqlock", NULL, MTX_DEF|MTX_NOWITNESS); + seqcount_init(&seqlock->seql_count); +} + +static inline void +write_seqlock(struct seqlock *seqlock) +{ + mtx_lock(&seqlock->seql_lock); + write_seqcount_begin(&seqlock->seql_count); +} + +static inline void +write_sequnlock(struct seqlock *seqlock) +{ + write_seqcount_end(&seqlock->seql_count); + mtx_unlock(&seqlock->seql_lock); +} + +#define write_seqlock_irqsave(seqlock, flags) do { \ + (flags) = 0; \ + write_seqlock(seqlock); \ +} while (0) + +static inline void +write_sequnlock_irqrestore(struct seqlock *seqlock, + unsigned long flags __unused) +{ + write_sequnlock(seqlock); +} + +static inline unsigned +read_seqbegin(const struct seqlock *seqlock) +{ + return (read_seqcount_begin(&seqlock->seql_count)); +} + +#define read_seqretry(seqlock, gen) \ + read_seqcount_retry(&(seqlock)->seql_count, gen) + +#endif /* _LINUX_SEQLOCK_H__ */ From owner-dev-commits-src-main@freebsd.org Mon Jul 5 00:23:51 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 177C865070B; Mon, 5 Jul 2021 00:23:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GJ5yb017Mz4t8G; Mon, 5 Jul 2021 00:23:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AFE8D1C39E; Mon, 5 Jul 2021 00:23:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1650NonI022709; Mon, 5 Jul 2021 00:23:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1650NoQg022708; Mon, 5 Jul 2021 00:23:50 GMT (envelope-from git) Date: Mon, 5 Jul 2021 00:23:50 GMT Message-Id: <202107050023.1650NoQg022708@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 5fa1eb1cd927 - main - Bump __FreeBSD_version to 1400025 for LinuxKPI change. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5fa1eb1cd927219070b5753b64114a9240d76bf8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 00:23:51 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=5fa1eb1cd927219070b5753b64114a9240d76bf8 commit 5fa1eb1cd927219070b5753b64114a9240d76bf8 Author: Vladimir Kondratyev AuthorDate: 2021-07-05 00:22:19 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-07-05 00:22:19 +0000 Bump __FreeBSD_version to 1400025 for LinuxKPI change. --- sys/sys/param.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/sys/param.h b/sys/sys/param.h index 90a3a2cfac89..96538a949c3f 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -76,7 +76,7 @@ * cannot include sys/param.h and should only be updated here. */ #undef __FreeBSD_version -#define __FreeBSD_version 1400024 +#define __FreeBSD_version 1400025 /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-dev-commits-src-main@freebsd.org Mon Jul 5 02:16:11 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C64EB651354; Mon, 5 Jul 2021 02:16:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GJ8SC52RBz3J1S; Mon, 5 Jul 2021 02:16:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 90D631D9D5; Mon, 5 Jul 2021 02:16:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1652GBlx068980; Mon, 5 Jul 2021 02:16:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1652GBNe068979; Mon, 5 Jul 2021 02:16:11 GMT (envelope-from git) Date: Mon, 5 Jul 2021 02:16:11 GMT Message-Id: <202107050216.1652GBNe068979@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Li-Wen Hsu Subject: git: 167897510919 - main - freebsd-tips: Fix the description of fetch(1) to match the command MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: lwhsu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 167897510919a76740eca0d79713abbd088660fe Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 02:16:11 -0000 The branch main has been updated by lwhsu: URL: https://cgit.FreeBSD.org/src/commit/?id=167897510919a76740eca0d79713abbd088660fe commit 167897510919a76740eca0d79713abbd088660fe Author: Li-Wen Hsu AuthorDate: 2021-07-05 02:14:25 +0000 Commit: Li-Wen Hsu CommitDate: 2021-07-05 02:14:25 +0000 freebsd-tips: Fix the description of fetch(1) to match the command Reported by: jrtc27 MFC with: ffe6afc4f0121f1909f2fa88694228f771dd3fcb --- usr.bin/fortune/datfiles/freebsd-tips | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.bin/fortune/datfiles/freebsd-tips b/usr.bin/fortune/datfiles/freebsd-tips index c747c689791b..c974f74dfda3 100644 --- a/usr.bin/fortune/datfiles/freebsd-tips +++ b/usr.bin/fortune/datfiles/freebsd-tips @@ -441,7 +441,7 @@ You can use the 'fetch' command to retrieve files over ftp, http or https. fetch https://www.FreeBSD.org/images/beastie.png -will download the front page of the FreeBSD web site. +will download the beastie image from the FreeBSD web site. % You can use "whereis" to search standard binary, manual page and source directories for the specified programs. This can be particularly handy From owner-dev-commits-src-main@freebsd.org Mon Jul 5 02:17:44 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5463965193D; Mon, 5 Jul 2021 02:17:44 +0000 (UTC) (envelope-from lwhsu@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GJ8V01vMFz3HsD; Mon, 5 Jul 2021 02:17:44 +0000 (UTC) (envelope-from lwhsu@freebsd.org) Received: from mail-yb1-f178.google.com (mail-yb1-f178.google.com [209.85.219.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: lwhsu/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 248BF26C04; Mon, 5 Jul 2021 02:17:44 +0000 (UTC) (envelope-from lwhsu@freebsd.org) Received: by mail-yb1-f178.google.com with SMTP id m9so26648659ybp.8; Sun, 04 Jul 2021 19:17:44 -0700 (PDT) X-Gm-Message-State: AOAM530UA70Fphs9ZiwlFTfxaMP83uVplk+PP0OU6/Lcx1svpmaP6zEE Mt2So1H5O1J9Pml57QrfmbKJDR4tnWXBTWcYtLM= X-Google-Smtp-Source: ABdhPJwbLYew0Y5OfRAmTnYOC3cqWQZ7BlNSTcERcwS/uydHGQr+QdJ0AJ9iCMxzEM3oksiSnVqlDgWRwDjxg2PQd/o= X-Received: by 2002:a25:38c6:: with SMTP id f189mr8444644yba.110.1625451463669; Sun, 04 Jul 2021 19:17:43 -0700 (PDT) MIME-Version: 1.0 References: <202107041401.164E1KXH094610@gitrepo.freebsd.org> <03B758C5-2243-4ACF-9574-D984B283B407@freebsd.org> In-Reply-To: <03B758C5-2243-4ACF-9574-D984B283B407@freebsd.org> From: Li-Wen Hsu Date: Mon, 5 Jul 2021 10:17:32 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: ffe6afc4f012 - main - freebsd-tips: Use a fetchable URL as example To: Jessica Clarke Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 02:17:44 -0000 On Sun, Jul 4, 2021 at 10:52 PM Jessica Clarke wrote: > > Hi, > > On 4 Jul 2021, at 15:01, Li-Wen Hsu wrote: > > > > The branch main has been updated by lwhsu: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=ffe6afc4f0121f1909f2fa88694228f771dd3fcb > > > > commit ffe6afc4f0121f1909f2fa88694228f771dd3fcb > > Author: Li-Wen Hsu > > AuthorDate: 2021-07-04 14:00:46 +0000 > > Commit: Li-Wen Hsu > > CommitDate: 2021-07-04 14:00:46 +0000 > > > > freebsd-tips: Use a fetchable URL as example > > > > MFC after: 3 days > > --- > > usr.bin/fortune/datfiles/freebsd-tips | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/usr.bin/fortune/datfiles/freebsd-tips b/usr.bin/fortune/datfiles/freebsd-tips > > index cbbaff9eb84f..c747c689791b 100644 > > --- a/usr.bin/fortune/datfiles/freebsd-tips > > +++ b/usr.bin/fortune/datfiles/freebsd-tips > > @@ -439,7 +439,7 @@ You can use "pkg info" to see a list of packages you have installed. > > % > > You can use the 'fetch' command to retrieve files over ftp, http or https. > > > > - fetch https://www.FreeBSD.org/index.html > > + fetch https://www.FreeBSD.org/images/beastie.png > > > > will download the front page of the FreeBSD web site. > > This description no longer matches. Thanks for catching this! Fixed in 167897510919a76740eca0d79713abbd088660fe. Best, Li-Wen From owner-dev-commits-src-main@freebsd.org Mon Jul 5 07:15:38 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 021AB655346; Mon, 5 Jul 2021 07:15:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GJH5j6gFwz4SK7; Mon, 5 Jul 2021 07:15:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CD7DA21C9C; Mon, 5 Jul 2021 07:15:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1657Fbr7070433; Mon, 5 Jul 2021 07:15:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1657FbIm070432; Mon, 5 Jul 2021 07:15:37 GMT (envelope-from git) Date: Mon, 5 Jul 2021 07:15:37 GMT Message-Id: <202107050715.1657FbIm070432@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Peter Holm Subject: git: 7ebe83ddb788 - main - stress2: Limit scope of rm(1) wildcard in cleanup. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pho X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7ebe83ddb788568181aa0916b23284cdce639b3c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 07:15:38 -0000 The branch main has been updated by pho: URL: https://cgit.FreeBSD.org/src/commit/?id=7ebe83ddb788568181aa0916b23284cdce639b3c commit 7ebe83ddb788568181aa0916b23284cdce639b3c Author: Peter Holm AuthorDate: 2021-07-05 07:14:05 +0000 Commit: Peter Holm CommitDate: 2021-07-05 07:14:05 +0000 stress2: Limit scope of rm(1) wildcard in cleanup. Reviewed by: rgrimes --- tools/test/stress2/misc/mmap3.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/test/stress2/misc/mmap3.sh b/tools/test/stress2/misc/mmap3.sh index 9175b77842f3..8a319377070f 100755 --- a/tools/test/stress2/misc/mmap3.sh +++ b/tools/test/stress2/misc/mmap3.sh @@ -42,12 +42,13 @@ while [ `date '+%s'` -lt $((start + 5 * 60)) ]; do ./mmap3 done echo "Expect Segmentation faults" -trap "rm -f /tmp/mmap3.0*" EXIT INT +trap "ls /tmp/mmap3* | grep -E 'mmap3\.[0-9]{6}\.[0-9]{4}$' | xargs rm -v" \ + EXIT INT start=`date '+%s'` while [ `date '+%s'` -lt $((start + 5 * 60)) ]; do ./mmap3 random done -rm -f mmap3 mmap3.core /tmp/mmap3.0* +rm -f mmap3 mmap3.core exit EOF From owner-dev-commits-src-main@freebsd.org Mon Jul 5 07:18:04 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EE85E655365; Mon, 5 Jul 2021 07:18:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GJH8X6SLpz4SMr; Mon, 5 Jul 2021 07:18:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C69D721A2D; Mon, 5 Jul 2021 07:18:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1657I46X070802; Mon, 5 Jul 2021 07:18:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1657I4EY070801; Mon, 5 Jul 2021 07:18:04 GMT (envelope-from git) Date: Mon, 5 Jul 2021 07:18:04 GMT Message-Id: <202107050718.1657I4EY070801@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Peter Holm Subject: git: c5d6dd80b54b - main - stress2: Wait for the "swap" program to terminate MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pho X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c5d6dd80b54b61fcebbd2914de79d04d12d5b8f8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 07:18:05 -0000 The branch main has been updated by pho: URL: https://cgit.FreeBSD.org/src/commit/?id=c5d6dd80b54b61fcebbd2914de79d04d12d5b8f8 commit c5d6dd80b54b61fcebbd2914de79d04d12d5b8f8 Author: Peter Holm AuthorDate: 2021-07-05 07:16:32 +0000 Commit: Peter Holm CommitDate: 2021-07-05 07:16:32 +0000 stress2: Wait for the "swap" program to terminate --- tools/test/stress2/misc/syzkaller20.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/test/stress2/misc/syzkaller20.sh b/tools/test/stress2/misc/syzkaller20.sh index 43c961983bf1..15a16bf41fd0 100755 --- a/tools/test/stress2/misc/syzkaller20.sh +++ b/tools/test/stress2/misc/syzkaller20.sh @@ -102,6 +102,7 @@ mycc -o /tmp/syzkaller20 -Wall -Wextra -O2 /tmp/syzkaller20.c -lpthread || (cd /tmp; ./syzkaller20) & sleep 60 pkill -9 syzkaller20 swap +while pgrep -q swap; do pkill swap; done wait rm -f /tmp/syzkaller20 /tmp/syzkaller20.c /tmp/syzkaller20.core From owner-dev-commits-src-main@freebsd.org Mon Jul 5 09:23:04 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EF9F36580BA; Mon, 5 Jul 2021 09:23:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GJKwm6SvLz4hFV; Mon, 5 Jul 2021 09:23:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C630722F6B; Mon, 5 Jul 2021 09:23:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1659N4pD043924; Mon, 5 Jul 2021 09:23:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1659N4lV043923; Mon, 5 Jul 2021 09:23:04 GMT (envelope-from git) Date: Mon, 5 Jul 2021 09:23:04 GMT Message-Id: <202107050923.1659N4lV043923@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: f92c21a28cd8 - main - pf: depessimize table handling MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f92c21a28cd856834249a008771b2f002e477a39 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 09:23:05 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=f92c21a28cd856834249a008771b2f002e477a39 commit f92c21a28cd856834249a008771b2f002e477a39 Author: Mateusz Guzik AuthorDate: 2021-07-02 11:19:56 +0000 Commit: Mateusz Guzik CommitDate: 2021-07-05 08:42:01 +0000 pf: depessimize table handling Creating tables and zeroing their counters induces excessive IPIs (14 per table), which in turns kills single- and multi-threaded performance. Work around the problem by extending per-CPU counters with a general counter populated on "zeroing" requests -- it stores the currently found sum. Then requests to report the current value are the sum of per-CPU counters subtracted by the saved value. Sample timings when loading a config with 100k tables on a 104-way box: stock: pfctl -f tables100000.conf 0.39s user 69.37s system 99% cpu 1:09.76 total pfctl -f tables100000.conf 0.40s user 68.14s system 99% cpu 1:08.54 total patched: pfctl -f tables100000.conf 0.35s user 6.41s system 99% cpu 6.771 total pfctl -f tables100000.conf 0.48s user 6.47s system 99% cpu 6.949 total Reviewed by: kp (previous version) Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/net/pfvar.h | 62 ++++++++++++++++++++++++++++++++++++++++++++--- sys/netpfil/pf/pf_table.c | 58 +++++++++++++++++++++----------------------- 2 files changed, 85 insertions(+), 35 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index c97fffea845f..515953c09f53 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -817,16 +817,70 @@ struct pfr_tstats { int pfrts_refcnt[PFR_REFCNT_MAX]; }; +#ifdef _KERNEL + +struct pfr_kstate_counter { + counter_u64_t pkc_pcpu; + u_int64_t pkc_zero; +}; + +static inline int +pfr_kstate_counter_init(struct pfr_kstate_counter *pfrc, int flags) +{ + + pfrc->pkc_zero = 0; + pfrc->pkc_pcpu = counter_u64_alloc(flags); + if (pfrc->pkc_pcpu == NULL) + return (ENOMEM); + return (0); +} + +static inline void +pfr_kstate_counter_deinit(struct pfr_kstate_counter *pfrc) +{ + + counter_u64_free(pfrc->pkc_pcpu); +} + +static inline u_int64_t +pfr_kstate_counter_fetch(struct pfr_kstate_counter *pfrc) +{ + u_int64_t c; + + c = counter_u64_fetch(pfrc->pkc_pcpu); + c -= pfrc->pkc_zero; + return (c); +} + +static inline void +pfr_kstate_counter_zero(struct pfr_kstate_counter *pfrc) +{ + u_int64_t c; + + c = counter_u64_fetch(pfrc->pkc_pcpu); + pfrc->pkc_zero = c; +} + +static inline void +pfr_kstate_counter_add(struct pfr_kstate_counter *pfrc, int64_t n) +{ + + counter_u64_add(pfrc->pkc_pcpu, n); +} + struct pfr_ktstats { struct pfr_table pfrts_t; - counter_u64_t pfrkts_packets[PFR_DIR_MAX][PFR_OP_TABLE_MAX]; - counter_u64_t pfrkts_bytes[PFR_DIR_MAX][PFR_OP_TABLE_MAX]; - counter_u64_t pfrkts_match; - counter_u64_t pfrkts_nomatch; + struct pfr_kstate_counter pfrkts_packets[PFR_DIR_MAX][PFR_OP_TABLE_MAX]; + struct pfr_kstate_counter pfrkts_bytes[PFR_DIR_MAX][PFR_OP_TABLE_MAX]; + struct pfr_kstate_counter pfrkts_match; + struct pfr_kstate_counter pfrkts_nomatch; long pfrkts_tzero; int pfrkts_cnt; int pfrkts_refcnt[PFR_REFCNT_MAX]; }; + +#endif /* _KERNEL */ + #define pfrts_name pfrts_t.pfrt_name #define pfrts_flags pfrts_t.pfrt_flags diff --git a/sys/netpfil/pf/pf_table.c b/sys/netpfil/pf/pf_table.c index f643790ff620..cd7d96eacd13 100644 --- a/sys/netpfil/pf/pf_table.c +++ b/sys/netpfil/pf/pf_table.c @@ -1326,15 +1326,15 @@ pfr_get_tstats(struct pfr_table *filter, struct pfr_tstats *tbl, int *size, for (pfr_dir = 0; pfr_dir < PFR_DIR_MAX; pfr_dir ++) { for (pfr_op = 0; pfr_op < PFR_OP_TABLE_MAX; pfr_op ++) { tbl->pfrts_packets[pfr_dir][pfr_op] = - counter_u64_fetch( - p->pfrkt_packets[pfr_dir][pfr_op]); + pfr_kstate_counter_fetch( + &p->pfrkt_packets[pfr_dir][pfr_op]); tbl->pfrts_bytes[pfr_dir][pfr_op] = - counter_u64_fetch( - p->pfrkt_bytes[pfr_dir][pfr_op]); + pfr_kstate_counter_fetch( + &p->pfrkt_bytes[pfr_dir][pfr_op]); } } - tbl->pfrts_match = counter_u64_fetch(p->pfrkt_match); - tbl->pfrts_nomatch = counter_u64_fetch(p->pfrkt_nomatch); + tbl->pfrts_match = pfr_kstate_counter_fetch(&p->pfrkt_match); + tbl->pfrts_nomatch = pfr_kstate_counter_fetch(&p->pfrkt_nomatch); tbl->pfrts_tzero = p->pfrkt_tzero; tbl->pfrts_cnt = p->pfrkt_cnt; for (pfr_op = 0; pfr_op < PFR_REFCNT_MAX; pfr_op++) @@ -1870,12 +1870,12 @@ pfr_clstats_ktable(struct pfr_ktable *kt, long tzero, int recurse) } for (pfr_dir = 0; pfr_dir < PFR_DIR_MAX; pfr_dir ++) { for (pfr_op = 0; pfr_op < PFR_OP_TABLE_MAX; pfr_op ++) { - counter_u64_zero(kt->pfrkt_packets[pfr_dir][pfr_op]); - counter_u64_zero(kt->pfrkt_bytes[pfr_dir][pfr_op]); + pfr_kstate_counter_zero(&kt->pfrkt_packets[pfr_dir][pfr_op]); + pfr_kstate_counter_zero(&kt->pfrkt_bytes[pfr_dir][pfr_op]); } } - counter_u64_zero(kt->pfrkt_match); - counter_u64_zero(kt->pfrkt_nomatch); + pfr_kstate_counter_zero(&kt->pfrkt_match); + pfr_kstate_counter_zero(&kt->pfrkt_nomatch); kt->pfrkt_tzero = tzero; } @@ -1905,28 +1905,24 @@ pfr_create_ktable(struct pfr_table *tbl, long tzero, int attachruleset) for (pfr_dir = 0; pfr_dir < PFR_DIR_MAX; pfr_dir ++) { for (pfr_op = 0; pfr_op < PFR_OP_TABLE_MAX; pfr_op ++) { - kt->pfrkt_packets[pfr_dir][pfr_op] = - counter_u64_alloc(M_NOWAIT); - if (! kt->pfrkt_packets[pfr_dir][pfr_op]) { + if (pfr_kstate_counter_init( + &kt->pfrkt_packets[pfr_dir][pfr_op], M_NOWAIT) != 0) { pfr_destroy_ktable(kt, 0); return (NULL); } - kt->pfrkt_bytes[pfr_dir][pfr_op] = - counter_u64_alloc(M_NOWAIT); - if (! kt->pfrkt_bytes[pfr_dir][pfr_op]) { + if (pfr_kstate_counter_init( + &kt->pfrkt_bytes[pfr_dir][pfr_op], M_NOWAIT) != 0) { pfr_destroy_ktable(kt, 0); return (NULL); } } } - kt->pfrkt_match = counter_u64_alloc(M_NOWAIT); - if (! kt->pfrkt_match) { + if (pfr_kstate_counter_init(&kt->pfrkt_match, M_NOWAIT) != 0) { pfr_destroy_ktable(kt, 0); return (NULL); } - kt->pfrkt_nomatch = counter_u64_alloc(M_NOWAIT); - if (! kt->pfrkt_nomatch) { + if (pfr_kstate_counter_init(&kt->pfrkt_nomatch, M_NOWAIT) != 0) { pfr_destroy_ktable(kt, 0); return (NULL); } @@ -1977,12 +1973,12 @@ pfr_destroy_ktable(struct pfr_ktable *kt, int flushaddr) } for (pfr_dir = 0; pfr_dir < PFR_DIR_MAX; pfr_dir ++) { for (pfr_op = 0; pfr_op < PFR_OP_TABLE_MAX; pfr_op ++) { - counter_u64_free(kt->pfrkt_packets[pfr_dir][pfr_op]); - counter_u64_free(kt->pfrkt_bytes[pfr_dir][pfr_op]); + pfr_kstate_counter_deinit(&kt->pfrkt_packets[pfr_dir][pfr_op]); + pfr_kstate_counter_deinit(&kt->pfrkt_bytes[pfr_dir][pfr_op]); } } - counter_u64_free(kt->pfrkt_match); - counter_u64_free(kt->pfrkt_nomatch); + pfr_kstate_counter_deinit(&kt->pfrkt_match); + pfr_kstate_counter_deinit(&kt->pfrkt_nomatch); free(kt, M_PFTABLE); } @@ -2052,9 +2048,9 @@ pfr_match_addr(struct pfr_ktable *kt, struct pf_addr *a, sa_family_t af) } match = (ke && !ke->pfrke_not); if (match) - counter_u64_add(kt->pfrkt_match, 1); + pfr_kstate_counter_add(&kt->pfrkt_match, 1); else - counter_u64_add(kt->pfrkt_nomatch, 1); + pfr_kstate_counter_add(&kt->pfrkt_nomatch, 1); return (match); } @@ -2109,8 +2105,8 @@ pfr_update_stats(struct pfr_ktable *kt, struct pf_addr *a, sa_family_t af, ("pfr_update_stats: assertion failed.\n")); op_pass = PFR_OP_XPASS; } - counter_u64_add(kt->pfrkt_packets[dir_out][op_pass], 1); - counter_u64_add(kt->pfrkt_bytes[dir_out][op_pass], len); + pfr_kstate_counter_add(&kt->pfrkt_packets[dir_out][op_pass], 1); + pfr_kstate_counter_add(&kt->pfrkt_bytes[dir_out][op_pass], len); if (ke != NULL && op_pass != PFR_OP_XPASS && (kt->pfrkt_flags & PFR_TFLAG_COUNTERS)) { counter_u64_add(pfr_kentry_counter(&ke->pfrke_counters, @@ -2206,7 +2202,7 @@ pfr_pool_get(struct pfr_ktable *kt, int *pidx, struct pf_addr *counter, _next_block: ke = pfr_kentry_byidx(kt, idx, af); if (ke == NULL) { - counter_u64_add(kt->pfrkt_nomatch, 1); + pfr_kstate_counter_add(&kt->pfrkt_nomatch, 1); return (1); } pfr_prepare_network(&umask, af, ke->pfrke_net); @@ -2231,7 +2227,7 @@ _next_block: /* this is a single IP address - no possible nested block */ PF_ACPY(counter, addr, af); *pidx = idx; - counter_u64_add(kt->pfrkt_match, 1); + pfr_kstate_counter_add(&kt->pfrkt_match, 1); return (0); } for (;;) { @@ -2251,7 +2247,7 @@ _next_block: /* lookup return the same block - perfect */ PF_ACPY(counter, addr, af); *pidx = idx; - counter_u64_add(kt->pfrkt_match, 1); + pfr_kstate_counter_add(&kt->pfrkt_match, 1); return (0); } From owner-dev-commits-src-main@freebsd.org Mon Jul 5 09:23:06 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 249CB658404; Mon, 5 Jul 2021 09:23:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GJKwp0P1Tz4hRX; Mon, 5 Jul 2021 09:23:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EB084233F6; Mon, 5 Jul 2021 09:23:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1659N5hu043950; Mon, 5 Jul 2021 09:23:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1659N5XD043947; Mon, 5 Jul 2021 09:23:05 GMT (envelope-from git) Date: Mon, 5 Jul 2021 09:23:05 GMT Message-Id: <202107050923.1659N5XD043947@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: dc1ab04e4c9e - main - pf: allow table stats clearing and reading with ruleset rlock MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dc1ab04e4c9ede3606985e0cce1200e3060ac166 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 09:23:06 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=dc1ab04e4c9ede3606985e0cce1200e3060ac166 commit dc1ab04e4c9ede3606985e0cce1200e3060ac166 Author: Mateusz Guzik AuthorDate: 2021-07-02 12:55:57 +0000 Commit: Mateusz Guzik CommitDate: 2021-07-05 08:42:01 +0000 pf: allow table stats clearing and reading with ruleset rlock Instead serialize against these operations with a dedicated lock. Prior to the change, When pushing 17 mln pps of traffic, calling DIOCRGETTSTATS in a loop would restrict throughput to about 7 mln. With the change there is no slowdown. Reviewed by: kp (previous version) Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/net/pfvar.h | 7 +++++++ sys/netpfil/pf/pf.c | 4 ++++ sys/netpfil/pf/pf_ioctl.c | 18 ++++++++++++------ sys/netpfil/pf/pf_table.c | 2 ++ 4 files changed, 25 insertions(+), 6 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 515953c09f53..8ed998be0d78 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -131,10 +131,17 @@ extern struct rmlock pf_rules_lock; #define PF_RULES_RUNLOCK() rm_runlock(&pf_rules_lock, &_pf_rules_tracker) #define PF_RULES_WLOCK() rm_wlock(&pf_rules_lock) #define PF_RULES_WUNLOCK() rm_wunlock(&pf_rules_lock) +#define PF_RULES_WOWNED() rm_wowned(&pf_rules_lock) #define PF_RULES_ASSERT() rm_assert(&pf_rules_lock, RA_LOCKED) #define PF_RULES_RASSERT() rm_assert(&pf_rules_lock, RA_RLOCKED) #define PF_RULES_WASSERT() rm_assert(&pf_rules_lock, RA_WLOCKED) +extern struct mtx pf_table_stats_lock; +#define PF_TABLE_STATS_LOCK() mtx_lock(&pf_table_stats_lock) +#define PF_TABLE_STATS_UNLOCK() mtx_unlock(&pf_table_stats_lock) +#define PF_TABLE_STATS_OWNED() mtx_owned(&pf_table_stats_lock) +#define PF_TABLE_STATS_ASSERT() mtx_assert(&pf_rules_lock, MA_OWNED) + extern struct sx pf_end_lock; #define PF_MODVER 1 diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 39b032962e84..b05ea1c12285 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -211,6 +211,10 @@ struct mtx pf_unlnkdrules_mtx; MTX_SYSINIT(pf_unlnkdrules_mtx, &pf_unlnkdrules_mtx, "pf unlinked rules", MTX_DEF); +struct mtx pf_table_stats_lock; +MTX_SYSINIT(pf_table_stats_lock, &pf_table_stats_lock, "pf table stats", + MTX_DEF); + VNET_DEFINE_STATIC(uma_zone_t, pf_sources_z); #define V_pf_sources_z VNET(pf_sources_z) uma_zone_t pf_mtag_z; diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 9acfe56b7208..51781d488763 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -3725,10 +3725,12 @@ DIOCCHANGEADDR_error: error = ENODEV; break; } - PF_RULES_WLOCK(); + PF_TABLE_STATS_LOCK(); + PF_RULES_RLOCK(); n = pfr_table_count(&io->pfrio_table, io->pfrio_flags); if (n < 0) { - PF_RULES_WUNLOCK(); + PF_RULES_RUNLOCK(); + PF_TABLE_STATS_UNLOCK(); error = EINVAL; break; } @@ -3739,12 +3741,14 @@ DIOCCHANGEADDR_error: sizeof(struct pfr_tstats), M_TEMP, M_NOWAIT); if (pfrtstats == NULL) { error = ENOMEM; - PF_RULES_WUNLOCK(); + PF_RULES_RUNLOCK(); + PF_TABLE_STATS_UNLOCK(); break; } error = pfr_get_tstats(&io->pfrio_table, pfrtstats, &io->pfrio_size, io->pfrio_flags | PFR_FLAG_USERIOCTL); - PF_RULES_WUNLOCK(); + PF_RULES_RUNLOCK(); + PF_TABLE_STATS_UNLOCK(); if (error == 0) error = copyout(pfrtstats, io->pfrio_buffer, totlen); free(pfrtstats, M_TEMP); @@ -3779,10 +3783,12 @@ DIOCCHANGEADDR_error: break; } - PF_RULES_WLOCK(); + PF_TABLE_STATS_LOCK(); + PF_RULES_RLOCK(); error = pfr_clr_tstats(pfrts, io->pfrio_size, &io->pfrio_nzero, io->pfrio_flags | PFR_FLAG_USERIOCTL); - PF_RULES_WUNLOCK(); + PF_RULES_RUNLOCK(); + PF_TABLE_STATS_UNLOCK(); free(pfrts, M_TEMP); break; } diff --git a/sys/netpfil/pf/pf_table.c b/sys/netpfil/pf/pf_table.c index cd7d96eacd13..5afc90e54d7c 100644 --- a/sys/netpfil/pf/pf_table.c +++ b/sys/netpfil/pf/pf_table.c @@ -1864,6 +1864,8 @@ pfr_clstats_ktable(struct pfr_ktable *kt, long tzero, int recurse) struct pfr_kentryworkq addrq; int pfr_dir, pfr_op; + MPASS(PF_TABLE_STATS_OWNED() || PF_RULES_WOWNED()); + if (recurse) { pfr_enqueue_addrs(kt, &addrq, NULL, 0); pfr_clstats_kentries(kt, &addrq, tzero, 0); From owner-dev-commits-src-main@freebsd.org Mon Jul 5 09:39:47 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 48E48658537; Mon, 5 Jul 2021 09:39:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GJLJ31GY1z4jHJ; Mon, 5 Jul 2021 09:39:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0FE0E237CA; Mon, 5 Jul 2021 09:39:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1659dkr1057991; Mon, 5 Jul 2021 09:39:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1659dkdh057990; Mon, 5 Jul 2021 09:39:46 GMT (envelope-from git) Date: Mon, 5 Jul 2021 09:39:46 GMT Message-Id: <202107050939.1659dkdh057990@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 48687f733fdb - main - armv7: allwinner: Add aw_r_intc driver MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 48687f733fdbbe4b7085aa88a70194c39b44bd9b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 09:39:47 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=48687f733fdbbe4b7085aa88a70194c39b44bd9b commit 48687f733fdbbe4b7085aa88a70194c39b44bd9b Author: Emmanuel Vadot AuthorDate: 2021-07-05 09:38:23 +0000 Commit: Emmanuel Vadot CommitDate: 2021-07-05 09:38:23 +0000 armv7: allwinner: Add aw_r_intc driver This is also needed after the 5.13 dts update. Sponsored by: Diablotin Systems Reported by: Mark Millard --- sys/arm/allwinner/files.allwinner | 1 + sys/arm/conf/GENERIC | 1 + 2 files changed, 2 insertions(+) diff --git a/sys/arm/allwinner/files.allwinner b/sys/arm/allwinner/files.allwinner index 55519fc78026..57e27a962ec0 100644 --- a/sys/arm/allwinner/files.allwinner +++ b/sys/arm/allwinner/files.allwinner @@ -11,6 +11,7 @@ arm/allwinner/aw_machdep.c standard arm/allwinner/aw_mmc.c optional mmc | mmccam arm/allwinner/aw_mp.c optional smp arm/allwinner/aw_nmi.c standard +arm/allwinner/aw_r_intc.c optional aw_r_intc arm/allwinner/aw_rsb.c optional rsb | p2wi arm/allwinner/aw_rtc.c optional aw_rtc arm/allwinner/aw_syscon.c optional ext_resources syscon diff --git a/sys/arm/conf/GENERIC b/sys/arm/conf/GENERIC index dc6e2657779d..427f354d1f93 100644 --- a/sys/arm/conf/GENERIC +++ b/sys/arm/conf/GENERIC @@ -83,6 +83,7 @@ device cpufreq # Interrupt controller device gic +device aw_r_intc # PMU support (for CCNT). device pmu From owner-dev-commits-src-main@freebsd.org Mon Jul 5 09:57:53 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9F466658DBB; Mon, 5 Jul 2021 09:57:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GJLhx3FXnz4lNT; Mon, 5 Jul 2021 09:57:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4DF5023EF6; Mon, 5 Jul 2021 09:57:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1659vrfN084913; Mon, 5 Jul 2021 09:57:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1659vrDh084912; Mon, 5 Jul 2021 09:57:53 GMT (envelope-from git) Date: Mon, 5 Jul 2021 09:57:53 GMT Message-Id: <202107050957.1659vrDh084912@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: f649cff58721 - main - pf: padalign global locks found in pf.c MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f649cff58721f493f218a4d1fb88a12255945472 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 09:57:53 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=f649cff58721f493f218a4d1fb88a12255945472 commit f649cff58721f493f218a4d1fb88a12255945472 Author: Mateusz Guzik AuthorDate: 2021-07-05 09:26:29 +0000 Commit: Mateusz Guzik CommitDate: 2021-07-05 09:56:54 +0000 pf: padalign global locks found in pf.c Reviewed by: kp Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/net/pfvar.h | 4 ++-- sys/netpfil/pf/pf.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 8ed998be0d78..1840c23bc937 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -121,7 +121,7 @@ struct pfi_dynaddr { #define PF_STATE_LOCK_ASSERT(s) do {} while (0) #endif /* INVARIANTS */ -extern struct mtx pf_unlnkdrules_mtx; +extern struct mtx_padalign pf_unlnkdrules_mtx; #define PF_UNLNKDRULES_LOCK() mtx_lock(&pf_unlnkdrules_mtx) #define PF_UNLNKDRULES_UNLOCK() mtx_unlock(&pf_unlnkdrules_mtx) @@ -136,7 +136,7 @@ extern struct rmlock pf_rules_lock; #define PF_RULES_RASSERT() rm_assert(&pf_rules_lock, RA_RLOCKED) #define PF_RULES_WASSERT() rm_assert(&pf_rules_lock, RA_WLOCKED) -extern struct mtx pf_table_stats_lock; +extern struct mtx_padalign pf_table_stats_lock; #define PF_TABLE_STATS_LOCK() mtx_lock(&pf_table_stats_lock) #define PF_TABLE_STATS_UNLOCK() mtx_unlock(&pf_table_stats_lock) #define PF_TABLE_STATS_OWNED() mtx_owned(&pf_table_stats_lock) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index b05ea1c12285..ed273e6e0b6a 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -178,7 +178,7 @@ STAILQ_HEAD(pf_send_head, pf_send_entry); VNET_DEFINE_STATIC(struct pf_send_head, pf_sendqueue); #define V_pf_sendqueue VNET(pf_sendqueue) -static struct mtx pf_sendqueue_mtx; +static struct mtx_padalign pf_sendqueue_mtx; MTX_SYSINIT(pf_sendqueue_mtx, &pf_sendqueue_mtx, "pf send queue", MTX_DEF); #define PF_SENDQ_LOCK() mtx_lock(&pf_sendqueue_mtx) #define PF_SENDQ_UNLOCK() mtx_unlock(&pf_sendqueue_mtx) @@ -200,18 +200,18 @@ VNET_DEFINE_STATIC(struct pf_overload_head, pf_overloadqueue); VNET_DEFINE_STATIC(struct task, pf_overloadtask); #define V_pf_overloadtask VNET(pf_overloadtask) -static struct mtx pf_overloadqueue_mtx; +static struct mtx_padalign pf_overloadqueue_mtx; MTX_SYSINIT(pf_overloadqueue_mtx, &pf_overloadqueue_mtx, "pf overload/flush queue", MTX_DEF); #define PF_OVERLOADQ_LOCK() mtx_lock(&pf_overloadqueue_mtx) #define PF_OVERLOADQ_UNLOCK() mtx_unlock(&pf_overloadqueue_mtx) VNET_DEFINE(struct pf_krulequeue, pf_unlinked_rules); -struct mtx pf_unlnkdrules_mtx; +struct mtx_padalign pf_unlnkdrules_mtx; MTX_SYSINIT(pf_unlnkdrules_mtx, &pf_unlnkdrules_mtx, "pf unlinked rules", MTX_DEF); -struct mtx pf_table_stats_lock; +struct mtx_padalign pf_table_stats_lock; MTX_SYSINIT(pf_table_stats_lock, &pf_table_stats_lock, "pf table stats", MTX_DEF); From owner-dev-commits-src-main@freebsd.org Mon Jul 5 13:53:20 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A921365D270; Mon, 5 Jul 2021 13:53:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GJRwc4KqBz3jbb; Mon, 5 Jul 2021 13:53:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7D187270B6; Mon, 5 Jul 2021 13:53:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 165DrK05004896; Mon, 5 Jul 2021 13:53:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 165DrKCQ004895; Mon, 5 Jul 2021 13:53:20 GMT (envelope-from git) Date: Mon, 5 Jul 2021 13:53:20 GMT Message-Id: <202107051353.165DrKCQ004895@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: b464c459eaf4 - main - loader: Fix dtb loading MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b464c459eaf4e63a3abaaa1ecf51c9d6e9f7521e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 13:53:20 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=b464c459eaf4e63a3abaaa1ecf51c9d6e9f7521e commit b464c459eaf4e63a3abaaa1ecf51c9d6e9f7521e Author: Emmanuel Vadot AuthorDate: 2021-07-05 13:50:39 +0000 Commit: Emmanuel Vadot CommitDate: 2021-07-05 13:53:08 +0000 loader: Fix dtb loading When calling file_findfile with only a type it returns the first file matching the type. But in fdt_apply_overlays we then iterate on the next files and try loading them as dtb overlays. Fix this by checking the type one more time. Sponsored by: Diablotin Systems Reported by: Mark Millard --- stand/fdt/fdt_loader_cmd.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/stand/fdt/fdt_loader_cmd.c b/stand/fdt/fdt_loader_cmd.c index 7580eceedb05..c14b99768d70 100644 --- a/stand/fdt/fdt_loader_cmd.c +++ b/stand/fdt/fdt_loader_cmd.c @@ -466,6 +466,8 @@ fdt_apply_overlays() current_fdtp_size = fdtp_size; overlays_applied = 0; for (fp = file_findfile(NULL, "dtbo"); fp != NULL; fp = fp->f_next) { + if (strcmp(fp->f_type, "dtbo") != 0) + continue; COPYOUT(fp->f_addr, overlay, fp->f_size); /* Check compatible first to avoid unnecessary allocation */ rv = fdt_check_overlay_compatible(current_fdtp, overlay); From owner-dev-commits-src-main@freebsd.org Mon Jul 5 15:17:53 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6B0EE65E82E; Mon, 5 Jul 2021 15:17:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GJTp92QBFz4VR8; Mon, 5 Jul 2021 15:17:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 37DDB5A2; Mon, 5 Jul 2021 15:17:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 165FHrpn012489; Mon, 5 Jul 2021 15:17:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 165FHrLJ012488; Mon, 5 Jul 2021 15:17:53 GMT (envelope-from git) Date: Mon, 5 Jul 2021 15:17:53 GMT Message-Id: <202107051517.165FHrLJ012488@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jessica Clarke Subject: git: 55c57a7811ec - main - rman: Remove an outdated comment that no longer applies MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 55c57a7811ec3c2dfcbfd69216a8eaad4e9be8bc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 15:17:53 -0000 The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=55c57a7811ec3c2dfcbfd69216a8eaad4e9be8bc commit 55c57a7811ec3c2dfcbfd69216a8eaad4e9be8bc Author: Jessica Clarke AuthorDate: 2021-07-05 15:15:03 +0000 Commit: Jessica Clarke CommitDate: 2021-07-05 15:15:03 +0000 rman: Remove an outdated comment that no longer applies Since commit 2dd1bdf1834c in 2016 the r_start and r_end fields have been rman_res_t, which was briefly unsigned long, but commit da1b038af9f9 changed the typedef to be uintmax_t instead. C99 is also something we assume these days. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D30808 --- sys/kern/subr_rman.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/sys/kern/subr_rman.c b/sys/kern/subr_rman.c index a76dbf020ee3..a8f5188e7f54 100644 --- a/sys/kern/subr_rman.c +++ b/sys/kern/subr_rman.c @@ -79,11 +79,7 @@ __FBSDID("$FreeBSD$"); /* * We use a linked list rather than a bitmap because we need to be able to * represent potentially huge objects (like all of a processor's physical - * address space). That is also why the indices are defined to have type - * `unsigned long' -- that being the largest integral type in ISO C (1990). - * The 1999 version of C allows `long long'; we may need to switch to that - * at some point in the future, particularly if we want to support 36-bit - * addresses on IA32 hardware. + * address space). */ struct resource_i { struct resource r_r; From owner-dev-commits-src-main@freebsd.org Mon Jul 5 15:17:54 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 97C1C65E830; Mon, 5 Jul 2021 15:17:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GJTpB3DQ3z4Vdh; Mon, 5 Jul 2021 15:17:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 50B0B160; Mon, 5 Jul 2021 15:17:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 165FHsNu012513; Mon, 5 Jul 2021 15:17:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 165FHsfD012512; Mon, 5 Jul 2021 15:17:54 GMT (envelope-from git) Date: Mon, 5 Jul 2021 15:17:54 GMT Message-Id: <202107051517.165FHsfD012512@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jessica Clarke Subject: git: af433832f752 - main - geom_label: Remove an old sysinstall(8) workaround MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: af433832f7520840c22edd1fe1266c1a5cb781ad Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 15:17:54 -0000 The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=af433832f7520840c22edd1fe1266c1a5cb781ad commit af433832f7520840c22edd1fe1266c1a5cb781ad Author: Jessica Clarke AuthorDate: 2021-07-05 15:15:32 +0000 Commit: Jessica Clarke CommitDate: 2021-07-05 15:15:32 +0000 geom_label: Remove an old sysinstall(8) workaround We removed sysinstall(8) back in 2011, so this workaround should be long since unnecessary. This workaround can end up breaking cases that are hit in the real world, such as dd'ing a small pre-built disk image to a large partition that you intend to grow on first boot and uses a UFS disk label for / in its /etc/fstab (as the only reliable thing a raw UFS image can reference). Reviewed by: imp, mckusick Differential Revision: https://reviews.freebsd.org/D30825 --- sys/geom/label/g_label_ufs.c | 35 +++++------------------------------ 1 file changed, 5 insertions(+), 30 deletions(-) diff --git a/sys/geom/label/g_label_ufs.c b/sys/geom/label/g_label_ufs.c index ababbaa4b43a..70d59488d7b6 100644 --- a/sys/geom/label/g_label_ufs.c +++ b/sys/geom/label/g_label_ufs.c @@ -49,19 +49,8 @@ __FBSDID("$FreeBSD$"); #define G_LABEL_UFS_ID 1 /* - * G_LABEL_UFS_CMP returns true if difference between provider mediasize - * and filesystem size is less than G_LABEL_UFS_MAXDIFF sectors - */ -#define G_LABEL_UFS_CMP(prov, fsys, size) \ - ( abs( ((fsys)->size) - ( (prov)->mediasize / (fsys)->fs_fsize )) \ - < G_LABEL_UFS_MAXDIFF ) -#define G_LABEL_UFS_MAXDIFF 0x100 - -/* - * Try to find a superblock on the provider. If successful, then - * check that the size in the superblock corresponds to the size - * of the underlying provider. Finally, look for a volume label - * and create an appropriate provider based on that. + * Try to find a superblock on the provider. If successful, look for a volume + * label and create an appropriate provider based on that. */ static void g_label_ufs_taste_common(struct g_consumer *cp, char *label, size_t size, int what) @@ -81,24 +70,10 @@ g_label_ufs_taste_common(struct g_consumer *cp, char *label, size_t size, int wh return; } - /* - * Check for magic. We also need to check if file system size - * is almost equal to providers size, because sysinstall(8) - * used to bogusly put first partition at offset 0 - * instead of 16, and glabel/ufs would find file system on slice - * instead of partition. - * - * In addition, media size can be a bit bigger than file system - * size. For instance, mkuzip can append bytes to align data - * to large sector size (it improves compression rates). - */ - if (fs->fs_magic == FS_UFS1_MAGIC && fs->fs_fsize > 0 && - ( G_LABEL_UFS_CMP(pp, fs, fs_old_size) - || G_LABEL_UFS_CMP(pp, fs, fs_providersize))) { + /* Check for magic. */ + if (fs->fs_magic == FS_UFS1_MAGIC && fs->fs_fsize > 0) { /* Valid UFS1. */ - } else if (fs->fs_magic == FS_UFS2_MAGIC && fs->fs_fsize > 0 && - ( G_LABEL_UFS_CMP(pp, fs, fs_size) - || G_LABEL_UFS_CMP(pp, fs, fs_providersize))) { + } else if (fs->fs_magic == FS_UFS2_MAGIC && fs->fs_fsize > 0) { /* Valid UFS2. */ } else { goto out; From owner-dev-commits-src-main@freebsd.org Mon Jul 5 15:17:55 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ED2D765E90B; Mon, 5 Jul 2021 15:17:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GJTpC5ttnz4Vbx; Mon, 5 Jul 2021 15:17:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8591327CF9; Mon, 5 Jul 2021 15:17:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 165FHtOX012537; Mon, 5 Jul 2021 15:17:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 165FHt4e012536; Mon, 5 Jul 2021 15:17:55 GMT (envelope-from git) Date: Mon, 5 Jul 2021 15:17:55 GMT Message-Id: <202107051517.165FHt4e012536@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jessica Clarke Subject: git: 348c41d1815d - main - riscv: Implement non-stub __vdso_gettc and __vdso_gettimekeep MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 348c41d1815dc2e872a1deba1f4bf760caaa1094 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 15:17:56 -0000 The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=348c41d1815dc2e872a1deba1f4bf760caaa1094 commit 348c41d1815dc2e872a1deba1f4bf760caaa1094 Author: Jessica Clarke AuthorDate: 2021-07-05 15:16:53 +0000 Commit: Jessica Clarke CommitDate: 2021-07-05 15:16:53 +0000 riscv: Implement non-stub __vdso_gettc and __vdso_gettimekeep PR: 256905 Reviewed by: arichardson, mhorne MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D30963 --- lib/libc/riscv/sys/Makefile.inc | 2 +- lib/libc/riscv/sys/__vdso_gettc.c | 56 +++++++++++++++++++++++++++++++++++++++ sys/riscv/include/vdso.h | 2 ++ sys/riscv/riscv/elf_machdep.c | 4 +-- sys/riscv/riscv/timer.c | 14 ++++++++++ 5 files changed, 75 insertions(+), 3 deletions(-) diff --git a/lib/libc/riscv/sys/Makefile.inc b/lib/libc/riscv/sys/Makefile.inc index 0e94e6652645..b322cece382c 100644 --- a/lib/libc/riscv/sys/Makefile.inc +++ b/lib/libc/riscv/sys/Makefile.inc @@ -1,6 +1,6 @@ # $FreeBSD$ -SRCS+= trivial-vdso_tc.c +SRCS+= __vdso_gettc.c MDASM= cerror.S \ syscall.S \ diff --git a/lib/libc/riscv/sys/__vdso_gettc.c b/lib/libc/riscv/sys/__vdso_gettc.c new file mode 100644 index 000000000000..20e69a791bb5 --- /dev/null +++ b/lib/libc/riscv/sys/__vdso_gettc.c @@ -0,0 +1,56 @@ +/*- + * Copyright (c) 2021 Jessica Clarke + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include + +#include + +#include + +#include "libc_private.h" + +#pragma weak __vdso_gettc +int +__vdso_gettc(const struct vdso_timehands *th, u_int *tc) +{ + if (th->th_algo != VDSO_TH_ALGO_RISCV_RDTIME) + return (ENOSYS); + + *tc = csr_read(time); + return (0); +} + +#pragma weak __vdso_gettimekeep +int +__vdso_gettimekeep(struct vdso_timekeep **tk) +{ + return (_elf_aux_info(AT_TIMEKEEP, tk, sizeof(*tk))); +} diff --git a/sys/riscv/include/vdso.h b/sys/riscv/include/vdso.h index 5a8f7f555b50..175c52eedcef 100644 --- a/sys/riscv/include/vdso.h +++ b/sys/riscv/include/vdso.h @@ -31,4 +31,6 @@ #define VDSO_TIMEHANDS_MD \ uint32_t th_res[8]; +#define VDSO_TH_ALGO_RISCV_RDTIME VDSO_TH_ALGO_1 + #endif /* !_MACHINE_VDSO_H_ */ diff --git a/sys/riscv/riscv/elf_machdep.c b/sys/riscv/riscv/elf_machdep.c index ee80e04e8c31..2a355a977800 100644 --- a/sys/riscv/riscv/elf_machdep.c +++ b/sys/riscv/riscv/elf_machdep.c @@ -87,8 +87,8 @@ struct sysentvec elf64_freebsd_sysvec = { .sv_setregs = exec_setregs, .sv_fixlimit = NULL, .sv_maxssiz = NULL, - .sv_flags = SV_ABI_FREEBSD | SV_LP64 | SV_SHP | SV_ASLR | - SV_RNG_SEED_VER, + .sv_flags = SV_ABI_FREEBSD | SV_LP64 | SV_SHP | SV_TIMEKEEP | + SV_ASLR | SV_RNG_SEED_VER, .sv_set_syscall_retval = cpu_set_syscall_retval, .sv_fetch_syscall_args = cpu_fetch_syscall_args, .sv_syscallnames = syscallnames, diff --git a/sys/riscv/riscv/timer.c b/sys/riscv/riscv/timer.c index 845a2fbed2ff..c75350f4aac5 100644 --- a/sys/riscv/riscv/timer.c +++ b/sys/riscv/riscv/timer.c @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -78,6 +79,9 @@ struct riscv_timer_softc { static struct riscv_timer_softc *riscv_timer_sc = NULL; +static uint32_t riscv_timer_fill_vdso_timehands(struct vdso_timehands *vdso_th, + struct timecounter *tc); + static timecounter_get_t riscv_timer_get_timecount; static struct timecounter riscv_timer_timecount = { @@ -87,6 +91,7 @@ static struct timecounter riscv_timer_timecount = { .tc_counter_mask = ~0u, .tc_frequency = 0, .tc_quality = 1000, + .tc_fill_vdso_timehands = riscv_timer_fill_vdso_timehands, }; static inline uint64_t @@ -301,3 +306,12 @@ DELAY(int usec) } TSEXIT(); } + +static uint32_t +riscv_timer_fill_vdso_timehands(struct vdso_timehands *vdso_th, + struct timecounter *tc) +{ + vdso_th->th_algo = VDSO_TH_ALGO_RISCV_RDTIME; + bzero(vdso_th->th_res, sizeof(vdso_th->th_res)); + return (1); +} From owner-dev-commits-src-main@freebsd.org Mon Jul 5 18:36:58 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6076866162F; Mon, 5 Jul 2021 18:36:58 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from omta002.cacentral1.a.cloudfilter.net (omta002.cacentral1.a.cloudfilter.net [3.97.99.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GJZCt1LvCz3KVB; Mon, 5 Jul 2021 18:36:58 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from shw-obgw-4004a.ext.cloudfilter.net ([10.228.9.227]) by cmsmtp with ESMTP id 0SqbmKHBE4bIn0TSjmZg4X; Mon, 05 Jul 2021 18:36:57 +0000 Received: from spqr.komquats.com ([70.66.148.124]) by cmsmtp with ESMTPA id 0TShmNLip3DJA0TSimRGdG; Mon, 05 Jul 2021 18:36:57 +0000 X-Authority-Analysis: v=2.4 cv=FMjee8ks c=1 sm=1 tr=0 ts=60e35149 a=Cwc3rblV8FOMdVN/wOAqyQ==:117 a=Cwc3rblV8FOMdVN/wOAqyQ==:17 a=kj9zAlcOel0A:10 a=e_q4qTt1xDgA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=EkcXrb_YAAAA:8 a=6fEmDOBOFkKXxzvScQIA:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 a=LK5xJRSDVpKd5WXXoEvA:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id 7974E14F; Mon, 5 Jul 2021 11:36:54 -0700 (PDT) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.16.1/8.16.1) with ESMTP id 165IaspD003460; Mon, 5 Jul 2021 11:36:54 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <202107051836.165IaspD003460@slippy.cwsent.com> X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Jessica Clarke cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: af433832f752 - main - geom_label: Remove an old sysinstall(8) workaround In-reply-to: <202107051517.165FHsfD012512@gitrepo.freebsd.org> References: <202107051517.165FHsfD012512@gitrepo.freebsd.org> Comments: In-reply-to Jessica Clarke message dated "Mon, 05 Jul 2021 15:17:54 +0000." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Mon, 05 Jul 2021 11:36:54 -0700 X-CMAE-Envelope: MS4xfJ0JJBKb5LT/s+kPTC/Tn7RgX2SelufE2Al/LrG+DG+Sj50k/jKMJ65bqI12LPVtbfgrUE+28tUpXH+maz3GzLsYLrNEJwb2UyXIhl3XPwjzTDxdgGr6 nl8xCRF8RgeNYEVQjSGQAKgC+8Mn8tfI4do6jYMcx5tRMS7x0Uk5NVwiNHlKirkkoJ4kfWwnlDWzq76fUZJUYxAbEjqR6rhqPm8qiWJttFpZU/Cir0K5/uVe kDOu4+3zKmQT3fm81c59OoTpZY/hI2wFQBc4aalyEfwin6W+EsLqtQyXkL7L44zpFqZY64bFyoJuFpwDU+x05XKJAhJq7cLpexwyhUqNylw= X-Rspamd-Queue-Id: 4GJZCt1LvCz3KVB X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 18:36:58 -0000 In message <202107051517.165FHsfD012512@gitrepo.freebsd.org>, Jessica Clarke wr ites: > The branch main has been updated by jrtc27: > > URL: https://cgit.FreeBSD.org/src/commit/?id=af433832f7520840c22edd1fe1266c1a > 5cb781ad > > commit af433832f7520840c22edd1fe1266c1a5cb781ad > Author: Jessica Clarke > AuthorDate: 2021-07-05 15:15:32 +0000 > Commit: Jessica Clarke > CommitDate: 2021-07-05 15:15:32 +0000 > > geom_label: Remove an old sysinstall(8) workaround > > We removed sysinstall(8) back in 2011, so this workaround should be long > since unnecessary. This workaround can end up breaking cases that are > hit in the real world, such as dd'ing a small pre-built disk image to a > large partition that you intend to grow on first boot and uses a UFS > disk label for / in its /etc/fstab (as the only reliable thing a raw UFS > image can reference). > > Reviewed by: imp, mckusick > Differential Revision: https://reviews.freebsd.org/D30825 > --- > sys/geom/label/g_label_ufs.c | 35 +++++------------------------------ > 1 file changed, 5 insertions(+), 30 deletions(-) > > diff --git a/sys/geom/label/g_label_ufs.c b/sys/geom/label/g_label_ufs.c > index ababbaa4b43a..70d59488d7b6 100644 > --- a/sys/geom/label/g_label_ufs.c > +++ b/sys/geom/label/g_label_ufs.c > @@ -49,19 +49,8 @@ __FBSDID("$FreeBSD$"); > #define G_LABEL_UFS_ID 1 > > /* > - * G_LABEL_UFS_CMP returns true if difference between provider mediasize > - * and filesystem size is less than G_LABEL_UFS_MAXDIFF sectors > - */ > -#define G_LABEL_UFS_CMP(prov, fsys, size) > \ > - ( abs( ((fsys)->size) - ( (prov)->mediasize / (fsys)->fs_fsize )) \ > - < G_LABEL_UFS_MAXDIFF ) > -#define G_LABEL_UFS_MAXDIFF 0x100 > - > -/* > - * Try to find a superblock on the provider. If successful, then > - * check that the size in the superblock corresponds to the size > - * of the underlying provider. Finally, look for a volume label > - * and create an appropriate provider based on that. > + * Try to find a superblock on the provider. If successful, look for a volum > e > + * label and create an appropriate provider based on that. > */ > static void > g_label_ufs_taste_common(struct g_consumer *cp, char *label, size_t size, in > t what) > @@ -81,24 +70,10 @@ g_label_ufs_taste_common(struct g_consumer *cp, char *lab > el, size_t size, int wh > return; > } > > - /* > - * Check for magic. We also need to check if file system size > - * is almost equal to providers size, because sysinstall(8) > - * used to bogusly put first partition at offset 0 > - * instead of 16, and glabel/ufs would find file system on slice > - * instead of partition. > - * > - * In addition, media size can be a bit bigger than file system > - * size. For instance, mkuzip can append bytes to align data > - * to large sector size (it improves compression rates). > - */ > - if (fs->fs_magic == FS_UFS1_MAGIC && fs->fs_fsize > 0 && > - ( G_LABEL_UFS_CMP(pp, fs, fs_old_size) > - || G_LABEL_UFS_CMP(pp, fs, fs_providersize))) { > + /* Check for magic. */ > + if (fs->fs_magic == FS_UFS1_MAGIC && fs->fs_fsize > 0) { > /* Valid UFS1. */ > - } else if (fs->fs_magic == FS_UFS2_MAGIC && fs->fs_fsize > 0 && > - ( G_LABEL_UFS_CMP(pp, fs, fs_size) > - || G_LABEL_UFS_CMP(pp, fs, fs_providersize))) { > + } else if (fs->fs_magic == FS_UFS2_MAGIC && fs->fs_fsize > 0) { > /* Valid UFS2. */ > } else { > goto out; > On one of my machines which uses UFS filesystems (sandbox) also fails: bob# ls /dev/ufs s10-amd64 s13-amd64 s13-amd64e test s11-amd64 s13-amd64a s13-amd64f testa s12-amd64 s13-amd64d s13-i386 bob# mount /alt/s11-amd64/root bob# ls /dev/ufs s10-amd64 s12-amd64 test s11-amd64 s13-i386 testa bob# After the mount of /alt/s11-amd64/root, s10-amd64 the s13-* filesystems become unavailble They share the same fdisk slice, using different bsdlabel partitions within the slice. My laptop zfs pool is on a partition in the same slice as its UFS filesystems. Looks like once a filesystem on a slice has been mounted, the other partitions within the slice are no longer available following this commit. -- Cheers, Cy Schubert FreeBSD UNIX: Web: https://FreeBSD.org NTP: Web: https://nwtime.org The need of the many outweighs the greed of the few. From owner-dev-commits-src-main@freebsd.org Mon Jul 5 18:48:27 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 09251661A4A for ; Mon, 5 Jul 2021 18:48:27 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GJZT627Rbz3LW1 for ; Mon, 5 Jul 2021 18:48:26 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wr1-f43.google.com with SMTP id f14so22794033wrs.6 for ; Mon, 05 Jul 2021 11:48:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=sFmkivGKl9i7qvrYWIG/5lojULGmeZxSGPgkNwQ/BkQ=; b=RhpIIPvc46rE/7dN3RRZ0YDO+AgEXvrBiiavK6eh+Cf4w4kmMktLYOR1D1laFWIquz 9zcHDr28jqF53c++m+oq/7v1+ucxsZVf2ATFcZVEfSzWoadRUcxcRi/FGC8mxwyUvGq8 nrg8je4MjGQ+akycCSwAvFewfQvQGD+jy+6H1+lVrZ1VhL2HdoNkRR7yKWGPUkOhqAj7 a4kNdXth86u4x3MyD7FMAbeoJn5lyTfvsrSDZys1mnw5PDIddGrpBcVSXNHQAo7risyZ MCrWdN2ioJDTXZA2hGSbyiH3CenaKADhOE0hVf9PF48V0dBvKlX+i/4uWkUVRjrIMDF4 zxcA== X-Gm-Message-State: AOAM530NGUSU9Xiy4qFrmQcC8HK+Q6EduJX48+k3jufN2ULguXeOYkIh wGH4AZtP3V4cNoqiszYIdk7DDC3MdAOetQ== X-Google-Smtp-Source: ABdhPJwN6BtwZ9uAM8J54DUFEMK7et/3dFBSemQt3maXiB16N/NQrvIhhmeFjZ4Onz5enUAcOCSKvQ== X-Received: by 2002:a5d:64c2:: with SMTP id f2mr5459564wri.158.1625510904458; Mon, 05 Jul 2021 11:48:24 -0700 (PDT) Received: from smtpclient.apple (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id d3sm5946136wrx.77.2021.07.05.11.48.23 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Jul 2021 11:48:24 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.100.0.2.22\)) Subject: Re: git: af433832f752 - main - geom_label: Remove an old sysinstall(8) workaround From: Jessica Clarke In-Reply-To: <202107051836.165IaspD003460@slippy.cwsent.com> Date: Mon, 5 Jul 2021 19:48:23 +0100 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: References: <202107051517.165FHsfD012512@gitrepo.freebsd.org> <202107051836.165IaspD003460@slippy.cwsent.com> To: Cy Schubert X-Mailer: Apple Mail (2.3654.100.0.2.22) X-Rspamd-Queue-Id: 4GJZT627Rbz3LW1 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of jrtc27@jrtc27.com designates 209.85.221.43 as permitted sender) smtp.mailfrom=jrtc27@jrtc27.com X-Spamd-Result: default: False [-2.48 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17:c]; MV_CASE(0.50)[]; RCVD_COUNT_THREE(0.00)[3]; NEURAL_HAM_SHORT(-0.98)[-0.979]; FORGED_SENDER(0.30)[jrtc27@freebsd.org,jrtc27@jrtc27.com]; MIME_TRACE(0.00)[0:+]; RBL_DBL_DONT_QUERY_IPS(0.00)[209.85.221.43:from]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; R_DKIM_NA(0.00)[]; FROM_NEQ_ENVFROM(0.00)[jrtc27@freebsd.org,jrtc27@jrtc27.com]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FREEFALL_USER(0.00)[jrtc27]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; MID_RHS_MATCH_FROM(0.00)[]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[dev-commits-src-main@freebsd.org]; DMARC_NA(0.00)[freebsd.org]; SPAMHAUS_ZRD(0.00)[209.85.221.43:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; RCVD_IN_DNSWL_NONE(0.00)[209.85.221.43:from]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.85.221.43:from]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[dev-commits-src-main] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 18:48:27 -0000 On 5 Jul 2021, at 19:36, Cy Schubert wrote: >=20 > In message <202107051517.165FHsfD012512@gitrepo.freebsd.org>, Jessica=20= > Clarke wr > ites: >> The branch main has been updated by jrtc27: >>=20 >> URL: = https://cgit.FreeBSD.org/src/commit/?id=3Daf433832f7520840c22edd1fe1266c1a= >> 5cb781ad >>=20 >> commit af433832f7520840c22edd1fe1266c1a5cb781ad >> Author: Jessica Clarke >> AuthorDate: 2021-07-05 15:15:32 +0000 >> Commit: Jessica Clarke >> CommitDate: 2021-07-05 15:15:32 +0000 >>=20 >> geom_label: Remove an old sysinstall(8) workaround >>=20 >> We removed sysinstall(8) back in 2011, so this workaround should = be long >> since unnecessary. This workaround can end up breaking cases that = are >> hit in the real world, such as dd'ing a small pre-built disk image = to a >> large partition that you intend to grow on first boot and uses a = UFS >> disk label for / in its /etc/fstab (as the only reliable thing a = raw UFS >> image can reference). >>=20 >> Reviewed by: imp, mckusick >> Differential Revision: https://reviews.freebsd.org/D30825 >> --- >> sys/geom/label/g_label_ufs.c | 35 +++++------------------------------ >> 1 file changed, 5 insertions(+), 30 deletions(-) >>=20 >> diff --git a/sys/geom/label/g_label_ufs.c = b/sys/geom/label/g_label_ufs.c >> index ababbaa4b43a..70d59488d7b6 100644 >> --- a/sys/geom/label/g_label_ufs.c >> +++ b/sys/geom/label/g_label_ufs.c >> @@ -49,19 +49,8 @@ __FBSDID("$FreeBSD$"); >> #define G_LABEL_UFS_ID 1 >>=20 >> /* >> - * G_LABEL_UFS_CMP returns true if difference between provider = mediasize >> - * and filesystem size is less than G_LABEL_UFS_MAXDIFF sectors >> - */ >> -#define G_LABEL_UFS_CMP(prov, fsys, size) =09 >> \ >> - ( abs( ((fsys)->size) - ( (prov)->mediasize / (fsys)->fs_fsize = )) \ >> - < G_LABEL_UFS_MAXDIFF ) >> -#define G_LABEL_UFS_MAXDIFF 0x100 >> - >> -/* >> - * Try to find a superblock on the provider. If successful, then >> - * check that the size in the superblock corresponds to the size >> - * of the underlying provider. Finally, look for a volume label >> - * and create an appropriate provider based on that. >> + * Try to find a superblock on the provider. If successful, look for = a volum >> e >> + * label and create an appropriate provider based on that. >> */ >> static void >> g_label_ufs_taste_common(struct g_consumer *cp, char *label, size_t = size, in >> t what) >> @@ -81,24 +70,10 @@ g_label_ufs_taste_common(struct g_consumer *cp, = char *lab >> el, size_t size, int wh >> return; >> } >>=20 >> - /* >> - * Check for magic. We also need to check if file system size >> - * is almost equal to providers size, because sysinstall(8) >> - * used to bogusly put first partition at offset 0 >> - * instead of 16, and glabel/ufs would find file system on slice >> - * instead of partition. >> - * >> - * In addition, media size can be a bit bigger than file system >> - * size. For instance, mkuzip can append bytes to align data >> - * to large sector size (it improves compression rates). >> - */ >> - if (fs->fs_magic =3D=3D FS_UFS1_MAGIC && fs->fs_fsize > 0 && >> - ( G_LABEL_UFS_CMP(pp, fs, fs_old_size) >> - || G_LABEL_UFS_CMP(pp, fs, fs_providersize))) { >> + /* Check for magic. */ >> + if (fs->fs_magic =3D=3D FS_UFS1_MAGIC && fs->fs_fsize > 0) { >> /* Valid UFS1. */ >> - } else if (fs->fs_magic =3D=3D FS_UFS2_MAGIC && fs->fs_fsize > 0 = && >> - ( G_LABEL_UFS_CMP(pp, fs, fs_size) >> - || G_LABEL_UFS_CMP(pp, fs, fs_providersize))) { >> + } else if (fs->fs_magic =3D=3D FS_UFS2_MAGIC && fs->fs_fsize > = 0) { >> /* Valid UFS2. */ >> } else { >> goto out; >>=20 >=20 > On one of my machines which uses UFS filesystems (sandbox) also fails: >=20 > bob# ls /dev/ufs > s10-amd64 s13-amd64 s13-amd64e test > s11-amd64 s13-amd64a s13-amd64f testa > s12-amd64 s13-amd64d s13-i386 > bob# mount /alt/s11-amd64/root > bob# ls /dev/ufs > s10-amd64 s12-amd64 test > s11-amd64 s13-i386 testa > bob#=20 >=20 > After the mount of /alt/s11-amd64/root, s10-amd64 the s13-* = filesystems=20 > become unavailble They share the same fdisk slice, using different=20 > bsdlabel partitions within the slice. >=20 > My laptop zfs pool is on a partition in the same slice as its UFS=20 > filesystems. Looks like once a filesystem on a slice has been mounted, = the=20 > other partitions within the slice are no longer available following = this=20 > commit. Hm, what does bsdlabel on the disk say? My guess is your disk is set up in the bogus manner mentioned in that comment. Is it an old machine installed by sysinstall(8)? Jess From owner-dev-commits-src-main@freebsd.org Mon Jul 5 18:51:55 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 65D5B661B8B; Mon, 5 Jul 2021 18:51:55 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from omta001.cacentral1.a.cloudfilter.net (omta001.cacentral1.a.cloudfilter.net [3.97.99.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GJZY63cXGz3Lp4; Mon, 5 Jul 2021 18:51:54 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from shw-obgw-4004a.ext.cloudfilter.net ([10.228.9.227]) by cmsmtp with ESMTP id 0Pp9m7Q4gFRDp0Th6mXpxM; Mon, 05 Jul 2021 18:51:48 +0000 Received: from spqr.komquats.com ([70.66.148.124]) by cmsmtp with ESMTPA id 0Th5mNROR3DJA0Th6mRJWy; Mon, 05 Jul 2021 18:51:48 +0000 X-Authority-Analysis: v=2.4 cv=FMjee8ks c=1 sm=1 tr=0 ts=60e354c4 a=Cwc3rblV8FOMdVN/wOAqyQ==:117 a=Cwc3rblV8FOMdVN/wOAqyQ==:17 a=kj9zAlcOel0A:10 a=e_q4qTt1xDgA:10 a=VxmjJ2MpAAAA:8 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=EkcXrb_YAAAA:8 a=yHHbRozUl0hyjb4n39YA:9 a=CjuIK1q_8ugA:10 a=3OlYsrKNJUQA:10 a=7gXAzLPJhVmCkEl4_tsf:22 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 a=LK5xJRSDVpKd5WXXoEvA:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id 0BE2315E; Mon, 5 Jul 2021 11:51:47 -0700 (PDT) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.16.1/8.16.1) with ESMTP id 165IpkRs003653; Mon, 5 Jul 2021 11:51:46 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <202107051851.165IpkRs003653@slippy.cwsent.com> X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Cy Schubert cc: Jessica Clarke , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: af433832f752 - main - geom_label: Remove an old sysinstall(8) workaround In-reply-to: <202107051836.165IaspD003460@slippy.cwsent.com> References: <202107051517.165FHsfD012512@gitrepo.freebsd.org> <202107051836.165IaspD003460@slippy.cwsent.com> Comments: In-reply-to Cy Schubert message dated "Mon, 05 Jul 2021 11:36:54 -0700." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Mon, 05 Jul 2021 11:51:46 -0700 X-CMAE-Envelope: MS4xfK0IEFKCTr+qxpY3Lqqs8JPKz5zYQ3xZCc/OmIoDrjrAv1A3MkihXW9hZbek5MNSTIQ95GCSXnF6QYuBJyX7EVkkIYQaibva41cVAjC9PVeCqPTE8JG6 HF3rhv956eHVn+9RWeTk/Lt1nyjnZKiA44QBNbsCuaB9dPDvhP42ewpo+httaHzfEUtpkV6D1qi+mqZERvbjxNRbgmALgGfL/f+2xSr/5DVSEDKgPD0Umevc wt29yP11xneNi8mAoROOVVWN5RSMVkUPDF62EfolsUD99uGj+iTWNP0sxXQ31szF/kD4iOq4OqWQ8yN4oNExlg9oDheD5n46B8vMN1etFxk= X-Rspamd-Queue-Id: 4GJZY63cXGz3Lp4 X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of cy.schubert@cschubert.com has no SPF policy when checking 3.97.99.32) smtp.mailfrom=cy.schubert@cschubert.com X-Spamd-Result: default: False [-0.51 / 15.00]; HAS_REPLYTO(0.00)[Cy.Schubert@cschubert.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; MV_CASE(0.50)[]; RCPT_COUNT_FIVE(0.00)[5]; NEURAL_HAM_SHORT(-0.41)[-0.412]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RBL_DBL_DONT_QUERY_IPS(0.00)[3.97.99.32:from]; ASN(0.00)[asn:16509, ipnet:3.96.0.0/15, country:US]; R_DKIM_NA(0.00)[]; RECEIVED_SPAMHAUS_PBL(0.00)[70.66.148.124:received]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.998]; RCVD_COUNT_FIVE(0.00)[5]; REPLYTO_EQ_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-0.50)[-0.504]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[cschubert.com: no valid DMARC record]; AUTH_NA(1.00)[]; SPAMHAUS_ZRD(0.00)[3.97.99.32:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_TLS_LAST(0.00)[]; R_SPF_NA(0.00)[no SPF record]; MAILMAN_DEST(0.00)[dev-commits-src-main,dev-commits-src-all] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 18:51:55 -0000 In message <202107051836.165IaspD003460@slippy.cwsent.com>, Cy Schubert writes: > In message <202107051517.165FHsfD012512@gitrepo.freebsd.org>, Jessica > Clarke wr > ites: > > The branch main has been updated by jrtc27: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=af433832f7520840c22edd1fe1266c > 1a > > 5cb781ad > > > > commit af433832f7520840c22edd1fe1266c1a5cb781ad > > Author: Jessica Clarke > > AuthorDate: 2021-07-05 15:15:32 +0000 > > Commit: Jessica Clarke > > CommitDate: 2021-07-05 15:15:32 +0000 > > > > geom_label: Remove an old sysinstall(8) workaround > > > > We removed sysinstall(8) back in 2011, so this workaround should be lon > g > > since unnecessary. This workaround can end up breaking cases that are > > hit in the real world, such as dd'ing a small pre-built disk image to a > > large partition that you intend to grow on first boot and uses a UFS > > disk label for / in its /etc/fstab (as the only reliable thing a raw UF > S > > image can reference). > > > > Reviewed by: imp, mckusick > > Differential Revision: https://reviews.freebsd.org/D30825 > > --- > > sys/geom/label/g_label_ufs.c | 35 +++++------------------------------ > > 1 file changed, 5 insertions(+), 30 deletions(-) > > > > diff --git a/sys/geom/label/g_label_ufs.c b/sys/geom/label/g_label_ufs.c > > index ababbaa4b43a..70d59488d7b6 100644 > > --- a/sys/geom/label/g_label_ufs.c > > +++ b/sys/geom/label/g_label_ufs.c > > @@ -49,19 +49,8 @@ __FBSDID("$FreeBSD$"); > > #define G_LABEL_UFS_ID 1 > > > > /* > > - * G_LABEL_UFS_CMP returns true if difference between provider mediasize > > - * and filesystem size is less than G_LABEL_UFS_MAXDIFF sectors > > - */ > > -#define G_LABEL_UFS_CMP(prov, fsys, size) > > \ > > - ( abs( ((fsys)->size) - ( (prov)->mediasize / (fsys)->fs_fsize )) \ > > - < G_LABEL_UFS_MAXDIFF ) > > -#define G_LABEL_UFS_MAXDIFF 0x100 > > - > > -/* > > - * Try to find a superblock on the provider. If successful, then > > - * check that the size in the superblock corresponds to the size > > - * of the underlying provider. Finally, look for a volume label > > - * and create an appropriate provider based on that. > > + * Try to find a superblock on the provider. If successful, look for a vol > um > > e > > + * label and create an appropriate provider based on that. > > */ > > static void > > g_label_ufs_taste_common(struct g_consumer *cp, char *label, size_t size, > in > > t what) > > @@ -81,24 +70,10 @@ g_label_ufs_taste_common(struct g_consumer *cp, char *l > ab > > el, size_t size, int wh > > return; > > } > > > > - /* > > - * Check for magic. We also need to check if file system size > > - * is almost equal to providers size, because sysinstall(8) > > - * used to bogusly put first partition at offset 0 > > - * instead of 16, and glabel/ufs would find file system on slice > > - * instead of partition. > > - * > > - * In addition, media size can be a bit bigger than file system > > - * size. For instance, mkuzip can append bytes to align data > > - * to large sector size (it improves compression rates). > > - */ > > - if (fs->fs_magic == FS_UFS1_MAGIC && fs->fs_fsize > 0 && > > - ( G_LABEL_UFS_CMP(pp, fs, fs_old_size) > > - || G_LABEL_UFS_CMP(pp, fs, fs_providersize))) { > > + /* Check for magic. */ > > + if (fs->fs_magic == FS_UFS1_MAGIC && fs->fs_fsize > 0) { > > /* Valid UFS1. */ > > - } else if (fs->fs_magic == FS_UFS2_MAGIC && fs->fs_fsize > 0 && > > - ( G_LABEL_UFS_CMP(pp, fs, fs_size) > > - || G_LABEL_UFS_CMP(pp, fs, fs_providersize))) { > > + } else if (fs->fs_magic == FS_UFS2_MAGIC && fs->fs_fsize > 0) { > > /* Valid UFS2. */ > > } else { > > goto out; > > > > On one of my machines which uses UFS filesystems (sandbox) also fails: > > bob# ls /dev/ufs > s10-amd64 s13-amd64 s13-amd64e test > s11-amd64 s13-amd64a s13-amd64f testa > s12-amd64 s13-amd64d s13-i386 > bob# mount /alt/s11-amd64/root > bob# ls /dev/ufs > s10-amd64 s12-amd64 test > s11-amd64 s13-i386 testa > bob# > > After the mount of /alt/s11-amd64/root, s10-amd64 the s13-* filesystems > become unavailble They share the same fdisk slice, using different > bsdlabel partitions within the slice. > > My laptop zfs pool is on a partition in the same slice as its UFS > filesystems. Looks like once a filesystem on a slice has been mounted, the > other partitions within the slice are no longer available following this > commit. Ok, I see the problem. The two affected machines have UFS partitions at offset 0 of their respective slices. -- Cheers, Cy Schubert FreeBSD UNIX: Web: https://FreeBSD.org NTP: Web: https://nwtime.org The need of the many outweighs the greed of the few. From owner-dev-commits-src-main@freebsd.org Mon Jul 5 18:56:49 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1D2E7661DEA; Mon, 5 Jul 2021 18:56:49 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from omta001.cacentral1.a.cloudfilter.net (omta001.cacentral1.a.cloudfilter.net [3.97.99.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GJZfm5Sscz3N91; Mon, 5 Jul 2021 18:56:48 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from shw-obgw-4004a.ext.cloudfilter.net ([10.228.9.227]) by cmsmtp with ESMTP id 0Ovcm7MkLFRDp0TlwmXrHt; Mon, 05 Jul 2021 18:56:48 +0000 Received: from spqr.komquats.com ([70.66.148.124]) by cmsmtp with ESMTPA id 0TlumNTfH3DJA0TlvmRKWQ; Mon, 05 Jul 2021 18:56:48 +0000 X-Authority-Analysis: v=2.4 cv=FMjee8ks c=1 sm=1 tr=0 ts=60e355f0 a=Cwc3rblV8FOMdVN/wOAqyQ==:117 a=Cwc3rblV8FOMdVN/wOAqyQ==:17 a=kj9zAlcOel0A:10 a=e_q4qTt1xDgA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=EkcXrb_YAAAA:8 a=r3DTfxH57WFLSE7fR2kA:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 a=LK5xJRSDVpKd5WXXoEvA:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id 60171170; Mon, 5 Jul 2021 11:56:46 -0700 (PDT) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.16.1/8.16.1) with ESMTP id 165IukLl003702; Mon, 5 Jul 2021 11:56:46 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <202107051856.165IukLl003702@slippy.cwsent.com> X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Jessica Clarke cc: Cy Schubert , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Subject: Re: git: af433832f752 - main - geom_label: Remove an old sysinstall(8) workaround In-reply-to: References: <202107051517.165FHsfD012512@gitrepo.freebsd.org> <202107051836.165IaspD003460@slippy.cwsent.com> Comments: In-reply-to Jessica Clarke message dated "Mon, 05 Jul 2021 19:48:23 +0100." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Mon, 05 Jul 2021 11:56:46 -0700 X-CMAE-Envelope: MS4xfJwRtzIMW1f5a0PeIJnSlZDQ0MPDEVMr+cEDuhbNWxRxdXWfMdBJ6Ru3B/wcDj5m1zhSYyTe30expSvuHHSklySSZhQ5p864l0BRapd5Wnux+4uEkn8Q kxeoF46qjy2BQaKUA/jyXowH5zFpLU06132S2OMzwDRLYGH0yE23E7sefVVaU/fy01RbdG8SmV9j4+IYNdqX45yfd44REN1j9ake3+Z0SL3NdzNBi5Gswdqw 7OMvBKZSE28CrPuqYQPtJtuMpa4BWK/8oi7Xk/g3BXTQb1sFsoJRDif81Fas3X2fRi5dtEJATEbWo8I9IPtIoWNSwezd5tv7Ia92QpVWmoM= X-Rspamd-Queue-Id: 4GJZfm5Sscz3N91 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 18:56:49 -0000 In message , Jessica Clarke w rites: > On 5 Jul 2021, at 19:36, Cy Schubert wrote: > > > > In message <202107051517.165FHsfD012512@gitrepo.freebsd.org>, Jessica > > Clarke wr > > ites: > >> The branch main has been updated by jrtc27: > >> > >> URL: https://cgit.FreeBSD.org/src/commit/?id=af433832f7520840c22edd1fe1266 > c1a > >> 5cb781ad > >> > >> commit af433832f7520840c22edd1fe1266c1a5cb781ad > >> Author: Jessica Clarke > >> AuthorDate: 2021-07-05 15:15:32 +0000 > >> Commit: Jessica Clarke > >> CommitDate: 2021-07-05 15:15:32 +0000 > >> > >> geom_label: Remove an old sysinstall(8) workaround > >> > >> We removed sysinstall(8) back in 2011, so this workaround should be lon > g > >> since unnecessary. This workaround can end up breaking cases that are > >> hit in the real world, such as dd'ing a small pre-built disk image to a > >> large partition that you intend to grow on first boot and uses a UFS > >> disk label for / in its /etc/fstab (as the only reliable thing a raw UF > S > >> image can reference). > >> > >> Reviewed by: imp, mckusick > >> Differential Revision: https://reviews.freebsd.org/D30825 > >> --- > >> sys/geom/label/g_label_ufs.c | 35 +++++------------------------------ > >> 1 file changed, 5 insertions(+), 30 deletions(-) > >> > >> diff --git a/sys/geom/label/g_label_ufs.c b/sys/geom/label/g_label_ufs.c > >> index ababbaa4b43a..70d59488d7b6 100644 > >> --- a/sys/geom/label/g_label_ufs.c > >> +++ b/sys/geom/label/g_label_ufs.c > >> @@ -49,19 +49,8 @@ __FBSDID("$FreeBSD$"); > >> #define G_LABEL_UFS_ID 1 > >> > >> /* > >> - * G_LABEL_UFS_CMP returns true if difference between provider mediasize > >> - * and filesystem size is less than G_LABEL_UFS_MAXDIFF sectors > >> - */ > >> -#define G_LABEL_UFS_CMP(prov, fsys, size) > >> \ > >> - ( abs( ((fsys)->size) - ( (prov)->mediasize / (fsys)->fs_fsize )) \ > >> - < G_LABEL_UFS_MAXDIFF ) > >> -#define G_LABEL_UFS_MAXDIFF 0x100 > >> - > >> -/* > >> - * Try to find a superblock on the provider. If successful, then > >> - * check that the size in the superblock corresponds to the size > >> - * of the underlying provider. Finally, look for a volume label > >> - * and create an appropriate provider based on that. > >> + * Try to find a superblock on the provider. If successful, look for a vo > lum > >> e > >> + * label and create an appropriate provider based on that. > >> */ > >> static void > >> g_label_ufs_taste_common(struct g_consumer *cp, char *label, size_t size, > in > >> t what) > >> @@ -81,24 +70,10 @@ g_label_ufs_taste_common(struct g_consumer *cp, char * > lab > >> el, size_t size, int wh > >> return; > >> } > >> > >> - /* > >> - * Check for magic. We also need to check if file system size > >> - * is almost equal to providers size, because sysinstall(8) > >> - * used to bogusly put first partition at offset 0 > >> - * instead of 16, and glabel/ufs would find file system on slice > >> - * instead of partition. > >> - * > >> - * In addition, media size can be a bit bigger than file system > >> - * size. For instance, mkuzip can append bytes to align data > >> - * to large sector size (it improves compression rates). > >> - */ > >> - if (fs->fs_magic == FS_UFS1_MAGIC && fs->fs_fsize > 0 && > >> - ( G_LABEL_UFS_CMP(pp, fs, fs_old_size) > >> - || G_LABEL_UFS_CMP(pp, fs, fs_providersize))) { > >> + /* Check for magic. */ > >> + if (fs->fs_magic == FS_UFS1_MAGIC && fs->fs_fsize > 0) { > >> /* Valid UFS1. */ > >> - } else if (fs->fs_magic == FS_UFS2_MAGIC && fs->fs_fsize > 0 && > >> - ( G_LABEL_UFS_CMP(pp, fs, fs_size) > >> - || G_LABEL_UFS_CMP(pp, fs, fs_providersize))) { > >> + } else if (fs->fs_magic == FS_UFS2_MAGIC && fs->fs_fsize > 0) { > >> /* Valid UFS2. */ > >> } else { > >> goto out; > >> > > > > On one of my machines which uses UFS filesystems (sandbox) also fails: > > > > bob# ls /dev/ufs > > s10-amd64 s13-amd64 s13-amd64e test > > s11-amd64 s13-amd64a s13-amd64f testa > > s12-amd64 s13-amd64d s13-i386 > > bob# mount /alt/s11-amd64/root > > bob# ls /dev/ufs > > s10-amd64 s12-amd64 test > > s11-amd64 s13-i386 testa > > bob# > > > > After the mount of /alt/s11-amd64/root, s10-amd64 the s13-* filesystems > > become unavailble They share the same fdisk slice, using different > > bsdlabel partitions within the slice. > > > > My laptop zfs pool is on a partition in the same slice as its UFS > > filesystems. Looks like once a filesystem on a slice has been mounted, the > > other partitions within the slice are no longer available following this > > commit. > > Hm, what does bsdlabel on the disk say? My guess is your disk is set up > in the bogus manner mentioned in that comment. Is it an old machine > installed by sysinstall(8)? A little more investigation shows that on the two affected machines, UFS partitions are at offset 0 of their respective slices. For legacy environments this will require some kind of workaround or boot off a rescue disk (which I do have) to dump/recreate/restore the partitions at an offset that is not zero. The problem is quite logical. Doing the work to recreate the partitions doesn't bother me but other people may trip across this. Your call. -- Cheers, Cy Schubert FreeBSD UNIX: Web: https://FreeBSD.org NTP: Web: https://nwtime.org The need of the many outweighs the greed of the few. From owner-dev-commits-src-main@freebsd.org Mon Jul 5 19:58:58 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 682AF662848 for ; Mon, 5 Jul 2021 19:58:58 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GJc2T1SrJz3mJ5 for ; Mon, 5 Jul 2021 19:58:57 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wr1-f52.google.com with SMTP id f14so22977820wrs.6 for ; Mon, 05 Jul 2021 12:58:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=OXc8QeWAZNBwt896YzoLowptHdApb19pMW2mxtEV8mg=; b=K3VRCjnyxnvzJdbcLkTEHNB4cu1WeMywZCTeQhpMvagKjDObiNOjR2D1YWjrPW6NFQ +K9prO1Xnwk/nI98VC0+dqwV4a1L7Xks/nbmFcRElqMXyCoiFhjucpGY8tF+hhQsTayP lAngmPq1Cxa1VG6DyH3qhPKYSdor3/cVzqLls5teUORZtPiPK5Is1zEdQloSTRIFiSvx +owVT1YC6tEbUeWTYpkCr68U2W3DELIAO02hwR9to2qy1jmEwBgzxFUWlhOf97gjV6M5 5cVwVxMBnoj16mpFQZygxRybvn+16WkiRLsx7jwKtinELv75eQRByIjr9cMTYIKeLUkW 98pw== X-Gm-Message-State: AOAM532fkzvAhXSpD4GPcR/CjAdApxB28fVN8LGbi8wpeDKO0ecKwhFl 4US8wpDBWFPac0mDFfOEU/fTNQ== X-Google-Smtp-Source: ABdhPJwBA5dl97ixRn90rtzZY99flgTDm5a8H8BqwYZGHMao6n3GjVr2Y0Sa2+UGxuqV3DeGS0PAaw== X-Received: by 2002:adf:de92:: with SMTP id w18mr6830300wrl.42.1625515135755; Mon, 05 Jul 2021 12:58:55 -0700 (PDT) Received: from smtpclient.apple (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id f1sm4736826wri.74.2021.07.05.12.58.55 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Jul 2021 12:58:55 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.100.0.2.22\)) Subject: Re: git: af433832f752 - main - geom_label: Remove an old sysinstall(8) workaround From: Jessica Clarke In-Reply-To: <202107051856.165IukLl003702@slippy.cwsent.com> Date: Mon, 5 Jul 2021 20:58:53 +0100 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: <11BB2019-EAE3-40A6-A3B1-EA3241AA91BF@freebsd.org> References: <202107051517.165FHsfD012512@gitrepo.freebsd.org> <202107051836.165IaspD003460@slippy.cwsent.com> <202107051856.165IukLl003702@slippy.cwsent.com> To: Cy Schubert X-Mailer: Apple Mail (2.3654.100.0.2.22) X-Rspamd-Queue-Id: 4GJc2T1SrJz3mJ5 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of jrtc27@jrtc27.com designates 209.85.221.52 as permitted sender) smtp.mailfrom=jrtc27@jrtc27.com X-Spamd-Result: default: False [-2.46 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17:c]; MV_CASE(0.50)[]; RCVD_COUNT_THREE(0.00)[3]; NEURAL_HAM_SHORT(-0.96)[-0.960]; FORGED_SENDER(0.30)[jrtc27@freebsd.org,jrtc27@jrtc27.com]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; MID_RHS_MATCH_FROM(0.00)[]; FROM_NEQ_ENVFROM(0.00)[jrtc27@freebsd.org,jrtc27@jrtc27.com]; ARC_NA(0.00)[]; RBL_DBL_DONT_QUERY_IPS(0.00)[209.85.221.52:from]; FREEFALL_USER(0.00)[jrtc27]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[dev-commits-src-main@freebsd.org]; DMARC_NA(0.00)[freebsd.org]; SPAMHAUS_ZRD(0.00)[209.85.221.52:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[209.85.221.52:from]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.85.221.52:from]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[dev-commits-src-main] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 19:58:58 -0000 On 5 Jul 2021, at 19:56, Cy Schubert wrote: >=20 > In message , Jessica=20= > Clarke w > rites: >> On 5 Jul 2021, at 19:36, Cy Schubert = wrote: >>>=20 >>> In message <202107051517.165FHsfD012512@gitrepo.freebsd.org>, = Jessica=20 >>> Clarke wr >>> ites: >>>> The branch main has been updated by jrtc27: >>>>=20 >>>> URL: = https://cgit.FreeBSD.org/src/commit/?id=3Daf433832f7520840c22edd1fe1266 >> c1a >>>> 5cb781ad >>>>=20 >>>> commit af433832f7520840c22edd1fe1266c1a5cb781ad >>>> Author: Jessica Clarke >>>> AuthorDate: 2021-07-05 15:15:32 +0000 >>>> Commit: Jessica Clarke >>>> CommitDate: 2021-07-05 15:15:32 +0000 >>>>=20 >>>> geom_label: Remove an old sysinstall(8) workaround >>>>=20 >>>> We removed sysinstall(8) back in 2011, so this workaround should = be lon >> g >>>> since unnecessary. This workaround can end up breaking cases that = are >>>> hit in the real world, such as dd'ing a small pre-built disk = image to a >>>> large partition that you intend to grow on first boot and uses a = UFS >>>> disk label for / in its /etc/fstab (as the only reliable thing a = raw UF >> S >>>> image can reference). >>>>=20 >>>> Reviewed by: imp, mckusick >>>> Differential Revision: https://reviews.freebsd.org/D30825 >>>> --- >>>> sys/geom/label/g_label_ufs.c | 35 = +++++------------------------------ >>>> 1 file changed, 5 insertions(+), 30 deletions(-) >>>>=20 >>>> diff --git a/sys/geom/label/g_label_ufs.c = b/sys/geom/label/g_label_ufs.c >>>> index ababbaa4b43a..70d59488d7b6 100644 >>>> --- a/sys/geom/label/g_label_ufs.c >>>> +++ b/sys/geom/label/g_label_ufs.c >>>> @@ -49,19 +49,8 @@ __FBSDID("$FreeBSD$"); >>>> #define G_LABEL_UFS_ID 1 >>>>=20 >>>> /* >>>> - * G_LABEL_UFS_CMP returns true if difference between provider = mediasize >>>> - * and filesystem size is less than G_LABEL_UFS_MAXDIFF sectors >>>> - */ >>>> -#define G_LABEL_UFS_CMP(prov, fsys, size) =09 >>>> \ >>>> - ( abs( ((fsys)->size) - ( (prov)->mediasize / (fsys)->fs_fsize = )) \ >>>> - < G_LABEL_UFS_MAXDIFF ) >>>> -#define G_LABEL_UFS_MAXDIFF 0x100 >>>> - >>>> -/* >>>> - * Try to find a superblock on the provider. If successful, then >>>> - * check that the size in the superblock corresponds to the size >>>> - * of the underlying provider. Finally, look for a volume label >>>> - * and create an appropriate provider based on that. >>>> + * Try to find a superblock on the provider. If successful, look = for a vo >> lum >>>> e >>>> + * label and create an appropriate provider based on that. >>>> */ >>>> static void >>>> g_label_ufs_taste_common(struct g_consumer *cp, char *label, size_t = size,=20 >> in >>>> t what) >>>> @@ -81,24 +70,10 @@ g_label_ufs_taste_common(struct g_consumer *cp, = char * >> lab >>>> el, size_t size, int wh >>>> return; >>>> } >>>>=20 >>>> - /* >>>> - * Check for magic. We also need to check if file system size >>>> - * is almost equal to providers size, because sysinstall(8) >>>> - * used to bogusly put first partition at offset 0 >>>> - * instead of 16, and glabel/ufs would find file system on slice >>>> - * instead of partition. >>>> - * >>>> - * In addition, media size can be a bit bigger than file system >>>> - * size. For instance, mkuzip can append bytes to align data >>>> - * to large sector size (it improves compression rates). >>>> - */ >>>> - if (fs->fs_magic =3D=3D FS_UFS1_MAGIC && fs->fs_fsize > 0 && >>>> - ( G_LABEL_UFS_CMP(pp, fs, fs_old_size) >>>> - || G_LABEL_UFS_CMP(pp, fs, fs_providersize))) { >>>> + /* Check for magic. */ >>>> + if (fs->fs_magic =3D=3D FS_UFS1_MAGIC && fs->fs_fsize > 0) { >>>> /* Valid UFS1. */ >>>> - } else if (fs->fs_magic =3D=3D FS_UFS2_MAGIC && fs->fs_fsize > 0 = && >>>> - ( G_LABEL_UFS_CMP(pp, fs, fs_size) >>>> - || G_LABEL_UFS_CMP(pp, fs, fs_providersize))) { >>>> + } else if (fs->fs_magic =3D=3D FS_UFS2_MAGIC && fs->fs_fsize > = 0) { >>>> /* Valid UFS2. */ >>>> } else { >>>> goto out; >>>>=20 >>>=20 >>> On one of my machines which uses UFS filesystems (sandbox) also = fails: >>>=20 >>> bob# ls /dev/ufs >>> s10-amd64 s13-amd64 s13-amd64e test >>> s11-amd64 s13-amd64a s13-amd64f testa >>> s12-amd64 s13-amd64d s13-i386 >>> bob# mount /alt/s11-amd64/root >>> bob# ls /dev/ufs >>> s10-amd64 s12-amd64 test >>> s11-amd64 s13-i386 testa >>> bob#=20 >>>=20 >>> After the mount of /alt/s11-amd64/root, s10-amd64 the s13-* = filesystems=20 >>> become unavailble They share the same fdisk slice, using different=20= >>> bsdlabel partitions within the slice. >>>=20 >>> My laptop zfs pool is on a partition in the same slice as its UFS=20 >>> filesystems. Looks like once a filesystem on a slice has been = mounted, the=20 >>> other partitions within the slice are no longer available following = this=20 >>> commit. >>=20 >> Hm, what does bsdlabel on the disk say? My guess is your disk is set = up >> in the bogus manner mentioned in that comment. Is it an old machine >> installed by sysinstall(8)? >=20 > A little more investigation shows that on the two affected machines, = UFS=20 > partitions are at offset 0 of their respective slices. For legacy=20 > environments this will require some kind of workaround or boot off a = rescue=20 > disk (which I do have) to dump/recreate/restore the partitions at an = offset=20 > that is not zero. The problem is quite logical. >=20 > Doing the work to recreate the partitions doesn't bother me but other=20= > people may trip across this. Your call. How about something like D31068? Jess From owner-dev-commits-src-main@freebsd.org Tue Jul 6 02:09:55 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0B27466E670; Tue, 6 Jul 2021 02:09:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GJmGV6j13z3H8s; Tue, 6 Jul 2021 02:09:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CAF9011167; Tue, 6 Jul 2021 02:09:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16629sUG076821; Tue, 6 Jul 2021 02:09:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16629sEk076820; Tue, 6 Jul 2021 02:09:54 GMT (envelope-from git) Date: Tue, 6 Jul 2021 02:09:54 GMT Message-Id: <202107060209.16629sEk076820@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Cox Subject: git: e41fde3ed71c - main - On a failed fcmpset don't pointlessly repeat tests MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: alc X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e41fde3ed71c1e4fce81eac002c9f5b0926e6c49 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 02:09:55 -0000 The branch main has been updated by alc: URL: https://cgit.FreeBSD.org/src/commit/?id=e41fde3ed71c1e4fce81eac002c9f5b0926e6c49 commit e41fde3ed71c1e4fce81eac002c9f5b0926e6c49 Author: Alan Cox AuthorDate: 2021-07-04 05:20:42 +0000 Commit: Alan Cox CommitDate: 2021-07-06 02:07:40 +0000 On a failed fcmpset don't pointlessly repeat tests In a few places, on a failed compare-and-set, both the amd64 pmap and the arm64 pmap repeat tests on bits that won't change state while the pmap is locked. Eliminate some of these unnecessary tests. Reviewed by: andrew, kib, markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31014 --- sys/amd64/amd64/pmap.c | 11 +++++------ sys/arm64/arm64/pmap.c | 15 ++++++++------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index ea017b8a61a8..5e0b6d76ae0a 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -8459,7 +8459,7 @@ pmap_remove_write(vm_page_t m) pvh = (m->flags & PG_FICTITIOUS) != 0 ? &pv_dummy : pa_to_pvh(VM_PAGE_TO_PHYS(m)); rw_wlock(lock); -retry_pv_loop: +retry: TAILQ_FOREACH_SAFE(pv, &pvh->pv_list, pv_next, next_pv) { pmap = PV_PMAP(pv); if (!PMAP_TRYLOCK(pmap)) { @@ -8469,7 +8469,7 @@ retry_pv_loop: rw_wlock(lock); if (pvh_gen != pvh->pv_gen) { PMAP_UNLOCK(pmap); - goto retry_pv_loop; + goto retry; } } PG_RW = pmap_rw_bit(pmap); @@ -8493,7 +8493,7 @@ retry_pv_loop: if (pvh_gen != pvh->pv_gen || md_gen != m->md.pv_gen) { PMAP_UNLOCK(pmap); - goto retry_pv_loop; + goto retry; } } PG_M = pmap_modified_bit(pmap); @@ -8503,12 +8503,11 @@ retry_pv_loop: ("pmap_remove_write: found a 2mpage in page %p's pv list", m)); pte = pmap_pde_to_pte(pde, pv->pv_va); -retry: oldpte = *pte; if (oldpte & PG_RW) { - if (!atomic_cmpset_long(pte, oldpte, oldpte & + while (!atomic_fcmpset_long(pte, &oldpte, oldpte & ~(PG_RW | PG_M))) - goto retry; + cpu_spinwait(); if ((oldpte & PG_M) != 0) vm_page_dirty(m); pmap_invalidate_page(pmap, pv->pv_va); diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c index 79b9d20231aa..bf476490b6be 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -3223,10 +3223,12 @@ pmap_protect_l2(pmap_t pmap, pt_entry_t *l2, vm_offset_t sva, pt_entry_t mask, * Return if the L2 entry already has the desired access restrictions * in place. */ -retry: if ((old_l2 & mask) == nbits) return; + while (!atomic_fcmpset_64(l2, &old_l2, (old_l2 & ~mask) | nbits)) + cpu_spinwait(); + /* * When a dirty read/write superpage mapping is write protected, * update the dirty field of each of the superpage's constituent 4KB @@ -3240,9 +3242,6 @@ retry: vm_page_dirty(mt); } - if (!atomic_fcmpset_64(l2, &old_l2, (old_l2 & ~mask) | nbits)) - goto retry; - /* * Since a promotion must break the 4KB page mappings before making * the 2MB page mapping, a pmap_invalidate_page() suffices. @@ -3334,7 +3333,7 @@ pmap_protect(pmap_t pmap, vm_offset_t sva, vm_offset_t eva, vm_prot_t prot) for (l3p = pmap_l2_to_l3(l2, sva); sva != va_next; l3p++, sva += L3_SIZE) { l3 = pmap_load(l3p); -retry: + /* * Go to the next L3 entry if the current one is * invalid or already has the desired access @@ -3351,6 +3350,10 @@ retry: continue; } + while (!atomic_fcmpset_64(l3p, &l3, (l3 & ~mask) | + nbits)) + cpu_spinwait(); + /* * When a dirty read/write mapping is write protected, * update the page's dirty field. @@ -3360,8 +3363,6 @@ retry: pmap_pte_dirty(pmap, l3)) vm_page_dirty(PHYS_TO_VM_PAGE(l3 & ~ATTR_MASK)); - if (!atomic_fcmpset_64(l3p, &l3, (l3 & ~mask) | nbits)) - goto retry; if (va == va_next) va = sva; } From owner-dev-commits-src-main@freebsd.org Tue Jul 6 03:13:22 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C2F8766F038; Tue, 6 Jul 2021 03:13:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GJngk55BCz3PJQ; Tue, 6 Jul 2021 03:13:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 959B711CED; Tue, 6 Jul 2021 03:13:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1663DMrH070036; Tue, 6 Jul 2021 03:13:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1663DMSJ070035; Tue, 6 Jul 2021 03:13:22 GMT (envelope-from git) Date: Tue, 6 Jul 2021 03:13:22 GMT Message-Id: <202107060313.1663DMSJ070035@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Motin Subject: git: e3bcd07d834d - main - nvme(4): Report NPWA before NPWG as stripesize. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e3bcd07d834def94dcf570ac7350ca2c454ebf10 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 03:13:22 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=e3bcd07d834def94dcf570ac7350ca2c454ebf10 commit e3bcd07d834def94dcf570ac7350ca2c454ebf10 Author: Alexander Motin AuthorDate: 2021-07-06 02:19:48 +0000 Commit: Alexander Motin CommitDate: 2021-07-06 03:13:15 +0000 nvme(4): Report NPWA before NPWG as stripesize. New Samsung 980 SSDs report Namespace Preferred Write Alignment of 8 (4KB) and Namespace Preferred Write Granularity of 32 (16KB). My quick tests show that 16KB is a minimal sequential write size when the SSD reaches peak IOPS, so writing much less is very slow. But writing slightly less or slightly more does not change much, so it seems not so much a size granularity as minimum I/O size. Thinking about different stripesize consumers: - Partition alignment should be based on NPWA by definition. - ZFS ashift in part of forcing alignment of all I/Os should also be based on NPWA. In part of forcing size granularity, if really needed, it may be set to NPWG, but too big value can make ZFS too space-inefficient, and the 16KB is actually the biggest supported value there now. - ZFS recordsize/volblocksize could potentially be tuned up toward NPWG to work as I/O size granularity, but enabled compression makes it too fuzzy. And those are normally user-configurable things. - ZFS I/O aggregation code could definitely use Optimal Write Size value and may be NPWG, but we don't have fields in GEOM now to report the minimal and optimal I/O sizes, and even maximal is not reported outside GEOM DISK to be used by ZFS. MFC after: 1 week --- sys/dev/nvme/nvme_ns.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sys/dev/nvme/nvme_ns.c b/sys/dev/nvme/nvme_ns.c index 82ab48efa826..8f97b08b88f4 100644 --- a/sys/dev/nvme/nvme_ns.c +++ b/sys/dev/nvme/nvme_ns.c @@ -231,10 +231,15 @@ nvme_ns_get_data(struct nvme_namespace *ns) uint32_t nvme_ns_get_stripesize(struct nvme_namespace *ns) { + uint32_t ss; if (((ns->data.nsfeat >> NVME_NS_DATA_NSFEAT_NPVALID_SHIFT) & - NVME_NS_DATA_NSFEAT_NPVALID_MASK) != 0 && ns->data.npwg != 0) { - return ((ns->data.npwg + 1) * nvme_ns_get_sector_size(ns)); + NVME_NS_DATA_NSFEAT_NPVALID_MASK) != 0) { + ss = nvme_ns_get_sector_size(ns); + if (ns->data.npwa != 0) + return ((ns->data.npwa + 1) * ss); + else if (ns->data.npwg != 0) + return ((ns->data.npwg + 1) * ss); } return (ns->boundary); } From owner-dev-commits-src-main@freebsd.org Tue Jul 6 07:02:42 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AD61C651A9B; Tue, 6 Jul 2021 07:02:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GJtmL4Zj5z4YQw; Tue, 6 Jul 2021 07:02:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 85148155D7; Tue, 6 Jul 2021 07:02:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16672gle076530; Tue, 6 Jul 2021 07:02:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16672gE0076529; Tue, 6 Jul 2021 07:02:42 GMT (envelope-from git) Date: Tue, 6 Jul 2021 07:02:42 GMT Message-Id: <202107060702.16672gE0076529@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wojciech Macek Subject: git: 382376f39863 - main - enetc: Add support for 2.5G fixed-link speed MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wma X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 382376f39863d553808f96527bc53bf7149780fe Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 07:02:42 -0000 The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=382376f39863d553808f96527bc53bf7149780fe commit 382376f39863d553808f96527bc53bf7149780fe Author: Wojciech Macek AuthorDate: 2021-07-06 07:01:30 +0000 Commit: Wojciech Macek CommitDate: 2021-07-06 07:01:30 +0000 enetc: Add support for 2.5G fixed-link speed With the v5.13 device-tree update speed of the CPU switch port was changed to 2.5G. Reflect that in the driver. Submitted by: Kornel Duleba Obtained from: Semihalf Sponsored by: Alstom Group --- sys/dev/enetc/if_enetc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/dev/enetc/if_enetc.c b/sys/dev/enetc/if_enetc.c index 03bd7462a062..54cdc6ea9ad4 100644 --- a/sys/dev/enetc/if_enetc.c +++ b/sys/dev/enetc/if_enetc.c @@ -287,6 +287,9 @@ enetc_setup_fixed(struct enetc_softc *sc, phandle_t node) case 1000: speed = IFM_1000_T; break; + case 2500: + speed = IFM_2500_T; + break; default: device_printf(sc->dev, "Unsupported link speed value of %d\n", speed); From owner-dev-commits-src-main@freebsd.org Tue Jul 6 08:54:40 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E6114653BBC; Tue, 6 Jul 2021 08:54:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GJxFX62dZz4mRX; Tue, 6 Jul 2021 08:54:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B69BF16E06; Tue, 6 Jul 2021 08:54:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1668seIO023704; Tue, 6 Jul 2021 08:54:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1668seVc023703; Tue, 6 Jul 2021 08:54:40 GMT (envelope-from git) Date: Tue, 6 Jul 2021 08:54:40 GMT Message-Id: <202107060854.1668seVc023703@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Edward Tomasz Napierala Subject: git: 13aa56fcd596 - main - cam(4): preserve alloc_flags when copying CCBs MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 13aa56fcd59674cd65afc8e9d6b0c15d32bf9f81 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 08:54:41 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=13aa56fcd59674cd65afc8e9d6b0c15d32bf9f81 commit 13aa56fcd59674cd65afc8e9d6b0c15d32bf9f81 Author: Edward Tomasz Napierala AuthorDate: 2021-07-06 08:23:25 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-07-06 08:27:22 +0000 cam(4): preserve alloc_flags when copying CCBs Before UMA CCBs, all CCBs were of the same size, and could be trivially copied using bcopy(9). Now we have to preserve alloc_flags, otherwise we might end up attempting to free stack-allocated CCB to UMA; we also need to take CCB size into account. This fixes kernel panic which would occur when trying to access a stopped (as in, SCSI START STOP, also "ctladm stop") SCSI device. Reported By: Gary Jennejohn Tested By: Gary Jennejohn Reviewed By: imp Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D31054 --- sys/cam/cam_periph.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/sys/cam/cam_periph.c b/sys/cam/cam_periph.c index 3e1a19936825..90ddf261cb12 100644 --- a/sys/cam/cam_periph.c +++ b/sys/cam/cam_periph.c @@ -1354,6 +1354,7 @@ camperiphdone(struct cam_periph *periph, union ccb *done_ccb) cam_status status; struct scsi_start_stop_unit *scsi_cmd; int error = 0, error_code, sense_key, asc, ascq; + u_int16_t done_flags; scsi_cmd = (struct scsi_start_stop_unit *) &done_ccb->csio.cdb_io.cdb_bytes; @@ -1422,8 +1423,21 @@ camperiphdone(struct cam_periph *periph, union ccb *done_ccb) * blocking by that also any new recovery attempts for this CCB, * and the result will be the final one returned to the CCB owher. */ + + /* + * Copy the CCB back, preserving the alloc_flags field. Things + * will crash horribly if the CCBs are not of the same size. + */ saved_ccb = (union ccb *)done_ccb->ccb_h.saved_ccb_ptr; - bcopy(saved_ccb, done_ccb, sizeof(*done_ccb)); + KASSERT(saved_ccb->ccb_h.func_code == XPT_SCSI_IO, + ("%s: saved_ccb func_code %#x != XPT_SCSI_IO", + __func__, saved_ccb->ccb_h.func_code)); + KASSERT(done_ccb->ccb_h.func_code == XPT_SCSI_IO, + ("%s: done_ccb func_code %#x != XPT_SCSI_IO", + __func__, done_ccb->ccb_h.func_code)); + done_flags = done_ccb->ccb_h.alloc_flags; + bcopy(saved_ccb, done_ccb, sizeof(struct ccb_scsiio)); + done_ccb->ccb_h.alloc_flags = done_flags; xpt_free_ccb(saved_ccb); if (done_ccb->ccb_h.cbfcnp != camperiphdone) periph->flags &= ~CAM_PERIPH_RECOVERY_INPROG; @@ -1619,6 +1633,7 @@ camperiphscsisenseerror(union ccb *ccb, union ccb **orig, struct cam_periph *periph; union ccb *orig_ccb = ccb; int error, recoveryccb; + u_int16_t flags; #if defined(BUF_TRACKING) || defined(FULL_BUF_TRACKING) if (ccb->ccb_h.func_code == XPT_SCSI_IO && ccb->csio.bio != NULL) @@ -1713,7 +1728,13 @@ camperiphscsisenseerror(union ccb *ccb, union ccb **orig, * this freeze will be dropped as part of ERESTART. */ ccb->ccb_h.status &= ~CAM_DEV_QFRZN; - bcopy(ccb, orig_ccb, sizeof(*orig_ccb)); + + KASSERT(ccb->ccb_h.func_code == XPT_SCSI_IO, + ("%s: ccb func_code %#x != XPT_SCSI_IO", + __func__, ccb->ccb_h.func_code)); + flags = orig_ccb->ccb_h.alloc_flags; + bcopy(ccb, orig_ccb, sizeof(struct ccb_scsiio)); + orig_ccb->ccb_h.alloc_flags = flags; } switch (err_action & SS_MASK) { From owner-dev-commits-src-main@freebsd.org Tue Jul 6 09:03:14 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3B808653BF6; Tue, 6 Jul 2021 09:03:14 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GJxRQ1FtNz4mrX; Tue, 6 Jul 2021 09:03:14 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from aniel.nours.eu (nours.eu [176.31.115.77]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: bapt) by smtp.freebsd.org (Postfix) with ESMTPSA id EF932554F; Tue, 6 Jul 2021 09:03:13 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: by aniel.nours.eu (Postfix, from userid 1001) id 3F5713AA12; Tue, 6 Jul 2021 11:03:11 +0200 (CEST) Date: Tue, 6 Jul 2021 11:03:11 +0200 From: Baptiste Daroussin To: Fernando =?utf-8?Q?Apestegu=C3=ADa?= Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 0a0f7486413c - main - man: Build manpages for all architectures Message-ID: <20210706090311.aomxh4n45tkpktdc@aniel.nours.eu> References: <202106300806.15U86pGq037942@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <202106300806.15U86pGq037942@gitrepo.freebsd.org> X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 09:03:14 -0000 On Wed, Jun 30, 2021 at 08:06:51AM +0000, Fernando Apesteguía wrote: > The branch main has been updated by fernape (doc, ports committer): > > URL: https://cgit.FreeBSD.org/src/commit/?id=0a0f7486413c147d56808b38055c40c64cff61f5 > > commit 0a0f7486413c147d56808b38055c40c64cff61f5 > Author: Fernando Apesteguía > AuthorDate: 2021-06-09 10:58:04 +0000 > Commit: Fernando Apesteguía > CommitDate: 2021-06-30 07:57:51 +0000 > > man: Build manpages for all architectures > > Building and installing architecture-specific man pages only raises a number of > problems: > > * The https://www.freebsd.org/cgi/man.cgi is incomplete. As an > example, it does not show results for pae(4). The reason for this is > that the cgi interface runs on FreeBSD amd64. > > * In FreeBSD amd64 some manual pages have broken X-refs. See hptrr(4) > for an example. > > * Also, we have broken links in our Release Notes. This is a > consequence of the first point. See > https://www.freebsd.org/releases/13.0R/hardware/#proc-i386. > > Make MAN_ARCH default to 'all' so we build all the man pages for all the > architectures. The difference in disk space is negligible. Also link > architecture-specific man pages to their own section while keeping their own > namespace. > > PR: 212290 > Reported by: mj@bsdops.com > Approved by: ceri@, wosch@ > MFC after: 4 weeks > --- > sbin/Makefile | 6 ++++++ > share/man/man4/Makefile | 4 +--- > share/man/man4/man4.aarch64/Makefile | 5 +++++ > share/man/man4/man4.arm/Makefile | 5 +++++ > share/man/man4/man4.i386/Makefile | 5 +++++ > share/man/man4/man4.powerpc/Makefile | 5 +++++ > share/man/man5/make.conf.5 | 2 +- > usr.sbin/Makefile | 7 +++++++ > usr.sbin/apm/Makefile | 4 ++++ > 9 files changed, 39 insertions(+), 4 deletions(-) > > diff --git a/sbin/Makefile b/sbin/Makefile > index 64840bae82bb..f53e2f037ebe 100644 > --- a/sbin/Makefile > +++ b/sbin/Makefile > @@ -90,6 +90,12 @@ SUBDIR.${MK_ZFS}+= zfsbootcfg > > SUBDIR.${MK_TESTS}+= tests > > +# Add architecture-specific manpages > +# to be included anyway > +MAN= sconfig/sconfig.8 > + > +.include > + > .include > > SUBDIR_PARALLEL= > diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile > index 5051470edc71..9027fe7df841 100644 > --- a/share/man/man4/Makefile > +++ b/share/man/man4/Makefile > @@ -895,9 +895,7 @@ _cgem.4= cgem.4 > MLINKS+=cgem.4 if_cgem.4 > .endif > > -.if empty(MAN_ARCH) > -__arches= ${MACHINE} ${MACHINE_ARCH} ${MACHINE_CPUARCH} > -.elif ${MAN_ARCH} == "all" > +.if empty(MAN_ARCH) || ${MAN_ARCH} == "all" > __arches= ${:!/bin/sh -c "/bin/ls -d ${.CURDIR}/man4.*"!:E} > .else > __arches= ${MAN_ARCH} > diff --git a/share/man/man4/man4.aarch64/Makefile b/share/man/man4/man4.aarch64/Makefile > index 6714a47011ef..ef5fcd84ccd4 100644 > --- a/share/man/man4/man4.aarch64/Makefile > +++ b/share/man/man4/man4.aarch64/Makefile > @@ -17,6 +17,11 @@ MAN= \ > rk_i2c.4 \ > rk_pinctrl.4 \ > > +# Link files to the parent directory > +.for _manpage in ${MAN} > +MLINKS+=${_manpage} ../${_manpage} > +.endfor This breaks make -DNO_ROOT in a subtle manner and so likely pkgbase. The right way to do it is to add something that uses INSTALL_RSYMLINK or alike. Best regards, Bapt From owner-dev-commits-src-main@freebsd.org Tue Jul 6 09:35:20 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 76705654C55; Tue, 6 Jul 2021 09:35:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GJy8S2w0nz4qpM; Tue, 6 Jul 2021 09:35:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4C15317343; Tue, 6 Jul 2021 09:35:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1669ZKtc076990; Tue, 6 Jul 2021 09:35:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1669ZKWq076989; Tue, 6 Jul 2021 09:35:20 GMT (envelope-from git) Date: Tue, 6 Jul 2021 09:35:20 GMT Message-Id: <202107060935.1669ZKWq076989@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Edward Tomasz Napierala Subject: git: a081a943a0ec - main - cam: drop unused 'saved_ccb' field from softcs MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a081a943a0ece20cf4ed28681ec3e01baa94ca2e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 09:35:20 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=a081a943a0ece20cf4ed28681ec3e01baa94ca2e commit a081a943a0ece20cf4ed28681ec3e01baa94ca2e Author: Edward Tomasz Napierala AuthorDate: 2021-07-06 09:04:09 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-07-06 09:04:38 +0000 cam: drop unused 'saved_ccb' field from softcs No functional changes. Do not MFC this, it changes kernel ABI. Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D30698 --- sys/cam/mmc/mmc_xpt.c | 1 - sys/cam/scsi/scsi_cd.c | 1 - sys/cam/scsi/scsi_ch.c | 1 - sys/cam/scsi/scsi_da.c | 1 - sys/cam/scsi/scsi_enc_internal.h | 1 - sys/cam/scsi/scsi_pass.c | 1 - sys/cam/scsi/scsi_pt.c | 1 - sys/cam/scsi/scsi_sa.c | 1 - sys/cam/scsi/scsi_sg.c | 1 - sys/cam/scsi/scsi_xpt.c | 1 - 10 files changed, 10 deletions(-) diff --git a/sys/cam/mmc/mmc_xpt.c b/sys/cam/mmc/mmc_xpt.c index a649946f096f..6a3ba02acecb 100644 --- a/sys/cam/mmc/mmc_xpt.c +++ b/sys/cam/mmc/mmc_xpt.c @@ -176,7 +176,6 @@ CAM_XPT_PROTO(mmc_proto); typedef struct { probe_action action; int restart; - union ccb saved_ccb; uint32_t host_ocr; uint32_t flags; #define PROBE_FLAG_ACMD_SENT 0x1 /* CMD55 is sent, card expects ACMD */ diff --git a/sys/cam/scsi/scsi_cd.c b/sys/cam/scsi/scsi_cd.c index 91d91a6a8e78..e790b0c89d02 100644 --- a/sys/cam/scsi/scsi_cd.c +++ b/sys/cam/scsi/scsi_cd.c @@ -164,7 +164,6 @@ struct cd_softc { struct bio_queue_head bio_queue; LIST_HEAD(, ccb_hdr) pending_ccbs; struct cd_params params; - union ccb saved_ccb; cd_quirks quirks; struct cam_periph *periph; int minimum_command_size; diff --git a/sys/cam/scsi/scsi_ch.c b/sys/cam/scsi/scsi_ch.c index 64b0947eaf8d..d440526a7913 100644 --- a/sys/cam/scsi/scsi_ch.c +++ b/sys/cam/scsi/scsi_ch.c @@ -145,7 +145,6 @@ struct ch_softc { ch_flags flags; ch_state state; ch_quirks quirks; - union ccb saved_ccb; struct devstat *device_stats; struct cdev *dev; int open_count; diff --git a/sys/cam/scsi/scsi_da.c b/sys/cam/scsi/scsi_da.c index cf6e2e17e410..ad4c2611333a 100644 --- a/sys/cam/scsi/scsi_da.c +++ b/sys/cam/scsi/scsi_da.c @@ -373,7 +373,6 @@ struct da_softc { int p_type; struct disk_params params; struct disk *disk; - union ccb saved_ccb; struct task sysctl_task; struct sysctl_ctx_list sysctl_ctx; struct sysctl_oid *sysctl_tree; diff --git a/sys/cam/scsi/scsi_enc_internal.h b/sys/cam/scsi/scsi_enc_internal.h index ed00dee1578c..61696a89b4ee 100644 --- a/sys/cam/scsi/scsi_enc_internal.h +++ b/sys/cam/scsi/scsi_enc_internal.h @@ -143,7 +143,6 @@ struct enc_softc { #define ENC_FLAG_INVALID 0x01 #define ENC_FLAG_INITIALIZED 0x02 #define ENC_FLAG_SHUTDOWN 0x04 - union ccb saved_ccb; struct cdev *enc_dev; struct cam_periph *periph; int open_count; diff --git a/sys/cam/scsi/scsi_pass.c b/sys/cam/scsi/scsi_pass.c index 146ff8f26700..e7d9d755c8cc 100644 --- a/sys/cam/scsi/scsi_pass.c +++ b/sys/cam/scsi/scsi_pass.c @@ -129,7 +129,6 @@ struct pass_softc { pass_state state; pass_flags flags; u_int8_t pd_type; - union ccb saved_ccb; int open_count; u_int maxio; struct devstat *device_stats; diff --git a/sys/cam/scsi/scsi_pt.c b/sys/cam/scsi/scsi_pt.c index 50ac160db6e9..4e7ce9566c59 100644 --- a/sys/cam/scsi/scsi_pt.c +++ b/sys/cam/scsi/scsi_pt.c @@ -82,7 +82,6 @@ struct pt_softc { LIST_HEAD(, ccb_hdr) pending_ccbs; pt_state state; pt_flags flags; - union ccb saved_ccb; int io_timeout; struct cdev *dev; }; diff --git a/sys/cam/scsi/scsi_sa.c b/sys/cam/scsi/scsi_sa.c index 6c7e20df9f6d..d53fd06b2377 100644 --- a/sys/cam/scsi/scsi_sa.c +++ b/sys/cam/scsi/scsi_sa.c @@ -351,7 +351,6 @@ struct sa_softc { u_int8_t dsreg; /* mtio mt_dsreg, redux */ int buffer_mode; int filemarks; - union ccb saved_ccb; int last_resid_was_io; uint8_t density_type_bits[SA_DENSITY_TYPES]; int density_info_valid[SA_DENSITY_TYPES]; diff --git a/sys/cam/scsi/scsi_sg.c b/sys/cam/scsi/scsi_sg.c index 6b6e65a39f75..c2be014b118b 100644 --- a/sys/cam/scsi/scsi_sg.c +++ b/sys/cam/scsi/scsi_sg.c @@ -106,7 +106,6 @@ struct sg_softc { int sg_timeout; int sg_user_timeout; uint8_t pd_type; - union ccb saved_ccb; }; static d_open_t sgopen; diff --git a/sys/cam/scsi/scsi_xpt.c b/sys/cam/scsi/scsi_xpt.c index b88e1869b880..6b77d50b25c3 100644 --- a/sys/cam/scsi/scsi_xpt.c +++ b/sys/cam/scsi/scsi_xpt.c @@ -189,7 +189,6 @@ typedef enum { typedef struct { TAILQ_HEAD(, ccb_hdr) request_ccbs; probe_action action; - union ccb saved_ccb; probe_flags flags; MD5_CTX context; u_int8_t digest[16]; From owner-dev-commits-src-main@freebsd.org Tue Jul 6 10:07:23 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 64F046551C6; Tue, 6 Jul 2021 10:07:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GJysR2RTVz4tKJ; Tue, 6 Jul 2021 10:07:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3D1A1178EE; Tue, 6 Jul 2021 10:07:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 166A7N2P018361; Tue, 6 Jul 2021 10:07:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 166A7NSD018360; Tue, 6 Jul 2021 10:07:23 GMT (envelope-from git) Date: Tue, 6 Jul 2021 10:07:23 GMT Message-Id: <202107061007.166A7NSD018360@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: d053fb22f6d3 - main - usr.bin/sort: Avoid UBSan errors MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d053fb22f6d3b6bb0f4e47e4507fefc20cbe0e32 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 10:07:23 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=d053fb22f6d3b6bb0f4e47e4507fefc20cbe0e32 commit d053fb22f6d3b6bb0f4e47e4507fefc20cbe0e32 Author: Alex Richardson AuthorDate: 2021-07-05 13:32:48 +0000 Commit: Alex Richardson CommitDate: 2021-07-06 09:51:05 +0000 usr.bin/sort: Avoid UBSan errors UBSan complains about out-of-bounds accesses for zero-length arrays. To avoid this we can use flexible array members. However, the C standard does not allow for structures that only contain flexible array members, so we move the length parameters into that structure too. Split out from D28233. Reviewed By: markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31009 --- usr.bin/sort/Makefile | 2 +- usr.bin/sort/bwstring.c | 267 ++++++++++++++++++++++++------------------------ usr.bin/sort/bwstring.h | 31 +++--- 3 files changed, 155 insertions(+), 145 deletions(-) diff --git a/usr.bin/sort/Makefile b/usr.bin/sort/Makefile index d38e036b90c0..3f7b607a177a 100644 --- a/usr.bin/sort/Makefile +++ b/usr.bin/sort/Makefile @@ -3,8 +3,8 @@ .include PROG= sort - SRCS= bwstring.c coll.c file.c mem.c radixsort.c sort.c vsort.c +CSTD= c11 sort.1: sort.1.in sed ${MAN_SUB} ${.ALLSRC} >${.TARGET} diff --git a/usr.bin/sort/bwstring.c b/usr.bin/sort/bwstring.c index f6200c53c83e..c31cb859cb37 100644 --- a/usr.bin/sort/bwstring.c +++ b/usr.bin/sort/bwstring.c @@ -113,7 +113,7 @@ initialise_months(void) static int wide_str_coll(const wchar_t *s1, const wchar_t *s2) { - int ret = 0; + int ret; errno = 0; ret = wcscoll(s1, s2); @@ -144,41 +144,44 @@ bwsprintf(FILE *f, struct bwstring *bws, const char *prefix, const char *suffix) { if (mb_cur_max == 1) - fprintf(f, "%s%s%s", prefix, bws->data.cstr, suffix); + fprintf(f, "%s%s%s", prefix, bws->cdata.str, suffix); else - fprintf(f, "%s%S%s", prefix, bws->data.wstr, suffix); + fprintf(f, "%s%S%s", prefix, bws->wdata.str, suffix); } const void* bwsrawdata(const struct bwstring *bws) { - return (&(bws->data)); + return (&(bws->wdata)); } size_t bwsrawlen(const struct bwstring *bws) { - return ((mb_cur_max == 1) ? bws->len : SIZEOF_WCHAR_STRING(bws->len)); + return ((mb_cur_max == 1) ? bws->cdata.len : + SIZEOF_WCHAR_STRING(bws->wdata.len)); } size_t bws_memsize(const struct bwstring *bws) { - return ((mb_cur_max == 1) ? (bws->len + 2 + sizeof(struct bwstring)) : - (SIZEOF_WCHAR_STRING(bws->len + 1) + sizeof(struct bwstring))); + return ((mb_cur_max == 1) ? + (bws->cdata.len + 2 + sizeof(struct bwstring)) : + (SIZEOF_WCHAR_STRING(bws->wdata.len + 1) + sizeof(struct bwstring))); } void bws_setlen(struct bwstring *bws, size_t newlen) { - if (bws && newlen != bws->len && newlen <= bws->len) { - bws->len = newlen; - if (mb_cur_max == 1) - bws->data.cstr[newlen] = '\0'; - else - bws->data.wstr[newlen] = L'\0'; + if (mb_cur_max == 1 && bws && newlen != bws->cdata.len && + newlen <= bws->cdata.len) { + bws->cdata.len = newlen; + bws->cdata.str[newlen] = '\0'; + } else if (bws && newlen != bws->wdata.len && newlen <= bws->wdata.len) { + bws->wdata.len = newlen; + bws->wdata.str[newlen] = L'\0'; } } @@ -190,17 +193,16 @@ bwsalloc(size_t sz) { struct bwstring *ret; - if (mb_cur_max == 1) + if (mb_cur_max == 1) { ret = sort_malloc(sizeof(struct bwstring) + 1 + sz); - else - ret = sort_malloc(sizeof(struct bwstring) + - SIZEOF_WCHAR_STRING(sz + 1)); - ret->len = sz; - - if (mb_cur_max == 1) - ret->data.cstr[ret->len] = '\0'; - else - ret->data.wstr[ret->len] = L'\0'; + ret->cdata.len = sz; + ret->cdata.str[sz] = '\0'; + } else { + ret = sort_malloc( + sizeof(struct bwstring) + SIZEOF_WCHAR_STRING(sz + 1)); + ret->wdata.len = sz; + ret->wdata.str[sz] = L'\0'; + } return (ret); } @@ -216,13 +218,13 @@ bwsdup(const struct bwstring *s) if (s == NULL) return (NULL); else { - struct bwstring *ret = bwsalloc(s->len); + struct bwstring *ret = bwsalloc(BWSLEN(s)); if (mb_cur_max == 1) - memcpy(ret->data.cstr, s->data.cstr, (s->len)); + memcpy(ret->cdata.str, s->cdata.str, (s->cdata.len)); else - memcpy(ret->data.wstr, s->data.wstr, - SIZEOF_WCHAR_STRING(s->len)); + memcpy(ret->wdata.str, s->wdata.str, + SIZEOF_WCHAR_STRING(s->wdata.len)); return (ret); } @@ -244,9 +246,9 @@ bwssbdup(const wchar_t *str, size_t len) if (mb_cur_max == 1) for (size_t i = 0; i < len; ++i) - ret->data.cstr[i] = (unsigned char) str[i]; + ret->cdata.str[i] = (char)str[i]; else - memcpy(ret->data.wstr, str, SIZEOF_WCHAR_STRING(len)); + memcpy(ret->wdata.str, str, SIZEOF_WCHAR_STRING(len)); return (ret); } @@ -264,7 +266,7 @@ bwscsbdup(const unsigned char *str, size_t len) if (str) { if (mb_cur_max == 1) - memcpy(ret->data.cstr, str, len); + memcpy(ret->cdata.str, str, len); else { mbstate_t mbs; const char *s; @@ -288,12 +290,12 @@ bwscsbdup(const unsigned char *str, size_t len) case (size_t) -1: /* FALLTHROUGH */ case (size_t) -2: - ret->data.wstr[chars++] = + ret->wdata.str[chars++] = (unsigned char) s[cptr]; ++cptr; break; default: - n = mbrtowc(ret->data.wstr + (chars++), + n = mbrtowc(ret->wdata.str + (chars++), s + cptr, charlen, &mbs); if ((n == (size_t)-1) || (n == (size_t)-2)) /* NOTREACHED */ @@ -302,8 +304,8 @@ bwscsbdup(const unsigned char *str, size_t len) } } - ret->len = chars; - ret->data.wstr[ret->len] = L'\0'; + ret->wdata.len = chars; + ret->wdata.str[ret->wdata.len] = L'\0'; } } return (ret); @@ -328,19 +330,20 @@ bwsfree(const struct bwstring *s) size_t bwscpy(struct bwstring *dst, const struct bwstring *src) { - size_t nums = src->len; + size_t nums = BWSLEN(src); - if (nums > dst->len) - nums = dst->len; - dst->len = nums; + if (nums > BWSLEN(dst)) + nums = BWSLEN(dst); if (mb_cur_max == 1) { - memcpy(dst->data.cstr, src->data.cstr, nums); - dst->data.cstr[dst->len] = '\0'; + memcpy(dst->cdata.str, src->cdata.str, nums); + dst->cdata.len = nums; + dst->cdata.str[dst->cdata.len] = '\0'; } else { - memcpy(dst->data.wstr, src->data.wstr, - SIZEOF_WCHAR_STRING(nums + 1)); - dst->data.wstr[dst->len] = L'\0'; + memcpy(dst->wdata.str, src->wdata.str, + SIZEOF_WCHAR_STRING(nums)); + dst->wdata.len = nums; + dst->wdata.str[nums] = L'\0'; } return (nums); @@ -355,21 +358,22 @@ bwscpy(struct bwstring *dst, const struct bwstring *src) struct bwstring * bwsncpy(struct bwstring *dst, const struct bwstring *src, size_t size) { - size_t nums = src->len; + size_t nums = BWSLEN(src); - if (nums > dst->len) - nums = dst->len; + if (nums > BWSLEN(dst)) + nums = BWSLEN(dst); if (nums > size) nums = size; - dst->len = nums; if (mb_cur_max == 1) { - memcpy(dst->data.cstr, src->data.cstr, nums); - dst->data.cstr[dst->len] = '\0'; + memcpy(dst->cdata.str, src->cdata.str, nums); + dst->cdata.len = nums; + dst->cdata.str[nums] = '\0'; } else { - memcpy(dst->data.wstr, src->data.wstr, - SIZEOF_WCHAR_STRING(nums + 1)); - dst->data.wstr[dst->len] = L'\0'; + memcpy(dst->wdata.str, src->wdata.str, + SIZEOF_WCHAR_STRING(nums)); + dst->wdata.len = nums; + dst->wdata.str[nums] = L'\0'; } return (dst); @@ -387,25 +391,24 @@ bwsnocpy(struct bwstring *dst, const struct bwstring *src, size_t offset, size_t size) { - if (offset >= src->len) { - dst->data.wstr[0] = 0; - dst->len = 0; + if (offset >= BWSLEN(src)) { + bws_setlen(dst, 0); } else { - size_t nums = src->len - offset; + size_t nums = BWSLEN(src) - offset; - if (nums > dst->len) - nums = dst->len; + if (nums > BWSLEN(dst)) + nums = BWSLEN(dst); if (nums > size) nums = size; - dst->len = nums; if (mb_cur_max == 1) { - memcpy(dst->data.cstr, src->data.cstr + offset, - (nums)); - dst->data.cstr[dst->len] = '\0'; + memcpy(dst->cdata.str, src->cdata.str + offset, nums); + dst->cdata.len = nums; + dst->cdata.str[nums] = '\0'; } else { - memcpy(dst->data.wstr, src->data.wstr + offset, + memcpy(dst->wdata.str, src->wdata.str + offset, SIZEOF_WCHAR_STRING(nums)); - dst->data.wstr[dst->len] = L'\0'; + dst->wdata.len = nums; + dst->wdata.str[nums] = L'\0'; } } return (dst); @@ -421,16 +424,16 @@ bwsfwrite(struct bwstring *bws, FILE *f, bool zero_ended) { if (mb_cur_max == 1) { - size_t len = bws->len; + size_t len = bws->cdata.len; if (!zero_ended) { - bws->data.cstr[len] = '\n'; + bws->cdata.str[len] = '\n'; - if (fwrite(bws->data.cstr, len + 1, 1, f) < 1) + if (fwrite(bws->cdata.str, len + 1, 1, f) < 1) err(2, NULL); - bws->data.cstr[len] = '\0'; - } else if (fwrite(bws->data.cstr, len + 1, 1, f) < 1) + bws->cdata.str[len] = '\0'; + } else if (fwrite(bws->cdata.str, len + 1, 1, f) < 1) err(2, NULL); return (len + 1); @@ -442,7 +445,7 @@ bwsfwrite(struct bwstring *bws, FILE *f, bool zero_ended) eols = zero_ended ? btowc('\0') : btowc('\n'); while (printed < BWSLEN(bws)) { - const wchar_t *s = bws->data.wstr + printed; + const wchar_t *s = bws->wdata.str + printed; if (*s == L'\0') { int nums; @@ -508,7 +511,7 @@ bwsfgetln(FILE *f, size_t *len, bool zero_ended, struct reader_buffer *rb) if (ret[*len - 1] == '\n') --(*len); } - return (bwscsbdup((unsigned char*)ret, *len)); + return (bwscsbdup((unsigned char *)ret, *len)); } else { *len = 0; @@ -548,7 +551,7 @@ bwsfgetln(FILE *f, size_t *len, bool zero_ended, struct reader_buffer *rb) } else while (!feof(f)) { - wint_t c = 0; + wint_t c; c = fgetwc(f); @@ -581,10 +584,10 @@ bwsncmp(const struct bwstring *bws1, const struct bwstring *bws2, size_t offset, size_t len) { size_t cmp_len, len1, len2; - int res = 0; + int res; - len1 = bws1->len; - len2 = bws2->len; + len1 = BWSLEN(bws1); + len2 = BWSLEN(bws2); if (len1 <= offset) { return ((len2 <= offset) ? 0 : -1); @@ -604,18 +607,18 @@ bwsncmp(const struct bwstring *bws1, const struct bwstring *bws2, cmp_len = len; if (mb_cur_max == 1) { - const unsigned char *s1, *s2; + const char *s1, *s2; - s1 = bws1->data.cstr + offset; - s2 = bws2->data.cstr + offset; + s1 = bws1->cdata.str + offset; + s2 = bws2->cdata.str + offset; res = memcmp(s1, s2, cmp_len); } else { const wchar_t *s1, *s2; - s1 = bws1->data.wstr + offset; - s2 = bws2->data.wstr + offset; + s1 = bws1->wdata.str + offset; + s2 = bws2->wdata.str + offset; res = memcmp(s1, s2, SIZEOF_WCHAR_STRING(cmp_len)); } @@ -638,8 +641,8 @@ bwscmp(const struct bwstring *bws1, const struct bwstring *bws2, size_t offset) size_t len1, len2, cmp_len; int res; - len1 = bws1->len; - len2 = bws2->len; + len1 = BWSLEN(bws1); + len2 = BWSLEN(bws2); len1 -= offset; len2 -= offset; @@ -665,7 +668,7 @@ int bws_iterator_cmp(bwstring_iterator iter1, bwstring_iterator iter2, size_t len) { wchar_t c1, c2; - size_t i = 0; + size_t i; for (i = 0; i < len; ++i) { c1 = bws_get_iter_value(iter1); @@ -684,8 +687,8 @@ bwscoll(const struct bwstring *bws1, const struct bwstring *bws2, size_t offset) { size_t len1, len2; - len1 = bws1->len; - len2 = bws2->len; + len1 = BWSLEN(bws1); + len2 = BWSLEN(bws2); if (len1 <= offset) return ((len2 <= offset) ? 0 : -1); @@ -697,13 +700,13 @@ bwscoll(const struct bwstring *bws1, const struct bwstring *bws2, size_t offset) len2 -= offset; if (mb_cur_max == 1) { - const unsigned char *s1, *s2; + const char *s1, *s2; - s1 = bws1->data.cstr + offset; - s2 = bws2->data.cstr + offset; + s1 = bws1->cdata.str + offset; + s2 = bws2->cdata.str + offset; if (byte_sort) { - int res = 0; + int res; if (len1 > len2) { res = memcmp(s1, s2, len2); @@ -719,7 +722,7 @@ bwscoll(const struct bwstring *bws1, const struct bwstring *bws2, size_t offset) return (res); } else { - int res = 0; + int res; size_t i, maxlen; i = 0; @@ -780,10 +783,10 @@ bwscoll(const struct bwstring *bws1, const struct bwstring *bws2, size_t offset) } else { const wchar_t *s1, *s2; size_t i, maxlen; - int res = 0; + int res; - s1 = bws1->data.wstr + offset; - s2 = bws2->data.wstr + offset; + s1 = bws1->wdata.str + offset; + s2 = bws2->wdata.str + offset; i = 0; maxlen = len1; @@ -850,14 +853,14 @@ bwscoll(const struct bwstring *bws1, const struct bwstring *bws2, size_t offset) double bwstod(struct bwstring *s0, bool *empty) { - double ret = 0; + double ret; if (mb_cur_max == 1) { - unsigned char *end, *s; + char *end, *s; char *ep; - s = s0->data.cstr; - end = s + s0->len; + s = s0->cdata.str; + end = s + s0->cdata.len; ep = NULL; while (isblank(*s) && s < end) @@ -869,15 +872,15 @@ bwstod(struct bwstring *s0, bool *empty) } ret = strtod((char*)s, &ep); - if ((unsigned char*) ep == s) { + if (ep == s) { *empty = true; return (0); } } else { wchar_t *end, *ep, *s; - s = s0->data.wstr; - end = s + s0->len; + s = s0->wdata.str; + end = s + s0->wdata.len; ep = NULL; while (iswblank(*s) && s < end) @@ -910,25 +913,25 @@ bws_month_score(const struct bwstring *s0) { if (mb_cur_max == 1) { - const unsigned char *end, *s; + const char *end, *s; - s = s0->data.cstr; - end = s + s0->len; + s = s0->cdata.str; + end = s + s0->cdata.len; while (isblank(*s) && s < end) ++s; for (int i = 11; i >= 0; --i) { if (cmonths[i] && - (s == (unsigned char*)strstr((const char*)s, (char*)(cmonths[i])))) + (s == strstr(s, cmonths[i]))) return (i); } } else { const wchar_t *end, *s; - s = s0->data.wstr; - end = s + s0->len; + s = s0->wdata.str; + end = s + s0->wdata.len; while (iswblank(*s) && s < end) ++s; @@ -950,11 +953,11 @@ ignore_leading_blanks(struct bwstring *str) { if (mb_cur_max == 1) { - unsigned char *dst, *end, *src; + char *dst, *end, *src; - src = str->data.cstr; + src = str->cdata.str; dst = src; - end = src + str->len; + end = src + str->cdata.len; while (src < end && isblank(*src)) ++src; @@ -974,9 +977,9 @@ ignore_leading_blanks(struct bwstring *str) } else { wchar_t *dst, *end, *src; - src = str->data.wstr; + src = str->wdata.str; dst = src; - end = src + str->len; + end = src + str->wdata.len; while (src < end && iswblank(*src)) ++src; @@ -1003,15 +1006,15 @@ ignore_leading_blanks(struct bwstring *str) struct bwstring * ignore_nonprinting(struct bwstring *str) { - size_t newlen = str->len; + size_t newlen = BWSLEN(str); if (mb_cur_max == 1) { - unsigned char *dst, *end, *src; - unsigned char c; + char *dst, *end, *src; + char c; - src = str->data.cstr; + src = str->cdata.str; dst = src; - end = src + str->len; + end = src + str->cdata.len; while (src < end) { c = *src; @@ -1028,9 +1031,9 @@ ignore_nonprinting(struct bwstring *str) wchar_t *dst, *end, *src; wchar_t c; - src = str->data.wstr; + src = str->wdata.str; dst = src; - end = src + str->len; + end = src + str->wdata.len; while (src < end) { c = *src; @@ -1056,15 +1059,15 @@ ignore_nonprinting(struct bwstring *str) struct bwstring * dictionary_order(struct bwstring *str) { - size_t newlen = str->len; + size_t newlen = BWSLEN(str); if (mb_cur_max == 1) { - unsigned char *dst, *end, *src; - unsigned char c; + char *dst, *end, *src; + char c; - src = str->data.cstr; + src = str->cdata.str; dst = src; - end = src + str->len; + end = src + str->cdata.len; while (src < end) { c = *src; @@ -1081,9 +1084,9 @@ dictionary_order(struct bwstring *str) wchar_t *dst, *end, *src; wchar_t c; - src = str->data.wstr; + src = str->wdata.str; dst = src; - end = src + str->len; + end = src + str->wdata.len; while (src < end) { c = *src; @@ -1110,10 +1113,10 @@ ignore_case(struct bwstring *str) { if (mb_cur_max == 1) { - unsigned char *end, *s; + char *end, *s; - s = str->data.cstr; - end = s + str->len; + s = str->cdata.str; + end = s + str->cdata.len; while (s < end) { *s = toupper(*s); @@ -1122,8 +1125,8 @@ ignore_case(struct bwstring *str) } else { wchar_t *end, *s; - s = str->data.wstr; - end = s + str->len; + s = str->wdata.str; + end = s + str->wdata.len; while (s < end) { *s = towupper(*s); @@ -1138,7 +1141,7 @@ bws_disorder_warnx(struct bwstring *s, const char *fn, size_t pos) { if (mb_cur_max == 1) - warnx("%s:%zu: disorder: %s", fn, pos + 1, s->data.cstr); + warnx("%s:%zu: disorder: %s", fn, pos + 1, s->cdata.str); else - warnx("%s:%zu: disorder: %ls", fn, pos + 1, s->data.wstr); + warnx("%s:%zu: disorder: %ls", fn, pos + 1, s->wdata.str); } diff --git a/usr.bin/sort/bwstring.h b/usr.bin/sort/bwstring.h index b63bb97ab93f..09a0dbf2fac2 100644 --- a/usr.bin/sort/bwstring.h +++ b/usr.bin/sort/bwstring.h @@ -46,17 +46,25 @@ extern bool byte_sort; /* wchar_t is of 4 bytes: */ #define SIZEOF_WCHAR_STRING(LEN) ((LEN)*sizeof(wchar_t)) +struct wstr { + size_t len; + wchar_t str[]; +}; + +struct cstr { + size_t len; + char str[]; +}; + /* * Binary "wide" string */ struct bwstring { - size_t len; - union - { - wchar_t wstr[0]; - unsigned char cstr[0]; - } data; + union { + struct wstr wdata; + struct cstr cdata; + }; }; struct reader_buffer @@ -67,8 +75,7 @@ struct reader_buffer typedef void *bwstring_iterator; -#define BWSLEN(s) ((s)->len) - +#define BWSLEN(s) ((mb_cur_max == 1) ? (s)->cdata.len : (s)->wdata.len) struct bwstring *bwsalloc(size_t sz); size_t bwsrawlen(const struct bwstring *bws); @@ -103,7 +110,7 @@ static inline bwstring_iterator bws_begin(struct bwstring *bws) { - return (bwstring_iterator) (&(bws->data)); + return ((bwstring_iterator)bws->wdata.str); } static inline bwstring_iterator @@ -111,8 +118,8 @@ bws_end(struct bwstring *bws) { return ((mb_cur_max == 1) ? - (bwstring_iterator) (bws->data.cstr + bws->len) : - (bwstring_iterator) (bws->data.wstr + bws->len)); + (bwstring_iterator) (bws->cdata.str + bws->cdata.len) : + (bwstring_iterator) (bws->wdata.str + bws->wdata.len)); } static inline bwstring_iterator @@ -138,7 +145,7 @@ bws_get_iter_value(bwstring_iterator iter) int bws_iterator_cmp(bwstring_iterator iter1, bwstring_iterator iter2, size_t len); -#define BWS_GET(bws, pos) ((mb_cur_max == 1) ? ((bws)->data.cstr[(pos)]) : (bws)->data.wstr[(pos)]) +#define BWS_GET(bws, pos) ((mb_cur_max == 1) ? (bws->cdata.str[(pos)]) : bws->wdata.str[(pos)]) void initialise_months(void); From owner-dev-commits-src-main@freebsd.org Tue Jul 6 10:07:24 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 88EC7655491; Tue, 6 Jul 2021 10:07:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GJysS3RB4z4ts7; Tue, 6 Jul 2021 10:07:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5E39517C9E; Tue, 6 Jul 2021 10:07:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 166A7OfK018385; Tue, 6 Jul 2021 10:07:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 166A7ORD018384; Tue, 6 Jul 2021 10:07:24 GMT (envelope-from git) Date: Tue, 6 Jul 2021 10:07:24 GMT Message-Id: <202107061007.166A7ORD018384@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: 4d552825eceb - main - usr.bin/login: send errors to console if syslog isn't running MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4d552825ecebecd6c95a995c0b314b09936121b5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 10:07:24 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=4d552825ecebecd6c95a995c0b314b09936121b5 commit 4d552825ecebecd6c95a995c0b314b09936121b5 Author: Alex Richardson AuthorDate: 2021-07-06 09:50:05 +0000 Commit: Alex Richardson CommitDate: 2021-07-06 09:51:16 +0000 usr.bin/login: send errors to console if syslog isn't running I was debugging why login(1) wasn't working as expected on a minimal MFS_ROOT disk image. This image doesn't have syslogd running so the warnings were lost and I had to use GDB to find out why login(1) was failing (missing PAM libraries) instead of being able to see it in the console output. MFC after: 1 week Reviewed By: pfg Differential Revision: https://reviews.freebsd.org/D30892 --- usr.bin/login/login.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.bin/login/login.c b/usr.bin/login/login.c index 510712a15491..2ac0d9324c26 100644 --- a/usr.bin/login/login.c +++ b/usr.bin/login/login.c @@ -199,7 +199,7 @@ main(int argc, char *argv[]) (void)alarm(timeout); (void)setpriority(PRIO_PROCESS, 0, 0); - openlog("login", 0, LOG_AUTH); + openlog("login", LOG_CONS, LOG_AUTH); uid = getuid(); euid = geteuid(); From owner-dev-commits-src-main@freebsd.org Tue Jul 6 10:07:26 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3A5236551CD; Tue, 6 Jul 2021 10:07:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GJysT6jNlz4tsG; Tue, 6 Jul 2021 10:07:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9E80B17976; Tue, 6 Jul 2021 10:07:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 166A7PGq018409; Tue, 6 Jul 2021 10:07:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 166A7PmD018408; Tue, 6 Jul 2021 10:07:25 GMT (envelope-from git) Date: Tue, 6 Jul 2021 10:07:25 GMT Message-Id: <202107061007.166A7PmD018408@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: e34c713b0e66 - main - rtld/tests: Avoid function name conflict with libc opendir() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e34c713b0e660a49b57fafc02c9eccb26b938220 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 10:07:26 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=e34c713b0e660a49b57fafc02c9eccb26b938220 commit e34c713b0e660a49b57fafc02c9eccb26b938220 Author: Alex Richardson AuthorDate: 2021-07-06 09:51:57 +0000 Commit: Alex Richardson CommitDate: 2021-07-06 09:51:57 +0000 rtld/tests: Avoid function name conflict with libc opendir() This prevents these tests from being compiled with ASAN since the asan interceptors also define opendir() but matching the libc function. Reviewed By: oshogbo, kib, markj Differential Revision: https://reviews.freebsd.org/D31038 --- libexec/rtld-elf/tests/common.c | 2 +- libexec/rtld-elf/tests/common.h | 2 +- libexec/rtld-elf/tests/ld_library_pathfds.c | 4 ++-- libexec/rtld-elf/tests/ld_preload_fds.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libexec/rtld-elf/tests/common.c b/libexec/rtld-elf/tests/common.c index 6eb3edfbc14c..82dd5180b582 100644 --- a/libexec/rtld-elf/tests/common.c +++ b/libexec/rtld-elf/tests/common.c @@ -67,7 +67,7 @@ try_to_run(int binary, int exit_status, char * const *env, } int -opendir(const char *name) +opendir_fd(const char *name) { return open(name, O_RDONLY | O_DIRECTORY); diff --git a/libexec/rtld-elf/tests/common.h b/libexec/rtld-elf/tests/common.h index d5bf2050dcfd..12a9eec36eb5 100644 --- a/libexec/rtld-elf/tests/common.h +++ b/libexec/rtld-elf/tests/common.h @@ -37,7 +37,7 @@ void expect_missing_library(int binary, char *senv); void try_to_run(int binary, int expected_exit_status, char * const *env, const char *expected_out, const char *expected_err); -int opendir(const char *name); +int opendir_fd(const char *name); int opendirat(int parent, const char *name); #endif /* _LD_COMMON_H_ */ diff --git a/libexec/rtld-elf/tests/ld_library_pathfds.c b/libexec/rtld-elf/tests/ld_library_pathfds.c index bc0627d4c3d5..ed9f51c175fa 100644 --- a/libexec/rtld-elf/tests/ld_library_pathfds.c +++ b/libexec/rtld-elf/tests/ld_library_pathfds.c @@ -159,12 +159,12 @@ static void setup(struct descriptors *dp, const atf_tc_t *tc) { - dp->testdir = opendir(atf_tc_get_config_var(tc, "srcdir")); + dp->testdir = opendir_fd(atf_tc_get_config_var(tc, "srcdir")); ATF_REQUIRE(dp->testdir >= 0); ATF_REQUIRE( (dp->binary = openat(dp->testdir, TARGET_ELF_NAME, O_RDONLY)) >= 0); - ATF_REQUIRE((dp->root = opendir("/")) >= 0); + ATF_REQUIRE((dp->root = opendir_fd("/")) >= 0); ATF_REQUIRE((dp->etc = opendirat(dp->root, "etc")) >= 0); ATF_REQUIRE((dp->usr = opendirat(dp->root, "usr")) >= 0); } diff --git a/libexec/rtld-elf/tests/ld_preload_fds.c b/libexec/rtld-elf/tests/ld_preload_fds.c index 3a220b009bb6..99378b549de5 100644 --- a/libexec/rtld-elf/tests/ld_preload_fds.c +++ b/libexec/rtld-elf/tests/ld_preload_fds.c @@ -39,7 +39,7 @@ setup(const atf_tc_t *tc) { int testdir; - testdir = opendir(atf_tc_get_config_var(tc, "srcdir")); + testdir = opendir_fd(atf_tc_get_config_var(tc, "srcdir")); ATF_REQUIRE(testdir >= 0); binaryfd = openat(testdir, TARGET_ELF_NAME, O_RDONLY); From owner-dev-commits-src-main@freebsd.org Tue Jul 6 10:07:27 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 86D20655521; Tue, 6 Jul 2021 10:07:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GJysW2Djvz4thg; Tue, 6 Jul 2021 10:07:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1257817A5A; Tue, 6 Jul 2021 10:07:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 166A7QwD018433; Tue, 6 Jul 2021 10:07:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 166A7QQu018432; Tue, 6 Jul 2021 10:07:26 GMT (envelope-from git) Date: Tue, 6 Jul 2021 10:07:26 GMT Message-Id: <202107061007.166A7QQu018432@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: 31914882fca5 - main - Import Arm Optimized Routines v21.02 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 31914882fca502069810b9e9ddea4bcd8136a4f4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 10:07:28 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=31914882fca502069810b9e9ddea4bcd8136a4f4 commit 31914882fca502069810b9e9ddea4bcd8136a4f4 Merge: e34c713b0e66 f9f37c002ab5 Author: Alex Richardson AuthorDate: 2021-07-06 10:02:44 +0000 Commit: Alex Richardson CommitDate: 2021-07-06 10:05:34 +0000 Import Arm Optimized Routines v21.02 This is the new replacement for the existing cortex-strings code which will be replaced in a follow-up commit. We should also be able to use some of the math functions to allow the tests to pass on AArch64 (and other architectures) instead of just x86. We might also be able to reuse some of the tests for the kyua testsuite. Imported using ``` curl -L https://github.com/ARM-software/optimized-routines/tarball/e823e3abf5f89ecba58a10fc0fd82c13d9984b6b | tar --strip-components=1 -xvzf - git add . ``` Differential Revision: https://reviews.freebsd.org/D29035 git-subtree-dir: contrib/arm-optimized-routines git-subtree-mainline: e34c713b0e660a49b57fafc02c9eccb26b938220 git-subtree-split: f9f37c002ab5a580accfe26b731eef45e798b435 contrib/arm-optimized-routines/.gitignore | 3 + contrib/arm-optimized-routines/LICENSE | 21 + contrib/arm-optimized-routines/Makefile | 89 + contrib/arm-optimized-routines/README | 56 + contrib/arm-optimized-routines/config.mk.dist | 73 + .../contributor-agreement.pdf | Bin 0 -> 104680 bytes contrib/arm-optimized-routines/math/Dir.mk | 110 + contrib/arm-optimized-routines/math/cosf.c | 63 + contrib/arm-optimized-routines/math/erf.c | 244 + contrib/arm-optimized-routines/math/erf_data.c | 85 + contrib/arm-optimized-routines/math/erff.c | 104 + contrib/arm-optimized-routines/math/erff_data.c | 22 + contrib/arm-optimized-routines/math/exp.c | 176 + contrib/arm-optimized-routines/math/exp2.c | 143 + contrib/arm-optimized-routines/math/exp2f.c | 80 + contrib/arm-optimized-routines/math/exp2f_data.c | 78 + contrib/arm-optimized-routines/math/exp_data.c | 1120 + contrib/arm-optimized-routines/math/expf.c | 91 + .../arm-optimized-routines/math/include/mathlib.h | 100 + contrib/arm-optimized-routines/math/log.c | 162 + contrib/arm-optimized-routines/math/log2.c | 141 + contrib/arm-optimized-routines/math/log2_data.c | 209 + contrib/arm-optimized-routines/math/log2f.c | 80 + contrib/arm-optimized-routines/math/log2f_data.c | 33 + contrib/arm-optimized-routines/math/log_data.c | 511 + contrib/arm-optimized-routines/math/logf.c | 79 + contrib/arm-optimized-routines/math/logf_data.c | 33 + contrib/arm-optimized-routines/math/math_config.h | 462 + contrib/arm-optimized-routines/math/math_err.c | 80 + contrib/arm-optimized-routines/math/math_errf.c | 80 + contrib/arm-optimized-routines/math/pow.c | 380 + contrib/arm-optimized-routines/math/pow_log_data.c | 184 + contrib/arm-optimized-routines/math/powf.c | 221 + .../arm-optimized-routines/math/powf_log2_data.c | 34 + contrib/arm-optimized-routines/math/s_cos.c | 6 + contrib/arm-optimized-routines/math/s_cosf.c | 6 + contrib/arm-optimized-routines/math/s_exp.c | 6 + contrib/arm-optimized-routines/math/s_exp2f.c | 6 + contrib/arm-optimized-routines/math/s_exp2f_1u.c | 6 + contrib/arm-optimized-routines/math/s_expf.c | 6 + contrib/arm-optimized-routines/math/s_expf_1u.c | 6 + contrib/arm-optimized-routines/math/s_log.c | 6 + contrib/arm-optimized-routines/math/s_logf.c | 6 + contrib/arm-optimized-routines/math/s_pow.c | 6 + contrib/arm-optimized-routines/math/s_powf.c | 6 + contrib/arm-optimized-routines/math/s_sin.c | 6 + contrib/arm-optimized-routines/math/s_sinf.c | 6 + contrib/arm-optimized-routines/math/sincosf.c | 79 + contrib/arm-optimized-routines/math/sincosf.h | 153 + contrib/arm-optimized-routines/math/sincosf_data.c | 63 + contrib/arm-optimized-routines/math/sinf.c | 67 + .../arm-optimized-routines/math/test/mathbench.c | 773 + .../arm-optimized-routines/math/test/mathtest.c | 1701 + .../math/test/rtest/dotest.c | 2167 ++ .../math/test/rtest/intern.h | 91 + .../arm-optimized-routines/math/test/rtest/main.c | 334 + .../math/test/rtest/random.c | 99 + .../math/test/rtest/random.h | 12 + .../arm-optimized-routines/math/test/rtest/semi.c | 905 + .../arm-optimized-routines/math/test/rtest/semi.h | 53 + .../arm-optimized-routines/math/test/rtest/types.h | 25 + .../math/test/rtest/wrappers.c | 261 + .../math/test/rtest/wrappers.h | 114 + contrib/arm-optimized-routines/math/test/runulp.sh | 315 + .../math/test/testcases/directed/cosf.tst | 25 + .../math/test/testcases/directed/erf.tst | 17 + .../math/test/testcases/directed/erff.tst | 17 + .../math/test/testcases/directed/exp.tst | 31 + .../math/test/testcases/directed/exp2.tst | 30 + .../math/test/testcases/directed/exp2f.tst | 25 + .../math/test/testcases/directed/expf.tst | 23 + .../math/test/testcases/directed/log.tst | 21 + .../math/test/testcases/directed/log2.tst | 21 + .../math/test/testcases/directed/log2f.tst | 27 + .../math/test/testcases/directed/logf.tst | 69 + .../math/test/testcases/directed/pow.tst | 1418 + .../math/test/testcases/directed/powf.tst | 246 + .../math/test/testcases/directed/sincosf.tst | 51 + .../math/test/testcases/directed/sinf.tst | 28 + .../math/test/testcases/random/double.tst | 10 + .../math/test/testcases/random/float.tst | 15 + .../math/test/traces/exp.txt | 16000 ++++++++++ .../math/test/traces/sincosf.txt | 31999 +++++++++++++++++++ contrib/arm-optimized-routines/math/test/ulp.c | 853 + contrib/arm-optimized-routines/math/test/ulp.h | 362 + .../arm-optimized-routines/math/tools/cos.sollya | 31 + .../arm-optimized-routines/math/tools/exp.sollya | 35 + .../arm-optimized-routines/math/tools/exp2.sollya | 48 + .../arm-optimized-routines/math/tools/log.sollya | 35 + .../arm-optimized-routines/math/tools/log2.sollya | 42 + .../math/tools/log2_abs.sollya | 41 + .../math/tools/log_abs.sollya | 35 + contrib/arm-optimized-routines/math/tools/plot.py | 61 + contrib/arm-optimized-routines/math/tools/remez.jl | 1334 + .../arm-optimized-routines/math/tools/sin.sollya | 37 + .../arm-optimized-routines/math/tools/v_exp.sollya | 30 + .../arm-optimized-routines/math/tools/v_log.sollya | 34 + .../arm-optimized-routines/math/tools/v_sin.sollya | 36 + contrib/arm-optimized-routines/math/v_cos.c | 87 + contrib/arm-optimized-routines/math/v_cosf.c | 76 + contrib/arm-optimized-routines/math/v_exp.c | 94 + contrib/arm-optimized-routines/math/v_exp.h | 14 + contrib/arm-optimized-routines/math/v_exp2f.c | 78 + contrib/arm-optimized-routines/math/v_exp2f_1u.c | 75 + contrib/arm-optimized-routines/math/v_exp_data.c | 403 + contrib/arm-optimized-routines/math/v_expf.c | 83 + contrib/arm-optimized-routines/math/v_expf_1u.c | 80 + contrib/arm-optimized-routines/math/v_log.c | 104 + contrib/arm-optimized-routines/math/v_log.h | 18 + contrib/arm-optimized-routines/math/v_log_data.c | 158 + contrib/arm-optimized-routines/math/v_logf.c | 73 + contrib/arm-optimized-routines/math/v_math.h | 641 + contrib/arm-optimized-routines/math/v_pow.c | 27 + contrib/arm-optimized-routines/math/v_powf.c | 235 + contrib/arm-optimized-routines/math/v_sin.c | 86 + contrib/arm-optimized-routines/math/v_sinf.c | 75 + contrib/arm-optimized-routines/math/vn_cos.c | 12 + contrib/arm-optimized-routines/math/vn_cosf.c | 12 + contrib/arm-optimized-routines/math/vn_exp.c | 12 + contrib/arm-optimized-routines/math/vn_exp2f.c | 12 + contrib/arm-optimized-routines/math/vn_exp2f_1u.c | 11 + contrib/arm-optimized-routines/math/vn_expf.c | 12 + contrib/arm-optimized-routines/math/vn_expf_1u.c | 11 + contrib/arm-optimized-routines/math/vn_log.c | 12 + contrib/arm-optimized-routines/math/vn_logf.c | 12 + contrib/arm-optimized-routines/math/vn_pow.c | 12 + contrib/arm-optimized-routines/math/vn_powf.c | 12 + contrib/arm-optimized-routines/math/vn_sin.c | 12 + contrib/arm-optimized-routines/math/vn_sinf.c | 12 + contrib/arm-optimized-routines/networking/Dir.mk | 76 + .../networking/aarch64/chksum_simd.c | 146 + .../networking/arm/chksum_simd.c | 149 + contrib/arm-optimized-routines/networking/chksum.c | 81 + .../networking/chksum_common.h | 132 + .../networking/include/networking.h | 14 + .../networking/test/chksum.c | 381 + contrib/arm-optimized-routines/string/Dir.mk | 113 + .../string/aarch64/__mtag_tag_region.S | 100 + .../string/aarch64/__mtag_tag_zero_region.S | 100 + .../string/aarch64/check-arch.S | 13 + .../string/aarch64/memchr-mte.S | 116 + .../string/aarch64/memchr-sve.S | 64 + .../arm-optimized-routines/string/aarch64/memchr.S | 146 + .../string/aarch64/memcmp-sve.S | 51 + .../arm-optimized-routines/string/aarch64/memcmp.S | 137 + .../string/aarch64/memcpy-advsimd.S | 206 + .../arm-optimized-routines/string/aarch64/memcpy.S | 243 + .../string/aarch64/memrchr.S | 117 + .../arm-optimized-routines/string/aarch64/memset.S | 117 + .../string/aarch64/stpcpy-mte.S | 10 + .../string/aarch64/stpcpy-sve.S | 10 + .../arm-optimized-routines/string/aarch64/stpcpy.S | 10 + .../string/aarch64/strchr-mte.S | 105 + .../string/aarch64/strchr-sve.S | 70 + .../arm-optimized-routines/string/aarch64/strchr.S | 126 + .../string/aarch64/strchrnul-mte.S | 84 + .../string/aarch64/strchrnul-sve.S | 9 + .../string/aarch64/strchrnul.S | 114 + .../string/aarch64/strcmp-mte.S | 189 + .../string/aarch64/strcmp-sve.S | 59 + .../arm-optimized-routines/string/aarch64/strcmp.S | 173 + .../string/aarch64/strcpy-mte.S | 161 + .../string/aarch64/strcpy-sve.S | 71 + .../arm-optimized-routines/string/aarch64/strcpy.S | 311 + .../string/aarch64/strlen-mte.S | 80 + .../string/aarch64/strlen-sve.S | 55 + .../arm-optimized-routines/string/aarch64/strlen.S | 200 + .../string/aarch64/strncmp-mte.S | 307 + .../string/aarch64/strncmp-sve.S | 69 + .../string/aarch64/strncmp.S | 260 + .../string/aarch64/strnlen-sve.S | 74 + .../string/aarch64/strnlen.S | 112 + .../string/aarch64/strrchr-mte.S | 127 + .../string/aarch64/strrchr-sve.S | 84 + .../string/aarch64/strrchr.S | 149 + .../arm-optimized-routines/string/arm/check-arch.S | 10 + contrib/arm-optimized-routines/string/arm/memchr.S | 132 + contrib/arm-optimized-routines/string/arm/memcpy.S | 587 + contrib/arm-optimized-routines/string/arm/memset.S | 98 + .../string/arm/strcmp-armv6m.S | 117 + contrib/arm-optimized-routines/string/arm/strcmp.S | 475 + contrib/arm-optimized-routines/string/arm/strcpy.c | 133 + .../string/arm/strlen-armv6t2.S | 124 + contrib/arm-optimized-routines/string/asmdefs.h | 98 + .../arm-optimized-routines/string/bench/memcpy.c | 260 + .../arm-optimized-routines/string/bench/strlen.c | 221 + .../string/include/benchlib.h | 33 + .../string/include/stringlib.h | 69 + .../string/test/__mtag_tag_region.c | 147 + .../string/test/__mtag_tag_zero_region.c | 147 + .../arm-optimized-routines/string/test/memchr.c | 110 + .../arm-optimized-routines/string/test/memcmp.c | 125 + .../arm-optimized-routines/string/test/memcpy.c | 120 + .../arm-optimized-routines/string/test/memmove.c | 164 + .../arm-optimized-routines/string/test/memrchr.c | 106 + .../arm-optimized-routines/string/test/memset.c | 129 + contrib/arm-optimized-routines/string/test/mte.h | 142 + .../arm-optimized-routines/string/test/stpcpy.c | 125 + .../arm-optimized-routines/string/test/strchr.c | 121 + .../arm-optimized-routines/string/test/strchrnul.c | 126 + .../arm-optimized-routines/string/test/strcmp.c | 132 + .../arm-optimized-routines/string/test/strcpy.c | 123 + .../string/test/stringtest.h | 55 + .../arm-optimized-routines/string/test/strlen.c | 103 + .../arm-optimized-routines/string/test/strncmp.c | 139 + .../arm-optimized-routines/string/test/strnlen.c | 109 + .../arm-optimized-routines/string/test/strrchr.c | 121 + .../string/x86_64/check-arch.S | 10 + 208 files changed, 78517 insertions(+) diff --cc contrib/arm-optimized-routines/.gitignore index 000000000000,000000000000..a814c1418935 new file mode 100644 --- /dev/null +++ b/contrib/arm-optimized-routines/.gitignore @@@ -1,0 -1,0 +1,3 @@@ ++build/ ++.DS_Store ++config.mk diff --cc contrib/arm-optimized-routines/LICENSE index 000000000000,2543b82ed92d..2543b82ed92d mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/LICENSE +++ b/contrib/arm-optimized-routines/LICENSE diff --cc contrib/arm-optimized-routines/Makefile index 000000000000,000000000000..169f89e2c9d6 new file mode 100644 --- /dev/null +++ b/contrib/arm-optimized-routines/Makefile @@@ -1,0 -1,0 +1,89 @@@ ++# Makefile - requires GNU make ++# ++# Copyright (c) 2018-2020, Arm Limited. ++# SPDX-License-Identifier: MIT ++ ++srcdir = . ++prefix = /usr ++bindir = $(prefix)/bin ++libdir = $(prefix)/lib ++includedir = $(prefix)/include ++ ++# Configure these in config.mk, do not make changes in this file. ++SUBS = math string networking ++HOST_CC = cc ++HOST_CFLAGS = -std=c99 -O2 ++HOST_LDFLAGS = ++HOST_LDLIBS = ++EMULATOR = ++CPPFLAGS = ++CFLAGS = -std=c99 -O2 ++CFLAGS_SHARED = -fPIC ++CFLAGS_ALL = -Ibuild/include $(CPPFLAGS) $(CFLAGS) ++LDFLAGS = ++LDLIBS = ++AR = $(CROSS_COMPILE)ar ++RANLIB = $(CROSS_COMPILE)ranlib ++INSTALL = install ++ ++all: ++ ++-include config.mk ++ ++$(foreach sub,$(SUBS),$(eval include $(srcdir)/$(sub)/Dir.mk)) ++ ++# Required targets of subproject foo: ++# all-foo ++# check-foo ++# clean-foo ++# install-foo ++# Required make variables of subproject foo: ++# foo-files: Built files (all in build/). ++# Make variables used by subproject foo: ++# foo-...: Variables defined in foo/Dir.mk or by config.mk. ++ ++all: $(SUBS:%=all-%) ++ ++ALL_FILES = $(foreach sub,$(SUBS),$($(sub)-files)) ++DIRS = $(sort $(patsubst %/,%,$(dir $(ALL_FILES)))) ++$(ALL_FILES): | $(DIRS) ++$(DIRS): ++ mkdir -p $@ ++ ++$(filter %.os,$(ALL_FILES)): CFLAGS_ALL += $(CFLAGS_SHARED) ++ ++build/%.o: $(srcdir)/%.S ++ $(CC) $(CFLAGS_ALL) -c -o $@ $< ++ ++build/%.o: $(srcdir)/%.c ++ $(CC) $(CFLAGS_ALL) -c -o $@ $< ++ ++build/%.os: $(srcdir)/%.S ++ $(CC) $(CFLAGS_ALL) -c -o $@ $< ++ ++build/%.os: $(srcdir)/%.c ++ $(CC) $(CFLAGS_ALL) -c -o $@ $< ++ ++clean: $(SUBS:%=clean-%) ++ rm -rf build ++ ++distclean: clean ++ rm -f config.mk ++ ++$(DESTDIR)$(bindir)/%: build/bin/% ++ $(INSTALL) -D $< $@ ++ ++$(DESTDIR)$(libdir)/%.so: build/lib/%.so ++ $(INSTALL) -D $< $@ ++ ++$(DESTDIR)$(libdir)/%: build/lib/% ++ $(INSTALL) -m 644 -D $< $@ ++ ++$(DESTDIR)$(includedir)/%: build/include/% ++ $(INSTALL) -m 644 -D $< $@ ++ ++install: $(SUBS:%=install-%) ++ ++check: $(SUBS:%=check-%) ++ ++.PHONY: all clean distclean install check diff --cc contrib/arm-optimized-routines/README index 000000000000,ae465e93fea7..ae465e93fea7 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/README +++ b/contrib/arm-optimized-routines/README diff --cc contrib/arm-optimized-routines/config.mk.dist index 000000000000,177e1ac4f53a..177e1ac4f53a mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/config.mk.dist +++ b/contrib/arm-optimized-routines/config.mk.dist diff --cc contrib/arm-optimized-routines/contributor-agreement.pdf index 000000000000,f42c3ae975d9..f42c3ae975d9 mode 000000,100644..100644 Binary files differ diff --cc contrib/arm-optimized-routines/math/Dir.mk index 000000000000,3b841ab71955..3b841ab71955 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/Dir.mk +++ b/contrib/arm-optimized-routines/math/Dir.mk diff --cc contrib/arm-optimized-routines/math/cosf.c index 000000000000,f29f19474e23..f29f19474e23 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/cosf.c +++ b/contrib/arm-optimized-routines/math/cosf.c diff --cc contrib/arm-optimized-routines/math/erf.c index 000000000000,12d7e5160df7..12d7e5160df7 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/erf.c +++ b/contrib/arm-optimized-routines/math/erf.c diff --cc contrib/arm-optimized-routines/math/erf_data.c index 000000000000,807875bdd7f5..807875bdd7f5 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/erf_data.c +++ b/contrib/arm-optimized-routines/math/erf_data.c diff --cc contrib/arm-optimized-routines/math/erff.c index 000000000000,a58e82565dc3..a58e82565dc3 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/erff.c +++ b/contrib/arm-optimized-routines/math/erff.c diff --cc contrib/arm-optimized-routines/math/erff_data.c index 000000000000,fa6b1ef4dedb..fa6b1ef4dedb mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/erff_data.c +++ b/contrib/arm-optimized-routines/math/erff_data.c diff --cc contrib/arm-optimized-routines/math/exp.c index 000000000000,7f5024cd8792..7f5024cd8792 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/exp.c +++ b/contrib/arm-optimized-routines/math/exp.c diff --cc contrib/arm-optimized-routines/math/exp2.c index 000000000000,35ab39f22ed5..35ab39f22ed5 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/exp2.c +++ b/contrib/arm-optimized-routines/math/exp2.c diff --cc contrib/arm-optimized-routines/math/exp2f.c index 000000000000,94b32538aa0d..94b32538aa0d mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/exp2f.c +++ b/contrib/arm-optimized-routines/math/exp2f.c diff --cc contrib/arm-optimized-routines/math/exp2f_data.c index 000000000000,3fb0ad11b15a..3fb0ad11b15a mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/exp2f_data.c +++ b/contrib/arm-optimized-routines/math/exp2f_data.c diff --cc contrib/arm-optimized-routines/math/exp_data.c index 000000000000,cba76832566f..cba76832566f mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/exp_data.c +++ b/contrib/arm-optimized-routines/math/exp_data.c diff --cc contrib/arm-optimized-routines/math/expf.c index 000000000000,9b2f0c3d8c56..9b2f0c3d8c56 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/expf.c +++ b/contrib/arm-optimized-routines/math/expf.c diff --cc contrib/arm-optimized-routines/math/include/mathlib.h index 000000000000,279d829d8ea1..279d829d8ea1 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/include/mathlib.h +++ b/contrib/arm-optimized-routines/math/include/mathlib.h diff --cc contrib/arm-optimized-routines/math/log.c index 000000000000,d3b7bc60747c..d3b7bc60747c mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/log.c +++ b/contrib/arm-optimized-routines/math/log.c diff --cc contrib/arm-optimized-routines/math/log2.c index 000000000000,55102b772969..55102b772969 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/log2.c +++ b/contrib/arm-optimized-routines/math/log2.c diff --cc contrib/arm-optimized-routines/math/log2_data.c index 000000000000,3fc9b47c1f03..3fc9b47c1f03 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/log2_data.c +++ b/contrib/arm-optimized-routines/math/log2_data.c diff --cc contrib/arm-optimized-routines/math/log2f.c index 000000000000,acb629e6846c..acb629e6846c mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/log2f.c +++ b/contrib/arm-optimized-routines/math/log2f.c diff --cc contrib/arm-optimized-routines/math/log2f_data.c index 000000000000,f3546d730aba..f3546d730aba mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/log2f_data.c +++ b/contrib/arm-optimized-routines/math/log2f_data.c diff --cc contrib/arm-optimized-routines/math/log_data.c index 000000000000,96a098d42c16..96a098d42c16 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/log_data.c +++ b/contrib/arm-optimized-routines/math/log_data.c diff --cc contrib/arm-optimized-routines/math/logf.c index 000000000000,cfbaee12df10..cfbaee12df10 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/logf.c +++ b/contrib/arm-optimized-routines/math/logf.c diff --cc contrib/arm-optimized-routines/math/logf_data.c index 000000000000,e8973ce4fedc..e8973ce4fedc mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/logf_data.c +++ b/contrib/arm-optimized-routines/math/logf_data.c diff --cc contrib/arm-optimized-routines/math/math_config.h index 000000000000,e85104337048..e85104337048 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/math_config.h +++ b/contrib/arm-optimized-routines/math/math_config.h diff --cc contrib/arm-optimized-routines/math/math_err.c index 000000000000,1bf9538a1ab1..1bf9538a1ab1 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/math_err.c +++ b/contrib/arm-optimized-routines/math/math_err.c diff --cc contrib/arm-optimized-routines/math/math_errf.c index 000000000000,d5350b819ab1..d5350b819ab1 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/math_errf.c +++ b/contrib/arm-optimized-routines/math/math_errf.c diff --cc contrib/arm-optimized-routines/math/pow.c index 000000000000,86842c6abacd..86842c6abacd mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/pow.c +++ b/contrib/arm-optimized-routines/math/pow.c diff --cc contrib/arm-optimized-routines/math/pow_log_data.c index 000000000000,45569c5cc064..45569c5cc064 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/pow_log_data.c +++ b/contrib/arm-optimized-routines/math/pow_log_data.c diff --cc contrib/arm-optimized-routines/math/powf.c index 000000000000,6ba45d3852a5..6ba45d3852a5 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/powf.c +++ b/contrib/arm-optimized-routines/math/powf.c diff --cc contrib/arm-optimized-routines/math/powf_log2_data.c index 000000000000,97e0d98cdbab..97e0d98cdbab mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/powf_log2_data.c +++ b/contrib/arm-optimized-routines/math/powf_log2_data.c diff --cc contrib/arm-optimized-routines/math/s_cos.c index 000000000000,53a95b0adfde..53a95b0adfde mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/s_cos.c +++ b/contrib/arm-optimized-routines/math/s_cos.c diff --cc contrib/arm-optimized-routines/math/s_cosf.c index 000000000000,914c02eba651..914c02eba651 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/s_cosf.c +++ b/contrib/arm-optimized-routines/math/s_cosf.c diff --cc contrib/arm-optimized-routines/math/s_exp.c index 000000000000,ac7246b2c100..ac7246b2c100 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/s_exp.c +++ b/contrib/arm-optimized-routines/math/s_exp.c diff --cc contrib/arm-optimized-routines/math/s_exp2f.c index 000000000000,df7dfd680ff4..df7dfd680ff4 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/s_exp2f.c +++ b/contrib/arm-optimized-routines/math/s_exp2f.c diff --cc contrib/arm-optimized-routines/math/s_exp2f_1u.c index 000000000000,5e3852b41d83..5e3852b41d83 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/s_exp2f_1u.c +++ b/contrib/arm-optimized-routines/math/s_exp2f_1u.c diff --cc contrib/arm-optimized-routines/math/s_expf.c index 000000000000,3492c460733d..3492c460733d mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/s_expf.c +++ b/contrib/arm-optimized-routines/math/s_expf.c diff --cc contrib/arm-optimized-routines/math/s_expf_1u.c index 000000000000,eb7bbcba5566..eb7bbcba5566 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/s_expf_1u.c +++ b/contrib/arm-optimized-routines/math/s_expf_1u.c diff --cc contrib/arm-optimized-routines/math/s_log.c index 000000000000,23289cf948ec..23289cf948ec mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/s_log.c +++ b/contrib/arm-optimized-routines/math/s_log.c diff --cc contrib/arm-optimized-routines/math/s_logf.c index 000000000000,9399350fc1ee..9399350fc1ee mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/s_logf.c +++ b/contrib/arm-optimized-routines/math/s_logf.c diff --cc contrib/arm-optimized-routines/math/s_pow.c index 000000000000,2e34c9f896d6..2e34c9f896d6 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/s_pow.c +++ b/contrib/arm-optimized-routines/math/s_pow.c diff --cc contrib/arm-optimized-routines/math/s_powf.c index 000000000000,6d91a4a72b37..6d91a4a72b37 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/s_powf.c +++ b/contrib/arm-optimized-routines/math/s_powf.c diff --cc contrib/arm-optimized-routines/math/s_sin.c index 000000000000,06982c2018c6..06982c2018c6 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/s_sin.c +++ b/contrib/arm-optimized-routines/math/s_sin.c diff --cc contrib/arm-optimized-routines/math/s_sinf.c index 000000000000,68ca90853736..68ca90853736 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/s_sinf.c +++ b/contrib/arm-optimized-routines/math/s_sinf.c diff --cc contrib/arm-optimized-routines/math/sincosf.c index 000000000000,9746f1c22e6c..9746f1c22e6c mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/sincosf.c +++ b/contrib/arm-optimized-routines/math/sincosf.c diff --cc contrib/arm-optimized-routines/math/sincosf.h index 000000000000,1e80fc9ba8e1..1e80fc9ba8e1 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/sincosf.h +++ b/contrib/arm-optimized-routines/math/sincosf.h diff --cc contrib/arm-optimized-routines/math/sincosf_data.c index 000000000000,ab4ac4710fef..ab4ac4710fef mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/sincosf_data.c +++ b/contrib/arm-optimized-routines/math/sincosf_data.c diff --cc contrib/arm-optimized-routines/math/sinf.c index 000000000000,ddbc1daf74a9..ddbc1daf74a9 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/sinf.c +++ b/contrib/arm-optimized-routines/math/sinf.c diff --cc contrib/arm-optimized-routines/math/test/mathbench.c index 000000000000,0c17826e5296..0c17826e5296 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/test/mathbench.c +++ b/contrib/arm-optimized-routines/math/test/mathbench.c diff --cc contrib/arm-optimized-routines/math/test/mathtest.c index 000000000000,310896738e47..310896738e47 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/test/mathtest.c +++ b/contrib/arm-optimized-routines/math/test/mathtest.c diff --cc contrib/arm-optimized-routines/math/test/rtest/dotest.c index 000000000000,6be79e1df0d1..6be79e1df0d1 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/test/rtest/dotest.c +++ b/contrib/arm-optimized-routines/math/test/rtest/dotest.c diff --cc contrib/arm-optimized-routines/math/test/rtest/intern.h index 000000000000,12a9c749e18e..12a9c749e18e mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/test/rtest/intern.h +++ b/contrib/arm-optimized-routines/math/test/rtest/intern.h diff --cc contrib/arm-optimized-routines/math/test/rtest/main.c index 000000000000,0d8ead891320..0d8ead891320 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/test/rtest/main.c +++ b/contrib/arm-optimized-routines/math/test/rtest/main.c diff --cc contrib/arm-optimized-routines/math/test/rtest/random.c index 000000000000,56123966b8c4..56123966b8c4 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/test/rtest/random.c +++ b/contrib/arm-optimized-routines/math/test/rtest/random.c diff --cc contrib/arm-optimized-routines/math/test/rtest/random.h index 000000000000,b4b22df82a3d..b4b22df82a3d mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/test/rtest/random.h +++ b/contrib/arm-optimized-routines/math/test/rtest/random.h diff --cc contrib/arm-optimized-routines/math/test/rtest/semi.c index 000000000000,c9f0daf76508..c9f0daf76508 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/test/rtest/semi.c +++ b/contrib/arm-optimized-routines/math/test/rtest/semi.c diff --cc contrib/arm-optimized-routines/math/test/rtest/semi.h index 000000000000,17dc4158fb51..17dc4158fb51 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/test/rtest/semi.h +++ b/contrib/arm-optimized-routines/math/test/rtest/semi.h diff --cc contrib/arm-optimized-routines/math/test/rtest/types.h index 000000000000,53cd557fa4cf..53cd557fa4cf mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/test/rtest/types.h +++ b/contrib/arm-optimized-routines/math/test/rtest/types.h diff --cc contrib/arm-optimized-routines/math/test/rtest/wrappers.c index 000000000000,de45ac5768d0..de45ac5768d0 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/test/rtest/wrappers.c +++ b/contrib/arm-optimized-routines/math/test/rtest/wrappers.c diff --cc contrib/arm-optimized-routines/math/test/rtest/wrappers.h index 000000000000,7b09c85a59f1..7b09c85a59f1 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/test/rtest/wrappers.h +++ b/contrib/arm-optimized-routines/math/test/rtest/wrappers.h diff --cc contrib/arm-optimized-routines/math/test/runulp.sh index 000000000000,0190d9ab27fb..0190d9ab27fb mode 000000,100755..100755 --- a/contrib/arm-optimized-routines/math/test/runulp.sh +++ b/contrib/arm-optimized-routines/math/test/runulp.sh diff --cc contrib/arm-optimized-routines/math/test/testcases/directed/cosf.tst index 000000000000,79160443f099..79160443f099 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/test/testcases/directed/cosf.tst +++ b/contrib/arm-optimized-routines/math/test/testcases/directed/cosf.tst diff --cc contrib/arm-optimized-routines/math/test/testcases/directed/erf.tst index 000000000000,7fa4d1868c0e..7fa4d1868c0e mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/test/testcases/directed/erf.tst +++ b/contrib/arm-optimized-routines/math/test/testcases/directed/erf.tst diff --cc contrib/arm-optimized-routines/math/test/testcases/directed/erff.tst index 000000000000,d05b7b1119c4..d05b7b1119c4 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/test/testcases/directed/erff.tst +++ b/contrib/arm-optimized-routines/math/test/testcases/directed/erff.tst diff --cc contrib/arm-optimized-routines/math/test/testcases/directed/exp.tst index 000000000000,85d556cd1e00..85d556cd1e00 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/test/testcases/directed/exp.tst +++ b/contrib/arm-optimized-routines/math/test/testcases/directed/exp.tst diff --cc contrib/arm-optimized-routines/math/test/testcases/directed/exp2.tst index 000000000000,fa56c9f8be4b..fa56c9f8be4b mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/test/testcases/directed/exp2.tst +++ b/contrib/arm-optimized-routines/math/test/testcases/directed/exp2.tst diff --cc contrib/arm-optimized-routines/math/test/testcases/directed/exp2f.tst index 000000000000,38cfc3f78ac6..38cfc3f78ac6 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/test/testcases/directed/exp2f.tst +++ b/contrib/arm-optimized-routines/math/test/testcases/directed/exp2f.tst diff --cc contrib/arm-optimized-routines/math/test/testcases/directed/expf.tst index 000000000000,ff0f671c2656..ff0f671c2656 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/test/testcases/directed/expf.tst +++ b/contrib/arm-optimized-routines/math/test/testcases/directed/expf.tst diff --cc contrib/arm-optimized-routines/math/test/testcases/directed/log.tst index 000000000000,a0aa398cbf73..a0aa398cbf73 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/test/testcases/directed/log.tst +++ b/contrib/arm-optimized-routines/math/test/testcases/directed/log.tst diff --cc contrib/arm-optimized-routines/math/test/testcases/directed/log2.tst index 000000000000,ff1286cbd53e..ff1286cbd53e mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/test/testcases/directed/log2.tst +++ b/contrib/arm-optimized-routines/math/test/testcases/directed/log2.tst diff --cc contrib/arm-optimized-routines/math/test/testcases/directed/log2f.tst index 000000000000,5832c4f08f1e..5832c4f08f1e mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/test/testcases/directed/log2f.tst +++ b/contrib/arm-optimized-routines/math/test/testcases/directed/log2f.tst diff --cc contrib/arm-optimized-routines/math/test/testcases/directed/logf.tst index 000000000000,6e68a36e0f6a..6e68a36e0f6a mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/test/testcases/directed/logf.tst +++ b/contrib/arm-optimized-routines/math/test/testcases/directed/logf.tst diff --cc contrib/arm-optimized-routines/math/test/testcases/directed/pow.tst index 000000000000,19665817153d..19665817153d mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/test/testcases/directed/pow.tst +++ b/contrib/arm-optimized-routines/math/test/testcases/directed/pow.tst diff --cc contrib/arm-optimized-routines/math/test/testcases/directed/powf.tst index 000000000000,3fa8b110f8bc..3fa8b110f8bc mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/test/testcases/directed/powf.tst +++ b/contrib/arm-optimized-routines/math/test/testcases/directed/powf.tst diff --cc contrib/arm-optimized-routines/math/test/testcases/directed/sincosf.tst index 000000000000,4b33d2291c66..4b33d2291c66 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/test/testcases/directed/sincosf.tst +++ b/contrib/arm-optimized-routines/math/test/testcases/directed/sincosf.tst diff --cc contrib/arm-optimized-routines/math/test/testcases/directed/sinf.tst index 000000000000,ded80b1598c6..ded80b1598c6 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/test/testcases/directed/sinf.tst +++ b/contrib/arm-optimized-routines/math/test/testcases/directed/sinf.tst diff --cc contrib/arm-optimized-routines/math/test/testcases/random/double.tst index 000000000000,c24ff80d5d95..c24ff80d5d95 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/test/testcases/random/double.tst +++ b/contrib/arm-optimized-routines/math/test/testcases/random/double.tst diff --cc contrib/arm-optimized-routines/math/test/testcases/random/float.tst index 000000000000,d02a22750abe..d02a22750abe mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/test/testcases/random/float.tst +++ b/contrib/arm-optimized-routines/math/test/testcases/random/float.tst diff --cc contrib/arm-optimized-routines/math/test/traces/exp.txt index 000000000000,cb067d5174b9..cb067d5174b9 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/test/traces/exp.txt +++ b/contrib/arm-optimized-routines/math/test/traces/exp.txt diff --cc contrib/arm-optimized-routines/math/test/traces/sincosf.txt index 000000000000,33de0c7ab9e3..33de0c7ab9e3 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/test/traces/sincosf.txt +++ b/contrib/arm-optimized-routines/math/test/traces/sincosf.txt diff --cc contrib/arm-optimized-routines/math/test/ulp.c index 000000000000,51479b87a0fd..51479b87a0fd mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/test/ulp.c +++ b/contrib/arm-optimized-routines/math/test/ulp.c diff --cc contrib/arm-optimized-routines/math/test/ulp.h index 000000000000,a0c301664321..a0c301664321 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/test/ulp.h +++ b/contrib/arm-optimized-routines/math/test/ulp.h diff --cc contrib/arm-optimized-routines/math/tools/cos.sollya index 000000000000,bd72d6b74820..bd72d6b74820 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/tools/cos.sollya +++ b/contrib/arm-optimized-routines/math/tools/cos.sollya diff --cc contrib/arm-optimized-routines/math/tools/exp.sollya index 000000000000,b7a462cda5a4..b7a462cda5a4 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/tools/exp.sollya +++ b/contrib/arm-optimized-routines/math/tools/exp.sollya diff --cc contrib/arm-optimized-routines/math/tools/exp2.sollya index 000000000000,e760769601d4..e760769601d4 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/tools/exp2.sollya +++ b/contrib/arm-optimized-routines/math/tools/exp2.sollya diff --cc contrib/arm-optimized-routines/math/tools/log.sollya index 000000000000,6df4db44b6f3..6df4db44b6f3 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/tools/log.sollya +++ b/contrib/arm-optimized-routines/math/tools/log.sollya diff --cc contrib/arm-optimized-routines/math/tools/log2.sollya index 000000000000,4a364c0f111f..4a364c0f111f mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/tools/log2.sollya +++ b/contrib/arm-optimized-routines/math/tools/log2.sollya diff --cc contrib/arm-optimized-routines/math/tools/log2_abs.sollya index 000000000000,82c4dac26fa1..82c4dac26fa1 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/tools/log2_abs.sollya +++ b/contrib/arm-optimized-routines/math/tools/log2_abs.sollya diff --cc contrib/arm-optimized-routines/math/tools/log_abs.sollya index 000000000000,a2ac190fc497..a2ac190fc497 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/tools/log_abs.sollya +++ b/contrib/arm-optimized-routines/math/tools/log_abs.sollya diff --cc contrib/arm-optimized-routines/math/tools/plot.py index 000000000000,6c8b89ff284b..6c8b89ff284b mode 000000,100755..100755 --- a/contrib/arm-optimized-routines/math/tools/plot.py +++ b/contrib/arm-optimized-routines/math/tools/plot.py diff --cc contrib/arm-optimized-routines/math/tools/remez.jl index 000000000000,2ff436f5287f..2ff436f5287f mode 000000,100755..100755 --- a/contrib/arm-optimized-routines/math/tools/remez.jl +++ b/contrib/arm-optimized-routines/math/tools/remez.jl diff --cc contrib/arm-optimized-routines/math/tools/sin.sollya index 000000000000,a6e851145c11..a6e851145c11 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/tools/sin.sollya +++ b/contrib/arm-optimized-routines/math/tools/sin.sollya diff --cc contrib/arm-optimized-routines/math/tools/v_exp.sollya index 000000000000,c0abb63fb642..c0abb63fb642 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/tools/v_exp.sollya +++ b/contrib/arm-optimized-routines/math/tools/v_exp.sollya diff --cc contrib/arm-optimized-routines/math/tools/v_log.sollya index 000000000000,cc3d2c4ae72a..cc3d2c4ae72a mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/tools/v_log.sollya +++ b/contrib/arm-optimized-routines/math/tools/v_log.sollya diff --cc contrib/arm-optimized-routines/math/tools/v_sin.sollya index 000000000000,65cc9957c624..65cc9957c624 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/tools/v_sin.sollya +++ b/contrib/arm-optimized-routines/math/tools/v_sin.sollya diff --cc contrib/arm-optimized-routines/math/v_cos.c index 000000000000,20ba6bd0d0d9..20ba6bd0d0d9 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/v_cos.c +++ b/contrib/arm-optimized-routines/math/v_cos.c diff --cc contrib/arm-optimized-routines/math/v_cosf.c index 000000000000,150294b8845e..150294b8845e mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/v_cosf.c +++ b/contrib/arm-optimized-routines/math/v_cosf.c diff --cc contrib/arm-optimized-routines/math/v_exp.c index 000000000000,e459d53fddd2..e459d53fddd2 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/v_exp.c +++ b/contrib/arm-optimized-routines/math/v_exp.c diff --cc contrib/arm-optimized-routines/math/v_exp.h index 000000000000,305da19c0a53..305da19c0a53 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/v_exp.h +++ b/contrib/arm-optimized-routines/math/v_exp.h diff --cc contrib/arm-optimized-routines/math/v_exp2f.c index 000000000000,e3ea5af3414d..e3ea5af3414d mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/v_exp2f.c +++ b/contrib/arm-optimized-routines/math/v_exp2f.c diff --cc contrib/arm-optimized-routines/math/v_exp2f_1u.c index 000000000000,1caa14d9bfff..1caa14d9bfff mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/v_exp2f_1u.c +++ b/contrib/arm-optimized-routines/math/v_exp2f_1u.c diff --cc contrib/arm-optimized-routines/math/v_exp_data.c index 000000000000,365355497e95..365355497e95 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/v_exp_data.c +++ b/contrib/arm-optimized-routines/math/v_exp_data.c diff --cc contrib/arm-optimized-routines/math/v_expf.c index 000000000000,d403e00534f0..d403e00534f0 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/v_expf.c +++ b/contrib/arm-optimized-routines/math/v_expf.c diff --cc contrib/arm-optimized-routines/math/v_expf_1u.c index 000000000000,023bd248c9ac..023bd248c9ac mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/v_expf_1u.c +++ b/contrib/arm-optimized-routines/math/v_expf_1u.c diff --cc contrib/arm-optimized-routines/math/v_log.c index 000000000000,d84c740d2b6b..d84c740d2b6b mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/v_log.c +++ b/contrib/arm-optimized-routines/math/v_log.c diff --cc contrib/arm-optimized-routines/math/v_log.h index 000000000000,bcc2fa6fa930..bcc2fa6fa930 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/v_log.h +++ b/contrib/arm-optimized-routines/math/v_log.h diff --cc contrib/arm-optimized-routines/math/v_log_data.c index 000000000000,97ee5b09c6a9..97ee5b09c6a9 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/v_log_data.c +++ b/contrib/arm-optimized-routines/math/v_log_data.c diff --cc contrib/arm-optimized-routines/math/v_logf.c index 000000000000,7373192f03fa..7373192f03fa mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/v_logf.c +++ b/contrib/arm-optimized-routines/math/v_logf.c diff --cc contrib/arm-optimized-routines/math/v_math.h index 000000000000,f2cc4670bb9b..f2cc4670bb9b mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/v_math.h +++ b/contrib/arm-optimized-routines/math/v_math.h diff --cc contrib/arm-optimized-routines/math/v_pow.c index 000000000000,a209d57f41ce..a209d57f41ce mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/v_pow.c +++ b/contrib/arm-optimized-routines/math/v_pow.c diff --cc contrib/arm-optimized-routines/math/v_powf.c index 000000000000,fb80fa6f1846..fb80fa6f1846 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/v_powf.c +++ b/contrib/arm-optimized-routines/math/v_powf.c diff --cc contrib/arm-optimized-routines/math/v_sin.c index 000000000000,2b9ed059189c..2b9ed059189c mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/v_sin.c +++ b/contrib/arm-optimized-routines/math/v_sin.c diff --cc contrib/arm-optimized-routines/math/v_sinf.c index 000000000000,e66bfce6d8aa..e66bfce6d8aa mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/v_sinf.c +++ b/contrib/arm-optimized-routines/math/v_sinf.c diff --cc contrib/arm-optimized-routines/math/vn_cos.c index 000000000000,b57a549eba68..b57a549eba68 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/vn_cos.c +++ b/contrib/arm-optimized-routines/math/vn_cos.c diff --cc contrib/arm-optimized-routines/math/vn_cosf.c index 000000000000,6321d4620fa7..6321d4620fa7 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/vn_cosf.c +++ b/contrib/arm-optimized-routines/math/vn_cosf.c diff --cc contrib/arm-optimized-routines/math/vn_exp.c index 000000000000,06e269d41766..06e269d41766 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/vn_exp.c +++ b/contrib/arm-optimized-routines/math/vn_exp.c diff --cc contrib/arm-optimized-routines/math/vn_exp2f.c index 000000000000,db9707e86f16..db9707e86f16 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/vn_exp2f.c +++ b/contrib/arm-optimized-routines/math/vn_exp2f.c diff --cc contrib/arm-optimized-routines/math/vn_exp2f_1u.c index 000000000000,17bd0abd7a60..17bd0abd7a60 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/vn_exp2f_1u.c +++ b/contrib/arm-optimized-routines/math/vn_exp2f_1u.c diff --cc contrib/arm-optimized-routines/math/vn_expf.c index 000000000000,0652907225d9..0652907225d9 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/vn_expf.c +++ b/contrib/arm-optimized-routines/math/vn_expf.c diff --cc contrib/arm-optimized-routines/math/vn_expf_1u.c index 000000000000,3be776814822..3be776814822 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/vn_expf_1u.c +++ b/contrib/arm-optimized-routines/math/vn_expf_1u.c diff --cc contrib/arm-optimized-routines/math/vn_log.c index 000000000000,b58fe8ff820a..b58fe8ff820a mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/vn_log.c +++ b/contrib/arm-optimized-routines/math/vn_log.c diff --cc contrib/arm-optimized-routines/math/vn_logf.c index 000000000000,cc5b8ae3ed55..cc5b8ae3ed55 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/vn_logf.c +++ b/contrib/arm-optimized-routines/math/vn_logf.c diff --cc contrib/arm-optimized-routines/math/vn_pow.c index 000000000000,260950113b04..260950113b04 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/vn_pow.c +++ b/contrib/arm-optimized-routines/math/vn_pow.c diff --cc contrib/arm-optimized-routines/math/vn_powf.c index 000000000000,095d07e337ad..095d07e337ad mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/vn_powf.c +++ b/contrib/arm-optimized-routines/math/vn_powf.c diff --cc contrib/arm-optimized-routines/math/vn_sin.c index 000000000000,905c79623350..905c79623350 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/vn_sin.c +++ b/contrib/arm-optimized-routines/math/vn_sin.c diff --cc contrib/arm-optimized-routines/math/vn_sinf.c index 000000000000,1214e1a55638..1214e1a55638 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/vn_sinf.c +++ b/contrib/arm-optimized-routines/math/vn_sinf.c diff --cc contrib/arm-optimized-routines/networking/Dir.mk index 000000000000,b49610341171..b49610341171 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/networking/Dir.mk +++ b/contrib/arm-optimized-routines/networking/Dir.mk diff --cc contrib/arm-optimized-routines/networking/aarch64/chksum_simd.c index 000000000000,6d5be58b1f32..6d5be58b1f32 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/networking/aarch64/chksum_simd.c *** 386 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Tue Jul 6 13:29:27 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B868E6571BE; Tue, 6 Jul 2021 13:29:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GK3Lb4kyzz4jjw; Tue, 6 Jul 2021 13:29:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 86B4B1A702; Tue, 6 Jul 2021 13:29:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 166DTRxh084356; Tue, 6 Jul 2021 13:29:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 166DTRNj084355; Tue, 6 Jul 2021 13:29:27 GMT (envelope-from git) Date: Tue, 6 Jul 2021 13:29:27 GMT Message-Id: <202107061329.166DTRNj084355@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: c78f449d85e0 - main - usr.bin/diff: fix UBSan error in readhash MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c78f449d85e0b292fe5d942cca99f11c1cd430fa Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 13:29:27 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=c78f449d85e0b292fe5d942cca99f11c1cd430fa commit c78f449d85e0b292fe5d942cca99f11c1cd430fa Author: Alex Richardson AuthorDate: 2021-07-06 11:16:40 +0000 Commit: Alex Richardson CommitDate: 2021-07-06 11:16:40 +0000 usr.bin/diff: fix UBSan error in readhash UBSan complains about the `sum = sum * 127 + chrtran(t);` line below since that can overflow an `int`. Use `unsigned int` instead to ensure that overflow is well-defined. Reviewed By: imp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31075 --- usr.bin/diff/diffreg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.bin/diff/diffreg.c b/usr.bin/diff/diffreg.c index 1b28281024c6..651ec88df909 100644 --- a/usr.bin/diff/diffreg.c +++ b/usr.bin/diff/diffreg.c @@ -1345,7 +1345,7 @@ static int readhash(FILE *f, int flags) { int i, t, space; - int sum; + unsigned sum; sum = 1; space = 0; From owner-dev-commits-src-main@freebsd.org Tue Jul 6 13:29:28 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DC99F657CDD; Tue, 6 Jul 2021 13:29:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GK3Lc5j3Fz4jZh; Tue, 6 Jul 2021 13:29:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A40751A32D; Tue, 6 Jul 2021 13:29:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 166DTSQI084381; Tue, 6 Jul 2021 13:29:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 166DTS4v084380; Tue, 6 Jul 2021 13:29:28 GMT (envelope-from git) Date: Tue, 6 Jul 2021 13:29:28 GMT Message-Id: <202107061329.166DTS4v084380@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: 2eefc1d92643 - main - Fix building rescue/rescue when sanitizers are enabled MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2eefc1d926430dbba83128d27f8bed3c34199159 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 13:29:29 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=2eefc1d926430dbba83128d27f8bed3c34199159 commit 2eefc1d926430dbba83128d27f8bed3c34199159 Author: Alex Richardson AuthorDate: 2021-07-06 11:18:29 +0000 Commit: Alex Richardson CommitDate: 2021-07-06 11:18:30 +0000 Fix building rescue/rescue when sanitizers are enabled We have to ensure that we don't link any instrumented object files into rescue as it is a static executable and static binaries can't use the sanitizer runtime. Reviewed By: imp Differential Revision: https://reviews.freebsd.org/D31044 --- rescue/rescue/Makefile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rescue/rescue/Makefile b/rescue/rescue/Makefile index 7352828a822c..f2aa614f1dfc 100644 --- a/rescue/rescue/Makefile +++ b/rescue/rescue/Makefile @@ -6,7 +6,12 @@ PACKAGE=rescue MAN= MK_SSP= no +# Static-PIE is not supported so we should not be linking against _pie.a libs. +# This is also needed to avoid linking against sanitizer-instrumented libraries +# since MK_ASAN/MK_UBSAN will instrument the .pieo object files. +MK_PIE= no NO_SHARED= yes +CRUNCH_BUILDOPTS+= MK_PIE=no NO_SHARED=yes PROG= rescue BINDIR?=/rescue From owner-dev-commits-src-main@freebsd.org Tue Jul 6 13:47:23 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D3F3565840D; Tue, 6 Jul 2021 13:47:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GK3lH5blHz4n5m; Tue, 6 Jul 2021 13:47:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A6D5D1AABA; Tue, 6 Jul 2021 13:47:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 166DlNj0010995; Tue, 6 Jul 2021 13:47:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 166DlNuD010994; Tue, 6 Jul 2021 13:47:23 GMT (envelope-from git) Date: Tue, 6 Jul 2021 13:47:23 GMT Message-Id: <202107061347.166DlNuD010994@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: c9144ec14d2a - main - Skip netgraph tests when WITHOUT_NETGRAPH is set MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c9144ec14d2a5a53cfe91ada1b3b9c06b78dc999 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 13:47:23 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=c9144ec14d2a5a53cfe91ada1b3b9c06b78dc999 commit c9144ec14d2a5a53cfe91ada1b3b9c06b78dc999 Author: Ed Maste AuthorDate: 2021-07-06 13:44:15 +0000 Commit: Ed Maste CommitDate: 2021-07-06 13:45:34 +0000 Skip netgraph tests when WITHOUT_NETGRAPH is set PR: 256986 Reported by: John Marshall MFC after: 1 week Sponsored by: The FreeBSD Foundation --- tests/sys/Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/sys/Makefile b/tests/sys/Makefile index 4ba885405ce7..2781f7fb4ded 100644 --- a/tests/sys/Makefile +++ b/tests/sys/Makefile @@ -20,7 +20,7 @@ TESTS_SUBDIRS+= kqueue TESTS_SUBDIRS+= mac TESTS_SUBDIRS+= mqueue TESTS_SUBDIRS+= net -TESTS_SUBDIRS+= netgraph +TESTS_SUBDIRS+= ${_netgraph} TESTS_SUBDIRS+= netinet TESTS_SUBDIRS+= netinet6 TESTS_SUBDIRS+= netipsec @@ -40,6 +40,10 @@ _audit= audit _cddl= cddl .endif +.if ${MK_NETGRAPH} != "no" +_netgraph= netgraph +.endif + # Items not integrated into kyua runs by default SUBDIR+= pjdfstest From owner-dev-commits-src-main@freebsd.org Tue Jul 6 14:29:29 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8FE21658A40; Tue, 6 Jul 2021 14:29:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GK4gs3Ppmz3F8H; Tue, 6 Jul 2021 14:29:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5DFBB1B234; Tue, 6 Jul 2021 14:29:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 166ETTin064438; Tue, 6 Jul 2021 14:29:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 166ETTEn064437; Tue, 6 Jul 2021 14:29:29 GMT (envelope-from git) Date: Tue, 6 Jul 2021 14:29:29 GMT Message-Id: <202107061429.166ETTEn064437@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Gallatin Subject: git: 28d0a740dd9a - main - ktls: auto-disable ifnet (inline hw) kTLS MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gallatin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 28d0a740dd9a67e4a4fa9fda5bb39b5963316f35 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 14:29:29 -0000 The branch main has been updated by gallatin: URL: https://cgit.FreeBSD.org/src/commit/?id=28d0a740dd9a67e4a4fa9fda5bb39b5963316f35 commit 28d0a740dd9a67e4a4fa9fda5bb39b5963316f35 Author: Andrew Gallatin AuthorDate: 2021-07-06 14:17:33 +0000 Commit: Andrew Gallatin CommitDate: 2021-07-06 14:28:32 +0000 ktls: auto-disable ifnet (inline hw) kTLS Ifnet (inline) hw kTLS NICs typically keep state within a TLS record, so that when transmitting in-order, they can continue encryption on each segment sent without DMA'ing extra state from the host. This breaks down when transmits are out of order (eg, TCP retransmits). In this case, the NIC must re-DMA the entire TLS record up to and including the segment being retransmitted. This means that when re-transmitting the last 1448 byte segment of a TLS record, the NIC will have to re-DMA the entire 16KB TLS record. This can lead to the NIC running out of PCIe bus bandwidth well before it saturates the network link if a lot of TCP connections have a high retransmoit rate. This change introduces a new sysctl (kern.ipc.tls.ifnet_max_rexmit_pct), where TCP connections with higher retransmit rate will be switched to SW kTLS so as to conserve PCIe bandwidth. Reviewed by: hselasky, markj, rrs Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D30908 --- sys/kern/uipc_ktls.c | 107 ++++++++++++++++++++++++++++++++++++++++++++++++++ sys/netinet/tcp_var.h | 13 +++++- sys/sys/ktls.h | 15 ++++++- 3 files changed, 133 insertions(+), 2 deletions(-) diff --git a/sys/kern/uipc_ktls.c b/sys/kern/uipc_ktls.c index 7e87e7c740e3..88e29157289d 100644 --- a/sys/kern/uipc_ktls.c +++ b/sys/kern/uipc_ktls.c @@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$"); #include "opt_inet.h" #include "opt_inet6.h" +#include "opt_kern_tls.h" #include "opt_ratelimit.h" #include "opt_rss.h" @@ -121,6 +122,11 @@ SYSCTL_INT(_kern_ipc_tls_stats, OID_AUTO, threads, CTLFLAG_RD, &ktls_number_threads, 0, "Number of TLS threads in thread-pool"); +unsigned int ktls_ifnet_max_rexmit_pct = 2; +SYSCTL_UINT(_kern_ipc_tls, OID_AUTO, ifnet_max_rexmit_pct, CTLFLAG_RWTUN, + &ktls_ifnet_max_rexmit_pct, 2, + "Max percent bytes retransmitted before ifnet TLS is disabled"); + static bool ktls_offload_enable; SYSCTL_BOOL(_kern_ipc_tls, OID_AUTO, enable, CTLFLAG_RWTUN, &ktls_offload_enable, 0, @@ -184,6 +190,14 @@ static COUNTER_U64_DEFINE_EARLY(ktls_switch_failed); SYSCTL_COUNTER_U64(_kern_ipc_tls_stats, OID_AUTO, switch_failed, CTLFLAG_RD, &ktls_switch_failed, "TLS sessions unable to switch between SW and ifnet"); +static COUNTER_U64_DEFINE_EARLY(ktls_ifnet_disable_fail); +SYSCTL_COUNTER_U64(_kern_ipc_tls_stats, OID_AUTO, ifnet_disable_failed, CTLFLAG_RD, + &ktls_ifnet_disable_fail, "TLS sessions unable to switch to SW from ifnet"); + +static COUNTER_U64_DEFINE_EARLY(ktls_ifnet_disable_ok); +SYSCTL_COUNTER_U64(_kern_ipc_tls_stats, OID_AUTO, ifnet_disable_ok, CTLFLAG_RD, + &ktls_ifnet_disable_ok, "TLS sessions able to switch to SW from ifnet"); + SYSCTL_NODE(_kern_ipc_tls, OID_AUTO, sw, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "Software TLS session stats"); SYSCTL_NODE(_kern_ipc_tls, OID_AUTO, ifnet, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, @@ -2187,3 +2201,96 @@ ktls_work_thread(void *ctx) } } } + +static void +ktls_disable_ifnet_help(void *context, int pending __unused) +{ + struct ktls_session *tls; + struct inpcb *inp; + struct tcpcb *tp; + struct socket *so; + int err; + + tls = context; + inp = tls->inp; + if (inp == NULL) + return; + INP_WLOCK(inp); + so = inp->inp_socket; + MPASS(so != NULL); + if ((inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) || + (inp->inp_flags2 & INP_FREED)) { + goto out; + } + + if (so->so_snd.sb_tls_info != NULL) + err = ktls_set_tx_mode(so, TCP_TLS_MODE_SW); + else + err = ENXIO; + if (err == 0) { + counter_u64_add(ktls_ifnet_disable_ok, 1); + /* ktls_set_tx_mode() drops inp wlock, so recheck flags */ + if ((inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) == 0 && + (inp->inp_flags2 & INP_FREED) == 0 && + (tp = intotcpcb(inp)) != NULL && + tp->t_fb->tfb_hwtls_change != NULL) + (*tp->t_fb->tfb_hwtls_change)(tp, 0); + } else { + counter_u64_add(ktls_ifnet_disable_fail, 1); + } + +out: + SOCK_LOCK(so); + sorele(so); + if (!in_pcbrele_wlocked(inp)) + INP_WUNLOCK(inp); + ktls_free(tls); +} + +/* + * Called when re-transmits are becoming a substantial portion of the + * sends on this connection. When this happens, we transition the + * connection to software TLS. This is needed because most inline TLS + * NICs keep crypto state only for in-order transmits. This means + * that to handle a TCP rexmit (which is out-of-order), the NIC must + * re-DMA the entire TLS record up to and including the current + * segment. This means that when re-transmitting the last ~1448 byte + * segment of a 16KB TLS record, we could wind up re-DMA'ing an order + * of magnitude more data than we are sending. This can cause the + * PCIe link to saturate well before the network, which can cause + * output drops, and a general loss of capacity. + */ +void +ktls_disable_ifnet(void *arg) +{ + struct tcpcb *tp; + struct inpcb *inp; + struct socket *so; + struct ktls_session *tls; + + tp = arg; + inp = tp->t_inpcb; + INP_WLOCK_ASSERT(inp); + so = inp->inp_socket; + SOCK_LOCK(so); + tls = so->so_snd.sb_tls_info; + if (tls->disable_ifnet_pending) { + SOCK_UNLOCK(so); + return; + } + + /* + * note that disable_ifnet_pending is never cleared; disabling + * ifnet can only be done once per session, so we never want + * to do it again + */ + + (void)ktls_hold(tls); + in_pcbref(inp); + soref(so); + tls->disable_ifnet_pending = true; + tls->inp = inp; + SOCK_UNLOCK(so); + TASK_INIT(&tls->disable_ifnet_task, 0, ktls_disable_ifnet_help, tls); + (void)taskqueue_enqueue(taskqueue_thread, &tls->disable_ifnet_task); +} diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h index dd30f89896d2..3f72a821e71f 100644 --- a/sys/netinet/tcp_var.h +++ b/sys/netinet/tcp_var.h @@ -39,8 +39,10 @@ #include #ifdef _KERNEL +#include "opt_kern_tls.h" #include #include +#include #endif #define TCP_END_BYTE_INFO 8 /* Bytes that makeup the "end information array" */ @@ -1139,8 +1141,10 @@ tcp_fields_to_net(struct tcphdr *th) static inline void tcp_account_for_send(struct tcpcb *tp, uint32_t len, uint8_t is_rxt, - uint8_t is_tlp, int hw_tls __unused) + uint8_t is_tlp, int hw_tls) { + uint64_t rexmit_percent; + if (is_tlp) { tp->t_sndtlppack++; tp->t_sndtlpbyte += len; @@ -1150,6 +1154,13 @@ tcp_account_for_send(struct tcpcb *tp, uint32_t len, uint8_t is_rxt, tp->t_snd_rxt_bytes += len; else tp->t_sndbytes += len; + + if (hw_tls && is_rxt) { + rexmit_percent = (1000ULL * tp->t_snd_rxt_bytes) / (10ULL * (tp->t_snd_rxt_bytes + tp->t_sndbytes)); + if (rexmit_percent > ktls_ifnet_max_rexmit_pct) + ktls_disable_ifnet(tp); + } + } #endif /* _KERNEL */ diff --git a/sys/sys/ktls.h b/sys/sys/ktls.h index b28c94965c97..7fd8831878b4 100644 --- a/sys/sys/ktls.h +++ b/sys/sys/ktls.h @@ -189,10 +189,12 @@ struct ktls_session { u_int wq_index; volatile u_int refcount; int mode; - bool reset_pending; struct task reset_tag_task; + struct task disable_ifnet_task; struct inpcb *inp; + bool reset_pending; + bool disable_ifnet_pending; } __aligned(CACHE_LINE_SIZE); void ktls_check_rx(struct sockbuf *sb); @@ -231,5 +233,16 @@ ktls_free(struct ktls_session *tls) ktls_destroy(tls); } +#ifdef KERN_TLS +extern unsigned int ktls_ifnet_max_rexmit_pct; +void ktls_disable_ifnet(void *arg); +#else +#define ktls_ifnet_max_rexmit_pct 1 +inline void +ktls_disable_ifnet(void *arg __unused) +{ +} +#endif + #endif /* !_KERNEL */ #endif /* !_SYS_KTLS_H_ */ From owner-dev-commits-src-main@freebsd.org Tue Jul 6 15:00:16 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 624FE658EC8; Tue, 6 Jul 2021 15:00:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GK5MN2J2xz3JK8; Tue, 6 Jul 2021 15:00:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3701B1B87D; Tue, 6 Jul 2021 15:00:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 166F0G7D010498; Tue, 6 Jul 2021 15:00:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 166F0G20010490; Tue, 6 Jul 2021 15:00:16 GMT (envelope-from git) Date: Tue, 6 Jul 2021 15:00:16 GMT Message-Id: <202107061500.166F0G20010490@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: c76616f496ee - main - etc/ttys: merge ttys file down to single file MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c76616f496ee7e6b0a4ed9444fad56418f137a5a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 15:00:16 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=c76616f496ee7e6b0a4ed9444fad56418f137a5a commit c76616f496ee7e6b0a4ed9444fad56418f137a5a Author: Elliott Mitchell AuthorDate: 2021-05-13 06:58:00 +0000 Commit: Mitchell Horne CommitDate: 2021-07-06 14:53:10 +0000 etc/ttys: merge ttys file down to single file The tty lists were already pretty similar and there hadn't been any real need for them to remain distinct for some time. As such, merge to a single file. The RISC-V console is preserved. For systems where it doesn't exist, its presence in /etc/ttys is harmless. The uncommented version of the ttyv8/XDM line from ttys.amd64 was the one chosen. Reviewed by: imp MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D30256 --- sbin/init/Makefile | 10 +-------- sbin/init/{ttys.riscv => ttys} | 2 +- sbin/init/ttys.aarch64 | 49 ------------------------------------------ sbin/init/ttys.amd64 | 49 ------------------------------------------ sbin/init/ttys.arm | 49 ------------------------------------------ sbin/init/ttys.i386 | 49 ------------------------------------------ sbin/init/ttys.mips | 36 ------------------------------- sbin/init/ttys.powerpc | 49 ------------------------------------------ 8 files changed, 2 insertions(+), 291 deletions(-) diff --git a/sbin/init/Makefile b/sbin/init/Makefile index 3c242617fe7a..3a914dc7acef 100644 --- a/sbin/init/Makefile +++ b/sbin/init/Makefile @@ -12,15 +12,7 @@ CFLAGS+=-DDEBUGSHELL -DSECURE -DLOGIN_CAP -DCOMPAT_SYSV_INIT LIBADD= util crypt CONFTTYSNAME= ttys -.if exists(${.CURDIR}/ttys.${MACHINE}) -CONFTTYS+= ttys.${MACHINE} -.elif exists(${.CURDIR}/ttys.${MACHINE_ARCH}) -CONFTTYS+= ttys.${MACHINE_ARCH} -.elif exists(${.CURDIR}/ttys.${MACHINE_CPUARCH}) -CONFTTYS+= ttys.${MACHINE_CPUARCH} -.else -.error MACHINE.ttys missing -.endif +CONFTTYS+= ttys # Needed for getmntopts.c MOUNT= ${SRCTOP}/sbin/mount diff --git a/sbin/init/ttys.riscv b/sbin/init/ttys similarity index 97% rename from sbin/init/ttys.riscv rename to sbin/init/ttys index 4e49b7a83bd8..4a5ee50dba59 100644 --- a/sbin/init/ttys.riscv +++ b/sbin/init/ttys @@ -38,7 +38,7 @@ ttyv4 "/usr/libexec/getty Pc" xterm onifexists secure ttyv5 "/usr/libexec/getty Pc" xterm onifexists secure ttyv6 "/usr/libexec/getty Pc" xterm onifexists secure ttyv7 "/usr/libexec/getty Pc" xterm onifexists secure -#ttyv8 "/usr/local/bin/xdm -nodaemon" xterm onifexists secure +ttyv8 "/usr/local/bin/xdm -nodaemon" xterm off secure # Serial terminals # The 'dialup' keyword identifies dialin lines to login, fingerd etc. ttyu0 "/usr/libexec/getty 3wire" vt100 onifconsole secure diff --git a/sbin/init/ttys.aarch64 b/sbin/init/ttys.aarch64 deleted file mode 100644 index 8a2376e799a1..000000000000 --- a/sbin/init/ttys.aarch64 +++ /dev/null @@ -1,49 +0,0 @@ -# -# $FreeBSD$ -# @(#)ttys 5.1 (Berkeley) 4/17/89 -# -# This file specifies various information about terminals on the system. -# It is used by several different programs. Common entries for the -# various columns include: -# -# name The name of the terminal device. -# -# getty The program to start running on the terminal. Typically a -# getty program, as the name implies. Other common entries -# include none, when no getty is needed, and xdm, to start the -# X Window System. -# -# type The initial terminal type for this port. For hardwired -# terminal lines, this will contain the type of terminal used. -# For virtual consoles, the correct type is typically xterm. -# Other common values include dialup for incoming modem ports, and -# unknown when the terminal type cannot be predetermined. -# -# status Must be on or off. If on, init will run the getty program on -# the specified port. If the word "secure" appears, this tty -# allows root login. -# -# name getty type status comments -# -# If console is marked "insecure", then init will ask for the root password -# when going to single-user mode. -console none unknown off secure -# -ttyv0 "/usr/libexec/getty Pc" xterm onifexists secure -# Virtual terminals -ttyv1 "/usr/libexec/getty Pc" xterm onifexists secure -ttyv2 "/usr/libexec/getty Pc" xterm onifexists secure -ttyv3 "/usr/libexec/getty Pc" xterm onifexists secure -ttyv4 "/usr/libexec/getty Pc" xterm onifexists secure -ttyv5 "/usr/libexec/getty Pc" xterm onifexists secure -ttyv6 "/usr/libexec/getty Pc" xterm onifexists secure -ttyv7 "/usr/libexec/getty Pc" xterm onifexists secure -#ttyv8 "/usr/local/bin/xdm -nodaemon" xterm onifexists secure -# Serial terminals -# The 'dialup' keyword identifies dialin lines to login, fingerd etc. -ttyu0 "/usr/libexec/getty 3wire" vt100 onifconsole secure -ttyu1 "/usr/libexec/getty 3wire" vt100 onifconsole secure -ttyu2 "/usr/libexec/getty 3wire" vt100 onifconsole secure -ttyu3 "/usr/libexec/getty 3wire" vt100 onifconsole secure -# Dumb console -dcons "/usr/libexec/getty std.9600" vt100 off secure diff --git a/sbin/init/ttys.amd64 b/sbin/init/ttys.amd64 deleted file mode 100644 index b8392780ac9a..000000000000 --- a/sbin/init/ttys.amd64 +++ /dev/null @@ -1,49 +0,0 @@ -# -# $FreeBSD$ -# @(#)ttys 5.1 (Berkeley) 4/17/89 -# -# This file specifies various information about terminals on the system. -# It is used by several different programs. Common entries for the -# various columns include: -# -# name The name of the terminal device. -# -# getty The program to start running on the terminal. Typically a -# getty program, as the name implies. Other common entries -# include none, when no getty is needed, and xdm, to start the -# X Window System. -# -# type The initial terminal type for this port. For hardwired -# terminal lines, this will contain the type of terminal used. -# For virtual consoles, the correct type is typically xterm. -# Other common values include dialup for incoming modem ports, and -# unknown when the terminal type cannot be predetermined. -# -# status Must be on or off. If on, init will run the getty program on -# the specified port. If the word "secure" appears, this tty -# allows root login. -# -# name getty type status comments -# -# If console is marked "insecure", then init will ask for the root password -# when going to single-user mode. -console none unknown off secure -# -ttyv0 "/usr/libexec/getty Pc" xterm onifexists secure -# Virtual terminals -ttyv1 "/usr/libexec/getty Pc" xterm onifexists secure -ttyv2 "/usr/libexec/getty Pc" xterm onifexists secure -ttyv3 "/usr/libexec/getty Pc" xterm onifexists secure -ttyv4 "/usr/libexec/getty Pc" xterm onifexists secure -ttyv5 "/usr/libexec/getty Pc" xterm onifexists secure -ttyv6 "/usr/libexec/getty Pc" xterm onifexists secure -ttyv7 "/usr/libexec/getty Pc" xterm onifexists secure -ttyv8 "/usr/local/bin/xdm -nodaemon" xterm off secure -# Serial terminals -# The 'dialup' keyword identifies dialin lines to login, fingerd etc. -ttyu0 "/usr/libexec/getty 3wire" vt100 onifconsole secure -ttyu1 "/usr/libexec/getty 3wire" vt100 onifconsole secure -ttyu2 "/usr/libexec/getty 3wire" vt100 onifconsole secure -ttyu3 "/usr/libexec/getty 3wire" vt100 onifconsole secure -# Dumb console -dcons "/usr/libexec/getty std.9600" vt100 off secure diff --git a/sbin/init/ttys.arm b/sbin/init/ttys.arm deleted file mode 100644 index b0722e4522dd..000000000000 --- a/sbin/init/ttys.arm +++ /dev/null @@ -1,49 +0,0 @@ -# -# $FreeBSD$ -# @(#)ttys 5.1 (Berkeley) 4/17/89 -# -# This file specifies various information about terminals on the system. -# It is used by several different programs. Common entries for the -# various columns include: -# -# name The name of the terminal device. -# -# getty The program to start running on the terminal. Typically a -# getty program, as the name implies. Other common entries -# include none, when no getty is needed, and xdm, to start the -# X Window System. -# -# type The initial terminal type for this port. For hardwired -# terminal lines, this will contain the type of terminal used. -# For virtual consoles, the correct type is typically xterm. -# Other common values include dialup for incoming modem ports, and -# unknown when the terminal type cannot be predetermined. -# -# status Must be on or off. If on, init will run the getty program on -# the specified port. If the word "secure" appears, this tty -# allows root login. -# -# name getty type status comments -# -# If console is marked "insecure", then init will ask for the root password -# when going to single-user mode. -console none unknown off secure -# -ttyv0 "/usr/libexec/getty Pc" xterm onifexists secure -# Virtual terminals -ttyv1 "/usr/libexec/getty Pc" xterm onifexists secure -ttyv2 "/usr/libexec/getty Pc" xterm onifexists secure -ttyv3 "/usr/libexec/getty Pc" xterm onifexists secure -ttyv4 "/usr/libexec/getty Pc" xterm onifexists secure -ttyv5 "/usr/libexec/getty Pc" xterm onifexists secure -ttyv6 "/usr/libexec/getty Pc" xterm onifexists secure -ttyv7 "/usr/libexec/getty Pc" xterm onifexists secure -#ttyv8 "/usr/local/bin/xdm -nodaemon" xterm off secure -# Serial terminals -# The 'dialup' keyword identifies dialin lines to login, fingerd etc. -ttyu0 "/usr/libexec/getty 3wire" vt100 onifconsole secure -ttyu1 "/usr/libexec/getty 3wire" vt100 onifconsole secure -ttyu2 "/usr/libexec/getty 3wire" vt100 onifconsole secure -ttyu3 "/usr/libexec/getty 3wire" vt100 onifconsole secure -# Dumb console -dcons "/usr/libexec/getty std.9600" vt100 off secure diff --git a/sbin/init/ttys.i386 b/sbin/init/ttys.i386 deleted file mode 100644 index b8392780ac9a..000000000000 --- a/sbin/init/ttys.i386 +++ /dev/null @@ -1,49 +0,0 @@ -# -# $FreeBSD$ -# @(#)ttys 5.1 (Berkeley) 4/17/89 -# -# This file specifies various information about terminals on the system. -# It is used by several different programs. Common entries for the -# various columns include: -# -# name The name of the terminal device. -# -# getty The program to start running on the terminal. Typically a -# getty program, as the name implies. Other common entries -# include none, when no getty is needed, and xdm, to start the -# X Window System. -# -# type The initial terminal type for this port. For hardwired -# terminal lines, this will contain the type of terminal used. -# For virtual consoles, the correct type is typically xterm. -# Other common values include dialup for incoming modem ports, and -# unknown when the terminal type cannot be predetermined. -# -# status Must be on or off. If on, init will run the getty program on -# the specified port. If the word "secure" appears, this tty -# allows root login. -# -# name getty type status comments -# -# If console is marked "insecure", then init will ask for the root password -# when going to single-user mode. -console none unknown off secure -# -ttyv0 "/usr/libexec/getty Pc" xterm onifexists secure -# Virtual terminals -ttyv1 "/usr/libexec/getty Pc" xterm onifexists secure -ttyv2 "/usr/libexec/getty Pc" xterm onifexists secure -ttyv3 "/usr/libexec/getty Pc" xterm onifexists secure -ttyv4 "/usr/libexec/getty Pc" xterm onifexists secure -ttyv5 "/usr/libexec/getty Pc" xterm onifexists secure -ttyv6 "/usr/libexec/getty Pc" xterm onifexists secure -ttyv7 "/usr/libexec/getty Pc" xterm onifexists secure -ttyv8 "/usr/local/bin/xdm -nodaemon" xterm off secure -# Serial terminals -# The 'dialup' keyword identifies dialin lines to login, fingerd etc. -ttyu0 "/usr/libexec/getty 3wire" vt100 onifconsole secure -ttyu1 "/usr/libexec/getty 3wire" vt100 onifconsole secure -ttyu2 "/usr/libexec/getty 3wire" vt100 onifconsole secure -ttyu3 "/usr/libexec/getty 3wire" vt100 onifconsole secure -# Dumb console -dcons "/usr/libexec/getty std.9600" vt100 off secure diff --git a/sbin/init/ttys.mips b/sbin/init/ttys.mips deleted file mode 100644 index 21bb9325f3bf..000000000000 --- a/sbin/init/ttys.mips +++ /dev/null @@ -1,36 +0,0 @@ -# -# $FreeBSD$ -# @(#)ttys 5.1 (Berkeley) 4/17/89 -# -# This file specifies various information about terminals on the system. -# It is used by several different programs. Common entries for the -# various columns include: -# -# name The name of the terminal device. -# -# getty The program to start running on the terminal. Typically a -# getty program, as the name implies. Other common entries -# include none, when no getty is needed, and xdm, to start the -# X Window System. -# -# type The initial terminal type for this port. For hardwired -# terminal lines, this will contain the type of terminal used. -# For virtual consoles, the correct type is typically xterm. -# Other common values include dialup for incoming modem ports, and -# unknown when the terminal type cannot be predetermined. -# -# status Must be on or off. If on, init will run the getty program on -# the specified port. If the word "secure" appears, this tty -# allows root login. -# -# name getty type status comments -# -# If console is marked "insecure", then init will ask for the root password -# when going to single-user mode. -console none unknown off secure -# Serial terminals -# The 'dialup' keyword identifies dialin lines to login, fingerd etc. -ttyu0 "/usr/libexec/getty 3wire" vt100 onifconsole secure -ttyu1 "/usr/libexec/getty 3wire" vt100 onifconsole secure -ttyu2 "/usr/libexec/getty 3wire" vt100 onifconsole secure -ttyu3 "/usr/libexec/getty 3wire" vt100 onifconsole secure diff --git a/sbin/init/ttys.powerpc b/sbin/init/ttys.powerpc deleted file mode 100644 index b0722e4522dd..000000000000 --- a/sbin/init/ttys.powerpc +++ /dev/null @@ -1,49 +0,0 @@ -# -# $FreeBSD$ -# @(#)ttys 5.1 (Berkeley) 4/17/89 -# -# This file specifies various information about terminals on the system. -# It is used by several different programs. Common entries for the -# various columns include: -# -# name The name of the terminal device. -# -# getty The program to start running on the terminal. Typically a -# getty program, as the name implies. Other common entries -# include none, when no getty is needed, and xdm, to start the -# X Window System. -# -# type The initial terminal type for this port. For hardwired -# terminal lines, this will contain the type of terminal used. -# For virtual consoles, the correct type is typically xterm. -# Other common values include dialup for incoming modem ports, and -# unknown when the terminal type cannot be predetermined. -# -# status Must be on or off. If on, init will run the getty program on -# the specified port. If the word "secure" appears, this tty -# allows root login. -# -# name getty type status comments -# -# If console is marked "insecure", then init will ask for the root password -# when going to single-user mode. -console none unknown off secure -# -ttyv0 "/usr/libexec/getty Pc" xterm onifexists secure -# Virtual terminals -ttyv1 "/usr/libexec/getty Pc" xterm onifexists secure -ttyv2 "/usr/libexec/getty Pc" xterm onifexists secure -ttyv3 "/usr/libexec/getty Pc" xterm onifexists secure -ttyv4 "/usr/libexec/getty Pc" xterm onifexists secure -ttyv5 "/usr/libexec/getty Pc" xterm onifexists secure -ttyv6 "/usr/libexec/getty Pc" xterm onifexists secure -ttyv7 "/usr/libexec/getty Pc" xterm onifexists secure -#ttyv8 "/usr/local/bin/xdm -nodaemon" xterm off secure -# Serial terminals -# The 'dialup' keyword identifies dialin lines to login, fingerd etc. -ttyu0 "/usr/libexec/getty 3wire" vt100 onifconsole secure -ttyu1 "/usr/libexec/getty 3wire" vt100 onifconsole secure -ttyu2 "/usr/libexec/getty 3wire" vt100 onifconsole secure -ttyu3 "/usr/libexec/getty 3wire" vt100 onifconsole secure -# Dumb console -dcons "/usr/libexec/getty std.9600" vt100 off secure From owner-dev-commits-src-main@freebsd.org Tue Jul 6 15:00:17 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7DEF1659504; Tue, 6 Jul 2021 15:00:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GK5MP338Hz3JZ0; Tue, 6 Jul 2021 15:00:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 52B281B87E; Tue, 6 Jul 2021 15:00:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 166F0HYV010996; Tue, 6 Jul 2021 15:00:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 166F0HAN010990; Tue, 6 Jul 2021 15:00:17 GMT (envelope-from git) Date: Tue, 6 Jul 2021 15:00:17 GMT Message-Id: <202107061500.166F0HAN010990@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 2b2c460d7bb8 - main - etc/ttys: add xen console MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2b2c460d7bb856a069047583a55a60976cd375a4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 15:00:17 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=2b2c460d7bb856a069047583a55a60976cd375a4 commit 2b2c460d7bb856a069047583a55a60976cd375a4 Author: Julien Grall AuthorDate: 2015-10-29 14:22:35 +0000 Commit: Mitchell Horne CommitDate: 2021-07-06 14:53:10 +0000 etc/ttys: add xen console Xen VMs get a simulated serial device meant for use as a console. Often an xterm or other advanced terminal is used, so use xterm as the type. Depending on configuration, FreeBSD on Xen for amd64 may instead use an emulated serial port, but the virtual console may also be available. Submitted by: Elliott Mitchell Reviewed by: imp (slightly earlier version) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D29873 --- sbin/init/ttys | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sbin/init/ttys b/sbin/init/ttys index 4a5ee50dba59..a2f5b8975ecd 100644 --- a/sbin/init/ttys +++ b/sbin/init/ttys @@ -47,5 +47,7 @@ ttyu2 "/usr/libexec/getty 3wire" vt100 onifconsole secure ttyu3 "/usr/libexec/getty 3wire" vt100 onifconsole secure # Dumb console dcons "/usr/libexec/getty std.9600" vt100 off secure +# Xen Virtual console +xc0 "/usr/libexec/getty Pc" xterm onifconsole secure # RISC-V HTIF console rcons "/usr/libexec/getty std.9600" vt100 onifconsole secure From owner-dev-commits-src-main@freebsd.org Tue Jul 6 15:14:13 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0047F65C048; Tue, 6 Jul 2021 15:14:13 +0000 (UTC) (envelope-from lutz@iks-jena.de) Received: from annwfn.iks-jena.de (annwfn.iks-jena.de [IPv6:2001:4bd8::19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4GK5gS4MCBz3PD9; Tue, 6 Jul 2021 15:14:12 +0000 (UTC) (envelope-from lutz@iks-jena.de) X-SMTP-Sender: IPv6:2001:4bd8:0:666:248:54ff:fe12:ee3f Received: from belenus.iks-jena.de (belenus.iks-jena.de [IPv6:2001:4bd8:0:666:248:54ff:fe12:ee3f]) by annwfn.iks-jena.de (8.15.2/8.15.2) with ESMTPS id 166FClRO002156 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 6 Jul 2021 17:12:47 +0200 X-MSA-Host: belenus.iks-jena.de Received: (from lutz@localhost) by belenus.iks-jena.de (8.14.3/8.14.1/Submit) id 166FClTT011818; Tue, 6 Jul 2021 17:12:47 +0200 Date: Tue, 6 Jul 2021 17:12:47 +0200 From: Lutz Donnerhacke To: Ed Maste Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: c9144ec14d2a - main - Skip netgraph tests when WITHOUT_NETGRAPH is set Message-ID: <20210706151247.GA11784@belenus.iks-jena.de> References: <202107061347.166DlNuD010994@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202107061347.166DlNuD010994@gitrepo.freebsd.org> X-message-flag: Please send plain text messages only. Thank you. User-Agent: Mutt/1.5.17 (2007-11-01) X-Rspamd-Queue-Id: 4GK5gS4MCBz3PD9 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 15:14:13 -0000 On Tue, Jul 06, 2021 at 01:47:23PM +0000, Ed Maste wrote: > Skip netgraph tests when WITHOUT_NETGRAPH is set Thank you. I missed this case. From owner-dev-commits-src-main@freebsd.org Tue Jul 6 15:48:02 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 778EE65CDA8; Tue, 6 Jul 2021 15:48:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GK6QV30KDz3hmg; Tue, 6 Jul 2021 15:48:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4F8201C671; Tue, 6 Jul 2021 15:48:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 166Fm2cZ078878; Tue, 6 Jul 2021 15:48:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 166Fm2ol078877; Tue, 6 Jul 2021 15:48:02 GMT (envelope-from git) Date: Tue, 6 Jul 2021 15:48:02 GMT Message-Id: <202107061548.166Fm2ol078877@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ram Kishore Vegesna Subject: git: 29e2dbd42c3e - main - ocs_fc: Add gendump and dump_to_host ioctl command support. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ram X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 29e2dbd42c3e2e10e606b3414f4d0c53021d4e86 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 15:48:02 -0000 The branch main has been updated by ram: URL: https://cgit.FreeBSD.org/src/commit/?id=29e2dbd42c3e2e10e606b3414f4d0c53021d4e86 commit 29e2dbd42c3e2e10e606b3414f4d0c53021d4e86 Author: Ram Kishore Vegesna AuthorDate: 2021-06-24 07:05:00 +0000 Commit: Ram Kishore Vegesna CommitDate: 2021-07-06 15:38:11 +0000 ocs_fc: Add gendump and dump_to_host ioctl command support. Support to generate firmware dump. Approved by: mav(mentor) --- sys/dev/ocs_fc/ocs_gendump.c | 388 +++++++++++++++++++++++++++++++++++++++++++ sys/dev/ocs_fc/ocs_gendump.h | 42 +++++ sys/dev/ocs_fc/ocs_ioctl.c | 13 +- sys/dev/ocs_fc/ocs_ioctl.h | 3 + sys/dev/ocs_fc/ocs_mgmt.c | 152 ++--------------- sys/dev/ocs_fc/ocs_os.c | 3 +- sys/dev/ocs_fc/ocs_os.h | 3 +- sys/modules/ocs_fc/Makefile | 3 +- 8 files changed, 449 insertions(+), 158 deletions(-) diff --git a/sys/dev/ocs_fc/ocs_gendump.c b/sys/dev/ocs_fc/ocs_gendump.c new file mode 100644 index 000000000000..d24870f39668 --- /dev/null +++ b/sys/dev/ocs_fc/ocs_gendump.c @@ -0,0 +1,388 @@ +/* + * Copyright (c) 2021 Broadcom. All rights reserved. + * The term "Broadcom" refers to Broadcom Limited and/or its subsidiaries. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "ocs.h" +#include "ocs_gendump.h" + +/* Reset all the functions associated with a bus/dev */ +static int +ocs_gen_dump_reset(uint8_t bus, uint8_t dev) +{ + uint32_t index = 0; + ocs_t *ocs; + int rc = 0; + + while ((ocs = ocs_get_instance(index++)) != NULL) { + uint8_t ocs_bus, ocs_dev, ocs_func; + ocs_domain_t *domain; + + ocs_get_bus_dev_func(ocs, &ocs_bus, &ocs_dev, &ocs_func); + + if (!(ocs_bus == bus && ocs_dev == dev)) + continue; + + if (ocs_hw_reset(&ocs->hw, OCS_HW_RESET_FUNCTION)) { + ocs_log_test(ocs, "failed to reset port\n"); + rc = -1; + continue; + } + + ocs_log_debug(ocs, "successfully reset port\n"); + while ((domain = ocs_list_get_head(&ocs->domain_list)) != NULL) { + ocs_log_debug(ocs, "free domain %p\n", domain); + ocs_domain_force_free(domain); + } + /* now initialize hw so user can read the dump in */ + if (ocs_hw_init(&ocs->hw)) { + ocs_log_err(ocs, "failed to initialize hw\n"); + rc = -1; + } else { + ocs_log_debug(ocs, "successfully initialized hw\n"); + } + } + return rc; +} + +int +ocs_gen_dump(ocs_t *ocs) +{ + uint32_t reset_required; + uint32_t dump_ready; + uint32_t ms_waited; + uint8_t bus, dev, func; + int rc = 0; + int index = 0, port_index = 0; + ocs_t *nxt_ocs; + uint8_t nxt_bus, nxt_dev, nxt_func; + uint8_t prev_port_state[OCS_MAX_HBA_PORTS] = {0,}; + ocs_xport_stats_t link_status; + + ocs_get_bus_dev_func(ocs, &bus, &dev, &func); + + /* Drop link on all ports belongs to this HBA*/ + while ((nxt_ocs = ocs_get_instance(index++)) != NULL) { + ocs_get_bus_dev_func(nxt_ocs, &nxt_bus, &nxt_dev, &nxt_func); + + if (!(bus == nxt_bus && dev == nxt_dev)) + continue; + + if ((port_index >= OCS_MAX_HBA_PORTS)) + continue; + + /* Check current link status and save for future use */ + if (ocs_xport_status(nxt_ocs->xport, OCS_XPORT_PORT_STATUS, + &link_status) == 0) { + if (link_status.value == OCS_XPORT_PORT_ONLINE) { + prev_port_state[port_index] = 1; + ocs_xport_control(nxt_ocs->xport, + OCS_XPORT_PORT_OFFLINE); + } else { + prev_port_state[port_index] = 0; + } + } + port_index++; + } + + /* Wait until all ports have quiesced */ + for (index = 0; (nxt_ocs = ocs_get_instance(index++)) != NULL; ) { + ms_waited = 0; + for (;;) { + ocs_xport_stats_t status; + + ocs_xport_status(nxt_ocs->xport, OCS_XPORT_IS_QUIESCED, + &status); + if (status.value) { + ocs_log_debug(nxt_ocs, "port quiesced\n"); + break; + } + + ocs_msleep(10); + ms_waited += 10; + if (ms_waited > 60000) { + ocs_log_test(nxt_ocs, + "timed out waiting for port to quiesce\n"); + break; + } + } + } + + /* Initiate dump */ + if (ocs_hw_raise_ue(&ocs->hw, 1) == OCS_HW_RTN_SUCCESS) { + + /* Wait for dump to complete */ + ocs_log_debug(ocs, "Dump requested, wait for completion.\n"); + + dump_ready = 0; + ms_waited = 0; + while ((!dump_ready) && (ms_waited < 30000)) { + ocs_hw_get(&ocs->hw, OCS_HW_DUMP_READY, &dump_ready); + ocs_udelay(10000); + ms_waited += 10; + } + + if (!dump_ready) { + ocs_log_test(ocs, "Failed to see dump after 30 secs\n"); + rc = -1; + } else { + ocs_log_debug(ocs, "sucessfully generated dump\n"); + } + + /* now reset port */ + ocs_hw_get(&ocs->hw, OCS_HW_RESET_REQUIRED, &reset_required); + ocs_log_debug(ocs, "reset required=%d\n", reset_required); + if (reset_required) { + if (ocs_gen_dump_reset(bus, dev) == 0) { + ocs_log_debug(ocs, "all devices reset\n"); + } else { + ocs_log_test(ocs, "all devices NOT reset\n"); + } + } + } else { + ocs_log_test(ocs, "dump request to hw failed\n"); + rc = -1; + } + + index = port_index = 0; + nxt_ocs = NULL; + /* Bring links on each HBA port to previous state*/ + while ((nxt_ocs = ocs_get_instance(index++)) != NULL) { + ocs_get_bus_dev_func(nxt_ocs, &nxt_bus, &nxt_dev, &nxt_func); + if (port_index > OCS_MAX_HBA_PORTS) { + ocs_log_err(NULL, "port index(%d) out of boundary\n", + port_index); + rc = -1; + break; + } + if ((bus == nxt_bus) && (dev == nxt_dev) && + prev_port_state[port_index++]) { + ocs_xport_control(nxt_ocs->xport, OCS_XPORT_PORT_ONLINE); + } + } + + return rc; +} + +int +ocs_fdb_dump(ocs_t *ocs) +{ + uint32_t dump_ready; + uint32_t ms_waited; + int rc = 0; + +#define FDB 2 + + /* Initiate dump */ + if (ocs_hw_raise_ue(&ocs->hw, FDB) == OCS_HW_RTN_SUCCESS) { + + /* Wait for dump to complete */ + ocs_log_debug(ocs, "Dump requested, wait for completion.\n"); + + dump_ready = 0; + ms_waited = 0; + while ((!(dump_ready == FDB)) && (ms_waited < 10000)) { + ocs_hw_get(&ocs->hw, OCS_HW_DUMP_READY, &dump_ready); + ocs_udelay(10000); + ms_waited += 10; + } + + if (!dump_ready) { + ocs_log_err(ocs, "Failed to see dump after 10 secs\n"); + return -1; + } + + ocs_log_debug(ocs, "sucessfully generated dump\n"); + + } else { + ocs_log_err(ocs, "dump request to hw failed\n"); + rc = -1; + } + + return rc; +} + +/** + * @brief Create a Lancer dump into a memory buffer + * @par Description + * This function creates a DMA buffer to hold a Lancer dump, + * sets the dump location to point to that buffer, then calls + * ocs_gen_dump to cause a dump to be transfered to the buffer. + * After the dump is complete it copies the dump to the provided + * user space buffer. + * + * @param ocs Pointer to ocs structure + * @param buf User space buffer in which to store the dump + * @param buflen Length of the user buffer in bytes + * + * @return Returns 0 on success, non-zero on error. + */ +int +ocs_dump_to_host(ocs_t *ocs, void *buf, uint32_t buflen) +{ + int rc; + uint32_t i, num_buffers; + ocs_dma_t *dump_buffers; + uint32_t rem_bytes, offset; + + if (buflen == 0) { + ocs_log_test(ocs, "zero buffer length is invalid\n"); + return -1; + } + + num_buffers = ((buflen + OCS_MAX_DMA_ALLOC - 1) / OCS_MAX_DMA_ALLOC); + + dump_buffers = ocs_malloc(ocs, sizeof(ocs_dma_t) * num_buffers, + OCS_M_ZERO | OCS_M_NOWAIT); + if (dump_buffers == NULL) { + ocs_log_err(ocs, "Failed to dump buffers\n"); + return -1; + } + + /* Allocate a DMA buffers to hold the dump */ + rem_bytes = buflen; + for (i = 0; i < num_buffers; i++) { + uint32_t num_bytes = MIN(rem_bytes, OCS_MAX_DMA_ALLOC); + + rc = ocs_dma_alloc(ocs, &dump_buffers[i], num_bytes, + OCS_MIN_DMA_ALIGNMENT); + if (rc) { + ocs_log_err(ocs, "Failed to allocate dump buffer\n"); + + /* Free any previously allocated buffers */ + goto free_and_return; + } + rem_bytes -= num_bytes; + } + + rc = ocs_hw_set_dump_location(&ocs->hw, num_buffers, dump_buffers, 0); + if (rc) { + ocs_log_test(ocs, "ocs_hw_set_dump_location failed\n"); + goto free_and_return; + } + + /* Generate the dump */ + rc = ocs_gen_dump(ocs); + if (rc) { + ocs_log_test(ocs, "ocs_gen_dump failed\n"); + goto free_and_return; + } + + /* Copy the dump from the DMA buffer into the user buffer */ + offset = 0; + for (i = 0; i < num_buffers; i++) { + if (ocs_copy_to_user((uint8_t*)buf + offset, + dump_buffers[i].virt, dump_buffers[i].size)) { + ocs_log_test(ocs, "ocs_copy_to_user failed\n"); + rc = -1; + } + offset += dump_buffers[i].size; + } + +free_and_return: + /* Free the DMA buffer and return */ + for (i = 0; i < num_buffers; i++) { + ocs_dma_free(ocs, &dump_buffers[i]); + } + ocs_free(ocs, dump_buffers, sizeof(ocs_dma_t) * num_buffers); + return rc; +} + +int +ocs_function_speciic_dump(ocs_t *ocs, void *buf, uint32_t buflen) +{ + int rc; + uint32_t i, num_buffers; + ocs_dma_t *dump_buffers; + uint32_t rem_bytes, offset; + + if (buflen == 0) { + ocs_log_err(ocs, "zero buffer length is invalid\n"); + return -1; + } + + num_buffers = ((buflen + OCS_MAX_DMA_ALLOC - 1) / OCS_MAX_DMA_ALLOC); + + dump_buffers = ocs_malloc(ocs, sizeof(ocs_dma_t) * num_buffers, + OCS_M_ZERO | OCS_M_NOWAIT); + if (dump_buffers == NULL) { + ocs_log_err(ocs, "Failed to allocate dump buffers\n"); + return -1; + } + + /* Allocate a DMA buffers to hold the dump */ + rem_bytes = buflen; + for (i = 0; i < num_buffers; i++) { + uint32_t num_bytes = MIN(rem_bytes, OCS_MAX_DMA_ALLOC); + rc = ocs_dma_alloc(ocs, &dump_buffers[i], num_bytes, + OCS_MIN_DMA_ALIGNMENT); + if (rc) { + ocs_log_err(ocs, "Failed to allocate dma buffer\n"); + + /* Free any previously allocated buffers */ + goto free_and_return; + } + rem_bytes -= num_bytes; + } + + /* register buffers for function spcific dump */ + rc = ocs_hw_set_dump_location(&ocs->hw, num_buffers, dump_buffers, 1); + if (rc) { + ocs_log_err(ocs, "ocs_hw_set_dump_location failed\n"); + goto free_and_return; + } + + /* Invoke dump by setting fdd=1 and ip=1 in sliport_control register */ + rc = ocs_fdb_dump(ocs); + if (rc) { + ocs_log_err(ocs, "ocs_gen_dump failed\n"); + goto free_and_return; + } + + /* Copy the dump from the DMA buffer into the user buffer */ + offset = 0; + for (i = 0; i < num_buffers; i++) { + if (ocs_copy_to_user((uint8_t*)buf + offset, + dump_buffers[i].virt, dump_buffers[i].size)) { + ocs_log_err(ocs, "ocs_copy_to_user failed\n"); + rc = -1; + } + offset += dump_buffers[i].size; + } + +free_and_return: + /* Free the DMA buffer and return */ + for (i = 0; i < num_buffers; i++) { + ocs_dma_free(ocs, &dump_buffers[i]); + } + ocs_free(ocs, dump_buffers, sizeof(ocs_dma_t) * num_buffers); + return rc; + +} diff --git a/sys/dev/ocs_fc/ocs_gendump.h b/sys/dev/ocs_fc/ocs_gendump.h new file mode 100644 index 000000000000..2343003feef6 --- /dev/null +++ b/sys/dev/ocs_fc/ocs_gendump.h @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2021 Broadcom. All rights reserved. + * The term "Broadcom" refers to Broadcom Limited and/or its subsidiaries. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + */ + +#if !defined(__OCS_GENDUMP_H__) +#define __OCS_GENDUMP_H__ +extern int ocs_gen_dump(ocs_t *ocs); +extern int ocs_fdb_dump(ocs_t *ocs); +extern int ocs_dump_to_host(ocs_t *ocs, void *buf, uint32_t buflen); +extern int ocs_function_speciic_dump(ocs_t *ocs, void *buf, uint32_t buflen); + +#define OCS_MAX_HBA_PORTS 4 + +#endif // __OCS_GENDUMP_H__ diff --git a/sys/dev/ocs_fc/ocs_ioctl.c b/sys/dev/ocs_fc/ocs_ioctl.c index 13d80bd3edde..c0576bd6600f 100644 --- a/sys/dev/ocs_fc/ocs_ioctl.c +++ b/sys/dev/ocs_fc/ocs_ioctl.c @@ -60,22 +60,12 @@ ocs_firmware_write(ocs_t *ocs, const uint8_t *buf, size_t buf_len, uint8_t *chan static int ocs_open(struct cdev *cdev, int flags, int fmt, struct thread *td) { -#if 0 - struct ocs_softc *ocs = cdev->si_drv1; - - device_printf(ocs->dev, "%s\n", __func__); -#endif return 0; } static int ocs_close(struct cdev *cdev, int flag, int fmt, struct thread *td) { -#if 0 - struct ocs_softc *ocs = cdev->si_drv1; - - device_printf(ocs->dev, "%s\n", __func__); -#endif return 0; } @@ -95,7 +85,8 @@ __ocs_ioctl_mbox_cb(ocs_hw_t *hw, int32_t status, uint8_t *mqe, void *arg) } static int -ocs_process_sli_config (ocs_t *ocs, ocs_ioctl_elxu_mbox_t *mcmd, ocs_dma_t *dma){ +ocs_process_sli_config (ocs_t *ocs, ocs_ioctl_elxu_mbox_t *mcmd, ocs_dma_t *dma) +{ sli4_cmd_sli_config_t *sli_config = (sli4_cmd_sli_config_t *)mcmd->payload; if (sli_config->emb) { diff --git a/sys/dev/ocs_fc/ocs_ioctl.h b/sys/dev/ocs_fc/ocs_ioctl.h index ad2460d09b87..f2a291843d5a 100644 --- a/sys/dev/ocs_fc/ocs_ioctl.h +++ b/sys/dev/ocs_fc/ocs_ioctl.h @@ -303,18 +303,21 @@ typedef struct { typedef struct { uint8_t *name; /*<< Input: name of property to retrieve */ + uint16_t name_len; /*<< Input: Length of name */ uint8_t *value; /*<< Output: user space buffer in which to place the response */ uint32_t value_length; /*<< Input: size of the user space buffer */ } ocs_ioctl_cmd_get_t; typedef struct { uint8_t *name; /*<< Input: name of property to set */ + uint16_t name_len; /*<< Input: Length of name */ uint8_t *value; /*<< Input: user space buffer which contains the new value */ int32_t result; /*<< Output: result */ } ocs_ioctl_cmd_set_t; typedef struct { uint8_t *name; /*<< Input: name of action to execute */ + uint16_t name_len; /*<< Input: Length of name */ void *arg_in; /*<< Input: pointer to argument in user space */ uint32_t arg_in_length; /*<< Input: size of arg_in in bytes */ void *arg_out; /*<< Output: pointer to argument from kernel to user */ diff --git a/sys/dev/ocs_fc/ocs_mgmt.c b/sys/dev/ocs_fc/ocs_mgmt.c index 1f22a0316791..ff0e028caea2 100644 --- a/sys/dev/ocs_fc/ocs_mgmt.c +++ b/sys/dev/ocs_fc/ocs_mgmt.c @@ -42,6 +42,7 @@ #include "ocs.h" #include "ocs_mgmt.h" +#include "ocs_gendump.h" #include "ocs_vpd.h" #define SFP_PAGE_SIZE 128 @@ -55,11 +56,6 @@ static int ocs_mgmt_function_reset(ocs_t *ocs, char *, void *buf, uint32_t buf_l static void ocs_mgmt_fw_write_cb(int32_t status, uint32_t actual_write_length, uint32_t change_status, void *arg); static int ocs_mgmt_force_assert(ocs_t *ocs, char *, void *buf, uint32_t buf_len, void*, uint32_t); -#if defined(OCS_INCLUDE_RAMD) -static int32_t -ocs_mgmt_read_phys(ocs_t *ocs, char *, void *, uint32_t , void *, uint32_t); -#endif - /* Getters */ static void get_nodes_count(ocs_t *, char *, ocs_textbuf_t*); @@ -141,9 +137,6 @@ static int set_nv_wwn(ocs_t*, char*, char*); static int set_loglevel(ocs_t*, char*, char*); static void ocs_mgmt_linkcfg_cb(int32_t status, uintptr_t value, void *arg); -#if defined(OCS_INCLUDE_RAMD) -static void* find_address_in_target(ocs_ramdisc_t **ramdisc_array, uint32_t ramdisc_count, uintptr_t target_addr); -#endif ocs_mgmt_table_entry_t mgmt_table[] = { {"nodes_count", get_nodes_count, NULL, NULL}, @@ -193,9 +186,6 @@ ocs_mgmt_table_entry_t mgmt_table[] = { {"firmware_write", NULL, NULL, ocs_mgmt_firmware_write}, {"firmware_reset", NULL, NULL, ocs_mgmt_firmware_reset}, {"function_reset", NULL, NULL, ocs_mgmt_function_reset}, -#if defined(OCS_INCLUDE_RAMD) - {"read_phys", NULL, NULL, ocs_mgmt_read_phys}, -#endif {"force_assert", NULL, NULL, ocs_mgmt_force_assert}, {"tgt_rscn_delay", get_tgt_rscn_delay, set_tgt_rscn_delay, NULL}, @@ -490,6 +480,15 @@ ocs_mgmt_exec(ocs_t *ocs, char *action, void *arg_in, } } + /* See if it's a value I can supply */ + if (ocs_strcmp(unqualified_name, "driver/gendump") == 0) { + return ocs_gen_dump(ocs); + } + + if (ocs_strcmp(unqualified_name, "driver/dump_to_host") == 0) { + return ocs_dump_to_host(ocs, arg_out, arg_out_length); + } + if ((ocs->mgmt_functions) && (ocs->mgmt_functions->exec_handler)) { result = ocs->mgmt_functions->exec_handler(qualifier, action, arg_in, arg_in_length, arg_out, arg_out_length, ocs); @@ -559,137 +558,6 @@ ocs_mgmt_get_all(ocs_t *ocs, ocs_textbuf_t *textbuf) ocs_mgmt_end_unnumbered_section(textbuf, "ocs"); } -#if defined(OCS_INCLUDE_RAMD) -static int32_t -ocs_mgmt_read_phys(ocs_t *ocs, char *name, void *arg_in, uint32_t arg_in_length, void *arg_out, uint32_t arg_out_length) -{ - uint32_t length; - char addr_str[80]; - uintptr_t target_addr; - void* vaddr = NULL; - ocs_ramdisc_t **ramdisc_array; - uint32_t ramdisc_count; - - if ((arg_in == NULL) || - (arg_in_length == 0) || - (arg_out == NULL) || - (arg_out_length == 0)) { - return -1; - } - - if (arg_in_length > 80) { - arg_in_length = 80; - } - - if (ocs_copy_from_user(addr_str, arg_in, arg_in_length)) { - ocs_log_test(ocs, "Failed to copy addr from user\n"); - return -EFAULT; - } - - target_addr = (uintptr_t)ocs_strtoul(addr_str, NULL, 0); - /* addr_str must be the physical address of a buffer that was reported - * in an SGL. Search ramdiscs looking for a segment that contains that - * physical address - */ - - if (ocs->tgt_ocs.use_global_ramd) { - /* Only one target */ - ramdisc_count = ocs->tgt_ocs.rdisc_count; - ramdisc_array = ocs->tgt_ocs.rdisc; - vaddr = find_address_in_target(ramdisc_array, ramdisc_count, target_addr); - } else { - /* Multiple targets. Each target is on a sport */ - uint32_t domain_idx; - - for (domain_idx=0; domain_idxdomain_instance_count; domain_idx++) { - ocs_domain_t *domain; - uint32_t sport_idx; - - domain = ocs_domain_get_instance(ocs, domain_idx); - for (sport_idx=0; sport_idx < domain->sport_instance_count; sport_idx++) { - ocs_sport_t *sport; - - sport = ocs_sport_get_instance(domain, sport_idx); - ramdisc_count = sport->tgt_sport.rdisc_count; - ramdisc_array = sport->tgt_sport.rdisc; - vaddr = find_address_in_target(ramdisc_array, ramdisc_count, target_addr); - - if (vaddr != NULL) { - break; - } - } - } - } - - length = arg_out_length; - - if (vaddr != NULL) { - if (ocs_copy_to_user(arg_out, vaddr, length)) { - ocs_log_test(ocs, "Failed to copy buffer to user\n"); - return -EFAULT; - } - - return 0; - } else { - return -EFAULT; - } - -} - -/* - * This function searches a target for a given physical address. - * The target is made up of a number of LUNs, each represented by - * a ocs_ramdisc_t. - */ -static void* find_address_in_target(ocs_ramdisc_t **ramdisc_array, uint32_t ramdisc_count, uintptr_t target_addr) -{ - void *vaddr = NULL; - uint32_t ramdisc_idx; - - /* Check each ramdisc */ - for (ramdisc_idx=0; ramdisc_idxsegment_count; segment_idx++) { - ramdisc_segment_t *segment = rdisc->segments[segment_idx]; - uintptr_t segment_start; - uintptr_t segment_end; - uint32_t offset; - - segment_start = segment->data_segment.phys; - segment_end = segment->data_segment.phys + segment->data_segment.size - 1; - if ((target_addr >= segment_start) && (target_addr <= segment_end)) { - /* Found the target address */ - offset = target_addr - segment_start; - vaddr = (uint32_t*)segment->data_segment.virt + offset; - } - - if (rdisc->dif_separate) { - segment_start = segment->dif_segment.phys; - segment_end = segment->data_segment.phys + segment->dif_segment.size - 1; - if ((target_addr >= segment_start) && (target_addr <= segment_end)) { - /* Found the target address */ - offset = target_addr - segment_start; - vaddr = (uint32_t*)segment->dif_segment.virt + offset; - } - } - - if (vaddr != NULL) { - break; - } - } - - if (vaddr != NULL) { - break; - } - } - - return vaddr; -} -#endif - static int32_t ocs_mgmt_firmware_reset(ocs_t *ocs, char *name, void *buf, uint32_t buf_len, void *arg_out, uint32_t arg_out_length) { diff --git a/sys/dev/ocs_fc/ocs_os.c b/sys/dev/ocs_fc/ocs_os.c index 985a611ba91e..4e4edea2e63f 100644 --- a/sys/dev/ocs_fc/ocs_os.c +++ b/sys/dev/ocs_fc/ocs_os.c @@ -883,13 +883,12 @@ ocs_pci_model(uint16_t vendor, uint16_t device) return "unknown"; } -int32_t +void ocs_get_bus_dev_func(ocs_t *ocs, uint8_t* bus, uint8_t* dev, uint8_t* func) { *bus = pci_get_bus(ocs->dev); *dev = pci_get_slot(ocs->dev); *func= pci_get_function(ocs->dev); - return 0; } /** diff --git a/sys/dev/ocs_fc/ocs_os.h b/sys/dev/ocs_fc/ocs_os.h index acc1a9b1cc19..5e36cca3b829 100644 --- a/sys/dev/ocs_fc/ocs_os.h +++ b/sys/dev/ocs_fc/ocs_os.h @@ -1050,9 +1050,8 @@ typedef struct ocs_pci_reg_s { * @param dev Pointer to location to store the device number. * @param func Pointer to location to store the function number. * - * @return Returns 0. */ -extern int32_t +extern void ocs_get_bus_dev_func(ocs_t *ocs, uint8_t* bus, uint8_t* dev, uint8_t* func); extern ocs_t *ocs_get_instance(uint32_t index); diff --git a/sys/modules/ocs_fc/Makefile b/sys/modules/ocs_fc/Makefile index 9bab50eba5bc..8d546f9eabfd 100644 --- a/sys/modules/ocs_fc/Makefile +++ b/sys/modules/ocs_fc/Makefile @@ -33,7 +33,8 @@ SRCS += \ ocs_scsi.c \ ocs_unsol.c \ ocs_ddump.c \ - ocs_mgmt.c + ocs_mgmt.c \ + ocs_gendump.c # CAM initiator/target From owner-dev-commits-src-main@freebsd.org Tue Jul 6 16:07:05 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F38C865D1E2; Tue, 6 Jul 2021 16:07:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GK6rS6SX3z3l1t; Tue, 6 Jul 2021 16:07:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C61C81C9B1; Tue, 6 Jul 2021 16:07:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 166G74Ur006295; Tue, 6 Jul 2021 16:07:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 166G74ta006294; Tue, 6 Jul 2021 16:07:04 GMT (envelope-from git) Date: Tue, 6 Jul 2021 16:07:04 GMT Message-Id: <202107061607.166G74ta006294@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ryan Moeller Subject: git: 53b438b2425c - main - zfsd: Check for error from zpool_vdev_online MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: freqlabs X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 53b438b2425c374f6147ac80b3330a9ec08432bb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 16:07:05 -0000 The branch main has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=53b438b2425c374f6147ac80b3330a9ec08432bb commit 53b438b2425c374f6147ac80b3330a9ec08432bb Author: Ryan Moeller AuthorDate: 2021-07-06 16:00:18 +0000 Commit: Ryan Moeller CommitDate: 2021-07-06 16:00:18 +0000 zfsd: Check for error from zpool_vdev_online Onlining a vdev can fail. Log the error if it does. Reviewed by: mav, asomers MFC after: 1 week Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D30882 --- cddl/usr.sbin/zfsd/case_file.cc | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/cddl/usr.sbin/zfsd/case_file.cc b/cddl/usr.sbin/zfsd/case_file.cc index da2125b4d716..8da711fc10cb 100644 --- a/cddl/usr.sbin/zfsd/case_file.cc +++ b/cddl/usr.sbin/zfsd/case_file.cc @@ -280,9 +280,17 @@ CaseFile::ReEvaluate(const string &devPath, const string &physPath, Vdev *vdev) || vdev->PoolGUID() == Guid::InvalidGuid()) && vdev->GUID() == m_vdevGUID) { - zpool_vdev_online(pool, vdev->GUIDString().c_str(), - ZFS_ONLINE_CHECKREMOVE | ZFS_ONLINE_UNSPARE, - &m_vdevState); + if (zpool_vdev_online(pool, vdev->GUIDString().c_str(), + ZFS_ONLINE_CHECKREMOVE | ZFS_ONLINE_UNSPARE, + &m_vdevState) != 0) { + syslog(LOG_ERR, + "Failed to online vdev(%s/%s:%s): %s: %s\n", + zpool_get_name(pool), vdev->GUIDString().c_str(), + devPath.c_str(), libzfs_error_action(g_zfsHandle), + libzfs_error_description(g_zfsHandle)); + return (/*consumed*/false); + } + syslog(LOG_INFO, "Onlined vdev(%s/%s:%s). State now %s.\n", zpool_get_name(pool), vdev->GUIDString().c_str(), devPath.c_str(), From owner-dev-commits-src-main@freebsd.org Tue Jul 6 18:55:49 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 262D4665E91; Tue, 6 Jul 2021 18:55:49 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GKBb90H8pz4fxT; Tue, 6 Jul 2021 18:55:49 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from venus.codepro.be (venus.codepro.be [5.9.86.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.codepro.be", Issuer "R3" (verified OK)) (Authenticated sender: kp) by smtp.freebsd.org (Postfix) with ESMTPSA id CC940A73C; Tue, 6 Jul 2021 18:55:48 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: by venus.codepro.be (Postfix, authenticated sender kp) id D19F946013; Tue, 6 Jul 2021 20:55:45 +0200 (CEST) From: "Kristof Provost" To: "Ram Kishore Vegesna" Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 29e2dbd42c3e - main - ocs_fc: Add gendump and dump_to_host ioctl command support. Date: Tue, 06 Jul 2021 20:55:44 +0200 X-Mailer: MailMate (1.13.2r5673) Message-ID: In-Reply-To: <202107061548.166Fm2ol078877@gitrepo.freebsd.org> References: <202107061548.166Fm2ol078877@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 18:55:49 -0000 Hi Ram, On 6 Jul 2021, at 17:48, Ram Kishore Vegesna wrote: > The branch main has been updated by ram: > > URL: = > https://cgit.FreeBSD.org/src/commit/?id=3D29e2dbd42c3e2e10e606b3414f4d0= c53021d4e86 > > commit 29e2dbd42c3e2e10e606b3414f4d0c53021d4e86 > Author: Ram Kishore Vegesna > AuthorDate: 2021-06-24 07:05:00 +0000 > Commit: Ram Kishore Vegesna > CommitDate: 2021-07-06 15:38:11 +0000 > > ocs_fc: Add gendump and dump_to_host ioctl command support. > > Support to generate firmware dump. > > Approved by: mav(mentor) > --- > sys/dev/ocs_fc/ocs_gendump.c | 388 = > +++++++++++++++++++++++++++++++++++++++++++ > sys/dev/ocs_fc/ocs_gendump.h | 42 +++++ > sys/dev/ocs_fc/ocs_ioctl.c | 13 +- > sys/dev/ocs_fc/ocs_ioctl.h | 3 + > sys/dev/ocs_fc/ocs_mgmt.c | 152 ++--------------- > sys/dev/ocs_fc/ocs_os.c | 3 +- > sys/dev/ocs_fc/ocs_os.h | 3 +- > sys/modules/ocs_fc/Makefile | 3 +- > 8 files changed, 449 insertions(+), 158 deletions(-) > I=E2=80=99m seeing this build failure (amd64, GENERIC kernel): ld: error: undefined symbol: ocs_gen_dump >>> referenced by ocs_mgmt.c:485 = (/usr/src/sys/dev/ocs_fc/ocs_mgmt.c:485) >>> ocs_mgmt.o:(ocs_mgmt_exec) ld: error: undefined symbol: ocs_dump_to_host >>> referenced by ocs_mgmt.c:489 = (/usr/src/sys/dev/ocs_fc/ocs_mgmt.c:489) >>> ocs_mgmt.o:(ocs_mgmt_exec) *** [kernel.full] Error code 1 Does that ring any bells? Thanks, Kristof From owner-dev-commits-src-main@freebsd.org Tue Jul 6 19:03:44 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AC314666237; Tue, 6 Jul 2021 19:03:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GKBmJ4NPnz4h0d; Tue, 6 Jul 2021 19:03:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7ECF41F305; Tue, 6 Jul 2021 19:03:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 166J3i3n047081; Tue, 6 Jul 2021 19:03:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 166J3iG7047080; Tue, 6 Jul 2021 19:03:44 GMT (envelope-from git) Date: Tue, 6 Jul 2021 19:03:44 GMT Message-Id: <202107061903.166J3iG7047080@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Motin Subject: git: d0732fa81963 - main - Add ocs_gendump.c to the build, missed in 29e2dbd42c3e. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d0732fa81963d336099a6b134a1eb4be867bfa8b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 19:03:44 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=d0732fa81963d336099a6b134a1eb4be867bfa8b commit d0732fa81963d336099a6b134a1eb4be867bfa8b Author: Alexander Motin AuthorDate: 2021-07-06 19:03:06 +0000 Commit: Alexander Motin CommitDate: 2021-07-06 19:03:06 +0000 Add ocs_gendump.c to the build, missed in 29e2dbd42c3e. --- sys/conf/files | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/conf/files b/sys/conf/files index ef58ba895d2b..94f4e92bb25c 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -2579,6 +2579,7 @@ dev/oce/oce_mbox.c optional oce pci dev/oce/oce_queue.c optional oce pci dev/oce/oce_sysctl.c optional oce pci dev/oce/oce_util.c optional oce pci +dev/ocs_fc/ocs_gendump.c optional ocs_fc pci dev/ocs_fc/ocs_pci.c optional ocs_fc pci dev/ocs_fc/ocs_ioctl.c optional ocs_fc pci dev/ocs_fc/ocs_os.c optional ocs_fc pci From owner-dev-commits-src-main@freebsd.org Tue Jul 6 19:04:50 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E9E476660A5; Tue, 6 Jul 2021 19:04:50 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-qk1-x731.google.com (mail-qk1-x731.google.com [IPv6:2607:f8b0:4864:20::731]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GKBnZ5Vvbz4gxl; Tue, 6 Jul 2021 19:04:50 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: by mail-qk1-x731.google.com with SMTP id t19so6608899qkg.7; Tue, 06 Jul 2021 12:04:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:autocrypt:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=5EclEbvOQR0Bml1e8BxOMOHKOp1k1W/bJ11Rlb1SIAI=; b=GZBEs4rsDVmKf5MuBWzmg6d98VPlZP6kEqSRMgh7xnPo14f9lsXrSDtdCWNnnYR40h D5W0T3ohYzEtCyOjGp5iIXPSxOsVb3qW7R5JHyT3mThLmVmIO9nnwDsa1LZhuehHG91w HXEP3Pe+JbsCb/jZmg+QaEd5XjQvTxDxJYU49UpjHddz6w1YsfkNvth2P/p7xHvnNnUn KGK5dYb8qztrBRWO49dZWlAq7tYoCQgt5MOAtMtVk2tw+5ddMTLsDWisaWi5tbnT3nYH XpgQXh5l1FhBildhpPKgV9NBZUW7t9Y1nrwhX5dZ7FUj7/VZV3glZ1R9Uj+Tka7PoVwc spYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=5EclEbvOQR0Bml1e8BxOMOHKOp1k1W/bJ11Rlb1SIAI=; b=ieFe/srD8RynDMBJMndudfFmOFsiIiBQFrDw/D7yqTe5SAB124gHKNiJIohc+PdAmP vUJ/bXuaJicgBOkL87pZz6whtVvPI9R4Mk3Ly9zFMlFwRftjHAAt/p0gqPV8x2dtlWfj ezZni9wzwagP5ER216fV2vc4C+Q2Ygx1Dgr5YygZj7L0l4ijB/vq5Uhtb93AqsRq9Gd0 IkmeS5z9WGgegvJftjZRKekrSA8/aljiVbzkXoGXdwsBHt9lsPWWeSuPFh971RBM+GyL 2rk8xYf9hqMed9Y5oEqIsHxHSC+1YgYvx6GLunE1UKk5XkfYEsOgndS0Mqzn1TuU3Vml sECQ== X-Gm-Message-State: AOAM532Kg6rVYG+rmfzxJh5YjHQdAxmpeQmrY727ostq3pLBMdbNGUam vM08qo3vin2/hoLOo/jojtLpsi9fKpk= X-Google-Smtp-Source: ABdhPJw3ltOforn2LqNL+eywirdgGe2O2nhkmsTSyL3gX/cRF5XKZbrVORhzPIWQ8FEJcXK+cR597g== X-Received: by 2002:ae9:f805:: with SMTP id x5mr10181671qkh.373.1625598289295; Tue, 06 Jul 2021 12:04:49 -0700 (PDT) Received: from mavoffice.ixsystems.com ([38.32.73.2]) by smtp.gmail.com with ESMTPSA id t62sm7188292qkc.26.2021.07.06.12.04.48 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 06 Jul 2021 12:04:48 -0700 (PDT) Subject: Re: git: 29e2dbd42c3e - main - ocs_fc: Add gendump and dump_to_host ioctl command support. To: Kristof Provost , Ram Kishore Vegesna Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202107061548.166Fm2ol078877@gitrepo.freebsd.org> From: Alexander Motin Autocrypt: addr=mavbsd@gmail.com; prefer-encrypt=mutual; keydata= mQENBFOzxAwBCADkPrax0pI2W/ig0CK9nRJJwsHitAGEZ2HZiFEuti+6/4UVxj81yr4ak/4g 9bKUyC7rMEAp/ZHNhd+MFCPAAcHPvtovnfykqE/vuosCS3wlSLloix2iKVLks0CwbLHGAyne 46lTQW74Xl/33c3W1Z6d8jD9gVFT/xaVzZ0U9xdzOmsYAZaAj4ki0tuxO9F7L+ct9grRe7iP g8t9hai7BL4ee3VRwk2JXnKb7UvBiVITKYWKz1jRvZIrjPokgEcCLOSlv7x/1kjuFnj3xWZU 7HSFFT8J93epBbrSSCsYsppIk2fZH41kaaFXsMQfTPH8wkeM6qwrvOh4HiQM08R+9tThABEB AAG0IkFsZXhhbmRlciBNb3RpbiA8bWF2YnNkQGdtYWlsLmNvbT6JAVQEEwEKAD4CGwMFCwkI BwMFFQoJCAsFFgMCAQACHgECF4AWIQTpjPPE5pzDzQ5XnVWDGMOVW6sifwUCWWDCtwUJDTHM ogAKCRCDGMOVW6sif7nYB/9TpvgdnxMVBT9aPaaGrFOToI8lV5eCUIB3ot6+VbfeMam0nkFZ GGoaXvDMdIf++1jFADTP+hcl1fIrrH1uy2ZS1tDu3Ngd6BUCAcHcbFEqEZnCwzQTkULHbYGJ pHxKAvQYIvrOTpBb4IBHBO44lOVC21VYj8ii6hTr1ACqYa4SbIaQobByWkWErHNGN9A64LFS rbir4mXJ0Bo0vgfj3jtoGEV8RrbYseYBR2NOaw+1GjRMjoJxyTMgU1XNDZHAVGHiw/KG2cR8 EH4rqj47fLWJLWZy/ffUsWmqDnWvqswbzZjQXT8B4Yls9aqum5pykoNKtbAFT8Xpb/Y9RE1s nkXTuQENBFOzxAwBCADmYFn9nCSLvufCMz9nZFxP7q497a+Dqqwf8hxllH+9S8+g9BYumQF4 A7ZnBSxj3zMlriwL0jPsZqILpO8wuIUQWL0MnJiIbqgatYztVqf2fpaaDzP9XA2C5/BZb5iP 3ONDIVGYd+OQwOI2FlmmTY0B1FlUNXz3+feb3VVTD0/2mxPBOQ2hen0pEZqhU5n2EZH27d8r VPDXVGqQ3CVWO3BD9pyQVTWT5ziDm0f2SIEsY46xuaN+Ml6KnrqfCb8BL/vzcpc87slxGUdR HRCM0P2tZ4f9I+DV7c2RKiluGk1pZkqm+sDfI4dTkjjqpGLH5xN538XGW8YuCEaDUGJZufUf ABEBAAGJATwEGAEKACYCGwwWIQTpjPPE5pzDzQ5XnVWDGMOVW6sifwUCWWDC2AUJDTHMzAAK CRCDGMOVW6sif06oB/0UBwpZL3nBNNutpcCqD/5tDIeCOUy0YKCSZ/EuxtQZ6qIWCZIi6gOs Xurqxg+zqnTQJddlG641m3SVfs73mt7yaDODGbmImKxml1scxV6liXD8DFPbAIfDEYIR7rgu b4D2+OU537cPf/p9IvBn1YUITqnqVBnUIODT3F74kpKAL4oOqafS3MYrJ9IK6FECrdeRnLEv WHEFoN4/R54qXOjLuNeh1/fBW9ddzRyanNoHkxy5EcrgRTqMiKgejfRio8zgCM8cbFXZfU3r 8BrK6eDOP0Rc1m0oLGzp2xO+OeJZrlWRn0XhI51JvER6fUNlFil5ad3sZWY7zqf7lRKQoJc+ tCJBbGV4YW5kZXIgTW90aW4gPG1hdmJzZEBnbWFpbC5jb20+uQENBFOzxAwBCADmYFn9nCSL vufCMz9nZFxP7q497a+Dqqwf8hxllH+9S8+g9BYumQF4A7ZnBSxj3zMlriwL0jPsZqILpO8w uIUQWL0MnJiIbqgatYztVqf2fpaaDzP9XA2C5/BZb5iP3ONDIVGYd+OQwOI2FlmmTY0B1FlU NXz3+feb3VVTD0/2mxPBOQ2hen0pEZqhU5n2EZH27d8rVPDXVGqQ3CVWO3BD9pyQVTWT5ziD m0f2SIEsY46xuaN+Ml6KnrqfCb8BL/vzcpc87slxGUdRHRCM0P2tZ4f9I+DV7c2RKiluGk1p Zkqm+sDfI4dTkjjqpGLH5xN538XGW8YuCEaDUGJZufUfABEBAAGJATwEGAEKACYCGwwWIQTp jPPE5pzDzQ5XnVWDGMOVW6sifwUCWWDC2AUJDTHMzAAKCRCDGMOVW6sif06oB/0UBwpZL3nB NNutpcCqD/5tDIeCOUy0YKCSZ/EuxtQZ6qIWCZIi6gOsXurqxg+zqnTQJddlG641m3SVfs73 mt7yaDODGbmImKxml1scxV6liXD8DFPbAIfDEYIR7rgub4D2+OU537cPf/p9IvBn1YUITqnq VBnUIODT3F74kpKAL4oOqafS3MYrJ9IK6FECrdeRnLEvWHEFoN4/R54qXOjLuNeh1/fBW9dd zRyanNoHkxy5EcrgRTqMiKgejfRio8zgCM8cbFXZfU3r8BrK6eDOP0Rc1m0oLGzp2xO+OeJZ rlWRn0XhI51JvER6fUNlFil5ad3sZWY7zqf7lRKQoJc+ Message-ID: <2b8685de-e94b-9413-b4fd-43526c7903d3@gmail.com> Date: Tue, 6 Jul 2021 15:04:47 -0400 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.8.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4GKBnZ5Vvbz4gxl X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 19:04:51 -0000 On 06.07.2021 14:55, Kristof Provost wrote: > On 6 Jul 2021, at 17:48, Ram Kishore Vegesna wrote: > The branch main has been updated by ram: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=29e2dbd42c3e2e10e606b3414f4d0c53021d4e86 > > commit 29e2dbd42c3e2e10e606b3414f4d0c53021d4e86 > Author: Ram Kishore Vegesna > AuthorDate: 2021-06-24 07:05:00 +0000 > Commit: Ram Kishore Vegesna > CommitDate: 2021-07-06 15:38:11 +0000 > > ocs_fc: Add gendump and dump_to_host ioctl command support. > > Support to generate firmware dump. > > Approved by: mav(mentor) > --- > sys/dev/ocs_fc/ocs_gendump.c | 388 > +++++++++++++++++++++++++++++++++++++++++++ > sys/dev/ocs_fc/ocs_gendump.h | 42 +++++ > sys/dev/ocs_fc/ocs_ioctl.c | 13 +- > sys/dev/ocs_fc/ocs_ioctl.h | 3 + > sys/dev/ocs_fc/ocs_mgmt.c | 152 ++--------------- > sys/dev/ocs_fc/ocs_os.c | 3 +- > sys/dev/ocs_fc/ocs_os.h | 3 +- > sys/modules/ocs_fc/Makefile | 3 +- > 8 files changed, 449 insertions(+), 158 deletions(-) > > I’m seeing this build failure (amd64, GENERIC kernel): > > |ld: error: undefined symbol: ocs_gen_dump >>> referenced by > ocs_mgmt.c:485 (/usr/src/sys/dev/ocs_fc/ocs_mgmt.c:485) >>> > ocs_mgmt.o:(ocs_mgmt_exec) ld: error: undefined symbol: ocs_dump_to_host >>>> referenced by ocs_mgmt.c:489 > (/usr/src/sys/dev/ocs_fc/ocs_mgmt.c:489) >>> ocs_mgmt.o:(ocs_mgmt_exec) > *** [kernel.full] Error code 1 | > > Does that ring any bells? d0732fa81963 should fix it. Sorry for breakage. -- Alexander Motin From owner-dev-commits-src-main@freebsd.org Tue Jul 6 19:05:15 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BE18B6661DE; Tue, 6 Jul 2021 19:05:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GKBp34qWSz4gy3; Tue, 6 Jul 2021 19:05:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8D8BD1F152; Tue, 6 Jul 2021 19:05:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 166J5FoH047304; Tue, 6 Jul 2021 19:05:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 166J5FDH047303; Tue, 6 Jul 2021 19:05:15 GMT (envelope-from git) Date: Tue, 6 Jul 2021 19:05:15 GMT Message-Id: <202107061905.166J5FDH047303@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 2a69eb8c878e - main - cxgb: switch bare zone_mbuf use to m_free_raw MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2a69eb8c878eb5c9a31c37fd08ea292f9a3a0a36 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 19:05:15 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=2a69eb8c878eb5c9a31c37fd08ea292f9a3a0a36 commit 2a69eb8c878eb5c9a31c37fd08ea292f9a3a0a36 Author: Mateusz Guzik AuthorDate: 2021-07-06 16:25:39 +0000 Commit: Mateusz Guzik CommitDate: 2021-07-06 19:05:11 +0000 cxgb: switch bare zone_mbuf use to m_free_raw Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/dev/cxgb/cxgb_sge.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/cxgb/cxgb_sge.c b/sys/dev/cxgb/cxgb_sge.c index 00b67880fcc8..0d415d94224f 100644 --- a/sys/dev/cxgb/cxgb_sge.c +++ b/sys/dev/cxgb/cxgb_sge.c @@ -806,7 +806,7 @@ free_rx_bufs(adapter_t *sc, struct sge_fl *q) uma_zfree(zone_pack, d->m); } else { m_init(d->m, M_NOWAIT, MT_DATA, 0); - uma_zfree(zone_mbuf, d->m); + m_free_raw(d->m); uma_zfree(q->zone, d->rxsd_cl); } } From owner-dev-commits-src-main@freebsd.org Tue Jul 6 19:18:32 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 15CA9666409; Tue, 6 Jul 2021 19:18:32 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GKC5M71kBz4j48; Tue, 6 Jul 2021 19:18:31 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from venus.codepro.be (venus.codepro.be [5.9.86.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.codepro.be", Issuer "R3" (verified OK)) (Authenticated sender: kp) by smtp.freebsd.org (Postfix) with ESMTPSA id BF9A5AB35; Tue, 6 Jul 2021 19:18:31 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: by venus.codepro.be (Postfix, authenticated sender kp) id 3BC2A45F2C; Tue, 6 Jul 2021 21:18:29 +0200 (CEST) From: "Kristof Provost" To: "Alexander Motin" Cc: "Ram Kishore Vegesna" , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 29e2dbd42c3e - main - ocs_fc: Add gendump and dump_to_host ioctl command support. Date: Tue, 06 Jul 2021 21:18:28 +0200 X-Mailer: MailMate (1.13.2r5673) Message-ID: <0BD4E409-AD73-45F8-80B4-99E6FAC7BFE6@FreeBSD.org> In-Reply-To: <2b8685de-e94b-9413-b4fd-43526c7903d3@gmail.com> References: <202107061548.166Fm2ol078877@gitrepo.freebsd.org> <2b8685de-e94b-9413-b4fd-43526c7903d3@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: quoted-printable X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 19:18:32 -0000 On 6 Jul 2021, at 21:04, Alexander Motin wrote: > On 06.07.2021 14:55, Kristof Provost wrote: >> On 6 Jul 2021, at 17:48, Ram Kishore Vegesna wrote: >> The branch main has been updated by ram: >> >> URL: >> https://cgit.FreeBSD.org/src/commit/?id=3D29e2dbd42c3e2e10e606b341= 4f4d0c53021d4e86 >> >> commit 29e2dbd42c3e2e10e606b3414f4d0c53021d4e86 >> Author: Ram Kishore Vegesna >> AuthorDate: 2021-06-24 07:05:00 +0000 >> Commit: Ram Kishore Vegesna >> CommitDate: 2021-07-06 15:38:11 +0000 >> >> ocs_fc: Add gendump and dump_to_host ioctl command support. >> >> Support to generate firmware dump. >> >> Approved by: mav(mentor) >> --- >> sys/dev/ocs_fc/ocs_gendump.c | 388 >> +++++++++++++++++++++++++++++++++++++++++++ >> sys/dev/ocs_fc/ocs_gendump.h | 42 +++++ >> sys/dev/ocs_fc/ocs_ioctl.c | 13 +- >> sys/dev/ocs_fc/ocs_ioctl.h | 3 + >> sys/dev/ocs_fc/ocs_mgmt.c | 152 ++--------------- >> sys/dev/ocs_fc/ocs_os.c | 3 +- >> sys/dev/ocs_fc/ocs_os.h | 3 +- >> sys/modules/ocs_fc/Makefile | 3 +- >> 8 files changed, 449 insertions(+), 158 deletions(-) >> >> I=E2=80=99m seeing this build failure (amd64, GENERIC kernel): >> >> |ld: error: undefined symbol: ocs_gen_dump >>> referenced by >> ocs_mgmt.c:485 (/usr/src/sys/dev/ocs_fc/ocs_mgmt.c:485) >>> >> ocs_mgmt.o:(ocs_mgmt_exec) ld: error: undefined symbol: = >> ocs_dump_to_host >>>>> referenced by ocs_mgmt.c:489 >> (/usr/src/sys/dev/ocs_fc/ocs_mgmt.c:489) >>> = >> ocs_mgmt.o:(ocs_mgmt_exec) >> *** [kernel.full] Error code 1 | >> >> Does that ring any bells? > > d0732fa81963 should fix it. Sorry for breakage. > That works. Thanks for the quick fix. =E2=80=94 Kristof From owner-dev-commits-src-main@freebsd.org Tue Jul 6 19:26:54 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5B4C0666EF6; Tue, 6 Jul 2021 19:26:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GKCH227nMz4kk3; Tue, 6 Jul 2021 19:26:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3275C1F65D; Tue, 6 Jul 2021 19:26:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 166JQsc2074749; Tue, 6 Jul 2021 19:26:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 166JQsLw074748; Tue, 6 Jul 2021 19:26:54 GMT (envelope-from git) Date: Tue, 6 Jul 2021 19:26:54 GMT Message-Id: <202107061926.166JQsLw074748@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Randall Stewart Subject: git: e834f9a44acc - main - tcp: Address goodput and TLP edge cases. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rrs X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e834f9a44acc577e658f40023d9465e887c94920 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 19:26:54 -0000 The branch main has been updated by rrs: URL: https://cgit.FreeBSD.org/src/commit/?id=e834f9a44acc577e658f40023d9465e887c94920 commit e834f9a44acc577e658f40023d9465e887c94920 Author: Randall Stewart AuthorDate: 2021-07-06 14:36:14 +0000 Commit: Randall Stewart CommitDate: 2021-07-06 19:26:37 +0000 tcp: Address goodput and TLP edge cases. There are several cases where we make a goodput measurement and we are running out of data when we decide to make the measurement. In reality we should not make such a measurement if there is no chance we can have "enough" data. There is also some corner case TLP's that end up not registering as a TLP like they should, we fix this by pushing the doing_tlp setup to the actual timeout that knows it did a TLP. This makes it so we always have the appropriate flag on the sendmap indicating a TLP being done as well as count correctly so we make no more that two TLP's. In addressing the goodput lets also add a "quality" metric that can be viewed via blackbox logs so that a casual observer does not have to figure out how good of a measurement it is. This is needed due to the fact that we may still make a measurement that is of a poorer quality as we run out of data but still have a minimal amount of data to make a measurement. Reviewed by: tuexen Sponsored by: Netflix Inc. Differential Revision: https://reviews.freebsd.org/D31076 --- sys/netinet/tcp_stacks/rack.c | 329 +++++++++++++++++++++++++++----------- sys/netinet/tcp_stacks/tcp_rack.h | 11 ++ 2 files changed, 251 insertions(+), 89 deletions(-) diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c index 6678ca92738b..b5727f7873fd 100644 --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -458,9 +458,11 @@ rack_log_alt_to_to_cancel(struct tcp_rack *rack, uint32_t flex3, uint32_t flex4, uint32_t flex5, uint32_t flex6, uint16_t flex7, uint8_t mod); + static void rack_log_pacing_delay_calc(struct tcp_rack *rack, uint32_t len, uint32_t slot, - uint64_t bw_est, uint64_t bw, uint64_t len_time, int method, int line, struct rack_sendmap *rsm); + uint64_t bw_est, uint64_t bw, uint64_t len_time, int method, int line, + struct rack_sendmap *rsm, uint8_t quality); static struct rack_sendmap * rack_find_high_nonack(struct tcp_rack *rack, struct rack_sendmap *rsm); @@ -472,7 +474,7 @@ rack_get_sockopt(struct socket *so, struct sockopt *sopt, struct inpcb *inp, struct tcpcb *tp, struct tcp_rack *rack); static void rack_do_goodput_measurement(struct tcpcb *tp, struct tcp_rack *rack, - tcp_seq th_ack, int line); + tcp_seq th_ack, int line, uint8_t quality); static uint32_t rack_get_pacing_len(struct tcp_rack *rack, uint64_t bw, uint32_t mss); static int32_t rack_handoff_ok(struct tcpcb *tp); @@ -1566,9 +1568,6 @@ rack_init_sysctls(void) SYSCTL_CHILDREN(rack_counters), OID_AUTO, "hwpace_lost", CTLFLAG_RD, &rack_hw_pace_lost, "Total number of times we failed to initialize hw pacing"); - - - rack_badfr = counter_u64_alloc(M_WAITOK); SYSCTL_ADD_COUNTER_U64(&rack_sysctl_ctx, SYSCTL_CHILDREN(rack_counters), @@ -3045,7 +3044,7 @@ rack_get_measure_window(struct tcpcb *tp, struct tcp_rack *rack) /* * We have no measurement (IW is in flight?) so * we can only guess using our data_window sysctl - * value (usually 100MSS). + * value (usually 20MSS). */ return (def_len); } @@ -3113,7 +3112,7 @@ rack_get_measure_window(struct tcpcb *tp, struct tcp_rack *rack) } static int -rack_enough_for_measurement(struct tcpcb *tp, struct tcp_rack *rack, tcp_seq th_ack) +rack_enough_for_measurement(struct tcpcb *tp, struct tcp_rack *rack, tcp_seq th_ack, uint8_t *quality) { uint32_t tim, srtts, segsiz; @@ -3123,6 +3122,7 @@ rack_enough_for_measurement(struct tcpcb *tp, struct tcp_rack *rack, tcp_seq th_ if ((tp->snd_max == tp->snd_una) || (th_ack == tp->snd_max)){ /* All is acked */ + *quality = RACK_QUALITY_ALLACKED; return (1); } if (SEQ_LT(th_ack, tp->gput_seq)) { @@ -3136,17 +3136,19 @@ rack_enough_for_measurement(struct tcpcb *tp, struct tcp_rack *rack, tcp_seq th_ return (0); } if (rack->r_ctl.rc_first_appl && - (rack->r_ctl.rc_first_appl->r_start == th_ack)) { + (SEQ_GEQ(th_ack, rack->r_ctl.rc_first_appl->r_end))) { /* - * We are up to the app limited point + * We are up to the app limited send point * we have to measure irrespective of the time.. */ + *quality = RACK_QUALITY_APPLIMITED; return (1); } /* Now what about time? */ srtts = (rack->r_ctl.rc_gp_srtt * rack_min_srtts); tim = tcp_tv_to_usectick(&rack->r_ctl.act_rcv_time) - tp->gput_ts; if (tim >= srtts) { + *quality = RACK_QUALITY_HIGH; return (1); } /* Nope not even a full SRTT has passed */ @@ -3673,7 +3675,8 @@ rack_enter_probertt(struct tcp_rack *rack, uint32_t us_cts) * now. */ rack_do_goodput_measurement(rack->rc_tp, rack, - rack->rc_tp->snd_una, __LINE__); + rack->rc_tp->snd_una, __LINE__, + RACK_QUALITY_PROBERTT); } rack->r_ctl.rack_per_of_gp_probertt = rack_per_of_gp_probertt; rack->r_ctl.rc_time_probertt_entered = us_cts; @@ -3711,7 +3714,8 @@ rack_exit_probertt(struct tcp_rack *rack, uint32_t us_cts) * now. */ rack_do_goodput_measurement(rack->rc_tp, rack, - rack->rc_tp->snd_una, __LINE__); + rack->rc_tp->snd_una, __LINE__, + RACK_QUALITY_PROBERTT); } else if (rack->rc_tp->t_flags & TF_GPUTINPROG) { /* * We don't have enough data to make a measurement. @@ -4188,7 +4192,7 @@ rack_make_timely_judgement(struct tcp_rack *rack, uint32_t rtt, int32_t rtt_diff static void rack_do_goodput_measurement(struct tcpcb *tp, struct tcp_rack *rack, - tcp_seq th_ack, int line) + tcp_seq th_ack, int line, uint8_t quality) { uint64_t tim, bytes_ps, ltim, stim, utim; uint32_t segsiz, bytes, reqbytes, us_cts; @@ -4202,7 +4206,6 @@ rack_do_goodput_measurement(struct tcpcb *tp, struct tcp_rack *rack, tim = us_cts - tp->gput_ts; else tim = 0; - if (rack->r_ctl.rc_gp_cumack_ts > rack->r_ctl.rc_gp_output_ts) stim = rack->r_ctl.rc_gp_cumack_ts - rack->r_ctl.rc_gp_output_ts; else @@ -4230,7 +4233,7 @@ rack_do_goodput_measurement(struct tcpcb *tp, struct tcp_rack *rack, bytes = 0; bytes_ps = 0; rack_log_pacing_delay_calc(rack, bytes_ps, reqbytes, - 0, 0, 0, 10, __LINE__, NULL); + 0, 0, 0, 10, __LINE__, NULL, quality); goto skip_measurement; } if (rack->r_ctl.rc_gp_lowrtt == 0xffffffff) { @@ -4238,7 +4241,7 @@ rack_do_goodput_measurement(struct tcpcb *tp, struct tcp_rack *rack, bytes = 0; bytes_ps = 0; rack_log_pacing_delay_calc(rack, bytes_ps, reqbytes, - 0, 0, 0, 10, __LINE__, NULL); + 0, 0, 0, 10, __LINE__, NULL, quality); goto skip_measurement; } /* @@ -4275,7 +4278,7 @@ rack_do_goodput_measurement(struct tcpcb *tp, struct tcp_rack *rack, bytes = 0; bytes_ps = 0; rack_log_pacing_delay_calc(rack, bytes_ps, reqbytes, - 0, 0, 0, 10, __LINE__, NULL); + 0, 0, 0, 10, __LINE__, NULL, quality); goto skip_measurement; } else bytes = (th_ack - tp->gput_seq); @@ -4307,7 +4310,7 @@ rack_do_goodput_measurement(struct tcpcb *tp, struct tcp_rack *rack, if ((bytes_ps < reqbytes) || rack->app_limited_needs_set) { rack_log_pacing_delay_calc(rack, bytes_ps, reqbytes, rack->r_ctl.rc_app_limited_cnt, - 0, 0, 10, __LINE__, NULL); + 0, 0, 10, __LINE__, NULL, quality); goto skip_measurement; } /* @@ -4349,7 +4352,7 @@ rack_do_goodput_measurement(struct tcpcb *tp, struct tcp_rack *rack, */ rack_log_pacing_delay_calc(rack, bytes, reqbytes, bytes_ps, rack->r_ctl.last_max_bw, 0, - 11, __LINE__, NULL); + 11, __LINE__, NULL, quality); bytes_ps = rack->r_ctl.last_max_bw; } /* We store gp for b/w in bytes per second */ @@ -4363,7 +4366,7 @@ rack_do_goodput_measurement(struct tcpcb *tp, struct tcp_rack *rack, } else { rack_log_pacing_delay_calc(rack, bytes_ps, reqbytes, rack->r_ctl.rc_app_limited_cnt, - 0, 0, 10, __LINE__, NULL); + 0, 0, 10, __LINE__, NULL, quality); } if (rack->rc_inp->inp_in_hpts && (rack->r_ctl.rc_hpts_flags & PACE_PKT_OUTPUT)) { @@ -4504,14 +4507,14 @@ rack_do_goodput_measurement(struct tcpcb *tp, struct tcp_rack *rack, rack_apply_deferred_options(rack); } rack_log_pacing_delay_calc(rack, subpart, addpart, bytes_ps, stim, - rack_get_bw(rack), 22, did_add, NULL); + rack_get_bw(rack), 22, did_add, NULL, quality); /* We do not update any multipliers if we are in or have seen a probe-rtt */ if ((rack->measure_saw_probe_rtt == 0) && rack->rc_gp_rtt_set) rack_update_multiplier(rack, timely_says, bytes_ps, rack->r_ctl.rc_gp_srtt, rack->r_ctl.rc_rtt_diff); rack_log_pacing_delay_calc(rack, bytes, tim, bytes_ps, stim, - rack_get_bw(rack), 3, line, NULL); + rack_get_bw(rack), 3, line, NULL, quality); /* reset the gp srtt and setup the new prev */ rack->r_ctl.rc_prev_gp_srtt = rack->r_ctl.rc_gp_srtt; /* Record the lost count for the next measurement */ @@ -4554,14 +4557,13 @@ skip_measurement: TCPS_HAVEESTABLISHED(tp->t_state) && rack->r_ctl.rc_app_limited_cnt && (SEQ_GT(rack->r_ctl.rc_first_appl->r_start, th_ack)) && - ((rack->r_ctl.rc_first_appl->r_start - th_ack) > + ((rack->r_ctl.rc_first_appl->r_end - th_ack) > max(rc_init_window(rack), (MIN_GP_WIN * segsiz)))) { /* * Yep there is enough outstanding to make a measurement here. */ struct rack_sendmap *rsm, fe; - tp->t_flags |= TF_GPUTINPROG; rack->r_ctl.rc_gp_lowrtt = 0xffffffff; rack->r_ctl.rc_gp_high_rwnd = rack->rc_tp->snd_wnd; tp->gput_ts = tcp_tv_to_usectick(&rack->r_ctl.act_rcv_time); @@ -4572,13 +4574,34 @@ skip_measurement: else if ((rack->measure_saw_probe_rtt) && (SEQ_GEQ(tp->gput_seq, rack->r_ctl.rc_probertt_sndmax_atexit))) rack->measure_saw_probe_rtt = 0; - if ((rack->r_ctl.rc_first_appl->r_start - th_ack) >= rack_get_measure_window(tp, rack)) { + if ((rack->r_ctl.rc_first_appl->r_end - th_ack) >= rack_get_measure_window(tp, rack)) { /* There is a full window to gain info from */ tp->gput_ack = tp->gput_seq + rack_get_measure_window(tp, rack); } else { /* We can only measure up to the applimited point */ - tp->gput_ack = tp->gput_seq + (rack->r_ctl.rc_first_appl->r_start - th_ack); + tp->gput_ack = tp->gput_seq + (rack->r_ctl.rc_first_appl->r_end - th_ack); + if ((tp->gput_ack - tp->gput_seq) < (MIN_GP_WIN * segsiz)) { + /* + * We don't have enough to make a measurement. + */ + tp->t_flags &= ~TF_GPUTINPROG; + rack_log_pacing_delay_calc(rack, tp->gput_ack, tp->gput_seq, + 0, 0, 0, 6, __LINE__, NULL, quality); + return; + } + } + if (tp->t_state >= TCPS_FIN_WAIT_1) { + /* + * We will get no more data into the SB + * this means we need to have the data available + * before we start a measurement. + */ + if (sbavail(&tp->t_inpcb->inp_socket->so_snd) < (tp->gput_ack - tp->gput_seq)) { + /* Nope not enough data. */ + return; + } } + tp->t_flags |= TF_GPUTINPROG; /* * Now we need to find the timestamp of the send at tp->gput_seq * for the send based measurement. @@ -4619,7 +4642,7 @@ skip_measurement: tp->gput_ts, rack->r_ctl.rc_app_limited_cnt, 9, - __LINE__, NULL); + __LINE__, NULL, quality); } } @@ -4632,7 +4655,7 @@ rack_ack_received(struct tcpcb *tp, struct tcp_rack *rack, uint32_t th_ack, uint { uint32_t prior_cwnd, acked; struct tcp_log_buffer *lgb = NULL; - uint8_t labc_to_use; + uint8_t labc_to_use, quality; INP_WLOCK_ASSERT(tp->t_inpcb); tp->ccv->nsegs = nsegs; @@ -4649,10 +4672,11 @@ rack_ack_received(struct tcpcb *tp, struct tcp_rack *rack, uint32_t th_ack, uint stats_voi_update_abs_s32(tp->t_stats, VOI_TCP_CALCFRWINDIFF, ((int32_t)rack->r_ctl.cwnd_to_use) - tp->snd_wnd); #endif + quality = RACK_QUALITY_NONE; if ((tp->t_flags & TF_GPUTINPROG) && - rack_enough_for_measurement(tp, rack, th_ack)) { + rack_enough_for_measurement(tp, rack, th_ack, &quality)) { /* Measure the Goodput */ - rack_do_goodput_measurement(tp, rack, th_ack, __LINE__); + rack_do_goodput_measurement(tp, rack, th_ack, __LINE__, quality); #ifdef NETFLIX_PEAKRATE if ((type == CC_ACK) && (tp->t_maxpeakrate)) { @@ -5511,7 +5535,8 @@ rack_enter_persist(struct tcpcb *tp, struct tcp_rack *rack, uint32_t cts) * Stop the goodput now, the calling of the * measurement function clears the flag. */ - rack_do_goodput_measurement(tp, rack, tp->snd_una, __LINE__); + rack_do_goodput_measurement(tp, rack, tp->snd_una, __LINE__, + RACK_QUALITY_PERSIST); } #ifdef NETFLIX_SHARED_CWND if (rack->r_ctl.rc_scw) { @@ -5678,7 +5703,7 @@ rack_start_hpts_timer(struct tcp_rack *rack, struct tcpcb *tp, uint32_t cts, rack->r_ctl.rc_hpts_flags = 0; us_cts = tcp_get_usecs(&tv); /* Now early/late accounting */ - rack_log_pacing_delay_calc(rack, entry_slot, slot, 0, 0, 0, 26, __LINE__, NULL); + rack_log_pacing_delay_calc(rack, entry_slot, slot, 0, 0, 0, 26, __LINE__, NULL, 0); if (rack->r_early && (rack->rc_ack_can_sendout_data == 0)) { /* * We have a early carry over set, @@ -5820,7 +5845,7 @@ rack_start_hpts_timer(struct tcp_rack *rack, struct tcpcb *tp, uint32_t cts, hpts_timeout = 0x7ffffffe; rack->r_ctl.rc_timer_exp = cts + hpts_timeout; } - rack_log_pacing_delay_calc(rack, entry_slot, slot, hpts_timeout, 0, 0, 27, __LINE__, NULL); + rack_log_pacing_delay_calc(rack, entry_slot, slot, hpts_timeout, 0, 0, 27, __LINE__, NULL, 0); if ((rack->gp_ready == 0) && (rack->use_fixed_rate == 0) && (hpts_timeout < slot) && @@ -6152,7 +6177,7 @@ rack_merge_rsm(struct tcp_rack *rack, * when all timers have been stopped (destroyed PCB?). */ static int -rack_timeout_tlp(struct tcpcb *tp, struct tcp_rack *rack, uint32_t cts) +rack_timeout_tlp(struct tcpcb *tp, struct tcp_rack *rack, uint32_t cts, uint8_t *doing_tlp) { /* * Tail Loss Probe. @@ -6194,6 +6219,22 @@ rack_timeout_tlp(struct tcpcb *tp, struct tcp_rack *rack, uint32_t cts) collapsed_win = 1; goto need_retran; } + if ((tp->t_flags & TF_GPUTINPROG) && + (rack->r_ctl.rc_tlp_cnt_out == 1)) { + /* + * If this is the second in a row + * TLP and we are doing a measurement + * its time to abandon the measurement. + * Something is likely broken on + * the clients network and measuring a + * broken network does us no good. + */ + tp->t_flags &= ~TF_GPUTINPROG; + rack_log_pacing_delay_calc(rack, (tp->gput_ack - tp->gput_seq) /*flex2*/, + rack->r_ctl.rc_gp_srtt /*flex1*/, + tp->gput_seq, + 0, 0, 18, __LINE__, NULL, 0); + } /* * Check our send oldest always settings, and if * there is an oldest to send jump to the need_retran. @@ -6219,6 +6260,7 @@ rack_timeout_tlp(struct tcpcb *tp, struct tcp_rack *rack, uint32_t cts) if (rack->rack_no_prr == 0) { if (out + amm <= tp->snd_wnd) { rack->r_ctl.rc_prr_sndcnt = amm; + rack->r_ctl.rc_tlp_new_data = amm; rack_log_to_prr(rack, 4, 0); } } else @@ -6312,6 +6354,8 @@ need_retran: } rack->r_ctl.rc_tlpsend = rsm; send: + /* Make sure output path knows we are doing a TLP */ + *doing_tlp = 1; rack->r_timer_override = 1; rack->r_ctl.rc_hpts_flags &= ~PACE_TMR_TLP; return (0); @@ -6675,6 +6719,20 @@ rack_timeout_rxt(struct tcpcb *tp, struct tcp_rack *rack, uint32_t cts) if (tp->t_timers->tt_flags & TT_STOPPED) { return (1); } + if ((tp->t_flags & TF_GPUTINPROG) && + (tp->t_rxtshift)) { + /* + * We have had a second timeout + * measurements on successive rxt's are not profitable. + * It is unlikely to be of any use (the network is + * broken or the client went away). + */ + tp->t_flags &= ~TF_GPUTINPROG; + rack_log_pacing_delay_calc(rack, (tp->gput_ack - tp->gput_seq) /*flex2*/, + rack->r_ctl.rc_gp_srtt /*flex1*/, + tp->gput_seq, + 0, 0, 18, __LINE__, NULL, 0); + } if (ctf_progress_timeout_check(tp, false)) { tcp_log_end_status(tp, TCP_EI_STATUS_RETRAN); rack_log_progress_event(rack, tp, tick, PROGRESS_DROP, __LINE__); @@ -6912,11 +6970,37 @@ out: } static int -rack_process_timers(struct tcpcb *tp, struct tcp_rack *rack, uint32_t cts, uint8_t hpts_calling) +rack_process_timers(struct tcpcb *tp, struct tcp_rack *rack, uint32_t cts, uint8_t hpts_calling, uint8_t *doing_tlp) { int32_t ret = 0; int32_t timers = (rack->r_ctl.rc_hpts_flags & PACE_TMR_MASK); + if ((tp->t_state >= TCPS_FIN_WAIT_1) && + (tp->t_flags & TF_GPUTINPROG)) { + /* + * We have a goodput in progress + * and we have entered a late state. + * Do we have enough data in the sb + * to handle the GPUT request? + */ + uint32_t bytes; + + bytes = tp->gput_ack - tp->gput_seq; + if (SEQ_GT(tp->gput_seq, tp->snd_una)) + bytes += tp->gput_seq - tp->snd_una; + if (bytes > sbavail(&tp->t_inpcb->inp_socket->so_snd)) { + /* + * There are not enough bytes in the socket + * buffer that have been sent to cover this + * measurement. Cancel it. + */ + rack_log_pacing_delay_calc(rack, (tp->gput_ack - tp->gput_seq) /*flex2*/, + rack->r_ctl.rc_gp_srtt /*flex1*/, + tp->gput_seq, + 0, 0, 18, __LINE__, NULL, 0); + tp->t_flags &= ~TF_GPUTINPROG; + } + } if (timers == 0) { return (0); } @@ -6980,7 +7064,7 @@ skip_time_check: ret = rack_timeout_rack(tp, rack, cts); } else if (timers & PACE_TMR_TLP) { rack->r_ctl.rc_tlp_rxt_last_time = cts; - ret = rack_timeout_tlp(tp, rack, cts); + ret = rack_timeout_tlp(tp, rack, cts, doing_tlp); } else if (timers & PACE_TMR_RXT) { rack->r_ctl.rc_tlp_rxt_last_time = cts; rack->r_fast_output = 0; @@ -8106,7 +8190,7 @@ rack_need_set_test(struct tcpcb *tp, (SEQ_GEQ(tp->gput_seq, rack->r_ctl.rc_probertt_sndmax_atexit))) rack->measure_saw_probe_rtt = 0; rack_log_pacing_delay_calc(rack, ts, tp->gput_ts, - seq, tp->gput_seq, 0, 5, line, NULL); + seq, tp->gput_seq, 0, 5, line, NULL, 0); if (rack->rc_gp_filled && ((tp->gput_ack - tp->gput_seq) < max(rc_init_window(rack), (MIN_GP_WIN * @@ -8123,7 +8207,7 @@ rack_need_set_test(struct tcpcb *tp, */ tp->t_flags &= ~TF_GPUTINPROG; rack_log_pacing_delay_calc(rack, tp->gput_ack, tp->gput_seq, - 0, 0, 0, 6, __LINE__, NULL); + 0, 0, 0, 6, __LINE__, NULL, 0); } else { /* * Reset the window further out. @@ -12861,6 +12945,32 @@ rack_do_compressed_ack_processing(struct tcpcb *tp, struct socket *so, struct mb if (rack->r_state != tp->t_state) rack_set_state(tp, rack); + if ((tp->t_state >= TCPS_FIN_WAIT_1) && + (tp->t_flags & TF_GPUTINPROG)) { + /* + * We have a goodput in progress + * and we have entered a late state. + * Do we have enough data in the sb + * to handle the GPUT request? + */ + uint32_t bytes; + + bytes = tp->gput_ack - tp->gput_seq; + if (SEQ_GT(tp->gput_seq, tp->snd_una)) + bytes += tp->gput_seq - tp->snd_una; + if (bytes > sbavail(&tp->t_inpcb->inp_socket->so_snd)) { + /* + * There are not enough bytes in the socket + * buffer that have been sent to cover this + * measurement. Cancel it. + */ + rack_log_pacing_delay_calc(rack, (tp->gput_ack - tp->gput_seq) /*flex2*/, + rack->r_ctl.rc_gp_srtt /*flex1*/, + tp->gput_seq, + 0, 0, 18, __LINE__, NULL, 0); + tp->t_flags &= ~TF_GPUTINPROG; + } + } to = &to_holder; to->to_flags = 0; KASSERT((m->m_len >= sizeof(struct tcp_ackent)), @@ -13465,6 +13575,8 @@ rack_do_segment_nounlock(struct mbuf *m, struct tcphdr *th, struct socket *so, * tv passed from common code is from either M_TSTMP_LRO or * tcp_get_usecs() if no LRO m_pkthdr timestamp is present. */ + rack = (struct tcp_rack *)tp->t_fb_ptr; + cts = tcp_tv_to_usectick(tv); if (m->m_flags & M_ACKCMP) { return (rack_do_compressed_ack_processing(tp, so, m, nxt_pkt, tv)); } @@ -13479,9 +13591,6 @@ rack_do_segment_nounlock(struct mbuf *m, struct tcphdr *th, struct socket *so, if (thflags & TH_ACK) ts_val = get_cyclecount(); #endif - cts = tcp_tv_to_usectick(tv); - rack = (struct tcp_rack *)tp->t_fb_ptr; - if ((m->m_flags & M_TSTMP) || (m->m_flags & M_TSTMP_LRO)) { mbuf_tstmp2timespec(m, &ts); @@ -13532,6 +13641,32 @@ rack_do_segment_nounlock(struct mbuf *m, struct tcphdr *th, struct socket *so, __func__)); KASSERT(tp->t_state != TCPS_TIME_WAIT, ("%s: TCPS_TIME_WAIT", __func__)); + if ((tp->t_state >= TCPS_FIN_WAIT_1) && + (tp->t_flags & TF_GPUTINPROG)) { + /* + * We have a goodput in progress + * and we have entered a late state. + * Do we have enough data in the sb + * to handle the GPUT request? + */ + uint32_t bytes; + + bytes = tp->gput_ack - tp->gput_seq; + if (SEQ_GT(tp->gput_seq, tp->snd_una)) + bytes += tp->gput_seq - tp->snd_una; + if (bytes > sbavail(&tp->t_inpcb->inp_socket->so_snd)) { + /* + * There are not enough bytes in the socket + * buffer that have been sent to cover this + * measurement. Cancel it. + */ + rack_log_pacing_delay_calc(rack, (tp->gput_ack - tp->gput_seq) /*flex2*/, + rack->r_ctl.rc_gp_srtt /*flex1*/, + tp->gput_seq, + 0, 0, 18, __LINE__, NULL, 0); + tp->t_flags &= ~TF_GPUTINPROG; + } + } if (tp->t_logstate != TCP_LOG_STATE_OFF) { union tcp_log_stackspecific log; struct timeval ltv; @@ -13813,6 +13948,7 @@ rack_do_segment_nounlock(struct mbuf *m, struct tcphdr *th, struct socket *so, /* Check in on probertt */ rack_check_probe_rtt(rack, us_cts); } + rack_clear_rate_sample(rack); if (rack->forced_ack) { uint32_t us_rtt; @@ -13828,8 +13964,8 @@ rack_do_segment_nounlock(struct mbuf *m, struct tcphdr *th, struct socket *so, us_rtt = us_cts - rack->r_ctl.forced_ack_ts; if (us_rtt == 0) us_rtt = 1; - rack_log_rtt_upd(tp, rack, us_rtt, 0, NULL, 3); rack_apply_updated_usrtt(rack, us_rtt, us_cts); + tcp_rack_xmit_timer(rack, us_rtt, 0, us_rtt, 3, NULL, 1); } /* * This is the one exception case where we set the rack state @@ -13843,7 +13979,6 @@ rack_do_segment_nounlock(struct mbuf *m, struct tcphdr *th, struct socket *so, (rsm = RB_MIN(rack_rb_tree_head, &rack->r_ctl.rc_mtree)) != NULL) kern_prefetch(rsm, &prev_state); prev_state = rack->r_state; - rack_clear_rate_sample(rack); retval = (*rack->r_substate) (m, th, so, tp, &to, drop_hdrlen, tlen, tiwin, thflags, nxt_pkt, iptos); @@ -14088,7 +14223,7 @@ check_it: static void rack_log_pacing_delay_calc(struct tcp_rack *rack, uint32_t len, uint32_t slot, uint64_t bw_est, uint64_t bw, uint64_t len_time, int method, - int line, struct rack_sendmap *rsm) + int line, struct rack_sendmap *rsm, uint8_t quality) { if (rack->rc_tp->t_logstate != TCP_LOG_STATE_OFF) { union tcp_log_stackspecific log; @@ -14145,6 +14280,7 @@ rack_log_pacing_delay_calc(struct tcp_rack *rack, uint32_t len, uint32_t slot, log.u_bbr.cwnd_gain |= rack->rc_gp_saw_ss; log.u_bbr.cwnd_gain <<= 1; log.u_bbr.cwnd_gain |= rack->rc_gp_saw_ca; + log.u_bbr.bbr_substate = quality; TCP_LOG_EVENTP(rack->rc_tp, NULL, &rack->rc_inp->inp_socket->so_rcv, &rack->rc_inp->inp_socket->so_snd, @@ -14269,7 +14405,7 @@ pace_to_fill_cwnd(struct tcp_rack *rack, int32_t slot, uint32_t len, uint32_t se *rate_wanted = fill_bw; if (non_paced || (lentim < slot)) { rack_log_pacing_delay_calc(rack, len, slot, fill_bw, - 0, lentim, 12, __LINE__, NULL); + 0, lentim, 12, __LINE__, NULL, 0); return ((int32_t)lentim); } else return (slot); @@ -14278,7 +14414,6 @@ pace_to_fill_cwnd(struct tcp_rack *rack, int32_t slot, uint32_t len, uint32_t se static int32_t rack_get_pacing_delay(struct tcp_rack *rack, struct tcpcb *tp, uint32_t len, struct rack_sendmap *rsm, uint32_t segsiz) { - struct rack_sendmap *lrsm; int32_t slot = 0; int can_start_hw_pacing = 1; int err; @@ -14331,29 +14466,14 @@ rack_get_pacing_delay(struct tcp_rack *rack, struct tcpcb *tp, uint32_t len, str slot = 0; } slot *= HPTS_USEC_IN_MSEC; - if (rsm == NULL) { - /* - * We always consider ourselves app limited with old style - * that are not retransmits. This could be the initial - * measurement, but thats ok its all setup and specially - * handled. If another send leaks out, then that too will - * be mark app-limited. - */ - lrsm = RB_MAX(rack_rb_tree_head, &rack->r_ctl.rc_mtree); - if (lrsm && ((lrsm->r_flags & RACK_APP_LIMITED) == 0)) { - rack->r_ctl.rc_first_appl = lrsm; - lrsm->r_flags |= RACK_APP_LIMITED; - rack->r_ctl.rc_app_limited_cnt++; - } - } if (rack->rc_pace_to_cwnd) { uint64_t rate_wanted = 0; slot = pace_to_fill_cwnd(rack, slot, len, segsiz, NULL, &rate_wanted, 1); rack->rc_ack_can_sendout_data = 1; - rack_log_pacing_delay_calc(rack, len, slot, rate_wanted, 0, 0, 14, __LINE__, NULL); + rack_log_pacing_delay_calc(rack, len, slot, rate_wanted, 0, 0, 14, __LINE__, NULL, 0); } else - rack_log_pacing_delay_calc(rack, len, slot, tr_perms, reduce, 0, 7, __LINE__, NULL); + rack_log_pacing_delay_calc(rack, len, slot, tr_perms, reduce, 0, 7, __LINE__, NULL, 0); } else { uint64_t bw_est, res, lentim, rate_wanted; uint32_t orig_val, srtt, segs, oh; @@ -14428,7 +14548,7 @@ rack_get_pacing_delay(struct tcp_rack *rack, struct tcpcb *tp, uint32_t len, str } /* Did we change the TSO size, if so log it */ if (rack->r_ctl.rc_pace_max_segs != orig_val) - rack_log_pacing_delay_calc(rack, len, slot, orig_val, 0, 0, 15, __LINE__, NULL); + rack_log_pacing_delay_calc(rack, len, slot, orig_val, 0, 0, 15, __LINE__, NULL, 0); prev_fill = rack->r_via_fill_cw; if ((rack->rc_pace_to_cwnd) && (capped == 0) && @@ -14582,11 +14702,11 @@ done_w_hdwr: else srtt = RACK_INITIAL_RTO * HPTS_USEC_IN_MSEC; /* its in ms convert */ if (srtt < slot) { - rack_log_pacing_delay_calc(rack, srtt, slot, rate_wanted, bw_est, lentim, 99, __LINE__, NULL); + rack_log_pacing_delay_calc(rack, srtt, slot, rate_wanted, bw_est, lentim, 99, __LINE__, NULL, 0); slot = srtt; } } - rack_log_pacing_delay_calc(rack, len, slot, rate_wanted, bw_est, lentim, 2, __LINE__, rsm); + rack_log_pacing_delay_calc(rack, len, slot, rate_wanted, bw_est, lentim, 2, __LINE__, rsm, 0); } if (rack->r_ctl.crte && (rack->r_ctl.crte->rs_num_enobufs > 0)) { /* @@ -14626,6 +14746,20 @@ rack_start_gp_measurement(struct tcpcb *tp, struct tcp_rack *rack, */ return; } + if (tp->t_state >= TCPS_FIN_WAIT_1) { + /* + * We will get no more data into the SB + * this means we need to have the data available + * before we start a measurement. + */ + + if (sbavail(&tp->t_inpcb->inp_socket->so_snd) < + max(rc_init_window(rack), + (MIN_GP_WIN * ctf_fixed_maxseg(tp)))) { + /* Nope not enough data */ + return; + } + } tp->t_flags |= TF_GPUTINPROG; rack->r_ctl.rc_gp_lowrtt = 0xffffffff; rack->r_ctl.rc_gp_high_rwnd = rack->rc_tp->snd_wnd; @@ -14664,7 +14798,7 @@ rack_start_gp_measurement(struct tcpcb *tp, struct tcp_rack *rack, tp->gput_ts, rack->r_ctl.rc_app_limited_cnt, 9, - __LINE__, NULL); + __LINE__, NULL, 0); return; } if (sb_offset) { @@ -14672,7 +14806,6 @@ rack_start_gp_measurement(struct tcpcb *tp, struct tcp_rack *rack, * We are out somewhere in the sb * can we use the already outstanding data? */ - if (rack->r_ctl.rc_app_limited_cnt == 0) { /* * Yes first one is good and in this case @@ -14748,7 +14881,7 @@ start_set: tp->gput_ts, rack->r_ctl.rc_app_limited_cnt, 9, - __LINE__, NULL); + __LINE__, NULL, 0); return; } @@ -14796,7 +14929,7 @@ use_latest: (uint64_t)my_rsm, tp->gput_ts, rack->r_ctl.rc_app_limited_cnt, - 9, __LINE__, NULL); + 9, __LINE__, NULL, 0); } static inline uint32_t @@ -15069,7 +15202,7 @@ rack_fo_m_copym(struct tcp_rack *rack, int32_t *plen, static int rack_fast_rsm_output(struct tcpcb *tp, struct tcp_rack *rack, struct rack_sendmap *rsm, - uint64_t ts_val, uint32_t cts, uint32_t ms_cts, struct timeval *tv, int len) + uint64_t ts_val, uint32_t cts, uint32_t ms_cts, struct timeval *tv, int len, uint8_t doing_tlp) { /* * Enter the fast retransmit path. We are given that a sched_pin is @@ -15090,7 +15223,6 @@ rack_fast_rsm_output(struct tcpcb *tp, struct tcp_rack *rack, struct rack_sendma uint64_t crtsc; int cnt_thru = 1; #endif - int doing_tlp = 0; struct tcpopt to; u_char opt[TCP_MAXOLEN]; uint32_t hdrlen, optlen; @@ -15116,6 +15248,8 @@ rack_fast_rsm_output(struct tcpcb *tp, struct tcp_rack *rack, struct rack_sendma } if (rsm->r_flags & RACK_TLP) doing_tlp = 1; + else if (doing_tlp) + rsm->r_flags |= RACK_TLP; startseq = rsm->r_start; segsiz = min(ctf_fixed_maxseg(tp), rack->r_ctl.rc_pace_min_segs); inp = rack->rc_inp; @@ -15371,7 +15505,10 @@ rack_fast_rsm_output(struct tcpcb *tp, struct tcp_rack *rack, struct rack_sendma log.u_bbr.flex6 = rack->r_ctl.rc_agg_early; log.u_bbr.applimited = rack->r_ctl.rc_agg_delayed; log.u_bbr.bw_inuse = rack_get_bw(rack); - log.u_bbr.flex8 = 1; + if (doing_tlp == 0) + log.u_bbr.flex8 = 1; + else + log.u_bbr.flex8 = 2; log.u_bbr.pacing_gain = rack_get_output_gain(rack, NULL); log.u_bbr.flex7 = 55; log.u_bbr.pkts_out = tp->t_maxseg; @@ -16010,6 +16147,7 @@ rack_output(struct tcpcb *tp) int32_t sup_rack = 0; uint32_t cts, ms_cts, delayed, early; uint16_t add_flag = RACK_SENT_SP; + /* The doing_tlp flag will be set by the actual rack_timeout_tlp() */ uint8_t hpts_calling, doing_tlp = 0; uint32_t cwnd_to_use, pace_max_seg; int32_t do_a_prefetch = 0; @@ -16090,7 +16228,7 @@ rack_output(struct tcpcb *tp) } /* Do the timers, which may override the pacer */ if (rack->r_ctl.rc_hpts_flags & PACE_TMR_MASK) { - if (rack_process_timers(tp, rack, cts, hpts_calling)) { + if (rack_process_timers(tp, rack, cts, hpts_calling, &doing_tlp)) { counter_u64_add(rack_out_size[TCP_MSS_ACCT_ATIMER], 1); #ifdef TCP_ACCOUNTING sched_unpin(); @@ -16158,6 +16296,7 @@ rack_output(struct tcpcb *tp) rack_set_state(tp, rack); } if ((rack->r_fast_output) && + (doing_tlp == 0) && (tp->rcv_numsacks == 0)) { int ret; @@ -16323,7 +16462,6 @@ again: long cwin; long tlen; - doing_tlp = 1; /* * Check if we can do a TLP with a RACK'd packet * this can happen if we are not doing the rack @@ -16422,7 +16560,7 @@ again: ((rsm->r_flags & RACK_HAS_FIN) == 0)) { int ret; - ret = rack_fast_rsm_output(tp, rack, rsm, ts_val, cts, ms_cts, &tv, len); + ret = rack_fast_rsm_output(tp, rack, rsm, ts_val, cts, ms_cts, &tv, len, doing_tlp); if (ret == 0) return (0); } @@ -16516,8 +16654,6 @@ again: } else { len = rack->r_ctl.rc_tlp_new_data; } - rack->r_ctl.rc_tlp_new_data = 0; - doing_tlp = 1; } else { len = rack_what_can_we_send(tp, rack, cwnd_to_use, avail, sb_offset); } @@ -17167,12 +17303,23 @@ just_return_nolock: if (end_window) { uint8_t log = 0; + /* Adjust the Gput measurement */ if ((tp->t_flags & TF_GPUTINPROG) && SEQ_GT(tp->gput_ack, tp->snd_max)) { - /* Mark the last packet has app limited */ tp->gput_ack = tp->snd_max; - log = 1; + if ((tp->gput_ack - tp->gput_seq) < (MIN_GP_WIN * segsiz)) { + /* + * There is not enough to measure. + */ + tp->t_flags &= ~TF_GPUTINPROG; + rack_log_pacing_delay_calc(rack, (tp->gput_ack - tp->gput_seq) /*flex2*/, + rack->r_ctl.rc_gp_srtt /*flex1*/, + tp->gput_seq, + 0, 0, 18, __LINE__, NULL, 0); + } else + log = 1; } + /* Mark the last packet has app limited */ rsm = RB_MAX(rack_rb_tree_head, &rack->r_ctl.rc_mtree); if (rsm && ((rsm->r_flags & RACK_APP_LIMITED) == 0)) { if (rack->r_ctl.rc_app_limited_cnt == 0) @@ -17193,7 +17340,7 @@ just_return_nolock: if (log) rack_log_pacing_delay_calc(rack, rack->r_ctl.rc_app_limited_cnt, seq, - tp->gput_ack, 0, 0, 4, __LINE__, NULL); + tp->gput_ack, 0, 0, 4, __LINE__, NULL, 0); } } if (slot) { @@ -18141,6 +18288,10 @@ out: rack->rc_gp_saw_ss = 1; } } + if (doing_tlp && (rsm == NULL)) { + /* Make sure new data TLP cnt is clear */ + rack->r_ctl.rc_tlp_new_data = 0; + } if (TCPS_HAVEESTABLISHED(tp->t_state) && (tp->t_flags & TF_SACK_PERMIT) && tp->rcv_numsacks > 0) @@ -18624,7 +18775,7 @@ rack_update_seg(struct tcp_rack *rack) orig_val = rack->r_ctl.rc_pace_max_segs; rack_set_pace_segments(rack->rc_tp, rack, __LINE__, NULL); if (orig_val != rack->r_ctl.rc_pace_max_segs) - rack_log_pacing_delay_calc(rack, 0, 0, orig_val, 0, 0, 15, __LINE__, NULL); + rack_log_pacing_delay_calc(rack, 0, 0, orig_val, 0, 0, 15, __LINE__, NULL, 0); } static void @@ -19242,7 +19393,7 @@ rack_process_option(struct tcpcb *tp, struct tcp_rack *rack, int sopt_name, rack->r_ctl.rc_fixed_pacing_rate_ss, rack->r_ctl.rc_fixed_pacing_rate_ca, rack->r_ctl.rc_fixed_pacing_rate_rec, 0, 0, 8, - __LINE__, NULL); + __LINE__, NULL,0); break; case TCP_RACK_PACE_RATE_SS: @@ -19260,7 +19411,7 @@ rack_process_option(struct tcpcb *tp, struct tcp_rack *rack, int sopt_name, rack->r_ctl.rc_fixed_pacing_rate_ss, rack->r_ctl.rc_fixed_pacing_rate_ca, rack->r_ctl.rc_fixed_pacing_rate_rec, 0, 0, 8, - __LINE__, NULL); + __LINE__, NULL, 0); break; case TCP_RACK_PACE_RATE_CA: @@ -19278,7 +19429,7 @@ rack_process_option(struct tcpcb *tp, struct tcp_rack *rack, int sopt_name, rack->r_ctl.rc_fixed_pacing_rate_ss, rack->r_ctl.rc_fixed_pacing_rate_ca, rack->r_ctl.rc_fixed_pacing_rate_rec, 0, 0, 8, - __LINE__, NULL); + __LINE__, NULL, 0); break; case TCP_RACK_GP_INCREASE_REC: RACK_OPTS_INC(tcp_gp_inc_rec); @@ -19287,7 +19438,7 @@ rack_process_option(struct tcpcb *tp, struct tcp_rack *rack, int sopt_name, rack->r_ctl.rack_per_of_gp_ss, rack->r_ctl.rack_per_of_gp_ca, rack->r_ctl.rack_per_of_gp_rec, 0, 0, 1, - __LINE__, NULL); + __LINE__, NULL, 0); break; case TCP_RACK_GP_INCREASE_CA: RACK_OPTS_INC(tcp_gp_inc_ca); @@ -19305,7 +19456,7 @@ rack_process_option(struct tcpcb *tp, struct tcp_rack *rack, int sopt_name, rack->r_ctl.rack_per_of_gp_ss, rack->r_ctl.rack_per_of_gp_ca, rack->r_ctl.rack_per_of_gp_rec, 0, 0, 1, - __LINE__, NULL); + __LINE__, NULL, 0); break; case TCP_RACK_GP_INCREASE_SS: RACK_OPTS_INC(tcp_gp_inc_ss); @@ -19323,7 +19474,7 @@ rack_process_option(struct tcpcb *tp, struct tcp_rack *rack, int sopt_name, rack->r_ctl.rack_per_of_gp_ss, rack->r_ctl.rack_per_of_gp_ca, rack->r_ctl.rack_per_of_gp_rec, 0, 0, 1, - __LINE__, NULL); + __LINE__, NULL, 0); break; case TCP_RACK_RR_CONF: RACK_OPTS_INC(tcp_rack_rrr_no_conf_rate); @@ -19555,8 +19706,8 @@ rack_set_sockopt(struct socket *so, struct sockopt *sopt, case TCP_RACK_GP_INCREASE_REC: /* URL:gp_inc_rec */ case TCP_RACK_RR_CONF: /* URL:rrr_conf */ case TCP_BBR_HDWR_PACE: /* URL:hdwrpace */ - case TCP_HDWR_RATE_CAP: /* URL: hdwrcap boolean */ - case TCP_PACING_RATE_CAP: /* URL:cap-- used by side-channel */ + case TCP_HDWR_RATE_CAP: /* URL:hdwrcap boolean */ + case TCP_PACING_RATE_CAP: /* URL:cap -- used by side-channel */ case TCP_HDWR_UP_ONLY: /* URL:uponly -- hardware pacing boolean */ /* End pacing related */ case TCP_FAST_RSM_HACK: /* URL:frsm_hack */ diff --git a/sys/netinet/tcp_stacks/tcp_rack.h b/sys/netinet/tcp_stacks/tcp_rack.h index 54582d4fd9c5..55ebb07549d0 100644 --- a/sys/netinet/tcp_stacks/tcp_rack.h +++ b/sys/netinet/tcp_stacks/tcp_rack.h @@ -268,6 +268,15 @@ struct rack_opts_stats { #define TLP_USE_TWO_TWO 3 /* Use 2.2 behavior */ #define RACK_MIN_BW 8000 /* 64kbps in Bps */ +/* Rack quality indicators for GPUT measurements */ +#define RACK_QUALITY_NONE 0 /* No quality stated */ +#define RACK_QUALITY_HIGH 1 /* A normal measurement of a GP RTT */ +#define RACK_QUALITY_APPLIMITED 2 /* An app limited case that may be of lower quality */ +#define RACK_QUALITY_PERSIST 3 /* A measurement where we went into persists */ +#define RACK_QUALITY_PROBERTT 4 /* A measurement where we went into or exited probe RTT */ +#define RACK_QUALITY_ALLACKED 5 /* All data is now acknowledged */ + + #define MIN_GP_WIN 6 /* We need at least 6 MSS in a GP measurement */ #ifdef _KERNEL #define RACK_OPTS_SIZE (sizeof(struct rack_opts_stats)/sizeof(uint64_t)) @@ -318,6 +327,7 @@ extern counter_u64_t rack_opts_arry[RACK_OPTS_SIZE]; #define RACK_GP_HIST 4 /* How much goodput history do we maintain? */ #define RACK_NUM_FSB_DEBUG 16 +#ifdef _KERNEL struct rack_fast_send_blk { uint32_t left_to_send; uint16_t tcp_ip_hdr_len; @@ -501,6 +511,7 @@ struct rack_control { uint8_t rc_rate_sample_method; uint8_t rc_gp_hist_idx; }; +#endif #define RACK_TIMELY_CNT_BOOST 5 /* At 5th increase boost */ #define RACK_MINRTT_FILTER_TIM 10 /* Seconds */ From owner-dev-commits-src-main@freebsd.org Tue Jul 6 21:42:53 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 578D7648CEF; Tue, 6 Jul 2021 21:42:53 +0000 (UTC) (envelope-from fernando.apesteguia@gmail.com) Received: from mail-oi1-f179.google.com (mail-oi1-f179.google.com [209.85.167.179]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GKGHx1pctz3JK0; Tue, 6 Jul 2021 21:42:53 +0000 (UTC) (envelope-from fernando.apesteguia@gmail.com) Received: by mail-oi1-f179.google.com with SMTP id h9so975375oih.4; Tue, 06 Jul 2021 14:42:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=Sn9hrf7Xd1oxpLCYfT20DzRJi1jK+ITgAaBlaIrsdbE=; b=kkQlSp7L5+3o3S4KgGZA6t3ojTER9085H6MQs4sC2dpIO3TJI6jfZNI1oPoCJfjsCK 51Bg6D4v4LNtaO64bNBC4EKaQGT6gW4IvmdmF4t8krUBklamz6JkH3c0NvLptG49gEzc eOR1RvP0qGuju1QGFXutB/oGDI/Lz+7PAqBC2dG404rPuE5v+KNjhDA9Ier6F6knm0mO 4Mrc3MStSG3d77aLLESJfM61ZFrjh/nDlYQnaYodmpOVyQqZHR3R/YxfteQLDLeU5+Er DtGdpmMBVDPXmv9xM+Jiigw6+BGQtgJl0/xWazOYHOmPOQJUCditqLAon4VSvbd1Wx+J wsYA== X-Gm-Message-State: AOAM5307XdJGRDqx1YJcrjKIHsrrQKHBwH1xeYQxpvispQ74VA62IP0A VXh9Yhi5opIzXOb7fdMirERSLq/csAX3wQ== X-Google-Smtp-Source: ABdhPJzL3xYPqv0it/9+8OHFAg5n+nYNuZGjYRoKe/5/QKnkpahwDHPapn7T9TQd+wMyzv9bGz+ANw== X-Received: by 2002:aca:dc44:: with SMTP id t65mr16148666oig.76.1625607771526; Tue, 06 Jul 2021 14:42:51 -0700 (PDT) Received: from mail-ot1-f53.google.com (mail-ot1-f53.google.com. [209.85.210.53]) by smtp.gmail.com with ESMTPSA id o26sm3664302oic.12.2021.07.06.14.42.51 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 06 Jul 2021 14:42:51 -0700 (PDT) Received: by mail-ot1-f53.google.com with SMTP id d27-20020a05683018fbb02904ae64d1b56bso221628otf.9; Tue, 06 Jul 2021 14:42:51 -0700 (PDT) X-Received: by 2002:a25:bb08:: with SMTP id z8mr28378392ybg.188.1625607411652; Tue, 06 Jul 2021 14:36:51 -0700 (PDT) MIME-Version: 1.0 References: <202106300806.15U86pGq037942@gitrepo.freebsd.org> <20210706090311.aomxh4n45tkpktdc@aniel.nours.eu> In-Reply-To: <20210706090311.aomxh4n45tkpktdc@aniel.nours.eu> From: =?UTF-8?Q?Fernando_Apestegu=C3=ADa?= Date: Tue, 6 Jul 2021 21:34:40 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: 0a0f7486413c - main - man: Build manpages for all architectures To: Baptiste Daroussin Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 4GKGHx1pctz3JK0 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 21:42:53 -0000 On Tue, Jul 6, 2021 at 11:03 AM Baptiste Daroussin wrote= : > > On Wed, Jun 30, 2021 at 08:06:51AM +0000, Fernando Apestegu=C3=ADa wrote: > > The branch main has been updated by fernape (doc, ports committer): > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=3D0a0f7486413c147d56808b38= 055c40c64cff61f5 > > > > commit 0a0f7486413c147d56808b38055c40c64cff61f5 > > Author: Fernando Apestegu=C3=ADa > > AuthorDate: 2021-06-09 10:58:04 +0000 > > Commit: Fernando Apestegu=C3=ADa > > CommitDate: 2021-06-30 07:57:51 +0000 > > > > man: Build manpages for all architectures > > > > Building and installing architecture-specific man pages only raises= a number of > > problems: > > > > * The https://www.freebsd.org/cgi/man.cgi is incomplete. As an > > example, it does not show results for pae(4). The reason for thi= s is > > that the cgi interface runs on FreeBSD amd64. > > > > * In FreeBSD amd64 some manual pages have broken X-refs. See hptrr= (4) > > for an example. > > > > * Also, we have broken links in our Release Notes. This is a > > consequence of the first point. See > > https://www.freebsd.org/releases/13.0R/hardware/#proc-i386. > > > > Make MAN_ARCH default to 'all' so we build all the man pages for al= l the > > architectures. The difference in disk space is negligible. Also lin= k > > architecture-specific man pages to their own section while keeping = their own > > namespace. > > > > PR: 212290 > > Reported by: mj@bsdops.com > > Approved by: ceri@, wosch@ > > MFC after: 4 weeks > > --- > > sbin/Makefile | 6 ++++++ > > share/man/man4/Makefile | 4 +--- > > share/man/man4/man4.aarch64/Makefile | 5 +++++ > > share/man/man4/man4.arm/Makefile | 5 +++++ > > share/man/man4/man4.i386/Makefile | 5 +++++ > > share/man/man4/man4.powerpc/Makefile | 5 +++++ > > share/man/man5/make.conf.5 | 2 +- > > usr.sbin/Makefile | 7 +++++++ > > usr.sbin/apm/Makefile | 4 ++++ > > 9 files changed, 39 insertions(+), 4 deletions(-) > > > > diff --git a/sbin/Makefile b/sbin/Makefile > > index 64840bae82bb..f53e2f037ebe 100644 > > --- a/sbin/Makefile > > +++ b/sbin/Makefile > > @@ -90,6 +90,12 @@ SUBDIR.${MK_ZFS}+=3D zfsbootcfg > > > > SUBDIR.${MK_TESTS}+=3D tests > > > > +# Add architecture-specific manpages > > +# to be included anyway > > +MAN=3D sconfig/sconfig.8 > > + > > +.include > > + > > .include > > > > SUBDIR_PARALLEL=3D > > diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile > > index 5051470edc71..9027fe7df841 100644 > > --- a/share/man/man4/Makefile > > +++ b/share/man/man4/Makefile > > @@ -895,9 +895,7 @@ _cgem.4=3D cgem.4 > > MLINKS+=3Dcgem.4 if_cgem.4 > > .endif > > > > -.if empty(MAN_ARCH) > > -__arches=3D ${MACHINE} ${MACHINE_ARCH} ${MACHINE_CPUARCH} > > -.elif ${MAN_ARCH} =3D=3D "all" > > +.if empty(MAN_ARCH) || ${MAN_ARCH} =3D=3D "all" > > __arches=3D ${:!/bin/sh -c "/bin/ls -d ${.CURDIR}/man4.*"!:E} > > .else > > __arches=3D ${MAN_ARCH} > > diff --git a/share/man/man4/man4.aarch64/Makefile b/share/man/man4/man4= .aarch64/Makefile > > index 6714a47011ef..ef5fcd84ccd4 100644 > > --- a/share/man/man4/man4.aarch64/Makefile > > +++ b/share/man/man4/man4.aarch64/Makefile > > @@ -17,6 +17,11 @@ MAN=3D \ > > rk_i2c.4 \ > > rk_pinctrl.4 \ > > > > +# Link files to the parent directory > > +.for _manpage in ${MAN} > > +MLINKS+=3D${_manpage} ../${_manpage} > > +.endfor > > This breaks make -DNO_ROOT in a subtle manner and so likely pkgbase. > > The right way to do it is to add something that uses INSTALL_RSYMLINK or = alike. I'll look into it. Thanks! > > Best regards, > Bapt From owner-dev-commits-src-main@freebsd.org Wed Jul 7 00:43:58 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4E9F464AE76; Wed, 7 Jul 2021 00:43:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GKLJt1pHnz4RCj; Wed, 7 Jul 2021 00:43:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 254AF23C8D; Wed, 7 Jul 2021 00:43:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1670hwUi000982; Wed, 7 Jul 2021 00:43:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1670hwDn000981; Wed, 7 Jul 2021 00:43:58 GMT (envelope-from git) Date: Wed, 7 Jul 2021 00:43:58 GMT Message-Id: <202107070043.1670hwDn000981@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: da2f833f7a0b - main - MMCCAM: fix a panic after cam_sim_alloc_dev() removal in sdhci.c MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: da2f833f7a0bef3cde7d5fc2a05e4646e873567f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 00:43:58 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=da2f833f7a0bef3cde7d5fc2a05e4646e873567f commit da2f833f7a0bef3cde7d5fc2a05e4646e873567f Author: Bjoern A. Zeeb AuthorDate: 2021-07-07 00:37:45 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-07 00:37:45 +0000 MMCCAM: fix a panic after cam_sim_alloc_dev() removal in sdhci.c During the removal of cam_sim_alloc_dev() in aeb04e88f51a706ef4b6a380bf5e82d15203fb6a for sdhci.c and the follow-up build-fix in a72af82e3169fcacfedf9047120679300a4296f8 slot->dev and slot->bus got mixed up for MMCCAM; slot->dev is only used in the !MMCCAM case so is uninitialised here leading to a panic; switch back to slot->bus to return to the status quo. Reviewed by: imp (ack on arm@) X-Differential Revision: https://reviews.freebsd.org/D30857 --- sys/dev/sdhci/sdhci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/sdhci/sdhci.c b/sys/dev/sdhci/sdhci.c index bd30175e9f86..d075c2e05000 100644 --- a/sys/dev/sdhci/sdhci.c +++ b/sys/dev/sdhci/sdhci.c @@ -2484,7 +2484,7 @@ sdhci_start_slot(struct sdhci_slot *slot) mtx_init(&slot->sim_mtx, "sdhcisim", NULL, MTX_DEF); slot->sim = cam_sim_alloc(sdhci_cam_action, sdhci_cam_poll, - "sdhci_slot", slot, device_get_unit(slot->dev), + "sdhci_slot", slot, device_get_unit(slot->bus), &slot->sim_mtx, 1, 1, slot->devq); if (slot->sim == NULL) { From owner-dev-commits-src-main@freebsd.org Wed Jul 7 09:47:35 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C53FD65285F; Wed, 7 Jul 2021 09:47:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GKZN752Rtz4TDD; Wed, 7 Jul 2021 09:47:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 95D1E2D14; Wed, 7 Jul 2021 09:47:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1679lZ7T023297; Wed, 7 Jul 2021 09:47:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1679lZ2f023296; Wed, 7 Jul 2021 09:47:35 GMT (envelope-from git) Date: Wed, 7 Jul 2021 09:47:35 GMT Message-Id: <202107070947.1679lZ2f023296@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Edward Tomasz Napierala Subject: git: 6f147a0734e0 - main - cam: enable kern.cam.ada.enable_uma_ccbs by default MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6f147a0734e00437db89ccbddc57f60fa6c5db7b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 09:47:35 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=6f147a0734e00437db89ccbddc57f60fa6c5db7b commit 6f147a0734e00437db89ccbddc57f60fa6c5db7b Author: Edward Tomasz Napierala AuthorDate: 2021-07-07 08:39:34 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-07-07 08:40:34 +0000 cam: enable kern.cam.ada.enable_uma_ccbs by default This makes the ada(4) driver use UMA for its CCBs. While it's da(4) counterpart needs some more testing, this one seems to be safe now. Please let me know via email if you notice any suspicious kernel messages, Reviewed By: imp Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D30567 --- sys/cam/ata/ata_da.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/cam/ata/ata_da.c b/sys/cam/ata/ata_da.c index a8b67b2254a6..7063a40fcc3c 100644 --- a/sys/cam/ata/ata_da.c +++ b/sys/cam/ata/ata_da.c @@ -904,7 +904,7 @@ static int ada_spindown_suspend = ADA_DEFAULT_SPINDOWN_SUSPEND; static int ada_read_ahead = ADA_DEFAULT_READ_AHEAD; static int ada_write_cache = ADA_DEFAULT_WRITE_CACHE; static int ada_enable_biospeedup = 1; -static int ada_enable_uma_ccbs = 0; +static int ada_enable_uma_ccbs = 1; static SYSCTL_NODE(_kern_cam, OID_AUTO, ada, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "CAM Direct Access Disk driver"); From owner-dev-commits-src-main@freebsd.org Wed Jul 7 10:39:09 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4DA55652AF9; Wed, 7 Jul 2021 10:39:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GKbWd1G10z4bcC; Wed, 7 Jul 2021 10:39:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 126423831; Wed, 7 Jul 2021 10:39:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 167Ad8Dw091015; Wed, 7 Jul 2021 10:39:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 167Ad8nw091014; Wed, 7 Jul 2021 10:39:08 GMT (envelope-from git) Date: Wed, 7 Jul 2021 10:39:08 GMT Message-Id: <202107071039.167Ad8nw091014@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: a7b05eb16c9d - main - Sync the arm64 special registers with the Armv8.5 XML MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a7b05eb16c9d84e1fd59864f5da67d23897ed91c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 10:39:09 -0000 The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=a7b05eb16c9d84e1fd59864f5da67d23897ed91c commit a7b05eb16c9d84e1fd59864f5da67d23897ed91c Author: Andrew Turner AuthorDate: 2021-07-01 01:14:09 +0000 Commit: Andrew Turner CommitDate: 2021-07-06 20:46:55 +0000 Sync the arm64 special registers with the Armv8.5 XML Add the missing macros and decode all the fields as described in the Arm Architecture System Registers XML corresponding to Armv8.5. Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30983 --- sys/arm64/arm64/identcpu.c | 83 +++++++++++++++++++++++++++++++++++++++------- sys/arm64/include/armreg.h | 51 +++++++++++++++++++++++++--- 2 files changed, 117 insertions(+), 17 deletions(-) diff --git a/sys/arm64/arm64/identcpu.c b/sys/arm64/arm64/identcpu.c index bae5770b4b04..c2812055dfa9 100644 --- a/sys/arm64/arm64/identcpu.c +++ b/sys/arm64/arm64/identcpu.c @@ -304,9 +304,22 @@ static struct mrs_field id_aa64afr1_fields[] = { /* ID_AA64DFR0_EL1 */ +static struct mrs_field_value id_aa64dfr0_tracefilt[] = { + MRS_FIELD_VALUE(ID_AA64DFR0_TraceFilt_NONE, ""), + MRS_FIELD_VALUE(ID_AA64DFR0_TraceFilt_8_4, "Trace v8.4"), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field_value id_aa64dfr0_doublelock[] = { + MRS_FIELD_VALUE(ID_AA64DFR0_DoubleLock_IMPL, "DoubleLock"), + MRS_FIELD_VALUE(ID_AA64DFR0_DoubleLock_NONE, ""), + MRS_FIELD_VALUE_END, +}; + static struct mrs_field_value id_aa64dfr0_pmsver[] = { MRS_FIELD_VALUE(ID_AA64DFR0_PMSVer_NONE, ""), - MRS_FIELD_VALUE(ID_AA64DFR0_PMSVer_V1, "SPE"), + MRS_FIELD_VALUE(ID_AA64DFR0_PMSVer_SPE, "SPE"), + MRS_FIELD_VALUE(ID_AA64DFR0_PMSVer_SPE_8_3, "SPE v8.3"), MRS_FIELD_VALUE_END, }; @@ -328,7 +341,9 @@ static struct mrs_field_value id_aa64dfr0_brps[] = { static struct mrs_field_value id_aa64dfr0_pmuver[] = { MRS_FIELD_VALUE(ID_AA64DFR0_PMUVer_NONE, ""), MRS_FIELD_VALUE(ID_AA64DFR0_PMUVer_3, "PMUv3"), - MRS_FIELD_VALUE(ID_AA64DFR0_PMUVer_3_1, "PMUv3+16 bit evtCount"), + MRS_FIELD_VALUE(ID_AA64DFR0_PMUVer_3_1, "PMUv3 v8.1"), + MRS_FIELD_VALUE(ID_AA64DFR0_PMUVer_3_4, "PMUv3 v8.4"), + MRS_FIELD_VALUE(ID_AA64DFR0_PMUVer_3_5, "PMUv3 v8.5"), MRS_FIELD_VALUE(ID_AA64DFR0_PMUVer_IMPL, "IMPL PMU"), MRS_FIELD_VALUE_END, }; @@ -343,10 +358,15 @@ static struct mrs_field_value id_aa64dfr0_debugver[] = { MRS_FIELD_VALUE(ID_AA64DFR0_DebugVer_8, "Debugv8"), MRS_FIELD_VALUE(ID_AA64DFR0_DebugVer_8_VHE, "Debugv8_VHE"), MRS_FIELD_VALUE(ID_AA64DFR0_DebugVer_8_2, "Debugv8.2"), + MRS_FIELD_VALUE(ID_AA64DFR0_DebugVer_8_4, "Debugv8.4"), MRS_FIELD_VALUE_END, }; static struct mrs_field id_aa64dfr0_fields[] = { + MRS_FIELD(ID_AA64DFR0, TraceFilt, false, MRS_EXACT, + id_aa64dfr0_tracefilt), + MRS_FIELD(ID_AA64DFR0, DoubleLock, false, MRS_EXACT, + id_aa64dfr0_doublelock), MRS_FIELD(ID_AA64DFR0, PMSVer, false, MRS_EXACT, id_aa64dfr0_pmsver), MRS_FIELD(ID_AA64DFR0, CTX_CMPs, false, MRS_EXACT, id_aa64dfr0_ctx_cmps), @@ -361,7 +381,7 @@ static struct mrs_field id_aa64dfr0_fields[] = { }; -/* ID_AA64DFR1 */ +/* ID_AA64DFR1_EL1 */ static struct mrs_field id_aa64dfr1_fields[] = { MRS_FIELD_END, }; @@ -524,12 +544,16 @@ static struct mrs_field_value id_aa64isar1_jscvt[] = { }; static struct mrs_field_value id_aa64isar1_api[] = { - MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR1, API, NONE, IMPL), + MRS_FIELD_VALUE(ID_AA64ISAR1_API_NONE, ""), + MRS_FIELD_VALUE(ID_AA64ISAR1_API_PAC, "API PAC"), + MRS_FIELD_VALUE(ID_AA64ISAR1_API_EPAC, "API EPAC"), MRS_FIELD_VALUE_END, }; static struct mrs_field_value id_aa64isar1_apa[] = { - MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR1, APA, NONE, IMPL), + MRS_FIELD_VALUE(ID_AA64ISAR1_APA_NONE, ""), + MRS_FIELD_VALUE(ID_AA64ISAR1_APA_PAC, "APA PAC"), + MRS_FIELD_VALUE(ID_AA64ISAR1_APA_EPAC, "APA EPAC"), MRS_FIELD_VALUE_END, }; @@ -562,8 +586,34 @@ static struct mrs_field id_aa64isar1_fields[] = { /* ID_AA64MMFR0_EL1 */ +static struct mrs_field_value id_aa64mmfr0_exs[] = { + MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR0, ExS, ALL, IMPL), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field_value id_aa64mmfr0_tgran4_2[] = { + MRS_FIELD_VALUE(ID_AA64MMFR0_TGran4_2_TGran4, ""), + MRS_FIELD_VALUE(ID_AA64MMFR0_TGran4_2_NONE, "No S2 TGran4"), + MRS_FIELD_VALUE(ID_AA64MMFR0_TGran4_2_IMPL, "S2 TGran4"), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field_value id_aa64mmfr0_tgran64_2[] = { + MRS_FIELD_VALUE(ID_AA64MMFR0_TGran64_2_TGran64, ""), + MRS_FIELD_VALUE(ID_AA64MMFR0_TGran64_2_NONE, "No S2 TGran64"), + MRS_FIELD_VALUE(ID_AA64MMFR0_TGran64_2_IMPL, "S2 TGran64"), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field_value id_aa64mmfr0_tgran16_2[] = { + MRS_FIELD_VALUE(ID_AA64MMFR0_TGran16_2_TGran16, ""), + MRS_FIELD_VALUE(ID_AA64MMFR0_TGran16_2_NONE, "No S2 TGran16"), + MRS_FIELD_VALUE(ID_AA64MMFR0_TGran16_2_IMPL, "S2 TGran16"), + MRS_FIELD_VALUE_END, +}; + static struct mrs_field_value id_aa64mmfr0_tgran4[] = { - MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR0, TGran4, NONE, IMPL), + MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR0, TGran4,NONE, IMPL), MRS_FIELD_VALUE_END, }; @@ -577,7 +627,7 @@ static struct mrs_field_value id_aa64mmfr0_tgran16[] = { MRS_FIELD_VALUE_END, }; -static struct mrs_field_value id_aa64mmfr0_bigend_el0[] = { +static struct mrs_field_value id_aa64mmfr0_bigendel0[] = { MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR0, BigEndEL0, FIXED, MIXED), MRS_FIELD_VALUE_END, }; @@ -592,7 +642,7 @@ static struct mrs_field_value id_aa64mmfr0_bigend[] = { MRS_FIELD_VALUE_END, }; -static struct mrs_field_value id_aa64mmfr0_asid_bits[] = { +static struct mrs_field_value id_aa64mmfr0_asidbits[] = { MRS_FIELD_VALUE(ID_AA64MMFR0_ASIDBits_8, "8bit ASID"), MRS_FIELD_VALUE(ID_AA64MMFR0_ASIDBits_16, "16bit ASID"), MRS_FIELD_VALUE_END, @@ -610,17 +660,24 @@ static struct mrs_field_value id_aa64mmfr0_parange[] = { }; static struct mrs_field id_aa64mmfr0_fields[] = { + MRS_FIELD(ID_AA64MMFR0, ExS, false, MRS_EXACT, id_aa64mmfr0_exs), + MRS_FIELD(ID_AA64MMFR0, TGran4_2, false, MRS_EXACT, + id_aa64mmfr0_tgran4_2), + MRS_FIELD(ID_AA64MMFR0, TGran64_2, false, MRS_EXACT, + id_aa64mmfr0_tgran64_2), + MRS_FIELD(ID_AA64MMFR0, TGran16_2, false, MRS_EXACT, + id_aa64mmfr0_tgran16_2), MRS_FIELD(ID_AA64MMFR0, TGran4, false, MRS_EXACT, id_aa64mmfr0_tgran4), MRS_FIELD(ID_AA64MMFR0, TGran64, false, MRS_EXACT, id_aa64mmfr0_tgran64), MRS_FIELD(ID_AA64MMFR0, TGran16, false, MRS_EXACT, id_aa64mmfr0_tgran16), MRS_FIELD(ID_AA64MMFR0, BigEndEL0, false, MRS_EXACT, - id_aa64mmfr0_bigend_el0), + id_aa64mmfr0_bigendel0), MRS_FIELD(ID_AA64MMFR0, SNSMem, false, MRS_EXACT, id_aa64mmfr0_snsmem), MRS_FIELD(ID_AA64MMFR0, BigEnd, false, MRS_EXACT, id_aa64mmfr0_bigend), MRS_FIELD(ID_AA64MMFR0, ASIDBits, false, MRS_EXACT, - id_aa64mmfr0_asid_bits), + id_aa64mmfr0_asidbits), MRS_FIELD(ID_AA64MMFR0, PARange, false, MRS_EXACT, id_aa64mmfr0_parange), MRS_FIELD_END, @@ -735,7 +792,8 @@ static struct mrs_field_value id_aa64mmfr2_st[] = { }; static struct mrs_field_value id_aa64mmfr2_nv[] = { - MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR2, NV, NONE, IMPL), + MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR2, NV, NONE, 8_3), + MRS_FIELD_VALUE(ID_AA64MMFR2_NV_8_4, "NV v8.4"), MRS_FIELD_VALUE_END, }; @@ -835,7 +893,8 @@ static struct mrs_field_value id_aa64pfr0_sve[] = { static struct mrs_field_value id_aa64pfr0_ras[] = { MRS_FIELD_VALUE(ID_AA64PFR0_RAS_NONE, ""), - MRS_FIELD_VALUE(ID_AA64PFR0_RAS_V1, "RASv1"), + MRS_FIELD_VALUE(ID_AA64PFR0_RAS_IMPL, "RAS"), + MRS_FIELD_VALUE(ID_AA64PFR0_RAS_8_4, "RAS v8.4"), MRS_FIELD_VALUE_END, }; diff --git a/sys/arm64/include/armreg.h b/sys/arm64/include/armreg.h index af6e84e6c772..8a2bbb60f3d0 100644 --- a/sys/arm64/include/armreg.h +++ b/sys/arm64/include/armreg.h @@ -266,6 +266,7 @@ #define ID_AA64DFR0_DebugVer_8 (UL(0x6) << ID_AA64DFR0_DebugVer_SHIFT) #define ID_AA64DFR0_DebugVer_8_VHE (UL(0x7) << ID_AA64DFR0_DebugVer_SHIFT) #define ID_AA64DFR0_DebugVer_8_2 (UL(0x8) << ID_AA64DFR0_DebugVer_SHIFT) +#define ID_AA64DFR0_DebugVer_8_4 (UL(0x9) << ID_AA64DFR0_DebugVer_SHIFT) #define ID_AA64DFR0_TraceVer_SHIFT 4 #define ID_AA64DFR0_TraceVer_MASK (UL(0xf) << ID_AA64DFR0_TraceVer_SHIFT) #define ID_AA64DFR0_TraceVer_VAL(x) ((x) & ID_AA64DFR0_TraceVer_MASK) @@ -277,6 +278,8 @@ #define ID_AA64DFR0_PMUVer_NONE (UL(0x0) << ID_AA64DFR0_PMUVer_SHIFT) #define ID_AA64DFR0_PMUVer_3 (UL(0x1) << ID_AA64DFR0_PMUVer_SHIFT) #define ID_AA64DFR0_PMUVer_3_1 (UL(0x4) << ID_AA64DFR0_PMUVer_SHIFT) +#define ID_AA64DFR0_PMUVer_3_4 (UL(0x5) << ID_AA64DFR0_PMUVer_SHIFT) +#define ID_AA64DFR0_PMUVer_3_5 (UL(0x6) << ID_AA64DFR0_PMUVer_SHIFT) #define ID_AA64DFR0_PMUVer_IMPL (UL(0xf) << ID_AA64DFR0_PMUVer_SHIFT) #define ID_AA64DFR0_BRPs_SHIFT 12 #define ID_AA64DFR0_BRPs_MASK (UL(0xf) << ID_AA64DFR0_BRPs_SHIFT) @@ -294,7 +297,18 @@ #define ID_AA64DFR0_PMSVer_MASK (UL(0xf) << ID_AA64DFR0_PMSVer_SHIFT) #define ID_AA64DFR0_PMSVer_VAL(x) ((x) & ID_AA64DFR0_PMSVer_MASK) #define ID_AA64DFR0_PMSVer_NONE (UL(0x0) << ID_AA64DFR0_PMSVer_SHIFT) -#define ID_AA64DFR0_PMSVer_V1 (UL(0x1) << ID_AA64DFR0_PMSVer_SHIFT) +#define ID_AA64DFR0_PMSVer_SPE (UL(0x1) << ID_AA64DFR0_PMSVer_SHIFT) +#define ID_AA64DFR0_PMSVer_SPE_8_3 (UL(0x2) << ID_AA64DFR0_PMSVer_SHIFT) +#define ID_AA64DFR0_DoubleLock_SHIFT 36 +#define ID_AA64DFR0_DoubleLock_MASK (UL(0xf) << ID_AA64DFR0_DoubleLock_SHIFT) +#define ID_AA64DFR0_DoubleLock_VAL(x) ((x) & ID_AA64DFR0_DoubleLock_MASK) +#define ID_AA64DFR0_DoubleLock_IMPL (UL(0x0) << ID_AA64DFR0_DoubleLock_SHIFT) +#define ID_AA64DFR0_DoubleLock_NONE (UL(0xf) << ID_AA64DFR0_DoubleLock_SHIFT) +#define ID_AA64DFR0_TraceFilt_SHIFT 40 +#define ID_AA64DFR0_TraceFilt_MASK (UL(0xf) << ID_AA64DFR0_TraceFilt_SHIFT) +#define ID_AA64DFR0_TraceFilt_VAL(x) ((x) & ID_AA64DFR0_TraceFilt_MASK) +#define ID_AA64DFR0_TraceFilt_NONE (UL(0x0) << ID_AA64DFR0_TraceFilt_SHIFT) +#define ID_AA64DFR0_TraceFilt_8_4 (UL(0x1) << ID_AA64DFR0_TraceFilt_SHIFT) /* ID_AA64ISAR0_EL1 */ #define ID_AA64ISAR0_EL1 MRS_REG(3, 0, 0, 6, 0) @@ -385,12 +399,14 @@ #define ID_AA64ISAR1_APA_MASK (UL(0xf) << ID_AA64ISAR1_APA_SHIFT) #define ID_AA64ISAR1_APA_VAL(x) ((x) & ID_AA64ISAR1_APA_MASK) #define ID_AA64ISAR1_APA_NONE (UL(0x0) << ID_AA64ISAR1_APA_SHIFT) -#define ID_AA64ISAR1_APA_IMPL (UL(0x1) << ID_AA64ISAR1_APA_SHIFT) +#define ID_AA64ISAR1_APA_PAC (UL(0x1) << ID_AA64ISAR1_APA_SHIFT) +#define ID_AA64ISAR1_APA_EPAC (UL(0x2) << ID_AA64ISAR1_APA_SHIFT) #define ID_AA64ISAR1_API_SHIFT 8 #define ID_AA64ISAR1_API_MASK (UL(0xf) << ID_AA64ISAR1_API_SHIFT) #define ID_AA64ISAR1_API_VAL(x) ((x) & ID_AA64ISAR1_API_MASK) #define ID_AA64ISAR1_API_NONE (UL(0x0) << ID_AA64ISAR1_API_SHIFT) -#define ID_AA64ISAR1_API_IMPL (UL(0x1) << ID_AA64ISAR1_API_SHIFT) +#define ID_AA64ISAR1_API_PAC (UL(0x1) << ID_AA64ISAR1_API_SHIFT) +#define ID_AA64ISAR1_API_EPAC (UL(0x2) << ID_AA64ISAR1_API_SHIFT) #define ID_AA64ISAR1_JSCVT_SHIFT 12 #define ID_AA64ISAR1_JSCVT_MASK (UL(0xf) << ID_AA64ISAR1_JSCVT_SHIFT) #define ID_AA64ISAR1_JSCVT_VAL(x) ((x) & ID_AA64ISAR1_JSCVT_MASK) @@ -495,6 +511,29 @@ #define ID_AA64MMFR0_TGran4_VAL(x) ((x) & ID_AA64MMFR0_TGran4_MASK) #define ID_AA64MMFR0_TGran4_IMPL (UL(0x0) << ID_AA64MMFR0_TGran4_SHIFT) #define ID_AA64MMFR0_TGran4_NONE (UL(0xf) << ID_AA64MMFR0_TGran4_SHIFT) +#define ID_AA64MMFR0_TGran16_2_SHIFT 32 +#define ID_AA64MMFR0_TGran16_2_MASK (UL(0xf) << ID_AA64MMFR0_TGran16_2_SHIFT) +#define ID_AA64MMFR0_TGran16_2_VAL(x) ((x) & ID_AA64MMFR0_TGran16_2_MASK) +#define ID_AA64MMFR0_TGran16_2_TGran16 (UL(0x0) << ID_AA64MMFR0_TGran16_2_SHIFT) +#define ID_AA64MMFR0_TGran16_2_NONE (UL(0x1) << ID_AA64MMFR0_TGran16_2_SHIFT) +#define ID_AA64MMFR0_TGran16_2_IMPL (UL(0x2) << ID_AA64MMFR0_TGran16_2_SHIFT) +#define ID_AA64MMFR0_TGran64_2_SHIFT 36 +#define ID_AA64MMFR0_TGran64_2_MASK (UL(0xf) << ID_AA64MMFR0_TGran64_2_SHIFT) +#define ID_AA64MMFR0_TGran64_2_VAL(x) ((x) & ID_AA64MMFR0_TGran64_2_MASK) +#define ID_AA64MMFR0_TGran64_2_TGran64 (UL(0x0) << ID_AA64MMFR0_TGran64_2_SHIFT) +#define ID_AA64MMFR0_TGran64_2_NONE (UL(0x1) << ID_AA64MMFR0_TGran64_2_SHIFT) +#define ID_AA64MMFR0_TGran64_2_IMPL (UL(0x2) << ID_AA64MMFR0_TGran64_2_SHIFT) +#define ID_AA64MMFR0_TGran4_2_SHIFT 40 +#define ID_AA64MMFR0_TGran4_2_MASK (UL(0xf) << ID_AA64MMFR0_TGran4_2_SHIFT) +#define ID_AA64MMFR0_TGran4_2_VAL(x) ((x) & ID_AA64MMFR0_TGran4_2_MASK) +#define ID_AA64MMFR0_TGran4_2_TGran4 (UL(0x0) << ID_AA64MMFR0_TGran4_2_SHIFT) +#define ID_AA64MMFR0_TGran4_2_NONE (UL(0x1) << ID_AA64MMFR0_TGran4_2_SHIFT) +#define ID_AA64MMFR0_TGran4_2_IMPL (UL(0x2) << ID_AA64MMFR0_TGran4_2_SHIFT) +#define ID_AA64MMFR0_ExS_SHIFT 44 +#define ID_AA64MMFR0_ExS_MASK (UL(0xf) << ID_AA64MMFR0_ExS_SHIFT) +#define ID_AA64MMFR0_ExS_VAL(x) ((x) & ID_AA64MMFR0_ExS_MASK) +#define ID_AA64MMFR0_ExS_ALL (UL(0x0) << ID_AA64MMFR0_ExS_SHIFT) +#define ID_AA64MMFR0_ExS_IMPL (UL(0x1) << ID_AA64MMFR0_ExS_SHIFT) /* ID_AA64MMFR1_EL1 */ #define ID_AA64MMFR1_EL1 MRS_REG(3, 0, 0, 7, 1) @@ -578,7 +617,8 @@ #define ID_AA64MMFR2_NV_MASK (UL(0xf) << ID_AA64MMFR2_NV_SHIFT) #define ID_AA64MMFR2_NV_VAL(x) ((x) & ID_AA64MMFR2_NV_MASK) #define ID_AA64MMFR2_NV_NONE (UL(0x0) << ID_AA64MMFR2_NV_SHIFT) -#define ID_AA64MMFR2_NV_IMPL (UL(0x1) << ID_AA64MMFR2_NV_SHIFT) +#define ID_AA64MMFR2_NV_8_3 (UL(0x1) << ID_AA64MMFR2_NV_SHIFT) +#define ID_AA64MMFR2_NV_8_4 (UL(0x2) << ID_AA64MMFR2_NV_SHIFT) #define ID_AA64MMFR2_ST_SHIFT 28 #define ID_AA64MMFR2_ST_MASK (UL(0xf) << ID_AA64MMFR2_ST_SHIFT) #define ID_AA64MMFR2_ST_VAL(x) ((x) & ID_AA64MMFR2_ST_MASK) @@ -668,7 +708,8 @@ #define ID_AA64PFR0_RAS_MASK (UL(0xf) << ID_AA64PFR0_RAS_SHIFT) #define ID_AA64PFR0_RAS_VAL(x) ((x) & ID_AA64PFR0_RAS_MASK) #define ID_AA64PFR0_RAS_NONE (UL(0x0) << ID_AA64PFR0_RAS_SHIFT) -#define ID_AA64PFR0_RAS_V1 (UL(0x1) << ID_AA64PFR0_RAS_SHIFT) +#define ID_AA64PFR0_RAS_IMPL (UL(0x1) << ID_AA64PFR0_RAS_SHIFT) +#define ID_AA64PFR0_RAS_8_4 (UL(0x2) << ID_AA64PFR0_RAS_SHIFT) #define ID_AA64PFR0_SVE_SHIFT 32 #define ID_AA64PFR0_SVE_MASK (UL(0xf) << ID_AA64PFR0_SVE_SHIFT) #define ID_AA64PFR0_SVE_VAL(x) ((x) & ID_AA64PFR0_SVE_MASK) From owner-dev-commits-src-main@freebsd.org Wed Jul 7 11:00:42 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DE1296537EA; Wed, 7 Jul 2021 11:00:42 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GKc0V5Ynyz4dbL; Wed, 7 Jul 2021 11:00:42 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-lf1-x12f.google.com with SMTP id r26so3378169lfp.2; Wed, 07 Jul 2021 04:00:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=x4HYnOvzFttJ0e5A9VisZaMB3Bp+13UgEiTdrd4Wfb8=; b=FqptaHB1iE/gLMRxPRI0dKA3eY1w8uPkYQTJnzXVgwPGJbQjtcjkv07ledUlPB1HWy 1xPXpHlPz/w8h7iAflbSh/aCdt7mUbj85R5CSn8zx0+jyK9pV3t3PcvmKybR1nCNqMQg 9rmzN3hM1RCyEwSVr3AoJ6tSCcuspdJBMweSmbTjOkBdQl+6s51APALqqM/k+XKHnBBr NbQwxpELpvTidPtnvjJUWrKT3hS79r/+I6a5BPhzto89jYU0gxlN0rodkJ7f47+fsxO7 f63R5RScHNgPH+Rz0VazvR1bXpDvigmHqrqu6CELpIqpcAK3k1FTYkMd8DsKppUl3FZv 9xdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=x4HYnOvzFttJ0e5A9VisZaMB3Bp+13UgEiTdrd4Wfb8=; b=FQ+Mvrf5pMhHUWvM/p8IKHrPTR89LqVJLdcPrbuLW3QG6Gi/uEbTo9OYA+sPefMn9j tnHAqgztX9XXwMBH7TDHE8vRUyo7ipNRfv5fbYIL1VWrgvcd+XMalBlZNcGUREaEz4Zl 9uPti4eZ2Z5cauRYtZXtW0t7vmeNGz9/4qZVgBOb/SKDk6xBbQ9+3waRcaQcuT7ksQtz w7JW+g3b0xOOT7ADeywtrOWXw7EFfdxba+nTgj4T3HrtToe3B9pazo0NFSJK6Ku6XX9p sLVfLq0mR2jLwuQuhp1oFM3JcnoYq9pGVRTParaOuMm18QcfPrPgkrbfMvQKFjX8OyFY TtpQ== X-Gm-Message-State: AOAM533qbm2V4U5QLpIVQOGdcMBlr+WId4TZluteRmCuhGNE57nwo41O ga9tLafKkEEwE+TgLCX00O+kEK+LNvgYSmtA/dq1UDWP X-Google-Smtp-Source: ABdhPJz11+67aU78e9gHje3YI1yfeAUkUknTcg3bX8cTTnST6b96cWfu1TjrAHZ0Qvj/QDRYyM7DCa2Pv+rdQwDH1uQ= X-Received: by 2002:ac2:5a04:: with SMTP id q4mr18955625lfn.110.1625655641020; Wed, 07 Jul 2021 04:00:41 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a2e:8416:0:0:0:0:0 with HTTP; Wed, 7 Jul 2021 04:00:40 -0700 (PDT) In-Reply-To: <202107061429.166ETTEn064437@gitrepo.freebsd.org> References: <202107061429.166ETTEn064437@gitrepo.freebsd.org> From: Mateusz Guzik Date: Wed, 7 Jul 2021 13:00:40 +0200 Message-ID: Subject: Re: git: 28d0a740dd9a - main - ktls: auto-disable ifnet (inline hw) kTLS To: Andrew Gallatin Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4GKc0V5Ynyz4dbL X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 11:00:42 -0000 This breaks NOIP kernel builds. On 7/6/21, Andrew Gallatin wrote: > The branch main has been updated by gallatin: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=28d0a740dd9a67e4a4fa9fda5bb39b5963316f35 > > commit 28d0a740dd9a67e4a4fa9fda5bb39b5963316f35 > Author: Andrew Gallatin > AuthorDate: 2021-07-06 14:17:33 +0000 > Commit: Andrew Gallatin > CommitDate: 2021-07-06 14:28:32 +0000 > > ktls: auto-disable ifnet (inline hw) kTLS > > Ifnet (inline) hw kTLS NICs typically keep state within > a TLS record, so that when transmitting in-order, > they can continue encryption on each segment sent without > DMA'ing extra state from the host. > > This breaks down when transmits are out of order (eg, > TCP retransmits). In this case, the NIC must re-DMA > the entire TLS record up to and including the segment > being retransmitted. This means that when re-transmitting > the last 1448 byte segment of a TLS record, the NIC will > have to re-DMA the entire 16KB TLS record. This can lead > to the NIC running out of PCIe bus bandwidth well before > it saturates the network link if a lot of TCP connections have > a high retransmoit rate. > > This change introduces a new sysctl > (kern.ipc.tls.ifnet_max_rexmit_pct), > where TCP connections with higher retransmit rate will be > switched to SW kTLS so as to conserve PCIe bandwidth. > > Reviewed by: hselasky, markj, rrs > Sponsored by: Netflix > Differential Revision: https://reviews.freebsd.org/D30908 > --- > sys/kern/uipc_ktls.c | 107 > ++++++++++++++++++++++++++++++++++++++++++++++++++ > sys/netinet/tcp_var.h | 13 +++++- > sys/sys/ktls.h | 15 ++++++- > 3 files changed, 133 insertions(+), 2 deletions(-) > > diff --git a/sys/kern/uipc_ktls.c b/sys/kern/uipc_ktls.c > index 7e87e7c740e3..88e29157289d 100644 > --- a/sys/kern/uipc_ktls.c > +++ b/sys/kern/uipc_ktls.c > @@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$"); > > #include "opt_inet.h" > #include "opt_inet6.h" > +#include "opt_kern_tls.h" > #include "opt_ratelimit.h" > #include "opt_rss.h" > > @@ -121,6 +122,11 @@ SYSCTL_INT(_kern_ipc_tls_stats, OID_AUTO, threads, > CTLFLAG_RD, > &ktls_number_threads, 0, > "Number of TLS threads in thread-pool"); > > +unsigned int ktls_ifnet_max_rexmit_pct = 2; > +SYSCTL_UINT(_kern_ipc_tls, OID_AUTO, ifnet_max_rexmit_pct, CTLFLAG_RWTUN, > + &ktls_ifnet_max_rexmit_pct, 2, > + "Max percent bytes retransmitted before ifnet TLS is disabled"); > + > static bool ktls_offload_enable; > SYSCTL_BOOL(_kern_ipc_tls, OID_AUTO, enable, CTLFLAG_RWTUN, > &ktls_offload_enable, 0, > @@ -184,6 +190,14 @@ static COUNTER_U64_DEFINE_EARLY(ktls_switch_failed); > SYSCTL_COUNTER_U64(_kern_ipc_tls_stats, OID_AUTO, switch_failed, > CTLFLAG_RD, > &ktls_switch_failed, "TLS sessions unable to switch between SW and > ifnet"); > > +static COUNTER_U64_DEFINE_EARLY(ktls_ifnet_disable_fail); > +SYSCTL_COUNTER_U64(_kern_ipc_tls_stats, OID_AUTO, ifnet_disable_failed, > CTLFLAG_RD, > + &ktls_ifnet_disable_fail, "TLS sessions unable to switch to SW from > ifnet"); > + > +static COUNTER_U64_DEFINE_EARLY(ktls_ifnet_disable_ok); > +SYSCTL_COUNTER_U64(_kern_ipc_tls_stats, OID_AUTO, ifnet_disable_ok, > CTLFLAG_RD, > + &ktls_ifnet_disable_ok, "TLS sessions able to switch to SW from > ifnet"); > + > SYSCTL_NODE(_kern_ipc_tls, OID_AUTO, sw, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, > "Software TLS session stats"); > SYSCTL_NODE(_kern_ipc_tls, OID_AUTO, ifnet, CTLFLAG_RD | CTLFLAG_MPSAFE, > 0, > @@ -2187,3 +2201,96 @@ ktls_work_thread(void *ctx) > } > } > } > + > +static void > +ktls_disable_ifnet_help(void *context, int pending __unused) > +{ > + struct ktls_session *tls; > + struct inpcb *inp; > + struct tcpcb *tp; > + struct socket *so; > + int err; > + > + tls = context; > + inp = tls->inp; > + if (inp == NULL) > + return; > + INP_WLOCK(inp); > + so = inp->inp_socket; > + MPASS(so != NULL); > + if ((inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) || > + (inp->inp_flags2 & INP_FREED)) { > + goto out; > + } > + > + if (so->so_snd.sb_tls_info != NULL) > + err = ktls_set_tx_mode(so, TCP_TLS_MODE_SW); > + else > + err = ENXIO; > + if (err == 0) { > + counter_u64_add(ktls_ifnet_disable_ok, 1); > + /* ktls_set_tx_mode() drops inp wlock, so recheck flags */ > + if ((inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) == 0 && > + (inp->inp_flags2 & INP_FREED) == 0 && > + (tp = intotcpcb(inp)) != NULL && > + tp->t_fb->tfb_hwtls_change != NULL) > + (*tp->t_fb->tfb_hwtls_change)(tp, 0); > + } else { > + counter_u64_add(ktls_ifnet_disable_fail, 1); > + } > + > +out: > + SOCK_LOCK(so); > + sorele(so); > + if (!in_pcbrele_wlocked(inp)) > + INP_WUNLOCK(inp); > + ktls_free(tls); > +} > + > +/* > + * Called when re-transmits are becoming a substantial portion of the > + * sends on this connection. When this happens, we transition the > + * connection to software TLS. This is needed because most inline TLS > + * NICs keep crypto state only for in-order transmits. This means > + * that to handle a TCP rexmit (which is out-of-order), the NIC must > + * re-DMA the entire TLS record up to and including the current > + * segment. This means that when re-transmitting the last ~1448 byte > + * segment of a 16KB TLS record, we could wind up re-DMA'ing an order > + * of magnitude more data than we are sending. This can cause the > + * PCIe link to saturate well before the network, which can cause > + * output drops, and a general loss of capacity. > + */ > +void > +ktls_disable_ifnet(void *arg) > +{ > + struct tcpcb *tp; > + struct inpcb *inp; > + struct socket *so; > + struct ktls_session *tls; > + > + tp = arg; > + inp = tp->t_inpcb; > + INP_WLOCK_ASSERT(inp); > + so = inp->inp_socket; > + SOCK_LOCK(so); > + tls = so->so_snd.sb_tls_info; > + if (tls->disable_ifnet_pending) { > + SOCK_UNLOCK(so); > + return; > + } > + > + /* > + * note that disable_ifnet_pending is never cleared; disabling > + * ifnet can only be done once per session, so we never want > + * to do it again > + */ > + > + (void)ktls_hold(tls); > + in_pcbref(inp); > + soref(so); > + tls->disable_ifnet_pending = true; > + tls->inp = inp; > + SOCK_UNLOCK(so); > + TASK_INIT(&tls->disable_ifnet_task, 0, ktls_disable_ifnet_help, tls); > + (void)taskqueue_enqueue(taskqueue_thread, &tls->disable_ifnet_task); > +} > diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h > index dd30f89896d2..3f72a821e71f 100644 > --- a/sys/netinet/tcp_var.h > +++ b/sys/netinet/tcp_var.h > @@ -39,8 +39,10 @@ > #include > > #ifdef _KERNEL > +#include "opt_kern_tls.h" > #include > #include > +#include > #endif > > #define TCP_END_BYTE_INFO 8 /* Bytes that makeup the "end information > array" */ > @@ -1139,8 +1141,10 @@ tcp_fields_to_net(struct tcphdr *th) > > static inline void > tcp_account_for_send(struct tcpcb *tp, uint32_t len, uint8_t is_rxt, > - uint8_t is_tlp, int hw_tls __unused) > + uint8_t is_tlp, int hw_tls) > { > + uint64_t rexmit_percent; > + > if (is_tlp) { > tp->t_sndtlppack++; > tp->t_sndtlpbyte += len; > @@ -1150,6 +1154,13 @@ tcp_account_for_send(struct tcpcb *tp, uint32_t len, > uint8_t is_rxt, > tp->t_snd_rxt_bytes += len; > else > tp->t_sndbytes += len; > + > + if (hw_tls && is_rxt) { > + rexmit_percent = (1000ULL * tp->t_snd_rxt_bytes) / (10ULL * > (tp->t_snd_rxt_bytes + tp->t_sndbytes)); > + if (rexmit_percent > ktls_ifnet_max_rexmit_pct) > + ktls_disable_ifnet(tp); > + } > + > } > #endif /* _KERNEL */ > > diff --git a/sys/sys/ktls.h b/sys/sys/ktls.h > index b28c94965c97..7fd8831878b4 100644 > --- a/sys/sys/ktls.h > +++ b/sys/sys/ktls.h > @@ -189,10 +189,12 @@ struct ktls_session { > u_int wq_index; > volatile u_int refcount; > int mode; > - bool reset_pending; > > struct task reset_tag_task; > + struct task disable_ifnet_task; > struct inpcb *inp; > + bool reset_pending; > + bool disable_ifnet_pending; > } __aligned(CACHE_LINE_SIZE); > > void ktls_check_rx(struct sockbuf *sb); > @@ -231,5 +233,16 @@ ktls_free(struct ktls_session *tls) > ktls_destroy(tls); > } > > +#ifdef KERN_TLS > +extern unsigned int ktls_ifnet_max_rexmit_pct; > +void ktls_disable_ifnet(void *arg); > +#else > +#define ktls_ifnet_max_rexmit_pct 1 > +inline void > +ktls_disable_ifnet(void *arg __unused) > +{ > +} > +#endif > + > #endif /* !_KERNEL */ > #endif /* !_SYS_KTLS_H_ */ > -- Mateusz Guzik From owner-dev-commits-src-main@freebsd.org Wed Jul 7 11:08:13 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EF68A6539A4; Wed, 7 Jul 2021 11:08:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GKc996BYnz4fQ0; Wed, 7 Jul 2021 11:08:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BC043439D; Wed, 7 Jul 2021 11:08:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 167B8Dou032105; Wed, 7 Jul 2021 11:08:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 167B8DZZ032104; Wed, 7 Jul 2021 11:08:13 GMT (envelope-from git) Date: Wed, 7 Jul 2021 11:08:13 GMT Message-Id: <202107071108.167B8DZZ032104@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 0a718a6e6eba - main - mbuf: replace all direct uma_zfree(zone_mbuf) calls with m_free_raw MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0a718a6e6ebaa1b8442123df8bdbae5a04a77987 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 11:08:14 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=0a718a6e6ebaa1b8442123df8bdbae5a04a77987 commit 0a718a6e6ebaa1b8442123df8bdbae5a04a77987 Author: Mateusz Guzik AuthorDate: 2021-07-06 16:44:35 +0000 Commit: Mateusz Guzik CommitDate: 2021-07-07 11:05:46 +0000 mbuf: replace all direct uma_zfree(zone_mbuf) calls with m_free_raw Reviewed by: donner Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31082 --- sys/kern/kern_mbuf.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/sys/kern/kern_mbuf.c b/sys/kern/kern_mbuf.c index 2333bf887354..c43f086bb83f 100644 --- a/sys/kern/kern_mbuf.c +++ b/sys/kern/kern_mbuf.c @@ -1191,19 +1191,19 @@ mb_free_ext(struct mbuf *m) break; case EXT_CLUSTER: uma_zfree(zone_clust, m->m_ext.ext_buf); - uma_zfree(zone_mbuf, mref); + m_free_raw(mref); break; case EXT_JUMBOP: uma_zfree(zone_jumbop, m->m_ext.ext_buf); - uma_zfree(zone_mbuf, mref); + m_free_raw(mref); break; case EXT_JUMBO9: uma_zfree(zone_jumbo9, m->m_ext.ext_buf); - uma_zfree(zone_mbuf, mref); + m_free_raw(mref); break; case EXT_JUMBO16: uma_zfree(zone_jumbo16, m->m_ext.ext_buf); - uma_zfree(zone_mbuf, mref); + m_free_raw(mref); break; case EXT_SFBUF: case EXT_NET_DRV: @@ -1212,7 +1212,7 @@ mb_free_ext(struct mbuf *m) KASSERT(mref->m_ext.ext_free != NULL, ("%s: ext_free not set", __func__)); mref->m_ext.ext_free(mref); - uma_zfree(zone_mbuf, mref); + m_free_raw(mref); break; case EXT_EXTREF: KASSERT(m->m_ext.ext_free != NULL, @@ -1230,7 +1230,7 @@ mb_free_ext(struct mbuf *m) } if (freembuf && m != mref) - uma_zfree(zone_mbuf, m); + m_free_raw(m); } /* @@ -1268,11 +1268,11 @@ mb_free_extpg(struct mbuf *m) ktls_enqueue_to_free(mref); else #endif - uma_zfree(zone_mbuf, mref); + m_free_raw(mref); } if (m != mref) - uma_zfree(zone_mbuf, m); + m_free_raw(m); } /* @@ -1364,7 +1364,7 @@ m_get2(int size, int how, short type, int flags) n = uma_zalloc_arg(zone_jumbop, m, how); if (n == NULL) { - uma_zfree(zone_mbuf, m); + m_free_raw(m); return (NULL); } @@ -1395,7 +1395,7 @@ m_getjcl(int how, short type, int flags, int size) zone = m_getzone(size); n = uma_zalloc_arg(zone, m, how); if (n == NULL) { - uma_zfree(zone_mbuf, m); + m_free_raw(m); return (NULL); } MBUF_PROBE5(m__getjcl, how, type, flags, size, m); From owner-dev-commits-src-main@freebsd.org Wed Jul 7 11:08:15 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 18062653836; Wed, 7 Jul 2021 11:08:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GKc9C04wYz4fNB; Wed, 7 Jul 2021 11:08:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D5C374074; Wed, 7 Jul 2021 11:08:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 167B8EYI032129; Wed, 7 Jul 2021 11:08:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 167B8E3U032128; Wed, 7 Jul 2021 11:08:14 GMT (envelope-from git) Date: Wed, 7 Jul 2021 11:08:14 GMT Message-Id: <202107071108.167B8E3U032128@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: c2c34ee5401d - main - mbuf: add m_get_raw and m_gethdr_raw MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c2c34ee5401d8772165707e2c80beddf8a7d60df Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 11:08:15 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=c2c34ee5401d8772165707e2c80beddf8a7d60df commit c2c34ee5401d8772165707e2c80beddf8a7d60df Author: Mateusz Guzik AuthorDate: 2021-07-06 18:51:20 +0000 Commit: Mateusz Guzik CommitDate: 2021-07-07 11:05:46 +0000 mbuf: add m_get_raw and m_gethdr_raw The intent is to eliminate the MT_NOINIT flag and consequently a branch from the constructor. Reviewed by: gallatin Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31080 --- sys/kern/uipc_mbuf.c | 10 ++++++++++ sys/sys/mbuf.h | 28 ++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c index b9e716b411be..74c8ef62eb8d 100644 --- a/sys/kern/uipc_mbuf.c +++ b/sys/kern/uipc_mbuf.c @@ -62,11 +62,21 @@ SDT_PROBE_DEFINE5_XLATE(sdt, , , m__init, "uint32_t", "uint32_t", "uint32_t", "uint32_t"); +SDT_PROBE_DEFINE3_XLATE(sdt, , , m__gethdr_raw, + "uint32_t", "uint32_t", + "uint16_t", "uint16_t", + "struct mbuf *", "mbufinfo_t *"); + SDT_PROBE_DEFINE3_XLATE(sdt, , , m__gethdr, "uint32_t", "uint32_t", "uint16_t", "uint16_t", "struct mbuf *", "mbufinfo_t *"); +SDT_PROBE_DEFINE3_XLATE(sdt, , , m__get_raw, + "uint32_t", "uint32_t", + "uint16_t", "uint16_t", + "struct mbuf *", "mbufinfo_t *"); + SDT_PROBE_DEFINE3_XLATE(sdt, , , m__get, "uint32_t", "uint32_t", "uint16_t", "uint16_t", diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h index 1dac5fcf32b7..2936966f6acc 100644 --- a/sys/sys/mbuf.h +++ b/sys/sys/mbuf.h @@ -62,7 +62,9 @@ SDT_PROBE5(sdt, , , probe, arg0, arg1, arg2, arg3, arg4) SDT_PROBE_DECLARE(sdt, , , m__init); +SDT_PROBE_DECLARE(sdt, , , m__gethdr_raw); SDT_PROBE_DECLARE(sdt, , , m__gethdr); +SDT_PROBE_DECLARE(sdt, , , m__get_raw); SDT_PROBE_DECLARE(sdt, , , m__get); SDT_PROBE_DECLARE(sdt, , , m__getcl); SDT_PROBE_DECLARE(sdt, , , m__getjcl); @@ -956,6 +958,19 @@ m_init(struct mbuf *m, int how, short type, int flags) return (error); } +static __inline struct mbuf * +m_get_raw(int how, short type) +{ + struct mbuf *m; + struct mb_args args; + + args.flags = 0; + args.type = type | MT_NOINIT; + m = uma_zalloc_arg(zone_mbuf, &args, how); + MBUF_PROBE3(m__get_raw, how, type, m); + return (m); +} + static __inline struct mbuf * m_get(int how, short type) { @@ -969,6 +984,19 @@ m_get(int how, short type) return (m); } +static __inline struct mbuf * +m_gethdr_raw(int how, short type) +{ + struct mbuf *m; + struct mb_args args; + + args.flags = M_PKTHDR; + args.type = type | MT_NOINIT; + m = uma_zalloc_arg(zone_mbuf, &args, how); + MBUF_PROBE3(m__gethdr_raw, how, type, m); + return (m); +} + static __inline struct mbuf * m_gethdr(int how, short type) { From owner-dev-commits-src-main@freebsd.org Wed Jul 7 11:08:16 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5B2486539AE; Wed, 7 Jul 2021 11:08:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GKc9D0xrmz4fHh; Wed, 7 Jul 2021 11:08:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 066103E77; Wed, 7 Jul 2021 11:08:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 167B8FoE032153; Wed, 7 Jul 2021 11:08:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 167B8FiO032152; Wed, 7 Jul 2021 11:08:15 GMT (envelope-from git) Date: Wed, 7 Jul 2021 11:08:15 GMT Message-Id: <202107071108.167B8FiO032152@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: a56888534d96 - main - iflib: use m_gethdr_raw MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a56888534d96641af97e6d659d8ecf5a054204c2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 11:08:16 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=a56888534d96641af97e6d659d8ecf5a054204c2 commit a56888534d96641af97e6d659d8ecf5a054204c2 Author: Mateusz Guzik AuthorDate: 2021-07-06 18:52:48 +0000 Commit: Mateusz Guzik CommitDate: 2021-07-07 11:05:46 +0000 iflib: use m_gethdr_raw Reviewed by: gallatin Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31081 --- sys/net/iflib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/net/iflib.c b/sys/net/iflib.c index 0b36e880e15e..abd6bd32cd4e 100644 --- a/sys/net/iflib.c +++ b/sys/net/iflib.c @@ -2122,7 +2122,7 @@ iflib_fl_refill(if_ctx_t ctx, iflib_fl_t fl, int count) BUS_DMASYNC_PREREAD); if (sd_m[frag_idx] == NULL) { - m = m_gethdr(M_NOWAIT, MT_NOINIT); + m = m_gethdr_raw(M_NOWAIT, 0); if (__predict_false(m == NULL)) break; sd_m[frag_idx] = m; From owner-dev-commits-src-main@freebsd.org Wed Jul 7 11:08:17 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B4CB56535CC; Wed, 7 Jul 2021 11:08:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GKc9F2FZzz4f9C; Wed, 7 Jul 2021 11:08:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 33BE03E78; Wed, 7 Jul 2021 11:08:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 167B8HS3032184; Wed, 7 Jul 2021 11:08:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 167B8HFH032183; Wed, 7 Jul 2021 11:08:17 GMT (envelope-from git) Date: Wed, 7 Jul 2021 11:08:17 GMT Message-Id: <202107071108.167B8HFH032183@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: edcf1054d3fb - main - cxgb: use m_gethdr_raw MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: edcf1054d3fb4772ade6a2c0b7afd9e28672385d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 11:08:17 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=edcf1054d3fb4772ade6a2c0b7afd9e28672385d commit edcf1054d3fb4772ade6a2c0b7afd9e28672385d Author: Mateusz Guzik AuthorDate: 2021-07-07 07:38:23 +0000 Commit: Mateusz Guzik CommitDate: 2021-07-07 11:05:46 +0000 cxgb: use m_gethdr_raw Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/dev/cxgb/cxgb_sge.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/cxgb/cxgb_sge.c b/sys/dev/cxgb/cxgb_sge.c index 0d415d94224f..eb9d8f51dcd3 100644 --- a/sys/dev/cxgb/cxgb_sge.c +++ b/sys/dev/cxgb/cxgb_sge.c @@ -727,7 +727,7 @@ refill_fl(adapter_t *sc, struct sge_fl *q, int n) } else { if ((cl = m_cljget(NULL, M_NOWAIT, q->buf_size)) == NULL) break; - if ((m = m_gethdr(M_NOWAIT, MT_NOINIT)) == NULL) { + if ((m = m_gethdr_raw(M_NOWAIT, 0)) == NULL) { uma_zfree(q->zone, cl); break; } From owner-dev-commits-src-main@freebsd.org Wed Jul 7 11:12:29 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 642FE654245; Wed, 7 Jul 2021 11:12:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GKcG52SZVz4gH2; Wed, 7 Jul 2021 11:12:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3D11745E8; Wed, 7 Jul 2021 11:12:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 167BCT5d045422; Wed, 7 Jul 2021 11:12:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 167BCT9e045421; Wed, 7 Jul 2021 11:12:29 GMT (envelope-from git) Date: Wed, 7 Jul 2021 11:12:29 GMT Message-Id: <202107071112.167BCT9e045421@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 71ab344524a1 - main - Add sv_onexec_old() sysent hook for exec event MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 71ab344524a14f00f21c4c5638906d7b965d2b64 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 11:12:29 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=71ab344524a14f00f21c4c5638906d7b965d2b64 commit 71ab344524a14f00f21c4c5638906d7b965d2b64 Author: Konstantin Belousov AuthorDate: 2021-07-01 18:04:06 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-07 11:12:07 +0000 Add sv_onexec_old() sysent hook for exec event Unlike sv_onexec(), it is called from the old (pre-exec) sysentvec structure. The old vmspace for the process is still intact during the call. Reviewed by: dchagin, markj Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D30987 --- sys/kern/kern_exec.c | 2 ++ sys/sys/sysent.h | 1 + 2 files changed, 3 insertions(+) diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index c3c23f44189e..763196a593e4 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -1064,6 +1064,8 @@ exec_new_vmspace(struct image_params *imgp, struct sysentvec *sv) sigfastblock_clear(td); umtx_exec(p); + if (p->p_sysent->sv_onexec_old != NULL) + p->p_sysent->sv_onexec_old(td); itimers_exec(p); if (sv->sv_onexec != NULL) sv->sv_onexec(p, imgp); diff --git a/sys/sys/sysent.h b/sys/sys/sysent.h index e0e5e351ae20..869c140c06f5 100644 --- a/sys/sys/sysent.h +++ b/sys/sys/sysent.h @@ -150,6 +150,7 @@ struct sysentvec { u_long *sv_hwcap2; /* Value passed in AT_HWCAP2. */ const char *(*sv_machine_arch)(struct proc *); vm_offset_t sv_fxrng_gen_base; + void (*sv_onexec_old)(struct thread *td); void (*sv_onexec)(struct proc *, struct image_params *); void (*sv_onexit)(struct proc *); void (*sv_ontdexit)(struct thread *td); From owner-dev-commits-src-main@freebsd.org Wed Jul 7 11:12:30 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8C57E654421; Wed, 7 Jul 2021 11:12:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GKcG63TYGz4gR0; Wed, 7 Jul 2021 11:12:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5F75644BB; Wed, 7 Jul 2021 11:12:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 167BCUu5045446; Wed, 7 Jul 2021 11:12:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 167BCUMP045445; Wed, 7 Jul 2021 11:12:30 GMT (envelope-from git) Date: Wed, 7 Jul 2021 11:12:30 GMT Message-Id: <202107071112.167BCUMP045445@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 55976ce11a10 - main - Move sv_onexit() sysentvec hook slightly later MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 55976ce11a10765dee6c71b7ed6eac016bd560ef Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 11:12:30 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=55976ce11a10765dee6c71b7ed6eac016bd560ef commit 55976ce11a10765dee6c71b7ed6eac016bd560ef Author: Konstantin Belousov AuthorDate: 2021-07-01 18:06:42 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-07 11:12:07 +0000 Move sv_onexit() sysentvec hook slightly later after itimers are stopped. This makes it more usable for e.g. native FreeBSD ABI sysentvecs. Reviewed by: dchagin, markj Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D30987 --- sys/kern/kern_exit.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index fcd8b39a8ee2..515c2d4e6397 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -340,9 +340,6 @@ exit1(struct thread *td, int rval, int signo) itimers_exit(p); - if (p->p_sysent->sv_onexit != NULL) - p->p_sysent->sv_onexit(p); - /* * Check if any loadable modules need anything done at process exit. * E.g. SYSV IPC stuff. @@ -374,6 +371,8 @@ exit1(struct thread *td, int rval, int signo) PROC_UNLOCK(p); umtx_thread_exit(td); + if (p->p_sysent->sv_onexit != NULL) + p->p_sysent->sv_onexit(p); seltdfini(td); /* From owner-dev-commits-src-main@freebsd.org Wed Jul 7 11:12:32 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 18B8B6543DF; Wed, 7 Jul 2021 11:12:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GKcG75RdGz4gR9; Wed, 7 Jul 2021 11:12:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8564344BC; Wed, 7 Jul 2021 11:12:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 167BCVn9045470; Wed, 7 Jul 2021 11:12:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 167BCVtx045469; Wed, 7 Jul 2021 11:12:31 GMT (envelope-from git) Date: Wed, 7 Jul 2021 11:12:31 GMT Message-Id: <202107071112.167BCVtx045469@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 28a66fc3da34 - main - Do not call FreeBSD-ABI specific code for all ABIs MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 28a66fc3da3460850520389971e1194f5327f560 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 11:12:32 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=28a66fc3da3460850520389971e1194f5327f560 commit 28a66fc3da3460850520389971e1194f5327f560 Author: Konstantin Belousov AuthorDate: 2021-07-01 18:00:29 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-07 11:12:07 +0000 Do not call FreeBSD-ABI specific code for all ABIs Use sysentvec hooks to only call umtx_thread_exit/umtx_exec, which handle robust mutexes, for native FreeBSD ABI. Similarly, there is no sense in calling sigfastblock_clear() for non-native ABIs. Requested by: dchagin Reviewed by: dchagin, markj (previous version) Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D30987 --- sys/amd64/amd64/elf_machdep.c | 4 ++++ sys/arm/arm/elf_machdep.c | 2 ++ sys/arm64/arm64/elf32_machdep.c | 2 ++ sys/arm64/arm64/elf_machdep.c | 2 ++ sys/compat/ia32/ia32_sysvec.c | 2 ++ sys/i386/i386/elf_machdep.c | 2 ++ sys/kern/imgact_aout.c | 4 ++++ sys/kern/kern_exec.c | 9 +++++++-- sys/kern/kern_exit.c | 8 +++++++- sys/mips/mips/elf_machdep.c | 2 ++ sys/powerpc/powerpc/elf32_machdep.c | 2 ++ sys/powerpc/powerpc/elf64_machdep.c | 4 ++++ sys/riscv/riscv/elf_machdep.c | 2 ++ sys/sys/sysent.h | 3 +++ 14 files changed, 45 insertions(+), 3 deletions(-) diff --git a/sys/amd64/amd64/elf_machdep.c b/sys/amd64/amd64/elf_machdep.c index a7cef2a8d92a..80f7d1d8cefa 100644 --- a/sys/amd64/amd64/elf_machdep.c +++ b/sys/amd64/amd64/elf_machdep.c @@ -85,6 +85,8 @@ struct sysentvec elf64_freebsd_sysvec_la48 = { .sv_thread_detach = NULL, .sv_trap = NULL, .sv_stackgap = elf64_stackgap, + .sv_onexec_old = exec_onexec_old, + .sv_onexit = exit_onexit, }; struct sysentvec elf64_freebsd_sysvec_la57 = { @@ -123,6 +125,8 @@ struct sysentvec elf64_freebsd_sysvec_la57 = { .sv_thread_detach = NULL, .sv_trap = NULL, .sv_stackgap = elf64_stackgap, + .sv_onexec_old = exec_onexec_old, + .sv_onexit = exit_onexit, }; static void diff --git a/sys/arm/arm/elf_machdep.c b/sys/arm/arm/elf_machdep.c index c67cd225a1af..64e347ce7649 100644 --- a/sys/arm/arm/elf_machdep.c +++ b/sys/arm/arm/elf_machdep.c @@ -100,6 +100,8 @@ struct sysentvec elf32_freebsd_sysvec = { .sv_trap = NULL, .sv_hwcap = &elf_hwcap, .sv_hwcap2 = &elf_hwcap2, + .sv_onexec_old = exec_onexec_old, + .sv_onexit = exit_onexit, }; INIT_SYSENTVEC(elf32_sysvec, &elf32_freebsd_sysvec); diff --git a/sys/arm64/arm64/elf32_machdep.c b/sys/arm64/arm64/elf32_machdep.c index 5321e12d74e9..206413b45172 100644 --- a/sys/arm64/arm64/elf32_machdep.c +++ b/sys/arm64/arm64/elf32_machdep.c @@ -112,6 +112,8 @@ static struct sysentvec elf32_freebsd_sysvec = { .sv_schedtail = NULL, .sv_thread_detach = NULL, .sv_trap = NULL, + .sv_onexec_old = exec_onexec_old, + .sv_onexit = exit_onexit, }; INIT_SYSENTVEC(elf32_sysvec, &elf32_freebsd_sysvec); diff --git a/sys/arm64/arm64/elf_machdep.c b/sys/arm64/arm64/elf_machdep.c index 82ecdf894911..eafaf4150dff 100644 --- a/sys/arm64/arm64/elf_machdep.c +++ b/sys/arm64/arm64/elf_machdep.c @@ -95,6 +95,8 @@ static struct sysentvec elf64_freebsd_sysvec = { .sv_trap = NULL, .sv_hwcap = &elf_hwcap, .sv_hwcap2 = &elf_hwcap2, + .sv_onexec_old = exec_onexec_old, + .sv_onexit = exit_onexit, }; INIT_SYSENTVEC(elf64_sysvec, &elf64_freebsd_sysvec); diff --git a/sys/compat/ia32/ia32_sysvec.c b/sys/compat/ia32/ia32_sysvec.c index 2b019e3b0323..df8a36a34810 100644 --- a/sys/compat/ia32/ia32_sysvec.c +++ b/sys/compat/ia32/ia32_sysvec.c @@ -131,6 +131,8 @@ struct sysentvec ia32_freebsd_sysvec = { .sv_thread_detach = NULL, .sv_trap = NULL, .sv_stackgap = elf32_stackgap, + .sv_onexec_old = exec_onexec_old, + .sv_onexit = exit_onexit, }; INIT_SYSENTVEC(elf_ia32_sysvec, &ia32_freebsd_sysvec); diff --git a/sys/i386/i386/elf_machdep.c b/sys/i386/i386/elf_machdep.c index cb7b5617715c..5858c8382e33 100644 --- a/sys/i386/i386/elf_machdep.c +++ b/sys/i386/i386/elf_machdep.c @@ -86,6 +86,8 @@ struct sysentvec elf32_freebsd_sysvec = { .sv_schedtail = NULL, .sv_thread_detach = NULL, .sv_trap = NULL, + .sv_onexec_old = exec_onexec_old, + .sv_onexit = exit_onexit, }; INIT_SYSENTVEC(elf32_sysvec, &elf32_freebsd_sysvec); diff --git a/sys/kern/imgact_aout.c b/sys/kern/imgact_aout.c index 3255ef169f70..9e7455e14e1d 100644 --- a/sys/kern/imgact_aout.c +++ b/sys/kern/imgact_aout.c @@ -101,6 +101,8 @@ struct sysentvec aout_sysvec = { .sv_schedtail = NULL, .sv_thread_detach = NULL, .sv_trap = NULL, + .sv_onexec_old = exec_onexec_old, + .sv_onexit = exit_onexit, }; #elif defined(__amd64__) @@ -137,6 +139,8 @@ struct sysentvec aout_sysvec = { .sv_set_syscall_retval = ia32_set_syscall_retval, .sv_fetch_syscall_args = ia32_fetch_syscall_args, .sv_syscallnames = freebsd32_syscallnames, + .sv_onexec_old = exec_onexec_old, + .sv_onexit = exit_onexit, }; #else #error "Port me" diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index 763196a593e4..edb4ad1af3c1 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -1040,6 +1040,13 @@ exec_unmap_first_page(struct image_params *imgp) } } +void +exec_onexec_old(struct thread *td) +{ + sigfastblock_clear(td); + umtx_exec(td->td_proc); +} + /* * Destroy old address space, and allocate a new stack. * The new stack is only sgrowsiz large because it is grown @@ -1062,8 +1069,6 @@ exec_new_vmspace(struct image_params *imgp, struct sysentvec *sv) imgp->vmspace_destroyed = 1; imgp->sysent = sv; - sigfastblock_clear(td); - umtx_exec(p); if (p->p_sysent->sv_onexec_old != NULL) p->p_sysent->sv_onexec_old(td); itimers_exec(p); diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index 515c2d4e6397..bfd25366b49c 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -195,6 +195,13 @@ proc_clear_orphan(struct proc *p) p->p_treeflag &= ~P_TREE_ORPHANED; } +void +exit_onexit(struct proc *p) +{ + MPASS(p->p_numthreads == 1); + umtx_thread_exit(FIRST_THREAD_IN_PROC(p)); +} + /* * exit -- death of process. */ @@ -370,7 +377,6 @@ exit1(struct thread *td, int rval, int signo) PROC_UNLOCK(p); - umtx_thread_exit(td); if (p->p_sysent->sv_onexit != NULL) p->p_sysent->sv_onexit(p); seltdfini(td); diff --git a/sys/mips/mips/elf_machdep.c b/sys/mips/mips/elf_machdep.c index 9df6d1d36436..c6a45f71107b 100644 --- a/sys/mips/mips/elf_machdep.c +++ b/sys/mips/mips/elf_machdep.c @@ -91,6 +91,8 @@ static struct sysentvec elf_freebsd_sysvec = { .sv_schedtail = NULL, .sv_thread_detach = NULL, .sv_trap = NULL, + .sv_onexec_old = exec_onexec_old, + .sv_onexit = exit_onexit, }; static __ElfN(Brandinfo) freebsd_brand_info = { diff --git a/sys/powerpc/powerpc/elf32_machdep.c b/sys/powerpc/powerpc/elf32_machdep.c index 2c4928f7d9df..341352fdd589 100644 --- a/sys/powerpc/powerpc/elf32_machdep.c +++ b/sys/powerpc/powerpc/elf32_machdep.c @@ -134,6 +134,8 @@ struct sysentvec elf32_freebsd_sysvec = { .sv_trap = NULL, .sv_hwcap = &cpu_features, .sv_hwcap2 = &cpu_features2, + .sv_onexec_old = exec_onexec_old, + .sv_onexit = exit_onexit, }; INIT_SYSENTVEC(elf32_sysvec, &elf32_freebsd_sysvec); diff --git a/sys/powerpc/powerpc/elf64_machdep.c b/sys/powerpc/powerpc/elf64_machdep.c index 38f76c158793..dca1ec6bb535 100644 --- a/sys/powerpc/powerpc/elf64_machdep.c +++ b/sys/powerpc/powerpc/elf64_machdep.c @@ -96,6 +96,8 @@ struct sysentvec elf64_freebsd_sysvec_v1 = { .sv_trap = NULL, .sv_hwcap = &cpu_features, .sv_hwcap2 = &cpu_features2, + .sv_onexec_old = exec_onexec_old, + .sv_onexit = exit_onexit, }; struct sysentvec elf64_freebsd_sysvec_v2 = { @@ -135,6 +137,8 @@ struct sysentvec elf64_freebsd_sysvec_v2 = { .sv_trap = NULL, .sv_hwcap = &cpu_features, .sv_hwcap2 = &cpu_features2, + .sv_onexec_old = exec_onexec_old, + .sv_onexit = exit_onexit, }; static boolean_t ppc64_elfv1_header_match(struct image_params *params, diff --git a/sys/riscv/riscv/elf_machdep.c b/sys/riscv/riscv/elf_machdep.c index 2a355a977800..8cb1355708d2 100644 --- a/sys/riscv/riscv/elf_machdep.c +++ b/sys/riscv/riscv/elf_machdep.c @@ -99,6 +99,8 @@ struct sysentvec elf64_freebsd_sysvec = { .sv_trap = NULL, .sv_hwcap = &elf_hwcap, .sv_machine_arch = riscv_machine_arch, + .sv_onexec_old = exec_onexec_old, + .sv_onexit = exit_onexit, }; INIT_SYSENTVEC(elf64_sysvec, &elf64_freebsd_sysvec); diff --git a/sys/sys/sysent.h b/sys/sys/sysent.h index 869c140c06f5..f0bb084d59dc 100644 --- a/sys/sys/sysent.h +++ b/sys/sys/sysent.h @@ -322,6 +322,9 @@ void exec_sysvec_init(void *param); void exec_sysvec_init_secondary(struct sysentvec *sv, struct sysentvec *sv2); void exec_inittk(void); +void exit_onexit(struct proc *p); +void exec_onexec_old(struct thread *td); + #define INIT_SYSENTVEC(name, sv) \ SYSINIT(name, SI_SUB_EXEC, SI_ORDER_ANY, \ (sysinit_cfunc_t)exec_sysvec_init, sv); From owner-dev-commits-src-main@freebsd.org Wed Jul 7 11:12:33 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 294E0654514; Wed, 7 Jul 2021 11:12:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GKcG85fqjz4g7Z; Wed, 7 Jul 2021 11:12:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A3E3A44BD; Wed, 7 Jul 2021 11:12:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 167BCWhk045494; Wed, 7 Jul 2021 11:12:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 167BCWhd045493; Wed, 7 Jul 2021 11:12:32 GMT (envelope-from git) Date: Wed, 7 Jul 2021 11:12:32 GMT Message-Id: <202107071112.167BCWhd045493@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 747a6b7ace3d - main - cloudabi and linux ABIs: do not call umtx_thread_cleanup() from thr_exit syscall MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 747a6b7ace3dd9401289bde8c4e7fc91b8dc18dc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 11:12:33 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=747a6b7ace3dd9401289bde8c4e7fc91b8dc18dc commit 747a6b7ace3dd9401289bde8c4e7fc91b8dc18dc Author: Konstantin Belousov AuthorDate: 2021-07-01 22:30:59 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-07 11:12:14 +0000 cloudabi and linux ABIs: do not call umtx_thread_cleanup() from thr_exit syscall These ABIs do not use umtx at all, so there is nothing to clean. Cloudabi references to umtx keys do not require any cleanups anyway. Requested by: dchagin Reviewed by: dchagin, markj Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D30987 --- sys/compat/cloudabi/cloudabi_thread.c | 3 --- sys/compat/linux/linux_fork.c | 3 --- 2 files changed, 6 deletions(-) diff --git a/sys/compat/cloudabi/cloudabi_thread.c b/sys/compat/cloudabi/cloudabi_thread.c index e70549b6e332..f920b8b41ee8 100644 --- a/sys/compat/cloudabi/cloudabi_thread.c +++ b/sys/compat/cloudabi/cloudabi_thread.c @@ -30,7 +30,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include @@ -45,8 +44,6 @@ cloudabi_sys_thread_exit(struct thread *td, .scope = uap->scope, }; - umtx_thread_exit(td); - /* Wake up joining thread. */ cloudabi_sys_lock_unlock(td, &cloudabi_sys_lock_unlock_args); diff --git a/sys/compat/linux/linux_fork.c b/sys/compat/linux/linux_fork.c index ed4adcf8a175..8230d5b4108b 100644 --- a/sys/compat/linux/linux_fork.c +++ b/sys/compat/linux/linux_fork.c @@ -45,7 +45,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include @@ -376,8 +375,6 @@ linux_exit(struct thread *td, struct linux_exit_args *args) LINUX_CTR2(exit, "thread(%d) (%d)", em->em_tid, args->rval); - umtx_thread_exit(td); - linux_thread_detach(td); /* From owner-dev-commits-src-main@freebsd.org Wed Jul 7 11:22:41 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0CDC3654A0F; Wed, 7 Jul 2021 11:22:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GKcTr6yHTz4hM8; Wed, 7 Jul 2021 11:22:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D74174900; Wed, 7 Jul 2021 11:22:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 167BMexV059362; Wed, 7 Jul 2021 11:22:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 167BMe50059361; Wed, 7 Jul 2021 11:22:40 GMT (envelope-from git) Date: Wed, 7 Jul 2021 11:22:40 GMT Message-Id: <202107071122.167BMe50059361@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Randall Stewart Subject: git: d7955cc0ffdf - main - tcp: HPTS performance enhancements MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rrs X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d7955cc0ffdf9fb58013245a6f181c757574ea0a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 11:22:41 -0000 The branch main has been updated by rrs: URL: https://cgit.FreeBSD.org/src/commit/?id=d7955cc0ffdf9fb58013245a6f181c757574ea0a commit d7955cc0ffdf9fb58013245a6f181c757574ea0a Author: Randall Stewart AuthorDate: 2021-07-06 19:23:22 +0000 Commit: Randall Stewart CommitDate: 2021-07-07 11:22:35 +0000 tcp: HPTS performance enhancements HPTS drives both rack and bbr, and yet there have been many complaints about performance. This bit of work restructures hpts to help reduce CPU overhead. It does this by now instead of relying on the timer/callout to drive it instead use user return from a system call as well as lro flushes to drive hpts. The timer becomes a backstop that dynamically adjusts based on how "late" we are. Reviewed by: tuexen, glebius Sponsored by: Netflix Inc. Differential Revision: https://reviews.freebsd.org/D31083 --- sys/kern/subr_trap.c | 10 + sys/netinet/in_pcb.h | 4 +- sys/netinet/tcp_hpts.c | 1309 +++++++++++++++++++++++++---------------- sys/netinet/tcp_hpts.h | 99 +++- sys/netinet/tcp_lro.c | 28 +- sys/netinet/tcp_lro.h | 10 +- sys/netinet/tcp_stacks/bbr.c | 6 +- sys/netinet/tcp_stacks/rack.c | 22 +- 8 files changed, 931 insertions(+), 557 deletions(-) diff --git a/sys/kern/subr_trap.c b/sys/kern/subr_trap.c index 8981091b50ed..d0f616d037c5 100644 --- a/sys/kern/subr_trap.c +++ b/sys/kern/subr_trap.c @@ -140,6 +140,16 @@ userret(struct thread *td, struct trapframe *frame) #ifdef HWPMC_HOOKS if (PMC_THREAD_HAS_SAMPLES(td)) PMC_CALL_HOOK(td, PMC_FN_THR_USERRET, NULL); +#endif +#ifdef TCPHPTS + /* + * @gallatin is adament that this needs to go here, I + * am not so sure. Running hpts is a lot like + * a lro_flush() that happens while a user process + * is running. But he may know best so I will go + * with his view of accounting. :-) + */ + tcp_run_hpts(); #endif /* * Let the scheduler adjust our priority etc. diff --git a/sys/netinet/in_pcb.h b/sys/netinet/in_pcb.h index 923c5ba4edff..c20c516628b8 100644 --- a/sys/netinet/in_pcb.h +++ b/sys/netinet/in_pcb.h @@ -258,6 +258,7 @@ struct inpcb { volatile uint32_t inp_in_input; /* on input hpts (lock b) */ #endif volatile uint16_t inp_hpts_cpu; /* Lock (i) */ + volatile uint16_t inp_irq_cpu; /* Set by LRO in behalf of or the driver */ u_int inp_refcount; /* (i) refcount */ int inp_flags; /* (i) generic IP/datagram flags */ int inp_flags2; /* (i) generic IP/datagram flags #2*/ @@ -266,7 +267,8 @@ struct inpcb { inp_input_cpu_set : 1, /* on input hpts (i) */ inp_hpts_calls :1, /* (i) from output hpts */ inp_input_calls :1, /* (i) from input hpts */ - inp_spare_bits2 : 4; + inp_irq_cpu_set :1, /* (i) from LRO/Driver */ + inp_spare_bits2 : 3; uint8_t inp_numa_domain; /* numa domain */ void *inp_ppcb; /* (i) pointer to per-protocol pcb */ struct socket *inp_socket; /* (i) back pointer to socket */ diff --git a/sys/netinet/tcp_hpts.c b/sys/netinet/tcp_hpts.c index fd8b66b9ccdb..9a390e3a85c8 100644 --- a/sys/netinet/tcp_hpts.c +++ b/sys/netinet/tcp_hpts.c @@ -193,23 +193,29 @@ static int tcp_bind_threads = 1; #else static int tcp_bind_threads = 2; #endif -TUNABLE_INT("net.inet.tcp.bind_hptss", &tcp_bind_threads); - +static int tcp_use_irq_cpu = 0; static struct tcp_hptsi tcp_pace; +static uint32_t *cts_last_ran; static int hpts_does_tp_logging = 0; +static int hpts_use_assigned_cpu = 1; +static int32_t hpts_uses_oldest = OLDEST_THRESHOLD; -static void tcp_wakehpts(struct tcp_hpts_entry *p); -static void tcp_wakeinput(struct tcp_hpts_entry *p); static void tcp_input_data(struct tcp_hpts_entry *hpts, struct timeval *tv); -static void tcp_hptsi(struct tcp_hpts_entry *hpts); +static int32_t tcp_hptsi(struct tcp_hpts_entry *hpts, int from_callout); static void tcp_hpts_thread(void *ctx); static void tcp_init_hptsi(void *st); int32_t tcp_min_hptsi_time = DEFAULT_MIN_SLEEP; -static int32_t tcp_hpts_callout_skip_swi = 0; +static int conn_cnt_thresh = DEFAULT_CONNECTION_THESHOLD; +static int32_t dynamic_min_sleep = DYNAMIC_MIN_SLEEP; +static int32_t dynamic_max_sleep = DYNAMIC_MAX_SLEEP; + + SYSCTL_NODE(_net_inet_tcp, OID_AUTO, hpts, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, "TCP Hpts controls"); +SYSCTL_NODE(_net_inet_tcp_hpts, OID_AUTO, stats, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, + "TCP Hpts statistics"); #define timersub(tvp, uvp, vvp) \ do { \ @@ -230,44 +236,92 @@ struct hpts_domain_info { struct hpts_domain_info hpts_domains[MAXMEMDOM]; -SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, precision, CTLFLAG_RW, - &tcp_hpts_precision, 120, - "Value for PRE() precision of callout"); - counter_u64_t hpts_hopelessly_behind; -SYSCTL_COUNTER_U64(_net_inet_tcp_hpts, OID_AUTO, hopeless, CTLFLAG_RD, +SYSCTL_COUNTER_U64(_net_inet_tcp_hpts_stats, OID_AUTO, hopeless, CTLFLAG_RD, &hpts_hopelessly_behind, "Number of times hpts could not catch up and was behind hopelessly"); counter_u64_t hpts_loops; -SYSCTL_COUNTER_U64(_net_inet_tcp_hpts, OID_AUTO, loops, CTLFLAG_RD, +SYSCTL_COUNTER_U64(_net_inet_tcp_hpts_stats, OID_AUTO, loops, CTLFLAG_RD, &hpts_loops, "Number of times hpts had to loop to catch up"); counter_u64_t back_tosleep; -SYSCTL_COUNTER_U64(_net_inet_tcp_hpts, OID_AUTO, no_tcbsfound, CTLFLAG_RD, +SYSCTL_COUNTER_U64(_net_inet_tcp_hpts_stats, OID_AUTO, no_tcbsfound, CTLFLAG_RD, &back_tosleep, "Number of times hpts found no tcbs"); counter_u64_t combined_wheel_wrap; -SYSCTL_COUNTER_U64(_net_inet_tcp_hpts, OID_AUTO, comb_wheel_wrap, CTLFLAG_RD, +SYSCTL_COUNTER_U64(_net_inet_tcp_hpts_stats, OID_AUTO, comb_wheel_wrap, CTLFLAG_RD, &combined_wheel_wrap, "Number of times the wheel lagged enough to have an insert see wrap"); counter_u64_t wheel_wrap; -SYSCTL_COUNTER_U64(_net_inet_tcp_hpts, OID_AUTO, wheel_wrap, CTLFLAG_RD, +SYSCTL_COUNTER_U64(_net_inet_tcp_hpts_stats, OID_AUTO, wheel_wrap, CTLFLAG_RD, &wheel_wrap, "Number of times the wheel lagged enough to have an insert see wrap"); -static int32_t out_ts_percision = 0; +counter_u64_t hpts_direct_call; +SYSCTL_COUNTER_U64(_net_inet_tcp_hpts_stats, OID_AUTO, direct_call, CTLFLAG_RD, + &hpts_direct_call, "Number of times hpts was called by syscall/trap or other entry"); + +counter_u64_t hpts_wake_timeout; + +SYSCTL_COUNTER_U64(_net_inet_tcp_hpts_stats, OID_AUTO, timeout_wakeup, CTLFLAG_RD, + &hpts_wake_timeout, "Number of times hpts threads woke up via the callout expiring"); + +counter_u64_t hpts_direct_awakening; + +SYSCTL_COUNTER_U64(_net_inet_tcp_hpts_stats, OID_AUTO, direct_awakening, CTLFLAG_RD, + &hpts_direct_awakening, "Number of times hpts threads woke up via the callout expiring"); -SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, out_tspercision, CTLFLAG_RW, - &out_ts_percision, 0, - "Do we use a percise timestamp for every output cts"); +counter_u64_t hpts_back_tosleep; + +SYSCTL_COUNTER_U64(_net_inet_tcp_hpts_stats, OID_AUTO, back_tosleep, CTLFLAG_RD, + &hpts_back_tosleep, "Number of times hpts threads woke up via the callout expiring and went back to sleep no work"); + +counter_u64_t cpu_uses_flowid; +counter_u64_t cpu_uses_random; + +SYSCTL_COUNTER_U64(_net_inet_tcp_hpts_stats, OID_AUTO, cpusel_flowid, CTLFLAG_RD, + &cpu_uses_flowid, "Number of times when setting cpuid we used the flowid field"); +SYSCTL_COUNTER_U64(_net_inet_tcp_hpts_stats, OID_AUTO, cpusel_random, CTLFLAG_RD, + &cpu_uses_random, "Number of times when setting cpuid we used the a random value"); + +TUNABLE_INT("net.inet.tcp.bind_hptss", &tcp_bind_threads); +TUNABLE_INT("net.inet.tcp.use_irq", &tcp_use_irq_cpu); +SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, bind_hptss, CTLFLAG_RD, + &tcp_bind_threads, 2, + "Thread Binding tunable"); +SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, use_irq, CTLFLAG_RD, + &tcp_use_irq_cpu, 0, + "Use of irq CPU tunable"); +SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, precision, CTLFLAG_RW, + &tcp_hpts_precision, 120, + "Value for PRE() precision of callout"); +SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, cnt_thresh, CTLFLAG_RW, + &conn_cnt_thresh, 0, + "How many connections (below) make us use the callout based mechanism"); SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, logging, CTLFLAG_RW, &hpts_does_tp_logging, 0, "Do we add to any tp that has logging on pacer logs"); +SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, use_assigned_cpu, CTLFLAG_RW, + &hpts_use_assigned_cpu, 0, + "Do we start any hpts timer on the assigned cpu?"); +SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, use_oldest, CTLFLAG_RW, + &hpts_uses_oldest, OLDEST_THRESHOLD, + "Do syscalls look for the hpts that has been the longest since running (or just use cpu no if 0)?"); +SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, dyn_minsleep, CTLFLAG_RW, + &dynamic_min_sleep, 250, + "What is the dynamic minsleep value?"); +SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, dyn_maxsleep, CTLFLAG_RW, + &dynamic_max_sleep, 5000, + "What is the dynamic maxsleep value?"); + + + + static int32_t max_pacer_loops = 10; SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, loopmax, CTLFLAG_RW, @@ -287,7 +341,7 @@ sysctl_net_inet_tcp_hpts_max_sleep(SYSCTL_HANDLER_ARGS) new = hpts_sleep_max; error = sysctl_handle_int(oidp, &new, 0, req); if (error == 0 && req->newptr) { - if ((new < (NUM_OF_HPTSI_SLOTS / 4)) || + if ((new < dynamic_min_sleep) || (new > HPTS_MAX_SLEEP_ALLOWED)) error = EINVAL; else @@ -296,26 +350,60 @@ sysctl_net_inet_tcp_hpts_max_sleep(SYSCTL_HANDLER_ARGS) return (error); } +static int +sysctl_net_inet_tcp_hpts_min_sleep(SYSCTL_HANDLER_ARGS) +{ + int error; + uint32_t new; + + new = tcp_min_hptsi_time; + error = sysctl_handle_int(oidp, &new, 0, req); + if (error == 0 && req->newptr) { + if (new < LOWEST_SLEEP_ALLOWED) + error = EINVAL; + else + tcp_min_hptsi_time = new; + } + return (error); +} + SYSCTL_PROC(_net_inet_tcp_hpts, OID_AUTO, maxsleep, CTLTYPE_UINT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, &hpts_sleep_max, 0, &sysctl_net_inet_tcp_hpts_max_sleep, "IU", "Maximum time hpts will sleep"); -SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, minsleep, CTLFLAG_RW, +SYSCTL_PROC(_net_inet_tcp_hpts, OID_AUTO, minsleep, + CTLTYPE_UINT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, &tcp_min_hptsi_time, 0, + &sysctl_net_inet_tcp_hpts_min_sleep, "IU", "The minimum time the hpts must sleep before processing more slots"); -SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, skip_swi, CTLFLAG_RW, - &tcp_hpts_callout_skip_swi, 0, - "Do we have the callout call directly to the hpts?"); +static int ticks_indicate_more_sleep = TICKS_INDICATE_MORE_SLEEP; +static int ticks_indicate_less_sleep = TICKS_INDICATE_LESS_SLEEP; +static int tcp_hpts_no_wake_over_thresh = 1; + +SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, more_sleep, CTLFLAG_RW, + &ticks_indicate_more_sleep, 0, + "If we only process this many or less on a timeout, we need longer sleep on the next callout"); +SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, less_sleep, CTLFLAG_RW, + &ticks_indicate_less_sleep, 0, + "If we process this many or more on a timeout, we need less sleep on the next callout"); +SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, nowake_over_thresh, CTLFLAG_RW, + &tcp_hpts_no_wake_over_thresh, 0, + "When we are over the threshold on the pacer do we prohibit wakeups?"); static void tcp_hpts_log(struct tcp_hpts_entry *hpts, struct tcpcb *tp, struct timeval *tv, - int ticks_to_run, int idx) + int slots_to_run, int idx, int from_callout) { union tcp_log_stackspecific log; - + /* + * Unused logs are + * 64 bit - delRate, rttProp, bw_inuse + * 16 bit - cwnd_gain + * 8 bit - bbr_state, bbr_substate, inhpts, ininput; + */ memset(&log.u_bbr, 0, sizeof(log.u_bbr)); log.u_bbr.flex1 = hpts->p_nxt_slot; log.u_bbr.flex2 = hpts->p_cur_slot; @@ -323,8 +411,9 @@ tcp_hpts_log(struct tcp_hpts_entry *hpts, struct tcpcb *tp, struct timeval *tv, log.u_bbr.flex4 = idx; log.u_bbr.flex5 = hpts->p_curtick; log.u_bbr.flex6 = hpts->p_on_queue_cnt; - log.u_bbr.use_lt_bw = 1; - log.u_bbr.inflight = ticks_to_run; + log.u_bbr.flex7 = hpts->p_cpu; + log.u_bbr.flex8 = (uint8_t)from_callout; + log.u_bbr.inflight = slots_to_run; log.u_bbr.applimited = hpts->overidden_sleep; log.u_bbr.delivered = hpts->saved_curtick; log.u_bbr.timeStamp = tcp_tv_to_usectick(tv); @@ -332,7 +421,9 @@ tcp_hpts_log(struct tcp_hpts_entry *hpts, struct tcpcb *tp, struct timeval *tv, log.u_bbr.lt_epoch = hpts->saved_prev_slot; log.u_bbr.pkts_out = hpts->p_delayed_by; log.u_bbr.lost = hpts->p_hpts_sleep_time; - log.u_bbr.cur_del_rate = hpts->p_runningtick; + log.u_bbr.pacing_gain = hpts->p_cpu; + log.u_bbr.pkt_epoch = hpts->p_runningslot; + log.u_bbr.use_lt_bw = 1; TCP_LOG_EVENTP(tp, NULL, &tp->t_inpcb->inp_socket->so_rcv, &tp->t_inpcb->inp_socket->so_snd, @@ -341,47 +432,40 @@ tcp_hpts_log(struct tcp_hpts_entry *hpts, struct tcpcb *tp, struct timeval *tv, } static void -hpts_timeout_swi(void *arg) +tcp_wakehpts(struct tcp_hpts_entry *hpts) { - struct tcp_hpts_entry *hpts; + HPTS_MTX_ASSERT(hpts); - hpts = (struct tcp_hpts_entry *)arg; - swi_sched(hpts->ie_cookie, 0); + if (tcp_hpts_no_wake_over_thresh && (hpts->p_on_queue_cnt >= conn_cnt_thresh)) { + hpts->p_direct_wake = 0; + return; + } + if (hpts->p_hpts_wake_scheduled == 0) { + hpts->p_hpts_wake_scheduled = 1; + swi_sched(hpts->ie_cookie, 0); + } } static void -hpts_timeout_dir(void *arg) +hpts_timeout_swi(void *arg) { - tcp_hpts_thread(arg); + struct tcp_hpts_entry *hpts; + + hpts = (struct tcp_hpts_entry *)arg; + swi_sched(hpts->ie_cookie, 0); } static inline void hpts_sane_pace_remove(struct tcp_hpts_entry *hpts, struct inpcb *inp, struct hptsh *head, int clear) { -#ifdef INVARIANTS - if (mtx_owned(&hpts->p_mtx) == 0) { - /* We don't own the mutex? */ - panic("%s: hpts:%p inp:%p no hpts mutex", __FUNCTION__, hpts, inp); - } - if (hpts->p_cpu != inp->inp_hpts_cpu) { - /* It is not the right cpu/mutex? */ - panic("%s: hpts:%p inp:%p incorrect CPU", __FUNCTION__, hpts, inp); - } - if (inp->inp_in_hpts == 0) { - /* We are not on the hpts? */ - panic("%s: hpts:%p inp:%p not on the hpts?", __FUNCTION__, hpts, inp); - } -#endif + HPTS_MTX_ASSERT(hpts); + KASSERT(hpts->p_cpu == inp->inp_hpts_cpu, ("%s: hpts:%p inp:%p incorrect CPU", __FUNCTION__, hpts, inp)); + KASSERT(inp->inp_in_hpts != 0, ("%s: hpts:%p inp:%p not on the hpts?", __FUNCTION__, hpts, inp)); TAILQ_REMOVE(head, inp, inp_hpts); hpts->p_on_queue_cnt--; - if (hpts->p_on_queue_cnt < 0) { - /* Count should not go negative .. */ -#ifdef INVARIANTS - panic("Hpts goes negative inp:%p hpts:%p", - inp, hpts); -#endif - hpts->p_on_queue_cnt = 0; - } + KASSERT(hpts->p_on_queue_cnt >= 0, + ("Hpts goes negative inp:%p hpts:%p", + inp, hpts)); if (clear) { inp->inp_hpts_request = 0; inp->inp_in_hpts = 0; @@ -391,20 +475,13 @@ hpts_sane_pace_remove(struct tcp_hpts_entry *hpts, struct inpcb *inp, struct hpt static inline void hpts_sane_pace_insert(struct tcp_hpts_entry *hpts, struct inpcb *inp, struct hptsh *head, int line, int noref) { -#ifdef INVARIANTS - if (mtx_owned(&hpts->p_mtx) == 0) { - /* We don't own the mutex? */ - panic("%s: hpts:%p inp:%p no hpts mutex", __FUNCTION__, hpts, inp); - } - if (hpts->p_cpu != inp->inp_hpts_cpu) { - /* It is not the right cpu/mutex? */ - panic("%s: hpts:%p inp:%p incorrect CPU", __FUNCTION__, hpts, inp); - } - if ((noref == 0) && (inp->inp_in_hpts == 1)) { - /* We are already on the hpts? */ - panic("%s: hpts:%p inp:%p already on the hpts?", __FUNCTION__, hpts, inp); - } -#endif + HPTS_MTX_ASSERT(hpts); + KASSERT(hpts->p_cpu == inp->inp_hpts_cpu, + ("%s: hpts:%p inp:%p incorrect CPU", __FUNCTION__, hpts, inp)); + KASSERT(((noref == 1) && (inp->inp_in_hpts == 1)) || + ((noref == 0) && (inp->inp_in_hpts == 0)), + ("%s: hpts:%p inp:%p already on the hpts?", + __FUNCTION__, hpts, inp)); TAILQ_INSERT_TAIL(head, inp, inp_hpts); inp->inp_in_hpts = 1; hpts->p_on_queue_cnt++; @@ -416,37 +493,20 @@ hpts_sane_pace_insert(struct tcp_hpts_entry *hpts, struct inpcb *inp, struct hpt static inline void hpts_sane_input_remove(struct tcp_hpts_entry *hpts, struct inpcb *inp, int clear) { -#ifdef INVARIANTS - if (mtx_owned(&hpts->p_mtx) == 0) { - /* We don't own the mutex? */ - panic("%s: hpts:%p inp:%p no hpts mutex", __FUNCTION__, hpts, inp); - } - if (hpts->p_cpu != inp->inp_input_cpu) { - /* It is not the right cpu/mutex? */ - panic("%s: hpts:%p inp:%p incorrect CPU", __FUNCTION__, hpts, inp); - } - if (inp->inp_in_input == 0) { - /* We are not on the input hpts? */ - panic("%s: hpts:%p inp:%p not on the input hpts?", __FUNCTION__, hpts, inp); - } -#endif + HPTS_MTX_ASSERT(hpts); + KASSERT(hpts->p_cpu == inp->inp_hpts_cpu, + ("%s: hpts:%p inp:%p incorrect CPU", __FUNCTION__, hpts, inp)); + KASSERT(inp->inp_in_input != 0, + ("%s: hpts:%p inp:%p not on the input hpts?", __FUNCTION__, hpts, inp)); TAILQ_REMOVE(&hpts->p_input, inp, inp_input); hpts->p_on_inqueue_cnt--; - if (hpts->p_on_inqueue_cnt < 0) { -#ifdef INVARIANTS - panic("Hpts in goes negative inp:%p hpts:%p", - inp, hpts); -#endif - hpts->p_on_inqueue_cnt = 0; - } -#ifdef INVARIANTS - if (TAILQ_EMPTY(&hpts->p_input) && - (hpts->p_on_inqueue_cnt != 0)) { - /* We should not be empty with a queue count */ - panic("%s hpts:%p in_hpts input empty but cnt:%d", - __FUNCTION__, hpts, hpts->p_on_inqueue_cnt); - } -#endif + KASSERT(hpts->p_on_inqueue_cnt >= 0, + ("Hpts in goes negative inp:%p hpts:%p", + inp, hpts)); + KASSERT((((TAILQ_EMPTY(&hpts->p_input) != 0) && (hpts->p_on_inqueue_cnt == 0)) || + ((TAILQ_EMPTY(&hpts->p_input) == 0) && (hpts->p_on_inqueue_cnt > 0))), + ("%s hpts:%p input cnt (p_on_inqueue):%d and queue state mismatch", + __FUNCTION__, hpts, hpts->p_on_inqueue_cnt)); if (clear) inp->inp_in_input = 0; } @@ -454,46 +514,17 @@ hpts_sane_input_remove(struct tcp_hpts_entry *hpts, struct inpcb *inp, int clear static inline void hpts_sane_input_insert(struct tcp_hpts_entry *hpts, struct inpcb *inp, int line) { -#ifdef INVARIANTS - if (mtx_owned(&hpts->p_mtx) == 0) { - /* We don't own the mutex? */ - panic("%s: hpts:%p inp:%p no hpts mutex", __FUNCTION__, hpts, inp); - } - if (hpts->p_cpu != inp->inp_input_cpu) { - /* It is not the right cpu/mutex? */ - panic("%s: hpts:%p inp:%p incorrect CPU", __FUNCTION__, hpts, inp); - } - if (inp->inp_in_input == 1) { - /* We are already on the input hpts? */ - panic("%s: hpts:%p inp:%p already on the input hpts?", __FUNCTION__, hpts, inp); - } -#endif + HPTS_MTX_ASSERT(hpts); + KASSERT(hpts->p_cpu == inp->inp_hpts_cpu, + ("%s: hpts:%p inp:%p incorrect CPU", __FUNCTION__, hpts, inp)); + KASSERT(inp->inp_in_input == 0, + ("%s: hpts:%p inp:%p already on the input hpts?", __FUNCTION__, hpts, inp)); TAILQ_INSERT_TAIL(&hpts->p_input, inp, inp_input); inp->inp_in_input = 1; hpts->p_on_inqueue_cnt++; in_pcbref(inp); } -static void -tcp_wakehpts(struct tcp_hpts_entry *hpts) -{ - HPTS_MTX_ASSERT(hpts); - if (hpts->p_hpts_wake_scheduled == 0) { - hpts->p_hpts_wake_scheduled = 1; - swi_sched(hpts->ie_cookie, 0); - } -} - -static void -tcp_wakeinput(struct tcp_hpts_entry *hpts) -{ - HPTS_MTX_ASSERT(hpts); - if (hpts->p_hpts_wake_scheduled == 0) { - hpts->p_hpts_wake_scheduled = 1; - swi_sched(hpts->ie_cookie, 0); - } -} - struct tcp_hpts_entry * tcp_cur_hpts(struct inpcb *inp) { @@ -514,12 +545,9 @@ tcp_hpts_lock(struct inpcb *inp) again: hpts_num = inp->inp_hpts_cpu; hpts = tcp_pace.rp_ent[hpts_num]; -#ifdef INVARIANTS - if (mtx_owned(&hpts->p_mtx)) { - panic("Hpts:%p owns mtx prior-to lock line:%d", - hpts, __LINE__); - } -#endif + KASSERT(mtx_owned(&hpts->p_mtx) == 0, + ("Hpts:%p owns mtx prior-to lock line:%d", + hpts, __LINE__)); mtx_lock(&hpts->p_mtx); if (hpts_num != inp->inp_hpts_cpu) { mtx_unlock(&hpts->p_mtx); @@ -537,12 +565,9 @@ tcp_input_lock(struct inpcb *inp) again: hpts_num = inp->inp_input_cpu; hpts = tcp_pace.rp_ent[hpts_num]; -#ifdef INVARIANTS - if (mtx_owned(&hpts->p_mtx)) { - panic("Hpts:%p owns mtx prior-to lock line:%d", - hpts, __LINE__); - } -#endif + KASSERT(mtx_owned(&hpts->p_mtx) == 0, + ("Hpts:%p owns mtx prior-to lock line:%d", + hpts, __LINE__)); mtx_lock(&hpts->p_mtx); if (hpts_num != inp->inp_input_cpu) { mtx_unlock(&hpts->p_mtx); @@ -555,6 +580,7 @@ static void tcp_remove_hpts_ref(struct inpcb *inp, struct tcp_hpts_entry *hpts, int line) { int32_t add_freed; + int32_t ret; if (inp->inp_flags2 & INP_FREED) { /* @@ -567,26 +593,11 @@ tcp_remove_hpts_ref(struct inpcb *inp, struct tcp_hpts_entry *hpts, int line) add_freed = 0; } #ifndef INP_REF_DEBUG - if (in_pcbrele_wlocked(inp)) { - /* - * This should not happen. We have the inpcb referred to by - * the main socket (why we are called) and the hpts. It - * should always return 0. - */ - panic("inpcb:%p release ret 1", - inp); - } + ret = in_pcbrele_wlocked(inp); #else - if (__in_pcbrele_wlocked(inp, line)) { - /* - * This should not happen. We have the inpcb referred to by - * the main socket (why we are called) and the hpts. It - * should always return 0. - */ - panic("inpcb:%p release ret 1", - inp); - } + ret = __in_pcbrele_wlocked(inp, line); #endif + KASSERT(ret != 1, ("inpcb:%p release ret 1", inp)); if (add_freed) { inp->inp_flags2 |= INP_FREED; } @@ -642,73 +653,76 @@ __tcp_hpts_remove(struct inpcb *inp, int32_t flags, int32_t line) } static inline int -hpts_tick(uint32_t wheel_tick, uint32_t plus) +hpts_slot(uint32_t wheel_slot, uint32_t plus) { /* * Given a slot on the wheel, what slot * is that plus ticks out? */ - KASSERT(wheel_tick < NUM_OF_HPTSI_SLOTS, ("Invalid tick %u not on wheel", wheel_tick)); - return ((wheel_tick + plus) % NUM_OF_HPTSI_SLOTS); + KASSERT(wheel_slot < NUM_OF_HPTSI_SLOTS, ("Invalid tick %u not on wheel", wheel_slot)); + return ((wheel_slot + plus) % NUM_OF_HPTSI_SLOTS); } static inline int tick_to_wheel(uint32_t cts_in_wticks) { /* - * Given a timestamp in wheel ticks (10usec inc's) - * map it to our limited space wheel. + * Given a timestamp in ticks (so by + * default to get it to a real time one + * would multiply by 10.. i.e the number + * of ticks in a slot) map it to our limited + * space wheel. */ return (cts_in_wticks % NUM_OF_HPTSI_SLOTS); } static inline int -hpts_ticks_diff(int prev_tick, int tick_now) +hpts_slots_diff(int prev_slot, int slot_now) { /* - * Given two ticks that are someplace + * Given two slots that are someplace * on our wheel. How far are they apart? */ - if (tick_now > prev_tick) - return (tick_now - prev_tick); - else if (tick_now == prev_tick) + if (slot_now > prev_slot) + return (slot_now - prev_slot); + else if (slot_now == prev_slot) /* * Special case, same means we can go all of our * wheel less one slot. */ return (NUM_OF_HPTSI_SLOTS - 1); else - return ((NUM_OF_HPTSI_SLOTS - prev_tick) + tick_now); + return ((NUM_OF_HPTSI_SLOTS - prev_slot) + slot_now); } /* - * Given a tick on the wheel that is the current time - * mapped to the wheel (wheel_tick), what is the maximum + * Given a slot on the wheel that is the current time + * mapped to the wheel (wheel_slot), what is the maximum * distance forward that can be obtained without - * wrapping past either prev_tick or running_tick + * wrapping past either prev_slot or running_slot * depending on the htps state? Also if passed - * a uint32_t *, fill it with the tick location. + * a uint32_t *, fill it with the slot location. * * Note if you do not give this function the current - * time (that you think it is) mapped to the wheel + * time (that you think it is) mapped to the wheel slot * then the results will not be what you expect and * could lead to invalid inserts. */ static inline int32_t -max_ticks_available(struct tcp_hpts_entry *hpts, uint32_t wheel_tick, uint32_t *target_tick) +max_slots_available(struct tcp_hpts_entry *hpts, uint32_t wheel_slot, uint32_t *target_slot) { - uint32_t dis_to_travel, end_tick, pacer_to_now, avail_on_wheel; + uint32_t dis_to_travel, end_slot, pacer_to_now, avail_on_wheel; if ((hpts->p_hpts_active == 1) && (hpts->p_wheel_complete == 0)) { - end_tick = hpts->p_runningtick; + end_slot = hpts->p_runningslot; /* Back up one tick */ - if (end_tick == 0) - end_tick = NUM_OF_HPTSI_SLOTS - 1; + if (end_slot == 0) + end_slot = NUM_OF_HPTSI_SLOTS - 1; else - end_tick--; - if (target_tick) - *target_tick = end_tick; + end_slot--; + if (target_slot) + *target_slot = end_slot; } else { /* * For the case where we are @@ -718,26 +732,26 @@ max_ticks_available(struct tcp_hpts_entry *hpts, uint32_t wheel_tick, uint32_t * * prev tick and subtract one from it. This puts us * as far out as possible on the wheel. */ - end_tick = hpts->p_prev_slot; - if (end_tick == 0) - end_tick = NUM_OF_HPTSI_SLOTS - 1; + end_slot = hpts->p_prev_slot; + if (end_slot == 0) + end_slot = NUM_OF_HPTSI_SLOTS - 1; else - end_tick--; - if (target_tick) - *target_tick = end_tick; + end_slot--; + if (target_slot) + *target_slot = end_slot; /* * Now we have close to the full wheel left minus the * time it has been since the pacer went to sleep. Note * that wheel_tick, passed in, should be the current time * from the perspective of the caller, mapped to the wheel. */ - if (hpts->p_prev_slot != wheel_tick) - dis_to_travel = hpts_ticks_diff(hpts->p_prev_slot, wheel_tick); + if (hpts->p_prev_slot != wheel_slot) + dis_to_travel = hpts_slots_diff(hpts->p_prev_slot, wheel_slot); else dis_to_travel = 1; /* * dis_to_travel in this case is the space from when the - * pacer stopped (p_prev_slot) and where our wheel_tick + * pacer stopped (p_prev_slot) and where our wheel_slot * is now. To know how many slots we can put it in we * subtract from the wheel size. We would not want * to place something after p_prev_slot or it will @@ -746,21 +760,21 @@ max_ticks_available(struct tcp_hpts_entry *hpts, uint32_t wheel_tick, uint32_t * return (NUM_OF_HPTSI_SLOTS - dis_to_travel); } /* - * So how many slots are open between p_runningtick -> p_cur_slot + * So how many slots are open between p_runningslot -> p_cur_slot * that is what is currently un-available for insertion. Special * case when we are at the last slot, this gets 1, so that * the answer to how many slots are available is all but 1. */ - if (hpts->p_runningtick == hpts->p_cur_slot) + if (hpts->p_runningslot == hpts->p_cur_slot) dis_to_travel = 1; else - dis_to_travel = hpts_ticks_diff(hpts->p_runningtick, hpts->p_cur_slot); + dis_to_travel = hpts_slots_diff(hpts->p_runningslot, hpts->p_cur_slot); /* * How long has the pacer been running? */ - if (hpts->p_cur_slot != wheel_tick) { + if (hpts->p_cur_slot != wheel_slot) { /* The pacer is a bit late */ - pacer_to_now = hpts_ticks_diff(hpts->p_cur_slot, wheel_tick); + pacer_to_now = hpts_slots_diff(hpts->p_cur_slot, wheel_slot); } else { /* The pacer is right on time, now == pacers start time */ pacer_to_now = 0; @@ -774,24 +788,24 @@ max_ticks_available(struct tcp_hpts_entry *hpts, uint32_t wheel_tick, uint32_t * /* * Now how many of those we will eat due to the pacer's * time (p_cur_slot) of start being behind the - * real time (wheel_tick)? + * real time (wheel_slot)? */ if (avail_on_wheel <= pacer_to_now) { /* * Wheel wrap, we can't fit on the wheel, that * is unusual the system must be way overloaded! - * Insert into the assured tick, and return special + * Insert into the assured slot, and return special * "0". */ counter_u64_add(combined_wheel_wrap, 1); - *target_tick = hpts->p_nxt_slot; + *target_slot = hpts->p_nxt_slot; return (0); } else { /* * We know how many slots are open * on the wheel (the reverse of what * is left to run. Take away the time - * the pacer started to now (wheel_tick) + * the pacer started to now (wheel_slot) * and that tells you how many slots are * open that can be inserted into that won't * be touched by the pacer until later. @@ -815,7 +829,7 @@ tcp_queue_to_hpts_immediate_locked(struct inpcb *inp, struct tcp_hpts_entry *hpt * A sleeping hpts we want in next slot to run * note that in this state p_prev_slot == p_cur_slot */ - inp->inp_hptsslot = hpts_tick(hpts->p_prev_slot, 1); + inp->inp_hptsslot = hpts_slot(hpts->p_prev_slot, 1); if ((hpts->p_on_min_sleep == 0) && (hpts->p_hpts_active == 0)) need_wake = 1; } else if ((void *)inp == hpts->p_inp) { @@ -827,7 +841,7 @@ tcp_queue_to_hpts_immediate_locked(struct inpcb *inp, struct tcp_hpts_entry *hpt */ inp->inp_hptsslot = hpts->p_nxt_slot; } else - inp->inp_hptsslot = hpts->p_runningtick; + inp->inp_hptsslot = hpts->p_runningslot; hpts_sane_pace_insert(hpts, inp, &hpts->p_hptss[inp->inp_hptsslot], line, noref); if (need_wake) { /* @@ -862,9 +876,9 @@ check_if_slot_would_be_wrong(struct tcp_hpts_entry *hpts, struct inpcb *inp, uin * Sanity checks for the pacer with invariants * on insert. */ - if (inp_hptsslot >= NUM_OF_HPTSI_SLOTS) - panic("hpts:%p inp:%p slot:%d > max", - hpts, inp, inp_hptsslot); + KASSERT(inp_hptsslot < NUM_OF_HPTSI_SLOTS, + ("hpts:%p inp:%p slot:%d > max", + hpts, inp, inp_hptsslot)); if ((hpts->p_hpts_active) && (hpts->p_wheel_complete == 0)) { /* @@ -875,17 +889,16 @@ check_if_slot_would_be_wrong(struct tcp_hpts_entry *hpts, struct inpcb *inp, uin */ int distance, yet_to_run; - distance = hpts_ticks_diff(hpts->p_runningtick, inp_hptsslot); - if (hpts->p_runningtick != hpts->p_cur_slot) - yet_to_run = hpts_ticks_diff(hpts->p_runningtick, hpts->p_cur_slot); + distance = hpts_slots_diff(hpts->p_runningslot, inp_hptsslot); + if (hpts->p_runningslot != hpts->p_cur_slot) + yet_to_run = hpts_slots_diff(hpts->p_runningslot, hpts->p_cur_slot); else yet_to_run = 0; /* processing last slot */ - if (yet_to_run > distance) { - panic("hpts:%p inp:%p slot:%d distance:%d yet_to_run:%d rs:%d cs:%d", - hpts, inp, inp_hptsslot, - distance, yet_to_run, - hpts->p_runningtick, hpts->p_cur_slot); - } + KASSERT(yet_to_run <= distance, + ("hpts:%p inp:%p slot:%d distance:%d yet_to_run:%d rs:%d cs:%d", + hpts, inp, inp_hptsslot, + distance, yet_to_run, + hpts->p_runningslot, hpts->p_cur_slot)); } } #endif @@ -895,8 +908,9 @@ tcp_hpts_insert_locked(struct tcp_hpts_entry *hpts, struct inpcb *inp, uint32_t struct hpts_diag *diag, struct timeval *tv) { uint32_t need_new_to = 0; - uint32_t wheel_cts, last_tick; - int32_t wheel_tick, maxticks; + uint32_t wheel_cts; + int32_t wheel_slot, maxslots, last_slot; + int cpu; int8_t need_wakeup = 0; HPTS_MTX_ASSERT(hpts); @@ -904,7 +918,7 @@ tcp_hpts_insert_locked(struct tcp_hpts_entry *hpts, struct inpcb *inp, uint32_t memset(diag, 0, sizeof(struct hpts_diag)); diag->p_hpts_active = hpts->p_hpts_active; diag->p_prev_slot = hpts->p_prev_slot; - diag->p_runningtick = hpts->p_runningtick; + diag->p_runningslot = hpts->p_runningslot; diag->p_nxt_slot = hpts->p_nxt_slot; diag->p_cur_slot = hpts->p_cur_slot; diag->p_curtick = hpts->p_curtick; @@ -913,131 +927,120 @@ tcp_hpts_insert_locked(struct tcp_hpts_entry *hpts, struct inpcb *inp, uint32_t diag->p_on_min_sleep = hpts->p_on_min_sleep; diag->hpts_sleep_time = hpts->p_hpts_sleep_time; } - if (inp->inp_in_hpts == 0) { - if (slot == 0) { - /* Immediate */ - tcp_queue_to_hpts_immediate_locked(inp, hpts, line, 0); - return; - } - /* Get the current time relative to the wheel */ - wheel_cts = tcp_tv_to_hptstick(tv); - /* Map it onto the wheel */ - wheel_tick = tick_to_wheel(wheel_cts); - /* Now what's the max we can place it at? */ - maxticks = max_ticks_available(hpts, wheel_tick, &last_tick); - if (diag) { - diag->wheel_tick = wheel_tick; - diag->maxticks = maxticks; - diag->wheel_cts = wheel_cts; + KASSERT(inp->inp_in_hpts == 0, ("Hpts:%p tp:%p already on hpts and add?", hpts, inp)); + if (slot == 0) { + /* Immediate */ + tcp_queue_to_hpts_immediate_locked(inp, hpts, line, 0); + return; + } + /* Get the current time relative to the wheel */ + wheel_cts = tcp_tv_to_hptstick(tv); + /* Map it onto the wheel */ + wheel_slot = tick_to_wheel(wheel_cts); + /* Now what's the max we can place it at? */ + maxslots = max_slots_available(hpts, wheel_slot, &last_slot); + if (diag) { + diag->wheel_slot = wheel_slot; + diag->maxslots = maxslots; + diag->wheel_cts = wheel_cts; + } + if (maxslots == 0) { + /* The pacer is in a wheel wrap behind, yikes! */ + if (slot > 1) { + /* + * Reduce by 1 to prevent a forever loop in + * case something else is wrong. Note this + * probably does not hurt because the pacer + * if its true is so far behind we will be + * > 1second late calling anyway. + */ + slot--; } - if (maxticks == 0) { - /* The pacer is in a wheel wrap behind, yikes! */ - if (slot > 1) { - /* - * Reduce by 1 to prevent a forever loop in - * case something else is wrong. Note this - * probably does not hurt because the pacer - * if its true is so far behind we will be - * > 1second late calling anyway. - */ - slot--; - } - inp->inp_hptsslot = last_tick; - inp->inp_hpts_request = slot; - } else if (maxticks >= slot) { - /* It all fits on the wheel */ - inp->inp_hpts_request = 0; - inp->inp_hptsslot = hpts_tick(wheel_tick, slot); - } else { - /* It does not fit */ - inp->inp_hpts_request = slot - maxticks; - inp->inp_hptsslot = last_tick; + inp->inp_hptsslot = last_slot; + inp->inp_hpts_request = slot; + } else if (maxslots >= slot) { + /* It all fits on the wheel */ + inp->inp_hpts_request = 0; + inp->inp_hptsslot = hpts_slot(wheel_slot, slot); + } else { + /* It does not fit */ + inp->inp_hpts_request = slot - maxslots; + inp->inp_hptsslot = last_slot; + } + if (diag) { + diag->slot_remaining = inp->inp_hpts_request; + diag->inp_hptsslot = inp->inp_hptsslot; + } +#ifdef INVARIANTS + check_if_slot_would_be_wrong(hpts, inp, inp->inp_hptsslot, line); +#endif + hpts_sane_pace_insert(hpts, inp, &hpts->p_hptss[inp->inp_hptsslot], line, 0); + if ((hpts->p_hpts_active == 0) && + (inp->inp_hpts_request == 0) && + (hpts->p_on_min_sleep == 0)) { + /* + * The hpts is sleeping and NOT on a minimum + * sleep time, we need to figure out where + * it will wake up at and if we need to reschedule + * its time-out. + */ + uint32_t have_slept, yet_to_sleep; + + /* Now do we need to restart the hpts's timer? */ + have_slept = hpts_slots_diff(hpts->p_prev_slot, wheel_slot); + if (have_slept < hpts->p_hpts_sleep_time) + yet_to_sleep = hpts->p_hpts_sleep_time - have_slept; + else { + /* We are over-due */ + yet_to_sleep = 0; + need_wakeup = 1; } if (diag) { - diag->slot_remaining = inp->inp_hpts_request; - diag->inp_hptsslot = inp->inp_hptsslot; + diag->have_slept = have_slept; + diag->yet_to_sleep = yet_to_sleep; } -#ifdef INVARIANTS - check_if_slot_would_be_wrong(hpts, inp, inp->inp_hptsslot, line); -#endif - hpts_sane_pace_insert(hpts, inp, &hpts->p_hptss[inp->inp_hptsslot], line, 0); - if ((hpts->p_hpts_active == 0) && - (inp->inp_hpts_request == 0) && - (hpts->p_on_min_sleep == 0)) { + if (yet_to_sleep && + (yet_to_sleep > slot)) { /* *** 1483 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Wed Jul 7 14:40:13 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 507A6657D80; Wed, 7 Jul 2021 14:40:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GKhsn1ZK5z3MFy; Wed, 7 Jul 2021 14:40:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1AF0F6D54; Wed, 7 Jul 2021 14:40:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 167EeCXE020123; Wed, 7 Jul 2021 14:40:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 167EeCSk020117; Wed, 7 Jul 2021 14:40:12 GMT (envelope-from git) Date: Wed, 7 Jul 2021 14:40:12 GMT Message-Id: <202107071440.167EeCSk020117@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Gallatin Subject: git: 4150a5a87ed6 - main - ktls: fix NOINET build MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gallatin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4150a5a87ed6757cb6fd0118b4058eef77f735f7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 14:40:13 -0000 The branch main has been updated by gallatin: URL: https://cgit.FreeBSD.org/src/commit/?id=4150a5a87ed6757cb6fd0118b4058eef77f735f7 commit 4150a5a87ed6757cb6fd0118b4058eef77f735f7 Author: Andrew Gallatin AuthorDate: 2021-07-07 14:38:57 +0000 Commit: Andrew Gallatin CommitDate: 2021-07-07 14:40:02 +0000 ktls: fix NOINET build Reported by: mjguzik Sponsored by: Netflix --- sys/kern/uipc_ktls.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/kern/uipc_ktls.c b/sys/kern/uipc_ktls.c index 88e29157289d..5f7dde325740 100644 --- a/sys/kern/uipc_ktls.c +++ b/sys/kern/uipc_ktls.c @@ -2202,6 +2202,7 @@ ktls_work_thread(void *ctx) } } +#if defined(INET) || defined(INET6) static void ktls_disable_ifnet_help(void *context, int pending __unused) { @@ -2294,3 +2295,4 @@ ktls_disable_ifnet(void *arg) TASK_INIT(&tls->disable_ifnet_task, 0, ktls_disable_ifnet_help, tls); (void)taskqueue_enqueue(taskqueue_thread, &tls->disable_ifnet_task); } +#endif From owner-dev-commits-src-main@freebsd.org Wed Jul 7 14:49:20 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B60BE657D6C; Wed, 7 Jul 2021 14:49:20 +0000 (UTC) (envelope-from gallatin@cs.duke.edu) Received: from duke.cs.duke.edu (duke.cs.duke.edu [152.3.140.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4GKj4J4JWtz3NDG; Wed, 7 Jul 2021 14:49:20 +0000 (UTC) (envelope-from gallatin@cs.duke.edu) Received: from [192.168.1.2] (pool-74-110-137-7.rcmdva.fios.verizon.net [74.110.137.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: gallatin) by duke.cs.duke.edu (Postfix) with ESMTPSA id 14E23270016A; Wed, 7 Jul 2021 10:49:19 -0400 (EDT) DMARC-Filter: OpenDMARC Filter v1.3.1 duke.cs.duke.edu 14E23270016A DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=cs.duke.edu; s=mail0816; t=1625669359; bh=Uo4D0KOkTInGOdbeR4wRsr/W9Lh5CdsrTJR6F87/vBc=; h=Subject:To:From:Date:From; b=YPtvb9X2YWSSrI4TGqBdrMVkAlB7d/2twkbd5X0nOtvPRsgRLbGt1VhAVcRkkQOE5 eOVgXTpLaKtFDRjdTgh9fsgDxvoC2PK9DdgwWiq+WslhWKYXmqTE/Z10RLrI/qv92D gfAzQulCd3aJM8+VIRmNcYP7npF/bqJPizN9M5y3F4H7lU/qiSnkRiMvs4Pb362d5l CM6+Mr6FmpOR4eruGJ3GWOVgHgGgYUx+KDGhk2j4db1TZEhG7xcpCgqMk/27vuodxM yOowTtlnbnf+GG9b9DYofkI6s7Jm/7j8FbY74mJB5kLZucKmZC062FVtm4Z0smxuRg OsOgjaJO8hDAg== Subject: Re: git: 28d0a740dd9a - main - ktls: auto-disable ifnet (inline hw) kTLS To: Mateusz Guzik , Andrew Gallatin Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org References: <202107061429.166ETTEn064437@gitrepo.freebsd.org> From: Andrew Gallatin Message-ID: <8285ccb3-87d8-fe84-de27-0fd06409df70@cs.duke.edu> Date: Wed, 7 Jul 2021 10:49:18 -0400 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4GKj4J4JWtz3NDG X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 14:49:20 -0000 On 7/7/21 7:00 AM, Mateusz Guzik wrote: > This breaks NOIP kernel builds. Thanks for pointing this out, it should be fixed in 4150a5a87ed > On 7/6/21, Andrew Gallatin wrote: >> The branch main has been updated by gallatin: >> >> URL: >> https://urldefense.com/v3/__https://cgit.FreeBSD.org/src/commit/?id=28d0a740dd9a67e4a4fa9fda5bb39b5963316f35__;!!OToaGQ!_d4pkzhNaWowgMsR4-c1qtLXr1H9SC_kBWNDvXvVV15lerMV4elltm-V6OZj3iET-A$ >> >> commit 28d0a740dd9a67e4a4fa9fda5bb39b5963316f35 >> Author: Andrew Gallatin >> AuthorDate: 2021-07-06 14:17:33 +0000 >> Commit: Andrew Gallatin >> CommitDate: 2021-07-06 14:28:32 +0000 >> >> ktls: auto-disable ifnet (inline hw) kTLS >> >> Ifnet (inline) hw kTLS NICs typically keep state within >> a TLS record, so that when transmitting in-order, >> they can continue encryption on each segment sent without >> DMA'ing extra state from the host. >> >> This breaks down when transmits are out of order (eg, >> TCP retransmits). In this case, the NIC must re-DMA >> the entire TLS record up to and including the segment >> being retransmitted. This means that when re-transmitting >> the last 1448 byte segment of a TLS record, the NIC will >> have to re-DMA the entire 16KB TLS record. This can lead >> to the NIC running out of PCIe bus bandwidth well before >> it saturates the network link if a lot of TCP connections have >> a high retransmoit rate. >> >> This change introduces a new sysctl >> (kern.ipc.tls.ifnet_max_rexmit_pct), >> where TCP connections with higher retransmit rate will be >> switched to SW kTLS so as to conserve PCIe bandwidth. >> >> Reviewed by: hselasky, markj, rrs >> Sponsored by: Netflix >> Differential Revision: https://urldefense.com/v3/__https://reviews.freebsd.org/D30908__;!!OToaGQ!_d4pkzhNaWowgMsR4-c1qtLXr1H9SC_kBWNDvXvVV15lerMV4elltm-V6OYOYLaV0A$ >> --- >> sys/kern/uipc_ktls.c | 107 >> ++++++++++++++++++++++++++++++++++++++++++++++++++ >> sys/netinet/tcp_var.h | 13 +++++- >> sys/sys/ktls.h | 15 ++++++- >> 3 files changed, 133 insertions(+), 2 deletions(-) >> >> diff --git a/sys/kern/uipc_ktls.c b/sys/kern/uipc_ktls.c >> index 7e87e7c740e3..88e29157289d 100644 >> --- a/sys/kern/uipc_ktls.c >> +++ b/sys/kern/uipc_ktls.c >> @@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$"); >> >> #include "opt_inet.h" >> #include "opt_inet6.h" >> +#include "opt_kern_tls.h" >> #include "opt_ratelimit.h" >> #include "opt_rss.h" >> >> @@ -121,6 +122,11 @@ SYSCTL_INT(_kern_ipc_tls_stats, OID_AUTO, threads, >> CTLFLAG_RD, >> &ktls_number_threads, 0, >> "Number of TLS threads in thread-pool"); >> >> +unsigned int ktls_ifnet_max_rexmit_pct = 2; >> +SYSCTL_UINT(_kern_ipc_tls, OID_AUTO, ifnet_max_rexmit_pct, CTLFLAG_RWTUN, >> + &ktls_ifnet_max_rexmit_pct, 2, >> + "Max percent bytes retransmitted before ifnet TLS is disabled"); >> + >> static bool ktls_offload_enable; >> SYSCTL_BOOL(_kern_ipc_tls, OID_AUTO, enable, CTLFLAG_RWTUN, >> &ktls_offload_enable, 0, >> @@ -184,6 +190,14 @@ static COUNTER_U64_DEFINE_EARLY(ktls_switch_failed); >> SYSCTL_COUNTER_U64(_kern_ipc_tls_stats, OID_AUTO, switch_failed, >> CTLFLAG_RD, >> &ktls_switch_failed, "TLS sessions unable to switch between SW and >> ifnet"); >> >> +static COUNTER_U64_DEFINE_EARLY(ktls_ifnet_disable_fail); >> +SYSCTL_COUNTER_U64(_kern_ipc_tls_stats, OID_AUTO, ifnet_disable_failed, >> CTLFLAG_RD, >> + &ktls_ifnet_disable_fail, "TLS sessions unable to switch to SW from >> ifnet"); >> + >> +static COUNTER_U64_DEFINE_EARLY(ktls_ifnet_disable_ok); >> +SYSCTL_COUNTER_U64(_kern_ipc_tls_stats, OID_AUTO, ifnet_disable_ok, >> CTLFLAG_RD, >> + &ktls_ifnet_disable_ok, "TLS sessions able to switch to SW from >> ifnet"); >> + >> SYSCTL_NODE(_kern_ipc_tls, OID_AUTO, sw, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, >> "Software TLS session stats"); >> SYSCTL_NODE(_kern_ipc_tls, OID_AUTO, ifnet, CTLFLAG_RD | CTLFLAG_MPSAFE, >> 0, >> @@ -2187,3 +2201,96 @@ ktls_work_thread(void *ctx) >> } >> } >> } >> + >> +static void >> +ktls_disable_ifnet_help(void *context, int pending __unused) >> +{ >> + struct ktls_session *tls; >> + struct inpcb *inp; >> + struct tcpcb *tp; >> + struct socket *so; >> + int err; >> + >> + tls = context; >> + inp = tls->inp; >> + if (inp == NULL) >> + return; >> + INP_WLOCK(inp); >> + so = inp->inp_socket; >> + MPASS(so != NULL); >> + if ((inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) || >> + (inp->inp_flags2 & INP_FREED)) { >> + goto out; >> + } >> + >> + if (so->so_snd.sb_tls_info != NULL) >> + err = ktls_set_tx_mode(so, TCP_TLS_MODE_SW); >> + else >> + err = ENXIO; >> + if (err == 0) { >> + counter_u64_add(ktls_ifnet_disable_ok, 1); >> + /* ktls_set_tx_mode() drops inp wlock, so recheck flags */ >> + if ((inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) == 0 && >> + (inp->inp_flags2 & INP_FREED) == 0 && >> + (tp = intotcpcb(inp)) != NULL && >> + tp->t_fb->tfb_hwtls_change != NULL) >> + (*tp->t_fb->tfb_hwtls_change)(tp, 0); >> + } else { >> + counter_u64_add(ktls_ifnet_disable_fail, 1); >> + } >> + >> +out: >> + SOCK_LOCK(so); >> + sorele(so); >> + if (!in_pcbrele_wlocked(inp)) >> + INP_WUNLOCK(inp); >> + ktls_free(tls); >> +} >> + >> +/* >> + * Called when re-transmits are becoming a substantial portion of the >> + * sends on this connection. When this happens, we transition the >> + * connection to software TLS. This is needed because most inline TLS >> + * NICs keep crypto state only for in-order transmits. This means >> + * that to handle a TCP rexmit (which is out-of-order), the NIC must >> + * re-DMA the entire TLS record up to and including the current >> + * segment. This means that when re-transmitting the last ~1448 byte >> + * segment of a 16KB TLS record, we could wind up re-DMA'ing an order >> + * of magnitude more data than we are sending. This can cause the >> + * PCIe link to saturate well before the network, which can cause >> + * output drops, and a general loss of capacity. >> + */ >> +void >> +ktls_disable_ifnet(void *arg) >> +{ >> + struct tcpcb *tp; >> + struct inpcb *inp; >> + struct socket *so; >> + struct ktls_session *tls; >> + >> + tp = arg; >> + inp = tp->t_inpcb; >> + INP_WLOCK_ASSERT(inp); >> + so = inp->inp_socket; >> + SOCK_LOCK(so); >> + tls = so->so_snd.sb_tls_info; >> + if (tls->disable_ifnet_pending) { >> + SOCK_UNLOCK(so); >> + return; >> + } >> + >> + /* >> + * note that disable_ifnet_pending is never cleared; disabling >> + * ifnet can only be done once per session, so we never want >> + * to do it again >> + */ >> + >> + (void)ktls_hold(tls); >> + in_pcbref(inp); >> + soref(so); >> + tls->disable_ifnet_pending = true; >> + tls->inp = inp; >> + SOCK_UNLOCK(so); >> + TASK_INIT(&tls->disable_ifnet_task, 0, ktls_disable_ifnet_help, tls); >> + (void)taskqueue_enqueue(taskqueue_thread, &tls->disable_ifnet_task); >> +} >> diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h >> index dd30f89896d2..3f72a821e71f 100644 >> --- a/sys/netinet/tcp_var.h >> +++ b/sys/netinet/tcp_var.h >> @@ -39,8 +39,10 @@ >> #include >> >> #ifdef _KERNEL >> +#include "opt_kern_tls.h" >> #include >> #include >> +#include >> #endif >> >> #define TCP_END_BYTE_INFO 8 /* Bytes that makeup the "end information >> array" */ >> @@ -1139,8 +1141,10 @@ tcp_fields_to_net(struct tcphdr *th) >> >> static inline void >> tcp_account_for_send(struct tcpcb *tp, uint32_t len, uint8_t is_rxt, >> - uint8_t is_tlp, int hw_tls __unused) >> + uint8_t is_tlp, int hw_tls) >> { >> + uint64_t rexmit_percent; >> + >> if (is_tlp) { >> tp->t_sndtlppack++; >> tp->t_sndtlpbyte += len; >> @@ -1150,6 +1154,13 @@ tcp_account_for_send(struct tcpcb *tp, uint32_t len, >> uint8_t is_rxt, >> tp->t_snd_rxt_bytes += len; >> else >> tp->t_sndbytes += len; >> + >> + if (hw_tls && is_rxt) { >> + rexmit_percent = (1000ULL * tp->t_snd_rxt_bytes) / (10ULL * >> (tp->t_snd_rxt_bytes + tp->t_sndbytes)); >> + if (rexmit_percent > ktls_ifnet_max_rexmit_pct) >> + ktls_disable_ifnet(tp); >> + } >> + >> } >> #endif /* _KERNEL */ >> >> diff --git a/sys/sys/ktls.h b/sys/sys/ktls.h >> index b28c94965c97..7fd8831878b4 100644 >> --- a/sys/sys/ktls.h >> +++ b/sys/sys/ktls.h >> @@ -189,10 +189,12 @@ struct ktls_session { >> u_int wq_index; >> volatile u_int refcount; >> int mode; >> - bool reset_pending; >> >> struct task reset_tag_task; >> + struct task disable_ifnet_task; >> struct inpcb *inp; >> + bool reset_pending; >> + bool disable_ifnet_pending; >> } __aligned(CACHE_LINE_SIZE); >> >> void ktls_check_rx(struct sockbuf *sb); >> @@ -231,5 +233,16 @@ ktls_free(struct ktls_session *tls) >> ktls_destroy(tls); >> } >> >> +#ifdef KERN_TLS >> +extern unsigned int ktls_ifnet_max_rexmit_pct; >> +void ktls_disable_ifnet(void *arg); >> +#else >> +#define ktls_ifnet_max_rexmit_pct 1 >> +inline void >> +ktls_disable_ifnet(void *arg __unused) >> +{ >> +} >> +#endif >> + >> #endif /* !_KERNEL */ >> #endif /* !_SYS_KTLS_H_ */ >> > > From owner-dev-commits-src-main@freebsd.org Wed Jul 7 17:05:23 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A4F3365947A; Wed, 7 Jul 2021 17:05:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GKm5H45Ccz4SB3; Wed, 7 Jul 2021 17:05:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 75A1A110F9; Wed, 7 Jul 2021 17:05:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 167H5N1s014931; Wed, 7 Jul 2021 17:05:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 167H5No7014930; Wed, 7 Jul 2021 17:05:23 GMT (envelope-from git) Date: Wed, 7 Jul 2021 17:05:23 GMT Message-Id: <202107071705.167H5No7014930@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Gallatin Subject: git: b1e806c0ed96 - main - tcp: fix alternate stack build with LINT-NO{INET, INET6, IP} MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gallatin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b1e806c0ed960e1eb9ee889c7d0df3c168290c4f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 17:05:23 -0000 The branch main has been updated by gallatin: URL: https://cgit.FreeBSD.org/src/commit/?id=b1e806c0ed960e1eb9ee889c7d0df3c168290c4f commit b1e806c0ed960e1eb9ee889c7d0df3c168290c4f Author: Andrew Gallatin AuthorDate: 2021-07-07 17:02:08 +0000 Commit: Andrew Gallatin CommitDate: 2021-07-07 17:02:08 +0000 tcp: fix alternate stack build with LINT-NO{INET,INET6,IP} When fixing another bug, I noticed that the alternate TCP stacks do not build when various combinations of ipv4 and ipv6 are disabled. Reviewed by: rrs, tuexen Differential Revision: https://reviews.freebsd.org/D31094 Sponsored by: Netflix --- sys/netinet/tcp_stacks/bbr.c | 9 ++++--- sys/netinet/tcp_stacks/rack.c | 45 ++++++++++++++++++++++++-------- sys/netinet/tcp_stacks/rack_bbr_common.c | 6 ++++- 3 files changed, 45 insertions(+), 15 deletions(-) diff --git a/sys/netinet/tcp_stacks/bbr.c b/sys/netinet/tcp_stacks/bbr.c index 8969e4e47ba1..c96fec07b6c9 100644 --- a/sys/netinet/tcp_stacks/bbr.c +++ b/sys/netinet/tcp_stacks/bbr.c @@ -3515,13 +3515,16 @@ bbr_get_header_oh(struct tcp_bbr *bbr) if (bbr->r_ctl.rc_inc_ip_oh) { /* Do we include IP overhead? */ #ifdef INET6 - if (bbr->r_is_v6) + if (bbr->r_is_v6) { seg_oh += sizeof(struct ip6_hdr); - else + } else #endif + { + #ifdef INET seg_oh += sizeof(struct ip); #endif + } } if (bbr->r_ctl.rc_inc_enet_oh) { /* Do we include the ethernet overhead? */ @@ -11956,7 +11959,7 @@ bbr_output_wtime(struct tcpcb *tp, const struct timeval *tv) uint32_t tot_len = 0; uint32_t rtr_cnt = 0; uint32_t maxseg, pace_max_segs, p_maxseg; - int32_t csum_flags; + int32_t csum_flags = 0; int32_t hw_tls; #if defined(IPSEC) || defined(IPSEC_SUPPORT) unsigned ipsec_optlen = 0; diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c index 75287282cf3e..f417f8a4ee7f 100644 --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -12043,7 +12043,9 @@ rack_init_fsb_block(struct tcpcb *tp, struct tcp_rack *rack) #ifdef INET struct ip *ip = NULL; #endif +#if defined(INET) || defined(INET6) struct udphdr *udp = NULL; +#endif /* Ok lets fill in the fast block, it can only be used with no IP options! */ #ifdef INET6 @@ -12067,6 +12069,7 @@ rack_init_fsb_block(struct tcpcb *tp, struct tcp_rack *rack) ip6, rack->r_ctl.fsb.th); } else #endif /* INET6 */ +#ifdef INET { rack->r_ctl.fsb.tcp_ip_hdr_len = sizeof(struct tcpiphdr); ip = (struct ip *)rack->r_ctl.fsb.tcp_ip_hdr; @@ -12086,6 +12089,7 @@ rack_init_fsb_block(struct tcpcb *tp, struct tcp_rack *rack) tp->t_port, ip, rack->r_ctl.fsb.th); } +#endif rack->r_fsb_inited = 1; } @@ -15226,7 +15230,7 @@ rack_fast_rsm_output(struct tcpcb *tp, struct tcp_rack *rack, struct rack_sendma struct tcpopt to; u_char opt[TCP_MAXOLEN]; uint32_t hdrlen, optlen; - int32_t slot, segsiz, max_val, tso = 0, error, flags, ulen = 0; + int32_t slot, segsiz, max_val, tso = 0, error = 0, flags, ulen = 0; uint32_t us_cts; uint32_t if_hw_tsomaxsegcount = 0, startseq; uint32_t if_hw_tsomaxsegsize; @@ -15706,7 +15710,7 @@ rack_fast_output(struct tcpcb *tp, struct tcp_rack *rack, uint64_t ts_val, u_char opt[TCP_MAXOLEN]; uint32_t hdrlen, optlen; int cnt_thru = 1; - int32_t slot, segsiz, len, max_val, tso = 0, sb_offset, error, flags, ulen = 0; + int32_t slot, segsiz, len, max_val, tso = 0, sb_offset, error = 0, flags, ulen = 0; uint32_t us_cts, s_soff; uint32_t if_hw_tsomaxsegcount = 0, startseq; uint32_t if_hw_tsomaxsegsize; @@ -16119,9 +16123,9 @@ rack_output(struct tcpcb *tp) long tot_len_this_send = 0; #ifdef INET struct ip *ip = NULL; -#endif #ifdef TCPDEBUG struct ipovly *ipov = NULL; +#endif #endif struct udphdr *udp = NULL; struct tcp_rack *rack; @@ -16130,7 +16134,10 @@ rack_output(struct tcpcb *tp) uint8_t mark = 0; uint8_t wanted_cookie = 0; u_char opt[TCP_MAXOLEN]; - unsigned ipoptlen, optlen, hdrlen, ulen=0; + unsigned ipoptlen, optlen, hdrlen; +#if defined(INET) || defined(INET6) + unsigned ulen=0; +#endif uint32_t rack_seq; #if defined(IPSEC) || defined(IPSEC_SUPPORT) @@ -17830,21 +17837,29 @@ send: #endif if ((ipoptlen == 0) && (rack->r_ctl.fsb.tcp_ip_hdr) && rack->r_fsb_inited) { #ifdef INET6 - if (isipv6) + if (isipv6) { ip6 = (struct ip6_hdr *)rack->r_ctl.fsb.tcp_ip_hdr; - else + } else #endif /* INET6 */ + { +#ifdef INET ip = (struct ip *)rack->r_ctl.fsb.tcp_ip_hdr; +#endif + } th = rack->r_ctl.fsb.th; udp = rack->r_ctl.fsb.udp; if (udp) { #ifdef INET6 - if (isipv6) + if (isipv6) { ulen = hdrlen + len - sizeof(struct ip6_hdr); - else + } else #endif /* INET6 */ + { +#ifdef INET ulen = hdrlen + len - sizeof(struct ip); - udp->uh_ulen = htons(ulen); + udp->uh_ulen = htons(ulen); +#endif + } } } else { #ifdef INET6 @@ -17863,6 +17878,7 @@ send: } else #endif /* INET6 */ { +#ifdef INET ip = mtod(m, struct ip *); #ifdef TCPDEBUG ipov = (struct ipovly *)ip; @@ -17877,6 +17893,7 @@ send: } else th = (struct tcphdr *)(ip + 1); tcpip_fillheaders(inp, tp->t_port, ip, th); +#endif /* INET */ } } /* @@ -17915,11 +17932,15 @@ send: if (len > 0 && SEQ_GEQ(tp->snd_nxt, tp->snd_max) && (sack_rxmit == 0)) { #ifdef INET6 - if (isipv6) + if (isipv6) { ip6->ip6_flow |= htonl(IPTOS_ECN_ECT0 << 20); - else + } else #endif + { +#ifdef INET ip->ip_tos |= IPTOS_ECN_ECT0; +#endif + } KMOD_TCPSTAT_INC(tcps_ecn_ect0); /* * Reply with proper ECN notifications. @@ -18024,7 +18045,9 @@ send: ip6 = mtod(m, struct ip6_hdr *); else #endif /* INET6 */ +#ifdef INET ip = mtod(m, struct ip *); +#endif /* INET */ th = (struct tcphdr *)(cpto + ((uint8_t *)rack->r_ctl.fsb.th - rack->r_ctl.fsb.tcp_ip_hdr)); /* If we have a udp header lets set it into the mbuf as well */ if (udp) diff --git a/sys/netinet/tcp_stacks/rack_bbr_common.c b/sys/netinet/tcp_stacks/rack_bbr_common.c index 501d29ac48da..d9f48f733e93 100644 --- a/sys/netinet/tcp_stacks/rack_bbr_common.c +++ b/sys/netinet/tcp_stacks/rack_bbr_common.c @@ -166,17 +166,21 @@ static int ctf_get_enet_type(struct ifnet *ifp, struct mbuf *m) { struct ether_header *eh; - struct tcphdr *th; #ifdef INET6 struct ip6_hdr *ip6 = NULL; /* Keep compiler happy. */ #endif #ifdef INET struct ip *ip = NULL; /* Keep compiler happy. */ #endif +#if defined(INET) || defined(INET6) + struct tcphdr *th; int32_t tlen; uint16_t drop_hdrlen; +#endif uint16_t etype; +#ifdef INET uint8_t iptos; +#endif /* Is it the easy way? */ if (m->m_flags & M_LRO_EHDRSTRP) From owner-dev-commits-src-main@freebsd.org Wed Jul 7 18:15:58 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 88C0265A985; Wed, 7 Jul 2021 18:15:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GKnfk01RVz4dqQ; Wed, 7 Jul 2021 18:15:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DCDA411E6B; Wed, 7 Jul 2021 18:15:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 167IFvvC007722; Wed, 7 Jul 2021 18:15:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 167IFvon007721; Wed, 7 Jul 2021 18:15:57 GMT (envelope-from git) Date: Wed, 7 Jul 2021 18:15:57 GMT Message-Id: <202107071815.167IFvon007721@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Martin Matuska Subject: git: 48b4fe050328 - main - zfs: attach zpool_influxdb to build MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mm X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 48b4fe0503282f03d25e23f44109c5cb6d450f7c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 18:15:58 -0000 The branch main has been updated by mm: URL: https://cgit.FreeBSD.org/src/commit/?id=48b4fe0503282f03d25e23f44109c5cb6d450f7c commit 48b4fe0503282f03d25e23f44109c5cb6d450f7c Author: Martin Matuska AuthorDate: 2021-07-07 17:45:52 +0000 Commit: Martin Matuska CommitDate: 2021-07-07 18:15:12 +0000 zfs: attach zpool_influxdb to build From the zpool_influxdb.8 manual page: zpool_influxdb produces InfluxDB-line-protocol-compatible metrics from zpools. Like the zpool command, zpool_influxdb reads the current pool status and statistics. Unlike the zpool command which is intended for humans, zpool_influxdb formats the output in the InfluxDB line protocol. The expected use is as a plugin to a metrics collector or aggregator, such as Telegraf. zpool_influxdb is installed into /usr/libexec/zfs/ Differential revision: https://reviews.freebsd.org/D31094 MFC after: 3 days --- cddl/Makefile | 2 +- cddl/usr.libexec/Makefile | 13 +++++++++++ cddl/usr.libexec/zpool_influxdb/Makefile | 28 ++++++++++++++++++++++ cddl/usr.libexec/zpool_influxdb/Makefile.depend | 31 +++++++++++++++++++++++++ etc/mtree/BSD.debug.dist | 2 ++ etc/mtree/BSD.usr.dist | 2 ++ 6 files changed, 77 insertions(+), 1 deletion(-) diff --git a/cddl/Makefile b/cddl/Makefile index 7b9d13146afa..284a370c0167 100644 --- a/cddl/Makefile +++ b/cddl/Makefile @@ -3,7 +3,7 @@ .include SUBDIR= lib .WAIT \ - sbin share usr.bin usr.sbin + sbin share usr.bin usr.libexec usr.sbin SUBDIR.${MK_TESTS}+= tests diff --git a/cddl/usr.libexec/Makefile b/cddl/usr.libexec/Makefile new file mode 100644 index 000000000000..6280cbab5766 --- /dev/null +++ b/cddl/usr.libexec/Makefile @@ -0,0 +1,13 @@ +# $FreeBSD$ + +.include + +SUBDIR= ${_zpool_influxdb} + +.if ${MK_ZFS} != "no" +_zpool_influxdb= zpool_influxdb +.endif + +SUBDIR_PARALLEL= + +.include diff --git a/cddl/usr.libexec/zpool_influxdb/Makefile b/cddl/usr.libexec/zpool_influxdb/Makefile new file mode 100644 index 000000000000..2fb22f02ef32 --- /dev/null +++ b/cddl/usr.libexec/zpool_influxdb/Makefile @@ -0,0 +1,28 @@ +# $FreeBSD$ + +ZFSTOP= ${SRCTOP}/sys/contrib/openzfs + +.PATH: ${ZFSTOP}/cmd/zpool_influxdb +.PATH: ${ZFSTOP}/man/man8 + +PROG= zpool_influxdb +MAN= zpool_influxdb.8 +BINDIR?= /usr/libexec/zfs + +WARNS?= 0 +CSTD= c99 + +CFLAGS+= \ + -DIN_BASE \ + -I${ZFSTOP}/include \ + -I${ZFSTOP}/lib/libspl/include \ + -I${ZFSTOP}/lib/libspl/include/os/freebsd \ + -include ${ZFSTOP}/include/os/freebsd/spl/sys/ccompile.h \ + -DHAVE_ISSETUGID \ + -include ${SRCTOP}/sys/modules/zfs/zfs_config.h \ + -DSYSCONFDIR=\"/etc\" \ + -DPKGDATADIR=\"/usr/share/zfs\" + +LIBADD= nvpair spl zfs + +.include diff --git a/cddl/usr.libexec/zpool_influxdb/Makefile.depend b/cddl/usr.libexec/zpool_influxdb/Makefile.depend new file mode 100644 index 000000000000..53090da6e2fc --- /dev/null +++ b/cddl/usr.libexec/zpool_influxdb/Makefile.depend @@ -0,0 +1,31 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + cddl/lib/libavl \ + cddl/lib/libnvpair \ + cddl/lib/libumem \ + cddl/lib/libuutil \ + cddl/lib/libzfs \ + cddl/lib/libzfs_core \ + gnu/lib/csu \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/libc \ + lib/libcompiler_rt \ + lib/libexpat \ + lib/libgeom \ + lib/libmd \ + lib/libsbuf \ + lib/libthr \ + lib/libutil \ + lib/libz \ + lib/msun \ + + +.include + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/etc/mtree/BSD.debug.dist b/etc/mtree/BSD.debug.dist index d377e9fe1f69..551137beefa3 100644 --- a/etc/mtree/BSD.debug.dist +++ b/etc/mtree/BSD.debug.dist @@ -54,6 +54,8 @@ .. sm.bin .. + zfs + .. .. sbin .. diff --git a/etc/mtree/BSD.usr.dist b/etc/mtree/BSD.usr.dist index b4bac9406f79..97d17cedb5a1 100644 --- a/etc/mtree/BSD.usr.dist +++ b/etc/mtree/BSD.usr.dist @@ -156,6 +156,8 @@ .. sm.bin .. + zfs + .. .. local .. From owner-dev-commits-src-main@freebsd.org Wed Jul 7 18:36:20 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1990565A67D; Wed, 7 Jul 2021 18:36:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GKp6D0Ftvz4gyy; Wed, 7 Jul 2021 18:36:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E54F11253F; Wed, 7 Jul 2021 18:36:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 167IaJGl034163; Wed, 7 Jul 2021 18:36:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 167IaJFH034162; Wed, 7 Jul 2021 18:36:19 GMT (envelope-from git) Date: Wed, 7 Jul 2021 18:36:19 GMT Message-Id: <202107071836.167IaJFH034162@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Cox Subject: git: 0add3c9945c8 - main - arm64: Simplify fcmpset failure in pmap_promote_l2() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: alc X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0add3c9945c85c7f766f9225866e99e2a805819b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 18:36:20 -0000 The branch main has been updated by alc: URL: https://cgit.FreeBSD.org/src/commit/?id=0add3c9945c85c7f766f9225866e99e2a805819b commit 0add3c9945c85c7f766f9225866e99e2a805819b Author: Alan Cox AuthorDate: 2021-07-07 18:16:03 +0000 Commit: Alan Cox CommitDate: 2021-07-07 18:34:11 +0000 arm64: Simplify fcmpset failure in pmap_promote_l2() When the initial fcmpset in pmap_promote_l2() fails, there is no need to repeat the check for the physical address being 2MB aligned or for the accessed bit being set. While the pmap is locked the hardware can only transition the accessed bit from 0 to 1, and we have already determined that it is 1 when the fcmpset fails. MFC after: 1 week --- sys/arm64/arm64/pmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c index bf476490b6be..7758a84d81d5 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -3502,7 +3502,6 @@ pmap_promote_l2(pmap_t pmap, pd_entry_t *l2, vm_offset_t va, firstl3 = pmap_l2_to_l3(l2, sva); newl2 = pmap_load(firstl3); -setl2: if (((newl2 & (~ATTR_MASK | ATTR_AF)) & L2_OFFSET) != ATTR_AF) { atomic_add_long(&pmap_l2_p_failures, 1); CTR2(KTR_PMAP, "pmap_promote_l2: failure for va %#lx" @@ -3510,6 +3509,7 @@ setl2: return; } +setl2: if ((newl2 & (ATTR_S1_AP_RW_BIT | ATTR_SW_DBM)) == (ATTR_S1_AP(ATTR_S1_AP_RO) | ATTR_SW_DBM)) { /* From owner-dev-commits-src-main@freebsd.org Wed Jul 7 19:08:44 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8784365B495; Wed, 7 Jul 2021 19:08:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GKpqc3TP7z4mSS; Wed, 7 Jul 2021 19:08:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5FBC5128CF; Wed, 7 Jul 2021 19:08:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 167J8iDf073954; Wed, 7 Jul 2021 19:08:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 167J8iXL073953; Wed, 7 Jul 2021 19:08:44 GMT (envelope-from git) Date: Wed, 7 Jul 2021 19:08:44 GMT Message-Id: <202107071908.167J8iXL073953@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Gallatin Subject: git: 0756bdf19c5c - main - ktls: make ktls_disable_ifnet() shim static MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gallatin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0756bdf19c5c97fabf4090e844f8df9505fbd566 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 19:08:44 -0000 The branch main has been updated by gallatin: URL: https://cgit.FreeBSD.org/src/commit/?id=0756bdf19c5c97fabf4090e844f8df9505fbd566 commit 0756bdf19c5c97fabf4090e844f8df9505fbd566 Author: Andrew Gallatin AuthorDate: 2021-07-07 19:05:49 +0000 Commit: Andrew Gallatin CommitDate: 2021-07-07 19:08:13 +0000 ktls: make ktls_disable_ifnet() shim static A user reported that when compiling without KERN_TLS, and with -O0, the kernel failed to link due to ktls_disable_ifnet() being undefined. Making the shim static works around this issue. Reported by: Gary Jennejohn Sponsored by: Netflix --- sys/sys/ktls.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/sys/ktls.h b/sys/sys/ktls.h index 7fd8831878b4..a4156eb10395 100644 --- a/sys/sys/ktls.h +++ b/sys/sys/ktls.h @@ -238,7 +238,7 @@ extern unsigned int ktls_ifnet_max_rexmit_pct; void ktls_disable_ifnet(void *arg); #else #define ktls_ifnet_max_rexmit_pct 1 -inline void +static inline void ktls_disable_ifnet(void *arg __unused) { } From owner-dev-commits-src-main@freebsd.org Wed Jul 7 19:53:50 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 421EB65BDFF; Wed, 7 Jul 2021 19:53:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GKqqf1H7lz4sJq; Wed, 7 Jul 2021 19:53:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 141EF139AE; Wed, 7 Jul 2021 19:53:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 167Jrnnv039756; Wed, 7 Jul 2021 19:53:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 167JrnnU039755; Wed, 7 Jul 2021 19:53:49 GMT (envelope-from git) Date: Wed, 7 Jul 2021 19:53:49 GMT Message-Id: <202107071953.167JrnnU039755@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Somers Subject: git: 3874c0abb0af - main - [skip ci] correct a few SPDX license tags MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3874c0abb0afaea6adc24ac96dc9dc5043f2b69e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 19:53:50 -0000 The branch main has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=3874c0abb0afaea6adc24ac96dc9dc5043f2b69e commit 3874c0abb0afaea6adc24ac96dc9dc5043f2b69e Author: Alan Somers AuthorDate: 2021-07-07 19:52:20 +0000 Commit: Alan Somers CommitDate: 2021-07-07 19:52:20 +0000 [skip ci] correct a few SPDX license tags These were all incorrectly labeled as 2-clause BSD licenses by a semi-automated process, when in fact they are 3-clause. Discussed with: pfg, imp MFC after: 2 weeks Sponsored by: Axcient --- lib/libgeom/geom_getxml.c | 2 +- lib/libgeom/geom_stats.c | 2 +- lib/libgeom/geom_xml2tree.c | 2 +- lib/libgeom/libgeom.h | 2 +- sbin/fsck_ffs/ea.c | 2 +- usr.sbin/gstat/gstat.c | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/libgeom/geom_getxml.c b/lib/libgeom/geom_getxml.c index f3d7ba9deb03..48565f707b03 100644 --- a/lib/libgeom/geom_getxml.c +++ b/lib/libgeom/geom_getxml.c @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-3-Clause-FreeBSD * * Copyright (c) 2003 Poul-Henning Kamp * All rights reserved. diff --git a/lib/libgeom/geom_stats.c b/lib/libgeom/geom_stats.c index 7c9191e29686..e8e2969e835f 100644 --- a/lib/libgeom/geom_stats.c +++ b/lib/libgeom/geom_stats.c @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-3-Clause-FreeBSD * * Copyright (c) 2003 Poul-Henning Kamp * All rights reserved. diff --git a/lib/libgeom/geom_xml2tree.c b/lib/libgeom/geom_xml2tree.c index 5f4636f9368b..824800070933 100644 --- a/lib/libgeom/geom_xml2tree.c +++ b/lib/libgeom/geom_xml2tree.c @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-3-Clause-FreeBSD * * Copyright (c) 2003 Poul-Henning Kamp * All rights reserved. diff --git a/lib/libgeom/libgeom.h b/lib/libgeom/libgeom.h index 075d2d21f26c..fc593b234302 100644 --- a/lib/libgeom/libgeom.h +++ b/lib/libgeom/libgeom.h @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-3-Clause-FreeBSD * * Copyright (c) 2003 Poul-Henning Kamp * All rights reserved. diff --git a/sbin/fsck_ffs/ea.c b/sbin/fsck_ffs/ea.c index 7cf20196dfae..54353005bdc0 100644 --- a/sbin/fsck_ffs/ea.c +++ b/sbin/fsck_ffs/ea.c @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-3-Clause-FreeBSD * * Copyright (c) 2002 Poul-Henning Kamp * Copyright (c) 2002 Networks Associates Technology, Inc. diff --git a/usr.sbin/gstat/gstat.c b/usr.sbin/gstat/gstat.c index c2d28720205f..65388c3002ff 100644 --- a/usr.sbin/gstat/gstat.c +++ b/usr.sbin/gstat/gstat.c @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-3-Clause-FreeBSD * * Copyright (c) 2003 Poul-Henning Kamp * All rights reserved. From owner-dev-commits-src-main@freebsd.org Wed Jul 7 20:12:01 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A717165C3F7; Wed, 7 Jul 2021 20:12:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GKrDd4NJrz4tcD; Wed, 7 Jul 2021 20:12:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7F55213E8C; Wed, 7 Jul 2021 20:12:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 167KC1ZE065913; Wed, 7 Jul 2021 20:12:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 167KC1IL065912; Wed, 7 Jul 2021 20:12:01 GMT (envelope-from git) Date: Wed, 7 Jul 2021 20:12:01 GMT Message-Id: <202107072012.167KC1IL065912@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?Q?Fernando Apestegu=C3=ADa?= Subject: git: f6043a672135 - main - ObsoleteFiles.inc: Remove manpages from OLD_FILES MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: fernape X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f6043a672135da8ec090d8878cc844b8aace54f9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 20:12:01 -0000 The branch main has been updated by fernape (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=f6043a672135da8ec090d8878cc844b8aace54f9 commit f6043a672135da8ec090d8878cc844b8aace54f9 Author: Fernando Apesteguía AuthorDate: 2021-07-07 13:15:02 +0000 Commit: Fernando Apesteguía CommitDate: 2021-07-07 18:09:02 +0000 ObsoleteFiles.inc: Remove manpages from OLD_FILES In 0a0f7486413c147d56808b38055c40c64cff61f5 sconfig.8.gz and apmd.8.gz were moved back to the parent directory share/man/man8. This conflicts with a previous entry in OLD_FILES so running 'make delete-old' would delete the new installed files. Reported by: marklmi@yahoo.com Approved by: emaste@ Fixes: 0a0f7486413c - Build manpages for all architectures MFH: 4 weeks Differential Revision: https://reviews.freebsd.org/D31092 --- ObsoleteFiles.inc | 2 -- 1 file changed, 2 deletions(-) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index 60707faebefc..d72aea5e8efc 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -14840,11 +14840,9 @@ OLD_FILES+=usr/share/man/man7/mmroff.7.gz OLD_FILES+=usr/share/man/man7/mwww.7.gz OLD_FILES+=usr/share/man/man8/apm.8.gz OLD_FILES+=usr/share/man/man8/apmconf.8.gz -OLD_FILES+=usr/share/man/man8/apmd.8.gz OLD_FILES+=usr/share/man/man8/dm.8.gz OLD_FILES+=usr/share/man/man8/pam_ftp.8.gz OLD_FILES+=usr/share/man/man8/pam_wheel.8.gz -OLD_FILES+=usr/share/man/man8/sconfig.8.gz OLD_FILES+=usr/share/man/man8/ssl.8.gz OLD_FILES+=usr/share/man/man8/wlconfig.8.gz OLD_FILES+=usr/share/man/man9/CURSIG.9.gz From owner-dev-commits-src-main@freebsd.org Wed Jul 7 20:49:00 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9D08665D089; Wed, 7 Jul 2021 20:49:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GKs3J46GWz3J2n; Wed, 7 Jul 2021 20:49:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 753FE1444E; Wed, 7 Jul 2021 20:49:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 167Kn0wU006978; Wed, 7 Jul 2021 20:49:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 167Kn01O006977; Wed, 7 Jul 2021 20:49:00 GMT (envelope-from git) Date: Wed, 7 Jul 2021 20:49:00 GMT Message-Id: <202107072049.167Kn01O006977@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: f68e3ea831b7 - main - devmatch: defer until after kld MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f68e3ea831b76a8927eed7f7abfea55ee5a193c4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 20:49:00 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=f68e3ea831b76a8927eed7f7abfea55ee5a193c4 commit f68e3ea831b76a8927eed7f7abfea55ee5a193c4 Author: Helge Oldach AuthorDate: 2021-07-07 20:43:35 +0000 Commit: Warner Losh CommitDate: 2021-07-07 20:48:40 +0000 devmatch: defer until after kld devmatch loads a number of things automatically. Allow the list of things to load to happen first in case those drivers affect what would be loaded. Normally, this will produce the same results, but there's some special cases that may not when drivers are loaded that report other drivers missing, like virtio_pci. PR: 253287 Reviewed by: imp MFC After: 2 weeks --- libexec/rc/rc.d/devmatch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libexec/rc/rc.d/devmatch b/libexec/rc/rc.d/devmatch index 0b2e3719dabb..dd61307a4e0a 100755 --- a/libexec/rc/rc.d/devmatch +++ b/libexec/rc/rc.d/devmatch @@ -26,7 +26,7 @@ # $FreeBSD$ # # PROVIDE: devmatch -# REQUIRE: kldxref +# REQUIRE: kld # BEFORE: netif # KEYWORD: nojail From owner-dev-commits-src-main@freebsd.org Wed Jul 7 21:32:13 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7F81365D6A3; Wed, 7 Jul 2021 21:32:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GKt193BgFz3Q6Q; Wed, 7 Jul 2021 21:32:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 563DF14D33; Wed, 7 Jul 2021 21:32:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 167LWDla073425; Wed, 7 Jul 2021 21:32:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 167LWDte073424; Wed, 7 Jul 2021 21:32:13 GMT (envelope-from git) Date: Wed, 7 Jul 2021 21:32:13 GMT Message-Id: <202107072132.167LWDte073424@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Martin Matuska Subject: git: 7cd22ac43418 - main - zfs: merge openzfs/zfs@bdd11cbb9 (master) into main MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mm X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7cd22ac43418da08448d0bab1009ff3cbda85120 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 21:32:13 -0000 The branch main has been updated by mm: URL: https://cgit.FreeBSD.org/src/commit/?id=7cd22ac43418da08448d0bab1009ff3cbda85120 commit 7cd22ac43418da08448d0bab1009ff3cbda85120 Merge: f68e3ea831b7 bdd11cbb90a2 Author: Martin Matuska AuthorDate: 2021-07-07 21:31:10 +0000 Commit: Martin Matuska CommitDate: 2021-07-07 21:31:52 +0000 zfs: merge openzfs/zfs@bdd11cbb9 (master) into main Notable upstream pull request merges: #12274 Optimize txg_kick() process #12281 Move gethrtime() calls out of vdev queue lock #12287 Remove refcount from spa_config_*( #12289 Compact dbuf/buf hashes and lock arrays #12290 Remove avl_size field from struct avl_tree #12294 Upstream: dmu_zfetch_stream_fini leaks refcount #12295 Fix abd leak, kmem_free correct size of abd_t #12328 FreeBSD: Hardcode abd_chunk_size to PAGE_SIZE Obtained from: OpenZFS OpenZFS commit: bdd11cbb90a2afa54fd00935ac0d34b4ddf2515c sys/contrib/openzfs/cmd/zed/agents/zfs_mod.c | 40 +++++- sys/contrib/openzfs/cmd/zed/zed_disk_event.c | 2 + sys/contrib/openzfs/cmd/zvol_id/zvol_id_main.c | 58 +++++---- sys/contrib/openzfs/include/sys/abd.h | 1 - sys/contrib/openzfs/include/sys/abd_impl.h | 2 +- sys/contrib/openzfs/include/sys/avl_impl.h | 4 +- sys/contrib/openzfs/include/sys/dbuf.h | 4 +- sys/contrib/openzfs/include/sys/spa_impl.h | 4 +- sys/contrib/openzfs/include/sys/txg.h | 2 +- sys/contrib/openzfs/module/avl/avl.c | 2 - sys/contrib/openzfs/module/os/freebsd/zfs/abd_os.c | 136 +++++++++------------ sys/contrib/openzfs/module/os/linux/zfs/abd_os.c | 3 +- sys/contrib/openzfs/module/zfs/abd.c | 2 +- sys/contrib/openzfs/module/zfs/arc.c | 25 +--- sys/contrib/openzfs/module/zfs/dbuf.c | 6 +- sys/contrib/openzfs/module/zfs/dmu_zfetch.c | 2 + sys/contrib/openzfs/module/zfs/dsl_pool.c | 25 +++- sys/contrib/openzfs/module/zfs/spa_misc.c | 19 ++- sys/contrib/openzfs/module/zfs/txg.c | 36 +++--- sys/contrib/openzfs/module/zfs/vdev_queue.c | 11 +- sys/contrib/openzfs/tests/runfiles/linux.run | 9 +- .../openzfs/tests/test-runner/bin/zts-report.py.in | 1 + .../zfs-tests/tests/functional/fault/Makefile.am | 1 + .../tests/functional/fault/auto_online_002_pos.ksh | 94 ++++++++++++++ sys/contrib/openzfs/udev/rules.d/60-zvol.rules.in | 9 +- sys/modules/zfs/zfs_config.h | 4 +- 26 files changed, 303 insertions(+), 199 deletions(-) diff --cc sys/contrib/openzfs/tests/zfs-tests/tests/functional/fault/auto_online_002_pos.ksh index 000000000000,60185ace34bb..60185ace34bb mode 000000,100755..100755 --- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/fault/auto_online_002_pos.ksh +++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/fault/auto_online_002_pos.ksh diff --cc sys/modules/zfs/zfs_config.h index 7983ac8959e7,000000000000..9c7c76fac70f mode 100644,000000..100644 --- a/sys/modules/zfs/zfs_config.h +++ b/sys/modules/zfs/zfs_config.h @@@ -1,774 -1,0 +1,774 @@@ +/* + * $FreeBSD$ + */ + +/* zfs_config.h. Generated from zfs_config.h.in by configure. */ +/* zfs_config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if translation of program messages to the user's native + language is requested. */ +/* #undef ENABLE_NLS */ + +/* bio_end_io_t wants 1 arg */ +/* #undef HAVE_1ARG_BIO_END_IO_T */ + +/* lookup_bdev() wants 1 arg */ +/* #undef HAVE_1ARG_LOOKUP_BDEV */ + +/* submit_bio() wants 1 arg */ +/* #undef HAVE_1ARG_SUBMIT_BIO */ + +/* bdi_setup_and_register() wants 2 args */ +/* #undef HAVE_2ARGS_BDI_SETUP_AND_REGISTER */ + +/* vfs_getattr wants 2 args */ +/* #undef HAVE_2ARGS_VFS_GETATTR */ + +/* zlib_deflate_workspacesize() wants 2 args */ +/* #undef HAVE_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE */ + +/* bdi_setup_and_register() wants 3 args */ +/* #undef HAVE_3ARGS_BDI_SETUP_AND_REGISTER */ + +/* vfs_getattr wants 3 args */ +/* #undef HAVE_3ARGS_VFS_GETATTR */ + +/* vfs_getattr wants 4 args */ +/* #undef HAVE_4ARGS_VFS_GETATTR */ + +/* kernel has access_ok with 'type' parameter */ +/* #undef HAVE_ACCESS_OK_TYPE */ + +/* posix_acl has refcount_t */ +/* #undef HAVE_ACL_REFCOUNT */ + +/* Define if host toolchain supports AES */ +#define HAVE_AES 1 + +#ifdef __amd64__ +#ifndef RESCUE +/* Define if host toolchain supports AVX */ +#define HAVE_AVX 1 +#endif + +/* Define if host toolchain supports AVX2 */ +#define HAVE_AVX2 1 + +/* Define if host toolchain supports AVX512BW */ +#define HAVE_AVX512BW 1 + +/* Define if host toolchain supports AVX512CD */ +#define HAVE_AVX512CD 1 + +/* Define if host toolchain supports AVX512DQ */ +#define HAVE_AVX512DQ 1 + +/* Define if host toolchain supports AVX512ER */ +#define HAVE_AVX512ER 1 + +/* Define if host toolchain supports AVX512F */ +#define HAVE_AVX512F 1 + +/* Define if host toolchain supports AVX512IFMA */ +#define HAVE_AVX512IFMA 1 + +/* Define if host toolchain supports AVX512PF */ +#define HAVE_AVX512PF 1 + +/* Define if host toolchain supports AVX512VBMI */ +#define HAVE_AVX512VBMI 1 + +/* Define if host toolchain supports AVX512VL */ +#define HAVE_AVX512VL 1 +#endif + +/* bdev_check_media_change() exists */ +/* #undef HAVE_BDEV_CHECK_MEDIA_CHANGE */ + +/* bdev_whole() is available */ +/* #undef HAVE_BDEV_WHOLE */ + +/* bio->bi_opf is defined */ +/* #undef HAVE_BIO_BI_OPF */ + +/* bio->bi_status exists */ +/* #undef HAVE_BIO_BI_STATUS */ + +/* bio has bi_iter */ +/* #undef HAVE_BIO_BVEC_ITER */ + +/* bio_*_io_acct() available */ +/* #undef HAVE_BIO_IO_ACCT */ + +/* bio_set_dev() is available */ +/* #undef HAVE_BIO_SET_DEV */ + +/* bio_set_dev() GPL-only */ +/* #undef HAVE_BIO_SET_DEV_GPL_ONLY */ + +/* bio_set_op_attrs is available */ +/* #undef HAVE_BIO_SET_OP_ATTRS */ + +/* blkdev_reread_part() exists */ +/* #undef HAVE_BLKDEV_REREAD_PART */ + +/* blkg_tryget() is available */ +/* #undef HAVE_BLKG_TRYGET */ + +/* blkg_tryget() GPL-only */ +/* #undef HAVE_BLKG_TRYGET_GPL_ONLY */ + +/* blk_alloc_queue() expects request function */ +/* #undef HAVE_BLK_ALLOC_QUEUE_REQUEST_FN */ + +/* blk_alloc_queue_rh() expects request function */ +/* #undef HAVE_BLK_ALLOC_QUEUE_REQUEST_FN_RH */ + +/* blk queue backing_dev_info is dynamic */ +/* #undef HAVE_BLK_QUEUE_BDI_DYNAMIC */ + +/* blk_queue_flag_clear() exists */ +/* #undef HAVE_BLK_QUEUE_FLAG_CLEAR */ + +/* blk_queue_flag_set() exists */ +/* #undef HAVE_BLK_QUEUE_FLAG_SET */ + +/* blk_queue_flush() is available */ +/* #undef HAVE_BLK_QUEUE_FLUSH */ + +/* blk_queue_flush() is GPL-only */ +/* #undef HAVE_BLK_QUEUE_FLUSH_GPL_ONLY */ + +/* blk_queue_secdiscard() is available */ +/* #undef HAVE_BLK_QUEUE_SECDISCARD */ + +/* blk_queue_secure_erase() is available */ +/* #undef HAVE_BLK_QUEUE_SECURE_ERASE */ + +/* blk_queue_write_cache() exists */ +/* #undef HAVE_BLK_QUEUE_WRITE_CACHE */ + +/* blk_queue_write_cache() is GPL-only */ +/* #undef HAVE_BLK_QUEUE_WRITE_CACHE_GPL_ONLY */ + +/* Define to 1 if you have the Mac OS X function CFLocaleCopyCurrent in the + CoreFoundation framework. */ +/* #undef HAVE_CFLOCALECOPYCURRENT */ + +/* Define to 1 if you have the Mac OS X function + CFLocaleCopyPreferredLanguages in the CoreFoundation framework. */ +/* #undef HAVE_CFLOCALECOPYPREFERREDLANGUAGES */ + +/* Define to 1 if you have the Mac OS X function CFPreferencesCopyAppValue in + the CoreFoundation framework. */ +/* #undef HAVE_CFPREFERENCESCOPYAPPVALUE */ + +/* check_disk_change() exists */ +/* #undef HAVE_CHECK_DISK_CHANGE */ + +/* clear_inode() is available */ +/* #undef HAVE_CLEAR_INODE */ + +/* dentry uses const struct dentry_operations */ +/* #undef HAVE_CONST_DENTRY_OPERATIONS */ + +/* copy_from_iter() is available */ +/* #undef HAVE_COPY_FROM_ITER */ + +/* copy_to_iter() is available */ +/* #undef HAVE_COPY_TO_ITER */ + +/* yes */ +/* #undef HAVE_CPU_HOTPLUG */ + +/* current_time() exists */ +/* #undef HAVE_CURRENT_TIME */ + +/* Define if the GNU dcgettext() function is already present or preinstalled. + */ +/* #undef HAVE_DCGETTEXT */ + +/* DECLARE_EVENT_CLASS() is available */ +/* #undef HAVE_DECLARE_EVENT_CLASS */ + +/* lookup_bdev() wants dev_t arg */ +/* #undef HAVE_DEVT_LOOKUP_BDEV */ + +/* sops->dirty_inode() wants flags */ +/* #undef HAVE_DIRTY_INODE_WITH_FLAGS */ + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* d_make_root() is available */ +/* #undef HAVE_D_MAKE_ROOT */ + +/* d_prune_aliases() is available */ +/* #undef HAVE_D_PRUNE_ALIASES */ + +/* dops->d_revalidate() operation takes nameidata */ +/* #undef HAVE_D_REVALIDATE_NAMEIDATA */ + +/* eops->encode_fh() wants child and parent inodes */ +/* #undef HAVE_ENCODE_FH_WITH_INODE */ + +/* sops->evict_inode() exists */ +/* #undef HAVE_EVICT_INODE */ + +/* fops->aio_fsync() exists */ +/* #undef HAVE_FILE_AIO_FSYNC */ + +/* file_dentry() is available */ +/* #undef HAVE_FILE_DENTRY */ + +/* file_inode() is available */ +/* #undef HAVE_FILE_INODE */ + +/* iops->follow_link() cookie */ +/* #undef HAVE_FOLLOW_LINK_COOKIE */ + +/* iops->follow_link() nameidata */ +/* #undef HAVE_FOLLOW_LINK_NAMEIDATA */ + +/* fops->fsync() with range */ +/* #undef HAVE_FSYNC_RANGE */ + +/* fops->fsync() without dentry */ +/* #undef HAVE_FSYNC_WITHOUT_DENTRY */ + +/* generic_*_io_acct() 3 arg available */ +/* #undef HAVE_GENERIC_IO_ACCT_3ARG */ + +/* generic_*_io_acct() 4 arg available */ +/* #undef HAVE_GENERIC_IO_ACCT_4ARG */ + +/* generic_readlink is global */ +/* #undef HAVE_GENERIC_READLINK */ + +/* generic_setxattr() exists */ +/* #undef HAVE_GENERIC_SETXATTR */ + +/* generic_write_checks() takes kiocb */ +/* #undef HAVE_GENERIC_WRITE_CHECKS_KIOCB */ + +/* Define if the GNU gettext() function is already present or preinstalled. */ +/* #undef HAVE_GETTEXT */ + +/* iops->get_link() cookie */ +/* #undef HAVE_GET_LINK_COOKIE */ + +/* iops->get_link() delayed */ +/* #undef HAVE_GET_LINK_DELAYED */ + +/* group_info->gid exists */ +/* #undef HAVE_GROUP_INFO_GID */ + +/* has_capability() is available */ +/* #undef HAVE_HAS_CAPABILITY */ + +/* Define if you have the iconv() function and it works. */ +#define HAVE_ICONV 1 + +/* yes */ +/* #undef HAVE_INODE_LOCK_SHARED */ + +/* inode_set_flags() exists */ +/* #undef HAVE_INODE_SET_FLAGS */ + +/* inode_set_iversion() exists */ +/* #undef HAVE_INODE_SET_IVERSION */ + +/* inode->i_*time's are timespec64 */ +/* #undef HAVE_INODE_TIMESPEC64_TIMES */ + +/* timestamp_truncate() exists */ +/* #undef HAVE_INODE_TIMESTAMP_TRUNCATE */ + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* in_compat_syscall() is available */ +/* #undef HAVE_IN_COMPAT_SYSCALL */ + +/* iov_iter_advance() is available */ +/* #undef HAVE_IOV_ITER_ADVANCE */ + +/* iov_iter_count() is available */ +/* #undef HAVE_IOV_ITER_COUNT */ + +/* iov_iter_fault_in_readable() is available */ +/* #undef HAVE_IOV_ITER_FAULT_IN_READABLE */ + +/* iov_iter_init() is available */ +/* #undef HAVE_IOV_ITER_INIT */ + +/* iov_iter_init() is available */ +/* #undef HAVE_IOV_ITER_INIT_LEGACY */ + +/* iov_iter_revert() is available */ +/* #undef HAVE_IOV_ITER_REVERT */ + +/* iov_iter types are available */ +/* #undef HAVE_IOV_ITER_TYPES */ + +/* yes */ +/* #undef HAVE_IO_SCHEDULE_TIMEOUT */ + +/* Define to 1 if you have the `issetugid' function. */ +#define HAVE_ISSETUGID 1 + +/* kernel has kernel_fpu_* functions */ +/* #undef HAVE_KERNEL_FPU */ + +/* kernel has asm/fpu/api.h */ +/* #undef HAVE_KERNEL_FPU_API_HEADER */ + +/* kernel fpu internal */ +/* #undef HAVE_KERNEL_FPU_INTERNAL */ + +/* uncached_acl_sentinel() exists */ +/* #undef HAVE_KERNEL_GET_ACL_HANDLE_CACHE */ + +/* kernel does stack verification */ +/* #undef HAVE_KERNEL_OBJTOOL */ + +/* kernel has linux/objtool.h */ +/* #undef HAVE_KERNEL_OBJTOOL_HEADER */ + +/* kernel_read() take loff_t pointer */ +/* #undef HAVE_KERNEL_READ_PPOS */ + +/* timer_list.function gets a timer_list */ +/* #undef HAVE_KERNEL_TIMER_FUNCTION_TIMER_LIST */ + +/* struct timer_list has a flags member */ +/* #undef HAVE_KERNEL_TIMER_LIST_FLAGS */ + +/* timer_setup() is available */ +/* #undef HAVE_KERNEL_TIMER_SETUP */ + +/* kernel_write() take loff_t pointer */ +/* #undef HAVE_KERNEL_WRITE_PPOS */ + +/* kmem_cache_create_usercopy() exists */ +/* #undef HAVE_KMEM_CACHE_CREATE_USERCOPY */ + +/* kstrtoul() exists */ +/* #undef HAVE_KSTRTOUL */ + +/* ktime_get_coarse_real_ts64() exists */ +/* #undef HAVE_KTIME_GET_COARSE_REAL_TS64 */ + +/* ktime_get_raw_ts64() exists */ +/* #undef HAVE_KTIME_GET_RAW_TS64 */ + +/* kvmalloc exists */ +/* #undef HAVE_KVMALLOC */ + +/* kernel has large stacks */ +/* #undef HAVE_LARGE_STACKS */ + +/* Define if you have [aio] */ +/* #undef HAVE_LIBAIO */ + +/* Define if you have [blkid] */ +/* #undef HAVE_LIBBLKID */ + +/* Define if you have [crypto] */ +#define HAVE_LIBCRYPTO 1 + +/* Define if you have [tirpc] */ +/* #undef HAVE_LIBTIRPC */ + +/* Define if you have [udev] */ +/* #undef HAVE_LIBUDEV */ + +/* Define if you have [uuid] */ +/* #undef HAVE_LIBUUID */ + +/* lseek_execute() is available */ +/* #undef HAVE_LSEEK_EXECUTE */ + +/* makedev() is declared in sys/mkdev.h */ +/* #undef HAVE_MAKEDEV_IN_MKDEV */ + +/* makedev() is declared in sys/sysmacros.h */ +/* #undef HAVE_MAKEDEV_IN_SYSMACROS */ + +/* Noting that make_request_fn() returns blk_qc_t */ +/* #undef HAVE_MAKE_REQUEST_FN_RET_QC */ + +/* Noting that make_request_fn() returns void */ +/* #undef HAVE_MAKE_REQUEST_FN_RET_VOID */ + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* iops->create()/mkdir()/mknod() take umode_t */ +/* #undef HAVE_MKDIR_UMODE_T */ + +/* Define to 1 if you have the `mlockall' function. */ +#define HAVE_MLOCKALL 1 + +/* lookup_bdev() wants mode arg */ +/* #undef HAVE_MODE_LOOKUP_BDEV */ + +/* Define if host toolchain supports MOVBE */ +#define HAVE_MOVBE 1 + +/* new_sync_read()/new_sync_write() are available */ +/* #undef HAVE_NEW_SYNC_READ */ + +/* iops->getattr() takes a path */ +/* #undef HAVE_PATH_IOPS_GETATTR */ + +/* Define if host toolchain supports PCLMULQDQ */ +#define HAVE_PCLMULQDQ 1 + +/* percpu_counter_init() wants gfp_t */ +/* #undef HAVE_PERCPU_COUNTER_INIT_WITH_GFP */ + +/* posix_acl_chmod() exists */ +/* #undef HAVE_POSIX_ACL_CHMOD */ + +/* posix_acl_from_xattr() needs user_ns */ +/* #undef HAVE_POSIX_ACL_FROM_XATTR_USERNS */ + +/* posix_acl_release() is available */ +/* #undef HAVE_POSIX_ACL_RELEASE */ + +/* posix_acl_release() is GPL-only */ +/* #undef HAVE_POSIX_ACL_RELEASE_GPL_ONLY */ + +/* posix_acl_valid() wants user namespace */ +/* #undef HAVE_POSIX_ACL_VALID_WITH_NS */ + +/* proc_ops structure exists */ +/* #undef HAVE_PROC_OPS_STRUCT */ + +/* iops->put_link() cookie */ +/* #undef HAVE_PUT_LINK_COOKIE */ + +/* iops->put_link() delayed */ +/* #undef HAVE_PUT_LINK_DELAYED */ + +/* iops->put_link() nameidata */ +/* #undef HAVE_PUT_LINK_NAMEIDATA */ + +/* If available, contains the Python version number currently in use. */ +#define HAVE_PYTHON "3.7" + +/* qat is enabled and existed */ +/* #undef HAVE_QAT */ + +/* iops->rename() wants flags */ +/* #undef HAVE_RENAME_WANTS_FLAGS */ + +/* REQ_DISCARD is defined */ +/* #undef HAVE_REQ_DISCARD */ + +/* REQ_FLUSH is defined */ +/* #undef HAVE_REQ_FLUSH */ + +/* REQ_OP_DISCARD is defined */ +/* #undef HAVE_REQ_OP_DISCARD */ + +/* REQ_OP_FLUSH is defined */ +/* #undef HAVE_REQ_OP_FLUSH */ + +/* REQ_OP_SECURE_ERASE is defined */ +/* #undef HAVE_REQ_OP_SECURE_ERASE */ + +/* REQ_PREFLUSH is defined */ +/* #undef HAVE_REQ_PREFLUSH */ + +/* revalidate_disk() is available */ +/* #undef HAVE_REVALIDATE_DISK */ + +/* revalidate_disk_size() is available */ +/* #undef HAVE_REVALIDATE_DISK_SIZE */ + +/* struct rw_semaphore has member activity */ +/* #undef HAVE_RWSEM_ACTIVITY */ + +/* struct rw_semaphore has atomic_long_t member count */ +/* #undef HAVE_RWSEM_ATOMIC_LONG_COUNT */ + +/* linux/sched/signal.h exists */ +/* #undef HAVE_SCHED_SIGNAL_HEADER */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SECURITY_PAM_MODULES_H 1 + +/* setattr_prepare() is available */ +/* #undef HAVE_SETATTR_PREPARE */ + +/* iops->set_acl() exists */ +/* #undef HAVE_SET_ACL */ + +/* set_cached_acl() is usable */ +/* #undef HAVE_SET_CACHED_ACL_USABLE */ + +/* struct shrink_control exists */ +/* #undef HAVE_SHRINK_CONTROL_STRUCT */ + +/* new shrinker callback wants 2 args */ +/* #undef HAVE_SINGLE_SHRINKER_CALLBACK */ + +/* ->count_objects exists */ +/* #undef HAVE_SPLIT_SHRINKER_CALLBACK */ + +#if defined(__amd64__) || defined(__i386__) +/* Define if host toolchain supports SSE */ +#define HAVE_SSE 1 + +/* Define if host toolchain supports SSE2 */ +#define HAVE_SSE2 1 + +/* Define if host toolchain supports SSE3 */ +#define HAVE_SSE3 1 + +/* Define if host toolchain supports SSE4.1 */ +#define HAVE_SSE4_1 1 + +/* Define if host toolchain supports SSE4.2 */ +#define HAVE_SSE4_2 1 + +/* Define if host toolchain supports SSSE3 */ +#define HAVE_SSSE3 1 +#endif + +/* STACK_FRAME_NON_STANDARD is defined */ +/* #undef HAVE_STACK_FRAME_NON_STANDARD */ + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `strlcat' function. */ +#define HAVE_STRLCAT 1 + +/* Define to 1 if you have the `strlcpy' function. */ +#define HAVE_STRLCPY 1 + +/* submit_bio is member of struct block_device_operations */ +/* #undef HAVE_SUBMIT_BIO_IN_BLOCK_DEVICE_OPERATIONS */ + +/* super_setup_bdi_name() exits */ +/* #undef HAVE_SUPER_SETUP_BDI_NAME */ + +/* super_block->s_user_ns exists */ +/* #undef HAVE_SUPER_USER_NS */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* i_op->tmpfile() exists */ +/* #undef HAVE_TMPFILE */ + +/* totalhigh_pages() exists */ +/* #undef HAVE_TOTALHIGH_PAGES */ + +/* kernel has totalram_pages() */ +/* #undef HAVE_TOTALRAM_PAGES_FUNC */ + +/* Define to 1 if you have the `udev_device_get_is_initialized' function. */ +/* #undef HAVE_UDEV_DEVICE_GET_IS_INITIALIZED */ + +/* kernel has __kernel_fpu_* functions */ +/* #undef HAVE_UNDERSCORE_KERNEL_FPU */ + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* iops->getattr() takes a vfsmount */ +/* #undef HAVE_VFSMOUNT_IOPS_GETATTR */ + +/* aops->direct_IO() uses iovec */ +/* #undef HAVE_VFS_DIRECT_IO_IOVEC */ + +/* aops->direct_IO() uses iov_iter without rw */ +/* #undef HAVE_VFS_DIRECT_IO_ITER */ + +/* aops->direct_IO() uses iov_iter with offset */ +/* #undef HAVE_VFS_DIRECT_IO_ITER_OFFSET */ + +/* aops->direct_IO() uses iov_iter with rw and offset */ +/* #undef HAVE_VFS_DIRECT_IO_ITER_RW_OFFSET */ + +/* All required iov_iter interfaces are available */ +/* #undef HAVE_VFS_IOV_ITER */ + +/* fops->iterate() is available */ +/* #undef HAVE_VFS_ITERATE */ + +/* fops->iterate_shared() is available */ +/* #undef HAVE_VFS_ITERATE_SHARED */ + +/* fops->readdir() is available */ +/* #undef HAVE_VFS_READDIR */ + +/* fops->read/write_iter() are available */ +/* #undef HAVE_VFS_RW_ITERATE */ + +/* __vmalloc page flags exists */ +/* #undef HAVE_VMALLOC_PAGE_KERNEL */ + +/* yes */ +/* #undef HAVE_WAIT_ON_BIT_ACTION */ + +/* wait_queue_entry_t exists */ +/* #undef HAVE_WAIT_QUEUE_ENTRY_T */ + +/* wq_head->head and wq_entry->entry exist */ +/* #undef HAVE_WAIT_QUEUE_HEAD_ENTRY */ + +/* xattr_handler->get() wants dentry */ +/* #undef HAVE_XATTR_GET_DENTRY */ + +/* xattr_handler->get() wants both dentry and inode */ +/* #undef HAVE_XATTR_GET_DENTRY_INODE */ + +/* xattr_handler->get() wants xattr_handler */ +/* #undef HAVE_XATTR_GET_HANDLER */ + +/* xattr_handler has name */ +/* #undef HAVE_XATTR_HANDLER_NAME */ + +/* xattr_handler->list() wants dentry */ +/* #undef HAVE_XATTR_LIST_DENTRY */ + +/* xattr_handler->list() wants xattr_handler */ +/* #undef HAVE_XATTR_LIST_HANDLER */ + +/* xattr_handler->list() wants simple */ +/* #undef HAVE_XATTR_LIST_SIMPLE */ + +/* xattr_handler->set() wants dentry */ +/* #undef HAVE_XATTR_SET_DENTRY */ + +/* xattr_handler->set() wants both dentry and inode */ +/* #undef HAVE_XATTR_SET_DENTRY_INODE */ + +/* xattr_handler->set() wants xattr_handler */ +/* #undef HAVE_XATTR_SET_HANDLER */ + +/* Define if you have [z] */ +#define HAVE_ZLIB 1 + +/* __posix_acl_chmod() exists */ +/* #undef HAVE___POSIX_ACL_CHMOD */ + +/* kernel exports FPU functions */ +/* #undef KERNEL_EXPORTS_X86_FPU */ + +/* Define to the sub-directory where libtool stores uninstalled libraries. */ +#define LT_OBJDIR ".libs/" + +/* make_request_fn() return type */ +/* #undef MAKE_REQUEST_FN_RET */ + +/* hardened module_param_call */ +/* #undef MODULE_PARAM_CALL_CONST */ + +/* struct shrink_control has nid */ +/* #undef SHRINK_CONTROL_HAS_NID */ + +/* Defined for legacy compatibility. */ +#define SPL_META_ALIAS ZFS_META_ALIAS + +/* Defined for legacy compatibility. */ +#define SPL_META_RELEASE ZFS_META_RELEASE + +/* Defined for legacy compatibility. */ +#define SPL_META_VERSION ZFS_META_VERSION + +/* True if ZFS is to be compiled for a FreeBSD system */ +#define SYSTEM_FREEBSD 1 + +/* True if ZFS is to be compiled for a Linux system */ +/* #undef SYSTEM_LINUX */ + +/* zfs debugging enabled */ +/* #undef ZFS_DEBUG */ + +/* /dev/zfs minor */ +/* #undef ZFS_DEVICE_MINOR */ + +/* enum node_stat_item contains NR_FILE_PAGES */ +/* #undef ZFS_ENUM_NODE_STAT_ITEM_NR_FILE_PAGES */ + +/* enum node_stat_item contains NR_INACTIVE_ANON */ +/* #undef ZFS_ENUM_NODE_STAT_ITEM_NR_INACTIVE_ANON */ + +/* enum node_stat_item contains NR_INACTIVE_FILE */ +/* #undef ZFS_ENUM_NODE_STAT_ITEM_NR_INACTIVE_FILE */ + +/* enum zone_stat_item contains NR_FILE_PAGES */ +/* #undef ZFS_ENUM_ZONE_STAT_ITEM_NR_FILE_PAGES */ + +/* enum zone_stat_item contains NR_INACTIVE_ANON */ +/* #undef ZFS_ENUM_ZONE_STAT_ITEM_NR_INACTIVE_ANON */ + +/* enum zone_stat_item contains NR_INACTIVE_FILE */ +/* #undef ZFS_ENUM_ZONE_STAT_ITEM_NR_INACTIVE_FILE */ + +/* global_node_page_state() exists */ +/* #undef ZFS_GLOBAL_NODE_PAGE_STATE */ + +/* global_zone_page_state() exists */ +/* #undef ZFS_GLOBAL_ZONE_PAGE_STATE */ + +/* Define to 1 if GPL-only symbols can be used */ +/* #undef ZFS_IS_GPL_COMPATIBLE */ + +/* Define the project alias string. */ - #define ZFS_META_ALIAS "zfs-2.1.99-FreeBSD_g4694131a0" ++#define ZFS_META_ALIAS "zfs-2.1.99-FreeBSD_gbdd11cbb9" + +/* Define the project author. */ +#define ZFS_META_AUTHOR "OpenZFS" + +/* Define the project release date. */ +/* #undef ZFS_META_DATA */ + +/* Define the maximum compatible kernel version. */ +#define ZFS_META_KVER_MAX "5.13" + +/* Define the minimum compatible kernel version. */ +#define ZFS_META_KVER_MIN "3.10" + +/* Define the project license. */ +#define ZFS_META_LICENSE "CDDL" + +/* Define the libtool library 'age' version information. */ +/* #undef ZFS_META_LT_AGE */ + +/* Define the libtool library 'current' version information. */ +/* #undef ZFS_META_LT_CURRENT */ + +/* Define the libtool library 'revision' version information. */ +/* #undef ZFS_META_LT_REVISION */ + +/* Define the project name. */ +#define ZFS_META_NAME "zfs" + +/* Define the project release. */ - #define ZFS_META_RELEASE "FreeBSD_g4694131a0" ++#define ZFS_META_RELEASE "FreeBSD_gbdd11cbb9" + +/* Define the project version. */ +#define ZFS_META_VERSION "2.1.99" + +/* count is located in percpu_ref.data */ +/* #undef ZFS_PERCPU_REF_COUNT_IN_DATA */ + From owner-dev-commits-src-main@freebsd.org Thu Jul 8 01:27:44 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C0E7065FE38; Thu, 8 Jul 2021 01:27:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GKzDw4vKHz4chH; Thu, 8 Jul 2021 01:27:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 904FE180E5; Thu, 8 Jul 2021 01:27:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1681RiJ3079010; Thu, 8 Jul 2021 01:27:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1681Ri8I079008; Thu, 8 Jul 2021 01:27:44 GMT (envelope-from git) Date: Thu, 8 Jul 2021 01:27:44 GMT Message-Id: <202107080127.1681Ri8I079008@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: f39dd6a97844 - main - one-true-awk: import 20210221 (1e4bc42c53a1) which fixes a number of bugs MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f39dd6a9784467f0db5886012b3f4b13899be6b8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jul 2021 01:27:44 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=f39dd6a9784467f0db5886012b3f4b13899be6b8 commit f39dd6a9784467f0db5886012b3f4b13899be6b8 Merge: 7cd22ac43418 746b7396bb3e Author: Warner Losh AuthorDate: 2021-07-07 23:30:35 +0000 Commit: Warner Losh CommitDate: 2021-07-08 01:25:43 +0000 one-true-awk: import 20210221 (1e4bc42c53a1) which fixes a number of bugs Import the latest bsd-features branch of the one-true-awk upstream: o Move to bison for $YACC o Set close-on-exec flag for file and pipe redirects that aren't std* o lots of little fixes to modernize ocde base o free sval member before setting it o fix a bug where a{0,3} could match aaaa o pull in systime and strftime from NetBSD awk o pull in fixes from {Net,Free,Open}BSD (normalized our code with them) o add BSD extensions and, or, xor, compl, lsheift, rshift (mostly a nop) Also revert a few of the trivial FreeBSD changes that were done slightly differently in the upstreaming process. Also, our PR database may have been mined by upstream for these fixes, and Mikolaj Golub may deserve credit for some of the fixes in this update. Suggested by: Mikolaj Golub PR: 143363,143365,143368,143369,143373,143375,214782 Sponsored by: Netflix contrib/one-true-awk/ChangeLog | 108 +++ contrib/one-true-awk/FIXES | 261 +++++- contrib/one-true-awk/REGRESS | 4 + contrib/one-true-awk/awk.1 | 159 +++- contrib/one-true-awk/awk.h | 67 +- contrib/one-true-awk/awkgram.y | 48 +- contrib/one-true-awk/b.c | 438 +++++++--- .../one-true-awk/bugs-fixed/missing-precision.ok | 2 +- contrib/one-true-awk/bugs-fixed/negative-nf.ok | 2 +- contrib/one-true-awk/lex.c | 77 +- contrib/one-true-awk/lib.c | 327 +++++--- contrib/one-true-awk/main.c | 163 ++-- contrib/one-true-awk/makefile | 74 +- contrib/one-true-awk/maketab.c | 66 +- contrib/one-true-awk/parse.c | 29 +- contrib/one-true-awk/proctab.c | 202 ++--- contrib/one-true-awk/proto.h | 41 +- contrib/one-true-awk/run.c | 918 ++++++++++++++------- contrib/one-true-awk/tran.c | 164 ++-- usr.bin/awk/Makefile | 10 +- 20 files changed, 2192 insertions(+), 968 deletions(-) diff --cc contrib/one-true-awk/awk.h index 31d070aecddc,51c00df9f279..230eac41548c --- a/contrib/one-true-awk/awk.h +++ b/contrib/one-true-awk/awk.h @@@ -217,9 -235,8 +235,10 @@@ extern int pairstack[], paircnt #define NCHARS (256+3) /* 256 handles 8-bit chars; 128 does 7-bit */ /* watch out in match(), etc. */ + #define HAT (NCHARS+2) /* matches ^ in regular expr */ #define NSTATES 32 +#define HAT (NCHARS+2) /* matches ^ in regular expr */ + /* NCHARS is 2**n */ typedef struct rrow { long ltype; /* long avoids pointer warnings on 64-bit */ diff --cc contrib/one-true-awk/b.c index 0cdcf30a972e,000000000000..20f4a8bee7f9 mode 100644,000000..100644 --- a/contrib/one-true-awk/b.c +++ b/contrib/one-true-awk/b.c @@@ -1,1225 -1,0 +1,1391 @@@ +/**************************************************************** +Copyright (C) Lucent Technologies 1997 +All Rights Reserved + +Permission to use, copy, modify, and distribute this software and +its documentation for any purpose and without fee is hereby +granted, provided that the above copyright notice appear in all +copies and that both that the copyright notice and this +permission notice and warranty disclaimer appear in supporting +documentation, and that the name Lucent Technologies or any of +its entities not be used in advertising or publicity pertaining +to distribution of the software without specific, written prior +permission. + +LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. +IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY +SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER +IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. +****************************************************************/ + +/* lasciate ogne speranza, voi ch'intrate. */ + +#include +__FBSDID("$FreeBSD$"); + +#define DEBUG + +#include +#include +#include +#include +#include +#include "awk.h" - #include "ytab.h" ++#include "awkgram.tab.h" + +#define MAXLIN 22 + +#define type(v) (v)->nobj /* badly overloaded here */ +#define info(v) (v)->ntype /* badly overloaded here */ +#define left(v) (v)->narg[0] +#define right(v) (v)->narg[1] +#define parent(v) (v)->nnext + +#define LEAF case CCL: case NCCL: case CHAR: case DOT: case FINAL: case ALL: +#define ELEAF case EMPTYRE: /* empty string in regexp */ +#define UNARY case STAR: case PLUS: case QUEST: + +/* encoding in tree Nodes: + leaf (CCL, NCCL, CHAR, DOT, FINAL, ALL, EMPTYRE): + left is index, right contains value or pointer to value + unary (STAR, PLUS, QUEST): left is child, right is null + binary (CAT, OR): left and right are children + parent contains pointer to parent +*/ + + +int *setvec; +int *tmpset; +int maxsetvec = 0; + +int rtok; /* next token in current re */ +int rlxval; - static uschar *rlxstr; - static uschar *prestr; /* current position in current re */ - static uschar *lastre; /* origin of last re */ - static uschar *lastatom; /* origin of last Atom */ - static uschar *starttok; - static uschar *basestr; /* starts with original, replaced during ++static const uschar *rlxstr; ++static const uschar *prestr; /* current position in current re */ ++static const uschar *lastre; /* origin of last re */ ++static const uschar *lastatom; /* origin of last Atom */ ++static const uschar *starttok; ++static const uschar *basestr; /* starts with original, replaced during + repetition processing */ - static uschar *firstbasestr; ++static const uschar *firstbasestr; + +static int setcnt; +static int poscnt; + - char *patbeg; ++const char *patbeg; +int patlen; + - #define NFA 20 /* cache this many dynamic fa's */ ++#define NFA 128 /* cache this many dynamic fa's */ +fa *fatab[NFA]; +int nfatab = 0; /* entries in fatab */ + - fa *makedfa(const char *s, int anchor) /* returns dfa for reg expr s */ ++static int * ++intalloc(size_t n, const char *f) ++{ ++ int *p = (int *) calloc(n, sizeof(int)); ++ if (p == NULL) ++ overflo(f); ++ return p; ++} ++ ++static void ++resizesetvec(const char *f) ++{ ++ if (maxsetvec == 0) ++ maxsetvec = MAXLIN; ++ else ++ maxsetvec *= 4; ++ setvec = (int *) realloc(setvec, maxsetvec * sizeof(*setvec)); ++ tmpset = (int *) realloc(tmpset, maxsetvec * sizeof(*tmpset)); ++ if (setvec == NULL || tmpset == NULL) ++ overflo(f); ++} ++ ++static void ++resize_state(fa *f, int state) ++{ ++ unsigned int **p; ++ uschar *p2; ++ int **p3; ++ int i, new_count; ++ ++ if (++state < f->state_count) ++ return; ++ ++ new_count = state + 10; /* needs to be tuned */ ++ ++ p = (unsigned int **) realloc(f->gototab, new_count * sizeof(f->gototab[0])); ++ if (p == NULL) ++ goto out; ++ f->gototab = p; ++ ++ p2 = (uschar *) realloc(f->out, new_count * sizeof(f->out[0])); ++ if (p2 == NULL) ++ goto out; ++ f->out = p2; ++ ++ p3 = (int **) realloc(f->posns, new_count * sizeof(f->posns[0])); ++ if (p3 == NULL) ++ goto out; ++ f->posns = p3; ++ ++ for (i = f->state_count; i < new_count; ++i) { ++ f->gototab[i] = (unsigned int *) calloc(NCHARS, sizeof(**f->gototab)); ++ if (f->gototab[i] == NULL) ++ goto out; ++ f->out[i] = 0; ++ f->posns[i] = NULL; ++ } ++ f->state_count = new_count; ++ return; ++out: ++ overflo(__func__); ++} ++ ++fa *makedfa(const char *s, bool anchor) /* returns dfa for reg expr s */ +{ + int i, use, nuse; + fa *pfa; + static int now = 1; + + if (setvec == NULL) { /* first time through any RE */ - maxsetvec = MAXLIN; - setvec = (int *) malloc(maxsetvec * sizeof(int)); - tmpset = (int *) malloc(maxsetvec * sizeof(int)); - if (setvec == NULL || tmpset == NULL) - overflo("out of space initializing makedfa"); ++ resizesetvec(__func__); + } + - if (compile_time) /* a constant for sure */ ++ if (compile_time != RUNNING) /* a constant for sure */ + return mkdfa(s, anchor); + for (i = 0; i < nfatab; i++) /* is it there already? */ + if (fatab[i]->anchor == anchor + && strcmp((const char *) fatab[i]->restr, s) == 0) { + fatab[i]->use = now++; + return fatab[i]; + } + pfa = mkdfa(s, anchor); + if (nfatab < NFA) { /* room for another */ + fatab[nfatab] = pfa; + fatab[nfatab]->use = now++; + nfatab++; + return pfa; + } + use = fatab[0]->use; /* replace least-recently used */ + nuse = 0; + for (i = 1; i < nfatab; i++) + if (fatab[i]->use < use) { + use = fatab[i]->use; + nuse = i; + } + freefa(fatab[nuse]); + fatab[nuse] = pfa; + pfa->use = now++; + return pfa; +} + - fa *mkdfa(const char *s, int anchor) /* does the real work of making a dfa */ - /* anchor = 1 for anchored matches, else 0 */ ++fa *mkdfa(const char *s, bool anchor) /* does the real work of making a dfa */ ++ /* anchor = true for anchored matches, else false */ +{ + Node *p, *p1; + fa *f; + - firstbasestr = (uschar *) s; ++ firstbasestr = (const uschar *) s; + basestr = firstbasestr; + p = reparse(s); + p1 = op2(CAT, op2(STAR, op2(ALL, NIL, NIL), NIL), p); + /* put ALL STAR in front of reg. exp. */ + p1 = op2(CAT, p1, op2(FINAL, NIL, NIL)); + /* put FINAL after reg. exp. */ + + poscnt = 0; + penter(p1); /* enter parent pointers and leaf indices */ - if ((f = (fa *) calloc(1, sizeof(fa) + poscnt*sizeof(rrow))) == NULL) - overflo("out of space for fa"); ++ if ((f = (fa *) calloc(1, sizeof(fa) + poscnt * sizeof(rrow))) == NULL) ++ overflo(__func__); + f->accept = poscnt-1; /* penter has computed number of positions in re */ + cfoll(f, p1); /* set up follow sets */ + freetr(p1); - if ((f->posns[0] = (int *) calloc(*(f->re[0].lfollow), sizeof(int))) == NULL) - overflo("out of space in makedfa"); - if ((f->posns[1] = (int *) calloc(1, sizeof(int))) == NULL) - overflo("out of space in makedfa"); ++ resize_state(f, 1); ++ f->posns[0] = intalloc(*(f->re[0].lfollow), __func__); ++ f->posns[1] = intalloc(1, __func__); + *f->posns[1] = 0; + f->initstat = makeinit(f, anchor); + f->anchor = anchor; + f->restr = (uschar *) tostring(s); + if (firstbasestr != basestr) { + if (basestr) + xfree(basestr); + } + return f; +} + - int makeinit(fa *f, int anchor) ++int makeinit(fa *f, bool anchor) +{ + int i, k; + + f->curstat = 2; + f->out[2] = 0; - f->reset = 0; + k = *(f->re[0].lfollow); - xfree(f->posns[2]); - if ((f->posns[2] = (int *) calloc(k+1, sizeof(int))) == NULL) - overflo("out of space in makeinit"); - for (i=0; i <= k; i++) { ++ xfree(f->posns[2]); ++ f->posns[2] = intalloc(k + 1, __func__); ++ for (i = 0; i <= k; i++) { + (f->posns[2])[i] = (f->re[0].lfollow)[i]; + } + if ((f->posns[2])[1] == f->accept) + f->out[2] = 1; - for (i=0; i < NCHARS; i++) ++ for (i = 0; i < NCHARS; i++) + f->gototab[2][i] = 0; + f->curstat = cgoto(f, 2, HAT); + if (anchor) { + *f->posns[2] = k-1; /* leave out position 0 */ - for (i=0; i < k; i++) { ++ for (i = 0; i < k; i++) { + (f->posns[0])[i] = (f->posns[2])[i]; + } + + f->out[0] = f->out[2]; + if (f->curstat != 2) + --(*f->posns[f->curstat]); + } + return f->curstat; +} + +void penter(Node *p) /* set up parent pointers and leaf indices */ +{ + switch (type(p)) { + ELEAF + LEAF + info(p) = poscnt; + poscnt++; + break; + UNARY + penter(left(p)); + parent(left(p)) = p; + break; + case CAT: + case OR: + penter(left(p)); + penter(right(p)); + parent(left(p)) = p; + parent(right(p)) = p; + break; ++ case ZERO: ++ break; + default: /* can't happen */ + FATAL("can't happen: unknown type %d in penter", type(p)); + break; + } +} + +void freetr(Node *p) /* free parse tree */ +{ + switch (type(p)) { + ELEAF + LEAF + xfree(p); + break; + UNARY ++ case ZERO: + freetr(left(p)); + xfree(p); + break; + case CAT: + case OR: + freetr(left(p)); + freetr(right(p)); + xfree(p); + break; + default: /* can't happen */ + FATAL("can't happen: unknown type %d in freetr", type(p)); + break; + } +} + +/* in the parsing of regular expressions, metacharacters like . have */ +/* to be seen literally; \056 is not a metacharacter. */ + - int hexstr(uschar **pp) /* find and eval hex string at pp, return new p */ ++int hexstr(const uschar **pp) /* find and eval hex string at pp, return new p */ +{ /* only pick up one 8-bit byte (2 chars) */ - uschar *p; ++ const uschar *p; + int n = 0; + int i; + - for (i = 0, p = (uschar *) *pp; i < 2 && isxdigit(*p); i++, p++) { ++ for (i = 0, p = *pp; i < 2 && isxdigit(*p); i++, p++) { + if (isdigit(*p)) + n = 16 * n + *p - '0'; + else if (*p >= 'a' && *p <= 'f') + n = 16 * n + *p - 'a' + 10; + else if (*p >= 'A' && *p <= 'F') + n = 16 * n + *p - 'A' + 10; + } - *pp = (uschar *) p; ++ *pp = p; + return n; +} + +#define isoctdigit(c) ((c) >= '0' && (c) <= '7') /* multiple use of arg */ + - int quoted(uschar **pp) /* pick up next thing after a \\ */ ++int quoted(const uschar **pp) /* pick up next thing after a \\ */ + /* and increment *pp */ +{ - uschar *p = *pp; ++ const uschar *p = *pp; + int c; + + if ((c = *p++) == 't') + c = '\t'; + else if (c == 'n') + c = '\n'; + else if (c == 'f') + c = '\f'; + else if (c == 'r') + c = '\r'; + else if (c == 'b') + c = '\b'; ++ else if (c == 'v') ++ c = '\v'; ++ else if (c == 'a') ++ c = '\a'; + else if (c == '\\') + c = '\\'; + else if (c == 'x') { /* hexadecimal goo follows */ + c = hexstr(&p); /* this adds a null if number is invalid */ + } else if (isoctdigit(c)) { /* \d \dd \ddd */ + int n = c - '0'; + if (isoctdigit(*p)) { + n = 8 * n + *p++ - '0'; + if (isoctdigit(*p)) + n = 8 * n + *p++ - '0'; + } + c = n; + } /* else */ + /* c = c; */ + *pp = p; + return c; +} + +static int collate_range_cmp(int a, int b) +{ + static char s[2][2]; + + if ((uschar)a == (uschar)b) + return 0; + s[0][0] = a; + s[1][0] = b; + return (strcoll(s[0], s[1])); +} + +char *cclenter(const char *argp) /* add a character class */ +{ - int i, c, c2; - int j; - uschar *p = (uschar *) argp; - uschar *op, *bp; ++ int i, c, c2, j; ++ const uschar *op, *p = (const uschar *) argp; ++ uschar *bp; + static uschar *buf = NULL; + static int bufsz = 100; + + op = p; + if (buf == NULL && (buf = (uschar *) malloc(bufsz)) == NULL) + FATAL("out of space for character class [%.10s...] 1", p); + bp = buf; + for (i = 0; (c = *p++) != 0; ) { + if (c == '\\') { + c = quoted(&p); + } else if (c == '-' && i > 0 && bp[-1] != 0) { + if (*p != 0) { + c = bp[-1]; + c2 = *p++; + if (c2 == '\\') + c2 = quoted(&p); + if (collate_range_cmp(c, c2) > 0) { + bp--; + i--; + continue; + } + for (j = 0; j < NCHARS; j++) { + if ((collate_range_cmp(c, j) > 0) || + collate_range_cmp(j, c2) > 0) + continue; + if (!adjbuf((char **) &buf, &bufsz, bp-buf+2, 100, (char **) &bp, "cclenter1")) + FATAL("out of space for character class [%.10s...] 2", p); + *bp++ = j; + i++; + } + continue; + } + } + if (!adjbuf((char **) &buf, &bufsz, bp-buf+2, 100, (char **) &bp, "cclenter2")) + FATAL("out of space for character class [%.10s...] 3", p); + *bp++ = c; + i++; + } + *bp = 0; - dprintf( ("cclenter: in = |%s|, out = |%s|\n", op, buf) ); ++ DPRINTF("cclenter: in = |%s|, out = |%s|\n", op, buf); + xfree(op); + return (char *) tostring((char *) buf); +} + +void overflo(const char *s) +{ - FATAL("regular expression too big: %.30s...", s); ++ FATAL("regular expression too big: out of space in %.30s...", s); +} + +void cfoll(fa *f, Node *v) /* enter follow set of each leaf of vertex v into lfollow[leaf] */ +{ + int i; + int *p; + + switch (type(v)) { + ELEAF + LEAF + f->re[info(v)].ltype = type(v); + f->re[info(v)].lval.np = right(v); + while (f->accept >= maxsetvec) { /* guessing here! */ - maxsetvec *= 4; - setvec = (int *) realloc(setvec, maxsetvec * sizeof(int)); - tmpset = (int *) realloc(tmpset, maxsetvec * sizeof(int)); - if (setvec == NULL || tmpset == NULL) - overflo("out of space in cfoll()"); ++ resizesetvec(__func__); + } + for (i = 0; i <= f->accept; i++) + setvec[i] = 0; + setcnt = 0; + follow(v); /* computes setvec and setcnt */ - if ((p = (int *) calloc(setcnt+1, sizeof(int))) == NULL) - overflo("out of space building follow set"); ++ p = intalloc(setcnt + 1, __func__); + f->re[info(v)].lfollow = p; + *p = setcnt; + for (i = f->accept; i >= 0; i--) + if (setvec[i] == 1) + *++p = i; + break; + UNARY + cfoll(f,left(v)); + break; + case CAT: + case OR: + cfoll(f,left(v)); + cfoll(f,right(v)); + break; ++ case ZERO: ++ break; + default: /* can't happen */ + FATAL("can't happen: unknown type %d in cfoll", type(v)); + } +} + +int first(Node *p) /* collects initially active leaves of p into setvec */ + /* returns 0 if p matches empty string */ +{ + int b, lp; + + switch (type(p)) { + ELEAF + LEAF + lp = info(p); /* look for high-water mark of subscripts */ + while (setcnt >= maxsetvec || lp >= maxsetvec) { /* guessing here! */ - maxsetvec *= 4; - setvec = (int *) realloc(setvec, maxsetvec * sizeof(int)); - tmpset = (int *) realloc(tmpset, maxsetvec * sizeof(int)); - if (setvec == NULL || tmpset == NULL) - overflo("out of space in first()"); ++ resizesetvec(__func__); + } + if (type(p) == EMPTYRE) { + setvec[lp] = 0; + return(0); + } + if (setvec[lp] != 1) { + setvec[lp] = 1; + setcnt++; + } + if (type(p) == CCL && (*(char *) right(p)) == '\0') + return(0); /* empty CCL */ - else return(1); ++ return(1); + case PLUS: - if (first(left(p)) == 0) return(0); ++ if (first(left(p)) == 0) ++ return(0); + return(1); + case STAR: + case QUEST: + first(left(p)); + return(0); + case CAT: + if (first(left(p)) == 0 && first(right(p)) == 0) return(0); + return(1); + case OR: + b = first(right(p)); + if (first(left(p)) == 0 || b == 0) return(0); + return(1); ++ case ZERO: ++ return 0; + } + FATAL("can't happen: unknown type %d in first", type(p)); /* can't happen */ + return(-1); +} + +void follow(Node *v) /* collects leaves that can follow v into setvec */ +{ + Node *p; + + if (type(v) == FINAL) + return; + p = parent(v); + switch (type(p)) { + case STAR: + case PLUS: + first(v); + follow(p); + return; + + case OR: + case QUEST: + follow(p); + return; + + case CAT: + if (v == left(p)) { /* v is left child of p */ + if (first(right(p)) == 0) { + follow(p); + return; + } + } else /* v is right child */ + follow(p); + return; + } +} + +int member(int c, const char *sarg) /* is c in s? */ +{ - uschar *s = (uschar *) sarg; ++ const uschar *s = (const uschar *) sarg; + + while (*s) + if (c == *s++) + return(1); + return(0); +} + +int match(fa *f, const char *p0) /* shortest match ? */ +{ + int s, ns; - uschar *p = (uschar *) p0; ++ const uschar *p = (const uschar *) p0; ++ ++ s = f->initstat; ++ assert (s < f->state_count); + - s = f->reset ? makeinit(f,0) : f->initstat; + if (f->out[s]) + return(1); + do { + /* assert(*p < NCHARS); */ + if ((ns = f->gototab[s][*p]) != 0) + s = ns; + else + s = cgoto(f, s, *p); + if (f->out[s]) + return(1); + } while (*p++ != 0); + return(0); +} + +int pmatch(fa *f, const char *p0) /* longest match, for sub */ +{ + int s, ns; - uschar *p = (uschar *) p0; - uschar *q; - int i, k; ++ const uschar *p = (const uschar *) p0; ++ const uschar *q; + - /* s = f->reset ? makeinit(f,1) : f->initstat; */ - if (f->reset) { - f->initstat = s = makeinit(f,1); - } else { - s = f->initstat; - } - patbeg = (char *) p; ++ s = f->initstat; ++ assert(s < f->state_count); ++ ++ patbeg = (const char *)p; + patlen = -1; + do { + q = p; + do { + if (f->out[s]) /* final state */ + patlen = q-p; + /* assert(*q < NCHARS); */ + if ((ns = f->gototab[s][*q]) != 0) + s = ns; + else + s = cgoto(f, s, *q); ++ ++ assert(s < f->state_count); ++ + if (s == 1) { /* no transition */ + if (patlen >= 0) { - patbeg = (char *) p; ++ patbeg = (const char *) p; + return(1); + } + else + goto nextin; /* no match */ + } + } while (*q++ != 0); + if (f->out[s]) + patlen = q-p-1; /* don't count $ */ + if (patlen >= 0) { - patbeg = (char *) p; ++ patbeg = (const char *) p; + return(1); + } + nextin: + s = 2; ++#if 0 /* XXX */ + if (f->reset) { + for (i = 2; i <= f->curstat; i++) - xfree(f->posns[i]); ++n xfree(f->posns[i]); + k = *f->posns[0]; + if ((f->posns[2] = (int *) calloc(k+1, sizeof(int))) == NULL) + overflo("out of space in pmatch"); + for (i = 0; i <= k; i++) + (f->posns[2])[i] = (f->posns[0])[i]; + f->initstat = f->curstat = 2; + f->out[2] = f->out[0]; + for (i = 0; i < NCHARS; i++) + f->gototab[2][i] = 0; + } ++#endif + } while (*p++ != 0); + return (0); +} + +int nematch(fa *f, const char *p0) /* non-empty match, for sub */ +{ + int s, ns; - uschar *p = (uschar *) p0; - uschar *q; - int i, k; ++ const uschar *p = (const uschar *) p0; ++ const uschar *q; + - /* s = f->reset ? makeinit(f,1) : f->initstat; */ - if (f->reset) { - f->initstat = s = makeinit(f,1); - } else { - s = f->initstat; - } ++ s = f->initstat; ++ assert(s < f->state_count); ++ ++ patbeg = (const char *)p; + patlen = -1; + while (*p) { + q = p; + do { + if (f->out[s]) /* final state */ + patlen = q-p; + /* assert(*q < NCHARS); */ + if ((ns = f->gototab[s][*q]) != 0) + s = ns; + else + s = cgoto(f, s, *q); + if (s == 1) { /* no transition */ + if (patlen > 0) { - patbeg = (char *) p; ++ patbeg = (const char *) p; + return(1); + } else + goto nnextin; /* no nonempty match */ + } + } while (*q++ != 0); + if (f->out[s]) + patlen = q-p-1; /* don't count $ */ + if (patlen > 0 ) { - patbeg = (char *) p; ++ patbeg = (const char *) p; + return(1); + } + nnextin: + s = 2; ++#if 0 /* XXX */ + if (f->reset) { + for (i = 2; i <= f->curstat; i++) + xfree(f->posns[i]); + k = *f->posns[0]; + if ((f->posns[2] = (int *) calloc(k+1, sizeof(int))) == NULL) + overflo("out of state space"); + for (i = 0; i <= k; i++) + (f->posns[2])[i] = (f->posns[0])[i]; + f->initstat = f->curstat = 2; + f->out[2] = f->out[0]; + for (i = 0; i < NCHARS; i++) + f->gototab[2][i] = 0; + } ++#endif + p++; + } + return (0); +} + ++ ++/* ++ * NAME ++ * fnematch ++ * ++ * DESCRIPTION ++ * A stream-fed version of nematch which transfers characters to a ++ * null-terminated buffer. All characters up to and including the last ++ * character of the matching text or EOF are placed in the buffer. If ++ * a match is found, patbeg and patlen are set appropriately. ++ * ++ * RETURN VALUES ++ * false No match found. ++ * true Match found. ++ */ ++ ++bool fnematch(fa *pfa, FILE *f, char **pbuf, int *pbufsize, int quantum) ++{ ++ char *buf = *pbuf; ++ int bufsize = *pbufsize; ++ int c, i, j, k, ns, s; ++ ++ s = pfa->initstat; ++ patlen = 0; ++ ++ /* ++ * All indices relative to buf. ++ * i <= j <= k <= bufsize ++ * ++ * i: origin of active substring ++ * j: current character ++ * k: destination of next getc() ++ */ ++ i = -1, k = 0; ++ do { ++ j = i++; ++ do { ++ if (++j == k) { ++ if (k == bufsize) ++ if (!adjbuf((char **) &buf, &bufsize, bufsize+1, quantum, 0, "fnematch")) ++ FATAL("stream '%.30s...' too long", buf); ++ buf[k++] = (c = getc(f)) != EOF ? c : 0; ++ } ++ c = (uschar)buf[j]; ++ /* assert(c < NCHARS); */ ++ ++ if ((ns = pfa->gototab[s][c]) != 0) ++ s = ns; ++ else ++ s = cgoto(pfa, s, c); ++ ++ if (pfa->out[s]) { /* final state */ ++ patlen = j - i + 1; ++ if (c == 0) /* don't count $ */ ++ patlen--; ++ } ++ } while (buf[j] && s != 1); ++ s = 2; ++ } while (buf[i] && !patlen); ++ ++ /* adjbuf() may have relocated a resized buffer. Inform the world. */ ++ *pbuf = buf; ++ *pbufsize = bufsize; ++ ++ if (patlen) { ++ patbeg = (char *) buf + i; ++ /* ++ * Under no circumstances is the last character fed to ++ * the automaton part of the match. It is EOF's nullbyte, ++ * or it sent the automaton into a state with no further ++ * transitions available (s==1), or both. Room for a ++ * terminating nullbyte is guaranteed. ++ * ++ * ungetc any chars after the end of matching text ++ * (except for EOF's nullbyte, if present) and null ++ * terminate the buffer. ++ */ ++ do ++ if (buf[--k] && ungetc(buf[k], f) == EOF) ++ FATAL("unable to ungetc '%c'", buf[k]); ++ while (k > i + patlen); ++ buf[k] = '\0'; ++ return true; ++ } ++ else ++ return false; ++} ++ +Node *reparse(const char *p) /* parses regular expression pointed to by p */ +{ /* uses relex() to scan regular expression */ + Node *np; + - dprintf( ("reparse <%s>\n", p) ); - lastre = prestr = (uschar *) p; /* prestr points to string to be parsed */ ++ DPRINTF("reparse <%s>\n", p); ++ lastre = prestr = (const uschar *) p; /* prestr points to string to be parsed */ + rtok = relex(); + /* GNU compatibility: an empty regexp matches anything */ + if (rtok == '\0') { + /* FATAL("empty regular expression"); previous */ + return(op2(EMPTYRE, NIL, NIL)); + } + np = regexp(); + if (rtok != '\0') + FATAL("syntax error in regular expression %s at %s", lastre, prestr); + return(np); +} + +Node *regexp(void) /* top-level parse of reg expr */ +{ + return (alt(concat(primary()))); +} + +Node *primary(void) +{ + Node *np; + int savelastatom; + + switch (rtok) { + case CHAR: + lastatom = starttok; + np = op2(CHAR, NIL, itonp(rlxval)); + rtok = relex(); + return (unary(np)); + case ALL: + rtok = relex(); + return (unary(op2(ALL, NIL, NIL))); + case EMPTYRE: + rtok = relex(); + return (unary(op2(EMPTYRE, NIL, NIL))); + case DOT: + lastatom = starttok; *** 3688 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Thu Jul 8 02:30:18 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C5CC7660D90; Thu, 8 Jul 2021 02:30:18 +0000 (UTC) (envelope-from lwhsu@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GL0d64rtTz4pK3; Thu, 8 Jul 2021 02:30:18 +0000 (UTC) (envelope-from lwhsu@freebsd.org) Received: from mail-yb1-f178.google.com (mail-yb1-f178.google.com [209.85.219.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: lwhsu/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 86F792A1F2; Thu, 8 Jul 2021 02:30:18 +0000 (UTC) (envelope-from lwhsu@freebsd.org) Received: by mail-yb1-f178.google.com with SMTP id r132so6512054yba.5; Wed, 07 Jul 2021 19:30:18 -0700 (PDT) X-Gm-Message-State: AOAM533+uO8B74j4+CbTnXzxmk3ZrYTzjJg+UkP064r3T5gjr9gBtAvV jKYpiv0MV8I6I1LenLMquOMDgGmiqEjqdj4iai8= X-Google-Smtp-Source: ABdhPJz+AjQNesJYGzkL3Bfa5pZ3DSqAQXmLAZmPRsweGd1hhA7bFZ02dE7w++se+gWO4cOW7XKIeOw8K+up8jUX+Hg= X-Received: by 2002:a25:34d1:: with SMTP id b200mr34319167yba.492.1625711417978; Wed, 07 Jul 2021 19:30:17 -0700 (PDT) MIME-Version: 1.0 References: <202107071122.167BMe50059361@gitrepo.freebsd.org> In-Reply-To: <202107071122.167BMe50059361@gitrepo.freebsd.org> From: Li-Wen Hsu Date: Thu, 8 Jul 2021 10:30:06 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: d7955cc0ffdf - main - tcp: HPTS performance enhancements To: Randall Stewart Cc: src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jul 2021 02:30:18 -0000 On Wed, Jul 7, 2021 at 7:22 PM Randall Stewart wrote: > > The branch main has been updated by rrs: > > URL: https://cgit.FreeBSD.org/src/commit/?id=d7955cc0ffdf9fb58013245a6f181c757574ea0a > > commit d7955cc0ffdf9fb58013245a6f181c757574ea0a > Author: Randall Stewart > AuthorDate: 2021-07-06 19:23:22 +0000 > Commit: Randall Stewart > CommitDate: 2021-07-07 11:22:35 +0000 > > tcp: HPTS performance enhancements > > HPTS drives both rack and bbr, and yet there have been many complaints > about performance. This bit of work restructures hpts to help reduce CPU > overhead. It does this by now instead of relying on the timer/callout to > drive it instead use user return from a system call as well as lro flushes > to drive hpts. The timer becomes a backstop that dynamically adjusts > based on how "late" we are. > > Reviewed by: tuexen, glebius > Sponsored by: Netflix Inc. > Differential Revision: https://reviews.freebsd.org/D31083 > --- > sys/kern/subr_trap.c | 10 + > sys/netinet/in_pcb.h | 4 +- > sys/netinet/tcp_hpts.c | 1309 +++++++++++++++++++++++++---------------- > sys/netinet/tcp_hpts.h | 99 +++- > sys/netinet/tcp_lro.c | 28 +- > sys/netinet/tcp_lro.h | 10 +- > sys/netinet/tcp_stacks/bbr.c | 6 +- > sys/netinet/tcp_stacks/rack.c | 22 +- > 8 files changed, 931 insertions(+), 557 deletions(-) Hi Randall. I think this breaks 32 bits platforms builds, for example: https://ci.freebsd.org/job/FreeBSD-main-i386-LINT/18214/console https://ci.freebsd.org/job/FreeBSD-main-armv7-LINT/1192/console Can you help check this? Thanks! Best, Li-Wen From owner-dev-commits-src-main@freebsd.org Thu Jul 8 06:44:56 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F0A8A663EDB; Thu, 8 Jul 2021 06:44:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GL6Gw6Jj1z3M0G; Thu, 8 Jul 2021 06:44:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C0E421C2BA; Thu, 8 Jul 2021 06:44:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1686iufZ002782; Thu, 8 Jul 2021 06:44:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1686iu9c002781; Thu, 8 Jul 2021 06:44:56 GMT (envelope-from git) Date: Thu, 8 Jul 2021 06:44:56 GMT Message-Id: <202107080644.1686iu9c002781@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michal Meloun Subject: git: a49f208d94b8 - main - intrng: Releasing interrupt source should clear interrupt table full state. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mmel X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a49f208d94b873b2187adbfe1d785b3bc8bdc598 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jul 2021 06:44:57 -0000 The branch main has been updated by mmel: URL: https://cgit.FreeBSD.org/src/commit/?id=a49f208d94b873b2187adbfe1d785b3bc8bdc598 commit a49f208d94b873b2187adbfe1d785b3bc8bdc598 Author: Michal Meloun AuthorDate: 2021-07-02 18:17:36 +0000 Commit: Michal Meloun CommitDate: 2021-07-08 06:16:46 +0000 intrng: Releasing interrupt source should clear interrupt table full state. The first release of an interrupt in a situation where the interrupt table is full should schedule a full table check the next time an interrupt is allocated. A full check is necessary to ensure maximum separation between the order of allocation and the order of release. Submitted by: ehem_freebsd@m5p.com (initial version) Discussed in: https://reviews.freebsd.org/D29310 MFC after: 4 weeks --- sys/kern/subr_intr.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sys/kern/subr_intr.c b/sys/kern/subr_intr.c index df6bf9e63ba0..d4926b2e2364 100644 --- a/sys/kern/subr_intr.c +++ b/sys/kern/subr_intr.c @@ -447,6 +447,16 @@ isrc_free_irq(struct intr_irqsrc *isrc) irq_sources[isrc->isrc_irq] = NULL; isrc->isrc_irq = INTR_IRQ_INVALID; /* just to be safe */ + + /* + * If we are recovering from the state irq_sources table is full, + * then the following allocation should check the entire table. This + * will ensure maximum separation of allocation order from release + * order. + */ + if (irq_next_free >= intr_nirq) + irq_next_free = 0; + return (0); } From owner-dev-commits-src-main@freebsd.org Thu Jul 8 06:58:27 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4800E664707; Thu, 8 Jul 2021 06:58:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GL6ZW1Nlmz3MtD; Thu, 8 Jul 2021 06:58:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 17FF01C6A9; Thu, 8 Jul 2021 06:58:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1686wRf3016204; Thu, 8 Jul 2021 06:58:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1686wQrP016203; Thu, 8 Jul 2021 06:58:26 GMT (envelope-from git) Date: Thu, 8 Jul 2021 06:58:26 GMT Message-Id: <202107080658.1686wQrP016203@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michal Meloun Subject: git: e88c3b1b02a6 - main - intrng: remove now redundant shadow variable. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mmel X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e88c3b1b02a663f18f51167f54a50e7b4f0eca02 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jul 2021 06:58:27 -0000 The branch main has been updated by mmel: URL: https://cgit.FreeBSD.org/src/commit/?id=e88c3b1b02a663f18f51167f54a50e7b4f0eca02 commit e88c3b1b02a663f18f51167f54a50e7b4f0eca02 Author: Michal Meloun AuthorDate: 2021-07-02 18:28:25 +0000 Commit: Michal Meloun CommitDate: 2021-07-08 06:46:41 +0000 intrng: remove now redundant shadow variable. Should not be a functional change. Submitted by: ehem_freebsd@m5p.com Discussed in: https://reviews.freebsd.org/D29310 MFC after: 4 weeks --- sys/kern/subr_intr.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/sys/kern/subr_intr.c b/sys/kern/subr_intr.c index d4926b2e2364..04636f09c5a1 100644 --- a/sys/kern/subr_intr.c +++ b/sys/kern/subr_intr.c @@ -401,15 +401,14 @@ intr_isrc_dispatch(struct intr_irqsrc *isrc, struct trapframe *tf) static inline int isrc_alloc_irq(struct intr_irqsrc *isrc) { - u_int maxirqs, irq; + u_int irq; mtx_assert(&isrc_table_lock, MA_OWNED); - maxirqs = intr_nirq; - if (irq_next_free >= maxirqs) + if (irq_next_free >= intr_nirq) return (ENOSPC); - for (irq = irq_next_free; irq < maxirqs; irq++) { + for (irq = irq_next_free; irq < intr_nirq; irq++) { if (irq_sources[irq] == NULL) goto found; } @@ -418,7 +417,7 @@ isrc_alloc_irq(struct intr_irqsrc *isrc) goto found; } - irq_next_free = maxirqs; + irq_next_free = intr_nirq; return (ENOSPC); found: @@ -426,7 +425,7 @@ found: irq_sources[irq] = isrc; irq_next_free = irq + 1; - if (irq_next_free >= maxirqs) + if (irq_next_free >= intr_nirq) irq_next_free = 0; return (0); } From owner-dev-commits-src-main@freebsd.org Thu Jul 8 08:48:00 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7DAE2665E52; Thu, 8 Jul 2021 08:48:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GL90w2t8pz3snx; Thu, 8 Jul 2021 08:48:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4AB3B1DEFF; Thu, 8 Jul 2021 08:48:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1688m0je062408; Thu, 8 Jul 2021 08:48:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1688m0G7062407; Thu, 8 Jul 2021 08:48:00 GMT (envelope-from git) Date: Thu, 8 Jul 2021 08:48:00 GMT Message-Id: <202107080848.1688m0G7062407@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 211cddf9e3a1 - main - pf: rename pf_state to pf_kstate MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 211cddf9e3a1bc0d4b1b94bea7d16a47b5a17f49 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jul 2021 08:48:00 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=211cddf9e3a1bc0d4b1b94bea7d16a47b5a17f49 commit 211cddf9e3a1bc0d4b1b94bea7d16a47b5a17f49 Author: Kristof Provost AuthorDate: 2021-07-06 09:42:20 +0000 Commit: Kristof Provost CommitDate: 2021-07-08 08:31:43 +0000 pf: rename pf_state to pf_kstate Indicate that this is a kernel-only structure, and make it easier to distinguish from others used to communicate with userspace. Reviewed by: mjg MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31096 --- sys/net/pfvar.h | 56 +++++++++++----------- sys/netpfil/pf/if_pfsync.c | 84 ++++++++++++++++----------------- sys/netpfil/pf/pf.c | 114 ++++++++++++++++++++++----------------------- sys/netpfil/pf/pf_ioctl.c | 42 ++++++++--------- sys/netpfil/pf/pf_norm.c | 4 +- sys/netpfil/pf/pf_nv.c | 2 +- sys/netpfil/pf/pf_nv.h | 2 +- 7 files changed, 152 insertions(+), 152 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 1840c23bc937..f491e18b03a4 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -501,10 +501,10 @@ struct pf_state_key { u_int8_t pad[2]; LIST_ENTRY(pf_state_key) entry; - TAILQ_HEAD(, pf_state) states[2]; + TAILQ_HEAD(, pf_kstate) states[2]; }; -/* Keep synced with struct pf_state. */ +/* Keep synced with struct pf_kstate. */ struct pf_state_cmp { u_int64_t id; u_int32_t creatorid; @@ -521,16 +521,16 @@ struct pf_state_cmp { #define PFSTATE_SETMASK (PFSTATE_SETPRIO) #ifdef _KERNEL -struct pf_state { +struct pf_kstate { u_int64_t id; u_int32_t creatorid; u_int8_t direction; u_int8_t pad[3]; u_int refs; - TAILQ_ENTRY(pf_state) sync_list; - TAILQ_ENTRY(pf_state) key_list[2]; - LIST_ENTRY(pf_state) entry; + TAILQ_ENTRY(pf_kstate) sync_list; + TAILQ_ENTRY(pf_kstate) key_list[2]; + LIST_ENTRY(pf_kstate) entry; struct pf_state_peer src; struct pf_state_peer dst; union pf_krule_ptr rule; @@ -562,7 +562,7 @@ struct pf_state { /* * Size <= fits 13 objects per page on LP64. Try to not grow the struct beyond that. */ -_Static_assert(sizeof(struct pf_state) <= 312, "pf_state size crosses 312 bytes"); +_Static_assert(sizeof(struct pf_kstate) <= 312, "pf_kstate size crosses 312 bytes"); #endif /* @@ -623,11 +623,11 @@ struct pfsync_state { #ifdef _KERNEL /* pfsync */ typedef int pfsync_state_import_t(struct pfsync_state *, u_int8_t); -typedef void pfsync_insert_state_t(struct pf_state *); -typedef void pfsync_update_state_t(struct pf_state *); -typedef void pfsync_delete_state_t(struct pf_state *); +typedef void pfsync_insert_state_t(struct pf_kstate *); +typedef void pfsync_update_state_t(struct pf_kstate *); +typedef void pfsync_delete_state_t(struct pf_kstate *); typedef void pfsync_clear_states_t(u_int32_t, const char *); -typedef int pfsync_defer_t(struct pf_state *, struct mbuf *); +typedef int pfsync_defer_t(struct pf_kstate *, struct mbuf *); typedef void pfsync_detach_ifnet_t(struct ifnet *); VNET_DECLARE(pfsync_state_import_t *, pfsync_state_import_ptr); @@ -645,7 +645,7 @@ VNET_DECLARE(pfsync_defer_t *, pfsync_defer_ptr); extern pfsync_detach_ifnet_t *pfsync_detach_ifnet_ptr; void pfsync_state_export(struct pfsync_state *, - struct pf_state *); + struct pf_kstate *); /* pflog */ struct pf_kruleset; @@ -1474,7 +1474,7 @@ struct pf_keyhash { }; struct pf_idhash { - LIST_HEAD(, pf_state) states; + LIST_HEAD(, pf_kstate) states; struct mtx lock; }; @@ -1548,26 +1548,26 @@ extern void pf_unload_vnet_purge(void); extern void pf_intr(void *); extern void pf_purge_expired_src_nodes(void); -extern int pf_unlink_state(struct pf_state *, u_int); +extern int pf_unlink_state(struct pf_kstate *, u_int); #define PF_ENTER_LOCKED 0x00000001 #define PF_RETURN_LOCKED 0x00000002 extern int pf_state_insert(struct pfi_kkif *, struct pfi_kkif *, struct pf_state_key *, struct pf_state_key *, - struct pf_state *); -extern struct pf_state *pf_alloc_state(int); -extern void pf_free_state(struct pf_state *); + struct pf_kstate *); +extern struct pf_kstate *pf_alloc_state(int); +extern void pf_free_state(struct pf_kstate *); static __inline void -pf_ref_state(struct pf_state *s) +pf_ref_state(struct pf_kstate *s) { refcount_acquire(&s->refs); } static __inline int -pf_release_state(struct pf_state *s) +pf_release_state(struct pf_kstate *s) { if (refcount_release(&s->refs)) { @@ -1578,7 +1578,7 @@ pf_release_state(struct pf_state *s) } static __inline int -pf_release_staten(struct pf_state *s, u_int n) +pf_release_staten(struct pf_kstate *s, u_int n) { if (refcount_releasen(&s->refs, n)) { @@ -1588,14 +1588,14 @@ pf_release_staten(struct pf_state *s, u_int n) return (0); } -extern struct pf_state *pf_find_state_byid(uint64_t, uint32_t); -extern struct pf_state *pf_find_state_all(struct pf_state_key_cmp *, +extern struct pf_kstate *pf_find_state_byid(uint64_t, uint32_t); +extern struct pf_kstate *pf_find_state_all(struct pf_state_key_cmp *, u_int, int *); extern struct pf_ksrc_node *pf_find_src_node(struct pf_addr *, struct pf_krule *, sa_family_t, int); extern void pf_unlink_src_node(struct pf_ksrc_node *); extern u_int pf_free_src_nodes(struct pf_ksrc_node_list *); -extern void pf_print_state(struct pf_state *); +extern void pf_print_state(struct pf_kstate *); extern void pf_print_flags(u_int8_t); extern u_int16_t pf_cksum_fixup(u_int16_t, u_int16_t, u_int16_t, u_int8_t); @@ -1626,7 +1626,7 @@ void pf_addr_inc(struct pf_addr *, sa_family_t); int pf_refragment6(struct ifnet *, struct mbuf **, struct m_tag *); #endif /* INET6 */ -u_int32_t pf_new_isn(struct pf_state *); +u_int32_t pf_new_isn(struct pf_kstate *); void *pf_pull_hdr(struct mbuf *, int, void *, int, u_short *, u_short *, sa_family_t); void pf_change_a(void *, u_int16_t *, u_int32_t, u_int8_t); @@ -1637,7 +1637,7 @@ void pf_patch_16_unaligned(struct mbuf *, u_int16_t *, void *, u_int16_t, bool, u_int8_t); void pf_patch_32_unaligned(struct mbuf *, u_int16_t *, void *, u_int32_t, bool, u_int8_t); -void pf_send_deferred_syn(struct pf_state *); +void pf_send_deferred_syn(struct pf_kstate *); int pf_match_addr(u_int8_t, struct pf_addr *, struct pf_addr *, struct pf_addr *, sa_family_t); int pf_match_addr_range(struct pf_addr *, struct pf_addr *, @@ -1648,14 +1648,14 @@ void pf_normalize_init(void); void pf_normalize_cleanup(void); int pf_normalize_tcp(int, struct pfi_kkif *, struct mbuf *, int, int, void *, struct pf_pdesc *); -void pf_normalize_tcp_cleanup(struct pf_state *); +void pf_normalize_tcp_cleanup(struct pf_kstate *); int pf_normalize_tcp_init(struct mbuf *, int, struct pf_pdesc *, struct tcphdr *, struct pf_state_peer *, struct pf_state_peer *); int pf_normalize_tcp_stateful(struct mbuf *, int, struct pf_pdesc *, - u_short *, struct tcphdr *, struct pf_state *, + u_short *, struct tcphdr *, struct pf_kstate *, struct pf_state_peer *, struct pf_state_peer *, int *); u_int32_t - pf_state_expires(const struct pf_state *); + pf_state_expires(const struct pf_kstate *); void pf_purge_expired_fragments(void); void pf_purge_fragments(uint32_t); int pf_routable(struct pf_addr *addr, sa_family_t af, struct pfi_kkif *, diff --git a/sys/netpfil/pf/if_pfsync.c b/sys/netpfil/pf/if_pfsync.c index 16878fe87750..7208444d65d7 100644 --- a/sys/netpfil/pf/if_pfsync.c +++ b/sys/netpfil/pf/if_pfsync.c @@ -115,7 +115,7 @@ struct pfsync_pkt { u_int8_t flags; }; -static int pfsync_upd_tcp(struct pf_state *, struct pfsync_state_peer *, +static int pfsync_upd_tcp(struct pf_kstate *, struct pfsync_state_peer *, struct pfsync_state_peer *); static int pfsync_in_clr(struct pfsync_pkt *, struct mbuf *, int, int); static int pfsync_in_ins(struct pfsync_pkt *, struct mbuf *, int, int); @@ -147,16 +147,16 @@ static int (*pfsync_acts[])(struct pfsync_pkt *, struct mbuf *, int, int) = { }; struct pfsync_q { - void (*write)(struct pf_state *, void *); + void (*write)(struct pf_kstate *, void *); size_t len; u_int8_t action; }; /* we have one of these for every PFSYNC_S_ */ -static void pfsync_out_state(struct pf_state *, void *); -static void pfsync_out_iack(struct pf_state *, void *); -static void pfsync_out_upd_c(struct pf_state *, void *); -static void pfsync_out_del(struct pf_state *, void *); +static void pfsync_out_state(struct pf_kstate *, void *); +static void pfsync_out_iack(struct pf_kstate *, void *); +static void pfsync_out_upd_c(struct pf_kstate *, void *); +static void pfsync_out_del(struct pf_kstate *, void *); static struct pfsync_q pfsync_qs[] = { { pfsync_out_state, sizeof(struct pfsync_state), PFSYNC_ACT_INS }, @@ -166,10 +166,10 @@ static struct pfsync_q pfsync_qs[] = { { pfsync_out_del, sizeof(struct pfsync_del_c), PFSYNC_ACT_DEL_C } }; -static void pfsync_q_ins(struct pf_state *, int, bool); -static void pfsync_q_del(struct pf_state *, bool, struct pfsync_bucket *); +static void pfsync_q_ins(struct pf_kstate *, int, bool); +static void pfsync_q_del(struct pf_kstate *, bool, struct pfsync_bucket *); -static void pfsync_update_state(struct pf_state *); +static void pfsync_update_state(struct pf_kstate *); struct pfsync_upd_req_item { TAILQ_ENTRY(pfsync_upd_req_item) ur_entry; @@ -182,7 +182,7 @@ struct pfsync_deferral { u_int pd_refs; struct callout pd_tmo; - struct pf_state *pd_st; + struct pf_kstate *pd_st; struct mbuf *pd_m; }; @@ -198,7 +198,7 @@ struct pfsync_bucket #define PFSYNCF_BUCKET_PUSH 0x00000001 size_t b_len; - TAILQ_HEAD(, pf_state) b_qs[PFSYNC_S_COUNT]; + TAILQ_HEAD(, pf_kstate) b_qs[PFSYNC_S_COUNT]; TAILQ_HEAD(, pfsync_upd_req_item) b_upd_req_list; TAILQ_HEAD(, pfsync_deferral) b_deferrals; u_int b_deferred; @@ -291,13 +291,13 @@ static int pfsyncoutput(struct ifnet *, struct mbuf *, const struct sockaddr *, struct route *); static int pfsyncioctl(struct ifnet *, u_long, caddr_t); -static int pfsync_defer(struct pf_state *, struct mbuf *); +static int pfsync_defer(struct pf_kstate *, struct mbuf *); static void pfsync_undefer(struct pfsync_deferral *, int); -static void pfsync_undefer_state(struct pf_state *, int); +static void pfsync_undefer_state(struct pf_kstate *, int); static void pfsync_defer_tmo(void *); static void pfsync_request_update(u_int32_t, u_int64_t); -static bool pfsync_update_state_req(struct pf_state *); +static bool pfsync_update_state_req(struct pf_kstate *); static void pfsync_drop(struct pfsync_softc *); static void pfsync_sendout(int, int); @@ -313,7 +313,7 @@ static void pfsync_detach_ifnet(struct ifnet *); static void pfsync_update_net_tdb(struct pfsync_tdb *); #endif static struct pfsync_bucket *pfsync_get_bucket(struct pfsync_softc *, - struct pf_state *); + struct pf_kstate *); #define PFSYNC_MAX_BULKTRIES 12 @@ -461,7 +461,7 @@ pfsync_state_import(struct pfsync_state *sp, u_int8_t flags) struct pfsync_state_key key[2]; #endif struct pfsync_state_key *kw, *ks; - struct pf_state *st = NULL; + struct pf_kstate *st = NULL; struct pf_state_key *skw = NULL, *sks = NULL; struct pf_krule *r = NULL; struct pfi_kkif *kif; @@ -753,7 +753,7 @@ pfsync_in_clr(struct pfsync_pkt *pkt, struct mbuf *m, int offset, int count) for (int i = 0; i <= pf_hashmask; i++) { struct pf_idhash *ih = &V_pf_idhash[i]; - struct pf_state *s; + struct pf_kstate *s; relock: PF_HASHROW_LOCK(ih); LIST_FOREACH(s, &ih->states, entry) { @@ -812,7 +812,7 @@ static int pfsync_in_iack(struct pfsync_pkt *pkt, struct mbuf *m, int offset, int count) { struct pfsync_ins_ack *ia, *iaa; - struct pf_state *st; + struct pf_kstate *st; struct mbuf *mp; int len = count * sizeof(*ia); @@ -846,7 +846,7 @@ pfsync_in_iack(struct pfsync_pkt *pkt, struct mbuf *m, int offset, int count) } static int -pfsync_upd_tcp(struct pf_state *st, struct pfsync_state_peer *src, +pfsync_upd_tcp(struct pf_kstate *st, struct pfsync_state_peer *src, struct pfsync_state_peer *dst) { int sync = 0; @@ -884,7 +884,7 @@ pfsync_in_upd(struct pfsync_pkt *pkt, struct mbuf *m, int offset, int count) { struct pfsync_softc *sc = V_pfsyncif; struct pfsync_state *sa, *sp; - struct pf_state *st; + struct pf_kstate *st; int sync; struct mbuf *mp; @@ -970,7 +970,7 @@ pfsync_in_upd_c(struct pfsync_pkt *pkt, struct mbuf *m, int offset, int count) { struct pfsync_softc *sc = V_pfsyncif; struct pfsync_upd_c *ua, *up; - struct pf_state *st; + struct pf_kstate *st; int len = count * sizeof(*up); int sync; struct mbuf *mp; @@ -1060,7 +1060,7 @@ pfsync_in_ureq(struct pfsync_pkt *pkt, struct mbuf *m, int offset, int count) int len = count * sizeof(*ur); int i, offp; - struct pf_state *st; + struct pf_kstate *st; mp = m_pulldown(m, offset, len, &offp); if (mp == NULL) { @@ -1098,7 +1098,7 @@ pfsync_in_del(struct pfsync_pkt *pkt, struct mbuf *m, int offset, int count) { struct mbuf *mp; struct pfsync_state *sa, *sp; - struct pf_state *st; + struct pf_kstate *st; int len = count * sizeof(*sp); int offp, i; @@ -1129,7 +1129,7 @@ pfsync_in_del_c(struct pfsync_pkt *pkt, struct mbuf *m, int offset, int count) { struct mbuf *mp; struct pfsync_del_c *sa, *sp; - struct pf_state *st; + struct pf_kstate *st; int len = count * sizeof(*sp); int offp, i; @@ -1480,7 +1480,7 @@ pfsyncioctl(struct ifnet *ifp, u_long cmd, caddr_t data) } static void -pfsync_out_state(struct pf_state *st, void *buf) +pfsync_out_state(struct pf_kstate *st, void *buf) { struct pfsync_state *sp = buf; @@ -1488,7 +1488,7 @@ pfsync_out_state(struct pf_state *st, void *buf) } static void -pfsync_out_iack(struct pf_state *st, void *buf) +pfsync_out_iack(struct pf_kstate *st, void *buf) { struct pfsync_ins_ack *iack = buf; @@ -1497,7 +1497,7 @@ pfsync_out_iack(struct pf_state *st, void *buf) } static void -pfsync_out_upd_c(struct pf_state *st, void *buf) +pfsync_out_upd_c(struct pf_kstate *st, void *buf) { struct pfsync_upd_c *up = buf; @@ -1510,7 +1510,7 @@ pfsync_out_upd_c(struct pf_state *st, void *buf) } static void -pfsync_out_del(struct pf_state *st, void *buf) +pfsync_out_del(struct pf_kstate *st, void *buf) { struct pfsync_del_c *dp = buf; @@ -1522,7 +1522,7 @@ pfsync_out_del(struct pf_state *st, void *buf) static void pfsync_drop(struct pfsync_softc *sc) { - struct pf_state *st, *next; + struct pf_kstate *st, *next; struct pfsync_upd_req_item *ur; struct pfsync_bucket *b; int c, q; @@ -1562,7 +1562,7 @@ pfsync_sendout(int schedswi, int c) struct ip *ip; struct pfsync_header *ph; struct pfsync_subheader *subh; - struct pf_state *st, *st_next; + struct pf_kstate *st, *st_next; struct pfsync_upd_req_item *ur; struct pfsync_bucket *b = &sc->sc_buckets[c]; int offset; @@ -1702,7 +1702,7 @@ pfsync_sendout(int schedswi, int c) } static void -pfsync_insert_state(struct pf_state *st) +pfsync_insert_state(struct pf_kstate *st) { struct pfsync_softc *sc = V_pfsyncif; struct pfsync_bucket *b = pfsync_get_bucket(sc, st); @@ -1730,7 +1730,7 @@ pfsync_insert_state(struct pf_state *st) } static int -pfsync_defer(struct pf_state *st, struct mbuf *m) +pfsync_defer(struct pf_kstate *st, struct mbuf *m) { struct pfsync_softc *sc = V_pfsyncif; struct pfsync_deferral *pd; @@ -1778,7 +1778,7 @@ pfsync_undefer(struct pfsync_deferral *pd, int drop) { struct pfsync_softc *sc = pd->pd_sc; struct mbuf *m = pd->pd_m; - struct pf_state *st = pd->pd_st; + struct pf_kstate *st = pd->pd_st; struct pfsync_bucket *b = pfsync_get_bucket(sc, st); PFSYNC_BUCKET_LOCK_ASSERT(b); @@ -1804,7 +1804,7 @@ pfsync_defer_tmo(void *arg) struct pfsync_deferral *pd = arg; struct pfsync_softc *sc = pd->pd_sc; struct mbuf *m = pd->pd_m; - struct pf_state *st = pd->pd_st; + struct pf_kstate *st = pd->pd_st; struct pfsync_bucket *b = pfsync_get_bucket(sc, st); PFSYNC_BUCKET_LOCK_ASSERT(b); @@ -1828,7 +1828,7 @@ pfsync_defer_tmo(void *arg) } static void -pfsync_undefer_state(struct pf_state *st, int drop) +pfsync_undefer_state(struct pf_kstate *st, int drop) { struct pfsync_softc *sc = V_pfsyncif; struct pfsync_deferral *pd; @@ -1851,14 +1851,14 @@ pfsync_undefer_state(struct pf_state *st, int drop) } static struct pfsync_bucket* -pfsync_get_bucket(struct pfsync_softc *sc, struct pf_state *st) +pfsync_get_bucket(struct pfsync_softc *sc, struct pf_kstate *st) { int c = PF_IDHASH(st) % pfsync_buckets; return &sc->sc_buckets[c]; } static void -pfsync_update_state(struct pf_state *st) +pfsync_update_state(struct pf_kstate *st) { struct pfsync_softc *sc = V_pfsyncif; bool sync = false, ref = true; @@ -1956,7 +1956,7 @@ pfsync_request_update(u_int32_t creatorid, u_int64_t id) } static bool -pfsync_update_state_req(struct pf_state *st) +pfsync_update_state_req(struct pf_kstate *st) { struct pfsync_softc *sc = V_pfsyncif; bool ref = true, full = false; @@ -2003,7 +2003,7 @@ pfsync_update_state_req(struct pf_state *st) } static void -pfsync_delete_state(struct pf_state *st) +pfsync_delete_state(struct pf_kstate *st) { struct pfsync_softc *sc = V_pfsyncif; struct pfsync_bucket *b = pfsync_get_bucket(sc, st); @@ -2067,7 +2067,7 @@ pfsync_clear_states(u_int32_t creatorid, const char *ifname) } static void -pfsync_q_ins(struct pf_state *st, int q, bool ref) +pfsync_q_ins(struct pf_kstate *st, int q, bool ref) { struct pfsync_softc *sc = V_pfsyncif; size_t nlen = pfsync_qs[q].len; @@ -2097,7 +2097,7 @@ pfsync_q_ins(struct pf_state *st, int q, bool ref) } static void -pfsync_q_del(struct pf_state *st, bool unref, struct pfsync_bucket *b) +pfsync_q_del(struct pf_kstate *st, bool unref, struct pfsync_bucket *b) { int q = st->sync_state; @@ -2137,7 +2137,7 @@ static void pfsync_bulk_update(void *arg) { struct pfsync_softc *sc = arg; - struct pf_state *s; + struct pf_kstate *s; int i, sent = 0; PFSYNC_BLOCK_ASSERT(sc); diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index ed273e6e0b6a..8fae01ce1c23 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -115,12 +115,12 @@ __FBSDID("$FreeBSD$"); SDT_PROVIDER_DEFINE(pf); SDT_PROBE_DEFINE4(pf, ip, test, done, "int", "int", "struct pf_krule *", - "struct pf_state *"); + "struct pf_kstate *"); SDT_PROBE_DEFINE4(pf, ip, test6, done, "int", "int", "struct pf_krule *", - "struct pf_state *"); + "struct pf_kstate *"); SDT_PROBE_DEFINE5(pf, ip, state, lookup, "struct pfi_kkif *", "struct pf_state_key_cmp *", "int", "struct pf_pdesc *", - "struct pf_state *"); + "struct pf_kstate *"); /* * Global variables @@ -228,7 +228,7 @@ VNET_DEFINE(uint64_t, pf_stateid[MAXCPU]); #define PFID_MAXID (~PFID_CPUMASK) CTASSERT((1 << PFID_CPUBITS) >= MAXCPU); -static void pf_src_tree_remove_state(struct pf_state *); +static void pf_src_tree_remove_state(struct pf_kstate *); static void pf_init_threshold(struct pf_threshold *, u_int32_t, u_int32_t); static void pf_add_threshold(struct pf_threshold *); @@ -251,13 +251,13 @@ static void pf_send_tcp(struct mbuf *, u_int16_t, struct ifnet *); static void pf_send_icmp(struct mbuf *, u_int8_t, u_int8_t, sa_family_t, struct pf_krule *); -static void pf_detach_state(struct pf_state *); +static void pf_detach_state(struct pf_kstate *); static int pf_state_key_attach(struct pf_state_key *, - struct pf_state_key *, struct pf_state *); -static void pf_state_key_detach(struct pf_state *, int); + struct pf_state_key *, struct pf_kstate *); +static void pf_state_key_detach(struct pf_kstate *, int); static int pf_state_key_ctor(void *, int, void *, int); static u_int32_t pf_tcp_iss(struct pf_pdesc *); -static int pf_test_rule(struct pf_krule **, struct pf_state **, +static int pf_test_rule(struct pf_krule **, struct pf_kstate **, int, struct pfi_kkif *, struct mbuf *, int, struct pf_pdesc *, struct pf_krule **, struct pf_kruleset **, struct inpcb *); @@ -266,29 +266,29 @@ static int pf_create_state(struct pf_krule *, struct pf_krule *, struct pf_ksrc_node *, struct pf_state_key *, struct pf_state_key *, struct mbuf *, int, u_int16_t, u_int16_t, int *, struct pfi_kkif *, - struct pf_state **, int, u_int16_t, u_int16_t, + struct pf_kstate **, int, u_int16_t, u_int16_t, int); static int pf_test_fragment(struct pf_krule **, int, struct pfi_kkif *, struct mbuf *, void *, struct pf_pdesc *, struct pf_krule **, struct pf_kruleset **); static int pf_tcp_track_full(struct pf_state_peer *, - struct pf_state_peer *, struct pf_state **, + struct pf_state_peer *, struct pf_kstate **, struct pfi_kkif *, struct mbuf *, int, struct pf_pdesc *, u_short *, int *); static int pf_tcp_track_sloppy(struct pf_state_peer *, - struct pf_state_peer *, struct pf_state **, + struct pf_state_peer *, struct pf_kstate **, struct pf_pdesc *, u_short *); -static int pf_test_state_tcp(struct pf_state **, int, +static int pf_test_state_tcp(struct pf_kstate **, int, struct pfi_kkif *, struct mbuf *, int, void *, struct pf_pdesc *, u_short *); -static int pf_test_state_udp(struct pf_state **, int, +static int pf_test_state_udp(struct pf_kstate **, int, struct pfi_kkif *, struct mbuf *, int, void *, struct pf_pdesc *); -static int pf_test_state_icmp(struct pf_state **, int, +static int pf_test_state_icmp(struct pf_kstate **, int, struct pfi_kkif *, struct mbuf *, int, void *, struct pf_pdesc *, u_short *); -static int pf_test_state_other(struct pf_state **, int, +static int pf_test_state_other(struct pf_kstate **, int, struct pfi_kkif *, struct mbuf *, struct pf_pdesc *); static u_int8_t pf_get_wscale(struct mbuf *, int, u_int16_t, sa_family_t); @@ -298,15 +298,15 @@ static u_int16_t pf_calc_mss(struct pf_addr *, sa_family_t, int, u_int16_t); static int pf_check_proto_cksum(struct mbuf *, int, int, u_int8_t, sa_family_t); -static void pf_print_state_parts(struct pf_state *, +static void pf_print_state_parts(struct pf_kstate *, struct pf_state_key *, struct pf_state_key *); static int pf_addr_wrap_neq(struct pf_addr_wrap *, struct pf_addr_wrap *); static void pf_patch_8(struct mbuf *, u_int16_t *, u_int8_t *, u_int8_t, bool, u_int8_t); -static struct pf_state *pf_find_state(struct pfi_kkif *, +static struct pf_kstate *pf_find_state(struct pfi_kkif *, struct pf_state_key_cmp *, u_int); -static int pf_src_connlimit(struct pf_state **); +static int pf_src_connlimit(struct pf_kstate **); static void pf_overload_task(void *v, int pending); static int pf_insert_src_node(struct pf_ksrc_node **, struct pf_krule *, struct pf_addr *, sa_family_t); @@ -316,14 +316,14 @@ static int pf_mtag_uminit(void *, int, int); static void pf_mtag_free(struct m_tag *); #ifdef INET static void pf_route(struct mbuf **, struct pf_krule *, int, - struct ifnet *, struct pf_state *, + struct ifnet *, struct pf_kstate *, struct pf_pdesc *, struct inpcb *); #endif /* INET */ #ifdef INET6 static void pf_change_a6(struct pf_addr *, u_int16_t *, struct pf_addr *, u_int8_t); static void pf_route6(struct mbuf **, struct pf_krule *, int, - struct ifnet *, struct pf_state *, + struct ifnet *, struct pf_kstate *, struct pf_pdesc *, struct inpcb *); #endif /* INET6 */ @@ -480,7 +480,7 @@ pf_hashsrc(struct pf_addr *addr, sa_family_t af) #ifdef ALTQ static int -pf_state_hash(struct pf_state *s) +pf_state_hash(struct pf_kstate *s) { u_int32_t hv = (intptr_t)s / sizeof(*s); @@ -543,7 +543,7 @@ pf_check_threshold(struct pf_threshold *threshold) } static int -pf_src_connlimit(struct pf_state **state) +pf_src_connlimit(struct pf_kstate **state) { struct pf_overload_entry *pfoe; int bad = 0; @@ -659,7 +659,7 @@ pf_overload_task(void *v, int pending) for (int i = 0; i <= pf_hashmask; i++) { struct pf_idhash *ih = &V_pf_idhash[i]; struct pf_state_key *sk; - struct pf_state *s; + struct pf_kstate *s; PF_HASHROW_LOCK(ih); LIST_FOREACH(s, &ih->states, entry) { @@ -844,7 +844,7 @@ pf_initialize() V_pf_hashseed = arc4random(); /* States and state keys storage. */ - V_pf_state_z = uma_zcreate("pf states", sizeof(struct pf_state), + V_pf_state_z = uma_zcreate("pf states", sizeof(struct pf_kstate), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); V_pf_limits[PF_LIMIT_STATES].zone = V_pf_state_z; uma_zone_set_max(V_pf_state_z, PFSTATE_HIWAT); @@ -1007,11 +1007,11 @@ pf_get_mtag(struct mbuf *m) static int pf_state_key_attach(struct pf_state_key *skw, struct pf_state_key *sks, - struct pf_state *s) + struct pf_kstate *s) { struct pf_keyhash *khs, *khw, *kh; struct pf_state_key *sk, *cur; - struct pf_state *si, *olds = NULL; + struct pf_kstate *si, *olds = NULL; int idx; KASSERT(s->refs == 0, ("%s: state not pristine", __func__)); @@ -1172,7 +1172,7 @@ stateattach: } static void -pf_detach_state(struct pf_state *s) +pf_detach_state(struct pf_kstate *s) { struct pf_state_key *sks = s->key[PF_SK_STACK]; struct pf_keyhash *kh; @@ -1203,7 +1203,7 @@ pf_detach_state(struct pf_state *s) } static void -pf_state_key_detach(struct pf_state *s, int idx) +pf_state_key_detach(struct pf_kstate *s, int idx) { struct pf_state_key *sk = s->key[idx]; #ifdef INVARIANTS @@ -1268,10 +1268,10 @@ pf_state_key_clone(struct pf_state_key *orig) int pf_state_insert(struct pfi_kkif *kif, struct pfi_kkif *orig_kif, - struct pf_state_key *skw, struct pf_state_key *sks, struct pf_state *s) + struct pf_state_key *skw, struct pf_state_key *sks, struct pf_kstate *s) { struct pf_idhash *ih; - struct pf_state *cur; + struct pf_kstate *cur; int error; KASSERT(TAILQ_EMPTY(&sks->states[0]) && TAILQ_EMPTY(&sks->states[1]), @@ -1328,11 +1328,11 @@ pf_state_insert(struct pfi_kkif *kif, struct pfi_kkif *orig_kif, /* * Find state by ID: returns with locked row on success. */ -struct pf_state * +struct pf_kstate * pf_find_state_byid(uint64_t id, uint32_t creatorid) { struct pf_idhash *ih; - struct pf_state *s; + struct pf_kstate *s; counter_u64_add(V_pf_status.fcounters[FCNT_STATE_SEARCH], 1); @@ -1353,12 +1353,12 @@ pf_find_state_byid(uint64_t id, uint32_t creatorid) * Find state by key. * Returns with ID hash slot locked on success. */ -static struct pf_state * +static struct pf_kstate * pf_find_state(struct pfi_kkif *kif, struct pf_state_key_cmp *key, u_int dir) { struct pf_keyhash *kh; struct pf_state_key *sk; - struct pf_state *s; + struct pf_kstate *s; int idx; counter_u64_add(V_pf_status.fcounters[FCNT_STATE_SEARCH], 1); @@ -1397,12 +1397,12 @@ pf_find_state(struct pfi_kkif *kif, struct pf_state_key_cmp *key, u_int dir) return (NULL); } -struct pf_state * +struct pf_kstate * pf_find_state_all(struct pf_state_key_cmp *key, u_int dir, int *more) { struct pf_keyhash *kh; struct pf_state_key *sk; - struct pf_state *s, *ret = NULL; + struct pf_kstate *s, *ret = NULL; int idx, inout = 0; counter_u64_add(V_pf_status.fcounters[FCNT_STATE_SEARCH], 1); @@ -1592,7 +1592,7 @@ pf_unload_vnet_purge(void) } u_int32_t -pf_state_expires(const struct pf_state *state) +pf_state_expires(const struct pf_kstate *state) { u_int32_t timeout; u_int32_t start; @@ -1656,7 +1656,7 @@ pf_purge_expired_src_nodes() } static void -pf_src_tree_remove_state(struct pf_state *s) +pf_src_tree_remove_state(struct pf_kstate *s) { struct pf_ksrc_node *sn; struct pf_srchash *sh; @@ -1693,7 +1693,7 @@ pf_src_tree_remove_state(struct pf_state *s) * unlocked, since it needs to go through key hash locking. */ int -pf_unlink_state(struct pf_state *s, u_int flags) +pf_unlink_state(struct pf_kstate *s, u_int flags) { struct pf_idhash *ih = &V_pf_idhash[PF_IDHASH(s)]; @@ -1740,7 +1740,7 @@ pf_unlink_state(struct pf_state *s, u_int flags) return (pf_release_staten(s, 2)); } -struct pf_state * +struct pf_kstate * pf_alloc_state(int flags) { @@ -1748,7 +1748,7 @@ pf_alloc_state(int flags) } void -pf_free_state(struct pf_state *cur) +pf_free_state(struct pf_kstate *cur) { KASSERT(cur->refs == 0, ("%s: %p has refs", __func__, cur)); @@ -1767,7 +1767,7 @@ static u_int pf_purge_expired_states(u_int i, int maxcheck) { struct pf_idhash *ih; - struct pf_state *s; + struct pf_kstate *s; V_pf_status.states = uma_zone_get_cur(V_pf_state_z); @@ -1925,13 +1925,13 @@ pf_print_host(struct pf_addr *addr, u_int16_t p, sa_family_t af) } void -pf_print_state(struct pf_state *s) +pf_print_state(struct pf_kstate *s) { pf_print_state_parts(s, NULL, NULL); } static void -pf_print_state_parts(struct pf_state *s, +pf_print_state_parts(struct pf_kstate *s, struct pf_state_key *skwp, struct pf_state_key *sksp) { struct pf_state_key *skw, *sks; @@ -3330,7 +3330,7 @@ pf_tcp_iss(struct pf_pdesc *pd) } static int -pf_test_rule(struct pf_krule **rm, struct pf_state **sm, int direction, +pf_test_rule(struct pf_krule **rm, struct pf_kstate **sm, int direction, struct pfi_kkif *kif, struct mbuf *m, int off, struct pf_pdesc *pd, struct pf_krule **am, struct pf_kruleset **rsm, struct inpcb *inp) { @@ -3707,10 +3707,10 @@ static int pf_create_state(struct pf_krule *r, struct pf_krule *nr, struct pf_krule *a, struct pf_pdesc *pd, struct pf_ksrc_node *nsn, struct pf_state_key *nk, struct pf_state_key *sk, struct mbuf *m, int off, u_int16_t sport, - u_int16_t dport, int *rewrite, struct pfi_kkif *kif, struct pf_state **sm, + u_int16_t dport, int *rewrite, struct pfi_kkif *kif, struct pf_kstate **sm, int tag, u_int16_t bproto_sum, u_int16_t bip_sum, int hdrlen) { - struct pf_state *s = NULL; + struct pf_kstate *s = NULL; struct pf_ksrc_node *sn = NULL; struct tcphdr *th = &pd->hdr.tcp; u_int16_t mss = V_tcp_mssdflt; @@ -4049,7 +4049,7 @@ pf_test_fragment(struct pf_krule **rm, int direction, struct pfi_kkif *kif, static int pf_tcp_track_full(struct pf_state_peer *src, struct pf_state_peer *dst, - struct pf_state **state, struct pfi_kkif *kif, struct mbuf *m, int off, + struct pf_kstate **state, struct pfi_kkif *kif, struct mbuf *m, int off, struct pf_pdesc *pd, u_short *reason, int *copyback) { struct tcphdr *th = &pd->hdr.tcp; @@ -4375,7 +4375,7 @@ pf_tcp_track_full(struct pf_state_peer *src, struct pf_state_peer *dst, static int pf_tcp_track_sloppy(struct pf_state_peer *src, struct pf_state_peer *dst, - struct pf_state **state, struct pf_pdesc *pd, u_short *reason) + struct pf_kstate **state, struct pf_pdesc *pd, u_short *reason) { struct tcphdr *th = &pd->hdr.tcp; @@ -4445,7 +4445,7 @@ pf_tcp_track_sloppy(struct pf_state_peer *src, struct pf_state_peer *dst, } static int -pf_test_state_tcp(struct pf_state **state, int direction, struct pfi_kkif *kif, +pf_test_state_tcp(struct pf_kstate **state, int direction, struct pfi_kkif *kif, struct mbuf *m, int off, void *h, struct pf_pdesc *pd, u_short *reason) { @@ -4613,7 +4613,7 @@ pf_test_state_tcp(struct pf_state **state, int direction, struct pfi_kkif *kif, } static int -pf_test_state_udp(struct pf_state **state, int direction, struct pfi_kkif *kif, +pf_test_state_udp(struct pf_kstate **state, int direction, struct pfi_kkif *kif, struct mbuf *m, int off, void *h, struct pf_pdesc *pd) { struct pf_state_peer *src, *dst; @@ -4680,7 +4680,7 @@ pf_test_state_udp(struct pf_state **state, int direction, struct pfi_kkif *kif, } static int -pf_test_state_icmp(struct pf_state **state, int direction, struct pfi_kkif *kif, +pf_test_state_icmp(struct pf_kstate **state, int direction, struct pfi_kkif *kif, struct mbuf *m, int off, void *h, struct pf_pdesc *pd, u_short *reason) { struct pf_addr *saddr = pd->src, *daddr = pd->dst; @@ -5284,7 +5284,7 @@ pf_test_state_icmp(struct pf_state **state, int direction, struct pfi_kkif *kif, } static int -pf_test_state_other(struct pf_state **state, int direction, struct pfi_kkif *kif, +pf_test_state_other(struct pf_kstate **state, int direction, struct pfi_kkif *kif, struct mbuf *m, struct pf_pdesc *pd) { struct pf_state_peer *src, *dst; @@ -5456,7 +5456,7 @@ pf_routable(struct pf_addr *addr, sa_family_t af, struct pfi_kkif *kif, #ifdef INET static void pf_route(struct mbuf **m, struct pf_krule *r, int dir, struct ifnet *oifp, - struct pf_state *s, struct pf_pdesc *pd, struct inpcb *inp) + struct pf_kstate *s, struct pf_pdesc *pd, struct inpcb *inp) { struct mbuf *m0, *m1; struct sockaddr_in dst; @@ -5644,7 +5644,7 @@ bad: #ifdef INET6 static void pf_route6(struct mbuf **m, struct pf_krule *r, int dir, struct ifnet *oifp, - struct pf_state *s, struct pf_pdesc *pd, struct inpcb *inp) + struct pf_kstate *s, struct pf_pdesc *pd, struct inpcb *inp) { struct mbuf *m0; struct sockaddr_in6 dst; @@ -5933,7 +5933,7 @@ pf_test(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, struct inpcb * struct ip *h = NULL; struct m_tag *ipfwtag; struct pf_krule *a = NULL, *r = &V_pf_default_rule, *tr, *nr; - struct pf_state *s = NULL; + struct pf_kstate *s = NULL; struct pf_kruleset *ruleset = NULL; struct pf_pdesc pd; int off, dirndx, pqid = 0; @@ -6321,7 +6321,7 @@ pf_test6(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, struct inpcb struct m_tag *mtag; struct ip6_hdr *h = NULL; struct pf_krule *a = NULL, *r = &V_pf_default_rule, *tr, *nr; - struct pf_state *s = NULL; + struct pf_kstate *s = NULL; struct pf_kruleset *ruleset = NULL; struct pf_pdesc pd; int off, terminal = 0, dirndx, rh_cnt = 0, pqid = 0; diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 51781d488763..19b92e932052 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -1957,7 +1957,7 @@ pf_label_match(const struct pf_krule *rule, const char *label) static unsigned int pf_kill_matching_state(struct pf_state_key_cmp *key, int dir) { - struct pf_state *match; + struct pf_kstate *match; int more = 0; unsigned int killed = 0; @@ -1975,7 +1975,7 @@ pf_kill_matching_state(struct pf_state_key_cmp *key, int dir) static int pf_killstates_row(struct pf_kstate_kill *psk, struct pf_idhash *ih) { - struct pf_state *s; + struct pf_kstate *s; *** 165 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Thu Jul 8 08:48:01 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F0E56665F0A; Thu, 8 Jul 2021 08:48:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GL90x4PGlz3sx8; Thu, 8 Jul 2021 08:48:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 72A4C1DBF1; Thu, 8 Jul 2021 08:48:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1688m102062432; Thu, 8 Jul 2021 08:48:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1688m1rI062431; Thu, 8 Jul 2021 08:48:01 GMT (envelope-from git) Date: Thu, 8 Jul 2021 08:48:01 GMT Message-Id: <202107080848.1688m1rI062431@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 8cceacc0f1ee - main - pf: Remove unneeded NULL check MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8cceacc0f1ee6a77c5f0566b8e6b0f054160fb20 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jul 2021 08:48:02 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=8cceacc0f1ee6a77c5f0566b8e6b0f054160fb20 commit 8cceacc0f1ee6a77c5f0566b8e6b0f054160fb20 Author: Kristof Provost AuthorDate: 2021-07-05 12:02:06 +0000 Commit: Kristof Provost CommitDate: 2021-07-08 08:32:33 +0000 pf: Remove unneeded NULL check pidx is never NULL, and is used unconditionally later on in the function. Add an assertion, as documentation for the requirement to provide an idx pointer. Reported by: clang --analyze MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/netpfil/pf/pf_table.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/netpfil/pf/pf_table.c b/sys/netpfil/pf/pf_table.c index 5afc90e54d7c..4cfe5d61e83e 100644 --- a/sys/netpfil/pf/pf_table.c +++ b/sys/netpfil/pf/pf_table.c @@ -2177,6 +2177,8 @@ pfr_pool_get(struct pfr_ktable *kt, int *pidx, struct pf_addr *counter, struct pfr_kentry *ke, *ke2 = NULL; int idx = -1, use_counter = 0; + MPASS(pidx != NULL); + switch (af) { case AF_INET: uaddr.sin.sin_len = sizeof(struct sockaddr_in); @@ -2194,8 +2196,7 @@ pfr_pool_get(struct pfr_ktable *kt, int *pidx, struct pf_addr *counter, if (!(kt->pfrkt_flags & PFR_TFLAG_ACTIVE)) return (-1); - if (pidx != NULL) - idx = *pidx; + idx = *pidx; if (counter != NULL && idx >= 0) use_counter = 1; if (idx < 0) From owner-dev-commits-src-main@freebsd.org Thu Jul 8 08:48:02 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C0AF7665F0D; Thu, 8 Jul 2021 08:48:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GL90y4fwhz3slx; Thu, 8 Jul 2021 08:48:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 875471DDC9; Thu, 8 Jul 2021 08:48:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1688m2jP062456; Thu, 8 Jul 2021 08:48:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1688m2Ff062455; Thu, 8 Jul 2021 08:48:02 GMT (envelope-from git) Date: Thu, 8 Jul 2021 08:48:02 GMT Message-Id: <202107080848.1688m2Ff062455@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: fa96701c8abb - main - pf: Handle errors returned by pf_killstates() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fa96701c8abbc29aad7f8f8d6b823bd7f89c6c15 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jul 2021 08:48:02 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=fa96701c8abbc29aad7f8f8d6b823bd7f89c6c15 commit fa96701c8abbc29aad7f8f8d6b823bd7f89c6c15 Author: Kristof Provost AuthorDate: 2021-07-05 12:21:03 +0000 Commit: Kristof Provost CommitDate: 2021-07-08 08:32:42 +0000 pf: Handle errors returned by pf_killstates() Happily this wasn't a real bug, because pf_killstates() never fails, but we should check the return value anyway, in case it does ever start returning errors. Reported by: clang --analyze MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/netpfil/pf/pf_ioctl.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 19b92e932052..fece41e917e5 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -4887,6 +4887,8 @@ pf_killstates_nv(struct pfioc_nv *nv) ERROUT(error); error = pf_killstates(&kill, &killed); + if (error) + ERROUT(error); free(nvlpacked, M_NVLIST); nvlpacked = NULL; From owner-dev-commits-src-main@freebsd.org Thu Jul 8 08:52:42 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 93223665FDA; Thu, 8 Jul 2021 08:52:42 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GL96L3dyBz3t5d; Thu, 8 Jul 2021 08:52:42 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-lf1-x12c.google.com with SMTP id 8so1377855lfp.9; Thu, 08 Jul 2021 01:52:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=ZMMkSs+LTZpOXb7MNz8IqQ4LwDXrEyIKVgdsAGGhehM=; b=ocYonRddLnclkx1BstViADtdlTFPtf3QQyDUL3lGwh9r4KnInIHdth/peiqW2s+HrI O/lgeQtM2MF/ypCVSeC3MAufADifWvglA3j7hj6RJMiiVu2mw/clGTQ1nmsdvr9f1Mqo 0hXiiAGazTIv5aN/a6QRiU273WXjPnLqIn18U2myykA7KQTFtthbT0Utx57XMazLzi1Q B03XAG1j3hw1MBgG/aSFDs70qCp94//ncZsCvEaEoGehnE/N3Y3VZyBdo3MznQ7p5a1Q GhN1zGqCkrLvPe8x9t0YGE1HhG9awgAYxfbGF/P5FFPnDaIdn06PyG7/8XVLZ/TbuoGm NFOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=ZMMkSs+LTZpOXb7MNz8IqQ4LwDXrEyIKVgdsAGGhehM=; b=HTsszJhAtPgURxLKSRlFmuO1bh1bIgIBkTKvrNJnptwgzOXEIOq9xfLZX1x7+c3rL4 9dfn4PZl7eOUm1NOAu6tzo5qEj/zI4lUns9Xt0Y+UTdWtUSz+gjLHdSHXs1gvU5nuB2I M7lS0y69UqX1Esa0+9YAMB4mSsQSHv0arnDeVIL8MhwD2jVdYey4UZihFDzMZjOJQekn DdST96t03RE335EhtzUxthUuapXKVTSxdTAaht6uOEKrfuc/2K/IVd45hTxya4PaTplw v+Jl0ptw8jAsuk3i63KVA7mnNyrjh6yfB7sj+v8WwOO7cKXQryrToBDTEs9vGBnnT4M6 lRDA== X-Gm-Message-State: AOAM530f5Dnta9boBBiQbedAToFJzcfRHuEQsZbt+uISAErvIeI9Jka3 t34Tax9ceyuvfkAeyuORfboCkQLwju4WX/rDFBSXNsB6 X-Google-Smtp-Source: ABdhPJzln77xq17BcJSsDumyaKg/9guhAfHtMqlTyeJmVkaX3IZZeTGlyLLaSue1jL+Ps/wzCwDxwua5bTCQ23RSuhw= X-Received: by 2002:a05:651c:54f:: with SMTP id q15mr23765844ljp.347.1625734358550; Thu, 08 Jul 2021 01:52:38 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a2e:9c8b:0:0:0:0:0 with HTTP; Thu, 8 Jul 2021 01:52:37 -0700 (PDT) In-Reply-To: <202107080848.1688m2Ff062455@gitrepo.freebsd.org> References: <202107080848.1688m2Ff062455@gitrepo.freebsd.org> From: Mateusz Guzik Date: Thu, 8 Jul 2021 10:52:37 +0200 Message-ID: Subject: Re: git: fa96701c8abb - main - pf: Handle errors returned by pf_killstates() To: Kristof Provost Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4GL96L3dyBz3t5d X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jul 2021 08:52:42 -0000 if it never fails it should return void On 7/8/21, Kristof Provost wrote: > The branch main has been updated by kp: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=fa96701c8abbc29aad7f8f8d6b823bd7f89c6c15 > > commit fa96701c8abbc29aad7f8f8d6b823bd7f89c6c15 > Author: Kristof Provost > AuthorDate: 2021-07-05 12:21:03 +0000 > Commit: Kristof Provost > CommitDate: 2021-07-08 08:32:42 +0000 > > pf: Handle errors returned by pf_killstates() > > Happily this wasn't a real bug, because pf_killstates() never fails, > but > we should check the return value anyway, in case it does ever start > returning errors. > > Reported by: clang --analyze > MFC after: 1 week > Sponsored by: Rubicon Communications, LLC ("Netgate") > --- > sys/netpfil/pf/pf_ioctl.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c > index 19b92e932052..fece41e917e5 100644 > --- a/sys/netpfil/pf/pf_ioctl.c > +++ b/sys/netpfil/pf/pf_ioctl.c > @@ -4887,6 +4887,8 @@ pf_killstates_nv(struct pfioc_nv *nv) > ERROUT(error); > > error = pf_killstates(&kill, &killed); > + if (error) > + ERROUT(error); > > free(nvlpacked, M_NVLIST); > nvlpacked = NULL; > -- Mateusz Guzik From owner-dev-commits-src-main@freebsd.org Thu Jul 8 12:16:49 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B1C18668ABB; Thu, 8 Jul 2021 12:16:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GLFds4HClz4qHR; Thu, 8 Jul 2021 12:16:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6F3282096A; Thu, 8 Jul 2021 12:16:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 168CGnmv042719; Thu, 8 Jul 2021 12:16:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 168CGnkl042718; Thu, 8 Jul 2021 12:16:49 GMT (envelope-from git) Date: Thu, 8 Jul 2021 12:16:49 GMT Message-Id: <202107081216.168CGnkl042718@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Randall Stewart Subject: git: 7312e4e5cfc8 - main - tcp: Fix 32 bit platform breakage MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rrs X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7312e4e5cfc8e48597acf17f4faa8159f0b5fa06 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jul 2021 12:16:49 -0000 The branch main has been updated by rrs: URL: https://cgit.FreeBSD.org/src/commit/?id=7312e4e5cfc8e48597acf17f4faa8159f0b5fa06 commit 7312e4e5cfc8e48597acf17f4faa8159f0b5fa06 Author: Randall Stewart AuthorDate: 2021-07-08 11:06:58 +0000 Commit: Randall Stewart CommitDate: 2021-07-08 12:16:45 +0000 tcp: Fix 32 bit platform breakage This fixes the incorrect use of a sysctl add to u64. It was for a useconds time, but on 32 bit platforms its not a u64. Instead use the long directive. Reviewed by: tuexen Sponsored by: Netflix Inc. Differential Revision: https://reviews.freebsd.org/D31107 --- sys/netinet/tcp_hpts.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/netinet/tcp_hpts.c b/sys/netinet/tcp_hpts.c index 9a390e3a85c8..9ec092f703ec 100644 --- a/sys/netinet/tcp_hpts.c +++ b/sys/netinet/tcp_hpts.c @@ -2208,10 +2208,10 @@ tcp_init_hptsi(void *st) OID_AUTO, "lastran", CTLFLAG_RD, &cts_last_ran[i], 0, "The last usec tick that this hpts ran"); - SYSCTL_ADD_U64(&hpts->hpts_ctx, + SYSCTL_ADD_LONG(&hpts->hpts_ctx, SYSCTL_CHILDREN(hpts->hpts_root), OID_AUTO, "cur_min_sleep", CTLFLAG_RD, - &hpts->p_mysleep.tv_usec, 0, + &hpts->p_mysleep.tv_usec, "What the running pacers is using for p_mysleep.tv_usec"); SYSCTL_ADD_U64(&hpts->hpts_ctx, SYSCTL_CHILDREN(hpts->hpts_root), From owner-dev-commits-src-main@freebsd.org Thu Jul 8 13:12:02 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4C19E66934F; Thu, 8 Jul 2021 13:12:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GLGsZ1nBgz3Dkw; Thu, 8 Jul 2021 13:12:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 25CEF21A72; Thu, 8 Jul 2021 13:12:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 168DC2MU022309; Thu, 8 Jul 2021 13:12:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 168DC2dx022308; Thu, 8 Jul 2021 13:12:02 GMT (envelope-from git) Date: Thu, 8 Jul 2021 13:12:02 GMT Message-Id: <202107081312.168DC2dx022308@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: c0edde302190 - main - Fix the name of the arm64 SCTLR_E0E register MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c0edde3021900b80fec4e6360d97ba9d9e50d4fd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jul 2021 13:12:02 -0000 The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=c0edde3021900b80fec4e6360d97ba9d9e50d4fd commit c0edde3021900b80fec4e6360d97ba9d9e50d4fd Author: Andrew Turner AuthorDate: 2021-07-07 23:12:50 +0000 Commit: Andrew Turner CommitDate: 2021-07-07 23:18:04 +0000 Fix the name of the arm64 SCTLR_E0E register The character between the E's was the letter O, however in the Arm Documentation and XML the character is the number 0 (zero). Sponsored by: The FreeBSD Foundation --- sys/arm64/arm64/locore.S | 2 +- sys/arm64/include/armreg.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/arm64/arm64/locore.S b/sys/arm64/arm64/locore.S index 472a052e9903..a7e0c87bec0e 100644 --- a/sys/arm64/arm64/locore.S +++ b/sys/arm64/arm64/locore.S @@ -727,7 +727,7 @@ sctlr_set: SCTLR_M | SCTLR_CP15BEN) sctlr_clear: /* Bits to clear */ - .quad (SCTLR_EE | SCTLR_EOE | SCTLR_IESB | SCTLR_WXN | SCTLR_UMA | \ + .quad (SCTLR_EE | SCTLR_E0E | SCTLR_IESB | SCTLR_WXN | SCTLR_UMA | \ SCTLR_ITD | SCTLR_A) LEND(start_mmu) diff --git a/sys/arm64/include/armreg.h b/sys/arm64/include/armreg.h index 8a2bbb60f3d0..58b6c2f637f0 100644 --- a/sys/arm64/include/armreg.h +++ b/sys/arm64/include/armreg.h @@ -831,7 +831,7 @@ #define SCTLR_IESB 0x00200000 /* ARMv8.2 */ /* Bit 22 is reserved */ #define SCTLR_SPAN 0x00800000 /* ARMv8.1 */ -#define SCTLR_EOE 0x01000000 +#define SCTLR_E0E 0x01000000 #define SCTLR_EE 0x02000000 #define SCTLR_UCI 0x04000000 #define SCTLR_EnDA 0x08000000 /* ARMv8.3 */ From owner-dev-commits-src-main@freebsd.org Thu Jul 8 14:00:59 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E3604669F26; Thu, 8 Jul 2021 14:00:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GLHy35Dm0z3JY8; Thu, 8 Jul 2021 14:00:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9BDD122383; Thu, 8 Jul 2021 14:00:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 168E0xnU088313; Thu, 8 Jul 2021 14:00:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 168E0xrO088312; Thu, 8 Jul 2021 14:00:59 GMT (envelope-from git) Date: Thu, 8 Jul 2021 14:00:59 GMT Message-Id: <202107081400.168E0xrO088312@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: e0c0612d9ba4 - main - setkey: ansify MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e0c0612d9ba4b56e51ebca483f1f82d70d64f0f8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jul 2021 14:01:00 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=e0c0612d9ba4b56e51ebca483f1f82d70d64f0f8 commit e0c0612d9ba4b56e51ebca483f1f82d70d64f0f8 Author: Mateusz Guzik AuthorDate: 2021-07-08 11:28:34 +0000 Commit: Mateusz Guzik CommitDate: 2021-07-08 14:00:55 +0000 setkey: ansify --- sbin/setkey/setkey.c | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/sbin/setkey/setkey.c b/sbin/setkey/setkey.c index 1d66a92e0100..d011fd44a40a 100644 --- a/sbin/setkey/setkey.c +++ b/sbin/setkey/setkey.c @@ -91,7 +91,7 @@ extern int lineno; extern int parse(FILE **); void -usage() +usage(void) { printf("usage: setkey [-v] -c\n"); @@ -103,9 +103,7 @@ usage() } int -main(ac, av) - int ac; - char **av; +main(int ac, char **av) { FILE *fp = stdin; int c; @@ -202,7 +200,7 @@ main(ac, av) } int -get_supported() +get_supported(void) { if (pfkey_send_register(so, SADB_SATYPE_UNSPEC) < 0) @@ -234,7 +232,7 @@ sendkeyshort(u_int type, uint8_t satype) } void -promisc() +promisc(void) { struct sadb_msg msg; u_char rbuf[1024 * 32]; /* XXX: Enough ? Should I do MSG_PEEK ? */ @@ -300,9 +298,7 @@ promisc() } int -sendkeymsg(buf, len) - char *buf; - size_t len; +sendkeymsg(char *buf, size_t len) { u_char rbuf[1024 * 32]; /* XXX: Enough ? Should I do MSG_PEEK ? */ ssize_t l; @@ -374,9 +370,7 @@ end: } int -postproc(msg, len) - struct sadb_msg *msg; - int len; +postproc(struct sadb_msg *msg, int len) { if (msg->sadb_msg_errno != 0) { @@ -482,8 +476,7 @@ static const char *ipproto[] = { (((x) < sizeof(tab)/sizeof(tab[0]) && tab[(x)]) ? tab[(x)] : numstr(x)) const char * -numstr(x) - int x; +numstr(int x) { static char buf[20]; snprintf(buf, sizeof(buf), "#%d", x); @@ -491,15 +484,14 @@ numstr(x) } void -shortdump_hdr() +shortdump_hdr(void) { printf("%-4s %-3s %-1s %-8s %-7s %s -> %s\n", "time", "p", "s", "spi", "ltime", "src", "dst"); } void -shortdump(msg) - struct sadb_msg *msg; +shortdump(struct sadb_msg *msg) { caddr_t mhp[SADB_EXT_MAX + 1]; char buf[NI_MAXHOST], pbuf[NI_MAXSERV]; @@ -585,7 +577,7 @@ shortdump(msg) * Print the timestamp */ static void -printdate() +printdate(void) { struct timeval tp; int s; From owner-dev-commits-src-main@freebsd.org Thu Jul 8 14:01:00 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EA895669F28; Thu, 8 Jul 2021 14:01:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GLHy46GZgz3Jf8; Thu, 8 Jul 2021 14:01:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BE31E221B8; Thu, 8 Jul 2021 14:01:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 168E10Ss088337; Thu, 8 Jul 2021 14:01:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 168E10in088336; Thu, 8 Jul 2021 14:01:00 GMT (envelope-from git) Date: Thu, 8 Jul 2021 14:01:00 GMT Message-Id: <202107081401.168E10in088336@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: b29817874d19 - main - setkey: fix several warnings popping up when compiling without WARNS=1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b29817874d19ce3e4e4c78e3cb74ebefe71f90cc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jul 2021 14:01:01 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=b29817874d19ce3e4e4c78e3cb74ebefe71f90cc commit b29817874d19ce3e4e4c78e3cb74ebefe71f90cc Author: Mateusz Guzik AuthorDate: 2021-07-08 11:30:45 +0000 Commit: Mateusz Guzik CommitDate: 2021-07-08 14:00:55 +0000 setkey: fix several warnings popping up when compiling without WARNS=1 --- sbin/setkey/setkey.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/sbin/setkey/setkey.c b/sbin/setkey/setkey.c index d011fd44a40a..9e896996a259 100644 --- a/sbin/setkey/setkey.c +++ b/sbin/setkey/setkey.c @@ -73,17 +73,17 @@ static int32_t gmt2local(time_t); #define MODE_CMDFLUSH 3 #define MODE_PROMISC 4 -int so; - -int f_forever = 0; -int f_all = 0; -int f_verbose = 0; -int f_mode = 0; -int f_cmddump = 0; -int f_policy = 0; -int f_hexdump = 0; -int f_tflag = 0; -int f_scope = 0; +static int so; + +static int f_forever = 0; +static int f_all = 0; +static int f_verbose = 0; +static int f_mode = 0; +static int f_cmddump = 0; +static int f_policy = 0; +static int f_hexdump = 0; +static int f_tflag = 0; +static int f_scope = 0; static time_t thiszone; extern int lineno; @@ -322,10 +322,10 @@ again: printf("\n"); } if (f_hexdump) { - int i; + size_t i; for (i = 0; i < len; i++) { if (i % 16 == 0) - printf("%08x: ", i); + printf("%08x: ", (u_int)i); printf("%02x ", buf[i] & 0xff); if (i % 16 == 15) printf("\n"); From owner-dev-commits-src-main@freebsd.org Thu Jul 8 14:01:02 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1E37466A2AA; Thu, 8 Jul 2021 14:01:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GLHy608WDz3JVy; Thu, 8 Jul 2021 14:01:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E0D3B22384; Thu, 8 Jul 2021 14:01:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 168E11Tw088361; Thu, 8 Jul 2021 14:01:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 168E119E088360; Thu, 8 Jul 2021 14:01:01 GMT (envelope-from git) Date: Thu, 8 Jul 2021 14:01:01 GMT Message-Id: <202107081401.168E119E088360@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 1e67e3109d9d - main - setkey: drop an unused argument from postproc MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1e67e3109d9df74c9de60f0f6ee4d8f303c2d7bd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jul 2021 14:01:02 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=1e67e3109d9df74c9de60f0f6ee4d8f303c2d7bd commit 1e67e3109d9df74c9de60f0f6ee4d8f303c2d7bd Author: Mateusz Guzik AuthorDate: 2021-07-08 11:31:43 +0000 Commit: Mateusz Guzik CommitDate: 2021-07-08 14:00:55 +0000 setkey: drop an unused argument from postproc --- sbin/setkey/setkey.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sbin/setkey/setkey.c b/sbin/setkey/setkey.c index 9e896996a259..d556a842f048 100644 --- a/sbin/setkey/setkey.c +++ b/sbin/setkey/setkey.c @@ -61,7 +61,7 @@ int get_supported(void); void sendkeyshort(u_int, uint8_t); void promisc(void); int sendkeymsg(char *, size_t); -int postproc(struct sadb_msg *, int); +int postproc(struct sadb_msg *); const char *numstr(int); void shortdump_hdr(void); void shortdump(struct sadb_msg *); @@ -355,7 +355,7 @@ again: kdebug_sadb((struct sadb_msg *)rbuf); printf("\n"); } - if (postproc(msg, l) < 0) + if (postproc(msg) < 0) break; } while (msg->sadb_msg_errno || msg->sadb_msg_seq); @@ -370,7 +370,7 @@ end: } int -postproc(struct sadb_msg *msg, int len) +postproc(struct sadb_msg *msg) { if (msg->sadb_msg_errno != 0) { From owner-dev-commits-src-main@freebsd.org Thu Jul 8 14:01:03 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4D8CC669D49; Thu, 8 Jul 2021 14:01:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GLHy71Vfhz3JYF; Thu, 8 Jul 2021 14:01:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0E12F22386; Thu, 8 Jul 2021 14:01:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 168E12lc088389; Thu, 8 Jul 2021 14:01:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 168E12mq088388; Thu, 8 Jul 2021 14:01:02 GMT (envelope-from git) Date: Thu, 8 Jul 2021 14:01:02 GMT Message-Id: <202107081401.168E12mq088388@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 19d6e29b8722 - main - pf: add pf_find_state_all_exists MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 19d6e29b872232c47190344f3dfded2f73edd8ae Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jul 2021 14:01:03 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=19d6e29b872232c47190344f3dfded2f73edd8ae commit 19d6e29b872232c47190344f3dfded2f73edd8ae Author: Mateusz Guzik AuthorDate: 2021-07-08 13:11:57 +0000 Commit: Mateusz Guzik CommitDate: 2021-07-08 14:00:55 +0000 pf: add pf_find_state_all_exists Reviewed by: kp Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/net/pfvar.h | 2 ++ sys/netpfil/pf/pf.c | 9 +++++++++ sys/netpfil/pf/pf_lb.c | 10 ++++------ 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index f491e18b03a4..7bbb585106c7 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -1591,6 +1591,8 @@ pf_release_staten(struct pf_kstate *s, u_int n) extern struct pf_kstate *pf_find_state_byid(uint64_t, uint32_t); extern struct pf_kstate *pf_find_state_all(struct pf_state_key_cmp *, u_int, int *); +extern bool pf_find_state_all_exists(struct pf_state_key_cmp *, + u_int); extern struct pf_ksrc_node *pf_find_src_node(struct pf_addr *, struct pf_krule *, sa_family_t, int); extern void pf_unlink_src_node(struct pf_ksrc_node *); diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 8fae01ce1c23..3ca921ff3287 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -1453,6 +1453,15 @@ second_run: return (ret); } +bool +pf_find_state_all_exists(struct pf_state_key_cmp *key, u_int dir) +{ + struct pf_kstate *s; + + s = pf_find_state_all(key, dir, NULL); + return (s != NULL); +} + /* END state table stuff */ static void diff --git a/sys/netpfil/pf/pf_lb.c b/sys/netpfil/pf/pf_lb.c index 5e281eccc144..000ee69d9ae9 100644 --- a/sys/netpfil/pf/pf_lb.c +++ b/sys/netpfil/pf/pf_lb.c @@ -244,13 +244,13 @@ pf_get_sport(sa_family_t af, u_int8_t proto, struct pf_krule *r, * (traceroute -I through nat) */ key.port[1] = sport; - if (pf_find_state_all(&key, PF_IN, NULL) == NULL) { + if (!pf_find_state_all_exists(&key, PF_IN)) { *nport = sport; return (0); } } else if (low == high) { key.port[1] = htons(low); - if (pf_find_state_all(&key, PF_IN, NULL) == NULL) { + if (!pf_find_state_all_exists(&key, PF_IN)) { *nport = htons(low); return (0); } @@ -268,8 +268,7 @@ pf_get_sport(sa_family_t af, u_int8_t proto, struct pf_krule *r, /* low <= cut <= high */ for (tmp = cut; tmp <= high && tmp <= 0xffff; ++tmp) { key.port[1] = htons(tmp); - if (pf_find_state_all(&key, PF_IN, NULL) == - NULL) { + if (!pf_find_state_all_exists(&key, PF_IN)) { *nport = htons(tmp); return (0); } @@ -277,8 +276,7 @@ pf_get_sport(sa_family_t af, u_int8_t proto, struct pf_krule *r, tmp = cut; for (tmp -= 1; tmp >= low && tmp <= 0xffff; --tmp) { key.port[1] = htons(tmp); - if (pf_find_state_all(&key, PF_IN, NULL) == - NULL) { + if (!pf_find_state_all_exists(&key, PF_IN)) { *nport = htons(tmp); return (0); } From owner-dev-commits-src-main@freebsd.org Thu Jul 8 14:23:16 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D260466A465; Thu, 8 Jul 2021 14:23:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GLJRm5MPTz3M45; Thu, 8 Jul 2021 14:23:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 965E922995; Thu, 8 Jul 2021 14:23:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 168ENGGa019476; Thu, 8 Jul 2021 14:23:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 168ENGr6019475; Thu, 8 Jul 2021 14:23:16 GMT (envelope-from git) Date: Thu, 8 Jul 2021 14:23:16 GMT Message-Id: <202107081423.168ENGr6019475@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 28f47a199cfd - main - pf: fallback if $pf_rules fails to load MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 28f47a199cfd8749ab30a0327b0a3f8977ec2b43 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jul 2021 14:23:16 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=28f47a199cfd8749ab30a0327b0a3f8977ec2b43 commit 28f47a199cfd8749ab30a0327b0a3f8977ec2b43 Author: Thomas Steen Rasmussen AuthorDate: 2021-06-16 18:29:06 +0000 Commit: Kristof Provost CommitDate: 2021-07-08 12:22:04 +0000 pf: fallback if $pf_rules fails to load Support loading a default pf ruleset in case of invalid pf.conf. If no pf rules are loaded pf will pass/allow all traffic, assuming the kernel is compiled without PF_DEFAULT_TO_DROP, as is the case in GENERIC. In other words: if there's a typo in the main pf_rules we would allow all traffic. The new default rules minimise the impact of this. If $pf_program (i.e. pfctl) fails to set $pf_fules and $pf_fallback_rules_enable is YES we will load $pf_fallback_rules_file if set, or $pf_fallback_rules. $pf_fallback_rules can include multiple rules, for example to permit traffic on a management interface. $pf_fallback_rules_enable defaults to "NO", preserving historic behaviour. man page changes by ceri@. PR: 256410 Reviewed by: donner, kp Sponsored by: semaphor.dk Differential Revision: https://reviews.freebsd.org/D30791 --- libexec/rc/rc.conf | 5 +++++ libexec/rc/rc.d/pf | 19 ++++++++++++++++++- share/man/man5/rc.conf.5 | 38 +++++++++++++++++++++++++++++++++++++- 3 files changed, 60 insertions(+), 2 deletions(-) diff --git a/libexec/rc/rc.conf b/libexec/rc/rc.conf index 9fdc4d9d8636..b392dae9ae6c 100644 --- a/libexec/rc/rc.conf +++ b/libexec/rc/rc.conf @@ -224,6 +224,11 @@ pf_rules="/etc/pf.conf" # rules definition file for pf (nonexistent # by default) pf_program="/sbin/pfctl" # where the pfctl program lives pf_flags="" # additional flags for pfctl +pf_fallback_rules_enable="NO" # fallback if loading ruleset fails +pf_fallback_rules="block drop log all" # rules to load on pf ruleset failure +#pf_fallback_rules="block drop log all +#pass quick on em4" # multi-rule +pf_fallback_rules_file="/etc/pf-fallback.conf" # rules file on ruleset failure pflog_enable="NO" # Set to YES to enable packet filter logging pflog_logfile="/var/log/pflog" # where pflogd should store the logfile pflog_program="/sbin/pflogd" # where the pflogd program lives diff --git a/libexec/rc/rc.d/pf b/libexec/rc/rc.d/pf index 1f7394007667..fa1b49643cc5 100755 --- a/libexec/rc/rc.d/pf +++ b/libexec/rc/rc.d/pf @@ -23,11 +23,28 @@ extra_commands="check reload resync" required_files="$pf_rules" required_modules="pf" +pf_fallback() +{ + warn "Unable to load $pf_rules." + + if ! checkyesno pf_fallback_rules_enable; then + return + fi + + if [ -f $pf_fallback_rules_file ]; then + warn "Loading fallback rules file: $pf_fallback_rules_file" + $pf_program -f "$pf_fallback_rules_file" $pf_flags + else + warn "Loading fallback rules: $pf_fallback_rules" + echo $pf_fallback_rules | $pf_program -f - $pf_flags + fi +} + pf_start() { check_startmsgs && echo -n 'Enabling pf' $pf_program -F all > /dev/null 2>&1 - $pf_program -f "$pf_rules" $pf_flags + $pf_program -f "$pf_rules" $pf_flags || pf_fallback if ! $pf_program -s info | grep -q "Enabled" ; then $pf_program -eq fi diff --git a/share/man/man5/rc.conf.5 b/share/man/man5/rc.conf.5 index 5692228c4db5..57404b8c0e89 100644 --- a/share/man/man5/rc.conf.5 +++ b/share/man/man5/rc.conf.5 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 1, 2021 +.Dd July 8, 2021 .Dt RC.CONF 5 .Os .Sh NAME @@ -996,6 +996,42 @@ is set to these flags are passed to the .Xr pfctl 8 program when loading the ruleset. +.It Va pf_fallback_rules_enable +.Pq Vt bool +Set to +.Dq Li NO +by default. +Setting this to +.Dq Li YES +enables loading +.Va pf_fallback_rules_file +or +.Va pf_fallback_rules +in case of a problem when loading the ruleset in +.Va pf_rules . +.It Va pf_fallback_rules_file +.Pq Vt str +Path to a pf ruleset to load in case of failure when loading the +ruleset in +.Va pf_rules +(default +.Pa /etc/pf-fallback.conf ) . +.It Va pf_fallback_rules +.Pq Vt str +A pf ruleset to load in case of failure when loading the ruleset in +.Va pf_rules +and +.Va pf_fallback_rules_file +is not found. +Multiple rules can be set as follows: +.Bd -literal +pf_fallback_rules="\\ + block drop log all\\ + pass in quick on em0" +.Pp +.Ed +The default fallback rule is +.Dq block drop log all .It Va pflog_enable .Pq Vt bool Set to From owner-dev-commits-src-main@freebsd.org Thu Jul 8 16:18:08 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0A3E664E2ED; Thu, 8 Jul 2021 16:18:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GLM0H6rpCz3q0w; Thu, 8 Jul 2021 16:18:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D21DF24192; Thu, 8 Jul 2021 16:18:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 168GI7h4066453; Thu, 8 Jul 2021 16:18:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 168GI72c066452; Thu, 8 Jul 2021 16:18:07 GMT (envelope-from git) Date: Thu, 8 Jul 2021 16:18:07 GMT Message-Id: <202107081618.168GI72c066452@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Somers Subject: git: 61631b24a134 - main - iostat: fix rounding errors in iostat -x MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 61631b24a1347a23cafe0657fba894622b1606e2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jul 2021 16:18:08 -0000 The branch main has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=61631b24a1347a23cafe0657fba894622b1606e2 commit 61631b24a1347a23cafe0657fba894622b1606e2 Author: Alan Somers AuthorDate: 2021-07-08 16:16:32 +0000 Commit: Alan Somers CommitDate: 2021-07-08 16:16:32 +0000 iostat: fix rounding errors in iostat -x Better to round numbers instead of flooring them. MFC after: 3 weeks Sponsored by: Axcient --- usr.sbin/iostat/iostat.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/usr.sbin/iostat/iostat.c b/usr.sbin/iostat/iostat.c index 4cbfcfcbcbd5..9140bf10ef07 100644 --- a/usr.sbin/iostat/iostat.c +++ b/usr.sbin/iostat/iostat.c @@ -888,17 +888,17 @@ devstats(int perf_select, long double etime, int havelast) mb_per_second_write > ((long double).0005)/1024 || busy_pct > 0.5) { if (Iflag == 0) - printf("%-8.8s %7d %7d %8.1Lf " - "%8.1Lf %5d %5d %5d %5d " - "%4" PRIu64 " %3.0Lf ", + printf("%-8.8s %7.0Lf %7.0Lf %8.1Lf " + "%8.1Lf %5.0Lf %5.0Lf %5.0Lf %5.0Lf" + " %4" PRIu64 " %3.0Lf ", devicename, - (int)transfers_per_second_read, - (int)transfers_per_second_write, + transfers_per_second_read, + transfers_per_second_write, mb_per_second_read * 1024, mb_per_second_write * 1024, - (int)ms_per_read, (int)ms_per_write, - (int)ms_per_other, - (int)ms_per_transaction, + ms_per_read, ms_per_write, + ms_per_other, + ms_per_transaction, queue_len, busy_pct); else printf("%-8.8s %11.1Lf %11.1Lf " From owner-dev-commits-src-main@freebsd.org Thu Jul 8 16:53:40 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5AC2C650D1F for ; Thu, 8 Jul 2021 16:53:40 +0000 (UTC) (envelope-from ram.vegesna@broadcom.com) Received: from mail-ot1-x331.google.com (mail-ot1-x331.google.com [IPv6:2607:f8b0:4864:20::331]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GLMnH3gK0z3vf2 for ; Thu, 8 Jul 2021 16:53:39 +0000 (UTC) (envelope-from ram.vegesna@broadcom.com) Received: by mail-ot1-x331.google.com with SMTP id w8-20020a0568304108b02904b3da3d49e5so2470259ott.1 for ; Thu, 08 Jul 2021 09:53:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=o7Ek+uS4j39qNSOawQtEHacRJ2qGZn62+fvXjECa3iE=; b=EBCzUNZymzrWhgPz3oIvtnKPny1BtHO0GICiWHmGOZRe9C4cs4dzXkVCYTm3vK9Q8G i3+yxRONZkPiuk5sr8wKDkH86OL2qBaP8l3kNrymIFqT82WDx08Ds+hMhKphqIJbqJ4I RvV5a2uNecgipcVrcCz62MmNy9wG77BMX5eLPWT2JhdsllPxBFBTI3EdDi+ne8VthEYn 8CxT1CbRMXHin409BdC1IFGk/w2qYtuVwlW1DObMW4ipeLE+LrL0r3IHiBS3JkYoqq9d yZeYYOkIxrtMtlYYKY4hkm6UOG4RC5Fe5P/dP7spaaNg/7bB2W21phWJFOXpfbTxjeh7 EHbg== X-Gm-Message-State: AOAM533Oq0EYhOMSmm3kQMTAxb9uDVY+zBPj8lF2xhRtXc6gNNqIHtkT kwP8wJCbpWZ84YSEsXg9k1jQxzKrwbihd8jO5WT+xlfGkgE5dQC58hrF01cFbZGBaBWaKrhN+Hg Q1HcauS/aP9U/y6KjmeNp5X/R0HMRFfdjy49F X-Google-Smtp-Source: ABdhPJzAGm0EHNkNSsejQA9yc3VmSKlE7GMjOcrnZPm6lzBaGS8mbRdJtqTe/2oGUhI5RjpVIoOmEG0Z8nTZi4lWK8g= X-Received: by 2002:a05:6830:1f55:: with SMTP id u21mr24360363oth.4.1625763217604; Thu, 08 Jul 2021 09:53:37 -0700 (PDT) MIME-Version: 1.0 References: <202107061548.166Fm2ol078877@gitrepo.freebsd.org> <2b8685de-e94b-9413-b4fd-43526c7903d3@gmail.com> In-Reply-To: <2b8685de-e94b-9413-b4fd-43526c7903d3@gmail.com> From: Ram Kishore Vegesna Date: Thu, 8 Jul 2021 22:23:26 +0530 Message-ID: Subject: Re: git: 29e2dbd42c3e - main - ocs_fc: Add gendump and dump_to_host ioctl command support. To: Alexander Motin Cc: Kristof Provost , Ram Kishore Vegesna , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: multipart/signed; protocol="application/pkcs7-signature"; micalg=sha-256; boundary="00000000000024a23405c69f7f70" X-Rspamd-Queue-Id: 4GLMnH3gK0z3vf2 X-Spamd-Bar: --- X-Spamd-Result: default: False [-3.88 / 15.00]; TO_DN_SOME(0.00)[]; HAS_ATTACHMENT(0.00)[]; R_SPF_SOFTFAIL(0.00)[~all]; RCPT_COUNT_FIVE(0.00)[6]; DKIM_TRACE(0.00)[broadcom.com:+]; DMARC_POLICY_ALLOW(0.00)[broadcom.com,quarantine]; DMARC_POLICY_ALLOW_WITH_FAILURES(-0.50)[]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:+,3:~,4:~]; RBL_DBL_DONT_QUERY_IPS(0.00)[2607:f8b0:4864:20::331:from]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[broadcom.com:s=google]; FROM_HAS_DN(0.00)[]; SIGNED_SMIME(-2.00)[]; NEURAL_SPAM_SHORT(1.00)[0.999]; NEURAL_HAM_LONG(-0.98)[-0.976]; MIME_GOOD(-0.20)[multipart/signed,multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[dev-commits-src-main@freebsd.org]; SPAMHAUS_ZRD(0.00)[2607:f8b0:4864:20::331:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::331:from]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[dev-commits-src-main] X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jul 2021 16:53:40 -0000 --00000000000024a23405c69f7f70 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sorry I missed that change. Alexander, Thanks for the fix. -Ram On Wed, Jul 7, 2021 at 12:34 AM Alexander Motin wrote: > On 06.07.2021 14:55, Kristof Provost wrote: > > On 6 Jul 2021, at 17:48, Ram Kishore Vegesna wrote: > > The branch main has been updated by ram: > > > > URL: > > > https://cgit.FreeBSD.org/src/commit/?id=3D29e2dbd42c3e2e10e606b3414f4d0c5= 3021d4e86 > > > > commit 29e2dbd42c3e2e10e606b3414f4d0c53021d4e86 > > Author: Ram Kishore Vegesna > > AuthorDate: 2021-06-24 07:05:00 +0000 > > Commit: Ram Kishore Vegesna > > CommitDate: 2021-07-06 15:38:11 +0000 > > > > ocs_fc: Add gendump and dump_to_host ioctl command support. > > > > Support to generate firmware dump. > > > > Approved by: mav(mentor) > > --- > > sys/dev/ocs_fc/ocs_gendump.c | 388 > > +++++++++++++++++++++++++++++++++++++++++++ > > sys/dev/ocs_fc/ocs_gendump.h | 42 +++++ > > sys/dev/ocs_fc/ocs_ioctl.c | 13 +- > > sys/dev/ocs_fc/ocs_ioctl.h | 3 + > > sys/dev/ocs_fc/ocs_mgmt.c | 152 ++--------------- > > sys/dev/ocs_fc/ocs_os.c | 3 +- > > sys/dev/ocs_fc/ocs_os.h | 3 +- > > sys/modules/ocs_fc/Makefile | 3 +- > > 8 files changed, 449 insertions(+), 158 deletions(-) > > > > I=E2=80=99m seeing this build failure (amd64, GENERIC kernel): > > > > |ld: error: undefined symbol: ocs_gen_dump >>> referenced by > > ocs_mgmt.c:485 (/usr/src/sys/dev/ocs_fc/ocs_mgmt.c:485) >>> > > ocs_mgmt.o:(ocs_mgmt_exec) ld: error: undefined symbol: ocs_dump_to_hos= t > >>>> referenced by ocs_mgmt.c:489 > > (/usr/src/sys/dev/ocs_fc/ocs_mgmt.c:489) >>> ocs_mgmt.o:(ocs_mgmt_exec) > > *** [kernel.full] Error code 1 | > > > > Does that ring any bells? > > d0732fa81963 should fix it. Sorry for breakage. > > -- > Alexander Motin > --=20 This electronic communication and the information and any files transmitted= =20 with it, or attached to it, are confidential and are intended solely for=20 the use of the individual or entity to whom it is addressed and may contain= =20 information that is confidential, legally privileged, protected by privacy= =20 laws, or otherwise restricted from disclosure to anyone else. If you are=20 not the intended recipient or the person responsible for delivering the=20 e-mail to the intended recipient, you are hereby notified that any use,=20 copying, distributing, dissemination, forwarding, printing, or copying of= =20 this e-mail is strictly prohibited. If you received this e-mail in error,= =20 please return the e-mail to the sender, delete it from your computer, and= =20 destroy any printed copy of it. --00000000000024a23405c69f7f70 Content-Type: application/pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="smime.p7s" Content-Description: S/MIME Cryptographic Signature MIIQcgYJKoZIhvcNAQcCoIIQYzCCEF8CAQExDzANBglghkgBZQMEAgEFADALBgkqhkiG9w0BBwGg gg3JMIIFDTCCA/WgAwIBAgIQeEqpED+lv77edQixNJMdADANBgkqhkiG9w0BAQsFADBMMSAwHgYD VQQLExdHbG9iYWxTaWduIFJvb3QgQ0EgLSBSMzETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UE AxMKR2xvYmFsU2lnbjAeFw0yMDA5MTYwMDAwMDBaFw0yODA5MTYwMDAwMDBaMFsxCzAJBgNVBAYT AkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMTEwLwYDVQQDEyhHbG9iYWxTaWduIEdDQyBS MyBQZXJzb25hbFNpZ24gMiBDQSAyMDIwMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA vbCmXCcsbZ/a0fRIQMBxp4gJnnyeneFYpEtNydrZZ+GeKSMdHiDgXD1UnRSIudKo+moQ6YlCOu4t rVWO/EiXfYnK7zeop26ry1RpKtogB7/O115zultAz64ydQYLe+a1e/czkALg3sgTcOOcFZTXk38e aqsXsipoX1vsNurqPtnC27TWsA7pk4uKXscFjkeUE8JZu9BDKaswZygxBOPBQBwrA5+20Wxlk6k1 e6EKaaNaNZUy30q3ArEf30ZDpXyfCtiXnupjSK8WU2cK4qsEtj09JS4+mhi0CTCrCnXAzum3tgcH cHRg0prcSzzEUDQWoFxyuqwiwhHu3sPQNmFOMwIDAQABo4IB2jCCAdYwDgYDVR0PAQH/BAQDAgGG MGAGA1UdJQRZMFcGCCsGAQUFBwMCBggrBgEFBQcDBAYKKwYBBAGCNxQCAgYKKwYBBAGCNwoDBAYJ KwYBBAGCNxUGBgorBgEEAYI3CgMMBggrBgEFBQcDBwYIKwYBBQUHAxEwEgYDVR0TAQH/BAgwBgEB /wIBADAdBgNVHQ4EFgQUljPR5lgXWzR1ioFWZNW+SN6hj88wHwYDVR0jBBgwFoAUj/BLf6guRSSu TVD6Y5qL3uLdG7wwegYIKwYBBQUHAQEEbjBsMC0GCCsGAQUFBzABhiFodHRwOi8vb2NzcC5nbG9i YWxzaWduLmNvbS9yb290cjMwOwYIKwYBBQUHMAKGL2h0dHA6Ly9zZWN1cmUuZ2xvYmFsc2lnbi5j b20vY2FjZXJ0L3Jvb3QtcjMuY3J0MDYGA1UdHwQvMC0wK6ApoCeGJWh0dHA6Ly9jcmwuZ2xvYmFs c2lnbi5jb20vcm9vdC1yMy5jcmwwWgYDVR0gBFMwUTALBgkrBgEEAaAyASgwQgYKKwYBBAGgMgEo CjA0MDIGCCsGAQUFBwIBFiZodHRwczovL3d3dy5nbG9iYWxzaWduLmNvbS9yZXBvc2l0b3J5LzAN BgkqhkiG9w0BAQsFAAOCAQEAdAXk/XCnDeAOd9nNEUvWPxblOQ/5o/q6OIeTYvoEvUUi2qHUOtbf jBGdTptFsXXe4RgjVF9b6DuizgYfy+cILmvi5hfk3Iq8MAZsgtW+A/otQsJvK2wRatLE61RbzkX8 9/OXEZ1zT7t/q2RiJqzpvV8NChxIj+P7WTtepPm9AIj0Keue+gS2qvzAZAY34ZZeRHgA7g5O4TPJ /oTd+4rgiU++wLDlcZYd/slFkaT3xg4qWDepEMjT4T1qFOQIL+ijUArYS4owpPg9NISTKa1qqKWJ jFoyms0d0GwOniIIbBvhI2MJ7BSY9MYtWVT5jJO3tsVHwj4cp92CSFuGwunFMzCCA18wggJHoAMC AQICCwQAAAAAASFYUwiiMA0GCSqGSIb3DQEBCwUAMEwxIDAeBgNVBAsTF0dsb2JhbFNpZ24gUm9v dCBDQSAtIFIzMRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQDEwpHbG9iYWxTaWduMB4XDTA5 MDMxODEwMDAwMFoXDTI5MDMxODEwMDAwMFowTDEgMB4GA1UECxMXR2xvYmFsU2lnbiBSb290IENB IC0gUjMxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkdsb2JhbFNpZ24wggEiMA0GCSqG SIb3DQEBAQUAA4IBDwAwggEKAoIBAQDMJXaQeQZ4Ihb1wIO2hMoonv0FdhHFrYhy/EYCQ8eyip0E XyTLLkvhYIJG4VKrDIFHcGzdZNHr9SyjD4I9DCuul9e2FIYQebs7E4B3jAjhSdJqYi8fXvqWaN+J J5U4nwbXPsnLJlkNc96wyOkmDoMVxu9bi9IEYMpJpij2aTv2y8gokeWdimFXN6x0FNx04Druci8u nPvQu7/1PQDhBjPogiuuU6Y6FnOM3UEOIDrAtKeh6bJPkC4yYOlXy7kEkmho5TgmYHWyn3f/kRTv riBJ/K1AFUjRAjFhGV64l++td7dkmnq/X8ET75ti+w1s4FRpFqkD2m7pg5NxdsZphYIXAgMBAAGj QjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBSP8Et/qC5FJK5N UPpjmove4t0bvDANBgkqhkiG9w0BAQsFAAOCAQEAS0DbwFCq/sgM7/eWVEVJu5YACUGssxOGhigH M8pr5nS5ugAtrqQK0/Xx8Q+Kv3NnSoPHRHt44K9ubG8DKY4zOUXDjuS5V2yq/BKW7FPGLeQkbLmU Y/vcU2hnVj6DuM81IcPJaP7O2sJTqsyQiunwXUaMld16WCgaLx3ezQA3QY/tRG3XUyiXfvNnBB4V 14qWtNPeTCekTBtzc3b0F5nCH3oO4y0IrQocLP88q1UOD5F+NuvDV0m+4S4tfGCLw0FREyOdzvcy a5QBqJnnLDMfOjsl0oZAzjsshnjJYS8Uuu7bVW/fhO4FCU29KNhyztNiUGUe65KXgzHZs7XKR1g/ XzCCBVEwggQ5oAMCAQICDCHWmFjgp1UNrBuhLTANBgkqhkiG9w0BAQsFADBbMQswCQYDVQQGEwJC RTEZMBcGA1UEChMQR2xvYmFsU2lnbiBudi1zYTExMC8GA1UEAxMoR2xvYmFsU2lnbiBHQ0MgUjMg UGVyc29uYWxTaWduIDIgQ0EgMjAyMDAeFw0yMTAyMjIxMzIwNDlaFw0yMjA5MTgwNTQ0MjBaMIGU MQswCQYDVQQGEwJJTjESMBAGA1UECBMJS2FybmF0YWthMRIwEAYDVQQHEwlCYW5nYWxvcmUxFjAU BgNVBAoTDUJyb2FkY29tIEluYy4xHDAaBgNVBAMTE1JhbSBLaXNob3JlIFZlZ2VzbmExJzAlBgkq hkiG9w0BCQEWGHJhbS52ZWdlc25hQGJyb2FkY29tLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEP ADCCAQoCggEBAKvDIuYw4Dw9iSL1FWdgKrhC9K2xqtq0FeHNKQGyTOZzJ6DsQDCaDqKL2D1XWMf2 XaIEnkjdCglht1PGBfTChSjLBKojnG2iBRze8NTHJV6oJsCZDXPPwdyJMXL/vMAkxAFqkDU078oO gufvsLigzOCQXAYp6HHt53iHtp06J16pJCY9fhdIcn7OcVYik2ofB7xDnb1HZOHNhkHdjdIaID0H Vxab43fOCbFozIOlzutBV4fhpWlA3FrVNhbPhbwO398TsV3gUkYHkxoS9kLeRXHnNcdOcFMo8Maz mQF6P67d881N/0Tt0k0MfXGTHytZvfFdayivzlL9nAnyXTzPFU8CAwEAAaOCAdkwggHVMA4GA1Ud DwEB/wQEAwIFoDCBowYIKwYBBQUHAQEEgZYwgZMwTgYIKwYBBQUHMAKGQmh0dHA6Ly9zZWN1cmUu Z2xvYmFsc2lnbi5jb20vY2FjZXJ0L2dzZ2NjcjNwZXJzb25hbHNpZ24yY2EyMDIwLmNydDBBBggr BgEFBQcwAYY1aHR0cDovL29jc3AuZ2xvYmFsc2lnbi5jb20vZ3NnY2NyM3BlcnNvbmFsc2lnbjJj YTIwMjAwTQYDVR0gBEYwRDBCBgorBgEEAaAyASgKMDQwMgYIKwYBBQUHAgEWJmh0dHBzOi8vd3d3 Lmdsb2JhbHNpZ24uY29tL3JlcG9zaXRvcnkvMAkGA1UdEwQCMAAwSQYDVR0fBEIwQDA+oDygOoY4 aHR0cDovL2NybC5nbG9iYWxzaWduLmNvbS9nc2djY3IzcGVyc29uYWxzaWduMmNhMjAyMC5jcmww IwYDVR0RBBwwGoEYcmFtLnZlZ2VzbmFAYnJvYWRjb20uY29tMBMGA1UdJQQMMAoGCCsGAQUFBwME MB8GA1UdIwQYMBaAFJYz0eZYF1s0dYqBVmTVvkjeoY/PMB0GA1UdDgQWBBQt2m9JVe4cejFw9Mog spXwL7sKWzANBgkqhkiG9w0BAQsFAAOCAQEAARwXxUTPdWpdSOs12BsNVMRlHdaahp3UNv1LW20i ps55UslOtXjHiznNQr5nyhmnkH0TLxn12NGEV0BnOmb70Ml2klfFLXTw73cp/mxM2eOZX5ho+f8v TuqwzxbJ+WAoFHzMJfevy9SEdovoE1TeBhc+IgZQR3zCkMt00bsKvKD0SmgNKiSmkHr+WbJCjCq7 tlkydEDuGjuSfbNzIcS0qLpqIHaSh/3WmF7TWzBJ8Ln1HwrvuMZ3Txksjsmpt34GFSubX+CGrYyW ORNGomSiW66FqRvj0iaYYbNTIfnU7/iJy3CN8Z5SvVroNAQbRfoooT/loWsoiUUNmTR9kebvLzGC Am0wggJpAgEBMGswWzELMAkGA1UEBhMCQkUxGTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExMTAv BgNVBAMTKEdsb2JhbFNpZ24gR0NDIFIzIFBlcnNvbmFsU2lnbiAyIENBIDIwMjACDCHWmFjgp1UN rBuhLTANBglghkgBZQMEAgEFAKCB1DAvBgkqhkiG9w0BCQQxIgQg+C3Ga0I10J4QPPCsoe8YhfhO ksQS08cKG2TNrws/v08wGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcN MjEwNzA4MTY1MzM4WjBpBgkqhkiG9w0BCQ8xXDBaMAsGCWCGSAFlAwQBKjALBglghkgBZQMEARYw CwYJYIZIAWUDBAECMAoGCCqGSIb3DQMHMAsGCSqGSIb3DQEBCjALBgkqhkiG9w0BAQcwCwYJYIZI AWUDBAIBMA0GCSqGSIb3DQEBAQUABIIBAHNo4QUTVRmBcyc2qr+HOuajOpFrrKSvsfL5+275f7Px DrlCr5HWHEMVS4z2p/+mcE6UVQZ1gcn+fOT0BVo+Sn4Irexyc1bmLMWOjTli5Zm4BjpOSsudmH6y agi9nfUzbo9YH/9Ci3hOMYs7GEkeKR1kZa4pIKyRW992mDKcSRM32HdiCvZKEq8Hx7h2kTsiI0OR hbEFP9ivQU6dvopfbP3+qn+aZWtERt6QSQjXNgN/3RXWpJid2S/BjRBy6ojc6ky99yU6epRBSSsG fEXqFpBBxsXhEhBkPNe8Bb6W0/Q9EMHCoa6JhOTd0QJO4it3tQXmcKInm5ElxhhgJPhRrpA= --00000000000024a23405c69f7f70-- From owner-dev-commits-src-main@freebsd.org Thu Jul 8 18:25:33 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5A3C9651C1C; Thu, 8 Jul 2021 18:25:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GLPqK1wPXz4ZcB; Thu, 8 Jul 2021 18:25:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 269F625D8B; Thu, 8 Jul 2021 18:25:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 168IPX1r040625; Thu, 8 Jul 2021 18:25:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 168IPXki040624; Thu, 8 Jul 2021 18:25:33 GMT (envelope-from git) Date: Thu, 8 Jul 2021 18:25:33 GMT Message-Id: <202107081825.168IPXki040624@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 34641052826c - main - pf: pf_killstates() never fails, so remove the return value MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 34641052826c718566b994b75cd2bddb53a21583 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jul 2021 18:25:33 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=34641052826c718566b994b75cd2bddb53a21583 commit 34641052826c718566b994b75cd2bddb53a21583 Author: Kristof Provost AuthorDate: 2021-07-08 08:54:16 +0000 Commit: Kristof Provost CommitDate: 2021-07-08 16:56:29 +0000 pf: pf_killstates() never fails, so remove the return value Suggested by: mjg MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/netpfil/pf/pf_ioctl.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index fece41e917e5..33eb0e15ea57 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -201,7 +201,7 @@ struct cdev *pf_dev; */ static void pf_clear_all_states(void); static unsigned int pf_clear_states(const struct pf_kstate_kill *); -static int pf_killstates(struct pf_kstate_kill *, +static void pf_killstates(struct pf_kstate_kill *, unsigned int *); static int pf_killstates_row(struct pf_kstate_kill *, struct pf_idhash *); @@ -2779,7 +2779,7 @@ DIOCCHANGERULE_error: break; psk->psk_killed = 0; - error = pf_killstates(&kill, &psk->psk_killed); + pf_killstates(&kill, &psk->psk_killed); break; } @@ -4834,7 +4834,7 @@ relock_DIOCCLRSTATES: return (killed); } -static int +static void pf_killstates(struct pf_kstate_kill *kill, unsigned int *killed) { struct pf_kstate *s; @@ -4847,13 +4847,13 @@ pf_killstates(struct pf_kstate_kill *kill, unsigned int *killed) pf_unlink_state(s, PF_ENTER_LOCKED); *killed = 1; } - return (0); + return; } for (unsigned int i = 0; i <= pf_hashmask; i++) *killed += pf_killstates_row(kill, &V_pf_idhash[i]); - return (0); + return; } static int @@ -4886,9 +4886,7 @@ pf_killstates_nv(struct pfioc_nv *nv) if (error) ERROUT(error); - error = pf_killstates(&kill, &killed); - if (error) - ERROUT(error); + pf_killstates(&kill, &killed); free(nvlpacked, M_NVLIST); nvlpacked = NULL; From owner-dev-commits-src-main@freebsd.org Thu Jul 8 18:25:34 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 71D29651C89; Thu, 8 Jul 2021 18:25:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GLPqL2Y2sz4ZrX; Thu, 8 Jul 2021 18:25:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 40C7225E9F; Thu, 8 Jul 2021 18:25:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 168IPYFQ040649; Thu, 8 Jul 2021 18:25:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 168IPYLo040648; Thu, 8 Jul 2021 18:25:34 GMT (envelope-from git) Date: Thu, 8 Jul 2021 18:25:34 GMT Message-Id: <202107081825.168IPYLo040648@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: c5dd8bac0b96 - main - dummynet: reduce console spam MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c5dd8bac0b96e11da02181bd1dbee677e270842d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jul 2021 18:25:34 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=c5dd8bac0b96e11da02181bd1dbee677e270842d commit c5dd8bac0b96e11da02181bd1dbee677e270842d Author: Luiz Otavio O Souza AuthorDate: 2016-02-11 13:35:01 +0000 Commit: Kristof Provost CommitDate: 2021-07-08 18:25:05 +0000 dummynet: reduce console spam Only print this warning when boot verbose is enabled. This can get pretty annoying (and useless) in some systems. Reviewed by: kp MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/netpfil/ipfw/ip_dummynet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/netpfil/ipfw/ip_dummynet.c b/sys/netpfil/ipfw/ip_dummynet.c index 56fa56138d96..d3242fd85817 100644 --- a/sys/netpfil/ipfw/ip_dummynet.c +++ b/sys/netpfil/ipfw/ip_dummynet.c @@ -169,7 +169,7 @@ ipdn_bound_var(int *v, int dflt, int lo, int hi, const char *msg) op = "Clamp"; } else return *v; - if (op && msg) + if (op && msg && bootverbose) printf("%s %s to %d (was %d)\n", op, msg, *v, oldv); return *v; } From owner-dev-commits-src-main@freebsd.org Thu Jul 8 20:20:28 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CCD21653403; Thu, 8 Jul 2021 20:20:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GLSMw4Wrfz4mjR; Thu, 8 Jul 2021 20:20:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7B474271E7; Thu, 8 Jul 2021 20:20:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 168KKSni096403; Thu, 8 Jul 2021 20:20:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 168KKSWj096402; Thu, 8 Jul 2021 20:20:28 GMT (envelope-from git) Date: Thu, 8 Jul 2021 20:20:28 GMT Message-Id: <202107082020.168KKSWj096402@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: bf3a385217ce - main - fan53555: attach to build and switch from syr827 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bf3a385217ce4ea96f08559692dd55ec9431a628 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jul 2021 20:20:28 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=bf3a385217ce4ea96f08559692dd55ec9431a628 commit bf3a385217ce4ea96f08559692dd55ec9431a628 Author: Bjoern A. Zeeb AuthorDate: 2021-07-08 17:25:31 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-08 20:17:45 +0000 fan53555: attach to build and switch from syr827 Rather than extending syr827 for syr828 (as initially done in D31103) switch to the Fairchild Semiconductor Corporation fan53555 implementation which is in-tree but was not attached to the build. The fan53555 implementation also supports syr827/syr8278 already. [1] Update NOTES and the arm64 GENERIC configuration for the switch. syr827 for now stays in the tree but is not used by any kernel configuration. Suggested by: mmel [1] Reviewed by: mmel, manu Differential Revision: https://reviews.freebsd.org/D31112 --- sys/arm64/conf/GENERIC | 2 +- sys/conf/NOTES | 2 +- sys/conf/files | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/arm64/conf/GENERIC b/sys/arm64/conf/GENERIC index 473578f8fbe1..f92a78f8e802 100644 --- a/sys/arm64/conf/GENERIC +++ b/sys/arm64/conf/GENERIC @@ -198,10 +198,10 @@ device iicmux device iic device icee # Generic IIC eeprom device twsi # Allwinner I2C controller +device fan53555 # Fairchild Semi FAN53555/SYR82x Regulator device pca9547 # NPX I2C bus multiplexer device pcf8563 # NXP Real-time clock/calendar device rk_i2c # RockChip I2C controller -device syr827 # Silergy SYR827 PMIC device sy8106a # SY8106A Buck Regulator device vf_i2c # Freescale Vybrid I2C controller device fsliic # Freescale iMX I2C controller diff --git a/sys/conf/NOTES b/sys/conf/NOTES index d7972c4a7e7a..a13882facce2 100644 --- a/sys/conf/NOTES +++ b/sys/conf/NOTES @@ -2265,6 +2265,7 @@ device ds1307 # Dallas DS1307 RTC and compatible device ds13rtc # All Dallas/Maxim ds13xx chips device ds1672 # Dallas DS1672 RTC device ds3231 # Dallas DS3231 RTC + temperature +device fan53555 # Fairchild Semi FAN53555/SYR82x Regulator device icee # AT24Cxxx and compatible EEPROMs device isl12xx # Intersil ISL12xx RTC device lm75 # LM75 compatible temperature sensor @@ -2272,7 +2273,6 @@ device nxprtc # NXP RTCs: PCA/PFC212x PCA/PCF85xx device rtc8583 # Epson RTC-8583 device s35390a # Seiko Instruments S-35390A RTC device sy8106a # Silergy Corp. SY8106A buck regulator -device syr827 # Silergy Corp. DC/DC regulator # Parallel-Port Bus # diff --git a/sys/conf/files b/sys/conf/files index 94f4e92bb25c..22cf4db11695 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1881,6 +1881,7 @@ dev/iicbus/s35390a.c optional s35390a dev/iicbus/sy8106a.c optional sy8106a ext_resources fdt dev/iicbus/syr827.c optional syr827 ext_resources fdt dev/iicbus/gpio/tca6416.c optional tca6416 fdt +dev/iicbus/pmic/fan53555.c optional fan53555 ext_resources fdt dev/iir/iir.c optional iir dev/iir/iir_ctrl.c optional iir dev/iir/iir_pci.c optional iir pci From owner-dev-commits-src-main@freebsd.org Thu Jul 8 21:27:26 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 63421653D7E; Thu, 8 Jul 2021 21:27:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GLTsB2PjGz3CsR; Thu, 8 Jul 2021 21:27:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3C2794C6; Thu, 8 Jul 2021 21:27:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 168LRQ4m081655; Thu, 8 Jul 2021 21:27:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 168LRQVb081654; Thu, 8 Jul 2021 21:27:26 GMT (envelope-from git) Date: Thu, 8 Jul 2021 21:27:26 GMT Message-Id: <202107082127.168LRQVb081654@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: b29ebb9c65b3 - main - devmatch: Be tolerant of .ko being present. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b29ebb9c65b350e78aedfc790bfcaf9717059b70 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jul 2021 21:27:26 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=b29ebb9c65b350e78aedfc790bfcaf9717059b70 commit b29ebb9c65b350e78aedfc790bfcaf9717059b70 Author: Warner Losh AuthorDate: 2021-07-08 19:44:21 +0000 Commit: Warner Losh CommitDate: 2021-07-08 21:22:22 +0000 devmatch: Be tolerant of .ko being present. We document that we did not need .ko on the module names in devmatch_blocklist, but we really needed them. Keep the documentation the same, but strip the .ko when we need to use the names so you can specify either. PR: 256240 MFC After: 2 weeks Sponsored by: Netflix --- libexec/rc/rc.d/devmatch | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/libexec/rc/rc.d/devmatch b/libexec/rc/rc.d/devmatch index dd61307a4e0a..f7f677b968e7 100755 --- a/libexec/rc/rc.d/devmatch +++ b/libexec/rc/rc.d/devmatch @@ -52,18 +52,23 @@ devmatch_start() [ -n "$list" ] || return - # While kldload can accept multiple modules - # on the line at once, we loop here in case - # there's some weird error with one of them. - # We also optimize against the false positives - # or drivers that have symbolic links that - # confuse devmatch by running it -n. - # Finally, we filter out all items in the - # devmatch_blocklist. + # While kldload can accept multiple modules on the line at once, we loop + # here in case there's some weird error with one of them. We also + # optimize against the false positives or drivers that have symbolic + # links that confuse devmatch by running it -n. Finally, we filter out + # all items in the devmatch_blocklist. + # + # We strip all the .ko suffixes off so that one may specify modules + # with or without .ko. Prior version documented it was without, while + # the code required it, so accept both now. devmatch produces module + # names with .ko + devctl freeze - x=$(echo ${devmatch_blocklist:-${devmatch_blacklist}} | tr ' ' '#') + x=$(echo '#'${devmatch_blocklist:-${devmatch_blacklist}}'#' | \ + sed -e "s/ /#/g;s/\.ko#/#/g") for m in ${list}; do - case "#${x}#" in + m="${m%.ko}" + case "${x}" in *"#${m}#"*) continue ;; esac echo "Autoloading module: ${m}" From owner-dev-commits-src-main@freebsd.org Thu Jul 8 21:27:27 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A7169653F21; Thu, 8 Jul 2021 21:27:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GLTsC3nsXz3DCR; Thu, 8 Jul 2021 21:27:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 66909531; Thu, 8 Jul 2021 21:27:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 168LRRUM081679; Thu, 8 Jul 2021 21:27:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 168LRRtm081678; Thu, 8 Jul 2021 21:27:27 GMT (envelope-from git) Date: Thu, 8 Jul 2021 21:27:27 GMT Message-Id: <202107082127.168LRRtm081678@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 5549c6a62f0f - main - devmatch: don't announce autoloading so much MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5549c6a62f0f4fc5d7e80973b28ebcf7f556edf8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jul 2021 21:27:27 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=5549c6a62f0f4fc5d7e80973b28ebcf7f556edf8 commit 5549c6a62f0f4fc5d7e80973b28ebcf7f556edf8 Author: Warner Losh AuthorDate: 2021-07-08 19:53:18 +0000 Commit: Warner Losh CommitDate: 2021-07-08 21:22:22 +0000 devmatch: don't announce autoloading so much devmatch rc script would announce it was loading a module multiple times. It used kldload -n so it really wasn't loading it that many times, but the message is confusing. Use kldstat to see if we need to load the module before saying we do. This fixes the vast majority of the problems. It may be possible to race devmatch with a user invocation and devd, though quite hard. In that case we'll announce things twice, but still only load it once. No attempt is made to fix this. PR: 232782 MFC After: 2 weeks Sponsored by: Netflix --- libexec/rc/rc.d/devmatch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libexec/rc/rc.d/devmatch b/libexec/rc/rc.d/devmatch index f7f677b968e7..f5b8e8e51071 100755 --- a/libexec/rc/rc.d/devmatch +++ b/libexec/rc/rc.d/devmatch @@ -71,8 +71,8 @@ devmatch_start() case "${x}" in *"#${m}#"*) continue ;; esac - echo "Autoloading module: ${m}" - kldload -n ${m} + kldstat -q -n ${m} || \ + (echo "Autoloading module: ${m}"; kldload -n ${m}) done devctl thaw } From owner-dev-commits-src-main@freebsd.org Thu Jul 8 23:58:21 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4E037655F06; Thu, 8 Jul 2021 23:58:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GLYCK1prlz3v0p; Thu, 8 Jul 2021 23:58:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 222AB1EE6; Thu, 8 Jul 2021 23:58:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 168NwLq1081373; Thu, 8 Jul 2021 23:58:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 168NwKGa081372; Thu, 8 Jul 2021 23:58:20 GMT (envelope-from git) Date: Thu, 8 Jul 2021 23:58:20 GMT Message-Id: <202107082358.168NwKGa081372@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 25a66f1fb177 - main - nanobsd: remove sparc64 embedded example MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 25a66f1fb177e0f3628f92f73b6ecf48a305d230 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jul 2021 23:58:21 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=25a66f1fb177e0f3628f92f73b6ecf48a305d230 commit 25a66f1fb177e0f3628f92f73b6ecf48a305d230 Author: Warner Losh AuthorDate: 2021-07-08 23:55:20 +0000 Commit: Warner Losh CommitDate: 2021-07-08 23:56:54 +0000 nanobsd: remove sparc64 embedded example Remove the qemu sparc64 example. It was only ever compile tested since qemu had issues booting FreeBSD/sparc64. Also remove obsolete info about armv5 configs removed long ago. Sponsored by: Netflix --- tools/tools/nanobsd/embedded/README | 9 ------- tools/tools/nanobsd/embedded/qemu-sparc64.cfg | 36 --------------------------- 2 files changed, 45 deletions(-) diff --git a/tools/tools/nanobsd/embedded/README b/tools/tools/nanobsd/embedded/README index 78f6c31b2c6d..b77d3302d861 100644 --- a/tools/tools/nanobsd/embedded/README +++ b/tools/tools/nanobsd/embedded/README @@ -31,17 +31,8 @@ qemu-powerpc.cfg Create a bootable 32-bit powerpc image for qemu qemu-powerpc64.cfg Create a bootable 64-bit IBM-flavor image for qemu -qemu-sparc64.cfg Create a bootable sparc64 image for qemu rpi.cfg Create a bootable image for Raspberry Pi B rpi2.cfg Create a bootable image for Raspberry Pi2 -sam9260ek.cfg Create a bootable image for an Atmel SAM9260-EK - evaluation board (still needs a kernel loaded - into dataflash or NAND, so experimental). -sam9g20ek.cfg Create a bootable image for an Atmel SAM9G20-EK - evaluation board (still needs a kernel loaded - into dataflash or NAND, so experimental). Also - works on many after-market boards that are somewhat - compatible with the references board. QEMU command lines for serial console access diff --git a/tools/tools/nanobsd/embedded/qemu-sparc64.cfg b/tools/tools/nanobsd/embedded/qemu-sparc64.cfg deleted file mode 100644 index 9a63c9b42d55..000000000000 --- a/tools/tools/nanobsd/embedded/qemu-sparc64.cfg +++ /dev/null @@ -1,36 +0,0 @@ -# $FreeBSD$ - -#- -# Copyright (c) 2015 M. Warner Losh -# Copyright (c) 2010-2011 iXsystems, Inc. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL iXsystems, Inc. OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# - -NANO_ARCH=sparc64 -NANO_KERNEL=GENERIC -NANO_DRIVE=ada0 -NANO_NAME=qemu-sparc64 - -. common # Pull in common definitions - -qemu_env From owner-dev-commits-src-main@freebsd.org Fri Jul 9 00:44:00 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C40A4656A88; Fri, 9 Jul 2021 00:44:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GLZD04k2rz4V9K; Fri, 9 Jul 2021 00:44:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8A23529D9; Fri, 9 Jul 2021 00:44:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1690i0Gq047696; Fri, 9 Jul 2021 00:44:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1690i00x047695; Fri, 9 Jul 2021 00:44:00 GMT (envelope-from git) Date: Fri, 9 Jul 2021 00:44:00 GMT Message-Id: <202107090044.1690i00x047695@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: 1e0a518d6548 - main - nfscl: Add a Linux compatible "nconnect" mount option MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1e0a518d65488caafff89a4ecba9cfb2be233379 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jul 2021 00:44:00 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=1e0a518d65488caafff89a4ecba9cfb2be233379 commit 1e0a518d65488caafff89a4ecba9cfb2be233379 Author: Rick Macklem AuthorDate: 2021-07-09 00:39:04 +0000 Commit: Rick Macklem CommitDate: 2021-07-09 00:39:04 +0000 nfscl: Add a Linux compatible "nconnect" mount option Linux has had an "nconnect" NFS mount option for some time. It specifies that N (up to 16) TCP connections are to created for a mount, instead of just one TCP connection. A discussion on freebsd-net@ indicated that this could improve client<-->server network bandwidth, if either the client or server have one of the following: - multiple network ports aggregated to-gether with lagg/lacp. - a fast NIC that is using multiple queues It does result in using more IP port#s and might increase server peak load for a client. One difference from the Linux implementation is that this implementation uses the first TCP connection for all RPCs composed of small messages and uses the additional TCP connections for RPCs that normally have large messages (Read/Readdir/Write). The Linux implementation spreads all RPCs across all TCP connections in a round robin fashion, whereas this implementation spreads Read/Readdir/Write across the additional TCP connections in a round robin fashion. Reviewed by: markj MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D30970 --- sys/fs/nfs/nfs_commonkrpc.c | 70 ++++++++++++++++++++++++++++++++++------ sys/fs/nfs/nfs_commonsubs.c | 5 +-- sys/fs/nfs/nfs_var.h | 4 +-- sys/fs/nfsclient/nfs_clrpcops.c | 8 ++--- sys/fs/nfsclient/nfs_clvfsops.c | 66 ++++++++++++++++++++++++++++++------- sys/fs/nfsclient/nfsmount.h | 8 +++++ sys/fs/nfsserver/nfs_nfsdstate.c | 6 ++-- 7 files changed, 134 insertions(+), 33 deletions(-) diff --git a/sys/fs/nfs/nfs_commonkrpc.c b/sys/fs/nfs/nfs_commonkrpc.c index 63ff02331a0e..423ddb52494f 100644 --- a/sys/fs/nfs/nfs_commonkrpc.c +++ b/sys/fs/nfs/nfs_commonkrpc.c @@ -167,7 +167,8 @@ static int nfsv2_procid[NFS_V3NPROCS] = { */ int newnfs_connect(struct nfsmount *nmp, struct nfssockreq *nrp, - struct ucred *cred, NFSPROC_T *p, int callback_retry_mult, bool dotls) + struct ucred *cred, NFSPROC_T *p, int callback_retry_mult, bool dotls, + struct __rpc_client **clipp) { int rcvreserve, sndreserve; int pktscale, pktscalesav; @@ -420,15 +421,22 @@ newnfs_connect(struct nfsmount *nmp, struct nfssockreq *nrp, CLNT_CONTROL(client, CLSET_RETRY_TIMEOUT, &timo); } + /* + * *clipp is &nrp->nr_client or &nm_aconn[nmp->nm_nextaconn]. + * The latter case is for additional connections specified by the + * "nconnect" mount option. nr_mtx etc is used for these additional + * connections, as well as nr_client in the nfssockreq + * structure for the mount. + */ mtx_lock(&nrp->nr_mtx); - if (nrp->nr_client != NULL) { + if (*clipp != NULL) { mtx_unlock(&nrp->nr_mtx); /* * Someone else already connected. */ CLNT_RELEASE(client); } else { - nrp->nr_client = client; + *clipp = client; /* * Protocols that do not require connections may be optionally * left unconnected for servers that reply from a port other @@ -453,18 +461,34 @@ out: * NFS disconnect. Clean up and unlink. */ void -newnfs_disconnect(struct nfssockreq *nrp) +newnfs_disconnect(struct nfsmount *nmp, struct nfssockreq *nrp) { - CLIENT *client; + CLIENT *client, *aconn[NFS_MAXNCONN - 1]; + int i; mtx_lock(&nrp->nr_mtx); if (nrp->nr_client != NULL) { client = nrp->nr_client; nrp->nr_client = NULL; + if (nmp != NULL && nmp->nm_aconnect > 0) { + for (i = 0; i < nmp->nm_aconnect; i++) { + aconn[i] = nmp->nm_aconn[i]; + nmp->nm_aconn[i] = NULL; + } + } mtx_unlock(&nrp->nr_mtx); rpc_gss_secpurge_call(client); CLNT_CLOSE(client); CLNT_RELEASE(client); + if (nmp != NULL && nmp->nm_aconnect > 0) { + for (i = 0; i < nmp->nm_aconnect; i++) { + if (aconn[i] != NULL) { + rpc_gss_secpurge_call(aconn[i]); + CLNT_CLOSE(aconn[i]); + CLNT_RELEASE(aconn[i]); + } + } + } } else { mtx_unlock(&nrp->nr_mtx); } @@ -565,7 +589,7 @@ newnfs_request(struct nfsrv_descript *nd, struct nfsmount *nmp, int error = 0, usegssname = 0, secflavour = AUTH_SYS; int freeslot, maxslot, reterr, slotpos, timeo; u_int16_t procnum; - u_int trylater_delay = 1; + u_int nextconn, trylater_delay = 1; struct nfs_feedback_arg nf; struct timeval timo; AUTH *auth; @@ -577,6 +601,7 @@ newnfs_request(struct nfsrv_descript *nd, struct nfsmount *nmp, struct ucred *authcred; struct nfsclsession *sep; uint8_t sessionid[NFSX_V4SESSIONID]; + bool nextconn_set; sep = dssep; if (xidp != NULL) @@ -602,12 +627,24 @@ newnfs_request(struct nfsrv_descript *nd, struct nfsmount *nmp, } /* - * XXX if not already connected call nfs_connect now. Longer - * term, change nfs_mount to call nfs_connect unconditionally - * and let clnt_reconnect_create handle reconnects. + * If not already connected call newnfs_connect now. */ if (nrp->nr_client == NULL) - newnfs_connect(nmp, nrp, cred, td, 0, false); + newnfs_connect(nmp, nrp, cred, td, 0, false, &nrp->nr_client); + + nextconn_set = false; + if (nmp != NULL && nmp->nm_aconnect > 0 && + (nd->nd_procnum == NFSPROC_READ || + nd->nd_procnum == NFSPROC_READDIR || + nd->nd_procnum == NFSPROC_READDIRPLUS || + nd->nd_procnum == NFSPROC_WRITE)) { + nextconn = atomic_fetchadd_int(&nmp->nm_nextaconn, 1); + nextconn %= nmp->nm_aconnect; + nextconn_set = true; + if (nmp->nm_aconn[nextconn] == NULL) + newnfs_connect(nmp, nrp, cred, td, 0, false, + &nmp->nm_aconn[nextconn]); + } /* * For a client side mount, nmp is != NULL and clp == NULL. For @@ -830,6 +867,19 @@ tryagain: if (clp != NULL && sep != NULL) stat = clnt_bck_call(nrp->nr_client, &ext, procnum, nd->nd_mreq, &nd->nd_mrep, timo, sep->nfsess_xprt); + else if (nextconn_set) + /* + * When there are multiple TCP connections, send the + * RPCs with large messages on the alternate TCP + * connection(s) in a round robin fashion. + * The small RPC messages are sent on the default + * TCP connection because they do not require much + * network bandwidth and separating them from the + * large RPC messages avoids them getting "log jammed" + * behind several large RPC messages. + */ + stat = CLNT_CALL_MBUF(nmp->nm_aconn[nextconn], + &ext, procnum, nd->nd_mreq, &nd->nd_mrep, timo); else stat = CLNT_CALL_MBUF(nrp->nr_client, &ext, procnum, nd->nd_mreq, &nd->nd_mrep, timo); diff --git a/sys/fs/nfs/nfs_commonsubs.c b/sys/fs/nfs/nfs_commonsubs.c index 02416da54f01..1bdc13123aac 100644 --- a/sys/fs/nfs/nfs_commonsubs.c +++ b/sys/fs/nfs/nfs_commonsubs.c @@ -3624,7 +3624,8 @@ nfsrv_nfsuserdport(struct nfsuserd_args *nargs, NFSPROC_T *p) } rp->nr_vers = RPCNFSUSERD_VERS; if (error == 0) - error = newnfs_connect(NULL, rp, NFSPROCCRED(p), p, 0, false); + error = newnfs_connect(NULL, rp, NFSPROCCRED(p), p, 0, false, + &rp->nr_client); if (error == 0) { NFSLOCKNAMEID(); nfsrv_nfsuserd = RUNNING; @@ -3658,7 +3659,7 @@ nfsrv_nfsuserddelport(void) msleep(&nfsrv_userdupcalls, NFSNAMEIDMUTEXPTR, PVFS, "nfsupcalls", 0); NFSUNLOCKNAMEID(); - newnfs_disconnect(&nfsrv_nfsuserdsock); + newnfs_disconnect(NULL, &nfsrv_nfsuserdsock); free(nfsrv_nfsuserdsock.nr_nam, M_SONAME); NFSLOCKNAMEID(); nfsrv_nfsuserd = NOTRUNNING; diff --git a/sys/fs/nfs/nfs_var.h b/sys/fs/nfs/nfs_var.h index 5c474d97ad04..9cbaeae361a6 100644 --- a/sys/fs/nfs/nfs_var.h +++ b/sys/fs/nfs/nfs_var.h @@ -772,8 +772,8 @@ int newnfs_request(struct nfsrv_descript *, struct nfsmount *, struct ucred *, u_int32_t, u_int32_t, u_char *, int, u_int64_t *, struct nfsclsession *); int newnfs_connect(struct nfsmount *, struct nfssockreq *, - struct ucred *, NFSPROC_T *, int, bool); -void newnfs_disconnect(struct nfssockreq *); + struct ucred *, NFSPROC_T *, int, bool, struct __rpc_client **); +void newnfs_disconnect(struct nfsmount *, struct nfssockreq *); int newnfs_sigintr(struct nfsmount *, NFSPROC_T *); /* nfs_nfsdkrpc.c */ diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c index 128afb33b9ef..213399551097 100644 --- a/sys/fs/nfsclient/nfs_clrpcops.c +++ b/sys/fs/nfsclient/nfs_clrpcops.c @@ -5610,7 +5610,7 @@ nfsrpc_fillsa(struct nfsmount *nmp, struct sockaddr_in *sin, * unmount, but I did it anyhow. */ nrp->nr_cred = crhold(nmp->nm_sockreq.nr_cred); - error = newnfs_connect(nmp, nrp, NULL, p, 0, false); + error = newnfs_connect(nmp, nrp, NULL, p, 0, false, &nrp->nr_client); NFSCL_DEBUG(3, "DS connect=%d\n", error); dsp = NULL; @@ -5628,7 +5628,7 @@ nfsrpc_fillsa(struct nfsmount *nmp, struct sockaddr_in *sin, } while (error == NFSERR_MINORVERMISMATCH && firsttry++ == 0); if (error != 0) - newnfs_disconnect(nrp); + newnfs_disconnect(NULL, nrp); } else { dsp = malloc(sizeof(struct nfsclds), M_NFSCLDS, M_WAITOK | M_ZERO); @@ -5656,7 +5656,7 @@ nfsrpc_fillsa(struct nfsmount *nmp, struct sockaddr_in *sin, * If there is already a session for this * server, use it. */ - (void)newnfs_disconnect(nrp); + newnfs_disconnect(NULL, nrp); nfscl_freenfsclds(dsp); *dspp = tdsp; return (0); @@ -5688,7 +5688,7 @@ nfsrpc_fillsa(struct nfsmount *nmp, struct sockaddr_in *sin, NFSUNLOCKMNT(nmp); *dspp = dsp; } else if (dsp != NULL) { - newnfs_disconnect(nrp); + newnfs_disconnect(NULL, nrp); nfscl_freenfsclds(dsp); } return (error); diff --git a/sys/fs/nfsclient/nfs_clvfsops.c b/sys/fs/nfsclient/nfs_clvfsops.c index 931f37d4ef67..57eae3f1f1cf 100644 --- a/sys/fs/nfsclient/nfs_clvfsops.c +++ b/sys/fs/nfsclient/nfs_clvfsops.c @@ -118,7 +118,7 @@ static void nfs_decode_args(struct mount *mp, struct nfsmount *nmp, static int mountnfs(struct nfs_args *, struct mount *, struct sockaddr *, char *, u_char *, int, u_char *, int, u_char *, int, struct vnode **, struct ucred *, - struct thread *, int, int, int, uint32_t, char *); + struct thread *, int, int, int, uint32_t, char *, int); static void nfs_getnlminfo(struct vnode *, uint8_t *, size_t *, struct sockaddr_storage *, int *, off_t *, struct timeval *); @@ -548,7 +548,7 @@ nfs_mountdiskless(char *path, nam = sodupsockaddr((struct sockaddr *)sin, M_WAITOK); if ((error = mountnfs(args, mp, nam, path, NULL, 0, dirpath, dirlen, NULL, 0, vpp, td->td_ucred, td, NFS_DEFAULT_NAMETIMEO, - NFS_DEFAULT_NEGNAMETIMEO, 0, 0, NULL)) != 0) { + NFS_DEFAULT_NEGNAMETIMEO, 0, 0, NULL, 0)) != 0) { printf("nfs_mountroot: mount %s on /: %d\n", path, error); return (error); } @@ -715,14 +715,14 @@ nfs_decode_args(struct mount *mp, struct nfsmount *nmp, struct nfs_args *argp, haslock = 1; } if (!error) { - newnfs_disconnect(&nmp->nm_sockreq); + newnfs_disconnect(nmp, &nmp->nm_sockreq); if (haslock) newnfs_sndunlock(&nmp->nm_sockreq.nr_lock); nmp->nm_sotype = argp->sotype; nmp->nm_soproto = argp->proto; if (nmp->nm_sotype == SOCK_DGRAM) while (newnfs_connect(nmp, &nmp->nm_sockreq, - cred, td, 0, false)) { + cred, td, 0, false, &nmp->nm_sockreq.nr_client)) { printf("newnfs_args: retrying connect\n"); (void) nfs_catnap(PSOCK, 0, "nfscon"); } @@ -750,7 +750,7 @@ static const char *nfs_opts[] = { "from", "nfs_args", "resvport", "readahead", "hostname", "timeo", "timeout", "addr", "fh", "nfsv3", "sec", "principal", "nfsv4", "gssname", "allgssname", "dirpath", "minorversion", "nametimeo", "negnametimeo", "nocto", "noncontigwr", - "pnfs", "wcommitsize", "oneopenown", "tls", "tlscertname", + "pnfs", "wcommitsize", "oneopenown", "tls", "tlscertname", "nconnect", NULL }; /* @@ -902,6 +902,7 @@ nfs_mount(struct mount *mp) krbnamelen, srvkrbnamelen; size_t hstlen; uint32_t newflag; + int aconn = 0; has_nfs_args_opt = 0; has_nfs_from_opt = 0; @@ -1192,6 +1193,20 @@ nfs_mount(struct mount *mp) goto out; } } + if (vfs_getopt(mp->mnt_optnew, "nconnect", (void **)&opt, NULL) == + 0) { + ret = sscanf(opt, "%d", &aconn); + if (ret != 1 || aconn < 1 || aconn > NFS_MAXNCONN) { + vfs_mount_error(mp, "illegal nconnect: %s", opt); + error = EINVAL; + goto out; + } + /* + * Setting nconnect=1 is a no-op, allowed so that + * the option can be used in a Linux compatible way. + */ + aconn--; + } if (vfs_getopt(mp->mnt_optnew, "sec", (void **) &secname, NULL) == 0) nfs_sec_name(secname, &args.flags); @@ -1359,10 +1374,25 @@ nfs_mount(struct mount *mp) } } + if (aconn > 0 && (args.sotype != SOCK_STREAM || + (args.flags & NFSMNT_NFSV4) == 0 || minvers == 0)) { + /* + * RFC 5661 requires that an NFSv4.1/4.2 server + * send an RPC reply on the same TCP connection + * as the one it received the request on. + * This property in required for "nconnect" and + * might not be the case for NFSv3 or NFSv4.0 servers. + */ + vfs_mount_error(mp, "nconnect should only be used " + "for NFSv4.1/4.2 mounts"); + error = EINVAL; + goto out; + } + args.fh = nfh; error = mountnfs(&args, mp, nam, hst, krbname, krbnamelen, dirpath, dirlen, srvkrbname, srvkrbnamelen, &vp, td->td_ucred, td, - nametimeo, negnametimeo, minvers, newflag, tlscertname); + nametimeo, negnametimeo, minvers, newflag, tlscertname, aconn); out: if (!error) { MNT_ILOCK(mp); @@ -1410,7 +1440,7 @@ mountnfs(struct nfs_args *argp, struct mount *mp, struct sockaddr *nam, char *hst, u_char *krbname, int krbnamelen, u_char *dirpath, int dirlen, u_char *srvkrbname, int srvkrbnamelen, struct vnode **vpp, struct ucred *cred, struct thread *td, int nametimeo, int negnametimeo, - int minvers, uint32_t newflag, char *tlscertname) + int minvers, uint32_t newflag, char *tlscertname, int aconn) { struct nfsmount *nmp; struct nfsnode *np; @@ -1577,7 +1607,8 @@ mountnfs(struct nfs_args *argp, struct mount *mp, struct sockaddr *nam, else nmp->nm_sockreq.nr_vers = NFS_VER2; - if ((error = newnfs_connect(nmp, &nmp->nm_sockreq, cred, td, 0, false))) + if ((error = newnfs_connect(nmp, &nmp->nm_sockreq, cred, td, 0, false, + &nmp->nm_sockreq.nr_client))) goto bad; /* For NFSv4, get the clientid now. */ if ((argp->flags & NFSMNT_NFSV4) != 0) { @@ -1586,6 +1617,12 @@ mountnfs(struct nfs_args *argp, struct mount *mp, struct sockaddr *nam, NFSCL_DEBUG(3, "aft getcl=%d\n", error); if (error != 0) goto bad; + if (aconn > 0 && nmp->nm_minorvers == 0) { + vfs_mount_error(mp, "nconnect should only be used " + "for NFSv4.1/4.2 mounts"); + error = EINVAL; + goto bad; + } } if (nmp->nm_fhsize == 0 && (nmp->nm_flag & NFSMNT_NFSV4) && @@ -1680,6 +1717,10 @@ mountnfs(struct nfs_args *argp, struct mount *mp, struct sockaddr *nam, MNT_IUNLOCK(mp); } + /* Can now allow additional connections. */ + if (aconn > 0) + nmp->nm_aconnect = aconn; + /* * Lose the lock but keep the ref. */ @@ -1692,7 +1733,7 @@ mountnfs(struct nfs_args *argp, struct mount *mp, struct sockaddr *nam, bad: if (clp != NULL) nfscl_clientrelease(clp); - newnfs_disconnect(&nmp->nm_sockreq); + newnfs_disconnect(NULL, &nmp->nm_sockreq); crfree(nmp->nm_sockreq.nr_cred); if (nmp->nm_sockreq.nr_auth != NULL) AUTH_DESTROY(nmp->nm_sockreq.nr_auth); @@ -1707,7 +1748,7 @@ bad: TAILQ_FOREACH_SAFE(dsp, &nmp->nm_sess, nfsclds_list, tdsp) { if (dsp != TAILQ_FIRST(&nmp->nm_sess) && dsp->nfsclds_sockp != NULL) - newnfs_disconnect(dsp->nfsclds_sockp); + newnfs_disconnect(NULL, dsp->nfsclds_sockp); nfscl_freenfsclds(dsp); } free(nmp->nm_tlscertname, M_NEWNFSMNT); @@ -1793,7 +1834,7 @@ nfs_unmount(struct mount *mp, int mntflags) msleep(nmp, &nmp->nm_mtx, PVFS, "nfsfdism", 0); mtx_unlock(&nmp->nm_mtx); - newnfs_disconnect(&nmp->nm_sockreq); + newnfs_disconnect(nmp, &nmp->nm_sockreq); crfree(nmp->nm_sockreq.nr_cred); free(nmp->nm_nam, M_SONAME); if (nmp->nm_sockreq.nr_auth != NULL) @@ -1803,7 +1844,7 @@ nfs_unmount(struct mount *mp, int mntflags) TAILQ_FOREACH_SAFE(dsp, &nmp->nm_sess, nfsclds_list, tdsp) { if (dsp != TAILQ_FIRST(&nmp->nm_sess) && dsp->nfsclds_sockp != NULL) - newnfs_disconnect(dsp->nfsclds_sockp); + newnfs_disconnect(NULL, dsp->nfsclds_sockp); nfscl_freenfsclds(dsp); } free(nmp->nm_tlscertname, M_NEWNFSMNT); @@ -2067,6 +2108,7 @@ void nfscl_retopts(struct nfsmount *nmp, char *buffer, size_t buflen) &blen); nfscl_printopt(nmp, (nmp->nm_flag & NFSMNT_NOCONN) != 0, ",noconn", &buf, &blen); + nfscl_printoptval(nmp, nmp->nm_aconnect + 1, ",nconnect", &buf, &blen); nfscl_printopt(nmp, (nmp->nm_flag & NFSMNT_SOFT) == 0, ",hard", &buf, &blen); nfscl_printopt(nmp, (nmp->nm_flag & NFSMNT_SOFT) != 0, ",soft", &buf, diff --git a/sys/fs/nfsclient/nfsmount.h b/sys/fs/nfsclient/nfsmount.h index f8ea8c9a1418..a5997e474be9 100644 --- a/sys/fs/nfsclient/nfsmount.h +++ b/sys/fs/nfsclient/nfsmount.h @@ -39,6 +39,9 @@ #include +/* Maximum value for nm_nconnect. */ +#define NFS_MAXNCONN 16 + /* * Mount structure. * One allocated on every NFS mount. @@ -81,6 +84,11 @@ struct nfsmount { u_int64_t nm_clval; /* identifies which clientid */ u_int64_t nm_fsid[2]; /* NFSv4 fsid */ int nm_minorvers; /* Minor version # for NFSv4 */ + u_int nm_aconnect; /* additional TCP connections */ + u_int nm_nextaconn; /* Next nm_aconn[] to use */ + /* unclipped, wraps to 0 */ + struct __rpc_client *nm_aconn[NFS_MAXNCONN - 1]; /* Additional nconn */ + /* Locked via nm_sockreq.nr_mtx */ u_int16_t nm_krbnamelen; /* Krb5 host principal, if any */ u_int16_t nm_dirpathlen; /* and mount dirpath, for V4 */ u_int16_t nm_srvkrbnamelen; /* and the server's target name */ diff --git a/sys/fs/nfsserver/nfs_nfsdstate.c b/sys/fs/nfsserver/nfs_nfsdstate.c index 98f5e26d49bb..01280c8e49c6 100644 --- a/sys/fs/nfsserver/nfs_nfsdstate.c +++ b/sys/fs/nfsserver/nfs_nfsdstate.c @@ -1368,7 +1368,7 @@ nfsrv_zapclient(struct nfsclient *clp, NFSPROC_T *p) NULL, 0, NULL, NULL, NULL, 0, p); } #endif - newnfs_disconnect(&clp->lc_req); + newnfs_disconnect(NULL, &clp->lc_req); free(clp->lc_req.nr_nam, M_SONAME); NFSFREEMUTEX(&clp->lc_req.nr_mtx); free(clp->lc_stateid, M_NFSDCLIENT); @@ -4577,10 +4577,10 @@ nfsrv_docallback(struct nfsclient *clp, int procnum, nfsv4stateid_t *stateidp, nfsrv_freesession(sep, NULL); } else if (nd->nd_procnum == NFSV4PROC_CBNULL) error = newnfs_connect(NULL, &clp->lc_req, cred, - NULL, 1, dotls); + NULL, 1, dotls, &clp->lc_req.nr_client); else error = newnfs_connect(NULL, &clp->lc_req, cred, - NULL, 3, dotls); + NULL, 3, dotls, &clp->lc_req.nr_client); } newnfs_sndunlock(&clp->lc_req.nr_lock); NFSD_DEBUG(4, "aft sndunlock=%d\n", error); From owner-dev-commits-src-main@freebsd.org Fri Jul 9 01:33:40 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5DC8A65732F; Fri, 9 Jul 2021 01:33:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GLbKJ22Ypz4b6N; Fri, 9 Jul 2021 01:33:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2E8763ABD; Fri, 9 Jul 2021 01:33:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1691XePu014313; Fri, 9 Jul 2021 01:33:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1691Xewa014312; Fri, 9 Jul 2021 01:33:40 GMT (envelope-from git) Date: Fri, 9 Jul 2021 01:33:40 GMT Message-Id: <202107090133.1691Xewa014312@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: bd597b814933 - main - UPDATING: Add an entry for commit 1e0a518d6548 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bd597b8149331b4da4675c022a859d86e9c6a5b6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jul 2021 01:33:40 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=bd597b8149331b4da4675c022a859d86e9c6a5b6 commit bd597b8149331b4da4675c022a859d86e9c6a5b6 Author: Rick Macklem AuthorDate: 2021-07-09 01:30:24 +0000 Commit: Rick Macklem CommitDate: 2021-07-09 01:30:24 +0000 UPDATING: Add an entry for commit 1e0a518d6548 --- UPDATING | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/UPDATING b/UPDATING index 35994b25a2f1..d1ebb992c78c 100644 --- a/UPDATING +++ b/UPDATING @@ -27,6 +27,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 14.x IS SLOW: world, or to merely disable the most expensive debugging functionality at runtime, run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20210708: + Commit 1e0a518d6548 changed the internal KAPI between the NFS + modules. They all need to be rebuilt from sources. I did not + bump __FreeBSD_version, since it was bumped recently. + 20210624: The NFSv4 client now uses the highest minor version of NFSv4 supported by the NFSv4 server by default instead of minor version 0, From owner-dev-commits-src-main@freebsd.org Fri Jul 9 05:08:07 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9A39965994A; Fri, 9 Jul 2021 05:08:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GLh4l3lDdz3BrZ; Fri, 9 Jul 2021 05:08:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 694946909; Fri, 9 Jul 2021 05:08:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1695870Z094364; Fri, 9 Jul 2021 05:08:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 169587B5094363; Fri, 9 Jul 2021 05:08:07 GMT (envelope-from git) Date: Fri, 9 Jul 2021 05:08:07 GMT Message-Id: <202107090508.169587B5094363@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: f68a53dba933 - main - awk: Reduce diffs with upstream to almost nothing. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f68a53dba933f9c1143863603f5a16fdbe5f070e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jul 2021 05:08:07 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=f68a53dba933f9c1143863603f5a16fdbe5f070e commit f68a53dba933f9c1143863603f5a16fdbe5f070e Author: Warner Losh AuthorDate: 2021-07-09 03:51:24 +0000 Commit: Warner Losh CommitDate: 2021-07-09 05:05:13 +0000 awk: Reduce diffs with upstream to almost nothing. In the merge of 20210215, I left two merge conflicts #if 0'd by mistake to check later rather than resolve them as part of the merge. This code turns out to be from the original one-true-awk import and not FreeBSD specific, so remove them. Remove a extra definition of HAT. Remove a stylistic change that also appears to be a mismerge along the way. Remove FREEBSD-upgrade. Nobody has updated it since the original 2007 cvs import. It talks about old CVS branches that never made it into svn, let alone git. New imports will follow the standard practices now, so there's nothing left to document. Move README to README.md and copy the README.md from upstream over. This leaves just the $FreeBSD$ lines (which remain for the stable/12 merge) and the strcoll part of ru@'s r201989/d98dd8e5f94c as the only diffs with upstream. FreeBSD also still has its own man page, which I don't plan on changing. Once this commit is merged to stable/12, I plan no further merges to stable/12. Sometime after that I'll remove the $FreeBSD$ lines to reduce the diffs even more (though i want to make sure plans won't change first). I also plan to talk to upstream about this change... MFC After: 2 weeks Sponsored by: Netflix --- contrib/one-true-awk/FREEBSD-upgrade | 24 ------- contrib/one-true-awk/README | 94 --------------------------- contrib/one-true-awk/README.md | 119 +++++++++++++++++++++++++++++++++++ contrib/one-true-awk/awk.h | 2 - contrib/one-true-awk/b.c | 32 +--------- 5 files changed, 120 insertions(+), 151 deletions(-) diff --git a/contrib/one-true-awk/FREEBSD-upgrade b/contrib/one-true-awk/FREEBSD-upgrade deleted file mode 100644 index f0f70ab7b17b..000000000000 --- a/contrib/one-true-awk/FREEBSD-upgrade +++ /dev/null @@ -1,24 +0,0 @@ -# $FreeBSD$ - -Import of the 2005/04/24 version of the "one true awk", as described -in "The AWK Programming Language", by Al Aho, Brian Kernighan, and -Peter Weinberger (Addison-Wesley, 1988, ISBN 0-201-07981-X). - -Original sources were taken from the Brian Kernighan's AWK page -http://www.cs.princeton.edu/~bwk/btl.mirror -and include bug fixes up thru Oct 23, 2007. - -The following files were removed for this import: - - buildwin.bat - makefile.win - missing95.c - vcvars32.bat - ytab.c - ytab.h - ytabc.bak - ytabh.bak - -The vendor import was done by: - - cvs import src/contrib/one-true-awk BELL_LABS bwk_20071023 diff --git a/contrib/one-true-awk/README b/contrib/one-true-awk/README deleted file mode 100644 index 24aaf9092d58..000000000000 --- a/contrib/one-true-awk/README +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************** -Copyright (C) Lucent Technologies 1997 -All Rights Reserved - -Permission to use, copy, modify, and distribute this software and -its documentation for any purpose and without fee is hereby -granted, provided that the above copyright notice appear in all -copies and that both that the copyright notice and this -permission notice and warranty disclaimer appear in supporting -documentation, and that the name Lucent Technologies or any of -its entities not be used in advertising or publicity pertaining -to distribution of the software without specific, written prior -permission. - -LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. -IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY -SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER -IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF -THIS SOFTWARE. -****************************************************************/ - -This is the version of awk described in "The AWK Programming Language", -by Al Aho, Brian Kernighan, and Peter Weinberger -(Addison-Wesley, 1988, ISBN 0-201-07981-X). - -Changes, mostly bug fixes and occasional enhancements, are listed -in FIXES. If you distribute this code further, please please please -distribute FIXES with it. If you find errors, please report them -to bwk@cs.princeton.edu. Thanks. - -The program itself is created by - make -which should produce a sequence of messages roughly like this: - - yacc -d awkgram.y - -conflicts: 43 shift/reduce, 85 reduce/reduce - mv y.tab.c ytab.c - mv y.tab.h ytab.h - cc -c ytab.c - cc -c b.c - cc -c main.c - cc -c parse.c - cc maketab.c -o maketab - ./maketab >proctab.c - cc -c proctab.c - cc -c tran.c - cc -c lib.c - cc -c run.c - cc -c lex.c - cc ytab.o b.o main.o parse.o proctab.o tran.o lib.o run.o lex.o -lm - -This produces an executable a.out; you will eventually want to -move this to some place like /usr/bin/awk. - -If your system does not have yacc or bison (the GNU -equivalent), you must compile the pieces manually. We have -included yacc output in ytab.c and ytab.h, and backup copies in -case you overwrite them. We have also included a copy of -proctab.c so you do not need to run maketab. - -NOTE: This version uses ANSI C, as you should also. We have -compiled this without any changes using gcc -Wall and/or local C -compilers on a variety of systems, but new systems or compilers -may raise some new complaint; reports of difficulties are -welcome. - -This also compiles with Visual C++ on all flavors of Windows, -*if* you provide versions of popen and pclose. The file -missing95.c contains versions that can be used to get started -with, though the underlying support has mysterious properties, -the symptom of which can be truncated pipe output. Beware. The -file makefile.win gives hints on how to proceed; if you run -vcvars32.bat, it will set up necessary paths and parameters so -you can subsequently run nmake -f makefile.win. Beware also that -when running on Windows under command.com, various quoting -conventions are different from Unix systems: single quotes won't -work around arguments, and various characters like % are -interpreted within double quotes. - -This compiles without change on Macintosh OS X using gcc and -the standard developer tools. - -This is also said to compile on Macintosh OS 9 systems, using the -file "buildmac" provided by Dan Allen (danallen@microsoft.com), -to whom many thanks. - -The version of malloc that comes with some systems is sometimes -astonishly slow. If awk seems slow, you might try fixing that. -More generally, turning on optimization can significantly improve -awk's speed, perhaps by 1/3 for highest levels. diff --git a/contrib/one-true-awk/README.md b/contrib/one-true-awk/README.md new file mode 100644 index 000000000000..b8089b3a4803 --- /dev/null +++ b/contrib/one-true-awk/README.md @@ -0,0 +1,119 @@ +# The One True Awk + +This is the version of `awk` described in _The AWK Programming Language_, +by Al Aho, Brian Kernighan, and Peter Weinberger +(Addison-Wesley, 1988, ISBN 0-201-07981-X). + +## Copyright + +Copyright (C) Lucent Technologies 1997
+All Rights Reserved + +Permission to use, copy, modify, and distribute this software and +its documentation for any purpose and without fee is hereby +granted, provided that the above copyright notice appear in all +copies and that both that the copyright notice and this +permission notice and warranty disclaimer appear in supporting +documentation, and that the name Lucent Technologies or any of +its entities not be used in advertising or publicity pertaining +to distribution of the software without specific, written prior +permission. + +LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. +IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY +SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER +IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. + +## Distribution and Reporting Problems + +Changes, mostly bug fixes and occasional enhancements, are listed +in `FIXES`. If you distribute this code further, please please please +distribute `FIXES` with it. + +If you find errors, please report them +to bwk@cs.princeton.edu. +Please _also_ open an issue in the GitHub issue tracker, to make +it easy to track issues. +Thanks. + +## Submitting Pull Requests + +Pull requests are welcome. Some guidelines: + +* Please do not use functions or facilities that are not standard (e.g., +`strlcpy()`, `fpurge()`). + +* Please run the test suite and make sure that your changes pass before +posting the pull request. To do so: + + 1. Save the previous version of `awk` somewhere in your path. Call it `nawk` (for example). + 1. Run `oldawk=nawk make check > check.out 2>&1`. + 1. Search for `BAD` or `error` in the result. In general, look over it manually to make sure there are no errors. + +* Please create the pull request with a request +to merge into the `staging` branch instead of into the `master` branch. +This allows us to do testing, and to make any additional edits or changes +after the merge but before merging to `master`. + +## Building + +The program itself is created by + + make + +which should produce a sequence of messages roughly like this: + + yacc -d awkgram.y + conflicts: 43 shift/reduce, 85 reduce/reduce + mv y.tab.c ytab.c + mv y.tab.h ytab.h + cc -c ytab.c + cc -c b.c + cc -c main.c + cc -c parse.c + cc maketab.c -o maketab + ./maketab >proctab.c + cc -c proctab.c + cc -c tran.c + cc -c lib.c + cc -c run.c + cc -c lex.c + cc ytab.o b.o main.o parse.o proctab.o tran.o lib.o run.o lex.o -lm + +This produces an executable `a.out`; you will eventually want to +move this to some place like `/usr/bin/awk`. + +If your system does not have `yacc` or `bison` (the GNU +equivalent), you need to install one of them first. + +NOTE: This version uses ANSI C (C 99), as you should also. We have +compiled this without any changes using `gcc -Wall` and/or local C +compilers on a variety of systems, but new systems or compilers +may raise some new complaint; reports of difficulties are +welcome. + +This compiles without change on Macintosh OS X using `gcc` and +the standard developer tools. + +You can also use `make CC=g++` to build with the GNU C++ compiler, +should you choose to do so. + +The version of `malloc` that comes with some systems is sometimes +astonishly slow. If `awk` seems slow, you might try fixing that. +More generally, turning on optimization can significantly improve +`awk`'s speed, perhaps by 1/3 for highest levels. + +## A Note About Maintenance + +NOTICE! Maintenance of this program is on a ``best effort'' +basis. We try to get to issues and pull requests as quickly +as we can. Unfortunately, however, keeping this program going +is not at the top of our priority list. + +#### Last Updated + +Fri Dec 25 16:53:34 EST 2020 diff --git a/contrib/one-true-awk/awk.h b/contrib/one-true-awk/awk.h index 230eac41548c..51c00df9f279 100644 --- a/contrib/one-true-awk/awk.h +++ b/contrib/one-true-awk/awk.h @@ -237,8 +237,6 @@ extern int pairstack[], paircnt; /* watch out in match(), etc. */ #define HAT (NCHARS+2) /* matches ^ in regular expr */ #define NSTATES 32 -#define HAT (NCHARS+2) /* matches ^ in regular expr */ - /* NCHARS is 2**n */ typedef struct rrow { long ltype; /* long avoids pointer warnings on 64-bit */ diff --git a/contrib/one-true-awk/b.c b/contrib/one-true-awk/b.c index 20f4a8bee7f9..dd64f09647b0 100644 --- a/contrib/one-true-awk/b.c +++ b/contrib/one-true-awk/b.c @@ -614,22 +614,7 @@ int pmatch(fa *f, const char *p0) /* longest match, for sub */ } nextin: s = 2; -#if 0 /* XXX */ - if (f->reset) { - for (i = 2; i <= f->curstat; i++) -n xfree(f->posns[i]); - k = *f->posns[0]; - if ((f->posns[2] = (int *) calloc(k+1, sizeof(int))) == NULL) - overflo("out of space in pmatch"); - for (i = 0; i <= k; i++) - (f->posns[2])[i] = (f->posns[0])[i]; - f->initstat = f->curstat = 2; - f->out[2] = f->out[0]; - for (i = 0; i < NCHARS; i++) - f->gototab[2][i] = 0; - } -#endif - } while (*p++ != 0); + } while (*p++); return (0); } @@ -670,21 +655,6 @@ int nematch(fa *f, const char *p0) /* non-empty match, for sub */ } nnextin: s = 2; -#if 0 /* XXX */ - if (f->reset) { - for (i = 2; i <= f->curstat; i++) - xfree(f->posns[i]); - k = *f->posns[0]; - if ((f->posns[2] = (int *) calloc(k+1, sizeof(int))) == NULL) - overflo("out of state space"); - for (i = 0; i <= k; i++) - (f->posns[2])[i] = (f->posns[0])[i]; - f->initstat = f->curstat = 2; - f->out[2] = f->out[0]; - for (i = 0; i < NCHARS; i++) - f->gototab[2][i] = 0; - } -#endif p++; } return (0); From owner-dev-commits-src-main@freebsd.org Fri Jul 9 05:23:00 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DD7A06597C4; Fri, 9 Jul 2021 05:23:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GLhPw5ggKz3DtL; Fri, 9 Jul 2021 05:23:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A5FEB69CB; Fri, 9 Jul 2021 05:23:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1695N0j0020804; Fri, 9 Jul 2021 05:23:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1695N0vO020803; Fri, 9 Jul 2021 05:23:00 GMT (envelope-from git) Date: Fri, 9 Jul 2021 05:23:00 GMT Message-Id: <202107090523.1695N0vO020803@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 3f7b23177f1d - main - UPDATING: Note awk upgraded to upstream one-true-awk 20210215. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3f7b23177f1d68547196958f504c514432478115 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jul 2021 05:23:00 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=3f7b23177f1d68547196958f504c514432478115 commit 3f7b23177f1d68547196958f504c514432478115 Author: Warner Losh AuthorDate: 2021-07-09 05:10:38 +0000 Commit: Warner Losh CommitDate: 2021-07-09 05:16:06 +0000 UPDATING: Note awk upgraded to upstream one-true-awk 20210215. The updating entry can be used for release notes. I'll merge this to stable/12 and stable/13 to make sure it gets into thier release notes. Relnotes: yes Sponsored by: Netflix --- UPDATING | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/UPDATING b/UPDATING index d1ebb992c78c..e7453030b24a 100644 --- a/UPDATING +++ b/UPDATING @@ -32,6 +32,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 14.x IS SLOW: modules. They all need to be rebuilt from sources. I did not bump __FreeBSD_version, since it was bumped recently. +20210707: + awk has been updated to the latest one-true-awk version 20120215. + This contains a number of minor bug fixes. + 20210624: The NFSv4 client now uses the highest minor version of NFSv4 supported by the NFSv4 server by default instead of minor version 0, From owner-dev-commits-src-main@freebsd.org Fri Jul 9 05:29:35 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0AC6F659AB5; Fri, 9 Jul 2021 05:29:35 +0000 (UTC) (envelope-from yasu@utahime.org) Received: from gate.home.utahime.org (gate.home.utahime.org [183.180.29.210]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4GLhYV58sLz3FBK; Fri, 9 Jul 2021 05:29:34 +0000 (UTC) (envelope-from yasu@utahime.org) Received: from eastasia.home.utahime.org (eastasia.home.utahime.org [192.168.174.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by gate.home.utahime.org (Postfix) with ESMTPS id 88D093A948; Fri, 9 Jul 2021 14:29:25 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=utahime.org; s=maybe2019112701; t=1625808565; bh=tdj+aDYBN4gEOEZowRJLazecqfPJtq0Ot/52K8e03Lk=; h=Date:To:Cc:Subject:From:In-Reply-To:References; b=tpO0vmfEPQfQRfCbF78tWgtBHywZt1IDMhHSBoSm1513dHg2+NFqz+F73wKqQqo4z ez3M9wwUeqQrnn+99wa9oJIg4Zf+OSoWwzLReFfrO6wzXLMGEwNUMN1vwjAS7YW/Bk lhIZaebbp+3StG0R8HxkUZ/b4aOcaJrkQgGx5rzIWfDiSlwumbboaofyFOzCNjp1lX l+v2DPozF+47wWf2KpE/4m78YyR2s96AjL5RX7LF4eTyuh7oRzIll6QV+hNOsPI6jl PTrcI8r3ZPlLgQ5MykqvtNha1hdf3eyK674cOs3JeLFByaa9aekIF9LqMbc1yUHrOn myckY1roDHhyw== Received: from localhost (rolling.home.utahime.org [192.168.174.11]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by eastasia.home.utahime.org (Postfix) with ESMTPSA id A528A3CAE2; Fri, 9 Jul 2021 14:29:24 +0900 (JST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.3 at eastasia.home.utahime.org Date: Fri, 09 Jul 2021 14:29:05 +0900 (JST) Message-Id: <20210709.142905.792234204091664441.yasu@utahime.org> To: imp@FreeBSD.org Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 3f7b23177f1d - main - UPDATING: Note awk upgraded to upstream one-true-awk 20210215. From: Yasuhiro Kimura In-Reply-To: <202107090523.1695N0vO020803@gitrepo.freebsd.org> References: <202107090523.1695N0vO020803@gitrepo.freebsd.org> X-Mailer: Mew version 6.8 on Emacs 27.2 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4GLhYV58sLz3FBK X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jul 2021 05:29:35 -0000 From: Warner Losh Subject: git: 3f7b23177f1d - main - UPDATING: Note awk upgraded to upstream one-true-awk 20210215. Date: Fri, 9 Jul 2021 05:23:00 GMT > +20210707: > + awk has been updated to the latest one-true-awk version 20120215. ^^^^^^^^ Typo of 20210215? --- Yasuhiro Kimura From owner-dev-commits-src-main@freebsd.org Fri Jul 9 05:43:45 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6BEF965A1B4; Fri, 9 Jul 2021 05:43:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GLhss2PSxz3GMX; Fri, 9 Jul 2021 05:43:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3AD8A700E; Fri, 9 Jul 2021 05:43:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1695hjnS047402; Fri, 9 Jul 2021 05:43:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1695hjKt047401; Fri, 9 Jul 2021 05:43:45 GMT (envelope-from git) Date: Fri, 9 Jul 2021 05:43:45 GMT Message-Id: <202107090543.1695hjKt047401@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: a65fe39d5418 - main - UPDATING: fix typo MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a65fe39d5418ffd96b93744d3a3e43cd48ecab4c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jul 2021 05:43:45 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=a65fe39d5418ffd96b93744d3a3e43cd48ecab4c commit a65fe39d5418ffd96b93744d3a3e43cd48ecab4c Author: Warner Losh AuthorDate: 2021-07-09 05:42:15 +0000 Commit: Warner Losh CommitDate: 2021-07-09 05:42:15 +0000 UPDATING: fix typo The correct version is 20210215, not 20120215 :( Reported by: Yasuhiro Kimura Fixes: 3f7b23177f1d Sponsored by: Netflix --- UPDATING | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UPDATING b/UPDATING index e7453030b24a..4a8fde856e83 100644 --- a/UPDATING +++ b/UPDATING @@ -33,7 +33,7 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 14.x IS SLOW: bump __FreeBSD_version, since it was bumped recently. 20210707: - awk has been updated to the latest one-true-awk version 20120215. + awk has been updated to the latest one-true-awk version 20210215. This contains a number of minor bug fixes. 20210624: From owner-dev-commits-src-main@freebsd.org Fri Jul 9 09:16:09 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0BF4265CAAF; Fri, 9 Jul 2021 09:16:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GLnZw6zvKz4Rl7; Fri, 9 Jul 2021 09:16:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D7CBE11FFF; Fri, 9 Jul 2021 09:16:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1699G8a9028607; Fri, 9 Jul 2021 09:16:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1699G8sm028606; Fri, 9 Jul 2021 09:16:08 GMT (envelope-from git) Date: Fri, 9 Jul 2021 09:16:08 GMT Message-Id: <202107090916.1699G8sm028606@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: c6bf20a2a46d - main - pf: add DIOCGETSTATESV2 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c6bf20a2a46dc36bf881ac594454f71379828a9a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jul 2021 09:16:09 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=c6bf20a2a46dc36bf881ac594454f71379828a9a commit c6bf20a2a46dc36bf881ac594454f71379828a9a Author: Kristof Provost AuthorDate: 2021-07-06 10:12:12 +0000 Commit: Kristof Provost CommitDate: 2021-07-09 08:29:53 +0000 pf: add DIOCGETSTATESV2 Add a new version of the DIOCGETSTATES call, which extends the struct to include the original interface information. MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31097 --- sys/net/pfvar.h | 73 ++++++++++++++++++++++++++++ sys/netpfil/pf/pf_ioctl.c | 119 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 192 insertions(+) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 7bbb585106c7..17af5d46a183 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -520,6 +520,65 @@ struct pf_state_cmp { #define PFSTATE_SETPRIO 0x0200 #define PFSTATE_SETMASK (PFSTATE_SETPRIO) +struct pf_state_scrub_export { + uint16_t pfss_flags; + uint8_t pfss_ttl; /* stashed TTL */ +#define PF_SCRUB_FLAG_VALID 0x01 + uint8_t scrub_flag; + uint32_t pfss_ts_mod; /* timestamp modulation */ +}; + +struct pf_state_key_export { + struct pf_addr addr[2]; + uint16_t port[2]; +}; + +struct pf_state_peer_export { + struct pf_state_scrub_export scrub; /* state is scrubbed */ + uint32_t seqlo; /* Max sequence number sent */ + uint32_t seqhi; /* Max the other end ACKd + win */ + uint32_t seqdiff; /* Sequence number modulator */ + uint16_t max_win; /* largest window (pre scaling) */ + uint16_t mss; /* Maximum segment size option */ + uint8_t state; /* active state level */ + uint8_t wscale; /* window scaling factor */ + uint8_t dummy[6]; +}; +_Static_assert(sizeof(struct pf_state_peer_export) == 32, "size incorrect"); + +struct pf_state_export { + uint64_t version; +#define PF_STATE_VERSION 20210706 + uint64_t id; + char ifname[IFNAMSIZ]; + char orig_ifname[IFNAMSIZ]; + struct pf_state_key_export key[2]; + struct pf_state_peer_export src; + struct pf_state_peer_export dst; + struct pf_addr rt_addr; + uint32_t rule; + uint32_t anchor; + uint32_t nat_rule; + uint32_t creation; + uint32_t expire; + uint32_t spare0; + uint64_t packets[2]; + uint64_t bytes[2]; + uint32_t creatorid; + uint32_t spare1; + sa_family_t af; + uint8_t proto; + uint8_t direction; + uint8_t log; + uint8_t state_flags; + uint8_t timeout; + uint8_t sync_flags; + uint8_t updates; + + uint8_t spare[112]; +}; +_Static_assert(sizeof(struct pf_state_export) == 384, "size incorrect"); + #ifdef _KERNEL struct pf_kstate { u_int64_t id; @@ -646,6 +705,8 @@ extern pfsync_detach_ifnet_t *pfsync_detach_ifnet_ptr; void pfsync_state_export(struct pfsync_state *, struct pf_kstate *); +void pf_state_export(struct pf_state_export *, + struct pf_kstate *); /* pflog */ struct pf_kruleset; @@ -1187,6 +1248,17 @@ struct pfioc_states { #define ps_states ps_u.psu_states }; +struct pfioc_states_v2 { + int ps_len; + uint64_t ps_req_version; + union { + caddr_t psu_buf; + struct pf_state_export *psu_states; + } ps_u; +#define ps_buf ps_u.psu_buf +#define ps_states ps_u.psu_states +}; + struct pfioc_src_nodes { int psn_len; union { @@ -1402,6 +1474,7 @@ struct pfioc_iface { #define DIOCCLRIFFLAG _IOWR('D', 90, struct pfioc_iface) #define DIOCKILLSRCNODES _IOWR('D', 91, struct pfioc_src_node_kill) #define DIOCKEEPCOUNTERS _IOWR('D', 92, struct pfioc_nv) +#define DIOCGETSTATESV2 _IOWR('D', 93, struct pfioc_states_v2) struct pf_ifspeed_v0 { char ifname[IFNAMSIZ]; diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 33eb0e15ea57..e4017f48a8ca 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -2108,6 +2108,7 @@ pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td case DIOCNATLOOK: case DIOCSETDEBUG: case DIOCGETSTATES: + case DIOCGETSTATESV2: case DIOCGETSTATESNV: case DIOCGETTIMEOUT: case DIOCCLRRULECTRS: @@ -2161,6 +2162,7 @@ pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td case DIOCGETSTATENV: case DIOCGETSTATUS: case DIOCGETSTATES: + case DIOCGETSTATESV2: case DIOCGETSTATESNV: case DIOCGETTIMEOUT: case DIOCGETLIMIT: @@ -2871,6 +2873,60 @@ DIOCGETSTATES_full: break; } + case DIOCGETSTATESV2: { + struct pfioc_states_v2 *ps = (struct pfioc_states_v2 *)addr; + struct pf_kstate *s; + struct pf_state_export *pstore, *p; + int i, nr; + + if (ps->ps_req_version > PF_STATE_VERSION) { + error = ENOTSUP; + break; + } + + if (ps->ps_len <= 0) { + nr = uma_zone_get_cur(V_pf_state_z); + ps->ps_len = sizeof(struct pf_state_export) * nr; + break; + } + + p = pstore = malloc(ps->ps_len, M_TEMP, M_WAITOK | M_ZERO); + nr = 0; + + for (i = 0; i <= pf_hashmask; i++) { + struct pf_idhash *ih = &V_pf_idhash[i]; + + if (LIST_EMPTY(&ih->states)) + continue; + + PF_HASHROW_LOCK(ih); + LIST_FOREACH(s, &ih->states, entry) { + if (s->timeout == PFTM_UNLINKED) + continue; + + if ((nr+1) * sizeof(*p) > ps->ps_len) { + PF_HASHROW_UNLOCK(ih); + goto DIOCGETSTATESV2_full; + } + pf_state_export(p, s); + p++; + nr++; + } + PF_HASHROW_UNLOCK(ih); + } +DIOCGETSTATESV2_full: + error = copyout(pstore, ps->ps_states, + sizeof(struct pf_state_export) * nr); + if (error) { + free(pstore, M_TEMP); + break; + } + ps->ps_len = sizeof(struct pf_state_export) * nr; + free(pstore, M_TEMP); + + break; + } + case DIOCGETSTATESNV: { error = pf_getstates((struct pfioc_nv *)addr); break; @@ -4594,7 +4650,70 @@ pfsync_state_export(struct pfsync_state *sp, struct pf_kstate *st) pf_state_counter_hton(st->packets[1], sp->packets[1]); pf_state_counter_hton(st->bytes[0], sp->bytes[0]); pf_state_counter_hton(st->bytes[1], sp->bytes[1]); +} + +void +pf_state_export(struct pf_state_export *sp, struct pf_kstate *st) +{ + bzero(sp, sizeof(*sp)); + + sp->version = PF_STATE_VERSION; + + /* copy from state key */ + sp->key[PF_SK_WIRE].addr[0] = st->key[PF_SK_WIRE]->addr[0]; + sp->key[PF_SK_WIRE].addr[1] = st->key[PF_SK_WIRE]->addr[1]; + sp->key[PF_SK_WIRE].port[0] = st->key[PF_SK_WIRE]->port[0]; + sp->key[PF_SK_WIRE].port[1] = st->key[PF_SK_WIRE]->port[1]; + sp->key[PF_SK_STACK].addr[0] = st->key[PF_SK_STACK]->addr[0]; + sp->key[PF_SK_STACK].addr[1] = st->key[PF_SK_STACK]->addr[1]; + sp->key[PF_SK_STACK].port[0] = st->key[PF_SK_STACK]->port[0]; + sp->key[PF_SK_STACK].port[1] = st->key[PF_SK_STACK]->port[1]; + sp->proto = st->key[PF_SK_WIRE]->proto; + sp->af = st->key[PF_SK_WIRE]->af; + + /* copy from state */ + strlcpy(sp->ifname, st->kif->pfik_name, sizeof(sp->ifname)); + strlcpy(sp->orig_ifname, st->orig_kif->pfik_name, + sizeof(sp->orig_ifname)); + bcopy(&st->rt_addr, &sp->rt_addr, sizeof(sp->rt_addr)); + sp->creation = htonl(time_uptime - st->creation); + sp->expire = pf_state_expires(st); + if (sp->expire <= time_uptime) + sp->expire = htonl(0); + else + sp->expire = htonl(sp->expire - time_uptime); + + sp->direction = st->direction; + sp->log = st->log; + sp->timeout = st->timeout; + sp->state_flags = st->state_flags; + if (st->src_node) + sp->sync_flags |= PFSYNC_FLAG_SRCNODE; + if (st->nat_src_node) + sp->sync_flags |= PFSYNC_FLAG_NATSRCNODE; + + sp->id = st->id; + sp->creatorid = st->creatorid; + pf_state_peer_hton(&st->src, &sp->src); + pf_state_peer_hton(&st->dst, &sp->dst); + + if (st->rule.ptr == NULL) + sp->rule = htonl(-1); + else + sp->rule = htonl(st->rule.ptr->nr); + if (st->anchor.ptr == NULL) + sp->anchor = htonl(-1); + else + sp->anchor = htonl(st->anchor.ptr->nr); + if (st->nat_rule.ptr == NULL) + sp->nat_rule = htonl(-1); + else + sp->nat_rule = htonl(st->nat_rule.ptr->nr); + sp->packets[0] = st->packets[0]; + sp->packets[1] = st->packets[1]; + sp->bytes[0] = st->bytes[0]; + sp->bytes[1] = st->bytes[1]; } static void From owner-dev-commits-src-main@freebsd.org Fri Jul 9 09:16:10 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2C84C65CBBD; Fri, 9 Jul 2021 09:16:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GLnZy0gZ2z4Rfq; Fri, 9 Jul 2021 09:16:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F2FF311C74; Fri, 9 Jul 2021 09:16:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1699G9Ap028635; Fri, 9 Jul 2021 09:16:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1699G9ch028634; Fri, 9 Jul 2021 09:16:09 GMT (envelope-from git) Date: Fri, 9 Jul 2021 09:16:09 GMT Message-Id: <202107090916.1699G9ch028634@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: be70c7a50d32 - main - libpfctl: migrate to DIOCGETSTATESV2 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: be70c7a50d324dd56f3a0d37d8372e7855dd580b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jul 2021 09:16:10 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=be70c7a50d324dd56f3a0d37d8372e7855dd580b commit be70c7a50d324dd56f3a0d37d8372e7855dd580b Author: Kristof Provost AuthorDate: 2021-07-06 11:05:19 +0000 Commit: Kristof Provost CommitDate: 2021-07-09 08:29:57 +0000 libpfctl: migrate to DIOCGETSTATESV2 Stop using the *NV version to retrieve states, as its performance is unacceptably bad. For 1,000,000 states the nvlist version needed ~100 seconds to retrieve the states, the new version needs ~3 seconds. Reviewed by: mjg MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31098 --- lib/libpfctl/libpfctl.c | 196 +++++++++++++++++++----------------------------- 1 file changed, 79 insertions(+), 117 deletions(-) diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c index bbb53edf8bc1..6421a2c752a8 100644 --- a/lib/libpfctl/libpfctl.c +++ b/lib/libpfctl/libpfctl.c @@ -637,150 +637,112 @@ pfctl_nv_add_state_cmp(nvlist_t *nvl, const char *name, } static void -pf_nvstate_peer_to_state_peer(const nvlist_t *nvl, - struct pfctl_state_peer *peer) +pf_state_key_export_to_state_key(struct pfctl_state_key *ps, + const struct pf_state_key_export *s) { - bzero(peer, sizeof(*peer)); - - peer->seqlo = nvlist_get_number(nvl, "seqlo"); - peer->seqhi = nvlist_get_number(nvl, "seqhi"); - peer->seqdiff = nvlist_get_number(nvl, "seqdiff"); - peer->state = nvlist_get_number(nvl, "state"); - peer->wscale = nvlist_get_number(nvl, "wscale"); + bcopy(s->addr, ps->addr, sizeof(ps->addr[0]) * 2); + ps->port[0] = s->port[0]; + ps->port[1] = s->port[1]; } static void -pf_nvstate_key_to_state_key(const nvlist_t *nvl, struct pfctl_state_key *key) +pf_state_peer_export_to_state_peer(struct pfctl_state_peer *ps, + const struct pf_state_peer_export *s) { - const nvlist_t * const *tmp; - size_t count; - - bzero(key, sizeof(*key)); - - tmp = nvlist_get_nvlist_array(nvl, "addr", &count); - assert(count == 2); - - for (int i = 0; i < 2; i++) - pf_nvaddr_to_addr(tmp[i], &key->addr[i]); - - pf_nvuint_16_array(nvl, "port", 2, key->port, NULL); - - key->af = nvlist_get_number(nvl, "af"); - key->proto = nvlist_get_number(nvl, "proto"); + /* Ignore scrub. */ + ps->seqlo = s->seqlo; + ps->seqhi = s->seqhi; + ps->seqdiff = s->seqdiff; + /* Ignore max_win & mss */ + ps->state = s->state; + ps->wscale = s->wscale; } static void -pf_nvstate_to_state(const nvlist_t *nvl, struct pfctl_state *s) -{ - bzero(s, sizeof(*s)); - - s->id = nvlist_get_number(nvl, "id"); - s->creatorid = nvlist_get_number(nvl, "creatorid"); - s->direction = nvlist_get_number(nvl, "direction"); - - pf_nvstate_peer_to_state_peer(nvlist_get_nvlist(nvl, "src"), &s->src); - pf_nvstate_peer_to_state_peer(nvlist_get_nvlist(nvl, "dst"), &s->dst); - - pf_nvstate_key_to_state_key(nvlist_get_nvlist(nvl, "stack_key"), - &s->key[0]); - pf_nvstate_key_to_state_key(nvlist_get_nvlist(nvl, "wire_key"), - &s->key[1]); - - strlcpy(s->ifname, nvlist_get_string(nvl, "ifname"), - sizeof(s->ifname)); - strlcpy(s->orig_ifname, nvlist_get_string(nvl, "orig_ifname"), - sizeof(s->orig_ifname)); - - pf_nvaddr_to_addr(nvlist_get_nvlist(nvl, "rt_addr"), &s->rt_addr); - s->rule = nvlist_get_number(nvl, "rule"); - s->anchor = nvlist_get_number(nvl, "anchor"); - s->nat_rule = nvlist_get_number(nvl, "nat_rule"); - s->creation = nvlist_get_number(nvl, "creation"); - s->expire = nvlist_get_number(nvl, "expire"); - - pf_nvuint_64_array(nvl, "packets", 2, s->packets, NULL); - pf_nvuint_64_array(nvl, "bytes", 2, s->bytes, NULL); - - s->state_flags = nvlist_get_number(nvl, "state_flags"); - s->sync_flags = nvlist_get_number(nvl, "sync_flags"); +pf_state_export_to_state(struct pfctl_state *ps, const struct pf_state_export *s) +{ + assert(s->version >= PF_STATE_VERSION); + + ps->id = s->id; + strlcpy(ps->ifname, s->ifname, sizeof(ps->ifname)); + strlcpy(ps->orig_ifname, s->orig_ifname, sizeof(ps->orig_ifname)); + pf_state_key_export_to_state_key(&ps->key[0], &s->key[0]); + pf_state_key_export_to_state_key(&ps->key[1], &s->key[1]); + pf_state_peer_export_to_state_peer(&ps->src, &s->src); + pf_state_peer_export_to_state_peer(&ps->dst, &s->dst); + bcopy(&s->rt_addr, &ps->rt_addr, sizeof(ps->rt_addr)); + ps->rule = s->rule; + ps->anchor = s->anchor; + ps->nat_rule = s->nat_rule; + ps->creation = s->creation; + ps->expire = s->expire; + ps->packets[0] = s->packets[0]; + ps->packets[1] = s->packets[1]; + ps->bytes[0] = s->bytes[0]; + ps->bytes[1] = s->bytes[1]; + ps->creatorid = s->creatorid; + ps->key[0].proto = s->proto; + ps->key[1].proto = s->proto; + ps->key[0].af = s->af; + ps->key[1].af = s->af; + ps->direction = s->direction; + ps->state_flags = s->state_flags; + ps->sync_flags = s->sync_flags; } int pfctl_get_states(int dev, struct pfctl_states *states) { - struct pfioc_nv nv; - nvlist_t *nvl = NULL; - const nvlist_t * const *slist; - size_t found_count; - int error = 0; + struct pfioc_states_v2 ps; + struct pf_state_export *p; + char *inbuf = NULL, *newinbuf = NULL; + unsigned int len = 0; + int i, error; + + bzero(&ps, sizeof(ps)); + ps.ps_req_version = PF_STATE_VERSION; bzero(states, sizeof(*states)); TAILQ_INIT(&states->states); - /* Just enough to get a number, and we'll grow from there. */ - nv.data = malloc(64); - nv.len = nv.size = 64; - for (;;) { - if (ioctl(dev, DIOCGETSTATESNV, &nv)) { - error = errno; - goto out; + ps.ps_len = len; + if (len) { + newinbuf = realloc(inbuf, len); + if (newinbuf == NULL) + return (ENOMEM); + ps.ps_buf = inbuf = newinbuf; } - - nvlist_destroy(nvl); - nvl = nvlist_unpack(nv.data, nv.len, 0); - if (nvl == NULL) { - error = EIO; - goto out; + if ((error = ioctl(dev, DIOCGETSTATESV2, &ps)) < 0) { + free(inbuf); + return (error); } - - states->count = nvlist_get_number(nvl, "count"); - - /* Are there any states? */ - if (states->count == 0) + if (ps.ps_len + sizeof(struct pfioc_states_v2) < len) break; + if (len == 0 && ps.ps_len == 0) + goto out; + if (len == 0 && ps.ps_len != 0) + len = ps.ps_len; + if (ps.ps_len == 0) + goto out; /* no states */ + len *= 2; + } + p = ps.ps_states; - if (nvlist_exists_nvlist_array(nvl, "states")) - slist = nvlist_get_nvlist_array(nvl, "states", &found_count); - else - found_count = 0; - - if (found_count < states->count) { - size_t new_size = nv.size + - (nv.size * states->count / (found_count + 1) * 2); - - /* Our buffer is too small. Estimate what we need based - * on how many states fit in the previous allocation - * and how many states there are. Doubled for margin. - * */ - nv.data = realloc(nv.data, new_size); - nv.size = new_size; - - if (nv.data == NULL) { - error = ENOMEM; - goto out; - } - continue; + for (i = 0; i < ps.ps_len; i += sizeof(*p), p++) { + struct pfctl_state *s = malloc(sizeof(*s)); + if (s == NULL) { + pfctl_free_states(states); + error = ENOMEM; + goto out; } - for (size_t i = 0; i < found_count; i++) { - struct pfctl_state *s = malloc(sizeof(*s)); - if (s == NULL) { - pfctl_free_states(states); - error = ENOMEM; - goto out; - } - - pf_nvstate_to_state(slist[i], s); - TAILQ_INSERT_TAIL(&states->states, s, entry); - } - break; + pf_state_export_to_state(s, p); + TAILQ_INSERT_TAIL(&states->states, s, entry); } out: - nvlist_destroy(nvl); - free(nv.data); - + free(inbuf); return (error); } From owner-dev-commits-src-main@freebsd.org Fri Jul 9 09:16:11 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 83DDF65CC1F; Fri, 9 Jul 2021 09:16:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GLnZz24ksz4RNF; Fri, 9 Jul 2021 09:16:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2A5D411B73; Fri, 9 Jul 2021 09:16:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1699GBh3028659; Fri, 9 Jul 2021 09:16:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1699GBCF028658; Fri, 9 Jul 2021 09:16:11 GMT (envelope-from git) Date: Fri, 9 Jul 2021 09:16:11 GMT Message-Id: <202107090916.1699GBCF028658@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 3fc12ae04204 - main - pf: bound DIOCGETSTATESV2 memory use MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3fc12ae042040192aa43984106a75663aaa9e0f5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jul 2021 09:16:11 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=3fc12ae042040192aa43984106a75663aaa9e0f5 commit 3fc12ae042040192aa43984106a75663aaa9e0f5 Author: Kristof Provost AuthorDate: 2021-07-08 13:01:19 +0000 Commit: Kristof Provost CommitDate: 2021-07-09 08:30:02 +0000 pf: bound DIOCGETSTATESV2 memory use Rather than allocating however much memory userspace asks for we only allocate enough for a handful of states, and copy to userspace for each completed row. We start out with enough space for 16 states (per row), but grow that as required. In most configurations we expect at most a handful of states per row (more than that would have other negative effects on packet processing performance). Reviewed by: mjg MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31111 --- sys/netpfil/pf/pf_ioctl.c | 48 +++++++++++++++++++++++++++++++++++------------ 1 file changed, 36 insertions(+), 12 deletions(-) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index e4017f48a8ca..e0f7216ce5fc 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -2878,6 +2878,8 @@ DIOCGETSTATES_full: struct pf_kstate *s; struct pf_state_export *pstore, *p; int i, nr; + size_t slice_count = 16, count; + void *out; if (ps->ps_req_version > PF_STATE_VERSION) { error = ENOTSUP; @@ -2890,38 +2892,60 @@ DIOCGETSTATES_full: break; } - p = pstore = malloc(ps->ps_len, M_TEMP, M_WAITOK | M_ZERO); + out = ps->ps_states; + pstore = mallocarray(slice_count, + sizeof(struct pf_state_export), M_TEMP, M_WAITOK | M_ZERO); nr = 0; for (i = 0; i <= pf_hashmask; i++) { struct pf_idhash *ih = &V_pf_idhash[i]; +DIOCGETSTATESV2_retry: + p = pstore; + if (LIST_EMPTY(&ih->states)) continue; PF_HASHROW_LOCK(ih); + count = 0; + LIST_FOREACH(s, &ih->states, entry) { + if (s->timeout == PFTM_UNLINKED) + continue; + count++; + } + + if (count > slice_count) { + PF_HASHROW_UNLOCK(ih); + free(pstore, M_TEMP); + slice_count = count * 2; + pstore = mallocarray(slice_count, + sizeof(struct pf_state_export), M_TEMP, + M_WAITOK | M_ZERO); + goto DIOCGETSTATESV2_retry; + } + + if ((nr+count) * sizeof(*p) > ps->ps_len) { + PF_HASHROW_UNLOCK(ih); + goto DIOCGETSTATESV2_full; + } + LIST_FOREACH(s, &ih->states, entry) { if (s->timeout == PFTM_UNLINKED) continue; - if ((nr+1) * sizeof(*p) > ps->ps_len) { - PF_HASHROW_UNLOCK(ih); - goto DIOCGETSTATESV2_full; - } pf_state_export(p, s); p++; nr++; } PF_HASHROW_UNLOCK(ih); + error = copyout(pstore, out, + sizeof(struct pf_state_export) * count); + if (error) + break; + out = ps->ps_states + nr; } DIOCGETSTATESV2_full: - error = copyout(pstore, ps->ps_states, - sizeof(struct pf_state_export) * nr); - if (error) { - free(pstore, M_TEMP); - break; - } - ps->ps_len = sizeof(struct pf_state_export) * nr; + ps->ps_len = nr * sizeof(struct pf_state_export); free(pstore, M_TEMP); break; From owner-dev-commits-src-main@freebsd.org Fri Jul 9 11:48:42 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E3F4F65E70A; Fri, 9 Jul 2021 11:48:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GLryy5vv6z4lFw; Fri, 9 Jul 2021 11:48:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A8A9F1409C; Fri, 9 Jul 2021 11:48:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 169BmgTr030119; Fri, 9 Jul 2021 11:48:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 169BmgYW030118; Fri, 9 Jul 2021 11:48:42 GMT (envelope-from git) Date: Fri, 9 Jul 2021 11:48:42 GMT Message-Id: <202107091148.169BmgYW030118@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: 84992a3251d5 - main - sctp: provide sac_error also for ABORT chunk being sent MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 84992a3251d56df3bc36e0ac33ba383f41107864 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jul 2021 11:48:43 -0000 The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=84992a3251d56df3bc36e0ac33ba383f41107864 commit 84992a3251d56df3bc36e0ac33ba383f41107864 Author: Michael Tuexen AuthorDate: 2021-07-09 11:46:27 +0000 Commit: Michael Tuexen CommitDate: 2021-07-09 11:46:27 +0000 sctp: provide sac_error also for ABORT chunk being sent Thanks to Florent Castelli for bringing this issue up for the userland stack and providing an initial patch. MFC: 3 days --- sys/netinet/sctputil.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/sys/netinet/sctputil.c b/sys/netinet/sctputil.c index aec2298e26b2..1f909fa1d8d4 100644 --- a/sys/netinet/sctputil.c +++ b/sys/netinet/sctputil.c @@ -4367,19 +4367,29 @@ sctp_abort_association(struct sctp_inpcb *inp, struct sctp_tcb *stcb, uint8_t mflowtype, uint32_t mflowid, uint32_t vrf_id, uint16_t port) { + struct sctp_gen_error_cause *cause; uint32_t vtag; + uint16_t cause_code; - vtag = 0; if (stcb != NULL) { vtag = stcb->asoc.peer_vtag; vrf_id = stcb->asoc.vrf_id; + if (op_err != NULL) { + /* Read the cause code from the error cause. */ + cause = mtod(op_err, struct sctp_gen_error_cause *); + cause_code = ntohs(cause->code); + } else { + cause_code = 0; + } + } else { + vtag = 0; } sctp_send_abort(m, iphlen, src, dst, sh, vtag, op_err, mflowtype, mflowid, inp->fibnum, vrf_id, port); if (stcb != NULL) { /* We have a TCB to abort, send notification too */ - sctp_abort_notification(stcb, 0, 0, NULL, SCTP_SO_NOT_LOCKED); + sctp_abort_notification(stcb, 0, cause_code, NULL, SCTP_SO_NOT_LOCKED); /* Ok, now lets free it */ SCTP_STAT_INCR_COUNTER32(sctps_aborted); if ((SCTP_GET_STATE(stcb) == SCTP_STATE_OPEN) || @@ -4458,6 +4468,8 @@ sctp_abort_an_association(struct sctp_inpcb *inp, struct sctp_tcb *stcb, struct mbuf *op_err, int so_locked) { + struct sctp_gen_error_cause *cause; + uint16_t cause_code; if (stcb == NULL) { /* Got to have a TCB */ @@ -4469,6 +4481,13 @@ sctp_abort_an_association(struct sctp_inpcb *inp, struct sctp_tcb *stcb, } return; } + if (op_err != NULL) { + /* Read the cause code from the error cause. */ + cause = mtod(op_err, struct sctp_gen_error_cause *); + cause_code = ntohs(cause->code); + } else { + cause_code = 0; + } /* notify the peer */ sctp_send_abort_tcb(stcb, op_err, so_locked); SCTP_STAT_INCR_COUNTER32(sctps_aborted); @@ -4478,7 +4497,7 @@ sctp_abort_an_association(struct sctp_inpcb *inp, struct sctp_tcb *stcb, } /* notify the ulp */ if ((inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) == 0) { - sctp_abort_notification(stcb, 0, 0, NULL, so_locked); + sctp_abort_notification(stcb, 0, cause_code, NULL, so_locked); } /* now free the asoc */ #ifdef SCTP_ASOCLOG_OF_TSNS From owner-dev-commits-src-main@freebsd.org Fri Jul 9 12:10:17 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F021665EEFE; Fri, 9 Jul 2021 12:10:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GLsRs67G6z4qlB; Fri, 9 Jul 2021 12:10:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B9729145E5; Fri, 9 Jul 2021 12:10:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 169CAHgl063939; Fri, 9 Jul 2021 12:10:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 169CAHVx063934; Fri, 9 Jul 2021 12:10:17 GMT (envelope-from git) Date: Fri, 9 Jul 2021 12:10:17 GMT Message-Id: <202107091210.169CAHVx063934@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mariusz Zaborski Subject: git: 24c681a7f6d6 - main - grep: fix combination of quite and count flag MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: oshogbo X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 24c681a7f6d6c777221fdbd289da64ff65ad8785 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jul 2021 12:10:18 -0000 The branch main has been updated by oshogbo: URL: https://cgit.FreeBSD.org/src/commit/?id=24c681a7f6d6c777221fdbd289da64ff65ad8785 commit 24c681a7f6d6c777221fdbd289da64ff65ad8785 Author: Mariusz Zaborski AuthorDate: 2021-07-09 12:09:14 +0000 Commit: Mariusz Zaborski CommitDate: 2021-07-09 12:09:14 +0000 grep: fix combination of quite and count flag When the quite (-q) flag is provided, we don't expect any output. Currently, the behavior is broken: $ grep -cq flag util.c 1 $ grep -cs flag util.c 55 First of all, we print a number to stdout. Secondly, it just returns 0 or 1 (which is unexpected). GNU grep with c and q flags doesn't print anything. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D31108 --- usr.bin/grep/util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.bin/grep/util.c b/usr.bin/grep/util.c index a2520e24de8e..698e347c192e 100644 --- a/usr.bin/grep/util.c +++ b/usr.bin/grep/util.c @@ -388,7 +388,7 @@ procfile(const char *fn) clearqueue(); grep_close(f); - if (cflag) { + if (cflag && !qflag) { if (!hflag) printf("%s:", pc.ln.file); printf("%u\n", lines); From owner-dev-commits-src-main@freebsd.org Fri Jul 9 12:17:08 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D245765F189; Fri, 9 Jul 2021 12:17:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GLsbm4wpqz4rLF; Fri, 9 Jul 2021 12:17:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 916701426B; Fri, 9 Jul 2021 12:17:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 169CH8Ev070697; Fri, 9 Jul 2021 12:17:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 169CH8qd070696; Fri, 9 Jul 2021 12:17:08 GMT (envelope-from git) Date: Fri, 9 Jul 2021 12:17:08 GMT Message-Id: <202107091217.169CH8qd070696@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: ce64352a702d - main - sctp: provide consistent stream information in case of early errors MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ce64352a702db1fef8c0e33f3a6f13a3e5d92736 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jul 2021 12:17:08 -0000 The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=ce64352a702db1fef8c0e33f3a6f13a3e5d92736 commit ce64352a702db1fef8c0e33f3a6f13a3e5d92736 Author: Michael Tuexen AuthorDate: 2021-07-09 12:15:22 +0000 Commit: Michael Tuexen CommitDate: 2021-07-09 12:16:59 +0000 sctp: provide consistent stream information in case of early errors While there, make sure the function is called correctly. MFC after: 3 days --- sys/netinet/sctputil.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/sys/netinet/sctputil.c b/sys/netinet/sctputil.c index 1f909fa1d8d4..21e49bdfcb23 100644 --- a/sys/netinet/sctputil.c +++ b/sys/netinet/sctputil.c @@ -3163,6 +3163,8 @@ sctp_notify_assoc_change(uint16_t state, struct sctp_tcb *stcb, uint16_t abort_len; unsigned int i; + KASSERT((abort == NULL) || (from_peer != 0), + ("sctp_notify_assoc_change: ABORT chunk provided for local termination")); if (stcb == NULL) { return; } @@ -3202,9 +3204,13 @@ sctp_notify_assoc_change(uint16_t state, struct sctp_tcb *stcb, sac->sac_length = sizeof(struct sctp_assoc_change); sac->sac_state = state; sac->sac_error = error; - /* XXX verify these stream counts */ - sac->sac_outbound_streams = stcb->asoc.streamoutcnt; - sac->sac_inbound_streams = stcb->asoc.streamincnt; + if (state == SCTP_CANT_STR_ASSOC) { + sac->sac_outbound_streams = 0; + sac->sac_inbound_streams = 0; + } else { + sac->sac_outbound_streams = stcb->asoc.streamoutcnt; + sac->sac_inbound_streams = stcb->asoc.streamincnt; + } sac->sac_assoc_id = sctp_get_associd(stcb); if (notif_len > sizeof(struct sctp_assoc_change)) { if ((state == SCTP_COMM_UP) || (state == SCTP_RESTART)) { From owner-dev-commits-src-main@freebsd.org Fri Jul 9 15:16:53 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1A92E661901; Fri, 9 Jul 2021 15:16:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GLxb90BZnz3rCN; Fri, 9 Jul 2021 15:16:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E28C016EFA; Fri, 9 Jul 2021 15:16:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 169FGqfc011852; Fri, 9 Jul 2021 15:16:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 169FGqte011851; Fri, 9 Jul 2021 15:16:52 GMT (envelope-from git) Date: Fri, 9 Jul 2021 15:16:52 GMT Message-Id: <202107091516.169FGqte011851@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: 1472117a1e1c - main - Support fixed size, variable location acpi resources MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1472117a1e1c40f10b9c3a48788fbf8355588ee8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jul 2021 15:16:53 -0000 The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=1472117a1e1c40f10b9c3a48788fbf8355588ee8 commit 1472117a1e1c40f10b9c3a48788fbf8355588ee8 Author: Andrew Turner AuthorDate: 2021-07-08 15:25:38 +0000 Commit: Andrew Turner CommitDate: 2021-07-09 01:31:19 +0000 Support fixed size, variable location acpi resources These have been found in some Arm ACPI tables generated by edk2, e.g. when describing the pl011 uart on the Arm AEMv8 model. Reviewed by: imp, jkim Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31110 --- sys/dev/acpica/acpi_resource.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/sys/dev/acpica/acpi_resource.c b/sys/dev/acpica/acpi_resource.c index fbd0baaa7d37..2e813276af8f 100644 --- a/sys/dev/acpica/acpi_resource.c +++ b/sys/dev/acpica/acpi_resource.c @@ -421,6 +421,27 @@ acpi_parse_resource(ACPI_RESOURCE *res, void *context) (uintmax_t)min, (uintmax_t)length)); set->set_ioport(dev, arc->context, min, length); } + } else if (res->Data.Address.MinAddressFixed != ACPI_ADDRESS_FIXED && + res->Data.Address.MaxAddressFixed != ACPI_ADDRESS_FIXED) { + /* Fixed size, variable location resource descriptor */ + min = roundup(min, gran + 1); + if ((min + length - 1) > max) { + device_printf(dev, + "invalid memory range: start: %jx end: %jx max: %jx\n", + (uintmax_t)min, (uintmax_t)(min + length - 1), + (uintmax_t)max); + } else { + if (res->Data.Address.ResourceType == ACPI_MEMORY_RANGE) { + ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, + "%s/Memory 0x%jx/%ju\n", name, (uintmax_t)min, + (uintmax_t)length)); + set->set_memory(dev, arc->context, min, length); + } else { + ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, "%s/IO 0x%jx/%ju\n", + name, (uintmax_t)min, (uintmax_t)length)); + set->set_ioport(dev, arc->context, min, length); + } + } } else { if (res->Data.Address32.ResourceType == ACPI_MEMORY_RANGE) { ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, From owner-dev-commits-src-main@freebsd.org Fri Jul 9 17:26:57 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8A27F663BA1; Fri, 9 Jul 2021 17:26:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GM0TF3GxRz4b9w; Fri, 9 Jul 2021 17:26:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 58AB91899A; Fri, 9 Jul 2021 17:26:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 169HQvxR084474; Fri, 9 Jul 2021 17:26:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 169HQvGQ084473; Fri, 9 Jul 2021 17:26:57 GMT (envelope-from git) Date: Fri, 9 Jul 2021 17:26:57 GMT Message-Id: <202107091726.169HQvGQ084473@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 72821668b039 - main - stand/kmem_zalloc: panic when a M_WAITOK allocation fails MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 72821668b039c276914569e9caa1cdfa4e4cb674 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jul 2021 17:26:57 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=72821668b039c276914569e9caa1cdfa4e4cb674 commit 72821668b039c276914569e9caa1cdfa4e4cb674 Author: Warner Losh AuthorDate: 2021-07-09 17:21:18 +0000 Commit: Warner Losh CommitDate: 2021-07-09 17:21:18 +0000 stand/kmem_zalloc: panic when a M_WAITOK allocation fails Malloc() might return NULL, in which case we will panic with a NULL pointer deref. Make it panic when the allocation fails to preserve the postcondtion that we never return a non-NULL value. Reviewed by: tsoome PR: 249859 Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D31106 --- sys/sys/malloc.h | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/sys/sys/malloc.h b/sys/sys/malloc.h index 0c585c5a0dcf..b8c2788edd44 100644 --- a/sys/sys/malloc.h +++ b/sys/sys/malloc.h @@ -298,16 +298,20 @@ extern void *Malloc(size_t bytes, const char *file, int line); * flags mean anything and there's no need declare malloc types. * Define the simple alloc / free routines in terms of Malloc and * Free. None of the kernel features that this stuff disables are needed. - * - * XXX we are setting ourselves up for a potential crash if we can't allocate - * memory for a M_WAITOK call. */ -#define M_WAITOK 0 +#define M_WAITOK 1 #define M_ZERO 0 -#define M_NOWAIT 0 +#define M_NOWAIT 2 #define MALLOC_DECLARE(x) -#define kmem_zalloc(size, flags) Malloc((size), __FILE__, __LINE__) +#define kmem_zalloc(size, flags) ({ \ + void *p = Malloc((size), __FILE__, __LINE__); \ + if (p == NULL && (flags & M_WAITOK) != 0) \ + panic("Could not malloc %zd bytes with M_WAITOK from %s line %d", \ + (size_t)size, __FILE__, __LINE__); \ + p; \ +}) + #define kmem_free(p, size) Free(p, __FILE__, __LINE__) /* @@ -315,5 +319,6 @@ extern void *Malloc(size_t bytes, const char *file, int line); * M_WAITOK. Given the above, it will also be a nop. */ #define KM_SLEEP M_WAITOK +#define KM_NOSLEEP M_NOWAIT #endif /* _STANDALONE */ #endif /* !_SYS_MALLOC_H_ */ From owner-dev-commits-src-main@freebsd.org Fri Jul 9 17:26:58 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CF00C66395A; Fri, 9 Jul 2021 17:26:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GM0TG4sHPz4Zy3; Fri, 9 Jul 2021 17:26:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7B3C918A1A; Fri, 9 Jul 2021 17:26:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 169HQw8C084499; Fri, 9 Jul 2021 17:26:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 169HQwsR084498; Fri, 9 Jul 2021 17:26:58 GMT (envelope-from git) Date: Fri, 9 Jul 2021 17:26:58 GMT Message-Id: <202107091726.169HQwsR084498@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 9e3761d126c5 - main - arm: remove fslsdma from GENERIC MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9e3761d126c5c019d6c935e83989928eb1a0e76e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jul 2021 17:26:59 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=9e3761d126c5c019d6c935e83989928eb1a0e76e commit 9e3761d126c5c019d6c935e83989928eb1a0e76e Author: MIHIRA Sanpei Yoshiro AuthorDate: 2021-07-09 17:12:39 +0000 Commit: Warner Losh CommitDate: 2021-07-09 17:21:40 +0000 arm: remove fslsdma from GENERIC The fslsdma device requires sdma_fw, but that's not included in GENERIC. That firmware is not in the FreeBSD tree at the moment, but could easily be. The license for the firmware can be found in the linux firmware repo: https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/commit/?id=3123d78e09d2f815de4d94aa35c07b3c0469c80e and looks to be a BSD license + no reverse engineer. We can add this back after the firmware is imported, made a port, or whose automatic loading can be made to happen. Reviewed by: imp (with ian finding the license) PR: 237466 MFC after: 1 week --- sys/arm/conf/GENERIC | 1 - 1 file changed, 1 deletion(-) diff --git a/sys/arm/conf/GENERIC b/sys/arm/conf/GENERIC index 427f354d1f93..34876e285f8d 100644 --- a/sys/arm/conf/GENERIC +++ b/sys/arm/conf/GENERIC @@ -258,7 +258,6 @@ device ti_pruss device ti_mbox # DMA controller -device fslsdma device ti_sdma device a10_dmac device a31_dmac From owner-dev-commits-src-main@freebsd.org Fri Jul 9 17:56:23 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 72F83664226; Fri, 9 Jul 2021 17:56:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GM17C2gBNz4f8L; Fri, 9 Jul 2021 17:56:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 439CB191B4; Fri, 9 Jul 2021 17:56:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 169HuNSG024203; Fri, 9 Jul 2021 17:56:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 169HuNf4024202; Fri, 9 Jul 2021 17:56:23 GMT (envelope-from git) Date: Fri, 9 Jul 2021 17:56:23 GMT Message-Id: <202107091756.169HuNf4024202@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gordon Bergling Subject: git: c5cbef2f85e6 - main - math(3): Use the .Fa macro for function arguments MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gbe X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c5cbef2f85e6020ef8357b7d3af3ca228a262309 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jul 2021 17:56:23 -0000 The branch main has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=c5cbef2f85e6020ef8357b7d3af3ca228a262309 commit c5cbef2f85e6020ef8357b7d3af3ca228a262309 Author: Gordon Bergling AuthorDate: 2021-07-09 17:51:44 +0000 Commit: Gordon Bergling CommitDate: 2021-07-09 17:51:44 +0000 math(3): Use the .Fa macro for function arguments .Fa is the suitable macro for functions in comparsion to the .Ar macro, which should be used for commandline arguments. While here, fix some mandoc warnings. Reviewed by: imp (earlier version) Obtained from: OpenBSD (in partial) MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D31090 --- lib/msun/man/acos.3 | 2 +- lib/msun/man/acosh.3 | 4 ++-- lib/msun/man/asin.3 | 2 +- lib/msun/man/asinh.3 | 4 ++-- lib/msun/man/atan2.3 | 16 ++++++++-------- lib/msun/man/atanh.3 | 6 +++--- lib/msun/man/ccos.3 | 2 +- lib/msun/man/ccosh.3 | 2 +- lib/msun/man/exp.3 | 8 ++++---- lib/msun/man/sincos.3 | 6 +++--- lib/msun/man/sqrt.3 | 4 ++-- 11 files changed, 28 insertions(+), 28 deletions(-) diff --git a/lib/msun/man/acos.3 b/lib/msun/man/acos.3 index e0c7e676f5d6..4e75f854c1da 100644 --- a/lib/msun/man/acos.3 +++ b/lib/msun/man/acos.3 @@ -60,7 +60,7 @@ These functions return the arc cosine in the range radians. If: .Bd -unfilled -offset indent -.Pf \&| Ns Ar x Ns \&| > 1 , +.Pf \&| Ns Fa x Ns \&| > 1 , .Ed .Pp .Fn acos x diff --git a/lib/msun/man/acosh.3 b/lib/msun/man/acosh.3 index 6af85f85ddfb..c2943317573c 100644 --- a/lib/msun/man/acosh.3 +++ b/lib/msun/man/acosh.3 @@ -55,13 +55,13 @@ and functions compute the inverse hyperbolic cosine of the real argument -.Ar x . +.Fa x . For a discussion of error due to roundoff, see .Xr math 3 . .Sh RETURN VALUES These functions return the inverse hyperbolic cosine of -.Ar x . +.Fa x . If the argument is less than 1, .Fn acosh raises an invalid exception and returns an \*(Na. diff --git a/lib/msun/man/asin.3 b/lib/msun/man/asin.3 index 8bb3c3be66ec..15c181bd8d1f 100644 --- a/lib/msun/man/asin.3 +++ b/lib/msun/man/asin.3 @@ -62,7 +62,7 @@ These functions return the arc sine in the range radians. If: .Bd -unfilled -offset indent -.Pf \&| Ns Ar x Ns \&| > 1 +.Pf \&| Ns Fa x Ns \&| > 1 .Ed .Pp .Fn asin x diff --git a/lib/msun/man/asinh.3 b/lib/msun/man/asinh.3 index 38b33175dd2a..c2181dc49d32 100644 --- a/lib/msun/man/asinh.3 +++ b/lib/msun/man/asinh.3 @@ -55,13 +55,13 @@ and functions compute the inverse hyperbolic sine of the real argument -.Ar x . +.Fa x . For a discussion of error due to roundoff, see .Xr math 3 . .Sh RETURN VALUES These functions return the inverse hyperbolic sine of -.Ar x . +.Fa x . .Sh SEE ALSO .Xr acosh 3 , .Xr atanh 3 , diff --git a/lib/msun/man/atan2.3 b/lib/msun/man/atan2.3 index 59c8a0e3de36..307dadd1a628 100644 --- a/lib/msun/man/atan2.3 +++ b/lib/msun/man/atan2.3 @@ -63,7 +63,7 @@ The and .Fn atan2l functions compute the principal value of the arc tangent of -.Fa y/ Ns Ar x , +.Fa y/ Ns Fa x , using the signs of both arguments to determine the quadrant of the return value. .Pp @@ -94,7 +94,7 @@ and .Fn atan2l functions, if successful, return the arc tangent of -.Fa y/ Ns Ar x +.Fa y/ Ns Fa x in the range .Bk -words .Bq \&- Ns \*(Pi , \&+ Ns \*(Pi @@ -105,22 +105,22 @@ Here are some of the special cases: .It Fn atan2 y x No := Ta .Fn atan y/x Ta if -.Ar x +.Fa x > 0, -.It Ta sign( Ns Ar y Ns )*(\*(Pi - +.It Ta sign( Ns Fa y Ns )*(\*(Pi - .Fn atan "\*(Bay/x\*(Ba" ) Ta if -.Ar x +.Fa x < 0, .It Ta .No 0 Ta if x = y = 0, or .It Ta -.Pf sign( Ar y Ns )*\*(Pi/2 Ta +.Pf sign( Fa y Ns )*\*(Pi/2 Ta if -.Ar x +.Fa x = 0 \(!= -.Ar y . +.Fa y . .El .Sh NOTES The function diff --git a/lib/msun/man/atanh.3 b/lib/msun/man/atanh.3 index 5c3bb7e30f16..5984ee89337e 100644 --- a/lib/msun/man/atanh.3 +++ b/lib/msun/man/atanh.3 @@ -55,18 +55,18 @@ and functions compute the inverse hyperbolic tangent of the real argument -.Ar x . +.Fa x . For a discussion of error due to roundoff, see .Xr math 3 . .Sh RETURN VALUES These functions return the inverse hyperbolic tangent of -.Ar x +.Fa x if successful. If the argument has absolute value 1, a divide-by-zero exception is raised and an infinity is returned. If -.Ar |x| +.Fa |x| > 1, an invalid exception is raised and an \*(Na is returned. .Sh SEE ALSO .Xr acosh 3 , diff --git a/lib/msun/man/ccos.3 b/lib/msun/man/ccos.3 index c07205e6d91d..2c66b6b1b9cf 100644 --- a/lib/msun/man/ccos.3 +++ b/lib/msun/man/ccos.3 @@ -31,7 +31,7 @@ .Nm ccos , .Nm ccosf , .Nm csin , -.Nm csinf +.Nm csinf , .Nm ctan , .Nm ctanf .Nd complex trigonometric functions diff --git a/lib/msun/man/ccosh.3 b/lib/msun/man/ccosh.3 index f006442cdc1d..748b5429b072 100644 --- a/lib/msun/man/ccosh.3 +++ b/lib/msun/man/ccosh.3 @@ -31,7 +31,7 @@ .Nm ccosh , .Nm ccoshf , .Nm csinh , -.Nm csinhf +.Nm csinhf , .Nm ctanh , .Nm ctanhf .Nd complex hyperbolic functions diff --git a/lib/msun/man/exp.3 b/lib/msun/man/exp.3 index 2244bfac375a..ee43081bad83 100644 --- a/lib/msun/man/exp.3 +++ b/lib/msun/man/exp.3 @@ -108,9 +108,9 @@ and the .Fn powl functions compute the value of -.Ar x +.Fa x to the exponent -.Ar y . +.Fa y . .Sh ERROR (due to Roundoff etc.) The values of .Fn exp 0 , @@ -181,8 +181,8 @@ then \*(Na**0 = 1 too because x**0 = 1 for all finite and infinite x, i.e., independently of x. .El .Sh SEE ALSO -.Xr clog 3 -.Xr cpow 3 +.Xr clog 3 , +.Xr cpow 3 , .Xr fenv 3 , .Xr ldexp 3 , .Xr log 3 , diff --git a/lib/msun/man/sincos.3 b/lib/msun/man/sincos.3 index 7d44bea931b1..eecccf3cf37a 100644 --- a/lib/msun/man/sincos.3 +++ b/lib/msun/man/sincos.3 @@ -67,13 +67,13 @@ Upon returning from and .Fn sincosl , the memory pointed to by -.Ar "*s" +.Fa "*s" and -.Ar "*c" +.Fa "*c" are assigned the values of sine and cosine, respectively. .Sh SEE ALSO .Xr cos 3 , -.Xr sin 3 , +.Xr sin 3 .Sh HISTORY These functions were added to .Fx 9.0 diff --git a/lib/msun/man/sqrt.3 b/lib/msun/man/sqrt.3 index bf6c3436cdbf..8214f8a2a7fb 100644 --- a/lib/msun/man/sqrt.3 +++ b/lib/msun/man/sqrt.3 @@ -63,7 +63,7 @@ and .Fn cbrtl functions compute the cube root of -.Ar x . +.Fa x . .Pp The .Fn sqrt , @@ -72,7 +72,7 @@ and .Fn sqrtl functions compute the non-negative square root of -.Ar x . +.Fa x . .Sh RETURN VALUES The .Fn cbrt , From owner-dev-commits-src-main@freebsd.org Fri Jul 9 19:34:39 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 53A1C6653E7; Fri, 9 Jul 2021 19:34:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GM3Jb1f2fz4v6N; Fri, 9 Jul 2021 19:34:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1C51C1A618; Fri, 9 Jul 2021 19:34:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 169JYcLe057364; Fri, 9 Jul 2021 19:34:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 169JYcWt057363; Fri, 9 Jul 2021 19:34:38 GMT (envelope-from git) Date: Fri, 9 Jul 2021 19:34:38 GMT Message-Id: <202107091934.169JYcWt057363@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 82626fef6253 - main - iichid(4): Perform bus_teardown_intr/bus_setup_intr to disable interrupts MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 82626fef6253a9172163df137097f54e93e3c209 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jul 2021 19:34:39 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=82626fef6253a9172163df137097f54e93e3c209 commit 82626fef6253a9172163df137097f54e93e3c209 Author: Vladimir Kondratyev AuthorDate: 2021-07-09 19:32:59 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-07-09 19:32:59 +0000 iichid(4): Perform bus_teardown_intr/bus_setup_intr to disable interrupts during suspend/resume cycle. Previously used bus_generic_suspend_intr and bus_generic_resume_intr may cause interrupt storm because of missed interrupt acknowledges caused by blocking of intr handler. Reported by: J.R. Oldroyd MFC after: 1 week --- sys/dev/iicbus/iichid.c | 47 +++++++++++++++++++++++++++++++++++------------ 1 file changed, 35 insertions(+), 12 deletions(-) diff --git a/sys/dev/iicbus/iichid.c b/sys/dev/iicbus/iichid.c index 68d7cfd9090f..d95ffb8add88 100644 --- a/sys/dev/iicbus/iichid.c +++ b/sys/dev/iicbus/iichid.c @@ -177,6 +177,7 @@ struct iichid_softc { struct task event_task; #endif + struct task suspend_task; bool open; /* iicbus lock */ bool suspend; /* iicbus lock */ bool power_on; /* iicbus lock */ @@ -188,6 +189,8 @@ static device_detach_t iichid_detach; static device_resume_t iichid_resume; static device_suspend_t iichid_suspend; +static void iichid_suspend_task(void *, int); + #ifdef IICHID_SAMPLING static int iichid_setup_callout(struct iichid_softc *); static int iichid_reset_callout(struct iichid_softc *); @@ -1075,6 +1078,7 @@ iichid_attach(device_t dev) sc->power_on = true; + TASK_INIT(&sc->suspend_task, 0, iichid_suspend_task, sc); #ifdef IICHID_SAMPLING TASK_INIT(&sc->event_task, 0, iichid_event_task, sc); /* taskqueue_create can't fail with M_WAITOK mflag passed. */ @@ -1146,7 +1150,6 @@ iichid_attach(device_t dev) device_printf(dev, "failed to attach child: error %d\n", error); iichid_detach(dev); } - done: (void)iichid_set_power(sc, I2C_HID_POWER_OFF); sc->power_on = false; @@ -1175,6 +1178,14 @@ iichid_detach(device_t dev) return (0); } +static void +iichid_suspend_task(void *context, int pending) +{ + struct iichid_softc *sc = context; + + iichid_teardown_interrupt(sc); +} + static int iichid_suspend(device_t dev) { @@ -1183,12 +1194,6 @@ iichid_suspend(device_t dev) sc = device_get_softc(dev); (void)bus_generic_suspend(dev); -#ifdef IICHID_SAMPLING - if (sc->sampling_rate_slow < 0) -#endif - (void)bus_generic_suspend_intr(device_get_parent(dev), dev, - sc->irq_res); - /* * 8.2 - The HOST is going into a deep power optimized state and wishes * to put all the devices into a low power state also. The HOST @@ -1202,6 +1207,24 @@ iichid_suspend(device_t dev) else DPRINTF(sc, "Successfully set power_state\n"); +#ifdef IICHID_SAMPLING + if (sc->sampling_rate_slow < 0) +#endif + { + /* + * bus_teardown_intr can not be executed right here as it wants + * to run on certain CPU to interacts with LAPIC while suspend + * thread is bound to CPU0. So run it from taskqueue context. + */ +#ifdef IICHID_SAMPLING +#define suspend_thread sc->taskqueue +#else +#define suspend_thread taskqueue_thread +#endif + taskqueue_enqueue(suspend_thread, &sc->suspend_task); + taskqueue_drain(suspend_thread, &sc->suspend_task); + } + return (0); } @@ -1212,6 +1235,11 @@ iichid_resume(device_t dev) int error; sc = device_get_softc(dev); +#ifdef IICHID_SAMPLING + if (sc->sampling_rate_slow < 0) +#endif + iichid_setup_interrupt(sc); + DPRINTF(sc, "Resume called, setting device to power_state 0\n"); error = iichid_set_power_state(sc, IICHID_PS_NULL, IICHID_PS_ON); if (error != 0) @@ -1219,11 +1247,6 @@ iichid_resume(device_t dev) else DPRINTF(sc, "Successfully set power_state\n"); (void)bus_generic_resume(dev); -#ifdef IICHID_SAMPLING - if (sc->sampling_rate_slow < 0) -#endif - (void)bus_generic_resume_intr(device_get_parent(dev), dev, - sc->irq_res); return (0); } From owner-dev-commits-src-main@freebsd.org Fri Jul 9 19:54:27 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9AE216656A5 for ; Fri, 9 Jul 2021 19:54:27 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qt1-x82e.google.com (mail-qt1-x82e.google.com [IPv6:2607:f8b0:4864:20::82e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GM3lR3RyMz3DCP for ; Fri, 9 Jul 2021 19:54:27 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-qt1-x82e.google.com with SMTP id x24so8392994qts.11 for ; Fri, 09 Jul 2021 12:54:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=7VXe/T725BhUcviId67HBLTEjgIEQSFSJdaeow7whlk=; b=DQVwCxIVXGVFpTtz0XqbECcJwz94PPV94FGhV6vTL6QEH9hjOlTYh/MDs3FVQ89oWM Ty1hIGgjPPBwP0JLYiU2dFPlLNLp1Ceqbi0VJQJxCD+YyYO6nuCn5M7GY5D9hI5mOgp/ b5zTpfz2/WGc5Gca6hgFY780cqTABjHLbS3QCMjZrvAV1+CATDoZrd04ytnTmGqBRmfn 8Jq+leC+iClswRcOojQP6ZBsNOuGjL67lDA3MfpvmIlPR4XkUlT2nvy3pCyMBBk+Giay t+oodPAb03W/UrOCvzkD+W1TB2CIqhxahKbX29i8gcEl7w0T0fLYjVrGiZhBi1buo/Tf 5pVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=7VXe/T725BhUcviId67HBLTEjgIEQSFSJdaeow7whlk=; b=jqq8jxcWi4+e8vqXx9B0Ld8WPsDs/Yurwdbx3lWkwae03CSElPdiVrzYU9WxMZeNET WZTKfTmpJnpD0f866vAi5tXzcPY+fcExiY4Uqx7UcSr9aHEvHJ5Ba67ywYgLC2UG880W hUdyIWc/7I0eqAJpP1Q3JgnZnrF4HwBAno6JppmZiefQLhOJ/vFyHToY5lrW2ly2iX7t hxE0cE13CxrsuwK4LfQu+WAcWllW40GVIEHLko873t5aiX+x6i9Q0RLzACq1WdQ7VexR XnV5saAScW7vL4n+PZc7WNb2Bd3C9jWJ0jxmzm+9lnyEF9vraYJjsNQic88utSqh0Orq bB6Q== X-Gm-Message-State: AOAM532YRlC4i9OhE8EMNBDLZZfJVm4BlxzM8kgFIpwVQk7hu1b3AbeY uYStmqmPOWvAd4s2GHGQzyfzeA== X-Google-Smtp-Source: ABdhPJzAp06cIY49U8j4hLKsIYbvf2KhUc7rIdOpkkDNPJ4167WFHp+CVBd27HneflKLoMMLjHkYDw== X-Received: by 2002:ac8:5314:: with SMTP id t20mr2842703qtn.235.1625860466668; Fri, 09 Jul 2021 12:54:26 -0700 (PDT) Received: from mutt-hbsd (pool-100-16-224-136.bltmmd.fios.verizon.net. [100.16.224.136]) by smtp.gmail.com with ESMTPSA id d26sm480810qka.107.2021.07.09.12.54.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Jul 2021 12:54:26 -0700 (PDT) Date: Fri, 9 Jul 2021 15:54:25 -0400 From: Shawn Webb To: Warner Losh Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 72821668b039 - main - stand/kmem_zalloc: panic when a M_WAITOK allocation fails Message-ID: <20210709195425.xzk2azaor4ielmb4@mutt-hbsd> X-Operating-System: FreeBSD mutt-hbsd 14.0-CURRENT-HBSD FreeBSD 14.0-CURRENT-HBSD X-PGP-Key: https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/blob/master/Shawn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc References: <202107091726.169HQvGQ084473@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="bbnarx7wbuksohxs" Content-Disposition: inline In-Reply-To: <202107091726.169HQvGQ084473@gitrepo.freebsd.org> X-Rspamd-Queue-Id: 4GM3lR3RyMz3DCP X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jul 2021 19:54:27 -0000 --bbnarx7wbuksohxs Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jul 09, 2021 at 05:26:57PM +0000, Warner Losh wrote: > The branch main has been updated by imp: >=20 > URL: https://cgit.FreeBSD.org/src/commit/?id=3D72821668b039c276914569e9ca= a1cdfa4e4cb674 >=20 > commit 72821668b039c276914569e9caa1cdfa4e4cb674 > Author: Warner Losh > AuthorDate: 2021-07-09 17:21:18 +0000 > Commit: Warner Losh > CommitDate: 2021-07-09 17:21:18 +0000 >=20 > stand/kmem_zalloc: panic when a M_WAITOK allocation fails > =20 > Malloc() might return NULL, in which case we will panic with a NULL > pointer deref. Make it panic when the allocation fails to preserve the > postcondtion that we never return a non-NULL value. malloc(9) tells us that M_WAITOK will never fail. I'm thinking this conditional might need to be negated for the !M_WAITOK case, in which malloc(9) could indeed fail. Although, even as I type this email, I just realized that a different function, Malloc, is being called. What's the difference between malloc and Malloc? Thanks, --=20 Shawn Webb Cofounder / Security Engineer HardenedBSD https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/raw/master/Shawn_Webb/03A= 4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc --bbnarx7wbuksohxs Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAmDoqXEACgkQ/y5nonf4 4fpiPQ/9GhtOSJy3+Stl9jkeS3ZoT03rPiQouKWNEyS3PqbPJ9LYN2xT66FVDViJ ZYQ/fjH27lDikBOExbvO70ykU5D9HBgjmvqkrG8sQKbCwJzGE9gy4l0uNTdA4Lm7 fOic36syucTSeKwvWq7ptYMyz75/fSxovIoyH9uPB4oL6bZzjjuhYk1Z3XnglVG8 MJhqvpzz77ORjiuymB1QbZSq7a1F79jPcRMC0cK6xm4BmLPn+Brw/+eviQ4vr160 0L9ZfR/NA0XUgC9tDwfDgGjYQVRsZ3Xl8B8M9UXybbPHQMRyunWupfU4+Gln2AVH X6Rt6aeuvBA46gBp+/ea8NatGDWYZLPAfGNe54oS8LGj3Db1e2LayEyLDSguTzWL AgY1p0fnNdF4YAfY8HIoTmP7PvYwFjUNpL4MXAjeotWWMKoaIXtbWBFfYmxmfbZx ep2/S8jenXYK0SmG5ky9+P5YJCNdKpeg5/b5LsApOoegme6LFTd2uAN1Dg33ipvH VfxX7B35dqlFqR6gGBUJm3MzOJF1kR7L5cZR/BWHIJ1Y9ZPzZ0xeaZ8OJrKjhQOm QoATgJ2ouHUxXO1vLETJxRiwoKfzOxaMOitbXblU014bAr3YojzZ7KCj0ipFvdn/ t4y+Q2dsEMcZtRKvv94vdcCgx/QUcFJoFksELQisLfs4vd9/QpY= =NObg -----END PGP SIGNATURE----- --bbnarx7wbuksohxs-- From owner-dev-commits-src-main@freebsd.org Fri Jul 9 20:34:25 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E2ACF665F27 for ; Fri, 9 Jul 2021 20:34:25 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qt1-x82a.google.com (mail-qt1-x82a.google.com [IPv6:2607:f8b0:4864:20::82a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GM4dY5rtRz3J4f for ; Fri, 9 Jul 2021 20:34:25 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qt1-x82a.google.com with SMTP id z18so5157737qtq.8 for ; Fri, 09 Jul 2021 13:34:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=dqPoCulu499GOXS7I1BI3tFTyc/v6/IzhGnfpiTpAEo=; b=K5rnQgkFSaRY68QX4c2wzNWKQF+rf+pLwLzrAyX1affrdaBtf3ofWhN2XJzgXSiIXJ QXE/j14W/Fos22dHp+Fg+bLnCdTTrbr0ldVtk5VQMp1keM64zPauSwMhnjWFEQAZbglh 1qXUOk5xe+Ca+2nikEf6oioxqSyUh4mJSt+vAo2L+pEqB5HAdmJg5LRB6zPs8juBdgL6 6pnODUMlxZfpv8v1FB4fqnfO/6vWGkBt9cf683mcatGsRnoFCrJbpWWHt1Ygt8Qer7kN 2B3c/eEHjX5uuclVh2hNkDPVoWGB1jjjN7UzNVnt2NSHTmGPbOooCIoU4J5dlRiFvoAN ebdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=dqPoCulu499GOXS7I1BI3tFTyc/v6/IzhGnfpiTpAEo=; b=NmQyP/v+U4pVueWvwI7a+d+a3FiVmea+tG9asd+zfl8LIX8aju+n6PlbmmV9w7yAeo 3+bo7jVofRjjBCMvNtyDHnma1SrXNO89z7sdLAH5/Zsiybqi1d7nwyqhO6vmPpNC4Is5 5yTTf/erpGfXo8kjftY/alQw+aRrP4F5Wpz63Bm94WEr/eMPCmmm599d6XZJj51gXtbj KuoJYiZ9pCYXgJf5KmM356KBuAYNdr3ueOaX2Y7jBDf8r2aPqPJksO5J9dRRZ4JIbUMg OBt05a1o86uUKEgK/4SrnhmXaYU0WrPNelJG4QhoDpmRhulfc2ZIyVx1MRtkQGGkR0iC QQiA== X-Gm-Message-State: AOAM533dbDvjGK44G++r/QtH93NydDbxnWLLPJo0rNJ7vbTHz2kOFvIr DnbgSHR2MK3bHn3hOYt+Nwvv9fqut2OJxv2oeHugVA== X-Google-Smtp-Source: ABdhPJytaDHZKCZVmivilBF8V8wxh5TdKen4IqRB554rcVUFsDk6pSLtb8GYpNwIkgmSas9fHyanT+H+V4sJXbq3giE= X-Received: by 2002:ac8:5314:: with SMTP id t20mr2982637qtn.235.1625862864517; Fri, 09 Jul 2021 13:34:24 -0700 (PDT) MIME-Version: 1.0 References: <202107091726.169HQvGQ084473@gitrepo.freebsd.org> <20210709195425.xzk2azaor4ielmb4@mutt-hbsd> In-Reply-To: <20210709195425.xzk2azaor4ielmb4@mutt-hbsd> From: Warner Losh Date: Fri, 9 Jul 2021 14:34:12 -0600 Message-ID: Subject: Re: git: 72821668b039 - main - stand/kmem_zalloc: panic when a M_WAITOK allocation fails To: Shawn Webb Cc: Warner Losh , src-committers , "" , dev-commits-src-main@freebsd.org X-Rspamd-Queue-Id: 4GM4dY5rtRz3J4f X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jul 2021 20:34:26 -0000 On Fri, Jul 9, 2021 at 1:54 PM Shawn Webb wrote: > On Fri, Jul 09, 2021 at 05:26:57PM +0000, Warner Losh wrote: > > The branch main has been updated by imp: > > > > URL: > https://cgit.FreeBSD.org/src/commit/?id=72821668b039c276914569e9caa1cdfa4e4cb674 > > > > commit 72821668b039c276914569e9caa1cdfa4e4cb674 > > Author: Warner Losh > > AuthorDate: 2021-07-09 17:21:18 +0000 > > Commit: Warner Losh > > CommitDate: 2021-07-09 17:21:18 +0000 > > > > stand/kmem_zalloc: panic when a M_WAITOK allocation fails > > > > Malloc() might return NULL, in which case we will panic with a NULL > > pointer deref. Make it panic when the allocation fails to preserve > the > > postcondtion that we never return a non-NULL value. > > malloc(9) tells us that M_WAITOK will never fail. I'm thinking this > conditional might need to be negated for the !M_WAITOK case, in which > malloc(9) could indeed fail. > > Although, even as I type this email, I just realized that a different > function, Malloc, is being called. What's the difference between > malloc and Malloc? > The block of code is to be used in the standalone environment. The Malloc() function there doesn't have wait/nowait variants and can fail (though in the boot loader, that almost never happens except when there's a bug). The code is for wrappers around kmem_zalloc which is the OpenZFS spelling of malloc. It assumes that kmem_zalloc with M_WAITOK will never return NULL, so it never checks. This changes a weird panic when the returned NULL pointer is dereferenced, to an orderly panic when the malloc that the code assumes will never fail actuall fails. This at least gives better context of where the error happened and what the error was. In practice, this is a big nop, but we have had issues with other Malloc calls in the past failing because of bugs that caused us to ask for a ridiculous amount of memory. Make sense? Warner From owner-dev-commits-src-main@freebsd.org Fri Jul 9 21:19:41 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7BC946665C2; Fri, 9 Jul 2021 21:19:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GM5dn36J7z3NqG; Fri, 9 Jul 2021 21:19:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4F0351BD65; Fri, 9 Jul 2021 21:19:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 169LJfZU090840; Fri, 9 Jul 2021 21:19:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 169LJfSb090839; Fri, 9 Jul 2021 21:19:41 GMT (envelope-from git) Date: Fri, 9 Jul 2021 21:19:41 GMT Message-Id: <202107092119.169LJfSb090839@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: 105b68b42dd1 - main - sctp: Fix errno in case of association setup failures MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 105b68b42dd11bce5c554b1ef0ddf73aa069d7da Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jul 2021 21:19:41 -0000 The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=105b68b42dd11bce5c554b1ef0ddf73aa069d7da commit 105b68b42dd11bce5c554b1ef0ddf73aa069d7da Author: Michael Tuexen AuthorDate: 2021-07-09 21:17:35 +0000 Commit: Michael Tuexen CommitDate: 2021-07-09 21:19:25 +0000 sctp: Fix errno in case of association setup failures Do not report always ETIMEDOUT, but only when appropriate. In other cases report ECONNABORTED. MFC after: 3 days --- sys/netinet/sctp_asconf.c | 2 +- sys/netinet/sctp_constants.h | 1 + sys/netinet/sctp_indata.c | 34 ++++++++++++++--------------- sys/netinet/sctp_input.c | 8 +++---- sys/netinet/sctp_output.c | 10 ++++----- sys/netinet/sctp_pcb.c | 4 ++-- sys/netinet/sctp_timer.c | 4 ++-- sys/netinet/sctp_usrreq.c | 4 ++-- sys/netinet/sctputil.c | 52 ++++++++++++++++++++++++++++---------------- sys/netinet/sctputil.h | 4 ++-- sys/netinet6/sctp6_usrreq.c | 2 +- 11 files changed, 70 insertions(+), 55 deletions(-) diff --git a/sys/netinet/sctp_asconf.c b/sys/netinet/sctp_asconf.c index c06ddf7b1f2e..0915e187ee40 100644 --- a/sys/netinet/sctp_asconf.c +++ b/sys/netinet/sctp_asconf.c @@ -1704,7 +1704,7 @@ sctp_handle_asconf_ack(struct mbuf *m, int offset, SCTPDBG(SCTP_DEBUG_ASCONF1, "handle_asconf_ack: got unexpected next serial number! Aborting asoc!\n"); SCTP_SNPRINTF(msg, sizeof(msg), "Never sent serial number %8.8x", serial_num); op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); - sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, false, SCTP_SO_NOT_LOCKED); *abort_no_unlock = 1; return; } diff --git a/sys/netinet/sctp_constants.h b/sys/netinet/sctp_constants.h index 197b93791944..1ff3f3918ef6 100644 --- a/sys/netinet/sctp_constants.h +++ b/sys/netinet/sctp_constants.h @@ -716,6 +716,7 @@ __FBSDID("$FreeBSD$"); #define SCTP_NOTIFY_NO_PEER_AUTH 25 #define SCTP_NOTIFY_SENDER_DRY 26 #define SCTP_NOTIFY_REMOTE_ERROR 27 +#define SCTP_NOTIFY_ASSOC_TIMEDOUT 28 /* This is the value for messages that are NOT completely * copied down where we will start to split the message. diff --git a/sys/netinet/sctp_indata.c b/sys/netinet/sctp_indata.c index 6997a0099c88..fb1327a94475 100644 --- a/sys/netinet/sctp_indata.c +++ b/sys/netinet/sctp_indata.c @@ -444,7 +444,7 @@ sctp_abort_in_reasm(struct sctp_tcb *stcb, chk->data = NULL; sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED); stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_1; - sctp_abort_an_association(stcb->sctp_ep, stcb, oper, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(stcb->sctp_ep, stcb, oper, false, SCTP_SO_NOT_LOCKED); *abort_flag = 1; } @@ -533,7 +533,7 @@ sctp_queue_data_to_stream(struct sctp_tcb *stcb, } op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_2; - sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, false, SCTP_SO_NOT_LOCKED); *abort_flag = 1; return; } @@ -623,7 +623,7 @@ sctp_queue_data_to_stream(struct sctp_tcb *stcb, sctp_clean_up_control(stcb, control); op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_3; - sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, false, SCTP_SO_NOT_LOCKED); *abort_flag = 1; } } @@ -1745,7 +1745,7 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc, */ op_err = sctp_generate_no_user_data_cause(tsn); stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_16; - sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, false, SCTP_SO_NOT_LOCKED); *abort_flag = 1; return (0); } @@ -1811,7 +1811,7 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc, * receiver. Send peer an ABORT! */ op_err = sctp_generate_cause(SCTP_CAUSE_OUT_OF_RESC, ""); - sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, false, SCTP_SO_NOT_LOCKED); *abort_flag = 1; return (0); } @@ -1882,7 +1882,7 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc, err_out: op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_17; - sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, false, SCTP_SO_NOT_LOCKED); *abort_flag = 1; return (0); } @@ -2017,7 +2017,7 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc, } op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_18; - sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, false, SCTP_SO_NOT_LOCKED); *abort_flag = 1; return (0); } @@ -2736,7 +2736,7 @@ sctp_process_data(struct mbuf **mm, int iphlen, int *offset, int length, SCTP_SNPRINTF(msg, sizeof(msg), "%s", "DATA chunk received when I-DATA was negotiated"); op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_21; - sctp_abort_an_association(inp, stcb, op_err, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(inp, stcb, op_err, false, SCTP_SO_NOT_LOCKED); return (2); } if ((asoc->idata_supported == 0) && @@ -2747,7 +2747,7 @@ sctp_process_data(struct mbuf **mm, int iphlen, int *offset, int length, SCTP_SNPRINTF(msg, sizeof(msg), "%s", "I-DATA chunk received when DATA was negotiated"); op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_22; - sctp_abort_an_association(inp, stcb, op_err, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(inp, stcb, op_err, false, SCTP_SO_NOT_LOCKED); return (2); } if ((ch->chunk_type == SCTP_DATA) || @@ -2772,7 +2772,7 @@ sctp_process_data(struct mbuf **mm, int iphlen, int *offset, int length, chk_length); op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_23; - sctp_abort_an_association(inp, stcb, op_err, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(inp, stcb, op_err, false, SCTP_SO_NOT_LOCKED); return (2); } #ifdef SCTP_AUDITING_ENABLED @@ -2841,7 +2841,7 @@ sctp_process_data(struct mbuf **mm, int iphlen, int *offset, int length, SCTP_SNPRINTF(msg, sizeof(msg), "DATA chunk followed by chunk of type %2.2x", ch->chunk_type); op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); - sctp_abort_an_association(inp, stcb, op_err, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(inp, stcb, op_err, false, SCTP_SO_NOT_LOCKED); return (2); } default: @@ -2860,7 +2860,7 @@ sctp_process_data(struct mbuf **mm, int iphlen, int *offset, int length, SCTP_SNPRINTF(msg, sizeof(msg), "Chunk of length %u", chk_length); op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_24; - sctp_abort_an_association(inp, stcb, op_err, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(inp, stcb, op_err, false, SCTP_SO_NOT_LOCKED); return (2); } if (ch->chunk_type & 0x40) { @@ -4003,7 +4003,7 @@ sctp_express_handle_sack(struct sctp_tcb *stcb, uint32_t cumack, cumack, send_s); op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_25; - sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, false, SCTP_SO_NOT_LOCKED); return; } asoc->this_sack_highest_gap = cumack; @@ -4308,7 +4308,7 @@ again: /* XXX */ op_err = sctp_generate_cause(SCTP_CAUSE_USER_INITIATED_ABT, ""); stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_28; - sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, false, SCTP_SO_NOT_LOCKED); return; } if ((asoc->state & SCTP_STATE_SHUTDOWN_PENDING) && @@ -4524,7 +4524,7 @@ hopeless_peer: cum_ack, send_s); op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_29; - sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, false, SCTP_SO_NOT_LOCKED); return; } /**********************/ @@ -4985,7 +4985,7 @@ hopeless_peer: /* XXX */ op_err = sctp_generate_cause(SCTP_CAUSE_USER_INITIATED_ABT, ""); stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_35; - sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, false, SCTP_SO_NOT_LOCKED); return; } if ((asoc->state & SCTP_STATE_SHUTDOWN_PENDING) && @@ -5533,7 +5533,7 @@ sctp_handle_forward_tsn(struct sctp_tcb *stcb, new_cum_tsn, asoc->highest_tsn_inside_map); op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_37; - sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, false, SCTP_SO_NOT_LOCKED); return; } SCTP_STAT_INCR(sctps_fwdtsn_map_over); diff --git a/sys/netinet/sctp_input.c b/sys/netinet/sctp_input.c index 6a0b5d41052a..ed15b81ba3e5 100644 --- a/sys/netinet/sctp_input.c +++ b/sys/netinet/sctp_input.c @@ -414,7 +414,7 @@ sctp_process_init_ack(struct mbuf *m, int iphlen, int offset, &nat_friendly, &cookie_found); if (abort_flag) { /* Send an abort and notify peer */ - sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, false, SCTP_SO_NOT_LOCKED); *abort_no_unlock = 1; return (-1); } @@ -785,7 +785,7 @@ sctp_handle_abort(struct sctp_abort_chunk *abort, sctp_timer_stop(SCTP_TIMER_TYPE_RECV, stcb->sctp_ep, stcb, NULL, SCTP_FROM_SCTP_INPUT + SCTP_LOC_7); /* notify user of the abort and clean up... */ - sctp_abort_notification(stcb, 1, error, abort, SCTP_SO_NOT_LOCKED); + sctp_abort_notification(stcb, true, false, error, abort, SCTP_SO_NOT_LOCKED); /* free the tcb */ SCTP_STAT_INCR_COUNTER32(sctps_aborted); if ((SCTP_GET_STATE(stcb) == SCTP_STATE_OPEN) || @@ -1140,7 +1140,7 @@ sctp_handle_error(struct sctp_chunkhdr *ch, asoc->stale_cookie_count++; if (asoc->stale_cookie_count > asoc->max_init_times) { - sctp_abort_notification(stcb, 0, 0, NULL, SCTP_SO_NOT_LOCKED); + sctp_abort_notification(stcb, false, true, 0, NULL, SCTP_SO_NOT_LOCKED); /* now free the asoc */ (void)sctp_free_assoc(stcb->sctp_ep, stcb, SCTP_NORMAL_PROC, SCTP_FROM_SCTP_INPUT + SCTP_LOC_12); @@ -5106,7 +5106,7 @@ process_control_chunks: SCTP_SNPRINTF(msg, sizeof(msg), "%s", "I-FORWARD-TSN chunk received when FORWARD-TSN was negotiated"); } op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); - sctp_abort_an_association(inp, stcb, op_err, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(inp, stcb, op_err, false, SCTP_SO_NOT_LOCKED); *offset = length; return (NULL); } diff --git a/sys/netinet/sctp_output.c b/sys/netinet/sctp_output.c index c69db88f7d7d..e34534e80fa3 100644 --- a/sys/netinet/sctp_output.c +++ b/sys/netinet/sctp_output.c @@ -6631,7 +6631,7 @@ sctp_sendall_iterator(struct sctp_inpcb *inp, struct sctp_tcb *stcb, void *ptr, * us. */ atomic_add_int(&stcb->asoc.refcnt, 1); - sctp_abort_an_association(inp, stcb, m, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(inp, stcb, m, false, SCTP_SO_NOT_LOCKED); /* * sctp_abort_an_association calls sctp_free_asoc() free * association will NOT free it since we incremented the @@ -6715,7 +6715,7 @@ sctp_sendall_iterator(struct sctp_inpcb *inp, struct sctp_tcb *stcb, void *ptr, msg); atomic_add_int(&stcb->asoc.refcnt, 1); sctp_abort_an_association(stcb->sctp_ep, stcb, - op_err, SCTP_SO_NOT_LOCKED); + op_err, false, SCTP_SO_NOT_LOCKED); atomic_add_int(&stcb->asoc.refcnt, -1); goto no_chunk_output; } @@ -9555,7 +9555,7 @@ sctp_chunk_retransmission(struct sctp_inpcb *inp, msg); atomic_add_int(&stcb->asoc.refcnt, 1); sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, - so_locked); + false, so_locked); SCTP_TCB_LOCK(stcb); atomic_subtract_int(&stcb->asoc.refcnt, 1); return (SCTP_RETRAN_EXIT); @@ -12967,7 +12967,7 @@ sctp_lower_sosend(struct socket *so, free_cnt_applied = 0; /* release this lock, otherwise we hang on ourselves */ NET_EPOCH_ENTER(et); - sctp_abort_an_association(stcb->sctp_ep, stcb, mm, SCTP_SO_LOCKED); + sctp_abort_an_association(stcb->sctp_ep, stcb, mm, false, SCTP_SO_LOCKED); NET_EPOCH_EXIT(et); /* now relock the stcb so everything is sane */ hold_tcblock = 0; @@ -13544,7 +13544,7 @@ dataless_eof: msg); NET_EPOCH_ENTER(et); sctp_abort_an_association(stcb->sctp_ep, stcb, - op_err, SCTP_SO_LOCKED); + op_err, false, SCTP_SO_LOCKED); NET_EPOCH_EXIT(et); /* * now relock the stcb so everything diff --git a/sys/netinet/sctp_pcb.c b/sys/netinet/sctp_pcb.c index ce4850469144..bdc575de615f 100644 --- a/sys/netinet/sctp_pcb.c +++ b/sys/netinet/sctp_pcb.c @@ -6198,7 +6198,7 @@ sctp_load_addresses_from_init(struct sctp_tcb *stcb, struct mbuf *m, op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), msg); sctp_abort_an_association(stcb_tmp->sctp_ep, - stcb_tmp, op_err, + stcb_tmp, op_err, false, SCTP_SO_NOT_LOCKED); goto add_it_now; } @@ -6298,7 +6298,7 @@ sctp_load_addresses_from_init(struct sctp_tcb *stcb, struct mbuf *m, op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), msg); sctp_abort_an_association(stcb_tmp->sctp_ep, - stcb_tmp, op_err, + stcb_tmp, op_err, false, SCTP_SO_NOT_LOCKED); goto add_it_now6; } diff --git a/sys/netinet/sctp_timer.c b/sys/netinet/sctp_timer.c index 582abd8e8854..2d3836829e89 100644 --- a/sys/netinet/sctp_timer.c +++ b/sys/netinet/sctp_timer.c @@ -157,7 +157,7 @@ sctp_threshold_management(struct sctp_inpcb *inp, struct sctp_tcb *stcb, op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), "Association error counter exceeded"); inp->last_abort_code = SCTP_FROM_SCTP_TIMER + SCTP_LOC_2; - sctp_abort_an_association(inp, stcb, op_err, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(inp, stcb, op_err, true, SCTP_SO_NOT_LOCKED); return (1); } return (0); @@ -1071,7 +1071,7 @@ sctp_cookie_timer(struct sctp_inpcb *inp, op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), "Cookie timer expired, but no cookie"); inp->last_abort_code = SCTP_FROM_SCTP_TIMER + SCTP_LOC_3; - sctp_abort_an_association(inp, stcb, op_err, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(inp, stcb, op_err, false, SCTP_SO_NOT_LOCKED); } else { #ifdef INVARIANTS panic("Cookie timer expires in wrong state?"); diff --git a/sys/netinet/sctp_usrreq.c b/sys/netinet/sctp_usrreq.c index 6308cabf5d63..822a8ffb534f 100644 --- a/sys/netinet/sctp_usrreq.c +++ b/sys/netinet/sctp_usrreq.c @@ -189,7 +189,7 @@ sctp_notify(struct sctp_inpcb *inp, } else if ((icmp_code == ICMP_UNREACH_PROTOCOL) || (icmp_code == ICMP_UNREACH_PORT)) { /* Treat it like an ABORT. */ - sctp_abort_notification(stcb, 1, 0, NULL, SCTP_SO_NOT_LOCKED); + sctp_abort_notification(stcb, true, false, 0, NULL, SCTP_SO_NOT_LOCKED); (void)sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC, SCTP_FROM_SCTP_USRREQ + SCTP_LOC_2); /* no need to unlock here, since the TCB is gone */ @@ -960,7 +960,7 @@ sctp_shutdown(struct socket *so) stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_USRREQ + SCTP_LOC_6; SCTP_INP_RUNLOCK(inp); sctp_abort_an_association(stcb->sctp_ep, stcb, - op_err, SCTP_SO_LOCKED); + op_err, false, SCTP_SO_LOCKED); NET_EPOCH_EXIT(et); return (0); } diff --git a/sys/netinet/sctputil.c b/sys/netinet/sctputil.c index 21e49bdfcb23..ad4409f666df 100644 --- a/sys/netinet/sctputil.c +++ b/sys/netinet/sctputil.c @@ -1998,7 +1998,7 @@ sctp_timeout_handler(void *t) SCTP_STAT_INCR(sctps_timoshutdownguard); op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), "Shutdown guard timer expired"); - sctp_abort_an_association(inp, stcb, op_err, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(inp, stcb, op_err, true, SCTP_SO_NOT_LOCKED); /* no need to unlock on tcb its gone */ goto out_decr; case SCTP_TIMER_TYPE_AUTOCLOSE: @@ -3154,7 +3154,8 @@ sctp_pad_lastmbuf(struct mbuf *m, int padval, struct mbuf *last_mbuf) static void sctp_notify_assoc_change(uint16_t state, struct sctp_tcb *stcb, - uint16_t error, struct sctp_abort_chunk *abort, uint8_t from_peer, int so_locked) + uint16_t error, struct sctp_abort_chunk *abort, + bool from_peer, bool timedout, int so_locked) { struct mbuf *m_notify; struct sctp_assoc_change *sac; @@ -3163,8 +3164,10 @@ sctp_notify_assoc_change(uint16_t state, struct sctp_tcb *stcb, uint16_t abort_len; unsigned int i; - KASSERT((abort == NULL) || (from_peer != 0), + KASSERT(abort == NULL || from_peer, ("sctp_notify_assoc_change: ABORT chunk provided for local termination")); + KASSERT(!from_peer || !timedout, + ("sctp_notify_assoc_change: timeouts can only be local")); if (stcb == NULL) { return; } @@ -3272,8 +3275,7 @@ set_error: stcb->sctp_socket->so_error = ECONNRESET; } } else { - if ((SCTP_GET_STATE(stcb) == SCTP_STATE_COOKIE_WAIT) || - (SCTP_GET_STATE(stcb) == SCTP_STATE_COOKIE_ECHOED)) { + if (timedout) { SCTP_LTRACE_ERR_RET(NULL, stcb, NULL, SCTP_FROM_SCTPUTIL, ETIMEDOUT); stcb->sctp_socket->so_error = ETIMEDOUT; } else { @@ -4085,7 +4087,7 @@ sctp_ulp_notify(uint32_t notification, struct sctp_tcb *stcb, switch (notification) { case SCTP_NOTIFY_ASSOC_UP: if (stcb->asoc.assoc_up_sent == 0) { - sctp_notify_assoc_change(SCTP_COMM_UP, stcb, error, NULL, 0, so_locked); + sctp_notify_assoc_change(SCTP_COMM_UP, stcb, error, NULL, false, false, so_locked); stcb->asoc.assoc_up_sent = 1; } if (stcb->asoc.adaptation_needed && (stcb->asoc.adaptation_sent == 0)) { @@ -4097,7 +4099,7 @@ sctp_ulp_notify(uint32_t notification, struct sctp_tcb *stcb, } break; case SCTP_NOTIFY_ASSOC_DOWN: - sctp_notify_assoc_change(SCTP_SHUTDOWN_COMP, stcb, error, NULL, 0, so_locked); + sctp_notify_assoc_change(SCTP_SHUTDOWN_COMP, stcb, error, NULL, false, false, so_locked); break; case SCTP_NOTIFY_INTERFACE_DOWN: { @@ -4150,21 +4152,29 @@ sctp_ulp_notify(uint32_t notification, struct sctp_tcb *stcb, case SCTP_NOTIFY_ASSOC_LOC_ABORTED: if ((SCTP_GET_STATE(stcb) == SCTP_STATE_COOKIE_WAIT) || (SCTP_GET_STATE(stcb) == SCTP_STATE_COOKIE_ECHOED)) { - sctp_notify_assoc_change(SCTP_CANT_STR_ASSOC, stcb, error, data, 0, so_locked); + sctp_notify_assoc_change(SCTP_CANT_STR_ASSOC, stcb, error, data, false, false, so_locked); } else { - sctp_notify_assoc_change(SCTP_COMM_LOST, stcb, error, data, 0, so_locked); + sctp_notify_assoc_change(SCTP_COMM_LOST, stcb, error, data, false, false, so_locked); } break; case SCTP_NOTIFY_ASSOC_REM_ABORTED: if ((SCTP_GET_STATE(stcb) == SCTP_STATE_COOKIE_WAIT) || (SCTP_GET_STATE(stcb) == SCTP_STATE_COOKIE_ECHOED)) { - sctp_notify_assoc_change(SCTP_CANT_STR_ASSOC, stcb, error, data, 1, so_locked); + sctp_notify_assoc_change(SCTP_CANT_STR_ASSOC, stcb, error, data, true, false, so_locked); } else { - sctp_notify_assoc_change(SCTP_COMM_LOST, stcb, error, data, 1, so_locked); + sctp_notify_assoc_change(SCTP_COMM_LOST, stcb, error, data, true, false, so_locked); + } + break; + case SCTP_NOTIFY_ASSOC_TIMEDOUT: + if ((SCTP_GET_STATE(stcb) == SCTP_STATE_COOKIE_WAIT) || + (SCTP_GET_STATE(stcb) == SCTP_STATE_COOKIE_ECHOED)) { + sctp_notify_assoc_change(SCTP_CANT_STR_ASSOC, stcb, error, data, false, true, so_locked); + } else { + sctp_notify_assoc_change(SCTP_COMM_LOST, stcb, error, data, false, true, so_locked); } break; case SCTP_NOTIFY_ASSOC_RESTART: - sctp_notify_assoc_change(SCTP_RESTART, stcb, error, NULL, 0, so_locked); + sctp_notify_assoc_change(SCTP_RESTART, stcb, error, NULL, false, false, so_locked); if (stcb->asoc.auth_supported == 0) { sctp_ulp_notify(SCTP_NOTIFY_NO_PEER_AUTH, stcb, 0, NULL, so_locked); @@ -4337,8 +4347,9 @@ sctp_report_all_outbound(struct sctp_tcb *stcb, uint16_t error, int so_locked) } void -sctp_abort_notification(struct sctp_tcb *stcb, uint8_t from_peer, uint16_t error, - struct sctp_abort_chunk *abort, int so_locked) +sctp_abort_notification(struct sctp_tcb *stcb, bool from_peer, bool timeout, + uint16_t error, struct sctp_abort_chunk *abort, + int so_locked) { if (stcb == NULL) { return; @@ -4361,7 +4372,11 @@ sctp_abort_notification(struct sctp_tcb *stcb, uint8_t from_peer, uint16_t error if (from_peer) { sctp_ulp_notify(SCTP_NOTIFY_ASSOC_REM_ABORTED, stcb, error, abort, so_locked); } else { - sctp_ulp_notify(SCTP_NOTIFY_ASSOC_LOC_ABORTED, stcb, error, abort, so_locked); + if (timeout) { + sctp_ulp_notify(SCTP_NOTIFY_ASSOC_TIMEDOUT, stcb, error, abort, so_locked); + } else { + sctp_ulp_notify(SCTP_NOTIFY_ASSOC_LOC_ABORTED, stcb, error, abort, so_locked); + } } } @@ -4395,7 +4410,7 @@ sctp_abort_association(struct sctp_inpcb *inp, struct sctp_tcb *stcb, vrf_id, port); if (stcb != NULL) { /* We have a TCB to abort, send notification too */ - sctp_abort_notification(stcb, 0, cause_code, NULL, SCTP_SO_NOT_LOCKED); + sctp_abort_notification(stcb, false, false, cause_code, NULL, SCTP_SO_NOT_LOCKED); /* Ok, now lets free it */ SCTP_STAT_INCR_COUNTER32(sctps_aborted); if ((SCTP_GET_STATE(stcb) == SCTP_STATE_OPEN) || @@ -4471,8 +4486,7 @@ none_in: void sctp_abort_an_association(struct sctp_inpcb *inp, struct sctp_tcb *stcb, - struct mbuf *op_err, - int so_locked) + struct mbuf *op_err, bool timedout, int so_locked) { struct sctp_gen_error_cause *cause; uint16_t cause_code; @@ -4503,7 +4517,7 @@ sctp_abort_an_association(struct sctp_inpcb *inp, struct sctp_tcb *stcb, } /* notify the ulp */ if ((inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) == 0) { - sctp_abort_notification(stcb, 0, cause_code, NULL, so_locked); + sctp_abort_notification(stcb, false, timedout, cause_code, NULL, so_locked); } /* now free the asoc */ #ifdef SCTP_ASOCLOG_OF_TSNS diff --git a/sys/netinet/sctputil.h b/sys/netinet/sctputil.h index c81633223224..3319eb4f455b 100644 --- a/sys/netinet/sctputil.h +++ b/sys/netinet/sctputil.h @@ -167,7 +167,7 @@ void sctp_report_all_outbound(struct sctp_tcb *, uint16_t, int); int sctp_expand_mapping_array(struct sctp_association *, uint32_t); void -sctp_abort_notification(struct sctp_tcb *, uint8_t, uint16_t, +sctp_abort_notification(struct sctp_tcb *, bool, bool, uint16_t, struct sctp_abort_chunk *, int); /* We abort responding to an IP packet for some reason */ @@ -181,7 +181,7 @@ sctp_abort_association(struct sctp_inpcb *, struct sctp_tcb *, struct mbuf *, /* We choose to abort via user input */ void sctp_abort_an_association(struct sctp_inpcb *, struct sctp_tcb *, - struct mbuf *, int); + struct mbuf *, bool, int); void sctp_handle_ootb(struct mbuf *, int, int, diff --git a/sys/netinet6/sctp6_usrreq.c b/sys/netinet6/sctp6_usrreq.c index 09371ce249db..6f5d639e6367 100644 --- a/sys/netinet6/sctp6_usrreq.c +++ b/sys/netinet6/sctp6_usrreq.c @@ -200,7 +200,7 @@ sctp6_notify(struct sctp_inpcb *inp, case ICMP6_PARAM_PROB: /* Treat it like an ABORT. */ if (icmp6_code == ICMP6_PARAMPROB_NEXTHEADER) { - sctp_abort_notification(stcb, 1, 0, NULL, SCTP_SO_NOT_LOCKED); + sctp_abort_notification(stcb, true, false, 0, NULL, SCTP_SO_NOT_LOCKED); (void)sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC, SCTP_FROM_SCTP_USRREQ + SCTP_LOC_2); } else { From owner-dev-commits-src-main@freebsd.org Fri Jul 9 21:48:37 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 90E9C666EE7; Fri, 9 Jul 2021 21:48:37 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GM6H93Mgtz3R3d; Fri, 9 Jul 2021 21:48:37 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro.local (d-24-233-223-154.va.cpe.atlanticbb.net [24.233.223.154]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 26CD7E2DA; Fri, 9 Jul 2021 21:48:37 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: git: 1f7d11e636ab - main - build.7: remove documentation of "make update" To: Ceri Davies , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202107011552.161FqeER094768@gitrepo.freebsd.org> From: John Baldwin Message-ID: <5e8ca76f-39e8-0b52-1b10-249d0c0bfd0c@FreeBSD.org> Date: Fri, 9 Jul 2021 17:48:36 -0400 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <202107011552.161FqeER094768@gitrepo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jul 2021 21:48:37 -0000 On 7/1/21 8:52 AM, Ceri Davies wrote: > The branch main has been updated by ceri (doc committer): > > URL: https://cgit.FreeBSD.org/src/commit/?id=1f7d11e636abf68d92b052fefe63b687d84c966a > > commit 1f7d11e636abf68d92b052fefe63b687d84c966a > Author: Ceri Davies > AuthorDate: 2021-07-01 15:04:33 +0000 > Commit: Ceri Davies > CommitDate: 2021-07-01 15:52:32 +0000 > > build.7: remove documentation of "make update" > > update target was removed in e290182bcf3895ca659dff111bca6a077c4708b1 Oops, thanks for fixing! -- John Baldwin From owner-dev-commits-src-main@freebsd.org Fri Jul 9 22:41:38 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BE84F667794 for ; Fri, 9 Jul 2021 22:41:38 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qt1-x830.google.com (mail-qt1-x830.google.com [IPv6:2607:f8b0:4864:20::830]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GM7SL3R0Cz3nbN for ; Fri, 9 Jul 2021 22:41:38 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-qt1-x830.google.com with SMTP id v10so8723485qto.1 for ; Fri, 09 Jul 2021 15:41:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=ZAaMmPy3viyS6h8rtZDadXHtxla3RXLgeQVjodelawg=; b=W1QTpeN2Pv3LToA4aCuM+4kOk9LcNQCDw4qnVHoXs5XOhzf/Gu3MPLzFeompA3JkKk Ke5TQQyrQBqM+/vvMJHVZYlRiYKcZG7Tp/joaZPUlFfso1eKttXksJffuOpaoCHn85FJ mOYV6mwCO4pI2caiTxJunuQKIJtjp1AbOvLWOl91hFJX5iscbqEYYv6x1oCLrUzD0uFY 3vKrX8N67StKDZDZen6H4/LYPHepkrounW/6UKDiAcBH7nQAttGyOGycTrzTycet6cn/ GUGU2fvOlGv4M0KTu8Rb1V6Wuz440gck1Ho1rxz44/qadIH8z65sAZA490TQ+DCOQFKR aTag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=ZAaMmPy3viyS6h8rtZDadXHtxla3RXLgeQVjodelawg=; b=EDEEMcQQzBKRLYUVuR7+8XAVWCqLV71DsjvrEhDifHvHbMsD9jqOHyGzYDdyzi4zoj U+Z4pyWlHJUcz4qJMd60jUR53+yr8uYEsbO8Bp5CoXAhKk6VAxz1mxNRWUt09s5MNtKL PiAlbByWLasi6tlk+NpRsEsurcR1KURybB8KOjJCEKgZaUO6omCd+n0hNmRu+CaIeRV9 /htqFLky9acxSgCzbZ4yKPJUJzTN7l1OUvKGR/cDToutlX+v8JIsoI258GkBueftluN5 sJK64rddoKBzXbthWAcivFNRe7HakonL+QfgFQBtKpTLOgmd23pkX0T+WoauZ/b86jRY MeIQ== X-Gm-Message-State: AOAM5303H/5RBLXAeGtYfnww245gTqrWZgfCUv7wxfQz1K4trx/emc/W 3U1Y9mxLaajIZvcLSP3oT7Mffw== X-Google-Smtp-Source: ABdhPJwhOCTup/lglIQLB5ltY0IBECbDou8j5qSWaNZJceaAlYv6hjKDmK5cZ0xdmF55gEaJC0+HDw== X-Received: by 2002:ac8:6698:: with SMTP id d24mr35978620qtp.37.1625870497611; Fri, 09 Jul 2021 15:41:37 -0700 (PDT) Received: from mutt-hbsd (pool-100-16-224-136.bltmmd.fios.verizon.net. [100.16.224.136]) by smtp.gmail.com with ESMTPSA id q206sm3156226qka.19.2021.07.09.15.41.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Jul 2021 15:41:37 -0700 (PDT) Date: Fri, 9 Jul 2021 18:41:36 -0400 From: Shawn Webb To: Warner Losh Cc: Warner Losh , src-committers , "" , dev-commits-src-main@freebsd.org Subject: Re: git: 72821668b039 - main - stand/kmem_zalloc: panic when a M_WAITOK allocation fails Message-ID: <20210709224136.qprhblk43ndtmxqf@mutt-hbsd> X-Operating-System: FreeBSD mutt-hbsd 14.0-CURRENT-HBSD FreeBSD 14.0-CURRENT-HBSD X-PGP-Key: https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/blob/master/Shawn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc References: <202107091726.169HQvGQ084473@gitrepo.freebsd.org> <20210709195425.xzk2azaor4ielmb4@mutt-hbsd> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="53mirfa322pvcatr" Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 4GM7SL3R0Cz3nbN X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jul 2021 22:41:38 -0000 --53mirfa322pvcatr Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jul 09, 2021 at 02:34:12PM -0600, Warner Losh wrote: > On Fri, Jul 9, 2021 at 1:54 PM Shawn Webb > wrote: >=20 > > On Fri, Jul 09, 2021 at 05:26:57PM +0000, Warner Losh wrote: > > > The branch main has been updated by imp: > > > > > > URL: > > https://cgit.FreeBSD.org/src/commit/?id=3D72821668b039c276914569e9caa1c= dfa4e4cb674 > > > > > > commit 72821668b039c276914569e9caa1cdfa4e4cb674 > > > Author: Warner Losh > > > AuthorDate: 2021-07-09 17:21:18 +0000 > > > Commit: Warner Losh > > > CommitDate: 2021-07-09 17:21:18 +0000 > > > > > > stand/kmem_zalloc: panic when a M_WAITOK allocation fails > > > > > > Malloc() might return NULL, in which case we will panic with a NU= LL > > > pointer deref. Make it panic when the allocation fails to preserve > > the > > > postcondtion that we never return a non-NULL value. > > > > malloc(9) tells us that M_WAITOK will never fail. I'm thinking this > > conditional might need to be negated for the !M_WAITOK case, in which > > malloc(9) could indeed fail. > > > > Although, even as I type this email, I just realized that a different > > function, Malloc, is being called. What's the difference between > > malloc and Malloc? > > >=20 > The block of code is to be used in the standalone environment. > The Malloc() function there doesn't have wait/nowait variants and > can fail (though in the boot loader, that almost never happens except > when there's a bug). The code is for wrappers around kmem_zalloc > which is the OpenZFS spelling of malloc. It assumes that kmem_zalloc > with M_WAITOK will never return NULL, so it never checks. This > changes a weird panic when the returned NULL pointer is dereferenced, > to an orderly panic when the malloc that the code assumes will never > fail actuall fails. This at least gives better context of where the error > happened and what the error was. In practice, this is a big nop, but > we have had issues with other Malloc calls in the past failing because > of bugs that caused us to ask for a ridiculous amount of memory. >=20 > Make sense? That makes much more sense. Thanks a lot for the clarification! --=20 Shawn Webb Cofounder / Security Engineer HardenedBSD https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/raw/master/Shawn_Webb/03A= 4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc --53mirfa322pvcatr Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAmDo0J4ACgkQ/y5nonf4 4fq4tRAAoQKdCupdv+PZ+1R36+kh9uRyFkOk+/fR5VkQl8anqid7GMAYx6fwEC5k bsqj95tIBJZ00iV0pjoqdCJYgzmBAOcrs8ZNNka1Q42kgSyqk+xgHe2MHGnVaQ7g 60zCj8267dpo+nhQVp0vkffpSgb+qpLm9wKZQ0wDe4hExyZNBabSfOubCrLDCkwW m8t/iG0laOAtbRNJ2EqWuELIAkqKZpuume0KUH4iL14d8RjhpPCQecwA7orPZnDU sZnO2te2qQbckBRhfCNEMNW7pBY7JfIPyzqfa4Bk0vdWtm7PIJnFwxi59IvqWKtZ jwCWMNzNNIt9wZDOnB0ktuLZWRxQvCqcV2SQ96lDIQCbWYEnzxItGqD9INpqh3y2 Jfl7dnWDmcnnHHfHYRaYJgW4yEqnqpAB8V/BhgES4bnYN4vCst3LWheEPBpKOe3s Ar4735O+QwdR9hFKyHPVeVokaeFSu46mfD/3/li1F7/HcLNKpqs7KxvCksZE+uHq Fv3n7ddWrndI+DTkFzPtvleVBQjhpS828rgoP5jCC6liFRkOp/omFD85g4l68L73 ejKAn6ZWiP/LzS/8La9xDfHRQ3SMsw8CVO81m83b9WixDlnCLLx66WGnA596pMkb OFvNA7c4hZHr9z5H46/C2hZ8G9mpaW2e7R/U2IbkN8y4x0bSTj8= =RxBr -----END PGP SIGNATURE----- --53mirfa322pvcatr-- From owner-dev-commits-src-main@freebsd.org Sat Jul 10 00:48:08 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A9E466496D4; Sat, 10 Jul 2021 00:48:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GMBGJ4BBGz4XhH; Sat, 10 Jul 2021 00:48:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 740671E65B; Sat, 10 Jul 2021 00:48:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16A0m8OZ072308; Sat, 10 Jul 2021 00:48:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16A0m8L8072307; Sat, 10 Jul 2021 00:48:08 GMT (envelope-from git) Date: Sat, 10 Jul 2021 00:48:08 GMT Message-Id: <202107100048.16A0m8L8072307@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: f08f0ae5247a - main - amd64: Mark the trapframe as initialized in trap() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f08f0ae5247ab31de58bda0817e74ccc1a3a5e95 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 00:48:08 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=f08f0ae5247ab31de58bda0817e74ccc1a3a5e95 commit f08f0ae5247ab31de58bda0817e74ccc1a3a5e95 Author: Mark Johnston AuthorDate: 2021-07-10 00:38:03 +0000 Commit: Mark Johnston CommitDate: 2021-07-10 00:38:50 +0000 amd64: Mark the trapframe as initialized in trap() Otherwise KASAN may generate false positives if the trapframe was written into a poisoned region of the stack. Reported by: pho Sponsored by: The FreeBSD Foundation --- sys/amd64/amd64/trap.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c index e67e188bb4fd..a60b17cf554f 100644 --- a/sys/amd64/amd64/trap.c +++ b/sys/amd64/amd64/trap.c @@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$"); #include "opt_kdb.h" #include +#include #include #include #include @@ -227,6 +228,8 @@ trap(struct trapframe *frame) p = td->td_proc; dr6 = 0; + kasan_mark(frame, sizeof(*frame), sizeof(*frame), 0); + VM_CNT_INC(v_trap); type = frame->tf_trapno; From owner-dev-commits-src-main@freebsd.org Sat Jul 10 00:48:09 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CB48064961C; Sat, 10 Jul 2021 00:48:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GMBGK4yZ4z4XmT; Sat, 10 Jul 2021 00:48:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8BBB11E8A6; Sat, 10 Jul 2021 00:48:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16A0m94H072332; Sat, 10 Jul 2021 00:48:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16A0m9Jb072331; Sat, 10 Jul 2021 00:48:09 GMT (envelope-from git) Date: Sat, 10 Jul 2021 00:48:09 GMT Message-Id: <202107100048.16A0m9Jb072331@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 5d243d41b120 - main - hwpmc: Disable KASAN in pmc_save_kernel_callchain() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5d243d41b1206044cb5eddd5d48c1c711b731478 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 00:48:09 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=5d243d41b1206044cb5eddd5d48c1c711b731478 commit 5d243d41b1206044cb5eddd5d48c1c711b731478 Author: Mark Johnston AuthorDate: 2021-07-10 00:38:11 +0000 Commit: Mark Johnston CommitDate: 2021-07-10 00:38:50 +0000 hwpmc: Disable KASAN in pmc_save_kernel_callchain() As in commit 831850d8b087, this routine can trigger false positives, so exclude it from instrumentation. Reported by: pho Sponsored by: The FreeBSD Foundation --- sys/dev/hwpmc/hwpmc_x86.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/hwpmc/hwpmc_x86.c b/sys/dev/hwpmc/hwpmc_x86.c index 2b2596328ec0..db6ed6fb1145 100644 --- a/sys/dev/hwpmc/hwpmc_x86.c +++ b/sys/dev/hwpmc/hwpmc_x86.c @@ -156,7 +156,7 @@ pmc_save_user_callchain(uintptr_t *cc, int nframes, struct trapframe *tf) * code, and if so we terminate our trace. */ -int +int __nosanitizeaddress pmc_save_kernel_callchain(uintptr_t *cc, int nframes, struct trapframe *tf) { int n; From owner-dev-commits-src-main@freebsd.org Sat Jul 10 00:48:11 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0281F6491F2; Sat, 10 Jul 2021 00:48:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GMBGL6KYXz4XhM; Sat, 10 Jul 2021 00:48:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B9A031EA14; Sat, 10 Jul 2021 00:48:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16A0mATs072356; Sat, 10 Jul 2021 00:48:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16A0mAnx072355; Sat, 10 Jul 2021 00:48:10 GMT (envelope-from git) Date: Sat, 10 Jul 2021 00:48:10 GMT Message-Id: <202107100048.16A0mAnx072355@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 36226163fa48 - main - x86: Mark the trapframe as initialized in ipi_bitmap_handler() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 36226163fa48ee2c5f73bd2e870ce2e5a057f42e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 00:48:11 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=36226163fa48ee2c5f73bd2e870ce2e5a057f42e commit 36226163fa48ee2c5f73bd2e870ce2e5a057f42e Author: Mark Johnston AuthorDate: 2021-07-10 00:38:18 +0000 Commit: Mark Johnston CommitDate: 2021-07-10 00:38:50 +0000 x86: Mark the trapframe as initialized in ipi_bitmap_handler() Otherwise KASAN may generate false positives if the trapframe was written into a poisoned region of the stack. Reported by: pho Reported by: syzbot+ee60455cd58e6eed20c9@syzkaller.appspotmail.com Reported by: syzbot+be5f9df26426ace3a00c@syzkaller.appspotmail.com Sponsored by: The FreeBSD Foundation --- sys/x86/x86/mp_x86.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/x86/x86/mp_x86.c b/sys/x86/x86/mp_x86.c index 2dcdf923c467..1f22b3a7886a 100644 --- a/sys/x86/x86/mp_x86.c +++ b/sys/x86/x86/mp_x86.c @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include /* cngetc() */ #include @@ -1279,6 +1280,8 @@ ipi_bitmap_handler(struct trapframe frame) int cpu = PCPU_GET(cpuid); u_int ipi_bitmap; + kasan_mark(&frame, sizeof(frame), sizeof(frame), 0); + td = curthread; ipi_bitmap = atomic_readandclear_int(&cpuid_to_pcpu[cpu]-> pc_ipi_bitmap); From owner-dev-commits-src-main@freebsd.org Sat Jul 10 00:48:12 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2E97564988D; Sat, 10 Jul 2021 00:48:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GMBGN0Vyhz4XrW; Sat, 10 Jul 2021 00:48:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E0AF61E5C3; Sat, 10 Jul 2021 00:48:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16A0mBY5072380; Sat, 10 Jul 2021 00:48:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16A0mBPQ072379; Sat, 10 Jul 2021 00:48:11 GMT (envelope-from git) Date: Sat, 10 Jul 2021 00:48:11 GMT Message-Id: <202107100048.16A0mBPQ072379@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: b0dfc4868478 - main - uma: Fix a few problems with KASAN integration MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b0dfc48684780024a3d736c5a5449284dad97f4e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 00:48:12 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=b0dfc48684780024a3d736c5a5449284dad97f4e commit b0dfc48684780024a3d736c5a5449284dad97f4e Author: Mark Johnston AuthorDate: 2021-07-10 00:38:21 +0000 Commit: Mark Johnston CommitDate: 2021-07-10 00:38:50 +0000 uma: Fix a few problems with KASAN integration - Ensure that all items returned by UMA are aligned to KASAN_SHADOW_SCALE (8). This was true in practice since smaller alignments are not used by any consumers, but we should enforce it anyway. - Use a non-zero code for marking redzones that appear naturally in items that are not a multiple of the scale factor in size. Currently we do not modify keg layouts to force the creation of redzones. - Use a non-zero code for marking freed per-CPU items, otherwise accesses of freed per-CPU items are not detected by the runtime. Sponsored by: The FreeBSD Foundation --- sys/vm/uma_core.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/sys/vm/uma_core.c b/sys/vm/uma_core.c index d2e01f3a0605..59cc960d3dd9 100644 --- a/sys/vm/uma_core.c +++ b/sys/vm/uma_core.c @@ -556,11 +556,12 @@ kasan_mark_item_valid(uma_zone_t zone, void *item) sz = zone->uz_size; rsz = roundup2(sz, KASAN_SHADOW_SCALE); if ((zone->uz_flags & UMA_ZONE_PCPU) == 0) { - kasan_mark(item, sz, rsz, 0); + kasan_mark(item, sz, rsz, KASAN_GENERIC_REDZONE); } else { pcpu_item = zpcpu_base_to_offset(item); for (i = 0; i <= mp_maxid; i++) - kasan_mark(zpcpu_get_cpu(pcpu_item, i), sz, rsz, 0); + kasan_mark(zpcpu_get_cpu(pcpu_item, i), sz, rsz, + KASAN_GENERIC_REDZONE); } } @@ -580,7 +581,8 @@ kasan_mark_item_invalid(uma_zone_t zone, void *item) } else { pcpu_item = zpcpu_base_to_offset(item); for (i = 0; i <= mp_maxid; i++) - kasan_mark(zpcpu_get_cpu(pcpu_item, i), 0, sz, 0); + kasan_mark(zpcpu_get_cpu(pcpu_item, i), 0, sz, + KASAN_UMA_FREED); } } @@ -2238,6 +2240,14 @@ keg_layout(uma_keg_t keg) PRINT_UMA_ZFLAGS)); alignsize = keg->uk_align + 1; +#ifdef KASAN + /* + * ASAN requires that each allocation be aligned to the shadow map + * scale factor. + */ + if (alignsize < KASAN_SHADOW_SCALE) + alignsize = KASAN_SHADOW_SCALE; +#endif /* * Calculate the size of each allocation (rsize) according to From owner-dev-commits-src-main@freebsd.org Sat Jul 10 00:48:13 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E8F486496E9; Sat, 10 Jul 2021 00:48:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GMBGP1tSLz4XvH; Sat, 10 Jul 2021 00:48:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0A46B1E4CE; Sat, 10 Jul 2021 00:48:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16A0mC7O072411; Sat, 10 Jul 2021 00:48:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16A0mCp4072410; Sat, 10 Jul 2021 00:48:12 GMT (envelope-from git) Date: Sat, 10 Jul 2021 00:48:12 GMT Message-Id: <202107100048.16A0mCp4072410@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 588c7a06dffb - main - KASAN: Implement __asan_unregister_globals() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 588c7a06dffbc74b281dacbdd854437b0815e501 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 00:48:14 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=588c7a06dffbc74b281dacbdd854437b0815e501 commit 588c7a06dffbc74b281dacbdd854437b0815e501 Author: Mark Johnston AuthorDate: 2021-07-10 00:38:28 +0000 Commit: Mark Johnston CommitDate: 2021-07-10 00:38:50 +0000 KASAN: Implement __asan_unregister_globals() It will be called during KLD unload to unpoison the redzones following global variables. Otherwise, virtual address ranges previously used for a KLD may be left tainted, triggering false positives when they are recycled. Reported by: pho Sponsored by: The FreeBSD Foundation --- sys/kern/subr_asan.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sys/kern/subr_asan.c b/sys/kern/subr_asan.c index b812f7bca465..07f7b44d08d7 100644 --- a/sys/kern/subr_asan.c +++ b/sys/kern/subr_asan.c @@ -948,7 +948,12 @@ __asan_register_globals(struct __asan_global *globals, size_t n) void __asan_unregister_globals(struct __asan_global *globals, size_t n) { - /* never called */ + size_t i; + + for (i = 0; i < n; i++) { + kasan_mark(globals[i].beg, globals[i].size_with_redzone, + globals[i].size_with_redzone, 0); + } } #define ASAN_LOAD_STORE(size) \ From owner-dev-commits-src-main@freebsd.org Sat Jul 10 00:58:04 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6B0D1649E25; Sat, 10 Jul 2021 00:58:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GMBTm2Czzz4YZd; Sat, 10 Jul 2021 00:58:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3005F1EA3E; Sat, 10 Jul 2021 00:58:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16A0w4VK085355; Sat, 10 Jul 2021 00:58:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16A0w42M085354; Sat, 10 Jul 2021 00:58:04 GMT (envelope-from git) Date: Sat, 10 Jul 2021 00:58:04 GMT Message-Id: <202107100058.16A0w42M085354@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Motin Subject: git: 63ca9ea4f34d - main - Use sleepq_signal(SLEEPQ_DROP) in cv_signal(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 63ca9ea4f34d887b66c7b9f1710f5e4be543ebed Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 00:58:04 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=63ca9ea4f34d887b66c7b9f1710f5e4be543ebed commit 63ca9ea4f34d887b66c7b9f1710f5e4be543ebed Author: Alexander Motin AuthorDate: 2021-07-10 00:52:40 +0000 Commit: Alexander Motin CommitDate: 2021-07-10 00:57:58 +0000 Use sleepq_signal(SLEEPQ_DROP) in cv_signal(). Same as wakeup_one()/wakeup_any() commit before it reduces the lock hold time and so contention. MFC after: 1 week --- sys/kern/kern_condvar.c | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/sys/kern/kern_condvar.c b/sys/kern/kern_condvar.c index e26b689b4e11..ffceee44a5c0 100644 --- a/sys/kern/kern_condvar.c +++ b/sys/kern/kern_condvar.c @@ -397,26 +397,23 @@ _cv_timedwait_sig_sbt(struct cv *cvp, struct lock_object *lock, void cv_signal(struct cv *cvp) { - int wakeup_swapper; if (cvp->cv_waiters == 0) return; - wakeup_swapper = 0; sleepq_lock(cvp); - if (cvp->cv_waiters > 0) { - if (cvp->cv_waiters == CV_WAITERS_BOUND && - sleepq_lookup(cvp) == NULL) { - cvp->cv_waiters = 0; - } else { - if (cvp->cv_waiters < CV_WAITERS_BOUND) - cvp->cv_waiters--; - wakeup_swapper = sleepq_signal(cvp, SLEEPQ_CONDVAR, 0, - 0); - } + if (cvp->cv_waiters == 0) { + sleepq_release(cvp); + return; + } + if (cvp->cv_waiters == CV_WAITERS_BOUND && sleepq_lookup(cvp) == NULL) { + cvp->cv_waiters = 0; + sleepq_release(cvp); + } else { + if (cvp->cv_waiters < CV_WAITERS_BOUND) + cvp->cv_waiters--; + if (sleepq_signal(cvp, SLEEPQ_CONDVAR | SLEEPQ_DROP, 0, 0)) + kick_proc0(); } - sleepq_release(cvp); - if (wakeup_swapper) - kick_proc0(); } /* From owner-dev-commits-src-main@freebsd.org Sat Jul 10 11:13:05 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BF4E46528B4; Sat, 10 Jul 2021 11:13:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GMS7P50bVz4hHx; Sat, 10 Jul 2021 11:13:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9473126E31; Sat, 10 Jul 2021 11:13:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16ABD5wo009027; Sat, 10 Jul 2021 11:13:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16ABD5dG009026; Sat, 10 Jul 2021 11:13:05 GMT (envelope-from git) Date: Sat, 10 Jul 2021 11:13:05 GMT Message-Id: <202107101113.16ABD5dG009026@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?Q?Stefan E=C3=9Fer?= Subject: git: 58080fbca09f - main - libalias: fix divide by zero causing panic MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: se X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 58080fbca09fda6d5f011d37059edbca8ceb4c58 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 11:13:05 -0000 The branch main has been updated by se: URL: https://cgit.FreeBSD.org/src/commit/?id=58080fbca09fda6d5f011d37059edbca8ceb4c58 commit 58080fbca09fda6d5f011d37059edbca8ceb4c58 Author: Stefan Eßer AuthorDate: 2021-07-10 11:00:56 +0000 Commit: Stefan Eßer CommitDate: 2021-07-10 11:08:18 +0000 libalias: fix divide by zero causing panic The packet_limit can fall to 0, leading to a divide by zero abort in the "packets % packet_limit". An possible solution would be to apply a lower limit of 1 after the calculation of packet_limit, but since any number modulo 1 gives 0, the more efficient solution is to skip the modulo operation for packet_limit <= 1. Since this is a fix for a panic observed in stable/12, merging this fix to stable/12 and stable/13 before expiry of the 3 day waiting period might be justified, if it works for the reporter of the issue. Reported by: Karl Denninger MFC after: 3 days --- sys/netinet/libalias/alias_db.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/netinet/libalias/alias_db.c b/sys/netinet/libalias/alias_db.c index c09ad4352ce4..4612b32c139c 100644 --- a/sys/netinet/libalias/alias_db.c +++ b/sys/netinet/libalias/alias_db.c @@ -1769,7 +1769,7 @@ HouseKeeping(struct libalias *la) * Reduce the amount of house keeping work substantially by * sampling over the packets. */ - if (packets % packet_limit == 0) { + if (packet_limit <= 1 || packets % packet_limit == 0) { time_t now; #ifdef _KERNEL From owner-dev-commits-src-main@freebsd.org Sat Jul 10 11:47:07 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 66F91652CBA; Sat, 10 Jul 2021 11:47:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GMStg2CLKz4lRX; Sat, 10 Jul 2021 11:47:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 34881273F0; Sat, 10 Jul 2021 11:47:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16ABl7Fj048379; Sat, 10 Jul 2021 11:47:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16ABl7gl048378; Sat, 10 Jul 2021 11:47:07 GMT (envelope-from git) Date: Sat, 10 Jul 2021 11:47:07 GMT Message-Id: <202107101147.16ABl7gl048378@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 55e63ed307fb - main - x86: use ANSI C definition style for trap_fatal MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 55e63ed307fb099722cf6d30a18c9badab9b5d03 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 11:47:07 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=55e63ed307fb099722cf6d30a18c9badab9b5d03 commit 55e63ed307fb099722cf6d30a18c9badab9b5d03 Author: Konstantin Belousov AuthorDate: 2021-07-10 10:59:32 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-10 11:46:53 +0000 x86: use ANSI C definition style for trap_fatal PR: 257062 Submitted by: Vijay Sharma MFC after: 1 week --- sys/amd64/amd64/trap.c | 4 +--- sys/i386/i386/trap.c | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c index a60b17cf554f..55649687ce50 100644 --- a/sys/amd64/amd64/trap.c +++ b/sys/amd64/amd64/trap.c @@ -874,9 +874,7 @@ after_vmfault: } static void -trap_fatal(frame, eva) - struct trapframe *frame; - vm_offset_t eva; +trap_fatal(struct trapframe *frame, vm_offset_t eva) { int code, ss; u_int type; diff --git a/sys/i386/i386/trap.c b/sys/i386/i386/trap.c index 6fd2a1393761..045478149be5 100644 --- a/sys/i386/i386/trap.c +++ b/sys/i386/i386/trap.c @@ -875,9 +875,7 @@ trap_pfault(struct trapframe *frame, bool usermode, vm_offset_t eva, } static void -trap_fatal(frame, eva) - struct trapframe *frame; - vm_offset_t eva; +trap_fatal(struct trapframe *frame, vm_offset_t eva) { int code, ss, esp; u_int type; From owner-dev-commits-src-main@freebsd.org Sat Jul 10 11:47:08 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AE2C8653203; Sat, 10 Jul 2021 11:47:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GMSth3FgMz4l45; Sat, 10 Jul 2021 11:47:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5670B27725; Sat, 10 Jul 2021 11:47:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16ABl8Ki048403; Sat, 10 Jul 2021 11:47:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16ABl8tM048402; Sat, 10 Jul 2021 11:47:08 GMT (envelope-from git) Date: Sat, 10 Jul 2021 11:47:08 GMT Message-Id: <202107101147.16ABl8tM048402@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 9dc715230cca - main - amd64 locore.S: trim .globl list from symbols gone for long time MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9dc715230ccab1c3ad17f076379d29a017059030 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 11:47:08 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=9dc715230ccab1c3ad17f076379d29a017059030 commit 9dc715230ccab1c3ad17f076379d29a017059030 Author: Konstantin Belousov AuthorDate: 2021-07-10 11:04:31 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-10 11:46:53 +0000 amd64 locore.S: trim .globl list from symbols gone for long time Sponsored by: The FreeBSD Foundation MFC after: 1 week --- sys/amd64/amd64/locore.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/amd64/amd64/locore.S b/sys/amd64/amd64/locore.S index a9bb9be330d8..6cd2061aef07 100644 --- a/sys/amd64/amd64/locore.S +++ b/sys/amd64/amd64/locore.S @@ -36,7 +36,7 @@ /* * Compiled KERNBASE location */ - .globl kernbase, kernload, loc_PTmap, loc_PDmap, loc_PDPmap, dmapbase, dmapend + .globl kernbase, kernload, dmapbase, dmapend .set kernbase,KERNBASE .set kernload,KERNLOAD .set dmapbase,DMAP_MIN_ADDRESS From owner-dev-commits-src-main@freebsd.org Sat Jul 10 11:47:11 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 028CE652B74; Sat, 10 Jul 2021 11:47:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GMStk5nkZz4lRn; Sat, 10 Jul 2021 11:47:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A9741276D7; Sat, 10 Jul 2021 11:47:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16ABlAVs048451; Sat, 10 Jul 2021 11:47:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16ABlA7C048450; Sat, 10 Jul 2021 11:47:10 GMT (envelope-from git) Date: Sat, 10 Jul 2021 11:47:10 GMT Message-Id: <202107101147.16ABlA7C048450@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 71463a34ab3f - main - amd64 mpboot.S: fix typo in comment MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 71463a34ab3f65ff109b529f2fae93b694b73fdd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 11:47:11 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=71463a34ab3f65ff109b529f2fae93b694b73fdd commit 71463a34ab3f65ff109b529f2fae93b694b73fdd Author: Konstantin Belousov AuthorDate: 2021-07-10 11:06:44 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-10 11:46:54 +0000 amd64 mpboot.S: fix typo in comment Sponsored by: The FreeBSD Foundation MFC after: 1 week --- sys/amd64/amd64/mpboot.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/amd64/amd64/mpboot.S b/sys/amd64/amd64/mpboot.S index fb75d2b88440..e525102b5d3d 100644 --- a/sys/amd64/amd64/mpboot.S +++ b/sys/amd64/amd64/mpboot.S @@ -47,7 +47,7 @@ mptramp_start: mov %ax, %ss /* - * Find relocation base and patch the gdt descript and ljmp targets + * Find relocation base and patch the gdt descriptor and ljmp targets */ xorl %ebx,%ebx mov %cs, %bx From owner-dev-commits-src-main@freebsd.org Sat Jul 10 11:47:09 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BC542652CC5; Sat, 10 Jul 2021 11:47:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GMStj4sVhz4lPS; Sat, 10 Jul 2021 11:47:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 846F227579; Sat, 10 Jul 2021 11:47:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16ABl9ss048427; Sat, 10 Jul 2021 11:47:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16ABl9Ts048426; Sat, 10 Jul 2021 11:47:09 GMT (envelope-from git) Date: Sat, 10 Jul 2021 11:47:09 GMT Message-Id: <202107101147.16ABl9Ts048426@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 63664df72036 - main - amd64 locore.S: add FF copyright for LA57 work MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 63664df72036dc8ee99bd83fecc91faf167fa232 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 11:47:09 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=63664df72036dc8ee99bd83fecc91faf167fa232 commit 63664df72036dc8ee99bd83fecc91faf167fa232 Author: Konstantin Belousov AuthorDate: 2021-07-10 11:05:19 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-10 11:46:53 +0000 amd64 locore.S: add FF copyright for LA57 work Sponsored by: The FreeBSD Foundation MFC after: 1 week --- sys/amd64/amd64/locore.S | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys/amd64/amd64/locore.S b/sys/amd64/amd64/locore.S index 6cd2061aef07..f2eedb402ef3 100644 --- a/sys/amd64/amd64/locore.S +++ b/sys/amd64/amd64/locore.S @@ -2,6 +2,12 @@ * Copyright (c) 2003 Peter Wemm * All rights reserved. * + * Copyright (c) 2020, 2021 The FreeBSD Foundation + * + * Portions of this software were developed by + * Konstantin Belousov under sponsorship from + * the FreeBSD Foundation. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: From owner-dev-commits-src-main@freebsd.org Sat Jul 10 11:47:12 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 18F936528E8; Sat, 10 Jul 2021 11:47:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GMStl6hhQz4lLr; Sat, 10 Jul 2021 11:47:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C61522757A; Sat, 10 Jul 2021 11:47:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16ABlB3s048481; Sat, 10 Jul 2021 11:47:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16ABlBTq048480; Sat, 10 Jul 2021 11:47:11 GMT (envelope-from git) Date: Sat, 10 Jul 2021 11:47:11 GMT Message-Id: <202107101147.16ABlBTq048480@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: fdc71fa112d6 - main - amd64 pmap: unexpand the NBPDR macro definition MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fdc71fa112d66c7c0aba9ff80adc7b8bb22ea6ca Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 11:47:12 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=fdc71fa112d66c7c0aba9ff80adc7b8bb22ea6ca commit fdc71fa112d66c7c0aba9ff80adc7b8bb22ea6ca Author: Konstantin Belousov AuthorDate: 2021-07-10 11:07:41 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-10 11:46:54 +0000 amd64 pmap: unexpand the NBPDR macro definition Sponsored by: The FreeBSD Foundation MFC after: 1 week --- sys/amd64/amd64/pmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index 5e0b6d76ae0a..f8bd17dc6238 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -1554,7 +1554,7 @@ nkpt_init(vm_paddr_t addr) #ifdef NKPT pt_pages = NKPT; #else - pt_pages = howmany(addr, 1 << PDRSHIFT); + pt_pages = howmany(addr, NBPDR); pt_pages += NKPDPE(pt_pages); /* From owner-dev-commits-src-main@freebsd.org Sat Jul 10 15:44:47 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C695B656054; Sat, 10 Jul 2021 15:44:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GMZ8v52Nwz3pxS; Sat, 10 Jul 2021 15:44:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 95BD12355; Sat, 10 Jul 2021 15:44:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16AFilDi067845; Sat, 10 Jul 2021 15:44:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16AFilLn067844; Sat, 10 Jul 2021 15:44:47 GMT (envelope-from git) Date: Sat, 10 Jul 2021 15:44:47 GMT Message-Id: <202107101544.16AFilLn067844@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Martin Matuska Subject: git: 476ef25d321c - main - zfs: update zfs_config.h to match current OpenZFS version (bdd11cbb9) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mm X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 476ef25d321c4eb9fffe91265a03960983332bc2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 15:44:47 -0000 The branch main has been updated by mm: URL: https://cgit.FreeBSD.org/src/commit/?id=476ef25d321c4eb9fffe91265a03960983332bc2 commit 476ef25d321c4eb9fffe91265a03960983332bc2 Author: Martin Matuska AuthorDate: 2021-07-10 14:46:21 +0000 Commit: Martin Matuska CommitDate: 2021-07-10 15:43:16 +0000 zfs: update zfs_config.h to match current OpenZFS version (bdd11cbb9) TBD: build with fetch(3) support for keylocation=http(s):// --- sys/modules/zfs/zfs_config.h | 92 +++++++++++++++++++++++++++++++++++++++----- 1 file changed, 82 insertions(+), 10 deletions(-) diff --git a/sys/modules/zfs/zfs_config.h b/sys/modules/zfs/zfs_config.h index 9c7c76fac70f..ddb2527e56fd 100644 --- a/sys/modules/zfs/zfs_config.h +++ b/sys/modules/zfs/zfs_config.h @@ -88,6 +88,9 @@ /* bdev_whole() is available */ /* #undef HAVE_BDEV_WHOLE */ +/* bio->bi_bdev->bd_disk exists */ +/* #undef HAVE_BIO_BDEV_DISK */ + /* bio->bi_opf is defined */ /* #undef HAVE_BIO_BI_OPF */ @@ -100,6 +103,9 @@ /* bio_*_io_acct() available */ /* #undef HAVE_BIO_IO_ACCT */ +/* bio_max_segs() is implemented */ +/* #undef HAVE_BIO_MAX_SEGS */ + /* bio_set_dev() is available */ /* #undef HAVE_BIO_SET_DEV */ @@ -151,6 +157,9 @@ /* blk_queue_write_cache() is GPL-only */ /* #undef HAVE_BLK_QUEUE_WRITE_CACHE_GPL_ONLY */ +/* Define if revalidate_disk() in block_device_operations */ +/* #undef HAVE_BLOCK_DEVICE_OPERATIONS_REVALIDATE_DISK */ + /* Define to 1 if you have the Mac OS X function CFLocaleCopyCurrent in the CoreFoundation framework. */ /* #undef HAVE_CFLOCALECOPYCURRENT */ @@ -197,6 +206,9 @@ /* sops->dirty_inode() wants flags */ /* #undef HAVE_DIRTY_INODE_WITH_FLAGS */ +/* disk_*_io_acct() available */ +/* #undef HAVE_DISK_IO_ACCT */ + /* Define to 1 if you have the header file. */ #define HAVE_DLFCN_H 1 @@ -236,6 +248,9 @@ /* fops->fsync() without dentry */ /* #undef HAVE_FSYNC_WITHOUT_DENTRY */ +/* generic_fillattr requires struct user_namespace* */ +/* #undef HAVE_GENERIC_FILLATTR_USERNS */ + /* generic_*_io_acct() 3 arg available */ /* #undef HAVE_GENERIC_IO_ACCT_3ARG */ @@ -272,6 +287,12 @@ /* yes */ /* #undef HAVE_INODE_LOCK_SHARED */ +/* inode_owner_or_capable() exists */ +/* #undef HAVE_INODE_OWNER_OR_CAPABLE */ + +/* inode_owner_or_capable() takes user_ns */ +/* #undef HAVE_INODE_OWNER_OR_CAPABLE_IDMAPPED */ + /* inode_set_flags() exists */ /* #undef HAVE_INODE_SET_FLAGS */ @@ -290,6 +311,21 @@ /* in_compat_syscall() is available */ /* #undef HAVE_IN_COMPAT_SYSCALL */ +/* iops->create() takes struct user_namespace* */ +/* #undef HAVE_IOPS_CREATE_USERNS */ + +/* iops->mkdir() takes struct user_namespace* */ +/* #undef HAVE_IOPS_MKDIR_USERNS */ + +/* iops->mknod() takes struct user_namespace* */ +/* #undef HAVE_IOPS_MKNOD_USERNS */ + +/* iops->rename() takes struct user_namespace* */ +/* #undef HAVE_IOPS_RENAME_USERNS */ + +/* iops->symlink() takes struct user_namespace* */ +/* #undef HAVE_IOPS_SYMLINK_USERNS */ + /* iov_iter_advance() is available */ /* #undef HAVE_IOV_ITER_ADVANCE */ @@ -299,12 +335,6 @@ /* iov_iter_fault_in_readable() is available */ /* #undef HAVE_IOV_ITER_FAULT_IN_READABLE */ -/* iov_iter_init() is available */ -/* #undef HAVE_IOV_ITER_INIT */ - -/* iov_iter_init() is available */ -/* #undef HAVE_IOV_ITER_INIT_LEGACY */ - /* iov_iter_revert() is available */ /* #undef HAVE_IOV_ITER_REVERT */ @@ -404,7 +434,7 @@ /* Define to 1 if you have the header file. */ #define HAVE_MEMORY_H 1 -/* iops->create()/mkdir()/mknod() take umode_t */ +/* iops->mkdir() takes umode_t */ /* #undef HAVE_MKDIR_UMODE_T */ /* Define to 1 if you have the `mlockall' function. */ @@ -425,6 +455,9 @@ /* Define if host toolchain supports PCLMULQDQ */ #define HAVE_PCLMULQDQ 1 +/* percpu_counter_add_batch() is defined */ +/* #undef HAVE_PERCPU_COUNTER_ADD_BATCH */ + /* percpu_counter_init() wants gfp_t */ /* #undef HAVE_PERCPU_COUNTER_INIT_WITH_GFP */ @@ -500,18 +533,33 @@ /* Define to 1 if you have the header file. */ #define HAVE_SECURITY_PAM_MODULES_H 1 -/* setattr_prepare() is available */ -/* #undef HAVE_SETATTR_PREPARE */ +/* setattr_prepare() is available, doesn't accept user_namespace */ +/* #undef HAVE_SETATTR_PREPARE_NO_USERNS */ + +/* setattr_prepare() accepts user_namespace */ +/* #undef HAVE_SETATTR_PREPARE_USERNS */ -/* iops->set_acl() exists */ +/* iops->set_acl() exists, takes 3 args */ /* #undef HAVE_SET_ACL */ +/* iops->set_acl() takes 4 args */ +/* #undef HAVE_SET_ACL_USERNS */ + /* set_cached_acl() is usable */ /* #undef HAVE_SET_CACHED_ACL_USABLE */ +/* set_special_state() exists */ +/* #undef HAVE_SET_SPECIAL_STATE */ + /* struct shrink_control exists */ /* #undef HAVE_SHRINK_CONTROL_STRUCT */ +/* kernel_siginfo_t exists */ +/* #undef HAVE_SIGINFO */ + +/* signal_stop() exists */ +/* #undef HAVE_SIGNAL_STOP */ + /* new shrinker callback wants 2 args */ /* #undef HAVE_SINGLE_SHRINKER_CALLBACK */ @@ -577,6 +625,9 @@ /* i_op->tmpfile() exists */ /* #undef HAVE_TMPFILE */ +/* i_op->tmpfile() has userns */ +/* #undef HAVE_TMPFILE_USERNS */ + /* totalhigh_pages() exists */ /* #undef HAVE_TOTALHIGH_PAGES */ @@ -592,6 +643,9 @@ /* Define to 1 if you have the header file. */ #define HAVE_UNISTD_H 1 +/* iops->getattr() takes struct user_namespace* */ +/* #undef HAVE_USERNS_IOPS_GETATTR */ + /* iops->getattr() takes a vfsmount */ /* #undef HAVE_VFSMOUNT_IOPS_GETATTR */ @@ -664,6 +718,9 @@ /* xattr_handler->set() wants xattr_handler */ /* #undef HAVE_XATTR_SET_HANDLER */ +/* xattr_handler->set() takes user_namespace */ +/* #undef HAVE_XATTR_SET_USERNS */ + /* Define if you have [z] */ #define HAVE_ZLIB 1 @@ -673,6 +730,21 @@ /* kernel exports FPU functions */ /* #undef KERNEL_EXPORTS_X86_FPU */ +/* TBD: fetch(3) support */ +#if 0 +/* whether the chosen libfetch is to be loaded at run-time */ +#define LIBFETCH_DYNAMIC 1 + +/* libfetch is fetch(3) */ +#define LIBFETCH_IS_FETCH 1 + +/* libfetch is libcurl */ +#define LIBFETCH_IS_LIBCURL 0 + +/* soname of chosen libfetch */ +#define LIBFETCH_SONAME "libfetch.so.6" +#endif + /* Define to the sub-directory where libtool stores uninstalled libraries. */ #define LT_OBJDIR ".libs/" From owner-dev-commits-src-main@freebsd.org Sat Jul 10 16:20:11 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2DD96657106; Sat, 10 Jul 2021 16:20:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GMZxl0q1fz3tNv; Sat, 10 Jul 2021 16:20:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 02CDB3289; Sat, 10 Jul 2021 16:20:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16AGKAFT012187; Sat, 10 Jul 2021 16:20:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16AGKAAW012182; Sat, 10 Jul 2021 16:20:10 GMT (envelope-from git) Date: Sat, 10 Jul 2021 16:20:10 GMT Message-Id: <202107101620.16AGKAAW012182@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: David Chisnall Subject: git: 3a522ba1bc85 - main - Pass the syscall number to capsicum permission-denied signals MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: theraven X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3a522ba1bc852c3d4660a4fa32e4a94999d09a47 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 16:20:11 -0000 The branch main has been updated by theraven: URL: https://cgit.FreeBSD.org/src/commit/?id=3a522ba1bc852c3d4660a4fa32e4a94999d09a47 commit 3a522ba1bc852c3d4660a4fa32e4a94999d09a47 Author: David Chisnall AuthorDate: 2021-07-10 16:19:52 +0000 Commit: David Chisnall CommitDate: 2021-07-10 16:19:52 +0000 Pass the syscall number to capsicum permission-denied signals The syscall number is stored in the same register as the syscall return on amd64 (and possibly other architectures) and so it is impossible to recover in the signal handler after the call has returned. This small tweak delivers it in the `si_value` field of the signal, which is sufficient to catch capability violations and emulate them with a call to a more-privileged process in the signal handler. Approved by: markj (mentor) Reviewed by: kib, bcr (manpages) Differential Revision: https://reviews.freebsd.org/D29185 --- lib/libc/sys/procctl.2 | 10 ++++++++++ share/man/man3/siginfo.3 | 2 ++ sys/amd64/amd64/trap.c | 1 + sys/amd64/cloudabi32/cloudabi32_sysvec.c | 1 + sys/amd64/cloudabi64/cloudabi64_sysvec.c | 1 + sys/amd64/ia32/ia32_syscall.c | 1 + sys/amd64/include/proc.h | 1 + sys/amd64/linux/linux_sysvec.c | 1 + sys/amd64/linux32/linux32_sysvec.c | 1 + sys/arm/arm/syscall.c | 1 + sys/arm/cloudabi32/cloudabi32_sysvec.c | 1 + sys/arm/include/proc.h | 1 + sys/arm64/arm64/elf32_machdep.c | 1 + sys/arm64/arm64/trap.c | 1 + sys/arm64/cloudabi32/cloudabi32_sysvec.c | 1 + sys/arm64/cloudabi64/cloudabi64_sysvec.c | 1 + sys/arm64/include/proc.h | 1 + sys/arm64/linux/linux_sysvec.c | 1 + sys/i386/cloudabi32/cloudabi32_sysvec.c | 1 + sys/i386/i386/trap.c | 1 + sys/i386/include/proc.h | 1 + sys/i386/linux/linux_sysvec.c | 1 + sys/kern/subr_syscall.c | 1 + sys/mips/include/proc.h | 1 + sys/mips/mips/trap.c | 1 + sys/powerpc/include/proc.h | 1 + sys/powerpc/powerpc/trap.c | 1 + sys/riscv/include/proc.h | 1 + sys/riscv/riscv/trap.c | 1 + sys/sys/signal.h | 7 +++++++ 30 files changed, 46 insertions(+) diff --git a/lib/libc/sys/procctl.2 b/lib/libc/sys/procctl.2 index 432ed5919a81..ce7a2be5d5e4 100644 --- a/lib/libc/sys/procctl.2 +++ b/lib/libc/sys/procctl.2 @@ -454,6 +454,16 @@ and the .Va si_code member is set to .Dv TRAP_CAP . +The system call number is stored in the +.Va si_syscall +field of the +.Fa siginfo +signal handler parameter. +The other system call parameters can be read from the +.Fa ucontext_t +but the system call number is typically stored in the register +that also contains the return value and so is unavailable in the +signal handler. .Pp See .Xr capsicum 4 diff --git a/share/man/man3/siginfo.3 b/share/man/man3/siginfo.3 index acc8785b2f0d..7f8a809cdfa5 100644 --- a/share/man/man3/siginfo.3 +++ b/share/man/man3/siginfo.3 @@ -85,6 +85,8 @@ timer overrun count .It Vt int Ta Va si_mqd Ta .Tn POSIX message queue ID +.It Vt int Ta Va si_syscall Ta +system-call number for system calls blocked by Capsicum .El .Pp The diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c index 55649687ce50..b08495f3f139 100644 --- a/sys/amd64/amd64/trap.c +++ b/sys/amd64/amd64/trap.c @@ -1059,6 +1059,7 @@ cpu_fetch_syscall_args(struct thread *td) sa = &td->td_sa; sa->code = frame->tf_rax; + sa->original_code = sa->code; if (__predict_false(sa->code == SYS_syscall || sa->code == SYS___syscall || diff --git a/sys/amd64/cloudabi32/cloudabi32_sysvec.c b/sys/amd64/cloudabi32/cloudabi32_sysvec.c index 164f87e90e91..26924ed5a980 100644 --- a/sys/amd64/cloudabi32/cloudabi32_sysvec.c +++ b/sys/amd64/cloudabi32/cloudabi32_sysvec.c @@ -101,6 +101,7 @@ cloudabi32_fetch_syscall_args(struct thread *td) /* Obtain system call number. */ sa->code = frame->tf_rax; + sa->original_code = sa->code; if (sa->code >= CLOUDABI32_SYS_MAXSYSCALL) return (ENOSYS); sa->callp = &cloudabi32_sysent[sa->code]; diff --git a/sys/amd64/cloudabi64/cloudabi64_sysvec.c b/sys/amd64/cloudabi64/cloudabi64_sysvec.c index d3893902b08e..c08d912e84d4 100644 --- a/sys/amd64/cloudabi64/cloudabi64_sysvec.c +++ b/sys/amd64/cloudabi64/cloudabi64_sysvec.c @@ -98,6 +98,7 @@ cloudabi64_fetch_syscall_args(struct thread *td) /* Obtain system call number. */ sa->code = frame->tf_rax; + sa->original_code = sa->code; if (sa->code >= CLOUDABI64_SYS_MAXSYSCALL) return (ENOSYS); sa->callp = &cloudabi64_sysent[sa->code]; diff --git a/sys/amd64/ia32/ia32_syscall.c b/sys/amd64/ia32/ia32_syscall.c index 6c9399d1a52f..9294ef8ce741 100644 --- a/sys/amd64/ia32/ia32_syscall.c +++ b/sys/amd64/ia32/ia32_syscall.c @@ -150,6 +150,7 @@ ia32_fetch_syscall_args(struct thread *td) params = (caddr_t)frame->tf_rsp + sizeof(u_int32_t); sa->code = frame->tf_rax; + sa->original_code = sa->code; /* * Need to check if this is a 32 bit or 64 bit syscall. diff --git a/sys/amd64/include/proc.h b/sys/amd64/include/proc.h index 59796e729ac4..0f8cf50e326d 100644 --- a/sys/amd64/include/proc.h +++ b/sys/amd64/include/proc.h @@ -92,6 +92,7 @@ struct mdproc { struct syscall_args { u_int code; + u_int original_code; struct sysent *callp; register_t args[8]; }; diff --git a/sys/amd64/linux/linux_sysvec.c b/sys/amd64/linux/linux_sysvec.c index c5538932b1e3..566af6de29e7 100644 --- a/sys/amd64/linux/linux_sysvec.c +++ b/sys/amd64/linux/linux_sysvec.c @@ -191,6 +191,7 @@ linux_fetch_syscall_args(struct thread *td) sa->args[4] = frame->tf_r8; sa->args[5] = frame->tf_r9; sa->code = frame->tf_rax; + sa->original_code = sa->code; if (sa->code >= p->p_sysent->sv_size) /* nosys */ diff --git a/sys/amd64/linux32/linux32_sysvec.c b/sys/amd64/linux32/linux32_sysvec.c index 504d57e418a5..7dfd57a74a1e 100644 --- a/sys/amd64/linux32/linux32_sysvec.c +++ b/sys/amd64/linux32/linux32_sysvec.c @@ -662,6 +662,7 @@ linux32_fetch_syscall_args(struct thread *td) sa->args[4] = frame->tf_rdi; sa->args[5] = frame->tf_rbp; /* Unconfirmed */ sa->code = frame->tf_rax; + sa->original_code = sa->code; if (sa->code >= p->p_sysent->sv_size) /* nosys */ diff --git a/sys/arm/arm/syscall.c b/sys/arm/arm/syscall.c index a851db6e4556..a635de0ec716 100644 --- a/sys/arm/arm/syscall.c +++ b/sys/arm/arm/syscall.c @@ -108,6 +108,7 @@ cpu_fetch_syscall_args(struct thread *td) nap = 4; sa = &td->td_sa; sa->code = td->td_frame->tf_r7; + sa->original_code = sa->code; ap = &td->td_frame->tf_r0; if (sa->code == SYS_syscall) { sa->code = *ap++; diff --git a/sys/arm/cloudabi32/cloudabi32_sysvec.c b/sys/arm/cloudabi32/cloudabi32_sysvec.c index a8c5da47d265..4df57b22e13d 100644 --- a/sys/arm/cloudabi32/cloudabi32_sysvec.c +++ b/sys/arm/cloudabi32/cloudabi32_sysvec.c @@ -78,6 +78,7 @@ cloudabi32_fetch_syscall_args(struct thread *td) /* Obtain system call number. */ sa->code = frame->tf_r12; + sa->original_code = sa->code; if (sa->code >= CLOUDABI32_SYS_MAXSYSCALL) return (ENOSYS); sa->callp = &cloudabi32_sysent[sa->code]; diff --git a/sys/arm/include/proc.h b/sys/arm/include/proc.h index a37ccd8f621c..9566c264731e 100644 --- a/sys/arm/include/proc.h +++ b/sys/arm/include/proc.h @@ -75,6 +75,7 @@ struct mdproc { */ struct syscall_args { u_int code; + u_int original_code; struct sysent *callp; register_t args[MAXARGS]; } __aligned(8); diff --git a/sys/arm64/arm64/elf32_machdep.c b/sys/arm64/arm64/elf32_machdep.c index 206413b45172..7cedbffc4d43 100644 --- a/sys/arm64/arm64/elf32_machdep.c +++ b/sys/arm64/arm64/elf32_machdep.c @@ -175,6 +175,7 @@ freebsd32_fetch_syscall_args(struct thread *td) /* r7 is the syscall id */ sa->code = td->td_frame->tf_x[7]; + sa->original_code = sa->code; if (sa->code == SYS_syscall) { sa->code = *ap++; diff --git a/sys/arm64/arm64/trap.c b/sys/arm64/arm64/trap.c index 744b646b31c8..2b2d2e433efa 100644 --- a/sys/arm64/arm64/trap.c +++ b/sys/arm64/arm64/trap.c @@ -130,6 +130,7 @@ cpu_fetch_syscall_args(struct thread *td) dst_ap = &sa->args[0]; sa->code = td->td_frame->tf_x[8]; + sa->original_code = sa->code; if (__predict_false(sa->code == SYS_syscall || sa->code == SYS___syscall)) { sa->code = *ap++; diff --git a/sys/arm64/cloudabi32/cloudabi32_sysvec.c b/sys/arm64/cloudabi32/cloudabi32_sysvec.c index 889393560ede..b7be5cc0e5e3 100644 --- a/sys/arm64/cloudabi32/cloudabi32_sysvec.c +++ b/sys/arm64/cloudabi32/cloudabi32_sysvec.c @@ -75,6 +75,7 @@ cloudabi32_fetch_syscall_args(struct thread *td) /* Obtain system call number. */ sa->code = frame->tf_x[0]; + sa->original_code = sa->code; if (sa->code >= CLOUDABI32_SYS_MAXSYSCALL) return (ENOSYS); sa->callp = &cloudabi32_sysent[sa->code]; diff --git a/sys/arm64/cloudabi64/cloudabi64_sysvec.c b/sys/arm64/cloudabi64/cloudabi64_sysvec.c index bdbd828b7b62..624d86693457 100644 --- a/sys/arm64/cloudabi64/cloudabi64_sysvec.c +++ b/sys/arm64/cloudabi64/cloudabi64_sysvec.c @@ -78,6 +78,7 @@ cloudabi64_fetch_syscall_args(struct thread *td) /* Obtain system call number. */ sa->code = frame->tf_x[8]; + sa->original_code = sa->code; if (sa->code >= CLOUDABI64_SYS_MAXSYSCALL) return (ENOSYS); sa->callp = &cloudabi64_sysent[sa->code]; diff --git a/sys/arm64/include/proc.h b/sys/arm64/include/proc.h index bb933dc98241..3800798d79b7 100644 --- a/sys/arm64/include/proc.h +++ b/sys/arm64/include/proc.h @@ -49,6 +49,7 @@ struct mdproc { #define MAXARGS 8 struct syscall_args { u_int code; + u_int original_code; struct sysent *callp; register_t args[MAXARGS]; }; diff --git a/sys/arm64/linux/linux_sysvec.c b/sys/arm64/linux/linux_sysvec.c index e1d3708b70e9..7749c1cd7fc8 100644 --- a/sys/arm64/linux/linux_sysvec.c +++ b/sys/arm64/linux/linux_sysvec.c @@ -125,6 +125,7 @@ linux_fetch_syscall_args(struct thread *td) sa = &td->td_sa; sa->code = td->td_frame->tf_x[8]; + sa->original_code = sa->code; /* LINUXTODO: generic syscall? */ if (sa->code >= p->p_sysent->sv_size) sa->callp = &p->p_sysent->sv_table[0]; diff --git a/sys/i386/cloudabi32/cloudabi32_sysvec.c b/sys/i386/cloudabi32/cloudabi32_sysvec.c index 4f12d2b6cbce..e0a50f6697a9 100644 --- a/sys/i386/cloudabi32/cloudabi32_sysvec.c +++ b/sys/i386/cloudabi32/cloudabi32_sysvec.c @@ -96,6 +96,7 @@ cloudabi32_fetch_syscall_args(struct thread *td) /* Obtain system call number. */ sa->code = frame->tf_eax; + sa->original_code = sa->code; if (sa->code >= CLOUDABI32_SYS_MAXSYSCALL) return (ENOSYS); sa->callp = &cloudabi32_sysent[sa->code]; diff --git a/sys/i386/i386/trap.c b/sys/i386/i386/trap.c index 045478149be5..07abac23c9da 100644 --- a/sys/i386/i386/trap.c +++ b/sys/i386/i386/trap.c @@ -1052,6 +1052,7 @@ cpu_fetch_syscall_args(struct thread *td) #endif sa->code = frame->tf_eax; + sa->original_code = sa->code; params = (caddr_t)frame->tf_esp + sizeof(uint32_t); /* diff --git a/sys/i386/include/proc.h b/sys/i386/include/proc.h index 2950946ff155..76e1ac611474 100644 --- a/sys/i386/include/proc.h +++ b/sys/i386/include/proc.h @@ -64,6 +64,7 @@ struct mdproc { struct syscall_args { u_int code; + u_int original_code; struct sysent *callp; register_t args[8]; }; diff --git a/sys/i386/linux/linux_sysvec.c b/sys/i386/linux/linux_sysvec.c index adb70fded6dc..a0959d55b585 100644 --- a/sys/i386/linux/linux_sysvec.c +++ b/sys/i386/linux/linux_sysvec.c @@ -756,6 +756,7 @@ linux_fetch_syscall_args(struct thread *td) sa = &td->td_sa; sa->code = frame->tf_eax; + sa->original_code = sa->code; sa->args[0] = frame->tf_ebx; sa->args[1] = frame->tf_ecx; sa->args[2] = frame->tf_edx; diff --git a/sys/kern/subr_syscall.c b/sys/kern/subr_syscall.c index 85a0814a2125..2304e3e7f3f9 100644 --- a/sys/kern/subr_syscall.c +++ b/sys/kern/subr_syscall.c @@ -230,6 +230,7 @@ syscallret(struct thread *td) ksi.ksi_signo = SIGTRAP; ksi.ksi_errno = td->td_errno; ksi.ksi_code = TRAP_CAP; + ksi.ksi_info.si_syscall = sa->original_code; trapsignal(td, &ksi); } } diff --git a/sys/mips/include/proc.h b/sys/mips/include/proc.h index 0cb1d433387c..29d832a162e6 100644 --- a/sys/mips/include/proc.h +++ b/sys/mips/include/proc.h @@ -84,6 +84,7 @@ struct mdproc { #define MAXARGS 8 struct syscall_args { u_int code; + u_int original_code; struct sysent *callp; register_t args[MAXARGS]; }; diff --git a/sys/mips/mips/trap.c b/sys/mips/mips/trap.c index 96a2de4ee817..9d7a07606373 100644 --- a/sys/mips/mips/trap.c +++ b/sys/mips/mips/trap.c @@ -355,6 +355,7 @@ cpu_fetch_syscall_args(struct thread *td) else locr0->pc += sizeof(int); sa->code = locr0->v0; + sa->original_code = sa->code; switch (sa->code) { case SYS___syscall: diff --git a/sys/powerpc/include/proc.h b/sys/powerpc/include/proc.h index d4df3ccfefef..aac4e66b39fc 100644 --- a/sys/powerpc/include/proc.h +++ b/sys/powerpc/include/proc.h @@ -62,6 +62,7 @@ struct mdproc { #define MAXARGS 8 struct syscall_args { u_int code; + u_int original_code; struct sysent *callp; register_t args[MAXARGS]; }; diff --git a/sys/powerpc/powerpc/trap.c b/sys/powerpc/powerpc/trap.c index 3a1bdf7cde07..ab5189a0f418 100644 --- a/sys/powerpc/powerpc/trap.c +++ b/sys/powerpc/powerpc/trap.c @@ -667,6 +667,7 @@ cpu_fetch_syscall_args(struct thread *td) sa = &td->td_sa; sa->code = frame->fixreg[0]; + sa->original_code = sa->code; params = (caddr_t)(frame->fixreg + FIRSTARG); n = NARGREG; diff --git a/sys/riscv/include/proc.h b/sys/riscv/include/proc.h index 4b5ae9ebe3ed..1c6c8d2919b5 100644 --- a/sys/riscv/include/proc.h +++ b/sys/riscv/include/proc.h @@ -48,6 +48,7 @@ struct mdproc { #define MAXARGS 8 struct syscall_args { u_int code; + u_int original_code; struct sysent *callp; register_t args[MAXARGS]; }; diff --git a/sys/riscv/riscv/trap.c b/sys/riscv/riscv/trap.c index 07d7f84a94e8..8844638c8204 100644 --- a/sys/riscv/riscv/trap.c +++ b/sys/riscv/riscv/trap.c @@ -103,6 +103,7 @@ cpu_fetch_syscall_args(struct thread *td) dst_ap = &sa->args[0]; sa->code = td->td_frame->tf_t[0]; + sa->original_code = sa->code; if (__predict_false(sa->code == SYS_syscall || sa->code == SYS___syscall)) { sa->code = *ap++; diff --git a/sys/sys/signal.h b/sys/sys/signal.h index 8b45a521c3ee..9dae3ce04745 100644 --- a/sys/sys/signal.h +++ b/sys/sys/signal.h @@ -255,6 +255,12 @@ typedef struct __siginfo { struct { long _band; /* band event for SIGPOLL */ } _poll; /* was this ever used ? */ + struct { + int _syscall; /* Syscall number for signals + * delivered as a result of + * system calls denied by + * Capsicum. */ + } _capsicum; struct { long __spare1__; int __spare2__[7]; @@ -267,6 +273,7 @@ typedef struct __siginfo { #define si_overrun _reason._timer._overrun #define si_mqd _reason._mesgq._mqd #define si_band _reason._poll._band +#define si_syscall _reason._capsicum._syscall #if defined(_WANT_LWPINFO32) || (defined(_KERNEL) && defined(__LP64__)) struct siginfo32 { From owner-dev-commits-src-main@freebsd.org Sat Jul 10 16:54:03 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 72F9065727A; Sat, 10 Jul 2021 16:54:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GMbhq2sszz4Rll; Sat, 10 Jul 2021 16:54:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4AC333B46; Sat, 10 Jul 2021 16:54:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16AGs3Ki061055; Sat, 10 Jul 2021 16:54:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16AGs3Hn061054; Sat, 10 Jul 2021 16:54:03 GMT (envelope-from git) Date: Sat, 10 Jul 2021 16:54:03 GMT Message-Id: <202107101654.16AGs3Hn061054@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 445b5554bf97 - main - nvmecontrol: document power command MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 445b5554bf97254a0ead3d70f801871d62dcfb62 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 16:54:03 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=445b5554bf97254a0ead3d70f801871d62dcfb62 commit 445b5554bf97254a0ead3d70f801871d62dcfb62 Author: Warner Losh AuthorDate: 2021-07-10 16:51:15 +0000 Commit: Warner Losh CommitDate: 2021-07-10 16:53:34 +0000 nvmecontrol: document power command The description of the power command is missing. While the synopsis is present, there's no explanation. Add one. Reviewed by: mav, chuck PR: 237866 Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D31122 --- sbin/nvmecontrol/nvmecontrol.8 | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/sbin/nvmecontrol/nvmecontrol.8 b/sbin/nvmecontrol/nvmecontrol.8 index 2d634eb54216..7d70e1762f73 100644 --- a/sbin/nvmecontrol/nvmecontrol.8 +++ b/sbin/nvmecontrol/nvmecontrol.8 @@ -470,6 +470,37 @@ Run in mode. This will report status on a sanitize that is already running on the drive. .El +.Ss power +Manage the power modes of the NVMe controller. +.Bl -tag -width 6n +.It Fl l +List all supported power modes. +.It Fl p Ar mode +Set the power mode to +.Ar mode . +This must be a mode listed with the +.Dl nvmecontrol power -l +command. +.It Fl w Ar hint +Set the workload hint for automatic power mode control. +.Bl -tag -compact -width 6n +.It 0 +No workload hint is provided. +.It 1 +Extended idle period workload. +The device is often idle for minutes at a time. +A burst of write commands comes in over a period of seconds. +Then the device returns to being idle. +.It 2 +Heavy sequential writes. +A huge number of sequential writes will be submitted, filling the submission queues. +.It Other +All other values are reserved and have no standard meaning. +.El +Please see the +.Dq NVM Subsystem Workloads +section of the relevant NVM Express Base Standard for details. +.El .Ss selftest Start the specified device self-test: .Bl -tag -width 6n @@ -505,7 +536,7 @@ and commands send NVMe commands to either the administrative or the data part of the device. These commands are expected to be compatible with nvme-cli. -Please see the NVMe Standard for details. +Please see the NVM Express Base Standard for details. .Bl -tag -width 16n .It Fl o -opcode Ar opcode Opcode to send. From owner-dev-commits-src-main@freebsd.org Sat Jul 10 16:54:04 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C6909657184; Sat, 10 Jul 2021 16:54:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GMbhr3sdRz4S2k; Sat, 10 Jul 2021 16:54:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5A06E3BCB; Sat, 10 Jul 2021 16:54:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16AGs4uR061079; Sat, 10 Jul 2021 16:54:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16AGs4DG061078; Sat, 10 Jul 2021 16:54:04 GMT (envelope-from git) Date: Sat, 10 Jul 2021 16:54:04 GMT Message-Id: <202107101654.16AGs4DG061078@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: d8514fa6f1b0 - main - mk: LZMA_SUPPORT is unused MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d8514fa6f1b0b9824b169c5ab66f37713b303c57 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 16:54:05 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=d8514fa6f1b0b9824b169c5ab66f37713b303c57 commit d8514fa6f1b0b9824b169c5ab66f37713b303c57 Author: Warner Losh AuthorDate: 2021-07-10 16:52:12 +0000 Commit: Warner Losh CommitDate: 2021-07-10 16:53:35 +0000 mk: LZMA_SUPPORT is unused Retire LZMA_SUPPORT. It's unused since r332995. Reviewed by: delphij PR: 244302 Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D31088 --- share/man/man5/src.conf.5 | 4 +--- share/mk/src.opts.mk | 1 - tools/build/options/WITHOUT_LZMA_SUPPORT | 2 -- 3 files changed, 1 insertion(+), 6 deletions(-) diff --git a/share/man/man5/src.conf.5 b/share/man/man5/src.conf.5 index e9265df9051a..b08abf4888b7 100644 --- a/share/man/man5/src.conf.5 +++ b/share/man/man5/src.conf.5 @@ -1,6 +1,6 @@ .\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman. .\" $FreeBSD$ -.Dd June 28, 2021 +.Dd July 6, 2021 .Dt SRC.CONF 5 .Os .Sh NAME @@ -1040,8 +1040,6 @@ and related programs. Build .Xr ls 1 without support for colors to distinguish file types. -.It Va WITHOUT_LZMA_SUPPORT -Build some programs without optional lzma compression support. .It Va WITHOUT_MAIL Do not build any mail support (MUA or MTA). When set, it enforces these options: diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk index db2625a80c52..27de86f6c8d4 100644 --- a/share/mk/src.opts.mk +++ b/share/mk/src.opts.mk @@ -139,7 +139,6 @@ __DEFAULT_YES_OPTIONS = \ LOCATE \ LPR \ LS_COLORS \ - LZMA_SUPPORT \ MAIL \ MAILWRAPPER \ MAKE \ diff --git a/tools/build/options/WITHOUT_LZMA_SUPPORT b/tools/build/options/WITHOUT_LZMA_SUPPORT deleted file mode 100644 index 9e8a9bc55194..000000000000 --- a/tools/build/options/WITHOUT_LZMA_SUPPORT +++ /dev/null @@ -1,2 +0,0 @@ -.\" $FreeBSD$ -Build some programs without optional lzma compression support. From owner-dev-commits-src-main@freebsd.org Sat Jul 10 19:04:47 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1A630659542; Sat, 10 Jul 2021 19:04:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GMfbg03qRz4jKj; Sat, 10 Jul 2021 19:04:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DEEB051F5; Sat, 10 Jul 2021 19:04:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16AJ4kmm035409; Sat, 10 Jul 2021 19:04:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16AJ4k4x035408; Sat, 10 Jul 2021 19:04:46 GMT (envelope-from git) Date: Sat, 10 Jul 2021 19:04:46 GMT Message-Id: <202107101904.16AJ4k4x035408@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: e036ee6ce2e4 - main - Let the xhci_hw_root structure span exactly XHCI_PAGE_SIZE bytes by increasing the number of completion event TRBs. This avoids wasting memory. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e036ee6ce2e4d6fe0564f8bb3aa99a2f61d48fc6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 19:04:47 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=e036ee6ce2e4d6fe0564f8bb3aa99a2f61d48fc6 commit e036ee6ce2e4d6fe0564f8bb3aa99a2f61d48fc6 Author: Hans Petter Selasky AuthorDate: 2021-07-10 12:14:11 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-10 17:57:52 +0000 Let the xhci_hw_root structure span exactly XHCI_PAGE_SIZE bytes by increasing the number of completion event TRBs. This avoids wasting memory. MFC after: 1 week Sponsored by: NVIDIA Networking --- sys/dev/usb/controller/xhci.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/dev/usb/controller/xhci.h b/sys/dev/usb/controller/xhci.h index c0427e0cf11f..e8841a05b134 100644 --- a/sys/dev/usb/controller/xhci.h +++ b/sys/dev/usb/controller/xhci.h @@ -33,7 +33,7 @@ #define XHCI_MAX_DEVICES MIN(USB_MAX_DEVICES, 128) #define XHCI_MAX_ENDPOINTS 32 /* hardcoded - do not change */ #define XHCI_MAX_SCRATCHPADS 256 /* theoretical max is 1023 */ -#define XHCI_MAX_EVENTS (16 * 13) +#define XHCI_MAX_EVENTS 232 #define XHCI_MAX_COMMANDS (16 * 1) #define XHCI_MAX_RSEG 1 #define XHCI_MAX_TRANSFERS 4 @@ -383,6 +383,8 @@ struct xhci_hw_root { struct xhci_trb hwr_commands[XHCI_MAX_COMMANDS]; }; +CTASSERT(sizeof(struct xhci_hw_root) == XHCI_PAGE_SIZE); + struct xhci_endpoint_ext { struct xhci_trb *trb; struct usb_xfer *xfer[XHCI_MAX_TRANSFERS * XHCI_MAX_STREAMS]; From owner-dev-commits-src-main@freebsd.org Sat Jul 10 19:04:48 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A941365986A; Sat, 10 Jul 2021 19:04:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GMfbh1Blbz4jFD; Sat, 10 Jul 2021 19:04:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 105295B15; Sat, 10 Jul 2021 19:04:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16AJ4lqt035433; Sat, 10 Jul 2021 19:04:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16AJ4lj3035432; Sat, 10 Jul 2021 19:04:47 GMT (envelope-from git) Date: Sat, 10 Jul 2021 19:04:47 GMT Message-Id: <202107101904.16AJ4lj3035432@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: d038463bd269 - main - Make sure the XHCI driver obeys the isochronous scheduling threshold value as given by the XHCI hardware parameters to avoid scheduling isochronous transfers too early. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d038463bd269031fa8f13c0951b223bcae02bbca Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 19:04:48 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=d038463bd269031fa8f13c0951b223bcae02bbca commit d038463bd269031fa8f13c0951b223bcae02bbca Author: Hans Petter Selasky AuthorDate: 2021-07-10 16:09:56 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-10 17:57:52 +0000 Make sure the XHCI driver obeys the isochronous scheduling threshold value as given by the XHCI hardware parameters to avoid scheduling isochronous transfers too early. MFC after: 1 week Sponsored by: NVIDIA Networking --- sys/dev/usb/controller/xhci.c | 11 ++++++++++- sys/dev/usb/controller/xhci.h | 3 +++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/sys/dev/usb/controller/xhci.c b/sys/dev/usb/controller/xhci.c index 10e37c97c254..dd64c2d45141 100644 --- a/sys/dev/usb/controller/xhci.c +++ b/sys/dev/usb/controller/xhci.c @@ -644,6 +644,9 @@ xhci_init(struct xhci_softc *sc, device_t self, uint8_t dma32) DPRINTF("HCS2=0x%08x\n", temp); + /* get isochronous scheduling threshold */ + sc->sc_ist = XHCI_HCS2_IST(temp); + /* get number of scratchpads */ sc->sc_noscratch = XHCI_HCS2_SPB_MAX(temp); @@ -2075,7 +2078,13 @@ xhci_setup_generic_chain(struct usb_xfer *xfer) x = XREAD4(temp.sc, runt, XHCI_MFINDEX); - DPRINTF("MFINDEX=0x%08x\n", x); + DPRINTF("MFINDEX=0x%08x IST=0x%x\n", x, sc->sc_ist); + + /* add isochronous scheduling threshold */ + if (temp.sc->sc_ist & 8) + x += (temp.sc->sc_ist & 7) << 3; + else + x += (temp.sc->sc_ist & 7); switch (usbd_get_speed(xfer->xroot->udev)) { case USB_SPEED_FULL: diff --git a/sys/dev/usb/controller/xhci.h b/sys/dev/usb/controller/xhci.h index e8841a05b134..802207208569 100644 --- a/sys/dev/usb/controller/xhci.h +++ b/sys/dev/usb/controller/xhci.h @@ -529,6 +529,9 @@ struct xhci_softc { /* size of context */ uint8_t sc_ctx_is_64_byte; + /* Isochronous Scheduling Threshold */ + uint8_t sc_ist; + /* vendor string for root HUB */ char sc_vendor[16]; }; From owner-dev-commits-src-main@freebsd.org Sat Jul 10 19:04:49 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 59A9B65992E; Sat, 10 Jul 2021 19:04:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GMfbj1vvSz4j6d; Sat, 10 Jul 2021 19:04:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 26D6F5A8B; Sat, 10 Jul 2021 19:04:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16AJ4nv1035461; Sat, 10 Jul 2021 19:04:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16AJ4nuC035460; Sat, 10 Jul 2021 19:04:49 GMT (envelope-from git) Date: Sat, 10 Jul 2021 19:04:49 GMT Message-Id: <202107101904.16AJ4nuC035460@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: 3f5054862a46 - main - Make sure the avr32dci_odevd structure is used. This fixes a compilation error. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3f5054862a4603116bb872cf8b7b3cc946e93741 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 19:04:49 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=3f5054862a4603116bb872cf8b7b3cc946e93741 commit 3f5054862a4603116bb872cf8b7b3cc946e93741 Author: Hans Petter Selasky AuthorDate: 2021-07-10 16:13:21 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-10 17:57:52 +0000 Make sure the avr32dci_odevd structure is used. This fixes a compilation error. MFC after: 1 week Sponsored by: NVIDIA Networking --- sys/dev/usb/controller/avr32dci.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys/dev/usb/controller/avr32dci.c b/sys/dev/usb/controller/avr32dci.c index eaf0f8261b92..7cc5ca5d90c7 100644 --- a/sys/dev/usb/controller/avr32dci.c +++ b/sys/dev/usb/controller/avr32dci.c @@ -1690,6 +1690,12 @@ tr_handle_get_descriptor: len = sizeof(avr32dci_devd); ptr = (const void *)&avr32dci_devd; goto tr_valid; + case UDESC_DEVICE_QUALIFIER: + if (value & 0xff) + goto tr_stalled; + len = sizeof(avr32dci_odevd); + ptr = (const void *)&avr32dci_odevd; + goto tr_valid; case UDESC_CONFIG: if (value & 0xff) { goto tr_stalled; From owner-dev-commits-src-main@freebsd.org Sat Jul 10 19:04:50 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 90B8D65986F; Sat, 10 Jul 2021 19:04:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GMfbk2w4rz4jQD; Sat, 10 Jul 2021 19:04:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4204158B3; Sat, 10 Jul 2021 19:04:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16AJ4oPN035488; Sat, 10 Jul 2021 19:04:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16AJ4oFN035487; Sat, 10 Jul 2021 19:04:50 GMT (envelope-from git) Date: Sat, 10 Jul 2021 19:04:50 GMT Message-Id: <202107101904.16AJ4oFN035487@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: 8fc2a3c41791 - main - Factor out repeated code in the USB controller drivers to avoid bugs computing the same isochronous start frame number over and over again. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8fc2a3c41791b205a107dc2bec16ac7514a57958 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 19:04:51 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=8fc2a3c41791b205a107dc2bec16ac7514a57958 commit 8fc2a3c41791b205a107dc2bec16ac7514a57958 Author: Hans Petter Selasky AuthorDate: 2021-07-10 16:17:51 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-10 18:59:00 +0000 Factor out repeated code in the USB controller drivers to avoid bugs computing the same isochronous start frame number over and over again. PR: 257082 MFC after: 1 week Sponsored by: NVIDIA Networking --- sys/dev/usb/controller/atmegadci.c | 37 +------------- sys/dev/usb/controller/avr32dci.c | 37 +------------- sys/dev/usb/controller/dwc_otg.c | 45 +---------------- sys/dev/usb/controller/ehci.c | 96 ++++++------------------------------ sys/dev/usb/controller/musb_otg.c | 42 +--------------- sys/dev/usb/controller/ohci.c | 33 +++---------- sys/dev/usb/controller/saf1761_otg.c | 70 ++------------------------ sys/dev/usb/controller/uhci.c | 41 +++------------ sys/dev/usb/controller/uss820dci.c | 35 +------------ sys/dev/usb/controller/xhci.c | 85 +++++++++++-------------------- sys/dev/usb/usb_transfer.c | 69 ++++++++++++++++++++++++++ sys/dev/usb/usb_transfer.h | 1 + 12 files changed, 140 insertions(+), 451 deletions(-) diff --git a/sys/dev/usb/controller/atmegadci.c b/sys/dev/usb/controller/atmegadci.c index 1f91948c4ccd..06bee13c3a59 100644 --- a/sys/dev/usb/controller/atmegadci.c +++ b/sys/dev/usb/controller/atmegadci.c @@ -1421,7 +1421,6 @@ static void atmegadci_device_isoc_fs_enter(struct usb_xfer *xfer) { struct atmegadci_softc *sc = ATMEGA_BUS2SC(xfer->xroot->bus); - uint32_t temp; uint32_t nframes; DPRINTFN(6, "xfer=%p next=%d nframes=%d\n", @@ -1433,41 +1432,9 @@ atmegadci_device_isoc_fs_enter(struct usb_xfer *xfer) (ATMEGA_READ_1(sc, ATMEGA_UDFNUMH) << 8) | (ATMEGA_READ_1(sc, ATMEGA_UDFNUML)); - nframes &= ATMEGA_FRAME_MASK; - - /* - * check if the frame index is within the window where the frames - * will be inserted - */ - temp = (nframes - xfer->endpoint->isoc_next) & ATMEGA_FRAME_MASK; - - if ((xfer->endpoint->is_synced == 0) || - (temp < xfer->nframes)) { - /* - * If there is data underflow or the pipe queue is - * empty we schedule the transfer a few frames ahead - * of the current frame position. Else two isochronous - * transfers might overlap. - */ - xfer->endpoint->isoc_next = (nframes + 3) & ATMEGA_FRAME_MASK; - xfer->endpoint->is_synced = 1; + if (usbd_xfer_get_isochronous_start_frame( + xfer, nframes, 0, 1, ATMEGA_FRAME_MASK, NULL)) DPRINTFN(3, "start next=%d\n", xfer->endpoint->isoc_next); - } - /* - * compute how many milliseconds the insertion is ahead of the - * current frame position: - */ - temp = (xfer->endpoint->isoc_next - nframes) & ATMEGA_FRAME_MASK; - - /* - * pre-compute when the isochronous transfer will be finished: - */ - xfer->isoc_time_complete = - usb_isoc_time_expand(&sc->sc_bus, nframes) + temp + - xfer->nframes; - - /* compute frame number for next insertion */ - xfer->endpoint->isoc_next += xfer->nframes; /* setup TDs */ atmegadci_setup_standard_chain(xfer); diff --git a/sys/dev/usb/controller/avr32dci.c b/sys/dev/usb/controller/avr32dci.c index 7cc5ca5d90c7..0ab9a8ff665d 100644 --- a/sys/dev/usb/controller/avr32dci.c +++ b/sys/dev/usb/controller/avr32dci.c @@ -1355,7 +1355,6 @@ static void avr32dci_device_isoc_fs_enter(struct usb_xfer *xfer) { struct avr32dci_softc *sc = AVR32_BUS2SC(xfer->xroot->bus); - uint32_t temp; uint32_t nframes; uint8_t ep_no; @@ -1366,41 +1365,9 @@ avr32dci_device_isoc_fs_enter(struct usb_xfer *xfer) ep_no = xfer->endpointno & UE_ADDR; nframes = (AVR32_READ_4(sc, AVR32_FNUM) / 8); - nframes &= AVR32_FRAME_MASK; - - /* - * check if the frame index is within the window where the frames - * will be inserted - */ - temp = (nframes - xfer->endpoint->isoc_next) & AVR32_FRAME_MASK; - - if ((xfer->endpoint->is_synced == 0) || - (temp < xfer->nframes)) { - /* - * If there is data underflow or the pipe queue is - * empty we schedule the transfer a few frames ahead - * of the current frame position. Else two isochronous - * transfers might overlap. - */ - xfer->endpoint->isoc_next = (nframes + 3) & AVR32_FRAME_MASK; - xfer->endpoint->is_synced = 1; + if (usbd_xfer_get_isochronous_start_frame( + xfer, nframes, 0, 1, AVR32_FRAME_MASK, NULL)) DPRINTFN(3, "start next=%d\n", xfer->endpoint->isoc_next); - } - /* - * compute how many milliseconds the insertion is ahead of the - * current frame position: - */ - temp = (xfer->endpoint->isoc_next - nframes) & AVR32_FRAME_MASK; - - /* - * pre-compute when the isochronous transfer will be finished: - */ - xfer->isoc_time_complete = - usb_isoc_time_expand(&sc->sc_bus, nframes) + temp + - xfer->nframes; - - /* compute frame number for next insertion */ - xfer->endpoint->isoc_next += xfer->nframes; /* setup TDs */ avr32dci_setup_standard_chain(xfer); diff --git a/sys/dev/usb/controller/dwc_otg.c b/sys/dev/usb/controller/dwc_otg.c index 421b95593b3a..8192c7b011e9 100644 --- a/sys/dev/usb/controller/dwc_otg.c +++ b/sys/dev/usb/controller/dwc_otg.c @@ -4189,9 +4189,7 @@ dwc_otg_device_isoc_start(struct usb_xfer *xfer) { struct dwc_otg_softc *sc = DWC_OTG_BUS2SC(xfer->xroot->bus); uint32_t temp; - uint32_t msframes; uint32_t framenum; - uint8_t shift = usbd_xfer_get_fps_shift(xfer); DPRINTFN(6, "xfer=%p next=%d nframes=%d\n", xfer, xfer->endpoint->isoc_next, xfer->nframes); @@ -4214,52 +4212,13 @@ dwc_otg_device_isoc_start(struct usb_xfer *xfer) if (sc->sc_flags.status_high_speed) framenum /= 8; - framenum &= DWC_OTG_FRAME_MASK; - - /* - * Compute number of milliseconds worth of data traffic for - * this USB transfer: - */ - if (xfer->xroot->udev->speed == USB_SPEED_HIGH) - msframes = ((xfer->nframes << shift) + 7) / 8; - else - msframes = xfer->nframes; - - /* - * check if the frame index is within the window where the frames - * will be inserted - */ - temp = (framenum - xfer->endpoint->isoc_next) & DWC_OTG_FRAME_MASK; - - if ((xfer->endpoint->is_synced == 0) || (temp < msframes)) { - /* - * If there is data underflow or the pipe queue is - * empty we schedule the transfer a few frames ahead - * of the current frame position. Else two isochronous - * transfers might overlap. - */ - xfer->endpoint->isoc_next = (framenum + 3) & DWC_OTG_FRAME_MASK; - xfer->endpoint->is_synced = 1; + if (usbd_xfer_get_isochronous_start_frame( + xfer, framenum, 0, 1, DWC_OTG_FRAME_MASK, NULL)) DPRINTFN(3, "start next=%d\n", xfer->endpoint->isoc_next); - } - /* - * compute how many milliseconds the insertion is ahead of the - * current frame position: - */ - temp = (xfer->endpoint->isoc_next - framenum) & DWC_OTG_FRAME_MASK; - - /* - * pre-compute when the isochronous transfer will be finished: - */ - xfer->isoc_time_complete = - usb_isoc_time_expand(&sc->sc_bus, framenum) + temp + msframes; /* setup TDs */ dwc_otg_setup_standard_chain(xfer); - /* compute frame number for next insertion */ - xfer->endpoint->isoc_next += msframes; - /* start TD chain */ dwc_otg_start_standard_chain(xfer); } diff --git a/sys/dev/usb/controller/ehci.c b/sys/dev/usb/controller/ehci.c index 0b7f41b39234..dd4f7c568625 100644 --- a/sys/dev/usb/controller/ehci.c +++ b/sys/dev/usb/controller/ehci.c @@ -2440,6 +2440,7 @@ ehci_device_isoc_fs_enter(struct usb_xfer *xfer) uint32_t *plen; uint32_t buf_offset; uint32_t nframes; + uint32_t startframe; uint32_t temp; uint32_t sitd_mask; uint16_t tlen; @@ -2458,39 +2459,9 @@ ehci_device_isoc_fs_enter(struct usb_xfer *xfer) nframes = EOREAD4(sc, EHCI_FRINDEX) / 8; - /* - * check if the frame index is within the window where the frames - * will be inserted - */ - buf_offset = (nframes - xfer->endpoint->isoc_next) & - (EHCI_VIRTUAL_FRAMELIST_COUNT - 1); - - if ((xfer->endpoint->is_synced == 0) || - (buf_offset < xfer->nframes)) { - /* - * If there is data underflow or the pipe queue is empty we - * schedule the transfer a few frames ahead of the current - * frame position. Else two isochronous transfers might - * overlap. - */ - xfer->endpoint->isoc_next = (nframes + 3) & - (EHCI_VIRTUAL_FRAMELIST_COUNT - 1); - xfer->endpoint->is_synced = 1; - DPRINTFN(3, "start next=%d\n", xfer->endpoint->isoc_next); - } - /* - * compute how many milliseconds the insertion is ahead of the - * current frame position: - */ - buf_offset = (xfer->endpoint->isoc_next - nframes) & - (EHCI_VIRTUAL_FRAMELIST_COUNT - 1); - - /* - * pre-compute when the isochronous transfer will be finished: - */ - xfer->isoc_time_complete = - usb_isoc_time_expand(&sc->sc_bus, nframes) + - buf_offset + xfer->nframes; + if (usbd_xfer_get_isochronous_start_frame( + xfer, nframes, 0, 1, EHCI_VIRTUAL_FRAMELIST_COUNT - 1, &startframe)) + DPRINTFN(3, "start next=%d\n", startframe); /* get the real number of frames */ @@ -2507,11 +2478,11 @@ ehci_device_isoc_fs_enter(struct usb_xfer *xfer) td = xfer->td_start[xfer->flags_int.curr_dma_set]; xfer->td_transfer_first = td; - pp_last = &sc->sc_isoc_fs_p_last[xfer->endpoint->isoc_next]; + pp_last = &sc->sc_isoc_fs_p_last[startframe]; /* store starting position */ - xfer->qh_pos = xfer->endpoint->isoc_next; + xfer->qh_pos = startframe; while (nframes--) { if (td == NULL) { @@ -2633,10 +2604,6 @@ ehci_device_isoc_fs_enter(struct usb_xfer *xfer) xfer->td_transfer_last = td_last; - /* update isoc_next */ - xfer->endpoint->isoc_next = (pp_last - &sc->sc_isoc_fs_p_last[0]) & - (EHCI_VIRTUAL_FRAMELIST_COUNT - 1); - /* * We don't allow cancelling of the SPLIT transaction USB FULL * speed transfer, because it disturbs the bandwidth @@ -2743,11 +2710,11 @@ ehci_device_isoc_hs_enter(struct usb_xfer *xfer) uint32_t status; uint32_t buf_offset; uint32_t nframes; + uint32_t startframe; uint32_t itd_offset[8 + 1]; uint8_t x; uint8_t td_no; uint8_t page_no; - uint8_t shift = usbd_xfer_get_fps_shift(xfer); #ifdef USB_DEBUG uint8_t once = 1; @@ -2755,47 +2722,16 @@ ehci_device_isoc_hs_enter(struct usb_xfer *xfer) #endif DPRINTFN(6, "xfer=%p next=%d nframes=%d shift=%d\n", - xfer, xfer->endpoint->isoc_next, xfer->nframes, (int)shift); + xfer, xfer->endpoint->isoc_next, xfer->nframes, + usbd_xfer_get_fps_shift(xfer)); /* get the current frame index */ nframes = EOREAD4(sc, EHCI_FRINDEX) / 8; - /* - * check if the frame index is within the window where the frames - * will be inserted - */ - buf_offset = (nframes - xfer->endpoint->isoc_next) & - (EHCI_VIRTUAL_FRAMELIST_COUNT - 1); - - if ((xfer->endpoint->is_synced == 0) || - (buf_offset < (((xfer->nframes << shift) + 7) / 8))) { - /* - * If there is data underflow or the pipe queue is empty we - * schedule the transfer a few frames ahead of the current - * frame position. Else two isochronous transfers might - * overlap. - */ - xfer->endpoint->isoc_next = (nframes + 3) & - (EHCI_VIRTUAL_FRAMELIST_COUNT - 1); - xfer->endpoint->is_synced = 1; - DPRINTFN(3, "start next=%d\n", xfer->endpoint->isoc_next); - } - /* - * compute how many milliseconds the insertion is ahead of the - * current frame position: - */ - buf_offset = (xfer->endpoint->isoc_next - nframes) & - (EHCI_VIRTUAL_FRAMELIST_COUNT - 1); - - /* - * pre-compute when the isochronous transfer will be finished: - */ - xfer->isoc_time_complete = - usb_isoc_time_expand(&sc->sc_bus, nframes) + buf_offset + - (((xfer->nframes << shift) + 7) / 8); - - /* get the real number of frames */ + if (usbd_xfer_get_isochronous_start_frame( + xfer, nframes, 0, 1, EHCI_VIRTUAL_FRAMELIST_COUNT - 1, &startframe)) + DPRINTFN(3, "start next=%d\n", startframe); nframes = xfer->nframes; @@ -2811,11 +2747,11 @@ ehci_device_isoc_hs_enter(struct usb_xfer *xfer) td = xfer->td_start[xfer->flags_int.curr_dma_set]; xfer->td_transfer_first = td; - pp_last = &sc->sc_isoc_hs_p_last[xfer->endpoint->isoc_next]; + pp_last = &sc->sc_isoc_hs_p_last[startframe]; /* store starting position */ - xfer->qh_pos = xfer->endpoint->isoc_next; + xfer->qh_pos = startframe; while (nframes) { if (td == NULL) { @@ -2927,10 +2863,6 @@ ehci_device_isoc_hs_enter(struct usb_xfer *xfer) } xfer->td_transfer_last = td_last; - - /* update isoc_next */ - xfer->endpoint->isoc_next = (pp_last - &sc->sc_isoc_hs_p_last[0]) & - (EHCI_VIRTUAL_FRAMELIST_COUNT - 1); } static void diff --git a/sys/dev/usb/controller/musb_otg.c b/sys/dev/usb/controller/musb_otg.c index 24eba2a9a552..fd2f7e72c43a 100644 --- a/sys/dev/usb/controller/musb_otg.c +++ b/sys/dev/usb/controller/musb_otg.c @@ -3436,9 +3436,7 @@ static void musbotg_device_isoc_enter(struct usb_xfer *xfer) { struct musbotg_softc *sc = MUSBOTG_BUS2SC(xfer->xroot->bus); - uint32_t temp; uint32_t nframes; - uint32_t fs_frames; DPRINTFN(5, "xfer=%p next=%d nframes=%d\n", xfer, xfer->endpoint->isoc_next, xfer->nframes); @@ -3447,45 +3445,9 @@ musbotg_device_isoc_enter(struct usb_xfer *xfer) nframes = MUSB2_READ_2(sc, MUSB2_REG_FRAME); - /* - * check if the frame index is within the window where the frames - * will be inserted - */ - temp = (nframes - xfer->endpoint->isoc_next) & MUSB2_MASK_FRAME; - - if (usbd_get_speed(xfer->xroot->udev) == USB_SPEED_HIGH) { - fs_frames = (xfer->nframes + 7) / 8; - } else { - fs_frames = xfer->nframes; - } - - if ((xfer->endpoint->is_synced == 0) || - (temp < fs_frames)) { - /* - * If there is data underflow or the pipe queue is - * empty we schedule the transfer a few frames ahead - * of the current frame position. Else two isochronous - * transfers might overlap. - */ - xfer->endpoint->isoc_next = (nframes + 3) & MUSB2_MASK_FRAME; - xfer->endpoint->is_synced = 1; + if (usbd_xfer_get_isochronous_start_frame( + xfer, nframes, 0, 1, MUSB2_MASK_FRAME, NULL)) DPRINTFN(2, "start next=%d\n", xfer->endpoint->isoc_next); - } - /* - * compute how many milliseconds the insertion is ahead of the - * current frame position: - */ - temp = (xfer->endpoint->isoc_next - nframes) & MUSB2_MASK_FRAME; - - /* - * pre-compute when the isochronous transfer will be finished: - */ - xfer->isoc_time_complete = - usb_isoc_time_expand(&sc->sc_bus, nframes) + temp + - fs_frames; - - /* compute frame number for next insertion */ - xfer->endpoint->isoc_next += fs_frames; /* setup TDs */ musbotg_setup_standard_chain(xfer); diff --git a/sys/dev/usb/controller/ohci.c b/sys/dev/usb/controller/ohci.c index 39f3bd54f507..7268af06a602 100644 --- a/sys/dev/usb/controller/ohci.c +++ b/sys/dev/usb/controller/ohci.c @@ -1824,6 +1824,7 @@ ohci_device_isoc_enter(struct usb_xfer *xfer) struct ohci_hcca *hcca; uint32_t buf_offset; uint32_t nframes; + uint32_t startframe; uint32_t ed_flags; uint32_t *plen; uint16_t itd_offset[OHCI_ITD_NOFFSET]; @@ -1840,31 +1841,9 @@ ohci_device_isoc_enter(struct usb_xfer *xfer) DPRINTFN(6, "xfer=%p isoc_next=%u nframes=%u hcca_fn=%u\n", xfer, xfer->endpoint->isoc_next, xfer->nframes, nframes); - if ((xfer->endpoint->is_synced == 0) || - (((nframes - xfer->endpoint->isoc_next) & 0xFFFF) < xfer->nframes) || - (((xfer->endpoint->isoc_next - nframes) & 0xFFFF) >= 128)) { - /* - * If there is data underflow or the pipe queue is empty we - * schedule the transfer a few frames ahead of the current - * frame position. Else two isochronous transfers might - * overlap. - */ - xfer->endpoint->isoc_next = (nframes + 3) & 0xFFFF; - xfer->endpoint->is_synced = 1; - DPRINTFN(3, "start next=%d\n", xfer->endpoint->isoc_next); - } - /* - * compute how many milliseconds the insertion is ahead of the - * current frame position: - */ - buf_offset = ((xfer->endpoint->isoc_next - nframes) & 0xFFFF); - - /* - * pre-compute when the isochronous transfer will be finished: - */ - xfer->isoc_time_complete = - (usb_isoc_time_expand(&sc->sc_bus, nframes) + buf_offset + - xfer->nframes); + if (usbd_xfer_get_isochronous_start_frame( + xfer, nframes, 0, 1, 0xFFFF, &startframe)) + DPRINTFN(3, "start next=%d\n", startframe); /* get the real number of frames */ @@ -1905,12 +1884,12 @@ ohci_device_isoc_enter(struct usb_xfer *xfer) /* fill current ITD */ td->itd_flags = htole32( OHCI_ITD_NOCC | - OHCI_ITD_SET_SF(xfer->endpoint->isoc_next) | + OHCI_ITD_SET_SF(startframe) | OHCI_ITD_NOINTR | OHCI_ITD_SET_FC(ncur)); td->frames = ncur; - xfer->endpoint->isoc_next += ncur; + startframe += ncur; if (length == 0) { /* all zero */ diff --git a/sys/dev/usb/controller/saf1761_otg.c b/sys/dev/usb/controller/saf1761_otg.c index df0162e51749..f5725a3cb48a 100644 --- a/sys/dev/usb/controller/saf1761_otg.c +++ b/sys/dev/usb/controller/saf1761_otg.c @@ -2632,7 +2632,6 @@ static void saf1761_otg_device_isoc_enter(struct usb_xfer *xfer) { struct saf1761_otg_softc *sc = SAF1761_OTG_BUS2SC(xfer->xroot->bus); - uint32_t temp; uint32_t nframes; DPRINTFN(6, "xfer=%p next=%d nframes=%d\n", @@ -2642,39 +2641,9 @@ saf1761_otg_device_isoc_enter(struct usb_xfer *xfer) nframes = SAF1761_READ_LE_4(sc, SOTG_FRAME_NUM); - /* - * check if the frame index is within the window where the - * frames will be inserted - */ - temp = (nframes - xfer->endpoint->isoc_next) & SOTG_FRAME_NUM_SOFR_MASK; - - if ((xfer->endpoint->is_synced == 0) || - (temp < xfer->nframes)) { - /* - * If there is data underflow or the pipe queue is - * empty we schedule the transfer a few frames ahead - * of the current frame position. Else two isochronous - * transfers might overlap. - */ - xfer->endpoint->isoc_next = (nframes + 3) & SOTG_FRAME_NUM_SOFR_MASK; - xfer->endpoint->is_synced = 1; + if (usbd_xfer_get_isochronous_start_frame( + xfer, nframes, 0, 1, SOTG_FRAME_NUM_SOFR_MASK, NULL)) DPRINTFN(3, "start next=%d\n", xfer->endpoint->isoc_next); - } - /* - * compute how many milliseconds the insertion is ahead of the - * current frame position: - */ - temp = (xfer->endpoint->isoc_next - nframes) & SOTG_FRAME_NUM_SOFR_MASK; - - /* - * pre-compute when the isochronous transfer will be finished: - */ - xfer->isoc_time_complete = - usb_isoc_time_expand(&sc->sc_bus, nframes) + temp + - xfer->nframes; - - /* compute frame number for next insertion */ - xfer->endpoint->isoc_next += xfer->nframes; /* setup TDs */ saf1761_otg_setup_standard_chain(xfer); @@ -2714,7 +2683,6 @@ static void saf1761_otg_host_isoc_enter(struct usb_xfer *xfer) { struct saf1761_otg_softc *sc = SAF1761_OTG_BUS2SC(xfer->xroot->bus); - uint32_t temp; uint32_t nframes; DPRINTFN(6, "xfer=%p next=%d nframes=%d\n", @@ -2724,39 +2692,9 @@ saf1761_otg_host_isoc_enter(struct usb_xfer *xfer) nframes = (SAF1761_READ_LE_4(sc, SOTG_FRINDEX) & SOTG_FRINDEX_MASK) >> 3; - /* - * check if the frame index is within the window where the - * frames will be inserted - */ - temp = (nframes - xfer->endpoint->isoc_next) & (SOTG_FRINDEX_MASK >> 3); - - if ((xfer->endpoint->is_synced == 0) || - (temp < xfer->nframes)) { - /* - * If there is data underflow or the pipe queue is - * empty we schedule the transfer a few frames ahead - * of the current frame position. Else two isochronous - * transfers might overlap. - */ - xfer->endpoint->isoc_next = (nframes + 3) & (SOTG_FRINDEX_MASK >> 3); - xfer->endpoint->is_synced = 1; + if (usbd_xfer_get_isochronous_start_frame( + xfer, nframes, 0, 1, SOTG_FRINDEX_MASK >> 3, NULL)) DPRINTFN(3, "start next=%d\n", xfer->endpoint->isoc_next); - } - /* - * compute how many milliseconds the insertion is ahead of the - * current frame position: - */ - temp = (xfer->endpoint->isoc_next - nframes) & (SOTG_FRINDEX_MASK >> 3); - - /* - * pre-compute when the isochronous transfer will be finished: - */ - xfer->isoc_time_complete = - usb_isoc_time_expand(&sc->sc_bus, nframes) + temp + - xfer->nframes; - - /* compute frame number for next insertion */ - xfer->endpoint->isoc_next += xfer->nframes; /* setup TDs */ saf1761_otg_setup_standard_chain(xfer); diff --git a/sys/dev/usb/controller/uhci.c b/sys/dev/usb/controller/uhci.c index 59453359deb0..41caa1610989 100644 --- a/sys/dev/usb/controller/uhci.c +++ b/sys/dev/usb/controller/uhci.c @@ -2111,7 +2111,7 @@ uhci_device_isoc_enter(struct usb_xfer *xfer) struct uhci_mem_layout ml; uhci_softc_t *sc = UHCI_BUS2SC(xfer->xroot->bus); uint32_t nframes; - uint32_t temp; + uint32_t startframe; uint32_t *plen; #ifdef USB_DEBUG @@ -2127,34 +2127,9 @@ uhci_device_isoc_enter(struct usb_xfer *xfer) nframes = UREAD2(sc, UHCI_FRNUM); - temp = (nframes - xfer->endpoint->isoc_next) & - (UHCI_VFRAMELIST_COUNT - 1); - - if ((xfer->endpoint->is_synced == 0) || - (temp < xfer->nframes)) { - /* - * If there is data underflow or the pipe queue is empty we - * schedule the transfer a few frames ahead of the current - * frame position. Else two isochronous transfers might - * overlap. - */ - xfer->endpoint->isoc_next = (nframes + 3) & (UHCI_VFRAMELIST_COUNT - 1); - xfer->endpoint->is_synced = 1; - DPRINTFN(3, "start next=%d\n", xfer->endpoint->isoc_next); - } - /* - * compute how many milliseconds the insertion is ahead of the - * current frame position: - */ - temp = (xfer->endpoint->isoc_next - nframes) & - (UHCI_VFRAMELIST_COUNT - 1); - - /* - * pre-compute when the isochronous transfer will be finished: - */ - xfer->isoc_time_complete = - usb_isoc_time_expand(&sc->sc_bus, nframes) + temp + - xfer->nframes; + if (usbd_xfer_get_isochronous_start_frame( + xfer, nframes, 0, 1, UHCI_VFRAMELIST_COUNT - 1, &startframe)) + DPRINTFN(3, "start next=%d\n", startframe); /* get the real number of frames */ @@ -2171,11 +2146,11 @@ uhci_device_isoc_enter(struct usb_xfer *xfer) td = xfer->td_start[xfer->flags_int.curr_dma_set]; xfer->td_transfer_first = td; - pp_last = &sc->sc_isoc_p_last[xfer->endpoint->isoc_next]; + pp_last = &sc->sc_isoc_p_last[startframe]; /* store starting position */ - xfer->qh_pos = xfer->endpoint->isoc_next; + xfer->qh_pos = startframe; while (nframes--) { if (td == NULL) { @@ -2252,10 +2227,6 @@ uhci_device_isoc_enter(struct usb_xfer *xfer) } xfer->td_transfer_last = td_last; - - /* update isoc_next */ - xfer->endpoint->isoc_next = (pp_last - &sc->sc_isoc_p_last[0]) & - (UHCI_VFRAMELIST_COUNT - 1); } static void diff --git a/sys/dev/usb/controller/uss820dci.c b/sys/dev/usb/controller/uss820dci.c index b2e112b07f6e..0c37a932b2a9 100644 --- a/sys/dev/usb/controller/uss820dci.c +++ b/sys/dev/usb/controller/uss820dci.c @@ -1706,7 +1706,6 @@ static void uss820dci_device_isoc_fs_enter(struct usb_xfer *xfer) { struct uss820dci_softc *sc = USS820_DCI_BUS2SC(xfer->xroot->bus); - uint32_t temp; uint32_t nframes; DPRINTFN(6, "xfer=%p next=%d nframes=%d\n", @@ -1716,39 +1715,9 @@ uss820dci_device_isoc_fs_enter(struct usb_xfer *xfer) nframes = USS820_READ_1(sc, USS820_SOFL); - /* - * check if the frame index is within the window where the - * frames will be inserted - */ - temp = (nframes - xfer->endpoint->isoc_next) & USS820_SOFL_MASK; - - if ((xfer->endpoint->is_synced == 0) || - (temp < xfer->nframes)) { - /* - * If there is data underflow or the pipe queue is - * empty we schedule the transfer a few frames ahead - * of the current frame position. Else two isochronous - * transfers might overlap. - */ - xfer->endpoint->isoc_next = (nframes + 3) & USS820_SOFL_MASK; - xfer->endpoint->is_synced = 1; + if (usbd_xfer_get_isochronous_start_frame( + xfer, nframes, 0, 1, USS820_SOFL_MASK, NULL)) DPRINTFN(3, "start next=%d\n", xfer->endpoint->isoc_next); - } - /* - * compute how many milliseconds the insertion is ahead of the - * current frame position: - */ - temp = (xfer->endpoint->isoc_next - nframes) & USS820_SOFL_MASK; - - /* - * pre-compute when the isochronous transfer will be finished: - */ - xfer->isoc_time_complete = - usb_isoc_time_expand(&sc->sc_bus, nframes) + temp + - xfer->nframes; - - /* compute frame number for next insertion */ - xfer->endpoint->isoc_next += xfer->nframes; /* setup TDs */ uss820dci_setup_standard_chain(xfer); diff --git a/sys/dev/usb/controller/xhci.c b/sys/dev/usb/controller/xhci.c index dd64c2d45141..93468c5d9333 100644 --- a/sys/dev/usb/controller/xhci.c +++ b/sys/dev/usb/controller/xhci.c @@ -133,8 +133,8 @@ struct xhci_std_temp { uint32_t offset; uint32_t max_packet_size; uint32_t average; + uint32_t isoc_frame; uint16_t isoc_delta; - uint16_t isoc_frame; uint8_t shortpkt; uint8_t multishort; uint8_t last_frame; @@ -2080,62 +2080,55 @@ xhci_setup_generic_chain(struct usb_xfer *xfer) DPRINTF("MFINDEX=0x%08x IST=0x%x\n", x, sc->sc_ist); - /* add isochronous scheduling threshold */ - if (temp.sc->sc_ist & 8) - x += (temp.sc->sc_ist & 7) << 3; - else - x += (temp.sc->sc_ist & 7); - switch (usbd_get_speed(xfer->xroot->udev)) { case USB_SPEED_FULL: shift = 3; temp.isoc_delta = 8; /* 1ms */ - x += temp.isoc_delta - 1; - x &= ~(temp.isoc_delta - 1); break; default: shift = usbd_xfer_get_fps_shift(xfer); temp.isoc_delta = 1U << shift; - x += temp.isoc_delta - 1; - x &= ~(temp.isoc_delta - 1); - /* simple frame load balancing */ - x += xfer->endpoint->usb_uframe; break; } - y = XHCI_MFINDEX_GET(x - xfer->endpoint->isoc_next); + /* Compute isochronous scheduling threshold. */ + if (temp.sc->sc_ist & 8) + y = (temp.sc->sc_ist & 7) << 3; + else + y = (temp.sc->sc_ist & 7); - if ((xfer->endpoint->is_synced == 0) || - (y < (xfer->nframes << shift)) || - (XHCI_MFINDEX_GET(-y) >= (128 * 8))) { + /* Range check the IST. */ + if (y < 8) { + y = 0; + } else if (y > 15) { + DPRINTFN(3, "IST(%d) is too big!\n", temp.sc->sc_ist); /* - * If there is data underflow or the pipe - * queue is empty we schedule the transfer a - * few frames ahead of the current frame - * position. Else two isochronous transfers - * might overlap. + * The USB stack minimum isochronous transfer + * size is typically 2x2 ms of payload. If the + * IST makes is above 15 microframes, we have + * an effective scheduling delay of more than + * or equal to 2 milliseconds, which is too + * much. */ - xfer->endpoint->isoc_next = XHCI_MFINDEX_GET(x + (3 * 8)); - xfer->endpoint->is_synced = 1; - temp.do_isoc_sync = 1; - - DPRINTFN(3, "start next=%d\n", xfer->endpoint->isoc_next); + } else { + /* + * Subtract one millisecond, because the + * generic code adds that to the latency. + */ + y -= 8; } - /* compute isochronous completion time */ - - y = XHCI_MFINDEX_GET(xfer->endpoint->isoc_next - (x & ~7)); + if (usbd_xfer_get_isochronous_start_frame( + xfer, x, y, 8, XHCI_MFINDEX_GET(-1), &temp.isoc_frame)) { + /* Start isochronous transfer at specified time. */ + temp.do_isoc_sync = 1; - xfer->isoc_time_complete = - usb_isoc_time_expand(&temp.sc->sc_bus, x / 8) + - (y / 8) + (((xfer->nframes << shift) + 7) / 8); + DPRINTFN(3, "start next=%d\n", temp.isoc_frame); + } x = 0; - temp.isoc_frame = xfer->endpoint->isoc_next; temp.trb_type = XHCI_TRB_TYPE_ISOCH; - xfer->endpoint->isoc_next += xfer->nframes << shift; - } else if (xfer->flags_int.control_xfr) { /* check if we should prepend a setup message */ @@ -3072,15 +3065,7 @@ xhci_device_done(struct usb_xfer *xfer, usb_error_t error) static void xhci_device_generic_open(struct usb_xfer *xfer) { - if (xfer->flags_int.isochronous_xfr) { - switch (xfer->xroot->udev->speed) { - case USB_SPEED_FULL: - break; - default: - usb_hs_bandwidth_alloc(xfer); - break; - } - } + DPRINTF("\n"); } static void @@ -3089,16 +3074,6 @@ xhci_device_generic_close(struct usb_xfer *xfer) DPRINTF("\n"); xhci_device_done(xfer, USB_ERR_CANCELLED); - - if (xfer->flags_int.isochronous_xfr) { - switch (xfer->xroot->udev->speed) { - case USB_SPEED_FULL: - break; - default: - usb_hs_bandwidth_free(xfer); - break; - } - } } static void diff --git a/sys/dev/usb/usb_transfer.c b/sys/dev/usb/usb_transfer.c index 871f8d729658..436e08db14a1 100644 --- a/sys/dev/usb/usb_transfer.c +++ b/sys/dev/usb/usb_transfer.c @@ -3627,3 +3627,72 @@ usbd_xfer_maxp_was_clamped(struct usb_xfer *xfer) { return (xfer->flags_int.maxp_was_clamped); } + +/* + * The following function computes the next isochronous frame number + * where the first isochronous packet should be queued. + * + * The function returns non-zero if there was a discontinuity. + * Else zero is returned for normal operation. + */ +uint8_t +usbd_xfer_get_isochronous_start_frame(struct usb_xfer *xfer, uint32_t frame_curr, + uint32_t frame_min, uint32_t frame_ms, uint32_t frame_mask, uint32_t *p_frame_start) +{ + uint32_t duration; + uint32_t delta; + uint8_t retval; + uint8_t shift; + + /* Compute time ahead of current schedule. */ + delta = (xfer->endpoint->isoc_next - frame_curr) & frame_mask; + + /* + * Check if it is the first transfer or if the future frame + * delta is less than one millisecond or if the frame delta is + * negative: + */ + if (xfer->endpoint->is_synced == 0 || + delta < (frame_ms + frame_min) || + delta > (frame_mask / 2)) { + /* Schedule transfer 2 milliseconds into the future. */ + xfer->endpoint->isoc_next = (frame_curr + 2 * frame_ms + frame_min) & frame_mask; + xfer->endpoint->is_synced = 1; + + retval = 1; + } else { + retval = 0; + } + + /* Store start time, if any. */ + if (p_frame_start != NULL) + *p_frame_start = xfer->endpoint->isoc_next & frame_mask; + + /* Get relative completion time, in milliseconds. */ + delta = xfer->endpoint->isoc_next - frame_curr + (frame_curr % frame_ms); + delta &= frame_mask; + delta /= frame_ms; + + switch (usbd_get_speed(xfer->xroot->udev)) { + case USB_SPEED_FULL: + shift = 3; + break; + default: + shift = usbd_xfer_get_fps_shift(xfer); + break; + } + + /* Get duration in milliseconds, rounded up. */ + duration = ((xfer->nframes << shift) + 7) / 8; + + /* Compute full 32-bit completion time, in milliseconds. */ + xfer->isoc_time_complete = + usb_isoc_time_expand(xfer->xroot->bus, frame_curr / frame_ms) + + delta + duration; + + /* Compute next isochronous frame. */ + xfer->endpoint->isoc_next += duration * frame_ms; + xfer->endpoint->isoc_next &= frame_mask; + + return (retval); +} diff --git a/sys/dev/usb/usb_transfer.h b/sys/dev/usb/usb_transfer.h index c6b97e1ab3c5..91f4f6790b31 100644 --- a/sys/dev/usb/usb_transfer.h +++ b/sys/dev/usb/usb_transfer.h @@ -250,5 +250,6 @@ void usbd_transfer_timeout_ms(struct usb_xfer *xfer, void (*cb) (void *arg), usb_timeout_t ms); usb_timeout_t usbd_get_dma_delay(struct usb_device *udev); void usbd_transfer_power_ref(struct usb_xfer *xfer, int val); +uint8_t usbd_xfer_get_isochronous_start_frame(struct usb_xfer *, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t *); #endif /* _USB_TRANSFER_H_ */ From owner-dev-commits-src-main@freebsd.org Sat Jul 10 19:26:39 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 296FA65A448; Sat, 10 Jul 2021 19:26:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GMg4v0hzSz4lsH; Sat, 10 Jul 2021 19:26:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EA6D858FA; Sat, 10 Jul 2021 19:26:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16AJQcMC062400; Sat, 10 Jul 2021 19:26:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16AJQcRv062399; Sat, 10 Jul 2021 19:26:38 GMT (envelope-from git) Date: Sat, 10 Jul 2021 19:26:38 GMT Message-Id: <202107101926.16AJQcRv062399@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: David Chisnall Subject: git: d2b558281aad - main - Revert "Pass the syscall number to capsicum permission-denied signals" MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: theraven X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d2b558281aadc266807e42ffb27d2108d308de46 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 19:26:39 -0000 The branch main has been updated by theraven: URL: https://cgit.FreeBSD.org/src/commit/?id=d2b558281aadc266807e42ffb27d2108d308de46 commit d2b558281aadc266807e42ffb27d2108d308de46 Author: David Chisnall AuthorDate: 2021-07-10 19:25:38 +0000 Commit: David Chisnall CommitDate: 2021-07-10 19:26:01 +0000 Revert "Pass the syscall number to capsicum permission-denied signals" This broke the i386 build. This reverts commit 3a522ba1bc852c3d4660a4fa32e4a94999d09a47. --- lib/libc/sys/procctl.2 | 10 ---------- share/man/man3/siginfo.3 | 2 -- sys/amd64/amd64/trap.c | 1 - sys/amd64/cloudabi32/cloudabi32_sysvec.c | 1 - sys/amd64/cloudabi64/cloudabi64_sysvec.c | 1 - sys/amd64/ia32/ia32_syscall.c | 1 - sys/amd64/include/proc.h | 1 - sys/amd64/linux/linux_sysvec.c | 1 - sys/amd64/linux32/linux32_sysvec.c | 1 - sys/arm/arm/syscall.c | 1 - sys/arm/cloudabi32/cloudabi32_sysvec.c | 1 - sys/arm/include/proc.h | 1 - sys/arm64/arm64/elf32_machdep.c | 1 - sys/arm64/arm64/trap.c | 1 - sys/arm64/cloudabi32/cloudabi32_sysvec.c | 1 - sys/arm64/cloudabi64/cloudabi64_sysvec.c | 1 - sys/arm64/include/proc.h | 1 - sys/arm64/linux/linux_sysvec.c | 1 - sys/i386/cloudabi32/cloudabi32_sysvec.c | 1 - sys/i386/i386/trap.c | 1 - sys/i386/include/proc.h | 1 - sys/i386/linux/linux_sysvec.c | 1 - sys/kern/subr_syscall.c | 1 - sys/mips/include/proc.h | 1 - sys/mips/mips/trap.c | 1 - sys/powerpc/include/proc.h | 1 - sys/powerpc/powerpc/trap.c | 1 - sys/riscv/include/proc.h | 1 - sys/riscv/riscv/trap.c | 1 - sys/sys/signal.h | 7 ------- 30 files changed, 46 deletions(-) diff --git a/lib/libc/sys/procctl.2 b/lib/libc/sys/procctl.2 index ce7a2be5d5e4..432ed5919a81 100644 --- a/lib/libc/sys/procctl.2 +++ b/lib/libc/sys/procctl.2 @@ -454,16 +454,6 @@ and the .Va si_code member is set to .Dv TRAP_CAP . -The system call number is stored in the -.Va si_syscall -field of the -.Fa siginfo -signal handler parameter. -The other system call parameters can be read from the -.Fa ucontext_t -but the system call number is typically stored in the register -that also contains the return value and so is unavailable in the -signal handler. .Pp See .Xr capsicum 4 diff --git a/share/man/man3/siginfo.3 b/share/man/man3/siginfo.3 index 7f8a809cdfa5..acc8785b2f0d 100644 --- a/share/man/man3/siginfo.3 +++ b/share/man/man3/siginfo.3 @@ -85,8 +85,6 @@ timer overrun count .It Vt int Ta Va si_mqd Ta .Tn POSIX message queue ID -.It Vt int Ta Va si_syscall Ta -system-call number for system calls blocked by Capsicum .El .Pp The diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c index b08495f3f139..55649687ce50 100644 --- a/sys/amd64/amd64/trap.c +++ b/sys/amd64/amd64/trap.c @@ -1059,7 +1059,6 @@ cpu_fetch_syscall_args(struct thread *td) sa = &td->td_sa; sa->code = frame->tf_rax; - sa->original_code = sa->code; if (__predict_false(sa->code == SYS_syscall || sa->code == SYS___syscall || diff --git a/sys/amd64/cloudabi32/cloudabi32_sysvec.c b/sys/amd64/cloudabi32/cloudabi32_sysvec.c index 26924ed5a980..164f87e90e91 100644 --- a/sys/amd64/cloudabi32/cloudabi32_sysvec.c +++ b/sys/amd64/cloudabi32/cloudabi32_sysvec.c @@ -101,7 +101,6 @@ cloudabi32_fetch_syscall_args(struct thread *td) /* Obtain system call number. */ sa->code = frame->tf_rax; - sa->original_code = sa->code; if (sa->code >= CLOUDABI32_SYS_MAXSYSCALL) return (ENOSYS); sa->callp = &cloudabi32_sysent[sa->code]; diff --git a/sys/amd64/cloudabi64/cloudabi64_sysvec.c b/sys/amd64/cloudabi64/cloudabi64_sysvec.c index c08d912e84d4..d3893902b08e 100644 --- a/sys/amd64/cloudabi64/cloudabi64_sysvec.c +++ b/sys/amd64/cloudabi64/cloudabi64_sysvec.c @@ -98,7 +98,6 @@ cloudabi64_fetch_syscall_args(struct thread *td) /* Obtain system call number. */ sa->code = frame->tf_rax; - sa->original_code = sa->code; if (sa->code >= CLOUDABI64_SYS_MAXSYSCALL) return (ENOSYS); sa->callp = &cloudabi64_sysent[sa->code]; diff --git a/sys/amd64/ia32/ia32_syscall.c b/sys/amd64/ia32/ia32_syscall.c index 9294ef8ce741..6c9399d1a52f 100644 --- a/sys/amd64/ia32/ia32_syscall.c +++ b/sys/amd64/ia32/ia32_syscall.c @@ -150,7 +150,6 @@ ia32_fetch_syscall_args(struct thread *td) params = (caddr_t)frame->tf_rsp + sizeof(u_int32_t); sa->code = frame->tf_rax; - sa->original_code = sa->code; /* * Need to check if this is a 32 bit or 64 bit syscall. diff --git a/sys/amd64/include/proc.h b/sys/amd64/include/proc.h index 0f8cf50e326d..59796e729ac4 100644 --- a/sys/amd64/include/proc.h +++ b/sys/amd64/include/proc.h @@ -92,7 +92,6 @@ struct mdproc { struct syscall_args { u_int code; - u_int original_code; struct sysent *callp; register_t args[8]; }; diff --git a/sys/amd64/linux/linux_sysvec.c b/sys/amd64/linux/linux_sysvec.c index 566af6de29e7..c5538932b1e3 100644 --- a/sys/amd64/linux/linux_sysvec.c +++ b/sys/amd64/linux/linux_sysvec.c @@ -191,7 +191,6 @@ linux_fetch_syscall_args(struct thread *td) sa->args[4] = frame->tf_r8; sa->args[5] = frame->tf_r9; sa->code = frame->tf_rax; - sa->original_code = sa->code; if (sa->code >= p->p_sysent->sv_size) /* nosys */ diff --git a/sys/amd64/linux32/linux32_sysvec.c b/sys/amd64/linux32/linux32_sysvec.c index 7dfd57a74a1e..504d57e418a5 100644 --- a/sys/amd64/linux32/linux32_sysvec.c +++ b/sys/amd64/linux32/linux32_sysvec.c @@ -662,7 +662,6 @@ linux32_fetch_syscall_args(struct thread *td) sa->args[4] = frame->tf_rdi; sa->args[5] = frame->tf_rbp; /* Unconfirmed */ sa->code = frame->tf_rax; - sa->original_code = sa->code; if (sa->code >= p->p_sysent->sv_size) /* nosys */ diff --git a/sys/arm/arm/syscall.c b/sys/arm/arm/syscall.c index a635de0ec716..a851db6e4556 100644 --- a/sys/arm/arm/syscall.c +++ b/sys/arm/arm/syscall.c @@ -108,7 +108,6 @@ cpu_fetch_syscall_args(struct thread *td) nap = 4; sa = &td->td_sa; sa->code = td->td_frame->tf_r7; - sa->original_code = sa->code; ap = &td->td_frame->tf_r0; if (sa->code == SYS_syscall) { sa->code = *ap++; diff --git a/sys/arm/cloudabi32/cloudabi32_sysvec.c b/sys/arm/cloudabi32/cloudabi32_sysvec.c index 4df57b22e13d..a8c5da47d265 100644 --- a/sys/arm/cloudabi32/cloudabi32_sysvec.c +++ b/sys/arm/cloudabi32/cloudabi32_sysvec.c @@ -78,7 +78,6 @@ cloudabi32_fetch_syscall_args(struct thread *td) /* Obtain system call number. */ sa->code = frame->tf_r12; - sa->original_code = sa->code; if (sa->code >= CLOUDABI32_SYS_MAXSYSCALL) return (ENOSYS); sa->callp = &cloudabi32_sysent[sa->code]; diff --git a/sys/arm/include/proc.h b/sys/arm/include/proc.h index 9566c264731e..a37ccd8f621c 100644 --- a/sys/arm/include/proc.h +++ b/sys/arm/include/proc.h @@ -75,7 +75,6 @@ struct mdproc { */ struct syscall_args { u_int code; - u_int original_code; struct sysent *callp; register_t args[MAXARGS]; } __aligned(8); diff --git a/sys/arm64/arm64/elf32_machdep.c b/sys/arm64/arm64/elf32_machdep.c index 7cedbffc4d43..206413b45172 100644 --- a/sys/arm64/arm64/elf32_machdep.c +++ b/sys/arm64/arm64/elf32_machdep.c @@ -175,7 +175,6 @@ freebsd32_fetch_syscall_args(struct thread *td) /* r7 is the syscall id */ sa->code = td->td_frame->tf_x[7]; - sa->original_code = sa->code; if (sa->code == SYS_syscall) { sa->code = *ap++; diff --git a/sys/arm64/arm64/trap.c b/sys/arm64/arm64/trap.c index 2b2d2e433efa..744b646b31c8 100644 --- a/sys/arm64/arm64/trap.c +++ b/sys/arm64/arm64/trap.c @@ -130,7 +130,6 @@ cpu_fetch_syscall_args(struct thread *td) dst_ap = &sa->args[0]; sa->code = td->td_frame->tf_x[8]; - sa->original_code = sa->code; if (__predict_false(sa->code == SYS_syscall || sa->code == SYS___syscall)) { sa->code = *ap++; diff --git a/sys/arm64/cloudabi32/cloudabi32_sysvec.c b/sys/arm64/cloudabi32/cloudabi32_sysvec.c index b7be5cc0e5e3..889393560ede 100644 --- a/sys/arm64/cloudabi32/cloudabi32_sysvec.c +++ b/sys/arm64/cloudabi32/cloudabi32_sysvec.c @@ -75,7 +75,6 @@ cloudabi32_fetch_syscall_args(struct thread *td) /* Obtain system call number. */ sa->code = frame->tf_x[0]; - sa->original_code = sa->code; if (sa->code >= CLOUDABI32_SYS_MAXSYSCALL) return (ENOSYS); sa->callp = &cloudabi32_sysent[sa->code]; diff --git a/sys/arm64/cloudabi64/cloudabi64_sysvec.c b/sys/arm64/cloudabi64/cloudabi64_sysvec.c index 624d86693457..bdbd828b7b62 100644 --- a/sys/arm64/cloudabi64/cloudabi64_sysvec.c +++ b/sys/arm64/cloudabi64/cloudabi64_sysvec.c @@ -78,7 +78,6 @@ cloudabi64_fetch_syscall_args(struct thread *td) /* Obtain system call number. */ sa->code = frame->tf_x[8]; - sa->original_code = sa->code; if (sa->code >= CLOUDABI64_SYS_MAXSYSCALL) return (ENOSYS); sa->callp = &cloudabi64_sysent[sa->code]; diff --git a/sys/arm64/include/proc.h b/sys/arm64/include/proc.h index 3800798d79b7..bb933dc98241 100644 --- a/sys/arm64/include/proc.h +++ b/sys/arm64/include/proc.h @@ -49,7 +49,6 @@ struct mdproc { #define MAXARGS 8 struct syscall_args { u_int code; - u_int original_code; struct sysent *callp; register_t args[MAXARGS]; }; diff --git a/sys/arm64/linux/linux_sysvec.c b/sys/arm64/linux/linux_sysvec.c index 7749c1cd7fc8..e1d3708b70e9 100644 --- a/sys/arm64/linux/linux_sysvec.c +++ b/sys/arm64/linux/linux_sysvec.c @@ -125,7 +125,6 @@ linux_fetch_syscall_args(struct thread *td) sa = &td->td_sa; sa->code = td->td_frame->tf_x[8]; - sa->original_code = sa->code; /* LINUXTODO: generic syscall? */ if (sa->code >= p->p_sysent->sv_size) sa->callp = &p->p_sysent->sv_table[0]; diff --git a/sys/i386/cloudabi32/cloudabi32_sysvec.c b/sys/i386/cloudabi32/cloudabi32_sysvec.c index e0a50f6697a9..4f12d2b6cbce 100644 --- a/sys/i386/cloudabi32/cloudabi32_sysvec.c +++ b/sys/i386/cloudabi32/cloudabi32_sysvec.c @@ -96,7 +96,6 @@ cloudabi32_fetch_syscall_args(struct thread *td) /* Obtain system call number. */ sa->code = frame->tf_eax; - sa->original_code = sa->code; if (sa->code >= CLOUDABI32_SYS_MAXSYSCALL) return (ENOSYS); sa->callp = &cloudabi32_sysent[sa->code]; diff --git a/sys/i386/i386/trap.c b/sys/i386/i386/trap.c index 07abac23c9da..045478149be5 100644 --- a/sys/i386/i386/trap.c +++ b/sys/i386/i386/trap.c @@ -1052,7 +1052,6 @@ cpu_fetch_syscall_args(struct thread *td) #endif sa->code = frame->tf_eax; - sa->original_code = sa->code; params = (caddr_t)frame->tf_esp + sizeof(uint32_t); /* diff --git a/sys/i386/include/proc.h b/sys/i386/include/proc.h index 76e1ac611474..2950946ff155 100644 --- a/sys/i386/include/proc.h +++ b/sys/i386/include/proc.h @@ -64,7 +64,6 @@ struct mdproc { struct syscall_args { u_int code; - u_int original_code; struct sysent *callp; register_t args[8]; }; diff --git a/sys/i386/linux/linux_sysvec.c b/sys/i386/linux/linux_sysvec.c index a0959d55b585..adb70fded6dc 100644 --- a/sys/i386/linux/linux_sysvec.c +++ b/sys/i386/linux/linux_sysvec.c @@ -756,7 +756,6 @@ linux_fetch_syscall_args(struct thread *td) sa = &td->td_sa; sa->code = frame->tf_eax; - sa->original_code = sa->code; sa->args[0] = frame->tf_ebx; sa->args[1] = frame->tf_ecx; sa->args[2] = frame->tf_edx; diff --git a/sys/kern/subr_syscall.c b/sys/kern/subr_syscall.c index 2304e3e7f3f9..85a0814a2125 100644 --- a/sys/kern/subr_syscall.c +++ b/sys/kern/subr_syscall.c @@ -230,7 +230,6 @@ syscallret(struct thread *td) ksi.ksi_signo = SIGTRAP; ksi.ksi_errno = td->td_errno; ksi.ksi_code = TRAP_CAP; - ksi.ksi_info.si_syscall = sa->original_code; trapsignal(td, &ksi); } } diff --git a/sys/mips/include/proc.h b/sys/mips/include/proc.h index 29d832a162e6..0cb1d433387c 100644 --- a/sys/mips/include/proc.h +++ b/sys/mips/include/proc.h @@ -84,7 +84,6 @@ struct mdproc { #define MAXARGS 8 struct syscall_args { u_int code; - u_int original_code; struct sysent *callp; register_t args[MAXARGS]; }; diff --git a/sys/mips/mips/trap.c b/sys/mips/mips/trap.c index 9d7a07606373..96a2de4ee817 100644 --- a/sys/mips/mips/trap.c +++ b/sys/mips/mips/trap.c @@ -355,7 +355,6 @@ cpu_fetch_syscall_args(struct thread *td) else locr0->pc += sizeof(int); sa->code = locr0->v0; - sa->original_code = sa->code; switch (sa->code) { case SYS___syscall: diff --git a/sys/powerpc/include/proc.h b/sys/powerpc/include/proc.h index aac4e66b39fc..d4df3ccfefef 100644 --- a/sys/powerpc/include/proc.h +++ b/sys/powerpc/include/proc.h @@ -62,7 +62,6 @@ struct mdproc { #define MAXARGS 8 struct syscall_args { u_int code; - u_int original_code; struct sysent *callp; register_t args[MAXARGS]; }; diff --git a/sys/powerpc/powerpc/trap.c b/sys/powerpc/powerpc/trap.c index ab5189a0f418..3a1bdf7cde07 100644 --- a/sys/powerpc/powerpc/trap.c +++ b/sys/powerpc/powerpc/trap.c @@ -667,7 +667,6 @@ cpu_fetch_syscall_args(struct thread *td) sa = &td->td_sa; sa->code = frame->fixreg[0]; - sa->original_code = sa->code; params = (caddr_t)(frame->fixreg + FIRSTARG); n = NARGREG; diff --git a/sys/riscv/include/proc.h b/sys/riscv/include/proc.h index 1c6c8d2919b5..4b5ae9ebe3ed 100644 --- a/sys/riscv/include/proc.h +++ b/sys/riscv/include/proc.h @@ -48,7 +48,6 @@ struct mdproc { #define MAXARGS 8 struct syscall_args { u_int code; - u_int original_code; struct sysent *callp; register_t args[MAXARGS]; }; diff --git a/sys/riscv/riscv/trap.c b/sys/riscv/riscv/trap.c index 8844638c8204..07d7f84a94e8 100644 --- a/sys/riscv/riscv/trap.c +++ b/sys/riscv/riscv/trap.c @@ -103,7 +103,6 @@ cpu_fetch_syscall_args(struct thread *td) dst_ap = &sa->args[0]; sa->code = td->td_frame->tf_t[0]; - sa->original_code = sa->code; if (__predict_false(sa->code == SYS_syscall || sa->code == SYS___syscall)) { sa->code = *ap++; diff --git a/sys/sys/signal.h b/sys/sys/signal.h index 9dae3ce04745..8b45a521c3ee 100644 --- a/sys/sys/signal.h +++ b/sys/sys/signal.h @@ -255,12 +255,6 @@ typedef struct __siginfo { struct { long _band; /* band event for SIGPOLL */ } _poll; /* was this ever used ? */ - struct { - int _syscall; /* Syscall number for signals - * delivered as a result of - * system calls denied by - * Capsicum. */ - } _capsicum; struct { long __spare1__; int __spare2__[7]; @@ -273,7 +267,6 @@ typedef struct __siginfo { #define si_overrun _reason._timer._overrun #define si_mqd _reason._mesgq._mqd #define si_band _reason._poll._band -#define si_syscall _reason._capsicum._syscall #if defined(_WANT_LWPINFO32) || (defined(_KERNEL) && defined(__LP64__)) struct siginfo32 { From owner-dev-commits-src-main@freebsd.org Sat Jul 10 19:30:26 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 375EE65A79D for ; Sat, 10 Jul 2021 19:30:26 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GMg9G0kbTz4m4L for ; Sat, 10 Jul 2021 19:30:25 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wr1-f49.google.com with SMTP id d12so16931321wre.13 for ; Sat, 10 Jul 2021 12:30:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=Yjn9x3DUZpCnDncqDYORAKKF/MLImMdTxz74QWi7Xmg=; b=aT7pKSBzUNTyPjqW87KFc6/RI6sxI9bfnB05OotEkl/XCHjMtSjjGHpfP+dwo6tK37 z6KJuHqye8FE9fNT5M39fcEXaWml7M1Z1/jtzKqRUwSA8RCBRZhtr1woPIaB/FVqZ6sb U6pNhywJtlzlPqHHj6awfue/zUc35GbOfZ+XgnwIipx9Jvacn4PRyVpCwkQVDNP1W783 1OexmjpWivqPOpqybPVvYEKn7qKhI4ONRVF0Xa+Jt6f1tbaRY+m+Lb9P5p6mXMKpLmDC Fn1NN+DgL6PAEsxNX6K9CGYjzRofYerOBxFlWN7qveQelv9Ud0Z/V5eQLON4J5R8+oxs bX4g== X-Gm-Message-State: AOAM531y7NnjHzuQlYZKkkOr28y5IY3+U7RTmf4FNCmhhtseeN6klMhd /okcBCljc+gkHeE6Ovy/zfRABg== X-Google-Smtp-Source: ABdhPJxEywK2rff1ISliAJuqJqr7ehsgzcwhi5tf5yESNYo3EuVqSvY3FgsROoEuzxSuils7pfN5ag== X-Received: by 2002:a5d:47a7:: with SMTP id 7mr17974773wrb.150.1625945424755; Sat, 10 Jul 2021 12:30:24 -0700 (PDT) Received: from smtpclient.apple (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id x19sm8214198wmi.10.2021.07.10.12.30.24 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 10 Jul 2021 12:30:24 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.100.0.2.22\)) Subject: Re: git: d038463bd269 - main - Make sure the XHCI driver obeys the isochronous scheduling threshold value as given by the XHCI hardware parameters to avoid scheduling isochronous transfers too early. From: Jessica Clarke In-Reply-To: <202107101904.16AJ4lj3035432@gitrepo.freebsd.org> Date: Sat, 10 Jul 2021 20:30:22 +0100 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: <09444339-973B-4A2B-ACEA-B00B8E48F460@freebsd.org> References: <202107101904.16AJ4lj3035432@gitrepo.freebsd.org> To: Hans Petter Selasky X-Mailer: Apple Mail (2.3654.100.0.2.22) X-Rspamd-Queue-Id: 4GMg9G0kbTz4m4L X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 19:30:26 -0000 On 10 Jul 2021, at 20:04, Hans Petter Selasky = wrote: >=20 > The branch main has been updated by hselasky: >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3Dd038463bd269031fa8f13c0951b223bc= ae02bbca >=20 > commit d038463bd269031fa8f13c0951b223bcae02bbca > Author: Hans Petter Selasky > AuthorDate: 2021-07-10 16:09:56 +0000 > Commit: Hans Petter Selasky > CommitDate: 2021-07-10 17:57:52 +0000 >=20 > Make sure the XHCI driver obeys the isochronous scheduling = threshold value > as given by the XHCI hardware parameters to avoid scheduling = isochronous > transfers too early. >=20 > MFC after: 1 week > Sponsored by: NVIDIA Networking > --- > sys/dev/usb/controller/xhci.c | 11 ++++++++++- > sys/dev/usb/controller/xhci.h | 3 +++ > 2 files changed, 13 insertions(+), 1 deletion(-) >=20 > diff --git a/sys/dev/usb/controller/xhci.c = b/sys/dev/usb/controller/xhci.c > index 10e37c97c254..dd64c2d45141 100644 > --- a/sys/dev/usb/controller/xhci.c > +++ b/sys/dev/usb/controller/xhci.c > @@ -644,6 +644,9 @@ xhci_init(struct xhci_softc *sc, device_t self, = uint8_t dma32) >=20 > DPRINTF("HCS2=3D0x%08x\n", temp); >=20 > + /* get isochronous scheduling threshold */ > + sc->sc_ist =3D XHCI_HCS2_IST(temp); > + > /* get number of scratchpads */ > sc->sc_noscratch =3D XHCI_HCS2_SPB_MAX(temp); >=20 > @@ -2075,7 +2078,13 @@ xhci_setup_generic_chain(struct usb_xfer *xfer) >=20 > x =3D XREAD4(temp.sc, runt, XHCI_MFINDEX); >=20 > - DPRINTF("MFINDEX=3D0x%08x\n", x); > + DPRINTF("MFINDEX=3D0x%08x IST=3D0x%x\n", x, sc->sc_ist); This broke amd64 GENERIC with error: use of undeclared identifier =E2=80=98= sc' Should this be temp.sc? Jess From owner-dev-commits-src-main@freebsd.org Sat Jul 10 19:32:05 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 64B6F65A92A; Sat, 10 Jul 2021 19:32:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GMgC91p4wz4mj5; Sat, 10 Jul 2021 19:32:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 274F96025; Sat, 10 Jul 2021 19:32:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16AJW5KZ074819; Sat, 10 Jul 2021 19:32:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16AJW5ev074818; Sat, 10 Jul 2021 19:32:05 GMT (envelope-from git) Date: Sat, 10 Jul 2021 19:32:05 GMT Message-Id: <202107101932.16AJW5ev074818@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: f52783fcf5cc - main - Fix USB debug print after 8fc2a3c41791b205a107dc2bec16ac7514a57958 . MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f52783fcf5cc60734121d061beef0d4ea47b224a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 19:32:05 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=f52783fcf5cc60734121d061beef0d4ea47b224a commit f52783fcf5cc60734121d061beef0d4ea47b224a Author: Hans Petter Selasky AuthorDate: 2021-07-10 19:30:29 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-10 19:31:28 +0000 Fix USB debug print after 8fc2a3c41791b205a107dc2bec16ac7514a57958 . MFC after: 1 week Sponsored by: NVIDIA Networking --- sys/dev/usb/controller/xhci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/usb/controller/xhci.c b/sys/dev/usb/controller/xhci.c index 93468c5d9333..690091fcef2f 100644 --- a/sys/dev/usb/controller/xhci.c +++ b/sys/dev/usb/controller/xhci.c @@ -2078,7 +2078,7 @@ xhci_setup_generic_chain(struct usb_xfer *xfer) x = XREAD4(temp.sc, runt, XHCI_MFINDEX); - DPRINTF("MFINDEX=0x%08x IST=0x%x\n", x, sc->sc_ist); + DPRINTF("MFINDEX=0x%08x IST=0x%x\n", x, temp.sc->sc_ist); switch (usbd_get_speed(xfer->xroot->udev)) { case USB_SPEED_FULL: From owner-dev-commits-src-main@freebsd.org Sat Jul 10 19:34:58 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A394265A741; Sat, 10 Jul 2021 19:34:58 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [88.99.82.50]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4GMgGV3QMXz4mPk; Sat, 10 Jul 2021 19:34:58 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2020.home.selasky.org (unknown [178.17.145.105]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 313F826028D; Sat, 10 Jul 2021 21:34:51 +0200 (CEST) Subject: Re: git: d038463bd269 - main - Make sure the XHCI driver obeys the isochronous scheduling threshold value as given by the XHCI hardware parameters to avoid scheduling isochronous transfers too early. To: Jessica Clarke Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" References: <202107101904.16AJ4lj3035432@gitrepo.freebsd.org> <09444339-973B-4A2B-ACEA-B00B8E48F460@freebsd.org> From: Hans Petter Selasky Message-ID: <4a0de77e-babe-8fd7-502e-df3dbb309616@selasky.org> Date: Sat, 10 Jul 2021 21:34:43 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.10.2 MIME-Version: 1.0 In-Reply-To: <09444339-973B-4A2B-ACEA-B00B8E48F460@freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4GMgGV3QMXz4mPk X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 19:34:58 -0000 On 7/10/21 9:30 PM, Jessica Clarke wrote: > This broke amd64 GENERIC with error: use of undeclared identifier ‘sc' > > Should this be temp.sc? Yes. I was testing mostly with GENERIC-NODEBUG and forgot to check all the prints. Fixed: https://cgit.freebsd.org/src/commit/?id=f52783fcf5cc60734121d061beef0d4ea47b224a --HPS From owner-dev-commits-src-main@freebsd.org Sat Jul 10 20:00:34 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1C0CA65AB9A; Sat, 10 Jul 2021 20:00:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GMgr20Lgrz4qby; Sat, 10 Jul 2021 20:00:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E80B5668E; Sat, 10 Jul 2021 20:00:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16AK0Xqt011425; Sat, 10 Jul 2021 20:00:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16AK0Xdt011424; Sat, 10 Jul 2021 20:00:33 GMT (envelope-from git) Date: Sat, 10 Jul 2021 20:00:33 GMT Message-Id: <202107102000.16AK0Xdt011424@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: 05f56ac92fe4 - main - LinuxKPI: Force the usleep_range() function to sleep instead of spinning on the timer. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 05f56ac92fe4bcb00be5bd01574991a50c548b8b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 20:00:34 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=05f56ac92fe4bcb00be5bd01574991a50c548b8b commit 05f56ac92fe4bcb00be5bd01574991a50c548b8b Author: Hans Petter Selasky AuthorDate: 2021-07-10 19:56:29 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-10 19:59:31 +0000 LinuxKPI: Force the usleep_range() function to sleep instead of spinning on the timer. This allows other threads to execute, typically during hardware waiting loops. This also maches how the function works in Linux. Reviewed by: kib MFC after: 1 week Sponsored by: NVIDIA Networking --- sys/compat/linuxkpi/common/include/linux/delay.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/delay.h b/sys/compat/linuxkpi/common/include/linux/delay.h index 860d36368a8e..1ed9dffed359 100644 --- a/sys/compat/linuxkpi/common/include/linux/delay.h +++ b/sys/compat/linuxkpi/common/include/linux/delay.h @@ -2,7 +2,7 @@ * Copyright (c) 2010 Isilon Systems, Inc. * Copyright (c) 2010 iX Systems, Inc. * Copyright (c) 2010 Panasas, Inc. - * Copyright (c) 2013-2015 Mellanox Technologies, Ltd. + * Copyright (c) 2013-2021 Mellanox Technologies, Ltd. * Copyright (c) 2014 François Tigeot * All rights reserved. * @@ -68,7 +68,10 @@ ndelay(unsigned long x) static inline void usleep_range(unsigned long min, unsigned long max) { - DELAY(min); + /* guard against invalid values */ + if (min == 0) + min = 1; + pause_sbt("lnxsleep", ustosbt(min), 0, C_HARDCLOCK); } extern unsigned int linux_msleep_interruptible(unsigned int ms); From owner-dev-commits-src-main@freebsd.org Sun Jul 11 12:01:01 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0D92B666067; Sun, 11 Jul 2021 12:01:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GN58D705Jz4mLx; Sun, 11 Jul 2021 12:01:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D7EEA1B27C; Sun, 11 Jul 2021 12:01:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16BC10t1090590; Sun, 11 Jul 2021 12:01:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16BC10tG090589; Sun, 11 Jul 2021 12:01:00 GMT (envelope-from git) Date: Sun, 11 Jul 2021 12:01:00 GMT Message-Id: <202107111201.16BC10tG090589@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: cf48d1f77126 - main - Clamp the XHCI minimum isochronous scheduling delay to the maximum value that will work under FreeBSD, if the value is too big. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cf48d1f77126d8de4c03c4dd7c8502be2b5f1954 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Jul 2021 12:01:01 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=cf48d1f77126d8de4c03c4dd7c8502be2b5f1954 commit cf48d1f77126d8de4c03c4dd7c8502be2b5f1954 Author: Hans Petter Selasky AuthorDate: 2021-07-11 11:56:52 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-11 11:57:15 +0000 Clamp the XHCI minimum isochronous scheduling delay to the maximum value that will work under FreeBSD, if the value is too big. MFC after: 1 week Sponsored by: NVIDIA Networking --- sys/dev/usb/controller/xhci.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/dev/usb/controller/xhci.c b/sys/dev/usb/controller/xhci.c index 690091fcef2f..e9d15eabc20a 100644 --- a/sys/dev/usb/controller/xhci.c +++ b/sys/dev/usb/controller/xhci.c @@ -2110,6 +2110,7 @@ xhci_setup_generic_chain(struct usb_xfer *xfer) * or equal to 2 milliseconds, which is too * much. */ + y = 7; } else { /* * Subtract one millisecond, because the From owner-dev-commits-src-main@freebsd.org Sun Jul 11 12:54:08 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A829A6674C2; Sun, 11 Jul 2021 12:54:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GN6KX4BMMz3CwY; Sun, 11 Jul 2021 12:54:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 789401C180; Sun, 11 Jul 2021 12:54:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16BCs8qk059450; Sun, 11 Jul 2021 12:54:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16BCs8LD059449; Sun, 11 Jul 2021 12:54:08 GMT (envelope-from git) Date: Sun, 11 Jul 2021 12:54:08 GMT Message-Id: <202107111254.16BCs8LD059449@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gordon Bergling Subject: git: 5aa1e55b0ae7 - main - hwpmc(4): Fix a typo in the man page date MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gbe X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5aa1e55b0ae777920e0672ec3e627bea7cb6c1fc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Jul 2021 12:54:08 -0000 The branch main has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=5aa1e55b0ae777920e0672ec3e627bea7cb6c1fc commit 5aa1e55b0ae777920e0672ec3e627bea7cb6c1fc Author: Gordon Bergling AuthorDate: 2021-07-11 12:53:18 +0000 Commit: Gordon Bergling CommitDate: 2021-07-11 12:53:18 +0000 hwpmc(4): Fix a typo in the man page date MFC after: 3 days --- share/man/man4/hwpmc.4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/man/man4/hwpmc.4 b/share/man/man4/hwpmc.4 index a5b4bcb94707..d1bd576fcb9c 100644 --- a/share/man/man4/hwpmc.4 +++ b/share/man/man4/hwpmc.4 @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd Apryl 3, 2021 +.Dd April 3, 2021 .Dt HWPMC 4 .Os .Sh NAME From owner-dev-commits-src-main@freebsd.org Sun Jul 11 14:47:59 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3D8A6668CE7; Sun, 11 Jul 2021 14:47:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GN8rv1C9Fz3jrJ; Sun, 11 Jul 2021 14:47:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 10A831D738; Sun, 11 Jul 2021 14:47:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16BElwvd006051; Sun, 11 Jul 2021 14:47:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16BElwkH006050; Sun, 11 Jul 2021 14:47:58 GMT (envelope-from git) Date: Sun, 11 Jul 2021 14:47:58 GMT Message-Id: <202107111447.16BElwkH006050@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 9c1c02093b90 - main - loader: support.4th resets the read buffer incorrectly MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9c1c02093b90ae49745a174eb26ea85dd1990eec Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Jul 2021 14:47:59 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=9c1c02093b90ae49745a174eb26ea85dd1990eec commit 9c1c02093b90ae49745a174eb26ea85dd1990eec Author: John Hood AuthorDate: 2021-07-11 14:44:12 +0000 Commit: Warner Losh CommitDate: 2021-07-11 14:47:29 +0000 loader: support.4th resets the read buffer incorrectly Large nextboot.conf files (over 80 bytes) are not read correctly by the Forth loader, causing file parsing to abort, and nextboot configuration fails to apply. Simple repro: nextboot -e foo=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx shutdown -r now That will cause the bug to cause a parse failure but shouldn't otherwise affect the boot. Depending on your loader configuration, you may also have to set beastie_disable and/or reduce the number of modules loaded to see the error on a small console screen. 12.0 or CURRENT users will also have to explicitly use the Forth loader instead of the Lua loader. The error will look something like: Warning: syntax error on file /boot/loader.conf.local foo="xxxxxxxxxxxxxxnextboot_enable="YES" ^ /boot/support.4th has crude file I/O buffering, which uses a buffer 'read_buffer', defined to be 80 bytes by the 'read_buffer_size' constant. The loader first tastes nextboot.conf, reading and parsing the first line in it for nextboot_enable="YES". If this is true, then it reopens the file and parses it like other loader .conf files. Unfortunately, the file I/O buffering code does not fully reset the buffer state in the reset_line_reading word. If the last file was read to the end, that doesn't matter; the file buffer is treated as empty anyway. But in the nextboot.conf case, the loader will not read to the end of file if it is over 80 bytes, and the file buffer may be reused when reading the next file. When the file is reread, the corrupt text may cause file parsing to abort on bad syntax (if the corrupt line has <>2 quotes in it), the wrong variable to be set, no variable to be set at all, or (if the splice happens to land at a line ending) something approximating normal operation. The bug is very old, dating back to at least 2000 if not before, and is still present in 12.0 and CURRENT r345863 (though it is now hidden by the Lua loader by default). Suggested one-line attached. This does change the behavior of the reset_line_reading word, which is exported in the line-reading dictionary (though the export is not documented in loader man pages). But repo history shows it was probably exported for the PNP support code, which was never included in the loader build, and was removed 5 months ago. One thing that puzzles me: how has this bug gone unnoticed/unfixed for nearly 2 decades? I find it hard to believe that nobody's tried to do something interesting with nextboot, like load a kernel and filesystem, which is what I'm doing. PR: 239315 Reviewed by: imp --- stand/forth/support.4th | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stand/forth/support.4th b/stand/forth/support.4th index d87cf16a16dd..ec04b7e9e322 100644 --- a/stand/forth/support.4th +++ b/stand/forth/support.4th @@ -485,7 +485,7 @@ variable fd get-current ( -- wid ) previous definitions >search ( wid -- ) : reset_line_reading - 0 to read_buffer_ptr + 0 read_buffer .len ! ; : read_line From owner-dev-commits-src-main@freebsd.org Sun Jul 11 15:06:22 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6190F6691E0; Sun, 11 Jul 2021 15:06:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GN9G628Dxz3m2H; Sun, 11 Jul 2021 15:06:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 260FB1DD89; Sun, 11 Jul 2021 15:06:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16BF6MSh033389; Sun, 11 Jul 2021 15:06:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16BF6MV9033388; Sun, 11 Jul 2021 15:06:22 GMT (envelope-from git) Date: Sun, 11 Jul 2021 15:06:22 GMT Message-Id: <202107111506.16BF6MV9033388@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 36cfb5d50f8e - main - nanobsd: enhance fill_pkg.sh MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 36cfb5d50f8e8856695780a6792fb7e81816e9ee Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Jul 2021 15:06:22 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=36cfb5d50f8e8856695780a6792fb7e81816e9ee commit 36cfb5d50f8e8856695780a6792fb7e81816e9ee Author: Lev A. Serebryakov AuthorDate: 2021-07-11 15:04:39 +0000 Commit: Warner Losh CommitDate: 2021-07-11 15:05:16 +0000 nanobsd: enhance fill_pkg.sh NanoBSD has helper script "fill_pkg.sh" which links all packages and ther dependencies from "package dump" (like /usr/ports/packages/All) to specified director. fill_pkg.sh has some limitations: 1) It needs ports tree, which should have exactly same versions as "package dump". 2) It requires full paths to needed ports, including "/usr/ports" part. 3) It has assumptions about Nano Package Dir (it assumes, that it specified rtelative to current directory). 4) It does not have any diagnostics (almost). This PR enhances "fill_pkg.sh" script in several ways: 1) Nano package dir could be absolute path. 2) Script understands four ways to specify "root" ports/packages: (a) Absolute directory with port (old one) (b) Relative directory with port, relative to ${PORTSDIR} or /usr/ports (c) Absolute path to file with package (with .tbz suffix) (d) Name of package in dump dir, with or without .tbz suffix These ways can be mixed in one call. Dependencies for packages are obtained with 'pkg_info -r' call, and are searched for in same directory as "parent" package. Dependencies for ports are obtained in old way from port's Makefile. 3) Three levels of diagnostic (and -v option, could be repeated) are added. 4) All path variables are enclosed in quotes, to make script work with paths, containing spaces. Note: imp merged in the changes to fill_pkg.sh since this has been a PR. PR: 151695 Reviewed by: imp@ MFC After: 3 days Differential Revision: https://reviews.freebsd.org/D31101 --- tools/tools/nanobsd/fill_pkg.sh | 154 +++++++++++++++++++++++++++++----------- 1 file changed, 113 insertions(+), 41 deletions(-) diff --git a/tools/tools/nanobsd/fill_pkg.sh b/tools/tools/nanobsd/fill_pkg.sh index be240a3bf66f..80f61429ee8f 100644 --- a/tools/tools/nanobsd/fill_pkg.sh +++ b/tools/tools/nanobsd/fill_pkg.sh @@ -1,5 +1,6 @@ #!/bin/sh # +# Copyright (c) 2014 Lev Serebryakov. # Copyright (c) 2009 Poul-Henning Kamp. # All rights reserved. # @@ -27,70 +28,141 @@ # $FreeBSD$ # # Usage: -# $0 PACKAGE_DUMP NANO_PACKAGE_DIR /usr/ports/foo/bar ... +# $0 PACKAGE_DUMP NANO_PACKAGE_DIR /usr/ports/foo/bar [package.txz]... # # Will symlink the packages listed, including their runtime dependencies, # from the PACKAGE_DUMP to the NANO_PACKAGE_DIR. # -NANO_PKG_DUMP=$1 -shift; -if [ ! -d $NANO_PKG_DUMP ] ; then - echo "$NANO_PKG_DUMP not a directory" 1>&2 - exit 1 -fi +: ${PORTSDIR:=/usr/ports} -NANO_PACKAGE_DIR=$1 -shift; +usage () { + echo "Usage: $0 [-v] package-dump-dir nano-package-dir port-dir-or-pkg ..." 1>&2 + exit 2 +} + +msg () { + local l + l=$1 ; shift + [ "$l" -le "$VERBOSE" ] && echo $* +} ports_recurse() ( - of=$1 - shift - for d - do - if [ ! -d $d ] ; then - echo "Missing port $d" 1>&2 + local outputfile dumpdir type fullpath pkgname p + outputfile=$1 ; shift + dumpdir=$1 ; shift + for p do + if [ -d "$p" -a -f "$p/Makefile" ] ; then + msg 3 "$p: full path to port" + pkgname=`cd "$p" && make -V pkgname` + type=port + fullpath=$p + elif [ -d "${PORTSDIR}/$p" -a -f "${PORTSDIR}/$p/Makefile" ] ; then + msg 3 "$p: path to port relative to ${PORTSDIR}}" + pkgname=`cd "${PORTSDIR}/$p" && make -V pkgname` + type=port + fullpath=${PORTSDIR}/$p + elif [ "${p%.txz}" != "$p" -a -f "$p" ] && pkg info -F "$p" > /dev/null 2>&1 ; then + msg 3 "$p: full package file name" + pkgname=`basename "$p" | sed 's/\.txz$//I'` + type=pkg + fullpath=$p + elif [ "${p%.txz}" != "$p" -a -f "$dumpdir/$p" ] && pkg info -F "$dumpdir/$p" > /dev/null 2>&1 ; then + msg 3 "$p: package file name relative to $dumpdir" + pkgname=`basename "$p" | sed 's/\.txz$//I'` + type=pkg + fullpath=$dumpdir/$p + elif [ -f "$dumpdir/$p.txz" ] && pkg info -F "$dumpdir/$p.txz" > /dev/null 2>&1 ; then + msg 3 "$p: package name relative to $dumpdir" + pkgname=`basename "$p"` + type=pkg + fullpath=$dumpdir/$p.txz + else + echo "Missing port or package $p" 1>&2 exit 2 fi - if grep -q "^$d\$" $of ; then + if grep -q "^$pkgname\$" "$outputfile" ; then + msg 3 "$pkgname was added already" true - else + elif [ "$type" = "port" ] ; then ( - cd $d - rd=`make -V RUN_DEPENDS ${PORTS_OPTS}` - ld=`make -V LIB_DEPENDS ${PORTS_OPTS}` - - for x in $rd $ld - do - ports_recurse $of `echo $x | - sed 's/^[^:]*:\([^:]*\).*$/\1/'` - done + cd "$fullpath" + rd=`make -V RUN_DEPENDS ${PORTS_OPTS}` + ld=`make -V LIB_DEPENDS ${PORTS_OPTS}` + + for dep in $rd $ld ; do + arg=`echo $dep | sed 's/^[^:]*:\([^:]*\).*$/\1/'` + msg 2 "Check $arg as requirement for port $pkgname" + ports_recurse "$outputfile" "$dumpdir" "$arg" + done ) - echo $d >> $of + msg 1 "Add $pkgname" + echo "$pkgname" >> "$outputfile" + else + dir=`dirname "$p"` # Get directory from SPECIFIED path, not from full path + if [ "$dir" = "." ] ; then + dir="" + else + dir=${dir}/ + fi + deps=`pkg info -dF "$fullpath" | grep -v "$pkgname:"` + for dep in $deps ; do + arg=`echo $dep | sed -e "s|^|$dir|" -e 's/$/.txz/'` + msg 2 "Check $arg as requirement for package $pkgname" + ports_recurse "$outputfile" "$dumpdir" "$arg" + done + msg 1 "Add $pkgname" + echo "$pkgname" >> "$outputfile" fi done ) -rm -rf $NANO_PACKAGE_DIR -mkdir -p $NANO_PACKAGE_DIR +VERBOSE=0 + +while getopts v opt ; do + case "$opt" in + v) VERBOSE=$(($VERBOSE + 1)) ;; + [?]) usage ;; + esac +done +shift $(( ${OPTIND} - 1 )) + +if [ "$#" -lt 3 ] ; then + usage +fi + +NANO_PKG_DUMP=`realpath $1` +shift; +if [ ! -d "$NANO_PKG_DUMP" ] ; then + echo "$NANO_PKG_DUMP is not a directory" 1>&2 + usage +fi + +NANO_PKG_DIR=`realpath $1` +shift; +if [ ! -d "$NANO_PKG_DIR" ] ; then + echo "$NANO_PKG_DIR is not a directory" 1>&2 + usage +fi + +# Cleanup +rm -rf "$NANO_PKG_DIR/"* + +PL=$NANO_PKG_DIR/_list +true > "$PL" -PL=$NANO_PACKAGE_DIR/_list -true > $PL -for i -do - ports_recurse `pwd`/$PL $i +for p do + ports_recurse "$PL" "$NANO_PKG_DUMP" "$p" done -for i in `cat $PL` -do - p=`(cd $i && make -V PKGNAME)` - if [ -f $NANO_PKG_DUMP/$p.t[bx]z ] ; then - ln -s $NANO_PKG_DUMP/$p.t[bx]z $NANO_PACKAGE_DIR +for i in `cat "$PL"` ; do + if [ -f "$NANO_PKG_DUMP/$i.txz" ] ; then + ln -s "$NANO_PKG_DUMP/$i.txz" "$NANO_PKG_DIR" else - echo "Package $p misssing in $NANO_PKG_DUMP" 1>&2 + echo "Package $i misssing in $NANO_PKG_DUMP" 1>&2 exit 1 fi done -rm -f $PL +rm -f "$PL" exit 0 From owner-dev-commits-src-main@freebsd.org Sun Jul 11 16:36:35 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3115C66AEA8; Sun, 11 Jul 2021 16:36:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GNCGC0W0Gz4SsM; Sun, 11 Jul 2021 16:36:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EF2DB1ECEF; Sun, 11 Jul 2021 16:36:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16BGaY6Z052919; Sun, 11 Jul 2021 16:36:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16BGaYeH052918; Sun, 11 Jul 2021 16:36:34 GMT (envelope-from git) Date: Sun, 11 Jul 2021 16:36:34 GMT Message-Id: <202107111636.16BGaYeH052918@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: b21f19c9e0b7 - main - MINIMAL: remove debugging and some loadable network modules MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b21f19c9e0b7f3c923d845e9e31c0552f0162a62 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Jul 2021 16:36:35 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=b21f19c9e0b7f3c923d845e9e31c0552f0162a62 commit b21f19c9e0b7f3c923d845e9e31c0552f0162a62 Author: Helge Oldach AuthorDate: 2021-07-11 16:21:11 +0000 Commit: Warner Losh CommitDate: 2021-07-11 16:35:42 +0000 MINIMAL: remove debugging and some loadable network modules Remove deugging stuff, since it's arguably not needed in a minimal setup. Also vlan, tuntap and gif since they can be loaded. imp didn't include the part of the patch that removed xen guest support. Xen guest is relatively small and has no way of being loaded. Reviewed by: imp PR: 229564 MFC After: 3 days --- sys/amd64/conf/MINIMAL | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/sys/amd64/conf/MINIMAL b/sys/amd64/conf/MINIMAL index b03b17b1bfcd..6678f0a7ee63 100644 --- a/sys/amd64/conf/MINIMAL +++ b/sys/amd64/conf/MINIMAL @@ -83,16 +83,6 @@ options INCLUDE_CONFIG_FILE # Include this file in kernel # Debugging support. Always need this: options KDB # Enable kernel debugger support. options KDB_TRACE # Print a stack trace for a panic. -# For full debugger support use (turn off in stable branch): -options DDB # Support DDB. -options GDB # Support remote GDB. -options DEADLKRES # Enable the deadlock resolver -options INVARIANTS # Enable calls of extra sanity checking -options INVARIANT_SUPPORT # Extra sanity checks of internal structures, required by INVARIANTS -options WITNESS # Enable checks to detect deadlocks and cycles -options WITNESS_SKIPSPIN # Don't run witness on spinlocks for speed -options MALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) zones -options VERBOSE_SYSINIT=0 # Support debug.verbose_sysinit, off by default # Make an SMP-capable kernel by default options SMP # Symmetric MultiProcessor Kernel @@ -135,9 +125,6 @@ device loop # Network loopback device padlock_rng # VIA Padlock RNG device rdrand_rng # Intel Bull Mountain RNG device ether # Ethernet support -device vlan # 802.1Q VLAN support -device tuntap # Packet tunnel. -device gif # IPv6 and IPv4 tunneling # The `bpf' device enables the Berkeley Packet Filter. # Be aware of the administrative consequences of enabling this! From owner-dev-commits-src-main@freebsd.org Sun Jul 11 20:37:19 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7053F66EB13; Sun, 11 Jul 2021 20:37:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GNJbz2l3Qz3JXL; Sun, 11 Jul 2021 20:37:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3B30C2213B; Sun, 11 Jul 2021 20:37:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16BKbJae072823; Sun, 11 Jul 2021 20:37:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16BKbJ2Q072822; Sun, 11 Jul 2021 20:37:19 GMT (envelope-from git) Date: Sun, 11 Jul 2021 20:37:19 GMT Message-Id: <202107112037.16BKbJ2Q072822@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: 4488c8c34ba3 - main - mount_nfs.8: Add information for "nconnect" to man page MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4488c8c34ba38146aab52fd60211bb32cdc87267 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Jul 2021 20:37:19 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=4488c8c34ba38146aab52fd60211bb32cdc87267 commit 4488c8c34ba38146aab52fd60211bb32cdc87267 Author: Rick Macklem AuthorDate: 2021-07-11 20:34:16 +0000 Commit: Rick Macklem CommitDate: 2021-07-11 20:34:16 +0000 mount_nfs.8: Add information for "nconnect" to man page Commit 1e0a518d6548 added a new NFS mount option "nconnect". This patch adds information on this option to the man page. It also adds an IMPLEMENTATION section that explains how the default I/O size is determined and that "nfsstat -m" can be used to find out what option settings are actually in use. This is a content change. Reviewed by: gbe (manpages) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D31135 --- sbin/mount_nfs/mount_nfs.8 | 43 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/sbin/mount_nfs/mount_nfs.8 b/sbin/mount_nfs/mount_nfs.8 index 36a3c180b1e3..648cb2128e90 100644 --- a/sbin/mount_nfs/mount_nfs.8 +++ b/sbin/mount_nfs/mount_nfs.8 @@ -28,7 +28,7 @@ .\" @(#)mount_nfs.8 8.3 (Berkeley) 3/29/95 .\" $FreeBSD$ .\" -.Dd June 26, 2021 +.Dd July 10, 2021 .Dt MOUNT_NFS 8 .Os .Sh NAME @@ -196,6 +196,25 @@ If this is set to 0 it disables positive name caching for the mount point. Override the default of NFS_DEFAULT_NEGNAMETIMEO for the timeout (in seconds) for negative name cache entries. If this is set to 0 it disables negative name caching for the mount point. +.It Cm nconnect Ns = Ns Aq Ar value +Specify the number of TCP connections (1-16) to be used +for an NFS Version 4, minor version 1 or 2 mount. +Multiple TCP connections can provide more client to server network +bandwidth for certain network configurations such as: +.Bd -literal +- Multiple network interfaces that are aggregated together. +- A fast network interface that uses multiple queues. +.Ed +.sp +The first TCP connection will be used for all RPCs that consist +entirely of small RPC messages. +The RPCs that can have large RPC messages (Read/Readdir/Write) are +distributed over the additional TCP connections in a round robin +fashion. +This option will result in more IP port#s being used. +This option requires the +.Cm nfsv4 +option. .It Cm nfsv2 Use the NFS Version 2 protocol (the default is to try version 3 first then version 2). @@ -586,9 +605,31 @@ Same as Same as .Fl o Cm nfsv4 .El +.Sh IMPLEMENTATION NOTES +When neither the +.Cm rsize +nor +.Cm wsize +options are specified, the I/O size will be set to the largest value +supported by both the NFS client and server. +The largest value supported by the NFS client is defined by +the tunable +.Cd vfs.maxbcachebuf +which can be set to a power of two up to +.Cd kern.maxphys . +.Pp +The +.Xr nfsstat 1 +command with the +.Ic -m +command line option will show what +.Nm +option settings are actually in use for the mount. .Sh SEE ALSO +.Xr nfsstat 1 , .Xr nmount 2 , .Xr unmount 2 , +.Xr lagg 4 , .Xr nfsv4 4 , .Xr fstab 5 , .Xr gssd 8 , From owner-dev-commits-src-main@freebsd.org Sun Jul 11 20:58:15 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0AF2566EDDA; Sun, 11 Jul 2021 20:58:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GNK466jgLz3Ls5; Sun, 11 Jul 2021 20:58:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CE80A2258E; Sun, 11 Jul 2021 20:58:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16BKwE8o099122; Sun, 11 Jul 2021 20:58:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16BKwECM099121; Sun, 11 Jul 2021 20:58:14 GMT (envelope-from git) Date: Sun, 11 Jul 2021 20:58:14 GMT Message-Id: <202107112058.16BKwECM099121@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Robert Wing Subject: git: 0c5a59252c8e - main - fsck_ffs: fix background fsck in preen mode MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0c5a59252c8e7b80b98521ebc23a415a05ff9594 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Jul 2021 20:58:15 -0000 The branch main has been updated by rew: URL: https://cgit.FreeBSD.org/src/commit/?id=0c5a59252c8e7b80b98521ebc23a415a05ff9594 commit 0c5a59252c8e7b80b98521ebc23a415a05ff9594 Author: Robert Wing AuthorDate: 2021-07-11 20:47:27 +0000 Commit: Robert Wing CommitDate: 2021-07-11 20:47:27 +0000 fsck_ffs: fix background fsck in preen mode Background checks are only allowed for mounted filesystems - don't try to open the device for writing when performing a background check. While here, remove a debugging printf that's commented out. PR: 256746 Fixes: 5cc52631b3b88dfc36d8049dc8bece8573c5f9af Reviewed by: mckusick MFC After: 1 week Differential Revision: https://reviews.freebsd.org/D30880 --- sbin/fsck_ffs/main.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/sbin/fsck_ffs/main.c b/sbin/fsck_ffs/main.c index edda3d785f09..90eb745ddabc 100644 --- a/sbin/fsck_ffs/main.c +++ b/sbin/fsck_ffs/main.c @@ -295,15 +295,14 @@ checkfilesys(char *filesys) */ if ((fsreadfd = open(filesys, O_RDONLY)) < 0 || readsb(0) == 0) exit(3); /* Cannot read superblock */ - if (nflag || (fswritefd = open(filesys, O_WRONLY)) < 0) { + if (bkgrdflag == 0 && + (nflag || (fswritefd = open(filesys, O_WRONLY)) < 0)) { fswritefd = -1; if (preen) pfatal("NO WRITE ACCESS"); printf(" (NO WRITE)"); } if ((sblock.fs_flags & FS_GJOURNAL) != 0) { - //printf("GJournaled file system detected on %s.\n", - // filesys); if (sblock.fs_clean == 1) { pwarn("FILE SYSTEM CLEAN; SKIPPING CHECKS\n"); exit(0); @@ -317,10 +316,10 @@ checkfilesys(char *filesys) } else { pfatal( "UNEXPECTED INCONSISTENCY, CANNOT RUN FAST FSCK\n"); - close(fsreadfd); - close(fswritefd); } } + close(fsreadfd); + close(fswritefd); } /* * If we are to do a background check: