From owner-dev-commits-src-all@freebsd.org Mon Aug 2 00:30:50 2021 Return-Path: Delivered-To: dev-commits-src-all@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 3F50F669354; Mon, 2 Aug 2021 00:30: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 4GdJnk1NH2z4V2N; Mon, 2 Aug 2021 00:30: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 17A6C15F59; Mon, 2 Aug 2021 00:30: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 1720UnxC004140; Mon, 2 Aug 2021 00:30:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1720UnCK004129; Mon, 2 Aug 2021 00:30:49 GMT (envelope-from git) Date: Mon, 2 Aug 2021 00:30:49 GMT Message-Id: <202108020030.1720UnCK004129@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: 665895db262f - main - amd64 pmap_vm_page_alloc_check(): loose the assert 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: 665895db262fa596b347e40f6857b37e0f43b184 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 00:30:50 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=665895db262fa596b347e40f6857b37e0f43b184 commit 665895db262fa596b347e40f6857b37e0f43b184 Author: Konstantin Belousov AuthorDate: 2021-08-01 21:58:21 +0000 Commit: Konstantin Belousov CommitDate: 2021-08-02 00:28:33 +0000 amd64 pmap_vm_page_alloc_check(): loose the assert Current expression checks that vm_page_alloc(9) never returns a page belonging to the preload area. This is not true if something was freed from there, for instance a preloaded module was unloaded, or ucode update freed. Only check that we never allow to allocate a page belonging to the kernel proper, check against _end. Reported and tested by: dhw Sponsored by: The FreeBSD Foundation MFC after: 1 week --- sys/amd64/include/pmap.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sys/amd64/include/pmap.h b/sys/amd64/include/pmap.h index 518dc544ac0d..375a86f95e9f 100644 --- a/sys/amd64/include/pmap.h +++ b/sys/amd64/include/pmap.h @@ -457,9 +457,10 @@ extern int invpcid_works; #define pmap_unmapbios(va, sz) pmap_unmapdev((va), (sz)) #define pmap_vm_page_alloc_check(m) \ - KASSERT(m->phys_addr < kernphys || m->phys_addr >= KERNend, \ - ("allocating kernel page %p pa %#lx kernphys %#lx kernend %#lx", \ - m, m->phys_addr, kernphys, KERNend)); + KASSERT(m->phys_addr < kernphys || \ + m->phys_addr >= kernphys + (vm_offset_t)&_end - KERNSTART, \ + ("allocating kernel page %p pa %#lx kernphys %#lx end %p", \ + m, m->phys_addr, kernphys, &_end)); struct thread; From owner-dev-commits-src-all@freebsd.org Mon Aug 2 02:58:35 2021 Return-Path: Delivered-To: dev-commits-src-all@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 AAE6866AE0C; Mon, 2 Aug 2021 02:58: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 4GdN4C47bKz4fNC; Mon, 2 Aug 2021 02:58: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 7628617C6C; Mon, 2 Aug 2021 02:58: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 1722wZUD094129; Mon, 2 Aug 2021 02:58:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1722wZcf094128; Mon, 2 Aug 2021 02:58:35 GMT (envelope-from git) Date: Mon, 2 Aug 2021 02:58:35 GMT Message-Id: <202108020258.1722wZcf094128@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: 2668bb2add8d - main - sched_ule(4): Reduce duplicate search for load. 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: 2668bb2add8d11c56524ce9014b510412f8f6aa9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 02:58:35 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=2668bb2add8d11c56524ce9014b510412f8f6aa9 commit 2668bb2add8d11c56524ce9014b510412f8f6aa9 Author: Alexander Motin AuthorDate: 2021-08-02 02:07:51 +0000 Commit: Alexander Motin CommitDate: 2021-08-02 02:07:51 +0000 sched_ule(4): Reduce duplicate search for load. When sched_highest() called for some CPU group returns nothing, idle thread calls it for the parent CPU group. But the parent CPU group also includes the CPU group we've just searched, and unless there is a race going on, it is unlikely we find anything new this time. Avoid the double search in case of parent group having only two sub- groups (the most prominent case). Instead of escalating to the parent group run the next search over the sibling subgroup and escalate two levels up after if that fail too. In case of more than two siblings the difference is less significant, while searching the parent group can result in better decision if we find several candidate CPUs. On 2-socket 40-core Xeon system I am measuring ~25% reduction of CPU time spent inside cpu_search_highest() in both SMT (2x20x2) and non- SMT (2x20) cases. MFC after: 1 month --- sys/kern/sched_ule.c | 63 +++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 52 insertions(+), 11 deletions(-) diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c index 2b55b0a7a8c5..028e07efa889 100644 --- a/sys/kern/sched_ule.c +++ b/sys/kern/sched_ule.c @@ -933,10 +933,10 @@ tdq_move(struct tdq *from, struct tdq *to) static int tdq_idled(struct tdq *tdq) { - struct cpu_group *cg; + struct cpu_group *cg, *parent; struct tdq *steal; cpuset_t mask; - int cpu, switchcnt; + int cpu, switchcnt, goup; if (smp_started == 0 || steal_idle == 0 || tdq->tdq_cg == NULL) return (1); @@ -944,7 +944,7 @@ tdq_idled(struct tdq *tdq) CPU_CLR(PCPU_GET(cpuid), &mask); restart: switchcnt = tdq->tdq_switchcnt + tdq->tdq_oldswitchcnt; - for (cg = tdq->tdq_cg; ; ) { + for (cg = tdq->tdq_cg, goup = 0; ; ) { cpu = sched_highest(cg, &mask, steal_thresh); /* * We were assigned a thread but not preempted. Returning @@ -952,10 +952,29 @@ tdq_idled(struct tdq *tdq) */ if (tdq->tdq_load) return (0); + + /* + * We found no CPU to steal from in this group. Escalate to + * the parent and repeat. But if parent has only two children + * groups we can avoid searching this group again by searching + * the other one specifically and then escalating two levels. + */ if (cpu == -1) { - cg = cg->cg_parent; - if (cg == NULL) + if (goup) { + cg = cg->cg_parent; + goup = 0; + } + parent = cg->cg_parent; + if (parent == NULL) return (1); + if (parent->cg_children == 2) { + if (cg == &parent->cg_child[0]) + cg = &parent->cg_child[1]; + else + cg = &parent->cg_child[0]; + goup = 1; + } else + cg = parent; continue; } steal = TDQ_CPU(cpu); @@ -1868,10 +1887,10 @@ lend: static void tdq_trysteal(struct tdq *tdq) { - struct cpu_group *cg; + struct cpu_group *cg, *parent; struct tdq *steal; cpuset_t mask; - int cpu, i; + int cpu, i, goup; if (smp_started == 0 || trysteal_limit == 0 || tdq->tdq_cg == NULL) return; @@ -1880,7 +1899,7 @@ tdq_trysteal(struct tdq *tdq) /* We don't want to be preempted while we're iterating. */ spinlock_enter(); TDQ_UNLOCK(tdq); - for (i = 1, cg = tdq->tdq_cg; ; ) { + for (i = 1, cg = tdq->tdq_cg, goup = 0; ; ) { cpu = sched_highest(cg, &mask, steal_thresh); /* * If a thread was added while interrupts were disabled don't @@ -1890,13 +1909,35 @@ tdq_trysteal(struct tdq *tdq) TDQ_LOCK(tdq); break; } + + /* + * We found no CPU to steal from in this group. Escalate to + * the parent and repeat. But if parent has only two children + * groups we can avoid searching this group again by searching + * the other one specifically and then escalating two levels. + */ if (cpu == -1) { - i++; - cg = cg->cg_parent; - if (cg == NULL || i > trysteal_limit) { + if (goup) { + cg = cg->cg_parent; + goup = 0; + } + if (++i > trysteal_limit) { + TDQ_LOCK(tdq); + break; + } + parent = cg->cg_parent; + if (parent == NULL) { TDQ_LOCK(tdq); break; } + if (parent->cg_children == 2) { + if (cg == &parent->cg_child[0]) + cg = &parent->cg_child[1]; + else + cg = &parent->cg_child[0]; + goup = 1; + } else + cg = parent; continue; } steal = TDQ_CPU(cpu); From owner-dev-commits-src-all@freebsd.org Mon Aug 2 02:58:36 2021 Return-Path: Delivered-To: dev-commits-src-all@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 B345766ADCB; Mon, 2 Aug 2021 02:58:36 +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 4GdN4D4d4yz4fW5; Mon, 2 Aug 2021 02:58:36 +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 8730C17CED; Mon, 2 Aug 2021 02:58:36 +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 1722waXZ094153; Mon, 2 Aug 2021 02:58:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1722walG094152; Mon, 2 Aug 2021 02:58:36 GMT (envelope-from git) Date: Mon, 2 Aug 2021 02:58:36 GMT Message-Id: <202108020258.1722walG094152@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: 8bb173fb5bc3 - main - sched_ule(4): Use trylock when stealing load. 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: 8bb173fb5bc33a02d5a4670c9a60bba0ece07bac Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 02:58:36 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=8bb173fb5bc33a02d5a4670c9a60bba0ece07bac commit 8bb173fb5bc33a02d5a4670c9a60bba0ece07bac Author: Alexander Motin AuthorDate: 2021-08-02 02:42:01 +0000 Commit: Alexander Motin CommitDate: 2021-08-02 02:42:01 +0000 sched_ule(4): Use trylock when stealing load. On some load patterns it is possible for several CPUs to try steal thread from the same CPU despite randomization introduced. It may cause significant lock contention when holding one queue lock idle thread tries to acquire another one. Use of trylock on the remote queue allows both reduce the contention and handle lock ordering easier. If we can't get lock inside tdq_trysteal() we just return, allowing tdq_idled() handle it. If it happens in tdq_idled(), then we repeat search for load skipping this CPU. On 2-socket 80-thread Xeon system I am observing dramatic reduction of the lock spinning time when doing random uncached 4KB reads from 12 ZVOLs, while IOPS increase from 327K to 403K. MFC after: 1 month --- sys/kern/sched_ule.c | 39 +++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c index 028e07efa889..1bdcfb1f793d 100644 --- a/sys/kern/sched_ule.c +++ b/sys/kern/sched_ule.c @@ -300,6 +300,8 @@ static struct tdq tdq_cpu; #define TDQ_LOCK_ASSERT(t, type) mtx_assert(TDQ_LOCKPTR((t)), (type)) #define TDQ_LOCK(t) mtx_lock_spin(TDQ_LOCKPTR((t))) #define TDQ_LOCK_FLAGS(t, f) mtx_lock_spin_flags(TDQ_LOCKPTR((t)), (f)) +#define TDQ_TRYLOCK(t) mtx_trylock_spin(TDQ_LOCKPTR((t))) +#define TDQ_TRYLOCK_FLAGS(t, f) mtx_trylock_spin_flags(TDQ_LOCKPTR((t)), (f)) #define TDQ_UNLOCK(t) mtx_unlock_spin(TDQ_LOCKPTR((t))) #define TDQ_LOCKPTR(t) ((struct mtx *)(&(t)->tdq_lock)) @@ -989,13 +991,22 @@ tdq_idled(struct tdq *tdq) if (steal->tdq_load < steal_thresh || steal->tdq_transferable == 0) goto restart; - tdq_lock_pair(tdq, steal); /* - * We were assigned a thread while waiting for the locks. - * Switch to it now instead of stealing a thread. + * Try to lock both queues. If we are assigned a thread while + * waited for the lock, switch to it now instead of stealing. + * If we can't get the lock, then somebody likely got there + * first so continue searching. */ - if (tdq->tdq_load) - break; + TDQ_LOCK(tdq); + if (tdq->tdq_load > 0) { + mi_switch(SW_VOL | SWT_IDLE); + return (0); + } + if (TDQ_TRYLOCK_FLAGS(steal, MTX_DUPOK) == 0) { + TDQ_UNLOCK(tdq); + CPU_CLR(cpu, &mask); + continue; + } /* * The data returned by sched_highest() is stale and * the chosen CPU no longer has an eligible thread, or @@ -1948,18 +1959,18 @@ tdq_trysteal(struct tdq *tdq) if (steal->tdq_load < steal_thresh || steal->tdq_transferable == 0) continue; - tdq_lock_pair(tdq, steal); /* - * If we get to this point, unconditonally exit the loop - * to bound the time spent in the critcal section. - * - * If a thread was added while interrupts were disabled don't - * steal one here. + * Try to lock both queues. If we are assigned a thread while + * waited for the lock, switch to it now instead of stealing. + * If we can't get the lock, then somebody likely got there + * first. At this point unconditonally exit the loop to + * bound the time spent in the critcal section. */ - if (tdq->tdq_load > 0) { - TDQ_UNLOCK(steal); + TDQ_LOCK(tdq); + if (tdq->tdq_load > 0) + break; + if (TDQ_TRYLOCK_FLAGS(steal, MTX_DUPOK) == 0) break; - } /* * The data returned by sched_highest() is stale and * the chosen CPU no longer has an eligible thread. From owner-dev-commits-src-all@freebsd.org Mon Aug 2 03:44:05 2021 Return-Path: Delivered-To: dev-commits-src-all@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 7287666AFF3; Mon, 2 Aug 2021 03:44:05 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-lj1-x22d.google.com (mail-lj1-x22d.google.com [IPv6:2a00:1450:4864:20::22d]) (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 4GdP4j28yFz4hV5; Mon, 2 Aug 2021 03:44:05 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-lj1-x22d.google.com with SMTP id h9so22142091ljq.8; Sun, 01 Aug 2021 20:44:05 -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=6bZTynY+Z2ApvDJDwouTTpLSDunc7mJcE3e8Bzl/Ask=; b=hXGVJJcacqNSLEzjbHJkZ2YFu9/gNhfTPIkrfU4Zifsi8hGwwhtUsRhepp6KSyWMJ5 6dLjn91BNof0tWguH1B9dnP4GheXHd1l3U54D2kiLlF2s16HV0Z584m+JC8Vsx056Cwz inEVoF831EZn6sEHi5uic5sNqldq6GiFSZlfoXDdlFwKcRWicHDBEWWpvIM+wHRXOzk3 oJJ2rnb/tNe+k1QPlhe49nRiO0J3AwFfAQgSAPNQefbI7j3UG+48M50++6wu7x9VD4/v I4hya+mqTJBgXFoNlORsKQ3OUEiIM54D3EUTjeUgNn3QhO90T8JhSw1/QIL3DhsV67IF UULQ== 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=6bZTynY+Z2ApvDJDwouTTpLSDunc7mJcE3e8Bzl/Ask=; b=JygNfEhtfXszzDWMNowc1KwRLGrKSUBMEX887Z8lkaRe9RP2OQODkGxPcENKk0lKtV rz13gKOk90fkCF1ZADNXXcsk2sR2yDHMy4+XPlISqPaS9B8HRT4EpCl1MbRZ1WHwXZLp kL6exYBsK4Ew0L6yA8OtjpjINS1+gHui1X2HEBmGUiCB7N4kIcr8tqyZ8eVvA/Dzm3Sl 95ZjPO92o6f/eLQgEzUugZ0Xj3c7adwa4hu3w03vkK8UELOaRaJhQsbFPe/lFEbDh5xp X2XnH2LoFit5HqeqG6ijVY/ROJTRU4AyZL320ZG87DXfzDThBYXQZentHSBDsOQZaeLl V7SA== X-Gm-Message-State: AOAM531L8z3u4zob5l33YJgPQWKHrUdAZ1SPbzumtNbeSZ1J62RIQRdt v5N9Y1gkfJewTwIxBZlS7SzXzHHQzAJ7c+qgsxryrDqr X-Google-Smtp-Source: ABdhPJzGnasRktCRFkXZlLWzldSube0yky6y+z5ZXFs7su24UQKS9t/vrs/PgmhDVCQC+ZRCSQLtBZ6YZ+9VPtqVDIk= X-Received: by 2002:a2e:b81c:: with SMTP id u28mr9610751ljo.483.1627875838332; Sun, 01 Aug 2021 20:43:58 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a2e:a40d:0:0:0:0:0 with HTTP; Sun, 1 Aug 2021 20:43:57 -0700 (PDT) In-Reply-To: <202108020258.1722walG094152@gitrepo.freebsd.org> References: <202108020258.1722walG094152@gitrepo.freebsd.org> From: Mateusz Guzik Date: Mon, 2 Aug 2021 05:43:57 +0200 Message-ID: Subject: Re: git: 8bb173fb5bc3 - main - sched_ule(4): Use trylock when stealing load. To: Alexander Motin 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: 4GdP4j28yFz4hV5 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 03:44:05 -0000 Mostly related, I just had a look at the code and noticed: static uint32_t sched_random(void) { uint32_t *rndptr; rndptr = DPCPU_PTR(randomval); *rndptr = *rndptr * 69069 + 5; return (*rndptr >> 16); } Except randomval starts at 0 for all CPUs. Should be easy to pre-init with an actual random value. Is that something you played with? On 8/2/21, Alexander Motin wrote: > The branch main has been updated by mav: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=8bb173fb5bc33a02d5a4670c9a60bba0ece07bac > > commit 8bb173fb5bc33a02d5a4670c9a60bba0ece07bac > Author: Alexander Motin > AuthorDate: 2021-08-02 02:42:01 +0000 > Commit: Alexander Motin > CommitDate: 2021-08-02 02:42:01 +0000 > > sched_ule(4): Use trylock when stealing load. > > On some load patterns it is possible for several CPUs to try steal > thread from the same CPU despite randomization introduced. It may > cause significant lock contention when holding one queue lock idle > thread tries to acquire another one. Use of trylock on the remote > queue allows both reduce the contention and handle lock ordering > easier. If we can't get lock inside tdq_trysteal() we just return, > allowing tdq_idled() handle it. If it happens in tdq_idled(), then > we repeat search for load skipping this CPU. > > On 2-socket 80-thread Xeon system I am observing dramatic reduction > of the lock spinning time when doing random uncached 4KB reads from > 12 ZVOLs, while IOPS increase from 327K to 403K. > > MFC after: 1 month > --- > sys/kern/sched_ule.c | 39 +++++++++++++++++++++++++-------------- > 1 file changed, 25 insertions(+), 14 deletions(-) > > diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c > index 028e07efa889..1bdcfb1f793d 100644 > --- a/sys/kern/sched_ule.c > +++ b/sys/kern/sched_ule.c > @@ -300,6 +300,8 @@ static struct tdq tdq_cpu; > #define TDQ_LOCK_ASSERT(t, type) mtx_assert(TDQ_LOCKPTR((t)), (type)) > #define TDQ_LOCK(t) mtx_lock_spin(TDQ_LOCKPTR((t))) > #define TDQ_LOCK_FLAGS(t, f) mtx_lock_spin_flags(TDQ_LOCKPTR((t)), (f)) > +#define TDQ_TRYLOCK(t) mtx_trylock_spin(TDQ_LOCKPTR((t))) > +#define TDQ_TRYLOCK_FLAGS(t, f) mtx_trylock_spin_flags(TDQ_LOCKPTR((t)), > (f)) > #define TDQ_UNLOCK(t) mtx_unlock_spin(TDQ_LOCKPTR((t))) > #define TDQ_LOCKPTR(t) ((struct mtx *)(&(t)->tdq_lock)) > > @@ -989,13 +991,22 @@ tdq_idled(struct tdq *tdq) > if (steal->tdq_load < steal_thresh || > steal->tdq_transferable == 0) > goto restart; > - tdq_lock_pair(tdq, steal); > /* > - * We were assigned a thread while waiting for the locks. > - * Switch to it now instead of stealing a thread. > + * Try to lock both queues. If we are assigned a thread while > + * waited for the lock, switch to it now instead of stealing. > + * If we can't get the lock, then somebody likely got there > + * first so continue searching. > */ > - if (tdq->tdq_load) > - break; > + TDQ_LOCK(tdq); > + if (tdq->tdq_load > 0) { > + mi_switch(SW_VOL | SWT_IDLE); > + return (0); > + } > + if (TDQ_TRYLOCK_FLAGS(steal, MTX_DUPOK) == 0) { > + TDQ_UNLOCK(tdq); > + CPU_CLR(cpu, &mask); > + continue; > + } > /* > * The data returned by sched_highest() is stale and > * the chosen CPU no longer has an eligible thread, or > @@ -1948,18 +1959,18 @@ tdq_trysteal(struct tdq *tdq) > if (steal->tdq_load < steal_thresh || > steal->tdq_transferable == 0) > continue; > - tdq_lock_pair(tdq, steal); > /* > - * If we get to this point, unconditonally exit the loop > - * to bound the time spent in the critcal section. > - * > - * If a thread was added while interrupts were disabled don't > - * steal one here. > + * Try to lock both queues. If we are assigned a thread while > + * waited for the lock, switch to it now instead of stealing. > + * If we can't get the lock, then somebody likely got there > + * first. At this point unconditonally exit the loop to > + * bound the time spent in the critcal section. > */ > - if (tdq->tdq_load > 0) { > - TDQ_UNLOCK(steal); > + TDQ_LOCK(tdq); > + if (tdq->tdq_load > 0) > + break; > + if (TDQ_TRYLOCK_FLAGS(steal, MTX_DUPOK) == 0) > break; > - } > /* > * The data returned by sched_highest() is stale and > * the chosen CPU no longer has an eligible thread. > -- Mateusz Guzik From owner-dev-commits-src-all@freebsd.org Mon Aug 2 03:47:38 2021 Return-Path: Delivered-To: dev-commits-src-all@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 8C6E566BA04; Mon, 2 Aug 2021 03:47:38 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-qk1-x72a.google.com (mail-qk1-x72a.google.com [IPv6:2607:f8b0:4864:20::72a]) (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 4GdP8p3Fr2z4hXH; Mon, 2 Aug 2021 03:47:38 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: by mail-qk1-x72a.google.com with SMTP id t66so15520909qkb.0; Sun, 01 Aug 2021 20:47:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=4CjCuYTuuhunBpUawLkExsoHRoGyxR7zBr3lQgIslSY=; b=mWNHyeBWIe/uYrW6tmZYHwz9334sf9oc93xosmdpiYo1nYBg5SgTmYJyD7kd72RiGS eOxiZNbtoASVkd9wrFRVr6Qm1KcO+EnJXK44nbNdStaa6T27QTOHHDHpv2dU/yih5Hno g0fFNfH1uduGgfNf63UmJdkp1JMqcVSdomrw1oKu/23HBd1H7ltrbYr4QtFJFm3Kwrpw q2pG+SH1KoruBUalK+zAWl5B4MjnDoekwct6MiIUAUrLGSZOzMSWIvz8jwO2dH3K9+IK 6Kp0wfcXUX82W2+108AQMQfDL8U6TDa/v7FRS7SruaLYqsfCkQnkkdviUCLu3c06EK0c d+kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=4CjCuYTuuhunBpUawLkExsoHRoGyxR7zBr3lQgIslSY=; b=Qc8uBS+rH7sYqEkhRUmp7Eg7QHfd2Q8WcQT5AQ1CyULhk39D2VviOLnUAfGq+mYzhQ echFaFzv9GO+MFa/c/QnrSZbiZFKcuthNAsgC/k2b3xA0imJdVvxIgKPLQB4ALp00GHc 4Tu+k8xGFP5CauTemiKKT6t0mJqUpBApxSKbxULOu2an1MNDYCHjE0s5KGGxsvz8B5EI YcQSVeXvmIQxIlIzC6ILwRr2Z3i4+9ZyA9vxa22beE5R0F62gG+fPdf09yKnuSgk3m7C by4kh54VlohazSKNRBSynvcTYbDjtyq5F/WhLPjH8vFkIwKDPqmbHE7UpYDVns70gFFg 94qA== X-Gm-Message-State: AOAM531z7HM29f96NehbNAjBsVecBPjpdwtKt+TwuWDLeChQ9teUX/ij 8tf1ggZg7Li2ylHjl+olJeCclhRu8Qg= X-Google-Smtp-Source: ABdhPJyO7zYu3m0b7y88H5rllandvCRWpCy1lfZO405k0oMRHbkQC55eo9DKVD80VV6E6amQeCwCWg== X-Received: by 2002:a37:bca:: with SMTP id 193mr14100255qkl.120.1627876057211; Sun, 01 Aug 2021 20:47:37 -0700 (PDT) Received: from spectre.mavhome.dp.ua (104-55-12-234.lightspeed.knvltn.sbcglobal.net. [104.55.12.234]) by smtp.gmail.com with ESMTPSA id w5sm4061675qtv.3.2021.08.01.20.47.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 01 Aug 2021 20:47:36 -0700 (PDT) Sender: Alexander Motin Subject: Re: git: 8bb173fb5bc3 - main - sched_ule(4): Use trylock when stealing load. To: Mateusz Guzik Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org References: <202108020258.1722walG094152@gitrepo.freebsd.org> From: Alexander Motin Message-ID: <443ba55d-aff1-1f36-e3e7-00df95f4abdc@FreeBSD.org> Date: Sun, 1 Aug 2021 23:47:35 -0400 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4GdP8p3Fr2z4hXH 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 03:47:38 -0000 On 01.08.2021 23:43, Mateusz Guzik wrote: > Mostly related, I just had a look at the code and noticed: > > static uint32_t > sched_random(void) > { > uint32_t *rndptr; > > rndptr = DPCPU_PTR(randomval); > *rndptr = *rndptr * 69069 + 5; > > return (*rndptr >> 16); > } > > Except randomval starts at 0 for all CPUs. Should be easy to pre-init > with an actual random value. Is that something you played with? It is pretty old code, so no, at least not this time. But I doubt it would make a any difference, since different CPUs should have different number of calls to this, so they should naturally run away from each-other. -- Alexander Motin From owner-dev-commits-src-all@freebsd.org Mon Aug 2 06:26:09 2021 Return-Path: Delivered-To: dev-commits-src-all@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 963FF66E4C5; Mon, 2 Aug 2021 06:26: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 4GdSgj3pnXz4tkk; Mon, 2 Aug 2021 06:26: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 6B1FB1AD09; Mon, 2 Aug 2021 06:26: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 1726Q9Co075624; Mon, 2 Aug 2021 06:26:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1726Q9CB075623; Mon, 2 Aug 2021 06:26:09 GMT (envelope-from git) Date: Mon, 2 Aug 2021 06:26:09 GMT Message-Id: <202108020626.1726Q9CB075623@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: 9340ebd404ef - main - Add missing file to sys/conf/files after 469884cf04a9b92677c7c83e229ca6b8814f8b0a . 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: 9340ebd404efad7068b5a45fd3b3d8bb21187b91 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 06:26:09 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=9340ebd404efad7068b5a45fd3b3d8bb21187b91 commit 9340ebd404efad7068b5a45fd3b3d8bb21187b91 Author: Hans Petter Selasky AuthorDate: 2021-08-02 06:24:22 +0000 Commit: Hans Petter Selasky CommitDate: 2021-08-02 06:25:04 +0000 Add missing file to sys/conf/files after 469884cf04a9b92677c7c83e229ca6b8814f8b0a . Found by: vishwin@ Differential Revision: https://reviews.freebsd.org/D29921 MFC after: 1 week Sponsored by: NVIDIA Networking --- sys/conf/files | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/conf/files b/sys/conf/files index ae3fd61ed7a1..44eda0e8bae6 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -4578,6 +4578,8 @@ compat/linuxkpi/common/src/linux_domain.c optional compat_linuxkpi \ compile-with "${LINUXKPI_C}" compat/linuxkpi/common/src/linux_firmware.c optional compat_linuxkpi \ compile-with "${LINUXKPI_C}" +compat/linuxkpi/common/src/linux_fpu.c optional compat_linuxkpi \ + compile-with "${LINUXKPI_C}" compat/linuxkpi/common/src/linux_hrtimer.c optional compat_linuxkpi \ compile-with "${LINUXKPI_C}" compat/linuxkpi/common/src/linux_kthread.c optional compat_linuxkpi \ From owner-dev-commits-src-all@freebsd.org Mon Aug 2 06:26:52 2021 Return-Path: Delivered-To: dev-commits-src-all@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 DBC6566E2C9; Mon, 2 Aug 2021 06:26:52 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [IPv6:2a01:4f8:c17:6c4b::2]) (using TLSv1.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 4GdShX4hZ4z4tl1; Mon, 2 Aug 2021 06:26:52 +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 2EC932600CB; Mon, 2 Aug 2021 08:26:44 +0200 (CEST) Subject: Re: git: 469884cf04a9 - main - LinuxKPI: Make FPU sections thread-safe and use the NOCTX flag. To: Charlie Li , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202107311338.16VDcaSh006994@gitrepo.freebsd.org> From: Hans Petter Selasky Message-ID: Date: Mon, 2 Aug 2021 08:26:33 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 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: 4GdShX4hZ4z4tl1 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 06:26:52 -0000 On 8/1/21 12:32 PM, Charlie Li wrote: > Hans Petter Selasky wrote: >> commit 469884cf04a9b92677c7c83e229ca6b8814f8b0a >> Author: Hans Petter Selasky >> AuthorDate: 2021-07-31 13:32:52 +0000 >> Commit: Hans Petter Selasky >> CommitDate: 2021-07-31 13:36:48 +0000 >> >> LinuxKPI: Make FPU sections thread-safe and use the NOCTX flag. >> >> Reviewed by: kib >> Submitted by: greg@unrelenting.technology >> Differential Revision: https://reviews.freebsd.org/D29921 >> MFC after: 1 week >> Sponsored by: NVIDIA Networking >> --- >> sys/compat/linuxkpi/common/include/asm/fpu/api.h | 40 ++++------------------ >> sys/compat/linuxkpi/common/include/linux/sched.h | 3 +- >> sys/compat/linuxkpi/common/src/linux_fpu.c | 43 ++++++++++++++++++------ >> sys/conf/files.amd64 | 3 -- >> sys/conf/files.arm64 | 4 --- >> sys/conf/files.i386 | 3 -- >> sys/modules/linuxkpi/Makefile | 3 +- >> 7 files changed, 43 insertions(+), 56 deletions(-) >> > i915kms from drm-kmod, while successfully built against the commit after > (__FreeBSD_version bump), fails to load on that same commit: > > link_elf_obj: symbol lkpi_kernel_fpu_begin undefined > linker_load_file: /boot/modules/i915kms.ko - unsupported file type > Should be fixed by: https://cgit.freebsd.org/src/commit/?id=9340ebd404efad7068b5a45fd3b3d8bb21187b91 --HPS From owner-dev-commits-src-all@freebsd.org Mon Aug 2 08:29:13 2021 Return-Path: Delivered-To: dev-commits-src-all@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 38F8D670611; Mon, 2 Aug 2021 08:29: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 4GdWPj0jBnz3HrM; Mon, 2 Aug 2021 08:29: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 EFD461C34E; Mon, 2 Aug 2021 08:29:12 +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 1728TCvm035109; Mon, 2 Aug 2021 08:29:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1728TCa1035108; Mon, 2 Aug 2021 08:29:12 GMT (envelope-from git) Date: Mon, 2 Aug 2021 08:29:12 GMT Message-Id: <202108020829.1728TCa1035108@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Xin LI Subject: git: f5536286dbc3 - stable/13 - less: upgrade to v590. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: delphij X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f5536286dbc34733322ee28d97ca3c0fda9a0839 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 08:29:13 -0000 The branch stable/13 has been updated by delphij: URL: https://cgit.FreeBSD.org/src/commit/?id=f5536286dbc34733322ee28d97ca3c0fda9a0839 commit f5536286dbc34733322ee28d97ca3c0fda9a0839 Author: Xin LI AuthorDate: 2021-07-18 05:20:44 +0000 Commit: Xin LI CommitDate: 2021-08-02 08:28:42 +0000 less: upgrade to v590. (cherry picked from commit 30a1828c5196c415c8afc0d50f9131885d0c6b43) (cherry picked from commit 4bcc6d14e23d1443a275fc3a494094274a2f8382) --- contrib/less/NEWS | 30 ++- contrib/less/README | 9 +- contrib/less/ch.c | 2 +- contrib/less/cmdbuf.c | 31 ++- contrib/less/command.c | 1 + contrib/less/decode.c | 93 +++++-- contrib/less/edit.c | 4 +- contrib/less/filename.c | 57 ++-- contrib/less/funcs.h | 12 +- contrib/less/help.c | 4 +- contrib/less/less.h | 1 + contrib/less/less.hlp | 2 + contrib/less/less.nro | 102 +++++--- contrib/less/lessecho.nro | 2 +- contrib/less/lesskey.c | 607 ++++--------------------------------------- contrib/less/lesskey.h | 24 ++ contrib/less/lesskey.nro | 51 ++-- contrib/less/lesskey_parse.c | 580 +++++++++++++++++++++++++++++++++++++++++ contrib/less/line.c | 85 +++--- contrib/less/linenum.c | 23 ++ contrib/less/optfunc.c | 61 ++++- contrib/less/opttbl.c | 23 +- contrib/less/output.c | 15 +- contrib/less/screen.c | 15 +- contrib/less/tags.c | 18 +- contrib/less/version.c | 15 +- contrib/less/xbuf.c | 52 ++++ contrib/less/xbuf.h | 15 ++ usr.bin/less/Makefile | 5 +- usr.bin/less/defines.h | 6 +- usr.bin/lesskey/Makefile | 2 +- 31 files changed, 1184 insertions(+), 763 deletions(-) diff --git a/contrib/less/NEWS b/contrib/less/NEWS index bc5afd655ddc..a403c5d8a875 100644 --- a/contrib/less/NEWS +++ b/contrib/less/NEWS @@ -3,8 +3,7 @@ ====================================================================== - For the latest news about less, see the "less" Web page: - https://greenwoodsoftware.com/less + For the latest news about less, see https://greenwoodsoftware.com/less You can also download the latest version of less from there. Report bugs, suggestions or comments at @@ -12,7 +11,32 @@ ====================================================================== - Major changes between "less" versions 563 and 581.2 + Major changes between "less" versions 581 and 590 + +* Make less able to read lesskey source files (deprecating lesskey). + +* If XDG_CONFIG_HOME is set, find lesskey source file + in $XDG_CONFIG_HOME/lesskey rather than $HOME/.lesskey. + +* If XDG_DATA_HOME is set, find and store history file + in $XDG_DATA_HOME/lesshst rather than $HOME/.lesshst. + +* Add the --lesskey-src option. + +* Add the --file-size option. + +* With -F, if screen is resized to make file fit on one screen, don't exit. + +* Fix bug which could leave terminal in mouse-reporting mode + after exiting less. + +* Fix bug which caused failure to respond to window resize. + +* Fix backslash bug searching in tag file. + +====================================================================== + + Major changes between "less" versions 563 and 581 * Change ESC-u command to toggle, not disable, highlighting per man page. diff --git a/contrib/less/README b/contrib/less/README index 2acbd00d762a..4a5aa62a44ee 100644 --- a/contrib/less/README +++ b/contrib/less/README @@ -7,9 +7,7 @@ ************************************************************************** ************************************************************************** - Less, version 581.2 - - This is the distribution of less, version 581.2, released 28 Apr 2021. + This is the source code distribution of "less". This program is part of the GNU project (http://www.gnu.org). This program is free software. You may redistribute it and/or @@ -27,6 +25,11 @@ ========================================================================= +You should build from a clone of a git repository +ONLY IF you are doing development on the less source itself. +If you are merely using less as a tool, you should download a release +from http://greenwoodsoftware.com and NOT from github. + The formatted manual page is in less.man. The manual page nroff source is in less.nro. Major changes made since the last posted version are in NEWS. diff --git a/contrib/less/ch.c b/contrib/less/ch.c index bab0692f7437..379dd84c41b8 100644 --- a/contrib/less/ch.c +++ b/contrib/less/ch.c @@ -860,7 +860,7 @@ ch_init(f, flags) * Allocate and initialize a new filestate. */ thisfile = (struct filestate *) - calloc(1, sizeof(struct filestate)); + ecalloc(1, sizeof(struct filestate)); thisfile->buflist.next = thisfile->buflist.prev = END_OF_CHAIN; thisfile->nbufs = 0; thisfile->flags = flags; diff --git a/contrib/less/cmdbuf.c b/contrib/less/cmdbuf.c index 9cc1f3e94977..dd135382aa11 100644 --- a/contrib/less/cmdbuf.c +++ b/contrib/less/cmdbuf.c @@ -1401,11 +1401,12 @@ mlist_size(ml) * Get the name of the history file. */ static char * -histfile_name(VOID_PARAM) +histfile_name(must_exist) + int must_exist; { char *home; + char *xdg; char *name; - int len; /* See if filename is explicitly specified by $LESSHISTFILE. */ name = lgetenv("LESSHISTFILE"); @@ -1421,19 +1422,25 @@ histfile_name(VOID_PARAM) if (strcmp(LESSHISTFILE, "") == 0 || strcmp(LESSHISTFILE, "-") == 0) return (NULL); - /* Otherwise, file is in $HOME. */ + /* Try in $XDG_DATA_HOME first, then in $HOME. */ + xdg = lgetenv("XDG_DATA_HOME"); home = lgetenv("HOME"); - if (isnullenv(home)) - { #if OS2 + if (isnullenv(home)) home = lgetenv("INIT"); - if (isnullenv(home)) #endif - return (NULL); + name = NULL; + if (!must_exist) + { + /* If we're writing the file and the file already exists, use it. */ + name = dirfile(xdg, &LESSHISTFILE[1], 1); + if (name == NULL) + name = dirfile(home, LESSHISTFILE, 1); } - len = (int) (strlen(home) + strlen(LESSHISTFILE) + 2); - name = (char *) ecalloc(len, sizeof(char)); - SNPRINTF2(name, len, "%s/%s", home, LESSHISTFILE); + if (name == NULL) + name = dirfile(xdg, &LESSHISTFILE[1], must_exist); + if (name == NULL) + name = dirfile(home, LESSHISTFILE, must_exist); return (name); } @@ -1454,7 +1461,7 @@ read_cmdhist2(action, uparam, skip_search, skip_shell) char *p; int *skip = NULL; - filename = histfile_name(); + filename = histfile_name(1); if (filename == NULL) return; f = fopen(filename, "r"); @@ -1700,7 +1707,7 @@ save_cmdhist(VOID_PARAM) if (!histfile_modified()) return; - histname = histfile_name(); + histname = histfile_name(0); if (histname == NULL) return; tempname = make_tempname(histname); diff --git a/contrib/less/command.c b/contrib/less/command.c index ae59181c2827..171788f2e750 100644 --- a/contrib/less/command.c +++ b/contrib/less/command.c @@ -797,6 +797,7 @@ prompt(VOID_PARAM) entire_file_displayed() && !(ch_getflags() & CH_HELPFILE) && next_ifile(curr_ifile) == NULL_IFILE) quit(QUIT_OK); + quit_if_one_screen = FALSE; /* only get one chance at this */ #if MSDOS_COMPILER==WIN32C /* diff --git a/contrib/less/decode.c b/contrib/less/decode.c index f3bfb7a8ead2..7e9b167bc786 100644 --- a/contrib/less/decode.c +++ b/contrib/less/decode.c @@ -339,21 +339,41 @@ init_cmds(VOID_PARAM) add_fcmd_table((char*)cmdtable, sizeof(cmdtable)); add_ecmd_table((char*)edittable, sizeof(edittable)); #if USERFILE +#ifdef BINDIR /* For backwards compatibility */ + /* Try to add tables in the OLD system lesskey file. */ + add_hometable(lesskey, NULL, BINDIR "/.sysless", 1); +#endif /* - * For backwards compatibility, - * try to add tables in the OLD system lesskey file. + * Try to load lesskey source file or binary file. + * If the source file succeeds, don't load binary file. + * The binary file is likely to have been generated from + * a (possibly out of date) copy of the src file, + * so loading it is at best redundant. */ -#ifdef BINDIR - add_hometable(NULL, BINDIR "/.sysless", 1); -#endif /* - * Try to add the tables in the system lesskey file. + * Try to add tables in system lesskey src file. */ - add_hometable("LESSKEY_SYSTEM", LESSKEYFILE_SYS, 1); +#if HAVE_LESSKEYSRC + if (add_hometable(lesskey_src, "LESSKEYIN_SYSTEM", LESSKEYINFILE_SYS, 1) != 0) +#endif + { + /* + * Try to add the tables in the system lesskey binary file. + */ + add_hometable(lesskey, "LESSKEY_SYSTEM", LESSKEYFILE_SYS, 1); + } /* - * Try to add the tables in the standard lesskey file "$HOME/.less". + * Try to add tables in the lesskey src file "$HOME/.lesskey". */ - add_hometable("LESSKEY", LESSKEYFILE, 0); +#if HAVE_LESSKEYSRC + if (add_hometable(lesskey_src, "LESSKEYIN", DEF_LESSKEYINFILE, 0) != 0) +#endif + { + /* + * Try to add the tables in the standard lesskey binary file "$HOME/.less". + */ + add_hometable(lesskey, "LESSKEY", LESSKEYFILE, 0); + } #endif } @@ -877,32 +897,63 @@ lesskey(filename, sysvar) return (new_lesskey(buf, (int)len, sysvar)); } +#if HAVE_LESSKEYSRC + public int +lesskey_src(filename, sysvar) + char *filename; + int sysvar; +{ + static struct lesskey_tables tables; + int r = parse_lesskey(filename, &tables); + if (r != 0) + return (r); + add_fcmd_table(tables.cmdtable.buf.data, tables.cmdtable.buf.end); + add_ecmd_table(tables.edittable.buf.data, tables.edittable.buf.end); + add_var_table(sysvar ? &list_sysvar_tables : &list_var_tables, + tables.vartable.buf.data, tables.vartable.buf.end); + return (0); +} + + void +lesskey_parse_error(s) + char *s; +{ + PARG parg; + parg.p_string = s; + error("%s", &parg); +} +#endif /* HAVE_LESSKEYSRC */ + /* - * Add the standard lesskey file "$HOME/.less" + * Add a lesskey file. */ - public void -add_hometable(envname, def_filename, sysvar) + public int +add_hometable(call_lesskey, envname, def_filename, sysvar) + int (*call_lesskey)(char *, int); char *envname; char *def_filename; int sysvar; { char *filename; - PARG parg; + int r; if (envname != NULL && (filename = lgetenv(envname)) != NULL) filename = save(filename); - else if (sysvar) + else if (sysvar) /* def_filename is full path */ filename = save(def_filename); - else - filename = homefile(def_filename); - if (filename == NULL) - return; - if (lesskey(filename, sysvar) < 0) + else /* def_filename is just basename */ { - parg.p_string = filename; - error("Cannot use lesskey file \"%s\"", &parg); + char *xdg = lgetenv("XDG_CONFIG_HOME"); + if (!isnullenv(xdg)) + filename = dirfile(xdg, def_filename+1, 1); + if (filename == NULL) + filename = homefile(def_filename); } + if (filename == NULL) + return -1; + r = (*call_lesskey)(filename, sysvar); free(filename); + return (r); } #endif diff --git a/contrib/less/edit.c b/contrib/less/edit.c index 12631dba6bac..529ed75b0afe 100644 --- a/contrib/less/edit.c +++ b/contrib/less/edit.c @@ -26,6 +26,7 @@ extern int force_open; extern int is_tty; extern int sigs; extern int hshift; +extern int want_filesize; extern IFILE curr_ifile; extern IFILE old_ifile; extern struct scrpos initial_scrpos; @@ -487,7 +488,8 @@ edit_ifile(ifile) cmd_addhist(ml_examine, qfilename, 1); free(qfilename); } - + if (want_filesize) + scan_eof(); } free(filename); return (0); diff --git a/contrib/less/filename.c b/contrib/less/filename.c index 177cb946364a..aba8d3a362e3 100644 --- a/contrib/less/filename.c +++ b/contrib/less/filename.c @@ -216,10 +216,11 @@ shell_quote(s) * Return a pathname that points to a specified file in a specified directory. * Return NULL if the file does not exist in the directory. */ - static char * -dirfile(dirname, filename) + public char * +dirfile(dirname, filename, must_exist) char *dirname; char *filename; + int must_exist; { char *pathname; int len; @@ -235,17 +236,20 @@ dirfile(dirname, filename) if (pathname == NULL) return (NULL); SNPRINTF3(pathname, len, "%s%s%s", dirname, PATHNAME_SEP, filename); - /* - * Make sure the file exists. - */ - f = open(pathname, OPEN_READ); - if (f < 0) + if (must_exist) { - free(pathname); - pathname = NULL; - } else - { - close(f); + /* + * Make sure the file exists. + */ + f = open(pathname, OPEN_READ); + if (f < 0) + { + free(pathname); + pathname = NULL; + } else + { + close(f); + } } return (pathname); } @@ -259,25 +263,19 @@ homefile(filename) { char *pathname; - /* - * Try $HOME/filename. - */ - pathname = dirfile(lgetenv("HOME"), filename); + /* Try $HOME/filename. */ + pathname = dirfile(lgetenv("HOME"), filename, 1); if (pathname != NULL) return (pathname); #if OS2 - /* - * Try $INIT/filename. - */ - pathname = dirfile(lgetenv("INIT"), filename); + /* Try $INIT/filename. */ + pathname = dirfile(lgetenv("INIT"), filename, 1); if (pathname != NULL) return (pathname); #endif #if MSDOS_COMPILER || OS2 - /* - * Look for the file anywhere on search path. - */ - pathname = (char *) calloc(_MAX_PATH, sizeof(char)); + /* Look for the file anywhere on search path. */ + pathname = (char *) ecalloc(_MAX_PATH, sizeof(char)); #if MSDOS_COMPILER==DJGPPC { char *res = searchpath(filename); @@ -517,6 +515,7 @@ seek_filesize(f) return ((POSITION) spos); } +#if HAVE_POPEN /* * Read a string from a file. * Return a pointer to the string in memory. @@ -560,10 +559,6 @@ readfd(fd) return (buf); } - - -#if HAVE_POPEN - /* * Execute a shell command. * Return a pointer to a pipe connected to the shell command's standard output. @@ -812,6 +807,7 @@ lrealpath(path) return (save(path)); } +#if HAVE_POPEN /* * Return number of %s escapes in a string. * Return a large number if there are any other % escapes besides %s. @@ -837,6 +833,7 @@ num_pct_s(lessopen) } return (num); } +#endif /* * See if we should open a "replacement file" @@ -953,10 +950,13 @@ open_altfile(filename, pf, pfd) cmd = readfd(fd); pclose(fd); if (*cmd == '\0') + { /* * Pipe is empty. This means there is no alt file. */ + free(cmd); return (NULL); + } return (cmd); #endif /* HAVE_POPEN */ } @@ -1122,4 +1122,3 @@ last_component(name) } return (name); } - diff --git a/contrib/less/funcs.h b/contrib/less/funcs.h index 12930356c938..330540ac2156 100644 --- a/contrib/less/funcs.h +++ b/contrib/less/funcs.h @@ -106,7 +106,8 @@ public int ecmd_decode LESSPARAMS ((char *cmd, char **sp)); public char * lgetenv LESSPARAMS ((char *var)); public int isnullenv LESSPARAMS ((char* s)); public int lesskey LESSPARAMS ((char *filename, int sysvar)); -public void add_hometable LESSPARAMS ((char *envname, char *def_filename, int sysvar)); +public int lesskey_src LESSPARAMS ((char *filename, int sysvar)); +public int add_hometable LESSPARAMS ((int (*call_lesskey)(char *, int), char *envname, char *def_filename, int sysvar)); public int editchar LESSPARAMS ((int c, int flags)); public void init_textlist LESSPARAMS ((struct textlist *tlist, char *str)); public char * forw_textlist LESSPARAMS ((struct textlist *tlist, char *prev)); @@ -129,6 +130,7 @@ public void use_logfile LESSPARAMS ((char *filename)); public char * shell_unquote LESSPARAMS ((char *str)); public char * get_meta_escape LESSPARAMS ((VOID_PARAM)); public char * shell_quote LESSPARAMS ((char *s)); +public char * dirfile LESSPARAMS ((char *dirname, char *filename, int must_exist)); public char * homefile LESSPARAMS ((char *filename)); public char * fexpand LESSPARAMS ((char *s)); public char * fcomplete LESSPARAMS ((char *s)); @@ -213,6 +215,7 @@ public void add_lnum LESSPARAMS ((LINENUM linenum, POSITION pos)); public LINENUM find_linenum LESSPARAMS ((POSITION pos)); public POSITION find_pos LESSPARAMS ((LINENUM linenum)); public LINENUM currline LESSPARAMS ((int where)); +public void scan_eof LESSPARAMS ((VOID_PARAM)); public void lsystem LESSPARAMS ((char *cmd, char *donemsg)); public int pipe_mark LESSPARAMS ((int c, char *cmd)); public int pipe_data LESSPARAMS ((char *cmd, POSITION spos, POSITION epos)); @@ -235,6 +238,7 @@ public void calc_jump_sline LESSPARAMS ((VOID_PARAM)); public void opt_shift LESSPARAMS ((int type, char *s)); public void calc_shift_count LESSPARAMS ((VOID_PARAM)); public void opt_k LESSPARAMS ((int type, char *s)); +public void opt_ks LESSPARAMS ((int type, char *s)); public void opt_t LESSPARAMS ((int type, char *s)); public void opt__T LESSPARAMS ((int type, char *s)); public void opt_p LESSPARAMS ((int type, char *s)); @@ -251,6 +255,7 @@ public void opt_mousecap LESSPARAMS ((int type, char *s)); public void opt_wheel_lines LESSPARAMS ((int type, char *s)); public void opt_linenum_width LESSPARAMS ((int type, char *s)); public void opt_status_col_width LESSPARAMS ((int type, char *s)); +public void opt_filesize LESSPARAMS ((int type, char *s)); public void opt_ttyin_name LESSPARAMS ((int type, char *s)); public void opt_rstat LESSPARAMS ((int type, char *s)); public int get_swindow LESSPARAMS ((VOID_PARAM)); @@ -280,6 +285,7 @@ public void put_line LESSPARAMS ((VOID_PARAM)); public void flush LESSPARAMS ((VOID_PARAM)); public void set_output LESSPARAMS ((int fd)); public int putchr LESSPARAMS ((int c)); +public void clear_bot_if_needed LESSPARAMS ((VOID_PARAM)); public void putstr LESSPARAMS ((constant char *s)); public int less_printf LESSPARAMS ((char *fmt, PARG *parg)); public void get_return LESSPARAMS ((VOID_PARAM)); @@ -342,3 +348,7 @@ public void close_getchr LESSPARAMS ((VOID_PARAM)); public int default_wheel_lines LESSPARAMS ((VOID_PARAM)); public void rstat LESSPARAMS ((char st)); public int getchr LESSPARAMS ((VOID_PARAM)); +public void xbuf_init LESSPARAMS ((struct xbuffer *xbuf)); +public void xbuf_deinit LESSPARAMS ((struct xbuffer *xbuf)); +public void xbuf_reset LESSPARAMS ((struct xbuffer *xbuf)); +public void xbuf_add LESSPARAMS ((struct xbuffer *xbuf, char ch)); diff --git a/contrib/less/help.c b/contrib/less/help.c index f5b4aa1fbf1a..9dabd43ca221 100644 --- a/contrib/less/help.c +++ b/contrib/less/help.c @@ -1,4 +1,4 @@ -/* This file was generated by mkhelp.pl from less.hlp at 14:59 on 2021/4/28 */ +/* This file was generated by mkhelp.pl from less.hlp at 17:45 on 2021/6/3 */ #include "less.h" constant char helpdata[] = { '\n', @@ -208,6 +208,8 @@ constant char helpdata[] = { ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','D','o','n','\'','t',' ','d','i','s','p','l','a','y',' ','t','i','l','d','e','s',' ','a','f','t','e','r',' ','e','n','d',' ','o','f',' ','f','i','l','e','.','\n', ' ',' ','-','#',' ','[','_','\b','N',']',' ',' ','.','.','.','.',' ',' ','-','-','s','h','i','f','t','=','[','_','\b','N',']','\n', ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','S','e','t',' ','h','o','r','i','z','o','n','t','a','l',' ','s','c','r','o','l','l',' ','a','m','o','u','n','t',' ','(','0',' ','=',' ','o','n','e',' ','h','a','l','f',' ','s','c','r','e','e','n',' ','w','i','d','t','h',')','.','\n', +' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','-','-','f','i','l','e','-','s','i','z','e','\n', +' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','A','u','t','o','m','a','t','i','c','a','l','l','y',' ','d','e','t','e','r','m','i','n','e',' ','t','h','e',' ','s','i','z','e',' ','o','f',' ','t','h','e',' ','i','n','p','u','t',' ','f','i','l','e','.','\n', ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','-','-','f','o','l','l','o','w','-','n','a','m','e','\n', ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','T','h','e',' ','F',' ','c','o','m','m','a','n','d',' ','c','h','a','n','g','e','s',' ','f','i','l','e','s',' ','i','f',' ','t','h','e',' ','i','n','p','u','t',' ','f','i','l','e',' ','i','s',' ','r','e','n','a','m','e','d','.','\n', ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','-','-','i','n','c','s','e','a','r','c','h','\n', diff --git a/contrib/less/less.h b/contrib/less/less.h index 4751976bac18..83e31514be3e 100644 --- a/contrib/less/less.h +++ b/contrib/less/less.h @@ -571,6 +571,7 @@ struct loption; struct hilite_tree; struct ansi_state; #include "pattern.h" +#include "xbuf.h" #include "funcs.h" /* Functions not included in funcs.h */ diff --git a/contrib/less/less.hlp b/contrib/less/less.hlp index 1e1ebf447711..333a0b576c5e 100644 --- a/contrib/less/less.hlp +++ b/contrib/less/less.hlp @@ -205,6 +205,8 @@ Don't display tildes after end of file. -# [_N] .... --shift=[_N] Set horizontal scroll amount (0 = one half screen width). + --file-size + Automatically determine the size of the input file. --follow-name The F command changes files if the input file is renamed. --incsearch diff --git a/contrib/less/less.nro b/contrib/less/less.nro index f148ccb76d98..7c8372b500c6 100644 --- a/contrib/less/less.nro +++ b/contrib/less/less.nro @@ -1,5 +1,5 @@ '\" t -.TH LESS 1 "Version 581.2: 28 Apr 2021" +.TH LESS 1 "Version 590: 03 Jun 2021" .SH NAME less \- opposite of more .SH SYNOPSIS @@ -759,13 +759,38 @@ Causes .I less to open and interpret the named file as a .IR lesskey (1) -file. +binary file. Multiple \-k options may be specified. If the LESSKEY or LESSKEY_SYSTEM environment variable is set, or if a lesskey file is found in a standard place (see KEY BINDINGS), it is also used as a .I lesskey file. +.IP "\-\-lesskey-src=\fIfilename\fP" +Causes +.I less +to open and interpret the named file as a +.IR lesskey (1) +source file. +If the LESSKEYIN or LESSKEYIN_SYSTEM environment variable is set, or +if a lesskey source file is found in a standard place (see KEY BINDINGS), +it is also used as a +.I "lesskey source" +file. +Prior to version 582, the +.I lesskey +program needed to be run to convert a +.I "lesskey source" +file to a +.I "lesskey binary" +file for +.I less +to use. +Newer versions of +.I less +read the +.I "lesskey source" +file directly and ignore the binary file if the source file exists. .IP "\-K or \-\-quit-on-intr" Causes .I less @@ -1054,6 +1079,12 @@ If the number is specified as a fraction, the actual number of scroll positions is recalculated if the terminal window is resized, so that the actual scroll remains at the specified fraction of the screen width. +.IP "\-\-file-size" +If \-\-file-size is specified, +.I less +will determine the size of the file +immediately after opening the file. +Normally this is not done, because it can be slow if the input file is large. .IP "\-\-follow-name" Normally, if the input file is renamed while an F command is executing, .I less @@ -1222,57 +1253,61 @@ Delete the entire command line and return to the main prompt. .SH "KEY BINDINGS" You may define your own .I less -commands by using the program -.IR lesskey (1) -to create a lesskey file. +commands by creating a lesskey source file. This file specifies a set of command keys and an action associated with each key. -You may also use -.I lesskey -to change the line-editing keys (see LINE EDITING), +You may also change the line-editing keys (see LINE EDITING), and to set environment variables. -If the environment variable LESSKEY is set, +If the environment variable LESSKEYIN is set, .I less -uses that as the name of the lesskey file. +uses that as the name of the lesskey source file. Otherwise, .I less -looks in a standard place for the lesskey file: +looks in a standard place for the lesskey source file: On Unix systems, .I less -looks for a lesskey file called "$HOME/.less". +looks for a lesskey file called "$XDG_CONFIG_HOME/lesskey" or "$HOME/.lesskey". On MS-DOS and Windows systems, .I less -looks for a lesskey file called "$HOME/_less", and if it is not found there, -then looks for a lesskey file called "_less" in any directory specified +looks for a lesskey file called "$HOME/_lesskey", and if it is not found there, +then looks for a lesskey file called "_lesskey" in any directory specified in the PATH environment variable. On OS/2 systems, .I less -looks for a lesskey file called "$HOME/less.ini", and if it is not found, -then looks for a lesskey file called "less.ini" in any directory specified +looks for a lesskey file called "$HOME/lesskey.ini", and if it is not found, +then looks for a lesskey file called "lesskey.ini" in any directory specified in the INIT environment variable, and if it not found there, -then looks for a lesskey file called "less.ini" in any directory specified +then looks for a lesskey file called "lesskey.ini" in any directory specified in the PATH environment variable. See the .I lesskey manual page for more details. -.P -A system-wide lesskey file may also be set up to provide key bindings. +.PP +A system-wide lesskey source file may also be set up to provide key bindings. If a key is defined in both a local lesskey file and in the system-wide file, key bindings in the local file take precedence over those in the system-wide file. -If the environment variable LESSKEY_SYSTEM is set, +If the environment variable LESSKEYIN_SYSTEM is set, .I less uses that as the name of the system-wide lesskey file. Otherwise, .I less looks in a standard place for the system-wide lesskey file: -On Unix systems, the system-wide lesskey file is /usr/local/etc/sysless. +On Unix systems, the system-wide lesskey file is /usr/local/etc/syslesskey. (However, if .I less was built with a different sysconf directory than /usr/local/etc, that directory is where the sysless file is found.) -On MS-DOS and Windows systems, the system-wide lesskey file is c:\e_sysless. -On OS/2 systems, the system-wide lesskey file is c:\esysless.ini. +On MS-DOS and Windows systems, the system-wide lesskey file is c:\e_syslesskey. +On OS/2 systems, the system-wide lesskey file is c:\esyslesskey.ini. +.PP +Previous versions of +.I less +(before v582) used lesskey files with a binary format, produced by the +.I lesskey +program. It is no longer necessary to use the +.I lesskey +program. . .SH "INPUT PREPROCESSOR" You may define an "input preprocessor" for @@ -1890,20 +1925,29 @@ Name of the history file used to remember search commands and shell commands between invocations of .IR less . If set to "\-" or "/dev/null", a history file is not used. -The default is "$HOME/.lesshst" on Unix systems, "$HOME/_lesshst" on -DOS and Windows systems, or "$HOME/lesshst.ini" or "$INIT/lesshst.ini" +The default is "$XDG_DATA_HOME/lesshst" or "$HOME/.lesshst" on Unix systems, +"$HOME/_lesshst" on DOS and Windows systems, +or "$HOME/lesshst.ini" or "$INIT/lesshst.ini" on OS/2 systems. .IP LESSHISTSIZE The maximum number of commands to save in the history file. The default is 100. +.IP LESSKEYIN +Name of the default +.I "lesskey source" +file. .IP LESSKEY Name of the default -.IR lesskey (1) +.I "lesskey binary" +file. (Not used if "$LESSKEYIN" exists.) +.IP LESSKEYIN_SYSTEM +Name of the default system-wide +.I "lesskey source" file. .IP LESSKEY_SYSTEM Name of the default system-wide -.IR lesskey (1) -file. +.I "lesskey binary" +file. (Not used if "$LESSKEYIN_SYSTEM" exists.) .IP LESSMETACHARS List of characters which are considered "metacharacters" by the shell. .IP LESSMETAESCAPE @@ -1981,4 +2025,4 @@ Report bugs at https://github.com/gwsw/less/issues. .br For more information, see the less homepage at .br -https://greenwoodsoftware.com/less. +https://greenwoodsoftware.com/less diff --git a/contrib/less/lessecho.nro b/contrib/less/lessecho.nro index 484efa135d34..4733a93edd68 100644 --- a/contrib/less/lessecho.nro +++ b/contrib/less/lessecho.nro @@ -1,4 +1,4 @@ -.TH LESSECHO 1 "Version 581.2: 28 Apr 2021" +.TH LESSECHO 1 "Version 590: 03 Jun 2021" .SH NAME lessecho \- expand metacharacters .SH SYNOPSIS diff --git a/contrib/less/lesskey.c b/contrib/less/lesskey.c index de7a9bfc8311..b5130cccb8f7 100644 --- a/contrib/less/lesskey.c +++ b/contrib/less/lesskey.c @@ -80,121 +80,12 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include "less.h" +#include +#include +#include #include "lesskey.h" #include "cmd.h" - -struct cmdname -{ - char *cn_name; - int cn_action; -}; - -struct cmdname cmdnames[] = -{ - { "back-bracket", A_B_BRACKET }, - { "back-line", A_B_LINE }, - { "back-line-force", A_BF_LINE }, - { "back-screen", A_B_SCREEN }, - { "back-scroll", A_B_SCROLL }, - { "back-search", A_B_SEARCH }, - { "back-window", A_B_WINDOW }, - { "clear-mark", A_CLRMARK }, - { "debug", A_DEBUG }, - { "digit", A_DIGIT }, - { "display-flag", A_DISP_OPTION }, - { "display-option", A_DISP_OPTION }, - { "end", A_GOEND }, - { "end-scroll", A_RRSHIFT }, - { "examine", A_EXAMINE }, - { "filter", A_FILTER }, - { "first-cmd", A_FIRSTCMD }, - { "firstcmd", A_FIRSTCMD }, - { "flush-repaint", A_FREPAINT }, - { "forw-bracket", A_F_BRACKET }, - { "forw-forever", A_F_FOREVER }, - { "forw-until-hilite", A_F_UNTIL_HILITE }, - { "forw-line", A_F_LINE }, - { "forw-line-force", A_FF_LINE }, - { "forw-screen", A_F_SCREEN }, - { "forw-screen-force", A_FF_SCREEN }, - { "forw-scroll", A_F_SCROLL }, - { "forw-search", A_F_SEARCH }, - { "forw-window", A_F_WINDOW }, - { "goto-end", A_GOEND }, - { "goto-end-buffered", A_GOEND_BUF }, - { "goto-line", A_GOLINE }, - { "goto-mark", A_GOMARK }, - { "help", A_HELP }, - { "index-file", A_INDEX_FILE }, - { "invalid", A_UINVALID }, - { "left-scroll", A_LSHIFT }, - { "next-file", A_NEXT_FILE }, - { "next-tag", A_NEXT_TAG }, - { "noaction", A_NOACTION }, - { "no-scroll", A_LLSHIFT }, - { "percent", A_PERCENT }, - { "pipe", A_PIPE }, - { "prev-file", A_PREV_FILE }, - { "prev-tag", A_PREV_TAG }, - { "quit", A_QUIT }, - { "remove-file", A_REMOVE_FILE }, - { "repaint", A_REPAINT }, - { "repaint-flush", A_FREPAINT }, - { "repeat-search", A_AGAIN_SEARCH }, - { "repeat-search-all", A_T_AGAIN_SEARCH }, - { "reverse-search", A_REVERSE_SEARCH }, - { "reverse-search-all", A_T_REVERSE_SEARCH }, - { "right-scroll", A_RSHIFT }, - { "set-mark", A_SETMARK }, - { "set-mark-bottom", A_SETMARKBOT }, - { "shell", A_SHELL }, - { "status", A_STAT }, - { "toggle-flag", A_OPT_TOGGLE }, - { "toggle-option", A_OPT_TOGGLE }, - { "undo-hilite", A_UNDO_SEARCH }, - { "clear-search", A_CLR_SEARCH }, - { "version", A_VERSION }, - { "visual", A_VISUAL }, - { NULL, 0 } -}; - -struct cmdname editnames[] = -{ - { "back-complete", EC_B_COMPLETE }, - { "backspace", EC_BACKSPACE }, - { "delete", EC_DELETE }, - { "down", EC_DOWN }, - { "end", EC_END }, - { "expand", EC_EXPAND }, - { "forw-complete", EC_F_COMPLETE }, - { "home", EC_HOME }, - { "insert", EC_INSERT }, - { "invalid", EC_UINVALID }, - { "kill-line", EC_LINEKILL }, - { "abort", EC_ABORT }, - { "left", EC_LEFT }, - { "literal", EC_LITERAL }, - { "right", EC_RIGHT }, - { "up", EC_UP }, - { "word-backspace", EC_W_BACKSPACE }, - { "word-delete", EC_W_DELETE }, - { "word-left", EC_W_LEFT }, - { "word-right", EC_W_RIGHT }, - { NULL, 0 } -}; - -struct table -{ - struct cmdname *names; - char *pbuffer; - char buffer[MAX_USERCMD]; -}; - -struct table cmdtable; -struct table edittable; -struct table vartable; -struct table *currtable = &cmdtable; +#include "defines.h" char fileheader[] = { C0_LESSKEY_MAGIC, @@ -215,26 +106,44 @@ char endsection[1] = { END_SECTION }; char *infile = NULL; char *outfile = NULL ; -int linenum; -int errors; - extern char version[]; - void -usage(VOID_PARAM) + static void +usage(void) { fprintf(stderr, "usage: lesskey [-o output] [input]\n"); exit(1); } - char * + void +lesskey_parse_error(s) + char *s; +{ + fprintf(stderr, "%s\n", s); +} + + void * +ecalloc(count, size) + int count; + unsigned int size; +{ + void *p; + + p = calloc(count, size); + if (p != NULL) + return (p); + fprintf(stderr, "lesskey: cannot allocate %d bytes of memory\n", count*size); + exit(1); +} + + static char * mkpathname(dirname, filename) char *dirname; char *filename; { char *pathname; *** 1959 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Mon Aug 2 09:32:55 2021 Return-Path: Delivered-To: dev-commits-src-all@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 EBEF967151A; Mon, 2 Aug 2021 09:32: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 4GdXqC63h2z3PNv; Mon, 2 Aug 2021 09:32: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 B82DF1D58F; Mon, 2 Aug 2021 09:32: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 1729WtiX027663; Mon, 2 Aug 2021 09:32:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1729WtwJ027662; Mon, 2 Aug 2021 09:32:55 GMT (envelope-from git) Date: Mon, 2 Aug 2021 09:32:55 GMT Message-Id: <202108020932.1729WtwJ027662@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?Q?Roger Pau Monn=C3=A9?= Subject: git: 82bf6a2566ba - main - xen/timer: fix amd64 LINT kernel build MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: royger X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 82bf6a2566ba51f2516c16aa7cca6398972c3123 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 09:32:56 -0000 The branch main has been updated by royger: URL: https://cgit.FreeBSD.org/src/commit/?id=82bf6a2566ba51f2516c16aa7cca6398972c3123 commit 82bf6a2566ba51f2516c16aa7cca6398972c3123 Author: Roger Pau Monné AuthorDate: 2021-08-02 08:22:22 +0000 Commit: Roger Pau Monné CommitDate: 2021-08-02 08:33:35 +0000 xen/timer: fix amd64 LINT kernel build On amd64 XENHVM depends on the xentimer device for PVH early startup, so both should be added or removed together (like the current dependency with xenpci). Fix this by adding xentimer to NOTES and updating the comments on the config files. Note that on i386 there's no such dependency between xentimer and XENHVM, since there's no PVH support. While there also fix the MINIMAL i386 build to include the xentimer, so it keeps the same functionality as before xentimer was split from XENHVM. Reported by: lwhsu PR: 257549 Fixes: ae5981274815 ('xen/timer: make xen timer optional') --- sys/amd64/conf/GENERIC | 4 ++-- sys/amd64/conf/MINIMAL | 4 +++- sys/amd64/conf/NOTES | 1 + sys/i386/conf/MINIMAL | 1 + 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/sys/amd64/conf/GENERIC b/sys/amd64/conf/GENERIC index fa531e13a3b9..f7b41919575d 100644 --- a/sys/amd64/conf/GENERIC +++ b/sys/amd64/conf/GENERIC @@ -380,8 +380,8 @@ device virtio_balloon # VirtIO Memory Balloon device device hyperv # HyperV drivers # Xen HVM Guest Optimizations -# NOTE: XENHVM and xenpci interdepend. They must be added or removed -# together. xentimer depends on XENHVM and isn't required. +# NOTE: XENHVM depends on xenpci and xentimer. +# They must be added or removed together. options XENHVM # Xen HVM kernel infrastructure device xenpci # Xen HVM Hypervisor services driver device xentimer # Xen x86 PV timer device diff --git a/sys/amd64/conf/MINIMAL b/sys/amd64/conf/MINIMAL index 6678f0a7ee63..14f91e6c8eaf 100644 --- a/sys/amd64/conf/MINIMAL +++ b/sys/amd64/conf/MINIMAL @@ -132,9 +132,11 @@ device ether # Ethernet support device bpf # Berkeley packet filter # Xen HVM Guest Optimizations -# NOTE: XENHVM depends on xenpci. They must be added or removed together. +# NOTE: XENHVM depends on xenpci and xentimer. +# They must be added or removed together. options XENHVM # Xen HVM kernel infrastructure device xenpci # Xen HVM Hypervisor services driver +device xentimer # Xen x86 PV timer device # evdev interface options EVDEV_SUPPORT # evdev support in legacy drivers diff --git a/sys/amd64/conf/NOTES b/sys/amd64/conf/NOTES index f5bdf15ebb08..501ceaedb222 100644 --- a/sys/amd64/conf/NOTES +++ b/sys/amd64/conf/NOTES @@ -504,6 +504,7 @@ device hyperv # HyperV drivers # Xen HVM Guest Optimizations options XENHVM # Xen HVM kernel infrastructure device xenpci # Xen HVM Hypervisor services driver +device xentimer # Xen x86 PV timer device ##################################################################### diff --git a/sys/i386/conf/MINIMAL b/sys/i386/conf/MINIMAL index f80c5cf40b48..37b8e074ac65 100644 --- a/sys/i386/conf/MINIMAL +++ b/sys/i386/conf/MINIMAL @@ -149,6 +149,7 @@ device bpf # Berkeley packet filter # NOTE: XENHVM depends on xenpci. They must be added or removed together. options XENHVM # Xen HVM kernel infrastructure device xenpci # Xen HVM Hypervisor services driver +device xentimer # Xen x86 PV timer device # evdev interface options EVDEV_SUPPORT # evdev support in legacy drivers From owner-dev-commits-src-all@freebsd.org Mon Aug 2 09:58:35 2021 Return-Path: Delivered-To: dev-commits-src-all@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 80407671A63; Mon, 2 Aug 2021 09:58: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 4GdYNq3Bckz3h0C; Mon, 2 Aug 2021 09:58: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 551B21DA91; Mon, 2 Aug 2021 09:58: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 1729wZ9w055120; Mon, 2 Aug 2021 09:58:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1729wZqj055119; Mon, 2 Aug 2021 09:58:35 GMT (envelope-from git) Date: Mon, 2 Aug 2021 09:58:35 GMT Message-Id: <202108020958.1729wZqj055119@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ka Ho Ng Subject: git: df95cc76affb - main - vmm: Bump vmname buffer in struct vm to VM_MAX_NAMELEN + 1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: khng X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: df95cc76affbbf114c9ff2e4ee011b6f162aa8bd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 09:58:35 -0000 The branch main has been updated by khng: URL: https://cgit.FreeBSD.org/src/commit/?id=df95cc76affbbf114c9ff2e4ee011b6f162aa8bd commit df95cc76affbbf114c9ff2e4ee011b6f162aa8bd Author: Ka Ho Ng AuthorDate: 2021-08-02 09:54:40 +0000 Commit: Ka Ho Ng CommitDate: 2021-08-02 09:55:08 +0000 vmm: Bump vmname buffer in struct vm to VM_MAX_NAMELEN + 1 In hw.vmm.create sysctl handler the maximum length of vm name is VM_MAX_NAMELEN. However in vm_create() the maximum length allowed is only VM_MAX_NAMELEN - 1 chars. Bump the length of the internal buffer to allow the length of VM_MAX_NAMELEN for vm name. MFC after: 3 days Reviewed by: grehan Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31372 --- sys/amd64/vmm/vmm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/amd64/vmm/vmm.c b/sys/amd64/vmm/vmm.c index 5c2a404f45a7..80fcde8d80fa 100644 --- a/sys/amd64/vmm/vmm.c +++ b/sys/amd64/vmm/vmm.c @@ -174,7 +174,7 @@ struct vm { struct mem_map mem_maps[VM_MAX_MEMMAPS]; /* (i) guest address space */ struct mem_seg mem_segs[VM_MAX_MEMSEGS]; /* (o) guest memory regions */ struct vmspace *vmspace; /* (o) guest's address space */ - char name[VM_MAX_NAMELEN]; /* (o) virtual machine name */ + char name[VM_MAX_NAMELEN+1]; /* (o) virtual machine name */ struct vcpu vcpu[VM_MAXCPU]; /* (i) guest vcpus */ /* The following describe the vm cpu topology */ uint16_t sockets; /* (o) num of sockets */ @@ -480,7 +480,8 @@ vm_create(const char *name, struct vm **retvm) if (!vmm_initialized) return (ENXIO); - if (name == NULL || strlen(name) >= VM_MAX_NAMELEN) + if (name == NULL || strnlen(name, VM_MAX_NAMELEN + 1) == + VM_MAX_NAMELEN + 1) return (EINVAL); vmspace = vmmops_vmspace_alloc(0, VM_MAXUSER_ADDRESS_LA48); From owner-dev-commits-src-all@freebsd.org Mon Aug 2 11:11:57 2021 Return-Path: Delivered-To: dev-commits-src-all@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 6D1F367289E; Mon, 2 Aug 2021 11:11: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 4Gdb1T2YDvz3lJW; Mon, 2 Aug 2021 11:11: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 3FEC21E675; Mon, 2 Aug 2021 11:11: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 172BBvSE060972; Mon, 2 Aug 2021 11:11:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 172BBvgt060971; Mon, 2 Aug 2021 11:11:57 GMT (envelope-from git) Date: Mon, 2 Aug 2021 11:11:57 GMT Message-Id: <202108021111.172BBvgt060971@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Aleksandr Rybalko Subject: git: aed2afeb51e4 - main - Ignore ResourceProducer flag for: o Arm CoreLink TM CMN-600 Coherent Mesh Network controller, o Arm CoreLink DMC-620 Dynamic Memory Controller. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ray X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: aed2afeb51e474628d508cc4c6dea223b78b9789 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 11:11:57 -0000 The branch main has been updated by ray: URL: https://cgit.FreeBSD.org/src/commit/?id=aed2afeb51e474628d508cc4c6dea223b78b9789 commit aed2afeb51e474628d508cc4c6dea223b78b9789 Author: Aleksandr Rybalko AuthorDate: 2021-08-02 10:41:14 +0000 Commit: Aleksandr Rybalko CommitDate: 2021-08-02 11:11:20 +0000 Ignore ResourceProducer flag for: o Arm CoreLink TM CMN-600 Coherent Mesh Network controller, o Arm CoreLink DMC-620 Dynamic Memory Controller. Sponsored by: Ampere Computing LLC Submitted by: Klara Inc. --- sys/dev/acpica/acpi_resource.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/dev/acpica/acpi_resource.c b/sys/dev/acpica/acpi_resource.c index 2e813276af8f..d7945f03e402 100644 --- a/sys/dev/acpica/acpi_resource.c +++ b/sys/dev/acpica/acpi_resource.c @@ -511,10 +511,12 @@ acpi_parse_resources(device_t dev, ACPI_HANDLE handle, */ if (acpi_MatchHid(handle, "ARMHC500") != ACPI_MATCHHID_NOMATCH || acpi_MatchHid(handle, "ARMHC502") != ACPI_MATCHHID_NOMATCH || + acpi_MatchHid(handle, "ARMHC600") != ACPI_MATCHHID_NOMATCH || acpi_MatchHid(handle, "ARMHC979") != ACPI_MATCHHID_NOMATCH || acpi_MatchHid(handle, "ARMHC97C") != ACPI_MATCHHID_NOMATCH || acpi_MatchHid(handle, "ARMHC98D") != ACPI_MATCHHID_NOMATCH || - acpi_MatchHid(handle, "ARMHC9FF") != ACPI_MATCHHID_NOMATCH) + acpi_MatchHid(handle, "ARMHC9FF") != ACPI_MATCHHID_NOMATCH || + acpi_MatchHid(handle, "ARMHD620") != ACPI_MATCHHID_NOMATCH) arc.ignore_producer_flag = true; status = AcpiWalkResources(handle, "_CRS", acpi_parse_resource, &arc); From owner-dev-commits-src-all@freebsd.org Mon Aug 2 12:18:47 2021 Return-Path: Delivered-To: dev-commits-src-all@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 E883A67370D; Mon, 2 Aug 2021 12:18: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 4GdcVb5LnRz3qCk; Mon, 2 Aug 2021 12:18: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 9F4201F62A; Mon, 2 Aug 2021 12:18: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 172CIlK5043769; Mon, 2 Aug 2021 12:18:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 172CIlql043768; Mon, 2 Aug 2021 12:18:47 GMT (envelope-from git) Date: Mon, 2 Aug 2021 12:18:47 GMT Message-Id: <202108021218.172CIlql043768@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Richard Scheffenegger Subject: git: e4ee2a39ade5 - stable/13 - tcp: Add PRR cwnd reduction for non-SACK loss MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rscheff X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: e4ee2a39ade5d6be38aed21f2fe1224c77f61af2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 12:18:48 -0000 The branch stable/13 has been updated by rscheff: URL: https://cgit.FreeBSD.org/src/commit/?id=e4ee2a39ade5d6be38aed21f2fe1224c77f61af2 commit e4ee2a39ade5d6be38aed21f2fe1224c77f61af2 Author: Richard Scheffenegger AuthorDate: 2021-06-19 17:06:48 +0000 Commit: Richard Scheffenegger CommitDate: 2021-08-02 11:59:23 +0000 tcp: Add PRR cwnd reduction for non-SACK loss This completes PRR cwnd reduction in all circumstances for the base TCP stack (SACK loss recovery, ECN window reduction, non-SACK loss recovery), preventing the arriving ACKs to clock out new data at the old, too high rate. This reduces the chance to induce additional losses while recovering from loss (during congested network conditions). For non-SACK loss recovery, each ACK is assumed to have one MSS delivered. In order to prevent ACK-split attacks, only one window worth of ACKs is considered to actually have delivered new data. MFC after: 6 weeks Reviewed By: rrs, #transport Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D29441 (cherry picked from commit 74d7fc8753a76851db6db556ff0f09de1fbb26d5) --- sys/netinet/tcp_input.c | 56 ++++++++++++++++++++++++++++++++++++------------- 1 file changed, 41 insertions(+), 15 deletions(-) diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index 6d86e43f07dd..f7ca4ce05200 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -2605,8 +2605,7 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, cc_ack_received(tp, th, nsegs, CC_DUPACK); if (V_tcp_do_prr && - IN_FASTRECOVERY(tp->t_flags) && - (tp->t_flags & TF_SACK_PERMIT)) { + IN_FASTRECOVERY(tp->t_flags)) { tcp_do_prr_ack(tp, th, &to); } else if ((tp->t_flags & TF_SACK_PERMIT) && (to.to_flags & TOF_SACK) && @@ -2682,8 +2681,16 @@ enter_recovery: * snd_ssthresh is already updated by * cc_cong_signal. */ - tp->sackhint.prr_delivered = - tp->sackhint.sacked_bytes; + if ((tp->t_flags & TF_SACK_PERMIT) && + (to.to_flags & TOF_SACK)) { + tp->sackhint.prr_delivered = + tp->sackhint.sacked_bytes; + } else { + tp->sackhint.prr_delivered = + imin(tp->snd_max - tp->snd_una, + imin(INT_MAX / 65536, + tp->t_dupacks) * maxseg); + } tp->sackhint.recover_fs = max(1, tp->snd_nxt - tp->snd_una); } @@ -3961,11 +3968,23 @@ tcp_do_prr_ack(struct tcpcb *tp, struct tcphdr *th, struct tcpopt *to) * (del_data) and an estimate of how many bytes are in the * network. */ - del_data = tp->sackhint.delivered_data; - if (V_tcp_do_rfc6675_pipe) - pipe = tcp_compute_pipe(tp); - else - pipe = (tp->snd_nxt - tp->snd_fack) + tp->sackhint.sack_bytes_rexmit; + if (((tp->t_flags & TF_SACK_PERMIT) && + (to->to_flags & TOF_SACK)) || + (IN_CONGRECOVERY(tp->t_flags) && + !IN_FASTRECOVERY(tp->t_flags))) { + del_data = tp->sackhint.delivered_data; + if (V_tcp_do_rfc6675_pipe) + pipe = tcp_compute_pipe(tp); + else + pipe = (tp->snd_nxt - tp->snd_fack) + + tp->sackhint.sack_bytes_rexmit; + } else { + if (tp->sackhint.prr_delivered < (tcprexmtthresh * maxseg + + tp->snd_recover - tp->snd_una)) + del_data = maxseg; + pipe = imax(0, tp->snd_max - tp->snd_una - + imin(INT_MAX / 65536, tp->t_dupacks) * maxseg); + } tp->sackhint.prr_delivered += del_data; /* * Proportional Rate Reduction @@ -3978,9 +3997,9 @@ tcp_do_prr_ack(struct tcpcb *tp, struct tcphdr *th, struct tcpopt *to) tp->snd_ssthresh, tp->sackhint.recover_fs) - tp->sackhint.prr_out; } else { - if (V_tcp_do_prr_conservative) + if (V_tcp_do_prr_conservative || (del_data == 0)) limit = tp->sackhint.prr_delivered - - tp->sackhint.prr_out; + tp->sackhint.prr_out; else limit = imax(tp->sackhint.prr_delivered - tp->sackhint.prr_out, del_data) + @@ -3994,11 +4013,18 @@ tcp_do_prr_ack(struct tcpcb *tp, struct tcphdr *th, struct tcpopt *to) * accordingly. */ if (IN_FASTRECOVERY(tp->t_flags)) { - tp->snd_cwnd = imax(maxseg, tp->snd_nxt - tp->snd_recover + - tp->sackhint.sack_bytes_rexmit + (snd_cnt * maxseg)); + if ((tp->t_flags & TF_SACK_PERMIT) && + (to->to_flags & TOF_SACK)) { + tp->snd_cwnd = tp->snd_nxt - tp->snd_recover + + tp->sackhint.sack_bytes_rexmit + + (snd_cnt * maxseg); + } else { + tp->snd_cwnd = (tp->snd_max - tp->snd_una) + + (snd_cnt * maxseg); + } } else if (IN_CONGRECOVERY(tp->t_flags)) - tp->snd_cwnd = imax(maxseg, pipe - del_data + - (snd_cnt * maxseg)); + tp->snd_cwnd = pipe - del_data + (snd_cnt * maxseg); + tp->snd_cwnd = imax(maxseg, tp->snd_cwnd); } /* From owner-dev-commits-src-all@freebsd.org Mon Aug 2 12:44:08 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C198B673F6F; Mon, 2 Aug 2021 12:44: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 4Gdd3r4z9Hz3sHC; Mon, 2 Aug 2021 12:44: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 929821F576; Mon, 2 Aug 2021 12:44: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 172Ci8Rh083051; Mon, 2 Aug 2021 12:44:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 172Ci84b083050; Mon, 2 Aug 2021 12:44:08 GMT (envelope-from git) Date: Mon, 2 Aug 2021 12:44:08 GMT Message-Id: <202108021244.172Ci84b083050@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Toomas Soome Subject: git: 1b1bb6f17880 - main - loader: tftp client should use server address from rootip MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tsoome X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1b1bb6f178802a4522824e0268634a99cdbda098 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 12:44:08 -0000 The branch main has been updated by tsoome: URL: https://cgit.FreeBSD.org/src/commit/?id=1b1bb6f178802a4522824e0268634a99cdbda098 commit 1b1bb6f178802a4522824e0268634a99cdbda098 Author: Toomas Soome AuthorDate: 2021-08-02 12:27:38 +0000 Commit: Toomas Soome CommitDate: 2021-08-02 12:43:54 +0000 loader: tftp client should use server address from rootip servip is set from bootp bp_siaddr (if present) and rootip is set immediately from servip in tha sane bootp code. However, the common/dev_net.c does only set rootip (based on url processing etc). Therefore, we should also use rootip in tftp reader. Fixes hung tftp based boot when bp_siaddr is not provided. MFC after: 1 week --- stand/libsa/tftp.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/stand/libsa/tftp.c b/stand/libsa/tftp.c index 3892f2aad86a..22e03ab58da1 100644 --- a/stand/libsa/tftp.c +++ b/stand/libsa/tftp.c @@ -38,7 +38,7 @@ __FBSDID("$FreeBSD$"); * Simple TFTP implementation for libsa. * Assumes: * - socket descriptor (int) at open_file->f_devdata - * - server host IP in global servip + * - server host IP in global rootip * Restrictions: * - read only * - lseek only with SEEK_SET or SEEK_CUR @@ -83,8 +83,6 @@ struct fs_ops tftp_fsops = { .fo_readdir = null_readdir }; -extern struct in_addr servip; - static int tftpport = 2000; static int is_open = 0; @@ -460,7 +458,7 @@ tftp_open(const char *path, struct open_file *f) return (EINVAL); } - io->destip = servip; + io->destip = rootip; tftpfile->off = 0; pathsize = (strlen(rootpath) + 1 + strlen(path) + 1) * sizeof(char); tftpfile->path = malloc(pathsize); From owner-dev-commits-src-all@freebsd.org Mon Aug 2 13:00:55 2021 Return-Path: Delivered-To: dev-commits-src-all@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 098C367401A; Mon, 2 Aug 2021 13:00: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 4GddRB6mNVz3tDp; Mon, 2 Aug 2021 13:00: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 D0B941FBDB; Mon, 2 Aug 2021 13:00: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 172D0sE3008645; Mon, 2 Aug 2021 13:00:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 172D0sIA008644; Mon, 2 Aug 2021 13:00:54 GMT (envelope-from git) Date: Mon, 2 Aug 2021 13:00:54 GMT Message-Id: <202108021300.172D0sIA008644@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Tom Jones Subject: git: a77a6a049e37 - stable/13 - inet6_option_space is deprecated, refer to inet6_opt_init instead MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: thj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a77a6a049e371e456b9ba6043717f814530a94ae Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 13:00:55 -0000 The branch stable/13 has been updated by thj: URL: https://cgit.FreeBSD.org/src/commit/?id=a77a6a049e371e456b9ba6043717f814530a94ae commit a77a6a049e371e456b9ba6043717f814530a94ae Author: Tom Jones AuthorDate: 2021-07-30 13:23:39 +0000 Commit: Tom Jones CommitDate: 2021-08-02 12:58:51 +0000 inet6_option_space is deprecated, refer to inet6_opt_init instead Reviewed by: bz, hrs MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D26273 (cherry picked from commit 0943200b1308bcf2e2b331f6aba514d64d74545f) --- share/man/man4/ip6.4 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/share/man/man4/ip6.4 b/share/man/man4/ip6.4 index 7b71aa23eae0..9c94b3def444 100644 --- a/share/man/man4/ip6.4 +++ b/share/man/man4/ip6.4 @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 1, 2018 +.Dd July 30, 2021 .Dt IP6 4 .Os .Sh NAME @@ -291,7 +291,7 @@ struct ip6_hbh { .Ed .Pp The -.Fn inet6_option_space +.Fn inet6_opt_init routine and family of routines may be used to manipulate this data. .Pp This option requires superuser privileges. @@ -311,7 +311,7 @@ struct ip6_dest { .Ed .Pp The -.Fn inet6_option_space +.Fn inet6_opt_init routine and family of routines may be used to manipulate this data. .Pp This option requires superuser privileges. @@ -345,7 +345,7 @@ struct ip6_rthdr { .Ed .Pp The -.Fn inet6_option_space +.Fn inet6_opt_init routine and family of routines may be used to manipulate this data. .Pp This option requires superuser privileges. From owner-dev-commits-src-all@freebsd.org Mon Aug 2 13:35:05 2021 Return-Path: Delivered-To: dev-commits-src-all@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 F2D066744A7; Mon, 2 Aug 2021 13:35: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 4GdfBc6KQ4z4RWd; Mon, 2 Aug 2021 13:35: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 C1C6A20903; Mon, 2 Aug 2021 13:35: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 172DZ48A050524; Mon, 2 Aug 2021 13:35:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 172DZ4hE050523; Mon, 2 Aug 2021 13:35:04 GMT (envelope-from git) Date: Mon, 2 Aug 2021 13:35:04 GMT Message-Id: <202108021335.172DZ4hE050523@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: 5f6c8ce2452d - main - tools/build: Don't redefine open() for the linux bootstrap 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: 5f6c8ce2452da2da233e37bf4c2b6fccde8594b1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 13:35:05 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=5f6c8ce2452da2da233e37bf4c2b6fccde8594b1 commit 5f6c8ce2452da2da233e37bf4c2b6fccde8594b1 Author: Alex Richardson AuthorDate: 2021-08-02 08:45:05 +0000 Commit: Alex Richardson CommitDate: 2021-08-02 13:33:23 +0000 tools/build: Don't redefine open() for the linux bootstrap This is needed to bootstrap llvm-tblgen on Linux since LLVM calls `::open(...)` which does not work if open is a statement macro. Also stop defining O_SHLOCK/O_EXLOCK and update the only bootstrap tools user of those flags to deal with missing definitions. Reviewed By: jrtc27 MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31226 --- lib/libc/db/db/db.c | 6 ++++++ tools/build/cross-build/include/linux/fcntl.h | 25 ++++--------------------- 2 files changed, 10 insertions(+), 21 deletions(-) diff --git a/lib/libc/db/db/db.c b/lib/libc/db/db/db.c index a9a5b060da62..7158cc80e44e 100644 --- a/lib/libc/db/db/db.c +++ b/lib/libc/db/db/db.c @@ -49,6 +49,12 @@ static int __dberr(void); #ifndef O_CLOEXEC #define O_CLOEXEC 0 #endif +#ifndef O_EXLOCK +#define O_EXLOCK 0 +#endif +#ifndef O_SHLOCK +#define O_SHLOCK 0 +#endif DB * dbopen(const char *fname, int flags, int mode, DBTYPE type, const void *openinfo) diff --git a/tools/build/cross-build/include/linux/fcntl.h b/tools/build/cross-build/include/linux/fcntl.h index 94662befddad..4fa169d4ed4c 100644 --- a/tools/build/cross-build/include/linux/fcntl.h +++ b/tools/build/cross-build/include/linux/fcntl.h @@ -1,7 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause * - * Copyright 2018-2020 Alex Richardson + * Copyright 2018-2021 Alex Richardson * * This software was developed by SRI International and the University of * Cambridge Computer Laboratory (Department of Computer Science and @@ -12,6 +12,9 @@ * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) * ("CTSRD"), as part of the DARPA CRASH research programme. * + * This work was supported by Innovate UK project 105694, "Digital Security by + * Design (DSbD) Technology Platform Prototype". + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -37,29 +40,9 @@ */ #pragma once - /* includes which contains a member __unused */ #include "__unused_workaround_start.h" #include_next #include "__unused_workaround_end.h" -#ifdef __unused_undefd -#undef __unused_undefd -#define __unused __attribute__((unused)) -#endif - #include - -#ifndef O_EXLOCK -#define O_EXLOCK (1 << 30) -#endif -#ifndef O_SHLOCK -#define O_SHLOCK (1 << 31) -#endif - -#undef open -#define open(path, flags, ...) ({ \ - int __fd = (open)(path, flags, ##__VA_ARGS__); \ - if (flags & O_EXLOCK) flock(__fd, LOCK_EX); \ - if (flags & O_SHLOCK) flock(__fd, LOCK_SH); \ - __fd; }) From owner-dev-commits-src-all@freebsd.org Mon Aug 2 13:35:06 2021 Return-Path: Delivered-To: dev-commits-src-all@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 64D3D674697; Mon, 2 Aug 2021 13:35: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 4GdfBf1bDRz4RQk; Mon, 2 Aug 2021 13:35: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 EEC7D20458; Mon, 2 Aug 2021 13:35: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 172DZ5G9050548; Mon, 2 Aug 2021 13:35:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 172DZ5xV050547; Mon, 2 Aug 2021 13:35:05 GMT (envelope-from git) Date: Mon, 2 Aug 2021 13:35:05 GMT Message-Id: <202108021335.172DZ5xV050547@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: 7bc797e3f380 - main - Add build system support for ASAN+UBSAN instrumentation 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: 7bc797e3f3807660cf98e5b1bd63545cafe820f8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 13:35:06 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=7bc797e3f3807660cf98e5b1bd63545cafe820f8 commit 7bc797e3f3807660cf98e5b1bd63545cafe820f8 Author: Alex Richardson AuthorDate: 2021-08-02 08:48:21 +0000 Commit: Alex Richardson CommitDate: 2021-08-02 13:33:24 +0000 Add build system support for ASAN+UBSAN instrumentation This adds two new options WITH_ASAN/WITH_UBSAN that can be set to enable instrumentation of all binaries with AddressSanitizer and/or UndefinedBehaviourSanitizer. This current patch is almost sufficient to get a complete buildworld with sanitizer instrumentation but in order to actually build and boot a system it depends on a few more follow-up commits. Reviewed By: brooks, kib, markj Differential Revision: https://reviews.freebsd.org/D31043 --- Makefile.inc1 | 12 ++++++++++++ Makefile.libcompat | 1 + lib/Makefile | 2 ++ lib/csu/Makefile.inc | 3 +++ lib/libclang_rt/Makefile.inc | 2 ++ lib/libgcc_eh/Makefile.inc | 8 ++++++++ lib/libgcc_s/Makefile | 3 +++ libexec/rtld-elf/Makefile | 3 +++ share/mk/bsd.README | 2 +- share/mk/bsd.compat.mk | 1 + share/mk/bsd.lib.mk | 8 ++++++-- share/mk/bsd.opts.mk | 4 +++- share/mk/bsd.prog.mk | 2 ++ share/mk/bsd.progs.mk | 2 +- share/mk/bsd.sanitizer.mk | 43 +++++++++++++++++++++++++++++++++++++++++++ share/mk/sys.mk | 2 +- 16 files changed, 92 insertions(+), 6 deletions(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index 213b32a97ed3..8fa55f5cea2e 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -718,6 +718,7 @@ BSARGS= DESTDIR= \ MK_HTML=no NO_LINT=yes MK_MAN=no MK_MAN_UTILS=yes \ -DNO_PIC MK_PROFILE=no -DNO_SHARED \ -DNO_CPU_CFLAGS MK_WERROR=no MK_CTF=no \ + MK_ASAN=no MK_UBSAN=no \ MK_CLANG_EXTRAS=no MK_CLANG_FORMAT=no MK_CLANG_FULL=no \ MK_LLDB=no MK_RETPOLINE=no MK_TESTS=no \ MK_INCLUDES=yes @@ -739,6 +740,7 @@ TMAKE= \ SSP_CFLAGS= \ -DNO_LINT \ -DNO_CPU_CFLAGS MK_WERROR=no MK_CTF=no \ + MK_ASAN=no MK_UBSAN=no \ MK_CLANG_EXTRAS=no MK_CLANG_FORMAT=no MK_CLANG_FULL=no \ MK_LLDB=no MK_RETPOLINE=no MK_TESTS=no @@ -2844,6 +2846,16 @@ _prereq_libs= lib/libcompiler_rt .if ${MK_SSP} != "no" _prereq_libs+= lib/libssp_nonshared .endif +.if ${MK_ASAN} != "no" +_prereq_libs+= lib/libclang_rt/asan +_prereq_libs+= lib/libclang_rt/asan-preinit +_prereq_libs+= lib/libclang_rt/asan_cxx +.endif +.if ${MK_UBSAN} != "no" +_prereq_libs+= lib/libclang_rt/ubsan_minimal +_prereq_libs+= lib/libclang_rt/ubsan_standalone +_prereq_libs+= lib/libclang_rt/ubsan_standalone_cxx +.endif # These dependencies are not automatically generated: # diff --git a/Makefile.libcompat b/Makefile.libcompat index c400cef6fbe3..c2be63c29e73 100644 --- a/Makefile.libcompat +++ b/Makefile.libcompat @@ -104,6 +104,7 @@ build${libcompat}: .PHONY OBJROOT='$${OBJTOP}/' \ MAKEOBJDIRPREFIX= \ DIRPRFX=${_dir}/ -DNO_LINT -DNO_CPU_CFLAGS \ + MK_ASAN=no MK_UBSAN=no \ MK_CTF=no MK_RETPOLINE=no MK_WERROR=no \ ${_t} .endfor diff --git a/lib/Makefile b/lib/Makefile index a06e77dee022..674368a19ffd 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -180,6 +180,8 @@ SUBDIR.${MK_STATS}+= libstats ${MACHINE_CPUARCH} == "arm" || ${MACHINE_CPUARCH} == "i386" || \ ${MACHINE_CPUARCH} == "powerpc") _libclang_rt= libclang_rt +.elif ${MK_ASAN} != "no" || ${MK_UBSAN} != "no" +.error "Requested build with sanitizers but cannot build runtime libraries!" .endif .if ${MK_CXX} != "no" diff --git a/lib/csu/Makefile.inc b/lib/csu/Makefile.inc index 5681ef65117a..b089e1a947b1 100644 --- a/lib/csu/Makefile.inc +++ b/lib/csu/Makefile.inc @@ -3,6 +3,9 @@ SSP_CFLAGS= NO_WMISSING_VARIABLE_DECLARATIONS= +# Can't instrument these files since that breaks non-sanitized programs. +MK_ASAN:= no +MK_UBSAN:= no .include diff --git a/lib/libclang_rt/Makefile.inc b/lib/libclang_rt/Makefile.inc index 946d3f4c77a7..19b8868b60e3 100644 --- a/lib/libclang_rt/Makefile.inc +++ b/lib/libclang_rt/Makefile.inc @@ -12,6 +12,8 @@ SHLIBDIR= ${LIBDIR} NO_PIC= MK_PROFILE= no +MK_ASAN:= no +MK_UBSAN:= no WARNS?= 0 diff --git a/lib/libgcc_eh/Makefile.inc b/lib/libgcc_eh/Makefile.inc index 4fe1eff406e1..9e386992e78c 100644 --- a/lib/libgcc_eh/Makefile.inc +++ b/lib/libgcc_eh/Makefile.inc @@ -20,9 +20,17 @@ SRCS_EXC+= libunwind.cpp SRCS+= ${SRCS_EXC} .for file in ${SRCS_EXC:M*.c} CFLAGS.${file}+= -fno-exceptions -funwind-tables +.if ${MK_ASAN} != "no" +# False-positives during stack unwinding +CFLAGS.${file}+= -fno-sanitize=address +.endif .endfor .for file in ${SRCS_EXC:M*.cpp} CXXFLAGS.${file}+= -fno-exceptions -funwind-tables +.if ${MK_ASAN} != "no" +# False-positives during stack unwinding +CXXFLAGS.${file}+= -fno-sanitize=address +.endif .endfor CFLAGS+= -I${UNWINDINCDIR} diff --git a/lib/libgcc_s/Makefile b/lib/libgcc_s/Makefile index 84477ee00818..aa097d7255de 100644 --- a/lib/libgcc_s/Makefile +++ b/lib/libgcc_s/Makefile @@ -4,6 +4,9 @@ PACKAGE= clibs SHLIB_NAME= libgcc_s.so.1 SHLIBDIR?= /lib +# Enabling UBSan triggers "undefined reference to vtable for __cxxabiv1::__function_type_info" +MK_UBSAN:= no + .include MK_SSP= no diff --git a/libexec/rtld-elf/Makefile b/libexec/rtld-elf/Makefile index 9ae998942a12..db1bf70ca59e 100644 --- a/libexec/rtld-elf/Makefile +++ b/libexec/rtld-elf/Makefile @@ -9,7 +9,10 @@ RTLD_ELF_DIR:= ${.PARSEDIR} .include PACKAGE= clibs MK_PIE= no # Always position independent using local rules +# Not compatible with sanitizer instrumentation or SSP. +MK_ASAN= no MK_SSP= no +MK_UBSAN= no CONFS= libmap.conf PROG?= ld-elf.so.1 diff --git a/share/mk/bsd.README b/share/mk/bsd.README index 9eb91c1bce3c..8004d742d649 100644 --- a/share/mk/bsd.README +++ b/share/mk/bsd.README @@ -118,7 +118,7 @@ The profiled libraries are no longer built in a different directory than the regular libraries. A new suffix, ".po", is used to denote a profiled object, and ".pico" denotes a position-independent relocatable object. ".nossppico" denotes a position-independent relocatable object without -stack smashing protection. +stack smashing protection and without sanitizer instrumentation. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= diff --git a/share/mk/bsd.compat.mk b/share/mk/bsd.compat.mk index e063415bcbfc..6787209dcd25 100644 --- a/share/mk/bsd.compat.mk +++ b/share/mk/bsd.compat.mk @@ -162,6 +162,7 @@ LIBCOMPATCFLAGS+= -B${LIBCOMPATTMP}/usr/lib${libcompat} LIBDIR_BASE:= /usr/lib${libcompat} _LIB_OBJTOP= ${LIBCOMPAT_OBJTOP} LIBDESTDIR:= ${LIBCOMPATTMP} +SYSROOT:= ${LIBCOMPATTMP} CFLAGS+= ${LIBCOMPATCFLAGS} LDFLAGS+= ${CFLAGS} ${LIBCOMPATLDFLAGS} MACHINE= ${LIBCOMPAT_MACHINE} diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk index db54055b7ae0..5de74b6fa056 100644 --- a/share/mk/bsd.lib.mk +++ b/share/mk/bsd.lib.mk @@ -6,6 +6,8 @@ .include .include +____: + .if defined(LIB_CXX) || defined(SHLIB_CXX) _LD= ${CXX} .else @@ -106,6 +108,8 @@ CXXFLAGS+= -ftrivial-auto-var-init=pattern .endif .endif +.include "bsd.sanitizer.mk" + .if ${MK_DEBUG_FILES} != "no" && empty(DEBUG_FLAGS:M-g) && \ empty(DEBUG_FLAGS:M-gdwarf*) CFLAGS+= ${DEBUG_FILES_CFLAGS} @@ -147,7 +151,7 @@ PO_FLAG=-pg ${CTFCONVERT_CMD} .c.nossppico: - ${CC} ${PICFLAG} -DPIC ${SHARED_CFLAGS:C/^-fstack-protector.*$//} ${CFLAGS:C/^-fstack-protector.*$//} -c ${.IMPSRC} -o ${.TARGET} + ${CC} ${PICFLAG} -DPIC ${SHARED_CFLAGS:C/^-fstack-protector.*$//:C/^-fsanitize.*$//} ${CFLAGS:C/^-fstack-protector.*$//:C/^-fsanitize.*$//} -c ${.IMPSRC} -o ${.TARGET} ${CTFCONVERT_CMD} .c.pieo: @@ -161,7 +165,7 @@ PO_FLAG=-pg ${CXX} ${PICFLAG} -DPIC ${SHARED_CXXFLAGS} ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET} .cc.nossppico .C.nossppico .cpp.nossppico .cxx.nossppico: - ${CXX} ${PICFLAG} -DPIC ${SHARED_CXXFLAGS:C/^-fstack-protector.*$//} ${CXXFLAGS:C/^-fstack-protector.*$//} -c ${.IMPSRC} -o ${.TARGET} + ${CXX} ${PICFLAG} -DPIC ${SHARED_CXXFLAGS:C/^-fstack-protector.*$//:C/^-fsanitize.*$//} ${CXXFLAGS:C/^-fstack-protector.*$//:C/^-fsanitize.*$//} -c ${.IMPSRC} -o ${.TARGET} .cc.pieo .C.pieo .cpp.pieo .cxx.pieo: ${CXX} ${PIEFLAG} ${SHARED_CXXFLAGS} ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET} diff --git a/share/mk/bsd.opts.mk b/share/mk/bsd.opts.mk index 33d843593427..6e81484a09ab 100644 --- a/share/mk/bsd.opts.mk +++ b/share/mk/bsd.opts.mk @@ -69,6 +69,7 @@ __DEFAULT_YES_OPTIONS = \ WERROR __DEFAULT_NO_OPTIONS = \ + ASAN \ BIND_NOW \ CCACHE_BUILD \ CTF \ @@ -77,7 +78,8 @@ __DEFAULT_NO_OPTIONS = \ INSTALL_AS_USER \ MANSPLITPKG \ RETPOLINE \ - STALE_STAGED + STALE_STAGED \ + UBSAN __DEFAULT_DEPENDENT_OPTIONS = \ MAKE_CHECK_USE_SANDBOX/TESTS \ diff --git a/share/mk/bsd.prog.mk b/share/mk/bsd.prog.mk index 89eddb24abb0..96d72daf2611 100644 --- a/share/mk/bsd.prog.mk +++ b/share/mk/bsd.prog.mk @@ -81,6 +81,8 @@ CXXFLAGS+= -ftrivial-auto-var-init=pattern .endif .endif +.include "bsd.sanitizer.mk" + .if ${MACHINE_CPUARCH} == "riscv" && ${LINKER_FEATURES:Mriscv-relaxations} == "" CFLAGS += -mno-relax .endif diff --git a/share/mk/bsd.progs.mk b/share/mk/bsd.progs.mk index 54266a335177..79397f595688 100644 --- a/share/mk/bsd.progs.mk +++ b/share/mk/bsd.progs.mk @@ -23,7 +23,7 @@ PROGS += ${PROGS_CXX} .if defined(PROG) # just one of many PROG_OVERRIDE_VARS += BINDIR BINGRP BINOWN BINMODE CSTD CXXSTD DPSRCS MAN \ - NO_SHARED MK_WERROR PROGNAME SRCS STRIP WARNS + NO_SHARED MK_WERROR PROGNAME SRCS STRIP WARNS MK_ASAN MK_UBSAN PROG_VARS += CFLAGS CXXFLAGS DEBUG_FLAGS DPADD INTERNALPROG LDADD LIBADD \ LINKS LDFLAGS MLINKS ${PROG_OVERRIDE_VARS} .for v in ${PROG_VARS:O:u} diff --git a/share/mk/bsd.sanitizer.mk b/share/mk/bsd.sanitizer.mk new file mode 100644 index 000000000000..56d010767906 --- /dev/null +++ b/share/mk/bsd.sanitizer.mk @@ -0,0 +1,43 @@ +.include + +.include "../../lib/libclang_rt/compiler-rt-vars.mk" +_use_sanitizers= no +# Add the necessary sanitizer flags if requested +.if ${MK_ASAN} == "yes" && ${NO_SHARED:Uno:tl} == "no" +SANITIZER_CFLAGS+= -fsanitize=address -fPIC +# TODO: remove this once all basic errors have been fixed: +# https://github.com/google/sanitizers/wiki/AddressSanitizer#faq +SANITIZER_CFLAGS+= -fsanitize-recover=address +SANITIZER_LDFLAGS+= -fsanitize=address +_use_sanitizers= yes +.endif # ${MK_ASAN} == "yes" + +.if ${MK_UBSAN} == "yes" && ${NO_SHARED:Uno:tl} == "no" +# Unlike the other sanitizers, UBSan could also work for static libraries. +# However, this currently results in linker errors (even with the +# -fsanitize-minimal-runtime flag), so only enable it for dynamically linked +# code for now. +SANITIZER_CFLAGS+= -fsanitize=undefined +SANITIZER_CFLAGS+= -fsanitize-recover=undefined +SANITIZER_LDFLAGS+= -fsanitize=undefined +_use_sanitizers= yes +.endif # ${MK_UBSAN} == "yes" + +.if !defined(BOOTSTRAPPING) && ${_use_sanitizers} != 0 && \ + ${COMPILER_TYPE} != "clang" +.error "Sanitizer instrumentation currently only supported with clang" +.endif + +# For libraries we only instrument the shared and PIE libraries by setting +# SHARED_CFLAGS instead of CFLAGS. We do this since static executables are not +# compatible with the santizers (interceptors do not work). +.if ${_use_sanitizers} != "no" +.if target(____) +SHARED_CFLAGS+= ${SANITIZER_CFLAGS} +SOLINKOPTS+= ${SANITIZER_LDFLAGS} +LDFLAGS:= ${LDFLAGS:N-Wl,-no-undefined:N-Wl,--no-undefined} +.else +CFLAGS+= ${SANITIZER_CFLAGS} +LDFLAGS+= ${SANITIZER_LDFLAGS} +.endif +.endif # ${_use_sanitizers} != "no" diff --git a/share/mk/sys.mk b/share/mk/sys.mk index 89ac2c549656..462002ce7d18 100644 --- a/share/mk/sys.mk +++ b/share/mk/sys.mk @@ -242,7 +242,7 @@ LFLAGS ?= # compiler driver flags (e.g. -mabi=*) that conflict with flags to LD. LD ?= ld LDFLAGS ?= -_LDFLAGS = ${LDFLAGS:S/-Wl,//g:N-mabi=*:N-fuse-ld=*:N--ld-path=*} +_LDFLAGS = ${LDFLAGS:S/-Wl,//g:N-mabi=*:N-fuse-ld=*:N--ld-path=*:N-fsanitize=*:N-fno-sanitize=*} MAKE ?= make From owner-dev-commits-src-all@freebsd.org Mon Aug 2 13:35:07 2021 Return-Path: Delivered-To: dev-commits-src-all@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 4E164673E72; Mon, 2 Aug 2021 13:35: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 4GdfBg123Kz4RYl; Mon, 2 Aug 2021 13:35: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 0ABAF20628; Mon, 2 Aug 2021 13:35: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 172DZ6kx050572; Mon, 2 Aug 2021 13:35:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 172DZ6No050571; Mon, 2 Aug 2021 13:35:06 GMT (envelope-from git) Date: Mon, 2 Aug 2021 13:35:06 GMT Message-Id: <202108021335.172DZ6No050571@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: 9efbe526e00f - main - libthr: work around an ASAN false-positive 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: 9efbe526e00f47d946b3320f595e73fea26805df Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 13:35:07 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=9efbe526e00f47d946b3320f595e73fea26805df commit 9efbe526e00f47d946b3320f595e73fea26805df Author: Alex Richardson AuthorDate: 2021-08-02 08:49:21 +0000 Commit: Alex Richardson CommitDate: 2021-08-02 13:33:24 +0000 libthr: work around an ASAN false-positive I got the following error with an ASAN-instrument libthr: ==803==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7fffffffcdb0 at pc 0x000801863396 bp 0x7ff8 READ of size 4 at 0x7fffffffcdb0 thread T0 #0 0x801863395 in handle_signal /local/scratch/alr48/cheri/freebsd/lib/libthr/thread/thr_sig.c:262:2 #1 0x801860da2 in thr_sighandler /local/scratch/alr48/cheri/freebsd/lib/libthr/thread/thr_sig.c:246:2 Address 0x7fffffffcdb0 is located in stack of thread T0 at offset 208 in frame #0 0x80186080f in thr_sighandler /local/scratch/alr48/cheri/freebsd/lib/libthr/thread/thr_sig.c:213 This frame has 1 object(s): [32, 64) 'act' (line 216) <== Memory access at offset 208 overflows this variable HINT: this may be a false positive if your program uses some custom stack This seems like a false-positive since the line in question is `SIGSETOR(actp->sa_mask, ucp->uc_sigmask);` and it complains about a read operation (from the ucontext_t argument) so this indicates to me that ASAN does not understand that thr_sighandler() is a signal handler. Differential Revision: https://reviews.freebsd.org/D31074 --- lib/libthr/Makefile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/libthr/Makefile b/lib/libthr/Makefile index 1a5dfa18dca7..038823413cb2 100644 --- a/lib/libthr/Makefile +++ b/lib/libthr/Makefile @@ -29,6 +29,12 @@ CFLAGS+=-I${SRCTOP}/lib/libthread_db CFLAGS.thr_stack.c+= -Wno-cast-align CFLAGS.rtld_malloc.c+= -Wno-cast-align CFLAGS.thr_symbols.c+= -Wno-missing-variable-declarations +.if ${MK_ASAN} != "no" +# False-positive ASAN error claiming the local "struct sigaction act;" is +# overflowed by handle_signal() reading from the ucontext_t argument. This +# could be caused by ASAN not treating this function as a signal handler. +CFLAGS.thr_sig.c+= -fno-sanitize=address +.endif .ifndef NO_THREAD_UNWIND_STACK CFLAGS+=-fexceptions From owner-dev-commits-src-all@freebsd.org Mon Aug 2 13:35:08 2021 Return-Path: Delivered-To: dev-commits-src-all@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 7AE5C673FEF; Mon, 2 Aug 2021 13:35: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 4GdfBh2rJzz4RYp; Mon, 2 Aug 2021 13:35: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 3A1FB20729; Mon, 2 Aug 2021 13:35: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 172DZ8Xq050596; Mon, 2 Aug 2021 13:35:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 172DZ8ln050595; Mon, 2 Aug 2021 13:35:08 GMT (envelope-from git) Date: Mon, 2 Aug 2021 13:35:08 GMT Message-Id: <202108021335.172DZ8ln050595@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: c826e08841fb - main - Fix MK_TESTS build with MK_ASAN/MK_UBSAN 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: c826e08841fbcc0ba0c5a78aa09d6ee22a95f2f9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 13:35:08 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=c826e08841fbcc0ba0c5a78aa09d6ee22a95f2f9 commit c826e08841fbcc0ba0c5a78aa09d6ee22a95f2f9 Author: Alex Richardson AuthorDate: 2021-08-02 08:49:50 +0000 Commit: Alex Richardson CommitDate: 2021-08-02 13:33:24 +0000 Fix MK_TESTS build with MK_ASAN/MK_UBSAN Reviewed By: markj Differential Revision: https://reviews.freebsd.org/D31049 --- tests/sys/capsicum/Makefile | 6 ++++++ usr.sbin/rpcbind/tests/Makefile | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/tests/sys/capsicum/Makefile b/tests/sys/capsicum/Makefile index ded91803cf8a..1d2543b2ef4d 100644 --- a/tests/sys/capsicum/Makefile +++ b/tests/sys/capsicum/Makefile @@ -43,6 +43,12 @@ PROGS+= $p NO_SHARED.$p= SRCS.$p= mini-me.c .endfor +.if ${MK_ASAN} != "no" || ${MK_UBSAN} != "no" +# mini-me.o is linked into a static binary so we can't use sanitizers. +# Note: We have to set CFLAGS here since it will be built as part of +# _PROGS_COMMON_OBJS and therefore NO_SHARED.$p does not disable ASAN/UBSAN. +CFLAGS.mini-me.c+= -fno-sanitize=address -fno-sanitize=undefined +.endif BINDIR= ${TESTSDIR} diff --git a/usr.sbin/rpcbind/tests/Makefile b/usr.sbin/rpcbind/tests/Makefile index 515214763421..dae57a29fda7 100644 --- a/usr.sbin/rpcbind/tests/Makefile +++ b/usr.sbin/rpcbind/tests/Makefile @@ -14,4 +14,12 @@ CFLAGS+= -DINET6 WARNS?= 3 +.if ${MK_ASAN} != "no" +# Work around "error: duplicate symbol: getifaddrs" when building with ASAN. +# The ASAN interceptors also define getifaddrs, but we want to prefer the local +# stub symbol here, so using a shared sanitizer runtime moves the local +# definition first in the symbol resolution order. +LDFLAGS+=-shared-libasan +.endif + .include From owner-dev-commits-src-all@freebsd.org Mon Aug 2 13:35:09 2021 Return-Path: Delivered-To: dev-commits-src-all@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 BFED16744B4; Mon, 2 Aug 2021 13:35: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 4GdfBj4S5hz4Rc6; Mon, 2 Aug 2021 13:35: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 56CA12072A; Mon, 2 Aug 2021 13:35: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 172DZ9EV050621; Mon, 2 Aug 2021 13:35:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 172DZ9jN050619; Mon, 2 Aug 2021 13:35:09 GMT (envelope-from git) Date: Mon, 2 Aug 2021 13:35:09 GMT Message-Id: <202108021335.172DZ9jN050619@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: 5e9226f063bc - main - Fix build of stand/ when building world with ASAN 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: 5e9226f063bc43574e2168b4aafad8232f08002a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 13:35:09 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=5e9226f063bc43574e2168b4aafad8232f08002a commit 5e9226f063bc43574e2168b4aafad8232f08002a Author: Alex Richardson AuthorDate: 2021-08-02 08:50:16 +0000 Commit: Alex Richardson CommitDate: 2021-08-02 13:33:24 +0000 Fix build of stand/ when building world with ASAN The userboot/test program links against the default userspace libraries (e.g. shared libgcc_s.so) that will be instrumented if WITH_ASAN is set. All other programs link against libsa instead of libc and therefore can't use the sanitizer runtime library. To fix the stand/ build with sanitizers, we disable MK_ASAN/MK_UBSAN if -nostdlib is found in the LDFLAGS (i.e. we are using libsa instead of libc). Reviewed By: imp, tsoome Differential Revision: https://reviews.freebsd.org/D31047 --- stand/defs.mk | 6 ++++++ stand/userboot/userboot/Makefile | 5 +++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/stand/defs.mk b/stand/defs.mk index d50c89879613..02a03b92577e 100644 --- a/stand/defs.mk +++ b/stand/defs.mk @@ -24,6 +24,12 @@ INTERNALLIB= # enough to make that hassle worth chasing. _CPUCFLAGS= +.if ${LDFLAGS:M-nostdlib} +# Sanitizers won't work unless we link against libc (e.g. in userboot/test). +MK_ASAN:= no +MK_UBSAN:= no +.endif + .include .include diff --git a/stand/userboot/userboot/Makefile b/stand/userboot/userboot/Makefile index 767840101200..60fcf57d9697 100644 --- a/stand/userboot/userboot/Makefile +++ b/stand/userboot/userboot/Makefile @@ -6,6 +6,9 @@ LOADER_CD9660_SUPPORT?= no LOADER_EXT2FS_SUPPORT?= no PIC=yes +# Note: -nostdlib needs to be added to LDFLAGS before including defs.mk +LDFLAGS+= -nostdlib -Wl,-Bsymbolic + .include SHLIB_NAME= userboot_${LOADER_INTERP}.so @@ -39,8 +42,6 @@ CFLAGS.main.c+= -I${SYSDIR}/contrib/openzfs/include/os/freebsd/zfs CFLAGS.gfx_fb.c+= -I$(SRCTOP)/sys/teken -I${SRCTOP}/contrib/pnglite CWARNFLAGS.main.c += -Wno-implicit-function-declaration -LDFLAGS+= -nostdlib -Wl,-Bsymbolic - NEWVERSWHAT= "User boot ${LOADER_INTERP}" ${MACHINE_CPUARCH} VERSION_FILE= ${.CURDIR}/../userboot/version From owner-dev-commits-src-all@freebsd.org Mon Aug 2 13:35:10 2021 Return-Path: Delivered-To: dev-commits-src-all@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 ECE21674657; Mon, 2 Aug 2021 13:35: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 4GdfBk3ypxz4Rc8; Mon, 2 Aug 2021 13:35: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 6490D20259; Mon, 2 Aug 2021 13:35: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 172DZA0t050651; Mon, 2 Aug 2021 13:35:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 172DZAKC050650; Mon, 2 Aug 2021 13:35:10 GMT (envelope-from git) Date: Mon, 2 Aug 2021 13:35:10 GMT Message-Id: <202108021335.172DZAKC050650@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: f0712132b68b - main - Don't instrument the rdtsc ifunc when building with ASAN/UBSAN 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: f0712132b68b4271e0602b06ee5f282718bfb8c5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 13:35:11 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=f0712132b68b4271e0602b06ee5f282718bfb8c5 commit f0712132b68b4271e0602b06ee5f282718bfb8c5 Author: Alex Richardson AuthorDate: 2021-08-02 08:51:01 +0000 Commit: Alex Richardson CommitDate: 2021-08-02 13:33:24 +0000 Don't instrument the rdtsc ifunc when building with ASAN/UBSAN The ifunc resolver is called before the sanitizer runtime is initialized, so any instrumentation results in an immediate crash. Reviewed By: kib Differential Revision: https://reviews.freebsd.org/D31046 --- lib/libc/x86/sys/Makefile.inc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/libc/x86/sys/Makefile.inc b/lib/libc/x86/sys/Makefile.inc index 41e0d1a8ad66..eff3a1085ec6 100644 --- a/lib/libc/x86/sys/Makefile.inc +++ b/lib/libc/x86/sys/Makefile.inc @@ -12,3 +12,11 @@ MAN+= \ .if ${MACHINE_CPUARCH} == "amd64" && ${MK_HYPERV} != "no" CFLAGS+= -DWANT_HYPERV .endif +# We can't use sanitizer instrumentation on ifuncs called during sanitizer +# runtime startup. +.if ${MK_ASAN} != "no" +CFLAGS.__vdso_gettc.c+=-fno-sanitize=address +.endif +.if ${MK_UBSAN} != "no" +CFLAGS.__vdso_gettc.c+=-fno-sanitize=undefined +.endif From owner-dev-commits-src-all@freebsd.org Mon Aug 2 13:35:11 2021 Return-Path: Delivered-To: dev-commits-src-all@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 D58816746A8; Mon, 2 Aug 2021 13:35: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 4GdfBl5CPPz4RXB; Mon, 2 Aug 2021 13:35: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 906B2208B4; Mon, 2 Aug 2021 13:35: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 172DZB6Y050675; Mon, 2 Aug 2021 13:35:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 172DZBO9050674; Mon, 2 Aug 2021 13:35:11 GMT (envelope-from git) Date: Mon, 2 Aug 2021 13:35:11 GMT Message-Id: <202108021335.172DZBO9050674@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: 8185be330723 - main - libc: Disable ASAN for certain string functions 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: 8185be3307232d88ddd1b6468f4ddec54a993f54 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 13:35:11 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=8185be3307232d88ddd1b6468f4ddec54a993f54 commit 8185be3307232d88ddd1b6468f4ddec54a993f54 Author: Alex Richardson AuthorDate: 2021-08-02 08:51:34 +0000 Commit: Alex Richardson CommitDate: 2021-08-02 13:33:24 +0000 libc: Disable ASAN for certain string functions They deliberately read out-of-bounds values to avoid byte-by-byte loads and check multiple bytes at once. While this will work on x86, it is flagged as an out-of-bounds read with ASAN, so we have to disable instrumentation here. This also causes bounds errors for CHERI, so in CheriBSD we use implementations that avoid OOB reads. Differential Revision: https://reviews.freebsd.org/D31045 --- lib/libc/string/Makefile.inc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/libc/string/Makefile.inc b/lib/libc/string/Makefile.inc index 6945155812af..1df3d40e329f 100644 --- a/lib/libc/string/Makefile.inc +++ b/lib/libc/string/Makefile.inc @@ -29,6 +29,15 @@ MISRCS+=bcmp.c bcopy.c bzero.c explicit_bzero.c \ SYM_MAPS+= ${LIBC_SRCTOP}/string/Symbol.map +.if ${MK_ASAN} != "no" +# These source files deliberately read out of bounds since they assume that +# out-of-bounds memory accesses that don't cross pages are always legal. +# Note: While this is fine on x86, it does break when running with CHERI. +CFLAGS.strlen.c+= -fno-sanitize=address +CFLAGS.strchrnul.c+= -fno-sanitize=address +CFLAGS.memchr.c+= -fno-sanitize=address +.endif + # machine-dependent string sources .sinclude "${LIBC_SRCTOP}/${LIBC_ARCH}/string/Makefile.inc" From owner-dev-commits-src-all@freebsd.org Mon Aug 2 13:35:13 2021 Return-Path: Delivered-To: dev-commits-src-all@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 2FE8C6747F3; Mon, 2 Aug 2021 13:35: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 4GdfBm6CtYz4RXF; Mon, 2 Aug 2021 13:35: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 B157120629; Mon, 2 Aug 2021 13:35:12 +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 172DZC3w050699; Mon, 2 Aug 2021 13:35:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 172DZCeH050698; Mon, 2 Aug 2021 13:35:12 GMT (envelope-from git) Date: Mon, 2 Aug 2021 13:35:12 GMT Message-Id: <202108021335.172DZCeH050698@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: 2de949cf85d0 - main - Remove mkcsmapper_static and mkesdb_static from build-tools 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: 2de949cf85d0e0b9ff71e1ffd74153814de96175 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 13:35:13 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=2de949cf85d0e0b9ff71e1ffd74153814de96175 commit 2de949cf85d0e0b9ff71e1ffd74153814de96175 Author: Alex Richardson AuthorDate: 2021-08-02 09:49:01 +0000 Commit: Alex Richardson CommitDate: 2021-08-02 13:33:25 +0000 Remove mkcsmapper_static and mkesdb_static from build-tools Build them as part of the bootstrap-tools phase instead. Reviewed by: emaste (no objections) Differential Revision: https://reviews.freebsd.org/D28181 --- Makefile.inc1 | 9 +++++++-- share/i18n/csmapper/Makefile.inc | 6 ++---- share/i18n/csmapper/Makefile.part | 2 -- share/i18n/esdb/Makefile.inc | 6 ++---- share/i18n/esdb/Makefile.part | 2 -- targets/pseudo/hosttools/Makefile.depend.host | 4 ++-- usr.bin/Makefile | 6 ------ usr.bin/mkcsmapper/Makefile | 6 ++++++ usr.bin/mkcsmapper_static/Makefile.depend | 19 ------------------- usr.bin/mkesdb/Makefile | 6 ++++++ usr.bin/mkesdb_static/Makefile.depend | 19 ------------------- 11 files changed, 25 insertions(+), 60 deletions(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index 8fa55f5cea2e..e3707c7a504a 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -2331,6 +2331,11 @@ _localedef= usr.bin/localedef ${_bt}-usr.bin/localedef: ${_bt}-usr.bin/yacc ${_bt_lex_depend} .endif +.if ${MK_ICONV} != "no" +_mkesdb= usr.bin/mkesdb +_mkcsmapper= usr.bin/mkcsmapper +.endif + .if ${MK_KERBEROS} != "no" _kerberos5_bootstrap_tools= \ kerberos5/tools/make-roken \ @@ -2482,6 +2487,8 @@ bootstrap-tools: ${_bt}-links .PHONY ${_nmtree} \ ${_vtfontcvt} \ ${_localedef} \ + ${_mkcsmapper} \ + ${_mkesdb} \ ${LOCAL_BSTOOL_DIRS} ${_bt}-${_tool}: ${_bt}-links .PHONY .MAKE ${_+_}@${ECHODIR} "===> ${_tool} (obj,all,install)"; \ @@ -2543,8 +2550,6 @@ _bt_clean= ${CLEANDIR} ${_share} \ usr.bin/awk \ ${_libmagic} \ - usr.bin/mkesdb_static \ - usr.bin/mkcsmapper_static \ usr.bin/vi/catalog build-tools_${_tool}: .PHONY ${_+_}@${ECHODIR} "===> ${_tool} (${_bt_clean:D${_bt_clean},}obj,build-tools)"; \ diff --git a/share/i18n/csmapper/Makefile.inc b/share/i18n/csmapper/Makefile.inc index 284900c1bc05..72473764f313 100644 --- a/share/i18n/csmapper/Makefile.inc +++ b/share/i18n/csmapper/Makefile.inc @@ -3,7 +3,5 @@ .include CSMAPPERDIR?= /usr/share/i18n/csmapper -.if ${MK_STAGING} == "yes" -MKCSMAPPER= ${STAGE_HOST_OBJTOP}/usr/bin/mkcsmapper_static -.endif -MKCSMAPPER?= ${.OBJDIR:H:H:H}/usr.bin/mkcsmapper_static/mkcsmapper_static +# mkcsmapper builds as part of bootstrap-tools and can therefore be found in $PATH +MKCSMAPPER?= mkcsmapper diff --git a/share/i18n/csmapper/Makefile.part b/share/i18n/csmapper/Makefile.part index 4dbb4ff313dd..6b472f815bc6 100644 --- a/share/i18n/csmapper/Makefile.part +++ b/share/i18n/csmapper/Makefile.part @@ -1,8 +1,6 @@ # $FreeBSD$ # $NetBSD: Makefile,v 1.13 2007/03/13 16:34:37 tnozaki Exp $ -MKCSMAPPER?= ${.OBJDIR:H:H:H:H}/usr.bin/mkcsmapper_static/mkcsmapper_static - ESUBDIR?= ${CODE} PARTFILE?= ${.CURDIR}/${CODE}.part .if exists(${PARTFILE}) diff --git a/share/i18n/esdb/Makefile.inc b/share/i18n/esdb/Makefile.inc index ab61d2cee22f..096beeb96a62 100644 --- a/share/i18n/esdb/Makefile.inc +++ b/share/i18n/esdb/Makefile.inc @@ -5,7 +5,5 @@ .PATH: ${.CURDIR} ESDBDIR?= /usr/share/i18n/esdb -.if ${MK_STAGING} == "yes" -MKESDB= ${STAGE_HOST_OBJTOP}/usr/bin/mkesdb_static -.endif -MKESDB?= ${.OBJDIR:H:H:H}/usr.bin/mkesdb_static/mkesdb_static +# mkesdb builds as part of bootstrap-tools and can therefore be found in $PATH +MKESDB?= mkesdb diff --git a/share/i18n/esdb/Makefile.part b/share/i18n/esdb/Makefile.part index 703854e6e527..0378b117a5ca 100644 --- a/share/i18n/esdb/Makefile.part +++ b/share/i18n/esdb/Makefile.part @@ -1,8 +1,6 @@ # $FreeBSD$ # $NetBSD: Makefile.part,v 1.6 2008/10/25 22:35:36 apb Exp $ -MKESDB?= ${.OBJDIR:H:H:H:H}/usr.bin/mkesdb_static/mkesdb_static - PARTFILE?= ${.CURDIR}/${CODE}.part ALIASFILE?= ${.CURDIR}/${CODE}.alias .if !defined(NO_SEP) diff --git a/targets/pseudo/hosttools/Makefile.depend.host b/targets/pseudo/hosttools/Makefile.depend.host index 1def9574156b..3d6ab127eec9 100644 --- a/targets/pseudo/hosttools/Makefile.depend.host +++ b/targets/pseudo/hosttools/Makefile.depend.host @@ -12,8 +12,8 @@ DIRDEPS = \ usr.bin/clang/clang-tblgen \ usr.bin/clang/llvm-tblgen \ usr.bin/localedef \ - usr.bin/mkcsmapper_static \ - usr.bin/mkesdb_static \ + usr.bin/mkcsmapper \ + usr.bin/mkesdb \ usr.bin/xinstall \ usr.bin/yacc \ usr.sbin/config \ diff --git a/usr.bin/Makefile b/usr.bin/Makefile index 206da7154ac2..f1b07a7007be 100644 --- a/usr.bin/Makefile +++ b/usr.bin/Makefile @@ -283,12 +283,6 @@ SUBDIR.${MK_UTMPX}+= users SUBDIR.${MK_UTMPX}+= who SUBDIR.${MK_OFED}+= ofed -# These are normally only handled for build-tools. -.if make(clean*) -SUBDIR+= mkcsmapper_static -SUBDIR+= mkesdb_static -.endif - .include SUBDIR_PARALLEL= diff --git a/usr.bin/mkcsmapper/Makefile b/usr.bin/mkcsmapper/Makefile index 5d5e8b560bbf..eda8f96bf153 100644 --- a/usr.bin/mkcsmapper/Makefile +++ b/usr.bin/mkcsmapper/Makefile @@ -3,6 +3,12 @@ .PATH: ${SRCTOP}/lib/libc/iconv PROG= mkcsmapper +.if defined(BOOTSTRAPPING) +# When bootstrapping, the host libc might not contain these expected symbols +# so compile them directly into the binary. +SRCS= citrus_bcs.c citrus_db_factory.c citrus_db_hash.c \ + citrus_lookup_factory.c citrus_pivot_factory.c +.endif LDFLAGS+= -L${SRCTOP}/lib/libc NO_WMISSING_VARIABLE_DECLARATIONS= diff --git a/usr.bin/mkcsmapper_static/Makefile.depend b/usr.bin/mkcsmapper_static/Makefile.depend deleted file mode 100644 index f2071f254a6b..000000000000 --- a/usr.bin/mkcsmapper_static/Makefile.depend +++ /dev/null @@ -1,19 +0,0 @@ -# $FreeBSD$ -# Autogenerated - do NOT edit! - -DIRDEPS = \ - gnu/lib/csu \ - include \ - include/arpa \ - include/xlocale \ - lib/${CSU_DIR} \ - lib/libc \ - lib/libcompiler_rt \ - usr.bin/yacc.host \ - - -.include - -.if ${DEP_RELDIR} == ${_DEP_RELDIR} -# local dependencies - needed for -jN in clean tree -.endif diff --git a/usr.bin/mkesdb/Makefile b/usr.bin/mkesdb/Makefile index d49ecfa88f63..3540dcc8401a 100644 --- a/usr.bin/mkesdb/Makefile +++ b/usr.bin/mkesdb/Makefile @@ -3,6 +3,12 @@ .PATH: ${SRCTOP}/lib/libc/iconv PROG= mkesdb +.if defined(BOOTSTRAPPING) +# When bootstrapping, the host libc might not contain these expected symbols +# so compile them directly into the binary. +SRCS= citrus_bcs.c citrus_db_factory.c citrus_db_hash.c \ + citrus_lookup_factory.c +.endif NO_WMISSING_VARIABLE_DECLARATIONS= diff --git a/usr.bin/mkesdb_static/Makefile.depend b/usr.bin/mkesdb_static/Makefile.depend deleted file mode 100644 index f2071f254a6b..000000000000 --- a/usr.bin/mkesdb_static/Makefile.depend +++ /dev/null @@ -1,19 +0,0 @@ -# $FreeBSD$ -# Autogenerated - do NOT edit! - -DIRDEPS = \ - gnu/lib/csu \ - include \ - include/arpa \ - include/xlocale \ - lib/${CSU_DIR} \ - lib/libc \ - lib/libcompiler_rt \ - usr.bin/yacc.host \ - - -.include - -.if ${DEP_RELDIR} == ${_DEP_RELDIR} -# local dependencies - needed for -jN in clean tree -.endif From owner-dev-commits-src-all@freebsd.org Mon Aug 2 13:38:09 2021 Return-Path: Delivered-To: dev-commits-src-all@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 CC0D3674ACD; Mon, 2 Aug 2021 13:38: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 4GdfG93mG5z4SKY; Mon, 2 Aug 2021 13:38: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 5E32820631; Mon, 2 Aug 2021 13:38: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 172Dc9Gb051217; Mon, 2 Aug 2021 13:38:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 172Dc9QF051216; Mon, 2 Aug 2021 13:38:09 GMT (envelope-from git) Date: Mon, 2 Aug 2021 13:38:09 GMT Message-Id: <202108021338.172Dc9QF051216@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: 31ba4ce8898f - main - Allow bootstrapping llvm-tblgen on macOS and Linux 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: 31ba4ce8898f9dfa5e7f054fdbc26e50a599a6e3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 13:38:09 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=31ba4ce8898f9dfa5e7f054fdbc26e50a599a6e3 commit 31ba4ce8898f9dfa5e7f054fdbc26e50a599a6e3 Author: Alex Richardson AuthorDate: 2021-08-02 13:36:03 +0000 Commit: Alex Richardson CommitDate: 2021-08-02 13:36:03 +0000 Allow bootstrapping llvm-tblgen on macOS and Linux This is needed in order to build various LLVM binutils (e.g. addr2line) as well as clang/lld/lldb. Co-authored-by: Jessica Clarke Test Plan: Compiles on ubuntu 18.04 and macOS 11.4 Reviewed By: dim Differential Revision: https://reviews.freebsd.org/D31057 --- contrib/llvm-project/lld/tools/lld/lld.cpp | 3 +- lib/clang/include/llvm/Config/config.h | 58 +++++++++++++++++++--- lib/clang/libllvm/Makefile | 3 +- lib/clang/llvm.build.mk | 12 +++++ share/mk/src.opts.mk | 8 --- .../build/cross-build/include/common/sys/sysctl.h | 6 +++ tools/build/make.py | 4 ++ usr.bin/clang/clang.prog.mk | 2 + usr.bin/clang/lld/Makefile | 2 + usr.bin/clang/llvm.prog.mk | 2 + 10 files changed, 83 insertions(+), 17 deletions(-) diff --git a/contrib/llvm-project/lld/tools/lld/lld.cpp b/contrib/llvm-project/lld/tools/lld/lld.cpp index d30362ba7826..8827a883ceb6 100644 --- a/contrib/llvm-project/lld/tools/lld/lld.cpp +++ b/contrib/llvm-project/lld/tools/lld/lld.cpp @@ -146,7 +146,8 @@ static Flavor parseFlavor(std::vector &v) { static int lldMain(int argc, const char **argv, llvm::raw_ostream &stdoutOS, llvm::raw_ostream &stderrOS, bool exitEarly = true) { std::vector args(argv, argv + argc); -#ifdef __FreeBSD__ +#if 1 + /* On FreeBSD we only build the ELF linker. */ return !elf::link(args, exitEarly, stdoutOS, stderrOS); #else switch (parseFlavor(args)) { diff --git a/lib/clang/include/llvm/Config/config.h b/lib/clang/include/llvm/Config/config.h index 0cd6dabeab17..35ce8c189d2b 100644 --- a/lib/clang/include/llvm/Config/config.h +++ b/lib/clang/include/llvm/Config/config.h @@ -29,7 +29,11 @@ /* #undef HAVE_CRASHREPORTERCLIENT_H */ /* can use __crashreporter_info__ */ +#if defined(__APPLE__) +#define HAVE_CRASHREPORTER_INFO 1 +#else #define HAVE_CRASHREPORTER_INFO 0 +#endif /* Define to 1 if you have the declaration of `arc4random', and to 0 if you don't. */ @@ -125,28 +129,46 @@ #define HAVE_PTHREAD_SETNAME_NP 1 /* Define to 1 if you have the header file. */ +#if __has_include() #define HAVE_LINK_H 1 +#else +#define HAVE_LINK_H 0 +#endif /* Define to 1 if you have the `lseek64' function. */ -/* #undef HAVE_LSEEK64 */ +#if defined(__linux__) +#define HAVE_LSEEK64 1 +#endif /* Define to 1 if you have the header file. */ -/* #undef HAVE_MACH_MACH_H */ +#if __has_include() +#define HAVE_MACH_MACH_H 1 +#endif /* Define to 1 if you have the `mallctl' function. */ +#if defined(__FreeBSD__) #define HAVE_MALLCTL 1 +#endif /* Define to 1 if you have the `mallinfo' function. */ -/* #undef HAVE_MALLINFO */ +#if defined(__linux__) +#define HAVE_MALLINFO 1 +#endif /* Define to 1 if you have the header file. */ -/* #undef HAVE_MALLOC_MALLOC_H */ +#if __has_include() +#define HAVE_MALLOC_MALLOC_H 1 +#endif /* Define to 1 if you have the `malloc_zone_statistics' function. */ -/* #undef HAVE_MALLOC_ZONE_STATISTICS */ +#if defined(__APPLE__) +#define HAVE_MALLOC_ZONE_STATISTICS 1 +#endif /* Define to 1 if you have the `posix_fallocate' function. */ +#if !defined(__APPLE__) #define HAVE_POSIX_FALLOCATE 1 +#endif /* Define to 1 if you have the `posix_spawn' function. */ #define HAVE_POSIX_SPAWN 1 @@ -209,19 +231,31 @@ #define HAVE_SYS_TIME_H 1 /* Define to 1 if stat struct has st_mtimespec member .*/ +#if !defined(__linux__) #define HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC 1 +#endif /* Define to 1 if stat struct has st_mtim member. */ +#if !defined(__APPLE__) #define HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC 1 +#endif /* Define to 1 if you have the header file. */ #define HAVE_SYS_TYPES_H 1 /* Define if the setupterm() function is supported this platform. */ +#if defined(__FreeBSD__) +/* + * This is only needed for terminalHasColors(). When disabled LLVM falls back + * to checking a list of TERM prefixes which is sufficient for a bootstrap tool. + */ #define LLVM_ENABLE_TERMINFO 1 +#endif /* Define if the xar_open() function is supported this platform. */ -/* #undef HAVE_LIBXAR */ +#if defined(__APPLE__) +#define HAVE_LIBXAR +#endif /* Define to 1 if you have the header file. */ #define HAVE_TERMIOS_H 1 @@ -239,7 +273,9 @@ /* #undef HAVE__CHSIZE_S */ /* Define to 1 if you have the `_Unwind_Backtrace' function. */ -/* #undef HAVE__UNWIND_BACKTRACE */ +#if !defined(__FreeBSD__) +#define HAVE__UNWIND_BACKTRACE 1 +#endif /* Have host's __alloca */ /* #undef HAVE___ALLOCA */ @@ -315,7 +351,11 @@ /* #undef LLVM_LIBXML2_ENABLED */ /* Define to the extension used for shared libraries, say, ".so". */ +#if defined(__APPLE__) +#define LTDL_SHLIB_EXT ".dylib" +#else #define LTDL_SHLIB_EXT ".so" +#endif /* Define to the address where bug reports for this package should be sent. */ #define PACKAGE_BUGREPORT "https://bugs.freebsd.org/submit/" @@ -351,6 +391,10 @@ /* #undef LLVM_GISEL_COV_PREFIX */ /* Whether Timers signpost passes in Xcode Instruments */ +#if defined(__APPLE__) +#define LLVM_SUPPORT_XCODE_SIGNPOSTS 1 +#else #define LLVM_SUPPORT_XCODE_SIGNPOSTS 0 +#endif #endif diff --git a/lib/clang/libllvm/Makefile b/lib/clang/libllvm/Makefile index 85440f467a18..09d6336c01d9 100644 --- a/lib/clang/libllvm/Makefile +++ b/lib/clang/libllvm/Makefile @@ -717,7 +717,8 @@ SRCS_EXL+= LTO/LTOModule.cpp SRCS_EXL+= LTO/SummaryBasedOptimizations.cpp SRCS_EXL+= LTO/ThinLTOCodeGenerator.cpp SRCS_MIN+= LTO/UpdateCompilerUsed.cpp -SRCS_MIN+= LineEditor/LineEditor.cpp +# Only needed for clangd/clang-query, uncomment once we build those. +# SRCS_XDW+= LineEditor/LineEditor.cpp SRCS_MIN+= Linker/IRMover.cpp SRCS_MIN+= Linker/LinkModules.cpp SRCS_MIN+= MC/ConstantPools.cpp diff --git a/lib/clang/llvm.build.mk b/lib/clang/llvm.build.mk index b248fb816364..70b39fdc44ca 100644 --- a/lib/clang/llvm.build.mk +++ b/lib/clang/llvm.build.mk @@ -100,12 +100,24 @@ CFLAGS+= -DLLVM_NATIVE_TARGETMC=LLVMInitialize${LLVM_NATIVE_ARCH}TargetMC CFLAGS+= -ffunction-sections CFLAGS+= -fdata-sections +.if ${LINKER_TYPE} == "mac" +LDFLAGS+= -Wl,-dead_strip +.else LDFLAGS+= -Wl,--gc-sections +.endif CXXSTD?= c++14 CXXFLAGS+= -fno-exceptions CXXFLAGS+= -fno-rtti +.if ${.MAKE.OS} == "FreeBSD" || !defined(BOOTSTRAPPING) +# Building on macOS/Linux needs the real sysctl() not the bootstrap tools stub. +CFLAGS+= -DBOOTSTRAPPING_WANT_NATIVE_SYSCTL +.else CXXFLAGS.clang+= -stdlib=libc++ +.endif +.if defined(BOOTSTRAPPING) && ${.MAKE.OS} == "Linux" +LIBADD+= dl +.endif .if ${MACHINE_ARCH:Mmips64} STATIC_CFLAGS+= -mxgot diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk index 27de86f6c8d4..bd360dd1ad29 100644 --- a/share/mk/src.opts.mk +++ b/share/mk/src.opts.mk @@ -360,14 +360,6 @@ __DEFAULT_YES_OPTIONS+=OPENMP __DEFAULT_NO_OPTIONS+=OPENMP .endif -.if ${.MAKE.OS} != "FreeBSD" -# Building the target compiler requires building tablegen on the host -# which is (currently) not possible on non-FreeBSD. -BROKEN_OPTIONS+=CLANG LLD LLDB -# The same also applies to the bootstrap LLVM. -BROKEN_OPTIONS+=CLANG_BOOTSTRAP LLD_BOOTSTRAP -.endif - .include # diff --git a/tools/build/cross-build/include/common/sys/sysctl.h b/tools/build/cross-build/include/common/sys/sysctl.h index 856f6be23421..6d6f5438c557 100644 --- a/tools/build/cross-build/include/common/sys/sysctl.h +++ b/tools/build/cross-build/include/common/sys/sysctl.h @@ -37,6 +37,11 @@ */ #pragma once +#ifdef BOOTSTRAPPING_WANT_NATIVE_SYSCTL +/* We need the real sysctl.h e.g. when bootstrapping the LLVM tools. */ +#include_next +#else +/* Otherwise, avoid sysctls since they might not be supported on the host. */ #include #define sysctlbyname __freebsd_sysctlbyname @@ -44,3 +49,4 @@ int sysctl(const int *, u_int, void *, size_t *, const void *, size_t); int sysctlbyname(const char *, void *, size_t *, const void *, size_t); +#endif diff --git a/tools/build/make.py b/tools/build/make.py index 0cf831a3c966..799ea89b74b3 100755 --- a/tools/build/make.py +++ b/tools/build/make.py @@ -166,6 +166,9 @@ if __name__ == "__main__": "needed if CC/CPP/CXX are not set). ") parser.add_argument("--debug", action="store_true", help="Print information on inferred env vars") + parser.add_argument("--bootstrap-toolchain", action="store_true", + help="Bootstrap the toolchain instead of using an " + "external one (experimental and not recommended)") parser.add_argument("--clean", action="store_true", help="Do a clean rebuild instead of building with " "-DWITHOUT_CLEAN") @@ -195,6 +198,7 @@ if __name__ == "__main__": if "universe" not in sys.argv and "tinderbox" not in sys.argv: sys.exit("TARGET= and TARGET_ARCH= must be set explicitly " "when building on non-FreeBSD") + if not parsed_args.bootstrap_toolchain: # infer values for CC/CXX/CPP if parsed_args.host_compiler_type == "gcc": default_cc, default_cxx, default_cpp = ("gcc", "g++", "cpp") diff --git a/usr.bin/clang/clang.prog.mk b/usr.bin/clang/clang.prog.mk index de5cceac7c6b..d0ed6b8587c5 100644 --- a/usr.bin/clang/clang.prog.mk +++ b/usr.bin/clang/clang.prog.mk @@ -17,8 +17,10 @@ LDADD+= ${OBJTOP}/lib/clang/lib${lib}/lib${lib}.a PACKAGE= clang +.if ${.MAKE.OS} == "FreeBSD" || !defined(BOOTSTRAPPING) LIBADD+= execinfo LIBADD+= ncursesw +.endif LIBADD+= pthread .include diff --git a/usr.bin/clang/lld/Makefile b/usr.bin/clang/lld/Makefile index 3593a4006ba2..8e95ccc07f04 100644 --- a/usr.bin/clang/lld/Makefile +++ b/usr.bin/clang/lld/Makefile @@ -102,8 +102,10 @@ TGHDRS+= ${INCFILE} DPSRCS+= ${TGHDRS} CLEANFILES+= ${TGHDRS} ${TGHDRS:C/$/.d/} +.if ${.MAKE.OS} == "FreeBSD" || !defined(BOOTSTRAPPING) LIBADD+= execinfo LIBADD+= ncursesw +.endif LIBADD+= pthread LIBADD+= z diff --git a/usr.bin/clang/llvm.prog.mk b/usr.bin/clang/llvm.prog.mk index 58fd3eedd113..56698c4138d3 100644 --- a/usr.bin/clang/llvm.prog.mk +++ b/usr.bin/clang/llvm.prog.mk @@ -22,8 +22,10 @@ LDADD+= ${OBJTOP}/lib/clang/lib${lib}/lib${lib}.a PACKAGE= clang +.if ${.MAKE.OS} == "FreeBSD" || !defined(BOOTSTRAPPING) LIBADD+= execinfo LIBADD+= ncursesw +.endif LIBADD+= pthread .include From owner-dev-commits-src-all@freebsd.org Mon Aug 2 14:48:54 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C7CCE675981; Mon, 2 Aug 2021 14:48: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 4Gdgqp5G1zz4Xfc; Mon, 2 Aug 2021 14:48: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 9D10121622; Mon, 2 Aug 2021 14:48: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 172EmsSs043948; Mon, 2 Aug 2021 14:48:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 172EmsxA043947; Mon, 2 Aug 2021 14:48:54 GMT (envelope-from git) Date: Mon, 2 Aug 2021 14:48:54 GMT Message-Id: <202108021448.172EmsxA043947@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: 5c9cb96a239c - main - Fix BUILD_WITH_STRICT_TMPPATH build after adding time to ITOOLS 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: 5c9cb96a239cd9793a74ff91baa7296b814948aa Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 14:48:54 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=5c9cb96a239cd9793a74ff91baa7296b814948aa commit 5c9cb96a239cd9793a74ff91baa7296b814948aa Author: Alex Richardson AuthorDate: 2021-08-02 14:34:26 +0000 Commit: Alex Richardson CommitDate: 2021-08-02 14:34:26 +0000 Fix BUILD_WITH_STRICT_TMPPATH build after adding time to ITOOLS This is needed after bbd16236e986ef1b0e1da37c9c8a7f9dd2d63b5d (and 99feb137f5f66f903bba816c1d98ced2a92bef12). --- tools/build/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/build/Makefile b/tools/build/Makefile index 31d027f75ce2..948a5f9dfdb2 100644 --- a/tools/build/Makefile +++ b/tools/build/Makefile @@ -266,8 +266,8 @@ SYSINCS+= ${SRCTOP}/sys/sys/elf.h # Linux/MacOS since we only use flags that are supported by all of them. _host_tools_to_symlink= basename bzip2 bunzip2 chmod chown cmp comm cp date dd \ dirname echo env false find fmt gzip gunzip head hostname id ln ls \ - mkdir mv nice patch rm sh sleep stat tee touch tr true uname uniq unxz \ - wc which xz + mkdir mv nice patch rm sh sleep stat tee time touch tr true uname uniq \ + unxz wc which xz # We also need a symlink to the absolute path to the make binary used for # the toplevel makefile. This is not necessarily the same as `which make` From owner-dev-commits-src-all@freebsd.org Mon Aug 2 14:55:34 2021 Return-Path: Delivered-To: dev-commits-src-all@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 4E3D1675944; Mon, 2 Aug 2021 14:55: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 4GdgzV182Xz4Y0q; Mon, 2 Aug 2021 14:55: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 0F4C521834; Mon, 2 Aug 2021 14:55: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 172EtXTh057285; Mon, 2 Aug 2021 14:55:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 172EtX31057284; Mon, 2 Aug 2021 14:55:33 GMT (envelope-from git) Date: Mon, 2 Aug 2021 14:55:33 GMT Message-Id: <202108021455.172EtX31057284@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: ca34553b6f63 - main - sched_ule(4): Pre-seed sched_random(). 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: ca34553b6f631ec4ec5ae9f3825e3196e172c35d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 14:55:34 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=ca34553b6f631ec4ec5ae9f3825e3196e172c35d commit ca34553b6f631ec4ec5ae9f3825e3196e172c35d Author: Alexander Motin AuthorDate: 2021-08-02 14:50:34 +0000 Commit: Alexander Motin CommitDate: 2021-08-02 14:55:28 +0000 sched_ule(4): Pre-seed sched_random(). I don't think it changes anything, but why not. While there, make cpu_search_highest() use all 8 lower load bits for noise, since it does not use cs_prefer and the code is not shared with cpu_search_lowest() any more. MFC after: 1 month --- sys/kern/sched_ule.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c index 1bdcfb1f793d..9bcc2a64e2b8 100644 --- a/sys/kern/sched_ule.c +++ b/sys/kern/sched_ule.c @@ -739,7 +739,7 @@ cpu_search_highest(const struct cpu_group *cg, const struct cpu_search *s, if (l < s->cs_limit || !tdq->tdq_transferable || !CPU_ISSET(c, s->cs_mask)) continue; - load -= sched_random() % 128; + load -= sched_random() % 256; if (load > bload) { bload = load; r->cs_cpu = c; @@ -1416,6 +1416,7 @@ sched_setup_smp(void) tdq->tdq_cg = smp_topo_find(cpu_top, i); if (tdq->tdq_cg == NULL) panic("Can't find cpu group for %d\n", i); + DPCPU_ID_SET(i, randomval, i * 69069 + 5); } PCPU_SET(sched, DPCPU_PTR(tdq)); balance_tdq = TDQ_SELF(); From owner-dev-commits-src-all@freebsd.org Mon Aug 2 15:03:22 2021 Return-Path: Delivered-To: dev-commits-src-all@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 69E69675DEA; Mon, 2 Aug 2021 15:03: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 4Gdh8V2QVTz4YHs; Mon, 2 Aug 2021 15:03: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 3107E21B70; Mon, 2 Aug 2021 15:03: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 172F3MIl071024; Mon, 2 Aug 2021 15:03:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 172F3M4S071023; Mon, 2 Aug 2021 15:03:22 GMT (envelope-from git) Date: Mon, 2 Aug 2021 15:03:22 GMT Message-Id: <202108021503.172F3M4S071023@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: 17d6371e4c85 - main - Fix GCC and -DWITH_CLEAN build after 7bc797e3f3807660cf98e5b1bd63545cafe820f8 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: 17d6371e4c85ca5952118203676cbd764db2b209 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 15:03:22 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=17d6371e4c85ca5952118203676cbd764db2b209 commit 17d6371e4c85ca5952118203676cbd764db2b209 Author: Alex Richardson AuthorDate: 2021-08-02 15:01:30 +0000 Commit: Alex Richardson CommitDate: 2021-08-02 15:03:05 +0000 Fix GCC and -DWITH_CLEAN build after 7bc797e3f3807660cf98e5b1bd63545cafe820f8 Reported by: kib --- lib/libclang_rt/compiler-rt-vars.mk | 7 +++++-- share/mk/bsd.sanitizer.mk | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/libclang_rt/compiler-rt-vars.mk b/lib/libclang_rt/compiler-rt-vars.mk index 974a553e379c..c270009e5d50 100644 --- a/lib/libclang_rt/compiler-rt-vars.mk +++ b/lib/libclang_rt/compiler-rt-vars.mk @@ -15,10 +15,13 @@ CRTARCH?= ${MACHINE_ARCH:S/amd64/x86_64/:C/hf$//:S/mipsn32/mips64/} # The only way to set the path to the sanitizer libraries with clang is to # override the resource directory. # Note: lib/freebsd is automatically appended to the -resource-dir value. -SANITIZER_LDFLAGS= -resource-dir=${SYSROOT}${CLANGDIR} +SANITIZER_LDFLAGS+= -resource-dir=${SYSROOT}${CLANGDIR} # Also set RPATH to ensure that the dynamically linked runtime libs are found. SANITIZER_LDFLAGS+= -Wl,--enable-new-dtags SANITIZER_LDFLAGS+= -Wl,-rpath,${SANITIZER_LIBDIR} -.else +.elif ${COMPILER_TYPE} != "none" +# This file can be included with COMPILER_TYPE=none during the cleandir phase, +# only emit an error when trying to compile with an unsupported compiler such +# as GCC. .error "Unknown link flags for -fsanitize=... COMPILER_TYPE=${COMPILER_TYPE}" .endif diff --git a/share/mk/bsd.sanitizer.mk b/share/mk/bsd.sanitizer.mk index 56d010767906..567b1da2afde 100644 --- a/share/mk/bsd.sanitizer.mk +++ b/share/mk/bsd.sanitizer.mk @@ -1,6 +1,5 @@ .include -.include "../../lib/libclang_rt/compiler-rt-vars.mk" _use_sanitizers= no # Add the necessary sanitizer flags if requested .if ${MK_ASAN} == "yes" && ${NO_SHARED:Uno:tl} == "no" @@ -23,7 +22,7 @@ SANITIZER_LDFLAGS+= -fsanitize=undefined _use_sanitizers= yes .endif # ${MK_UBSAN} == "yes" -.if !defined(BOOTSTRAPPING) && ${_use_sanitizers} != 0 && \ +.if !defined(BOOTSTRAPPING) && ${_use_sanitizers} != "no" && \ ${COMPILER_TYPE} != "clang" .error "Sanitizer instrumentation currently only supported with clang" .endif @@ -32,6 +31,7 @@ _use_sanitizers= yes # SHARED_CFLAGS instead of CFLAGS. We do this since static executables are not # compatible with the santizers (interceptors do not work). .if ${_use_sanitizers} != "no" +.include "../../lib/libclang_rt/compiler-rt-vars.mk" .if target(____) SHARED_CFLAGS+= ${SANITIZER_CFLAGS} SOLINKOPTS+= ${SANITIZER_LDFLAGS} From owner-dev-commits-src-all@freebsd.org Mon Aug 2 15:04:03 2021 Return-Path: Delivered-To: dev-commits-src-all@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 BB5CC6759CB; Mon, 2 Aug 2021 15:04: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 4Gdh9H4y7dz4YnB; Mon, 2 Aug 2021 15:04: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 921F1219D4; Mon, 2 Aug 2021 15:04: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 172F43Tc071254; Mon, 2 Aug 2021 15:04:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 172F437h071252; Mon, 2 Aug 2021 15:04:03 GMT (envelope-from git) Date: Mon, 2 Aug 2021 15:04:03 GMT Message-Id: <202108021504.172F437h071252@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 5f0efabf2b16 - stable/12 - tests: Enable net tests 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/stable/12 X-Git-Reftype: branch X-Git-Commit: 5f0efabf2b16d15ed7da25b1a8b0b24b8352b6d1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 15:04:03 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=5f0efabf2b16d15ed7da25b1a8b0b24b8352b6d1 commit 5f0efabf2b16d15ed7da25b1a8b0b24b8352b6d1 Author: Kristof Provost AuthorDate: 2020-02-13 14:09:09 +0000 Commit: Kristof Provost CommitDate: 2021-08-02 15:03:02 +0000 tests: Enable net tests We have a number of tests in the net subdirectory that were not executed. List the net directory so we run those tests. (cherry picked from commit 475b483aeef96d8bf47159f06761104d92c58c8c) --- tests/sys/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/sys/Makefile b/tests/sys/Makefile index 5d96c7654a28..efc4f801890f 100644 --- a/tests/sys/Makefile +++ b/tests/sys/Makefile @@ -19,6 +19,7 @@ TESTS_SUBDIRS+= kqueue TESTS_SUBDIRS+= mac TESTS_SUBDIRS+= mqueue TESTS_SUBDIRS+= ${_netgraph} +TESTS_SUBDIRS+= net TESTS_SUBDIRS+= netinet TESTS_SUBDIRS+= netinet6 TESTS_SUBDIRS+= netipsec From owner-dev-commits-src-all@freebsd.org Mon Aug 2 15:04:04 2021 Return-Path: Delivered-To: dev-commits-src-all@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 5906B6759CC; Mon, 2 Aug 2021 15:04: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 4Gdh9J1yQKz4YL6; Mon, 2 Aug 2021 15:04: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 21FA621861; Mon, 2 Aug 2021 15:04: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 172F44kH071348; Mon, 2 Aug 2021 15:04:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 172F44Wc071347; Mon, 2 Aug 2021 15:04:04 GMT (envelope-from git) Date: Mon, 2 Aug 2021 15:04:04 GMT Message-Id: <202108021504.172F44Wc071347@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 096cacc8115f - stable/13 - bridge tests: test linking bridges with a gif tunnel 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 096cacc8115fc3c5a46747afdf7be7eaf557d39f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 15:04:04 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=096cacc8115fc3c5a46747afdf7be7eaf557d39f commit 096cacc8115fc3c5a46747afdf7be7eaf557d39f Author: Kristof Provost AuthorDate: 2021-07-21 15:32:24 +0000 Commit: Kristof Provost CommitDate: 2021-08-02 14:50:32 +0000 bridge tests: test linking bridges with a gif tunnel Fairly basic test case for using gif(4)'s ability to tunnel Ethernet traffic between bridges. MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 4b765ab4cda051a6d9ceb5fb9cac80c7f3b910bf) --- tests/sys/net/if_bridge_test.sh | 66 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/tests/sys/net/if_bridge_test.sh b/tests/sys/net/if_bridge_test.sh index 4703efed46b8..b029d8d60419 100755 --- a/tests/sys/net/if_bridge_test.sh +++ b/tests/sys/net/if_bridge_test.sh @@ -452,6 +452,71 @@ stp_validation_cleanup() vnet_cleanup } +atf_test_case "gif" "cleanup" +gif_head() +{ + atf_set descr 'gif as a bridge member' + atf_set require.user root +} + +gif_body() +{ + vnet_init + + epair=$(vnet_mkepair) + + vnet_mkjail one ${epair}a + vnet_mkjail two ${epair}b + + jexec one sysctl net.link.gif.max_nesting=2 + jexec two sysctl net.link.gif.max_nesting=2 + + jexec one ifconfig ${epair}a 192.0.2.1/24 up + jexec two ifconfig ${epair}b 192.0.2.2/24 up + + # Tunnel + gif_one=$(jexec one ifconfig gif create) + gif_two=$(jexec two ifconfig gif create) + + jexec one ifconfig ${gif_one} tunnel 192.0.2.1 192.0.2.2 + jexec one ifconfig ${gif_one} up + jexec two ifconfig ${gif_two} tunnel 192.0.2.2 192.0.2.1 + jexec two ifconfig ${gif_two} up + + bridge_one=$(jexec one ifconfig bridge create) + bridge_two=$(jexec two ifconfig bridge create) + jexec one ifconfig ${bridge_one} 198.51.100.1/24 up + jexec one ifconfig ${bridge_one} addm ${gif_one} + jexec two ifconfig ${bridge_two} 198.51.100.2/24 up + jexec two ifconfig ${bridge_two} addm ${gif_two} + + # Sanity check + atf_check -s exit:0 -o ignore \ + jexec one ping -c 1 192.0.2.2 + + # Test tunnel + atf_check -s exit:0 -o ignore \ + jexec one ping -c 1 198.51.100.2 + atf_check -s exit:0 -o ignore \ + jexec one ping -c 1 -s 1200 198.51.100.2 + atf_check -s exit:0 -o ignore \ + jexec one ping -c 1 -s 2000 198.51.100.2 + + # Higher MTU on the tunnel than on the underlying interface + jexec one ifconfig ${epair}a mtu 1000 + jexec two ifconfig ${epair}b mtu 1000 + + atf_check -s exit:0 -o ignore \ + jexec one ping -c 1 -s 1200 198.51.100.2 + atf_check -s exit:0 -o ignore \ + jexec one ping -c 1 -s 2000 198.51.100.2 +} + +gif_cleanup() +{ + vnet_cleanup +} + atf_init_test_cases() { atf_add_test_case "bridge_transmit_ipv4_unicast" @@ -463,4 +528,5 @@ atf_init_test_cases() atf_add_test_case "delete_with_members" atf_add_test_case "mac_conflict" atf_add_test_case "stp_validation" + atf_add_test_case "gif" } From owner-dev-commits-src-all@freebsd.org Mon Aug 2 15:04:05 2021 Return-Path: Delivered-To: dev-commits-src-all@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 0FAE66758F7; Mon, 2 Aug 2021 15:04: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 4Gdh9J6ktPz4YZ0; Mon, 2 Aug 2021 15:04: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 CC96921A69; Mon, 2 Aug 2021 15:04: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 172F44Ow071373; Mon, 2 Aug 2021 15:04:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 172F44bi071372; Mon, 2 Aug 2021 15:04:04 GMT (envelope-from git) Date: Mon, 2 Aug 2021 15:04:04 GMT Message-Id: <202108021504.172F44bi071372@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 83dc038e594c - stable/12 - bridge tests: test linking bridges with a gif tunnel 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/stable/12 X-Git-Reftype: branch X-Git-Commit: 83dc038e594c6875ce44e79db2b8e494d53e5d5d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 15:04:05 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=83dc038e594c6875ce44e79db2b8e494d53e5d5d commit 83dc038e594c6875ce44e79db2b8e494d53e5d5d Author: Kristof Provost AuthorDate: 2021-07-21 15:32:24 +0000 Commit: Kristof Provost CommitDate: 2021-08-02 15:03:02 +0000 bridge tests: test linking bridges with a gif tunnel Fairly basic test case for using gif(4)'s ability to tunnel Ethernet traffic between bridges. MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 4b765ab4cda051a6d9ceb5fb9cac80c7f3b910bf) --- tests/sys/net/if_bridge_test.sh | 66 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/tests/sys/net/if_bridge_test.sh b/tests/sys/net/if_bridge_test.sh index 4703efed46b8..b029d8d60419 100755 --- a/tests/sys/net/if_bridge_test.sh +++ b/tests/sys/net/if_bridge_test.sh @@ -452,6 +452,71 @@ stp_validation_cleanup() vnet_cleanup } +atf_test_case "gif" "cleanup" +gif_head() +{ + atf_set descr 'gif as a bridge member' + atf_set require.user root +} + +gif_body() +{ + vnet_init + + epair=$(vnet_mkepair) + + vnet_mkjail one ${epair}a + vnet_mkjail two ${epair}b + + jexec one sysctl net.link.gif.max_nesting=2 + jexec two sysctl net.link.gif.max_nesting=2 + + jexec one ifconfig ${epair}a 192.0.2.1/24 up + jexec two ifconfig ${epair}b 192.0.2.2/24 up + + # Tunnel + gif_one=$(jexec one ifconfig gif create) + gif_two=$(jexec two ifconfig gif create) + + jexec one ifconfig ${gif_one} tunnel 192.0.2.1 192.0.2.2 + jexec one ifconfig ${gif_one} up + jexec two ifconfig ${gif_two} tunnel 192.0.2.2 192.0.2.1 + jexec two ifconfig ${gif_two} up + + bridge_one=$(jexec one ifconfig bridge create) + bridge_two=$(jexec two ifconfig bridge create) + jexec one ifconfig ${bridge_one} 198.51.100.1/24 up + jexec one ifconfig ${bridge_one} addm ${gif_one} + jexec two ifconfig ${bridge_two} 198.51.100.2/24 up + jexec two ifconfig ${bridge_two} addm ${gif_two} + + # Sanity check + atf_check -s exit:0 -o ignore \ + jexec one ping -c 1 192.0.2.2 + + # Test tunnel + atf_check -s exit:0 -o ignore \ + jexec one ping -c 1 198.51.100.2 + atf_check -s exit:0 -o ignore \ + jexec one ping -c 1 -s 1200 198.51.100.2 + atf_check -s exit:0 -o ignore \ + jexec one ping -c 1 -s 2000 198.51.100.2 + + # Higher MTU on the tunnel than on the underlying interface + jexec one ifconfig ${epair}a mtu 1000 + jexec two ifconfig ${epair}b mtu 1000 + + atf_check -s exit:0 -o ignore \ + jexec one ping -c 1 -s 1200 198.51.100.2 + atf_check -s exit:0 -o ignore \ + jexec one ping -c 1 -s 2000 198.51.100.2 +} + +gif_cleanup() +{ + vnet_cleanup +} + atf_init_test_cases() { atf_add_test_case "bridge_transmit_ipv4_unicast" @@ -463,4 +528,5 @@ atf_init_test_cases() atf_add_test_case "delete_with_members" atf_add_test_case "mac_conflict" atf_add_test_case "stp_validation" + atf_add_test_case "gif" } From owner-dev-commits-src-all@freebsd.org Mon Aug 2 15:04:05 2021 Return-Path: Delivered-To: dev-commits-src-all@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 B527A675C67; Mon, 2 Aug 2021 15:04: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 4Gdh9K32Bbz4YnG; Mon, 2 Aug 2021 15:04: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 38B25219D5; Mon, 2 Aug 2021 15:04: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 172F454k071397; Mon, 2 Aug 2021 15:04:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 172F45Ev071396; Mon, 2 Aug 2021 15:04:05 GMT (envelope-from git) Date: Mon, 2 Aug 2021 15:04:05 GMT Message-Id: <202108021504.172F45Ev071396@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 50ecd99be523 - stable/13 - bpf: Add an ioctl to set the VLAN Priority on packets sent by bpf 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 50ecd99be523213b05cd1abff3d484fa9702d647 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 15:04:05 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=50ecd99be523213b05cd1abff3d484fa9702d647 commit 50ecd99be523213b05cd1abff3d484fa9702d647 Author: Luiz Otavio O Souza AuthorDate: 2021-07-21 15:41:22 +0000 Commit: Kristof Provost CommitDate: 2021-08-02 14:50:32 +0000 bpf: Add an ioctl to set the VLAN Priority on packets sent by bpf This allows the use of VLAN PCP in dhclient, which is required for certain ISPs (such as Orange.fr). Reviewed by: bcr (man page) MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31263 (cherry picked from commit 1e7fe2fbb9c0bed230d8db94d7444a90ca5ce199) --- sbin/dhclient/bpf.c | 8 ++++++++ sbin/dhclient/clparse.c | 6 ++++++ sbin/dhclient/conflex.c | 2 ++ sbin/dhclient/dhclient.conf.5 | 9 ++++++++- sbin/dhclient/dhcpd.h | 1 + sbin/dhclient/dhctoken.h | 1 + share/man/man4/bpf.4 | 4 +++- sys/net/bpf.c | 43 +++++++++++++++++++++++++++++++++++++++++++ sys/net/bpf.h | 1 + sys/net/bpfdesc.h | 1 + 10 files changed, 74 insertions(+), 2 deletions(-) diff --git a/sbin/dhclient/bpf.c b/sbin/dhclient/bpf.c index 4a753fd27595..a50abca62fd3 100644 --- a/sbin/dhclient/bpf.c +++ b/sbin/dhclient/bpf.c @@ -90,6 +90,14 @@ if_register_bpf(struct interface_info *info, int flags) error("Can't attach interface %s to bpf device %s: %m", info->name, filename); + /* Tag the packets with the proper VLAN PCP setting. */ + if (info->client->config->vlan_pcp != 0) { + if (ioctl(sock, BIOCSETVLANPCP, + &info->client->config->vlan_pcp) < 0) + error( "Can't set the VLAN PCP tag on interface %s: %m", + info->name); + } + return (sock); } diff --git a/sbin/dhclient/clparse.c b/sbin/dhclient/clparse.c index 66695fd6b8f0..58ece525f8d1 100644 --- a/sbin/dhclient/clparse.c +++ b/sbin/dhclient/clparse.c @@ -76,6 +76,7 @@ read_client_conf(void) memset(&top_level_config, 0, sizeof(top_level_config)); /* Set some defaults... */ + top_level_config.vlan_pcp = 0; top_level_config.timeout = 60; top_level_config.select_interval = 0; top_level_config.reboot_timeout = 10; @@ -201,6 +202,7 @@ parse_client_statement(FILE *cfile, struct interface_info *ip, int token; char *val; struct option *option; + time_t tmp; switch (next_token(&val, cfile)) { case SEND: @@ -260,6 +262,10 @@ parse_client_statement(FILE *cfile, struct interface_info *ip, case REBOOT: parse_lease_time(cfile, &config->reboot_timeout); return; + case VLAN_PCP: + parse_lease_time(cfile, &tmp); + config->vlan_pcp = (u_int)tmp; + return; case BACKOFF_CUTOFF: parse_lease_time(cfile, &config->backoff_cutoff); return; diff --git a/sbin/dhclient/conflex.c b/sbin/dhclient/conflex.c index 66fc9e397125..c11c9189527e 100644 --- a/sbin/dhclient/conflex.c +++ b/sbin/dhclient/conflex.c @@ -524,6 +524,8 @@ intern(char *atom, int dfv) case 'v': if (!strcasecmp(atom + 1, "endor-class")) return (VENDOR_CLASS); + if (!strcasecmp(atom + 1, "lan-pcp")) + return (VLAN_PCP); break; case 'y': if (!strcasecmp(atom + 1, "iaddr")) diff --git a/sbin/dhclient/dhclient.conf.5 b/sbin/dhclient/dhclient.conf.5 index 2f28c5722574..14a0de4111dd 100644 --- a/sbin/dhclient/dhclient.conf.5 +++ b/sbin/dhclient/dhclient.conf.5 @@ -38,7 +38,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 31, 2018 +.Dd July 21, 2021 .Dt DHCLIENT.CONF 5 .Os .Sh NAME @@ -484,6 +484,13 @@ lease database and will record the media type used to acquire the address. Whenever the client tries to renew the lease, it will use that same media type. The lease must expire before the client will go back to cycling through media types. +.It Ic vlan-pcp Ar code ; +The +.Ic vlan-pcp +statement sets the PCP (Priority Code Point) value for the VLAN header. +This requires the +.Va net.link.vlan.mtag_pcp +sysctl to be set to 1. .El .Sh EXAMPLES The following configuration file is used on a laptop diff --git a/sbin/dhclient/dhcpd.h b/sbin/dhclient/dhcpd.h index 240a3ae23bda..b151daa90a1c 100644 --- a/sbin/dhclient/dhcpd.h +++ b/sbin/dhclient/dhcpd.h @@ -159,6 +159,7 @@ struct client_config { u_int8_t required_options[256]; u_int8_t requested_options[256]; int requested_option_count; + u_int vlan_pcp; time_t timeout; time_t initial_interval; time_t retry_interval; diff --git a/sbin/dhclient/dhctoken.h b/sbin/dhclient/dhctoken.h index 26c81aa734dc..c929307c7e06 100644 --- a/sbin/dhclient/dhctoken.h +++ b/sbin/dhclient/dhctoken.h @@ -133,6 +133,7 @@ #define AUTHORITATIVE 333 #define TOKEN_NOT 334 #define ALWAYS_REPLY_RFC1048 335 +#define VLAN_PCP 336 #define is_identifier(x) ((x) >= FIRST_TOKEN && \ (x) != STRING && \ diff --git a/share/man/man4/bpf.4 b/share/man/man4/bpf.4 index 200328891041..66f4ae72918b 100644 --- a/share/man/man4/bpf.4 +++ b/share/man/man4/bpf.4 @@ -49,7 +49,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 9, 2020 +.Dd July 22, 2021 .Dt BPF 4 .Os .Sh NAME @@ -659,6 +659,8 @@ therefore ownership is not assigned, the user process must check .Vt bzh_kernel_gen against .Vt bzh_user_gen . +.It Dv BIOCSETVLANPCP +Set the VLAN PCP bits to the supplied value. .El .Sh STANDARD IOCTLS .Nm diff --git a/sys/net/bpf.c b/sys/net/bpf.c index 605e7aa39fdb..0343c8f851be 100644 --- a/sys/net/bpf.c +++ b/sys/net/bpf.c @@ -78,6 +78,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -130,6 +131,7 @@ struct bpf_program_buffer { #if defined(DEV_BPF) || defined(NETGRAPH_BPF) #define PRINET 26 /* interruptible */ +#define BPF_PRIO_MAX 7 #define SIZEOF_BPF_HDR(type) \ (offsetof(type, bh_hdrlen) + sizeof(((type *)0)->bh_hdrlen)) @@ -969,6 +971,9 @@ bpfopen(struct cdev *dev, int flags, int fmt, struct thread *td) callout_init_mtx(&d->bd_callout, &d->bd_lock, 0); knlist_init_mtx(&d->bd_sel.si_note, &d->bd_lock); + /* Disable VLAN pcp tagging. */ + d->bd_pcp = 0; + return (0); } @@ -1159,6 +1164,27 @@ bpf_ready(struct bpf_d *d) return (0); } +static int +bpf_setpcp(struct mbuf *m, u_int8_t prio) +{ + struct m_tag *mtag; + + KASSERT(prio <= BPF_PRIO_MAX, + ("%s with invalid pcp", __func__)); + + mtag = m_tag_locate(m, MTAG_8021Q, MTAG_8021Q_PCP_OUT, NULL); + if (mtag == NULL) { + mtag = m_tag_alloc(MTAG_8021Q, MTAG_8021Q_PCP_OUT, + sizeof(uint8_t), M_NOWAIT); + if (mtag == NULL) + return (ENOMEM); + m_tag_prepend(m, mtag); + } + + *(uint8_t *)(mtag + 1) = prio; + return (0); +} + static int bpfwrite(struct cdev *dev, struct uio *uio, int ioflag) { @@ -1259,6 +1285,9 @@ bpfwrite(struct cdev *dev, struct uio *uio, int ioflag) ro.ro_flags = RT_HAS_HEADER; } + if (d->bd_pcp != 0) + bpf_setpcp(m, d->bd_pcp); + /* Avoid possible recursion on BPFD_LOCK(). */ NET_EPOCH_ENTER(et); BPFD_UNLOCK(d); @@ -1348,6 +1377,7 @@ reset_d(struct bpf_d *d) * BIOCROTZBUF Force rotation of zero-copy buffer * BIOCSETBUFMODE Set buffer mode. * BIOCGETBUFMODE Get current buffer mode. + * BIOCSETVLANPCP Set VLAN PCP tag. */ /* ARGSUSED */ static int @@ -1898,6 +1928,19 @@ bpfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, case BIOCROTZBUF: error = bpf_ioctl_rotzbuf(td, d, (struct bpf_zbuf *)addr); break; + + case BIOCSETVLANPCP: + { + u_int pcp; + + pcp = *(u_int *)addr; + if (pcp > BPF_PRIO_MAX || pcp < 0) { + error = EINVAL; + break; + } + d->bd_pcp = pcp; + break; + } } CURVNET_RESTORE(); return (error); diff --git a/sys/net/bpf.h b/sys/net/bpf.h index 54bbfd23bba2..b7cd8036856c 100644 --- a/sys/net/bpf.h +++ b/sys/net/bpf.h @@ -153,6 +153,7 @@ struct bpf_zbuf { #define BIOCSETFNR _IOW('B', 130, struct bpf_program) #define BIOCGTSTAMP _IOR('B', 131, u_int) #define BIOCSTSTAMP _IOW('B', 132, u_int) +#define BIOCSETVLANPCP _IOW('B', 133, u_int) /* Obsolete */ #define BIOCGSEESENT BIOCGDIRECTION diff --git a/sys/net/bpfdesc.h b/sys/net/bpfdesc.h index be978280311d..52cc5f130eb3 100644 --- a/sys/net/bpfdesc.h +++ b/sys/net/bpfdesc.h @@ -91,6 +91,7 @@ struct bpf_d { int bd_feedback; /* true to feed back sent packets */ int bd_async; /* non-zero if packet reception should generate signal */ int bd_sig; /* signal to send upon packet reception */ + int bd_pcp; /* VLAN pcp tag */ struct sigio * bd_sigio; /* information for async I/O */ struct selinfo bd_sel; /* bsd select info */ struct mtx bd_lock; /* per-descriptor lock */ From owner-dev-commits-src-all@freebsd.org Mon Aug 2 15:04:07 2021 Return-Path: Delivered-To: dev-commits-src-all@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 D2150675E1A; Mon, 2 Aug 2021 15:04: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 4Gdh9M2wmQz4YWp; Mon, 2 Aug 2021 15:04: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 0C03021863; Mon, 2 Aug 2021 15:04: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 172F46Cu071469; Mon, 2 Aug 2021 15:04:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 172F46kl071468; Mon, 2 Aug 2021 15:04:06 GMT (envelope-from git) Date: Mon, 2 Aug 2021 15:04:06 GMT Message-Id: <202108021504.172F46kl071468@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: e22a6a4fbfaf - stable/12 - tests: basic VLAN test 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/stable/12 X-Git-Reftype: branch X-Git-Commit: e22a6a4fbfaf02c4a76542e1cfad76a8194c0290 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 15:04:08 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=e22a6a4fbfaf02c4a76542e1cfad76a8194c0290 commit e22a6a4fbfaf02c4a76542e1cfad76a8194c0290 Author: Kristof Provost AuthorDate: 2019-10-15 04:50:08 +0000 Commit: Kristof Provost CommitDate: 2021-08-02 15:03:02 +0000 tests: basic VLAN test Set up two jails connected by an epair. Create VLAN interfaces in both jails and check connectivity. This is a very basic test, but exposed panics during the network stack epoch work, so this is worth testing. (cherry picked from commit fcd69db27dc93796374600938e4fcf5544aa2a06) --- tests/sys/net/Makefile | 1 + tests/sys/net/if_vlan.sh | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/tests/sys/net/Makefile b/tests/sys/net/Makefile index 77c3c833a186..0a6f2a5ea292 100644 --- a/tests/sys/net/Makefile +++ b/tests/sys/net/Makefile @@ -10,6 +10,7 @@ ATF_TESTS_SH+= if_bridge_test ATF_TESTS_SH+= if_clone_test ATF_TESTS_SH+= if_lagg_test ATF_TESTS_SH+= if_tun_test +ATF_TESTS_SH+= if_vlan # The tests are written to be run in parallel, but doing so leads to random # panics. I think it's because the kernel's list of interfaces isn't properly diff --git a/tests/sys/net/if_vlan.sh b/tests/sys/net/if_vlan.sh new file mode 100755 index 000000000000..60b799b25675 --- /dev/null +++ b/tests/sys/net/if_vlan.sh @@ -0,0 +1,42 @@ +# $FreeBSD$ + +. $(atf_get_srcdir)/../common/vnet.subr + +atf_test_case "basic" "cleanup" +basic_head() +{ + atf_set descr 'Basic VLAN test' + atf_set require.user root +} + +basic_body() +{ + vnet_init + + epair_vlan=$(vnet_mkepair) + + vnet_mkjail alcatraz ${epair_vlan}a + vnet_mkjail singsing ${epair_vlan}b + + vlan0=$(jexec alcatraz ifconfig vlan create vlandev ${epair_vlan}a \ + vlan 42) + jexec alcatraz ifconfig ${epair_vlan}a up + jexec alcatraz ifconfig ${vlan0} 10.0.0.1/24 up + + vlan1=$(jexec singsing ifconfig vlan create vlandev ${epair_vlan}b \ + vlan 42) + jexec singsing ifconfig ${epair_vlan}b up + jexec singsing ifconfig ${vlan1} 10.0.0.2/24 up + + atf_check -s exit:0 -o ignore jexec singsing ping -c 1 10.0.0.1 +} + +basic_cleanup() +{ + vnet_cleanup +} + +atf_init_test_cases() +{ + atf_add_test_case "basic" +} From owner-dev-commits-src-all@freebsd.org Mon Aug 2 15:04:08 2021 Return-Path: Delivered-To: dev-commits-src-all@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 2B8146759D2; Mon, 2 Aug 2021 15:04: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 4Gdh9M4gMLz4YQl; Mon, 2 Aug 2021 15:04: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 79F3421671; Mon, 2 Aug 2021 15:04: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 172F47aE071493; Mon, 2 Aug 2021 15:04:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 172F47h8071492; Mon, 2 Aug 2021 15:04:07 GMT (envelope-from git) Date: Mon, 2 Aug 2021 15:04:07 GMT Message-Id: <202108021504.172F47h8071492@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 60c9798db74d - stable/13 - net tests: basic test case for bpf(4)'s ability to set vlan pcp 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 60c9798db74d0b04dcbb4162d155ecd6b38c0e52 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 15:04:08 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=60c9798db74d0b04dcbb4162d155ecd6b38c0e52 commit 60c9798db74d0b04dcbb4162d155ecd6b38c0e52 Author: Kristof Provost AuthorDate: 2021-07-22 12:50:27 +0000 Commit: Kristof Provost CommitDate: 2021-08-02 14:50:32 +0000 net tests: basic test case for bpf(4)'s ability to set vlan pcp Use dhclient with its 'vlan-pcp' option to set a VLAN PCP value and verify that it actually gets set. MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31276 (cherry picked from commit 3e87f800f01b6d2cbe49924a01038379889d8b3b) --- tests/sys/net/Makefile | 3 ++ tests/sys/net/dhclient_pcp.conf | 1 + tests/sys/net/if_vlan.sh | 47 +++++++++++++++++++++++ tests/sys/net/pcp.py | 74 +++++++++++++++++++++++++++++++++++++ tests/sys/netpfil/common/sniffer.py | 12 ++++-- 5 files changed, 134 insertions(+), 3 deletions(-) diff --git a/tests/sys/net/Makefile b/tests/sys/net/Makefile index 40b3a5e5fff6..4771040816b7 100644 --- a/tests/sys/net/Makefile +++ b/tests/sys/net/Makefile @@ -21,8 +21,11 @@ TESTS_SUBDIRS+= routing TEST_METADATA+= is_exclusive=true ${PACKAGE}FILES+= \ + dhclient_pcp.conf \ + pcp.py \ stp.py +${PACKAGE}FILESMODE_pcp.py= 0555 ${PACKAGE}FILESMODE_stp.py= 0555 MAN= diff --git a/tests/sys/net/dhclient_pcp.conf b/tests/sys/net/dhclient_pcp.conf new file mode 100644 index 000000000000..fbd86e5bd0f8 --- /dev/null +++ b/tests/sys/net/dhclient_pcp.conf @@ -0,0 +1 @@ +vlan-pcp 6; diff --git a/tests/sys/net/if_vlan.sh b/tests/sys/net/if_vlan.sh index 2edcb16eab88..517206cb55c7 100755 --- a/tests/sys/net/if_vlan.sh +++ b/tests/sys/net/if_vlan.sh @@ -210,6 +210,52 @@ qinq_dot_cleanup() vnet_cleanup } +atf_test_case "bpf_pcp" "cleanup" +bpf_pcp_head() +{ + atf_set descr 'Set VLAN PCP through BPF' + atf_set require.config 'allow_sysctl_side_effects' + atf_set require.user root + atf_set require.progs scapy +} + +bpf_pcp_body() +{ + vnet_init + + epair=$(vnet_mkepair) + + ifconfig ${epair}a up + + vnet_mkjail alcatraz ${epair}b + vlan=$(jexec alcatraz ifconfig vlan create) + jexec alcatraz ifconfig ${vlan} vlan 42 vlandev ${epair}b + jexec alcatraz ifconfig ${vlan} up + jexec alcatraz ifconfig ${epair}b up + + sysctl net.link.vlan.mtag_pcp=1 + + jexec alcatraz dhclient ${vlan} & + atf_check -s exit:1 -o ignore -e ignore $(atf_get_srcdir)/pcp.py \ + --expect-pcp 6 \ + --recvif ${epair}a + + jexec alcatraz killall dhclient + sleep 1 + + jexec alcatraz dhclient -c $(atf_get_srcdir)/dhclient_pcp.conf ${vlan} & + atf_check -s exit:0 -o ignore -e ignore $(atf_get_srcdir)/pcp.py \ + --expect-pcp 6 \ + --recvif ${epair}a +} + +bpf_pcp_cleanup() +{ + sysctl net.link.vlan.mtag_pcp=0 + jexec alcatraz killall dhclient + vnet_cleanup +} + atf_init_test_cases() { atf_add_test_case "basic" @@ -217,4 +263,5 @@ atf_init_test_cases() atf_add_test_case "qinq_deep" atf_add_test_case "qinq_legacy" atf_add_test_case "qinq_dot" + atf_add_test_case "bpf_pcp" } diff --git a/tests/sys/net/pcp.py b/tests/sys/net/pcp.py new file mode 100644 index 000000000000..cea88faaf438 --- /dev/null +++ b/tests/sys/net/pcp.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python3 +# +# SPDX-License-Identifier: BSD-2-Clause +# +# Copyright (c) 2021 Rubicon Communications, LLC (Netgate). +# +# 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. + +import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) +import scapy.all as sp +import sys +import os +curdir = os.path.dirname(os.path.realpath(__file__)) +netpfil_common = curdir + "/../netpfil/common" +sys.path.append(netpfil_common) +from sniffer import Sniffer + +def check_pcp(args, packet): + vlan = packet.getlayer(sp.Dot1Q) + + if vlan is None: + return False + + if not packet.getlayer(sp.BOOTP): + return False + + if vlan.prio == int(args.expect_pcp[0]): + return True + + return False + +def main(): + parser = argparse.ArgumentParser("pcp.py", + description="PCP test tool") + parser.add_argument('--recvif', nargs=1, + required=True, + help='The interface where to look for packets to check') + parser.add_argument('--expect-pcp', nargs=1, + help='The expected PCP value on VLAN packets') + + args = parser.parse_args() + + sniffer = Sniffer(args, check_pcp, recvif=args.recvif[0], timeout=20) + + sniffer.join() + + if sniffer.foundCorrectPacket: + sys.exit(0) + + sys.exit(1) + +if __name__ == '__main__': + main() diff --git a/tests/sys/netpfil/common/sniffer.py b/tests/sys/netpfil/common/sniffer.py index 200ac750dd7f..a7ebfc122573 100644 --- a/tests/sys/netpfil/common/sniffer.py +++ b/tests/sys/netpfil/common/sniffer.py @@ -28,12 +28,14 @@ import threading import scapy.all as sp +import sys class Sniffer(threading.Thread): - def __init__(self, args, check_function, recvif=None): + def __init__(self, args, check_function, recvif=None, timeout=3): threading.Thread.__init__(self) self._args = args + self._timeout = timeout if recvif is not None: self._recvif = recvif else: @@ -50,5 +52,9 @@ class Sniffer(threading.Thread): return ret def run(self): - self.packets = sp.sniff(iface=self._recvif, - stop_filter=self._checkPacket, timeout=3) + self.packets = [] + try: + self.packets = sp.sniff(iface=self._recvif, + stop_filter=self._checkPacket, timeout=self._timeout) + except Exception as e: + print(e, file=sys.stderr) From owner-dev-commits-src-all@freebsd.org Mon Aug 2 15:04:07 2021 Return-Path: Delivered-To: dev-commits-src-all@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 1A35F675DFC; Mon, 2 Aug 2021 15:04: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 4Gdh9L4Fgzz4YWm; Mon, 2 Aug 2021 15:04: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 62B3321862; Mon, 2 Aug 2021 15:04:06 +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 172F464F071445; Mon, 2 Aug 2021 15:04:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 172F46rT071444; Mon, 2 Aug 2021 15:04:06 GMT (envelope-from git) Date: Mon, 2 Aug 2021 15:04:06 GMT Message-Id: <202108021504.172F46rT071444@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: c9ef3984a1a7 - stable/13 - vlan: deduplicate bpf_setpcp() and pf_ieee8021q_setpcp() 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/stable/13 X-Git-Reftype: branch X-Git-Commit: c9ef3984a1a73cf0d5b0922383d85b0f36ea4ee3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 15:04:07 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=c9ef3984a1a73cf0d5b0922383d85b0f36ea4ee3 commit c9ef3984a1a73cf0d5b0922383d85b0f36ea4ee3 Author: Kristof Provost AuthorDate: 2021-07-22 08:35:08 +0000 Commit: Kristof Provost CommitDate: 2021-08-02 14:50:32 +0000 vlan: deduplicate bpf_setpcp() and pf_ieee8021q_setpcp() These two fuctions were identical, so move them into the common vlan_set_pcp() function, exposed in the if_vlan_var.h header. Reviewed by: donner MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31275 (cherry picked from commit 9ef8cd0b7906371803421aa897056b6fc0710fcb) --- sys/net/bpf.c | 23 +---------------------- sys/net/if_vlan.c | 2 +- sys/net/if_vlan_var.h | 26 ++++++++++++++++++++++++++ sys/netpfil/pf/pf.c | 25 ++----------------------- 4 files changed, 30 insertions(+), 46 deletions(-) diff --git a/sys/net/bpf.c b/sys/net/bpf.c index 0343c8f851be..6ae0699c949f 100644 --- a/sys/net/bpf.c +++ b/sys/net/bpf.c @@ -1164,27 +1164,6 @@ bpf_ready(struct bpf_d *d) return (0); } -static int -bpf_setpcp(struct mbuf *m, u_int8_t prio) -{ - struct m_tag *mtag; - - KASSERT(prio <= BPF_PRIO_MAX, - ("%s with invalid pcp", __func__)); - - mtag = m_tag_locate(m, MTAG_8021Q, MTAG_8021Q_PCP_OUT, NULL); - if (mtag == NULL) { - mtag = m_tag_alloc(MTAG_8021Q, MTAG_8021Q_PCP_OUT, - sizeof(uint8_t), M_NOWAIT); - if (mtag == NULL) - return (ENOMEM); - m_tag_prepend(m, mtag); - } - - *(uint8_t *)(mtag + 1) = prio; - return (0); -} - static int bpfwrite(struct cdev *dev, struct uio *uio, int ioflag) { @@ -1286,7 +1265,7 @@ bpfwrite(struct cdev *dev, struct uio *uio, int ioflag) } if (d->bd_pcp != 0) - bpf_setpcp(m, d->bd_pcp); + vlan_set_pcp(m, d->bd_pcp); /* Avoid possible recursion on BPFD_LOCK(). */ NET_EPOCH_ENTER(et); diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c index bd3a5335a97f..2ff584a059e9 100644 --- a/sys/net/if_vlan.c +++ b/sys/net/if_vlan.c @@ -2037,7 +2037,7 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) error = priv_check(curthread, PRIV_NET_SETVLANPCP); if (error) break; - if (ifr->ifr_vlan_pcp > 7) { + if (ifr->ifr_vlan_pcp > VLAN_PCP_MAX) { error = EINVAL; break; } diff --git a/sys/net/if_vlan_var.h b/sys/net/if_vlan_var.h index 1b9540f18a3e..91bed40c43a6 100644 --- a/sys/net/if_vlan_var.h +++ b/sys/net/if_vlan_var.h @@ -32,6 +32,8 @@ #ifndef _NET_IF_VLAN_VAR_H_ #define _NET_IF_VLAN_VAR_H_ 1 +#include + /* Set the VLAN ID in an mbuf packet header non-destructively. */ #define EVL_APPLY_VLID(m, vlid) \ do { \ @@ -124,6 +126,8 @@ struct vlanreq { #define MTAG_8021Q_PCP_IN 0 /* Input priority. */ #define MTAG_8021Q_PCP_OUT 1 /* Output priority. */ +#define VLAN_PCP_MAX 7 + /* * 802.1q full tag. Proto and vid are stored in host byte order. */ @@ -168,6 +172,28 @@ typedef void (*vlan_unconfig_fn)(void *, struct ifnet *, uint16_t); EVENTHANDLER_DECLARE(vlan_config, vlan_config_fn); EVENTHANDLER_DECLARE(vlan_unconfig, vlan_unconfig_fn); +static inline int +vlan_set_pcp(struct mbuf *m, uint8_t prio) +{ + struct m_tag *mtag; + + KASSERT(prio <= VLAN_PCP_MAX, + ("%s with invalid pcp", __func__)); + + mtag = m_tag_locate(m, MTAG_8021Q, MTAG_8021Q_PCP_OUT, NULL); + if (mtag == NULL) { + mtag = m_tag_alloc(MTAG_8021Q, MTAG_8021Q_PCP_OUT, + sizeof(uint8_t), M_NOWAIT); + if (mtag == NULL) + return (ENOMEM); + m_tag_prepend(m, mtag); + } + + *(uint8_t *)(mtag + 1) = prio; + + return (0); +} + #endif /* _KERNEL */ #endif /* _NET_IF_VLAN_VAR_H_ */ diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 87912046f8d3..3f954497dc20 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -2715,27 +2715,6 @@ pf_return(struct pf_krule *r, struct pf_krule *nr, struct pf_pdesc *pd, r->return_icmp6 & 255, af, r); } -static int -pf_ieee8021q_setpcp(struct mbuf *m, u_int8_t prio) -{ - struct m_tag *mtag; - - KASSERT(prio <= PF_PRIO_MAX, - ("%s with invalid pcp", __func__)); - - mtag = m_tag_locate(m, MTAG_8021Q, MTAG_8021Q_PCP_OUT, NULL); - if (mtag == NULL) { - mtag = m_tag_alloc(MTAG_8021Q, MTAG_8021Q_PCP_OUT, - sizeof(uint8_t), M_NOWAIT); - if (mtag == NULL) - return (ENOMEM); - m_tag_prepend(m, mtag); - } - - *(uint8_t *)(mtag + 1) = prio; - return (0); -} - static int pf_match_ieee8021q_pcp(u_int8_t prio, struct mbuf *m) { @@ -6266,7 +6245,7 @@ done: if (r->scrub_flags & PFSTATE_SETPRIO) { if (pd.tos & IPTOS_LOWDELAY) pqid = 1; - if (pf_ieee8021q_setpcp(m, r->set_prio[pqid])) { + if (vlan_set_pcp(m, r->set_prio[pqid])) { action = PF_DROP; REASON_SET(&reason, PFRES_MEMORY); log = 1; @@ -6713,7 +6692,7 @@ done: if (r->scrub_flags & PFSTATE_SETPRIO) { if (pd.tos & IPTOS_LOWDELAY) pqid = 1; - if (pf_ieee8021q_setpcp(m, r->set_prio[pqid])) { + if (vlan_set_pcp(m, r->set_prio[pqid])) { action = PF_DROP; REASON_SET(&reason, PFRES_MEMORY); log = 1; From owner-dev-commits-src-all@freebsd.org Mon Aug 2 15:04:07 2021 Return-Path: Delivered-To: dev-commits-src-all@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 1F9CE675C6B; Mon, 2 Aug 2021 15:04: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 4Gdh9L42WPz4YQh; Mon, 2 Aug 2021 15:04: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 DB61E217BB; Mon, 2 Aug 2021 15:04: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 172F45YC071421; Mon, 2 Aug 2021 15:04:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 172F45iR071420; Mon, 2 Aug 2021 15:04:05 GMT (envelope-from git) Date: Mon, 2 Aug 2021 15:04:05 GMT Message-Id: <202108021504.172F45iR071420@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 766bd3d6b0b8 - stable/12 - bpf: Add an ioctl to set the VLAN Priority on packets sent by bpf 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/stable/12 X-Git-Reftype: branch X-Git-Commit: 766bd3d6b0b82bfb37a8907aa64eea542646d8b4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 15:04:07 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=766bd3d6b0b82bfb37a8907aa64eea542646d8b4 commit 766bd3d6b0b82bfb37a8907aa64eea542646d8b4 Author: Luiz Otavio O Souza AuthorDate: 2021-07-21 15:41:22 +0000 Commit: Kristof Provost CommitDate: 2021-08-02 15:03:02 +0000 bpf: Add an ioctl to set the VLAN Priority on packets sent by bpf This allows the use of VLAN PCP in dhclient, which is required for certain ISPs (such as Orange.fr). Reviewed by: bcr (man page) MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31263 (cherry picked from commit 1e7fe2fbb9c0bed230d8db94d7444a90ca5ce199) --- sbin/dhclient/bpf.c | 8 ++++++++ sbin/dhclient/clparse.c | 6 ++++++ sbin/dhclient/conflex.c | 2 ++ sbin/dhclient/dhclient.conf.5 | 9 ++++++++- sbin/dhclient/dhcpd.h | 1 + sbin/dhclient/dhctoken.h | 1 + share/man/man4/bpf.4 | 4 +++- sys/net/bpf.c | 43 +++++++++++++++++++++++++++++++++++++++++++ sys/net/bpf.h | 1 + sys/net/bpfdesc.h | 1 + 10 files changed, 74 insertions(+), 2 deletions(-) diff --git a/sbin/dhclient/bpf.c b/sbin/dhclient/bpf.c index 4a753fd27595..a50abca62fd3 100644 --- a/sbin/dhclient/bpf.c +++ b/sbin/dhclient/bpf.c @@ -90,6 +90,14 @@ if_register_bpf(struct interface_info *info, int flags) error("Can't attach interface %s to bpf device %s: %m", info->name, filename); + /* Tag the packets with the proper VLAN PCP setting. */ + if (info->client->config->vlan_pcp != 0) { + if (ioctl(sock, BIOCSETVLANPCP, + &info->client->config->vlan_pcp) < 0) + error( "Can't set the VLAN PCP tag on interface %s: %m", + info->name); + } + return (sock); } diff --git a/sbin/dhclient/clparse.c b/sbin/dhclient/clparse.c index 66695fd6b8f0..58ece525f8d1 100644 --- a/sbin/dhclient/clparse.c +++ b/sbin/dhclient/clparse.c @@ -76,6 +76,7 @@ read_client_conf(void) memset(&top_level_config, 0, sizeof(top_level_config)); /* Set some defaults... */ + top_level_config.vlan_pcp = 0; top_level_config.timeout = 60; top_level_config.select_interval = 0; top_level_config.reboot_timeout = 10; @@ -201,6 +202,7 @@ parse_client_statement(FILE *cfile, struct interface_info *ip, int token; char *val; struct option *option; + time_t tmp; switch (next_token(&val, cfile)) { case SEND: @@ -260,6 +262,10 @@ parse_client_statement(FILE *cfile, struct interface_info *ip, case REBOOT: parse_lease_time(cfile, &config->reboot_timeout); return; + case VLAN_PCP: + parse_lease_time(cfile, &tmp); + config->vlan_pcp = (u_int)tmp; + return; case BACKOFF_CUTOFF: parse_lease_time(cfile, &config->backoff_cutoff); return; diff --git a/sbin/dhclient/conflex.c b/sbin/dhclient/conflex.c index 66fc9e397125..c11c9189527e 100644 --- a/sbin/dhclient/conflex.c +++ b/sbin/dhclient/conflex.c @@ -524,6 +524,8 @@ intern(char *atom, int dfv) case 'v': if (!strcasecmp(atom + 1, "endor-class")) return (VENDOR_CLASS); + if (!strcasecmp(atom + 1, "lan-pcp")) + return (VLAN_PCP); break; case 'y': if (!strcasecmp(atom + 1, "iaddr")) diff --git a/sbin/dhclient/dhclient.conf.5 b/sbin/dhclient/dhclient.conf.5 index 2f28c5722574..14a0de4111dd 100644 --- a/sbin/dhclient/dhclient.conf.5 +++ b/sbin/dhclient/dhclient.conf.5 @@ -38,7 +38,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 31, 2018 +.Dd July 21, 2021 .Dt DHCLIENT.CONF 5 .Os .Sh NAME @@ -484,6 +484,13 @@ lease database and will record the media type used to acquire the address. Whenever the client tries to renew the lease, it will use that same media type. The lease must expire before the client will go back to cycling through media types. +.It Ic vlan-pcp Ar code ; +The +.Ic vlan-pcp +statement sets the PCP (Priority Code Point) value for the VLAN header. +This requires the +.Va net.link.vlan.mtag_pcp +sysctl to be set to 1. .El .Sh EXAMPLES The following configuration file is used on a laptop diff --git a/sbin/dhclient/dhcpd.h b/sbin/dhclient/dhcpd.h index 240a3ae23bda..b151daa90a1c 100644 --- a/sbin/dhclient/dhcpd.h +++ b/sbin/dhclient/dhcpd.h @@ -159,6 +159,7 @@ struct client_config { u_int8_t required_options[256]; u_int8_t requested_options[256]; int requested_option_count; + u_int vlan_pcp; time_t timeout; time_t initial_interval; time_t retry_interval; diff --git a/sbin/dhclient/dhctoken.h b/sbin/dhclient/dhctoken.h index 26c81aa734dc..c929307c7e06 100644 --- a/sbin/dhclient/dhctoken.h +++ b/sbin/dhclient/dhctoken.h @@ -133,6 +133,7 @@ #define AUTHORITATIVE 333 #define TOKEN_NOT 334 #define ALWAYS_REPLY_RFC1048 335 +#define VLAN_PCP 336 #define is_identifier(x) ((x) >= FIRST_TOKEN && \ (x) != STRING && \ diff --git a/share/man/man4/bpf.4 b/share/man/man4/bpf.4 index 200328891041..66f4ae72918b 100644 --- a/share/man/man4/bpf.4 +++ b/share/man/man4/bpf.4 @@ -49,7 +49,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 9, 2020 +.Dd July 22, 2021 .Dt BPF 4 .Os .Sh NAME @@ -659,6 +659,8 @@ therefore ownership is not assigned, the user process must check .Vt bzh_kernel_gen against .Vt bzh_user_gen . +.It Dv BIOCSETVLANPCP +Set the VLAN PCP bits to the supplied value. .El .Sh STANDARD IOCTLS .Nm diff --git a/sys/net/bpf.c b/sys/net/bpf.c index 699679369c2d..7e0af0cfebc0 100644 --- a/sys/net/bpf.c +++ b/sys/net/bpf.c @@ -76,6 +76,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -125,6 +126,7 @@ CTASSERT(offsetof(struct bpf_if, bif_ext) == 0); #if defined(DEV_BPF) || defined(NETGRAPH_BPF) #define PRINET 26 /* interruptible */ +#define BPF_PRIO_MAX 7 #define SIZEOF_BPF_HDR(type) \ (offsetof(type, bh_hdrlen) + sizeof(((type *)0)->bh_hdrlen)) @@ -927,6 +929,9 @@ bpfopen(struct cdev *dev, int flags, int fmt, struct thread *td) callout_init_mtx(&d->bd_callout, &d->bd_lock, 0); knlist_init_mtx(&d->bd_sel.si_note, &d->bd_lock); + /* Disable VLAN pcp tagging. */ + d->bd_pcp = 0; + return (0); } @@ -1116,6 +1121,27 @@ bpf_ready(struct bpf_d *d) return (0); } +static int +bpf_setpcp(struct mbuf *m, u_int8_t prio) +{ + struct m_tag *mtag; + + KASSERT(prio <= BPF_PRIO_MAX, + ("%s with invalid pcp", __func__)); + + mtag = m_tag_locate(m, MTAG_8021Q, MTAG_8021Q_PCP_OUT, NULL); + if (mtag == NULL) { + mtag = m_tag_alloc(MTAG_8021Q, MTAG_8021Q_PCP_OUT, + sizeof(uint8_t), M_NOWAIT); + if (mtag == NULL) + return (ENOMEM); + m_tag_prepend(m, mtag); + } + + *(uint8_t *)(mtag + 1) = prio; + return (0); +} + static int bpfwrite(struct cdev *dev, struct uio *uio, int ioflag) { @@ -1194,6 +1220,9 @@ bpfwrite(struct cdev *dev, struct uio *uio, int ioflag) ro.ro_flags = RT_HAS_HEADER; } + if (d->bd_pcp != 0) + bpf_setpcp(m, d->bd_pcp); + error = (*ifp->if_output)(ifp, m, &dst, &ro); if (error) counter_u64_add(d->bd_wdcount, 1); @@ -1273,6 +1302,7 @@ reset_d(struct bpf_d *d) * BIOCROTZBUF Force rotation of zero-copy buffer * BIOCSETBUFMODE Set buffer mode. * BIOCGETBUFMODE Get current buffer mode. + * BIOCSETVLANPCP Set VLAN PCP tag. */ /* ARGSUSED */ static int @@ -1824,6 +1854,19 @@ bpfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, case BIOCROTZBUF: error = bpf_ioctl_rotzbuf(td, d, (struct bpf_zbuf *)addr); break; + + case BIOCSETVLANPCP: + { + u_int pcp; + + pcp = *(u_int *)addr; + if (pcp > BPF_PRIO_MAX || pcp < 0) { + error = EINVAL; + break; + } + d->bd_pcp = pcp; + break; + } } CURVNET_RESTORE(); return (error); diff --git a/sys/net/bpf.h b/sys/net/bpf.h index 4e62ed387f23..7a81962c4b3c 100644 --- a/sys/net/bpf.h +++ b/sys/net/bpf.h @@ -149,6 +149,7 @@ struct bpf_zbuf { #define BIOCSETFNR _IOW('B', 130, struct bpf_program) #define BIOCGTSTAMP _IOR('B', 131, u_int) #define BIOCSTSTAMP _IOW('B', 132, u_int) +#define BIOCSETVLANPCP _IOW('B', 133, u_int) /* Obsolete */ #define BIOCGSEESENT BIOCGDIRECTION diff --git a/sys/net/bpfdesc.h b/sys/net/bpfdesc.h index 7d23e06ec3a3..8baa759faed3 100644 --- a/sys/net/bpfdesc.h +++ b/sys/net/bpfdesc.h @@ -90,6 +90,7 @@ struct bpf_d { int bd_feedback; /* true to feed back sent packets */ int bd_async; /* non-zero if packet reception should generate signal */ int bd_sig; /* signal to send upon packet reception */ + int bd_pcp; /* VLAN pcp tag */ struct sigio * bd_sigio; /* information for async I/O */ struct selinfo bd_sel; /* bsd select info */ struct mtx bd_lock; /* per-descriptor lock */ From owner-dev-commits-src-all@freebsd.org Mon Aug 2 15:04:09 2021 Return-Path: Delivered-To: dev-commits-src-all@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 3B1B0675E86; Mon, 2 Aug 2021 15:04: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 4Gdh9N2zBCz4YTk; Mon, 2 Aug 2021 15:04: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 346D121B71; Mon, 2 Aug 2021 15:04: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 172F48b6071517; Mon, 2 Aug 2021 15:04:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 172F483k071516; Mon, 2 Aug 2021 15:04:08 GMT (envelope-from git) Date: Mon, 2 Aug 2021 15:04:08 GMT Message-Id: <202108021504.172F483k071516@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 40dfe99449af - stable/12 - net tests: basic test case for bpf(4)'s ability to set vlan pcp 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/stable/12 X-Git-Reftype: branch X-Git-Commit: 40dfe99449af99ad56775ac4fd144b4e1db3c72f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 15:04:09 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=40dfe99449af99ad56775ac4fd144b4e1db3c72f commit 40dfe99449af99ad56775ac4fd144b4e1db3c72f Author: Kristof Provost AuthorDate: 2021-07-22 12:50:27 +0000 Commit: Kristof Provost CommitDate: 2021-08-02 15:03:03 +0000 net tests: basic test case for bpf(4)'s ability to set vlan pcp Use dhclient with its 'vlan-pcp' option to set a VLAN PCP value and verify that it actually gets set. MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31276 (cherry picked from commit 3e87f800f01b6d2cbe49924a01038379889d8b3b) --- tests/sys/net/Makefile | 3 ++ tests/sys/net/dhclient_pcp.conf | 1 + tests/sys/net/if_vlan.sh | 47 +++++++++++++++++++++++ tests/sys/net/pcp.py | 74 +++++++++++++++++++++++++++++++++++++ tests/sys/netpfil/common/sniffer.py | 12 ++++-- 5 files changed, 134 insertions(+), 3 deletions(-) diff --git a/tests/sys/net/Makefile b/tests/sys/net/Makefile index 0a6f2a5ea292..cccabd9fc775 100644 --- a/tests/sys/net/Makefile +++ b/tests/sys/net/Makefile @@ -18,8 +18,11 @@ ATF_TESTS_SH+= if_vlan TEST_METADATA+= is_exclusive=true ${PACKAGE}FILES+= \ + dhclient_pcp.conf \ + pcp.py \ stp.py +${PACKAGE}FILESMODE_pcp.py= 0555 ${PACKAGE}FILESMODE_stp.py= 0555 MAN= diff --git a/tests/sys/net/dhclient_pcp.conf b/tests/sys/net/dhclient_pcp.conf new file mode 100644 index 000000000000..fbd86e5bd0f8 --- /dev/null +++ b/tests/sys/net/dhclient_pcp.conf @@ -0,0 +1 @@ +vlan-pcp 6; diff --git a/tests/sys/net/if_vlan.sh b/tests/sys/net/if_vlan.sh index 60b799b25675..2ffc82e017a3 100755 --- a/tests/sys/net/if_vlan.sh +++ b/tests/sys/net/if_vlan.sh @@ -36,7 +36,54 @@ basic_cleanup() vnet_cleanup } +atf_test_case "bpf_pcp" "cleanup" +bpf_pcp_head() +{ + atf_set descr 'Set VLAN PCP through BPF' + atf_set require.config 'allow_sysctl_side_effects' + atf_set require.user root + atf_set require.progs scapy +} + +bpf_pcp_body() +{ + vnet_init + + epair=$(vnet_mkepair) + + ifconfig ${epair}a up + + vnet_mkjail alcatraz ${epair}b + vlan=$(jexec alcatraz ifconfig vlan create) + jexec alcatraz ifconfig ${vlan} vlan 42 vlandev ${epair}b + jexec alcatraz ifconfig ${vlan} up + jexec alcatraz ifconfig ${epair}b up + + sysctl net.link.vlan.mtag_pcp=1 + + jexec alcatraz dhclient ${vlan} & + atf_check -s exit:1 -o ignore -e ignore $(atf_get_srcdir)/pcp.py \ + --expect-pcp 6 \ + --recvif ${epair}a + + jexec alcatraz killall dhclient + sleep 1 + + jexec alcatraz dhclient -c $(atf_get_srcdir)/dhclient_pcp.conf ${vlan} & + atf_check -s exit:0 -o ignore -e ignore $(atf_get_srcdir)/pcp.py \ + --expect-pcp 6 \ + --recvif ${epair}a +} + +bpf_pcp_cleanup() +{ + sysctl net.link.vlan.mtag_pcp=0 + jexec alcatraz killall dhclient + vnet_cleanup +} + atf_init_test_cases() { atf_add_test_case "basic" + atf_add_test_case "bpf_pcp" } diff --git a/tests/sys/net/pcp.py b/tests/sys/net/pcp.py new file mode 100644 index 000000000000..cea88faaf438 --- /dev/null +++ b/tests/sys/net/pcp.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python3 +# +# SPDX-License-Identifier: BSD-2-Clause +# +# Copyright (c) 2021 Rubicon Communications, LLC (Netgate). +# +# 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. + +import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) +import scapy.all as sp +import sys +import os +curdir = os.path.dirname(os.path.realpath(__file__)) +netpfil_common = curdir + "/../netpfil/common" +sys.path.append(netpfil_common) +from sniffer import Sniffer + +def check_pcp(args, packet): + vlan = packet.getlayer(sp.Dot1Q) + + if vlan is None: + return False + + if not packet.getlayer(sp.BOOTP): + return False + + if vlan.prio == int(args.expect_pcp[0]): + return True + + return False + +def main(): + parser = argparse.ArgumentParser("pcp.py", + description="PCP test tool") + parser.add_argument('--recvif', nargs=1, + required=True, + help='The interface where to look for packets to check') + parser.add_argument('--expect-pcp', nargs=1, + help='The expected PCP value on VLAN packets') + + args = parser.parse_args() + + sniffer = Sniffer(args, check_pcp, recvif=args.recvif[0], timeout=20) + + sniffer.join() + + if sniffer.foundCorrectPacket: + sys.exit(0) + + sys.exit(1) + +if __name__ == '__main__': + main() diff --git a/tests/sys/netpfil/common/sniffer.py b/tests/sys/netpfil/common/sniffer.py index 200ac750dd7f..a7ebfc122573 100644 --- a/tests/sys/netpfil/common/sniffer.py +++ b/tests/sys/netpfil/common/sniffer.py @@ -28,12 +28,14 @@ import threading import scapy.all as sp +import sys class Sniffer(threading.Thread): - def __init__(self, args, check_function, recvif=None): + def __init__(self, args, check_function, recvif=None, timeout=3): threading.Thread.__init__(self) self._args = args + self._timeout = timeout if recvif is not None: self._recvif = recvif else: @@ -50,5 +52,9 @@ class Sniffer(threading.Thread): return ret def run(self): - self.packets = sp.sniff(iface=self._recvif, - stop_filter=self._checkPacket, timeout=3) + self.packets = [] + try: + self.packets = sp.sniff(iface=self._recvif, + stop_filter=self._checkPacket, timeout=self._timeout) + except Exception as e: + print(e, file=sys.stderr) From owner-dev-commits-src-all@freebsd.org Mon Aug 2 15:04:10 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A252F675AE5; Mon, 2 Aug 2021 15:04: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 4Gdh9P5bs4z4YnS; Mon, 2 Aug 2021 15:04: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 59E6321672; Mon, 2 Aug 2021 15:04: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 172F49km071579; Mon, 2 Aug 2021 15:04:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 172F491L071578; Mon, 2 Aug 2021 15:04:09 GMT (envelope-from git) Date: Mon, 2 Aug 2021 15:04:09 GMT Message-Id: <202108021504.172F491L071578@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 666a7f460270 - stable/12 - vlan: deduplicate bpf_setpcp() and pf_ieee8021q_setpcp() 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/stable/12 X-Git-Reftype: branch X-Git-Commit: 666a7f4602708cb730c784c5d4a9ef34b620f721 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 15:04:10 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=666a7f4602708cb730c784c5d4a9ef34b620f721 commit 666a7f4602708cb730c784c5d4a9ef34b620f721 Author: Kristof Provost AuthorDate: 2021-07-22 08:35:08 +0000 Commit: Kristof Provost CommitDate: 2021-08-02 15:03:03 +0000 vlan: deduplicate bpf_setpcp() and pf_ieee8021q_setpcp() These two fuctions were identical, so move them into the common vlan_set_pcp() function, exposed in the if_vlan_var.h header. Reviewed by: donner MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31275 (cherry picked from commit 9ef8cd0b7906371803421aa897056b6fc0710fcb) --- sys/net/bpf.c | 23 +---------------------- sys/net/if_vlan.c | 2 +- sys/net/if_vlan_var.h | 26 ++++++++++++++++++++++++++ sys/netpfil/pf/pf.c | 25 ++----------------------- 4 files changed, 30 insertions(+), 46 deletions(-) diff --git a/sys/net/bpf.c b/sys/net/bpf.c index 7e0af0cfebc0..5ca92a97f74f 100644 --- a/sys/net/bpf.c +++ b/sys/net/bpf.c @@ -1121,27 +1121,6 @@ bpf_ready(struct bpf_d *d) return (0); } -static int -bpf_setpcp(struct mbuf *m, u_int8_t prio) -{ - struct m_tag *mtag; - - KASSERT(prio <= BPF_PRIO_MAX, - ("%s with invalid pcp", __func__)); - - mtag = m_tag_locate(m, MTAG_8021Q, MTAG_8021Q_PCP_OUT, NULL); - if (mtag == NULL) { - mtag = m_tag_alloc(MTAG_8021Q, MTAG_8021Q_PCP_OUT, - sizeof(uint8_t), M_NOWAIT); - if (mtag == NULL) - return (ENOMEM); - m_tag_prepend(m, mtag); - } - - *(uint8_t *)(mtag + 1) = prio; - return (0); -} - static int bpfwrite(struct cdev *dev, struct uio *uio, int ioflag) { @@ -1221,7 +1200,7 @@ bpfwrite(struct cdev *dev, struct uio *uio, int ioflag) } if (d->bd_pcp != 0) - bpf_setpcp(m, d->bd_pcp); + vlan_set_pcp(m, d->bd_pcp); error = (*ifp->if_output)(ifp, m, &dst, &ro); if (error) diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c index 2f1b1dec9603..a055c978c32f 100644 --- a/sys/net/if_vlan.c +++ b/sys/net/if_vlan.c @@ -1943,7 +1943,7 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) error = priv_check(curthread, PRIV_NET_SETVLANPCP); if (error) break; - if (ifr->ifr_vlan_pcp > 7) { + if (ifr->ifr_vlan_pcp > VLAN_PCP_MAX) { error = EINVAL; break; } diff --git a/sys/net/if_vlan_var.h b/sys/net/if_vlan_var.h index 0b66ec0a0a1e..aaf64efe3d7f 100644 --- a/sys/net/if_vlan_var.h +++ b/sys/net/if_vlan_var.h @@ -32,6 +32,8 @@ #ifndef _NET_IF_VLAN_VAR_H_ #define _NET_IF_VLAN_VAR_H_ 1 +#include + /* Set the VLAN ID in an mbuf packet header non-destructively. */ #define EVL_APPLY_VLID(m, vlid) \ do { \ @@ -123,6 +125,8 @@ struct vlanreq { #define MTAG_8021Q_PCP_IN 0 /* Input priority. */ #define MTAG_8021Q_PCP_OUT 1 /* Output priority. */ +#define VLAN_PCP_MAX 7 + #define VLAN_CAPABILITIES(_ifp) do { \ if ((_ifp)->if_vlantrunk != NULL) \ (*vlan_trunk_cap_p)(_ifp); \ @@ -158,6 +162,28 @@ EVENTHANDLER_DECLARE(vlan_config, vlan_config_fn); EVENTHANDLER_DECLARE(vlan_unconfig, vlan_unconfig_fn); #endif /* _SYS_EVENTHANDLER_H_ */ +static inline int +vlan_set_pcp(struct mbuf *m, uint8_t prio) +{ + struct m_tag *mtag; + + KASSERT(prio <= VLAN_PCP_MAX, + ("%s with invalid pcp", __func__)); + + mtag = m_tag_locate(m, MTAG_8021Q, MTAG_8021Q_PCP_OUT, NULL); + if (mtag == NULL) { + mtag = m_tag_alloc(MTAG_8021Q, MTAG_8021Q_PCP_OUT, + sizeof(uint8_t), M_NOWAIT); + if (mtag == NULL) + return (ENOMEM); + m_tag_prepend(m, mtag); + } + + *(uint8_t *)(mtag + 1) = prio; + + return (0); +} + #endif /* _KERNEL */ #endif /* _NET_IF_VLAN_VAR_H_ */ diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 7b2812a952ce..caae2b92f0d6 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -2717,27 +2717,6 @@ pf_return(struct pf_krule *r, struct pf_krule *nr, struct pf_pdesc *pd, } -static int -pf_ieee8021q_setpcp(struct mbuf *m, u_int8_t prio) -{ - struct m_tag *mtag; - - KASSERT(prio <= PF_PRIO_MAX, - ("%s with invalid pcp", __func__)); - - mtag = m_tag_locate(m, MTAG_8021Q, MTAG_8021Q_PCP_OUT, NULL); - if (mtag == NULL) { - mtag = m_tag_alloc(MTAG_8021Q, MTAG_8021Q_PCP_OUT, - sizeof(uint8_t), M_NOWAIT); - if (mtag == NULL) - return (ENOMEM); - m_tag_prepend(m, mtag); - } - - *(uint8_t *)(mtag + 1) = prio; - return (0); -} - static int pf_match_ieee8021q_pcp(u_int8_t prio, struct mbuf *m) { @@ -6351,7 +6330,7 @@ done: if (r->scrub_flags & PFSTATE_SETPRIO) { if (pd.tos & IPTOS_LOWDELAY) pqid = 1; - if (pf_ieee8021q_setpcp(m, r->set_prio[pqid])) { + if (vlan_set_pcp(m, r->set_prio[pqid])) { action = PF_DROP; REASON_SET(&reason, PFRES_MEMORY); log = 1; @@ -6803,7 +6782,7 @@ done: if (r->scrub_flags & PFSTATE_SETPRIO) { if (pd.tos & IPTOS_LOWDELAY) pqid = 1; - if (pf_ieee8021q_setpcp(m, r->set_prio[pqid])) { + if (vlan_set_pcp(m, r->set_prio[pqid])) { action = PF_DROP; REASON_SET(&reason, PFRES_MEMORY); log = 1; From owner-dev-commits-src-all@freebsd.org Mon Aug 2 15:40:07 2021 Return-Path: Delivered-To: dev-commits-src-all@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 36BA967688D; Mon, 2 Aug 2021 15:40: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 4Gdhyv0nnpz4cxX; Mon, 2 Aug 2021 15:40: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 F32E722213; Mon, 2 Aug 2021 15:40:06 +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 172Fe6Ax014260; Mon, 2 Aug 2021 15:40:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 172Fe6Fk014257; Mon, 2 Aug 2021 15:40:06 GMT (envelope-from git) Date: Mon, 2 Aug 2021 15:40:06 GMT Message-Id: <202108021540.172Fe6Fk014257@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: 9f1db6c5557b - main - Add missing bsd.linker.mk include after 31ba4ce8898f9dfa5e7f054fdbc26e50a599a6e3 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: 9f1db6c5557bd01734ee63afacaf07a37fb3cc60 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 15:40:07 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=9f1db6c5557bd01734ee63afacaf07a37fb3cc60 commit 9f1db6c5557bd01734ee63afacaf07a37fb3cc60 Author: Alex Richardson AuthorDate: 2021-08-02 15:38:39 +0000 Commit: Alex Richardson CommitDate: 2021-08-02 15:38:39 +0000 Add missing bsd.linker.mk include after 31ba4ce8898f9dfa5e7f054fdbc26e50a599a6e3 This is needed for -DWITH_CLEAN builds since the cleandir phase does not include bsd.linker.mk from bsd.compiler.mk --- lib/clang/llvm.build.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/clang/llvm.build.mk b/lib/clang/llvm.build.mk index 70b39fdc44ca..3a712cde1703 100644 --- a/lib/clang/llvm.build.mk +++ b/lib/clang/llvm.build.mk @@ -100,6 +100,7 @@ CFLAGS+= -DLLVM_NATIVE_TARGETMC=LLVMInitialize${LLVM_NATIVE_ARCH}TargetMC CFLAGS+= -ffunction-sections CFLAGS+= -fdata-sections +.include "bsd.linker.mk" .if ${LINKER_TYPE} == "mac" LDFLAGS+= -Wl,-dead_strip .else From owner-dev-commits-src-all@freebsd.org Mon Aug 2 15:56:16 2021 Return-Path: Delivered-To: dev-commits-src-all@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 49A23676E12; Mon, 2 Aug 2021 15:56: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 4GdjKX1JKKz4dZ0; Mon, 2 Aug 2021 15:56: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 1528822684; Mon, 2 Aug 2021 15:56: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 172FuFYE037515; Mon, 2 Aug 2021 15:56:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 172FuFBm037514; Mon, 2 Aug 2021 15:56:15 GMT (envelope-from git) Date: Mon, 2 Aug 2021 15:56:15 GMT Message-Id: <202108021556.172FuFBm037514@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 156b889469d2 - stable/13 - mrsas(4): Report more correct maximum I/O size. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 156b889469d2f59743f1811f731040dfdc3e5e14 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 15:56:16 -0000 The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=156b889469d2f59743f1811f731040dfdc3e5e14 commit 156b889469d2f59743f1811f731040dfdc3e5e14 Author: Alexander Motin AuthorDate: 2021-07-01 19:28:55 +0000 Commit: Alexander Motin CommitDate: 2021-08-02 15:56:10 +0000 mrsas(4): Report more correct maximum I/O size. Subtract one SGE for the case of misaligned address. Also take into account maximum number of sectors reported by firmware, that gives nicer 256KB limit instead of 276KB calculated from the SGE limit. While there, remove number of I/O size checks, duplicating what is already checked by CAM and busdma(9). MFC after: 1 month Sponsored by: iXsystems, Inc. (cherry picked from commit fa3d57c256104649217b5022947de9c1c59a326e) --- sys/dev/mrsas/mrsas.c | 11 ++++++----- sys/dev/mrsas/mrsas_cam.c | 36 +----------------------------------- 2 files changed, 7 insertions(+), 40 deletions(-) diff --git a/sys/dev/mrsas/mrsas.c b/sys/dev/mrsas/mrsas.c index 01173387c8d4..8814642fccd0 100644 --- a/sys/dev/mrsas/mrsas.c +++ b/sys/dev/mrsas/mrsas.c @@ -1914,15 +1914,16 @@ mrsas_alloc_mem(struct mrsas_softc *sc) /* * Allocate parent DMA tag */ - if (bus_dma_tag_create(NULL, /* parent */ + if (bus_dma_tag_create( + bus_get_dma_tag(sc->mrsas_dev), /* parent */ 1, /* alignment */ 0, /* boundary */ BUS_SPACE_MAXADDR, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ NULL, NULL, /* filter, filterarg */ - maxphys, /* maxsize */ - sc->max_num_sge, /* nsegments */ - maxphys, /* maxsegsize */ + BUS_SPACE_MAXSIZE, /* maxsize */ + BUS_SPACE_UNRESTRICTED, /* nsegments */ + BUS_SPACE_MAXSIZE, /* maxsegsize */ 0, /* flags */ NULL, NULL, /* lockfunc, lockarg */ &sc->mrsas_parent_tag /* tag */ @@ -2533,7 +2534,7 @@ mrsas_init_fw(struct mrsas_softc *sc) sc->ctrl_info->max_strips_per_io; max_sectors_2 = sc->ctrl_info->max_request_size; tmp_sectors = min(max_sectors_1, max_sectors_2); - sc->max_sectors_per_req = sc->max_num_sge * MRSAS_PAGE_SIZE / 512; + sc->max_sectors_per_req = (sc->max_num_sge - 1) * MRSAS_PAGE_SIZE / 512; if (tmp_sectors && (sc->max_sectors_per_req > tmp_sectors)) sc->max_sectors_per_req = tmp_sectors; diff --git a/sys/dev/mrsas/mrsas_cam.c b/sys/dev/mrsas/mrsas_cam.c index 3557782dae49..85dacdb9f306 100644 --- a/sys/dev/mrsas/mrsas_cam.c +++ b/sys/dev/mrsas/mrsas_cam.c @@ -369,7 +369,7 @@ mrsas_action(struct cam_sim *sim, union ccb *ccb) else ccb->cpi.max_target = MRSAS_MAX_LD_IDS - 1; #if (__FreeBSD_version > 704000) - ccb->cpi.maxio = sc->max_num_sge * MRSAS_PAGE_SIZE; + ccb->cpi.maxio = sc->max_sectors_per_req * 512; #endif ccb->ccb_h.status = CAM_REQ_CMP; xpt_done(ccb); @@ -513,21 +513,11 @@ mrsas_startio(struct mrsas_softc *sc, struct cam_sim *sim, ccb_h->status = CAM_REQ_INVALID; goto done; case CAM_DATA_VADDR: - if (csio->dxfer_len > (sc->max_num_sge * MRSAS_PAGE_SIZE)) { - mrsas_release_mpt_cmd(cmd); - ccb_h->status = CAM_REQ_TOO_BIG; - goto done; - } cmd->length = csio->dxfer_len; if (cmd->length) cmd->data = csio->data_ptr; break; case CAM_DATA_BIO: - if (csio->dxfer_len > (sc->max_num_sge * MRSAS_PAGE_SIZE)) { - mrsas_release_mpt_cmd(cmd); - ccb_h->status = CAM_REQ_TOO_BIG; - goto done; - } cmd->length = csio->dxfer_len; if (cmd->length) cmd->data = csio->data_ptr; @@ -539,11 +529,6 @@ mrsas_startio(struct mrsas_softc *sc, struct cam_sim *sim, #else if (!(ccb_h->flags & CAM_DATA_PHYS)) { /* Virtual data address */ if (!(ccb_h->flags & CAM_SCATTER_VALID)) { - if (csio->dxfer_len > (sc->max_num_sge * MRSAS_PAGE_SIZE)) { - mrsas_release_mpt_cmd(cmd); - ccb_h->status = CAM_REQ_TOO_BIG; - goto done; - } cmd->length = csio->dxfer_len; if (cmd->length) cmd->data = csio->data_ptr; @@ -867,11 +852,6 @@ mrsas_build_ldio_rw(struct mrsas_softc *sc, struct mrsas_mpt_cmd *cmd, io_request->DataLength = htole32(cmd->length); if (mrsas_map_request(sc, cmd, ccb) == SUCCESS) { - if (cmd->sge_count > sc->max_num_sge) { - device_printf(sc->mrsas_dev, "Error: sge_count (0x%x) exceeds" - "max (0x%x) allowed\n", cmd->sge_count, sc->max_num_sge); - return (FAIL); - } if (sc->is_ventura || sc->is_aero) io_request->RaidContext.raid_context_g35.numSGE = cmd->sge_count; else { @@ -1234,11 +1214,6 @@ mrsas_build_ldio_nonrw(struct mrsas_softc *sc, struct mrsas_mpt_cmd *cmd, io_request->DataLength = cmd->length; if (mrsas_map_request(sc, cmd, ccb) == SUCCESS) { - if (cmd->sge_count > sc->max_num_sge) { - device_printf(sc->mrsas_dev, "Error: sge_count (0x%x) exceeds" - "max (0x%x) allowed\n", cmd->sge_count, sc->max_num_sge); - return (1); - } if (sc->is_ventura || sc->is_aero) io_request->RaidContext.raid_context_g35.numSGE = cmd->sge_count; else { @@ -1364,11 +1339,6 @@ mrsas_build_syspdio(struct mrsas_softc *sc, struct mrsas_mpt_cmd *cmd, io_request->DataLength = htole32(cmd->length); if (mrsas_map_request(sc, cmd, ccb) == SUCCESS) { - if (cmd->sge_count > sc->max_num_sge) { - device_printf(sc->mrsas_dev, "Error: sge_count (0x%x) exceeds" - "max (0x%x) allowed\n", cmd->sge_count, sc->max_num_sge); - return (1); - } if (sc->is_ventura || sc->is_aero) io_request->RaidContext.raid_context_g35.numSGE = cmd->sge_count; else { @@ -1714,10 +1684,6 @@ mrsas_data_load_cb(void *arg, bus_dma_segment_t *segs, int nseg, int error) if (cmd->flags & MRSAS_DIR_OUT) bus_dmamap_sync(cmd->sc->data_tag, cmd->data_dmamap, BUS_DMASYNC_PREWRITE); - if (nseg > sc->max_num_sge) { - device_printf(sc->mrsas_dev, "SGE count is too large or 0.\n"); - return; - } /* Check for whether PRPs should be built or IEEE SGLs*/ if ((cmd->io_request->IoFlags & MPI25_SAS_DEVICE0_FLAGS_ENABLED_FAST_PATH) && From owner-dev-commits-src-all@freebsd.org Mon Aug 2 15:59:53 2021 Return-Path: Delivered-To: dev-commits-src-all@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 49911676C65; Mon, 2 Aug 2021 15:59: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 4GdjPj1VHLz4f0w; Mon, 2 Aug 2021 15:59: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 15F122252B; Mon, 2 Aug 2021 15:59: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 172FxqYO037852; Mon, 2 Aug 2021 15:59:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 172Fxqf6037851; Mon, 2 Aug 2021 15:59:52 GMT (envelope-from git) Date: Mon, 2 Aug 2021 15:59:52 GMT Message-Id: <202108021559.172Fxqf6037851@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: ef87250124b1 - stable/12 - mrsas(4): Report more correct maximum I/O size. 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/stable/12 X-Git-Reftype: branch X-Git-Commit: ef87250124b12216c4e8e608d73008ca13448cba Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 15:59:53 -0000 The branch stable/12 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=ef87250124b12216c4e8e608d73008ca13448cba commit ef87250124b12216c4e8e608d73008ca13448cba Author: Alexander Motin AuthorDate: 2021-07-01 19:28:55 +0000 Commit: Alexander Motin CommitDate: 2021-08-02 15:59:43 +0000 mrsas(4): Report more correct maximum I/O size. Subtract one SGE for the case of misaligned address. Also take into account maximum number of sectors reported by firmware, that gives nicer 256KB limit instead of 276KB calculated from the SGE limit. While there, remove number of I/O size checks, duplicating what is already checked by CAM and busdma(9). MFC after: 1 month Sponsored by: iXsystems, Inc. (cherry picked from commit fa3d57c256104649217b5022947de9c1c59a326e) --- sys/dev/mrsas/mrsas.c | 11 ++++++----- sys/dev/mrsas/mrsas_cam.c | 36 +----------------------------------- 2 files changed, 7 insertions(+), 40 deletions(-) diff --git a/sys/dev/mrsas/mrsas.c b/sys/dev/mrsas/mrsas.c index df4fb98c53eb..ff7dc765a3b4 100644 --- a/sys/dev/mrsas/mrsas.c +++ b/sys/dev/mrsas/mrsas.c @@ -1923,15 +1923,16 @@ mrsas_alloc_mem(struct mrsas_softc *sc) /* * Allocate parent DMA tag */ - if (bus_dma_tag_create(NULL, /* parent */ + if (bus_dma_tag_create( + bus_get_dma_tag(sc->mrsas_dev), /* parent */ 1, /* alignment */ 0, /* boundary */ BUS_SPACE_MAXADDR, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ NULL, NULL, /* filter, filterarg */ - MAXPHYS, /* maxsize */ - sc->max_num_sge, /* nsegments */ - MAXPHYS, /* maxsegsize */ + BUS_SPACE_MAXSIZE, /* maxsize */ + BUS_SPACE_UNRESTRICTED, /* nsegments */ + BUS_SPACE_MAXSIZE, /* maxsegsize */ 0, /* flags */ NULL, NULL, /* lockfunc, lockarg */ &sc->mrsas_parent_tag /* tag */ @@ -2543,7 +2544,7 @@ mrsas_init_fw(struct mrsas_softc *sc) sc->ctrl_info->max_strips_per_io; max_sectors_2 = sc->ctrl_info->max_request_size; tmp_sectors = min(max_sectors_1, max_sectors_2); - sc->max_sectors_per_req = sc->max_num_sge * MRSAS_PAGE_SIZE / 512; + sc->max_sectors_per_req = (sc->max_num_sge - 1) * MRSAS_PAGE_SIZE / 512; if (tmp_sectors && (sc->max_sectors_per_req > tmp_sectors)) sc->max_sectors_per_req = tmp_sectors; diff --git a/sys/dev/mrsas/mrsas_cam.c b/sys/dev/mrsas/mrsas_cam.c index 0ff897a01aa8..c53fdbb4ea71 100644 --- a/sys/dev/mrsas/mrsas_cam.c +++ b/sys/dev/mrsas/mrsas_cam.c @@ -369,7 +369,7 @@ mrsas_action(struct cam_sim *sim, union ccb *ccb) else ccb->cpi.max_target = MRSAS_MAX_LD_IDS - 1; #if (__FreeBSD_version > 704000) - ccb->cpi.maxio = sc->max_num_sge * MRSAS_PAGE_SIZE; + ccb->cpi.maxio = sc->max_sectors_per_req * 512; #endif ccb->ccb_h.status = CAM_REQ_CMP; xpt_done(ccb); @@ -513,21 +513,11 @@ mrsas_startio(struct mrsas_softc *sc, struct cam_sim *sim, ccb_h->status = CAM_REQ_INVALID; goto done; case CAM_DATA_VADDR: - if (csio->dxfer_len > (sc->max_num_sge * MRSAS_PAGE_SIZE)) { - mrsas_release_mpt_cmd(cmd); - ccb_h->status = CAM_REQ_TOO_BIG; - goto done; - } cmd->length = csio->dxfer_len; if (cmd->length) cmd->data = csio->data_ptr; break; case CAM_DATA_BIO: - if (csio->dxfer_len > (sc->max_num_sge * MRSAS_PAGE_SIZE)) { - mrsas_release_mpt_cmd(cmd); - ccb_h->status = CAM_REQ_TOO_BIG; - goto done; - } cmd->length = csio->dxfer_len; if (cmd->length) cmd->data = csio->data_ptr; @@ -539,11 +529,6 @@ mrsas_startio(struct mrsas_softc *sc, struct cam_sim *sim, #else if (!(ccb_h->flags & CAM_DATA_PHYS)) { /* Virtual data address */ if (!(ccb_h->flags & CAM_SCATTER_VALID)) { - if (csio->dxfer_len > (sc->max_num_sge * MRSAS_PAGE_SIZE)) { - mrsas_release_mpt_cmd(cmd); - ccb_h->status = CAM_REQ_TOO_BIG; - goto done; - } cmd->length = csio->dxfer_len; if (cmd->length) cmd->data = csio->data_ptr; @@ -871,11 +856,6 @@ mrsas_build_ldio_rw(struct mrsas_softc *sc, struct mrsas_mpt_cmd *cmd, io_request->DataLength = cmd->length; if (mrsas_map_request(sc, cmd, ccb) == SUCCESS) { - if (cmd->sge_count > sc->max_num_sge) { - device_printf(sc->mrsas_dev, "Error: sge_count (0x%x) exceeds" - "max (0x%x) allowed\n", cmd->sge_count, sc->max_num_sge); - return (FAIL); - } if (sc->is_ventura || sc->is_aero) io_request->RaidContext.raid_context_g35.numSGE = cmd->sge_count; else { @@ -1239,11 +1219,6 @@ mrsas_build_ldio_nonrw(struct mrsas_softc *sc, struct mrsas_mpt_cmd *cmd, io_request->DataLength = cmd->length; if (mrsas_map_request(sc, cmd, ccb) == SUCCESS) { - if (cmd->sge_count > sc->max_num_sge) { - device_printf(sc->mrsas_dev, "Error: sge_count (0x%x) exceeds" - "max (0x%x) allowed\n", cmd->sge_count, sc->max_num_sge); - return (1); - } if (sc->is_ventura || sc->is_aero) io_request->RaidContext.raid_context_g35.numSGE = cmd->sge_count; else { @@ -1369,11 +1344,6 @@ mrsas_build_syspdio(struct mrsas_softc *sc, struct mrsas_mpt_cmd *cmd, io_request->DataLength = cmd->length; if (mrsas_map_request(sc, cmd, ccb) == SUCCESS) { - if (cmd->sge_count > sc->max_num_sge) { - device_printf(sc->mrsas_dev, "Error: sge_count (0x%x) exceeds" - "max (0x%x) allowed\n", cmd->sge_count, sc->max_num_sge); - return (1); - } if (sc->is_ventura || sc->is_aero) io_request->RaidContext.raid_context_g35.numSGE = cmd->sge_count; else { @@ -1724,10 +1694,6 @@ mrsas_data_load_cb(void *arg, bus_dma_segment_t *segs, int nseg, int error) if (cmd->flags & MRSAS_DIR_OUT) bus_dmamap_sync(cmd->sc->data_tag, cmd->data_dmamap, BUS_DMASYNC_PREWRITE); - if (nseg > sc->max_num_sge) { - device_printf(sc->mrsas_dev, "SGE count is too large or 0.\n"); - return; - } /* Check for whether PRPs should be built or IEEE SGLs*/ if ((cmd->io_request->IoFlags & MPI25_SAS_DEVICE0_FLAGS_ENABLED_FAST_PATH) && From owner-dev-commits-src-all@freebsd.org Mon Aug 2 16:16:05 2021 Return-Path: Delivered-To: dev-commits-src-all@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 26E6267701B; Mon, 2 Aug 2021 16:16:05 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-qv1-xf33.google.com (mail-qv1-xf33.google.com [IPv6:2607:f8b0:4864:20::f33]) (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 4GdjmN1lSlz4gCj; Mon, 2 Aug 2021 16:16:04 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: by mail-qv1-xf33.google.com with SMTP id f91so9119670qva.9; Mon, 02 Aug 2021 09:16:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:autocrypt:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=pK74zS57PZWdJlXnnNhbpQ0cbGzOsnikR8cTDqPYUA0=; b=UV8YYoH8pA+MyaBO/oDYaQNP+Brm7axDSRobeSPjtwS3mgK6kcZ3UG91oUuVniHMcW cq3d3U73BbnCjWtSZQ65lxTKgyerPn2qGLXBWSRKPTV/ve8mPTQoMg//ZPYPSrvgezYq 92Y48S2g7v7UUdTH08TV7oJOXJFFOqEeX3VfaPZ9eU9hHIpL6px4j+VFNwr/ukpYWjXC se8l7V+d3eATl7LhRcv5I0LXXDAIY6RL4ZIb1UxEOFtuUtG9AOoYlgEzoUIj51eRvVDh fcQHgITkWa7OMzKrzNUV9257k8361njNxEjh/3YpAAKkfd7eAaW9y8bNnRP8coAxSlbJ iLkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=pK74zS57PZWdJlXnnNhbpQ0cbGzOsnikR8cTDqPYUA0=; b=Baq62loNxyAjWs2bKeeQtWrsr7YnMk7b7PCIqeNcnxkaBQN1n0WQfSGGg9n+poMTJB 9t1GlJQgoyGfl+lgUldnPyiSInwMaEvmYgq6VeEBb52V3BbdT8fHwi6kHLpjl4enc1cA Sb+FNQLRjztW+Or5xbBIUpBU7pMr84zIG6iRK8McCAmJs6/OSLiZtUS+oz6+t6Y5Ygn3 Zq39JSHeOJyXSdoMihQbpoaXa2WL7JFWB/AUF3/NWI52hipzUqu9wQyIGTKb/fnUnuQf Yi/FjQhw3yxLr2UzPtD5ZIzwWgYnzn1OWcBUB6ru/gb89wAGaLdfarbYHKZeGo35IDtW CuHA== X-Gm-Message-State: AOAM533ko/cM/FjJ12uIDrGc3ItnpoZUhlT/+Ej77ZojC1epQSRbX6qm 7mS3W0Ux6lB2vyPOVQBpzmiuA//usms= X-Google-Smtp-Source: ABdhPJxPVi2m6hx+L2O36aXanVDIDjcyP/dugS1fYyvO0Mmdse8If7cufqcvMIZBwIckO4dfe63UiQ== X-Received: by 2002:a05:6214:a93:: with SMTP id ev19mr17327262qvb.27.1627920957439; Mon, 02 Aug 2021 09:15:57 -0700 (PDT) Received: from mavoffice.ixsystems.com ([38.32.73.2]) by smtp.gmail.com with ESMTPSA id a21sm6156179qkk.74.2021.08.02.09.15.56 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 02 Aug 2021 09:15:56 -0700 (PDT) Sender: Alexander Motin Subject: Re: git: 74f80bc1af2f - main - coretemp(4): Switch to smp_rendezvous_cpus(). To: Konstantin Belousov Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org References: <202107300326.16U3QGHR070204@gitrepo.freebsd.org> From: Alexander Motin Autocrypt: addr=mav@FreeBSD.org; prefer-encrypt=mutual; keydata= mQENBFOzxAwBCADkPrax0pI2W/ig0CK9nRJJwsHitAGEZ2HZiFEuti+6/4UVxj81yr4ak/4g 9bKUyC7rMEAp/ZHNhd+MFCPAAcHPvtovnfykqE/vuosCS3wlSLloix2iKVLks0CwbLHGAyne 46lTQW74Xl/33c3W1Z6d8jD9gVFT/xaVzZ0U9xdzOmsYAZaAj4ki0tuxO9F7L+ct9grRe7iP g8t9hai7BL4ee3VRwk2JXnKb7UvBiVITKYWKz1jRvZIrjPokgEcCLOSlv7x/1kjuFnj3xWZU 7HSFFT8J93epBbrSSCsYsppIk2fZH41kaaFXsMQfTPH8wkeM6qwrvOh4HiQM08R+9tThABEB AAG0IUFsZXhhbmRlciBNb3RpbiA8bWF2QEZyZWVCU0Qub3JnPokBVwQTAQoAQQIbAwULCQgH AwUVCgkICwUWAwIBAAIeAQIXgAIZARYhBOmM88TmnMPNDledVYMYw5VbqyJ/BQJZYMKuBQkN McyiAAoJEIMYw5VbqyJ/tuUIAOG3ONOSNYqjK4eTZ1TVh9jdUBAhWk5nhDFnODN49Wj0AbYm 7aIqy8O1hnCDSZG5LttjSAo3UfXJZDKQM0BLb0gpRMBnAYqO6tdolLNqAbPGJBnGoPjsh24y 6KcbDaNnis+lD4GwPXwQM+92wZGhCUFElPV9NciZGVS65TNIgk7X+yEjjhD1MSWKKijZ1r9Z zIt4OzUTxxNOvzdlABZS88nNRdJkatOQJPmFdd1mpP6UzTNCiLUo1pIqOEtJgvVVDYq5WHY6 tciWWYdmZG/tIBexJmv2mV2OLVjXR6ZeKmntVH14H72/wRHJuYHQC+r5SVRcWWayrThsY6jZ Yr4+raQ= Message-ID: <5b8b9ee4-4c90-ed32-de37-9d03fd812550@FreeBSD.org> Date: Mon, 2 Aug 2021 12:15:55 -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: 7bit X-Rspamd-Queue-Id: 4GdjmN1lSlz4gCj X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=UV8YYoH8; dmarc=none; spf=pass (mx1.freebsd.org: domain of mavbsd@gmail.com designates 2607:f8b0:4864:20::f33 as permitted sender) smtp.mailfrom=mavbsd@gmail.com X-Spamd-Result: default: False [-3.20 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[gmail.com:+]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FREEMAIL_TO(0.00)[gmail.com]; FORGED_SENDER(0.30)[mav@FreeBSD.org,mavbsd@gmail.com]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; MID_RHS_MATCH_FROM(0.00)[]; FROM_NEQ_ENVFROM(0.00)[mav@FreeBSD.org,mavbsd@gmail.com]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[FreeBSD.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::f33:from]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[dev-commits-src-main,dev-commits-src-all] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 16:16:05 -0000 On 31.07.2021 08:48, Konstantin Belousov wrote: >> +static void >> +coretemp_wrmsr(void *arg) >> +{ >> + struct coretemp_args *args = arg; >> + >> + wrmsr(args->msr, args->val); >> +} > We have x86_msr_op(). It covers coretemp_wrmsr(), and with slight > change of the interface would also handle the functionality of > coretemp_rdmsr(). As I see x86_msr_op() is tuned for MSR modification on all CPUs, while this code touches one CPU at a time. -- Alexander Motin From owner-dev-commits-src-all@freebsd.org Mon Aug 2 16:29:13 2021 Return-Path: Delivered-To: dev-commits-src-all@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 3C96E6770EA; Mon, 2 Aug 2021 16:29: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 4Gdk3Y0yW2z4gRD; Mon, 2 Aug 2021 16:29: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 04F3D22D66; Mon, 2 Aug 2021 16:29: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 172GTCOc078683; Mon, 2 Aug 2021 16:29:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 172GTCR8078682; Mon, 2 Aug 2021 16:29:12 GMT (envelope-from git) Date: Mon, 2 Aug 2021 16:29:12 GMT Message-Id: <202108021629.172GTCR8078682@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 8ca384eb1d42 - main - devclass_alloc_unit: move "at" hint test to after device-in-use test MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8ca384eb1d429aae866f53abfadafc71ab009dc6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 16:29:13 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=8ca384eb1d429aae866f53abfadafc71ab009dc6 commit 8ca384eb1d429aae866f53abfadafc71ab009dc6 Author: Adam Fenn AuthorDate: 2021-08-02 16:27:17 +0000 Commit: Kyle Evans CommitDate: 2021-08-02 16:27:17 +0000 devclass_alloc_unit: move "at" hint test to after device-in-use test Only perform this expensive operation when the unit number is a potential candidate (i.e. not already in use), thereby reducing device scan time on systems with many devices, unit numbers, and drivers. Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. X-NetApp-PR: #61 Differential Revision: https://reviews.freebsd.org/D31381 --- sys/kern/subr_bus.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c index fc2048561cf6..77b4c4c66c4b 100644 --- a/sys/kern/subr_bus.c +++ b/sys/kern/subr_bus.c @@ -1638,15 +1638,15 @@ devclass_alloc_unit(devclass_t dc, device_t dev, int *unitp) /* Unwired device, find the next available slot for it */ unit = 0; for (unit = 0;; unit++) { + /* If this device slot is already in use, skip it. */ + if (unit < dc->maxunit && dc->devices[unit] != NULL) + continue; + /* If there is an "at" hint for a unit then skip it. */ if (resource_string_value(dc->name, unit, "at", &s) == 0) continue; - /* If this device slot is already in use, skip it. */ - if (unit < dc->maxunit && dc->devices[unit] != NULL) - continue; - break; } } From owner-dev-commits-src-all@freebsd.org Mon Aug 2 16:30:26 2021 Return-Path: Delivered-To: dev-commits-src-all@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 DD83467716E; Mon, 2 Aug 2021 16:30: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 4Gdk4y5x2rz4gnT; Mon, 2 Aug 2021 16:30: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 B3D5C22B53; Mon, 2 Aug 2021 16:30: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 172GUQa3087069; Mon, 2 Aug 2021 16:30:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 172GUQQJ087068; Mon, 2 Aug 2021 16:30:26 GMT (envelope-from git) Date: Mon, 2 Aug 2021 16:30:26 GMT Message-Id: <202108021630.172GUQQJ087068@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: 600745f1e226 - main - pf: bound DIOCGETSTATES 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: 600745f1e2260e7ed3c2e6183b24388ff38c916c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 16:30:26 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=600745f1e2260e7ed3c2e6183b24388ff38c916c commit 600745f1e2260e7ed3c2e6183b24388ff38c916c Author: Kristof Provost AuthorDate: 2021-08-02 07:46:33 +0000 Commit: Kristof Provost CommitDate: 2021-08-02 14:29:23 +0000 pf: bound DIOCGETSTATES memory use Similar to what we did earlier for DIOCGETSTATESV2 we only allocate enough memory for a handful of states and copy those out, bit by bit, rather than allocating memory for all states in one go. MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/netpfil/pf/pf_ioctl.c | 51 ++++++++++++++++++++++++++++++++++++----------- 1 file changed, 39 insertions(+), 12 deletions(-) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 7c506b79295b..b2d7fc33d8b8 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -2916,7 +2916,9 @@ DIOCCHANGERULE_error: struct pfioc_states *ps = (struct pfioc_states *)addr; struct pf_kstate *s; struct pfsync_state *pstore, *p; - int i, nr; + int i, nr; + size_t slice_count = 16, count; + void *out; if (ps->ps_len <= 0) { nr = uma_zone_get_cur(V_pf_state_z); @@ -2924,34 +2926,59 @@ DIOCCHANGERULE_error: break; } - p = pstore = malloc(ps->ps_len, M_TEMP, M_WAITOK | M_ZERO); + out = ps->ps_states; + pstore = mallocarray(slice_count, + sizeof(struct pfsync_state), M_TEMP, M_WAITOK | M_ZERO); nr = 0; for (i = 0; i <= pf_hashmask; i++) { struct pf_idhash *ih = &V_pf_idhash[i]; +DIOCGETSTATES_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 pfsync_state), M_TEMP, + M_WAITOK | M_ZERO); + goto DIOCGETSTATES_retry; + } + + if ((nr+count) * sizeof(*p) > ps->ps_len) { + PF_HASHROW_UNLOCK(ih); + goto DIOCGETSTATES_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 DIOCGETSTATES_full; - } pfsync_state_export(p, s); p++; nr++; } PF_HASHROW_UNLOCK(ih); + error = copyout(pstore, out, + sizeof(struct pfsync_state) * count); + if (error) + break; + out = ps->ps_states + nr; } DIOCGETSTATES_full: - error = copyout(pstore, ps->ps_states, - sizeof(struct pfsync_state) * nr); - if (error) { - free(pstore, M_TEMP); - break; - } ps->ps_len = sizeof(struct pfsync_state) * nr; free(pstore, M_TEMP); From owner-dev-commits-src-all@freebsd.org Mon Aug 2 17:07:37 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A1D99677E84; Mon, 2 Aug 2021 17:07:37 +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 4Gdkvs4Bk7z4jHt; Mon, 2 Aug 2021 17:07: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 6A25123438; Mon, 2 Aug 2021 17:07: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 172H7bt8032251; Mon, 2 Aug 2021 17:07:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 172H7bfW032250; Mon, 2 Aug 2021 17:07:37 GMT (envelope-from git) Date: Mon, 2 Aug 2021 17:07:37 GMT Message-Id: <202108021707.172H7bfW032250@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: d59f1c49e26b - main - cxgbe tom: Permit rcv_nxt mismatches on FIN for iSCSI connections on T6. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d59f1c49e26ba29e7583019bb5d6aa029466fdb6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 17:07:37 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=d59f1c49e26ba29e7583019bb5d6aa029466fdb6 commit d59f1c49e26ba29e7583019bb5d6aa029466fdb6 Author: John Baldwin AuthorDate: 2021-08-02 16:41:27 +0000 Commit: John Baldwin CommitDate: 2021-08-02 16:41:27 +0000 cxgbe tom: Permit rcv_nxt mismatches on FIN for iSCSI connections on T6. The remote peer might send a FIN in the middle of a burst of data PDUs. In the case of T6 with data PDU completion moderation, the driver would not have seen these PDUs since the final PDU in the burst was never received resulting in a stale rcv_nxt when the FIN is received. While here, invert the logic in the condition to be more readable and always set tp->rcv_nxt from the sequence number in the CPL. This sets the proper value of rcv_nxt for FINs on connections with data received but not reported via a CPL (e.g. a partial iSCSI PDU burst interrupted by a FIN). Reported by: Jithesh Arakkan @ Chelsio Reviewed by: np Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D30871 --- sys/dev/cxgbe/tom/t4_cpl_io.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/sys/dev/cxgbe/tom/t4_cpl_io.c b/sys/dev/cxgbe/tom/t4_cpl_io.c index 3af127c6a3a3..a75f93ded5f6 100644 --- a/sys/dev/cxgbe/tom/t4_cpl_io.c +++ b/sys/dev/cxgbe/tom/t4_cpl_io.c @@ -1288,7 +1288,21 @@ do_peer_close(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) if (toep->flags & TPF_ABORT_SHUTDOWN) goto done; - tp->rcv_nxt++; /* FIN */ + if (ulp_mode(toep) == ULP_MODE_RDMA || + (ulp_mode(toep) == ULP_MODE_ISCSI && chip_id(sc) >= CHELSIO_T6)) { + /* + * There might be data received via DDP before the FIN + * not reported to the driver. Just assume the + * sequence number in the CPL is correct as the + * sequence number of the FIN. + */ + } else { + KASSERT(tp->rcv_nxt + 1 == be32toh(cpl->rcv_nxt), + ("%s: rcv_nxt mismatch: %u %u", __func__, tp->rcv_nxt, + be32toh(cpl->rcv_nxt))); + } + + tp->rcv_nxt = be32toh(cpl->rcv_nxt); so = inp->inp_socket; socantrcvmore(so); @@ -1300,12 +1314,6 @@ do_peer_close(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) DDP_UNLOCK(toep); } - if (ulp_mode(toep) != ULP_MODE_RDMA) { - KASSERT(tp->rcv_nxt == be32toh(cpl->rcv_nxt), - ("%s: rcv_nxt mismatch: %u %u", __func__, tp->rcv_nxt, - be32toh(cpl->rcv_nxt))); - } - switch (tp->t_state) { case TCPS_SYN_RECEIVED: tp->t_starttime = ticks; From owner-dev-commits-src-all@freebsd.org Mon Aug 2 19:01:29 2021 Return-Path: Delivered-To: dev-commits-src-all@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 11EB16792C8; Mon, 2 Aug 2021 19:01: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 4GdnRD6jR3z4qsf; Mon, 2 Aug 2021 19:01: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 C4AC1249C9; Mon, 2 Aug 2021 19:01: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 172J1SOj088596; Mon, 2 Aug 2021 19:01:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 172J1SI6088577; Mon, 2 Aug 2021 19:01:28 GMT (envelope-from git) Date: Mon, 2 Aug 2021 19:01:28 GMT Message-Id: <202108021901.172J1SI6088577@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 225d3b0771d8 - stable/13 - libvmmapi: Fix warnings and stop overridding WARNS 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 225d3b0771d895a7b101e9349cf607ed86c06f6a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 19:01:29 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=225d3b0771d895a7b101e9349cf607ed86c06f6a commit 225d3b0771d895a7b101e9349cf607ed86c06f6a Author: Mark Johnston AuthorDate: 2021-07-26 20:40:16 +0000 Commit: Mark Johnston CommitDate: 2021-08-02 19:01:02 +0000 libvmmapi: Fix warnings and stop overridding WARNS - Avoid shadowing the global optarg. - Sprinkle __unused. - Cast nitems() to int. - Fix sign in vm_copy_setup(). Reviewed by: grehan Sponsored by: The FreeBSD Foundation (cherry picked from commit 45cd18ec73dcd262612898bf1a263cacde17d348) --- lib/libvmmapi/Makefile | 2 -- lib/libvmmapi/vmmapi.c | 34 +++++++++++++++++----------------- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/lib/libvmmapi/Makefile b/lib/libvmmapi/Makefile index bf17566a0d7d..9c410833e09c 100644 --- a/lib/libvmmapi/Makefile +++ b/lib/libvmmapi/Makefile @@ -5,8 +5,6 @@ LIB= vmmapi SRCS= vmmapi.c vmmapi_freebsd.c INCS= vmmapi.h -WARNS?= 2 - LIBADD= util CFLAGS+= -I${.CURDIR} diff --git a/lib/libvmmapi/vmmapi.c b/lib/libvmmapi/vmmapi.c index 5810274c9a73..0543c92f4300 100644 --- a/lib/libvmmapi/vmmapi.c +++ b/lib/libvmmapi/vmmapi.c @@ -111,7 +111,7 @@ vm_create(const char *name) /* Try to load vmm(4) module before creating a guest. */ if (modfind("vmm") < 0) kldload("vmm"); - return (CREATE((char *)name)); + return (CREATE(name)); } struct vmctx * @@ -153,14 +153,14 @@ vm_destroy(struct vmctx *vm) } int -vm_parse_memsize(const char *optarg, size_t *ret_memsize) +vm_parse_memsize(const char *opt, size_t *ret_memsize) { char *endptr; size_t optval; int error; - optval = strtoul(optarg, &endptr, 0); - if (*optarg != '\0' && *endptr == '\0') { + optval = strtoul(opt, &endptr, 0); + if (*opt != '\0' && *endptr == '\0') { /* * For the sake of backward compatibility if the memory size * specified on the command line is less than a megabyte then @@ -171,7 +171,7 @@ vm_parse_memsize(const char *optarg, size_t *ret_memsize) *ret_memsize = optval; error = 0; } else - error = expand_number(optarg, ret_memsize); + error = expand_number(opt, ret_memsize); return (error); } @@ -729,7 +729,7 @@ vm_inject_exception(struct vmctx *ctx, int vcpu, int vector, int errcode_valid, } int -vm_apicid2vcpu(struct vmctx *ctx, int apicid) +vm_apicid2vcpu(struct vmctx *ctx __unused, int apicid) { /* * The apic id associated with the 'vcpu' has the same numerical value @@ -907,7 +907,7 @@ vm_capability_name2type(const char *capname) { int i; - for (i = 0; i < nitems(capstrmap); i++) { + for (i = 0; i < (int)nitems(capstrmap); i++) { if (strcmp(capstrmap[i], capname) == 0) return (i); } @@ -918,7 +918,7 @@ vm_capability_name2type(const char *capname) const char * vm_capability_type2name(int type) { - if (type >= 0 && type < nitems(capstrmap)) + if (type >= 0 && type < (int)nitems(capstrmap)) return (capstrmap[type]); return (NULL); @@ -1366,8 +1366,8 @@ vm_copy_setup(struct vmctx *ctx, int vcpu, struct vm_guest_paging *paging, int *fault) { void *va; - uint64_t gpa; - int error, i, n, off; + uint64_t gpa, off; + int error, i, n; for (i = 0; i < iovcnt; i++) { iov[i].iov_base = 0; @@ -1381,7 +1381,7 @@ vm_copy_setup(struct vmctx *ctx, int vcpu, struct vm_guest_paging *paging, return (error); off = gpa & PAGE_MASK; - n = min(len, PAGE_SIZE - off); + n = MIN(len, PAGE_SIZE - off); va = vm_map_gpa(ctx, gpa, n); if (va == NULL) @@ -1399,14 +1399,14 @@ vm_copy_setup(struct vmctx *ctx, int vcpu, struct vm_guest_paging *paging, } void -vm_copy_teardown(struct vmctx *ctx, int vcpu, struct iovec *iov, int iovcnt) +vm_copy_teardown(struct vmctx *ctx __unused, int vcpu __unused, + struct iovec *iov __unused, int iovcnt __unused) { - - return; } void -vm_copyin(struct vmctx *ctx, int vcpu, struct iovec *iov, void *vp, size_t len) +vm_copyin(struct vmctx *ctx __unused, int vcpu __unused, struct iovec *iov, + void *vp, size_t len) { const char *src; char *dst; @@ -1426,8 +1426,8 @@ vm_copyin(struct vmctx *ctx, int vcpu, struct iovec *iov, void *vp, size_t len) } void -vm_copyout(struct vmctx *ctx, int vcpu, const void *vp, struct iovec *iov, - size_t len) +vm_copyout(struct vmctx *ctx __unused, int vcpu __unused, const void *vp, + struct iovec *iov, size_t len) { const char *src; char *dst; From owner-dev-commits-src-all@freebsd.org Mon Aug 2 19:01:30 2021 Return-Path: Delivered-To: dev-commits-src-all@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 148FB678DD9; Mon, 2 Aug 2021 19:01: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 4GdnRG06qLz4ql6; Mon, 2 Aug 2021 19:01: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 E1AF324BCE; Mon, 2 Aug 2021 19:01: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 172J1TuJ090064; Mon, 2 Aug 2021 19:01:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 172J1Tja090052; Mon, 2 Aug 2021 19:01:29 GMT (envelope-from git) Date: Mon, 2 Aug 2021 19:01:29 GMT Message-Id: <202108021901.172J1Tja090052@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 668a555de619 - stable/13 - rip: Add missing minimum length validation in rip_output() 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 668a555de619f0894cb233f00f70dc19973c154f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 19:01:30 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=668a555de619f0894cb233f00f70dc19973c154f commit 668a555de619f0894cb233f00f70dc19973c154f Author: Mark Johnston AuthorDate: 2021-07-26 20:39:18 +0000 Commit: Mark Johnston CommitDate: 2021-08-02 19:01:11 +0000 rip: Add missing minimum length validation in rip_output() If the socket is configured such that the sender is expected to supply the IP header, then we need to verify that it actually did so. Reported by: syzkaller+KMSAN Reviewed by: donner Sponsored by: The FreeBSD Foundation (cherry picked from commit ba21825202737a8b7e90e1ef669c7fe7e7d50325) --- sys/netinet/raw_ip.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c index 1db73a6da68c..996440227145 100644 --- a/sys/netinet/raw_ip.c +++ b/sys/netinet/raw_ip.c @@ -523,8 +523,15 @@ rip_output(struct mbuf *m, struct socket *so, ...) } else { if (m->m_pkthdr.len > IP_MAXPACKET) { m_freem(m); - return(EMSGSIZE); + return (EMSGSIZE); } + if (m->m_pkthdr.len < sizeof(*ip)) { + m_freem(m); + return (EINVAL); + } + m = m_pullup(m, sizeof(*ip)); + if (m == NULL) + return (ENOMEM); ip = mtod(m, struct ip *); hlen = ip->ip_hl << 2; if (m->m_len < hlen) { From owner-dev-commits-src-all@freebsd.org Mon Aug 2 19:02:06 2021 Return-Path: Delivered-To: dev-commits-src-all@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 3EDB86792F6; Mon, 2 Aug 2021 19:02: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 4GdnRy1NSpz4qtl; Mon, 2 Aug 2021 19:02: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 1744224BF7; Mon, 2 Aug 2021 19:02:06 +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 172J25X8091383; Mon, 2 Aug 2021 19:02:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 172J25Wb091382; Mon, 2 Aug 2021 19:02:05 GMT (envelope-from git) Date: Mon, 2 Aug 2021 19:02:05 GMT Message-Id: <202108021902.172J25Wb091382@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 14a06b083b56 - stable/12 - rip: Add missing minimum length validation in rip_output() 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/stable/12 X-Git-Reftype: branch X-Git-Commit: 14a06b083b56572868f82759f5f74d17523e8afa Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 19:02:06 -0000 The branch stable/12 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=14a06b083b56572868f82759f5f74d17523e8afa commit 14a06b083b56572868f82759f5f74d17523e8afa Author: Mark Johnston AuthorDate: 2021-07-26 20:39:18 +0000 Commit: Mark Johnston CommitDate: 2021-08-02 19:01:54 +0000 rip: Add missing minimum length validation in rip_output() If the socket is configured such that the sender is expected to supply the IP header, then we need to verify that it actually did so. Reported by: syzkaller+KMSAN Reviewed by: donner Sponsored by: The FreeBSD Foundation (cherry picked from commit ba21825202737a8b7e90e1ef669c7fe7e7d50325) --- sys/netinet/raw_ip.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c index 1fd621a068f4..f15a3bca3a90 100644 --- a/sys/netinet/raw_ip.c +++ b/sys/netinet/raw_ip.c @@ -508,8 +508,15 @@ rip_output(struct mbuf *m, struct socket *so, ...) } else { if (m->m_pkthdr.len > IP_MAXPACKET) { m_freem(m); - return(EMSGSIZE); + return (EMSGSIZE); } + if (m->m_pkthdr.len < sizeof(*ip)) { + m_freem(m); + return (EINVAL); + } + m = m_pullup(m, sizeof(*ip)); + if (m == NULL) + return (ENOMEM); ip = mtod(m, struct ip *); hlen = ip->ip_hl << 2; if (m->m_len < hlen) { From owner-dev-commits-src-all@freebsd.org Mon Aug 2 19:45:45 2021 Return-Path: Delivered-To: dev-commits-src-all@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 24DC867955D; Mon, 2 Aug 2021 19:45: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 4GdpQK0LWnz3C7L; Mon, 2 Aug 2021 19:45: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 E8F182564C; Mon, 2 Aug 2021 19:45: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 172JjiMd044956; Mon, 2 Aug 2021 19:45:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 172Jjinc044955; Mon, 2 Aug 2021 19:45:44 GMT (envelope-from git) Date: Mon, 2 Aug 2021 19:45:44 GMT Message-Id: <202108021945.172Jjinc044955@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Eric van Gyzen Subject: git: 428624130abf - main - Fix lockstat:::thread-spin dtrace probe with LOCK_PROFILING MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vangyzen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 428624130abfc225b479a09a3060d0939569b1ea Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 19:45:45 -0000 The branch main has been updated by vangyzen: URL: https://cgit.FreeBSD.org/src/commit/?id=428624130abfc225b479a09a3060d0939569b1ea commit 428624130abfc225b479a09a3060d0939569b1ea Author: Eric van Gyzen AuthorDate: 2021-08-02 18:54:57 +0000 Commit: Eric van Gyzen CommitDate: 2021-08-02 19:44:23 +0000 Fix lockstat:::thread-spin dtrace probe with LOCK_PROFILING The spinning start time is missing from the calculation due to a misplaced #endif. Return the #endif where it's supposed to be. Submitted by: Alexander Alexeev Reviewed by: bdrewery, mjg MFC after: 1 week Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D31384 --- sys/kern/kern_mutex.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/kern/kern_mutex.c b/sys/kern/kern_mutex.c index d9db69e2ac09..a85420e62c7a 100644 --- a/sys/kern/kern_mutex.c +++ b/sys/kern/kern_mutex.c @@ -895,6 +895,8 @@ thread_lock_flags_(struct thread *td, int opts, const char *file, int line) doing_lockprof = 1; #elif defined(KDTRACE_HOOKS) doing_lockprof = lockstat_enabled; +#endif +#ifdef KDTRACE_HOOKS if (__predict_false(doing_lockprof)) spin_time -= lockstat_nsecs(&td->td_lock->lock_object); #endif From owner-dev-commits-src-all@freebsd.org Mon Aug 2 20:37:39 2021 Return-Path: Delivered-To: dev-commits-src-all@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 AD00467A60B; Mon, 2 Aug 2021 20:37: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 4GdqZC4WTfz3Gb1; Mon, 2 Aug 2021 20:37: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 786B225BE8; Mon, 2 Aug 2021 20:37: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 172Kbd8e011977; Mon, 2 Aug 2021 20:37:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 172KbdS5011976; Mon, 2 Aug 2021 20:37:39 GMT (envelope-from git) Date: Mon, 2 Aug 2021 20:37:39 GMT Message-Id: <202108022037.172KbdS5011976@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 6162cf885c00 - main - malloc(9): Document/complete aligned variants MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6162cf885c00a0893a0961415f1829942343dcc1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 20:37:39 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=6162cf885c00a0893a0961415f1829942343dcc1 commit 6162cf885c00a0893a0961415f1829942343dcc1 Author: Adam Fenn AuthorDate: 2021-08-02 20:33:31 +0000 Commit: Kyle Evans CommitDate: 2021-08-02 20:36:14 +0000 malloc(9): Document/complete aligned variants Comments on a pending kvmclock driver suggested adding a malloc_aligned() to complement malloc_domainset_aligned(); add it now, and document both. Reviewed by: imp, kib, allanjude (manpages) Differential Revision: https://reviews.freebsd.org/D31004 --- share/man/man9/malloc.9 | 25 ++++++++++++++++++++++++- sys/sys/malloc.h | 2 ++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/share/man/man9/malloc.9 b/share/man/man9/malloc.9 index b8c6e504e0c0..71375e90951f 100644 --- a/share/man/man9/malloc.9 +++ b/share/man/man9/malloc.9 @@ -29,7 +29,7 @@ .\" $NetBSD: malloc.9,v 1.3 1996/11/11 00:05:11 lukem Exp $ .\" $FreeBSD$ .\" -.Dd March 6, 2021 +.Dd July 2, 2021 .Dt MALLOC 9 .Os .Sh NAME @@ -58,6 +58,13 @@ .Ft size_t .Fn malloc_usable_size "const void *addr" .Ft void * +.Fo malloc_aligned +.Fa "size_t size" +.Fa "size_t align" +.Fa "struct malloc_type *type" +.Fa "int flags" +.Fc +.Ft void * .Fn malloc_exec "size_t size" "struct malloc_type *type" "int flags" .Fn MALLOC_DECLARE type .In sys/param.h @@ -69,6 +76,14 @@ .Ft void * .Fn malloc_domainset "size_t size" "struct malloc_type *type" "struct domainset *ds" "int flags" .Ft void * +.Fo malloc_domainset_aligned +.Fa "size_t size" +.Fa "size_t align" +.Fa "struct malloc_type *type" +.Fa "struct domainset *ds" +.Fa "int flags" +.Fc +.Ft void * .Fn malloc_domainset_exec "size_t size" "struct malloc_type *type" "struct domainset *ds" "int flags" .Ft void * .Fn mallocarray_domainset "size_t nmemb" "size_t size" "struct malloc_type *type" "struct domainset *ds" "int flags" @@ -88,6 +103,14 @@ See .Xr domainset 9 for some example policies. .Pp +The +.Fn malloc_aligned +and +.Fn malloc_domainset_aligned +variants return allocations aligned as specified by +.Fa align , +which must be non-zero, a power of two, and less than or equal to the page size. +.Pp Both .Fn malloc_exec and diff --git a/sys/sys/malloc.h b/sys/sys/malloc.h index b8c2788edd44..3d88460a751e 100644 --- a/sys/sys/malloc.h +++ b/sys/sys/malloc.h @@ -265,6 +265,8 @@ void *realloc(void *addr, size_t size, struct malloc_type *type, int flags) __result_use_check __alloc_size(2); void *reallocf(void *addr, size_t size, struct malloc_type *type, int flags) __result_use_check __alloc_size(2); +void *malloc_aligned(size_t size, size_t align, struct malloc_type *type, + int flags) __malloc_like __result_use_check __alloc_size(1); void *malloc_domainset_aligned(size_t size, size_t align, struct malloc_type *mtp, struct domainset *ds, int flags) __malloc_like __result_use_check __alloc_size(1); From owner-dev-commits-src-all@freebsd.org Mon Aug 2 20:48:10 2021 Return-Path: Delivered-To: dev-commits-src-all@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 20A2967A637; Mon, 2 Aug 2021 20:48:10 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.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 4GdqpK5zDWz3Kcs; Mon, 2 Aug 2021 20:48:09 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 172Km1DW009441 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Mon, 2 Aug 2021 23:48:04 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 172Km1DW009441 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 172Km1gR009440; Mon, 2 Aug 2021 23:48:01 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 2 Aug 2021 23:48:01 +0300 From: Konstantin Belousov To: Alexander Motin Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 74f80bc1af2f - main - coretemp(4): Switch to smp_rendezvous_cpus(). Message-ID: References: <202107300326.16U3QGHR070204@gitrepo.freebsd.org> <5b8b9ee4-4c90-ed32-de37-9d03fd812550@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5b8b9ee4-4c90-ed32-de37-9d03fd812550@FreeBSD.org> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.5 X-Spam-Checker-Version: SpamAssassin 3.4.5 (2021-03-20) on tom.home X-Rspamd-Queue-Id: 4GdqpK5zDWz3Kcs 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 20:48:10 -0000 On Mon, Aug 02, 2021 at 12:15:55PM -0400, Alexander Motin wrote: > On 31.07.2021 08:48, Konstantin Belousov wrote: > >> +static void > >> +coretemp_wrmsr(void *arg) > >> +{ > >> + struct coretemp_args *args = arg; > >> + > >> + wrmsr(args->msr, args->val); > >> +} > > We have x86_msr_op(). It covers coretemp_wrmsr(), and with slight > > change of the interface would also handle the functionality of > > coretemp_rdmsr(). > > As I see x86_msr_op() is tuned for MSR modification on all CPUs, while > this code touches one CPU at a time. https://reviews.freebsd.org/D31386 From owner-dev-commits-src-all@freebsd.org Mon Aug 2 21:54:55 2021 Return-Path: Delivered-To: dev-commits-src-all@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 41D0D67B61C; Mon, 2 Aug 2021 21:54: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 4GdsHM19gHz3QDy; Mon, 2 Aug 2021 21:54: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 012F426F68; Mon, 2 Aug 2021 21:54: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 172Lssrc018908; Mon, 2 Aug 2021 21:54:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 172LssYo018907; Mon, 2 Aug 2021 21:54:54 GMT (envelope-from git) Date: Mon, 2 Aug 2021 21:54:54 GMT Message-Id: <202108022154.172LssYo018907@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: d00131e154d9 - main - clock_id: These symbols weren't in 4.4BSD, adjust copyright 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: d00131e154d9d847121292fe67cedcd5ac19d60e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 21:54:55 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=d00131e154d9d847121292fe67cedcd5ac19d60e commit d00131e154d9d847121292fe67cedcd5ac19d60e Author: Warner Losh AuthorDate: 2021-08-02 21:49:47 +0000 Commit: Warner Losh CommitDate: 2021-08-02 21:50:32 +0000 clock_id: These symbols weren't in 4.4BSD, adjust copyright Peter Wemm added the first CLOCK_* symbols in 0f5ed9f420528 in 1997 after obtaining them from NetBSD. In NetBSD, jtc@netbsd.org committed them in sys/sys/time.h rev 1.19 dated 1996/11/15, along with all the system calls associated with 1003.1b. FreeBSD's values are, however, different than NetBSD's today. The USL/UCB lawsuit was settled in 1994, so these couldn't have been derived from material provided to University of California covered in that settlement. This file does not need the settlement disclaimer. Furthermore, I rewrote most of the code (except the symbols and their values) when merging it from time.h and sys/time.h. Most of the creative content of the file is new, so update copyright to reflect that. Reviewed by: kaktus Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D31369 --- sys/sys/_clock_id.h | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/sys/sys/_clock_id.h b/sys/sys/_clock_id.h index a88eb063122f..47a551428dc3 100644 --- a/sys/sys/_clock_id.h +++ b/sys/sys/_clock_id.h @@ -1,13 +1,7 @@ /*- - * SPDX-License-Identifier: BSD-3-Clause + * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 1989, 1993 - * The Regents of the University of California. All rights reserved. - * (c) UNIX System Laboratories, Inc. - * All or some portions of this file are derived from material licensed - * to the University of California by American Telephone and Telegraph - * Co. or Unix System Laboratories, Inc. and are reproduced herein with - * the permission of UNIX System Laboratories, Inc. + * Copyright (c) 2021 Netflix, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -17,9 +11,6 @@ * 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 University 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 REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE @@ -32,8 +23,6 @@ * 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. - * - * @(#)time.h 8.3 (Berkeley) 1/21/94 */ #ifndef _SYS_SYS__CLOCK_ID_H From owner-dev-commits-src-all@freebsd.org Mon Aug 2 21:54:56 2021 Return-Path: Delivered-To: dev-commits-src-all@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 5848067AC74; Mon, 2 Aug 2021 21:54: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 4GdsHN0m4dz3Q1X; Mon, 2 Aug 2021 21:54: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 020E0271D3; Mon, 2 Aug 2021 21:54: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 172LstEq018937; Mon, 2 Aug 2021 21:54:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 172LstGd018936; Mon, 2 Aug 2021 21:54:55 GMT (envelope-from git) Date: Mon, 2 Aug 2021 21:54:55 GMT Message-Id: <202108022154.172LstGd018936@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: aaccfdde3d66 - main - awk: Enable tests again 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: aaccfdde3d66083af3e239555ba459249733ca08 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 21:54:56 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=aaccfdde3d66083af3e239555ba459249733ca08 commit aaccfdde3d66083af3e239555ba459249733ca08 Author: Warner Losh AuthorDate: 2021-08-02 21:53:26 +0000 Commit: Warner Losh CommitDate: 2021-08-02 21:53:26 +0000 awk: Enable tests again Since we now pass all 24 of the NetBSD awk tests, re-enable these tests. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D31370 --- usr.bin/awk/Makefile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/usr.bin/awk/Makefile b/usr.bin/awk/Makefile index 89dbf4460f45..28212f75f7d9 100644 --- a/usr.bin/awk/Makefile +++ b/usr.bin/awk/Makefile @@ -29,8 +29,7 @@ DEPENDOBJS+= maketab build-tools: maketab maketab: awkgram.tab.h ${BUILD_TOOLS_META} -# awk needs some work before we can connect these tests to the build -#HAS_TESTS= -#SUBDIR.${MK_TESTS}+= tests +HAS_TESTS= +SUBDIR.${MK_TESTS}+= tests .include From owner-dev-commits-src-all@freebsd.org Tue Aug 3 02:05:45 2021 Return-Path: Delivered-To: dev-commits-src-all@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 9BDBA67E180; Tue, 3 Aug 2021 02:05: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 4Gdyrn3hhvz4Tj5; Tue, 3 Aug 2021 02:05: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 667C02A92; Tue, 3 Aug 2021 02:05: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 17325jO2052594; Tue, 3 Aug 2021 02:05:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17325jom052593; Tue, 3 Aug 2021 02:05:45 GMT (envelope-from git) Date: Tue, 3 Aug 2021 02:05:45 GMT Message-Id: <202108030205.17325jom052593@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kevin Bowling Subject: git: 4ccafcfc8693 - stable/13 - e1000: Clean up igb_txrx MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 4ccafcfc86936e3b32bbea5a6662d0e40cdcd565 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 02:05:45 -0000 The branch stable/13 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=4ccafcfc86936e3b32bbea5a6662d0e40cdcd565 commit 4ccafcfc86936e3b32bbea5a6662d0e40cdcd565 Author: Kevin Bowling AuthorDate: 2021-07-20 07:06:31 +0000 Commit: Kevin Bowling CommitDate: 2021-08-03 02:04:05 +0000 e1000: Clean up igb_txrx The intention here is to reduce differences between em, igb, igc, ixgbe. The main functional change is logical simplification in igb_rx_checksum and getting interface caps from scctx instead of the ifp. Reviewed by: gallatin, markj MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D30073 (cherry picked from commit 41f02257146d128cdd4aa2bdcfdab7f9e08a4314) --- sys/dev/e1000/igb_txrx.c | 119 +++++++++++++++++++++++------------------------ 1 file changed, 59 insertions(+), 60 deletions(-) diff --git a/sys/dev/e1000/igb_txrx.c b/sys/dev/e1000/igb_txrx.c index 9f1921bf0c7e..ac768f84f810 100644 --- a/sys/dev/e1000/igb_txrx.c +++ b/sys/dev/e1000/igb_txrx.c @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2016 Matthew Macy * All rights reserved. * @@ -47,16 +49,20 @@ static int igb_isc_txd_credits_update(void *arg, uint16_t txqid, bool clear); static void igb_isc_rxd_refill(void *arg, if_rxd_update_t iru); -static void igb_isc_rxd_flush(void *arg, uint16_t rxqid, uint8_t flid __unused, qidx_t pidx); -static int igb_isc_rxd_available(void *arg, uint16_t rxqid, qidx_t idx, qidx_t budget); +static void igb_isc_rxd_flush(void *arg, uint16_t rxqid, uint8_t flid __unused, + qidx_t pidx); +static int igb_isc_rxd_available(void *arg, uint16_t rxqid, qidx_t idx, + qidx_t budget); static int igb_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri); -static int igb_tx_ctx_setup(struct tx_ring *txr, if_pkt_info_t pi, u32 *cmd_type_len, u32 *olinfo_status); -static int igb_tso_setup(struct tx_ring *txr, if_pkt_info_t pi, u32 *cmd_type_len, u32 *olinfo_status); +static int igb_tx_ctx_setup(struct tx_ring *txr, if_pkt_info_t pi, + uint32_t *cmd_type_len, uint32_t *olinfo_status); +static int igb_tso_setup(struct tx_ring *txr, if_pkt_info_t pi, + uint32_t *cmd_type_len, uint32_t *olinfo_status); -static void igb_rx_checksum(u32 staterr, if_rxd_info_t ri, u32 ptype); -static int igb_determine_rsstype(u16 pkt_info); +static void igb_rx_checksum(uint32_t staterr, if_rxd_info_t ri, uint32_t ptype); +static int igb_determine_rsstype(uint16_t pkt_info); extern void igb_if_enable_intr(if_ctx_t ctx); extern int em_intr(void *arg); @@ -79,13 +85,14 @@ struct if_txrx igb_txrx = { * **********************************************************************/ static int -igb_tso_setup(struct tx_ring *txr, if_pkt_info_t pi, u32 *cmd_type_len, u32 *olinfo_status) +igb_tso_setup(struct tx_ring *txr, if_pkt_info_t pi, uint32_t *cmd_type_len, + uint32_t *olinfo_status) { struct e1000_adv_tx_context_desc *TXD; struct adapter *adapter = txr->adapter; - u32 type_tucmd_mlhl = 0, vlan_macip_lens = 0; - u32 mss_l4len_idx = 0; - u32 paylen; + uint32_t type_tucmd_mlhl = 0, vlan_macip_lens = 0; + uint32_t mss_l4len_idx = 0; + uint32_t paylen; switch(pi->ipi_etype) { case ETHERTYPE_IPV6: @@ -143,12 +150,13 @@ igb_tso_setup(struct tx_ring *txr, if_pkt_info_t pi, u32 *cmd_type_len, u32 *oli * **********************************************************************/ static int -igb_tx_ctx_setup(struct tx_ring *txr, if_pkt_info_t pi, u32 *cmd_type_len, u32 *olinfo_status) +igb_tx_ctx_setup(struct tx_ring *txr, if_pkt_info_t pi, uint32_t *cmd_type_len, + uint32_t *olinfo_status) { struct e1000_adv_tx_context_desc *TXD; - struct adapter *adapter = txr->adapter; - u32 vlan_macip_lens, type_tucmd_mlhl; - u32 mss_l4len_idx; + struct adapter *adapter = txr->adapter; + uint32_t vlan_macip_lens, type_tucmd_mlhl; + uint32_t mss_l4len_idx; mss_l4len_idx = vlan_macip_lens = type_tucmd_mlhl = 0; /* First check if TSO is to be used */ @@ -162,7 +170,7 @@ igb_tx_ctx_setup(struct tx_ring *txr, if_pkt_info_t pi, u32 *cmd_type_len, u32 * TXD = (struct e1000_adv_tx_context_desc *) &txr->tx_base[pi->ipi_pidx]; /* - ** In advanced descriptors the vlan tag must + ** In advanced descriptors the vlan tag must ** be placed into the context descriptor. Hence ** we need to make one even if not doing offloads. */ @@ -171,7 +179,7 @@ igb_tx_ctx_setup(struct tx_ring *txr, if_pkt_info_t pi, u32 *cmd_type_len, u32 * } else if ((pi->ipi_csum_flags & IGB_CSUM_OFFLOAD) == 0) { return (0); } - + /* Set the ether header length */ vlan_macip_lens |= pi->ipi_ehdrlen << E1000_ADVTXD_MACLEN_SHIFT; @@ -236,7 +244,7 @@ igb_isc_txd_encap(void *arg, if_pkt_info_t pi) bus_dma_segment_t *segs = pi->ipi_segs; union e1000_adv_tx_desc *txd = NULL; int i, j, pidx_last; - u32 olinfo_status, cmd_type_len, txd_flags; + uint32_t olinfo_status, cmd_type_len, txd_flags; qidx_t ntxd; pidx_last = olinfo_status = 0; @@ -395,7 +403,7 @@ igb_isc_rxd_available(void *arg, uint16_t rxqid, qidx_t idx, qidx_t budget) struct em_rx_queue *que = &sc->rx_queues[rxqid]; struct rx_ring *rxr = &que->rxr; union e1000_adv_rx_desc *rxd; - u32 staterr = 0; + uint32_t staterr = 0; int cnt, i; for (cnt = 0, i = idx; cnt < scctx->isc_nrxd[0] && cnt <= budget;) { @@ -426,16 +434,15 @@ igb_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) if_softc_ctx_t scctx = adapter->shared; struct em_rx_queue *que = &adapter->rx_queues[ri->iri_qsidx]; struct rx_ring *rxr = &que->rxr; - struct ifnet *ifp = iflib_get_ifp(adapter->ctx); union e1000_adv_rx_desc *rxd; - u16 pkt_info, len; - u16 vtag = 0; - u32 ptype; - u32 staterr = 0; + uint16_t pkt_info, len, vtag; + uint32_t ptype, staterr; + int i, cidx; bool eop; - int i = 0; - int cidx = ri->iri_cidx; + + staterr = i = vtag = 0; + cidx = ri->iri_cidx; do { rxd = (union e1000_adv_rx_desc *)&rxr->rx_base[cidx]; @@ -485,14 +492,15 @@ igb_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) rxr->rx_packets++; - if ((ifp->if_capenable & IFCAP_RXCSUM) != 0) + if ((scctx->isc_capenable & IFCAP_RXCSUM) != 0) igb_rx_checksum(staterr, ri, ptype); - if ((ifp->if_capenable & IFCAP_VLAN_HWTAGGING) != 0 && + if ((scctx->isc_capenable & IFCAP_VLAN_HWTAGGING) != 0 && (staterr & E1000_RXD_STAT_VP) != 0) { ri->iri_vtag = vtag; ri->iri_flags |= M_VLANTAG; } + ri->iri_flowid = le32toh(rxd->wb.lower.hi_dword.rss); ri->iri_rsstype = igb_determine_rsstype(pkt_info); @@ -509,46 +517,37 @@ igb_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) * *********************************************************************/ static void -igb_rx_checksum(u32 staterr, if_rxd_info_t ri, u32 ptype) +igb_rx_checksum(uint32_t staterr, if_rxd_info_t ri, uint32_t ptype) { - u16 status = (u16)staterr; - u8 errors = (u8) (staterr >> 24); - bool sctp = FALSE; + uint16_t status = (uint16_t)staterr; + uint8_t errors = (uint8_t)(staterr >> 24); /* Ignore Checksum bit is set */ - if (status & E1000_RXD_STAT_IXSM) { - ri->iri_csum_flags = 0; + if (__predict_false(status & E1000_RXD_STAT_IXSM)) return; - } - if ((ptype & E1000_RXDADV_PKTTYPE_ETQF) == 0 && - (ptype & E1000_RXDADV_PKTTYPE_SCTP) != 0) - sctp = 1; - else - sctp = 0; - - if (status & E1000_RXD_STAT_IPCS) { - /* Did it pass? */ - if (!(errors & E1000_RXD_ERR_IPE)) { - /* IP Checksum Good */ - ri->iri_csum_flags = CSUM_IP_CHECKED; - ri->iri_csum_flags |= CSUM_IP_VALID; - } else - ri->iri_csum_flags = 0; - } + /* If there is a layer 3 or 4 error we are done */ + if (errors & (E1000_RXD_ERR_IPE | E1000_RXD_ERR_TCPE)) + return; - if (status & (E1000_RXD_STAT_TCPCS | E1000_RXD_STAT_UDPCS)) { - u64 type = (CSUM_DATA_VALID | CSUM_PSEUDO_HDR); - if (sctp) /* reassign */ - type = CSUM_SCTP_VALID; - /* Did it pass? */ - if (!(errors & E1000_RXD_ERR_TCPE)) { - ri->iri_csum_flags |= type; - if (sctp == 0) - ri->iri_csum_data = htons(0xffff); + /* IP Checksum Good */ + if (status & E1000_RXD_STAT_IPCS) + ri->iri_csum_flags = (CSUM_IP_CHECKED | CSUM_IP_VALID); + + /* Valid L4E checksum */ + if (__predict_true(status & + (E1000_RXD_STAT_TCPCS | E1000_RXD_STAT_UDPCS))) { + /* SCTP header present. + * XXXKB: ETQF doesn't appear to be used in igb? + */ + if (__predict_false((ptype & E1000_RXDADV_PKTTYPE_ETQF) == 0 && + (ptype & E1000_RXDADV_PKTTYPE_SCTP) != 0)) { + ri->iri_csum_flags |= CSUM_SCTP_VALID; + } else { + ri->iri_csum_flags |= CSUM_DATA_VALID | CSUM_PSEUDO_HDR; + ri->iri_csum_data = htons(0xffff); } } - return; } /******************************************************************** @@ -557,7 +556,7 @@ igb_rx_checksum(u32 staterr, if_rxd_info_t ri, u32 ptype) * ******************************************************************/ static int -igb_determine_rsstype(u16 pkt_info) +igb_determine_rsstype(uint16_t pkt_info) { switch (pkt_info & E1000_RXDADV_RSSTYPE_MASK) { case E1000_RXDADV_RSSTYPE_IPV4_TCP: From owner-dev-commits-src-all@freebsd.org Tue Aug 3 02:05:46 2021 Return-Path: Delivered-To: dev-commits-src-all@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 DD70067E0F3; Tue, 3 Aug 2021 02:05: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 4Gdyrp4hgQz4Tj7; Tue, 3 Aug 2021 02:05: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 8935628A2; Tue, 3 Aug 2021 02:05: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 17325kU9052618; Tue, 3 Aug 2021 02:05:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17325kCF052617; Tue, 3 Aug 2021 02:05:46 GMT (envelope-from git) Date: Tue, 3 Aug 2021 02:05:46 GMT Message-Id: <202108030205.17325kCF052617@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kevin Bowling Subject: git: b91bb9b07f75 - stable/13 - e1000: Add missing branch prediction MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: b91bb9b07f75e8f014ce26fb20617f9de56c59a1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 02:05:47 -0000 The branch stable/13 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=b91bb9b07f75e8f014ce26fb20617f9de56c59a1 commit b91bb9b07f75e8f014ce26fb20617f9de56c59a1 Author: Kevin Bowling AuthorDate: 2021-07-20 07:21:21 +0000 Commit: Kevin Bowling CommitDate: 2021-08-03 02:04:31 +0000 e1000: Add missing branch prediction I missed this edit from the ixgbe review (D30074) Reviewed by: gallatin MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D30073 (cherry picked from commit 9fd0cda92d3346e1daa30eb48e185e2077ac0566) --- sys/dev/e1000/igb_txrx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/e1000/igb_txrx.c b/sys/dev/e1000/igb_txrx.c index ac768f84f810..75c5c160bf3e 100644 --- a/sys/dev/e1000/igb_txrx.c +++ b/sys/dev/e1000/igb_txrx.c @@ -527,7 +527,7 @@ igb_rx_checksum(uint32_t staterr, if_rxd_info_t ri, uint32_t ptype) return; /* If there is a layer 3 or 4 error we are done */ - if (errors & (E1000_RXD_ERR_IPE | E1000_RXD_ERR_TCPE)) + if (__predict_false(errors & (E1000_RXD_ERR_IPE | E1000_RXD_ERR_TCPE))) return; /* IP Checksum Good */ From owner-dev-commits-src-all@freebsd.org Tue Aug 3 02:05:48 2021 Return-Path: Delivered-To: dev-commits-src-all@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 215FE67E109; Tue, 3 Aug 2021 02:05: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 4Gdyrq5lsdz4TQl; Tue, 3 Aug 2021 02:05: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 AD89922E4; Tue, 3 Aug 2021 02:05: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 17325ljw052642; Tue, 3 Aug 2021 02:05:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17325loV052641; Tue, 3 Aug 2021 02:05:47 GMT (envelope-from git) Date: Tue, 3 Aug 2021 02:05:47 GMT Message-Id: <202108030205.17325loV052641@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kevin Bowling Subject: git: bb048438e7e5 - stable/13 - igb: clean up igb_txrx comments MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: bb048438e7e580169b5255711ed8e6e9e9faf59c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 02:05:48 -0000 The branch stable/13 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=bb048438e7e580169b5255711ed8e6e9e9faf59c commit bb048438e7e580169b5255711ed8e6e9e9faf59c Author: Kevin Bowling AuthorDate: 2021-07-31 15:04:25 +0000 Commit: Kevin Bowling CommitDate: 2021-08-03 02:04:46 +0000 igb: clean up igb_txrx comments Reviewed by: grehan MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D31227 (cherry picked from commit ff01d6343f1f0c6550e4072eddda91dabd366d09) --- sys/dev/e1000/igb_txrx.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/sys/dev/e1000/igb_txrx.c b/sys/dev/e1000/igb_txrx.c index 75c5c160bf3e..2252270fa5ea 100644 --- a/sys/dev/e1000/igb_txrx.c +++ b/sys/dev/e1000/igb_txrx.c @@ -522,7 +522,6 @@ igb_rx_checksum(uint32_t staterr, if_rxd_info_t ri, uint32_t ptype) uint16_t status = (uint16_t)staterr; uint8_t errors = (uint8_t)(staterr >> 24); - /* Ignore Checksum bit is set */ if (__predict_false(status & E1000_RXD_STAT_IXSM)) return; @@ -537,9 +536,7 @@ igb_rx_checksum(uint32_t staterr, if_rxd_info_t ri, uint32_t ptype) /* Valid L4E checksum */ if (__predict_true(status & (E1000_RXD_STAT_TCPCS | E1000_RXD_STAT_UDPCS))) { - /* SCTP header present. - * XXXKB: ETQF doesn't appear to be used in igb? - */ + /* SCTP header present */ if (__predict_false((ptype & E1000_RXDADV_PKTTYPE_ETQF) == 0 && (ptype & E1000_RXDADV_PKTTYPE_SCTP) != 0)) { ri->iri_csum_flags |= CSUM_SCTP_VALID; From owner-dev-commits-src-all@freebsd.org Tue Aug 3 02:11:59 2021 Return-Path: Delivered-To: dev-commits-src-all@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 E39D167E5BF; Tue, 3 Aug 2021 02:11: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 4Gdyzz65yKz4V8r; Tue, 3 Aug 2021 02:11: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 B9D5F26F4; Tue, 3 Aug 2021 02:11: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 1732Bx0I064574; Tue, 3 Aug 2021 02:11:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1732BxCU064573; Tue, 3 Aug 2021 02:11:59 GMT (envelope-from git) Date: Tue, 3 Aug 2021 02:11:59 GMT Message-Id: <202108030211.1732BxCU064573@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kevin Bowling Subject: git: 0861c2c695a7 - stable/12 - e1000: Clean up igb_txrx MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 0861c2c695a770a789bc291b85ec1311d55c37dd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 02:12:00 -0000 The branch stable/12 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=0861c2c695a770a789bc291b85ec1311d55c37dd commit 0861c2c695a770a789bc291b85ec1311d55c37dd Author: Kevin Bowling AuthorDate: 2021-07-20 07:06:31 +0000 Commit: Kevin Bowling CommitDate: 2021-08-03 02:09:14 +0000 e1000: Clean up igb_txrx The intention here is to reduce differences between em, igb, igc, ixgbe. The main functional change is logical simplification in igb_rx_checksum and getting interface caps from scctx instead of the ifp. Reviewed by: gallatin, markj MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D30073 (cherry picked from commit 41f02257146d128cdd4aa2bdcfdab7f9e08a4314) --- sys/dev/e1000/igb_txrx.c | 119 +++++++++++++++++++++++------------------------ 1 file changed, 59 insertions(+), 60 deletions(-) diff --git a/sys/dev/e1000/igb_txrx.c b/sys/dev/e1000/igb_txrx.c index 6c41d440c769..4430f3136446 100644 --- a/sys/dev/e1000/igb_txrx.c +++ b/sys/dev/e1000/igb_txrx.c @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2016 Matthew Macy * All rights reserved. * @@ -47,16 +49,20 @@ static int igb_isc_txd_credits_update(void *arg, uint16_t txqid, bool clear); static void igb_isc_rxd_refill(void *arg, if_rxd_update_t iru); -static void igb_isc_rxd_flush(void *arg, uint16_t rxqid, uint8_t flid __unused, qidx_t pidx); -static int igb_isc_rxd_available(void *arg, uint16_t rxqid, qidx_t idx, qidx_t budget); +static void igb_isc_rxd_flush(void *arg, uint16_t rxqid, uint8_t flid __unused, + qidx_t pidx); +static int igb_isc_rxd_available(void *arg, uint16_t rxqid, qidx_t idx, + qidx_t budget); static int igb_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri); -static int igb_tx_ctx_setup(struct tx_ring *txr, if_pkt_info_t pi, u32 *cmd_type_len, u32 *olinfo_status); -static int igb_tso_setup(struct tx_ring *txr, if_pkt_info_t pi, u32 *cmd_type_len, u32 *olinfo_status); +static int igb_tx_ctx_setup(struct tx_ring *txr, if_pkt_info_t pi, + uint32_t *cmd_type_len, uint32_t *olinfo_status); +static int igb_tso_setup(struct tx_ring *txr, if_pkt_info_t pi, + uint32_t *cmd_type_len, uint32_t *olinfo_status); -static void igb_rx_checksum(u32 staterr, if_rxd_info_t ri, u32 ptype); -static int igb_determine_rsstype(u16 pkt_info); +static void igb_rx_checksum(uint32_t staterr, if_rxd_info_t ri, uint32_t ptype); +static int igb_determine_rsstype(uint16_t pkt_info); extern void igb_if_enable_intr(if_ctx_t ctx); extern int em_intr(void *arg); @@ -81,13 +87,14 @@ extern if_shared_ctx_t em_sctx; * **********************************************************************/ static int -igb_tso_setup(struct tx_ring *txr, if_pkt_info_t pi, u32 *cmd_type_len, u32 *olinfo_status) +igb_tso_setup(struct tx_ring *txr, if_pkt_info_t pi, uint32_t *cmd_type_len, + uint32_t *olinfo_status) { struct e1000_adv_tx_context_desc *TXD; struct adapter *adapter = txr->adapter; - u32 type_tucmd_mlhl = 0, vlan_macip_lens = 0; - u32 mss_l4len_idx = 0; - u32 paylen; + uint32_t type_tucmd_mlhl = 0, vlan_macip_lens = 0; + uint32_t mss_l4len_idx = 0; + uint32_t paylen; switch(pi->ipi_etype) { case ETHERTYPE_IPV6: @@ -145,12 +152,13 @@ igb_tso_setup(struct tx_ring *txr, if_pkt_info_t pi, u32 *cmd_type_len, u32 *oli * **********************************************************************/ static int -igb_tx_ctx_setup(struct tx_ring *txr, if_pkt_info_t pi, u32 *cmd_type_len, u32 *olinfo_status) +igb_tx_ctx_setup(struct tx_ring *txr, if_pkt_info_t pi, uint32_t *cmd_type_len, + uint32_t *olinfo_status) { struct e1000_adv_tx_context_desc *TXD; - struct adapter *adapter = txr->adapter; - u32 vlan_macip_lens, type_tucmd_mlhl; - u32 mss_l4len_idx; + struct adapter *adapter = txr->adapter; + uint32_t vlan_macip_lens, type_tucmd_mlhl; + uint32_t mss_l4len_idx; mss_l4len_idx = vlan_macip_lens = type_tucmd_mlhl = 0; /* First check if TSO is to be used */ @@ -164,7 +172,7 @@ igb_tx_ctx_setup(struct tx_ring *txr, if_pkt_info_t pi, u32 *cmd_type_len, u32 * TXD = (struct e1000_adv_tx_context_desc *) &txr->tx_base[pi->ipi_pidx]; /* - ** In advanced descriptors the vlan tag must + ** In advanced descriptors the vlan tag must ** be placed into the context descriptor. Hence ** we need to make one even if not doing offloads. */ @@ -173,7 +181,7 @@ igb_tx_ctx_setup(struct tx_ring *txr, if_pkt_info_t pi, u32 *cmd_type_len, u32 * } else if ((pi->ipi_csum_flags & IGB_CSUM_OFFLOAD) == 0) { return (0); } - + /* Set the ether header length */ vlan_macip_lens |= pi->ipi_ehdrlen << E1000_ADVTXD_MACLEN_SHIFT; @@ -238,7 +246,7 @@ igb_isc_txd_encap(void *arg, if_pkt_info_t pi) bus_dma_segment_t *segs = pi->ipi_segs; union e1000_adv_tx_desc *txd = NULL; int i, j, pidx_last; - u32 olinfo_status, cmd_type_len, txd_flags; + uint32_t olinfo_status, cmd_type_len, txd_flags; qidx_t ntxd; pidx_last = olinfo_status = 0; @@ -397,7 +405,7 @@ igb_isc_rxd_available(void *arg, uint16_t rxqid, qidx_t idx, qidx_t budget) struct em_rx_queue *que = &sc->rx_queues[rxqid]; struct rx_ring *rxr = &que->rxr; union e1000_adv_rx_desc *rxd; - u32 staterr = 0; + uint32_t staterr = 0; int cnt, i; for (cnt = 0, i = idx; cnt < scctx->isc_nrxd[0] && cnt <= budget;) { @@ -428,16 +436,15 @@ igb_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) if_softc_ctx_t scctx = adapter->shared; struct em_rx_queue *que = &adapter->rx_queues[ri->iri_qsidx]; struct rx_ring *rxr = &que->rxr; - struct ifnet *ifp = iflib_get_ifp(adapter->ctx); union e1000_adv_rx_desc *rxd; - u16 pkt_info, len; - u16 vtag = 0; - u32 ptype; - u32 staterr = 0; + uint16_t pkt_info, len, vtag; + uint32_t ptype, staterr; + int i, cidx; bool eop; - int i = 0; - int cidx = ri->iri_cidx; + + staterr = i = vtag = 0; + cidx = ri->iri_cidx; do { rxd = (union e1000_adv_rx_desc *)&rxr->rx_base[cidx]; @@ -487,14 +494,15 @@ igb_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) rxr->rx_packets++; - if ((ifp->if_capenable & IFCAP_RXCSUM) != 0) + if ((scctx->isc_capenable & IFCAP_RXCSUM) != 0) igb_rx_checksum(staterr, ri, ptype); - if ((ifp->if_capenable & IFCAP_VLAN_HWTAGGING) != 0 && + if ((scctx->isc_capenable & IFCAP_VLAN_HWTAGGING) != 0 && (staterr & E1000_RXD_STAT_VP) != 0) { ri->iri_vtag = vtag; ri->iri_flags |= M_VLANTAG; } + ri->iri_flowid = le32toh(rxd->wb.lower.hi_dword.rss); ri->iri_rsstype = igb_determine_rsstype(pkt_info); @@ -511,46 +519,37 @@ igb_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) * *********************************************************************/ static void -igb_rx_checksum(u32 staterr, if_rxd_info_t ri, u32 ptype) +igb_rx_checksum(uint32_t staterr, if_rxd_info_t ri, uint32_t ptype) { - u16 status = (u16)staterr; - u8 errors = (u8) (staterr >> 24); - bool sctp = FALSE; + uint16_t status = (uint16_t)staterr; + uint8_t errors = (uint8_t)(staterr >> 24); /* Ignore Checksum bit is set */ - if (status & E1000_RXD_STAT_IXSM) { - ri->iri_csum_flags = 0; + if (__predict_false(status & E1000_RXD_STAT_IXSM)) return; - } - if ((ptype & E1000_RXDADV_PKTTYPE_ETQF) == 0 && - (ptype & E1000_RXDADV_PKTTYPE_SCTP) != 0) - sctp = 1; - else - sctp = 0; - - if (status & E1000_RXD_STAT_IPCS) { - /* Did it pass? */ - if (!(errors & E1000_RXD_ERR_IPE)) { - /* IP Checksum Good */ - ri->iri_csum_flags = CSUM_IP_CHECKED; - ri->iri_csum_flags |= CSUM_IP_VALID; - } else - ri->iri_csum_flags = 0; - } + /* If there is a layer 3 or 4 error we are done */ + if (errors & (E1000_RXD_ERR_IPE | E1000_RXD_ERR_TCPE)) + return; - if (status & (E1000_RXD_STAT_TCPCS | E1000_RXD_STAT_UDPCS)) { - u64 type = (CSUM_DATA_VALID | CSUM_PSEUDO_HDR); - if (sctp) /* reassign */ - type = CSUM_SCTP_VALID; - /* Did it pass? */ - if (!(errors & E1000_RXD_ERR_TCPE)) { - ri->iri_csum_flags |= type; - if (sctp == 0) - ri->iri_csum_data = htons(0xffff); + /* IP Checksum Good */ + if (status & E1000_RXD_STAT_IPCS) + ri->iri_csum_flags = (CSUM_IP_CHECKED | CSUM_IP_VALID); + + /* Valid L4E checksum */ + if (__predict_true(status & + (E1000_RXD_STAT_TCPCS | E1000_RXD_STAT_UDPCS))) { + /* SCTP header present. + * XXXKB: ETQF doesn't appear to be used in igb? + */ + if (__predict_false((ptype & E1000_RXDADV_PKTTYPE_ETQF) == 0 && + (ptype & E1000_RXDADV_PKTTYPE_SCTP) != 0)) { + ri->iri_csum_flags |= CSUM_SCTP_VALID; + } else { + ri->iri_csum_flags |= CSUM_DATA_VALID | CSUM_PSEUDO_HDR; + ri->iri_csum_data = htons(0xffff); } } - return; } /******************************************************************** @@ -559,7 +558,7 @@ igb_rx_checksum(u32 staterr, if_rxd_info_t ri, u32 ptype) * ******************************************************************/ static int -igb_determine_rsstype(u16 pkt_info) +igb_determine_rsstype(uint16_t pkt_info) { switch (pkt_info & E1000_RXDADV_RSSTYPE_MASK) { case E1000_RXDADV_RSSTYPE_IPV4_TCP: From owner-dev-commits-src-all@freebsd.org Tue Aug 3 02:12:01 2021 Return-Path: Delivered-To: dev-commits-src-all@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 31CC167E27A; Tue, 3 Aug 2021 02: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 4Gdz010mJgz4Tyt; Tue, 3 Aug 2021 02: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 EEB292C0C; Tue, 3 Aug 2021 02:12: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 1732C0wC064598; Tue, 3 Aug 2021 02:12:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1732C0Ts064597; Tue, 3 Aug 2021 02:12:00 GMT (envelope-from git) Date: Tue, 3 Aug 2021 02:12:00 GMT Message-Id: <202108030212.1732C0Ts064597@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kevin Bowling Subject: git: a1b9408f97d1 - stable/12 - e1000: Add missing branch prediction MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: a1b9408f97d194e0c5a926b1acb42f212cd0ec9d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 02:12:01 -0000 The branch stable/12 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=a1b9408f97d194e0c5a926b1acb42f212cd0ec9d commit a1b9408f97d194e0c5a926b1acb42f212cd0ec9d Author: Kevin Bowling AuthorDate: 2021-07-20 07:21:21 +0000 Commit: Kevin Bowling CommitDate: 2021-08-03 02:10:29 +0000 e1000: Add missing branch prediction I missed this edit from the ixgbe review (D30074) Reviewed by: gallatin MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D30073 (cherry picked from commit 9fd0cda92d3346e1daa30eb48e185e2077ac0566) --- sys/dev/e1000/igb_txrx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/e1000/igb_txrx.c b/sys/dev/e1000/igb_txrx.c index 4430f3136446..24a80c1857b2 100644 --- a/sys/dev/e1000/igb_txrx.c +++ b/sys/dev/e1000/igb_txrx.c @@ -529,7 +529,7 @@ igb_rx_checksum(uint32_t staterr, if_rxd_info_t ri, uint32_t ptype) return; /* If there is a layer 3 or 4 error we are done */ - if (errors & (E1000_RXD_ERR_IPE | E1000_RXD_ERR_TCPE)) + if (__predict_false(errors & (E1000_RXD_ERR_IPE | E1000_RXD_ERR_TCPE))) return; /* IP Checksum Good */ From owner-dev-commits-src-all@freebsd.org Tue Aug 3 02:12:02 2021 Return-Path: Delivered-To: dev-commits-src-all@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 6166C67DE78; Tue, 3 Aug 2021 02: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 4Gdz0224Dwz4Tqf; Tue, 3 Aug 2021 02: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 1F42C2A75; Tue, 3 Aug 2021 02: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 1732C12a064622; Tue, 3 Aug 2021 02: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 1732C1oA064621; Tue, 3 Aug 2021 02:12:01 GMT (envelope-from git) Date: Tue, 3 Aug 2021 02:12:01 GMT Message-Id: <202108030212.1732C1oA064621@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kevin Bowling Subject: git: 2c99e12ff176 - stable/12 - igb: clean up igb_txrx comments MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 2c99e12ff1761ea66fe2ed183e55a7cb60cc0007 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 02:12:02 -0000 The branch stable/12 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=2c99e12ff1761ea66fe2ed183e55a7cb60cc0007 commit 2c99e12ff1761ea66fe2ed183e55a7cb60cc0007 Author: Kevin Bowling AuthorDate: 2021-07-31 15:04:25 +0000 Commit: Kevin Bowling CommitDate: 2021-08-03 02:10:52 +0000 igb: clean up igb_txrx comments Reviewed by: grehan MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D31227 (cherry picked from commit ff01d6343f1f0c6550e4072eddda91dabd366d09) --- sys/dev/e1000/igb_txrx.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/sys/dev/e1000/igb_txrx.c b/sys/dev/e1000/igb_txrx.c index 24a80c1857b2..3aa13fe2a1d4 100644 --- a/sys/dev/e1000/igb_txrx.c +++ b/sys/dev/e1000/igb_txrx.c @@ -524,7 +524,6 @@ igb_rx_checksum(uint32_t staterr, if_rxd_info_t ri, uint32_t ptype) uint16_t status = (uint16_t)staterr; uint8_t errors = (uint8_t)(staterr >> 24); - /* Ignore Checksum bit is set */ if (__predict_false(status & E1000_RXD_STAT_IXSM)) return; @@ -539,9 +538,7 @@ igb_rx_checksum(uint32_t staterr, if_rxd_info_t ri, uint32_t ptype) /* Valid L4E checksum */ if (__predict_true(status & (E1000_RXD_STAT_TCPCS | E1000_RXD_STAT_UDPCS))) { - /* SCTP header present. - * XXXKB: ETQF doesn't appear to be used in igb? - */ + /* SCTP header present */ if (__predict_false((ptype & E1000_RXDADV_PKTTYPE_ETQF) == 0 && (ptype & E1000_RXDADV_PKTTYPE_SCTP) != 0)) { ri->iri_csum_flags |= CSUM_SCTP_VALID; From owner-dev-commits-src-all@freebsd.org Tue Aug 3 02:12:56 2021 Return-Path: Delivered-To: dev-commits-src-all@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 4B1F867E702; Tue, 3 Aug 2021 02:12: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 4Gdz141fN7z4Twl; Tue, 3 Aug 2021 02:12: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 21D802C10; Tue, 3 Aug 2021 02:12: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 1732CuJV065683; Tue, 3 Aug 2021 02:12:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1732Cufb065682; Tue, 3 Aug 2021 02:12:56 GMT (envelope-from git) Date: Tue, 3 Aug 2021 02:12:56 GMT Message-Id: <202108030212.1732Cufb065682@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 04cc0c393c31 - main - malloc(9): provide missing malloc_aligned implementation MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 04cc0c393c317b6d5e28c8dc80cd1b5ea071f28f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 02:12:56 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=04cc0c393c317b6d5e28c8dc80cd1b5ea071f28f commit 04cc0c393c317b6d5e28c8dc80cd1b5ea071f28f Author: Kyle Evans AuthorDate: 2021-08-03 02:11:44 +0000 Commit: Kyle Evans CommitDate: 2021-08-03 02:12:39 +0000 malloc(9): provide missing malloc_aligned implementation Pointy hat: kevans Fixes: 6162cf885c00 ("malloc(9): Document/complete aligned variants") --- sys/kern/kern_malloc.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c index bd0f46ea5220..0c2f1689d194 100644 --- a/sys/kern/kern_malloc.c +++ b/sys/kern/kern_malloc.c @@ -771,6 +771,13 @@ malloc_domainset_exec(size_t size, struct malloc_type *mtp, struct domainset *ds return (malloc_large(size, mtp, ds, flags DEBUG_REDZONE_ARG)); } +void * +malloc_aligned(size_t size, size_t align, struct malloc_type *type, int flags) +{ + return (malloc_domainset_aligned(size, align, type, DOMAINSET_RR(), + flags)); +} + void * malloc_domainset_aligned(size_t size, size_t align, struct malloc_type *mtp, struct domainset *ds, int flags) From owner-dev-commits-src-all@freebsd.org Tue Aug 3 02:45:38 2021 Return-Path: Delivered-To: dev-commits-src-all@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 F1CD067EBD2; Tue, 3 Aug 2021 02:45: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 4Gdzkp6F7kz4WlV; Tue, 3 Aug 2021 02:45:38 +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 BE5552E4A; Tue, 3 Aug 2021 02:45: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 1732jcXZ005451; Tue, 3 Aug 2021 02:45:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1732jcXC005450; Tue, 3 Aug 2021 02:45:38 GMT (envelope-from git) Date: Tue, 3 Aug 2021 02:45:38 GMT Message-Id: <202108030245.1732jcXC005450@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 814254f51b96 - stable/13 - Remove opensolaris_atomic.S dependency. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 814254f51b9672dada372b5e7b8ec977caefa2fd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 02:45:39 -0000 The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=814254f51b9672dada372b5e7b8ec977caefa2fd commit 814254f51b9672dada372b5e7b8ec977caefa2fd Author: Alexander Motin AuthorDate: 2021-07-27 23:50:52 +0000 Commit: Alexander Motin CommitDate: 2021-08-03 02:45:04 +0000 Remove opensolaris_atomic.S dependency. This file is no longer there, so this broke static zfs build. (cherry picked from commit e0229c5110d2a35e1cc464a596fff2498b836b1c) --- sys/conf/files.i386 | 1 - 1 file changed, 1 deletion(-) diff --git a/sys/conf/files.i386 b/sys/conf/files.i386 index 4bbd584cb831..602b86a7bdf3 100644 --- a/sys/conf/files.i386 +++ b/sys/conf/files.i386 @@ -47,7 +47,6 @@ linux_vdso.so optional compat_linux \ no-implicit-rule \ clean "linux_vdso.so" # -cddl/contrib/opensolaris/common/atomic/i386/opensolaris_atomic.S optional zfs | dtrace compile-with "${ZFS_S}" cddl/dev/dtrace/i386/dtrace_asm.S optional dtrace compile-with "${DTRACE_S}" cddl/dev/dtrace/i386/dtrace_subr.c optional dtrace compile-with "${DTRACE_C}" compat/linprocfs/linprocfs.c optional linprocfs From owner-dev-commits-src-all@freebsd.org Tue Aug 3 09:38:52 2021 Return-Path: Delivered-To: dev-commits-src-all@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 3CFF1634644; Tue, 3 Aug 2021 09:38:52 +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 4Gf8vc1DWfz3MtX; Tue, 3 Aug 2021 09:38:52 +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 12941110E2; Tue, 3 Aug 2021 09:38: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 1739cp2o055483; Tue, 3 Aug 2021 09:38:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1739cprS055482; Tue, 3 Aug 2021 09:38:51 GMT (envelope-from git) Date: Tue, 3 Aug 2021 09:38:51 GMT Message-Id: <202108030938.1739cprS055482@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: 428a32edba4c - main - Use .sinclude for bsd.sanitizer.mk 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: 428a32edba4c3bf3cfc0e4cf240c1b29397ecdbb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 09:38:52 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=428a32edba4c3bf3cfc0e4cf240c1b29397ecdbb commit 428a32edba4c3bf3cfc0e4cf240c1b29397ecdbb Author: Alex Richardson AuthorDate: 2021-08-03 09:37:28 +0000 Commit: Alex Richardson CommitDate: 2021-08-03 09:38:20 +0000 Use .sinclude for bsd.sanitizer.mk We don't install this file since MK_ASAN/MK_UBSAN is only supported for src builds. However, some ports also use bsd.lib.mk/bsd.prog.mk so we should not fail the build if it can't be included. Reported by: jkim Fixes: 7bc797e3f380 ("Add build system support for ASAN+UBSAN instrumentation") --- share/mk/bsd.lib.mk | 3 ++- share/mk/bsd.prog.mk | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk index 5de74b6fa056..aaac0b68d984 100644 --- a/share/mk/bsd.lib.mk +++ b/share/mk/bsd.lib.mk @@ -108,7 +108,8 @@ CXXFLAGS+= -ftrivial-auto-var-init=pattern .endif .endif -.include "bsd.sanitizer.mk" +# bsd.sanitizer.mk is not installed, so don't require it (e.g. for ports). +.sinclude "bsd.sanitizer.mk" .if ${MK_DEBUG_FILES} != "no" && empty(DEBUG_FLAGS:M-g) && \ empty(DEBUG_FLAGS:M-gdwarf*) diff --git a/share/mk/bsd.prog.mk b/share/mk/bsd.prog.mk index 96d72daf2611..4f00be193874 100644 --- a/share/mk/bsd.prog.mk +++ b/share/mk/bsd.prog.mk @@ -81,7 +81,8 @@ CXXFLAGS+= -ftrivial-auto-var-init=pattern .endif .endif -.include "bsd.sanitizer.mk" +# bsd.sanitizer.mk is not installed, so don't require it (e.g. for ports). +.sinclude "bsd.sanitizer.mk" .if ${MACHINE_CPUARCH} == "riscv" && ${LINKER_FEATURES:Mriscv-relaxations} == "" CFLAGS += -mno-relax From owner-dev-commits-src-all@freebsd.org Tue Aug 3 09:52:44 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A5E5A6347C5; Tue, 3 Aug 2021 09:52: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 4Gf9Cc4NBKz3NRx; Tue, 3 Aug 2021 09:52: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 7EF0A10E74; Tue, 3 Aug 2021 09:52: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 1739qigV081279; Tue, 3 Aug 2021 09:52:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1739qiV3081278; Tue, 3 Aug 2021 09:52:44 GMT (envelope-from git) Date: Tue, 3 Aug 2021 09:52:44 GMT Message-Id: <202108030952.1739qiV3081278@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 75e8553e7908 - stable/13 - null_bypass(): some style 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 75e8553e790877b1339597bbf7f880399392d724 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 09:52:44 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=75e8553e790877b1339597bbf7f880399392d724 commit 75e8553e790877b1339597bbf7f880399392d724 Author: Konstantin Belousov AuthorDate: 2021-07-20 00:48:49 +0000 Commit: Konstantin Belousov CommitDate: 2021-08-03 09:52:35 +0000 null_bypass(): some style (cherry picked from commit 7b7227c4a601d92a46cf625ca7ae245664a809fe) --- sys/fs/nullfs/null_vnops.c | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/sys/fs/nullfs/null_vnops.c b/sys/fs/nullfs/null_vnops.c index 3b4e30d8a499..29be2a34614c 100644 --- a/sys/fs/nullfs/null_vnops.c +++ b/sys/fs/nullfs/null_vnops.c @@ -223,13 +223,12 @@ int null_bypass(struct vop_generic_args *ap) { struct vnode **this_vp_p; - int error; struct vnode *old_vps[VDESC_MAX_VPS]; struct vnode **vps_p[VDESC_MAX_VPS]; struct vnode ***vppp; struct vnode *lvp; struct vnodeop_desc *descp = ap->a_desc; - int reles, i; + int error, i, reles; if (null_bug_bypass) printf ("null_bypass: %s\n", descp->vdesc_name); @@ -252,26 +251,28 @@ null_bypass(struct vop_generic_args *ap) for (i = 0; i < VDESC_MAX_VPS; reles >>= 1, i++) { if (descp->vdesc_vp_offsets[i] == VDESC_NO_OFFSET) break; /* bail out at end of list */ - vps_p[i] = this_vp_p = - VOPARG_OFFSETTO(struct vnode**,descp->vdesc_vp_offsets[i],ap); + vps_p[i] = this_vp_p = VOPARG_OFFSETTO(struct vnode **, + descp->vdesc_vp_offsets[i], ap); + /* * We're not guaranteed that any but the first vnode * are of our type. Check for and don't map any * that aren't. (We must always map first vp or vclean fails.) */ - if (i && (*this_vp_p == NULLVP || + if (i != 0 && (*this_vp_p == NULLVP || (*this_vp_p)->v_op != &null_vnodeops)) { old_vps[i] = NULLVP; } else { old_vps[i] = *this_vp_p; *(vps_p[i]) = NULLVPTOLOWERVP(*this_vp_p); + /* * XXX - Several operations have the side effect * of vrele'ing their vp's. We must account for * that. (This should go away in the future.) */ if (reles & VDESC_VP0_WILLRELE) - VREF(*this_vp_p); + vref(*this_vp_p); } } @@ -279,9 +280,9 @@ null_bypass(struct vop_generic_args *ap) * Call the operation on the lower layer * with the modified argument structure. */ - if (vps_p[0] && *vps_p[0]) + if (vps_p[0] != NULL && *vps_p[0] != NULL) { error = VCALL(ap); - else { + } else { printf("null_bypass: no map for %s\n", descp->vdesc_name); error = EINVAL; } @@ -295,7 +296,7 @@ null_bypass(struct vop_generic_args *ap) for (i = 0; i < VDESC_MAX_VPS; reles >>= 1, i++) { if (descp->vdesc_vp_offsets[i] == VDESC_NO_OFFSET) break; /* bail out at end of list */ - if (old_vps[i]) { + if (old_vps[i] != NULL) { lvp = *(vps_p[i]); /* @@ -328,17 +329,18 @@ null_bypass(struct vop_generic_args *ap) * (Assumes that the lower layer always returns * a VREF'ed vpp unless it gets an error.) */ - if (descp->vdesc_vpp_offset != VDESC_NO_OFFSET && !error) { + if (descp->vdesc_vpp_offset != VDESC_NO_OFFSET && error == 0) { /* * XXX - even though some ops have vpp returned vp's, * several ops actually vrele this before returning. * We must avoid these ops. * (This should go away when these ops are regularized.) */ - vppp = VOPARG_OFFSETTO(struct vnode***, - descp->vdesc_vpp_offset,ap); - if (*vppp) - error = null_nodeget(old_vps[0]->v_mount, **vppp, *vppp); + vppp = VOPARG_OFFSETTO(struct vnode ***, + descp->vdesc_vpp_offset, ap); + if (*vppp != NULL) + error = null_nodeget(old_vps[0]->v_mount, **vppp, + *vppp); } return (error); From owner-dev-commits-src-all@freebsd.org Tue Aug 3 09:52:45 2021 Return-Path: Delivered-To: dev-commits-src-all@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 D478563481A; Tue, 3 Aug 2021 09:52: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 4Gf9Cd5MrHz3NZ6; Tue, 3 Aug 2021 09:52: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 A04A81159B; Tue, 3 Aug 2021 09:52: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 1739qjQF081305; Tue, 3 Aug 2021 09:52:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1739qjhk081304; Tue, 3 Aug 2021 09:52:45 GMT (envelope-from git) Date: Tue, 3 Aug 2021 09:52:45 GMT Message-Id: <202108030952.1739qjhk081304@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: b5eaf005273b - stable/13 - nullfs: provide custom null_advlock bypass 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/stable/13 X-Git-Reftype: branch X-Git-Commit: b5eaf005273b5e23db8e83e08b0bd32bbbbe1d53 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 09:52:46 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=b5eaf005273b5e23db8e83e08b0bd32bbbbe1d53 commit b5eaf005273b5e23db8e83e08b0bd32bbbbe1d53 Author: Konstantin Belousov AuthorDate: 2021-07-17 22:56:47 +0000 Commit: Konstantin Belousov CommitDate: 2021-08-03 09:52:35 +0000 nullfs: provide custom null_advlock bypass (cherry picked from commit 161e9a97363d17caf0b47983b28a37f3f59f9978) --- sys/fs/nullfs/null_vnops.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/sys/fs/nullfs/null_vnops.c b/sys/fs/nullfs/null_vnops.c index 29be2a34614c..4dfc5efaf9ed 100644 --- a/sys/fs/nullfs/null_vnops.c +++ b/sys/fs/nullfs/null_vnops.c @@ -980,6 +980,28 @@ null_read_pgcache(struct vop_read_pgcache_args *ap) return (error); } +static int +null_advlock(struct vop_advlock_args *ap) +{ + struct vnode *lvp, *vp; + struct null_node *xp; + int error; + + vp = ap->a_vp; + VI_LOCK(vp); + xp = VTONULL(vp); + if (xp == NULL) { + VI_UNLOCK(vp); + return (EBADF); + } + lvp = xp->null_lowervp; + vref(lvp); + VI_UNLOCK(vp); + error = VOP_ADVLOCK(lvp, ap->a_id, ap->a_op, ap->a_fl, ap->a_flags); + vrele(lvp); + return (error); +} + /* * Avoid standard bypass, since lower dvp and vp could be no longer * valid after vput(). @@ -1035,6 +1057,7 @@ struct vop_vector null_vnodeops = { .vop_bypass = null_bypass, .vop_access = null_access, .vop_accessx = null_accessx, + .vop_advlock = null_advlock, .vop_advlockpurge = vop_stdadvlockpurge, .vop_bmap = VOP_EOPNOTSUPP, .vop_stat = null_stat, From owner-dev-commits-src-all@freebsd.org Tue Aug 3 09:52:47 2021 Return-Path: Delivered-To: dev-commits-src-all@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 6EBC2634A66; Tue, 3 Aug 2021 09:52: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 4Gf9Cg0Pwsz3NgK; Tue, 3 Aug 2021 09:52: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 D3D8811607; Tue, 3 Aug 2021 09:52: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 1739qk7Y081334; Tue, 3 Aug 2021 09:52:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1739qkUc081333; Tue, 3 Aug 2021 09:52:46 GMT (envelope-from git) Date: Tue, 3 Aug 2021 09:52:46 GMT Message-Id: <202108030952.1739qkUc081333@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 0a4eb4d65c11 - stable/13 - null_bypass(): prevent loosing the only reference to the lower vnode 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 0a4eb4d65c11dc775733dd5a0a470419e1376515 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 09:52:47 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=0a4eb4d65c11dc775733dd5a0a470419e1376515 commit 0a4eb4d65c11dc775733dd5a0a470419e1376515 Author: Konstantin Belousov AuthorDate: 2021-07-20 00:53:08 +0000 Commit: Konstantin Belousov CommitDate: 2021-08-03 09:52:35 +0000 null_bypass(): prevent loosing the only reference to the lower vnode (cherry picked from commit d5b078163e0d6bb2fe36f8e49a44853908d5e2db) --- sys/fs/nullfs/null_vnops.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/sys/fs/nullfs/null_vnops.c b/sys/fs/nullfs/null_vnops.c index 4dfc5efaf9ed..03f8b0dcbf7d 100644 --- a/sys/fs/nullfs/null_vnops.c +++ b/sys/fs/nullfs/null_vnops.c @@ -266,6 +266,17 @@ null_bypass(struct vop_generic_args *ap) old_vps[i] = *this_vp_p; *(vps_p[i]) = NULLVPTOLOWERVP(*this_vp_p); + /* + * The upper vnode reference to the lower + * vnode is the only reference that keeps our + * pointer to the lower vnode alive. If lower + * vnode is relocked during the VOP call, + * upper vnode might become unlocked and + * reclaimed, which invalidates our reference. + * Add a transient hold around VOP call. + */ + vhold(*this_vp_p); + /* * XXX - Several operations have the side effect * of vrele'ing their vp's. We must account for @@ -300,6 +311,7 @@ null_bypass(struct vop_generic_args *ap) lvp = *(vps_p[i]); /* + * Get rid of the transient hold on lvp. * If lowervp was unlocked during VOP * operation, nullfs upper vnode could have * been reclaimed, which changes its v_vnlock @@ -307,11 +319,14 @@ null_bypass(struct vop_generic_args *ap) * must move lock ownership from lower to * upper (reclaimed) vnode. */ - if (lvp != NULLVP && - VOP_ISLOCKED(lvp) == LK_EXCLUSIVE && - old_vps[i]->v_vnlock != lvp->v_vnlock) { - VOP_UNLOCK(lvp); - VOP_LOCK(old_vps[i], LK_EXCLUSIVE | LK_RETRY); + if (lvp != NULLVP) { + if (VOP_ISLOCKED(lvp) == LK_EXCLUSIVE && + old_vps[i]->v_vnlock != lvp->v_vnlock) { + VOP_UNLOCK(lvp); + VOP_LOCK(old_vps[i], LK_EXCLUSIVE | + LK_RETRY); + } + vdrop(lvp); } *(vps_p[i]) = old_vps[i]; From owner-dev-commits-src-all@freebsd.org Tue Aug 3 09:52:48 2021 Return-Path: Delivered-To: dev-commits-src-all@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 3BC64634673; Tue, 3 Aug 2021 09:52: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 4Gf9Ch11hwz3NWr; Tue, 3 Aug 2021 09:52: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 F09BB11681; Tue, 3 Aug 2021 09:52: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 1739qlSv081358; Tue, 3 Aug 2021 09:52:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1739qln4081357; Tue, 3 Aug 2021 09:52:47 GMT (envelope-from git) Date: Tue, 3 Aug 2021 09:52:47 GMT Message-Id: <202108030952.1739qln4081357@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: a3c7e571c089 - stable/13 - null_lookup: restore dvp lock always, not only on success 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/stable/13 X-Git-Reftype: branch X-Git-Commit: a3c7e571c08944082d134f8a2b883e80e9f0321a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 09:52:48 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=a3c7e571c08944082d134f8a2b883e80e9f0321a commit a3c7e571c08944082d134f8a2b883e80e9f0321a Author: Konstantin Belousov AuthorDate: 2021-07-21 13:19:51 +0000 Commit: Konstantin Belousov CommitDate: 2021-08-03 09:52:35 +0000 null_lookup: restore dvp lock always, not only on success (cherry picked from commit 4f21442e10dbb22f1bd4c990dc0b1a2aa51231b9) --- sys/fs/nullfs/null_vnops.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sys/fs/nullfs/null_vnops.c b/sys/fs/nullfs/null_vnops.c index 03f8b0dcbf7d..eed0d6c74138 100644 --- a/sys/fs/nullfs/null_vnops.c +++ b/sys/fs/nullfs/null_vnops.c @@ -436,11 +436,12 @@ null_lookup(struct vop_lookup_args *ap) * dvp to be reclaimed due to shared v_vnlock. Check for the * doomed state and return error. */ - if ((error == 0 || error == EJUSTRETURN) && - VN_IS_DOOMED(dvp)) { - error = ENOENT; - if (lvp != NULL) - vput(lvp); + if (VN_IS_DOOMED(dvp)) { + if (error == 0 || error == EJUSTRETURN) { + if (lvp != NULL) + vput(lvp); + error = ENOENT; + } /* * If vgone() did reclaimed dvp before curthread From owner-dev-commits-src-all@freebsd.org Tue Aug 3 09:52:49 2021 Return-Path: Delivered-To: dev-commits-src-all@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 5C30D63481F; Tue, 3 Aug 2021 09:52: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 4Gf9Cj1vLVz3NrF; Tue, 3 Aug 2021 09:52: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 18C37112D8; Tue, 3 Aug 2021 09:52: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 1739qmcF081382; Tue, 3 Aug 2021 09:52:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1739qmDL081381; Tue, 3 Aug 2021 09:52:48 GMT (envelope-from git) Date: Tue, 3 Aug 2021 09:52:48 GMT Message-Id: <202108030952.1739qmDL081381@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 2a56a5c2c21a - stable/13 - fifofs: fifo vnode might be relocked before VOP_OPEN() is called 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 2a56a5c2c21a7bf1fc321a60fffbd8d59970633b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 09:52:49 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=2a56a5c2c21a7bf1fc321a60fffbd8d59970633b commit 2a56a5c2c21a7bf1fc321a60fffbd8d59970633b Author: Konstantin Belousov AuthorDate: 2021-07-22 10:27:43 +0000 Commit: Konstantin Belousov CommitDate: 2021-08-03 09:52:36 +0000 fifofs: fifo vnode might be relocked before VOP_OPEN() is called (cherry picked from commit 10db1896495b744aa5b039dd4ef1973b7a339379) --- sys/fs/fifofs/fifo_vnops.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/sys/fs/fifofs/fifo_vnops.c b/sys/fs/fifofs/fifo_vnops.c index d2a51de84fba..861f1b40a744 100644 --- a/sys/fs/fifofs/fifo_vnops.c +++ b/sys/fs/fifofs/fifo_vnops.c @@ -282,9 +282,21 @@ fifo_close(ap) struct pipe *cpipe; vp = ap->a_vp; + ASSERT_VOP_ELOCKED(vp, "fifo_close"); fip = vp->v_fifoinfo; + + /* + * During open, it is possible that the fifo vnode is relocked + * after the vnode is instantiated but before VOP_OPEN() is + * done. For instance, vn_open_vnode() might need to upgrade + * vnode lock, or ffs_vput_pair() needs to unlock vp to sync + * dvp. In this case, reclaim can observe us with v_fifoinfo + * equal to NULL. + */ + if (fip == NULL) + return (0); + cpipe = fip->fi_pipe; - ASSERT_VOP_ELOCKED(vp, "fifo_close"); if (ap->a_fflag & FREAD) { fip->fi_readers--; if (fip->fi_readers == 0) { From owner-dev-commits-src-all@freebsd.org Tue Aug 3 09:52:50 2021 Return-Path: Delivered-To: dev-commits-src-all@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 CE3BC634A7B; Tue, 3 Aug 2021 09:52: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 4Gf9Ck4yyRz3NTm; Tue, 3 Aug 2021 09:52: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 4B4FB10E75; Tue, 3 Aug 2021 09:52: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 1739qotR081408; Tue, 3 Aug 2021 09:52:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1739qos4081407; Tue, 3 Aug 2021 09:52:50 GMT (envelope-from git) Date: Tue, 3 Aug 2021 09:52:50 GMT Message-Id: <202108030952.1739qos4081407@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 5c52335fd1cc - stable/13 - null_rename: some style 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 5c52335fd1ccdd640134fe7b3dec7e8755e8d42c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 09:52:50 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=5c52335fd1ccdd640134fe7b3dec7e8755e8d42c commit 5c52335fd1ccdd640134fe7b3dec7e8755e8d42c Author: Konstantin Belousov AuthorDate: 2021-07-24 14:46:51 +0000 Commit: Konstantin Belousov CommitDate: 2021-08-03 09:52:36 +0000 null_rename: some style (cherry picked from commit 26e72728ce12c8670894435fcef8055a0ecb6266) --- sys/fs/nullfs/null_vnops.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/sys/fs/nullfs/null_vnops.c b/sys/fs/nullfs/null_vnops.c index eed0d6c74138..3afdf049863f 100644 --- a/sys/fs/nullfs/null_vnops.c +++ b/sys/fs/nullfs/null_vnops.c @@ -655,15 +655,17 @@ null_remove(struct vop_remove_args *ap) static int null_rename(struct vop_rename_args *ap) { - struct vnode *tdvp = ap->a_tdvp; - struct vnode *fvp = ap->a_fvp; - struct vnode *fdvp = ap->a_fdvp; - struct vnode *tvp = ap->a_tvp; + struct vnode *fdvp, *fvp, *tdvp, *tvp; struct null_node *tnn; + tdvp = ap->a_tdvp; + fvp = ap->a_fvp; + fdvp = ap->a_fdvp; + tvp = ap->a_tvp; + /* Check for cross-device rename. */ if ((fvp->v_mount != tdvp->v_mount) || - (tvp && (fvp->v_mount != tvp->v_mount))) { + (tvp != NULL && fvp->v_mount != tvp->v_mount)) { if (tdvp == tvp) vrele(tdvp); else From owner-dev-commits-src-all@freebsd.org Tue Aug 3 09:52:52 2021 Return-Path: Delivered-To: dev-commits-src-all@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 003F36347DD; Tue, 3 Aug 2021 09:52: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 4Gf9Cl3qxbz3NTs; Tue, 3 Aug 2021 09:52:51 +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 530FA11552; Tue, 3 Aug 2021 09:52:51 +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 1739qpsA081432; Tue, 3 Aug 2021 09:52:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1739qpV3081431; Tue, 3 Aug 2021 09:52:51 GMT (envelope-from git) Date: Tue, 3 Aug 2021 09:52:51 GMT Message-Id: <202108030952.1739qpV3081431@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 7f5a4aff9b48 - stable/13 - nullfs: provide custom null_rename bypass 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 7f5a4aff9b4826c1b9852f949ef97fe7ecf3efb0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 09:52:52 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=7f5a4aff9b4826c1b9852f949ef97fe7ecf3efb0 commit 7f5a4aff9b4826c1b9852f949ef97fe7ecf3efb0 Author: Konstantin Belousov AuthorDate: 2021-07-24 15:05:58 +0000 Commit: Konstantin Belousov CommitDate: 2021-08-03 09:52:36 +0000 nullfs: provide custom null_rename bypass (cherry picked from commit 4eaf9609fe42878eccaaf5fe1873f792074a62e4) --- sys/fs/nullfs/null_vnops.c | 68 ++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 57 insertions(+), 11 deletions(-) diff --git a/sys/fs/nullfs/null_vnops.c b/sys/fs/nullfs/null_vnops.c index 3afdf049863f..6a6df55a0bef 100644 --- a/sys/fs/nullfs/null_vnops.c +++ b/sys/fs/nullfs/null_vnops.c @@ -656,32 +656,78 @@ static int null_rename(struct vop_rename_args *ap) { struct vnode *fdvp, *fvp, *tdvp, *tvp; - struct null_node *tnn; + struct vnode *lfdvp, *lfvp, *ltdvp, *ltvp; + struct null_node *fdnn, *fnn, *tdnn, *tnn; + int error; tdvp = ap->a_tdvp; fvp = ap->a_fvp; fdvp = ap->a_fdvp; tvp = ap->a_tvp; + lfdvp = NULL; /* Check for cross-device rename. */ if ((fvp->v_mount != tdvp->v_mount) || (tvp != NULL && fvp->v_mount != tvp->v_mount)) { - if (tdvp == tvp) - vrele(tdvp); - else - vput(tdvp); - if (tvp) - vput(tvp); - vrele(fdvp); - vrele(fvp); - return (EXDEV); + error = EXDEV; + goto upper_err; + } + + VI_LOCK(fdvp); + fdnn = VTONULL(fdvp); + if (fdnn == NULL) { /* fdvp is not locked, can be doomed */ + VI_UNLOCK(fdvp); + error = ENOENT; + goto upper_err; } + lfdvp = fdnn->null_lowervp; + vref(lfdvp); + VI_UNLOCK(fdvp); + + VI_LOCK(fvp); + fnn = VTONULL(fvp); + if (fnn == NULL) { + VI_UNLOCK(fvp); + error = ENOENT; + goto upper_err; + } + lfvp = fnn->null_lowervp; + vref(lfvp); + VI_UNLOCK(fvp); + + tdnn = VTONULL(tdvp); + ltdvp = tdnn->null_lowervp; + vref(ltdvp); if (tvp != NULL) { tnn = VTONULL(tvp); + ltvp = tnn->null_lowervp; + vref(ltvp); tnn->null_flags |= NULLV_DROP; + } else { + ltvp = NULL; } - return (null_bypass((struct vop_generic_args *)ap)); + + error = VOP_RENAME(lfdvp, lfvp, ap->a_fcnp, ltdvp, ltvp, ap->a_tcnp); + vrele(fdvp); + vrele(fvp); + vrele(tdvp); + if (tvp != NULL) + vrele(tvp); + return (error); + +upper_err: + if (tdvp == tvp) + vrele(tdvp); + else + vput(tdvp); + if (tvp) + vput(tvp); + if (lfdvp != NULL) + vrele(lfdvp); + vrele(fdvp); + vrele(fvp); + return (error); } static int From owner-dev-commits-src-all@freebsd.org Tue Aug 3 09:52:53 2021 Return-Path: Delivered-To: dev-commits-src-all@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 1CC7E634679; Tue, 3 Aug 2021 09:52: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 4Gf9Cm4lVXz3NZX; Tue, 3 Aug 2021 09:52:52 +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 7916010E76; Tue, 3 Aug 2021 09:52: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 1739qqZ5081462; Tue, 3 Aug 2021 09:52:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1739qqiq081461; Tue, 3 Aug 2021 09:52:52 GMT (envelope-from git) Date: Tue, 3 Aug 2021 09:52:52 GMT Message-Id: <202108030952.1739qqiq081461@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 2fb281fa02d3 - stable/13 - Revert most of ce42e793100b460f597e4c85ec0da12e274f9394 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 2fb281fa02d34b31b25e949415cfda4549b5aa6b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 09:52:53 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=2fb281fa02d34b31b25e949415cfda4549b5aa6b commit 2fb281fa02d34b31b25e949415cfda4549b5aa6b Author: Konstantin Belousov AuthorDate: 2021-07-19 15:40:38 +0000 Commit: Konstantin Belousov CommitDate: 2021-08-03 09:52:36 +0000 Revert most of ce42e793100b460f597e4c85ec0da12e274f9394 to restore ABI compatibility for pre-10.x binaries. It restores _umtx_lock() and _umtx_unlock() syscalls, and UMTX_OP_LOCK/ UMTX_OP_UNLOCK umtx_op(2) operations. UMUTEX_ERROR_CHECK flag is left out for now, I do not think it makes a difference. PR: 218571 Reviewed by: brooks (previous version) Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31220 (cherry picked from commit 9b6b793bd79521edc082a89b264a30881cb65e22) --- sys/compat/freebsd32/syscalls.master | 6 +- sys/kern/kern_umtx.c | 446 ++++++++++++++++++++++++++++++++++- sys/kern/syscalls.master | 14 +- sys/sys/_umtx.h | 4 + sys/sys/umtx.h | 7 +- 5 files changed, 467 insertions(+), 10 deletions(-) diff --git a/sys/compat/freebsd32/syscalls.master b/sys/compat/freebsd32/syscalls.master index 93d5a251d8ab..aac788bf3956 100644 --- a/sys/compat/freebsd32/syscalls.master +++ b/sys/compat/freebsd32/syscalls.master @@ -789,8 +789,10 @@ 431 AUE_THR_EXIT NOPROTO { void thr_exit(long *state); } 432 AUE_NULL NOPROTO { int thr_self(long *id); } 433 AUE_THR_KILL NOPROTO { int thr_kill(long id, int sig); } -434 AUE_NULL UNIMPL nosys -435 AUE_NULL UNIMPL nosys +434 AUE_NULL COMPAT10 { int freebsd32_umtx_lock( \ + struct umtx *umtx); } +435 AUE_NULL COMPAT10 { int freebsd32_umtx_unlock( \ + struct umtx *umtx); } 436 AUE_JAIL_ATTACH NOPROTO { int jail_attach(int jid); } 437 AUE_EXTATTR_LIST_FD NOPROTO { ssize_t extattr_list_fd(int fd, \ int attrnamespace, void *data, \ diff --git a/sys/kern/kern_umtx.c b/sys/kern/kern_umtx.c index a1dca77fe991..b76d080b8e06 100644 --- a/sys/kern/kern_umtx.c +++ b/sys/kern/kern_umtx.c @@ -908,6 +908,369 @@ umtx_key_release(struct umtx_key *key) vm_object_deallocate(key->info.shared.object); } +#ifdef COMPAT_FREEBSD10 +/* + * Lock a umtx object. + */ +static int +do_lock_umtx(struct thread *td, struct umtx *umtx, u_long id, + const struct timespec *timeout) +{ + struct abs_timeout timo; + struct umtx_q *uq; + u_long owner; + u_long old; + int error = 0; + + uq = td->td_umtxq; + if (timeout != NULL) + abs_timeout_init(&timo, CLOCK_REALTIME, 0, timeout); + + /* + * Care must be exercised when dealing with umtx structure. It + * can fault on any access. + */ + for (;;) { + /* + * Try the uncontested case. This should be done in userland. + */ + owner = casuword(&umtx->u_owner, UMTX_UNOWNED, id); + + /* The acquire succeeded. */ + if (owner == UMTX_UNOWNED) + return (0); + + /* The address was invalid. */ + if (owner == -1) + return (EFAULT); + + /* If no one owns it but it is contested try to acquire it. */ + if (owner == UMTX_CONTESTED) { + owner = casuword(&umtx->u_owner, + UMTX_CONTESTED, id | UMTX_CONTESTED); + + if (owner == UMTX_CONTESTED) + return (0); + + /* The address was invalid. */ + if (owner == -1) + return (EFAULT); + + error = thread_check_susp(td, false); + if (error != 0) + break; + + /* If this failed the lock has changed, restart. */ + continue; + } + + /* + * If we caught a signal, we have retried and now + * exit immediately. + */ + if (error != 0) + break; + + if ((error = umtx_key_get(umtx, TYPE_SIMPLE_LOCK, + AUTO_SHARE, &uq->uq_key)) != 0) + return (error); + + umtxq_lock(&uq->uq_key); + umtxq_busy(&uq->uq_key); + umtxq_insert(uq); + umtxq_unbusy(&uq->uq_key); + umtxq_unlock(&uq->uq_key); + + /* + * Set the contested bit so that a release in user space + * knows to use the system call for unlock. If this fails + * either some one else has acquired the lock or it has been + * released. + */ + old = casuword(&umtx->u_owner, owner, owner | UMTX_CONTESTED); + + /* The address was invalid. */ + if (old == -1) { + umtxq_lock(&uq->uq_key); + umtxq_remove(uq); + umtxq_unlock(&uq->uq_key); + umtx_key_release(&uq->uq_key); + return (EFAULT); + } + + /* + * We set the contested bit, sleep. Otherwise the lock changed + * and we need to retry or we lost a race to the thread + * unlocking the umtx. + */ + umtxq_lock(&uq->uq_key); + if (old == owner) + error = umtxq_sleep(uq, "umtx", timeout == NULL ? NULL : + &timo); + umtxq_remove(uq); + umtxq_unlock(&uq->uq_key); + umtx_key_release(&uq->uq_key); + + if (error == 0) + error = thread_check_susp(td, false); + } + + if (timeout == NULL) { + /* Mutex locking is restarted if it is interrupted. */ + if (error == EINTR) + error = ERESTART; + } else { + /* Timed-locking is not restarted. */ + if (error == ERESTART) + error = EINTR; + } + return (error); +} + +/* + * Unlock a umtx object. + */ +static int +do_unlock_umtx(struct thread *td, struct umtx *umtx, u_long id) +{ + struct umtx_key key; + u_long owner; + u_long old; + int error; + int count; + + /* + * Make sure we own this mtx. + */ + owner = fuword(__DEVOLATILE(u_long *, &umtx->u_owner)); + if (owner == -1) + return (EFAULT); + + if ((owner & ~UMTX_CONTESTED) != id) + return (EPERM); + + /* This should be done in userland */ + if ((owner & UMTX_CONTESTED) == 0) { + old = casuword(&umtx->u_owner, owner, UMTX_UNOWNED); + if (old == -1) + return (EFAULT); + if (old == owner) + return (0); + owner = old; + } + + /* We should only ever be in here for contested locks */ + if ((error = umtx_key_get(umtx, TYPE_SIMPLE_LOCK, AUTO_SHARE, + &key)) != 0) + return (error); + + umtxq_lock(&key); + umtxq_busy(&key); + count = umtxq_count(&key); + umtxq_unlock(&key); + + /* + * When unlocking the umtx, it must be marked as unowned if + * there is zero or one thread only waiting for it. + * Otherwise, it must be marked as contested. + */ + old = casuword(&umtx->u_owner, owner, + count <= 1 ? UMTX_UNOWNED : UMTX_CONTESTED); + umtxq_lock(&key); + umtxq_signal(&key,1); + umtxq_unbusy(&key); + umtxq_unlock(&key); + umtx_key_release(&key); + if (old == -1) + return (EFAULT); + if (old != owner) + return (EINVAL); + return (0); +} + +#ifdef COMPAT_FREEBSD32 + +/* + * Lock a umtx object. + */ +static int +do_lock_umtx32(struct thread *td, uint32_t *m, uint32_t id, + const struct timespec *timeout) +{ + struct abs_timeout timo; + struct umtx_q *uq; + uint32_t owner; + uint32_t old; + int error = 0; + + uq = td->td_umtxq; + + if (timeout != NULL) + abs_timeout_init(&timo, CLOCK_REALTIME, 0, timeout); + + /* + * Care must be exercised when dealing with umtx structure. It + * can fault on any access. + */ + for (;;) { + /* + * Try the uncontested case. This should be done in userland. + */ + owner = casuword32(m, UMUTEX_UNOWNED, id); + + /* The acquire succeeded. */ + if (owner == UMUTEX_UNOWNED) + return (0); + + /* The address was invalid. */ + if (owner == -1) + return (EFAULT); + + /* If no one owns it but it is contested try to acquire it. */ + if (owner == UMUTEX_CONTESTED) { + owner = casuword32(m, + UMUTEX_CONTESTED, id | UMUTEX_CONTESTED); + if (owner == UMUTEX_CONTESTED) + return (0); + + /* The address was invalid. */ + if (owner == -1) + return (EFAULT); + + error = thread_check_susp(td, false); + if (error != 0) + break; + + /* If this failed the lock has changed, restart. */ + continue; + } + + /* + * If we caught a signal, we have retried and now + * exit immediately. + */ + if (error != 0) + return (error); + + if ((error = umtx_key_get(m, TYPE_SIMPLE_LOCK, + AUTO_SHARE, &uq->uq_key)) != 0) + return (error); + + umtxq_lock(&uq->uq_key); + umtxq_busy(&uq->uq_key); + umtxq_insert(uq); + umtxq_unbusy(&uq->uq_key); + umtxq_unlock(&uq->uq_key); + + /* + * Set the contested bit so that a release in user space + * knows to use the system call for unlock. If this fails + * either some one else has acquired the lock or it has been + * released. + */ + old = casuword32(m, owner, owner | UMUTEX_CONTESTED); + + /* The address was invalid. */ + if (old == -1) { + umtxq_lock(&uq->uq_key); + umtxq_remove(uq); + umtxq_unlock(&uq->uq_key); + umtx_key_release(&uq->uq_key); + return (EFAULT); + } + + /* + * We set the contested bit, sleep. Otherwise the lock changed + * and we need to retry or we lost a race to the thread + * unlocking the umtx. + */ + umtxq_lock(&uq->uq_key); + if (old == owner) + error = umtxq_sleep(uq, "umtx", timeout == NULL ? + NULL : &timo); + umtxq_remove(uq); + umtxq_unlock(&uq->uq_key); + umtx_key_release(&uq->uq_key); + + if (error == 0) + error = thread_check_susp(td, false); + } + + if (timeout == NULL) { + /* Mutex locking is restarted if it is interrupted. */ + if (error == EINTR) + error = ERESTART; + } else { + /* Timed-locking is not restarted. */ + if (error == ERESTART) + error = EINTR; + } + return (error); +} + +/* + * Unlock a umtx object. + */ +static int +do_unlock_umtx32(struct thread *td, uint32_t *m, uint32_t id) +{ + struct umtx_key key; + uint32_t owner; + uint32_t old; + int error; + int count; + + /* + * Make sure we own this mtx. + */ + owner = fuword32(m); + if (owner == -1) + return (EFAULT); + + if ((owner & ~UMUTEX_CONTESTED) != id) + return (EPERM); + + /* This should be done in userland */ + if ((owner & UMUTEX_CONTESTED) == 0) { + old = casuword32(m, owner, UMUTEX_UNOWNED); + if (old == -1) + return (EFAULT); + if (old == owner) + return (0); + owner = old; + } + + /* We should only ever be in here for contested locks */ + if ((error = umtx_key_get(m, TYPE_SIMPLE_LOCK, AUTO_SHARE, + &key)) != 0) + return (error); + + umtxq_lock(&key); + umtxq_busy(&key); + count = umtxq_count(&key); + umtxq_unlock(&key); + + /* + * When unlocking the umtx, it must be marked as unowned if + * there is zero or one thread only waiting for it. + * Otherwise, it must be marked as contested. + */ + old = casuword32(m, owner, + count <= 1 ? UMUTEX_UNOWNED : UMUTEX_CONTESTED); + umtxq_lock(&key); + umtxq_signal(&key,1); + umtxq_unbusy(&key); + umtxq_unlock(&key); + umtx_key_release(&key); + if (old == -1) + return (EFAULT); + if (old != owner) + return (EINVAL); + return (0); +} +#endif /* COMPAT_FREEBSD32 */ +#endif /* COMPAT_FREEBSD10 */ + /* * Fetch and compare value, sleep on the address if value is not changed. */ @@ -3397,6 +3760,21 @@ do_sem2_wake(struct thread *td, struct _usem2 *sem) return (error); } +#ifdef COMPAT_FREEBSD10 +int +freebsd10__umtx_lock(struct thread *td, struct freebsd10__umtx_lock_args *uap) +{ + return (do_lock_umtx(td, uap->umtx, td->td_tid, 0)); +} + +int +freebsd10__umtx_unlock(struct thread *td, + struct freebsd10__umtx_unlock_args *uap) +{ + return (do_unlock_umtx(td, uap->umtx, td->td_tid)); +} +#endif + inline int umtx_copyin_timeout(const void *uaddr, struct timespec *tsp) { @@ -3456,13 +3834,50 @@ umtx_copyout_timeout(void *uaddr, size_t sz, struct timespec *tsp) return (copyout(tsp, uaddr, sizeof(*tsp))); } +#ifdef COMPAT_FREEBSD10 static int -__umtx_op_unimpl(struct thread *td, struct _umtx_op_args *uap, - const struct umtx_copyops *ops __unused) +__umtx_op_lock_umtx(struct thread *td, struct _umtx_op_args *uap, + const struct umtx_copyops *ops) +{ + struct timespec *ts, timeout; + int error; + + /* Allow a null timespec (wait forever). */ + if (uap->uaddr2 == NULL) + ts = NULL; + else { + error = ops->copyin_timeout(uap->uaddr2, &timeout); + if (error != 0) + return (error); + ts = &timeout; + } +#ifdef COMPAT_FREEBSD32 + if (ops->compat32) + return (do_lock_umtx32(td, uap->obj, uap->val, ts)); +#endif + return (do_lock_umtx(td, uap->obj, uap->val, ts)); +} + +static int +__umtx_op_unlock_umtx(struct thread *td, struct _umtx_op_args *uap, + const struct umtx_copyops *ops) { +#ifdef COMPAT_FREEBSD32 + if (ops->compat32) + return (do_unlock_umtx32(td, uap->obj, uap->val)); +#endif + return (do_unlock_umtx(td, uap->obj, uap->val)); +} +#endif /* COMPAT_FREEBSD10 */ +#if !defined(COMPAT_FREEBSD10) +static int +__umtx_op_unimpl(struct thread *td __unused, struct _umtx_op_args *uap __unused, + const struct umtx_copyops *ops __unused) +{ return (EOPNOTSUPP); } +#endif /* COMPAT_FREEBSD10 */ static int __umtx_op_wait(struct thread *td, struct _umtx_op_args *uap, @@ -4358,8 +4773,13 @@ typedef int (*_umtx_op_func)(struct thread *td, struct _umtx_op_args *uap, const struct umtx_copyops *umtx_ops); static const _umtx_op_func op_table[] = { - [UMTX_OP_RESERVED0] = __umtx_op_unimpl, - [UMTX_OP_RESERVED1] = __umtx_op_unimpl, +#ifdef COMPAT_FREEBSD10 + [UMTX_OP_LOCK] = __umtx_op_lock_umtx, + [UMTX_OP_UNLOCK] = __umtx_op_unlock_umtx, +#else + [UMTX_OP_LOCK] = __umtx_op_unimpl, + [UMTX_OP_UNLOCK] = __umtx_op_unimpl, +#endif [UMTX_OP_WAIT] = __umtx_op_wait, [UMTX_OP_WAKE] = __umtx_op_wake, [UMTX_OP_MUTEX_TRYLOCK] = __umtx_op_trylock_umutex, @@ -4480,6 +4900,22 @@ sys__umtx_op(struct thread *td, struct _umtx_op_args *uap) } #ifdef COMPAT_FREEBSD32 +#ifdef COMPAT_FREEBSD10 +int +freebsd10_freebsd32_umtx_lock(struct thread *td, + struct freebsd10_freebsd32_umtx_lock_args *uap) +{ + return (do_lock_umtx32(td, (uint32_t *)uap->umtx, td->td_tid, NULL)); +} + +int +freebsd10_freebsd32_umtx_unlock(struct thread *td, + struct freebsd10_freebsd32_umtx_unlock_args *uap) +{ + return (do_unlock_umtx32(td, (uint32_t *)uap->umtx, td->td_tid)); +} +#endif /* COMPAT_FREEBSD10 */ + int freebsd32__umtx_op(struct thread *td, struct freebsd32__umtx_op_args *uap) { @@ -4487,7 +4923,7 @@ freebsd32__umtx_op(struct thread *td, struct freebsd32__umtx_op_args *uap) return (kern__umtx_op(td, uap->obj, uap->op, uap->val, uap->uaddr, uap->uaddr2, &umtx_native_ops32)); } -#endif +#endif /* COMPAT_FREEBSD32 */ void umtx_thread_init(struct thread *td) diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master index 5b8e8049927c..d3ec771aac6f 100644 --- a/sys/kern/syscalls.master +++ b/sys/kern/syscalls.master @@ -2288,7 +2288,19 @@ int sig ); } -434-435 AUE_NULL UNIMPL nosys + +434 AUE_NULL COMPAT10 { + int _umtx_lock( + _Inout_ struct umtx *umtx + ); + } + +435 AUE_NULL COMPAT10 { + int _umtx_unlock( + _Inout_ struct umtx *umtx + ); + } + 436 AUE_JAIL_ATTACH STD { int jail_attach( int jid diff --git a/sys/sys/_umtx.h b/sys/sys/_umtx.h index b9d10b756a0c..d280c7d3db19 100644 --- a/sys/sys/_umtx.h +++ b/sys/sys/_umtx.h @@ -35,6 +35,10 @@ #include #include +struct umtx { + volatile unsigned long u_owner; /* Owner of the mutex. */ +}; + struct umutex { volatile __lwpid_t m_owner; /* Owner of the mutex */ __uint32_t m_flags; /* Flags of the mutex */ diff --git a/sys/sys/umtx.h b/sys/sys/umtx.h index 6753a6217688..60e9dccdad91 100644 --- a/sys/sys/umtx.h +++ b/sys/sys/umtx.h @@ -34,6 +34,9 @@ #include +#define UMTX_UNOWNED 0x0 +#define UMTX_CONTESTED LONG_MIN + /* Common lock flags */ #define USYNC_PROCESS_SHARED 0x0001 /* Process shared sync objs */ @@ -73,8 +76,8 @@ #define USEM_COUNT(c) ((c) & USEM_MAX_COUNT) /* op code for _umtx_op */ -#define UMTX_OP_RESERVED0 0 -#define UMTX_OP_RESERVED1 1 +#define UMTX_OP_LOCK 0 /* COMPAT10 */ +#define UMTX_OP_UNLOCK 1 /* COMPAT10 */ #define UMTX_OP_WAIT 2 #define UMTX_OP_WAKE 3 #define UMTX_OP_MUTEX_TRYLOCK 4 From owner-dev-commits-src-all@freebsd.org Tue Aug 3 09:52:54 2021 Return-Path: Delivered-To: dev-commits-src-all@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 BF99E634830; Tue, 3 Aug 2021 09:52: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 4Gf9Cp0Q69z3NpN; Tue, 3 Aug 2021 09:52: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 99B9111553; Tue, 3 Aug 2021 09:52: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 1739qrnd081486; Tue, 3 Aug 2021 09:52:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1739qr9A081485; Tue, 3 Aug 2021 09:52:53 GMT (envelope-from git) Date: Tue, 3 Aug 2021 09:52:53 GMT Message-Id: <202108030952.1739qr9A081485@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: fb29b54a91f0 - stable/13 - Regen 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/stable/13 X-Git-Reftype: branch X-Git-Commit: fb29b54a91f05c3eb2822e8cfe92b26457a9a0f8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 09:52:54 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=fb29b54a91f05c3eb2822e8cfe92b26457a9a0f8 commit fb29b54a91f05c3eb2822e8cfe92b26457a9a0f8 Author: Konstantin Belousov AuthorDate: 2021-07-28 10:56:19 +0000 Commit: Konstantin Belousov CommitDate: 2021-08-03 09:52:36 +0000 Regen --- sys/compat/freebsd32/freebsd32_proto.h | 10 ++++++++++ sys/compat/freebsd32/freebsd32_syscall.h | 2 ++ sys/compat/freebsd32/freebsd32_syscalls.c | 4 ++-- sys/compat/freebsd32/freebsd32_sysent.c | 4 ++-- sys/kern/init_sysent.c | 4 ++-- sys/kern/syscalls.c | 4 ++-- sys/kern/systrace_args.c | 8 ++++---- sys/sys/syscall.h | 2 ++ sys/sys/syscall.mk | 2 ++ sys/sys/sysproto.h | 14 ++++++++++++-- 10 files changed, 40 insertions(+), 14 deletions(-) diff --git a/sys/compat/freebsd32/freebsd32_proto.h b/sys/compat/freebsd32/freebsd32_proto.h index 14a2fe794c94..d7d4d4fec5ff 100644 --- a/sys/compat/freebsd32/freebsd32_proto.h +++ b/sys/compat/freebsd32/freebsd32_proto.h @@ -1193,6 +1193,12 @@ int freebsd7_freebsd32_shmctl(struct thread *, struct freebsd7_freebsd32_shmctl_ #if !defined(PAD64_REQUIRED) && !defined(__amd64__) #define PAD64_REQUIRED #endif +struct freebsd10_freebsd32_umtx_lock_args { + char umtx_l_[PADL_(struct umtx *)]; struct umtx * umtx; char umtx_r_[PADR_(struct umtx *)]; +}; +struct freebsd10_freebsd32_umtx_unlock_args { + char umtx_l_[PADL_(struct umtx *)]; struct umtx * umtx; char umtx_r_[PADR_(struct umtx *)]; +}; #ifdef PAD64_REQUIRED #else #endif @@ -1209,6 +1215,8 @@ int freebsd7_freebsd32_shmctl(struct thread *, struct freebsd7_freebsd32_shmctl_ #else #endif int freebsd10_freebsd32_pipe(struct thread *, struct freebsd10_freebsd32_pipe_args *); +int freebsd10_freebsd32_umtx_lock(struct thread *, struct freebsd10_freebsd32_umtx_lock_args *); +int freebsd10_freebsd32_umtx_unlock(struct thread *, struct freebsd10_freebsd32_umtx_unlock_args *); #endif /* COMPAT_FREEBSD10 */ @@ -1414,6 +1422,8 @@ int freebsd11_freebsd32_fstatat(struct thread *, struct freebsd11_freebsd32_fsta #define FREEBSD32_SYS_AUE_freebsd32_getcontext AUE_NULL #define FREEBSD32_SYS_AUE_freebsd32_setcontext AUE_NULL #define FREEBSD32_SYS_AUE_freebsd32_swapcontext AUE_NULL +#define FREEBSD32_SYS_AUE_freebsd10_freebsd32_umtx_lock AUE_NULL +#define FREEBSD32_SYS_AUE_freebsd10_freebsd32_umtx_unlock AUE_NULL #define FREEBSD32_SYS_AUE_freebsd32_ksem_timedwait AUE_SEMWAIT #define FREEBSD32_SYS_AUE_freebsd32_thr_suspend AUE_NULL #define FREEBSD32_SYS_AUE_freebsd32__umtx_op AUE_NULL diff --git a/sys/compat/freebsd32/freebsd32_syscall.h b/sys/compat/freebsd32/freebsd32_syscall.h index eea7e2f56968..c6ca12448ad2 100644 --- a/sys/compat/freebsd32/freebsd32_syscall.h +++ b/sys/compat/freebsd32/freebsd32_syscall.h @@ -356,6 +356,8 @@ #define FREEBSD32_SYS_thr_exit 431 #define FREEBSD32_SYS_thr_self 432 #define FREEBSD32_SYS_thr_kill 433 +#define FREEBSD32_SYS_freebsd10_freebsd32_umtx_lock 434 +#define FREEBSD32_SYS_freebsd10_freebsd32_umtx_unlock 435 #define FREEBSD32_SYS_jail_attach 436 #define FREEBSD32_SYS_extattr_list_fd 437 #define FREEBSD32_SYS_extattr_list_file 438 diff --git a/sys/compat/freebsd32/freebsd32_syscalls.c b/sys/compat/freebsd32/freebsd32_syscalls.c index 0311882f02d0..4a79f2efdaa4 100644 --- a/sys/compat/freebsd32/freebsd32_syscalls.c +++ b/sys/compat/freebsd32/freebsd32_syscalls.c @@ -443,8 +443,8 @@ const char *freebsd32_syscallnames[] = { "thr_exit", /* 431 = thr_exit */ "thr_self", /* 432 = thr_self */ "thr_kill", /* 433 = thr_kill */ - "#434", /* 434 = nosys */ - "#435", /* 435 = nosys */ + "compat10.freebsd32_umtx_lock", /* 434 = freebsd10 freebsd32_umtx_lock */ + "compat10.freebsd32_umtx_unlock", /* 435 = freebsd10 freebsd32_umtx_unlock */ "jail_attach", /* 436 = jail_attach */ "extattr_list_fd", /* 437 = extattr_list_fd */ "extattr_list_file", /* 438 = extattr_list_file */ diff --git a/sys/compat/freebsd32/freebsd32_sysent.c b/sys/compat/freebsd32/freebsd32_sysent.c index bf9356fc1735..98b43274e9d8 100644 --- a/sys/compat/freebsd32/freebsd32_sysent.c +++ b/sys/compat/freebsd32/freebsd32_sysent.c @@ -496,8 +496,8 @@ struct sysent freebsd32_sysent[] = { { .sy_narg = AS(thr_exit_args), .sy_call = (sy_call_t *)sys_thr_exit, .sy_auevent = AUE_THR_EXIT, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 431 = thr_exit */ { .sy_narg = AS(thr_self_args), .sy_call = (sy_call_t *)sys_thr_self, .sy_auevent = AUE_NULL, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 432 = thr_self */ { .sy_narg = AS(thr_kill_args), .sy_call = (sy_call_t *)sys_thr_kill, .sy_auevent = AUE_THR_KILL, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 433 = thr_kill */ - { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 434 = nosys */ - { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 435 = nosys */ + { compat10(AS(freebsd10_freebsd32_umtx_lock_args),freebsd32_umtx_lock), .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 434 = freebsd10 freebsd32_umtx_lock */ + { compat10(AS(freebsd10_freebsd32_umtx_unlock_args),freebsd32_umtx_unlock), .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 435 = freebsd10 freebsd32_umtx_unlock */ { .sy_narg = AS(jail_attach_args), .sy_call = (sy_call_t *)sys_jail_attach, .sy_auevent = AUE_JAIL_ATTACH, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 436 = jail_attach */ { .sy_narg = AS(extattr_list_fd_args), .sy_call = (sy_call_t *)sys_extattr_list_fd, .sy_auevent = AUE_EXTATTR_LIST_FD, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 437 = extattr_list_fd */ { .sy_narg = AS(extattr_list_file_args), .sy_call = (sy_call_t *)sys_extattr_list_file, .sy_auevent = AUE_EXTATTR_LIST_FILE, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 438 = extattr_list_file */ diff --git a/sys/kern/init_sysent.c b/sys/kern/init_sysent.c index bac6edf1cee4..b4000dac6b83 100644 --- a/sys/kern/init_sysent.c +++ b/sys/kern/init_sysent.c @@ -489,8 +489,8 @@ struct sysent sysent[] = { { .sy_narg = AS(thr_exit_args), .sy_call = (sy_call_t *)sys_thr_exit, .sy_auevent = AUE_THR_EXIT, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 431 = thr_exit */ { .sy_narg = AS(thr_self_args), .sy_call = (sy_call_t *)sys_thr_self, .sy_auevent = AUE_NULL, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 432 = thr_self */ { .sy_narg = AS(thr_kill_args), .sy_call = (sy_call_t *)sys_thr_kill, .sy_auevent = AUE_THR_KILL, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 433 = thr_kill */ - { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 434 = nosys */ - { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 435 = nosys */ + { compat10(AS(freebsd10__umtx_lock_args),_umtx_lock), .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 434 = freebsd10 _umtx_lock */ + { compat10(AS(freebsd10__umtx_unlock_args),_umtx_unlock), .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 435 = freebsd10 _umtx_unlock */ { .sy_narg = AS(jail_attach_args), .sy_call = (sy_call_t *)sys_jail_attach, .sy_auevent = AUE_JAIL_ATTACH, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 436 = jail_attach */ { .sy_narg = AS(extattr_list_fd_args), .sy_call = (sy_call_t *)sys_extattr_list_fd, .sy_auevent = AUE_EXTATTR_LIST_FD, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 437 = extattr_list_fd */ { .sy_narg = AS(extattr_list_file_args), .sy_call = (sy_call_t *)sys_extattr_list_file, .sy_auevent = AUE_EXTATTR_LIST_FILE, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 438 = extattr_list_file */ diff --git a/sys/kern/syscalls.c b/sys/kern/syscalls.c index 88fa3aee980f..de891eb35967 100644 --- a/sys/kern/syscalls.c +++ b/sys/kern/syscalls.c @@ -440,8 +440,8 @@ const char *syscallnames[] = { "thr_exit", /* 431 = thr_exit */ "thr_self", /* 432 = thr_self */ "thr_kill", /* 433 = thr_kill */ - "#434", /* 434 = nosys */ - "#435", /* 435 = nosys */ + "compat10._umtx_lock", /* 434 = freebsd10 _umtx_lock */ + "compat10._umtx_unlock", /* 435 = freebsd10 _umtx_unlock */ "jail_attach", /* 436 = jail_attach */ "extattr_list_fd", /* 437 = extattr_list_fd */ "extattr_list_file", /* 438 = extattr_list_file */ diff --git a/sys/kern/systrace_args.c b/sys/kern/systrace_args.c index 68fe1eff8769..8f8274b1cdac 100644 --- a/sys/kern/systrace_args.c +++ b/sys/kern/systrace_args.c @@ -470,7 +470,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* getgroups */ case 79: { struct getgroups_args *p = params; - uarg[0] = p->gidsetsize; /* u_int */ + iarg[0] = p->gidsetsize; /* int */ uarg[1] = (intptr_t)p->gidset; /* gid_t * */ *n_args = 2; break; @@ -478,7 +478,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* setgroups */ case 80: { struct setgroups_args *p = params; - uarg[0] = p->gidsetsize; /* u_int */ + iarg[0] = p->gidsetsize; /* int */ uarg[1] = (intptr_t)p->gidset; /* gid_t * */ *n_args = 2; break; @@ -4122,7 +4122,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) case 79: switch (ndx) { case 0: - p = "u_int"; + p = "int"; break; case 1: p = "userland gid_t *"; @@ -4135,7 +4135,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) case 80: switch (ndx) { case 0: - p = "u_int"; + p = "int"; break; case 1: p = "userland gid_t *"; diff --git a/sys/sys/syscall.h b/sys/sys/syscall.h index 3d2db9563e35..950055c9559e 100644 --- a/sys/sys/syscall.h +++ b/sys/sys/syscall.h @@ -376,6 +376,8 @@ #define SYS_thr_exit 431 #define SYS_thr_self 432 #define SYS_thr_kill 433 +#define SYS_freebsd10__umtx_lock 434 +#define SYS_freebsd10__umtx_unlock 435 #define SYS_jail_attach 436 #define SYS_extattr_list_fd 437 #define SYS_extattr_list_file 438 diff --git a/sys/sys/syscall.mk b/sys/sys/syscall.mk index 4c3e04ebd0f7..e007d2c81e61 100644 --- a/sys/sys/syscall.mk +++ b/sys/sys/syscall.mk @@ -286,6 +286,8 @@ MIASM = \ thr_exit.o \ thr_self.o \ thr_kill.o \ + freebsd10__umtx_lock.o \ + freebsd10__umtx_unlock.o \ jail_attach.o \ extattr_list_fd.o \ extattr_list_file.o \ diff --git a/sys/sys/sysproto.h b/sys/sys/sysproto.h index 66060ab77f9a..f17b1951f559 100644 --- a/sys/sys/sysproto.h +++ b/sys/sys/sysproto.h @@ -284,11 +284,11 @@ struct mincore_args { char vec_l_[PADL_(char *)]; char * vec; char vec_r_[PADR_(char *)]; }; struct getgroups_args { - char gidsetsize_l_[PADL_(u_int)]; u_int gidsetsize; char gidsetsize_r_[PADR_(u_int)]; + char gidsetsize_l_[PADL_(int)]; int gidsetsize; char gidsetsize_r_[PADR_(int)]; char gidset_l_[PADL_(gid_t *)]; gid_t * gidset; char gidset_r_[PADR_(gid_t *)]; }; struct setgroups_args { - char gidsetsize_l_[PADL_(u_int)]; u_int gidsetsize; char gidsetsize_r_[PADR_(u_int)]; + char gidsetsize_l_[PADL_(int)]; int gidsetsize; char gidsetsize_r_[PADR_(int)]; char gidset_l_[PADL_(gid_t *)]; gid_t * gidset; char gidset_r_[PADR_(gid_t *)]; }; struct getpgrp_args { @@ -2573,7 +2573,15 @@ int freebsd7_shmctl(struct thread *, struct freebsd7_shmctl_args *); #ifdef COMPAT_FREEBSD10 +struct freebsd10__umtx_lock_args { + char umtx_l_[PADL_(struct umtx *)]; struct umtx * umtx; char umtx_r_[PADR_(struct umtx *)]; +}; +struct freebsd10__umtx_unlock_args { + char umtx_l_[PADL_(struct umtx *)]; struct umtx * umtx; char umtx_r_[PADR_(struct umtx *)]; +}; int freebsd10_pipe(struct thread *, struct freebsd10_pipe_args *); +int freebsd10__umtx_lock(struct thread *, struct freebsd10__umtx_lock_args *); +int freebsd10__umtx_unlock(struct thread *, struct freebsd10__umtx_unlock_args *); #endif /* COMPAT_FREEBSD10 */ @@ -3040,6 +3048,8 @@ int freebsd12_closefrom(struct thread *, struct freebsd12_closefrom_args *); #define SYS_AUE_thr_exit AUE_THR_EXIT #define SYS_AUE_thr_self AUE_NULL #define SYS_AUE_thr_kill AUE_THR_KILL +#define SYS_AUE_freebsd10__umtx_lock AUE_NULL +#define SYS_AUE_freebsd10__umtx_unlock AUE_NULL #define SYS_AUE_jail_attach AUE_JAIL_ATTACH #define SYS_AUE_extattr_list_fd AUE_EXTATTR_LIST_FD #define SYS_AUE_extattr_list_file AUE_EXTATTR_LIST_FILE From owner-dev-commits-src-all@freebsd.org Tue Aug 3 09:52:55 2021 Return-Path: Delivered-To: dev-commits-src-all@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 69D33634C98; Tue, 3 Aug 2021 09:52: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 4Gf9Cq06g3z3Nv1; Tue, 3 Aug 2021 09:52: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 BD62811682; Tue, 3 Aug 2021 09:52: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 1739qsnL081510; Tue, 3 Aug 2021 09:52:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1739qs2F081509; Tue, 3 Aug 2021 09:52:54 GMT (envelope-from git) Date: Tue, 3 Aug 2021 09:52:54 GMT Message-Id: <202108030952.1739qs2F081509@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: dfda6a71e7e1 - stable/13 - /dev/pci: clarify meaning of writeable file descriptor 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/stable/13 X-Git-Reftype: branch X-Git-Commit: dfda6a71e7e185eba840cc8924fe744836d6c232 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 09:52:55 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=dfda6a71e7e185eba840cc8924fe744836d6c232 commit dfda6a71e7e185eba840cc8924fe744836d6c232 Author: Konstantin Belousov AuthorDate: 2021-07-27 00:22:14 +0000 Commit: Konstantin Belousov CommitDate: 2021-08-03 09:52:36 +0000 /dev/pci: clarify meaning of writeable file descriptor (cherry picked from commit 85ae35ef37c07c32d4e923435b637cbf0df3e8a3) --- share/man/man4/pci.4 | 15 +++++++++++++-- sys/dev/pci/pci_user.c | 7 ++++++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/share/man/man4/pci.4 b/share/man/man4/pci.4 index 18eaae1cd4d4..28a456d18179 100644 --- a/share/man/man4/pci.4 +++ b/share/man/man4/pci.4 @@ -24,12 +24,12 @@ .\" .\" $FreeBSD$ .\" -.Dd June 17, 2019 +.Dd July 27, 2021 .Dt PCI 4 .Os .Sh NAME .Nm pci -.Nd generic PCI bus driver +.Nd generic PCI/PCIe bus driver .Sh SYNOPSIS To compile the PCI bus driver into the kernel, place the following line in your @@ -53,6 +53,8 @@ The .Nm driver provides support for .Tn PCI +and +.Tn PCIe devices in the kernel and limited access to .Tn PCI devices for userland. @@ -80,6 +82,15 @@ granting access to the device. If used improperly, this driver can allow userland applications to crash a machine or cause data loss. +In particular, driver only allows operations on the opened +.Pa /dev/pci +to modify system state if the file descriptor was opened for writing. +For instance, the +.Dv PCIOCREAD +and +.Dv PCIOCBARMMAP +operations require a writeable descriptor, because reading a config register +or a BAR read access could have function-specific side-effects. .Pp The .Nm diff --git a/sys/dev/pci/pci_user.c b/sys/dev/pci/pci_user.c index c34fd715707e..640a10abfeca 100644 --- a/sys/dev/pci/pci_user.c +++ b/sys/dev/pci/pci_user.c @@ -943,7 +943,12 @@ pci_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *t io_old = NULL; #endif - if (!(flag & FWRITE)) { + /* + * Interpret read-only opened /dev/pci as a promise that no + * operation of the file descriptor could modify system state, + * including side-effects due to reading devices registers. + */ + if ((flag & FWRITE) == 0) { switch (cmd) { case PCIOCGETCONF: #ifdef COMPAT_FREEBSD32 From owner-dev-commits-src-all@freebsd.org Tue Aug 3 09:52:56 2021 Return-Path: Delivered-To: dev-commits-src-all@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 D685F634AAF; Tue, 3 Aug 2021 09:52: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 4Gf9Cr1cyyz3NV6; Tue, 3 Aug 2021 09:52: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 DB32D10E77; Tue, 3 Aug 2021 09:52: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 1739qtlM081534; Tue, 3 Aug 2021 09:52:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1739qtcY081533; Tue, 3 Aug 2021 09:52:55 GMT (envelope-from git) Date: Tue, 3 Aug 2021 09:52:55 GMT Message-Id: <202108030952.1739qtcY081533@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 21049f0567f2 - stable/13 - amd64: make efi_boot global 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 21049f0567f2e1a206ef21e0614bd98d37214711 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 09:52:57 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=21049f0567f2e1a206ef21e0614bd98d37214711 commit 21049f0567f2e1a206ef21e0614bd98d37214711 Author: Konstantin Belousov AuthorDate: 2021-07-22 16:22:21 +0000 Commit: Konstantin Belousov CommitDate: 2021-08-03 09:52:36 +0000 amd64: make efi_boot global (cherry picked from commit 6a3821369f43bb1e8a672cbbfd7732406d9f9a4c) --- sys/amd64/amd64/machdep.c | 3 ++- sys/amd64/include/md_var.h | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index 0098e926d0f0..93030cbe7126 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -228,6 +228,8 @@ struct mtx dt_lock; /* lock for GDT and LDT */ void (*vmm_resume_p)(void); +bool efi_boot; + static void cpu_startup(dummy) void *dummy; @@ -1613,7 +1615,6 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) struct region_descriptor r_gdt; size_t kstack0_sz; int late_console; - bool efi_boot; TSRAW(&thread0, TS_ENTER, __func__, NULL); diff --git a/sys/amd64/include/md_var.h b/sys/amd64/include/md_var.h index 3b2454a4b441..b66e314d99b1 100644 --- a/sys/amd64/include/md_var.h +++ b/sys/amd64/include/md_var.h @@ -55,6 +55,8 @@ extern int la57; */ extern char kernphys[]; +extern bool efi_boot; + struct savefpu; struct sysentvec; From owner-dev-commits-src-all@freebsd.org Tue Aug 3 09:52:58 2021 Return-Path: Delivered-To: dev-commits-src-all@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 63B8E634E45; Tue, 3 Aug 2021 09:52: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 4Gf9Cs5WNxz3NV8; Tue, 3 Aug 2021 09:52: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 05B0C1159C; Tue, 3 Aug 2021 09:52: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 1739qucH081558; Tue, 3 Aug 2021 09:52:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1739quZh081557; Tue, 3 Aug 2021 09:52:56 GMT (envelope-from git) Date: Tue, 3 Aug 2021 09:52:56 GMT Message-Id: <202108030952.1739quZh081557@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 17332276a640 - stable/13 - amd64: do not touch low memory in AP startup unless we used legacy boot 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 17332276a640ea822455089a114b74ca9eeadee4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 09:52:58 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=17332276a640ea822455089a114b74ca9eeadee4 commit 17332276a640ea822455089a114b74ca9eeadee4 Author: Konstantin Belousov AuthorDate: 2021-07-22 16:27:21 +0000 Commit: Konstantin Belousov CommitDate: 2021-08-03 09:52:36 +0000 amd64: do not touch low memory in AP startup unless we used legacy boot (cherry picked from commit 48216088b1157a22b95540efea58f70057cd5c06) --- sys/amd64/amd64/mp_machdep.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sys/amd64/amd64/mp_machdep.c b/sys/amd64/amd64/mp_machdep.c index aa62c2086fa4..237710da349d 100644 --- a/sys/amd64/amd64/mp_machdep.c +++ b/sys/amd64/amd64/mp_machdep.c @@ -450,13 +450,16 @@ native_start_all_aps(void) } /* save the current value of the warm-start vector */ - mpbioswarmvec = *((u_int32_t *) WARMBOOT_OFF); + if (!efi_boot) + mpbioswarmvec = *((u_int32_t *) WARMBOOT_OFF); outb(CMOS_REG, BIOS_RESET); mpbiosreason = inb(CMOS_DATA); /* setup a vector to our boot code */ - *((volatile u_short *) WARMBOOT_OFF) = WARMBOOT_TARGET; - *((volatile u_short *) WARMBOOT_SEG) = (boot_address >> 4); + if (!efi_boot) { + *((volatile u_short *)WARMBOOT_OFF) = WARMBOOT_TARGET; + *((volatile u_short *)WARMBOOT_SEG) = (boot_address >> 4); + } outb(CMOS_REG, BIOS_RESET); outb(CMOS_DATA, BIOS_WARM); /* 'warm-start' */ From owner-dev-commits-src-all@freebsd.org Tue Aug 3 09:52:59 2021 Return-Path: Delivered-To: dev-commits-src-all@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 07285634D63; Tue, 3 Aug 2021 09:52: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 4Gf9Ct3Zz1z3Nrn; Tue, 3 Aug 2021 09:52: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 2CC5911608; Tue, 3 Aug 2021 09:52: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 1739qw7Q081588; Tue, 3 Aug 2021 09:52:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1739qwCw081587; Tue, 3 Aug 2021 09:52:58 GMT (envelope-from git) Date: Tue, 3 Aug 2021 09:52:58 GMT Message-Id: <202108030952.1739qwCw081587@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 2c7315c09a2b - stable/13 - amd64: do not touch low memory in AP startup unless we used legacy boot 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 2c7315c09a2b228f544c5c94b29f4d55701792f8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 09:52:59 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=2c7315c09a2b228f544c5c94b29f4d55701792f8 commit 2c7315c09a2b228f544c5c94b29f4d55701792f8 Author: Konstantin Belousov AuthorDate: 2021-07-29 13:18:19 +0000 Commit: Konstantin Belousov CommitDate: 2021-08-03 09:52:36 +0000 amd64: do not touch low memory in AP startup unless we used legacy boot (cherry picked from commit 2572376f7f6412bc69bd6138e9ac9a6efd7642af) --- sys/amd64/amd64/mp_machdep.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/amd64/amd64/mp_machdep.c b/sys/amd64/amd64/mp_machdep.c index 237710da349d..74f1af919b66 100644 --- a/sys/amd64/amd64/mp_machdep.c +++ b/sys/amd64/amd64/mp_machdep.c @@ -502,7 +502,8 @@ native_start_all_aps(void) /* attempt to start the Application Processor */ if (!start_ap(apic_id)) { /* restore the warmstart vector */ - *(u_int32_t *) WARMBOOT_OFF = mpbioswarmvec; + if (!efi_boot) + *(u_int32_t *)WARMBOOT_OFF = mpbioswarmvec; panic("AP #%d (PHY# %d) failed!", cpu, apic_id); } @@ -510,7 +511,8 @@ native_start_all_aps(void) } /* restore the warmstart vector */ - *(u_int32_t *) WARMBOOT_OFF = mpbioswarmvec; + if (!efi_boot) + *(u_int32_t *)WARMBOOT_OFF = mpbioswarmvec; outb(CMOS_REG, BIOS_RESET); outb(CMOS_DATA, mpbiosreason); From owner-dev-commits-src-all@freebsd.org Tue Aug 3 09:53:00 2021 Return-Path: Delivered-To: dev-commits-src-all@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 5D622634848; Tue, 3 Aug 2021 09:53: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 4Gf9Cv6Kksz3NpZ; Tue, 3 Aug 2021 09:52: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 46A7F112D9; Tue, 3 Aug 2021 09:52: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 1739qxcu081612; Tue, 3 Aug 2021 09:52:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1739qxIm081611; Tue, 3 Aug 2021 09:52:59 GMT (envelope-from git) Date: Tue, 3 Aug 2021 09:52:59 GMT Message-Id: <202108030952.1739qxIm081611@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 5a84640fcf27 - stable/13 - amd64 pti init: fix calculation of the kernel text start 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 5a84640fcf2763e1475aabc0f591384fb0d2c080 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 09:53:00 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=5a84640fcf2763e1475aabc0f591384fb0d2c080 commit 5a84640fcf2763e1475aabc0f591384fb0d2c080 Author: Konstantin Belousov AuthorDate: 2021-07-10 19:51:16 +0000 Commit: Konstantin Belousov CommitDate: 2021-08-03 09:52:37 +0000 amd64 pti init: fix calculation of the kernel text start (cherry picked from commit 34516d4ad19b83e5dfe6ec8c1db232c422d7ecff) --- 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 9b95343f43f3..73850cbb376f 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -10636,7 +10636,7 @@ pmap_pti_init(void) va = __pcpu[i].pc_common_tss.tss_ist4 + sizeof(struct nmi_pcpu); pmap_pti_add_kva_locked(va - DBG_STACK_SIZE, va, false); } - pmap_pti_add_kva_locked((vm_offset_t)kernphys + KERNBASE, + pmap_pti_add_kva_locked((vm_offset_t)KERNBASE + NBPDR, (vm_offset_t)etext, true); pti_finalized = true; VM_OBJECT_WUNLOCK(pti_obj); From owner-dev-commits-src-all@freebsd.org Tue Aug 3 09:53:01 2021 Return-Path: Delivered-To: dev-commits-src-all@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 575D0634AD6; Tue, 3 Aug 2021 09:53: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 4Gf9Cw4Ry4z3NvJ; Tue, 3 Aug 2021 09:53: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 6CE091159D; Tue, 3 Aug 2021 09:53: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 1739r0eX081636; Tue, 3 Aug 2021 09:53:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1739r0Ts081635; Tue, 3 Aug 2021 09:53:00 GMT (envelope-from git) Date: Tue, 3 Aug 2021 09:53:00 GMT Message-Id: <202108030953.1739r0Ts081635@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 6ba778918946 - stable/13 - amd64: add pmap_alloc_page_below_4g() 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 6ba778918946fcdfd15146bf1a47fb19d3262115 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 09:53:01 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=6ba778918946fcdfd15146bf1a47fb19d3262115 commit 6ba778918946fcdfd15146bf1a47fb19d3262115 Author: Konstantin Belousov AuthorDate: 2021-07-13 15:00:54 +0000 Commit: Konstantin Belousov CommitDate: 2021-08-03 09:52:37 +0000 amd64: add pmap_alloc_page_below_4g() (cherry picked from commit c8bae074d9e1d766bcbc2e631ce0c2e9d248881c) --- sys/amd64/amd64/pmap.c | 49 +++++++++++++++++++----------------------------- sys/amd64/include/pmap.h | 1 + 2 files changed, 20 insertions(+), 30 deletions(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index 73850cbb376f..e5d46449c275 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -1997,6 +1997,19 @@ pmap_init_pat(void) load_cr4(cr4); } +vm_page_t +pmap_page_alloc_below_4g(bool zeroed) +{ + vm_page_t m; + + m = vm_page_alloc_contig(NULL, 0, (zeroed ? VM_ALLOC_ZERO : 0) | + VM_ALLOC_NORMAL | VM_ALLOC_NOBUSY | VM_ALLOC_NOOBJ, + 1, 0, (1ULL << 32), PAGE_SIZE, 0, VM_MEMATTR_DEFAULT); + if (m != NULL && zeroed && (m->flags & PG_ZERO) == 0) + pmap_zero_page(m); + return (m); +} + extern const char la57_trampoline[], la57_trampoline_gdt_desc[], la57_trampoline_gdt[], la57_trampoline_end[]; @@ -2022,42 +2035,18 @@ pmap_bootstrap_la57(void *arg __unused) r_gdt.rd_limit = NGDT * sizeof(struct user_segment_descriptor) - 1; r_gdt.rd_base = (long)__pcpu[0].pc_gdt; - m_code = vm_page_alloc_contig(NULL, 0, - VM_ALLOC_NORMAL | VM_ALLOC_NOBUSY | VM_ALLOC_ZERO | VM_ALLOC_NOOBJ, - 1, 0, (1ULL << 32), PAGE_SIZE, 0, VM_MEMATTR_DEFAULT); - if ((m_code->flags & PG_ZERO) == 0) - pmap_zero_page(m_code); + m_code = pmap_page_alloc_below_4g(true); v_code = (char *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m_code)); - m_pml5 = vm_page_alloc_contig(NULL, 0, - VM_ALLOC_NORMAL | VM_ALLOC_NOBUSY | VM_ALLOC_ZERO | VM_ALLOC_NOOBJ, - 1, 0, (1ULL << 32), PAGE_SIZE, 0, VM_MEMATTR_DEFAULT); - if ((m_pml5->flags & PG_ZERO) == 0) - pmap_zero_page(m_pml5); + m_pml5 = pmap_page_alloc_below_4g(true); KPML5phys = VM_PAGE_TO_PHYS(m_pml5); v_pml5 = (pml5_entry_t *)PHYS_TO_DMAP(KPML5phys); - m_pml4 = vm_page_alloc_contig(NULL, 0, - VM_ALLOC_NORMAL | VM_ALLOC_NOBUSY | VM_ALLOC_ZERO | VM_ALLOC_NOOBJ, - 1, 0, (1ULL << 32), PAGE_SIZE, 0, VM_MEMATTR_DEFAULT); - if ((m_pml4->flags & PG_ZERO) == 0) - pmap_zero_page(m_pml4); + m_pml4 = pmap_page_alloc_below_4g(true); v_pml4 = (pdp_entry_t *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m_pml4)); - m_pdp = vm_page_alloc_contig(NULL, 0, - VM_ALLOC_NORMAL | VM_ALLOC_NOBUSY | VM_ALLOC_ZERO | VM_ALLOC_NOOBJ, - 1, 0, (1ULL << 32), PAGE_SIZE, 0, VM_MEMATTR_DEFAULT); - if ((m_pdp->flags & PG_ZERO) == 0) - pmap_zero_page(m_pdp); + m_pdp = pmap_page_alloc_below_4g(true); v_pdp = (pdp_entry_t *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m_pdp)); - m_pd = vm_page_alloc_contig(NULL, 0, - VM_ALLOC_NORMAL | VM_ALLOC_NOBUSY | VM_ALLOC_ZERO | VM_ALLOC_NOOBJ, - 1, 0, (1ULL << 32), PAGE_SIZE, 0, VM_MEMATTR_DEFAULT); - if ((m_pd->flags & PG_ZERO) == 0) - pmap_zero_page(m_pd); + m_pd = pmap_page_alloc_below_4g(true); v_pd = (pdp_entry_t *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m_pd)); - m_pt = vm_page_alloc_contig(NULL, 0, - VM_ALLOC_NORMAL | VM_ALLOC_NOBUSY | VM_ALLOC_ZERO | VM_ALLOC_NOOBJ, - 1, 0, (1ULL << 32), PAGE_SIZE, 0, VM_MEMATTR_DEFAULT); - if ((m_pt->flags & PG_ZERO) == 0) - pmap_zero_page(m_pt); + m_pt = pmap_page_alloc_below_4g(true); v_pt = (pt_entry_t *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m_pt)); /* diff --git a/sys/amd64/include/pmap.h b/sys/amd64/include/pmap.h index 8ba654cb2e7c..d06a618a08b6 100644 --- a/sys/amd64/include/pmap.h +++ b/sys/amd64/include/pmap.h @@ -501,6 +501,7 @@ int pmap_pkru_set(pmap_t pmap, vm_offset_t sva, vm_offset_t eva, void pmap_thread_init_invl_gen(struct thread *td); int pmap_vmspace_copy(pmap_t dst_pmap, pmap_t src_pmap); void pmap_page_array_startup(long count); +vm_page_t pmap_page_alloc_below_4g(bool zeroed); #endif /* _KERNEL */ /* Return various clipped indexes for a given VA */ From owner-dev-commits-src-all@freebsd.org Tue Aug 3 10:08:00 2021 Return-Path: Delivered-To: dev-commits-src-all@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 86DC0634FD5; Tue, 3 Aug 2021 10:08: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 4Gf9YD3F7Fz3Q2w; Tue, 3 Aug 2021 10:08: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 576EC11716; Tue, 3 Aug 2021 10:08: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 173A80OZ096590; Tue, 3 Aug 2021 10:08:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 173A80UG096589; Tue, 3 Aug 2021 10:08:00 GMT (envelope-from git) Date: Tue, 3 Aug 2021 10:08:00 GMT Message-Id: <202108031008.173A80UG096589@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marcin Wojtas Subject: git: f5b29d0f3510 - main - etherswitch: Add a new striptagingress port flag MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mw X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f5b29d0f35100238068c4b3145e15486f991e911 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 10:08:00 -0000 The branch main has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=f5b29d0f35100238068c4b3145e15486f991e911 commit f5b29d0f35100238068c4b3145e15486f991e911 Author: Kornel Duleba AuthorDate: 2021-06-23 11:13:05 +0000 Commit: Marcin Wojtas CommitDate: 2021-08-03 10:07:48 +0000 etherswitch: Add a new striptagingress port flag Felix switch found in LS1028A supports stripping VLAN tag on ingress, instead of egress. The striptag flag excepts the latter behaviour. Add a new flag to support the feature. Obtained from: Semihalf Sponsored by: Alstom Group Differential Revision: https://reviews.freebsd.org/D30922 --- sbin/etherswitchcfg/etherswitchcfg.8 | 6 +++++- sbin/etherswitchcfg/etherswitchcfg.c | 4 ++++ sys/dev/etherswitch/etherswitch.h | 19 ++++++++++--------- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/sbin/etherswitchcfg/etherswitchcfg.8 b/sbin/etherswitchcfg/etherswitchcfg.8 index 0695b0eddba4..9380c1f4f055 100644 --- a/sbin/etherswitchcfg/etherswitchcfg.8 +++ b/sbin/etherswitchcfg/etherswitchcfg.8 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 28, 2019 +.Dd June 23, 2021 .Dt ETHERSWITCHCFG 8 .Os .Sh NAME @@ -139,6 +139,10 @@ Disable the add VLAN tag option. Strip the VLAN tags from the packets sent by the port. .It Fl striptag Disable the strip VLAN tag option. +.It Cm striptagingress +Strip the VLAN tags from the packets received by the port. +.It Fl striptagingress +Disable the strip VLAN tag on ingress option. .It Cm firstlock This options makes the switch port lock on the first MAC address it sees. After that, usually you need to reset the switch to learn different diff --git a/sbin/etherswitchcfg/etherswitchcfg.c b/sbin/etherswitchcfg/etherswitchcfg.c index f3af9f93825a..7f3403918fad 100644 --- a/sbin/etherswitchcfg/etherswitchcfg.c +++ b/sbin/etherswitchcfg/etherswitchcfg.c @@ -223,6 +223,8 @@ set_port_flag(struct cfg *cfg, int argc, char *argv[]) f = ETHERSWITCH_PORT_DOUBLE_TAG; else if (strcasecmp(flag, "ingress") == 0) f = ETHERSWITCH_PORT_INGRESS; + else if (strcasecmp(flag, "striptagingress") == 0) + f = ETHERSWITCH_PORT_STRIPTAGINGRESS; } bzero(&p, sizeof(p)); p.es_port = cfg->unit; @@ -869,6 +871,8 @@ static struct cmds cmds[] = { { MODE_PORT, "-ingress", 0, set_port_flag }, { MODE_PORT, "striptag", 0, set_port_flag }, { MODE_PORT, "-striptag", 0, set_port_flag }, + { MODE_PORT, "striptagingress", 0, set_port_flag }, + { MODE_PORT, "-striptagingress", 0, set_port_flag }, { MODE_PORT, "doubletag", 0, set_port_flag }, { MODE_PORT, "-doubletag", 0, set_port_flag }, { MODE_PORT, "firstlock", 0, set_port_flag }, diff --git a/sys/dev/etherswitch/etherswitch.h b/sys/dev/etherswitch/etherswitch.h index 02bf91cd613c..9d87be03e26d 100644 --- a/sys/dev/etherswitch/etherswitch.h +++ b/sys/dev/etherswitch/etherswitch.h @@ -57,17 +57,18 @@ struct etherswitch_conf { }; typedef struct etherswitch_conf etherswitch_conf_t; -#define ETHERSWITCH_PORT_CPU (1 << 0) -#define ETHERSWITCH_PORT_STRIPTAG (1 << 1) -#define ETHERSWITCH_PORT_ADDTAG (1 << 2) -#define ETHERSWITCH_PORT_FIRSTLOCK (1 << 3) -#define ETHERSWITCH_PORT_DROPUNTAGGED (1 << 4) -#define ETHERSWITCH_PORT_DOUBLE_TAG (1 << 5) -#define ETHERSWITCH_PORT_INGRESS (1 << 6) -#define ETHERSWITCH_PORT_DROPTAGGED (1 << 7) +#define ETHERSWITCH_PORT_CPU (1 << 0) +#define ETHERSWITCH_PORT_STRIPTAG (1 << 1) +#define ETHERSWITCH_PORT_ADDTAG (1 << 2) +#define ETHERSWITCH_PORT_FIRSTLOCK (1 << 3) +#define ETHERSWITCH_PORT_DROPUNTAGGED (1 << 4) +#define ETHERSWITCH_PORT_DOUBLE_TAG (1 << 5) +#define ETHERSWITCH_PORT_INGRESS (1 << 6) +#define ETHERSWITCH_PORT_DROPTAGGED (1 << 7) +#define ETHERSWITCH_PORT_STRIPTAGINGRESS (1 << 8) #define ETHERSWITCH_PORT_FLAGS_BITS \ "\020\1CPUPORT\2STRIPTAG\3ADDTAG\4FIRSTLOCK\5DROPUNTAGGED\6QinQ\7INGRESS" \ -"\10DROPTAGGED" +"\10DROPTAGGED\11STRIPTAGINGRESS" #define ETHERSWITCH_PORT_MAX_LEDS 3 From owner-dev-commits-src-all@freebsd.org Tue Aug 3 10:08:01 2021 Return-Path: Delivered-To: dev-commits-src-all@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 95F8D6357F7; Tue, 3 Aug 2021 10:08: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 4Gf9YF3cWjz3Q2y; Tue, 3 Aug 2021 10:08: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 651141157B; Tue, 3 Aug 2021 10:08: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 173A81OE096618; Tue, 3 Aug 2021 10:08:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 173A81mK096617; Tue, 3 Aug 2021 10:08:01 GMT (envelope-from git) Date: Tue, 3 Aug 2021 10:08:01 GMT Message-Id: <202108031008.173A81mK096617@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marcin Wojtas Subject: git: 451bcf1b3601 - main - Introduce driver for Freescale Felix switch MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mw X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 451bcf1b360146af0759ac18c9cc55f0a36cc386 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 10:08:01 -0000 The branch main has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=451bcf1b360146af0759ac18c9cc55f0a36cc386 commit 451bcf1b360146af0759ac18c9cc55f0a36cc386 Author: Marcin Wojtas AuthorDate: 2021-06-09 11:23:26 +0000 Commit: Marcin Wojtas CommitDate: 2021-08-03 10:07:49 +0000 Introduce driver for Freescale Felix switch It is found on boards equipped with LS1028A SoC. 802.1q VLAN grouping is supported. An external MDIO device is used for communicating with PHYs. The driver is built as a module by default, it is not included in GENERIC kernel config. Submitted by: Lukasz Hajec Kornel Duleba Obtained from: Semihalf Sponsored by: Alstom Group Differential Revision: https://reviews.freebsd.org/D30923 --- share/man/man4/man4.aarch64/Makefile | 1 + share/man/man4/man4.aarch64/felix.4 | 83 +++ sys/conf/files.arm64 | 2 + sys/dev/etherswitch/felix/felix.c | 996 ++++++++++++++++++++++++++++++++++ sys/dev/etherswitch/felix/felix_reg.h | 100 ++++ sys/dev/etherswitch/felix/felix_var.h | 105 ++++ sys/modules/Makefile | 2 + sys/modules/felix/Makefile | 34 ++ 8 files changed, 1323 insertions(+) diff --git a/share/man/man4/man4.aarch64/Makefile b/share/man/man4/man4.aarch64/Makefile index ef5fcd84ccd4..6d0e427e6b28 100644 --- a/share/man/man4/man4.aarch64/Makefile +++ b/share/man/man4/man4.aarch64/Makefile @@ -12,6 +12,7 @@ MAN= \ aw_syscon.4 \ bcm283x_pwm.4 \ enetc.4 \ + felix.4 \ rk_gpio.4 \ rk_grf.4 \ rk_i2c.4 \ diff --git a/share/man/man4/man4.aarch64/felix.4 b/share/man/man4/man4.aarch64/felix.4 new file mode 100644 index 000000000000..738309a4cc84 --- /dev/null +++ b/share/man/man4/man4.aarch64/felix.4 @@ -0,0 +1,83 @@ +.\" - +.\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD +.\" +.\" Copyright (c) 2021 Alstom Group. +.\" Copyright (c) 2021 Semihalf. +.\" +.\" 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. +.\" +.Dd June 21, 2021 +.Dt FELIX 4 +.Os +.Sh NAME +.Nm felix +.Nd "driver for Microchip Ocelot Felix switch" +.Sh SYNOPSIS +To compile this driver into the kernel the following lines must be present +in the kernel configuration file: +.sp +.Cd "options SOC_NXP_LS" +.Cd "device pci" +.Cd "device fdt" +.Cd "device mdio" +.Cd "device enetc" +.Cd "device etherswitch" +.Cd "device felix" +.Sh DESCRIPTION +The +.Nm +driver provides a management interface to Microchip Ocelot Felix switch (VSC9959) +found in NXP LS1028A SoC. It is a PCI device, part of the larger ENETC +root complex. The driver is using +.Xr etherswitch 4 +framework. +.Pp +This driver supports only dot1q vlan. dot1q support port base addtag, striptag, +dropuntagged, dropuntagged. +.Sh EXAMPLES +Configure dot1q vlan by etherswitchcfg command. +.Pp +.Dl # etherswitchcfg config vlan_mode dot1q +.Pp +Configure port 5 is tagging port. +.Pp +.Dl # etherswitchcfg port5 addtag +.Pp +Disable port 5 is tagging port. +.Pp +.Dl # etherswitchcfg port5 -addtag +.Sh SEE ALSO +.Xr etherswitch 4 , +.Xr etherswitchcfg 8 +.Sh HISTORY +The +.Nm +device driver first appeared in +.Fx 14.0 . +.Sh AUTHORS +The +.Nm +driver was written by +.An Kornel Duleba (mindal@semihalf.com) +and +.An Lukasz Hajec (lha@semihalf.com) + diff --git a/sys/conf/files.arm64 b/sys/conf/files.arm64 index 3bc534073634..bfa03dade1db 100644 --- a/sys/conf/files.arm64 +++ b/sys/conf/files.arm64 @@ -179,6 +179,8 @@ dev/enetc/enetc_mdio.c optional enetc soc_nxp_ls dev/enetc/enetc_mdio_pci.c optional enetc pci soc_nxp_ls dev/enetc/if_enetc.c optional enetc iflib pci fdt soc_nxp_ls +dev/etherswitch/felix/felix.c optional enetc etherswitch fdt felix pci soc_nxp_ls + dev/gpio/pl061.c optional pl061 gpio dev/gpio/pl061_acpi.c optional pl061 gpio acpi dev/gpio/pl061_fdt.c optional pl061 gpio fdt diff --git a/sys/dev/etherswitch/felix/felix.c b/sys/dev/etherswitch/felix/felix.c new file mode 100644 index 000000000000..140811807586 --- /dev/null +++ b/sys/dev/etherswitch/felix/felix.c @@ -0,0 +1,996 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2021 Alstom Group. + * Copyright (c) 2021 Semihalf. + * + * 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 + +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +#include "etherswitch_if.h" +#include "miibus_if.h" + +MALLOC_DECLARE(M_FELIX); +MALLOC_DEFINE(M_FELIX, "felix", "felix switch"); + +static device_probe_t felix_probe; +static device_attach_t felix_attach; +static device_detach_t felix_detach; + +static etherswitch_info_t* felix_getinfo(device_t); +static int felix_getconf(device_t, etherswitch_conf_t *); +static int felix_setconf(device_t, etherswitch_conf_t *); +static void felix_lock(device_t); +static void felix_unlock(device_t); +static int felix_getport(device_t, etherswitch_port_t *); +static int felix_setport(device_t, etherswitch_port_t *); +static int felix_readreg_wrapper(device_t, int); +static int felix_writereg_wrapper(device_t, int, int); +static int felix_readphy(device_t, int, int); +static int felix_writephy(device_t, int, int, int); +static int felix_setvgroup(device_t, etherswitch_vlangroup_t *); +static int felix_getvgroup(device_t, etherswitch_vlangroup_t *); + +static int felix_parse_port_fdt(felix_softc_t, phandle_t, int *); +static int felix_setup(felix_softc_t); +static void felix_setup_port(felix_softc_t, int); + +static void felix_tick(void *); +static int felix_ifmedia_upd(struct ifnet *); +static void felix_ifmedia_sts(struct ifnet *, struct ifmediareq *); + +static void felix_get_port_cfg(felix_softc_t, etherswitch_port_t *); +static void felix_set_port_cfg(felix_softc_t, etherswitch_port_t *); + +static bool felix_is_phyport(felix_softc_t, int); +static struct mii_data *felix_miiforport(felix_softc_t, unsigned int); +static int felix_phyforport(felix_softc_t, int); + +static struct felix_pci_id felix_pci_ids[] = { + {PCI_VENDOR_FREESCALE, FELIX_DEV_ID, FELIX_DEV_NAME}, + {0, 0, NULL} +}; + +static device_method_t felix_methods[] = { + /* device interface */ + DEVMETHOD(device_probe, felix_probe), + DEVMETHOD(device_attach, felix_attach), + DEVMETHOD(device_detach, felix_detach), + + /* bus interface */ + DEVMETHOD(bus_add_child, device_add_child_ordered), + + /* etherswitch interface */ + DEVMETHOD(etherswitch_getinfo, felix_getinfo), + DEVMETHOD(etherswitch_getconf, felix_getconf), + DEVMETHOD(etherswitch_setconf, felix_setconf), + DEVMETHOD(etherswitch_lock, felix_lock), + DEVMETHOD(etherswitch_unlock, felix_unlock), + DEVMETHOD(etherswitch_getport, felix_getport), + DEVMETHOD(etherswitch_setport, felix_setport), + DEVMETHOD(etherswitch_readreg, felix_readreg_wrapper), + DEVMETHOD(etherswitch_writereg, felix_writereg_wrapper), + DEVMETHOD(etherswitch_readphyreg, felix_readphy), + DEVMETHOD(etherswitch_writephyreg, felix_writephy), + DEVMETHOD(etherswitch_setvgroup, felix_setvgroup), + DEVMETHOD(etherswitch_getvgroup, felix_getvgroup), + + DEVMETHOD_END +}; + +static devclass_t felix_devclass; +DEFINE_CLASS_0(felix, felix_driver, felix_methods, + sizeof(struct felix_softc)); + +DRIVER_MODULE(felix, pci, felix_driver, felix_devclass, NULL, NULL); +DRIVER_MODULE(etherswitch, felix, etherswitch_driver, etherswitch_devclass, + NULL, NULL); +MODULE_VERSION(felix, 1); +MODULE_PNP_INFO("U16:vendor;U16:device;D:#", pci, felix, + felix_pci_ids, nitems(felix_pci_ids) - 1); + +static int +felix_probe(device_t dev) +{ + struct felix_pci_id *id; + felix_softc_t sc; + + sc = device_get_softc(dev); + sc->dev = dev; + + for (id = felix_pci_ids; id->vendor != 0; ++id) { + if (pci_get_device(dev) != id->device || + pci_get_vendor(dev) != id->vendor) + continue; + + device_set_desc(dev, id->desc); + + return (BUS_PROBE_DEFAULT); + } + + return (ENXIO); +} + +static int +felix_parse_port_fdt(felix_softc_t sc, phandle_t child, int *pport) +{ + uint32_t port, status; + phandle_t node; + + if (OF_getencprop(child, "reg", (void *)&port, sizeof(port)) < 0) { + device_printf(sc->dev, "Port node doesn't have reg property\n"); + return (ENXIO); + } + + *pport = port; + + node = OF_getproplen(child, "ethernet"); + if (node <= 0) + sc->ports[port].cpu_port = false; + else + sc->ports[port].cpu_port = true; + + node = ofw_bus_find_child(child, "fixed-link"); + if (node <= 0) { + sc->ports[port].fixed_port = false; + return (0); + } + + sc->ports[port].fixed_port = true;; + + if (OF_getencprop(node, "speed", &status, sizeof(status)) <= 0) { + device_printf(sc->dev, + "Port has fixed-link node without link speed specified\n"); + return (ENXIO); + } + + switch (status) { + case 2500: + status = IFM_2500_T; + break; + case 1000: + status = IFM_1000_T; + break; + case 100: + status = IFM_100_T; + break; + case 10: + status = IFM_10_T; + break; + default: + device_printf(sc->dev, + "Unsupported link speed value of %d\n", + status); + return (ENXIO); + } + + if (OF_hasprop(node, "full-duplex")) + status |= IFM_FDX; + else + status |= IFM_HDX; + + status |= IFM_ETHER; + sc->ports[port].fixed_link_status = status; + return (0); +} + +static int +felix_init_interface(felix_softc_t sc, int port) +{ + char name[IFNAMSIZ]; + + snprintf(name, IFNAMSIZ, "%sport", device_get_nameunit(sc->dev)); + + sc->ports[port].ifp = if_alloc(IFT_ETHER); + if (sc->ports[port].ifp == NULL) + return (ENOMEM); + + sc->ports[port].ifp->if_softc = sc; + sc->ports[port].ifp->if_flags = IFF_UP | IFF_BROADCAST | IFF_MULTICAST | + IFF_DRV_RUNNING | IFF_SIMPLEX; + sc->ports[port].ifname = malloc(strlen(name) + 1, M_FELIX, M_NOWAIT); + if (sc->ports[port].ifname == NULL) { + if_free(sc->ports[port].ifp); + return (ENOMEM); + } + + memcpy(sc->ports[port].ifname, name, strlen(name) + 1); + if_initname(sc->ports[port].ifp, sc->ports[port].ifname, port); + return (0); +} + +static void +felix_setup_port(felix_softc_t sc, int port) +{ + + /* Link speed has to be always set to 1000 in the clock register. */ + FELIX_DEVGMII_PORT_WR4(sc, port, FELIX_DEVGMII_CLK_CFG, + FELIX_DEVGMII_CLK_CFG_SPEED_1000); + FELIX_DEVGMII_PORT_WR4(sc, port, FELIX_DEVGMII_MAC_CFG, + FELIX_DEVGMII_MAC_CFG_TX_ENA | FELIX_DEVGMII_MAC_CFG_RX_ENA); + FELIX_WR4(sc, FELIX_QSYS_PORT_MODE(port), + FELIX_QSYS_PORT_MODE_PORT_ENA); + + /* + * Enable "VLANMTU". Each port has a configurable MTU. + * Accept frames that are 8 and 4 bytes longer than it + * for double and single tagged frames respectively. + * Since etherswitch API doesn't provide an option to change + * MTU don't touch it for now. + */ + FELIX_DEVGMII_PORT_WR4(sc, port, FELIX_DEVGMII_VLAN_CFG, + FELIX_DEVGMII_VLAN_CFG_ENA | + FELIX_DEVGMII_VLAN_CFG_LEN_ENA | + FELIX_DEVGMII_VLAN_CFG_DOUBLE_ENA); +} + +static int +felix_setup(felix_softc_t sc) +{ + int timeout, i; + uint32_t reg; + + /* Trigger soft reset, bit is self-clearing, with 5s timeout. */ + FELIX_WR4(sc, FELIX_DEVCPU_GCB_RST, FELIX_DEVCPU_GCB_RST_EN); + timeout = FELIX_INIT_TIMEOUT; + do { + DELAY(1000); + reg = FELIX_RD4(sc, FELIX_DEVCPU_GCB_RST); + if ((reg & FELIX_DEVCPU_GCB_RST_EN) == 0) + break; + } while (timeout-- > 0); + if (timeout == 0) { + device_printf(sc->dev, + "Timeout while waiting for switch to reset\n"); + return (ETIMEDOUT); + } + + FELIX_WR4(sc, FELIX_SYS_RAM_CTRL, FELIX_SYS_RAM_CTRL_INIT); + timeout = FELIX_INIT_TIMEOUT; + do { + DELAY(1000); + reg = FELIX_RD4(sc, FELIX_SYS_RAM_CTRL); + if ((reg & FELIX_SYS_RAM_CTRL_INIT) == 0) + break; + } while (timeout-- > 0); + if (timeout == 0) { + device_printf(sc->dev, + "Timeout while waiting for switch RAM init.\n"); + return (ETIMEDOUT); + } + + FELIX_WR4(sc, FELIX_SYS_CFG, FELIX_SYS_CFG_CORE_EN); + + for (i = 0; i < sc->info.es_nports; i++) + felix_setup_port(sc, i); + + return (0); +} + +static int +felix_attach(device_t dev) +{ + phandle_t child, ports, node; + int error, port, rid; + felix_softc_t sc; + device_t mdio_dev; + uint32_t phy_addr; + ssize_t size; + + sc = device_get_softc(dev); + sc->info.es_nports = 0; + sc->info.es_vlan_caps = ETHERSWITCH_VLAN_DOT1Q; + strlcpy(sc->info.es_name, "Felix TSN Switch", sizeof(sc->info.es_name)); + + rid = PCIR_BAR(FELIX_BAR_REGS); + sc->regs = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, + RF_ACTIVE); + if (sc->regs == NULL) { + device_printf(dev, "Failed to allocate registers BAR.\n"); + return (ENXIO); + } + + mtx_init(&sc->mtx, "felix lock", NULL, MTX_DEF); + callout_init_mtx(&sc->tick_callout, &sc->mtx, 0); + + node = ofw_bus_get_node(dev); + if (node <= 0) { + error = ENXIO; + goto out_fail; + } + + ports = ofw_bus_find_child(node, "ports"); + if (ports == 0) { + device_printf(dev, + "Failed to find \"ports\" property in DTS.\n"); + error = ENXIO; + goto out_fail; + } + + for (child = OF_child(ports); child != 0; child = OF_peer(child)) { + /* Do not parse disabled ports. */ + if (ofw_bus_node_status_okay(child) == 0) + continue; + + error = felix_parse_port_fdt(sc, child, &port); + if (error != 0) + goto out_fail; + + error = felix_init_interface(sc, port); + if (error != 0) { + device_printf(sc->dev, + "Failed to initialize interface.\n"); + goto out_fail; + } + + if (sc->ports[port].fixed_port) { + sc->info.es_nports++; + continue; + } + + size = OF_getencprop(child, "phy-handle", &node, sizeof(node)); + if (size <= 0) { + device_printf(sc->dev, + "Failed to acquire PHY handle from FDT.\n"); + error = ENXIO; + goto out_fail; + } + + node = OF_node_from_xref(node); + size = OF_getencprop(node, "reg", &phy_addr, sizeof(phy_addr)); + if (size <= 0) { + device_printf(sc->dev, + "Failed to obtain PHY address.\n"); + error = ENXIO; + goto out_fail; + } + + node = OF_parent(node); + if (node <= 0) { + device_printf(sc->dev, + "Failed to obtain MDIO node.\n"); + error = ENXIO; + goto out_fail; + } + + mdio_dev = OF_device_from_xref(node); + if (mdio_dev == NULL) { + device_printf(sc->dev, + "Failed to obtain MDIO driver handle.\n"); + error = ENXIO; + goto out_fail; + } + + sc->ports[port].phyaddr = phy_addr; + sc->ports[port].miibus = NULL; + error = mii_attach(mdio_dev, &sc->ports[port].miibus, sc->ports[port].ifp, + felix_ifmedia_upd, felix_ifmedia_sts, BMSR_DEFCAPMASK, + phy_addr, MII_OFFSET_ANY, 0); + if (error != 0) + goto out_fail; + + sc->info.es_nports++; + } + + error = felix_setup(sc); + if (error != 0) + goto out_fail; + + /* The tick routine has to be called with the lock held. */ + FELIX_LOCK(sc); + felix_tick(sc); + FELIX_UNLOCK(sc); + + /* Allow etherswitch to attach as our child. */ + bus_generic_probe(dev); + bus_generic_attach(dev); + + return (0); + +out_fail: + felix_detach(dev); + return (error); +} + +static int +felix_detach(device_t dev) +{ + felix_softc_t sc; + device_t mdio_dev; + int error; + int i; + + error = 0; + sc = device_get_softc(dev); + bus_generic_detach(dev); + + mtx_lock(&sc->mtx); + callout_stop(&sc->tick_callout); + mtx_unlock(&sc->mtx); + mtx_destroy(&sc->mtx); + + /* + * If we have been fully attached do a soft reset. + * This way after when driver is unloaded switch is left in unmanaged mode. + */ + if (device_is_attached(dev)) + felix_setup(sc); + + for (i = 0; i < sc->info.es_nports; i++) { + if (sc->ports[i].miibus != NULL) { + mdio_dev = device_get_parent(sc->ports[i].miibus); + device_delete_child(mdio_dev, sc->ports[i].miibus); + } + if (sc->ports[i].ifp != NULL) + if_free(sc->ports[i].ifp); + if (sc->ports[i].ifname != NULL) + free(sc->ports[i].ifname, M_FELIX); + } + + if (sc->regs != NULL) + error = bus_release_resource(sc->dev, SYS_RES_MEMORY, + rman_get_rid(sc->regs), sc->regs); + + return (error); +} + +static etherswitch_info_t* +felix_getinfo(device_t dev) +{ + felix_softc_t sc; + + sc = device_get_softc(dev); + return (&sc->info); +} + +static int +felix_getconf(device_t dev, etherswitch_conf_t *conf) +{ + felix_softc_t sc; + + sc = device_get_softc(dev); + + /* Return the VLAN mode. */ + conf->cmd = ETHERSWITCH_CONF_VLAN_MODE; + conf->vlan_mode = sc->vlan_mode; + return (0); +} + +static int +felix_init_vlan(felix_softc_t sc) +{ + int timeout = FELIX_INIT_TIMEOUT; + uint32_t reg; + int i; + + /* Flush VLAN table in hardware. */ + FELIX_WR4(sc, FELIX_ANA_VT, FELIX_ANA_VT_RESET); + do { + DELAY(1000); + reg = FELIX_RD4(sc, FELIX_ANA_VT); + if ((reg & FELIX_ANA_VT_STS) == FELIX_ANA_VT_IDLE) + break; + } while (timeout-- > 0); + if (timeout == 0) { + device_printf(sc->dev, + "Timeout during VLAN table reset.\n"); + return (ETIMEDOUT); + } + + /* Flush VLAN table in sc. */ + for (i = 0; i < sc->info.es_nvlangroups; i++) + sc->vlans[i] = 0; + + /* + * Make all ports VLAN aware. + * Read VID from incoming frames and use it for port grouping + * purposes. + * Don't set this if pvid is set. + */ + for (i = 0; i < sc->info.es_nports; i++) { + reg = FELIX_ANA_PORT_RD4(sc, i, FELIX_ANA_PORT_VLAN_CFG); + if ((reg & FELIX_ANA_PORT_VLAN_CFG_VID_MASK) != 0) + continue; + + reg |= FELIX_ANA_PORT_VLAN_CFG_VID_AWARE; + FELIX_ANA_PORT_WR4(sc, i, FELIX_ANA_PORT_VLAN_CFG, reg); + } + return (0); +} + +static int +felix_setconf(device_t dev, etherswitch_conf_t *conf) +{ + felix_softc_t sc; + int error; + + error = 0; + /* Set the VLAN mode. */ + sc = device_get_softc(dev); + FELIX_LOCK(sc); + if (conf->cmd & ETHERSWITCH_CONF_VLAN_MODE) { + switch (conf->vlan_mode) { + case ETHERSWITCH_VLAN_DOT1Q: + sc->vlan_mode = ETHERSWITCH_VLAN_DOT1Q; + sc->info.es_nvlangroups = FELIX_NUM_VLANS; + error = felix_init_vlan(sc); + break; + default: + error = EINVAL; + } + } + FELIX_UNLOCK(sc); + return (error); +} + +static void +felix_lock(device_t dev) +{ + felix_softc_t sc; + + sc = device_get_softc(dev); + FELIX_LOCK_ASSERT(sc, MA_NOTOWNED); + FELIX_LOCK(sc); +} + +static void +felix_unlock(device_t dev) +{ + felix_softc_t sc; + + sc = device_get_softc(dev); + FELIX_LOCK_ASSERT(sc, MA_OWNED); + FELIX_UNLOCK(sc); +} + +static void +felix_get_port_cfg(felix_softc_t sc, etherswitch_port_t *p) +{ + uint32_t reg; + + p->es_flags = 0; + + reg = FELIX_ANA_PORT_RD4(sc, p->es_port, FELIX_ANA_PORT_DROP_CFG); + if (reg & FELIX_ANA_PORT_DROP_CFG_TAGGED) + p->es_flags |= ETHERSWITCH_PORT_DROPTAGGED; + + if (reg & FELIX_ANA_PORT_DROP_CFG_UNTAGGED) + p->es_flags |= ETHERSWITCH_PORT_DROPUNTAGGED; + + reg = FELIX_DEVGMII_PORT_RD4(sc, p->es_port, FELIX_DEVGMII_VLAN_CFG); + if (reg & FELIX_DEVGMII_VLAN_CFG_DOUBLE_ENA) + p->es_flags |= ETHERSWITCH_PORT_DOUBLE_TAG; + + reg = FELIX_REW_PORT_RD4(sc, p->es_port, FELIX_REW_PORT_TAG_CFG); + if (reg & FELIX_REW_PORT_TAG_CFG_ALL) + p->es_flags |= ETHERSWITCH_PORT_ADDTAG; + + reg = FELIX_ANA_PORT_RD4(sc, p->es_port, FELIX_ANA_PORT_VLAN_CFG); + if (reg & FELIX_ANA_PORT_VLAN_CFG_POP) + p->es_flags |= ETHERSWITCH_PORT_STRIPTAGINGRESS; + + p->es_pvid = reg & FELIX_ANA_PORT_VLAN_CFG_VID_MASK; +} + +static int +felix_getport(device_t dev, etherswitch_port_t *p) +{ + struct ifmediareq *ifmr; + struct mii_data *mii; + felix_softc_t sc; + int error; + + error = 0; + sc = device_get_softc(dev); + FELIX_LOCK_ASSERT(sc, MA_NOTOWNED); + + if (p->es_port >= sc->info.es_nports || p->es_port < 0) + return (EINVAL); + + FELIX_LOCK(sc); + felix_get_port_cfg(sc, p); + if (sc->ports[p->es_port].fixed_port) { + ifmr = &p->es_ifmr; + ifmr->ifm_status = IFM_ACTIVE | IFM_AVALID; + ifmr->ifm_count = 0; + ifmr->ifm_active = sc->ports[p->es_port].fixed_link_status; + ifmr->ifm_current = ifmr->ifm_active; + ifmr->ifm_mask = 0; + } else { + mii = felix_miiforport(sc, p->es_port); + error = ifmedia_ioctl(mii->mii_ifp, &p->es_ifr, + &mii->mii_media, SIOCGIFMEDIA); + } + FELIX_UNLOCK(sc); + return (error); +} + +static void +felix_set_port_cfg(felix_softc_t sc, etherswitch_port_t *p) +{ + uint32_t reg; + + reg = FELIX_ANA_PORT_RD4(sc, p->es_port, FELIX_ANA_PORT_DROP_CFG); + if (p->es_flags & ETHERSWITCH_PORT_DROPTAGGED) + reg |= FELIX_ANA_PORT_DROP_CFG_TAGGED; + else + reg &= ~FELIX_ANA_PORT_DROP_CFG_TAGGED; + + if (p->es_flags & ETHERSWITCH_PORT_DROPUNTAGGED) + reg |= FELIX_ANA_PORT_DROP_CFG_UNTAGGED; + else + reg &= ~FELIX_ANA_PORT_DROP_CFG_UNTAGGED; + + FELIX_ANA_PORT_WR4(sc, p->es_port, FELIX_ANA_PORT_DROP_CFG, reg); + + reg = FELIX_REW_PORT_RD4(sc, p->es_port, FELIX_REW_PORT_TAG_CFG); + if (p->es_flags & ETHERSWITCH_PORT_ADDTAG) + reg |= FELIX_REW_PORT_TAG_CFG_ALL; + else + reg &= ~FELIX_REW_PORT_TAG_CFG_ALL; + + FELIX_REW_PORT_WR4(sc, p->es_port, FELIX_REW_PORT_TAG_CFG, reg); + + reg = FELIX_ANA_PORT_RD4(sc, p->es_port, FELIX_ANA_PORT_VLAN_CFG); + if (p->es_flags & ETHERSWITCH_PORT_STRIPTAGINGRESS) + reg |= FELIX_ANA_PORT_VLAN_CFG_POP; + else + reg &= ~FELIX_ANA_PORT_VLAN_CFG_POP; + + reg &= ~FELIX_ANA_PORT_VLAN_CFG_VID_MASK; + reg |= p->es_pvid & FELIX_ANA_PORT_VLAN_CFG_VID_MASK; + /* + * If port VID is set use it for VLAN classification, + * instead of frame VID. + * By default the frame tag takes precedence. + * Force the switch to ignore it. + */ + if (p->es_pvid != 0) + reg &= ~FELIX_ANA_PORT_VLAN_CFG_VID_AWARE; + else + reg |= FELIX_ANA_PORT_VLAN_CFG_VID_AWARE; + + FELIX_ANA_PORT_WR4(sc, p->es_port, FELIX_ANA_PORT_VLAN_CFG, reg); +} + +static int +felix_setport(device_t dev, etherswitch_port_t *p) +{ + felix_softc_t sc; + struct mii_data *mii; + int error; + + error = 0; + sc = device_get_softc(dev); + FELIX_LOCK_ASSERT(sc, MA_NOTOWNED); + + if (p->es_port >= sc->info.es_nports || p->es_port < 0) + return (EINVAL); + + FELIX_LOCK(sc); + felix_set_port_cfg(sc, p); + if (felix_is_phyport(sc, p->es_port)) { + mii = felix_miiforport(sc, p->es_port); + error = ifmedia_ioctl(mii->mii_ifp, &p->es_ifr, &mii->mii_media, + SIOCSIFMEDIA); + } + FELIX_UNLOCK(sc); + + return (error); +} + +static int +felix_readreg_wrapper(device_t dev, int addr_reg) +{ + felix_softc_t sc; + + sc = device_get_softc(dev); + if (addr_reg > rman_get_size(sc->regs)) + return (UINT32_MAX); /* Can't return errors here. */ + + return (FELIX_RD4(sc, addr_reg)); +} + +static int +felix_writereg_wrapper(device_t dev, int addr_reg, int val) +{ + felix_softc_t sc; + + sc = device_get_softc(dev); + if (addr_reg > rman_get_size(sc->regs)) + return (EINVAL); + + FELIX_WR4(sc, addr_reg, val); + return (0); +} + +static int +felix_readphy(device_t dev, int phy, int reg) +{ + felix_softc_t sc; + device_t mdio_dev; + int port; + + sc = device_get_softc(dev); + port = felix_phyforport(sc, phy); + if (port < 0) + return (UINT32_MAX); /* Can't return errors here. */ + + mdio_dev = device_get_parent(sc->ports[port].miibus); + return (MIIBUS_READREG(mdio_dev, phy, reg)); +} + +static int +felix_writephy(device_t dev, int phy, int reg, int data) +{ + felix_softc_t sc; + device_t mdio_dev; + int port; + + sc = device_get_softc(dev); + port = felix_phyforport(sc, phy); + if (port < 0) + return (ENXIO); + + mdio_dev = device_get_parent(sc->ports[port].miibus); + return (MIIBUS_WRITEREG(mdio_dev, phy, reg, data)); +} + +static int +felix_set_dot1q_vlan(felix_softc_t sc, etherswitch_vlangroup_t *vg) +{ + uint32_t reg; + int i, vid; + + vid = vg->es_vid & ETHERSWITCH_VID_MASK; + + /* Tagged mode is not supported. */ + if (vg->es_member_ports != vg->es_untagged_ports) + return (EINVAL); + + /* + * Hardware support 4096 groups, but we can't do group_id == vid. + * Note that hw_group_id == vid. + */ + if (vid == 0) { + /* Clear VLAN table entry using old VID. */ + FELIX_WR4(sc, FELIX_ANA_VTIDX, sc->vlans[vg->es_vlangroup]); + FELIX_WR4(sc, FELIX_ANA_VT, FELIX_ANA_VT_WRITE); + sc->vlans[vg->es_vlangroup] = 0; + return (0); + } + + /* The VID is already used in a different group. */ + for (i = 0; i < sc->info.es_nvlangroups; i++) + if (i != vg->es_vlangroup && vid == sc->vlans[i]) + return (EINVAL); + + /* This group already uses a different VID. */ + if (sc->vlans[vg->es_vlangroup] != 0 && + sc->vlans[vg->es_vlangroup] != vid) + return (EINVAL); + + sc->vlans[vg->es_vlangroup] = vid; + + /* Assign members to the given group. */ + reg = vg->es_member_ports & FELIX_ANA_VT_PORTMASK_MASK; + reg <<= FELIX_ANA_VT_PORTMASK_SHIFT; + reg |= FELIX_ANA_VT_WRITE; + + FELIX_WR4(sc, FELIX_ANA_VTIDX, vid); + FELIX_WR4(sc, FELIX_ANA_VT, reg); + + /* + * According to documentation read and write commands *** 440 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Tue Aug 3 10:08:02 2021 Return-Path: Delivered-To: dev-commits-src-all@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 CEB27634FDB; Tue, 3 Aug 2021 10:08: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 4Gf9YG5Dc0z3PyL; Tue, 3 Aug 2021 10:08: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 8F18B10EFE; Tue, 3 Aug 2021 10:08: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 173A82ao096645; Tue, 3 Aug 2021 10:08:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 173A82or096644; Tue, 3 Aug 2021 10:08:02 GMT (envelope-from git) Date: Tue, 3 Aug 2021 10:08:02 GMT Message-Id: <202108031008.173A82or096644@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marcin Wojtas Subject: git: bfce69ae9a07 - main - dtb: freescale: Add fsl-ls1028a-rdb to the build MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mw X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bfce69ae9a0731f87574fcbe96f14e5f8e77f036 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 10:08:02 -0000 The branch main has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=bfce69ae9a0731f87574fcbe96f14e5f8e77f036 commit bfce69ae9a0731f87574fcbe96f14e5f8e77f036 Author: Kornel Duleba AuthorDate: 2021-06-23 12:56:34 +0000 Commit: Marcin Wojtas CommitDate: 2021-08-03 10:07:49 +0000 dtb: freescale: Add fsl-ls1028a-rdb to the build With the recent inclusion of ENETC networking driver we now support this board. Obtained from: Semihalf Sponsored by: Alstom Group --- sys/modules/dtb/freescale/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/modules/dtb/freescale/Makefile b/sys/modules/dtb/freescale/Makefile index 4f211ad53357..77602c4f5ef1 100644 --- a/sys/modules/dtb/freescale/Makefile +++ b/sys/modules/dtb/freescale/Makefile @@ -1,6 +1,7 @@ # $FreeBSD$ # All the dts files for Freescale (now NXP) systems we support. -DTS= freescale/fsl-lx2160a-clearfog-cx.dts \ +DTS= freescale/fsl-ls1028a-rdb.dts \ + freescale/fsl-lx2160a-clearfog-cx.dts \ freescale/fsl-lx2160a-honeycomb.dts \ freescale/fsl-lx2160a-qds.dts \ freescale/fsl-lx2160a-rdb.dts From owner-dev-commits-src-all@freebsd.org Tue Aug 3 10:08:04 2021 Return-Path: Delivered-To: dev-commits-src-all@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 0007C635803; Tue, 3 Aug 2021 10:08: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 4Gf9YH6C4rz3Ppf; Tue, 3 Aug 2021 10:08: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 B65891157C; Tue, 3 Aug 2021 10:08: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 173A83JM096671; Tue, 3 Aug 2021 10:08:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 173A83HA096670; Tue, 3 Aug 2021 10:08:03 GMT (envelope-from git) Date: Tue, 3 Aug 2021 10:08:03 GMT Message-Id: <202108031008.173A83HA096670@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marcin Wojtas Subject: git: 5ad6d28cbe6b - main - enetc: Support building the driver as a loadable module. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mw X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5ad6d28cbe6b3ff85e49607a7e04cb68db3ed6df Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 10:08:04 -0000 The branch main has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=5ad6d28cbe6b3ff85e49607a7e04cb68db3ed6df commit 5ad6d28cbe6b3ff85e49607a7e04cb68db3ed6df Author: Kornel Duleba AuthorDate: 2021-07-28 09:23:23 +0000 Commit: Marcin Wojtas CommitDate: 2021-08-03 10:07:49 +0000 enetc: Support building the driver as a loadable module. Function level reset has to be done in attach in order to put the hardware in a known state before configuring it. The order of DRIVER_MODULEs was changed to ensure that the miibus driver is loaded when mii_attach is called. Obtained from: Semihalf Sponsored by: Alstom Group --- sys/dev/enetc/if_enetc.c | 6 +++++- sys/modules/Makefile | 2 ++ sys/modules/enetc/Makefile | 8 ++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/sys/dev/enetc/if_enetc.c b/sys/dev/enetc/if_enetc.c index 54cdc6ea9ad4..46327eb419bf 100644 --- a/sys/dev/enetc/if_enetc.c +++ b/sys/dev/enetc/if_enetc.c @@ -158,8 +158,8 @@ static driver_t enetc_driver = { }; static devclass_t enetc_devclass; -DRIVER_MODULE(enetc, pci, enetc_driver, enetc_devclass, NULL, NULL); DRIVER_MODULE(miibus, enetc, miibus_driver, miibus_devclass, NULL, NULL); +DRIVER_MODULE(enetc, pci, enetc_driver, enetc_devclass, NULL, NULL); MODULE_VERSION(enetc, 1); IFLIB_PNP_INFO(pci, enetc, enetc_vendor_info_array); @@ -366,6 +366,10 @@ enetc_attach_pre(if_ctx_t ctx) sc->shared = scctx; ifp = iflib_get_ifp(ctx); + pci_save_state(sc->dev); + pcie_flr(sc->dev, 1000, false); + pci_restore_state(sc->dev); + rid = PCIR_BAR(ENETC_BAR_REGS); sc->regs = bus_alloc_resource_any(sc->dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); if (sc->regs == NULL) { diff --git a/sys/modules/Makefile b/sys/modules/Makefile index e6e683ecd65e..0ba139977968 100644 --- a/sys/modules/Makefile +++ b/sys/modules/Makefile @@ -111,6 +111,7 @@ SUBDIR= \ ${_efirt} \ ${_em} \ ${_ena} \ + ${_enetc} \ esp \ ${_et} \ evdev \ @@ -612,6 +613,7 @@ _allwinner= allwinner _armv8crypto= armv8crypto _dwwdt= dwwdt _em= em +_enetc= enetc _felix= felix _rockchip= rockchip .endif diff --git a/sys/modules/enetc/Makefile b/sys/modules/enetc/Makefile new file mode 100644 index 000000000000..694ec2043f37 --- /dev/null +++ b/sys/modules/enetc/Makefile @@ -0,0 +1,8 @@ +#$FreeBSD$ + +.PATH: ${SRCTOP}/sys/dev/enetc + +KMOD = if_enetc +SRCS = if_enetc.c enetc_mdio.c + +.include From owner-dev-commits-src-all@freebsd.org Tue Aug 3 10:08:05 2021 Return-Path: Delivered-To: dev-commits-src-all@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 62E4A63537D; Tue, 3 Aug 2021 10:08: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 4Gf9YK0vBqz3Ppn; Tue, 3 Aug 2021 10:08: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 C173710EFF; Tue, 3 Aug 2021 10:08: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 173A84U4096695; Tue, 3 Aug 2021 10:08:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 173A84BG096694; Tue, 3 Aug 2021 10:08:04 GMT (envelope-from git) Date: Tue, 3 Aug 2021 10:08:04 GMT Message-Id: <202108031008.173A84BG096694@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marcin Wojtas Subject: git: dfcaa2c18bf9 - main - enetc_mdio: Support building the driver as a loadable module. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mw X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dfcaa2c18bf9c69b94d531364f8913b23f19505f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 10:08:05 -0000 The branch main has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=dfcaa2c18bf9c69b94d531364f8913b23f19505f commit dfcaa2c18bf9c69b94d531364f8913b23f19505f Author: Kornel Duleba AuthorDate: 2021-07-28 11:38:53 +0000 Commit: Marcin Wojtas CommitDate: 2021-08-03 10:07:49 +0000 enetc_mdio: Support building the driver as a loadable module. After recent arm64 GENERIC config cleanup the ENETC MDIO in NXP LS1028A SoC should support being loaded as a module. Obtained from: Semihalf Sponsored by: Alstom Group --- sys/conf/files.arm64 | 4 ++-- sys/dev/enetc/enetc_mdio_pci.c | 8 ++++---- sys/dev/etherswitch/felix/felix.c | 2 ++ sys/modules/Makefile | 2 ++ sys/modules/enetc_mdio/Makefile | 8 ++++++++ 5 files changed, 18 insertions(+), 6 deletions(-) diff --git a/sys/conf/files.arm64 b/sys/conf/files.arm64 index bfa03dade1db..5cd1fa396171 100644 --- a/sys/conf/files.arm64 +++ b/sys/conf/files.arm64 @@ -175,8 +175,8 @@ dev/cpufreq/cpufreq_dt.c optional cpufreq fdt dev/dwc/if_dwc.c optional fdt dwc_rk soc_rockchip_rk3328 | fdt dwc_rk soc_rockchip_rk3399 | fdt dwc_socfpga soc_intel_stratix10 dev/dwc/if_dwc_if.m optional fdt dwc_rk soc_rockchip_rk3328 | fdt dwc_rk soc_rockchip_rk3399 | fdt dwc_socfpga soc_intel_stratix10 -dev/enetc/enetc_mdio.c optional enetc soc_nxp_ls -dev/enetc/enetc_mdio_pci.c optional enetc pci soc_nxp_ls +dev/enetc/enetc_mdio.c optional enetc soc_nxp_ls | enetc_mdio soc_nxp_ls +dev/enetc/enetc_mdio_pci.c optional enetc_mdio pci soc_nxp_ls dev/enetc/if_enetc.c optional enetc iflib pci fdt soc_nxp_ls dev/etherswitch/felix/felix.c optional enetc etherswitch fdt felix pci soc_nxp_ls diff --git a/sys/dev/enetc/enetc_mdio_pci.c b/sys/dev/enetc/enetc_mdio_pci.c index 0fd540008e57..aac236d1c246 100644 --- a/sys/dev/enetc/enetc_mdio_pci.c +++ b/sys/dev/enetc/enetc_mdio_pci.c @@ -159,7 +159,7 @@ enetc_mdio_pci_detach(device_t dev) sc = device_get_softc(dev); - bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->sc_regs); + bus_release_resource(dev, SYS_RES_MEMORY, PCIR_BAR(0), sc->sc_regs); mtx_destroy(&sc->sc_lock); return (0); @@ -184,8 +184,8 @@ static driver_t enetc_mdio_pci_driver = { static devclass_t enetc_mdio_pci_devclass; -DRIVER_MODULE(enetc_mdio_pci, pci, enetc_mdio_pci_driver, +DRIVER_MODULE(enetc_mdio, pci, enetc_mdio_pci_driver, enetc_mdio_pci_devclass, 0, 0); -DRIVER_MODULE(miibus, enetc_mdio_pci, miibus_driver, miibus_devclass, +DRIVER_MODULE(miibus, enetc_mdio, miibus_driver, miibus_devclass, 0, 0); -MODULE_VERSION(enetc_mdio_pci, 1); +MODULE_VERSION(enetc_mdio, 1); diff --git a/sys/dev/etherswitch/felix/felix.c b/sys/dev/etherswitch/felix/felix.c index 140811807586..1cd1e0e29ca7 100644 --- a/sys/dev/etherswitch/felix/felix.c +++ b/sys/dev/etherswitch/felix/felix.c @@ -138,6 +138,8 @@ MODULE_VERSION(felix, 1); MODULE_PNP_INFO("U16:vendor;U16:device;D:#", pci, felix, felix_pci_ids, nitems(felix_pci_ids) - 1); +MODULE_DEPEND(felix, enetc_mdio, 1, 1, 1); + static int felix_probe(device_t dev) { diff --git a/sys/modules/Makefile b/sys/modules/Makefile index 0ba139977968..fdaea7fa4ec9 100644 --- a/sys/modules/Makefile +++ b/sys/modules/Makefile @@ -112,6 +112,7 @@ SUBDIR= \ ${_em} \ ${_ena} \ ${_enetc} \ + ${_enetc_mdio} \ esp \ ${_et} \ evdev \ @@ -614,6 +615,7 @@ _armv8crypto= armv8crypto _dwwdt= dwwdt _em= em _enetc= enetc +_enetc_mdio= enetc_mdio _felix= felix _rockchip= rockchip .endif diff --git a/sys/modules/enetc_mdio/Makefile b/sys/modules/enetc_mdio/Makefile new file mode 100644 index 000000000000..f448fc526705 --- /dev/null +++ b/sys/modules/enetc_mdio/Makefile @@ -0,0 +1,8 @@ +#$FreeBSD$ + +.PATH: ${SRCTOP}/sys/dev/enetc + +KMOD = enetc_mdio +SRCS = enetc_mdio_pci.c enetc_mdio.c + +.include From owner-dev-commits-src-all@freebsd.org Tue Aug 3 10:11:15 2021 Return-Path: Delivered-To: dev-commits-src-all@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 96888635A96; Tue, 3 Aug 2021 10:11: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 4Gf9cz3pFkz3QZQ; Tue, 3 Aug 2021 10:11: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 6BE811191F; Tue, 3 Aug 2021 10:11: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 173ABFE7005489; Tue, 3 Aug 2021 10:11:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 173ABF3N005488; Tue, 3 Aug 2021 10:11:15 GMT (envelope-from git) Date: Tue, 3 Aug 2021 10:11:15 GMT Message-Id: <202108031011.173ABF3N005488@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: 29b4fa787621 - main - hdaa: add missing break in hdac_pin_patch(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 29b4fa787621cbfb070323ecf2ea2da4d372bd94 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 10:11:15 -0000 The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=29b4fa787621cbfb070323ecf2ea2da4d372bd94 commit 29b4fa787621cbfb070323ecf2ea2da4d372bd94 Author: Gleb Smirnoff AuthorDate: 2021-08-03 10:06:16 +0000 Commit: Gleb Smirnoff CommitDate: 2021-08-03 10:09:32 +0000 hdaa: add missing break in hdac_pin_patch(). Fixes driver attach on my Thinkpad X1 Carbon, and likely on many other ALC family devices. Fixes: ef790cc7407e827db9563d08a52a71ab36436986 --- sys/dev/sound/pci/hda/hdaa_patches.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/dev/sound/pci/hda/hdaa_patches.c b/sys/dev/sound/pci/hda/hdaa_patches.c index dc404b9ba98e..45577819e897 100644 --- a/sys/dev/sound/pci/hda/hdaa_patches.c +++ b/sys/dev/sound/pci/hda/hdaa_patches.c @@ -326,6 +326,7 @@ hdac_pin_patch(struct hdaa_widget *w) switch (patch->type) { case PIN_PATCH_TYPE_STRING: patch_str = patch->patch.string; + break; case PIN_PATCH_TYPE_MASK: config &= ~patch->patch.mask[0]; config |= patch->patch.mask[1]; From owner-dev-commits-src-all@freebsd.org Tue Aug 3 10:13:55 2021 Return-Path: Delivered-To: dev-commits-src-all@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 45510635E01; Tue, 3 Aug 2021 10:13: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 4Gf9h31SK6z3R3j; Tue, 3 Aug 2021 10:13: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 1A6ED119AD; Tue, 3 Aug 2021 10:13: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 173ADtOT009947; Tue, 3 Aug 2021 10:13:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 173ADtsD009946; Tue, 3 Aug 2021 10:13:55 GMT (envelope-from git) Date: Tue, 3 Aug 2021 10:13:55 GMT Message-Id: <202108031013.173ADtsD009946@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: d3fd2cbbb7f9 - main - nl_NL.ISO8859-1: reinstall the missing LC_MESSAGES MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d3fd2cbbb7f9be95025143500ce0a5378135ee1c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 10:13:55 -0000 The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=d3fd2cbbb7f9be95025143500ce0a5378135ee1c commit d3fd2cbbb7f9be95025143500ce0a5378135ee1c Author: Baptiste Daroussin AuthorDate: 2021-08-03 10:10:21 +0000 Commit: Baptiste Daroussin CommitDate: 2021-08-03 10:13:52 +0000 nl_NL.ISO8859-1: reinstall the missing LC_MESSAGES --- share/msgdef/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/share/msgdef/Makefile b/share/msgdef/Makefile index 497c094ffdd7..44f1ca316953 100644 --- a/share/msgdef/Makefile +++ b/share/msgdef/Makefile @@ -50,6 +50,7 @@ LOCALES+= nb_NO.ISO8859-15 LOCALES+= lt_LT.ISO8859-13 LOCALES+= pl_PL.ISO8859-2 +SAME+= nl_NL.ISO8859-15 nl_NL.ISO8859-1 SAME+= nl_NL.ISO8859-15 af_ZA.ISO8859-15 SAME+= nl_NL.ISO8859-15 af_ZA.ISO8859-1 SAME+= es_MX.ISO8859-1 es_ES.ISO8859-15 From owner-dev-commits-src-all@freebsd.org Tue Aug 3 10:52:58 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C345C6365D8; Tue, 3 Aug 2021 10:52: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 4GfBY64wNwz3lS3; Tue, 3 Aug 2021 10:52: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 90CCA121B4; Tue, 3 Aug 2021 10:52: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 173Aqw7r063648; Tue, 3 Aug 2021 10:52:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 173AqwHE063647; Tue, 3 Aug 2021 10:52:58 GMT (envelope-from git) Date: Tue, 3 Aug 2021 10:52:58 GMT Message-Id: <202108031052.173AqwHE063647@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 3a83634c0fe2 - stable/13 - Wait for all task_struct allocations to be returned before freeing the UMA zone in the LinuxKPI 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 3a83634c0fe255be6cfb2e6cb48187f3753216ef Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 10:52:58 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=3a83634c0fe255be6cfb2e6cb48187f3753216ef commit 3a83634c0fe255be6cfb2e6cb48187f3753216ef Author: Hans Petter Selasky AuthorDate: 2021-05-21 11:17:42 +0000 Commit: Konstantin Belousov CommitDate: 2021-08-03 09:55:12 +0000 Wait for all task_struct allocations to be returned before freeing the UMA zone in the LinuxKPI (cherry picked from commit b764a426534f2f5f86d6625288c74dafdbc94d2b) --- sys/compat/linuxkpi/common/src/linux_current.c | 35 ++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_current.c b/sys/compat/linuxkpi/common/src/linux_current.c index 9bae7ee92e49..51e396081c04 100644 --- a/sys/compat/linuxkpi/common/src/linux_current.c +++ b/sys/compat/linuxkpi/common/src/linux_current.c @@ -45,6 +45,7 @@ extern u_int first_msi_irq, num_msi_irqs; static eventhandler_tag linuxkpi_thread_dtor_tag; +static atomic_t linux_current_allocs; static uma_zone_t linux_current_zone; static uma_zone_t linux_mm_zone; @@ -146,6 +147,10 @@ linux_alloc_current(struct thread *td, int flags) /* free mm_struct pointer, if any */ uma_zfree(linux_mm_zone, mm); + /* keep track of number of allocations */ + if (atomic_add_return(1, &linux_current_allocs) == INT_MAX) + panic("linux_alloc_current: Refcount too high!"); + return (0); } @@ -173,6 +178,10 @@ linux_free_current(struct task_struct *ts) { mmput(ts->mm); uma_zfree(linux_current_zone, ts); + + /* keep track of number of allocations */ + if (atomic_sub_return(1, &linux_current_allocs) < 0) + panic("linux_free_current: Negative refcount!"); } static void @@ -271,10 +280,6 @@ SYSCTL_INT(_compat_linuxkpi, OID_AUTO, task_struct_reserve, static void linux_current_init(void *arg __unused) { - lkpi_alloc_current = linux_alloc_current; - linuxkpi_thread_dtor_tag = EVENTHANDLER_REGISTER(thread_dtor, - linuxkpi_thread_dtor, NULL, EVENTHANDLER_PRI_ANY); - TUNABLE_INT_FETCH("compat.linuxkpi.task_struct_reserve", &lkpi_task_resrv); if (lkpi_task_resrv == 0) { @@ -298,6 +303,12 @@ linux_current_init(void *arg __unused) UMA_ALIGN_PTR, 0); uma_zone_reserve(linux_mm_zone, lkpi_task_resrv); uma_prealloc(linux_mm_zone, lkpi_task_resrv); + + atomic_thread_fence_seq_cst(); + + lkpi_alloc_current = linux_alloc_current; + linuxkpi_thread_dtor_tag = EVENTHANDLER_REGISTER(thread_dtor, + linuxkpi_thread_dtor, NULL, EVENTHANDLER_PRI_ANY); } SYSINIT(linux_current, SI_SUB_EVENTHANDLER, SI_ORDER_SECOND, linux_current_init, NULL); @@ -309,6 +320,10 @@ linux_current_uninit(void *arg __unused) struct task_struct *ts; struct thread *td; + lkpi_alloc_current = linux_alloc_current_noop; + + atomic_thread_fence_seq_cst(); + sx_slock(&allproc_lock); FOREACH_PROC_IN_SYSTEM(p) { PROC_LOCK(p); @@ -321,8 +336,18 @@ linux_current_uninit(void *arg __unused) PROC_UNLOCK(p); } sx_sunlock(&allproc_lock); + + /* + * There is a window where threads are removed from the + * process list and where the thread destructor is invoked. + * Catch that window by waiting for all task_struct + * allocations to be returned before freeing the UMA zone. + */ + while (atomic_read(&linux_current_allocs) != 0) + pause("W", 1); + EVENTHANDLER_DEREGISTER(thread_dtor, linuxkpi_thread_dtor_tag); - lkpi_alloc_current = linux_alloc_current_noop; + uma_zdestroy(linux_current_zone); uma_zdestroy(linux_mm_zone); } From owner-dev-commits-src-all@freebsd.org Tue Aug 3 10:52:59 2021 Return-Path: Delivered-To: dev-commits-src-all@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 E882A636276; Tue, 3 Aug 2021 10:52: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 4GfBY763H9z3lGN; Tue, 3 Aug 2021 10:52: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 B27F8121B5; Tue, 3 Aug 2021 10:52: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 173AqxQ0063672; Tue, 3 Aug 2021 10:52:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 173AqxgH063671; Tue, 3 Aug 2021 10:52:59 GMT (envelope-from git) Date: Tue, 3 Aug 2021 10:52:59 GMT Message-Id: <202108031052.173AqxgH063671@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 130f41810ea7 - stable/13 - linuxkpi: remove global atomic counter of the task allocations 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 130f41810ea754d4ba2da636d7804458185b7ed0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 10:53:00 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=130f41810ea754d4ba2da636d7804458185b7ed0 commit 130f41810ea754d4ba2da636d7804458185b7ed0 Author: Konstantin Belousov AuthorDate: 2021-05-20 15:28:20 +0000 Commit: Konstantin Belousov CommitDate: 2021-08-03 09:56:02 +0000 linuxkpi: remove global atomic counter of the task allocations (cherry picked from commit d96f55bc7159e8d018847abe5b1782d74c8aa415) --- sys/compat/linuxkpi/common/src/linux_current.c | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_current.c b/sys/compat/linuxkpi/common/src/linux_current.c index 51e396081c04..925d96770cc2 100644 --- a/sys/compat/linuxkpi/common/src/linux_current.c +++ b/sys/compat/linuxkpi/common/src/linux_current.c @@ -45,7 +45,6 @@ extern u_int first_msi_irq, num_msi_irqs; static eventhandler_tag linuxkpi_thread_dtor_tag; -static atomic_t linux_current_allocs; static uma_zone_t linux_current_zone; static uma_zone_t linux_mm_zone; @@ -147,10 +146,6 @@ linux_alloc_current(struct thread *td, int flags) /* free mm_struct pointer, if any */ uma_zfree(linux_mm_zone, mm); - /* keep track of number of allocations */ - if (atomic_add_return(1, &linux_current_allocs) == INT_MAX) - panic("linux_alloc_current: Refcount too high!"); - return (0); } @@ -178,10 +173,6 @@ linux_free_current(struct task_struct *ts) { mmput(ts->mm); uma_zfree(linux_current_zone, ts); - - /* keep track of number of allocations */ - if (atomic_sub_return(1, &linux_current_allocs) < 0) - panic("linux_free_current: Negative refcount!"); } static void @@ -306,9 +297,9 @@ linux_current_init(void *arg __unused) atomic_thread_fence_seq_cst(); - lkpi_alloc_current = linux_alloc_current; linuxkpi_thread_dtor_tag = EVENTHANDLER_REGISTER(thread_dtor, linuxkpi_thread_dtor, NULL, EVENTHANDLER_PRI_ANY); + lkpi_alloc_current = linux_alloc_current; } SYSINIT(linux_current, SI_SUB_EVENTHANDLER, SI_ORDER_SECOND, linux_current_init, NULL); @@ -337,17 +328,10 @@ linux_current_uninit(void *arg __unused) } sx_sunlock(&allproc_lock); - /* - * There is a window where threads are removed from the - * process list and where the thread destructor is invoked. - * Catch that window by waiting for all task_struct - * allocations to be returned before freeing the UMA zone. - */ - while (atomic_read(&linux_current_allocs) != 0) - pause("W", 1); + thread_reap_barrier(); EVENTHANDLER_DEREGISTER(thread_dtor, linuxkpi_thread_dtor_tag); - + uma_zdestroy(linux_current_zone); uma_zdestroy(linux_mm_zone); } From owner-dev-commits-src-all@freebsd.org Tue Aug 3 12:27:01 2021 Return-Path: Delivered-To: dev-commits-src-all@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 44F7963804C; Tue, 3 Aug 2021 12:27: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 4GfDdd1CtMz3rdF; Tue, 3 Aug 2021 12:27: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 1280D1307B; Tue, 3 Aug 2021 12:27: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 173CR17E084658; Tue, 3 Aug 2021 12:27:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 173CR1qN084657; Tue, 3 Aug 2021 12:27:01 GMT (envelope-from git) Date: Tue, 3 Aug 2021 12:27:01 GMT Message-Id: <202108031227.173CR1qN084657@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: 184d64af1344 - main - locales: stop hardcoding the directories in the mtree MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 184d64af1344d6f3c370499510cede49320f4863 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 12:27:01 -0000 The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=184d64af1344d6f3c370499510cede49320f4863 commit 184d64af1344d6f3c370499510cede49320f4863 Author: Baptiste Daroussin AuthorDate: 2021-08-03 12:25:00 +0000 Commit: Baptiste Daroussin CommitDate: 2021-08-03 12:25:00 +0000 locales: stop hardcoding the directories in the mtree The framework knows how to create directories and tag them properly for a the creation of a mtree, not need to hardcode all the locales entries in bsd.usr.mk This simplifies addition of new locales but also allow people building with WITHOUT_LOCALES to end up with a directory full of empty files --- etc/mtree/BSD.usr.dist | 383 ----------------------------------- share/colldef/Makefile | 2 + share/colldef_unicode/Makefile | 2 + share/ctypedef/Makefile | 2 + share/monetdef/Makefile | 2 + share/monetdef_unicode/Makefile | 2 + share/msgdef/Makefile | 2 + share/msgdef_unicode/Makefile | 2 + share/numericdef/Makefile | 2 + share/numericdef_unicode/Makefile | 2 + share/timedef/Makefile | 2 + tools/tools/locale/tools/cldr2def.pl | 2 + 12 files changed, 22 insertions(+), 383 deletions(-) diff --git a/etc/mtree/BSD.usr.dist b/etc/mtree/BSD.usr.dist index 97d17cedb5a1..c96ec1ea5fb5 100644 --- a/etc/mtree/BSD.usr.dist +++ b/etc/mtree/BSD.usr.dist @@ -465,389 +465,6 @@ .. .. locale - af_ZA.ISO8859-1 - .. - af_ZA.ISO8859-15 - .. - af_ZA.UTF-8 - .. - ar_AE.UTF-8 - .. - ar_EG.UTF-8 - .. - ar_JO.UTF-8 - .. - ar_MA.UTF-8 - .. - ar_QA.UTF-8 - .. - ar_SA.UTF-8 - .. - am_ET.UTF-8 - .. - be_BY.CP1131 - .. - be_BY.CP1251 - .. - be_BY.ISO8859-5 - .. - be_BY.UTF-8 - .. - bg_BG.CP1251 - .. - bg_BG.UTF-8 - .. - ca_AD.ISO8859-1 - .. - ca_AD.ISO8859-15 - .. - ca_ES.ISO8859-1 - .. - ca_ES.ISO8859-15 - .. - ca_FR.ISO8859-1 - .. - ca_FR.ISO8859-15 - .. - ca_IT.ISO8859-1 - .. - ca_IT.ISO8859-15 - .. - ca_AD.UTF-8 - .. - ca_ES.UTF-8 - .. - ca_FR.UTF-8 - .. - ca_IT.UTF-8 - .. - cs_CZ.ISO8859-2 - .. - cs_CZ.UTF-8 - .. - da_DK.ISO8859-1 - .. - da_DK.ISO8859-15 - .. - da_DK.UTF-8 - .. - de_AT.ISO8859-1 - .. - de_AT.ISO8859-15 - .. - de_AT.UTF-8 - .. - de_CH.ISO8859-1 - .. - de_CH.ISO8859-15 - .. - de_CH.UTF-8 - .. - de_DE.ISO8859-1 - .. - de_DE.ISO8859-15 - .. - de_DE.UTF-8 - .. - el_GR.ISO8859-7 - .. - el_GR.UTF-8 - .. - en_AU.ISO8859-1 - .. - en_AU.ISO8859-15 - .. - en_AU.US-ASCII - .. - en_AU.UTF-8 - .. - en_CA.ISO8859-1 - .. - en_CA.ISO8859-15 - .. - en_CA.US-ASCII - .. - en_CA.UTF-8 - .. - en_GB.ISO8859-1 - .. - en_GB.ISO8859-15 - .. - en_GB.US-ASCII - .. - en_GB.UTF-8 - .. - en_HK.ISO8859-1 - .. - en_HK.UTF-8 - .. - en_IE.ISO8859-1 - .. - en_IE.ISO8859-15 - .. - en_IE.UTF-8 - .. - en_NZ.ISO8859-1 - .. - en_NZ.ISO8859-15 - .. - en_NZ.US-ASCII - .. - en_NZ.UTF-8 - .. - en_PH.UTF-8 - .. - en_SG.ISO8859-1 - .. - en_SG.UTF-8 - .. - en_US.ISO8859-1 - .. - en_US.ISO8859-15 - .. - en_US.US-ASCII - .. - en_US.UTF-8 - .. - en_ZA.ISO8859-1 - .. - en_ZA.ISO8859-15 - .. - en_ZA.US-ASCII - .. - en_ZA.UTF-8 - .. - es_AR.ISO8859-1 - .. - es_AR.UTF-8 - .. - es_CR.UTF-8 - .. - es_ES.ISO8859-1 - .. - es_ES.ISO8859-15 - .. - es_ES.UTF-8 - .. - es_MX.ISO8859-1 - .. - es_MX.UTF-8 - .. - et_EE.ISO8859-1 - .. - et_EE.ISO8859-15 - .. - et_EE.UTF-8 - .. - eu_ES.ISO8859-1 - .. - eu_ES.ISO8859-15 - .. - eu_ES.UTF-8 - .. - fi_FI.ISO8859-1 - .. - fi_FI.ISO8859-15 - .. - fi_FI.UTF-8 - .. - fr_BE.ISO8859-1 - .. - fr_BE.ISO8859-15 - .. - fr_BE.UTF-8 - .. - fr_CA.ISO8859-1 - .. - fr_CA.ISO8859-15 - .. - fr_CA.UTF-8 - .. - fr_CH.ISO8859-1 - .. - fr_CH.ISO8859-15 - .. - fr_CH.UTF-8 - .. - fr_FR.ISO8859-1 - .. - fr_FR.ISO8859-15 - .. - fr_FR.UTF-8 - .. - ga_IE.UTF-8 - .. - he_IL.UTF-8 - .. - hi_IN.ISCII-DEV - .. - hi_IN.UTF-8 - .. - hr_HR.ISO8859-2 - .. - hr_HR.UTF-8 - .. - hu_HU.ISO8859-2 - .. - hu_HU.UTF-8 - .. - hy_AM.ARMSCII-8 - .. - hy_AM.UTF-8 - .. - is_IS.ISO8859-1 - .. - is_IS.ISO8859-15 - .. - is_IS.UTF-8 - .. - it_CH.ISO8859-1 - .. - it_CH.ISO8859-15 - .. - it_CH.UTF-8 - .. - it_IT.ISO8859-1 - .. - it_IT.ISO8859-15 - .. - it_IT.UTF-8 - .. - ja_JP.SJIS - .. - ja_JP.UTF-8 - .. - ja_JP.eucJP - .. - kk_KZ.UTF-8 - .. - ko_KR.CP949 - .. - ko_KR.UTF-8 - .. - ko_KR.eucKR - .. - lt_LT.ISO8859-13 - .. - lt_LT.UTF-8 - .. - lv_LV.ISO8859-13 - .. - lv_LV.UTF-8 - .. - mn_MN.UTF-8 - .. - nb_NO.ISO8859-1 - .. - nb_NO.ISO8859-15 - .. - nb_NO.UTF-8 - .. - nl_BE.ISO8859-1 - .. - nl_BE.ISO8859-15 - .. - nl_BE.UTF-8 - .. - nl_NL.ISO8859-1 - .. - nl_NL.ISO8859-15 - .. - nl_NL.UTF-8 - .. - nn_NO.ISO8859-1 - .. - nn_NO.ISO8859-15 - .. - nn_NO.UTF-8 - .. - pl_PL.ISO8859-2 - .. - pl_PL.UTF-8 - .. - pt_BR.ISO8859-1 - .. - pt_BR.UTF-8 - .. - pt_PT.ISO8859-1 - .. - pt_PT.ISO8859-15 - .. - pt_PT.UTF-8 - .. - ro_RO.ISO8859-2 - .. - ro_RO.UTF-8 - .. - ru_RU.CP1251 - .. - ru_RU.CP866 - .. - ru_RU.ISO8859-5 - .. - ru_RU.KOI8-R - .. - ru_RU.UTF-8 - .. - se_FI.UTF-8 - .. - se_NO.UTF-8 - .. - sk_SK.ISO8859-2 - .. - sk_SK.UTF-8 - .. - sl_SI.ISO8859-2 - .. - sl_SI.UTF-8 - .. - sr_RS.ISO8859-5 - .. - sr_RS.UTF-8 - .. - sr_RS.ISO8859-2 - .. - sr_RS.UTF-8@latin - .. - sv_FI.ISO8859-1 - .. - sv_FI.ISO8859-15 - .. - sv_FI.UTF-8 - .. - sv_SE.ISO8859-1 - .. - sv_SE.ISO8859-15 - .. - sv_SE.UTF-8 - .. - tr_TR.ISO8859-9 - .. - tr_TR.UTF-8 - .. - uk_UA.CP1251 - .. - uk_UA.ISO8859-5 - .. - uk_UA.KOI8-U - .. - uk_UA.UTF-8 - .. - zh_CN.GB18030 - .. - zh_CN.GB2312 - .. - zh_CN.GBK - .. - zh_CN.eucCN - .. - zh_CN.UTF-8 - .. - zh_HK.UTF-8 - .. - zh_TW.Big5 - .. - zh_TW.UTF-8 .. .. man diff --git a/share/colldef/Makefile b/share/colldef/Makefile index 89454f84a5e4..15e84179c768 100644 --- a/share/colldef/Makefile +++ b/share/colldef/Makefile @@ -133,7 +133,9 @@ SAME+= ko_KR.eucKR ko_KR.CP949 # legacy (same charset) FILES= ${LOCALES:S/$/.LC_COLLATE/} CLEANFILES= ${FILES} +DIRS+= SAMEDIRS .for f t in ${SAME} +SAMEDIRS+= ${LOCALEDIR}/$t SYMLINKS+= ../$f/${FILESNAME} \ ${LOCALEDIR}/$t/${FILESNAME} .endfor diff --git a/share/colldef_unicode/Makefile b/share/colldef_unicode/Makefile index e84d952a1316..4dd4bf78a36f 100644 --- a/share/colldef_unicode/Makefile +++ b/share/colldef_unicode/Makefile @@ -104,7 +104,9 @@ SAME+= zh_TW.UTF-8 zh_HK.UTF-8 FILES= ${LOCALES:S/$/.LC_COLLATE/} CLEANFILES= ${FILES} +DIRS+= SAMEDIRS .for f t in ${SAME} +SAMEDIRS+= ${LOCALEDIR}/$t SYMLINKS+= ../$f/${FILESNAME} \ ${LOCALEDIR}/$t/${FILESNAME} .endfor diff --git a/share/ctypedef/Makefile b/share/ctypedef/Makefile index da580d72c32f..ad7eb237f3eb 100644 --- a/share/ctypedef/Makefile +++ b/share/ctypedef/Makefile @@ -215,7 +215,9 @@ SAME+= ko_KR.eucKR ko_KR.CP949 # legacy (same charset) FILES= ${LOCALES:S/$/.LC_CTYPE/} CLEANFILES= ${FILES} +DIRS+= SAMEDIRS .for f t in ${SAME} +SAMEDIRS+= ${LOCALEDIR}/$t SYMLINKS+= ../$f/${FILESNAME} \ ${LOCALEDIR}/$t/${FILESNAME} .endfor diff --git a/share/monetdef/Makefile b/share/monetdef/Makefile index e5d861da468d..f0b34998f4bd 100644 --- a/share/monetdef/Makefile +++ b/share/monetdef/Makefile @@ -129,7 +129,9 @@ SAME+= ko_KR.eucKR ko_KR.CP949 # legacy (same charset) FILES= ${LOCALES:S/$/.out/} CLEANFILES= ${FILES} +DIRS+= SAMEDIRS .for f t in ${SAME} +SAMEDIRS+= ${LOCALEDIR}/$t SYMLINKS+= ../$f/${FILESNAME} \ ${LOCALEDIR}/$t/${FILESNAME} .endfor diff --git a/share/monetdef_unicode/Makefile b/share/monetdef_unicode/Makefile index 6eaab4f0ad94..4655c742669b 100644 --- a/share/monetdef_unicode/Makefile +++ b/share/monetdef_unicode/Makefile @@ -96,7 +96,9 @@ SAME+= sr_RS.UTF-8@latin sr_RS.UTF-8 FILES= ${LOCALES:S/$/.out/} CLEANFILES= ${FILES} +DIRS+= SAMEDIRS .for f t in ${SAME} +SAMEDIRS+= ${LOCALEDIR}/$t SYMLINKS+= ../$f/${FILESNAME} \ ${LOCALEDIR}/$t/${FILESNAME} .endfor diff --git a/share/msgdef/Makefile b/share/msgdef/Makefile index 44f1ca316953..9f0b7f2f3bcf 100644 --- a/share/msgdef/Makefile +++ b/share/msgdef/Makefile @@ -122,7 +122,9 @@ SAME+= ko_KR.eucKR ko_KR.CP949 # legacy (same charset) FILES= ${LOCALES:S/$/.out/} CLEANFILES= ${FILES} +DIRS+= SAMEDIRS .for f t in ${SAME} +SAMEDIRS+= ${LOCALEDIR}/$t SYMLINKS+= ../$f/${FILESNAME} \ ${LOCALEDIR}/$t/${FILESNAME} .endfor diff --git a/share/msgdef_unicode/Makefile b/share/msgdef_unicode/Makefile index 3f14010b9fa8..c0bffc05ccc6 100644 --- a/share/msgdef_unicode/Makefile +++ b/share/msgdef_unicode/Makefile @@ -96,7 +96,9 @@ SAME+= zh_TW.UTF-8 zh_HK.UTF-8 FILES= ${LOCALES:S/$/.out/} CLEANFILES= ${FILES} +DIRS+= SAMEDIRS .for f t in ${SAME} +SAMEDIRS+= ${LOCALEDIR}/$t SYMLINKS+= ../$f/${FILESNAME} \ ${LOCALEDIR}/$t/${FILESNAME} .endfor diff --git a/share/numericdef/Makefile b/share/numericdef/Makefile index 1742dd724d1c..f1047e9cb5d3 100644 --- a/share/numericdef/Makefile +++ b/share/numericdef/Makefile @@ -125,7 +125,9 @@ SAME+= ko_KR.eucKR ko_KR.CP949 # legacy (same charset) FILES= ${LOCALES:S/$/.out/} CLEANFILES= ${FILES} +DIRS+= SAMEDIRS .for f t in ${SAME} +SAMEDIRS+= ${LOCALEDIR}/$t SYMLINKS+= ../$f/${FILESNAME} \ ${LOCALEDIR}/$t/${FILESNAME} .endfor diff --git a/share/numericdef_unicode/Makefile b/share/numericdef_unicode/Makefile index c7568a4177fb..3f7f3e4f285e 100644 --- a/share/numericdef_unicode/Makefile +++ b/share/numericdef_unicode/Makefile @@ -96,7 +96,9 @@ SAME+= fr_FR.UTF-8 fr_BE.UTF-8 FILES= ${LOCALES:S/$/.out/} CLEANFILES= ${FILES} +DIRS+= SAMEDIRS .for f t in ${SAME} +SAMEDIRS+= ${LOCALEDIR}/$t SYMLINKS+= ../$f/${FILESNAME} \ ${LOCALEDIR}/$t/${FILESNAME} .endfor diff --git a/share/timedef/Makefile b/share/timedef/Makefile index 042f2f0e36f0..428e8067ae18 100644 --- a/share/timedef/Makefile +++ b/share/timedef/Makefile @@ -208,7 +208,9 @@ SAME+= ko_KR.eucKR ko_KR.CP949 # legacy (same charset) FILES= ${LOCALES:S/$/.out/} CLEANFILES= ${FILES} +DIRS+= SAMEDIRS .for f t in ${SAME} +SAMEDIRS+= ${LOCALEDIR}/$t SYMLINKS+= ../$f/${FILESNAME} \ ${LOCALEDIR}/$t/${FILESNAME} .endfor diff --git a/tools/tools/locale/tools/cldr2def.pl b/tools/tools/locale/tools/cldr2def.pl index 70e0bdad525b..277102d60a49 100755 --- a/tools/tools/locale/tools/cldr2def.pl +++ b/tools/tools/locale/tools/cldr2def.pl @@ -1081,7 +1081,9 @@ EOF FILES= \${LOCALES:S/\$/.${SRCOUT2}/} CLEANFILES= \${FILES} +DIRS+= SAMEDIRS .for f t in \${SAME} +SAMEDIRS+= \${LOCALEDIR}/\$t SYMLINKS+= ../\$f/\${FILESNAME} \\ \${LOCALEDIR}/\$t/\${FILESNAME} .endfor From owner-dev-commits-src-all@freebsd.org Tue Aug 3 12:39:22 2021 Return-Path: Delivered-To: dev-commits-src-all@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 BC343638263; Tue, 3 Aug 2021 12:39: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 4GfDvt4gGxz3svR; Tue, 3 Aug 2021 12:39: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 83C2E13627; Tue, 3 Aug 2021 12:39: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 173CdMWK098395; Tue, 3 Aug 2021 12:39:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 173CdMex098394; Tue, 3 Aug 2021 12:39:22 GMT (envelope-from git) Date: Tue, 3 Aug 2021 12:39:22 GMT Message-Id: <202108031239.173CdMex098394@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: 8232bb385989 - main - locales: fix typo preventing installation of collation for ru_RU.CP866 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8232bb38598957b8bb4f3d13738a05e16b05387a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 12:39:22 -0000 The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=8232bb38598957b8bb4f3d13738a05e16b05387a commit 8232bb38598957b8bb4f3d13738a05e16b05387a Author: Baptiste Daroussin AuthorDate: 2021-08-03 12:37:26 +0000 Commit: Baptiste Daroussin CommitDate: 2021-08-03 12:37:26 +0000 locales: fix typo preventing installation of collation for ru_RU.CP866 --- share/colldef/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/colldef/Makefile b/share/colldef/Makefile index 15e84179c768..765abf9747f3 100644 --- a/share/colldef/Makefile +++ b/share/colldef/Makefile @@ -18,7 +18,7 @@ LOCALES_MAPPED+= af_ZA.ISO8859-1 af_ZA.ISO8859-15 LOCALES_MAPPED+= be_BY.ISO8859-5 be_BY.CP1251 LOCALES_MAPPED+= be_BY.ISO8859-5 be_BY.CP1131 LOCALES_MAPPED+= ru_RU.KOI8-R ru_RU.ISO8859-5 -LOCALES_MAPPED+= ru_RU.KOI8-R RU.CP866 +LOCALES_MAPPED+= ru_RU.KOI8-R ru_RU.CP866 LOCALES_MAPPED+= ru_RU.KOI8-R ru_RU.CP1251 LOCALES_MAPPED+= ru_RU.KOI8-R bg_BG.CP1251 LOCALES_MAPPED+= ca_IT.ISO8859-15 ca_IT.ISO8859-1 From owner-dev-commits-src-all@freebsd.org Tue Aug 3 15:07:35 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C2C0463A31C; Tue, 3 Aug 2021 15:07: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 4GfJBv58qzz4jGy; Tue, 3 Aug 2021 15:07: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 962EB15164; Tue, 3 Aug 2021 15:07: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 173F7ZDS004114; Tue, 3 Aug 2021 15:07:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 173F7ZWr004113; Tue, 3 Aug 2021 15:07:35 GMT (envelope-from git) Date: Tue, 3 Aug 2021 15:07:35 GMT Message-Id: <202108031507.173F7ZWr004113@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: c982a41a0c33 - main - mtree: remove a leftover '..' in BSD.usr.dist making it inconsistent MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c982a41a0c33cee21f73f6589576f46c8fd497a7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 15:07:35 -0000 The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=c982a41a0c33cee21f73f6589576f46c8fd497a7 commit c982a41a0c33cee21f73f6589576f46c8fd497a7 Author: Baptiste Daroussin AuthorDate: 2021-08-03 15:05:37 +0000 Commit: Baptiste Daroussin CommitDate: 2021-08-03 15:06:31 +0000 mtree: remove a leftover '..' in BSD.usr.dist making it inconsistent Reported by: Michael Butler --- etc/mtree/BSD.usr.dist | 1 - 1 file changed, 1 deletion(-) diff --git a/etc/mtree/BSD.usr.dist b/etc/mtree/BSD.usr.dist index c96ec1ea5fb5..121af3ffe857 100644 --- a/etc/mtree/BSD.usr.dist +++ b/etc/mtree/BSD.usr.dist @@ -465,7 +465,6 @@ .. .. locale - .. .. man man1 From owner-dev-commits-src-all@freebsd.org Tue Aug 3 15:22:18 2021 Return-Path: Delivered-To: dev-commits-src-all@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 1B3BF63A5D2; Tue, 3 Aug 2021 15:22:18 +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 4GfJWs6JhLz4nCZ; Tue, 3 Aug 2021 15:22: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 B35FF15D85; Tue, 3 Aug 2021 15:22: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 173FMHLY030396; Tue, 3 Aug 2021 15:22:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 173FMHF9030395; Tue, 3 Aug 2021 15:22:17 GMT (envelope-from git) Date: Tue, 3 Aug 2021 15:22:17 GMT Message-Id: <202108031522.173FMHF9030395@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bryan Drewery Subject: git: 36269b823182 - main - Fix native-xtools build MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bdrewery X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 36269b82318280ef184c953b90674f5905e0f53f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 15:22:18 -0000 The branch main has been updated by bdrewery: URL: https://cgit.FreeBSD.org/src/commit/?id=36269b82318280ef184c953b90674f5905e0f53f commit 36269b82318280ef184c953b90674f5905e0f53f Author: Bryan Drewery AuthorDate: 2021-08-03 15:20:57 +0000 Commit: Bryan Drewery CommitDate: 2021-08-03 15:22:14 +0000 Fix native-xtools build Fixes https://github.com/freebsd/poudriere/issues/894 Fixes: d0c737e18 ("Makefile: Fix MAKEOBJDIRPREFIX command-line") X-MFC-With: d0c737e18 --- Makefile | 2 +- Makefile.inc1 | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index c64873fb241b..711854f4693c 100644 --- a/Makefile +++ b/Makefile @@ -218,7 +218,7 @@ _MAKEOBJDIRPREFIX!= /usr/bin/env -i PATH=${PATH} ${MAKE} MK_AUTO_OBJ=no \ ${.MAKEFLAGS:MMAKEOBJDIRPREFIX=*} __MAKE_CONF=${__MAKE_CONF} \ SRCCONF=${SRCCONF} SRC_ENV_CONF= \ -f /dev/null -V MAKEOBJDIRPREFIX dummy -.if !empty(_MAKEOBJDIRPREFIX) || !empty(.MAKEOVERRIDES:MMAKEOBJDIRPREFIX) +.if !empty(_MAKEOBJDIRPREFIX) .error MAKEOBJDIRPREFIX can only be set in environment or src-env.conf(5),\ not as a global (in make.conf(5) or src.conf(5)) or command-line variable. .endif diff --git a/Makefile.inc1 b/Makefile.inc1 index e3707c7a504a..b6843177c10b 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -2739,7 +2739,6 @@ SUBDIR= ${SUBDIR_OVERRIDE} NXBMAKEARGS+= \ OBJTOP=${NXBOBJTOP:Q} \ OBJROOT=${NXBOBJROOT:Q} \ - MAKEOBJDIRPREFIX= \ -DNO_SHARED \ -DNO_CPU_CFLAGS \ -DNO_PIC \ @@ -2763,6 +2762,9 @@ NXBMAKEARGS+= \ MK_WERROR=no \ MK_ZFS=no +NXBMAKEENV+= \ + MAKEOBJDIRPREFIX= + .if make(native-xtools*) && \ (!defined(NXB_TARGET) || !defined(NXB_TARGET_ARCH)) .error Missing NXB_TARGET / NXB_TARGET_ARCH From owner-dev-commits-src-all@freebsd.org Tue Aug 3 15:26:28 2021 Return-Path: Delivered-To: dev-commits-src-all@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 4A17B63A7E4 for ; Tue, 3 Aug 2021 15:26:28 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) (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 4GfJch1LPPz4q2G for ; Tue, 3 Aug 2021 15:26:28 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wr1-f51.google.com with SMTP id p5so25765856wro.7 for ; Tue, 03 Aug 2021 08:26:28 -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=Dapzr5nTubN4XmGhA2Ht9dT3hMZapyn7zixsbO1MVPw=; b=SgwriR7Xfjdjv2MSBkr95NsUhRltzwmZRk/ClBJGzFaPfW1a1nB7+KcOPCEWhIItcV TT4/TDJcnt1VvA8tmqBc+XpVfo+skQqqkEO4sxKXdYSnUrXIWGKiEfwBfcNtwmFeUN8y /3HRFxAGgwryMEzEPFjgYB3OW4fIg5tFLsnYoBlYgrl14/bppzWwe/gbDDDNK7V47E4M 7NSWOw80AIELyEzDELNO2DZwfC3zKDyoPKQa3Iivdo7v6vNBs5n2GXTtaUC+TtO/h/Mj edSlIlTpuF0zkQhAajTiQd0sn39hQMSJStccIXSe6LYqmMksU88tEPyvyMFgwyFSRinS N5cQ== X-Gm-Message-State: AOAM533/dFUWW4V0Te/8hvXWGGBNpWj/7e6qCsPUVaq2/X67z17asGYl fVxUk0M5y+TOrdxxj0lIu2E0AV4gESV96WPJ X-Google-Smtp-Source: ABdhPJz6dTPQzt15GJqxiWTd3CvxSuhk4mz8+e3I6SZGTDCIkMtOSJJ54dwzMtG6alCAYOHjRXLNOw== X-Received: by 2002:a5d:6908:: with SMTP id t8mr24107524wru.421.1628004380713; Tue, 03 Aug 2021 08:26:20 -0700 (PDT) Received: from smtpclient.apple (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id h9sm13519323wmb.35.2021.08.03.08.26.19 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Aug 2021 08:26:20 -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: 36269b823182 - main - Fix native-xtools build From: Jessica Clarke In-Reply-To: <202108031522.173FMHF9030395@gitrepo.freebsd.org> Date: Tue, 3 Aug 2021 16:26:19 +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: <21EA81CD-0058-4E80-9FAD-424C0ACCD276@freebsd.org> References: <202108031522.173FMHF9030395@gitrepo.freebsd.org> To: Bryan Drewery X-Mailer: Apple Mail (2.3654.100.0.2.22) X-Rspamd-Queue-Id: 4GfJch1LPPz4q2G 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 15:26:28 -0000 On 3 Aug 2021, at 16:22, Bryan Drewery wrote: >=20 > The branch main has been updated by bdrewery: >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3D36269b82318280ef184c953b90674f59= 05e0f53f >=20 > commit 36269b82318280ef184c953b90674f5905e0f53f > Author: Bryan Drewery > AuthorDate: 2021-08-03 15:20:57 +0000 > Commit: Bryan Drewery > CommitDate: 2021-08-03 15:22:14 +0000 >=20 > Fix native-xtools build >=20 > Fixes https://github.com/freebsd/poudriere/issues/894 > Fixes: d0c737e18 ("Makefile: Fix MAKEOBJDIRPREFIX = command-line") > X-MFC-With: d0c737e18 > --- > Makefile | 2 +- > Makefile.inc1 | 4 +++- > 2 files changed, 4 insertions(+), 2 deletions(-) >=20 > diff --git a/Makefile b/Makefile > index c64873fb241b..711854f4693c 100644 > --- a/Makefile > +++ b/Makefile > @@ -218,7 +218,7 @@ _MAKEOBJDIRPREFIX!=3D /usr/bin/env -i PATH=3D${PATH}= ${MAKE} MK_AUTO_OBJ=3Dno \ > ${.MAKEFLAGS:MMAKEOBJDIRPREFIX=3D*} __MAKE_CONF=3D${__MAKE_CONF} \ > SRCCONF=3D${SRCCONF} SRC_ENV_CONF=3D \ > -f /dev/null -V MAKEOBJDIRPREFIX dummy > -.if !empty(_MAKEOBJDIRPREFIX) || = !empty(.MAKEOVERRIDES:MMAKEOBJDIRPREFIX) > +.if !empty(_MAKEOBJDIRPREFIX) Why was this reverted? This restores the bug I was fixing. Does your change below not fix the actual issue you were seeing? Jess > .error MAKEOBJDIRPREFIX can only be set in environment or = src-env.conf(5),\ > not as a global (in make.conf(5) or src.conf(5)) or command-line = variable. > .endif > diff --git a/Makefile.inc1 b/Makefile.inc1 > index e3707c7a504a..b6843177c10b 100644 > --- a/Makefile.inc1 > +++ b/Makefile.inc1 > @@ -2739,7 +2739,6 @@ SUBDIR=3D ${SUBDIR_OVERRIDE} > NXBMAKEARGS+=3D \ > OBJTOP=3D${NXBOBJTOP:Q} \ > OBJROOT=3D${NXBOBJROOT:Q} \ > - MAKEOBJDIRPREFIX=3D \ > -DNO_SHARED \ > -DNO_CPU_CFLAGS \ > -DNO_PIC \ > @@ -2763,6 +2762,9 @@ NXBMAKEARGS+=3D \ > MK_WERROR=3Dno \ > MK_ZFS=3Dno >=20 > +NXBMAKEENV+=3D \ > + MAKEOBJDIRPREFIX=3D > + > .if make(native-xtools*) && \ > (!defined(NXB_TARGET) || !defined(NXB_TARGET_ARCH)) > .error Missing NXB_TARGET / NXB_TARGET_ARCH From owner-dev-commits-src-all@freebsd.org Tue Aug 3 15:42:39 2021 Return-Path: Delivered-To: dev-commits-src-all@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 BE4D663A84D; Tue, 3 Aug 2021 15:42: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 4GfJzM507Rz4tFr; Tue, 3 Aug 2021 15:42: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 91C2916059; Tue, 3 Aug 2021 15:42: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 173Fgdrt056307; Tue, 3 Aug 2021 15:42:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 173FgdN5056306; Tue, 3 Aug 2021 15:42:39 GMT (envelope-from git) Date: Tue, 3 Aug 2021 15:42:39 GMT Message-Id: <202108031542.173FgdN5056306@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: 1a78f44cd205 - main - Move setting arm64 HWCAP values to the ID tables 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: 1a78f44cd205b6f9ca11ef5cdb6e1f32c0134193 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 15:42:39 -0000 The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=1a78f44cd205b6f9ca11ef5cdb6e1f32c0134193 commit 1a78f44cd205b6f9ca11ef5cdb6e1f32c0134193 Author: Andrew Turner AuthorDate: 2021-07-16 13:49:33 +0000 Commit: Andrew Turner CommitDate: 2021-08-03 01:42:39 +0000 Move setting arm64 HWCAP values to the ID tables The HWCAPS values are based on the ID registers. Move setting these to the existing ID register parsing code. Previously we would need to handle all possible ID field values where a HWCAP is set, however as most ID fields follow a scheme where when the field increments it will only add new features meaning we only need to check if the field is greater than when the HWCAP feature was added. While here stop setting HWCAP value that need kernel support, but this support is missing. Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31201 --- sys/arm64/arm64/identcpu.c | 595 +++++++++++++++++++++++++-------------------- 1 file changed, 325 insertions(+), 270 deletions(-) diff --git a/sys/arm64/arm64/identcpu.c b/sys/arm64/arm64/identcpu.c index 40f56017b9fd..193ed6427b1d 100644 --- a/sys/arm64/arm64/identcpu.c +++ b/sys/arm64/arm64/identcpu.c @@ -48,11 +48,8 @@ __FBSDID("$FreeBSD$"); #include static void print_cpu_features(u_int cpu); -static u_long parse_cpu_features_hwcap(void); -static u_long parse_cpu_features_hwcap2(void); #ifdef COMPAT_FREEBSD32 static u_long parse_cpu_features_hwcap32(void); -static u_long parse_cpu_features_hwcap32_2(void); #endif char machine[] = "arm64"; @@ -285,16 +282,32 @@ struct mrs_field_value { #define MRS_FIELD_VALUE_END { .desc = NULL } +struct mrs_field_hwcap { + u_long *hwcap; + uint64_t min; + u_long hwcap_val; +}; + +#define MRS_HWCAP(_hwcap, _val, _min) \ +{ \ + .hwcap = (_hwcap), \ + .hwcap_val = (_val), \ + .min = (_min), \ +} + +#define MRS_HWCAP_END { .hwcap = NULL } + struct mrs_field { const char *name; struct mrs_field_value *values; + struct mrs_field_hwcap *hwcaps; uint64_t mask; bool sign; u_int type; u_int shift; }; -#define MRS_FIELD(_register, _name, _sign, _type, _values) \ +#define MRS_FIELD_HWCAP(_register, _name, _sign, _type, _values, _hwcap) \ { \ .name = #_name, \ .sign = (_sign), \ @@ -302,8 +315,12 @@ struct mrs_field { .shift = _register ## _ ## _name ## _SHIFT, \ .mask = _register ## _ ## _name ## _MASK, \ .values = (_values), \ + .hwcaps = (_hwcap), \ } +#define MRS_FIELD(_register, _name, _sign, _type, _values) \ + MRS_FIELD_HWCAP(_register, _name, _sign, _type, _values, NULL) + #define MRS_FIELD_END { .type = MRS_INVALID, } /* ID_AA64AFR0_EL1 */ @@ -409,6 +426,11 @@ static struct mrs_field_value id_aa64isar0_rndr[] = { MRS_FIELD_VALUE_END, }; +static struct mrs_field_hwcap id_aa64isar0_rndr_caps[] = { + MRS_HWCAP(&elf_hwcap2, HWCAP2_RNG, ID_AA64ISAR0_RNDR_IMPL), + MRS_HWCAP_END +}; + static struct mrs_field_value id_aa64isar0_tlb[] = { MRS_FIELD_VALUE(ID_AA64ISAR0_TLB_NONE, ""), MRS_FIELD_VALUE(ID_AA64ISAR0_TLB_TLBIOS, "TLBI-OS"), @@ -423,78 +445,154 @@ static struct mrs_field_value id_aa64isar0_ts[] = { MRS_FIELD_VALUE_END, }; +static struct mrs_field_hwcap id_aa64isar0_ts_caps[] = { + MRS_HWCAP(&elf_hwcap, HWCAP_FLAGM, ID_AA64ISAR0_TS_CondM_8_4), + MRS_HWCAP(&elf_hwcap2, HWCAP2_FLAGM2, ID_AA64ISAR0_TS_CondM_8_5), + MRS_HWCAP_END +}; + static struct mrs_field_value id_aa64isar0_fhm[] = { MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR0, FHM, NONE, IMPL), MRS_FIELD_VALUE_END, }; +static struct mrs_field_hwcap id_aa64isar0_fhm_caps[] = { + MRS_HWCAP(&elf_hwcap, HWCAP_ASIMDFHM, ID_AA64ISAR0_FHM_IMPL), + MRS_HWCAP_END +}; + static struct mrs_field_value id_aa64isar0_dp[] = { MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR0, DP, NONE, IMPL), MRS_FIELD_VALUE_END, }; +static struct mrs_field_hwcap id_aa64isar0_dp_caps[] = { + MRS_HWCAP(&elf_hwcap, HWCAP_ASIMDDP, ID_AA64ISAR0_DP_IMPL), + MRS_HWCAP_END +}; + static struct mrs_field_value id_aa64isar0_sm4[] = { MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR0, SM4, NONE, IMPL), MRS_FIELD_VALUE_END, }; +static struct mrs_field_hwcap id_aa64isar0_sm4_caps[] = { + MRS_HWCAP(&elf_hwcap, HWCAP_SM4, ID_AA64ISAR0_SM4_IMPL), + MRS_HWCAP_END +}; + static struct mrs_field_value id_aa64isar0_sm3[] = { MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR0, SM3, NONE, IMPL), MRS_FIELD_VALUE_END, }; +static struct mrs_field_hwcap id_aa64isar0_sm3_caps[] = { + MRS_HWCAP(&elf_hwcap, HWCAP_SM3, ID_AA64ISAR0_SM3_IMPL), + MRS_HWCAP_END +}; + static struct mrs_field_value id_aa64isar0_sha3[] = { MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR0, SHA3, NONE, IMPL), MRS_FIELD_VALUE_END, }; +static struct mrs_field_hwcap id_aa64isar0_sha3_caps[] = { + MRS_HWCAP(&elf_hwcap, HWCAP_SHA3, ID_AA64ISAR0_SHA3_IMPL), + MRS_HWCAP_END +}; + static struct mrs_field_value id_aa64isar0_rdm[] = { MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR0, RDM, NONE, IMPL), MRS_FIELD_VALUE_END, }; +static struct mrs_field_hwcap id_aa64isar0_rdm_caps[] = { + MRS_HWCAP(&elf_hwcap, HWCAP_ASIMDRDM, ID_AA64ISAR0_RDM_IMPL), + MRS_HWCAP_END +}; + static struct mrs_field_value id_aa64isar0_atomic[] = { MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR0, Atomic, NONE, IMPL), MRS_FIELD_VALUE_END, }; +static struct mrs_field_hwcap id_aa64isar0_atomic_caps[] = { + MRS_HWCAP(&elf_hwcap, HWCAP_ATOMICS, ID_AA64ISAR0_Atomic_IMPL), + MRS_HWCAP_END +}; + static struct mrs_field_value id_aa64isar0_crc32[] = { MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR0, CRC32, NONE, BASE), MRS_FIELD_VALUE_END, }; +static struct mrs_field_hwcap id_aa64isar0_crc32_caps[] = { + MRS_HWCAP(&elf_hwcap, HWCAP_CRC32, ID_AA64ISAR0_CRC32_BASE), + MRS_HWCAP_END +}; + static struct mrs_field_value id_aa64isar0_sha2[] = { MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR0, SHA2, NONE, BASE), MRS_FIELD_VALUE(ID_AA64ISAR0_SHA2_512, "SHA2+SHA512"), MRS_FIELD_VALUE_END, }; +static struct mrs_field_hwcap id_aa64isar0_sha2_caps[] = { + MRS_HWCAP(&elf_hwcap, HWCAP_SHA2, ID_AA64ISAR0_SHA2_BASE), + MRS_HWCAP(&elf_hwcap, HWCAP_SHA512, ID_AA64ISAR0_SHA2_512), + MRS_HWCAP_END +}; + static struct mrs_field_value id_aa64isar0_sha1[] = { MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR0, SHA1, NONE, BASE), MRS_FIELD_VALUE_END, }; +static struct mrs_field_hwcap id_aa64isar0_sha1_caps[] = { + MRS_HWCAP(&elf_hwcap, HWCAP_SHA1, ID_AA64ISAR0_SHA1_BASE), + MRS_HWCAP_END +}; + static struct mrs_field_value id_aa64isar0_aes[] = { MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR0, AES, NONE, BASE), MRS_FIELD_VALUE(ID_AA64ISAR0_AES_PMULL, "AES+PMULL"), MRS_FIELD_VALUE_END, }; +static struct mrs_field_hwcap id_aa64isar0_aes_caps[] = { + MRS_HWCAP(&elf_hwcap, HWCAP_AES, ID_AA64ISAR0_AES_BASE), + MRS_HWCAP(&elf_hwcap, HWCAP_PMULL, ID_AA64ISAR0_AES_PMULL), + MRS_HWCAP_END +}; + static struct mrs_field id_aa64isar0_fields[] = { - MRS_FIELD(ID_AA64ISAR0, RNDR, false, MRS_LOWER, id_aa64isar0_rndr), + MRS_FIELD_HWCAP(ID_AA64ISAR0, RNDR, false, MRS_LOWER, + id_aa64isar0_rndr, id_aa64isar0_rndr_caps), MRS_FIELD(ID_AA64ISAR0, TLB, false, MRS_EXACT, id_aa64isar0_tlb), - MRS_FIELD(ID_AA64ISAR0, TS, false, MRS_LOWER, id_aa64isar0_ts), - MRS_FIELD(ID_AA64ISAR0, FHM, false, MRS_LOWER, id_aa64isar0_fhm), - MRS_FIELD(ID_AA64ISAR0, DP, false, MRS_LOWER, id_aa64isar0_dp), - MRS_FIELD(ID_AA64ISAR0, SM4, false, MRS_LOWER, id_aa64isar0_sm4), - MRS_FIELD(ID_AA64ISAR0, SM3, false, MRS_LOWER, id_aa64isar0_sm3), - MRS_FIELD(ID_AA64ISAR0, SHA3, false, MRS_LOWER, id_aa64isar0_sha3), - MRS_FIELD(ID_AA64ISAR0, RDM, false, MRS_LOWER, id_aa64isar0_rdm), - MRS_FIELD(ID_AA64ISAR0, Atomic, false, MRS_LOWER, id_aa64isar0_atomic), - MRS_FIELD(ID_AA64ISAR0, CRC32, false, MRS_LOWER, id_aa64isar0_crc32), - MRS_FIELD(ID_AA64ISAR0, SHA2, false, MRS_LOWER, id_aa64isar0_sha2), - MRS_FIELD(ID_AA64ISAR0, SHA1, false, MRS_LOWER, id_aa64isar0_sha1), - MRS_FIELD(ID_AA64ISAR0, AES, false, MRS_LOWER, id_aa64isar0_aes), + MRS_FIELD_HWCAP(ID_AA64ISAR0, TS, false, MRS_LOWER, id_aa64isar0_ts, + id_aa64isar0_ts_caps), + MRS_FIELD_HWCAP(ID_AA64ISAR0, FHM, false, MRS_LOWER, id_aa64isar0_fhm, + id_aa64isar0_fhm_caps), + MRS_FIELD_HWCAP(ID_AA64ISAR0, DP, false, MRS_LOWER, id_aa64isar0_dp, + id_aa64isar0_dp_caps), + MRS_FIELD_HWCAP(ID_AA64ISAR0, SM4, false, MRS_LOWER, id_aa64isar0_sm4, + id_aa64isar0_sm4_caps), + MRS_FIELD_HWCAP(ID_AA64ISAR0, SM3, false, MRS_LOWER, id_aa64isar0_sm3, + id_aa64isar0_sm3_caps), + MRS_FIELD_HWCAP(ID_AA64ISAR0, SHA3, false, MRS_LOWER, id_aa64isar0_sha3, + id_aa64isar0_sha3_caps), + MRS_FIELD_HWCAP(ID_AA64ISAR0, RDM, false, MRS_LOWER, id_aa64isar0_rdm, + id_aa64isar0_rdm_caps), + MRS_FIELD_HWCAP(ID_AA64ISAR0, Atomic, false, MRS_LOWER, + id_aa64isar0_atomic, id_aa64isar0_atomic_caps), + MRS_FIELD_HWCAP(ID_AA64ISAR0, CRC32, false, MRS_LOWER, + id_aa64isar0_crc32, id_aa64isar0_crc32_caps), + MRS_FIELD_HWCAP(ID_AA64ISAR0, SHA2, false, MRS_LOWER, id_aa64isar0_sha2, + id_aa64isar0_sha2_caps), + MRS_FIELD_HWCAP(ID_AA64ISAR0, SHA1, false, MRS_LOWER, + id_aa64isar0_sha1, id_aa64isar0_sha1_caps), + MRS_FIELD_HWCAP(ID_AA64ISAR0, AES, false, MRS_LOWER, id_aa64isar0_aes, + id_aa64isar0_aes_caps), MRS_FIELD_END, }; @@ -505,16 +603,31 @@ static struct mrs_field_value id_aa64isar1_i8mm[] = { MRS_FIELD_VALUE_END, }; +static struct mrs_field_hwcap id_aa64isar1_i8mm_caps[] = { + MRS_HWCAP(&elf_hwcap2, HWCAP2_I8MM, ID_AA64ISAR1_I8MM_IMPL), + MRS_HWCAP_END +}; + static struct mrs_field_value id_aa64isar1_dgh[] = { MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR1, DGH, NONE, IMPL), MRS_FIELD_VALUE_END, }; +static struct mrs_field_hwcap id_aa64isar1_dgh_caps[] = { + MRS_HWCAP(&elf_hwcap2, HWCAP2_DGH, ID_AA64ISAR1_DGH_IMPL), + MRS_HWCAP_END +}; + static struct mrs_field_value id_aa64isar1_bf16[] = { MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR1, BF16, NONE, IMPL), MRS_FIELD_VALUE_END, }; +static struct mrs_field_hwcap id_aa64isar1_bf16_caps[] = { + MRS_HWCAP(&elf_hwcap2, HWCAP2_BF16, ID_AA64ISAR1_BF16_IMPL), + MRS_HWCAP_END +}; + static struct mrs_field_value id_aa64isar1_specres[] = { MRS_FIELD_VALUE(ID_AA64ISAR1_SPECRES_NONE, ""), MRS_FIELD_VALUE(ID_AA64ISAR1_SPECRES_IMPL, "PredInv"), @@ -526,11 +639,21 @@ static struct mrs_field_value id_aa64isar1_sb[] = { MRS_FIELD_VALUE_END, }; +static struct mrs_field_hwcap id_aa64isar1_sb_caps[] = { + MRS_HWCAP(&elf_hwcap, HWCAP_SB, ID_AA64ISAR1_SB_IMPL), + MRS_HWCAP_END +}; + static struct mrs_field_value id_aa64isar1_frintts[] = { MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR1, FRINTTS, NONE, IMPL), MRS_FIELD_VALUE_END, }; +static struct mrs_field_hwcap id_aa64isar1_frintts_caps[] = { + MRS_HWCAP(&elf_hwcap2, HWCAP2_FRINT, ID_AA64ISAR1_FRINTTS_IMPL), + MRS_HWCAP_END +}; + static struct mrs_field_value id_aa64isar1_gpi[] = { MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR1, GPI, NONE, IMPL), MRS_FIELD_VALUE_END, @@ -548,16 +671,32 @@ static struct mrs_field_value id_aa64isar1_lrcpc[] = { MRS_FIELD_VALUE_END, }; +static struct mrs_field_hwcap id_aa64isar1_lrcpc_caps[] = { + MRS_HWCAP(&elf_hwcap, HWCAP_LRCPC, ID_AA64ISAR1_LRCPC_RCPC_8_3), + MRS_HWCAP(&elf_hwcap, HWCAP_ILRCPC, ID_AA64ISAR1_LRCPC_RCPC_8_4), + MRS_HWCAP_END +}; + static struct mrs_field_value id_aa64isar1_fcma[] = { MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR1, FCMA, NONE, IMPL), MRS_FIELD_VALUE_END, }; +static struct mrs_field_hwcap id_aa64isar1_fcma_caps[] = { + MRS_HWCAP(&elf_hwcap, HWCAP_FCMA, ID_AA64ISAR1_FCMA_IMPL), + MRS_HWCAP_END +}; + static struct mrs_field_value id_aa64isar1_jscvt[] = { MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR1, JSCVT, NONE, IMPL), MRS_FIELD_VALUE_END, }; +static struct mrs_field_hwcap id_aa64isar1_jscvt_caps[] = { + MRS_HWCAP(&elf_hwcap, HWCAP_JSCVT, ID_AA64ISAR1_JSCVT_IMPL), + MRS_HWCAP_END +}; + static struct mrs_field_value id_aa64isar1_api[] = { MRS_FIELD_VALUE(ID_AA64ISAR1_API_NONE, ""), MRS_FIELD_VALUE(ID_AA64ISAR1_API_PAC, "API PAC"), @@ -579,23 +718,37 @@ static struct mrs_field_value id_aa64isar1_dpb[] = { MRS_FIELD_VALUE_END, }; +static struct mrs_field_hwcap id_aa64isar1_dpb_caps[] = { + MRS_HWCAP(&elf_hwcap, HWCAP_DCPOP, ID_AA64ISAR1_DPB_DCCVAP), + MRS_HWCAP(&elf_hwcap2, HWCAP2_DCPODP, ID_AA64ISAR1_DPB_DCCVADP), + MRS_HWCAP_END +}; + static struct mrs_field id_aa64isar1_fields[] = { - MRS_FIELD(ID_AA64ISAR1, I8MM, false, MRS_LOWER, id_aa64isar1_i8mm), - MRS_FIELD(ID_AA64ISAR1, DGH, false, MRS_LOWER, id_aa64isar1_dgh), - MRS_FIELD(ID_AA64ISAR1, BF16, false, MRS_LOWER, id_aa64isar1_bf16), + MRS_FIELD_HWCAP(ID_AA64ISAR1, I8MM, false, MRS_LOWER, + id_aa64isar1_i8mm, id_aa64isar1_i8mm_caps), + MRS_FIELD_HWCAP(ID_AA64ISAR1, DGH, false, MRS_LOWER, id_aa64isar1_dgh, + id_aa64isar1_dgh_caps), + MRS_FIELD_HWCAP(ID_AA64ISAR1, BF16, false, MRS_LOWER, + id_aa64isar1_bf16, id_aa64isar1_bf16_caps), MRS_FIELD(ID_AA64ISAR1, SPECRES, false, MRS_EXACT, id_aa64isar1_specres), - MRS_FIELD(ID_AA64ISAR1, SB, false, MRS_LOWER, id_aa64isar1_sb), - MRS_FIELD(ID_AA64ISAR1, FRINTTS, false, MRS_LOWER, - id_aa64isar1_frintts), + MRS_FIELD_HWCAP(ID_AA64ISAR1, SB, false, MRS_LOWER, id_aa64isar1_sb, + id_aa64isar1_sb_caps), + MRS_FIELD_HWCAP(ID_AA64ISAR1, FRINTTS, false, MRS_LOWER, + id_aa64isar1_frintts, id_aa64isar1_frintts_caps), MRS_FIELD(ID_AA64ISAR1, GPI, false, MRS_EXACT, id_aa64isar1_gpi), MRS_FIELD(ID_AA64ISAR1, GPA, false, MRS_EXACT, id_aa64isar1_gpa), - MRS_FIELD(ID_AA64ISAR1, LRCPC, false, MRS_LOWER, id_aa64isar1_lrcpc), - MRS_FIELD(ID_AA64ISAR1, FCMA, false, MRS_LOWER, id_aa64isar1_fcma), - MRS_FIELD(ID_AA64ISAR1, JSCVT, false, MRS_LOWER, id_aa64isar1_jscvt), + MRS_FIELD_HWCAP(ID_AA64ISAR1, LRCPC, false, MRS_LOWER, + id_aa64isar1_lrcpc, id_aa64isar1_lrcpc_caps), + MRS_FIELD_HWCAP(ID_AA64ISAR1, FCMA, false, MRS_LOWER, + id_aa64isar1_fcma, id_aa64isar1_fcma_caps), + MRS_FIELD_HWCAP(ID_AA64ISAR1, JSCVT, false, MRS_LOWER, + id_aa64isar1_jscvt, id_aa64isar1_jscvt_caps), MRS_FIELD(ID_AA64ISAR1, API, false, MRS_EXACT, id_aa64isar1_api), MRS_FIELD(ID_AA64ISAR1, APA, false, MRS_EXACT, id_aa64isar1_apa), - MRS_FIELD(ID_AA64ISAR1, DPB, false, MRS_LOWER, id_aa64isar1_dpb), + MRS_FIELD_HWCAP(ID_AA64ISAR1, DPB, false, MRS_LOWER, id_aa64isar1_dpb, + id_aa64isar1_dpb_caps), MRS_FIELD_END, }; @@ -801,6 +954,11 @@ static struct mrs_field_value id_aa64mmfr2_at[] = { MRS_FIELD_VALUE_END, }; +static struct mrs_field_hwcap id_aa64mmfr2_at_caps[] = { + MRS_HWCAP(&elf_hwcap, HWCAP_USCAT, ID_AA64MMFR2_AT_IMPL), + MRS_HWCAP_END +}; + static struct mrs_field_value id_aa64mmfr2_st[] = { MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR2, ST, NONE, IMPL), MRS_FIELD_VALUE_END, @@ -851,7 +1009,8 @@ static struct mrs_field id_aa64mmfr2_fields[] = { MRS_FIELD(ID_AA64MMFR2, TTL, false, MRS_EXACT, id_aa64mmfr2_ttl), MRS_FIELD(ID_AA64MMFR2, FWB, false, MRS_EXACT, id_aa64mmfr2_fwb), MRS_FIELD(ID_AA64MMFR2, IDS, false, MRS_EXACT, id_aa64mmfr2_ids), - MRS_FIELD(ID_AA64MMFR2, AT, false, MRS_LOWER, id_aa64mmfr2_at), + MRS_FIELD_HWCAP(ID_AA64MMFR2, AT, false, MRS_LOWER, id_aa64mmfr2_at, + id_aa64mmfr2_at_caps), MRS_FIELD(ID_AA64MMFR2, ST, false, MRS_EXACT, id_aa64mmfr2_st), MRS_FIELD(ID_AA64MMFR2, NV, false, MRS_EXACT, id_aa64mmfr2_nv), MRS_FIELD(ID_AA64MMFR2, CCIDX, false, MRS_EXACT, id_aa64mmfr2_ccidx), @@ -885,6 +1044,11 @@ static struct mrs_field_value id_aa64pfr0_dit[] = { MRS_FIELD_VALUE_END, }; +static struct mrs_field_hwcap id_aa64pfr0_dit_caps[] = { + MRS_HWCAP(&elf_hwcap, HWCAP_DIT, ID_AA64PFR0_DIT_PSTATE), + MRS_HWCAP_END +}; + static struct mrs_field_value id_aa64pfr0_amu[] = { MRS_FIELD_VALUE(ID_AA64PFR0_AMU_NONE, ""), MRS_FIELD_VALUE(ID_AA64PFR0_AMU_V1, "AMUv1"), @@ -906,6 +1070,14 @@ static struct mrs_field_value id_aa64pfr0_sve[] = { MRS_FIELD_VALUE_END, }; +#if 0 +/* Enable when we add SVE support */ +static struct mrs_field_hwcap id_aa64pfr0_sve_caps[] = { + MRS_HWCAP(&elf_hwcap, HWCAP_SVE, ID_AA64PFR0_SVE_IMPL), + MRS_HWCAP_END +}; +#endif + static struct mrs_field_value id_aa64pfr0_ras[] = { MRS_FIELD_VALUE(ID_AA64PFR0_RAS_NONE, ""), MRS_FIELD_VALUE(ID_AA64PFR0_RAS_IMPL, "RAS"), @@ -924,12 +1096,24 @@ static struct mrs_field_value id_aa64pfr0_advsimd[] = { MRS_FIELD_VALUE_END, }; +static struct mrs_field_hwcap id_aa64pfr0_advsimd_caps[] = { + MRS_HWCAP(&elf_hwcap, HWCAP_ASIMD, ID_AA64PFR0_AdvSIMD_IMPL), + MRS_HWCAP(&elf_hwcap, HWCAP_ASIMDHP, ID_AA64PFR0_AdvSIMD_HP), + MRS_HWCAP_END +}; + static struct mrs_field_value id_aa64pfr0_fp[] = { MRS_FIELD_VALUE_NONE_IMPL(ID_AA64PFR0, FP, NONE, IMPL), MRS_FIELD_VALUE(ID_AA64PFR0_FP_HP, "FP+HP"), MRS_FIELD_VALUE_END, }; +static struct mrs_field_hwcap id_aa64pfr0_fp_caps[] = { + MRS_HWCAP(&elf_hwcap, HWCAP_FP, ID_AA64PFR0_FP_IMPL), + MRS_HWCAP(&elf_hwcap, HWCAP_FPHP, ID_AA64PFR0_FP_HP), + MRS_HWCAP_END +}; + static struct mrs_field_value id_aa64pfr0_el3[] = { MRS_FIELD_VALUE_NONE_IMPL(ID_AA64PFR0, EL3, NONE, 64), MRS_FIELD_VALUE(ID_AA64PFR0_EL3_64_32, "EL3 32"), @@ -957,15 +1141,18 @@ static struct mrs_field_value id_aa64pfr0_el0[] = { static struct mrs_field id_aa64pfr0_fields[] = { MRS_FIELD(ID_AA64PFR0, CSV3, false, MRS_EXACT, id_aa64pfr0_csv3), MRS_FIELD(ID_AA64PFR0, CSV2, false, MRS_EXACT, id_aa64pfr0_csv2), - MRS_FIELD(ID_AA64PFR0, DIT, false, MRS_LOWER, id_aa64pfr0_dit), + MRS_FIELD_HWCAP(ID_AA64PFR0, DIT, false, MRS_LOWER, id_aa64pfr0_dit, + id_aa64pfr0_dit_caps), MRS_FIELD(ID_AA64PFR0, AMU, false, MRS_EXACT, id_aa64pfr0_amu), MRS_FIELD(ID_AA64PFR0, MPAM, false, MRS_EXACT, id_aa64pfr0_mpam), MRS_FIELD(ID_AA64PFR0, SEL2, false, MRS_EXACT, id_aa64pfr0_sel2), MRS_FIELD(ID_AA64PFR0, SVE, false, MRS_EXACT, id_aa64pfr0_sve), MRS_FIELD(ID_AA64PFR0, RAS, false, MRS_EXACT, id_aa64pfr0_ras), MRS_FIELD(ID_AA64PFR0, GIC, false, MRS_EXACT, id_aa64pfr0_gic), - MRS_FIELD(ID_AA64PFR0, AdvSIMD, true, MRS_LOWER, id_aa64pfr0_advsimd), - MRS_FIELD(ID_AA64PFR0, FP, true, MRS_LOWER, id_aa64pfr0_fp), + MRS_FIELD_HWCAP(ID_AA64PFR0, AdvSIMD, true, MRS_LOWER, + id_aa64pfr0_advsimd, id_aa64pfr0_advsimd_caps), + MRS_FIELD_HWCAP(ID_AA64PFR0, FP, true, MRS_LOWER, id_aa64pfr0_fp, + id_aa64pfr0_fp_caps), MRS_FIELD(ID_AA64PFR0, EL3, false, MRS_EXACT, id_aa64pfr0_el3), MRS_FIELD(ID_AA64PFR0, EL2, false, MRS_EXACT, id_aa64pfr0_el2), MRS_FIELD(ID_AA64PFR0, EL1, false, MRS_LOWER, id_aa64pfr0_el1), @@ -989,15 +1176,29 @@ static struct mrs_field_value id_aa64pfr1_ssbs[] = { MRS_FIELD_VALUE_END, }; +static struct mrs_field_hwcap id_aa64pfr1_ssbs_caps[] = { + MRS_HWCAP(&elf_hwcap, HWCAP_SSBS, ID_AA64PFR1_SSBS_PSTATE), + MRS_HWCAP_END +}; + static struct mrs_field_value id_aa64pfr1_bt[] = { MRS_FIELD_VALUE(ID_AA64PFR1_BT_NONE, ""), MRS_FIELD_VALUE(ID_AA64PFR1_BT_IMPL, "BTI"), MRS_FIELD_VALUE_END, }; +#if 0 +/* Enable when we add BTI support */ +static struct mrs_field_hwcap id_aa64pfr1_bt_caps[] = { + MRS_HWCAP(&elf_hwcap2, HWCAP2_BTI, ID_AA64PFR1_BT_IMPL), + MRS_HWCAP_END +}; +#endif + static struct mrs_field id_aa64pfr1_fields[] = { MRS_FIELD(ID_AA64PFR1, MTE, false, MRS_EXACT, id_aa64pfr1_mte), - MRS_FIELD(ID_AA64PFR1, SSBS, false, MRS_LOWER, id_aa64pfr1_ssbs), + MRS_FIELD_HWCAP(ID_AA64PFR1, SSBS, false, MRS_LOWER, id_aa64pfr1_ssbs, + id_aa64pfr1_ssbs_caps), MRS_FIELD(ID_AA64PFR1, BT, false, MRS_EXACT, id_aa64pfr1_bt), MRS_FIELD_END, }; @@ -1019,22 +1220,43 @@ static struct mrs_field_value id_isar5_crc32[] = { MRS_FIELD_VALUE_END, }; +static struct mrs_field_hwcap id_isar5_crc32_caps[] = { + MRS_HWCAP(&elf32_hwcap2, HWCAP32_2_CRC32, ID_ISAR5_CRC32_IMPL), + MRS_HWCAP_END +}; + static struct mrs_field_value id_isar5_sha2[] = { MRS_FIELD_VALUE_NONE_IMPL(ID_ISAR5, SHA2, NONE, IMPL), MRS_FIELD_VALUE_END, }; +static struct mrs_field_hwcap id_isar5_sha2_caps[] = { + MRS_HWCAP(&elf32_hwcap2, HWCAP32_2_SHA2, ID_ISAR5_SHA2_IMPL), + MRS_HWCAP_END +}; + static struct mrs_field_value id_isar5_sha1[] = { MRS_FIELD_VALUE_NONE_IMPL(ID_ISAR5, SHA1, NONE, IMPL), MRS_FIELD_VALUE_END, }; +static struct mrs_field_hwcap id_isar5_sha1_caps[] = { + MRS_HWCAP(&elf32_hwcap2, HWCAP32_2_SHA1, ID_ISAR5_SHA1_IMPL), + MRS_HWCAP_END +}; + static struct mrs_field_value id_isar5_aes[] = { MRS_FIELD_VALUE_NONE_IMPL(ID_ISAR5, AES, NONE, BASE), MRS_FIELD_VALUE(ID_ISAR5_AES_VMULL, "AES+VMULL"), MRS_FIELD_VALUE_END, }; +static struct mrs_field_hwcap id_isar5_aes_caps[] = { + MRS_HWCAP(&elf32_hwcap2, HWCAP32_2_AES, ID_ISAR5_AES_BASE), + MRS_HWCAP(&elf32_hwcap2, HWCAP32_2_PMULL, ID_ISAR5_AES_VMULL), + MRS_HWCAP_END +}; + static struct mrs_field_value id_isar5_sevl[] = { MRS_FIELD_VALUE_NONE_IMPL(ID_ISAR5, SEVL, NOP, IMPL), MRS_FIELD_VALUE_END, @@ -1043,10 +1265,14 @@ static struct mrs_field_value id_isar5_sevl[] = { static struct mrs_field id_isar5_fields[] = { MRS_FIELD(ID_ISAR5, VCMA, false, MRS_LOWER, id_isar5_vcma), MRS_FIELD(ID_ISAR5, RDM, false, MRS_LOWER, id_isar5_rdm), - MRS_FIELD(ID_ISAR5, CRC32, false, MRS_LOWER, id_isar5_crc32), - MRS_FIELD(ID_ISAR5, SHA2, false, MRS_LOWER, id_isar5_sha2), - MRS_FIELD(ID_ISAR5, SHA1, false, MRS_LOWER, id_isar5_sha1), - MRS_FIELD(ID_ISAR5, AES, false, MRS_LOWER, id_isar5_aes), + MRS_FIELD_HWCAP(ID_ISAR5, CRC32, false, MRS_LOWER, id_isar5_crc32, + id_isar5_crc32_caps), + MRS_FIELD_HWCAP(ID_ISAR5, SHA2, false, MRS_LOWER, id_isar5_sha2, + id_isar5_sha2_caps), + MRS_FIELD_HWCAP(ID_ISAR5, SHA1, false, MRS_LOWER, id_isar5_sha1, + id_isar5_sha1_caps), + MRS_FIELD_HWCAP(ID_ISAR5, AES, false, MRS_LOWER, id_isar5_aes, + id_isar5_aes_caps), MRS_FIELD(ID_ISAR5, SEVL, false, MRS_LOWER, id_isar5_sevl), MRS_FIELD_END, }; @@ -1079,6 +1305,11 @@ static struct mrs_field_value mvfr0_fpdp[] = { MRS_FIELD_VALUE_END, }; +static struct mrs_field_hwcap mvfr0_fpdp_caps[] = { + MRS_HWCAP(&elf32_hwcap, HWCAP32_VFP, MVFR0_FPDP_VFP_v2), + MRS_HWCAP(&elf32_hwcap, HWCAP32_VFPv3, MVFR0_FPDP_VFP_v3_v4), +}; + static struct mrs_field_value mvfr0_fpsp[] = { MRS_FIELD_VALUE(MVFR0_FPSP_NONE, ""), MRS_FIELD_VALUE(MVFR0_FPSP_VFP_v2, "SP VFPv2"), @@ -1098,7 +1329,8 @@ static struct mrs_field mvfr0_fields[] = { MRS_FIELD(MVFR0, FPSqrt, false, MRS_LOWER, mvfr0_fpsqrt), MRS_FIELD(MVFR0, FPDivide, false, MRS_LOWER, mvfr0_fpdivide), MRS_FIELD(MVFR0, FPTrap, false, MRS_LOWER, mvfr0_fptrap), - MRS_FIELD(MVFR0, FPDP, false, MRS_LOWER, mvfr0_fpdp), + MRS_FIELD_HWCAP(MVFR0, FPDP, false, MRS_LOWER, mvfr0_fpdp, + mvfr0_fpdp_caps), MRS_FIELD(MVFR0, FPSP, false, MRS_LOWER, mvfr0_fpsp), MRS_FIELD(MVFR0, SIMDReg, false, MRS_LOWER, mvfr0_simdreg), MRS_FIELD_END, @@ -1110,6 +1342,11 @@ static struct mrs_field_value mvfr1_simdfmac[] = { MRS_FIELD_VALUE_END, }; +static struct mrs_field_hwcap mvfr1_simdfmac_caps[] = { + MRS_HWCAP(&elf32_hwcap, HWCAP32_VFPv4, MVFR1_SIMDFMAC_IMPL), + MRS_HWCAP_END +}; + static struct mrs_field_value mvfr1_fphp[] = { MRS_FIELD_VALUE(MVFR1_FPHP_NONE, ""), MRS_FIELD_VALUE(MVFR1_FPHP_CONV_SP, "FPHP SP Conv"), @@ -1140,6 +1377,11 @@ static struct mrs_field_value mvfr1_simdls[] = { MRS_FIELD_VALUE_END, }; +static struct mrs_field_hwcap mvfr1_simdls_caps[] = { + MRS_HWCAP(&elf32_hwcap, HWCAP32_VFPv4, MVFR1_SIMDFMAC_IMPL), + MRS_HWCAP_END +}; + static struct mrs_field_value mvfr1_fpdnan[] = { MRS_FIELD_VALUE_NONE_IMPL(MVFR1, FPDNaN, NONE, IMPL), MRS_FIELD_VALUE_END, @@ -1151,12 +1393,14 @@ static struct mrs_field_value mvfr1_fpftz[] = { }; static struct mrs_field mvfr1_fields[] = { - MRS_FIELD(MVFR1, SIMDFMAC, false, MRS_LOWER, mvfr1_simdfmac), + MRS_FIELD_HWCAP(MVFR1, SIMDFMAC, false, MRS_LOWER, mvfr1_simdfmac, + mvfr1_simdfmac_caps), MRS_FIELD(MVFR1, FPHP, false, MRS_LOWER, mvfr1_fphp), MRS_FIELD(MVFR1, SIMDHP, false, MRS_LOWER, mvfr1_simdhp), MRS_FIELD(MVFR1, SIMDSP, false, MRS_LOWER, mvfr1_simdsp), MRS_FIELD(MVFR1, SIMDInt, false, MRS_LOWER, mvfr1_simdint), - MRS_FIELD(MVFR1, SIMDLS, false, MRS_LOWER, mvfr1_simdls), + MRS_FIELD_HWCAP(MVFR1, SIMDLS, false, MRS_LOWER, mvfr1_simdls, + mvfr1_simdls_caps), MRS_FIELD(MVFR1, FPDNaN, false, MRS_LOWER, mvfr1_fpdnan), MRS_FIELD(MVFR1, FPFtZ, false, MRS_LOWER, mvfr1_fpftz), MRS_FIELD_END, @@ -1424,6 +1668,41 @@ int64_t dcache_line_size; /* The minimum D cache line size */ int64_t icache_line_size; /* The minimum I cache line size */ int64_t idcache_line_size; /* The minimum cache line size */ +/* + * Find the values to export to userspace as AT_HWCAP and AT_HWCAP2. + */ +static void +parse_cpu_features(void) +{ + struct mrs_field_hwcap *hwcaps; + struct mrs_field *fields; + uint64_t min, reg; + int i, j, k; + + for (i = 0; i < nitems(user_regs); i++) { + reg = CPU_DESC_FIELD(user_cpu_desc, i); + fields = user_regs[i].fields; + for (j = 0; fields[j].type != 0; j++) { + hwcaps = fields[j].hwcaps; + if (hwcaps == NULL) + continue; + + for (k = 0; hwcaps[k].hwcap != NULL; k++) { + min = hwcaps[k].min; + + /* + * If the field is greater than the minimum + * value we can set the hwcap; + */ + if (mrs_field_cmp(reg, min, fields[j].shift, + 4, fields[j].sign) >= 0) { + *hwcaps[k].hwcap |= hwcaps[k].hwcap_val; + } + } + } + } +} + static void identify_cpu_sysinit(void *dummy __unused) { @@ -1444,14 +1723,12 @@ identify_cpu_sysinit(void *dummy __unused) idc = false; } - /* Exposed to userspace as AT_HWCAP and AT_HWCAP2 */ - elf_hwcap = parse_cpu_features_hwcap(); - elf_hwcap2 = parse_cpu_features_hwcap2(); + /* Find the values to export to userspace as AT_HWCAP and AT_HWCAP2 */ + parse_cpu_features(); #ifdef COMPAT_FREEBSD32 - /* 32-bit ARM versions of AT_HWCAP/HWCAP2 */ - elf32_hwcap = parse_cpu_features_hwcap32(); - elf32_hwcap2 = parse_cpu_features_hwcap32_2(); + /* Set the default caps and any that need to check multiple fields */ + elf32_hwcap |= parse_cpu_features_hwcap32(); #endif if (dic && idc) { @@ -1485,244 +1762,22 @@ cpu_features_sysinit(void *dummy __unused) /* Log features before APs are released and start printing to the dmesg. */ SYSINIT(cpu_features, SI_SUB_SMP - 1, SI_ORDER_ANY, cpu_features_sysinit, NULL); -static u_long -parse_cpu_features_hwcap(void) -{ - u_long hwcap = 0; - - switch (ID_AA64ISAR0_TS_VAL(user_cpu_desc.id_aa64isar0)) { - case ID_AA64ISAR0_TS_CondM_8_4: - case ID_AA64ISAR0_TS_CondM_8_5: - hwcap |= HWCAP_FLAGM; - break; - default: - break; - } - - if (ID_AA64ISAR0_FHM_VAL(user_cpu_desc.id_aa64isar0) == - ID_AA64ISAR0_FHM_IMPL) - hwcap |= HWCAP_ASIMDFHM; - - if (ID_AA64ISAR0_DP_VAL(user_cpu_desc.id_aa64isar0) == - ID_AA64ISAR0_DP_IMPL) - hwcap |= HWCAP_ASIMDDP; - - if (ID_AA64ISAR0_SM4_VAL(user_cpu_desc.id_aa64isar0) == - ID_AA64ISAR0_SM4_IMPL) - hwcap |= HWCAP_SM4; - - if (ID_AA64ISAR0_SM3_VAL(user_cpu_desc.id_aa64isar0) == - ID_AA64ISAR0_SM3_IMPL) - hwcap |= HWCAP_SM3; - - if (ID_AA64ISAR0_SHA3_VAL(user_cpu_desc.id_aa64isar0) == - ID_AA64ISAR0_SHA3_IMPL) - hwcap |= HWCAP_SHA3; - - if (ID_AA64ISAR0_RDM_VAL(user_cpu_desc.id_aa64isar0) == - ID_AA64ISAR0_RDM_IMPL) - hwcap |= HWCAP_ASIMDRDM; - - if (ID_AA64ISAR0_Atomic_VAL(user_cpu_desc.id_aa64isar0) == - ID_AA64ISAR0_Atomic_IMPL) - hwcap |= HWCAP_ATOMICS; - - if (ID_AA64ISAR0_CRC32_VAL(user_cpu_desc.id_aa64isar0) == - ID_AA64ISAR0_CRC32_BASE) - hwcap |= HWCAP_CRC32; - - switch (ID_AA64ISAR0_SHA2_VAL(user_cpu_desc.id_aa64isar0)) { - case ID_AA64ISAR0_SHA2_BASE: - hwcap |= HWCAP_SHA2; - break; - case ID_AA64ISAR0_SHA2_512: - hwcap |= HWCAP_SHA2 | HWCAP_SHA512; - break; - default: - break; - } - - if (ID_AA64ISAR0_SHA1_VAL(user_cpu_desc.id_aa64isar0) == - ID_AA64ISAR0_SHA1_BASE) - hwcap |= HWCAP_SHA1; - - switch (ID_AA64ISAR0_AES_VAL(user_cpu_desc.id_aa64isar0)) { - case ID_AA64ISAR0_AES_BASE: - hwcap |= HWCAP_AES; - break; - case ID_AA64ISAR0_AES_PMULL: - hwcap |= HWCAP_PMULL | HWCAP_AES; - break; - default: - break; - } - - if (ID_AA64ISAR1_SB_VAL(user_cpu_desc.id_aa64isar1) == - ID_AA64ISAR1_SB_IMPL) - hwcap |= HWCAP_SB; - - switch (ID_AA64ISAR1_LRCPC_VAL(user_cpu_desc.id_aa64isar1)) { - case ID_AA64ISAR1_LRCPC_RCPC_8_3: - hwcap |= HWCAP_LRCPC; - break; - case ID_AA64ISAR1_LRCPC_RCPC_8_4: - hwcap |= HWCAP_LRCPC | HWCAP_ILRCPC; - break; - default: - break; - } - - if (ID_AA64ISAR1_FCMA_VAL(user_cpu_desc.id_aa64isar1) == - ID_AA64ISAR1_FCMA_IMPL) - hwcap |= HWCAP_FCMA; - - if (ID_AA64ISAR1_JSCVT_VAL(user_cpu_desc.id_aa64isar1) == - ID_AA64ISAR1_JSCVT_IMPL) - hwcap |= HWCAP_JSCVT; - - if (ID_AA64ISAR1_DPB_VAL(user_cpu_desc.id_aa64isar1) == - ID_AA64ISAR1_DPB_DCCVAP) - hwcap |= HWCAP_DCPOP; - - if (ID_AA64MMFR2_AT_VAL(user_cpu_desc.id_aa64mmfr2) == - ID_AA64MMFR2_AT_IMPL) - hwcap |= HWCAP_USCAT; - - if (ID_AA64PFR0_DIT_VAL(user_cpu_desc.id_aa64pfr0) == - ID_AA64PFR0_DIT_PSTATE) - hwcap |= HWCAP_DIT; - - if (ID_AA64PFR0_SVE_VAL(user_cpu_desc.id_aa64pfr0) == - ID_AA64PFR0_SVE_IMPL) - hwcap |= HWCAP_SVE; - - switch (ID_AA64PFR0_AdvSIMD_VAL(user_cpu_desc.id_aa64pfr0)) { - case ID_AA64PFR0_AdvSIMD_IMPL: - hwcap |= HWCAP_ASIMD; - break; - case ID_AA64PFR0_AdvSIMD_HP: - hwcap |= HWCAP_ASIMD | HWCAP_ASIMDHP; - break; - default: - break; - } - - switch (ID_AA64PFR0_FP_VAL(user_cpu_desc.id_aa64pfr0)) { - case ID_AA64PFR0_FP_IMPL: - hwcap |= HWCAP_FP; - break; - case ID_AA64PFR0_FP_HP: - hwcap |= HWCAP_FP | HWCAP_FPHP; - break; - default: - break; - } - - if (ID_AA64PFR1_SSBS_VAL(user_cpu_desc.id_aa64pfr1) == - ID_AA64PFR1_SSBS_PSTATE_MSR) - hwcap |= HWCAP_SSBS; - - return (hwcap); -} - -static u_long -parse_cpu_features_hwcap2(void) -{ - u_long hwcap2 = 0; - - if (ID_AA64ISAR0_RNDR_VAL(user_cpu_desc.id_aa64isar0) == - ID_AA64ISAR0_RNDR_IMPL) - hwcap2 |= HWCAP2_RNG; - - if (ID_AA64ISAR0_TS_VAL(user_cpu_desc.id_aa64isar0) == - ID_AA64ISAR0_TS_CondM_8_5) - hwcap2 |= HWCAP2_FLAGM2; - - if (ID_AA64ISAR1_I8MM_VAL(user_cpu_desc.id_aa64isar1) == - ID_AA64ISAR1_I8MM_IMPL) - hwcap2 |= HWCAP2_I8MM; - - if (ID_AA64ISAR1_DGH_VAL(user_cpu_desc.id_aa64isar1) == - ID_AA64ISAR1_DGH_IMPL) - hwcap2 |= HWCAP2_DGH; - - if (ID_AA64ISAR1_BF16_VAL(user_cpu_desc.id_aa64isar1) == - ID_AA64ISAR1_BF16_IMPL) - hwcap2 |= HWCAP2_BF16; - - if (ID_AA64ISAR1_FRINTTS_VAL(user_cpu_desc.id_aa64isar1) == - ID_AA64ISAR1_FRINTTS_IMPL) - hwcap2 |= HWCAP2_FRINT; - - if (ID_AA64ISAR1_DPB_VAL(user_cpu_desc.id_aa64isar1) == - ID_AA64ISAR1_DPB_DCCVADP) - hwcap2 |= HWCAP2_DCPODP; - - if (ID_AA64PFR1_BT_VAL(user_cpu_desc.id_aa64pfr1) == - ID_AA64PFR1_BT_IMPL) - hwcap2 |= HWCAP2_BTI; - - return (hwcap2); -} - #ifdef COMPAT_FREEBSD32 static u_long parse_cpu_features_hwcap32(void) { u_long hwcap = HWCAP32_DEFAULT; - if (MVFR0_FPDP_VAL(user_cpu_desc.mvfr0) >= - MVFR0_FPDP_VFP_v2) { - hwcap |= HWCAP32_VFP; - - if (MVFR0_FPDP_VAL(user_cpu_desc.mvfr0) == - MVFR0_FPDP_VFP_v3_v4) { - hwcap |= HWCAP32_VFPv3; - - if (MVFR1_SIMDFMAC_VAL(user_cpu_desc.mvfr1) == - MVFR1_SIMDFMAC_IMPL) - hwcap |= HWCAP32_VFPv4; - } - } - - if ((MVFR1_SIMDLS_VAL(user_cpu_desc.mvfr1) == + if ((MVFR1_SIMDLS_VAL(user_cpu_desc.mvfr1) >= MVFR1_SIMDLS_IMPL) && - (MVFR1_SIMDInt_VAL(user_cpu_desc.mvfr1) == + (MVFR1_SIMDInt_VAL(user_cpu_desc.mvfr1) >= MVFR1_SIMDInt_IMPL) && - (MVFR1_SIMDSP_VAL(user_cpu_desc.mvfr1) == + (MVFR1_SIMDSP_VAL(user_cpu_desc.mvfr1) >= MVFR1_SIMDSP_IMPL)) hwcap |= HWCAP32_NEON; return (hwcap); } - -static u_long -parse_cpu_features_hwcap32_2(void) -{ - u_long hwcap2 = 0; - - if (ID_ISAR5_AES_VAL(user_cpu_desc.id_isar5) >= - ID_ISAR5_AES_BASE) - hwcap2 |= HWCAP32_2_AES; - - if (ID_ISAR5_AES_VAL(user_cpu_desc.id_isar5) == - ID_ISAR5_AES_VMULL) - hwcap2 |= HWCAP32_2_PMULL; - - if (ID_ISAR5_SHA1_VAL(user_cpu_desc.id_isar5) == - ID_ISAR5_SHA1_IMPL) - hwcap2 |= HWCAP32_2_SHA1; - - if (ID_ISAR5_SHA2_VAL(user_cpu_desc.id_isar5) == - ID_ISAR5_SHA2_IMPL) - hwcap2 |= HWCAP32_2_SHA2; - - if (ID_ISAR5_CRC32_VAL(user_cpu_desc.id_isar5) == - ID_ISAR5_CRC32_IMPL) - hwcap2 |= HWCAP32_2_CRC32; - - return (hwcap2); -} #endif /* COMPAT_FREEBSD32 */ static void From owner-dev-commits-src-all@freebsd.org Tue Aug 3 15:42:41 2021 Return-Path: Delivered-To: dev-commits-src-all@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 514D463AF07; Tue, 3 Aug 2021 15:42: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 4GfJzN6fBpz4tJT; Tue, 3 Aug 2021 15:42: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 BF2BA16108; Tue, 3 Aug 2021 15:42: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 173FgenQ056331; Tue, 3 Aug 2021 15:42:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 173FgeNG056330; Tue, 3 Aug 2021 15:42:40 GMT (envelope-from git) Date: Tue, 3 Aug 2021 15:42:40 GMT Message-Id: <202108031542.173FgeNG056330@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: 8b3bd5a2b571 - main - Only store the arm64 ID registers in the cpu_desc 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: 8b3bd5a2b571e2681c96dbe5b4a04529ef0d7f53 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 15:42:41 -0000 The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=8b3bd5a2b571e2681c96dbe5b4a04529ef0d7f53 commit 8b3bd5a2b571e2681c96dbe5b4a04529ef0d7f53 Author: Andrew Turner AuthorDate: 2021-07-29 08:55:01 +0000 Commit: Andrew Turner CommitDate: 2021-08-03 01:42:40 +0000 Only store the arm64 ID registers in the cpu_desc There is no need to store a pointer to the CPU implementer and part strings. Switch to load them directly into the sbuf used to print them on boot. While here print the machine ID register when we fail to determine the implementer or part we are booting on. Reviewed by: markj, kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31346 --- sys/arm64/arm64/identcpu.c | 112 +++++++++++++++++++++++++-------------------- 1 file changed, 62 insertions(+), 50 deletions(-) diff --git a/sys/arm64/arm64/identcpu.c b/sys/arm64/arm64/identcpu.c index 193ed6427b1d..37330a8f0e3f 100644 --- a/sys/arm64/arm64/identcpu.c +++ b/sys/arm64/arm64/identcpu.c @@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$"); #include #include +static void print_cpu_midr(struct sbuf *sb, u_int cpu); static void print_cpu_features(u_int cpu); #ifdef COMPAT_FREEBSD32 static u_long parse_cpu_features_hwcap32(void); @@ -116,13 +117,6 @@ uint64_t __cpu_affinity[MAXCPU]; static u_int cpu_aff_levels; struct cpu_desc { - u_int cpu_impl; - u_int cpu_part_num; - u_int cpu_variant; - u_int cpu_revision; - const char *cpu_impl_name; - const char *cpu_part_name; - uint64_t mpidr; uint64_t id_aa64afr0; uint64_t id_aa64afr1; @@ -169,7 +163,7 @@ struct cpu_parts { u_int part_id; const char *part_name; }; -#define CPU_PART_NONE { 0, "Unknown Processor" } +#define CPU_PART_NONE { 0, NULL } struct cpu_implementers { u_int impl_id; @@ -180,7 +174,7 @@ struct cpu_implementers { */ const struct cpu_parts *cpu_parts; }; -#define CPU_IMPLEMENTER_NONE { 0, "Unknown Implementer", cpu_parts_none } +#define CPU_IMPLEMENTER_NONE { 0, NULL, NULL } /* * Per-implementer table of (PartNum, CPU Name) pairs. @@ -1435,7 +1429,6 @@ static struct mrs_user_reg user_regs[] = { USER_REG(ID_AA64PFR0_EL1, id_aa64pfr0), USER_REG(ID_AA64PFR1_EL1, id_aa64pfr1), - #ifdef COMPAT_FREEBSD32 USER_REG(ID_ISAR5_EL1, id_isar5), @@ -1754,10 +1747,17 @@ SYSINIT(identify_cpu, SI_SUB_CPU, SI_ORDER_ANY, identify_cpu_sysinit, NULL); static void cpu_features_sysinit(void *dummy __unused) { + struct sbuf sb; u_int cpu; CPU_FOREACH(cpu) print_cpu_features(cpu); + + /* Fill in cpu_model for the hw.model sysctl */ + sbuf_new(&sb, cpu_model, sizeof(cpu_model), SBUF_FIXEDLEN); + print_cpu_midr(&sb, 0); + sbuf_finish(&sb); + sbuf_delete(&sb); } /* Log features before APs are released and start printing to the dmesg. */ SYSINIT(cpu_features, SI_SUB_SMP - 1, SI_ORDER_ANY, cpu_features_sysinit, NULL); @@ -1879,15 +1879,64 @@ print_id_register(struct sbuf *sb, const char *reg_name, uint64_t reg, print_register(sb, reg_name, reg, print_id_fields, fields); } +static void +print_cpu_midr(struct sbuf *sb, u_int cpu) +{ + const struct cpu_parts *cpu_partsp; + const char *cpu_impl_name; + const char *cpu_part_name; + u_int midr; + u_int impl_id; + u_int part_id; + + midr = pcpu_find(cpu)->pc_midr; + + cpu_impl_name = NULL; + cpu_partsp = NULL; + impl_id = CPU_IMPL(midr); + for (int i = 0; cpu_implementers[i].impl_name != NULL; i++) { + if (impl_id == cpu_implementers[i].impl_id) { + cpu_impl_name = cpu_implementers[i].impl_name; + cpu_partsp = cpu_implementers[i].cpu_parts; + break; + } + } + /* Unknown implementer, so unknown part */ + if (cpu_impl_name == NULL) { + sbuf_printf(sb, "Unknown Implementer (midr: %08x)", midr); + return; + } + + KASSERT(cpu_partsp != NULL, ("%s: No parts table for implementer %s", + __func__, cpu_impl_name)); + + cpu_part_name = NULL; + part_id = CPU_PART(midr); + for (int i = 0; cpu_partsp[i].part_name != NULL; i++) { + if (part_id == cpu_partsp[i].part_id) { + cpu_part_name = cpu_partsp[i].part_name; + break; + } + } + /* Known Implementer, Unknown part */ + if (cpu_part_name == NULL) { + sbuf_printf(sb, "%s Unknown CPU r%dp%d (midr: %08x)", + cpu_impl_name, CPU_VAR(midr), CPU_REV(midr), midr); + return; + } + + sbuf_printf(sb, "%s %s r%dp%d", cpu_impl_name, + cpu_part_name, CPU_VAR(midr), CPU_REV(midr)); +} + static void print_cpu_features(u_int cpu) { struct sbuf *sb; sb = sbuf_new_auto(); - sbuf_printf(sb, "CPU%3d: %s %s r%dp%d", cpu, - cpu_desc[cpu].cpu_impl_name, cpu_desc[cpu].cpu_part_name, - cpu_desc[cpu].cpu_variant, cpu_desc[cpu].cpu_revision); + sbuf_printf(sb, "CPU%3u: ", cpu); + print_cpu_midr(sb, cpu); sbuf_cat(sb, " affinity:"); switch(cpu_aff_levels) { @@ -2058,43 +2107,6 @@ identify_cache(uint64_t ctr) void identify_cpu(u_int cpu) { - u_int midr; - u_int impl_id; - u_int part_id; - size_t i; - const struct cpu_parts *cpu_partsp = NULL; - - midr = get_midr(); - - impl_id = CPU_IMPL(midr); - for (i = 0; i < nitems(cpu_implementers); i++) { - if (impl_id == cpu_implementers[i].impl_id || - cpu_implementers[i].impl_id == 0) { - cpu_desc[cpu].cpu_impl = impl_id; - cpu_desc[cpu].cpu_impl_name = - cpu_implementers[i].impl_name; - cpu_partsp = cpu_implementers[i].cpu_parts; - break; - } - } - - part_id = CPU_PART(midr); - for (i = 0; &cpu_partsp[i] != NULL; i++) { - if (part_id == cpu_partsp[i].part_id || - cpu_partsp[i].part_id == 0) { - cpu_desc[cpu].cpu_part_num = part_id; - cpu_desc[cpu].cpu_part_name = cpu_partsp[i].part_name; - break; - } - } - - cpu_desc[cpu].cpu_revision = CPU_REV(midr); - cpu_desc[cpu].cpu_variant = CPU_VAR(midr); - - snprintf(cpu_model, sizeof(cpu_model), "%s %s r%dp%d", - cpu_desc[cpu].cpu_impl_name, cpu_desc[cpu].cpu_part_name, - cpu_desc[cpu].cpu_variant, cpu_desc[cpu].cpu_revision); - /* Save affinity for current CPU */ cpu_desc[cpu].mpidr = get_mpidr(); CPU_AFFINITY(cpu) = cpu_desc[cpu].mpidr & CPU_AFF_MASK; From owner-dev-commits-src-all@freebsd.org Tue Aug 3 16:04:23 2021 Return-Path: Delivered-To: dev-commits-src-all@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 4566C63B0D9; Tue, 3 Aug 2021 16:04: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 4GfKSR1JGkz3Dhy; Tue, 3 Aug 2021 16:04: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 153171659F; Tue, 3 Aug 2021 16:04: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 173G4Msv084190; Tue, 3 Aug 2021 16:04:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 173G4MKd084189; Tue, 3 Aug 2021 16:04:22 GMT (envelope-from git) Date: Tue, 3 Aug 2021 16:04:22 GMT Message-Id: <202108031604.173G4MKd084189@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: 30e1773fdef4 - main - locales: fix abuse of bsd.dirs.mk MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 30e1773fdef42cb509bf75e9fa09472e77a333de Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 16:04:23 -0000 The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=30e1773fdef42cb509bf75e9fa09472e77a333de commit 30e1773fdef42cb509bf75e9fa09472e77a333de Author: Baptiste Daroussin AuthorDate: 2021-08-03 16:00:45 +0000 Commit: Baptiste Daroussin CommitDate: 2021-08-03 16:02:15 +0000 locales: fix abuse of bsd.dirs.mk the way SAMEDIRS was defined was an abuse of bsd.dirs.mk resulting in all the directory to be created in one single command, but DESTDIR is only prepend once on the first element of the list Switch to the properway to use bsd.dirs.mk --- share/colldef/Makefile | 4 ++-- share/colldef_unicode/Makefile | 4 ++-- share/ctypedef/Makefile | 4 ++-- share/monetdef/Makefile | 4 ++-- share/monetdef_unicode/Makefile | 4 ++-- share/msgdef/Makefile | 4 ++-- share/msgdef_unicode/Makefile | 4 ++-- share/numericdef/Makefile | 4 ++-- share/numericdef_unicode/Makefile | 4 ++-- share/timedef/Makefile | 4 ++-- tools/tools/locale/tools/cldr2def.pl | 4 ++-- 11 files changed, 22 insertions(+), 22 deletions(-) diff --git a/share/colldef/Makefile b/share/colldef/Makefile index 765abf9747f3..66487fb76984 100644 --- a/share/colldef/Makefile +++ b/share/colldef/Makefile @@ -133,9 +133,9 @@ SAME+= ko_KR.eucKR ko_KR.CP949 # legacy (same charset) FILES= ${LOCALES:S/$/.LC_COLLATE/} CLEANFILES= ${FILES} -DIRS+= SAMEDIRS .for f t in ${SAME} -SAMEDIRS+= ${LOCALEDIR}/$t +DIRS+= LOCALEDIR_$t +LOCALEDIR_$t= ${LOCALEDIR}/$t SYMLINKS+= ../$f/${FILESNAME} \ ${LOCALEDIR}/$t/${FILESNAME} .endfor diff --git a/share/colldef_unicode/Makefile b/share/colldef_unicode/Makefile index 4dd4bf78a36f..ea895d8e388e 100644 --- a/share/colldef_unicode/Makefile +++ b/share/colldef_unicode/Makefile @@ -104,9 +104,9 @@ SAME+= zh_TW.UTF-8 zh_HK.UTF-8 FILES= ${LOCALES:S/$/.LC_COLLATE/} CLEANFILES= ${FILES} -DIRS+= SAMEDIRS .for f t in ${SAME} -SAMEDIRS+= ${LOCALEDIR}/$t +DIRS+= LOCALEDIR_$t +LOCALEDIR_$t= ${LOCALEDIR}/$t SYMLINKS+= ../$f/${FILESNAME} \ ${LOCALEDIR}/$t/${FILESNAME} .endfor diff --git a/share/ctypedef/Makefile b/share/ctypedef/Makefile index ad7eb237f3eb..1a57cfeb1444 100644 --- a/share/ctypedef/Makefile +++ b/share/ctypedef/Makefile @@ -215,9 +215,9 @@ SAME+= ko_KR.eucKR ko_KR.CP949 # legacy (same charset) FILES= ${LOCALES:S/$/.LC_CTYPE/} CLEANFILES= ${FILES} -DIRS+= SAMEDIRS .for f t in ${SAME} -SAMEDIRS+= ${LOCALEDIR}/$t +DIRS+= LOCALEDIR_$t +LOCALEDIR_$t= ${LOCALEDIR}/$t SYMLINKS+= ../$f/${FILESNAME} \ ${LOCALEDIR}/$t/${FILESNAME} .endfor diff --git a/share/monetdef/Makefile b/share/monetdef/Makefile index f0b34998f4bd..bec0b78d9433 100644 --- a/share/monetdef/Makefile +++ b/share/monetdef/Makefile @@ -129,9 +129,9 @@ SAME+= ko_KR.eucKR ko_KR.CP949 # legacy (same charset) FILES= ${LOCALES:S/$/.out/} CLEANFILES= ${FILES} -DIRS+= SAMEDIRS .for f t in ${SAME} -SAMEDIRS+= ${LOCALEDIR}/$t +DIRS+= LOCALEDIR_$t +LOCALEDIR_$t= ${LOCALEDIR}/$t SYMLINKS+= ../$f/${FILESNAME} \ ${LOCALEDIR}/$t/${FILESNAME} .endfor diff --git a/share/monetdef_unicode/Makefile b/share/monetdef_unicode/Makefile index 4655c742669b..2fa073f3981d 100644 --- a/share/monetdef_unicode/Makefile +++ b/share/monetdef_unicode/Makefile @@ -96,9 +96,9 @@ SAME+= sr_RS.UTF-8@latin sr_RS.UTF-8 FILES= ${LOCALES:S/$/.out/} CLEANFILES= ${FILES} -DIRS+= SAMEDIRS .for f t in ${SAME} -SAMEDIRS+= ${LOCALEDIR}/$t +DIRS+= LOCALEDIR_$t +LOCALEDIR_$t= ${LOCALEDIR}/$t SYMLINKS+= ../$f/${FILESNAME} \ ${LOCALEDIR}/$t/${FILESNAME} .endfor diff --git a/share/msgdef/Makefile b/share/msgdef/Makefile index 9f0b7f2f3bcf..a176d30c01fc 100644 --- a/share/msgdef/Makefile +++ b/share/msgdef/Makefile @@ -122,9 +122,9 @@ SAME+= ko_KR.eucKR ko_KR.CP949 # legacy (same charset) FILES= ${LOCALES:S/$/.out/} CLEANFILES= ${FILES} -DIRS+= SAMEDIRS .for f t in ${SAME} -SAMEDIRS+= ${LOCALEDIR}/$t +DIRS+= LOCALEDIR_$t +LOCALEDIR_$t= ${LOCALEDIR}/$t SYMLINKS+= ../$f/${FILESNAME} \ ${LOCALEDIR}/$t/${FILESNAME} .endfor diff --git a/share/msgdef_unicode/Makefile b/share/msgdef_unicode/Makefile index c0bffc05ccc6..34f8b30ff733 100644 --- a/share/msgdef_unicode/Makefile +++ b/share/msgdef_unicode/Makefile @@ -96,9 +96,9 @@ SAME+= zh_TW.UTF-8 zh_HK.UTF-8 FILES= ${LOCALES:S/$/.out/} CLEANFILES= ${FILES} -DIRS+= SAMEDIRS .for f t in ${SAME} -SAMEDIRS+= ${LOCALEDIR}/$t +DIRS+= LOCALEDIR_$t +LOCALEDIR_$t= ${LOCALEDIR}/$t SYMLINKS+= ../$f/${FILESNAME} \ ${LOCALEDIR}/$t/${FILESNAME} .endfor diff --git a/share/numericdef/Makefile b/share/numericdef/Makefile index f1047e9cb5d3..da04535aa4c9 100644 --- a/share/numericdef/Makefile +++ b/share/numericdef/Makefile @@ -125,9 +125,9 @@ SAME+= ko_KR.eucKR ko_KR.CP949 # legacy (same charset) FILES= ${LOCALES:S/$/.out/} CLEANFILES= ${FILES} -DIRS+= SAMEDIRS .for f t in ${SAME} -SAMEDIRS+= ${LOCALEDIR}/$t +DIRS+= LOCALEDIR_$t +LOCALEDIR_$t= ${LOCALEDIR}/$t SYMLINKS+= ../$f/${FILESNAME} \ ${LOCALEDIR}/$t/${FILESNAME} .endfor diff --git a/share/numericdef_unicode/Makefile b/share/numericdef_unicode/Makefile index 3f7f3e4f285e..07290250c6b5 100644 --- a/share/numericdef_unicode/Makefile +++ b/share/numericdef_unicode/Makefile @@ -96,9 +96,9 @@ SAME+= fr_FR.UTF-8 fr_BE.UTF-8 FILES= ${LOCALES:S/$/.out/} CLEANFILES= ${FILES} -DIRS+= SAMEDIRS .for f t in ${SAME} -SAMEDIRS+= ${LOCALEDIR}/$t +DIRS+= LOCALEDIR_$t +LOCALEDIR_$t= ${LOCALEDIR}/$t SYMLINKS+= ../$f/${FILESNAME} \ ${LOCALEDIR}/$t/${FILESNAME} .endfor diff --git a/share/timedef/Makefile b/share/timedef/Makefile index 428e8067ae18..df16c038ba4c 100644 --- a/share/timedef/Makefile +++ b/share/timedef/Makefile @@ -208,9 +208,9 @@ SAME+= ko_KR.eucKR ko_KR.CP949 # legacy (same charset) FILES= ${LOCALES:S/$/.out/} CLEANFILES= ${FILES} -DIRS+= SAMEDIRS .for f t in ${SAME} -SAMEDIRS+= ${LOCALEDIR}/$t +DIRS+= LOCALEDIR_$t +LOCALEDIR_$t= ${LOCALEDIR}/$t SYMLINKS+= ../$f/${FILESNAME} \ ${LOCALEDIR}/$t/${FILESNAME} .endfor diff --git a/tools/tools/locale/tools/cldr2def.pl b/tools/tools/locale/tools/cldr2def.pl index 277102d60a49..78b2634b6250 100755 --- a/tools/tools/locale/tools/cldr2def.pl +++ b/tools/tools/locale/tools/cldr2def.pl @@ -1081,9 +1081,9 @@ EOF FILES= \${LOCALES:S/\$/.${SRCOUT2}/} CLEANFILES= \${FILES} -DIRS+= SAMEDIRS .for f t in \${SAME} -SAMEDIRS+= \${LOCALEDIR}/\$t +DIRS+= LOCALEDIR_\$t +LOCALEDIR_\$t= \${LOCALEDIR}/\$t SYMLINKS+= ../\$f/\${FILESNAME} \\ \${LOCALEDIR}/\$t/\${FILESNAME} .endfor From owner-dev-commits-src-all@freebsd.org Tue Aug 3 16:31:26 2021 Return-Path: Delivered-To: dev-commits-src-all@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 8175763BE57 for ; Tue, 3 Aug 2021 16:31:26 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound2m.ore.mailhop.org (outbound2m.ore.mailhop.org [54.149.155.156]) (using TLSv1.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 4GfL3f17vJz3GQn for ; Tue, 3 Aug 2021 16:31:26 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1628008280; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=XOW4hnTVIWv//TWUlaWXPqGQkNjSTxkJ3T+11oqf4ISF9/TFOp8kOcydg48ZkBmV47QF2Q71YwA+I X0qsf0YRlfVQix7Ve+tAUAdRTNOwUdPz24a4/sVHd2HUOUeHq3yH4WHYVRVo6a+d2dElh9GqPIM+Y5 J2jMAAn7kqWc1CzX1Hb8wvtbOVvY4/s3HnQX5yDglGa9w4SKfqokuzz1IKEETCnNe9JnCtKJryDwoo 0TYMc/WsOPdjCeiSmMQjxBcrveNKco6uRy8ji7L+0yNw1cvBecdfU4WUhSUD7RGA9DELbeOo6f/A+6 xxNpaYGqQGX9UDs0nD9QPM9KYhegNaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:dkim-signature:from; bh=oZ0OR14MSJYFlI9Hqn22WatJdqhATMzFbJwOBgbrOYI=; b=TcD6wwYBx+ubqmDCb+JAIml076/VB1OWofMOVvbD+zBT+y+rf7579G3ciVoJtpYh4ZdPOZ7prDHIt Utz+RGZ5NVwGMg0CB68ZozGja1Ds3Q228o/bYqpXnkwYAD8yp19On8qeyjIR+GFUWtSS8fR7OI5Zi6 PhsC8at/CB5ydFtT6O+CUPj3dL/OSP9SP7O1u7+T8rFG43OF2eB8/LNJhuaOTXKnama/XforhQn5QA 1IXz5bEg/LUDWQEWX/JzNNi7lblwcuHzkFIBqPXyGjCqe+g7+r4mavCy5XnaLZdgwCaZC+jsrTDv2p qNcWWtQ6E/hqGfJWP2vITfRBLl+e36g== ARC-Authentication-Results: i=1; outbound4.ore.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=67.177.211.60; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:from; bh=oZ0OR14MSJYFlI9Hqn22WatJdqhATMzFbJwOBgbrOYI=; b=RPVrODoz9jUueiilbgf13uHFbsAP/KJniYDr1BtBwS6HmVkx6X8iIEL9TDJs/eOZikPcU0wLJkmcC 4fKVmFTG3Bb1IGJQ3TYhmQ3kqVd0vi5rYI3kYVH/q2n3Nea2vHnAgy2iF7fiLfZtIJrtIQvIuvOcwl e0G4p6IX0zrFUr2BFR/cJwa5T6kMtkGSfsgscFhsuf/7FTrqoCCa81tpqWkEnWFZSmzS1NqqNRnuhp boP9ZdfBJu9kEWlKGC3rhU62R/+rC2tYHQNuFU3Fo8r4vMq3daCAU4GJTMwS0WbHle0tD8jaRAJrJe Y7AFBs40WtIAtwHwdWtk5ELuxJ6DhCg== X-Originating-IP: 67.177.211.60 X-MHO-RoutePath: aGlwcGll X-MHO-User: 3aa508c1-f478-11eb-a657-89389772cfc7 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (c-67-177-211-60.hsd1.co.comcast.net [67.177.211.60]) by outbound4.ore.mailhop.org (Halon) with ESMTPSA id 3aa508c1-f478-11eb-a657-89389772cfc7; Tue, 03 Aug 2021 16:31:18 +0000 (UTC) Received: from [172.22.42.84] (rev2.hippie.lan [172.22.42.84]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id 173GVHYs076666; Tue, 3 Aug 2021 10:31:17 -0600 (MDT) (envelope-from ian@freebsd.org) X-Authentication-Warning: paranoia.hippie.lan: Host rev2.hippie.lan [172.22.42.84] claimed to be [172.22.42.84] Message-ID: Subject: Re: git: dfcaa2c18bf9 - main - enetc_mdio: Support building the driver as a loadable module. From: Ian Lepore To: Marcin Wojtas , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Date: Tue, 03 Aug 2021 10:31:17 -0600 In-Reply-To: <202108031008.173A84BG096694@gitrepo.freebsd.org> References: <202108031008.173A84BG096694@gitrepo.freebsd.org> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.40.3 FreeBSD GNOME Team MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4GfL3f17vJz3GQn 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 16:31:26 -0000 On Tue, 2021-08-03 at 10:08 +0000, Marcin Wojtas wrote: > The branch main has been updated by mw: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=dfcaa2c18bf9c69b94d531364f8913b23f19505f > > commit dfcaa2c18bf9c69b94d531364f8913b23f19505f > Author:     Kornel Duleba > AuthorDate: 2021-07-28 11:38:53 +0000 > Commit:     Marcin Wojtas > CommitDate: 2021-08-03 10:07:49 +0000 > >     enetc_mdio: Support building the driver as a loadable module. >     > [...] > diff --git a/sys/modules/enetc_mdio/Makefile > b/sys/modules/enetc_mdio/Makefile > new file mode 100644 > index 000000000000..f448fc526705 > --- /dev/null > +++ b/sys/modules/enetc_mdio/Makefile > @@ -0,0 +1,8 @@ > +#$FreeBSD$ > + > +.PATH: ${SRCTOP}/sys/dev/enetc > + > +KMOD   = enetc_mdio > +SRCS   = enetc_mdio_pci.c enetc_mdio.c > + > +.include A module makefile must list all the header files it uses which are generated at build time from interface definitions (.m files) in its SRCS list. For this driver, I think that means ifdi_if.h and miibus_if.h. -- Ian From owner-dev-commits-src-all@freebsd.org Tue Aug 3 16:36:44 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A4FD663C2B3; Tue, 3 Aug 2021 16:36: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 4GfL9m4G5nz3HHt; Tue, 3 Aug 2021 16:36: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 7A54816A66; Tue, 3 Aug 2021 16:36: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 173GaiJo023777; Tue, 3 Aug 2021 16:36:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 173GaiDC023776; Tue, 3 Aug 2021 16:36:44 GMT (envelope-from git) Date: Tue, 3 Aug 2021 16:36:44 GMT Message-Id: <202108031636.173GaiDC023776@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: 0fa5403d493b - main - pkgbase: move locales into their own package MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0fa5403d493be24dda2bf575c04019ef2dcc9d0c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 16:36:44 -0000 The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=0fa5403d493be24dda2bf575c04019ef2dcc9d0c commit 0fa5403d493be24dda2bf575c04019ef2dcc9d0c Author: Baptiste Daroussin AuthorDate: 2021-08-03 15:02:16 +0000 Commit: Baptiste Daroussin CommitDate: 2021-08-03 16:35:26 +0000 pkgbase: move locales into their own package The only exception here being C.UTF-8 as this is the default locales so it needs to always be installed Reviewed by: pkgbase (emaste) Differential Revision: https://reviews.freebsd.org/D31397 --- share/colldef/Makefile | 1 + share/colldef_unicode/Makefile | 2 ++ share/ctypedef/Makefile | 9 ++++++++- share/monetdef/Makefile | 2 ++ share/monetdef_unicode/Makefile | 2 ++ share/msgdef/Makefile | 2 ++ share/msgdef_unicode/Makefile | 2 ++ share/numericdef/Makefile | 2 ++ share/numericdef_unicode/Makefile | 2 ++ share/timedef/Makefile | 2 ++ tools/tools/locale/tools/cldr2def.pl | 2 ++ 11 files changed, 27 insertions(+), 1 deletion(-) diff --git a/share/colldef/Makefile b/share/colldef/Makefile index 66487fb76984..f7e24446342d 100644 --- a/share/colldef/Makefile +++ b/share/colldef/Makefile @@ -1,5 +1,6 @@ # $FreeBSD$ +PACKAGE= locales LOCALEDIR= ${SHAREDIR}/locale FILESNAME= LC_COLLATE .SUFFIXES: .src .LC_COLLATE diff --git a/share/colldef_unicode/Makefile b/share/colldef_unicode/Makefile index ea895d8e388e..f76a7a94805c 100644 --- a/share/colldef_unicode/Makefile +++ b/share/colldef_unicode/Makefile @@ -2,6 +2,7 @@ # Warning: Do not edit. This file is automatically generated from the # tools in /usr/src/tools/tools/locale. +PACKAGE= locales LOCALEDIR= ${SHAREDIR}/locale FILESNAME= LC_COLLATE .SUFFIXES: .src .LC_COLLATE @@ -107,6 +108,7 @@ CLEANFILES= ${FILES} .for f t in ${SAME} DIRS+= LOCALEDIR_$t LOCALEDIR_$t= ${LOCALEDIR}/$t +LOCALEDIR_$tPACKAGE= locales SYMLINKS+= ../$f/${FILESNAME} \ ${LOCALEDIR}/$t/${FILESNAME} .endfor diff --git a/share/ctypedef/Makefile b/share/ctypedef/Makefile index 1a57cfeb1444..912b4e6f4757 100644 --- a/share/ctypedef/Makefile +++ b/share/ctypedef/Makefile @@ -1,5 +1,8 @@ # $FreeBSD$ +PACKAGE= locales +FILESGROUPS= FILES ALWAYS +ALWAYSPACKAGE= runtime LOCALEDIR= ${SHAREDIR}/locale FILESNAME= LC_CTYPE .SUFFIXES: .src .LC_CTYPE @@ -212,12 +215,15 @@ SAME+= lv_LV.ISO8859-13 lt_LT.ISO8859-13 SAME+= ko_KR.eucKR ko_KR.CP949 # legacy (same charset) .endif -FILES= ${LOCALES:S/$/.LC_CTYPE/} +# C.UTF-8 is the default locale, so it should always been installed. +ALWAYS= C.UTF-8.LC_CTYPE +FILES= ${LOCALES:NC.UTF-8:S/$/.LC_CTYPE/} CLEANFILES= ${FILES} .for f t in ${SAME} DIRS+= LOCALEDIR_$t LOCALEDIR_$t= ${LOCALEDIR}/$t +LOCALEDIR_$tPACKAGE= locales SYMLINKS+= ../$f/${FILESNAME} \ ${LOCALEDIR}/$t/${FILESNAME} .endfor @@ -225,6 +231,7 @@ SYMLINKS+= ../$f/${FILESNAME} \ .for f in ${LOCALES} FILESDIR_${f}.LC_CTYPE= ${LOCALEDIR}/${f} .endfor +FILESDIR_C.UTF-8.LC_CTYPEPACKAGE= runtime SYMPAIRS+= zh_CN.eucCN.src zh_CN.GB18030.src SYMPAIRS+= zh_CN.eucCN.src zh_CN.GB2312.src diff --git a/share/monetdef/Makefile b/share/monetdef/Makefile index bec0b78d9433..dd1732bd87c6 100644 --- a/share/monetdef/Makefile +++ b/share/monetdef/Makefile @@ -2,6 +2,7 @@ # Warning: Do not edit. This file is automatically generated from the # tools in /usr/src/tools/tools/locale. +PACKAGE= locales LOCALEDIR= ${SHAREDIR}/locale FILESNAME= LC_MONETARY .SUFFIXES: .src .out @@ -132,6 +133,7 @@ CLEANFILES= ${FILES} .for f t in ${SAME} DIRS+= LOCALEDIR_$t LOCALEDIR_$t= ${LOCALEDIR}/$t +LOCALEDIR_$tPACKAGE= locales SYMLINKS+= ../$f/${FILESNAME} \ ${LOCALEDIR}/$t/${FILESNAME} .endfor diff --git a/share/monetdef_unicode/Makefile b/share/monetdef_unicode/Makefile index 2fa073f3981d..2ab442ad51b4 100644 --- a/share/monetdef_unicode/Makefile +++ b/share/monetdef_unicode/Makefile @@ -2,6 +2,7 @@ # Warning: Do not edit. This file is automatically generated from the # tools in /usr/src/tools/tools/locale. +PACKAGE= locales LOCALEDIR= ${SHAREDIR}/locale FILESNAME= LC_MONETARY .SUFFIXES: .src .out @@ -99,6 +100,7 @@ CLEANFILES= ${FILES} .for f t in ${SAME} DIRS+= LOCALEDIR_$t LOCALEDIR_$t= ${LOCALEDIR}/$t +LOCALEDIR_$tPACKAGE= locales SYMLINKS+= ../$f/${FILESNAME} \ ${LOCALEDIR}/$t/${FILESNAME} .endfor diff --git a/share/msgdef/Makefile b/share/msgdef/Makefile index a176d30c01fc..4cc6a45b46c6 100644 --- a/share/msgdef/Makefile +++ b/share/msgdef/Makefile @@ -1,5 +1,6 @@ # $FreeBSD$ +PACKAGE= locales LOCALEDIR= ${SHAREDIR}/locale FILESNAME= LC_MESSAGES .SUFFIXES: .src .out @@ -125,6 +126,7 @@ CLEANFILES= ${FILES} .for f t in ${SAME} DIRS+= LOCALEDIR_$t LOCALEDIR_$t= ${LOCALEDIR}/$t +LOCALEDIR_$tPACKAGE= locales SYMLINKS+= ../$f/${FILESNAME} \ ${LOCALEDIR}/$t/${FILESNAME} .endfor diff --git a/share/msgdef_unicode/Makefile b/share/msgdef_unicode/Makefile index 34f8b30ff733..608ba8860afb 100644 --- a/share/msgdef_unicode/Makefile +++ b/share/msgdef_unicode/Makefile @@ -2,6 +2,7 @@ # Warning: Do not edit. This file is automatically generated from the # tools in /usr/src/tools/tools/locale. +PACKAGE= locales LOCALEDIR= ${SHAREDIR}/locale FILESNAME= LC_MESSAGES .SUFFIXES: .src .out @@ -99,6 +100,7 @@ CLEANFILES= ${FILES} .for f t in ${SAME} DIRS+= LOCALEDIR_$t LOCALEDIR_$t= ${LOCALEDIR}/$t +LOCALEDIR_$tPACKAGE= locales SYMLINKS+= ../$f/${FILESNAME} \ ${LOCALEDIR}/$t/${FILESNAME} .endfor diff --git a/share/numericdef/Makefile b/share/numericdef/Makefile index da04535aa4c9..90e2551570b5 100644 --- a/share/numericdef/Makefile +++ b/share/numericdef/Makefile @@ -1,5 +1,6 @@ # $FreeBSD$ +PACKAGE= locale LOCALEDIR= ${SHAREDIR}/locale FILESNAME= LC_NUMERIC .SUFFIXES: .src .out @@ -128,6 +129,7 @@ CLEANFILES= ${FILES} .for f t in ${SAME} DIRS+= LOCALEDIR_$t LOCALEDIR_$t= ${LOCALEDIR}/$t +LOCALEDIR_$tPACKAGE= locales SYMLINKS+= ../$f/${FILESNAME} \ ${LOCALEDIR}/$t/${FILESNAME} .endfor diff --git a/share/numericdef_unicode/Makefile b/share/numericdef_unicode/Makefile index 07290250c6b5..6b7af4799efe 100644 --- a/share/numericdef_unicode/Makefile +++ b/share/numericdef_unicode/Makefile @@ -2,6 +2,7 @@ # Warning: Do not edit. This file is automatically generated from the # tools in /usr/src/tools/tools/locale. +PACKAGE= locales LOCALEDIR= ${SHAREDIR}/locale FILESNAME= LC_NUMERIC .SUFFIXES: .src .out @@ -99,6 +100,7 @@ CLEANFILES= ${FILES} .for f t in ${SAME} DIRS+= LOCALEDIR_$t LOCALEDIR_$t= ${LOCALEDIR}/$t +LOCALEDIR_$tPACKAGE= locales SYMLINKS+= ../$f/${FILESNAME} \ ${LOCALEDIR}/$t/${FILESNAME} .endfor diff --git a/share/timedef/Makefile b/share/timedef/Makefile index df16c038ba4c..c33461ff36bd 100644 --- a/share/timedef/Makefile +++ b/share/timedef/Makefile @@ -1,5 +1,6 @@ # $FreeBSD$ +PACKAGE= locales LOCALEDIR= ${SHAREDIR}/locale FILESNAME= LC_TIME .SUFFIXES: .src .out @@ -211,6 +212,7 @@ CLEANFILES= ${FILES} .for f t in ${SAME} DIRS+= LOCALEDIR_$t LOCALEDIR_$t= ${LOCALEDIR}/$t +LOCALEDIR_$tPACKAGE= locales SYMLINKS+= ../$f/${FILESNAME} \ ${LOCALEDIR}/$t/${FILESNAME} .endfor diff --git a/tools/tools/locale/tools/cldr2def.pl b/tools/tools/locale/tools/cldr2def.pl index 78b2634b6250..e65ec30fa6d5 100755 --- a/tools/tools/locale/tools/cldr2def.pl +++ b/tools/tools/locale/tools/cldr2def.pl @@ -952,6 +952,7 @@ sub make_makefile { # Warning: Do not edit. This file is automatically generated from the # tools in /usr/src/tools/tools/locale. +PACKAGE= locales LOCALEDIR= \${SHAREDIR}/locale FILESNAME= $FILESNAMES{$TYPE} .SUFFIXES: .src .${SRCOUT2} @@ -1084,6 +1085,7 @@ CLEANFILES= \${FILES} .for f t in \${SAME} DIRS+= LOCALEDIR_\$t LOCALEDIR_\$t= \${LOCALEDIR}/\$t +LOCALEDIR_\$tPACKAGE= locales SYMLINKS+= ../\$f/\${FILESNAME} \\ \${LOCALEDIR}/\$t/\${FILESNAME} .endfor From owner-dev-commits-src-all@freebsd.org Tue Aug 3 17:00:31 2021 Return-Path: Delivered-To: dev-commits-src-all@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 9F56D63C6EF; Tue, 3 Aug 2021 17:00:31 +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 4GfLjC3hTcz3JWH; Tue, 3 Aug 2021 17:00: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 66DD016DCD; Tue, 3 Aug 2021 17:00: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 173H0VKC059878; Tue, 3 Aug 2021 17:00:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 173H0VOZ059877; Tue, 3 Aug 2021 17:00:31 GMT (envelope-from git) Date: Tue, 3 Aug 2021 17:00:31 GMT Message-Id: <202108031700.173H0VOZ059877@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bryan Drewery Subject: git: 2482ea42fb60 - main - Revert "Fix native-xtools build" MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bdrewery X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2482ea42fb606ae38a2c518f964f57337a4509e4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 17:00:31 -0000 The branch main has been updated by bdrewery: URL: https://cgit.FreeBSD.org/src/commit/?id=2482ea42fb606ae38a2c518f964f57337a4509e4 commit 2482ea42fb606ae38a2c518f964f57337a4509e4 Author: Bryan Drewery AuthorDate: 2021-08-03 16:59:44 +0000 Commit: Bryan Drewery CommitDate: 2021-08-03 17:00:28 +0000 Revert "Fix native-xtools build" This reverts commit 36269b82318280ef184c953b90674f5905e0f53f. This had an unintended change included. --- Makefile | 2 +- Makefile.inc1 | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 711854f4693c..c64873fb241b 100644 --- a/Makefile +++ b/Makefile @@ -218,7 +218,7 @@ _MAKEOBJDIRPREFIX!= /usr/bin/env -i PATH=${PATH} ${MAKE} MK_AUTO_OBJ=no \ ${.MAKEFLAGS:MMAKEOBJDIRPREFIX=*} __MAKE_CONF=${__MAKE_CONF} \ SRCCONF=${SRCCONF} SRC_ENV_CONF= \ -f /dev/null -V MAKEOBJDIRPREFIX dummy -.if !empty(_MAKEOBJDIRPREFIX) +.if !empty(_MAKEOBJDIRPREFIX) || !empty(.MAKEOVERRIDES:MMAKEOBJDIRPREFIX) .error MAKEOBJDIRPREFIX can only be set in environment or src-env.conf(5),\ not as a global (in make.conf(5) or src.conf(5)) or command-line variable. .endif diff --git a/Makefile.inc1 b/Makefile.inc1 index b6843177c10b..e3707c7a504a 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -2739,6 +2739,7 @@ SUBDIR= ${SUBDIR_OVERRIDE} NXBMAKEARGS+= \ OBJTOP=${NXBOBJTOP:Q} \ OBJROOT=${NXBOBJROOT:Q} \ + MAKEOBJDIRPREFIX= \ -DNO_SHARED \ -DNO_CPU_CFLAGS \ -DNO_PIC \ @@ -2762,9 +2763,6 @@ NXBMAKEARGS+= \ MK_WERROR=no \ MK_ZFS=no -NXBMAKEENV+= \ - MAKEOBJDIRPREFIX= - .if make(native-xtools*) && \ (!defined(NXB_TARGET) || !defined(NXB_TARGET_ARCH)) .error Missing NXB_TARGET / NXB_TARGET_ARCH From owner-dev-commits-src-all@freebsd.org Tue Aug 3 17:00:32 2021 Return-Path: Delivered-To: dev-commits-src-all@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 B471D63C3E9; Tue, 3 Aug 2021 17:00: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 4GfLjD4fh7z3J25; Tue, 3 Aug 2021 17:00: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 87F4116DCE; Tue, 3 Aug 2021 17:00: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 173H0WAe059905; Tue, 3 Aug 2021 17:00:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 173H0WpI059904; Tue, 3 Aug 2021 17:00:32 GMT (envelope-from git) Date: Tue, 3 Aug 2021 17:00:32 GMT Message-Id: <202108031700.173H0WpI059904@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bryan Drewery Subject: git: b60770fceb2b - main - Fix native-xtools build MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bdrewery X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b60770fceb2b94efe334221bd13a5e55229babb3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 17:00:32 -0000 The branch main has been updated by bdrewery: URL: https://cgit.FreeBSD.org/src/commit/?id=b60770fceb2b94efe334221bd13a5e55229babb3 commit b60770fceb2b94efe334221bd13a5e55229babb3 Author: Bryan Drewery AuthorDate: 2021-08-03 15:20:57 +0000 Commit: Bryan Drewery CommitDate: 2021-08-03 17:00:28 +0000 Fix native-xtools build Fixes https://github.com/freebsd/poudriere/issues/894 Fixes: d0c737e18 ("Makefile: Fix MAKEOBJDIRPREFIX command-line") X-MFC-With: d0c737e18 --- Makefile.inc1 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index e3707c7a504a..b6843177c10b 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -2739,7 +2739,6 @@ SUBDIR= ${SUBDIR_OVERRIDE} NXBMAKEARGS+= \ OBJTOP=${NXBOBJTOP:Q} \ OBJROOT=${NXBOBJROOT:Q} \ - MAKEOBJDIRPREFIX= \ -DNO_SHARED \ -DNO_CPU_CFLAGS \ -DNO_PIC \ @@ -2763,6 +2762,9 @@ NXBMAKEARGS+= \ MK_WERROR=no \ MK_ZFS=no +NXBMAKEENV+= \ + MAKEOBJDIRPREFIX= + .if make(native-xtools*) && \ (!defined(NXB_TARGET) || !defined(NXB_TARGET_ARCH)) .error Missing NXB_TARGET / NXB_TARGET_ARCH From owner-dev-commits-src-all@freebsd.org Tue Aug 3 17:00:46 2021 Return-Path: Delivered-To: dev-commits-src-all@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 9D77163C6FE; Tue, 3 Aug 2021 17:00:46 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1.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 "freefall.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GfLjV3ptWz3Jg1; Tue, 3 Aug 2021 17:00:46 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1628010046; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=yIEWHk/HgNJM/zJoym1//7stV4hF4rEIasYMH6/NeMU=; b=EhIdkk0JWQmQrXevBtNPOJV8WHGB+01IPsrGz6zajTtXkeuRH3U8/oKdvoKBm7Z/LqlxnJ R5Ay9qMcOC1kZ3c9qw37nE68tnL9h31sJXcYmslWHqpz6hnQKzwJKg/e2v+isiynJAOqfi AhP++gfqurZ4DxDDuJ514+x1+yEoxDOSSo7QCwMvyRavASr4Ibsf2E1wRjtTpEZ3tEhwqX NLZJHQPnyEAANkOqzr7Ag4A5LWTMXHG9eXpTYzZEeBeqNWqVp0Vk9eQsdoBFq1vWXAGvMK FDh0lqLlSdIjKjFLs5oevNnzTvtNb38vZIP9KMvjYCkOFGtGS0+cSTTXre7FLw== Received: from mail.xzibition.com (unknown [127.0.1.132]) (using TLSv1.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 freefall.freebsd.org (Postfix) with ESMTPS id 5215A1089E; Tue, 3 Aug 2021 17:00:46 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [172.31.3.2]) by mail.xzibition.com (Postfix) with ESMTP id 45579309E4; Tue, 3 Aug 2021 17:00:45 +0000 (UTC) X-Virus-Scanned: amavisd-new at mail.xzibition.com Received: from mail.xzibition.com ([172.31.3.2]) by mail.xzibition.com (mail.xzibition.com [172.31.3.2]) (amavisd-new, port 10026) with LMTP id f4iDVh4KWKFb; Tue, 3 Aug 2021 17:00:42 +0000 (UTC) Subject: Re: git: 36269b823182 - main - Fix native-xtools build DKIM-Filter: OpenDKIM Filter v2.10.3 mail.xzibition.com 6686A309D0 To: Jessica Clarke Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" References: <202108031522.173FMHF9030395@gitrepo.freebsd.org> <21EA81CD-0058-4E80-9FAD-424C0ACCD276@freebsd.org> From: Bryan Drewery Organization: FreeBSD Message-ID: <2ea87511-69e8-084a-6148-c4b071346076@FreeBSD.org> Date: Tue, 3 Aug 2021 10:00:39 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: <21EA81CD-0058-4E80-9FAD-424C0ACCD276@freebsd.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="20FTa2FgqScQfgS62zyXj3XzGhrh4KcDu" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1628010046; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=yIEWHk/HgNJM/zJoym1//7stV4hF4rEIasYMH6/NeMU=; b=nf5hzB5VlMl1sLyDsbABVVJwHCTKYmtCzcVM1NvtbFUyCGLp1Lg96NY3NuhWZ0RZZykPrE 1tz8Xn7GBZV+E59jsbXjaBd9MW0JX9ht6hYuwC9ro/aXvq0HJNosDQ12NcWizAxhehMSmc Blgq/BAAZfl5BgAcDbD8Y1Q4FpRUdEyND0oo8OzWxZCgY5idhxiziMH9DBldXIxeAKck4o X7cUtcCtMI13qWtuhEgl9uupRTJAJU4Z0JaGluNgO4VkiUfzuCnFoj8bqjHXGgwvf74/fg UkgupK/PoI78PSHZGJjNnikHlsKBginf7sK3SlRI9/luvCypjyprYRB6fo6JLQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1628010046; a=rsa-sha256; cv=none; b=LgT8G4uRc9g/VQs0XPBnsksf/AJK8IisKB/Zpu0ZoYHbr/xl70HgRg3zceLE4Y3AxRI2x8 w77/F9zMD8dQI9atP70sbFYM0bvNpBGf4bmtfHnZkmvEVA37DKTsQZuXmmtWQXv+LAusO4 d1JHBYVzZRoX9xW98xp1FG7HH5wZkuDozkZBGinBmFEpPG8tObcWV+wRH8kHthppRPMok1 PR4QJsBSyVuC6SLrXMAm9U8nLWwXoPDBjDYFHLNV6jVDURRocPH3bLVzHgupE0KDhvPy0u PGE4AXsMXc29yMdjHAIh51YvcbEw3nGDW6SatuEarc3ZcDOqwVIjvkyO0DS5Og== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 17:00:46 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --20FTa2FgqScQfgS62zyXj3XzGhrh4KcDu Content-Type: multipart/mixed; boundary="ReUHfC152P2qIWeljJMTM3LgYXMgOUAbe"; protected-headers="v1" From: Bryan Drewery To: Jessica Clarke Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Message-ID: <2ea87511-69e8-084a-6148-c4b071346076@FreeBSD.org> Subject: Re: git: 36269b823182 - main - Fix native-xtools build References: <202108031522.173FMHF9030395@gitrepo.freebsd.org> <21EA81CD-0058-4E80-9FAD-424C0ACCD276@freebsd.org> In-Reply-To: <21EA81CD-0058-4E80-9FAD-424C0ACCD276@freebsd.org> --ReUHfC152P2qIWeljJMTM3LgYXMgOUAbe Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 8/3/2021 8:26 AM, Jessica Clarke wrote: > On 3 Aug 2021, at 16:22, Bryan Drewery wrote: >> >> The branch main has been updated by bdrewery: >> >> URL: https://cgit.FreeBSD.org/src/commit/?id=3D36269b82318280ef184c953= b90674f5905e0f53f >> >> commit 36269b82318280ef184c953b90674f5905e0f53f >> Author: Bryan Drewery >> AuthorDate: 2021-08-03 15:20:57 +0000 >> Commit: Bryan Drewery >> CommitDate: 2021-08-03 15:22:14 +0000 >> >> Fix native-xtools build >> >> Fixes https://github.com/freebsd/poudriere/issues/894 >> Fixes: d0c737e18 ("Makefile: Fix MAKEOBJDIRPREFIX command-= line") >> X-MFC-With: d0c737e18 >> --- >> Makefile | 2 +- >> Makefile.inc1 | 4 +++- >> 2 files changed, 4 insertions(+), 2 deletions(-) >> >> diff --git a/Makefile b/Makefile >> index c64873fb241b..711854f4693c 100644 >> --- a/Makefile >> +++ b/Makefile >> @@ -218,7 +218,7 @@ _MAKEOBJDIRPREFIX!=3D /usr/bin/env -i PATH=3D${PAT= H} ${MAKE} MK_AUTO_OBJ=3Dno \ >> ${.MAKEFLAGS:MMAKEOBJDIRPREFIX=3D*} __MAKE_CONF=3D${__MAKE_CONF} \= >> SRCCONF=3D${SRCCONF} SRC_ENV_CONF=3D \ >> -f /dev/null -V MAKEOBJDIRPREFIX dummy >> -.if !empty(_MAKEOBJDIRPREFIX) || !empty(.MAKEOVERRIDES:MMAKEOBJDIRPRE= FIX) >> +.if !empty(_MAKEOBJDIRPREFIX) >=20 > Why was this reverted? This restores the bug I was fixing. Does your > change below not fix the actual issue you were seeing? >=20 Sorry! This was not meant to be removed. It was just a mishap from testin= g. I reverted it and pushed the proper fix just now. > Jess >=20 >> .error MAKEOBJDIRPREFIX can only be set in environment or src-env.conf= (5),\ >> not as a global (in make.conf(5) or src.conf(5)) or command-line v= ariable. >> .endif >> diff --git a/Makefile.inc1 b/Makefile.inc1 >> index e3707c7a504a..b6843177c10b 100644 >> --- a/Makefile.inc1 >> +++ b/Makefile.inc1 >> @@ -2739,7 +2739,6 @@ SUBDIR=3D ${SUBDIR_OVERRIDE} >> NXBMAKEARGS+=3D \ >> OBJTOP=3D${NXBOBJTOP:Q} \ >> OBJROOT=3D${NXBOBJROOT:Q} \ >> - MAKEOBJDIRPREFIX=3D \ >> -DNO_SHARED \ >> -DNO_CPU_CFLAGS \ >> -DNO_PIC \ >> @@ -2763,6 +2762,9 @@ NXBMAKEARGS+=3D \ >> MK_WERROR=3Dno \ >> MK_ZFS=3Dno >> >> +NXBMAKEENV+=3D \ >> + MAKEOBJDIRPREFIX=3D >> + >> .if make(native-xtools*) && \ >> (!defined(NXB_TARGET) || !defined(NXB_TARGET_ARCH)) >> .error Missing NXB_TARGET / NXB_TARGET_ARCH >=20 --=20 Regards, Bryan Drewery --ReUHfC152P2qIWeljJMTM3LgYXMgOUAbe-- --20FTa2FgqScQfgS62zyXj3XzGhrh4KcDu Content-Type: application/pgp-signature; name="OpenPGP_signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="OpenPGP_signature" -----BEGIN PGP SIGNATURE----- wsB5BAABCAAjFiEE+Rc8ssOq6npcih8JNddxu25Gl88FAmEJdjcFAwAAAAAACgkQNddxu25Gl89x 5wgArHRmE7H3hQPn6JKvJCKWy2N572dZiWZClyOv45T7eZq3YmeQg9BVNiaxrMRWVwKzS4JF/lI9 djTfDRUZMqdLlaRWvsSiZQXrA+thpQMgWUzH36yR2W0UMuqxMscoZh8aoRoVNgQL1axanFi9giWT KpMzXLVS77IMeYbR+FyNdZfrNQAjxc/gTO9xNQRR4VubEx0PKT54xlFrUEzSWl5uhxApcKE+AU5Q Jw8vZf7nPH8FA+kkKe0PtHgREPnEAAP4fciJpemf9DGMGorbuVc+1VKAADrcAXuvmppkve62QCYQ 9VPOw8QgpX11XTk5RE3anzxNkJqhZg194CNo2auFoA== =qa3z -----END PGP SIGNATURE----- --20FTa2FgqScQfgS62zyXj3XzGhrh4KcDu-- From owner-dev-commits-src-all@freebsd.org Tue Aug 3 17:32:13 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C303863D4C5 for ; Tue, 3 Aug 2021 17:32:13 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (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 4GfMPm6RJnz3MBG for ; Tue, 3 Aug 2021 17:32:12 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wm1-f44.google.com with SMTP id m20-20020a05600c4f54b029024e75a15716so2592562wmq.2 for ; Tue, 03 Aug 2021 10:32:12 -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=dpfcn/hTtKIb5g3S4tkUG5cGk+DGMyr0/pkUUcCT5Lw=; b=YJ2PmQv2DtkFggYGfNoFiiqxGcdZhbY/G/X3m3d3nkeK/Py3gdvhgG29rsvT+Nw6lX /nfMEqrjTTR/XkwC81QszeyKe6ISoSNMXXH4ZDYIG6jeW11gAI8NJNUEIZr0QVpXQVuL W9nznxzKyE0DcPzSGK/tiHBdfeJ2DpdL8jPLIp8njS7YsHwtnAsh9jCnl3LiwvVED7mL YmQCaNa6oR4mLNujYgSDFJbyYWiuh35qJ58Cc5ijuvycgZKpWm+yQtmGf5MYaAQ8IfIP QtRlAzSwcac2puo4Sjkfsvzxjo9UrG3yAi5EmwzELid6Zbnoj9r+HRV1UUGOVIsmHZL0 W71A== X-Gm-Message-State: AOAM530jlfKy0QM5JHFdrr08RsI1Q11RMI9DE3VLVrHIIceB0SxIeRct eGJ1N8gRV7DGOGJebozllMdpPA== X-Google-Smtp-Source: ABdhPJywWvp2p9IJg11+NH1QTKehK/Hr8u5XdcNj0C1G4x5Mc/Vgu7Q959eJmTDL+32vY2BxPkIq+g== X-Received: by 2002:a1c:7c10:: with SMTP id x16mr23187271wmc.41.1628011925941; Tue, 03 Aug 2021 10:32:05 -0700 (PDT) Received: from smtpclient.apple (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id x18sm7895924wmc.17.2021.08.03.10.32.05 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Aug 2021 10:32:05 -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: 36269b823182 - main - Fix native-xtools build From: Jessica Clarke In-Reply-To: <2ea87511-69e8-084a-6148-c4b071346076@FreeBSD.org> Date: Tue, 3 Aug 2021 18:32:05 +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: <60B4BA12-B543-4FCE-AA8C-05BF461A1F13@freebsd.org> References: <202108031522.173FMHF9030395@gitrepo.freebsd.org> <21EA81CD-0058-4E80-9FAD-424C0ACCD276@freebsd.org> <2ea87511-69e8-084a-6148-c4b071346076@FreeBSD.org> To: Bryan Drewery X-Mailer: Apple Mail (2.3654.100.0.2.22) X-Rspamd-Queue-Id: 4GfMPm6RJnz3MBG 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.128.44 as permitted sender) smtp.mailfrom=jrtc27@jrtc27.com X-Spamd-Result: default: False [-2.49 / 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.99)[-0.987]; 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)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FREEFALL_USER(0.00)[jrtc27]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[dev-commits-src-all@freebsd.org]; DMARC_NA(0.00)[freebsd.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[209.85.128.44:from,131.111.193.104:received]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.85.128.44:from]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[dev-commits-src-all] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 17:32:13 -0000 On 3 Aug 2021, at 18:00, Bryan Drewery wrote: >=20 > On 8/3/2021 8:26 AM, Jessica Clarke wrote: >> On 3 Aug 2021, at 16:22, Bryan Drewery wrote: >>>=20 >>> The branch main has been updated by bdrewery: >>>=20 >>> URL: = https://cgit.FreeBSD.org/src/commit/?id=3D36269b82318280ef184c953b90674f59= 05e0f53f >>>=20 >>> commit 36269b82318280ef184c953b90674f5905e0f53f >>> Author: Bryan Drewery >>> AuthorDate: 2021-08-03 15:20:57 +0000 >>> Commit: Bryan Drewery >>> CommitDate: 2021-08-03 15:22:14 +0000 >>>=20 >>> Fix native-xtools build >>>=20 >>> Fixes https://github.com/freebsd/poudriere/issues/894 >>> Fixes: d0c737e18 ("Makefile: Fix MAKEOBJDIRPREFIX = command-line") >>> X-MFC-With: d0c737e18 >>> --- >>> Makefile | 2 +- >>> Makefile.inc1 | 4 +++- >>> 2 files changed, 4 insertions(+), 2 deletions(-) >>>=20 >>> diff --git a/Makefile b/Makefile >>> index c64873fb241b..711854f4693c 100644 >>> --- a/Makefile >>> +++ b/Makefile >>> @@ -218,7 +218,7 @@ _MAKEOBJDIRPREFIX!=3D /usr/bin/env -i = PATH=3D${PATH} ${MAKE} MK_AUTO_OBJ=3Dno \ >>> ${.MAKEFLAGS:MMAKEOBJDIRPREFIX=3D*} __MAKE_CONF=3D${__MAKE_CONF} = \ >>> SRCCONF=3D${SRCCONF} SRC_ENV_CONF=3D \ >>> -f /dev/null -V MAKEOBJDIRPREFIX dummy >>> -.if !empty(_MAKEOBJDIRPREFIX) || = !empty(.MAKEOVERRIDES:MMAKEOBJDIRPREFIX) >>> +.if !empty(_MAKEOBJDIRPREFIX) >>=20 >> Why was this reverted? This restores the bug I was fixing. Does your >> change below not fix the actual issue you were seeing? >>=20 >=20 > Sorry! This was not meant to be removed. It was just a mishap from = testing. >=20 > I reverted it and pushed the proper fix just now. Thanks, glad my understanding was correct. I=E2=80=99ll give my commit = longer to bake before MFC=E2=80=99ing with this one to see if any other = regressions pop up. Jess From owner-dev-commits-src-all@freebsd.org Tue Aug 3 17:32:41 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C956563D35F; Tue, 3 Aug 2021 17:32:41 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4GfMQK0yb1z3M24; Tue, 3 Aug 2021 17:32:40 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id 173HWXaw049196; Tue, 3 Aug 2021 10:32:33 -0700 (PDT) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id 173HWXr9049195; Tue, 3 Aug 2021 10:32:33 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <202108031732.173HWXr9049195@gndrsh.dnsmgr.net> Subject: Re: git: 184d64af1344 - main - locales: stop hardcoding the directories in the mtree In-Reply-To: <202108031227.173CR1qN084657@gitrepo.freebsd.org> To: Baptiste Daroussin Date: Tue, 3 Aug 2021 10:32:33 -0700 (PDT) CC: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 4GfMQK0yb1z3M24 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 17:32:41 -0000 > The branch main has been updated by bapt: > > URL: https://cgit.FreeBSD.org/src/commit/?id=184d64af1344d6f3c370499510cede49320f4863 > > commit 184d64af1344d6f3c370499510cede49320f4863 > Author: Baptiste Daroussin > AuthorDate: 2021-08-03 12:25:00 +0000 > Commit: Baptiste Daroussin > CommitDate: 2021-08-03 12:25:00 +0000 > > locales: stop hardcoding the directories in the mtree > > The framework knows how to create directories and tag them properly > for a the creation of a mtree, not need to hardcode all the locales > entries in bsd.usr.mk > > This simplifies addition of new locales but also allow people building > with WITHOUT_LOCALES to end up with a directory full of empty files The uses of /etc/mtree go beyond the simple directory creation, please cause something to build a BSD.locale.dist file and install it in /etc/mtree to replace the functionality removal you have just performed. Thanks, Rod > --- > etc/mtree/BSD.usr.dist | 383 ----------------------------------- > share/colldef/Makefile | 2 + > share/colldef_unicode/Makefile | 2 + > share/ctypedef/Makefile | 2 + > share/monetdef/Makefile | 2 + > share/monetdef_unicode/Makefile | 2 + > share/msgdef/Makefile | 2 + > share/msgdef_unicode/Makefile | 2 + > share/numericdef/Makefile | 2 + > share/numericdef_unicode/Makefile | 2 + > share/timedef/Makefile | 2 + > tools/tools/locale/tools/cldr2def.pl | 2 + > 12 files changed, 22 insertions(+), 383 deletions(-) > > diff --git a/etc/mtree/BSD.usr.dist b/etc/mtree/BSD.usr.dist > index 97d17cedb5a1..c96ec1ea5fb5 100644 > --- a/etc/mtree/BSD.usr.dist > +++ b/etc/mtree/BSD.usr.dist > @@ -465,389 +465,6 @@ > .. > .. > locale > - af_ZA.ISO8859-1 > - .. > - af_ZA.ISO8859-15 > - .. > - af_ZA.UTF-8 > - .. > - ar_AE.UTF-8 > - .. > - ar_EG.UTF-8 > - .. > - ar_JO.UTF-8 > - .. > - ar_MA.UTF-8 > - .. > - ar_QA.UTF-8 > - .. > - ar_SA.UTF-8 > - .. > - am_ET.UTF-8 > - .. > - be_BY.CP1131 > - .. > - be_BY.CP1251 > - .. > - be_BY.ISO8859-5 > - .. > - be_BY.UTF-8 > - .. > - bg_BG.CP1251 > - .. > - bg_BG.UTF-8 > - .. > - ca_AD.ISO8859-1 > - .. > - ca_AD.ISO8859-15 > - .. > - ca_ES.ISO8859-1 > - .. > - ca_ES.ISO8859-15 > - .. > - ca_FR.ISO8859-1 > - .. > - ca_FR.ISO8859-15 > - .. > - ca_IT.ISO8859-1 > - .. > - ca_IT.ISO8859-15 > - .. > - ca_AD.UTF-8 > - .. > - ca_ES.UTF-8 > - .. > - ca_FR.UTF-8 > - .. > - ca_IT.UTF-8 > - .. > - cs_CZ.ISO8859-2 > - .. > - cs_CZ.UTF-8 > - .. > - da_DK.ISO8859-1 > - .. > - da_DK.ISO8859-15 > - .. > - da_DK.UTF-8 > - .. > - de_AT.ISO8859-1 > - .. > - de_AT.ISO8859-15 > - .. > - de_AT.UTF-8 > - .. > - de_CH.ISO8859-1 > - .. > - de_CH.ISO8859-15 > - .. > - de_CH.UTF-8 > - .. > - de_DE.ISO8859-1 > - .. > - de_DE.ISO8859-15 > - .. > - de_DE.UTF-8 > - .. > - el_GR.ISO8859-7 > - .. > - el_GR.UTF-8 > - .. > - en_AU.ISO8859-1 > - .. > - en_AU.ISO8859-15 > - .. > - en_AU.US-ASCII > - .. > - en_AU.UTF-8 > - .. > - en_CA.ISO8859-1 > - .. > - en_CA.ISO8859-15 > - .. > - en_CA.US-ASCII > - .. > - en_CA.UTF-8 > - .. > - en_GB.ISO8859-1 > - .. > - en_GB.ISO8859-15 > - .. > - en_GB.US-ASCII > - .. > - en_GB.UTF-8 > - .. > - en_HK.ISO8859-1 > - .. > - en_HK.UTF-8 > - .. > - en_IE.ISO8859-1 > - .. > - en_IE.ISO8859-15 > - .. > - en_IE.UTF-8 > - .. > - en_NZ.ISO8859-1 > - .. > - en_NZ.ISO8859-15 > - .. > - en_NZ.US-ASCII > - .. > - en_NZ.UTF-8 > - .. > - en_PH.UTF-8 > - .. > - en_SG.ISO8859-1 > - .. > - en_SG.UTF-8 > - .. > - en_US.ISO8859-1 > - .. > - en_US.ISO8859-15 > - .. > - en_US.US-ASCII > - .. > - en_US.UTF-8 > - .. > - en_ZA.ISO8859-1 > - .. > - en_ZA.ISO8859-15 > - .. > - en_ZA.US-ASCII > - .. > - en_ZA.UTF-8 > - .. > - es_AR.ISO8859-1 > - .. > - es_AR.UTF-8 > - .. > - es_CR.UTF-8 > - .. > - es_ES.ISO8859-1 > - .. > - es_ES.ISO8859-15 > - .. > - es_ES.UTF-8 > - .. > - es_MX.ISO8859-1 > - .. > - es_MX.UTF-8 > - .. > - et_EE.ISO8859-1 > - .. > - et_EE.ISO8859-15 > - .. > - et_EE.UTF-8 > - .. > - eu_ES.ISO8859-1 > - .. > - eu_ES.ISO8859-15 > - .. > - eu_ES.UTF-8 > - .. > - fi_FI.ISO8859-1 > - .. > - fi_FI.ISO8859-15 > - .. > - fi_FI.UTF-8 > - .. > - fr_BE.ISO8859-1 > - .. > - fr_BE.ISO8859-15 > - .. > - fr_BE.UTF-8 > - .. > - fr_CA.ISO8859-1 > - .. > - fr_CA.ISO8859-15 > - .. > - fr_CA.UTF-8 > - .. > - fr_CH.ISO8859-1 > - .. > - fr_CH.ISO8859-15 > - .. > - fr_CH.UTF-8 > - .. > - fr_FR.ISO8859-1 > - .. > - fr_FR.ISO8859-15 > - .. > - fr_FR.UTF-8 > - .. > - ga_IE.UTF-8 > - .. > - he_IL.UTF-8 > - .. > - hi_IN.ISCII-DEV > - .. > - hi_IN.UTF-8 > - .. > - hr_HR.ISO8859-2 > - .. > - hr_HR.UTF-8 > - .. > - hu_HU.ISO8859-2 > - .. > - hu_HU.UTF-8 > - .. > - hy_AM.ARMSCII-8 > - .. > - hy_AM.UTF-8 > - .. > - is_IS.ISO8859-1 > - .. > - is_IS.ISO8859-15 > - .. > - is_IS.UTF-8 > - .. > - it_CH.ISO8859-1 > - .. > - it_CH.ISO8859-15 > - .. > - it_CH.UTF-8 > - .. > - it_IT.ISO8859-1 > - .. > - it_IT.ISO8859-15 > - .. > - it_IT.UTF-8 > - .. > - ja_JP.SJIS > - .. > - ja_JP.UTF-8 > - .. > - ja_JP.eucJP > - .. > - kk_KZ.UTF-8 > - .. > - ko_KR.CP949 > - .. > - ko_KR.UTF-8 > - .. > - ko_KR.eucKR > - .. > - lt_LT.ISO8859-13 > - .. > - lt_LT.UTF-8 > - .. > - lv_LV.ISO8859-13 > - .. > - lv_LV.UTF-8 > - .. > - mn_MN.UTF-8 > - .. > - nb_NO.ISO8859-1 > - .. > - nb_NO.ISO8859-15 > - .. > - nb_NO.UTF-8 > - .. > - nl_BE.ISO8859-1 > - .. > - nl_BE.ISO8859-15 > - .. > - nl_BE.UTF-8 > - .. > - nl_NL.ISO8859-1 > - .. > - nl_NL.ISO8859-15 > - .. > - nl_NL.UTF-8 > - .. > - nn_NO.ISO8859-1 > - .. > - nn_NO.ISO8859-15 > - .. > - nn_NO.UTF-8 > - .. > - pl_PL.ISO8859-2 > - .. > - pl_PL.UTF-8 > - .. > - pt_BR.ISO8859-1 > - .. > - pt_BR.UTF-8 > - .. > - pt_PT.ISO8859-1 > - .. > - pt_PT.ISO8859-15 > - .. > - pt_PT.UTF-8 > - .. > - ro_RO.ISO8859-2 > - .. > - ro_RO.UTF-8 > - .. > - ru_RU.CP1251 > - .. > - ru_RU.CP866 > - .. > - ru_RU.ISO8859-5 > - .. > - ru_RU.KOI8-R > - .. > - ru_RU.UTF-8 > - .. > - se_FI.UTF-8 > - .. > - se_NO.UTF-8 > - .. > - sk_SK.ISO8859-2 > - .. > - sk_SK.UTF-8 > - .. > - sl_SI.ISO8859-2 > - .. > - sl_SI.UTF-8 > - .. > - sr_RS.ISO8859-5 > - .. > - sr_RS.UTF-8 > - .. > - sr_RS.ISO8859-2 > - .. > - sr_RS.UTF-8@latin > - .. > - sv_FI.ISO8859-1 > - .. > - sv_FI.ISO8859-15 > - .. > - sv_FI.UTF-8 > - .. > - sv_SE.ISO8859-1 > - .. > - sv_SE.ISO8859-15 > - .. > - sv_SE.UTF-8 > - .. > - tr_TR.ISO8859-9 > - .. > - tr_TR.UTF-8 > - .. > - uk_UA.CP1251 > - .. > - uk_UA.ISO8859-5 > - .. > - uk_UA.KOI8-U > - .. > - uk_UA.UTF-8 > - .. > - zh_CN.GB18030 > - .. > - zh_CN.GB2312 > - .. > - zh_CN.GBK > - .. > - zh_CN.eucCN > - .. > - zh_CN.UTF-8 > - .. > - zh_HK.UTF-8 > - .. > - zh_TW.Big5 > - .. > - zh_TW.UTF-8 > .. > .. > man > diff --git a/share/colldef/Makefile b/share/colldef/Makefile > index 89454f84a5e4..15e84179c768 100644 > --- a/share/colldef/Makefile > +++ b/share/colldef/Makefile > @@ -133,7 +133,9 @@ SAME+= ko_KR.eucKR ko_KR.CP949 # legacy (same charset) > FILES= ${LOCALES:S/$/.LC_COLLATE/} > CLEANFILES= ${FILES} > > +DIRS+= SAMEDIRS > .for f t in ${SAME} > +SAMEDIRS+= ${LOCALEDIR}/$t > SYMLINKS+= ../$f/${FILESNAME} \ > ${LOCALEDIR}/$t/${FILESNAME} > .endfor > diff --git a/share/colldef_unicode/Makefile b/share/colldef_unicode/Makefile > index e84d952a1316..4dd4bf78a36f 100644 > --- a/share/colldef_unicode/Makefile > +++ b/share/colldef_unicode/Makefile > @@ -104,7 +104,9 @@ SAME+= zh_TW.UTF-8 zh_HK.UTF-8 > FILES= ${LOCALES:S/$/.LC_COLLATE/} > CLEANFILES= ${FILES} > > +DIRS+= SAMEDIRS > .for f t in ${SAME} > +SAMEDIRS+= ${LOCALEDIR}/$t > SYMLINKS+= ../$f/${FILESNAME} \ > ${LOCALEDIR}/$t/${FILESNAME} > .endfor > diff --git a/share/ctypedef/Makefile b/share/ctypedef/Makefile > index da580d72c32f..ad7eb237f3eb 100644 > --- a/share/ctypedef/Makefile > +++ b/share/ctypedef/Makefile > @@ -215,7 +215,9 @@ SAME+= ko_KR.eucKR ko_KR.CP949 # legacy (same charset) > FILES= ${LOCALES:S/$/.LC_CTYPE/} > CLEANFILES= ${FILES} > > +DIRS+= SAMEDIRS > .for f t in ${SAME} > +SAMEDIRS+= ${LOCALEDIR}/$t > SYMLINKS+= ../$f/${FILESNAME} \ > ${LOCALEDIR}/$t/${FILESNAME} > .endfor > diff --git a/share/monetdef/Makefile b/share/monetdef/Makefile > index e5d861da468d..f0b34998f4bd 100644 > --- a/share/monetdef/Makefile > +++ b/share/monetdef/Makefile > @@ -129,7 +129,9 @@ SAME+= ko_KR.eucKR ko_KR.CP949 # legacy (same charset) > FILES= ${LOCALES:S/$/.out/} > CLEANFILES= ${FILES} > > +DIRS+= SAMEDIRS > .for f t in ${SAME} > +SAMEDIRS+= ${LOCALEDIR}/$t > SYMLINKS+= ../$f/${FILESNAME} \ > ${LOCALEDIR}/$t/${FILESNAME} > .endfor > diff --git a/share/monetdef_unicode/Makefile b/share/monetdef_unicode/Makefile > index 6eaab4f0ad94..4655c742669b 100644 > --- a/share/monetdef_unicode/Makefile > +++ b/share/monetdef_unicode/Makefile > @@ -96,7 +96,9 @@ SAME+= sr_RS.UTF-8@latin sr_RS.UTF-8 > FILES= ${LOCALES:S/$/.out/} > CLEANFILES= ${FILES} > > +DIRS+= SAMEDIRS > .for f t in ${SAME} > +SAMEDIRS+= ${LOCALEDIR}/$t > SYMLINKS+= ../$f/${FILESNAME} \ > ${LOCALEDIR}/$t/${FILESNAME} > .endfor > diff --git a/share/msgdef/Makefile b/share/msgdef/Makefile > index 44f1ca316953..9f0b7f2f3bcf 100644 > --- a/share/msgdef/Makefile > +++ b/share/msgdef/Makefile > @@ -122,7 +122,9 @@ SAME+= ko_KR.eucKR ko_KR.CP949 # legacy (same charset) > FILES= ${LOCALES:S/$/.out/} > CLEANFILES= ${FILES} > > +DIRS+= SAMEDIRS > .for f t in ${SAME} > +SAMEDIRS+= ${LOCALEDIR}/$t > SYMLINKS+= ../$f/${FILESNAME} \ > ${LOCALEDIR}/$t/${FILESNAME} > .endfor > diff --git a/share/msgdef_unicode/Makefile b/share/msgdef_unicode/Makefile > index 3f14010b9fa8..c0bffc05ccc6 100644 > --- a/share/msgdef_unicode/Makefile > +++ b/share/msgdef_unicode/Makefile > @@ -96,7 +96,9 @@ SAME+= zh_TW.UTF-8 zh_HK.UTF-8 > FILES= ${LOCALES:S/$/.out/} > CLEANFILES= ${FILES} > > +DIRS+= SAMEDIRS > .for f t in ${SAME} > +SAMEDIRS+= ${LOCALEDIR}/$t > SYMLINKS+= ../$f/${FILESNAME} \ > ${LOCALEDIR}/$t/${FILESNAME} > .endfor > diff --git a/share/numericdef/Makefile b/share/numericdef/Makefile > index 1742dd724d1c..f1047e9cb5d3 100644 > --- a/share/numericdef/Makefile > +++ b/share/numericdef/Makefile > @@ -125,7 +125,9 @@ SAME+= ko_KR.eucKR ko_KR.CP949 # legacy (same charset) > FILES= ${LOCALES:S/$/.out/} > CLEANFILES= ${FILES} > > +DIRS+= SAMEDIRS > .for f t in ${SAME} > +SAMEDIRS+= ${LOCALEDIR}/$t > SYMLINKS+= ../$f/${FILESNAME} \ > ${LOCALEDIR}/$t/${FILESNAME} > .endfor > diff --git a/share/numericdef_unicode/Makefile b/share/numericdef_unicode/Makefile > index c7568a4177fb..3f7f3e4f285e 100644 > --- a/share/numericdef_unicode/Makefile > +++ b/share/numericdef_unicode/Makefile > @@ -96,7 +96,9 @@ SAME+= fr_FR.UTF-8 fr_BE.UTF-8 > FILES= ${LOCALES:S/$/.out/} > CLEANFILES= ${FILES} > > +DIRS+= SAMEDIRS > .for f t in ${SAME} > +SAMEDIRS+= ${LOCALEDIR}/$t > SYMLINKS+= ../$f/${FILESNAME} \ > ${LOCALEDIR}/$t/${FILESNAME} > .endfor > diff --git a/share/timedef/Makefile b/share/timedef/Makefile > index 042f2f0e36f0..428e8067ae18 100644 > --- a/share/timedef/Makefile > +++ b/share/timedef/Makefile > @@ -208,7 +208,9 @@ SAME+= ko_KR.eucKR ko_KR.CP949 # legacy (same charset) > FILES= ${LOCALES:S/$/.out/} > CLEANFILES= ${FILES} > > +DIRS+= SAMEDIRS > .for f t in ${SAME} > +SAMEDIRS+= ${LOCALEDIR}/$t > SYMLINKS+= ../$f/${FILESNAME} \ > ${LOCALEDIR}/$t/${FILESNAME} > .endfor > diff --git a/tools/tools/locale/tools/cldr2def.pl b/tools/tools/locale/tools/cldr2def.pl > index 70e0bdad525b..277102d60a49 100755 > --- a/tools/tools/locale/tools/cldr2def.pl > +++ b/tools/tools/locale/tools/cldr2def.pl > @@ -1081,7 +1081,9 @@ EOF > FILES= \${LOCALES:S/\$/.${SRCOUT2}/} > CLEANFILES= \${FILES} > > +DIRS+= SAMEDIRS > .for f t in \${SAME} > +SAMEDIRS+= \${LOCALEDIR}/\$t > SYMLINKS+= ../\$f/\${FILESNAME} \\ > \${LOCALEDIR}/\$t/\${FILESNAME} > .endfor > -- Rod Grimes rgrimes@freebsd.org From owner-dev-commits-src-all@freebsd.org Tue Aug 3 18:19:41 2021 Return-Path: Delivered-To: dev-commits-src-all@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 7BCB263DADD; Tue, 3 Aug 2021 18: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 4GfNSY33tbz3QJW; Tue, 3 Aug 2021 18: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 5141B180B4; Tue, 3 Aug 2021 18: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 173IJfoe060447; Tue, 3 Aug 2021 18: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 173IJfkv060446; Tue, 3 Aug 2021 18:19:41 GMT (envelope-from git) Date: Tue, 3 Aug 2021 18:19:41 GMT Message-Id: <202108031819.173IJfkv060446@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: 2d319ebe5c08 - main - Style 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: 2d319ebe5c08f3454c4e76564b88fb921f008185 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 18:19:41 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=2d319ebe5c08f3454c4e76564b88fb921f008185 commit 2d319ebe5c08f3454c4e76564b88fb921f008185 Author: Konstantin Belousov AuthorDate: 2021-08-02 21:05:11 +0000 Commit: Konstantin Belousov CommitDate: 2021-08-03 18:19:32 +0000 Style Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31378 --- lib/libc/include/compat.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libc/include/compat.h b/lib/libc/include/compat.h index 72823366c33a..ccb92c0fd930 100644 --- a/lib/libc/include/compat.h +++ b/lib/libc/include/compat.h @@ -37,7 +37,7 @@ #ifndef __LIBC_COMPAT_H__ #define __LIBC_COMPAT_H__ -#define __sym_compat(sym,impl,verid) \ +#define __sym_compat(sym, impl, verid) \ .symver impl, sym@verid #ifndef NO_COMPAT7 @@ -74,7 +74,7 @@ __sym_compat(kevent, freebsd11_kevent, FBSD_1.0); #define __weak_reference(sym,alias) \ .weak alias;.equ alias,sym -__weak_reference(__sys_fcntl,__fcntl_compat) +__weak_reference(__sys_fcntl, __fcntl_compat) #undef __weak_reference From owner-dev-commits-src-all@freebsd.org Tue Aug 3 18:19:42 2021 Return-Path: Delivered-To: dev-commits-src-all@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 AD36D63DDBB; Tue, 3 Aug 2021 18:19: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 4GfNSZ45ktz3QMZ; Tue, 3 Aug 2021 18:19: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 73AE9180B5; Tue, 3 Aug 2021 18:19: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 173IJgle060471; Tue, 3 Aug 2021 18:19:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 173IJgPB060470; Tue, 3 Aug 2021 18:19:42 GMT (envelope-from git) Date: Tue, 3 Aug 2021 18:19:42 GMT Message-Id: <202108031819.173IJgPB060470@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: 49ad342cc10c - main - Add _Fork() 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: 49ad342cc10cba14b3a40ba26cf8bb2150e2925a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 18:19:42 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=49ad342cc10cba14b3a40ba26cf8bb2150e2925a commit 49ad342cc10cba14b3a40ba26cf8bb2150e2925a Author: Konstantin Belousov AuthorDate: 2021-08-02 09:50:32 +0000 Commit: Konstantin Belousov CommitDate: 2021-08-03 18:19:32 +0000 Add _Fork() Current POSIX standard requires fork() to be async-signal safe. Neither our implementation, nor implementations in other operating systems are, and practically it is impossible to make fork() async-signal safe without too much efforts. Also, that would put undue requirement that all atfork handlers should be async-signal safe as well, which contradicts its main use. As result, Austin Group dropped the requirement, and added a new function _Fork() that should be async-signal safe, but it does not call atfork handlers. Basically, _Fork() can be implemented as a raw syscall. Release of glibc 2.34 added _Fork(), do the same for FreeBSD. Clarify threading behavior for fork() in the manpage. Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D31378 --- include/unistd.h | 1 + lib/libc/sys/Makefile.inc | 1 + lib/libc/sys/Symbol.map | 4 +++ lib/libc/sys/_Fork.c | 45 +++++++++++++++++++++++++++ lib/libc/sys/fork.2 | 78 ++++++++++++++++++++++++++++++++++++++++++++--- 5 files changed, 125 insertions(+), 4 deletions(-) diff --git a/include/unistd.h b/include/unistd.h index 9fa9bebbc4c0..5f358ad72d9a 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -586,6 +586,7 @@ int undelete(const char *); int unwhiteout(const char *); void *valloc(size_t); /* obsoleted by malloc() */ int funlinkat(int, const char *, int, int); +pid_t _Fork(void); #ifndef _OPTRESET_DECLARED #define _OPTRESET_DECLARED diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc index 9a417f4a7c74..a1eb9567a380 100644 --- a/lib/libc/sys/Makefile.inc +++ b/lib/libc/sys/Makefile.inc @@ -49,6 +49,7 @@ SRCS+= closefrom.c SRCS+= pipe.c SRCS+= shm_open.c SRCS+= vadvise.c +SRCS+= _Fork.c SRCS+= compat-stub.c diff --git a/lib/libc/sys/Symbol.map b/lib/libc/sys/Symbol.map index 0044c06fd639..80bb2c236191 100644 --- a/lib/libc/sys/Symbol.map +++ b/lib/libc/sys/Symbol.map @@ -417,6 +417,10 @@ FBSD_1.6 { shm_rename; }; +FBSD_1.7 { + _Fork; +}; + FBSDprivate_1.0 { ___acl_aclcheck_fd; __sys___acl_aclcheck_fd; diff --git a/lib/libc/sys/_Fork.c b/lib/libc/sys/_Fork.c new file mode 100644 index 000000000000..a7aaf82429bb --- /dev/null +++ b/lib/libc/sys/_Fork.c @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2021 The FreeBSD Foundation. + * All rights reserved. + * + * 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: + * 1. Redistributions of source code must retain the above copyright + * notice(s), this list of conditions and the following disclaimer as + * the first lines of this file unmodified other than the possible + * addition of one or more copyright notices. + * 2. Redistributions in binary form must reproduce the above copyright + * notice(s), 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 COPYRIGHT HOLDER(S) ``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(S) 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 "libc_private.h" + +#pragma weak _Fork +pid_t +_Fork(void) +{ + return (__sys_fork()); +} diff --git a/lib/libc/sys/fork.2 b/lib/libc/sys/fork.2 index 9ea0a6afb96f..bf934d166b03 100644 --- a/lib/libc/sys/fork.2 +++ b/lib/libc/sys/fork.2 @@ -28,7 +28,7 @@ .\" @(#)fork.2 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd April 20, 2021 +.Dd August 2, 2021 .Dt FORK 2 .Os .Sh NAME @@ -40,10 +40,12 @@ .In unistd.h .Ft pid_t .Fn fork void +.Ft pid_t +.Fn _Fork void .Sh DESCRIPTION The .Fn fork -system call causes creation of a new process. +function causes creation of a new process. The new process (child process) is an exact copy of the calling process (parent process) except for the following: .Bl -bullet -offset indent @@ -77,6 +79,15 @@ are set to 0; see All interval timers are cleared; see .Xr setitimer 2 . .It +The robust mutexes list (see +.Xr pthread_mutexattr_setrobust 3 ) +is cleared for the child. +.It +The atfork handlers established with the +.Xr pthread_atfork 3 +function are called as appropriate before fork in the parent process, +and after the child is created, in parent and child. +.It The child process has only one thread, corresponding to the calling thread in the parent process. If the process has more than one thread, @@ -87,11 +98,58 @@ and therefore only async-signal-safe functions are guaranteed to work in the child process until a call to .Xr execve 2 or a similar function. +The +.Fx +implementation of +.Fn fork +provides a usable +.Xr malloc 3 , +and +.Xr rtld 1 +services in the child process. .El +.Pp +The +.Fn fork +function is not async-signal safe and creates a cancellation point +in the parent process. +It cannot be safely used from signal handlers, and the atfork handlers +established by +.Xr pthread_atfork 3 +do not need to be async-signal safe either. +.Pp +The +.Fn _Fork +function creates a new process, similarly to +.Fn fork , +but it is async-signal safe. +.Fn _Fork +does not call atfork handlers, and does not create a cancellation point. +It can be used safely from signal handlers, but then no userspace +services ( +.Xr malloc 3 +or +.Xr rtld 1 ) +are available in the child if forked from multi-threaded parent. +In particular, if using dynamic linking, all dynamic symbols used by the +child after +.Fn _Fork +must be pre-resolved. +Note: resolving can be done globally by specifying the +.Ev LD_BIND_NOW +environment variable to the dynamic linker, or per-binary by passing the +.Fl z Ar now +option to the static linker +.Xr ld 1 , +or by using each symbol before the +.Fn _Fork +call to force the binding. .Sh RETURN VALUES Upon successful completion, .Fn fork -returns a value +and +.Fn _Fork +return a value of 0 to the child process and returns the process ID of the child process to the parent process. Otherwise, a value of -1 is returned @@ -176,9 +234,21 @@ There is insufficient swap space for the new process. .Xr setrlimit 2 , .Xr sigaction 2 , .Xr vfork 2 , -.Xr wait 2 +.Xr wait 2 , +.Xr pthread_atfork 3 .Sh HISTORY The .Fn fork function appeared in .At v1 . +.Pp +The +.Fn _Fork +function was defined by Austin Group together with the removal +of a requirement that the +.Fn fork +implementation must be async-signal safe. +The +.Fn _Fork +function appeared in +.Fx 14.0 . From owner-dev-commits-src-all@freebsd.org Tue Aug 3 20:28:05 2021 Return-Path: Delivered-To: dev-commits-src-all@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 08E8E650391; Tue, 3 Aug 2021 20:28:05 +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 4GfRJh6TPQz3rkb; Tue, 3 Aug 2021 20:28:04 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from aniel.nours.eu (nours.eu [IPv6:2001:41d0:8:3a4d::1]) (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 AF119C1E0; Tue, 3 Aug 2021 20:28:04 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from dummy.faircode.eu (10.246.39.62.rev.sfr.net [62.39.246.10]) (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 aniel.nours.eu (Postfix) with ESMTPSA id 96CD64D875; Tue, 3 Aug 2021 22:28:02 +0200 (CEST) Date: Tue, 3 Aug 2021 20:28:01 +0000 (UTC) From: Baptiste Daroussin To: "Rodney W. Grimes" Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Message-ID: <1acb127e-1d2c-4c9f-96e6-23bfbf9695ac@FreeBSD.org> In-Reply-To: <202108031732.173HWXr9049195@gndrsh.dnsmgr.net> References: <202108031732.173HWXr9049195@gndrsh.dnsmgr.net> Subject: Re: git: 184d64af1344 - main - locales: stop hardcoding the directories in the mtree MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Correlation-ID: <1acb127e-1d2c-4c9f-96e6-23bfbf9695ac@FreeBSD.org> X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 20:28:05 -0000 3 ao=C3=BBt 2021 19:32:44 Rodney W. Grimes : >> The branch main has been updated by bapt: >> >> URL: https://cgit.FreeBSD.org/src/commit/?id=3D184d64af1344d6f3c37049951= 0cede49320f4863 >> >> commit 184d64af1344d6f3c370499510cede49320f4863 >> Author:=C2=A0=C2=A0=C2=A0=C2=A0 Baptiste Daroussin >> AuthorDate: 2021-08-03 12:25:00 +0000 >> Commit:=C2=A0=C2=A0=C2=A0=C2=A0 Baptiste Daroussin >> CommitDate: 2021-08-03 12:25:00 +0000 >> >> =C2=A0=C2=A0=C2=A0 locales: stop hardcoding the directories in the mtree >> =C2=A0=C2=A0=C2=A0 >> =C2=A0=C2=A0=C2=A0 The framework knows how to create directories and tag= them properly >> =C2=A0=C2=A0=C2=A0 for a the creation of a mtree, not need to hardcode a= ll the locales >> =C2=A0=C2=A0=C2=A0 entries in bsd.usr.mk >> =C2=A0=C2=A0=C2=A0 >> =C2=A0=C2=A0=C2=A0 This simplifies addition of new locales but also allo= w people building >> =C2=A0=C2=A0=C2=A0 with WITHOUT_LOCALES to end up with a directory full = of empty files > > The uses of /etc/mtree go beyond the simple directory creation, > please cause something to build a BSD.locale.dist file and install > it in /etc/mtree to replace the functionality removal you have > just performed. > > Thanks, > Rod > Please provide a valid use case not working anymore after this change and I= will consider. Note that this is not the only part of the tree where the same thing is don= e. Best, Bapt From owner-dev-commits-src-all@freebsd.org Tue Aug 3 22:51:27 2021 Return-Path: Delivered-To: dev-commits-src-all@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 8DAFD651DE9; Tue, 3 Aug 2021 22:51: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 4GfVV73Njsz4Vn6; Tue, 3 Aug 2021 22:51: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 5DA6E1BC1E; Tue, 3 Aug 2021 22:51: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 173MpR4T030294; Tue, 3 Aug 2021 22:51:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 173MpRrh030293; Tue, 3 Aug 2021 22:51:27 GMT (envelope-from git) Date: Tue, 3 Aug 2021 22:51:27 GMT Message-Id: <202108032251.173MpRrh030293@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kevin Bowling Subject: git: 914e70b909d0 - stable/13 - arm: Bump KSTACK_PAGES default to match i386/amd64 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 914e70b909d0b91843264231a2c2f97c40a940f9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 22:51:27 -0000 The branch stable/13 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=914e70b909d0b91843264231a2c2f97c40a940f9 commit 914e70b909d0b91843264231a2c2f97c40a940f9 Author: Kevin Bowling AuthorDate: 2021-07-21 01:35:54 +0000 Commit: Kevin Bowling CommitDate: 2021-08-03 22:51:14 +0000 arm: Bump KSTACK_PAGES default to match i386/amd64 See 3f6867ef6386 for additional context. It is also needed for OpenZFS performance and stability. Reviewed by: ian (arm), imp Differential Revision: https://reviews.freebsd.org/D31244 (cherry picked from commit b684d812fcb04b2997fd755405a92c36b9f6e30e) --- sys/arm/include/param.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/arm/include/param.h b/sys/arm/include/param.h index 807b492324fa..45dc0f270c50 100644 --- a/sys/arm/include/param.h +++ b/sys/arm/include/param.h @@ -114,7 +114,7 @@ #define MAXPAGESIZES 2 /* maximum number of supported page sizes */ #ifndef KSTACK_PAGES -#define KSTACK_PAGES 2 +#define KSTACK_PAGES 4 #endif /* !KSTACK_PAGES */ #ifndef FPCONTEXTSIZE From owner-dev-commits-src-all@freebsd.org Tue Aug 3 22:52:00 2021 Return-Path: Delivered-To: dev-commits-src-all@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 5C7A0652328; Tue, 3 Aug 2021 22:52: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 4GfVVm2Df9z4VRy; Tue, 3 Aug 2021 22:52: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 33A9F1BACF; Tue, 3 Aug 2021 22:52: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 173Mq0ET033694; Tue, 3 Aug 2021 22:52:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 173Mq01B033693; Tue, 3 Aug 2021 22:52:00 GMT (envelope-from git) Date: Tue, 3 Aug 2021 22:52:00 GMT Message-Id: <202108032252.173Mq01B033693@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kevin Bowling Subject: git: 19737ec0a2e4 - stable/12 - arm: Bump KSTACK_PAGES default to match i386/amd64 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 19737ec0a2e4d234de074fcc5dacde444f599546 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 22:52:00 -0000 The branch stable/12 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=19737ec0a2e4d234de074fcc5dacde444f599546 commit 19737ec0a2e4d234de074fcc5dacde444f599546 Author: Kevin Bowling AuthorDate: 2021-07-21 01:35:54 +0000 Commit: Kevin Bowling CommitDate: 2021-08-03 22:51:52 +0000 arm: Bump KSTACK_PAGES default to match i386/amd64 See 3f6867ef6386 for additional context. It is also needed for OpenZFS performance and stability. Reviewed by: ian (arm), imp Differential Revision: https://reviews.freebsd.org/D31244 (cherry picked from commit b684d812fcb04b2997fd755405a92c36b9f6e30e) --- sys/arm/include/param.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/arm/include/param.h b/sys/arm/include/param.h index 39dcc5e341bf..8ba4963406b3 100644 --- a/sys/arm/include/param.h +++ b/sys/arm/include/param.h @@ -124,7 +124,7 @@ #define MAXPAGESIZES 2 /* maximum number of supported page sizes */ #ifndef KSTACK_PAGES -#define KSTACK_PAGES 2 +#define KSTACK_PAGES 4 #endif /* !KSTACK_PAGES */ #ifndef FPCONTEXTSIZE From owner-dev-commits-src-all@freebsd.org Tue Aug 3 23:49:45 2021 Return-Path: Delivered-To: dev-commits-src-all@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 D1C8B6528B5; Tue, 3 Aug 2021 23:49: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 4GfWnP5JqPz4Yqb; Tue, 3 Aug 2021 23:49: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 9FC691C8B7; Tue, 3 Aug 2021 23:49: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 173NnjBk001047; Tue, 3 Aug 2021 23:49:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 173NnjxM001046; Tue, 3 Aug 2021 23:49:45 GMT (envelope-from git) Date: Tue, 3 Aug 2021 23:49:45 GMT Message-Id: <202108032349.173NnjxM001046@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 9ec7dbf46b0a - stable/13 - 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 9ec7dbf46b0a025b06f5d94decea4889f2793c60 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 23:49:45 -0000 The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=9ec7dbf46b0a025b06f5d94decea4889f2793c60 commit 9ec7dbf46b0a025b06f5d94decea4889f2793c60 Author: Rick Macklem AuthorDate: 2021-07-09 00:39:04 +0000 Commit: Rick Macklem CommitDate: 2021-08-03 23:40:47 +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. (cherry picked from commit 1e0a518d65488caafff89a4ecba9cfb2be233379) --- 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 8979a4d08243..6093f7c0adeb 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 2fe30035b904..d6ec1f9a3825 100644 --- a/sys/fs/nfsclient/nfs_clvfsops.c +++ b/sys/fs/nfsclient/nfs_clvfsops.c @@ -119,7 +119,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 *); @@ -546,7 +546,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); } @@ -713,14 +713,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"); } @@ -748,7 +748,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 }; /* @@ -900,6 +900,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; @@ -1190,6 +1191,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); @@ -1357,10 +1372,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); @@ -1408,7 +1438,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; @@ -1575,7 +1605,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) { @@ -1584,6 +1615,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) && @@ -1678,6 +1715,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. */ @@ -1690,7 +1731,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); @@ -1705,7 +1746,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); @@ -1791,7 +1832,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) @@ -1801,7 +1842,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); @@ -2065,6 +2106,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-all@freebsd.org Tue Aug 3 23:50:25 2021 Return-Path: Delivered-To: dev-commits-src-all@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 33187652FA6; Tue, 3 Aug 2021 23:50:25 +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 4GfWp90vBQz4Z5C; Tue, 3 Aug 2021 23:50: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 085EB1C2CD; Tue, 3 Aug 2021 23:50: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 173NoOmk009446; Tue, 3 Aug 2021 23:50:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 173NoOxe009445; Tue, 3 Aug 2021 23:50:24 GMT (envelope-from git) Date: Tue, 3 Aug 2021 23:50:24 GMT Message-Id: <202108032350.173NoOxe009445@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Li-Wen Hsu Subject: git: d2c0584257a3 - stable/13 - loader.conf(5): mention "efi" option for "console" parameter 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/stable/13 X-Git-Reftype: branch X-Git-Commit: d2c0584257a344622b8b7e1581080b7a7933d818 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 23:50:25 -0000 The branch stable/13 has been updated by lwhsu: URL: https://cgit.FreeBSD.org/src/commit/?id=d2c0584257a344622b8b7e1581080b7a7933d818 commit d2c0584257a344622b8b7e1581080b7a7933d818 Author: Li-Wen Hsu AuthorDate: 2021-07-31 22:41:49 +0000 Commit: Li-Wen Hsu CommitDate: 2021-08-03 23:50:14 +0000 loader.conf(5): mention "efi" option for "console" parameter PR: 213467 Reviewed by: imp MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D31368 (cherry picked from commit de0c7fbe280a1e0946afb111cf7a9811364c4bd6) --- stand/defaults/loader.conf.5 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/stand/defaults/loader.conf.5 b/stand/defaults/loader.conf.5 index b4109371a1cf..23a65935c95a 100644 --- a/stand/defaults/loader.conf.5 +++ b/stand/defaults/loader.conf.5 @@ -23,7 +23,7 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD$ -.Dd July 10, 2021 +.Dd July 31, 2021 .Dt LOADER.CONF 5 .Os .Sh NAME @@ -270,6 +270,8 @@ serial port speed setting. selects serial console, .Dq vidconsole selects the video console, +.Dq efi +selects the EFI console, .Dq nullconsole selects a mute console (useful for systems with neither a video console nor a serial port), and From owner-dev-commits-src-all@freebsd.org Tue Aug 3 23:51:05 2021 Return-Path: Delivered-To: dev-commits-src-all@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 89005652553; Tue, 3 Aug 2021 23:51: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 4GfWpx3T1kz4Z3d; Tue, 3 Aug 2021 23:51: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 60BA71C9A2; Tue, 3 Aug 2021 23:51: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 173Np5vv011284; Tue, 3 Aug 2021 23:51:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 173Np5mh011283; Tue, 3 Aug 2021 23:51:05 GMT (envelope-from git) Date: Tue, 3 Aug 2021 23:51:05 GMT Message-Id: <202108032351.173Np5mh011283@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Li-Wen Hsu Subject: git: b0ef42f3669d - stable/12 - loader.conf(5): mention "efi" option for "console" parameter 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/stable/12 X-Git-Reftype: branch X-Git-Commit: b0ef42f3669d0d909ffd6edf00b8b98abb12dd92 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 23:51:05 -0000 The branch stable/12 has been updated by lwhsu: URL: https://cgit.FreeBSD.org/src/commit/?id=b0ef42f3669d0d909ffd6edf00b8b98abb12dd92 commit b0ef42f3669d0d909ffd6edf00b8b98abb12dd92 Author: Li-Wen Hsu AuthorDate: 2021-07-31 22:41:49 +0000 Commit: Li-Wen Hsu CommitDate: 2021-08-03 23:50:45 +0000 loader.conf(5): mention "efi" option for "console" parameter PR: 213467 Reviewed by: imp MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D31368 (cherry picked from commit de0c7fbe280a1e0946afb111cf7a9811364c4bd6) --- stand/defaults/loader.conf.5 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/stand/defaults/loader.conf.5 b/stand/defaults/loader.conf.5 index 3bd83dcc5c30..730770e44cd4 100644 --- a/stand/defaults/loader.conf.5 +++ b/stand/defaults/loader.conf.5 @@ -23,7 +23,7 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD$ -.Dd December 31, 2020 +.Dd July 31, 2021 .Dt LOADER.CONF 5 .Os .Sh NAME @@ -230,6 +230,8 @@ serial port speed setting. selects serial console, .Dq vidconsole selects the video console, +.Dq efi +selects the EFI console, .Dq nullconsole selects a mute console (useful for systems with neither a video console nor a serial port), and From owner-dev-commits-src-all@freebsd.org Tue Aug 3 23:52:06 2021 Return-Path: Delivered-To: dev-commits-src-all@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 93134652FDA; Tue, 3 Aug 2021 23:52: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 4GfWr63ljFz4ZW0; Tue, 3 Aug 2021 23:52: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 69B331C6F5; Tue, 3 Aug 2021 23:52:06 +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 173Nq6bG013866; Tue, 3 Aug 2021 23:52:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 173Nq6SX013865; Tue, 3 Aug 2021 23:52:06 GMT (envelope-from git) Date: Tue, 3 Aug 2021 23:52:06 GMT Message-Id: <202108032352.173Nq6SX013865@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 46b4c26b5b01 - stable/13 - 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 46b4c26b5b01e48894d5d0979a4bfc6bc8725a4a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 23:52:06 -0000 The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=46b4c26b5b01e48894d5d0979a4bfc6bc8725a4a commit 46b4c26b5b01e48894d5d0979a4bfc6bc8725a4a Author: Rick Macklem AuthorDate: 2021-07-11 20:34:16 +0000 Commit: Rick Macklem CommitDate: 2021-08-03 23:49:28 +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. (cherry picked from commit 4488c8c34ba38146aab52fd60211bb32cdc87267) --- 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-all@freebsd.org Tue Aug 3 23:54:10 2021 Return-Path: Delivered-To: dev-commits-src-all@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 E6FD6653388; Tue, 3 Aug 2021 23:54: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 4GfWtV69JVz4Zss; Tue, 3 Aug 2021 23:54: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 BB8341C6FC; Tue, 3 Aug 2021 23:54: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 173NsAaq014111; Tue, 3 Aug 2021 23:54:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 173NsABE014110; Tue, 3 Aug 2021 23:54:10 GMT (envelope-from git) Date: Tue, 3 Aug 2021 23:54:10 GMT Message-Id: <202108032354.173NsABE014110@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 9fb6e613373c - stable/13 - nfsd: Add sysctl to set maximum I/O size up to 1Mbyte 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 9fb6e613373cf90bb25e7cf5b40a0a7f82c941f6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 23:54:11 -0000 The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=9fb6e613373cf90bb25e7cf5b40a0a7f82c941f6 commit 9fb6e613373cf90bb25e7cf5b40a0a7f82c941f6 Author: Rick Macklem AuthorDate: 2021-07-16 22:01:03 +0000 Commit: Rick Macklem CommitDate: 2021-08-03 23:50:33 +0000 nfsd: Add sysctl to set maximum I/O size up to 1Mbyte Since MAXPHYS now allows the FreeBSD NFS client to do 1Mbyte I/O operations, add a sysctl called vfs.nfsd.srvmaxio so that the maximum NFS server I/O size can be set up to 1Mbyte. The Linux NFS client can also do 1Mbyte I/O operations. The default of 128Kbytes for the maximum I/O size has not been changed for two reasons: - kern.ipc.maxsockbuf must be increased to support 1Mbyte I/O - The limited benchmarking I can do actually shows a drop in I/O rate when the I/O size is above 256Kbytes. However, daveb@spectralogic.com reports seeing an increase in I/O rate for the 1Mbyte I/O size vs 128Kbytes using a Linux client. (cherry picked from commit ee29e6f31111ea3cd490248987f2f2ec412eb0bb) --- sys/fs/nfs/nfs.h | 2 +- sys/fs/nfs/nfs_commonport.c | 7 ++-- sys/fs/nfs/nfs_commonsubs.c | 5 ++- sys/fs/nfs/nfsproto.h | 1 - sys/fs/nfsserver/nfs_nfsdport.c | 81 ++++++++++++++++++++++++++++++++++++++++ sys/fs/nfsserver/nfs_nfsdserv.c | 12 ++++-- sys/fs/nfsserver/nfs_nfsdstate.c | 11 +++--- 7 files changed, 104 insertions(+), 15 deletions(-) diff --git a/sys/fs/nfs/nfs.h b/sys/fs/nfs/nfs.h index 272b8dbfee22..1a29a7e1d6ec 100644 --- a/sys/fs/nfs/nfs.h +++ b/sys/fs/nfs/nfs.h @@ -156,7 +156,7 @@ (t).tv_sec = time.tv_sec; (t).tv_nsec = 1000 * time.tv_usec; } while (0) #define NFS_SRVMAXDATA(n) \ (((n)->nd_flag & (ND_NFSV3 | ND_NFSV4)) ? \ - NFS_SRVMAXIO : NFS_V2MAXDATA) + nfs_srvmaxio : NFS_V2MAXDATA) #define NFS64BITSSET 0xffffffffffffffffull #define NFS64BITSMINUS1 0xfffffffffffffffeull diff --git a/sys/fs/nfs/nfs_commonport.c b/sys/fs/nfs/nfs_commonport.c index 47038980c640..8a100749fc32 100644 --- a/sys/fs/nfs/nfs_commonport.c +++ b/sys/fs/nfs/nfs_commonport.c @@ -76,6 +76,7 @@ void (*nfsd_call_servertimer)(void) = NULL; void (*ncl_call_invalcaches)(struct vnode *) = NULL; vop_advlock_t *nfs_advlock_p = NULL; vop_reclaim_t *nfs_reclaim_p = NULL; +uint32_t nfs_srvmaxio = NFS_SRVMAXIO; int nfs_pnfsio(task_fn_t *, void *); @@ -303,11 +304,11 @@ nfsvno_getfs(struct nfsfsinfo *sip, int isdgram) if (isdgram) pref = NFS_MAXDGRAMDATA; else - pref = NFS_SRVMAXIO; - sip->fs_rtmax = NFS_SRVMAXIO; + pref = nfs_srvmaxio; + sip->fs_rtmax = nfs_srvmaxio; sip->fs_rtpref = pref; sip->fs_rtmult = NFS_FABLKSIZE; - sip->fs_wtmax = NFS_SRVMAXIO; + sip->fs_wtmax = nfs_srvmaxio; sip->fs_wtpref = pref; sip->fs_wtmult = NFS_FABLKSIZE; sip->fs_dtpref = pref; diff --git a/sys/fs/nfs/nfs_commonsubs.c b/sys/fs/nfs/nfs_commonsubs.c index 1bdc13123aac..817d89284091 100644 --- a/sys/fs/nfs/nfs_commonsubs.c +++ b/sys/fs/nfs/nfs_commonsubs.c @@ -85,6 +85,7 @@ extern volatile int nfsrv_devidcnt; extern int nfscl_debuglevel; extern struct nfsdevicehead nfsrv_devidhead; extern struct nfsstatsv1 nfsstatsv1; +extern uint32_t nfs_srvmaxio; SYSCTL_DECL(_vfs_nfs); SYSCTL_INT(_vfs_nfs, OID_AUTO, enable_uidtostring, CTLFLAG_RW, @@ -2201,7 +2202,7 @@ nfsv4_loadattr(struct nfsrv_descript *nd, vnode_t vp, NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED); attrsum += NFSX_UNSIGNED; i = fxdr_unsigned(int, *tl); - if (compare && !(*retcmpp) && i != NFS_SRVMAXIO) + if (compare && !(*retcmpp) && i != nfs_srvmaxio) *retcmpp = NFSERR_NOTSAME; break; default: @@ -3012,7 +3013,7 @@ nfsv4_fillattr(struct nfsrv_descript *nd, struct mount *mp, vnode_t vp, case NFSATTRBIT_LAYOUTALIGNMENT: case NFSATTRBIT_LAYOUTBLKSIZE: NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED); - *tl = txdr_unsigned(NFS_SRVMAXIO); + *tl = txdr_unsigned(nfs_srvmaxio); retnum += NFSX_UNSIGNED; break; case NFSATTRBIT_XATTRSUPPORT: diff --git a/sys/fs/nfs/nfsproto.h b/sys/fs/nfs/nfsproto.h index 62d86c3a4593..13e146154805 100644 --- a/sys/fs/nfs/nfsproto.h +++ b/sys/fs/nfs/nfsproto.h @@ -73,7 +73,6 @@ */ #define NFS_MAXPKTHDR 404 #define NFS_MAXXDR 4096 -#define NFS_MAXPACKET (NFS_SRVMAXIO + NFS_MAXXDR) #define NFS_MINPACKET 20 #define NFS_FABLKSIZE 512 /* Size in bytes of a block wrt fa_blocks */ #define NFSV4_MINORVERSION 0 /* V4 Minor version */ diff --git a/sys/fs/nfsserver/nfs_nfsdport.c b/sys/fs/nfsserver/nfs_nfsdport.c index 7bcbc738d61b..efe9aac7a136 100644 --- a/sys/fs/nfsserver/nfs_nfsdport.c +++ b/sys/fs/nfsserver/nfs_nfsdport.c @@ -76,6 +76,9 @@ extern struct nfsdontlisthead nfsrv_dontlisthead; extern volatile int nfsrv_dontlistlen; extern volatile int nfsrv_devidcnt; extern int nfsrv_maxpnfsmirror; +extern uint32_t nfs_srvmaxio; +extern int nfs_bufpackets; +extern u_long sb_max_adj; struct vfsoptlist nfsv4root_opt, nfsv4root_newopt; NFSDLOCKMUTEX; NFSSTATESPINLOCK; @@ -195,6 +198,84 @@ SYSCTL_PROC(_vfs_nfsd, OID_AUTO, dsdirsize, CTLTYPE_UINT | CTLFLAG_MPSAFE | CTLFLAG_RW, 0, sizeof(nfsrv_dsdirsize), sysctl_dsdirsize, "IU", "Number of dsN subdirs on the DS servers"); +/* + * nfs_srvmaxio can only be increased and only when the nfsd threads are + * not running. The setting must be a power of 2, with the current limit of + * 1Mbyte. + */ +static int +sysctl_srvmaxio(SYSCTL_HANDLER_ARGS) +{ + int error; + u_int newsrvmaxio; + uint64_t tval; + + newsrvmaxio = nfs_srvmaxio; + error = sysctl_handle_int(oidp, &newsrvmaxio, 0, req); + if (error != 0 || req->newptr == NULL) + return (error); + if (newsrvmaxio == nfs_srvmaxio) + return (0); + if (newsrvmaxio < nfs_srvmaxio) { + printf("nfsd: vfs.nfsd.srvmaxio can only be increased\n"); + return (EINVAL); + } + if (newsrvmaxio > 1048576) { + printf("nfsd: vfs.nfsd.srvmaxio cannot be > 1Mbyte\n"); + return (EINVAL); + } + if ((newsrvmaxio & (newsrvmaxio - 1)) != 0) { + printf("nfsd: vfs.nfsd.srvmaxio must be a power of 2\n"); + return (EINVAL); + } + + /* + * Check that kern.ipc.maxsockbuf is large enough for + * newsrviomax, given the setting of vfs.nfs.bufpackets. + */ + if ((newsrvmaxio + NFS_MAXXDR) * nfs_bufpackets > + sb_max_adj) { + /* + * Suggest vfs.nfs.bufpackets * maximum RPC message for + * sb_max_adj. + */ + tval = (newsrvmaxio + NFS_MAXXDR) * nfs_bufpackets; + + /* + * Convert suggested sb_max_adj value to a suggested + * sb_max value, which is what is set via kern.ipc.maxsockbuf. + * Perform the inverse calculation of (from uipc_sockbuf.c): + * sb_max_adj = (u_quad_t)sb_max * MCLBYTES / + * (MSIZE + MCLBYTES); + * XXX If the calculation of sb_max_adj from sb_max changes, + * this calculation must be changed as well. + */ + tval *= (MSIZE + MCLBYTES); /* Brackets for readability. */ + tval += MCLBYTES - 1; /* Round up divide. */ + tval /= MCLBYTES; + printf("nfsd: set kern.ipc.maxsockbuf to a minimum of " + "%ju to support %ubyte NFS I/O\n", (uintmax_t)tval, + newsrvmaxio); + return (EINVAL); + } + + NFSD_LOCK(); + if (newnfs_numnfsd != 0) { + NFSD_UNLOCK(); + printf("nfsd: cannot set vfs.nfsd.srvmaxio when nfsd " + "threads are running\n"); + return (EINVAL); + } + + + nfs_srvmaxio = newsrvmaxio; + NFSD_UNLOCK(); + return (0); +} +SYSCTL_PROC(_vfs_nfsd, OID_AUTO, srvmaxio, + CTLTYPE_UINT | CTLFLAG_MPSAFE | CTLFLAG_RW, NULL, 0, + sysctl_srvmaxio, "IU", "Maximum I/O size in bytes"); + #define MAX_REORDERED_RPC 16 #define NUM_HEURISTIC 1031 #define NHUSE_INIT 64 diff --git a/sys/fs/nfsserver/nfs_nfsdserv.c b/sys/fs/nfsserver/nfs_nfsdserv.c index e564a6a48b79..0ba3472b4ff9 100644 --- a/sys/fs/nfsserver/nfs_nfsdserv.c +++ b/sys/fs/nfsserver/nfs_nfsdserv.c @@ -66,6 +66,7 @@ extern u_long sb_max_adj; extern int nfsrv_pnfsatime; extern int nfsrv_maxpnfsmirror; extern int nfs_maxcopyrange; +extern uint32_t nfs_srvmaxio; static int nfs_async = 0; SYSCTL_DECL(_vfs_nfsd); @@ -1023,7 +1024,7 @@ nfsrvd_write(struct nfsrv_descript *nd, __unused int isdgram, lop->lo_end = NFS64BITSSET; } - if (retlen > NFS_SRVMAXIO || retlen < 0) + if (retlen > nfs_srvmaxio || retlen < 0) nd->nd_repstat = EIO; if (vnode_vtype(vp) != VREG && !nd->nd_repstat) { if (nd->nd_flag & ND_NFSV3) @@ -4417,6 +4418,7 @@ nfsrvd_createsession(struct nfsrv_descript *nd, __unused int isdgram, struct nfsdsession *sep = NULL; uint32_t rdmacnt; struct thread *p = curthread; + static bool do_printf = true; if ((nd->nd_repstat = nfsd_checkrootexp(nd)) != 0) goto nfsmout; @@ -4438,12 +4440,16 @@ nfsrvd_createsession(struct nfsrv_descript *nd, __unused int isdgram, sep->sess_maxreq = fxdr_unsigned(uint32_t, *tl++); if (sep->sess_maxreq > sb_max_adj - NFS_MAXXDR) { sep->sess_maxreq = sb_max_adj - NFS_MAXXDR; - printf("Consider increasing kern.ipc.maxsockbuf\n"); + if (do_printf) + printf("Consider increasing kern.ipc.maxsockbuf\n"); + do_printf = false; } sep->sess_maxresp = fxdr_unsigned(uint32_t, *tl++); if (sep->sess_maxresp > sb_max_adj - NFS_MAXXDR) { sep->sess_maxresp = sb_max_adj - NFS_MAXXDR; - printf("Consider increasing kern.ipc.maxsockbuf\n"); + if (do_printf) + printf("Consider increasing kern.ipc.maxsockbuf\n"); + do_printf = false; } sep->sess_maxrespcached = fxdr_unsigned(uint32_t, *tl++); sep->sess_maxops = fxdr_unsigned(uint32_t, *tl++); diff --git a/sys/fs/nfsserver/nfs_nfsdstate.c b/sys/fs/nfsserver/nfs_nfsdstate.c index 01280c8e49c6..750eda2027ec 100644 --- a/sys/fs/nfsserver/nfs_nfsdstate.c +++ b/sys/fs/nfsserver/nfs_nfsdstate.c @@ -42,6 +42,7 @@ struct nfsv4lock nfsv4rootfs_lock; time_t nfsdev_time = 0; int nfsrv_layouthashsize; volatile int nfsrv_layoutcnt = 0; +extern uint32_t nfs_srvmaxio; extern int newnfs_numnfsd; extern struct nfsstatsv1 nfsstatsv1; @@ -6898,7 +6899,7 @@ nfsrv_filelayout(struct nfsrv_descript *nd, int iomode, fhandle_t *fhp, tl += (NFSX_V4DEVICEID / NFSX_UNSIGNED); /* Set the stripe size to the maximum I/O size. */ - *tl++ = txdr_unsigned(NFS_SRVMAXIO & NFSFLAYUTIL_STRIPE_MASK); + *tl++ = txdr_unsigned(nfs_srvmaxio & NFSFLAYUTIL_STRIPE_MASK); *tl++ = 0; /* 1st stripe index. */ pattern_offset = 0; txdr_hyper(pattern_offset, tl); tl += 2; /* Pattern offset. */ @@ -7964,13 +7965,13 @@ nfsrv_allocdevid(struct nfsdevice *ds, char *addr, char *dnshost) *tl++ = txdr_unsigned(2); /* Two NFS Versions. */ *tl++ = txdr_unsigned(NFS_VER4); /* NFSv4. */ *tl++ = txdr_unsigned(NFSV42_MINORVERSION); /* Minor version 2. */ - *tl++ = txdr_unsigned(NFS_SRVMAXIO); /* DS max rsize. */ - *tl++ = txdr_unsigned(NFS_SRVMAXIO); /* DS max wsize. */ + *tl++ = txdr_unsigned(nfs_srvmaxio); /* DS max rsize. */ + *tl++ = txdr_unsigned(nfs_srvmaxio); /* DS max wsize. */ *tl++ = newnfs_true; /* Tightly coupled. */ *tl++ = txdr_unsigned(NFS_VER4); /* NFSv4. */ *tl++ = txdr_unsigned(NFSV41_MINORVERSION); /* Minor version 1. */ - *tl++ = txdr_unsigned(NFS_SRVMAXIO); /* DS max rsize. */ - *tl++ = txdr_unsigned(NFS_SRVMAXIO); /* DS max wsize. */ + *tl++ = txdr_unsigned(nfs_srvmaxio); /* DS max rsize. */ + *tl++ = txdr_unsigned(nfs_srvmaxio); /* DS max wsize. */ *tl = newnfs_true; /* Tightly coupled. */ ds->nfsdev_hostnamelen = strlen(dnshost); From owner-dev-commits-src-all@freebsd.org Wed Aug 4 00:09:54 2021 Return-Path: Delivered-To: dev-commits-src-all@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 92E566533BA; Wed, 4 Aug 2021 00:09: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 4GfXDf3k5Wz4bvB; Wed, 4 Aug 2021 00: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 67BA11CB2E; Wed, 4 Aug 2021 00: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 17409sAd028352; Wed, 4 Aug 2021 00: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 17409sCt028351; Wed, 4 Aug 2021 00:09:54 GMT (envelope-from git) Date: Wed, 4 Aug 2021 00:09:54 GMT Message-Id: <202108040009.17409sCt028351@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 53d162819c20 - stable/13 - param.h: Bump __FreeBSD_version to 1300514 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 53d162819c20e5cf267cb91f7a19940e96e8bec4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Aug 2021 00:09:54 -0000 The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=53d162819c20e5cf267cb91f7a19940e96e8bec4 commit 53d162819c20e5cf267cb91f7a19940e96e8bec4 Author: Rick Macklem AuthorDate: 2021-08-04 00:06:59 +0000 Commit: Rick Macklem CommitDate: 2021-08-04 00:06:59 +0000 param.h: Bump __FreeBSD_version to 1300514 Commits 9fb6e613373c and 9ec7dbf46b0a both changed the internal KAPI between the NFS modules. Bump __FreeBSD_version to 1300514 so that all modules are rebuilt from sources. This is a direct commit. --- 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 497847dc1e6a..ef5eb4206706 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1300513 /* Master, propagated to newvers */ +#define __FreeBSD_version 1300514 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-dev-commits-src-all@freebsd.org Wed Aug 4 00:15:18 2021 Return-Path: Delivered-To: dev-commits-src-all@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 8537C653830; Wed, 4 Aug 2021 00:15:18 +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 4GfXLt3FZNz4c70; Wed, 4 Aug 2021 00:15:18 +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 587C71CF81; Wed, 4 Aug 2021 00:15:18 +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 1740FIpg041724; Wed, 4 Aug 2021 00:15:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1740FIEI041723; Wed, 4 Aug 2021 00:15:18 GMT (envelope-from git) Date: Wed, 4 Aug 2021 00:15:18 GMT Message-Id: <202108040015.1740FIEI041723@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 123fc95d47f2 - stable/13 - UPDATING: Add an entry for commits 9fb6e613373c and 9ec7dbf46b0a 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 123fc95d47f2e1aa542c4a9960744ac964572540 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Aug 2021 00:15:18 -0000 The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=123fc95d47f2e1aa542c4a9960744ac964572540 commit 123fc95d47f2e1aa542c4a9960744ac964572540 Author: Rick Macklem AuthorDate: 2021-08-04 00:12:22 +0000 Commit: Rick Macklem CommitDate: 2021-08-04 00:12:22 +0000 UPDATING: Add an entry for commits 9fb6e613373c and 9ec7dbf46b0a This is a direct commit. --- UPDATING | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/UPDATING b/UPDATING index b780eeb7b887..503ce0962398 100644 --- a/UPDATING +++ b/UPDATING @@ -12,6 +12,11 @@ Items affecting the ports and packages system can be found in /usr/ports/UPDATING. Please read that file before updating system packages and/or ports. +20210803: + Commits 9fb6e613373c and 9ec7dbf46b0a both changed the internal + KAPI between the NFS modules. Bump __FreeBSD_version to 1300514. + All NFS modules must be rebuilt from sources. + 20210718: Bump __FreeBSD_version to 1300512 after merging LinuxKPI, OFED, net80211, and driver changes in order to support building From owner-dev-commits-src-all@freebsd.org Wed Aug 4 00:27:11 2021 Return-Path: Delivered-To: dev-commits-src-all@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 ABAF9653C49; Wed, 4 Aug 2021 00:27: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 4GfXcb46LGz4cKm; Wed, 4 Aug 2021 00:27: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 717E71D140; Wed, 4 Aug 2021 00:27: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 1740RBfu055020; Wed, 4 Aug 2021 00:27:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1740RB99055019; Wed, 4 Aug 2021 00:27:11 GMT (envelope-from git) Date: Wed, 4 Aug 2021 00:27:11 GMT Message-Id: <202108040027.1740RB99055019@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 311759c5363d - stable/13 - RELNOTES: Add entries for commits 9fb6e613373c and 9ec7dbf46b0a 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 311759c5363dbb8ee649722bf33bdba7158bbef0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Aug 2021 00:27:11 -0000 The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=311759c5363dbb8ee649722bf33bdba7158bbef0 commit 311759c5363dbb8ee649722bf33bdba7158bbef0 Author: Rick Macklem AuthorDate: 2021-08-04 00:24:23 +0000 Commit: Rick Macklem CommitDate: 2021-08-04 00:24:23 +0000 RELNOTES: Add entries for commits 9fb6e613373c and 9ec7dbf46b0a This is a direct commit. --- RELNOTES | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/RELNOTES b/RELNOTES index 376615308ada..100e005d253a 100644 --- a/RELNOTES +++ b/RELNOTES @@ -10,6 +10,29 @@ newline. Entries should be separated by a newline. Changes to this file should not be MFCed. +9fb6e613373c: + Add a sysctl called vfs.nfsd.srvmaxio that can be used to + increase the NFS server's maximum I/O size from 128Kbytes + to any power of 2 up to 1Mbyte. It can only be set when + the nfsd threads are not running and will normally require + an increase in kern.ipc.maxsockbuf to at least the value + recommended by the console log message generated when + setting vfs.nfsd.srvmaxio is first attempted. + +9ec7dbf46b0a: + Add a new NFSv4.1/4.2 mount option "nconnect" that can + be used to specify the number of TCP connections that + will be used for the mount, up to a maximum of 16. + The first (default) TCP connection will be used for + all RPCs that consist of small RPC messages. + The RPCs that can consist of large RPC messages + (Read/Readdir/ReaddirPlus/Write) will be sent on the + additional TCP connections in a round robin fashion. + If either the NFS client or NFS server have multiple + network interfaces aggregated together or a network + interface that uses multiple queues, this can increase + NFS performance for the mount. + various: One True Awk has been updated to the latest from upstream (20210215). All the FreeBSD patches, but one, have now been From owner-dev-commits-src-all@freebsd.org Wed Aug 4 02:11:34 2021 Return-Path: Delivered-To: dev-commits-src-all@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 E3930655335; Wed, 4 Aug 2021 02:11: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 4GfZx25x9zz4jLq; Wed, 4 Aug 2021 02:11: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 B42EE1E3B5; Wed, 4 Aug 2021 02:11: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 1742BYLZ099561; Wed, 4 Aug 2021 02:11:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1742BYum099560; Wed, 4 Aug 2021 02:11:34 GMT (envelope-from git) Date: Wed, 4 Aug 2021 02:11:34 GMT Message-Id: <202108040211.1742BYum099560@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: e94f1a0a37fd - main - Revert "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: e94f1a0a37fdd3252201aaa5a94f46da7f8e740e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Aug 2021 02:11:35 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=e94f1a0a37fdd3252201aaa5a94f46da7f8e740e commit e94f1a0a37fdd3252201aaa5a94f46da7f8e740e Author: Warner Losh AuthorDate: 2021-08-04 02:09:18 +0000 Commit: Warner Losh CommitDate: 2021-08-04 02:10:32 +0000 Revert "arm: remove fslsdma from GENERIC" The firmware was already in the tree when I did this commit, and I missed the message. The bug was obsolete. This reverts commit 9e3761d126c5c019d6c935e83989928eb1a0e76e. PR: 237466 Sponsored by: Netflix --- sys/arm/conf/GENERIC | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/arm/conf/GENERIC b/sys/arm/conf/GENERIC index 34876e285f8d..427f354d1f93 100644 --- a/sys/arm/conf/GENERIC +++ b/sys/arm/conf/GENERIC @@ -258,6 +258,7 @@ device ti_pruss device ti_mbox # DMA controller +device fslsdma device ti_sdma device a10_dmac device a31_dmac From owner-dev-commits-src-all@freebsd.org Wed Aug 4 02:13:42 2021 Return-Path: Delivered-To: dev-commits-src-all@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 315F7655597; Wed, 4 Aug 2021 02:13: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 4GfZzV0tJHz4jXl; Wed, 4 Aug 2021 02:13: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 060EB1E8CA; Wed, 4 Aug 2021 02:13: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 1742Df8E000876; Wed, 4 Aug 2021 02:13:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1742DfBo000875; Wed, 4 Aug 2021 02:13:41 GMT (envelope-from git) Date: Wed, 4 Aug 2021 02:13:41 GMT Message-Id: <202108040213.1742DfBo000875@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: efc3ebeb6938 - stable/13 - Revert "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/stable/13 X-Git-Reftype: branch X-Git-Commit: efc3ebeb69383a9b54f2670d8f705fd2410904b4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Aug 2021 02:13:42 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=efc3ebeb69383a9b54f2670d8f705fd2410904b4 commit efc3ebeb69383a9b54f2670d8f705fd2410904b4 Author: Warner Losh AuthorDate: 2021-08-04 02:09:18 +0000 Commit: Warner Losh CommitDate: 2021-08-04 02:12:22 +0000 Revert "arm: remove fslsdma from GENERIC" The firmware was already in the tree when I did this commit, and I missed the message. The bug was obsolete. This reverts commit 9e3761d126c5c019d6c935e83989928eb1a0e76e. The commit was f219c053852d82acb9852cd735c815ba315f416d in stable/13. PR: 237466 Sponsored by: Netflix (cherry picked from commit e94f1a0a37fdd3252201aaa5a94f46da7f8e740e) --- sys/arm/conf/GENERIC | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/arm/conf/GENERIC b/sys/arm/conf/GENERIC index bc191d86dd59..165f707106f4 100644 --- a/sys/arm/conf/GENERIC +++ b/sys/arm/conf/GENERIC @@ -258,6 +258,7 @@ device ti_pruss device ti_mbox # DMA controller +device fslsdma device ti_sdma device a10_dmac device a31_dmac From owner-dev-commits-src-all@freebsd.org Wed Aug 4 08:15:56 2021 Return-Path: Delivered-To: dev-commits-src-all@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 2E432659CD9; Wed, 4 Aug 2021 08:15: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 4Gfl1R5Wthz3J6q; Wed, 4 Aug 2021 08:15: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 A5D48235C8; Wed, 4 Aug 2021 08:15: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 1748FtUb083617; Wed, 4 Aug 2021 08:15:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1748Ftg3083616; Wed, 4 Aug 2021 08:15:55 GMT (envelope-from git) Date: Wed, 4 Aug 2021 08:15:55 GMT Message-Id: <202108040815.1748Ftg3083616@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Tom Jones Subject: git: 64a0116cd008 - stable/13 - Correct section reference for examples in RFC3542 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: thj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 64a0116cd0086bb5ee08a8a1ddd8267ce81b6826 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Aug 2021 08:15:56 -0000 The branch stable/13 has been updated by thj: URL: https://cgit.FreeBSD.org/src/commit/?id=64a0116cd0086bb5ee08a8a1ddd8267ce81b6826 commit 64a0116cd0086bb5ee08a8a1ddd8267ce81b6826 Author: Tom Jones AuthorDate: 2021-08-01 12:52:07 +0000 Commit: Tom Jones CommitDate: 2021-08-04 08:15:27 +0000 Correct section reference for examples in RFC3542 Reviewed by: bz, network MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D26272 (cherry picked from commit 44752e92e134167e9a0ecd277e32608a5595e6d1) --- lib/libc/net/inet6_opt_init.3 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libc/net/inet6_opt_init.3 b/lib/libc/net/inet6_opt_init.3 index 671346818470..484767f781fa 100644 --- a/lib/libc/net/inet6_opt_init.3 +++ b/lib/libc/net/inet6_opt_init.3 @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 23, 2004 +.Dd August 1, 2021 .Dt INET6_OPT_INIT 3 .Os .\" @@ -305,7 +305,7 @@ All the functions return on an error. .\" .Sh EXAMPLES -RFC3542 gives comprehensive examples in Section 23. +RFC3542 gives comprehensive examples in Section 22. .Pp KAME also provides examples in the .Pa advapitest From owner-dev-commits-src-all@freebsd.org Wed Aug 4 08:16:36 2021 Return-Path: Delivered-To: dev-commits-src-all@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 24E12659967; Wed, 4 Aug 2021 08:16:36 +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 4Gfl2D0bP4z3JHW; Wed, 4 Aug 2021 08:16:36 +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 F1A4B235C9; Wed, 4 Aug 2021 08:16: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 1748GZZE083774; Wed, 4 Aug 2021 08:16:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1748GZeG083773; Wed, 4 Aug 2021 08:16:35 GMT (envelope-from git) Date: Wed, 4 Aug 2021 08:16:35 GMT Message-Id: <202108040816.1748GZeG083773@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Tom Jones Subject: git: c94af0dbb7c7 - stable/12 - Correct section reference for examples in RFC3542 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: thj X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: c94af0dbb7c79978433662a1d31d1e50f86e4515 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Aug 2021 08:16:36 -0000 The branch stable/12 has been updated by thj: URL: https://cgit.FreeBSD.org/src/commit/?id=c94af0dbb7c79978433662a1d31d1e50f86e4515 commit c94af0dbb7c79978433662a1d31d1e50f86e4515 Author: Tom Jones AuthorDate: 2021-08-01 12:52:07 +0000 Commit: Tom Jones CommitDate: 2021-08-04 08:16:15 +0000 Correct section reference for examples in RFC3542 Reviewed by: bz, network MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D26272 (cherry picked from commit 44752e92e134167e9a0ecd277e32608a5595e6d1) --- lib/libc/net/inet6_opt_init.3 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libc/net/inet6_opt_init.3 b/lib/libc/net/inet6_opt_init.3 index 671346818470..484767f781fa 100644 --- a/lib/libc/net/inet6_opt_init.3 +++ b/lib/libc/net/inet6_opt_init.3 @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 23, 2004 +.Dd August 1, 2021 .Dt INET6_OPT_INIT 3 .Os .\" @@ -305,7 +305,7 @@ All the functions return on an error. .\" .Sh EXAMPLES -RFC3542 gives comprehensive examples in Section 23. +RFC3542 gives comprehensive examples in Section 22. .Pp KAME also provides examples in the .Pa advapitest From owner-dev-commits-src-all@freebsd.org Wed Aug 4 10:12:19 2021 Return-Path: Delivered-To: dev-commits-src-all@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 021CF65B450; Wed, 4 Aug 2021 10:12: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 4Gfnbk6Tvfz3NnZ; Wed, 4 Aug 2021 10:12:18 +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 C6F1724E38; Wed, 4 Aug 2021 10:12:18 +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 174ACImq042954; Wed, 4 Aug 2021 10:12:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 174ACIFh042953; Wed, 4 Aug 2021 10:12:18 GMT (envelope-from git) Date: Wed, 4 Aug 2021 10:12:18 GMT Message-Id: <202108041012.174ACIFh042953@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ka Ho Ng Subject: git: 21d854658801 - main - sound: Add an example of basic sound application MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: khng X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 21d854658801f6ddb91de3a3c3384e90f5d920f2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Aug 2021 10:12:19 -0000 The branch main has been updated by khng: URL: https://cgit.FreeBSD.org/src/commit/?id=21d854658801f6ddb91de3a3c3384e90f5d920f2 commit 21d854658801f6ddb91de3a3c3384e90f5d920f2 Author: Goran Mekić AuthorDate: 2021-08-04 10:04:54 +0000 Commit: Ka Ho Ng CommitDate: 2021-08-04 10:11:54 +0000 sound: Add an example of basic sound application This is an example demonstrating the usage of the OSS-compatible APIs provided by the sound(4) subsystem. It reads frames from a dsp node and writes them to the same dsp node. MFC after: 2 weeks Reviewed by: hselasky, bcr Differential revision: https://reviews.freebsd.org/D30149 --- share/examples/Makefile | 7 ++ share/examples/sound/README | 66 +++++++++++ share/examples/sound/basic.c | 99 ++++++++++++++++ share/examples/sound/ossinit.h | 262 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 434 insertions(+) diff --git a/share/examples/Makefile b/share/examples/Makefile index f4273d2266f0..1d916f344b77 100644 --- a/share/examples/Makefile +++ b/share/examples/Makefile @@ -30,6 +30,7 @@ LDIRS= BSD_daemon \ printing \ ses \ scsi_target \ + sound \ sunrpc \ ypldap @@ -315,6 +316,12 @@ SE_SCSI_TARGET= \ scsi_target.8 \ scsi_cmds.c +SE_DIRS+= sound +SE_SOUND= \ + basic.c \ + ossinit.h \ + README + SE_DIRS+= sunrpc SE_SUNRPC= Makefile diff --git a/share/examples/sound/README b/share/examples/sound/README new file mode 100644 index 000000000000..0188a26348c8 --- /dev/null +++ b/share/examples/sound/README @@ -0,0 +1,66 @@ +Briefly summarised, a general audio application will: +- open(2) +- ioctl(2) +- read(2) +- write(2) +- close(2) + +In this example, read/write will be called in a loop for a duration of +record/playback. Usually, /dev/dsp is the device you want to open, but it can +be any OSS compatible device, even user space one created with virtual_oss. For +configuring sample rate, bit depth and all other configuring of the device +ioctl is used. As devices can support multiple sample rates and formats, what +specific application should do in case there's an error issuing ioctl, as not +all errors are fatal, is upon the developer to decide. As a general guideline +Official OSS development howto should be used. FreeBSD OSS and virtual_oss are +different to a small degree. + +For more advanced OSS and real-time applications, developers need to handle +buffers more carefully. The size of the buffer in OSS is selected using fragment +size size_selector and the buffer size is 2^size_selector for values between 4 +and 16. The formula on the official site is: + +int frag = (max_fragments << 16) | (size_selector); +ioctl(fd, SNDCTL_DSP_SETFRAGMENT, &frag); + +The max_fragments determines in how many fragments the buffer will be, hence if +the size_selector is 4, the requested size is 2^4 = 16 and for the +max_fragments of 2, the total buffer size will be + +(2 ^ size_selector) * max_fragments + +or in this case 32 bytes. Please note that size of buffer is in bytes not +samples. For example, 24bit sample will be represented with 3 bytes. If you're +porting audio app from Linux, you should be aware that 24 bit samples are +represented with 4 bytes (usually int). + +FreeBSD kernel will round up max_fragments and size of fragment/buffer, so the +last thing any OSS code should do is get info about buffer with audio_buf_info +and SNDCTL_DSP_GETOSPACE. That also means that not all values of max_fragments +are permitted. + +From kernel perspective, there are few points OSS developers should be aware of: +- There is a software facing buffer (bs) and a hardware driver buffer (b) +- The sizes can be seen with cat /dev/sndstat as [b:_/_/_] [bs:_/_/_] (needed: + sysctl hw.snd.verbose=2) +- OSS ioctl only concern software buffer fragments, not hardware + +For USB the block size is according to hw.usb.uaudio.buffer_ms sysctl, meaning +2ms at 48kHz gives 0.002 * 48000 = 96 samples per block, all multiples of this +work well. Block size for virtual_oss, if used, should be set accordingly. + +OSS driver insists on reading / writing a certain number of samples at a time, +one fragment full of samples. It is bound to do so in a fixed time frame, to +avoid under- and overruns in communication with the hardware. + +The idea of a total buffer size that holds max_fragments fragments is to give +some slack and allow application to be about max_fragments - 1 fragments late. +Let's call this the jitter tolerance. The jitter tolerance may be much less if +there is a slight mismatch between the period and the samples per fragment. + +Jitter tolerance gets better if we can make either the period or the samples +per fragment considerably smaller than the other. In our case that means we +divide the total buffer size into smaller fragments, keeping overall latency at +the same level. + +Official OSS development howto: http://manuals.opensound.com/developer/DSP.html diff --git a/share/examples/sound/basic.c b/share/examples/sound/basic.c new file mode 100644 index 000000000000..c903cbd8bf11 --- /dev/null +++ b/share/examples/sound/basic.c @@ -0,0 +1,99 @@ +/* + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2021 Goran Mekić + * + * 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 "ossinit.h" + +int +main() +{ + config_t config = { + .device = "/dev/dsp", + .channels = -1, + .format = format, + .frag = -1, + .sample_rate = 48000, + .sample_size = sizeof(sample_t), + .buffer_info.fragments = -1, + .mmap = 0, + }; + + /* Initialize device */ + oss_init(&config); + + /* + * Allocate input and output buffers so that their size match + * frag_size + */ + int ret; + int bytes = config.buffer_info.bytes; + int8_t *ibuf = malloc(bytes); + int8_t *obuf = malloc(bytes); + sample_t *channels = malloc(bytes); + + printf( + "bytes: %d, fragments: %d, fragsize: %d, fragstotal: %d, samples: %d\n", + bytes, + config.buffer_info.fragments, + config.buffer_info.fragsize, + config.buffer_info.fragstotal, + config.sample_count + ); + + /* Minimal engine: read input and copy it to the output */ + for (;;) { + ret = read(config.fd, ibuf, bytes); + if (ret < bytes) { + fprintf( + stderr, + "Requested %d bytes, but read %d!\n", + bytes, + ret + ); + break; + } + oss_split(&config, (sample_t *)ibuf, channels); + /* All processing will happen here */ + oss_merge(&config, channels, (sample_t *)obuf); + ret = write(config.fd, obuf, bytes); + if (ret < bytes) { + fprintf( + stderr, + "Requested %d bytes, but wrote %d!\n", + bytes, + ret + ); + break; + } + } + + /* Cleanup */ + free(channels); + free(obuf); + free(ibuf); + close(config.fd); + return (0); +} diff --git a/share/examples/sound/ossinit.h b/share/examples/sound/ossinit.h new file mode 100644 index 000000000000..b5fbd3e99244 --- /dev/null +++ b/share/examples/sound/ossinit.h @@ -0,0 +1,262 @@ +/* + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2021 Goran Mekić + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include +#include +#include + + +#ifndef SAMPLE_SIZE +#define SAMPLE_SIZE 16 +#endif + +/* Format can be unsigned, in which case replace S with U */ +#if SAMPLE_SIZE == 32 +typedef int32_t sample_t; +int format = AFMT_S32_NE; /* Signed 32bit native endian format */ +#elif SAMPLE_SIZE == 16 +typedef int16_t sample_t; +int format = AFMT_S16_NE; /* Signed 16bit native endian format */ +#elif SAMPLE_SIZE == 8 +typedef int8_t sample_t; +int format = AFMT_S8_NE; /* Signed 8bit native endian format */ +#else +#error Unsupported sample format! +typedef int32_t sample_t; +int format = AFMT_S32_NE; /* Not a real value, just silencing + * compiler errors */ +#endif + + + +/* + * Minimal configuration for OSS + * For real world applications, this structure will probably contain many + * more fields + */ +typedef struct config { + char *device; + int channels; + int fd; + int format; + int frag; + int sample_count; + int sample_rate; + int sample_size; + int chsamples; + int mmap; + oss_audioinfo audio_info; + audio_buf_info buffer_info; +} config_t; + + +/* + * Error state is indicated by value=-1 in which case application exits + * with error + */ +static inline void +check_error(const int value, const char *message) +{ + if (value == -1) { + fprintf(stderr, "OSS error: %s %s\n", message, strerror(errno)); + exit(1); + } +} + + + +/* Calculate frag by giving it minimal size of buffer */ +static inline int +size2frag(int x) +{ + int frag = 0; + + while ((1 << frag) < x) { + ++frag; + } + return frag; +} + + +/* + * Split input buffer into channels. Input buffer is in interleaved format + * which means if we have 2 channels (L and R), this is what the buffer of + * 8 samples would contain: L,R,L,R,L,R,L,R. The result are two channels + * containing: L,L,L,L and R,R,R,R. + */ +void +oss_split(config_t *config, sample_t *input, sample_t *output) +{ + int channel; + int index; + + for (int i = 0; i < config->sample_count; ++i) { + channel = i % config->channels; + index = i / config->channels; + output[channel * index] = input[i]; + } +} + + +/* + * Convert channels into interleaved format and place it in output + * buffer + */ +void +oss_merge(config_t *config, sample_t *input, sample_t *output) +{ + for (int channel = 0; channel < config->channels; ++channel) { + for (int index = 0; index < config->chsamples; ++index) { + output[index * config->channels + channel] = input[channel * index]; + } + } +} + +void +oss_init(config_t *config) +{ + int error; + int tmp; + + /* Open the device for read and write */ + config->fd = open(config->device, O_RDWR); + check_error(config->fd, "open"); + + /* Get device information */ + config->audio_info.dev = -1; + error = ioctl(config->fd, SNDCTL_ENGINEINFO, &(config->audio_info)); + check_error(error, "SNDCTL_ENGINEINFO"); + printf("min_channels: %d\n", config->audio_info.min_channels); + printf("max_channels: %d\n", config->audio_info.max_channels); + printf("latency: %d\n", config->audio_info.latency); + printf("handle: %s\n", config->audio_info.handle); + if (config->audio_info.min_rate > config->sample_rate || config->sample_rate > config->audio_info.max_rate) { + fprintf(stderr, "%s doesn't support chosen ", config->device); + fprintf(stderr, "samplerate of %dHz!\n", config->sample_rate); + exit(1); + } + if (config->channels < 1) { + config->channels = config->audio_info.max_channels; + } + + /* + * If device is going to be used in mmap mode, disable all format + * conversions. Official OSS documentation states error code should not be + * checked. http://manuals.opensound.com/developer/mmap_test.c.html#LOC10 + */ + if (config->mmap) { + tmp = 0; + ioctl(config->fd, SNDCTL_DSP_COOKEDMODE, &tmp); + } + + /* + * Set number of channels. If number of channels is chosen to the value + * near the one wanted, save it in config + */ + tmp = config->channels; + error = ioctl(config->fd, SNDCTL_DSP_CHANNELS, &tmp); + check_error(error, "SNDCTL_DSP_CHANNELS"); + if (tmp != config->channels) { /* or check if tmp is close enough? */ + fprintf(stderr, "%s doesn't support chosen ", config->device); + fprintf(stderr, "channel count of %d", config->channels); + fprintf(stderr, ", set to %d!\n", tmp); + } + config->channels = tmp; + + /* Set format, or bit size: 8, 16, 24 or 32 bit sample */ + tmp = config->format; + error = ioctl(config->fd, SNDCTL_DSP_SETFMT, &tmp); + check_error(error, "SNDCTL_DSP_SETFMT"); + if (tmp != config->format) { + fprintf(stderr, "%s doesn't support chosen sample format!\n", config->device); + exit(1); + } + + /* Most common values for samplerate (in kHz): 44.1, 48, 88.2, 96 */ + tmp = config->sample_rate; + error = ioctl(config->fd, SNDCTL_DSP_SPEED, &tmp); + check_error(error, "SNDCTL_DSP_SPEED"); + + /* Get and check device capabilities */ + error = ioctl(config->fd, SNDCTL_DSP_GETCAPS, &(config->audio_info.caps)); + check_error(error, "SNDCTL_DSP_GETCAPS"); + if (!(config->audio_info.caps & PCM_CAP_DUPLEX)) { + fprintf(stderr, "Device doesn't support full duplex!\n"); + exit(1); + } + if (config->mmap) { + if (!(config->audio_info.caps & PCM_CAP_TRIGGER)) { + fprintf(stderr, "Device doesn't support triggering!\n"); + exit(1); + } + if (!(config->audio_info.caps & PCM_CAP_MMAP)) { + fprintf(stderr, "Device doesn't support mmap mode!\n"); + exit(1); + } + } + + /* + * If desired frag is smaller than minimum, based on number of channels + * and format (size in bits: 8, 16, 24, 32), set that as frag. Buffer size + * is 2^frag, but the real size of the buffer will be read when the + * configuration of the device is successfull + */ + int min_frag = size2frag(config->sample_size * config->channels); + + if (config->frag < min_frag) { + config->frag = min_frag; + } + + /* + * Allocate buffer in fragments. Total buffer will be split in number + * of fragments (2 by default) + */ + if (config->buffer_info.fragments < 0) { + config->buffer_info.fragments = 2; + } + tmp = ((config->buffer_info.fragments) << 16) | config->frag; + error = ioctl(config->fd, SNDCTL_DSP_SETFRAGMENT, &tmp); + check_error(error, "SNDCTL_DSP_SETFRAGMENT"); + + /* When all is set and ready to go, get the size of buffer */ + error = ioctl(config->fd, SNDCTL_DSP_GETOSPACE, &(config->buffer_info)); + check_error(error, "SNDCTL_DSP_GETOSPACE"); + if (config->buffer_info.bytes < 1) { + fprintf( + stderr, + "OSS buffer error: buffer size can not be %d\n", + config->buffer_info.bytes + ); + exit(1); + } + config->sample_count = config->buffer_info.bytes / config->sample_size; + config->chsamples = config->sample_count / config->channels; +} From owner-dev-commits-src-all@freebsd.org Wed Aug 4 13:44:34 2021 Return-Path: Delivered-To: dev-commits-src-all@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 2FA8065ECA0; Wed, 4 Aug 2021 13:44:34 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4GftJd6PClz3vND; Wed, 4 Aug 2021 13:44:33 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id 174DiVeu052683; Wed, 4 Aug 2021 06:44:31 -0700 (PDT) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id 174DiVr0052682; Wed, 4 Aug 2021 06:44:31 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <202108041344.174DiVr0052682@gndrsh.dnsmgr.net> Subject: Re: git: 184d64af1344 - main - locales: stop hardcoding the directories in the mtree In-Reply-To: <1acb127e-1d2c-4c9f-96e6-23bfbf9695ac@FreeBSD.org> To: Baptiste Daroussin Date: Wed, 4 Aug 2021 06:44:31 -0700 (PDT) CC: "Rodney W. Grimes" , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 4GftJd6PClz3vND 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Aug 2021 13:44:34 -0000 > 3 ao?t 2021 19:32:44 Rodney W. Grimes : > > >> The branch main has been updated by bapt: > >> > >> URL: https://cgit.FreeBSD.org/src/commit/?id=184d64af1344d6f3c370499510cede49320f4863 > >> > >> commit 184d64af1344d6f3c370499510cede49320f4863 > >> Author:???? Baptiste Daroussin > >> AuthorDate: 2021-08-03 12:25:00 +0000 > >> Commit:???? Baptiste Daroussin > >> CommitDate: 2021-08-03 12:25:00 +0000 > >> > >> ??? locales: stop hardcoding the directories in the mtree > >> ??? > >> ??? The framework knows how to create directories and tag them properly > >> ??? for a the creation of a mtree, not need to hardcode all the locales > >> ??? entries in bsd.usr.mk > >> ??? > >> ??? This simplifies addition of new locales but also allow people building > >> ??? with WITHOUT_LOCALES to end up with a directory full of empty files > > > > The uses of /etc/mtree go beyond the simple directory creation, > > please cause something to build a BSD.locale.dist file and install > > it in /etc/mtree to replace the functionality removal you have > > just performed. > > > > Thanks, > > Rod > > > > Please provide a valid use case not working anymore after this change and I will consider. >From mtree(1): The mtree utility compares a file hierarchy against a specification, Since the shipped specification is now incomplete it can no longer be used to do validate the hiararchy of a system against RELEASED /etc/mtree files. > > Note that this is not the only part of the tree where the same thing is done. More regression does not make regression right. > Best, > Bapt -- Rod Grimes rgrimes@freebsd.org From owner-dev-commits-src-all@freebsd.org Wed Aug 4 14:29:51 2021 Return-Path: Delivered-To: dev-commits-src-all@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 891A665F590 for ; Wed, 4 Aug 2021 14:29:51 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk1-x72e.google.com (mail-qk1-x72e.google.com [IPv6:2607:f8b0:4864:20::72e]) (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 4GfvJv2CHgz4R3g for ; Wed, 4 Aug 2021 14:29:51 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x72e.google.com with SMTP id e14so2910562qkg.3 for ; Wed, 04 Aug 2021 07:29:51 -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=rxzb+z2276c5kgOp0/4sIu5xq45BT+FHvbn/l9bvtsA=; b=wuGDY8hBogFxCjbn2/DiH5CyQrZhbqC38A97Vp1Avr3sD6i5P2boOlTw2vtGl0oHpt nhtyARG7LrvVirf7xhA75dwkmeie0CnSCgQHmCus2KxRowAoykwuCbQYjPa5SvvsHygh UH6fJQLhkAlC5iRqrmJ26ctsDmaeCqjKQr2EEfV6pV+/eCo/DttJzFnuCkaDPw2e0GSt c6rCFbRVoS9QLEIpZQsdGqe9wJ/8Row7GVEBFw3oAUVNmA+QyKEov+xnD6XnQkRwbU3V Vyhti7ySeK0V/95y+PBaMNHiyny8pSAv5if8P4smT405L/07z1OD7bU78iJnTcNfmvKB ibhQ== 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=rxzb+z2276c5kgOp0/4sIu5xq45BT+FHvbn/l9bvtsA=; b=EvpR2GJ8F5/LQT604V79u/2XOGUREMoAcfX57ociCFsNnkObfhV+hsDAXa5TjTwczo CnJ6PZf1Yxuq3RZdCjXZgbv/X10O2ULxcV2HWAfyAHRSpApzgnCc/PGJ2D+uNrWAT5VX G/NVphITFZBHxyNqnltnYzqHsm4n0TW+F5zWRzYXFsOVrux4i1YL9aB5L60HrrMInS/M 6Rhxbm5iYw9xxoJVo7L4WJ8gihDWxMNimod9IEafOwcDihTkufKpO1eY//WzM8Ykz9aD iInl0ElYfv66I1IzSpqnIsb0S1ulnwPvPFi0jj11UkcPrtQC4RBqHdbMhcEaUkUSCy5W DZ/w== X-Gm-Message-State: AOAM532necLATLPHVEDxfd//y2YUYIoYXmKeyAAZIRGz4Fm3mD40InTk W/WyP+8gFDTu0qdsBohDJKHM6iGODkA43If9CCZtDg== X-Google-Smtp-Source: ABdhPJwvjObZ1tgEEjkaHfOeDiuydFrQeJvejnx1acp3XoogTDgn3l8XRtUEdxvgT91l6QO/hRJIhwfIsZb6DTI/EHI= X-Received: by 2002:a37:802:: with SMTP id 2mr26474653qki.89.1628087385371; Wed, 04 Aug 2021 07:29:45 -0700 (PDT) MIME-Version: 1.0 References: <1acb127e-1d2c-4c9f-96e6-23bfbf9695ac@FreeBSD.org> <202108041344.174DiVr0052682@gndrsh.dnsmgr.net> In-Reply-To: <202108041344.174DiVr0052682@gndrsh.dnsmgr.net> From: Warner Losh Date: Wed, 4 Aug 2021 08:29:34 -0600 Message-ID: Subject: Re: git: 184d64af1344 - main - locales: stop hardcoding the directories in the mtree To: "Rodney W. Grimes" Cc: Baptiste Daroussin , src-committers , "" , dev-commits-src-main@freebsd.org X-Rspamd-Queue-Id: 4GfvJv2CHgz4R3g 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Aug 2021 14:29:51 -0000 On Wed, Aug 4, 2021 at 7:44 AM Rodney W. Grimes wrote: > > 3 ao?t 2021 19:32:44 Rodney W. Grimes : > > > > >> The branch main has been updated by bapt: > > >> > > >> URL: > https://cgit.FreeBSD.org/src/commit/?id=184d64af1344d6f3c370499510cede49320f4863 > > >> > > >> commit 184d64af1344d6f3c370499510cede49320f4863 > > >> Author:???? Baptiste Daroussin > > >> AuthorDate: 2021-08-03 12:25:00 +0000 > > >> Commit:???? Baptiste Daroussin > > >> CommitDate: 2021-08-03 12:25:00 +0000 > > >> > > >> ??? locales: stop hardcoding the directories in the mtree > > >> ??? > > >> ??? The framework knows how to create directories and tag them > properly > > >> ??? for a the creation of a mtree, not need to hardcode all the > locales > > >> ??? entries in bsd.usr.mk > > >> ??? > > >> ??? This simplifies addition of new locales but also allow people > building > > >> ??? with WITHOUT_LOCALES to end up with a directory full of empty > files > > > > > > The uses of /etc/mtree go beyond the simple directory creation, > > > please cause something to build a BSD.locale.dist file and install > > > it in /etc/mtree to replace the functionality removal you have > > > just performed. > > > > > > Thanks, > > > Rod > > > > > > > Please provide a valid use case not working anymore after this change > and I will consider. > > From mtree(1): > The mtree utility compares a file hierarchy against a > specification, > > Since the shipped specification is now incomplete it can no longer be used > to do validate the hiararchy of a system against RELEASED /etc/mtree files. > install -d broke this at least a decade or more ago. Most people really don't care outside of things in /var getting created since validating directories is of such little functionality w/o also validating binaries and such. It's used in bsd.files.mk which is included by lots of things in the tree. > Note that this is not the only part of the tree where the same thing is > done. > > More regression does not make regression right. > The decision was made a long time ago to leave this feature behind, though you can still get it today if you do a NO_ROOT build because that creates a metafile that includes both directories and files for the system. pkg base uses that to generate its packages. NO_ROOT builds are better anyway, because it also lets you tag each file / directory on a per-package basis so you don't have them if you don't install a specific package. Warner > > Best, > > Bapt > -- > Rod Grimes > rgrimes@freebsd.org > From owner-dev-commits-src-all@freebsd.org Wed Aug 4 15:40:30 2021 Return-Path: Delivered-To: dev-commits-src-all@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 ABCAA65FCE4; Wed, 4 Aug 2021 15:40:30 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4GfwtQ2K2Sz4Tf9; Wed, 4 Aug 2021 15:40:30 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id 174FeQGL053048; Wed, 4 Aug 2021 08:40:26 -0700 (PDT) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id 174FeQme053047; Wed, 4 Aug 2021 08:40:26 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <202108041540.174FeQme053047@gndrsh.dnsmgr.net> Subject: Re: git: 184d64af1344 - main - locales: stop hardcoding the directories in the mtree In-Reply-To: To: Warner Losh Date: Wed, 4 Aug 2021 08:40:26 -0700 (PDT) CC: "Rodney W. Grimes" , Baptiste Daroussin , src-committers , "" , dev-commits-src-main@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 4GfwtQ2K2Sz4Tf9 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Aug 2021 15:40:30 -0000 [ Charset UTF-8 unsupported, converting... ] > On Wed, Aug 4, 2021 at 7:44 AM Rodney W. Grimes > wrote: > > > > 3 ao?t 2021 19:32:44 Rodney W. Grimes : > > > > > > >> The branch main has been updated by bapt: > > > >> > > > >> URL: > > https://cgit.FreeBSD.org/src/commit/?id=184d64af1344d6f3c370499510cede49320f4863 > > > >> > > > >> commit 184d64af1344d6f3c370499510cede49320f4863 > > > >> Author:???? Baptiste Daroussin > > > >> AuthorDate: 2021-08-03 12:25:00 +0000 > > > >> Commit:???? Baptiste Daroussin > > > >> CommitDate: 2021-08-03 12:25:00 +0000 > > > >> > > > >> ??? locales: stop hardcoding the directories in the mtree > > > >> ??? > > > >> ??? The framework knows how to create directories and tag them > > properly > > > >> ??? for a the creation of a mtree, not need to hardcode all the > > locales > > > >> ??? entries in bsd.usr.mk > > > >> ??? > > > >> ??? This simplifies addition of new locales but also allow people > > building > > > >> ??? with WITHOUT_LOCALES to end up with a directory full of empty > > files > > > > > > > > The uses of /etc/mtree go beyond the simple directory creation, > > > > please cause something to build a BSD.locale.dist file and install > > > > it in /etc/mtree to replace the functionality removal you have > > > > just performed. > > > > > > > > Thanks, > > > > Rod > > > > > > > > > > Please provide a valid use case not working anymore after this change > > and I will consider. > > > > From mtree(1): > > The mtree utility compares a file hierarchy against a > > specification, > > > > Since the shipped specification is now incomplete it can no longer be used > > to do validate the hiararchy of a system against RELEASED /etc/mtree files. > > > > install -d broke this at least a decade or more ago. install -d did not break this, use of install -d does not preclude maintaining mtree files. install -d is only used in a few places. > Most people really > don't > care outside of things in /var getting created since validating directories > is > of such little functionality w/o also validating binaries and such. It's > used > in bsd.files.mk which is included by lots of things in the tree. So we only catter to "some people" is what your saying, since "most people" dont care? > > > Note that this is not the only part of the tree where the same thing is > > done. > > > > More regression does not make regression right. > > > > The decision was made a long time ago to leave this feature behind, though > you can still get it today if you do a NO_ROOT build because that creates a > metafile that includes both directories and files for the system. pkg base > uses > that to generate its packages. NO_ROOT builds are better anyway, because > it also lets you tag each file / directory on a per-package basis so you > don't > have them if you don't install a specific package. This "feature" and mtree has NOT been left behind. Make hierarchy and the mtree files are still very much being used by the build and release process. And again, age of regression does not make regression correct. We are often "fixing" 20 year old bugs, should we stop fixing them cause they are "old"? More "death by a 1000 prickly sticks" cause developers dont use every feature that users do and some users like the features they have been using to continue to be usable. > Warner > > > Best, Bapt > > Rod Grimes > > rgrimes@freebsd.org -- Rod Grimes rgrimes@freebsd.org From owner-dev-commits-src-all@freebsd.org Wed Aug 4 17:16:54 2021 Return-Path: Delivered-To: dev-commits-src-all@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 DB9AD651C80; Wed, 4 Aug 2021 17:16: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 4Gfz1f5kcwz4bjc; Wed, 4 Aug 2021 17:16: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 A8EAB2980; Wed, 4 Aug 2021 17:16: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 174HGsJ4006971; Wed, 4 Aug 2021 17:16:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 174HGsab006970; Wed, 4 Aug 2021 17:16:54 GMT (envelope-from git) Date: Wed, 4 Aug 2021 17:16:54 GMT Message-Id: <202108041716.174HGsab006970@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: 0ef5eee9d941 - main - Add vn_lktype_write() 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: 0ef5eee9d94162ac3cefa0bd8aedf1bfa6f87192 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Aug 2021 17:16:54 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=0ef5eee9d94162ac3cefa0bd8aedf1bfa6f87192 commit 0ef5eee9d94162ac3cefa0bd8aedf1bfa6f87192 Author: Konstantin Belousov AuthorDate: 2021-08-04 02:34:48 +0000 Commit: Konstantin Belousov CommitDate: 2021-08-04 16:40:13 +0000 Add vn_lktype_write() and remove repetetive code that calculates vnode locking type for write. Reviewed by: khng, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31405 --- sys/cam/ctl/ctl_backend_block.c | 20 +++++--------------- sys/kern/vfs_syscalls.c | 10 ++-------- sys/kern/vfs_vnops.c | 34 ++++++++++++++-------------------- sys/sys/vnode.h | 1 + sys/vm/vm_pageout.c | 6 ++---- 5 files changed, 24 insertions(+), 47 deletions(-) diff --git a/sys/cam/ctl/ctl_backend_block.c b/sys/cam/ctl/ctl_backend_block.c index 4ffaf0912915..83ea6b43dac3 100644 --- a/sys/cam/ctl/ctl_backend_block.c +++ b/sys/cam/ctl/ctl_backend_block.c @@ -588,7 +588,7 @@ ctl_be_block_flush_file(struct ctl_be_block_lun *be_lun, { union ctl_io *io = beio->io; struct mount *mountpoint; - int error, lock_flags; + int error; DPRINTF("entered\n"); @@ -597,12 +597,8 @@ ctl_be_block_flush_file(struct ctl_be_block_lun *be_lun, (void) vn_start_write(be_lun->vn, &mountpoint, V_WAIT); - if (MNT_SHARED_WRITES(mountpoint) || - ((mountpoint == NULL) && MNT_SHARED_WRITES(be_lun->vn->v_mount))) - lock_flags = LK_SHARED; - else - lock_flags = LK_EXCLUSIVE; - vn_lock(be_lun->vn, lock_flags | LK_RETRY); + vn_lock(be_lun->vn, vn_lktype_write(mountpoint, be_lun->vn) | + LK_RETRY); error = VOP_FSYNC(be_lun->vn, beio->io_arg ? MNT_NOWAIT : MNT_WAIT, curthread); VOP_UNLOCK(be_lun->vn); @@ -722,16 +718,10 @@ ctl_be_block_dispatch_file(struct ctl_be_block_lun *be_lun, } } else { struct mount *mountpoint; - int lock_flags; (void)vn_start_write(be_lun->vn, &mountpoint, V_WAIT); - - if (MNT_SHARED_WRITES(mountpoint) || ((mountpoint == NULL) - && MNT_SHARED_WRITES(be_lun->vn->v_mount))) - lock_flags = LK_SHARED; - else - lock_flags = LK_EXCLUSIVE; - vn_lock(be_lun->vn, lock_flags | LK_RETRY); + vn_lock(be_lun->vn, vn_lktype_write(mountpoint, + be_lun->vn) | LK_RETRY); /* * UFS pays attention to IO_DIRECT for writes. The write diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 82629a4f5947..5701932a0163 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -3517,7 +3517,7 @@ kern_fsync(struct thread *td, int fd, bool fullsync) struct vnode *vp; struct mount *mp; struct file *fp; - int error, lock_flags; + int error; AUDIT_ARG_FD(fd); error = getvnode(td, fd, &cap_fsync_rights, &fp); @@ -3532,13 +3532,7 @@ retry: error = vn_start_write(vp, &mp, V_WAIT | PCATCH); if (error != 0) goto drop; - if (MNT_SHARED_WRITES(mp) || - ((mp == NULL) && MNT_SHARED_WRITES(vp->v_mount))) { - lock_flags = LK_SHARED; - } else { - lock_flags = LK_EXCLUSIVE; - } - vn_lock(vp, lock_flags | LK_RETRY); + vn_lock(vp, vn_lktype_write(mp, vp) | LK_RETRY); AUDIT_ARG_VNODE1(vp); if (vp->v_object != NULL) { VM_OBJECT_WLOCK(vp->v_object); diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index fc5118e8aa24..b7e53add5a35 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -653,11 +653,7 @@ vn_rdwr(enum uio_rw rw, struct vnode *vp, void *base, int len, off_t offset, (error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0) goto out; - if (MNT_SHARED_WRITES(mp) || - ((mp == NULL) && MNT_SHARED_WRITES(vp->v_mount))) - lock_flags = LK_SHARED; - else - lock_flags = LK_EXCLUSIVE; + lock_flags = vn_lktype_write(mp, vp); } else lock_flags = LK_SHARED; vn_lock(vp, lock_flags | LK_RETRY); @@ -1106,7 +1102,7 @@ vn_write(struct file *fp, struct uio *uio, struct ucred *active_cred, int flags, struct vnode *vp; struct mount *mp; off_t orig_offset; - int error, ioflag, lock_flags; + int error, ioflag; int advice; bool need_finished_write; @@ -1147,14 +1143,7 @@ vn_write(struct file *fp, struct uio *uio, struct ucred *active_cred, int flags, advice = get_advice(fp, uio); - if (MNT_SHARED_WRITES(mp) || - (mp == NULL && MNT_SHARED_WRITES(vp->v_mount))) { - lock_flags = LK_SHARED; - } else { - lock_flags = LK_EXCLUSIVE; - } - - vn_lock(vp, lock_flags | LK_RETRY); + vn_lock(vp, vn_lktype_write(mp, vp) | LK_RETRY); switch (advice) { case POSIX_FADV_NORMAL: case POSIX_FADV_SEQUENTIAL: @@ -3060,7 +3049,7 @@ vn_write_outvp(struct vnode *outvp, char *dat, off_t outoff, off_t xfer, { struct mount *mp; off_t dataoff, holeoff, xfer2; - int error, lckf; + int error; /* * Loop around doing writes of blksize until write has been completed. @@ -3099,11 +3088,7 @@ vn_write_outvp(struct vnode *outvp, char *dat, off_t outoff, off_t xfer, VOP_UNLOCK(outvp); } } else { - if (MNT_SHARED_WRITES(mp)) - lckf = LK_SHARED; - else - lckf = LK_EXCLUSIVE; - error = vn_lock(outvp, lckf); + error = vn_lock(outvp, vn_lktype_write(mp, outvp)); if (error == 0) { error = vn_rdwr(UIO_WRITE, outvp, dat, xfer2, outoff, UIO_SYSSPACE, IO_NODELOCKED, @@ -3532,3 +3517,12 @@ vn_lock_pair(struct vnode *vp1, bool vp1_locked, struct vnode *vp2, if (vp2 != NULL) ASSERT_VOP_ELOCKED(vp2, "vp2 ret"); } + +int +vn_lktype_write(struct mount *mp, struct vnode *vp) +{ + if (MNT_SHARED_WRITES(mp) || + (mp == NULL && MNT_SHARED_WRITES(vp->v_mount))) + return (LK_SHARED); + return (LK_EXCLUSIVE); +} diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index 64fb00c5845e..1f2d74fdf5f1 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -1089,6 +1089,7 @@ int vn_chown(struct file *fp, uid_t uid, gid_t gid, struct ucred *active_cred, void vn_fsid(struct vnode *vp, struct vattr *va); int vn_dir_check_exec(struct vnode *vp, struct componentname *cnp); +int vn_lktype_write(struct mount *mp, struct vnode *vp); #define VOP_UNLOCK_FLAGS(vp, flags) ({ \ struct vnode *_vp = (vp); \ diff --git a/sys/vm/vm_pageout.c b/sys/vm/vm_pageout.c index 216e76359631..9a0b295569e2 100644 --- a/sys/vm/vm_pageout.c +++ b/sys/vm/vm_pageout.c @@ -606,7 +606,7 @@ vm_pageout_clean(vm_page_t m, int *numpagedout) struct mount *mp; vm_object_t object; vm_pindex_t pindex; - int error, lockmode; + int error; object = m->object; VM_OBJECT_ASSERT_WLOCKED(object); @@ -640,9 +640,7 @@ vm_pageout_clean(vm_page_t m, int *numpagedout) vm_object_reference_locked(object); pindex = m->pindex; VM_OBJECT_WUNLOCK(object); - lockmode = MNT_SHARED_WRITES(vp->v_mount) ? - LK_SHARED : LK_EXCLUSIVE; - if (vget(vp, lockmode | LK_TIMELOCK)) { + if (vget(vp, vn_lktype_write(NULL, vp) | LK_TIMELOCK) != 0) { vp = NULL; error = EDEADLK; goto unlock_mp; From owner-dev-commits-src-all@freebsd.org Wed Aug 4 17:22:11 2021 Return-Path: Delivered-To: dev-commits-src-all@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 4F9A9651C6F; Wed, 4 Aug 2021 17:22: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 4Gfz7l01wLz4c8F; Wed, 4 Aug 2021 17:22: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 DD3BB274E; Wed, 4 Aug 2021 17:22: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 174HMApX017638; Wed, 4 Aug 2021 17:22:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 174HMAQP017637; Wed, 4 Aug 2021 17:22:10 GMT (envelope-from git) Date: Wed, 4 Aug 2021 17:22:10 GMT Message-Id: <202108041722.174HMAQP017637@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 3f244aace29b - stable/13 - Update WITHOUT_KERNEL_SYMBOLS description 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 3f244aace29b46d8d36e8272c9695811e2cc414f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Aug 2021 17:22:11 -0000 The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=3f244aace29b46d8d36e8272c9695811e2cc414f commit 3f244aace29b46d8d36e8272c9695811e2cc414f Author: Ed Maste AuthorDate: 2021-07-27 21:18:41 +0000 Commit: Ed Maste CommitDate: 2021-08-04 17:21:33 +0000 Update WITHOUT_KERNEL_SYMBOLS description We have installed kernel debug data under /usr/lib/debug/ for some time now, so the suggestion to set WITHOUT_KERNEL_SYMBOLS for small root partitions is no longer valid. Also call them "debug symbol files" rather than just "symbol files", since they contain much more than just symbols. The kernel also includes (some) symbols, regardless of the setting of this knob. MFC after: 1 week (cherry picked from commit 5f946c76c0cc2d1b4fa150f691764da163579d19) --- tools/build/options/WITHOUT_KERNEL_SYMBOLS | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tools/build/options/WITHOUT_KERNEL_SYMBOLS b/tools/build/options/WITHOUT_KERNEL_SYMBOLS index e2b3926a6e46..33fa2c4f1c97 100644 --- a/tools/build/options/WITHOUT_KERNEL_SYMBOLS +++ b/tools/build/options/WITHOUT_KERNEL_SYMBOLS @@ -1,5 +1,2 @@ .\" $FreeBSD$ -Set to not install kernel symbol files. -.Bf -symbolic -This option is recommended for those people who have small root partitions. -.Ef +Do not install kernel debug symbol files. From owner-dev-commits-src-all@freebsd.org Wed Aug 4 17:24:30 2021 Return-Path: Delivered-To: dev-commits-src-all@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 B110D652291; Wed, 4 Aug 2021 17:24: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 4GfzBQ4XxVz4cRn; Wed, 4 Aug 2021 17:24: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 84105298F; Wed, 4 Aug 2021 17:24: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 174HOUDL020294; Wed, 4 Aug 2021 17:24:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 174HOUOG020293; Wed, 4 Aug 2021 17:24:30 GMT (envelope-from git) Date: Wed, 4 Aug 2021 17:24:30 GMT Message-Id: <202108041724.174HOUOG020293@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 5f27244beb8a - stable/13 - src.conf.5: regen after 3f244aace29b 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 5f27244beb8a1943238e64f530270679fbfa8e16 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Aug 2021 17:24:30 -0000 The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=5f27244beb8a1943238e64f530270679fbfa8e16 commit 5f27244beb8a1943238e64f530270679fbfa8e16 Author: Ed Maste AuthorDate: 2021-08-04 17:24:02 +0000 Commit: Ed Maste CommitDate: 2021-08-04 17:24:02 +0000 src.conf.5: regen after 3f244aace29b --- share/man/man5/src.conf.5 | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/share/man/man5/src.conf.5 b/share/man/man5/src.conf.5 index c083d8b91cb1..a0c1b4bb8b8a 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 July 10, 2021 +.Dd August 4, 2021 .Dt SRC.CONF 5 .Os .Sh NAME @@ -811,10 +811,7 @@ and Set to enable the "retpoline" mitigation for CVE-2017-5715 in the kernel build. .It Va WITHOUT_KERNEL_SYMBOLS -Set to not install kernel symbol files. -.Bf -symbolic -This option is recommended for those people who have small root partitions. -.Ef +Do not install kernel debug symbol files. .It Va WITHOUT_KVM Set to not build the .Nm libkvm From owner-dev-commits-src-all@freebsd.org Wed Aug 4 18:18:07 2021 Return-Path: Delivered-To: dev-commits-src-all@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 6E21F653305; Wed, 4 Aug 2021 18:18:07 +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 4Gg0NH2W9mz4gwY; Wed, 4 Aug 2021 18:18:07 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro.local (ralph.baldwin.cx [66.234.199.215]) (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 5F6AA27660; Wed, 4 Aug 2021 18:18:06 +0000 (UTC) (envelope-from jhb@FreeBSD.org) To: Marcin Wojtas , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202108031008.173A83HA096670@gitrepo.freebsd.org> From: John Baldwin Subject: Re: git: 5ad6d28cbe6b - main - enetc: Support building the driver as a loadable module. Message-ID: Date: Wed, 4 Aug 2021 11:18:02 -0700 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: <202108031008.173A83HA096670@gitrepo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Aug 2021 18:18:07 -0000 On 8/3/21 3:08 AM, Marcin Wojtas wrote: > The branch main has been updated by mw: > > URL: https://cgit.FreeBSD.org/src/commit/?id=5ad6d28cbe6b3ff85e49607a7e04cb68db3ed6df > > commit 5ad6d28cbe6b3ff85e49607a7e04cb68db3ed6df > Author: Kornel Duleba > AuthorDate: 2021-07-28 09:23:23 +0000 > Commit: Marcin Wojtas > CommitDate: 2021-08-03 10:07:49 +0000 > > enetc: Support building the driver as a loadable module. > > Function level reset has to be done in attach in order to put the > hardware in a known state before configuring it. > The order of DRIVER_MODULEs was changed to ensure that the miibus driver > is loaded when mii_attach is called. > > Obtained from: Semihalf > Sponsored by: Alstom Group > --- > sys/dev/enetc/if_enetc.c | 6 +++++- > sys/modules/Makefile | 2 ++ > sys/modules/enetc/Makefile | 8 ++++++++ > 3 files changed, 15 insertions(+), 1 deletion(-) > > diff --git a/sys/dev/enetc/if_enetc.c b/sys/dev/enetc/if_enetc.c > index 54cdc6ea9ad4..46327eb419bf 100644 > --- a/sys/dev/enetc/if_enetc.c > +++ b/sys/dev/enetc/if_enetc.c > @@ -158,8 +158,8 @@ static driver_t enetc_driver = { > }; > > static devclass_t enetc_devclass; > -DRIVER_MODULE(enetc, pci, enetc_driver, enetc_devclass, NULL, NULL); > DRIVER_MODULE(miibus, enetc, miibus_driver, miibus_devclass, NULL, NULL); > +DRIVER_MODULE(enetc, pci, enetc_driver, enetc_devclass, NULL, NULL); > MODULE_VERSION(enetc, 1); This is not the right way to fix this as the toolchain is free to reorder symbols. You should instead use 'DRIVER_MODULE_ORDERED(..., SI_ORDER_LAST)' for enetc so that the miibus driver is registered first. -- John Baldwin From owner-dev-commits-src-all@freebsd.org Wed Aug 4 18:24:31 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A8136653514; Wed, 4 Aug 2021 18:24:31 +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 4Gg0Wg3KRGz4hmq; Wed, 4 Aug 2021 18:24: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 5B9123823; Wed, 4 Aug 2021 18:24: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 174IOVqd001467; Wed, 4 Aug 2021 18:24:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 174IOVtA001466; Wed, 4 Aug 2021 18:24:31 GMT (envelope-from git) Date: Wed, 4 Aug 2021 18:24:31 GMT Message-Id: <202108041824.174IOVtA001466@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: 4f35e8cba232 - main - hwpmc: disable uncore class on Sandy Bridge and newer 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: 4f35e8cba232d9256ab1399b8adfb761988e5eff Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Aug 2021 18:24:31 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=4f35e8cba232d9256ab1399b8adfb761988e5eff commit 4f35e8cba232d9256ab1399b8adfb761988e5eff Author: Mitchell Horne AuthorDate: 2021-08-04 17:31:36 +0000 Commit: Mitchell Horne CommitDate: 2021-08-04 18:23:22 +0000 hwpmc: disable uncore class on Sandy Bridge and newer It was written for Nehalem and Westmere, with minor but incomplete updates for Sandy Bridge in 78d763a29b15. The uncore architecture changed significantly with this generation, bringing new layouts and locations for some MSRs. Misprogramming these MSRs in ucp_start_pmc() may panic the system, and this is trivially reproducible via pmcstat(8) on at least Broadwell and Haswell. Disable the class on these CPUs until it can be updated more completely and leave a TODO comment detailing some of the work required. Note that the nclasses value for Broadwell was already incorrect and doesn't need changing. The result is that any uncore events listed by pmcstat -L will no longer be allocatable, but this is already the case for newer generations of Intel CPUs. PR: 253687 Reported by: Zhenlei Huang Reviewed by: kib MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31389 --- sys/dev/hwpmc/hwpmc_intel.c | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/sys/dev/hwpmc/hwpmc_intel.c b/sys/dev/hwpmc/hwpmc_intel.c index aec037b64938..02b8fd9431d1 100644 --- a/sys/dev/hwpmc/hwpmc_intel.c +++ b/sys/dev/hwpmc/hwpmc_intel.c @@ -149,7 +149,7 @@ pmc_intel_initialize(void) break; case 0x2A: /* Per Intel document 253669-039US 05/2011. */ cputype = PMC_CPU_INTEL_SANDYBRIDGE; - nclasses = 5; + nclasses = 3; break; case 0x2D: /* Per Intel document 253669-044US 08/2012. */ cputype = PMC_CPU_INTEL_SANDYBRIDGE_XEON; @@ -195,7 +195,7 @@ pmc_intel_initialize(void) case 0x3C: /* Per Intel document 325462-045US 01/2013. */ case 0x45: /* Per Intel document 325462-045US 09/2014. */ cputype = PMC_CPU_INTEL_HASWELL; - nclasses = 5; + nclasses = 3; break; case 0x37: case 0x4A: @@ -275,10 +275,27 @@ pmc_intel_initialize(void) * Intel Corei7 and Westmere processors. */ case PMC_CPU_INTEL_COREI7: - case PMC_CPU_INTEL_HASWELL: - case PMC_CPU_INTEL_SANDYBRIDGE: case PMC_CPU_INTEL_WESTMERE: +#ifdef notyet + /* + * TODO: re-enable uncore class on these processors. + * + * The uncore unit was reworked beginning with Sandy Bridge, including + * the MSRs required to program it. In particular, we need to: + * - Parse the MSR_UNC_CBO_CONFIG MSR for number of C-box units in the + * system + * - Support reading and writing to ARB and C-box units, depending on + * the requested event + * - Create some kind of mapping between C-box <--> CPU + * + * Also TODO: support other later changes to these interfaces, to + * enable the uncore class on generations newer than Broadwell. + * Skylake+ appears to use newer addresses for the uncore MSRs. + */ + case PMC_CPU_INTEL_HASWELL: case PMC_CPU_INTEL_BROADWELL: + case PMC_CPU_INTEL_SANDYBRIDGE: +#endif error = pmc_uncore_initialize(pmc_mdep, ncpus); break; default: @@ -329,11 +346,13 @@ pmc_intel_finalize(struct pmc_mdep *md) * Uncore. */ switch (md->pmd_cputype) { - case PMC_CPU_INTEL_BROADWELL: case PMC_CPU_INTEL_COREI7: + case PMC_CPU_INTEL_WESTMERE: +#ifdef notyet case PMC_CPU_INTEL_HASWELL: + case PMC_CPU_INTEL_BROADWELL: case PMC_CPU_INTEL_SANDYBRIDGE: - case PMC_CPU_INTEL_WESTMERE: +#endif pmc_uncore_finalize(md); break; default: From owner-dev-commits-src-all@freebsd.org Wed Aug 4 18:24:32 2021 Return-Path: Delivered-To: dev-commits-src-all@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 B3238652EA5; Wed, 4 Aug 2021 18:24: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 4Gg0Wh4LmLz4hhK; Wed, 4 Aug 2021 18:24: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 7E8D034DD; Wed, 4 Aug 2021 18:24: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 174IOW70001491; Wed, 4 Aug 2021 18:24:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 174IOW8R001490; Wed, 4 Aug 2021 18:24:32 GMT (envelope-from git) Date: Wed, 4 Aug 2021 18:24:32 GMT Message-Id: <202108041824.174IOW8R001490@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: 8399d923a569 - main - hwpmc_intel: assert for correct nclasses value 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: 8399d923a5697b7c194dbd44c33018c94ec42c4e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Aug 2021 18:24:32 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=8399d923a5697b7c194dbd44c33018c94ec42c4e commit 8399d923a5697b7c194dbd44c33018c94ec42c4e Author: Mitchell Horne AuthorDate: 2021-08-04 17:37:05 +0000 Commit: Mitchell Horne CommitDate: 2021-08-04 18:23:22 +0000 hwpmc_intel: assert for correct nclasses value This variable is set based on the exact CPU model detected. If this value is set too small, it could lead to a NULL-dereference from an improperly initialized pmc_rowindex_to_classdep array. Though it has been fixed, this was previously the case for Broadwell. Add two asserts to catch this in DEBUG kernels, as it represents a configuration error that may be hard to uncover otherwise. PR: 253687 Reported by: Zhenlei Huang Sponsored by: The FreeBSD Foundation --- sys/dev/hwpmc/hwpmc_intel.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/dev/hwpmc/hwpmc_intel.c b/sys/dev/hwpmc/hwpmc_intel.c index 02b8fd9431d1..6cc6ae3b50d6 100644 --- a/sys/dev/hwpmc/hwpmc_intel.c +++ b/sys/dev/hwpmc/hwpmc_intel.c @@ -255,6 +255,7 @@ pmc_intel_initialize(void) case PMC_CPU_INTEL_IVYBRIDGE_XEON: case PMC_CPU_INTEL_HASWELL: case PMC_CPU_INTEL_HASWELL_XEON: + MPASS(nclasses >= PMC_MDEP_CLASS_INDEX_IAF); error = pmc_core_initialize(pmc_mdep, ncpus, verov); break; @@ -296,6 +297,7 @@ pmc_intel_initialize(void) case PMC_CPU_INTEL_BROADWELL: case PMC_CPU_INTEL_SANDYBRIDGE: #endif + MPASS(nclasses >= PMC_MDEP_CLASS_INDEX_UCF); error = pmc_uncore_initialize(pmc_mdep, ncpus); break; default: From owner-dev-commits-src-all@freebsd.org Wed Aug 4 18:24:33 2021 Return-Path: Delivered-To: dev-commits-src-all@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 CF5F0653703; Wed, 4 Aug 2021 18:24: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 4Gg0Wj5JkFz4hn1; Wed, 4 Aug 2021 18:24: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 9C44C391D; Wed, 4 Aug 2021 18:24: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 174IOXUI001515; Wed, 4 Aug 2021 18:24:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 174IOXOi001514; Wed, 4 Aug 2021 18:24:33 GMT (envelope-from git) Date: Wed, 4 Aug 2021 18:24:33 GMT Message-Id: <202108041824.174IOXOi001514@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: bcd2f41f7d22 - main - mk: format some option lists 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: bcd2f41f7d222a942fe0a268614b46d3ec3af4c0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Aug 2021 18:24:33 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=bcd2f41f7d222a942fe0a268614b46d3ec3af4c0 commit bcd2f41f7d222a942fe0a268614b46d3ec3af4c0 Author: Mitchell Horne AuthorDate: 2021-08-04 18:17:34 +0000 Commit: Mitchell Horne CommitDate: 2021-08-04 18:23:22 +0000 mk: format some option lists Alphabetize and give each option its own line, ahead of making another change to these lists. This makes future diffs easier to read. Reviewed by: imp, emaste MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31399 --- Makefile.inc1 | 54 ++++++++++++++++++++++++--------- Makefile.libcompat | 11 +++++-- targets/pseudo/bootstrap-tools/Makefile | 23 ++++++++++---- 3 files changed, 65 insertions(+), 23 deletions(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index b6843177c10b..b61ed693af77 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -715,13 +715,25 @@ BSARGS= DESTDIR= \ BOOTSTRAPPING=${BOOTSTRAPPING_OSRELDATE} \ BWPHASE=${.TARGET:C,^_,,} \ SSP_CFLAGS= \ - MK_HTML=no NO_LINT=yes MK_MAN=no MK_MAN_UTILS=yes \ - -DNO_PIC MK_PROFILE=no -DNO_SHARED \ - -DNO_CPU_CFLAGS MK_WERROR=no MK_CTF=no \ - MK_ASAN=no MK_UBSAN=no \ - MK_CLANG_EXTRAS=no MK_CLANG_FORMAT=no MK_CLANG_FULL=no \ - MK_LLDB=no MK_RETPOLINE=no MK_TESTS=no \ - MK_INCLUDES=yes + -DNO_CPU_CFLAGS \ + -DNO_LINT \ + -DNO_PIC \ + -DNO_SHARED \ + MK_ASAN=no \ + MK_CTF=no \ + MK_CLANG_EXTRAS=no \ + MK_CLANG_FORMAT=no \ + MK_CLANG_FULL=no \ + MK_HTML=no \ + MK_LLDB=no \ + MK_MAN=no \ + MK_PROFILE=no \ + MK_RETPOLINE=no \ + MK_TESTS=no \ + MK_UBSAN=no \ + MK_WERROR=no \ + MK_INCLUDES=yes \ + MK_MAN_UTILS=yes BMAKE= \ ${TIME_ENV} ${BMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \ @@ -738,11 +750,18 @@ TMAKE= \ BOOTSTRAPPING=${BOOTSTRAPPING_OSRELDATE} \ BWPHASE=${.TARGET:C,^_,,} \ SSP_CFLAGS= \ + -DNO_CPU_CFLAGS \ -DNO_LINT \ - -DNO_CPU_CFLAGS MK_WERROR=no MK_CTF=no \ - MK_ASAN=no MK_UBSAN=no \ - MK_CLANG_EXTRAS=no MK_CLANG_FORMAT=no MK_CLANG_FULL=no \ - MK_LLDB=no MK_RETPOLINE=no MK_TESTS=no + MK_ASAN=no \ + MK_CTF=no \ + MK_CLANG_EXTRAS=no \ + MK_CLANG_FORMAT=no \ + MK_CLANG_FULL=no \ + MK_LLDB=no \ + MK_RETPOLINE=no \ + MK_TESTS=no \ + MK_UBSAN=no \ + MK_WERROR=no # cross-tools stage # TOOLS_PREFIX set in BMAKE @@ -766,9 +785,16 @@ KTMAKE= ${TIME_ENV} \ MAKEOBJDIRPREFIX= \ BOOTSTRAPPING=${BOOTSTRAPPING_OSRELDATE} \ SSP_CFLAGS= \ - MK_HTML=no -DNO_LINT MK_MAN=no \ - -DNO_PIC MK_PROFILE=no -DNO_SHARED \ - -DNO_CPU_CFLAGS MK_RETPOLINE=no MK_WERROR=no MK_CTF=no + -DNO_CPU_CFLAGS \ + -DNO_LINT \ + -DNO_PIC \ + -DNO_SHARED \ + MK_CTF=no \ + MK_HTML=no \ + MK_MAN=no \ + MK_PROFILE=no \ + MK_RETPOLINE=no \ + MK_WERROR=no # world stage WMAKEENV= ${CROSSENV} \ diff --git a/Makefile.libcompat b/Makefile.libcompat index c2be63c29e73..88b1e3f0cf18 100644 --- a/Makefile.libcompat +++ b/Makefile.libcompat @@ -103,9 +103,14 @@ build${libcompat}: .PHONY OBJTOP=${LIBCOMPAT_OBJTOP} \ OBJROOT='$${OBJTOP}/' \ MAKEOBJDIRPREFIX= \ - DIRPRFX=${_dir}/ -DNO_LINT -DNO_CPU_CFLAGS \ - MK_ASAN=no MK_UBSAN=no \ - MK_CTF=no MK_RETPOLINE=no MK_WERROR=no \ + DIRPRFX=${_dir}/ \ + -DNO_LINT \ + -DNO_CPU_CFLAGS \ + MK_ASAN=no \ + MK_CTF=no \ + MK_RETPOLINE=no \ + MK_UBSAN=no \ + MK_WERROR=no \ ${_t} .endfor .endfor diff --git a/targets/pseudo/bootstrap-tools/Makefile b/targets/pseudo/bootstrap-tools/Makefile index 0023f763af83..1a7f2bd15ad0 100644 --- a/targets/pseudo/bootstrap-tools/Makefile +++ b/targets/pseudo/bootstrap-tools/Makefile @@ -40,12 +40,23 @@ BSARGS= DESTDIR= \ BOOTSTRAPPING=${OSRELDATE} \ BWPHASE=${.TARGET} \ SSP_CFLAGS= \ - MK_HTML=no NO_LINT=yes MK_MAN=no \ - -DNO_PIC MK_PROFILE=no -DNO_SHARED \ - -DNO_CPU_CFLAGS MK_WERROR=no MK_CTF=no \ - MK_CLANG_EXTRAS=no MK_CLANG_FORMAT=no MK_CLANG_FULL=no \ - MK_LLDB=no MK_TESTS=no \ - MK_INCLUDES=yes + -DNO_CPU_CFLAGS \ + -DNO_LINT \ + -DNO_PIC \ + -DNO_SHARED \ + MK_CTF=no \ + MK_CLANG_EXTRAS=no \ + MK_CLANG_FORMAT=no \ + MK_CLANG_FULL=no \ + MK_HTML=no \ + MK_LLDB=no \ + MK_MAN=no \ + MK_PROFILE=no \ + MK_RETPOLINE=no \ + MK_TESTS=no \ + MK_WERROR=no \ + MK_INCLUDES=yes \ + MK_MAN_UTILS=yes # We will handle building the toolchain and cross-compiler. BSARGS+= MK_CROSS_COMPILER=no MK_CLANG=no From owner-dev-commits-src-all@freebsd.org Wed Aug 4 18:24:35 2021 Return-Path: Delivered-To: dev-commits-src-all@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 377E46533CF; Wed, 4 Aug 2021 18:24: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 4Gg0Wk73x3z4hKh; Wed, 4 Aug 2021 18:24: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 C2F9D391E; Wed, 4 Aug 2021 18:24: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 174IOYTk001541; Wed, 4 Aug 2021 18:24:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 174IOYM8001540; Wed, 4 Aug 2021 18:24:34 GMT (envelope-from git) Date: Wed, 4 Aug 2021 18:24:34 GMT Message-Id: <202108041824.174IOYM8001540@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: 1b8db4b4e361 - main - arm: enable stack-smashing protection 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: 1b8db4b4e3614ef6334ce776dcdd46fe7f2c5a78 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Aug 2021 18:24:35 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=1b8db4b4e3614ef6334ce776dcdd46fe7f2c5a78 commit 1b8db4b4e3614ef6334ce776dcdd46fe7f2c5a78 Author: Mitchell Horne AuthorDate: 2021-08-04 18:18:18 +0000 Commit: Mitchell Horne CommitDate: 2021-08-04 18:23:22 +0000 arm: enable stack-smashing protection With current generation clang/llvm it can pass all of our tests in libc/ssp. While here, remove the extra MACHINE_CPUARCH check for mips. SSP is included in BROKEN_OPTIONS for this architecture in src.opts.mk, which is enough to ensure normal builds won't set SSP_CFLAGS. Reviewed by: kevans, imp, emaste MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D31400 --- share/mk/bsd.sys.mk | 5 ++--- sys/conf/kern.mk | 3 +-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/share/mk/bsd.sys.mk b/share/mk/bsd.sys.mk index 6341800d5c70..031d49bbaca2 100644 --- a/share/mk/bsd.sys.mk +++ b/share/mk/bsd.sys.mk @@ -239,12 +239,11 @@ CFLAGS.clang+= -Qunused-arguments # but not yet. CXXFLAGS.clang+= -Wno-c++11-extensions -.if ${MK_SSP} != "no" && \ - ${MACHINE_CPUARCH} != "arm" && ${MACHINE_CPUARCH} != "mips" +.if ${MK_SSP} != "no" # Don't use -Wstack-protector as it breaks world with -Werror. SSP_CFLAGS?= -fstack-protector-strong CFLAGS+= ${SSP_CFLAGS} -.endif # SSP && !ARM && !MIPS +.endif # SSP # Additional flags passed in CFLAGS and CXXFLAGS when MK_DEBUG_FILES is # enabled. diff --git a/sys/conf/kern.mk b/sys/conf/kern.mk index f8ea372b1d93..56bddb35398b 100644 --- a/sys/conf/kern.mk +++ b/sys/conf/kern.mk @@ -213,8 +213,7 @@ CFLAGS+= -fwrapv # # GCC SSP support # -.if ${MK_SSP} != "no" && \ - ${MACHINE_CPUARCH} != "arm" && ${MACHINE_CPUARCH} != "mips" +.if ${MK_SSP} != "no" CFLAGS+= -fstack-protector .endif From owner-dev-commits-src-all@freebsd.org Wed Aug 4 18:24:37 2021 Return-Path: Delivered-To: dev-commits-src-all@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 52EB6652EB9; Wed, 4 Aug 2021 18:24:37 +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 4Gg0Wm2hhvz4hYn; Wed, 4 Aug 2021 18:24:36 +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 F07923A92; Wed, 4 Aug 2021 18:24: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 174IOZp1001570; Wed, 4 Aug 2021 18:24:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 174IOZj6001569; Wed, 4 Aug 2021 18:24:35 GMT (envelope-from git) Date: Wed, 4 Aug 2021 18:24:35 GMT Message-Id: <202108041824.174IOZj6001569@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: 61ed578ee666 - main - Prefer MK_SSP=no to SSP_CFLAGS= 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: 61ed578ee66648eff206ee5622b66727bfb52e78 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Aug 2021 18:24:37 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=61ed578ee66648eff206ee5622b66727bfb52e78 commit 61ed578ee66648eff206ee5622b66727bfb52e78 Author: Mitchell Horne AuthorDate: 2021-08-04 18:20:50 +0000 Commit: Mitchell Horne CommitDate: 2021-08-04 18:23:22 +0000 Prefer MK_SSP=no to SSP_CFLAGS= It is more idiomatic. CFLAGS is only augmented with $SSP_CFLAGS when $MK_SSP != "no". Reviewed by: imp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31401 --- Makefile.inc1 | 8 ++++---- Makefile.libcompat | 3 ++- lib/csu/Makefile.inc | 3 +-- lib/libclang_rt/Makefile.inc | 2 +- stand/defs.mk | 2 -- targets/pseudo/bootstrap-tools/Makefile | 2 +- 6 files changed, 9 insertions(+), 11 deletions(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index b61ed693af77..be8ac02353e1 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -714,7 +714,6 @@ BSARGS= DESTDIR= \ MAKEOBJDIRPREFIX= \ BOOTSTRAPPING=${BOOTSTRAPPING_OSRELDATE} \ BWPHASE=${.TARGET:C,^_,,} \ - SSP_CFLAGS= \ -DNO_CPU_CFLAGS \ -DNO_LINT \ -DNO_PIC \ @@ -729,6 +728,7 @@ BSARGS= DESTDIR= \ MK_MAN=no \ MK_PROFILE=no \ MK_RETPOLINE=no \ + MK_SSP=no \ MK_TESTS=no \ MK_UBSAN=no \ MK_WERROR=no \ @@ -749,7 +749,6 @@ TMAKE= \ DESTDIR= \ BOOTSTRAPPING=${BOOTSTRAPPING_OSRELDATE} \ BWPHASE=${.TARGET:C,^_,,} \ - SSP_CFLAGS= \ -DNO_CPU_CFLAGS \ -DNO_LINT \ MK_ASAN=no \ @@ -759,6 +758,7 @@ TMAKE= \ MK_CLANG_FULL=no \ MK_LLDB=no \ MK_RETPOLINE=no \ + MK_SSP=no \ MK_TESTS=no \ MK_UBSAN=no \ MK_WERROR=no @@ -784,7 +784,6 @@ KTMAKE= ${TIME_ENV} \ OBJROOT='$${OBJTOP}/' \ MAKEOBJDIRPREFIX= \ BOOTSTRAPPING=${BOOTSTRAPPING_OSRELDATE} \ - SSP_CFLAGS= \ -DNO_CPU_CFLAGS \ -DNO_LINT \ -DNO_PIC \ @@ -793,6 +792,7 @@ KTMAKE= ${TIME_ENV} \ MK_HTML=no \ MK_MAN=no \ MK_PROFILE=no \ + MK_SSP=no \ MK_RETPOLINE=no \ MK_WERROR=no @@ -2768,7 +2768,6 @@ NXBMAKEARGS+= \ -DNO_SHARED \ -DNO_CPU_CFLAGS \ -DNO_PIC \ - SSP_CFLAGS= \ MK_CASPER=no \ MK_CLANG_EXTRAS=no \ MK_CLANG_FORMAT=no \ @@ -2784,6 +2783,7 @@ NXBMAKEARGS+= \ MK_PROFILE=no \ MK_RETPOLINE=no \ MK_SENDMAIL=no \ + MK_SSP=no \ MK_TESTS=no \ MK_WERROR=no \ MK_ZFS=no diff --git a/Makefile.libcompat b/Makefile.libcompat index 88b1e3f0cf18..b376ebaa65f4 100644 --- a/Makefile.libcompat +++ b/Makefile.libcompat @@ -99,7 +99,7 @@ build${libcompat}: .PHONY ${_+_}cd ${.CURDIR}/${_dir}; \ WORLDTMP=${WORLDTMP} \ MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" \ - ${MAKE} SSP_CFLAGS= DESTDIR= \ + ${MAKE} DESTDIR= \ OBJTOP=${LIBCOMPAT_OBJTOP} \ OBJROOT='$${OBJTOP}/' \ MAKEOBJDIRPREFIX= \ @@ -109,6 +109,7 @@ build${libcompat}: .PHONY MK_ASAN=no \ MK_CTF=no \ MK_RETPOLINE=no \ + MK_SSP=no \ MK_UBSAN=no \ MK_WERROR=no \ ${_t} diff --git a/lib/csu/Makefile.inc b/lib/csu/Makefile.inc index b089e1a947b1..31c1bcbd7278 100644 --- a/lib/csu/Makefile.inc +++ b/lib/csu/Makefile.inc @@ -1,13 +1,12 @@ # $FreeBSD$ -SSP_CFLAGS= - NO_WMISSING_VARIABLE_DECLARATIONS= # Can't instrument these files since that breaks non-sanitized programs. MK_ASAN:= no MK_UBSAN:= no .include +MK_SSP= no .if !defined(BUILDING_TESTS) diff --git a/lib/libclang_rt/Makefile.inc b/lib/libclang_rt/Makefile.inc index 19b8868b60e3..cb4ad189e18b 100644 --- a/lib/libclang_rt/Makefile.inc +++ b/lib/libclang_rt/Makefile.inc @@ -13,11 +13,11 @@ SHLIBDIR= ${LIBDIR} NO_PIC= MK_PROFILE= no MK_ASAN:= no +MK_SSP= no MK_UBSAN:= no WARNS?= 0 -SSP_CFLAGS= CFLAGS+= -DNDEBUG CFLAGS+= -DHAVE_RPC_XDR_H=0 CFLAGS+= -DSANITIZER_SUPPORTS_WEAK_HOOKS=0 diff --git a/stand/defs.mk b/stand/defs.mk index 02a03b92577e..1e22f7b7c693 100644 --- a/stand/defs.mk +++ b/stand/defs.mk @@ -135,8 +135,6 @@ LD_FLAGS+= -m elf_i386_fbsd AFLAGS+= --32 .endif -SSP_CFLAGS= - # Add in the no float / no SIMD stuff and announce we're freestanding # aarch64 and riscv don't have -msoft-float, but all others do. CFLAGS+= -ffreestanding ${CFLAGS_NO_SIMD} diff --git a/targets/pseudo/bootstrap-tools/Makefile b/targets/pseudo/bootstrap-tools/Makefile index 1a7f2bd15ad0..3ac47053a388 100644 --- a/targets/pseudo/bootstrap-tools/Makefile +++ b/targets/pseudo/bootstrap-tools/Makefile @@ -39,7 +39,6 @@ BSARGS= DESTDIR= \ MAKEOBJDIRPREFIX= \ BOOTSTRAPPING=${OSRELDATE} \ BWPHASE=${.TARGET} \ - SSP_CFLAGS= \ -DNO_CPU_CFLAGS \ -DNO_LINT \ -DNO_PIC \ @@ -53,6 +52,7 @@ BSARGS= DESTDIR= \ MK_MAN=no \ MK_PROFILE=no \ MK_RETPOLINE=no \ + MK_SSP=no \ MK_TESTS=no \ MK_WERROR=no \ MK_INCLUDES=yes \ From owner-dev-commits-src-all@freebsd.org Wed Aug 4 18:55:33 2021 Return-Path: Delivered-To: dev-commits-src-all@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 569D8653B57; Wed, 4 Aug 2021 18:55: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 4Gg1CT1gkNz4lJ5; Wed, 4 Aug 2021 18:55: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 2072C3D71; Wed, 4 Aug 2021 18:55: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 174ItXj1041328; Wed, 4 Aug 2021 18:55:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 174ItXap041327; Wed, 4 Aug 2021 18:55:33 GMT (envelope-from git) Date: Wed, 4 Aug 2021 18:55:33 GMT Message-Id: <202108041855.174ItXap041327@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: c51e4962a3cf - main - Document kern.log_wakeups_per_second. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c51e4962a3cf2959d1f1cb9ab74ceab448583169 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Aug 2021 18:55:33 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=c51e4962a3cf2959d1f1cb9ab74ceab448583169 commit c51e4962a3cf2959d1f1cb9ab74ceab448583169 Author: John Baldwin AuthorDate: 2021-08-04 18:50:34 +0000 Commit: John Baldwin CommitDate: 2021-08-04 18:50:34 +0000 Document kern.log_wakeups_per_second. PR: 148680 MFC after: 2 weeks --- sys/kern/subr_log.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/kern/subr_log.c b/sys/kern/subr_log.c index 9336611d6005..e69fb49b008f 100644 --- a/sys/kern/subr_log.c +++ b/sys/kern/subr_log.c @@ -98,10 +98,10 @@ static struct cv log_wakeup; struct mtx msgbuf_lock; MTX_SYSINIT(msgbuf_lock, &msgbuf_lock, "msgbuf lock", MTX_DEF); -/* Times per second to check for a pending syslog wakeup. */ static int log_wakeups_per_second = 5; SYSCTL_INT(_kern, OID_AUTO, log_wakeups_per_second, CTLFLAG_RW, - &log_wakeups_per_second, 0, ""); + &log_wakeups_per_second, 0, + "How often (times per second) to check for /dev/log waiters."); /*ARGSUSED*/ static int From owner-dev-commits-src-all@freebsd.org Wed Aug 4 19:02:12 2021 Return-Path: Delivered-To: dev-commits-src-all@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 CEB43654114; Wed, 4 Aug 2021 19:02: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 4Gg1M85RCZz4m3X; Wed, 4 Aug 2021 19:02: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 A327D4490; Wed, 4 Aug 2021 19:02:12 +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 174J2CTb055076; Wed, 4 Aug 2021 19:02:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 174J2Ci4055075; Wed, 4 Aug 2021 19:02:12 GMT (envelope-from git) Date: Wed, 4 Aug 2021 19:02:12 GMT Message-Id: <202108041902.174J2Ci4055075@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: 77013d11e648 - main - Cirrus-CI: add some timing info on pkg install failure 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: 77013d11e6483b970af25e13c9b892075742f7e5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Aug 2021 19:02:12 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=77013d11e6483b970af25e13c9b892075742f7e5 commit 77013d11e6483b970af25e13c9b892075742f7e5 Author: Ed Maste AuthorDate: 2021-06-02 17:08:29 +0000 Commit: Ed Maste CommitDate: 2021-08-04 19:02:00 +0000 Cirrus-CI: add some timing info on pkg install failure Sponsored by: The FreeBSD Foundation --- .cirrus-ci/pkg-install.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.cirrus-ci/pkg-install.sh b/.cirrus-ci/pkg-install.sh index ef83e5284078..bcb781191023 100644 --- a/.cirrus-ci/pkg-install.sh +++ b/.cirrus-ci/pkg-install.sh @@ -1,10 +1,11 @@ #!/bin/sh set -e +start_time=$(date +%s) pkg install -y "$@" && exit 0 cat < Delivered-To: dev-commits-src-all@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 8E6C9654035; Wed, 4 Aug 2021 19:05: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 4Gg1Qr2j0cz4m4D; Wed, 4 Aug 2021 19:05: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 44E3B422F; Wed, 4 Aug 2021 19:05: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 174J5OvS055441; Wed, 4 Aug 2021 19:05:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 174J5OiG055440; Wed, 4 Aug 2021 19:05:24 GMT (envelope-from git) Date: Wed, 4 Aug 2021 19:05:24 GMT Message-Id: <202108041905.174J5OiG055440@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: 62174eaf4605 - main - Install ipmi man page also on arm64 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: 62174eaf460544c7645172cdde2c9204dcfd7321 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Aug 2021 19:05:24 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=62174eaf460544c7645172cdde2c9204dcfd7321 commit 62174eaf460544c7645172cdde2c9204dcfd7321 Author: Ed Maste AuthorDate: 2021-05-29 20:49:20 +0000 Commit: Ed Maste CommitDate: 2021-08-04 19:04:24 +0000 Install ipmi man page also on arm64 Fixes: 40d0971bbe5d ("arm64: enable build of the ipmi module") Sponsored by: The FreeBSD Foundation --- share/man/man4/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index 71a0d37631c5..7177ca1c0b36 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -817,7 +817,6 @@ _if_vmx.4= if_vmx.4 _if_wpi.4= if_wpi.4 _igc.4= igc.4 _imcsmb.4= imcsmb.4 -_ipmi.4= ipmi.4 _io.4= io.4 _itwd.4= itwd.4 _nda.4= nda.4 @@ -887,6 +886,7 @@ _nvme.4= nvme.4 .if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" || \ ${MACHINE_CPUARCH} == "aarch64" +_ipmi.4= ipmi.4 _linux.4= linux.4 _ossl.4= ossl.4 .endif From owner-dev-commits-src-all@freebsd.org Wed Aug 4 20:10:35 2021 Return-Path: Delivered-To: dev-commits-src-all@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 17FA565509D; Wed, 4 Aug 2021 20:10: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 4Gg2t30Dg9z4skM; Wed, 4 Aug 2021 20:10: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 E49B94F9D; Wed, 4 Aug 2021 20:10: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 174KAYue045197; Wed, 4 Aug 2021 20:10:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 174KAYSb045196; Wed, 4 Aug 2021 20:10:34 GMT (envelope-from git) Date: Wed, 4 Aug 2021 20:10:34 GMT Message-Id: <202108042010.174KAYSb045196@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: a0d701f61426 - main - vtfontcvt: minor style(9) fixes from clang-format 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: a0d701f6142686e853f96745a11bc9231dad97a9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Aug 2021 20:10:35 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=a0d701f6142686e853f96745a11bc9231dad97a9 commit a0d701f6142686e853f96745a11bc9231dad97a9 Author: Ed Maste AuthorDate: 2021-05-13 00:17:35 +0000 Commit: Ed Maste CommitDate: 2021-08-04 19:08:21 +0000 vtfontcvt: minor style(9) fixes from clang-format Found during clang-format experiments (in D26340). Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30237 --- usr.bin/vtfontcvt/vtfontcvt.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/usr.bin/vtfontcvt/vtfontcvt.c b/usr.bin/vtfontcvt/vtfontcvt.c index fbfc0539b4d9..b7587f5881ec 100644 --- a/usr.bin/vtfontcvt/vtfontcvt.c +++ b/usr.bin/vtfontcvt/vtfontcvt.c @@ -31,21 +31,21 @@ __FBSDID("$FreeBSD$"); #include -#include #include +#include +#include #include #include -#include #include #include +#include +#include #include #include #include -#include #include #include -#include #define VFNT_MAXGLYPHS 131072 #define VFNT_MAXDIMENSION 128 @@ -300,11 +300,11 @@ check_whitelist(unsigned c) if (format == VT_C_SOURCE) { w = s_list; - n = sizeof (s_list) / sizeof (s_list[0]); + n = sizeof(s_list) / sizeof(s_list[0]); } if (format == VT_C_COMPRESSED) { w = c_list; - n = sizeof (c_list) / sizeof (c_list[0]); + n = sizeof(c_list) / sizeof(c_list[0]); } if (w == NULL) return (true); @@ -847,7 +847,7 @@ write_fnt_source(bool lz4, const char *filename) goto done; } if (fprintf(fp, "};\n\n") < 0) - goto done; + goto done; /* Write font maps. */ if (!TAILQ_EMPTY(&maps[VFNT_MAP_NORMAL])) { From owner-dev-commits-src-all@freebsd.org Wed Aug 4 20:10:36 2021 Return-Path: Delivered-To: dev-commits-src-all@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 553446550AD; Wed, 4 Aug 2021 20:10:36 +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 4Gg2t41WGTz4sTR; Wed, 4 Aug 2021 20:10:36 +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 13220511B; Wed, 4 Aug 2021 20:10:36 +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 174KAZKj045221; Wed, 4 Aug 2021 20:10:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 174KAZhG045220; Wed, 4 Aug 2021 20:10:35 GMT (envelope-from git) Date: Wed, 4 Aug 2021 20:10:35 GMT Message-Id: <202108042010.174KAZhG045220@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: c910570e7573 - main - Use compressed debug in standalone userland debug files by default 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: c910570e757305ba4a974b628bcd8fd4278908a7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Aug 2021 20:10:36 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=c910570e757305ba4a974b628bcd8fd4278908a7 commit c910570e757305ba4a974b628bcd8fd4278908a7 Author: Ed Maste AuthorDate: 2021-03-01 17:25:22 +0000 Commit: Ed Maste CommitDate: 2021-08-04 20:08:40 +0000 Use compressed debug in standalone userland debug files by default The compiler supports CFLAGS=-gz=zlib to compress .debug sections in object files, libraries, and binaries. Enable it to reduce disk usage for standalone debug files (and /usr/obj). Reviewed by: dim, kevans Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D29002 --- share/mk/bsd.compiler.mk | 2 +- share/mk/bsd.lib.mk | 5 +++++ share/mk/bsd.prog.mk | 4 ++++ share/mk/bsd.sys.mk | 2 +- 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/share/mk/bsd.compiler.mk b/share/mk/bsd.compiler.mk index a52c3968fb09..681f6ffec14c 100644 --- a/share/mk/bsd.compiler.mk +++ b/share/mk/bsd.compiler.mk @@ -235,7 +235,7 @@ ${X_}COMPILER_FEATURES+= c++11 c++14 ${X_}COMPILER_FEATURES+= c++17 .endif .if ${${X_}COMPILER_TYPE} == "clang" -${X_}COMPILER_FEATURES+= retpoline init-all +${X_}COMPILER_FEATURES+= compressed-debug retpoline init-all .endif .if ${${X_}COMPILER_TYPE} == "clang" && ${${X_}COMPILER_VERSION} >= 100000 || \ (${${X_}COMPILER_TYPE} == "gcc" && ${${X_}COMPILER_VERSION} >= 80100) diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk index aaac0b68d984..0c80dd63d5e8 100644 --- a/share/mk/bsd.lib.mk +++ b/share/mk/bsd.lib.mk @@ -113,8 +113,13 @@ CXXFLAGS+= -ftrivial-auto-var-init=pattern .if ${MK_DEBUG_FILES} != "no" && empty(DEBUG_FLAGS:M-g) && \ empty(DEBUG_FLAGS:M-gdwarf*) +.if !${COMPILER_FEATURES:Mcompressed-debug} +CFLAGS+= ${DEBUG_FILES_CFLAGS:N-gz*} +CXXFLAGS+= ${DEBUG_FILES_CFLAGS:N-gz*} +.else CFLAGS+= ${DEBUG_FILES_CFLAGS} CXXFLAGS+= ${DEBUG_FILES_CFLAGS} +.endif CTFFLAGS+= -g .endif diff --git a/share/mk/bsd.prog.mk b/share/mk/bsd.prog.mk index 4f00be193874..437ccf373130 100644 --- a/share/mk/bsd.prog.mk +++ b/share/mk/bsd.prog.mk @@ -93,7 +93,11 @@ CFLAGS+=${CRUNCH_CFLAGS} .else .if ${MK_DEBUG_FILES} != "no" && empty(DEBUG_FLAGS:M-g) && \ empty(DEBUG_FLAGS:M-gdwarf-*) +.if !${COMPILER_FEATURES:Mcompressed-debug} +CFLAGS+= ${DEBUG_FILES_CFLAGS:N-gz*} +.else CFLAGS+= ${DEBUG_FILES_CFLAGS} +.endif CTFFLAGS+= -g .endif .endif diff --git a/share/mk/bsd.sys.mk b/share/mk/bsd.sys.mk index 031d49bbaca2..a964cf6e596c 100644 --- a/share/mk/bsd.sys.mk +++ b/share/mk/bsd.sys.mk @@ -247,7 +247,7 @@ CFLAGS+= ${SSP_CFLAGS} # Additional flags passed in CFLAGS and CXXFLAGS when MK_DEBUG_FILES is # enabled. -DEBUG_FILES_CFLAGS?= -g +DEBUG_FILES_CFLAGS?= -g -gz=zlib # Allow user-specified additional warning flags, plus compiler and file # specific flag overrides, unless we've overridden this... From owner-dev-commits-src-all@freebsd.org Wed Aug 4 20:57:00 2021 Return-Path: Delivered-To: dev-commits-src-all@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 12E9A655A48; Wed, 4 Aug 2021 20:57: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 4Gg3vc01Gnz3CgL; Wed, 4 Aug 2021 20:57: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 DCEF75C89; Wed, 4 Aug 2021 20:56: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 174KuxDe002171; Wed, 4 Aug 2021 20:56:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 174KuxjP002170; Wed, 4 Aug 2021 20:56:59 GMT (envelope-from git) Date: Wed, 4 Aug 2021 20:56:59 GMT Message-Id: <202108042056.174KuxjP002170@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Phil Shafer Subject: git: cd2401cdd550 - main - add blank line between variables (testing git commit) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: phil X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cd2401cdd550e26dad098cdfb60d46a478b9ecb6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Aug 2021 20:57:00 -0000 The branch main has been updated by phil: URL: https://cgit.FreeBSD.org/src/commit/?id=cd2401cdd550e26dad098cdfb60d46a478b9ecb6 commit cd2401cdd550e26dad098cdfb60d46a478b9ecb6 Author: Phil Shafer AuthorDate: 2021-08-04 20:56:55 +0000 Commit: Phil Shafer CommitDate: 2021-08-04 20:56:55 +0000 add blank line between variables (testing git commit) --- lib/libxo/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/libxo/Makefile b/lib/libxo/Makefile index 954e3d5ee4b6..96e91e3bf21a 100644 --- a/lib/libxo/Makefile +++ b/lib/libxo/Makefile @@ -3,6 +3,7 @@ .include HAS_TESTS= + SUBDIR.${MK_TESTS}+= tests SUBDIR = libxo .WAIT encoder From owner-dev-commits-src-all@freebsd.org Wed Aug 4 22:56:48 2021 Return-Path: Delivered-To: dev-commits-src-all@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 35B4A656E5F; Wed, 4 Aug 2021 22:56: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 4Gg6Yr0X4fz3LqL; Wed, 4 Aug 2021 22:56: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 EA16C72E7; Wed, 4 Aug 2021 22:56: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 174Mulrg062087; Wed, 4 Aug 2021 22:56:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 174Mulvd062086; Wed, 4 Aug 2021 22:56:47 GMT (envelope-from git) Date: Wed, 4 Aug 2021 22:56:47 GMT Message-Id: <202108042256.174Mulvd062086@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: f3a3b0612169 - main - [lltable] Unify datapath feedback mechamism. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f3a3b061216936b6233d1624dfdba03240d7c045 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Aug 2021 22:56:48 -0000 The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=f3a3b061216936b6233d1624dfdba03240d7c045 commit f3a3b061216936b6233d1624dfdba03240d7c045 Author: Alexander V. Chernikov AuthorDate: 2021-08-02 22:39:00 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-08-04 22:52:43 +0000 [lltable] Unify datapath feedback mechamism. Use newly-create llentry_request_feedback(), llentry_mark_used() and llentry_get_hittime() to request datapatch usage check and fetch the results in the same fashion both in IPv4 and IPv6. While here, simplify llentry_provide_feedback() wrapper by eliminating 1 condition check. MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D31390 --- sys/net/if_ethersubr.c | 2 +- sys/net/if_infiniband.c | 2 +- sys/net/if_llatbl.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ sys/net/if_llatbl.h | 11 +++++++---- sys/netinet/if_ether.c | 25 +++++++------------------ sys/netinet/in.c | 15 +-------------- sys/netinet6/in6.c | 21 +-------------------- sys/netinet6/nd6.c | 32 ++++++++------------------------ 8 files changed, 72 insertions(+), 82 deletions(-) diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index 7eb46df8281a..718de9625044 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -315,7 +315,7 @@ ether_output(struct ifnet *ifp, struct mbuf *m, * the entry was used * by datapath. */ - llentry_mark_used(lle); + llentry_provide_feedback(lle); } if (lle != NULL) { phdr = lle->r_linkdata; diff --git a/sys/net/if_infiniband.c b/sys/net/if_infiniband.c index 3e7daeed4da3..528f20b7c98d 100644 --- a/sys/net/if_infiniband.c +++ b/sys/net/if_infiniband.c @@ -329,7 +329,7 @@ infiniband_output(struct ifnet *ifp, struct mbuf *m, * the entry was used * by datapath. */ - llentry_mark_used(lle); + llentry_provide_feedback(lle); } if (lle != NULL) { phdr = lle->r_linkdata; diff --git a/sys/net/if_llatbl.c b/sys/net/if_llatbl.c index 7225869a07d0..70baf58c2778 100644 --- a/sys/net/if_llatbl.c +++ b/sys/net/if_llatbl.c @@ -386,6 +386,52 @@ lltable_calc_llheader(struct ifnet *ifp, int family, char *lladdr, return (error); } +/* + * Requests feedback from the datapath. + * First packet using @lle should result in + * setting r_skip_req back to 0 and updating + * lle_hittime to the current time_uptime. + */ +void +llentry_request_feedback(struct llentry *lle) +{ + LLE_REQ_LOCK(lle); + lle->r_skip_req = 1; + LLE_REQ_UNLOCK(lle); +} + +/* + * Updates the lle state to mark it has been used + * and record the time. + * Used by the llentry_provide_feedback() wrapper. + */ +void +llentry_mark_used(struct llentry *lle) +{ + LLE_REQ_LOCK(lle); + lle->r_skip_req = 0; + lle->lle_hittime = time_uptime; + LLE_REQ_UNLOCK(lle); +} + +/* + * Fetches the time when lle was used. + * Return 0 if the entry was not used, relevant time_uptime + * otherwise. + */ +time_t +llentry_get_hittime(struct llentry *lle) +{ + time_t lle_hittime = 0; + + LLE_REQ_LOCK(lle); + if ((lle->r_skip_req == 0) && (lle_hittime < lle->lle_hittime)) + lle_hittime = lle->lle_hittime; + LLE_REQ_UNLOCK(lle); + + return (lle_hittime); +} + /* * Update link-layer header for given @lle after * interface lladdr was changed. diff --git a/sys/net/if_llatbl.h b/sys/net/if_llatbl.h index 1081b7cdf2cd..488f8b006315 100644 --- a/sys/net/if_llatbl.h +++ b/sys/net/if_llatbl.h @@ -250,17 +250,20 @@ lla_lookup(struct lltable *llt, u_int flags, const struct sockaddr *l3addr) return (llt->llt_lookup(llt, flags, l3addr)); } +void llentry_request_feedback(struct llentry *lle); +void llentry_mark_used(struct llentry *lle); +time_t llentry_get_hittime(struct llentry *lle); + /* * Notify the LLE code that the entry was used by datapath. */ static __inline void -llentry_mark_used(struct llentry *lle) +llentry_provide_feedback(struct llentry *lle) { - if (lle->r_skip_req == 0) + if (__predict_true(lle->r_skip_req == 0)) return; - if ((lle->r_flags & RLLE_VALID) != 0) - lle->lle_tbl->llt_mark_used(lle); + llentry_mark_used(lle); } int lla_rt_output(struct rt_msghdr *, struct rt_addrinfo *); diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c index ef50ec9ca964..3eb9d7210afb 100644 --- a/sys/netinet/if_ether.c +++ b/sys/netinet/if_ether.c @@ -207,7 +207,6 @@ arptimer(void *arg) { struct llentry *lle = (struct llentry *)arg; struct ifnet *ifp; - int r_skip_req; if (lle->la_flags & LLE_STATIC) { return; @@ -240,27 +239,17 @@ arptimer(void *arg) /* * Expiration time is approaching. - * Let's try to refresh entry if it is still - * in use. - * - * Set r_skip_req to get feedback from - * fast path. Change state and re-schedule - * ourselves. + * Request usage feedback from the datapath. + * Change state and re-schedule ourselves. */ - LLE_REQ_LOCK(lle); - lle->r_skip_req = 1; - LLE_REQ_UNLOCK(lle); + llentry_request_feedback(lle); lle->ln_state = ARP_LLINFO_VERIFY; callout_schedule(&lle->lle_timer, hz * V_arpt_rexmit); LLE_WUNLOCK(lle); CURVNET_RESTORE(); return; case ARP_LLINFO_VERIFY: - LLE_REQ_LOCK(lle); - r_skip_req = lle->r_skip_req; - LLE_REQ_UNLOCK(lle); - - if (r_skip_req == 0 && lle->la_preempt > 0) { + if (llentry_get_hittime(lle) > 0 && lle->la_preempt > 0) { /* Entry was used, issue refresh request */ struct epoch_tracker et; struct in_addr dst; @@ -532,7 +521,7 @@ arpresolve_full(struct ifnet *ifp, int is_gw, int flags, struct mbuf *m, bcopy(lladdr, desten, ll_len); /* Notify LLE code that the entry was used by datapath */ - llentry_mark_used(la); + llentry_provide_feedback(la); if (pflags != NULL) *pflags = la->la_flags & (LLE_VALID|LLE_IFADDR); if (plle) { @@ -656,7 +645,7 @@ arpresolve(struct ifnet *ifp, int is_gw, struct mbuf *m, if (pflags != NULL) *pflags = LLE_VALID | (la->r_flags & RLLE_IFADDR); /* Notify the LLE handling code that the entry was used. */ - llentry_mark_used(la); + llentry_provide_feedback(la); if (plle) { LLE_ADDREF(la); *plle = la; @@ -1225,7 +1214,7 @@ arp_check_update_lle(struct arphdr *ah, struct in_addr isaddr, struct ifnet *ifp return; /* Clear fast path feedback request if set */ - la->r_skip_req = 0; + llentry_mark_used(la); } arp_mark_lle_reachable(la); diff --git a/sys/netinet/in.c b/sys/netinet/in.c index bcf071a81e0e..d1dd2b31b6ef 100644 --- a/sys/netinet/in.c +++ b/sys/netinet/in.c @@ -1264,19 +1264,6 @@ in_lltable_destroy_lle_unlocked(epoch_context_t ctx) free(lle, M_LLTABLE); } -/* - * Called by the datapath to indicate that - * the entry was used. - */ -static void -in_lltable_mark_used(struct llentry *lle) -{ - - LLE_REQ_LOCK(lle); - lle->r_skip_req = 0; - LLE_REQ_UNLOCK(lle); -} - /* * Called by LLE_FREE_LOCKED when number of references * drops to zero. @@ -1681,7 +1668,7 @@ in_lltattach(struct ifnet *ifp) llt->llt_fill_sa_entry = in_lltable_fill_sa_entry; llt->llt_free_entry = in_lltable_free_entry; llt->llt_match_prefix = in_lltable_match_prefix; - llt->llt_mark_used = in_lltable_mark_used; + llt->llt_mark_used = llentry_mark_used; lltable_link(llt); return (llt); diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c index 02cb9df7da3a..d5b3452c0b06 100644 --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -2214,25 +2214,6 @@ in6_lltable_rtcheck(struct ifnet *ifp, return 0; } -/* - * Called by the datapath to indicate that the entry was used. - */ -static void -in6_lltable_mark_used(struct llentry *lle) -{ - - LLE_REQ_LOCK(lle); - lle->r_skip_req = 0; - - /* - * Set the hit time so the callback function - * can determine the remaining time before - * transiting to the DELAY state. - */ - lle->lle_hittime = time_uptime; - LLE_REQ_UNLOCK(lle); -} - static inline uint32_t in6_lltable_hash_dst(const struct in6_addr *dst, uint32_t hsize) { @@ -2469,7 +2450,7 @@ in6_lltattach(struct ifnet *ifp) llt->llt_fill_sa_entry = in6_lltable_fill_sa_entry; llt->llt_free_entry = in6_lltable_free_entry; llt->llt_match_prefix = in6_lltable_match_prefix; - llt->llt_mark_used = in6_lltable_mark_used; + llt->llt_mark_used = llentry_mark_used; lltable_link(llt); return (llt); diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c index 62f0ac733a23..60610462f4d7 100644 --- a/sys/netinet6/nd6.c +++ b/sys/netinet6/nd6.c @@ -617,7 +617,7 @@ nd6_llinfo_get_holdsrc(struct llentry *ln, struct in6_addr *src) static int nd6_is_stale(struct llentry *lle, long *pdelay, int *do_switch) { - int nd_delay, nd_gctimer, r_skip_req; + int nd_delay, nd_gctimer; time_t lle_hittime; long delay; @@ -625,17 +625,13 @@ nd6_is_stale(struct llentry *lle, long *pdelay, int *do_switch) nd_gctimer = V_nd6_gctimer; nd_delay = V_nd6_delay; - LLE_REQ_LOCK(lle); - r_skip_req = lle->r_skip_req; - lle_hittime = lle->lle_hittime; - LLE_REQ_UNLOCK(lle); + lle_hittime = llentry_get_hittime(lle); - if (r_skip_req > 0) { + if (lle_hittime == 0) { /* - * Nonzero r_skip_req value was set upon entering - * STALE state. Since value was not changed, no - * packets were passed using this lle. Ask for - * timer reschedule and keep STALE state. + * Datapath feedback has been requested upon entering + * STALE state. No packets has been passed using this lle. + * Ask for the timer reschedule and keep STALE state. */ delay = (long)(MIN(nd_gctimer, nd_delay)); delay *= hz; @@ -705,13 +701,7 @@ nd6_llinfo_setstate(struct llentry *lle, int newstate) break; case ND6_LLINFO_STALE: - /* - * Notify fast path that we want to know if any packet - * is transmitted by setting r_skip_req. - */ - LLE_REQ_LOCK(lle); - lle->r_skip_req = 1; - LLE_REQ_UNLOCK(lle); + llentry_request_feedback(lle); nd_delay = V_nd6_delay; nd_gctimer = V_nd6_gctimer; @@ -2254,13 +2244,7 @@ nd6_resolve(struct ifnet *ifp, int is_gw, struct mbuf *m, bcopy(ln->r_linkdata, desten, ln->r_hdrlen); if (pflags != NULL) *pflags = LLE_VALID | (ln->r_flags & RLLE_IFADDR); - /* Check if we have feedback request from nd6 timer */ - if (ln->r_skip_req != 0) { - LLE_REQ_LOCK(ln); - ln->r_skip_req = 0; /* Notify that entry was used */ - ln->lle_hittime = time_uptime; - LLE_REQ_UNLOCK(ln); - } + llentry_provide_feedback(ln); if (plle) { LLE_ADDREF(ln); *plle = ln; From owner-dev-commits-src-all@freebsd.org Thu Aug 5 00:34:02 2021 Return-Path: Delivered-To: dev-commits-src-all@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 DC45265846D; Thu, 5 Aug 2021 00:34: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 4Gg8k25cWsz3R9k; Thu, 5 Aug 2021 00:34: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 A895210D82; Thu, 5 Aug 2021 00:34: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 1750Y2X6095258; Thu, 5 Aug 2021 00:34:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1750Y2s7095257; Thu, 5 Aug 2021 00:34:02 GMT (envelope-from git) Date: Thu, 5 Aug 2021 00:34:02 GMT Message-Id: <202108050034.1750Y2s7095257@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: dfe4c2024fbc - stable/13 - nfscl: Send stateid.seqid of 0 for NFSv4.1/4.2 mounts 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/stable/13 X-Git-Reftype: branch X-Git-Commit: dfe4c2024fbc0df2d73bb0be71736943533b4a9a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 00:34:02 -0000 The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=dfe4c2024fbc0df2d73bb0be71736943533b4a9a commit dfe4c2024fbc0df2d73bb0be71736943533b4a9a Author: Rick Macklem AuthorDate: 2021-07-20 00:35:39 +0000 Commit: Rick Macklem CommitDate: 2021-08-05 00:30:40 +0000 nfscl: Send stateid.seqid of 0 for NFSv4.1/4.2 mounts For NFSv4.1/4.2, the client may set the "seqid" field of the stateid to 0 in RPC requests. This indicates to the server that it should not check the "seqid" or return NFSERR_OLDSTATEID if the "seqid" value is not up to date w.r.t. Open/Lock operations on the stateid. This "seqid" is incremented by the NFSv4 server for each Open/OpenDowngrade/Lock/Locku operation done on the stateid. Since a failure return of NFSERR_OLDSTATEID is of no use to the client for I/O operations, it makes sense to set "seqid" to 0 for the stateid argument for I/O operations. This avoids server failure replies of NFSERR_OLDSTATEID, although I am not aware of any case where this failure occurs. This makes the FreeBSD NFSv4.1/4.2 client compatible with the Linux NFSv4.1/4.2 client. (cherry picked from commit 7685f8344d9a59e9498bdfebb48066f98216fecd) --- sys/fs/nfsclient/nfs_clstate.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c index 8ea5d77d2053..406dcc9d9b80 100644 --- a/sys/fs/nfsclient/nfs_clstate.c +++ b/sys/fs/nfsclient/nfs_clstate.c @@ -569,7 +569,11 @@ nfscl_getstateid(vnode_t vp, u_int8_t *nfhp, int fhlen, u_int32_t mode, !NFSBCMP(nfhp, dp->nfsdl_fh, fhlen)) { if (!(mode & NFSV4OPEN_ACCESSWRITE) || (dp->nfsdl_flags & NFSCLDL_WRITE)) { - stateidp->seqid = dp->nfsdl_stateid.seqid; + if (NFSHASNFSV4N(nmp)) + stateidp->seqid = 0; + else + stateidp->seqid = + dp->nfsdl_stateid.seqid; stateidp->other[0] = dp->nfsdl_stateid.other[0]; stateidp->other[1] = dp->nfsdl_stateid.other[1]; stateidp->other[2] = dp->nfsdl_stateid.other[2]; @@ -604,8 +608,10 @@ nfscl_getstateid(vnode_t vp, u_int8_t *nfhp, int fhlen, u_int32_t mode, own, own, mode, &lp, &op); if (error == 0 && lp != NULL && fords == 0) { /* Don't return a lock stateid for a DS. */ - stateidp->seqid = - lp->nfsl_stateid.seqid; + if (NFSHASNFSV4N(nmp)) + stateidp->seqid = 0; + else + stateidp->seqid = lp->nfsl_stateid.seqid; stateidp->other[0] = lp->nfsl_stateid.other[0]; stateidp->other[1] = @@ -656,7 +662,10 @@ nfscl_getstateid(vnode_t vp, u_int8_t *nfhp, int fhlen, u_int32_t mode, /* * No lock stateid, so return the open stateid. */ - stateidp->seqid = op->nfso_stateid.seqid; + if (NFSHASNFSV4N(nmp)) + stateidp->seqid = 0; + else + stateidp->seqid = op->nfso_stateid.seqid; stateidp->other[0] = op->nfso_stateid.other[0]; stateidp->other[1] = op->nfso_stateid.other[1]; stateidp->other[2] = op->nfso_stateid.other[2]; From owner-dev-commits-src-all@freebsd.org Thu Aug 5 00:34:37 2021 Return-Path: Delivered-To: dev-commits-src-all@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 CB7DB658D0A; Thu, 5 Aug 2021 00:34:37 +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 4Gg8kj5Sg4z3RD3; Thu, 5 Aug 2021 00:34: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 A2C6910AC5; Thu, 5 Aug 2021 00:34: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 1750YbfW095431; Thu, 5 Aug 2021 00:34:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1750YbVK095430; Thu, 5 Aug 2021 00:34:37 GMT (envelope-from git) Date: Thu, 5 Aug 2021 00:34:37 GMT Message-Id: <202108050034.1750YbVK095430@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 7e48916d19de - stable/13 - vmci(4): Shorten interrupt descriptions. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 7e48916d19de024ad00b308db5c39d63d6b9efb2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 00:34:37 -0000 The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=7e48916d19de024ad00b308db5c39d63d6b9efb2 commit 7e48916d19de024ad00b308db5c39d63d6b9efb2 Author: Alexander Motin AuthorDate: 2021-07-22 16:58:10 +0000 Commit: Alexander Motin CommitDate: 2021-08-05 00:34:34 +0000 vmci(4): Shorten interrupt descriptions. We have no space there for such a long strings. Also it makes no sense to set description if there is only one interrupt. MFC after: 2 weeks (cherry picked from commit ab38c12b4a488c011ea85252621430ded6e87139) --- sys/dev/vmware/vmci/vmci.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/dev/vmware/vmci/vmci.c b/sys/dev/vmware/vmci/vmci.c index 91fcb39ed6ed..bbf17bbe7e41 100644 --- a/sys/dev/vmware/vmci/vmci.c +++ b/sys/dev/vmware/vmci/vmci.c @@ -845,17 +845,17 @@ vmci_setup_interrupts(struct vmci_softc *sc) vmci_interrupt, NULL, &intr->vmci_handler); if (error) return (error); - bus_describe_intr(sc->vmci_dev, intr->vmci_irq, intr->vmci_handler, - "vmci_interrupt"); if (sc->vmci_num_intr == 2) { + bus_describe_intr(sc->vmci_dev, intr->vmci_irq, + intr->vmci_handler, "dg"); intr = &sc->vmci_intrs[1]; error = bus_setup_intr(sc->vmci_dev, intr->vmci_irq, flags, NULL, vmci_interrupt_bm, NULL, &intr->vmci_handler); if (error) return (error); bus_describe_intr(sc->vmci_dev, intr->vmci_irq, - intr->vmci_handler, "vmci_interrupt_bm"); + intr->vmci_handler, "bm"); } return (0); From owner-dev-commits-src-all@freebsd.org Thu Aug 5 00:35:14 2021 Return-Path: Delivered-To: dev-commits-src-all@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 08083658CB2; Thu, 5 Aug 2021 00:35:14 +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 4Gg8lP6rvLz3RBV; Thu, 5 Aug 2021 00:35: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 D3E37108B0; Thu, 5 Aug 2021 00:35: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 1750ZDGf095588; Thu, 5 Aug 2021 00:35:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1750ZDmQ095587; Thu, 5 Aug 2021 00:35:13 GMT (envelope-from git) Date: Thu, 5 Aug 2021 00:35:13 GMT Message-Id: <202108050035.1750ZDmQ095587@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: b3ffcbec1ccb - stable/12 - vmci(4): Shorten interrupt descriptions. 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/stable/12 X-Git-Reftype: branch X-Git-Commit: b3ffcbec1ccb4832529408e4a391cf9a62ddd54d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 00:35:14 -0000 The branch stable/12 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=b3ffcbec1ccb4832529408e4a391cf9a62ddd54d commit b3ffcbec1ccb4832529408e4a391cf9a62ddd54d Author: Alexander Motin AuthorDate: 2021-07-22 16:58:10 +0000 Commit: Alexander Motin CommitDate: 2021-08-05 00:35:08 +0000 vmci(4): Shorten interrupt descriptions. We have no space there for such a long strings. Also it makes no sense to set description if there is only one interrupt. MFC after: 2 weeks (cherry picked from commit ab38c12b4a488c011ea85252621430ded6e87139) --- sys/dev/vmware/vmci/vmci.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/dev/vmware/vmci/vmci.c b/sys/dev/vmware/vmci/vmci.c index 82e23daa4c71..3f195231d8e2 100644 --- a/sys/dev/vmware/vmci/vmci.c +++ b/sys/dev/vmware/vmci/vmci.c @@ -845,17 +845,17 @@ vmci_setup_interrupts(struct vmci_softc *sc) vmci_interrupt, NULL, &intr->vmci_handler); if (error) return (error); - bus_describe_intr(sc->vmci_dev, intr->vmci_irq, intr->vmci_handler, - "vmci_interrupt"); if (sc->vmci_num_intr == 2) { + bus_describe_intr(sc->vmci_dev, intr->vmci_irq, + intr->vmci_handler, "dg"); intr = &sc->vmci_intrs[1]; error = bus_setup_intr(sc->vmci_dev, intr->vmci_irq, flags, NULL, vmci_interrupt_bm, NULL, &intr->vmci_handler); if (error) return (error); bus_describe_intr(sc->vmci_dev, intr->vmci_irq, - intr->vmci_handler, "vmci_interrupt_bm"); + intr->vmci_handler, "bm"); } return (0); From owner-dev-commits-src-all@freebsd.org Thu Aug 5 00:57:13 2021 Return-Path: Delivered-To: dev-commits-src-all@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 54FB86590DE; Thu, 5 Aug 2021 00:57: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 4Gg9Dn1gTKz3hlN; Thu, 5 Aug 2021 00:57: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 2209010D6F; Thu, 5 Aug 2021 00:57: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 1750vDf8021739; Thu, 5 Aug 2021 00:57:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1750vDIm021738; Thu, 5 Aug 2021 00:57:13 GMT (envelope-from git) Date: Thu, 5 Aug 2021 00:57:13 GMT Message-Id: <202108050057.1750vDIm021738@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: a1b07443998c - stable/13 - x86 __vdso_gettc: add O_CLOEXEC flag to open 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/stable/13 X-Git-Reftype: branch X-Git-Commit: a1b07443998c7e214642e0aea61e0f3af180cf36 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 00:57:13 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=a1b07443998c7e214642e0aea61e0f3af180cf36 commit a1b07443998c7e214642e0aea61e0f3af180cf36 Author: Konstantin Belousov AuthorDate: 2021-07-29 01:26:38 +0000 Commit: Konstantin Belousov CommitDate: 2021-08-05 00:56:46 +0000 x86 __vdso_gettc: add O_CLOEXEC flag to open (cherry picked from commit cbf6f55e77a9176572830a20804cf1d005dfea73) --- lib/libc/x86/sys/__vdso_gettc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libc/x86/sys/__vdso_gettc.c b/lib/libc/x86/sys/__vdso_gettc.c index 7a64f2a0b556..ab10943c811b 100644 --- a/lib/libc/x86/sys/__vdso_gettc.c +++ b/lib/libc/x86/sys/__vdso_gettc.c @@ -230,7 +230,7 @@ __vdso_init_hpet(uint32_t u) * triggering trap_enocap on the device open by absolute path. */ if ((cap_getmode(&mode) == 0 && mode != 0) || - (fd = _open(devname, O_RDONLY)) == -1) { + (fd = _open(devname, O_RDONLY | O_CLOEXEC)) == -1) { /* Prevent the caller from re-entering. */ atomic_cmpset_rel_ptr((volatile uintptr_t *)&hpet_dev_map[u], (uintptr_t)old_map, (uintptr_t)MAP_FAILED); @@ -266,7 +266,7 @@ __vdso_init_hyperv_tsc(void) if (cap_getmode(&mode) == 0 && mode != 0) goto fail; - fd = _open(HYPERV_REFTSC_DEVPATH, O_RDONLY); + fd = _open(HYPERV_REFTSC_DEVPATH, O_RDONLY | O_CLOEXEC); if (fd < 0) goto fail; hyperv_ref_tsc = mmap(NULL, sizeof(*hyperv_ref_tsc), PROT_READ, From owner-dev-commits-src-all@freebsd.org Thu Aug 5 08:55:28 2021 Return-Path: Delivered-To: dev-commits-src-all@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 71BB465FBFA; Thu, 5 Aug 2021 08:55: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 4GgMrc1Fl0z4kjY; Thu, 5 Aug 2021 08:55: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 14C0617895; Thu, 5 Aug 2021 08:55: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 1758tRgc064228; Thu, 5 Aug 2021 08:55:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1758tR09064227; Thu, 5 Aug 2021 08:55:27 GMT (envelope-from git) Date: Thu, 5 Aug 2021 08:55:27 GMT Message-Id: <202108050855.1758tR09064227@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: dcfd60587102 - main - Add more arm64 external abort sources 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: dcfd60587102b6854cda04a7c59c8de51ecf89b3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 08:55:28 -0000 The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=dcfd60587102b6854cda04a7c59c8de51ecf89b3 commit dcfd60587102b6854cda04a7c59c8de51ecf89b3 Author: Andrew Turner AuthorDate: 2021-08-03 13:20:54 +0000 Commit: Andrew Turner CommitDate: 2021-08-04 18:50:42 +0000 Add more arm64 external abort sources These will be used when we support the Arm Reliability, Availability, and Serviceability extension. Sponsored by: The FreeBSD Foundation --- sys/arm64/arm64/trap.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sys/arm64/arm64/trap.c b/sys/arm64/arm64/trap.c index 31bdf3e0287f..40bad51e8513 100644 --- a/sys/arm64/arm64/trap.c +++ b/sys/arm64/arm64/trap.c @@ -102,6 +102,15 @@ static abort_handler *abort_handlers[] = { [ISS_DATA_DFSC_PF_L3] = data_abort, [ISS_DATA_DFSC_ALIGN] = align_abort, [ISS_DATA_DFSC_EXT] = external_abort, + [ISS_DATA_DFSC_EXT_L0] = external_abort, + [ISS_DATA_DFSC_EXT_L1] = external_abort, + [ISS_DATA_DFSC_EXT_L2] = external_abort, + [ISS_DATA_DFSC_EXT_L3] = external_abort, + [ISS_DATA_DFSC_ECC] = external_abort, + [ISS_DATA_DFSC_ECC_L0] = external_abort, + [ISS_DATA_DFSC_ECC_L1] = external_abort, + [ISS_DATA_DFSC_ECC_L2] = external_abort, + [ISS_DATA_DFSC_ECC_L3] = external_abort, }; static __inline void From owner-dev-commits-src-all@freebsd.org Thu Aug 5 09:25:44 2021 Return-Path: Delivered-To: dev-commits-src-all@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 4D3C8660245; Thu, 5 Aug 2021 09:25: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 4GgNWX1Vzgz4nQN; Thu, 5 Aug 2021 09:25: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 180F717B43; Thu, 5 Aug 2021 09:25: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 1759PiZl006531; Thu, 5 Aug 2021 09:25:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1759PiEQ006530; Thu, 5 Aug 2021 09:25:44 GMT (envelope-from git) Date: Thu, 5 Aug 2021 09:25:44 GMT Message-Id: <202108050925.1759PiEQ006530@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: 22548a3b8070 - stable/13 - Simplify and speed up the kyua build 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 22548a3b807084fe67f8ec4d9e9094fcef868e12 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 09:25:44 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=22548a3b807084fe67f8ec4d9e9094fcef868e12 commit 22548a3b807084fe67f8ec4d9e9094fcef868e12 Author: Alex Richardson AuthorDate: 2021-07-02 08:21:04 +0000 Commit: Alex Richardson CommitDate: 2021-08-05 08:56:47 +0000 Simplify and speed up the kyua build Instead of having multiple kyua libraries, just include the files as part of usr.bin/kyua. Previously, we would build each kyua source up to four times: once as a .o file and once as a .pieo. Additionally, the kyua libraries might be built again for compat32. As all the kyua libraries amount to 102 C++ sources the build time is significant (especially when using an assertions enabled compiler). This change ensures that we build 306 fewer .cpp source files as part of buildworld. Reviewed By: brooks MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D30967 Remove lib/kyua from the build I forgot to include this line in 2eb9ad427475190e87d026de4ca7fc296947f2a0. Reported by: Jenkins CI MFC after: 1 week Fixes: 2eb9ad427475190ei ("Simplify and speed up the kyua build") Revert "Remove lib/kyua from the build" Accidentally removed it from the wrong file... This reverts commit 8ec4ba8a76aaf256942ac5996d45cc29022641ae. Remove lib/kyua from the build I forgot to include this line in 2eb9ad427475190e87d026de4ca7fc296947f2a0. Reported by: Jenkins CI MFC after: 1 week Fixes: 2eb9ad427475190ei ("Simplify and speed up the kyua build") (cherry picked from commit 2eb9ad427475190e87d026de4ca7fc296947f2a0) (cherry picked from commit 8ec4ba8a76aaf256942ac5996d45cc29022641ae) (cherry picked from commit 89da04fcaa33f100a60d06770f7424e5b7f1312f) (cherry picked from commit c951566915886330612bee880d6ece0d65bf9f5d) --- lib/Makefile | 1 - lib/kyua/Makefile | 10 --- lib/kyua/Makefile.inc | 20 ----- lib/kyua/Makefile.kyua | 11 --- lib/kyua/cli/Makefile | 29 -------- lib/kyua/drivers/Makefile | 12 --- lib/kyua/engine/Makefile | 22 ------ lib/kyua/model/Makefile | 13 ---- lib/kyua/store/Makefile | 18 ----- lib/kyua/utils/Makefile | 65 ---------------- share/mk/src.libnames.mk | 30 -------- usr.bin/kyua/Makefile | 140 +++++++++++++++++++++++++++++++++-- {lib => usr.bin}/kyua/config.h | 0 {lib => usr.bin}/kyua/utils/defs.hpp | 0 14 files changed, 135 insertions(+), 236 deletions(-) diff --git a/lib/Makefile b/lib/Makefile index 35cba77d7d06..3c218415d9ca 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -216,7 +216,6 @@ SUBDIR.${MK_RADIUS_SUPPORT}+= libradius SUBDIR.${MK_SENDMAIL}+= libmilter libsm libsmdb libsmutil SUBDIR.${MK_TELNET}+= libtelnet SUBDIR.${MK_TESTS_SUPPORT}+= atf -SUBDIR.${MK_TESTS_SUPPORT}.${MK_CXX}+= kyua SUBDIR.${MK_TESTS_SUPPORT}.${MK_CXX}+= liblutok SUBDIR.${MK_TESTS}+= tests SUBDIR.${MK_UNBOUND}+= libunbound diff --git a/lib/kyua/Makefile b/lib/kyua/Makefile deleted file mode 100644 index 1a1ea8bf5828..000000000000 --- a/lib/kyua/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -# $FreeBSD$ - -SUBDIR= cli \ - drivers \ - engine \ - model \ - store \ - utils - -.include diff --git a/lib/kyua/Makefile.inc b/lib/kyua/Makefile.inc deleted file mode 100644 index 52f19d3140b3..000000000000 --- a/lib/kyua/Makefile.inc +++ /dev/null @@ -1,20 +0,0 @@ -# $FreeBSD$ - -KYUA_LIBDIR:= ${.PARSEDIR} - -.include "${KYUA_LIBDIR}/Makefile.kyua" - -LIB_CXX= kyua_${KYUA_LIB} -INTERNALLIB= - -.PATH: ${KYUA_SRCDIR}/${KYUA_LIB} -CFLAGS+= -I${KYUA_LIBDIR} \ - -I${KYUA_SRCDIR} \ - -I${SRCTOP}/contrib/lutok/include - -CFLAGS+= -DHAVE_CONFIG_H - -# kyua uses auto_ptr -CFLAGS+= -Wno-deprecated-declarations - -.include "${.PARSEDIR}/../Makefile.inc" diff --git a/lib/kyua/Makefile.kyua b/lib/kyua/Makefile.kyua deleted file mode 100644 index 1fd30a135409..000000000000 --- a/lib/kyua/Makefile.kyua +++ /dev/null @@ -1,11 +0,0 @@ -# $FreeBSD$ - -KYUA_VERSION= 0.13 - -KYUA_CONFDIR= /etc/kyua -KYUA_DOCDIR= /usr/share/doc/kyua -KYUA_EGDIR= /usr/share/examples/kyua -KYUA_MISCDIR= /usr/share/kyua/misc -KYUA_STOREDIR= /usr/share/kyua/store - -KYUA_SRCDIR= ${SRCTOP}/contrib/kyua diff --git a/lib/kyua/cli/Makefile b/lib/kyua/cli/Makefile deleted file mode 100644 index b5de51607c12..000000000000 --- a/lib/kyua/cli/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -# $FreeBSD$ - -KYUA_LIB= cli -INTERNALLIB= -LIBADD= kyua_drivers kyua_engine kyua_model kyua_store kyua_utils -CFLAGS+= -DKYUA_CONFDIR=\"${KYUA_CONFDIR}\" \ - -DKYUA_DOCDIR=\"${KYUA_DOCDIR}\" \ - -DKYUA_MISCDIR=\"${KYUA_MISCDIR}\" \ - -DPACKAGE=\"kyua\" \ - -DPACKAGE_NAME=\"Kyua\" \ - -DPACKAGE_VERSION=\"${KYUA_VERSION}\" \ - -DVERSION=\"${KYUA_VERSION}\" - -SRCS= cmd_about.cpp \ - cmd_config.cpp \ - cmd_db_exec.cpp \ - cmd_db_migrate.cpp \ - cmd_debug.cpp \ - cmd_help.cpp \ - cmd_list.cpp \ - cmd_report.cpp \ - cmd_report_html.cpp \ - cmd_report_junit.cpp \ - cmd_test.cpp \ - common.cpp \ - config.cpp \ - main.cpp - -.include diff --git a/lib/kyua/drivers/Makefile b/lib/kyua/drivers/Makefile deleted file mode 100644 index adf9c0601269..000000000000 --- a/lib/kyua/drivers/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -# $FreeBSD$ - -KYUA_LIB= drivers -LIBADD= kyua_model kyua_engine kyua_store - -SRCS= debug_test.cpp \ - list_tests.cpp \ - report_junit.cpp \ - run_tests.cpp \ - scan_results.cpp - -.include diff --git a/lib/kyua/engine/Makefile b/lib/kyua/engine/Makefile deleted file mode 100644 index 4f0c9053c692..000000000000 --- a/lib/kyua/engine/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -# $FreeBSD$ - -KYUA_LIB= engine -LIBADD= lutok kyua_utils -CFLAGS= -DKYUA_ARCHITECTURE=\"${MACHINE_ARCH}\" \ - -DKYUA_PLATFORM=\"${MACHINE}\" - -SRCS= atf.cpp \ - atf_list.cpp \ - atf_result.cpp \ - config.cpp \ - exceptions.cpp \ - filters.cpp \ - kyuafile.cpp \ - plain.cpp \ - requirements.cpp \ - scanner.cpp \ - tap.cpp \ - tap_parser.cpp \ - scheduler.cpp - -.include diff --git a/lib/kyua/model/Makefile b/lib/kyua/model/Makefile deleted file mode 100644 index d4a0b91587e7..000000000000 --- a/lib/kyua/model/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -# $FreeBSD$ - -KYUA_LIB= model -LIBADD= lutok - -SRCS= context.cpp \ - exceptions.cpp \ - metadata.cpp \ - test_case.cpp \ - test_program.cpp \ - test_result.cpp - -.include diff --git a/lib/kyua/store/Makefile b/lib/kyua/store/Makefile deleted file mode 100644 index 39753691873e..000000000000 --- a/lib/kyua/store/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -# $FreeBSD$ - -KYUA_LIB= store -LIBADD= kyua_model kyua_utils sqlite3 - -CFLAGS+= -DKYUA_STOREDIR=\"${KYUA_STOREDIR}\" - -SRCS= dbtypes.cpp \ - exceptions.cpp \ - layout.cpp \ - metadata.cpp \ - migrate.cpp \ - read_backend.cpp \ - read_transaction.cpp \ - write_backend.cpp \ - write_transaction.cpp - -.include diff --git a/lib/kyua/utils/Makefile b/lib/kyua/utils/Makefile deleted file mode 100644 index 740b395d6951..000000000000 --- a/lib/kyua/utils/Makefile +++ /dev/null @@ -1,65 +0,0 @@ -# $FreeBSD$ - -KYUA_LIB= utils -LIBADD= lutok - -CFLAGS+= -I${SRCTOP}/contrib/sqlite3 -CFLAGS+= -DGDB=\"/usr/local/bin/gdb\" - -SRCS= datetime.cpp \ - env.cpp \ - memory.cpp \ - passwd.cpp \ - sanity.cpp \ - stacktrace.cpp \ - stream.cpp \ - units.cpp \ - cmdline/base_command.cpp \ - cmdline/exceptions.cpp \ - cmdline/globals.cpp \ - cmdline/options.cpp \ - cmdline/parser.cpp \ - cmdline/ui.cpp \ - cmdline/ui_mock.cpp \ - config/exceptions.cpp \ - config/keys.cpp \ - config/lua_module.cpp \ - config/nodes.cpp \ - config/parser.cpp \ - config/tree.cpp \ - format/exceptions.cpp \ - format/formatter.cpp \ - fs/auto_cleaners.cpp \ - fs/directory.cpp \ - fs/exceptions.cpp \ - fs/lua_module.cpp \ - fs/operations.cpp \ - fs/path.cpp \ - logging/operations.cpp \ - process/child.cpp \ - process/deadline_killer.cpp \ - process/exceptions.cpp \ - process/executor.cpp \ - process/fdstream.cpp \ - process/isolation.cpp \ - process/operations.cpp \ - process/status.cpp \ - process/system.cpp \ - process/systembuf.cpp \ - signals/exceptions.cpp \ - signals/interrupts.cpp \ - signals/misc.cpp \ - signals/programmer.cpp \ - signals/timer.cpp \ - sqlite/c_gate.cpp \ - sqlite/database.cpp \ - sqlite/exceptions.cpp \ - sqlite/statement.cpp \ - sqlite/transaction.cpp \ - text/exceptions.cpp \ - text/operations.cpp \ - text/regex.cpp \ - text/table.cpp \ - text/templates.cpp \ - -.include diff --git a/share/mk/src.libnames.mk b/share/mk/src.libnames.mk index 249443f1dcf2..93ae9caf1a2d 100644 --- a/share/mk/src.libnames.mk +++ b/share/mk/src.libnames.mk @@ -41,12 +41,6 @@ _INTERNALLIBS= \ fifolog \ ifconfig \ ipf \ - kyua_cli \ - kyua_drivers \ - kyua_engine \ - kyua_model \ - kyua_store \ - kyua_utils \ lpr \ lua \ lutok \ @@ -270,12 +264,6 @@ _DP_bsnmp= crypto _DP_geom= bsdxml sbuf _DP_cam= sbuf _DP_kvm= elf -_DP_kyua_cli= kyua_drivers kyua_engine kyua_model kyua_store kyua_utils -_DP_kyua_drivers= kyua_model kyua_engine kyua_store -_DP_kyua_engine= lutok kyua_utils -_DP_kyua_model= lutok -_DP_kyua_utils= lutok -_DP_kyua_store= kyua_model kyua_utils sqlite3 _DP_casper= nv _DP_cap_dns= nv _DP_cap_fileargs= nv @@ -498,24 +486,6 @@ _LIB_OBJTOP?= ${OBJTOP} LIBELFTCDIR= ${_LIB_OBJTOP}/lib/libelftc LIBELFTC?= ${LIBELFTCDIR}/libelftc${PIE_SUFFIX}.a -LIBKYUA_CLIDIR= ${_LIB_OBJTOP}/lib/kyua/cli -LIBKYUA_CLI?= ${LIBKYUA_CLIDIR}/libkyua_cli${PIE_SUFFIX}.a - -LIBKYUA_DRIVERSDIR= ${_LIB_OBJTOP}/lib/kyua/drivers -LIBKYUA_DRIVERS?= ${LIBKYUA_DRIVERSDIR}/libkyua_drivers${PIE_SUFFIX}.a - -LIBKYUA_ENGINEDIR= ${_LIB_OBJTOP}/lib/kyua/engine -LIBKYUA_ENGINE?= ${LIBKYUA_ENGINEDIR}/libkyua_engine${PIE_SUFFIX}.a - -LIBKYUA_MODELDIR= ${_LIB_OBJTOP}/lib/kyua/model -LIBKYUA_MODEL?= ${LIBKYUA_MODELDIR}/libkyua_model${PIE_SUFFIX}.a - -LIBKYUA_STOREDIR= ${_LIB_OBJTOP}/lib/kyua/store -LIBKYUA_STORE?= ${LIBKYUA_STOREDIR}/libkyua_store${PIE_SUFFIX}.a - -LIBKYUA_UTILSDIR= ${_LIB_OBJTOP}/lib/kyua/utils -LIBKYUA_UTILS?= ${LIBKYUA_UTILSDIR}/libkyua_utils${PIE_SUFFIX}.a - LIBLUADIR= ${_LIB_OBJTOP}/lib/liblua LIBLUA?= ${LIBLUADIR}/liblua${PIE_SUFFIX}.a diff --git a/usr.bin/kyua/Makefile b/usr.bin/kyua/Makefile index e27c8603f11b..966927709a06 100644 --- a/usr.bin/kyua/Makefile +++ b/usr.bin/kyua/Makefile @@ -2,14 +2,20 @@ .include -.include "${SRCTOP}/lib/kyua/Makefile.kyua" - +KYUA_CONFDIR= /etc/kyua +KYUA_DOCDIR= /usr/share/doc/kyua +KYUA_EGDIR= /usr/share/examples/kyua +KYUA_MISCDIR= /usr/share/kyua/misc +KYUA_STOREDIR= /usr/share/kyua/store +KYUA_VERSION= 0.13 + +KYUA_SRCDIR= ${SRCTOP}/contrib/kyua .PATH: ${KYUA_SRCDIR} PACKAGE= tests PROG_CXX= kyua SRCS= main.cpp -LIBADD= kyua_cli kyua_drivers kyua_engine kyua_model kyua_store +LIBADD= lutok sqlite3 MAN= kyua-about.1 \ kyua-config.1 \ @@ -26,10 +32,134 @@ MAN= kyua-about.1 \ kyua.conf.5 \ kyuafile.5 -CFLAGS+= -I${KYUA_SRCDIR} - +CFLAGS+= -I${KYUA_SRCDIR} -I${.CURDIR} +CFLAGS+= -I${SRCTOP}/contrib/lutok/include +CFLAGS+= -I${SRCTOP}/contrib/sqlite3 # kyua uses auto_ptr CFLAGS+= -Wno-deprecated-declarations +CFLAGS+= -DHAVE_CONFIG_H + +# We compile the kyua libraries as part of the main executable as this saves +# compile time and we don't install them anyway. +CFLAGS+= -DGDB=\"/usr/local/bin/gdb\" \ + -DKYUA_ARCHITECTURE=\"${MACHINE_ARCH}\" \ + -DKYUA_CONFDIR=\"${KYUA_CONFDIR}\" \ + -DKYUA_DOCDIR=\"${KYUA_DOCDIR}\" \ + -DKYUA_MISCDIR=\"${KYUA_MISCDIR}\" \ + -DKYUA_PLATFORM=\"${MACHINE}\" \ + -DKYUA_STOREDIR=\"${KYUA_STOREDIR}\" \ + -DPACKAGE=\"kyua\" \ + -DPACKAGE_NAME=\"Kyua\" \ + -DPACKAGE_VERSION=\"${KYUA_VERSION}\" \ + -DVERSION=\"${KYUA_VERSION}\" + +SRCS+= utils/datetime.cpp \ + utils/env.cpp \ + utils/memory.cpp \ + utils/passwd.cpp \ + utils/sanity.cpp \ + utils/stacktrace.cpp \ + utils/stream.cpp \ + utils/units.cpp \ + utils/cmdline/base_command.cpp \ + utils/cmdline/exceptions.cpp \ + utils/cmdline/globals.cpp \ + utils/cmdline/options.cpp \ + utils/cmdline/parser.cpp \ + utils/cmdline/ui.cpp \ + utils/cmdline/ui_mock.cpp \ + utils/config/exceptions.cpp \ + utils/config/keys.cpp \ + utils/config/lua_module.cpp \ + utils/config/nodes.cpp \ + utils/config/parser.cpp \ + utils/config/tree.cpp \ + utils/format/exceptions.cpp \ + utils/format/formatter.cpp \ + utils/fs/auto_cleaners.cpp \ + utils/fs/directory.cpp \ + utils/fs/exceptions.cpp \ + utils/fs/lua_module.cpp \ + utils/fs/operations.cpp \ + utils/fs/path.cpp \ + utils/logging/operations.cpp \ + utils/process/child.cpp \ + utils/process/deadline_killer.cpp \ + utils/process/exceptions.cpp \ + utils/process/executor.cpp \ + utils/process/fdstream.cpp \ + utils/process/isolation.cpp \ + utils/process/operations.cpp \ + utils/process/status.cpp \ + utils/process/system.cpp \ + utils/process/systembuf.cpp \ + utils/signals/exceptions.cpp \ + utils/signals/interrupts.cpp \ + utils/signals/misc.cpp \ + utils/signals/programmer.cpp \ + utils/signals/timer.cpp \ + utils/sqlite/c_gate.cpp \ + utils/sqlite/database.cpp \ + utils/sqlite/exceptions.cpp \ + utils/sqlite/statement.cpp \ + utils/sqlite/transaction.cpp \ + utils/text/exceptions.cpp \ + utils/text/operations.cpp \ + utils/text/regex.cpp \ + utils/text/table.cpp \ + utils/text/templates.cpp + +SRCS+= model/context.cpp \ + model/exceptions.cpp \ + model/metadata.cpp \ + model/test_case.cpp \ + model/test_program.cpp \ + model/test_result.cpp + +SRCS+= engine/atf.cpp \ + engine/atf_list.cpp \ + engine/atf_result.cpp \ + engine/config.cpp \ + engine/exceptions.cpp \ + engine/filters.cpp \ + engine/kyuafile.cpp \ + engine/plain.cpp \ + engine/requirements.cpp \ + engine/scanner.cpp \ + engine/tap.cpp \ + engine/tap_parser.cpp \ + engine/scheduler.cpp + +SRCS+= store/dbtypes.cpp \ + store/exceptions.cpp \ + store/layout.cpp \ + store/metadata.cpp \ + store/migrate.cpp \ + store/read_backend.cpp \ + store/read_transaction.cpp \ + store/write_backend.cpp \ + store/write_transaction.cpp + +SRCS+= drivers/debug_test.cpp \ + drivers/list_tests.cpp \ + drivers/report_junit.cpp \ + drivers/run_tests.cpp \ + drivers/scan_results.cpp + +SRCS+= cli/cmd_about.cpp \ + cli/cmd_config.cpp \ + cli/cmd_db_exec.cpp \ + cli/cmd_db_migrate.cpp \ + cli/cmd_debug.cpp \ + cli/cmd_help.cpp \ + cli/cmd_list.cpp \ + cli/cmd_report.cpp \ + cli/cmd_report_html.cpp \ + cli/cmd_report_junit.cpp \ + cli/cmd_test.cpp \ + cli/common.cpp \ + cli/config.cpp \ + cli/main.cpp FILESGROUPS= DOCS MISC STORE diff --git a/lib/kyua/config.h b/usr.bin/kyua/config.h similarity index 100% rename from lib/kyua/config.h rename to usr.bin/kyua/config.h diff --git a/lib/kyua/utils/defs.hpp b/usr.bin/kyua/utils/defs.hpp similarity index 100% rename from lib/kyua/utils/defs.hpp rename to usr.bin/kyua/utils/defs.hpp From owner-dev-commits-src-all@freebsd.org Thu Aug 5 09:25:46 2021 Return-Path: Delivered-To: dev-commits-src-all@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 E47BA660251; Thu, 5 Aug 2021 09:25: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 4GgNWZ4nMbz4nVm; Thu, 5 Aug 2021 09:25: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 4E40917E1F; Thu, 5 Aug 2021 09:25: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 1759PkIE006581; Thu, 5 Aug 2021 09:25:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1759Pkmv006580; Thu, 5 Aug 2021 09:25:46 GMT (envelope-from git) Date: Thu, 5 Aug 2021 09:25:46 GMT Message-Id: <202108050925.1759Pkmv006580@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: 608cb9631239 - stable/13 - 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 608cb96312395a755f79e5108a54f69c53557428 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 09:25:47 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=608cb96312395a755f79e5108a54f69c53557428 commit 608cb96312395a755f79e5108a54f69c53557428 Author: Alex Richardson AuthorDate: 2021-07-06 09:50:05 +0000 Commit: Alex Richardson CommitDate: 2021-08-05 08:57:54 +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 (cherry picked from commit 4d552825ecebecd6c95a995c0b314b09936121b5) --- 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-all@freebsd.org Thu Aug 5 09:25:45 2021 Return-Path: Delivered-To: dev-commits-src-all@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 9612E660249; Thu, 5 Aug 2021 09:25: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 4GgNWY2qvtz4nQR; Thu, 5 Aug 2021 09:25: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 30D5817CB0; Thu, 5 Aug 2021 09:25: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 1759PjHA006557; Thu, 5 Aug 2021 09:25:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1759PjrS006556; Thu, 5 Aug 2021 09:25:45 GMT (envelope-from git) Date: Thu, 5 Aug 2021 09:25:45 GMT Message-Id: <202108050925.1759PjrS006556@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: e4c2ffe93205 - stable/13 - 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/stable/13 X-Git-Reftype: branch X-Git-Commit: e4c2ffe932050f42271a5e1b00b185358fb5f5cc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 09:25:45 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=e4c2ffe932050f42271a5e1b00b185358fb5f5cc commit e4c2ffe932050f42271a5e1b00b185358fb5f5cc Author: Alex Richardson AuthorDate: 2021-07-05 13:32:48 +0000 Commit: Alex Richardson CommitDate: 2021-08-05 08:57:45 +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 (cherry picked from commit d053fb22f6d3b6bb0f4e47e4507fefc20cbe0e32) --- 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-all@freebsd.org Thu Aug 5 09:25:47 2021 Return-Path: Delivered-To: dev-commits-src-all@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 B60726600DC; Thu, 5 Aug 2021 09:25: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 4GgNWb49Rlz4nFF; Thu, 5 Aug 2021 09:25: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 6B18017DFC; Thu, 5 Aug 2021 09:25: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 1759Pl3j006607; Thu, 5 Aug 2021 09:25:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1759PlrS006606; Thu, 5 Aug 2021 09:25:47 GMT (envelope-from git) Date: Thu, 5 Aug 2021 09:25:47 GMT Message-Id: <202108050925.1759PlrS006606@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: 7a7324d9cebe - stable/13 - 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 7a7324d9cebee6f42d77a39f3a8c657e23676cc2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 09:25:47 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=7a7324d9cebee6f42d77a39f3a8c657e23676cc2 commit 7a7324d9cebee6f42d77a39f3a8c657e23676cc2 Author: Alex Richardson AuthorDate: 2021-07-06 11:16:40 +0000 Commit: Alex Richardson CommitDate: 2021-08-05 08:59:26 +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 (cherry picked from commit c78f449d85e0b292fe5d942cca99f11c1cd430fa) --- 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-all@freebsd.org Thu Aug 5 09:25:49 2021 Return-Path: Delivered-To: dev-commits-src-all@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 30FA46605E3; Thu, 5 Aug 2021 09:25: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 4GgNWc73kXz4nVw; Thu, 5 Aug 2021 09:25: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 985D417B44; Thu, 5 Aug 2021 09:25: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 1759PmWb006631; Thu, 5 Aug 2021 09:25:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1759Pmir006630; Thu, 5 Aug 2021 09:25:48 GMT (envelope-from git) Date: Thu, 5 Aug 2021 09:25:48 GMT Message-Id: <202108050925.1759Pmir006630@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: 120f0a029e26 - stable/13 - 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 120f0a029e267067325757f4269ab6b30506ddd7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 09:25:49 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=120f0a029e267067325757f4269ab6b30506ddd7 commit 120f0a029e267067325757f4269ab6b30506ddd7 Author: Alex Richardson AuthorDate: 2021-07-06 11:18:29 +0000 Commit: Alex Richardson CommitDate: 2021-08-05 08:59:51 +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 (cherry picked from commit 2eefc1d926430dbba83128d27f8bed3c34199159) --- 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-all@freebsd.org Thu Aug 5 09:25:50 2021 Return-Path: Delivered-To: dev-commits-src-all@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 1357A660462; Thu, 5 Aug 2021 09:25: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 4GgNWd6940z4nTH; Thu, 5 Aug 2021 09:25: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 B694217BDC; Thu, 5 Aug 2021 09:25: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 1759PnYk006659; Thu, 5 Aug 2021 09:25:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1759PnKr006658; Thu, 5 Aug 2021 09:25:49 GMT (envelope-from git) Date: Thu, 5 Aug 2021 09:25:49 GMT Message-Id: <202108050925.1759PnKr006658@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: 0869d85591db - stable/13 - bin/ps: Avoid function name conflict with libc uname() 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 0869d85591dbe71eff4cbd9fc93077cf5943a00c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 09:25:50 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=0869d85591dbe71eff4cbd9fc93077cf5943a00c commit 0869d85591dbe71eff4cbd9fc93077cf5943a00c Author: Alex Richardson AuthorDate: 2021-07-19 14:03:38 +0000 Commit: Alex Richardson CommitDate: 2021-08-05 08:59:59 +0000 bin/ps: Avoid function name conflict with libc uname() This prevents ps from being built with address sanitizer instrumentation. Reviewed By: trasz MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31048 (cherry picked from commit 2423585b1de50dd2daea8478318e94ff80e0e6ec) --- bin/ps/extern.h | 2 +- bin/ps/keyword.c | 2 +- bin/ps/print.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/ps/extern.h b/bin/ps/extern.h index 723d7fcb85dd..ea4362eeadd9 100644 --- a/bin/ps/extern.h +++ b/bin/ps/extern.h @@ -86,7 +86,7 @@ char *tdev(KINFO *, VARENT *); char *tdnam(KINFO *, VARENT *); char *tname(KINFO *, VARENT *); char *ucomm(KINFO *, VARENT *); -char *uname(KINFO *, VARENT *); +char *username(KINFO *, VARENT *); char *upr(KINFO *, VARENT *); char *usertime(KINFO *, VARENT *); char *vsize(KINFO *, VARENT *); diff --git a/bin/ps/keyword.c b/bin/ps/keyword.c index 2a8382a2273e..e78cf984e455 100644 --- a/bin/ps/keyword.c +++ b/bin/ps/keyword.c @@ -222,7 +222,7 @@ static VAR var[] = { {"upr", "UPR", NULL, "user-priority", 0, upr, 0, CHAR, NULL, 0}, {"uprocp", "UPROCP", NULL, "process-address", 0, kvar, KOFF(ki_paddr), KPTR, "lx", 0}, - {"user", "USER", NULL, "user", LJUST, uname, 0, CHAR, NULL, 0}, + {"user", "USER", NULL, "user", LJUST, username, 0, CHAR, NULL, 0}, {"usertime", "USERTIME", NULL, "user-time", USER, usertime, 0, CHAR, NULL, 0}, {"usrpri", "", "upr", NULL, 0, NULL, 0, CHAR, NULL, 0}, diff --git a/bin/ps/print.c b/bin/ps/print.c index 3d3a543c8a5d..2b61c6b0a15a 100644 --- a/bin/ps/print.c +++ b/bin/ps/print.c @@ -311,7 +311,7 @@ upr(KINFO *k, VARENT *ve __unused) #undef scalepri char * -uname(KINFO *k, VARENT *ve __unused) +username(KINFO *k, VARENT *ve __unused) { return (strdup(user_from_uid(k->ki_p->ki_uid, 0))); From owner-dev-commits-src-all@freebsd.org Thu Aug 5 09:25:51 2021 Return-Path: Delivered-To: dev-commits-src-all@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 E633E66049C; Thu, 5 Aug 2021 09:25: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 4GgNWg1T76z4nQk; Thu, 5 Aug 2021 09:25:51 +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 DF65A17861; Thu, 5 Aug 2021 09:25: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 1759Povx006686; Thu, 5 Aug 2021 09:25:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1759PoD2006685; Thu, 5 Aug 2021 09:25:50 GMT (envelope-from git) Date: Thu, 5 Aug 2021 09:25:50 GMT Message-Id: <202108050925.1759PoD2006685@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: e0174face9bb - stable/13 - Allow building usr.bin/vi with MK_ASAN 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/stable/13 X-Git-Reftype: branch X-Git-Commit: e0174face9bb3fe83dbc92984c32ad4ff32e6b7c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 09:25:52 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=e0174face9bb3fe83dbc92984c32ad4ff32e6b7c commit e0174face9bb3fe83dbc92984c32ad4ff32e6b7c Author: Alex Richardson AuthorDate: 2021-07-19 14:04:19 +0000 Commit: Alex Richardson CommitDate: 2021-08-05 09:00:14 +0000 Allow building usr.bin/vi with MK_ASAN We have to namespace the regex functions to avoid duplicate symbol errors. This also ensures that vi doesn't define the libc reg* functions with mismatched signatures. ld: error: duplicate symbol: regcomp >>> defined at sanitizer_common_interceptors.inc:7519 (/usr/src/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc:7519) >>> asan_interceptors.o:(__interceptor_regcomp) in archive /usr/lib/clang/10.0.1/lib/freebsd/libclang_rt.asan-x86_64.a >>> defined at regcomp.c >>> .../regex/regcomp.c.o:(.text+0x0) ld: error: duplicate symbol: regerror >>> defined at sanitizer_common_interceptors.inc:7543 (/usr/src/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc:7543) >>> asan_interceptors.o:(__interceptor_regerror) in archive /usr/lib/clang/10.0.1/lib/freebsd/libclang_rt.asan-x86_64.a >>> defined at regerror.c >>> .../regex/regerror.c.o:(.text+0x0) ld: error: duplicate symbol: regexec >>> defined at sanitizer_common_interceptors.inc:7530 (/usr/src/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc:7530) >>> asan_interceptors.o:(__interceptor_regexec) in archive /usr/lib/clang/10.0.1/lib/freebsd/libclang_rt.asan-x86_64.a >>> defined at regexec.c >>> .../regex/regexec.c.o:(.text+0x0) ld: error: duplicate symbol: regfree >>> defined at sanitizer_common_interceptors.inc:7553 (/usr/src/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc:7553) >>> asan_interceptors.o:(__interceptor_regfree) in archive /usr/lib/clang/10.0.1/lib/freebsd/libclang_rt.asan-x86_64.a >>> defined at regfree.c >>> .../regex/regfree.c.o:(.text+0x0) Committed upstream as https://github.com/lichray/nvi2/pull/92 Reviewed By: bapt Differential Revision: https://reviews.freebsd.org/D31050 (cherry picked from commit 8ef98a8045d4623edd75b91ce76eedeaa4ad3f01) --- contrib/nvi/regex/regex.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/contrib/nvi/regex/regex.h b/contrib/nvi/regex/regex.h index 20ea7865c0a0..7d788514a54c 100644 --- a/contrib/nvi/regex/regex.h +++ b/contrib/nvi/regex/regex.h @@ -96,6 +96,16 @@ typedef struct { #define REG_LARGE 01000 /* force large representation */ #define REG_BACKR 02000 /* force use of backref code */ +#ifdef USE_WIDECHAR +/* + * Avoid function name conflicts with the system regex functions. + * This is needed e.g. to build with AddressSanitizer. + */ +#define regcomp nvi_regcomp +#define regerror nvi_regerror +#define regexec nvi_regexec +#define regfree nvi_regfree +#endif int regcomp(regex_t *, const RCHAR_T *, int); size_t regerror(int, const regex_t *, char *, size_t); int regexec(const regex_t *, From owner-dev-commits-src-all@freebsd.org Thu Aug 5 09:25:52 2021 Return-Path: Delivered-To: dev-commits-src-all@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 52D89660543; Thu, 5 Aug 2021 09:25:52 +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 4GgNWh14G8z4nFQ; Thu, 5 Aug 2021 09:25:52 +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 09D3C17BDD; Thu, 5 Aug 2021 09:25: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 1759PpVc006712; Thu, 5 Aug 2021 09:25:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1759PpMZ006711; Thu, 5 Aug 2021 09:25:51 GMT (envelope-from git) Date: Thu, 5 Aug 2021 09:25:51 GMT Message-Id: <202108050925.1759PpMZ006711@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: b7440d235e5d - stable/13 - Don't build lldb-tablegen if MK_LLDB=no 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/stable/13 X-Git-Reftype: branch X-Git-Commit: b7440d235e5d5abba30d67fc59d822b190e6d267 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 09:25:52 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=b7440d235e5d5abba30d67fc59d822b190e6d267 commit b7440d235e5d5abba30d67fc59d822b190e6d267 Author: Alex Richardson AuthorDate: 2021-07-05 17:36:02 +0000 Commit: Alex Richardson CommitDate: 2021-08-05 09:00:28 +0000 Don't build lldb-tablegen if MK_LLDB=no Split out from D31060. Reviewed by: emaste (cherry picked from commit c5d1d88a351abe869c436f4f70c85d4c29e6e98c) --- Makefile.inc1 | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index a595dfbb76c9..ebc0733de857 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -2325,14 +2325,17 @@ _gensnmptree= usr.sbin/bsnmpd/gensnmptree # We need to build tblgen when we're building clang or lld, either as # bootstrap tools, or as the part of the normal build. .if ${MK_CLANG_BOOTSTRAP} != "no" || ${MK_CLANG} != "no" || \ - ${MK_LLD_BOOTSTRAP} != "no" || ${MK_LLD} != "no" + ${MK_LLD_BOOTSTRAP} != "no" || ${MK_LLD} != "no" || \ + ${MK_LLDB} != "no" _clang_tblgen= \ lib/clang/libllvmminimal \ - usr.bin/clang/llvm-tblgen \ - usr.bin/clang/clang-tblgen \ - usr.bin/clang/lldb-tblgen -# XXX: lldb-tblgen is not needed, if top-level MK_LLDB=no - + usr.bin/clang/llvm-tblgen +.if ${MK_CLANG_BOOTSTRAP} != "no" || ${MK_CLANG} != "no" +_clang_tblgen+= usr.bin/clang/clang-tblgen +.endif +.if ${MK_LLDB} != "no" +_clang_tblgen+= usr.bin/clang/lldb-tblgen +.endif ${_bt}-usr.bin/clang/clang-tblgen: ${_bt}-lib/clang/libllvmminimal ${_bt}-usr.bin/clang/llvm-tblgen: ${_bt}-lib/clang/libllvmminimal ${_bt}-usr.bin/clang/lldb-tblgen: ${_bt}-lib/clang/libllvmminimal From owner-dev-commits-src-all@freebsd.org Thu Aug 5 09:25:53 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A45E5660265; Thu, 5 Aug 2021 09:25: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 4GgNWj2JB7z4nLn; Thu, 5 Aug 2021 09:25: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 27A4617CB1; Thu, 5 Aug 2021 09:25: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 1759Prfr006736; Thu, 5 Aug 2021 09:25:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1759Prwk006735; Thu, 5 Aug 2021 09:25:53 GMT (envelope-from git) Date: Thu, 5 Aug 2021 09:25:53 GMT Message-Id: <202108050925.1759Prwk006735@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: e2e533bdcc7f - stable/13 - bsd.linker.mk: Detect LLD when built with PACKAGE_VENDOR 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/stable/13 X-Git-Reftype: branch X-Git-Commit: e2e533bdcc7f033fddd9155d126b1f8ddb095e56 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 09:25:53 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=e2e533bdcc7f033fddd9155d126b1f8ddb095e56 commit e2e533bdcc7f033fddd9155d126b1f8ddb095e56 Author: Alex Richardson AuthorDate: 2021-07-20 15:04:56 +0000 Commit: Alex Richardson CommitDate: 2021-08-05 09:00:36 +0000 bsd.linker.mk: Detect LLD when built with PACKAGE_VENDOR Recent versions of homebrew's LLD are built with PACKAGE_VENDOR (since https://github.com/Homebrew/homebrew-core/commit/e7c972b6062af753e564104e58d1fa20c0d1ad7a). This means that the -v output is now `Homebrew LLD 12.0.1 (compatible with GNU linkers)` and bsd.linker.mk no longer detects it as LLD since it only checks whether the first word is LLD. This change allow me to build on macOS again and should unbreak the GitHub actions CI. Reviewed By: imp, uqs MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D31224 (cherry picked from commit f8147dad44f1036160a413bb00b4e8b41f7a4a84) --- share/mk/bsd.linker.mk | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/share/mk/bsd.linker.mk b/share/mk/bsd.linker.mk index 344a5b937380..7209d7f173ae 100644 --- a/share/mk/bsd.linker.mk +++ b/share/mk/bsd.linker.mk @@ -69,7 +69,9 @@ _ld_version!= (${${ld}} -v 2>&1 || echo none) | sed -n 1p ${X_}LINKER_TYPE= bfd ${X_}LINKER_FREEBSD_VERSION= 0 _v= ${_ld_version:M[1-9]*.[0-9]*:[1]} -.elif ${_ld_version:[1]} == "LLD" +.elif ${_ld_version:MLLD} +# Strip any leading PACKAGE_VENDOR string (e.g. "Homebrew") +_ld_version:=${_ld_version:[*]:C/^.* LLD /LLD /:[@]} ${X_}LINKER_TYPE= lld _v= ${_ld_version:[2]} .if ${_ld_version:[3]} == "(FreeBSD" From owner-dev-commits-src-all@freebsd.org Thu Aug 5 09:25:54 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C9B90660703; Thu, 5 Aug 2021 09:25: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 4GgNWk4187z4nNG; Thu, 5 Aug 2021 09:25: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 53B3617CB2; Thu, 5 Aug 2021 09:25: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 1759PsvN006762; Thu, 5 Aug 2021 09:25:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1759Ps4T006761; Thu, 5 Aug 2021 09:25:54 GMT (envelope-from git) Date: Thu, 5 Aug 2021 09:25:54 GMT Message-Id: <202108050925.1759Ps4T006761@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: 85c76b41178c - stable/13 - tools/build: Don't redefine open() for the linux bootstrap 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 85c76b41178c69ad8262523bc19fe53d69110d92 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 09:25:54 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=85c76b41178c69ad8262523bc19fe53d69110d92 commit 85c76b41178c69ad8262523bc19fe53d69110d92 Author: Alex Richardson AuthorDate: 2021-08-02 08:45:05 +0000 Commit: Alex Richardson CommitDate: 2021-08-05 09:00:45 +0000 tools/build: Don't redefine open() for the linux bootstrap This is needed to bootstrap llvm-tblgen on Linux since LLVM calls `::open(...)` which does not work if open is a statement macro. Also stop defining O_SHLOCK/O_EXLOCK and update the only bootstrap tools user of those flags to deal with missing definitions. Reviewed By: jrtc27 MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31226 (cherry picked from commit 5f6c8ce2452da2da233e37bf4c2b6fccde8594b1) --- lib/libc/db/db/db.c | 6 ++++++ tools/build/cross-build/include/linux/fcntl.h | 25 ++++--------------------- 2 files changed, 10 insertions(+), 21 deletions(-) diff --git a/lib/libc/db/db/db.c b/lib/libc/db/db/db.c index a9a5b060da62..7158cc80e44e 100644 --- a/lib/libc/db/db/db.c +++ b/lib/libc/db/db/db.c @@ -49,6 +49,12 @@ static int __dberr(void); #ifndef O_CLOEXEC #define O_CLOEXEC 0 #endif +#ifndef O_EXLOCK +#define O_EXLOCK 0 +#endif +#ifndef O_SHLOCK +#define O_SHLOCK 0 +#endif DB * dbopen(const char *fname, int flags, int mode, DBTYPE type, const void *openinfo) diff --git a/tools/build/cross-build/include/linux/fcntl.h b/tools/build/cross-build/include/linux/fcntl.h index 94662befddad..4fa169d4ed4c 100644 --- a/tools/build/cross-build/include/linux/fcntl.h +++ b/tools/build/cross-build/include/linux/fcntl.h @@ -1,7 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause * - * Copyright 2018-2020 Alex Richardson + * Copyright 2018-2021 Alex Richardson * * This software was developed by SRI International and the University of * Cambridge Computer Laboratory (Department of Computer Science and @@ -12,6 +12,9 @@ * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) * ("CTSRD"), as part of the DARPA CRASH research programme. * + * This work was supported by Innovate UK project 105694, "Digital Security by + * Design (DSbD) Technology Platform Prototype". + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -37,29 +40,9 @@ */ #pragma once - /* includes which contains a member __unused */ #include "__unused_workaround_start.h" #include_next #include "__unused_workaround_end.h" -#ifdef __unused_undefd -#undef __unused_undefd -#define __unused __attribute__((unused)) -#endif - #include - -#ifndef O_EXLOCK -#define O_EXLOCK (1 << 30) -#endif -#ifndef O_SHLOCK -#define O_SHLOCK (1 << 31) -#endif - -#undef open -#define open(path, flags, ...) ({ \ - int __fd = (open)(path, flags, ##__VA_ARGS__); \ - if (flags & O_EXLOCK) flock(__fd, LOCK_EX); \ - if (flags & O_SHLOCK) flock(__fd, LOCK_SH); \ - __fd; }) From owner-dev-commits-src-all@freebsd.org Thu Aug 5 09:25:56 2021 Return-Path: Delivered-To: dev-commits-src-all@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 332F066070D; Thu, 5 Aug 2021 09:25: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 4GgNWm0Yk7z4nYV; Thu, 5 Aug 2021 09:25: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 962AB17F45; Thu, 5 Aug 2021 09:25: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 1759PtBW006786; Thu, 5 Aug 2021 09:25:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1759Pt8P006785; Thu, 5 Aug 2021 09:25:55 GMT (envelope-from git) Date: Thu, 5 Aug 2021 09:25:55 GMT Message-Id: <202108050925.1759Pt8P006785@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: 1d7c196d119d - stable/13 - Remove mkcsmapper_static and mkesdb_static from build-tools 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 1d7c196d119dcb5571ec4dff91d95327d1b5c91b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 09:25:56 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=1d7c196d119dcb5571ec4dff91d95327d1b5c91b commit 1d7c196d119dcb5571ec4dff91d95327d1b5c91b Author: Alex Richardson AuthorDate: 2021-08-02 09:49:01 +0000 Commit: Alex Richardson CommitDate: 2021-08-05 09:00:56 +0000 Remove mkcsmapper_static and mkesdb_static from build-tools Build them as part of the bootstrap-tools phase instead. Reviewed by: emaste (no objections) Differential Revision: https://reviews.freebsd.org/D28181 (cherry picked from commit 2de949cf85d0e0b9ff71e1ffd74153814de96175) --- Makefile.inc1 | 9 +++++++-- share/i18n/csmapper/Makefile.inc | 6 ++---- share/i18n/csmapper/Makefile.part | 2 -- share/i18n/esdb/Makefile.inc | 6 ++---- share/i18n/esdb/Makefile.part | 2 -- targets/pseudo/hosttools/Makefile.depend.host | 4 ++-- usr.bin/Makefile | 6 ------ usr.bin/mkcsmapper/Makefile | 6 ++++++ usr.bin/mkcsmapper_static/Makefile.depend | 19 ------------------- usr.bin/mkesdb/Makefile | 6 ++++++ usr.bin/mkesdb_static/Makefile.depend | 19 ------------------- 11 files changed, 25 insertions(+), 60 deletions(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index ebc0733de857..8b417eaaac05 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -2346,6 +2346,11 @@ _localedef= usr.bin/localedef ${_bt}-usr.bin/localedef: ${_bt}-usr.bin/yacc ${_bt_lex_depend} .endif +.if ${MK_ICONV} != "no" +_mkesdb= usr.bin/mkesdb +_mkcsmapper= usr.bin/mkcsmapper +.endif + .if ${MK_KERBEROS} != "no" _kerberos5_bootstrap_tools= \ kerberos5/tools/make-roken \ @@ -2497,6 +2502,8 @@ bootstrap-tools: ${_bt}-links .PHONY ${_nmtree} \ ${_vtfontcvt} \ ${_localedef} \ + ${_mkcsmapper} \ + ${_mkesdb} \ ${LOCAL_BSTOOL_DIRS} ${_bt}-${_tool}: ${_bt}-links .PHONY .MAKE ${_+_}@${ECHODIR} "===> ${_tool} (obj,all,install)"; \ @@ -2558,8 +2565,6 @@ _bt_clean= ${CLEANDIR} ${_share} \ usr.bin/awk \ ${_libmagic} \ - usr.bin/mkesdb_static \ - usr.bin/mkcsmapper_static \ usr.bin/vi/catalog build-tools_${_tool}: .PHONY ${_+_}@${ECHODIR} "===> ${_tool} (${_bt_clean:D${_bt_clean},}obj,build-tools)"; \ diff --git a/share/i18n/csmapper/Makefile.inc b/share/i18n/csmapper/Makefile.inc index 284900c1bc05..72473764f313 100644 --- a/share/i18n/csmapper/Makefile.inc +++ b/share/i18n/csmapper/Makefile.inc @@ -3,7 +3,5 @@ .include CSMAPPERDIR?= /usr/share/i18n/csmapper -.if ${MK_STAGING} == "yes" -MKCSMAPPER= ${STAGE_HOST_OBJTOP}/usr/bin/mkcsmapper_static -.endif -MKCSMAPPER?= ${.OBJDIR:H:H:H}/usr.bin/mkcsmapper_static/mkcsmapper_static +# mkcsmapper builds as part of bootstrap-tools and can therefore be found in $PATH +MKCSMAPPER?= mkcsmapper diff --git a/share/i18n/csmapper/Makefile.part b/share/i18n/csmapper/Makefile.part index 4dbb4ff313dd..6b472f815bc6 100644 --- a/share/i18n/csmapper/Makefile.part +++ b/share/i18n/csmapper/Makefile.part @@ -1,8 +1,6 @@ # $FreeBSD$ # $NetBSD: Makefile,v 1.13 2007/03/13 16:34:37 tnozaki Exp $ -MKCSMAPPER?= ${.OBJDIR:H:H:H:H}/usr.bin/mkcsmapper_static/mkcsmapper_static - ESUBDIR?= ${CODE} PARTFILE?= ${.CURDIR}/${CODE}.part .if exists(${PARTFILE}) diff --git a/share/i18n/esdb/Makefile.inc b/share/i18n/esdb/Makefile.inc index ab61d2cee22f..096beeb96a62 100644 --- a/share/i18n/esdb/Makefile.inc +++ b/share/i18n/esdb/Makefile.inc @@ -5,7 +5,5 @@ .PATH: ${.CURDIR} ESDBDIR?= /usr/share/i18n/esdb -.if ${MK_STAGING} == "yes" -MKESDB= ${STAGE_HOST_OBJTOP}/usr/bin/mkesdb_static -.endif -MKESDB?= ${.OBJDIR:H:H:H}/usr.bin/mkesdb_static/mkesdb_static +# mkesdb builds as part of bootstrap-tools and can therefore be found in $PATH +MKESDB?= mkesdb diff --git a/share/i18n/esdb/Makefile.part b/share/i18n/esdb/Makefile.part index 703854e6e527..0378b117a5ca 100644 --- a/share/i18n/esdb/Makefile.part +++ b/share/i18n/esdb/Makefile.part @@ -1,8 +1,6 @@ # $FreeBSD$ # $NetBSD: Makefile.part,v 1.6 2008/10/25 22:35:36 apb Exp $ -MKESDB?= ${.OBJDIR:H:H:H:H}/usr.bin/mkesdb_static/mkesdb_static - PARTFILE?= ${.CURDIR}/${CODE}.part ALIASFILE?= ${.CURDIR}/${CODE}.alias .if !defined(NO_SEP) diff --git a/targets/pseudo/hosttools/Makefile.depend.host b/targets/pseudo/hosttools/Makefile.depend.host index 1def9574156b..3d6ab127eec9 100644 --- a/targets/pseudo/hosttools/Makefile.depend.host +++ b/targets/pseudo/hosttools/Makefile.depend.host @@ -12,8 +12,8 @@ DIRDEPS = \ usr.bin/clang/clang-tblgen \ usr.bin/clang/llvm-tblgen \ usr.bin/localedef \ - usr.bin/mkcsmapper_static \ - usr.bin/mkesdb_static \ + usr.bin/mkcsmapper \ + usr.bin/mkesdb \ usr.bin/xinstall \ usr.bin/yacc \ usr.sbin/config \ diff --git a/usr.bin/Makefile b/usr.bin/Makefile index fcc406d2efc5..9b38cc2512b7 100644 --- a/usr.bin/Makefile +++ b/usr.bin/Makefile @@ -287,12 +287,6 @@ SUBDIR.${MK_SVN}+= svn SUBDIR.${MK_SVNLITE}+= svn SUBDIR.${MK_OFED}+= ofed -# These are normally only handled for build-tools. -.if make(clean*) -SUBDIR+= mkcsmapper_static -SUBDIR+= mkesdb_static -.endif - .include SUBDIR_PARALLEL= diff --git a/usr.bin/mkcsmapper/Makefile b/usr.bin/mkcsmapper/Makefile index 5d5e8b560bbf..eda8f96bf153 100644 --- a/usr.bin/mkcsmapper/Makefile +++ b/usr.bin/mkcsmapper/Makefile @@ -3,6 +3,12 @@ .PATH: ${SRCTOP}/lib/libc/iconv PROG= mkcsmapper +.if defined(BOOTSTRAPPING) +# When bootstrapping, the host libc might not contain these expected symbols +# so compile them directly into the binary. +SRCS= citrus_bcs.c citrus_db_factory.c citrus_db_hash.c \ + citrus_lookup_factory.c citrus_pivot_factory.c +.endif LDFLAGS+= -L${SRCTOP}/lib/libc NO_WMISSING_VARIABLE_DECLARATIONS= diff --git a/usr.bin/mkcsmapper_static/Makefile.depend b/usr.bin/mkcsmapper_static/Makefile.depend deleted file mode 100644 index f2071f254a6b..000000000000 --- a/usr.bin/mkcsmapper_static/Makefile.depend +++ /dev/null @@ -1,19 +0,0 @@ -# $FreeBSD$ -# Autogenerated - do NOT edit! - -DIRDEPS = \ - gnu/lib/csu \ - include \ - include/arpa \ - include/xlocale \ - lib/${CSU_DIR} \ - lib/libc \ - lib/libcompiler_rt \ - usr.bin/yacc.host \ - - -.include - -.if ${DEP_RELDIR} == ${_DEP_RELDIR} -# local dependencies - needed for -jN in clean tree -.endif diff --git a/usr.bin/mkesdb/Makefile b/usr.bin/mkesdb/Makefile index d49ecfa88f63..3540dcc8401a 100644 --- a/usr.bin/mkesdb/Makefile +++ b/usr.bin/mkesdb/Makefile @@ -3,6 +3,12 @@ .PATH: ${SRCTOP}/lib/libc/iconv PROG= mkesdb +.if defined(BOOTSTRAPPING) +# When bootstrapping, the host libc might not contain these expected symbols +# so compile them directly into the binary. +SRCS= citrus_bcs.c citrus_db_factory.c citrus_db_hash.c \ + citrus_lookup_factory.c +.endif NO_WMISSING_VARIABLE_DECLARATIONS= diff --git a/usr.bin/mkesdb_static/Makefile.depend b/usr.bin/mkesdb_static/Makefile.depend deleted file mode 100644 index f2071f254a6b..000000000000 --- a/usr.bin/mkesdb_static/Makefile.depend +++ /dev/null @@ -1,19 +0,0 @@ -# $FreeBSD$ -# Autogenerated - do NOT edit! - -DIRDEPS = \ - gnu/lib/csu \ - include \ - include/arpa \ - include/xlocale \ - lib/${CSU_DIR} \ - lib/libc \ - lib/libcompiler_rt \ - usr.bin/yacc.host \ - - -.include - -.if ${DEP_RELDIR} == ${_DEP_RELDIR} -# local dependencies - needed for -jN in clean tree -.endif From owner-dev-commits-src-all@freebsd.org Thu Aug 5 09:25:57 2021 Return-Path: Delivered-To: dev-commits-src-all@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 3BA3166062F; Thu, 5 Aug 2021 09:25: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 4GgNWm6m4Dz4nNN; Thu, 5 Aug 2021 09:25: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 A7C2E17BDE; Thu, 5 Aug 2021 09:25: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 1759PuNO006816; Thu, 5 Aug 2021 09:25:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1759PuZP006815; Thu, 5 Aug 2021 09:25:56 GMT (envelope-from git) Date: Thu, 5 Aug 2021 09:25:56 GMT Message-Id: <202108050925.1759PuZP006815@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: c65dab7dd245 - stable/13 - Allow bootstrapping llvm-tblgen on macOS and Linux 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/stable/13 X-Git-Reftype: branch X-Git-Commit: c65dab7dd2454036aa60467780daa60474f01714 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 09:25:58 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=c65dab7dd2454036aa60467780daa60474f01714 commit c65dab7dd2454036aa60467780daa60474f01714 Author: Alex Richardson AuthorDate: 2021-08-02 13:36:03 +0000 Commit: Alex Richardson CommitDate: 2021-08-05 09:01:08 +0000 Allow bootstrapping llvm-tblgen on macOS and Linux This is needed in order to build various LLVM binutils (e.g. addr2line) as well as clang/lld/lldb. Co-authored-by: Jessica Clarke Test Plan: Compiles on ubuntu 18.04 and macOS 11.4 Reviewed By: dim Differential Revision: https://reviews.freebsd.org/D31057 (cherry picked from commit 31ba4ce8898f9dfa5e7f054fdbc26e50a599a6e3) --- contrib/llvm-project/lld/tools/lld/lld.cpp | 3 +- lib/clang/include/llvm/Config/config.h | 58 +++++++++++++++++++--- lib/clang/libllvm/Makefile | 3 +- lib/clang/llvm.build.mk | 12 +++++ share/mk/src.opts.mk | 8 --- .../build/cross-build/include/common/sys/sysctl.h | 6 +++ tools/build/make.py | 4 ++ usr.bin/clang/clang.prog.mk | 2 + usr.bin/clang/lld/Makefile | 2 + usr.bin/clang/llvm.prog.mk | 2 + 10 files changed, 83 insertions(+), 17 deletions(-) diff --git a/contrib/llvm-project/lld/tools/lld/lld.cpp b/contrib/llvm-project/lld/tools/lld/lld.cpp index d30362ba7826..8827a883ceb6 100644 --- a/contrib/llvm-project/lld/tools/lld/lld.cpp +++ b/contrib/llvm-project/lld/tools/lld/lld.cpp @@ -146,7 +146,8 @@ static Flavor parseFlavor(std::vector &v) { static int lldMain(int argc, const char **argv, llvm::raw_ostream &stdoutOS, llvm::raw_ostream &stderrOS, bool exitEarly = true) { std::vector args(argv, argv + argc); -#ifdef __FreeBSD__ +#if 1 + /* On FreeBSD we only build the ELF linker. */ return !elf::link(args, exitEarly, stdoutOS, stderrOS); #else switch (parseFlavor(args)) { diff --git a/lib/clang/include/llvm/Config/config.h b/lib/clang/include/llvm/Config/config.h index 0cd6dabeab17..35ce8c189d2b 100644 --- a/lib/clang/include/llvm/Config/config.h +++ b/lib/clang/include/llvm/Config/config.h @@ -29,7 +29,11 @@ /* #undef HAVE_CRASHREPORTERCLIENT_H */ /* can use __crashreporter_info__ */ +#if defined(__APPLE__) +#define HAVE_CRASHREPORTER_INFO 1 +#else #define HAVE_CRASHREPORTER_INFO 0 +#endif /* Define to 1 if you have the declaration of `arc4random', and to 0 if you don't. */ @@ -125,28 +129,46 @@ #define HAVE_PTHREAD_SETNAME_NP 1 /* Define to 1 if you have the header file. */ +#if __has_include() #define HAVE_LINK_H 1 +#else +#define HAVE_LINK_H 0 +#endif /* Define to 1 if you have the `lseek64' function. */ -/* #undef HAVE_LSEEK64 */ +#if defined(__linux__) +#define HAVE_LSEEK64 1 +#endif /* Define to 1 if you have the header file. */ -/* #undef HAVE_MACH_MACH_H */ +#if __has_include() +#define HAVE_MACH_MACH_H 1 +#endif /* Define to 1 if you have the `mallctl' function. */ +#if defined(__FreeBSD__) #define HAVE_MALLCTL 1 +#endif /* Define to 1 if you have the `mallinfo' function. */ -/* #undef HAVE_MALLINFO */ +#if defined(__linux__) +#define HAVE_MALLINFO 1 +#endif /* Define to 1 if you have the header file. */ -/* #undef HAVE_MALLOC_MALLOC_H */ +#if __has_include() +#define HAVE_MALLOC_MALLOC_H 1 +#endif /* Define to 1 if you have the `malloc_zone_statistics' function. */ -/* #undef HAVE_MALLOC_ZONE_STATISTICS */ +#if defined(__APPLE__) +#define HAVE_MALLOC_ZONE_STATISTICS 1 +#endif /* Define to 1 if you have the `posix_fallocate' function. */ +#if !defined(__APPLE__) #define HAVE_POSIX_FALLOCATE 1 +#endif /* Define to 1 if you have the `posix_spawn' function. */ #define HAVE_POSIX_SPAWN 1 @@ -209,19 +231,31 @@ #define HAVE_SYS_TIME_H 1 /* Define to 1 if stat struct has st_mtimespec member .*/ +#if !defined(__linux__) #define HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC 1 +#endif /* Define to 1 if stat struct has st_mtim member. */ +#if !defined(__APPLE__) #define HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC 1 +#endif /* Define to 1 if you have the header file. */ #define HAVE_SYS_TYPES_H 1 /* Define if the setupterm() function is supported this platform. */ +#if defined(__FreeBSD__) +/* + * This is only needed for terminalHasColors(). When disabled LLVM falls back + * to checking a list of TERM prefixes which is sufficient for a bootstrap tool. + */ #define LLVM_ENABLE_TERMINFO 1 +#endif /* Define if the xar_open() function is supported this platform. */ -/* #undef HAVE_LIBXAR */ +#if defined(__APPLE__) +#define HAVE_LIBXAR +#endif /* Define to 1 if you have the header file. */ #define HAVE_TERMIOS_H 1 @@ -239,7 +273,9 @@ /* #undef HAVE__CHSIZE_S */ /* Define to 1 if you have the `_Unwind_Backtrace' function. */ -/* #undef HAVE__UNWIND_BACKTRACE */ +#if !defined(__FreeBSD__) +#define HAVE__UNWIND_BACKTRACE 1 +#endif /* Have host's __alloca */ /* #undef HAVE___ALLOCA */ @@ -315,7 +351,11 @@ /* #undef LLVM_LIBXML2_ENABLED */ /* Define to the extension used for shared libraries, say, ".so". */ +#if defined(__APPLE__) +#define LTDL_SHLIB_EXT ".dylib" +#else #define LTDL_SHLIB_EXT ".so" +#endif /* Define to the address where bug reports for this package should be sent. */ #define PACKAGE_BUGREPORT "https://bugs.freebsd.org/submit/" @@ -351,6 +391,10 @@ /* #undef LLVM_GISEL_COV_PREFIX */ /* Whether Timers signpost passes in Xcode Instruments */ +#if defined(__APPLE__) +#define LLVM_SUPPORT_XCODE_SIGNPOSTS 1 +#else #define LLVM_SUPPORT_XCODE_SIGNPOSTS 0 +#endif #endif diff --git a/lib/clang/libllvm/Makefile b/lib/clang/libllvm/Makefile index 85440f467a18..09d6336c01d9 100644 --- a/lib/clang/libllvm/Makefile +++ b/lib/clang/libllvm/Makefile @@ -717,7 +717,8 @@ SRCS_EXL+= LTO/LTOModule.cpp SRCS_EXL+= LTO/SummaryBasedOptimizations.cpp SRCS_EXL+= LTO/ThinLTOCodeGenerator.cpp SRCS_MIN+= LTO/UpdateCompilerUsed.cpp -SRCS_MIN+= LineEditor/LineEditor.cpp +# Only needed for clangd/clang-query, uncomment once we build those. +# SRCS_XDW+= LineEditor/LineEditor.cpp SRCS_MIN+= Linker/IRMover.cpp SRCS_MIN+= Linker/LinkModules.cpp SRCS_MIN+= MC/ConstantPools.cpp diff --git a/lib/clang/llvm.build.mk b/lib/clang/llvm.build.mk index ef271e85bf3f..adb2300541f6 100644 --- a/lib/clang/llvm.build.mk +++ b/lib/clang/llvm.build.mk @@ -100,12 +100,24 @@ CFLAGS+= -DLLVM_NATIVE_TARGETMC=LLVMInitialize${LLVM_NATIVE_ARCH}TargetMC CFLAGS+= -ffunction-sections CFLAGS+= -fdata-sections +.if ${LINKER_TYPE} == "mac" +LDFLAGS+= -Wl,-dead_strip +.else LDFLAGS+= -Wl,--gc-sections +.endif CXXSTD?= c++14 CXXFLAGS+= -fno-exceptions CXXFLAGS+= -fno-rtti +.if ${.MAKE.OS} == "FreeBSD" || !defined(BOOTSTRAPPING) +# Building on macOS/Linux needs the real sysctl() not the bootstrap tools stub. +CFLAGS+= -DBOOTSTRAPPING_WANT_NATIVE_SYSCTL +.else CXXFLAGS.clang+= -stdlib=libc++ +.endif +.if defined(BOOTSTRAPPING) && ${.MAKE.OS} == "Linux" +LIBADD+= dl +.endif .if ${MACHINE_ARCH:Mmips64} STATIC_CFLAGS+= -mxgot diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk index 7c64d54e39f3..77c60aef0bc4 100644 --- a/share/mk/src.opts.mk +++ b/share/mk/src.opts.mk @@ -358,14 +358,6 @@ __DEFAULT_YES_OPTIONS+=OPENMP __DEFAULT_NO_OPTIONS+=OPENMP .endif -.if ${.MAKE.OS} != "FreeBSD" -# Building the target compiler requires building tablegen on the host -# which is (currently) not possible on non-FreeBSD. -BROKEN_OPTIONS+=CLANG LLD LLDB -# The same also applies to the bootstrap LLVM. -BROKEN_OPTIONS+=CLANG_BOOTSTRAP LLD_BOOTSTRAP -.endif - .include # diff --git a/tools/build/cross-build/include/common/sys/sysctl.h b/tools/build/cross-build/include/common/sys/sysctl.h index 856f6be23421..6d6f5438c557 100644 --- a/tools/build/cross-build/include/common/sys/sysctl.h +++ b/tools/build/cross-build/include/common/sys/sysctl.h @@ -37,6 +37,11 @@ */ #pragma once +#ifdef BOOTSTRAPPING_WANT_NATIVE_SYSCTL +/* We need the real sysctl.h e.g. when bootstrapping the LLVM tools. */ +#include_next +#else +/* Otherwise, avoid sysctls since they might not be supported on the host. */ #include #define sysctlbyname __freebsd_sysctlbyname @@ -44,3 +49,4 @@ int sysctl(const int *, u_int, void *, size_t *, const void *, size_t); int sysctlbyname(const char *, void *, size_t *, const void *, size_t); +#endif diff --git a/tools/build/make.py b/tools/build/make.py index 0cf831a3c966..799ea89b74b3 100755 --- a/tools/build/make.py +++ b/tools/build/make.py @@ -166,6 +166,9 @@ if __name__ == "__main__": "needed if CC/CPP/CXX are not set). ") parser.add_argument("--debug", action="store_true", help="Print information on inferred env vars") + parser.add_argument("--bootstrap-toolchain", action="store_true", + help="Bootstrap the toolchain instead of using an " + "external one (experimental and not recommended)") parser.add_argument("--clean", action="store_true", help="Do a clean rebuild instead of building with " "-DWITHOUT_CLEAN") @@ -195,6 +198,7 @@ if __name__ == "__main__": if "universe" not in sys.argv and "tinderbox" not in sys.argv: sys.exit("TARGET= and TARGET_ARCH= must be set explicitly " "when building on non-FreeBSD") + if not parsed_args.bootstrap_toolchain: # infer values for CC/CXX/CPP if parsed_args.host_compiler_type == "gcc": default_cc, default_cxx, default_cpp = ("gcc", "g++", "cpp") diff --git a/usr.bin/clang/clang.prog.mk b/usr.bin/clang/clang.prog.mk index de5cceac7c6b..d0ed6b8587c5 100644 --- a/usr.bin/clang/clang.prog.mk +++ b/usr.bin/clang/clang.prog.mk @@ -17,8 +17,10 @@ LDADD+= ${OBJTOP}/lib/clang/lib${lib}/lib${lib}.a PACKAGE= clang +.if ${.MAKE.OS} == "FreeBSD" || !defined(BOOTSTRAPPING) LIBADD+= execinfo LIBADD+= ncursesw +.endif LIBADD+= pthread .include diff --git a/usr.bin/clang/lld/Makefile b/usr.bin/clang/lld/Makefile index 3593a4006ba2..8e95ccc07f04 100644 --- a/usr.bin/clang/lld/Makefile +++ b/usr.bin/clang/lld/Makefile @@ -102,8 +102,10 @@ TGHDRS+= ${INCFILE} DPSRCS+= ${TGHDRS} CLEANFILES+= ${TGHDRS} ${TGHDRS:C/$/.d/} +.if ${.MAKE.OS} == "FreeBSD" || !defined(BOOTSTRAPPING) LIBADD+= execinfo LIBADD+= ncursesw +.endif LIBADD+= pthread LIBADD+= z diff --git a/usr.bin/clang/llvm.prog.mk b/usr.bin/clang/llvm.prog.mk index 58fd3eedd113..56698c4138d3 100644 --- a/usr.bin/clang/llvm.prog.mk +++ b/usr.bin/clang/llvm.prog.mk @@ -22,8 +22,10 @@ LDADD+= ${OBJTOP}/lib/clang/lib${lib}/lib${lib}.a PACKAGE= clang +.if ${.MAKE.OS} == "FreeBSD" || !defined(BOOTSTRAPPING) LIBADD+= execinfo LIBADD+= ncursesw +.endif LIBADD+= pthread .include From owner-dev-commits-src-all@freebsd.org Thu Aug 5 10:45:53 2021 Return-Path: Delivered-To: dev-commits-src-all@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 803026615D3; Thu, 5 Aug 2021 10:45: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 4GgQJ12vhvz4ssb; Thu, 5 Aug 2021 10:45: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 486D118DA4; Thu, 5 Aug 2021 10:45: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 175AjrL9013267; Thu, 5 Aug 2021 10:45:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 175AjrX2013266; Thu, 5 Aug 2021 10:45:53 GMT (envelope-from git) Date: Thu, 5 Aug 2021 10:45:53 GMT Message-Id: <202108051045.175AjrX2013266@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: 7809becb4ea6 - stable/13 - Add missing bsd.linker.mk include after 31ba4ce8898f9dfa5e7f054fdbc26e50a599a6e3 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 7809becb4ea614b1a978cd60e7ce7b68d459391b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 10:45:53 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=7809becb4ea614b1a978cd60e7ce7b68d459391b commit 7809becb4ea614b1a978cd60e7ce7b68d459391b Author: Alex Richardson AuthorDate: 2021-08-02 15:38:39 +0000 Commit: Alex Richardson CommitDate: 2021-08-05 10:45:33 +0000 Add missing bsd.linker.mk include after 31ba4ce8898f9dfa5e7f054fdbc26e50a599a6e3 This is needed for -DWITH_CLEAN builds since the cleandir phase does not include bsd.linker.mk from bsd.compiler.mk (cherry picked from commit 9f1db6c5557bd01734ee63afacaf07a37fb3cc60) --- lib/clang/llvm.build.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/clang/llvm.build.mk b/lib/clang/llvm.build.mk index adb2300541f6..a909cd8e2c05 100644 --- a/lib/clang/llvm.build.mk +++ b/lib/clang/llvm.build.mk @@ -100,6 +100,7 @@ CFLAGS+= -DLLVM_NATIVE_TARGETMC=LLVMInitialize${LLVM_NATIVE_ARCH}TargetMC CFLAGS+= -ffunction-sections CFLAGS+= -fdata-sections +.include "bsd.linker.mk" .if ${LINKER_TYPE} == "mac" LDFLAGS+= -Wl,-dead_strip .else From owner-dev-commits-src-all@freebsd.org Thu Aug 5 11:17:27 2021 Return-Path: Delivered-To: dev-commits-src-all@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 24589661F14; Thu, 5 Aug 2021 11:17: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 4GgR0R0Vtkz4vBn; Thu, 5 Aug 2021 11:17: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 ED92219073; Thu, 5 Aug 2021 11:17: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 175BHQZn053582; Thu, 5 Aug 2021 11:17:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 175BHQ9D053581; Thu, 5 Aug 2021 11:17:26 GMT (envelope-from git) Date: Thu, 5 Aug 2021 11:17:26 GMT Message-Id: <202108051117.175BHQ9D053581@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: 589951c76a3f - main - arm64: conf: std.broadcom: Add dwcotg and smsc 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: 589951c76a3ff5d3b1105af03d66e676c83dbffc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 11:17:27 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=589951c76a3ff5d3b1105af03d66e676c83dbffc commit 589951c76a3ff5d3b1105af03d66e676c83dbffc Author: Emmanuel Vadot AuthorDate: 2021-08-05 11:16:23 +0000 Commit: Emmanuel Vadot CommitDate: 2021-08-05 11:16:23 +0000 arm64: conf: std.broadcom: Add dwcotg and smsc Add the dwcotg and smsc usb to ethernet driver to std.broadcom. Those are used in RPI3 PR: 257593 --- sys/arm64/conf/std.broadcom | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/arm64/conf/std.broadcom b/sys/arm64/conf/std.broadcom index 8dfa8cec52d3..3332aaac0826 100644 --- a/sys/arm64/conf/std.broadcom +++ b/sys/arm64/conf/std.broadcom @@ -20,8 +20,12 @@ device pl011 # Ethernet NICs device genet # Broadcom on RPi4 +# USB support +device dwcotg + # USB ethernet support device muge +device smsc # MMC/SD/SDIO Card slot support device sdhci From owner-dev-commits-src-all@freebsd.org Thu Aug 5 12:36:20 2021 Return-Path: Delivered-To: dev-commits-src-all@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 8DE04663236; Thu, 5 Aug 2021 12: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 4GgSlS3PC0z50wP; Thu, 5 Aug 2021 12: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 588AF19F5B; Thu, 5 Aug 2021 12:36: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 175CaK8K059999; Thu, 5 Aug 2021 12:36:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 175CaKst059998; Thu, 5 Aug 2021 12:36:20 GMT (envelope-from git) Date: Thu, 5 Aug 2021 12:36:20 GMT Message-Id: <202108051236.175CaKst059998@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: 89ed2ecb14ce - main - Disable compressed debug by default 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: 89ed2ecb14ceabc27883282cf96559a9e7d52717 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 12:36:20 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=89ed2ecb14ceabc27883282cf96559a9e7d52717 commit 89ed2ecb14ceabc27883282cf96559a9e7d52717 Author: Ed Maste AuthorDate: 2021-08-05 12:34:03 +0000 Commit: Ed Maste CommitDate: 2021-08-05 12:36:00 +0000 Disable compressed debug by default In c910570e7573 I enabled compressed debug sections, but it broke mips and powerpc. Disable it for now. Reported by: jenkins, manu Sponsored by: The FreeBSD Foundation --- share/mk/bsd.sys.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/mk/bsd.sys.mk b/share/mk/bsd.sys.mk index a964cf6e596c..031d49bbaca2 100644 --- a/share/mk/bsd.sys.mk +++ b/share/mk/bsd.sys.mk @@ -247,7 +247,7 @@ CFLAGS+= ${SSP_CFLAGS} # Additional flags passed in CFLAGS and CXXFLAGS when MK_DEBUG_FILES is # enabled. -DEBUG_FILES_CFLAGS?= -g -gz=zlib +DEBUG_FILES_CFLAGS?= -g # Allow user-specified additional warning flags, plus compiler and file # specific flag overrides, unless we've overridden this... From owner-dev-commits-src-all@freebsd.org Thu Aug 5 12:45:31 2021 Return-Path: Delivered-To: dev-commits-src-all@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 F2AF8662CE5; Thu, 5 Aug 2021 12:45: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 4GgSy26JXJz50yQ; Thu, 5 Aug 2021 12:45: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 C01521A7B2; Thu, 5 Aug 2021 12:45: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 175CjUrv072911; Thu, 5 Aug 2021 12:45:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 175CjUTE072910; Thu, 5 Aug 2021 12:45:30 GMT (envelope-from git) Date: Thu, 5 Aug 2021 12:45:30 GMT Message-Id: <202108051245.175CjUTE072910@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: d88815784447 - stable/13 - libc/locale: Use O_CLOEXEC when opening locale tables 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/stable/13 X-Git-Reftype: branch X-Git-Commit: d88815784447d24216bafeefa973da4e0ae5db14 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 12:45:31 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=d88815784447d24216bafeefa973da4e0ae5db14 commit d88815784447d24216bafeefa973da4e0ae5db14 Author: Mark Johnston AuthorDate: 2021-07-29 13:14:50 +0000 Commit: Mark Johnston CommitDate: 2021-08-05 12:45:22 +0000 libc/locale: Use O_CLOEXEC when opening locale tables Reviewed by: kib Sponsored by: The FreeBSD Foundation (cherry picked from commit 98bfb9dac28585fb5629c5fc951ce0d83490d446) --- lib/libc/locale/collate.c | 2 +- lib/libc/locale/rune.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libc/locale/collate.c b/lib/libc/locale/collate.c index c992d2299ab7..7afb2043e6a4 100644 --- a/lib/libc/locale/collate.c +++ b/lib/libc/locale/collate.c @@ -131,7 +131,7 @@ __collate_load_tables_l(const char *encoding, struct xlocale_collate *table) if (asprintf(&buf, "%s/%s/LC_COLLATE", _PathLocale, encoding) == -1) return (_LDP_ERROR); - if ((fd = _open(buf, O_RDONLY)) < 0) { + if ((fd = _open(buf, O_RDONLY | O_CLOEXEC)) < 0) { free(buf); return (_LDP_ERROR); } diff --git a/lib/libc/locale/rune.c b/lib/libc/locale/rune.c index b7334636f654..ce2095763eba 100644 --- a/lib/libc/locale/rune.c +++ b/lib/libc/locale/rune.c @@ -74,7 +74,7 @@ _Read_RuneMagi(const char *fname) int runetype_ext_len = 0; int fd; - if ((fd = _open(fname, O_RDONLY)) < 0) { + if ((fd = _open(fname, O_RDONLY | O_CLOEXEC)) < 0) { errno = EINVAL; return (NULL); } From owner-dev-commits-src-all@freebsd.org Thu Aug 5 13:11:41 2021 Return-Path: Delivered-To: dev-commits-src-all@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 715606636A2; Thu, 5 Aug 2021 13:11: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 4GgTXF2ql6z545Y; Thu, 5 Aug 2021 13:11: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 497AF1AE33; Thu, 5 Aug 2021 13:11: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 175DBfNl013544; Thu, 5 Aug 2021 13:11:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 175DBfVF013543; Thu, 5 Aug 2021 13:11:41 GMT (envelope-from git) Date: Thu, 5 Aug 2021 13:11:41 GMT Message-Id: <202108051311.175DBfVF013543@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: 3f1f6b6ef7f6 - main - tcp, udp: improve input validation in handling bind() 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: 3f1f6b6ef7f6fea63583a4b6e917b3cc0f0d525e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 13:11:41 -0000 The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=3f1f6b6ef7f6fea63583a4b6e917b3cc0f0d525e commit 3f1f6b6ef7f6fea63583a4b6e917b3cc0f0d525e Author: Michael Tuexen AuthorDate: 2021-08-05 11:42:30 +0000 Commit: Michael Tuexen CommitDate: 2021-08-05 11:48:44 +0000 tcp, udp: improve input validation in handling bind() Reported by: syzbot+24fcfd8057e9bc339295@syzkaller.appspotmail.com Reported by: syzbot+6e90ceb5c89285b2655b@syzkaller.appspotmail.com Reviewed by: markj, rscheff MFC after: 3 days Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D31422 --- sys/netinet/tcp_usrreq.c | 1 + sys/netinet/udp_usrreq.c | 1 + 2 files changed, 2 insertions(+) diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c index b1fc584f93b2..bcd7d18d9d62 100644 --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -326,6 +326,7 @@ tcp_usr_bind(struct socket *so, struct sockaddr *nam, struct thread *td) * Preserve compatibility with old programs. */ if (nam->sa_family != AF_UNSPEC || + nam->sa_len < offsetof(struct sockaddr_in, sin_zero) || sinp->sin_addr.s_addr != INADDR_ANY) return (EAFNOSUPPORT); nam->sa_family = AF_INET; diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c index 76ed063391eb..46d687690713 100644 --- a/sys/netinet/udp_usrreq.c +++ b/sys/netinet/udp_usrreq.c @@ -1635,6 +1635,7 @@ udp_bind(struct socket *so, struct sockaddr *nam, struct thread *td) * Preserve compatibility with old programs. */ if (nam->sa_family != AF_UNSPEC || + nam->sa_len < offsetof(struct sockaddr_in, sin_zero) || sinp->sin_addr.s_addr != INADDR_ANY) return (EAFNOSUPPORT); nam->sa_family = AF_INET; From owner-dev-commits-src-all@freebsd.org Thu Aug 5 14:22:11 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C54E1664987; Thu, 5 Aug 2021 14:22: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 4GgW5b5Gjxz3BmC; Thu, 5 Aug 2021 14:22: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 9DCA91BA5C; Thu, 5 Aug 2021 14:22: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 175EMBER006557; Thu, 5 Aug 2021 14:22:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 175EMBpP006556; Thu, 5 Aug 2021 14:22:11 GMT (envelope-from git) Date: Thu, 5 Aug 2021 14:22:11 GMT Message-Id: <202108051422.175EMBpP006556@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: 98215005b747 - main - ktls: start a thread to keep the 16k ktls buffer zone populated 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: 98215005b747fef67f44794ca64abd473b98bade Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 14:22:11 -0000 The branch main has been updated by gallatin: URL: https://cgit.FreeBSD.org/src/commit/?id=98215005b747fef67f44794ca64abd473b98bade commit 98215005b747fef67f44794ca64abd473b98bade Author: Andrew Gallatin AuthorDate: 2021-08-05 14:15:09 +0000 Commit: Andrew Gallatin CommitDate: 2021-08-05 14:19:12 +0000 ktls: start a thread to keep the 16k ktls buffer zone populated Ktls recently received an optimization where we allocate 16k physically contiguous crypto destination buffers. This provides a large (more than 5%) reduction in CPU use in our workload. However, after several days of uptime, the performance benefit disappears because we have frequent allocation failures from the ktls buffer zone. It turns out that when load drops off, the ktls buffer zone is trimmed, and some 16k buffers are freed back to the OS. When load picks back up again, re-allocating those 16k buffers fails after some number of days of uptime because physical memory has become fragmented. This causes allocations to fail, because they are intentionally done without M_NORECLAIM, so as to avoid pausing the ktls crytpo work thread while the VM system defragments memory. To work around this, this change starts one thread per VM domain to allocate ktls buffers with M_NORECLAIM, as we don't care if this thread is paused while memory is defragged. The thread then frees the buffers back into the ktls buffer zone, thus allowing future allocations to succeed. Note that waking up the thread is intentionally racy, but neither of the races really matter. In the worst case, we could have either spurious wakeups or we could have to wait 1 second until the next rate-limited allocation failure to wake up the thread. This patch has been in use at Netflix on a handful of servers, and seems to fix the issue. Differential Revision: https://reviews.freebsd.org/D31260 Reviewed by: jhb, markj, (jtl, rrs, and dhw reviewed earlier version) Sponsored by: Netflix --- sys/kern/uipc_ktls.c | 121 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 120 insertions(+), 1 deletion(-) diff --git a/sys/kern/uipc_ktls.c b/sys/kern/uipc_ktls.c index 5f7dde325740..17b87195fc50 100644 --- a/sys/kern/uipc_ktls.c +++ b/sys/kern/uipc_ktls.c @@ -78,6 +78,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include struct ktls_wq { struct mtx mtx; @@ -87,9 +88,17 @@ struct ktls_wq { int lastallocfail; } __aligned(CACHE_LINE_SIZE); +struct ktls_alloc_thread { + uint64_t wakeups; + uint64_t allocs; + struct thread *td; + int running; +}; + struct ktls_domain_info { int count; int cpu[MAXCPU]; + struct ktls_alloc_thread alloc_td; }; struct ktls_domain_info ktls_domains[MAXMEMDOM]; @@ -142,6 +151,11 @@ SYSCTL_BOOL(_kern_ipc_tls, OID_AUTO, sw_buffer_cache, CTLFLAG_RDTUN, &ktls_sw_buffer_cache, 1, "Enable caching of output buffers for SW encryption"); +static int ktls_max_alloc = 128; +SYSCTL_INT(_kern_ipc_tls, OID_AUTO, max_alloc, CTLFLAG_RWTUN, + &ktls_max_alloc, 128, + "Max number of 16k buffers to allocate in thread context"); + static COUNTER_U64_DEFINE_EARLY(ktls_tasks_active); SYSCTL_COUNTER_U64(_kern_ipc_tls, OID_AUTO, tasks_active, CTLFLAG_RD, &ktls_tasks_active, "Number of active tasks"); @@ -278,6 +292,7 @@ static void ktls_cleanup(struct ktls_session *tls); static void ktls_reset_send_tag(void *context, int pending); #endif static void ktls_work_thread(void *ctx); +static void ktls_alloc_thread(void *ctx); #if defined(INET) || defined(INET6) static u_int @@ -418,6 +433,32 @@ ktls_init(void *dummy __unused) ktls_number_threads++; } + /* + * Start an allocation thread per-domain to perform blocking allocations + * of 16k physically contiguous TLS crypto destination buffers. + */ + if (ktls_sw_buffer_cache) { + for (domain = 0; domain < vm_ndomains; domain++) { + if (VM_DOMAIN_EMPTY(domain)) + continue; + if (CPU_EMPTY(&cpuset_domain[domain])) + continue; + error = kproc_kthread_add(ktls_alloc_thread, + &ktls_domains[domain], &ktls_proc, + &ktls_domains[domain].alloc_td.td, + 0, 0, "KTLS", "alloc_%d", domain); + if (error) + panic("Can't add KTLS alloc thread %d error %d", + domain, error); + CPU_COPY(&cpuset_domain[domain], &mask); + error = cpuset_setthread(ktls_domains[domain].alloc_td.td->td_tid, + &mask); + if (error) + panic("Unable to bind KTLS alloc %d error %d", + domain, error); + } + } + /* * If we somehow have an empty domain, fall back to choosing * among all KTLS threads. @@ -1946,6 +1987,7 @@ static void * ktls_buffer_alloc(struct ktls_wq *wq, struct mbuf *m) { void *buf; + int domain, running; if (m->m_epg_npgs <= 2) return (NULL); @@ -1961,8 +2003,23 @@ ktls_buffer_alloc(struct ktls_wq *wq, struct mbuf *m) return (NULL); } buf = uma_zalloc(ktls_buffer_zone, M_NOWAIT | M_NORECLAIM); - if (buf == NULL) + if (buf == NULL) { + domain = PCPU_GET(domain); wq->lastallocfail = ticks; + + /* + * Note that this check is "racy", but the races are + * harmless, and are either a spurious wakeup if + * multiple threads fail allocations before the alloc + * thread wakes, or waiting an extra second in case we + * see an old value of running == true. + */ + if (!VM_DOMAIN_EMPTY(domain)) { + running = atomic_load_int(&ktls_domains[domain].alloc_td.running); + if (!running) + wakeup(&ktls_domains[domain].alloc_td); + } + } return (buf); } @@ -2154,6 +2211,68 @@ ktls_encrypt(struct ktls_wq *wq, struct mbuf *top) CURVNET_RESTORE(); } +static void +ktls_alloc_thread(void *ctx) +{ + struct ktls_domain_info *ktls_domain = ctx; + struct ktls_alloc_thread *sc = &ktls_domain->alloc_td; + void **buf; + struct sysctl_oid *oid; + char name[80]; + int i, nbufs; + + curthread->td_domain.dr_policy = + DOMAINSET_PREF(PCPU_GET(domain)); + snprintf(name, sizeof(name), "domain%d", PCPU_GET(domain)); + if (bootverbose) + printf("Starting KTLS alloc thread for domain %d\n", + PCPU_GET(domain)); + oid = SYSCTL_ADD_NODE(NULL, SYSCTL_STATIC_CHILDREN(_kern_ipc_tls), OID_AUTO, + name, CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, ""); + SYSCTL_ADD_U64(NULL, SYSCTL_CHILDREN(oid), OID_AUTO, "allocs", + CTLFLAG_RD, &sc->allocs, 0, "buffers allocated"); + SYSCTL_ADD_U64(NULL, SYSCTL_CHILDREN(oid), OID_AUTO, "wakeups", + CTLFLAG_RD, &sc->wakeups, 0, "thread wakeups"); + SYSCTL_ADD_INT(NULL, SYSCTL_CHILDREN(oid), OID_AUTO, "running", + CTLFLAG_RD, &sc->running, 0, "thread running"); + + buf = NULL; + nbufs = 0; + for (;;) { + atomic_store_int(&sc->running, 0); + tsleep(sc, PZERO, "waiting for work", 0); + atomic_store_int(&sc->running, 1); + sc->wakeups++; + if (nbufs != ktls_max_alloc) { + free(buf, M_KTLS); + nbufs = atomic_load_int(&ktls_max_alloc); + buf = malloc(sizeof(void *) * nbufs, M_KTLS, + M_WAITOK | M_ZERO); + } + /* + * Below we allocate nbufs with different allocation + * flags than we use when allocating normally during + * encryption in the ktls worker thread. We specify + * M_NORECLAIM in the worker thread. However, we omit + * that flag here and add M_WAITOK so that the VM + * system is permitted to perform expensive work to + * defragment memory. We do this here, as it does not + * matter if this thread blocks. If we block a ktls + * worker thread, we risk developing backlogs of + * buffers to be encrypted, leading to surges of + * traffic and potential NIC output drops. + */ + for (i = 0; i < nbufs; i++) { + buf[i] = uma_zalloc(ktls_buffer_zone, M_WAITOK); + sc->allocs++; + } + for (i = 0; i < nbufs; i++) { + uma_zfree(ktls_buffer_zone, buf[i]); + buf[i] = NULL; + } + } +} + static void ktls_work_thread(void *ctx) { From owner-dev-commits-src-all@freebsd.org Thu Aug 5 15:23:34 2021 Return-Path: Delivered-To: dev-commits-src-all@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 7C4826650F7; Thu, 5 Aug 2021 15:23: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 4GgXSQ2Sksz3GYr; Thu, 5 Aug 2021 15:23: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 3CB9C1CA98; Thu, 5 Aug 2021 15:23: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 175FNYxa086149; Thu, 5 Aug 2021 15:23:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 175FNYvD086148; Thu, 5 Aug 2021 15:23:34 GMT (envelope-from git) Date: Thu, 5 Aug 2021 15:23:34 GMT Message-Id: <202108051523.175FNYvD086148@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ka Ho Ng Subject: git: de2e15295966 - main - Add vnode_pager_purge_range(9) KPI MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: khng X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: de2e152959668756333db8a502a3d17a19dac393 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 15:23:34 -0000 The branch main has been updated by khng: URL: https://cgit.FreeBSD.org/src/commit/?id=de2e152959668756333db8a502a3d17a19dac393 commit de2e152959668756333db8a502a3d17a19dac393 Author: Ka Ho Ng AuthorDate: 2021-08-04 19:20:37 +0000 Commit: Ka Ho Ng CommitDate: 2021-08-05 14:52:26 +0000 Add vnode_pager_purge_range(9) KPI This KPI is created in addition to the existing vnode_pager_setsize(9) KPI. The KPI is intended for file systems that are able to turn a range of file into sparse range, also known as hole-punching. Sponsored by: The FreeBSD Foundation Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D27194 --- share/man/man9/Makefile | 1 + share/man/man9/vnode_pager_purge_range.9 | 85 +++++++++++++++++++ sys/vm/vm_extern.h | 1 + sys/vm/vnode_pager.c | 140 +++++++++++++++++++++++-------- 4 files changed, 194 insertions(+), 33 deletions(-) diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index a335f53b27f3..d0012301d889 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -409,6 +409,7 @@ MAN= accept_filter.9 \ vnet.9 \ vnode.9 \ vnode_pager_setsize.9 \ + vnode_pager_purge_range.9 \ VOP_ACCESS.9 \ VOP_ACLCHECK.9 \ VOP_ADVISE.9 \ diff --git a/share/man/man9/vnode_pager_purge_range.9 b/share/man/man9/vnode_pager_purge_range.9 new file mode 100644 index 000000000000..16a240c2a34b --- /dev/null +++ b/share/man/man9/vnode_pager_purge_range.9 @@ -0,0 +1,85 @@ +.\" +.\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD +.\" +.\" Copyright (c) 2021 The FreeBSD Foundation +.\" +.\" This manual page was written by Ka Ho Ng 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: +.\" 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. +.\" +.Dd August 2, 2021 +.Dt VNODE_PAGER_PURGE_RANGE 9 +.Os +.Sh NAME +.Nm vnode_pager_purge_range +.Nd "invalidate the cached contents within the given byte range" +.Sh SYNOPSIS +.In sys/param.h +.In vm/vm.h +.In vm/vm_extern.h +.Ft void +.Fo vnode_pager_purge_range +.Fa "struct vnode *vp" +.Fa "vm_ooffset_t start" +.Fa "vm_ooffset_t end" +.Fc +.Sh DESCRIPTION +.Nm +invalidates the cached contents within the given byte range from the +specified vnode +.Fa vp . +The range to be purged is +.Eo [ +.Fa start , end +.Ec ) . +If the +.Fa end +parameter is the value zero, the affected range starts from +.Fa start +continues to the end of the object. +Pages within the specified range will be removed from the object's queue. +If +.Fa start +or +.Fa end +is not aligned to a page boundary, the invalidated part of the page is zeroed. +This function only cleans the resident pages in the affected region, it is up to +the callers to ensure reading the backing store gets back zeroes. +.Pp +In case the vnode +.Fa vp +does not have a VM object allocated, the effect of calling this function is a +no-op. +.Sh LOCKS +The vnode must be locked on entry and will still be locked on exit. +.Sh SEE ALSO +.Xr vnode 9 +.Sh HISTORY +The +.Nm +manual page first appeared in +.Fx 14 . +.Sh AUTHORS +This +manual page was written by +.An Ka Ho Ng Aq Mt khng@FreeBSD.org . diff --git a/sys/vm/vm_extern.h b/sys/vm/vm_extern.h index acdb361d3262..ed365bd41689 100644 --- a/sys/vm/vm_extern.h +++ b/sys/vm/vm_extern.h @@ -120,6 +120,7 @@ void vmspace_free(struct vmspace *); void vmspace_exitfree(struct proc *); void vmspace_switch_aio(struct vmspace *); void vnode_pager_setsize(struct vnode *, vm_ooffset_t); +void vnode_pager_purge_range(struct vnode *, vm_ooffset_t, vm_ooffset_t); int vslock(void *, size_t); void vsunlock(void *, size_t); struct sf_buf *vm_imgact_map_page(vm_object_t object, vm_ooffset_t offset); diff --git a/sys/vm/vnode_pager.c b/sys/vm/vnode_pager.c index d167fcc555fb..4330c17c2033 100644 --- a/sys/vm/vnode_pager.c +++ b/sys/vm/vnode_pager.c @@ -427,6 +427,53 @@ vnode_pager_haspage(vm_object_t object, vm_pindex_t pindex, int *before, return TRUE; } +/* + * Internal routine clearing partial-page content + */ +static void +vnode_pager_subpage_purge(struct vm_page *m, int base, int end) +{ + int size; + + KASSERT(end > base && end <= PAGE_SIZE, + ("%s: start %d end %d", __func__, base, end)); + size = end - base; + + /* + * Clear out partial-page garbage in case + * the page has been mapped. + */ + pmap_zero_page_area(m, base, size); + + /* + * Update the valid bits to reflect the blocks + * that have been zeroed. Some of these valid + * bits may have already been set. + */ + vm_page_set_valid_range(m, base, size); + + /* + * Round up "base" to the next block boundary so + * that the dirty bit for a partially zeroed + * block is not cleared. + */ + base = roundup2(base, DEV_BSIZE); + end = rounddown2(end, DEV_BSIZE); + + if (end > base) { + /* + * Clear out partial-page dirty bits. + * + * note that we do not clear out the + * valid bits. This would prevent + * bogus_page replacement from working + * properly. + */ + vm_page_clear_dirty(m, base, end - base); + } + +} + /* * Lets the VM system know about a change in size for a file. * We adjust our own internal size and flush any cached pages in @@ -489,39 +536,9 @@ vnode_pager_setsize(struct vnode *vp, vm_ooffset_t nsize) m = vm_page_grab(object, OFF_TO_IDX(nsize), VM_ALLOC_NOCREAT); if (m == NULL) goto out; - if (!vm_page_none_valid(m)) { - int base = (int)nsize & PAGE_MASK; - int size = PAGE_SIZE - base; - - /* - * Clear out partial-page garbage in case - * the page has been mapped. - */ - pmap_zero_page_area(m, base, size); - - /* - * Update the valid bits to reflect the blocks that - * have been zeroed. Some of these valid bits may - * have already been set. - */ - vm_page_set_valid_range(m, base, size); - - /* - * Round "base" to the next block boundary so that the - * dirty bit for a partially zeroed block is not - * cleared. - */ - base = roundup2(base, DEV_BSIZE); - - /* - * Clear out partial-page dirty bits. - * - * note that we do not clear out the valid - * bits. This would prevent bogus_page - * replacement from working properly. - */ - vm_page_clear_dirty(m, base, PAGE_SIZE - base); - } + if (!vm_page_none_valid(m)) + vnode_pager_subpage_purge(m, (int)nsize & PAGE_MASK, + PAGE_SIZE); vm_page_xunbusy(m); } out: @@ -534,6 +551,63 @@ out: VM_OBJECT_WUNLOCK(object); } +/* + * Lets the VM system know about the purged range for a file. We toss away any + * cached pages in the associated object that are affected by the purge + * operation. Partial-page area not aligned to page boundaries will be zeroed + * and the dirty blocks in DEV_BSIZE unit within a page will not be flushed. + */ +void +vnode_pager_purge_range(struct vnode *vp, vm_ooffset_t start, vm_ooffset_t end) +{ + struct vm_page *m; + struct vm_object *object; + vm_pindex_t pi, pistart, piend; + bool same_page; + int base, pend; + + ASSERT_VOP_LOCKED(vp, "vnode_pager_purge_range"); + + object = vp->v_object; + pi = start + PAGE_MASK < start ? OBJ_MAX_SIZE : + OFF_TO_IDX(start + PAGE_MASK); + pistart = OFF_TO_IDX(start); + piend = end == 0 ? OBJ_MAX_SIZE : OFF_TO_IDX(end); + same_page = pistart == piend; + if ((end != 0 && end <= start) || object == NULL) + return; + + VM_OBJECT_WLOCK(object); + + if (pi < piend) + vm_object_page_remove(object, pi, piend, 0); + + if ((start & PAGE_MASK) != 0) { + base = (int)start & PAGE_MASK; + pend = same_page ? (int)end & PAGE_MASK : PAGE_SIZE; + m = vm_page_grab(object, pistart, VM_ALLOC_NOCREAT); + if (m != NULL) { + if (!vm_page_none_valid(m)) + vnode_pager_subpage_purge(m, base, pend); + vm_page_xunbusy(m); + } + if (same_page) + goto out; + } + if ((end & PAGE_MASK) != 0) { + base = same_page ? (int)start & PAGE_MASK : 0 ; + pend = (int)end & PAGE_MASK; + m = vm_page_grab(object, piend, VM_ALLOC_NOCREAT); + if (m != NULL) { + if (!vm_page_none_valid(m)) + vnode_pager_subpage_purge(m, base, pend); + vm_page_xunbusy(m); + } + } +out: + VM_OBJECT_WUNLOCK(object); +} + /* * calculate the linear (byte) disk address of specified virtual * file address From owner-dev-commits-src-all@freebsd.org Thu Aug 5 15:23:35 2021 Return-Path: Delivered-To: dev-commits-src-all@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 9481766570A; Thu, 5 Aug 2021 15:23: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 4GgXSR3hZfz3GhS; Thu, 5 Aug 2021 15:23: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 686901CB02; Thu, 5 Aug 2021 15:23: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 175FNZ3Z086179; Thu, 5 Aug 2021 15:23:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 175FNZHl086178; Thu, 5 Aug 2021 15:23:35 GMT (envelope-from git) Date: Thu, 5 Aug 2021 15:23:35 GMT Message-Id: <202108051523.175FNZHl086178@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ka Ho Ng Subject: git: abbb57d5a647 - main - vfs: Introduce vn_bmap_seekhole_locked() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: khng X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: abbb57d5a647f91847a860bd25b4f109c3abb390 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 15:23:35 -0000 The branch main has been updated by khng: URL: https://cgit.FreeBSD.org/src/commit/?id=abbb57d5a647f91847a860bd25b4f109c3abb390 commit abbb57d5a647f91847a860bd25b4f109c3abb390 Author: Ka Ho Ng AuthorDate: 2021-08-04 19:20:59 +0000 Commit: Ka Ho Ng CommitDate: 2021-08-05 14:52:26 +0000 vfs: Introduce vn_bmap_seekhole_locked() vn_bmap_seekhole_locked() is factored out version of vn_bmap_seekhole(). This variant requires shared vnode lock being held around the call. Sponsored by: The FreeBSD Foundation Reviewed by: kib, markj Differential Revision: https://reviews.freebsd.org/D31404 --- sys/kern/vfs_vnops.c | 36 +++++++++++++++++++++++++----------- sys/sys/vnode.h | 2 ++ 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index b7e53add5a35..ccc468d71737 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -2425,7 +2425,8 @@ vn_pages_remove(struct vnode *vp, vm_pindex_t start, vm_pindex_t end) } int -vn_bmap_seekhole(struct vnode *vp, u_long cmd, off_t *off, struct ucred *cred) +vn_bmap_seekhole_locked(struct vnode *vp, u_long cmd, off_t *off, + struct ucred *cred) { struct vattr va; daddr_t bn, bnp; @@ -2434,21 +2435,20 @@ vn_bmap_seekhole(struct vnode *vp, u_long cmd, off_t *off, struct ucred *cred) int error; KASSERT(cmd == FIOSEEKHOLE || cmd == FIOSEEKDATA, - ("Wrong command %lu", cmd)); + ("%s: Wrong command %lu", __func__, cmd)); + ASSERT_VOP_LOCKED(vp, "vn_bmap_seekhole_locked"); - if (vn_lock(vp, LK_SHARED) != 0) - return (EBADF); if (vp->v_type != VREG) { error = ENOTTY; - goto unlock; + goto out; } error = VOP_GETATTR(vp, &va, cred); if (error != 0) - goto unlock; + goto out; noff = *off; if (noff >= va.va_size) { error = ENXIO; - goto unlock; + goto out; } bsize = vp->v_mount->mnt_stat.f_iosize; for (bn = noff / bsize; noff < va.va_size; bn++, noff += bsize - @@ -2456,14 +2456,14 @@ vn_bmap_seekhole(struct vnode *vp, u_long cmd, off_t *off, struct ucred *cred) error = VOP_BMAP(vp, bn, NULL, &bnp, NULL, NULL); if (error == EOPNOTSUPP) { error = ENOTTY; - goto unlock; + goto out; } if ((bnp == -1 && cmd == FIOSEEKHOLE) || (bnp != -1 && cmd == FIOSEEKDATA)) { noff = bn * bsize; if (noff < *off) noff = *off; - goto unlock; + goto out; } } if (noff > va.va_size) @@ -2471,13 +2471,27 @@ vn_bmap_seekhole(struct vnode *vp, u_long cmd, off_t *off, struct ucred *cred) /* noff == va.va_size. There is an implicit hole at the end of file. */ if (cmd == FIOSEEKDATA) error = ENXIO; -unlock: - VOP_UNLOCK(vp); +out: if (error == 0) *off = noff; return (error); } +int +vn_bmap_seekhole(struct vnode *vp, u_long cmd, off_t *off, struct ucred *cred) +{ + int error; + + KASSERT(cmd == FIOSEEKHOLE || cmd == FIOSEEKDATA, + ("%s: Wrong command %lu", __func__, cmd)); + + if (vn_lock(vp, LK_SHARED) != 0) + return (EBADF); + error = vn_bmap_seekhole_locked(vp, cmd, off, cred); + VOP_UNLOCK(vp); + return (error); +} + int vn_seek(struct file *fp, off_t offset, int whence, struct thread *td) { diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index 1f2d74fdf5f1..702fd6623e6a 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -731,6 +731,8 @@ void vunref(struct vnode *); void vn_printf(struct vnode *vp, const char *fmt, ...) __printflike(2,3); int vrecycle(struct vnode *vp); int vrecyclel(struct vnode *vp); +int vn_bmap_seekhole_locked(struct vnode *vp, u_long cmd, off_t *off, + struct ucred *cred); int vn_bmap_seekhole(struct vnode *vp, u_long cmd, off_t *off, struct ucred *cred); int vn_close(struct vnode *vp, From owner-dev-commits-src-all@freebsd.org Thu Aug 5 15:23:36 2021 Return-Path: Delivered-To: dev-commits-src-all@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 D2EDE6656CF; Thu, 5 Aug 2021 15:23:36 +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 4GgXSS5FBQz3GcB; Thu, 5 Aug 2021 15:23:36 +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 8C1CA1CB03; Thu, 5 Aug 2021 15:23:36 +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 175FNaar086203; Thu, 5 Aug 2021 15:23:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 175FNaGp086202; Thu, 5 Aug 2021 15:23:36 GMT (envelope-from git) Date: Thu, 5 Aug 2021 15:23:36 GMT Message-Id: <202108051523.175FNaGp086202@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ka Ho Ng Subject: git: 0dc332bff200 - main - Add fspacectl(2), vn_deallocate(9) and VOP_DEALLOCATE(9). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: khng X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0dc332bff200c940edc36c4715b629a2e1e9f9ae Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 15:23:37 -0000 The branch main has been updated by khng: URL: https://cgit.FreeBSD.org/src/commit/?id=0dc332bff200c940edc36c4715b629a2e1e9f9ae commit 0dc332bff200c940edc36c4715b629a2e1e9f9ae Author: Ka Ho Ng AuthorDate: 2021-08-05 15:20:42 +0000 Commit: Ka Ho Ng CommitDate: 2021-08-05 15:20:42 +0000 Add fspacectl(2), vn_deallocate(9) and VOP_DEALLOCATE(9). fspacectl(2) is a system call to provide space management support to userspace applications. VOP_DEALLOCATE(9) is a VOP call to perform the deallocation. vn_deallocate(9) is a public KPI for kmods' use. The purpose of proposing a new system call, a KPI and a VOP call is to allow bhyve or other hypervisor monitors to emulate the behavior of SCSI UNMAP/NVMe DEALLOCATE on a plain file. fspacectl(2) comprises of cmd and flags parameters to specify the space management operation to be performed. Currently cmd has to be SPACECTL_DEALLOC, and flags has to be 0. fo_fspacectl is added to fileops. VOP_DEALLOCATE(9) is added as a new VOP call. A trivial implementation of VOP_DEALLOCATE(9) is provided. Sponsored by: The FreeBSD Foundation Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D28347 --- lib/libc/sys/Makefile.inc | 1 + lib/libc/sys/Symbol.map | 1 + lib/libc/sys/fspacectl.2 | 189 +++++++++++++++++++ lib/libc/sys/pathconf.2 | 3 + share/man/man9/Makefile | 2 + share/man/man9/VOP_DEALLOCATE.9 | 101 ++++++++++ share/man/man9/vn_deallocate.9 | 103 +++++++++++ sys/bsm/audit_kevents.h | 1 + sys/compat/freebsd32/freebsd32.h | 4 + sys/compat/freebsd32/freebsd32_misc.c | 34 ++++ sys/compat/freebsd32/syscalls.master | 5 + sys/kern/capabilities.conf | 5 + sys/kern/sys_generic.c | 70 +++++++ sys/kern/syscalls.master | 9 + sys/kern/vfs_default.c | 122 ++++++++++++ sys/kern/vfs_vnops.c | 110 +++++++++++ sys/kern/vnode_if.src | 11 ++ sys/security/audit/audit_bsm.c | 12 ++ sys/sys/fcntl.h | 20 ++ sys/sys/file.h | 15 ++ sys/sys/syscallsubr.h | 3 + sys/sys/unistd.h | 1 + sys/sys/vnode.h | 2 + tests/sys/file/Makefile | 1 + tests/sys/file/fspacectl_test.c | 338 ++++++++++++++++++++++++++++++++++ 25 files changed, 1163 insertions(+) diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc index a1eb9567a380..29e914872a8d 100644 --- a/lib/libc/sys/Makefile.inc +++ b/lib/libc/sys/Makefile.inc @@ -190,6 +190,7 @@ MAN+= abort2.2 \ fhreadlink.2 \ flock.2 \ fork.2 \ + fspacectl.2 \ fsync.2 \ getdirentries.2 \ getdtablesize.2 \ diff --git a/lib/libc/sys/Symbol.map b/lib/libc/sys/Symbol.map index 80bb2c236191..93fbc947a7e1 100644 --- a/lib/libc/sys/Symbol.map +++ b/lib/libc/sys/Symbol.map @@ -419,6 +419,7 @@ FBSD_1.6 { FBSD_1.7 { _Fork; + fspacectl; }; FBSDprivate_1.0 { diff --git a/lib/libc/sys/fspacectl.2 b/lib/libc/sys/fspacectl.2 new file mode 100644 index 000000000000..2f581d1c1fb8 --- /dev/null +++ b/lib/libc/sys/fspacectl.2 @@ -0,0 +1,189 @@ +.\" +.\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD +.\" +.\" Copyright (c) 2021 The FreeBSD Foundation +.\" +.\" This manual page was written by Ka Ho Ng 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: +.\" 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. +.\" +.Dd August 4, 2021 +.Dt FSPACECTL 2 +.Os +.Sh NAME +.Nm fspacectl +.Nd space management in a file +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In fcntl.h +.Ft int +.Fo fspacectl +.Fa "int fd" +.Fa "int cmd" +.Fa "const struct spacectl_range *rqsr" +.Fa "int flags" +.Fa "struct spacectl_range *rmsr" +.Fc +.Sh DESCRIPTION +.Nm +is a system call performing space management over a file. +The +.Fa fd +argument specifies the file descriptor to be operated on by the +.Fa cmd +argument. +The +.Fa rqsr +argument points to a +.Fa spacectl_range +structure that contains the requested operation range. +The +.Fa flags +argument controls the behavior of the operation to take place. +If the +.Fa rmsr +argument is non-NULL, the +.Fa spacectl_range +structure it points to is updated to contain the unprocessed operation range +after the system call returns. +Both +.Fa rqsr +and +.Fa rmsr +arguments can point to the same structure. +.Pp +The +.Fa spacectl_range +structure is defined as: +.Bd -literal +struct spacectl_range { + off_t r_offset; + off_t r_len; +}; +.Ed +.Pp +The operation specified by the +.Fa cmd +argument may be one of: +.Bl -tag -width SPACECTL_DEALLOC +.It Dv SPACECTL_DEALLOC +Zero a region in the file specified by the +.Fa rqsr +argument. +The +.Va "rqsr->r_offset" +has to be a value greater than or equal to 0, and the +.Va "rqsr->r_len" +has to be a value greater than 0. +.Pp +If the file system supports hole-punching, +file system space deallocation may be performed in the given region. +.El +.Pp +The +.Fa flags +argument needs to be the value 0 currently. +.Sh RETURN VALUES +Upon successful completion, the value 0 is returned; +otherwise the value -1 is returned and +.Va errno +is set to indicate the error. +.Sh ERRORS +Possible failure conditions: +.Bl -tag -width Er +.It Bq Er EBADF +The +.Fa fd +argument is not a valid file descriptor. +.It Bq Er EBADF +The +.Fa fd +argument references a file that was opened without write permission. +.It Bq Er EINTR +A signal was caught during execution. +.It Bq Er EINVAL +The +.Fa cmd +argument is not valid. +.It Bq Er EINVAL +If the +.Fa cmd +argument is +.Dv SPACECTL_DEALLOC , +either the +.Fa "range->r_offset" +argument was less than zero, or the +.Fa "range->r_len" +argument was less than or equal to zero. +.It Bq Er EINVAL +An invalid or unsupported flag is included in +.Fa flags . +.It Bq Er EINVAL +A flag included in +.Fa flags +is not supported by the operation specified by the +.Fa cmd +argument. +.It Bq Er EFAULT +The +.Fa rqsr +or a non-NULL +.Fa rmsr +argument point outside the process' allocated address space. +.It Bq Er EIO +An I/O error occurred while reading from or writing to a file system. +.It Bq Er EINTEGRITY +Corrupted data was detected while reading from the file system. +.It Bq Er ENODEV +The +.Fa fd +argument does not refer to a file that supports +.Nm . +.It Bq Er ENOSPC +There is insufficient free space remaining on the file system storage +media. +.It Bq Er ENOTCAPABLE +The file descriptor +.Fa fd +has insufficient rights. +.It Bq Er ESPIPE +The +.Fa fd +argument is associated with a pipe or FIFO. +.El +.Sh SEE ALSO +.Xr creat 2 , +.Xr ftruncate 2 , +.Xr open 2 , +.Xr unlink 2 +.Sh HISTORY +The +.Nm +system call appeared in +.Fx 14.0 . +.Sh AUTHORS +.Nm +and this manual page were written by +.An Ka Ho Ng Aq Mt khng@FreeBSD.org +under sponsorship from the FreeBSD Foundation. diff --git a/lib/libc/sys/pathconf.2 b/lib/libc/sys/pathconf.2 index 62ec532705ef..c5a7ba1be3c5 100644 --- a/lib/libc/sys/pathconf.2 +++ b/lib/libc/sys/pathconf.2 @@ -166,6 +166,9 @@ specified file, otherwise 0. .It Li _PC_MIN_HOLE_SIZE If a file system supports the reporting of holes (see .Xr lseek 2 ) , +.It Li _PC_DEALLOC_PRESENT +If a file system supports hole-punching (see +.Xr fspacectl 2 ) , .Fn pathconf and .Fn fpathconf diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index d0012301d889..b2f1451a79d7 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -404,6 +404,7 @@ MAN= accept_filter.9 \ vm_page_wire.9 \ vm_set_page_size.9 \ vmem.9 \ + vn_deallocate.9 \ vn_fullpath.9 \ vn_isdisk.9 \ vnet.9 \ @@ -420,6 +421,7 @@ MAN= accept_filter.9 \ VOP_BWRITE.9 \ VOP_COPY_FILE_RANGE.9 \ VOP_CREATE.9 \ + VOP_DEALLOCATE.9 \ VOP_FSYNC.9 \ VOP_GETACL.9 \ VOP_GETEXTATTR.9 \ diff --git a/share/man/man9/VOP_DEALLOCATE.9 b/share/man/man9/VOP_DEALLOCATE.9 new file mode 100644 index 000000000000..1c7f80cfbc6c --- /dev/null +++ b/share/man/man9/VOP_DEALLOCATE.9 @@ -0,0 +1,101 @@ +.\" +.\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD +.\" +.\" Copyright (c) 2021 The FreeBSD Foundation +.\" +.\" This manual page was written by Ka Ho Ng 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: +.\" 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. +.\" +.Dd May 11, 2021 +.Dt VOP_DEALLOCATE 9 +.Os +.Sh NAME +.Nm VOP_DEALLOCATE +.Nd zero and/or deallocate storage from a file +.Sh SYNOPSIS +.In sys/param.h +.In sys/vnode.h +.Ft int +.Fo VOP_DEALLOCATE +.Fa "struct vnode *vp" +.Fa "off_t *offset" +.Fa "off_t *len" +.Fa "int flags" +.Fa "struct ucred *cred" +.Fc +.Sh DESCRIPTION +This VOP call zeroes/deallocates storage for an offset range in a file. +It is used to implement the +.Xr fspacectl 2 +system call. +.Pp +Its arguments are: +.Bl -tag -width offset +.It Fa vp +The vnode of the file. +.It Fa offset +The start of the range to deallocate storage in the file. +.It Fa len +The length of the range to deallocate storage in the file. +.It Fa flags +The flags of this call. +This should be set to 0 for now. +.It Fa cred +The credentials of the caller. +.El +.Pp +.Fa *offset +and +.Fa *len +are updated to reflect the portion of the range that +still needs to be zeroed/deallocated on return. +Partial result is considered a successful operation. +.Sh LOCKS +The vnode should be locked on entry and will still be locked on exit. +.Sh RETURN VALUES +Zero is returned if the call is successful, otherwise an appropriate +error code is returned. +.Sh ERRORS +.Bl -tag -width Er +.It Bq Er EINVAL +Invalid +.Fa offset , len +or +.Fa flags +parameters are passed into this VOP call. +.It Bq Er ENODEV +The vnode type is not supported by this VOP call. +.It Bq Er ENOSPC +The file system is full. +.It Bq Er EPERM +An append-only flag is set on the file, but the caller is attempting to +zero before the current end of file. +.El +.Sh SEE ALSO +.Xr vnode 9 +.Sh AUTHORS +.Nm +and this manual page was written by +.An Ka Ho Ng Aq Mt khng@FreeBSD.org +under sponsorship from the FreeBSD Foundation. diff --git a/share/man/man9/vn_deallocate.9 b/share/man/man9/vn_deallocate.9 new file mode 100644 index 000000000000..415a8941ca68 --- /dev/null +++ b/share/man/man9/vn_deallocate.9 @@ -0,0 +1,103 @@ +.\" +.\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD +.\" +.\" Copyright (c) 2021 The FreeBSD Foundation +.\" +.\" This manual page was written by Ka Ho Ng 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: +.\" 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. +.\" +.Dd Jul 30, 2021 +.Dt VN_DEALLOCATE 9 +.Os +.Sh NAME +.Nm vn_deallocate +.Nd zero and/or deallocate storage from a file +.Sh SYNOPSIS +.In sys/param.h +.In sys/vnode.h +.Ft int +.Fo vn_deallocate +.Fa "struct vnode *vp" +.Fa "off_t *offset" +.Fa "off_t *length" +.Fa "int flags" +.Fa "int ioflg" +.Fa "struct ucred *active_cred" +.Fa "struct ucred *file_cred" +.Fc +.Sh DESCRIPTION +The +.Fn vn_deallocate +function zeros and/or deallocates backing storage space from a file. +This function only works on vnodes with +.Dv VREG +type. +.Pp +The arguments are: +.Bl -tag -width active_cred +.It Fa vp +The vnode of the file. +.It Fa offset +The starting offset of the operation range. +.It Fa length +The length of the operation range. +This must be greater than 0. +.It Fa flags +The control flags of the operation. +This should be set to 0 for now. +.It Fa ioflg +The control flags of vnode locking. +.It Fa active_cred +The user credentials of the calling thread. +.It Fa file_cred +The credentials installed on the file description pointing to the vnode or NOCRED. +.El +.Pp +The +.Fn ioflg +argument may be one or more of the following flags: +.Bl -tag -width IO_RANGELOCKED +.It Dv IO_NODELOCKED +The vnode was locked before the call. +.It Dv IO_RANGELOCKED +Rangelock was owned around the call. +.It Dv IO_NOMACCHECK +Skip MAC checking in the call. +.El +.Pp +.Fa *offset +and +.Fa *length +are updated to reflect the unprocessed operation range of the call. +.Sh RETURN VALUES +Upon successful completion, the value 0 is returned; otherwise the +appropriate error is returned. +.Sh SEE ALSO +.Xr vnode 9 , +.Xr VOP_DEALLOCATE 9 +.Sh AUTHORS +.Nm +and this manual page was written by +.An Ka Ho Ng Aq Mt khng@FreeBSD.org +under sponsorship from the FreeBSD Foundation. diff --git a/sys/bsm/audit_kevents.h b/sys/bsm/audit_kevents.h index eeb928ecafdc..0da82de1fbcb 100644 --- a/sys/bsm/audit_kevents.h +++ b/sys/bsm/audit_kevents.h @@ -662,6 +662,7 @@ #define AUE_SPECIALFD 43266 /* FreeBSD-specific. */ #define AUE_AIO_WRITEV 43267 /* FreeBSD-specific. */ #define AUE_AIO_READV 43268 /* FreeBSD-specific. */ +#define AUE_FSPACECTL 43269 /* FreeBSD-specific. */ /* * Darwin BSM uses a number of AUE_O_* definitions, which are aliased to the diff --git a/sys/compat/freebsd32/freebsd32.h b/sys/compat/freebsd32/freebsd32.h index 2e4f5155cbf4..8a14a42db813 100644 --- a/sys/compat/freebsd32/freebsd32.h +++ b/sys/compat/freebsd32/freebsd32.h @@ -435,5 +435,9 @@ struct ptrace_coredump32 { uint32_t pc_limit1, pc_limit2; }; +struct spacectl_range32 { + uint32_t r_offset1, r_offset2; + uint32_t r_len1, r_len2; +}; #endif /* !_COMPAT_FREEBSD32_FREEBSD32_H_ */ diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c index 736fd1123d53..c417a64d286a 100644 --- a/sys/compat/freebsd32/freebsd32_misc.c +++ b/sys/compat/freebsd32/freebsd32_misc.c @@ -3857,3 +3857,37 @@ freebsd32_ntp_adjtime(struct thread *td, struct freebsd32_ntp_adjtime_args *uap) } return (error); } + +int +freebsd32_fspacectl(struct thread *td, struct freebsd32_fspacectl_args *uap) +{ + struct spacectl_range rqsr, rmsr; + struct spacectl_range32 rqsr32, rmsr32; + int error, cerror; + + error = copyin(uap->rqsr, &rqsr32, sizeof(rqsr32)); + if (error != 0) + return (error); + rqsr.r_offset = PAIR32TO64(off_t, rqsr32.r_offset); + rqsr.r_len = PAIR32TO64(off_t, rqsr32.r_len); + + error = kern_fspacectl(td, uap->fd, uap->cmd, &rqsr, uap->flags, + &rmsr); + if (uap->rmsr != NULL) { +#if BYTE_ORDER == LITTLE_ENDIAN + rmsr32.r_offset1 = rmsr.r_offset; + rmsr32.r_offset2 = rmsr.r_offset >> 32; + rmsr32.r_len1 = rmsr.r_len; + rmsr32.r_len2 = rmsr.r_len >> 32; +#else + rmsr32.r_offset1 = rmsr.r_offset >> 32; + rmsr32.r_offset2 = rmsr.r_offset; + rmsr32.r_len1 = rmsr.r_len >> 32; + rmsr32.r_len2 = rmsr.r_len; +#endif + cerror = copyout(&rmsr32, uap->rmsr, sizeof(rmsr32)); + if (error == 0) + error = cerror; + } + return (error); +} diff --git a/sys/compat/freebsd32/syscalls.master b/sys/compat/freebsd32/syscalls.master index aac788bf3956..3e53de2dc966 100644 --- a/sys/compat/freebsd32/syscalls.master +++ b/sys/compat/freebsd32/syscalls.master @@ -1176,5 +1176,10 @@ struct aiocb32 *aiocbp); } 579 AUE_AIO_READV STD { int freebsd32_aio_readv( \ struct aiocb32 *aiocbp); } +580 AUE_FSPACECTL STD { int freebsd32_fspacectl(int fd, \ + int cmd, \ + const struct spacectl_range32 *rqsr, \ + int flags, \ + struct spacectl_range32 *rmsr); } ; vim: syntax=off diff --git a/sys/kern/capabilities.conf b/sys/kern/capabilities.conf index 602ec7088fc6..f53530eb7fa7 100644 --- a/sys/kern/capabilities.conf +++ b/sys/kern/capabilities.conf @@ -228,6 +228,11 @@ freebsd6_mmap freebsd6_pread freebsd6_pwrite +## +## Allow I/O-related file operations, subject to capability rights. +## +fspacectl + ## ## Allow querying file and file system state with fstat(2) and fstatfs(2), ## subject to capability rights. diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c index f86d494400e2..e6b2cba27a04 100644 --- a/sys/kern/sys_generic.c +++ b/sys/kern/sys_generic.c @@ -861,6 +861,76 @@ kern_posix_fallocate(struct thread *td, int fd, off_t offset, off_t len) return (error); } +int +sys_fspacectl(struct thread *td, struct fspacectl_args *uap) +{ + struct spacectl_range rqsr, rmsr; + int error, cerror; + + error = copyin(uap->rqsr, &rqsr, sizeof(rqsr)); + if (error != 0) + return (error); + + error = kern_fspacectl(td, uap->fd, uap->cmd, &rqsr, uap->flags, + &rmsr); + if (uap->rmsr != NULL) { + cerror = copyout(&rmsr, uap->rmsr, sizeof(rmsr)); + if (error == 0) + error = cerror; + } + return (error); +} + +int +kern_fspacectl(struct thread *td, int fd, int cmd, + const struct spacectl_range *rqsr, int flags, struct spacectl_range *rmsrp) +{ + struct file *fp; + struct spacectl_range rmsr; + int error; + + AUDIT_ARG_FD(fd); + AUDIT_ARG_CMD(cmd); + AUDIT_ARG_FFLAGS(flags); + + if (rqsr == NULL) + return (EINVAL); + rmsr = *rqsr; + if (rmsrp != NULL) + *rmsrp = rmsr; + + if (cmd != SPACECTL_DEALLOC || + rqsr->r_offset < 0 || rqsr->r_len <= 0 || + rqsr->r_offset > OFF_MAX - rqsr->r_len || + (flags & ~SPACECTL_F_SUPPORTED) != 0) + return (EINVAL); + + error = fget_write(td, fd, &cap_pwrite_rights, &fp); + if (error != 0) + return (error); + AUDIT_ARG_FILE(td->td_proc, fp); + if ((fp->f_ops->fo_flags & DFLAG_SEEKABLE) == 0) { + error = ESPIPE; + goto out; + } + if ((fp->f_flag & FWRITE) == 0) { + error = EBADF; + goto out; + } + + error = fo_fspacectl(fp, cmd, &rmsr.r_offset, &rmsr.r_len, flags, + td->td_ucred, td); + /* fspacectl is not restarted after signals if the file is modified. */ + if (rmsr.r_len != rqsr->r_len && (error == ERESTART || + error == EINTR || error == EWOULDBLOCK)) + error = 0; + if (rmsrp != NULL) + *rmsrp = rmsr; +out: + fdrop(fp, td); + return (error); +} + int kern_specialfd(struct thread *td, int type, void *arg) { diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master index af787908451a..11247aed8fd6 100644 --- a/sys/kern/syscalls.master +++ b/sys/kern/syscalls.master @@ -3250,6 +3250,15 @@ _Inout_ struct aiocb *aiocbp ); } +580 AUE_FSPACECTL STD { + int fspacectl( + int fd, + int cmd, + _In_ const struct spacectl_range *rqsr, + int flags, + _Out_opt_ struct spacectl_range *rmsr, + ); + } ; Please copy any additions and changes to the following compatability tables: ; sys/compat/freebsd32/syscalls.master diff --git a/sys/kern/vfs_default.c b/sys/kern/vfs_default.c index 63bca7810847..c42d5a795935 100644 --- a/sys/kern/vfs_default.c +++ b/sys/kern/vfs_default.c @@ -93,6 +93,7 @@ static int vop_stdgetpages_async(struct vop_getpages_async_args *ap); static int vop_stdread_pgcache(struct vop_read_pgcache_args *ap); static int vop_stdstat(struct vop_stat_args *ap); static int vop_stdvput_pair(struct vop_vput_pair_args *ap); +static int vop_stddeallocate(struct vop_deallocate_args *ap); /* * This vnode table stores what we want to do if the filesystem doesn't @@ -117,6 +118,7 @@ struct vop_vector default_vnodeops = { .vop_advlockasync = vop_stdadvlockasync, .vop_advlockpurge = vop_stdadvlockpurge, .vop_allocate = vop_stdallocate, + .vop_deallocate = vop_stddeallocate, .vop_bmap = vop_stdbmap, .vop_close = VOP_NULL, .vop_fsync = VOP_NULL, @@ -518,6 +520,7 @@ vop_stdpathconf(ap) case _PC_ACL_EXTENDED: case _PC_ACL_NFS4: case _PC_CAP_PRESENT: + case _PC_DEALLOC_PRESENT: case _PC_INF_PRESENT: case _PC_MAC_PRESENT: *ap->a_retval = 0; @@ -1069,6 +1072,125 @@ vop_stdallocate(struct vop_allocate_args *ap) return (error); } +static int +vp_zerofill(struct vnode *vp, struct vattr *vap, off_t *offsetp, off_t *lenp, + struct ucred *cred) +{ + int iosize; + int error = 0; + struct iovec aiov; + struct uio auio; + struct thread *td; + off_t offset, len; + + iosize = vap->va_blocksize; + td = curthread; + offset = *offsetp; + len = *lenp; + + if (iosize == 0) + iosize = BLKDEV_IOSIZE; + /* If va_blocksize is 512 bytes, iosize will be 4 kilobytes */ + iosize = min(iosize * 8, ZERO_REGION_SIZE); + + while (len > 0) { + int xfersize = iosize; + if (offset % iosize != 0) + xfersize -= offset % iosize; + if (xfersize > len) + xfersize = len; + + aiov.iov_base = __DECONST(void *, zero_region); + aiov.iov_len = xfersize; + auio.uio_iov = &aiov; + auio.uio_iovcnt = 1; + auio.uio_offset = offset; + auio.uio_resid = xfersize; + auio.uio_segflg = UIO_SYSSPACE; + auio.uio_rw = UIO_WRITE; + auio.uio_td = td; + + error = VOP_WRITE(vp, &auio, 0, cred); + if (error != 0) { + len -= xfersize - auio.uio_resid; + offset += xfersize - auio.uio_resid; + break; + } + + len -= xfersize; + offset += xfersize; + } + + *offsetp = offset; + *lenp = len; + return (error); +} + +static int +vop_stddeallocate(struct vop_deallocate_args *ap) +{ + struct vnode *vp; + off_t offset, len; + struct ucred *cred; + int error; + struct vattr va; + off_t noff, xfersize, rem; + + vp = ap->a_vp; + offset = *ap->a_offset; + len = *ap->a_len; + cred = ap->a_cred; + + error = VOP_GETATTR(vp, &va, cred); + if (error) + return (error); + + len = omin(OFF_MAX - offset, *ap->a_len); + while (len > 0) { + noff = offset; + error = vn_bmap_seekhole_locked(vp, FIOSEEKDATA, &noff, cred); + if (error) { + if (error != ENXIO) + /* XXX: Is it okay to fallback further? */ + goto out; + + /* + * No more data region to be filled + */ + len = 0; + error = 0; + break; + } + KASSERT(noff >= offset, ("FIOSEEKDATA going backward")); + if (noff != offset) { + xfersize = omin(noff - offset, len); + len -= xfersize; + offset += xfersize; + if (len == 0) + break; + } + error = vn_bmap_seekhole_locked(vp, FIOSEEKHOLE, &noff, cred); + if (error) + goto out; + + /* Fill zeroes */ + xfersize = rem = omin(noff - offset, len); + error = vp_zerofill(vp, &va, &offset, &rem, cred); + if (error) { + len -= xfersize - rem; + goto out; + } + + len -= xfersize; + if (should_yield()) + break; + } +out: + *ap->a_offset = offset; + *ap->a_len = len; + return (error); +} + int vop_stdadvise(struct vop_advise_args *ap) { diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index ccc468d71737..c54f55a99036 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -106,6 +106,7 @@ static fo_kqfilter_t vn_kqfilter; static fo_close_t vn_closefile; static fo_mmap_t vn_mmap; static fo_fallocate_t vn_fallocate; +static fo_fspacectl_t vn_fspacectl; struct fileops vnops = { .fo_read = vn_io_fault, @@ -123,6 +124,7 @@ struct fileops vnops = { .fo_fill_kinfo = vn_fill_kinfo, .fo_mmap = vn_mmap, .fo_fallocate = vn_fallocate, + .fo_fspacectl = vn_fspacectl, .fo_flags = DFLAG_PASSABLE | DFLAG_SEEKABLE }; @@ -3439,6 +3441,114 @@ vn_fallocate(struct file *fp, off_t offset, off_t len, struct thread *td) return (error); } +static int +vn_deallocate_impl(struct vnode *vp, off_t *offset, off_t *length, int flags, + int ioflg, struct ucred *active_cred, struct ucred *file_cred) +{ + struct mount *mp; + void *rl_cookie; + off_t off, len; + int error; +#ifdef AUDIT + bool audited_vnode1 = false; +#endif + + rl_cookie = NULL; + error = 0; + mp = NULL; + off = *offset; + len = *length; + + if ((ioflg & (IO_NODELOCKED|IO_RANGELOCKED)) == 0) + rl_cookie = vn_rangelock_wlock(vp, off, off + len); + while (len > 0 && error == 0) { + /* + * Try to deallocate the longest range in one pass. + * In case a pass takes too long to be executed, it returns + * partial result. The residue will be proceeded in the next + * pass. + */ + + if ((ioflg & IO_NODELOCKED) == 0) { + bwillwrite(); + if ((error = vn_start_write(vp, &mp, + V_WAIT | PCATCH)) != 0) + goto out; + vn_lock(vp, vn_lktype_write(mp, vp) | LK_RETRY); + } +#ifdef AUDIT + if (!audited_vnode1) { + AUDIT_ARG_VNODE1(vp); + audited_vnode1 = true; + } +#endif + +#ifdef MAC + if ((ioflg & IO_NOMACCHECK) == 0) + error = mac_vnode_check_write(active_cred, file_cred, + vp); +#endif + if (error == 0) + error = VOP_DEALLOCATE(vp, &off, &len, flags, + active_cred); + + if ((ioflg & IO_NODELOCKED) == 0) { + VOP_UNLOCK(vp); + if (mp != NULL) { + vn_finished_write(mp); + mp = NULL; + } + } + } +out: + if (rl_cookie != NULL) + vn_rangelock_unlock(vp, rl_cookie); + *offset = off; + *length = len; + return (error); +} + +int +vn_deallocate(struct vnode *vp, off_t *offset, off_t *length, int flags, + int ioflg, struct ucred *active_cred, struct ucred *file_cred) +{ + if (*offset < 0 || *length <= 0 || *length > OFF_MAX - *offset || + flags != 0) + return (EINVAL); + if (vp->v_type != VREG) + return (ENODEV); + + return (vn_deallocate_impl(vp, offset, length, flags, ioflg, + active_cred, file_cred)); +} + *** 562 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Thu Aug 5 15:23:38 2021 Return-Path: Delivered-To: dev-commits-src-all@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 398B2665855; Thu, 5 Aug 2021 15:23: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 4GgXST6x1dz3GcG; Thu, 5 Aug 2021 15:23: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 B477B1C8C5; Thu, 5 Aug 2021 15:23: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 175FNb1c086227; Thu, 5 Aug 2021 15:23:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 175FNbvY086226; Thu, 5 Aug 2021 15:23:37 GMT (envelope-from git) Date: Thu, 5 Aug 2021 15:23:37 GMT Message-Id: <202108051523.175FNbvY086226@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ka Ho Ng Subject: git: da9fe3529b3d - main - Regen after 0dc332bff200 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: khng X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: da9fe3529b3ddc7a4edcbfe323dfbd280ac40f09 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 15:23:38 -0000 The branch main has been updated by khng: URL: https://cgit.FreeBSD.org/src/commit/?id=da9fe3529b3ddc7a4edcbfe323dfbd280ac40f09 commit da9fe3529b3ddc7a4edcbfe323dfbd280ac40f09 Author: Ka Ho Ng AuthorDate: 2021-08-04 19:34:42 +0000 Commit: Ka Ho Ng CommitDate: 2021-08-05 15:22:02 +0000 Regen after 0dc332bff200 --- sys/compat/freebsd32/freebsd32_proto.h | 9 ++++++ sys/compat/freebsd32/freebsd32_syscall.h | 3 +- sys/compat/freebsd32/freebsd32_syscalls.c | 1 + sys/compat/freebsd32/freebsd32_sysent.c | 1 + sys/compat/freebsd32/freebsd32_systrace_args.c | 38 ++++++++++++++++++++++++++ sys/kern/init_sysent.c | 1 + sys/kern/syscalls.c | 1 + sys/kern/systrace_args.c | 38 ++++++++++++++++++++++++++ sys/sys/syscall.h | 3 +- sys/sys/syscall.mk | 3 +- sys/sys/sysproto.h | 9 ++++++ 11 files changed, 104 insertions(+), 3 deletions(-) diff --git a/sys/compat/freebsd32/freebsd32_proto.h b/sys/compat/freebsd32/freebsd32_proto.h index d7d4d4fec5ff..3a59abc99dcf 100644 --- a/sys/compat/freebsd32/freebsd32_proto.h +++ b/sys/compat/freebsd32/freebsd32_proto.h @@ -751,6 +751,13 @@ struct freebsd32_aio_writev_args { struct freebsd32_aio_readv_args { char aiocbp_l_[PADL_(struct aiocb32 *)]; struct aiocb32 * aiocbp; char aiocbp_r_[PADR_(struct aiocb32 *)]; }; +struct freebsd32_fspacectl_args { + char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; + char cmd_l_[PADL_(int)]; int cmd; char cmd_r_[PADR_(int)]; + char rqsr_l_[PADL_(const struct spacectl_range32 *)]; const struct spacectl_range32 * rqsr; char rqsr_r_[PADR_(const struct spacectl_range32 *)]; + char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)]; + char rmsr_l_[PADL_(struct spacectl_range32 *)]; struct spacectl_range32 * rmsr; char rmsr_r_[PADR_(struct spacectl_range32 *)]; +}; #if !defined(PAD64_REQUIRED) && !defined(__amd64__) #define PAD64_REQUIRED #endif @@ -893,6 +900,7 @@ int freebsd32_cpuset_setdomain(struct thread *, struct freebsd32_cpuset_setdomai int freebsd32___sysctlbyname(struct thread *, struct freebsd32___sysctlbyname_args *); int freebsd32_aio_writev(struct thread *, struct freebsd32_aio_writev_args *); int freebsd32_aio_readv(struct thread *, struct freebsd32_aio_readv_args *); +int freebsd32_fspacectl(struct thread *, struct freebsd32_fspacectl_args *); #ifdef COMPAT_43 @@ -1486,6 +1494,7 @@ int freebsd11_freebsd32_fstatat(struct thread *, struct freebsd11_freebsd32_fsta #define FREEBSD32_SYS_AUE_freebsd32___sysctlbyname AUE_SYSCTL #define FREEBSD32_SYS_AUE_freebsd32_aio_writev AUE_AIO_WRITEV #define FREEBSD32_SYS_AUE_freebsd32_aio_readv AUE_AIO_READV +#define FREEBSD32_SYS_AUE_freebsd32_fspacectl AUE_FSPACECTL #undef PAD_ #undef PADL_ diff --git a/sys/compat/freebsd32/freebsd32_syscall.h b/sys/compat/freebsd32/freebsd32_syscall.h index c6ca12448ad2..7898b3a25c2e 100644 --- a/sys/compat/freebsd32/freebsd32_syscall.h +++ b/sys/compat/freebsd32/freebsd32_syscall.h @@ -508,4 +508,5 @@ #define FREEBSD32_SYS___specialfd 577 #define FREEBSD32_SYS_freebsd32_aio_writev 578 #define FREEBSD32_SYS_freebsd32_aio_readv 579 -#define FREEBSD32_SYS_MAXSYSCALL 580 +#define FREEBSD32_SYS_freebsd32_fspacectl 580 +#define FREEBSD32_SYS_MAXSYSCALL 581 diff --git a/sys/compat/freebsd32/freebsd32_syscalls.c b/sys/compat/freebsd32/freebsd32_syscalls.c index 4a79f2efdaa4..51b7dbc249d0 100644 --- a/sys/compat/freebsd32/freebsd32_syscalls.c +++ b/sys/compat/freebsd32/freebsd32_syscalls.c @@ -616,4 +616,5 @@ const char *freebsd32_syscallnames[] = { "__specialfd", /* 577 = __specialfd */ "freebsd32_aio_writev", /* 578 = freebsd32_aio_writev */ "freebsd32_aio_readv", /* 579 = freebsd32_aio_readv */ + "freebsd32_fspacectl", /* 580 = freebsd32_fspacectl */ }; diff --git a/sys/compat/freebsd32/freebsd32_sysent.c b/sys/compat/freebsd32/freebsd32_sysent.c index 98b43274e9d8..6e1ae033b765 100644 --- a/sys/compat/freebsd32/freebsd32_sysent.c +++ b/sys/compat/freebsd32/freebsd32_sysent.c @@ -669,4 +669,5 @@ struct sysent freebsd32_sysent[] = { { .sy_narg = AS(__specialfd_args), .sy_call = (sy_call_t *)sys___specialfd, .sy_auevent = AUE_SPECIALFD, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 577 = __specialfd */ { .sy_narg = AS(freebsd32_aio_writev_args), .sy_call = (sy_call_t *)freebsd32_aio_writev, .sy_auevent = AUE_AIO_WRITEV, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 578 = freebsd32_aio_writev */ { .sy_narg = AS(freebsd32_aio_readv_args), .sy_call = (sy_call_t *)freebsd32_aio_readv, .sy_auevent = AUE_AIO_READV, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 579 = freebsd32_aio_readv */ + { .sy_narg = AS(freebsd32_fspacectl_args), .sy_call = (sy_call_t *)freebsd32_fspacectl, .sy_auevent = AUE_FSPACECTL, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 580 = freebsd32_fspacectl */ }; diff --git a/sys/compat/freebsd32/freebsd32_systrace_args.c b/sys/compat/freebsd32/freebsd32_systrace_args.c index 818a34e0cdad..7c970c358296 100644 --- a/sys/compat/freebsd32/freebsd32_systrace_args.c +++ b/sys/compat/freebsd32/freebsd32_systrace_args.c @@ -3407,6 +3407,17 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) *n_args = 1; break; } + /* freebsd32_fspacectl */ + case 580: { + struct freebsd32_fspacectl_args *p = params; + iarg[0] = p->fd; /* int */ + iarg[1] = p->cmd; /* int */ + uarg[2] = (intptr_t)p->rqsr; /* const struct spacectl_range32 * */ + iarg[3] = p->flags; /* int */ + uarg[4] = (intptr_t)p->rmsr; /* struct spacectl_range32 * */ + *n_args = 5; + break; + } default: *n_args = 0; break; @@ -9183,6 +9194,28 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; }; break; + /* freebsd32_fspacectl */ + case 580: + switch (ndx) { + case 0: + p = "int"; + break; + case 1: + p = "int"; + break; + case 2: + p = "userland const struct spacectl_range32 *"; + break; + case 3: + p = "int"; + break; + case 4: + p = "userland struct spacectl_range32 *"; + break; + default: + break; + }; + break; default: break; }; @@ -11102,6 +11135,11 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) if (ndx == 0 || ndx == 1) p = "int"; break; + /* freebsd32_fspacectl */ + case 580: + if (ndx == 0 || ndx == 1) + p = "int"; + break; default: break; }; diff --git a/sys/kern/init_sysent.c b/sys/kern/init_sysent.c index bc5beb83cf3f..414b998420aa 100644 --- a/sys/kern/init_sysent.c +++ b/sys/kern/init_sysent.c @@ -635,4 +635,5 @@ struct sysent sysent[] = { { .sy_narg = AS(__specialfd_args), .sy_call = (sy_call_t *)sys___specialfd, .sy_auevent = AUE_SPECIALFD, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 577 = __specialfd */ { .sy_narg = AS(aio_writev_args), .sy_call = (sy_call_t *)sys_aio_writev, .sy_auevent = AUE_AIO_WRITEV, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 578 = aio_writev */ { .sy_narg = AS(aio_readv_args), .sy_call = (sy_call_t *)sys_aio_readv, .sy_auevent = AUE_AIO_READV, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 579 = aio_readv */ + { .sy_narg = AS(fspacectl_args), .sy_call = (sy_call_t *)sys_fspacectl, .sy_auevent = AUE_FSPACECTL, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 580 = fspacectl */ }; diff --git a/sys/kern/syscalls.c b/sys/kern/syscalls.c index 190c82dd4e5e..4d5423a28bb8 100644 --- a/sys/kern/syscalls.c +++ b/sys/kern/syscalls.c @@ -586,4 +586,5 @@ const char *syscallnames[] = { "__specialfd", /* 577 = __specialfd */ "aio_writev", /* 578 = aio_writev */ "aio_readv", /* 579 = aio_readv */ + "fspacectl", /* 580 = fspacectl */ }; diff --git a/sys/kern/systrace_args.c b/sys/kern/systrace_args.c index 8f8274b1cdac..d924e49be355 100644 --- a/sys/kern/systrace_args.c +++ b/sys/kern/systrace_args.c @@ -3399,6 +3399,17 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) *n_args = 1; break; } + /* fspacectl */ + case 580: { + struct fspacectl_args *p = params; + iarg[0] = p->fd; /* int */ + iarg[1] = p->cmd; /* int */ + uarg[2] = (intptr_t)p->rqsr; /* const struct spacectl_range * */ + iarg[3] = p->flags; /* int */ + uarg[4] = (intptr_t)p->rmsr; /* struct spacectl_range * */ + *n_args = 5; + break; + } default: *n_args = 0; break; @@ -9088,6 +9099,28 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; }; break; + /* fspacectl */ + case 580: + switch (ndx) { + case 0: + p = "int"; + break; + case 1: + p = "int"; + break; + case 2: + p = "userland const struct spacectl_range *"; + break; + case 3: + p = "int"; + break; + case 4: + p = "userland struct spacectl_range *"; + break; + default: + break; + }; + break; default: break; }; @@ -11034,6 +11067,11 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) if (ndx == 0 || ndx == 1) p = "int"; break; + /* fspacectl */ + case 580: + if (ndx == 0 || ndx == 1) + p = "int"; + break; default: break; }; diff --git a/sys/sys/syscall.h b/sys/sys/syscall.h index 950055c9559e..34c836f22ccc 100644 --- a/sys/sys/syscall.h +++ b/sys/sys/syscall.h @@ -517,4 +517,5 @@ #define SYS___specialfd 577 #define SYS_aio_writev 578 #define SYS_aio_readv 579 -#define SYS_MAXSYSCALL 580 +#define SYS_fspacectl 580 +#define SYS_MAXSYSCALL 581 diff --git a/sys/sys/syscall.mk b/sys/sys/syscall.mk index e007d2c81e61..52cc8c9a7563 100644 --- a/sys/sys/syscall.mk +++ b/sys/sys/syscall.mk @@ -422,4 +422,5 @@ MIASM = \ rpctls_syscall.o \ __specialfd.o \ aio_writev.o \ - aio_readv.o + aio_readv.o \ + fspacectl.o diff --git a/sys/sys/sysproto.h b/sys/sys/sysproto.h index f17b1951f559..cec3c1925e5d 100644 --- a/sys/sys/sysproto.h +++ b/sys/sys/sysproto.h @@ -1847,6 +1847,13 @@ struct aio_writev_args { struct aio_readv_args { char aiocbp_l_[PADL_(struct aiocb *)]; struct aiocb * aiocbp; char aiocbp_r_[PADR_(struct aiocb *)]; }; +struct fspacectl_args { + char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; + char cmd_l_[PADL_(int)]; int cmd; char cmd_r_[PADR_(int)]; + char rqsr_l_[PADL_(const struct spacectl_range *)]; const struct spacectl_range * rqsr; char rqsr_r_[PADR_(const struct spacectl_range *)]; + char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)]; + char rmsr_l_[PADL_(struct spacectl_range *)]; struct spacectl_range * rmsr; char rmsr_r_[PADR_(struct spacectl_range *)]; +}; int nosys(struct thread *, struct nosys_args *); void sys_sys_exit(struct thread *, struct sys_exit_args *); int sys_fork(struct thread *, struct fork_args *); @@ -2241,6 +2248,7 @@ int sys_rpctls_syscall(struct thread *, struct rpctls_syscall_args *); int sys___specialfd(struct thread *, struct __specialfd_args *); int sys_aio_writev(struct thread *, struct aio_writev_args *); int sys_aio_readv(struct thread *, struct aio_readv_args *); +int sys_fspacectl(struct thread *, struct fspacectl_args *); #ifdef COMPAT_43 @@ -3185,6 +3193,7 @@ int freebsd12_closefrom(struct thread *, struct freebsd12_closefrom_args *); #define SYS_AUE___specialfd AUE_SPECIALFD #define SYS_AUE_aio_writev AUE_AIO_WRITEV #define SYS_AUE_aio_readv AUE_AIO_READV +#define SYS_AUE_fspacectl AUE_FSPACECTL #undef PAD_ #undef PADL_ From owner-dev-commits-src-all@freebsd.org Thu Aug 5 15:23:39 2021 Return-Path: Delivered-To: dev-commits-src-all@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 7613366570F; Thu, 5 Aug 2021 15:23: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 4GgXSW1wC2z3GhW; Thu, 5 Aug 2021 15:23: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 D5B681CA9A; Thu, 5 Aug 2021 15:23: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 175FNcju086251; Thu, 5 Aug 2021 15:23:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 175FNcUo086250; Thu, 5 Aug 2021 15:23:38 GMT (envelope-from git) Date: Thu, 5 Aug 2021 15:23:38 GMT Message-Id: <202108051523.175FNcUo086250@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ka Ho Ng Subject: git: 245ec7651e42 - main - param.h: Bump __FreeBSD_version to 1400029 for commit 0dc332bff200 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: khng X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 245ec7651e4221043d1032fb3f82f335dc65fc7f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 15:23:39 -0000 The branch main has been updated by khng: URL: https://cgit.FreeBSD.org/src/commit/?id=245ec7651e4221043d1032fb3f82f335dc65fc7f commit 245ec7651e4221043d1032fb3f82f335dc65fc7f Author: Ka Ho Ng AuthorDate: 2021-08-04 18:35:57 +0000 Commit: Ka Ho Ng CommitDate: 2021-08-05 15:22:07 +0000 param.h: Bump __FreeBSD_version to 1400029 for commit 0dc332bff200 Commit 0dc332bff200 changes fileops layout and adds VOP_DEALLOCATE VOP call. LinuxKPI kmods and file system modules need to be rebuilt at least. Sponsored by: The FreeBSD Foundation --- 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 de7607e6f90d..f842b344e9f9 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 1400028 +#define __FreeBSD_version 1400029 /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-dev-commits-src-all@freebsd.org Thu Aug 5 15:50:08 2021 Return-Path: Delivered-To: dev-commits-src-all@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 6242B665A26; Thu, 5 Aug 2021 15:50: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 4GgY341qmcz3JHP; Thu, 5 Aug 2021 15:50: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 26F721D093; Thu, 5 Aug 2021 15:50: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 175Fo8eL018084; Thu, 5 Aug 2021 15:50:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 175Fo8qv018081; Thu, 5 Aug 2021 15:50:08 GMT (envelope-from git) Date: Thu, 5 Aug 2021 15:50:08 GMT Message-Id: <202108051550.175Fo8qv018081@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: d0bc4b466683 - main - x86_msr_op: extend the KPI to allow MSR read and single-CPU operations 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: d0bc4b466683d17b84f9acafe4c3cc746f860dbf Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 15:50:08 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=d0bc4b466683d17b84f9acafe4c3cc746f860dbf commit d0bc4b466683d17b84f9acafe4c3cc746f860dbf Author: Konstantin Belousov AuthorDate: 2021-08-02 19:52:26 +0000 Commit: Konstantin Belousov CommitDate: 2021-08-05 15:46:37 +0000 x86_msr_op: extend the KPI to allow MSR read and single-CPU operations Reivewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31386 --- sys/dev/hwpmc/hwpmc_core.c | 8 +++--- sys/x86/include/x86_var.h | 18 ++++++++++--- sys/x86/x86/cpu_machdep.c | 65 +++++++++++++++++++++++++++++++++++----------- 3 files changed, 69 insertions(+), 22 deletions(-) diff --git a/sys/dev/hwpmc/hwpmc_core.c b/sys/dev/hwpmc/hwpmc_core.c index b0773227fac7..afd587296e01 100644 --- a/sys/dev/hwpmc/hwpmc_core.c +++ b/sys/dev/hwpmc/hwpmc_core.c @@ -261,8 +261,8 @@ iaf_allocate_pmc(int cpu, int ri, struct pmc *pm, if ((cpu_stdext_feature3 & CPUID_STDEXT3_TSXFA) != 0 && !pmc_tsx_force_abort_set) { pmc_tsx_force_abort_set = true; - x86_msr_op(MSR_TSX_FORCE_ABORT, MSR_OP_RENDEZVOUS | - MSR_OP_WRITE, 1); + x86_msr_op(MSR_TSX_FORCE_ABORT, MSR_OP_RENDEZVOUS_ALL | + MSR_OP_WRITE, 1, NULL); } flags = 0; @@ -403,8 +403,8 @@ iaf_release_pmc(int cpu, int ri, struct pmc *pmc) MPASS(pmc_alloc_refs > 0); if (pmc_alloc_refs-- == 1 && pmc_tsx_force_abort_set) { pmc_tsx_force_abort_set = false; - x86_msr_op(MSR_TSX_FORCE_ABORT, MSR_OP_RENDEZVOUS | - MSR_OP_WRITE, 0); + x86_msr_op(MSR_TSX_FORCE_ABORT, MSR_OP_RENDEZVOUS_ALL | + MSR_OP_WRITE, 0, NULL); } return (0); diff --git a/sys/x86/include/x86_var.h b/sys/x86/include/x86_var.h index 983c353327fd..0fdff68638cf 100644 --- a/sys/x86/include/x86_var.h +++ b/sys/x86/include/x86_var.h @@ -154,12 +154,24 @@ int user_dbreg_trap(register_t dr6); int minidumpsys(struct dumperinfo *); struct pcb *get_pcb_td(struct thread *td); +/* + * MSR ops for x86_msr_op() + */ #define MSR_OP_ANDNOT 0x00000001 #define MSR_OP_OR 0x00000002 #define MSR_OP_WRITE 0x00000003 +#define MSR_OP_READ 0x00000004 + +/* + * Where and which execution mode + */ #define MSR_OP_LOCAL 0x10000000 -#define MSR_OP_SCHED 0x20000000 -#define MSR_OP_RENDEZVOUS 0x30000000 -void x86_msr_op(u_int msr, u_int op, uint64_t arg1); +#define MSR_OP_SCHED_ALL 0x20000000 +#define MSR_OP_SCHED_ONE 0x30000000 +#define MSR_OP_RENDEZVOUS_ALL 0x40000000 +#define MSR_OP_RENDEZVOUS_ONE 0x50000000 +#define MSR_OP_CPUID(id) ((id) << 8) + +void x86_msr_op(u_int msr, u_int op, uint64_t arg1, uint64_t *res); #endif diff --git a/sys/x86/x86/cpu_machdep.c b/sys/x86/x86/cpu_machdep.c index eb94285ad606..bfc1a697cde0 100644 --- a/sys/x86/x86/cpu_machdep.c +++ b/sys/x86/x86/cpu_machdep.c @@ -119,6 +119,7 @@ struct msr_op_arg { u_int msr; int op; uint64_t arg1; + uint64_t *res; }; static void @@ -142,33 +143,41 @@ x86_msr_op_one(void *argp) case MSR_OP_WRITE: wrmsr(a->msr, a->arg1); break; + case MSR_OP_READ: + v = rdmsr(a->msr); + *a->res = v; + break; } } #define MSR_OP_EXMODE_MASK 0xf0000000 #define MSR_OP_OP_MASK 0x000000ff +#define MSR_OP_GET_CPUID(x) (((x) & ~MSR_OP_EXMODE_MASK) >> 8) void -x86_msr_op(u_int msr, u_int op, uint64_t arg1) +x86_msr_op(u_int msr, u_int op, uint64_t arg1, uint64_t *res) { struct thread *td; struct msr_op_arg a; + cpuset_t set; u_int exmode; - int bound_cpu, i, is_bound; + int bound_cpu, cpu, i, is_bound; a.op = op & MSR_OP_OP_MASK; MPASS(a.op == MSR_OP_ANDNOT || a.op == MSR_OP_OR || - a.op == MSR_OP_WRITE); + a.op == MSR_OP_WRITE || a.op == MSR_OP_READ); exmode = op & MSR_OP_EXMODE_MASK; - MPASS(exmode == MSR_OP_LOCAL || exmode == MSR_OP_SCHED || - exmode == MSR_OP_RENDEZVOUS); + MPASS(exmode == MSR_OP_LOCAL || exmode == MSR_OP_SCHED_ALL || + exmode == MSR_OP_SCHED_ONE || exmode == MSR_OP_RENDEZVOUS_ALL || + exmode == MSR_OP_RENDEZVOUS_ONE); a.msr = msr; a.arg1 = arg1; + a.res = res; switch (exmode) { case MSR_OP_LOCAL: x86_msr_op_one(&a); break; - case MSR_OP_SCHED: + case MSR_OP_SCHED_ALL: td = curthread; thread_lock(td); is_bound = sched_is_bound(td); @@ -183,8 +192,32 @@ x86_msr_op(u_int msr, u_int op, uint64_t arg1) sched_unbind(td); thread_unlock(td); break; - case MSR_OP_RENDEZVOUS: - smp_rendezvous(NULL, x86_msr_op_one, NULL, &a); + case MSR_OP_SCHED_ONE: + td = curthread; + cpu = MSR_OP_GET_CPUID(op); + thread_lock(td); + is_bound = sched_is_bound(td); + bound_cpu = td->td_oncpu; + if (!is_bound || bound_cpu != cpu) + sched_bind(td, cpu); + x86_msr_op_one(&a); + if (is_bound) { + if (bound_cpu != cpu) + sched_bind(td, bound_cpu); + } else { + sched_unbind(td); + } + thread_unlock(td); + break; + case MSR_OP_RENDEZVOUS_ALL: + smp_rendezvous(smp_no_rendezvous_barrier, x86_msr_op_one, + smp_no_rendezvous_barrier, &a); + break; + case MSR_OP_RENDEZVOUS_ONE: + cpu = MSR_OP_GET_CPUID(op); + CPU_SETOF(cpu, &set); + smp_rendezvous_cpus(set, smp_no_rendezvous_barrier, + x86_msr_op_one, smp_no_rendezvous_barrier, &a); break; } } @@ -872,9 +905,9 @@ hw_ibrs_recalculate(bool for_all_cpus) { if ((cpu_ia32_arch_caps & IA32_ARCH_CAP_IBRS_ALL) != 0) { x86_msr_op(MSR_IA32_SPEC_CTRL, (for_all_cpus ? - MSR_OP_RENDEZVOUS : MSR_OP_LOCAL) | + MSR_OP_RENDEZVOUS_ALL : MSR_OP_LOCAL) | (hw_ibrs_disable != 0 ? MSR_OP_ANDNOT : MSR_OP_OR), - IA32_SPEC_CTRL_IBRS); + IA32_SPEC_CTRL_IBRS, NULL); hw_ibrs_active = hw_ibrs_disable == 0; hw_ibrs_ibpb_active = 0; } else { @@ -930,7 +963,8 @@ hw_ssb_set(bool enable, bool for_all_cpus) hw_ssb_active = enable; x86_msr_op(MSR_IA32_SPEC_CTRL, (enable ? MSR_OP_OR : MSR_OP_ANDNOT) | - (for_all_cpus ? MSR_OP_SCHED : MSR_OP_LOCAL), IA32_SPEC_CTRL_SSBD); + (for_all_cpus ? MSR_OP_SCHED_ALL : MSR_OP_LOCAL), + IA32_SPEC_CTRL_SSBD, NULL); } void @@ -1221,8 +1255,9 @@ taa_set(bool enable, bool all) x86_msr_op(MSR_IA32_TSX_CTRL, (enable ? MSR_OP_OR : MSR_OP_ANDNOT) | - (all ? MSR_OP_RENDEZVOUS : MSR_OP_LOCAL), - IA32_TSX_CTRL_RTM_DISABLE | IA32_TSX_CTRL_TSX_CPUID_CLEAR); + (all ? MSR_OP_RENDEZVOUS_ALL : MSR_OP_LOCAL), + IA32_TSX_CTRL_RTM_DISABLE | IA32_TSX_CTRL_TSX_CPUID_CLEAR, + NULL); } void @@ -1386,8 +1421,8 @@ x86_rngds_mitg_recalculate(bool all_cpus) return; x86_msr_op(MSR_IA32_MCU_OPT_CTRL, (x86_rngds_mitg_enable ? MSR_OP_OR : MSR_OP_ANDNOT) | - (all_cpus ? MSR_OP_RENDEZVOUS : MSR_OP_LOCAL), - IA32_RNGDS_MITG_DIS); + (all_cpus ? MSR_OP_RENDEZVOUS_ALL : MSR_OP_LOCAL), + IA32_RNGDS_MITG_DIS, NULL); } static int From owner-dev-commits-src-all@freebsd.org Thu Aug 5 15:50:09 2021 Return-Path: Delivered-To: dev-commits-src-all@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 6A96666600C; Thu, 5 Aug 2021 15:50: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 4GgY352QNWz3JFB; Thu, 5 Aug 2021 15:50: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 3BCBE1CCEC; Thu, 5 Aug 2021 15:50: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 175Fo9U5018300; Thu, 5 Aug 2021 15:50:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 175Fo9GA018298; Thu, 5 Aug 2021 15:50:09 GMT (envelope-from git) Date: Thu, 5 Aug 2021 15:50:09 GMT Message-Id: <202108051550.175Fo9GA018298@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: 4cc6fe1e5b73 - main - coretemp: use x86_msr_op for thermal MSR access 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: 4cc6fe1e5b73ce540882753d918bc8208849e9e9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 15:50:09 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=4cc6fe1e5b73ce540882753d918bc8208849e9e9 commit 4cc6fe1e5b73ce540882753d918bc8208849e9e9 Author: Konstantin Belousov AuthorDate: 2021-08-02 19:53:08 +0000 Commit: Konstantin Belousov CommitDate: 2021-08-05 15:47:07 +0000 coretemp: use x86_msr_op for thermal MSR access Reviewed by: markj Discussed with: mav Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31386 --- sys/dev/coretemp/coretemp.c | 57 +++++++++++++-------------------------------- 1 file changed, 16 insertions(+), 41 deletions(-) diff --git a/sys/dev/coretemp/coretemp.c b/sys/dev/coretemp/coretemp.c index 53a2434254f6..bdc71b284ac7 100644 --- a/sys/dev/coretemp/coretemp.c +++ b/sys/dev/coretemp/coretemp.c @@ -315,56 +315,31 @@ struct coretemp_args { uint64_t val; }; -static void -coretemp_rdmsr(void *arg) -{ - struct coretemp_args *args = arg; - - args->val = rdmsr(args->msr); -} - -static void -coretemp_wrmsr(void *arg) -{ - struct coretemp_args *args = arg; - - wrmsr(args->msr, args->val); -} - +/* + * The digital temperature reading is located at bit 16 + * of MSR_THERM_STATUS. + * + * There is a bit on that MSR that indicates whether the + * temperature is valid or not. + * + * The temperature is computed by subtracting the temperature + * reading by Tj(max). + */ static uint64_t coretemp_get_thermal_msr(int cpu) { - struct coretemp_args args; - cpuset_t cpus; + uint64_t res; - /* - * The digital temperature reading is located at bit 16 - * of MSR_THERM_STATUS. - * - * There is a bit on that MSR that indicates whether the - * temperature is valid or not. - * - * The temperature is computed by subtracting the temperature - * reading by Tj(max). - */ - args.msr = MSR_THERM_STATUS; - CPU_SETOF(cpu, &cpus); - smp_rendezvous_cpus(cpus, smp_no_rendezvous_barrier, coretemp_rdmsr, - smp_no_rendezvous_barrier, &args); - return (args.val); + x86_msr_op(MSR_THERM_STATUS, MSR_OP_RENDEZVOUS_ONE | MSR_OP_READ | + MSR_OP_CPUID(cpu), 0, &res); + return (res); } static void coretemp_clear_thermal_msr(int cpu) { - struct coretemp_args args; - cpuset_t cpus; - - args.msr = MSR_THERM_STATUS; - args.val = 0; - CPU_SETOF(cpu, &cpus); - smp_rendezvous_cpus(cpus, smp_no_rendezvous_barrier, coretemp_wrmsr, - smp_no_rendezvous_barrier, &args); + x86_msr_op(MSR_THERM_STATUS, MSR_OP_RENDEZVOUS_ONE | MSR_OP_WRITE | + MSR_OP_CPUID(cpu), 0, NULL); } static int From owner-dev-commits-src-all@freebsd.org Thu Aug 5 16:00:17 2021 Return-Path: Delivered-To: dev-commits-src-all@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 7201B665FE3; Thu, 5 Aug 2021 16:00:17 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-il1-f174.google.com (mail-il1-f174.google.com [209.85.166.174]) (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 4GgYGn2cwVz3KvS; Thu, 5 Aug 2021 16:00:17 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-il1-f174.google.com with SMTP id k3so5632553ilu.2; Thu, 05 Aug 2021 09:00:17 -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=lRuXnnximghH+2nht3beOfR/L1VEF+U6w+vRGnIzBqM=; b=qahyFhqqncGcgFpxwmICg8p4vFnaV/VG+2G1cTCX+rm0d2mVP4O00rs4bJwu/r21eY A9wqxb3jwOgn80V7K8/28Ul8hDU3c8zUpAsEnjZ9o9GnShJsX9wWRYdBJPIfqhztxh2S zUd65nSl9lRcG1mVcnDhs8H9WhQENXWblO7J97bLuyKEA526p2AxbBp9lKbGCLoNS588 9K9M222D5lepoGfximnYBMjmyFbvEIV6Yk20U40kYq35gBt1VeeX193V+BnLELnfyioh 8jmCmrXfavhJ9xgtoxmBubZSUmcb4c4Uvjaw2WzUKTzoxCjr4xSD2PJRmnG1lZQcLHdI yZkA== X-Gm-Message-State: AOAM530/5bIezyCfrJThFhttH6utFf3RTUtafBfNg5ds83jHV4Io6e+s ugf+CAudjbaVU2Zo/+cXWM3TNx6Muz+qV3CuezcX2ek0S9Q= X-Google-Smtp-Source: ABdhPJxh7tkoc4fG4mgM6mop4RlHTHCgYJRPegiaNdEEszZG5Q6Y2qDs3vnjLK8x9YMISiruiQ1k/Pu0IY+IloYs7Fs= X-Received: by 2002:a92:cacd:: with SMTP id m13mr370800ilq.256.1628179210959; Thu, 05 Aug 2021 09:00:10 -0700 (PDT) MIME-Version: 1.0 References: <202108051422.175EMBpP006556@gitrepo.freebsd.org> In-Reply-To: <202108051422.175EMBpP006556@gitrepo.freebsd.org> From: Ed Maste Date: Thu, 5 Aug 2021 11:59:53 -0400 Message-ID: Subject: Re: git: 98215005b747 - main - ktls: start a thread to keep the 16k ktls buffer zone populated To: Andrew Gallatin Cc: src-committers , "" , dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4GgYGn2cwVz3KvS 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 16:00:17 -0000 On Thu, 5 Aug 2021 at 10:22, Andrew Gallatin wrote: > > The branch main has been updated by gallatin: > > URL: https://cgit.FreeBSD.org/src/commit/?id=98215005b747fef67f44794ca64abd473b98bade > > commit 98215005b747fef67f44794ca64abd473b98bade > Author: Andrew Gallatin > AuthorDate: 2021-08-05 14:15:09 +0000 > Commit: Andrew Gallatin > CommitDate: 2021-08-05 14:19:12 +0000 > > ktls: start a thread to keep the 16k ktls buffer zone populated My Cirrus-CI boot smoke test is now failing with: Starting KTLS alloc thread for domain 0 panic: sleeping without a lock cpuid = 0 time = 1 KDB: stack backtrace: db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe0000b20ae0 vpanic() at vpanic+0x187/frame 0xfffffe0000b20b40 panic() at panic+0x43/frame 0xfffffe0000b20ba0 _sleep() at _sleep+0x484/frame 0xfffffe0000b20c40 ktls_alloc_thread() at ktls_alloc_thread+0x1c4/frame 0xfffffe0000b20cf0 fork_exit() at fork_exit+0x80/frame 0xfffffe0000b20d30 fork_trampoline() at fork_trampoline+0xe/frame 0xfffffe0000b20d30 --- trap 0, rip = 0, rsp = 0, rbp = 0 --- KDB: enter: panic [ thread pid 2 tid 100027 ] Stopped at kdb_enter+0x37: movq $0,0x127877e(%rip) db> qemu-system-x86_64: terminating on signal 15 from pid 32579 (timeout) Did not boot successfully, see /tmp/ci-qemu-test-boot.log From owner-dev-commits-src-all@freebsd.org Thu Aug 5 16:52:21 2021 Return-Path: Delivered-To: dev-commits-src-all@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 801EF6669BA; Thu, 5 Aug 2021 16:52:21 +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 4GgZQs2rjLz3NqF; Thu, 5 Aug 2021 16:52:21 +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 4DFF12700137; Thu, 5 Aug 2021 12:52:15 -0400 (EDT) DMARC-Filter: OpenDMARC Filter v1.3.1 duke.cs.duke.edu 4DFF12700137 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=cs.duke.edu; s=mail0816; t=1628182335; bh=Ksg4Hdvv9K4OMkSjrReb686FZ2ippIK4LIHBjpjwwEY=; h=Subject:To:From:Date:From; b=EwGDRwIyvH2Awm1edHGwfrmkQBQSLTLd0CgC1lJxx1Z5VILWLjWnalXNpAR5wEsou 1I7l9YHrmaU3qsFyoGyOJ+sVTuSvoVTOJu0k323GmmhO9Xw5s+LY3+mTzYC4BGorCp rjFStkt8/UxfyhLlccodzzA04pX1eV37rTKeeLfcadSlgnwKXwPJqDuQWSQdZesD8I ShjLezPl0spJNNWrQzfatDYcXH01NJY3QylBnV+3Dc7QsDkmuHYmlC35KtPoLsFvyv LoQizmUJMmUH1QaIHJKe9I8lhWvahhHnn3G79a9LgVvK6N3UaE61AsJywHSHNGU7pC 3YmtD1Zn6zI1A== Subject: Re: git: 98215005b747 - main - ktls: start a thread to keep the 16k ktls buffer zone populated To: Ed Maste , Andrew Gallatin Cc: src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org References: <202108051422.175EMBpP006556@gitrepo.freebsd.org> From: Andrew Gallatin Message-ID: Date: Thu, 5 Aug 2021 12:52:14 -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: 4GgZQs2rjLz3NqF 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 16:52:21 -0000 On 8/5/21 11:59 AM, Ed Maste wrote: > On Thu, 5 Aug 2021 at 10:22, Andrew Gallatin wrote: >> >> The branch main has been updated by gallatin: >> >> URL: https://urldefense.com/v3/__https://cgit.FreeBSD.org/src/commit/?id=98215005b747fef67f44794ca64abd473b98bade__;!!OToaGQ!6H22s_lcYmkhuynvYHpkyGHe143j9dOq8CYazaDqtTi9kyapeu9DMyf0Tvo0tDDCVw$ >> >> commit 98215005b747fef67f44794ca64abd473b98bade >> Author: Andrew Gallatin >> AuthorDate: 2021-08-05 14:15:09 +0000 >> Commit: Andrew Gallatin >> CommitDate: 2021-08-05 14:19:12 +0000 >> >> ktls: start a thread to keep the 16k ktls buffer zone populated > > My Cirrus-CI boot smoke test is now failing with: > > Starting KTLS alloc thread for domain 0 > panic: sleeping without a lock > cpuid = 0 > time = 1 > KDB: stack backtrace: > db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe0000b20ae0 > vpanic() at vpanic+0x187/frame 0xfffffe0000b20b40 > panic() at panic+0x43/frame 0xfffffe0000b20ba0 > _sleep() at _sleep+0x484/frame 0xfffffe0000b20c40 > ktls_alloc_thread() at ktls_alloc_thread+0x1c4/frame 0xfffffe0000b20cf0 > fork_exit() at fork_exit+0x80/frame 0xfffffe0000b20d30 > fork_trampoline() at fork_trampoline+0xe/frame 0xfffffe0000b20d30 > --- trap 0, rip = 0, rsp = 0, rbp = 0 --- > KDB: enter: panic > [ thread pid 2 tid 100027 ] > Stopped at kdb_enter+0x37: movq $0,0x127877e(%rip) > db> qemu-system-x86_64: terminating on signal 15 from pid 32579 (timeout) > Did not boot successfully, see /tmp/ci-qemu-test-boot.log > I'd thought that I'd tested this with INVARIANTS, but I guess I was wrong. The assert is failing because I'm sleeping forever (sbt == 0). I don't understand the point of the assert, but I've reproduced the panic and am testing a workaround. Drew From owner-dev-commits-src-all@freebsd.org Thu Aug 5 17:10:25 2021 Return-Path: Delivered-To: dev-commits-src-all@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 8C86066740D; Thu, 5 Aug 2021 17:10:25 +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 4GgZqj3bwkz3Pny; Thu, 5 Aug 2021 17:10: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 5D4FE1E18E; Thu, 5 Aug 2021 17:10: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 175HAPLI031062; Thu, 5 Aug 2021 17:10:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 175HAP1D031061; Thu, 5 Aug 2021 17:10:25 GMT (envelope-from git) Date: Thu, 5 Aug 2021 17:10:25 GMT Message-Id: <202108051710.175HAP1D031061@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: 2694c869ff9f - main - ktls: fix a panic with INVARIANTS 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: 2694c869ff9ff60fd8e3d4d7936b7dc61763c18a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 17:10:25 -0000 The branch main has been updated by gallatin: URL: https://cgit.FreeBSD.org/src/commit/?id=2694c869ff9ff60fd8e3d4d7936b7dc61763c18a commit 2694c869ff9ff60fd8e3d4d7936b7dc61763c18a Author: Andrew Gallatin AuthorDate: 2021-08-05 17:05:00 +0000 Commit: Andrew Gallatin CommitDate: 2021-08-05 17:09:06 +0000 ktls: fix a panic with INVARIANTS 98215005b747fef67f44794ca64abd473b98bade introduced a new thread that uses tsleep(..0) to sleep forever. This hit an assert due to sleeping with a 0 timeout. So spell "forever" using SBT_MAX instead, which does not trigger the assert. Pointy hat to: gallatin Pointed out by: emaste Sponsored by: Netflix --- sys/kern/uipc_ktls.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/uipc_ktls.c b/sys/kern/uipc_ktls.c index 17b87195fc50..47815c266667 100644 --- a/sys/kern/uipc_ktls.c +++ b/sys/kern/uipc_ktls.c @@ -2240,7 +2240,7 @@ ktls_alloc_thread(void *ctx) nbufs = 0; for (;;) { atomic_store_int(&sc->running, 0); - tsleep(sc, PZERO, "waiting for work", 0); + tsleep_sbt(sc, PZERO, "waiting for work", SBT_MAX, SBT_1S, 0); atomic_store_int(&sc->running, 1); sc->wakeups++; if (nbufs != ktls_max_alloc) { From owner-dev-commits-src-all@freebsd.org Thu Aug 5 17:33:37 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A073F667AD9; Thu, 5 Aug 2021 17:33:37 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-io1-f41.google.com (mail-io1-f41.google.com [209.85.166.41]) (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 4GgbLT3mPRz3Qsq; Thu, 5 Aug 2021 17:33:37 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-io1-f41.google.com with SMTP id z7so7699871iog.13; Thu, 05 Aug 2021 10:33:37 -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=Za93dnmiNmSJp0S3SSxmyUWTgEw9qCT6Q2GwrpsQOmA=; b=CUftiGI6vY231NEUXWaw7SCP55Bo5GJu7OyADMlKbxG9Zj57A4PUiY228MNlzPPPoJ SHf3eZCuKHzChHIVcvoCMp+7cDt6MQbKnSpQMZRb1i6EXkyBVPYw7f0ePRcRNqNefKsO pYiz67lXaiQJs8/+6fBqkxDbOpvy8wIOrVxU9j/ehrWAHEJFZzH19h2mLv7f6xsawLO+ J9TUMjiSO2MeJlVaLnjluu9HREnzbw9esE8U8bZaMJCNSs8nokAGiZrPyHvix9G2sw7D 7YQC3YC5ygkGTdxXtEoCSTDYP72G5uKYvDwtE1nIw4zH9g0oZWr19liIVGRCX+Fdgu/1 +mhg== X-Gm-Message-State: AOAM533rJtk4M4DNCWOP8UiXjNIOIvrVPQvvCQiPhu3HWyeN4h/8tkcW QDL0PVnSbUNKk5seZoPJYik20tT9Kkl3HK/FtCeqK4em X-Google-Smtp-Source: ABdhPJwtZD7Ozxt3847b4GWBsTy4tRdALlbLYC3VhjYHHVxfvy1XVeD/FE+Nj7vRR+ldTP2sYc/A6Sq8ONe7tuIb5js= X-Received: by 2002:a5d:9655:: with SMTP id d21mr312398ios.111.1628184810303; Thu, 05 Aug 2021 10:33:30 -0700 (PDT) MIME-Version: 1.0 References: <202108051710.175HAP1D031061@gitrepo.freebsd.org> In-Reply-To: <202108051710.175HAP1D031061@gitrepo.freebsd.org> From: Ed Maste Date: Thu, 5 Aug 2021 13:33:12 -0400 Message-ID: Subject: Re: git: 2694c869ff9f - main - ktls: fix a panic with INVARIANTS To: Andrew Gallatin Cc: src-committers , "" , dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4GgbLT3mPRz3Qsq 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 17:33:37 -0000 On Thu, 5 Aug 2021 at 13:10, Andrew Gallatin wrote: > > The branch main has been updated by gallatin: > > URL: https://cgit.FreeBSD.org/src/commit/?id=2694c869ff9ff60fd8e3d4d7936b7dc61763c18a > > commit 2694c869ff9ff60fd8e3d4d7936b7dc61763c18a > Author: Andrew Gallatin > AuthorDate: 2021-08-05 17:05:00 +0000 > Commit: Andrew Gallatin > CommitDate: 2021-08-05 17:09:06 +0000 > > ktls: fix a panic with INVARIANTS Thanks for the quick fix. From owner-dev-commits-src-all@freebsd.org Thu Aug 5 17:41:58 2021 Return-Path: Delivered-To: dev-commits-src-all@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 424B766793A for ; Thu, 5 Aug 2021 17:41:58 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound2o.ore.mailhop.org (outbound2o.ore.mailhop.org [54.187.213.119]) (using TLSv1.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 4GgbX56Vspz3h90 for ; Thu, 5 Aug 2021 17:41:57 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1628185311; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=dCziVoFTMSWKLoe06vSNsSXvvEB6RPRGu5/n90bMfpGKIDss1tub8+PFybLSnFycF4U0slte7rPB3 BuDCLYrHbk1ITFgMXiq28Pgg12hBxo0e6EzD9FnnwW89ZEo9aRH13BPBaHL1hhjsqmfCboCBEEOmke SJvdLY+PW5plLxXGcxdv5QFkz931HYTl59vG18YFn/p1Z5KfNrBCpBZBdfGCFa0fFq0TD2w6oNBQ5n jqrDZ7ypSTG734hySndWMBnOmrPUn3HW77hniMW/g+3avsnwHOu/JsDI6SVpBF9dFpBboNCePCwDM2 0/5ITt/X3SM1uqftjprwyrjcF/m2XdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:dkim-signature:from; bh=8xad6Q1P38YW/K6tdXzN+cLrcAf+M8sm5hlFeoJKZXo=; b=D7fkIHzxGgjFqJs1Pzmpcc959b8rTjVW/pzyyJOaVpoKO4rG8QxGdX4pgM/bDRFnBe94c0ILnE/JF fXZ2PXgbsx+Lh2BrqYg9fkLJS6OhRmfjfLPN2JjmMcnCYrLxtCtyOlrgyp5cD3sweGUXx7pVmYCRKz qE1rPwAixKxBPXwvRmCvk6sUQU09gkiCtNy0ThJluR/Nc9mIh7oBRL8uJq8Vnk4QwHYULk7BvlDxQg e5/pSu3sByYMAgzYPd7sjXUczDgm6OrJ2Xn5hRamZyDXcF4ZbsyXJLvTSnNWNoT8vYrr6JYH3DX9F0 yGIHGVOmJXoRVx/voqia1kT9jDYIK/A== ARC-Authentication-Results: i=1; outbound4.ore.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=67.177.211.60; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:from; bh=8xad6Q1P38YW/K6tdXzN+cLrcAf+M8sm5hlFeoJKZXo=; b=D89lPYv9jHyedehI8iEhXvM12q5Z6NkLpcWkcucqsyolYHxbDMvDNaDTzeIVeLrUT/2ZFHz2bQuV0 D1V8S6tNehZbcwNx2j99o2f56Kn05t39zt4s3SeDwCxWFGHKbE7YazvyRrFu7WePyLfwzkwSN12R5R NAxiYs0++bFRz9iFsHGA93gFE5Zi5dOFTj+xO/xgXKSEOYeFM3v0bhnPrAauBlZv1Bv5HX9WuQ1RWK i5F6X4GFFv6SJuEf3bv2MzoOzB6C7oiLfIpASnoawGk6NSxfT/AhQFAVcXnK+bOiOmCQa8M/acT01N Vljr7WzDgNS3p1GxQu+ew+eTFniqN7Q== X-Originating-IP: 67.177.211.60 X-MHO-RoutePath: aGlwcGll X-MHO-User: 692b7e57-f614-11eb-a658-89389772cfc7 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (c-67-177-211-60.hsd1.co.comcast.net [67.177.211.60]) by outbound4.ore.mailhop.org (Halon) with ESMTPSA id 692b7e57-f614-11eb-a658-89389772cfc7; Thu, 05 Aug 2021 17:41:49 +0000 (UTC) Received: from [172.22.42.84] (rev2.hippie.lan [172.22.42.84]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id 175HfmhW085229; Thu, 5 Aug 2021 11:41:48 -0600 (MDT) (envelope-from ian@freebsd.org) X-Authentication-Warning: paranoia.hippie.lan: Host rev2.hippie.lan [172.22.42.84] claimed to be [172.22.42.84] Message-ID: <1013cb35c9a2c3cc55b4f3bd10d14b1540c9462f.camel@freebsd.org> Subject: Re: git: 2694c869ff9f - main - ktls: fix a panic with INVARIANTS From: Ian Lepore To: Andrew Gallatin , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Date: Thu, 05 Aug 2021 11:41:48 -0600 In-Reply-To: <202108051710.175HAP1D031061@gitrepo.freebsd.org> References: <202108051710.175HAP1D031061@gitrepo.freebsd.org> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.40.3 FreeBSD GNOME Team MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4GgbX56Vspz3h90 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 17:41:58 -0000 On Thu, 2021-08-05 at 17:10 +0000, Andrew Gallatin wrote: > The branch main has been updated by gallatin: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=2694c869ff9ff60fd8e3d4d7936b7dc61763c18a > > commit 2694c869ff9ff60fd8e3d4d7936b7dc61763c18a > Author:     Andrew Gallatin > AuthorDate: 2021-08-05 17:05:00 +0000 > Commit:     Andrew Gallatin > CommitDate: 2021-08-05 17:09:06 +0000 > >     ktls: fix a panic with INVARIANTS >     >     98215005b747fef67f44794ca64abd473b98bade introduced a new >     thread that uses tsleep(..0) to sleep forever.  This hit >     an assert due to sleeping with a 0 timeout. >     >     So spell "forever" using SBT_MAX instead, which does not >     trigger the assert. >     >     Pointy hat to: gallatin >     Pointed out by: emaste >     Sponsored by: Netflix > --- >  sys/kern/uipc_ktls.c | 2 +- >  1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/sys/kern/uipc_ktls.c b/sys/kern/uipc_ktls.c > index 17b87195fc50..47815c266667 100644 > --- a/sys/kern/uipc_ktls.c > +++ b/sys/kern/uipc_ktls.c > @@ -2240,7 +2240,7 @@ ktls_alloc_thread(void *ctx) >         nbufs = 0; >         for (;;) { >                 atomic_store_int(&sc->running, 0); > -               tsleep(sc, PZERO, "waiting for work", 0); > +               tsleep_sbt(sc, PZERO, "waiting for work", SBT_MAX, > SBT_1S, 0); >                 atomic_store_int(&sc->running, 1); >                 sc->wakeups++; >                 if (nbufs != ktls_max_alloc) { Finding a different way to spell "forever" is not a valid way to fix a problem where you're being warned that it is not safe to sleep forever. The assert was warning you that the code was vulnerable to hanging forever due to a missed wakeup. The code is still vulnerable to that, but now the problem is hidden and will be very difficult to find (more so because the wait message also violates the convention of using a short name that can be displayed by tools such as ps(1) and SIGINFO, where the wait-channel display is currently likely to show as "waitin"). I haven't looked at the code outside of the few lines shown in the commit diff, but based on the names involved, I suspect the right fix is to protect sc->running with a mutex and use msleep() instead of trying to roll-your-own with atomics. That would certainly be true if the wakeup code is some form of "if (!sc->running) wakeup(sc);" -- Ian From owner-dev-commits-src-all@freebsd.org Thu Aug 5 17:46:26 2021 Return-Path: Delivered-To: dev-commits-src-all@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 BE06C667C8A; Thu, 5 Aug 2021 17:46:26 +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 4GgbdG3SK9z3hgp; Thu, 5 Aug 2021 17:46:26 +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 D66062700137; Thu, 5 Aug 2021 13:46:25 -0400 (EDT) DMARC-Filter: OpenDMARC Filter v1.3.1 duke.cs.duke.edu D66062700137 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=cs.duke.edu; s=mail0816; t=1628185586; bh=y7n+r9JdomK31h/wi2srOGwsiANpX5UxKlJG5qUgR3s=; h=Subject:To:From:Date:From; b=J0tR06V5iro1Zgb2Xu3UKLMD30uf2wG+F8CRuZgPmpDGhfIFAOFSEfgySYiJwdzRR b+h4bx8UlNhhenY7vfdAVQFUYG84uoRB8SArnIOMlCsSkgz2bEX2taOBrwWqtVd9yG k6s5LPdV1aOtLMhPz2fdPv/SkHb4TVXW7+hjK2dbxVO5q5J6Yy9S9Hs9MssVb7f/ug /Nwec8LZpf+uLmbdA2s53AOvhGf/KOzGYkQmZutJGQMNKZUiIElocYmv31xD7YXO7N +okq8UNFfNiKrL7MVw4arDc/isvMzf0wnxpJ+jClRU6hxmO9e5OIBnATuVwfIZbGeo AiH35x0rn6vsg== Subject: Re: git: 2694c869ff9f - main - ktls: fix a panic with INVARIANTS To: Ian Lepore , Andrew Gallatin , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202108051710.175HAP1D031061@gitrepo.freebsd.org> <1013cb35c9a2c3cc55b4f3bd10d14b1540c9462f.camel@freebsd.org> From: Andrew Gallatin Message-ID: <69995f5d-9228-f956-aef5-d3cd4a4caa3d@cs.duke.edu> Date: Thu, 5 Aug 2021 13:46:25 -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: <1013cb35c9a2c3cc55b4f3bd10d14b1540c9462f.camel@freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4GgbdG3SK9z3hgp 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 17:46:26 -0000 On 8/5/21 1:41 PM, Ian Lepore wrote:       if (nbufs != ktls_max_alloc) { > > Finding a different way to spell "forever" is not a valid way to fix a > problem where you're being warned that it is not safe to sleep forever. > > The assert was warning you that the code was vulnerable to hanging > forever due to a missed wakeup. The code is still vulnerable to that, > but now the problem is hidden and will be very difficult to find (more > so because the wait message also violates the convention of using a > short name that can be displayed by tools such as ps(1) and SIGINFO, > where the wait-channel display is currently likely to show as > "waitin"). > > I haven't looked at the code outside of the few lines shown in the > commit diff, but based on the names involved, I suspect the right fix > is to protect sc->running with a mutex and use msleep() instead of > trying to roll-your-own with atomics. That would certainly be true if > the wakeup code is some form of "if (!sc->running) wakeup(sc);" > > -- Ian > The code is a case where a missing wakeup does not matter. The thread is woken up by an allocation failure, which are themselves rate-limited to one attempt per second (since failures are expensive, and there is a less expensive fallback). So the worst thing that can happen is that we wait at most an extra second. Adding a mutex adds nothing except unneeded complexity. Drew From owner-dev-commits-src-all@freebsd.org Thu Aug 5 18:37:41 2021 Return-Path: Delivered-To: dev-commits-src-all@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 3B20866848D; Thu, 5 Aug 2021 18:37: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 4GgcmP10RRz3mNR; Thu, 5 Aug 2021 18:37: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 0A97E1F3B5; Thu, 5 Aug 2021 18:37: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 175Ibe52043875; Thu, 5 Aug 2021 18:37:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 175IbeLh043874; Thu, 5 Aug 2021 18:37:40 GMT (envelope-from git) Date: Thu, 5 Aug 2021 18:37:40 GMT Message-Id: <202108051837.175IbeLh043874@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ceri Davies Subject: git: 383dbdb2ebff - main - fork.2: correct minor typo in manpage. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ceri X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 383dbdb2ebffabf8c0efadd8928f8ef3e45ab9e5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 18:37:41 -0000 The branch main has been updated by ceri (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=383dbdb2ebffabf8c0efadd8928f8ef3e45ab9e5 commit 383dbdb2ebffabf8c0efadd8928f8ef3e45ab9e5 Author: Ceri Davies AuthorDate: 2021-08-05 18:36:33 +0000 Commit: Ceri Davies CommitDate: 2021-08-05 18:36:33 +0000 fork.2: correct minor typo in manpage. --- lib/libc/sys/fork.2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libc/sys/fork.2 b/lib/libc/sys/fork.2 index bf934d166b03..d841b0bc38e1 100644 --- a/lib/libc/sys/fork.2 +++ b/lib/libc/sys/fork.2 @@ -150,7 +150,7 @@ Upon successful completion, and .Fn _Fork return a value -of 0 to the child process and returns the process ID of the child +of 0 to the child process and return the process ID of the child process to the parent process. Otherwise, a value of -1 is returned to the parent process, no child process is created, and the global From owner-dev-commits-src-all@freebsd.org Thu Aug 5 18:49:27 2021 Return-Path: Delivered-To: dev-commits-src-all@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 77D696688B3; Thu, 5 Aug 2021 18:49:27 +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 4Ggd1z2VcBz3nGK; Thu, 5 Aug 2021 18:49:27 +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 6DC8A2602DE; Thu, 5 Aug 2021 20:49:20 +0200 (CEST) Subject: Re: git: 2694c869ff9f - main - ktls: fix a panic with INVARIANTS To: Andrew Gallatin , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202108051710.175HAP1D031061@gitrepo.freebsd.org> From: Hans Petter Selasky Message-ID: Date: Thu, 5 Aug 2021 20:49:10 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: <202108051710.175HAP1D031061@gitrepo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4Ggd1z2VcBz3nGK 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 18:49:27 -0000 On 8/5/21 7:10 PM, Andrew Gallatin wrote: > + tsleep_sbt(sc, PZERO, "waiting for work", SBT_MAX, SBT_1S, 0); Hi, This basically puts a useless callout into the timer subsystem forever. I think if you don't care about this tsleep being accurate, then lock Giant and use sbt = 0. In between, I think that assert in question should be updated. --HPS From owner-dev-commits-src-all@freebsd.org Thu Aug 5 18:52:34 2021 Return-Path: Delivered-To: dev-commits-src-all@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 3640F668B15; Thu, 5 Aug 2021 18:52:34 +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 4Ggd5Y1J7Qz3nqb; Thu, 5 Aug 2021 18:52:33 +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)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 086422602DE; Thu, 5 Aug 2021 20:52:31 +0200 (CEST) Subject: Re: git: 2694c869ff9f - main - ktls: fix a panic with INVARIANTS From: Hans Petter Selasky To: Andrew Gallatin , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202108051710.175HAP1D031061@gitrepo.freebsd.org> Message-ID: Date: Thu, 5 Aug 2021 20:52:22 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4Ggd5Y1J7Qz3nqb X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of hps@selasky.org designates 88.99.82.50 as permitted sender) smtp.mailfrom=hps@selasky.org X-Spamd-Result: default: False [-1.61 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; R_SPF_ALLOW(-0.20)[+a:mail.turbocat.net]; DMARC_NA(0.00)[selasky.org]; NEURAL_SPAM_SHORT(0.69)[0.685]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:24940, ipnet:88.99.0.0/16, country:DE]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 18:52:34 -0000 On 8/5/21 8:49 PM, Hans Petter Selasky wrote: > On 8/5/21 7:10 PM, Andrew Gallatin wrote: >> +        tsleep_sbt(sc, PZERO, "waiting for work", SBT_MAX, SBT_1S, 0); > > Hi, > > This basically puts a useless callout into the timer subsystem forever. > I think if you don't care about this tsleep being accurate, then lock > Giant and use sbt = 0. > > In between, I think that assert in question should be updated. > > --HPS Or update the code: if (sbt != 0) sleepq_set_timeout_sbt(ident, sbt, pr, flags); Should maybe be: if (sbt > 0 && sbt < SBT_MAX) sleepq_set_timeout_sbt(ident, sbt, pr, flags); --HPS From owner-dev-commits-src-all@freebsd.org Thu Aug 5 19:20:19 2021 Return-Path: Delivered-To: dev-commits-src-all@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 5D0B7668ADF; Thu, 5 Aug 2021 19:20: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 4Ggdjb1xW9z3tsK; Thu, 5 Aug 2021 19:20: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 2AEE21F47C; Thu, 5 Aug 2021 19:20: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 175JKJOi004727; Thu, 5 Aug 2021 19:20:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 175JKJi8004720; Thu, 5 Aug 2021 19:20:19 GMT (envelope-from git) Date: Thu, 5 Aug 2021 19:20:19 GMT Message-Id: <202108051920.175JKJi8004720@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 87322a907545 - main - iscsi: Remove icl_soft-only fields from struct icl_conn. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 87322a907545fa76fbaf7949f80e85b1377a53ad Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 19:20:19 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=87322a907545fa76fbaf7949f80e85b1377a53ad commit 87322a907545fa76fbaf7949f80e85b1377a53ad Author: John Baldwin AuthorDate: 2021-08-05 19:05:30 +0000 Commit: John Baldwin CommitDate: 2021-08-05 19:05:30 +0000 iscsi: Remove icl_soft-only fields from struct icl_conn. Create a struct icl_soft_conn which extends struct icl_conn and move fields only used by icl_soft from struct icl_conn to struct icl_soft_conn. Reviewed by: mav Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D31414 --- sys/dev/cxgbe/cxgbei/icl_cxgbei.c | 11 -- sys/dev/iscsi/icl.h | 20 +--- sys/dev/iscsi/icl_soft.c | 218 ++++++++++++++++++++++---------------- 3 files changed, 128 insertions(+), 121 deletions(-) diff --git a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c index 7d8ebd1e040f..d5b13fb5c3ea 100644 --- a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c @@ -569,10 +569,6 @@ icl_cxgbei_new_conn(const char *name, struct mtx *lock) ic = &icc->ic; ic->ic_lock = lock; - /* XXXNP: review. Most of these icl_conn fields aren't really used */ - STAILQ_INIT(&ic->ic_to_send); - cv_init(&ic->ic_send_cv, "icl_cxgbei_tx"); - cv_init(&ic->ic_receive_cv, "icl_cxgbei_rx"); #ifdef DIAGNOSTIC refcount_init(&ic->ic_outstanding_pdus, 0); #endif @@ -594,9 +590,6 @@ icl_cxgbei_conn_free(struct icl_conn *ic) CTR2(KTR_CXGBE, "%s: icc %p", __func__, icc); - cv_destroy(&ic->ic_send_cv); - cv_destroy(&ic->ic_receive_cv); - mtx_destroy(&icc->cmp_lock); hashdestroy(icc->cmp_table, M_CXGBEI, icc->cmp_hash_mask); kobj_delete((struct kobj *)icc, M_CXGBE); @@ -864,10 +857,6 @@ icl_cxgbei_conn_close(struct icl_conn *ic) } ic->ic_disconnecting = true; - /* These are unused in this driver right now. */ - MPASS(STAILQ_EMPTY(&ic->ic_to_send)); - MPASS(ic->ic_receive_pdu == NULL); - #ifdef DIAGNOSTIC KASSERT(ic->ic_outstanding_pdus == 0, ("destroying session with %d outstanding PDUs", diff --git a/sys/dev/iscsi/icl.h b/sys/dev/iscsi/icl.h index 94600c0edad1..adcd580f299b 100644 --- a/sys/dev/iscsi/icl.h +++ b/sys/dev/iscsi/icl.h @@ -82,13 +82,6 @@ struct icl_pdu { void *ip_prv1; }; -#define ICL_CONN_STATE_INVALID 0 -#define ICL_CONN_STATE_BHS 1 -#define ICL_CONN_STATE_AHS 2 -#define ICL_CONN_STATE_HEADER_DIGEST 3 -#define ICL_CONN_STATE_DATA 4 -#define ICL_CONN_STATE_DATA_DIGEST 5 - #define ICL_NOCOPY (1 << 30) struct icl_conn { @@ -98,20 +91,11 @@ struct icl_conn { #ifdef DIAGNOSTIC volatile u_int ic_outstanding_pdus; #endif - STAILQ_HEAD(, icl_pdu) ic_to_send; - bool ic_check_send_space; - size_t ic_receive_len; - int ic_receive_state; - struct icl_pdu *ic_receive_pdu; - struct cv ic_send_cv; - struct cv ic_receive_cv; - bool ic_header_crc32c; - bool ic_data_crc32c; - bool ic_send_running; - bool ic_receive_running; uint32_t ic_max_recv_data_segment_length; uint32_t ic_max_send_data_segment_length; size_t ic_maxtags; + bool ic_header_crc32c; + bool ic_data_crc32c; bool ic_disconnecting; bool ic_iser; bool ic_unmapped; diff --git a/sys/dev/iscsi/icl_soft.c b/sys/dev/iscsi/icl_soft.c index 001c595af7ec..95c4c87dd6f3 100644 --- a/sys/dev/iscsi/icl_soft.c +++ b/sys/dev/iscsi/icl_soft.c @@ -63,6 +63,27 @@ __FBSDID("$FreeBSD$"); #include #include +#define ICL_CONN_STATE_BHS 1 +#define ICL_CONN_STATE_AHS 2 +#define ICL_CONN_STATE_HEADER_DIGEST 3 +#define ICL_CONN_STATE_DATA 4 +#define ICL_CONN_STATE_DATA_DIGEST 5 + +struct icl_soft_conn { + struct icl_conn ic; + + /* soft specific stuff goes here. */ + STAILQ_HEAD(, icl_pdu) to_send; + struct cv send_cv; + struct cv receive_cv; + struct icl_pdu *receive_pdu; + size_t receive_len; + int receive_state; + bool receive_running; + bool check_send_space; + bool send_running; +}; + struct icl_soft_pdu { struct icl_pdu ip; @@ -150,7 +171,7 @@ static kobj_method_t icl_soft_methods[] = { { 0, 0 } }; -DEFINE_CLASS(icl_soft, icl_soft_methods, sizeof(struct icl_conn)); +DEFINE_CLASS(icl_soft, icl_soft_methods, sizeof(struct icl_soft_conn)); static void icl_conn_fail(struct icl_conn *ic) @@ -441,14 +462,14 @@ static int icl_pdu_receive_data_segment(struct icl_pdu *request, struct mbuf **r, size_t *rs, bool *more_neededp) { - struct icl_conn *ic; + struct icl_soft_conn *isc; size_t len, padding = 0; struct mbuf *m; - ic = request->ip_conn; + isc = (struct icl_soft_conn *)request->ip_conn; *more_neededp = false; - ic->ic_receive_len = 0; + isc->receive_len = 0; len = icl_pdu_data_segment_length(request); if (len == 0) @@ -497,8 +518,7 @@ icl_pdu_receive_data_segment(struct icl_pdu *request, struct mbuf **r, ICL_DEBUG("len 0"); if (*more_neededp) - ic->ic_receive_len = - icl_pdu_data_segment_receive_len(request); + isc->receive_len = icl_pdu_data_segment_receive_len(request); return (0); } @@ -537,16 +557,17 @@ icl_pdu_check_data_digest(struct icl_pdu *request, struct mbuf **r, size_t *rs) * "part" of PDU at a time; call it repeatedly until it returns non-NULL. */ static struct icl_pdu * -icl_conn_receive_pdu(struct icl_conn *ic, struct mbuf **r, size_t *rs) +icl_conn_receive_pdu(struct icl_soft_conn *isc, struct mbuf **r, size_t *rs) { + struct icl_conn *ic = &isc->ic; struct icl_pdu *request; size_t len; int error = 0; bool more_needed; - if (ic->ic_receive_state == ICL_CONN_STATE_BHS) { - KASSERT(ic->ic_receive_pdu == NULL, - ("ic->ic_receive_pdu != NULL")); + if (isc->receive_state == ICL_CONN_STATE_BHS) { + KASSERT(isc->receive_pdu == NULL, + ("isc->receive_pdu != NULL")); request = icl_soft_conn_new_pdu(ic, M_NOWAIT); if (request == NULL) { ICL_DEBUG("failed to allocate PDU; " @@ -554,14 +575,14 @@ icl_conn_receive_pdu(struct icl_conn *ic, struct mbuf **r, size_t *rs) icl_conn_fail(ic); return (NULL); } - ic->ic_receive_pdu = request; + isc->receive_pdu = request; } else { - KASSERT(ic->ic_receive_pdu != NULL, - ("ic->ic_receive_pdu == NULL")); - request = ic->ic_receive_pdu; + KASSERT(isc->receive_pdu != NULL, + ("isc->receive_pdu == NULL")); + request = isc->receive_pdu; } - switch (ic->ic_receive_state) { + switch (isc->receive_state) { case ICL_CONN_STATE_BHS: //ICL_DEBUG("receiving BHS"); icl_soft_receive_buf(r, rs, request->ip_bhs, @@ -581,18 +602,18 @@ icl_conn_receive_pdu(struct icl_conn *ic, struct mbuf **r, size_t *rs) break; } - ic->ic_receive_state = ICL_CONN_STATE_AHS; - ic->ic_receive_len = icl_pdu_ahs_length(request); + isc->receive_state = ICL_CONN_STATE_AHS; + isc->receive_len = icl_pdu_ahs_length(request); break; case ICL_CONN_STATE_AHS: //ICL_DEBUG("receiving AHS"); icl_pdu_receive_ahs(request, r, rs); - ic->ic_receive_state = ICL_CONN_STATE_HEADER_DIGEST; + isc->receive_state = ICL_CONN_STATE_HEADER_DIGEST; if (ic->ic_header_crc32c == false) - ic->ic_receive_len = 0; + isc->receive_len = 0; else - ic->ic_receive_len = ISCSI_HEADER_DIGEST_SIZE; + isc->receive_len = ISCSI_HEADER_DIGEST_SIZE; break; case ICL_CONN_STATE_HEADER_DIGEST: @@ -604,9 +625,8 @@ icl_conn_receive_pdu(struct icl_conn *ic, struct mbuf **r, size_t *rs) break; } - ic->ic_receive_state = ICL_CONN_STATE_DATA; - ic->ic_receive_len = - icl_pdu_data_segment_receive_len(request); + isc->receive_state = ICL_CONN_STATE_DATA; + isc->receive_len = icl_pdu_data_segment_receive_len(request); break; case ICL_CONN_STATE_DATA: @@ -622,11 +642,11 @@ icl_conn_receive_pdu(struct icl_conn *ic, struct mbuf **r, size_t *rs) if (more_needed) break; - ic->ic_receive_state = ICL_CONN_STATE_DATA_DIGEST; + isc->receive_state = ICL_CONN_STATE_DATA_DIGEST; if (request->ip_data_len == 0 || ic->ic_data_crc32c == false) - ic->ic_receive_len = 0; + isc->receive_len = 0; else - ic->ic_receive_len = ISCSI_DATA_DIGEST_SIZE; + isc->receive_len = ISCSI_DATA_DIGEST_SIZE; break; case ICL_CONN_STATE_DATA_DIGEST: @@ -642,18 +662,18 @@ icl_conn_receive_pdu(struct icl_conn *ic, struct mbuf **r, size_t *rs) * We've received complete PDU; reset the receive state machine * and return the PDU. */ - ic->ic_receive_state = ICL_CONN_STATE_BHS; - ic->ic_receive_len = sizeof(struct iscsi_bhs); - ic->ic_receive_pdu = NULL; + isc->receive_state = ICL_CONN_STATE_BHS; + isc->receive_len = sizeof(struct iscsi_bhs); + isc->receive_pdu = NULL; return (request); default: - panic("invalid ic_receive_state %d\n", ic->ic_receive_state); + panic("invalid receive_state %d\n", isc->receive_state); } if (error != 0) { /* - * Don't free the PDU; it's pointed to by ic->ic_receive_pdu + * Don't free the PDU; it's pointed to by isc->receive_pdu * and will get freed in icl_soft_conn_close(). */ icl_conn_fail(ic); @@ -663,8 +683,9 @@ icl_conn_receive_pdu(struct icl_conn *ic, struct mbuf **r, size_t *rs) } static void -icl_conn_receive_pdus(struct icl_conn *ic, struct mbuf **r, size_t *rs) +icl_conn_receive_pdus(struct icl_soft_conn *isc, struct mbuf **r, size_t *rs) { + struct icl_conn *ic = &isc->ic; struct icl_pdu *response; for (;;) { @@ -675,15 +696,15 @@ icl_conn_receive_pdus(struct icl_conn *ic, struct mbuf **r, size_t *rs) * Loop until we have a complete PDU or there is not enough * data in the socket buffer. */ - if (*rs < ic->ic_receive_len) { + if (*rs < isc->receive_len) { #if 0 ICL_DEBUG("not enough data; have %zd, need %zd", - *rs, ic->ic_receive_len); + *rs, isc->receive_len); #endif return; } - response = icl_conn_receive_pdu(ic, r, rs); + response = icl_conn_receive_pdu(isc, r, rs); if (response == NULL) continue; @@ -703,14 +724,14 @@ icl_conn_receive_pdus(struct icl_conn *ic, struct mbuf **r, size_t *rs) static void icl_receive_thread(void *arg) { - struct icl_conn *ic; + struct icl_soft_conn *isc = arg; + struct icl_conn *ic = &isc->ic; size_t available, read = 0; struct socket *so; struct mbuf *m, *r = NULL; struct uio uio; int error, flags; - ic = arg; so = ic->ic_socket; for (;;) { @@ -727,9 +748,9 @@ icl_receive_thread(void *arg) * is enough data received to read the PDU. */ available = sbavail(&so->so_rcv); - if (read + available < ic->ic_receive_len) { - so->so_rcv.sb_lowat = ic->ic_receive_len - read; - cv_wait(&ic->ic_receive_cv, SOCKBUF_MTX(&so->so_rcv)); + if (read + available < isc->receive_len) { + so->so_rcv.sb_lowat = isc->receive_len - read; + cv_wait(&isc->receive_cv, SOCKBUF_MTX(&so->so_rcv)); so->so_rcv.sb_lowat = so->so_rcv.sb_hiwat + 1; available = sbavail(&so->so_rcv); } @@ -764,15 +785,15 @@ icl_receive_thread(void *arg) r = m; read += available; - icl_conn_receive_pdus(ic, &r, &read); + icl_conn_receive_pdus(isc, &r, &read); } if (r) m_freem(r); ICL_CONN_LOCK(ic); - ic->ic_receive_running = false; - cv_signal(&ic->ic_send_cv); + isc->receive_running = false; + cv_signal(&isc->send_cv); ICL_CONN_UNLOCK(ic); kthread_exit(); } @@ -780,13 +801,13 @@ icl_receive_thread(void *arg) static int icl_soupcall_receive(struct socket *so, void *arg, int waitflag) { - struct icl_conn *ic; + struct icl_soft_conn *isc; if (!soreadable(so)) return (SU_OK); - ic = arg; - cv_signal(&ic->ic_receive_cv); + isc = arg; + cv_signal(&isc->receive_cv); return (SU_OK); } @@ -846,8 +867,9 @@ icl_pdu_finalize(struct icl_pdu *request) } static void -icl_conn_send_pdus(struct icl_conn *ic, struct icl_pdu_stailq *queue) +icl_conn_send_pdus(struct icl_soft_conn *isc, struct icl_pdu_stailq *queue) { + struct icl_conn *ic = &isc->ic; struct icl_pdu *request, *request2; struct mbuf *m; struct socket *so; @@ -866,7 +888,7 @@ icl_conn_send_pdus(struct icl_conn *ic, struct icl_pdu_stailq *queue) * of error. */ available = sbspace(&so->so_snd); - ic->ic_check_send_space = false; + isc->check_send_space = false; /* * Notify the socket upcall that we don't need wakeups @@ -961,10 +983,12 @@ icl_conn_send_pdus(struct icl_conn *ic, struct icl_pdu_stailq *queue) static void icl_send_thread(void *arg) { + struct icl_soft_conn *isc; struct icl_conn *ic; struct icl_pdu_stailq queue; - ic = arg; + isc = arg; + ic = &isc->ic; STAILQ_INIT(&queue); @@ -976,18 +1000,18 @@ icl_send_thread(void *arg) * This way the icl_conn_send_pdus() can go through * all the queued PDUs without holding any locks. */ - if (STAILQ_EMPTY(&queue) || ic->ic_check_send_space) - STAILQ_CONCAT(&queue, &ic->ic_to_send); + if (STAILQ_EMPTY(&queue) || isc->check_send_space) + STAILQ_CONCAT(&queue, &isc->to_send); ICL_CONN_UNLOCK(ic); - icl_conn_send_pdus(ic, &queue); + icl_conn_send_pdus(isc, &queue); ICL_CONN_LOCK(ic); /* * The icl_soupcall_send() was called since the last * call to sbspace(); go around; */ - if (ic->ic_check_send_space) + if (isc->check_send_space) continue; /* @@ -995,7 +1019,7 @@ icl_send_thread(void *arg) * in the main one; go around. */ if (STAILQ_EMPTY(&queue) && - !STAILQ_EMPTY(&ic->ic_to_send)) + !STAILQ_EMPTY(&isc->to_send)) continue; /* @@ -1011,17 +1035,17 @@ icl_send_thread(void *arg) break; } - cv_wait(&ic->ic_send_cv, ic->ic_lock); + cv_wait(&isc->send_cv, ic->ic_lock); } /* * We're exiting; move PDUs back to the main queue, so they can * get freed properly. At this point ordering doesn't matter. */ - STAILQ_CONCAT(&ic->ic_to_send, &queue); + STAILQ_CONCAT(&isc->to_send, &queue); - ic->ic_send_running = false; - cv_signal(&ic->ic_send_cv); + isc->send_running = false; + cv_signal(&isc->send_cv); ICL_CONN_UNLOCK(ic); kthread_exit(); } @@ -1029,18 +1053,20 @@ icl_send_thread(void *arg) static int icl_soupcall_send(struct socket *so, void *arg, int waitflag) { + struct icl_soft_conn *isc; struct icl_conn *ic; if (!sowriteable(so)) return (SU_OK); - ic = arg; + isc = arg; + ic = &isc->ic; ICL_CONN_LOCK(ic); - ic->ic_check_send_space = true; + isc->check_send_space = true; ICL_CONN_UNLOCK(ic); - cv_signal(&ic->ic_send_cv); + cv_signal(&isc->send_cv); return (SU_OK); } @@ -1112,6 +1138,7 @@ static void icl_soft_conn_pdu_queue_cb(struct icl_conn *ic, struct icl_pdu *ip, icl_pdu_cb cb) { + struct icl_soft_conn *isc = (struct icl_soft_conn *)ic; struct icl_soft_pdu *isp = (struct icl_soft_pdu *)ip; ICL_CONN_LOCK_ASSERT(ic); @@ -1124,8 +1151,8 @@ icl_soft_conn_pdu_queue_cb(struct icl_conn *ic, struct icl_pdu *ip, return; } - if (!STAILQ_EMPTY(&ic->ic_to_send)) { - STAILQ_INSERT_TAIL(&ic->ic_to_send, ip, ip_next); + if (!STAILQ_EMPTY(&isc->to_send)) { + STAILQ_INSERT_TAIL(&isc->to_send, ip, ip_next); /* * If the queue is not empty, someone else had already * signaled the send thread; no need to do that again, @@ -1134,23 +1161,27 @@ icl_soft_conn_pdu_queue_cb(struct icl_conn *ic, struct icl_pdu *ip, return; } - STAILQ_INSERT_TAIL(&ic->ic_to_send, ip, ip_next); - cv_signal(&ic->ic_send_cv); + STAILQ_INSERT_TAIL(&isc->to_send, ip, ip_next); + cv_signal(&isc->send_cv); } static struct icl_conn * icl_soft_new_conn(const char *name, struct mtx *lock) { + struct icl_soft_conn *isc; struct icl_conn *ic; refcount_acquire(&icl_ncons); - ic = (struct icl_conn *)kobj_create(&icl_soft_class, M_ICL_SOFT, M_WAITOK | M_ZERO); + isc = (struct icl_soft_conn *)kobj_create(&icl_soft_class, M_ICL_SOFT, + M_WAITOK | M_ZERO); + + STAILQ_INIT(&isc->to_send); + cv_init(&isc->send_cv, "icl_tx"); + cv_init(&isc->receive_cv, "icl_rx"); - STAILQ_INIT(&ic->ic_to_send); + ic = &isc->ic; ic->ic_lock = lock; - cv_init(&ic->ic_send_cv, "icl_tx"); - cv_init(&ic->ic_receive_cv, "icl_rx"); #ifdef DIAGNOSTIC refcount_init(&ic->ic_outstanding_pdus, 0); #endif @@ -1164,21 +1195,23 @@ icl_soft_new_conn(const char *name, struct mtx *lock) void icl_soft_conn_free(struct icl_conn *ic) { + struct icl_soft_conn *isc = (struct icl_soft_conn *)ic; #ifdef DIAGNOSTIC KASSERT(ic->ic_outstanding_pdus == 0, ("destroying session with %d outstanding PDUs", ic->ic_outstanding_pdus)); #endif - cv_destroy(&ic->ic_send_cv); - cv_destroy(&ic->ic_receive_cv); - kobj_delete((struct kobj *)ic, M_ICL_SOFT); + cv_destroy(&isc->send_cv); + cv_destroy(&isc->receive_cv); + kobj_delete((struct kobj *)isc, M_ICL_SOFT); refcount_release(&icl_ncons); } static int icl_conn_start(struct icl_conn *ic) { + struct icl_soft_conn *isc = (struct icl_soft_conn *)ic; size_t minspace; struct sockopt opt; int error, one = 1; @@ -1193,8 +1226,8 @@ icl_conn_start(struct icl_conn *ic) return (EINVAL); } - ic->ic_receive_state = ICL_CONN_STATE_BHS; - ic->ic_receive_len = sizeof(struct iscsi_bhs); + isc->receive_state = ICL_CONN_STATE_BHS; + isc->receive_len = sizeof(struct iscsi_bhs); ic->ic_disconnecting = false; ICL_CONN_UNLOCK(ic); @@ -1251,25 +1284,25 @@ icl_conn_start(struct icl_conn *ic) * and free space to send outgoing ones. */ SOCKBUF_LOCK(&ic->ic_socket->so_snd); - soupcall_set(ic->ic_socket, SO_SND, icl_soupcall_send, ic); + soupcall_set(ic->ic_socket, SO_SND, icl_soupcall_send, isc); SOCKBUF_UNLOCK(&ic->ic_socket->so_snd); SOCKBUF_LOCK(&ic->ic_socket->so_rcv); - soupcall_set(ic->ic_socket, SO_RCV, icl_soupcall_receive, ic); + soupcall_set(ic->ic_socket, SO_RCV, icl_soupcall_receive, isc); SOCKBUF_UNLOCK(&ic->ic_socket->so_rcv); /* * Start threads. */ ICL_CONN_LOCK(ic); - ic->ic_send_running = ic->ic_receive_running = true; + isc->send_running = isc->receive_running = true; ICL_CONN_UNLOCK(ic); error = kthread_add(icl_send_thread, ic, NULL, NULL, 0, 0, "%stx", ic->ic_name); if (error != 0) { ICL_WARN("kthread_add(9) failed with error %d", error); ICL_CONN_LOCK(ic); - ic->ic_send_running = ic->ic_receive_running = false; - cv_signal(&ic->ic_send_cv); + isc->send_running = isc->receive_running = false; + cv_signal(&isc->send_cv); ICL_CONN_UNLOCK(ic); icl_soft_conn_close(ic); return (error); @@ -1279,8 +1312,8 @@ icl_conn_start(struct icl_conn *ic) if (error != 0) { ICL_WARN("kthread_add(9) failed with error %d", error); ICL_CONN_LOCK(ic); - ic->ic_receive_running = false; - cv_signal(&ic->ic_send_cv); + isc->receive_running = false; + cv_signal(&isc->send_cv); ICL_CONN_UNLOCK(ic); icl_soft_conn_close(ic); return (error); @@ -1355,6 +1388,7 @@ icl_soft_conn_handoff(struct icl_conn *ic, int fd) void icl_soft_conn_close(struct icl_conn *ic) { + struct icl_soft_conn *isc = (struct icl_soft_conn *)ic; struct icl_pdu *pdu; struct socket *so; @@ -1371,10 +1405,10 @@ icl_soft_conn_close(struct icl_conn *ic) if (so) SOCKBUF_UNLOCK(&so->so_rcv); } - while (ic->ic_receive_running || ic->ic_send_running) { - cv_signal(&ic->ic_receive_cv); - cv_signal(&ic->ic_send_cv); - cv_wait(&ic->ic_send_cv, ic->ic_lock); + while (isc->receive_running || isc->send_running) { + cv_signal(&isc->receive_cv); + cv_signal(&isc->send_cv); + cv_wait(&isc->send_cv, ic->ic_lock); } /* Some other thread could close the connection same time. */ @@ -1400,22 +1434,22 @@ icl_soft_conn_close(struct icl_conn *ic) soclose(so); ICL_CONN_LOCK(ic); - if (ic->ic_receive_pdu != NULL) { + if (isc->receive_pdu != NULL) { //ICL_DEBUG("freeing partially received PDU"); - icl_soft_conn_pdu_free(ic, ic->ic_receive_pdu); - ic->ic_receive_pdu = NULL; + icl_soft_conn_pdu_free(ic, isc->receive_pdu); + isc->receive_pdu = NULL; } /* * Remove any outstanding PDUs from the send queue. */ - while (!STAILQ_EMPTY(&ic->ic_to_send)) { - pdu = STAILQ_FIRST(&ic->ic_to_send); - STAILQ_REMOVE_HEAD(&ic->ic_to_send, ip_next); + while (!STAILQ_EMPTY(&isc->to_send)) { + pdu = STAILQ_FIRST(&isc->to_send); + STAILQ_REMOVE_HEAD(&isc->to_send, ip_next); icl_soft_pdu_done(pdu, ENOTCONN); } - KASSERT(STAILQ_EMPTY(&ic->ic_to_send), + KASSERT(STAILQ_EMPTY(&isc->to_send), ("destroying session with non-empty send queue")); ICL_CONN_UNLOCK(ic); } From owner-dev-commits-src-all@freebsd.org Thu Aug 5 20:45:35 2021 Return-Path: Delivered-To: dev-commits-src-all@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 78BC666A30A; Thu, 5 Aug 2021 20:45: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 4Gggbz2lRdz4VV2; Thu, 5 Aug 2021 20:45: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 4629420F1D; Thu, 5 Aug 2021 20:45: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 175KjZa8018668; Thu, 5 Aug 2021 20:45:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 175KjZFG018667; Thu, 5 Aug 2021 20:45:35 GMT (envelope-from git) Date: Thu, 5 Aug 2021 20:45:35 GMT Message-Id: <202108052045.175KjZFG018667@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 8482aa77481a - main - Use lltable calculated header when sending lle holdchain after successful lle resolution. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8482aa77481a1576df7a19dbeaccb91243fbb2a3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 20:45:35 -0000 The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=8482aa77481a1576df7a19dbeaccb91243fbb2a3 commit 8482aa77481a1576df7a19dbeaccb91243fbb2a3 Author: Alexander V. Chernikov AuthorDate: 2021-08-02 23:16:48 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-08-05 20:44:36 +0000 Use lltable calculated header when sending lle holdchain after successful lle resolution. Subscribers: imp, ae, bz Differential Revision: https://reviews.freebsd.org/D31391 --- sys/netinet/if_ether.c | 55 ++++++++++++++++++++++++++++++++++++++------------ sys/netinet6/nd6.c | 30 +++++++++++++++++---------- sys/netinet6/nd6.h | 6 ++---- sys/netinet6/nd6_nbr.c | 9 +++------ 4 files changed, 66 insertions(+), 34 deletions(-) diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c index 3eb9d7210afb..2f92d623feeb 100644 --- a/sys/netinet/if_ether.c +++ b/sys/netinet/if_ether.c @@ -1145,6 +1145,44 @@ drop: } #endif +static struct mbuf * +arp_grab_holdchain(struct llentry *la) +{ + struct mbuf *chain; + + LLE_WLOCK_ASSERT(la); + + chain = la->la_hold; + la->la_hold = NULL; + la->la_numheld = 0; + + return (chain); +} + +static void +arp_flush_holdchain(struct ifnet *ifp, struct llentry *la, struct mbuf *chain) +{ + struct mbuf *m_hold, *m_hold_next; + struct sockaddr_in sin; + + NET_EPOCH_ASSERT(); + + struct route ro = { + .ro_prepend = la->r_linkdata, + .ro_plen = la->r_hdrlen, + }; + + lltable_fill_sa_entry(la, (struct sockaddr *)&sin); + + for (m_hold = chain; m_hold != NULL; m_hold = m_hold_next) { + m_hold_next = m_hold->m_nextpkt; + m_hold->m_nextpkt = NULL; + /* Avoid confusing lower layers. */ + m_clrprotoflags(m_hold); + (*ifp->if_output)(ifp, m_hold, (struct sockaddr *)&sin, &ro); + } +} + /* * Checks received arp data against existing @la. * Updates lle state/performs notification if necessary. @@ -1153,8 +1191,6 @@ static void arp_check_update_lle(struct arphdr *ah, struct in_addr isaddr, struct ifnet *ifp, int bridged, struct llentry *la) { - struct sockaddr sa; - struct mbuf *m_hold, *m_hold_next; uint8_t linkhdr[LLE_MAX_LINKHDR]; size_t linkhdrsize; int lladdr_off; @@ -1227,18 +1263,11 @@ arp_check_update_lle(struct arphdr *ah, struct in_addr isaddr, struct ifnet *ifp * output routine. */ if (la->la_hold != NULL) { - m_hold = la->la_hold; - la->la_hold = NULL; - la->la_numheld = 0; - lltable_fill_sa_entry(la, &sa); + struct mbuf *chain; + + chain = arp_grab_holdchain(la); LLE_WUNLOCK(la); - for (; m_hold != NULL; m_hold = m_hold_next) { - m_hold_next = m_hold->m_nextpkt; - m_hold->m_nextpkt = NULL; - /* Avoid confusing lower layers. */ - m_clrprotoflags(m_hold); - (*ifp->if_output)(ifp, m_hold, &sa, NULL); - } + arp_flush_holdchain(ifp, la, chain); } else LLE_WUNLOCK(la); } diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c index 60610462f4d7..437fdb5d4e52 100644 --- a/sys/netinet6/nd6.c +++ b/sys/netinet6/nd6.c @@ -1923,7 +1923,6 @@ nd6_cache_lladdr(struct ifnet *ifp, struct in6_addr *from, char *lladdr, int llchange; int flags; uint16_t router = 0; - struct sockaddr_in6 sin6; struct mbuf *chain = NULL; u_char linkhdr[LLE_MAX_LINKHDR]; size_t linkhdrsize; @@ -2044,7 +2043,7 @@ nd6_cache_lladdr(struct ifnet *ifp, struct in6_addr *from, char *lladdr, EVENTHANDLER_INVOKE(lle_event, ln, LLENTRY_RESOLVED); if (ln->la_hold != NULL) - nd6_grab_holdchain(ln, &chain, &sin6); + chain = nd6_grab_holdchain(ln); } /* Calculates new router status */ @@ -2062,7 +2061,7 @@ nd6_cache_lladdr(struct ifnet *ifp, struct in6_addr *from, char *lladdr, LLE_RUNLOCK(ln); if (chain != NULL) - nd6_flush_holdchain(ifp, chain, &sin6); + nd6_flush_holdchain(ifp, ln, chain); /* * When the link-layer address of a router changes, select the @@ -2119,16 +2118,15 @@ nd6_slowtimo(void *arg) CURVNET_RESTORE(); } -void -nd6_grab_holdchain(struct llentry *ln, struct mbuf **chain, - struct sockaddr_in6 *sin6) +struct mbuf * +nd6_grab_holdchain(struct llentry *ln) { + struct mbuf *chain; LLE_WLOCK_ASSERT(ln); - *chain = ln->la_hold; + chain = ln->la_hold; ln->la_hold = NULL; - lltable_fill_sa_entry(ln, (struct sockaddr *)sin6); if (ln->ln_state == ND6_LLINFO_STALE) { /* @@ -2142,6 +2140,8 @@ nd6_grab_holdchain(struct llentry *ln, struct mbuf **chain, */ nd6_llinfo_setstate(ln, ND6_LLINFO_DELAY); } + + return (chain); } int @@ -2435,19 +2435,27 @@ nd6_resolve_addr(struct ifnet *ifp, int flags, const struct sockaddr *dst, } int -nd6_flush_holdchain(struct ifnet *ifp, struct mbuf *chain, - struct sockaddr_in6 *dst) +nd6_flush_holdchain(struct ifnet *ifp, struct llentry *lle, struct mbuf *chain) { struct mbuf *m, *m_head; + struct sockaddr_in6 dst6; int error = 0; + NET_EPOCH_ASSERT(); + + struct route_in6 ro = { + .ro_prepend = lle->r_linkdata, + .ro_plen = lle->r_hdrlen, + }; + + lltable_fill_sa_entry(lle, (struct sockaddr *)&dst6); m_head = chain; while (m_head) { m = m_head; m_head = m_head->m_nextpkt; m->m_nextpkt = NULL; - error = nd6_output_ifp(ifp, ifp, m, dst, NULL); + error = nd6_output_ifp(ifp, ifp, m, &dst6, (struct route *)&ro); } /* diff --git a/sys/netinet6/nd6.h b/sys/netinet6/nd6.h index a64c786efcc8..ee53acce840a 100644 --- a/sys/netinet6/nd6.h +++ b/sys/netinet6/nd6.h @@ -376,10 +376,8 @@ int nd6_resolve(struct ifnet *, int, struct mbuf *, int nd6_ioctl(u_long, caddr_t, struct ifnet *); void nd6_cache_lladdr(struct ifnet *, struct in6_addr *, char *, int, int, int); -void nd6_grab_holdchain(struct llentry *, struct mbuf **, - struct sockaddr_in6 *); -int nd6_flush_holdchain(struct ifnet *, struct mbuf *, - struct sockaddr_in6 *); +struct mbuf *nd6_grab_holdchain(struct llentry *); +int nd6_flush_holdchain(struct ifnet *, struct llentry *, struct mbuf *); int nd6_add_ifa_lle(struct in6_ifaddr *); void nd6_rem_ifa_lle(struct in6_ifaddr *, int); int nd6_output_ifp(struct ifnet *, struct ifnet *, struct mbuf *, diff --git a/sys/netinet6/nd6_nbr.c b/sys/netinet6/nd6_nbr.c index 42e901bdd2a4..0f18a38c37a1 100644 --- a/sys/netinet6/nd6_nbr.c +++ b/sys/netinet6/nd6_nbr.c @@ -623,7 +623,6 @@ nd6_na_input(struct mbuf *m, int off, int icmp6len) struct mbuf *chain; struct nd_neighbor_advert *nd_na; struct in6_addr daddr6, taddr6; - struct sockaddr_in6 sin6; union nd_opts ndopts; u_char linkhdr[LLE_MAX_LINKHDR]; char ip6bufs[INET6_ADDRSTRLEN], ip6bufd[INET6_ADDRSTRLEN]; @@ -899,16 +898,14 @@ nd6_na_input(struct mbuf *m, int off, int icmp6len) * rt->rt_flags &= ~RTF_REJECT; */ ln->la_asked = 0; - if (ln->la_hold != NULL) { - memset(&sin6, 0, sizeof(sin6)); - nd6_grab_holdchain(ln, &chain, &sin6); - } + if (ln->la_hold != NULL) + chain = nd6_grab_holdchain(ln); freeit: if (ln != NULL) LLE_WUNLOCK(ln); if (chain != NULL) - nd6_flush_holdchain(ifp, chain, &sin6); + nd6_flush_holdchain(ifp, ln, chain); if (checklink) pfxlist_onlink_check(); From owner-dev-commits-src-all@freebsd.org Thu Aug 5 22:24:35 2021 Return-Path: Delivered-To: dev-commits-src-all@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 E231866B2DE; Thu, 5 Aug 2021 22:24: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 4GgjpC5YBZz4bYS; Thu, 5 Aug 2021 22:24: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 A765E21F56; Thu, 5 Aug 2021 22:24: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 175MOZvb054508; Thu, 5 Aug 2021 22:24:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 175MOZSd054507; Thu, 5 Aug 2021 22:24:35 GMT (envelope-from git) Date: Thu, 5 Aug 2021 22:24:35 GMT Message-Id: <202108052224.175MOZSd054507@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 18ea5bc166c1 - stable/13 - virtio: enable VTNET_LEGACY_TX when ALTQ is enabled. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 18ea5bc166c1e908e24b8d2e13f5d1b36acc6742 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 22:24:36 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=18ea5bc166c1e908e24b8d2e13f5d1b36acc6742 commit 18ea5bc166c1e908e24b8d2e13f5d1b36acc6742 Author: Luiz Otavio O Souza AuthorDate: 2017-10-26 02:30:54 +0000 Commit: Kristof Provost CommitDate: 2021-08-05 20:04:04 +0000 virtio: enable VTNET_LEGACY_TX when ALTQ is enabled. ALTQ only works on network drivers which use if_start (rather than if_transmit). vtnet uses if_start if built with VTNET_LEGACY_TX. Default to that the kernel is built with ALTQ enabled, to reduce user surprise. MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 5afe81a7b23afd27289ca40e04a6a764134d6273) --- sys/dev/virtio/network/if_vtnetvar.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/dev/virtio/network/if_vtnetvar.h b/sys/dev/virtio/network/if_vtnetvar.h index 55e8a7267499..3f36ff3c1ca4 100644 --- a/sys/dev/virtio/network/if_vtnetvar.h +++ b/sys/dev/virtio/network/if_vtnetvar.h @@ -31,6 +31,10 @@ #ifndef _IF_VTNETVAR_H #define _IF_VTNETVAR_H +#ifdef ALTQ +#define VTNET_LEGACY_TX +#endif + struct vtnet_softc; struct vtnet_statistics { From owner-dev-commits-src-all@freebsd.org Thu Aug 5 22:24:37 2021 Return-Path: Delivered-To: dev-commits-src-all@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 27D4866B7F7; Thu, 5 Aug 2021 22:24:37 +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 4GgjpF0dhzz4bFq; Thu, 5 Aug 2021 22:24: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 F3229224C6; Thu, 5 Aug 2021 22:24:36 +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 175MOaDB054625; Thu, 5 Aug 2021 22:24:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 175MOaIr054624; Thu, 5 Aug 2021 22:24:36 GMT (envelope-from git) Date: Thu, 5 Aug 2021 22:24:36 GMT Message-Id: <202108052224.175MOaIr054624@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 973304077ff8 - stable/12 - virtio: enable VTNET_LEGACY_TX when ALTQ is enabled. 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/stable/12 X-Git-Reftype: branch X-Git-Commit: 973304077ff865a6ebeb55aa1d38f8d44b7dc3b4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 22:24:37 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=973304077ff865a6ebeb55aa1d38f8d44b7dc3b4 commit 973304077ff865a6ebeb55aa1d38f8d44b7dc3b4 Author: Luiz Otavio O Souza AuthorDate: 2017-10-26 02:30:54 +0000 Commit: Kristof Provost CommitDate: 2021-08-05 20:05:26 +0000 virtio: enable VTNET_LEGACY_TX when ALTQ is enabled. ALTQ only works on network drivers which use if_start (rather than if_transmit). vtnet uses if_start if built with VTNET_LEGACY_TX. Default to that the kernel is built with ALTQ enabled, to reduce user surprise. MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 5afe81a7b23afd27289ca40e04a6a764134d6273) --- sys/dev/virtio/network/if_vtnetvar.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/dev/virtio/network/if_vtnetvar.h b/sys/dev/virtio/network/if_vtnetvar.h index 4498ad534517..39f5c85d11be 100644 --- a/sys/dev/virtio/network/if_vtnetvar.h +++ b/sys/dev/virtio/network/if_vtnetvar.h @@ -31,6 +31,10 @@ #ifndef _IF_VTNETVAR_H #define _IF_VTNETVAR_H +#ifdef ALTQ +#define VTNET_LEGACY_TX +#endif + struct vtnet_softc; struct vtnet_statistics { From owner-dev-commits-src-all@freebsd.org Thu Aug 5 22:51:57 2021 Return-Path: Delivered-To: dev-commits-src-all@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 BB41D66BCC0; Thu, 5 Aug 2021 22:51: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 4GgkPn4rLgz4crB; Thu, 5 Aug 2021 22:51: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 8E7FD22274; Thu, 5 Aug 2021 22:51: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 175MpvGd090850; Thu, 5 Aug 2021 22:51:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 175MpvX7090849; Thu, 5 Aug 2021 22:51:57 GMT (envelope-from git) Date: Thu, 5 Aug 2021 22:51:57 GMT Message-Id: <202108052251.175MpvX7090849@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: 1b97a054f3ac - main - tsleep: Add a PNOLOCK flag 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: 1b97a054f3acaf13a5c8361b7b80e10ad16257b9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 22:51:57 -0000 The branch main has been updated by gallatin: URL: https://cgit.FreeBSD.org/src/commit/?id=1b97a054f3acaf13a5c8361b7b80e10ad16257b9 commit 1b97a054f3acaf13a5c8361b7b80e10ad16257b9 Author: Andrew Gallatin AuthorDate: 2021-08-05 21:16:30 +0000 Commit: Andrew Gallatin CommitDate: 2021-08-05 21:16:30 +0000 tsleep: Add a PNOLOCK flag Add a PNOLOCK flag so that, in the race circumstance where wakeup races are externally mitigated, tsleep() can be called with a sleep time of 0 without triggering an an assertion. Reviewed by: jhb Sponsored by: Netflix --- sys/kern/kern_synch.c | 3 ++- sys/sys/param.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c index 793c5309a30b..7bf5193fb7b1 100644 --- a/sys/kern/kern_synch.c +++ b/sys/kern/kern_synch.c @@ -148,7 +148,8 @@ _sleep(const void *ident, struct lock_object *lock, int priority, #endif WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, lock, "Sleeping on \"%s\"", wmesg); - KASSERT(sbt != 0 || mtx_owned(&Giant) || lock != NULL, + KASSERT(sbt != 0 || mtx_owned(&Giant) || lock != NULL || + (priority & PNOLOCK) != 0, ("sleeping without a lock")); KASSERT(ident != NULL, ("_sleep: NULL ident")); KASSERT(TD_IS_RUNNING(td), ("_sleep: curthread not running")); diff --git a/sys/sys/param.h b/sys/sys/param.h index f842b344e9f9..8864063e3d9b 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -246,7 +246,8 @@ #define PRIMASK 0x0ff #define PCATCH 0x100 /* OR'd with pri for tsleep to check signals */ #define PDROP 0x200 /* OR'd with pri to stop re-entry of interlock mutex */ -#define PRILASTFLAG 0x200 /* Last flag defined above */ +#define PNOLOCK 0x400 /* OR'd with pri to allow sleeping w/o a lock */ +#define PRILASTFLAG 0x400 /* Last flag defined above */ #define NZERO 0 /* default "nice" */ From owner-dev-commits-src-all@freebsd.org Thu Aug 5 22:51:58 2021 Return-Path: Delivered-To: dev-commits-src-all@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 E153D66C29D; Thu, 5 Aug 2021 22:51: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 4GgkPp5ygDz4cmC; Thu, 5 Aug 2021 22:51: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 B2C662285A; Thu, 5 Aug 2021 22:51: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 175MpwDJ090874; Thu, 5 Aug 2021 22:51:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 175MpwTC090873; Thu, 5 Aug 2021 22:51:58 GMT (envelope-from git) Date: Thu, 5 Aug 2021 22:51:58 GMT Message-Id: <202108052251.175MpwTC090873@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: 09066b98663d - main - ktls: Use the new PNOLOCK flag 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: 09066b98663d92f4d129bab25105805adf0abaf7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 22:51:59 -0000 The branch main has been updated by gallatin: URL: https://cgit.FreeBSD.org/src/commit/?id=09066b98663d92f4d129bab25105805adf0abaf7 commit 09066b98663d92f4d129bab25105805adf0abaf7 Author: Andrew Gallatin AuthorDate: 2021-08-05 21:19:12 +0000 Commit: Andrew Gallatin CommitDate: 2021-08-05 21:19:12 +0000 ktls: Use the new PNOLOCK flag Use the new PNOLOCK flag to tsleep() to indicate that we are managing potential races, and don't need to sleep with a lock, or have a backstop timeout. Reviewed by: jhb Sponsored by: Netflix --- sys/kern/uipc_ktls.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/uipc_ktls.c b/sys/kern/uipc_ktls.c index 47815c266667..1cc1f2e8b8c4 100644 --- a/sys/kern/uipc_ktls.c +++ b/sys/kern/uipc_ktls.c @@ -2240,7 +2240,7 @@ ktls_alloc_thread(void *ctx) nbufs = 0; for (;;) { atomic_store_int(&sc->running, 0); - tsleep_sbt(sc, PZERO, "waiting for work", SBT_MAX, SBT_1S, 0); + tsleep(sc, PZERO | PNOLOCK, "-", 0); atomic_store_int(&sc->running, 1); sc->wakeups++; if (nbufs != ktls_max_alloc) { From owner-dev-commits-src-all@freebsd.org Thu Aug 5 23:25:38 2021 Return-Path: Delivered-To: dev-commits-src-all@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 41B2566C904; Thu, 5 Aug 2021 23:25: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 4Ggl8f0xvvz4fkV; Thu, 5 Aug 2021 23:25:38 +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 04CBB2313B; Thu, 5 Aug 2021 23:25: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 175NPbqh035137; Thu, 5 Aug 2021 23:25:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 175NPbZG035136; Thu, 5 Aug 2021 23:25:37 GMT (envelope-from git) Date: Thu, 5 Aug 2021 23:25:37 GMT Message-Id: <202108052325.175NPbZG035136@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: 739de953ecc1 - main - ktls: Move KERN_TLS ifdef to tcp_var.h 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: 739de953ecc13afa930e2f55b7ee2a04e41e3519 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 23:25:38 -0000 The branch main has been updated by gallatin: URL: https://cgit.FreeBSD.org/src/commit/?id=739de953ecc13afa930e2f55b7ee2a04e41e3519 commit 739de953ecc13afa930e2f55b7ee2a04e41e3519 Author: Andrew Gallatin AuthorDate: 2021-08-05 23:17:35 +0000 Commit: Andrew Gallatin CommitDate: 2021-08-05 23:17:35 +0000 ktls: Move KERN_TLS ifdef to tcp_var.h This allows us to remove stubs in ktls.h and allows us to sort the function prototypes. Reviewed by: jhb Sponsored by: Netflix --- sys/netinet/tcp_var.h | 6 +++--- sys/sys/ktls.h | 14 +++----------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h index 8cfd2c5417c2..64e954cf4ad5 100644 --- a/sys/netinet/tcp_var.h +++ b/sys/netinet/tcp_var.h @@ -1144,8 +1144,6 @@ static inline void tcp_account_for_send(struct tcpcb *tp, uint32_t len, uint8_t is_rxt, uint8_t is_tlp, int hw_tls) { - uint64_t rexmit_percent; - if (is_tlp) { tp->t_sndtlppack++; tp->t_sndtlpbyte += len; @@ -1156,11 +1154,13 @@ tcp_account_for_send(struct tcpcb *tp, uint32_t len, uint8_t is_rxt, else tp->t_sndbytes += len; +#ifdef KERN_TLS if (hw_tls && is_rxt) { - rexmit_percent = (1000ULL * tp->t_snd_rxt_bytes) / (10ULL * (tp->t_snd_rxt_bytes + tp->t_sndbytes)); + uint64_t 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 } #endif /* _KERNEL */ diff --git a/sys/sys/ktls.h b/sys/sys/ktls.h index a4156eb10395..437e36f965ea 100644 --- a/sys/sys/ktls.h +++ b/sys/sys/ktls.h @@ -197,7 +197,10 @@ struct ktls_session { bool disable_ifnet_pending; } __aligned(CACHE_LINE_SIZE); +extern unsigned int ktls_ifnet_max_rexmit_pct; + void ktls_check_rx(struct sockbuf *sb); +void ktls_disable_ifnet(void *arg); int ktls_enable_rx(struct socket *so, struct tls_enable *en); int ktls_enable_tx(struct socket *so, struct tls_enable *en); void ktls_destroy(struct ktls_session *tls); @@ -233,16 +236,5 @@ 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 -static inline void -ktls_disable_ifnet(void *arg __unused) -{ -} -#endif - #endif /* !_KERNEL */ #endif /* !_SYS_KTLS_H_ */ From owner-dev-commits-src-all@freebsd.org Thu Aug 5 23:58:50 2021 Return-Path: Delivered-To: dev-commits-src-all@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 3CA3666D004 for ; Thu, 5 Aug 2021 23:58:50 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound2c.ore.mailhop.org (outbound2c.ore.mailhop.org [54.186.10.118]) (using TLSv1.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 4Ggltx6NNzz4hkv for ; Thu, 5 Aug 2021 23:58:49 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1628207923; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=gVrKL5P7eAIc0KHV8DYCfRTQ8xU2AEy1AhvoxHrhycYTz1c3m38v9tXSu0ChJyV0jA3CZJ1FajY7x v8LyQPubIuHGrRyKUJ0szUclnrau6jhPo6pAyOP31BSc9JGzh/kjIJqabuFQy1ruzMtuJBxrBYUGwe t/1VBhCH97XTC6M3ZuUFzNz0At6UnGwDoGabHgjzclu+5F/Dw0L+psnC41m352V6oh/1dM2li1UCMr ai6yJ6Xk9zao30n+f28RqFVdObYwlPnRNIfJ9w1PoeDNNr4Eb9x2dXmr7Qx9kxJ6ljbrxRIY382x5K MxSxeVFClW4W2Az9k5B3aRYhG1THCsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:dkim-signature:from; bh=l09YutvCLUy5HpLP3zWJgoK6psR+4zFElran31sxWt0=; b=hOPDBPx7poEjDdRTOhaYdcQDw4E0e+RtN3lR94LCZMh9zRwwDkfzOlIp6tLfHZP1pyTI+yOv5381/ +0bzoqCdNylN4ZFv7/OLBUBHlDaolPsIb3vzgVxPGTiByHWfNtsqpSlnfGjc1fbensa99Ecukgo2US KWtCXqkYraSVaJIYCp75XZbIQ0Ujn0xNjDYpY+XqlsHg6BbxB4a0Ii6eHruY56/W1uwTehS3WIwGWE 75TiSY2QAN/+gq/INYmCOiaQNo/1pvYaTO4+c/SsKUyOAE2ZETqp0whPR6ZECAMpNp0Jgii2bag48j GBdBPREWpXgA2fH9wheKx9a+YJkGyJQ== ARC-Authentication-Results: i=1; outbound4.ore.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=67.177.211.60; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:from; bh=l09YutvCLUy5HpLP3zWJgoK6psR+4zFElran31sxWt0=; b=AzEevA0J5IkyLcsSHR9kRNrjpBSmzldVospuJifhA2TCacylD3zOosybYlod+b5Nj2cVmf1K+wnOw 46kQ5yehLWjT5GIcEgVfUTnwSwD1acLWJGO46vZJ162BKtnhx+JXba16i53guocHe8XaMo5Ivw/4Nq r9CZQbiLdDlcPDQwft//hPX89VBJzFuLAxJcXdVh/6DX5RHIPuPOsa/tCHSaukbMlV00qh4t4Nvt/u Xc5QihzggXYn3e7BMn2MCBF/Rp4jPlrEc8Sxfw5TB6LHZXqyMVBJoYxZpPkLAqBG+5Y5cj22rhckn/ MrR4+FpDDA5mF5vrm6GZIYCKUjmSR3A== X-Originating-IP: 67.177.211.60 X-MHO-RoutePath: aGlwcGll X-MHO-User: 0f529c41-f649-11eb-a658-89389772cfc7 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (c-67-177-211-60.hsd1.co.comcast.net [67.177.211.60]) by outbound4.ore.mailhop.org (Halon) with ESMTPSA id 0f529c41-f649-11eb-a658-89389772cfc7; Thu, 05 Aug 2021 23:58:42 +0000 (UTC) Received: from [172.22.42.84] (rev2.hippie.lan [172.22.42.84]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id 175Nwf0q086315; Thu, 5 Aug 2021 17:58:41 -0600 (MDT) (envelope-from ian@freebsd.org) X-Authentication-Warning: paranoia.hippie.lan: Host rev2.hippie.lan [172.22.42.84] claimed to be [172.22.42.84] Message-ID: Subject: Re: git: 09066b98663d - main - ktls: Use the new PNOLOCK flag From: Ian Lepore To: Andrew Gallatin , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Date: Thu, 05 Aug 2021 17:58:41 -0600 In-Reply-To: <202108052251.175MpwTC090873@gitrepo.freebsd.org> References: <202108052251.175MpwTC090873@gitrepo.freebsd.org> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.40.3 FreeBSD GNOME Team MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4Ggltx6NNzz4hkv 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 23:58:50 -0000 On Thu, 2021-08-05 at 22:51 +0000, Andrew Gallatin wrote: > The branch main has been updated by gallatin: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=09066b98663d92f4d129bab25105805adf0abaf7 > > commit 09066b98663d92f4d129bab25105805adf0abaf7 > Author:     Andrew Gallatin > AuthorDate: 2021-08-05 21:19:12 +0000 > Commit:     Andrew Gallatin > CommitDate: 2021-08-05 21:19:12 +0000 > >     ktls: Use the new PNOLOCK flag >     >     Use the new PNOLOCK flag to tsleep() to indicate that >     we are managing potential races, and don't need to >     sleep with a lock, or have a backstop timeout. >     >     Reviewed by: jhb >     Sponsored by: Netflix > --- >  sys/kern/uipc_ktls.c | 2 +- >  1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/sys/kern/uipc_ktls.c b/sys/kern/uipc_ktls.c > index 47815c266667..1cc1f2e8b8c4 100644 > --- a/sys/kern/uipc_ktls.c > +++ b/sys/kern/uipc_ktls.c > @@ -2240,7 +2240,7 @@ ktls_alloc_thread(void *ctx) >         nbufs = 0; >         for (;;) { >                 atomic_store_int(&sc->running, 0); > -               tsleep_sbt(sc, PZERO, "waiting for work", SBT_MAX, > SBT_1S, 0); > +               tsleep(sc, PZERO | PNOLOCK, "-",  0); >                 atomic_store_int(&sc->running, 1); >                 sc->wakeups++; >                 if (nbufs != ktls_max_alloc) { I especially like this solution, it documents explicitly what you're doing and why. (Earlier I was considering mumbling something about "there should be a comment to say a sleep-forever is known safe here".) -- Ian From owner-dev-commits-src-all@freebsd.org Fri Aug 6 00:49:25 2021 Return-Path: Delivered-To: dev-commits-src-all@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 D634B66D261; Fri, 6 Aug 2021 00:49:25 +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 4Ggn1K5R4pz4l8F; Fri, 6 Aug 2021 00:49: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 9EA122448A; Fri, 6 Aug 2021 00:49: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 1760nPIS041492; Fri, 6 Aug 2021 00:49:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1760nPNo041491; Fri, 6 Aug 2021 00:49:25 GMT (envelope-from git) Date: Fri, 6 Aug 2021 00:49:25 GMT Message-Id: <202108060049.1760nPNo041491@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "David E. O'Brien" Subject: git: ec2942baf536 - stable/12 - Fortuna: Clean up reseeding key material to closer match FS&K MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: obrien X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: ec2942baf536cde8298febc1787b7bf4ff97cd27 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 00:49:25 -0000 The branch stable/12 has been updated by obrien: URL: https://cgit.FreeBSD.org/src/commit/?id=ec2942baf536cde8298febc1787b7bf4ff97cd27 commit ec2942baf536cde8298febc1787b7bf4ff97cd27 Author: Conrad Meyer AuthorDate: 2018-10-20 19:44:59 +0000 Commit: David E. O'Brien CommitDate: 2021-08-06 00:27:56 +0000 Fortuna: Clean up reseeding key material to closer match FS&K When reseeding, only incorporate actual key material. Do not include e.g. the derived key schedules or other AES context. I don't think the extra material was harmful here, just not beneficial. Reviewed by: delphij, markm Approved by: secteam (delphij) Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D16934 (cherry picked from commit 90545403e9d293efb0b843a75ad02361eadaae6d) --- sys/dev/random/fortuna.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/dev/random/fortuna.c b/sys/dev/random/fortuna.c index c20cea2f21ae..d203c2f138a1 100644 --- a/sys/dev/random/fortuna.c +++ b/sys/dev/random/fortuna.c @@ -285,7 +285,8 @@ random_fortuna_reseed_internal(uint32_t *entropy_data, u_int blockcount) */ randomdev_hash_init(&context); randomdev_hash_iterate(&context, zero_region, RANDOM_ZERO_BLOCKSIZE); - randomdev_hash_iterate(&context, &fortuna_state.fs_key, sizeof(fortuna_state.fs_key)); + randomdev_hash_iterate(&context, &fortuna_state.fs_key.key.keyMaterial, + fortuna_state.fs_key.key.keyLen / 8); randomdev_hash_iterate(&context, entropy_data, RANDOM_KEYSIZE*blockcount); randomdev_hash_finish(&context, hash); randomdev_hash_init(&context); From owner-dev-commits-src-all@freebsd.org Fri Aug 6 00:49:26 2021 Return-Path: Delivered-To: dev-commits-src-all@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 D26B466D75B; Fri, 6 Aug 2021 00:49: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 4Ggn1L5dYlz4l8G; Fri, 6 Aug 2021 00:49: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 A96F42448B; Fri, 6 Aug 2021 00:49: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 1760nQoQ041518; Fri, 6 Aug 2021 00:49:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1760nQlC041517; Fri, 6 Aug 2021 00:49:26 GMT (envelope-from git) Date: Fri, 6 Aug 2021 00:49:26 GMT Message-Id: <202108060049.1760nQlC041517@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "David E. O'Brien" Subject: git: 2cc41234353f - stable/12 - Fortuna: Add trivial assert to match FS&K definition MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: obrien X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 2cc41234353f4fff0b55984367b60748b67481ec Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 00:49:26 -0000 The branch stable/12 has been updated by obrien: URL: https://cgit.FreeBSD.org/src/commit/?id=2cc41234353f4fff0b55984367b60748b67481ec commit 2cc41234353f4fff0b55984367b60748b67481ec Author: Conrad Meyer AuthorDate: 2018-10-20 20:12:57 +0000 Commit: David E. O'Brien CommitDate: 2021-08-06 00:28:00 +0000 Fortuna: Add trivial assert to match FS&K definition FS&K GenerateBlocks function asserts C (counter) != 0. This should also be true in our implementation. Reviewed by: delphij, markm Approved by: secteam (delphij) Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D16936 (cherry picked from commit 84880efae7040bb55e6f63166f53158135574e3a) --- sys/dev/random/fortuna.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/dev/random/fortuna.c b/sys/dev/random/fortuna.c index d203c2f138a1..7b4193b528d4 100644 --- a/sys/dev/random/fortuna.c +++ b/sys/dev/random/fortuna.c @@ -310,6 +310,8 @@ random_fortuna_genblocks(uint8_t *buf, u_int blockcount) u_int i; RANDOM_RESEED_ASSERT_LOCK_OWNED(); + KASSERT(!uint128_is_zero(fortuna_state.fs_counter), ("FS&K: C != 0")); + for (i = 0; i < blockcount; i++) { /*- * FS&K - r = r|E(K,C) From owner-dev-commits-src-all@freebsd.org Fri Aug 6 00:49:28 2021 Return-Path: Delivered-To: dev-commits-src-all@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 385C266D55A; Fri, 6 Aug 2021 00:49: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 4Ggn1M6j2rz4l1r; Fri, 6 Aug 2021 00:49: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 CD67624445; Fri, 6 Aug 2021 00:49: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 1760nRgX041542; Fri, 6 Aug 2021 00:49:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1760nRaP041541; Fri, 6 Aug 2021 00:49:27 GMT (envelope-from git) Date: Fri, 6 Aug 2021 00:49:27 GMT Message-Id: <202108060049.1760nRaP041541@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "David E. O'Brien" Subject: git: b00de27cfc8d - stable/12 - Fortuna: trivial static variable cleanup MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: obrien X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: b00de27cfc8da96f22c6ad3353e492e947001fa3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 00:49:28 -0000 The branch stable/12 has been updated by obrien: URL: https://cgit.FreeBSD.org/src/commit/?id=b00de27cfc8da96f22c6ad3353e492e947001fa3 commit b00de27cfc8da96f22c6ad3353e492e947001fa3 Author: Conrad Meyer AuthorDate: 2018-10-20 20:15:06 +0000 Commit: David E. O'Brien CommitDate: 2021-08-06 00:28:01 +0000 Fortuna: trivial static variable cleanup Remove unnecessary use of function-local static variable. 32 bytes is small enough to live on the stack. Reviewed by: delphij, markm Approved by: secteam (delphij) Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D16937 (cherry picked from commit 494dda455cd1dad0277a35e292735243f92ec10a) --- sys/dev/random/fortuna.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/random/fortuna.c b/sys/dev/random/fortuna.c index 7b4193b528d4..6382d47b1415 100644 --- a/sys/dev/random/fortuna.c +++ b/sys/dev/random/fortuna.c @@ -333,7 +333,7 @@ random_fortuna_genblocks(uint8_t *buf, u_int blockcount) static __inline void random_fortuna_genrandom(uint8_t *buf, u_int bytecount) { - static uint8_t temp[RANDOM_BLOCKSIZE*(RANDOM_KEYS_PER_BLOCK)]; + uint8_t temp[RANDOM_BLOCKSIZE * RANDOM_KEYS_PER_BLOCK]; u_int blockcount; RANDOM_RESEED_ASSERT_LOCK_OWNED(); From owner-dev-commits-src-all@freebsd.org Fri Aug 6 03:31:49 2021 Return-Path: Delivered-To: dev-commits-src-all@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 007D366F7A5; Fri, 6 Aug 2021 03:31: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 4Ggrch6JLCz4vRY; Fri, 6 Aug 2021 03:31: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 C086E263E0; Fri, 6 Aug 2021 03:31: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 1763VmQ0066876; Fri, 6 Aug 2021 03:31:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1763Vmp2066875; Fri, 6 Aug 2021 03:31:48 GMT (envelope-from git) Date: Fri, 6 Aug 2021 03:31:48 GMT Message-Id: <202108060331.1763Vmp2066875@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 645b46d379a0 - main - pkgbase: fix locale packages MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 645b46d379a028b7a7b2c5a54ecfc1ab5a0b8936 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 03:31:49 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=645b46d379a028b7a7b2c5a54ecfc1ab5a0b8936 commit 645b46d379a028b7a7b2c5a54ecfc1ab5a0b8936 Author: Kyle Evans AuthorDate: 2021-08-05 18:37:18 +0000 Commit: Kyle Evans CommitDate: 2021-08-06 03:31:40 +0000 pkgbase: fix locale packages Most places spelled it -locales, but numericdef spelled it as -locale in just this one place. Pluralize it. Reviewed by: emaste, manu Fixes: 0fa5403d493b ("pkgbase: move locales into their own package") Differential Revision: https://reviews.freebsd.org/D31428 --- share/numericdef/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/numericdef/Makefile b/share/numericdef/Makefile index 90e2551570b5..12cc7dc68ab1 100644 --- a/share/numericdef/Makefile +++ b/share/numericdef/Makefile @@ -1,6 +1,6 @@ # $FreeBSD$ -PACKAGE= locale +PACKAGE= locales LOCALEDIR= ${SHAREDIR}/locale FILESNAME= LC_NUMERIC .SUFFIXES: .src .out From owner-dev-commits-src-all@freebsd.org Fri Aug 6 03:31:50 2021 Return-Path: Delivered-To: dev-commits-src-all@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 161E066F3FC; Fri, 6 Aug 2021 03:31: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 4Ggrcj73Fyz4vgJ; Fri, 6 Aug 2021 03:31: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 D87DD26656; Fri, 6 Aug 2021 03:31: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 1763VnwS066900; Fri, 6 Aug 2021 03:31:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1763VncT066899; Fri, 6 Aug 2021 03:31:49 GMT (envelope-from git) Date: Fri, 6 Aug 2021 03:31:49 GMT Message-Id: <202108060331.1763VncT066899@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: b3e87f133454 - main - ctypedef: fix installation of C.UTF-8 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b3e87f1334547b15596a98c030c3d99278685aa5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 03:31:50 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=b3e87f1334547b15596a98c030c3d99278685aa5 commit b3e87f1334547b15596a98c030c3d99278685aa5 Author: Kyle Evans AuthorDate: 2021-08-05 18:39:36 +0000 Commit: Kyle Evans CommitDate: 2021-08-06 03:31:40 +0000 ctypedef: fix installation of C.UTF-8 The appropriate directory and name were assigned to the FILESDIR grouping, but not the ALWAYS grouping where C.UTF-8 is actually assigned. Add the appropriate bits for ALWAYSDIR, and remove an obsolete *PACKAGE= assignment since C.UTF-8 is explicitly not included in FILES. Prior to this change, C.UTF-8 was being installed as /usr/share/C.UTF-8.LC_CTYPE. Reviewed by: manu Fixes: 0fa5403d493b ("pkgbase: move locales into their own package") Differential Revision: https://reviews.freebsd.org/D31429 --- ObsoleteFiles.inc | 3 +++ share/ctypedef/Makefile | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index d23562072214..99db0e591090 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -40,6 +40,9 @@ # xargs -n1 | sort | uniq -d; # done +# 20210805: C.UTF-8 installed to the wrong location +OLD_FILES+=usr/share/C.UTF-8.LC_CTYPE + # 20210619: new clang import which bumps version from 12.0.0 to 12.0.1. OLD_FILES+=usr/lib/clang/12.0.0/include/cuda_wrappers/algorithm OLD_FILES+=usr/lib/clang/12.0.0/include/cuda_wrappers/complex diff --git a/share/ctypedef/Makefile b/share/ctypedef/Makefile index 912b4e6f4757..a717e94db5e6 100644 --- a/share/ctypedef/Makefile +++ b/share/ctypedef/Makefile @@ -5,6 +5,7 @@ FILESGROUPS= FILES ALWAYS ALWAYSPACKAGE= runtime LOCALEDIR= ${SHAREDIR}/locale FILESNAME= LC_CTYPE +ALWAYSNAME= LC_CTYPE .SUFFIXES: .src .LC_CTYPE MAPLOC= ${.CURDIR}/../../tools/tools/locale/etc/final-maps @@ -231,7 +232,7 @@ SYMLINKS+= ../$f/${FILESNAME} \ .for f in ${LOCALES} FILESDIR_${f}.LC_CTYPE= ${LOCALEDIR}/${f} .endfor -FILESDIR_C.UTF-8.LC_CTYPEPACKAGE= runtime +ALWAYSDIR_C.UTF-8.LC_CTYPE= ${LOCALEDIR}/C.UTF-8 SYMPAIRS+= zh_CN.eucCN.src zh_CN.GB18030.src SYMPAIRS+= zh_CN.eucCN.src zh_CN.GB2312.src From owner-dev-commits-src-all@freebsd.org Fri Aug 6 05:13:32 2021 Return-Path: Delivered-To: dev-commits-src-all@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 95A23670435; Fri, 6 Aug 2021 05:13: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 4Ggtt43Z3Sz3GY9; Fri, 6 Aug 2021 05:13: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 6311C27C36; Fri, 6 Aug 2021 05:13: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 1765DWOJ000869; Fri, 6 Aug 2021 05:13:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1765DW3I000868; Fri, 6 Aug 2021 05:13:32 GMT (envelope-from git) Date: Fri, 6 Aug 2021 05:13:32 GMT Message-Id: <202108060513.1765DW3I000868@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "David E. O'Brien" Subject: git: ba2f52819c51 - stable/12 - Fortuna: Fix a race to prevent reseed spamming MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: obrien X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: ba2f52819c51853ce9f158878f13da736718fad2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 05:13:32 -0000 The branch stable/12 has been updated by obrien: URL: https://cgit.FreeBSD.org/src/commit/?id=ba2f52819c51853ce9f158878f13da736718fad2 commit ba2f52819c51853ce9f158878f13da736718fad2 Author: Conrad Meyer AuthorDate: 2018-10-20 21:09:12 +0000 Commit: David E. O'Brien CommitDate: 2021-08-06 05:12:00 +0000 Fortuna: Fix a race to prevent reseed spamming If multiple threads enter fortuna_pre_read contemporaneously, such as via read(2) or getrandom(2), they could race to check how long it has been since the last update due to a TOCTOU problem with 'now'. Here is an example problematic execution: Thread A: Thread B: now_A = getsbinuptime(); now_B = getsbinuptime(); // now_B > now_A RANDOM_RESEED_LOCK(); if (now - fs_lasttime > SBT_1S/10) { fs_lasttime = now; ... // reseed } RANDOM_RESEED_UNLOCK(); RANDOM_RESEED_LOCK(); if (now_A - fs_lasttime > SBT_1S/10) // now_A - fs_lasttime underflows fs_lasttime = now_A; ... // reseed again, despite less than 100ms elapsing } RANDOM_RESEED_UNLOCK(); To resolve the race, simply check the current time after we win the lock race. If getsbinuptime is perceived to be expensive, another option might be to just accept the race and validate that fs_lasttime isn't "in the future." (It should be within the last ~2^31 seconds out of ~2^32 seconds representable duration.) Reviewed by: delphij, markm Approved by: secteam (delphij) Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D16984 (cherry picked from commit 5528565a76f5caae336d4f13213108dc1fad4ae0) --- sys/dev/random/fortuna.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/random/fortuna.c b/sys/dev/random/fortuna.c index 6382d47b1415..f9a29fd5a596 100644 --- a/sys/dev/random/fortuna.c +++ b/sys/dev/random/fortuna.c @@ -368,11 +368,11 @@ random_fortuna_pre_read(void) u_int i; KASSERT(fortuna_state.fs_minpoolsize > 0, ("random: Fortuna threshold must be > 0")); + RANDOM_RESEED_LOCK(); #ifdef _KERNEL /* FS&K - Use 'getsbinuptime()' to prevent reseed-spamming. */ now = getsbinuptime(); #endif - RANDOM_RESEED_LOCK(); if (fortuna_state.fs_pool[0].fsp_length >= fortuna_state.fs_minpoolsize #ifdef _KERNEL From owner-dev-commits-src-all@freebsd.org Fri Aug 6 05:13:33 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A89F96703B7; Fri, 6 Aug 2021 05:13: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 4Ggtt54KMvz3GbR; Fri, 6 Aug 2021 05:13: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 7D76927B30; Fri, 6 Aug 2021 05:13: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 1765DXA2000895; Fri, 6 Aug 2021 05:13:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1765DXJi000894; Fri, 6 Aug 2021 05:13:33 GMT (envelope-from git) Date: Fri, 6 Aug 2021 05:13:33 GMT Message-Id: <202108060513.1765DXJi000894@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "David E. O'Brien" Subject: git: 8eb54646dd0e - stable/12 - Fortuna: fix a correctness issue in reseed (fortuna_pre_read) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: obrien X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 8eb54646dd0eabd66c70f152b502412c04766fdf Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 05:13:33 -0000 The branch stable/12 has been updated by obrien: URL: https://cgit.FreeBSD.org/src/commit/?id=8eb54646dd0eabd66c70f152b502412c04766fdf commit 8eb54646dd0eabd66c70f152b502412c04766fdf Author: Conrad Meyer AuthorDate: 2018-10-26 20:55:01 +0000 Commit: David E. O'Brien CommitDate: 2021-08-06 05:12:05 +0000 Fortuna: fix a correctness issue in reseed (fortuna_pre_read) 'i' counts the number of pools included in the array 's'. Passing 'i+1' to reseed_internal() as the number of blocks in 's' is a bogus overrun of the initialized portion of 's' -- technically UB. I found this via code inspection, referencing §9.5.2 "Pools" of the Fortuna chapter, but I would expect Coverity to notice the same issue. Unfortunately, it doesn't appear to. Reviewed by: markm Approved by: secteam (gordon) Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D16985 (cherry picked from commit 9a88479843e2314018f66fd2cdad5ae0200393d0) --- sys/dev/random/fortuna.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/random/fortuna.c b/sys/dev/random/fortuna.c index f9a29fd5a596..0eaffa1de439 100644 --- a/sys/dev/random/fortuna.c +++ b/sys/dev/random/fortuna.c @@ -408,7 +408,7 @@ random_fortuna_pre_read(void) SDT_PROBE2(random, fortuna, event_processor, debug, fortuna_state.fs_reseedcount, fortuna_state.fs_pool); #endif /* FS&K */ - random_fortuna_reseed_internal(s, i < RANDOM_FORTUNA_NPOOLS ? i + 1 : RANDOM_FORTUNA_NPOOLS); + random_fortuna_reseed_internal(s, i); /* Clean up and secure */ explicit_bzero(s, sizeof(s)); explicit_bzero(temp, sizeof(temp)); From owner-dev-commits-src-all@freebsd.org Fri Aug 6 05:13:35 2021 Return-Path: Delivered-To: dev-commits-src-all@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 12378670356; Fri, 6 Aug 2021 05:13: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 4Ggtt670mKz3GYD; Fri, 6 Aug 2021 05:13: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 B3C8127CA3; Fri, 6 Aug 2021 05:13: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 1765DYTL000927; Fri, 6 Aug 2021 05:13:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1765DY5p000926; Fri, 6 Aug 2021 05:13:34 GMT (envelope-from git) Date: Fri, 6 Aug 2021 05:13:34 GMT Message-Id: <202108060513.1765DY5p000926@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "David E. O'Brien" Subject: git: 1ae8bd9a7d5a - stable/12 - fortuna: Drop global lock to zero stack variables MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: obrien X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 1ae8bd9a7d5ac1247db21d8f302d3d0513e08702 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 05:13:35 -0000 The branch stable/12 has been updated by obrien: URL: https://cgit.FreeBSD.org/src/commit/?id=1ae8bd9a7d5ac1247db21d8f302d3d0513e08702 commit 1ae8bd9a7d5ac1247db21d8f302d3d0513e08702 Author: Conrad Meyer AuthorDate: 2018-10-26 21:00:26 +0000 Commit: David E. O'Brien CommitDate: 2021-08-06 05:12:10 +0000 fortuna: Drop global lock to zero stack variables Also drop explicit zeroing of hash context -- hash finish() operation is expected to do this. PR: 230877 Suggested by: delphij@ Reviewed by: delphij, markm Approved by: secteam (delphij) Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D16986 (cherry picked from commit 7be4093a844e80a591221e93d03f3daf6a972be3) --- sys/dev/random/fortuna.c | 65 +++++++++++++++++++++++++----------------------- 1 file changed, 34 insertions(+), 31 deletions(-) diff --git a/sys/dev/random/fortuna.c b/sys/dev/random/fortuna.c index 0eaffa1de439..866899846212 100644 --- a/sys/dev/random/fortuna.c +++ b/sys/dev/random/fortuna.c @@ -374,47 +374,50 @@ random_fortuna_pre_read(void) now = getsbinuptime(); #endif - if (fortuna_state.fs_pool[0].fsp_length >= fortuna_state.fs_minpoolsize + if (fortuna_state.fs_pool[0].fsp_length < fortuna_state.fs_minpoolsize #ifdef _KERNEL /* FS&K - Use 'getsbinuptime()' to prevent reseed-spamming. */ - && (now - fortuna_state.fs_lasttime > SBT_1S/10) + || (now - fortuna_state.fs_lasttime <= SBT_1S/10) #endif ) { + RANDOM_RESEED_UNLOCK(); + return; + } + #ifdef _KERNEL - fortuna_state.fs_lasttime = now; + fortuna_state.fs_lasttime = now; #endif - /* FS&K - ReseedCNT = ReseedCNT + 1 */ - fortuna_state.fs_reseedcount++; - /* s = \epsilon at start */ - for (i = 0; i < RANDOM_FORTUNA_NPOOLS; i++) { - /* FS&K - if Divides(ReseedCnt, 2^i) ... */ - if ((fortuna_state.fs_reseedcount % (1 << i)) == 0) { - /*- - * FS&K - temp = (P_i) - * - P_i = \epsilon - * - s = s|H(temp) - */ - randomdev_hash_finish(&fortuna_state.fs_pool[i].fsp_hash, temp); - randomdev_hash_init(&fortuna_state.fs_pool[i].fsp_hash); - fortuna_state.fs_pool[i].fsp_length = 0; - randomdev_hash_init(&context); - randomdev_hash_iterate(&context, temp, RANDOM_KEYSIZE); - randomdev_hash_finish(&context, s + i*RANDOM_KEYSIZE_WORDS); - } else - break; - } + /* FS&K - ReseedCNT = ReseedCNT + 1 */ + fortuna_state.fs_reseedcount++; + /* s = \epsilon at start */ + for (i = 0; i < RANDOM_FORTUNA_NPOOLS; i++) { + /* FS&K - if Divides(ReseedCnt, 2^i) ... */ + if ((fortuna_state.fs_reseedcount % (1 << i)) == 0) { + /*- + * FS&K - temp = (P_i) + * - P_i = \epsilon + * - s = s|H(temp) + */ + randomdev_hash_finish(&fortuna_state.fs_pool[i].fsp_hash, temp); + randomdev_hash_init(&fortuna_state.fs_pool[i].fsp_hash); + fortuna_state.fs_pool[i].fsp_length = 0; + randomdev_hash_init(&context); + randomdev_hash_iterate(&context, temp, RANDOM_KEYSIZE); + randomdev_hash_finish(&context, s + i*RANDOM_KEYSIZE_WORDS); + } else + break; + } #ifdef _KERNEL - SDT_PROBE2(random, fortuna, event_processor, debug, fortuna_state.fs_reseedcount, fortuna_state.fs_pool); + SDT_PROBE2(random, fortuna, event_processor, debug, fortuna_state.fs_reseedcount, fortuna_state.fs_pool); #endif - /* FS&K */ - random_fortuna_reseed_internal(s, i); - /* Clean up and secure */ - explicit_bzero(s, sizeof(s)); - explicit_bzero(temp, sizeof(temp)); - explicit_bzero(&context, sizeof(context)); - } + /* FS&K */ + random_fortuna_reseed_internal(s, i); RANDOM_RESEED_UNLOCK(); + + /* Clean up and secure */ + explicit_bzero(s, sizeof(s)); + explicit_bzero(temp, sizeof(temp)); } /*- From owner-dev-commits-src-all@freebsd.org Fri Aug 6 05:13:36 2021 Return-Path: Delivered-To: dev-commits-src-all@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 1A7F3670A00; Fri, 6 Aug 2021 05:13:36 +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 4Ggtt76S0lz3GRR; Fri, 6 Aug 2021 05:13: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 C27CB27CA4; Fri, 6 Aug 2021 05:13: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 1765DZ6O000953; Fri, 6 Aug 2021 05:13:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1765DZgo000952; Fri, 6 Aug 2021 05:13:35 GMT (envelope-from git) Date: Fri, 6 Aug 2021 05:13:35 GMT Message-Id: <202108060513.1765DZgo000952@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "David E. O'Brien" Subject: git: 17dc7d3add57 - stable/12 - Fortuna: Add failpoints to simulate initial seeding conditions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: obrien X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 17dc7d3add57f8aa3bf5091644fb23d06a5b9c9f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 05:13:36 -0000 The branch stable/12 has been updated by obrien: URL: https://cgit.FreeBSD.org/src/commit/?id=17dc7d3add57f8aa3bf5091644fb23d06a5b9c9f commit 17dc7d3add57f8aa3bf5091644fb23d06a5b9c9f Author: Conrad Meyer AuthorDate: 2018-10-26 21:03:57 +0000 Commit: David E. O'Brien CommitDate: 2021-08-06 05:12:16 +0000 Fortuna: Add failpoints to simulate initial seeding conditions Set debug.fail_point.random_fortuna_pre_read=return(1) and debug.fail_point.random_fortuna_seeded=return(1) to return to unseeded status (sort of). See the Differential URL for more detail. The goal is to reproduce e.g. Lev's recent CURRENT report[1] about failing newfs arc4random(3) usage (fixed in r338542). No functional change when failpoints are not set. [1]: https://lists.freebsd.org/pipermail/freebsd-current/2018-September/071067.html Reported by: lev Reviewed by: delphij, markm Approved by: secteam (delphij) Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D17047 (cherry picked from commit 9b8d0fe462b2f3f689cb87fe34bd42c388e23d49) --- sys/dev/random/fortuna.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/sys/dev/random/fortuna.c b/sys/dev/random/fortuna.c index 866899846212..3a46d527fa9a 100644 --- a/sys/dev/random/fortuna.c +++ b/sys/dev/random/fortuna.c @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #ifdef _KERNEL #include +#include #include #include #include @@ -384,6 +385,18 @@ random_fortuna_pre_read(void) return; } +#ifdef _KERNEL + /* + * When set, pretend we do not have enough entropy to reseed yet. + */ + KFAIL_POINT_CODE(DEBUG_FP, random_fortuna_pre_read, { + if (RETURN_VALUE != 0) { + RANDOM_RESEED_UNLOCK(); + return; + } + }); +#endif + #ifdef _KERNEL fortuna_state.fs_lasttime = now; #endif @@ -442,5 +455,13 @@ bool random_fortuna_seeded(void) { +#ifdef _KERNEL + /* When set, act as if we are not seeded. */ + KFAIL_POINT_CODE(DEBUG_FP, random_fortuna_seeded, { + if (RETURN_VALUE != 0) + fortuna_state.fs_counter = UINT128_ZERO; + }); +#endif + return (!uint128_is_zero(fortuna_state.fs_counter)); } From owner-dev-commits-src-all@freebsd.org Fri Aug 6 05:13:37 2021 Return-Path: Delivered-To: dev-commits-src-all@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 BA3116703BD; Fri, 6 Aug 2021 05:13:37 +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 4Ggtt92CQhz3Gbt; Fri, 6 Aug 2021 05:13: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 DD5F327668; Fri, 6 Aug 2021 05:13:36 +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 1765DavP000977; Fri, 6 Aug 2021 05:13:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1765DaPx000976; Fri, 6 Aug 2021 05:13:36 GMT (envelope-from git) Date: Fri, 6 Aug 2021 05:13:36 GMT Message-Id: <202108060513.1765DaPx000976@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "David E. O'Brien" Subject: git: f7c5c21f159f - stable/12 - fortuna: Deduplicate kernel vs user includes MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: obrien X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: f7c5c21f159ffd535c251a0052b5e8a2bc3b5b67 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 05:13:37 -0000 The branch stable/12 has been updated by obrien: URL: https://cgit.FreeBSD.org/src/commit/?id=f7c5c21f159ffd535c251a0052b5e8a2bc3b5b67 commit f7c5c21f159ffd535c251a0052b5e8a2bc3b5b67 Author: Conrad Meyer AuthorDate: 2019-03-01 22:51:45 +0000 Commit: David E. O'Brien CommitDate: 2021-08-06 05:12:21 +0000 fortuna: Deduplicate kernel vs user includes No functional change. Reviewed by: markj, markm Approved by: secteam (delphij), core (brooks) Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D19409 (cherry picked from commit e66ccbeaa3613d022dbc07b9f7403c6bfbe40be6) --- sys/dev/random/fortuna.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/sys/dev/random/fortuna.c b/sys/dev/random/fortuna.c index 3a46d527fa9a..11879831dbbd 100644 --- a/sys/dev/random/fortuna.c +++ b/sys/dev/random/fortuna.c @@ -35,10 +35,10 @@ #include __FBSDID("$FreeBSD$"); +#include #include #ifdef _KERNEL -#include #include #include #include @@ -50,17 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include - -#include -#include - -#include -#include -#include -#include -#include #else /* !_KERNEL */ -#include #include #include #include @@ -69,15 +59,18 @@ __FBSDID("$FreeBSD$"); #include #include "unit_test.h" +#endif /* _KERNEL */ #include #include #include #include +#ifdef _KERNEL +#include +#endif #include #include -#endif /* _KERNEL */ /* Defined in FS&K */ #define RANDOM_FORTUNA_NPOOLS 32 /* The number of accumulation pools */ From owner-dev-commits-src-all@freebsd.org Fri Aug 6 09:09:55 2021 Return-Path: Delivered-To: dev-commits-src-all@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 6203665229E; Fri, 6 Aug 2021 09:09:55 +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 4Gh06q1d8Wz3n28; Fri, 6 Aug 2021 09:09:55 +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 198FF260206; Fri, 6 Aug 2021 11:09:54 +0200 (CEST) Subject: Re: git: 09066b98663d - main - ktls: Use the new PNOLOCK flag To: Ian Lepore , Andrew Gallatin , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202108052251.175MpwTC090873@gitrepo.freebsd.org> From: Hans Petter Selasky Message-ID: <18ed8e5f-d042-478b-e18c-dd0de7affcae@selasky.org> Date: Fri, 6 Aug 2021 11:09:43 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 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: 4Gh06q1d8Wz3n28 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 09:09:55 -0000 On 8/6/21 1:58 AM, Ian Lepore wrote: > I especially like this solution, it documents explicitly what you're > doing and why. (Earlier I was considering mumbling something about > "there should be a comment to say a sleep-forever is known safe here".) Hi, MPSAFE is the word to use, like with other things related to GIANT? PNOLOCK -> PMPSAFE ?? --HPS From owner-dev-commits-src-all@freebsd.org Fri Aug 6 09:30:22 2021 Return-Path: Delivered-To: dev-commits-src-all@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 1AA796524F7; Fri, 6 Aug 2021 09:30: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 4Gh0ZP75dqz3pBZ; Fri, 6 Aug 2021 09:30: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 DB94328FC; Fri, 6 Aug 2021 09:30: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 1769ULR1044067; Fri, 6 Aug 2021 09:30:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1769UL5I044061; Fri, 6 Aug 2021 09:30:21 GMT (envelope-from git) Date: Fri, 6 Aug 2021 09:30:21 GMT Message-Id: <202108060930.1769UL5I044061@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: 132fca633593 - main - sound(4): Fix typos. 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: 132fca6335939b308f230d4942ba15ba2b56ceb7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 09:30:22 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=132fca6335939b308f230d4942ba15ba2b56ceb7 commit 132fca6335939b308f230d4942ba15ba2b56ceb7 Author: Hans Petter Selasky AuthorDate: 2021-07-28 11:25:01 +0000 Commit: Hans Petter Selasky CommitDate: 2021-08-06 09:28:43 +0000 sound(4): Fix typos. Submitted by: Christos Margiolis Differential Revision: https://reviews.freebsd.org/D31320 MFC after: 1 week Sponsored by: NVIDIA Networking --- sys/dev/sound/pcm/sound.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/sound/pcm/sound.c b/sys/dev/sound/pcm/sound.c index 299e4937f8e4..e03529f00b78 100644 --- a/sys/dev/sound/pcm/sound.c +++ b/sys/dev/sound/pcm/sound.c @@ -1020,7 +1020,7 @@ pcm_sysinit(device_t dev) { struct snddev_info *d = device_get_softc(dev); - /* XXX: an user should be able to set this with a control tool, the + /* XXX: a user should be able to set this with a control tool, the sysadmin then needs min+max sysctls for this */ SYSCTL_ADD_UINT(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), @@ -1133,7 +1133,7 @@ pcm_register(device_t dev, void *devinfo, int numplay, int numrec) sysctl_ctx_init(&d->rec_sysctl_ctx); d->rec_sysctl_tree = SYSCTL_ADD_NODE(&d->rec_sysctl_ctx, SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, "rec", - CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "record channels node"); + CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "recording channels node"); if (numplay > 0 || numrec > 0) d->flags |= SD_F_AUTOVCHAN; From owner-dev-commits-src-all@freebsd.org Fri Aug 6 09:30:23 2021 Return-Path: Delivered-To: dev-commits-src-all@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 48C55652AD1; Fri, 6 Aug 2021 09:30: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 4Gh0ZR16SNz3pHl; Fri, 6 Aug 2021 09:30: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 0D6C32BFA; Fri, 6 Aug 2021 09:30: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 1769UMij044204; Fri, 6 Aug 2021 09:30:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1769UMaO044203; Fri, 6 Aug 2021 09:30:22 GMT (envelope-from git) Date: Fri, 6 Aug 2021 09:30:22 GMT Message-Id: <202108060930.1769UMaO044203@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: ed2196e5df0c - main - sound(4): Implement playback and recording mode sysctl(8). 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: ed2196e5df0c8b5b81563d2fffdcb32bb7ebe966 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 09:30:23 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=ed2196e5df0c8b5b81563d2fffdcb32bb7ebe966 commit ed2196e5df0c8b5b81563d2fffdcb32bb7ebe966 Author: Hans Petter Selasky AuthorDate: 2021-07-28 11:22:52 +0000 Commit: Hans Petter Selasky CommitDate: 2021-08-06 09:28:44 +0000 sound(4): Implement playback and recording mode sysctl(8). The dev.pcm..mode sysctl(8) gives information if a sound device supports hardware mixing, playback or recording. Submitted by: Christos Margiolis Differential Revision: https://reviews.freebsd.org/D31320 MFC after: 1 week Sponsored by: NVIDIA Networking --- sys/dev/sound/pcm/sound.c | 23 +++++++++++++++++++++++ sys/dev/sound/pcm/sound.h | 4 ++++ 2 files changed, 27 insertions(+) diff --git a/sys/dev/sound/pcm/sound.c b/sys/dev/sound/pcm/sound.c index e03529f00b78..663ec84f93b6 100644 --- a/sys/dev/sound/pcm/sound.c +++ b/sys/dev/sound/pcm/sound.c @@ -1015,10 +1015,28 @@ SYSCTL_PROC(_hw_snd, OID_AUTO, clone_gc, "global clone garbage collector"); #endif +static u_int8_t +pcm_mode_init(struct snddev_info *d) +{ + u_int8_t mode = 0; + + if (d->playcount > 0) + mode |= PCM_MODE_PLAY; + if (d->reccount > 0) + mode |= PCM_MODE_REC; + if (d->mixer_dev != NULL) + mode |= PCM_MODE_MIXER; + + return (mode); +} + static void pcm_sysinit(device_t dev) { struct snddev_info *d = device_get_softc(dev); + u_int8_t mode; + + mode = pcm_mode_init(d); /* XXX: a user should be able to set this with a control tool, the sysadmin then needs min+max sysctls for this */ @@ -1030,6 +1048,11 @@ pcm_sysinit(device_t dev) "bitperfect", CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_NEEDGIANT, d, sizeof(d), sysctl_dev_pcm_bitperfect, "I", "bit-perfect playback/recording (0=disable, 1=enable)"); + SYSCTL_ADD_UINT(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), + OID_AUTO, "mode", CTLFLAG_RD, NULL, mode, + "mode (1=mixer, 2=play, 4=rec. The values are OR'ed if more than one" + "mode is supported)"); #ifdef SND_DEBUG SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, diff --git a/sys/dev/sound/pcm/sound.h b/sys/dev/sound/pcm/sound.h index 7b4a4d3a46ca..7c664524211a 100644 --- a/sys/dev/sound/pcm/sound.h +++ b/sys/dev/sound/pcm/sound.h @@ -412,6 +412,10 @@ struct snddev_info { void sound_oss_sysinfo(oss_sysinfo *); int sound_oss_card_info(oss_card_info *); +#define PCM_MODE_MIXER 0x01 +#define PCM_MODE_PLAY 0x02 +#define PCM_MODE_REC 0x04 + #define PCM_LOCKOWNED(d) mtx_owned((d)->lock) #define PCM_LOCK(d) mtx_lock((d)->lock) #define PCM_UNLOCK(d) mtx_unlock((d)->lock) From owner-dev-commits-src-all@freebsd.org Fri Aug 6 09:30:24 2021 Return-Path: Delivered-To: dev-commits-src-all@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 856A9652ADA; Fri, 6 Aug 2021 09:30: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 4Gh0ZS1s1vz3pW7; Fri, 6 Aug 2021 09:30: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 265B53223; Fri, 6 Aug 2021 09:30: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 1769UOxD044228; Fri, 6 Aug 2021 09:30:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1769UOLC044227; Fri, 6 Aug 2021 09:30:24 GMT (envelope-from git) Date: Fri, 6 Aug 2021 09:30:24 GMT Message-Id: <202108060930.1769UOLC044227@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: bb5cd80e8b42 - main - Update the TCP LRO code to handle both encrypted and un-encrypted traffic. 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: bb5cd80e8b42b31a2229077a7e93ffd3585eeb78 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 09:30:24 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=bb5cd80e8b42b31a2229077a7e93ffd3585eeb78 commit bb5cd80e8b42b31a2229077a7e93ffd3585eeb78 Author: Hans Petter Selasky AuthorDate: 2021-08-02 09:53:12 +0000 Commit: Hans Petter Selasky CommitDate: 2021-08-06 09:28:44 +0000 Update the TCP LRO code to handle both encrypted and un-encrypted traffic. Encrypted and un-encrypted traffic needs to be coalesced separately. Split the 16-bit lro_type field in the address information into two 8-bit fields, and then use the last 8-bit field for flags, which among other indicate if the received mbuf is encrypted or un-encrypted. Differential Revision: https://reviews.freebsd.org/D31377 Reviewed by: gallatin MFC after: 1 week Sponsored by: NVIDIA Networking --- sys/netinet/tcp_lro.c | 5 ++++- sys/netinet/tcp_lro.h | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/sys/netinet/tcp_lro.c b/sys/netinet/tcp_lro.c index f0a996f685c3..cb548d457bb3 100644 --- a/sys/netinet/tcp_lro.c +++ b/sys/netinet/tcp_lro.c @@ -394,6 +394,9 @@ tcp_lro_parser(struct mbuf *m, struct lro_parser *po, struct lro_parser *pi, boo po->data.vlan_id = htons(m->m_pkthdr.ether_vtag) & htons(EVL_VLID_MASK); } + /* Store decrypted flag, if any. */ + if (__predict_false(m->m_flags & M_DECRYPTED)) + po->data.lro_flags |= LRO_FLAG_DECRYPTED; } switch (po->data.lro_type) { @@ -1583,7 +1586,7 @@ do_bpf_strip_and_compress(struct inpcb *inp, struct lro_ctrl *lc, uint32_t *ts_ptr; int32_t n_mbuf; bool other_opts, can_compress; - uint16_t lro_type; + uint8_t lro_type; uint16_t iptos; int tcp_hdr_offset; int idx; diff --git a/sys/netinet/tcp_lro.h b/sys/netinet/tcp_lro.h index 75ab78c7fc6f..3eefd4f0537c 100644 --- a/sys/netinet/tcp_lro.h +++ b/sys/netinet/tcp_lro.h @@ -67,12 +67,14 @@ struct inpcb; union lro_address { u_long raw[1]; struct { - uint16_t lro_type; /* internal */ + uint8_t lro_type; /* internal */ #define LRO_TYPE_NONE 0 #define LRO_TYPE_IPV4_TCP 1 #define LRO_TYPE_IPV6_TCP 2 #define LRO_TYPE_IPV4_UDP 3 #define LRO_TYPE_IPV6_UDP 4 + uint8_t lro_flags; +#define LRO_FLAG_DECRYPTED 1 uint16_t vlan_id; /* VLAN identifier */ uint16_t s_port; /* source TCP/UDP port */ uint16_t d_port; /* destination TCP/UDP port */ From owner-dev-commits-src-all@freebsd.org Fri Aug 6 10:00:53 2021 Return-Path: Delivered-To: dev-commits-src-all@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 D0082652BCB; Fri, 6 Aug 2021 10:00: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 4Gh1Fd5b5Xz3sq2; Fri, 6 Aug 2021 10:00: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 A7E7B3464; Fri, 6 Aug 2021 10:00: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 176A0raH085618; Fri, 6 Aug 2021 10:00:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 176A0r7R085617; Fri, 6 Aug 2021 10:00:53 GMT (envelope-from git) Date: Fri, 6 Aug 2021 10:00:53 GMT Message-Id: <202108061000.176A0r7R085617@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Andrey V. Elsukov" Subject: git: d477a7feed17 - main - Fix panic in IPv6 multicast code. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ae X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d477a7feed177d0ad5c12bc6e2cce804d427ed38 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 10:00:53 -0000 The branch main has been updated by ae: URL: https://cgit.FreeBSD.org/src/commit/?id=d477a7feed177d0ad5c12bc6e2cce804d427ed38 commit d477a7feed177d0ad5c12bc6e2cce804d427ed38 Author: Andrey V. Elsukov AuthorDate: 2021-08-05 08:51:46 +0000 Commit: Andrey V. Elsukov CommitDate: 2021-08-06 09:57:59 +0000 Fix panic in IPv6 multicast code. Add check that ifp supports IPv6 multicasts in in6_getmulti. This fixes panic when user application tries to join into multicast group on an interface that doesn't support IPv6 multicasts, like IFT_PFLOG interfaces. PR: 257302 Reviewed by: melifaro MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31420 --- sys/netinet6/in6_mcast.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/sys/netinet6/in6_mcast.c b/sys/netinet6/in6_mcast.c index 0744a1178fc7..7326befc6d01 100644 --- a/sys/netinet6/in6_mcast.c +++ b/sys/netinet6/in6_mcast.c @@ -374,9 +374,18 @@ in6_getmulti(struct ifnet *ifp, const struct in6_addr *group, IN6_MULTI_LIST_LOCK(); IF_ADDR_WLOCK(ifp); NET_EPOCH_ENTER(et); - inm = in6m_lookup_locked(ifp, group); + /* + * Does ifp support IPv6 multicasts? + */ + if (ifp->if_afdata[AF_INET6] == NULL) + error = ENODEV; + else + inm = in6m_lookup_locked(ifp, group); NET_EPOCH_EXIT(et); + if (error != 0) + goto out_locked; + if (inm != NULL) { /* * If we already joined this group, just bump the From owner-dev-commits-src-all@freebsd.org Fri Aug 6 12:38:02 2021 Return-Path: Delivered-To: dev-commits-src-all@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 7B6F065526D; Fri, 6 Aug 2021 12:38: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 4Gh4ky2vsjz4YDP; Fri, 6 Aug 2021 12:38: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 4845058EE; Fri, 6 Aug 2021 12:38: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 176Cc2nL092202; Fri, 6 Aug 2021 12:38:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 176Cc2D2092201; Fri, 6 Aug 2021 12:38:02 GMT (envelope-from git) Date: Fri, 6 Aug 2021 12:38:02 GMT Message-Id: <202108061238.176Cc2D2092201@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: e06b8f112803 - main - pkgbase: Add nfsiod to the FreeBSD-nfs package 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: e06b8f11280397d7fdaa27d8d6f8eec9e4c707b3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 12:38:02 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=e06b8f11280397d7fdaa27d8d6f8eec9e4c707b3 commit e06b8f11280397d7fdaa27d8d6f8eec9e4c707b3 Author: Emmanuel Vadot AuthorDate: 2021-08-05 16:17:34 +0000 Commit: Emmanuel Vadot CommitDate: 2021-08-06 12:37:35 +0000 pkgbase: Add nfsiod to the FreeBSD-nfs package Missed in 081fb644925f --- sbin/nfsiod/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sbin/nfsiod/Makefile b/sbin/nfsiod/Makefile index 47cd290ec78e..912dd19e25cb 100644 --- a/sbin/nfsiod/Makefile +++ b/sbin/nfsiod/Makefile @@ -4,4 +4,6 @@ PROG= nfsiod MAN= nfsiod.8 +PACKAGE= nfs + .include From owner-dev-commits-src-all@freebsd.org Fri Aug 6 12:38:03 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A310965526E; Fri, 6 Aug 2021 12:38: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 4Gh4kz3qNrz4YDQ; Fri, 6 Aug 2021 12:38: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 60DA55BC9; Fri, 6 Aug 2021 12:38: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 176Cc3Wv092226; Fri, 6 Aug 2021 12:38:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 176Cc30B092225; Fri, 6 Aug 2021 12:38:03 GMT (envelope-from git) Date: Fri, 6 Aug 2021 12:38:03 GMT Message-Id: <202108061238.176Cc30B092225@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: 86c71e97d19f - main - pkgbase: locales: Also tag the files dir 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: 86c71e97d19f8b82b8ab79a56b20998ada7ee868 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 12:38:03 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=86c71e97d19f8b82b8ab79a56b20998ada7ee868 commit 86c71e97d19f8b82b8ab79a56b20998ada7ee868 Author: Emmanuel Vadot AuthorDate: 2021-08-06 12:36:06 +0000 Commit: Emmanuel Vadot CommitDate: 2021-08-06 12:37:45 +0000 pkgbase: locales: Also tag the files dir Otherwise bsd.dirs.mk will create the directory with the default package (utilities) and we end up with a bunch of empty dirs managed by this package while it shouldn't be the case. --- share/colldef/Makefile | 3 +++ share/colldef_unicode/Makefile | 2 ++ share/ctypedef/Makefile | 1 + share/monetdef/Makefile | 1 + share/monetdef_unicode/Makefile | 1 + share/msgdef/Makefile | 1 + share/msgdef_unicode/Makefile | 1 + share/numericdef/Makefile | 1 + share/numericdef_unicode/Makefile | 1 + share/timedef/Makefile | 1 + 10 files changed, 13 insertions(+) diff --git a/share/colldef/Makefile b/share/colldef/Makefile index f7e24446342d..5d94c6e77736 100644 --- a/share/colldef/Makefile +++ b/share/colldef/Makefile @@ -136,6 +136,7 @@ CLEANFILES= ${FILES} .for f t in ${SAME} DIRS+= LOCALEDIR_$t +LOCALEDIR_${t}PACKAGE= locales LOCALEDIR_$t= ${LOCALEDIR}/$t SYMLINKS+= ../$f/${FILESNAME} \ ${LOCALEDIR}/$t/${FILESNAME} @@ -143,11 +144,13 @@ SYMLINKS+= ../$f/${FILESNAME} \ .for f in ${LOCALES} FILESDIR_${f}.LC_COLLATE= ${LOCALEDIR}/${f} +FILESDIR_${f}.LC_COLLATEPACKAGE= locales .endfor .for f t in ${LOCALES_MAPPED} FILES+= $t.LC_COLLATE FILESDIR_$t.LC_COLLATE= ${LOCALEDIR}/$t +FILESDIR_${t}.LC_COLLATEPACKAGE= locales $t.LC_COLLATE: ${.CURDIR}/$f.src localedef ${LOCALEDEF_ENDIAN} -D -U -i ${.ALLSRC} \ -V ${CLDR_VERSION} \ diff --git a/share/colldef_unicode/Makefile b/share/colldef_unicode/Makefile index f76a7a94805c..0c1b0488b86d 100644 --- a/share/colldef_unicode/Makefile +++ b/share/colldef_unicode/Makefile @@ -115,11 +115,13 @@ SYMLINKS+= ../$f/${FILESNAME} \ .for f in ${LOCALES} FILESDIR_${f}.LC_COLLATE= ${LOCALEDIR}/${f} +FILESDIR_${f}.LC_COLLATEPACKAGE= locales .endfor .for f t in ${LOCALES_MAPPED} FILES+= $t.LC_COLLATE FILESDIR_$t.LC_COLLATE= ${LOCALEDIR}/$t +FILESDIR_$t.LC_COLLATEPACKAGE= locales $t.LC_COLLATE: ${.CURDIR}/$f.src localedef ${LOCALEDEF_ENDIAN} -D -U -i ${.ALLSRC} \ -V ${CLDR_VERSION} \ diff --git a/share/ctypedef/Makefile b/share/ctypedef/Makefile index a717e94db5e6..798576f7ad08 100644 --- a/share/ctypedef/Makefile +++ b/share/ctypedef/Makefile @@ -231,6 +231,7 @@ SYMLINKS+= ../$f/${FILESNAME} \ .for f in ${LOCALES} FILESDIR_${f}.LC_CTYPE= ${LOCALEDIR}/${f} +FILESDIR_${f}.LC_CTYPEPACKAGE= locales .endfor ALWAYSDIR_C.UTF-8.LC_CTYPE= ${LOCALEDIR}/C.UTF-8 diff --git a/share/monetdef/Makefile b/share/monetdef/Makefile index dd1732bd87c6..4e62cbf4b5e3 100644 --- a/share/monetdef/Makefile +++ b/share/monetdef/Makefile @@ -140,6 +140,7 @@ SYMLINKS+= ../$f/${FILESNAME} \ .for f in ${LOCALES} FILESDIR_${f}.out= ${LOCALEDIR}/${f} +FILESDIR_${f}.outPACKAGE= locales .endfor .include diff --git a/share/monetdef_unicode/Makefile b/share/monetdef_unicode/Makefile index 2ab442ad51b4..4e4d9a6c1a40 100644 --- a/share/monetdef_unicode/Makefile +++ b/share/monetdef_unicode/Makefile @@ -107,6 +107,7 @@ SYMLINKS+= ../$f/${FILESNAME} \ .for f in ${LOCALES} FILESDIR_${f}.out= ${LOCALEDIR}/${f} +FILESDIR_${f}.outPACKAGE= locales .endfor .include diff --git a/share/msgdef/Makefile b/share/msgdef/Makefile index 4cc6a45b46c6..f77f9c0758e0 100644 --- a/share/msgdef/Makefile +++ b/share/msgdef/Makefile @@ -133,6 +133,7 @@ SYMLINKS+= ../$f/${FILESNAME} \ .for f in ${LOCALES} FILESDIR_${f}.out= ${LOCALEDIR}/${f} +FILESDIR_${f}.outPACKAGE= locales .endfor .include diff --git a/share/msgdef_unicode/Makefile b/share/msgdef_unicode/Makefile index 608ba8860afb..78f581608218 100644 --- a/share/msgdef_unicode/Makefile +++ b/share/msgdef_unicode/Makefile @@ -107,6 +107,7 @@ SYMLINKS+= ../$f/${FILESNAME} \ .for f in ${LOCALES} FILESDIR_${f}.out= ${LOCALEDIR}/${f} +FILESDIR_${f}.outPACKAGE= locales .endfor .include diff --git a/share/numericdef/Makefile b/share/numericdef/Makefile index 12cc7dc68ab1..2890978237b3 100644 --- a/share/numericdef/Makefile +++ b/share/numericdef/Makefile @@ -136,6 +136,7 @@ SYMLINKS+= ../$f/${FILESNAME} \ .for f in ${LOCALES} FILESDIR_${f}.out= ${LOCALEDIR}/${f} +FILESDIR_${f}.outPACKAGE= locales .endfor .include diff --git a/share/numericdef_unicode/Makefile b/share/numericdef_unicode/Makefile index 6b7af4799efe..e8c72ac5f6bc 100644 --- a/share/numericdef_unicode/Makefile +++ b/share/numericdef_unicode/Makefile @@ -107,6 +107,7 @@ SYMLINKS+= ../$f/${FILESNAME} \ .for f in ${LOCALES} FILESDIR_${f}.out= ${LOCALEDIR}/${f} +FILESDIR_${f}.outPACKAGE= locales .endfor .include diff --git a/share/timedef/Makefile b/share/timedef/Makefile index c33461ff36bd..af0cd2ea378f 100644 --- a/share/timedef/Makefile +++ b/share/timedef/Makefile @@ -219,6 +219,7 @@ SYMLINKS+= ../$f/${FILESNAME} \ .for f in ${LOCALES} FILESDIR_${f}.out= ${LOCALEDIR}/${f} +FILESDIR_${f}.outPACKAGE= locales .endfor .include From owner-dev-commits-src-all@freebsd.org Fri Aug 6 12:51:12 2021 Return-Path: Delivered-To: dev-commits-src-all@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 F0BC5655D11; Fri, 6 Aug 2021 12:51: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 4Gh5286H4kz4Yx4; Fri, 6 Aug 2021 12:51: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 C0B3162FB; Fri, 6 Aug 2021 12:51:12 +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 176CpCsU017025; Fri, 6 Aug 2021 12:51:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 176CpCAf017024; Fri, 6 Aug 2021 12:51:12 GMT (envelope-from git) Date: Fri, 6 Aug 2021 12:51:12 GMT Message-Id: <202108061251.176CpCAf017024@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andrew Turner Subject: git: 52ec367e70cf - stable/13 - Use the arm virtual counter in the arm64 loader 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 52ec367e70cf55b5eab799c9887605fb58ae7016 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 12:51:13 -0000 The branch stable/13 has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=52ec367e70cf55b5eab799c9887605fb58ae7016 commit 52ec367e70cf55b5eab799c9887605fb58ae7016 Author: Andrew Turner AuthorDate: 2021-05-12 07:45:09 +0000 Commit: Andrew Turner CommitDate: 2021-08-05 20:50:15 +0000 Use the arm virtual counter in the arm64 loader It exist on all ARMv8+ CPUs, and other boot loaders rely on it being present. Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D30410 (cherry picked from commit 0a0d6ce34d6be89cb356c7815648e455fabe3151) --- stand/efi/libefi/Makefile | 5 +-- stand/efi/libefi/time_arm64.c | 72 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+), 2 deletions(-) diff --git a/stand/efi/libefi/Makefile b/stand/efi/libefi/Makefile index e838a5a10ac4..88f6d3fa0826 100644 --- a/stand/efi/libefi/Makefile +++ b/stand/efi/libefi/Makefile @@ -27,9 +27,10 @@ SRCS+= teken.c .if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" SRCS+= time.c -.elif ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "arm" || \ - ${MACHINE_CPUARCH} == "riscv" +.elif ${MACHINE_CPUARCH} == "arm" || ${MACHINE_CPUARCH} == "riscv" SRCS+= time_event.c +.elif ${MACHINE_CPUARCH} == "aarch64" +SRCS+= time_arm64.c .endif # We implement a slightly non-standard %S in that it always takes a diff --git a/stand/efi/libefi/time_arm64.c b/stand/efi/libefi/time_arm64.c new file mode 100644 index 000000000000..baa0f8bfa1ed --- /dev/null +++ b/stand/efi/libefi/time_arm64.c @@ -0,0 +1,72 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2021 Andrew Turner + * + * This work was supported by Innovate UK project 105694, "Digital Security + * by Design (DSbD) Technology Platform Prototype". + * + * 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 + +static uint64_t timer_freq; + +void +efi_time_init(void) +{ + /* Find the timer frequency */ + timer_freq = READ_SPECIALREG(cntfrq_el0); +} + +void +efi_time_fini(void) +{ +} + +time_t +time(time_t *tloc) +{ + time_t t; + + t = READ_SPECIALREG(cntvct_el0) / timer_freq; + if (tloc != NULL) + *tloc = t; + + return (t); +} + +time_t +getsecs(void) +{ + return time(NULL); +} From owner-dev-commits-src-all@freebsd.org Fri Aug 6 12:51:14 2021 Return-Path: Delivered-To: dev-commits-src-all@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 1F0D9655A43; Fri, 6 Aug 2021 12:51:14 +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 4Gh52B0F6fz4YrK; Fri, 6 Aug 2021 12:51: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 E1E9562FC; Fri, 6 Aug 2021 12:51: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 176CpDQU017053; Fri, 6 Aug 2021 12:51:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 176CpDgh017052; Fri, 6 Aug 2021 12:51:13 GMT (envelope-from git) Date: Fri, 6 Aug 2021 12:51:13 GMT Message-Id: <202108061251.176CpDgh017052@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andrew Turner Subject: git: acab6815aa38 - stable/13 - Use the correct length when copying arm64 vfp registers 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/stable/13 X-Git-Reftype: branch X-Git-Commit: acab6815aa389911939fee92f7fe98f1d63b741c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 12:51:14 -0000 The branch stable/13 has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=acab6815aa389911939fee92f7fe98f1d63b741c commit acab6815aa389911939fee92f7fe98f1d63b741c Author: Andrew Turner AuthorDate: 2021-06-14 11:01:46 +0000 Commit: Andrew Turner CommitDate: 2021-08-05 20:50:15 +0000 Use the correct length when copying arm64 vfp registers We passed the wrong length into memcpy in the arm64 get_fpcontext and set_fpcontext. This caused us to copy two status registers we didn't expect to copy. These are safe as they exist in both the source and destination, although in a different order, and we copy the correct values after the memcpy. Obtained from: CheriBSD Sponsored by: Innovate UK (cherry picked from commit e7f369b1c18ca0377bb0b016b4cab3f0de2a74c5) --- sys/arm64/arm64/machdep.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/arm64/arm64/machdep.c b/sys/arm64/arm64/machdep.c index 5cc17d2a4612..071bf3e51ab2 100644 --- a/sys/arm64/arm64/machdep.c +++ b/sys/arm64/arm64/machdep.c @@ -650,7 +650,7 @@ get_fpcontext(struct thread *td, mcontext_t *mcp) KASSERT((curpcb->pcb_fpflags & ~PCB_FP_USERMASK) == 0, ("Non-userspace FPU flags set in get_fpcontext")); memcpy(mcp->mc_fpregs.fp_q, curpcb->pcb_fpustate.vfp_regs, - sizeof(mcp->mc_fpregs)); + sizeof(mcp->mc_fpregs.fp_q)); mcp->mc_fpregs.fp_cr = curpcb->pcb_fpustate.vfp_fpcr; mcp->mc_fpregs.fp_sr = curpcb->pcb_fpustate.vfp_fpsr; mcp->mc_fpregs.fp_flags = curpcb->pcb_fpflags; @@ -681,7 +681,7 @@ set_fpcontext(struct thread *td, mcontext_t *mcp) KASSERT(curpcb->pcb_fpusaved == &curpcb->pcb_fpustate, ("Called set_fpcontext while the kernel is using the VFP")); memcpy(curpcb->pcb_fpustate.vfp_regs, mcp->mc_fpregs.fp_q, - sizeof(mcp->mc_fpregs)); + sizeof(mcp->mc_fpregs.fp_q)); curpcb->pcb_fpustate.vfp_fpcr = mcp->mc_fpregs.fp_cr; curpcb->pcb_fpustate.vfp_fpsr = mcp->mc_fpregs.fp_sr; curpcb->pcb_fpflags = mcp->mc_fpregs.fp_flags & PCB_FP_USERMASK; From owner-dev-commits-src-all@freebsd.org Fri Aug 6 12:51:15 2021 Return-Path: Delivered-To: dev-commits-src-all@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 80937655D45; Fri, 6 Aug 2021 12:51: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 4Gh52C2LVFz4YmL; Fri, 6 Aug 2021 12:51: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 253F95DC1; Fri, 6 Aug 2021 12:51: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 176CpErb017077; Fri, 6 Aug 2021 12:51:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 176CpE0L017076; Fri, 6 Aug 2021 12:51:14 GMT (envelope-from git) Date: Fri, 6 Aug 2021 12:51:14 GMT Message-Id: <202108061251.176CpE0L017076@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andrew Turner Subject: git: 24a9a22bc7d0 - stable/13 - Add more GIC and GICv3 registers 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 24a9a22bc7d0f639c0e30a0c8dc9b6eecfda3714 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 12:51:15 -0000 The branch stable/13 has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=24a9a22bc7d0f639c0e30a0c8dc9b6eecfda3714 commit 24a9a22bc7d0f639c0e30a0c8dc9b6eecfda3714 Author: Andrew Turner AuthorDate: 2021-06-14 12:48:53 +0000 Commit: Andrew Turner CommitDate: 2021-08-05 20:50:16 +0000 Add more GIC and GICv3 registers These aren't used by either driver, however they will be needed by bhyve on arm64 to emulate a GICv3 interrupt controller. Sponsored by: Innovate UK (cherry picked from commit 15fa52a56494d050c4b8e1535d98e2fd416f1944) --- sys/arm/arm/gic_common.h | 4 +- sys/arm64/arm64/gic_v3.c | 1 - sys/arm64/arm64/gic_v3_reg.h | 122 +++++++++++++++++++++++++++++++++++-------- 3 files changed, 103 insertions(+), 24 deletions(-) diff --git a/sys/arm/arm/gic_common.h b/sys/arm/arm/gic_common.h index 6643496afc38..4289146b0086 100644 --- a/sys/arm/arm/gic_common.h +++ b/sys/arm/arm/gic_common.h @@ -56,6 +56,7 @@ __BUS_ACCESSOR(gic, bus, GIC, BUS, u_int); /* Common register values */ #define GICD_CTLR 0x0000 /* v1 ICDDCR */ #define GICD_TYPER 0x0004 /* v1 ICDICTR */ +#define GICD_TYPER_ITLINESNUM_MASK 0x1f #define GICD_TYPER_I_NUM(n) ((((n) & 0x1F) + 1) * 32) #define GICD_IIDR 0x0008 /* v1 ICDIIDR */ #define GICD_IIDR_PROD_SHIFT 24 @@ -82,7 +83,8 @@ __BUS_ACCESSOR(gic, bus, GIC, BUS, u_int); #define GICD_ICENABLER(n) (0x0180 + (((n) >> 5) * 4)) /* v1 ICDICER */ #define GICD_ISPENDR(n) (0x0200 + (((n) >> 5) * 4)) /* v1 ICDISPR */ #define GICD_ICPENDR(n) (0x0280 + (((n) >> 5) * 4)) /* v1 ICDICPR */ -#define GICD_ICACTIVER(n) (0x0380 + (((n) >> 5) * 4)) /* v1 ICDABR */ +#define GICD_ISACTIVER(n) (0x0300 + (((n) >> 5) * 4)) /* v1 ICDABR */ +#define GICD_ICACTIVER(n) (0x0380 + (((n) >> 5) * 4)) #define GICD_IPRIORITYR(n) (0x0400 + (((n) >> 2) * 4)) /* v1 ICDIPR */ #define GICD_I_PER_IPRIORITYn 4 #define GICD_ITARGETSR(n) (0x0800 + (((n) >> 2) * 4)) /* v1 ICDIPTR */ diff --git a/sys/arm64/arm64/gic_v3.c b/sys/arm64/arm64/gic_v3.c index 954ed3cd878a..03b6490e7d61 100644 --- a/sys/arm64/arm64/gic_v3.c +++ b/sys/arm64/arm64/gic_v3.c @@ -1462,7 +1462,6 @@ gic_v3_map_msi(device_t dev, device_t child, struct intr_irqsrc *isrc, struct gic_v3_softc *sc = device_get_softc(dev); struct gic_v3_irqsrc *gi = (struct gic_v3_irqsrc *)isrc; -#define GICD_SETSPI_NSR 0x40 *addr = vtophys(rman_get_virtual(sc->gic_dist)) + GICD_SETSPI_NSR; *data = gi->gi_irq; diff --git a/sys/arm64/arm64/gic_v3_reg.h b/sys/arm64/arm64/gic_v3_reg.h index 34082b1bde0a..2ba35ec9dab3 100644 --- a/sys/arm64/arm64/gic_v3_reg.h +++ b/sys/arm64/arm64/gic_v3_reg.h @@ -57,13 +57,33 @@ #define GICD_CTLR_G1A (1 << 1) #define GICD_CTLR_ARE_NS (1 << 4) #define GICD_CTLR_RWP (1 << 31) + /* GICD_TYPER */ +#define GICD_TYPER_SECURITYEXTN (1 << 10) +#define GICD_TYPER_MBIS (1 << 16) +#define GICD_TYPER_LPIS (1 << 17) +#define GICD_TYPER_DVIS (1 << 18) +#define GICD_TYPER_IDBITS_SHIFT 19 #define GICD_TYPER_IDBITS(n) ((((n) >> 19) & 0x1F) + 1) /* * Registers (v3) */ +#define GICD_STATUSR 0x0010 + +#define GICD_SETSPI_NSR 0x0040 +#define GICD_CLRSPI_NSR 0x0048 +#define GICD_SETSPI_SR 0x0050 +#define GICD_CLRSPI_SR 0x0058 +#define GICD_SPI_INTID_MASK 0x3ff + #define GICD_IROUTER(n) (0x6000 + ((n) * 8)) +#define GICD_AFF3 (0xfful << 32) +#define GICD_IROUTER_IRM (1ul << 31) +#define GICD_AFF2 (0xfful << 16) +#define GICD_AFF1 (0xfful << 8) +#define GICD_AFF0 (0xfful << 0) +#define GICD_AFF (GICD_AFF0 | GICD_AFF1 | GICD_AFF1 | GICD_AFF3) #define GICD_PIDR4 0xFFD0 #define GICD_PIDR5 0xFFD4 @@ -73,6 +93,8 @@ #define GICD_PIDR1 0xFFE4 #define GICD_PIDR2 0xFFE8 +#define GICD_SIZE 0x10000 + #define GICR_PIDR2_ARCH_SHIFT 4 #define GICR_PIDR2_ARCH_MASK 0xF0 #define GICR_PIDR2_ARCH(x) \ @@ -82,27 +104,44 @@ #define GICD_PIDR3 0xFFEC -/* Redistributor registers */ -#define GICR_CTLR GICD_CTLR -#define GICR_CTLR_LPI_ENABLE (1 << 0) - -#define GICR_PIDR2 GICD_PIDR2 +/* + * Redistributor registers + */ -#define GICR_TYPER (0x0008) -#define GICR_TYPER_PLPIS (1 << 0) -#define GICR_TYPER_VLPIS (1 << 1) -#define GICR_TYPER_LAST (1 << 4) -#define GICR_TYPER_CPUNUM_SHIFT (8) -#define GICR_TYPER_CPUNUM_MASK (0xFFFUL << GICR_TYPER_CPUNUM_SHIFT) -#define GICR_TYPER_CPUNUM(x) \ +/* RD_base registers */ +#define GICR_CTLR 0x0000 +#define GICR_CTLR_LPI_ENABLE (1 << 0) +#define GICR_CTLR_RWP (1 << 3) +#define GICR_CTLR_DPG0 (1 << 24) +#define GICR_CTLR_DPG1NS (1 << 25) +#define GICR_CTLR_DPG1S (1 << 26) +#define GICR_CTLR_UWP (1 << 31) + +#define GICR_IIDR 0x0004 + +#define GICR_TYPER 0x0008 +#define GICR_TYPER_PLPIS (1 << 0) +#define GICR_TYPER_VLPIS (1 << 1) +#define GICR_TYPER_LAST (1 << 4) +#define GICR_TYPER_CPUNUM_SHIFT (8) +#define GICR_TYPER_CPUNUM_MASK (0xFFFUL << GICR_TYPER_CPUNUM_SHIFT) +#define GICR_TYPER_CPUNUM(x) \ (((x) & GICR_TYPER_CPUNUM_MASK) >> GICR_TYPER_CPUNUM_SHIFT) -#define GICR_TYPER_AFF_SHIFT (32) +#define GICR_TYPER_AFF_SHIFT 32 +#define GICR_TYPER_AFF_MASK (0xfffffffful << GICR_TYPER_AFF_SHIFT) +#define GICR_TYPER_AFF(x) \ + (((x) & GICR_TYPER_AFF_MASK) >> GICR_TYPER_AFF_SHIFT) -#define GICR_WAKER (0x0014) +#define GICR_STATUSR 0x0010 + +#define GICR_WAKER 0x0014 #define GICR_WAKER_PS (1 << 1) /* Processor sleep */ #define GICR_WAKER_CA (1 << 2) /* Children asleep */ -#define GICR_PROPBASER (0x0070) +#define GICR_SETLPIR 0x0040 +#define GICR_CLRLPIR 0x0048 + +#define GICR_PROPBASER 0x0070 #define GICR_PROPBASER_IDBITS_MASK 0x1FUL /* * Cacheability @@ -142,7 +181,11 @@ #define GICR_PROPBASER_SHARE_MASK \ (0x3UL << GICR_PROPBASER_SHARE_SHIFT) -#define GICR_PENDBASER (0x0078) +#define GICR_PROPBASER_OUTER_CACHE_SHIFT 56 +#define GICR_PROPBASER_OUTER_CACHE_MASK \ + (0x7UL << GICR_PROPBASER_OUTER_CACHE_SHIFT) + +#define GICR_PENDBASER 0x0078 /* * Cacheability * 0x0 - Device-nGnRnE @@ -181,12 +224,17 @@ #define GICR_PENDBASER_SHARE_MASK \ (0x3UL << GICR_PENDBASER_SHARE_SHIFT) -/* Re-distributor registers for SGIs and PPIs */ -#define GICR_RD_BASE_SIZE PAGE_SIZE_64K -#define GICR_SGI_BASE_SIZE PAGE_SIZE_64K -#define GICR_VLPI_BASE_SIZE PAGE_SIZE_64K -#define GICR_RESERVED_SIZE PAGE_SIZE_64K +#define GICR_PENDBASER_OUTER_CACHE_SHIFT 56 +#define GICR_PENDBASER_OUTER_CACHE_MASK \ + (0x7UL << GICR_PENDBASER_OUTER_CACHE_SHIFT) + +#define GICR_INVLPIR 0x00a0 +#define GICR_INVALLR 0x00b0 +#define GICR_SYNCR 0x00c0 + +#define GICR_PIDR2 GICD_PIDR2 +/* SGI_base registers */ #define GICR_IGROUPR0 (0x0080) #define GICR_ISENABLER0 (0x0100) #define GICR_ICENABLER0 (0x0180) @@ -195,7 +243,28 @@ #define GICR_I_PER_IPRIORITYn (GICD_I_PER_IPRIORITYn) -/* ITS registers */ +#define GICR_ISPENDR0 0x0200 +#define GICR_ICPENDR0 0x0280 +#define GICR_ISACTIVER0 0x0300 +#define GICR_ICACTIVER0 0x0380 +#define GICR_IPRIORITYR(n) (0x0400 + (((n) >> 2) * 4)) +#define GICR_ICFGR0 0x0c00 +#define GICR_ICFGR1 0x0c04 +#define GICR_IGRPMODR0 0x0d00 +#define GICR_NSACR 0x0e00 + +/* Re-distributor registers for SGIs and PPIs */ +#define GICR_RD_BASE 0 +#define GICR_RD_BASE_SIZE PAGE_SIZE_64K +#define GICR_SGI_BASE (1 * PAGE_SIZE_64K) +#define GICR_SGI_BASE_SIZE PAGE_SIZE_64K +#define GICR_VLPI_BASE (2 * PAGE_SIZE_64K) +#define GICR_VLPI_BASE_SIZE PAGE_SIZE_64K +#define GICR_RESERVED_SIZE PAGE_SIZE_64K + +/* + * ITS registers + */ #define GITS_PIDR2 GICR_PIDR2 #define GITS_PIDR2_ARCH_MASK GICR_PIDR2_ARCH_MASK #define GITS_PIDR2_ARCH_GICv3 GICR_PIDR2_ARCH_GICv3 @@ -266,9 +335,17 @@ #define GITS_CBASER_PA_SHIFT 12 #define GITS_CBASER_PA_MASK (0xFFFFFFFFFUL << GITS_CBASER_PA_SHIFT) +#define GITS_CBASER_SIZE_SHIFT 0 +#define GITS_CBASER_SIZE_MASK (0xFF << GITS_CBASER_SIZE_SHIFT) +#define GITS_CBASER_SIZE(x) \ + (4096 * (((x) & GITS_CBASER_SIZE_MASK) + 1)) #define GITS_CWRITER (0x0088) #define GITS_CREADR (0x0090) +#define GITS_CREADR_STALL 1ul + +#define GITS_CMD_OFFSET(reg) ((reg) & 0xfffe0ul) +#define GITS_CMD_SIZE 0x20 #define GITS_BASER_BASE (0x0100) #define GITS_BASER(x) (GITS_BASER_BASE + (x) * 8) @@ -342,6 +419,7 @@ #define GITS_BASER_NUM 8 #define GITS_TYPER (0x0008) +#define GITS_TYPER_HCC_SHIFT 24 #define GITS_TYPER_PTA (1UL << 19) #define GITS_TYPER_DEVB_SHIFT 13 #define GITS_TYPER_DEVB_MASK (0x1FUL << GITS_TYPER_DEVB_SHIFT) From owner-dev-commits-src-all@freebsd.org Fri Aug 6 12:51:16 2021 Return-Path: Delivered-To: dev-commits-src-all@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 D975E655A45; Fri, 6 Aug 2021 12:51: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 4Gh52D21xnz4YrS; Fri, 6 Aug 2021 12:51: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 2C37F6306; Fri, 6 Aug 2021 12:51: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 176CpG4L017101; Fri, 6 Aug 2021 12:51:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 176CpGDY017100; Fri, 6 Aug 2021 12:51:16 GMT (envelope-from git) Date: Fri, 6 Aug 2021 12:51:16 GMT Message-Id: <202108061251.176CpGDY017100@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andrew Turner Subject: git: 55dbd744b374 - stable/13 - Switch the order of the ID_AA64PFR1_EL1 fields 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 55dbd744b37410e34410b121d6c0438fcbc3df70 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 12:51:17 -0000 The branch stable/13 has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=55dbd744b37410e34410b121d6c0438fcbc3df70 commit 55dbd744b37410e34410b121d6c0438fcbc3df70 Author: Andrew Turner AuthorDate: 2021-07-01 00:45:39 +0000 Commit: Andrew Turner CommitDate: 2021-08-05 20:50:17 +0000 Switch the order of the ID_AA64PFR1_EL1 fields This makes them consistent with the fields in other registers. Sponsored by: The FreeBSD Foundation (cherry picked from commit 244002b48257a8e4d3b4772872981c0d7a467923) --- sys/arm64/arm64/identcpu.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/sys/arm64/arm64/identcpu.c b/sys/arm64/arm64/identcpu.c index 5dc3a91031b6..88d925f8162a 100644 --- a/sys/arm64/arm64/identcpu.c +++ b/sys/arm64/arm64/identcpu.c @@ -901,9 +901,10 @@ static struct mrs_field id_aa64pfr0_fields[] = { /* ID_AA64PFR1_EL1 */ -static struct mrs_field_value id_aa64pfr1_bt[] = { - MRS_FIELD_VALUE(ID_AA64PFR1_BT_NONE, ""), - MRS_FIELD_VALUE(ID_AA64PFR1_BT_IMPL, "BTI"), +static struct mrs_field_value id_aa64pfr1_mte[] = { + MRS_FIELD_VALUE(ID_AA64PFR1_MTE_NONE, ""), + MRS_FIELD_VALUE(ID_AA64PFR1_MTE_IMPL_EL0, "MTE EL0"), + MRS_FIELD_VALUE(ID_AA64PFR1_MTE_IMPL, "MTE"), MRS_FIELD_VALUE_END, }; @@ -914,17 +915,16 @@ static struct mrs_field_value id_aa64pfr1_ssbs[] = { MRS_FIELD_VALUE_END, }; -static struct mrs_field_value id_aa64pfr1_mte[] = { - MRS_FIELD_VALUE(ID_AA64PFR1_MTE_NONE, ""), - MRS_FIELD_VALUE(ID_AA64PFR1_MTE_IMPL_EL0, "MTE EL0"), - MRS_FIELD_VALUE(ID_AA64PFR1_MTE_IMPL, "MTE"), +static struct mrs_field_value id_aa64pfr1_bt[] = { + MRS_FIELD_VALUE(ID_AA64PFR1_BT_NONE, ""), + MRS_FIELD_VALUE(ID_AA64PFR1_BT_IMPL, "BTI"), MRS_FIELD_VALUE_END, }; static struct mrs_field id_aa64pfr1_fields[] = { - MRS_FIELD(ID_AA64PFR1, BT, false, MRS_EXACT, id_aa64pfr1_bt), - MRS_FIELD(ID_AA64PFR1, SSBS, false, MRS_LOWER, id_aa64pfr1_ssbs), MRS_FIELD(ID_AA64PFR1, MTE, false, MRS_EXACT, id_aa64pfr1_mte), + MRS_FIELD(ID_AA64PFR1, SSBS, false, MRS_LOWER, id_aa64pfr1_ssbs), + MRS_FIELD(ID_AA64PFR1, BT, false, MRS_EXACT, id_aa64pfr1_bt), MRS_FIELD_END, }; From owner-dev-commits-src-all@freebsd.org Fri Aug 6 12:51:17 2021 Return-Path: Delivered-To: dev-commits-src-all@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 8ADBE655563; Fri, 6 Aug 2021 12:51: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 4Gh52F3VT6z4YpM; Fri, 6 Aug 2021 12:51: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 5C85261A9; Fri, 6 Aug 2021 12:51: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 176CpHR7017125; Fri, 6 Aug 2021 12:51:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 176CpHk5017124; Fri, 6 Aug 2021 12:51:17 GMT (envelope-from git) Date: Fri, 6 Aug 2021 12:51:17 GMT Message-Id: <202108061251.176CpHk5017124@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andrew Turner Subject: git: 7d51b5257a66 - stable/13 - 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 7d51b5257a667476cc9e3471b5bc73b50d103e9b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 12:51:17 -0000 The branch stable/13 has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=7d51b5257a667476cc9e3471b5bc73b50d103e9b commit 7d51b5257a667476cc9e3471b5bc73b50d103e9b Author: Andrew Turner AuthorDate: 2021-07-01 01:14:09 +0000 Commit: Andrew Turner CommitDate: 2021-08-05 20:50:18 +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 (cherry picked from commit a7b05eb16c9d84e1fd59864f5da67d23897ed91c) --- 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 88d925f8162a..2cd5b914ddef 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 81cea5431017..d22da16ffc42 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-all@freebsd.org Fri Aug 6 12:51:18 2021 Return-Path: Delivered-To: dev-commits-src-all@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 D08966559CC; Fri, 6 Aug 2021 12:51:18 +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 4Gh52G5KZmz4Yvd; Fri, 6 Aug 2021 12:51:18 +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 8746662FE; Fri, 6 Aug 2021 12:51:18 +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 176CpIgg017149; Fri, 6 Aug 2021 12:51:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 176CpIEF017148; Fri, 6 Aug 2021 12:51:18 GMT (envelope-from git) Date: Fri, 6 Aug 2021 12:51:18 GMT Message-Id: <202108061251.176CpIEF017148@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andrew Turner Subject: git: 41a3f6bb9d81 - stable/13 - 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 41a3f6bb9d81d26afa8d0166840b4ae01899fba5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 12:51:19 -0000 The branch stable/13 has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=41a3f6bb9d81d26afa8d0166840b4ae01899fba5 commit 41a3f6bb9d81d26afa8d0166840b4ae01899fba5 Author: Andrew Turner AuthorDate: 2021-07-07 23:12:50 +0000 Commit: Andrew Turner CommitDate: 2021-08-05 20:50:19 +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 (cherry picked from commit c0edde3021900b80fec4e6360d97ba9d9e50d4fd) --- 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 48dd794116cd..50b064ab391a 100644 --- a/sys/arm64/arm64/locore.S +++ b/sys/arm64/arm64/locore.S @@ -748,7 +748,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 d22da16ffc42..ba9345c036f9 100644 --- a/sys/arm64/include/armreg.h +++ b/sys/arm64/include/armreg.h @@ -830,7 +830,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-all@freebsd.org Fri Aug 6 12:51:19 2021 Return-Path: Delivered-To: dev-commits-src-all@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 F2A60655A4B; Fri, 6 Aug 2021 12:51: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 4Gh52H5ndNz4Yvm; Fri, 6 Aug 2021 12:51: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 A813960C2; Fri, 6 Aug 2021 12:51: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 176CpJBd017179; Fri, 6 Aug 2021 12:51:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 176CpJQF017178; Fri, 6 Aug 2021 12:51:19 GMT (envelope-from git) Date: Fri, 6 Aug 2021 12:51:19 GMT Message-Id: <202108061251.176CpJQF017178@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andrew Turner Subject: git: 7bc993854162 - stable/13 - 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 7bc993854162d38b37f52ce8c7dc2fce1d17a222 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 12:51:20 -0000 The branch stable/13 has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=7bc993854162d38b37f52ce8c7dc2fce1d17a222 commit 7bc993854162d38b37f52ce8c7dc2fce1d17a222 Author: Andrew Turner AuthorDate: 2021-07-08 15:25:38 +0000 Commit: Andrew Turner CommitDate: 2021-08-05 20:50:20 +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 (cherry picked from commit 1472117a1e1c40f10b9c3a48788fbf8355588ee8) --- 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-all@freebsd.org Fri Aug 6 12:51:21 2021 Return-Path: Delivered-To: dev-commits-src-all@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 33E12655AC4; Fri, 6 Aug 2021 12:51: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 4Gh52J6ZT8z4Ymp; Fri, 6 Aug 2021 12:51: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 C511461AB; Fri, 6 Aug 2021 12:51: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 176CpKRo017203; Fri, 6 Aug 2021 12:51:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 176CpKgg017202; Fri, 6 Aug 2021 12:51:20 GMT (envelope-from git) Date: Fri, 6 Aug 2021 12:51:20 GMT Message-Id: <202108061251.176CpKgg017202@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andrew Turner Subject: git: 535a5779e2c4 - stable/13 - Update the arm64 HCR_EL2 registers 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 535a5779e2c43d11ce444456e8a3fffb84991835 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 12:51:21 -0000 The branch stable/13 has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=535a5779e2c43d11ce444456e8a3fffb84991835 commit 535a5779e2c43d11ce444456e8a3fffb84991835 Author: Andrew Turner AuthorDate: 2021-07-07 11:51:40 +0000 Commit: Andrew Turner CommitDate: 2021-08-05 20:50:21 +0000 Update the arm64 HCR_EL2 registers They are valid as of the ARMv8.7 XML. While here switch to use shifted values as they are easier to compare with values in the Arm Reference Manual. Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31093 (cherry picked from commit 3c1bfadaf93da6ec0291a7dc7dc7690ef6611619) --- sys/arm64/include/hypervisor.h | 113 ++++++++++++++++++++++++----------------- 1 file changed, 66 insertions(+), 47 deletions(-) diff --git a/sys/arm64/include/hypervisor.h b/sys/arm64/include/hypervisor.h index eab43b29a89e..e8599cb30f3f 100644 --- a/sys/arm64/include/hypervisor.h +++ b/sys/arm64/include/hypervisor.h @@ -1,6 +1,9 @@ /*- * Copyright (c) 2013, 2014 Andrew Turner - * All rights reserved. + * Copyright (c) 2021 The FreeBSD Foundation + * + * Portions of this software were developed by Andrew Turner + * 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 @@ -49,53 +52,69 @@ #define CPTR_TCPAC 0x80000000 /* HCR_EL2 - Hypervisor Config Register */ -#define HCR_VM 0x0000000000000001 -#define HCR_SWIO 0x0000000000000002 -#define HCR_PTW 0x0000000000000004 -#define HCR_FMO 0x0000000000000008 -#define HCR_IMO 0x0000000000000010 -#define HCR_AMO 0x0000000000000020 -#define HCR_VF 0x0000000000000040 -#define HCR_VI 0x0000000000000080 -#define HCR_VSE 0x0000000000000100 -#define HCR_FB 0x0000000000000200 -#define HCR_BSU_MASK 0x0000000000000c00 -#define HCR_BSU_IS 0x0000000000000400 -#define HCR_BSU_OS 0x0000000000000800 -#define HCR_BSU_FS 0x0000000000000c00 -#define HCR_DC 0x0000000000001000 -#define HCR_TWI 0x0000000000002000 -#define HCR_TWE 0x0000000000004000 -#define HCR_TID0 0x0000000000008000 -#define HCR_TID1 0x0000000000010000 -#define HCR_TID2 0x0000000000020000 -#define HCR_TID3 0x0000000000040000 -#define HCR_TSC 0x0000000000080000 -#define HCR_TIDCP 0x0000000000100000 -#define HCR_TACR 0x0000000000200000 -#define HCR_TSW 0x0000000000400000 -#define HCR_TPCP 0x0000000000800000 -#define HCR_TPU 0x0000000001000000 -#define HCR_TTLB 0x0000000002000000 -#define HCR_TVM 0x0000000004000000 -#define HCR_TGE 0x0000000008000000 -#define HCR_TDZ 0x0000000010000000 -#define HCR_HCD 0x0000000020000000 -#define HCR_TRVM 0x0000000040000000 -#define HCR_RW 0x0000000080000000 -#define HCR_CD 0x0000000100000000 -#define HCR_ID 0x0000000200000000 -#define HCR_E2H 0x0000000400000000 -#define HCR_TLOR 0x0000000800000000 -#define HCR_TERR 0x0000001000000000 -#define HCR_TEA 0x0000002000000000 -#define HCR_MIOCNCE 0x0000004000000000 +#define HCR_VM (UL(0x1) << 0) +#define HCR_SWIO (UL(0x1) << 1) +#define HCR_PTW (UL(0x1) << 2) +#define HCR_FMO (UL(0x1) << 3) +#define HCR_IMO (UL(0x1) << 4) +#define HCR_AMO (UL(0x1) << 5) +#define HCR_VF (UL(0x1) << 6) +#define HCR_VI (UL(0x1) << 7) +#define HCR_VSE (UL(0x1) << 8) +#define HCR_FB (UL(0x1) << 9) +#define HCR_BSU_MASK (UL(0x3) << 10) +#define HCR_BSU_IS (UL(0x1) << 10) +#define HCR_BSU_OS (UL(0x2) << 10) +#define HCR_BSU_FS (UL(0x3) << 10) +#define HCR_DC (UL(0x1) << 12) +#define HCR_TWI (UL(0x1) << 13) +#define HCR_TWE (UL(0x1) << 14) +#define HCR_TID0 (UL(0x1) << 15) +#define HCR_TID1 (UL(0x1) << 16) +#define HCR_TID2 (UL(0x1) << 17) +#define HCR_TID3 (UL(0x1) << 18) +#define HCR_TSC (UL(0x1) << 19) +#define HCR_TIDCP (UL(0x1) << 20) +#define HCR_TACR (UL(0x1) << 21) +#define HCR_TSW (UL(0x1) << 22) +#define HCR_TPCP (UL(0x1) << 23) +#define HCR_TPU (UL(0x1) << 24) +#define HCR_TTLB (UL(0x1) << 25) +#define HCR_TVM (UL(0x1) << 26) +#define HCR_TGE (UL(0x1) << 27) +#define HCR_TDZ (UL(0x1) << 28) +#define HCR_HCD (UL(0x1) << 29) +#define HCR_TRVM (UL(0x1) << 30) +#define HCR_RW (UL(0x1) << 31) +#define HCR_CD (UL(0x1) << 32) +#define HCR_ID (UL(0x1) << 33) +#define HCR_E2H (UL(0x1) << 34) +#define HCR_TLOR (UL(0x1) << 35) +#define HCR_TERR (UL(0x1) << 36) +#define HCR_TEA (UL(0x1) << 37) +#define HCR_MIOCNCE (UL(0x1) << 38) /* Bit 39 is reserved */ -#define HCR_APK 0x0000010000000000 -#define HCR_API 0x0000020000000000 -#define HCR_NV 0x0000040000000000 -#define HCR_NV1 0x0000080000000000 -#define HCR_AT 0x0000100000000000 +#define HCR_APK (UL(0x1) << 40) +#define HCR_API (UL(0x1) << 41) +#define HCR_NV (UL(0x1) << 42) +#define HCR_NV1 (UL(0x1) << 43) +#define HCR_AT (UL(0x1) << 44) +#define HCR_NV2 (UL(0x1) << 45) +#define HCR_FWB (UL(0x1) << 46) +#define HCR_FIEN (UL(0x1) << 47) +/* Bit 48 is reserved */ +#define HCR_TID4 (UL(0x1) << 49) +#define HCR_TICAB (UL(0x1) << 50) +#define HCR_AMVOFFEN (UL(0x1) << 51) +#define HCR_TOCU (UL(0x1) << 52) +#define HCR_EnSCXT (UL(0x1) << 53) +#define HCR_TTLBIS (UL(0x1) << 54) +#define HCR_TTLBOS (UL(0x1) << 55) +#define HCR_ATA (UL(0x1) << 56) +#define HCR_DCT (UL(0x1) << 57) +#define HCR_TID5 (UL(0x1) << 58) +#define HCR_TWEDEn (UL(0x1) << 59) +#define HCR_TWEDEL_MASK (UL(0xf) << 60) /* HPFAR_EL2 - Hypervisor IPA Fault Address Register */ #define HPFAR_EL2_FIPA_SHIFT 4 From owner-dev-commits-src-all@freebsd.org Fri Aug 6 12:51:22 2021 Return-Path: Delivered-To: dev-commits-src-all@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 37B5B655C61; Fri, 6 Aug 2021 12:51: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 4Gh52L0h7Kz4Ymx; Fri, 6 Aug 2021 12:51: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 EA40A620A; Fri, 6 Aug 2021 12:51: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 176CpLpr017227; Fri, 6 Aug 2021 12:51:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 176CpLnO017226; Fri, 6 Aug 2021 12:51:21 GMT (envelope-from git) Date: Fri, 6 Aug 2021 12:51:21 GMT Message-Id: <202108061251.176CpLnO017226@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andrew Turner Subject: git: 59c17fae900d - stable/13 - Update the SCTLR_EL1 register definitions 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 59c17fae900de697e44f7c22c5cceb6af3c1e66a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 12:51:22 -0000 The branch stable/13 has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=59c17fae900de697e44f7c22c5cceb6af3c1e66a commit 59c17fae900de697e44f7c22c5cceb6af3c1e66a Author: Andrew Turner AuthorDate: 2021-07-08 12:14:56 +0000 Commit: Andrew Turner CommitDate: 2021-08-05 20:50:21 +0000 Update the SCTLR_EL1 register definitions They are valid as of the ARMv8.7 XML. While here remove SCTLR_RES0 as it's unused and depends on which CPU the kernel is running on and switch to shifted values as they are easier to compare with the documentation. Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31120 (cherry picked from commit 5484e6d9cc5801e02cba1bf4b9a03ff2e75fa587) --- sys/arm64/include/armreg.h | 87 ++++++++++++++++++++++++++-------------------- 1 file changed, 50 insertions(+), 37 deletions(-) diff --git a/sys/arm64/include/armreg.h b/sys/arm64/include/armreg.h index ba9345c036f9..9521b0826064 100644 --- a/sys/arm64/include/armreg.h +++ b/sys/arm64/include/armreg.h @@ -1,10 +1,9 @@ /*- * Copyright (c) 2013, 2014 Andrew Turner - * Copyright (c) 2015 The FreeBSD Foundation - * All rights reserved. + * Copyright (c) 2015,2021 The FreeBSD Foundation * - * This software was developed by Andrew Turner under - * sponsorship from the FreeBSD Foundation. + * Portions of this software were developed by Andrew Turner + * 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 @@ -803,41 +802,55 @@ #define PAR_S_MASK (0x1 << PAR_S_SHIFT) /* SCTLR_EL1 - System Control Register */ -#define SCTLR_RES0 0xc8222440 /* Reserved ARMv8.0, write 0 */ #define SCTLR_RES1 0x30d00800 /* Reserved ARMv8.0, write 1 */ - -#define SCTLR_M 0x00000001 -#define SCTLR_A 0x00000002 -#define SCTLR_C 0x00000004 -#define SCTLR_SA 0x00000008 -#define SCTLR_SA0 0x00000010 -#define SCTLR_CP15BEN 0x00000020 -/* Bit 6 is reserved */ -#define SCTLR_ITD 0x00000080 -#define SCTLR_SED 0x00000100 -#define SCTLR_UMA 0x00000200 -/* Bit 10 is reserved */ -/* Bit 11 is reserved */ -#define SCTLR_I 0x00001000 -#define SCTLR_EnDB 0x00002000 /* ARMv8.3 */ -#define SCTLR_DZE 0x00004000 -#define SCTLR_UCT 0x00008000 -#define SCTLR_nTWI 0x00010000 +#define SCTLR_M (UL(0x1) << 0) +#define SCTLR_A (UL(0x1) << 1) +#define SCTLR_C (UL(0x1) << 2) +#define SCTLR_SA (UL(0x1) << 3) +#define SCTLR_SA0 (UL(0x1) << 4) +#define SCTLR_CP15BEN (UL(0x1) << 5) +#define SCTLR_nAA (UL(0x1) << 6) +#define SCTLR_ITD (UL(0x1) << 7) +#define SCTLR_SED (UL(0x1) << 8) +#define SCTLR_UMA (UL(0x1) << 9) +#define SCTLR_EnRCTX (UL(0x1) << 10) +#define SCTLR_EOS (UL(0x1) << 11) +#define SCTLR_I (UL(0x1) << 12) +#define SCTLR_EnDB (UL(0x1) << 13) +#define SCTLR_DZE (UL(0x1) << 14) +#define SCTLR_UCT (UL(0x1) << 15) +#define SCTLR_nTWI (UL(0x1) << 16) /* Bit 17 is reserved */ -#define SCTLR_nTWE 0x00040000 -#define SCTLR_WXN 0x00080000 -/* Bit 20 is reserved */ -#define SCTLR_IESB 0x00200000 /* ARMv8.2 */ -/* Bit 22 is reserved */ -#define SCTLR_SPAN 0x00800000 /* ARMv8.1 */ -#define SCTLR_E0E 0x01000000 -#define SCTLR_EE 0x02000000 -#define SCTLR_UCI 0x04000000 -#define SCTLR_EnDA 0x08000000 /* ARMv8.3 */ -#define SCTLR_nTLSMD 0x10000000 /* ARMv8.2 */ -#define SCTLR_LSMAOE 0x20000000 /* ARMv8.2 */ -#define SCTLR_EnIB 0x40000000 /* ARMv8.3 */ -#define SCTLR_EnIA 0x80000000 /* ARMv8.3 */ +#define SCTLR_nTWE (UL(0x1) << 18) +#define SCTLR_WXN (UL(0x1) << 19) +#define SCTLR_TSCXT (UL(0x1) << 20) +#define SCTLR_IESB (UL(0x1) << 21) +#define SCTLR_EIS (UL(0x1) << 22) +#define SCTLR_SPAN (UL(0x1) << 23) +#define SCTLR_E0E (UL(0x1) << 24) +#define SCTLR_EE (UL(0x1) << 25) +#define SCTLR_UCI (UL(0x1) << 26) +#define SCTLR_EnDA (UL(0x1) << 27) +#define SCTLR_nTLSMD (UL(0x1) << 28) +#define SCTLR_LSMAOE (UL(0x1) << 29) +#define SCTLR_EnIB (UL(0x1) << 30) +#define SCTLR_EnIA (UL(0x1) << 31) +/* Bits 34:32 are reserved */ +#define SCTLR_BT0 (UL(0x1) << 35) +#define SCTLR_BT1 (UL(0x1) << 36) +#define SCTLR_ITFSB (UL(0x1) << 37) +#define SCTLR_TCF0_MASK (UL(0x3) << 38) +#define SCTLR_TCF_MASK (UL(0x3) << 40) +#define SCTLR_ATA0 (UL(0x1) << 42) +#define SCTLR_ATA (UL(0x1) << 43) +#define SCTLR_DSSBS (UL(0x1) << 44) +#define SCTLR_TWEDEn (UL(0x1) << 45) +#define SCTLR_TWEDEL_MASK (UL(0xf) << 46) +/* Bits 53:50 are reserved */ +#define SCTLR_EnASR (UL(0x1) << 54) +#define SCTLR_EnAS0 (UL(0x1) << 55) +#define SCTLR_EnALS (UL(0x1) << 56) +#define SCTLR_EPAN (UL(0x1) << 57) /* SPSR_EL1 */ /* From owner-dev-commits-src-all@freebsd.org Fri Aug 6 12:51:23 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A7133655D92; Fri, 6 Aug 2021 12:51: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 4Gh52M2nHSz4Z09; Fri, 6 Aug 2021 12:51: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 187246149; Fri, 6 Aug 2021 12:51: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 176CpMf6017251; Fri, 6 Aug 2021 12:51:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 176CpMAm017250; Fri, 6 Aug 2021 12:51:22 GMT (envelope-from git) Date: Fri, 6 Aug 2021 12:51:22 GMT Message-Id: <202108061251.176CpMAm017250@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andrew Turner Subject: git: 9408ee9e88ef - stable/13 - Remove the newline from arm64 trap panics 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 9408ee9e88ef7505312d51ea9b431bc0b0bc2b61 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 12:51:24 -0000 The branch stable/13 has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=9408ee9e88ef7505312d51ea9b431bc0b0bc2b61 commit 9408ee9e88ef7505312d51ea9b431bc0b0bc2b61 Author: Andrew Turner AuthorDate: 2021-07-14 19:49:58 +0000 Commit: Andrew Turner CommitDate: 2021-08-05 20:50:22 +0000 Remove the newline from arm64 trap panics The panic function will already print a newline so there is no need to add it here. Sponsored by: The FreeBSD Foundation (cherry picked from commit 2665851086795c61e799fbe57bfb37cabab3cf8c) --- sys/arm64/arm64/trap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/arm64/arm64/trap.c b/sys/arm64/arm64/trap.c index cdb7ae8fadae..fa33f713a4fc 100644 --- a/sys/arm64/arm64/trap.c +++ b/sys/arm64/arm64/trap.c @@ -424,7 +424,7 @@ do_el1h_sync(struct thread *td, struct trapframe *frame) #ifdef KDB kdb_trap(exception, 0, frame); #else - panic("No debugger in kernel.\n"); + panic("No debugger in kernel."); #endif break; case EXCP_WATCHPT_EL1: @@ -432,7 +432,7 @@ do_el1h_sync(struct thread *td, struct trapframe *frame) #ifdef KDB kdb_trap(exception, 0, frame); #else - panic("No debugger in kernel.\n"); + panic("No debugger in kernel."); #endif break; case EXCP_UNKNOWN: @@ -442,7 +442,7 @@ do_el1h_sync(struct thread *td, struct trapframe *frame) default: print_registers(frame); printf(" far: %16lx\n", READ_SPECIALREG(far_el1)); - panic("Unknown kernel exception %x esr_el1 %lx\n", exception, + panic("Unknown kernel exception %x esr_el1 %lx", exception, esr); } } From owner-dev-commits-src-all@freebsd.org Fri Aug 6 12:51:24 2021 Return-Path: Delivered-To: dev-commits-src-all@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 BD2BA655ACA; Fri, 6 Aug 2021 12:51: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 4Gh52N34Ygz4Z2g; Fri, 6 Aug 2021 12:51: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 32ABA614A; Fri, 6 Aug 2021 12:51: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 176CpOgO017275; Fri, 6 Aug 2021 12:51:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 176CpOOU017274; Fri, 6 Aug 2021 12:51:24 GMT (envelope-from git) Date: Fri, 6 Aug 2021 12:51:24 GMT Message-Id: <202108061251.176CpOOU017274@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andrew Turner Subject: git: 90070aad0bed - stable/13 - Add virtio comments to the arm64 GENERIC config 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 90070aad0bed6fbfc86326acfdb9e9f29667209f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 12:51:24 -0000 The branch stable/13 has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=90070aad0bed6fbfc86326acfdb9e9f29667209f commit 90070aad0bed6fbfc86326acfdb9e9f29667209f Author: Andrew Turner AuthorDate: 2021-07-14 20:08:29 +0000 Commit: Andrew Turner CommitDate: 2021-08-05 20:50:23 +0000 Add virtio comments to the arm64 GENERIC config Most of these are from the amd64 GENERIC config. Sponsored by: The FreeBSD Foundation (cherry picked from commit ab9f9cfda5a77ff511d56cf183f081cb72ada79d) --- sys/arm64/conf/GENERIC | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sys/arm64/conf/GENERIC b/sys/arm64/conf/GENERIC index 3ce13a49bec7..c33ff2e6351a 100644 --- a/sys/arm64/conf/GENERIC +++ b/sys/arm64/conf/GENERIC @@ -361,11 +361,11 @@ device rk_dwmmc device rk_emmcphy # VirtIO support -device virtio -device virtio_pci -device virtio_mmio -device virtio_blk -device vtnet +device virtio # Generic VirtIO bus (required) +device virtio_pci # VirtIO PCI device +device virtio_mmio # VirtIO Memory Mapped IO device +device virtio_blk # VirtIO Block device +device vtnet # VirtIO Ethernet device # Chip-specific errata options THUNDERX_PASS_1_1_ERRATA From owner-dev-commits-src-all@freebsd.org Fri Aug 6 12:51:25 2021 Return-Path: Delivered-To: dev-commits-src-all@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 95AE26559D3; Fri, 6 Aug 2021 12:51:25 +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 4Gh52P3MMBz4Yxs; Fri, 6 Aug 2021 12:51: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 55E796380; Fri, 6 Aug 2021 12:51: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 176CpPA3017305; Fri, 6 Aug 2021 12:51:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 176CpP5h017304; Fri, 6 Aug 2021 12:51:25 GMT (envelope-from git) Date: Fri, 6 Aug 2021 12:51:25 GMT Message-Id: <202108061251.176CpP5h017304@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andrew Turner Subject: git: 534a780edd77 - stable/13 - Add virtio_scsi to the arm64 GENERIC config 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 534a780edd77c8de62903f990dd3d061d8d01515 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 12:51:26 -0000 The branch stable/13 has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=534a780edd77c8de62903f990dd3d061d8d01515 commit 534a780edd77c8de62903f990dd3d061d8d01515 Author: Andrew Turner AuthorDate: 2021-07-14 20:13:10 +0000 Commit: Andrew Turner CommitDate: 2021-08-05 20:50:24 +0000 Add virtio_scsi to the arm64 GENERIC config This is needed to boot on the Oracle Cloud VM.Standard.A1.Flex instance Sponsored by: The FreeBSD Foundation (cherry picked from commit b644d64e8a4641a6e4c53b3f4be51e08cb17f6cc) --- sys/arm64/conf/GENERIC | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/arm64/conf/GENERIC b/sys/arm64/conf/GENERIC index c33ff2e6351a..eea4441f096f 100644 --- a/sys/arm64/conf/GENERIC +++ b/sys/arm64/conf/GENERIC @@ -365,6 +365,7 @@ device virtio # Generic VirtIO bus (required) device virtio_pci # VirtIO PCI device device virtio_mmio # VirtIO Memory Mapped IO device device virtio_blk # VirtIO Block device +device virtio_scsi # VirtIO SCSI device device vtnet # VirtIO Ethernet device # Chip-specific errata From owner-dev-commits-src-all@freebsd.org Fri Aug 6 12:51:27 2021 Return-Path: Delivered-To: dev-commits-src-all@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 79943655C7E; Fri, 6 Aug 2021 12:51: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 4Gh52Q6ztHz4YwL; Fri, 6 Aug 2021 12:51: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 75FB7620B; Fri, 6 Aug 2021 12:51: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 176CpQUK017329; Fri, 6 Aug 2021 12:51:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 176CpQRi017328; Fri, 6 Aug 2021 12:51:26 GMT (envelope-from git) Date: Fri, 6 Aug 2021 12:51:26 GMT Message-Id: <202108061251.176CpQRi017328@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andrew Turner Subject: git: 9757cfb9d245 - stable/13 - Hide arm64 features that don't have a HWCAP 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 9757cfb9d24540ea1fa80ff54531142d5ec8c2bc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 12:51:28 -0000 The branch stable/13 has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=9757cfb9d24540ea1fa80ff54531142d5ec8c2bc commit 9757cfb9d24540ea1fa80ff54531142d5ec8c2bc Author: Andrew Turner AuthorDate: 2021-07-15 23:22:07 +0000 Commit: Andrew Turner CommitDate: 2021-08-05 20:50:25 +0000 Hide arm64 features that don't have a HWCAP We should only export MSR fields if there is also a HWCAP so it doesn't matter which software uses. Sponsored by: The FreeBSD Foundation (cherry picked from commit ae47eecf87b5d8a054bd5d640da12608cc5f126a) --- sys/arm64/arm64/identcpu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/arm64/arm64/identcpu.c b/sys/arm64/arm64/identcpu.c index 2cd5b914ddef..6395b3e0f08a 100644 --- a/sys/arm64/arm64/identcpu.c +++ b/sys/arm64/arm64/identcpu.c @@ -467,7 +467,7 @@ static struct mrs_field_value id_aa64isar0_aes[] = { static struct mrs_field id_aa64isar0_fields[] = { MRS_FIELD(ID_AA64ISAR0, RNDR, false, MRS_LOWER, id_aa64isar0_rndr), - MRS_FIELD(ID_AA64ISAR0, TLB, false, MRS_LOWER, id_aa64isar0_tlb), + MRS_FIELD(ID_AA64ISAR0, TLB, false, MRS_EXACT, id_aa64isar0_tlb), MRS_FIELD(ID_AA64ISAR0, TS, false, MRS_LOWER, id_aa64isar0_ts), MRS_FIELD(ID_AA64ISAR0, FHM, false, MRS_LOWER, id_aa64isar0_fhm), MRS_FIELD(ID_AA64ISAR0, DP, false, MRS_LOWER, id_aa64isar0_dp), @@ -568,7 +568,7 @@ static struct mrs_field id_aa64isar1_fields[] = { MRS_FIELD(ID_AA64ISAR1, I8MM, false, MRS_LOWER, id_aa64isar1_i8mm), MRS_FIELD(ID_AA64ISAR1, DGH, false, MRS_LOWER, id_aa64isar1_dgh), MRS_FIELD(ID_AA64ISAR1, BF16, false, MRS_LOWER, id_aa64isar1_bf16), - MRS_FIELD(ID_AA64ISAR1, SPECRES, false, MRS_LOWER, + MRS_FIELD(ID_AA64ISAR1, SPECRES, false, MRS_EXACT, id_aa64isar1_specres), MRS_FIELD(ID_AA64ISAR1, SB, false, MRS_LOWER, id_aa64isar1_sb), MRS_FIELD(ID_AA64ISAR1, FRINTTS, false, MRS_LOWER, From owner-dev-commits-src-all@freebsd.org Fri Aug 6 13:21:44 2021 Return-Path: Delivered-To: dev-commits-src-all@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 60537656725; Fri, 6 Aug 2021 13:21: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 4Gh5jN2BhCz4bcH; Fri, 6 Aug 2021 13:21: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 33A2C64EA; Fri, 6 Aug 2021 13:21: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 176DLiUa059482; Fri, 6 Aug 2021 13:21:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 176DLihO059481; Fri, 6 Aug 2021 13:21:44 GMT (envelope-from git) Date: Fri, 6 Aug 2021 13:21:44 GMT Message-Id: <202108061321.176DLihO059481@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: b542c9e42ba4 - main - modules: felix: Add needed dependencies 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: b542c9e42ba404b12facf2a51b4c2504bb14eab9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 13:21:44 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=b542c9e42ba404b12facf2a51b4c2504bb14eab9 commit b542c9e42ba404b12facf2a51b4c2504bb14eab9 Author: Emmanuel Vadot AuthorDate: 2021-08-06 13:20:06 +0000 Commit: Emmanuel Vadot CommitDate: 2021-08-06 13:21:31 +0000 modules: felix: Add needed dependencies Modules should list all needed _if dependencies in their makefile otherwise if one compiles a kernel that didn't compile those files the module won't build. Fixes: 451bcf1b3601 --- sys/modules/felix/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/modules/felix/Makefile b/sys/modules/felix/Makefile index cfe36a58c3dc..47747ffaa11e 100644 --- a/sys/modules/felix/Makefile +++ b/sys/modules/felix/Makefile @@ -29,6 +29,6 @@ .PATH: ${SRCTOP}/sys/dev/etherswitch/felix KMOD = felix -SRCS = felix.c +SRCS = felix.c etherswitch_if.c etherswitch_if.h .include From owner-dev-commits-src-all@freebsd.org Fri Aug 6 13:35:47 2021 Return-Path: Delivered-To: dev-commits-src-all@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 356AB656B5C; Fri, 6 Aug 2021 13:35: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 4Gh61b0zwrz4bkC; Fri, 6 Aug 2021 13:35: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 0A11B6B36; Fri, 6 Aug 2021 13:35: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 176DZkQo073844; Fri, 6 Aug 2021 13:35:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 176DZkKr073843; Fri, 6 Aug 2021 13:35:46 GMT (envelope-from git) Date: Fri, 6 Aug 2021 13:35:46 GMT Message-Id: <202108061335.176DZkKr073843@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jung-uk Kim Subject: git: 362fef2f4a99 - main - bsd.cpu.mk: add support for x86-64-v[234] levels as CPUTYPE MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jkim X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 362fef2f4a9954c0f5eeecbe512cc5abbdc44263 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 13:35:47 -0000 The branch main has been updated by jkim: URL: https://cgit.FreeBSD.org/src/commit/?id=362fef2f4a9954c0f5eeecbe512cc5abbdc44263 commit 362fef2f4a9954c0f5eeecbe512cc5abbdc44263 Author: Greg V AuthorDate: 2021-08-06 13:33:37 +0000 Commit: Jung-uk Kim CommitDate: 2021-08-06 13:33:37 +0000 bsd.cpu.mk: add support for x86-64-v[234] levels as CPUTYPE These are supported in LLVM 12 and GCC 11: https://github.com/llvm/llvm-project/commit/012dd42e027e https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=324bec558e95584e8c1997575ae9d75978af59f1 Differential Revision: https://reviews.freebsd.org/D29150 --- share/mk/bsd.cpu.mk | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/share/mk/bsd.cpu.mk b/share/mk/bsd.cpu.mk index 81a1f0f0dd32..f269bb110ed7 100644 --- a/share/mk/bsd.cpu.mk +++ b/share/mk/bsd.cpu.mk @@ -194,16 +194,19 @@ MACHINE_CPU = k5 i586 ${CPUTYPE} == "cooperlake" || ${CPUTYPE} == "cascadelake" || \ ${CPUTYPE} == "icelake-server" || ${CPUTYPE} == "icelake-client" || \ ${CPUTYPE} == "cannonlake" || ${CPUTYPE} == "knm" || \ - ${CPUTYPE} == "skylake-avx512" || ${CPUTYPE} == "knl" + ${CPUTYPE} == "skylake-avx512" || ${CPUTYPE} == "knl" || \ + ${CPUTYPE} == "x86-64-v4" MACHINE_CPU = avx512 avx2 avx sse42 sse41 ssse3 sse3 sse2 sse i686 mmx i586 . elif ${CPUTYPE} == "alderlake" || ${CPUTYPE} == "skylake" || \ - ${CPUTYPE} == "broadwell" || ${CPUTYPE} == "haswell" + ${CPUTYPE} == "broadwell" || ${CPUTYPE} == "haswell" || \ + ${CPUTYPE} == "x86-64-v3" MACHINE_CPU = avx2 avx sse42 sse41 ssse3 sse3 sse2 sse i686 mmx i586 . elif ${CPUTYPE} == "ivybridge" || ${CPUTYPE} == "sandybridge" MACHINE_CPU = avx sse42 sse41 ssse3 sse3 sse2 sse i686 mmx i586 . elif ${CPUTYPE} == "tremont" || ${CPUTYPE} == "goldmont-plus" || \ ${CPUTYPE} == "goldmont" || ${CPUTYPE} == "westmere" || \ - ${CPUTYPE} == "nehalem" || ${CPUTYPE} == "silvermont" + ${CPUTYPE} == "nehalem" || ${CPUTYPE} == "silvermont" || \ + ${CPUTYPE} == "x86-64-v2" MACHINE_CPU = sse42 sse41 ssse3 sse3 sse2 sse i686 mmx i586 . elif ${CPUTYPE} == "penryn" MACHINE_CPU = sse41 ssse3 sse3 sse2 sse i686 mmx i586 @@ -212,7 +215,7 @@ MACHINE_CPU = ssse3 sse3 sse2 sse i686 mmx i586 . elif ${CPUTYPE} == "yonah" || ${CPUTYPE} == "prescott" MACHINE_CPU = sse3 sse2 sse i686 mmx i586 . elif ${CPUTYPE} == "pentium4" || ${CPUTYPE} == "pentium4m" || \ - ${CPUTYPE} == "pentium-m" + ${CPUTYPE} == "pentium-m" || ${CPUTYPE} == "x86-64" MACHINE_CPU = sse2 sse i686 mmx i586 . elif ${CPUTYPE} == "pentium3" || ${CPUTYPE} == "pentium3m" MACHINE_CPU = sse i686 mmx i586 @@ -262,16 +265,19 @@ MACHINE_CPU = k8 3dnow ${CPUTYPE} == "cooperlake" || ${CPUTYPE} == "cascadelake" || \ ${CPUTYPE} == "icelake-server" || ${CPUTYPE} == "icelake-client" || \ ${CPUTYPE} == "cannonlake" || ${CPUTYPE} == "knm" || \ - ${CPUTYPE} == "skylake-avx512" || ${CPUTYPE} == "knl" + ${CPUTYPE} == "skylake-avx512" || ${CPUTYPE} == "knl" || \ + ${CPUTYPE} == "x86-64-v4" MACHINE_CPU = avx512 avx2 avx sse42 sse41 ssse3 sse3 . elif ${CPUTYPE} == "alderlake" || ${CPUTYPE} == "skylake" || \ - ${CPUTYPE} == "broadwell" || ${CPUTYPE} == "haswell" + ${CPUTYPE} == "broadwell" || ${CPUTYPE} == "haswell" || \ + ${CPUTYPE} == "x86-64-v3" MACHINE_CPU = avx2 avx sse42 sse41 ssse3 sse3 . elif ${CPUTYPE} == "ivybridge" || ${CPUTYPE} == "sandybridge" MACHINE_CPU = avx sse42 sse41 ssse3 sse3 . elif ${CPUTYPE} == "tremont" || ${CPUTYPE} == "goldmont-plus" || \ ${CPUTYPE} == "goldmont" || ${CPUTYPE} == "westmere" || \ - ${CPUTYPE} == "nehalem" || ${CPUTYPE} == "silvermont" + ${CPUTYPE} == "nehalem" || ${CPUTYPE} == "silvermont" || \ + ${CPUTYPE} == "x86-64-v2" MACHINE_CPU = sse42 sse41 ssse3 sse3 . elif ${CPUTYPE} == "penryn" MACHINE_CPU = sse41 ssse3 sse3 From owner-dev-commits-src-all@freebsd.org Fri Aug 6 15:00:41 2021 Return-Path: Delivered-To: dev-commits-src-all@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 10DE2657DED; Fri, 6 Aug 2021 15:00:41 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (glebi.us [162.251.186.162]) (using TLSv1.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 (2048 bits) client-digest SHA256) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gh7vX5gcnz4k92; Fri, 6 Aug 2021 15:00:40 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.16.1/8.16.1) with ESMTPS id 176F0dQM016686 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Fri, 6 Aug 2021 08:00:39 -0700 (PDT) (envelope-from glebius@freebsd.org) Received: (from glebius@localhost) by cell.glebi.us (8.16.1/8.16.1/Submit) id 176F0dwM016685; Fri, 6 Aug 2021 08:00:39 -0700 (PDT) (envelope-from glebius@freebsd.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@freebsd.org using -f Date: Fri, 6 Aug 2021 08:00:39 -0700 From: Gleb Smirnoff To: Lutz Donnerhacke Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 25392fac9488 - main - libalias: Fix splay comparsion bug Message-ID: References: <202107022232.162MWUIY049889@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202107022232.162MWUIY049889@gitrepo.freebsd.org> X-Rspamd-Queue-Id: 4Gh7vX5gcnz4k92 X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [0.00 / 15.00]; ASN(0.00)[asn:27348, ipnet:162.251.186.0/24, country:US]; local_wl_from(0.00)[freebsd.org] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 15:00:41 -0000 Lutz, Wouldn't declaring 'i' to u_short fix the root of the problem? On Fri, Jul 02, 2021 at 10:32:30PM +0000, Lutz Donnerhacke wrote: L> The branch main has been updated by donner: L> L> URL: https://cgit.FreeBSD.org/src/commit/?id=25392fac9488bcae5c451500df2e2945430484a6 L> L> commit 25392fac9488bcae5c451500df2e2945430484a6 L> Author: Lutz Donnerhacke L> AuthorDate: 2021-07-02 21:41:25 +0000 L> Commit: Lutz Donnerhacke L> CommitDate: 2021-07-02 22:31:53 +0000 L> L> libalias: Fix splay comparsion bug L> L> Comparing elements in a tree requires transitiviy. If a < b and b < c L> then a must be smaller than c. This way the tree elements are always L> pairwise comparable. L> L> Tristate comparsion functions returning values lower, equal, or L> greater than zero, are usually implemented by a simple subtraction of L> the operands. If the size of the operands are equal to the size of L> the result, integer modular arithmetics kick in and violates the L> transitivity. L> L> Example: L> Working on byte with 0, 120, and 240. Now computing the differences: L> 120 - 0 = 120 L> 240 - 120 = 120 L> 240 - 0 = -16 L> L> MFC after: 3 days L> sys/netinet/libalias/alias_db.h | 13 +++++++------ L> 1 file changed, 7 insertions(+), 6 deletions(-) L> L> diff --git a/sys/netinet/libalias/alias_db.h b/sys/netinet/libalias/alias_db.h L> index ec0b69c01f82..971ca305c1a6 100644 L> --- a/sys/netinet/libalias/alias_db.h L> +++ b/sys/netinet/libalias/alias_db.h L> @@ -351,10 +351,10 @@ static inline int L> cmp_out(struct alias_link *a, struct alias_link *b) { L> int i = a->src_port - b->src_port; L> if (i != 0) return (i); L> - i = a->src_addr.s_addr - b->src_addr.s_addr; L> - if (i != 0) return (i); L> - i = a->dst_addr.s_addr - b->dst_addr.s_addr; L> - if (i != 0) return (i); L> + if (a->src_addr.s_addr > b->src_addr.s_addr) return (1); L> + if (a->src_addr.s_addr < b->src_addr.s_addr) return (-1); L> + if (a->dst_addr.s_addr > b->dst_addr.s_addr) return (1); L> + if (a->dst_addr.s_addr < b->dst_addr.s_addr) return (-1); L> i = a->dst_port - b->dst_port; L> if (i != 0) return (i); L> i = a->link_type - b->link_type; L> @@ -368,8 +368,9 @@ cmp_in(struct group_in *a, struct group_in *b) { L> if (i != 0) return (i); L> i = a->link_type - b->link_type; L> if (i != 0) return (i); L> - i = a->alias_addr.s_addr - b->alias_addr.s_addr; L> - return (i); L> + if (a->alias_addr.s_addr > b->alias_addr.s_addr) return (1); L> + if (a->alias_addr.s_addr < b->alias_addr.s_addr) return (-1); L> + return (0); L> } L> SPLAY_PROTOTYPE(splay_in, group_in, in, cmp_in); L> -- Gleb Smirnoff From owner-dev-commits-src-all@freebsd.org Fri Aug 6 15:08:55 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C5C0A65848E; Fri, 6 Aug 2021 15:08:55 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (glebi.us [162.251.186.162]) (using TLSv1.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 (2048 bits) client-digest SHA256) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gh8533f74z4kg6; Fri, 6 Aug 2021 15:08:55 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.16.1/8.16.1) with ESMTPS id 176F8seC016705 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Fri, 6 Aug 2021 08:08:54 -0700 (PDT) (envelope-from glebius@freebsd.org) Received: (from glebius@localhost) by cell.glebi.us (8.16.1/8.16.1/Submit) id 176F8qm1016704; Fri, 6 Aug 2021 08:08:52 -0700 (PDT) (envelope-from glebius@freebsd.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@freebsd.org using -f Date: Fri, 6 Aug 2021 08:08:52 -0700 From: Gleb Smirnoff To: Lutz Donnerhacke Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 2f4d91f9cb22 - main - libalias: Rewrite HISTORY Message-ID: References: <202107041549.164Fn2Ga030801@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202107041549.164Fn2Ga030801@gitrepo.freebsd.org> X-Rspamd-Queue-Id: 4Gh8533f74z4kg6 X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [0.00 / 15.00]; local_wl_from(0.00)[freebsd.org]; ASN(0.00)[asn:27348, ipnet:162.251.186.0/24, country:US] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 15:08:55 -0000 Lutz, I think something should go between these two entries: Version 3.2: July, 2000 (Erik Salander, erik@whistle.com and Version 3.3: May 2021 (donner) At least porting to kernel by me and modularization by Paolo Pisati. These are substantial changes. On Sun, Jul 04, 2021 at 03:49:02PM +0000, Lutz Donnerhacke wrote: L> The branch main has been updated by donner: L> L> URL: https://cgit.FreeBSD.org/src/commit/?id=2f4d91f9cb22fc65eb65407e8118b433a5d71976 L> L> commit 2f4d91f9cb22fc65eb65407e8118b433a5d71976 L> Author: Lutz Donnerhacke L> AuthorDate: 2021-07-04 15:46:47 +0000 L> Commit: Lutz Donnerhacke L> CommitDate: 2021-07-04 15:46:47 +0000 L> L> libalias: Rewrite HISTORY L> L> Fix the history entry (wrong year) and add the missing recent work. L> MFC together with the other patches. L> L> MFC after: 2 days L> --- L> sys/netinet/libalias/HISTORY | 5 +++-- L> 1 file changed, 3 insertions(+), 2 deletions(-) L> L> diff --git a/sys/netinet/libalias/HISTORY b/sys/netinet/libalias/HISTORY L> index 04427be17b39..87d5b6f8ed76 100644 L> --- a/sys/netinet/libalias/HISTORY L> +++ b/sys/netinet/libalias/HISTORY L> @@ -144,6 +144,7 @@ Version 3.2: July, 2000 (Erik Salander, erik@whistle.com and L> Junichi Satoh, junichi@junichi.org) L> - Added support for streaming media (RTSP and PNA) aliasing. L> L> -Version 3.3: May 2020 (donner) L> +Version 3.3: May 2021 (donner) L> - Dropped LibAliasCheckNewLink L> - - Refactor the database handling, perfomance improvements. L> + - Refactor the database handling L> + - Switch to more effienct SPLAY trees L> _______________________________________________ L> dev-commits-src-all@freebsd.org mailing list L> https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all L> To unsubscribe, send any mail to "dev-commits-src-all-unsubscribe@freebsd.org" -- Gleb Smirnoff From owner-dev-commits-src-all@freebsd.org Fri Aug 6 16:39:11 2021 Return-Path: Delivered-To: dev-commits-src-all@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 BBBD76593B9; Fri, 6 Aug 2021 16:39: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 4GhB5C4mSTz4qrK; Fri, 6 Aug 2021 16:39: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 7D47611069; Fri, 6 Aug 2021 16:39: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 176GdBqk016073; Fri, 6 Aug 2021 16:39:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 176GdBca016072; Fri, 6 Aug 2021 16:39:11 GMT (envelope-from git) Date: Fri, 6 Aug 2021 16:39:11 GMT Message-Id: <202108061639.176GdBca016072@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: e6379a2c9546 - main - man: Install more man pages unconditionally 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: e6379a2c954698be466f5b4481a924b3a0074cb4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 16:39:11 -0000 The branch main has been updated by fernape (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=e6379a2c954698be466f5b4481a924b3a0074cb4 commit e6379a2c954698be466f5b4481a924b3a0074cb4 Author: Fernando Apesteguía AuthorDate: 2021-08-06 16:33:31 +0000 Commit: Fernando Apesteguía CommitDate: 2021-08-06 16:34:07 +0000 man: Install more man pages unconditionally Add more manual pages which were not spotted previously in 0a0f7486413c Ideally to be MFH'ed with: 8539518055d0 - Remove manpages from OLD_FILES 8b487b8292e4 - Fix bsd.subdir.mk-related issues after 0a0f7486413c f6043a672135 - ObsoleteFiles.inc: Remove manpages from OLD_FILES 0a0f7486413c - man: Build manpages for all architectures There is at least one pending issue when building with -DNO_ROOT. Reported by: ceri@ MFH: 4 weeks Discussed with: wosch Differential Revision: https://reviews.freebsd.org/D31018 --- share/man/man5/Makefile | 4 ++-- share/man/man8/Makefile | 4 ++-- share/man/man9/Makefile | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/share/man/man5/Makefile b/share/man/man5/Makefile index 2083993b0795..e1b765346689 100644 --- a/share/man/man5/Makefile +++ b/share/man/man5/Makefile @@ -107,8 +107,8 @@ MAN+= pf.conf.5 \ pf.os.5 .endif -.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" +# This makes more sense for amd64 and i386 but +# we decide to install all manpages in all architectures _boot.config.5= boot.config.5 -.endif .include diff --git a/share/man/man8/Makefile b/share/man/man8/Makefile index 1e61c79d12b9..1257f3ab97bf 100644 --- a/share/man/man8/Makefile +++ b/share/man/man8/Makefile @@ -35,10 +35,10 @@ MLINKS+=yp.8 NIS.8 \ yp.8 YP.8 .endif -.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "amd64" +# This makes more sense for aarch 64 and amd64 +# we decide to install all manpages in all architectures _uefi.8= uefi.8 MLINKS+=uefi.8 efi.8 -.endif .include diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index b2f1451a79d7..d6650a2538f7 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -2398,7 +2398,8 @@ MLINKS+=zone.9 uma.9 \ zone.9 uma_zone_set_warning.9 \ zone.9 uma_zsecond_create.9 -.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" +# This makes more sense for amd64 and i386 but +# we decide to install all manpages in all architectures _superio.9= superio.9 MLINKS+=superio.9 superio_devid.9 \ superio.9 superio_dev_disable.9 \ @@ -2415,6 +2416,5 @@ MLINKS+=superio.9 superio_devid.9 \ superio.9 superio_revid.9 \ superio.9 superio_vendor.9 \ superio.9 superio_write.9 -.endif .include From owner-dev-commits-src-all@freebsd.org Fri Aug 6 16:44:16 2021 Return-Path: Delivered-To: dev-commits-src-all@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 AB503659341; Fri, 6 Aug 2021 16:44:16 +0000 (UTC) (envelope-from rob.fx907@gmail.com) Received: from mail-oo1-xc34.google.com (mail-oo1-xc34.google.com [IPv6:2607:f8b0:4864:20::c34]) (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 4GhBC43x18z4rHZ; Fri, 6 Aug 2021 16:44:16 +0000 (UTC) (envelope-from rob.fx907@gmail.com) Received: by mail-oo1-xc34.google.com with SMTP id h7-20020a4ab4470000b0290263c143bcb2so2377172ooo.7; Fri, 06 Aug 2021 09:44:16 -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=a1LpHOj0V8F38XedG2+nRaYu+IPrFzA/ki2CiRwtUN8=; b=OyMp6MJ4GMwCKtnpJ5cBlehbTPtYxpcfV8n8PlVu6yVzy8CxclOn5rDmADJNHZnoDu O9SLnKKeG8n7twANUNjMhTWBFM/s2xQaojDVcWjN/mbqByMQ+to/VpUhfHMcvLBj/Pys bZmNeM7ppfz38sLZcgT0lIeWwSdXYGutCmjEYNvVWDayzzXvxT/8f5eyoJ/Z47oR9HDG FjaNjL0bW/F/2iaYWarQJXmE6sTXPoC3tzqNEOhi2M9jPMqUyku9PQ//A5IztFKfChfl mQDyoM3gx0lZgM9Jaa3l+OLMVARwJZ+gZjgjNrX/hIbJKMvKDHWx55G/19goUfvVPBEa 2kpg== 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=a1LpHOj0V8F38XedG2+nRaYu+IPrFzA/ki2CiRwtUN8=; b=CGCo5HeeD4jE7CaPZKK5y6XCk0AKNf8SW9e/zRH6xKrBuYMwlHMIMPf6ABssCDH1w9 5nw8qq1WpndIW2nOG8TltGQaiNWxLhPcMCLKbwLEmcPd0emy0J3kS0KGzOc0AMSBtv5T 0SZ+ysld1FpvaRyeBDEpGr9S4o0FP1nppG3fARd9u/ZoDF7YEFl2NW3v61K5MDOwfR9A tuC2ExS5XDHY1WGuhZIrQpSTPm8v8Xjkada9jETPPTtx20X0y3TC506tQg5q/oRBdUCm WHmBfjoJ8EX8kPw+W9WCwm0ElpcPlV0+GFOoAf88Us9LQazfdHF/hZPbN6Kx7vsyWvke ZWww== X-Gm-Message-State: AOAM531vuHCdeGuTWCjDVj9hN2+TjkPnMGxYDldXiMYOL0fTVQ2h8FLx bOm4YIql4Q+nkjT/feZjOatSWCO7UktUO+VTwakskuiFACc= X-Google-Smtp-Source: ABdhPJzEKp6GCKI6Ga+dSn6XV5K06jMwiVUwGPmekGUJJJSi4faP/9Cc5jRamMxGGITykw0PAJgoDwjJZwPJtZnituw= X-Received: by 2002:a4a:b04c:: with SMTP id g12mr7303668oon.3.1628268250600; Fri, 06 Aug 2021 09:44:10 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:ac9:704d:0:0:0:0:0 with HTTP; Fri, 6 Aug 2021 09:44:10 -0700 (PDT) In-Reply-To: References: <202107022232.162MWUIY049889@gitrepo.freebsd.org> From: Rob Wing Date: Fri, 6 Aug 2021 08:44:10 -0800 Message-ID: Subject: Re: git: 25392fac9488 - main - libalias: Fix splay comparsion bug To: Gleb Smirnoff Cc: Lutz Donnerhacke , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" X-Rspamd-Queue-Id: 4GhBC43x18z4rHZ 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)[] Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 16:44:16 -0000 Hey Gleb, as a heads up (in case you missed it)...about a week ago Lutz mentioned he=E2=80=99d be AFK for three weeks. On Friday, August 6, 2021, Gleb Smirnoff wrote: > Lutz, > > Wouldn't declaring 'i' to u_short fix the root of the problem? > > On Fri, Jul 02, 2021 at 10:32:30PM +0000, Lutz Donnerhacke wrote: > L> The branch main has been updated by donner: > L> > L> URL: https://cgit.FreeBSD.org/src/commit/?id=3D > 25392fac9488bcae5c451500df2e2945430484a6 > L> > L> commit 25392fac9488bcae5c451500df2e2945430484a6 > L> Author: Lutz Donnerhacke > L> AuthorDate: 2021-07-02 21:41:25 +0000 > L> Commit: Lutz Donnerhacke > L> CommitDate: 2021-07-02 22:31:53 +0000 > L> > L> libalias: Fix splay comparsion bug > L> > L> Comparing elements in a tree requires transitiviy. If a < b and b > < c > L> then a must be smaller than c. This way the tree elements are > always > L> pairwise comparable. > L> > L> Tristate comparsion functions returning values lower, equal, or > L> greater than zero, are usually implemented by a simple subtraction > of > L> the operands. If the size of the operands are equal to the size o= f > L> the result, integer modular arithmetics kick in and violates the > L> transitivity. > L> > L> Example: > L> Working on byte with 0, 120, and 240. Now computing the difference= s: > L> 120 - 0 =3D 120 > L> 240 - 120 =3D 120 > L> 240 - 0 =3D -16 > L> > L> MFC after: 3 days > L> sys/netinet/libalias/alias_db.h | 13 +++++++------ > L> 1 file changed, 7 insertions(+), 6 deletions(-) > L> > L> diff --git a/sys/netinet/libalias/alias_db.h > b/sys/netinet/libalias/alias_db.h > L> index ec0b69c01f82..971ca305c1a6 100644 > L> --- a/sys/netinet/libalias/alias_db.h > L> +++ b/sys/netinet/libalias/alias_db.h > L> @@ -351,10 +351,10 @@ static inline int > L> cmp_out(struct alias_link *a, struct alias_link *b) { > L> int i =3D a->src_port - b->src_port; > L> if (i !=3D 0) return (i); > L> - i =3D a->src_addr.s_addr - b->src_addr.s_addr; > L> - if (i !=3D 0) return (i); > L> - i =3D a->dst_addr.s_addr - b->dst_addr.s_addr; > L> - if (i !=3D 0) return (i); > L> + if (a->src_addr.s_addr > b->src_addr.s_addr) return (1); > L> + if (a->src_addr.s_addr < b->src_addr.s_addr) return (-1); > L> + if (a->dst_addr.s_addr > b->dst_addr.s_addr) return (1); > L> + if (a->dst_addr.s_addr < b->dst_addr.s_addr) return (-1); > L> i =3D a->dst_port - b->dst_port; > L> if (i !=3D 0) return (i); > L> i =3D a->link_type - b->link_type; > L> @@ -368,8 +368,9 @@ cmp_in(struct group_in *a, struct group_in *b) { > L> if (i !=3D 0) return (i); > L> i =3D a->link_type - b->link_type; > L> if (i !=3D 0) return (i); > L> - i =3D a->alias_addr.s_addr - b->alias_addr.s_addr; > L> - return (i); > L> + if (a->alias_addr.s_addr > b->alias_addr.s_addr) return (1); > L> + if (a->alias_addr.s_addr < b->alias_addr.s_addr) return (-1); > L> + return (0); > L> } > L> SPLAY_PROTOTYPE(splay_in, group_in, in, cmp_in); > L> > > -- > Gleb Smirnoff > From owner-dev-commits-src-all@freebsd.org Fri Aug 6 16:53:22 2021 Return-Path: Delivered-To: dev-commits-src-all@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 43BD2659B3D; Fri, 6 Aug 2021 16:53:22 +0000 (UTC) (envelope-from jhb@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 4GhBPZ1Hwkz4rdt; Fri, 6 Aug 2021 16:53:22 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro.local (ralph.baldwin.cx [66.234.199.215]) (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 7339EEEE5; Fri, 6 Aug 2021 16:53:21 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: git: 09066b98663d - main - ktls: Use the new PNOLOCK flag To: Hans Petter Selasky , Ian Lepore , Andrew Gallatin , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202108052251.175MpwTC090873@gitrepo.freebsd.org> <18ed8e5f-d042-478b-e18c-dd0de7affcae@selasky.org> From: John Baldwin Message-ID: <0805925c-dc48-c55c-2682-abffb672459c@FreeBSD.org> Date: Fri, 6 Aug 2021 09:53:14 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <18ed8e5f-d042-478b-e18c-dd0de7affcae@selasky.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 16:53:22 -0000 On 8/6/21 2:09 AM, Hans Petter Selasky wrote: > On 8/6/21 1:58 AM, Ian Lepore wrote: >> I especially like this solution, it documents explicitly what you're >> doing and why. (Earlier I was considering mumbling something about >> "there should be a comment to say a sleep-forever is known safe here".) > > Hi, > > MPSAFE is the word to use, like with other things related to GIANT? > > PNOLOCK -> PMPSAFE ?? No, I suggested PNOLOCK explicitly to mean "I'm purposefully sleeping without any lock at all". Normally MPSAFE has been used to mean "this has had other locking added so that it no longer needs Giant". I'd actually generally like to axe MPSAFE from our tree and invert flags to have things opt-in to Giant instead. This is already in place for sysctls (and for 14 we can probably axe the SYSCTL_MPSAFE flag). INTR_MPSAFE is probably one I'd like to flip next to an INTR_GIANT (though probably for 14 both flags would have to live as the sysctl flags did for 13). CALLOUT_MPSAFE -> CALLOUT_GIANT is perhaps another candidate. It'd be nice to get all these done in 14-current. I'm not super optimistic we can fully eradicate Giant in 14, but at least we can start better isolating it in terms of most code not having to declare "I don't need it" anymore. -- John Baldwin From owner-dev-commits-src-all@freebsd.org Fri Aug 6 18:51:51 2021 Return-Path: Delivered-To: dev-commits-src-all@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 EAC6C65C432; Fri, 6 Aug 2021 18:51: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 4GhF2H6Nd0z3Gp6; Fri, 6 Aug 2021 18:51:51 +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 C3C9A12E51; Fri, 6 Aug 2021 18:51:51 +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 176Ipp8l099112; Fri, 6 Aug 2021 18:51:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 176IppLt099111; Fri, 6 Aug 2021 18:51:51 GMT (envelope-from git) Date: Fri, 6 Aug 2021 18:51:51 GMT Message-Id: <202108061851.176IppLt099111@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dimitry Andric Subject: git: 34e7e4b6a059 - main - Add ElfW() macro for compatibility with Linux MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 34e7e4b6a059eee5e4e3e34de5b9d5f0d6e589f9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 18:51:52 -0000 The branch main has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=34e7e4b6a059eee5e4e3e34de5b9d5f0d6e589f9 commit 34e7e4b6a059eee5e4e3e34de5b9d5f0d6e589f9 Author: Dimitry Andric AuthorDate: 2021-08-05 18:57:22 +0000 Commit: Dimitry Andric CommitDate: 2021-08-06 18:50:32 +0000 Add ElfW() macro for compatibility with Linux Some Linux software using ELF headers assumes the existence of an ElfW(type) macro, which concatenates 'Elf', the default ELF word size, and the given type. This is identical to our __ElfN(x) macro in . Add the macro for compatibility, with a comment that we prefer the __ElfN() macro for FreeBSD. Reviewed by: emaste, kib Differential Revision: https://reviews.freebsd.org/D31427 MFC after: 1 week --- sys/sys/elf_generic.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/sys/elf_generic.h b/sys/sys/elf_generic.h index 301ee52cf7a1..dcd44fe93b14 100644 --- a/sys/sys/elf_generic.h +++ b/sys/sys/elf_generic.h @@ -57,6 +57,9 @@ #define __ELFN(x) __CONCAT(__CONCAT(__CONCAT(ELF,__ELF_WORD_SIZE),_),x) #define __ElfType(x) typedef __ElfN(x) __CONCAT(Elf_,x) +/* Define ElfW for compatibility with Linux, prefer __ElfN() in FreeBSD code */ +#define ElfW(x) __ElfN(x) + __ElfType(Addr); __ElfType(Half); __ElfType(Off); From owner-dev-commits-src-all@freebsd.org Fri Aug 6 19:28:17 2021 Return-Path: Delivered-To: dev-commits-src-all@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 0E21865DB39; Fri, 6 Aug 2021 19:28: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 4GhFrJ6Swqz3JLD; Fri, 6 Aug 2021 19:28: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 C1FBC13712; Fri, 6 Aug 2021 19:28: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 176JSGGi043353; Fri, 6 Aug 2021 19:28:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 176JSG42043352; Fri, 6 Aug 2021 19:28:16 GMT (envelope-from git) Date: Fri, 6 Aug 2021 19:28:16 GMT Message-Id: <202108061928.176JSG42043352@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 40b9f924b189 - main - pkg: allow multiple add arguments again MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 40b9f924b189ce8fa871db600b4abc99b03c6a65 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 19:28:17 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=40b9f924b189ce8fa871db600b4abc99b03c6a65 commit 40b9f924b189ce8fa871db600b4abc99b03c6a65 Author: Kyle Evans AuthorDate: 2021-02-18 03:41:53 +0000 Commit: Kyle Evans CommitDate: 2021-08-06 19:25:07 +0000 pkg: allow multiple add arguments again While pkg(7) add only handles a single 'add' argument, pkg-add(8) fully handles multiple arguments. Stop rejecting it, just turn off local-bootstrap mode and proceed to remote bootstrap if we need it. While we're here, check if the first argument to pkg add is even a pkg package. If it's not, also do remote bootstrap instead. Future work could improve this altogether by picking out a pkg package out of many and local bootstrap then pass the rest through to the newly installed pkg. Reviewed by: bapt, manu (earlier version) MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D28766 --- usr.sbin/pkg/pkg.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 50 insertions(+), 4 deletions(-) diff --git a/usr.sbin/pkg/pkg.c b/usr.sbin/pkg/pkg.c index 8193dc79a430..1196c78e5cc9 100644 --- a/usr.sbin/pkg/pkg.c +++ b/usr.sbin/pkg/pkg.c @@ -1056,6 +1056,40 @@ cleanup: return (ret); } +#define PKG_NAME "pkg" +#define PKG_DEVEL_NAME PKG_NAME "-devel" +#define PKG_PKG PKG_NAME "." + +static bool +pkg_is_pkg_pkg(const char *pkg) +{ + char *vstart; + size_t namelen; + + /* + * Chop off the final "-" (version delimiter) and check the name that + * precedes it. If we didn't have a version delimiter, it must be the + * pkg.$archive short form but we'll check it anyways. pkg-devel short + * form will look like a pkg archive with 'devel' version, but that's + * OK. We otherwise assumed that non-pkg packages will always have a + * version component. + */ + vstart = strrchr(pkg, '-'); + if (vstart == NULL) { + return (strlen(pkg) > sizeof(PKG_PKG) - 1 && + strncmp(pkg, PKG_PKG, sizeof(PKG_PKG) - 1) == 0); + } + + namelen = vstart - pkg; + if (namelen == sizeof(PKG_NAME) - 1 && + strncmp(pkg, PKG_NAME, sizeof(PKG_NAME) - 1) == 0) + return (true); + if (namelen == sizeof(PKG_DEVEL_NAME) - 1 && + strncmp(pkg, PKG_DEVEL_NAME, sizeof(PKG_DEVEL_NAME) - 1) == 0) + return (true); + return (false); +} + int main(int argc, char *argv[]) { @@ -1159,13 +1193,25 @@ main(int argc, char *argv[]) fprintf(stderr, args_bootstrap_message); exit(EXIT_FAILURE); } - // For add, we accept exactly one further argument else if (add_pkg && pkgarg != NULL) { - fprintf(stderr, args_add_message); - exit(EXIT_FAILURE); + /* + * Additional arguments also means it's not a + * local bootstrap request. + */ + add_pkg = false; } else if (add_pkg) { - pkgarg = argv[optind-1]; + /* + * If it's not a request for pkg or pkg-devel, + * then we must assume they were trying to + * install some other local package and we + * should try to bootstrap from the repo. + */ + if (!pkg_is_pkg_pkg(argv[optind-1])) { + add_pkg = false; + } else { + pkgarg = argv[optind-1]; + } } break; default: From owner-dev-commits-src-all@freebsd.org Fri Aug 6 19:28:18 2021 Return-Path: Delivered-To: dev-commits-src-all@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 1239F65DAA4; Fri, 6 Aug 2021 19:28:18 +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 4GhFrK723lz3JFf; Fri, 6 Aug 2021 19:28: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 DACC0136BB; Fri, 6 Aug 2021 19:28: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 176JSHE3043377; Fri, 6 Aug 2021 19:28:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 176JSHqY043376; Fri, 6 Aug 2021 19:28:17 GMT (envelope-from git) Date: Fri, 6 Aug 2021 19:28:17 GMT Message-Id: <202108061928.176JSHqY043376@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: d35164539b14 - main - pkg: use specific CONFSNAME_${file} for FreeBSD.conf MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d35164539b14a6d14fb587e58a0c7a1668d7643a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 19:28:18 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=d35164539b14a6d14fb587e58a0c7a1668d7643a commit d35164539b14a6d14fb587e58a0c7a1668d7643a Author: Kyle Evans AuthorDate: 2021-02-18 04:10:46 +0000 Commit: Kyle Evans CommitDate: 2021-08-06 19:25:45 +0000 pkg: use specific CONFSNAME_${file} for FreeBSD.conf Setting CONFSNAME directly is a little more complicated for downstream consumers, as any additional CONFS that are added here will inherit the group name by default. This is perhaps arguably a design flaw in CONFS because inheriting NAME will never give a good result when additional files are added, but this is a low-effort change. While we're here, pull FreeBSD.conf.${branch} out into a PKGCONF variable so one can just drop a new repo config in entirely with a new naming scheme. CONFSNAME gets set based on chopping anything off after ".conf", so that, e.g.: - FooBSD.conf => FooBSD.conf - FooBSD.conf.internal => FooBSD.conf Reviewed by: bapt, manu Differential Revision: https://reviews.freebsd.org/D28767 --- usr.sbin/pkg/Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/usr.sbin/pkg/Makefile b/usr.sbin/pkg/Makefile index a71f0b2acb86..dd3db00885b1 100644 --- a/usr.sbin/pkg/Makefile +++ b/usr.sbin/pkg/Makefile @@ -15,8 +15,9 @@ PKGCONFBRANCH?= latest . endif . endif .endif -CONFS= FreeBSD.conf.${PKGCONFBRANCH} -CONFSNAME= FreeBSD.conf +PKGCONF?= FreeBSD.conf.${PKGCONFBRANCH} +CONFS= ${PKGCONF} +CONFSNAME_${PKGCONF}= ${PKGCONF:C/\.conf.+$/.conf/} CONFSDIR= /etc/pkg CONFSMODE= 644 PROG= pkg From owner-dev-commits-src-all@freebsd.org Fri Aug 6 21:29:07 2021 Return-Path: Delivered-To: dev-commits-src-all@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 D391465F2A5; Fri, 6 Aug 2021 21:29: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 4GhJWl5PGsz3R0P; Fri, 6 Aug 2021 21:29: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 A180615197; Fri, 6 Aug 2021 21:29: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 176LT7BR003033; Fri, 6 Aug 2021 21:29:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 176LT773003032; Fri, 6 Aug 2021 21:29:07 GMT (envelope-from git) Date: Fri, 6 Aug 2021 21:29:07 GMT Message-Id: <202108062129.176LT773003032@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: f0594f52f6fd - main - iSCSI: Add support for segmentation offload for hardware offloads. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f0594f52f6fdabecee134dd5700bf936283959ad Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 21:29:07 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=f0594f52f6fdabecee134dd5700bf936283959ad commit f0594f52f6fdabecee134dd5700bf936283959ad Author: John Baldwin AuthorDate: 2021-08-06 21:03:00 +0000 Commit: John Baldwin CommitDate: 2021-08-06 21:03:00 +0000 iSCSI: Add support for segmentation offload for hardware offloads. Similar to TSO, iSCSI segmentation offload permits the upper layers to submit a "large" virtual PDU which is split up into multiple segments (PDUs) on the wire. Similar to how the TCP/IP headers are used as templates for TSO, the BHS at the start of a large PDU is used as a template to construct the specific BHS at the start of each PDU. In particular, the DataSN is incremented for each subsequent PDU, and the 'F' flag is only set on the last PDU. struct icl_conn has a new 'ic_hw_isomax' field which defaults to 0, but can be set to the largest virtual PDU a backend supports. If this value is non-zero, the iSCSI target and initiator use this size instead of 'ic_max_send_data_segment_length' to determine the maximum size for SCSI Data-In and SCSI Data-Out PDUs. Note that since PDUs can be constructed from multiple buffers before being dispatched, the target and initiator must wait for the PDU to be fully constructed before determining the number of DataSN values were consumed (and thus updating the per-transfer DataSN value used for the start of the next PDU). The target generates large PDUs for SCSI Data-In PDUs in cfiscsi_datamove_in(). The initiator generates large PDUs for SCSI Data-Out PDUs generated in response to an R2T. Reviewed by: mav Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D31222 --- sys/cam/ctl/ctl_frontend_iscsi.c | 29 +++++++++++++++++------------ sys/dev/iscsi/icl.h | 1 + sys/dev/iscsi/iscsi.c | 15 +++++++++++---- 3 files changed, 29 insertions(+), 16 deletions(-) diff --git a/sys/cam/ctl/ctl_frontend_iscsi.c b/sys/cam/ctl/ctl_frontend_iscsi.c index b3cd8ab79d76..b8fafcea69ed 100644 --- a/sys/cam/ctl/ctl_frontend_iscsi.c +++ b/sys/cam/ctl/ctl_frontend_iscsi.c @@ -2447,6 +2447,7 @@ cfiscsi_datamove_in(union ctl_io *io) struct iscsi_bhs_data_in *bhsdi; struct ctl_sg_entry ctl_sg_entry, *ctl_sglist; size_t len, expected_len, sg_len, buffer_offset; + size_t max_send_data_segment_length; const char *sg_addr; icl_pdu_cb cb; int ctl_sg_count, error, i; @@ -2504,6 +2505,11 @@ cfiscsi_datamove_in(union ctl_io *io) sg_len = 0; response = NULL; bhsdi = NULL; + if (cs->cs_conn->ic_hw_isomax != 0) + max_send_data_segment_length = cs->cs_conn->ic_hw_isomax; + else + max_send_data_segment_length = + cs->cs_conn->ic_max_send_data_segment_length; for (;;) { if (response == NULL) { response = cfiscsi_pdu_new_response(request, M_NOWAIT); @@ -2520,7 +2526,7 @@ cfiscsi_datamove_in(union ctl_io *io) bhsdi->bhsdi_initiator_task_tag = bhssc->bhssc_initiator_task_tag; bhsdi->bhsdi_target_transfer_tag = 0xffffffff; - bhsdi->bhsdi_datasn = htonl(PRIV_EXPDATASN(io)++); + bhsdi->bhsdi_datasn = htonl(PRIV_EXPDATASN(io)); bhsdi->bhsdi_buffer_offset = htonl(buffer_offset); } @@ -2536,15 +2542,11 @@ cfiscsi_datamove_in(union ctl_io *io) /* * Truncate to maximum data segment length. */ - KASSERT(response->ip_data_len < - cs->cs_conn->ic_max_send_data_segment_length, - ("ip_data_len %zd >= max_send_data_segment_length %d", - response->ip_data_len, - cs->cs_conn->ic_max_send_data_segment_length)); - if (response->ip_data_len + len > - cs->cs_conn->ic_max_send_data_segment_length) { - len = cs->cs_conn->ic_max_send_data_segment_length - - response->ip_data_len; + KASSERT(response->ip_data_len < max_send_data_segment_length, + ("ip_data_len %zd >= max_send_data_segment_length %zd", + response->ip_data_len, max_send_data_segment_length)); + if (response->ip_data_len + len > max_send_data_segment_length) { + len = max_send_data_segment_length - response->ip_data_len; KASSERT(len <= sg_len, ("len %zd > sg_len %zd", len, sg_len)); } @@ -2603,8 +2605,7 @@ cfiscsi_datamove_in(union ctl_io *io) i++; } - if (response->ip_data_len == - cs->cs_conn->ic_max_send_data_segment_length) { + if (response->ip_data_len == max_send_data_segment_length) { /* * Can't stuff more data into the current PDU; * queue it. Note that's not enough to check @@ -2619,6 +2620,8 @@ cfiscsi_datamove_in(union ctl_io *io) buffer_offset -= response->ip_data_len; break; } + PRIV_EXPDATASN(io) += howmany(response->ip_data_len, + cs->cs_conn->ic_max_send_data_segment_length); if (cb != NULL) { response->ip_prv0 = io->scsiio.kern_data_ref; response->ip_prv1 = io->scsiio.kern_data_arg; @@ -2654,6 +2657,8 @@ cfiscsi_datamove_in(union ctl_io *io) } } KASSERT(response->ip_data_len > 0, ("sending empty Data-In")); + PRIV_EXPDATASN(io) += howmany(response->ip_data_len, + cs->cs_conn->ic_max_send_data_segment_length); if (cb != NULL) { response->ip_prv0 = io->scsiio.kern_data_ref; response->ip_prv1 = io->scsiio.kern_data_arg; diff --git a/sys/dev/iscsi/icl.h b/sys/dev/iscsi/icl.h index adcd580f299b..bd12569a8957 100644 --- a/sys/dev/iscsi/icl.h +++ b/sys/dev/iscsi/icl.h @@ -93,6 +93,7 @@ struct icl_conn { #endif uint32_t ic_max_recv_data_segment_length; uint32_t ic_max_send_data_segment_length; + size_t ic_hw_isomax; size_t ic_maxtags; bool ic_header_crc32c; bool ic_data_crc32c; diff --git a/sys/dev/iscsi/iscsi.c b/sys/dev/iscsi/iscsi.c index 9a1b539e539b..60b3e3766da7 100644 --- a/sys/dev/iscsi/iscsi.c +++ b/sys/dev/iscsi/iscsi.c @@ -1154,7 +1154,7 @@ iscsi_pdu_handle_r2t(struct icl_pdu *response) struct iscsi_bhs_data_out *bhsdo; struct iscsi_outstanding *io; struct ccb_scsiio *csio; - size_t off, len, total_len; + size_t off, len, max_send_data_segment_length, total_len; int error; uint32_t datasn = 0; @@ -1203,11 +1203,16 @@ iscsi_pdu_handle_r2t(struct icl_pdu *response) //ISCSI_SESSION_DEBUG(is, "r2t; off %zd, len %zd", off, total_len); + if (is->is_conn->ic_hw_isomax != 0) + max_send_data_segment_length = is->is_conn->ic_hw_isomax; + else + max_send_data_segment_length = + is->is_conn->ic_max_send_data_segment_length; for (;;) { len = total_len; - if (len > is->is_conn->ic_max_send_data_segment_length) - len = is->is_conn->ic_max_send_data_segment_length; + if (len > max_send_data_segment_length) + len = max_send_data_segment_length; if (off + len > csio->dxfer_len) { ISCSI_SESSION_WARN(is, "target requested invalid " @@ -1232,7 +1237,7 @@ iscsi_pdu_handle_r2t(struct icl_pdu *response) bhsr2t->bhsr2t_initiator_task_tag; bhsdo->bhsdo_target_transfer_tag = bhsr2t->bhsr2t_target_transfer_tag; - bhsdo->bhsdo_datasn = htonl(datasn++); + bhsdo->bhsdo_datasn = htonl(datasn); bhsdo->bhsdo_buffer_offset = htonl(off); error = icl_pdu_append_data(request, csio->data_ptr + off, len, M_NOWAIT); @@ -1245,6 +1250,8 @@ iscsi_pdu_handle_r2t(struct icl_pdu *response) return; } + datasn += howmany(len, + is->is_conn->ic_max_send_data_segment_length); off += len; total_len -= len; From owner-dev-commits-src-all@freebsd.org Fri Aug 6 21:29:08 2021 Return-Path: Delivered-To: dev-commits-src-all@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 D7EE665F0C3; Fri, 6 Aug 2021 21:29: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 4GhJWm5mwwz3h1D; Fri, 6 Aug 2021 21:29: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 AF24914E45; Fri, 6 Aug 2021 21:29: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 176LT8Rl003057; Fri, 6 Aug 2021 21:29:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 176LT8JL003056; Fri, 6 Aug 2021 21:29:08 GMT (envelope-from git) Date: Fri, 6 Aug 2021 21:29:08 GMT Message-Id: <202108062129.176LT8JL003056@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 5b27e4b27caa - main - cxgbei: Support for ISO (iSCSI segmentation offload). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5b27e4b27caae840bd79ccc5cb7811a0c9acc656 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 21:29:08 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=5b27e4b27caae840bd79ccc5cb7811a0c9acc656 commit 5b27e4b27caae840bd79ccc5cb7811a0c9acc656 Author: John Baldwin AuthorDate: 2021-08-06 21:21:37 +0000 Commit: John Baldwin CommitDate: 2021-08-06 21:21:37 +0000 cxgbei: Support for ISO (iSCSI segmentation offload). ISO can be disabled before establishing a connection by setting dev.tNnex.N.toe.iso to 0. Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D31223 --- sys/dev/cxgbe/adapter.h | 1 + sys/dev/cxgbe/cxgbei/cxgbei.h | 2 + sys/dev/cxgbe/cxgbei/icl_cxgbei.c | 62 +++++++++++-- sys/dev/cxgbe/offload.h | 1 + sys/dev/cxgbe/t4_main.c | 5 ++ sys/dev/cxgbe/t4_sge.c | 5 ++ sys/dev/cxgbe/tom/t4_cpl_io.c | 184 ++++++++++++++++++++++++++++---------- sys/dev/cxgbe/tom/t4_tom.h | 52 +++++++++++ 8 files changed, 254 insertions(+), 58 deletions(-) diff --git a/sys/dev/cxgbe/adapter.h b/sys/dev/cxgbe/adapter.h index 3eb39ef5e987..14bc6cd9c36a 100644 --- a/sys/dev/cxgbe/adapter.h +++ b/sys/dev/cxgbe/adapter.h @@ -739,6 +739,7 @@ struct sge_ofld_txq { struct sge_wrq wrq; counter_u64_t tx_iscsi_pdus; counter_u64_t tx_iscsi_octets; + counter_u64_t tx_iscsi_iso_wrs; counter_u64_t tx_toe_tls_records; counter_u64_t tx_toe_tls_octets; } __aligned(CACHE_LINE_SIZE); diff --git a/sys/dev/cxgbe/cxgbei/cxgbei.h b/sys/dev/cxgbe/cxgbei/cxgbei.h index 45d3398d545c..433f15b743fe 100644 --- a/sys/dev/cxgbe/cxgbei/cxgbei.h +++ b/sys/dev/cxgbe/cxgbei/cxgbei.h @@ -134,6 +134,8 @@ struct cxgbei_data { struct sysctl_ctx_list ctx; /* from uld_activate to deactivate */ }; +#define CXGBEI_MAX_ISO_PAYLOAD 65535 + /* cxgbei.c */ u_int cxgbei_select_worker_thread(struct icl_cxgbei_conn *); diff --git a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c index d5b13fb5c3ea..a57d26ae21b8 100644 --- a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c @@ -335,13 +335,14 @@ finalize_pdu(struct icl_cxgbei_conn *icc, struct icl_cxgbei_pdu *icp) uint8_t ulp_submode, padding; struct mbuf *m, *last; struct iscsi_bhs *bhs; + int data_len; /* * Fix up the data segment mbuf first. */ m = ip->ip_data_mbuf; ulp_submode = icc->ulp_submode; - if (m) { + if (m != NULL) { last = m_last(m); /* @@ -349,7 +350,8 @@ finalize_pdu(struct icl_cxgbei_conn *icc, struct icl_cxgbei_pdu *icp) * necessary. There will definitely be room in the mbuf. */ padding = roundup2(ip->ip_data_len, 4) - ip->ip_data_len; - if (padding) { + if (padding != 0) { + MPASS(padding <= M_TRAILINGSPACE(last)); bzero(mtod(last, uint8_t *) + last->m_len, padding); last->m_len += padding; } @@ -367,9 +369,41 @@ finalize_pdu(struct icl_cxgbei_conn *icc, struct icl_cxgbei_pdu *icp) MPASS(m->m_len == sizeof(struct iscsi_bhs)); bhs = ip->ip_bhs; - bhs->bhs_data_segment_len[2] = ip->ip_data_len; - bhs->bhs_data_segment_len[1] = ip->ip_data_len >> 8; - bhs->bhs_data_segment_len[0] = ip->ip_data_len >> 16; + data_len = ip->ip_data_len; + if (data_len > icc->ic.ic_max_send_data_segment_length) { + struct iscsi_bhs_data_in *bhsdi; + int flags; + + KASSERT(padding == 0, ("%s: ISO with padding %d for icp %p", + __func__, padding, icp)); + switch (bhs->bhs_opcode) { + case ISCSI_BHS_OPCODE_SCSI_DATA_OUT: + flags = 1; + break; + case ISCSI_BHS_OPCODE_SCSI_DATA_IN: + flags = 2; + break; + default: + panic("invalid opcode %#x for ISO", bhs->bhs_opcode); + } + data_len = icc->ic.ic_max_send_data_segment_length; + bhsdi = (struct iscsi_bhs_data_in *)bhs; + if (bhsdi->bhsdi_flags & BHSDI_FLAGS_F) { + /* + * Firmware will set F on the final PDU in the + * burst. + */ + flags |= CXGBE_ISO_F; + bhsdi->bhsdi_flags &= ~BHSDI_FLAGS_F; + } + set_mbuf_iscsi_iso(m, true); + set_mbuf_iscsi_iso_flags(m, flags); + set_mbuf_iscsi_iso_mss(m, data_len); + } + + bhs->bhs_data_segment_len[2] = data_len; + bhs->bhs_data_segment_len[1] = data_len >> 8; + bhs->bhs_data_segment_len[0] = data_len >> 16; /* * Extract mbuf chain from PDU. @@ -477,7 +511,8 @@ icl_cxgbei_conn_pdu_append_data(struct icl_conn *ic, struct icl_pdu *ip, } MPASS(len == 0); } - MPASS(ip->ip_data_len <= ic->ic_max_send_data_segment_length); + MPASS(ip->ip_data_len <= max(ic->ic_max_send_data_segment_length, + ic->ic_hw_isomax)); return (0); } @@ -748,7 +783,7 @@ icl_cxgbei_conn_handoff(struct icl_conn *ic, int fd) struct tcpcb *tp; struct toepcb *toep; cap_rights_t rights; - int error; + int error, max_iso_pdus; MPASS(icc->icc_signature == CXGBEI_CONN_SIGNATURE); ICL_CONN_LOCK_ASSERT_NOT(ic); @@ -815,12 +850,21 @@ icl_cxgbei_conn_handoff(struct icl_conn *ic, int fd) icc->ulp_submode |= ULP_CRC_HEADER; if (ic->ic_data_crc32c) icc->ulp_submode |= ULP_CRC_DATA; + + if (icc->sc->tt.iso && chip_id(icc->sc) >= CHELSIO_T5) { + max_iso_pdus = CXGBEI_MAX_ISO_PAYLOAD / + ci->max_tx_pdu_len; + ic->ic_hw_isomax = max_iso_pdus * + ic->ic_max_send_data_segment_length; + } else + max_iso_pdus = 1; + so->so_options |= SO_NO_DDP; toep->params.ulp_mode = ULP_MODE_ISCSI; toep->ulpcb = icc; - send_iscsi_flowc_wr(icc->sc, toep, roundup(ci->max_tx_pdu_len, - tp->t_maxseg)); + send_iscsi_flowc_wr(icc->sc, toep, + roundup(max_iso_pdus * ci->max_tx_pdu_len, tp->t_maxseg)); set_ulp_mode_iscsi(icc->sc, toep, icc->ulp_submode); error = 0; } diff --git a/sys/dev/cxgbe/offload.h b/sys/dev/cxgbe/offload.h index 7efbd5f81f34..6607d0c173e7 100644 --- a/sys/dev/cxgbe/offload.h +++ b/sys/dev/cxgbe/offload.h @@ -233,6 +233,7 @@ struct tom_tunables { int cop_managed_offloading; int autorcvbuf_inc; int update_hc_on_pmtu_change; + int iso; }; /* iWARP driver tunables */ diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c index 67500b0c44b9..9865bd7048ae 100644 --- a/sys/dev/cxgbe/t4_main.c +++ b/sys/dev/cxgbe/t4_main.c @@ -7590,6 +7590,10 @@ t4_sysctls(struct adapter *sc) &sc->tt.update_hc_on_pmtu_change, 0, "Update hostcache entry if the PMTU changes"); + sc->tt.iso = 1; + SYSCTL_ADD_INT(ctx, children, OID_AUTO, "iso", CTLFLAG_RW, + &sc->tt.iso, 0, "Enable iSCSI segmentation offload"); + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "timer_tick", CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, sysctl_tp_tick, "A", "TP timer tick (us)"); @@ -11896,6 +11900,7 @@ clear_stats(struct adapter *sc, u_int port_id) ofld_txq->wrq.tx_wrs_copied = 0; counter_u64_zero(ofld_txq->tx_iscsi_pdus); counter_u64_zero(ofld_txq->tx_iscsi_octets); + counter_u64_zero(ofld_txq->tx_iscsi_iso_wrs); counter_u64_zero(ofld_txq->tx_toe_tls_records); counter_u64_zero(ofld_txq->tx_toe_tls_octets); } diff --git a/sys/dev/cxgbe/t4_sge.c b/sys/dev/cxgbe/t4_sge.c index 1d0e334896be..5093c84516bc 100644 --- a/sys/dev/cxgbe/t4_sge.c +++ b/sys/dev/cxgbe/t4_sge.c @@ -4787,6 +4787,7 @@ alloc_ofld_txq(struct vi_info *vi, struct sge_ofld_txq *ofld_txq, int idx) ofld_txq->tx_iscsi_pdus = counter_u64_alloc(M_WAITOK); ofld_txq->tx_iscsi_octets = counter_u64_alloc(M_WAITOK); + ofld_txq->tx_iscsi_iso_wrs = counter_u64_alloc(M_WAITOK); ofld_txq->tx_toe_tls_records = counter_u64_alloc(M_WAITOK); ofld_txq->tx_toe_tls_octets = counter_u64_alloc(M_WAITOK); add_ofld_txq_sysctls(&vi->ctx, oid, ofld_txq); @@ -4824,6 +4825,7 @@ free_ofld_txq(struct vi_info *vi, struct sge_ofld_txq *ofld_txq) MPASS(!(eq->flags & EQ_HW_ALLOCATED)); counter_u64_free(ofld_txq->tx_iscsi_pdus); counter_u64_free(ofld_txq->tx_iscsi_octets); + counter_u64_free(ofld_txq->tx_iscsi_iso_wrs); counter_u64_free(ofld_txq->tx_toe_tls_records); counter_u64_free(ofld_txq->tx_toe_tls_octets); free_wrq(sc, &ofld_txq->wrq); @@ -4848,6 +4850,9 @@ add_ofld_txq_sysctls(struct sysctl_ctx_list *ctx, struct sysctl_oid *oid, SYSCTL_ADD_COUNTER_U64(ctx, children, OID_AUTO, "tx_iscsi_octets", CTLFLAG_RD, &ofld_txq->tx_iscsi_octets, "# of payload octets in transmitted iSCSI PDUs"); + SYSCTL_ADD_COUNTER_U64(ctx, children, OID_AUTO, "tx_iscsi_iso_wrs", + CTLFLAG_RD, &ofld_txq->tx_iscsi_iso_wrs, + "# of iSCSI segmentation offload work requests"); SYSCTL_ADD_COUNTER_U64(ctx, children, OID_AUTO, "tx_toe_tls_records", CTLFLAG_RD, &ofld_txq->tx_toe_tls_records, "# of TOE TLS records transmitted"); diff --git a/sys/dev/cxgbe/tom/t4_cpl_io.c b/sys/dev/cxgbe/tom/t4_cpl_io.c index a75f93ded5f6..9013f03ddaa3 100644 --- a/sys/dev/cxgbe/tom/t4_cpl_io.c +++ b/sys/dev/cxgbe/tom/t4_cpl_io.c @@ -67,6 +67,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include + #include "common/common.h" #include "common/t4_msg.h" #include "common/t4_regs.h" @@ -516,38 +518,44 @@ t4_close_conn(struct adapter *sc, struct toepcb *toep) #define MAX_OFLD_TX_CREDITS (SGE_MAX_WR_LEN / 16) #define MIN_OFLD_TX_CREDITS (howmany(sizeof(struct fw_ofld_tx_data_wr) + 1, 16)) +#define MIN_ISO_TX_CREDITS (howmany(sizeof(struct cpl_tx_data_iso), 16)) +#define MIN_TX_CREDITS(iso) \ + (MIN_OFLD_TX_CREDITS + ((iso) ? MIN_ISO_TX_CREDITS : 0)) /* Maximum amount of immediate data we could stuff in a WR */ static inline int -max_imm_payload(int tx_credits) +max_imm_payload(int tx_credits, int iso) { + const int iso_cpl_size = iso ? sizeof(struct cpl_tx_data_iso) : 0; const int n = 1; /* Use no more than one desc for imm. data WR */ KASSERT(tx_credits >= 0 && tx_credits <= MAX_OFLD_TX_CREDITS, ("%s: %d credits", __func__, tx_credits)); - if (tx_credits < MIN_OFLD_TX_CREDITS) + if (tx_credits < MIN_TX_CREDITS(iso)) return (0); if (tx_credits >= (n * EQ_ESIZE) / 16) - return ((n * EQ_ESIZE) - sizeof(struct fw_ofld_tx_data_wr)); + return ((n * EQ_ESIZE) - sizeof(struct fw_ofld_tx_data_wr) - + iso_cpl_size); else - return (tx_credits * 16 - sizeof(struct fw_ofld_tx_data_wr)); + return (tx_credits * 16 - sizeof(struct fw_ofld_tx_data_wr) - + iso_cpl_size); } /* Maximum number of SGL entries we could stuff in a WR */ static inline int -max_dsgl_nsegs(int tx_credits) +max_dsgl_nsegs(int tx_credits, int iso) { int nseg = 1; /* ulptx_sgl has room for 1, rest ulp_tx_sge_pair */ - int sge_pair_credits = tx_credits - MIN_OFLD_TX_CREDITS; + int sge_pair_credits = tx_credits - MIN_TX_CREDITS(iso); KASSERT(tx_credits >= 0 && tx_credits <= MAX_OFLD_TX_CREDITS, ("%s: %d credits", __func__, tx_credits)); - if (tx_credits < MIN_OFLD_TX_CREDITS) + if (tx_credits < MIN_TX_CREDITS(iso)) return (0); nseg += 2 * (sge_pair_credits * 16 / 24); @@ -558,12 +566,13 @@ max_dsgl_nsegs(int tx_credits) } static inline void -write_tx_wr(void *dst, struct toepcb *toep, unsigned int immdlen, - unsigned int plen, uint8_t credits, int shove, int ulp_submode) +write_tx_wr(void *dst, struct toepcb *toep, int fw_wr_opcode, + unsigned int immdlen, unsigned int plen, uint8_t credits, int shove, + int ulp_submode) { struct fw_ofld_tx_data_wr *txwr = dst; - txwr->op_to_immdlen = htobe32(V_WR_OP(FW_OFLD_TX_DATA_WR) | + txwr->op_to_immdlen = htobe32(V_WR_OP(fw_wr_opcode) | V_FW_WR_IMMDLEN(immdlen)); txwr->flowid_len16 = htobe32(V_FW_WR_FLOWID(toep->tid) | V_FW_WR_LEN16(credits)); @@ -707,8 +716,8 @@ t4_push_frames(struct adapter *sc, struct toepcb *toep, int drop) txsd = &toep->txsd[toep->txsd_pidx]; do { tx_credits = min(toep->tx_credits, MAX_OFLD_TX_CREDITS); - max_imm = max_imm_payload(tx_credits); - max_nsegs = max_dsgl_nsegs(tx_credits); + max_imm = max_imm_payload(tx_credits, 0); + max_nsegs = max_dsgl_nsegs(tx_credits, 0); SOCKBUF_LOCK(sb); sowwakeup = drop; @@ -832,7 +841,8 @@ t4_push_frames(struct adapter *sc, struct toepcb *toep, int drop) } txwr = wrtod(wr); credits = howmany(wr->wr_len, 16); - write_tx_wr(txwr, toep, plen, plen, credits, shove, 0); + write_tx_wr(txwr, toep, FW_OFLD_TX_DATA_WR, plen, plen, + credits, shove, 0); m_copydata(sndptr, 0, plen, (void *)(txwr + 1)); nsegs = 0; } else { @@ -851,7 +861,8 @@ t4_push_frames(struct adapter *sc, struct toepcb *toep, int drop) } txwr = wrtod(wr); credits = howmany(wr_len, 16); - write_tx_wr(txwr, toep, 0, plen, credits, shove, 0); + write_tx_wr(txwr, toep, FW_OFLD_TX_DATA_WR, 0, plen, + credits, shove, 0); write_tx_sgl(txwr + 1, sndptr, m, nsegs, max_nsegs_1mbuf); if (wr_len & 0xf) { @@ -927,18 +938,71 @@ rqdrop_locked(struct mbufq *q, int plen) } } +/* + * Not a bit in the TCB, but is a bit in the ulp_submode field of the + * CPL_TX_DATA flags field in FW_ISCSI_TX_DATA_WR. + */ +#define ULP_ISO G_TX_ULP_SUBMODE(F_FW_ISCSI_TX_DATA_WR_ULPSUBMODE_ISO) + +static void +write_tx_data_iso(void *dst, u_int ulp_submode, uint8_t flags, uint16_t mss, + int len, int npdu) +{ + struct cpl_tx_data_iso *cpl; + unsigned int burst_size; + unsigned int last; + + /* + * The firmware will set the 'F' bit on the last PDU when + * either condition is true: + * + * - this large PDU is marked as the "last" slice + * + * - the amount of data payload bytes equals the burst_size + * + * The strategy used here is to always set the burst_size + * artificially high (len includes the size of the template + * BHS) and only set the "last" flag if the original PDU had + * 'F' set. + */ + burst_size = len; + last = !!(flags & CXGBE_ISO_F); + + cpl = (struct cpl_tx_data_iso *)dst; + cpl->op_to_scsi = htonl(V_CPL_TX_DATA_ISO_OP(CPL_TX_DATA_ISO) | + V_CPL_TX_DATA_ISO_FIRST(1) | V_CPL_TX_DATA_ISO_LAST(last) | + V_CPL_TX_DATA_ISO_CPLHDRLEN(0) | + V_CPL_TX_DATA_ISO_HDRCRC(!!(ulp_submode & ULP_CRC_HEADER)) | + V_CPL_TX_DATA_ISO_PLDCRC(!!(ulp_submode & ULP_CRC_DATA)) | + V_CPL_TX_DATA_ISO_IMMEDIATE(0) | + V_CPL_TX_DATA_ISO_SCSI(CXGBE_ISO_TYPE(flags))); + + cpl->ahs_len = 0; + cpl->mpdu = htons(DIV_ROUND_UP(mss, 4)); + cpl->burst_size = htonl(DIV_ROUND_UP(burst_size, 4)); + cpl->len = htonl(len); + cpl->reserved2_seglen_offset = htonl(0); + cpl->datasn_offset = htonl(0); + cpl->buffer_offset = htonl(0); + cpl->reserved3 = 0; +} + static struct wrqe * write_iscsi_mbuf_wr(struct toepcb *toep, struct mbuf *sndptr) { struct mbuf *m; struct fw_ofld_tx_data_wr *txwr; + struct cpl_tx_data_iso *cpl_iso; + void *p; struct wrqe *wr; u_int plen, nsegs, credits, max_imm, max_nsegs, max_nsegs_1mbuf; - u_int adjusted_plen, ulp_submode; + u_int adjusted_plen, imm_data, ulp_submode; struct inpcb *inp = toep->inp; struct tcpcb *tp = intotcpcb(inp); - int tx_credits, shove; + int tx_credits, shove, npdu, wr_len; + uint16_t iso_mss; static const u_int ulp_extra_len[] = {0, 4, 4, 8}; + bool iso; M_ASSERTPKTHDR(sndptr); @@ -958,8 +1022,10 @@ write_iscsi_mbuf_wr(struct toepcb *toep, struct mbuf *sndptr) return (wr); } - max_imm = max_imm_payload(tx_credits); - max_nsegs = max_dsgl_nsegs(tx_credits); + iso = mbuf_iscsi_iso(sndptr); + max_imm = max_imm_payload(tx_credits, iso); + max_nsegs = max_dsgl_nsegs(tx_credits, iso); + iso_mss = mbuf_iscsi_iso_mss(sndptr); plen = 0; nsegs = 0; @@ -993,8 +1059,6 @@ write_iscsi_mbuf_wr(struct toepcb *toep, struct mbuf *sndptr) MPASS(sndptr->m_pkthdr.len == plen); shove = !(tp->t_flags & TF_MORETOCOME); - ulp_submode = mbuf_ulp_submode(sndptr); - MPASS(ulp_submode < nitems(ulp_extra_len)); /* * plen doesn't include header and data digests, which are @@ -1002,51 +1066,73 @@ write_iscsi_mbuf_wr(struct toepcb *toep, struct mbuf *sndptr) * they do occupy TCP sequence space and need to be accounted * for. */ - adjusted_plen = plen + ulp_extra_len[ulp_submode]; + ulp_submode = mbuf_ulp_submode(sndptr); + MPASS(ulp_submode < nitems(ulp_extra_len)); + npdu = iso ? howmany(plen - ISCSI_BHS_SIZE, iso_mss) : 1; + adjusted_plen = plen + ulp_extra_len[ulp_submode] * npdu; + if (iso) + adjusted_plen += ISCSI_BHS_SIZE * (npdu - 1); + wr_len = sizeof(*txwr); + if (iso) + wr_len += sizeof(struct cpl_tx_data_iso); if (plen <= max_imm) { - /* Immediate data tx */ - - wr = alloc_wrqe(roundup2(sizeof(*txwr) + plen, 16), - &toep->ofld_txq->wrq); - if (wr == NULL) { - /* XXX: how will we recover from this? */ - return (NULL); - } - txwr = wrtod(wr); - credits = howmany(wr->wr_len, 16); - write_tx_wr(txwr, toep, plen, adjusted_plen, credits, - shove, ulp_submode); - m_copydata(sndptr, 0, plen, (void *)(txwr + 1)); + imm_data = plen; + wr_len += plen; nsegs = 0; } else { - int wr_len; - /* DSGL tx */ - wr_len = sizeof(*txwr) + sizeof(struct ulptx_sgl) + + imm_data = 0; + wr_len += sizeof(struct ulptx_sgl) + ((3 * (nsegs - 1)) / 2 + ((nsegs - 1) & 1)) * 8; - wr = alloc_wrqe(roundup2(wr_len, 16), - &toep->ofld_txq->wrq); - if (wr == NULL) { - /* XXX: how will we recover from this? */ - return (NULL); - } - txwr = wrtod(wr); - credits = howmany(wr_len, 16); - write_tx_wr(txwr, toep, 0, adjusted_plen, credits, - shove, ulp_submode); - write_tx_sgl(txwr + 1, sndptr, m, nsegs, max_nsegs_1mbuf); + } + + wr = alloc_wrqe(roundup2(wr_len, 16), &toep->ofld_txq->wrq); + if (wr == NULL) { + /* XXX: how will we recover from this? */ + return (NULL); + } + txwr = wrtod(wr); + credits = howmany(wr->wr_len, 16); + + if (iso) { + write_tx_wr(txwr, toep, FW_ISCSI_TX_DATA_WR, + imm_data + sizeof(struct cpl_tx_data_iso), + adjusted_plen, credits, shove, ulp_submode | ULP_ISO); + cpl_iso = (struct cpl_tx_data_iso *)(txwr + 1); + MPASS(plen == sndptr->m_pkthdr.len); + write_tx_data_iso(cpl_iso, ulp_submode, + mbuf_iscsi_iso_flags(sndptr), iso_mss, plen, npdu); + p = cpl_iso + 1; + } else { + write_tx_wr(txwr, toep, FW_OFLD_TX_DATA_WR, imm_data, + adjusted_plen, credits, shove, ulp_submode); + p = txwr + 1; + } + + if (imm_data != 0) { + m_copydata(sndptr, 0, plen, p); + } else { + write_tx_sgl(p, sndptr, m, nsegs, max_nsegs_1mbuf); if (wr_len & 0xf) { uint64_t *pad = (uint64_t *)((uintptr_t)txwr + wr_len); *pad = 0; } } + KASSERT(toep->tx_credits >= credits, + ("%s: not enough credits: credits %u " + "toep->tx_credits %u tx_credits %u nsegs %u " + "max_nsegs %u iso %d", __func__, credits, + toep->tx_credits, tx_credits, nsegs, max_nsegs, iso)); + tp->snd_nxt += adjusted_plen; tp->snd_max += adjusted_plen; - counter_u64_add(toep->ofld_txq->tx_iscsi_pdus, 1); + counter_u64_add(toep->ofld_txq->tx_iscsi_pdus, npdu); counter_u64_add(toep->ofld_txq->tx_iscsi_octets, plen); + if (iso) + counter_u64_add(toep->ofld_txq->tx_iscsi_iso_wrs, 1); return (wr); } diff --git a/sys/dev/cxgbe/tom/t4_tom.h b/sys/dev/cxgbe/tom/t4_tom.h index 5dd04ff548e5..10d9cfe87960 100644 --- a/sys/dev/cxgbe/tom/t4_tom.h +++ b/sys/dev/cxgbe/tom/t4_tom.h @@ -362,6 +362,58 @@ mbuf_ulp_submode(struct mbuf *m) return (m->m_pkthdr.PH_per.eight[0]); } +static inline void +set_mbuf_iscsi_iso(struct mbuf *m, bool iso) +{ + + M_ASSERTPKTHDR(m); + m->m_pkthdr.PH_per.eight[1] = iso; +} + +static inline bool +mbuf_iscsi_iso(struct mbuf *m) +{ + + M_ASSERTPKTHDR(m); + return (m->m_pkthdr.PH_per.eight[1]); +} + +/* Flags for iSCSI segmentation offload. */ +#define CXGBE_ISO_TYPE(flags) ((flags) & 0x3) +#define CXGBE_ISO_F 0x4 + +static inline void +set_mbuf_iscsi_iso_flags(struct mbuf *m, uint8_t flags) +{ + + M_ASSERTPKTHDR(m); + m->m_pkthdr.PH_per.eight[2] = flags; +} + +static inline uint8_t +mbuf_iscsi_iso_flags(struct mbuf *m) +{ + + M_ASSERTPKTHDR(m); + return (m->m_pkthdr.PH_per.eight[2]); +} + +static inline void +set_mbuf_iscsi_iso_mss(struct mbuf *m, uint16_t mss) +{ + + M_ASSERTPKTHDR(m); + m->m_pkthdr.PH_per.sixteen[2] = mss; +} + +static inline uint16_t +mbuf_iscsi_iso_mss(struct mbuf *m) +{ + + M_ASSERTPKTHDR(m); + return (m->m_pkthdr.PH_per.sixteen[2]); +} + /* t4_tom.c */ struct toepcb *alloc_toepcb(struct vi_info *, int); int init_toepcb(struct vi_info *, struct toepcb *); From owner-dev-commits-src-all@freebsd.org Fri Aug 6 21:50:52 2021 Return-Path: Delivered-To: dev-commits-src-all@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 06B4565F2FF; Fri, 6 Aug 2021 21:50:52 +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 4GhK0q6qjXz3htM; Fri, 6 Aug 2021 21:50:51 +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 D24BE15609; Fri, 6 Aug 2021 21:50:51 +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 176Lopms038907; Fri, 6 Aug 2021 21:50:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 176LopTh038906; Fri, 6 Aug 2021 21:50:51 GMT (envelope-from git) Date: Fri, 6 Aug 2021 21:50:51 GMT Message-Id: <202108062150.176LopTh038906@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: b701c27bf05f - stable/12 - pf: remove DIOCGETSTATESNV 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/stable/12 X-Git-Reftype: branch X-Git-Commit: b701c27bf05fc68a0f52dc10f23e28b2ec8a380c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 21:50:52 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=b701c27bf05fc68a0f52dc10f23e28b2ec8a380c commit b701c27bf05fc68a0f52dc10f23e28b2ec8a380c Author: Kristof Provost AuthorDate: 2021-07-06 11:13:24 +0000 Commit: Kristof Provost CommitDate: 2021-08-06 07:11:45 +0000 pf: remove DIOCGETSTATESNV While nvlists are very useful in maximising flexibility for future extensions their performance is simply unacceptably bad for the getstates feature, where we can easily want to export a million states or more. The DIOCGETSTATESNV call has been MFCd, but has not hit a release on any branch, so we can still remove it everywhere. Reviewed by: mjg MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31099 (cherry picked from commit b69019c14cd89a5e699bc6e69941aec5b1041b1e) --- sys/net/pfvar.h | 1 - sys/netpfil/pf/pf_ioctl.c | 86 ----------------------------------------------- 2 files changed, 87 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 35e2f0f717ba..52fd015ba54e 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -1441,7 +1441,6 @@ struct pfioc_iface { #define DIOCNATLOOK _IOWR('D', 23, struct pfioc_natlook) #define DIOCSETDEBUG _IOWR('D', 24, u_int32_t) #define DIOCGETSTATES _IOWR('D', 25, struct pfioc_states) -#define DIOCGETSTATESNV _IOWR('D', 25, struct pfioc_nv) #define DIOCCHANGERULE _IOWR('D', 26, struct pfioc_rule) /* XXX cut 26 - 28 */ #define DIOCSETTIMEOUT _IOWR('D', 29, struct pfioc_tm) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index a3026d394bde..8a6286b5c21a 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -209,7 +209,6 @@ static int pf_killstates_row(struct pf_kstate_kill *, static int pf_killstates_nv(struct pfioc_nv *); static int pf_clearstates_nv(struct pfioc_nv *); static int pf_getstate(struct pfioc_nv *); -static int pf_getstates(struct pfioc_nv *); static int pf_clear_tables(void); static void pf_clear_srcnodes(struct pf_ksrc_node *); static void pf_kill_srcnodes(struct pfioc_src_node_kill *); @@ -2120,7 +2119,6 @@ pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td case DIOCSETDEBUG: case DIOCGETSTATES: case DIOCGETSTATESV2: - case DIOCGETSTATESNV: case DIOCGETTIMEOUT: case DIOCCLRRULECTRS: case DIOCGETLIMIT: @@ -2175,7 +2173,6 @@ pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td case DIOCGETSTATUS: case DIOCGETSTATES: case DIOCGETSTATESV2: - case DIOCGETSTATESNV: case DIOCGETTIMEOUT: case DIOCGETLIMIT: case DIOCGETALTQSV0: @@ -2976,11 +2973,6 @@ DIOCGETSTATESV2_full: break; } - case DIOCGETSTATESNV: { - error = pf_getstates((struct pfioc_nv *)addr); - break; - } - case DIOCGETSTATUS: { struct pf_status *s = (struct pf_status *)addr; @@ -5270,84 +5262,6 @@ errout: return (error); } -static int -pf_getstates(struct pfioc_nv *nv) -{ - nvlist_t *nvl = NULL, *nvls; - void *nvlpacked = NULL; - struct pf_kstate *s = NULL; - int error = 0; - uint64_t count = 0; - -#define ERROUT(x) ERROUT_FUNCTION(errout, x) - - nvl = nvlist_create(0); - if (nvl == NULL) - ERROUT(ENOMEM); - - nvlist_add_number(nvl, "count", uma_zone_get_cur(V_pf_state_z)); - - for (int i = 0; i < pf_hashmask; i++) { - struct pf_idhash *ih = &V_pf_idhash[i]; - - /* Avoid taking the lock if there are no states in the row. */ - if (LIST_EMPTY(&ih->states)) - continue; - - PF_HASHROW_LOCK(ih); - LIST_FOREACH(s, &ih->states, entry) { - if (s->timeout == PFTM_UNLINKED) - continue; - - if (SIGPENDING(curthread)) { - PF_HASHROW_UNLOCK(ih); - ERROUT(EINTR); - } - - nvls = pf_state_to_nvstate(s); - if (nvls == NULL) { - PF_HASHROW_UNLOCK(ih); - ERROUT(ENOMEM); - } - if ((nvlist_size(nvl) + nvlist_size(nvls)) > nv->size) { - /* We've run out of room for more states. */ - nvlist_destroy(nvls); - PF_HASHROW_UNLOCK(ih); - goto DIOCGETSTATESNV_full; - } - nvlist_append_nvlist_array(nvl, "states", nvls); - nvlist_destroy(nvls); - count++; - } - PF_HASHROW_UNLOCK(ih); - } - - /* We've managed to put them all the available space. Let's make sure - * 'count' matches our array (that's racy, because we don't hold a lock - * over all states, only over each row individually. */ - (void)nvlist_take_number(nvl, "count"); - nvlist_add_number(nvl, "count", count); - -DIOCGETSTATESNV_full: - - nvlpacked = nvlist_pack(nvl, &nv->len); - if (nvlpacked == NULL) - ERROUT(ENOMEM); - - if (nv->size == 0) - ERROUT(0); - else if (nv->size < nv->len) - ERROUT(ENOSPC); - - error = copyout(nvlpacked, nv->data, nv->len); - -#undef ERROUT -errout: - free(nvlpacked, M_NVLIST); - nvlist_destroy(nvl); - return (error); -} - /* * XXX - Check for version missmatch!!! */ From owner-dev-commits-src-all@freebsd.org Fri Aug 6 21:50:53 2021 Return-Path: Delivered-To: dev-commits-src-all@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 54BCE65F7BA; Fri, 6 Aug 2021 21:50: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 4GhK0s0z4dz3hsm; Fri, 6 Aug 2021 21:50: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 082D0154D4; Fri, 6 Aug 2021 21:50: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 176LoqDu039022; Fri, 6 Aug 2021 21:50:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 176Loq4q039021; Fri, 6 Aug 2021 21:50:52 GMT (envelope-from git) Date: Fri, 6 Aug 2021 21:50:52 GMT Message-Id: <202108062150.176Loq4q039021@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 987a238d6eaa - stable/12 - UPDATING: Document the removal of DIOCGETSTATESNV 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/stable/12 X-Git-Reftype: branch X-Git-Commit: 987a238d6eaaeb0d11c163135e4e1b4617153d2c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 21:50:53 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=987a238d6eaaeb0d11c163135e4e1b4617153d2c commit 987a238d6eaaeb0d11c163135e4e1b4617153d2c Author: Kristof Provost AuthorDate: 2021-07-14 13:51:36 +0000 Commit: Kristof Provost CommitDate: 2021-08-06 07:12:48 +0000 UPDATING: Document the removal of DIOCGETSTATESNV MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 3412900333e659124f61ada6389ef40dd0f3ddd4) --- UPDATING | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/UPDATING b/UPDATING index dcde1cb75903..88a610e4705c 100644 --- a/UPDATING +++ b/UPDATING @@ -17,6 +17,12 @@ from older versions of FreeBSD, try WITHOUT_CLANG and WITH_GCC to bootstrap to the tip of head, and then rebuild without this option. The bootstrap process from older version of current across the gcc/clang cutover is a bit fragile. +20210730: + Commit b69019c14cd8 removes pf's DIOCGETSTATESNV ioctl. + As of be70c7a50d32 it is no longer used by userspace, but it does mean + users may not be able to enumerate pf states if they update the kernel + past c021ff986e2b without first updating userspace past be70c7a50d32. + 20210715: The 20210707 awk update brought in a change in behavior. This has been corrected as of d4d252c49976. Between these dates, if you From owner-dev-commits-src-all@freebsd.org Fri Aug 6 21:50:52 2021 Return-Path: Delivered-To: dev-commits-src-all@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 CB7DF65FB8F; Fri, 6 Aug 2021 21:50:52 +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 4GhK0r4Lntz3hhj; Fri, 6 Aug 2021 21:50:52 +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 7DA9E154D2; Fri, 6 Aug 2021 21:50: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 176Loqdg038994; Fri, 6 Aug 2021 21:50:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 176LoqjG038993; Fri, 6 Aug 2021 21:50:52 GMT (envelope-from git) Date: Fri, 6 Aug 2021 21:50:52 GMT Message-Id: <202108062150.176LoqjG038993@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 830afa2979ab - stable/13 - pf: remove DIOCGETSTATESNV 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 830afa2979ab5e20692e2fb9d0fe54eb6155b3af Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 21:50:52 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=830afa2979ab5e20692e2fb9d0fe54eb6155b3af commit 830afa2979ab5e20692e2fb9d0fe54eb6155b3af Author: Kristof Provost AuthorDate: 2021-07-06 11:13:24 +0000 Commit: Kristof Provost CommitDate: 2021-08-06 21:49:48 +0000 pf: remove DIOCGETSTATESNV While nvlists are very useful in maximising flexibility for future extensions their performance is simply unacceptably bad for the getstates feature, where we can easily want to export a million states or more. The DIOCGETSTATESNV call has been MFCd, but has not hit a release on any branch, so we can still remove it everywhere. Reviewed by: mjg MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31099 (cherry picked from commit b69019c14cd89a5e699bc6e69941aec5b1041b1e) --- sys/net/pfvar.h | 1 - sys/netpfil/pf/pf_ioctl.c | 86 ----------------------------------------------- 2 files changed, 87 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 7a244ac13d72..e037947a5375 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -1440,7 +1440,6 @@ struct pfioc_iface { #define DIOCNATLOOK _IOWR('D', 23, struct pfioc_natlook) #define DIOCSETDEBUG _IOWR('D', 24, u_int32_t) #define DIOCGETSTATES _IOWR('D', 25, struct pfioc_states) -#define DIOCGETSTATESNV _IOWR('D', 25, struct pfioc_nv) #define DIOCCHANGERULE _IOWR('D', 26, struct pfioc_rule) /* XXX cut 26 - 28 */ #define DIOCSETTIMEOUT _IOWR('D', 29, struct pfioc_tm) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 01601db07ea0..5fd711d1c574 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -209,7 +209,6 @@ static int pf_killstates_row(struct pf_kstate_kill *, static int pf_killstates_nv(struct pfioc_nv *); static int pf_clearstates_nv(struct pfioc_nv *); static int pf_getstate(struct pfioc_nv *); -static int pf_getstates(struct pfioc_nv *); static int pf_clear_tables(void); static void pf_clear_srcnodes(struct pf_ksrc_node *); static void pf_kill_srcnodes(struct pfioc_src_node_kill *); @@ -2119,7 +2118,6 @@ pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td case DIOCSETDEBUG: case DIOCGETSTATES: case DIOCGETSTATESV2: - case DIOCGETSTATESNV: case DIOCGETTIMEOUT: case DIOCCLRRULECTRS: case DIOCGETLIMIT: @@ -2174,7 +2172,6 @@ pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td case DIOCGETSTATUS: case DIOCGETSTATES: case DIOCGETSTATESV2: - case DIOCGETSTATESNV: case DIOCGETTIMEOUT: case DIOCGETLIMIT: case DIOCGETALTQSV0: @@ -2963,11 +2960,6 @@ DIOCGETSTATESV2_full: break; } - case DIOCGETSTATESNV: { - error = pf_getstates((struct pfioc_nv *)addr); - break; - } - case DIOCGETSTATUS: { struct pf_status *s = (struct pf_status *)addr; @@ -5203,84 +5195,6 @@ errout: return (error); } -static int -pf_getstates(struct pfioc_nv *nv) -{ - nvlist_t *nvl = NULL, *nvls; - void *nvlpacked = NULL; - struct pf_kstate *s = NULL; - int error = 0; - uint64_t count = 0; - -#define ERROUT(x) ERROUT_FUNCTION(errout, x) - - nvl = nvlist_create(0); - if (nvl == NULL) - ERROUT(ENOMEM); - - nvlist_add_number(nvl, "count", uma_zone_get_cur(V_pf_state_z)); - - for (int i = 0; i < pf_hashmask; i++) { - struct pf_idhash *ih = &V_pf_idhash[i]; - - /* Avoid taking the lock if there are no states in the row. */ - if (LIST_EMPTY(&ih->states)) - continue; - - PF_HASHROW_LOCK(ih); - LIST_FOREACH(s, &ih->states, entry) { - if (s->timeout == PFTM_UNLINKED) - continue; - - if (SIGPENDING(curthread)) { - PF_HASHROW_UNLOCK(ih); - ERROUT(EINTR); - } - - nvls = pf_state_to_nvstate(s); - if (nvls == NULL) { - PF_HASHROW_UNLOCK(ih); - ERROUT(ENOMEM); - } - if ((nvlist_size(nvl) + nvlist_size(nvls)) > nv->size) { - /* We've run out of room for more states. */ - nvlist_destroy(nvls); - PF_HASHROW_UNLOCK(ih); - goto DIOCGETSTATESNV_full; - } - nvlist_append_nvlist_array(nvl, "states", nvls); - nvlist_destroy(nvls); - count++; - } - PF_HASHROW_UNLOCK(ih); - } - - /* We've managed to put them all the available space. Let's make sure - * 'count' matches our array (that's racy, because we don't hold a lock - * over all states, only over each row individually. */ - (void)nvlist_take_number(nvl, "count"); - nvlist_add_number(nvl, "count", count); - -DIOCGETSTATESNV_full: - - nvlpacked = nvlist_pack(nvl, &nv->len); - if (nvlpacked == NULL) - ERROUT(ENOMEM); - - if (nv->size == 0) - ERROUT(0); - else if (nv->size < nv->len) - ERROUT(ENOSPC); - - error = copyout(nvlpacked, nv->data, nv->len); - -#undef ERROUT -errout: - free(nvlpacked, M_NVLIST); - nvlist_destroy(nvl); - return (error); -} - /* * XXX - Check for version missmatch!!! */ From owner-dev-commits-src-all@freebsd.org Fri Aug 6 21:50:53 2021 Return-Path: Delivered-To: dev-commits-src-all@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 D1C7065F9A4; Fri, 6 Aug 2021 21:50: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 4GhK0s5Dn8z3hhk; Fri, 6 Aug 2021 21:50: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 98DD71560A; Fri, 6 Aug 2021 21:50: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 176LorKD039046; Fri, 6 Aug 2021 21:50:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 176LorDn039045; Fri, 6 Aug 2021 21:50:53 GMT (envelope-from git) Date: Fri, 6 Aug 2021 21:50:53 GMT Message-Id: <202108062150.176LorDn039045@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 10ea921d32d6 - stable/13 - UPDATING: Document the removal of DIOCGETSTATESNV 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 10ea921d32d67c8c145e9bbe0bdb1e8f3bed55a2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 21:50:54 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=10ea921d32d67c8c145e9bbe0bdb1e8f3bed55a2 commit 10ea921d32d67c8c145e9bbe0bdb1e8f3bed55a2 Author: Kristof Provost AuthorDate: 2021-07-14 13:51:36 +0000 Commit: Kristof Provost CommitDate: 2021-08-06 21:49:48 +0000 UPDATING: Document the removal of DIOCGETSTATESNV MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 3412900333e659124f61ada6389ef40dd0f3ddd4) --- UPDATING | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/UPDATING b/UPDATING index 503ce0962398..6ad89bbf6602 100644 --- a/UPDATING +++ b/UPDATING @@ -17,6 +17,12 @@ and/or ports. KAPI between the NFS modules. Bump __FreeBSD_version to 1300514. All NFS modules must be rebuilt from sources. +20210730: + Commit b69019c14cd8 removes pf's DIOCGETSTATESNV ioctl. + As of be70c7a50d32 it is no longer used by userspace, but it does mean + users may not be able to enumerate pf states if they update the kernel + past c021ff986e2b without first updating userspace past be70c7a50d32. + 20210718: Bump __FreeBSD_version to 1300512 after merging LinuxKPI, OFED, net80211, and driver changes in order to support building From owner-dev-commits-src-all@freebsd.org Fri Aug 6 23:10:26 2021 Return-Path: Delivered-To: dev-commits-src-all@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 20C2B660787; Fri, 6 Aug 2021 23:10: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 4GhLmf09B0z3mGl; Fri, 6 Aug 2021 23:10: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 E224716520; Fri, 6 Aug 2021 23:10: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 176NAPWq043871; Fri, 6 Aug 2021 23:10:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 176NAPf2043870; Fri, 6 Aug 2021 23:10:25 GMT (envelope-from git) Date: Fri, 6 Aug 2021 23:10:25 GMT Message-Id: <202108062310.176NAPf2043870@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ka Ho Ng Subject: git: fd0ffba3b4c9 - main - Fix pathconf.2 documentation error MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: khng X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fd0ffba3b4c9edfc79590f98729dfa34abba6100 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 23:10:26 -0000 The branch main has been updated by khng: URL: https://cgit.FreeBSD.org/src/commit/?id=fd0ffba3b4c9edfc79590f98729dfa34abba6100 commit fd0ffba3b4c9edfc79590f98729dfa34abba6100 Author: Ka Ho Ng AuthorDate: 2021-08-06 23:09:57 +0000 Commit: Ka Ho Ng CommitDate: 2021-08-06 23:09:57 +0000 Fix pathconf.2 documentation error _PC_MIN_HOLE_SIZE and _PC_DEALLOC_PRESENT were mixed somehow before this fix. Sponsored by: The FreeBSD Foundation Reviewed by: delphij Differential Revision: https://reviews.freebsd.org/D31436 --- lib/libc/sys/pathconf.2 | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/libc/sys/pathconf.2 b/lib/libc/sys/pathconf.2 index c5a7ba1be3c5..5586e460185b 100644 --- a/lib/libc/sys/pathconf.2 +++ b/lib/libc/sys/pathconf.2 @@ -28,7 +28,7 @@ .\" @(#)pathconf.2 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd March 30, 2020 +.Dd August 6, 2021 .Dt PATHCONF 2 .Os .Sh NAME @@ -166,9 +166,6 @@ specified file, otherwise 0. .It Li _PC_MIN_HOLE_SIZE If a file system supports the reporting of holes (see .Xr lseek 2 ) , -.It Li _PC_DEALLOC_PRESENT -If a file system supports hole-punching (see -.Xr fspacectl 2 ) , .Fn pathconf and .Fn fpathconf @@ -177,6 +174,10 @@ bytes. The offsets of holes returned will be aligned to this same value. A special value of 1 is returned if the file system does not specify the minimum hole size but still reports holes. +.It Li _PC_DEALLOC_PRESENT +Return 1 if a file system supports hole-punching (see +.Xr fspacectl 2 ) , +otherwise 0. .El .Sh RETURN VALUES If the call to From owner-dev-commits-src-all@freebsd.org Sat Aug 7 01:44:24 2021 Return-Path: Delivered-To: dev-commits-src-all@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 E89DD662918; Sat, 7 Aug 2021 01:44: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 4GhQBJ60Lqz4QqD; Sat, 7 Aug 2021 01:44: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 B5E3018836; Sat, 7 Aug 2021 01:44: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 1771iO3s048633; Sat, 7 Aug 2021 01:44:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1771iOwi048632; Sat, 7 Aug 2021 01:44:24 GMT (envelope-from git) Date: Sat, 7 Aug 2021 01:44:24 GMT Message-Id: <202108070144.1771iOwi048632@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: c18c74a87c15 - main - namei: Add cn_flags bits for OPENREAD and OPENWRITE 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: c18c74a87c15f5f8774df7e2f8fa0fe72422203d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Aug 2021 01:44:25 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=c18c74a87c15f5f8774df7e2f8fa0fe72422203d commit c18c74a87c15f5f8774df7e2f8fa0fe72422203d Author: Rick Macklem AuthorDate: 2021-08-07 01:41:11 +0000 Commit: Rick Macklem CommitDate: 2021-08-07 01:41:11 +0000 namei: Add cn_flags bits for OPENREAD and OPENWRITE VOP_LOOKUP() is called with cn_flags bits ISLASTCN and ISOPEN to indicate that the lookup is for the last component of a pathname when doing open. If the cn_flags also indicates if the open is for Reading, Writing or Both, the NFSv4 client can do an NFSv4 Open operation in the same compound RPC as Lookup, often avoiding the additional Open RPC now done when VOP_OPEN() is called. This patch defines two new cn_flags bits called OPENREAD and OPENWRITE and sets these in open2nameif() based on FREAD, FWRITE flag bits. This will allow a subsequent patch to the NFSv4 client to do the Open operation in the same RPC as Lookup. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D31431 --- sys/kern/vfs_vnops.c | 4 ++++ sys/sys/namei.h | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index c54f55a99036..832ade5d800e 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -205,6 +205,10 @@ open2nameif(int fmode, u_int vn_open_flags) res |= RBENEATH; if ((fmode & O_EMPTY_PATH) != 0) res |= EMPTYPATH; + if ((fmode & FREAD) != 0) + res |= OPENREAD; + if ((fmode & FWRITE) != 0) + res |= OPENWRITE; if ((vn_open_flags & VN_OPEN_NOAUDIT) == 0) res |= AUDITVNODE1; if ((vn_open_flags & VN_OPEN_NOCAPCHECK) != 0) diff --git a/sys/sys/namei.h b/sys/sys/namei.h index 9e0a82ea1659..3f6e59289f0a 100644 --- a/sys/sys/namei.h +++ b/sys/sys/namei.h @@ -183,8 +183,8 @@ int cache_fplookup(struct nameidata *ndp, enum cache_fpl_status *status, #define AUDITVNODE1 0x00040000 /* audit the looked up vnode information */ #define AUDITVNODE2 0x00080000 /* audit the looked up vnode information */ #define NOCAPCHECK 0x00100000 /* do not perform capability checks */ -/* UNUSED 0x00200000 */ -/* UNUSED 0x00400000 */ +#define OPENREAD 0x00200000 /* open for reading */ +#define OPENWRITE 0x00400000 /* open for writing */ /* UNUSED 0x00800000 */ #define HASBUF 0x01000000 /* has allocated pathname buffer */ #define NOEXECCHECK 0x02000000 /* do not perform exec check on dir */ From owner-dev-commits-src-all@freebsd.org Sat Aug 7 09:11:19 2021 Return-Path: Delivered-To: dev-commits-src-all@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 E4B7B667E83; Sat, 7 Aug 2021 09:11: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 4Ghc5z6BNVz4tcw; Sat, 7 Aug 2021 09:11: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 BDE421E4FE; Sat, 7 Aug 2021 09:11: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 1779BJs5045409; Sat, 7 Aug 2021 09:11:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1779BJki045408; Sat, 7 Aug 2021 09:11:19 GMT (envelope-from git) Date: Sat, 7 Aug 2021 09:11:19 GMT Message-Id: <202108070911.1779BJki045408@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ka Ho Ng Subject: git: 3676512b60d6 - main - bhyve: Use fspacectl(2) for BOP_DELETE on regular file images MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: khng X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3676512b60d65ff68fb807ede2fa6e89af18c490 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Aug 2021 09:11:20 -0000 The branch main has been updated by khng: URL: https://cgit.FreeBSD.org/src/commit/?id=3676512b60d65ff68fb807ede2fa6e89af18c490 commit 3676512b60d65ff68fb807ede2fa6e89af18c490 Author: Ka Ho Ng AuthorDate: 2021-08-07 09:10:30 +0000 Commit: Ka Ho Ng CommitDate: 2021-08-07 09:10:30 +0000 bhyve: Use fspacectl(2) for BOP_DELETE on regular file images bhyve can also make use of fspacectl(2) to implement BOP_DELETE with hole-punching. Since it is not desirable to do zero-filling for large DEALLOCATE/UNMAP range, candelete is not set if pathconf(2) indicates that the underlying file system does not support native VOP_DEALLOCATE(9). Sponsored by: The FreeBSD Foundation Reviewed by: grehan Differential Revision: https://reviews.freebsd.org/D28880 --- usr.sbin/bhyve/block_if.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/usr.sbin/bhyve/block_if.c b/usr.sbin/bhyve/block_if.c index 98c0f9f5f38b..9d7371bec50f 100644 --- a/usr.sbin/bhyve/block_if.c +++ b/usr.sbin/bhyve/block_if.c @@ -239,6 +239,7 @@ blockif_proc(struct blockif_ctxt *bc, struct blockif_elem *be, uint8_t *buf) off_t arg[2]; ssize_t clen, len, off, boff, voff; int i, err; + struct spacectl_range range; br = be->be_req; if (br->br_iovcnt <= 1) @@ -336,8 +337,20 @@ blockif_proc(struct blockif_ctxt *bc, struct blockif_elem *be, uint8_t *buf) err = errno; else br->br_resid = 0; - } else - err = EOPNOTSUPP; + } else { + range.r_offset = br->br_offset; + range.r_len = br->br_resid; + + while (range.r_len > 0) { + if (fspacectl(bc->bc_fd, SPACECTL_DEALLOC, + &range, 0, &range) != 0) { + err = errno; + break; + } + } + if (err == 0) + br->br_resid = 0; + } break; default: err = EINVAL; @@ -566,8 +579,11 @@ blockif_open(nvlist_t *nvl, const char *ident) candelete = arg.value.i; if (ioctl(fd, DIOCGPROVIDERNAME, name) == 0) geom = 1; - } else + } else { psectsz = sbuf.st_blksize; + /* Avoid fallback implementation */ + candelete = fpathconf(fd, _PC_DEALLOC_PRESENT) == 1; + } #ifndef WITHOUT_CAPSICUM if (caph_ioctls_limit(fd, cmds, nitems(cmds)) == -1) From owner-dev-commits-src-all@freebsd.org Sat Aug 7 10:05:50 2021 Return-Path: Delivered-To: dev-commits-src-all@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 2AFAC668885; Sat, 7 Aug 2021 10:05: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 4GhdJt0pG0z3D3y; Sat, 7 Aug 2021 10:05: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 F3DE51F1F2; Sat, 7 Aug 2021 10:05: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 177A5np4017084; Sat, 7 Aug 2021 10:05:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 177A5nrD017083; Sat, 7 Aug 2021 10:05:49 GMT (envelope-from git) Date: Sat, 7 Aug 2021 10:05:49 GMT Message-Id: <202108071005.177A5nrD017083@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 0b79b007ebfc - main - [lltable] Restructure nd6 code. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0b79b007ebfc250a8a7b928df268ada6f1c988c4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Aug 2021 10:05:50 -0000 The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=0b79b007ebfc250a8a7b928df268ada6f1c988c4 commit 0b79b007ebfc250a8a7b928df268ada6f1c988c4 Author: Alexander V. Chernikov AuthorDate: 2021-08-06 08:27:22 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-08-07 09:59:11 +0000 [lltable] Restructure nd6 code. Factor out lltable locking logic from lltable_try_set_entry_addr() into a separate lltable_acquire_wlock(), so the latter can be used in other parts of the code w/o duplication. Create nd6_try_set_entry_addr() to avoid code duplication in nd6.c and nd6_nbr.c. Move lle creation logic from nd6_resolve_slow() into a separate nd6_get_llentry() to simplify the former. These changes serve as a pre-requisite for implementing RFC8950 (IPv4 prefixes with IPv6 nexthops). Differential Revision: https://reviews.freebsd.org/D31432 MFC after: 2 weeks --- sys/net/if_llatbl.c | 40 +++++++++++------ sys/net/if_llatbl.h | 2 + sys/netinet6/nd6.c | 114 ++++++++++++++++++++++++++++++++----------------- sys/netinet6/nd6.h | 1 + sys/netinet6/nd6_nbr.c | 11 +---- 5 files changed, 105 insertions(+), 63 deletions(-) diff --git a/sys/net/if_llatbl.c b/sys/net/if_llatbl.c index 70baf58c2778..c656974c80ee 100644 --- a/sys/net/if_llatbl.c +++ b/sys/net/if_llatbl.c @@ -318,22 +318,18 @@ lltable_set_entry_addr(struct ifnet *ifp, struct llentry *lle, } /* - * Tries to update @lle link-level address. - * Since update requires AFDATA WLOCK, function - * drops @lle lock, acquires AFDATA lock and then acquires - * @lle lock to maintain lock order. + * Acquires lltable write lock. * - * Returns 1 on success. + * Returns true on success, with both lltable and lle lock held. + * On failure, false is returned and lle wlock is still held. */ -int -lltable_try_set_entry_addr(struct ifnet *ifp, struct llentry *lle, - const char *linkhdr, size_t linkhdrsize, int lladdr_off) +bool +lltable_acquire_wlock(struct ifnet *ifp, struct llentry *lle) { + NET_EPOCH_ASSERT(); /* Perform real LLE update */ /* use afdata WLOCK to update fields */ - LLE_WLOCK_ASSERT(lle); - LLE_ADDREF(lle); LLE_WUNLOCK(lle); IF_AFDATA_WLOCK(ifp); LLE_WLOCK(lle); @@ -344,17 +340,33 @@ lltable_try_set_entry_addr(struct ifnet *ifp, struct llentry *lle, */ if ((lle->la_flags & LLE_DELETED) != 0) { IF_AFDATA_WUNLOCK(ifp); - LLE_FREE_LOCKED(lle); - return (0); + return (false); } + return (true); +} + +/* + * Tries to update @lle link-level address. + * Since update requires AFDATA WLOCK, function + * drops @lle lock, acquires AFDATA lock and then acquires + * @lle lock to maintain lock order. + * + * Returns 1 on success. + */ +int +lltable_try_set_entry_addr(struct ifnet *ifp, struct llentry *lle, + const char *linkhdr, size_t linkhdrsize, int lladdr_off) +{ + + if (!lltable_acquire_wlock(ifp, lle)) + return (0); + /* Update data */ lltable_set_entry_addr(ifp, lle, linkhdr, linkhdrsize, lladdr_off); IF_AFDATA_WUNLOCK(ifp); - LLE_REMREF(lle); - return (1); } diff --git a/sys/net/if_llatbl.h b/sys/net/if_llatbl.h index 488f8b006315..ffbaa7a946bb 100644 --- a/sys/net/if_llatbl.h +++ b/sys/net/if_llatbl.h @@ -238,6 +238,8 @@ void lltable_fill_sa_entry(const struct llentry *lle, struct sockaddr *sa); struct ifnet *lltable_get_ifp(const struct lltable *llt); int lltable_get_af(const struct lltable *llt); +bool lltable_acquire_wlock(struct ifnet *ifp, struct llentry *lle); + int lltable_foreach_lle(struct lltable *llt, llt_foreach_cb_t *f, void *farg); /* diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c index 437fdb5d4e52..5166186f56dc 100644 --- a/sys/netinet6/nd6.c +++ b/sys/netinet6/nd6.c @@ -1382,6 +1382,35 @@ nd6_is_addr_neighbor(const struct sockaddr_in6 *addr, struct ifnet *ifp) return (rc); } +/* + * Tries to update @lle address/prepend data with new @lladdr. + * + * Returns true on success. + * In any case, @lle is returned wlocked. + */ +bool +nd6_try_set_entry_addr(struct ifnet *ifp, struct llentry *lle, char *lladdr) +{ + u_char linkhdr[LLE_MAX_LINKHDR]; + size_t linkhdrsize; + int lladdr_off; + + LLE_WLOCK_ASSERT(lle); + + linkhdrsize = sizeof(linkhdr); + if (lltable_calc_llheader(ifp, AF_INET6, lladdr, + linkhdr, &linkhdrsize, &lladdr_off) != 0) { + return (false); + } + + if (!lltable_acquire_wlock(ifp, lle)) + return (false); + lltable_set_entry_addr(ifp, lle, linkhdr, linkhdrsize, lladdr_off); + IF_AFDATA_WUNLOCK(ifp); + + return (true); +} + /* * Free an nd6 llinfo entry. * Since the function would cause significant changes in the kernel, DO NOT @@ -2027,14 +2056,9 @@ nd6_cache_lladdr(struct ifnet *ifp, struct in6_addr *from, char *lladdr, * Record source link-layer address * XXX is it dependent to ifp->if_type? */ - linkhdrsize = sizeof(linkhdr); - if (lltable_calc_llheader(ifp, AF_INET6, lladdr, - linkhdr, &linkhdrsize, &lladdr_off) != 0) - return; - - if (lltable_try_set_entry_addr(ifp, ln, linkhdr, linkhdrsize, - lladdr_off) == 0) { + if (!nd6_try_set_entry_addr(ifp, ln, lladdr)) { /* Entry was deleted */ + LLE_WUNLOCK(ln); return; } @@ -2257,6 +2281,39 @@ nd6_resolve(struct ifnet *ifp, int is_gw, struct mbuf *m, return (nd6_resolve_slow(ifp, 0, m, dst6, desten, pflags, plle)); } +/* + * Finds or creates a new llentry for @addr. + * Returns wlocked llentry or NULL. + */ +static __noinline struct llentry * +nd6_get_llentry(struct ifnet *ifp, const struct in6_addr *addr) +{ + struct llentry *lle, *lle_tmp; + + lle = nd6_alloc(addr, 0, ifp); + if (lle == NULL) { + char ip6buf[INET6_ADDRSTRLEN]; + log(LOG_DEBUG, + "nd6_get_llentry: can't allocate llinfo for %s " + "(ln=%p)\n", + ip6_sprintf(ip6buf, addr), lle); + return (NULL); + } + + IF_AFDATA_WLOCK(ifp); + LLE_WLOCK(lle); + /* Prefer any existing entry over newly-created one */ + lle_tmp = nd6_lookup(addr, LLE_EXCLUSIVE, ifp); + if (lle_tmp == NULL) + lltable_link_entry(LLTABLE6(ifp), lle); + IF_AFDATA_WUNLOCK(ifp); + if (lle_tmp != NULL) { + lltable_free_entry(LLTABLE6(ifp), lle); + return (lle_tmp); + } else + return (lle); +} + /* * Do L2 address resolution for @sa_dst address. Stores found * address in @desten buffer. Copy of lle ln_flags can be also @@ -2273,7 +2330,7 @@ nd6_resolve_slow(struct ifnet *ifp, int flags, struct mbuf *m, const struct sockaddr_in6 *dst, u_char *desten, uint32_t *pflags, struct llentry **plle) { - struct llentry *lle = NULL, *lle_tmp; + struct llentry *lle = NULL; struct in6_addr *psrc, src; int send_ns, ll_len; char *lladdr; @@ -2286,39 +2343,16 @@ nd6_resolve_slow(struct ifnet *ifp, int flags, struct mbuf *m, * At this point, the destination of the packet must be a unicast * or an anycast address(i.e. not a multicast). */ - if (lle == NULL) { - lle = nd6_lookup(&dst->sin6_addr, LLE_EXCLUSIVE, ifp); - if ((lle == NULL) && nd6_is_addr_neighbor(dst, ifp)) { - /* - * Since nd6_is_addr_neighbor() internally calls nd6_lookup(), - * the condition below is not very efficient. But we believe - * it is tolerable, because this should be a rare case. - */ - lle = nd6_alloc(&dst->sin6_addr, 0, ifp); - if (lle == NULL) { - char ip6buf[INET6_ADDRSTRLEN]; - log(LOG_DEBUG, - "nd6_output: can't allocate llinfo for %s " - "(ln=%p)\n", - ip6_sprintf(ip6buf, &dst->sin6_addr), lle); - m_freem(m); - return (ENOBUFS); - } + lle = nd6_lookup(&dst->sin6_addr, LLE_EXCLUSIVE, ifp); + if ((lle == NULL) && nd6_is_addr_neighbor(dst, ifp)) { + /* + * Since nd6_is_addr_neighbor() internally calls nd6_lookup(), + * the condition below is not very efficient. But we believe + * it is tolerable, because this should be a rare case. + */ + lle = nd6_get_llentry(ifp, &dst->sin6_addr); + } - IF_AFDATA_WLOCK(ifp); - LLE_WLOCK(lle); - /* Prefer any existing entry over newly-created one */ - lle_tmp = nd6_lookup(&dst->sin6_addr, LLE_EXCLUSIVE, ifp); - if (lle_tmp == NULL) - lltable_link_entry(LLTABLE6(ifp), lle); - IF_AFDATA_WUNLOCK(ifp); - if (lle_tmp != NULL) { - lltable_free_entry(LLTABLE6(ifp), lle); - lle = lle_tmp; - lle_tmp = NULL; - } - } - } if (lle == NULL) { m_freem(m); return (ENOBUFS); diff --git a/sys/netinet6/nd6.h b/sys/netinet6/nd6.h index ee53acce840a..fe0f2b22cc48 100644 --- a/sys/netinet6/nd6.h +++ b/sys/netinet6/nd6.h @@ -376,6 +376,7 @@ int nd6_resolve(struct ifnet *, int, struct mbuf *, int nd6_ioctl(u_long, caddr_t, struct ifnet *); void nd6_cache_lladdr(struct ifnet *, struct in6_addr *, char *, int, int, int); +bool nd6_try_set_entry_addr(struct ifnet *ifp, struct llentry *lle, char *lladdr); struct mbuf *nd6_grab_holdchain(struct llentry *); int nd6_flush_holdchain(struct ifnet *, struct llentry *, struct mbuf *); int nd6_add_ifa_lle(struct in6_ifaddr *); diff --git a/sys/netinet6/nd6_nbr.c b/sys/netinet6/nd6_nbr.c index 0f18a38c37a1..974c454e93a5 100644 --- a/sys/netinet6/nd6_nbr.c +++ b/sys/netinet6/nd6_nbr.c @@ -770,16 +770,9 @@ nd6_na_input(struct mbuf *m, int off, int icmp6len) /* * Record link-layer address, and update the state. */ - linkhdrsize = sizeof(linkhdr); - if (lltable_calc_llheader(ifp, AF_INET6, lladdr, - linkhdr, &linkhdrsize, &lladdr_off) != 0) - return; - - if (lltable_try_set_entry_addr(ifp, ln, linkhdr, linkhdrsize, - lladdr_off) == 0) { - ln = NULL; + if (!nd6_try_set_entry_addr(ifp, ln, lladdr)) goto freeit; - } + EVENTHANDLER_INVOKE(lle_event, ln, LLENTRY_RESOLVED); if (is_solicited) nd6_llinfo_setstate(ln, ND6_LLINFO_REACHABLE); From owner-dev-commits-src-all@freebsd.org Sat Aug 7 11:06:29 2021 Return-Path: Delivered-To: dev-commits-src-all@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 15F9E669388; Sat, 7 Aug 2021 11:06: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 4Ghffr714Kz3Gvg; Sat, 7 Aug 2021 11:06: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 D89E720305; Sat, 7 Aug 2021 11:06: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 177B6SHk096765; Sat, 7 Aug 2021 11:06:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 177B6SW0096764; Sat, 7 Aug 2021 11:06:28 GMT (envelope-from git) Date: Sat, 7 Aug 2021 11:06:28 GMT Message-Id: <202108071106.177B6SW0096764@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: b30e7cb7fa9c - main - cache: add OPENREAD and OPENWRITE to fast path lookup 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: b30e7cb7fa9c521bda8fa7eeeb95205543827539 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Aug 2021 11:06:29 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=b30e7cb7fa9c521bda8fa7eeeb95205543827539 commit b30e7cb7fa9c521bda8fa7eeeb95205543827539 Author: Mateusz Guzik AuthorDate: 2021-08-07 11:02:38 +0000 Commit: Mateusz Guzik CommitDate: 2021-08-07 11:02:38 +0000 cache: add OPENREAD and OPENWRITE to fast path lookup --- sys/kern/vfs_cache.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 09f926d0cd31..199da865e39c 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -4175,7 +4175,8 @@ cache_fpl_terminated(struct cache_fpl *fpl) #define CACHE_FPL_SUPPORTED_CN_FLAGS \ (NC_NOMAKEENTRY | NC_KEEPPOSENTRY | LOCKLEAF | LOCKPARENT | WANTPARENT | \ FAILIFEXISTS | FOLLOW | LOCKSHARED | SAVENAME | SAVESTART | WILLBEDIR | \ - ISOPEN | NOMACCHECK | AUDITVNODE1 | AUDITVNODE2 | NOCAPCHECK) + ISOPEN | NOMACCHECK | AUDITVNODE1 | AUDITVNODE2 | NOCAPCHECK | OPENREAD | \ + OPENWRITE) #define CACHE_FPL_INTERNAL_CN_FLAGS \ (ISDOTDOT | MAKEENTRY | ISLASTCN) From owner-dev-commits-src-all@freebsd.org Sat Aug 7 11:14:57 2021 Return-Path: Delivered-To: dev-commits-src-all@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 80351669760; Sat, 7 Aug 2021 11:14: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 4Ghfrd2yNxz3HVQ; Sat, 7 Aug 2021 11:14: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 4965F20258; Sat, 7 Aug 2021 11:14: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 177BEvvJ010866; Sat, 7 Aug 2021 11:14:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 177BEvP1010865; Sat, 7 Aug 2021 11:14:57 GMT (envelope-from git) Date: Sat, 7 Aug 2021 11:14:57 GMT Message-Id: <202108071114.177BEvP1010865@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dimitry Andric Subject: git: d69d07569ee2 - main - Apply upstream lld fix for compressed input sections on BE targets MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d69d07569ee2404705ff4c4abb45dc0b884eeb35 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Aug 2021 11:14:57 -0000 The branch main has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=d69d07569ee2404705ff4c4abb45dc0b884eeb35 commit d69d07569ee2404705ff4c4abb45dc0b884eeb35 Author: Dimitry Andric AuthorDate: 2021-08-07 11:14:11 +0000 Commit: Dimitry Andric CommitDate: 2021-08-07 11:14:11 +0000 Apply upstream lld fix for compressed input sections on BE targets Merge commit c6ebc651b6fa from llvm git (by Simon Atanasyan): [LLD] Support compressed input sections on big-endian targets This patch enables compressed input sections on big-endian targets by checking the target endianness and selecting an appropriate `Chdr` structure. Fixes PR51369 Differential Revision: https://reviews.llvm.org/D107635 Reported by: emaste MFC after: 3 days --- contrib/llvm-project/lld/ELF/InputSection.cpp | 47 ++++++++++++--------------- contrib/llvm-project/lld/ELF/InputSection.h | 1 + 2 files changed, 21 insertions(+), 27 deletions(-) diff --git a/contrib/llvm-project/lld/ELF/InputSection.cpp b/contrib/llvm-project/lld/ELF/InputSection.cpp index 6f16fc7abc48..f9cad7f975a7 100644 --- a/contrib/llvm-project/lld/ELF/InputSection.cpp +++ b/contrib/llvm-project/lld/ELF/InputSection.cpp @@ -88,7 +88,22 @@ InputSectionBase::InputSectionBase(InputFile *file, uint64_t flags, if (!zlib::isAvailable()) error(toString(file) + ": contains a compressed section, " + "but zlib is not available"); - parseCompressedHeader(); + switch (config->ekind) { + case ELF32LEKind: + parseCompressedHeader(); + break; + case ELF32BEKind: + parseCompressedHeader(); + break; + case ELF64LEKind: + parseCompressedHeader(); + break; + case ELF64BEKind: + parseCompressedHeader(); + break; + default: + llvm_unreachable("unknown ELFT"); + } } } @@ -210,10 +225,7 @@ OutputSection *SectionBase::getOutputSection() { // When a section is compressed, `rawData` consists with a header followed // by zlib-compressed data. This function parses a header to initialize // `uncompressedSize` member and remove the header from `rawData`. -void InputSectionBase::parseCompressedHeader() { - using Chdr64 = typename ELF64LE::Chdr; - using Chdr32 = typename ELF32LE::Chdr; - +template void InputSectionBase::parseCompressedHeader() { // Old-style header if (name.startswith(".zdebug")) { if (!toStringRef(rawData).startswith("ZLIB")) { @@ -239,32 +251,13 @@ void InputSectionBase::parseCompressedHeader() { assert(flags & SHF_COMPRESSED); flags &= ~(uint64_t)SHF_COMPRESSED; - // New-style 64-bit header - if (config->is64) { - if (rawData.size() < sizeof(Chdr64)) { - error(toString(this) + ": corrupted compressed section"); - return; - } - - auto *hdr = reinterpret_cast(rawData.data()); - if (hdr->ch_type != ELFCOMPRESS_ZLIB) { - error(toString(this) + ": unsupported compression type"); - return; - } - - uncompressedSize = hdr->ch_size; - alignment = std::max(hdr->ch_addralign, 1); - rawData = rawData.slice(sizeof(*hdr)); - return; - } - - // New-style 32-bit header - if (rawData.size() < sizeof(Chdr32)) { + // New-style header + if (rawData.size() < sizeof(typename ELFT::Chdr)) { error(toString(this) + ": corrupted compressed section"); return; } - auto *hdr = reinterpret_cast(rawData.data()); + auto *hdr = reinterpret_cast(rawData.data()); if (hdr->ch_type != ELFCOMPRESS_ZLIB) { error(toString(this) + ": unsupported compression type"); return; diff --git a/contrib/llvm-project/lld/ELF/InputSection.h b/contrib/llvm-project/lld/ELF/InputSection.h index 5b91c1c90bd2..c914d0b42155 100644 --- a/contrib/llvm-project/lld/ELF/InputSection.h +++ b/contrib/llvm-project/lld/ELF/InputSection.h @@ -238,6 +238,7 @@ public: } protected: + template void parseCompressedHeader(); void uncompress() const; From owner-dev-commits-src-all@freebsd.org Sat Aug 7 12:57:27 2021 Return-Path: Delivered-To: dev-commits-src-all@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 5068866B272; Sat, 7 Aug 2021 12:57: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 4Ghj6v1TXlz3Pvs; Sat, 7 Aug 2021 12:57: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 16847218B7; Sat, 7 Aug 2021 12:57: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 177CvQTg042847; Sat, 7 Aug 2021 12:57:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 177CvQZp042846; Sat, 7 Aug 2021 12:57:26 GMT (envelope-from git) Date: Sat, 7 Aug 2021 12:57:26 GMT Message-Id: <202108071257.177CvQZp042846@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: b732091a761a - main - sctp: improve input validation of mapped addresses in send() Reported by: syzbot+35528f275f2eea6317cc@syzkaller.appspotmail.com Reported by: syzbot+ac29916d5f16d241553d@syzkaller.appspotmail.com MFC after: 3 days 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: b732091a761a04c7a04229f28642d27dc48485d8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Aug 2021 12:57:27 -0000 The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=b732091a761a04c7a04229f28642d27dc48485d8 commit b732091a761a04c7a04229f28642d27dc48485d8 Author: Michael Tuexen AuthorDate: 2021-08-07 12:50:40 +0000 Commit: Michael Tuexen CommitDate: 2021-08-07 12:50:40 +0000 sctp: improve input validation of mapped addresses in send() Reported by: syzbot+35528f275f2eea6317cc@syzkaller.appspotmail.com Reported by: syzbot+ac29916d5f16d241553d@syzkaller.appspotmail.com MFC after: 3 days --- sys/netinet/sctp_output.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/netinet/sctp_output.c b/sys/netinet/sctp_output.c index e34534e80fa3..5e9aff7bfba9 100644 --- a/sys/netinet/sctp_output.c +++ b/sys/netinet/sctp_output.c @@ -12434,9 +12434,13 @@ sctp_sosend(struct socket *so, } addr_to_use = addr; #if defined(INET) && defined(INET6) - if ((addr) && (addr->sa_family == AF_INET6)) { + if ((addr != NULL) && (addr->sa_family == AF_INET6)) { struct sockaddr_in6 *sin6; + if (addr->sa_len != sizeof(struct sockaddr_in6)) { + SCTP_LTRACE_ERR_RET(NULL, NULL, NULL, SCTP_FROM_SCTP_OUTPUT, EINVAL); + return (EINVAL); + } sin6 = (struct sockaddr_in6 *)addr; if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) { in6_sin6_2_sin(&sin, sin6); From owner-dev-commits-src-all@freebsd.org Sat Aug 7 13:13:41 2021 Return-Path: Delivered-To: dev-commits-src-all@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 E7F0766B5B0; Sat, 7 Aug 2021 13:13: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 4GhjTd5yPdz3QhY; Sat, 7 Aug 2021 13:13: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 B4AB921CD4; Sat, 7 Aug 2021 13:13: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 177DDfdF069976; Sat, 7 Aug 2021 13:13:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 177DDf8O069975; Sat, 7 Aug 2021 13:13:41 GMT (envelope-from git) Date: Sat, 7 Aug 2021 13:13:41 GMT Message-Id: <202108071313.177DDf8O069975@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: 112899c6afc5 - main - sctp: improve input validation of mapped addresses in sctp_connectx() MFC after: 3 days 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: 112899c6afc5d174445b6ab4738b8eb4de19d835 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Aug 2021 13:13:42 -0000 The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=112899c6afc5d174445b6ab4738b8eb4de19d835 commit 112899c6afc5d174445b6ab4738b8eb4de19d835 Author: Michael Tuexen AuthorDate: 2021-08-07 13:12:09 +0000 Commit: Michael Tuexen CommitDate: 2021-08-07 13:12:09 +0000 sctp: improve input validation of mapped addresses in sctp_connectx() MFC after: 3 days --- sys/netinet/sctputil.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/netinet/sctputil.c b/sys/netinet/sctputil.c index ad4409f666df..f331fb70ded5 100644 --- a/sys/netinet/sctputil.c +++ b/sys/netinet/sctputil.c @@ -6716,15 +6716,15 @@ sctp_connectx_helper_find(struct sctp_inpcb *inp, struct sockaddr *addr, { struct sockaddr_in6 *sin6; + incr = (unsigned int)sizeof(struct sockaddr_in6); + if (sa->sa_len != incr) { + return (EINVAL); + } sin6 = (struct sockaddr_in6 *)sa; if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) { /* Must be non-mapped for connectx */ return (EINVAL); } - incr = (unsigned int)sizeof(struct sockaddr_in6); - if (sa->sa_len != incr) { - return (EINVAL); - } (*num_v6) += 1; break; } From owner-dev-commits-src-all@freebsd.org Sat Aug 7 15:30:26 2021 Return-Path: Delivered-To: dev-commits-src-all@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 12B5066CDA9; Sat, 7 Aug 2021 15:30: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 4GhmWP6mHbz3pQy; Sat, 7 Aug 2021 15:30: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 CDF4E23899; Sat, 7 Aug 2021 15:30: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 177FUPSM051338; Sat, 7 Aug 2021 15:30:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 177FUPab051337; Sat, 7 Aug 2021 15:30:25 GMT (envelope-from git) Date: Sat, 7 Aug 2021 15:30:25 GMT Message-Id: <202108071530.177FUPab051337@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: 784692c74019 - main - sctp: improve handling of IPv4 addresses on IPV6 sockets Reported by: syzbot+08fe66e4bfc2777cba95@syzkaller.appspotmail.com MFC after: 3 days 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: 784692c74019fa69b5298fb1693a97f107c56b4b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Aug 2021 15:30:26 -0000 The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=784692c74019fa69b5298fb1693a97f107c56b4b commit 784692c74019fa69b5298fb1693a97f107c56b4b Author: Michael Tuexen AuthorDate: 2021-08-07 15:27:56 +0000 Commit: Michael Tuexen CommitDate: 2021-08-07 15:27:56 +0000 sctp: improve handling of IPv4 addresses on IPV6 sockets Reported by: syzbot+08fe66e4bfc2777cba95@syzkaller.appspotmail.com MFC after: 3 days --- sys/netinet6/sctp6_usrreq.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/netinet6/sctp6_usrreq.c b/sys/netinet6/sctp6_usrreq.c index 6f5d639e6367..fcbb566b53d3 100644 --- a/sys/netinet6/sctp6_usrreq.c +++ b/sys/netinet6/sctp6_usrreq.c @@ -771,7 +771,8 @@ sctp6_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr, return (EINVAL); } } - if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) { + if ((addr->sa_family == AF_INET6) && + IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) { struct sockaddr_in sin; /* convert v4-mapped into v4 addr and send */ @@ -909,7 +910,8 @@ sctp6_connect(struct socket *so, struct sockaddr *addr, struct thread *p) return (EINVAL); } } - if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) { + if ((addr->sa_family == AF_INET6) && + IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) { /* convert v4-mapped into v4 addr */ in6_sin6_2_sin(&store.sin, sin6); addr = &store.sa; From owner-dev-commits-src-all@freebsd.org Sat Aug 7 16:30:03 2021 Return-Path: Delivered-To: dev-commits-src-all@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 BA2D266DB9D; Sat, 7 Aug 2021 16:30: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 4GhnrC4gLrz3wKv; Sat, 7 Aug 2021 16:30: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 83FC0243EC; Sat, 7 Aug 2021 16:30: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 177GU3gc024540; Sat, 7 Aug 2021 16:30:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 177GU3mA024537; Sat, 7 Aug 2021 16:30:03 GMT (envelope-from git) Date: Sat, 7 Aug 2021 16:30:03 GMT Message-Id: <202108071630.177GU3mA024537@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: e650ef36ba9e - stable/13 - pf: locally originating connections with 'route-to' fail 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/stable/13 X-Git-Reftype: branch X-Git-Commit: e650ef36ba9ef7ec994d3e7048a56fea761f9c7e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Aug 2021 16:30:03 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=e650ef36ba9ef7ec994d3e7048a56fea761f9c7e commit e650ef36ba9ef7ec994d3e7048a56fea761f9c7e Author: Kristof Provost AuthorDate: 2021-07-14 10:17:03 +0000 Commit: Kristof Provost CommitDate: 2021-08-07 07:08:09 +0000 pf: locally originating connections with 'route-to' fail Similar to the REPLY_TO shortcut (6d786845cf) we also can't shortcut ROUTE_TO. If we do we will fail to apply transformations or update the state, which can lead to premature termination of the connections. PR: 257106 MFC after: 3 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31177 (cherry picked from commit 2c0d115bbc8f8ee3f011a5c4a69bcbf58c4b721f) --- sys/netpfil/pf/pf.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 3f954497dc20..0db9eaed1ac4 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -337,12 +337,6 @@ VNET_DEFINE(struct pf_limit, pf_limits[PF_LIMIT_MAX]); return (PF_DROP); \ if (PACKET_LOOPED(pd)) \ return (PF_PASS); \ - if ((d) == PF_OUT && \ - (s)->rule.ptr->rt == PF_ROUTETO && \ - (s)->rule.ptr->direction == PF_OUT && \ - (s)->rt_kif != NULL && \ - (s)->rt_kif != (i)) \ - return (PF_PASS); \ } while (0) #define BOUND_IFACE(r, k) \ From owner-dev-commits-src-all@freebsd.org Sat Aug 7 16:30:04 2021 Return-Path: Delivered-To: dev-commits-src-all@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 BC24D66D7C0; Sat, 7 Aug 2021 16:30: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 4GhnrD4tGZz3w2r; Sat, 7 Aug 2021 16:30: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 8F86F23EF9; Sat, 7 Aug 2021 16:30: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 177GU4Ce024832; Sat, 7 Aug 2021 16:30:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 177GU4Ok024829; Sat, 7 Aug 2021 16:30:04 GMT (envelope-from git) Date: Sat, 7 Aug 2021 16:30:04 GMT Message-Id: <202108071630.177GU4Ok024829@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 3bedd8a3b6d7 - stable/13 - pf tests: test locally originated connections with route-to 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 3bedd8a3b6d7816341cf6eebc3f91633a175320d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Aug 2021 16:30:04 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=3bedd8a3b6d7816341cf6eebc3f91633a175320d commit 3bedd8a3b6d7816341cf6eebc3f91633a175320d Author: Kristof Provost AuthorDate: 2021-07-14 10:33:37 +0000 Commit: Kristof Provost CommitDate: 2021-08-07 07:08:19 +0000 pf tests: test locally originated connections with route-to PR: 257106 Submitted by: Mark Cammidge MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D31178 (cherry picked from commit f808bb9b7e5ee2243e5a2aaad2275a78cdbe981b) --- tests/sys/netpfil/pf/route_to.sh | 70 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/tests/sys/netpfil/pf/route_to.sh b/tests/sys/netpfil/pf/route_to.sh index 59b16e35ee6f..957317eb462e 100644 --- a/tests/sys/netpfil/pf/route_to.sh +++ b/tests/sys/netpfil/pf/route_to.sh @@ -181,9 +181,79 @@ multiwan_cleanup() pft_cleanup } +atf_test_case "multiwanlocal" "cleanup" +multiwanlocal_head() +{ + atf_set descr 'Multi-WAN local origin source-based redirection / route-to test' + atf_set require.user root +} + +multiwanlocal_body() +{ + pft_init + + epair_one=$(vnet_mkepair) + epair_two=$(vnet_mkepair) + epair_cl_one=$(vnet_mkepair) + epair_cl_two=$(vnet_mkepair) + + vnet_mkjail srv1 ${epair_one}b + vnet_mkjail srv2 ${epair_two}b + vnet_mkjail wan_one ${epair_one}a ${epair_cl_one}b + vnet_mkjail wan_two ${epair_two}a ${epair_cl_two}b + vnet_mkjail client ${epair_cl_one}a ${epair_cl_two}a + + jexec client ifconfig ${epair_cl_one}a 203.0.113.1/25 + jexec wan_one ifconfig ${epair_cl_one}b 203.0.113.2/25 + jexec wan_one ifconfig ${epair_one}a 192.0.2.1/24 up + jexec wan_one sysctl net.inet.ip.forwarding=1 + jexec srv1 ifconfig ${epair_one}b 192.0.2.2/24 up + + jexec client ifconfig ${epair_cl_two}a 203.0.113.128/25 + jexec wan_two ifconfig ${epair_cl_two}b 203.0.113.129/25 + jexec wan_two ifconfig ${epair_two}a 198.51.100.1/24 up + jexec wan_two sysctl net.inet.ip.forwarding=1 + jexec srv2 ifconfig ${epair_two}b 198.51.100.2/24 up + + jexec client route add default 203.0.113.2 + jexec srv1 route add default 192.0.2.1 + jexec srv2 route add default 198.51.100.1 + + # Run data source in srv1 and srv2 + jexec srv1 sh -c 'dd if=/dev/zero bs=1024 count=100 | nc -l 7 -w 2 -N &' + jexec srv2 sh -c 'dd if=/dev/zero bs=1024 count=100 | nc -l 7 -w 2 -N &' + + jexec client pfctl -e + pft_set_rules client \ + "block in" \ + "block out" \ + "pass out quick route-to (${epair_cl_two}a 203.0.113.129) inet proto tcp from 203.0.113.128 to any port 7" \ + "pass out on ${epair_cl_one}a inet proto tcp from any to any port 7" + + # This should work + result=$(jexec client nc -N -w 1 192.0.2.2 7 | wc -c) + if [ ${result} -ne 102400 ]; then + jexec client pfctl -ss + atf_fail "Redirect from client on one failed: ${result}" + fi + + # This should trigger the issue + result=$(jexec client nc -N -w 1 -s 203.0.113.128 198.51.100.2 7 | wc -c) + jexec client pfctl -ss + if [ ${result} -ne 102400 ]; then + atf_fail "Redirect from client on two failed: ${result}" + fi +} + +multiwanlocal_cleanup() +{ + pft_cleanup +} + atf_init_test_cases() { atf_add_test_case "v4" atf_add_test_case "v6" atf_add_test_case "multiwan" + atf_add_test_case "multiwanlocal" } From owner-dev-commits-src-all@freebsd.org Sat Aug 7 16:30:04 2021 Return-Path: Delivered-To: dev-commits-src-all@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 7808266DB9E; Sat, 7 Aug 2021 16:30: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 4GhnrD2fdfz3wCC; Sat, 7 Aug 2021 16:30: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 439CB243ED; Sat, 7 Aug 2021 16:30: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 177GU4LA024754; Sat, 7 Aug 2021 16:30:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 177GU4ME024751; Sat, 7 Aug 2021 16:30:04 GMT (envelope-from git) Date: Sat, 7 Aug 2021 16:30:04 GMT Message-Id: <202108071630.177GU4ME024751@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 44c47bc6d61e - stable/12 - pf: locally originating connections with 'route-to' fail 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/stable/12 X-Git-Reftype: branch X-Git-Commit: 44c47bc6d61ea295c6bb955a40f32c93a589f3ea Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Aug 2021 16:30:04 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=44c47bc6d61ea295c6bb955a40f32c93a589f3ea commit 44c47bc6d61ea295c6bb955a40f32c93a589f3ea Author: Kristof Provost AuthorDate: 2021-07-14 10:17:03 +0000 Commit: Kristof Provost CommitDate: 2021-08-07 07:09:35 +0000 pf: locally originating connections with 'route-to' fail Similar to the REPLY_TO shortcut (6d786845cf) we also can't shortcut ROUTE_TO. If we do we will fail to apply transformations or update the state, which can lead to premature termination of the connections. PR: 257106 MFC after: 3 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31177 (cherry picked from commit 2c0d115bbc8f8ee3f011a5c4a69bcbf58c4b721f) --- sys/netpfil/pf/pf.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index caae2b92f0d6..a7b429120c9e 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -338,12 +338,6 @@ VNET_DEFINE(struct pf_limit, pf_limits[PF_LIMIT_MAX]); return (PF_DROP); \ if (PACKET_LOOPED(pd)) \ return (PF_PASS); \ - if ((d) == PF_OUT && \ - (s)->rule.ptr->rt == PF_ROUTETO && \ - (s)->rule.ptr->direction == PF_OUT && \ - (s)->rt_kif != NULL && \ - (s)->rt_kif != (i)) \ - return (PF_PASS); \ } while (0) #define BOUND_IFACE(r, k) \ From owner-dev-commits-src-all@freebsd.org Sat Aug 7 16:30:05 2021 Return-Path: Delivered-To: dev-commits-src-all@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 B962866D8D9; Sat, 7 Aug 2021 16:30: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 4GhnrF3pp2z3wKw; Sat, 7 Aug 2021 16:30: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 5D47824360; Sat, 7 Aug 2021 16:30: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 177GU5BO024990; Sat, 7 Aug 2021 16:30:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 177GU5bc024988; Sat, 7 Aug 2021 16:30:05 GMT (envelope-from git) Date: Sat, 7 Aug 2021 16:30:05 GMT Message-Id: <202108071630.177GU5bc024988@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: bd28b2d73223 - stable/12 - pf tests: test locally originated connections with route-to 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/stable/12 X-Git-Reftype: branch X-Git-Commit: bd28b2d73223b898169986eb5f04ee6045929612 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Aug 2021 16:30:05 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=bd28b2d73223b898169986eb5f04ee6045929612 commit bd28b2d73223b898169986eb5f04ee6045929612 Author: Kristof Provost AuthorDate: 2021-07-14 10:33:37 +0000 Commit: Kristof Provost CommitDate: 2021-08-07 07:11:28 +0000 pf tests: test locally originated connections with route-to PR: 257106 Submitted by: Mark Cammidge MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D31178 (cherry picked from commit f808bb9b7e5ee2243e5a2aaad2275a78cdbe981b) --- tests/sys/netpfil/pf/route_to.sh | 70 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/tests/sys/netpfil/pf/route_to.sh b/tests/sys/netpfil/pf/route_to.sh index 59b16e35ee6f..957317eb462e 100755 --- a/tests/sys/netpfil/pf/route_to.sh +++ b/tests/sys/netpfil/pf/route_to.sh @@ -181,9 +181,79 @@ multiwan_cleanup() pft_cleanup } +atf_test_case "multiwanlocal" "cleanup" +multiwanlocal_head() +{ + atf_set descr 'Multi-WAN local origin source-based redirection / route-to test' + atf_set require.user root +} + +multiwanlocal_body() +{ + pft_init + + epair_one=$(vnet_mkepair) + epair_two=$(vnet_mkepair) + epair_cl_one=$(vnet_mkepair) + epair_cl_two=$(vnet_mkepair) + + vnet_mkjail srv1 ${epair_one}b + vnet_mkjail srv2 ${epair_two}b + vnet_mkjail wan_one ${epair_one}a ${epair_cl_one}b + vnet_mkjail wan_two ${epair_two}a ${epair_cl_two}b + vnet_mkjail client ${epair_cl_one}a ${epair_cl_two}a + + jexec client ifconfig ${epair_cl_one}a 203.0.113.1/25 + jexec wan_one ifconfig ${epair_cl_one}b 203.0.113.2/25 + jexec wan_one ifconfig ${epair_one}a 192.0.2.1/24 up + jexec wan_one sysctl net.inet.ip.forwarding=1 + jexec srv1 ifconfig ${epair_one}b 192.0.2.2/24 up + + jexec client ifconfig ${epair_cl_two}a 203.0.113.128/25 + jexec wan_two ifconfig ${epair_cl_two}b 203.0.113.129/25 + jexec wan_two ifconfig ${epair_two}a 198.51.100.1/24 up + jexec wan_two sysctl net.inet.ip.forwarding=1 + jexec srv2 ifconfig ${epair_two}b 198.51.100.2/24 up + + jexec client route add default 203.0.113.2 + jexec srv1 route add default 192.0.2.1 + jexec srv2 route add default 198.51.100.1 + + # Run data source in srv1 and srv2 + jexec srv1 sh -c 'dd if=/dev/zero bs=1024 count=100 | nc -l 7 -w 2 -N &' + jexec srv2 sh -c 'dd if=/dev/zero bs=1024 count=100 | nc -l 7 -w 2 -N &' + + jexec client pfctl -e + pft_set_rules client \ + "block in" \ + "block out" \ + "pass out quick route-to (${epair_cl_two}a 203.0.113.129) inet proto tcp from 203.0.113.128 to any port 7" \ + "pass out on ${epair_cl_one}a inet proto tcp from any to any port 7" + + # This should work + result=$(jexec client nc -N -w 1 192.0.2.2 7 | wc -c) + if [ ${result} -ne 102400 ]; then + jexec client pfctl -ss + atf_fail "Redirect from client on one failed: ${result}" + fi + + # This should trigger the issue + result=$(jexec client nc -N -w 1 -s 203.0.113.128 198.51.100.2 7 | wc -c) + jexec client pfctl -ss + if [ ${result} -ne 102400 ]; then + atf_fail "Redirect from client on two failed: ${result}" + fi +} + +multiwanlocal_cleanup() +{ + pft_cleanup +} + atf_init_test_cases() { atf_add_test_case "v4" atf_add_test_case "v6" atf_add_test_case "multiwan" + atf_add_test_case "multiwanlocal" } From owner-dev-commits-src-all@freebsd.org Sat Aug 7 17:15:01 2021 Return-Path: Delivered-To: dev-commits-src-all@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 DF56F66E623; Sat, 7 Aug 2021 17:15: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 4Ghpr55kN4z4VJ2; Sat, 7 Aug 2021 17:15: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 AC98324F66; Sat, 7 Aug 2021 17:15: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 177HF1ZY089758; Sat, 7 Aug 2021 17:15:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 177HF1u5089757; Sat, 7 Aug 2021 17:15:01 GMT (envelope-from git) Date: Sat, 7 Aug 2021 17:15:01 GMT Message-Id: <202108071715.177HF1u5089757@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dimitry Andric Subject: git: cd38d9cf26db - main - Follow-up to d69d07569ee2 by bumping lld local version MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cd38d9cf26db9264f709c52469f0f4e9684d62bb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Aug 2021 17:15:01 -0000 The branch main has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=cd38d9cf26db9264f709c52469f0f4e9684d62bb commit cd38d9cf26db9264f709c52469f0f4e9684d62bb Author: Dimitry Andric AuthorDate: 2021-08-07 17:14:31 +0000 Commit: Dimitry Andric CommitDate: 2021-08-07 17:14:31 +0000 Follow-up to d69d07569ee2 by bumping lld local version This makes it easier to detect that lld's support for compressed input sections on BE targets is fixed. MFC after: 3 days X-MFC-With: d69d07569ee2 --- lib/clang/include/VCSVersion.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/clang/include/VCSVersion.inc b/lib/clang/include/VCSVersion.inc index cb7736e7d7de..8c1798de59ee 100644 --- a/lib/clang/include/VCSVersion.inc +++ b/lib/clang/include/VCSVersion.inc @@ -7,7 +7,7 @@ #define CLANG_REPOSITORY "git@github.com:llvm/llvm-project.git" // - -#define LLD_REVISION "llvmorg-12.0.1-0-gfed41342a82f-1400001" +#define LLD_REVISION "llvmorg-12.0.1-0-gfed41342a82f-1400002" #define LLD_REPOSITORY "FreeBSD" #define LLDB_REVISION "llvmorg-12.0.1-0-gfed41342a82f" From owner-dev-commits-src-all@freebsd.org Sat Aug 7 17:33:15 2021 Return-Path: Delivered-To: dev-commits-src-all@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 0C00066EBC6; Sat, 7 Aug 2021 17:33: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 4GhqF66rS4z4WGL; Sat, 7 Aug 2021 17:33: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 C37B5253BB; Sat, 7 Aug 2021 17:33: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 177HXE1I015922; Sat, 7 Aug 2021 17:33:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 177HXEEt015921; Sat, 7 Aug 2021 17:33:14 GMT (envelope-from git) Date: Sat, 7 Aug 2021 17:33:14 GMT Message-Id: <202108071733.177HXEEt015921@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: d178b1f878ae - main - Parse named nodes from IORT ACPI on arm64 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: d178b1f878ae5b1b4e574bcf34d21b60855bf5a0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Aug 2021 17:33:15 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=d178b1f878ae5b1b4e574bcf34d21b60855bf5a0 commit d178b1f878ae5b1b4e574bcf34d21b60855bf5a0 Author: Dmitry Salychev AuthorDate: 2021-08-07 17:17:57 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-08-07 17:30:38 +0000 Parse named nodes from IORT ACPI on arm64 Add the ability to map named components from IORT to their SMMU or ITS node in order to setup interrupts. It is now possible to find a node by its name (substring) and resource ID similar to PCI nodes. This is needed by work on a driver for NXP's Second Generation Data Path Acceleration Architecture (DPAA2). Reviewed by: andrew MFC after: 2 weeks Differential Revision:: https://reviews.freebsd.org/D31267 --- sys/arm64/acpica/acpi_iort.c | 138 ++++++++++++++++++++++++++++++++++++++----- sys/dev/acpica/acpivar.h | 4 ++ 2 files changed, 126 insertions(+), 16 deletions(-) diff --git a/sys/arm64/acpica/acpi_iort.c b/sys/arm64/acpica/acpi_iort.c index ec5cf799b333..e35531731251 100644 --- a/sys/arm64/acpica/acpi_iort.c +++ b/sys/arm64/acpica/acpi_iort.c @@ -77,6 +77,14 @@ struct iort_its_entry { int pxm; }; +struct iort_named_component +{ + UINT32 NodeFlags; + UINT64 MemoryProperties; + UINT8 MemoryAddressLimit; + char DeviceName[32]; /* Path of namespace object */ +}; + /* * IORT node. Each node has some device specific data depending on the * type of the node. The node can also have a set of mappings, OR in @@ -91,9 +99,10 @@ struct iort_node { u_int usecount; /* for bookkeeping */ u_int revision; /* node revision */ union { - ACPI_IORT_ROOT_COMPLEX pci_rc; /* PCI root complex */ - ACPI_IORT_SMMU smmu; - ACPI_IORT_SMMU_V3 smmu_v3; + ACPI_IORT_ROOT_COMPLEX pci_rc; /* PCI root complex */ + ACPI_IORT_SMMU smmu; + ACPI_IORT_SMMU_V3 smmu_v3; + struct iort_named_component named_comp; } data; union { struct iort_map_entry *mappings; /* node mappings */ @@ -105,6 +114,7 @@ struct iort_node { static TAILQ_HEAD(, iort_node) pci_nodes = TAILQ_HEAD_INITIALIZER(pci_nodes); static TAILQ_HEAD(, iort_node) smmu_nodes = TAILQ_HEAD_INITIALIZER(smmu_nodes); static TAILQ_HEAD(, iort_node) its_groups = TAILQ_HEAD_INITIALIZER(its_groups); +static TAILQ_HEAD(, iort_node) named_nodes = TAILQ_HEAD_INITIALIZER(named_nodes); static int iort_entry_get_id_mapping_index(struct iort_node *node) @@ -166,6 +176,29 @@ iort_entry_lookup(struct iort_node *node, u_int id, u_int *outid) return (entry->out_node); } +/* + * Perform an additional lookup in case of SMMU node and ITS outtype. + */ +static struct iort_node * +iort_smmu_trymap(struct iort_node *node, u_int outtype, u_int *outid) +{ + /* Original node can be not found. */ + if (!node) + return (NULL); + + /* Node can be SMMU or ITS. If SMMU, we need another lookup. */ + if (outtype == ACPI_IORT_NODE_ITS_GROUP && + (node->type == ACPI_IORT_NODE_SMMU_V3 || + node->type == ACPI_IORT_NODE_SMMU)) { + node = iort_entry_lookup(node, *outid, outid); + if (node == NULL) + return (NULL); + } + + KASSERT(node->type == outtype, ("mapping fail")); + return (node); +} + /* * Map a PCI RID to a SMMU node or an ITS node, based on outtype. */ @@ -184,21 +217,35 @@ iort_pci_rc_map(u_int seg, u_int rid, u_int outtype, u_int *outid) break; } - /* Could not find a PCI RC node with segment and device ID. */ - if (out_node == NULL) - return (NULL); + out_node = iort_smmu_trymap(out_node, outtype, &nxtid); + if (out_node) + *outid = nxtid; - /* Node can be SMMU or ITS. If SMMU, we need another lookup. */ - if (outtype == ACPI_IORT_NODE_ITS_GROUP && - (out_node->type == ACPI_IORT_NODE_SMMU_V3 || - out_node->type == ACPI_IORT_NODE_SMMU)) { - out_node = iort_entry_lookup(out_node, nxtid, &nxtid); - if (out_node == NULL) - return (NULL); + return (out_node); +} + +/* + * Map a named component node to a SMMU node or an ITS node, based on outtype. + */ +static struct iort_node * +iort_named_comp_map(const char *devname, u_int rid, u_int outtype, u_int *outid) +{ + struct iort_node *node, *out_node; + u_int nxtid; + + out_node = NULL; + TAILQ_FOREACH(node, &named_nodes, next) { + if (strstr(node->data.named_comp.DeviceName, devname) == NULL) + continue; + out_node = iort_entry_lookup(node, rid, &nxtid); + if (out_node != NULL) + break; } - KASSERT(out_node->type == outtype, ("mapping fail")); - *outid = nxtid; + out_node = iort_smmu_trymap(out_node, outtype, &nxtid); + if (out_node) + *outid = nxtid; + return (out_node); } @@ -279,6 +326,7 @@ iort_add_nodes(ACPI_IORT_NODE *node_entry, u_int node_offset) ACPI_IORT_ROOT_COMPLEX *pci_rc; ACPI_IORT_SMMU *smmu; ACPI_IORT_SMMU_V3 *smmu_v3; + ACPI_IORT_NAMED_COMPONENT *named_comp; struct iort_node *node; node = malloc(sizeof(*node), M_DEVBUF, M_WAITOK | M_ZERO); @@ -310,6 +358,19 @@ iort_add_nodes(ACPI_IORT_NODE *node_entry, u_int node_offset) iort_copy_its(node, node_entry); TAILQ_INSERT_TAIL(&its_groups, node, next); break; + case ACPI_IORT_NODE_NAMED_COMPONENT: + named_comp = (ACPI_IORT_NAMED_COMPONENT *)node_entry->NodeData; + memcpy(&node->data.named_comp, named_comp, sizeof(*named_comp)); + + /* Copy name of the node separately. */ + strncpy(node->data.named_comp.DeviceName, + named_comp->DeviceName, + sizeof(node->data.named_comp.DeviceName)); + node->data.named_comp.DeviceName[31] = 0; + + iort_copy_data(node, node_entry); + TAILQ_INSERT_TAIL(&named_nodes, node, next); + break; default: printf("ACPI: IORT: Dropping unhandled type %u\n", node_entry->Type); @@ -368,7 +429,9 @@ iort_post_process_mappings(void) TAILQ_FOREACH(node, &smmu_nodes, next) for (i = 0; i < node->nentries; i++) iort_resolve_node(&node->entries.mappings[i], FALSE); - /* TODO: named nodes */ + TAILQ_FOREACH(node, &named_nodes, next) + for (i = 0; i < node->nentries; i++) + iort_resolve_node(&node->entries.mappings[i], TRUE); } /* @@ -587,3 +650,46 @@ acpi_iort_map_pci_smmuv3(u_int seg, u_int rid, u_int *xref, u_int *sid) return (0); } + +/* + * Finds mapping for a named node given name and resource ID and returns the + * XREF for MSI interrupt setup and the device ID to use for the interrupt setup. + */ +int +acpi_iort_map_named_msi(const char *devname, u_int rid, u_int *xref, + u_int *devid) +{ + struct iort_node *node; + + node = iort_named_comp_map(devname, rid, ACPI_IORT_NODE_ITS_GROUP, + devid); + if (node == NULL) + return (ENOENT); + + /* This should be an ITS node */ + KASSERT(node->type == ACPI_IORT_NODE_ITS_GROUP, ("bad group")); + + /* Return first node, we don't handle more than that now. */ + *xref = node->entries.its[0].xref; + return (0); +} + +int +acpi_iort_map_named_smmuv3(const char *devname, u_int rid, u_int *xref, + u_int *devid) +{ + ACPI_IORT_SMMU_V3 *smmu; + struct iort_node *node; + + node = iort_named_comp_map(devname, rid, ACPI_IORT_NODE_SMMU_V3, devid); + if (node == NULL) + return (ENOENT); + + /* This should be an SMMU node. */ + KASSERT(node->type == ACPI_IORT_NODE_SMMU_V3, ("bad node")); + + smmu = (ACPI_IORT_SMMU_V3 *)&node->data.smmu_v3; + *xref = smmu->BaseAddress; + + return (0); +} diff --git a/sys/dev/acpica/acpivar.h b/sys/dev/acpica/acpivar.h index 980a004e2c35..1f64b479d414 100644 --- a/sys/dev/acpica/acpivar.h +++ b/sys/dev/acpica/acpivar.h @@ -578,6 +578,10 @@ int acpi_get_domain(device_t dev, device_t child, int *domain); int acpi_iort_map_pci_msi(u_int seg, u_int rid, u_int *xref, u_int *devid); int acpi_iort_map_pci_smmuv3(u_int seg, u_int rid, u_int *xref, u_int *devid); int acpi_iort_its_lookup(u_int its_id, u_int *xref, int *pxm); +int acpi_iort_map_named_msi(const char *devname, u_int rid, u_int *xref, + u_int *devid); +int acpi_iort_map_named_smmuv3(const char *devname, u_int rid, u_int *xref, + u_int *devid); #endif #endif /* _KERNEL */ #endif /* !_ACPIVAR_H_ */ From owner-dev-commits-src-all@freebsd.org Sat Aug 7 18:28:17 2021 Return-Path: Delivered-To: dev-commits-src-all@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 55CD166F49E; Sat, 7 Aug 2021 18:28: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 4GhrSd1hCQz4ZPh; Sat, 7 Aug 2021 18:28: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 22199260E9; Sat, 7 Aug 2021 18:28: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 177ISHvC082400; Sat, 7 Aug 2021 18:28:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 177ISHWN082399; Sat, 7 Aug 2021 18:28:17 GMT (envelope-from git) Date: Sat, 7 Aug 2021 18:28:17 GMT Message-Id: <202108071828.177ISHWN082399@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: 12b115ec57cb - main - fu540_prci: Rename to sifive_prci and use ocd_data for FU540 specificity 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: 12b115ec57cbe5e18a6511d9c98225551263d4ac Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Aug 2021 18:28:17 -0000 The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=12b115ec57cbe5e18a6511d9c98225551263d4ac commit 12b115ec57cbe5e18a6511d9c98225551263d4ac Author: Jessica Clarke AuthorDate: 2021-08-07 18:27:27 +0000 Commit: Jessica Clarke CommitDate: 2021-08-07 18:27:27 +0000 fu540_prci: Rename to sifive_prci and use ocd_data for FU540 specificity The FU740 has a very similar controller and will reuse most of the driver. This also drops the dependency on the device-tree include for the binding indices; the header doesn't namespace its contents (and nor does the FU740 one) so using both would require seperate translation units which would be unnecessarily complicated just to avoid defining local copies of the small number of constants. Whilst here, add the missing l to gemgxlclk's name and drop the prci_ prefix from tlclk's name as we don't prefix any of the others and it's entirely unnecessary. Reviewed by: kp, mhorne MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31021 --- sys/riscv/sifive/files.sifive | 2 +- sys/riscv/sifive/{fu540_prci.c => sifive_prci.c} | 85 +++++++++++++++--------- 2 files changed, 56 insertions(+), 31 deletions(-) diff --git a/sys/riscv/sifive/files.sifive b/sys/riscv/sifive/files.sifive index e0ab09b38502..5426f703c27c 100644 --- a/sys/riscv/sifive/files.sifive +++ b/sys/riscv/sifive/files.sifive @@ -1,6 +1,6 @@ # $FreeBSD$ riscv/sifive/fe310_aon.c optional fe310aon -riscv/sifive/fu540_prci.c standard riscv/sifive/fu540_spi.c optional fu540spi spibus +riscv/sifive/sifive_prci.c standard riscv/sifive/sifive_uart.c standard diff --git a/sys/riscv/sifive/fu540_prci.c b/sys/riscv/sifive/sifive_prci.c similarity index 81% rename from sys/riscv/sifive/fu540_prci.c rename to sys/riscv/sifive/sifive_prci.c index 133cdba26d10..7c0939c77251 100644 --- a/sys/riscv/sifive/fu540_prci.c +++ b/sys/riscv/sifive/sifive_prci.c @@ -3,6 +3,7 @@ * * Copyright (c) 2019 Axiado Corporation * All rights reserved. + * Copyright (c) 2021 Jessica Clarke * * This software was developed in part by Kristof Provost under contract for * Axiado Corporation. @@ -51,15 +52,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include - -static struct ofw_compat_data compat_data[] = { - { "sifive,aloeprci0", 1 }, - { "sifive,ux00prci0", 1 }, - { "sifive,fu540-c000-prci", 1 }, - { NULL, 0 }, -}; - static struct resource_spec prci_spec[] = { { SYS_RES_MEMORY, 0, RF_ACTIVE }, RESOURCE_SPEC_END @@ -86,10 +78,6 @@ struct prci_clk_pll_sc { #define PRCI_ASSERT_LOCKED(sc) mtx_assert(&(sc)->mtx, MA_OWNED); #define PRCI_ASSERT_UNLOCKED(sc) mtx_assert(&(sc)->mtx, MA_NOTOWNED); -#define PRCI_COREPLL_CFG0 0x4 -#define PRCI_DDRPLL_CFG0 0xC -#define PRCI_GEMGXLPLL_CFG0 0x1C - #define PRCI_PLL_DIVR_MASK 0x3f #define PRCI_PLL_DIVR_SHIFT 0 #define PRCI_PLL_DIVF_MASK 0x7fc0 @@ -113,17 +101,36 @@ struct prci_pll_def { .reg = (_base), \ } -/* PLL Clocks */ -struct prci_pll_def pll_clks[] = { - PLL(PRCI_CLK_COREPLL, "coreclk", PRCI_COREPLL_CFG0), - PLL(PRCI_CLK_DDRPLL, "ddrclk", PRCI_DDRPLL_CFG0), - PLL(PRCI_CLK_GEMGXLPLL, "gemgxclk", PRCI_GEMGXLPLL_CFG0), +#define PLL_END PLL(0, NULL, 0) + +struct prci_config { + struct prci_pll_def *pll_clks; + struct clk_fixed_def *tlclk_def; +}; + +/* FU540 clock numbers */ +#define FU540_PRCI_CORECLK 0 +#define FU540_PRCI_DDRCLK 1 +#define FU540_PRCI_GEMGXLCLK 2 +#define FU540_PRCI_TLCLK 3 + +/* FU540 registers */ +#define FU540_PRCI_COREPLL_CFG0 0x4 +#define FU540_PRCI_DDRPLL_CFG0 0xC +#define FU540_PRCI_GEMGXLPLL_CFG0 0x1C + +/* FU540 PLL clocks */ +static struct prci_pll_def fu540_pll_clks[] = { + PLL(FU540_PRCI_CORECLK, "coreclk", FU540_PRCI_COREPLL_CFG0), + PLL(FU540_PRCI_DDRCLK, "ddrclk", FU540_PRCI_DDRPLL_CFG0), + PLL(FU540_PRCI_GEMGXLCLK, "gemgxlclk", FU540_PRCI_GEMGXLPLL_CFG0), + PLL_END }; -/* Fixed divisor clock TLCLK. */ -struct clk_fixed_def tlclk_def = { - .clkdef.id = PRCI_CLK_TLCLK, - .clkdef.name = "prci_tlclk", +/* FU540 fixed divisor clock TLCLK. */ +static struct clk_fixed_def fu540_tlclk_def = { + .clkdef.id = FU540_PRCI_TLCLK, + .clkdef.name = "tlclk", .clkdef.parent_names = (const char *[]){"coreclk"}, .clkdef.parent_cnt = 1, .clkdef.flags = CLK_NODE_STATIC_STRINGS, @@ -131,6 +138,19 @@ struct clk_fixed_def tlclk_def = { .div = 2, }; +/* FU540 config */ +struct prci_config fu540_prci_config = { + .pll_clks = fu540_pll_clks, + .tlclk_def = &fu540_tlclk_def, +}; + +static struct ofw_compat_data compat_data[] = { + { "sifive,aloeprci0", (uintptr_t)&fu540_prci_config }, + { "sifive,ux00prci0", (uintptr_t)&fu540_prci_config }, + { "sifive,fu540-c000-prci", (uintptr_t)&fu540_prci_config }, + { NULL, 0 }, +}; + static int prci_clk_pll_init(struct clknode *clk, device_t dev) { @@ -199,7 +219,7 @@ prci_probe(device_t dev) if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) return (ENXIO); - device_set_desc(dev, "SiFive FU540 Power Reset Clocking Interrupt"); + device_set_desc(dev, "SiFive Power Reset Clocking Interrupt"); return (BUS_PROBE_DEFAULT); } @@ -231,10 +251,15 @@ prci_attach(device_t dev) clk_t clk_parent; phandle_t node; int i, ncells, error; + struct prci_config *cfg; + struct prci_pll_def *pll_clk; sc = device_get_softc(dev); sc->dev = dev; + cfg = (struct prci_config *)ofw_bus_search_compatible(dev, + compat_data)->ocd_data; + mtx_init(&sc->mtx, device_get_nameunit(sc->dev), NULL, MTX_DEF); error = bus_alloc_resources(dev, prci_spec, &sc->res); @@ -277,10 +302,10 @@ prci_attach(device_t dev) } /* We can't free a clkdom, so from now on we cannot fail. */ - for (i = 0; i < nitems(pll_clks); i++) { - clkdef.id = pll_clks[i].id; - clkdef.name = pll_clks[i].name; - prci_pll_register(sc, &clkdef, pll_clks[i].reg); + for (pll_clk = cfg->pll_clks; pll_clk->name; pll_clk++) { + clkdef.id = pll_clk->id; + clkdef.name = pll_clk->name; + prci_pll_register(sc, &clkdef, pll_clk->reg); } /* @@ -291,7 +316,7 @@ prci_attach(device_t dev) * will be registered automatically by the fixed_clk driver, and the * version we register here will be an unreferenced duplicate. */ - clknode_fixed_register(sc->clkdom, &tlclk_def); + clknode_fixed_register(sc->clkdom, cfg->tlclk_def); error = clkdom_finit(sc->clkdom); if (error) @@ -316,12 +341,12 @@ static device_method_t prci_methods[] = { }; static driver_t prci_driver = { - "fu540prci", + "sifive_prci", prci_methods, sizeof(struct prci_softc) }; static devclass_t prci_devclass; -EARLY_DRIVER_MODULE(fu540prci, simplebus, prci_driver, prci_devclass, 0, 0, +EARLY_DRIVER_MODULE(sifive_prci, simplebus, prci_driver, prci_devclass, 0, 0, BUS_PASS_BUS); From owner-dev-commits-src-all@freebsd.org Sat Aug 7 18:28:18 2021 Return-Path: Delivered-To: dev-commits-src-all@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 71B7E66F325; Sat, 7 Aug 2021 18:28:18 +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 4GhrSf2T31z4Zk7; Sat, 7 Aug 2021 18:28:18 +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 3B72225F8B; Sat, 7 Aug 2021 18:28:18 +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 177ISI1Q082424; Sat, 7 Aug 2021 18:28:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 177ISI8s082423; Sat, 7 Aug 2021 18:28:18 GMT (envelope-from git) Date: Sat, 7 Aug 2021 18:28:18 GMT Message-Id: <202108071828.177ISI8s082423@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: 589d8a78a57b - main - sifive_prci: Add support for the FU740 PRCI 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: 589d8a78a57b3ca1327bec3311281a38e4e49952 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Aug 2021 18:28:18 -0000 The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=589d8a78a57b3ca1327bec3311281a38e4e49952 commit 589d8a78a57b3ca1327bec3311281a38e4e49952 Author: Jessica Clarke AuthorDate: 2021-08-07 18:27:28 +0000 Commit: Jessica Clarke CommitDate: 2021-08-07 18:27:28 +0000 sifive_prci: Add support for the FU740 PRCI Reviewed by: mhorne MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31022 --- sys/riscv/sifive/sifive_prci.c | 292 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 291 insertions(+), 1 deletion(-) diff --git a/sys/riscv/sifive/sifive_prci.c b/sys/riscv/sifive/sifive_prci.c index 7c0939c77251..21b9cd568f32 100644 --- a/sys/riscv/sifive/sifive_prci.c +++ b/sys/riscv/sifive/sifive_prci.c @@ -47,11 +47,14 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include +#include "clkdev_if.h" + static struct resource_spec prci_spec[] = { { SYS_RES_MEMORY, 0, RF_ACTIVE }, RESOURCE_SPEC_END @@ -73,6 +76,12 @@ struct prci_clk_pll_sc { uint32_t reg; }; +struct prci_clk_div_sc { + struct prci_softc *parent_sc; + uint32_t reg; + uint32_t bias; +}; + #define PRCI_LOCK(sc) mtx_lock(&(sc)->mtx) #define PRCI_UNLOCK(sc) mtx_unlock(&(sc)->mtx) #define PRCI_ASSERT_LOCKED(sc) mtx_assert(&(sc)->mtx, MA_OWNED); @@ -87,6 +96,8 @@ struct prci_clk_pll_sc { #define PRCI_READ(_sc, _reg) \ bus_space_read_4((_sc)->bst, (_sc)->bsh, (_reg)) +#define PRCI_WRITE(_sc, _reg, _val) \ + bus_space_write_4((_sc)->bst, (_sc)->bsh, (_reg), (_val)) struct prci_pll_def { uint32_t id; @@ -103,8 +114,46 @@ struct prci_pll_def { #define PLL_END PLL(0, NULL, 0) +struct prci_div_def { + uint32_t id; + const char *name; + const char *parent_name; + uint32_t reg; + uint32_t bias; +}; + +#define DIV(_id, _name, _parent_name, _base, _bias) \ +{ \ + .id = (_id), \ + .name = (_name), \ + .parent_name = (_parent_name), \ + .reg = (_base), \ + .bias = (_bias), \ +} + +#define DIV_END DIV(0, NULL, NULL, 0, 0) + +struct prci_gate_def { + uint32_t id; + const char *name; + const char *parent_name; + uint32_t reg; +}; + +#define GATE(_id, _name, _parent_name, _base) \ +{ \ + .id = (_id), \ + .name = (_name), \ + .parent_name = (_parent_name), \ + .reg = (_base), \ +} + +#define GATE_END GATE(0, NULL, NULL, 0) + struct prci_config { struct prci_pll_def *pll_clks; + struct prci_div_def *div_clks; + struct prci_gate_def *gate_clks; struct clk_fixed_def *tlclk_def; }; @@ -144,10 +193,74 @@ struct prci_config fu540_prci_config = { .tlclk_def = &fu540_tlclk_def, }; +/* FU740 clock numbers */ +#define FU740_PRCI_CORECLK 0 +#define FU740_PRCI_DDRCLK 1 +#define FU740_PRCI_GEMGXLCLK 2 +#define FU740_PRCI_DVFSCORECLK 3 +#define FU740_PRCI_HFPCLK 4 +#define FU740_PRCI_CLTXCLK 5 +#define FU740_PRCI_TLCLK 6 +#define FU740_PRCI_PCLK 7 +#define FU740_PRCI_PCIEAUXCLK 8 + +/* FU740 registers */ +#define FU740_PRCI_COREPLL_CFG0 0x4 +#define FU740_PRCI_DDRPLL_CFG0 0xC +#define FU740_PRCI_PCIEAUX_GATE 0x14 +#define FU740_PRCI_GEMGXLPLL_CFG0 0x1C +#define FU740_PRCI_DVFSCOREPLL_CFG0 0x38 +#define FU740_PRCI_HFPCLKPLL_CFG0 0x50 +#define FU740_PRCI_CLTXPLL_CFG0 0x30 +#define FU740_PRCI_HFPCLK_DIV 0x5C + +/* FU740 PLL clocks */ +static struct prci_pll_def fu740_pll_clks[] = { + PLL(FU740_PRCI_CORECLK, "coreclk", FU740_PRCI_COREPLL_CFG0), + PLL(FU740_PRCI_DDRCLK, "ddrclk", FU740_PRCI_DDRPLL_CFG0), + PLL(FU740_PRCI_GEMGXLCLK, "gemgxlclk", FU740_PRCI_GEMGXLPLL_CFG0), + PLL(FU740_PRCI_DVFSCORECLK, "dvfscoreclk", FU740_PRCI_DVFSCOREPLL_CFG0), + PLL(FU740_PRCI_HFPCLK, "hfpclk", FU740_PRCI_HFPCLKPLL_CFG0), + PLL(FU740_PRCI_CLTXCLK, "cltxclk", FU740_PRCI_CLTXPLL_CFG0), + PLL_END +}; + +/* FU740 divisor clocks */ +static struct prci_div_def fu740_div_clks[] = { + DIV(FU740_PRCI_PCLK, "pclk", "hfpclk", FU740_PRCI_HFPCLK_DIV, 2), + DIV_END +}; + +/* FU740 gated clocks */ +static struct prci_gate_def fu740_gate_clks[] = { + GATE(FU740_PRCI_PCIEAUXCLK, "pcieauxclk", "hfclk", FU740_PRCI_PCIEAUX_GATE), + GATE_END +}; + +/* FU740 fixed divisor clock TLCLK. */ +static struct clk_fixed_def fu740_tlclk_def = { + .clkdef.id = FU740_PRCI_TLCLK, + .clkdef.name = "tlclk", + .clkdef.parent_names = (const char *[]){"coreclk"}, + .clkdef.parent_cnt = 1, + .clkdef.flags = CLK_NODE_STATIC_STRINGS, + .mult = 1, + .div = 2, +}; + +/* FU740 config */ +struct prci_config fu740_prci_config = { + .pll_clks = fu740_pll_clks, + .div_clks = fu740_div_clks, + .gate_clks = fu740_gate_clks, + .tlclk_def = &fu740_tlclk_def, +}; + static struct ofw_compat_data compat_data[] = { { "sifive,aloeprci0", (uintptr_t)&fu540_prci_config }, { "sifive,ux00prci0", (uintptr_t)&fu540_prci_config }, { "sifive,fu540-c000-prci", (uintptr_t)&fu540_prci_config }, + { "sifive,fu740-c000-prci", (uintptr_t)&fu740_prci_config }, { NULL, 0 }, }; @@ -209,6 +322,60 @@ DEFINE_CLASS_1(prci_clk_pll_clknode, prci_clk_pll_clknode_class, prci_clk_pll_clknode_methods, sizeof(struct prci_clk_pll_sc), clknode_class); +static int +prci_clk_div_init(struct clknode *clk, device_t dev) +{ + + clknode_init_parent_idx(clk, 0); + + return (0); +} + +static int +prci_clk_div_recalc(struct clknode *clk, uint64_t *freq) +{ + struct prci_clk_div_sc *sc; + struct clknode *parent_clk; + uint32_t div; + uint64_t refclk; + int err; + + KASSERT(freq != NULL, ("freq cannot be NULL")); + + sc = clknode_get_softc(clk); + + PRCI_LOCK(sc->parent_sc); + + /* Get refclock frequency. */ + parent_clk = clknode_get_parent(clk); + err = clknode_get_freq(parent_clk, &refclk); + if (err) { + device_printf(sc->parent_sc->dev, + "Failed to get refclk frequency\n"); + PRCI_UNLOCK(sc->parent_sc); + return (err); + } + + /* Calculate the divisor output */ + div = PRCI_READ(sc->parent_sc, sc->reg); + + *freq = refclk / (div + sc->bias); + + PRCI_UNLOCK(sc->parent_sc); + + return (0); +} + +static clknode_method_t prci_clk_div_clknode_methods[] = { + CLKNODEMETHOD(clknode_init, prci_clk_div_init), + CLKNODEMETHOD(clknode_recalc_freq, prci_clk_div_recalc), + CLKNODEMETHOD_END +}; + +DEFINE_CLASS_1(prci_clk_div_clknode, prci_clk_div_clknode_class, + prci_clk_div_clknode_methods, sizeof(struct prci_clk_div_sc), + clknode_class); + static int prci_probe(device_t dev) { @@ -243,16 +410,39 @@ prci_pll_register(struct prci_softc *parent_sc, struct clknode_init_def *clkdef, clknode_register(parent_sc->clkdom, clk); } +static void +prci_div_register(struct prci_softc *parent_sc, struct clknode_init_def *clkdef, + uint32_t reg, uint32_t bias) +{ + struct clknode *clk; + struct prci_clk_div_sc *sc; + + clk = clknode_create(parent_sc->clkdom, &prci_clk_div_clknode_class, + clkdef); + if (clk == NULL) + panic("Failed to create clknode"); + + sc = clknode_get_softc(clk); + sc->parent_sc = parent_sc; + sc->reg = reg; + sc->bias = bias; + + clknode_register(parent_sc->clkdom, clk); +} + static int prci_attach(device_t dev) { - struct clknode_init_def clkdef; + struct clknode_init_def clkdef, clkdef_div; + struct clk_gate_def clkdef_gate; struct prci_softc *sc; clk_t clk_parent; phandle_t node; int i, ncells, error; struct prci_config *cfg; struct prci_pll_def *pll_clk; + struct prci_div_def *div_clk; + struct prci_gate_def *gate_clk; sc = device_get_softc(dev); sc->dev = dev; @@ -308,6 +498,41 @@ prci_attach(device_t dev) prci_pll_register(sc, &clkdef, pll_clk->reg); } + if (cfg->div_clks != NULL) { + bzero(&clkdef_div, sizeof(clkdef_div)); + for (div_clk = cfg->div_clks; div_clk->name; div_clk++) { + clkdef_div.id = div_clk->id; + clkdef_div.name = div_clk->name; + clkdef_div.parent_names = &div_clk->parent_name; + clkdef_div.parent_cnt = 1; + prci_div_register(sc, &clkdef_div, div_clk->reg, + div_clk->bias); + } + } + + if (cfg->gate_clks != NULL) { + bzero(&clkdef_gate, sizeof(clkdef_gate)); + for (gate_clk = cfg->gate_clks; gate_clk->name; gate_clk++) { + clkdef_gate.clkdef.id = gate_clk->id; + clkdef_gate.clkdef.name = gate_clk->name; + clkdef_gate.clkdef.parent_names = &gate_clk->parent_name; + clkdef_gate.clkdef.parent_cnt = 1; + clkdef_gate.offset = gate_clk->reg; + clkdef_gate.shift = 0; + clkdef_gate.mask = 1; + clkdef_gate.on_value = 1; + clkdef_gate.off_value = 0; + error = clknode_gate_register(sc->clkdom, + &clkdef_gate); + if (error != 0) { + device_printf(dev, + "Couldn't create gated clock %s: %d\n", + gate_clk->name, error); + goto fail; + } + } + } + /* * Register the fixed clock "tlclk". * @@ -333,10 +558,75 @@ fail: return (error); } +static int +prci_write_4(device_t dev, bus_addr_t addr, uint32_t val) +{ + struct prci_softc *sc; + + sc = device_get_softc(dev); + + PRCI_WRITE(sc, addr, val); + + return (0); +} + +static int +prci_read_4(device_t dev, bus_addr_t addr, uint32_t *val) +{ + struct prci_softc *sc; + + sc = device_get_softc(dev); + + *val = PRCI_READ(sc, addr); + + return (0); +} + +static int +prci_modify_4(device_t dev, bus_addr_t addr, uint32_t clr, uint32_t set) +{ + struct prci_softc *sc; + uint32_t reg; + + sc = device_get_softc(dev); + + reg = PRCI_READ(sc, addr); + reg &= ~clr; + reg |= set; + PRCI_WRITE(sc, addr, reg); + + return (0); +} + +static void +prci_device_lock(device_t dev) +{ + struct prci_softc *sc; + + sc = device_get_softc(dev); + PRCI_LOCK(sc); +} + +static void +prci_device_unlock(device_t dev) +{ + struct prci_softc *sc; + + sc = device_get_softc(dev); + PRCI_UNLOCK(sc); +} + static device_method_t prci_methods[] = { DEVMETHOD(device_probe, prci_probe), DEVMETHOD(device_attach, prci_attach), + /* clkdev interface */ + DEVMETHOD(clkdev_write_4, prci_write_4), + DEVMETHOD(clkdev_read_4, prci_read_4), + DEVMETHOD(clkdev_modify_4, prci_modify_4), + DEVMETHOD(clkdev_device_lock, prci_device_lock), + DEVMETHOD(clkdev_device_unlock, prci_device_unlock), + DEVMETHOD_END }; From owner-dev-commits-src-all@freebsd.org Sat Aug 7 18:28:19 2021 Return-Path: Delivered-To: dev-commits-src-all@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 9E7FD66F077; Sat, 7 Aug 2021 18:28: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 4GhrSg3wtnz4ZJt; Sat, 7 Aug 2021 18:28: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 6989025F8C; Sat, 7 Aug 2021 18:28: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 177ISJXC082448; Sat, 7 Aug 2021 18:28:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 177ISJl1082447; Sat, 7 Aug 2021 18:28:19 GMT (envelope-from git) Date: Sat, 7 Aug 2021 18:28:19 GMT Message-Id: <202108071828.177ISJl1082447@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: dcbea9a2f465 - main - sifive_prci: Delay attachment until after clk_fixed 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: dcbea9a2f465be1786db21523a7f55db3f7ab3dd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Aug 2021 18:28:19 -0000 The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=dcbea9a2f465be1786db21523a7f55db3f7ab3dd commit dcbea9a2f465be1786db21523a7f55db3f7ab3dd Author: Jessica Clarke AuthorDate: 2021-08-07 18:27:29 +0000 Commit: Jessica Clarke CommitDate: 2021-08-07 18:27:29 +0000 sifive_prci: Delay attachment until after clk_fixed This avoids noisy output from early attempts to attach before clk_fixed has attached to the parent clocks. Reviewed by: kp, mhorne MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31023 --- sys/riscv/sifive/sifive_prci.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/riscv/sifive/sifive_prci.c b/sys/riscv/sifive/sifive_prci.c index 21b9cd568f32..36f2f6705f7e 100644 --- a/sys/riscv/sifive/sifive_prci.c +++ b/sys/riscv/sifive/sifive_prci.c @@ -638,5 +638,9 @@ static driver_t prci_driver = { static devclass_t prci_devclass; +/* + * hfclk and rtcclk appear later in the device tree than prci, so we must + * attach late. + */ EARLY_DRIVER_MODULE(sifive_prci, simplebus, prci_driver, prci_devclass, 0, 0, - BUS_PASS_BUS); + BUS_PASS_BUS + BUS_PASS_ORDER_LATE); From owner-dev-commits-src-all@freebsd.org Sat Aug 7 18:28:20 2021 Return-Path: Delivered-To: dev-commits-src-all@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 B67B066F56B; Sat, 7 Aug 2021 18:28: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 4GhrSh4LBVz4ZSh; Sat, 7 Aug 2021 18:28: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 7C4DA25F1A; Sat, 7 Aug 2021 18:28: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 177ISKIM082472; Sat, 7 Aug 2021 18:28:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 177ISKBu082471; Sat, 7 Aug 2021 18:28:20 GMT (envelope-from git) Date: Sat, 7 Aug 2021 18:28:20 GMT Message-Id: <202108071828.177ISKBu082471@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: 8e7e0690ecd7 - main - sifive_prci: Add reset support for the FU540 and FU740 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: 8e7e0690ecd79e8adc9182d486c05748bd97d26d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Aug 2021 18:28:20 -0000 The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=8e7e0690ecd79e8adc9182d486c05748bd97d26d commit 8e7e0690ecd79e8adc9182d486c05748bd97d26d Author: Jessica Clarke AuthorDate: 2021-08-07 18:27:29 +0000 Commit: Jessica Clarke CommitDate: 2021-08-07 18:27:29 +0000 sifive_prci: Add reset support for the FU540 and FU740 This is needed for FU740 PCIe support. Whilst we don't need the FU540's resets they are also defined for completeness. Reviewed by: manu MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31024 --- sys/riscv/conf/GENERIC | 1 + sys/riscv/sifive/sifive_prci.c | 57 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) diff --git a/sys/riscv/conf/GENERIC b/sys/riscv/conf/GENERIC index c6cd8e0fdedb..2af5f8803be7 100644 --- a/sys/riscv/conf/GENERIC +++ b/sys/riscv/conf/GENERIC @@ -82,6 +82,7 @@ device rcons # EXT_RESOURCES pseudo devices options EXT_RESOURCES device clk +device hwreset device syscon device syscon_power device riscv_syscon diff --git a/sys/riscv/sifive/sifive_prci.c b/sys/riscv/sifive/sifive_prci.c index 36f2f6705f7e..fee67bb153ac 100644 --- a/sys/riscv/sifive/sifive_prci.c +++ b/sys/riscv/sifive/sifive_prci.c @@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$"); #include #include "clkdev_if.h" +#include "hwreset_if.h" static struct resource_spec prci_spec[] = { { SYS_RES_MEMORY, 0, RF_ACTIVE }, @@ -69,6 +70,8 @@ struct prci_softc { struct resource *res; bus_space_tag_t bst; bus_space_handle_t bsh; + + int nresets; }; struct prci_clk_pll_sc { @@ -94,6 +97,9 @@ struct prci_clk_div_sc { #define PRCI_PLL_DIVQ_MASK 0x38000 #define PRCI_PLL_DIVQ_SHIFT 15 +/* Called devicesresetreg on the FU540 */ +#define PRCI_DEVICES_RESET_N 0x28 + #define PRCI_READ(_sc, _reg) \ bus_space_read_4((_sc)->bst, (_sc)->bsh, (_reg)) #define PRCI_WRITE(_sc, _reg, _val) \ @@ -155,6 +161,7 @@ struct prci_config { struct prci_div_def *div_clks; struct prci_gate_def *gate_clks; struct clk_fixed_def *tlclk_def; + int nresets; }; /* FU540 clock numbers */ @@ -191,6 +198,7 @@ static struct clk_fixed_def fu540_tlclk_def = { struct prci_config fu540_prci_config = { .pll_clks = fu540_pll_clks, .tlclk_def = &fu540_tlclk_def, + .nresets = 6, }; /* FU740 clock numbers */ @@ -254,6 +262,7 @@ struct prci_config fu740_prci_config = { .div_clks = fu740_div_clks, .gate_clks = fu740_gate_clks, .tlclk_def = &fu740_tlclk_def, + .nresets = 7, }; static struct ofw_compat_data compat_data[] = { @@ -547,6 +556,8 @@ prci_attach(device_t dev) if (error) panic("Couldn't finalise clock domain"); + sc->nresets = cfg->nresets; + return (0); fail1: @@ -616,6 +627,48 @@ prci_device_unlock(device_t dev) PRCI_UNLOCK(sc); } +static int +prci_reset_assert(device_t dev, intptr_t id, bool reset) +{ + struct prci_softc *sc; + uint32_t reg; + + sc = device_get_softc(dev); + + if (id >= sc->nresets) + return (ENXIO); + + PRCI_LOCK(sc); + reg = PRCI_READ(sc, PRCI_DEVICES_RESET_N); + if (reset) + reg &= ~(1u << id); + else + reg |= (1u << id); + PRCI_WRITE(sc, PRCI_DEVICES_RESET_N, reg); + PRCI_UNLOCK(sc); + + return (0); +} + +static int +prci_reset_is_asserted(device_t dev, intptr_t id, bool *reset) +{ + struct prci_softc *sc; + uint32_t reg; + + sc = device_get_softc(dev); + + if (id >= sc->nresets) + return (ENXIO); + + PRCI_LOCK(sc); + reg = PRCI_READ(sc, PRCI_DEVICES_RESET_N); + *reset = (reg & (1u << id)) == 0; + PRCI_UNLOCK(sc); + + return (0); +} + static device_method_t prci_methods[] = { DEVMETHOD(device_probe, prci_probe), DEVMETHOD(device_attach, prci_attach), @@ -627,6 +680,10 @@ static device_method_t prci_methods[] = { DEVMETHOD(clkdev_device_lock, prci_device_lock), DEVMETHOD(clkdev_device_unlock, prci_device_unlock), + /* Reset interface */ + DEVMETHOD(hwreset_assert, prci_reset_assert), + DEVMETHOD(hwreset_is_asserted, prci_reset_is_asserted), + DEVMETHOD_END }; From owner-dev-commits-src-all@freebsd.org Sat Aug 7 18:28:22 2021 Return-Path: Delivered-To: dev-commits-src-all@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 385D966F2C8; Sat, 7 Aug 2021 18:28: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 4GhrSj6jYJz4ZmP; Sat, 7 Aug 2021 18:28: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 9F4DD260EA; Sat, 7 Aug 2021 18:28: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 177ISLE6082503; Sat, 7 Aug 2021 18:28:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 177ISL77082502; Sat, 7 Aug 2021 18:28:21 GMT (envelope-from git) Date: Sat, 7 Aug 2021 18:28:21 GMT Message-Id: <202108071828.177ISL77082502@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: 90a089cf2a74 - main - fu540_spi: Rename to sifive_spi 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: 90a089cf2a7462e4101907e2a6161734b2487a78 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Aug 2021 18:28:22 -0000 The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=90a089cf2a7462e4101907e2a6161734b2487a78 commit 90a089cf2a7462e4101907e2a6161734b2487a78 Author: Jessica Clarke AuthorDate: 2021-08-07 18:27:30 +0000 Commit: Jessica Clarke CommitDate: 2021-08-07 18:27:30 +0000 fu540_spi: Rename to sifive_spi The FU740 also uses the same SPI controller. Reviewed by: kp, philip MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31026 --- sys/riscv/conf/GENERIC | 2 +- sys/riscv/conf/NOTES | 2 +- sys/riscv/sifive/files.sifive | 2 +- sys/riscv/sifive/{fu540_spi.c => sifive_spi.c} | 228 ++++++++++++------------- 4 files changed, 117 insertions(+), 117 deletions(-) diff --git a/sys/riscv/conf/GENERIC b/sys/riscv/conf/GENERIC index 2af5f8803be7..b65c0317f28d 100644 --- a/sys/riscv/conf/GENERIC +++ b/sys/riscv/conf/GENERIC @@ -174,5 +174,5 @@ options FDT makeoptions MODULES_EXTRA+="dtb/sifive" # SiFive device drivers -device fu540spi +device sifive_spi include "../sifive/std.sifive" diff --git a/sys/riscv/conf/NOTES b/sys/riscv/conf/NOTES index 9680728de6de..0a067ab19d34 100644 --- a/sys/riscv/conf/NOTES +++ b/sys/riscv/conf/NOTES @@ -66,7 +66,7 @@ device xilinx_spi # Xilinx AXI Quad-SPI Controller # SOC-specific device fe310aon -device fu540spi +device sifive_spi files "../sifive/files.sifive" # Flattened Device Tree diff --git a/sys/riscv/sifive/files.sifive b/sys/riscv/sifive/files.sifive index 5426f703c27c..2eb73f1607ac 100644 --- a/sys/riscv/sifive/files.sifive +++ b/sys/riscv/sifive/files.sifive @@ -1,6 +1,6 @@ # $FreeBSD$ riscv/sifive/fe310_aon.c optional fe310aon -riscv/sifive/fu540_spi.c optional fu540spi spibus riscv/sifive/sifive_prci.c standard +riscv/sifive/sifive_spi.c optional sifive_spi spibus riscv/sifive/sifive_uart.c standard diff --git a/sys/riscv/sifive/fu540_spi.c b/sys/riscv/sifive/sifive_spi.c similarity index 56% rename from sys/riscv/sifive/fu540_spi.c rename to sys/riscv/sifive/sifive_spi.c index 7cd132b9cda4..df72beaac7ae 100644 --- a/sys/riscv/sifive/fu540_spi.c +++ b/sys/riscv/sifive/sifive_spi.c @@ -62,12 +62,12 @@ __FBSDID("$FreeBSD$"); #define DBGPRINT(dev, fmt, args...) #endif -static struct resource_spec fuspi_spec[] = { +static struct resource_spec sfspi_spec[] = { { SYS_RES_MEMORY, 0, RF_ACTIVE }, RESOURCE_SPEC_END }; -struct fuspi_softc { +struct sfspi_softc { device_t dev; device_t parent; @@ -84,67 +84,67 @@ struct fuspi_softc { uint32_t cs_max; }; -#define FUSPI_LOCK(sc) mtx_lock(&(sc)->mtx) -#define FUSPI_UNLOCK(sc) mtx_unlock(&(sc)->mtx) -#define FUSPI_ASSERT_LOCKED(sc) mtx_assert(&(sc)->mtx, MA_OWNED); -#define FUSPI_ASSERT_UNLOCKED(sc) mtx_assert(&(sc)->mtx, MA_NOTOWNED); +#define SFSPI_LOCK(sc) mtx_lock(&(sc)->mtx) +#define SFSPI_UNLOCK(sc) mtx_unlock(&(sc)->mtx) +#define SFSPI_ASSERT_LOCKED(sc) mtx_assert(&(sc)->mtx, MA_OWNED); +#define SFSPI_ASSERT_UNLOCKED(sc) mtx_assert(&(sc)->mtx, MA_NOTOWNED); /* * Register offsets. * From Sifive-Unleashed-FU540-C000-v1.0.pdf page 101. */ -#define FUSPI_REG_SCKDIV 0x00 /* Serial clock divisor */ -#define FUSPI_REG_SCKMODE 0x04 /* Serial clock mode */ -#define FUSPI_REG_CSID 0x10 /* Chip select ID */ -#define FUSPI_REG_CSDEF 0x14 /* Chip select default */ -#define FUSPI_REG_CSMODE 0x18 /* Chip select mode */ -#define FUSPI_REG_DELAY0 0x28 /* Delay control 0 */ -#define FUSPI_REG_DELAY1 0x2C /* Delay control 1 */ -#define FUSPI_REG_FMT 0x40 /* Frame format */ -#define FUSPI_REG_TXDATA 0x48 /* Tx FIFO data */ -#define FUSPI_REG_RXDATA 0x4C /* Rx FIFO data */ -#define FUSPI_REG_TXMARK 0x50 /* Tx FIFO watermark */ -#define FUSPI_REG_RXMARK 0x54 /* Rx FIFO watermark */ -#define FUSPI_REG_FCTRL 0x60 /* SPI flash interface control* */ -#define FUSPI_REG_FFMT 0x64 /* SPI flash instruction format* */ -#define FUSPI_REG_IE 0x70 /* SPI interrupt enable */ -#define FUSPI_REG_IP 0x74 /* SPI interrupt pending */ - -#define FUSPI_SCKDIV_MASK 0xfff - -#define FUSPI_CSDEF_ALL ((1 << sc->cs_max)-1) - -#define FUSPI_CSMODE_AUTO 0x0U -#define FUSPI_CSMODE_HOLD 0x2U -#define FUSPI_CSMODE_OFF 0x3U - -#define FUSPI_TXDATA_DATA_MASK 0xff -#define FUSPI_TXDATA_FULL (1 << 31) - -#define FUSPI_RXDATA_DATA_MASK 0xff -#define FUSPI_RXDATA_EMPTY (1 << 31) - -#define FUSPI_SCKMODE_PHA (1 << 0) -#define FUSPI_SCKMODE_POL (1 << 1) - -#define FUSPI_FMT_PROTO_SINGLE 0x0U -#define FUSPI_FMT_PROTO_DUAL 0x1U -#define FUSPI_FMT_PROTO_QUAD 0x2U -#define FUSPI_FMT_PROTO_MASK 0x3U -#define FUSPI_FMT_ENDIAN (1 << 2) -#define FUSPI_FMT_DIR (1 << 3) -#define FUSPI_FMT_LEN(x) ((uint32_t)(x) << 16) -#define FUSPI_FMT_LEN_MASK (0xfU << 16) - -#define FUSPI_FIFO_DEPTH 8 - -#define FUSPI_READ(_sc, _reg) \ +#define SFSPI_REG_SCKDIV 0x00 /* Serial clock divisor */ +#define SFSPI_REG_SCKMODE 0x04 /* Serial clock mode */ +#define SFSPI_REG_CSID 0x10 /* Chip select ID */ +#define SFSPI_REG_CSDEF 0x14 /* Chip select default */ +#define SFSPI_REG_CSMODE 0x18 /* Chip select mode */ +#define SFSPI_REG_DELAY0 0x28 /* Delay control 0 */ +#define SFSPI_REG_DELAY1 0x2C /* Delay control 1 */ +#define SFSPI_REG_FMT 0x40 /* Frame format */ +#define SFSPI_REG_TXDATA 0x48 /* Tx FIFO data */ +#define SFSPI_REG_RXDATA 0x4C /* Rx FIFO data */ +#define SFSPI_REG_TXMARK 0x50 /* Tx FIFO watermark */ +#define SFSPI_REG_RXMARK 0x54 /* Rx FIFO watermark */ +#define SFSPI_REG_FCTRL 0x60 /* SPI flash interface control* */ +#define SFSPI_REG_FFMT 0x64 /* SPI flash instruction format* */ +#define SFSPI_REG_IE 0x70 /* SPI interrupt enable */ +#define SFSPI_REG_IP 0x74 /* SPI interrupt pending */ + +#define SFSPI_SCKDIV_MASK 0xfff + +#define SFSPI_CSDEF_ALL ((1 << sc->cs_max)-1) + +#define SFSPI_CSMODE_AUTO 0x0U +#define SFSPI_CSMODE_HOLD 0x2U +#define SFSPI_CSMODE_OFF 0x3U + +#define SFSPI_TXDATA_DATA_MASK 0xff +#define SFSPI_TXDATA_FULL (1 << 31) + +#define SFSPI_RXDATA_DATA_MASK 0xff +#define SFSPI_RXDATA_EMPTY (1 << 31) + +#define SFSPI_SCKMODE_PHA (1 << 0) +#define SFSPI_SCKMODE_POL (1 << 1) + +#define SFSPI_FMT_PROTO_SINGLE 0x0U +#define SFSPI_FMT_PROTO_DUAL 0x1U +#define SFSPI_FMT_PROTO_QUAD 0x2U +#define SFSPI_FMT_PROTO_MASK 0x3U +#define SFSPI_FMT_ENDIAN (1 << 2) +#define SFSPI_FMT_DIR (1 << 3) +#define SFSPI_FMT_LEN(x) ((uint32_t)(x) << 16) +#define SFSPI_FMT_LEN_MASK (0xfU << 16) + +#define SFSPI_FIFO_DEPTH 8 + +#define SFSPI_READ(_sc, _reg) \ bus_space_read_4((_sc)->bst, (_sc)->bsh, (_reg)) -#define FUSPI_WRITE(_sc, _reg, _val) \ +#define SFSPI_WRITE(_sc, _reg, _val) \ bus_space_write_4((_sc)->bst, (_sc)->bsh, (_reg), (_val)) static void -fuspi_tx(struct fuspi_softc *sc, uint8_t *buf, uint32_t bufsiz) +sfspi_tx(struct sfspi_softc *sc, uint8_t *buf, uint32_t bufsiz) { uint32_t val; uint8_t *p, *end; @@ -154,35 +154,35 @@ fuspi_tx(struct fuspi_softc *sc, uint8_t *buf, uint32_t bufsiz) end = buf + bufsiz; for (p = buf; p < end; p++) { do { - val = FUSPI_READ(sc, FUSPI_REG_TXDATA); - } while (val & FUSPI_TXDATA_FULL); + val = SFSPI_READ(sc, SFSPI_REG_TXDATA); + } while (val & SFSPI_TXDATA_FULL); val = *p; - FUSPI_WRITE(sc, FUSPI_REG_TXDATA, val); + SFSPI_WRITE(sc, SFSPI_REG_TXDATA, val); } } static void -fuspi_rx(struct fuspi_softc *sc, uint8_t *buf, uint32_t bufsiz) +sfspi_rx(struct sfspi_softc *sc, uint8_t *buf, uint32_t bufsiz) { uint32_t val; uint8_t *p, *end; KASSERT(buf != NULL, ("RX buffer cannot be NULL")); - KASSERT(bufsiz <= FUSPI_FIFO_DEPTH, + KASSERT(bufsiz <= SFSPI_FIFO_DEPTH, ("Cannot receive more than %d bytes at a time\n", - FUSPI_FIFO_DEPTH)); + SFSPI_FIFO_DEPTH)); end = buf + bufsiz; for (p = buf; p < end; p++) { do { - val = FUSPI_READ(sc, FUSPI_REG_RXDATA); - } while (val & FUSPI_RXDATA_EMPTY); - *p = val & FUSPI_RXDATA_DATA_MASK; + val = SFSPI_READ(sc, SFSPI_REG_RXDATA); + } while (val & SFSPI_RXDATA_EMPTY); + *p = val & SFSPI_RXDATA_DATA_MASK; }; } static int -fuspi_xfer_buf(struct fuspi_softc *sc, uint8_t *rxbuf, uint8_t *txbuf, +sfspi_xfer_buf(struct sfspi_softc *sc, uint8_t *rxbuf, uint8_t *txbuf, uint32_t txlen, uint32_t rxlen) { uint32_t bytes; @@ -192,10 +192,10 @@ fuspi_xfer_buf(struct fuspi_softc *sc, uint8_t *rxbuf, uint8_t *txbuf, KASSERT(txbuf != NULL, ("TX buffer cannot be NULL")); while (txlen) { - bytes = (txlen > FUSPI_FIFO_DEPTH) ? FUSPI_FIFO_DEPTH : txlen; - fuspi_tx(sc, txbuf, bytes); + bytes = (txlen > SFSPI_FIFO_DEPTH) ? SFSPI_FIFO_DEPTH : txlen; + sfspi_tx(sc, txbuf, bytes); txbuf += bytes; - fuspi_rx(sc, rxbuf, bytes); + sfspi_rx(sc, rxbuf, bytes); rxbuf += bytes; txlen -= bytes; } @@ -204,50 +204,50 @@ fuspi_xfer_buf(struct fuspi_softc *sc, uint8_t *rxbuf, uint8_t *txbuf, } static int -fuspi_setup(struct fuspi_softc *sc, uint32_t cs, uint32_t mode, +sfspi_setup(struct sfspi_softc *sc, uint32_t cs, uint32_t mode, uint32_t freq) { uint32_t csmode, fmt, sckdiv, sckmode; - FUSPI_ASSERT_LOCKED(sc); + SFSPI_ASSERT_LOCKED(sc); /* * Fsck = Fin / 2 * (div + 1) * -> div = Fin / (2 * Fsck) - 1 */ - sckdiv = (howmany(sc->freq >> 1, freq) - 1) & FUSPI_SCKDIV_MASK; - FUSPI_WRITE(sc, FUSPI_REG_SCKDIV, sckdiv); + sckdiv = (howmany(sc->freq >> 1, freq) - 1) & SFSPI_SCKDIV_MASK; + SFSPI_WRITE(sc, SFSPI_REG_SCKDIV, sckdiv); switch (mode) { case SPIBUS_MODE_CPHA: - sckmode = FUSPI_SCKMODE_PHA; + sckmode = SFSPI_SCKMODE_PHA; break; case SPIBUS_MODE_CPOL: - sckmode = FUSPI_SCKMODE_POL; + sckmode = SFSPI_SCKMODE_POL; break; case SPIBUS_MODE_CPOL_CPHA: - sckmode = FUSPI_SCKMODE_PHA | FUSPI_SCKMODE_POL; + sckmode = SFSPI_SCKMODE_PHA | SFSPI_SCKMODE_POL; break; } - FUSPI_WRITE(sc, FUSPI_REG_SCKMODE, sckmode); + SFSPI_WRITE(sc, SFSPI_REG_SCKMODE, sckmode); - csmode = FUSPI_CSMODE_HOLD; + csmode = SFSPI_CSMODE_HOLD; if (cs & SPIBUS_CS_HIGH) - csmode = FUSPI_CSMODE_AUTO; - FUSPI_WRITE(sc, FUSPI_REG_CSMODE, csmode); + csmode = SFSPI_CSMODE_AUTO; + SFSPI_WRITE(sc, SFSPI_REG_CSMODE, csmode); - FUSPI_WRITE(sc, FUSPI_REG_CSID, cs & ~SPIBUS_CS_HIGH); + SFSPI_WRITE(sc, SFSPI_REG_CSID, cs & ~SPIBUS_CS_HIGH); - fmt = FUSPI_FMT_PROTO_SINGLE | FUSPI_FMT_LEN(8); - FUSPI_WRITE(sc, FUSPI_REG_FMT, fmt); + fmt = SFSPI_FMT_PROTO_SINGLE | SFSPI_FMT_LEN(8); + SFSPI_WRITE(sc, SFSPI_REG_FMT, fmt); return (0); } static int -fuspi_transfer(device_t dev, device_t child, struct spi_command *cmd) +sfspi_transfer(device_t dev, device_t child, struct spi_command *cmd) { - struct fuspi_softc *sc; + struct sfspi_softc *sc; uint32_t clock, cs, csdef, mode; int err; @@ -266,38 +266,38 @@ fuspi_transfer(device_t dev, device_t child, struct spi_command *cmd) return (EINVAL); } - FUSPI_LOCK(sc); + SFSPI_LOCK(sc); device_busy(sc->dev); - err = fuspi_setup(sc, cs, mode, clock); + err = sfspi_setup(sc, cs, mode, clock); if (err != 0) { - FUSPI_UNLOCK(sc); + SFSPI_UNLOCK(sc); return (err); } err = 0; if (cmd->tx_cmd_sz > 0) - err = fuspi_xfer_buf(sc, cmd->rx_cmd, cmd->tx_cmd, + err = sfspi_xfer_buf(sc, cmd->rx_cmd, cmd->tx_cmd, cmd->tx_cmd_sz, cmd->rx_cmd_sz); if (cmd->tx_data_sz > 0 && err == 0) - err = fuspi_xfer_buf(sc, cmd->rx_data, cmd->tx_data, + err = sfspi_xfer_buf(sc, cmd->rx_data, cmd->tx_data, cmd->tx_data_sz, cmd->rx_data_sz); /* Deassert chip select. */ - csdef = FUSPI_CSDEF_ALL & ~(1 << cs); - FUSPI_WRITE(sc, FUSPI_REG_CSDEF, csdef); - FUSPI_WRITE(sc, FUSPI_REG_CSDEF, FUSPI_CSDEF_ALL); + csdef = SFSPI_CSDEF_ALL & ~(1 << cs); + SFSPI_WRITE(sc, SFSPI_REG_CSDEF, csdef); + SFSPI_WRITE(sc, SFSPI_REG_CSDEF, SFSPI_CSDEF_ALL); device_unbusy(sc->dev); - FUSPI_UNLOCK(sc); + SFSPI_UNLOCK(sc); return (err); } static int -fuspi_attach(device_t dev) +sfspi_attach(device_t dev) { - struct fuspi_softc *sc; + struct sfspi_softc *sc; int error; sc = device_get_softc(dev); @@ -305,7 +305,7 @@ fuspi_attach(device_t dev) mtx_init(&sc->mtx, device_get_nameunit(sc->dev), NULL, MTX_DEF); - error = bus_alloc_resources(dev, fuspi_spec, &sc->res); + error = bus_alloc_resources(dev, sfspi_spec, &sc->res); if (error) { device_printf(dev, "Couldn't allocate resources\n"); goto fail; @@ -334,13 +334,13 @@ fuspi_attach(device_t dev) * From Sifive-Unleashed-FU540-C000-v1.0.pdf page 103: * csdef is cs_width bits wide and all ones on reset. */ - sc->cs_max = FUSPI_READ(sc, FUSPI_REG_CSDEF); + sc->cs_max = SFSPI_READ(sc, SFSPI_REG_CSDEF); /* * We don't support the direct-mapped flash interface. * Disable it. */ - FUSPI_WRITE(sc, FUSPI_REG_FCTRL, 0x0); + SFSPI_WRITE(sc, SFSPI_REG_FCTRL, 0x0); /* Probe and attach the spibus when interrupts are available. */ sc->parent = device_add_child(dev, "spibus", -1); @@ -349,13 +349,13 @@ fuspi_attach(device_t dev) return (0); fail: - bus_release_resources(dev, fuspi_spec, &sc->res); + bus_release_resources(dev, sfspi_spec, &sc->res); mtx_destroy(&sc->mtx); return (error); } static int -fuspi_probe(device_t dev) +sfspi_probe(device_t dev) { if (!ofw_bus_status_okay(dev)) @@ -364,37 +364,37 @@ fuspi_probe(device_t dev) if (!ofw_bus_is_compatible(dev, "sifive,spi0")) return (ENXIO); - device_set_desc(dev, "SiFive FU540 SPI controller"); + device_set_desc(dev, "SiFive SPI controller"); return (BUS_PROBE_DEFAULT); } static phandle_t -fuspi_get_node(device_t bus, device_t dev) +sfspi_get_node(device_t bus, device_t dev) { return (ofw_bus_get_node(bus)); } -static device_method_t fuspi_methods[] = { - DEVMETHOD(device_probe, fuspi_probe), - DEVMETHOD(device_attach, fuspi_attach), +static device_method_t sfspi_methods[] = { + DEVMETHOD(device_probe, sfspi_probe), + DEVMETHOD(device_attach, sfspi_attach), - DEVMETHOD(spibus_transfer, fuspi_transfer), + DEVMETHOD(spibus_transfer, sfspi_transfer), - DEVMETHOD(ofw_bus_get_node, fuspi_get_node), + DEVMETHOD(ofw_bus_get_node, sfspi_get_node), DEVMETHOD_END }; -static driver_t fuspi_driver = { - "fu540spi", - fuspi_methods, - sizeof(struct fuspi_softc) +static driver_t sfspi_driver = { + "sifive_spi", + sfspi_methods, + sizeof(struct sfspi_softc) }; -static devclass_t fuspi_devclass; +static devclass_t sfspi_devclass; -DRIVER_MODULE(fu540spi, simplebus, fuspi_driver, fuspi_devclass, 0, 0); -DRIVER_MODULE(ofw_spibus, fu540spi, ofw_spibus_driver, ofw_spibus_devclass, 0, 0); -MODULE_DEPEND(fu540spi, ofw_spibus, 1, 1, 1); +DRIVER_MODULE(sifive_spi, simplebus, sfspi_driver, sfspi_devclass, 0, 0); +DRIVER_MODULE(ofw_spibus, sifive_spi, ofw_spibus_driver, ofw_spibus_devclass, 0, 0); +MODULE_DEPEND(sifive_spi, ofw_spibus, 1, 1, 1); From owner-dev-commits-src-all@freebsd.org Sat Aug 7 18:28:23 2021 Return-Path: Delivered-To: dev-commits-src-all@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 2921D66F334; Sat, 7 Aug 2021 18:28: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 4GhrSl08tYz4ZkQ; Sat, 7 Aug 2021 18:28: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 CFAE425CBF; Sat, 7 Aug 2021 18:28: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 177ISMia082527; Sat, 7 Aug 2021 18:28:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 177ISM51082526; Sat, 7 Aug 2021 18:28:22 GMT (envelope-from git) Date: Sat, 7 Aug 2021 18:28:22 GMT Message-Id: <202108071828.177ISM51082526@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: b47e5c5dbe20 - main - sifive_gpio: Add SiFive GPIO controller driver 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: b47e5c5dbe2058b6a178230dc7796c37bfeaa926 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Aug 2021 18:28:23 -0000 The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=b47e5c5dbe2058b6a178230dc7796c37bfeaa926 commit b47e5c5dbe2058b6a178230dc7796c37bfeaa926 Author: Jessica Clarke AuthorDate: 2021-08-07 18:27:31 +0000 Commit: Jessica Clarke CommitDate: 2021-08-07 18:27:31 +0000 sifive_gpio: Add SiFive GPIO controller driver This is present on both the FU540 and FU740, but only needed for the FU740 in order to assert reset and power enable signals for its PCIe controller. Reviewed by: mhorne MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31031 --- sys/riscv/conf/GENERIC | 4 + sys/riscv/sifive/files.sifive | 1 + sys/riscv/sifive/sifive_gpio.c | 464 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 469 insertions(+) diff --git a/sys/riscv/conf/GENERIC b/sys/riscv/conf/GENERIC index b65c0317f28d..360d6b163d45 100644 --- a/sys/riscv/conf/GENERIC +++ b/sys/riscv/conf/GENERIC @@ -123,6 +123,9 @@ device xae # Xilinx AXI Ethernet MAC device xdma # DMA interface device axidma # Xilinx AXI DMA Controller +# GPIO +device gpio + # SPI device spibus device spigen @@ -174,5 +177,6 @@ options FDT makeoptions MODULES_EXTRA+="dtb/sifive" # SiFive device drivers +device sifive_gpio device sifive_spi include "../sifive/std.sifive" diff --git a/sys/riscv/sifive/files.sifive b/sys/riscv/sifive/files.sifive index 2eb73f1607ac..9ea71c4fcd27 100644 --- a/sys/riscv/sifive/files.sifive +++ b/sys/riscv/sifive/files.sifive @@ -1,6 +1,7 @@ # $FreeBSD$ riscv/sifive/fe310_aon.c optional fe310aon +riscv/sifive/sifive_gpio.c optional sifive_gpio gpio riscv/sifive/sifive_prci.c standard riscv/sifive/sifive_spi.c optional sifive_spi spibus riscv/sifive/sifive_uart.c standard diff --git a/sys/riscv/sifive/sifive_gpio.c b/sys/riscv/sifive/sifive_gpio.c new file mode 100644 index 000000000000..47d03ca448d5 --- /dev/null +++ b/sys/riscv/sifive/sifive_gpio.c @@ -0,0 +1,464 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * 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. + * + */ + +/* TODO: Provide interrupt controller interface */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +/* Registers are 32-bit so can only fit 32 pins */ +#define SFGPIO_MAX_PINS 32 + +#define SFGPIO_DEFAULT_CAPS (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT) + +#define SFGPIO_INPUT_VAL 0x0 +#define SFGPIO_INPUT_EN 0x4 +#define SFGPIO_OUTPUT_EN 0x8 +#define SFGPIO_OUTPUT_VAL 0xc +#define SFGPIO_RISE_IE 0x18 +#define SFGPIO_RISE_IP 0x1c +#define SFGPIO_FALL_IE 0x20 +#define SFGPIO_FALL_IP 0x24 +#define SFGPIO_HIGH_IE 0x28 +#define SFGPIO_HIGH_IP 0x2c +#define SFGPIO_LOW_IE 0x30 +#define SFGPIO_LOW_IP 0x34 + +struct sfgpio_softc { + device_t dev; + device_t busdev; + struct mtx mtx; + struct resource *mem_res; + int mem_rid; + struct resource *irq_res; + int irq_rid; + int npins; + struct gpio_pin gpio_pins[SFGPIO_MAX_PINS]; +}; + +#define SFGPIO_LOCK(_sc) mtx_lock(&(_sc)->mtx) +#define SFGPIO_UNLOCK(_sc) mtx_unlock(&(_sc)->mtx) + +#define SFGPIO_READ(_sc, _off) \ + bus_read_4((_sc)->mem_res, (_off)) +#define SFGPIO_WRITE(_sc, _off, _val) \ + bus_write_4((_sc)->mem_res, (_off), (_val)) + +static struct ofw_compat_data compat_data[] = { + { "sifive,gpio0", 1 }, + { NULL, 0 }, +}; + +static int +sfgpio_probe(device_t dev) +{ + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) + return (ENXIO); + + device_set_desc(dev, "SiFive GPIO Controller"); + + return (BUS_PROBE_DEFAULT); +} + +static int +sfgpio_attach(device_t dev) +{ + struct sfgpio_softc *sc; + phandle_t node; + int error, i; + pcell_t npins; + uint32_t input_en, output_en; + + sc = device_get_softc(dev); + sc->dev = dev; + + node = ofw_bus_get_node(dev); + + mtx_init(&sc->mtx, device_get_nameunit(sc->dev), NULL, MTX_DEF); + + sc->mem_rid = 0; + sc->mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, + &sc->mem_rid, RF_ACTIVE); + if (sc->mem_res == NULL) { + device_printf(dev, "Cannot allocate memory resource\n"); + error = ENXIO; + goto fail; + } + + if (OF_getencprop(node, "ngpios", &npins, sizeof(npins)) <= 0) { + /* Optional; defaults to 16 */ + npins = 16; + } else if (npins > SFGPIO_MAX_PINS) { + device_printf(dev, "Too many pins: %d\n", npins); + error = ENXIO; + goto fail; + } + sc->npins = npins; + + sc->irq_rid = 0; + sc->irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &sc->irq_rid, + RF_ACTIVE); + if (sc->irq_res == NULL) { + device_printf(dev, "Cannot allocate IRQ resource\n"); + error = ENXIO; + goto fail; + } + + input_en = SFGPIO_READ(sc, SFGPIO_INPUT_EN); + output_en = SFGPIO_READ(sc, SFGPIO_OUTPUT_EN); + for (i = 0; i < sc->npins; ++i) { + sc->gpio_pins[i].gp_pin = i; + sc->gpio_pins[i].gp_caps = SFGPIO_DEFAULT_CAPS; + sc->gpio_pins[i].gp_flags = + ((input_en & (1u << i)) ? GPIO_PIN_INPUT : 0) | + ((output_en & (1u << i)) ? GPIO_PIN_OUTPUT : 0); + snprintf(sc->gpio_pins[i].gp_name, GPIOMAXNAME, "GPIO%d", i); + sc->gpio_pins[i].gp_name[GPIOMAXNAME - 1] = '\0'; + } + + sc->busdev = gpiobus_attach_bus(dev); + if (sc->busdev == NULL) { + device_printf(dev, "Cannot attach gpiobus\n"); + error = ENXIO; + goto fail; + } + + return (0); + +fail: + if (sc->busdev != NULL) + gpiobus_detach_bus(dev); + if (sc->irq_res != NULL) + bus_release_resource(dev, SYS_RES_IRQ, sc->irq_rid, + sc->irq_res); + if (sc->mem_res != NULL) + bus_release_resource(dev, SYS_RES_MEMORY, sc->mem_rid, + sc->mem_res); + mtx_destroy(&sc->mtx); + return (error); +} + +static device_t +sfgpio_get_bus(device_t dev) +{ + struct sfgpio_softc *sc; + + sc = device_get_softc(dev); + + return (sc->busdev); +} + +static int +sfgpio_pin_max(device_t dev, int *maxpin) +{ + struct sfgpio_softc *sc; + + sc = device_get_softc(dev); + + *maxpin = sc->npins - 1; + + return (0); +} + +static int +sfgpio_pin_set(device_t dev, uint32_t pin, unsigned int val) +{ + struct sfgpio_softc *sc; + uint32_t reg; + + sc = device_get_softc(dev); + + if (pin >= sc->npins) + return (EINVAL); + + SFGPIO_LOCK(sc); + reg = SFGPIO_READ(sc, SFGPIO_OUTPUT_VAL); + if (val) + reg |= (1u << pin); + else + reg &= ~(1u << pin); + SFGPIO_WRITE(sc, SFGPIO_OUTPUT_VAL, reg); + SFGPIO_UNLOCK(sc); + + return (0); +} + +static int +sfgpio_pin_get(device_t dev, uint32_t pin, unsigned int *val) +{ + struct sfgpio_softc *sc; + uint32_t reg; + + sc = device_get_softc(dev); + + if (pin >= sc->npins) + return (EINVAL); + + SFGPIO_LOCK(sc); + if (sc->gpio_pins[pin].gp_flags & GPIO_PIN_OUTPUT) + reg = SFGPIO_READ(sc, SFGPIO_OUTPUT_VAL); + else + reg = SFGPIO_READ(sc, SFGPIO_INPUT_VAL); + *val = (reg & (1u << pin)) ? 1 : 0; + SFGPIO_UNLOCK(sc); + + return (0); +} + +static int +sfgpio_pin_toggle(device_t dev, uint32_t pin) +{ + struct sfgpio_softc *sc; + uint32_t reg; + + sc = device_get_softc(dev); + + if (pin >= sc->npins) + return (EINVAL); + + SFGPIO_LOCK(sc); + reg = SFGPIO_READ(sc, SFGPIO_OUTPUT_VAL); + reg ^= (1u << pin); + SFGPIO_WRITE(sc, SFGPIO_OUTPUT_VAL, reg); + SFGPIO_UNLOCK(sc); + + return (0); +} + +static int +sfgpio_pin_getcaps(device_t dev, uint32_t pin, uint32_t *caps) +{ + struct sfgpio_softc *sc; + + sc = device_get_softc(dev); + + if (pin >= sc->npins) + return (EINVAL); + + SFGPIO_LOCK(sc); + *caps = sc->gpio_pins[pin].gp_caps; + SFGPIO_UNLOCK(sc); + + return (0); +} + +static int +sfgpio_pin_getflags(device_t dev, uint32_t pin, uint32_t *flags) +{ + struct sfgpio_softc *sc; + + sc = device_get_softc(dev); + + if (pin >= sc->npins) + return (EINVAL); + + SFGPIO_LOCK(sc); + *flags = sc->gpio_pins[pin].gp_flags; + SFGPIO_UNLOCK(sc); + + return (0); +} + +static int +sfgpio_pin_getname(device_t dev, uint32_t pin, char *name) +{ + struct sfgpio_softc *sc; + + sc = device_get_softc(dev); + + if (pin >= sc->npins) + return (EINVAL); + + SFGPIO_LOCK(sc); + memcpy(name, sc->gpio_pins[pin].gp_name, GPIOMAXNAME); + SFGPIO_UNLOCK(sc); + + return (0); +} + +static int +sfgpio_pin_setflags(device_t dev, uint32_t pin, uint32_t flags) +{ + struct sfgpio_softc *sc; + uint32_t reg; + + sc = device_get_softc(dev); + + if (pin >= sc->npins) + return (EINVAL); + + SFGPIO_LOCK(sc); + + reg = SFGPIO_READ(sc, SFGPIO_INPUT_EN); + if (flags & GPIO_PIN_INPUT) { + reg |= (1u << pin); + sc->gpio_pins[pin].gp_flags |= GPIO_PIN_INPUT; + } else { + reg &= ~(1u << pin); + sc->gpio_pins[pin].gp_flags &= ~GPIO_PIN_INPUT; + } + SFGPIO_WRITE(sc, SFGPIO_INPUT_EN, reg); + + reg = SFGPIO_READ(sc, SFGPIO_OUTPUT_EN); + if (flags & GPIO_PIN_OUTPUT) { + reg |= (1u << pin); + sc->gpio_pins[pin].gp_flags |= GPIO_PIN_OUTPUT; + } else { + reg &= ~(1u << pin); + sc->gpio_pins[pin].gp_flags &= ~GPIO_PIN_OUTPUT; + } + SFGPIO_WRITE(sc, SFGPIO_OUTPUT_EN, reg); + + SFGPIO_UNLOCK(sc); + + return (0); +} + +static int +sfgpio_pin_access_32(device_t dev, uint32_t first_pin, uint32_t clear_pins, + uint32_t change_pins, uint32_t *orig_pins) +{ + struct sfgpio_softc *sc; + uint32_t reg; + + if (first_pin != 0) + return (EINVAL); + + sc = device_get_softc(dev); + + SFGPIO_LOCK(sc); + + reg = SFGPIO_READ(sc, SFGPIO_OUTPUT_VAL); + + if (orig_pins != NULL) + /* Only input_val is implicitly masked by input_en */ + *orig_pins = SFGPIO_READ(sc, SFGPIO_INPUT_VAL) | + (reg & SFGPIO_READ(sc, SFGPIO_OUTPUT_EN)); + + if ((clear_pins | change_pins) != 0) + SFGPIO_WRITE(sc, SFGPIO_OUTPUT_VAL, + (reg & ~clear_pins) ^ change_pins); + + SFGPIO_UNLOCK(sc); + + return (0); +} + +static int +sfgpio_pin_config_32(device_t dev, uint32_t first_pin, uint32_t num_pins, + uint32_t *pin_flags) +{ + struct sfgpio_softc *sc; + uint32_t ireg, oreg; + int i; + + sc = device_get_softc(dev); + + if (first_pin != 0 || num_pins > sc->npins) + return (EINVAL); + + SFGPIO_LOCK(sc); + + ireg = SFGPIO_READ(sc, SFGPIO_INPUT_EN); + oreg = SFGPIO_READ(sc, SFGPIO_OUTPUT_EN); + for (i = 0; i < num_pins; ++i) { + if (pin_flags[i] & GPIO_PIN_INPUT) { + ireg |= (1u << i); + oreg &= ~(1u << i); + sc->gpio_pins[i].gp_flags |= GPIO_PIN_INPUT; + sc->gpio_pins[i].gp_flags &= ~GPIO_PIN_OUTPUT; + } else if (pin_flags[i] & GPIO_PIN_OUTPUT) { + ireg &= ~(1u << i); + oreg |= (1u << i); + sc->gpio_pins[i].gp_flags &= ~GPIO_PIN_INPUT; + sc->gpio_pins[i].gp_flags |= GPIO_PIN_OUTPUT; + } + } + SFGPIO_WRITE(sc, SFGPIO_INPUT_EN, ireg); + SFGPIO_WRITE(sc, SFGPIO_OUTPUT_EN, oreg); + + SFGPIO_UNLOCK(sc); + + return (0); +} + +static phandle_t +sfgpio_get_node(device_t bus, device_t dev) +{ + return (ofw_bus_get_node(bus)); +} + +static device_method_t sfgpio_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, sfgpio_probe), + DEVMETHOD(device_attach, sfgpio_attach), + + /* GPIO protocol */ + DEVMETHOD(gpio_get_bus, sfgpio_get_bus), + DEVMETHOD(gpio_pin_max, sfgpio_pin_max), + DEVMETHOD(gpio_pin_set, sfgpio_pin_set), + DEVMETHOD(gpio_pin_get, sfgpio_pin_get), + DEVMETHOD(gpio_pin_toggle, sfgpio_pin_toggle), + DEVMETHOD(gpio_pin_getcaps, sfgpio_pin_getcaps), + DEVMETHOD(gpio_pin_getflags, sfgpio_pin_getflags), + DEVMETHOD(gpio_pin_getname, sfgpio_pin_getname), + DEVMETHOD(gpio_pin_setflags, sfgpio_pin_setflags), + DEVMETHOD(gpio_pin_access_32, sfgpio_pin_access_32), + DEVMETHOD(gpio_pin_config_32, sfgpio_pin_config_32), + + /* ofw_bus interface */ + DEVMETHOD(ofw_bus_get_node, sfgpio_get_node), + + DEVMETHOD_END +}; + +static devclass_t sfgpio_devclass; +DEFINE_CLASS_0(gpio, sfgpio_driver, sfgpio_methods, + sizeof(struct sfgpio_softc)); +EARLY_DRIVER_MODULE(gpio, simplebus, sfgpio_driver, sfgpio_devclass, 0, 0, + BUS_PASS_INTERRUPT + BUS_PASS_ORDER_LATE); +MODULE_DEPEND(sfgpio, gpiobus, 1, 1, 1); From owner-dev-commits-src-all@freebsd.org Sat Aug 7 18:28:25 2021 Return-Path: Delivered-To: dev-commits-src-all@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 6FF3366F2D8; Sat, 7 Aug 2021 18:28:25 +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 4GhrSn1QWdz4ZT1; Sat, 7 Aug 2021 18:28: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 F0FFC25B4B; Sat, 7 Aug 2021 18:28: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 177ISOF4082575; Sat, 7 Aug 2021 18:28:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 177ISOsp082574; Sat, 7 Aug 2021 18:28:24 GMT (envelope-from git) Date: Sat, 7 Aug 2021 18:28:24 GMT Message-Id: <202108071828.177ISOsp082574@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: 262459806433 - main - pci_pci: Support growing windows in bus_adjust_resource for NEW_PCIB 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: 262459806433f838bb2e54cc4733c0887328a170 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Aug 2021 18:28:25 -0000 The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=262459806433f838bb2e54cc4733c0887328a170 commit 262459806433f838bb2e54cc4733c0887328a170 Author: Jessica Clarke AuthorDate: 2021-08-07 18:27:32 +0000 Commit: Jessica Clarke CommitDate: 2021-08-07 18:27:32 +0000 pci_pci: Support growing windows in bus_adjust_resource for NEW_PCIB If we allocate a new window for a bridge rather than reusing an existing one set up by firmware to cover all the devices then the new window only includes the range needed for the first device to allocate the resource. If a request comes in to adjust this resource in order to extend a downstream window for another device then this will fail as the rman doesn't have any space, so we must first grow the bridge's own window. This is needed to support successfully attaching more than one PCI device on SiFive's HiFive Unmatched, which has the following topology: Root Port <---> Bridge <---> Bridge <-+-> Bridge <---> (Unused) (pcib0) (pcib1) (pcib2) | (pcib3) +-> Bridge <---> xHCI | (pcib4) +-> Bridge <---> M.2 E-key | (pcib5) +-> Bridge <---> M.2 M-key | (pcib6) +-> Bridge <---> x16 slot (pcib7) Without this, the xHCI endpoint successfully attaches but NVMe M.2 M-key endpoint fails to attach as, when its adjacent bridge (pcib6) attempts to allocate a window from its parent (pcib2) on the other side of the switch, its parent attempts to grow its own window by calling bus_adjust_resource on its own parent (pcib1) which fails to call the root port device (pcib0) to request more memory to grow its own window. Had the root port been directly connected to the switch without the bridge in the middle then the existing code would have worked, but the extra hop broke it. Reviewed by: jhb MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31035 --- sys/dev/pci/pci_pci.c | 77 +++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 62 insertions(+), 15 deletions(-) diff --git a/sys/dev/pci/pci_pci.c b/sys/dev/pci/pci_pci.c index d6fbb06a61ac..83106eaa455b 100644 --- a/sys/dev/pci/pci_pci.c +++ b/sys/dev/pci/pci_pci.c @@ -148,6 +148,30 @@ static int pci_clear_pcib; SYSCTL_INT(_hw_pci, OID_AUTO, clear_pcib, CTLFLAG_RDTUN, &pci_clear_pcib, 0, "Clear firmware-assigned resources for PCI-PCI bridge I/O windows."); +/* + * Get the corresponding window if this resource from a child device was + * sub-allocated from one of our window resource managers. + */ +static struct pcib_window * +pcib_get_resource_window(struct pcib_softc *sc, int type, struct resource *r) +{ + switch (type) { + case SYS_RES_IOPORT: + if (rman_is_region_manager(r, &sc->io.rman)) + return (&sc->io); + break; + case SYS_RES_MEMORY: + /* Prefetchable resources may live in either memory rman. */ + if (rman_get_flags(r) & RF_PREFETCHABLE && + rman_is_region_manager(r, &sc->pmem.rman)) + return (&sc->pmem); + if (rman_is_region_manager(r, &sc->mem.rman)) + return (&sc->mem); + break; + } + return (NULL); +} + /* * Is a resource from a child device sub-allocated from one of our * resource managers? @@ -156,21 +180,11 @@ static int pcib_is_resource_managed(struct pcib_softc *sc, int type, struct resource *r) { - switch (type) { #ifdef PCI_RES_BUS - case PCI_RES_BUS: + if (type == PCI_RES_BUS) return (rman_is_region_manager(r, &sc->bus.rman)); #endif - case SYS_RES_IOPORT: - return (rman_is_region_manager(r, &sc->io.rman)); - case SYS_RES_MEMORY: - /* Prefetchable resources may live in either memory rman. */ - if (rman_get_flags(r) & RF_PREFETCHABLE && - rman_is_region_manager(r, &sc->pmem.rman)) - return (1); - return (rman_is_region_manager(r, &sc->mem.rman)); - } - return (0); + return (pcib_get_resource_window(sc, type, r) != NULL); } static int @@ -2330,11 +2344,44 @@ pcib_adjust_resource(device_t bus, device_t child, int type, struct resource *r, rman_res_t start, rman_res_t end) { struct pcib_softc *sc; + struct pcib_window *w; + int error; sc = device_get_softc(bus); - if (pcib_is_resource_managed(sc, type, r)) - return (rman_adjust_resource(r, start, end)); - return (bus_generic_adjust_resource(bus, child, type, r, start, end)); + + /* + * If the resource wasn't sub-allocated from one of our region + * managers then just pass the request up. + */ + if (!pcib_is_resource_managed(sc, type, r)) + return (bus_generic_adjust_resource(bus, child, type, r, + start, end)); + +#ifdef PCI_RES_BUS + if (type != PCI_RES_BUS) +#endif + { + /* + * Resource is managed and not a secondary bus number, must + * be from one of our windows. + */ + w = pcib_get_resource_window(sc, type, r); + KASSERT(w != NULL, + ("%s: no window for resource (%#jx-%#jx) type %d", + __func__, rman_get_start(r), rman_get_end(r), type)); + + /* + * If our window isn't big enough to grow the sub-allocation + * then we need to expand the window. + */ + if (start < w->base || end > w->limit) { + error = pcib_expand_window(sc, w, type, start, end); + if (error != 0) + return (error); + } + } + + return (rman_adjust_resource(r, start, end)); } int From owner-dev-commits-src-all@freebsd.org Sat Aug 7 18:28:24 2021 Return-Path: Delivered-To: dev-commits-src-all@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 4C28066F2CC; Sat, 7 Aug 2021 18:28: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 4GhrSm0jrLz4ZQ5; Sat, 7 Aug 2021 18:28: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 DA7C725B4A; Sat, 7 Aug 2021 18:28: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 177ISNeO082551; Sat, 7 Aug 2021 18:28:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 177ISN4K082550; Sat, 7 Aug 2021 18:28:23 GMT (envelope-from git) Date: Sat, 7 Aug 2021 18:28:23 GMT Message-Id: <202108071828.177ISN4K082550@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: 896e217a0eae - main - fu740_pci_dw: Add SiFive FU740 PCIe controller driver 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: 896e217a0eae692b1fe3de5d1354478541fb13ff Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Aug 2021 18:28:24 -0000 The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=896e217a0eae692b1fe3de5d1354478541fb13ff commit 896e217a0eae692b1fe3de5d1354478541fb13ff Author: Jessica Clarke AuthorDate: 2021-08-07 18:27:31 +0000 Commit: Jessica Clarke CommitDate: 2021-08-07 18:27:31 +0000 fu740_pci_dw: Add SiFive FU740 PCIe controller driver Reviewed by: mhorne MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31033 --- sys/conf/files.riscv | 2 + sys/riscv/conf/GENERIC | 1 + sys/riscv/sifive/files.sifive | 1 + sys/riscv/sifive/fu740_pci_dw.c | 465 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 469 insertions(+) diff --git a/sys/conf/files.riscv b/sys/conf/files.riscv index cf7b58bfe4e3..d46d520bd0b7 100644 --- a/sys/conf/files.riscv +++ b/sys/conf/files.riscv @@ -5,6 +5,8 @@ cddl/dev/fbt/riscv/fbt_isa.c optional dtrace_fbt | dtraceall compile-with "${ crypto/des/des_enc.c optional netsmb dev/ofw/ofw_cpu.c optional fdt dev/ofw/ofw_pcib.c optional pci fdt +dev/pci/pci_dw.c optional pci fdt +dev/pci/pci_dw_if.m optional pci fdt dev/pci/pci_host_generic.c optional pci dev/pci/pci_host_generic_fdt.c optional pci fdt dev/uart/uart_cpu_fdt.c optional uart fdt diff --git a/sys/riscv/conf/GENERIC b/sys/riscv/conf/GENERIC index 360d6b163d45..09882853ada2 100644 --- a/sys/riscv/conf/GENERIC +++ b/sys/riscv/conf/GENERIC @@ -177,6 +177,7 @@ options FDT makeoptions MODULES_EXTRA+="dtb/sifive" # SiFive device drivers +device fu740_pci_dw device sifive_gpio device sifive_spi include "../sifive/std.sifive" diff --git a/sys/riscv/sifive/files.sifive b/sys/riscv/sifive/files.sifive index 9ea71c4fcd27..f38bacb48e3b 100644 --- a/sys/riscv/sifive/files.sifive +++ b/sys/riscv/sifive/files.sifive @@ -1,6 +1,7 @@ # $FreeBSD$ riscv/sifive/fe310_aon.c optional fe310aon +riscv/sifive/fu740_pci_dw.c optional fu740_pci_dw pci fdt riscv/sifive/sifive_gpio.c optional sifive_gpio gpio riscv/sifive/sifive_prci.c standard riscv/sifive/sifive_spi.c optional sifive_spi spibus diff --git a/sys/riscv/sifive/fu740_pci_dw.c b/sys/riscv/sifive/fu740_pci_dw.c new file mode 100644 index 000000000000..fbb62cc44e65 --- /dev/null +++ b/sys/riscv/sifive/fu740_pci_dw.c @@ -0,0 +1,465 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright 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. + * + */ + +/* SiFive FU740 DesignWare PCIe driver */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "pcib_if.h" +#include "pci_dw_if.h" + +#define FUDW_PHYS 2 +#define FUDW_LANES_PER_PHY 4 + +#define FUDW_MGMT_PERST_N 0x0 +#define FUDW_MGMT_LTSSM_EN 0x10 +#define FUDW_MGMT_HOLD_PHY_RST 0x18 +#define FUDW_MGMT_DEVICE_TYPE 0x708 +#define FUDW_MGMT_DEVICE_TYPE_RC 0x4 +#define FUDW_MGMT_PHY_CR_PARA_REG(_n, _r) \ + (0x860 + (_n) * 0x40 + FUDW_MGMT_PHY_CR_PARA_##_r) +#define FUDW_MGMT_PHY_CR_PARA_ADDR 0x0 +#define FUDW_MGMT_PHY_CR_PARA_READ_EN 0x10 +#define FUDW_MGMT_PHY_CR_PARA_READ_DATA 0x18 +#define FUDW_MGMT_PHY_CR_PARA_SEL 0x20 +#define FUDW_MGMT_PHY_CR_PARA_WRITE_DATA 0x28 +#define FUDW_MGMT_PHY_CR_PARA_WRITE_EN 0x30 +#define FUDW_MGMT_PHY_CR_PARA_ACK 0x38 + +#define FUDW_MGMT_PHY_LANE(_n) (0x1008 + (_n) * 0x100) +#define FUDW_MGMT_PHY_LANE_CDR_TRACK_EN (1 << 0) +#define FUDW_MGMT_PHY_LANE_LOS_THRESH (1 << 5) +#define FUDW_MGMT_PHY_LANE_TERM_EN (1 << 9) +#define FUDW_MGMT_PHY_LANE_TERM_ACDC (1 << 10) +#define FUDW_MGMT_PHY_LANE_EN (1 << 11) +#define FUDW_MGMT_PHY_LANE_INIT \ + (FUDW_MGMT_PHY_LANE_CDR_TRACK_EN | FUDW_MGMT_PHY_LANE_LOS_THRESH | \ + FUDW_MGMT_PHY_LANE_TERM_EN | FUDW_MGMT_PHY_LANE_TERM_ACDC | \ + FUDW_MGMT_PHY_LANE_EN) + +#define FUDW_DBI_PORT_DBG1 0x72c +#define FUDW_DBI_PORT_DBG1_LINK_UP (1 << 4) +#define FUDW_DBI_PORT_DBG1_LINK_IN_TRAINING (1 << 29) + +struct fupci_softc { + struct pci_dw_softc dw_sc; + device_t dev; + struct resource *mgmt_res; + gpio_pin_t porst_pin; + gpio_pin_t pwren_pin; + clk_t pcie_aux_clk; + hwreset_t pcie_aux_rst; +}; + +#define FUDW_MGMT_READ(_sc, _o) bus_read_4((_sc)->mgmt_res, (_o)) +#define FUDW_MGMT_WRITE(_sc, _o, _v) bus_write_4((_sc)->mgmt_res, (_o), (_v)) + +static struct ofw_compat_data compat_data[] = { + { "sifive,fu740-pcie", 1 }, + { NULL, 0 }, +}; + +/* Currently unused; included for completeness */ +static int __unused +fupci_phy_read(struct fupci_softc *sc, int phy, uint32_t reg, uint32_t *val) +{ + unsigned timeout; + uint32_t ack; + + FUDW_MGMT_WRITE(sc, FUDW_MGMT_PHY_CR_PARA_REG(phy, ADDR), reg); + FUDW_MGMT_WRITE(sc, FUDW_MGMT_PHY_CR_PARA_REG(phy, READ_EN), 1); + + timeout = 10; + do { + ack = FUDW_MGMT_READ(sc, FUDW_MGMT_PHY_CR_PARA_REG(phy, ACK)); + if (ack != 0) + break; + DELAY(10); + } while (--timeout > 0); + + if (timeout == 0) { + device_printf(sc->dev, "Timeout waiting for read ACK\n"); + return (ETIMEDOUT); + } + + *val = FUDW_MGMT_READ(sc, FUDW_MGMT_PHY_CR_PARA_REG(phy, READ_DATA)); + FUDW_MGMT_WRITE(sc, FUDW_MGMT_PHY_CR_PARA_REG(phy, READ_EN), 0); + + timeout = 10; + do { + ack = FUDW_MGMT_READ(sc, FUDW_MGMT_PHY_CR_PARA_REG(phy, ACK)); + if (ack == 0) + break; + DELAY(10); + } while (--timeout > 0); + + if (timeout == 0) { + device_printf(sc->dev, "Timeout waiting for read un-ACK\n"); + return (ETIMEDOUT); + } + + return (0); +} + +static int +fupci_phy_write(struct fupci_softc *sc, int phy, uint32_t reg, uint32_t val) +{ + unsigned timeout; + uint32_t ack; + + FUDW_MGMT_WRITE(sc, FUDW_MGMT_PHY_CR_PARA_REG(phy, ADDR), reg); + FUDW_MGMT_WRITE(sc, FUDW_MGMT_PHY_CR_PARA_REG(phy, WRITE_DATA), val); + FUDW_MGMT_WRITE(sc, FUDW_MGMT_PHY_CR_PARA_REG(phy, WRITE_EN), 1); + + timeout = 10; + do { + ack = FUDW_MGMT_READ(sc, FUDW_MGMT_PHY_CR_PARA_REG(phy, ACK)); + if (ack != 0) + break; + DELAY(10); + } while (--timeout > 0); + + if (timeout == 0) { + device_printf(sc->dev, "Timeout waiting for write ACK\n"); + return (ETIMEDOUT); + } + + FUDW_MGMT_WRITE(sc, FUDW_MGMT_PHY_CR_PARA_REG(phy, WRITE_EN), 0); + + timeout = 10; + do { + ack = FUDW_MGMT_READ(sc, FUDW_MGMT_PHY_CR_PARA_REG(phy, ACK)); + if (ack == 0) + break; + DELAY(10); + } while (--timeout > 0); + + if (timeout == 0) { + device_printf(sc->dev, "Timeout waiting for write un-ACK\n"); + return (ETIMEDOUT); + } + + return (0); +} + +static int +fupci_phy_init(struct fupci_softc *sc) +{ + device_t dev; + int error, phy, lane; + + dev = sc->dev; + + /* Assert core power-on reset (active low) */ + error = gpio_pin_set_active(sc->porst_pin, false); + if (error != 0) { + device_printf(dev, "Cannot assert power-on reset: %d\n", + error); + return (error); + } + + /* Assert PERST_N */ + FUDW_MGMT_WRITE(sc, FUDW_MGMT_PERST_N, 0); + + /* Enable power */ + error = gpio_pin_set_active(sc->pwren_pin, true); + if (error != 0) { + device_printf(dev, "Cannot enable power: %d\n", error); + return (error); + } + + /* Hold PERST for 100ms as per the PCIe spec */ + DELAY(100); + + /* Deassert PERST_N */ + FUDW_MGMT_WRITE(sc, FUDW_MGMT_PERST_N, 1); + + /* Deassert core power-on reset (active low) */ + error = gpio_pin_set_active(sc->porst_pin, true); + if (error != 0) { + device_printf(dev, "Cannot deassert power-on reset: %d\n", + error); + return (error); + } + + /* Enable the aux clock */ + error = clk_enable(sc->pcie_aux_clk); + if (error != 0) { + device_printf(dev, "Cannot enable aux clock: %d\n", error); + return (error); + } + + /* Hold LTSSM in reset whilst initialising the PHYs */ + FUDW_MGMT_WRITE(sc, FUDW_MGMT_HOLD_PHY_RST, 1); + + /* Deassert the aux reset */ + error = hwreset_deassert(sc->pcie_aux_rst); + if (error != 0) { + device_printf(dev, "Cannot deassert aux reset: %d\n", error); + return (error); + } + + /* Enable control register interface */ + for (phy = 0; phy < FUDW_PHYS; ++phy) + FUDW_MGMT_WRITE(sc, FUDW_MGMT_PHY_CR_PARA_REG(phy, SEL), 1); + + /* Wait for enable to take effect */ + DELAY(1); + + /* Initialise lane configuration */ + for (phy = 0; phy < FUDW_PHYS; ++phy) { + for (lane = 0; lane < FUDW_LANES_PER_PHY; ++lane) + fupci_phy_write(sc, phy, FUDW_MGMT_PHY_LANE(lane), + FUDW_MGMT_PHY_LANE_INIT); + } + + /* Disable the aux clock whilst taking the LTSSM out of reset */ + error = clk_disable(sc->pcie_aux_clk); + if (error != 0) { + device_printf(dev, "Cannot disable aux clock: %d\n", error); + return (error); + } + + /* Take LTSSM out of reset */ + FUDW_MGMT_WRITE(sc, FUDW_MGMT_HOLD_PHY_RST, 0); + + /* Enable the aux clock again */ + error = clk_enable(sc->pcie_aux_clk); + if (error != 0) { + device_printf(dev, "Cannot re-enable aux clock: %d\n", error); + return (error); + } + + /* Put the controller in Root Complex mode */ + FUDW_MGMT_WRITE(sc, FUDW_MGMT_DEVICE_TYPE, FUDW_MGMT_DEVICE_TYPE_RC); + + return (0); +} + +static void +fupci_dbi_protect(struct fupci_softc *sc, bool protect) +{ + uint32_t reg; + + reg = pci_dw_dbi_rd4(sc->dev, DW_MISC_CONTROL_1); + if (protect) + reg &= ~DBI_RO_WR_EN; + else + reg |= DBI_RO_WR_EN; + pci_dw_dbi_wr4(sc->dev, DW_MISC_CONTROL_1, reg); +} + +static int +fupci_init(struct fupci_softc *sc) +{ + /* Enable 32-bit I/O window */ + fupci_dbi_protect(sc, false); + pci_dw_dbi_wr2(sc->dev, PCIR_IOBASEL_1, + (PCIM_BRIO_32 << 8) | PCIM_BRIO_32); + fupci_dbi_protect(sc, true); + + /* Enable LTSSM */ + FUDW_MGMT_WRITE(sc, FUDW_MGMT_LTSSM_EN, 1); + + return (0); +} + +static int +fupci_probe(device_t dev) +{ + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) + return (ENXIO); + + device_set_desc(dev, "SiFive FU740 PCIe Controller"); + + return (BUS_PROBE_DEFAULT); +} + +static int +fupci_attach(device_t dev) +{ + struct fupci_softc *sc; + phandle_t node; + int error, rid; + + sc = device_get_softc(dev); + node = ofw_bus_get_node(dev); + sc->dev = dev; + + rid = 0; + error = ofw_bus_find_string_index(node, "reg-names", "dbi", &rid); + if (error != 0) { + device_printf(dev, "Cannot get DBI memory: %d\n", error); + goto fail; + } + sc->dw_sc.dbi_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, + RF_ACTIVE); + if (sc->dw_sc.dbi_res == NULL) { + device_printf(dev, "Cannot allocate DBI memory\n"); + error = ENXIO; + goto fail; + } + + rid = 0; + error = ofw_bus_find_string_index(node, "reg-names", "mgmt", &rid); + if (error != 0) { + device_printf(dev, "Cannot get management space memory: %d\n", + error); + goto fail; + } + sc->mgmt_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, + RF_ACTIVE); + if (sc->mgmt_res == NULL) { + device_printf(dev, "Cannot allocate management space memory\n"); + error = ENXIO; + goto fail; + } + + error = gpio_pin_get_by_ofw_property(dev, node, "reset-gpios", + &sc->porst_pin); + /* Old U-Boot device tree uses perstn-gpios */ + if (error == ENOENT) + error = gpio_pin_get_by_ofw_property(dev, node, "perstn-gpios", + &sc->porst_pin); + if (error != 0) { + device_printf(dev, "Cannot get power-on reset GPIO: %d\n", + error); + goto fail; + } + error = gpio_pin_setflags(sc->porst_pin, GPIO_PIN_OUTPUT); + if (error != 0) { + device_printf(dev, "Cannot configure power-on reset GPIO: %d\n", + error); + goto fail; + } + + error = gpio_pin_get_by_ofw_property(dev, node, "pwren-gpios", + &sc->pwren_pin); + if (error != 0) { + device_printf(dev, "Cannot get power enable GPIO: %d\n", + error); + goto fail; + } + error = gpio_pin_setflags(sc->pwren_pin, GPIO_PIN_OUTPUT); + if (error != 0) { + device_printf(dev, "Cannot configure power enable GPIO: %d\n", + error); + goto fail; + } + + error = clk_get_by_ofw_name(dev, node, "pcie_aux", &sc->pcie_aux_clk); + /* Old U-Boot device tree uses pcieaux */ + if (error == ENOENT) + error = clk_get_by_ofw_name(dev, node, "pcieaux", + &sc->pcie_aux_clk); + if (error != 0) { + device_printf(dev, "Cannot get aux clock: %d\n", error); + goto fail; + } + + error = hwreset_get_by_ofw_idx(dev, node, 0, &sc->pcie_aux_rst); + if (error != 0) { + device_printf(dev, "Cannot get aux reset: %d\n", error); + goto fail; + } + + error = fupci_phy_init(sc); + if (error != 0) + goto fail; + + error = pci_dw_init(dev); + if (error != 0) + goto fail; + + error = fupci_init(sc); + if (error != 0) + goto fail; + + return (bus_generic_attach(dev)); + +fail: + /* XXX Cleanup */ + return (error); +} + +static int +fupci_get_link(device_t dev, bool *status) +{ + uint32_t reg; + + reg = pci_dw_dbi_rd4(dev, FUDW_DBI_PORT_DBG1); + *status = (reg & FUDW_DBI_PORT_DBG1_LINK_UP) != 0 && + (reg & FUDW_DBI_PORT_DBG1_LINK_IN_TRAINING) == 0; + + return (0); +} + +static device_method_t fupci_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, fupci_probe), + DEVMETHOD(device_attach, fupci_attach), + + /* PCI DW interface */ + DEVMETHOD(pci_dw_get_link, fupci_get_link), + + DEVMETHOD_END +}; + +DEFINE_CLASS_1(pcib, fupci_driver, fupci_methods, + sizeof(struct fupci_softc), pci_dw_driver); +static devclass_t fupci_devclass; +DRIVER_MODULE(fu740_pci_dw, simplebus, fupci_driver, fupci_devclass, + NULL, NULL); From owner-dev-commits-src-all@freebsd.org Sat Aug 7 18:28:26 2021 Return-Path: Delivered-To: dev-commits-src-all@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 85CFC66F2DE; Sat, 7 Aug 2021 18:28: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 4GhrSp2KMRz4ZVx; Sat, 7 Aug 2021 18:28: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 22C3825D59; Sat, 7 Aug 2021 18:28: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 177ISQh4082599; Sat, 7 Aug 2021 18:28:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 177ISQja082598; Sat, 7 Aug 2021 18:28:26 GMT (envelope-from git) Date: Sat, 7 Aug 2021 18:28:26 GMT Message-Id: <202108071828.177ISQja082598@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: 6e162bd2f298 - main - riscv: Add NVMe, USB and HID support to GENERIC 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: 6e162bd2f298b58a418a17d49f5671a9a113fc4e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Aug 2021 18:28:26 -0000 The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=6e162bd2f298b58a418a17d49f5671a9a113fc4e commit 6e162bd2f298b58a418a17d49f5671a9a113fc4e Author: Jessica Clarke AuthorDate: 2021-08-07 18:27:33 +0000 Commit: Jessica Clarke CommitDate: 2021-08-07 18:27:33 +0000 riscv: Add NVMe, USB and HID support to GENERIC The SiFive FU740 has both NVMe and USB so we need both to ensure we can mount root, and HID is a dependency of USB. Reviewed by: kp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31036 --- sys/riscv/conf/GENERIC | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/sys/riscv/conf/GENERIC b/sys/riscv/conf/GENERIC index 09882853ada2..ae7f1c166273 100644 --- a/sys/riscv/conf/GENERIC +++ b/sys/riscv/conf/GENERIC @@ -90,6 +90,10 @@ device riscv_syscon # Bus drivers device pci +# Block devices +device scbus +device da + # VirtIO support device virtio # Generic VirtIO bus (required) device virtio_pci # VirtIO PCI device @@ -97,6 +101,25 @@ device vtnet # VirtIO Ethernet device device virtio_blk # VirtIO Block device device virtio_mmio # VirtIO MMIO bus +# NVM Express (NVMe) support +device nvme # base NVMe driver +options NVME_USE_NVD=0 # prefer the cam(4) based nda(4) driver +device nvd # expose NVMe namespaces as disks, depends on nvme + +# USB support +options USB_DEBUG # enable debug msgs +device ohci # OHCI USB interface +device uhci # UHCI USB interface +device ehci # EHCI USB interface (USB 2.0) +device xhci # XHCI USB interface (USB 3.0) +device usb # USB Bus (required) +device ukbd # Keyboard +device umass # Disks/Mass storage - Requires scbus and da + +# HID support +options HID_DEBUG # enable debug msgs +device hid # Generic HID support + # DTrace support # device dtrace # device dtrace_profile From owner-dev-commits-src-all@freebsd.org Sat Aug 7 18:31:38 2021 Return-Path: Delivered-To: dev-commits-src-all@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 97DF766F944; Sat, 7 Aug 2021 18:31: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 4GhrXV3wGWz4bLq; Sat, 7 Aug 2021 18:31:38 +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 6EC6B25FAF; Sat, 7 Aug 2021 18:31: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 177IVcvU091892; Sat, 7 Aug 2021 18:31:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 177IVcwl091891; Sat, 7 Aug 2021 18:31:38 GMT (envelope-from git) Date: Sat, 7 Aug 2021 18:31:38 GMT Message-Id: <202108071831.177IVcwl091891@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: 5668a155cbe6 - main - gpio.4: Mention new sifive_gpio driver 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: 5668a155cbe6cef802bc95666477a440fdb6f606 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Aug 2021 18:31:38 -0000 The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=5668a155cbe6cef802bc95666477a440fdb6f606 commit 5668a155cbe6cef802bc95666477a440fdb6f606 Author: Jessica Clarke AuthorDate: 2021-08-07 18:31:34 +0000 Commit: Jessica Clarke CommitDate: 2021-08-07 18:31:34 +0000 gpio.4: Mention new sifive_gpio driver Suggested by: mhorne MFC after: 1 week --- share/man/man4/gpio.4 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/share/man/man4/gpio.4 b/share/man/man4/gpio.4 index da95c39f8e98..276d6855b49b 100644 --- a/share/man/man4/gpio.4 +++ b/share/man/man4/gpio.4 @@ -72,6 +72,13 @@ architecture include: .Cd "device wiigpio" .Cd "device macgpio" .Ed +.Pp +Additional device entries for the +.Li RISC-V +architecture include: +.Bd -ragged -offset indent +.Cd "device sifive_gpio" +.Ed .Sh DESCRIPTION The .Nm From owner-dev-commits-src-all@freebsd.org Sat Aug 7 20:26:27 2021 Return-Path: Delivered-To: dev-commits-src-all@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 33F41670B46; Sat, 7 Aug 2021 20:26: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 4Ghv4z0nSpz4h7r; Sat, 7 Aug 2021 20:26: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 0336C27828; Sat, 7 Aug 2021 20:26: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 177KQQMk042105; Sat, 7 Aug 2021 20:26:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 177KQQLA042104; Sat, 7 Aug 2021 20:26:26 GMT (envelope-from git) Date: Sat, 7 Aug 2021 20:26:26 GMT Message-Id: <202108072026.177KQQLA042104@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: 22997b755013 - main - pci_dw: Drop unconditional explicit DEBUG define 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: 22997b755013bdde60119fdc781769192ab7e1e0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Aug 2021 20:26:27 -0000 The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=22997b755013bdde60119fdc781769192ab7e1e0 commit 22997b755013bdde60119fdc781769192ab7e1e0 Author: Jessica Clarke AuthorDate: 2021-08-07 20:25:36 +0000 Commit: Jessica Clarke CommitDate: 2021-08-07 20:25:36 +0000 pci_dw: Drop unconditional explicit DEBUG define This has been present since the first revision of the file. The debugf macros have always been unused so it doesn't actually do anything useful, and besides, debugging should not be unconditionally turned on for a production driver. Moreover, this breaks the riscv LINT kernel build as sys/conf/NOTES includes options DEBUG, resulting in a macro redefinition error. This does not show up in the arm64 LINT kernel build since that has an explicit nooptions DEBUG, which is dubious and should be revisited. Rather than copy such a hack to riscv's NOTES, fix this specific instance of DEBUG breaking. Fixes: 896e217a0eae ("fu740_pci_dw: Add SiFive FU740 PCIe controller driver") MFC after: 1 week --- sys/dev/pci/pci_dw.c | 1 - 1 file changed, 1 deletion(-) diff --git a/sys/dev/pci/pci_dw.c b/sys/dev/pci/pci_dw.c index 9eb7b04dfd28..e31779b2bea1 100644 --- a/sys/dev/pci/pci_dw.c +++ b/sys/dev/pci/pci_dw.c @@ -59,7 +59,6 @@ __FBSDID("$FreeBSD$"); #include "pcib_if.h" #include "pci_dw_if.h" -#define DEBUG #ifdef DEBUG #define debugf(fmt, args...) do { printf(fmt,##args); } while (0) #else From owner-dev-commits-src-all@freebsd.org Sat Aug 7 22:21:01 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A784D672A85; Sat, 7 Aug 2021 22:21: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 4Ghxd94PT2z4n5f; Sat, 7 Aug 2021 22:21: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 7EFE5ED1; Sat, 7 Aug 2021 22:21: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 177ML1J9099509; Sat, 7 Aug 2021 22:21:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 177ML1nw099508; Sat, 7 Aug 2021 22:21:01 GMT (envelope-from git) Date: Sat, 7 Aug 2021 22:21:01 GMT Message-Id: <202108072221.177ML1nw099508@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: 0a4cb54506e3 - main - riscv: Add hwreset to NOTES to fix LINT build 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: 0a4cb54506e3e2c0d911ddd12416eb2fdc6a7bd7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Aug 2021 22:21:01 -0000 The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=0a4cb54506e3e2c0d911ddd12416eb2fdc6a7bd7 commit 0a4cb54506e3e2c0d911ddd12416eb2fdc6a7bd7 Author: Jessica Clarke AuthorDate: 2021-08-07 22:15:20 +0000 Commit: Jessica Clarke CommitDate: 2021-08-07 22:15:20 +0000 riscv: Add hwreset to NOTES to fix LINT build Fixes: 8e7e0690ecd7 ("sifive_prci: Add reset support for the FU540 and FU740") MFC after: 1 week --- sys/riscv/conf/NOTES | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/riscv/conf/NOTES b/sys/riscv/conf/NOTES index 0a067ab19d34..a99567ac16a5 100644 --- a/sys/riscv/conf/NOTES +++ b/sys/riscv/conf/NOTES @@ -26,6 +26,7 @@ device rcons # EXT_RESOURCES pseudo devices options EXT_RESOURCES device clk +device hwreset device phy device regulator device syscon From owner-dev-commits-src-all@freebsd.org Sat Aug 7 22:21:02 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C5E876725EC; Sat, 7 Aug 2021 22:21: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 4GhxdB5DWpz4n3g; Sat, 7 Aug 2021 22:21: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 9ADB8ED5; Sat, 7 Aug 2021 22:21: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 177ML2It099533; Sat, 7 Aug 2021 22:21:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 177ML2H9099532; Sat, 7 Aug 2021 22:21:02 GMT (envelope-from git) Date: Sat, 7 Aug 2021 22:21:02 GMT Message-Id: <202108072221.177ML2H9099532@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: c5e5202a3d5d - main - riscv: Sync NOTES with GENERIC changes 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: c5e5202a3d5d6b7d47a6da7b678bc5c4320c91e9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Aug 2021 22:21:02 -0000 The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=c5e5202a3d5d6b7d47a6da7b678bc5c4320c91e9 commit c5e5202a3d5d6b7d47a6da7b678bc5c4320c91e9 Author: Jessica Clarke AuthorDate: 2021-08-07 22:20:38 +0000 Commit: Jessica Clarke CommitDate: 2021-08-07 22:20:38 +0000 riscv: Sync NOTES with GENERIC changes USB is already in sys/conf/NOTES, but NVMe is not, nor of course are the new SiFive device drivers. MFC after: 1 week --- sys/riscv/conf/NOTES | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sys/riscv/conf/NOTES b/sys/riscv/conf/NOTES index a99567ac16a5..7dda89bfe1a8 100644 --- a/sys/riscv/conf/NOTES +++ b/sys/riscv/conf/NOTES @@ -44,6 +44,11 @@ device virtio_blk # VirtIO Block device device virtio_mmio # VirtIO MMIO bus device virtio_random # VirtIO Entropy device +# NVM Express (NVMe) support +device nvme # base NVMe driver +options NVME_USE_NVD=0 # prefer the cam(4) based nda(4) driver +device nvd # expose NVMe namespaces as disks, depends on nvme + # NOTE: dtrace introduces CDDL-licensed components into the kernel device dtrace # dtrace core device dtraceall # include all dtrace modules @@ -65,8 +70,10 @@ device axidma # Xilinx AXI DMA Controller # SPI device xilinx_spi # Xilinx AXI Quad-SPI Controller -# SOC-specific +# SiFive device drivers device fe310aon +device fu740_pci_dw +device sifive_gpio device sifive_spi files "../sifive/files.sifive" From owner-dev-commits-src-all@freebsd.org Sun Aug 8 00:26:35 2021 Return-Path: Delivered-To: dev-commits-src-all@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 628166744B3; Sun, 8 Aug 2021 00:26: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 4Gj0Q31yVsz4vFb; Sun, 8 Aug 2021 00:26: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 26FCB2D2D; Sun, 8 Aug 2021 00:26: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 1780QZh4062874; Sun, 8 Aug 2021 00:26:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1780QZDM062873; Sun, 8 Aug 2021 00:26:35 GMT (envelope-from git) Date: Sun, 8 Aug 2021 00:26:35 GMT Message-Id: <202108080026.1780QZDM062873@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: fe52b7f60ef4 - main - Disable PROFILE option by default 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: fe52b7f60ef46b65b24d7810a07be04483299d89 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Aug 2021 00:26:35 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=fe52b7f60ef46b65b24d7810a07be04483299d89 commit fe52b7f60ef46b65b24d7810a07be04483299d89 Author: Ed Maste AuthorDate: 2020-01-16 17:40:32 +0000 Commit: Ed Maste CommitDate: 2021-08-08 00:24:36 +0000 Disable PROFILE option by default Hardware based profiling (e.g. hwpmc) is much better and produces more useful results. Today the profiling lib archives (_p.a) serve no real purpose other than increasing the library build time. Both upstream and base system (in commit b762974cf4b9) Clang have been modified to remove the special case for linking against these libraries. Clang's -pg support and mcount() remain, so building with -pg can still be used on code that the user builds; we just no longer provide prebuilt libraries compiled with -pg. Discussed on freebsd-hackers[1] / freebsd-current [2] in 2020 and freebsd-arch [3] in 2021. A deprecation notice was added in commit 175841285e28. [1] https://lists.freebsd.org/pipermail/freebsd-hackers/2020-January/055551.html [2] https://lists.freebsd.org/pipermail/freebsd-current/2020-January/075105.html [3] https://lists.freebsd.org/archives/freebsd-arch/2021-June/000016.html PR: 256873 [exp-run] Reviewed by: imp, jhb, kib Relnotes: Yes Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30833 --- share/mk/bsd.opts.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/mk/bsd.opts.mk b/share/mk/bsd.opts.mk index 6e81484a09ab..2504e5038d6e 100644 --- a/share/mk/bsd.opts.mk +++ b/share/mk/bsd.opts.mk @@ -61,7 +61,6 @@ __DEFAULT_YES_OPTIONS = \ NIS \ NLS \ OPENSSH \ - PROFILE \ SSP \ TESTS \ TOOLCHAIN \ @@ -77,6 +76,7 @@ __DEFAULT_NO_OPTIONS = \ INIT_ALL_ZERO \ INSTALL_AS_USER \ MANSPLITPKG \ + PROFILE \ RETPOLINE \ STALE_STAGED \ UBSAN From owner-dev-commits-src-all@freebsd.org Sun Aug 8 00:31:02 2021 Return-Path: Delivered-To: dev-commits-src-all@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 55BF66741D6; Sun, 8 Aug 2021 00:31: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 4Gj0WB23jtz4vjK; Sun, 8 Aug 2021 00:31: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 2F00427CF; Sun, 8 Aug 2021 00:31: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 1780V23R072329; Sun, 8 Aug 2021 00:31:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1780V2WT072328; Sun, 8 Aug 2021 00:31:02 GMT (envelope-from git) Date: Sun, 8 Aug 2021 00:31:02 GMT Message-Id: <202108080031.1780V2WT072328@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: 3e5bff102b4b - main - bsdinstall: Remove unused sysctl.h header #include 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: 3e5bff102b4bd09962b0f735217635cb513d53a3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Aug 2021 00:31:02 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=3e5bff102b4bd09962b0f735217635cb513d53a3 commit 3e5bff102b4bd09962b0f735217635cb513d53a3 Author: Ed Maste AuthorDate: 2021-05-19 16:28:47 +0000 Commit: Ed Maste CommitDate: 2021-08-08 00:30:29 +0000 bsdinstall: Remove unused sysctl.h header #include --- usr.sbin/bsdinstall/partedit/part_wizard.c | 1 - 1 file changed, 1 deletion(-) diff --git a/usr.sbin/bsdinstall/partedit/part_wizard.c b/usr.sbin/bsdinstall/partedit/part_wizard.c index 9f7158a4801e..52c5d7f649cc 100644 --- a/usr.sbin/bsdinstall/partedit/part_wizard.c +++ b/usr.sbin/bsdinstall/partedit/part_wizard.c @@ -29,7 +29,6 @@ */ #include -#include #include #include #include From owner-dev-commits-src-all@freebsd.org Sun Aug 8 00:52:37 2021 Return-Path: Delivered-To: dev-commits-src-all@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 5F710674C1E; Sun, 8 Aug 2021 00:52:37 +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 4Gj10527JMz3Cc0; Sun, 8 Aug 2021 00:52: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 314952F34; Sun, 8 Aug 2021 00:52: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 1780qbol002665; Sun, 8 Aug 2021 00:52:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1780qbGh002664; Sun, 8 Aug 2021 00:52:37 GMT (envelope-from git) Date: Sun, 8 Aug 2021 00:52:37 GMT Message-Id: <202108080052.1780qbGh002664@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: b0dafb1b6f35 - main - src.conf.5: Regen after fe52b7f60ef4, PROFILE default off 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: b0dafb1b6f352a90cf164210598e778ecedaea48 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Aug 2021 00:52:37 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=b0dafb1b6f352a90cf164210598e778ecedaea48 commit b0dafb1b6f352a90cf164210598e778ecedaea48 Author: Ed Maste AuthorDate: 2021-08-08 00:51:44 +0000 Commit: Ed Maste CommitDate: 2021-08-08 00:51:44 +0000 src.conf.5: Regen after fe52b7f60ef4, PROFILE default off --- share/man/man5/src.conf.5 | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/share/man/man5/src.conf.5 b/share/man/man5/src.conf.5 index 658161f65d2f..60f2f0af02aa 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 July 27, 2021 +.Dd August 7, 2021 .Dt SRC.CONF 5 .Os .Sh NAME @@ -1348,20 +1348,11 @@ and related files. Do not build .Xr ppp 8 and related programs. -.It Va WITHOUT_PROFILE -Do not build profiled libraries for use with -.Xr gprof 8 . -.Pp -This is a default setting on -mips/mips64. .It Va WITH_PROFILE Build profiled libraries for use with .Xr gprof 8 . This option is deprecated and is not present in .Fx 14 . -.Pp -This is a default setting on -amd64/amd64, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mips, powerpc/powerpc, powerpc/powerpc64, riscv/riscv64 and riscv/riscv64sf. .It Va WITHOUT_QUOTAS Do not build .Xr quota 1 From owner-dev-commits-src-all@freebsd.org Sun Aug 8 01:56:31 2021 Return-Path: Delivered-To: dev-commits-src-all@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 5D142675608 for ; Sun, 8 Aug 2021 01:56:31 +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 4Gj2Pq1sHvz3G8S; Sun, 8 Aug 2021 01:56: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 2680443AD; Sun, 8 Aug 2021 01:56: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 1781uVpR081915; Sun, 8 Aug 2021 01:56:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1781uV39081914; Sun, 8 Aug 2021 01:56:31 GMT (envelope-from git) Date: Sun, 8 Aug 2021 01:56:31 GMT Message-Id: <202108080156.1781uV39081914@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Martin Matuska Subject: git: 14b43fbd9c13..f3678d70ff8f - vendor/openzfs/master - vendor branch updated 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/vendor/openzfs/master X-Git-Reftype: branch X-Git-Commit: f3678d70ff8f98d67caf377ec0326c9a6c7bcf29 X-Git-Oldrev: 14b43fbd9c13d802409ed886bb6b66fd528fb209 X-Git-Newrev: f3678d70ff8f98d67caf377ec0326c9a6c7bcf29 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Aug 2021 01:56:31 -0000 The branch vendor/openzfs/master has been updated by mm: URL: https://cgit.FreeBSD.org/src/log/?id=14b43fbd9c13..f3678d70ff8f 1b06b03a7be8 Linux 5.14 compat: blk_alloc_disk() f1ca7999bbf2 Fix unfortunate NULL in spa_update_dspace 1c24bf966c37 Linux 5.14 compat: explicity assign set_page_dirty da27b8bc7f27 Initialize "autoreplace" in spa_ld_get_props() 03363b2f86a9 Initialize all fields in zfs_log_xvattr() 58714c281789 Zero pad bytes when allocating a ZIL record 3a185275a017 Zero pad bytes following TX_WRITE log data 13737094503a Initialize dn_next_type[] in the dnode constructor 5dbf6c5a66d3 Replace /*PRINTFLIKEn*/ with attribute(printf) 90f1c3c94678 Prune /*NOTREACHED*/ 2c69ba6444ad Normalise /*FALLTHR{OUGH,U}*/ 037af3e0d403 Remove NOTE(CONSTCOND) and note.h ab8a8f074578 Fixes in persistent L2ARC 31c41aea9cd4 Add missing properties to zfs allow manpage d8381f50d6ad Read past end of argv array in zpool_do_import() bdd2bfd02c70 Assorted fixes for the performance tests dd3bda39cf7a Add comment on metaslab_class_throttle_reserve() locking 02601d8aa41d Move check_file to os/$platform section 273730d5b556 macOS can also set va_type 0b072481afe2 storeabi: add `no-corpus-path` flag 9776838cfb8c Update ABI files with generated in CI worker 4bd99c11d76b Remove overlooked __sun_attr__ based macros b72611f0f612 Fix format specifier warnings 7eebcd2be6ac Avoid small buffer copying on write 46b2623586df Allow disabling of unmapped I/O on FreeBSD 4357552785ac Modify checksum obtain method of QAT e1870be45049 Man zpool-scrub.8: describe sequential scrub ae1e40b32911 Enable /proc/diskstats for zvols f3678d70ff8f Make get_key_material_file fail more verbosely From owner-dev-commits-src-all@freebsd.org Sun Aug 8 02:39:02 2021 Return-Path: Delivered-To: dev-commits-src-all@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 B5950675AAB; Sun, 8 Aug 2021 02:39: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 4Gj3Lt47fLz3Hcn; Sun, 8 Aug 2021 02:39: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 719ED4941; Sun, 8 Aug 2021 02:39: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 1782d2Wc036059; Sun, 8 Aug 2021 02:39:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1782d2SV036058; Sun, 8 Aug 2021 02:39:02 GMT (envelope-from git) Date: Sun, 8 Aug 2021 02:39:02 GMT Message-Id: <202108080239.1782d2SV036058@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: 1f88aa09417f - main - zfs: merge openzfs/zfs@f3678d70f (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: 1f88aa09417f1cfb3929fd37531b1ab51213c2d6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Aug 2021 02:39:02 -0000 The branch main has been updated by mm: URL: https://cgit.FreeBSD.org/src/commit/?id=1f88aa09417f1cfb3929fd37531b1ab51213c2d6 commit 1f88aa09417f1cfb3929fd37531b1ab51213c2d6 Merge: b0dafb1b6f35 f3678d70ff8f Author: Martin Matuska AuthorDate: 2021-08-08 01:57:07 +0000 Commit: Martin Matuska CommitDate: 2021-08-08 02:01:26 +0000 zfs: merge openzfs/zfs@f3678d70f (master) into main Notable upstream pull request merges: #12339 Read past end of argv array in zpool_do_import() #12365 Fixes in persistent L2ARC #12383 Fixes for KMSAN reports #12425 Avoid small buffer copying on write #12428 Fix unfortunate NULL in spa_update_dspace #12446 Allow disabling of unmapped I/O on FreeBSD Obtained from: OpenZFS OpenZFS commit: f3678d70ff8f98d67caf377ec0326c9a6c7bcf29 sys/contrib/openzfs/cmd/mount_zfs/mount_zfs.c | 2 +- sys/contrib/openzfs/cmd/zdb/zdb.c | 2 +- sys/contrib/openzfs/cmd/zfs/zfs_main.c | 6 +- sys/contrib/openzfs/cmd/zgenhostid/zgenhostid.c | 3 +- sys/contrib/openzfs/cmd/zhack/zhack.c | 11 +- .../openzfs/cmd/zpool/os/freebsd/zpool_vdev_os.c | 6 + .../openzfs/cmd/zpool/os/linux/zpool_vdev_os.c | 6 + sys/contrib/openzfs/cmd/zpool/zpool_main.c | 19 +- sys/contrib/openzfs/cmd/zpool/zpool_util.h | 3 +- sys/contrib/openzfs/cmd/zpool/zpool_vdev.c | 28 +- .../openzfs/cmd/zpool_influxdb/zpool_influxdb.c | 1 + sys/contrib/openzfs/cmd/ztest/ztest.c | 344 +- sys/contrib/openzfs/config/Abigail.am | 4 +- .../openzfs/config/kernel-make-request-fn.m4 | 20 + .../openzfs/config/kernel-vfs-set_page_dirty.m4 | 34 + sys/contrib/openzfs/config/kernel.m4 | 2 + sys/contrib/openzfs/include/libuutil.h | 25 +- sys/contrib/openzfs/include/libuutil_impl.h | 3 +- .../openzfs/include/os/freebsd/spl/sys/ccompile.h | 91 - .../openzfs/include/os/freebsd/spl/sys/cmn_err.h | 23 +- .../openzfs/include/os/linux/spl/sys/cmn_err.h | 9 +- sys/contrib/openzfs/include/sys/Makefile.am | 1 - sys/contrib/openzfs/include/sys/abd.h | 1 + sys/contrib/openzfs/include/sys/abd_impl.h | 1 - sys/contrib/openzfs/include/sys/arc.h | 4 +- sys/contrib/openzfs/include/sys/arc_impl.h | 1 - sys/contrib/openzfs/include/sys/bitops.h | 11 +- sys/contrib/openzfs/include/sys/dbuf.h | 4 +- sys/contrib/openzfs/include/sys/dnode.h | 2 +- sys/contrib/openzfs/include/sys/dsl_dataset.h | 2 +- sys/contrib/openzfs/include/sys/dsl_dir.h | 2 +- sys/contrib/openzfs/include/sys/note.h | 56 - sys/contrib/openzfs/include/sys/spa.h | 20 +- sys/contrib/openzfs/include/sys/vdev.h | 3 +- sys/contrib/openzfs/include/sys/zfs_context.h | 2 - sys/contrib/openzfs/lib/libnvpair/libnvpair.abi | 4771 +++++----- sys/contrib/openzfs/lib/libnvpair/libnvpair.c | 9 +- .../lib/libspl/include/os/linux/sys/sysmacros.h | 2 - sys/contrib/openzfs/lib/libuutil/libuutil.abi | 3273 +++---- sys/contrib/openzfs/lib/libuutil/uu_pname.c | 14 +- sys/contrib/openzfs/lib/libzfs/libzfs.abi | 9972 ++++++++------------ sys/contrib/openzfs/lib/libzfs/libzfs_crypto.c | 2 +- sys/contrib/openzfs/lib/libzfs/libzfs_dataset.c | 2 +- sys/contrib/openzfs/lib/libzfs/libzfs_util.c | 5 - .../openzfs/lib/libzfs_core/libzfs_core.abi | 5561 +++++------ .../openzfs/lib/libzfsbootenv/libzfsbootenv.abi | 409 +- sys/contrib/openzfs/lib/libzpool/kernel.c | 1 - sys/contrib/openzfs/lib/libzutil/zutil_import.c | 15 +- sys/contrib/openzfs/man/man8/zfs-allow.8 | 28 +- sys/contrib/openzfs/man/man8/zpool-scrub.8 | 29 +- .../openzfs/module/icp/algs/skein/skein_impl.h | 8 - .../openzfs/module/icp/core/kcf_prov_tabs.c | 2 +- sys/contrib/openzfs/module/icp/io/aes.c | 2 +- sys/contrib/openzfs/module/icp/io/skein_mod.c | 1 - sys/contrib/openzfs/module/lua/llex.c | 2 +- sys/contrib/openzfs/module/lua/ltable.c | 2 +- sys/contrib/openzfs/module/os/freebsd/zfs/abd_os.c | 2 +- .../openzfs/module/os/freebsd/zfs/vdev_geom.c | 4 + .../openzfs/module/os/freebsd/zfs/zfs_acl.c | 4 +- .../openzfs/module/os/freebsd/zfs/zfs_ctldir.c | 2 +- .../openzfs/module/os/freebsd/zfs/zio_crypt.c | 2 - sys/contrib/openzfs/module/os/linux/zfs/abd_os.c | 2 +- .../openzfs/module/os/linux/zfs/qat_compress.c | 27 +- .../openzfs/module/os/linux/zfs/vdev_disk.c | 4 +- sys/contrib/openzfs/module/os/linux/zfs/zfs_acl.c | 4 +- .../openzfs/module/os/linux/zfs/zfs_znode.c | 2 +- sys/contrib/openzfs/module/os/linux/zfs/zpl_file.c | 6 + sys/contrib/openzfs/module/os/linux/zfs/zvol_os.c | 44 +- sys/contrib/openzfs/module/zfs/abd.c | 2 +- sys/contrib/openzfs/module/zfs/arc.c | 186 +- sys/contrib/openzfs/module/zfs/ddt.c | 1 - sys/contrib/openzfs/module/zfs/dnode.c | 1 + sys/contrib/openzfs/module/zfs/dsl_prop.c | 2 +- sys/contrib/openzfs/module/zfs/metaslab.c | 7 + sys/contrib/openzfs/module/zfs/spa.c | 2 +- sys/contrib/openzfs/module/zfs/spa_log_spacemap.c | 4 +- sys/contrib/openzfs/module/zfs/spa_misc.c | 11 +- sys/contrib/openzfs/module/zfs/vdev.c | 4 +- sys/contrib/openzfs/module/zfs/vdev_raidz_math.c | 8 +- sys/contrib/openzfs/module/zfs/zfs_log.c | 5 +- sys/contrib/openzfs/module/zfs/zfs_replay.c | 10 +- sys/contrib/openzfs/module/zfs/zil.c | 15 +- sys/contrib/openzfs/scripts/zfs-tests.sh | 27 +- sys/contrib/openzfs/tests/runfiles/common.run | 3 +- .../openzfs/tests/test-runner/bin/zts-report.py.in | 2 - .../openzfs/tests/zfs-tests/cmd/mkbusy/Makefile.am | 2 + .../openzfs/tests/zfs-tests/cmd/mkbusy/mkbusy.c | 116 +- .../openzfs/tests/zfs-tests/cmd/mkfile/mkfile.c | 3 +- .../tests/zfs-tests/cmd/mmapwrite/mmapwrite.c | 11 +- .../openzfs/tests/zfs-tests/include/tunables.cfg | 2 +- .../tests/functional/checksum/edonr_test.c | 3 - .../tests/functional/checksum/sha2_test.c | 3 - .../tests/functional/checksum/skein_test.c | 3 - .../zfs-tests/tests/functional/l2arc/Makefile.am | 5 +- .../tests/functional/l2arc/l2arc_arcstats_pos.ksh | 1 - .../functional/l2arc/persist_l2arc_004_pos.ksh | 55 +- .../functional/l2arc/persist_l2arc_005_pos.ksh | 69 +- .../functional/l2arc/persist_l2arc_006_pos.ksh | 101 - .../functional/l2arc/persist_l2arc_007_pos.ksh | 97 - .../functional/l2arc/persist_l2arc_008_pos.ksh | 143 - .../openzfs/tests/zfs-tests/tests/perf/perf.shlib | 61 +- .../tests/perf/regression/random_reads.ksh | 30 +- .../tests/perf/regression/random_readwrite.ksh | 30 +- .../perf/regression/random_readwrite_fixed.ksh | 30 +- .../tests/perf/regression/random_writes.ksh | 30 +- .../tests/perf/regression/random_writes_zil.ksh | 31 +- .../tests/perf/regression/sequential_reads.ksh | 30 +- .../regression/sequential_reads_arc_cached.ksh | 30 +- .../sequential_reads_arc_cached_clone.ksh | 31 +- .../regression/sequential_reads_dbuf_cached.ksh | 32 +- .../tests/perf/regression/sequential_writes.ksh | 30 +- .../zfs-tests/tests/perf/regression/setup.ksh | 3 +- sys/modules/zfs/zfs_config.h | 10 +- sys/modules/zfs/zfs_gitrev.h | 2 +- 114 files changed, 10956 insertions(+), 15293 deletions(-) diff --cc sys/contrib/openzfs/config/kernel-vfs-set_page_dirty.m4 index 000000000000,a9d252e4e01e..a9d252e4e01e mode 000000,100644..100644 --- a/sys/contrib/openzfs/config/kernel-vfs-set_page_dirty.m4 +++ b/sys/contrib/openzfs/config/kernel-vfs-set_page_dirty.m4 diff --cc sys/modules/zfs/zfs_config.h index f3b53d243ae3,000000000000..9542f241179f mode 100644,000000..100644 --- a/sys/modules/zfs/zfs_config.h +++ b/sys/modules/zfs/zfs_config.h @@@ -1,843 -1,0 +1,849 @@@ +/* + * $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_bdev->bd_disk exists */ +/* #undef HAVE_BIO_BDEV_DISK */ + +/* 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_max_segs() is implemented */ +/* #undef HAVE_BIO_MAX_SEGS */ + +/* 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_disk() exists */ ++/* #undef HAVE_BLK_ALLOC_DISK */ ++ +/* 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 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 */ + +/* 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 */ + +/* disk_*_io_acct() available */ +/* #undef HAVE_DISK_IO_ACCT */ + +/* 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_fillattr requires struct user_namespace* */ +/* #undef HAVE_GENERIC_FILLATTR_USERNS */ + +/* 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_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 */ + +/* 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 */ + +/* 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 */ + +/* 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_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 */ + +/* 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->mkdir() takes 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_add_batch() is defined */ +/* #undef HAVE_PERCPU_COUNTER_ADD_BATCH */ + +/* 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, 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, 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 */ + +/* ->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 */ + +/* i_op->tmpfile() has userns */ +/* #undef HAVE_TMPFILE_USERNS */ + +/* 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 struct user_namespace* */ +/* #undef HAVE_USERNS_IOPS_GETATTR */ + +/* 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 */ + ++/* __set_page_dirty_nobuffers exists */ ++/* #undef HAVE_VFS_SET_PAGE_DIRTY_NOBUFFERS */ ++ +/* __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 */ + +/* xattr_handler->set() takes user_namespace */ +/* #undef HAVE_XATTR_SET_USERNS */ + +/* 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 */ + +/* 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/" + +/* 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_g14b43fbd9" ++#define ZFS_META_ALIAS "zfs-2.1.99-FreeBSD_gf3678d70f" + +/* 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. */ *** 27 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Sun Aug 8 03:14:46 2021 Return-Path: Delivered-To: dev-commits-src-all@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 08F50675DE0; Sun, 8 Aug 2021 03:14: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 4Gj4856blNz3KMQ; Sun, 8 Aug 2021 03:14: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 CADD9554F; Sun, 8 Aug 2021 03:14: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 1783Ej3S090160; Sun, 8 Aug 2021 03:14:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1783EjMt090159; Sun, 8 Aug 2021 03:14:45 GMT (envelope-from git) Date: Sun, 8 Aug 2021 03:14:45 GMT Message-Id: <202108080314.1783EjMt090159@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: 54247ce1f96f - main - Makefile.inc1: Avoid hanging if pkg is not installed 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: 54247ce1f96f04d16f1429007bac3607c8a0a39e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Aug 2021 03:14:46 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=54247ce1f96f04d16f1429007bac3607c8a0a39e commit 54247ce1f96f04d16f1429007bac3607c8a0a39e Author: Ed Maste AuthorDate: 2021-08-08 01:50:32 +0000 Commit: Ed Maste CommitDate: 2021-08-08 03:13:40 +0000 Makefile.inc1: Avoid hanging if pkg is not installed For `pkg --version`, Redirect stdin from /dev/null to avoid waiting on /usr/sbin/pkg's bootstrap prompt if the pkg package is not installed. Also redirect stderr to /dev/null to discard the warning message in this case. Reported by: mjg Fixes: 4e224e4be7c3 ("pkgbase: accommodate pkg < 1.17") Sponsored by: The FreeBSD Foundation --- Makefile.inc1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index be8ac02353e1..2c1f72085110 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -1889,7 +1889,8 @@ _pkgbootstrap: .PHONY .if make(create-world-packages-jobs) || make(create-kernel-packages*) || make(real-update-packages) || make(sign-packages) PKG_ABI!=${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/usr/bin/uname config ABI .endif -PKG_BIN_VERSION!=${PKG_CMD} --version | awk -F. '/^[0-9.]+$$/ {print $$1 * 10000 + $$2 * 100 + $$3}' +PKG_BIN_VERSION!=${PKG_CMD} --version /dev/null |\ + awk -F. '/^[0-9.]+$$/ {print $$1 * 10000 + $$2 * 100 + $$3}' .if ${PKG_BIN_VERSION} < 11700 PKG_EXT= ${PKG_FORMAT} .else From owner-dev-commits-src-all@freebsd.org Sun Aug 8 07:16:03 2021 Return-Path: Delivered-To: dev-commits-src-all@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 70D4D650E10 for ; Sun, 8 Aug 2021 07:16:03 +0000 (UTC) (envelope-from mw@semihalf.com) Received: from mail-qt1-x82f.google.com (mail-qt1-x82f.google.com [IPv6:2607:f8b0:4864:20::82f]) (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 4Gj9VV4jLQz3mnL for ; Sun, 8 Aug 2021 07:16:02 +0000 (UTC) (envelope-from mw@semihalf.com) Received: by mail-qt1-x82f.google.com with SMTP id l24so9992864qtj.4 for ; Sun, 08 Aug 2021 00:16:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=AxHM7cCD94wFdDWu1/8FZcGPJG1u8O4WZCY3kHek8fM=; b=lLfl96RGjKaPd1CIlJsl8/j0xfCcPFi4tVyeq7GevCpAC9AJ0KS5VTZEwP5QYd8p81 8Pch38PrMr2IAuM+Gpws/KOSH7K7j1SPDxv7Zg8s/HAgMLuKP7acKQVIGk6RI6QqEzaD pvVTivYVnTUtc0CrU3i/XqBlpTi8wkKh4zzuIKvHYHYQUUqPgscZG6b2sVbEZhPSSuOi fz6oyQFm9VA8J/xrRVIEjzWUKnLJLoi8Dpc7t7QabYjtjFHYAfDWLf4wNMoON4EVrJOy uwtciTDWpum8NVBdAjn7oJookujyd86iI/jaTK17AHagYzZ1eCQGqBhukB/+Sv1uJTOI tpsw== 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=AxHM7cCD94wFdDWu1/8FZcGPJG1u8O4WZCY3kHek8fM=; b=h23zxbZVUKQkUIC1ww7mYh30o/Dr+5EtowdgVDkh3cAaHyVX4tbthCzEJsEtslDr67 NSeRuyFfQe+0yUhItyhStWg7uEE9LZOC1QszDmKM0RkIQcAzOOjEmJuZ1uImF8f6t7PL ei22iMPnFoeUNbLfpV3qUGkXBv9/YpJnDbIqnwsx0NtIQG2Ivq+WPW/JCrlbmz0avKhz StYyIVaBoZ14T/PYohcqX3hF1F+p2KEUfuxW0/AcoBkjt5Lcb8NfrZkv0MaBR+QcN+a9 2YsB4PfvMIGlQ8hngj6DRS9al/pC6ulFSUgiWUdXQPGHaW/WCU8LoJj4XlnLwk5TYN6e D5rQ== X-Gm-Message-State: AOAM53026y2mfE7NwLkBWZdt2zKGp7E4IAx5Rudk5xI5wNFglTh7W8gA 4RO0Nwh+nwX/aZi6jGl+62bH+qj1Mq3cO6qfR3j2fA== X-Google-Smtp-Source: ABdhPJw4B0uix3gReVFRmrs8pirsQkjiJIG/qTkXlpjgXtvcGpPQNBcl8aasRQ4345V0AmI2KtwZjWb/P7wlhG36QAc= X-Received: by 2002:ac8:44c2:: with SMTP id b2mr14897748qto.216.1628406962111; Sun, 08 Aug 2021 00:16:02 -0700 (PDT) MIME-Version: 1.0 References: <202108031008.173A84BG096694@gitrepo.freebsd.org> In-Reply-To: From: Marcin Wojtas Date: Sun, 8 Aug 2021 09:15:52 +0200 Message-ID: Subject: Re: git: dfcaa2c18bf9 - main - enetc_mdio: Support building the driver as a loadable module. To: Ian Lepore Cc: Marcin Wojtas , src-committers , 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: 4Gj9VV4jLQz3mnL X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=semihalf-com.20150623.gappssmtp.com header.s=20150623 header.b=lLfl96RG; dmarc=none; spf=none (mx1.freebsd.org: domain of mw@semihalf.com has no SPF policy when checking 2607:f8b0:4864:20::82f) smtp.mailfrom=mw@semihalf.com X-Spamd-Result: default: False [-3.30 / 15.00]; RCVD_TLS_ALL(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[semihalf-com.20150623.gappssmtp.com:s=20150623]; FREEFALL_USER(0.00)[mw]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; 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-all@freebsd.org]; DMARC_NA(0.00)[semihalf.com]; RCPT_COUNT_FIVE(0.00)[5]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[semihalf-com.20150623.gappssmtp.com:+]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::82f:from]; R_SPF_NA(0.00)[no SPF record]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[dev-commits-src-all] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Aug 2021 07:16:03 -0000 Hi Ian, wt., 3 sie 2021 o 18:31 Ian Lepore napisa=C5=82(a): > > On Tue, 2021-08-03 at 10:08 +0000, Marcin Wojtas wrote: > > The branch main has been updated by mw: > > > > URL: > > https://cgit.FreeBSD.org/src/commit/?id=3Ddfcaa2c18bf9c69b94d531364f891= 3b23f19505f > > > > commit dfcaa2c18bf9c69b94d531364f8913b23f19505f > > Author: Kornel Duleba > > AuthorDate: 2021-07-28 11:38:53 +0000 > > Commit: Marcin Wojtas > > CommitDate: 2021-08-03 10:07:49 +0000 > > > > enetc_mdio: Support building the driver as a loadable module. > > > > [...] > > diff --git a/sys/modules/enetc_mdio/Makefile > > b/sys/modules/enetc_mdio/Makefile > > new file mode 100644 > > index 000000000000..f448fc526705 > > --- /dev/null > > +++ b/sys/modules/enetc_mdio/Makefile > > @@ -0,0 +1,8 @@ > > +#$FreeBSD$ > > + > > +.PATH: ${SRCTOP}/sys/dev/enetc > > + > > +KMOD =3D enetc_mdio > > +SRCS =3D enetc_mdio_pci.c enetc_mdio.c > > + > > +.include > > A module makefile must list all the header files it uses which are > generated at build time from interface definitions (.m files) in its > SRCS list. For this driver, I think that means ifdi_if.h and > miibus_if.h. > > -- Ian > Agreed. Part of it was already fixed by manu, I'm about to add remaining dependencies. Thanks, Marcin From owner-dev-commits-src-all@freebsd.org Sun Aug 8 07:17:41 2021 Return-Path: Delivered-To: dev-commits-src-all@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 8B25C651195 for ; Sun, 8 Aug 2021 07:17:41 +0000 (UTC) (envelope-from mw@semihalf.com) Received: from mail-qk1-x72d.google.com (mail-qk1-x72d.google.com [IPv6:2607:f8b0:4864:20::72d]) (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 4Gj9XP0ffnz3mm1 for ; Sun, 8 Aug 2021 07:17:41 +0000 (UTC) (envelope-from mw@semihalf.com) Received: by mail-qk1-x72d.google.com with SMTP id c130so6582362qkg.7 for ; Sun, 08 Aug 2021 00:17:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=K5BjvU0YYByF4fQPqKPaL+V6x37LVgrwi04mXqRd4Ao=; b=HRLoqW0oEM728pmgCDVYDxRbrsvJfkJKUgIrrfmcdLWdgPnR3s0Dva1vOoq3TdKSGm KByooceui46udZ8t18U8T4N69cZ4I0L0I8PLD3Nc3zzOsyXe7z99omxrkclfC3grSWoa yQGddqXJJXr4mWMlU95jGgRrXmQe3vY10lEatjKSpV/6ic7XfTIsPPI82L/JBgN7tbso g5CRh1C0ouiFKUgP1K8hz77I0Zfcdjm3uUQ3lsaMyUds9xZIEhSrxORIkA+sz85Nowmu OKHPl2TiyXpSRM8PT0cHeJSn9i2BrgHiErw8mAdiZ2o+Tkz1UoGtMgnN3G5RBIQMzO2J +UKw== 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=K5BjvU0YYByF4fQPqKPaL+V6x37LVgrwi04mXqRd4Ao=; b=eB/Wlwc+KbDIplNdcNM8Wv3F/s4YftHGLqp4VPNNP0UhE1tTYH4OCE7cQqi+APHX94 SG5yMKGuFbjxAw2+TmTrzkgIX56N6nz+pcGw4u/TrrCyMei0gqdIN1vzPiwN0WUki2wL /SftpPhg6hin5nNp5BBANHvlUAGI3/tr7nmtFrqKrJTi23mGRvZUz5FqWVtcfDK4EIpT 9KFLh9Crea2miM77PbJm7YQmO+C5W6FMr2P+kfAGHCcTPWopeROkZCLse+j6r3r+nKJh 4uNonR9Oz/zPILFXEr6qj5NTaWStngwHFaLdfKs1JDjQxPT0GThWQv5aYBjWg3Mj6nih 5H/w== X-Gm-Message-State: AOAM530m7xOsaRCGbA6VN81FIwHP3l5pLtwE8WY2kSdRYmMx3tDo9Cet h6Pi2AFJDeW+zjrmrAzz63qN1ac8rpSUzs8InfmkT4eWHpxE3Q== X-Google-Smtp-Source: ABdhPJxr00GaJ+QRRiXFUCo0UnU9KlX36UwaP+e1XDA3QBfaE+qaV94aMnIfsx7tZXn8HG15c1Bi10gDBrzQJ8IFaqg= X-Received: by 2002:a05:620a:12af:: with SMTP id x15mr10793769qki.300.1628407060679; Sun, 08 Aug 2021 00:17:40 -0700 (PDT) MIME-Version: 1.0 References: <202108031008.173A83HA096670@gitrepo.freebsd.org> In-Reply-To: From: Marcin Wojtas Date: Sun, 8 Aug 2021 09:17:30 +0200 Message-ID: Subject: Re: git: 5ad6d28cbe6b - main - enetc: Support building the driver as a loadable module. To: John Baldwin Cc: Marcin Wojtas , src-committers , 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: 4Gj9XP0ffnz3mm1 X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=semihalf-com.20150623.gappssmtp.com header.s=20150623 header.b=HRLoqW0o; dmarc=none; spf=none (mx1.freebsd.org: domain of mw@semihalf.com has no SPF policy when checking 2607:f8b0:4864:20::72d) smtp.mailfrom=mw@semihalf.com X-Spamd-Result: default: False [-3.30 / 15.00]; RCVD_TLS_ALL(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[semihalf-com.20150623.gappssmtp.com:s=20150623]; FREEFALL_USER(0.00)[mw]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; 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-all@freebsd.org]; DMARC_NA(0.00)[semihalf.com]; RCPT_COUNT_FIVE(0.00)[5]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[semihalf-com.20150623.gappssmtp.com:+]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::72d:from]; R_SPF_NA(0.00)[no SPF record]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[dev-commits-src-all] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Aug 2021 07:17:41 -0000 =C5=9Br., 4 sie 2021 o 20:18 John Baldwin napisa=C5=82(a)= : > > On 8/3/21 3:08 AM, Marcin Wojtas wrote: > > The branch main has been updated by mw: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=3D5ad6d28cbe6b3ff85e49607a= 7e04cb68db3ed6df > > > > commit 5ad6d28cbe6b3ff85e49607a7e04cb68db3ed6df > > Author: Kornel Duleba > > AuthorDate: 2021-07-28 09:23:23 +0000 > > Commit: Marcin Wojtas > > CommitDate: 2021-08-03 10:07:49 +0000 > > > > enetc: Support building the driver as a loadable module. > > > > Function level reset has to be done in attach in order to put the > > hardware in a known state before configuring it. > > The order of DRIVER_MODULEs was changed to ensure that the miibus = driver > > is loaded when mii_attach is called. > > > > Obtained from: Semihalf > > Sponsored by: Alstom Group > > --- > > sys/dev/enetc/if_enetc.c | 6 +++++- > > sys/modules/Makefile | 2 ++ > > sys/modules/enetc/Makefile | 8 ++++++++ > > 3 files changed, 15 insertions(+), 1 deletion(-) > > > > diff --git a/sys/dev/enetc/if_enetc.c b/sys/dev/enetc/if_enetc.c > > index 54cdc6ea9ad4..46327eb419bf 100644 > > --- a/sys/dev/enetc/if_enetc.c > > +++ b/sys/dev/enetc/if_enetc.c > > @@ -158,8 +158,8 @@ static driver_t enetc_driver =3D { > > }; > > > > static devclass_t enetc_devclass; > > -DRIVER_MODULE(enetc, pci, enetc_driver, enetc_devclass, NULL, NULL); > > DRIVER_MODULE(miibus, enetc, miibus_driver, miibus_devclass, NULL, NU= LL); > > +DRIVER_MODULE(enetc, pci, enetc_driver, enetc_devclass, NULL, NULL); > > MODULE_VERSION(enetc, 1); > > This is not the right way to fix this as the toolchain is free to reorder > symbols. You should instead use 'DRIVER_MODULE_ORDERED(..., SI_ORDER_LAS= T)' > for enetc so that the miibus driver is registered first. > Thank you for the remark - I will submit a fix for that. Best regards, Marcin From owner-dev-commits-src-all@freebsd.org Sun Aug 8 08:17:51 2021 Return-Path: Delivered-To: dev-commits-src-all@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 6B31E65218E; Sun, 8 Aug 2021 08:17: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 4GjBsq2JF6z3pmj; Sun, 8 Aug 2021 08:17:51 +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 3787311341; Sun, 8 Aug 2021 08:17:51 +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 1788HpiF087545; Sun, 8 Aug 2021 08:17:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1788Hpid087544; Sun, 8 Aug 2021 08:17:51 GMT (envelope-from git) Date: Sun, 8 Aug 2021 08:17:51 GMT Message-Id: <202108080817.1788Hpid087544@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: 04389c855e56 - main - Fix some common typos in comments 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: 04389c855e56d1715637fa43575ec13455a68b2e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Aug 2021 08:17:51 -0000 The branch main has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=04389c855e56d1715637fa43575ec13455a68b2e commit 04389c855e56d1715637fa43575ec13455a68b2e Author: Gordon Bergling AuthorDate: 2021-08-08 08:16:06 +0000 Commit: Gordon Bergling CommitDate: 2021-08-08 08:16:06 +0000 Fix some common typos in comments - s/configuraiton/configuration/ - s/specifed/specified/ - s/compatiblity/compatibility/ MFC after: 5 days --- sys/cam/scsi/scsi_enc_ses.c | 2 +- sys/dev/aic7xxx/aic7xxx.reg | 2 +- sys/dev/gpio/gpio_if.m | 6 +++--- sys/dev/gpio/gpiobus_if.m | 6 +++--- sys/dev/hpt27xx/hptintf.h | 2 +- sys/dev/hwpmc/hwpmc_amd.c | 2 +- sys/dev/mlx5/mlx5_en/mlx5_en_port_buffer.c | 2 +- sys/dev/qlnx/qlnxe/ecore_sriov.h | 2 +- sys/dev/sound/fdt/audio_soc.c | 2 +- sys/netinet/in_fib.c | 2 +- sys/netinet6/in6_pcb.c | 2 +- sys/sys/user.h | 2 +- usr.bin/quota/quota.c | 4 ++-- usr.sbin/lpr/lpc/cmds.c | 2 +- 14 files changed, 19 insertions(+), 19 deletions(-) diff --git a/sys/cam/scsi/scsi_enc_ses.c b/sys/cam/scsi/scsi_enc_ses.c index 32e523923fd2..f4f1c4a23516 100644 --- a/sys/cam/scsi/scsi_enc_ses.c +++ b/sys/cam/scsi/scsi_enc_ses.c @@ -418,7 +418,7 @@ ses_iter_init(enc_softc_t *enc, enc_cache_t *cache, struct ses_iterator *iter) /** * \brief Traverse the provided SES iterator to the next element - * within the configuraiton. + * within the configuration. * * \param iter The iterator to move. * diff --git a/sys/dev/aic7xxx/aic7xxx.reg b/sys/dev/aic7xxx/aic7xxx.reg index 7a15b5613163..a9253aa94b6e 100644 --- a/sys/dev/aic7xxx/aic7xxx.reg +++ b/sys/dev/aic7xxx/aic7xxx.reg @@ -1510,7 +1510,7 @@ scratch_ram { size 6 /* * These are reserved registers in the card's scratch ram on the 2742. - * The EISA configuraiton chip is mapped here. On Rev E. of the + * The EISA configuration chip is mapped here. On Rev E. of the * aic7770, the sequencer can use this area for scratch, but the * host cannot directly access these registers. On later chips, this * area can be read and written by both the host and the sequencer. diff --git a/sys/dev/gpio/gpio_if.m b/sys/dev/gpio/gpio_if.m index 70838cd1042b..4a97f532b1e2 100644 --- a/sys/dev/gpio/gpio_if.m +++ b/sys/dev/gpio/gpio_if.m @@ -85,7 +85,7 @@ METHOD int pin_max { }; # -# Set value of pin specifed by pin_num +# Set value of pin specified by pin_num # METHOD int pin_set { device_t dev; @@ -94,7 +94,7 @@ METHOD int pin_set { }; # -# Get value of pin specifed by pin_num +# Get value of pin specified by pin_num # METHOD int pin_get { device_t dev; @@ -103,7 +103,7 @@ METHOD int pin_get { }; # -# Toggle value of pin specifed by pin_num +# Toggle value of pin specified by pin_num # METHOD int pin_toggle { device_t dev; diff --git a/sys/dev/gpio/gpiobus_if.m b/sys/dev/gpio/gpiobus_if.m index ee926d5b96f0..63324645a4de 100644 --- a/sys/dev/gpio/gpiobus_if.m +++ b/sys/dev/gpio/gpiobus_if.m @@ -49,7 +49,7 @@ METHOD void release_bus { }; # -# Set value of pin specifed by pin_num +# Set value of pin specified by pin_num # METHOD int pin_set { device_t dev; @@ -59,7 +59,7 @@ METHOD int pin_set { }; # -# Get value of pin specifed by pin_num +# Get value of pin specified by pin_num # METHOD int pin_get { device_t dev; @@ -69,7 +69,7 @@ METHOD int pin_get { }; # -# Toggle value of pin specifed by pin_num +# Toggle value of pin specified by pin_num # METHOD int pin_toggle { device_t dev; diff --git a/sys/dev/hpt27xx/hptintf.h b/sys/dev/hpt27xx/hptintf.h index ce768b846fba..7a988ccc566f 100644 --- a/sys/dev/hpt27xx/hptintf.h +++ b/sys/dev/hpt27xx/hptintf.h @@ -132,7 +132,7 @@ typedef HPT_U32 DEVICEID; #define MAX_ARRAY_MEMBERS_V3 64 #endif -/* keep definition for source code compatiblity */ +/* keep definition for source code compatibility */ #define MAX_ARRAY_MEMBERS MAX_ARRAY_MEMBERS_V1 /* diff --git a/sys/dev/hwpmc/hwpmc_amd.c b/sys/dev/hwpmc/hwpmc_amd.c index a95615926bc3..024024ece19b 100644 --- a/sys/dev/hwpmc/hwpmc_amd.c +++ b/sys/dev/hwpmc/hwpmc_amd.c @@ -771,7 +771,7 @@ amd_stop_pmc(int cpu, int ri) /* * Due to NMI latency on newer AMD processors * NMI interrupts are ignored, which leads to - * panic or messages based on kernel configuraiton + * panic or messages based on kernel configuration */ /* Wait for the count to be reset */ diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_port_buffer.c b/sys/dev/mlx5/mlx5_en/mlx5_en_port_buffer.c index f453b4759e27..6a623f4c9cad 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_port_buffer.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_port_buffer.c @@ -178,7 +178,7 @@ static int update_xoff_threshold(struct mlx5e_priv *priv, * port_buffer: port receive buffer configuration * change: * - * Update buffer configuration based on pfc configuraiton and priority + * Update buffer configuration based on pfc configuration and priority * to buffer mapping. * Buffer's lossy bit is changed to: * lossless if there is at least one PFC enabled priority mapped to this buffer diff --git a/sys/dev/qlnx/qlnxe/ecore_sriov.h b/sys/dev/qlnx/qlnxe/ecore_sriov.h index 57097df30948..84d954404e13 100644 --- a/sys/dev/qlnx/qlnxe/ecore_sriov.h +++ b/sys/dev/qlnx/qlnxe/ecore_sriov.h @@ -222,7 +222,7 @@ struct ecore_pf_iov { #ifdef CONFIG_ECORE_SRIOV /** * @brief Read sriov related information and allocated resources - * reads from configuraiton space, shmem, etc. + * reads from configuration space, shmem, etc. * * @param p_hwfn * diff --git a/sys/dev/sound/fdt/audio_soc.c b/sys/dev/sound/fdt/audio_soc.c index cd5807d955c9..eeb55d85420e 100644 --- a/sys/dev/sound/fdt/audio_soc.c +++ b/sys/dev/sound/fdt/audio_soc.c @@ -61,7 +61,7 @@ struct audio_soc_channel { struct audio_soc_softc { /* * pcm_register assumes that sc is snddev_info, - * so this has to be first structure member for "compatiblity" + * so this has to be first structure member for "compatibility" */ struct snddev_info info; device_t dev; diff --git a/sys/netinet/in_fib.c b/sys/netinet/in_fib.c index 8a6e64876b3d..3e09be7dc6e2 100644 --- a/sys/netinet/in_fib.c +++ b/sys/netinet/in_fib.c @@ -60,7 +60,7 @@ __FBSDID("$FreeBSD$"); #ifdef INET -/* Verify struct route compatiblity */ +/* Verify struct route compatibility */ /* Assert 'struct route_in' is compatible with 'struct route' */ CHK_STRUCT_ROUTE_COMPAT(struct route_in, ro_dst4); diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c index 9572efaf5e1d..14b95dfe0254 100644 --- a/sys/netinet6/in6_pcb.c +++ b/sys/netinet6/in6_pcb.c @@ -699,7 +699,7 @@ in6_pcbnotify(struct inpcbinfo *pcbinfo, struct sockaddr *dst, /* * Detect if we should notify the error. If no source and - * destination ports are specifed, but non-zero flowinfo and + * destination ports are specified, but non-zero flowinfo and * local address match, notify the error. This is the case * when the error is delivered with an encrypted buffer * by ESP. Otherwise, just compare addresses and ports diff --git a/sys/sys/user.h b/sys/sys/user.h index 14471c91572f..e8bfba981e83 100644 --- a/sys/sys/user.h +++ b/sys/sys/user.h @@ -349,7 +349,7 @@ struct kinfo_file { int64_t kf_offset; /* Seek location. */ union { struct { - /* API compatiblity with FreeBSD < 12. */ + /* API compatibility with FreeBSD < 12. */ int kf_vnode_type; int kf_sock_domain; int kf_sock_type; diff --git a/usr.bin/quota/quota.c b/usr.bin/quota/quota.c index 71e63208884f..7dceb67b23e8 100644 --- a/usr.bin/quota/quota.c +++ b/usr.bin/quota/quota.c @@ -215,7 +215,7 @@ showuid(u_long uid) } /* - * Print out quotas for a specifed user name. + * Print out quotas for a specified user name. */ static int showusrname(char *name) @@ -246,7 +246,7 @@ showgid(u_long gid) } /* - * Print out quotas for a specifed group name. + * Print out quotas for a specified group name. */ static int showgrpname(char *name) diff --git a/usr.sbin/lpr/lpc/cmds.c b/usr.sbin/lpr/lpc/cmds.c index 0fb2e676f6a7..c0debb1fcbcd 100644 --- a/usr.sbin/lpr/lpc/cmds.c +++ b/usr.sbin/lpr/lpc/cmds.c @@ -94,7 +94,7 @@ static void wrapup_clean(int _laststatus); */ enum qsel_val { /* how a given ptr was selected */ QSEL_UNKNOWN = -1, /* ... not selected yet */ - QSEL_BYNAME = 0, /* ... user specifed it by name */ + QSEL_BYNAME = 0, /* ... user specified it by name */ QSEL_ALL = 1 /* ... user wants "all" printers */ /* (with more to come) */ }; From owner-dev-commits-src-all@freebsd.org Sun Aug 8 09:21:19 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A49B5652C1C; Sun, 8 Aug 2021 09:21: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 4GjDH34FKBz3slW; Sun, 8 Aug 2021 09:21: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 7943312340; Sun, 8 Aug 2021 09:21: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 1789LJIv076238; Sun, 8 Aug 2021 09:21:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1789LJNj076237; Sun, 8 Aug 2021 09:21:19 GMT (envelope-from git) Date: Sun, 8 Aug 2021 09:21:19 GMT Message-Id: <202108080921.1789LJNj076237@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 9748eb742791 - main - Simplify nhop operations in ip_output(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9748eb742791dcfbb6496dc5c7c72c9283759baf Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Aug 2021 09:21:19 -0000 The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=9748eb742791dcfbb6496dc5c7c72c9283759baf commit 9748eb742791dcfbb6496dc5c7c72c9283759baf Author: Alexander V. Chernikov AuthorDate: 2021-08-07 11:18:02 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-08-08 09:19:27 +0000 Simplify nhop operations in ip_output(). Consistently use `nh` instead of always dereferencing ro->ro_nh inside the if block. Always use nexthop mtu, as it provides guarantee that mtu is accurate. Pass `nh` pointer to rt_update_ro_flags() to allow upcoming uses of updating ro flags based on different nexthop. Differential Revision: https://reviews.freebsd.org/D31451 Reviewed by: kp MFC after: 2 weeks --- sys/net/route/route_ctl.c | 21 +++++++++++++++++++-- sys/netinet/ip_output.c | 27 +++++++++++++-------------- 2 files changed, 32 insertions(+), 16 deletions(-) diff --git a/sys/net/route/route_ctl.c b/sys/net/route/route_ctl.c index 582901d67a8d..a686d1623053 100644 --- a/sys/net/route/route_ctl.c +++ b/sys/net/route/route_ctl.c @@ -567,6 +567,24 @@ rib_add_route(uint32_t fibnum, struct rt_addrinfo *info, return (error); } +/* + * Checks if @dst and @gateway is valid combination. + * + * Returns true if is valid, false otherwise. + */ +static bool +check_gateway(struct rib_head *rnh, struct sockaddr *dst, + struct sockaddr *gateway) +{ + if (dst->sa_family == gateway->sa_family) + return (true); + else if (gateway->sa_family == AF_UNSPEC) + return (true); + else if (gateway->sa_family == AF_LINK) + return (true); + return (false); +} + /* * Creates rtentry and nexthop based on @info data. * Return 0 and fills in rtentry into @prt on success, @@ -589,8 +607,7 @@ create_rtentry(struct rib_head *rnh, struct rt_addrinfo *info, if ((flags & RTF_GATEWAY) && !gateway) return (EINVAL); - if (dst && gateway && (dst->sa_family != gateway->sa_family) && - (gateway->sa_family != AF_UNSPEC) && (gateway->sa_family != AF_LINK)) + if (dst && gateway && !check_gateway(rnh, dst, gateway)) return (EINVAL); if (dst->sa_len > sizeof(((struct rtentry *)NULL)->rt_dstb)) diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c index f913a2591fcc..3041232b7223 100644 --- a/sys/netinet/ip_output.c +++ b/sys/netinet/ip_output.c @@ -293,9 +293,9 @@ done: /* rte<>ro_flags translation */ static inline void -rt_update_ro_flags(struct route *ro) +rt_update_ro_flags(struct route *ro, const struct nhop_object *nh) { - int nh_flags = ro->ro_nh->nh_flags; + int nh_flags = nh->nh_flags; ro->ro_flags &= ~ (RT_REJECT|RT_BLACKHOLE|RT_HAS_GW); @@ -495,22 +495,21 @@ again: goto bad; } } - ia = ifatoia(ro->ro_nh->nh_ifa); - ifp = ro->ro_nh->nh_ifp; - counter_u64_add(ro->ro_nh->nh_pksent, 1); - rt_update_ro_flags(ro); - if (ro->ro_nh->nh_flags & NHF_GATEWAY) - gw = &ro->ro_nh->gw4_sa; - if (ro->ro_nh->nh_flags & NHF_HOST) - isbroadcast = (ro->ro_nh->nh_flags & NHF_BROADCAST); + struct nhop_object *nh = ro->ro_nh; + + ia = ifatoia(nh->nh_ifa); + ifp = nh->nh_ifp; + counter_u64_add(nh->nh_pksent, 1); + rt_update_ro_flags(ro, nh); + if (nh->nh_flags & NHF_GATEWAY) + gw = &nh->gw4_sa; + if (nh->nh_flags & NHF_HOST) + isbroadcast = (nh->nh_flags & NHF_BROADCAST); else if (ifp->if_flags & IFF_BROADCAST) isbroadcast = in_ifaddr_broadcast(gw->sin_addr, ia); else isbroadcast = 0; - if (ro->ro_nh->nh_flags & NHF_HOST) - mtu = ro->ro_nh->nh_mtu; - else - mtu = ifp->if_mtu; + mtu = nh->nh_mtu; src = IA_SIN(ia)->sin_addr; } else { struct nhop_object *nh; From owner-dev-commits-src-all@freebsd.org Sun Aug 8 13:34:16 2021 Return-Path: Delivered-To: dev-commits-src-all@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 14FA6656762; Sun, 8 Aug 2021 13:34: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 4GjKtw03zWz4cyX; Sun, 8 Aug 2021 13:34: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 DE2C71581F; Sun, 8 Aug 2021 13:34: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 178DYFff012785; Sun, 8 Aug 2021 13:34:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 178DYFiR012784; Sun, 8 Aug 2021 13:34:15 GMT (envelope-from git) Date: Sun, 8 Aug 2021 13:34:15 GMT Message-Id: <202108081334.178DYFiR012784@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: b0cf8194c236 - main - cam: revert half of 75b5caa08ef 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: b0cf8194c2369b6a31960c52e0e47ac8c3b455d2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Aug 2021 13:34:16 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=b0cf8194c2369b6a31960c52e0e47ac8c3b455d2 commit b0cf8194c2369b6a31960c52e0e47ac8c3b455d2 Author: Edward Tomasz Napierala AuthorDate: 2021-08-08 13:24:07 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-08-08 13:24:19 +0000 cam: revert half of 75b5caa08ef This turns debugging printf() into a KASSERT(). It's for ATA for now; SCSI will came later. Reviewed By: imp Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D31380 --- sys/cam/ata/ata_xpt.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/sys/cam/ata/ata_xpt.c b/sys/cam/ata/ata_xpt.c index 946763342160..ee0fe65e2ada 100644 --- a/sys/cam/ata/ata_xpt.c +++ b/sys/cam/ata/ata_xpt.c @@ -1799,18 +1799,10 @@ ata_action(union ccb *start_ccb) { if (start_ccb->ccb_h.func_code != XPT_ATA_IO) { -#ifdef notyet KASSERT((start_ccb->ccb_h.alloc_flags & CAM_CCB_FROM_UMA) == 0, ("%s: ccb %p, func_code %#x should not be allocated " "from UMA zone\n", __func__, start_ccb, start_ccb->ccb_h.func_code)); -#else - if ((start_ccb->ccb_h.alloc_flags & CAM_CCB_FROM_UMA) != 0) { - printf("%s: ccb %p, func_code %#x should not be allocated " - "from UMA zone\n", - __func__, start_ccb, start_ccb->ccb_h.func_code); - } -#endif } switch (start_ccb->ccb_h.func_code) { From owner-dev-commits-src-all@freebsd.org Sun Aug 8 14:43:02 2021 Return-Path: Delivered-To: dev-commits-src-all@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 87768657BC3; Sun, 8 Aug 2021 14:43: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 4GjMQG3Fs7z4hcV; Sun, 8 Aug 2021 14:43: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 5798E1662D; Sun, 8 Aug 2021 14:43: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 178Eh2KJ006047; Sun, 8 Aug 2021 14:43:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 178Eh2S9006046; Sun, 8 Aug 2021 14:43:02 GMT (envelope-from git) Date: Sun, 8 Aug 2021 14:43:02 GMT Message-Id: <202108081443.178Eh2S9006046@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: 9feff969a010 - main - Remove "All Rights Reserved" from FreeBSD Foundation sys/ copyrights 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: 9feff969a01044c3083b552f06f7eb6416bc0524 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Aug 2021 14:43:02 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=9feff969a01044c3083b552f06f7eb6416bc0524 commit 9feff969a01044c3083b552f06f7eb6416bc0524 Author: Ed Maste AuthorDate: 2021-08-08 14:38:01 +0000 Commit: Ed Maste CommitDate: 2021-08-08 14:42:24 +0000 Remove "All Rights Reserved" from FreeBSD Foundation sys/ copyrights These ones were unambiguous cases where the Foundation was the only listed copyright holder (in the associated license block). Sponsored by: The FreeBSD Foundation --- sys/amd64/amd64/copyout.c | 1 - sys/amd64/amd64/efirt_support.S | 1 - sys/amd64/include/efi.h | 1 - sys/amd64/include/frame.h | 1 - sys/arm/arm/gic_common.h | 1 - sys/arm/freescale/imx/imx51_sdmareg.h | 1 - sys/arm/freescale/imx/imx51_ssireg.h | 1 - sys/arm/freescale/imx/imx_console.c | 1 - sys/arm/freescale/imx/imx_gpio.c | 1 - sys/arm/freescale/imx/imx_gpt.c | 1 - sys/arm/freescale/imx/imx_gptreg.h | 1 - sys/arm/freescale/imx/imx_wdog.c | 1 - sys/arm/freescale/imx/imx_wdogreg.h | 1 - sys/arm/freescale/imx/tzic.c | 1 - sys/arm/include/debug_monitor.h | 1 - sys/arm/include/fdt.h | 1 - sys/arm/include/ofw_machdep.h | 1 - sys/arm64/acpica/acpi_wakeup.c | 1 - sys/arm64/acpica/pci_cfgreg.c | 1 - sys/arm64/arm64/autoconf.c | 1 - sys/arm64/arm64/copyinout.S | 1 - sys/arm64/arm64/db_disasm.c | 1 - sys/arm64/arm64/db_interface.c | 1 - sys/arm64/arm64/db_trace.c | 1 - sys/arm64/arm64/debug_monitor.c | 1 - sys/arm64/arm64/dump_machdep.c | 1 - sys/arm64/arm64/gic_v3.c | 1 - sys/arm64/arm64/gic_v3_acpi.c | 1 - sys/arm64/arm64/gic_v3_fdt.c | 1 - sys/arm64/arm64/gic_v3_reg.h | 1 - sys/arm64/arm64/gic_v3_var.h | 1 - sys/arm64/arm64/gicv3_its.c | 1 - sys/arm64/arm64/mp_machdep.c | 1 - sys/arm64/arm64/stack_machdep.c | 1 - sys/arm64/arm64/sys_machdep.c | 1 - sys/arm64/arm64/unwind.c | 1 - sys/arm64/arm64/vfp.c | 1 - sys/arm64/cavium/thunder_pcie_common.c | 1 - sys/arm64/cavium/thunder_pcie_common.h | 1 - sys/arm64/cavium/thunder_pcie_pem.c | 1 - sys/arm64/include/bus_dma_impl.h | 1 - sys/arm64/include/debug_monitor.h | 1 - sys/arm64/include/ifunc.h | 1 - sys/arm64/include/iodev.h | 1 - sys/arm64/include/ofw_machdep.h | 1 - sys/arm64/include/pci_cfgreg.h | 1 - sys/arm64/include/vfp.h | 1 - sys/compat/freebsd32/freebsd32_capability.c | 1 - sys/compat/freebsd32/freebsd32_misc.h | 1 - sys/contrib/libnv/dnvlist.c | 1 - sys/crypto/armv8/armv8_crypto.h | 1 - sys/dev/acpica/acpi_bus_if.m | 1 - sys/dev/agp/agp_i810.h | 1 - sys/dev/ata/chipsets/ata-fsl.c | 1 - sys/dev/bhnd/bhnd_eromvar.h | 1 - sys/dev/bhnd/bhnd_private.h | 1 - sys/dev/bhnd/cores/chipc/chipc_gpio.c | 1 - sys/dev/bhnd/cores/chipc/chipc_gpiovar.h | 1 - sys/dev/bhnd/cores/chipc/pwrctl/bhnd_pwrctl.h | 1 - sys/dev/bhnd/cores/pmu/bhnd_pmu_types.h | 1 - sys/dev/drm2/drm_gem.c | 1 - sys/dev/drm2/drm_gem_names.c | 1 - sys/dev/drm2/drm_gem_names.h | 1 - sys/dev/drm2/drm_linux_list_sort.c | 1 - sys/dev/fb/fbd.c | 1 - sys/dev/fdt/fdt_common.c | 1 - sys/dev/fdt/fdt_common.h | 1 - sys/dev/fdt/fdt_static_dtb.S | 1 - sys/dev/iommu/busdma_iommu.c | 1 - sys/dev/iommu/busdma_iommu.h | 1 - sys/dev/iommu/iommu.h | 1 - sys/dev/iommu/iommu_gas.c | 1 - sys/dev/iommu/iommu_gas.h | 1 - sys/dev/iommu/iommu_types.h | 1 - sys/dev/ofw/ofw_cpu.h | 1 - sys/dev/ofw/ofw_fdt.c | 1 - sys/dev/uart/uart_bus_fdt.c | 1 - sys/dev/uart/uart_cpu_arm64.c | 1 - sys/dev/uart/uart_cpu_fdt.c | 1 - sys/dev/uart/uart_dev_imx.c | 1 - sys/dev/uart/uart_dev_imx.h | 1 - sys/dev/vnic/lmac_if.m | 1 - sys/dev/vnic/thunder_bgx_fdt.c | 1 - sys/dev/vnic/thunder_mdio.c | 1 - sys/dev/vnic/thunder_mdio_fdt.c | 1 - sys/dev/vnic/thunder_mdio_var.h | 1 - sys/dev/vt/colors/vt_termcolors.c | 1 - sys/dev/vt/colors/vt_termcolors.h | 1 - sys/dev/vt/font/vt_mouse_cursor.c | 1 - sys/dev/vt/hw/efifb/efifb.c | 1 - sys/dev/vt/hw/fb/vt_early_fb.c | 1 - sys/dev/vt/hw/fb/vt_fb.c | 1 - sys/dev/vt/hw/fb/vt_fb.h | 1 - sys/dev/vt/hw/vbefb/vbefb.c | 1 - sys/dev/vt/logo/logo_freebsd.c | 1 - sys/dev/vt/vt.h | 1 - sys/dev/vt/vt_buf.c | 1 - sys/dev/vt/vt_consolectl.c | 1 - sys/dev/vt/vt_core.c | 1 - sys/dev/vt/vt_font.c | 1 - sys/dts/arm/efikamx.dts | 1 - sys/dts/arm/imx51x.dtsi | 1 - sys/i386/i386/copyout.c | 1 - sys/i386/i386/copyout_fast.s | 1 - sys/i386/i386/minidump_machdep_nopae.c | 1 - sys/i386/i386/minidump_machdep_pae.c | 1 - sys/i386/i386/pmap_nopae.c | 1 - sys/i386/i386/pmap_pae.c | 1 - sys/i386/include/pmap_base.h | 1 - sys/i386/linux/linux_copyout.c | 1 - sys/kern/kern_tc.c | 1 - sys/kern/msi_if.m | 1 - sys/kern/subr_capability.c | 1 - sys/kern/subr_rangeset.c | 1 - sys/kern/subr_terminal.c | 1 - sys/libkern/arc4random.c | 1 - sys/mips/broadcom/bcm_mips.c | 1 - sys/mips/broadcom/bcm_mipsvar.h | 1 - sys/mips/include/fdt.h | 1 - sys/net/ieee_oui.h | 1 - sys/net80211/ieee80211_hwmp.c | 1 - sys/net80211/ieee80211_mesh.c | 1 - sys/net80211/ieee80211_mesh.h | 1 - sys/opencrypto/gfmult.c | 1 - sys/opencrypto/gfmult.h | 1 - sys/opencrypto/gmac.c | 1 - sys/opencrypto/gmac.h | 1 - sys/riscv/include/bus_dma_impl.h | 1 - sys/riscv/riscv/db_interface.c | 1 - sys/sys/_rangeset.h | 1 - sys/sys/atomic_common.h | 1 - sys/sys/caprights.h | 1 - sys/sys/dnv.h | 1 - sys/sys/font.h | 1 - sys/sys/rangeset.h | 1 - sys/sys/terminal.h | 1 - sys/sys/timepps.h | 1 - sys/tools/fdt/embed_dtb.sh | 1 - sys/x86/include/busdma_impl.h | 1 - sys/x86/include/ifunc.h | 1 - sys/x86/iommu/intel_ctx.c | 1 - sys/x86/iommu/intel_dmar.h | 1 - sys/x86/iommu/intel_drv.c | 1 - sys/x86/iommu/intel_fault.c | 1 - sys/x86/iommu/intel_idpgtbl.c | 1 - sys/x86/iommu/intel_intrmap.c | 1 - sys/x86/iommu/intel_qi.c | 1 - sys/x86/iommu/intel_quirks.c | 1 - sys/x86/iommu/intel_reg.h | 1 - sys/x86/iommu/intel_utils.c | 1 - sys/x86/iommu/iommu_intrmap.h | 1 - 151 files changed, 151 deletions(-) diff --git a/sys/amd64/amd64/copyout.c b/sys/amd64/amd64/copyout.c index 36e817635694..d5f94dd39276 100644 --- a/sys/amd64/amd64/copyout.c +++ b/sys/amd64/amd64/copyout.c @@ -2,7 +2,6 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2018 The FreeBSD Foundation - * All rights reserved. * * This software was developed by Konstantin Belousov * under sponsorship from the FreeBSD Foundation. diff --git a/sys/amd64/amd64/efirt_support.S b/sys/amd64/amd64/efirt_support.S index b54b13b01fe6..7546a0765204 100644 --- a/sys/amd64/amd64/efirt_support.S +++ b/sys/amd64/amd64/efirt_support.S @@ -2,7 +2,6 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2018 The FreeBSD Foundation - * All rights reserved. * * This software was developed by Konstantin Belousov * under sponsorship from the FreeBSD Foundation. diff --git a/sys/amd64/include/efi.h b/sys/amd64/include/efi.h index 2c24bebfe548..b7bda5388c21 100644 --- a/sys/amd64/include/efi.h +++ b/sys/amd64/include/efi.h @@ -1,6 +1,5 @@ /*- * Copyright (c) 2016 The FreeBSD Foundation - * All rights reserved. * * This software was developed by Konstantin Belousov * under sponsorship from the FreeBSD Foundation. diff --git a/sys/amd64/include/frame.h b/sys/amd64/include/frame.h index f0a6fcf5bc9c..fef5ab2b3765 100644 --- a/sys/amd64/include/frame.h +++ b/sys/amd64/include/frame.h @@ -2,7 +2,6 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2018 The FreeBSD Foundation - * All rights reserved. * * This software was developed by Konstantin Belousov * under sponsorship from the FreeBSD Foundation. diff --git a/sys/arm/arm/gic_common.h b/sys/arm/arm/gic_common.h index 4289146b0086..9e8fb19300ca 100644 --- a/sys/arm/arm/gic_common.h +++ b/sys/arm/arm/gic_common.h @@ -1,6 +1,5 @@ /*- * Copyright (c) 2016 The FreeBSD Foundation - * All rights reserved. * * This software was developed by Andrew Turner under * the sponsorship of the FreeBSD Foundation. diff --git a/sys/arm/freescale/imx/imx51_sdmareg.h b/sys/arm/freescale/imx/imx51_sdmareg.h index 71c28f6bec14..7c6f14a3e715 100644 --- a/sys/arm/freescale/imx/imx51_sdmareg.h +++ b/sys/arm/freescale/imx/imx51_sdmareg.h @@ -2,7 +2,6 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2012, 2013 The FreeBSD Foundation - * All rights reserved. * * This software was developed by Oleksandr Rybalko under sponsorship * from the FreeBSD Foundation. diff --git a/sys/arm/freescale/imx/imx51_ssireg.h b/sys/arm/freescale/imx/imx51_ssireg.h index 3846b4950750..05c01a79a449 100644 --- a/sys/arm/freescale/imx/imx51_ssireg.h +++ b/sys/arm/freescale/imx/imx51_ssireg.h @@ -2,7 +2,6 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2012, 2013 The FreeBSD Foundation - * All rights reserved. * * This software was developed by Oleksandr Rybalko under sponsorship * from the FreeBSD Foundation. diff --git a/sys/arm/freescale/imx/imx_console.c b/sys/arm/freescale/imx/imx_console.c index d5ade2decd7b..b497b9cf3a14 100644 --- a/sys/arm/freescale/imx/imx_console.c +++ b/sys/arm/freescale/imx/imx_console.c @@ -1,6 +1,5 @@ /*- * Copyright (c) 2012, 2013 The FreeBSD Foundation - * All rights reserved. * * This software was developed by Oleksandr Rybalko under sponsorship * from the FreeBSD Foundation. diff --git a/sys/arm/freescale/imx/imx_gpio.c b/sys/arm/freescale/imx/imx_gpio.c index 8324d8daa30c..ef4c7917f342 100644 --- a/sys/arm/freescale/imx/imx_gpio.c +++ b/sys/arm/freescale/imx/imx_gpio.c @@ -1,6 +1,5 @@ /*- * Copyright (c) 2012, 2013 The FreeBSD Foundation - * All rights reserved. * * This software was developed by Oleksandr Rybalko under sponsorship * from the FreeBSD Foundation. diff --git a/sys/arm/freescale/imx/imx_gpt.c b/sys/arm/freescale/imx/imx_gpt.c index 6149ec6c6f04..0605f5ca3558 100644 --- a/sys/arm/freescale/imx/imx_gpt.c +++ b/sys/arm/freescale/imx/imx_gpt.c @@ -2,7 +2,6 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2012, 2013 The FreeBSD Foundation - * All rights reserved. * * This software was developed by Oleksandr Rybalko under sponsorship * from the FreeBSD Foundation. diff --git a/sys/arm/freescale/imx/imx_gptreg.h b/sys/arm/freescale/imx/imx_gptreg.h index e1c13b7d0d6a..f37f94b88425 100644 --- a/sys/arm/freescale/imx/imx_gptreg.h +++ b/sys/arm/freescale/imx/imx_gptreg.h @@ -2,7 +2,6 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2012, 2013 The FreeBSD Foundation - * All rights reserved. * * This software was developed by Oleksandr Rybalko under sponsorship * from the FreeBSD Foundation. diff --git a/sys/arm/freescale/imx/imx_wdog.c b/sys/arm/freescale/imx/imx_wdog.c index df2ae510e5fb..287a8771f791 100644 --- a/sys/arm/freescale/imx/imx_wdog.c +++ b/sys/arm/freescale/imx/imx_wdog.c @@ -2,7 +2,6 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2012, 2013 The FreeBSD Foundation - * All rights reserved. * * This software was developed by Oleksandr Rybalko under sponsorship * from the FreeBSD Foundation. diff --git a/sys/arm/freescale/imx/imx_wdogreg.h b/sys/arm/freescale/imx/imx_wdogreg.h index d192a28bbdc5..a66ca5adfc8e 100644 --- a/sys/arm/freescale/imx/imx_wdogreg.h +++ b/sys/arm/freescale/imx/imx_wdogreg.h @@ -2,7 +2,6 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2012, 2013 The FreeBSD Foundation - * All rights reserved. * * This software was developed by Oleksandr Rybalko under sponsorship * from the FreeBSD Foundation. diff --git a/sys/arm/freescale/imx/tzic.c b/sys/arm/freescale/imx/tzic.c index 6f3aca14da84..cddbd6ba9919 100644 --- a/sys/arm/freescale/imx/tzic.c +++ b/sys/arm/freescale/imx/tzic.c @@ -2,7 +2,6 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2012, 2013 The FreeBSD Foundation - * All rights reserved. * * This software was developed by Oleksandr Rybalko under sponsorship * from the FreeBSD Foundation. diff --git a/sys/arm/include/debug_monitor.h b/sys/arm/include/debug_monitor.h index c160397393ad..1271d9ec052b 100644 --- a/sys/arm/include/debug_monitor.h +++ b/sys/arm/include/debug_monitor.h @@ -1,6 +1,5 @@ /*- * Copyright (c) 2014 The FreeBSD Foundation - * All rights reserved. * * This software was developed by Semihalf under * the sponsorship of the FreeBSD Foundation. diff --git a/sys/arm/include/fdt.h b/sys/arm/include/fdt.h index e8af11c8c4b0..37849d381372 100644 --- a/sys/arm/include/fdt.h +++ b/sys/arm/include/fdt.h @@ -2,7 +2,6 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2010 The FreeBSD Foundation - * All rights reserved. * * This software was developed by Semihalf under sponsorship from * the FreeBSD Foundation. diff --git a/sys/arm/include/ofw_machdep.h b/sys/arm/include/ofw_machdep.h index 76ab31c963cf..1adbb02965c3 100644 --- a/sys/arm/include/ofw_machdep.h +++ b/sys/arm/include/ofw_machdep.h @@ -2,7 +2,6 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2009 The FreeBSD Foundation - * All rights reserved. * * This software was developed by Semihalf under sponsorship from * the FreeBSD Foundation. diff --git a/sys/arm64/acpica/acpi_wakeup.c b/sys/arm64/acpica/acpi_wakeup.c index 7724fddd0fde..8504cac5894f 100644 --- a/sys/arm64/acpica/acpi_wakeup.c +++ b/sys/arm64/acpica/acpi_wakeup.c @@ -1,6 +1,5 @@ /*- * Copyright (c) 2015 The FreeBSD Foundation - * All rights reserved. * * This software was developed by Andrew Turner under * sponsorship from the FreeBSD Foundation. diff --git a/sys/arm64/acpica/pci_cfgreg.c b/sys/arm64/acpica/pci_cfgreg.c index e80803fbaa4a..f8e777b65ff4 100644 --- a/sys/arm64/acpica/pci_cfgreg.c +++ b/sys/arm64/acpica/pci_cfgreg.c @@ -1,6 +1,5 @@ /*- * Copyright (c) 2015 The FreeBSD Foundation - * All rights reserved. * * This software was developed by Semihalf under * the sponsorship of the FreeBSD Foundation. diff --git a/sys/arm64/arm64/autoconf.c b/sys/arm64/arm64/autoconf.c index 9788c789cfc4..f762a0fe858e 100644 --- a/sys/arm64/arm64/autoconf.c +++ b/sys/arm64/arm64/autoconf.c @@ -1,6 +1,5 @@ /*- * Copyright (c) 2015 The FreeBSD Foundation - * All rights reserved. * * This software was developed by Andrew Turner under * sponsorship from the FreeBSD Foundation. diff --git a/sys/arm64/arm64/copyinout.S b/sys/arm64/arm64/copyinout.S index 45d08d3ac545..86e3c55f9a09 100644 --- a/sys/arm64/arm64/copyinout.S +++ b/sys/arm64/arm64/copyinout.S @@ -1,6 +1,5 @@ /*- * Copyright (c) 2015 The FreeBSD Foundation - * All rights reserved. * * This software was developed by Andrew Turner under * sponsorship from the FreeBSD Foundation. diff --git a/sys/arm64/arm64/db_disasm.c b/sys/arm64/arm64/db_disasm.c index 73efca0bdee9..a7d65845acbf 100644 --- a/sys/arm64/arm64/db_disasm.c +++ b/sys/arm64/arm64/db_disasm.c @@ -1,6 +1,5 @@ /*- * Copyright (c) 2015 The FreeBSD Foundation - * All rights reserved. * * This software was developed by Semihalf under * the sponsorship of the FreeBSD Foundation. diff --git a/sys/arm64/arm64/db_interface.c b/sys/arm64/arm64/db_interface.c index 5138bf3f1cab..d8ae79715a19 100644 --- a/sys/arm64/arm64/db_interface.c +++ b/sys/arm64/arm64/db_interface.c @@ -1,6 +1,5 @@ /*- * Copyright (c) 2015 The FreeBSD Foundation - * All rights reserved. * * This software was developed by Semihalf under * the sponsorship of the FreeBSD Foundation. diff --git a/sys/arm64/arm64/db_trace.c b/sys/arm64/arm64/db_trace.c index 5f018f2133b6..f6edb34e55d5 100644 --- a/sys/arm64/arm64/db_trace.c +++ b/sys/arm64/arm64/db_trace.c @@ -1,6 +1,5 @@ /*- * Copyright (c) 2015 The FreeBSD Foundation - * All rights reserved. * * This software was developed by Semihalf under * the sponsorship of the FreeBSD Foundation. diff --git a/sys/arm64/arm64/debug_monitor.c b/sys/arm64/arm64/debug_monitor.c index 8ef2ba360786..83b1f2b8b65b 100644 --- a/sys/arm64/arm64/debug_monitor.c +++ b/sys/arm64/arm64/debug_monitor.c @@ -1,6 +1,5 @@ /*- * Copyright (c) 2014 The FreeBSD Foundation - * All rights reserved. * * This software was developed by Semihalf under * the sponsorship of the FreeBSD Foundation. diff --git a/sys/arm64/arm64/dump_machdep.c b/sys/arm64/arm64/dump_machdep.c index d92777fea051..dc5126bee058 100644 --- a/sys/arm64/arm64/dump_machdep.c +++ b/sys/arm64/arm64/dump_machdep.c @@ -1,6 +1,5 @@ /*- * Copyright (c) 2015 The FreeBSD Foundation - * All rights reserved. * * This software was developed by Andrew Turner under * sponsorship from the FreeBSD Foundation. diff --git a/sys/arm64/arm64/gic_v3.c b/sys/arm64/arm64/gic_v3.c index 03b6490e7d61..3e7cd30140eb 100644 --- a/sys/arm64/arm64/gic_v3.c +++ b/sys/arm64/arm64/gic_v3.c @@ -1,6 +1,5 @@ /*- * Copyright (c) 2015-2016 The FreeBSD Foundation - * All rights reserved. * * This software was developed by Andrew Turner under * the sponsorship of the FreeBSD Foundation. diff --git a/sys/arm64/arm64/gic_v3_acpi.c b/sys/arm64/arm64/gic_v3_acpi.c index e73e37f8e851..6a090baffacf 100644 --- a/sys/arm64/arm64/gic_v3_acpi.c +++ b/sys/arm64/arm64/gic_v3_acpi.c @@ -1,6 +1,5 @@ /*- * Copyright (c) 2016 The FreeBSD Foundation - * All rights reserved. * * This software was developed by Andrew Turner under * the sponsorship of the FreeBSD Foundation. diff --git a/sys/arm64/arm64/gic_v3_fdt.c b/sys/arm64/arm64/gic_v3_fdt.c index 483d67ba6deb..d2c0611c9167 100644 --- a/sys/arm64/arm64/gic_v3_fdt.c +++ b/sys/arm64/arm64/gic_v3_fdt.c @@ -1,6 +1,5 @@ /*- * Copyright (c) 2015 The FreeBSD Foundation - * All rights reserved. * * This software was developed by Semihalf under * the sponsorship of the FreeBSD Foundation. diff --git a/sys/arm64/arm64/gic_v3_reg.h b/sys/arm64/arm64/gic_v3_reg.h index 2ba35ec9dab3..94033d28cb01 100644 --- a/sys/arm64/arm64/gic_v3_reg.h +++ b/sys/arm64/arm64/gic_v3_reg.h @@ -1,6 +1,5 @@ /*- * Copyright (c) 2015 The FreeBSD Foundation - * All rights reserved. * * This software was developed by Semihalf under * the sponsorship of the FreeBSD Foundation. diff --git a/sys/arm64/arm64/gic_v3_var.h b/sys/arm64/arm64/gic_v3_var.h index 1645c417fd8d..7722a48cb456 100644 --- a/sys/arm64/arm64/gic_v3_var.h +++ b/sys/arm64/arm64/gic_v3_var.h @@ -1,6 +1,5 @@ /*- * Copyright (c) 2015 The FreeBSD Foundation - * All rights reserved. * * This software was developed by Semihalf under * the sponsorship of the FreeBSD Foundation. diff --git a/sys/arm64/arm64/gicv3_its.c b/sys/arm64/arm64/gicv3_its.c index 8ba7aa3b2047..af587247626b 100644 --- a/sys/arm64/arm64/gicv3_its.c +++ b/sys/arm64/arm64/gicv3_its.c @@ -1,6 +1,5 @@ /*- * Copyright (c) 2015-2016 The FreeBSD Foundation - * All rights reserved. * * This software was developed by Andrew Turner under * the sponsorship of the FreeBSD Foundation. diff --git a/sys/arm64/arm64/mp_machdep.c b/sys/arm64/arm64/mp_machdep.c index 3b1a8cc89cab..63715c64641c 100644 --- a/sys/arm64/arm64/mp_machdep.c +++ b/sys/arm64/arm64/mp_machdep.c @@ -1,6 +1,5 @@ /*- * Copyright (c) 2015-2016 The FreeBSD Foundation - * All rights reserved. * * This software was developed by Andrew Turner under * sponsorship from the FreeBSD Foundation. diff --git a/sys/arm64/arm64/stack_machdep.c b/sys/arm64/arm64/stack_machdep.c index 9486e4815294..001164e7b6e3 100644 --- a/sys/arm64/arm64/stack_machdep.c +++ b/sys/arm64/arm64/stack_machdep.c @@ -1,6 +1,5 @@ /*- * Copyright (c) 2015 The FreeBSD Foundation - * All rights reserved. * * This software was developed by Andrew Turner under * sponsorship from the FreeBSD Foundation. diff --git a/sys/arm64/arm64/sys_machdep.c b/sys/arm64/arm64/sys_machdep.c index dfb2c4ad85b8..937a9f761a7c 100644 --- a/sys/arm64/arm64/sys_machdep.c +++ b/sys/arm64/arm64/sys_machdep.c @@ -1,6 +1,5 @@ /*- * Copyright (c) 2015 The FreeBSD Foundation - * All rights reserved. * * This software was developed by Andrew Turner under * sponsorship from the FreeBSD Foundation. diff --git a/sys/arm64/arm64/unwind.c b/sys/arm64/arm64/unwind.c index cd994fffb953..770158295fb5 100644 --- a/sys/arm64/arm64/unwind.c +++ b/sys/arm64/arm64/unwind.c @@ -1,6 +1,5 @@ /*- * Copyright (c) 2015 The FreeBSD Foundation - * All rights reserved. * * This software was developed by Semihalf under * the sponsorship of the FreeBSD Foundation. diff --git a/sys/arm64/arm64/vfp.c b/sys/arm64/arm64/vfp.c index 9de27349fb8d..a481b5ebb3ba 100644 --- a/sys/arm64/arm64/vfp.c +++ b/sys/arm64/arm64/vfp.c @@ -1,6 +1,5 @@ /*- * Copyright (c) 2015-2016 The FreeBSD Foundation - * All rights reserved. * * This software was developed by Andrew Turner under * sponsorship from the FreeBSD Foundation. diff --git a/sys/arm64/cavium/thunder_pcie_common.c b/sys/arm64/cavium/thunder_pcie_common.c index 8f1d4834b1a5..a47b3ba18908 100644 --- a/sys/arm64/cavium/thunder_pcie_common.c +++ b/sys/arm64/cavium/thunder_pcie_common.c @@ -1,6 +1,5 @@ /*- * Copyright (c) 2015 The FreeBSD Foundation - * All rights reserved. * * This software was developed by Semihalf under * the sponsorship of the FreeBSD Foundation. diff --git a/sys/arm64/cavium/thunder_pcie_common.h b/sys/arm64/cavium/thunder_pcie_common.h index 057dff5d3b4b..d9a34148a513 100644 --- a/sys/arm64/cavium/thunder_pcie_common.h +++ b/sys/arm64/cavium/thunder_pcie_common.h @@ -1,6 +1,5 @@ /*- * Copyright (c) 2015 The FreeBSD Foundation - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/sys/arm64/cavium/thunder_pcie_pem.c b/sys/arm64/cavium/thunder_pcie_pem.c index 9296280ad95f..45d9880571b0 100644 --- a/sys/arm64/cavium/thunder_pcie_pem.c +++ b/sys/arm64/cavium/thunder_pcie_pem.c @@ -1,6 +1,5 @@ /*- * Copyright (c) 2015 The FreeBSD Foundation - * All rights reserved. * * This software was developed by Semihalf under * the sponsorship of the FreeBSD Foundation. diff --git a/sys/arm64/include/bus_dma_impl.h b/sys/arm64/include/bus_dma_impl.h index 736376c13864..1488bd3a55da 100644 --- a/sys/arm64/include/bus_dma_impl.h +++ b/sys/arm64/include/bus_dma_impl.h @@ -1,6 +1,5 @@ /*- * Copyright (c) 2013 The FreeBSD Foundation - * All rights reserved. * * This software was developed by Konstantin Belousov * under sponsorship from the FreeBSD Foundation. diff --git a/sys/arm64/include/debug_monitor.h b/sys/arm64/include/debug_monitor.h index 4ca1a4c9248e..befc51e88304 100644 --- a/sys/arm64/include/debug_monitor.h +++ b/sys/arm64/include/debug_monitor.h @@ -1,6 +1,5 @@ /*- * Copyright (c) 2014 The FreeBSD Foundation - * All rights reserved. * * This software was developed by Semihalf under * the sponsorship of the FreeBSD Foundation. diff --git a/sys/arm64/include/ifunc.h b/sys/arm64/include/ifunc.h index cf89af7c7142..da4d856f7f92 100644 --- a/sys/arm64/include/ifunc.h +++ b/sys/arm64/include/ifunc.h @@ -1,6 +1,5 @@ /*- * Copyright (c) 2015-2018 The FreeBSD Foundation - * All rights reserved. * * This software was developed by Konstantin Belousov * under sponsorship from the FreeBSD Foundation. diff --git a/sys/arm64/include/iodev.h b/sys/arm64/include/iodev.h index 5521ff71bc5f..8752c4cb7f6b 100644 --- a/sys/arm64/include/iodev.h +++ b/sys/arm64/include/iodev.h @@ -1,6 +1,5 @@ /*- * Copyright (c) 2015 The FreeBSD Foundation - * All rights reserved. * * This software was developed by Andrew Turner under * sponsorship from the FreeBSD Foundation. diff --git a/sys/arm64/include/ofw_machdep.h b/sys/arm64/include/ofw_machdep.h index 511fc8d71c19..b2ba37cb441c 100644 --- a/sys/arm64/include/ofw_machdep.h +++ b/sys/arm64/include/ofw_machdep.h @@ -1,6 +1,5 @@ /*- * Copyright (c) 2009 The FreeBSD Foundation - * All rights reserved. * * This software was developed by Semihalf under sponsorship from * the FreeBSD Foundation. diff --git a/sys/arm64/include/pci_cfgreg.h b/sys/arm64/include/pci_cfgreg.h index 68b38aaeb5bb..fa7e93f1a7e7 100644 --- a/sys/arm64/include/pci_cfgreg.h +++ b/sys/arm64/include/pci_cfgreg.h @@ -1,6 +1,5 @@ /*- * Copyright (c) 2015 The FreeBSD Foundation - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/sys/arm64/include/vfp.h b/sys/arm64/include/vfp.h index 6689be1b15d7..629b1b7fadf4 100644 --- a/sys/arm64/include/vfp.h +++ b/sys/arm64/include/vfp.h @@ -1,6 +1,5 @@ /*- * Copyright (c) 2015 The FreeBSD Foundation - * All rights reserved. * * This software was developed by Andrew Turner under * sponsorship from the FreeBSD Foundation. diff --git a/sys/compat/freebsd32/freebsd32_capability.c b/sys/compat/freebsd32/freebsd32_capability.c index 9a39b4f4cd71..2796d2e9384f 100644 --- a/sys/compat/freebsd32/freebsd32_capability.c +++ b/sys/compat/freebsd32/freebsd32_capability.c @@ -2,7 +2,6 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2013 The FreeBSD Foundation - * All rights reserved. * * This software was developed by Pawel Jakub Dawidek under sponsorship from * the FreeBSD Foundation. diff --git a/sys/compat/freebsd32/freebsd32_misc.h b/sys/compat/freebsd32/freebsd32_misc.h index 9e0f55ae8478..f6f85adc8e72 100644 --- a/sys/compat/freebsd32/freebsd32_misc.h +++ b/sys/compat/freebsd32/freebsd32_misc.h @@ -2,7 +2,6 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2013 The FreeBSD Foundation - * All rights reserved. * * This software was developed by Pawel Jakub Dawidek under sponsorship from * the FreeBSD Foundation. diff --git a/sys/contrib/libnv/dnvlist.c b/sys/contrib/libnv/dnvlist.c index b118d379406f..3c6898d51256 100644 --- a/sys/contrib/libnv/dnvlist.c +++ b/sys/contrib/libnv/dnvlist.c @@ -2,7 +2,6 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2013 The FreeBSD Foundation - * All rights reserved. * * This software was developed by Pawel Jakub Dawidek under sponsorship from * the FreeBSD Foundation. diff --git a/sys/crypto/armv8/armv8_crypto.h b/sys/crypto/armv8/armv8_crypto.h index 0e4cd91e7062..855aabd8bac3 100644 --- a/sys/crypto/armv8/armv8_crypto.h +++ b/sys/crypto/armv8/armv8_crypto.h @@ -1,6 +1,5 @@ /*- * Copyright (c) 2016 The FreeBSD Foundation - * All rights reserved. * * This software was developed by Andrew Turner under * sponsorship from the FreeBSD Foundation. diff --git a/sys/dev/acpica/acpi_bus_if.m b/sys/dev/acpica/acpi_bus_if.m index df3f930af086..9142a89453c5 100644 --- a/sys/dev/acpica/acpi_bus_if.m +++ b/sys/dev/acpica/acpi_bus_if.m @@ -1,6 +1,5 @@ #- # Copyright (c) 2016 The FreeBSD Foundation -# All rights reserved. # # This software was developed by Andrew Turner under # sponsorship from the FreeBSD Foundation. diff --git a/sys/dev/agp/agp_i810.h b/sys/dev/agp/agp_i810.h index 211675c4a67d..d3633150fed5 100644 --- a/sys/dev/agp/agp_i810.h +++ b/sys/dev/agp/agp_i810.h @@ -2,7 +2,6 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2011 The FreeBSD Foundation - * All rights reserved. * * This software was developed by Konstantin Belousov under sponsorship from * the FreeBSD Foundation. diff --git a/sys/dev/ata/chipsets/ata-fsl.c b/sys/dev/ata/chipsets/ata-fsl.c index 32fe2a04bd19..25187390611a 100644 --- a/sys/dev/ata/chipsets/ata-fsl.c +++ b/sys/dev/ata/chipsets/ata-fsl.c @@ -2,7 +2,6 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2012 The FreeBSD Foundation - * All rights reserved. * * This software was developed by Oleksandr Rybalko under sponsorship * from the FreeBSD Foundation. diff --git a/sys/dev/bhnd/bhnd_eromvar.h b/sys/dev/bhnd/bhnd_eromvar.h index a7e6e2cf98f2..dbfed9f520ed 100644 --- a/sys/dev/bhnd/bhnd_eromvar.h +++ b/sys/dev/bhnd/bhnd_eromvar.h @@ -2,7 +2,6 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2017 The FreeBSD Foundation - * All rights reserved. * * This software was developed by Landon Fuller under sponsorship from * the FreeBSD Foundation. diff --git a/sys/dev/bhnd/bhnd_private.h b/sys/dev/bhnd/bhnd_private.h index aae25349e90e..224ea67a0b76 100644 --- a/sys/dev/bhnd/bhnd_private.h +++ b/sys/dev/bhnd/bhnd_private.h @@ -2,7 +2,6 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2017 The FreeBSD Foundation - * All rights reserved. * * This software was developed by Landon Fuller under sponsorship from * the FreeBSD Foundation. diff --git a/sys/dev/bhnd/cores/chipc/chipc_gpio.c b/sys/dev/bhnd/cores/chipc/chipc_gpio.c index 9123531d3ab6..7c75259c226f 100644 --- a/sys/dev/bhnd/cores/chipc/chipc_gpio.c +++ b/sys/dev/bhnd/cores/chipc/chipc_gpio.c @@ -2,7 +2,6 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2017 The FreeBSD Foundation - * All rights reserved. * * This software was developed by Landon Fuller under sponsorship from * the FreeBSD Foundation. diff --git a/sys/dev/bhnd/cores/chipc/chipc_gpiovar.h b/sys/dev/bhnd/cores/chipc/chipc_gpiovar.h index 640fbc1560d4..c4bbcdf47688 100644 --- a/sys/dev/bhnd/cores/chipc/chipc_gpiovar.h +++ b/sys/dev/bhnd/cores/chipc/chipc_gpiovar.h @@ -2,7 +2,6 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2017 The FreeBSD Foundation - * All rights reserved. * * This software was developed by Landon Fuller under sponsorship from * the FreeBSD Foundation. diff --git a/sys/dev/bhnd/cores/chipc/pwrctl/bhnd_pwrctl.h b/sys/dev/bhnd/cores/chipc/pwrctl/bhnd_pwrctl.h index 3d05709d5b38..01d3e76298dd 100644 --- a/sys/dev/bhnd/cores/chipc/pwrctl/bhnd_pwrctl.h +++ b/sys/dev/bhnd/cores/chipc/pwrctl/bhnd_pwrctl.h @@ -1,6 +1,5 @@ /*- * Copyright (c) 2017 The FreeBSD Foundation - * All rights reserved. * * This software was developed by Landon Fuller under sponsorship from * the FreeBSD Foundation. diff --git a/sys/dev/bhnd/cores/pmu/bhnd_pmu_types.h b/sys/dev/bhnd/cores/pmu/bhnd_pmu_types.h index 700ff3287b16..48f54f235d80 100644 --- a/sys/dev/bhnd/cores/pmu/bhnd_pmu_types.h +++ b/sys/dev/bhnd/cores/pmu/bhnd_pmu_types.h @@ -2,7 +2,6 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2017 The FreeBSD Foundation - * All rights reserved. * * This software was developed by Landon Fuller under sponsorship from * the FreeBSD Foundation. diff --git a/sys/dev/drm2/drm_gem.c b/sys/dev/drm2/drm_gem.c index 47d363a811ad..2692eb2499ae 100644 --- a/sys/dev/drm2/drm_gem.c +++ b/sys/dev/drm2/drm_gem.c @@ -2,7 +2,6 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2011 The FreeBSD Foundation - * All rights reserved. * * This software was developed by Konstantin Belousov under sponsorship from * the FreeBSD Foundation. diff --git a/sys/dev/drm2/drm_gem_names.c b/sys/dev/drm2/drm_gem_names.c index 6b0046fc042e..58dbc5a26c8f 100644 --- a/sys/dev/drm2/drm_gem_names.c +++ b/sys/dev/drm2/drm_gem_names.c @@ -2,7 +2,6 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2011 The FreeBSD Foundation - * All rights reserved. * * This software was developed by Konstantin Belousov under sponsorship from * the FreeBSD Foundation. diff --git a/sys/dev/drm2/drm_gem_names.h b/sys/dev/drm2/drm_gem_names.h index bb97c0797f74..dad66f6ef9a6 100644 --- a/sys/dev/drm2/drm_gem_names.h +++ b/sys/dev/drm2/drm_gem_names.h @@ -2,7 +2,6 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2011 The FreeBSD Foundation - * All rights reserved. * * This software was developed by Konstantin Belousov under sponsorship from * the FreeBSD Foundation. diff --git a/sys/dev/drm2/drm_linux_list_sort.c b/sys/dev/drm2/drm_linux_list_sort.c index bd7085e2a86d..f9a64154c796 100644 --- a/sys/dev/drm2/drm_linux_list_sort.c +++ b/sys/dev/drm2/drm_linux_list_sort.c @@ -2,7 +2,6 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2011 The FreeBSD Foundation - * All rights reserved. * * This software was developed by Konstantin Belousov under sponsorship from * the FreeBSD Foundation. diff --git a/sys/dev/fb/fbd.c b/sys/dev/fb/fbd.c index 36439af9256c..e577768eafdb 100644 --- a/sys/dev/fb/fbd.c +++ b/sys/dev/fb/fbd.c @@ -2,7 +2,6 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2013 The FreeBSD Foundation - * All rights reserved. * * This software was developed by Aleksandr Rybalko under sponsorship from the * FreeBSD Foundation. diff --git a/sys/dev/fdt/fdt_common.c b/sys/dev/fdt/fdt_common.c index 107c91e11425..18ac3957f7f9 100644 --- a/sys/dev/fdt/fdt_common.c +++ b/sys/dev/fdt/fdt_common.c @@ -2,7 +2,6 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2009-2014 The FreeBSD Foundation - * All rights reserved. * * This software was developed by Andrew Turner under sponsorship from * the FreeBSD Foundation. diff --git a/sys/dev/fdt/fdt_common.h b/sys/dev/fdt/fdt_common.h index 3bf4df41973c..fc2990cdae29 100644 --- a/sys/dev/fdt/fdt_common.h +++ b/sys/dev/fdt/fdt_common.h @@ -2,7 +2,6 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2009-2010 The FreeBSD Foundation - * All rights reserved. * * This software was developed by Semihalf under sponsorship from * the FreeBSD Foundation. diff --git a/sys/dev/fdt/fdt_static_dtb.S b/sys/dev/fdt/fdt_static_dtb.S index ae1fc03e5b4a..1686bc4b0099 100644 --- a/sys/dev/fdt/fdt_static_dtb.S +++ b/sys/dev/fdt/fdt_static_dtb.S @@ -1,6 +1,5 @@ /*- * Copyright (c) 2010 The FreeBSD Foundation - * All rights reserved. * * This software was developed by Semihalf under sponsorship from * the FreeBSD Foundation. diff --git a/sys/dev/iommu/busdma_iommu.c b/sys/dev/iommu/busdma_iommu.c index 9cafd49807ff..07a16e87eeda 100644 --- a/sys/dev/iommu/busdma_iommu.c +++ b/sys/dev/iommu/busdma_iommu.c @@ -2,7 +2,6 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2013 The FreeBSD Foundation - * All rights reserved. * * This software was developed by Konstantin Belousov * under sponsorship from the FreeBSD Foundation. diff --git a/sys/dev/iommu/busdma_iommu.h b/sys/dev/iommu/busdma_iommu.h index 857d3670fc6f..f911f26fa0f7 100644 --- a/sys/dev/iommu/busdma_iommu.h +++ b/sys/dev/iommu/busdma_iommu.h @@ -2,7 +2,6 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2013 The FreeBSD Foundation - * All rights reserved. * * This software was developed by Konstantin Belousov * under sponsorship from the FreeBSD Foundation. diff --git a/sys/dev/iommu/iommu.h b/sys/dev/iommu/iommu.h index ba592ea08ff1..dd803e84c2ee 100644 --- a/sys/dev/iommu/iommu.h +++ b/sys/dev/iommu/iommu.h @@ -2,7 +2,6 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2013 The FreeBSD Foundation - * All rights reserved. * * This software was developed by Konstantin Belousov * under sponsorship from the FreeBSD Foundation. diff --git a/sys/dev/iommu/iommu_gas.c b/sys/dev/iommu/iommu_gas.c index 431c0c195c35..ae54f41953c8 100644 --- a/sys/dev/iommu/iommu_gas.c +++ b/sys/dev/iommu/iommu_gas.c *** 933 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Sun Aug 8 17:35:36 2021 Return-Path: Delivered-To: dev-commits-src-all@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 8318B660AF5; Sun, 8 Aug 2021 17:35:36 +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 4GjRFN3FSwz3HKB; Sun, 8 Aug 2021 17:35:36 +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 5692718E09; Sun, 8 Aug 2021 17:35:36 +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 178HZaLY048455; Sun, 8 Aug 2021 17:35:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 178HZaUo048454; Sun, 8 Aug 2021 17:35:36 GMT (envelope-from git) Date: Sun, 8 Aug 2021 17:35:36 GMT Message-Id: <202108081735.178HZaUo048454@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: 47363e99d3d3 - main - Enable compressed debug on little-endian targets 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: 47363e99d3d312c510902b68d5cf3094ddc7bb76 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Aug 2021 17:35:36 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=47363e99d3d312c510902b68d5cf3094ddc7bb76 commit 47363e99d3d312c510902b68d5cf3094ddc7bb76 Author: Ed Maste AuthorDate: 2021-08-07 14:46:07 +0000 Commit: Ed Maste CommitDate: 2021-08-08 17:31:28 +0000 Enable compressed debug on little-endian targets Compressed debug was enabled by default in commit c910570e7573, but broke the build on big-endian targets, and so was disabled in 89ed2ecb14ce. Older versions of LLD fail with big-endian compressed debug sections. This was fixed in LLD upstream (commit c6ebc651b6fa) and merged to FreeBSD main (commit d69d07569ee2) by dim. External toolchains (e.g. the llvm12 package) will not yet have the fix. These may be used to link against base system .a archives, so compressed debug sections would cause trouble even though the base system is fixed. Enable compressed debug sections again, for little-endian targets only. As discussed on freebsd-hackers[1] I expect to undo this in the future (using compressed debug everywhere), once fixed versions of lld are widely available. Note that to be pedantically correct we should check both the compiler and the linker for compressed debug support, but given the external toolchain constraint the extra complexity does not seem worthwhile. [1] https://lists.freebsd.org/archives/freebsd-hackers/2021-August/000188.html PR: 257638 Reported by: jrtc27 [impact of .a archives] Discussed with: imp Relnotes: Yes Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31454 Revert "Disable compressed debug by default" This reverts commit 89ed2ecb14ceabc27883282cf96559a9e7d52717. --- share/mk/bsd.compiler.mk | 9 ++++++++- share/mk/bsd.sys.mk | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/share/mk/bsd.compiler.mk b/share/mk/bsd.compiler.mk index 681f6ffec14c..757361a566dd 100644 --- a/share/mk/bsd.compiler.mk +++ b/share/mk/bsd.compiler.mk @@ -235,7 +235,14 @@ ${X_}COMPILER_FEATURES+= c++11 c++14 ${X_}COMPILER_FEATURES+= c++17 .endif .if ${${X_}COMPILER_TYPE} == "clang" -${X_}COMPILER_FEATURES+= compressed-debug retpoline init-all +${X_}COMPILER_FEATURES+= retpoline init-all +# PR257638 lld fails with BE compressed debug. Fixed in main but external tool +# chains will initially not have the fix. For now limit the feature to LE +# targets. +.include +.if ${TARGET_ENDIANNESS} == "1234" +${X_}COMPILER_FEATURES+= compressed-debug +.endif .endif .if ${${X_}COMPILER_TYPE} == "clang" && ${${X_}COMPILER_VERSION} >= 100000 || \ (${${X_}COMPILER_TYPE} == "gcc" && ${${X_}COMPILER_VERSION} >= 80100) diff --git a/share/mk/bsd.sys.mk b/share/mk/bsd.sys.mk index 031d49bbaca2..a964cf6e596c 100644 --- a/share/mk/bsd.sys.mk +++ b/share/mk/bsd.sys.mk @@ -247,7 +247,7 @@ CFLAGS+= ${SSP_CFLAGS} # Additional flags passed in CFLAGS and CXXFLAGS when MK_DEBUG_FILES is # enabled. -DEBUG_FILES_CFLAGS?= -g +DEBUG_FILES_CFLAGS?= -g -gz=zlib # Allow user-specified additional warning flags, plus compiler and file # specific flag overrides, unless we've overridden this... From owner-dev-commits-src-all@freebsd.org Sun Aug 8 19:51:30 2021 Return-Path: Delivered-To: dev-commits-src-all@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 08C26662B56; Sun, 8 Aug 2021 19:51: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 4GjVG96tNHz3hL6; Sun, 8 Aug 2021 19:51: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 D4C341AB7C; Sun, 8 Aug 2021 19:51: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 178JpTHC030425; Sun, 8 Aug 2021 19:51:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 178JpTuo030424; Sun, 8 Aug 2021 19:51:29 GMT (envelope-from git) Date: Sun, 8 Aug 2021 19:51:29 GMT Message-Id: <202108081951.178JpTuo030424@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: 2a51e8823a60 - main - fork(2): comment about doubtful use of stdio and exit(3) in example 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: 2a51e8823a60180feb534176bc41d5d10e2a01b1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Aug 2021 19:51:30 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=2a51e8823a60180feb534176bc41d5d10e2a01b1 commit 2a51e8823a60180feb534176bc41d5d10e2a01b1 Author: Konstantin Belousov AuthorDate: 2021-08-05 16:03:03 +0000 Commit: Konstantin Belousov CommitDate: 2021-08-08 19:38:59 +0000 fork(2): comment about doubtful use of stdio and exit(3) in example Add fflush(stdout) as the common idiom. Explain the need to use exit() but advise against it. Reviewed by: emaste, markj Sponsored by: The FreeBSD Foundation MFC after: 3 days Differential revision: https://reviews.freebsd.org/D31425 --- lib/libc/sys/fork.2 | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/lib/libc/sys/fork.2 b/lib/libc/sys/fork.2 index d841b0bc38e1..dbde8f5275aa 100644 --- a/lib/libc/sys/fork.2 +++ b/lib/libc/sys/fork.2 @@ -28,7 +28,7 @@ .\" @(#)fork.2 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd August 2, 2021 +.Dd August 5, 2021 .Dt FORK 2 .Os .Sh NAME @@ -172,11 +172,28 @@ main(void) { pid_t pid; + /* + * If child is expected to use stdio(3), state of + * the reused io streams must be synchronized between + * parent and child, to avoid double output and other + * possible issues. + */ + fflush(stdout); + switch (pid = fork()) { case -1: err(1, "Failed to fork"); case 0: printf("Hello from child process!\en"); + + /* + * Since we wrote into stdout, child needs to use + * exit(3) and not _exit(2). This causes handlers + * registered with atexit(3) to be called twice, + * once in parent, and once in the child. If such + * behavior is undesirable, consider + * terminating child with _exit(2) or _Exit(3). + */ exit(0); default: break; From owner-dev-commits-src-all@freebsd.org Sun Aug 8 19:51:31 2021 Return-Path: Delivered-To: dev-commits-src-all@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 27F93662A92; Sun, 8 Aug 2021 19:51:31 +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 4GjVGC0WpHz3h7W; Sun, 8 Aug 2021 19:51: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 ED5E11AA12; Sun, 8 Aug 2021 19:51: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 178JpUOf030450; Sun, 8 Aug 2021 19:51:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 178JpUko030449; Sun, 8 Aug 2021 19:51:30 GMT (envelope-from git) Date: Sun, 8 Aug 2021 19:51:30 GMT Message-Id: <202108081951.178JpUko030449@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: ee62fb2e1e14 - main - _Exit(3): document implementation 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: ee62fb2e1e14eab35d4e4e92535bcac9fc91eeb8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Aug 2021 19:51:31 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=ee62fb2e1e14eab35d4e4e92535bcac9fc91eeb8 commit ee62fb2e1e14eab35d4e4e92535bcac9fc91eeb8 Author: Konstantin Belousov AuthorDate: 2021-08-05 16:04:44 +0000 Commit: Konstantin Belousov CommitDate: 2021-08-08 19:39:46 +0000 _Exit(3): document implementation Remove a useless note about unlinking temporary files, they are unlinked in tmpfile(3) [1]. Add a note about __cxa_atexit(). Explain exactly what are the FreeBSD implementation differences between exit() and _Exit(). Noted by: markj [1] Reviewed by: emaste, markj Sponsored by: The FreeBSD Foundation MFC after: 3 days Differential revision: https://reviews.freebsd.org/D31425 --- lib/libc/stdlib/exit.3 | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/lib/libc/stdlib/exit.3 b/lib/libc/stdlib/exit.3 index 9c2b79b72956..ff7a67ffcb85 100644 --- a/lib/libc/stdlib/exit.3 +++ b/lib/libc/stdlib/exit.3 @@ -32,7 +32,7 @@ .\" @(#)exit.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd March 22, 2020 +.Dd August 5, 2021 .Dt EXIT 3 .Os .Sh NAME @@ -58,17 +58,17 @@ Before termination, performs the following functions in the order listed: .Bl -enum -offset indent .It -Call the functions registered with the +Call all functions registered with the +.Xr __cxa_atexit 3 +function +(which are typically destructors from the loaded dynamic objects), +and the functions registered with the .Xr atexit 3 function, in the reverse order of their registration. .It Flush all open output streams. .It Close all open streams. -.It -Unlink all files created with the -.Xr tmpfile 3 -function. .El .Pp The @@ -76,6 +76,14 @@ The function terminates without calling the functions registered with the .Xr atexit 3 function, and may or may not perform the other actions listed. +The +.Fx +implementation of the +.Fn _Exit +function does not call destructors registered with +.Xr __cxa_atexit 3, +does not flush buffers, and does not close streams. +.Pp Both functions make the low-order eight bits of the .Fa status argument available to a parent process which has called a From owner-dev-commits-src-all@freebsd.org Sun Aug 8 19:53:04 2021 Return-Path: Delivered-To: dev-commits-src-all@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 2023C662AAF; Sun, 8 Aug 2021 19:53: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 4GjVJ00MP5z3hFF; Sun, 8 Aug 2021 19:53: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 E96091AC0A; Sun, 8 Aug 2021 19:53: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 178Jr37S034566; Sun, 8 Aug 2021 19:53:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 178Jr3Av034565; Sun, 8 Aug 2021 19:53:03 GMT (envelope-from git) Date: Sun, 8 Aug 2021 19:53:03 GMT Message-Id: <202108081953.178Jr3Av034565@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: f75caed644a5 - main - amd64 UEFI loader: stop copying staging area to 2M physical 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: f75caed644a5c8c342a1ea5e7a6d5251f82ed0b1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Aug 2021 19:53:04 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=f75caed644a5c8c342a1ea5e7a6d5251f82ed0b1 commit f75caed644a5c8c342a1ea5e7a6d5251f82ed0b1 Author: Konstantin Belousov AuthorDate: 2021-07-10 19:55:56 +0000 Commit: Konstantin Belousov CommitDate: 2021-08-08 19:52:29 +0000 amd64 UEFI loader: stop copying staging area to 2M physical On amd64, add a possibility to activate kernel with staging area in place. Add 'copy_staging' command to control this. For now, by default the old mode of copying kernel to 2M phys is retained. It is going to be changed in several weeks. On amd64, add some slop to the staging area to satisfy both requirements of the kernel startup allocator, and to have space for minor staging data increase after the final size is calculated. Add a new command 'staging_slop' to control its size. Improve staging area resizing, in particular, reallocate it anew if we cannot grow it neither down nor up. Reviewed by: kevans, markj Discussed with: emaste (the delivery plan) Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31121 --- stand/common/bootstrap.h | 3 + stand/common/load_elf.c | 15 ++ stand/efi/loader/arch/amd64/elf64_freebsd.c | 142 +++++++++++++---- stand/efi/loader/bootinfo.c | 6 +- stand/efi/loader/copy.c | 232 ++++++++++++++++++++++++---- stand/efi/loader/loader_efi.h | 10 ++ 6 files changed, 348 insertions(+), 60 deletions(-) diff --git a/stand/common/bootstrap.h b/stand/common/bootstrap.h index b7e1f8553f47..eb4e50203133 100644 --- a/stand/common/bootstrap.h +++ b/stand/common/bootstrap.h @@ -228,6 +228,9 @@ struct preloaded_file size_t f_size; /* file size */ struct kernel_module *f_modules; /* list of modules if any */ struct preloaded_file *f_next; /* next file */ +#ifdef __amd64__ + bool f_kernphys_relocatable; +#endif }; struct file_format diff --git a/stand/common/load_elf.c b/stand/common/load_elf.c index f1a9ff8e0c22..9ae91036dbb4 100644 --- a/stand/common/load_elf.c +++ b/stand/common/load_elf.c @@ -207,6 +207,18 @@ static int elf_section_header_convert(const Elf_Ehdr *ehdr, Elf_Shdr *shdr) #undef CONVERT_SWITCH #undef CONVERT_FIELD + +#ifdef __amd64__ +static bool +is_kernphys_relocatable(elf_file_t ef) +{ + Elf_Sym sym; + + return (__elfN(lookup_symbol)(ef, "kernphys", &sym, STT_OBJECT) == 0 && + sym.st_size == 8); +} +#endif + static int __elfN(load_elf_header)(char *filename, elf_file_t ef) { @@ -434,6 +446,9 @@ __elfN(loadfile_raw)(char *filename, uint64_t dest, /* Load OK, return module pointer */ *result = (struct preloaded_file *)fp; err = 0; +#ifdef __amd64__ + fp->f_kernphys_relocatable = is_kernphys_relocatable(&ef); +#endif goto out; ioerr: diff --git a/stand/efi/loader/arch/amd64/elf64_freebsd.c b/stand/efi/loader/arch/amd64/elf64_freebsd.c index a950ca55e843..d0c8ef96eeea 100644 --- a/stand/efi/loader/arch/amd64/elf64_freebsd.c +++ b/stand/efi/loader/arch/amd64/elf64_freebsd.c @@ -82,7 +82,11 @@ struct file_format *file_formats[] = { static pml4_entry_t *PT4; static pdp_entry_t *PT3; +static pdp_entry_t *PT3_l, *PT3_u; static pd_entry_t *PT2; +static pd_entry_t *PT2_l0, *PT2_l1, *PT2_l2, *PT2_l3, *PT2_u0, *PT2_u1; + +extern EFI_PHYSICAL_ADDRESS staging; static void (*trampoline)(uint64_t stack, void *copy_finish, uint64_t kernend, uint64_t modulep, pml4_entry_t *pagetable, uint64_t entry); @@ -105,6 +109,12 @@ elf64_exec(struct preloaded_file *fp) ACPI_TABLE_RSDP *rsdp; char buf[24]; int revision; + bool copy_auto; + + copy_auto = copy_staging == COPY_STAGING_AUTO; + if (copy_auto) + copy_staging = fp->f_kernphys_relocatable ? + COPY_STAGING_DISABLE : COPY_STAGING_ENABLE; /* * Report the RSDP to the kernel. While this can be found with @@ -151,57 +161,133 @@ elf64_exec(struct preloaded_file *fp) } if ((md = file_findmetadata(fp, MODINFOMD_ELFHDR)) == NULL) - return(EFTYPE); + return (EFTYPE); ehdr = (Elf_Ehdr *)&(md->md_data); - trampcode = (vm_offset_t)0x0000000040000000; + trampcode = copy_staging == COPY_STAGING_ENABLE ? + (vm_offset_t)0x0000000040000000 /* 1G */ : + (vm_offset_t)0x0000000100000000; /* 4G */; err = BS->AllocatePages(AllocateMaxAddress, EfiLoaderData, 1, (EFI_PHYSICAL_ADDRESS *)&trampcode); + if (EFI_ERROR(err)) { + printf("Unable to allocate trampoline\n"); + if (copy_auto) + copy_staging = COPY_STAGING_AUTO; + return (ENOMEM); + } bzero((void *)trampcode, EFI_PAGE_SIZE); trampstack = trampcode + EFI_PAGE_SIZE - 8; bcopy((void *)&amd64_tramp, (void *)trampcode, amd64_tramp_size); trampoline = (void *)trampcode; - PT4 = (pml4_entry_t *)0x0000000040000000; - err = BS->AllocatePages(AllocateMaxAddress, EfiLoaderData, 3, - (EFI_PHYSICAL_ADDRESS *)&PT4); - bzero(PT4, 3 * EFI_PAGE_SIZE); + if (copy_staging == COPY_STAGING_ENABLE) { + PT4 = (pml4_entry_t *)0x0000000040000000; + err = BS->AllocatePages(AllocateMaxAddress, EfiLoaderData, 3, + (EFI_PHYSICAL_ADDRESS *)&PT4); + if (EFI_ERROR(err)) { + printf("Unable to allocate trampoline page table\n"); + BS->FreePages(trampcode, 1); + if (copy_auto) + copy_staging = COPY_STAGING_AUTO; + return (ENOMEM); + } + bzero(PT4, 3 * EFI_PAGE_SIZE); + PT3 = &PT4[512]; + PT2 = &PT3[512]; + + /* + * This is kinda brutal, but every single 1GB VM + * memory segment points to the same first 1GB of + * physical memory. But it is more than adequate. + */ + for (i = 0; i < NPTEPG; i++) { + /* + * Each slot of the L4 pages points to the + * same L3 page. + */ + PT4[i] = (pml4_entry_t)PT3; + PT4[i] |= PG_V | PG_RW; + + /* + * Each slot of the L3 pages points to the + * same L2 page. + */ + PT3[i] = (pdp_entry_t)PT2; + PT3[i] |= PG_V | PG_RW; + + /* + * The L2 page slots are mapped with 2MB pages for 1GB. + */ + PT2[i] = (pd_entry_t)i * (2 * 1024 * 1024); + PT2[i] |= PG_V | PG_RW | PG_PS; + } + } else { + PT4 = (pml4_entry_t *)0x0000000100000000; /* 4G */ + err = BS->AllocatePages(AllocateMaxAddress, EfiLoaderData, 9, + (EFI_PHYSICAL_ADDRESS *)&PT4); + if (EFI_ERROR(err)) { + printf("Unable to allocate trampoline page table\n"); + BS->FreePages(trampcode, 9); + if (copy_auto) + copy_staging = COPY_STAGING_AUTO; + return (ENOMEM); + } - PT3 = &PT4[512]; - PT2 = &PT3[512]; + bzero(PT4, 9 * EFI_PAGE_SIZE); + + PT3_l = &PT4[NPML4EPG * 1]; + PT3_u = &PT4[NPML4EPG * 2]; + PT2_l0 = &PT4[NPML4EPG * 3]; + PT2_l1 = &PT4[NPML4EPG * 4]; + PT2_l2 = &PT4[NPML4EPG * 5]; + PT2_l3 = &PT4[NPML4EPG * 6]; + PT2_u0 = &PT4[NPML4EPG * 7]; + PT2_u1 = &PT4[NPML4EPG * 8]; + + /* 1:1 mapping of lower 4G */ + PT4[0] = (pml4_entry_t)PT3_l | PG_V | PG_RW; + PT3_l[0] = (pdp_entry_t)PT2_l0 | PG_V | PG_RW; + PT3_l[1] = (pdp_entry_t)PT2_l1 | PG_V | PG_RW; + PT3_l[2] = (pdp_entry_t)PT2_l2 | PG_V | PG_RW; + PT3_l[3] = (pdp_entry_t)PT2_l3 | PG_V | PG_RW; + for (i = 0; i < 4 * NPDEPG; i++) { + PT2_l0[i] = ((pd_entry_t)i << PDRSHIFT) | PG_V | + PG_RW | PG_PS; + } - /* - * This is kinda brutal, but every single 1GB VM memory segment points - * to the same first 1GB of physical memory. But it is more than - * adequate. - */ - for (i = 0; i < 512; i++) { - /* Each slot of the L4 pages points to the same L3 page. */ - PT4[i] = (pml4_entry_t)PT3; - PT4[i] |= PG_V | PG_RW; - - /* Each slot of the L3 pages points to the same L2 page. */ - PT3[i] = (pdp_entry_t)PT2; - PT3[i] |= PG_V | PG_RW; - - /* The L2 page slots are mapped with 2MB pages for 1GB. */ - PT2[i] = i * (2 * 1024 * 1024); - PT2[i] |= PG_V | PG_RW | PG_PS; + /* mapping of kernel 2G below top */ + PT4[NPML4EPG - 1] = (pml4_entry_t)PT3_u | PG_V | PG_RW; + PT3_u[NPDPEPG - 2] = (pdp_entry_t)PT2_u0 | PG_V | PG_RW; + PT3_u[NPDPEPG - 1] = (pdp_entry_t)PT2_u1 | PG_V | PG_RW; + /* compat mapping of phys @0 */ + PT2_u0[0] = PG_PS | PG_V | PG_RW; + /* this maps past staging area */ + for (i = 1; i < 2 * NPDEPG; i++) { + PT2_u0[i] = ((pd_entry_t)staging + + ((pd_entry_t)i - 1) * NBPDR) | + PG_V | PG_RW | PG_PS; + } } + printf("staging %#lx (%scoping) tramp %p PT4 %p\n", + staging, copy_staging == COPY_STAGING_ENABLE ? "" : "not ", + trampoline, PT4); printf("Start @ 0x%lx ...\n", ehdr->e_entry); efi_time_fini(); err = bi_load(fp->f_args, &modulep, &kernend, true); if (err != 0) { efi_time_init(); - return(err); + if (copy_auto) + copy_staging = COPY_STAGING_AUTO; + return (err); } dev_cleanup(); - trampoline(trampstack, efi_copy_finish, kernend, modulep, PT4, - ehdr->e_entry); + trampoline(trampstack, copy_staging == COPY_STAGING_ENABLE ? + efi_copy_finish : efi_copy_finish_nop, kernend, modulep, + PT4, ehdr->e_entry); panic("exec returned"); } diff --git a/stand/efi/loader/bootinfo.c b/stand/efi/loader/bootinfo.c index 9924901d29e6..f4501f18f14c 100644 --- a/stand/efi/loader/bootinfo.c +++ b/stand/efi/loader/bootinfo.c @@ -65,6 +65,8 @@ int bi_load(char *args, vm_offset_t *modulep, vm_offset_t *kernendp, extern EFI_SYSTEM_TABLE *ST; +int boot_services_gone; + static int bi_getboothowto(char *kargs) { @@ -396,8 +398,10 @@ bi_load_efi_data(struct preloaded_file *kfp, bool exit_bs) if (!exit_bs) break; status = BS->ExitBootServices(IH, efi_mapkey); - if (!EFI_ERROR(status)) + if (!EFI_ERROR(status)) { + boot_services_gone = 1; break; + } } if (retry == 0) { diff --git a/stand/efi/loader/copy.c b/stand/efi/loader/copy.c index e723b61e3bca..b8ed4c8e027e 100644 --- a/stand/efi/loader/copy.c +++ b/stand/efi/loader/copy.c @@ -39,6 +39,11 @@ __FBSDID("$FreeBSD$"); #include "loader_efi.h" +#define M(x) ((x) * 1024 * 1024) +#define G(x) (1UL * (x) * 1024 * 1024 * 1024) + +extern int boot_services_gone; + #if defined(__i386__) || defined(__amd64__) #include #include @@ -175,24 +180,142 @@ out: #ifndef EFI_STAGING_SIZE #if defined(__arm__) -#define EFI_STAGING_SIZE 32 +#define EFI_STAGING_SIZE M(32) +#else +#define EFI_STAGING_SIZE M(64) +#endif +#endif + +#if defined(__aarch64__) || defined(__amd64__) || defined(__arm__) || \ + defined(__riscv) +#define EFI_STAGING_2M_ALIGN 1 #else -#define EFI_STAGING_SIZE 64 +#define EFI_STAGING_2M_ALIGN 0 #endif + +#if defined(__amd64__) +#define EFI_STAGING_SLOP M(8) +#else +#define EFI_STAGING_SLOP 0 #endif +static u_long staging_slop = EFI_STAGING_SLOP; + EFI_PHYSICAL_ADDRESS staging, staging_end, staging_base; int stage_offset_set = 0; ssize_t stage_offset; +static void +efi_copy_free(void) +{ + BS->FreePages(staging_base, (staging_end - staging_base) / + EFI_PAGE_SIZE); + stage_offset_set = 0; + stage_offset = 0; +} + +#ifdef __amd64__ +int copy_staging = COPY_STAGING_ENABLE; + +static int +command_copy_staging(int argc, char *argv[]) +{ + static const char *const mode[3] = { + [COPY_STAGING_ENABLE] = "enable", + [COPY_STAGING_DISABLE] = "disable", + [COPY_STAGING_AUTO] = "auto", + }; + int prev, res; + + res = CMD_OK; + if (argc > 2) { + res = CMD_ERROR; + } else if (argc == 2) { + prev = copy_staging; + if (strcmp(argv[1], "enable") == 0) + copy_staging = COPY_STAGING_ENABLE; + else if (strcmp(argv[1], "disable") == 0) + copy_staging = COPY_STAGING_DISABLE; + else if (strcmp(argv[1], "auto") == 0) + copy_staging = COPY_STAGING_AUTO; + else { + printf("usage: copy_staging enable|disable|auto\n"); + res = CMD_ERROR; + } + if (res == CMD_OK && prev != copy_staging) { + printf("changed copy_staging, unloading kernel\n"); + unload(); + efi_copy_free(); + efi_copy_init(); + } + } else { + printf("copy staging: %s\n", mode[copy_staging]); + } + return (res); +} +COMMAND_SET(copy_staging, "copy_staging", "copy staging", command_copy_staging); +#endif + +static int +command_staging_slop(int argc, char *argv[]) +{ + char *endp; + u_long new, prev; + int res; + + res = CMD_OK; + if (argc > 2) { + res = CMD_ERROR; + } else if (argc == 2) { + new = strtoul(argv[1], &endp, 0); + if (*endp != '\0') { + printf("invalid slop value\n"); + res = CMD_ERROR; + } + if (res == CMD_OK && staging_slop != new) { + printf("changed slop, unloading kernel\n"); + unload(); + efi_copy_free(); + efi_copy_init(); + } + } else { + printf("staging slop %#lx\n", staging_slop); + } + return (res); +} +COMMAND_SET(staging_slop, "staging_slop", "set staging slop", + command_staging_slop); + +#if defined(__i386__) || defined(__amd64__) +/* + * The staging area must reside in the the first 1GB or 4GB physical + * memory: see elf64_exec() in + * boot/efi/loader/arch/amd64/elf64_freebsd.c. + */ +static EFI_PHYSICAL_ADDRESS +get_staging_max(void) +{ + EFI_PHYSICAL_ADDRESS res; + +#if defined(__i386__) + res = G(1); +#elif defined(__amd64__) + res = copy_staging == COPY_STAGING_ENABLE ? G(1) : G(4); +#endif + return (res); +} +#define EFI_ALLOC_METHOD AllocateMaxAddress +#else +#define EFI_ALLOC_METHOD AllocateAnyPages +#endif + int efi_copy_init(void) { EFI_STATUS status; - unsigned long nr_pages; - nr_pages = EFI_SIZE_TO_PAGES((EFI_STAGING_SIZE) * 1024 * 1024); + nr_pages = EFI_SIZE_TO_PAGES((EFI_STAGING_SIZE)); #if defined(__i386__) || defined(__amd64__) /* @@ -203,18 +326,10 @@ efi_copy_init(void) if (running_on_hyperv()) efi_verify_staging_size(&nr_pages); - /* - * The staging area must reside in the the first 1GB physical - * memory: see elf64_exec() in - * boot/efi/loader/arch/amd64/elf64_freebsd.c. - */ - staging = 1024*1024*1024; - status = BS->AllocatePages(AllocateMaxAddress, EfiLoaderData, - nr_pages, &staging); -#else - status = BS->AllocatePages(AllocateAnyPages, EfiLoaderData, - nr_pages, &staging); + staging = get_staging_max(); #endif + status = BS->AllocatePages(EFI_ALLOC_METHOD, EfiLoaderData, + nr_pages, &staging); if (EFI_ERROR(status)) { printf("failed to allocate staging area: %lu\n", EFI_ERROR_CODE(status)); @@ -223,7 +338,7 @@ efi_copy_init(void) staging_base = staging; staging_end = staging + nr_pages * EFI_PAGE_SIZE; -#if defined(__aarch64__) || defined(__arm__) || defined(__riscv) +#if EFI_STAGING_2M_ALIGN /* * Round the kernel load address to a 2MiB value. This is needed * because the kernel builds a page table based on where it has @@ -231,7 +346,7 @@ efi_copy_init(void) * either a 1MiB or 2MiB page for this we need to make sure it * is correctly aligned for both cases. */ - staging = roundup2(staging, 2 * 1024 * 1024); + staging = roundup2(staging, M(2)); #endif return (0); @@ -240,20 +355,42 @@ efi_copy_init(void) static bool efi_check_space(vm_offset_t end) { - EFI_PHYSICAL_ADDRESS addr; + EFI_PHYSICAL_ADDRESS addr, new_base, new_staging; EFI_STATUS status; unsigned long nr_pages; + end = roundup2(end, EFI_PAGE_SIZE); + /* There is already enough space */ - if (end <= staging_end) + if (end + staging_slop <= staging_end) return (true); - end = roundup2(end, EFI_PAGE_SIZE); - nr_pages = EFI_SIZE_TO_PAGES(end - staging_end); + if (boot_services_gone) { + if (end <= staging_end) + return (true); + panic("efi_check_space: cannot expand staging area " + "after boot services were exited\n"); + } + + /* + * Add slop at the end: + * 1. amd64 kernel expects to do some very early allocations + * by carving out memory after kernend. Slop guarantees + * that it does not ovewrite anything useful. + * 2. It seems that initial calculation of the staging size + * could be somewhat smaller than actually copying in after + * boot services are exited. Slop avoids calling + * BS->AllocatePages() when it cannot work. + */ + end += staging_slop; + nr_pages = EFI_SIZE_TO_PAGES(end - staging_end); #if defined(__i386__) || defined(__amd64__) - /* X86 needs all memory to be allocated under the 1G boundary */ - if (end > 1024*1024*1024) + /* + * i386 needs all memory to be allocated under the 1G boundary. + * amd64 needs all memory to be allocated under the 1G or 4G boundary. + */ + if (end > get_staging_max()) goto before_staging; #endif @@ -268,14 +405,12 @@ efi_check_space(vm_offset_t end) before_staging: /* Try allocating space before the previous allocation */ - if (staging < nr_pages * EFI_PAGE_SIZE) { - printf("Not enough space before allocation\n"); - return (false); - } + if (staging < nr_pages * EFI_PAGE_SIZE) + goto expand; addr = staging - nr_pages * EFI_PAGE_SIZE; -#if defined(__aarch64__) || defined(__arm__) || defined(__riscv) +#if EFI_STAGING_2M_ALIGN /* See efi_copy_init for why this is needed */ - addr = rounddown2(addr, 2 * 1024 * 1024); + addr = rounddown2(addr, M(2)); #endif nr_pages = EFI_SIZE_TO_PAGES(staging_base - addr); status = BS->AllocatePages(AllocateAddress, EfiLoaderData, nr_pages, @@ -288,11 +423,42 @@ before_staging: staging_base = addr; memmove((void *)(uintptr_t)staging_base, (void *)(uintptr_t)staging, staging_end - staging); - stage_offset -= (staging - staging_base); + stage_offset -= staging - staging_base; staging = staging_base; return (true); } +expand: + nr_pages = EFI_SIZE_TO_PAGES(end - (vm_offset_t)staging); +#if EFI_STAGING_2M_ALIGN + nr_pages += M(2) / EFI_PAGE_SIZE; +#endif +#if defined(__i386__) || defined(__amd64__) + new_base = get_staging_max(); +#endif + status = BS->AllocatePages(EFI_ALLOC_METHOD, EfiLoaderData, + nr_pages, &new_base); + if (!EFI_ERROR(status)) { +#if EFI_STAGING_2M_ALIGN + new_staging = roundup2(new_base, M(2)); +#else + new_staging = new_base; +#endif + /* + * Move the old allocation and update the state so + * translation still works. + */ + memcpy((void *)(uintptr_t)new_staging, + (void *)(uintptr_t)staging, staging_end - staging); + BS->FreePages(staging_base, (staging_end - staging_base) / + EFI_PAGE_SIZE); + stage_offset -= staging - new_staging; + staging = new_staging; + staging_end = new_base + nr_pages * EFI_PAGE_SIZE; + staging_base = new_base; + return (true); + } + printf("efi_check_space: Unable to expand staging area\n"); return (false); } @@ -335,7 +501,6 @@ efi_copyout(const vm_offset_t src, void *dest, const size_t len) return (len); } - ssize_t efi_readin(readin_handle_t fd, vm_offset_t dest, const size_t len) { @@ -364,3 +529,8 @@ efi_copy_finish(void) while (src < last) *dst++ = *src++; } + +void +efi_copy_finish_nop(void) +{ +} diff --git a/stand/efi/loader/loader_efi.h b/stand/efi/loader/loader_efi.h index 4d077514e423..8254d16b1592 100644 --- a/stand/efi/loader/loader_efi.h +++ b/stand/efi/loader/loader_efi.h @@ -34,6 +34,15 @@ #include #include +#ifdef __amd64__ +enum { + COPY_STAGING_ENABLE, + COPY_STAGING_DISABLE, + COPY_STAGING_AUTO, +}; +extern int copy_staging; +#endif + int efi_autoload(void); int efi_copy_init(void); @@ -44,5 +53,6 @@ ssize_t efi_readin(readin_handle_t fd, vm_offset_t dest, const size_t len); void * efi_translate(vm_offset_t ptr); void efi_copy_finish(void); +void efi_copy_finish_nop(void); #endif /* _LOADER_EFI_COPY_H_ */ From owner-dev-commits-src-all@freebsd.org Sun Aug 8 20:27:43 2021 Return-Path: Delivered-To: dev-commits-src-all@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 9675D66305A; Sun, 8 Aug 2021 20:27: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 4GjW3z3VJNz3kT6; Sun, 8 Aug 2021 20:27:43 +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 5FEEB1B02F; Sun, 8 Aug 2021 20:27: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 178KRhWS074987; Sun, 8 Aug 2021 20:27:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 178KRhaM074986; Sun, 8 Aug 2021 20:27:43 GMT (envelope-from git) Date: Sun, 8 Aug 2021 20:27:43 GMT Message-Id: <202108082027.178KRhaM074986@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marcin Wojtas Subject: git: 5f2fe88377b1 - main - felix: Add autogenerated files to Makefile MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mw X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5f2fe88377b1b1e57c392e2284e2080f13bf3427 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Aug 2021 20:27:43 -0000 The branch main has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=5f2fe88377b1b1e57c392e2284e2080f13bf3427 commit 5f2fe88377b1b1e57c392e2284e2080f13bf3427 Author: Kornel Duleba AuthorDate: 2021-08-05 12:07:22 +0000 Commit: Marcin Wojtas CommitDate: 2021-08-08 20:27:15 +0000 felix: Add autogenerated files to Makefile A module makefile must list all the header files it uses which are generated at build time from interface definitions (.m files) in its SRCS list. Fixes: 451bcf1b3601 Reported by: ian --- sys/modules/felix/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/modules/felix/Makefile b/sys/modules/felix/Makefile index 47747ffaa11e..a9eac1080c91 100644 --- a/sys/modules/felix/Makefile +++ b/sys/modules/felix/Makefile @@ -30,5 +30,6 @@ KMOD = felix SRCS = felix.c etherswitch_if.c etherswitch_if.h +SRCS += bus_if.h device_if.h miibus_if.h ofw_bus_if.h pci_if.h .include From owner-dev-commits-src-all@freebsd.org Sun Aug 8 20:27:44 2021 Return-Path: Delivered-To: dev-commits-src-all@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 CDA7E663217; Sun, 8 Aug 2021 20: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 4GjW404dXbz3kT9; Sun, 8 Aug 2021 20: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 81A071ADEA; Sun, 8 Aug 2021 20: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 178KRiw4075011; Sun, 8 Aug 2021 20: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 178KRiZq075010; Sun, 8 Aug 2021 20:27:44 GMT (envelope-from git) Date: Sun, 8 Aug 2021 20:27:44 GMT Message-Id: <202108082027.178KRiZq075010@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marcin Wojtas Subject: git: 4b64193bed12 - main - enetc: Force correct order with DRIVER_MODULE_ORDERED MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mw X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4b64193bed12f604c1aba348472c98f7f8e64316 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Aug 2021 20:27:44 -0000 The branch main has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=4b64193bed12f604c1aba348472c98f7f8e64316 commit 4b64193bed12f604c1aba348472c98f7f8e64316 Author: Kornel Duleba AuthorDate: 2021-08-05 12:09:08 +0000 Commit: Marcin Wojtas CommitDate: 2021-08-08 20:27:15 +0000 enetc: Force correct order with DRIVER_MODULE_ORDERED The toolchain can reorder symbols, meaning that changing the order of DRIVER_MODULE macros is not enough to ensure that miibus gets registered first. Use DRIVER_MODULE_ORDERED instead to fix the problem properly. Fixes: 5ad6d28cbe6b ("enetc: Support building the driver as a loadable module.") Reported by: jhb --- sys/dev/enetc/if_enetc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/dev/enetc/if_enetc.c b/sys/dev/enetc/if_enetc.c index 46327eb419bf..2a72f807acd7 100644 --- a/sys/dev/enetc/if_enetc.c +++ b/sys/dev/enetc/if_enetc.c @@ -159,7 +159,9 @@ static driver_t enetc_driver = { static devclass_t enetc_devclass; DRIVER_MODULE(miibus, enetc, miibus_driver, miibus_devclass, NULL, NULL); -DRIVER_MODULE(enetc, pci, enetc_driver, enetc_devclass, NULL, NULL); +/* Make sure miibus gets procesed first. */ +DRIVER_MODULE_ORDERED(enetc, pci, enetc_driver, enetc_devclass, NULL, NULL, + SI_ORDER_ANY); MODULE_VERSION(enetc, 1); IFLIB_PNP_INFO(pci, enetc, enetc_vendor_info_array); From owner-dev-commits-src-all@freebsd.org Sun Aug 8 20:27:46 2021 Return-Path: Delivered-To: dev-commits-src-all@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 0B25F66360B; Sun, 8 Aug 2021 20:27: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 4GjW415kBDz3kTG; Sun, 8 Aug 2021 20:27: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 A46431AFA8; Sun, 8 Aug 2021 20:27: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 178KRjHH075041; Sun, 8 Aug 2021 20:27:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 178KRjBV075040; Sun, 8 Aug 2021 20:27:45 GMT (envelope-from git) Date: Sun, 8 Aug 2021 20:27:45 GMT Message-Id: <202108082027.178KRjBV075040@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marcin Wojtas Subject: git: ad560dee552e - main - enetc: Add autogenerated files to Makefile MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mw X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ad560dee552e24145b6a527ee94ef9e29a2d9cd2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Aug 2021 20:27:46 -0000 The branch main has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=ad560dee552e24145b6a527ee94ef9e29a2d9cd2 commit ad560dee552e24145b6a527ee94ef9e29a2d9cd2 Author: Marcin Wojtas AuthorDate: 2021-08-08 20:23:44 +0000 Commit: Marcin Wojtas CommitDate: 2021-08-08 20:27:16 +0000 enetc: Add autogenerated files to Makefile A module makefile must list all the header files it uses which are generated at build time from interface definitions (.m files) in its SRCS list. Fixes: 5ad6d28cbe6b ("enetc: Support building the driver as a loadable module.") --- sys/modules/enetc/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/modules/enetc/Makefile b/sys/modules/enetc/Makefile index 694ec2043f37..1f6bf36927bb 100644 --- a/sys/modules/enetc/Makefile +++ b/sys/modules/enetc/Makefile @@ -4,5 +4,6 @@ KMOD = if_enetc SRCS = if_enetc.c enetc_mdio.c +SRCS += bus_if.h device_if.h ifdi_if.h miibus_if.h ofw_bus_if.h pci_if.h .include From owner-dev-commits-src-all@freebsd.org Sun Aug 8 21:27:12 2021 Return-Path: Delivered-To: dev-commits-src-all@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 95462664084; Sun, 8 Aug 2021 21:27: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 4GjXNc3p6xz3sdx; Sun, 8 Aug 2021 21:27: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 69F911BF9F; Sun, 8 Aug 2021 21:27:12 +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 178LRCAh054895; Sun, 8 Aug 2021 21:27:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 178LRCXH054894; Sun, 8 Aug 2021 21:27:12 GMT (envelope-from git) Date: Sun, 8 Aug 2021 21:27:12 GMT Message-Id: <202108082127.178LRCXH054894@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: 66b8eced9723 - main - dtrace: use %zu format specifier for data of size_t type 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: 66b8eced9723b5b1fa5b05b286a9312a4d32237b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Aug 2021 21:27:12 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=66b8eced9723b5b1fa5b05b286a9312a4d32237b commit 66b8eced9723b5b1fa5b05b286a9312a4d32237b Author: Konstantin Belousov AuthorDate: 2021-08-08 21:25:49 +0000 Commit: Konstantin Belousov CommitDate: 2021-08-08 21:27:04 +0000 dtrace: use %zu format specifier for data of size_t type Sponsored by: The FreeBSD Foundation --- sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c | 2 +- sys/cddl/dev/dtrace/dtrace_load.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c b/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c index ca6fa5481856..a59edb05e2b6 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c +++ b/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c @@ -17106,7 +17106,7 @@ dtrace_attach(dev_info_t *devi, ddi_attach_cmd_t cmd) offsetof(dtrace_probe_t, dtpr_prevname)); if (dtrace_retain_max < 1) { - cmn_err(CE_WARN, "illegal value (%lu) for dtrace_retain_max; " + cmn_err(CE_WARN, "illegal value (%zu) for dtrace_retain_max; " "setting to 1", dtrace_retain_max); dtrace_retain_max = 1; } diff --git a/sys/cddl/dev/dtrace/dtrace_load.c b/sys/cddl/dev/dtrace/dtrace_load.c index 029af60d1cd8..232d7df6999c 100644 --- a/sys/cddl/dev/dtrace/dtrace_load.c +++ b/sys/cddl/dev/dtrace/dtrace_load.c @@ -119,7 +119,7 @@ dtrace_load(void *dummy) offsetof(dtrace_probe_t, dtpr_prevname)); if (dtrace_retain_max < 1) { - cmn_err(CE_WARN, "illegal value (%lu) for dtrace_retain_max; " + cmn_err(CE_WARN, "illegal value (%zu) for dtrace_retain_max; " "setting to 1", dtrace_retain_max); dtrace_retain_max = 1; } From owner-dev-commits-src-all@freebsd.org Sun Aug 8 22:29:57 2021 Return-Path: Delivered-To: dev-commits-src-all@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 0A2976697BD; Sun, 8 Aug 2021 22:29: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 4GjYn06sqBz4b2G; Sun, 8 Aug 2021 22:29: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 CF55D1CD4B; Sun, 8 Aug 2021 22:29: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 178MTuoK047591; Sun, 8 Aug 2021 22:29:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 178MTutC047590; Sun, 8 Aug 2021 22:29:56 GMT (envelope-from git) Date: Sun, 8 Aug 2021 22:29:56 GMT Message-Id: <202108082229.178MTutC047590@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: e5018628e76a - main - kbdmux(4): Make callout handler mpsafe. 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: e5018628e76a27e0f61ca03e2aa2247b3c62a158 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Aug 2021 22:29:57 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=e5018628e76a27e0f61ca03e2aa2247b3c62a158 commit e5018628e76a27e0f61ca03e2aa2247b3c62a158 Author: Alexander Motin AuthorDate: 2021-08-08 22:19:08 +0000 Commit: Alexander Motin CommitDate: 2021-08-08 22:29:48 +0000 kbdmux(4): Make callout handler mpsafe. Both callout and taskqueue now have drain() routines not requiring external locking. It allows to remove TASK flag and manual drain, so the only thing remaining for lock to protect inside the callout handler is ks_inq_length zero comparison, that can be lockless. MFC after: 2 weeks --- sys/dev/kbdmux/kbdmux.c | 61 ++++++++----------------------------------------- 1 file changed, 10 insertions(+), 51 deletions(-) diff --git a/sys/dev/kbdmux/kbdmux.c b/sys/dev/kbdmux/kbdmux.c index 409e52c21716..3bbdc78b7c1a 100644 --- a/sys/dev/kbdmux/kbdmux.c +++ b/sys/dev/kbdmux/kbdmux.c @@ -105,12 +105,6 @@ MALLOC_DEFINE(M_KBDMUX, KEYBOARD_NAME, "Keyboard multiplexor"); mtx_unlock(&(s)->ks_lock) #define KBDMUX_LOCK_ASSERT(s, w) \ mtx_assert(&(s)->ks_lock, (w)) -#define KBDMUX_SLEEP(s, f, d, t) \ - msleep(&(s)->f, &(s)->ks_lock, PCATCH | (PZERO + 1), (d), (t)) -#define KBDMUX_CALLOUT_INIT(s) \ - callout_init_mtx(&(s)->ks_timo, &(s)->ks_lock, 0) -#define KBDMUX_QUEUE_INTR(s) \ - taskqueue_enqueue(taskqueue_swi_giant, &(s)->ks_task) #else #define KBDMUX_LOCK_DECL_GLOBAL @@ -124,12 +118,6 @@ MALLOC_DEFINE(M_KBDMUX, KEYBOARD_NAME, "Keyboard multiplexor"); #define KBDMUX_LOCK_ASSERT(s, w) -#define KBDMUX_SLEEP(s, f, d, t) \ - tsleep(&(s)->f, PCATCH | (PZERO + 1), (d), (t)) -#define KBDMUX_CALLOUT_INIT(s) \ - callout_init(&(s)->ks_timo, 0) -#define KBDMUX_QUEUE_INTR(s) \ - taskqueue_enqueue(taskqueue_swi_giant, &(s)->ks_task) #endif /* not yet */ /* @@ -157,7 +145,6 @@ struct kbdmux_state int ks_flags; /* flags */ #define COMPOSE (1 << 0) /* compose char flag */ -#define TASK (1 << 2) /* interrupt task queued */ int ks_polling; /* poll nesting count */ int ks_mode; /* K_XLATE, K_RAW, K_CODE */ @@ -223,16 +210,8 @@ void kbdmux_kbd_intr(void *xkbd, int pending) { keyboard_t *kbd = (keyboard_t *) xkbd; - kbdmux_state_t *state = (kbdmux_state_t *) kbd->kb_data; kbdd_intr(kbd, NULL); - - KBDMUX_LOCK(state); - - state->ks_flags &= ~TASK; - wakeup(&state->ks_task); - - KBDMUX_UNLOCK(state); } /* @@ -243,23 +222,12 @@ kbdmux_kbd_intr_timo(void *xstate) { kbdmux_state_t *state = (kbdmux_state_t *) xstate; - KBDMUX_LOCK_ASSERT(state, MA_OWNED); - - if (callout_pending(&state->ks_timo)) - return; /* callout was reset */ - - if (!callout_active(&state->ks_timo)) - return; /* callout was stopped */ - - callout_deactivate(&state->ks_timo); - /* queue interrupt task if needed */ - if (state->ks_inq_length > 0 && !(state->ks_flags & TASK) && - KBDMUX_QUEUE_INTR(state) == 0) - state->ks_flags |= TASK; + if (state->ks_inq_length > 0) + taskqueue_enqueue(taskqueue_swi_giant, &state->ks_task); /* re-schedule timeout */ - callout_reset(&state->ks_timo, TICKS, kbdmux_kbd_intr_timo, state); + callout_schedule(&state->ks_timo, TICKS); } /* @@ -299,9 +267,8 @@ kbdmux_kbd_event(keyboard_t *kbd, int event, void *arg) } /* queue interrupt task if needed */ - if (state->ks_inq_length > 0 && !(state->ks_flags & TASK) && - KBDMUX_QUEUE_INTR(state) == 0) - state->ks_flags |= TASK; + if (state->ks_inq_length > 0) + taskqueue_enqueue(taskqueue_swi_giant, &state->ks_task); KBDMUX_UNLOCK(state); } break; @@ -444,7 +411,7 @@ kbdmux_init(int unit, keyboard_t **kbdp, void *arg, int flags) KBDMUX_LOCK_INIT(state); TASK_INIT(&state->ks_task, 0, kbdmux_kbd_intr, (void *) kbd); - KBDMUX_CALLOUT_INIT(state); + callout_init(&state->ks_timo, 1); SLIST_INIT(&state->ks_kbds); } else if (KBD_IS_INITIALIZED(*kbdp) && KBD_IS_CONFIGURED(*kbdp)) { return (0); @@ -521,9 +488,7 @@ kbdmux_init(int unit, keyboard_t **kbdp, void *arg, int flags) KBD_CONFIG_DONE(kbd); - KBDMUX_LOCK(state); callout_reset(&state->ks_timo, TICKS, kbdmux_kbd_intr_timo, state); - KBDMUX_UNLOCK(state); } return (0); @@ -555,16 +520,8 @@ kbdmux_term(keyboard_t *kbd) kbdmux_state_t *state = (kbdmux_state_t *) kbd->kb_data; kbdmux_kbd_t *k; - KBDMUX_LOCK(state); - - /* kill callout */ - callout_stop(&state->ks_timo); - - /* wait for interrupt task */ - while (state->ks_flags & TASK) - KBDMUX_SLEEP(state, ks_task, "kbdmuxc", 0); - /* release all keyboards from the mux */ + KBDMUX_LOCK(state); while ((k = SLIST_FIRST(&state->ks_kbds)) != NULL) { kbd_release(k->kbd, &k->kbd); SLIST_REMOVE_HEAD(&state->ks_kbds, next); @@ -573,9 +530,11 @@ kbdmux_term(keyboard_t *kbd) free(k, M_KBDMUX); } - KBDMUX_UNLOCK(state); + callout_drain(&state->ks_timo); + taskqueue_drain(taskqueue_swi_giant, &state->ks_task); + kbd_unregister(kbd); #ifdef EVDEV_SUPPORT