From owner-dev-commits-src-all@freebsd.org Mon Jul 26 10: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 6FA2C66A349; Mon, 26 Jul 2021 10: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 4GYGRG2hRbz4v5x; Mon, 26 Jul 2021 10: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 43654157C6; Mon, 26 Jul 2021 10: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 16QAUoK4046041; Mon, 26 Jul 2021 10:30:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QAUoKC046040; Mon, 26 Jul 2021 10:30:50 GMT (envelope-from git) Date: Mon, 26 Jul 2021 10:30:50 GMT Message-Id: <202107261030.16QAUoKC046040@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: ccc510b46340 - main - linux: implement signal delivery on arm64 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: ccc510b46340da563e21549a1a0cb99915d8d623 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, 26 Jul 2021 10:30:50 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=ccc510b46340da563e21549a1a0cb99915d8d623 commit ccc510b46340da563e21549a1a0cb99915d8d623 Author: Edward Tomasz Napierala AuthorDate: 2021-07-25 06:22:47 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-07-25 06:22:57 +0000 linux: implement signal delivery on arm64 Note that this still uses FreeBSD-style sigframe; this will be addressed later. Reviewed By: dchagin Sponsored By: EPSRC Differential Revision: https://reviews.freebsd.org/D31258 --- sys/arm64/linux/linux.h | 10 ++++ sys/arm64/linux/linux_locore.asm | 4 +- sys/arm64/linux/linux_sysvec.c | 98 ++++++++++++++++++++++++++++++++++++++-- 3 files changed, 106 insertions(+), 6 deletions(-) diff --git a/sys/arm64/linux/linux.h b/sys/arm64/linux/linux.h index ab3bab8264f4..7ea169b962b4 100644 --- a/sys/arm64/linux/linux.h +++ b/sys/arm64/linux/linux.h @@ -243,6 +243,16 @@ typedef struct l_siginfo { #define lsi_band _sifields._sigpoll._band #define lsi_fd _sifields._sigpoll._fd +/* + * This structure is different from the one used by Linux, + * but it doesn't matter - it's not user-accessible. We need + * it instead of the native one because of l_siginfo. + */ +struct l_sigframe { + struct l_siginfo sf_si; + ucontext_t sf_uc; +}; + union l_semun { l_int val; l_uintptr_t buf; diff --git a/sys/arm64/linux/linux_locore.asm b/sys/arm64/linux/linux_locore.asm index 24a48d74f7b5..0311c2e7e7e9 100644 --- a/sys/arm64/linux/linux_locore.asm +++ b/sys/arm64/linux/linux_locore.asm @@ -44,7 +44,9 @@ linux_platform: .text + nop /* This is what Linux calls a "Mysterious NOP". */ ENTRY(__kernel_rt_sigreturn) - brk #0 /* LINUXTODO: implement __kernel_rt_sigreturn */ + mov x8, #LINUX_SYS_linux_rt_sigreturn + svc #0 ret END(__kernel_rt_sigreturn) diff --git a/sys/arm64/linux/linux_sysvec.c b/sys/arm64/linux/linux_sysvec.c index 72621b4bbfbd..3625155111f2 100644 --- a/sys/arm64/linux/linux_sysvec.c +++ b/sys/arm64/linux/linux_sysvec.c @@ -37,12 +37,14 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include #include #include #include +#include #include #include @@ -61,6 +63,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -407,18 +410,103 @@ linux_exec_setregs(struct thread *td, struct image_params *imgp, int linux_rt_sigreturn(struct thread *td, struct linux_rt_sigreturn_args *args) { + struct l_sigframe frame; + struct trapframe *tf; + int error; + + tf = td->td_frame; + + if (copyin((void *)tf->tf_sp, &frame, sizeof(frame))) + return (EFAULT); - /* LINUXTODO: implement */ - LIN_SDT_PROBE0(sysvec, linux_rt_sigreturn, todo); - return (EDOOFUS); + error = set_mcontext(td, &frame.sf_uc.uc_mcontext); + if (error != 0) + return (error); + + /* Restore signal mask. */ + kern_sigprocmask(td, SIG_SETMASK, &frame.sf_uc.uc_sigmask, NULL, 0); + + return (EJUSTRETURN); } static void linux_rt_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask) { + struct thread *td; + struct proc *p; + struct trapframe *tf; + struct l_sigframe *fp, frame; + struct sigacts *psp; + int onstack, sig; + uint32_t spsr; + + td = curthread; + p = td->td_proc; + PROC_LOCK_ASSERT(p, MA_OWNED); + + sig = ksi->ksi_signo; + psp = p->p_sigacts; + mtx_assert(&psp->ps_mtx, MA_OWNED); + + tf = td->td_frame; + onstack = sigonstack(tf->tf_sp); + + CTR4(KTR_SIG, "sendsig: td=%p (%s) catcher=%p sig=%d", td, p->p_comm, + catcher, sig); + + /* Allocate and validate space for the signal handler context. */ + if ((td->td_pflags & TDP_ALTSTACK) != 0 && !onstack && + SIGISMEMBER(psp->ps_sigonstack, sig)) { + fp = (struct l_sigframe *)((uintptr_t)td->td_sigstk.ss_sp + + td->td_sigstk.ss_size); +#if defined(COMPAT_43) + td->td_sigstk.ss_flags |= SS_ONSTACK; +#endif + } else { + fp = (struct l_sigframe *)td->td_frame->tf_sp; + } + + /* Make room, keeping the stack aligned */ + fp--; + fp = (struct l_sigframe *)STACKALIGN(fp); + + /* Fill in the frame to copy out */ + bzero(&frame, sizeof(frame)); + get_mcontext(td, &frame.sf_uc.uc_mcontext, 0); + spsr = frame.sf_uc.uc_mcontext.mc_gpregs.gp_spsr; + + /* Translate the signal. */ + sig = bsd_to_linux_signal(sig); + + siginfo_to_lsiginfo(&ksi->ksi_info, &frame.sf_si, sig); + frame.sf_uc.uc_sigmask = *mask; + frame.sf_uc.uc_stack = td->td_sigstk; + frame.sf_uc.uc_stack.ss_flags = (td->td_pflags & TDP_ALTSTACK) != 0 ? + (onstack ? SS_ONSTACK : 0) : SS_DISABLE; + mtx_unlock(&psp->ps_mtx); + PROC_UNLOCK(td->td_proc); + + /* Copy the sigframe out to the user's stack. */ + if (copyout(&frame, fp, sizeof(*fp)) != 0) { + /* Process has trashed its stack. Kill it. */ + CTR2(KTR_SIG, "sendsig: sigexit td=%p fp=%p", td, fp); + PROC_LOCK(p); + sigexit(td, SIGILL); + } + + tf->tf_x[0]= sig; + tf->tf_x[1] = (register_t)&fp->sf_si; + tf->tf_x[2] = (register_t)&fp->sf_uc; + + tf->tf_elr = (register_t)catcher; + tf->tf_sp = (register_t)fp; + tf->tf_lr = (register_t)__kernel_rt_sigreturn; + + CTR3(KTR_SIG, "sendsig: return td=%p pc=%#x sp=%#x", td, tf->tf_elr, + tf->tf_sp); - /* LINUXTODO: implement */ - LIN_SDT_PROBE0(sysvec, linux_rt_sendsig, todo); + PROC_LOCK(p); + mtx_lock(&psp->ps_mtx); } struct sysentvec elf_linux_sysvec = { From owner-dev-commits-src-all@freebsd.org Mon Jul 26 11:20: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 6B04066AD84; Mon, 26 Jul 2021 11:20: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 4GYHXG27WJz3NYk; Mon, 26 Jul 2021 11:20: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 29C2415D64; Mon, 26 Jul 2021 11:20: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 16QBKEdD008221; Mon, 26 Jul 2021 11:20:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QBKE7w008215; Mon, 26 Jul 2021 11:20:14 GMT (envelope-from git) Date: Mon, 26 Jul 2021 11:20:14 GMT Message-Id: <202107261120.16QBKE7w008215@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: b54838003cd4 - main - linux: fix sigaltstack on amd64 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: b54838003cd43845576764dbad8f587d8f8b291d 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, 26 Jul 2021 11:20:14 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=b54838003cd43845576764dbad8f587d8f8b291d commit b54838003cd43845576764dbad8f587d8f8b291d Author: Edward Tomasz Napierala AuthorDate: 2021-07-26 10:57:47 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-07-26 10:57:52 +0000 linux: fix sigaltstack on amd64 To determine whether to use alternate signal stack or not, we need to use the native signal number, not the one translated with bsd_to_linux_signal(). In practical terms, this fixes golang. Reviewed By: dchagin Fixes: 135dd0cab51 Sponsored By: EPSRC Differential Revision: https://reviews.freebsd.org/D31298 --- sys/amd64/linux/linux_sysvec.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/amd64/linux/linux_sysvec.c b/sys/amd64/linux/linux_sysvec.c index fede294ce706..75fb21c7d037 100644 --- a/sys/amd64/linux/linux_sysvec.c +++ b/sys/amd64/linux/linux_sysvec.c @@ -630,9 +630,6 @@ linux_rt_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask) LINUX_CTR4(rt_sendsig, "%p, %d, %p, %u", catcher, sig, mask, code); - /* Translate the signal. */ - sig = bsd_to_linux_signal(sig); - /* Save user context. */ bzero(&sf, sizeof(sf)); bsd_to_linux_sigset(mask, &sf.sf_sc.uc_sigmask); @@ -676,6 +673,9 @@ linux_rt_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask) /* Align to 16 bytes. */ sfp = (struct l_rt_sigframe *)((unsigned long)sp & ~0xFul); + /* Translate the signal. */ + sig = bsd_to_linux_signal(sig); + /* Build the argument list for the signal handler. */ regs->tf_rdi = sig; /* arg 1 in %rdi */ regs->tf_rax = 0; From owner-dev-commits-src-all@freebsd.org Mon Jul 26 12:31: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 A97AC66BCB3; Mon, 26 Jul 2021 12:31: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 4GYK6S2dnnz3sMs; Mon, 26 Jul 2021 12:31: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 1BB6E17131; Mon, 26 Jul 2021 12:31: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 16QCVSeP008425; Mon, 26 Jul 2021 12:31:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QCVS1X008424; Mon, 26 Jul 2021 12:31:28 GMT (envelope-from git) Date: Mon, 26 Jul 2021 12:31:28 GMT Message-Id: <202107261231.16QCVS1X008424@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: d2dc4548eb20 - main - pf: remove duplicate ERROUT_FUNCTION definition 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: d2dc4548eb20771769ce996cb0da35d8b7dca784 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, 26 Jul 2021 12:31:28 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=d2dc4548eb20771769ce996cb0da35d8b7dca784 commit d2dc4548eb20771769ce996cb0da35d8b7dca784 Author: Kristof Provost AuthorDate: 2021-07-26 05:56:04 +0000 Commit: Kristof Provost CommitDate: 2021-07-26 10:31:10 +0000 pf: remove duplicate ERROUT_FUNCTION definition Sponsored by: Modirum MDPay --- sys/netpfil/pf/pf_ioctl.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 6f45a1d1ac53..33c38eaaf9fa 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -275,14 +275,6 @@ pflog_packet_t *pflog_packet_ptr = NULL; extern u_long pf_ioctl_maxcount; -#define ERROUT_FUNCTION(target, x) \ - do { \ - error = (x); \ - SDT_PROBE3(pf, ioctl, function, error, __func__, error, \ - __LINE__); \ - goto target; \ - } while (0) - static void pfattach_vnet(void) { From owner-dev-commits-src-all@freebsd.org Mon Jul 26 13:30:40 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F1CBC66C34F; Mon, 26 Jul 2021 13:30:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYLQm68Gzz4Z4r; Mon, 26 Jul 2021 13:30: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 BB9D817CAC; Mon, 26 Jul 2021 13:30: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 16QDUe0T087747; Mon, 26 Jul 2021 13:30:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QDUeMP087746; Mon, 26 Jul 2021 13:30:40 GMT (envelope-from git) Date: Mon, 26 Jul 2021 13:30:40 GMT Message-Id: <202107261330.16QDUeMP087746@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Leandro Lupori Subject: git: b48a2770d48b - main - powerpc64: add Power8 and Power9 PMCs MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: luporl X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b48a2770d48b9f9aa61788704897e9a2e9e10c09 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, 26 Jul 2021 13:30:41 -0000 The branch main has been updated by luporl: URL: https://cgit.FreeBSD.org/src/commit/?id=b48a2770d48b9f9aa61788704897e9a2e9e10c09 commit b48a2770d48b9f9aa61788704897e9a2e9e10c09 Author: Leandro Lupori AuthorDate: 2021-07-23 18:09:09 +0000 Commit: Leandro Lupori CommitDate: 2021-07-26 13:27:23 +0000 powerpc64: add Power8 and Power9 PMCs Add support to allocate Power8 and 9 PMCs. Submitted by: Leonardo Bianconi Reviewed by: mhorne Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br) Differential Revision: https://reviews.freebsd.org/D31109 --- lib/libpmc/libpmc_pmu_util.c | 34 ++++++++++++++++++++++++ sys/dev/hwpmc/hwpmc_power8.c | 59 +++++++++++++++++++++++++++++++++++++++--- sys/dev/hwpmc/hwpmc_powerpc.c | 3 +++ sys/powerpc/include/pmc_mdep.h | 1 + 4 files changed, 93 insertions(+), 4 deletions(-) diff --git a/lib/libpmc/libpmc_pmu_util.c b/lib/libpmc/libpmc_pmu_util.c index e6f74e6abe81..edd99357678e 100644 --- a/lib/libpmc/libpmc_pmu_util.c +++ b/lib/libpmc/libpmc_pmu_util.c @@ -142,6 +142,13 @@ pmu_alias_get(const char *name) return (name); } +#elif defined(__powerpc64__) + +static const char * +pmu_alias_get(const char *name) +{ + return (name); +} #elif defined(__aarch64__) @@ -571,6 +578,33 @@ pmc_pmu_pmcallocate(const char *event_name, struct pmc_op_pmcallocate *pm) return (pmc_pmu_amd_pmcallocate(event_name, pm, &ped)); } +#elif defined(__powerpc64__) + +int +pmc_pmu_pmcallocate(const char *event_name, struct pmc_op_pmcallocate *pm) +{ + const struct pmu_event *pe; + struct pmu_event_desc ped; + int idx = -1; + + bzero(&pm->pm_md, sizeof(pm->pm_md)); + pm->pm_caps |= (PMC_CAP_READ | PMC_CAP_WRITE); + event_name = pmu_alias_get(event_name); + + if ((pe = pmu_event_get(NULL, event_name, &idx)) == NULL) + return (ENOENT); + if (pe->event == NULL) + return (ENOENT); + if (pmu_parse_event(&ped, pe->event)) + return (ENOENT); + + assert(ped.ped_event >= 0); + pm->pm_ev = idx; + pm->pm_md.pm_event = ped.ped_event; + pm->pm_class = PMC_CLASS_POWER8; + return (0); +} + #elif defined(__aarch64__) int diff --git a/sys/dev/hwpmc/hwpmc_power8.c b/sys/dev/hwpmc/hwpmc_power8.c index 7cc2ac8295f6..ce063a57a10e 100644 --- a/sys/dev/hwpmc/hwpmc_power8.c +++ b/sys/dev/hwpmc/hwpmc_power8.c @@ -43,6 +43,12 @@ __FBSDID("$FreeBSD$"); #define POWER8_MAX_PMCS 6 +#define PM_EVENT_CODE(pe) (pe & 0xffff) +#define PM_EVENT_COUNTER(pe) ((pe >> 16) & 0xffff) + +#define PM_CYC 0x1e +#define PM_INST_CMPL 0x02 + static struct pmc_ppc_event power8_event_codes[] = { {PMC_EV_POWER8_INSTR_COMPLETED, .pe_flags = PMC_FLAG_PMC5, @@ -275,6 +281,54 @@ power8_resume_pmc(bool ie) mtspr(SPR_MMCR0, mmcr0); } +static int +power8_allocate_pmc(int cpu, int ri, struct pmc *pm, + const struct pmc_op_pmcallocate *a) +{ + uint32_t caps, config, counter, pe; + + KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), + ("[powerpc,%d] illegal CPU value %d", __LINE__, cpu)); + KASSERT(ri >= 0 && ri < ppc_max_pmcs, + ("[powerpc,%d] illegal row index %d", __LINE__, ri)); + + pe = a->pm_md.pm_event; + counter = PM_EVENT_COUNTER(pe); + config = PM_EVENT_CODE(pe); + + /* + * PMC5 and PMC6 are not programmable and always count instructions + * completed and cycles, respectively. + * + * When counter is 0 any of the 4 programmable PMCs may be used for + * the specified event, otherwise it must match ri + 1. + */ + if (counter == 0 && config == PM_INST_CMPL) + counter = 5; + else if (counter == 0 && config == PM_CYC) + counter = 6; + else if (counter > 4) + return (EINVAL); + + if (counter != 0 && counter != ri + 1) + return (EINVAL); + + caps = a->pm_caps; + + if (caps & PMC_CAP_SYSTEM) + config |= POWERPC_PMC_KERNEL_ENABLE; + if (caps & PMC_CAP_USER) + config |= POWERPC_PMC_USER_ENABLE; + if ((caps & (PMC_CAP_USER | PMC_CAP_SYSTEM)) == 0) + config |= POWERPC_PMC_ENABLE; + + pm->pm_md.pm_powerpc.pm_powerpc_evsel = config; + + PMCDBG3(MDP,ALL,1,"powerpc-allocate cpu=%d ri=%d -> config=0x%x", + cpu, ri, config); + return (0); +} + int pmc_power8_initialize(struct pmc_mdep *pmc_mdep) { @@ -291,7 +345,7 @@ pmc_power8_initialize(struct pmc_mdep *pmc_mdep) pcd->pcd_pcpu_init = power8_pcpu_init; pcd->pcd_pcpu_fini = power8_pcpu_fini; - pcd->pcd_allocate_pmc = powerpc_allocate_pmc; + pcd->pcd_allocate_pmc = power8_allocate_pmc; pcd->pcd_release_pmc = powerpc_release_pmc; pcd->pcd_start_pmc = powerpc_start_pmc; pcd->pcd_stop_pmc = powerpc_stop_pmc; @@ -304,10 +358,7 @@ pmc_power8_initialize(struct pmc_mdep *pmc_mdep) pmc_mdep->pmd_npmc += POWER8_MAX_PMCS; pmc_mdep->pmd_intr = powerpc_pmc_intr; - ppc_event_codes = power8_event_codes; ppc_event_codes_size = power8_event_codes_size; - ppc_event_first = PMC_EV_POWER8_FIRST; - ppc_event_last = PMC_EV_POWER8_LAST; ppc_max_pmcs = POWER8_MAX_PMCS; powerpc_set_pmc = power8_set_pmc; diff --git a/sys/dev/hwpmc/hwpmc_powerpc.c b/sys/dev/hwpmc/hwpmc_powerpc.c index e97211f0d9a6..3a2115ece3cb 100644 --- a/sys/dev/hwpmc/hwpmc_powerpc.c +++ b/sys/dev/hwpmc/hwpmc_powerpc.c @@ -603,6 +603,9 @@ pmc_md_initialize() pmc_mdep = NULL; } + /* Set the value for kern.hwpmc.cpuid */ + snprintf(pmc_cpuid, sizeof(pmc_cpuid), "%08lx", mfpvr()); + return (pmc_mdep); } diff --git a/sys/powerpc/include/pmc_mdep.h b/sys/powerpc/include/pmc_mdep.h index 0a1609196ef9..3d31ff7b99cd 100644 --- a/sys/powerpc/include/pmc_mdep.h +++ b/sys/powerpc/include/pmc_mdep.h @@ -10,6 +10,7 @@ #define PMC_MDEP_CLASS_INDEX_POWERPC 1 union pmc_md_op_pmcallocate { + uint32_t pm_event; uint64_t __pad[4]; }; From owner-dev-commits-src-all@freebsd.org Mon Jul 26 13:50: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 79F8A66CF2F; Mon, 26 Jul 2021 13:50: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 4GYLsZ34jZz4dWk; Mon, 26 Jul 2021 13:50: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 50DC218149; Mon, 26 Jul 2021 13:50: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 16QDoQ2K013038; Mon, 26 Jul 2021 13:50:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QDoQxf013037; Mon, 26 Jul 2021 13:50:26 GMT (envelope-from git) Date: Mon, 26 Jul 2021 13:50:26 GMT Message-Id: <202107261350.16QDoQxf013037@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: af07a7ba5836 - stable/13 - zfs: add missed dependency of zfs module on zlib 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: af07a7ba58363f4b6cdfb9cf456d6231c73a6b34 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, 26 Jul 2021 13:50:26 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=af07a7ba58363f4b6cdfb9cf456d6231c73a6b34 commit af07a7ba58363f4b6cdfb9cf456d6231c73a6b34 Author: Konstantin Belousov AuthorDate: 2021-07-17 14:59:47 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-26 13:50:13 +0000 zfs: add missed dependency of zfs module on zlib (cherry picked from commit dbaad75f2834f40bfe74ebe393d2101967052036) --- sys/contrib/openzfs/module/os/freebsd/zfs/kmod_core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/contrib/openzfs/module/os/freebsd/zfs/kmod_core.c b/sys/contrib/openzfs/module/os/freebsd/zfs/kmod_core.c index d5ba0d93a569..1a7bcbabd0a5 100644 --- a/sys/contrib/openzfs/module/os/freebsd/zfs/kmod_core.c +++ b/sys/contrib/openzfs/module/os/freebsd/zfs/kmod_core.c @@ -371,3 +371,4 @@ MODULE_DEPEND(zfsctrl, krpc, 1, 1, 1); #endif MODULE_DEPEND(zfsctrl, acl_nfs4, 1, 1, 1); MODULE_DEPEND(zfsctrl, crypto, 1, 1, 1); +MODULE_DEPEND(zfsctrl, zlib, 1, 1, 1); From owner-dev-commits-src-all@freebsd.org Mon Jul 26 15:19: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 C44A266DAA7; Mon, 26 Jul 2021 15:19: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 4GYNrB4kh4z3JbN; Mon, 26 Jul 2021 15:19: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 7C9AC190D4; Mon, 26 Jul 2021 15:19: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 16QFJM7Q025276; Mon, 26 Jul 2021 15:19:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QFJMPn025275; Mon, 26 Jul 2021 15:19:22 GMT (envelope-from git) Date: Mon, 26 Jul 2021 15:19:22 GMT Message-Id: <202107261519.16QFJMPn025275@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: 5955e8b93ece - stable/13 - mlx5: cqe64: update the tunneled bit name with recent PRM 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: 5955e8b93ece64cb1f95d9c037c209eacfc77e10 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, 26 Jul 2021 15:19:22 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=5955e8b93ece64cb1f95d9c037c209eacfc77e10 commit 5955e8b93ece64cb1f95d9c037c209eacfc77e10 Author: Konstantin Belousov AuthorDate: 2021-04-06 03:23:22 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-26 13:51:09 +0000 mlx5: cqe64: update the tunneled bit name with recent PRM (cherry picked from commit c8bdc78be19da5443c9186fa2fdb6e9427795565) --- sys/dev/mlx5/device.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sys/dev/mlx5/device.h b/sys/dev/mlx5/device.h index 69057d5f2470..64d4ed87d58f 100644 --- a/sys/dev/mlx5/device.h +++ b/sys/dev/mlx5/device.h @@ -662,8 +662,9 @@ struct mlx5_err_cqe { }; struct mlx5_cqe64 { - u8 tunneled_etc; - u8 rsvd0[3]; + u8 tls_outer_l3_tunneled; + u8 rsvd0; + __be16 wqe_id; u8 lro_tcppsh_abort_dupack; u8 lro_min_ttl; __be16 lro_tcp_win; @@ -724,7 +725,7 @@ static inline bool cqe_has_vlan(struct mlx5_cqe64 *cqe) static inline bool cqe_is_tunneled(struct mlx5_cqe64 *cqe) { - return cqe->tunneled_etc & 0x1; + return cqe->tls_outer_l3_tunneled & 0x1; } enum { From owner-dev-commits-src-all@freebsd.org Mon Jul 26 15:19: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 E7E7766DF81; Mon, 26 Jul 2021 15:19: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 4GYNrD61bDz3JVr; Mon, 26 Jul 2021 15:19: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 B53E319256; Mon, 26 Jul 2021 15:19: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 16QFJOPT025324; Mon, 26 Jul 2021 15:19:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QFJOPk025323; Mon, 26 Jul 2021 15:19:24 GMT (envelope-from git) Date: Mon, 26 Jul 2021 15:19:24 GMT Message-Id: <202107261519.16QFJOPk025323@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: 273cc11d5cb8 - stable/13 - mlx5en: increase the limit MLX5E_MAX_TX_HEADER 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: 273cc11d5cb837ded7396a8cde486de2a5c4f221 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, 26 Jul 2021 15:19:25 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=273cc11d5cb837ded7396a8cde486de2a5c4f221 commit 273cc11d5cb837ded7396a8cde486de2a5c4f221 Author: Konstantin Belousov AuthorDate: 2021-04-06 03:26:47 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-26 13:51:10 +0000 mlx5en: increase the limit MLX5E_MAX_TX_HEADER (cherry picked from commit 8b8c71d7ac31140277ab0383d22e6cb5c2d779d4) --- sys/dev/mlx5/mlx5_en/en.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/mlx5/mlx5_en/en.h b/sys/dev/mlx5/mlx5_en/en.h index 2ec47fa96a6d..86f44dda168c 100644 --- a/sys/dev/mlx5/mlx5_en/en.h +++ b/sys/dev/mlx5/mlx5_en/en.h @@ -125,7 +125,7 @@ #define MLX5E_SQ_TX_QUEUE_SIZE 4096 /* SQ drbr queue size */ #define MLX5E_MAX_TX_NUM_TC 8 /* units */ -#define MLX5E_MAX_TX_HEADER 128 /* bytes */ +#define MLX5E_MAX_TX_HEADER 192 /* bytes */ #define MLX5E_MAX_TX_PAYLOAD_SIZE 65536 /* bytes */ #define MLX5E_MAX_TX_MBUF_SIZE 65536 /* bytes */ #define MLX5E_MAX_TX_MBUF_FRAGS \ From owner-dev-commits-src-all@freebsd.org Mon Jul 26 15:19: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 182C266DAAA; Mon, 26 Jul 2021 15:19: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 4GYNrC56SJz3JVl; Mon, 26 Jul 2021 15:19: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 90DB419255; Mon, 26 Jul 2021 15:19: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 16QFJNve025300; Mon, 26 Jul 2021 15:19:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QFJN1s025299; Mon, 26 Jul 2021 15:19:23 GMT (envelope-from git) Date: Mon, 26 Jul 2021 15:19:23 GMT Message-Id: <202107261519.16QFJN1s025299@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: 3e8436ec78b8 - stable/13 - mlx5: Flow steering tree: increase number of supported flow tables from 3 to 5 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: 3e8436ec78b89d40f4b405971f76791e6629fb2a 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, 26 Jul 2021 15:19:24 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=3e8436ec78b89d40f4b405971f76791e6629fb2a commit 3e8436ec78b89d40f4b405971f76791e6629fb2a Author: Konstantin Belousov AuthorDate: 2021-04-06 03:24:19 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-26 13:51:10 +0000 mlx5: Flow steering tree: increase number of supported flow tables from 3 to 5 (cherry picked from commit bc56a8f9e7abc20820757298cbb32c4aaa4fc0bc) --- sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c b/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c index e7951682e56d..55c7896e3d52 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c @@ -66,7 +66,7 @@ #define BYPASS_MAX_FT 5 #define BYPASS_PRIO_MAX_FT 1 -#define KERNEL_MAX_FT 3 +#define KERNEL_MAX_FT 5 #define LEFTOVER_MAX_FT 1 #define KENREL_MIN_LEVEL 3 #define LEFTOVER_MIN_LEVEL KENREL_MIN_LEVEL + 1 From owner-dev-commits-src-all@freebsd.org Mon Jul 26 15:19: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 4A86D66DB2D; Mon, 26 Jul 2021 15:19: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 4GYNrG03V3z3JYV; Mon, 26 Jul 2021 15:19: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 D58EF19627; Mon, 26 Jul 2021 15:19: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 16QFJPcP025354; Mon, 26 Jul 2021 15:19:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QFJPlW025353; Mon, 26 Jul 2021 15:19:25 GMT (envelope-from git) Date: Mon, 26 Jul 2021 15:19:25 GMT Message-Id: <202107261519.16QFJPlW025353@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: f9b965c23857 - stable/13 - mlx5en: style, remove redundant parentheses 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: f9b965c2385766f5eb5e9253f116900f02b0d048 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, 26 Jul 2021 15:19:26 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=f9b965c2385766f5eb5e9253f116900f02b0d048 commit f9b965c2385766f5eb5e9253f116900f02b0d048 Author: Konstantin Belousov AuthorDate: 2021-04-06 03:29:22 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-26 13:51:10 +0000 mlx5en: style, remove redundant parentheses (cherry picked from commit 16816f968917f15ba69fe56faafe4564439c6d47) --- sys/dev/mlx5/mlx5_en/mlx5_en_tx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c b/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c index c8dd21f6aadc..124d2afe414c 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c @@ -256,7 +256,7 @@ mlx5e_get_full_header_size(const struct mbuf *mb, const struct tcphdr **ppth) if (unlikely(mb->m_len < ETHER_HDR_LEN)) goto failure; if (eh->evl_encap_proto == htons(ETHERTYPE_VLAN)) { - if (unlikely(mb->m_len < (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN))) + if (unlikely(mb->m_len < ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN)) goto failure; eth_type = ntohs(eh->evl_proto); eth_hdr_len = ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN; From owner-dev-commits-src-all@freebsd.org Mon Jul 26 15:19: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 432E066D5F0; Mon, 26 Jul 2021 15:19: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 4GYNrJ2hLbz3Jds; Mon, 26 Jul 2021 15:19: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 174E319425; Mon, 26 Jul 2021 15:19: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 16QFJSB5025403; Mon, 26 Jul 2021 15:19:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QFJSPC025402; Mon, 26 Jul 2021 15:19:28 GMT (envelope-from git) Date: Mon, 26 Jul 2021 15:19:28 GMT Message-Id: <202107261519.16QFJSPC025402@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: 8ab58a780df5 - stable/13 - mlx5en: register vxlan start/stop handlers 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: 8ab58a780df5101047875c2b014ceb136a725ea8 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, 26 Jul 2021 15:19:29 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=8ab58a780df5101047875c2b014ceb136a725ea8 commit 8ab58a780df5101047875c2b014ceb136a725ea8 Author: Konstantin Belousov AuthorDate: 2021-04-06 03:38:59 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-26 13:51:10 +0000 mlx5en: register vxlan start/stop handlers (cherry picked from commit 861a612d7bad4812630c9be55e7b59d8fe2cfa18) --- sys/dev/mlx5/mlx5_en/en.h | 25 ++ sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c | 674 +++++++++++++++++++++++++++++- sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 10 + 3 files changed, 701 insertions(+), 8 deletions(-) diff --git a/sys/dev/mlx5/mlx5_en/en.h b/sys/dev/mlx5/mlx5_en/en.h index 86f44dda168c..ab30c7e2ca90 100644 --- a/sys/dev/mlx5/mlx5_en/en.h +++ b/sys/dev/mlx5/mlx5_en/en.h @@ -944,6 +944,18 @@ struct mlx5e_vlan_db { bool filter_disabled; }; +struct mlx5e_vxlan_db_el { + u_int refcount; + u_int proto; + u_int port; + struct mlx5_flow_rule *vxlan_ft_rule; + TAILQ_ENTRY(mlx5e_vxlan_db_el) link; +}; + +struct mlx5e_vxlan_db { + TAILQ_HEAD(, mlx5e_vxlan_db_el) head; +}; + struct mlx5e_flow_table { int num_groups; struct mlx5_flow_table *t; @@ -953,7 +965,11 @@ struct mlx5e_flow_table { struct mlx5e_flow_tables { struct mlx5_flow_namespace *ns; struct mlx5e_flow_table vlan; + struct mlx5e_flow_table vxlan; + struct mlx5_flow_rule *vxlan_catchall_ft_rule; struct mlx5e_flow_table main; + struct mlx5e_flow_table main_vxlan; + struct mlx5_flow_rule *main_vxlan_rule[MLX5E_NUM_TT]; struct mlx5e_flow_table inner_rss; }; @@ -1005,10 +1021,12 @@ struct mlx5e_priv { u32 tisn[MLX5E_MAX_TX_NUM_TC]; u32 rqtn; u32 tirn[MLX5E_NUM_TT]; + u32 tirn_inner_vxlan[MLX5E_NUM_TT]; struct mlx5e_flow_tables fts; struct mlx5e_eth_addr_db eth_addr; struct mlx5e_vlan_db vlan; + struct mlx5e_vxlan_db vxlan; struct mlx5e_params params; struct mlx5e_params_ethtool params_ethtool; @@ -1035,6 +1053,8 @@ struct mlx5e_priv { struct ifmedia media; int media_status_last; int media_active_last; + eventhandler_tag vxlan_start; + eventhandler_tag vxlan_stop; struct callout watchdog; @@ -1124,6 +1144,11 @@ void mlx5e_disable_vlan_filter(struct mlx5e_priv *priv); int mlx5e_add_all_vlan_rules(struct mlx5e_priv *priv); void mlx5e_del_all_vlan_rules(struct mlx5e_priv *priv); +void mlx5e_vxlan_start(void *arg, struct ifnet *ifp, sa_family_t family, + u_int port); +void mlx5e_vxlan_stop(void *arg, struct ifnet *ifp, sa_family_t family, + u_int port); + static inline void mlx5e_tx_notify_hw(struct mlx5e_sq *sq, u32 *wqe) { diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c b/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c index 20e81fe806a5..f4f9e494308e 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c @@ -450,6 +450,226 @@ add_eth_addr_rule_out: return (err); } +static void +mlx5e_del_main_vxlan_rules(struct mlx5e_priv *priv) +{ + struct mlx5_flow_rule **ra = priv->fts.main_vxlan_rule, **r; + + r = &ra[MLX5E_TT_IPV6_IPSEC_ESP]; + if (*r != NULL) { + mlx5_del_flow_rule(*r); + *r = NULL; + } + + r = &ra[MLX5E_TT_IPV4_IPSEC_ESP]; + if (*r != NULL) { + mlx5_del_flow_rule(*r); + *r = NULL; + } + + r = &ra[MLX5E_TT_IPV6_IPSEC_AH]; + if (*r != NULL) { + mlx5_del_flow_rule(*r); + *r = NULL; + } + + r = &ra[MLX5E_TT_IPV4_IPSEC_AH]; + if (*r != NULL) { + mlx5_del_flow_rule(*r); + *r = NULL; + } + + r = &ra[MLX5E_TT_IPV6_TCP]; + if (*r != NULL) { + mlx5_del_flow_rule(*r); + *r = NULL; + } + + r = &ra[MLX5E_TT_IPV4_TCP]; + if (*r != NULL) { + mlx5_del_flow_rule(*r); + *r = NULL; + } + + r = &ra[MLX5E_TT_IPV6_UDP]; + if (*r != NULL) { + mlx5_del_flow_rule(*r); + *r = NULL; + } + + r = &ra[MLX5E_TT_IPV4_UDP]; + if (*r != NULL) { + mlx5_del_flow_rule(*r); + *r = NULL; + } + + r = &ra[MLX5E_TT_IPV6]; + if (*r != NULL) { + mlx5_del_flow_rule(*r); + *r = NULL; + } + + r = &ra[MLX5E_TT_IPV4]; + if (*r != NULL) { + mlx5_del_flow_rule(*r); + *r = NULL; + } + + r = &ra[MLX5E_TT_ANY]; + if (*r != NULL) { + mlx5_del_flow_rule(*r); + *r = NULL; + } +} + +static int +mlx5e_add_main_vxlan_rules_sub(struct mlx5e_priv *priv, u32 *mc, u32 *mv) +{ + struct mlx5_flow_destination dest = {}; + u8 mc_enable = 0; + struct mlx5_flow_rule **rule_p; + struct mlx5_flow_table *ft = priv->fts.main_vxlan.t; + u32 *tirn = priv->tirn_inner_vxlan; + int err = 0; + + dest.type = MLX5_FLOW_DESTINATION_TYPE_TIR; + + mc_enable = MLX5_MATCH_INNER_HEADERS; + MLX5_SET_TO_ONES(fte_match_param, mc, inner_headers.ethertype); + + rule_p = &priv->fts.main_vxlan_rule[MLX5E_TT_IPV4]; + dest.tir_num = tirn[MLX5E_TT_IPV4]; + MLX5_SET(fte_match_param, mv, inner_headers.ethertype, ETHERTYPE_IP); + *rule_p = mlx5_add_flow_rule(ft, mc_enable, mc, mv, + MLX5_FLOW_CONTEXT_ACTION_FWD_DEST, MLX5_FS_ETH_FLOW_TAG, &dest); + if (IS_ERR_OR_NULL(*rule_p)) + goto err_del_ai; + + rule_p = &priv->fts.main_vxlan_rule[MLX5E_TT_IPV6]; + dest.tir_num = tirn[MLX5E_TT_IPV6]; + MLX5_SET(fte_match_param, mv, inner_headers.ethertype, ETHERTYPE_IPV6); + *rule_p = mlx5_add_flow_rule(ft, mc_enable, mc, mv, + MLX5_FLOW_CONTEXT_ACTION_FWD_DEST, MLX5_FS_ETH_FLOW_TAG, &dest); + if (IS_ERR_OR_NULL(*rule_p)) + goto err_del_ai; + + MLX5_SET_TO_ONES(fte_match_param, mc, inner_headers.ip_protocol); + MLX5_SET(fte_match_param, mv, inner_headers.ip_protocol, IPPROTO_UDP); + + rule_p = &priv->fts.main_vxlan_rule[MLX5E_TT_IPV4_UDP]; + dest.tir_num = tirn[MLX5E_TT_IPV4_UDP]; + MLX5_SET(fte_match_param, mv, inner_headers.ethertype, ETHERTYPE_IP); + *rule_p = mlx5_add_flow_rule(ft, mc_enable, mc, mv, + MLX5_FLOW_CONTEXT_ACTION_FWD_DEST, MLX5_FS_ETH_FLOW_TAG, &dest); + if (IS_ERR_OR_NULL(*rule_p)) + goto err_del_ai; + + rule_p = &priv->fts.main_vxlan_rule[MLX5E_TT_IPV6_UDP]; + dest.tir_num = tirn[MLX5E_TT_IPV6_UDP]; + MLX5_SET(fte_match_param, mv, inner_headers.ethertype, ETHERTYPE_IPV6); + *rule_p = mlx5_add_flow_rule(ft, mc_enable, mc, mv, + MLX5_FLOW_CONTEXT_ACTION_FWD_DEST, MLX5_FS_ETH_FLOW_TAG, &dest); + if (IS_ERR_OR_NULL(*rule_p)) + goto err_del_ai; + + MLX5_SET(fte_match_param, mv, inner_headers.ip_protocol, IPPROTO_TCP); + + rule_p = &priv->fts.main_vxlan_rule[MLX5E_TT_IPV4_TCP]; + dest.tir_num = tirn[MLX5E_TT_IPV4_TCP]; + MLX5_SET(fte_match_param, mv, inner_headers.ethertype, ETHERTYPE_IP); + *rule_p = mlx5_add_flow_rule(ft, mc_enable, mc, mv, + MLX5_FLOW_CONTEXT_ACTION_FWD_DEST, MLX5_FS_ETH_FLOW_TAG, &dest); + if (IS_ERR_OR_NULL(*rule_p)) + goto err_del_ai; + + rule_p = &priv->fts.main_vxlan_rule[MLX5E_TT_IPV6_TCP]; + dest.tir_num = tirn[MLX5E_TT_IPV6_TCP]; + MLX5_SET(fte_match_param, mv, inner_headers.ethertype, ETHERTYPE_IPV6); + *rule_p = mlx5_add_flow_rule(ft, mc_enable, mc, mv, + MLX5_FLOW_CONTEXT_ACTION_FWD_DEST, MLX5_FS_ETH_FLOW_TAG, &dest); + if (IS_ERR_OR_NULL(*rule_p)) + goto err_del_ai; + + MLX5_SET(fte_match_param, mv, inner_headers.ip_protocol, IPPROTO_AH); + + rule_p = &priv->fts.main_vxlan_rule[MLX5E_TT_IPV4_IPSEC_AH]; + dest.tir_num = tirn[MLX5E_TT_IPV4_IPSEC_AH]; + MLX5_SET(fte_match_param, mv, inner_headers.ethertype, ETHERTYPE_IP); + *rule_p = mlx5_add_flow_rule(ft, mc_enable, mc, mv, + MLX5_FLOW_CONTEXT_ACTION_FWD_DEST, MLX5_FS_ETH_FLOW_TAG, &dest); + if (IS_ERR_OR_NULL(*rule_p)) + goto err_del_ai; + + rule_p = &priv->fts.main_vxlan_rule[MLX5E_TT_IPV6_IPSEC_AH]; + dest.tir_num = tirn[MLX5E_TT_IPV6_IPSEC_AH]; + MLX5_SET(fte_match_param, mv, inner_headers.ethertype, ETHERTYPE_IPV6); + *rule_p = mlx5_add_flow_rule(ft, mc_enable, mc, mv, + MLX5_FLOW_CONTEXT_ACTION_FWD_DEST, MLX5_FS_ETH_FLOW_TAG, &dest); + if (IS_ERR_OR_NULL(*rule_p)) + goto err_del_ai; + + MLX5_SET(fte_match_param, mv, inner_headers.ip_protocol, IPPROTO_ESP); + + rule_p = &priv->fts.main_vxlan_rule[MLX5E_TT_IPV4_IPSEC_ESP]; + dest.tir_num = tirn[MLX5E_TT_IPV4_IPSEC_ESP]; + MLX5_SET(fte_match_param, mv, inner_headers.ethertype, ETHERTYPE_IP); + *rule_p = mlx5_add_flow_rule(ft, mc_enable, mc, mv, + MLX5_FLOW_CONTEXT_ACTION_FWD_DEST, MLX5_FS_ETH_FLOW_TAG, &dest); + if (IS_ERR_OR_NULL(*rule_p)) + goto err_del_ai; + + rule_p = &priv->fts.main_vxlan_rule[MLX5E_TT_IPV6_IPSEC_ESP]; + dest.tir_num = tirn[MLX5E_TT_IPV6_IPSEC_ESP]; + MLX5_SET(fte_match_param, mv, inner_headers.ethertype, + ETHERTYPE_IPV6); + *rule_p = mlx5_add_flow_rule(ft, mc_enable, mc, mv, + MLX5_FLOW_CONTEXT_ACTION_FWD_DEST, MLX5_FS_ETH_FLOW_TAG, &dest); + if (IS_ERR_OR_NULL(*rule_p)) + goto err_del_ai; + + mc_enable = 0; + memset(mv, 0, MLX5_ST_SZ_BYTES(fte_match_param)); + memset(mc, 0, MLX5_ST_SZ_BYTES(fte_match_param)); + rule_p = &priv->fts.main_vxlan_rule[MLX5E_TT_ANY]; + dest.tir_num = tirn[MLX5E_TT_ANY]; + *rule_p = mlx5_add_flow_rule(ft, mc_enable, mc, mv, + MLX5_FLOW_CONTEXT_ACTION_FWD_DEST, MLX5_FS_ETH_FLOW_TAG, &dest); + if (IS_ERR_OR_NULL(*rule_p)) + goto err_del_ai; + + return (0); + +err_del_ai: + err = PTR_ERR(*rule_p); + *rule_p = NULL; + mlx5e_del_main_vxlan_rules(priv); + + return (err); +} + +static int +mlx5e_add_main_vxlan_rules(struct mlx5e_priv *priv) +{ + u32 *match_criteria; + u32 *match_value; + int err = 0; + + match_value = mlx5_vzalloc(MLX5_ST_SZ_BYTES(fte_match_param)); + match_criteria = mlx5_vzalloc(MLX5_ST_SZ_BYTES(fte_match_param)); + if (match_value == NULL || match_criteria == NULL) { + mlx5_en_err(priv->ifp, "alloc failed\n"); + err = -ENOMEM; + goto add_main_vxlan_rules_out; + } + err = mlx5e_add_main_vxlan_rules_sub(priv, match_criteria, match_value); + +add_main_vxlan_rules_out: + kvfree(match_criteria); + kvfree(match_value); + + return (err); +} + static int mlx5e_vport_context_update_vlans(struct mlx5e_priv *priv) { struct ifnet *ifp = priv->ifp; @@ -512,7 +732,7 @@ mlx5e_add_vlan_rule_sub(struct mlx5e_priv *priv, int err = 0; dest.type = MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE; - dest.ft = priv->fts.main.t; + dest.ft = priv->fts.vxlan.t; mc_enable = MLX5_MATCH_OUTER_HEADERS; @@ -1267,14 +1487,87 @@ mlx5e_create_main_groups(struct mlx5e_flow_table *ft) return (err); } -static int mlx5e_create_main_flow_table(struct mlx5e_priv *priv) +#define MLX5E_MAIN_VXLAN_GROUP0_SIZE BIT(3) +#define MLX5E_MAIN_VXLAN_GROUP1_SIZE BIT(3) +#define MLX5E_MAIN_VXLAN_GROUP2_SIZE BIT(0) +static int +mlx5e_create_main_vxlan_groups_sub(struct mlx5e_flow_table *ft, u32 *in, + int inlen) +{ + u8 *mc = MLX5_ADDR_OF(create_flow_group_in, in, match_criteria); + int err; + int ix = 0; + + memset(in, 0, inlen); + MLX5_SET_CFG(in, match_criteria_enable, MLX5_MATCH_INNER_HEADERS); + MLX5_SET_TO_ONES(fte_match_param, mc, inner_headers.ethertype); + MLX5_SET_TO_ONES(fte_match_param, mc, inner_headers.ip_protocol); + MLX5_SET_CFG(in, start_flow_index, ix); + ix += MLX5E_MAIN_VXLAN_GROUP0_SIZE; + MLX5_SET_CFG(in, end_flow_index, ix - 1); + ft->g[ft->num_groups] = mlx5_create_flow_group(ft->t, in); + if (IS_ERR(ft->g[ft->num_groups])) + goto err_destory_groups; + ft->num_groups++; + + memset(in, 0, inlen); + MLX5_SET_CFG(in, match_criteria_enable, MLX5_MATCH_INNER_HEADERS); + MLX5_SET_TO_ONES(fte_match_param, mc, inner_headers.ethertype); + MLX5_SET_CFG(in, start_flow_index, ix); + ix += MLX5E_MAIN_VXLAN_GROUP1_SIZE; + MLX5_SET_CFG(in, end_flow_index, ix - 1); + ft->g[ft->num_groups] = mlx5_create_flow_group(ft->t, in); + if (IS_ERR(ft->g[ft->num_groups])) + goto err_destory_groups; + ft->num_groups++; + + memset(in, 0, inlen); + MLX5_SET_CFG(in, start_flow_index, ix); + ix += MLX5E_MAIN_VXLAN_GROUP2_SIZE; + MLX5_SET_CFG(in, end_flow_index, ix - 1); + ft->g[ft->num_groups] = mlx5_create_flow_group(ft->t, in); + if (IS_ERR(ft->g[ft->num_groups])) + goto err_destory_groups; + ft->num_groups++; + + return (0); + +err_destory_groups: + err = PTR_ERR(ft->g[ft->num_groups]); + ft->g[ft->num_groups] = NULL; + mlx5e_destroy_groups(ft); + + return (err); +} + +static int +mlx5e_create_main_vxlan_groups(struct mlx5e_flow_table *ft) +{ + u32 *in; + int inlen = MLX5_ST_SZ_BYTES(create_flow_group_in); + int err; + + in = mlx5_vzalloc(inlen); + if (!in) + return (-ENOMEM); + + err = mlx5e_create_main_vxlan_groups_sub(ft, in, inlen); + + kvfree(in); + return (err); +} + + +static int +mlx5e_create_main_flow_table(struct mlx5e_priv *priv, bool inner_vxlan) { - struct mlx5e_flow_table *ft = &priv->fts.main; + struct mlx5e_flow_table *ft = inner_vxlan ? &priv->fts.main_vxlan : + &priv->fts.main; int err; ft->num_groups = 0; - ft->t = mlx5_create_flow_table(priv->fts.ns, 0, "main", - MLX5E_MAIN_TABLE_SIZE); + ft->t = mlx5_create_flow_table(priv->fts.ns, 0, + inner_vxlan ? "vxlan_main" : "main", MLX5E_MAIN_TABLE_SIZE); if (IS_ERR(ft->t)) { err = PTR_ERR(ft->t); @@ -1287,7 +1580,8 @@ static int mlx5e_create_main_flow_table(struct mlx5e_priv *priv) goto err_destroy_main_flow_table; } - err = mlx5e_create_main_groups(ft); + err = inner_vxlan ? mlx5e_create_main_vxlan_groups(ft) : + mlx5e_create_main_groups(ft); if (err) goto err_free_g; return (0); @@ -1307,6 +1601,11 @@ static void mlx5e_destroy_main_flow_table(struct mlx5e_priv *priv) mlx5e_destroy_flow_table(&priv->fts.main); } +static void mlx5e_destroy_main_vxlan_flow_table(struct mlx5e_priv *priv) +{ + mlx5e_destroy_flow_table(&priv->fts.main_vxlan); +} + #define MLX5E_NUM_VLAN_GROUPS 3 #define MLX5E_VLAN_GROUP0_SIZE BIT(12) #define MLX5E_VLAN_GROUP1_SIZE BIT(1) @@ -1428,6 +1727,333 @@ mlx5e_destroy_vlan_flow_table(struct mlx5e_priv *priv) mlx5e_destroy_flow_table(&priv->fts.vlan); } +static int +mlx5e_add_vxlan_rule_sub(struct mlx5e_priv *priv, u_int protocol, u_int port, + u32 *mc, u32 *mv, struct mlx5e_vxlan_db_el *el) +{ + struct mlx5_flow_table *ft = priv->fts.vxlan.t; + struct mlx5_flow_destination dest = {}; + u8 mc_enable; + struct mlx5_flow_rule **rule_p; + int err = 0; + + dest.type = MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE; + dest.ft = priv->fts.main_vxlan.t; + + mc_enable = MLX5_MATCH_OUTER_HEADERS; + rule_p = &el->vxlan_ft_rule; + MLX5_SET_TO_ONES(fte_match_param, mc, outer_headers.ethertype); + MLX5_SET(fte_match_param, mv, outer_headers.ethertype, protocol); + MLX5_SET_TO_ONES(fte_match_param, mc, outer_headers.ip_protocol); + MLX5_SET(fte_match_param, mv, outer_headers.ip_protocol, IPPROTO_UDP); + MLX5_SET_TO_ONES(fte_match_param, mc, outer_headers.udp_dport); + MLX5_SET(fte_match_param, mv, outer_headers.udp_dport, port); + + *rule_p = mlx5_add_flow_rule(ft, mc_enable, mc, mv, + MLX5_FLOW_CONTEXT_ACTION_FWD_DEST, MLX5_FS_ETH_FLOW_TAG, &dest); + + if (IS_ERR(*rule_p)) { + err = PTR_ERR(*rule_p); + *rule_p = NULL; + mlx5_en_err(priv->ifp, "add rule failed\n"); + } + + return (err); +} + +static struct mlx5e_vxlan_db_el * +mlx5e_vxlan_find_db_el(struct mlx5e_priv *priv, u_int proto, u_int port) +{ + struct mlx5e_vxlan_db_el *el; + + TAILQ_FOREACH(el, &priv->vxlan.head, link) { + if (el->proto == proto && el->port == port) + return (el); + } + return (NULL); +} + +static struct mlx5e_vxlan_db_el * +mlx5e_vxlan_alloc_db_el(struct mlx5e_priv *priv, u_int proto, u_int port) +{ + struct mlx5e_vxlan_db_el *el; + + el = mlx5_vzalloc(sizeof(*el)); + el->refcount = 1; + el->proto = proto; + el->port = port; + el->vxlan_ft_rule = NULL; + return (el); +} + +static int +mlx5e_vxlan_family_to_proto(sa_family_t family, u_int *proto) +{ + switch (family) { + case AF_INET: + *proto = ETHERTYPE_IP; + return (0); + case AF_INET6: + *proto = ETHERTYPE_IPV6; + return (0); + default: + return (-EINVAL); + } +} + +static int +mlx5e_add_vxlan_rule(struct mlx5e_priv *priv, sa_family_t family, u_int port) +{ + struct mlx5e_vxlan_db_el *el; + u32 *match_criteria; + u32 *match_value; + u_int proto; + int err; + + err = mlx5e_vxlan_family_to_proto(family, &proto); + if (err != 0) + return (err); + + el = mlx5e_vxlan_find_db_el(priv, proto, port); + if (el != NULL) { + el->refcount++; + return (0); + } + el = mlx5e_vxlan_alloc_db_el(priv, proto, port); + + match_value = mlx5_vzalloc(MLX5_ST_SZ_BYTES(fte_match_param)); + match_criteria = mlx5_vzalloc(MLX5_ST_SZ_BYTES(fte_match_param)); + if (match_value == NULL || match_criteria == NULL) { + mlx5_en_err(priv->ifp, "alloc failed\n"); + err = -ENOMEM; + goto add_vxlan_rule_out; + } + + err = mlx5e_add_vxlan_rule_sub(priv, proto, port, match_criteria, + match_value, el); + if (err == 0) { + TAILQ_INSERT_TAIL(&priv->vxlan.head, el, link); + } else { + kvfree(el); + } + +add_vxlan_rule_out: + kvfree(match_criteria); + kvfree(match_value); + + return (err); +} + +static int +mlx5e_add_vxlan_catchall_rule_sub(struct mlx5e_priv *priv, u32 *mc, u32 *mv) +{ + struct mlx5_flow_table *ft = priv->fts.vxlan.t; + struct mlx5_flow_destination dest = {}; + u8 mc_enable = 0; + struct mlx5_flow_rule **rule_p; + int err = 0; + + dest.type = MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE; + dest.ft = priv->fts.main.t; + + rule_p = &priv->fts.vxlan_catchall_ft_rule; + *rule_p = mlx5_add_flow_rule(ft, mc_enable, mc, mv, + MLX5_FLOW_CONTEXT_ACTION_FWD_DEST, MLX5_FS_ETH_FLOW_TAG, &dest); + + if (IS_ERR(*rule_p)) { + err = PTR_ERR(*rule_p); + *rule_p = NULL; + mlx5_en_err(priv->ifp, "add rule failed\n"); + } + + return (err); +} + + +static int +mlx5e_add_vxlan_catchall_rule(struct mlx5e_priv *priv) +{ + u32 *match_criteria; + u32 *match_value; + int err; + + match_value = mlx5_vzalloc(MLX5_ST_SZ_BYTES(fte_match_param)); + match_criteria = mlx5_vzalloc(MLX5_ST_SZ_BYTES(fte_match_param)); + if (match_value == NULL || match_criteria == NULL) { + mlx5_en_err(priv->ifp, "alloc failed\n"); + err = -ENOMEM; + goto add_vxlan_rule_out; + } + + err = mlx5e_add_vxlan_catchall_rule_sub(priv, match_criteria, + match_value); + +add_vxlan_rule_out: + kvfree(match_criteria); + kvfree(match_value); + + return (err); +} + +static int +mlx5e_del_vxlan_rule(struct mlx5e_priv *priv, sa_family_t family, u_int port) +{ + struct mlx5e_vxlan_db_el *el; + u_int proto; + int err; + + err = mlx5e_vxlan_family_to_proto(family, &proto); + if (err != 0) + return (err); + + el = mlx5e_vxlan_find_db_el(priv, proto, port); + if (el == NULL) + return (0); + if (el->refcount > 1) { + el->refcount--; + return (0); + } + + mlx5_del_flow_rule(el->vxlan_ft_rule); + TAILQ_REMOVE(&priv->vxlan.head, el, link); + kvfree(el); + return (0); +} + +static void +mlx5e_del_vxlan_catchall_rule(struct mlx5e_priv *priv) +{ + mlx5_del_flow_rule(priv->fts.vxlan_catchall_ft_rule); +} + +void +mlx5e_vxlan_start(void *arg, struct ifnet *ifp __unused, sa_family_t family, + u_int port) +{ + struct mlx5e_priv *priv = arg; + int err; + + PRIV_LOCK(priv); + err = mlx5_vxlan_udp_port_add(priv->mdev, port); + if (err == 0 && test_bit(MLX5E_STATE_OPENED, &priv->state)) + mlx5e_add_vxlan_rule(priv, family, port); + PRIV_UNLOCK(priv); +} + +void +mlx5e_vxlan_stop(void *arg, struct ifnet *ifp __unused, sa_family_t family, + u_int port) +{ + struct mlx5e_priv *priv = arg; + + PRIV_LOCK(priv); + if (test_bit(MLX5E_STATE_OPENED, &priv->state)) + mlx5e_del_vxlan_rule(priv, family, port); + (void)mlx5_vxlan_udp_port_delete(priv->mdev, port); + PRIV_UNLOCK(priv); +} + +#define MLX5E_VXLAN_GROUP0_SIZE BIT(3) /* XXXKIB */ +#define MLX5E_VXLAN_GROUP1_SIZE BIT(0) +#define MLX5E_NUM_VXLAN_GROUPS BIT(1) +#define MLX5E_VXLAN_TABLE_SIZE \ + (MLX5E_VXLAN_GROUP0_SIZE + MLX5E_VXLAN_GROUP1_SIZE) + +static int +mlx5e_create_vxlan_groups_sub(struct mlx5e_flow_table *ft, u32 *in, + int inlen) +{ + int err; + int ix = 0; + u8 *mc = MLX5_ADDR_OF(create_flow_group_in, in, match_criteria); + + memset(in, 0, inlen); + MLX5_SET_CFG(in, match_criteria_enable, MLX5_MATCH_OUTER_HEADERS); + MLX5_SET_TO_ONES(fte_match_param, mc, outer_headers.ethertype); + MLX5_SET_TO_ONES(fte_match_param, mc, outer_headers.ip_protocol); + MLX5_SET_TO_ONES(fte_match_param, mc, outer_headers.udp_dport); + MLX5_SET_CFG(in, start_flow_index, ix); + ix += MLX5E_VXLAN_GROUP0_SIZE; + MLX5_SET_CFG(in, end_flow_index, ix - 1); + ft->g[ft->num_groups] = mlx5_create_flow_group(ft->t, in); + if (IS_ERR(ft->g[ft->num_groups])) + goto err_destory_groups; + ft->num_groups++; + + memset(in, 0, inlen); + MLX5_SET_CFG(in, start_flow_index, ix); + ix += MLX5E_VXLAN_GROUP1_SIZE; + MLX5_SET_CFG(in, end_flow_index, ix - 1); + ft->g[ft->num_groups] = mlx5_create_flow_group(ft->t, in); + if (IS_ERR(ft->g[ft->num_groups])) + goto err_destory_groups; + ft->num_groups++; + + return (0); + +err_destory_groups: + err = PTR_ERR(ft->g[ft->num_groups]); + ft->g[ft->num_groups] = NULL; + mlx5e_destroy_groups(ft); + + return (err); +} + +static int +mlx5e_create_vxlan_groups(struct mlx5e_flow_table *ft) +{ + u32 *in; + int inlen = MLX5_ST_SZ_BYTES(create_flow_group_in); + int err; + + in = mlx5_vzalloc(inlen); + if (!in) + return (-ENOMEM); + + err = mlx5e_create_vxlan_groups_sub(ft, in, inlen); + + kvfree(in); + return (err); +} + +static int +mlx5e_create_vxlan_flow_table(struct mlx5e_priv *priv) +{ + struct mlx5e_flow_table *ft = &priv->fts.vxlan; + int err; + + ft->num_groups = 0; + ft->t = mlx5_create_flow_table(priv->fts.ns, 0, "vxlan", + MLX5E_VXLAN_TABLE_SIZE); + + if (IS_ERR(ft->t)) { + err = PTR_ERR(ft->t); + ft->t = NULL; + return (err); + } + ft->g = kcalloc(MLX5E_NUM_VXLAN_GROUPS, sizeof(*ft->g), GFP_KERNEL); + if (!ft->g) { + err = -ENOMEM; + goto err_destroy_vxlan_flow_table; + } + + err = mlx5e_create_vxlan_groups(ft); + if (err) + goto err_free_g; + + TAILQ_INIT(&priv->vxlan.head); + return (0); + +err_free_g: + kfree(ft->g); + +err_destroy_vxlan_flow_table: + mlx5_destroy_flow_table(ft->t); + ft->t = NULL; + + return (err); +} + #define MLX5E_NUM_INNER_RSS_GROUPS 3 #define MLX5E_INNER_RSS_GROUP0_SIZE BIT(3) #define MLX5E_INNER_RSS_GROUP1_SIZE BIT(1) @@ -1547,6 +2173,12 @@ static void mlx5e_destroy_inner_rss_flow_table(struct mlx5e_priv *priv) mlx5e_destroy_flow_table(&priv->fts.inner_rss); } +static void +mlx5e_destroy_vxlan_flow_table(struct mlx5e_priv *priv) +{ + mlx5e_destroy_flow_table(&priv->fts.vxlan); +} + int mlx5e_open_flow_table(struct mlx5e_priv *priv) { @@ -1559,18 +2191,40 @@ mlx5e_open_flow_table(struct mlx5e_priv *priv) if (err) return (err); - err = mlx5e_create_main_flow_table(priv); + err = mlx5e_create_vxlan_flow_table(priv); if (err) goto err_destroy_vlan_flow_table; - err = mlx5e_create_inner_rss_flow_table(priv); + err = mlx5e_create_main_flow_table(priv, false); + if (err) + goto err_destroy_vxlan_flow_table; + + err = mlx5e_create_main_flow_table(priv, true); if (err) goto err_destroy_main_flow_table; + err = mlx5e_create_inner_rss_flow_table(priv); + if (err) + goto err_destroy_main_vxlan_flow_table; + + err = mlx5e_add_vxlan_catchall_rule(priv); + if (err != 0) + goto err_destroy_inner_rss_flow_table; + + err = mlx5e_add_main_vxlan_rules(priv); + if (err != 0) + goto err_destroy_inner_rss_flow_table; + return (0); +err_destroy_inner_rss_flow_table: + mlx5e_destroy_inner_rss_flow_table(priv); +err_destroy_main_vxlan_flow_table: + mlx5e_destroy_main_vxlan_flow_table(priv); err_destroy_main_flow_table: mlx5e_destroy_main_flow_table(priv); +err_destroy_vxlan_flow_table: + mlx5e_destroy_vxlan_flow_table(priv); err_destroy_vlan_flow_table: mlx5e_destroy_vlan_flow_table(priv); @@ -1583,6 +2237,10 @@ mlx5e_close_flow_table(struct mlx5e_priv *priv) mlx5e_handle_ifp_addr(priv); mlx5e_destroy_inner_rss_flow_table(priv); + mlx5e_del_vxlan_catchall_rule(priv); + mlx5e_destroy_vxlan_flow_table(priv); + mlx5e_del_main_vxlan_rules(priv); mlx5e_destroy_main_flow_table(priv); + mlx5e_destroy_main_vxlan_flow_table(priv); mlx5e_destroy_vlan_flow_table(priv); } diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index 296252875888..1adf83cf57f9 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -4558,6 +4558,12 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) priv->vlan_detach = EVENTHANDLER_REGISTER(vlan_unconfig, mlx5e_vlan_rx_kill_vid, priv, EVENTHANDLER_PRI_FIRST); + /* Register for VxLAN events */ + priv->vxlan_start = EVENTHANDLER_REGISTER(vxlan_start, + mlx5e_vxlan_start, priv, EVENTHANDLER_PRI_ANY); + priv->vxlan_stop = EVENTHANDLER_REGISTER(vxlan_stop, + mlx5e_vxlan_stop, priv, EVENTHANDLER_PRI_ANY); + /* Link is down by default */ if_link_state_change(ifp, LINK_STATE_DOWN); @@ -4660,6 +4666,10 @@ mlx5e_destroy_ifp(struct mlx5_core_dev *mdev, void *vpriv) EVENTHANDLER_DEREGISTER(vlan_config, priv->vlan_attach); if (priv->vlan_detach != NULL) EVENTHANDLER_DEREGISTER(vlan_unconfig, priv->vlan_detach); + if (priv->vxlan_start != NULL) + EVENTHANDLER_DEREGISTER(vxlan_start, priv->vxlan_start); + if (priv->vxlan_stop != NULL) + EVENTHANDLER_DEREGISTER(vxlan_stop, priv->vxlan_stop); /* make sure device gets closed */ PRIV_LOCK(priv); From owner-dev-commits-src-all@freebsd.org Mon Jul 26 15:19: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 7A19366D5F1; Mon, 26 Jul 2021 15:19: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 4GYNrM2Jnjz3Jpt; Mon, 26 Jul 2021 15:19: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 6FCBF193D7; Mon, 26 Jul 2021 15:19: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 16QFJUTW025451; Mon, 26 Jul 2021 15:19:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QFJUl3025450; Mon, 26 Jul 2021 15:19:30 GMT (envelope-from git) Date: Mon, 26 Jul 2021 15:19:30 GMT Message-Id: <202107261519.16QFJUl3025450@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: 56e096ec869b - stable/13 - mlx5en: build TIRs to handle inner RSS 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: 56e096ec869b542fc39c31ab937d1fae3f7dd5eb 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, 26 Jul 2021 15:19:31 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=56e096ec869b542fc39c31ab937d1fae3f7dd5eb commit 56e096ec869b542fc39c31ab937d1fae3f7dd5eb Author: Konstantin Belousov AuthorDate: 2021-04-06 03:43:23 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-26 13:51:10 +0000 mlx5en: build TIRs to handle inner RSS (cherry picked from commit fba6942f19f9cd6455f34658c8fff2ada1ee9691) --- sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 106 +++++++++++++++++++++--------------- 1 file changed, 62 insertions(+), 44 deletions(-) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index 92a7fc97279f..b5de6b3903fd 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -2774,9 +2774,11 @@ mlx5e_get_rss_key(void *key_ptr) } static void -mlx5e_build_tir_ctx(struct mlx5e_priv *priv, u32 * tirc, int tt) +mlx5e_build_tir_ctx(struct mlx5e_priv *priv, u32 * tirc, int tt, bool inner_vxlan) { void *hfso = MLX5_ADDR_OF(tirc, tirc, rx_hash_field_selector_outer); + void *hfsi = MLX5_ADDR_OF(tirc, tirc, rx_hash_field_selector_inner); + void *hfs = inner_vxlan ? hfsi : hfso; __be32 *hkey; MLX5_SET(tirc, tirc, transport_domain, priv->tdn); @@ -2808,6 +2810,11 @@ mlx5e_build_tir_ctx(struct mlx5e_priv *priv, u32 * tirc, int tt) lro_timer_supported_periods[2])); } + if (inner_vxlan && + (priv->ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) { + MLX5_SET(tirc, tirc, tunneled_offload_en, 1); + } + /* setup parameters for hashing TIR type, if any */ switch (tt) { case MLX5E_TT_ANY: @@ -2842,104 +2849,104 @@ mlx5e_build_tir_ctx(struct mlx5e_priv *priv, u32 * tirc, int tt) switch (tt) { case MLX5E_TT_IPV4_TCP: - MLX5_SET(rx_hash_field_select, hfso, l3_prot_type, + MLX5_SET(rx_hash_field_select, hfs, l3_prot_type, MLX5_L3_PROT_TYPE_IPV4); - MLX5_SET(rx_hash_field_select, hfso, l4_prot_type, + MLX5_SET(rx_hash_field_select, hfs, l4_prot_type, MLX5_L4_PROT_TYPE_TCP); #ifdef RSS if (!(rss_gethashconfig() & RSS_HASHTYPE_RSS_TCP_IPV4)) { - MLX5_SET(rx_hash_field_select, hfso, selected_fields, + MLX5_SET(rx_hash_field_select, hfs, selected_fields, MLX5_HASH_IP); } else #endif - MLX5_SET(rx_hash_field_select, hfso, selected_fields, + MLX5_SET(rx_hash_field_select, hfs, selected_fields, MLX5_HASH_ALL); break; case MLX5E_TT_IPV6_TCP: - MLX5_SET(rx_hash_field_select, hfso, l3_prot_type, + MLX5_SET(rx_hash_field_select, hfs, l3_prot_type, MLX5_L3_PROT_TYPE_IPV6); - MLX5_SET(rx_hash_field_select, hfso, l4_prot_type, + MLX5_SET(rx_hash_field_select, hfs, l4_prot_type, MLX5_L4_PROT_TYPE_TCP); #ifdef RSS if (!(rss_gethashconfig() & RSS_HASHTYPE_RSS_TCP_IPV6)) { - MLX5_SET(rx_hash_field_select, hfso, selected_fields, + MLX5_SET(rx_hash_field_select, hfs, selected_fields, MLX5_HASH_IP); } else #endif - MLX5_SET(rx_hash_field_select, hfso, selected_fields, + MLX5_SET(rx_hash_field_select, hfs, selected_fields, MLX5_HASH_ALL); break; case MLX5E_TT_IPV4_UDP: - MLX5_SET(rx_hash_field_select, hfso, l3_prot_type, + MLX5_SET(rx_hash_field_select, hfs, l3_prot_type, MLX5_L3_PROT_TYPE_IPV4); - MLX5_SET(rx_hash_field_select, hfso, l4_prot_type, + MLX5_SET(rx_hash_field_select, hfs, l4_prot_type, MLX5_L4_PROT_TYPE_UDP); #ifdef RSS if (!(rss_gethashconfig() & RSS_HASHTYPE_RSS_UDP_IPV4)) { - MLX5_SET(rx_hash_field_select, hfso, selected_fields, + MLX5_SET(rx_hash_field_select, hfs, selected_fields, MLX5_HASH_IP); } else #endif - MLX5_SET(rx_hash_field_select, hfso, selected_fields, + MLX5_SET(rx_hash_field_select, hfs, selected_fields, MLX5_HASH_ALL); break; case MLX5E_TT_IPV6_UDP: - MLX5_SET(rx_hash_field_select, hfso, l3_prot_type, + MLX5_SET(rx_hash_field_select, hfs, l3_prot_type, MLX5_L3_PROT_TYPE_IPV6); - MLX5_SET(rx_hash_field_select, hfso, l4_prot_type, + MLX5_SET(rx_hash_field_select, hfs, l4_prot_type, MLX5_L4_PROT_TYPE_UDP); #ifdef RSS if (!(rss_gethashconfig() & RSS_HASHTYPE_RSS_UDP_IPV6)) { - MLX5_SET(rx_hash_field_select, hfso, selected_fields, + MLX5_SET(rx_hash_field_select, hfs, selected_fields, MLX5_HASH_IP); } else #endif - MLX5_SET(rx_hash_field_select, hfso, selected_fields, + MLX5_SET(rx_hash_field_select, hfs, selected_fields, MLX5_HASH_ALL); break; case MLX5E_TT_IPV4_IPSEC_AH: - MLX5_SET(rx_hash_field_select, hfso, l3_prot_type, + MLX5_SET(rx_hash_field_select, hfs, l3_prot_type, MLX5_L3_PROT_TYPE_IPV4); - MLX5_SET(rx_hash_field_select, hfso, selected_fields, + MLX5_SET(rx_hash_field_select, hfs, selected_fields, MLX5_HASH_IP_IPSEC_SPI); break; case MLX5E_TT_IPV6_IPSEC_AH: - MLX5_SET(rx_hash_field_select, hfso, l3_prot_type, + MLX5_SET(rx_hash_field_select, hfs, l3_prot_type, MLX5_L3_PROT_TYPE_IPV6); - MLX5_SET(rx_hash_field_select, hfso, selected_fields, + MLX5_SET(rx_hash_field_select, hfs, selected_fields, MLX5_HASH_IP_IPSEC_SPI); break; case MLX5E_TT_IPV4_IPSEC_ESP: - MLX5_SET(rx_hash_field_select, hfso, l3_prot_type, + MLX5_SET(rx_hash_field_select, hfs, l3_prot_type, MLX5_L3_PROT_TYPE_IPV4); - MLX5_SET(rx_hash_field_select, hfso, selected_fields, + MLX5_SET(rx_hash_field_select, hfs, selected_fields, MLX5_HASH_IP_IPSEC_SPI); break; case MLX5E_TT_IPV6_IPSEC_ESP: - MLX5_SET(rx_hash_field_select, hfso, l3_prot_type, + MLX5_SET(rx_hash_field_select, hfs, l3_prot_type, MLX5_L3_PROT_TYPE_IPV6); - MLX5_SET(rx_hash_field_select, hfso, selected_fields, + MLX5_SET(rx_hash_field_select, hfs, selected_fields, MLX5_HASH_IP_IPSEC_SPI); break; case MLX5E_TT_IPV4: - MLX5_SET(rx_hash_field_select, hfso, l3_prot_type, + MLX5_SET(rx_hash_field_select, hfs, l3_prot_type, MLX5_L3_PROT_TYPE_IPV4); - MLX5_SET(rx_hash_field_select, hfso, selected_fields, + MLX5_SET(rx_hash_field_select, hfs, selected_fields, MLX5_HASH_IP); break; case MLX5E_TT_IPV6: - MLX5_SET(rx_hash_field_select, hfso, l3_prot_type, + MLX5_SET(rx_hash_field_select, hfs, l3_prot_type, MLX5_L3_PROT_TYPE_IPV6); - MLX5_SET(rx_hash_field_select, hfso, selected_fields, + MLX5_SET(rx_hash_field_select, hfs, selected_fields, MLX5_HASH_IP); break; @@ -2949,7 +2956,7 @@ mlx5e_build_tir_ctx(struct mlx5e_priv *priv, u32 * tirc, int tt) } static int -mlx5e_open_tir(struct mlx5e_priv *priv, int tt) +mlx5e_open_tir(struct mlx5e_priv *priv, int tt, bool inner_vxlan) { struct mlx5_core_dev *mdev = priv->mdev; u32 *in; @@ -2963,9 +2970,10 @@ mlx5e_open_tir(struct mlx5e_priv *priv, int tt) return (-ENOMEM); tirc = MLX5_ADDR_OF(create_tir_in, in, tir_context); - mlx5e_build_tir_ctx(priv, tirc, tt); + mlx5e_build_tir_ctx(priv, tirc, tt, inner_vxlan); - err = mlx5_core_create_tir(mdev, in, inlen, &priv->tirn[tt]); + err = mlx5_core_create_tir(mdev, in, inlen, inner_vxlan ? + &priv->tirn_inner_vxlan[tt] : &priv->tirn[tt]); kvfree(in); @@ -2973,19 +2981,20 @@ mlx5e_open_tir(struct mlx5e_priv *priv, int tt) } static void -mlx5e_close_tir(struct mlx5e_priv *priv, int tt) +mlx5e_close_tir(struct mlx5e_priv *priv, int tt, bool inner_vxlan) { - mlx5_core_destroy_tir(priv->mdev, priv->tirn[tt]); + mlx5_core_destroy_tir(priv->mdev, inner_vxlan ? + priv->tirn_inner_vxlan[tt] : priv->tirn[tt]); } static int -mlx5e_open_tirs(struct mlx5e_priv *priv) +mlx5e_open_tirs(struct mlx5e_priv *priv, bool inner_vxlan) { int err; int i; for (i = 0; i < MLX5E_NUM_TT; i++) { - err = mlx5e_open_tir(priv, i); + err = mlx5e_open_tir(priv, i, inner_vxlan); if (err) goto err_close_tirs; } @@ -2994,18 +3003,18 @@ mlx5e_open_tirs(struct mlx5e_priv *priv) err_close_tirs: for (i--; i >= 0; i--) - mlx5e_close_tir(priv, i); + mlx5e_close_tir(priv, i, inner_vxlan); return (err); } static void -mlx5e_close_tirs(struct mlx5e_priv *priv) +mlx5e_close_tirs(struct mlx5e_priv *priv, bool inner_vxlan) { int i; for (i = 0; i < MLX5E_NUM_TT; i++) - mlx5e_close_tir(priv, i); + mlx5e_close_tir(priv, i, inner_vxlan); } /* @@ -3113,16 +3122,21 @@ mlx5e_open_locked(struct ifnet *ifp) mlx5_en_err(ifp, "mlx5e_open_rqt failed, %d\n", err); goto err_close_channels; } - err = mlx5e_open_tirs(priv); + err = mlx5e_open_tirs(priv, false); if (err) { - mlx5_en_err(ifp, "mlx5e_open_tir failed, %d\n", err); + mlx5_en_err(ifp, "mlx5e_open_tir(main) failed, %d\n", err); goto err_close_rqls; } + err = mlx5e_open_tirs(priv, true); + if (err) { + mlx5_en_err(ifp, "mlx5e_open_tir(inner) failed, %d\n", err); + goto err_close_tirs; + } err = mlx5e_open_flow_table(priv); if (err) { mlx5_en_err(ifp, "mlx5e_open_flow_table failed, %d\n", err); - goto err_close_tirs; + goto err_close_tirs_inner; } err = mlx5e_add_all_vlan_rules(priv); if (err) { @@ -3140,8 +3154,11 @@ mlx5e_open_locked(struct ifnet *ifp) err_close_flow_table: mlx5e_close_flow_table(priv); +err_close_tirs_inner: + mlx5e_close_tirs(priv, true); + err_close_tirs: - mlx5e_close_tirs(priv); + mlx5e_close_tirs(priv, false); err_close_rqls: mlx5e_close_rqt(priv); @@ -3189,7 +3206,8 @@ mlx5e_close_locked(struct ifnet *ifp) mlx5e_del_all_vlan_rules(priv); if_link_state_change(priv->ifp, LINK_STATE_DOWN); mlx5e_close_flow_table(priv); - mlx5e_close_tirs(priv); + mlx5e_close_tirs(priv, true); + mlx5e_close_tirs(priv, false); mlx5e_close_rqt(priv); mlx5e_close_channels(priv); mlx5_vport_dealloc_q_counter(priv->mdev, From owner-dev-commits-src-all@freebsd.org Mon Jul 26 15:19: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 8F21366DAB0; Mon, 26 Jul 2021 15:19: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 4GYNrH0nbVz3Jdr; Mon, 26 Jul 2021 15:19: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 F156D19528; Mon, 26 Jul 2021 15:19: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 16QFJQD8025379; Mon, 26 Jul 2021 15:19:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QFJQjr025378; Mon, 26 Jul 2021 15:19:26 GMT (envelope-from git) Date: Mon, 26 Jul 2021 15:19:26 GMT Message-Id: <202107261519.16QFJQjr025378@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: ed08b3711958 - stable/13 - mlx5en: eliminate magic constant 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: ed08b3711958f690cc910b0540c881f5041f46a9 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, 26 Jul 2021 15:19:27 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=ed08b3711958f690cc910b0540c881f5041f46a9 commit ed08b3711958f690cc910b0540c881f5041f46a9 Author: Konstantin Belousov AuthorDate: 2021-04-06 03:30:09 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-26 13:51:10 +0000 mlx5en: eliminate magic constant (cherry picked from commit 1b36b3869f3be722dd15760ddcb4598b6dfe7cf7) --- sys/dev/mlx5/mlx5_en/mlx5_en_tx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c b/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c index 124d2afe414c..1ba47e44ae96 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c @@ -277,7 +277,7 @@ mlx5e_get_full_header_size(const struct mbuf *mb, const struct tcphdr **ppth) goto tcp_packet; case IPPROTO_UDP: ip_hlen = ip->ip_hl << 2; - eth_hdr_len += ip_hlen + 8; + eth_hdr_len += ip_hlen + sizeof(struct udphdr); th = NULL; goto udp_packet; default: @@ -293,7 +293,7 @@ mlx5e_get_full_header_size(const struct mbuf *mb, const struct tcphdr **ppth) eth_hdr_len += sizeof(*ip6); goto tcp_packet; case IPPROTO_UDP: - eth_hdr_len += sizeof(*ip6) + 8; + eth_hdr_len += sizeof(*ip6) + sizeof(struct udphdr); th = NULL; goto udp_packet; default: From owner-dev-commits-src-all@freebsd.org Mon Jul 26 15:19: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 4865366DAC3; Mon, 26 Jul 2021 15:19: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 4GYNrP1MGwz3JmS; Mon, 26 Jul 2021 15:19: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 B09EC19628; Mon, 26 Jul 2021 15:19: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 16QFJWh5025505; Mon, 26 Jul 2021 15:19:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QFJWdU025504; Mon, 26 Jul 2021 15:19:32 GMT (envelope-from git) Date: Mon, 26 Jul 2021 15:19:32 GMT Message-Id: <202107261519.16QFJWdU025504@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: 56fd9780ad57 - stable/13 - mlx5en: handle checksum and TSO offloading for VxLAN packets on TX 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: 56fd9780ad57d06133e19bec13b0e54aae36b809 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, 26 Jul 2021 15:19:33 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=56fd9780ad57d06133e19bec13b0e54aae36b809 commit 56fd9780ad57d06133e19bec13b0e54aae36b809 Author: Konstantin Belousov AuthorDate: 2021-04-06 03:45:20 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-26 13:51:10 +0000 mlx5en: handle checksum and TSO offloading for VxLAN packets on TX (cherry picked from commit 7c9febf9f11bec467ef79c6ff19d695ace7edb6b) --- sys/dev/mlx5/mlx5_en/mlx5_en_tx.c | 289 +++++++++++++++++++++++++++++++++++++- 1 file changed, 287 insertions(+), 2 deletions(-) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c b/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c index 1ba47e44ae96..6bc0a91ca8ef 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c @@ -332,6 +332,221 @@ failure: return (0); } +/* + * Locate a pointer inside a mbuf chain. Returns NULL upon failure. + */ +static inline void * +mlx5e_parse_mbuf_chain(const struct mbuf **mb, int *poffset, int eth_hdr_len, + int min_len) +{ + if (unlikely(mb[0]->m_len == eth_hdr_len)) { + poffset[0] = eth_hdr_len; + if (unlikely((mb[0] = mb[0]->m_next) == NULL)) + return (NULL); + } + if (unlikely(mb[0]->m_len < eth_hdr_len - poffset[0] + min_len)) + return (NULL); + return (mb[0]->m_data + eth_hdr_len - poffset[0]); +} + +/* + * This function parse IPv4 and IPv6 packets looking for UDP, VXLAN + * and TCP headers. + * + * The return value indicates the number of bytes from the beginning + * of the packet until the first byte after the TCP header. If this + * function returns zero, the parsing failed. + */ +static int +mlx5e_get_vxlan_header_size(const struct mbuf *mb, struct mlx5e_tx_wqe *wqe, + uint8_t cs_mask, uint8_t opcode) +{ + const struct ether_vlan_header *eh; + struct ip *ip4; + struct ip6_hdr *ip6; + struct tcphdr *th; + struct udphdr *udp; + bool has_outer_vlan_tag; + uint16_t eth_type; + uint8_t ip_type; + int pkt_hdr_len; + int eth_hdr_len; + int tcp_hlen; + int ip_hlen; + int offset; + + pkt_hdr_len = mb->m_pkthdr.len; + has_outer_vlan_tag = (mb->m_flags & M_VLANTAG) != 0; + offset = 0; + + eh = mtod(mb, const struct ether_vlan_header *); + if (unlikely(mb->m_len < ETHER_HDR_LEN)) + return (0); + + if (eh->evl_encap_proto == htons(ETHERTYPE_VLAN)) { + if (unlikely(mb->m_len < ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN)) + return (0); + eth_type = eh->evl_proto; + eth_hdr_len = ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN; + } else { + eth_type = eh->evl_encap_proto; + eth_hdr_len = ETHER_HDR_LEN; + } + + switch (eth_type) { + case htons(ETHERTYPE_IP): + ip4 = mlx5e_parse_mbuf_chain(&mb, &offset, eth_hdr_len, + sizeof(*ip4)); + if (unlikely(ip4 == NULL)) + return (0); + ip_type = ip4->ip_p; + if (unlikely(ip_type != IPPROTO_UDP)) + return (0); + wqe->eth.swp_outer_l3_offset = eth_hdr_len / 2; + wqe->eth.cs_flags = MLX5_ETH_WQE_L3_CSUM | MLX5_ETH_WQE_L4_CSUM; + ip_hlen = ip4->ip_hl << 2; + eth_hdr_len += ip_hlen; + udp = mlx5e_parse_mbuf_chain(&mb, &offset, eth_hdr_len, + sizeof(*udp)); + if (unlikely(udp == NULL)) + return (0); + wqe->eth.swp_outer_l4_offset = eth_hdr_len / 2; + wqe->eth.swp_flags |= MLX5_ETH_WQE_SWP_OUTER_L4_TYPE; + eth_hdr_len += sizeof(*udp); + break; + case htons(ETHERTYPE_IPV6): + ip6 = mlx5e_parse_mbuf_chain(&mb, &offset, eth_hdr_len, + sizeof(*ip6)); + if (unlikely(ip6 == NULL)) + return (0); + ip_type = ip6->ip6_nxt; + if (unlikely(ip_type != IPPROTO_UDP)) + return (0); + wqe->eth.swp_outer_l3_offset = eth_hdr_len / 2; + wqe->eth.cs_flags = MLX5_ETH_WQE_L3_CSUM | MLX5_ETH_WQE_L4_CSUM; + eth_hdr_len += sizeof(*ip6); + udp = mlx5e_parse_mbuf_chain(&mb, &offset, eth_hdr_len, + sizeof(*udp)); + if (unlikely(udp == NULL)) + return (0); + wqe->eth.swp_outer_l4_offset = eth_hdr_len / 2; + wqe->eth.swp_flags |= MLX5_ETH_WQE_SWP_OUTER_L4_TYPE | + MLX5_ETH_WQE_SWP_OUTER_L3_TYPE; + eth_hdr_len += sizeof(*udp); + break; + default: + return (0); + } + + /* + * If the hardware is not computing inner IP checksum, then + * skip inlining the inner outer UDP and VXLAN header: + */ + if (unlikely((cs_mask & MLX5_ETH_WQE_L3_INNER_CSUM) == 0)) + goto done; + if (unlikely(mlx5e_parse_mbuf_chain(&mb, &offset, eth_hdr_len, + 8) == NULL)) + return (0); + eth_hdr_len += 8; + + /* Check for ethernet header again. */ + eh = mlx5e_parse_mbuf_chain(&mb, &offset, eth_hdr_len, ETHER_HDR_LEN); + if (unlikely(eh == NULL)) + return (0); + if (eh->evl_encap_proto == htons(ETHERTYPE_VLAN)) { + if (unlikely(mb->m_len < eth_hdr_len - offset + ETHER_HDR_LEN + + ETHER_VLAN_ENCAP_LEN)) + return (0); + eth_type = eh->evl_proto; + eth_hdr_len += ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN; + } else { + eth_type = eh->evl_encap_proto; + eth_hdr_len += ETHER_HDR_LEN; + } + + /* Check for IP header again. */ + switch (eth_type) { + case htons(ETHERTYPE_IP): + ip4 = mlx5e_parse_mbuf_chain(&mb, &offset, eth_hdr_len, + sizeof(*ip4)); + if (unlikely(ip4 == NULL)) + return (0); + wqe->eth.swp_inner_l3_offset = eth_hdr_len / 2; + wqe->eth.cs_flags |= MLX5_ETH_WQE_L3_INNER_CSUM; + ip_type = ip4->ip_p; + ip_hlen = ip4->ip_hl << 2; + eth_hdr_len += ip_hlen; + break; + case htons(ETHERTYPE_IPV6): + ip6 = mlx5e_parse_mbuf_chain(&mb, &offset, eth_hdr_len, + sizeof(*ip6)); + if (unlikely(ip6 == NULL)) + return (0); + wqe->eth.swp_inner_l3_offset = eth_hdr_len / 2; + wqe->eth.cs_flags |= MLX5_ETH_WQE_L3_INNER_CSUM; + wqe->eth.swp_flags |= MLX5_ETH_WQE_SWP_INNER_L3_TYPE; + ip_type = ip6->ip6_nxt; + eth_hdr_len += sizeof(*ip6); + break; + default: + return (0); + } + + /* + * If the hardware is not computing inner UDP/TCP checksum, + * then skip inlining the inner UDP/TCP header: + */ + if (unlikely((cs_mask & MLX5_ETH_WQE_L4_INNER_CSUM) == 0)) + goto done; + + switch (ip_type) { + case IPPROTO_UDP: + udp = mlx5e_parse_mbuf_chain(&mb, &offset, eth_hdr_len, + sizeof(*udp)); + if (unlikely(udp == NULL)) + return (0); + wqe->eth.swp_inner_l4_offset = (eth_hdr_len / 2); + wqe->eth.cs_flags |= MLX5_ETH_WQE_L4_INNER_CSUM; + wqe->eth.swp_flags |= MLX5_ETH_WQE_SWP_INNER_L4_TYPE; + eth_hdr_len += sizeof(*udp); + break; + case IPPROTO_TCP: + th = mlx5e_parse_mbuf_chain(&mb, &offset, eth_hdr_len, + sizeof(*th)); + if (unlikely(th == NULL)) + return (0); + wqe->eth.swp_inner_l4_offset = eth_hdr_len / 2; + wqe->eth.cs_flags |= MLX5_ETH_WQE_L4_INNER_CSUM; + wqe->eth.swp_flags |= MLX5_ETH_WQE_SWP_INNER_L4_TYPE; + tcp_hlen = th->th_off << 2; + eth_hdr_len += tcp_hlen; + break; + default: + return (0); + } +done: + if (unlikely(pkt_hdr_len < eth_hdr_len)) + return (0); + + /* Account for software inserted VLAN tag, if any. */ + if (unlikely(has_outer_vlan_tag)) { + wqe->eth.swp_outer_l3_offset += ETHER_VLAN_ENCAP_LEN / 2; + wqe->eth.swp_outer_l4_offset += ETHER_VLAN_ENCAP_LEN / 2; + wqe->eth.swp_inner_l3_offset += ETHER_VLAN_ENCAP_LEN / 2; + wqe->eth.swp_inner_l4_offset += ETHER_VLAN_ENCAP_LEN / 2; + } + + /* + * When inner checksums are set, outer L4 checksum flag must + * be disabled. + */ + if (wqe->eth.cs_flags & (MLX5_ETH_WQE_L3_INNER_CSUM | + MLX5_ETH_WQE_L4_INNER_CSUM)) + wqe->eth.cs_flags &= ~MLX5_ETH_WQE_L4_CSUM; + + return (eth_hdr_len); +} + struct mlx5_wqe_dump_seg { struct mlx5_wqe_ctrl_seg ctrl; struct mlx5_wqe_data_seg data; @@ -574,8 +789,77 @@ top: num_pkts = DIV_ROUND_UP(payload_len, mss); sq->mbuf[pi].num_bytes = payload_len + (num_pkts * args.ihs); + sq->stats.tso_packets++; sq->stats.tso_bytes += payload_len; + } else if (mb->m_pkthdr.csum_flags & CSUM_ENCAP_VXLAN) { + /* check for inner TCP TSO first */ + if (mb->m_pkthdr.csum_flags & (CSUM_INNER_IP_TSO | + CSUM_INNER_IP6_TSO)) { + u32 payload_len; + u32 mss = mb->m_pkthdr.tso_segsz; + u32 num_pkts; + + wqe->eth.mss = cpu_to_be16(mss); + opcode = MLX5_OPCODE_LSO; + + if (likely(args.ihs == 0)) { + args.ihs = mlx5e_get_vxlan_header_size(mb, wqe, + MLX5_ETH_WQE_L3_INNER_CSUM | + MLX5_ETH_WQE_L4_INNER_CSUM | + MLX5_ETH_WQE_L4_CSUM | + MLX5_ETH_WQE_L3_CSUM, + opcode); + if (unlikely(args.ihs == 0)) { + err = EINVAL; + goto tx_drop; + } + } + + payload_len = mb->m_pkthdr.len - args.ihs; + if (payload_len == 0) + num_pkts = 1; + else + num_pkts = DIV_ROUND_UP(payload_len, mss); + sq->mbuf[pi].num_bytes = payload_len + + num_pkts * args.ihs; + + sq->stats.tso_packets++; + sq->stats.tso_bytes += payload_len; + } else { + opcode = MLX5_OPCODE_SEND; + + if (likely(args.ihs == 0)) { + uint8_t cs_mask; + + if (mb->m_pkthdr.csum_flags & + (CSUM_INNER_IP_TCP | CSUM_INNER_IP_UDP)) { + cs_mask = + MLX5_ETH_WQE_L3_INNER_CSUM | + MLX5_ETH_WQE_L4_INNER_CSUM | + MLX5_ETH_WQE_L4_CSUM | + MLX5_ETH_WQE_L3_CSUM; + } else if (mb->m_pkthdr.csum_flags & CSUM_INNER_IP) { + cs_mask = + MLX5_ETH_WQE_L3_INNER_CSUM | + MLX5_ETH_WQE_L4_CSUM | + MLX5_ETH_WQE_L3_CSUM; + } else { + cs_mask = + MLX5_ETH_WQE_L4_CSUM | + MLX5_ETH_WQE_L3_CSUM; + } + args.ihs = mlx5e_get_vxlan_header_size(mb, wqe, + cs_mask, opcode); + if (unlikely(args.ihs == 0)) { + err = EINVAL; + goto tx_drop; + } + } + + sq->mbuf[pi].num_bytes = max_t (unsigned int, + mb->m_pkthdr.len, ETHER_MIN_LEN - ETHER_CRC_LEN); + } } else { opcode = MLX5_OPCODE_SEND; @@ -622,7 +906,7 @@ top: /* Range checks */ if (unlikely(args.ihs > (sq->max_inline - ETHER_VLAN_ENCAP_LEN))) { - if (mb->m_pkthdr.csum_flags & CSUM_TSO) { + if (mb->m_pkthdr.csum_flags & (CSUM_TSO | CSUM_ENCAP_VXLAN)) { err = EINVAL; goto tx_drop; } @@ -646,7 +930,8 @@ top: } else { /* check if inline header size is too big */ if (unlikely(args.ihs > sq->max_inline)) { - if (unlikely(mb->m_pkthdr.csum_flags & CSUM_TSO)) { + if (unlikely(mb->m_pkthdr.csum_flags & (CSUM_TSO | + CSUM_ENCAP_VXLAN))) { err = EINVAL; goto tx_drop; } From owner-dev-commits-src-all@freebsd.org Mon Jul 26 15:19: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 273CA66E01F; Mon, 26 Jul 2021 15:19: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 4GYNrT6dRhz3JhJ; Mon, 26 Jul 2021 15:19: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 4A1351962A; Mon, 26 Jul 2021 15:19: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 16QFJbYp025605; Mon, 26 Jul 2021 15:19:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QFJbTa025604; Mon, 26 Jul 2021 15:19:37 GMT (envelope-from git) Date: Mon, 26 Jul 2021 15:19:37 GMT Message-Id: <202107261519.16QFJbTa025604@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: c0d0e85679ab - stable/13 - mlx5en: add mlx5e_add_vxlan_rule_from_db() helper 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: c0d0e85679ab47c0efa371044ef9086c78a4f62b 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, 26 Jul 2021 15:19:38 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=c0d0e85679ab47c0efa371044ef9086c78a4f62b commit c0d0e85679ab47c0efa371044ef9086c78a4f62b Author: Konstantin Belousov AuthorDate: 2021-04-14 07:08:56 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-26 13:51:11 +0000 mlx5en: add mlx5e_add_vxlan_rule_from_db() helper (cherry picked from commit 559eaa44d91ad74973612843835a8248b3df7341) --- sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c | 41 ++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c b/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c index 9e10a3728b1d..648dc199157c 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c @@ -1802,11 +1802,34 @@ mlx5e_vxlan_family_to_proto(sa_family_t family, u_int *proto) } static int -mlx5e_add_vxlan_rule(struct mlx5e_priv *priv, sa_family_t family, u_int port) +mlx5e_add_vxlan_rule_from_db(struct mlx5e_priv *priv, + struct mlx5e_vxlan_db_el *el) { - struct mlx5e_vxlan_db_el *el; u32 *match_criteria; u32 *match_value; + int err; + + match_value = mlx5_vzalloc(MLX5_ST_SZ_BYTES(fte_match_param)); + match_criteria = mlx5_vzalloc(MLX5_ST_SZ_BYTES(fte_match_param)); + if (match_value == NULL || match_criteria == NULL) { + mlx5_en_err(priv->ifp, "alloc failed\n"); + err = -ENOMEM; + goto add_vxlan_rule_out; + } + + err = mlx5e_add_vxlan_rule_sub(priv, match_criteria, match_value, el); + +add_vxlan_rule_out: + kvfree(match_criteria); + kvfree(match_value); + + return (err); +} + +static int +mlx5e_add_vxlan_rule(struct mlx5e_priv *priv, sa_family_t family, u_int port) +{ + struct mlx5e_vxlan_db_el *el; u_int proto; int err; @@ -1821,25 +1844,13 @@ mlx5e_add_vxlan_rule(struct mlx5e_priv *priv, sa_family_t family, u_int port) } el = mlx5e_vxlan_alloc_db_el(priv, proto, port); - match_value = mlx5_vzalloc(MLX5_ST_SZ_BYTES(fte_match_param)); - match_criteria = mlx5_vzalloc(MLX5_ST_SZ_BYTES(fte_match_param)); - if (match_value == NULL || match_criteria == NULL) { - mlx5_en_err(priv->ifp, "alloc failed\n"); - err = -ENOMEM; - goto add_vxlan_rule_out; - } - - err = mlx5e_add_vxlan_rule_sub(priv, match_criteria, match_value, el); + err = mlx5e_add_vxlan_rule_from_db(priv, el); if (err == 0) { TAILQ_INSERT_TAIL(&priv->vxlan.head, el, link); } else { kvfree(el); } -add_vxlan_rule_out: - kvfree(match_criteria); - kvfree(match_value); - return (err); } From owner-dev-commits-src-all@freebsd.org Mon Jul 26 15:19: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 2E1FB66DB4D; Mon, 26 Jul 2021 15:19: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 4GYNrS2hYVz3Jq9; Mon, 26 Jul 2021 15:19: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 2DE3819629; Mon, 26 Jul 2021 15:19: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 16QFJaQY025577; Mon, 26 Jul 2021 15:19:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QFJaW3025576; Mon, 26 Jul 2021 15:19:36 GMT (envelope-from git) Date: Mon, 26 Jul 2021 15:19:36 GMT Message-Id: <202107261519.16QFJaW3025576@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: 2226c0e78528 - stable/13 - mlx5en: remove unneeded protocol and port parameters from mlx5e_add_vxal_rule 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: 2226c0e78528a94675a071dfcf079ee211dacdfa 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, 26 Jul 2021 15:19:37 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=2226c0e78528a94675a071dfcf079ee211dacdfa commit 2226c0e78528a94675a071dfcf079ee211dacdfa Author: Konstantin Belousov AuthorDate: 2021-04-14 07:03:46 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-26 13:51:11 +0000 mlx5en: remove unneeded protocol and port parameters from mlx5e_add_vxal_rule (cherry picked from commit e012189d0265851c631261bdcb175727ba715b34) --- sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c b/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c index f4f9e494308e..9e10a3728b1d 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c @@ -1728,8 +1728,8 @@ mlx5e_destroy_vlan_flow_table(struct mlx5e_priv *priv) } static int -mlx5e_add_vxlan_rule_sub(struct mlx5e_priv *priv, u_int protocol, u_int port, - u32 *mc, u32 *mv, struct mlx5e_vxlan_db_el *el) +mlx5e_add_vxlan_rule_sub(struct mlx5e_priv *priv, u32 *mc, u32 *mv, + struct mlx5e_vxlan_db_el *el) { struct mlx5_flow_table *ft = priv->fts.vxlan.t; struct mlx5_flow_destination dest = {}; @@ -1743,11 +1743,11 @@ mlx5e_add_vxlan_rule_sub(struct mlx5e_priv *priv, u_int protocol, u_int port, mc_enable = MLX5_MATCH_OUTER_HEADERS; rule_p = &el->vxlan_ft_rule; MLX5_SET_TO_ONES(fte_match_param, mc, outer_headers.ethertype); - MLX5_SET(fte_match_param, mv, outer_headers.ethertype, protocol); + MLX5_SET(fte_match_param, mv, outer_headers.ethertype, el->proto); MLX5_SET_TO_ONES(fte_match_param, mc, outer_headers.ip_protocol); MLX5_SET(fte_match_param, mv, outer_headers.ip_protocol, IPPROTO_UDP); MLX5_SET_TO_ONES(fte_match_param, mc, outer_headers.udp_dport); - MLX5_SET(fte_match_param, mv, outer_headers.udp_dport, port); + MLX5_SET(fte_match_param, mv, outer_headers.udp_dport, el->port); *rule_p = mlx5_add_flow_rule(ft, mc_enable, mc, mv, MLX5_FLOW_CONTEXT_ACTION_FWD_DEST, MLX5_FS_ETH_FLOW_TAG, &dest); @@ -1829,8 +1829,7 @@ mlx5e_add_vxlan_rule(struct mlx5e_priv *priv, sa_family_t family, u_int port) goto add_vxlan_rule_out; } - err = mlx5e_add_vxlan_rule_sub(priv, proto, port, match_criteria, - match_value, el); + err = mlx5e_add_vxlan_rule_sub(priv, match_criteria, match_value, el); if (err == 0) { TAILQ_INSERT_TAIL(&priv->vxlan.head, el, link); } else { From owner-dev-commits-src-all@freebsd.org Mon Jul 26 15:19: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 D1E7E66DAB2; Mon, 26 Jul 2021 15:19: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 4GYNrK30jQz3Jbd; Mon, 26 Jul 2021 15:19: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 45DA119529; Mon, 26 Jul 2021 15:19: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 16QFJTuw025427; Mon, 26 Jul 2021 15:19:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QFJTrA025426; Mon, 26 Jul 2021 15:19:29 GMT (envelope-from git) Date: Mon, 26 Jul 2021 15:19:29 GMT Message-Id: <202107261519.16QFJTrA025426@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: 64f13da9dce6 - stable/13 - mlx5en: allow software parser for created send queues 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: 64f13da9dce6803a16ccd0400f73369c68b5ccc9 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, 26 Jul 2021 15:19:29 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=64f13da9dce6803a16ccd0400f73369c68b5ccc9 commit 64f13da9dce6803a16ccd0400f73369c68b5ccc9 Author: Konstantin Belousov AuthorDate: 2021-04-06 03:42:12 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-26 13:51:10 +0000 mlx5en: allow software parser for created send queues (cherry picked from commit 5e12b3bb43bcc4aacc859242d7a653e64d6b339a) --- sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index 1adf83cf57f9..92a7fc97279f 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -1733,6 +1733,7 @@ mlx5e_enable_sq(struct mlx5e_sq *sq, struct mlx5e_sq_param *param, MLX5_SET(sqc, sqc, state, MLX5_SQC_STATE_RST); MLX5_SET(sqc, sqc, tis_lst_sz, 1); MLX5_SET(sqc, sqc, flush_in_error_en, 1); + MLX5_SET(sqc, sqc, allow_swp, 1); MLX5_SET(wq, wq, wq_type, MLX5_WQ_TYPE_CYCLIC); MLX5_SET(wq, wq, uar_page, sq->priv->bfreg.index); From owner-dev-commits-src-all@freebsd.org Mon Jul 26 15:19: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 EFDD666DF39; Mon, 26 Jul 2021 15:19: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 4GYNrM6HbMz3Jrs; Mon, 26 Jul 2021 15:19: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 915A71952A; Mon, 26 Jul 2021 15:19: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 16QFJVTE025481; Mon, 26 Jul 2021 15:19:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QFJViS025479; Mon, 26 Jul 2021 15:19:31 GMT (envelope-from git) Date: Mon, 26 Jul 2021 15:19:31 GMT Message-Id: <202107261519.16QFJViS025479@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: 2ec7f3d2fe64 - stable/13 - mlx5en: handle offloaded Rx checksums calculated for tunneled packets 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: 2ec7f3d2fe648efdc0f67da6981b0d0027a0b1be 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, 26 Jul 2021 15:19:32 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=2ec7f3d2fe648efdc0f67da6981b0d0027a0b1be commit 2ec7f3d2fe648efdc0f67da6981b0d0027a0b1be Author: Konstantin Belousov AuthorDate: 2021-04-06 03:44:13 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-26 13:51:10 +0000 mlx5en: handle offloaded Rx checksums calculated for tunneled packets (cherry picked from commit 149349e01ecd3a4655f7cbebe54973f6f0b0b371) --- sys/dev/mlx5/mlx5_en/mlx5_en_rx.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c b/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c index 2bf189efc7e0..7cfd15b6aa5e 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c @@ -306,6 +306,10 @@ mlx5e_build_rx_mbuf(struct mlx5_cqe64 *cqe, } #else M_HASHTYPE_SET(mb, M_HASHTYPE_OPAQUE_HASH); +#endif +#ifdef M_HASHTYPE_SETINNER + if (cqe_is_tunneled(cqe)) + M_HASHTYPE_SETINNER(mb); #endif } else { mb->m_pkthdr.flowid = rq->ix; @@ -313,7 +317,27 @@ mlx5e_build_rx_mbuf(struct mlx5_cqe64 *cqe, } mb->m_pkthdr.rcvif = ifp; - if (likely(ifp->if_capenable & (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6)) && + if (cqe_is_tunneled(cqe)) { + /* + * CQE can be tunneled only if TIR is configured to + * enable parsing of tunneled payload, so no need to + * check for capabilities. + */ + if (((cqe->hds_ip_ext & (CQE_L2_OK | CQE_L3_OK)) == + (CQE_L2_OK | CQE_L3_OK))) { + mb->m_pkthdr.csum_flags |= + CSUM_INNER_L3_CALC | CSUM_INNER_L3_VALID | + CSUM_IP_CHECKED | CSUM_IP_VALID | + CSUM_DATA_VALID | CSUM_PSEUDO_HDR; + mb->m_pkthdr.csum_data = htons(0xffff); + } + if (((cqe->hds_ip_ext & (CQE_L2_OK | CQE_L3_OK | CQE_L4_OK)) == + (CQE_L2_OK | CQE_L3_OK | CQE_L4_OK))) { + mb->m_pkthdr.csum_flags |= + CSUM_INNER_L4_CALC | CSUM_INNER_L4_VALID; + } + } else if (likely((ifp->if_capenable & (IFCAP_RXCSUM | + IFCAP_RXCSUM_IPV6)) != 0) && ((cqe->hds_ip_ext & (CQE_L2_OK | CQE_L3_OK | CQE_L4_OK)) == (CQE_L2_OK | CQE_L3_OK | CQE_L4_OK))) { mb->m_pkthdr.csum_flags = From owner-dev-commits-src-all@freebsd.org Mon Jul 26 15:19: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 7909966DDAF; Mon, 26 Jul 2021 15:19: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 4GYNrR6q91z3Jc9; Mon, 26 Jul 2021 15:19: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 1A5FD193D9; Mon, 26 Jul 2021 15:19: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 16QFJYCZ025553; Mon, 26 Jul 2021 15:19:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QFJY9f025552; Mon, 26 Jul 2021 15:19:34 GMT (envelope-from git) Date: Mon, 26 Jul 2021 15:19:34 GMT Message-Id: <202107261519.16QFJY9f025552@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: 692ba7de91a9 - stable/13 - mlx5: fix typo, KENREL_MIN_LEVEL->KERNEL_MIN_LEVEL 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: 692ba7de91a934a4a91ec0a4f3c50c71ed2ed368 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, 26 Jul 2021 15:19:37 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=692ba7de91a934a4a91ec0a4f3c50c71ed2ed368 commit 692ba7de91a934a4a91ec0a4f3c50c71ed2ed368 Author: Konstantin Belousov AuthorDate: 2021-04-07 14:08:43 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-26 13:51:11 +0000 mlx5: fix typo, KENREL_MIN_LEVEL->KERNEL_MIN_LEVEL (cherry picked from commit 859e41e90165b00b99addf4c498b8ec031ba9df9) --- sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c b/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c index 55c7896e3d52..320831b6e153 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c @@ -68,8 +68,8 @@ #define BYPASS_PRIO_MAX_FT 1 #define KERNEL_MAX_FT 5 #define LEFTOVER_MAX_FT 1 -#define KENREL_MIN_LEVEL 3 -#define LEFTOVER_MIN_LEVEL KENREL_MIN_LEVEL + 1 +#define KERNEL_MIN_LEVEL 3 +#define LEFTOVER_MIN_LEVEL KERNEL_MIN_LEVEL + 1 #define BYPASS_MIN_LEVEL MLX5_NUM_BYPASS_FTS + LEFTOVER_MIN_LEVEL struct node_caps { size_t arr_sz; @@ -113,7 +113,7 @@ struct init_tree_node { BYPASS_PRIO_MAX_FT), ADD_FT_PRIO("prio-mcast", 0, BYPASS_PRIO_MAX_FT))), - ADD_PRIO("kernel_prio", 0, KENREL_MIN_LEVEL, 0, {}, + ADD_PRIO("kernel_prio", 0, KERNEL_MIN_LEVEL, 0, {}, ADD_NS("kernel_ns", ADD_FT_PRIO("prio_kernel-0", 0, KERNEL_MAX_FT))), From owner-dev-commits-src-all@freebsd.org Mon Jul 26 15:19: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 3F30E66DADC; Mon, 26 Jul 2021 15:19: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 4GYNrW0fKdz3JqJ; Mon, 26 Jul 2021 15:19: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 7236419257; Mon, 26 Jul 2021 15:19: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 16QFJc0G025639; Mon, 26 Jul 2021 15:19:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QFJcXq025638; Mon, 26 Jul 2021 15:19:38 GMT (envelope-from git) Date: Mon, 26 Jul 2021 15:19:38 GMT Message-Id: <202107261519.16QFJcXq025638@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: 779fd2390b97 - stable/13 - mlx5en: remove all dynamic vxlan steering rules on close and reinstall on 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: 779fd2390b97c18bcfc88ad717cef9c2171b5e85 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, 26 Jul 2021 15:19:39 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=779fd2390b97c18bcfc88ad717cef9c2171b5e85 commit 779fd2390b97c18bcfc88ad717cef9c2171b5e85 Author: Konstantin Belousov AuthorDate: 2021-04-14 07:09:36 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-26 13:51:11 +0000 mlx5en: remove all dynamic vxlan steering rules on close and reinstall on open (cherry picked from commit 0e4cb0d5a487339cc7f5e151c466e20aeac1e4d9) --- sys/dev/mlx5/mlx5_en/en.h | 4 ++++ sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c | 36 ++++++++++++++++++++++++++++++- sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 10 +++++++++ 3 files changed, 49 insertions(+), 1 deletion(-) diff --git a/sys/dev/mlx5/mlx5_en/en.h b/sys/dev/mlx5/mlx5_en/en.h index ab30c7e2ca90..e4b66bea8f60 100644 --- a/sys/dev/mlx5/mlx5_en/en.h +++ b/sys/dev/mlx5/mlx5_en/en.h @@ -948,6 +948,7 @@ struct mlx5e_vxlan_db_el { u_int refcount; u_int proto; u_int port; + bool installed; struct mlx5_flow_rule *vxlan_ft_rule; TAILQ_ENTRY(mlx5e_vxlan_db_el) link; }; @@ -1149,6 +1150,9 @@ void mlx5e_vxlan_start(void *arg, struct ifnet *ifp, sa_family_t family, void mlx5e_vxlan_stop(void *arg, struct ifnet *ifp, sa_family_t family, u_int port); +int mlx5e_add_all_vxlan_rules(struct mlx5e_priv *priv); +void mlx5e_del_all_vxlan_rules(struct mlx5e_priv *priv); + static inline void mlx5e_tx_notify_hw(struct mlx5e_sq *sq, u32 *wqe) { diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c b/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c index 648dc199157c..a493e530a4c8 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c @@ -1840,13 +1840,15 @@ mlx5e_add_vxlan_rule(struct mlx5e_priv *priv, sa_family_t family, u_int port) el = mlx5e_vxlan_find_db_el(priv, proto, port); if (el != NULL) { el->refcount++; - return (0); + if (el->installed) + return (0); } el = mlx5e_vxlan_alloc_db_el(priv, proto, port); err = mlx5e_add_vxlan_rule_from_db(priv, el); if (err == 0) { TAILQ_INSERT_TAIL(&priv->vxlan.head, el, link); + el->installed = true; } else { kvfree(el); } @@ -1905,6 +1907,25 @@ add_vxlan_rule_out: return (err); } +int +mlx5e_add_all_vxlan_rules(struct mlx5e_priv *priv) +{ + struct mlx5e_vxlan_db_el *el; + int err; + + err = 0; + TAILQ_FOREACH(el, &priv->vxlan.head, link) { + if (el->installed) + continue; + err = mlx5e_add_vxlan_rule_from_db(priv, el); + if (err != 0) + break; + el->installed = false; + } + + return (err); +} + static int mlx5e_del_vxlan_rule(struct mlx5e_priv *priv, sa_family_t family, u_int port) { @@ -1930,6 +1951,19 @@ mlx5e_del_vxlan_rule(struct mlx5e_priv *priv, sa_family_t family, u_int port) return (0); } +void +mlx5e_del_all_vxlan_rules(struct mlx5e_priv *priv) +{ + struct mlx5e_vxlan_db_el *el; + + TAILQ_FOREACH(el, &priv->vxlan.head, link) { + if (!el->installed) + continue; + mlx5_del_flow_rule(el->vxlan_ft_rule); + el->installed = false; + } +} + static void mlx5e_del_vxlan_catchall_rule(struct mlx5e_priv *priv) { diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index 26bd5e00d22d..9a01940ca90c 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -3144,6 +3144,12 @@ mlx5e_open_locked(struct ifnet *ifp) "mlx5e_add_all_vlan_rules failed, %d\n", err); goto err_close_flow_table; } + err = mlx5e_add_all_vxlan_rules(priv); + if (err) { + mlx5_en_err(ifp, + "mlx5e_add_all_vxlan_rules failed, %d\n", err); + goto err_del_vlan_rules; + } set_bit(MLX5E_STATE_OPENED, &priv->state); mlx5e_update_carrier(priv); @@ -3151,6 +3157,9 @@ mlx5e_open_locked(struct ifnet *ifp) return (0); +err_del_vlan_rules: + mlx5e_del_all_vlan_rules(priv); + err_close_flow_table: mlx5e_close_flow_table(priv); @@ -3204,6 +3213,7 @@ mlx5e_close_locked(struct ifnet *ifp) mlx5e_set_rx_mode_core(priv); mlx5e_del_all_vlan_rules(priv); + mlx5e_del_all_vxlan_rules(priv); if_link_state_change(priv->ifp, LINK_STATE_DOWN); mlx5e_close_flow_table(priv); mlx5e_close_tirs(priv, true); From owner-dev-commits-src-all@freebsd.org Mon Jul 26 15: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 D689066DDBF; Mon, 26 Jul 2021 15: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 4GYNrY4S3Kz3Jvf; Mon, 26 Jul 2021 15: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 ADEAB193DB; Mon, 26 Jul 2021 15:19: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 16QFJeZK025687; Mon, 26 Jul 2021 15:19:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QFJenm025686; Mon, 26 Jul 2021 15:19:40 GMT (envelope-from git) Date: Mon, 26 Jul 2021 15:19:40 GMT Message-Id: <202107261519.16QFJenm025686@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: 40fa8f462b33 - stable/13 - mlx5en: Fix for IPv6 VxLAN checksum offload. 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: 40fa8f462b33d4f30693a36ce7ba3ddd2b128143 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, 26 Jul 2021 15:19:42 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=40fa8f462b33d4f30693a36ce7ba3ddd2b128143 commit 40fa8f462b33d4f30693a36ce7ba3ddd2b128143 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:25 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-26 13:51:11 +0000 mlx5en: Fix for IPv6 VxLAN checksum offload. (cherry picked from commit 1918b253d36a82ccc171df40d9abb75923f1ece5) --- sys/dev/mlx5/mlx5_en/mlx5_en_tx.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c b/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c index 6bc0a91ca8ef..437910ee7964 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c @@ -423,7 +423,7 @@ mlx5e_get_vxlan_header_size(const struct mbuf *mb, struct mlx5e_tx_wqe *wqe, if (unlikely(ip_type != IPPROTO_UDP)) return (0); wqe->eth.swp_outer_l3_offset = eth_hdr_len / 2; - wqe->eth.cs_flags = MLX5_ETH_WQE_L3_CSUM | MLX5_ETH_WQE_L4_CSUM; + wqe->eth.cs_flags = MLX5_ETH_WQE_L4_CSUM; eth_hdr_len += sizeof(*ip6); udp = mlx5e_parse_mbuf_chain(&mb, &offset, eth_hdr_len, sizeof(*udp)); @@ -483,7 +483,6 @@ mlx5e_get_vxlan_header_size(const struct mbuf *mb, struct mlx5e_tx_wqe *wqe, if (unlikely(ip6 == NULL)) return (0); wqe->eth.swp_inner_l3_offset = eth_hdr_len / 2; - wqe->eth.cs_flags |= MLX5_ETH_WQE_L3_INNER_CSUM; wqe->eth.swp_flags |= MLX5_ETH_WQE_SWP_INNER_L3_TYPE; ip_type = ip6->ip6_nxt; eth_hdr_len += sizeof(*ip6); @@ -833,7 +832,8 @@ top: uint8_t cs_mask; if (mb->m_pkthdr.csum_flags & - (CSUM_INNER_IP_TCP | CSUM_INNER_IP_UDP)) { + (CSUM_INNER_IP_TCP | CSUM_INNER_IP_UDP | + CSUM_INNER_IP6_TCP | CSUM_INNER_IP6_UDP)) { cs_mask = MLX5_ETH_WQE_L3_INNER_CSUM | MLX5_ETH_WQE_L4_INNER_CSUM | From owner-dev-commits-src-all@freebsd.org Mon Jul 26 15:19: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 2D33066D7F1; Mon, 26 Jul 2021 15:19: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 4GYNrb59MYz3Jn3; Mon, 26 Jul 2021 15:19: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 02ED719722; Mon, 26 Jul 2021 15: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 16QFJgC4025737; Mon, 26 Jul 2021 15: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 16QFJglk025736; Mon, 26 Jul 2021 15:19:42 GMT (envelope-from git) Date: Mon, 26 Jul 2021 15:19:42 GMT Message-Id: <202107261519.16QFJglk025736@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: a6925a8e34a5 - stable/13 - mlx5en: vxlan: do not report TCP inner packet as UDP for software parser 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: a6925a8e34a5e57f4a2d3044d394e8954f1fba26 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, 26 Jul 2021 15:19:44 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=a6925a8e34a5e57f4a2d3044d394e8954f1fba26 commit a6925a8e34a5e57f4a2d3044d394e8954f1fba26 Author: Konstantin Belousov AuthorDate: 2021-07-22 11:53:30 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-26 13:51:11 +0000 mlx5en: vxlan: do not report TCP inner packet as UDP for software parser (cherry picked from commit 1db1e58d9384ff9171c248abbef71cf7aea5ebbe) --- sys/dev/mlx5/mlx5_en/mlx5_en_tx.c | 1 - 1 file changed, 1 deletion(-) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c b/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c index 437910ee7964..0e8e5f46d032 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c @@ -516,7 +516,6 @@ mlx5e_get_vxlan_header_size(const struct mbuf *mb, struct mlx5e_tx_wqe *wqe, return (0); wqe->eth.swp_inner_l4_offset = eth_hdr_len / 2; wqe->eth.cs_flags |= MLX5_ETH_WQE_L4_INNER_CSUM; - wqe->eth.swp_flags |= MLX5_ETH_WQE_SWP_INNER_L4_TYPE; tcp_hlen = th->th_off << 2; eth_hdr_len += tcp_hlen; break; From owner-dev-commits-src-all@freebsd.org Mon Jul 26 15:19: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 9ECD066E035; Mon, 26 Jul 2021 15:19: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 4GYNrd42mHz3JnG; Mon, 26 Jul 2021 15:19: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 4DFE91952C; Mon, 26 Jul 2021 15:19: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 16QFJjgU025789; Mon, 26 Jul 2021 15:19:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QFJjdw025788; Mon, 26 Jul 2021 15:19:45 GMT (envelope-from git) Date: Mon, 26 Jul 2021 15:19:45 GMT Message-Id: <202107261519.16QFJjdw025788@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: 4348f0758c96 - stable/13 - mlx5: Fix PPLM register mapping 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: 4348f0758c9685419db77882ed92d4a2cff94078 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, 26 Jul 2021 15:19:46 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=4348f0758c9685419db77882ed92d4a2cff94078 commit 4348f0758c9685419db77882ed92d4a2cff94078 Author: Konstantin Belousov AuthorDate: 2021-04-21 14:12:53 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-26 13:51:11 +0000 mlx5: Fix PPLM register mapping (cherry picked from commit 06a3fd0e5c86ae4f00075c1571cf4e183e28b4c4) --- sys/dev/mlx5/mlx5_ifc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/mlx5/mlx5_ifc.h b/sys/dev/mlx5/mlx5_ifc.h index f748ec876ef4..81e91e180b8c 100644 --- a/sys/dev/mlx5/mlx5_ifc.h +++ b/sys/dev/mlx5/mlx5_ifc.h @@ -8139,7 +8139,7 @@ struct mlx5_ifc_pplm_reg_bits { u8 fec_override_admin_100g_2x[0x10]; u8 fec_override_admin_50g_1x[0x10]; - u8 reserved_at_140[0xC0]; + u8 reserved_at_140[0x140]; }; struct mlx5_ifc_ppll_reg_bits { From owner-dev-commits-src-all@freebsd.org Mon Jul 26 15: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 9780D66E02F; Mon, 26 Jul 2021 15: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 4GYNrZ22NKz3Jvj; Mon, 26 Jul 2021 15: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 CCCCE1952B; Mon, 26 Jul 2021 15: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 16QFJfEu025711; Mon, 26 Jul 2021 15: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 16QFJfkG025710; Mon, 26 Jul 2021 15:19:41 GMT (envelope-from git) Date: Mon, 26 Jul 2021 15:19:41 GMT Message-Id: <202107261519.16QFJfkG025710@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: 976a59ba6da5 - stable/13 - mlx5en: Add missing error case when creating VXLAN flow tables. 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: 976a59ba6da59a9bebd609f792e23303de5df903 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, 26 Jul 2021 15:19:42 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=976a59ba6da59a9bebd609f792e23303de5df903 commit 976a59ba6da59a9bebd609f792e23303de5df903 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:27 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-26 13:51:11 +0000 mlx5en: Add missing error case when creating VXLAN flow tables. (cherry picked from commit 2f7ce2326f9486e90cda2f0129331e1ab3694252) --- sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c b/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c index 6be95550c713..cdfe19d910d1 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c @@ -2252,34 +2252,28 @@ mlx5e_open_flow_table(struct mlx5e_priv *priv) err = mlx5e_create_main_flow_table(priv, true); if (err) goto err_destroy_main_flow_table; - } - if ((priv->ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) { err = mlx5e_create_inner_rss_flow_table(priv); if (err) goto err_destroy_main_vxlan_flow_table; - } - if ((priv->ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) { err = mlx5e_add_vxlan_catchall_rule(priv); if (err != 0) goto err_destroy_inner_rss_flow_table; - } - if ((priv->ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) { err = mlx5e_add_main_vxlan_rules(priv); if (err != 0) - goto err_destroy_inner_rss_flow_table; + goto err_destroy_vxlan_catchall_rule; } return (0); +err_destroy_vxlan_catchall_rule: + mlx5e_del_vxlan_catchall_rule(priv); err_destroy_inner_rss_flow_table: - if ((priv->ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) - mlx5e_destroy_inner_rss_flow_table(priv); + mlx5e_destroy_inner_rss_flow_table(priv); err_destroy_main_vxlan_flow_table: - if ((priv->ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) - mlx5e_destroy_main_vxlan_flow_table(priv); + mlx5e_destroy_main_vxlan_flow_table(priv); err_destroy_main_flow_table: mlx5e_destroy_main_flow_table(priv); err_destroy_vxlan_flow_table: From owner-dev-commits-src-all@freebsd.org Mon Jul 26 15:19: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 508AF66DDAB; Mon, 26 Jul 2021 15:19: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 4GYNrR0F2lz3JkN; Mon, 26 Jul 2021 15:19: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 E2F9A193D8; Mon, 26 Jul 2021 15:19: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 16QFJXtn025529; Mon, 26 Jul 2021 15:19:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QFJXou025528; Mon, 26 Jul 2021 15:19:33 GMT (envelope-from git) Date: Mon, 26 Jul 2021 15:19:33 GMT Message-Id: <202107261519.16QFJXou025528@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: d2fcc95d3404 - stable/13 - mlx5en: announce mce(4) capabilities for stateless VxLAN offloading 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: d2fcc95d340468ff78ff667b9fda6e56ea92cf1f 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, 26 Jul 2021 15:19:35 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=d2fcc95d340468ff78ff667b9fda6e56ea92cf1f commit d2fcc95d340468ff78ff667b9fda6e56ea92cf1f Author: Konstantin Belousov AuthorDate: 2021-04-06 03:46:12 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-26 13:51:10 +0000 mlx5en: announce mce(4) capabilities for stateless VxLAN offloading (cherry picked from commit bf202a8d7afb2e024d3d29d4d90e24b3925e9f06) --- sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index b5de6b3903fd..26bd5e00d22d 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -3446,6 +3446,21 @@ mlx5e_ioctl(struct ifnet *ifp, u_long command, caddr_t data) ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING; if (mask & IFCAP_WOL_MAGIC) ifp->if_capenable ^= IFCAP_WOL_MAGIC; + if (mask & IFCAP_VXLAN_HWCSUM) { + ifp->if_capenable ^= IFCAP_VXLAN_HWCSUM; + ifp->if_hwassist ^= CSUM_INNER_IP | CSUM_INNER_IP_UDP | + CSUM_INNER_IP_TCP | CSUM_INNER_IP6_UDP | + CSUM_INNER_IP6_TCP; + if (test_bit(MLX5E_STATE_OPENED, &priv->state)) { + mlx5e_close_locked(ifp); + mlx5e_open_locked(ifp); + } + } + if (mask & IFCAP_VXLAN_HWTSO) { + ifp->if_capenable ^= IFCAP_VXLAN_HWTSO; + ifp->if_hwassist ^= CSUM_INNER_IP_TSO | + CSUM_INNER_IP6_TSO; + } VLAN_CAPABILITIES(ifp); /* turn off LRO means also turn of HW LRO - if it's on */ @@ -4421,6 +4436,7 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) #ifdef RATELIMIT ifp->if_capabilities |= IFCAP_TXRTLMT | IFCAP_TXTLS_RTLMT; #endif + ifp->if_capabilities |= IFCAP_VXLAN_HWCSUM | IFCAP_VXLAN_HWTSO; ifp->if_snd_tag_alloc = mlx5e_snd_tag_alloc; ifp->if_snd_tag_free = mlx5e_snd_tag_free; ifp->if_snd_tag_modify = mlx5e_snd_tag_modify; @@ -4441,6 +4457,12 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) ifp->if_hwassist |= (CSUM_TCP | CSUM_UDP | CSUM_IP); if (ifp->if_capenable & IFCAP_TXCSUM_IPV6) ifp->if_hwassist |= (CSUM_UDP_IPV6 | CSUM_TCP_IPV6); + if (ifp->if_capabilities & IFCAP_VXLAN_HWCSUM) + ifp->if_hwassist |= CSUM_INNER_IP6_UDP | CSUM_INNER_IP6_TCP | + CSUM_INNER_IP | CSUM_INNER_IP_UDP | CSUM_INNER_IP_TCP | + CSUM_ENCAP_VXLAN; + if (ifp->if_capabilities & IFCAP_VXLAN_HWTSO) + ifp->if_hwassist |= CSUM_INNER_IP6_TSO | CSUM_INNER_IP_TSO; /* ifnet sysctl tree */ sysctl_ctx_init(&priv->sysctl_ctx); From owner-dev-commits-src-all@freebsd.org Mon Jul 26 15:19: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 B7F6A66DDC5; Mon, 26 Jul 2021 15:19: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 4GYNrc5H95z3Jvv; Mon, 26 Jul 2021 15:19: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 272A4193DC; Mon, 26 Jul 2021 15:19: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 16QFJiNW025765; Mon, 26 Jul 2021 15:19:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QFJiHx025764; Mon, 26 Jul 2021 15:19:44 GMT (envelope-from git) Date: Mon, 26 Jul 2021 15:19:44 GMT Message-Id: <202107261519.16QFJiHx025764@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: 14e2413289ae - stable/13 - mlx5en: add ASCII art providing an overview of flow tables organization 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: 14e2413289aedabf20b521dcbe5e24b34ca0d34b 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, 26 Jul 2021 15:19:46 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=14e2413289aedabf20b521dcbe5e24b34ca0d34b commit 14e2413289aedabf20b521dcbe5e24b34ca0d34b Author: Konstantin Belousov AuthorDate: 2021-04-26 22:38:46 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-26 13:51:11 +0000 mlx5en: add ASCII art providing an overview of flow tables organization (cherry picked from commit b1277d42d718cd42d04d39fa2d61873655e909b3) --- sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c b/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c index cdfe19d910d1..54fbe8e057cc 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c @@ -31,6 +31,35 @@ #include #include +/* + * The flow tables with rules define the packet processing on receive. + * Currently, the following structure is set up to handle different offloads + * like VLAN decapsulation, packet classification, RSS hashing, VxLAN checksum + * offloading: + * + * + * +=========+ +=========+ +=================+ + * |VLAN ft: | |VxLAN | |VxLAN Main | + * |CTAG/STAG|------>| VNI|----->|Inner Proto Match|=====> Inner TIR n + * |VID/noVID|/ |Catch-all|\ | | + * +=========+ +=========+| +=================+ + * | + * | + * | + * v + * +=================+ + * |Main | + * |Outer Proto Match|=====> TIR n + * | | + * +=================+ + * + * The path through flow rules directs each packet into an appropriate TIR, + * according to the: + * - VLAN encapsulation + * - Outer protocol + * - Presence of inner protocol + */ + #define MLX5_SET_CFG(p, f, v) MLX5_SET(create_flow_group_in, p, f, v) enum { From owner-dev-commits-src-all@freebsd.org Mon Jul 26 15: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 0BE5566E086; Mon, 26 Jul 2021 15: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 4GYNrX2zTWz3JqQ; Mon, 26 Jul 2021 15:19: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 8CD20193DA; Mon, 26 Jul 2021 15:19: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 16QFJd4U025663; Mon, 26 Jul 2021 15:19:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QFJdaI025662; Mon, 26 Jul 2021 15:19:39 GMT (envelope-from git) Date: Mon, 26 Jul 2021 15:19:39 GMT Message-Id: <202107261519.16QFJdaI025662@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: 518c3f34d020 - stable/13 - mlx5en: Honor IFCAP_VXLAN_HWCSUM 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: 518c3f34d020b49f7baa73001cb4e4af6d81d1c7 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, 26 Jul 2021 15:19:41 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=518c3f34d020b49f7baa73001cb4e4af6d81d1c7 commit 518c3f34d020b49f7baa73001cb4e4af6d81d1c7 Author: Konstantin Belousov AuthorDate: 2021-04-20 11:16:47 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-26 13:51:11 +0000 mlx5en: Honor IFCAP_VXLAN_HWCSUM (cherry picked from commit 48acda2b2d6d173a2231a3db153dd4709dcb5276) --- sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c | 77 +++++++++++++++++++------------ sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 44 ++++++++++-------- 2 files changed, 74 insertions(+), 47 deletions(-) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c b/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c index a493e530a4c8..6be95550c713 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c @@ -732,7 +732,8 @@ mlx5e_add_vlan_rule_sub(struct mlx5e_priv *priv, int err = 0; dest.type = MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE; - dest.ft = priv->fts.vxlan.t; + dest.ft = ((priv->ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) ? + priv->fts.vxlan.t : priv->fts.main.t; mc_enable = MLX5_MATCH_OUTER_HEADERS; @@ -1845,13 +1846,15 @@ mlx5e_add_vxlan_rule(struct mlx5e_priv *priv, sa_family_t family, u_int port) } el = mlx5e_vxlan_alloc_db_el(priv, proto, port); - err = mlx5e_add_vxlan_rule_from_db(priv, el); - if (err == 0) { + if ((priv->ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) { + err = mlx5e_add_vxlan_rule_from_db(priv, el); + if (err == 0) + el->installed = true; + } + if (err == 0) TAILQ_INSERT_TAIL(&priv->vxlan.head, el, link); - el->installed = true; - } else { + else kvfree(el); - } return (err); } @@ -2235,40 +2238,53 @@ mlx5e_open_flow_table(struct mlx5e_priv *priv) if (err) return (err); - err = mlx5e_create_vxlan_flow_table(priv); - if (err) - goto err_destroy_vlan_flow_table; + if ((priv->ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) { + err = mlx5e_create_vxlan_flow_table(priv); + if (err) + goto err_destroy_vlan_flow_table; + } err = mlx5e_create_main_flow_table(priv, false); if (err) goto err_destroy_vxlan_flow_table; - err = mlx5e_create_main_flow_table(priv, true); - if (err) - goto err_destroy_main_flow_table; + if ((priv->ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) { + err = mlx5e_create_main_flow_table(priv, true); + if (err) + goto err_destroy_main_flow_table; + } - err = mlx5e_create_inner_rss_flow_table(priv); - if (err) - goto err_destroy_main_vxlan_flow_table; + if ((priv->ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) { + err = mlx5e_create_inner_rss_flow_table(priv); + if (err) + goto err_destroy_main_vxlan_flow_table; + } - err = mlx5e_add_vxlan_catchall_rule(priv); - if (err != 0) - goto err_destroy_inner_rss_flow_table; + if ((priv->ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) { + err = mlx5e_add_vxlan_catchall_rule(priv); + if (err != 0) + goto err_destroy_inner_rss_flow_table; + } - err = mlx5e_add_main_vxlan_rules(priv); - if (err != 0) - goto err_destroy_inner_rss_flow_table; + if ((priv->ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) { + err = mlx5e_add_main_vxlan_rules(priv); + if (err != 0) + goto err_destroy_inner_rss_flow_table; + } return (0); err_destroy_inner_rss_flow_table: - mlx5e_destroy_inner_rss_flow_table(priv); + if ((priv->ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) + mlx5e_destroy_inner_rss_flow_table(priv); err_destroy_main_vxlan_flow_table: - mlx5e_destroy_main_vxlan_flow_table(priv); + if ((priv->ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) + mlx5e_destroy_main_vxlan_flow_table(priv); err_destroy_main_flow_table: mlx5e_destroy_main_flow_table(priv); err_destroy_vxlan_flow_table: - mlx5e_destroy_vxlan_flow_table(priv); + if ((priv->ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) + mlx5e_destroy_vxlan_flow_table(priv); err_destroy_vlan_flow_table: mlx5e_destroy_vlan_flow_table(priv); @@ -2280,11 +2296,14 @@ mlx5e_close_flow_table(struct mlx5e_priv *priv) { mlx5e_handle_ifp_addr(priv); - mlx5e_destroy_inner_rss_flow_table(priv); - mlx5e_del_vxlan_catchall_rule(priv); - mlx5e_destroy_vxlan_flow_table(priv); - mlx5e_del_main_vxlan_rules(priv); + if ((priv->ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) { + mlx5e_destroy_inner_rss_flow_table(priv); + mlx5e_del_vxlan_catchall_rule(priv); + mlx5e_destroy_vxlan_flow_table(priv); + mlx5e_del_main_vxlan_rules(priv); + } mlx5e_destroy_main_flow_table(priv); - mlx5e_destroy_main_vxlan_flow_table(priv); + if ((priv->ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) + mlx5e_destroy_main_vxlan_flow_table(priv); mlx5e_destroy_vlan_flow_table(priv); } diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index 9a01940ca90c..ab1d627c0fbc 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -2810,10 +2810,8 @@ mlx5e_build_tir_ctx(struct mlx5e_priv *priv, u32 * tirc, int tt, bool inner_vxla lro_timer_supported_periods[2])); } - if (inner_vxlan && - (priv->ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) { + if (inner_vxlan) MLX5_SET(tirc, tirc, tunneled_offload_en, 1); - } /* setup parameters for hashing TIR type, if any */ switch (tt) { @@ -3127,10 +3125,13 @@ mlx5e_open_locked(struct ifnet *ifp) mlx5_en_err(ifp, "mlx5e_open_tir(main) failed, %d\n", err); goto err_close_rqls; } - err = mlx5e_open_tirs(priv, true); - if (err) { - mlx5_en_err(ifp, "mlx5e_open_tir(inner) failed, %d\n", err); - goto err_close_tirs; + if ((ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) { + err = mlx5e_open_tirs(priv, true); + if (err) { + mlx5_en_err(ifp, "mlx5e_open_tir(inner) failed, %d\n", + err); + goto err_close_tirs; + } } err = mlx5e_open_flow_table(priv); if (err) { @@ -3144,11 +3145,13 @@ mlx5e_open_locked(struct ifnet *ifp) "mlx5e_add_all_vlan_rules failed, %d\n", err); goto err_close_flow_table; } - err = mlx5e_add_all_vxlan_rules(priv); - if (err) { - mlx5_en_err(ifp, - "mlx5e_add_all_vxlan_rules failed, %d\n", err); - goto err_del_vlan_rules; + if ((ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) { + err = mlx5e_add_all_vxlan_rules(priv); + if (err) { + mlx5_en_err(ifp, + "mlx5e_add_all_vxlan_rules failed, %d\n", err); + goto err_del_vlan_rules; + } } set_bit(MLX5E_STATE_OPENED, &priv->state); @@ -3164,7 +3167,8 @@ err_close_flow_table: mlx5e_close_flow_table(priv); err_close_tirs_inner: - mlx5e_close_tirs(priv, true); + if ((ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) + mlx5e_close_tirs(priv, true); err_close_tirs: mlx5e_close_tirs(priv, false); @@ -3213,10 +3217,12 @@ mlx5e_close_locked(struct ifnet *ifp) mlx5e_set_rx_mode_core(priv); mlx5e_del_all_vlan_rules(priv); - mlx5e_del_all_vxlan_rules(priv); + if ((ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) + mlx5e_del_all_vxlan_rules(priv); if_link_state_change(priv->ifp, LINK_STATE_DOWN); mlx5e_close_flow_table(priv); - mlx5e_close_tirs(priv, true); + if ((ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) + mlx5e_close_tirs(priv, true); mlx5e_close_tirs(priv, false); mlx5e_close_rqt(priv); mlx5e_close_channels(priv); @@ -3457,14 +3463,16 @@ mlx5e_ioctl(struct ifnet *ifp, u_long command, caddr_t data) if (mask & IFCAP_WOL_MAGIC) ifp->if_capenable ^= IFCAP_WOL_MAGIC; if (mask & IFCAP_VXLAN_HWCSUM) { + int was_opened = test_bit(MLX5E_STATE_OPENED, + &priv->state); + if (was_opened) + mlx5e_close_locked(ifp); ifp->if_capenable ^= IFCAP_VXLAN_HWCSUM; ifp->if_hwassist ^= CSUM_INNER_IP | CSUM_INNER_IP_UDP | CSUM_INNER_IP_TCP | CSUM_INNER_IP6_UDP | CSUM_INNER_IP6_TCP; - if (test_bit(MLX5E_STATE_OPENED, &priv->state)) { - mlx5e_close_locked(ifp); + if (was_opened) mlx5e_open_locked(ifp); - } } if (mask & IFCAP_VXLAN_HWTSO) { ifp->if_capenable ^= IFCAP_VXLAN_HWTSO; From owner-dev-commits-src-all@freebsd.org Mon Jul 26 15:19: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 EAFDB66DDCB; Mon, 26 Jul 2021 15:19: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 4GYNrg6KZJz3Jw5; Mon, 26 Jul 2021 15:19: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 902681952D; Mon, 26 Jul 2021 15:19: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 16QFJlxC025838; Mon, 26 Jul 2021 15:19:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QFJlfc025837; Mon, 26 Jul 2021 15:19:47 GMT (envelope-from git) Date: Mon, 26 Jul 2021 15:19:47 GMT Message-Id: <202107261519.16QFJlfc025837@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: f2e512d09bbe - stable/13 - mlx5: add a knob to administratively disable mlx5 fw dump setup 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: f2e512d09bbe6f28b48a5df246b495c3f62eb0c6 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, 26 Jul 2021 15:19:49 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=f2e512d09bbe6f28b48a5df246b495c3f62eb0c6 commit f2e512d09bbe6f28b48a5df246b495c3f62eb0c6 Author: Konstantin Belousov AuthorDate: 2021-07-05 07:55:19 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-26 13:51:12 +0000 mlx5: add a knob to administratively disable mlx5 fw dump setup (cherry picked from commit 8391db038df87e0fa5519617e3bb35a2cf78b41e) --- sys/dev/mlx5/mlx5_core/mlx5_fwdump.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c b/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c index 09e8f9f7660a..7bb563846144 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c @@ -59,6 +59,11 @@ mlx5_fwdump_destroy_dd(struct mlx5_core_dev *mdev) mdev->dump_data = NULL; } +static int mlx5_fw_dump_enable = 1; +SYSCTL_INT(_hw_mlx5, OID_AUTO, fw_dump_enable, CTLFLAG_RDTUN | CTLFLAG_NOFETCH, + &mlx5_fw_dump_enable, 0, + "Enable fw dump setup and op"); + void mlx5_fwdump_prep(struct mlx5_core_dev *mdev) { @@ -68,6 +73,14 @@ mlx5_fwdump_prep(struct mlx5_core_dev *mdev) u32 addr, in, out, next_addr; mdev->dump_data = NULL; + + TUNABLE_INT_FETCH("hw.mlx5.fw_dump_enable", &mlx5_fw_dump_enable); + if (!mlx5_fw_dump_enable) { + mlx5_core_warn(mdev, + "Firmware dump administratively prohibited\n"); + return; + } + error = mlx5_vsc_find_cap(mdev); if (error != 0) { /* Inability to create a firmware dump is not fatal. */ From owner-dev-commits-src-all@freebsd.org Mon Jul 26 15:19: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 AD2D166E0A4; Mon, 26 Jul 2021 15:19: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 4GYNrj33Zdz3Jsn; Mon, 26 Jul 2021 15:19: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 B5F3419723; Mon, 26 Jul 2021 15:19: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 16QFJmG0025862; Mon, 26 Jul 2021 15:19:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QFJm9j025861; Mon, 26 Jul 2021 15:19:48 GMT (envelope-from git) Date: Mon, 26 Jul 2021 15:19:48 GMT Message-Id: <202107261519.16QFJm9j025861@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: 9dee4f67892b - stable/13 - mlx5: drop Giant around VSC lock and CRSPACE enumeration on attach 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: 9dee4f67892bf82369e4fedf8353354f01346d93 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, 26 Jul 2021 15:19:49 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=9dee4f67892bf82369e4fedf8353354f01346d93 commit 9dee4f67892bf82369e4fedf8353354f01346d93 Author: Konstantin Belousov AuthorDate: 2021-07-05 09:24:00 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-26 13:51:12 +0000 mlx5: drop Giant around VSC lock and CRSPACE enumeration on attach (cherry picked from commit 78f5ebaed62e38caafc72f4ec1c0a7c2013e15c7) --- sys/dev/mlx5/mlx5_core/mlx5_fwdump.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c b/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c index 7bb563846144..a23de943f4aa 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c @@ -81,17 +81,19 @@ mlx5_fwdump_prep(struct mlx5_core_dev *mdev) return; } + DROP_GIANT(); + error = mlx5_vsc_find_cap(mdev); if (error != 0) { /* Inability to create a firmware dump is not fatal. */ mlx5_core_warn(mdev, "Unable to find vendor-specific capability, error %d\n", error); - return; + goto pickup_g; } error = mlx5_vsc_lock(mdev); if (error != 0) - return; + goto pickup_g; error = mlx5_vsc_set_space(mdev, MLX5_VSC_DOMAIN_SCAN_CRSPACE); if (error != 0) { mlx5_core_warn(mdev, "VSC scan space is not supported\n"); @@ -180,6 +182,8 @@ mlx5_fwdump_prep(struct mlx5_core_dev *mdev) unlock_vsc: mlx5_vsc_unlock(mdev); +pickup_g: + PICKUP_GIANT(); } int From owner-dev-commits-src-all@freebsd.org Mon Jul 26 15:19: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 DB91566DFBE; Mon, 26 Jul 2021 15:19: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 4GYNrf4RrQz3K1T; Mon, 26 Jul 2021 15:19: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 64D041962B; Mon, 26 Jul 2021 15:19: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 16QFJkTQ025813; Mon, 26 Jul 2021 15:19:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QFJkkr025812; Mon, 26 Jul 2021 15:19:46 GMT (envelope-from git) Date: Mon, 26 Jul 2021 15:19:46 GMT Message-Id: <202107261519.16QFJkkr025812@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: 180c45c1b4d3 - stable/13 - mlx5: Fix PBMC register mapping 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: 180c45c1b4d33a6d2c185e9a9bef30e8a35dd8c1 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, 26 Jul 2021 15:19:48 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=180c45c1b4d33a6d2c185e9a9bef30e8a35dd8c1 commit 180c45c1b4d33a6d2c185e9a9bef30e8a35dd8c1 Author: Konstantin Belousov AuthorDate: 2021-04-26 11:39:11 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-26 13:51:12 +0000 mlx5: Fix PBMC register mapping (cherry picked from commit 0fc0b62b0f7be49bcf4c5670a6c81386e333fb02) --- sys/dev/mlx5/mlx5_ifc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/mlx5/mlx5_ifc.h b/sys/dev/mlx5/mlx5_ifc.h index 81e91e180b8c..494180630500 100644 --- a/sys/dev/mlx5/mlx5_ifc.h +++ b/sys/dev/mlx5/mlx5_ifc.h @@ -8839,7 +8839,7 @@ struct mlx5_ifc_pbmc_reg_bits { struct mlx5_ifc_bufferx_reg_bits buffer[10]; - u8 reserved_at_2e0[0x40]; + u8 reserved_at_2e0[0x80]; }; struct mlx5_ifc_paos_reg_bits { From owner-dev-commits-src-all@freebsd.org Mon Jul 26 15:38: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 4192C66ED5B; Mon, 26 Jul 2021 15:38: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 4GYPFv1C4Fz3Q3q; Mon, 26 Jul 2021 15:38: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 05B9B19A90; Mon, 26 Jul 2021 15:38: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 16QFcAvY051886; Mon, 26 Jul 2021 15:38:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QFcA4S051885; Mon, 26 Jul 2021 15:38:10 GMT (envelope-from git) Date: Mon, 26 Jul 2021 15:38:10 GMT Message-Id: <202107261538.16QFcA4S051885@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: 2bfba2a04b05 - main - Cirrus-CI: Temporarily skip package build + test 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: 2bfba2a04b05524d72a6190164aa5aaa1d29e337 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, 26 Jul 2021 15:38:11 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=2bfba2a04b05524d72a6190164aa5aaa1d29e337 commit 2bfba2a04b05524d72a6190164aa5aaa1d29e337 Author: Ed Maste AuthorDate: 2021-07-26 14:33:09 +0000 Commit: Ed Maste CommitDate: 2021-07-26 14:36:39 +0000 Cirrus-CI: Temporarily skip package build + test The PKG_FORMAT=tar used by Cirrus CI's pkgbase build is failing after 6cafdee71d2b ("pkgbase: Track pkg 1.17"). Skip package build and test in Cirrus-CI until new pkg is available. PR: 257422 Sponsored by: The FreeBSD Foundation --- .cirrus.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 575f882b8b48..9760695bb654 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -23,10 +23,10 @@ task: - chown user:user /usr/obj/$(pwd -P) script: - su user -c "make -j$(sysctl -n hw.ncpu) CROSS_TOOLCHAIN=llvm12 WITHOUT_TOOLCHAIN=yes buildworld buildkernel" - package_script: - - su user -c "make CROSS_TOOLCHAIN=llvm12 WITHOUT_TOOLCHAIN=yes PKG_FORMAT=tar packages" - test_script: - - sh tools/boot/ci-qemu-test.sh +# package_script: +# - su user -c "make CROSS_TOOLCHAIN=llvm12 WITHOUT_TOOLCHAIN=yes PKG_FORMAT=tar packages" +# test_script: +# - sh tools/boot/ci-qemu-test.sh post_script: - df -m - du -m -s /usr/obj From owner-dev-commits-src-all@freebsd.org Mon Jul 26 16:13: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 2781A66F5C6; Mon, 26 Jul 2021 16:13: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 4GYQ2C0K3qz3pSL; Mon, 26 Jul 2021 16:13: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 E7B091A1A2; Mon, 26 Jul 2021 16:13: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 16QGD6Cq005004; Mon, 26 Jul 2021 16:13:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGD69I005003; Mon, 26 Jul 2021 16:13:06 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:06 GMT Message-Id: <202107261613.16QGD69I005003@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 906117f77367 - stable/13 - mlx5en: Add missing media types for 100GBit/s, 200Gbit/s and 400Gbit/s. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 906117f7736723fa035ea7ec33c160d0b1830cc0 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, 26 Jul 2021 16:13:07 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=906117f7736723fa035ea7ec33c160d0b1830cc0 commit 906117f7736723fa035ea7ec33c160d0b1830cc0 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:28 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:28 +0000 mlx5en: Add missing media types for 100GBit/s, 200Gbit/s and 400Gbit/s. Make the mlx5e_mode_table[] array one dimensional, because there is only one entry, 10G ER/LR, which share the same protocol bit. This patch only adds support for basic sub-type distinguishing for the extended protocol bits. Use verbose ifconfig eeprom output to get actual media type. Remove write only "connector_type" variable while at it. Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit a888087fba37da7c968058062b644f4a79b558c3) --- sys/dev/mlx5/mlx5_core/mlx5_port.c | 15 ++ sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 421 +++++++++++++++++------------------- sys/dev/mlx5/port.h | 85 ++------ 3 files changed, 232 insertions(+), 289 deletions(-) diff --git a/sys/dev/mlx5/mlx5_core/mlx5_port.c b/sys/dev/mlx5/mlx5_core/mlx5_port.c index b74efc5351ea..b303c7b07c7d 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_port.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_port.c @@ -1221,6 +1221,21 @@ int mlx5_query_pddr_range_info(struct mlx5_core_dev *mdev, u8 local_port, u8 *is } EXPORT_SYMBOL_GPL(mlx5_query_pddr_range_info); +int mlx5_query_pddr_cable_type(struct mlx5_core_dev *mdev, u8 local_port, u8 *cable_type) +{ + u32 pddr_reg[MLX5_ST_SZ_DW(pddr_reg)] = {}; + int error; + + error = mlx5_query_pddr(mdev, local_port, MLX5_PDDR_MODULE_INFO_PAGE, + pddr_reg, sizeof(pddr_reg)); + if (error != 0) + return (error); + + *cable_type = MLX5_GET(pddr_reg, pddr_reg, page_data.pddr_module_info.cable_type); + return (0); +} +EXPORT_SYMBOL_GPL(mlx5_query_pddr_cable_type); + int mlx5_query_pddr_troubleshooting_info(struct mlx5_core_dev *mdev, u16 *monitor_opcode, u8 *status_message, size_t sm_len) { diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index ab1d627c0fbc..57da44e68de3 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2015-2018 Mellanox Technologies. All rights reserved. + * Copyright (c) 2015-2021 Mellanox Technologies. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -57,356 +57,301 @@ struct media { u64 baudrate; }; -static const struct media mlx5e_mode_table[MLX5E_LINK_SPEEDS_NUMBER][MLX5E_LINK_MODES_NUMBER] = { - - [MLX5E_1000BASE_CX_SGMII][MLX5E_SGMII] = { +static const struct media mlx5e_mode_table[MLX5E_LINK_SPEEDS_NUMBER] = +{ + [MLX5E_1000BASE_CX_SGMII] = { .subtype = IFM_1000_CX_SGMII, .baudrate = IF_Mbps(1000ULL), }, - [MLX5E_1000BASE_KX][MLX5E_KX] = { + [MLX5E_1000BASE_KX] = { .subtype = IFM_1000_KX, .baudrate = IF_Mbps(1000ULL), }, - [MLX5E_10GBASE_CX4][MLX5E_CX4] = { + [MLX5E_10GBASE_CX4] = { .subtype = IFM_10G_CX4, .baudrate = IF_Gbps(10ULL), }, - [MLX5E_10GBASE_KX4][MLX5E_KX4] = { + [MLX5E_10GBASE_KX4] = { .subtype = IFM_10G_KX4, .baudrate = IF_Gbps(10ULL), }, - [MLX5E_10GBASE_KR][MLX5E_KR] = { + [MLX5E_10GBASE_KR] = { .subtype = IFM_10G_KR, .baudrate = IF_Gbps(10ULL), }, - [MLX5E_20GBASE_KR2][MLX5E_KR2] = { + [MLX5E_20GBASE_KR2] = { .subtype = IFM_20G_KR2, .baudrate = IF_Gbps(20ULL), }, - [MLX5E_40GBASE_CR4][MLX5E_CR4] = { + [MLX5E_40GBASE_CR4] = { .subtype = IFM_40G_CR4, .baudrate = IF_Gbps(40ULL), }, - [MLX5E_40GBASE_KR4][MLX5E_KR4] = { + [MLX5E_40GBASE_KR4] = { .subtype = IFM_40G_KR4, .baudrate = IF_Gbps(40ULL), }, - [MLX5E_56GBASE_R4][MLX5E_R] = { + [MLX5E_56GBASE_R4] = { .subtype = IFM_56G_R4, .baudrate = IF_Gbps(56ULL), }, - [MLX5E_10GBASE_CR][MLX5E_CR1] = { + [MLX5E_10GBASE_CR] = { .subtype = IFM_10G_CR1, .baudrate = IF_Gbps(10ULL), }, - [MLX5E_10GBASE_SR][MLX5E_SR] = { + [MLX5E_10GBASE_SR] = { .subtype = IFM_10G_SR, .baudrate = IF_Gbps(10ULL), }, - [MLX5E_10GBASE_ER_LR][MLX5E_ER] = { + [MLX5E_10GBASE_ER_LR] = { .subtype = IFM_10G_ER, .baudrate = IF_Gbps(10ULL), }, - [MLX5E_10GBASE_ER_LR][MLX5E_LR] = { - .subtype = IFM_10G_LR, - .baudrate = IF_Gbps(10ULL), - }, - [MLX5E_40GBASE_SR4][MLX5E_SR4] = { + [MLX5E_40GBASE_SR4] = { .subtype = IFM_40G_SR4, .baudrate = IF_Gbps(40ULL), }, - [MLX5E_40GBASE_LR4_ER4][MLX5E_LR4] = { + [MLX5E_40GBASE_LR4_ER4] = { .subtype = IFM_40G_LR4, .baudrate = IF_Gbps(40ULL), }, - [MLX5E_40GBASE_LR4_ER4][MLX5E_ER4] = { - .subtype = IFM_40G_ER4, - .baudrate = IF_Gbps(40ULL), - }, - [MLX5E_100GBASE_CR4][MLX5E_CR4] = { + [MLX5E_100GBASE_CR4] = { .subtype = IFM_100G_CR4, .baudrate = IF_Gbps(100ULL), }, - [MLX5E_100GBASE_SR4][MLX5E_SR4] = { + [MLX5E_100GBASE_SR4] = { .subtype = IFM_100G_SR4, .baudrate = IF_Gbps(100ULL), }, - [MLX5E_100GBASE_KR4][MLX5E_KR4] = { + [MLX5E_100GBASE_KR4] = { .subtype = IFM_100G_KR4, .baudrate = IF_Gbps(100ULL), }, - [MLX5E_100GBASE_LR4][MLX5E_LR4] = { + [MLX5E_100GBASE_LR4] = { .subtype = IFM_100G_LR4, .baudrate = IF_Gbps(100ULL), }, - [MLX5E_100BASE_TX][MLX5E_TX] = { + [MLX5E_100BASE_TX] = { .subtype = IFM_100_TX, .baudrate = IF_Mbps(100ULL), }, - [MLX5E_1000BASE_T][MLX5E_T] = { + [MLX5E_1000BASE_T] = { .subtype = IFM_1000_T, .baudrate = IF_Mbps(1000ULL), }, - [MLX5E_10GBASE_T][MLX5E_T] = { + [MLX5E_10GBASE_T] = { .subtype = IFM_10G_T, .baudrate = IF_Gbps(10ULL), }, - [MLX5E_25GBASE_CR][MLX5E_CR] = { + [MLX5E_25GBASE_CR] = { .subtype = IFM_25G_CR, .baudrate = IF_Gbps(25ULL), }, - [MLX5E_25GBASE_KR][MLX5E_KR] = { + [MLX5E_25GBASE_KR] = { .subtype = IFM_25G_KR, .baudrate = IF_Gbps(25ULL), }, - [MLX5E_25GBASE_SR][MLX5E_SR] = { + [MLX5E_25GBASE_SR] = { .subtype = IFM_25G_SR, .baudrate = IF_Gbps(25ULL), }, - [MLX5E_50GBASE_CR2][MLX5E_CR2] = { + [MLX5E_50GBASE_CR2] = { .subtype = IFM_50G_CR2, .baudrate = IF_Gbps(50ULL), }, - [MLX5E_50GBASE_KR2][MLX5E_KR2] = { + [MLX5E_50GBASE_KR2] = { .subtype = IFM_50G_KR2, .baudrate = IF_Gbps(50ULL), }, - [MLX5E_50GBASE_KR4][MLX5E_KR4] = { + [MLX5E_50GBASE_KR4] = { .subtype = IFM_50G_KR4, .baudrate = IF_Gbps(50ULL), }, }; -static const struct media mlx5e_ext_mode_table[MLX5E_EXT_LINK_SPEEDS_NUMBER][MLX5E_LINK_MODES_NUMBER] = { - [MLX5E_SGMII_100M][MLX5E_SGMII] = { +static const struct media mlx5e_ext_mode_table[MLX5E_EXT_LINK_SPEEDS_NUMBER][MLX5E_CABLE_TYPE_NUMBER] = +{ + /**/ + [MLX5E_SGMII_100M][MLX5E_CABLE_TYPE_UNKNOWN] = { .subtype = IFM_100_SGMII, .baudrate = IF_Mbps(100), }, - [MLX5E_1000BASE_X_SGMII][MLX5E_KX] = { - .subtype = IFM_1000_KX, - .baudrate = IF_Mbps(1000), - }, - [MLX5E_1000BASE_X_SGMII][MLX5E_CX_SGMII] = { - .subtype = IFM_1000_CX_SGMII, - .baudrate = IF_Mbps(1000), - }, - [MLX5E_1000BASE_X_SGMII][MLX5E_CX] = { + + /**/ + [MLX5E_1000BASE_X_SGMII][MLX5E_CABLE_TYPE_UNKNOWN] = { .subtype = IFM_1000_CX, .baudrate = IF_Mbps(1000), }, - [MLX5E_1000BASE_X_SGMII][MLX5E_LX] = { - .subtype = IFM_1000_LX, - .baudrate = IF_Mbps(1000), - }, - [MLX5E_1000BASE_X_SGMII][MLX5E_SX] = { + [MLX5E_1000BASE_X_SGMII][MLX5E_CABLE_TYPE_OPTICAL_MODULE] = { .subtype = IFM_1000_SX, .baudrate = IF_Mbps(1000), }, - [MLX5E_1000BASE_X_SGMII][MLX5E_T] = { - .subtype = IFM_1000_T, - .baudrate = IF_Mbps(1000), - }, - [MLX5E_5GBASE_R][MLX5E_T] = { - .subtype = IFM_5000_T, - .baudrate = IF_Mbps(5000), - }, - [MLX5E_5GBASE_R][MLX5E_KR] = { + + /**/ + [MLX5E_5GBASE_R][MLX5E_CABLE_TYPE_UNKNOWN] = { .subtype = IFM_5000_KR, .baudrate = IF_Mbps(5000), }, - [MLX5E_5GBASE_R][MLX5E_KR1] = { - .subtype = IFM_5000_KR1, - .baudrate = IF_Mbps(5000), - }, - [MLX5E_5GBASE_R][MLX5E_KR_S] = { - .subtype = IFM_5000_KR_S, + [MLX5E_5GBASE_R][MLX5E_CABLE_TYPE_TWISTED_PAIR] = { + .subtype = IFM_5000_T, .baudrate = IF_Mbps(5000), }, - [MLX5E_10GBASE_XFI_XAUI_1][MLX5E_ER] = { - .subtype = IFM_10G_ER, - .baudrate = IF_Gbps(10ULL), - }, - [MLX5E_10GBASE_XFI_XAUI_1][MLX5E_KR] = { + + /**/ + [MLX5E_10GBASE_XFI_XAUI_1][MLX5E_CABLE_TYPE_UNKNOWN] = { .subtype = IFM_10G_KR, .baudrate = IF_Gbps(10ULL), }, - [MLX5E_10GBASE_XFI_XAUI_1][MLX5E_LR] = { - .subtype = IFM_10G_LR, + [MLX5E_10GBASE_XFI_XAUI_1][MLX5E_CABLE_TYPE_PASSIVE_COPPER] = { + .subtype = IFM_10G_CR1, .baudrate = IF_Gbps(10ULL), }, - [MLX5E_10GBASE_XFI_XAUI_1][MLX5E_SR] = { + [MLX5E_10GBASE_XFI_XAUI_1][MLX5E_CABLE_TYPE_OPTICAL_MODULE] = { .subtype = IFM_10G_SR, .baudrate = IF_Gbps(10ULL), }, - [MLX5E_10GBASE_XFI_XAUI_1][MLX5E_T] = { - .subtype = IFM_10G_T, - .baudrate = IF_Gbps(10ULL), - }, - [MLX5E_10GBASE_XFI_XAUI_1][MLX5E_AOC] = { - .subtype = IFM_10G_AOC, - .baudrate = IF_Gbps(10ULL), - }, - [MLX5E_10GBASE_XFI_XAUI_1][MLX5E_CR1] = { - .subtype = IFM_10G_CR1, - .baudrate = IF_Gbps(10ULL), - }, - [MLX5E_40GBASE_XLAUI_4_XLPPI_4][MLX5E_CR4] = { - .subtype = IFM_40G_CR4, - .baudrate = IF_Gbps(40ULL), - }, - [MLX5E_40GBASE_XLAUI_4_XLPPI_4][MLX5E_KR4] = { + + /**/ + [MLX5E_40GBASE_XLAUI_4_XLPPI_4][MLX5E_CABLE_TYPE_UNKNOWN] = { .subtype = IFM_40G_KR4, .baudrate = IF_Gbps(40ULL), }, - [MLX5E_40GBASE_XLAUI_4_XLPPI_4][MLX5E_LR4] = { - .subtype = IFM_40G_LR4, + [MLX5E_40GBASE_XLAUI_4_XLPPI_4][MLX5E_CABLE_TYPE_PASSIVE_COPPER] = { + .subtype = IFM_40G_CR4, .baudrate = IF_Gbps(40ULL), }, - [MLX5E_40GBASE_XLAUI_4_XLPPI_4][MLX5E_SR4] = { + [MLX5E_40GBASE_XLAUI_4_XLPPI_4][MLX5E_CABLE_TYPE_OPTICAL_MODULE] = { .subtype = IFM_40G_SR4, .baudrate = IF_Gbps(40ULL), }, - [MLX5E_40GBASE_XLAUI_4_XLPPI_4][MLX5E_ER4] = { - .subtype = IFM_40G_ER4, - .baudrate = IF_Gbps(40ULL), - }, - [MLX5E_25GAUI_1_25GBASE_CR_KR][MLX5E_CR] = { - .subtype = IFM_25G_CR, - .baudrate = IF_Gbps(25ULL), - }, - [MLX5E_25GAUI_1_25GBASE_CR_KR][MLX5E_KR] = { + /**/ + [MLX5E_25GAUI_1_25GBASE_CR_KR][MLX5E_CABLE_TYPE_UNKNOWN] = { .subtype = IFM_25G_KR, .baudrate = IF_Gbps(25ULL), }, - [MLX5E_25GAUI_1_25GBASE_CR_KR][MLX5E_SR] = { - .subtype = IFM_25G_SR, - .baudrate = IF_Gbps(25ULL), - }, - [MLX5E_25GAUI_1_25GBASE_CR_KR][MLX5E_ACC] = { - .subtype = IFM_25G_ACC, - .baudrate = IF_Gbps(25ULL), - }, - [MLX5E_25GAUI_1_25GBASE_CR_KR][MLX5E_AOC] = { - .subtype = IFM_25G_AOC, - .baudrate = IF_Gbps(25ULL), - }, - [MLX5E_25GAUI_1_25GBASE_CR_KR][MLX5E_CR1] = { - .subtype = IFM_25G_CR1, - .baudrate = IF_Gbps(25ULL), - }, - [MLX5E_25GAUI_1_25GBASE_CR_KR][MLX5E_CR_S] = { - .subtype = IFM_25G_CR_S, - .baudrate = IF_Gbps(25ULL), - }, - [MLX5E_25GAUI_1_25GBASE_CR_KR][MLX5E_KR1] = { - .subtype = IFM_5000_KR1, - .baudrate = IF_Gbps(25ULL), - }, - [MLX5E_25GAUI_1_25GBASE_CR_KR][MLX5E_KR_S] = { - .subtype = IFM_25G_KR_S, + [MLX5E_25GAUI_1_25GBASE_CR_KR][MLX5E_CABLE_TYPE_PASSIVE_COPPER] = { + .subtype = IFM_25G_CR, .baudrate = IF_Gbps(25ULL), }, - [MLX5E_25GAUI_1_25GBASE_CR_KR][MLX5E_LR] = { - .subtype = IFM_25G_LR, + [MLX5E_25GAUI_1_25GBASE_CR_KR][MLX5E_CABLE_TYPE_OPTICAL_MODULE] = { + .subtype = IFM_25G_SR, .baudrate = IF_Gbps(25ULL), }, - [MLX5E_25GAUI_1_25GBASE_CR_KR][MLX5E_T] = { + [MLX5E_25GAUI_1_25GBASE_CR_KR][MLX5E_CABLE_TYPE_TWISTED_PAIR] = { .subtype = IFM_25G_T, .baudrate = IF_Gbps(25ULL), }, - [MLX5E_50GAUI_2_LAUI_2_50GBASE_CR2_KR2][MLX5E_CR2] = { - .subtype = IFM_50G_CR2, - .baudrate = IF_Gbps(50ULL), - }, - [MLX5E_50GAUI_2_LAUI_2_50GBASE_CR2_KR2][MLX5E_KR2] = { + + /**/ + [MLX5E_50GAUI_2_LAUI_2_50GBASE_CR2_KR2][MLX5E_CABLE_TYPE_UNKNOWN] = { .subtype = IFM_50G_KR2, .baudrate = IF_Gbps(50ULL), }, - [MLX5E_50GAUI_2_LAUI_2_50GBASE_CR2_KR2][MLX5E_KR4] = { - .subtype = IFM_50G_KR4, + [MLX5E_50GAUI_2_LAUI_2_50GBASE_CR2_KR2][MLX5E_CABLE_TYPE_PASSIVE_COPPER] = { + .subtype = IFM_50G_CR2, .baudrate = IF_Gbps(50ULL), }, - [MLX5E_50GAUI_2_LAUI_2_50GBASE_CR2_KR2][MLX5E_SR2] = { + [MLX5E_50GAUI_2_LAUI_2_50GBASE_CR2_KR2][MLX5E_CABLE_TYPE_OPTICAL_MODULE] = { .subtype = IFM_50G_SR2, .baudrate = IF_Gbps(50ULL), }, - [MLX5E_50GAUI_2_LAUI_2_50GBASE_CR2_KR2][MLX5E_LR2] = { - .subtype = IFM_50G_LR2, - .baudrate = IF_Gbps(50ULL), - }, - [MLX5E_50GAUI_1_LAUI_1_50GBASE_CR_KR][MLX5E_LR] = { - .subtype = IFM_50G_LR, - .baudrate = IF_Gbps(50ULL), - }, - [MLX5E_50GAUI_1_LAUI_1_50GBASE_CR_KR][MLX5E_SR] = { - .subtype = IFM_50G_SR, + + /**/ + [MLX5E_50GAUI_1_LAUI_1_50GBASE_CR_KR][MLX5E_CABLE_TYPE_UNKNOWN] = { + .subtype = IFM_50G_KR_PAM4, .baudrate = IF_Gbps(50ULL), }, - [MLX5E_50GAUI_1_LAUI_1_50GBASE_CR_KR][MLX5E_CP] = { + [MLX5E_50GAUI_1_LAUI_1_50GBASE_CR_KR][MLX5E_CABLE_TYPE_PASSIVE_COPPER] = { .subtype = IFM_50G_CP, .baudrate = IF_Gbps(50ULL), }, - [MLX5E_50GAUI_1_LAUI_1_50GBASE_CR_KR][MLX5E_FR] = { - .subtype = IFM_50G_FR, + [MLX5E_50GAUI_1_LAUI_1_50GBASE_CR_KR][MLX5E_CABLE_TYPE_OPTICAL_MODULE] = { + .subtype = IFM_50G_SR, .baudrate = IF_Gbps(50ULL), }, - [MLX5E_50GAUI_1_LAUI_1_50GBASE_CR_KR][MLX5E_KR_PAM4] = { - .subtype = IFM_50G_KR_PAM4, - .baudrate = IF_Gbps(50ULL), + + /**/ + [MLX5E_CAUI_4_100GBASE_CR4_KR4][MLX5E_CABLE_TYPE_UNKNOWN] = { + .subtype = IFM_100G_KR4, + .baudrate = IF_Gbps(100ULL), }, - [MLX5E_CAUI_4_100GBASE_CR4_KR4][MLX5E_CR4] = { + [MLX5E_CAUI_4_100GBASE_CR4_KR4][MLX5E_CABLE_TYPE_PASSIVE_COPPER] = { .subtype = IFM_100G_CR4, .baudrate = IF_Gbps(100ULL), }, - [MLX5E_CAUI_4_100GBASE_CR4_KR4][MLX5E_KR4] = { - .subtype = IFM_100G_KR4, + [MLX5E_CAUI_4_100GBASE_CR4_KR4][MLX5E_CABLE_TYPE_OPTICAL_MODULE] = { + .subtype = IFM_100G_SR4, .baudrate = IF_Gbps(100ULL), }, - [MLX5E_CAUI_4_100GBASE_CR4_KR4][MLX5E_LR4] = { - .subtype = IFM_100G_LR4, + + /**/ + [MLX5E_100GAUI_1_100GBASE_CR_KR][MLX5E_CABLE_TYPE_UNKNOWN] = { + .subtype = IFM_100G_KR_PAM4, .baudrate = IF_Gbps(100ULL), }, - [MLX5E_CAUI_4_100GBASE_CR4_KR4][MLX5E_SR4] = { - .subtype = IFM_100G_SR4, + [MLX5E_100GAUI_1_100GBASE_CR_KR][MLX5E_CABLE_TYPE_PASSIVE_COPPER] = { + .subtype = IFM_100G_CR_PAM4, .baudrate = IF_Gbps(100ULL), }, - [MLX5E_100GAUI_2_100GBASE_CR2_KR2][MLX5E_SR2] = { - .subtype = IFM_100G_SR2, + [MLX5E_100GAUI_1_100GBASE_CR_KR][MLX5E_CABLE_TYPE_OPTICAL_MODULE] = { + .subtype = IFM_100G_SR2, /* XXX */ .baudrate = IF_Gbps(100ULL), }, - [MLX5E_100GAUI_2_100GBASE_CR2_KR2][MLX5E_CP2] = { + + /**/ + [MLX5E_100GAUI_2_100GBASE_CR2_KR2][MLX5E_CABLE_TYPE_UNKNOWN] = { + .subtype = IFM_100G_KR4, + .baudrate = IF_Gbps(100ULL), + }, + [MLX5E_100GAUI_2_100GBASE_CR2_KR2][MLX5E_CABLE_TYPE_PASSIVE_COPPER] = { .subtype = IFM_100G_CP2, .baudrate = IF_Gbps(100ULL), }, - [MLX5E_100GAUI_2_100GBASE_CR2_KR2][MLX5E_KR2_PAM4] = { - .subtype = IFM_100G_KR2_PAM4, + [MLX5E_100GAUI_2_100GBASE_CR2_KR2][MLX5E_CABLE_TYPE_OPTICAL_MODULE] = { + .subtype = IFM_100G_SR2, .baudrate = IF_Gbps(100ULL), }, - [MLX5E_200GAUI_4_200GBASE_CR4_KR4][MLX5E_DR4] = { - .subtype = IFM_200G_DR4, + + /**/ + [MLX5E_200GAUI_2_200GBASE_CR2_KR2][MLX5E_CABLE_TYPE_UNKNOWN] = { + .subtype = IFM_200G_KR4_PAM4, /* XXX */ .baudrate = IF_Gbps(200ULL), }, - [MLX5E_200GAUI_4_200GBASE_CR4_KR4][MLX5E_LR4] = { - .subtype = IFM_200G_LR4, + [MLX5E_200GAUI_2_200GBASE_CR2_KR2][MLX5E_CABLE_TYPE_PASSIVE_COPPER] = { + .subtype = IFM_200G_CR4_PAM4, /* XXX */ .baudrate = IF_Gbps(200ULL), }, - [MLX5E_200GAUI_4_200GBASE_CR4_KR4][MLX5E_SR4] = { - .subtype = IFM_200G_SR4, + [MLX5E_200GAUI_2_200GBASE_CR2_KR2][MLX5E_CABLE_TYPE_OPTICAL_MODULE] = { + .subtype = IFM_200G_SR4, /* XXX */ .baudrate = IF_Gbps(200ULL), }, - [MLX5E_200GAUI_4_200GBASE_CR4_KR4][MLX5E_FR4] = { - .subtype = IFM_200G_FR4, + + /**/ + [MLX5E_200GAUI_4_200GBASE_CR4_KR4][MLX5E_CABLE_TYPE_UNKNOWN] = { + .subtype = IFM_200G_KR4_PAM4, .baudrate = IF_Gbps(200ULL), }, - [MLX5E_200GAUI_4_200GBASE_CR4_KR4][MLX5E_CR4_PAM4] = { + [MLX5E_200GAUI_4_200GBASE_CR4_KR4][MLX5E_CABLE_TYPE_PASSIVE_COPPER] = { .subtype = IFM_200G_CR4_PAM4, .baudrate = IF_Gbps(200ULL), }, - [MLX5E_200GAUI_4_200GBASE_CR4_KR4][MLX5E_KR4_PAM4] = { - .subtype = IFM_200G_KR4_PAM4, + [MLX5E_200GAUI_4_200GBASE_CR4_KR4][MLX5E_CABLE_TYPE_OPTICAL_MODULE] = { + .subtype = IFM_200G_SR4, .baudrate = IF_Gbps(200ULL), }, + + /**/ + [MLX5E_400GAUI_8][MLX5E_CABLE_TYPE_UNKNOWN] = { + .subtype = IFM_400G_LR8, /* XXX */ + .baudrate = IF_Gbps(400ULL), + }, + + /**/ + [MLX5E_400GAUI_4_400GBASE_CR4_KR4][MLX5E_CABLE_TYPE_UNKNOWN] = { + .subtype = IFM_400G_LR8, /* XXX */ + .baudrate = IF_Gbps(400ULL), + }, }; DEBUGNET_DEFINE(mlx5_en); @@ -420,9 +365,10 @@ mlx5e_update_carrier(struct mlx5e_priv *priv) u32 out[MLX5_ST_SZ_DW(ptys_reg)]; u32 eth_proto_oper; int error; + u8 i; + u8 cable_type; u8 port_state; u8 is_er_type; - u8 i, j; bool ext; struct media media_entry = {}; @@ -454,11 +400,23 @@ mlx5e_update_carrier(struct mlx5e_priv *priv) i = ilog2(eth_proto_oper); - for (j = 0; j != MLX5E_LINK_MODES_NUMBER; j++) { - media_entry = ext ? mlx5e_ext_mode_table[i][j] : - mlx5e_mode_table[i][j]; - if (media_entry.baudrate != 0) - break; + if (ext) { + error = mlx5_query_pddr_cable_type(mdev, 1, &cable_type); + if (error != 0) { + /* use fallback entry */ + media_entry = mlx5e_ext_mode_table[i][MLX5E_CABLE_TYPE_UNKNOWN]; + + mlx5_en_err(priv->ifp, + "query port pddr failed: %d\n", error); + } else { + media_entry = mlx5e_ext_mode_table[i][cable_type]; + + /* check if we should use fallback entry */ + if (media_entry.subtype == 0) + media_entry = mlx5e_ext_mode_table[i][MLX5E_CABLE_TYPE_UNKNOWN]; + } + } else { + media_entry = mlx5e_mode_table[i]; } if (media_entry.subtype == 0) { @@ -508,36 +466,35 @@ mlx5e_media_status(struct ifnet *dev, struct ifmediareq *ifmr) static u32 mlx5e_find_link_mode(u32 subtype, bool ext) { - u32 i; - u32 j; u32 link_mode = 0; - u32 speeds_num = 0; - struct media media_entry = {}; switch (subtype) { + case 0: + goto done; case IFM_10G_LR: subtype = IFM_10G_ER; break; case IFM_40G_ER4: subtype = IFM_40G_LR4; break; + default: + break; } - speeds_num = ext ? MLX5E_EXT_LINK_SPEEDS_NUMBER : - MLX5E_LINK_SPEEDS_NUMBER; - - for (i = 0; i != speeds_num; i++) { - for (j = 0; j < MLX5E_LINK_MODES_NUMBER ; ++j) { - media_entry = ext ? mlx5e_ext_mode_table[i][j] : - mlx5e_mode_table[i][j]; - if (media_entry.baudrate == 0) - continue; - if (media_entry.subtype == subtype) { - link_mode |= MLX5E_PROT_MASK(i); + if (ext) { + for (unsigned i = 0; i != MLX5E_EXT_LINK_SPEEDS_NUMBER; i++) { + for (unsigned j = 0; j != MLX5E_CABLE_TYPE_NUMBER; j++) { + if (mlx5e_ext_mode_table[i][j].subtype == subtype) + link_mode |= MLX5E_PROT_MASK(i); } } + } else { + for (unsigned i = 0; i != MLX5E_LINK_SPEEDS_NUMBER; i++) { + if (mlx5e_mode_table[i].subtype == subtype) + link_mode |= MLX5E_PROT_MASK(i); + } } - +done: return (link_mode); } @@ -4393,17 +4350,14 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) struct ifnet *ifp; struct mlx5e_priv *priv; u8 dev_addr[ETHER_ADDR_LEN] __aligned(4); - u8 connector_type; struct sysctl_oid_list *child; int ncv = mdev->priv.eq_table.num_comp_vectors; char unit[16]; struct pfil_head_args pa; int err; - int i,j; u32 eth_proto_cap; u32 out[MLX5_ST_SZ_DW(ptys_reg)]; - bool ext = 0; - u32 speeds_num; + bool ext; struct media media_entry = {}; if (mlx5e_check_required_hca_cap(mdev)) { @@ -4572,16 +4526,13 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) mlx5e_setup_pauseframes(priv); /* Setup supported medias */ - //TODO: If we failed to query ptys is it ok to proceed?? if (!mlx5_query_port_ptys(mdev, out, sizeof(out), MLX5_PTYS_EN, 1)) { ext = MLX5_CAP_PCAM_FEATURE(mdev, ptys_extended_ethernet); eth_proto_cap = MLX5_GET_ETH_PROTO(ptys_reg, out, ext, eth_proto_capability); - if (MLX5_CAP_PCAM_FEATURE(mdev, ptys_connector_type)) - connector_type = MLX5_GET(ptys_reg, out, - connector_type); } else { + ext = false; eth_proto_cap = 0; mlx5_en_err(ifp, "Query port media capability failed, %d\n", err); } @@ -4589,15 +4540,47 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) ifmedia_init(&priv->media, IFM_IMASK, mlx5e_media_change, mlx5e_media_status); - speeds_num = ext ? MLX5E_EXT_LINK_SPEEDS_NUMBER : MLX5E_LINK_SPEEDS_NUMBER; - for (i = 0; i != speeds_num; i++) { - for (j = 0; j < MLX5E_LINK_MODES_NUMBER ; ++j) { - media_entry = ext ? mlx5e_ext_mode_table[i][j] : - mlx5e_mode_table[i][j]; - if (media_entry.baudrate == 0) + if (ext) { + for (unsigned i = 0; i != MLX5E_EXT_LINK_SPEEDS_NUMBER; i++) { + /* check if hardware has the right capability */ + if (MLX5E_PROT_MASK(i) & ~eth_proto_cap) continue; - if (MLX5E_PROT_MASK(i) & eth_proto_cap) + for (unsigned j = 0; j != MLX5E_CABLE_TYPE_NUMBER; j++) { + media_entry = mlx5e_ext_mode_table[i][j]; + if (media_entry.subtype == 0) + continue; + /* check if this subtype was already added */ + for (unsigned k = 0; k != i; k++) { + /* check if hardware has the right capability */ + if (MLX5E_PROT_MASK(k) & ~eth_proto_cap) + continue; + for (unsigned m = 0; m != MLX5E_CABLE_TYPE_NUMBER; m++) { + if (media_entry.subtype == mlx5e_ext_mode_table[k][m].subtype) + goto skip_ext_media; + } + } mlx5e_ifm_add(priv, media_entry.subtype); + skip_ext_media:; + } + } + } else { + for (unsigned i = 0; i != MLX5E_LINK_SPEEDS_NUMBER; i++) { + media_entry = mlx5e_mode_table[i]; + if (media_entry.subtype == 0) + continue; + if (MLX5E_PROT_MASK(i) & ~eth_proto_cap) + continue; + /* check if this subtype was already added */ + for (unsigned k = 0; k != i; k++) { + if (media_entry.subtype == mlx5e_mode_table[k].subtype) + goto skip_media; + } + mlx5e_ifm_add(priv, media_entry.subtype); + + /* NOTE: 10G ER and LR shares the same entry */ + if (media_entry.subtype == IFM_10G_ER) + mlx5e_ifm_add(priv, IFM_10G_LR); + skip_media:; } } diff --git a/sys/dev/mlx5/port.h b/sys/dev/mlx5/port.h index d46ae1303496..276ee12415d7 100644 --- a/sys/dev/mlx5/port.h +++ b/sys/dev/mlx5/port.h @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2016-2018, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2016-2021, Mellanox Technologies, Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -108,7 +108,7 @@ enum mlx5e_link_speed { MLX5E_25GBASE_SR = 29, MLX5E_50GBASE_CR2 = 30, MLX5E_50GBASE_KR2 = 31, - MLX5E_LINK_SPEEDS_NUMBER, + MLX5E_LINK_SPEEDS_NUMBER = 32, }; enum mlx5e_ext_link_speed { @@ -122,78 +122,22 @@ enum mlx5e_ext_link_speed { MLX5E_50GAUI_1_LAUI_1_50GBASE_CR_KR = 8, MLX5E_CAUI_4_100GBASE_CR4_KR4 = 9, MLX5E_100GAUI_2_100GBASE_CR2_KR2 = 10, + MLX5E_100GAUI_1_100GBASE_CR_KR = 11, MLX5E_200GAUI_4_200GBASE_CR4_KR4 = 12, + MLX5E_200GAUI_2_200GBASE_CR2_KR2 = 13, MLX5E_400GAUI_8 = 15, - MLX5E_EXT_LINK_SPEEDS_NUMBER, + MLX5E_400GAUI_4_400GBASE_CR4_KR4 = 16, + MLX5E_EXT_LINK_SPEEDS_NUMBER = 32, }; -enum mlx5e_link_mode { - MLX5E_ACC, - MLX5E_AOC, - MLX5E_AUI, - MLX5E_AUI_AC, - MLX5E_AUI2, - MLX5E_AUI2_AC, - MLX5E_AUI4, - MLX5E_AUI4_AC, - MLX5E_CAUI2, - MLX5E_CAUI2_AC, - MLX5E_CAUI4, - MLX5E_CAUI4_AC, - MLX5E_CP, - MLX5E_CP2, - MLX5E_CR, - MLX5E_CR_S, - MLX5E_CR1, - MLX5E_CR2, - MLX5E_CR4, - MLX5E_CR_PAM4, - MLX5E_CR4_PAM4, - MLX5E_CX4, - MLX5E_CX, - MLX5E_CX_SGMII, - MLX5E_DR, - MLX5E_DR4, - MLX5E_ER, - MLX5E_ER4, - MLX5E_FR, - MLX5E_FR4, - MLX5E_KR, - MLX5E_KR1, - MLX5E_KR_PAM4, - MLX5E_KR_S, - MLX5E_KR2, - MLX5E_KR2_PAM4, - MLX5E_KR4, - MLX5E_KR4_PAM4, - MLX5E_KX, - MLX5E_KX4, - MLX5E_LR, - MLX5E_LR2, - MLX5E_LR4, - MLX5E_LX, - MLX5E_R, - MLX5E_SGMII, - MLX5E_SR, - MLX5E_SR2, - MLX5E_SR4, - MLX5E_SX, - MLX5E_T, - MLX5E_TX, - MLX5E_LINK_MODES_NUMBER, -}; - -enum mlx5e_connector_type { - MLX5E_PORT_UNKNOWN = 0, - MLX5E_PORT_NONE = 1, - MLX5E_PORT_TP = 2, - MLX5E_PORT_AUI = 3, - MLX5E_PORT_BNC = 4, - MLX5E_PORT_MII = 5, - MLX5E_PORT_FIBRE = 6, - MLX5E_PORT_DA = 7, - MLX5E_PORT_OTHER = 8, - MLX5E_CONNECTOR_TYPE_NUMBER, +enum mlx5e_cable_type { + MLX5E_CABLE_TYPE_UNKNOWN = 0, + MLX5E_CABLE_TYPE_ACTIVE_CABLE = 1, + MLX5E_CABLE_TYPE_OPTICAL_MODULE = 2, + MLX5E_CABLE_TYPE_PASSIVE_COPPER = 3, + MLX5E_CABLE_TYPE_CABLE_UNPLUGGED = 4, + MLX5E_CABLE_TYPE_TWISTED_PAIR = 5, + MLX5E_CABLE_TYPE_NUMBER = 8, }; enum mlx5_qpts_trust_state { @@ -282,6 +226,7 @@ int mlx5_set_dscp2prio(struct mlx5_core_dev *mdev, const u8 *dscp2prio); int mlx5_query_dscp2prio(struct mlx5_core_dev *mdev, u8 *dscp2prio); int mlx5_query_pddr_range_info(struct mlx5_core_dev *mdev, u8 local_port, u8 *is_er_type); +int mlx5_query_pddr_cable_type(struct mlx5_core_dev *mdev, u8 local_port, u8 *cable_type); u32 mlx5e_port_ptys2speed(struct mlx5_core_dev *mdev, u32 eth_proto_oper); int mlx5e_port_linkspeed(struct mlx5_core_dev *mdev, u32 *speed); From owner-dev-commits-src-all@freebsd.org Mon Jul 26 16:13: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 9E74766F438; Mon, 26 Jul 2021 16:13: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 4GYQ2D1Nbnz3pQB; Mon, 26 Jul 2021 16:13: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 153471A488; Mon, 26 Jul 2021 16:13: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 16QGD7qb005035; Mon, 26 Jul 2021 16:13:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGD7Nw005034; Mon, 26 Jul 2021 16:13:07 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:07 GMT Message-Id: <202107261613.16QGD7Nw005034@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 24cf63c77833 - stable/13 - mlx5ib: Support RAW Ethernet when RoCE is disabled in mlx5ib(4) 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 24cf63c77833ac8b23f48e7fc96c16eb5761cc84 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, 26 Jul 2021 16:13:08 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=24cf63c77833ac8b23f48e7fc96c16eb5761cc84 commit 24cf63c77833ac8b23f48e7fc96c16eb5761cc84 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:28 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:28 +0000 mlx5ib: Support RAW Ethernet when RoCE is disabled in mlx5ib(4) On some environments, such as certain SRIOV VF configurations, RoCE is not supported for mlx5 Ethernet ports. Currently, the driver will not open IB device on that port. This is problematic, since we do want user-space RAW Ethernet (RAW_PACKET QPs) functionality to remain in place. For that end, enhance the relevant driver flows such that we do create a device instance in that case. Linux commit: ca5b91d63192ceaa41a6145f8c923debb64c71fa Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 626cb01d4439b85eba9632a7738cddc64b6ad42d) --- sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c b/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c index 68dddeb8f1f1..b97d40ca8b99 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c @@ -3018,6 +3018,8 @@ static int mlx5_port_immutable(struct ib_device *ibdev, u8 port_num, struct ib_port_immutable *immutable) { struct ib_port_attr attr; + struct mlx5_ib_dev *dev = to_mdev(ibdev); + enum rdma_link_layer ll = mlx5_ib_port_link_layer(ibdev, port_num); int err; err = mlx5_ib_query_port(ibdev, port_num, &attr); @@ -3027,7 +3029,8 @@ static int mlx5_port_immutable(struct ib_device *ibdev, u8 port_num, immutable->pkey_tbl_len = attr.pkey_tbl_len; immutable->gid_tbl_len = attr.gid_tbl_len; immutable->core_cap_flags = get_core_cap_flags(ibdev); - immutable->max_mad_size = IB_MGMT_MAD_SIZE; + if ((ll == IB_LINK_LAYER_INFINIBAND) || MLX5_CAP_GEN(dev->mdev, roce)) + immutable->max_mad_size = IB_MGMT_MAD_SIZE; return 0; } @@ -3089,9 +3092,11 @@ static int mlx5_enable_roce(struct mlx5_ib_dev *dev) return err; } - err = mlx5_nic_vport_enable_roce(dev->mdev); - if (err) - goto err_unregister_netdevice_notifier; + if (MLX5_CAP_GEN(dev->mdev, roce)) { + err = mlx5_nic_vport_enable_roce(dev->mdev); + if (err) + goto err_unregister_netdevice_notifier; + } err = mlx5_roce_lag_init(dev); if (err) @@ -3100,7 +3105,8 @@ static int mlx5_enable_roce(struct mlx5_ib_dev *dev) return 0; err_disable_roce: - mlx5_nic_vport_disable_roce(dev->mdev); + if (MLX5_CAP_GEN(dev->mdev, roce)) + mlx5_nic_vport_disable_roce(dev->mdev); err_unregister_netdevice_notifier: mlx5_remove_roce_notifier(dev); @@ -3110,7 +3116,8 @@ err_unregister_netdevice_notifier: static void mlx5_disable_roce(struct mlx5_ib_dev *dev) { mlx5_roce_lag_cleanup(dev); - mlx5_nic_vport_disable_roce(dev->mdev); + if (MLX5_CAP_GEN(dev->mdev, roce)) + mlx5_nic_vport_disable_roce(dev->mdev); } static void mlx5_ib_dealloc_q_port_counter(struct mlx5_ib_dev *dev, u8 port_num) @@ -3268,9 +3275,6 @@ static void *mlx5_ib_add(struct mlx5_core_dev *mdev) port_type_cap = MLX5_CAP_GEN(mdev, port_type); ll = mlx5_port_type_cap_to_rdma_ll(port_type_cap); - if ((ll == IB_LINK_LAYER_ETHERNET) && !MLX5_CAP_GEN(mdev, roce)) - return NULL; - dev = (struct mlx5_ib_dev *)ib_alloc_device(sizeof(*dev)); if (!dev) return NULL; From owner-dev-commits-src-all@freebsd.org Mon Jul 26 16:13: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 8D81466EFBA; Mon, 26 Jul 2021 16:13: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 4GYQ2F2nP9z3pL2; Mon, 26 Jul 2021 16:13: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 427BA19E49; Mon, 26 Jul 2021 16:13: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 16QGD9HW005059; Mon, 26 Jul 2021 16:13:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGD9Qw005058; Mon, 26 Jul 2021 16:13:09 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:09 GMT Message-Id: <202107261613.16QGD9Qw005058@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 6b49b46f2692 - stable/13 - mlx5en: Add more error checks in the transmit path. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 6b49b46f2692fa7505b133276d1c878bb6fd5607 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, 26 Jul 2021 16:13:09 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=6b49b46f2692fa7505b133276d1c878bb6fd5607 commit 6b49b46f2692fa7505b133276d1c878bb6fd5607 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:29 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:28 +0000 mlx5en: Add more error checks in the transmit path. - Upon error more completion events than requested may be generated, particularly when using the completion event factor feature. - Count number of event errors in the transmit path. Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 4f4739a77b0e69dae57fd1687926d6e48a698fe4) --- sys/dev/mlx5/device.h | 5 +++++ sys/dev/mlx5/mlx5_en/en.h | 1 + sys/dev/mlx5/mlx5_en/mlx5_en_tx.c | 26 ++++++++++++++++++++++---- 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/sys/dev/mlx5/device.h b/sys/dev/mlx5/device.h index 64d4ed87d58f..e59fb6771d83 100644 --- a/sys/dev/mlx5/device.h +++ b/sys/dev/mlx5/device.h @@ -692,6 +692,11 @@ struct mlx5_cqe64 { #define MLX5_CQE_TSTMP_PTP (1ULL << 63) +static inline u8 get_cqe_opcode(struct mlx5_cqe64 *cqe) +{ + return (cqe->op_own >> 4); +} + static inline bool get_cqe_lro_timestamp_valid(struct mlx5_cqe64 *cqe) { return (cqe->lro_tcppsh_abort_dupack >> 7) & 1; diff --git a/sys/dev/mlx5/mlx5_en/en.h b/sys/dev/mlx5/mlx5_en/en.h index e4b66bea8f60..b249a82d30ef 100644 --- a/sys/dev/mlx5/mlx5_en/en.h +++ b/sys/dev/mlx5/mlx5_en/en.h @@ -627,6 +627,7 @@ struct mlx5e_rq_stats { m(+1, u64, defragged, "defragged", "Transmitted packets") \ m(+1, u64, dropped, "dropped", "Transmitted packets") \ m(+1, u64, enobuf, "enobuf", "Transmitted packets") \ + m(+1, u64, cqe_err, "cqe_err", "Transmit CQE errors") \ m(+1, u64, nop, "nop", "Transmitted packets") #define MLX5E_SQ_STATS_NUM (0 MLX5E_SQ_STATS(MLX5E_STATS_COUNT)) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c b/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c index 0e8e5f46d032..e85522bdfad7 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c @@ -1037,6 +1037,9 @@ mlx5e_poll_tx_cq(struct mlx5e_sq *sq, int budget) while (budget > 0) { struct mlx5_cqe64 *cqe; struct mbuf *mb; + bool match; + u16 sqcc_this; + u16 delta; u16 x; u16 ci; @@ -1046,11 +1049,28 @@ mlx5e_poll_tx_cq(struct mlx5e_sq *sq, int budget) mlx5_cqwq_pop(&sq->cq.wq); + /* check if the completion event indicates an error */ + if (unlikely(get_cqe_opcode(cqe) != MLX5_CQE_REQ)) + sq->stats.cqe_err++; + + /* setup local variables */ + sqcc_this = be16toh(cqe->wqe_counter); + match = false; + /* update budget according to the event factor */ budget -= sq->cev_factor; - for (x = 0; x != sq->cev_factor; x++) { + for (x = 0;; x++) { + if (unlikely(match != false)) { + break; + } else if (unlikely(x == sq->cev_factor)) { + /* WQE counter match not found */ + sq->stats.cqe_err++; + break; + } ci = sqcc & sq->wq.sz_m1; + delta = sqcc_this - sqcc; + match = (delta < sq->mbuf[ci].num_wqebbs); mb = sq->mbuf[ci].mbuf; sq->mbuf[ci].mbuf = NULL; @@ -1060,10 +1080,8 @@ mlx5e_poll_tx_cq(struct mlx5e_sq *sq, int budget) } if (mb == NULL) { - if (sq->mbuf[ci].num_bytes == 0) { - /* NOP */ + if (unlikely(sq->mbuf[ci].num_bytes == 0)) sq->stats.nop++; - } } else { bus_dmamap_sync(sq->dma_tag, sq->mbuf[ci].dma_map, BUS_DMASYNC_POSTWRITE); From owner-dev-commits-src-all@freebsd.org Mon Jul 26 16:13: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 A560366F622; Mon, 26 Jul 2021 16:13: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 4GYQ2G3Wf3z3pBp; Mon, 26 Jul 2021 16:13: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 57B3219E4A; Mon, 26 Jul 2021 16:13: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 16QGDAQ0005083; Mon, 26 Jul 2021 16:13:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDAwh005082; Mon, 26 Jul 2021 16:13:10 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:10 GMT Message-Id: <202107261613.16QGDAwh005082@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: cae3be82c3cd - stable/13 - mlx5ib: Simplify mlx5_ib_cont_pages() 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/stable/13 X-Git-Reftype: branch X-Git-Commit: cae3be82c3cd16e73b94a7320314b7d402275e35 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, 26 Jul 2021 16:13:10 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=cae3be82c3cd16e73b94a7320314b7d402275e35 commit cae3be82c3cd16e73b94a7320314b7d402275e35 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:30 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:28 +0000 mlx5ib: Simplify mlx5_ib_cont_pages() The patch simplifies mlx5_ib_cont_pages and fixes the following issues in the original implementation: First issues is related to alignment of the PFNs. After the check base + p != PFN, the alignment of the PFN wasn't checked. So the PFN sequence 0, 1, 1, 2 would result in a page_shift of 13 even though the 3rd PFN is not 8KB aligned. This wasn't actually a bug because it was supported by all the existing mlx5 compatible device, but we don't want to require this support in all future devices. Another issue is because the inner loop didn't advance PFN so the test "if (base + p != pfn)" always failed for SGE with len > (1<page_size); - - /* With ODP we must always match OS page size. */ - if (umem->odp_data) { - *count = ib_umem_page_count(umem); - *shift = PAGE_SHIFT; - *ncont = *count; - if (order) - *order = ilog2(roundup_pow_of_two(*count)); - - return; - } - addr = addr >> page_shift; + addr = addr >> PAGE_SHIFT; tmp = (unsigned long)addr; m = find_first_bit(&tmp, BITS_PER_LONG); - skip = 1 << m; - mask = skip - 1; - i = 0; + for_each_sg(umem->sg_head.sgl, sg, umem->nmap, entry) { - len = sg_dma_len(sg) >> page_shift; - pfn = sg_dma_address(sg) >> page_shift; - for (k = 0; k < len; k++) { - if (!(i & mask)) { - tmp = (unsigned long)pfn; - m = min_t(unsigned long, m, find_first_bit(&tmp, BITS_PER_LONG)); - skip = 1 << m; - mask = skip - 1; - base = pfn; - p = 0; - } else { - if (base + p != pfn) { - tmp = (unsigned long)p; - m = find_first_bit(&tmp, BITS_PER_LONG); - skip = 1 << m; - mask = skip - 1; - base = pfn; - p = 0; - } - } - p++; - i++; + len = sg_dma_len(sg) >> PAGE_SHIFT; + pfn = sg_dma_address(sg) >> PAGE_SHIFT; + if (base + p != pfn) { + /* If either the offset or the new + * base are unaligned update m + */ + tmp = (unsigned long)(pfn | p); + if (!IS_ALIGNED(tmp, 1 << m)) + m = find_first_bit(&tmp, BITS_PER_LONG); + + base = pfn; + p = 0; } + + p += len; + i += len; } if (i) { @@ -111,7 +86,7 @@ void mlx5_ib_cont_pages(struct ib_umem *umem, u64 addr, int *count, int *shift, *ncont = 0; } - *shift = page_shift + m; + *shift = PAGE_SHIFT + m; *count = i; } From owner-dev-commits-src-all@freebsd.org Mon Jul 26 16:13: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 6B81E66EF59; Mon, 26 Jul 2021 16:13: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 4GYQ2J6Rpjz3pFJ; Mon, 26 Jul 2021 16:13: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 9D78D1A22B; Mon, 26 Jul 2021 16:13: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 16QGDC0N005131; Mon, 26 Jul 2021 16:13:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDCuc005130; Mon, 26 Jul 2021 16:13:12 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:12 GMT Message-Id: <202107261613.16QGDCuc005130@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 4e16399f4507 - stable/13 - ipoib: Destroying a CQ should never fail. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 4e16399f450767642a875ef6660169e9fc6113d1 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, 26 Jul 2021 16:13:14 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=4e16399f450767642a875ef6660169e9fc6113d1 commit 4e16399f450767642a875ef6660169e9fc6113d1 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:32 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:28 +0000 ipoib: Destroying a CQ should never fail. Remove not needed error handling when destroying a CQ. The function in question will later on be updated to return "void". Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit eafc89853835147bcbd019a974ebfa9d3a8b00a7) --- sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_verbs.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_verbs.c b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_verbs.c index c459b3fb55a7..35fd7875b77d 100644 --- a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_verbs.c +++ b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_verbs.c @@ -254,11 +254,9 @@ void ipoib_transport_dev_cleanup(struct ipoib_dev_priv *priv) clear_bit(IPOIB_PKEY_ASSIGNED, &priv->flags); } - if (ib_destroy_cq(priv->send_cq)) - ipoib_warn(priv, "ib_cq_destroy (send) failed\n"); + ib_destroy_cq(priv->send_cq); - if (ib_destroy_cq(priv->recv_cq)) - ipoib_warn(priv, "ib_cq_destroy (recv) failed\n"); + ib_destroy_cq(priv->recv_cq); ipoib_cm_dev_cleanup(priv); From owner-dev-commits-src-all@freebsd.org Mon Jul 26 16:13: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 7864766F689; Mon, 26 Jul 2021 16:13: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 4GYQ2L0g00z3pLF; Mon, 26 Jul 2021 16:13: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 BFB9F1A291; Mon, 26 Jul 2021 16:13: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 16QGDDfO005161; Mon, 26 Jul 2021 16:13:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDDQc005160; Mon, 26 Jul 2021 16:13:13 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:13 GMT Message-Id: <202107261613.16QGDDQc005160@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 6c80d908d671 - stable/13 - ibcore: Remove unused and erroneous msg sequence encoding. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 6c80d908d671c327bc81551460a6aa21f0547c8e 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, 26 Jul 2021 16:13:14 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=6c80d908d671c327bc81551460a6aa21f0547c8e commit 6c80d908d671c327bc81551460a6aa21f0547c8e Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:33 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:29 +0000 ibcore: Remove unused and erroneous msg sequence encoding. In cm_form_tid(), a two bit message sequence number is OR'ed into bit 31-30 of the lower TID value. After Linux commit f06d26537559 ("IB/cm: Randomize starting comm ID"), the local_id is XOR'ed with a 32-bit random value. Hence, bit 31-30 in the lower TID now has an arbitrarily value and it makes no sense to OR in the message sequence number. Adding to that, the evolution in use of IDR routines in cm_alloc_id() has always had the possibility of returning a value with bit 30 set. In addition, said bits are never checked. Hence, remove the encoding and the corresponding enum. Linux commit: 87a37ce9e400e40daee537ff95343e3c94743c6d Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 315627b7191dd4fe30a9293609feaf7eeb62e478) --- sys/ofed/drivers/infiniband/core/cm_msgs.h | 7 ------- sys/ofed/drivers/infiniband/core/ib_cm.c | 14 ++++++-------- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/sys/ofed/drivers/infiniband/core/cm_msgs.h b/sys/ofed/drivers/infiniband/core/cm_msgs.h index 9b8ef9a93d5b..fa88aa711aa3 100644 --- a/sys/ofed/drivers/infiniband/core/cm_msgs.h +++ b/sys/ofed/drivers/infiniband/core/cm_msgs.h @@ -49,13 +49,6 @@ #define IB_CM_CLASS_VERSION 2 /* IB specification 1.2 */ -enum cm_msg_sequence { - CM_MSG_SEQUENCE_REQ, - CM_MSG_SEQUENCE_LAP, - CM_MSG_SEQUENCE_DREQ, - CM_MSG_SEQUENCE_SIDR -}; - struct cm_req_msg { struct ib_mad_hdr hdr; diff --git a/sys/ofed/drivers/infiniband/core/ib_cm.c b/sys/ofed/drivers/infiniband/core/ib_cm.c index 95b442eb0dd1..5d0229f57260 100644 --- a/sys/ofed/drivers/infiniband/core/ib_cm.c +++ b/sys/ofed/drivers/infiniband/core/ib_cm.c @@ -1130,14 +1130,12 @@ new_id: } EXPORT_SYMBOL(ib_cm_insert_listen); -static __be64 cm_form_tid(struct cm_id_private *cm_id_priv, - enum cm_msg_sequence msg_seq) +static __be64 cm_form_tid(struct cm_id_private *cm_id_priv) { u64 hi_tid, low_tid; hi_tid = ((u64) cm_id_priv->av.port->mad_agent->hi_tid) << 32; - low_tid = (u64) ((__force u32)cm_id_priv->id.local_id | - (msg_seq << 30)); + low_tid = (u64)cm_id_priv->id.local_id; return cpu_to_be64(hi_tid | low_tid); } @@ -1160,7 +1158,7 @@ static void cm_format_req(struct cm_req_msg *req_msg, struct ib_sa_path_rec *alt_path = param->alternate_path; cm_format_mad_hdr(&req_msg->hdr, CM_REQ_ATTR_ID, - cm_form_tid(cm_id_priv, CM_MSG_SEQUENCE_REQ)); + cm_form_tid(cm_id_priv)); req_msg->local_comm_id = cm_id_priv->id.local_id; req_msg->service_id = param->service_id; @@ -2171,7 +2169,7 @@ static void cm_format_dreq(struct cm_dreq_msg *dreq_msg, u8 private_data_len) { cm_format_mad_hdr(&dreq_msg->hdr, CM_DREQ_ATTR_ID, - cm_form_tid(cm_id_priv, CM_MSG_SEQUENCE_DREQ)); + cm_form_tid(cm_id_priv)); dreq_msg->local_comm_id = cm_id_priv->id.local_id; dreq_msg->remote_comm_id = cm_id_priv->id.remote_id; cm_dreq_set_remote_qpn(dreq_msg, cm_id_priv->remote_qpn); @@ -2775,7 +2773,7 @@ static void cm_format_lap(struct cm_lap_msg *lap_msg, u8 private_data_len) { cm_format_mad_hdr(&lap_msg->hdr, CM_LAP_ATTR_ID, - cm_form_tid(cm_id_priv, CM_MSG_SEQUENCE_LAP)); + cm_form_tid(cm_id_priv)); lap_msg->local_comm_id = cm_id_priv->id.local_id; lap_msg->remote_comm_id = cm_id_priv->id.remote_id; cm_lap_set_remote_qpn(lap_msg, cm_id_priv->remote_qpn); @@ -3110,7 +3108,7 @@ static void cm_format_sidr_req(struct cm_sidr_req_msg *sidr_req_msg, struct ib_cm_sidr_req_param *param) { cm_format_mad_hdr(&sidr_req_msg->hdr, CM_SIDR_REQ_ATTR_ID, - cm_form_tid(cm_id_priv, CM_MSG_SEQUENCE_SIDR)); + cm_form_tid(cm_id_priv)); sidr_req_msg->request_id = cm_id_priv->id.local_id; sidr_req_msg->pkey = param->path->pkey; sidr_req_msg->service_id = param->service_id; From owner-dev-commits-src-all@freebsd.org Mon Jul 26 16:13: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 5CABB66F2DF; Mon, 26 Jul 2021 16:13: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 4GYQ2H6DyDz3pNX; Mon, 26 Jul 2021 16:13: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 7255A1A489; Mon, 26 Jul 2021 16:13: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 16QGDB3g005107; Mon, 26 Jul 2021 16:13:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDB8E005106; Mon, 26 Jul 2021 16:13:11 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:11 GMT Message-Id: <202107261613.16QGDB8E005106@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: f1d4741b7600 - stable/13 - mlx5ib: Limit mkey page size to 2GB 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/stable/13 X-Git-Reftype: branch X-Git-Commit: f1d4741b76000caad899a7f81a7ae71c2c7b511c 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, 26 Jul 2021 16:13:12 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=f1d4741b76000caad899a7f81a7ae71c2c7b511c commit f1d4741b76000caad899a7f81a7ae71c2c7b511c Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:31 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:28 +0000 mlx5ib: Limit mkey page size to 2GB The maximum page size in the mkey context is 2GB. Until today, we didn't enforce this requirement in the code, and therefore, if we got a page size larger than 2GB, we have passed zeros in the log_page_shift instead of the actual value and the registration failed. This patch limits the driver to use compound pages of 2GB for mkeys. Linux commit: 762f899ae7875554284af92b821be8c083227092 Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 565cb4e8cc5efb4c493efe5cf2cb2ec36f69a413) --- sys/dev/mlx5/mlx5_ib/mlx5_ib.h | 6 +++++- sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c | 4 ++-- sys/dev/mlx5/mlx5_ib/mlx5_ib_mem.c | 7 ++++++- sys/dev/mlx5/mlx5_ib/mlx5_ib_mr.c | 2 +- sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c | 4 ++-- sys/dev/mlx5/mlx5_ib/mlx5_ib_srq.c | 2 +- 6 files changed, 17 insertions(+), 8 deletions(-) diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib.h b/sys/dev/mlx5/mlx5_ib/mlx5_ib.h index 0420b294de80..fcb1e584fcca 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib.h +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib.h @@ -59,6 +59,8 @@ pr_warn("%s: WARN: %s:%d:(pid %d): " format, (dev)->ib_dev.name, __func__, \ #define MLX5_IB_DEFAULT_UIDX 0xffffff #define MLX5_USER_ASSIGNED_UIDX_MASK __mlx5_mask(qpc, user_index) +#define MLX5_MKEY_PAGE_SHIFT_MASK __mlx5_mask(mkc, log_page_size) + enum { MLX5_IB_MMAP_CMD_SHIFT = 8, MLX5_IB_MMAP_CMD_MASK = 0xff, @@ -909,7 +911,9 @@ int mlx5_ib_query_port(struct ib_device *ibdev, u8 port, struct ib_port_attr *props); int mlx5_ib_init_fmr(struct mlx5_ib_dev *dev); void mlx5_ib_cleanup_fmr(struct mlx5_ib_dev *dev); -void mlx5_ib_cont_pages(struct ib_umem *umem, u64 addr, int *count, int *shift, +void mlx5_ib_cont_pages(struct ib_umem *umem, u64 addr, + unsigned long max_page_shift, + int *count, int *shift, int *ncont, int *order); void __mlx5_ib_populate_pas(struct mlx5_ib_dev *dev, struct ib_umem *umem, int page_shift, size_t offset, size_t num_pages, diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c b/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c index 15c33fdee440..3c37df82199f 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c @@ -781,7 +781,7 @@ static int create_cq_user(struct mlx5_ib_dev *dev, struct ib_udata *udata, if (err) goto err_umem; - mlx5_ib_cont_pages(cq->buf.umem, ucmd.buf_addr, &npages, &page_shift, + mlx5_ib_cont_pages(cq->buf.umem, ucmd.buf_addr, 0, &npages, &page_shift, &ncont, NULL); mlx5_ib_dbg(dev, "addr 0x%llx, size %u, npages %d, page_shift %d, ncont %d\n", (long long)ucmd.buf_addr, entries * ucmd.cqe_size, npages, page_shift, ncont); @@ -1148,7 +1148,7 @@ static int resize_user(struct mlx5_ib_dev *dev, struct mlx5_ib_cq *cq, return err; } - mlx5_ib_cont_pages(umem, ucmd.buf_addr, &npages, page_shift, + mlx5_ib_cont_pages(umem, ucmd.buf_addr, 0, &npages, page_shift, npas, NULL); cq->resize_umem = umem; diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib_mem.c b/sys/dev/mlx5/mlx5_ib/mlx5_ib_mem.c index 97d9d33603d6..b780fd2f72fd 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib_mem.c +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib_mem.c @@ -32,12 +32,15 @@ /* @umem: umem object to scan * @addr: ib virtual address requested by the user + * @max_page_shift: high limit for page_shift - 0 means no limit * @count: number of PAGE_SIZE pages covered by umem * @shift: page shift for the compound pages found in the region * @ncont: number of compund pages * @order: log2 of the number of compound pages */ -void mlx5_ib_cont_pages(struct ib_umem *umem, u64 addr, int *count, int *shift, +void mlx5_ib_cont_pages(struct ib_umem *umem, u64 addr, + unsigned long max_page_shift, + int *count, int *shift, int *ncont, int *order) { unsigned long tmp; @@ -51,6 +54,8 @@ void mlx5_ib_cont_pages(struct ib_umem *umem, u64 addr, int *count, int *shift, addr = addr >> PAGE_SHIFT; tmp = (unsigned long)addr; m = find_first_bit(&tmp, BITS_PER_LONG); + if (max_page_shift) + m = min_t(unsigned long, max_page_shift - PAGE_SHIFT, m); for_each_sg(umem->sg_head.sgl, sg, umem->nmap, entry) { len = sg_dma_len(sg) >> PAGE_SHIFT; diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib_mr.c b/sys/dev/mlx5/mlx5_ib/mlx5_ib_mr.c index 5df7aed9dc1c..585e52d35d3b 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib_mr.c +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib_mr.c @@ -637,7 +637,7 @@ static struct ib_umem *mr_umem_get(struct ib_pd *pd, u64 start, u64 length, return (void *)umem; } - mlx5_ib_cont_pages(umem, start, npages, page_shift, ncont, order); + mlx5_ib_cont_pages(umem, start, MLX5_MKEY_PAGE_SHIFT_MASK, npages, page_shift, ncont, order); if (!*npages) { mlx5_ib_warn(dev, "avoid zero region\n"); ib_umem_release(umem); diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c b/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c index 94561d32acc1..bc17ee56c7d0 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c @@ -659,7 +659,7 @@ static int mlx5_ib_umem_get(struct mlx5_ib_dev *dev, return PTR_ERR(*umem); } - mlx5_ib_cont_pages(*umem, addr, npages, page_shift, ncont, NULL); + mlx5_ib_cont_pages(*umem, addr, 0, npages, page_shift, ncont, NULL); err = mlx5_ib_get_buf_offset(addr, *page_shift, offset); if (err) { @@ -712,7 +712,7 @@ static int create_user_rq(struct mlx5_ib_dev *dev, struct ib_pd *pd, return err; } - mlx5_ib_cont_pages(rwq->umem, ucmd->buf_addr, &npages, &page_shift, + mlx5_ib_cont_pages(rwq->umem, ucmd->buf_addr, 0, &npages, &page_shift, &ncont, NULL); err = mlx5_ib_get_buf_offset(ucmd->buf_addr, page_shift, &rwq->rq_page_offset); diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib_srq.c b/sys/dev/mlx5/mlx5_ib/mlx5_ib_srq.c index 148b4c8f6d99..42e10f9a50de 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib_srq.c +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib_srq.c @@ -113,7 +113,7 @@ static int create_srq_user(struct ib_pd *pd, struct mlx5_ib_srq *srq, return err; } - mlx5_ib_cont_pages(srq->umem, ucmd.buf_addr, &npages, + mlx5_ib_cont_pages(srq->umem, ucmd.buf_addr, 0, &npages, &page_shift, &ncont, NULL); err = mlx5_ib_get_buf_offset(ucmd.buf_addr, page_shift, &offset); From owner-dev-commits-src-all@freebsd.org Mon Jul 26 16:13: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 6ECE066F464; Mon, 26 Jul 2021 16:13: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 4GYQ2M1c3Mz3pFL; Mon, 26 Jul 2021 16:13: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 E1CE51A22C; Mon, 26 Jul 2021 16:13: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 16QGDEWu005185; Mon, 26 Jul 2021 16:13:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDEG9005184; Mon, 26 Jul 2021 16:13:14 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:14 GMT Message-Id: <202107261613.16QGDEG9005184@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 349d037802fe - stable/13 - mlx5ib: Fix XRC QP support after introducing extended atomic. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 349d037802fe9fd64c2fc6233db81d121d28d080 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, 26 Jul 2021 16:13:16 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=349d037802fe9fd64c2fc6233db81d121d28d080 commit 349d037802fe9fd64c2fc6233db81d121d28d080 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:33 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:29 +0000 mlx5ib: Fix XRC QP support after introducing extended atomic. Extended atomics are supported with RC and XRC QP types, but Linux commit a60109dc9a95 added an unneeded check to to_mlx5_access_flags(). This broke XRC QPs. The following ib_atomic_bw invocation over XRC reproduces the issue: ib_atomic_bw -d mlx5_1 --connection=XRC --atomic_type=FETCH_AND_ADD It is safe to remove such checks because the QP type was already checked in ib_modify_qp_is_ok(), which was previously called from mlx5_ib_modify_qp(). Linux commit: 13f8d9c16693afb908ead3d2a758adbe6a79eccd Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit cf88b86e4954215eb447729042dab8dea722c044) --- sys/dev/mlx5/mlx5_ib/mlx5_ib.h | 2 + sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c | 85 ++++++++++++++++++++++++++++++++++----- 2 files changed, 78 insertions(+), 9 deletions(-) diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib.h b/sys/dev/mlx5/mlx5_ib/mlx5_ib.h index fcb1e584fcca..44a9aa307be7 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib.h +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib.h @@ -207,6 +207,8 @@ struct mlx5_ib_flow_db { * creates the actual hardware QP. */ #define MLX5_IB_QPT_HW_GSI IB_QPT_RESERVED2 +#define MLX5_IB_QPT_DCI IB_QPT_RESERVED3 +#define MLX5_IB_QPT_DCT IB_QPT_RESERVED4 #define MLX5_IB_WR_UMR IB_WR_RESERVED1 /* Private QP creation flags to be passed in ib_qp_init_attr.create_flags. diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c b/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c index bc17ee56c7d0..8f05b32a3261 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c @@ -1504,6 +1504,53 @@ err: return err; } +static int atomic_size_to_mode(int size_mask) +{ + /* driver does not support atomic_size > 256B + * and does not know how to translate bigger sizes + */ + int supported_size_mask = size_mask & 0x1ff; + int log_max_size; + + if (!supported_size_mask) + return -EOPNOTSUPP; + + log_max_size = __fls(supported_size_mask); + + if (log_max_size > 3) + return log_max_size; + + return MLX5_ATOMIC_MODE_8B; +} + +static int get_atomic_mode(struct mlx5_ib_dev *dev, + enum ib_qp_type qp_type) +{ + u8 atomic_operations = MLX5_CAP_ATOMIC(dev->mdev, atomic_operations); + u8 atomic = MLX5_CAP_GEN(dev->mdev, atomic); + int atomic_mode = -EOPNOTSUPP; + int atomic_size_mask; + + if (!atomic) + return -EOPNOTSUPP; + + if (qp_type == MLX5_IB_QPT_DCT) + atomic_size_mask = MLX5_CAP_ATOMIC(dev->mdev, atomic_size_dc); + else + atomic_size_mask = MLX5_CAP_ATOMIC(dev->mdev, atomic_size_qp); + + if ((atomic_operations & MLX5_ATOMIC_OPS_MASKED_CMP_SWAP) || + (atomic_operations & MLX5_ATOMIC_OPS_MASKED_FETCH_ADD)) + atomic_mode = atomic_size_to_mode(atomic_size_mask); + + if (atomic_mode <= 0 && + (atomic_operations & MLX5_ATOMIC_OPS_CMP_SWAP && + atomic_operations & MLX5_ATOMIC_OPS_FETCH_ADD)) + atomic_mode = MLX5_ATOMIC_MODE_IB_COMP; + + return atomic_mode; +} + static int create_qp_common(struct mlx5_ib_dev *dev, struct ib_pd *pd, struct ib_qp_init_attr *init_attr, struct ib_udata *udata, struct mlx5_ib_qp *qp) @@ -2119,12 +2166,14 @@ int mlx5_ib_destroy_qp(struct ib_qp *qp) return 0; } -static __be32 to_mlx5_access_flags(struct mlx5_ib_qp *qp, const struct ib_qp_attr *attr, - int attr_mask) +static int to_mlx5_access_flags(struct mlx5_ib_qp *qp, + const struct ib_qp_attr *attr, + int attr_mask, __be32 *hw_access_flags_be) { - u32 hw_access_flags = 0; u8 dest_rd_atomic; - u32 access_flags; + u32 access_flags, hw_access_flags = 0; + + struct mlx5_ib_dev *dev = to_mdev(qp->ibqp.device); if (attr_mask & IB_QP_MAX_DEST_RD_ATOMIC) dest_rd_atomic = attr->max_dest_rd_atomic; @@ -2141,12 +2190,23 @@ static __be32 to_mlx5_access_flags(struct mlx5_ib_qp *qp, const struct ib_qp_att if (access_flags & IB_ACCESS_REMOTE_READ) hw_access_flags |= MLX5_QP_BIT_RRE; - if (access_flags & IB_ACCESS_REMOTE_ATOMIC) - hw_access_flags |= (MLX5_QP_BIT_RAE | MLX5_ATOMIC_MODE_CX); + if (access_flags & IB_ACCESS_REMOTE_ATOMIC) { + int atomic_mode; + + atomic_mode = get_atomic_mode(dev, qp->ibqp.qp_type); + if (atomic_mode < 0) + return -EOPNOTSUPP; + + hw_access_flags |= MLX5_QP_BIT_RAE; + hw_access_flags |= atomic_mode << MLX5_ATOMIC_MODE_OFF; + } + if (access_flags & IB_ACCESS_REMOTE_WRITE) hw_access_flags |= MLX5_QP_BIT_RWE; - return cpu_to_be32(hw_access_flags); + *hw_access_flags_be = cpu_to_be32(hw_access_flags); + + return 0; } enum { @@ -2730,8 +2790,15 @@ static int __mlx5_ib_modify_qp(struct ib_qp *ibqp, cpu_to_be32(fls(attr->max_dest_rd_atomic - 1) << 21); } - if (attr_mask & (IB_QP_ACCESS_FLAGS | IB_QP_MAX_DEST_RD_ATOMIC)) - context->params2 |= to_mlx5_access_flags(qp, attr, attr_mask); + if (attr_mask & (IB_QP_ACCESS_FLAGS | IB_QP_MAX_DEST_RD_ATOMIC)) { + __be32 access_flags; + + err = to_mlx5_access_flags(qp, attr, attr_mask, &access_flags); + if (err) + goto out; + + context->params2 |= access_flags; + } if (attr_mask & IB_QP_MIN_RNR_TIMER) context->rnr_nextrecvpsn |= cpu_to_be32(attr->min_rnr_timer << 24); From owner-dev-commits-src-all@freebsd.org Mon Jul 26 16:13: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 13E6D66EF6A; Mon, 26 Jul 2021 16:13: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 4GYQ2b08KGz3pbX; Mon, 26 Jul 2021 16:13: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 56EE019E4B; Mon, 26 Jul 2021 16:13: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 16QGDQiD005438; Mon, 26 Jul 2021 16:13:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDQoV005437; Mon, 26 Jul 2021 16:13:26 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:26 GMT Message-Id: <202107261613.16QGDQoV005437@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: e898f1af80f6 - stable/13 - ibcore: Do not expose unsupported counters. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: e898f1af80f694e91707a1bb6725a7d197eb4359 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, 26 Jul 2021 16:13:28 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=e898f1af80f694e91707a1bb6725a7d197eb4359 commit e898f1af80f694e91707a1bb6725a7d197eb4359 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:40 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:30 +0000 ibcore: Do not expose unsupported counters. If the provider driver (such as rdma_rxe) doesn't support PMA counters, avoid exposing its directory similar to optional hw_counters directory. If core fails to read the PMA counter, return an error so that user can retry later if needed. Linux commit: 0f6ef65d1c6ec8deb5d0f11f86631ec4cfe8f22e Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit ac4174e064f447ed3b19a8b395625b7d2b3739d1) --- sys/ofed/drivers/infiniband/core/ib_sysfs.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/sys/ofed/drivers/infiniband/core/ib_sysfs.c b/sys/ofed/drivers/infiniband/core/ib_sysfs.c index 64ef4c4aefdb..c393bb64a034 100644 --- a/sys/ofed/drivers/infiniband/core/ib_sysfs.c +++ b/sys/ofed/drivers/infiniband/core/ib_sysfs.c @@ -520,7 +520,7 @@ static ssize_t show_pma_counter(struct ib_port *p, struct port_attribute *attr, ret = get_perf_mad(p->ibdev, p->port_num, tab_attr->attr_id, &data, 40 + offset / 8, sizeof(data)); if (ret < 0) - return sprintf(buf, "N/A (no PMA)\n"); + return ret; switch (width) { case 4: @@ -1043,10 +1043,12 @@ static int add_port(struct ib_device *device, int port_num, goto err_put; } - p->pma_table = get_counter_table(device, port_num); - ret = sysfs_create_group(&p->kobj, p->pma_table); - if (ret) - goto err_put_gid_attrs; + if (device->process_mad) { + p->pma_table = get_counter_table(device, port_num); + ret = sysfs_create_group(&p->kobj, p->pma_table); + if (ret) + goto err_put_gid_attrs; + } p->gid_group.name = "gids"; p->gid_group.attrs = alloc_group_attrs(show_port_gid, attr.gid_tbl_len); @@ -1158,7 +1160,8 @@ err_free_gid: p->gid_group.attrs = NULL; err_remove_pma: - sysfs_remove_group(&p->kobj, p->pma_table); + if (p->pma_table) + sysfs_remove_group(&p->kobj, p->pma_table); err_put_gid_attrs: kobject_put(&p->gid_attr_group->kobj); @@ -1270,7 +1273,9 @@ static void free_port_list_attributes(struct ib_device *device) kfree(port->hw_stats); free_hsag(&port->kobj, port->hw_stats_ag); } - sysfs_remove_group(p, port->pma_table); + + if (port->pma_table) + sysfs_remove_group(p, port->pma_table); sysfs_remove_group(p, &port->pkey_group); sysfs_remove_group(p, &port->gid_group); sysfs_remove_group(&port->gid_attr_group->kobj, From owner-dev-commits-src-all@freebsd.org Mon Jul 26 16:13: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 AEB4F66EFDF; Mon, 26 Jul 2021 16:13: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 4GYQ2Q469Rz3pSy; Mon, 26 Jul 2021 16:13: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 5BEF01A312; Mon, 26 Jul 2021 16:13: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 16QGDIVN005257; Mon, 26 Jul 2021 16:13:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDIAp005256; Mon, 26 Jul 2021 16:13:18 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:18 GMT Message-Id: <202107261613.16QGDIAp005256@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: a306f3d4485d - stable/13 - ibcore: Block processing of alternate path handling in RoCE RX CM messages. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: a306f3d4485d2846ab1052da28475683e8e5c7a4 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, 26 Jul 2021 16:13:18 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=a306f3d4485d2846ab1052da28475683e8e5c7a4 commit a306f3d4485d2846ab1052da28475683e8e5c7a4 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:35 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:29 +0000 ibcore: Block processing of alternate path handling in RoCE RX CM messages. Due to the below reasons, it is better to not support alternate path receive messages for RoCE in near term. 1. Alternate path for RoCE is not supported at rdmacm layer. 2. It is not supported in uverbs/core layer for RoCE. 3. Alternate path for IPv6 for link local address cannot resolve route determinstically without a valid incoming interface ID whose usecase make sense only with dual port mode. 4. init_av_from_path while processing LAP messages for IB and RoCE can lead to adding duplicate entry of AV into the port list, leads to list corruption. 5. rdma-core userspace a well known userspace implementation has removed support of libucm which use ucm.ko module, which is the only module that can trigger alternate path related messages. 6. ucm kernel module is requested to be removed from the IB core in the following patch, https://patchwork.kernel.org/patch/10268503/ . Linux commit: 97c45c2c28cd291e06778d9d36a0f60ee74726bc Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 0f2e5b432dcdd19955285169f1603473219ac130) --- sys/ofed/drivers/infiniband/core/ib_cm.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/sys/ofed/drivers/infiniband/core/ib_cm.c b/sys/ofed/drivers/infiniband/core/ib_cm.c index a0bfa1cd41b4..6a809b18d301 100644 --- a/sys/ofed/drivers/infiniband/core/ib_cm.c +++ b/sys/ofed/drivers/infiniband/core/ib_cm.c @@ -2957,6 +2957,13 @@ static int cm_lap_handler(struct cm_work *work) struct ib_mad_send_buf *msg = NULL; int ret; + /* Currently Alternate path messages are not supported for + * RoCE link layer. + */ + if (rdma_protocol_roce(work->port->cm_dev->ib_device, + work->port->port_num)) + return -EINVAL; + /* todo: verify LAP request and send reject APR if invalid. */ lap_msg = (struct cm_lap_msg *)work->mad_recv_wc->recv_buf.mad; cm_id_priv = cm_acquire_id(lap_msg->remote_comm_id, @@ -3102,6 +3109,13 @@ static int cm_apr_handler(struct cm_work *work) struct cm_apr_msg *apr_msg; int ret; + /* Currently Alternate path messages are not supported for + * RoCE link layer. + */ + if (rdma_protocol_roce(work->port->cm_dev->ib_device, + work->port->port_num)) + return -EINVAL; + apr_msg = (struct cm_apr_msg *)work->mad_recv_wc->recv_buf.mad; cm_id_priv = cm_acquire_id(apr_msg->remote_comm_id, apr_msg->local_comm_id); From owner-dev-commits-src-all@freebsd.org Mon Jul 26 16:13: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 3329766F473; Mon, 26 Jul 2021 16:13: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 4GYQ2S5vQRz3pNt; Mon, 26 Jul 2021 16:13: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 9B50C1A22D; Mon, 26 Jul 2021 16:13: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 16QGDKvv005311; Mon, 26 Jul 2021 16:13:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDKAA005310; Mon, 26 Jul 2021 16:13:20 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:20 GMT Message-Id: <202107261613.16QGDKAA005310@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: c254f79d9ae7 - stable/13 - ibcore: Move debug counters to be under relevant IB device 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/stable/13 X-Git-Reftype: branch X-Git-Commit: c254f79d9ae794f3e0353f2a9cb94acd288a82a2 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, 26 Jul 2021 16:13:21 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=c254f79d9ae794f3e0353f2a9cb94acd288a82a2 commit c254f79d9ae794f3e0353f2a9cb94acd288a82a2 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:37 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:29 +0000 ibcore: Move debug counters to be under relevant IB device The sysfs layout is created by CM incorrectly presented RDMA devices with InfiniBand link layer. Layout of such devices represents device tree of connections. By moving CM statistics to be under relevant port of IB device, we will fix the following issues: * Symlink name - It used device name instead of specific identifier. * Target location - It was supposed to point to PCI-ID/infiniband_cm/ instead of PCI-ID/infiniband/ * Target name - It created extra device file under already existing device folder, e.g. mlx5_0/mlx5_0 * Crash during boot with RDMA persistent naming patches. sysfs: cannot create duplicate filename '/class/infiniband_cm/mlx5_0' CPU: 29 PID: 433 Comm: modprobe Not tainted 5.0.0-rc5+ #178 Call Trace: dump_stack+0xcc/0x180 sysfs_warn_dup.cold.3+0x17/0x2d sysfs_do_create_link_sd.isra.2+0xd0/0xf0 device_add+0x7cb/0x1450 device_create_groups_vargs+0x1ae/0x220 device_create+0x93/0xc0 cm_add_one+0x38f/0xf60 [ib_cm] add_client_context+0x167/0x210 [ib_core] enable_device_and_get+0x230/0x3f0 [ib_core] ib_register_device+0x823/0xbf0 [ib_core] __mlx5_ib_add+0x45/0x150 [mlx5_ib] mlx5_ib_add+0x1b3/0x5e0 [mlx5_ib] mlx5_add_device+0x130/0x3a0 [mlx5_core] mlx5_register_interface+0x1a9/0x270 [mlx5_core] do_one_initcall+0x14f/0x5de do_init_module+0x247/0x7c0 load_module+0x4c2f/0x60d0 entry_SYSCALL_64_after_hwframe+0x49/0xbe After this change: [leonro@server ~]$ ls -al /sys/class/infiniband/ibp0s12f0/ports/1/ drwxr-xr-x 2 root root 0 Mar 11 11:17 cm_rx_duplicates drwxr-xr-x 2 root root 0 Mar 11 11:17 cm_rx_msgs drwxr-xr-x 2 root root 0 Mar 11 11:17 cm_tx_msgs drwxr-xr-x 2 root root 0 Mar 11 11:17 cm_tx_retries Linux commit: c87e65cfb97c7f325132a68288ed76ba7bdcd2c6 Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit f48e85dfe2ece188eaf44ee6cb626de1f7ae65e9) --- sys/ofed/drivers/infiniband/core/core_priv.h | 5 +++ sys/ofed/drivers/infiniband/core/ib_cm.c | 46 +++++----------------------- sys/ofed/drivers/infiniband/core/ib_sysfs.c | 45 +++++++++++++++++++++++++++ 3 files changed, 58 insertions(+), 38 deletions(-) diff --git a/sys/ofed/drivers/infiniband/core/core_priv.h b/sys/ofed/drivers/infiniband/core/core_priv.h index 62772fc2a6c5..7fa8d0cfe0bb 100644 --- a/sys/ofed/drivers/infiniband/core/core_priv.h +++ b/sys/ofed/drivers/infiniband/core/core_priv.h @@ -137,4 +137,9 @@ void ib_mad_cleanup(void); int ib_sa_init(void); void ib_sa_cleanup(void); +int ib_port_register_module_stat(struct ib_device *device, u8 port_num, + struct kobject *kobj, struct kobj_type *ktype, + const char *name); +void ib_port_unregister_module_stat(struct kobject *kobj); + #endif /* _CORE_PRIV_H */ diff --git a/sys/ofed/drivers/infiniband/core/ib_cm.c b/sys/ofed/drivers/infiniband/core/ib_cm.c index 5fb37e3245e8..1f96a733b042 100644 --- a/sys/ofed/drivers/infiniband/core/ib_cm.c +++ b/sys/ofed/drivers/infiniband/core/ib_cm.c @@ -60,6 +60,7 @@ __FBSDID("$FreeBSD$"); #include #include #include "cm_msgs.h" +#include "core_priv.h" MODULE_AUTHOR("Sean Hefty"); MODULE_DESCRIPTION("InfiniBand CM"); @@ -227,7 +228,6 @@ struct cm_port { struct cm_device { struct list_head list; struct ib_device *ib_device; - struct device *device; u8 ack_delay; int going_down; struct cm_port *port[0]; @@ -3978,18 +3978,6 @@ static struct kobj_type cm_counter_obj_type = { .default_attrs = cm_counter_default_attrs }; -static void cm_release_port_obj(struct kobject *obj) -{ - struct cm_port *cm_port; - - cm_port = container_of(obj, struct cm_port, port_obj); - kfree(cm_port); -} - -static struct kobj_type cm_port_obj_type = { - .release = cm_release_port_obj -}; - static char *cm_devnode(struct device *dev, umode_t *mode) { if (mode) @@ -4008,19 +3996,12 @@ static int cm_create_port_fs(struct cm_port *port) { int i, ret; - ret = kobject_init_and_add(&port->port_obj, &cm_port_obj_type, - &port->cm_dev->device->kobj, - "%d", port->port_num); - if (ret) { - kfree(port); - return ret; - } - for (i = 0; i < CM_COUNTER_GROUPS; i++) { - ret = kobject_init_and_add(&port->counter_group[i].obj, - &cm_counter_obj_type, - &port->port_obj, - "%s", counter_group_names[i]); + ret = ib_port_register_module_stat(port->cm_dev->ib_device, + port->port_num, + &port->counter_group[i].obj, + &cm_counter_obj_type, + counter_group_names[i]); if (ret) goto error; } @@ -4029,8 +4010,7 @@ static int cm_create_port_fs(struct cm_port *port) error: while (i--) - kobject_put(&port->counter_group[i].obj); - kobject_put(&port->port_obj); + ib_port_unregister_module_stat(&port->counter_group[i].obj); return ret; } @@ -4040,9 +4020,8 @@ static void cm_remove_port_fs(struct cm_port *port) int i; for (i = 0; i < CM_COUNTER_GROUPS; i++) - kobject_put(&port->counter_group[i].obj); + ib_port_unregister_module_stat(&port->counter_group[i].obj); - kobject_put(&port->port_obj); } static void cm_add_one(struct ib_device *ib_device) @@ -4069,13 +4048,6 @@ static void cm_add_one(struct ib_device *ib_device) cm_dev->ib_device = ib_device; cm_dev->ack_delay = ib_device->attrs.local_ca_ack_delay; cm_dev->going_down = 0; - cm_dev->device = device_create(&cm_class, &ib_device->dev, - MKDEV(0, 0), NULL, - "%s", ib_device->name); - if (IS_ERR(cm_dev->device)) { - kfree(cm_dev); - return; - } set_bit(IB_MGMT_METHOD_SEND, reg_req.method_mask); for (i = 1; i <= ib_device->phys_port_cnt; i++) { @@ -4144,7 +4116,6 @@ error1: kfree(port); } free: - device_unregister(cm_dev->device); kfree(cm_dev); } @@ -4199,7 +4170,6 @@ static void cm_remove_one(struct ib_device *ib_device, void *client_data) kfree(port); } - device_unregister(cm_dev->device); kfree(cm_dev); } diff --git a/sys/ofed/drivers/infiniband/core/ib_sysfs.c b/sys/ofed/drivers/infiniband/core/ib_sysfs.c index fb9884a7ea08..d12b5803e722 100644 --- a/sys/ofed/drivers/infiniband/core/ib_sysfs.c +++ b/sys/ofed/drivers/infiniband/core/ib_sysfs.c @@ -1336,3 +1336,48 @@ void ib_device_unregister_sysfs(struct ib_device *device) device_unregister(&device->dev); } + +/** + * ib_port_register_module_stat - add module counters under relevant port + * of IB device. + * + * @device: IB device to add counters + * @port_num: valid port number + * @kobj: pointer to the kobject to initialize + * @ktype: pointer to the ktype for this kobject. + * @name: the name of the kobject + */ +int ib_port_register_module_stat(struct ib_device *device, u8 port_num, + struct kobject *kobj, struct kobj_type *ktype, + const char *name) +{ + struct kobject *p, *t; + int ret; + + list_for_each_entry_safe(p, t, &device->port_list, entry) { + struct ib_port *port = container_of(p, struct ib_port, kobj); + + if (port->port_num != port_num) + continue; + + ret = kobject_init_and_add(kobj, ktype, &port->kobj, "%s", + name); + if (ret) { + kobject_put(kobj); + return ret; + } + } + + return 0; +} +EXPORT_SYMBOL(ib_port_register_module_stat); + +/** + * ib_port_unregister_module_stat - release module counters + * @kobj: pointer to the kobject to release + */ +void ib_port_unregister_module_stat(struct kobject *kobj) +{ + kobject_put(kobj); +} +EXPORT_SYMBOL(ib_port_unregister_module_stat); From owner-dev-commits-src-all@freebsd.org Mon Jul 26 16:13: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 CCE9266F68E; Mon, 26 Jul 2021 16:13: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 4GYQ2P2jT2z3pC7; Mon, 26 Jul 2021 16:13: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 36A3F1A292; Mon, 26 Jul 2021 16:13: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 16QGDHbE005233; Mon, 26 Jul 2021 16:13:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDHit005232; Mon, 26 Jul 2021 16:13:17 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:17 GMT Message-Id: <202107261613.16QGDHit005232@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: b3f8942c1a5d - stable/13 - ibcore: Store and restore ah_attr during LAP msg processing. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: b3f8942c1a5de03ebed6ff5065e7e84d167f9523 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, 26 Jul 2021 16:13:18 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=b3f8942c1a5de03ebed6ff5065e7e84d167f9523 commit b3f8942c1a5de03ebed6ff5065e7e84d167f9523 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:35 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:29 +0000 ibcore: Store and restore ah_attr during LAP msg processing. During CM LAP processing, ah_attr is reinitialized on receiving a LAP request. First likely during CM request processing. ah_attr might get zeroed out if LAP processing fails. Therefore, try to create a new ah_attr for the LAP message. If the initialization fails, continue with older ah_attr. If the initialization passes, consider the new ah_attr by overwriting the older one. Linux commit: 0e225dcb7681c0a8e52fb9dc68bd8ab973de4ca2 Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit bf5075e41e6a29232a1c5aef07e69b9173494187) --- sys/ofed/drivers/infiniband/core/ib_cm.c | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/sys/ofed/drivers/infiniband/core/ib_cm.c b/sys/ofed/drivers/infiniband/core/ib_cm.c index c0ee472c01a1..a0bfa1cd41b4 100644 --- a/sys/ofed/drivers/infiniband/core/ib_cm.c +++ b/sys/ofed/drivers/infiniband/core/ib_cm.c @@ -460,6 +460,32 @@ static void cm_set_private_data(struct cm_id_private *cm_id_priv, cm_id_priv->private_data_len = private_data_len; } +static int cm_init_av_for_lap(struct cm_port *port, struct ib_wc *wc, + struct ib_grh *grh, struct cm_av *av) +{ + struct ib_ah_attr new_ah_attr; + int ret; + + av->port = port; + av->pkey_index = wc->pkey_index; + + /* + * av->ah_attr might be initialized based on past wc during incoming + * connect request or while sending out connect request. So initialize + * a new ah_attr on stack. If initialization fails, old ah_attr is + * used for sending any responses. If initialization is successful, + * than new ah_attr is used by overwriting old one. + */ + ret = ib_init_ah_from_wc(port->cm_dev->ib_device, + port->port_num, wc, + grh, &new_ah_attr); + if (ret) + return ret; + + memcpy(&av->ah_attr, &new_ah_attr, sizeof(new_ah_attr)); + return 0; +} + static int cm_init_av_for_response(struct cm_port *port, struct ib_wc *wc, struct ib_grh *grh, struct cm_av *av) { @@ -3253,9 +3279,9 @@ static int cm_sidr_req_handler(struct cm_work *work) wc = work->mad_recv_wc->wc; cm_id_priv->av.dgid.global.subnet_prefix = cpu_to_be64(wc->slid); cm_id_priv->av.dgid.global.interface_id = 0; - ret = cm_init_av_for_response(work->port, work->mad_recv_wc->wc, - work->mad_recv_wc->recv_buf.grh, - &cm_id_priv->av); + ret = cm_init_av_for_lap(work->port, work->mad_recv_wc->wc, + work->mad_recv_wc->recv_buf.grh, + &cm_id_priv->av); if (ret) goto out; cm_id_priv->id.remote_id = sidr_req_msg->request_id; From owner-dev-commits-src-all@freebsd.org Mon Jul 26 16:13: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 C75C866F470; Mon, 26 Jul 2021 16:13: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 4GYQ2N4k7Hz3pLR; Mon, 26 Jul 2021 16:13: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 1669E19EB8; Mon, 26 Jul 2021 16:13: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 16QGDFhS005209; Mon, 26 Jul 2021 16:13:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDFME005208; Mon, 26 Jul 2021 16:13:15 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:15 GMT Message-Id: <202107261613.16QGDFME005208@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: bc73c139f027 - stable/13 - ibcore: Add rdma_reject_msg() helper function. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: bc73c139f027c01990a6132212117158a232bbcc 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, 26 Jul 2021 16:13:19 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=bc73c139f027c01990a6132212117158a232bbcc commit bc73c139f027c01990a6132212117158a232bbcc Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:34 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:29 +0000 ibcore: Add rdma_reject_msg() helper function. rdma_reject_msg() returns a pointer to a string message associated with the transport reject reason codes. Linux commit: 77a5db13153906a7e00740b10b2730e53385c5a8 Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit e25bcf8d775c61e9bb67246545d2ee6717f4ca89) --- sys/ofed/drivers/infiniband/core/ib_cm.c | 48 ++++++++++++++++++++++++++++++ sys/ofed/drivers/infiniband/core/ib_cma.c | 14 +++++++++ sys/ofed/drivers/infiniband/core/ib_iwcm.c | 21 +++++++++++++ sys/ofed/include/rdma/ib_cm.h | 6 ++++ sys/ofed/include/rdma/iw_cm.h | 6 ++++ sys/ofed/include/rdma/rdma_cm.h | 8 +++++ 6 files changed, 103 insertions(+) diff --git a/sys/ofed/drivers/infiniband/core/ib_cm.c b/sys/ofed/drivers/infiniband/core/ib_cm.c index 5d0229f57260..c0ee472c01a1 100644 --- a/sys/ofed/drivers/infiniband/core/ib_cm.c +++ b/sys/ofed/drivers/infiniband/core/ib_cm.c @@ -65,6 +65,54 @@ MODULE_AUTHOR("Sean Hefty"); MODULE_DESCRIPTION("InfiniBand CM"); MODULE_LICENSE("Dual BSD/GPL"); +static const char * const ibcm_rej_reason_strs[] = { + [IB_CM_REJ_NO_QP] = "no QP", + [IB_CM_REJ_NO_EEC] = "no EEC", + [IB_CM_REJ_NO_RESOURCES] = "no resources", + [IB_CM_REJ_TIMEOUT] = "timeout", + [IB_CM_REJ_UNSUPPORTED] = "unsupported", + [IB_CM_REJ_INVALID_COMM_ID] = "invalid comm ID", + [IB_CM_REJ_INVALID_COMM_INSTANCE] = "invalid comm instance", + [IB_CM_REJ_INVALID_SERVICE_ID] = "invalid service ID", + [IB_CM_REJ_INVALID_TRANSPORT_TYPE] = "invalid transport type", + [IB_CM_REJ_STALE_CONN] = "stale conn", + [IB_CM_REJ_RDC_NOT_EXIST] = "RDC not exist", + [IB_CM_REJ_INVALID_GID] = "invalid GID", + [IB_CM_REJ_INVALID_LID] = "invalid LID", + [IB_CM_REJ_INVALID_SL] = "invalid SL", + [IB_CM_REJ_INVALID_TRAFFIC_CLASS] = "invalid traffic class", + [IB_CM_REJ_INVALID_HOP_LIMIT] = "invalid hop limit", + [IB_CM_REJ_INVALID_PACKET_RATE] = "invalid packet rate", + [IB_CM_REJ_INVALID_ALT_GID] = "invalid alt GID", + [IB_CM_REJ_INVALID_ALT_LID] = "invalid alt LID", + [IB_CM_REJ_INVALID_ALT_SL] = "invalid alt SL", + [IB_CM_REJ_INVALID_ALT_TRAFFIC_CLASS] = "invalid alt traffic class", + [IB_CM_REJ_INVALID_ALT_HOP_LIMIT] = "invalid alt hop limit", + [IB_CM_REJ_INVALID_ALT_PACKET_RATE] = "invalid alt packet rate", + [IB_CM_REJ_PORT_CM_REDIRECT] = "port CM redirect", + [IB_CM_REJ_PORT_REDIRECT] = "port redirect", + [IB_CM_REJ_INVALID_MTU] = "invalid MTU", + [IB_CM_REJ_INSUFFICIENT_RESP_RESOURCES] = "insufficient resp resources", + [IB_CM_REJ_CONSUMER_DEFINED] = "consumer defined", + [IB_CM_REJ_INVALID_RNR_RETRY] = "invalid RNR retry", + [IB_CM_REJ_DUPLICATE_LOCAL_COMM_ID] = "duplicate local comm ID", + [IB_CM_REJ_INVALID_CLASS_VERSION] = "invalid class version", + [IB_CM_REJ_INVALID_FLOW_LABEL] = "invalid flow label", + [IB_CM_REJ_INVALID_ALT_FLOW_LABEL] = "invalid alt flow label", +}; + +const char *__attribute_const__ ibcm_reject_msg(int reason) +{ + size_t index = reason; + + if (index < ARRAY_SIZE(ibcm_rej_reason_strs) && + ibcm_rej_reason_strs[index]) + return ibcm_rej_reason_strs[index]; + else + return "unrecognized reason"; +} +EXPORT_SYMBOL(ibcm_reject_msg); + static void cm_add_one(struct ib_device *device); static void cm_remove_one(struct ib_device *device, void *client_data); diff --git a/sys/ofed/drivers/infiniband/core/ib_cma.c b/sys/ofed/drivers/infiniband/core/ib_cma.c index 829d668dbd05..2639c61b94a4 100644 --- a/sys/ofed/drivers/infiniband/core/ib_cma.c +++ b/sys/ofed/drivers/infiniband/core/ib_cma.c @@ -112,6 +112,20 @@ const char *__attribute_const__ rdma_event_msg(enum rdma_cm_event_type event) } EXPORT_SYMBOL(rdma_event_msg); +const char *__attribute_const__ rdma_reject_msg(struct rdma_cm_id *id, + int reason) +{ + if (rdma_ib_or_roce(id->device, id->port_num)) + return ibcm_reject_msg(reason); + + if (rdma_protocol_iwarp(id->device, id->port_num)) + return iwcm_reject_msg(reason); + + WARN_ON_ONCE(1); + return "unrecognized transport"; +} +EXPORT_SYMBOL(rdma_reject_msg); + static int cma_check_linklocal(struct rdma_dev_addr *, struct sockaddr *); static void cma_add_one(struct ib_device *device); static void cma_remove_one(struct ib_device *device, void *client_data); diff --git a/sys/ofed/drivers/infiniband/core/ib_iwcm.c b/sys/ofed/drivers/infiniband/core/ib_iwcm.c index a2abfec40668..6ac7b06569de 100644 --- a/sys/ofed/drivers/infiniband/core/ib_iwcm.c +++ b/sys/ofed/drivers/infiniband/core/ib_iwcm.c @@ -63,6 +63,27 @@ MODULE_AUTHOR("Tom Tucker"); MODULE_DESCRIPTION("iWARP CM"); MODULE_LICENSE("Dual BSD/GPL"); +static const char * const iwcm_rej_reason_strs[] = { + [ECONNRESET] = "reset by remote host", + [ECONNREFUSED] = "refused by remote application", + [ETIMEDOUT] = "setup timeout", +}; + +const char *__attribute_const__ iwcm_reject_msg(int reason) +{ + size_t index; + + /* iWARP uses negative errnos */ + index = -reason; + + if (index < ARRAY_SIZE(iwcm_rej_reason_strs) && + iwcm_rej_reason_strs[index]) + return iwcm_rej_reason_strs[index]; + else + return "unrecognized reason"; +} +EXPORT_SYMBOL(iwcm_reject_msg); + static struct workqueue_struct *iwcm_wq; struct iwcm_work { struct work_struct work; diff --git a/sys/ofed/include/rdma/ib_cm.h b/sys/ofed/include/rdma/ib_cm.h index 8806494766f6..8333b73f1f41 100644 --- a/sys/ofed/include/rdma/ib_cm.h +++ b/sys/ofed/include/rdma/ib_cm.h @@ -622,4 +622,10 @@ struct ib_cm_sidr_rep_param { int ib_send_cm_sidr_rep(struct ib_cm_id *cm_id, struct ib_cm_sidr_rep_param *param); +/** + * ibcm_reject_msg - return a pointer to a reject message string. + * @reason: Value returned in the REJECT event status field. + */ +const char *__attribute_const__ ibcm_reject_msg(int reason); + #endif /* IB_CM_H */ diff --git a/sys/ofed/include/rdma/iw_cm.h b/sys/ofed/include/rdma/iw_cm.h index ddb12dfd9256..e9e118c9dea5 100644 --- a/sys/ofed/include/rdma/iw_cm.h +++ b/sys/ofed/include/rdma/iw_cm.h @@ -257,4 +257,10 @@ int iw_cm_disconnect(struct iw_cm_id *cm_id, int abrupt); int iw_cm_init_qp_attr(struct iw_cm_id *cm_id, struct ib_qp_attr *qp_attr, int *qp_attr_mask); +/** + * iwcm_reject_msg - return a pointer to a reject message string. + * @reason: Value returned in the REJECT event status field. + */ +const char *__attribute_const__ iwcm_reject_msg(int reason); + #endif /* IW_CM_H */ diff --git a/sys/ofed/include/rdma/rdma_cm.h b/sys/ofed/include/rdma/rdma_cm.h index 09fa5c084e36..b5ed43426969 100644 --- a/sys/ofed/include/rdma/rdma_cm.h +++ b/sys/ofed/include/rdma/rdma_cm.h @@ -392,4 +392,12 @@ int rdma_set_afonly(struct rdma_cm_id *id, int afonly); */ __be64 rdma_get_service_id(struct rdma_cm_id *id, struct sockaddr *addr); +/** + * rdma_reject_msg - return a pointer to a reject message string. + * @id: Communication identifier that received the REJECT event. + * @reason: Value returned in the REJECT event status field. + */ +const char *__attribute_const__ rdma_reject_msg(struct rdma_cm_id *id, + int reason); + #endif /* RDMA_CM_H */ From owner-dev-commits-src-all@freebsd.org Mon Jul 26 16:13: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 2E73766F472; Mon, 26 Jul 2021 16:13: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 4GYQ2S2W8Bz3pCD; Mon, 26 Jul 2021 16:13: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 75CDD1A446; Mon, 26 Jul 2021 16:13: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 16QGDJts005287; Mon, 26 Jul 2021 16:13:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDJE8005286; Mon, 26 Jul 2021 16:13:19 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:19 GMT Message-Id: <202107261613.16QGDJE8005286@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 072eaae40ba7 - stable/13 - ibcore: Fix memory leak in cm_add/remove_one. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 072eaae40ba7b46101ec2cf4625e6e7e12debf0a 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, 26 Jul 2021 16:13:21 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=072eaae40ba7b46101ec2cf4625e6e7e12debf0a commit 072eaae40ba7b46101ec2cf4625e6e7e12debf0a Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:36 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:29 +0000 ibcore: Fix memory leak in cm_add/remove_one. In the process of moving the debug counters sysfs entries, the commit mentioned below eliminated the cm_infiniband sysfs directory. This sysfs directory was tied to the cm_port object allocated in procedure cm_add_one(). Before the commit below, this cm_port object was freed via a call to kobject_put(port->kobj) in procedure cm_remove_port_fs(). Since port no longer uses its kobj, kobject_put(port->kobj) was eliminated. This, however, meant that kfree was never called for the cm_port buffers. Fix this by adding explicit kfree(port) calls to functions cm_add_one() and cm_remove_one(). Note that the kfree call in the first chunk below, in the cm_add_one error flow, fixes an old, undetected memory leak. Linux commit: 94635c36f3854934a46d9e812e028d4721bbb0e6 Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 8d04583de542dcd087b401f6b830b8e6ab43d696) --- sys/ofed/drivers/infiniband/core/ib_cm.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/ofed/drivers/infiniband/core/ib_cm.c b/sys/ofed/drivers/infiniband/core/ib_cm.c index 6a809b18d301..5fb37e3245e8 100644 --- a/sys/ofed/drivers/infiniband/core/ib_cm.c +++ b/sys/ofed/drivers/infiniband/core/ib_cm.c @@ -4132,6 +4132,7 @@ error2: error1: port_modify.set_port_cap_mask = 0; port_modify.clr_port_cap_mask = IB_PORT_CM_SUP; + kfree(port); while (--i) { if (!rdma_cap_ib_cm(ib_device, i)) continue; @@ -4140,6 +4141,7 @@ error1: ib_modify_port(ib_device, port->port_num, 0, &port_modify); ib_unregister_mad_agent(port->mad_agent); cm_remove_port_fs(port); + kfree(port); } free: device_unregister(cm_dev->device); @@ -4194,6 +4196,7 @@ static void cm_remove_one(struct ib_device *ib_device, void *client_data) spin_unlock_irq(&cm.state_lock); ib_unregister_mad_agent(cur_mad_agent); cm_remove_port_fs(port); + kfree(port); } device_unregister(cm_dev->device); From owner-dev-commits-src-all@freebsd.org Mon Jul 26 16: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 E79D766F6A7; Mon, 26 Jul 2021 16:13: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 4GYQ2g36L6z3pbk; Mon, 26 Jul 2021 16:13: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 E7BE91A449; Mon, 26 Jul 2021 16:13: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 16QGDUft005538; Mon, 26 Jul 2021 16:13:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDUWA005537; Mon, 26 Jul 2021 16:13:30 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:30 GMT Message-Id: <202107261613.16QGDUWA005537@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: dd7241e04d90 - stable/13 - ibcore: Use inline function to validate port 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/stable/13 X-Git-Reftype: branch X-Git-Commit: dd7241e04d90407418089f749a68c4b1e391e65f 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, 26 Jul 2021 16:13:32 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=dd7241e04d90407418089f749a68c4b1e391e65f commit dd7241e04d90407418089f749a68c4b1e391e65f Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:43 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:30 +0000 ibcore: Use inline function to validate port Linux commit: 24dc831b77eca9361cf835be59fa69ea0e471afc Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit e2ae502d28605db0ca2af6e6261513106fe2b57d) --- sys/ofed/drivers/infiniband/core/ib_cache.c | 22 +++++++++++----------- sys/ofed/drivers/infiniband/core/ib_cma.c | 6 ++---- sys/ofed/drivers/infiniband/core/ib_device.c | 4 ++-- 3 files changed, 15 insertions(+), 17 deletions(-) diff --git a/sys/ofed/drivers/infiniband/core/ib_cache.c b/sys/ofed/drivers/infiniband/core/ib_cache.c index 3680b97ad2bf..1f44841348fe 100644 --- a/sys/ofed/drivers/infiniband/core/ib_cache.c +++ b/sys/ofed/drivers/infiniband/core/ib_cache.c @@ -518,8 +518,7 @@ int ib_find_cached_gid_by_port(struct ib_device *ib_dev, struct ib_gid_attr val = {.ndev = ndev, .gid_type = gid_type}; unsigned long flags; - if (port < rdma_start_port(ib_dev) || - port > rdma_end_port(ib_dev)) + if (!rdma_is_port_valid(ib_dev, port)) return -ENOENT; table = ports_table[port - rdma_start_port(ib_dev)]; @@ -579,9 +578,10 @@ static int ib_cache_gid_find_by_filter(struct ib_device *ib_dev, if (!ports_table) return -EOPNOTSUPP; - if (port < rdma_start_port(ib_dev) || - port > rdma_end_port(ib_dev) || - !rdma_protocol_roce(ib_dev, port)) + if (!rdma_is_port_valid(ib_dev, port)) + return -EINVAL; + + if (!rdma_protocol_roce(ib_dev, port)) return -EPROTONOSUPPORT; table = ports_table[port - rdma_start_port(ib_dev)]; @@ -885,7 +885,7 @@ int ib_get_cached_gid(struct ib_device *device, struct ib_gid_table **ports_table = device->cache.gid_cache; struct ib_gid_table *table = ports_table[port_num - rdma_start_port(device)]; - if (port_num < rdma_start_port(device) || port_num > rdma_end_port(device)) + if (!rdma_is_port_valid(device, port_num)) return -EINVAL; read_lock_irqsave(&table->rwlock, flags); @@ -934,7 +934,7 @@ int ib_get_cached_pkey(struct ib_device *device, unsigned long flags; int ret = 0; - if (port_num < rdma_start_port(device) || port_num > rdma_end_port(device)) + if (!rdma_is_port_valid(device, port_num)) return -EINVAL; read_lock_irqsave(&device->cache.lock, flags); @@ -963,7 +963,7 @@ int ib_find_cached_pkey(struct ib_device *device, int ret = -ENOENT; int partial_ix = -1; - if (port_num < rdma_start_port(device) || port_num > rdma_end_port(device)) + if (!rdma_is_port_valid(device, port_num)) return -EINVAL; read_lock_irqsave(&device->cache.lock, flags); @@ -1003,7 +1003,7 @@ int ib_find_exact_cached_pkey(struct ib_device *device, int i; int ret = -ENOENT; - if (port_num < rdma_start_port(device) || port_num > rdma_end_port(device)) + if (!rdma_is_port_valid(device, port_num)) return -EINVAL; read_lock_irqsave(&device->cache.lock, flags); @@ -1032,7 +1032,7 @@ int ib_get_cached_lmc(struct ib_device *device, unsigned long flags; int ret = 0; - if (port_num < rdma_start_port(device) || port_num > rdma_end_port(device)) + if (!rdma_is_port_valid(device, port_num)) return -EINVAL; read_lock_irqsave(&device->cache.lock, flags); @@ -1059,7 +1059,7 @@ static void ib_cache_update(struct ib_device *device, bool use_roce_gid_table = rdma_cap_roce_gid_table(device, port); - if (port < rdma_start_port(device) || port > rdma_end_port(device)) + if (!rdma_is_port_valid(device, port)) return; table = ports_table[port - rdma_start_port(device)]; diff --git a/sys/ofed/drivers/infiniband/core/ib_cma.c b/sys/ofed/drivers/infiniband/core/ib_cma.c index 2639c61b94a4..bad4b311e112 100644 --- a/sys/ofed/drivers/infiniband/core/ib_cma.c +++ b/sys/ofed/drivers/infiniband/core/ib_cma.c @@ -264,8 +264,7 @@ struct cma_device *cma_enum_devices_by_ibdev(cma_device_filter filter, int cma_get_default_gid_type(struct cma_device *cma_dev, unsigned int port) { - if (port < rdma_start_port(cma_dev->device) || - port > rdma_end_port(cma_dev->device)) + if (!rdma_is_port_valid(cma_dev->device, port)) return -EINVAL; return cma_dev->default_gid_type[port - rdma_start_port(cma_dev->device)]; @@ -277,8 +276,7 @@ int cma_set_default_gid_type(struct cma_device *cma_dev, { unsigned long supported_gids; - if (port < rdma_start_port(cma_dev->device) || - port > rdma_end_port(cma_dev->device)) + if (!rdma_is_port_valid(cma_dev->device, port)) return -EINVAL; supported_gids = roce_gid_type_mask_support(cma_dev->device, port); diff --git a/sys/ofed/drivers/infiniband/core/ib_device.c b/sys/ofed/drivers/infiniband/core/ib_device.c index 8ce1127db639..dc0e6a5866d2 100644 --- a/sys/ofed/drivers/infiniband/core/ib_device.c +++ b/sys/ofed/drivers/infiniband/core/ib_device.c @@ -664,7 +664,7 @@ int ib_query_port(struct ib_device *device, union ib_gid gid; int err; - if (port_num < rdma_start_port(device) || port_num > rdma_end_port(device)) + if (!rdma_is_port_valid(device, port_num)) return -EINVAL; memset(port_attr, 0, sizeof(*port_attr)); @@ -855,7 +855,7 @@ int ib_modify_port(struct ib_device *device, if (!device->modify_port) return -ENOSYS; - if (port_num < rdma_start_port(device) || port_num > rdma_end_port(device)) + if (!rdma_is_port_valid(device, port_num)) return -EINVAL; return device->modify_port(device, port_num, port_modify_mask, From owner-dev-commits-src-all@freebsd.org Mon Jul 26 16:13: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 7F24B66EF65; Mon, 26 Jul 2021 16:13:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYQ2T73Dvz3pQs; Mon, 26 Jul 2021 16:13: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 C36FB1A447; Mon, 26 Jul 2021 16:13: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 16QGDLHW005336; Mon, 26 Jul 2021 16:13:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDLhr005334; Mon, 26 Jul 2021 16:13:21 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:21 GMT Message-Id: <202107261613.16QGDLhr005334@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: c629928b25cc - stable/13 - ibcore: Fix memory leak in cm_req_handler error flows. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: c629928b25ccf55ebdf4cef20ae148daa1d8db67 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, 26 Jul 2021 16:13:22 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=c629928b25ccf55ebdf4cef20ae148daa1d8db67 commit c629928b25ccf55ebdf4cef20ae148daa1d8db67 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:37 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:29 +0000 ibcore: Fix memory leak in cm_req_handler error flows. In the cm_req_handler() error flows, sometimes cm_id_priv->timewait_info isn't free'd. Linux commit: 8b00914654ef56ff5473f4fe1f1168254dbb8a17 Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 2f05418748585dcbd5912f335040f652a8cc9703) --- sys/ofed/drivers/infiniband/core/ib_cm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/ofed/drivers/infiniband/core/ib_cm.c b/sys/ofed/drivers/infiniband/core/ib_cm.c index 1f96a733b042..7dea2620cb60 100644 --- a/sys/ofed/drivers/infiniband/core/ib_cm.c +++ b/sys/ofed/drivers/infiniband/core/ib_cm.c @@ -1790,8 +1790,7 @@ static int cm_req_handler(struct cm_work *work) listen_cm_id_priv = cm_match_req(work, cm_id_priv); if (!listen_cm_id_priv) { ret = -EINVAL; - kfree(cm_id_priv->timewait_info); - goto destroy; + goto free_timeinfo; } cm_id_priv->id.cm_handler = listen_cm_id_priv->id.cm_handler; @@ -1866,6 +1865,8 @@ static int cm_req_handler(struct cm_work *work) rejected: atomic_dec(&cm_id_priv->refcount); cm_deref_id(listen_cm_id_priv); +free_timeinfo: + kfree(cm_id_priv->timewait_info); destroy: ib_destroy_cm_id(cm_id); return ret; From owner-dev-commits-src-all@freebsd.org Mon Jul 26 16:13: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 8E41266F5FD; Mon, 26 Jul 2021 16:13: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 4GYQ2W5t5Qz3pYH; Mon, 26 Jul 2021 16:13: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 D7CDD1A313; Mon, 26 Jul 2021 16:13:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QGDMkG005360; Mon, 26 Jul 2021 16:13:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDM77005359; Mon, 26 Jul 2021 16:13:22 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:22 GMT Message-Id: <202107261613.16QGDM77005359@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 06307dd6e0df - stable/13 - ibcore: Issue DREQ when receiving REQ/REP for stale QP. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 06307dd6e0df91a867a6a42bb4da121f89085b54 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, 26 Jul 2021 16:13:24 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=06307dd6e0df91a867a6a42bb4da121f89085b54 commit 06307dd6e0df91a867a6a42bb4da121f89085b54 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:38 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:29 +0000 ibcore: Issue DREQ when receiving REQ/REP for stale QP. From "InfiBand Architecture Specifications Volume 1": A QP is said to have a stale connection when only one side has connection information. A stale connection may result if the remote CM had dropped the connection and sent a DREQ but the DREQ was never received by the local CM. Alternatively the remote CM may have lost all record of past connections because its node crashed and rebooted, while the local CM did not become aware of the remote node's reboot and therefore did not clean up stale connections. And: A local CM may receive a REQ/REP for a stale connection. It shall abort the connection issuing REJ to the REQ/REP. It shall then issue DREQ with "DREQ:remote QPN" set to the remote QPN from the REQ/REP. This patch solves a problem with reuse of QPN. Current codebase, that is IPoIB, relies on a REAP-mechanism to do cleanup of the structures in CM. A problem with this is the timeconstants governing this mechanism; they are up to 768 seconds and the interface may look inresponsive in that period. Issuing a DREQ (and receiving a DREP) does the necessary cleanup and the interface comes up. Linux commit: 9315bc9a133011fdb084f2626b86db3ebb64661f Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 12a913d207d287733da75784b3aa35f5e48d0cef) --- sys/ofed/drivers/infiniband/core/ib_cm.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/sys/ofed/drivers/infiniband/core/ib_cm.c b/sys/ofed/drivers/infiniband/core/ib_cm.c index 7dea2620cb60..376dcb420f5b 100644 --- a/sys/ofed/drivers/infiniband/core/ib_cm.c +++ b/sys/ofed/drivers/infiniband/core/ib_cm.c @@ -1679,6 +1679,7 @@ static struct cm_id_private * cm_match_req(struct cm_work *work, struct cm_id_private *listen_cm_id_priv, *cur_cm_id_priv; struct cm_timewait_info *timewait_info; struct cm_req_msg *req_msg; + struct ib_cm_id *cm_id; req_msg = (struct cm_req_msg *)work->mad_recv_wc->recv_buf.mad; @@ -1700,10 +1701,18 @@ static struct cm_id_private * cm_match_req(struct cm_work *work, timewait_info = cm_insert_remote_qpn(cm_id_priv->timewait_info); if (timewait_info) { cm_cleanup_timewait(cm_id_priv->timewait_info); + cur_cm_id_priv = cm_get_id(timewait_info->work.local_id, + timewait_info->work.remote_id); + spin_unlock_irq(&cm.lock); cm_issue_rej(work->port, work->mad_recv_wc, IB_CM_REJ_STALE_CONN, CM_MSG_RESPONSE_REQ, NULL, 0); + if (cur_cm_id_priv) { + cm_id = &cur_cm_id_priv->id; + ib_send_cm_dreq(cm_id, NULL, 0); + cm_deref_id(cur_cm_id_priv); + } return NULL; } @@ -2084,6 +2093,9 @@ static int cm_rep_handler(struct cm_work *work) struct cm_id_private *cm_id_priv; struct cm_rep_msg *rep_msg; int ret; + struct cm_id_private *cur_cm_id_priv; + struct ib_cm_id *cm_id; + struct cm_timewait_info *timewait_info; rep_msg = (struct cm_rep_msg *)work->mad_recv_wc->recv_buf.mad; cm_id_priv = cm_acquire_id(rep_msg->remote_comm_id, 0); @@ -2118,16 +2130,26 @@ static int cm_rep_handler(struct cm_work *work) goto error; } /* Check for a stale connection. */ - if (cm_insert_remote_qpn(cm_id_priv->timewait_info)) { + timewait_info = cm_insert_remote_qpn(cm_id_priv->timewait_info); + if (timewait_info) { rb_erase(&cm_id_priv->timewait_info->remote_id_node, &cm.remote_id_table); cm_id_priv->timewait_info->inserted_remote_id = 0; + cur_cm_id_priv = cm_get_id(timewait_info->work.local_id, + timewait_info->work.remote_id); + spin_unlock(&cm.lock); spin_unlock_irq(&cm_id_priv->lock); cm_issue_rej(work->port, work->mad_recv_wc, IB_CM_REJ_STALE_CONN, CM_MSG_RESPONSE_REP, NULL, 0); ret = -EINVAL; + if (cur_cm_id_priv) { + cm_id = &cur_cm_id_priv->id; + ib_send_cm_dreq(cm_id, NULL, 0); + cm_deref_id(cur_cm_id_priv); + } + goto error; } spin_unlock(&cm.lock); From owner-dev-commits-src-all@freebsd.org Mon Jul 26 16:13: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 E505466F4C1; Mon, 26 Jul 2021 16:13: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 4GYQ2c4zbcz3pf6; Mon, 26 Jul 2021 16:13: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 7F98E1A293; Mon, 26 Jul 2021 16:13: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 16QGDRgg005462; Mon, 26 Jul 2021 16:13:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDRli005461; Mon, 26 Jul 2021 16:13:27 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:27 GMT Message-Id: <202107261613.16QGDRli005461@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: f919e2521470 - stable/13 - mlx5core: Make sure error code is propagated on error. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f919e2521470144bbe99602b516f9834ee00f636 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, 26 Jul 2021 16:13:31 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=f919e2521470144bbe99602b516f9834ee00f636 commit f919e2521470144bbe99602b516f9834ee00f636 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:41 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:30 +0000 mlx5core: Make sure error code is propagated on error. If mlx5_init_once() fails, mlx5_load_one() should fail too, else the device instance remains attached causing problems at reboot. Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit d8cbfa101cbe3a9ece41120af93884177aff728a) --- sys/dev/mlx5/mlx5_core/mlx5_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/mlx5/mlx5_core/mlx5_main.c b/sys/dev/mlx5/mlx5_core/mlx5_main.c index 37a55f65683c..755e8844a892 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_main.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_main.c @@ -1101,7 +1101,7 @@ static int mlx5_load_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv, mlx5_start_health_poll(dev); - if (boot && mlx5_init_once(dev, priv)) { + if (boot && (err = mlx5_init_once(dev, priv))) { mlx5_core_err(dev, "sw objs init failed\n"); goto err_stop_poll; } From owner-dev-commits-src-all@freebsd.org Mon Jul 26 16:13: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 0FD8A66F702; Mon, 26 Jul 2021 16:13: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 4GYQ2d688nz3pTZ; Mon, 26 Jul 2021 16:13: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 A3C6A1A22F; Mon, 26 Jul 2021 16:13: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 16QGDS0o005486; Mon, 26 Jul 2021 16:13:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDS5i005485; Mon, 26 Jul 2021 16:13:28 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:28 GMT Message-Id: <202107261613.16QGDS5i005485@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 6ee862127d3d - stable/13 - ibcore: Protect against concurrent access to hardware stats. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 6ee862127d3d329575b72e95824c87518d65df7c 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, 26 Jul 2021 16:13:31 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=6ee862127d3d329575b72e95824c87518d65df7c commit 6ee862127d3d329575b72e95824c87518d65df7c Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:41 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:30 +0000 ibcore: Protect against concurrent access to hardware stats. Currently access to hardware stats buffer isn't protected, this can result in multiple writes and reads at the same time to the same memory location. This can lead to providing an incorrect value to the user. Add a mutex to protect against it. Linux commit: e945130b52bea65d15f9bdf54949d4cb7a88db7f Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 912e98cedee2590748a9893d3152b11694de3379) --- sys/ofed/drivers/infiniband/core/ib_sysfs.c | 34 ++++++++++++++++++++++++----- sys/ofed/include/rdma/ib_verbs.h | 4 ++++ 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/sys/ofed/drivers/infiniband/core/ib_sysfs.c b/sys/ofed/drivers/infiniband/core/ib_sysfs.c index c393bb64a034..806f4aba6c76 100644 --- a/sys/ofed/drivers/infiniband/core/ib_sysfs.c +++ b/sys/ofed/drivers/infiniband/core/ib_sysfs.c @@ -827,10 +827,15 @@ static ssize_t show_hw_stats(struct kobject *kobj, struct attribute *attr, dev = port->ibdev; stats = port->hw_stats; } + mutex_lock(&stats->lock); ret = update_hw_stats(dev, stats, hsa->port_num, hsa->index); if (ret) - return ret; - return print_hw_stat(stats, hsa->index, buf); + goto unlock; + ret = print_hw_stat(stats, hsa->index, buf); +unlock: + mutex_unlock(&stats->lock); + + return ret; } static ssize_t show_stats_lifespan(struct kobject *kobj, @@ -838,17 +843,25 @@ static ssize_t show_stats_lifespan(struct kobject *kobj, char *buf) { struct hw_stats_attribute *hsa; + struct rdma_hw_stats *stats; int msecs; hsa = container_of(attr, struct hw_stats_attribute, attr); if (!hsa->port_num) { struct ib_device *dev = container_of((struct device *)kobj, struct ib_device, dev); - msecs = jiffies_to_msecs(dev->hw_stats->lifespan); + + stats = dev->hw_stats; } else { struct ib_port *p = container_of(kobj, struct ib_port, kobj); - msecs = jiffies_to_msecs(p->hw_stats->lifespan); + + stats = p->hw_stats; } + + mutex_lock(&stats->lock); + msecs = jiffies_to_msecs(stats->lifespan); + mutex_unlock(&stats->lock); + return sprintf(buf, "%d\n", msecs); } @@ -857,6 +870,7 @@ static ssize_t set_stats_lifespan(struct kobject *kobj, const char *buf, size_t count) { struct hw_stats_attribute *hsa; + struct rdma_hw_stats *stats; int msecs; int jiffies; int ret; @@ -871,11 +885,18 @@ static ssize_t set_stats_lifespan(struct kobject *kobj, if (!hsa->port_num) { struct ib_device *dev = container_of((struct device *)kobj, struct ib_device, dev); - dev->hw_stats->lifespan = jiffies; + + stats = dev->hw_stats; } else { struct ib_port *p = container_of(kobj, struct ib_port, kobj); - p->hw_stats->lifespan = jiffies; + + stats = p->hw_stats; } + + mutex_lock(&stats->lock); + stats->lifespan = jiffies; + mutex_unlock(&stats->lock); + return count; } @@ -968,6 +989,7 @@ static void setup_hw_stats(struct ib_device *device, struct ib_port *port, sysfs_attr_init(hsag->attrs[i]); } + mutex_init(&stats->lock); /* treat an error here as non-fatal */ hsag->attrs[i] = alloc_hsa_lifespan("lifespan", port_num); if (hsag->attrs[i]) diff --git a/sys/ofed/include/rdma/ib_verbs.h b/sys/ofed/include/rdma/ib_verbs.h index 2399a3a53120..b18aa2855166 100644 --- a/sys/ofed/include/rdma/ib_verbs.h +++ b/sys/ofed/include/rdma/ib_verbs.h @@ -438,6 +438,9 @@ enum ib_port_speed { /** * struct rdma_hw_stats + * @lock - Mutex to protect parallel write access to lifespan and values + * of counters, which are 64bits and not guaranteeed to be written + * atomicaly on 32bits systems. * @timestamp - Used by the core code to track when the last update was * @lifespan - Used by the core code to determine how old the counters * should be before being updated again. Stored in jiffies, defaults @@ -453,6 +456,7 @@ enum ib_port_speed { * filled in by the drivers get_stats routine */ struct rdma_hw_stats { + struct mutex lock; /* Protect lifespan and values[] */ unsigned long timestamp; unsigned long lifespan; const char * const *names; From owner-dev-commits-src-all@freebsd.org Mon Jul 26 16:13: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 AAD9266EF7E; Mon, 26 Jul 2021 16:13: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 4GYQ2f5P06z3pfD; Mon, 26 Jul 2021 16:13: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 C868B1A48B; Mon, 26 Jul 2021 16:13: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 16QGDTDd005510; Mon, 26 Jul 2021 16:13:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDTZw005509; Mon, 26 Jul 2021 16:13:29 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:29 GMT Message-Id: <202107261613.16QGDTZw005509@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: a4b27295c71e - stable/13 - ibcore: Validate port number in query_pkey verb. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: a4b27295c71ea05b54f07b574018469a14ea68dd 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, 26 Jul 2021 16:13:31 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=a4b27295c71ea05b54f07b574018469a14ea68dd commit a4b27295c71ea05b54f07b574018469a14ea68dd Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:42 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:30 +0000 ibcore: Validate port number in query_pkey verb. Before calling the driver's function let's make sure port is valid. Linux commit: 9af3f5cf9d64a056eca53bc643f6288ad28bbbb5 Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 31525faed8b43c579767cf3ac211f41764b2a46c) --- sys/ofed/drivers/infiniband/core/ib_device.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/ofed/drivers/infiniband/core/ib_device.c b/sys/ofed/drivers/infiniband/core/ib_device.c index 8c6a2d9f1a8a..8ce1127db639 100644 --- a/sys/ofed/drivers/infiniband/core/ib_device.c +++ b/sys/ofed/drivers/infiniband/core/ib_device.c @@ -809,6 +809,9 @@ void ib_cache_gid_del_all_by_netdev(struct ifnet *ndev) int ib_query_pkey(struct ib_device *device, u8 port_num, u16 index, u16 *pkey) { + if (!rdma_is_port_valid(device, port_num)) + return -EINVAL; + return device->query_pkey(device, port_num, index, pkey); } EXPORT_SYMBOL(ib_query_pkey); From owner-dev-commits-src-all@freebsd.org Mon Jul 26 16:13: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 595D066F80C; Mon, 26 Jul 2021 16:13: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 4GYQ2j2Q37z3plL; Mon, 26 Jul 2021 16: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 184D919E4C; Mon, 26 Jul 2021 16: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 16QGDVGo005564; Mon, 26 Jul 2021 16:13:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDVHW005563; Mon, 26 Jul 2021 16:13:31 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:31 GMT Message-Id: <202107261613.16QGDVHW005563@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 7da85a0db999 - stable/13 - ibcore: Fail early if unsupported QP is provided. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 7da85a0db999e7ff0b00bb41460b274fd9341a83 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, 26 Jul 2021 16:13:34 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=7da85a0db999e7ff0b00bb41460b274fd9341a83 commit 7da85a0db999e7ff0b00bb41460b274fd9341a83 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:44 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:30 +0000 ibcore: Fail early if unsupported QP is provided. When requested QP type is not supported for a {device, port}, return the error right away before validating all parameters during mad agent registration time. Linux commit: 798bba01b44b0ddf8cd6e542635b37cc9a9b739c Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 507389a35a41f5f15592d2156d34039e3ee1c3e5) --- sys/ofed/drivers/infiniband/core/ib_mad.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/ofed/drivers/infiniband/core/ib_mad.c b/sys/ofed/drivers/infiniband/core/ib_mad.c index 7bb6323a4c53..2f14535688aa 100644 --- a/sys/ofed/drivers/infiniband/core/ib_mad.c +++ b/sys/ofed/drivers/infiniband/core/ib_mad.c @@ -219,6 +219,10 @@ struct ib_mad_agent *ib_register_mad_agent(struct ib_device *device, unsigned long flags; u8 mgmt_class, vclass; + if ((qp_type == IB_QPT_SMI && !rdma_cap_ib_smi(device, port_num)) || + (qp_type == IB_QPT_GSI && !rdma_cap_ib_cm(device, port_num))) + return ERR_PTR(-EPROTONOSUPPORT); + /* Validate parameters */ qpn = get_spl_qp_index(qp_type); if (qpn == -1) { From owner-dev-commits-src-all@freebsd.org Mon Jul 26 16:13: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 31AE366F4BF; Mon, 26 Jul 2021 16:13: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 4GYQ2Y6ZfRz3pR6; Mon, 26 Jul 2021 16:13: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 3287D1A448; Mon, 26 Jul 2021 16:13: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 16QGDPWS005412; Mon, 26 Jul 2021 16:13:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDPpc005411; Mon, 26 Jul 2021 16:13:25 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:25 GMT Message-Id: <202107261613.16QGDPpc005411@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 2cbd28890432 - stable/13 - ibcore: Introduce ib_port_phys_state enum. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 2cbd28890432f2b47a7cb3a99724294e83e619c9 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, 26 Jul 2021 16:13:26 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=2cbd28890432f2b47a7cb3a99724294e83e619c9 commit 2cbd28890432f2b47a7cb3a99724294e83e619c9 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:39 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:30 +0000 ibcore: Introduce ib_port_phys_state enum. In order to improve readability, add ib_port_phys_state enum to replace the use of magic numbers. Linux commit: 72a7720fca37fec0daf295923f17ac5d88a613e1 Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 4238b4a7a2cfe44e95f3553ff4a3f6f813fb81f5) --- sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c | 3 ++- sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c | 4 ++-- sys/ofed/drivers/infiniband/core/ib_sysfs.c | 30 +++++++++++++++++++---------- sys/ofed/include/rdma/ib_verbs.h | 10 ++++++++++ 4 files changed, 34 insertions(+), 13 deletions(-) diff --git a/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c b/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c index 62956607974b..ef23f182bc28 100644 --- a/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c +++ b/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c @@ -684,7 +684,8 @@ out: static u8 state_to_phys_state(enum ib_port_state state) { - return state == IB_PORT_ACTIVE ? 5 : 3; + return state == IB_PORT_ACTIVE ? + IB_PORT_PHYS_STATE_LINK_UP : IB_PORT_PHYS_STATE_DISABLED; } static int eth_link_query_port(struct ib_device *ibdev, u8 port, diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c b/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c index b97d40ca8b99..d614ec048f60 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c @@ -319,7 +319,7 @@ static int mlx5_query_port_roce(struct ib_device *device, u8 port_num, props->max_msg_sz = 1 << MLX5_CAP_GEN(dev->mdev, log_max_msg); props->pkey_tbl_len = 1; props->state = IB_PORT_DOWN; - props->phys_state = 3; + props->phys_state = IB_PORT_PHYS_STATE_DISABLED; mlx5_query_nic_vport_qkey_viol_cntr(dev->mdev, &qkey_viol_cntr); props->qkey_viol_cntr = qkey_viol_cntr; @@ -331,7 +331,7 @@ static int mlx5_query_port_roce(struct ib_device *device, u8 port_num, if (ndev->if_drv_flags & IFF_DRV_RUNNING && ndev->if_link_state == LINK_STATE_UP) { props->state = IB_PORT_ACTIVE; - props->phys_state = 5; + props->phys_state = IB_PORT_PHYS_STATE_LINK_UP; } ndev_ib_mtu = iboe_get_mtu(ndev->if_mtu); diff --git a/sys/ofed/drivers/infiniband/core/ib_sysfs.c b/sys/ofed/drivers/infiniband/core/ib_sysfs.c index 55e7b5395b8e..64ef4c4aefdb 100644 --- a/sys/ofed/drivers/infiniband/core/ib_sysfs.c +++ b/sys/ofed/drivers/infiniband/core/ib_sysfs.c @@ -293,6 +293,24 @@ static ssize_t rate_show(struct ib_port *p, struct port_attribute *unused, ib_width_enum_to_int(attr.active_width), speed); } +static const char *phys_state_to_str(enum ib_port_phys_state phys_state) +{ + static const char * phys_state_str[] = { + "", + "Sleep", + "Polling", + "Disabled", + "PortConfigurationTraining", + "LinkUp", + "LinkErrorRecovery", + "Phy Test", + }; + + if (phys_state < ARRAY_SIZE(phys_state_str)) + return phys_state_str[phys_state]; + return ""; +} + static ssize_t phys_state_show(struct ib_port *p, struct port_attribute *unused, char *buf) { @@ -304,16 +322,8 @@ static ssize_t phys_state_show(struct ib_port *p, struct port_attribute *unused, if (ret) return ret; - switch (attr.phys_state) { - case 1: return sprintf(buf, "1: Sleep\n"); - case 2: return sprintf(buf, "2: Polling\n"); - case 3: return sprintf(buf, "3: Disabled\n"); - case 4: return sprintf(buf, "4: PortConfigurationTraining\n"); - case 5: return sprintf(buf, "5: LinkUp\n"); - case 6: return sprintf(buf, "6: LinkErrorRecovery\n"); - case 7: return sprintf(buf, "7: Phy Test\n"); - default: return sprintf(buf, "%d: \n", attr.phys_state); - } + return sprintf(buf, "%d: %s\n", attr.phys_state, + phys_state_to_str(attr.phys_state)); } static ssize_t link_layer_show(struct ib_port *p, struct port_attribute *unused, diff --git a/sys/ofed/include/rdma/ib_verbs.h b/sys/ofed/include/rdma/ib_verbs.h index 2450682ffa66..2399a3a53120 100644 --- a/sys/ofed/include/rdma/ib_verbs.h +++ b/sys/ofed/include/rdma/ib_verbs.h @@ -396,6 +396,16 @@ enum ib_port_cap_flags { IB_PORT_IP_BASED_GIDS = 1 << 26, }; +enum ib_port_phys_state { + IB_PORT_PHYS_STATE_SLEEP = 1, + IB_PORT_PHYS_STATE_POLLING = 2, + IB_PORT_PHYS_STATE_DISABLED = 3, + IB_PORT_PHYS_STATE_PORT_CONFIGURATION_TRAINING = 4, + IB_PORT_PHYS_STATE_LINK_UP = 5, + IB_PORT_PHYS_STATE_LINK_ERROR_RECOVERY = 6, + IB_PORT_PHYS_STATE_PHY_TEST = 7, +}; + enum ib_port_width { IB_WIDTH_1X = 1, IB_WIDTH_2X = 16, From owner-dev-commits-src-all@freebsd.org Mon Jul 26 16:13: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 5302466F694; Mon, 26 Jul 2021 16:13: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 4GYQ2X45gcz3pYK; Mon, 26 Jul 2021 16:13: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 0FBD61A48A; Mon, 26 Jul 2021 16:13: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 16QGDNXI005384; Mon, 26 Jul 2021 16:13:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDNjU005383; Mon, 26 Jul 2021 16:13:23 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:23 GMT Message-Id: <202107261613.16QGDNjU005383@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 645d0710fc48 - stable/13 - ibcore: Fix unable to change lifespan entry for hw_counters. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 645d0710fc48e255ea74ede8bd2c08aab2207965 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, 26 Jul 2021 16:13:25 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=645d0710fc48e255ea74ede8bd2c08aab2207965 commit 645d0710fc48e255ea74ede8bd2c08aab2207965 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:39 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:30 +0000 ibcore: Fix unable to change lifespan entry for hw_counters. This patch fixes the case where 'lifespan' entry of the hw_counters is not writable. Currently write callback is not exposed for for the hw_counters sysfs operation. Due to this, modifying lifespan value results into permission denied error in below example. echo 10 > /sys/class/infiniband/mlx5_0/ports/1/hw_counters/lifespan -bash: /sys/class/infiniband/mlx5_0/ports/1/hw_counters/lifespan: Permission denied This patch adds the hook to modify any attribute which implements store() operation. Linux commit: 79c4d80b43b8e43684894574a508a871f0c196bf Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit d7d833e20ba33f5b9f3052a534af7ecdd602f152) --- sys/ofed/drivers/infiniband/core/ib_sysfs.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/sys/ofed/drivers/infiniband/core/ib_sysfs.c b/sys/ofed/drivers/infiniband/core/ib_sysfs.c index d12b5803e722..55e7b5395b8e 100644 --- a/sys/ofed/drivers/infiniband/core/ib_sysfs.c +++ b/sys/ofed/drivers/infiniband/core/ib_sysfs.c @@ -114,8 +114,22 @@ static ssize_t port_attr_show(struct kobject *kobj, return port_attr->show(p, port_attr, buf); } +static ssize_t port_attr_store(struct kobject *kobj, + struct attribute *attr, + const char *buf, size_t count) +{ + struct port_attribute *port_attr = + container_of(attr, struct port_attribute, attr); + struct ib_port *p = container_of(kobj, struct ib_port, kobj); + + if (!port_attr->store) + return -EIO; + return port_attr->store(p, port_attr, buf, count); +} + static const struct sysfs_ops port_sysfs_ops = { - .show = port_attr_show + .show = port_attr_show, + .store = port_attr_store }; static ssize_t gid_attr_show(struct kobject *kobj, From owner-dev-commits-src-all@freebsd.org Mon Jul 26 16:13: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 7883066F65D; Mon, 26 Jul 2021 16:13: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 4GYQ2p4ylCz3pV4; Mon, 26 Jul 2021 16:13: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 BD4001A230; Mon, 26 Jul 2021 16:13: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 16QGDb2u005690; Mon, 26 Jul 2021 16:13:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDbXu005689; Mon, 26 Jul 2021 16:13:37 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:37 GMT Message-Id: <202107261613.16QGDbXu005689@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: a0d74ac3f370 - stable/13 - ibcore: Fix a use-after-free in ucma_resolve_ip(). 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/stable/13 X-Git-Reftype: branch X-Git-Commit: a0d74ac3f3700fa384076d46f6a3fe4f82d1e0ad 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, 26 Jul 2021 16:13:39 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=a0d74ac3f3700fa384076d46f6a3fe4f82d1e0ad commit a0d74ac3f3700fa384076d46f6a3fe4f82d1e0ad Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:47 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:31 +0000 ibcore: Fix a use-after-free in ucma_resolve_ip(). There is a race condition between ucma_close() and ucma_resolve_ip(): CPU0 CPU1 ucma_resolve_ip(): ucma_close(): ctx = ucma_get_ctx(file, cmd.id); list_for_each_entry_safe(ctx, tmp, &file->ctx_list, list) { mutex_lock(&mut); idr_remove(&ctx_idr, ctx->id); mutex_unlock(&mut); ... mutex_lock(&mut); if (!ctx->closing) { mutex_unlock(&mut); rdma_destroy_id(ctx->cm_id); ... ucma_free_ctx(ctx); } ret = rdma_resolve_addr(); ucma_put_ctx(ctx); Before idr_remove(), ucma_get_ctx() could still find the ctx and after rdma_destroy_id(), rdma_resolve_addr() may still access id_priv pointer. Also, ucma_put_ctx() may use ctx after ucma_free_ctx() too. ucma_close() should call ucma_put_ctx() too which tests the refcnt and waits for the last one releasing it. The similar pattern is already used by ucma_destroy_id(). Linux commit: 5fe23f262e0548ca7f19fb79f89059a60d087d22 Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit c6ccb08686f3b92c12778b4b903431b2ce71ec2c) --- sys/ofed/drivers/infiniband/core/ib_ucma.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/ofed/drivers/infiniband/core/ib_ucma.c b/sys/ofed/drivers/infiniband/core/ib_ucma.c index 19e4a17836ee..878e4d348234 100644 --- a/sys/ofed/drivers/infiniband/core/ib_ucma.c +++ b/sys/ofed/drivers/infiniband/core/ib_ucma.c @@ -1705,6 +1705,8 @@ static int ucma_close(struct inode *inode, struct file *filp) mutex_lock(&mut); if (!ctx->closing) { mutex_unlock(&mut); + ucma_put_ctx(ctx); + wait_for_completion(&ctx->comp); /* rdma_destroy_id ensures that no event handlers are * inflight for that id before releasing it. */ From owner-dev-commits-src-all@freebsd.org Mon Jul 26 16: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 DE4F966F898; Mon, 26 Jul 2021 16: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 4GYQ2r66q8z3pVD; Mon, 26 Jul 2021 16:13: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 E3D5D19EB9; Mon, 26 Jul 2021 16:13: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 16QGDcFR005714; Mon, 26 Jul 2021 16:13:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDcBC005713; Mon, 26 Jul 2021 16:13:38 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:38 GMT Message-Id: <202107261613.16QGDcBC005713@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: d857bf203733 - stable/13 - ibcore: Don't allocate method table, if already present. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: d857bf20373325346168e71ff39cb84d692b51e7 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, 26 Jul 2021 16:13:42 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=d857bf20373325346168e71ff39cb84d692b51e7 commit d857bf20373325346168e71ff39cb84d692b51e7 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:48 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:31 +0000 ibcore: Don't allocate method table, if already present. This commit aligns the code in question with upstream Linux. Linux commit: 2468b82d69e3a53d024f28d79ba0fdb8bf43dfbf Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 721b795b721b349db5e6198f8681d5992447c775) --- sys/ofed/drivers/infiniband/core/ib_mad.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sys/ofed/drivers/infiniband/core/ib_mad.c b/sys/ofed/drivers/infiniband/core/ib_mad.c index 5b1297fe4cd3..82a3f19d92bb 100644 --- a/sys/ofed/drivers/infiniband/core/ib_mad.c +++ b/sys/ofed/drivers/infiniband/core/ib_mad.c @@ -1554,8 +1554,11 @@ static int add_oui_reg_req(struct ib_mad_reg_req *mad_reg_req, method = &(*vendor_table)->vendor_class[ vclass]->method_table[i]; /* Allocate method table for this OUI */ - if ((ret = allocate_method_table(method))) - goto error3; + if (!*method) { + ret = allocate_method_table(method); + if (ret) + goto error3; + } memcpy((*vendor_table)->vendor_class[vclass]->oui[i], mad_reg_req->oui, 3); goto check_in_use; From owner-dev-commits-src-all@freebsd.org Mon Jul 26 16: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 5C35666F6E2; Mon, 26 Jul 2021 16: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 4GYQ2s56cXz3plq; Mon, 26 Jul 2021 16: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 128F21A48C; Mon, 26 Jul 2021 16:13: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 16QGDd4B005738; Mon, 26 Jul 2021 16:13:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDdk5005737; Mon, 26 Jul 2021 16:13:39 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:39 GMT Message-Id: <202107261613.16QGDdk5005737@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: d76e6346afbc - stable/13 - ibcore: Add new IB rates. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: d76e6346afbc24260c2bbf4ad847ac03188facd4 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, 26 Jul 2021 16:13:42 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=d76e6346afbc24260c2bbf4ad847ac03188facd4 commit d76e6346afbc24260c2bbf4ad847ac03188facd4 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:49 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:31 +0000 ibcore: Add new IB rates. Add the new rates that were added to Infiniband spec as part of HDR and 2x support. Linux commit: a5a5d1993696419e7d5357fc3128e53d219d382e Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 3d2fb36a9ce72053e8865852caad30044dbd1059) --- sys/ofed/drivers/infiniband/core/ib_verbs.c | 48 +++++++++++++++++------------ 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/sys/ofed/drivers/infiniband/core/ib_verbs.c b/sys/ofed/drivers/infiniband/core/ib_verbs.c index b397a65fdd9d..9e06d079af31 100644 --- a/sys/ofed/drivers/infiniband/core/ib_verbs.c +++ b/sys/ofed/drivers/infiniband/core/ib_verbs.c @@ -127,20 +127,28 @@ EXPORT_SYMBOL(ib_wc_status_msg); __attribute_const__ int ib_rate_to_mult(enum ib_rate rate) { switch (rate) { - case IB_RATE_2_5_GBPS: return 1; - case IB_RATE_5_GBPS: return 2; - case IB_RATE_10_GBPS: return 4; - case IB_RATE_20_GBPS: return 8; - case IB_RATE_30_GBPS: return 12; - case IB_RATE_40_GBPS: return 16; - case IB_RATE_60_GBPS: return 24; - case IB_RATE_80_GBPS: return 32; - case IB_RATE_120_GBPS: return 48; + case IB_RATE_2_5_GBPS: return 1; + case IB_RATE_5_GBPS: return 2; + case IB_RATE_10_GBPS: return 4; + case IB_RATE_20_GBPS: return 8; + case IB_RATE_30_GBPS: return 12; + case IB_RATE_40_GBPS: return 16; + case IB_RATE_60_GBPS: return 24; + case IB_RATE_80_GBPS: return 32; + case IB_RATE_120_GBPS: return 48; + case IB_RATE_14_GBPS: return 6; + case IB_RATE_56_GBPS: return 22; + case IB_RATE_112_GBPS: return 45; + case IB_RATE_168_GBPS: return 67; + case IB_RATE_25_GBPS: return 10; + case IB_RATE_100_GBPS: return 40; + case IB_RATE_200_GBPS: return 80; + case IB_RATE_300_GBPS: return 120; case IB_RATE_28_GBPS: return 11; case IB_RATE_50_GBPS: return 20; case IB_RATE_400_GBPS: return 160; case IB_RATE_600_GBPS: return 240; - default: return -1; + default: return -1; } } EXPORT_SYMBOL(ib_rate_to_mult); @@ -148,15 +156,15 @@ EXPORT_SYMBOL(ib_rate_to_mult); __attribute_const__ enum ib_rate mult_to_ib_rate(int mult) { switch (mult) { - case 1: return IB_RATE_2_5_GBPS; - case 2: return IB_RATE_5_GBPS; - case 4: return IB_RATE_10_GBPS; - case 8: return IB_RATE_20_GBPS; - case 12: return IB_RATE_30_GBPS; - case 16: return IB_RATE_40_GBPS; - case 24: return IB_RATE_60_GBPS; - case 32: return IB_RATE_80_GBPS; - case 48: return IB_RATE_120_GBPS; + case 1: return IB_RATE_2_5_GBPS; + case 2: return IB_RATE_5_GBPS; + case 4: return IB_RATE_10_GBPS; + case 8: return IB_RATE_20_GBPS; + case 12: return IB_RATE_30_GBPS; + case 16: return IB_RATE_40_GBPS; + case 24: return IB_RATE_60_GBPS; + case 32: return IB_RATE_80_GBPS; + case 48: return IB_RATE_120_GBPS; case 6: return IB_RATE_14_GBPS; case 22: return IB_RATE_56_GBPS; case 45: return IB_RATE_112_GBPS; @@ -169,7 +177,7 @@ __attribute_const__ enum ib_rate mult_to_ib_rate(int mult) case 20: return IB_RATE_50_GBPS; case 160: return IB_RATE_400_GBPS; case 240: return IB_RATE_600_GBPS; - default: return IB_RATE_PORT_CURRENT; + default: return IB_RATE_PORT_CURRENT; } } EXPORT_SYMBOL(mult_to_ib_rate); From owner-dev-commits-src-all@freebsd.org Mon Jul 26 16:13: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 393E966F6F2; Mon, 26 Jul 2021 16:13: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 4GYQ2w6d4Hz3pfq; Mon, 26 Jul 2021 16:13: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 507D31A44C; Mon, 26 Jul 2021 16: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 16QGDgSJ005786; Mon, 26 Jul 2021 16:13:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDgOl005785; Mon, 26 Jul 2021 16:13:42 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:42 GMT Message-Id: <202107261613.16QGDgOl005785@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 1c1c0acb3113 - stable/13 - ibcore: Simplify ib_modify_qp_is_ok(). 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 1c1c0acb31137bc4e229215243eba8c8654b96cf 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, 26 Jul 2021 16:13:46 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=1c1c0acb31137bc4e229215243eba8c8654b96cf commit 1c1c0acb31137bc4e229215243eba8c8654b96cf Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:50 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:31 +0000 ibcore: Simplify ib_modify_qp_is_ok(). All callers to ib_modify_qp_is_ok() provides enum ib_qp_state makes the checks of out-of-scope redundant. Let's remove them together with updating function signature to return boolean result. While at it remove unused "ll" parameter from ib_modify_qp_is_ok(). Linux commit: 19b1f54099b6ee334acbfbcfbdffd1d1f057216d d31131bba5a1630304c55ea775c48cc84912ab59 Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit d92a9e5604d7302c349f77c0fde160256aec56ed) --- sys/dev/mlx4/mlx4_ib/mlx4_ib_qp.c | 10 +--------- sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c | 8 +------- sys/dev/mthca/mthca_qp.c | 3 +-- sys/dev/qlnx/qlnxr/qlnxr_verbs.c | 18 ------------------ sys/ofed/drivers/infiniband/core/ib_verbs.c | 19 +++++++------------ sys/ofed/include/rdma/ib_verbs.h | 6 ++---- 6 files changed, 12 insertions(+), 52 deletions(-) diff --git a/sys/dev/mlx4/mlx4_ib/mlx4_ib_qp.c b/sys/dev/mlx4/mlx4_ib/mlx4_ib_qp.c index 3b81797b46b0..280ab6359dd1 100644 --- a/sys/dev/mlx4/mlx4_ib/mlx4_ib_qp.c +++ b/sys/dev/mlx4/mlx4_ib/mlx4_ib_qp.c @@ -2163,21 +2163,13 @@ static int _mlx4_ib_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, struct mlx4_ib_qp *qp = to_mqp(ibqp); enum ib_qp_state cur_state, new_state; int err = -EINVAL; - int ll; mutex_lock(&qp->mutex); cur_state = attr_mask & IB_QP_CUR_STATE ? attr->cur_qp_state : qp->state; new_state = attr_mask & IB_QP_STATE ? attr->qp_state : cur_state; - if (cur_state == new_state && cur_state == IB_QPS_RESET) { - ll = IB_LINK_LAYER_UNSPECIFIED; - } else { - int port = attr_mask & IB_QP_PORT ? attr->port_num : qp->port; - ll = rdma_port_get_link_layer(&dev->ib_dev, port); - } - if (!ib_modify_qp_is_ok(cur_state, new_state, ibqp->qp_type, - attr_mask, ll)) { + attr_mask)) { pr_debug("qpn 0x%x: invalid attribute mask specified " "for transition %d to %d. qp_type %d," " attr_mask 0x%x\n", diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c b/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c index 8f05b32a3261..54a091548faf 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c @@ -2922,7 +2922,6 @@ int mlx5_ib_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, enum ib_qp_state cur_state, new_state; int err = -EINVAL; int port; - enum rdma_link_layer ll = IB_LINK_LAYER_UNSPECIFIED; if (ibqp->rwq_ind_tbl) return -ENOSYS; @@ -2938,13 +2937,8 @@ int mlx5_ib_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, cur_state = attr_mask & IB_QP_CUR_STATE ? attr->cur_qp_state : qp->state; new_state = attr_mask & IB_QP_STATE ? attr->qp_state : cur_state; - if (!(cur_state == new_state && cur_state == IB_QPS_RESET)) { - port = attr_mask & IB_QP_PORT ? attr->port_num : qp->port; - ll = dev->ib_dev.get_link_layer(&dev->ib_dev, port); - } - if (qp_type != MLX5_IB_QPT_REG_UMR && - !ib_modify_qp_is_ok(cur_state, new_state, qp_type, attr_mask, ll)) { + !ib_modify_qp_is_ok(cur_state, new_state, qp_type, attr_mask)) { mlx5_ib_dbg(dev, "invalid QP state transition from %d to %d, qp_type %d, attr_mask 0x%x\n", cur_state, new_state, ibqp->qp_type, attr_mask); goto out; diff --git a/sys/dev/mthca/mthca_qp.c b/sys/dev/mthca/mthca_qp.c index 33d61d29bbe5..b726450ba4aa 100644 --- a/sys/dev/mthca/mthca_qp.c +++ b/sys/dev/mthca/mthca_qp.c @@ -860,8 +860,7 @@ int mthca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask, new_state = attr_mask & IB_QP_STATE ? attr->qp_state : cur_state; - if (!ib_modify_qp_is_ok(cur_state, new_state, ibqp->qp_type, attr_mask, - IB_LINK_LAYER_UNSPECIFIED)) { + if (!ib_modify_qp_is_ok(cur_state, new_state, ibqp->qp_type, attr_mask)) { mthca_dbg(dev, "Bad QP transition (transport %d) " "%d->%d with attr 0x%08x\n", qp->transport, cur_state, new_state, diff --git a/sys/dev/qlnx/qlnxr/qlnxr_verbs.c b/sys/dev/qlnx/qlnxr/qlnxr_verbs.c index 9c0087c1b76d..861db52044f8 100644 --- a/sys/dev/qlnx/qlnxr/qlnxr_verbs.c +++ b/sys/dev/qlnx/qlnxr/qlnxr_verbs.c @@ -3543,22 +3543,6 @@ qlnxr_modify_qp(struct ib_qp *ibqp, new_qp_state = old_qp_state; if (QLNX_IS_ROCE(dev)) { -#if __FreeBSD_version >= 1100000 - if (!ib_modify_qp_is_ok(old_qp_state, - new_qp_state, - ibqp->qp_type, - attr_mask, - IB_LINK_LAYER_ETHERNET)) { - QL_DPRINT12(ha, - "invalid attribute mask=0x%x" - " specified for qpn=0x%x of type=0x%x \n" - " old_qp_state=0x%x, new_qp_state=0x%x\n", - attr_mask, qp->qp_id, ibqp->qp_type, - old_qp_state, new_qp_state); - rc = -EINVAL; - goto err; - } -#else if (!ib_modify_qp_is_ok(old_qp_state, new_qp_state, ibqp->qp_type, @@ -3572,8 +3556,6 @@ qlnxr_modify_qp(struct ib_qp *ibqp, rc = -EINVAL; goto err; } - -#endif /* #if __FreeBSD_version >= 1100000 */ } /* translate the masks... */ if (attr_mask & IB_QP_STATE) { diff --git a/sys/ofed/drivers/infiniband/core/ib_verbs.c b/sys/ofed/drivers/infiniband/core/ib_verbs.c index aabb416ddc21..32be78f118b5 100644 --- a/sys/ofed/drivers/infiniband/core/ib_verbs.c +++ b/sys/ofed/drivers/infiniband/core/ib_verbs.c @@ -1169,34 +1169,29 @@ static const struct { } }; -int ib_modify_qp_is_ok(enum ib_qp_state cur_state, enum ib_qp_state next_state, - enum ib_qp_type type, enum ib_qp_attr_mask mask, - enum rdma_link_layer ll) +bool ib_modify_qp_is_ok(enum ib_qp_state cur_state, enum ib_qp_state next_state, + enum ib_qp_type type, enum ib_qp_attr_mask mask) { enum ib_qp_attr_mask req_param, opt_param; - if (cur_state < 0 || cur_state > IB_QPS_ERR || - next_state < 0 || next_state > IB_QPS_ERR) - return 0; - if (mask & IB_QP_CUR_STATE && cur_state != IB_QPS_RTR && cur_state != IB_QPS_RTS && cur_state != IB_QPS_SQD && cur_state != IB_QPS_SQE) - return 0; + return false; if (!qp_state_table[cur_state][next_state].valid) - return 0; + return false; req_param = qp_state_table[cur_state][next_state].req_param[type]; opt_param = qp_state_table[cur_state][next_state].opt_param[type]; if ((mask & req_param) != req_param) - return 0; + return false; if (mask & ~(req_param | opt_param | IB_QP_STATE)) - return 0; + return false; - return 1; + return true; } EXPORT_SYMBOL(ib_modify_qp_is_ok); diff --git a/sys/ofed/include/rdma/ib_verbs.h b/sys/ofed/include/rdma/ib_verbs.h index cdbf2f5ce260..353181a8d790 100644 --- a/sys/ofed/include/rdma/ib_verbs.h +++ b/sys/ofed/include/rdma/ib_verbs.h @@ -2220,7 +2220,6 @@ static inline bool ib_is_udata_cleared(struct ib_udata *udata, * @next_state: Next QP state * @type: QP type * @mask: Mask of supplied QP attributes - * @ll : link layer of port * * This function is a helper function that a low-level driver's * modify_qp method can use to validate the consumer's input. It @@ -2228,9 +2227,8 @@ static inline bool ib_is_udata_cleared(struct ib_udata *udata, * transition from cur_state to next_state is allowed by the IB spec, * and that the attribute mask supplied is allowed for the transition. */ -int ib_modify_qp_is_ok(enum ib_qp_state cur_state, enum ib_qp_state next_state, - enum ib_qp_type type, enum ib_qp_attr_mask mask, - enum rdma_link_layer ll); +bool ib_modify_qp_is_ok(enum ib_qp_state cur_state, enum ib_qp_state next_state, + enum ib_qp_type type, enum ib_qp_attr_mask mask); int ib_register_event_handler (struct ib_event_handler *event_handler); int ib_unregister_event_handler(struct ib_event_handler *event_handler); From owner-dev-commits-src-all@freebsd.org Mon Jul 26 16:13: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 77A6466F6F6; Mon, 26 Jul 2021 16:13: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 4GYQ2z1JN8z3pcb; Mon, 26 Jul 2021 16:13: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 C2CF71A44D; Mon, 26 Jul 2021 16:13: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 16QGDk0V005889; Mon, 26 Jul 2021 16:13:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDkSO005888; Mon, 26 Jul 2021 16:13:46 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:46 GMT Message-Id: <202107261613.16QGDkSO005888@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: b383248ef6dc - stable/13 - mlx5: Set default timestamp format for mlx5en(4) and mlx5ib. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: b383248ef6dce0019856de495840b810dad18cb1 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, 26 Jul 2021 16:13:49 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=b383248ef6dce0019856de495840b810dad18cb1 commit b383248ef6dce0019856de495840b810dad18cb1 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:53 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:32 +0000 mlx5: Set default timestamp format for mlx5en(4) and mlx5ib. Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 4fb0a74e081772fc6fc2a43222ee072fd089bf5f) --- sys/dev/mlx5/driver.h | 21 +++++++++++++++++++++ sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 7 ++++++- sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c | 14 +++++++++++++- 3 files changed, 40 insertions(+), 2 deletions(-) diff --git a/sys/dev/mlx5/driver.h b/sys/dev/mlx5/driver.h index 5d4f58d7e1fd..c36380505fbb 100644 --- a/sys/dev/mlx5/driver.h +++ b/sys/dev/mlx5/driver.h @@ -1202,4 +1202,25 @@ static inline bool mlx5_rl_is_supported(struct mlx5_core_dev *dev) void mlx5_disable_interrupts(struct mlx5_core_dev *); void mlx5_poll_interrupts(struct mlx5_core_dev *); +static inline int mlx5_get_qp_default_ts(struct mlx5_core_dev *dev) +{ + return !MLX5_CAP_ROCE(dev, qp_ts_format) ? + MLX5_QPC_TIMESTAMP_FORMAT_FREE_RUNNING : + MLX5_QPC_TIMESTAMP_FORMAT_DEFAULT; +} + +static inline int mlx5_get_rq_default_ts(struct mlx5_core_dev *dev) +{ + return !MLX5_CAP_GEN(dev, rq_ts_format) ? + MLX5_RQC_TIMESTAMP_FORMAT_FREE_RUNNING : + MLX5_RQC_TIMESTAMP_FORMAT_DEFAULT; +} + +static inline int mlx5_get_sq_default_ts(struct mlx5_core_dev *dev) +{ + return !MLX5_CAP_GEN(dev, sq_ts_format) ? + MLX5_SQC_TIMESTAMP_FORMAT_FREE_RUNNING : + MLX5_SQC_TIMESTAMP_FORMAT_DEFAULT; +} + #endif /* MLX5_DRIVER_H */ diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index 57da44e68de3..fc9ffc01a0df 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -1350,12 +1350,12 @@ mlx5e_enable_rq(struct mlx5e_rq *rq, struct mlx5e_rq_param *param) struct mlx5e_channel *c = rq->channel; struct mlx5e_priv *priv = c->priv; struct mlx5_core_dev *mdev = priv->mdev; - void *in; void *rqc; void *wq; int inlen; int err; + u8 ts_format; inlen = MLX5_ST_SZ_BYTES(create_rq_in) + sizeof(u64) * rq->wq_ctrl.buf.npages; @@ -1363,6 +1363,7 @@ mlx5e_enable_rq(struct mlx5e_rq *rq, struct mlx5e_rq_param *param) if (in == NULL) return (-ENOMEM); + ts_format = mlx5_get_rq_default_ts(mdev); rqc = MLX5_ADDR_OF(create_rq_in, in, ctx); wq = MLX5_ADDR_OF(rqc, rqc, wq); @@ -1370,6 +1371,7 @@ mlx5e_enable_rq(struct mlx5e_rq *rq, struct mlx5e_rq_param *param) MLX5_SET(rqc, rqc, cqn, c->rq.cq.mcq.cqn); MLX5_SET(rqc, rqc, state, MLX5_RQC_STATE_RST); + MLX5_SET(rqc, rqc, ts_format, ts_format); MLX5_SET(rqc, rqc, flush_in_error_en, 1); if (priv->counter_set_id >= 0) MLX5_SET(rqc, rqc, counter_set_id, priv->counter_set_id); @@ -1673,6 +1675,7 @@ mlx5e_enable_sq(struct mlx5e_sq *sq, struct mlx5e_sq_param *param, void *wq; int inlen; int err; + u8 ts_format; inlen = MLX5_ST_SZ_BYTES(create_sq_in) + sizeof(u64) * sq->wq_ctrl.buf.npages; @@ -1680,6 +1683,7 @@ mlx5e_enable_sq(struct mlx5e_sq *sq, struct mlx5e_sq_param *param, if (in == NULL) return (-ENOMEM); + ts_format = mlx5_get_sq_default_ts(sq->priv->mdev); sqc = MLX5_ADDR_OF(create_sq_in, in, ctx); wq = MLX5_ADDR_OF(sqc, sqc, wq); @@ -1688,6 +1692,7 @@ mlx5e_enable_sq(struct mlx5e_sq *sq, struct mlx5e_sq_param *param, MLX5_SET(sqc, sqc, tis_num_0, tis_num); MLX5_SET(sqc, sqc, cqn, sq->cq.mcq.cqn); MLX5_SET(sqc, sqc, state, MLX5_SQC_STATE_RST); + MLX5_SET(sqc, sqc, ts_format, ts_format); MLX5_SET(sqc, sqc, tis_lst_sz, 1); MLX5_SET(sqc, sqc, flush_in_error_en, 1); MLX5_SET(sqc, sqc, allow_swp, 1); diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c b/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c index 54a091548faf..ec47b3e07b87 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2020, Mellanox Technologies. All rights reserved. + * Copyright (c) 2013-2021, Mellanox Technologies. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -962,6 +962,7 @@ static int create_kernel_qp(struct mlx5_ib_dev *dev, qpc = MLX5_ADDR_OF(create_qp_in, *in, qpc); MLX5_SET(qpc, qpc, uar_page, uar_index); + MLX5_SET(qpc, qpc, ts_format, mlx5_get_qp_default_ts(dev->mdev)); MLX5_SET(qpc, qpc, log_page_size, qp->buf.page_shift - MLX5_ADAPTER_PAGE_SHIFT); /* Set "fast registration enabled" for all kernel QPs */ @@ -1075,6 +1076,9 @@ static int create_raw_packet_qp_sq(struct mlx5_ib_dev *dev, int npages; int ncont = 0; u32 offset = 0; + u8 ts_format; + + ts_format = mlx5_get_sq_default_ts(dev->mdev); err = mlx5_ib_umem_get(dev, pd, ubuffer->buf_addr, ubuffer->buf_size, &sq->ubuffer.umem, &npages, &page_shift, @@ -1092,6 +1096,7 @@ static int create_raw_packet_qp_sq(struct mlx5_ib_dev *dev, sqc = MLX5_ADDR_OF(create_sq_in, in, ctx); MLX5_SET(sqc, sqc, flush_in_error_en, 1); MLX5_SET(sqc, sqc, state, MLX5_SQC_STATE_RST); + MLX5_SET(sqc, sqc, ts_format, ts_format); MLX5_SET(sqc, sqc, user_index, MLX5_GET(qpc, qpc, user_index)); MLX5_SET(sqc, sqc, cqn, MLX5_GET(qpc, qpc, cqn_snd)); MLX5_SET(sqc, sqc, tis_lst_sz, 1); @@ -1161,6 +1166,9 @@ static int create_raw_packet_qp_rq(struct mlx5_ib_dev *dev, int inlen; int err; u32 rq_pas_size = get_rq_pas_size(qpc); + u8 ts_format; + + ts_format = mlx5_get_rq_default_ts(dev->mdev); inlen = MLX5_ST_SZ_BYTES(create_rq_in) + rq_pas_size; in = mlx5_vzalloc(inlen); @@ -1171,6 +1179,7 @@ static int create_raw_packet_qp_rq(struct mlx5_ib_dev *dev, MLX5_SET(rqc, rqc, vlan_strip_disable, 1); MLX5_SET(rqc, rqc, mem_rq_type, MLX5_RQC_RQ_TYPE_MEMORY_RQ_INLINE); MLX5_SET(rqc, rqc, state, MLX5_RQC_STATE_RST); + MLX5_SET(rqc, rqc, ts_format, ts_format); MLX5_SET(rqc, rqc, flush_in_error_en, 1); MLX5_SET(rqc, rqc, user_index, MLX5_GET(qpc, qpc, user_index)); MLX5_SET(rqc, rqc, cqn, MLX5_GET(qpc, qpc, cqn_rcv)); @@ -1754,6 +1763,9 @@ static int create_qp_common(struct mlx5_ib_dev *dev, struct ib_pd *pd, MLX5_SET(qpc, qpc, log_rq_size, ilog2(qp->rq.wqe_cnt)); } + if (init_attr->qp_type != IB_QPT_RAW_PACKET) + MLX5_SET(qpc, qpc, ts_format, mlx5_get_qp_default_ts(dev->mdev)); + MLX5_SET(qpc, qpc, rq_type, get_rx_type(qp, init_attr)); if (qp->sq.wqe_cnt) From owner-dev-commits-src-all@freebsd.org Mon Jul 26 16:13: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 E93E166F7B3; Mon, 26 Jul 2021 16:13: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 4GYQ3230LRz3pmM; Mon, 26 Jul 2021 16:13: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 03EA31A232; Mon, 26 Jul 2021 16:13: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 16QGDljo005913; Mon, 26 Jul 2021 16:13:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDlGx005912; Mon, 26 Jul 2021 16:13:47 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:47 GMT Message-Id: <202107261613.16QGDlGx005912@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 47f7e8e4231f - stable/13 - ibcore: Declare ib_post_send() and ib_post_recv() arguments const 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 47f7e8e4231f9e2dcf8e6d180ec1a7353c8f94a6 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, 26 Jul 2021 16:13:51 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=47f7e8e4231f9e2dcf8e6d180ec1a7353c8f94a6 commit 47f7e8e4231f9e2dcf8e6d180ec1a7353c8f94a6 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:54 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:32 +0000 ibcore: Declare ib_post_send() and ib_post_recv() arguments const Since neither ib_post_send() nor ib_post_recv() modify the data structure their second argument points at, declare that argument const. This change makes it necessary to declare the 'bad_wr' argument const too and also to modify all ULPs that call ib_post_send(), ib_post_recv() or ib_post_srq_recv(). This patch does not change any functionality but makes it possible for the compiler to verify whether the ib_post_(send|recv|srq_recv) really do not modify the posted work request. Linux commit: f696bf6d64b195b83ca1bdb7cd33c999c9dcf514 7bb1fafc2f163ad03a2007295bb2f57cfdbfb630 d34ac5cd3a73aacd11009c4fc3ba15d7ea62c411 Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit c3987b8ea793c11f61fecb14ef93195a23e3522c) --- sys/contrib/rdma/krping/krping.c | 42 +++++++------- sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h | 8 +-- sys/dev/cxgbe/iw_cxgbe/qp.c | 28 +++++----- sys/dev/iser/iser_memory.c | 3 +- sys/dev/iser/iser_verbs.c | 13 +++-- sys/dev/mlx4/mlx4_ib/mlx4_ib.h | 12 ++-- sys/dev/mlx4/mlx4_ib/mlx4_ib_mad.c | 7 ++- sys/dev/mlx4/mlx4_ib/mlx4_ib_qp.c | 28 +++++----- sys/dev/mlx4/mlx4_ib/mlx4_ib_srq.c | 4 +- sys/dev/mlx5/mlx5_ib/mlx5_ib.h | 22 ++++---- sys/dev/mlx5/mlx5_ib/mlx5_ib_gsi.c | 8 +-- sys/dev/mlx5/mlx5_ib/mlx5_ib_mr.c | 43 +++++++-------- sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c | 70 +++++++++++++----------- sys/dev/mlx5/mlx5_ib/mlx5_ib_srq.c | 4 +- sys/dev/mthca/mthca_dev.h | 24 ++++---- sys/dev/mthca/mthca_qp.c | 24 ++++---- sys/dev/mthca/mthca_srq.c | 8 +-- sys/dev/qlnx/qlnxr/qlnxr_cm.c | 12 ++-- sys/dev/qlnx/qlnxr/qlnxr_cm.h | 8 +-- sys/dev/qlnx/qlnxr/qlnxr_verbs.c | 34 ++++++------ sys/dev/qlnx/qlnxr/qlnxr_verbs.h | 12 ++-- sys/ofed/drivers/infiniband/core/ib_mad.c | 9 +-- sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c | 9 ++- sys/ofed/drivers/infiniband/core/ib_verbs.c | 5 +- sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c | 4 +- sys/ofed/include/rdma/ib_verbs.h | 34 ++++++------ 26 files changed, 245 insertions(+), 230 deletions(-) diff --git a/sys/contrib/rdma/krping/krping.c b/sys/contrib/rdma/krping/krping.c index 75c874411bb3..da0a03af42cd 100644 --- a/sys/contrib/rdma/krping/krping.c +++ b/sys/contrib/rdma/krping/krping.c @@ -358,7 +358,7 @@ static void krping_cq_event_handler(struct ib_cq *cq, void *ctx) { struct krping_cb *cb = ctx; struct ib_wc wc; - struct ib_recv_wr *bad_wr; + const struct ib_recv_wr *bad_wr; int ret; BUG_ON(cb->cq != cq); @@ -705,7 +705,7 @@ err1: static u32 krping_rdma_rkey(struct krping_cb *cb, u64 buf, int post_inv) { u32 rkey; - struct ib_send_wr *bad_wr; + const struct ib_send_wr *bad_wr; int ret; struct scatterlist sg = {0}; @@ -772,7 +772,8 @@ static void krping_format_send(struct krping_cb *cb, u64 buf) static void krping_test_server(struct krping_cb *cb) { - struct ib_send_wr *bad_wr, inv; + const struct ib_send_wr *bad_wr; + struct ib_send_wr inv; int ret; while (1) { @@ -913,7 +914,7 @@ static void rlat_test(struct krping_cb *cb) struct timeval start_tv, stop_tv; int ret; struct ib_wc wc; - struct ib_send_wr *bad_wr; + const struct ib_send_wr *bad_wr; int ne; scnt = 0; @@ -1054,7 +1055,7 @@ static void wlat_test(struct krping_cb *cb) } if (scnt < iters) { - struct ib_send_wr *bad_wr; + const struct ib_send_wr *bad_wr; *buf = (char)scnt+1; if (scnt < cycle_iters) @@ -1187,7 +1188,7 @@ static void bw_test(struct krping_cb *cb) while (scnt < iters || ccnt < iters) { while (scnt < iters && scnt - ccnt < cb->txdepth) { - struct ib_send_wr *bad_wr; + const struct ib_send_wr *bad_wr; if (scnt < cycle_iters) post_cycles_start[scnt] = get_cycles(); @@ -1263,7 +1264,7 @@ done: static void krping_rlat_test_server(struct krping_cb *cb) { - struct ib_send_wr *bad_wr; + const struct ib_send_wr *bad_wr; struct ib_wc wc; int ret; @@ -1296,7 +1297,7 @@ static void krping_rlat_test_server(struct krping_cb *cb) static void krping_wlat_test_server(struct krping_cb *cb) { - struct ib_send_wr *bad_wr; + const struct ib_send_wr *bad_wr; struct ib_wc wc; int ret; @@ -1330,7 +1331,7 @@ static void krping_wlat_test_server(struct krping_cb *cb) static void krping_bw_test_server(struct krping_cb *cb) { - struct ib_send_wr *bad_wr; + const struct ib_send_wr *bad_wr; struct ib_wc wc; int ret; @@ -1434,7 +1435,7 @@ static int krping_bind_server(struct krping_cb *cb) static void krping_run_server(struct krping_cb *cb) { - struct ib_recv_wr *bad_wr; + const struct ib_recv_wr *bad_wr; int ret; ret = krping_bind_server(cb); @@ -1485,7 +1486,7 @@ err0: static void krping_test_client(struct krping_cb *cb) { int ping, start, cc, i, ret; - struct ib_send_wr *bad_wr; + const struct ib_send_wr *bad_wr; unsigned char c; start = 65; @@ -1558,7 +1559,7 @@ static void krping_test_client(struct krping_cb *cb) static void krping_rlat_test_client(struct krping_cb *cb) { - struct ib_send_wr *bad_wr; + const struct ib_send_wr *bad_wr; struct ib_wc wc; int ret; @@ -1600,7 +1601,7 @@ static void krping_rlat_test_client(struct krping_cb *cb) suseconds_t usec; unsigned long long elapsed; struct ib_wc wc; - struct ib_send_wr *bad_wr; + const struct ib_send_wr *bad_wr; int ne; cb->rdma_sq_wr.wr.opcode = IB_WR_RDMA_WRITE; @@ -1648,7 +1649,7 @@ static void krping_rlat_test_client(struct krping_cb *cb) static void krping_wlat_test_client(struct krping_cb *cb) { - struct ib_send_wr *bad_wr; + const struct ib_send_wr *bad_wr; struct ib_wc wc; int ret; @@ -1687,7 +1688,7 @@ static void krping_wlat_test_client(struct krping_cb *cb) static void krping_bw_test_client(struct krping_cb *cb) { - struct ib_send_wr *bad_wr; + const struct ib_send_wr *bad_wr; struct ib_wc wc; int ret; @@ -1729,8 +1730,10 @@ static void krping_bw_test_client(struct krping_cb *cb) */ static void flush_qp(struct krping_cb *cb) { - struct ib_send_wr wr = { 0 }, *bad; - struct ib_recv_wr recv_wr = { 0 }, *recv_bad; + struct ib_send_wr wr = { 0 }; + const struct ib_send_wr *bad; + struct ib_recv_wr recv_wr = { 0 }; + const struct ib_recv_wr *recv_bad; struct ib_wc wc; int ret; int flushed = 0; @@ -1773,7 +1776,8 @@ static void flush_qp(struct krping_cb *cb) static void krping_fr_test(struct krping_cb *cb) { - struct ib_send_wr inv, *bad; + struct ib_send_wr inv; + const struct ib_send_wr *bad; struct ib_reg_wr fr; struct ib_wc wc; u8 key = 0; @@ -1922,7 +1926,7 @@ static int krping_bind_client(struct krping_cb *cb) static void krping_run_client(struct krping_cb *cb) { - struct ib_recv_wr *bad_wr; + const struct ib_recv_wr *bad_wr; int ret; /* set type of service, if any */ diff --git a/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h b/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h index aa94a40add1e..8314800c4e7b 100644 --- a/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h +++ b/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h @@ -920,10 +920,10 @@ void c4iw_release_dev_ucontext(struct c4iw_rdev *rdev, void c4iw_init_dev_ucontext(struct c4iw_rdev *rdev, struct c4iw_dev_ucontext *uctx); int c4iw_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *wc); -int c4iw_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, - struct ib_send_wr **bad_wr); -int c4iw_post_receive(struct ib_qp *ibqp, struct ib_recv_wr *wr, - struct ib_recv_wr **bad_wr); +int c4iw_post_send(struct ib_qp *ibqp, const struct ib_send_wr *wr, + const struct ib_send_wr **bad_wr); +int c4iw_post_receive(struct ib_qp *ibqp, const struct ib_recv_wr *wr, + const struct ib_recv_wr **bad_wr); int c4iw_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param); int c4iw_create_listen(struct iw_cm_id *cm_id, int backlog); int c4iw_destroy_listen(struct iw_cm_id *cm_id); diff --git a/sys/dev/cxgbe/iw_cxgbe/qp.c b/sys/dev/cxgbe/iw_cxgbe/qp.c index f999254a748c..eb314a6034c8 100644 --- a/sys/dev/cxgbe/iw_cxgbe/qp.c +++ b/sys/dev/cxgbe/iw_cxgbe/qp.c @@ -335,7 +335,7 @@ free_sq_qid: } static int build_immd(struct t4_sq *sq, struct fw_ri_immd *immdp, - struct ib_send_wr *wr, int max, u32 *plenp) + const struct ib_send_wr *wr, int max, u32 *plenp) { u8 *dstp, *srcp; u32 plen = 0; @@ -405,7 +405,7 @@ static int build_isgl(__be64 *queue_start, __be64 *queue_end, } static int build_rdma_send(struct t4_sq *sq, union t4_wr *wqe, - struct ib_send_wr *wr, u8 *len16) + const struct ib_send_wr *wr, u8 *len16) { u32 plen; int size; @@ -472,7 +472,7 @@ static int build_rdma_send(struct t4_sq *sq, union t4_wr *wqe, } static int build_rdma_write(struct t4_sq *sq, union t4_wr *wqe, - struct ib_send_wr *wr, u8 *len16) + const struct ib_send_wr *wr, u8 *len16) { u32 plen; int size; @@ -514,7 +514,7 @@ static int build_rdma_write(struct t4_sq *sq, union t4_wr *wqe, return 0; } -static int build_rdma_read(union t4_wr *wqe, struct ib_send_wr *wr, u8 *len16) +static int build_rdma_read(union t4_wr *wqe, const struct ib_send_wr *wr, u8 *len16) { if (wr->num_sge > 1) return -EINVAL; @@ -545,7 +545,7 @@ static int build_rdma_read(union t4_wr *wqe, struct ib_send_wr *wr, u8 *len16) } static int build_rdma_recv(struct c4iw_qp *qhp, union t4_recv_wr *wqe, - struct ib_recv_wr *wr, u8 *len16) + const struct ib_recv_wr *wr, u8 *len16) { int ret; @@ -559,7 +559,7 @@ static int build_rdma_recv(struct c4iw_qp *qhp, union t4_recv_wr *wqe, return 0; } -static int build_inv_stag(union t4_wr *wqe, struct ib_send_wr *wr, +static int build_inv_stag(union t4_wr *wqe, const struct ib_send_wr *wr, u8 *len16) { wqe->inv.stag_inv = cpu_to_be32(wr->ex.invalidate_rkey); @@ -609,7 +609,7 @@ void c4iw_qp_rem_ref(struct ib_qp *qp) kref_put(&to_c4iw_qp(qp)->kref, queue_qp_free); } -static void complete_sq_drain_wr(struct c4iw_qp *qhp, struct ib_send_wr *wr) +static void complete_sq_drain_wr(struct c4iw_qp *qhp, const struct ib_send_wr *wr) { struct t4_cqe cqe = {}; struct c4iw_cq *schp; @@ -639,7 +639,7 @@ static void complete_sq_drain_wr(struct c4iw_qp *qhp, struct ib_send_wr *wr) spin_unlock_irqrestore(&schp->comp_handler_lock, flag); } -static void complete_rq_drain_wr(struct c4iw_qp *qhp, struct ib_recv_wr *wr) +static void complete_rq_drain_wr(struct c4iw_qp *qhp, const struct ib_recv_wr *wr) { struct t4_cqe cqe = {}; struct c4iw_cq *rchp; @@ -670,7 +670,7 @@ static void complete_rq_drain_wr(struct c4iw_qp *qhp, struct ib_recv_wr *wr) } static int build_tpte_memreg(struct fw_ri_fr_nsmr_tpte_wr *fr, - struct ib_reg_wr *wr, struct c4iw_mr *mhp, u8 *len16) + const struct ib_reg_wr *wr, struct c4iw_mr *mhp, u8 *len16) { __be64 *p = (__be64 *)fr->pbl; @@ -705,7 +705,7 @@ static int build_tpte_memreg(struct fw_ri_fr_nsmr_tpte_wr *fr, } static int build_memreg(struct t4_sq *sq, union t4_wr *wqe, - struct ib_reg_wr *wr, struct c4iw_mr *mhp, u8 *len16, + const struct ib_reg_wr *wr, struct c4iw_mr *mhp, u8 *len16, bool dsgl_supported) { struct fw_ri_immd *imdp; @@ -772,8 +772,8 @@ static int build_memreg(struct t4_sq *sq, union t4_wr *wqe, return 0; } -int c4iw_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, - struct ib_send_wr **bad_wr) +int c4iw_post_send(struct ib_qp *ibqp, const struct ib_send_wr *wr, + const struct ib_send_wr **bad_wr) { int err = 0; u8 len16 = 0; @@ -912,8 +912,8 @@ int c4iw_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, return err; } -int c4iw_post_receive(struct ib_qp *ibqp, struct ib_recv_wr *wr, - struct ib_recv_wr **bad_wr) +int c4iw_post_receive(struct ib_qp *ibqp, const struct ib_recv_wr *wr, + const struct ib_recv_wr **bad_wr) { int err = 0; struct c4iw_qp *qhp; diff --git a/sys/dev/iser/iser_memory.c b/sys/dev/iser/iser_memory.c index ca3b557866b1..9cf48248741c 100644 --- a/sys/dev/iser/iser_memory.c +++ b/sys/dev/iser/iser_memory.c @@ -159,7 +159,8 @@ iser_fast_reg_mr(struct icl_iser_pdu *iser_pdu, struct ib_mr *mr = rsc->mr; struct ib_reg_wr fastreg_wr; struct ib_send_wr inv_wr; - struct ib_send_wr *bad_wr, *wr = NULL; + const struct ib_send_wr *bad_wr; + struct ib_send_wr *wr = NULL; int ret, n; /* if there a single dma entry, dma mr suffices */ diff --git a/sys/dev/iser/iser_verbs.c b/sys/dev/iser/iser_verbs.c index c9d42da2657b..c613764bd952 100644 --- a/sys/dev/iser/iser_verbs.c +++ b/sys/dev/iser/iser_verbs.c @@ -614,8 +614,8 @@ int iser_conn_terminate(struct iser_conn *iser_conn) { struct ib_conn *ib_conn = &iser_conn->ib_conn; - struct ib_send_wr *bad_send_wr; - struct ib_recv_wr *bad_recv_wr; + const struct ib_send_wr *bad_send_wr; + const struct ib_recv_wr *bad_recv_wr; int err = 0; /* terminate the iser conn only if the conn state is UP */ @@ -860,7 +860,8 @@ iser_cma_handler(struct rdma_cm_id *cma_id, struct rdma_cm_event *event) int iser_post_recvl(struct iser_conn *iser_conn) { - struct ib_recv_wr rx_wr, *rx_wr_failed; + const struct ib_recv_wr *rx_wr_failed; + struct ib_recv_wr rx_wr; struct ib_conn *ib_conn = &iser_conn->ib_conn; struct ib_sge sge; int ib_ret; @@ -887,7 +888,8 @@ iser_post_recvl(struct iser_conn *iser_conn) int iser_post_recvm(struct iser_conn *iser_conn, int count) { - struct ib_recv_wr *rx_wr, *rx_wr_failed; + const struct ib_recv_wr *rx_wr_failed; + struct ib_recv_wr *rx_wr; int i, ib_ret; struct ib_conn *ib_conn = &iser_conn->ib_conn; unsigned int my_rx_head = iser_conn->rx_desc_head; @@ -925,7 +927,8 @@ int iser_post_send(struct ib_conn *ib_conn, struct iser_tx_desc *tx_desc, bool signal) { int ib_ret; - struct ib_send_wr send_wr, *send_wr_failed; + const struct ib_send_wr *send_wr_failed; + struct ib_send_wr send_wr; ib_dma_sync_single_for_device(ib_conn->device->ib_device, tx_desc->dma_addr, ISER_HEADERS_LEN, diff --git a/sys/dev/mlx4/mlx4_ib/mlx4_ib.h b/sys/dev/mlx4/mlx4_ib/mlx4_ib.h index 100a06b75af7..544ed1913419 100644 --- a/sys/dev/mlx4/mlx4_ib/mlx4_ib.h +++ b/sys/dev/mlx4/mlx4_ib/mlx4_ib.h @@ -760,8 +760,8 @@ int mlx4_ib_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr, int mlx4_ib_query_srq(struct ib_srq *srq, struct ib_srq_attr *srq_attr); int mlx4_ib_destroy_srq(struct ib_srq *srq); void mlx4_ib_free_srq_wqe(struct mlx4_ib_srq *srq, int wqe_index); -int mlx4_ib_post_srq_recv(struct ib_srq *ibsrq, struct ib_recv_wr *wr, - struct ib_recv_wr **bad_wr); +int mlx4_ib_post_srq_recv(struct ib_srq *ibsrq, const struct ib_recv_wr *wr, + const struct ib_recv_wr **bad_wr); struct ib_qp *mlx4_ib_create_qp(struct ib_pd *pd, struct ib_qp_init_attr *init_attr, @@ -771,10 +771,10 @@ int mlx4_ib_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask, struct ib_udata *udata); int mlx4_ib_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr, int qp_attr_mask, struct ib_qp_init_attr *qp_init_attr); -int mlx4_ib_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, - struct ib_send_wr **bad_wr); -int mlx4_ib_post_recv(struct ib_qp *ibqp, struct ib_recv_wr *wr, - struct ib_recv_wr **bad_wr); +int mlx4_ib_post_send(struct ib_qp *ibqp, const struct ib_send_wr *wr, + const struct ib_send_wr **bad_wr); +int mlx4_ib_post_recv(struct ib_qp *ibqp, const struct ib_recv_wr *wr, + const struct ib_recv_wr **bad_wr); int mlx4_MAD_IFC(struct mlx4_ib_dev *dev, int mad_ifc_flags, int port, const struct ib_wc *in_wc, const struct ib_grh *in_grh, diff --git a/sys/dev/mlx4/mlx4_ib/mlx4_ib_mad.c b/sys/dev/mlx4/mlx4_ib/mlx4_ib_mad.c index 183ccecd2171..455b85f27942 100644 --- a/sys/dev/mlx4/mlx4_ib/mlx4_ib_mad.c +++ b/sys/dev/mlx4/mlx4_ib/mlx4_ib_mad.c @@ -485,7 +485,7 @@ int mlx4_ib_send_to_slave(struct mlx4_ib_dev *dev, int slave, u8 port, { struct ib_sge list; struct ib_ud_wr wr; - struct ib_send_wr *bad_wr; + const struct ib_send_wr *bad_wr; struct mlx4_ib_demux_pv_ctx *tun_ctx; struct mlx4_ib_demux_pv_qp *tun_qp; struct mlx4_rcv_tunnel_mad *tun_mad; @@ -1275,7 +1275,8 @@ static int mlx4_ib_post_pv_qp_buf(struct mlx4_ib_demux_pv_ctx *ctx, int index) { struct ib_sge sg_list; - struct ib_recv_wr recv_wr, *bad_recv_wr; + struct ib_recv_wr recv_wr; + const struct ib_recv_wr *bad_recv_wr; int size; size = (tun_qp->qp->qp_type == IB_QPT_UD) ? @@ -1326,7 +1327,7 @@ int mlx4_ib_send_to_wire(struct mlx4_ib_dev *dev, int slave, u8 port, { struct ib_sge list; struct ib_ud_wr wr; - struct ib_send_wr *bad_wr; + const struct ib_send_wr *bad_wr; struct mlx4_ib_demux_pv_ctx *sqp_ctx; struct mlx4_ib_demux_pv_qp *sqp; struct mlx4_mad_snd_buf *sqp_mad; diff --git a/sys/dev/mlx4/mlx4_ib/mlx4_ib_qp.c b/sys/dev/mlx4/mlx4_ib/mlx4_ib_qp.c index 280ab6359dd1..9eebbd6bb978 100644 --- a/sys/dev/mlx4/mlx4_ib/mlx4_ib_qp.c +++ b/sys/dev/mlx4/mlx4_ib/mlx4_ib_qp.c @@ -2287,7 +2287,7 @@ static int vf_get_qp0_qkey(struct mlx4_dev *dev, int qpn, u32 *qkey) } static int build_sriov_qp0_header(struct mlx4_ib_sqp *sqp, - struct ib_ud_wr *wr, + const struct ib_ud_wr *wr, void *wqe, unsigned *mlx_seg_len) { struct mlx4_ib_dev *mdev = to_mdev(sqp->qp.ibqp.device); @@ -2416,7 +2416,7 @@ static u8 sl_to_vl(struct mlx4_ib_dev *dev, u8 sl, int port_num) } #define MLX4_ROCEV2_QP1_SPORT 0xC000 -static int build_mlx_header(struct mlx4_ib_sqp *sqp, struct ib_ud_wr *wr, +static int build_mlx_header(struct mlx4_ib_sqp *sqp, const struct ib_ud_wr *wr, void *wqe, unsigned *mlx_seg_len) { struct ib_device *ib_dev = sqp->qp.ibqp.device; @@ -2707,7 +2707,7 @@ static __be32 convert_access(int acc) } static void set_reg_seg(struct mlx4_wqe_fmr_seg *fseg, - struct ib_reg_wr *wr) + const struct ib_reg_wr *wr) { struct mlx4_ib_mr *mr = to_mmr(wr->mr); @@ -2737,7 +2737,7 @@ static __always_inline void set_raddr_seg(struct mlx4_wqe_raddr_seg *rseg, } static void set_atomic_seg(struct mlx4_wqe_atomic_seg *aseg, - struct ib_atomic_wr *wr) + const struct ib_atomic_wr *wr) { if (wr->wr.opcode == IB_WR_ATOMIC_CMP_AND_SWP) { aseg->swap_add = cpu_to_be64(wr->swap); @@ -2753,7 +2753,7 @@ static void set_atomic_seg(struct mlx4_wqe_atomic_seg *aseg, } static void set_masked_atomic_seg(struct mlx4_wqe_masked_atomic_seg *aseg, - struct ib_atomic_wr *wr) + const struct ib_atomic_wr *wr) { aseg->swap_add = cpu_to_be64(wr->swap); aseg->swap_add_mask = cpu_to_be64(wr->swap_mask); @@ -2762,7 +2762,7 @@ static void set_masked_atomic_seg(struct mlx4_wqe_masked_atomic_seg *aseg, } static void set_datagram_seg(struct mlx4_wqe_datagram_seg *dseg, - struct ib_ud_wr *wr) + const struct ib_ud_wr *wr) { memcpy(dseg->av, &to_mah(wr->ah)->av, sizeof (struct mlx4_av)); dseg->dqpn = cpu_to_be32(wr->remote_qpn); @@ -2773,7 +2773,7 @@ static void set_datagram_seg(struct mlx4_wqe_datagram_seg *dseg, static void set_tunnel_datagram_seg(struct mlx4_ib_dev *dev, struct mlx4_wqe_datagram_seg *dseg, - struct ib_ud_wr *wr, + const struct ib_ud_wr *wr, enum mlx4_ib_qp_type qpt) { union mlx4_ext_av *av = &to_mah(wr->ah)->av; @@ -2795,7 +2795,7 @@ static void set_tunnel_datagram_seg(struct mlx4_ib_dev *dev, dseg->qkey = cpu_to_be32(IB_QP_SET_QKEY); } -static void build_tunnel_header(struct ib_ud_wr *wr, void *wqe, unsigned *mlx_seg_len) +static void build_tunnel_header(const struct ib_ud_wr *wr, void *wqe, unsigned *mlx_seg_len) { struct mlx4_wqe_inline_seg *inl = wqe; struct mlx4_ib_tunnel_header hdr; @@ -2878,7 +2878,7 @@ static void __set_data_seg(struct mlx4_wqe_data_seg *dseg, struct ib_sge *sg) dseg->addr = cpu_to_be64(sg->addr); } -static int build_lso_seg(struct mlx4_wqe_lso_seg *wqe, struct ib_ud_wr *wr, +static int build_lso_seg(struct mlx4_wqe_lso_seg *wqe, const struct ib_ud_wr *wr, struct mlx4_ib_qp *qp, unsigned *lso_seg_len, __be32 *lso_hdr_sz, __be32 *blh) { @@ -2898,7 +2898,7 @@ static int build_lso_seg(struct mlx4_wqe_lso_seg *wqe, struct ib_ud_wr *wr, return 0; } -static __be32 send_ieth(struct ib_send_wr *wr) +static __be32 send_ieth(const struct ib_send_wr *wr) { switch (wr->opcode) { case IB_WR_SEND_WITH_IMM: @@ -2920,8 +2920,8 @@ static void add_zero_len_inline(void *wqe) inl->byte_count = cpu_to_be32(1U << 31); } -int mlx4_ib_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, - struct ib_send_wr **bad_wr) +int mlx4_ib_post_send(struct ib_qp *ibqp, const struct ib_send_wr *wr, + const struct ib_send_wr **bad_wr) { struct mlx4_ib_qp *qp = to_mqp(ibqp); void *wqe; @@ -3255,8 +3255,8 @@ out: return err; } -int mlx4_ib_post_recv(struct ib_qp *ibqp, struct ib_recv_wr *wr, - struct ib_recv_wr **bad_wr) +int mlx4_ib_post_recv(struct ib_qp *ibqp, const struct ib_recv_wr *wr, + const struct ib_recv_wr **bad_wr) { struct mlx4_ib_qp *qp = to_mqp(ibqp); struct mlx4_wqe_data_seg *scat; diff --git a/sys/dev/mlx4/mlx4_ib/mlx4_ib_srq.c b/sys/dev/mlx4/mlx4_ib/mlx4_ib_srq.c index a2e55db37125..a040b673dae9 100644 --- a/sys/dev/mlx4/mlx4_ib/mlx4_ib_srq.c +++ b/sys/dev/mlx4/mlx4_ib/mlx4_ib_srq.c @@ -311,8 +311,8 @@ void mlx4_ib_free_srq_wqe(struct mlx4_ib_srq *srq, int wqe_index) spin_unlock(&srq->lock); } -int mlx4_ib_post_srq_recv(struct ib_srq *ibsrq, struct ib_recv_wr *wr, - struct ib_recv_wr **bad_wr) +int mlx4_ib_post_srq_recv(struct ib_srq *ibsrq, const struct ib_recv_wr *wr, + const struct ib_recv_wr **bad_wr) { struct mlx4_ib_srq *srq = to_msrq(ibsrq); struct mlx4_wqe_srq_next_seg *next; diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib.h b/sys/dev/mlx5/mlx5_ib/mlx5_ib.h index 44a9aa307be7..695b1ab14948 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib.h +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib.h @@ -449,7 +449,7 @@ struct mlx5_umr_wr { u32 mkey; }; -static inline struct mlx5_umr_wr *umr_wr(struct ib_send_wr *wr) +static inline const struct mlx5_umr_wr *umr_wr(const struct ib_send_wr *wr) { return container_of(wr, struct mlx5_umr_wr, wr); } @@ -837,8 +837,8 @@ int mlx5_ib_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr, enum ib_srq_attr_mask attr_mask, struct ib_udata *udata); int mlx5_ib_query_srq(struct ib_srq *ibsrq, struct ib_srq_attr *srq_attr); int mlx5_ib_destroy_srq(struct ib_srq *srq); -int mlx5_ib_post_srq_recv(struct ib_srq *ibsrq, struct ib_recv_wr *wr, - struct ib_recv_wr **bad_wr); +int mlx5_ib_post_srq_recv(struct ib_srq *ibsrq, const struct ib_recv_wr *wr, + const struct ib_recv_wr **bad_wr); struct ib_qp *mlx5_ib_create_qp(struct ib_pd *pd, struct ib_qp_init_attr *init_attr, struct ib_udata *udata); @@ -847,10 +847,10 @@ int mlx5_ib_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int mlx5_ib_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr, int qp_attr_mask, struct ib_qp_init_attr *qp_init_attr); int mlx5_ib_destroy_qp(struct ib_qp *qp); -int mlx5_ib_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, - struct ib_send_wr **bad_wr); -int mlx5_ib_post_recv(struct ib_qp *ibqp, struct ib_recv_wr *wr, - struct ib_recv_wr **bad_wr); +int mlx5_ib_post_send(struct ib_qp *ibqp, const struct ib_send_wr *wr, + const struct ib_send_wr **bad_wr); +int mlx5_ib_post_recv(struct ib_qp *ibqp, const struct ib_recv_wr *wr, + const struct ib_recv_wr **bad_wr); void *mlx5_get_send_wqe(struct mlx5_ib_qp *qp, int n); int mlx5_ib_read_user_wqe(struct mlx5_ib_qp *qp, int send, int wqe_index, void *buffer, u32 length, @@ -994,10 +994,10 @@ int mlx5_ib_gsi_modify_qp(struct ib_qp *qp, struct ib_qp_attr *attr, int mlx5_ib_gsi_query_qp(struct ib_qp *qp, struct ib_qp_attr *qp_attr, int qp_attr_mask, struct ib_qp_init_attr *qp_init_attr); -int mlx5_ib_gsi_post_send(struct ib_qp *qp, struct ib_send_wr *wr, - struct ib_send_wr **bad_wr); -int mlx5_ib_gsi_post_recv(struct ib_qp *qp, struct ib_recv_wr *wr, - struct ib_recv_wr **bad_wr); +int mlx5_ib_gsi_post_send(struct ib_qp *qp, const struct ib_send_wr *wr, + const struct ib_send_wr **bad_wr); +int mlx5_ib_gsi_post_recv(struct ib_qp *qp, const struct ib_recv_wr *wr, + const struct ib_recv_wr **bad_wr); void mlx5_ib_gsi_pkey_change(struct mlx5_ib_gsi_qp *gsi); int mlx5_ib_generate_wc(struct ib_cq *ibcq, struct ib_wc *wc); diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib_gsi.c b/sys/dev/mlx5/mlx5_ib/mlx5_ib_gsi.c index 6c0417851665..dc90b1348378 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib_gsi.c +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib_gsi.c @@ -472,8 +472,8 @@ static struct ib_qp *get_tx_qp(struct mlx5_ib_gsi_qp *gsi, struct ib_ud_wr *wr) return gsi->tx_qps[qp_index]; } -int mlx5_ib_gsi_post_send(struct ib_qp *qp, struct ib_send_wr *wr, - struct ib_send_wr **bad_wr) +int mlx5_ib_gsi_post_send(struct ib_qp *qp, const struct ib_send_wr *wr, + const struct ib_send_wr **bad_wr) { struct mlx5_ib_gsi_qp *gsi = gsi_qp(qp); struct ib_qp *tx_qp; @@ -517,8 +517,8 @@ err: return ret; } -int mlx5_ib_gsi_post_recv(struct ib_qp *qp, struct ib_recv_wr *wr, - struct ib_recv_wr **bad_wr) +int mlx5_ib_gsi_post_recv(struct ib_qp *qp, const struct ib_recv_wr *wr, + const struct ib_recv_wr **bad_wr) { struct mlx5_ib_gsi_qp *gsi = gsi_qp(qp); diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib_mr.c b/sys/dev/mlx5/mlx5_ib/mlx5_ib_mr.c index 585e52d35d3b..145ec55d6757 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib_mr.c +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib_mr.c @@ -573,41 +573,38 @@ static int dma_map_mr_pas(struct mlx5_ib_dev *dev, struct ib_umem *umem, return 0; } -static void prep_umr_wqe_common(struct ib_pd *pd, struct ib_send_wr *wr, +static void prep_umr_wqe_common(struct ib_pd *pd, struct mlx5_umr_wr *umrwr, struct ib_sge *sg, u64 dma, int n, u32 key, int page_shift) { struct mlx5_ib_dev *dev = to_mdev(pd->device); - struct mlx5_umr_wr *umrwr = umr_wr(wr); sg->addr = dma; sg->length = ALIGN(sizeof(u64) * n, 64); sg->lkey = dev->umrc.pd->local_dma_lkey; - wr->next = NULL; - wr->sg_list = sg; + umrwr->wr.next = NULL; + umrwr->wr.sg_list = sg; if (n) - wr->num_sge = 1; + umrwr->wr.num_sge = 1; else - wr->num_sge = 0; + umrwr->wr.num_sge = 0; - wr->opcode = MLX5_IB_WR_UMR; + umrwr->wr.opcode = MLX5_IB_WR_UMR; umrwr->npages = n; umrwr->page_shift = page_shift; umrwr->mkey = key; } -static void prep_umr_reg_wqe(struct ib_pd *pd, struct ib_send_wr *wr, +static void prep_umr_reg_wqe(struct ib_pd *pd, struct mlx5_umr_wr *umrwr, struct ib_sge *sg, u64 dma, int n, u32 key, int page_shift, u64 virt_addr, u64 len, int access_flags) { - struct mlx5_umr_wr *umrwr = umr_wr(wr); + prep_umr_wqe_common(pd, umrwr, sg, dma, n, key, page_shift); - prep_umr_wqe_common(pd, wr, sg, dma, n, key, page_shift); - - wr->send_flags = 0; + umrwr->wr.send_flags = 0; umrwr->target.virt_addr = virt_addr; umrwr->length = len; @@ -616,12 +613,10 @@ static void prep_umr_reg_wqe(struct ib_pd *pd, struct ib_send_wr *wr, } static void prep_umr_unreg_wqe(struct mlx5_ib_dev *dev, - struct ib_send_wr *wr, u32 key) + struct mlx5_umr_wr *umrwr, u32 key) { - struct mlx5_umr_wr *umrwr = umr_wr(wr); - - wr->send_flags = MLX5_IB_SEND_UMR_UNREG | MLX5_IB_SEND_UMR_FAIL_IF_FREE; - wr->opcode = MLX5_IB_WR_UMR; + umrwr->wr.send_flags = MLX5_IB_SEND_UMR_UNREG | MLX5_IB_SEND_UMR_FAIL_IF_FREE; + umrwr->wr.opcode = MLX5_IB_WR_UMR; umrwr->mkey = key; } @@ -675,7 +670,7 @@ static struct mlx5_ib_mr *reg_umr(struct ib_pd *pd, struct ib_umem *umem, struct umr_common *umrc = &dev->umrc; struct mlx5_ib_umr_context umr_context; struct mlx5_umr_wr umrwr = {}; - struct ib_send_wr *bad; + const struct ib_send_wr *bad; struct mlx5_ib_mr *mr; struct ib_sge sg; int size; @@ -707,7 +702,7 @@ static struct mlx5_ib_mr *reg_umr(struct ib_pd *pd, struct ib_umem *umem, mlx5_ib_init_umr_context(&umr_context); umrwr.wr.wr_cqe = &umr_context.cqe; - prep_umr_reg_wqe(pd, &umrwr.wr, &sg, dma, npages, mr->mmkey.key, + prep_umr_reg_wqe(pd, &umrwr, &sg, dma, npages, mr->mmkey.key, page_shift, virt_addr, len, access_flags); down(&umrc->sem); @@ -756,7 +751,7 @@ int mlx5_ib_update_mtt(struct mlx5_ib_mr *mr, u64 start_page_index, int npages, int size; __be64 *pas; dma_addr_t dma; - struct ib_send_wr *bad; + const struct ib_send_wr *bad; struct mlx5_umr_wr wr; struct ib_sge sg; int err = 0; @@ -1026,7 +1021,7 @@ static int unreg_umr(struct mlx5_ib_dev *dev, struct mlx5_ib_mr *mr) struct umr_common *umrc = &dev->umrc; struct mlx5_ib_umr_context umr_context; struct mlx5_umr_wr umrwr = {}; - struct ib_send_wr *bad; + const struct ib_send_wr *bad; int err; if (mdev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) @@ -1035,7 +1030,7 @@ static int unreg_umr(struct mlx5_ib_dev *dev, struct mlx5_ib_mr *mr) mlx5_ib_init_umr_context(&umr_context); umrwr.wr.wr_cqe = &umr_context.cqe; - prep_umr_unreg_wqe(dev, &umrwr.wr, mr->mmkey.key); + prep_umr_unreg_wqe(dev, &umrwr, mr->mmkey.key); down(&umrc->sem); err = ib_post_send(umrc->qp, &umrwr.wr, &bad); @@ -1065,7 +1060,7 @@ static int rereg_umr(struct ib_pd *pd, struct mlx5_ib_mr *mr, u64 virt_addr, struct mlx5_ib_dev *dev = to_mdev(pd->device); struct device *ddev = dev->ib_dev.dma_device; struct mlx5_ib_umr_context umr_context; - struct ib_send_wr *bad; + const struct ib_send_wr *bad; struct mlx5_umr_wr umrwr = {}; struct ib_sge sg; struct umr_common *umrc = &dev->umrc; @@ -1090,7 +1085,7 @@ static int rereg_umr(struct ib_pd *pd, struct mlx5_ib_mr *mr, u64 virt_addr, umrwr.wr.send_flags |= MLX5_IB_SEND_UMR_UPDATE_TRANSLATION; } - prep_umr_wqe_common(pd, &umrwr.wr, &sg, dma, npages, mr->mmkey.key, + prep_umr_wqe_common(pd, &umrwr, &sg, dma, npages, mr->mmkey.key, page_shift); if (flags & IB_MR_REREG_PD) { diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c b/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c index ec47b3e07b87..90c6d69e30c2 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c @@ -3028,7 +3028,7 @@ static __always_inline void set_raddr_seg(struct mlx5_wqe_raddr_seg *rseg, } static void *set_eth_seg(struct mlx5_wqe_eth_seg *eseg, - struct ib_send_wr *wr, void *qend, + const struct ib_send_wr *wr, void *qend, struct mlx5_ib_qp *qp, int *size) { void *seg = eseg; @@ -3081,7 +3081,7 @@ static void *set_eth_seg(struct mlx5_wqe_eth_seg *eseg, } static void set_datagram_seg(struct mlx5_wqe_datagram_seg *dseg, - struct ib_send_wr *wr) + const struct ib_send_wr *wr) { memcpy(&dseg->av, &to_mah(ud_wr(wr)->ah)->av, sizeof(struct mlx5_av)); dseg->av.dqp_dct = cpu_to_be32(ud_wr(wr)->remote_qpn | MLX5_EXTENDED_UD_AV); @@ -3240,9 +3240,9 @@ static __be64 get_umr_update_pd_mask(void) } static void set_reg_umr_segment(struct mlx5_wqe_umr_ctrl_seg *umr, - struct ib_send_wr *wr) + const struct ib_send_wr *wr) { - struct mlx5_umr_wr *umrwr = umr_wr(wr); + const struct mlx5_umr_wr *umrwr = umr_wr(wr); memset(umr, 0, sizeof(*umr)); @@ -3311,9 +3311,9 @@ static void set_linv_mkey_seg(struct mlx5_mkey_seg *seg) seg->status = MLX5_MKEY_STATUS_FREE; } -static void set_reg_mkey_segment(struct mlx5_mkey_seg *seg, struct ib_send_wr *wr) +static void set_reg_mkey_segment(struct mlx5_mkey_seg *seg, const struct ib_send_wr *wr) { - struct mlx5_umr_wr *umrwr = umr_wr(wr); + const struct mlx5_umr_wr *umrwr = umr_wr(wr); memset(seg, 0, sizeof(*seg)); if (wr->send_flags & MLX5_IB_SEND_UMR_UNREG) { @@ -3344,7 +3344,7 @@ static void set_reg_data_seg(struct mlx5_wqe_data_seg *dseg, dseg->lkey = cpu_to_be32(pd->ibpd.local_dma_lkey); } -static __be32 send_ieth(struct ib_send_wr *wr) +static __be32 send_ieth(const struct ib_send_wr *wr) { switch (wr->opcode) { case IB_WR_SEND_WITH_IMM: @@ -3376,7 +3376,7 @@ static u8 wq_sig(void *wqe) return calc_sig(wqe, (*((u8 *)wqe + 8) & 0x3f) << 4); } -static int set_data_inl_seg(struct mlx5_ib_qp *qp, struct ib_send_wr *wr, +static int set_data_inl_seg(struct mlx5_ib_qp *qp, const struct ib_send_wr *wr, void *wqe, int *sz) { struct mlx5_wqe_inline_seg *seg; @@ -3522,7 +3522,7 @@ static int mlx5_set_bsf(struct ib_mr *sig_mr, return 0; } -static int set_sig_data_segment(struct ib_sig_handover_wr *wr, +static int set_sig_data_segment(const struct ib_sig_handover_wr *wr, struct mlx5_ib_qp *qp, void **seg, int *size) { struct ib_sig_attrs *sig_attrs = wr->sig_attrs; @@ -3624,7 +3624,7 @@ static int set_sig_data_segment(struct ib_sig_handover_wr *wr, } static void set_sig_mkey_segment(struct mlx5_mkey_seg *seg, - struct ib_sig_handover_wr *wr, u32 nelements, + const struct ib_sig_handover_wr *wr, u32 nelements, u32 length, u32 pdn) { struct ib_mr *sig_mr = wr->sig_mr; @@ -3655,10 +3655,10 @@ static void set_sig_umr_segment(struct mlx5_wqe_umr_ctrl_seg *umr, } -static int set_sig_umr_wr(struct ib_send_wr *send_wr, struct mlx5_ib_qp *qp, +static int set_sig_umr_wr(const struct ib_send_wr *send_wr, struct mlx5_ib_qp *qp, void **seg, int *size) { - struct ib_sig_handover_wr *wr = sig_handover_wr(send_wr); + const struct ib_sig_handover_wr *wr = sig_handover_wr(send_wr); struct mlx5_ib_mr *sig_mr = to_mmr(wr->sig_mr); u32 pdn = get_pd(qp)->pdn; u32 klm_oct_size; @@ -3732,7 +3732,7 @@ static int set_psv_wr(struct ib_sig_domain *domain, } static int set_reg_wr(struct mlx5_ib_qp *qp, - struct ib_reg_wr *wr, + const struct ib_reg_wr *wr, void **seg, int *size) { struct mlx5_ib_mr *mr = to_mmr(wr->mr); @@ -3797,7 +3797,7 @@ static void dump_wqe(struct mlx5_ib_qp *qp, int idx, int size_16) } } -static u8 get_fence(u8 fence, struct ib_send_wr *wr) +static u8 get_fence(u8 fence, const struct ib_send_wr *wr) { if (unlikely(wr->opcode == IB_WR_LOCAL_INV && wr->send_flags & IB_SEND_FENCE)) @@ -3815,10 +3815,10 @@ static u8 get_fence(u8 fence, struct ib_send_wr *wr) return 0; } -static int begin_wqe(struct mlx5_ib_qp *qp, void **seg, - struct mlx5_wqe_ctrl_seg **ctrl, - struct ib_send_wr *wr, unsigned *idx, - int *size, int nreq) +static int __begin_wqe(struct mlx5_ib_qp *qp, void **seg, + struct mlx5_wqe_ctrl_seg **ctrl, + const struct ib_send_wr *wr, unsigned *idx, + int *size, int nreq, bool send_signaled, bool solicited) { if (unlikely(mlx5_wq_overflow(&qp->sq, nreq, qp->ibqp.send_cq))) return -ENOMEM; @@ -3829,10 +3829,8 @@ static int begin_wqe(struct mlx5_ib_qp *qp, void **seg, *(uint32_t *)(*seg + 8) = 0; (*ctrl)->imm = send_ieth(wr); (*ctrl)->fm_ce_se = qp->sq_signal_bits | - (wr->send_flags & IB_SEND_SIGNALED ? - MLX5_WQE_CTRL_CQ_UPDATE : 0) | - (wr->send_flags & IB_SEND_SOLICITED ? - MLX5_WQE_CTRL_SOLICITED : 0); + (send_signaled ? MLX5_WQE_CTRL_CQ_UPDATE : 0) | + (solicited ? MLX5_WQE_CTRL_SOLICITED : 0); *seg += sizeof(**ctrl); *size = sizeof(**ctrl) / 16; @@ -3840,6 +3838,16 @@ static int begin_wqe(struct mlx5_ib_qp *qp, void **seg, return 0; } +static int begin_wqe(struct mlx5_ib_qp *qp, void **seg, + struct mlx5_wqe_ctrl_seg **ctrl, + const struct ib_send_wr *wr, unsigned *idx, + int *size, int nreq) +{ + return __begin_wqe(qp, seg, ctrl, wr, idx, size, nreq, + wr->send_flags & IB_SEND_SIGNALED, + wr->send_flags & IB_SEND_SOLICITED); +} + static void finish_wqe(struct mlx5_ib_qp *qp, *** 655 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Mon Jul 26 16: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 9C6F966F901; Mon, 26 Jul 2021 16: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 4GYQ2n1r2Gz3pbx; Mon, 26 Jul 2021 16: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 6186119E4D; Mon, 26 Jul 2021 16: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 16QGDYVF005612; Mon, 26 Jul 2021 16: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 16QGDYn2005611; Mon, 26 Jul 2021 16:13:34 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:34 GMT Message-Id: <202107261613.16QGDYn2005611@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: fe866f58903b - stable/13 - ibcore: Remove debug prints after allocation failure. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: fe866f58903b2ff578f774f30c42953c402dfd70 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, 26 Jul 2021 16:13:37 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=fe866f58903b2ff578f774f30c42953c402dfd70 commit fe866f58903b2ff578f774f30c42953c402dfd70 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:45 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:31 +0000 ibcore: Remove debug prints after allocation failure. The prints after [k|v][m|z|c]alloc() functions are not needed, because in case of failure, allocator will print their internal error prints anyway. Linux commit: 2716243212241855cd9070883779f6e58967dec5 Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 26646ba5bcdadbd513dc4dfccc772952732aea5c) --- sys/ofed/drivers/infiniband/core/ib_mad.c | 40 ++++++------------------------- 1 file changed, 7 insertions(+), 33 deletions(-) diff --git a/sys/ofed/drivers/infiniband/core/ib_mad.c b/sys/ofed/drivers/infiniband/core/ib_mad.c index b9f45ff5e41d..5b1297fe4cd3 100644 --- a/sys/ofed/drivers/infiniband/core/ib_mad.c +++ b/sys/ofed/drivers/infiniband/core/ib_mad.c @@ -827,7 +827,6 @@ static int handle_outgoing_dr_smp(struct ib_mad_agent_private *mad_agent_priv, local = kmalloc(sizeof *local, GFP_ATOMIC); if (!local) { ret = -ENOMEM; - dev_err(&device->dev, "No memory for ib_mad_local_private\n"); goto out; } local->mad_priv = NULL; @@ -835,7 +834,6 @@ static int handle_outgoing_dr_smp(struct ib_mad_agent_private *mad_agent_priv, mad_priv = alloc_mad_private(mad_size, GFP_ATOMIC); if (!mad_priv) { ret = -ENOMEM; - dev_err(&device->dev, "No memory for local response MAD\n"); kfree(local); goto out; } @@ -958,9 +956,6 @@ static int alloc_send_rmpp_list(struct ib_mad_send_wr_private *send_wr, for (left = send_buf->data_len + pad; left > 0; left -= seg_size) { seg = kmalloc(sizeof (*seg) + seg_size, gfp_mask); if (!seg) { - dev_err(&send_buf->mad_agent->device->dev, - "alloc_send_rmpp_segs: RMPP mem alloc failed for len %zd, gfp %#x\n", - sizeof (*seg) + seg_size, gfp_mask); free_send_rmpp_list(send_wr); return -ENOMEM; } @@ -1373,12 +1368,7 @@ static int allocate_method_table(struct ib_mad_mgmt_method_table **method) { /* Allocate management method table */ *method = kzalloc(sizeof **method, GFP_ATOMIC); - if (!*method) { - pr_err("No memory for ib_mad_mgmt_method_table\n"); - return -ENOMEM; - } - - return 0; + return (*method) ? 0 : (-ENOMEM); } /* @@ -1469,8 +1459,6 @@ static int add_nonoui_reg_req(struct ib_mad_reg_req *mad_reg_req, /* Allocate management class table for "new" class version */ *class = kzalloc(sizeof **class, GFP_ATOMIC); if (!*class) { - dev_err(&agent_priv->agent.device->dev, - "No memory for ib_mad_mgmt_class_table\n"); ret = -ENOMEM; goto error1; } @@ -1535,22 +1523,16 @@ static int add_oui_reg_req(struct ib_mad_reg_req *mad_reg_req, if (!*vendor_table) { /* Allocate mgmt vendor class table for "new" class version */ vendor = kzalloc(sizeof *vendor, GFP_ATOMIC); - if (!vendor) { - dev_err(&agent_priv->agent.device->dev, - "No memory for ib_mad_mgmt_vendor_class_table\n"); + if (!vendor) goto error1; - } *vendor_table = vendor; } if (!(*vendor_table)->vendor_class[vclass]) { /* Allocate table for this management vendor class */ vendor_class = kzalloc(sizeof *vendor_class, GFP_ATOMIC); - if (!vendor_class) { - dev_err(&agent_priv->agent.device->dev, - "No memory for ib_mad_mgmt_vendor_class\n"); + if (!vendor_class) goto error2; - } (*vendor_table)->vendor_class[vclass] = vendor_class; } @@ -1560,7 +1542,8 @@ static int add_oui_reg_req(struct ib_mad_reg_req *mad_reg_req, mad_reg_req->oui, 3)) { method = &(*vendor_table)->vendor_class[ vclass]->method_table[i]; - BUG_ON(!*method); + if (!*method) + goto error3; goto check_in_use; } } @@ -1570,7 +1553,6 @@ static int add_oui_reg_req(struct ib_mad_reg_req *mad_reg_req, vclass]->oui[i])) { method = &(*vendor_table)->vendor_class[ vclass]->method_table[i]; - BUG_ON(*method); /* Allocate method table for this OUI */ if ((ret = allocate_method_table(method))) goto error3; @@ -2249,11 +2231,8 @@ static void ib_mad_recv_done(struct ib_cq *cq, struct ib_wc *wc) mad_size = recv->mad_size; response = alloc_mad_private(mad_size, GFP_KERNEL); - if (!response) { - dev_err(&port_priv->device->dev, - "%s: no memory for response buffer\n", __func__); + if (!response) goto out; - } if (rdma_cap_ib_switch(port_priv->device)) port_num = wc->port_num; @@ -2880,8 +2859,6 @@ static int ib_mad_post_receive_mads(struct ib_mad_qp_info *qp_info, mad_priv = alloc_mad_private(port_mad_size(qp_info->port_priv), GFP_ATOMIC); if (!mad_priv) { - dev_err(&qp_info->port_priv->device->dev, - "No memory for receive buffer\n"); ret = -ENOMEM; break; } @@ -2972,11 +2949,8 @@ static int ib_mad_port_start(struct ib_mad_port_private *port_priv) u16 pkey_index; attr = kmalloc(sizeof *attr, GFP_KERNEL); - if (!attr) { - dev_err(&port_priv->device->dev, - "Couldn't kmalloc ib_qp_attr\n"); + if (!attr) return -ENOMEM; - } ret = ib_find_pkey(port_priv->device, port_priv->port_num, IB_DEFAULT_PKEY_FULL, &pkey_index); From owner-dev-commits-src-all@freebsd.org Mon Jul 26 16:14: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 289DD66F85E; Mon, 26 Jul 2021 16:14: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 4GYQ3G3R62z3pkH; Mon, 26 Jul 2021 16:14: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 51ABE1A295; Mon, 26 Jul 2021 16:13: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 16QGDx1n006165; Mon, 26 Jul 2021 16:13:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDxP3006164; Mon, 26 Jul 2021 16:13:59 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:59 GMT Message-Id: <202107261613.16QGDxP3006164@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 9fe9a92ab68f - stable/13 - ibcore: Add some functions and definitions for selecting and querying retryable ucontext cleanup. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 9fe9a92ab68fc3f8aa0b6a45f46e2385cc10887f 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, 26 Jul 2021 16:14:03 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=9fe9a92ab68fc3f8aa0b6a45f46e2385cc10887f commit 9fe9a92ab68fc3f8aa0b6a45f46e2385cc10887f Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:02:00 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:33 +0000 ibcore: Add some functions and definitions for selecting and querying retryable ucontext cleanup. Linux commit: 1c77483e4c50339b0306572167ccbff6b55d051b Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit f60da09dbb152d7c8ee1719197d98149a8b0c017) --- sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c | 1 + sys/ofed/include/rdma/ib_verbs.h | 56 ++++++++++++++++++++++++ 2 files changed, 57 insertions(+) diff --git a/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c b/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c index ab6e27d40d33..df3f8657755c 100644 --- a/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c +++ b/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c @@ -365,6 +365,7 @@ ssize_t ib_uverbs_get_context(struct ib_uverbs_file *file, ucontext->tgid = get_pid(task_pid_group_leader(current)); rcu_read_unlock(); ucontext->closing = 0; + ucontext->cleanup_retryable = false; #ifdef CONFIG_INFINIBAND_ON_DEMAND_PAGING ucontext->umem_tree = RB_ROOT; diff --git a/sys/ofed/include/rdma/ib_verbs.h b/sys/ofed/include/rdma/ib_verbs.h index 45a25dc06c45..723db4a659cf 100644 --- a/sys/ofed/include/rdma/ib_verbs.h +++ b/sys/ofed/include/rdma/ib_verbs.h @@ -1364,6 +1364,20 @@ struct ib_fmr_attr { struct ib_umem; +enum rdma_remove_reason { + /* + * Userspace requested uobject deletion or initial try + * to remove uobject via cleanup. Call could fail + */ + RDMA_REMOVE_DESTROY, + /* Context deletion. This call should delete the actual object itself */ + RDMA_REMOVE_CLOSE, + /* Driver is being hot-unplugged. This call should delete the actual object itself */ + RDMA_REMOVE_DRIVER_REMOVE, + /* uobj is being cleaned-up before being committed */ + RDMA_REMOVE_ABORT, +}; + struct ib_ucontext { struct ib_device *device; struct list_head pd_list; @@ -1379,6 +1393,8 @@ struct ib_ucontext { struct list_head rwq_ind_tbl_list; int closing; + bool cleanup_retryable; + pid_t tgid; #ifdef CONFIG_INFINIBAND_ON_DEMAND_PAGING struct rb_root umem_tree; @@ -2213,6 +2229,46 @@ static inline bool ib_is_udata_cleared(struct ib_udata *udata, return ret; } +/** + * ib_is_destroy_retryable - Check whether the uobject destruction + * is retryable. + * @ret: The initial destruction return code + * @why: remove reason + * @uobj: The uobject that is destroyed + * + * This function is a helper function that IB layer and low-level drivers + * can use to consider whether the destruction of the given uobject is + * retry-able. + * It checks the original return code, if it wasn't success the destruction + * is retryable according to the ucontext state (i.e. cleanup_retryable) and + * the remove reason. (i.e. why). + * Must be called with the object locked for destroy. + */ +static inline bool ib_is_destroy_retryable(int ret, enum rdma_remove_reason why, + struct ib_uobject *uobj) +{ + return ret && (why == RDMA_REMOVE_DESTROY || + uobj->context->cleanup_retryable); +} + +/** + * ib_destroy_usecnt - Called during destruction to check the usecnt + * @usecnt: The usecnt atomic + * @why: remove reason + * @uobj: The uobject that is destroyed + * + * Non-zero usecnts will block destruction unless destruction was triggered by + * a ucontext cleanup. + */ +static inline int ib_destroy_usecnt(atomic_t *usecnt, + enum rdma_remove_reason why, + struct ib_uobject *uobj) +{ + if (atomic_read(usecnt) && ib_is_destroy_retryable(-EBUSY, why, uobj)) + return -EBUSY; + return 0; +} + /** * ib_modify_qp_is_ok - Check that the supplied attribute mask * contains all required attributes and no attributes not allowed for From owner-dev-commits-src-all@freebsd.org Mon Jul 26 16:13: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 3E06066F7A1; Mon, 26 Jul 2021 16:13: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 4GYQ2n576zz3pj4; Mon, 26 Jul 2021 16: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 8D4A019E4E; Mon, 26 Jul 2021 16: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 16QGDZEO005636; Mon, 26 Jul 2021 16: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 16QGDZTF005635; Mon, 26 Jul 2021 16:13:35 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:35 GMT Message-Id: <202107261613.16QGDZTF005635@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 7449dd9a127d - stable/13 - ibcore: Do not overreact to SM LID change event. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 7449dd9a127dc3ec75c3445713ab2d8103537d02 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, 26 Jul 2021 16:13:38 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=7449dd9a127dc3ec75c3445713ab2d8103537d02 commit 7449dd9a127dc3ec75c3445713ab2d8103537d02 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:46 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:31 +0000 ibcore: Do not overreact to SM LID change event. When IPoIB receives an SM LID change event, it reacts by flushing its path record cache and rejoining multicast groups. This is the same behavior it performs when it receives a reregistration event. This behavior is unnecessary as an SM may have database backup or synchronization mechanisms which permit the SM location or LID to change without loss of multicast membership and without impact to path records. Both opensm and the OPA FM issue reregistration events if a new SM is started (or restarted with a new config) or an SM event occurs which results in loss of multicast membership records by the SM (such as opensm failover) or the SM encounters new nodes with Active ports (such as after joining 2 fabrics by connecting switches via ISLs). Hence this event can be depended on as the trigger for IPoIB cache and multicast flushing. It appears that some drivers, such as qib, and hfi1 issue the IB_EVENT_SM_CHANGE but other drivers such as mlx4 and mlx5 do not. Empirical testing on Mellanox EDR using ibv_asyncwatch has confirmed that Mellanox EDR HCAs do not generate SM change events and that opensm does generate reregistration. An SM LID change event is generated by the mentioned drivers to reflect that sm_lid and/or sm_sl in the local port info has changed. The intent of this event is to permit applications and ULPs which have a local copy of this information (or an address handle using it) to update their information. The intent is that the reregistration event (caused by the SM via a bit in Set(PortInfo)) be used to inform nodes that they need to rejoin multicast groups, resubscribe for notices and potentially update path records. When an SM migrates or fails over, a SM LID change event can occur. In response IPoIB discards path records and multicast membership and loses connectivity until these records are restored via SA requests. In very large fabrics, it may take minutes for the SM to be ready and for the SA responses to be supplied. This can result in undesirable and unnecessary IPoIB connectivity impacts. It also can result in an unnecessary storm of SA queries from all nodes in a cluster potentially followed by yet another storm if the SM issues the reregistration request. The fact the Mellanox HCAs do not even generate this event, is further evidence that on modern IB fabrics there will be no ill side effects from the proposed changes below to reduce the reaction by 3 kernel components to this event. So these changes should be benign for Mellanox IB fabrics and will benefit OPA fabrics while also making ib_core and ULP behavor "correct" as intended by the IBTA spec and kernel RDMA event APIs. Address these issues by removing IB_EVENT_SM_CHANGE handling from ipoib. IPoIB does not locally store sm_lid nor sm_sl, so it does not need to do anything on SM LID change. IPoIB makes use of other ib_core components to issue SA requests for it and those components correctly track SM LID and SM LID changes. Also in ib_core multicast handling, remove the test for IB_EVENT_SM_CHANGE. This code is moving all multicast groups to the error state, which will trigger rejoins. This code is used by IPoIB as well as the connection manager and other clients of multicast groups. This kernel module centralizes group membership status and joins since a node can only join a given group once but multiple ULPs or applications may want to join the same group. It makes use of the sa_query.c component in ib_core, which correctly trackes SM LID and SL. This component does not track SM LID nor SL itself and hence need not react to their changes. Similarly in the ib_core cache code remove the handling for the IB_EVENT_SM_CHANGE. In this function. The ib_cache_update function which is ultimately called is updating local copies of the pkey table, gid table and lmc. It does not update nor retain sm_lid nor sm_sl. As such it does not need to be called on an SM LID change. It technically also does not need to be called on a reregistration. The LID_CHANGE, PKEY_CHANGE, GID_CHANGE and port state change events (PORT_ERR, PORT_ACTICE) should be sufficient triggers. It is worth noting that the alternative of simply having the hfi1 and qib drivers not generate the SM LID change event was explored. While this would duplicate what Mellanox drivers do now, it is not the correct behavior and removes the ability for an SM to migrate without requiring reregistration. Since both opensm and OPA SM have mechanisms to backup or synchronize registration information, it is desirable to let them perform SM migrations (with LID or SL changes) without requiring reregistration when they deem it appropriate. Linux commit: ba7d8117f3cca8eb70d579fde3f9ec8cd6a28f39 Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit df1df0c742ec22de6ee7656a91ea8773c05f3b81) --- sys/ofed/drivers/infiniband/core/ib_multicast.c | 1 - 1 file changed, 1 deletion(-) diff --git a/sys/ofed/drivers/infiniband/core/ib_multicast.c b/sys/ofed/drivers/infiniband/core/ib_multicast.c index d81767bcd3a1..3784a3e5e290 100644 --- a/sys/ofed/drivers/infiniband/core/ib_multicast.c +++ b/sys/ofed/drivers/infiniband/core/ib_multicast.c @@ -800,7 +800,6 @@ static void mcast_event_handler(struct ib_event_handler *handler, switch (event->event) { case IB_EVENT_PORT_ERR: case IB_EVENT_LID_CHANGE: - case IB_EVENT_SM_CHANGE: case IB_EVENT_CLIENT_REREGISTER: mcast_groups_event(&dev->port[index], MCAST_GROUP_ERROR); break; From owner-dev-commits-src-all@freebsd.org Mon Jul 26 16:13: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 5F02066F65C; Mon, 26 Jul 2021 16:13: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 4GYQ2p2q4wz3pX0; Mon, 26 Jul 2021 16:13: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 9EE111A44B; Mon, 26 Jul 2021 16: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 16QGDaMs005664; Mon, 26 Jul 2021 16: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 16QGDa5Y005663; Mon, 26 Jul 2021 16:13:36 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:36 GMT Message-Id: <202107261613.16QGDa5Y005663@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 1753641a8b93 - stable/13 - ibcore: Define option to set ack timeout. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 1753641a8b93c625f65b4c5333b66db365eefe77 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, 26 Jul 2021 16:13:39 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=1753641a8b93c625f65b4c5333b66db365eefe77 commit 1753641a8b93c625f65b4c5333b66db365eefe77 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:47 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:31 +0000 ibcore: Define option to set ack timeout. Define new option in 'rdma_set_option' to override calculated QP timeout when requested to provide QP attributes to modify a QP. At the same time, pack tos_set to be bitfield. Linux commit: 2c1619edef61a03cb516efaa81750784c3071d10 Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 20fea7ac64683b064ffe4cefa750e46ba20de4f9) --- sys/ofed/drivers/infiniband/core/ib_cma.c | 34 ++++++++++++++++++++++++++++++ sys/ofed/drivers/infiniband/core/ib_ucma.c | 7 ++++++ sys/ofed/include/rdma/rdma_cm.h | 1 + sys/ofed/include/uapi/rdma/rdma_user_cm.h | 4 ++++ 4 files changed, 46 insertions(+) diff --git a/sys/ofed/drivers/infiniband/core/ib_cma.c b/sys/ofed/drivers/infiniband/core/ib_cma.c index bad4b311e112..586524ac88bb 100644 --- a/sys/ofed/drivers/infiniband/core/ib_cma.c +++ b/sys/ofed/drivers/infiniband/core/ib_cma.c @@ -336,8 +336,10 @@ struct rdma_id_private { u32 options; u8 srq; u8 tos; + u8 timeout_set:1; u8 reuseaddr; u8 afonly; + u8 timeout; enum ib_gid_type gid_type; }; @@ -775,6 +777,7 @@ struct rdma_cm_id *rdma_create_id(struct vnet *net, id_priv->id.event_handler = event_handler; id_priv->id.ps = ps; id_priv->id.qp_type = qp_type; + id_priv->timeout_set = false; spin_lock_init(&id_priv->lock); mutex_init(&id_priv->qp_mutex); init_completion(&id_priv->comp); @@ -1021,6 +1024,9 @@ int rdma_init_qp_attr(struct rdma_cm_id *id, struct ib_qp_attr *qp_attr, } else ret = -ENOSYS; + if ((*qp_attr_mask & IB_QP_TIMEOUT) && id_priv->timeout_set) + qp_attr->timeout = id_priv->timeout; + return ret; } EXPORT_SYMBOL(rdma_init_qp_attr); @@ -2495,6 +2501,34 @@ void rdma_set_service_type(struct rdma_cm_id *id, int tos) } EXPORT_SYMBOL(rdma_set_service_type); +/** + * rdma_set_ack_timeout() - Set the ack timeout of QP associated + * with a connection identifier. + * @id: Communication identifier to associated with service type. + * @timeout: Ack timeout to set a QP, expressed as 4.096 * 2^(timeout) usec. + * + * This function should be called before rdma_connect() on active side, + * and on passive side before rdma_accept(). It is applicable to primary + * path only. The timeout will affect the local side of the QP, it is not + * negotiated with remote side and zero disables the timer. + * + * Return: 0 for success + */ +int rdma_set_ack_timeout(struct rdma_cm_id *id, u8 timeout) +{ + struct rdma_id_private *id_priv; + + if (id->qp_type != IB_QPT_RC) + return -EINVAL; + + id_priv = container_of(id, struct rdma_id_private, id); + id_priv->timeout = timeout; + id_priv->timeout_set = true; + + return 0; +} +EXPORT_SYMBOL(rdma_set_ack_timeout); + static void cma_query_handler(int status, struct ib_sa_path_rec *path_rec, void *context) { diff --git a/sys/ofed/drivers/infiniband/core/ib_ucma.c b/sys/ofed/drivers/infiniband/core/ib_ucma.c index 5ea2845c0fe5..19e4a17836ee 100644 --- a/sys/ofed/drivers/infiniband/core/ib_ucma.c +++ b/sys/ofed/drivers/infiniband/core/ib_ucma.c @@ -1204,6 +1204,13 @@ static int ucma_set_option_id(struct ucma_context *ctx, int optname, } ret = rdma_set_afonly(ctx->cm_id, *((int *) optval) ? 1 : 0); break; + case RDMA_OPTION_ID_ACK_TIMEOUT: + if (optlen != sizeof(u8)) { + ret = -EINVAL; + break; + } + ret = rdma_set_ack_timeout(ctx->cm_id, *((u8 *)optval)); + break; default: ret = -ENOSYS; } diff --git a/sys/ofed/include/rdma/rdma_cm.h b/sys/ofed/include/rdma/rdma_cm.h index b5ed43426969..8b9b38601325 100644 --- a/sys/ofed/include/rdma/rdma_cm.h +++ b/sys/ofed/include/rdma/rdma_cm.h @@ -385,6 +385,7 @@ int rdma_set_reuseaddr(struct rdma_cm_id *id, int reuse); */ int rdma_set_afonly(struct rdma_cm_id *id, int afonly); +int rdma_set_ack_timeout(struct rdma_cm_id *id, u8 timeout); /** * rdma_get_service_id - Return the IB service ID for a specified address. * @id: Communication identifier associated with the address. diff --git a/sys/ofed/include/uapi/rdma/rdma_user_cm.h b/sys/ofed/include/uapi/rdma/rdma_user_cm.h index 7c6ade294835..d93bc9abfe90 100644 --- a/sys/ofed/include/uapi/rdma/rdma_user_cm.h +++ b/sys/ofed/include/uapi/rdma/rdma_user_cm.h @@ -296,6 +296,10 @@ enum { RDMA_OPTION_ID_TOS = 0, RDMA_OPTION_ID_REUSEADDR = 1, RDMA_OPTION_ID_AFONLY = 2, + RDMA_OPTION_ID_ACK_TIMEOUT = 3 +}; + +enum { RDMA_OPTION_IB_PATH = 1 }; From owner-dev-commits-src-all@freebsd.org Mon Jul 26 16:13: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 78DCC66F6F1; Mon, 26 Jul 2021 16:13: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 4GYQ2v51Zgz3pfk; Mon, 26 Jul 2021 16:13: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 2D3321A48D; Mon, 26 Jul 2021 16: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 16QGDfg3005762; Mon, 26 Jul 2021 16: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 16QGDfAb005761; Mon, 26 Jul 2021 16:13:41 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:41 GMT Message-Id: <202107261613.16QGDfAb005761@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 4c033941d0b9 - stable/13 - ibcore: Support rate limit for packet pacing 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 4c033941d0b9ddb78ab7cb9a0e8124f96df605f7 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, 26 Jul 2021 16:13:44 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=4c033941d0b9ddb78ab7cb9a0e8124f96df605f7 commit 4c033941d0b9ddb78ab7cb9a0e8124f96df605f7 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:49 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:31 +0000 ibcore: Support rate limit for packet pacing Add new member rate_limit to ib_qp_attr which holds the packet pacing rate in kbps, 0 means unlimited. IB_QP_RATE_LIMIT is added to ib_attr_mask and could be used by RAW QPs when changing QP state from RTR to RTS, RTS to RTS. Linux commit: 528e5a1bd3f0e9b760cb3a1062fce7513712a15d Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 0c13880cccd75655c878ce31e767bce04b1d6e85) --- sys/ofed/drivers/infiniband/core/ib_verbs.c | 2 ++ sys/ofed/include/rdma/ib_verbs.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/sys/ofed/drivers/infiniband/core/ib_verbs.c b/sys/ofed/drivers/infiniband/core/ib_verbs.c index 9e06d079af31..aabb416ddc21 100644 --- a/sys/ofed/drivers/infiniband/core/ib_verbs.c +++ b/sys/ofed/drivers/infiniband/core/ib_verbs.c @@ -1016,6 +1016,7 @@ static const struct { IB_QP_QKEY), [IB_QPT_GSI] = (IB_QP_CUR_STATE | IB_QP_QKEY), + [IB_QPT_RAW_PACKET] = IB_QP_RATE_LIMIT, } } }, @@ -1049,6 +1050,7 @@ static const struct { IB_QP_QKEY), [IB_QPT_GSI] = (IB_QP_CUR_STATE | IB_QP_QKEY), + [IB_QPT_RAW_PACKET] = IB_QP_RATE_LIMIT, } }, [IB_QPS_SQD] = { diff --git a/sys/ofed/include/rdma/ib_verbs.h b/sys/ofed/include/rdma/ib_verbs.h index b18aa2855166..cdbf2f5ce260 100644 --- a/sys/ofed/include/rdma/ib_verbs.h +++ b/sys/ofed/include/rdma/ib_verbs.h @@ -1132,6 +1132,7 @@ enum ib_qp_attr_mask { IB_QP_RESERVED2 = (1<<22), IB_QP_RESERVED3 = (1<<23), IB_QP_RESERVED4 = (1<<24), + IB_QP_RATE_LIMIT = (1<<25), }; enum ib_qp_state { @@ -1182,6 +1183,7 @@ struct ib_qp_attr { u8 rnr_retry; u8 alt_port_num; u8 alt_timeout; + u32 rate_limit; }; enum ib_wr_opcode { From owner-dev-commits-src-all@freebsd.org Mon Jul 26 16:13: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 5D6FA66F66E; Mon, 26 Jul 2021 16:13: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 4GYQ326ycgz3pXm; Mon, 26 Jul 2021 16:13: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 3107C1A233; Mon, 26 Jul 2021 16:13: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 16QGDn7S005943; Mon, 26 Jul 2021 16:13:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDnvk005942; Mon, 26 Jul 2021 16:13:49 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:49 GMT Message-Id: <202107261613.16QGDnvk005942@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: f52bc34a0635 - stable/13 - Fix LINT kernel build issues after c3987b8ea793c11f61fecb14ef93195a23e3522c . 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/stable/13 X-Git-Reftype: branch X-Git-Commit: f52bc34a0635c813080075f1d5383e03992e0ba4 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, 26 Jul 2021 16:13:53 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=f52bc34a0635c813080075f1d5383e03992e0ba4 commit f52bc34a0635c813080075f1d5383e03992e0ba4 Author: Hans Petter Selasky AuthorDate: 2021-07-12 15:47:15 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:32 +0000 Fix LINT kernel build issues after c3987b8ea793c11f61fecb14ef93195a23e3522c . Fixes the IPOIB_CM and SDP kernel options. Reported by: lwhsu @ Sponsored by: NVIDIA Networking (cherry picked from commit 693ddf4dc4b9c1ffbe6373e186e1b121e3635f53) --- sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c | 8 ++++---- sys/ofed/drivers/infiniband/ulp/sdp/sdp_rx.c | 2 +- sys/ofed/drivers/infiniband/ulp/sdp/sdp_tx.c | 5 +++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c index b61ebfd1495a..1e386a04d6d9 100644 --- a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c +++ b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c @@ -92,7 +92,7 @@ static void ipoib_cm_dma_unmap_rx(struct ipoib_dev_priv *priv, struct ipoib_cm_r static int ipoib_cm_post_receive_srq(struct ipoib_dev_priv *priv, int id) { - struct ib_recv_wr *bad_wr; + const struct ib_recv_wr *bad_wr; struct ipoib_rx_buf *rx_req; struct mbuf *m; int ret; @@ -124,7 +124,7 @@ static int ipoib_cm_post_receive_nonsrq(struct ipoib_dev_priv *priv, struct ib_sge *sge, int id) { struct ipoib_rx_buf *rx_req; - struct ib_recv_wr *bad_wr; + const struct ib_recv_wr *bad_wr; struct mbuf *m; int ret; int i; @@ -172,7 +172,7 @@ static void ipoib_cm_free_rx_ring(struct ipoib_dev_priv *priv, static void ipoib_cm_start_rx_drain(struct ipoib_dev_priv *priv) { - struct ib_send_wr *bad_wr; + const struct ib_send_wr *bad_wr; struct ipoib_cm_rx *p; /* We only reserved 1 extra slot in CQ for drain WRs, so @@ -600,7 +600,7 @@ static inline int post_send(struct ipoib_dev_priv *priv, struct ipoib_cm_tx_buf *tx_req, unsigned int wr_id) { - struct ib_send_wr *bad_wr; + const struct ib_send_wr *bad_wr; struct mbuf *mb = tx_req->mb; u64 *mapping = tx_req->mapping; struct mbuf *m; diff --git a/sys/ofed/drivers/infiniband/ulp/sdp/sdp_rx.c b/sys/ofed/drivers/infiniband/ulp/sdp/sdp_rx.c index bb56e1c4d7d1..e20602a8d87c 100644 --- a/sys/ofed/drivers/infiniband/ulp/sdp/sdp_rx.c +++ b/sys/ofed/drivers/infiniband/ulp/sdp/sdp_rx.c @@ -103,7 +103,7 @@ sdp_post_recv(struct sdp_sock *ssk) struct ib_recv_wr rx_wr = { NULL }; struct ib_sge ibsge[SDP_MAX_RECV_SGES]; struct ib_sge *sge = ibsge; - struct ib_recv_wr *bad_wr; + const struct ib_recv_wr *bad_wr; struct mbuf *mb, *m; struct sdp_bsdh *h; int id = ring_head(ssk->rx_ring); diff --git a/sys/ofed/drivers/infiniband/ulp/sdp/sdp_tx.c b/sys/ofed/drivers/infiniband/ulp/sdp/sdp_tx.c index 0d35759e4b71..64f42ed8d569 100644 --- a/sys/ofed/drivers/infiniband/ulp/sdp/sdp_tx.c +++ b/sys/ofed/drivers/infiniband/ulp/sdp/sdp_tx.c @@ -69,7 +69,7 @@ sdp_post_send(struct sdp_sock *ssk, struct mbuf *mb) struct sdp_bsdh *h; unsigned long mseq; struct ib_device *dev; - struct ib_send_wr *bad_wr; + const struct ib_send_wr *bad_wr; struct ib_sge ibsge[SDP_MAX_SEND_SGES]; struct ib_sge *sge; struct ib_send_wr tx_wr = { NULL }; @@ -390,7 +390,8 @@ void sdp_post_keepalive(struct sdp_sock *ssk) { int rc; - struct ib_send_wr wr, *bad_wr; + struct ib_send_wr wr; + const struct ib_send_wr *bad_wr; sdp_dbg(ssk->socket, "%s\n", __func__); From owner-dev-commits-src-all@freebsd.org Mon Jul 26 16:13: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 C39BD66F91C; Mon, 26 Jul 2021 16:13: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 4GYQ2y29JMz3pZB; Mon, 26 Jul 2021 16:13: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 5D4611A48E; Mon, 26 Jul 2021 16:13: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 16QGDhum005817; Mon, 26 Jul 2021 16:13:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDhch005816; Mon, 26 Jul 2021 16:13:43 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:43 GMT Message-Id: <202107261613.16QGDhch005816@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 11f42801533c - stable/13 - ibcore: Clean up INIT_UDATA() and INIT_UDATA_BUF_OR_NULL() macro usage. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 11f42801533ca9fd8cd261634fa050d679de79c9 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, 26 Jul 2021 16:13:48 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=11f42801533ca9fd8cd261634fa050d679de79c9 commit 11f42801533ca9fd8cd261634fa050d679de79c9 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:51 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:31 +0000 ibcore: Clean up INIT_UDATA() and INIT_UDATA_BUF_OR_NULL() macro usage. We get a harmless warning about the fact that we use the result of a multiplication as a condition in INIT_UDATA_BUF_OR_NULL(): uverbs_main.c: In function 'ib_uverbs_write': error: '*' in boolean context, suggest '&&' instead [-Werror=int-in-bool-context] This avoids the problem by using an inline function in place of the macro. After changing INIT_UDATA_BUF_OR_NULL() to an inline function, do the same change to INIT_UDATA() for consistency. Using an inline function gives us better type safety here among other issues with macros. I'm using u64_to_user_ptr() to convert the user pointer to simplify the logic rather than adding lots of new type casts. Linux commit: 12f727721eee61b3d19dedb95cb893b2baa9fe41 40a203396cc1c239f2e71c47c66ed03097123d2c Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 05f4691919d6d0219795a1ca8ad84dd82d87b1cf) --- sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c | 63 ++++++++++++----------- sys/ofed/drivers/infiniband/core/ib_uverbs_main.c | 7 +-- sys/ofed/drivers/infiniband/core/uverbs.h | 37 +++++++------ 3 files changed, 57 insertions(+), 50 deletions(-) diff --git a/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c b/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c index 46edd7b28580..dcc73dc5848e 100644 --- a/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c +++ b/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c @@ -339,8 +339,8 @@ ssize_t ib_uverbs_get_context(struct ib_uverbs_file *file, goto err; } - INIT_UDATA(&udata, buf + sizeof cmd, - (unsigned long) cmd.response + sizeof resp, + ib_uverbs_init_udata(&udata, buf + sizeof cmd, + u64_to_user_ptr(cmd.response + sizeof resp), in_len - sizeof cmd, out_len - sizeof resp); ucontext = ib_dev->alloc_ucontext(ib_dev, &udata); @@ -560,8 +560,8 @@ ssize_t ib_uverbs_alloc_pd(struct ib_uverbs_file *file, if (copy_from_user(&cmd, buf, sizeof cmd)) return -EFAULT; - INIT_UDATA(&udata, buf + sizeof cmd, - (unsigned long) cmd.response + sizeof resp, + ib_uverbs_init_udata(&udata, buf + sizeof cmd, + u64_to_user_ptr(cmd.response + sizeof resp), in_len - sizeof cmd, out_len - sizeof resp); uobj = kmalloc(sizeof *uobj, GFP_KERNEL); @@ -768,8 +768,8 @@ ssize_t ib_uverbs_open_xrcd(struct ib_uverbs_file *file, if (copy_from_user(&cmd, buf, sizeof cmd)) return -EFAULT; - INIT_UDATA(&udata, buf + sizeof cmd, - (unsigned long) cmd.response + sizeof resp, + ib_uverbs_init_udata(&udata, buf + sizeof cmd, + u64_to_user_ptr(cmd.response + sizeof resp), in_len - sizeof cmd, out_len - sizeof resp); mutex_lock(&file->device->xrcd_tree_mutex); @@ -978,8 +978,8 @@ ssize_t ib_uverbs_reg_mr(struct ib_uverbs_file *file, if (copy_from_user(&cmd, buf, sizeof cmd)) return -EFAULT; - INIT_UDATA(&udata, buf + sizeof cmd, - (unsigned long) cmd.response + sizeof resp, + ib_uverbs_init_udata(&udata, buf + sizeof cmd, + u64_to_user_ptr(cmd.response + sizeof resp), in_len - sizeof cmd, out_len - sizeof resp); if ((cmd.start & ~PAGE_MASK) != (cmd.hca_va & ~PAGE_MASK)) @@ -1085,8 +1085,8 @@ ssize_t ib_uverbs_rereg_mr(struct ib_uverbs_file *file, if (copy_from_user(&cmd, buf, sizeof(cmd))) return -EFAULT; - INIT_UDATA(&udata, buf + sizeof(cmd), - (unsigned long) cmd.response + sizeof(resp), + ib_uverbs_init_udata(&udata, buf + sizeof(cmd), + u64_to_user_ptr(cmd.response + sizeof(resp)), in_len - sizeof(cmd), out_len - sizeof(resp)); if (cmd.flags & ~IB_MR_REREG_SUPPORTED || !cmd.flags) @@ -1225,8 +1225,8 @@ ssize_t ib_uverbs_alloc_mw(struct ib_uverbs_file *file, goto err_free; } - INIT_UDATA(&udata, buf + sizeof(cmd), - (unsigned long)cmd.response + sizeof(resp), + ib_uverbs_init_udata(&udata, buf + sizeof(cmd), + u64_to_user_ptr(cmd.response + sizeof(resp)), in_len - sizeof(cmd) - sizeof(struct ib_uverbs_cmd_hdr), out_len - sizeof(resp)); @@ -1494,10 +1494,11 @@ ssize_t ib_uverbs_create_cq(struct ib_uverbs_file *file, if (copy_from_user(&cmd, buf, sizeof(cmd))) return -EFAULT; - INIT_UDATA(&ucore, buf, (unsigned long)cmd.response, sizeof(cmd), sizeof(resp)); + ib_uverbs_init_udata(&ucore, buf, + u64_to_user_ptr(cmd.response), sizeof(cmd), sizeof(resp)); - INIT_UDATA(&uhw, buf + sizeof(cmd), - (unsigned long)cmd.response + sizeof(resp), + ib_uverbs_init_udata(&uhw, buf + sizeof(cmd), + u64_to_user_ptr(cmd.response + sizeof(resp)), in_len - sizeof(cmd), out_len - sizeof(resp)); memset(&cmd_ex, 0, sizeof(cmd_ex)); @@ -1579,8 +1580,8 @@ ssize_t ib_uverbs_resize_cq(struct ib_uverbs_file *file, if (copy_from_user(&cmd, buf, sizeof cmd)) return -EFAULT; - INIT_UDATA(&udata, buf + sizeof cmd, - (unsigned long) cmd.response + sizeof resp, + ib_uverbs_init_udata(&udata, buf + sizeof cmd, + u64_to_user_ptr(cmd.response + sizeof resp), in_len - sizeof cmd, out_len - sizeof resp); cq = idr_read_cq(cmd.cq_handle, file->ucontext, 0); @@ -2050,10 +2051,10 @@ ssize_t ib_uverbs_create_qp(struct ib_uverbs_file *file, if (copy_from_user(&cmd, buf, sizeof(cmd))) return -EFAULT; - INIT_UDATA(&ucore, buf, (unsigned long)cmd.response, sizeof(cmd), - resp_size); - INIT_UDATA(&uhw, buf + sizeof(cmd), - (unsigned long)cmd.response + resp_size, + ib_uverbs_init_udata(&ucore, buf, + u64_to_user_ptr(cmd.response), sizeof(cmd), resp_size); + ib_uverbs_init_udata(&uhw, buf + sizeof(cmd), + u64_to_user_ptr(cmd.response + resp_size), in_len - sizeof(cmd) - sizeof(struct ib_uverbs_cmd_hdr), out_len - resp_size); @@ -2150,8 +2151,8 @@ ssize_t ib_uverbs_open_qp(struct ib_uverbs_file *file, if (copy_from_user(&cmd, buf, sizeof cmd)) return -EFAULT; - INIT_UDATA(&udata, buf + sizeof cmd, - (unsigned long) cmd.response + sizeof resp, + ib_uverbs_init_udata(&udata, buf + sizeof cmd, + u64_to_user_ptr(cmd.response + sizeof resp), in_len - sizeof cmd, out_len - sizeof resp); obj = kmalloc(sizeof *obj, GFP_KERNEL); @@ -2354,7 +2355,7 @@ ssize_t ib_uverbs_modify_qp(struct ib_uverbs_file *file, if (copy_from_user(&cmd, buf, sizeof cmd)) return -EFAULT; - INIT_UDATA(&udata, buf + sizeof cmd, NULL, in_len - sizeof cmd, + ib_uverbs_init_udata(&udata, buf + sizeof cmd, NULL, in_len - sizeof cmd, out_len); attr = kmalloc(sizeof *attr, GFP_KERNEL); @@ -2919,8 +2920,8 @@ ssize_t ib_uverbs_create_ah(struct ib_uverbs_file *file, if (!rdma_is_port_valid(ib_dev, cmd.attr.port_num)) return -EINVAL; - INIT_UDATA(&udata, buf + sizeof(cmd), - (unsigned long)cmd.response + sizeof(resp), + ib_uverbs_init_udata(&udata, buf + sizeof(cmd), + u64_to_user_ptr(cmd.response + sizeof(resp)), in_len - sizeof(cmd), out_len - sizeof(resp)); uobj = kmalloc(sizeof *uobj, GFP_KERNEL); @@ -4045,8 +4046,8 @@ ssize_t ib_uverbs_create_srq(struct ib_uverbs_file *file, xcmd.max_sge = cmd.max_sge; xcmd.srq_limit = cmd.srq_limit; - INIT_UDATA(&udata, buf + sizeof cmd, - (unsigned long) cmd.response + sizeof resp, + ib_uverbs_init_udata(&udata, buf + sizeof cmd, + u64_to_user_ptr(cmd.response + sizeof resp), in_len - sizeof cmd - sizeof(struct ib_uverbs_cmd_hdr), out_len - sizeof resp); @@ -4072,8 +4073,8 @@ ssize_t ib_uverbs_create_xsrq(struct ib_uverbs_file *file, if (copy_from_user(&cmd, buf, sizeof cmd)) return -EFAULT; - INIT_UDATA(&udata, buf + sizeof cmd, - (unsigned long) cmd.response + sizeof resp, + ib_uverbs_init_udata(&udata, buf + sizeof cmd, + u64_to_user_ptr(cmd.response + sizeof resp), in_len - sizeof cmd - sizeof(struct ib_uverbs_cmd_hdr), out_len - sizeof resp); @@ -4098,7 +4099,7 @@ ssize_t ib_uverbs_modify_srq(struct ib_uverbs_file *file, if (copy_from_user(&cmd, buf, sizeof cmd)) return -EFAULT; - INIT_UDATA(&udata, buf + sizeof cmd, NULL, in_len - sizeof cmd, + ib_uverbs_init_udata(&udata, buf + sizeof cmd, NULL, in_len - sizeof cmd, out_len); srq = idr_read_srq(cmd.srq_handle, file->ucontext); diff --git a/sys/ofed/drivers/infiniband/core/ib_uverbs_main.c b/sys/ofed/drivers/infiniband/core/ib_uverbs_main.c index e1b560774fbc..dff566e71f99 100644 --- a/sys/ofed/drivers/infiniband/core/ib_uverbs_main.c +++ b/sys/ofed/drivers/infiniband/core/ib_uverbs_main.c @@ -868,12 +868,13 @@ static ssize_t ib_uverbs_write(struct file *filp, const char __user *buf, } } - INIT_UDATA_BUF_OR_NULL(&ucore, buf, (unsigned long) ex_hdr.response, + ib_uverbs_init_udata_buf_or_null(&ucore, buf, + u64_to_user_ptr(ex_hdr.response), hdr.in_words * 8, hdr.out_words * 8); - INIT_UDATA_BUF_OR_NULL(&uhw, + ib_uverbs_init_udata_buf_or_null(&uhw, buf + ucore.inlen, - (unsigned long) ex_hdr.response + ucore.outlen, + u64_to_user_ptr(ex_hdr.response + ucore.outlen), ex_hdr.provider_in_words * 8, ex_hdr.provider_out_words * 8); diff --git a/sys/ofed/drivers/infiniband/core/uverbs.h b/sys/ofed/drivers/infiniband/core/uverbs.h index 0db0d47cc691..9f2a519fa259 100644 --- a/sys/ofed/drivers/infiniband/core/uverbs.h +++ b/sys/ofed/drivers/infiniband/core/uverbs.h @@ -54,23 +54,28 @@ #include #include -#define INIT_UDATA(udata, ibuf, obuf, ilen, olen) \ - do { \ - (udata)->inbuf = (const void __user *) (ibuf); \ - (udata)->outbuf = (void __user *) (obuf); \ - (udata)->inlen = (ilen); \ - (udata)->outlen = (olen); \ - } while (0) +static inline void +ib_uverbs_init_udata(struct ib_udata *udata, + const void __user *ibuf, + void __user *obuf, + size_t ilen, size_t olen) +{ + udata->inbuf = ibuf; + udata->outbuf = obuf; + udata->inlen = ilen; + udata->outlen = olen; +} -#define INIT_UDATA_BUF_OR_NULL(udata, ibuf, obuf, ilen, olen) \ - do { \ - (udata)->inbuf = ((ilen) != 0) ? \ - (const void __user *) (ibuf) : NULL; \ - (udata)->outbuf = ((olen) != 0) ? \ - (void __user *) (obuf) : NULL; \ - (udata)->inlen = (ilen); \ - (udata)->outlen = (olen); \ - } while (0) +static inline void +ib_uverbs_init_udata_buf_or_null(struct ib_udata *udata, + const void __user *ibuf, + void __user *obuf, + size_t ilen, size_t olen) +{ + ib_uverbs_init_udata(udata, + ilen ? ibuf : NULL, olen ? obuf : NULL, + ilen, olen); +} /* * Our lifetime rules for these structs are the following: From owner-dev-commits-src-all@freebsd.org Mon Jul 26 16:13: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 AD60766F91B; Mon, 26 Jul 2021 16:13: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 4GYQ2x3ztpz3pnc; Mon, 26 Jul 2021 16:13: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 891E51A48F; Mon, 26 Jul 2021 16:13: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 16QGDijR005841; Mon, 26 Jul 2021 16:13:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDixw005840; Mon, 26 Jul 2021 16:13:44 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:44 GMT Message-Id: <202107261613.16QGDixw005840@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: ee9aeb312c4c - stable/13 - ibcore: Implement ib_uverbs_get_ucontext_file(). 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/stable/13 X-Git-Reftype: branch X-Git-Commit: ee9aeb312c4c5fd58e4ae15567c87d9b04990f89 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, 26 Jul 2021 16:13:48 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=ee9aeb312c4c5fd58e4ae15567c87d9b04990f89 commit ee9aeb312c4c5fd58e4ae15567c87d9b04990f89 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:51 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:31 +0000 ibcore: Implement ib_uverbs_get_ucontext_file(). Expose ib_ucontext from a given ib_uverbs_file. Drivers that use the ioctl(9) API may have the ib_uverbs_file and need a way to get the related ib_ucontext from it, this is enabled by this patch. Downstream patches from this series will use it. Linux commit: 7dc08dcfc8c86cb4457e383734ff6844ddaff876 Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 79b817084ca891e465fe1a868ef1d9f1a3f33a69) --- sys/ofed/drivers/infiniband/core/ib_uverbs_main.c | 24 +++++++++++++++++++++++ sys/ofed/include/rdma/ib_verbs.h | 3 +++ 2 files changed, 27 insertions(+) diff --git a/sys/ofed/drivers/infiniband/core/ib_uverbs_main.c b/sys/ofed/drivers/infiniband/core/ib_uverbs_main.c index dff566e71f99..38016681b819 100644 --- a/sys/ofed/drivers/infiniband/core/ib_uverbs_main.c +++ b/sys/ofed/drivers/infiniband/core/ib_uverbs_main.c @@ -146,6 +146,30 @@ static int (*uverbs_ex_cmd_table[])(struct ib_uverbs_file *file, static void ib_uverbs_add_one(struct ib_device *device); static void ib_uverbs_remove_one(struct ib_device *device, void *client_data); +/* + * Must be called with the ufile->device->disassociate_srcu held, and the lock + * must be held until use of the ucontext is finished. + */ +struct ib_ucontext *ib_uverbs_get_ucontext_file(struct ib_uverbs_file *ufile) +{ + /* + * We do not hold the hw_destroy_rwsem lock for this flow, instead + * srcu is used. It does not matter if someone races this with + * get_context, we get NULL or valid ucontext. + */ + struct ib_ucontext *ucontext = READ_ONCE(ufile->ucontext); + + if (!srcu_dereference(ufile->device->ib_dev, + &ufile->device->disassociate_srcu)) + return ERR_PTR(-EIO); + + if (!ucontext) + return ERR_PTR(-EINVAL); + + return ucontext; +} +EXPORT_SYMBOL(ib_uverbs_get_ucontext_file); + int uverbs_dealloc_mw(struct ib_mw *mw) { struct ib_pd *pd = mw->pd; diff --git a/sys/ofed/include/rdma/ib_verbs.h b/sys/ofed/include/rdma/ib_verbs.h index 353181a8d790..da17bc9f8250 100644 --- a/sys/ofed/include/rdma/ib_verbs.h +++ b/sys/ofed/include/rdma/ib_verbs.h @@ -67,6 +67,7 @@ struct ifla_vf_info; struct ifla_vf_stats; +struct ib_uverbs_file; extern struct workqueue_struct *ib_wq; extern struct workqueue_struct *ib_comp_wq; @@ -3390,6 +3391,8 @@ void ib_drain_rq(struct ib_qp *qp); void ib_drain_sq(struct ib_qp *qp); void ib_drain_qp(struct ib_qp *qp); +struct ib_ucontext *ib_uverbs_get_ucontext_file(struct ib_uverbs_file *ufile); + int ib_resolve_eth_dmac(struct ib_device *device, struct ib_ah_attr *ah_attr); #endif /* IB_VERBS_H */ From owner-dev-commits-src-all@freebsd.org Mon Jul 26 16: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 D9A1E66F6D2; Mon, 26 Jul 2021 16: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 4GYQ2k0pSkz3pfL; Mon, 26 Jul 2021 16: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 3B50A1A44A; Mon, 26 Jul 2021 16: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 16QGDX4D005588; Mon, 26 Jul 2021 16: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 16QGDXr0005587; Mon, 26 Jul 2021 16:13:33 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:33 GMT Message-Id: <202107261613.16QGDXr0005587@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 36f60545aac6 - stable/13 - ibcore: Fix use-after-free in IB mad completion handling. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 36f60545aac67a3ee290bca78aa102c41f7d57c7 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, 26 Jul 2021 16:13:37 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=36f60545aac67a3ee290bca78aa102c41f7d57c7 commit 36f60545aac67a3ee290bca78aa102c41f7d57c7 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:44 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:30 +0000 ibcore: Fix use-after-free in IB mad completion handling. We encountered a use-after-free bug when unloading the driver: BUG: KASAN: use-after-free in ib_mad_post_receive_mads+0xddc/0xed0 [ib_core] Read of size 4 at addr ffff8882ca5aa868 by task kworker/u13:2/23862 Workqueue: ib-comp-unb-wq ib_cq_poll_work [ib_core] Call Trace: dump_stack+0x9a/0xeb print_address_description+0xe3/0x2e0 ib_mad_post_receive_mads+0xddc/0xed0 [ib_core] __kasan_report+0x15c/0x1df ib_mad_post_receive_mads+0xddc/0xed0 [ib_core] kasan_report+0xe/0x20 ib_mad_post_receive_mads+0xddc/0xed0 [ib_core] find_mad_agent+0xa00/0xa00 [ib_core] qlist_free_all+0x51/0xb0 mlx4_ib_sqp_comp_worker+0x1970/0x1970 [mlx4_ib] quarantine_reduce+0x1fa/0x270 kasan_unpoison_shadow+0x30/0x40 ib_mad_recv_done+0xdf6/0x3000 [ib_core] _raw_spin_unlock_irqrestore+0x46/0x70 ib_mad_send_done+0x1810/0x1810 [ib_core] mlx4_ib_destroy_cq+0x2a0/0x2a0 [mlx4_ib] _raw_spin_unlock_irqrestore+0x46/0x70 debug_object_deactivate+0x2b9/0x4a0 __ib_process_cq+0xe2/0x1d0 [ib_core] ib_cq_poll_work+0x45/0xf0 [ib_core] process_one_work+0x90c/0x1860 pwq_dec_nr_in_flight+0x320/0x320 worker_thread+0x87/0xbb0 __kthread_parkme+0xb6/0x180 process_one_work+0x1860/0x1860 kthread+0x320/0x3e0 kthread_park+0x120/0x120 ret_from_fork+0x24/0x30 ... Freed by task 31682: save_stack+0x19/0x80 __kasan_slab_free+0x11d/0x160 kfree+0xf5/0x2f0 ib_mad_port_close+0x200/0x380 [ib_core] ib_mad_remove_device+0xf0/0x230 [ib_core] remove_client_context+0xa6/0xe0 [ib_core] disable_device+0x14e/0x260 [ib_core] __ib_unregister_device+0x79/0x150 [ib_core] ib_unregister_device+0x21/0x30 [ib_core] mlx4_ib_remove+0x162/0x690 [mlx4_ib] mlx4_remove_device+0x204/0x2c0 [mlx4_core] mlx4_unregister_interface+0x49/0x1d0 [mlx4_core] mlx4_ib_cleanup+0xc/0x1d [mlx4_ib] __x64_sys_delete_module+0x2d2/0x400 do_syscall_64+0x95/0x470 entry_SYSCALL_64_after_hwframe+0x49/0xbe The problem was that the MAD PD was deallocated before the MAD CQ. There was completion work pending for the CQ when the PD got deallocated. When the mad completion handling reached procedure ib_mad_post_receive_mads(), we got a use-after-free bug in the following line of code in that procedure: sg_list.lkey = qp_info->port_priv->pd->local_dma_lkey; (the pd pointer in the above line is no longer valid, because the pd has been deallocated). We fix this by allocating the PD before the CQ in procedure ib_mad_port_open(), and deallocating the PD after freeing the CQ in procedure ib_mad_port_close(). Since the CQ completion work queue is flushed during ib_free_cq(), no completions will be pending for that CQ when the PD is later deallocated. Note that freeing the CQ before deallocating the PD is the practice in the ULPs. Linux commit: 770b7d96cfff6a8bf6c9f261ba6f135dc9edf484 Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 468a6b5055f0b6ea0bdb1ee8cbdf749204cb3b25) --- sys/ofed/drivers/infiniband/core/ib_mad.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/sys/ofed/drivers/infiniband/core/ib_mad.c b/sys/ofed/drivers/infiniband/core/ib_mad.c index 2f14535688aa..b9f45ff5e41d 100644 --- a/sys/ofed/drivers/infiniband/core/ib_mad.c +++ b/sys/ofed/drivers/infiniband/core/ib_mad.c @@ -3146,10 +3146,8 @@ static int ib_mad_port_open(struct ib_device *device, /* Create new device info */ port_priv = kzalloc(sizeof *port_priv, GFP_KERNEL); - if (!port_priv) { - dev_err(&device->dev, "No memory for ib_mad_port_private\n"); + if (!port_priv) return -ENOMEM; - } port_priv->device = device; port_priv->port_num = port_num; @@ -3163,18 +3161,18 @@ static int ib_mad_port_open(struct ib_device *device, if (has_smi) cq_size *= 2; + port_priv->pd = ib_alloc_pd(device, 0); + if (IS_ERR(port_priv->pd)) { + dev_err(&device->dev, "Couldn't create ib_mad PD\n"); + ret = PTR_ERR(port_priv->pd); + goto error3; + } + port_priv->cq = ib_alloc_cq(port_priv->device, port_priv, cq_size, 0, IB_POLL_WORKQUEUE); if (IS_ERR(port_priv->cq)) { dev_err(&device->dev, "Couldn't create ib_mad CQ\n"); ret = PTR_ERR(port_priv->cq); - goto error3; - } - - port_priv->pd = ib_alloc_pd(device, 0); - if (IS_ERR(port_priv->pd)) { - dev_err(&device->dev, "Couldn't create ib_mad PD\n"); - ret = PTR_ERR(port_priv->pd); goto error4; } @@ -3217,11 +3215,11 @@ error8: error7: destroy_mad_qp(&port_priv->qp_info[0]); error6: - ib_dealloc_pd(port_priv->pd); -error4: ib_free_cq(port_priv->cq); cleanup_recv_queue(&port_priv->qp_info[1]); cleanup_recv_queue(&port_priv->qp_info[0]); +error4: + ib_dealloc_pd(port_priv->pd); error3: kfree(port_priv); @@ -3251,8 +3249,8 @@ static int ib_mad_port_close(struct ib_device *device, int port_num) destroy_workqueue(port_priv->wq); destroy_mad_qp(&port_priv->qp_info[1]); destroy_mad_qp(&port_priv->qp_info[0]); - ib_dealloc_pd(port_priv->pd); ib_free_cq(port_priv->cq); + ib_dealloc_pd(port_priv->pd); cleanup_recv_queue(&port_priv->qp_info[1]); cleanup_recv_queue(&port_priv->qp_info[0]); /* XXX: Handle deallocation of MAD registration tables */ From owner-dev-commits-src-all@freebsd.org Mon Jul 26 16:13: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 8963966F672; Mon, 26 Jul 2021 16:13: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 4GYQ3856Szz3pgN; Mon, 26 Jul 2021 16:13: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 A35761A237; Mon, 26 Jul 2021 16:13: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 16QGDraZ006039; Mon, 26 Jul 2021 16:13:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDrLB006038; Mon, 26 Jul 2021 16:13:53 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:53 GMT Message-Id: <202107261613.16QGDrLB006038@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: c41403c5cae2 - stable/13 - mlx5en: Check for pci_channel_offline() when draining sendqueue. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: c41403c5cae251f0a531c3d3491a1401368c5cfd 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, 26 Jul 2021 16:13:57 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=c41403c5cae251f0a531c3d3491a1401368c5cfd commit c41403c5cae251f0a531c3d3491a1401368c5cfd Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:56 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:32 +0000 mlx5en: Check for pci_channel_offline() when draining sendqueue. This speeds up detach in hypervisor environments. Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 4692d9808e61958675d91ec595b5732c8d1fa700) --- sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index fc9ffc01a0df..97438de3bc2a 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -1875,7 +1875,8 @@ mlx5e_drain_sq(struct mlx5e_sq *sq) mtx_lock(&sq->lock); while (sq->cc != sq->pc && (sq->priv->media_status_last & IFM_ACTIVE) != 0 && - mdev->state != MLX5_DEVICE_STATE_INTERNAL_ERROR) { + mdev->state != MLX5_DEVICE_STATE_INTERNAL_ERROR && + pci_channel_offline(mdev->pdev) == 0) { mtx_unlock(&sq->lock); msleep(1); sq->cq.mcq.comp(&sq->cq.mcq, NULL); @@ -1893,7 +1894,8 @@ mlx5e_drain_sq(struct mlx5e_sq *sq) /* wait till SQ is empty */ mtx_lock(&sq->lock); while (sq->cc != sq->pc && - mdev->state != MLX5_DEVICE_STATE_INTERNAL_ERROR) { + mdev->state != MLX5_DEVICE_STATE_INTERNAL_ERROR && + pci_channel_offline(mdev->pdev) == 0) { mtx_unlock(&sq->lock); msleep(1); sq->cq.mcq.comp(&sq->cq.mcq, NULL); From owner-dev-commits-src-all@freebsd.org Mon Jul 26 16:13: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 030B266F73A; Mon, 26 Jul 2021 16:13: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 4GYQ351FDdz3pcv; Mon, 26 Jul 2021 16:13: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 642811A235; Mon, 26 Jul 2021 16:13: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 16QGDpTJ005991; Mon, 26 Jul 2021 16:13:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDp2I005990; Mon, 26 Jul 2021 16:13:51 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:51 GMT Message-Id: <202107261613.16QGDp2I005990@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 526c54f54b50 - stable/13 - mlx5ib: Extend parameter macros so that more arguments may be added. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 526c54f54b5073b896bc65538336f4aa163d3f7e 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, 26 Jul 2021 16:13:54 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=526c54f54b5073b896bc65538336f4aa163d3f7e commit 526c54f54b5073b896bc65538336f4aa163d3f7e Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:55 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:32 +0000 mlx5ib: Extend parameter macros so that more arguments may be added. Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 42f719d611413f3bf9c7914e008fe22c916e1ac5) --- sys/dev/mlx5/mlx5_ib/mlx5_ib.h | 62 +++++++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib.h b/sys/dev/mlx5/mlx5_ib/mlx5_ib.h index 695b1ab14948..0ac5368ca3b2 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib.h +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib.h @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2015, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2013-2020, Mellanox Technologies, Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -637,44 +637,44 @@ struct mlx5_roce { atomic_t next_port; }; -#define MLX5_IB_STATS_COUNT(a,b,c,d) a -#define MLX5_IB_STATS_VAR(a,b,c,d) b; -#define MLX5_IB_STATS_DESC(a,b,c,d) c, d, +#define MLX5_IB_STATS_COUNT(a,...) a +#define MLX5_IB_STATS_VAR(a,b,c,...) b c; +#define MLX5_IB_STATS_DESC(a,b,c,d,e,...) d, e, #define MLX5_IB_CONG_PARAMS(m) \ /* ECN RP */ \ - m(+1, u64 rp_clamp_tgt_rate, "rp_clamp_tgt_rate", "If set, whenever a CNP is processed, the target rate is updated to be the current rate") \ - m(+1, u64 rp_clamp_tgt_rate_ati, "rp_clamp_tgt_rate_ati", "If set, when receiving a CNP, the target rate should be updated if the transission rate was increased due to the timer, and not only due to the byte counter") \ - m(+1, u64 rp_time_reset, "rp_time_reset", "Time in microseconds between rate increases if no CNPs are received") \ - m(+1, u64 rp_byte_reset, "rp_byte_reset", "Transmitted data in bytes between rate increases if no CNP's are received. A value of zero means disabled.") \ - m(+1, u64 rp_threshold, "rp_threshold", "The number of times rpByteStage or rpTimeStage can count before the RP rate control state machine advances states") \ - m(+1, u64 rp_ai_rate, "rp_ai_rate", "The rate, in Mbits per second, used to increase rpTargetRate in the active increase state") \ - m(+1, u64 rp_hai_rate, "rp_hai_rate", "The rate, in Mbits per second, used to increase rpTargetRate in the hyper increase state") \ - m(+1, u64 rp_min_dec_fac, "rp_min_dec_fac", "The minimum factor by which the current transmit rate can be changed when processing a CNP. Value is given as a percentage, [1 .. 100]") \ - m(+1, u64 rp_min_rate, "rp_min_rate", "The minimum value, in Mbps per second, for rate to limit") \ - m(+1, u64 rp_rate_to_set_on_first_cnp, "rp_rate_to_set_on_first_cnp", "The rate that is set for the flow when a rate limiter is allocated to it upon first CNP received, in Mbps. A value of zero means use full port speed") \ - m(+1, u64 rp_dce_tcp_g, "rp_dce_tcp_g", "Used to update the congestion estimator, alpha, once every dce_tcp_rtt once every dce_tcp_rtt microseconds") \ - m(+1, u64 rp_dce_tcp_rtt, "rp_dce_tcp_rtt", "The time between updates of the aolpha value, in microseconds") \ - m(+1, u64 rp_rate_reduce_monitor_period, "rp_rate_reduce_monitor_period", "The minimum time between two consecutive rate reductions for a single flow") \ - m(+1, u64 rp_initial_alpha_value, "rp_initial_alpha_value", "The initial value of alpha to use when receiving the first CNP for a flow") \ - m(+1, u64 rp_gd, "rp_gd", "If a CNP is received, the flow rate is reduced at the beginning of the next rate_reduce_monitor_period interval") \ + m(+1, u64, rp_clamp_tgt_rate, "rp_clamp_tgt_rate", "If set, whenever a CNP is processed, the target rate is updated to be the current rate") \ + m(+1, u64, rp_clamp_tgt_rate_ati, "rp_clamp_tgt_rate_ati", "If set, when receiving a CNP, the target rate should be updated if the transission rate was increased due to the timer, and not only due to the byte counter") \ + m(+1, u64, rp_time_reset, "rp_time_reset", "Time in microseconds between rate increases if no CNPs are received") \ + m(+1, u64, rp_byte_reset, "rp_byte_reset", "Transmitted data in bytes between rate increases if no CNP's are received. A value of zero means disabled.") \ + m(+1, u64, rp_threshold, "rp_threshold", "The number of times rpByteStage or rpTimeStage can count before the RP rate control state machine advances states") \ + m(+1, u64, rp_ai_rate, "rp_ai_rate", "The rate, in Mbits per second, used to increase rpTargetRate in the active increase state") \ + m(+1, u64, rp_hai_rate, "rp_hai_rate", "The rate, in Mbits per second, used to increase rpTargetRate in the hyper increase state") \ + m(+1, u64, rp_min_dec_fac, "rp_min_dec_fac", "The minimum factor by which the current transmit rate can be changed when processing a CNP. Value is given as a percentage, [1 .. 100]") \ + m(+1, u64, rp_min_rate, "rp_min_rate", "The minimum value, in Mbps per second, for rate to limit") \ + m(+1, u64, rp_rate_to_set_on_first_cnp, "rp_rate_to_set_on_first_cnp", "The rate that is set for the flow when a rate limiter is allocated to it upon first CNP received, in Mbps. A value of zero means use full port speed") \ + m(+1, u64, rp_dce_tcp_g, "rp_dce_tcp_g", "Used to update the congestion estimator, alpha, once every dce_tcp_rtt once every dce_tcp_rtt microseconds") \ + m(+1, u64, rp_dce_tcp_rtt, "rp_dce_tcp_rtt", "The time between updates of the aolpha value, in microseconds") \ + m(+1, u64, rp_rate_reduce_monitor_period, "rp_rate_reduce_monitor_period", "The minimum time between two consecutive rate reductions for a single flow") \ + m(+1, u64, rp_initial_alpha_value, "rp_initial_alpha_value", "The initial value of alpha to use when receiving the first CNP for a flow") \ + m(+1, u64, rp_gd, "rp_gd", "If a CNP is received, the flow rate is reduced at the beginning of the next rate_reduce_monitor_period interval") \ /* ECN NP */ \ - m(+1, u64 np_cnp_dscp, "np_cnp_dscp", "The DiffServ Code Point of the generated CNP for this port") \ - m(+1, u64 np_cnp_prio_mode, "np_cnp_prio_mode", "The 802.1p priority value of the generated CNP for this port") \ - m(+1, u64 np_cnp_prio, "np_cnp_prio", "The 802.1p priority value of the generated CNP for this port") + m(+1, u64, np_cnp_dscp, "np_cnp_dscp", "The DiffServ Code Point of the generated CNP for this port") \ + m(+1, u64, np_cnp_prio_mode, "np_cnp_prio_mode", "The 802.1p priority value of the generated CNP for this port") \ + m(+1, u64, np_cnp_prio, "np_cnp_prio", "The 802.1p priority value of the generated CNP for this port") #define MLX5_IB_CONG_PARAMS_NUM (0 MLX5_IB_CONG_PARAMS(MLX5_IB_STATS_COUNT)) #define MLX5_IB_CONG_STATS(m) \ - m(+1, u64 syndrome, "syndrome", "Syndrome number") \ - m(+1, u64 rp_cur_flows, "rp_cur_flows", "Number of flows limited") \ - m(+1, u64 sum_flows, "sum_flows", "Sum of the number of flows limited over time") \ - m(+1, u64 rp_cnp_ignored, "rp_cnp_ignored", "Number of CNPs and CNMs ignored") \ - m(+1, u64 rp_cnp_handled, "rp_cnp_handled", "Number of CNPs and CNMs successfully handled") \ - m(+1, u64 time_stamp, "time_stamp", "Time stamp in microseconds") \ - m(+1, u64 accumulators_period, "accumulators_period", "The value of X variable for accumulating counters") \ - m(+1, u64 np_ecn_marked_roce_packets, "np_ecn_marked_roce_packets", "Number of ECN marked packets seen") \ - m(+1, u64 np_cnp_sent, "np_cnp_sent", "Number of CNPs sent") + m(+1, u64, syndrome, "syndrome", "Syndrome number") \ + m(+1, u64, rp_cur_flows, "rp_cur_flows", "Number of flows limited") \ + m(+1, u64, sum_flows, "sum_flows", "Sum of the number of flows limited over time") \ + m(+1, u64, rp_cnp_ignored, "rp_cnp_ignored", "Number of CNPs and CNMs ignored") \ + m(+1, u64, rp_cnp_handled, "rp_cnp_handled", "Number of CNPs and CNMs successfully handled") \ + m(+1, u64, time_stamp, "time_stamp", "Time stamp in microseconds") \ + m(+1, u64, accumulators_period, "accumulators_period", "The value of X variable for accumulating counters") \ + m(+1, u64, np_ecn_marked_roce_packets, "np_ecn_marked_roce_packets", "Number of ECN marked packets seen") \ + m(+1, u64, np_cnp_sent, "np_cnp_sent", "Number of CNPs sent") #define MLX5_IB_CONG_STATS_NUM (0 MLX5_IB_CONG_STATS(MLX5_IB_STATS_COUNT)) From owner-dev-commits-src-all@freebsd.org Mon Jul 26 16:13: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 4FAA966F987; Mon, 26 Jul 2021 16:13: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 4GYQ395JJyz3pZp; Mon, 26 Jul 2021 16:13: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 B90311A238; Mon, 26 Jul 2021 16:13: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 16QGDsB5006069; Mon, 26 Jul 2021 16:13:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDsIY006068; Mon, 26 Jul 2021 16:13:54 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:54 GMT Message-Id: <202107261613.16QGDsIY006068@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 1554e2673b3b - stable/13 - mlx5en: Configure relaxed PCI read and write ordering for ethernet. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 1554e2673b3b79f467fb8cdfcbbee3c73c090147 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, 26 Jul 2021 16:13:58 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=1554e2673b3b79f467fb8cdfcbbee3c73c090147 commit 1554e2673b3b79f467fb8cdfcbbee3c73c090147 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:57 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:32 +0000 mlx5en: Configure relaxed PCI read and write ordering for ethernet. This may improve performance in some configurations. Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit de2437f19950f6758159abbde93200468d1327fa) --- sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 14 +++++++++++++- sys/dev/mlx5/mlx5_ifc.h | 12 ++++++++---- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index 97438de3bc2a..02417f5f931c 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -3707,6 +3707,18 @@ mlx5e_build_ifp_priv(struct mlx5_core_dev *mdev, return (0); } +static void +mlx5e_mkey_set_relaxed_ordering(struct mlx5_core_dev *mdev, void *mkc) +{ + bool ro_pci_enable = + pci_get_relaxed_ordering_enabled(mdev->pdev->dev.bsddev); + bool ro_write = MLX5_CAP_GEN(mdev, relaxed_ordering_write); + bool ro_read = MLX5_CAP_GEN(mdev, relaxed_ordering_read); + + MLX5_SET(mkc, mkc, relaxed_ordering_read, ro_pci_enable && ro_read); + MLX5_SET(mkc, mkc, relaxed_ordering_write, ro_pci_enable && ro_write); +} + static int mlx5e_create_mkey(struct mlx5e_priv *priv, u32 pdn, struct mlx5_core_mr *mkey) @@ -3729,7 +3741,7 @@ mlx5e_create_mkey(struct mlx5e_priv *priv, u32 pdn, MLX5_SET(mkc, mkc, umr_en, 1); /* used by HW TLS */ MLX5_SET(mkc, mkc, lw, 1); MLX5_SET(mkc, mkc, lr, 1); - + mlx5e_mkey_set_relaxed_ordering(mdev, mkc); MLX5_SET(mkc, mkc, pd, pdn); MLX5_SET(mkc, mkc, length64, 1); MLX5_SET(mkc, mkc, qpn, 0xffffff); diff --git a/sys/dev/mlx5/mlx5_ifc.h b/sys/dev/mlx5/mlx5_ifc.h index ce8074fba3f1..d44927236f74 100644 --- a/sys/dev/mlx5/mlx5_ifc.h +++ b/sys/dev/mlx5/mlx5_ifc.h @@ -1069,12 +1069,14 @@ struct mlx5_ifc_cmd_hca_cap_bits { u8 reserved_4[0x8]; u8 log_max_cq_sz[0x8]; - u8 reserved_5[0xb]; + u8 relaxed_ordering_write_umr[0x1]; + u8 relaxed_ordering_read_umr[0x1]; + u8 reserved_5[0x9]; u8 log_max_cq[0x5]; u8 log_max_eq_sz[0x8]; - u8 relaxed_ordering_write[1]; - u8 reserved_6[0x1]; + u8 relaxed_ordering_write[0x1]; + u8 relaxed_ordering_read[0x1]; u8 log_max_mkey[0x6]; u8 reserved_7[0xb]; u8 fast_teardown[0x1]; @@ -2685,7 +2687,9 @@ struct mlx5_ifc_mkc_bits { u8 translations_octword_size[0x20]; - u8 reserved_7[0x1b]; + u8 reserved_at_1c0[0x19]; + u8 relaxed_ordering_read[0x1]; + u8 reserved_at_1d9[0x1]; u8 log_page_size[0x5]; u8 reserved_8[0x20]; From owner-dev-commits-src-all@freebsd.org Mon Jul 26 16:13: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 750A666F736; Mon, 26 Jul 2021 16:13: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 4GYQ326w3Qz3pjl; Mon, 26 Jul 2021 16:13: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 3501F1A490; Mon, 26 Jul 2021 16:13: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 16QGDoJJ005967; Mon, 26 Jul 2021 16:13:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDoVL005966; Mon, 26 Jul 2021 16:13:50 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:50 GMT Message-Id: <202107261613.16QGDoVL005966@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 75b63f08d2e8 - stable/13 - mlx5core: Don't query the PCI config space for offline during a firmware command. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 75b63f08d2e849c8639f0990f1e1794136b7050d 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, 26 Jul 2021 16:13:53 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=75b63f08d2e849c8639f0990f1e1794136b7050d commit 75b63f08d2e849c8639f0990f1e1794136b7050d Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:54 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:32 +0000 mlx5core: Don't query the PCI config space for offline during a firmware command. Querying the PCI config space for offline for every firmware command blocks the PCI bus and affects performance. Especially for packet pacing and TLS when objects are frequently created and destroyed. Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit e787b5acb1bdf97fc04ec3ebebb7a8dd40d85199) --- sys/dev/mlx5/mlx5_core/mlx5_cmd.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sys/dev/mlx5/mlx5_core/mlx5_cmd.c b/sys/dev/mlx5/mlx5_core/mlx5_cmd.c index 0bc5f92e3b02..c6cc3fee8c43 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_cmd.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_cmd.c @@ -1287,8 +1287,7 @@ static int cmd_exec_helper(struct mlx5_core_dev *dev, u8 status = 0; u32 drv_synd; - if (pci_channel_offline(dev->pdev) || - dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) { + if (dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) { u16 opcode = MLX5_GET(mbox_in, in, opcode); err = mlx5_internal_err_ret_value(dev, opcode, &drv_synd, &status); MLX5_SET(mbox_out, out, status, status); From owner-dev-commits-src-all@freebsd.org Mon Jul 26 16:13: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 DDDB466F857; Mon, 26 Jul 2021 16:13: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 4GYQ3B4ZXtz3ptc; Mon, 26 Jul 2021 16:13: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 CDC741A23A; Mon, 26 Jul 2021 16: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 16QGDtgd006093; Mon, 26 Jul 2021 16: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 16QGDtpv006092; Mon, 26 Jul 2021 16:13:55 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:55 GMT Message-Id: <202107261613.16QGDtpv006092@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: cd08d4c53775 - stable/13 - mlx4ib and mlx5ib: Set slid to zero in Ethernet completion struct 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/stable/13 X-Git-Reftype: branch X-Git-Commit: cd08d4c53775bb470044aa6001dc1647200d44e0 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, 26 Jul 2021 16:13:59 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=cd08d4c53775bb470044aa6001dc1647200d44e0 commit cd08d4c53775bb470044aa6001dc1647200d44e0 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:58 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:33 +0000 mlx4ib and mlx5ib: Set slid to zero in Ethernet completion struct IB spec says that a lid should be ignored when link layer is Ethernet, for example when building or parsing a CM request message (CA17-34). However, since ib_lid_be16() and ib_lid_cpu16() validates the slid, not only when link layer is IB, we set the slid to zero to prevent false warnings in the kernel log. Linux commit: 65389322b28f81cc137b60a41044c2d958a7b950 Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 30416d4e827341be32c3e415f16c73f252a68d85) --- sys/dev/mlx4/mlx4_ib/mlx4_ib_cq.c | 4 +++- sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/sys/dev/mlx4/mlx4_ib/mlx4_ib_cq.c b/sys/dev/mlx4/mlx4_ib/mlx4_ib_cq.c index d9f3a719e030..215c428e7af7 100644 --- a/sys/dev/mlx4/mlx4_ib/mlx4_ib_cq.c +++ b/sys/dev/mlx4/mlx4_ib/mlx4_ib_cq.c @@ -593,6 +593,7 @@ static void use_tunnel_data(struct mlx4_ib_qp *qp, struct mlx4_ib_cq *cq, struct wc->dlid_path_bits = 0; if (is_eth) { + wc->slid = 0; wc->vlan_id = be16_to_cpu(hdr->tun.sl_vid); memcpy(&(wc->smac[0]), (char *)&hdr->tun.mac_31_0, 4); memcpy(&(wc->smac[4]), (char *)&hdr->tun.slid_mac_47_32, 2); @@ -841,7 +842,6 @@ repoll: } } - wc->slid = be16_to_cpu(cqe->rlid); g_mlpath_rqpn = be32_to_cpu(cqe->g_mlpath_rqpn); wc->src_qp = g_mlpath_rqpn & 0xffffff; wc->dlid_path_bits = (g_mlpath_rqpn >> 24) & 0x7f; @@ -850,6 +850,7 @@ repoll: wc->wc_flags |= mlx4_ib_ipoib_csum_ok(cqe->status, cqe->checksum) ? IB_WC_IP_CSUM_OK : 0; if (is_eth) { + wc->slid = 0; wc->sl = be16_to_cpu(cqe->sl_vid) >> 13; if (be32_to_cpu(cqe->vlan_my_qpn) & MLX4_CQE_CVLAN_PRESENT_MASK) { @@ -861,6 +862,7 @@ repoll: memcpy(wc->smac, cqe->smac, ETH_ALEN); wc->wc_flags |= (IB_WC_WITH_VLAN | IB_WC_WITH_SMAC); } else { + wc->slid = be16_to_cpu(cqe->rlid); wc->sl = be16_to_cpu(cqe->sl_vid) >> 12; wc->vlan_id = 0xffff; } diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c b/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c index 3c37df82199f..495aabb01bfe 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c @@ -219,7 +219,6 @@ static void handle_responder(struct ib_wc *wc, struct mlx5_cqe64 *cqe, wc->ex.invalidate_rkey = be32_to_cpu(cqe->imm_inval_pkey); break; } - wc->slid = be16_to_cpu(cqe->slid); wc->src_qp = be32_to_cpu(cqe->flags_rqpn) & 0xffffff; wc->dlid_path_bits = cqe->ml_path; g = (be32_to_cpu(cqe->flags_rqpn) >> 28) & 3; @@ -234,10 +233,12 @@ static void handle_responder(struct ib_wc *wc, struct mlx5_cqe64 *cqe, } if (ll != IB_LINK_LAYER_ETHERNET) { + wc->slid = be16_to_cpu(cqe->slid); wc->sl = (be32_to_cpu(cqe->flags_rqpn) >> 24) & 0xf; return; } + wc->slid = 0; vlan_present = cqe_has_vlan(cqe); roce_packet_type = (be32_to_cpu(cqe->flags_rqpn) >> 24) & 0x3; if (vlan_present) { From owner-dev-commits-src-all@freebsd.org Mon Jul 26 16:14: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 9E8A366F8B4; Mon, 26 Jul 2021 16:14: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 4GYQ3C46V3z3pgY; Mon, 26 Jul 2021 16:13: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 240911A44F; Mon, 26 Jul 2021 16:13: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 16QGDwvM006141; Mon, 26 Jul 2021 16:13:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDwsK006140; Mon, 26 Jul 2021 16:13:58 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:58 GMT Message-Id: <202107261613.16QGDwsK006140@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 857966b357ee - stable/13 - mlx5en: Allocate per-channel doorbells. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 857966b357eed16c5e79fd1a40cb389980373100 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, 26 Jul 2021 16:14:00 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=857966b357eed16c5e79fd1a40cb389980373100 commit 857966b357eed16c5e79fd1a40cb389980373100 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:59 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:33 +0000 mlx5en: Allocate per-channel doorbells. To avoid congestion on the same PCI memory register space when traffic consists mostly of small packets. Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 9dfa21486e1db730305abd63df449bcc1e76127b) --- sys/dev/mlx5/mlx5_en/en.h | 6 ++-- sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 61 ++++++++++++++++++++++++------------- sys/dev/mlx5/mlx5_en/mlx5_en_rl.c | 5 +-- 3 files changed, 44 insertions(+), 28 deletions(-) diff --git a/sys/dev/mlx5/mlx5_en/en.h b/sys/dev/mlx5/mlx5_en/en.h index b249a82d30ef..c84e2af237b2 100644 --- a/sys/dev/mlx5/mlx5_en/en.h +++ b/sys/dev/mlx5/mlx5_en/en.h @@ -870,6 +870,7 @@ mlx5e_sq_queue_level(struct mlx5e_sq *sq) struct mlx5e_channel { struct mlx5e_rq rq; struct m_snd_tag tag; + struct mlx5_sq_bfreg bfreg; struct mlx5e_sq sq[MLX5E_MAX_TX_NUM_TC]; struct mlx5e_priv *priv; struct completion completion; @@ -1073,8 +1074,6 @@ struct mlx5e_priv { struct mlx5e_dcbx dcbx; bool sw_is_port_buf_owner; - struct mlx5_sq_bfreg bfreg; - struct pfil_head *pfil; struct mlx5e_channel channel[]; }; @@ -1201,7 +1200,8 @@ int mlx5e_open_cq(struct mlx5e_priv *, struct mlx5e_cq_param *, void mlx5e_close_cq(struct mlx5e_cq *); void mlx5e_free_sq_db(struct mlx5e_sq *); int mlx5e_alloc_sq_db(struct mlx5e_sq *); -int mlx5e_enable_sq(struct mlx5e_sq *, struct mlx5e_sq_param *, int tis_num); +int mlx5e_enable_sq(struct mlx5e_sq *, struct mlx5e_sq_param *, + const struct mlx5_sq_bfreg *, int tis_num); int mlx5e_modify_sq(struct mlx5e_sq *, int curr_state, int next_state); void mlx5e_disable_sq(struct mlx5e_sq *); void mlx5e_drain_sq(struct mlx5e_sq *); diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index d9860c24114b..b67f382522e7 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -1619,8 +1619,6 @@ mlx5e_create_sq(struct mlx5e_channel *c, &sq->dma_tag))) goto done; - sq->uar_map = priv->bfreg.map; - err = mlx5_wq_cyc_create(mdev, ¶m->wq, sqc_wq, &sq->wq, &sq->wq_ctrl); if (err) @@ -1668,7 +1666,7 @@ mlx5e_destroy_sq(struct mlx5e_sq *sq) int mlx5e_enable_sq(struct mlx5e_sq *sq, struct mlx5e_sq_param *param, - int tis_num) + const struct mlx5_sq_bfreg *bfreg, int tis_num) { void *in; void *sqc; @@ -1683,6 +1681,8 @@ mlx5e_enable_sq(struct mlx5e_sq *sq, struct mlx5e_sq_param *param, if (in == NULL) return (-ENOMEM); + sq->uar_map = bfreg->map; + ts_format = mlx5_get_sq_default_ts(sq->priv->mdev); sqc = MLX5_ADDR_OF(create_sq_in, in, ctx); wq = MLX5_ADDR_OF(sqc, sqc, wq); @@ -1698,7 +1698,7 @@ mlx5e_enable_sq(struct mlx5e_sq *sq, struct mlx5e_sq_param *param, MLX5_SET(sqc, sqc, allow_swp, 1); MLX5_SET(wq, wq, wq_type, MLX5_WQ_TYPE_CYCLIC); - MLX5_SET(wq, wq, uar_page, sq->priv->bfreg.index); + MLX5_SET(wq, wq, uar_page, bfreg->index); MLX5_SET(wq, wq, log_wq_pg_sz, sq->wq_ctrl.buf.page_shift - PAGE_SHIFT); MLX5_SET64(wq, wq, dbr_addr, sq->wq_ctrl.db.dma); @@ -1764,7 +1764,7 @@ mlx5e_open_sq(struct mlx5e_channel *c, if (err) return (err); - err = mlx5e_enable_sq(sq, param, c->priv->tisn[tc]); + err = mlx5e_enable_sq(sq, param, &c->bfreg, c->priv->tisn[tc]); if (err) goto err_destroy_sq; @@ -3763,10 +3763,12 @@ static const char *mlx5e_pport_stats_desc[] = { MLX5E_PPORT_STATS(MLX5E_STATS_DESC) }; -static void -mlx5e_priv_static_init(struct mlx5e_priv *priv, const uint32_t channels) +static int +mlx5e_priv_static_init(struct mlx5e_priv *priv, struct mlx5_core_dev *mdev, + const uint32_t channels) { uint32_t x; + int err; mtx_init(&priv->async_events_mtx, "mlx5async", MTX_NETWORK_LOCK, MTX_DEF); sx_init(&priv->state_lock, "mlx5state"); @@ -3774,13 +3776,34 @@ mlx5e_priv_static_init(struct mlx5e_priv *priv, const uint32_t channels) MLX5_INIT_DOORBELL_LOCK(&priv->doorbell_lock); for (x = 0; x != channels; x++) mlx5e_chan_static_init(priv, &priv->channel[x], x); + + for (x = 0; x != channels; x++) { + err = mlx5_alloc_bfreg(mdev, &priv->channel[x].bfreg, false, false); + if (err) + goto err_alloc_bfreg; + } + return (0); + +err_alloc_bfreg: + while (x--) + mlx5_free_bfreg(mdev, &priv->channel[x].bfreg); + + for (x = 0; x != channels; x++) + mlx5e_chan_static_destroy(&priv->channel[x]); + callout_drain(&priv->watchdog); + mtx_destroy(&priv->async_events_mtx); + sx_destroy(&priv->state_lock); + return (err); } static void -mlx5e_priv_static_destroy(struct mlx5e_priv *priv, const uint32_t channels) +mlx5e_priv_static_destroy(struct mlx5e_priv *priv, struct mlx5_core_dev *mdev, + const uint32_t channels) { uint32_t x; + for (x = 0; x != channels; x++) + mlx5_free_bfreg(mdev, &priv->channel[x].bfreg); for (x = 0; x != channels; x++) mlx5e_chan_static_destroy(&priv->channel[x]); callout_drain(&priv->watchdog); @@ -4397,7 +4420,10 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) goto err_free_priv; } /* setup all static fields */ - mlx5e_priv_static_init(priv, mdev->priv.eq_table.num_comp_vectors); + if (mlx5e_priv_static_init(priv, mdev, mdev->priv.eq_table.num_comp_vectors)) { + mlx5_core_err(mdev, "mlx5e_priv_static_init() failed\n"); + goto err_free_ifp; + } ifp->if_softc = priv; if_initname(ifp, "mce", device_get_unit(mdev->pdev->dev.bsddev)); @@ -4508,11 +4534,6 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) mlx5_en_err(ifp, "mlx5e_create_mkey failed, %d\n", err); goto err_dealloc_transport_domain; } - err = mlx5_alloc_bfreg(mdev, &priv->bfreg, false, false); - if (err) { - mlx5_en_err(ifp, "alloc bfreg failed, %d\n", err); - goto err_create_mkey; - } mlx5_query_nic_vport_mac_address(priv->mdev, 0, dev_addr); /* check if we should generate a random MAC address */ @@ -4525,7 +4546,7 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) err = mlx5e_rl_init(priv); if (err) { mlx5_en_err(ifp, "mlx5e_rl_init failed, %d\n", err); - goto err_alloc_bfreg; + goto err_create_mkey; } err = mlx5e_tls_init(priv); @@ -4664,9 +4685,6 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) err_rl_init: mlx5e_rl_cleanup(priv); -err_alloc_bfreg: - mlx5_free_bfreg(mdev, &priv->bfreg); - err_create_mkey: mlx5_core_destroy_mkey(priv->mdev, &priv->mr); @@ -4683,7 +4701,9 @@ err_free_sysctl: sysctl_ctx_free(&priv->sysctl_ctx); if (priv->sysctl_debug) sysctl_ctx_free(&priv->stats.port_stats_debug.ctx); - mlx5e_priv_static_destroy(priv, mdev->priv.eq_table.num_comp_vectors); + mlx5e_priv_static_destroy(priv, mdev, mdev->priv.eq_table.num_comp_vectors); + +err_free_ifp: if_free(ifp); err_free_priv: @@ -4767,13 +4787,12 @@ mlx5e_destroy_ifp(struct mlx5_core_dev *mdev, void *vpriv) sysctl_ctx_free(&priv->stats.port_stats_debug.ctx); sysctl_ctx_free(&priv->sysctl_ctx); - mlx5_free_bfreg(priv->mdev, &priv->bfreg); mlx5_core_destroy_mkey(priv->mdev, &priv->mr); mlx5_dealloc_transport_domain(priv->mdev, priv->tdn); mlx5_core_dealloc_pd(priv->mdev, priv->pdn); mlx5e_disable_async_events(priv); flush_workqueue(priv->wq); - mlx5e_priv_static_destroy(priv, mdev->priv.eq_table.num_comp_vectors); + mlx5e_priv_static_destroy(priv, mdev, mdev->priv.eq_table.num_comp_vectors); if_free(ifp); free(priv, M_MLX5EN); } diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c b/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c index 33b93b1b5ced..bd66b8ecd725 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c @@ -116,9 +116,6 @@ mlx5e_rl_create_sq(struct mlx5e_priv *priv, struct mlx5e_sq *sq, &sq->dma_tag))) goto done; - /* use shared UAR */ - sq->uar_map = priv->bfreg.map; - err = mlx5_wq_cyc_create(mdev, ¶m->wq, sqc_wq, &sq->wq, &sq->wq_ctrl); if (err) @@ -165,7 +162,7 @@ mlx5e_rl_open_sq(struct mlx5e_priv *priv, struct mlx5e_sq *sq, if (err) return (err); - err = mlx5e_enable_sq(sq, param, priv->rl.tisn); + err = mlx5e_enable_sq(sq, param, &priv->channel[ix].bfreg, priv->rl.tisn); if (err) goto err_destroy_sq; From owner-dev-commits-src-all@freebsd.org Mon Jul 26 16:14: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 C492166F99A; Mon, 26 Jul 2021 16:14: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 4GYQ3J0spvz3pgj; Mon, 26 Jul 2021 16:14: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 643F31A491; Mon, 26 Jul 2021 16:14: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 16QGE0CR006195; Mon, 26 Jul 2021 16:14:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGE0f9006194; Mon, 26 Jul 2021 16:14:00 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:14:00 GMT Message-Id: <202107261614.16QGE0f9006194@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: fdab56d1f605 - stable/13 - mlx5en: Allow binding channels to CPUs when RSS is not enabled. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: fdab56d1f6054f33ffab0b4498ea114acbb475ac 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, 26 Jul 2021 16:14:05 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=fdab56d1f6054f33ffab0b4498ea114acbb475ac commit fdab56d1f6054f33ffab0b4498ea114acbb475ac Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:02:02 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:33 +0000 mlx5en: Allow binding channels to CPUs when RSS is not enabled. Submitted by: Netflix Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit c8d16d1e084dc14191491e95ce226d3ce8b39275) --- sys/dev/mlx5/mlx5_en/en.h | 6 ++++-- sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c | 13 ++++++++++++- sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 24 ++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 3 deletions(-) diff --git a/sys/dev/mlx5/mlx5_en/en.h b/sys/dev/mlx5/mlx5_en/en.h index c84e2af237b2..8556a4364ddd 100644 --- a/sys/dev/mlx5/mlx5_en/en.h +++ b/sys/dev/mlx5/mlx5_en/en.h @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2015-2019 Mellanox Technologies. All rights reserved. + * Copyright (c) 2015-2021 Mellanox Technologies. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -710,7 +710,9 @@ struct mlx5e_params { m(+1, u64, diag_general_enable, "diag_general_enable", "0: Disabled 1: Enabled") \ m(+1, u64, hw_mtu, "hw_mtu", "Current hardware MTU value") \ m(+1, u64, mc_local_lb, "mc_local_lb", "0: Local multicast loopback enabled 1: Disabled") \ - m(+1, u64, uc_local_lb, "uc_local_lb", "0: Local unicast loopback enabled 1: Disabled") + m(+1, u64, uc_local_lb, "uc_local_lb", "0: Local unicast loopback enabled 1: Disabled") \ + m(+1, s64, irq_cpu_base, "irq_cpu_base", "-1: Don't bind IRQ 0..NCPU-1: select this base CPU when binding IRQs") \ + m(+1, s64, irq_cpu_stride, "irq_cpu_stride", "0..NCPU-1: Distance between IRQ vectors when binding them") #define MLX5E_PARAMS_NUM (0 MLX5E_PARAMS(MLX5E_STATS_COUNT)) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c b/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c index 4070fe4331a1..f7228989ee04 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2015-2019 Mellanox Technologies. All rights reserved. + * Copyright (c) 2015-2021 Mellanox Technologies. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -1250,6 +1250,15 @@ mlx5e_ethtool_handler(SYSCTL_HANDLER_ARGS) } break; + case MLX5_PARAM_OFFSET(irq_cpu_base): + case MLX5_PARAM_OFFSET(irq_cpu_stride): + if (was_opened) { + /* network interface must toggled */ + mlx5e_close_locked(priv->ifp); + mlx5e_open_locked(priv->ifp); + } + break; + default: break; } @@ -1413,6 +1422,8 @@ mlx5e_create_ethtool(struct mlx5e_priv *priv) int i; /* set some defaults */ + priv->params_ethtool.irq_cpu_base = -1; /* disabled */ + priv->params_ethtool.irq_cpu_stride = 1; priv->params_ethtool.tx_queue_size_max = 1 << MLX5E_PARAMS_MAXIMUM_LOG_SQ_SIZE; priv->params_ethtool.rx_queue_size_max = 1 << MLX5E_PARAMS_MAXIMUM_LOG_RQ_SIZE; priv->params_ethtool.tx_queue_size = 1 << priv->params.log_sq_size; diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index b67f382522e7..9345798006f2 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -2446,6 +2446,30 @@ mlx5e_open_channels(struct mlx5e_priv *priv) err = mlx5e_open_channel(priv, cparam, &priv->channel[i]); if (err) goto err_close_channels; + + /* Bind interrupt vectors, if any. */ + if (priv->params_ethtool.irq_cpu_base > -1) { + cpuset_t cpuset; + int cpu; + int irq; + int eqn; + int nirq; + + err = mlx5_vector2eqn(priv->mdev, i, + &eqn, &nirq); + + /* error here is non-fatal */ + if (err != 0) + continue; + + irq = priv->mdev->priv.msix_arr[nirq].vector; + cpu = (unsigned)(priv->params_ethtool.irq_cpu_base + + i * priv->params_ethtool.irq_cpu_stride) % (unsigned)mp_ncpus; + + CPU_ZERO(&cpuset); + CPU_SET(cpu, &cpuset); + intr_setaffinity(irq, CPU_WHICH_INTRHANDLER, &cpuset); + } } for (j = 0; j < priv->params.num_channels; j++) { From owner-dev-commits-src-all@freebsd.org Mon Jul 26 16:14: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 5801C66F951; Mon, 26 Jul 2021 16:14: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 4GYQ3P6TyTz3pxD; Mon, 26 Jul 2021 16:14: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 51B1419E4F; Mon, 26 Jul 2021 16:14: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 16QGE6wB006321; Mon, 26 Jul 2021 16:14:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGE69n006320; Mon, 26 Jul 2021 16:14:06 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:14:06 GMT Message-Id: <202107261614.16QGE69n006320@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 9661887500f8 - stable/13 - Fix mismerge in OFED update 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 9661887500f8231706ae87b47941af678ad48164 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, 26 Jul 2021 16:14:11 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=9661887500f8231706ae87b47941af678ad48164 commit 9661887500f8231706ae87b47941af678ad48164 Author: Hans Petter Selasky AuthorDate: 2021-07-26 16:12:35 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:12:35 +0000 Fix mismerge in OFED update When OFED was upgraded to Linux v4.9, a bunch of Linux-specific netlink changes were dropped. Unfortunately, there was a mismerge in this process and as a result ib_sa_cancel_query() would fail to cancel an outstanding MAD. This was causing rdma_destroy_id() to hang indefinitely waiting for the MAD to complete and release the final reference. Sponsored by: Dell Inc. Differential Revision: https://reviews.freebsd.org/D28421 Reviewed by: hselasky, kib (cherry picked from commit 8a06ca2f734c726799688d65a7dad67284275438) --- sys/ofed/drivers/infiniband/core/ib_sa_query.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/ofed/drivers/infiniband/core/ib_sa_query.c b/sys/ofed/drivers/infiniband/core/ib_sa_query.c index ce9c7f8a8998..b423d78d0407 100644 --- a/sys/ofed/drivers/infiniband/core/ib_sa_query.c +++ b/sys/ofed/drivers/infiniband/core/ib_sa_query.c @@ -622,6 +622,8 @@ void ib_sa_cancel_query(int id, struct ib_sa_query *query) agent = query->port->agent; mad_buf = query->mad_buf; spin_unlock_irqrestore(&idr_lock, flags); + + ib_cancel_mad(agent, mad_buf); } EXPORT_SYMBOL(ib_sa_cancel_query); From owner-dev-commits-src-all@freebsd.org Mon Jul 26 16:13: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 831C866F72D; Mon, 26 Jul 2021 16:13: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 4GYQ2y73lfz3pZG; Mon, 26 Jul 2021 16:13: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 B362E1A231; Mon, 26 Jul 2021 16:13: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 16QGDjeB005865; Mon, 26 Jul 2021 16:13:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDjnb005864; Mon, 26 Jul 2021 16:13:45 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:45 GMT Message-Id: <202107261613.16QGDjnb005864@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: a7a80f17715c - stable/13 - mlx5: Add new timestamp mode bits. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: a7a80f17715c7b71c9de66f127fb4b3e6b4b267a 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, 26 Jul 2021 16:13:49 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=a7a80f17715c7b71c9de66f127fb4b3e6b4b267a commit a7a80f17715c7b71c9de66f127fb4b3e6b4b267a Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:52 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:32 +0000 mlx5: Add new timestamp mode bits. These fields declare which timestamp mode is supported by the device per RQ/SQ/QP. In addition add the ts_format field to the select the mode for RQ/SQ/QP. Linux commit: a6a217dddcd544f6b75f0e2a60b6e84c1d494b7e Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 915fc66cb59faa543b852083233729c270d5aa3b) --- sys/dev/mlx5/mlx5_ifc.h | 56 +++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 50 insertions(+), 6 deletions(-) diff --git a/sys/dev/mlx5/mlx5_ifc.h b/sys/dev/mlx5/mlx5_ifc.h index 494180630500..ce8074fba3f1 100644 --- a/sys/dev/mlx5/mlx5_ifc.h +++ b/sys/dev/mlx5/mlx5_ifc.h @@ -914,13 +914,19 @@ enum { MLX5_ROCE_CAP_L3_TYPE_IPV6 = 0x4, }; +enum { + MLX5_QP_TIMESTAMP_FORMAT_CAP_FREE_RUNNING = 0x0, + MLX5_QP_TIMESTAMP_FORMAT_CAP_REAL_TIME = 0x1, + MLX5_QP_TIMESTAMP_FORMAT_CAP_FREE_RUNNING_AND_REAL_TIME = 0x2, +}; + struct mlx5_ifc_roce_cap_bits { u8 roce_apm[0x1]; u8 rts2rts_primary_eth_prio[0x1]; u8 roce_rx_allow_untagged[0x1]; u8 rts2rts_src_addr_index_for_vlan_valid_vlan_id[0x1]; - - u8 reserved_0[0x1c]; + u8 reserved_at_4[0x1a]; + u8 qp_ts_format[0x2]; u8 reserved_1[0x60]; @@ -1037,6 +1043,18 @@ enum { MLX5_CMD_HCA_CAP_CMDIF_CHECKSUM_ENABLED = 0x3, }; +enum { + MLX5_SQ_TIMESTAMP_FORMAT_CAP_FREE_RUNNING = 0x0, + MLX5_SQ_TIMESTAMP_FORMAT_CAP_REAL_TIME = 0x1, + MLX5_SQ_TIMESTAMP_FORMAT_CAP_FREE_RUNNING_AND_REAL_TIME = 0x2, +}; + +enum { + MLX5_RQ_TIMESTAMP_FORMAT_CAP_FREE_RUNNING = 0x0, + MLX5_RQ_TIMESTAMP_FORMAT_CAP_REAL_TIME = 0x1, + MLX5_RQ_TIMESTAMP_FORMAT_CAP_FREE_RUNNING_AND_REAL_TIME = 0x2, +}; + struct mlx5_ifc_cmd_hca_cap_bits { u8 reserved_0[0x80]; @@ -1274,7 +1292,9 @@ struct mlx5_ifc_cmd_hca_cap_bits { u8 general_obj_types[0x40]; - u8 reserved_at_440[0x8]; + u8 sq_ts_format[0x2]; + u8 rq_ts_format[0x2]; + u8 reserved_at_444[0x4]; u8 create_qp_start_hint[0x18]; u8 reserved_at_460[0x3]; @@ -1961,6 +1981,12 @@ enum { MLX5_QPC_CS_RES_UP_TO_64B = 0x2, }; +enum { + MLX5_QPC_TIMESTAMP_FORMAT_FREE_RUNNING = 0x0, + MLX5_QPC_TIMESTAMP_FORMAT_DEFAULT = 0x1, + MLX5_QPC_TIMESTAMP_FORMAT_REAL_TIME = 0x2, +}; + struct mlx5_ifc_qpc_bits { u8 state[0x4]; u8 lag_tx_port_affinity[0x4]; @@ -1987,7 +2013,9 @@ struct mlx5_ifc_qpc_bits { u8 log_rq_stride[0x3]; u8 no_sq[0x1]; u8 log_sq_size[0x4]; - u8 reserved_7[0x6]; + u8 reserved_at_55[0x3]; + u8 ts_format[0x2]; + u8 reserved_at_5a[0x1]; u8 rlky[0x1]; u8 ulp_stateless_offload_mode[0x4]; @@ -2376,6 +2404,12 @@ enum { MLX5_SQC_STATE_ERR = 0x3, }; +enum { + MLX5_SQC_TIMESTAMP_FORMAT_FREE_RUNNING = 0x0, + MLX5_SQC_TIMESTAMP_FORMAT_DEFAULT = 0x1, + MLX5_SQC_TIMESTAMP_FORMAT_REAL_TIME = 0x2, +}; + struct mlx5_ifc_sqc_bits { u8 rlkey[0x1]; u8 cd_master[0x1]; @@ -2386,7 +2420,9 @@ struct mlx5_ifc_sqc_bits { u8 state[0x4]; u8 reg_umr[0x1]; u8 allow_swp[0x1]; - u8 reserved_0[0x12]; + u8 reserved_at_e[0xc]; + u8 ts_format[0x2]; + u8 reserved_at_1c[0x4]; u8 reserved_1[0x8]; u8 user_index[0x18]; @@ -2492,6 +2528,12 @@ enum { MLX5_RQC_DROPLESS_MODE_ENABLE = 0x1, }; +enum { + MLX5_RQC_TIMESTAMP_FORMAT_FREE_RUNNING = 0x0, + MLX5_RQC_TIMESTAMP_FORMAT_DEFAULT = 0x1, + MLX5_RQC_TIMESTAMP_FORMAT_REAL_TIME = 0x2, +}; + struct mlx5_ifc_rqc_bits { u8 rlkey[0x1]; u8 delay_drop_en[0x1]; @@ -2501,7 +2543,9 @@ struct mlx5_ifc_rqc_bits { u8 state[0x4]; u8 reserved_1[0x1]; u8 flush_in_error_en[0x1]; - u8 reserved_2[0x12]; + u8 reserved_at_e[0xc]; + u8 ts_format[0x2]; + u8 reserved_at_1c[0x4]; u8 reserved_3[0x8]; u8 user_index[0x18]; From owner-dev-commits-src-all@freebsd.org Mon Jul 26 16:13: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 9705266F98C; Mon, 26 Jul 2021 16:13: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 4GYQ3B6qLZz3pd9; Mon, 26 Jul 2021 16:13: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 0C5111A44E; Mon, 26 Jul 2021 16:13: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 16QGDus7006117; Mon, 26 Jul 2021 16:13:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDuNY006116; Mon, 26 Jul 2021 16:13:56 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:56 GMT Message-Id: <202107261613.16QGDuNY006116@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 0ebff67cab8b - stable/13 - mlx5en: Wait for all TLS connections to terminate when unloading driver. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 0ebff67cab8b78e73f7a166fcabad3244edf812f 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, 26 Jul 2021 16:13:59 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=0ebff67cab8b78e73f7a166fcabad3244edf812f commit 0ebff67cab8b78e73f7a166fcabad3244edf812f Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:58 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:33 +0000 mlx5en: Wait for all TLS connections to terminate when unloading driver. The driver expects all TLS tags to be returned to the driver before it can free the UMA zone where the TLS tags reside. Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 3a934ba7a30831dda104e9faad9412f9743c9bae) --- sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls.c | 2 +- sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls.c b/sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls.c index 3e63b9e660f1..1a92e5aa222a 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls.c @@ -288,7 +288,7 @@ mlx5e_tls_snd_tag_alloc(struct ifnet *ifp, priv = ifp->if_softc; - if (priv->tls.init == 0) + if (priv->gone != 0 || priv->tls.init == 0) return (EOPNOTSUPP); /* allocate new tag from zone, if any */ diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index 02417f5f931c..d9860c24114b 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -4715,6 +4715,16 @@ mlx5e_destroy_ifp(struct mlx5_core_dev *mdev, void *vpriv) pause("W", hz); } #endif + +#ifdef KERN_TLS + /* wait for all TLS tags to get freed */ + while (priv->tls.init != 0 && + uma_zone_get_cur(priv->tls.zone) != 0) { + mlx5_en_err(priv->ifp, + "Waiting for all TLS connections to terminate\n"); + pause("W", hz); + } +#endif /* wait for all unlimited send tags to complete */ mlx5e_priv_wait_for_completion(priv, mdev->priv.eq_table.num_comp_vectors); From owner-dev-commits-src-all@freebsd.org Mon Jul 26 16: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 B797366F7D0; Mon, 26 Jul 2021 16: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 4GYQ366rb5z3pd1; Mon, 26 Jul 2021 16:13: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 7F87B1A294; Mon, 26 Jul 2021 16:13: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 16QGDqig006015; Mon, 26 Jul 2021 16:13:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDqCZ006014; Mon, 26 Jul 2021 16:13:52 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:52 GMT Message-Id: <202107261613.16QGDqCZ006014@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 763d239db250 - stable/13 - mlx5ib: Implement support for enabling and disabling RoCE ECN. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 763d239db2503ba39bbb9bbe43ae193a423e656c 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, 26 Jul 2021 16:13:56 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=763d239db2503ba39bbb9bbe43ae193a423e656c commit 763d239db2503ba39bbb9bbe43ae193a423e656c Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:56 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:32 +0000 mlx5ib: Implement support for enabling and disabling RoCE ECN. RoCE is short for Remote direct memory access over Converged Ethernet. ECN is short for Explicit Congestion Notification. Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 8abf5ac0e6ddaeddf49cf39193bbe0c3ebf7209b) --- sys/dev/mlx5/cmd.h | 4 ++ sys/dev/mlx5/mlx5_core/mlx5_cmd.c | 23 ++++++++++ sys/dev/mlx5/mlx5_ib/mlx5_ib.h | 39 +++++++++++++++++ sys/dev/mlx5/mlx5_ib/mlx5_ib_cong.c | 84 +++++++++++++++++++++++++++++++++++++ 4 files changed, 150 insertions(+) diff --git a/sys/dev/mlx5/cmd.h b/sys/dev/mlx5/cmd.h index 674a8ab44acd..babcaac58ee3 100644 --- a/sys/dev/mlx5/cmd.h +++ b/sys/dev/mlx5/cmd.h @@ -50,4 +50,8 @@ int mlx5_cmd_query_cong_params(struct mlx5_core_dev *dev, int cong_point, void *out, int out_size); int mlx5_cmd_modify_cong_params(struct mlx5_core_dev *mdev, void *in, int in_size); +int mlx5_cmd_query_cong_status(struct mlx5_core_dev *dev, int cong_point, + int prio, void *out, int out_size); +int mlx5_cmd_modify_cong_status(struct mlx5_core_dev *mdev, + void *in, int in_size); #endif /* MLX5_CMD_H */ diff --git a/sys/dev/mlx5/mlx5_core/mlx5_cmd.c b/sys/dev/mlx5/mlx5_core/mlx5_cmd.c index c6cc3fee8c43..c4e8b32ffcd5 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_cmd.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_cmd.c @@ -1668,3 +1668,26 @@ int mlx5_cmd_modify_cong_params(struct mlx5_core_dev *dev, return mlx5_cmd_exec(dev, in, in_size, out, sizeof(out)); } EXPORT_SYMBOL(mlx5_cmd_modify_cong_params); + +int mlx5_cmd_query_cong_status(struct mlx5_core_dev *dev, int cong_point, + int prio, void *out, int out_size) +{ + u32 in[MLX5_ST_SZ_DW(query_cong_status_in)] = { }; + + MLX5_SET(query_cong_status_in, in, opcode, + MLX5_CMD_OP_QUERY_CONG_STATUS); + MLX5_SET(query_cong_status_in, in, priority, prio); + MLX5_SET(query_cong_status_in, in, cong_protocol, cong_point); + + return mlx5_cmd_exec(dev, in, sizeof(in), out, out_size); +} +EXPORT_SYMBOL(mlx5_cmd_query_cong_status); + +int mlx5_cmd_modify_cong_status(struct mlx5_core_dev *dev, + void *in, int in_size) +{ + u32 out[MLX5_ST_SZ_DW(modify_cong_status_out)] = { }; + + return mlx5_cmd_exec(dev, in, in_size, out, sizeof(out)); +} +EXPORT_SYMBOL(mlx5_cmd_modify_cong_status); diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib.h b/sys/dev/mlx5/mlx5_ib/mlx5_ib.h index 0ac5368ca3b2..49f6e87868ff 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib.h +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib.h @@ -678,6 +678,44 @@ struct mlx5_roce { #define MLX5_IB_CONG_STATS_NUM (0 MLX5_IB_CONG_STATS(MLX5_IB_STATS_COUNT)) +#define MLX5_IB_CONG_STATUS(m) \ + /* ECN RP */ \ + m(+1, u64, rp_0_enable, "rp_0_enable", "Enable reaction point, priority 0", MLX5_IB_RROCE_ECN_RP, 0, enable) \ + m(+1, u64, rp_1_enable, "rp_1_enable", "Enable reaction point, priority 1", MLX5_IB_RROCE_ECN_RP, 1, enable) \ + m(+1, u64, rp_2_enable, "rp_2_enable", "Enable reaction point, priority 2", MLX5_IB_RROCE_ECN_RP, 2, enable) \ + m(+1, u64, rp_3_enable, "rp_3_enable", "Enable reaction point, priority 3", MLX5_IB_RROCE_ECN_RP, 3, enable) \ + m(+1, u64, rp_4_enable, "rp_4_enable", "Enable reaction point, priority 4", MLX5_IB_RROCE_ECN_RP, 4, enable) \ + m(+1, u64, rp_5_enable, "rp_5_enable", "Enable reaction point, priority 5", MLX5_IB_RROCE_ECN_RP, 5, enable) \ + m(+1, u64, rp_6_enable, "rp_6_enable", "Enable reaction point, priority 6", MLX5_IB_RROCE_ECN_RP, 6, enable) \ + m(+1, u64, rp_7_enable, "rp_7_enable", "Enable reaction point, priority 7", MLX5_IB_RROCE_ECN_RP, 7, enable) \ + m(+1, u64, rp_8_enable, "rp_8_enable", "Enable reaction point, priority 8", MLX5_IB_RROCE_ECN_RP, 8, enable) \ + m(+1, u64, rp_9_enable, "rp_9_enable", "Enable reaction point, priority 9", MLX5_IB_RROCE_ECN_RP, 9, enable) \ + m(+1, u64, rp_10_enable, "rp_10_enable", "Enable reaction point, priority 10", MLX5_IB_RROCE_ECN_RP, 10, enable) \ + m(+1, u64, rp_11_enable, "rp_11_enable", "Enable reaction point, priority 11", MLX5_IB_RROCE_ECN_RP, 11, enable) \ + m(+1, u64, rp_12_enable, "rp_12_enable", "Enable reaction point, priority 12", MLX5_IB_RROCE_ECN_RP, 12, enable) \ + m(+1, u64, rp_13_enable, "rp_13_enable", "Enable reaction point, priority 13", MLX5_IB_RROCE_ECN_RP, 13, enable) \ + m(+1, u64, rp_14_enable, "rp_14_enable", "Enable reaction point, priority 14", MLX5_IB_RROCE_ECN_RP, 14, enable) \ + m(+1, u64, rp_15_enable, "rp_15_enable", "Enable reaction point, priority 15", MLX5_IB_RROCE_ECN_RP, 15, enable) \ + /* ECN NP */ \ + m(+1, u64, np_0_enable, "np_0_enable", "Enable notification point, priority 0", MLX5_IB_RROCE_ECN_NP, 0, enable) \ + m(+1, u64, np_1_enable, "np_1_enable", "Enable notification point, priority 1", MLX5_IB_RROCE_ECN_NP, 1, enable) \ + m(+1, u64, np_2_enable, "np_2_enable", "Enable notification point, priority 2", MLX5_IB_RROCE_ECN_NP, 2, enable) \ + m(+1, u64, np_3_enable, "np_3_enable", "Enable notification point, priority 3", MLX5_IB_RROCE_ECN_NP, 3, enable) \ + m(+1, u64, np_4_enable, "np_4_enable", "Enable notification point, priority 4", MLX5_IB_RROCE_ECN_NP, 4, enable) \ + m(+1, u64, np_5_enable, "np_5_enable", "Enable notification point, priority 5", MLX5_IB_RROCE_ECN_NP, 5, enable) \ + m(+1, u64, np_6_enable, "np_6_enable", "Enable notification point, priority 6", MLX5_IB_RROCE_ECN_NP, 6, enable) \ + m(+1, u64, np_7_enable, "np_7_enable", "Enable notification point, priority 7", MLX5_IB_RROCE_ECN_NP, 7, enable) \ + m(+1, u64, np_8_enable, "np_8_enable", "Enable notification point, priority 8", MLX5_IB_RROCE_ECN_NP, 8, enable) \ + m(+1, u64, np_9_enable, "np_9_enable", "Enable notification point, priority 9", MLX5_IB_RROCE_ECN_NP, 9, enable) \ + m(+1, u64, np_10_enable, "np_10_enable", "Enable notification point, priority 10", MLX5_IB_RROCE_ECN_NP, 10, enable) \ + m(+1, u64, np_11_enable, "np_11_enable", "Enable notification point, priority 11", MLX5_IB_RROCE_ECN_NP, 11, enable) \ + m(+1, u64, np_12_enable, "np_12_enable", "Enable notification point, priority 12", MLX5_IB_RROCE_ECN_NP, 12, enable) \ + m(+1, u64, np_13_enable, "np_13_enable", "Enable notification point, priority 13", MLX5_IB_RROCE_ECN_NP, 13, enable) \ + m(+1, u64, np_14_enable, "np_14_enable", "Enable notification point, priority 14", MLX5_IB_RROCE_ECN_NP, 14, enable) \ + m(+1, u64, np_15_enable, "np_15_enable", "Enable notification point, priority 15", MLX5_IB_RROCE_ECN_NP, 15, enable) \ + +#define MLX5_IB_CONG_STATUS_NUM (0 MLX5_IB_CONG_STATUS(MLX5_IB_STATS_COUNT)) + struct mlx5_ib_congestion { struct sysctl_ctx_list ctx; struct sx lock; @@ -687,6 +725,7 @@ struct mlx5_ib_congestion { struct { MLX5_IB_CONG_PARAMS(MLX5_IB_STATS_VAR) MLX5_IB_CONG_STATS(MLX5_IB_STATS_VAR) + MLX5_IB_CONG_STATUS(MLX5_IB_STATS_VAR) }; }; }; diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib_cong.c b/sys/dev/mlx5/mlx5_ib/mlx5_ib_cong.c index 0fc6694bde82..85ba77362cca 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib_cong.c +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib_cong.c @@ -33,6 +33,10 @@ static const char *mlx5_ib_cong_params_desc[] = { MLX5_IB_CONG_PARAMS(MLX5_IB_STATS_DESC) }; +static const char *mlx5_ib_cong_status_desc[] = { + MLX5_IB_CONG_STATUS(MLX5_IB_STATS_DESC) +}; + static const char *mlx5_ib_cong_stats_desc[] = { MLX5_IB_CONG_STATS(MLX5_IB_STATS_DESC) }; @@ -346,6 +350,72 @@ done: return (error); } +static int +mlx5_ib_get_all_cc_status(struct mlx5_ib_dev *dev) +{ + const int outlen = MLX5_ST_SZ_BYTES(query_cong_status_out); + uint32_t out[MLX5_ST_SZ_DW(query_cong_status_out)] = {}; + int error; + +#define MLX5_IB_CONG_STATUS_READ(a,b,c,d,e,node,prio,field) do { \ + error = mlx5_cmd_query_cong_status(dev->mdev, node, prio, out, outlen); \ + if (error) \ + goto done; \ + dev->congestion.c = MLX5_GET(query_cong_status_out, out, field); \ +} while (0); + + MLX5_IB_CONG_STATUS(MLX5_IB_CONG_STATUS_READ); +done: + return (error); +} + +static int +mlx5_ib_cong_status_handler(SYSCTL_HANDLER_ARGS) +{ + const int inlen = MLX5_ST_SZ_BYTES(modify_cong_status_in); + uint32_t in[MLX5_ST_SZ_DW(modify_cong_status_in)] = {}; + struct mlx5_ib_dev *dev = arg1; + u64 value; + int error; + + CONG_LOCK(dev); + value = dev->congestion.arg[arg2]; + if (req != NULL) { + error = sysctl_handle_64(oidp, &value, 0, req); + /* convert value into a boolean */ + value = value ? 1 : 0; + if (error || req->newptr == NULL || + value == dev->congestion.arg[arg2]) + goto done; + + /* assign new binary value */ + dev->congestion.arg[arg2] = value; + } else { + error = 0; + } + if (!MLX5_CAP_GEN(dev->mdev, cc_modify_allowed)) + error = EPERM; + else switch (arg2) { +#define MLX5_IB_CONG_STATUS_WRITE(a,b,c,d,e,node,prio,field) \ + case MLX5_IB_INDEX(c): \ + MLX5_SET(modify_cong_status_in, in, opcode, \ + MLX5_CMD_OP_MODIFY_CONG_STATUS); \ + MLX5_SET(modify_cong_status_in, in, priority, prio); \ + MLX5_SET(modify_cong_status_in, in, cong_protocol, node); \ + MLX5_SET(modify_cong_status_in, in, field, value); \ + error = -mlx5_cmd_modify_cong_status(dev->mdev, in, inlen); \ + break; + MLX5_IB_CONG_STATUS(MLX5_IB_CONG_STATUS_WRITE) + default: + error = EINVAL; + break; + } +done: + CONG_UNLOCK(dev); + + return (error); +} + #define MLX5_GET_UNALIGNED_64(t,p,f) \ (((u64)MLX5_GET(t,p,f##_high) << 32) | MLX5_GET(t,p,f##_low)) @@ -422,6 +492,10 @@ mlx5_ib_init_congestion(struct mlx5_ib_dev *dev) if (err) return (err); + err = mlx5_ib_get_all_cc_status(dev); + if (err) + return (err); + parent = SYSCTL_ADD_NODE(ctx, SYSCTL_CHILDREN(dev->ib_dev.dev.kobj.oidp), OID_AUTO, "cong", CTLFLAG_RW | CTLFLAG_MPSAFE, NULL, "Congestion control"); @@ -445,6 +519,16 @@ mlx5_ib_init_congestion(struct mlx5_ib_dev *dev) mlx5_ib_cong_params_desc[2 * x + 1]); } + for (x = 0; x != MLX5_IB_CONG_STATUS_NUM; x++) { + SYSCTL_ADD_PROC(ctx, + SYSCTL_CHILDREN(node), OID_AUTO, + mlx5_ib_cong_status_desc[2 * x], + CTLTYPE_U64 | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, + dev, x + MLX5_IB_CONG_PARAMS_NUM + MLX5_IB_CONG_STATS_NUM, + &mlx5_ib_cong_status_handler, "QU", + mlx5_ib_cong_status_desc[2 * x + 1]); + } + node = SYSCTL_ADD_NODE(ctx, SYSCTL_CHILDREN(parent), OID_AUTO, "stats", CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "Statistics"); From owner-dev-commits-src-all@freebsd.org Mon Jul 26 16:14: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 E220666F93D; Mon, 26 Jul 2021 16:14: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 4GYQ3L1Hybz3ptw; Mon, 26 Jul 2021 16:14: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 9DD6D1A23C; Mon, 26 Jul 2021 16:14: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 16QGE1fZ006219; Mon, 26 Jul 2021 16:14:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGE1nD006218; Mon, 26 Jul 2021 16:14:01 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:14:01 GMT Message-Id: <202107261614.16QGE1nD006218@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 191a0e65a016 - stable/13 - mlx4: Map core_clock page to user space only when allowed 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 191a0e65a016a973b586a8d8a4927872e05d0167 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, 26 Jul 2021 16:14:07 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=191a0e65a016a973b586a8d8a4927872e05d0167 commit 191a0e65a016a973b586a8d8a4927872e05d0167 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:02:02 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:33 +0000 mlx4: Map core_clock page to user space only when allowed Currently when we map the hca_core_clock page to the user space, there are vulnerable registers, one of which is semaphore, on this page as well. If user read the wrong offset, it can modify the above semaphore and hang the device. Hence, mapping the hca_core_clock page to the user space only when user required it specifically. After this patch, mlx4 core_clock won't be mapped to user space by default. Oppose to current state, where mlx4 core_clock is always mapped to user space. Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit c8301cbb0fa25d03c1b6b2d056497d5a1580a8b4) --- sys/dev/mlx4/device.h | 1 + sys/dev/mlx4/mlx4_core/fw.h | 1 + sys/dev/mlx4/mlx4_core/mlx4_fw.c | 3 +++ sys/dev/mlx4/mlx4_core/mlx4_main.c | 6 ++++++ sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c | 5 +---- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/sys/dev/mlx4/device.h b/sys/dev/mlx4/device.h index 0af8fce5e634..ce934838253f 100644 --- a/sys/dev/mlx4/device.h +++ b/sys/dev/mlx4/device.h @@ -624,6 +624,7 @@ struct mlx4_caps { u32 dmfs_high_rate_qpn_range; u32 vf_caps; struct mlx4_rate_limit_caps rl_caps; + bool map_clock_to_user; }; struct mlx4_buf_list { diff --git a/sys/dev/mlx4/mlx4_core/fw.h b/sys/dev/mlx4/mlx4_core/fw.h index c4c4883b4d06..48ba434e6078 100644 --- a/sys/dev/mlx4/mlx4_core/fw.h +++ b/sys/dev/mlx4/mlx4_core/fw.h @@ -129,6 +129,7 @@ struct mlx4_dev_cap { u32 dmfs_high_rate_qpn_range; struct mlx4_rate_limit_caps rl_caps; struct mlx4_port_cap port_cap[MLX4_MAX_PORTS + 1]; + bool map_clock_to_user; }; struct mlx4_func_cap { diff --git a/sys/dev/mlx4/mlx4_core/mlx4_fw.c b/sys/dev/mlx4/mlx4_core/mlx4_fw.c index 0ac45e1297b9..68aa7e76c79d 100644 --- a/sys/dev/mlx4/mlx4_core/mlx4_fw.c +++ b/sys/dev/mlx4/mlx4_core/mlx4_fw.c @@ -820,6 +820,7 @@ int mlx4_QUERY_DEV_CAP(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap) #define QUERY_DEV_CAP_MAD_DEMUX_OFFSET 0xb0 #define QUERY_DEV_CAP_DMFS_HIGH_RATE_QPN_BASE_OFFSET 0xa8 #define QUERY_DEV_CAP_DMFS_HIGH_RATE_QPN_RANGE_OFFSET 0xac +#define QUERY_DEV_CAP_MAP_CLOCK_TO_USER 0xc1 #define QUERY_DEV_CAP_QP_RATE_LIMIT_NUM_OFFSET 0xcc #define QUERY_DEV_CAP_QP_RATE_LIMIT_MAX_OFFSET 0xd0 #define QUERY_DEV_CAP_QP_RATE_LIMIT_MIN_OFFSET 0xd2 @@ -838,6 +839,8 @@ int mlx4_QUERY_DEV_CAP(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap) if (mlx4_is_mfunc(dev)) disable_unsupported_roce_caps(outbox); + MLX4_GET(field, outbox, QUERY_DEV_CAP_MAP_CLOCK_TO_USER); + dev_cap->map_clock_to_user = field & 0x80; MLX4_GET(field, outbox, QUERY_DEV_CAP_RSVD_QP_OFFSET); dev_cap->reserved_qps = 1 << (field & 0xf); MLX4_GET(field, outbox, QUERY_DEV_CAP_MAX_QP_OFFSET); diff --git a/sys/dev/mlx4/mlx4_core/mlx4_main.c b/sys/dev/mlx4/mlx4_core/mlx4_main.c index 48cc2fc7d3f6..ca63d1d12ba6 100644 --- a/sys/dev/mlx4/mlx4_core/mlx4_main.c +++ b/sys/dev/mlx4/mlx4_core/mlx4_main.c @@ -386,6 +386,7 @@ static int mlx4_dev_cap(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap) } } + dev->caps.map_clock_to_user = dev_cap->map_clock_to_user; dev->caps.uar_page_size = PAGE_SIZE; dev->caps.num_uars = dev_cap->uar_size / PAGE_SIZE; dev->caps.local_ca_ack_delay = dev_cap->local_ca_ack_delay; @@ -1872,6 +1873,11 @@ int mlx4_get_internal_clock_params(struct mlx4_dev *dev, if (mlx4_is_slave(dev)) return -ENOTSUPP; + if (!dev->caps.map_clock_to_user) { + mlx4_dbg(dev, "Map clock to user is not supported.\n"); + return -EOPNOTSUPP; + } + if (!params) return -EINVAL; diff --git a/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c b/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c index ef23f182bc28..e992400820c0 100644 --- a/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c +++ b/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c @@ -560,12 +560,9 @@ static int mlx4_ib_query_device(struct ib_device *ibdev, props->hca_core_clock = dev->dev->caps.hca_core_clock * 1000UL; props->timestamp_mask = 0xFFFFFFFFFFFFULL; - if (!mlx4_is_slave(dev->dev)) - err = mlx4_get_internal_clock_params(dev->dev, &clock_params); - if (uhw->outlen >= resp.response_length + sizeof(resp.hca_core_clock_offset)) { resp.response_length += sizeof(resp.hca_core_clock_offset); - if (!err && !mlx4_is_slave(dev->dev)) { + if (!mlx4_get_internal_clock_params(dev->dev, &clock_params)) { resp.comp_mask |= QUERY_DEVICE_RESP_MASK_TIMESTAMP; resp.hca_core_clock_offset = clock_params.offset % PAGE_SIZE; } From owner-dev-commits-src-all@freebsd.org Mon Jul 26 16:14: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 5396C66F86D; Mon, 26 Jul 2021 16:14: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 4GYQ3L4khGz3px7; Mon, 26 Jul 2021 16:14: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 C5A961A297; Mon, 26 Jul 2021 16:14: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 16QGE2UO006243; Mon, 26 Jul 2021 16:14:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGE2oB006242; Mon, 26 Jul 2021 16:14:02 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:14:02 GMT Message-Id: <202107261614.16QGE2oB006242@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 2b4db9bbc23b - stable/13 - mlx5: Fix for uninitialized "uid" field. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 2b4db9bbc23b1a3030ba44d5fb174f6e031be39d 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, 26 Jul 2021 16:14:09 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=2b4db9bbc23b1a3030ba44d5fb174f6e031be39d commit 2b4db9bbc23b1a3030ba44d5fb174f6e031be39d Author: Hans Petter Selasky AuthorDate: 2021-06-21 13:41:11 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:33 +0000 mlx5: Fix for uninitialized "uid" field. Make sure the "uid" field gets properly set when destroying DCT and QP objects by making a copy of the field when creating such objects. Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit cbf6911e10d7ed4e772affdd03cb4d439669acbd) --- sys/dev/mlx5/driver.h | 1 + sys/dev/mlx5/mlx5_core/mlx5_qp.c | 90 +++++++++++++++++++++++++++++----------- sys/dev/mlx5/mlx5_ifc.h | 34 +++++++-------- sys/dev/mlx5/qp.h | 1 + 4 files changed, 84 insertions(+), 42 deletions(-) diff --git a/sys/dev/mlx5/driver.h b/sys/dev/mlx5/driver.h index c36380505fbb..d21a4aa075c0 100644 --- a/sys/dev/mlx5/driver.h +++ b/sys/dev/mlx5/driver.h @@ -805,6 +805,7 @@ struct mlx5_core_dct { struct completion drained; struct mlx5_rsc_debug *dbg; int pid; + u16 uid; }; enum { diff --git a/sys/dev/mlx5/mlx5_core/mlx5_qp.c b/sys/dev/mlx5/mlx5_core/mlx5_qp.c index c5fb95cc2d2b..441c005b9920 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_qp.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_qp.c @@ -133,6 +133,7 @@ int mlx5_core_create_qp(struct mlx5_core_dev *dev, if (err) return err; + qp->uid = MLX5_GET(create_qp_in, in, uid); qp->qpn = MLX5_GET(create_qp_out, out, qpn); mlx5_core_dbg(dev, "qpn = 0x%x\n", qp->qpn); @@ -145,8 +146,9 @@ int mlx5_core_create_qp(struct mlx5_core_dev *dev, return 0; err_cmd: - MLX5_SET(destroy_qp_in, in, opcode, MLX5_CMD_OP_DESTROY_QP); - MLX5_SET(destroy_qp_in, in, qpn, qp->qpn); + MLX5_SET(destroy_qp_in, din, opcode, MLX5_CMD_OP_DESTROY_QP); + MLX5_SET(destroy_qp_in, din, qpn, qp->qpn); + MLX5_SET(destroy_qp_in, din, uid, qp->uid); mlx5_cmd_exec(dev, din, sizeof(din), dout, sizeof(dout)); return err; } @@ -164,6 +166,7 @@ int mlx5_core_destroy_qp(struct mlx5_core_dev *dev, MLX5_SET(destroy_qp_in, in, opcode, MLX5_CMD_OP_DESTROY_QP); MLX5_SET(destroy_qp_in, in, qpn, qp->qpn); + MLX5_SET(destroy_qp_in, in, uid, qp->uid); err = mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out)); if (err) return err; @@ -203,33 +206,40 @@ static void mbox_free(struct mbox_info *mbox) static int modify_qp_mbox_alloc(struct mlx5_core_dev *dev, u16 opcode, int qpn, u32 opt_param_mask, void *qpc, - struct mbox_info *mbox) + struct mbox_info *mbox, u16 uid) { mbox->out = NULL; mbox->in = NULL; - #define MBOX_ALLOC(mbox, typ) \ - mbox_alloc(mbox, MLX5_ST_SZ_BYTES(typ##_in), MLX5_ST_SZ_BYTES(typ##_out)) +#define MBOX_ALLOC(mbox, typ) \ + mbox_alloc(mbox, MLX5_ST_SZ_BYTES(typ##_in), MLX5_ST_SZ_BYTES(typ##_out)) - #define MOD_QP_IN_SET(typ, in, _opcode, _qpn) \ - MLX5_SET(typ##_in, in, opcode, _opcode); \ - MLX5_SET(typ##_in, in, qpn, _qpn) - #define MOD_QP_IN_SET_QPC(typ, in, _opcode, _qpn, _opt_p, _qpc) \ - MOD_QP_IN_SET(typ, in, _opcode, _qpn); \ - MLX5_SET(typ##_in, in, opt_param_mask, _opt_p); \ - memcpy(MLX5_ADDR_OF(typ##_in, in, qpc), _qpc, MLX5_ST_SZ_BYTES(qpc)) +#define MOD_QP_IN_SET(typ, in, _opcode, _qpn, _uid) \ + do { \ + MLX5_SET(typ##_in, in, opcode, _opcode); \ + MLX5_SET(typ##_in, in, qpn, _qpn); \ + MLX5_SET(typ##_in, in, uid, _uid); \ + } while (0) + +#define MOD_QP_IN_SET_QPC(typ, in, _opcode, _qpn, _opt_p, _qpc, _uid) \ + do { \ + MOD_QP_IN_SET(typ, in, _opcode, _qpn, _uid); \ + MLX5_SET(typ##_in, in, opt_param_mask, _opt_p); \ + memcpy(MLX5_ADDR_OF(typ##_in, in, qpc), _qpc, \ + MLX5_ST_SZ_BYTES(qpc)); \ + } while (0) switch (opcode) { /* 2RST & 2ERR */ case MLX5_CMD_OP_2RST_QP: if (MBOX_ALLOC(mbox, qp_2rst)) return -ENOMEM; - MOD_QP_IN_SET(qp_2rst, mbox->in, opcode, qpn); + MOD_QP_IN_SET(qp_2rst, mbox->in, opcode, qpn, uid); break; case MLX5_CMD_OP_2ERR_QP: if (MBOX_ALLOC(mbox, qp_2err)) return -ENOMEM; - MOD_QP_IN_SET(qp_2err, mbox->in, opcode, qpn); + MOD_QP_IN_SET(qp_2err, mbox->in, opcode, qpn, uid); break; /* MODIFY with QPC */ @@ -237,37 +247,37 @@ static int modify_qp_mbox_alloc(struct mlx5_core_dev *dev, u16 opcode, int qpn, if (MBOX_ALLOC(mbox, rst2init_qp)) return -ENOMEM; MOD_QP_IN_SET_QPC(rst2init_qp, mbox->in, opcode, qpn, - opt_param_mask, qpc); + opt_param_mask, qpc, uid); break; case MLX5_CMD_OP_INIT2RTR_QP: if (MBOX_ALLOC(mbox, init2rtr_qp)) return -ENOMEM; MOD_QP_IN_SET_QPC(init2rtr_qp, mbox->in, opcode, qpn, - opt_param_mask, qpc); + opt_param_mask, qpc, uid); break; case MLX5_CMD_OP_RTR2RTS_QP: if (MBOX_ALLOC(mbox, rtr2rts_qp)) return -ENOMEM; MOD_QP_IN_SET_QPC(rtr2rts_qp, mbox->in, opcode, qpn, - opt_param_mask, qpc); + opt_param_mask, qpc, uid); break; case MLX5_CMD_OP_RTS2RTS_QP: if (MBOX_ALLOC(mbox, rts2rts_qp)) return -ENOMEM; MOD_QP_IN_SET_QPC(rts2rts_qp, mbox->in, opcode, qpn, - opt_param_mask, qpc); + opt_param_mask, qpc, uid); break; case MLX5_CMD_OP_SQERR2RTS_QP: if (MBOX_ALLOC(mbox, sqerr2rts_qp)) return -ENOMEM; MOD_QP_IN_SET_QPC(sqerr2rts_qp, mbox->in, opcode, qpn, - opt_param_mask, qpc); + opt_param_mask, qpc, uid); break; case MLX5_CMD_OP_INIT2INIT_QP: if (MBOX_ALLOC(mbox, init2init_qp)) return -ENOMEM; MOD_QP_IN_SET_QPC(init2init_qp, mbox->in, opcode, qpn, - opt_param_mask, qpc); + opt_param_mask, qpc, uid); break; default: mlx5_core_err(dev, "Unknown transition for modify QP: OP(0x%x) QPN(0x%x)\n", @@ -287,7 +297,7 @@ int mlx5_core_qp_modify(struct mlx5_core_dev *dev, u16 opcode, int err; err = modify_qp_mbox_alloc(dev, opcode, qp->qpn, - opt_param_mask, qpc, &mbox); + opt_param_mask, qpc, &mbox, qp->uid); if (err) return err; @@ -367,6 +377,7 @@ int mlx5_core_create_dct(struct mlx5_core_dev *dev, } dct->dctn = MLX5_GET(create_dct_out, out, dctn); + dct->uid = MLX5_GET(create_dct_in, in, uid); dct->common.res = MLX5_RES_DCT; spin_lock_irq(&table->lock); @@ -386,6 +397,7 @@ int mlx5_core_create_dct(struct mlx5_core_dev *dev, err_cmd: MLX5_SET(destroy_dct_in, din, opcode, MLX5_CMD_OP_DESTROY_DCT); MLX5_SET(destroy_dct_in, din, dctn, dct->dctn); + MLX5_SET(destroy_dct_in, din, uid, dct->uid); mlx5_cmd_exec(dev, &din, sizeof(din), dout, sizeof(dout)); return err; @@ -400,6 +412,7 @@ static int mlx5_core_drain_dct(struct mlx5_core_dev *dev, MLX5_SET(drain_dct_in, in, opcode, MLX5_CMD_OP_DRAIN_DCT); MLX5_SET(drain_dct_in, in, dctn, dct->dctn); + MLX5_SET(drain_dct_in, in, uid, dct->uid); return mlx5_cmd_exec(dev, (void *)&in, sizeof(in), (void *)&out, sizeof(out)); } @@ -437,6 +450,7 @@ free_dct: MLX5_SET(destroy_dct_in, in, opcode, MLX5_CMD_OP_DESTROY_DCT); MLX5_SET(destroy_dct_in, in, dctn, dct->dctn); + MLX5_SET(destroy_dct_in, in, uid, dct->uid); return mlx5_cmd_exec(dev, (void *)&in, sizeof(in), (void *)&out, sizeof(out)); @@ -469,6 +483,17 @@ int mlx5_core_arm_dct(struct mlx5_core_dev *dev, struct mlx5_core_dct *dct) } EXPORT_SYMBOL_GPL(mlx5_core_arm_dct); +static void destroy_rq_tracked(struct mlx5_core_dev *dev, u32 rqn, u16 uid) +{ + u32 in[MLX5_ST_SZ_DW(destroy_rq_in)] = {}; + u32 out[MLX5_ST_SZ_DW(destroy_rq_out)] = {}; + + MLX5_SET(destroy_rq_in, in, opcode, MLX5_CMD_OP_DESTROY_RQ); + MLX5_SET(destroy_rq_in, in, rqn, rqn); + MLX5_SET(destroy_rq_in, in, uid, uid); + mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out)); +} + int mlx5_core_create_rq_tracked(struct mlx5_core_dev *dev, u32 *in, int inlen, struct mlx5_core_qp *rq) { @@ -478,9 +503,11 @@ int mlx5_core_create_rq_tracked(struct mlx5_core_dev *dev, u32 *in, int inlen, if (err) return err; + rq->uid = MLX5_GET(create_rq_in, in, uid); + err = create_qprqsq_common(dev, rq, MLX5_RES_RQ); if (err) - mlx5_core_destroy_rq(dev, rq->qpn); + destroy_rq_tracked(dev, rq->qpn, rq->uid); return err; } @@ -490,10 +517,21 @@ void mlx5_core_destroy_rq_tracked(struct mlx5_core_dev *dev, struct mlx5_core_qp *rq) { destroy_qprqsq_common(dev, rq, MLX5_RES_RQ); - mlx5_core_destroy_rq(dev, rq->qpn); + destroy_rq_tracked(dev, rq->qpn, rq->uid); } EXPORT_SYMBOL(mlx5_core_destroy_rq_tracked); +static void destroy_sq_tracked(struct mlx5_core_dev *dev, u32 sqn, u16 uid) +{ + u32 in[MLX5_ST_SZ_DW(destroy_sq_in)] = {}; + u32 out[MLX5_ST_SZ_DW(destroy_sq_out)] = {}; + + MLX5_SET(destroy_sq_in, in, opcode, MLX5_CMD_OP_DESTROY_SQ); + MLX5_SET(destroy_sq_in, in, sqn, sqn); + MLX5_SET(destroy_sq_in, in, uid, uid); + mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out)); +} + int mlx5_core_create_sq_tracked(struct mlx5_core_dev *dev, u32 *in, int inlen, struct mlx5_core_qp *sq) { @@ -503,9 +541,11 @@ int mlx5_core_create_sq_tracked(struct mlx5_core_dev *dev, u32 *in, int inlen, if (err) return err; + sq->uid = MLX5_GET(create_sq_in, in, uid); + err = create_qprqsq_common(dev, sq, MLX5_RES_SQ); if (err) - mlx5_core_destroy_sq(dev, sq->qpn); + destroy_sq_tracked(dev, sq->qpn, sq->uid); return err; } @@ -515,6 +555,6 @@ void mlx5_core_destroy_sq_tracked(struct mlx5_core_dev *dev, struct mlx5_core_qp *sq) { destroy_qprqsq_common(dev, sq, MLX5_RES_SQ); - mlx5_core_destroy_sq(dev, sq->qpn); + destroy_sq_tracked(dev, sq->qpn, sq->uid); } EXPORT_SYMBOL(mlx5_core_destroy_sq_tracked); diff --git a/sys/dev/mlx5/mlx5_ifc.h b/sys/dev/mlx5/mlx5_ifc.h index d44927236f74..865548ed1981 100644 --- a/sys/dev/mlx5/mlx5_ifc.h +++ b/sys/dev/mlx5/mlx5_ifc.h @@ -3492,7 +3492,7 @@ struct mlx5_ifc_sqerr2rts_qp_out_bits { struct mlx5_ifc_sqerr2rts_qp_in_bits { u8 opcode[0x10]; - u8 reserved_0[0x10]; + u8 uid[0x10]; u8 reserved_1[0x10]; u8 op_mod[0x10]; @@ -3877,7 +3877,7 @@ struct mlx5_ifc_rts2rts_qp_out_bits { struct mlx5_ifc_rts2rts_qp_in_bits { u8 opcode[0x10]; - u8 reserved_0[0x10]; + u8 uid[0x10]; u8 reserved_1[0x10]; u8 op_mod[0x10]; @@ -3907,7 +3907,7 @@ struct mlx5_ifc_rtr2rts_qp_out_bits { struct mlx5_ifc_rtr2rts_qp_in_bits { u8 opcode[0x10]; - u8 reserved_0[0x10]; + u8 uid[0x10]; u8 reserved_1[0x10]; u8 op_mod[0x10]; @@ -3937,7 +3937,7 @@ struct mlx5_ifc_rst2init_qp_out_bits { struct mlx5_ifc_rst2init_qp_in_bits { u8 opcode[0x10]; - u8 reserved_0[0x10]; + u8 uid[0x10]; u8 reserved_1[0x10]; u8 op_mod[0x10]; @@ -5255,7 +5255,7 @@ struct mlx5_ifc_qp_2rst_out_bits { struct mlx5_ifc_qp_2rst_in_bits { u8 opcode[0x10]; - u8 reserved_0[0x10]; + u8 uid[0x10]; u8 reserved_1[0x10]; u8 op_mod[0x10]; @@ -5277,7 +5277,7 @@ struct mlx5_ifc_qp_2err_out_bits { struct mlx5_ifc_qp_2err_in_bits { u8 opcode[0x10]; - u8 reserved_0[0x10]; + u8 uid[0x10]; u8 reserved_1[0x10]; u8 op_mod[0x10]; @@ -5971,7 +5971,7 @@ struct mlx5_ifc_init2rtr_qp_out_bits { struct mlx5_ifc_init2rtr_qp_in_bits { u8 opcode[0x10]; - u8 reserved_0[0x10]; + u8 uid[0x10]; u8 reserved_1[0x10]; u8 op_mod[0x10]; @@ -6001,7 +6001,7 @@ struct mlx5_ifc_init2init_qp_out_bits { struct mlx5_ifc_init2init_qp_in_bits { u8 opcode[0x10]; - u8 reserved_0[0x10]; + u8 uid[0x10]; u8 reserved_1[0x10]; u8 op_mod[0x10]; @@ -6118,7 +6118,7 @@ struct mlx5_ifc_drain_dct_out_bits { struct mlx5_ifc_drain_dct_in_bits { u8 opcode[0x10]; - u8 reserved_0[0x10]; + u8 uid[0x10]; u8 reserved_1[0x10]; u8 op_mod[0x10]; @@ -6274,7 +6274,7 @@ struct mlx5_ifc_destroy_sq_out_bits { struct mlx5_ifc_destroy_sq_in_bits { u8 opcode[0x10]; - u8 reserved_0[0x10]; + u8 uid[0x10]; u8 reserved_1[0x10]; u8 op_mod[0x10]; @@ -6346,7 +6346,7 @@ struct mlx5_ifc_destroy_rq_out_bits { struct mlx5_ifc_destroy_rq_in_bits { u8 opcode[0x10]; - u8 reserved_0[0x10]; + u8 uid[0x10]; u8 reserved_1[0x10]; u8 op_mod[0x10]; @@ -6390,7 +6390,7 @@ struct mlx5_ifc_destroy_qp_out_bits { struct mlx5_ifc_destroy_qp_in_bits { u8 opcode[0x10]; - u8 reserved_0[0x10]; + u8 uid[0x10]; u8 reserved_1[0x10]; u8 op_mod[0x10]; @@ -6587,7 +6587,7 @@ struct mlx5_ifc_destroy_dct_out_bits { struct mlx5_ifc_destroy_dct_in_bits { u8 opcode[0x10]; - u8 reserved_0[0x10]; + u8 uid[0x10]; u8 reserved_1[0x10]; u8 op_mod[0x10]; @@ -7050,7 +7050,7 @@ struct mlx5_ifc_create_sq_out_bits { struct mlx5_ifc_create_sq_in_bits { u8 opcode[0x10]; - u8 reserved_0[0x10]; + u8 uid[0x10]; u8 reserved_1[0x10]; u8 op_mod[0x10]; @@ -7132,7 +7132,7 @@ struct mlx5_ifc_create_rq_out_bits { struct mlx5_ifc_create_rq_in_bits { u8 opcode[0x10]; - u8 reserved_0[0x10]; + u8 uid[0x10]; u8 reserved_1[0x10]; u8 op_mod[0x10]; @@ -7180,7 +7180,7 @@ struct mlx5_ifc_create_qp_out_bits { struct mlx5_ifc_create_qp_in_bits { u8 opcode[0x10]; - u8 reserved_0[0x10]; + u8 uid[0x10]; u8 reserved_1[0x10]; u8 op_mod[0x10]; @@ -7452,7 +7452,7 @@ struct mlx5_ifc_create_dct_out_bits { struct mlx5_ifc_create_dct_in_bits { u8 opcode[0x10]; - u8 reserved_0[0x10]; + u8 uid[0x10]; u8 reserved_1[0x10]; u8 op_mod[0x10]; diff --git a/sys/dev/mlx5/qp.h b/sys/dev/mlx5/qp.h index aada3401f7e7..bf9fef73667d 100644 --- a/sys/dev/mlx5/qp.h +++ b/sys/dev/mlx5/qp.h @@ -466,6 +466,7 @@ struct mlx5_core_qp { int qpn; struct mlx5_rsc_debug *dbg; int pid; + u16 uid; }; struct mlx5_qp_path { From owner-dev-commits-src-all@freebsd.org Mon Jul 26 16:14: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 BBA9A66F9BC; Mon, 26 Jul 2021 16:14: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 4GYQ3N1qRlz3pgs; Mon, 26 Jul 2021 16:14: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 15B431A298; Mon, 26 Jul 2021 16:14: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 16QGE4tE006291; Mon, 26 Jul 2021 16:14:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGE4tI006290; Mon, 26 Jul 2021 16:14:04 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:14:04 GMT Message-Id: <202107261614.16QGE4tI006290@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 5f23486df92d - stable/13 - ipoib: Fix for accessing uninitialized pointers and freed memory during attach and detach. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 5f23486df92d476a42d3cc25da7afe35fb6e8269 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, 26 Jul 2021 16:14:10 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=5f23486df92d476a42d3cc25da7afe35fb6e8269 commit 5f23486df92d476a42d3cc25da7afe35fb6e8269 Author: Hans Petter Selasky AuthorDate: 2021-07-12 13:01:19 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:33 +0000 ipoib: Fix for accessing uninitialized pointers and freed memory during attach and detach. Call infiniband_ifdetach() early to stop ifioctl(9) calls from user-space during device removal. Also make sure that ifioctl(9) calls are blocked from executing until the device is fully initialized. Ideally we would delay the infiniband_ifattach() call, but because part of the initialization is to update the link level address, that is not possible without more significant changes. Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit cd2c05d323d272163d04dd94caabe018ca2d4dc5) --- sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c | 34 +++++++++++++++++----- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c index b0f69842ac02..0982af9fb904 100644 --- a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c @@ -278,7 +278,13 @@ ipoib_ioctl(struct ifnet *ifp, u_long command, caddr_t data) int error = 0; /* check if detaching */ - if (priv == NULL || priv->gone != 0) + if (priv == NULL) + return (ENXIO); + /* wait for device to become ready, if any */ + while (priv->gone == 2) + pause("W", 1); + /* check for device gone */ + if (priv->gone != 0) return (ENXIO); switch (command) { @@ -822,7 +828,7 @@ out: } static void -ipoib_detach(struct ipoib_dev_priv *priv) +ipoib_ifdetach(struct ipoib_dev_priv *priv) { struct ifnet *dev; @@ -830,6 +836,16 @@ ipoib_detach(struct ipoib_dev_priv *priv) if (!test_bit(IPOIB_FLAG_SUBINTERFACE, &priv->flags)) { priv->gone = 1; infiniband_ifdetach(dev); + } +} + +static void +ipoib_detach(struct ipoib_dev_priv *priv) +{ + struct ifnet *dev; + + dev = priv->dev; + if (!test_bit(IPOIB_FLAG_SUBINTERFACE, &priv->flags)) { if_free(dev); free_unr(ipoib_unrhdr, priv->unit); } else @@ -845,6 +861,7 @@ ipoib_dev_cleanup(struct ipoib_dev_priv *priv) /* Delete any child interfaces first */ list_for_each_entry_safe(cpriv, tcpriv, &priv->child_intfs, list) { + ipoib_ifdetach(cpriv); ipoib_dev_cleanup(cpriv); ipoib_detach(cpriv); } @@ -897,6 +914,7 @@ ipoib_intf_alloc(const char *name) return NULL; } dev->if_softc = priv; + priv->gone = 2; /* initializing */ priv->unit = alloc_unr(ipoib_unrhdr); if (priv->unit == -1) { if_free(dev); @@ -906,7 +924,7 @@ ipoib_intf_alloc(const char *name) if_initname(dev, name, priv->unit); dev->if_flags = IFF_BROADCAST | IFF_MULTICAST; - infiniband_ifattach(dev, NULL, priv->broadcastaddr); + infiniband_ifattach(priv->dev, NULL, priv->broadcastaddr); dev->if_init = ipoib_init; dev->if_ioctl = ipoib_ioctl; @@ -915,7 +933,7 @@ ipoib_intf_alloc(const char *name) dev->if_snd.ifq_maxlen = ipoib_sendq_size * 2; priv->dev = dev; - if_link_state_change(dev, LINK_STATE_DOWN); + if_link_state_change(priv->dev, LINK_STATE_DOWN); return dev->if_softc; } @@ -1000,7 +1018,7 @@ ipoib_add_port(const char *format, struct ib_device *hca, u8 port) hca->name, port, result); goto device_init_failed; } - memcpy(IF_LLADDR(priv->dev) + 4, priv->local_gid.raw, sizeof (union ib_gid)); + memcpy(IF_LLADDR(priv->dev) + 4, priv->local_gid.raw, sizeof(union ib_gid)); result = ipoib_dev_init(priv, hca, port); if (result < 0) { @@ -1022,12 +1040,15 @@ ipoib_add_port(const char *format, struct ib_device *hca, u8 port) } if_printf(priv->dev, "Attached to %s port %d\n", hca->name, port); + priv->gone = 0; /* ready */ + return priv->dev; event_failed: ipoib_dev_cleanup(priv); device_init_failed: + ipoib_ifdetach(priv); ipoib_detach(priv); alloc_mem_failed: @@ -1088,12 +1109,11 @@ ipoib_remove_one(struct ib_device *device, void *client_data) if (rdma_port_get_link_layer(device, priv->port) != IB_LINK_LAYER_INFINIBAND) continue; + ipoib_ifdetach(priv); ipoib_stop(priv); ib_unregister_event_handler(&priv->event_handler); - /* dev_change_flags(priv->dev, priv->dev->flags & ~IFF_UP); */ - flush_workqueue(ipoib_workqueue); ipoib_dev_cleanup(priv); From owner-dev-commits-src-all@freebsd.org Mon Jul 26 16:14: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 B087966F94E; Mon, 26 Jul 2021 16:14: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 4GYQ3N0SRxz3ppk; Mon, 26 Jul 2021 16:14: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 D8FE919EBA; Mon, 26 Jul 2021 16:14: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 16QGE3DH006267; Mon, 26 Jul 2021 16:14:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGE3vo006266; Mon, 26 Jul 2021 16:14:03 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:14:03 GMT Message-Id: <202107261614.16QGE3vo006266@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 5b803f682001 - stable/13 - mlx5: Numa domain improvements. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 5b803f68200198ee3c014d34f3bd8e1eec172a69 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, 26 Jul 2021 16:14:10 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=5b803f68200198ee3c014d34f3bd8e1eec172a69 commit 5b803f68200198ee3c014d34f3bd8e1eec172a69 Author: Hans Petter Selasky AuthorDate: 2021-06-21 13:42:20 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:33 +0000 mlx5: Numa domain improvements. Properly allocate all mlx5en(4) structures from correct numa domain. While at it cleanup unused numa domain integers deriving from the Linux version of mlx5en(4). Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 7c3eff94bda8bb746bfa7a5edc81b014e2dc97f6) --- sys/dev/mlx5/driver.h | 10 ++++++---- sys/dev/mlx5/mlx5_core/mlx5_alloc.c | 13 +++---------- sys/dev/mlx5/mlx5_core/mlx5_main.c | 16 +++++++++------- sys/dev/mlx5/mlx5_core/mlx5_wq.c | 21 +++++++++------------ sys/dev/mlx5/mlx5_core/wq.h | 2 -- sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 28 ++++++++++++---------------- sys/dev/mlx5/mlx5_en/mlx5_en_rl.c | 10 ++++------ 7 files changed, 43 insertions(+), 57 deletions(-) diff --git a/sys/dev/mlx5/driver.h b/sys/dev/mlx5/driver.h index d21a4aa075c0..614a308e8e2f 100644 --- a/sys/dev/mlx5/driver.h +++ b/sys/dev/mlx5/driver.h @@ -985,8 +985,6 @@ void mlx5_drain_health_recovery(struct mlx5_core_dev *dev); void mlx5_trigger_health_work(struct mlx5_core_dev *dev); void mlx5_trigger_health_watchdog(struct mlx5_core_dev *dev); -#define mlx5_buf_alloc_node(dev, size, direct, buf, node) \ - mlx5_buf_alloc(dev, size, direct, buf) int mlx5_buf_alloc(struct mlx5_core_dev *dev, int size, int max_direct, struct mlx5_buf *buf); void mlx5_buf_free(struct mlx5_core_dev *dev, struct mlx5_buf *buf); @@ -1072,10 +1070,14 @@ void mlx5_eq_debugfs_cleanup(struct mlx5_core_dev *dev); int mlx5_cq_debugfs_init(struct mlx5_core_dev *dev); void mlx5_cq_debugfs_cleanup(struct mlx5_core_dev *dev); int mlx5_db_alloc(struct mlx5_core_dev *dev, struct mlx5_db *db); -int mlx5_db_alloc_node(struct mlx5_core_dev *dev, struct mlx5_db *db, - int node); void mlx5_db_free(struct mlx5_core_dev *dev, struct mlx5_db *db); +static inline struct domainset * +mlx5_dev_domainset(struct mlx5_core_dev *mdev) +{ + return (linux_get_vm_domain_set(mdev->priv.numa_node)); +} + const char *mlx5_command_str(int command); int mlx5_cmdif_debugfs_init(struct mlx5_core_dev *dev); void mlx5_cmdif_debugfs_cleanup(struct mlx5_core_dev *dev); diff --git a/sys/dev/mlx5/mlx5_core/mlx5_alloc.c b/sys/dev/mlx5/mlx5_core/mlx5_alloc.c index 1dabbd9f586f..99e39b80a4ec 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_alloc.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_alloc.c @@ -147,8 +147,7 @@ void mlx5_buf_free(struct mlx5_core_dev *dev, struct mlx5_buf *buf) } EXPORT_SYMBOL_GPL(mlx5_buf_free); -static struct mlx5_db_pgdir *mlx5_alloc_db_pgdir(struct mlx5_core_dev *dev, - int node) +static struct mlx5_db_pgdir *mlx5_alloc_db_pgdir(struct mlx5_core_dev *dev) { struct mlx5_db_pgdir *pgdir; @@ -199,7 +198,7 @@ static int mlx5_alloc_db_from_pgdir(struct mlx5_db_pgdir *pgdir, return 0; } -int mlx5_db_alloc_node(struct mlx5_core_dev *dev, struct mlx5_db *db, int node) +int mlx5_db_alloc(struct mlx5_core_dev *dev, struct mlx5_db *db) { struct mlx5_db_pgdir *pgdir; int ret = 0; @@ -210,7 +209,7 @@ int mlx5_db_alloc_node(struct mlx5_core_dev *dev, struct mlx5_db *db, int node) if (!mlx5_alloc_db_from_pgdir(pgdir, db)) goto out; - pgdir = mlx5_alloc_db_pgdir(dev, node); + pgdir = mlx5_alloc_db_pgdir(dev); if (!pgdir) { ret = -ENOMEM; goto out; @@ -226,12 +225,6 @@ out: return ret; } -EXPORT_SYMBOL_GPL(mlx5_db_alloc_node); - -int mlx5_db_alloc(struct mlx5_core_dev *dev, struct mlx5_db *db) -{ - return mlx5_db_alloc_node(dev, db, dev->priv.numa_node); -} EXPORT_SYMBOL_GPL(mlx5_db_alloc); void mlx5_db_free(struct mlx5_core_dev *dev, struct mlx5_db *db) diff --git a/sys/dev/mlx5/mlx5_core/mlx5_main.c b/sys/dev/mlx5/mlx5_core/mlx5_main.c index 755e8844a892..7527af524456 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_main.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_main.c @@ -82,8 +82,6 @@ SYSCTL_INT(_hw_mlx5, OID_AUTO, fast_unload_enabled, CTLFLAG_RWTUN, &mlx5_fast_unload_enabled, 0, "Set to enable fast unload. Clear to disable."); -#define NUMA_NO_NODE -1 - static LIST_HEAD(intf_list); static LIST_HEAD(dev_list); static DEFINE_MUTEX(intf_mutex); @@ -653,7 +651,7 @@ static int alloc_comp_eqs(struct mlx5_core_dev *dev) ncomp_vec = table->num_comp_vectors; nent = MLX5_COMP_EQ_SIZE; for (i = 0; i < ncomp_vec; i++) { - eq = kzalloc(sizeof(*eq), GFP_KERNEL); + eq = kzalloc_node(sizeof(*eq), GFP_KERNEL, dev->priv.numa_node); err = mlx5_create_map_eq(dev, eq, i + MLX5_EQ_VEC_COMP_BASE, nent, 0); @@ -715,7 +713,7 @@ static void mlx5_add_device(struct mlx5_interface *intf, struct mlx5_priv *priv) struct mlx5_device_context *dev_ctx; struct mlx5_core_dev *dev = container_of(priv, struct mlx5_core_dev, priv); - dev_ctx = kzalloc(sizeof(*dev_ctx), GFP_KERNEL); + dev_ctx = kzalloc_node(sizeof(*dev_ctx), GFP_KERNEL, priv->numa_node); if (!dev_ctx) return; @@ -869,8 +867,6 @@ static int mlx5_pci_init(struct mlx5_core_dev *dev, struct mlx5_priv *priv) INIT_LIST_HEAD(&priv->pgdir_list); spin_lock_init(&priv->mkey_lock); - priv->numa_node = NUMA_NO_NODE; - err = mlx5_pci_enable_device(dev); if (err) { mlx5_core_err(dev, "Cannot enable PCI device, aborting\n"); @@ -1314,14 +1310,20 @@ static int init_one(struct pci_dev *pdev, int num_vfs, sriov_pos; #endif int i,err; + int numa_node; struct sysctl_oid *pme_sysctl_node; struct sysctl_oid *pme_err_sysctl_node; struct sysctl_oid *cap_sysctl_node; struct sysctl_oid *current_cap_sysctl_node; struct sysctl_oid *max_cap_sysctl_node; - dev = kzalloc(sizeof(*dev), GFP_KERNEL); + numa_node = dev_to_node(&pdev->dev); + + dev = kzalloc_node(sizeof(*dev), GFP_KERNEL, numa_node); + priv = &dev->priv; + priv->numa_node = numa_node; + if (id) priv->pci_dev_data = id->driver_data; diff --git a/sys/dev/mlx5/mlx5_core/mlx5_wq.c b/sys/dev/mlx5/mlx5_core/mlx5_wq.c index 6cbb7c0000ae..131ed9bfce2a 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_wq.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_wq.c @@ -69,15 +69,14 @@ int mlx5_wq_cyc_create(struct mlx5_core_dev *mdev, struct mlx5_wq_param *param, wq->log_stride = MLX5_GET(wq, wqc, log_wq_stride); wq->sz_m1 = (1 << MLX5_GET(wq, wqc, log_wq_sz)) - 1; - err = mlx5_db_alloc_node(mdev, &wq_ctrl->db, param->db_numa_node); + err = mlx5_db_alloc(mdev, &wq_ctrl->db); if (err) { mlx5_core_warn(mdev, "mlx5_db_alloc() failed, %d\n", err); return err; } - err = mlx5_buf_alloc_node(mdev, mlx5_wq_cyc_get_byte_size(wq), - max_direct, &wq_ctrl->buf, - param->buf_numa_node); + err = mlx5_buf_alloc(mdev, mlx5_wq_cyc_get_byte_size(wq), + max_direct, &wq_ctrl->buf); if (err) { mlx5_core_warn(mdev, "mlx5_buf_alloc() failed, %d\n", err); goto err_db_free; @@ -107,15 +106,14 @@ int mlx5_cqwq_create(struct mlx5_core_dev *mdev, struct mlx5_wq_param *param, wq->log_sz = MLX5_GET(cqc, cqc, log_cq_size); wq->sz_m1 = (1 << wq->log_sz) - 1; - err = mlx5_db_alloc_node(mdev, &wq_ctrl->db, param->db_numa_node); + err = mlx5_db_alloc(mdev, &wq_ctrl->db); if (err) { mlx5_core_warn(mdev, "mlx5_db_alloc() failed, %d\n", err); return err; } - err = mlx5_buf_alloc_node(mdev, mlx5_cqwq_get_byte_size(wq), - max_direct, &wq_ctrl->buf, - param->buf_numa_node); + err = mlx5_buf_alloc(mdev, mlx5_cqwq_get_byte_size(wq), + max_direct, &wq_ctrl->buf); if (err) { mlx5_core_warn(mdev, "mlx5_buf_alloc() failed, %d\n", err); goto err_db_free; @@ -146,15 +144,14 @@ int mlx5_wq_ll_create(struct mlx5_core_dev *mdev, struct mlx5_wq_param *param, wq->log_stride = MLX5_GET(wq, wqc, log_wq_stride); wq->sz_m1 = (1 << MLX5_GET(wq, wqc, log_wq_sz)) - 1; - err = mlx5_db_alloc_node(mdev, &wq_ctrl->db, param->db_numa_node); + err = mlx5_db_alloc(mdev, &wq_ctrl->db); if (err) { mlx5_core_warn(mdev, "mlx5_db_alloc() failed, %d\n", err); return err; } - err = mlx5_buf_alloc_node(mdev, mlx5_wq_ll_get_byte_size(wq), - max_direct, &wq_ctrl->buf, - param->buf_numa_node); + err = mlx5_buf_alloc(mdev, mlx5_wq_ll_get_byte_size(wq), + max_direct, &wq_ctrl->buf); if (err) { mlx5_core_warn(mdev, "mlx5_buf_alloc() failed, %d\n", err); goto err_db_free; diff --git a/sys/dev/mlx5/mlx5_core/wq.h b/sys/dev/mlx5/mlx5_core/wq.h index 13f26b0dd9a1..f513e4d7f6b4 100644 --- a/sys/dev/mlx5/mlx5_core/wq.h +++ b/sys/dev/mlx5/mlx5_core/wq.h @@ -32,8 +32,6 @@ struct mlx5_wq_param { int linear; - int buf_numa_node; - int db_numa_node; }; struct mlx5_wq_ctrl { diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index 9345798006f2..170fb03be968 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -1261,7 +1261,8 @@ mlx5e_create_rq(struct mlx5e_channel *c, if (err) goto err_rq_wq_destroy; - rq->mbuf = malloc(wq_sz * sizeof(rq->mbuf[0]), M_MLX5EN, M_WAITOK | M_ZERO); + rq->mbuf = malloc_domainset(wq_sz * sizeof(rq->mbuf[0]), M_MLX5EN, + mlx5_dev_domainset(mdev), M_WAITOK | M_ZERO); for (i = 0; i != wq_sz; i++) { struct mlx5e_rx_wqe *wqe = mlx5_wq_ll_get_wqe(&rq->wq, i); int j; @@ -1525,7 +1526,8 @@ mlx5e_alloc_sq_db(struct mlx5e_sq *sq) int err; int x; - sq->mbuf = malloc(wq_sz * sizeof(sq->mbuf[0]), M_MLX5EN, M_WAITOK | M_ZERO); + sq->mbuf = malloc_domainset(wq_sz * sizeof(sq->mbuf[0]), M_MLX5EN, + mlx5_dev_domainset(sq->priv->mdev), M_WAITOK | M_ZERO); /* Create DMA descriptor MAPs */ for (x = 0; x != wq_sz; x++) { @@ -1619,6 +1621,11 @@ mlx5e_create_sq(struct mlx5e_channel *c, &sq->dma_tag))) goto done; + sq->mkey_be = cpu_to_be32(priv->mr.key); + sq->ifp = priv->ifp; + sq->priv = priv; + sq->tc = tc; + err = mlx5_wq_cyc_create(mdev, ¶m->wq, sqc_wq, &sq->wq, &sq->wq_ctrl); if (err) @@ -1630,11 +1637,6 @@ mlx5e_create_sq(struct mlx5e_channel *c, if (err) goto err_sq_wq_destroy; - sq->mkey_be = cpu_to_be32(priv->mr.key); - sq->ifp = priv->ifp; - sq->priv = priv; - sq->tc = tc; - mlx5e_update_sq_inline(sq); snprintf(buffer, sizeof(buffer), "txstat%dtc%d", c->ix, tc); @@ -1927,9 +1929,6 @@ mlx5e_create_cq(struct mlx5e_priv *priv, int err; u32 i; - param->wq.buf_numa_node = 0; - param->wq.db_numa_node = 0; - err = mlx5_vector2eqn(mdev, eq_ix, &eqn_not_used, &irqn); if (err) return (err); @@ -2292,8 +2291,6 @@ mlx5e_build_rq_param(struct mlx5e_priv *priv, MLX5_SET(wq, wq, log_wq_sz, priv->params.log_rq_size); MLX5_SET(wq, wq, pd, priv->pdn); - param->wq.buf_numa_node = 0; - param->wq.db_numa_node = 0; param->wq.linear = 1; } @@ -2308,8 +2305,6 @@ mlx5e_build_sq_param(struct mlx5e_priv *priv, MLX5_SET(wq, wq, log_wq_stride, ilog2(MLX5_SEND_WQE_BB)); MLX5_SET(wq, wq, pd, priv->pdn); - param->wq.buf_numa_node = 0; - param->wq.db_numa_node = 0; param->wq.linear = 1; } @@ -4430,13 +4425,14 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) mlx5_core_dbg(mdev, "mlx5e_check_required_hca_cap() failed\n"); return (NULL); } + /* * Try to allocate the priv and make room for worst-case * number of channel structures: */ - priv = malloc(sizeof(*priv) + + priv = malloc_domainset(sizeof(*priv) + (sizeof(priv->channel[0]) * mdev->priv.eq_table.num_comp_vectors), - M_MLX5EN, M_WAITOK | M_ZERO); + M_MLX5EN, mlx5_dev_domainset(mdev), M_WAITOK | M_ZERO); ifp = priv->ifp = if_alloc_dev(IFT_ETHER, mdev->pdev->dev.bsddev); if (ifp == NULL) { diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c b/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c index bd66b8ecd725..fa7b812fbdf1 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c @@ -51,8 +51,6 @@ mlx5e_rl_build_sq_param(struct mlx5e_rl_priv_data *rl, MLX5_SET(wq, wq, log_wq_stride, ilog2(MLX5_SEND_WQE_BB)); MLX5_SET(wq, wq, pd, rl->priv->pdn); - param->wq.buf_numa_node = 0; - param->wq.db_numa_node = 0; param->wq.linear = 1; } @@ -116,6 +114,10 @@ mlx5e_rl_create_sq(struct mlx5e_priv *priv, struct mlx5e_sq *sq, &sq->dma_tag))) goto done; + sq->mkey_be = cpu_to_be32(priv->mr.key); + sq->ifp = priv->ifp; + sq->priv = priv; + err = mlx5_wq_cyc_create(mdev, ¶m->wq, sqc_wq, &sq->wq, &sq->wq_ctrl); if (err) @@ -127,10 +129,6 @@ mlx5e_rl_create_sq(struct mlx5e_priv *priv, struct mlx5e_sq *sq, if (err) goto err_sq_wq_destroy; - sq->mkey_be = cpu_to_be32(priv->mr.key); - sq->ifp = priv->ifp; - sq->priv = priv; - mlx5e_update_sq_inline(sq); return (0); From owner-dev-commits-src-all@freebsd.org Mon Jul 26 16:36: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 1632C670D6B; Mon, 26 Jul 2021 16:36: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 4GYQYY6wmWz4Sc1; Mon, 26 Jul 2021 16:36: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 CCA9B1A88A; Mon, 26 Jul 2021 16:36: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 16QGanGF033557; Mon, 26 Jul 2021 16:36:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGanjT033556; Mon, 26 Jul 2021 16:36:49 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:36:49 GMT Message-Id: <202107261636.16QGanjT033556@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Leandro Lupori Subject: git: 0f47f916811a - main - hwpmc: fix powerpc/powerpcspe builds MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: luporl X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0f47f916811a3cc7e5a5173a1e173442aa9ddef9 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, 26 Jul 2021 16:36:50 -0000 The branch main has been updated by luporl: URL: https://cgit.FreeBSD.org/src/commit/?id=0f47f916811a3cc7e5a5173a1e173442aa9ddef9 commit 0f47f916811a3cc7e5a5173a1e173442aa9ddef9 Author: Leandro Lupori AuthorDate: 2021-07-26 16:29:42 +0000 Commit: Leandro Lupori CommitDate: 2021-07-26 16:29:42 +0000 hwpmc: fix powerpc/powerpcspe builds Fix 32-bit PowerPC build errors introduced by b48a2770d48b. --- sys/dev/hwpmc/hwpmc_powerpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/hwpmc/hwpmc_powerpc.c b/sys/dev/hwpmc/hwpmc_powerpc.c index 3a2115ece3cb..407af94a07e1 100644 --- a/sys/dev/hwpmc/hwpmc_powerpc.c +++ b/sys/dev/hwpmc/hwpmc_powerpc.c @@ -604,7 +604,7 @@ pmc_md_initialize() } /* Set the value for kern.hwpmc.cpuid */ - snprintf(pmc_cpuid, sizeof(pmc_cpuid), "%08lx", mfpvr()); + snprintf(pmc_cpuid, sizeof(pmc_cpuid), "%08jx", (uintmax_t)mfpvr()); return (pmc_mdep); } From owner-dev-commits-src-all@freebsd.org Mon Jul 26 18:18: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 401D567289F; Mon, 26 Jul 2021 18:18: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 4GYSpg1G60z4vCB; Mon, 26 Jul 2021 18:18: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 0370D1BE81; Mon, 26 Jul 2021 18:18: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 16QIIIHM068266; Mon, 26 Jul 2021 18:18:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QIIISW068265; Mon, 26 Jul 2021 18:18:18 GMT (envelope-from git) Date: Mon, 26 Jul 2021 18:18:18 GMT Message-Id: <202107261818.16QIIISW068265@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: a077a4e3b41b - main - Cirrus-CI: report pkg version 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: a077a4e3b41bb676be1237fb0af78d6814393fe7 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, 26 Jul 2021 18:18:19 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=a077a4e3b41bb676be1237fb0af78d6814393fe7 commit a077a4e3b41bb676be1237fb0af78d6814393fe7 Author: Ed Maste AuthorDate: 2021-07-26 17:27:16 +0000 Commit: Ed Maste CommitDate: 2021-07-26 18:17:59 +0000 Cirrus-CI: report pkg version PR: 257422 --- .cirrus.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.cirrus.yml b/.cirrus.yml index 9760695bb654..6e1e515ff84b 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -18,6 +18,7 @@ task: setup_script: - uname -a - df -m + - pkg --version - pw useradd user - mkdir -p /usr/obj/$(pwd -P) - chown user:user /usr/obj/$(pwd -P) From owner-dev-commits-src-all@freebsd.org Mon Jul 26 18:29: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 17866672A14; Mon, 26 Jul 2021 18:29: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 4GYT3q6lbDz3Dxs; Mon, 26 Jul 2021 18:29: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 C7B891BF13; Mon, 26 Jul 2021 18:29: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 16QIThTn081479; Mon, 26 Jul 2021 18:29:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QIThWa081478; Mon, 26 Jul 2021 18:29:43 GMT (envelope-from git) Date: Mon, 26 Jul 2021 18:29:43 GMT Message-Id: <202107261829.16QIThWa081478@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: de273c83a10c - main - linux(4): Fix i386 gcc build. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: de273c83a10c5807b52b7479e477854b77baa912 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, 26 Jul 2021 18:29:44 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=de273c83a10c5807b52b7479e477854b77baa912 commit de273c83a10c5807b52b7479e477854b77baa912 Author: Dmitry Chagin AuthorDate: 2021-07-26 18:28:16 +0000 Commit: Dmitry Chagin CommitDate: 2021-07-26 18:28:16 +0000 linux(4): Fix i386 gcc build. Do not specify memory model for i386. Seems that clang silencly ignores -mcmodel unlike gcc. Reported by: jhb MFC after: 2 weeks --- sys/modules/linux/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/modules/linux/Makefile b/sys/modules/linux/Makefile index 1304c2d91fd8..bf4449e0012e 100644 --- a/sys/modules/linux/Makefile +++ b/sys/modules/linux/Makefile @@ -60,20 +60,20 @@ linux${SFX}_assym.h: linux${SFX}_genassym.o sh ${SYSDIR}/kern/genassym.sh linux${SFX}_genassym.o > ${.TARGET} .if ${MACHINE_CPUARCH} == "amd64" -VDSOFLAGS=-DCOMPAT_FREEBSD32 -DCOMPAT_LINUX32 -m32 +VDSOFLAGS=-DCOMPAT_FREEBSD32 -DCOMPAT_LINUX32 -m32 -mcmodel=small .endif linux${SFX}_locore.o: linux${SFX}_assym.h assym.inc ${CC} -c -x assembler-with-cpp -DLOCORE -fPIC -pipe -O2 -Werror \ -msoft-float -mregparm=0 \ - -mcmodel=small -fno-common -nostdinc -fasynchronous-unwind-tables \ + -fno-common -nostdinc -fasynchronous-unwind-tables \ -fno-omit-frame-pointer -foptimize-sibling-calls ${VDSOFLAGS} \ -fno-stack-protector -I. -I${SYSDIR} -I${SRCTOP}/include \ ${.IMPSRC} -o ${.TARGET} linux${SFX}_vdso_gtod.o: linux_vdso_gtod.inc ${VDSODEPS} ${CC} -c -fPIC -pipe -O2 -Werror -msoft-float -mregparm=0 \ - -mcmodel=small -fno-common -nostdinc -fasynchronous-unwind-tables \ + -fno-common -nostdinc -fasynchronous-unwind-tables \ -fno-omit-frame-pointer -foptimize-sibling-calls ${VDSOFLAGS} \ -fno-stack-protector -I. -I${SYSDIR} -I${SRCTOP}/include \ ${.IMPSRC} -o ${.TARGET} From owner-dev-commits-src-all@freebsd.org Mon Jul 26 18:37: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 B4C2E672CE9 for ; Mon, 26 Jul 2021 18:37:53 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) (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 4GYTFF2GhXz3H8y for ; Mon, 26 Jul 2021 18:37:53 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wr1-f45.google.com with SMTP id l18so4561334wrv.5 for ; Mon, 26 Jul 2021 11:37:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=hQzUd1O+E/RvPXed/46Oa/irbsLN4iwCICZjVrp+N4Y=; b=KKYgsASXl+Idl1R5C51CkUi6TMhi1ARu/Nd795HEw2ZxQuxpFzHzH77v11scRRmi7M le/xq5BDp8P7rY/+P+8pUlP4tvlRIRlknSTNqWu5xyukGXnrNpJ7N1DeGZTsrLbga8Wv onaYI2oo9jp3e5wFW2zQxnSHvAZmMEaHsYzuTXXV0zsoTSEGOKIVBHakcmELjvd5EYB5 Bet4DXlL0+CIKESWzeF0UyWNS34uiSrg7OcdOs/2WcZA8dfLVr91jKLoYYgWQH49lauH EFZ3EHYF0PNgu0hpr425YNyYlUg+/6O0m1Y/VLvNblm0KdO1mhtHcPOLiOopHiuU/L+X f0rw== X-Gm-Message-State: AOAM531MijYnYIRDRpvS0pY6hcHN2g/heIr8z3MkVN5C54NEQi5B+TJe PZ3xP3Qy5T5meYetA4yKilQ/kk7j+u2obA== X-Google-Smtp-Source: ABdhPJzvV9jT6yTHOk9Ir+YxW1IiPyiv9aPQWqBMvsyhX0MiR58W8EKfuM7UZ+kdTqm/6cGoAaSJ7A== X-Received: by 2002:adf:82d2:: with SMTP id 76mr20760068wrc.5.1627324666607; Mon, 26 Jul 2021 11:37:46 -0700 (PDT) Received: from smtpclient.apple (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id s6sm748260wrt.45.2021.07.26.11.37.45 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Jul 2021 11:37:46 -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: de273c83a10c - main - linux(4): Fix i386 gcc build. From: Jessica Clarke In-Reply-To: <202107261829.16QIThWa081478@gitrepo.freebsd.org> Date: Mon, 26 Jul 2021 19:37:45 +0100 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: References: <202107261829.16QIThWa081478@gitrepo.freebsd.org> To: Dmitry Chagin X-Mailer: Apple Mail (2.3654.100.0.2.22) X-Rspamd-Queue-Id: 4GYTFF2GhXz3H8y 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, 26 Jul 2021 18:37:53 -0000 On 26 Jul 2021, at 19:29, Dmitry Chagin wrote: >=20 > The branch main has been updated by dchagin: >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3Dde273c83a10c5807b52b7479e477854b= 77baa912 >=20 > commit de273c83a10c5807b52b7479e477854b77baa912 > Author: Dmitry Chagin > AuthorDate: 2021-07-26 18:28:16 +0000 > Commit: Dmitry Chagin > CommitDate: 2021-07-26 18:28:16 +0000 >=20 > linux(4): Fix i386 gcc build. >=20 > Do not specify memory model for i386. Seems that clang silencly > ignores -mcmodel unlike gcc. >=20 > Reported by: jhb > MFC after: 2 weeks > --- > sys/modules/linux/Makefile | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) >=20 > diff --git a/sys/modules/linux/Makefile b/sys/modules/linux/Makefile > index 1304c2d91fd8..bf4449e0012e 100644 > --- a/sys/modules/linux/Makefile > +++ b/sys/modules/linux/Makefile > @@ -60,20 +60,20 @@ linux${SFX}_assym.h: linux${SFX}_genassym.o > sh ${SYSDIR}/kern/genassym.sh linux${SFX}_genassym.o > = ${.TARGET} >=20 > .if ${MACHINE_CPUARCH} =3D=3D "amd64" > -VDSOFLAGS=3D-DCOMPAT_FREEBSD32 -DCOMPAT_LINUX32 -m32 > +VDSOFLAGS=3D-DCOMPAT_FREEBSD32 -DCOMPAT_LINUX32 -m32 -mcmodel=3Dsmall This just shifts the problem. You=E2=80=99ve fixed it if building an = i386 kernel, but not if building an amd64 kernel with linux32 support. This line should just be reverted and everything should work fine. Jess From owner-dev-commits-src-all@freebsd.org Mon Jul 26 18:57: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 9A4A16731B1; Mon, 26 Jul 2021 18:57:05 +0000 (UTC) (envelope-from dchagin@heemeyer.club) Received: from heemeyer.club (heemeyer.club [IPv6:2001:19f0:6400:80a1:5054:ff:fe7a:a27d]) (using TLSv1.3 with cipher TLS_AES_256_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 4GYTgP3K2Fz3Mpn; Mon, 26 Jul 2021 18:57:05 +0000 (UTC) (envelope-from dchagin@heemeyer.club) Received: from heemeyer.club (localhost [127.0.0.1]) by heemeyer.club (8.16.1/8.16.1) with ESMTP id 16QIuuvC054697; Mon, 26 Jul 2021 21:56:56 +0300 (MSK) (envelope-from dchagin@heemeyer.club) Received: (from dchagin@localhost) by heemeyer.club (8.16.1/8.16.1/Submit) id 16QIuuGH054696; Mon, 26 Jul 2021 21:56:56 +0300 (MSK) (envelope-from dchagin) Date: Mon, 26 Jul 2021 21:56:56 +0300 From: Dmitry Chagin To: Jessica Clarke Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Subject: Re: git: de273c83a10c - main - linux(4): Fix i386 gcc build. Message-ID: References: <202107261829.16QIThWa081478@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Rspamd-Queue-Id: 4GYTgP3K2Fz3Mpn 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, 26 Jul 2021 18:57:05 -0000 On Mon, Jul 26, 2021 at 07:37:45PM +0100, Jessica Clarke wrote: > On 26 Jul 2021, at 19:29, Dmitry Chagin wrote: > > > > The branch main has been updated by dchagin: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=de273c83a10c5807b52b7479e477854b77baa912 > > > > commit de273c83a10c5807b52b7479e477854b77baa912 > > Author: Dmitry Chagin > > AuthorDate: 2021-07-26 18:28:16 +0000 > > Commit: Dmitry Chagin > > CommitDate: 2021-07-26 18:28:16 +0000 > > > > linux(4): Fix i386 gcc build. > > > > Do not specify memory model for i386. Seems that clang silencly > > ignores -mcmodel unlike gcc. > > > > Reported by: jhb > > MFC after: 2 weeks > > --- > > sys/modules/linux/Makefile | 6 +++--- > > 1 file changed, 3 insertions(+), 3 deletions(-) > > > > diff --git a/sys/modules/linux/Makefile b/sys/modules/linux/Makefile > > index 1304c2d91fd8..bf4449e0012e 100644 > > --- a/sys/modules/linux/Makefile > > +++ b/sys/modules/linux/Makefile > > @@ -60,20 +60,20 @@ linux${SFX}_assym.h: linux${SFX}_genassym.o > > sh ${SYSDIR}/kern/genassym.sh linux${SFX}_genassym.o > ${.TARGET} > > > > .if ${MACHINE_CPUARCH} == "amd64" > > -VDSOFLAGS=-DCOMPAT_FREEBSD32 -DCOMPAT_LINUX32 -m32 > > +VDSOFLAGS=-DCOMPAT_FREEBSD32 -DCOMPAT_LINUX32 -m32 -mcmodel=small > > This just shifts the problem. You’ve fixed it if building an i386 > kernel, but not if building an amd64 kernel with linux32 support. > This line should just be reverted and everything should work fine. > Aha, I see, seems that I'm in a command now how builds everything by gcc) From owner-dev-commits-src-all@freebsd.org Mon Jul 26 19:28: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 E3C1A673A02; Mon, 26 Jul 2021 19:28: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 4GYVMm5qbQz3l72; Mon, 26 Jul 2021 19:28: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 AE5161C7EF; Mon, 26 Jul 2021 19:28: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 16QJSaIL061079; Mon, 26 Jul 2021 19:28:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QJSaMw061078; Mon, 26 Jul 2021 19:28:36 GMT (envelope-from git) Date: Mon, 26 Jul 2021 19:28:36 GMT Message-Id: <202107261928.16QJSaMw061078@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: b0fa09a0a7e3 - main - linux(4): Fix amd64 gcc build. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b0fa09a0a7e30f301cc58750dedb3d88ec39992d 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, 26 Jul 2021 19:28:37 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=b0fa09a0a7e30f301cc58750dedb3d88ec39992d commit b0fa09a0a7e30f301cc58750dedb3d88ec39992d Author: Dmitry Chagin AuthorDate: 2021-07-26 19:28:21 +0000 Commit: Dmitry Chagin CommitDate: 2021-07-26 19:28:21 +0000 linux(4): Fix amd64 gcc build. Do not specify memory model and mregparm for amd64, it's only available on IA-32 architecture. Reported by: jhb, jrtc27 MFC after: 2 weeks --- sys/modules/linux/Makefile | 8 +++++--- sys/modules/linux64/Makefile | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/sys/modules/linux/Makefile b/sys/modules/linux/Makefile index bf4449e0012e..373ec3dcae91 100644 --- a/sys/modules/linux/Makefile +++ b/sys/modules/linux/Makefile @@ -60,19 +60,21 @@ linux${SFX}_assym.h: linux${SFX}_genassym.o sh ${SYSDIR}/kern/genassym.sh linux${SFX}_genassym.o > ${.TARGET} .if ${MACHINE_CPUARCH} == "amd64" -VDSOFLAGS=-DCOMPAT_FREEBSD32 -DCOMPAT_LINUX32 -m32 -mcmodel=small +VDSOFLAGS=-DCOMPAT_FREEBSD32 -DCOMPAT_LINUX32 -m32 +.else +VDSOFLAGS=-mregparm=0 .endif linux${SFX}_locore.o: linux${SFX}_assym.h assym.inc ${CC} -c -x assembler-with-cpp -DLOCORE -fPIC -pipe -O2 -Werror \ - -msoft-float -mregparm=0 \ + -msoft-float \ -fno-common -nostdinc -fasynchronous-unwind-tables \ -fno-omit-frame-pointer -foptimize-sibling-calls ${VDSOFLAGS} \ -fno-stack-protector -I. -I${SYSDIR} -I${SRCTOP}/include \ ${.IMPSRC} -o ${.TARGET} linux${SFX}_vdso_gtod.o: linux_vdso_gtod.inc ${VDSODEPS} - ${CC} -c -fPIC -pipe -O2 -Werror -msoft-float -mregparm=0 \ + ${CC} -c -fPIC -pipe -O2 -Werror -msoft-float \ -fno-common -nostdinc -fasynchronous-unwind-tables \ -fno-omit-frame-pointer -foptimize-sibling-calls ${VDSOFLAGS} \ -fno-stack-protector -I. -I${SYSDIR} -I${SRCTOP}/include \ diff --git a/sys/modules/linux64/Makefile b/sys/modules/linux64/Makefile index b85203a9ce93..17192b4f18aa 100644 --- a/sys/modules/linux64/Makefile +++ b/sys/modules/linux64/Makefile @@ -31,7 +31,7 @@ linux_assym.h: linux_genassym.o sh ${SYSDIR}/kern/genassym.sh linux_genassym.o > ${.TARGET} .if ${MACHINE_CPUARCH} == "amd64" -VDSOFLAGS=-mregparm=0 -mcmodel=small -msoft-float +VDSOFLAGS=-mcmodel=small -msoft-float VDSODEPS=linux_vdso_gettc_x86.inc .elif ${MACHINE_CPUARCH} == "aarch64" # The Linux uses tiny memory model, but our ld does not know about From owner-dev-commits-src-all@freebsd.org Mon Jul 26 20:10: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 AA5CB67419B; Mon, 26 Jul 2021 20:10: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 4GYWJ037DLz3vZ0; Mon, 26 Jul 2021 20:10: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 42D501D3D5; Mon, 26 Jul 2021 20:10: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 16QKAOEZ022953; Mon, 26 Jul 2021 20:10:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QKAOSj022952; Mon, 26 Jul 2021 20:10:24 GMT (envelope-from git) Date: Mon, 26 Jul 2021 20:10:24 GMT Message-Id: <202107262010.16QKAOSj022952@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: accff08c2f6a - main - dumpon: Fix unconfiguring netdump with "off" and "/dev/null". 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: accff08c2f6a8d1e36118993db5a792862cc3839 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, 26 Jul 2021 20:10:24 -0000 The branch main has been updated by bdrewery: URL: https://cgit.FreeBSD.org/src/commit/?id=accff08c2f6a8d1e36118993db5a792862cc3839 commit accff08c2f6a8d1e36118993db5a792862cc3839 Author: Bryan Drewery AuthorDate: 2021-07-24 21:18:23 +0000 Commit: Bryan Drewery CommitDate: 2021-07-26 20:08:59 +0000 dumpon: Fix unconfiguring netdump with "off" and "/dev/null". Netdump has its own configuration tracking such that ioctl(/dev/null, DIOCSKERNELDUMP) does a dumper_remove() but does not notify netdump about the removal. Simply sending the same ioctl to /dev/netdump handles the situation. Reviewed by: markj, cem Sponsored by: Dell EMC Differential Revision: https://reviews.freebsd.org/D31300 --- sbin/dumpon/dumpon.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/sbin/dumpon/dumpon.c b/sbin/dumpon/dumpon.c index ef1eb3defc98..e83994d01314 100644 --- a/sbin/dumpon/dumpon.c +++ b/sbin/dumpon/dumpon.c @@ -550,6 +550,24 @@ main(int argc, char *argv[]) } else dev = argv[0]; netdump = false; + + if (strcmp(dev, _PATH_DEVNULL) == 0) { + /* + * Netdump has its own configuration tracking that + * is not removed when using /dev/null. + */ + fd = open(_PATH_NETDUMP, O_RDONLY); + if (fd != -1) { + bzero(&ndconf, sizeof(ndconf)); + ndconf.kda_index = KDA_REMOVE_ALL; + ndconf.kda_af = AF_INET; + error = ioctl(fd, DIOCSKERNELDUMP, &ndconf); + if (error != 0) + err(1, "ioctl(%s, DIOCSKERNELDUMP)", + _PATH_NETDUMP); + close(fd); + } + } } else usage(); From owner-dev-commits-src-all@freebsd.org Mon Jul 26 20:10: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 8AF19673ED0; Mon, 26 Jul 2021 20:10: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 4GYWHz2yvXz3vD8; Mon, 26 Jul 2021 20:10: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 315091D3D4; Mon, 26 Jul 2021 20:10: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 16QKANUk022929; Mon, 26 Jul 2021 20:10:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QKAN02022928; Mon, 26 Jul 2021 20:10:23 GMT (envelope-from git) Date: Mon, 26 Jul 2021 20:10:23 GMT Message-Id: <202107262010.16QKAN02022928@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: 372557d8c3d3 - main - dumpon: Fix -v causing error when configuring an encrypted dump 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: 372557d8c3d37dd0c1d9be56513a436393963848 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, 26 Jul 2021 20:10:23 -0000 The branch main has been updated by bdrewery: URL: https://cgit.FreeBSD.org/src/commit/?id=372557d8c3d37dd0c1d9be56513a436393963848 commit 372557d8c3d37dd0c1d9be56513a436393963848 Author: Bryan Drewery AuthorDate: 2021-07-22 00:37:03 +0000 Commit: Bryan Drewery CommitDate: 2021-07-26 20:08:59 +0000 dumpon: Fix -v causing error when configuring an encrypted dump If -v is specified when adding a new device then a full listing of configured devices is displayed. This requires sysctl access which genkey()'s use of capability mode was blocking permission to access. This leads to both confusing console spam but also incorrectly returning an error status even if no other had been encountered. dumpon: Sysctl get 'kern.shutdown.dumpdevname': Operation not permitted Fix this by generating the key in a child process. Reviewed by: markj Sponsored by: Dell EMC Differential Revision: https://reviews.freebsd.org/D31266 --- sbin/dumpon/dumpon.c | 47 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/sbin/dumpon/dumpon.c b/sbin/dumpon/dumpon.c index 183ce5f08cb3..ef1eb3defc98 100644 --- a/sbin/dumpon/dumpon.c +++ b/sbin/dumpon/dumpon.c @@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -210,7 +211,7 @@ check_size(int fd, const char *fn) #ifdef HAVE_CRYPTO static void -genkey(const char *pubkeyfile, struct diocskerneldump_arg *kdap) +_genkey(const char *pubkeyfile, struct diocskerneldump_arg *kdap) { FILE *fp; RSA *pubkey; @@ -305,6 +306,50 @@ genkey(const char *pubkeyfile, struct diocskerneldump_arg *kdap) } RSA_free(pubkey); } + +/* + * Run genkey() in a child so it can use capability mode without affecting + * the rest of the runtime. + */ +static void +genkey(const char *pubkeyfile, struct diocskerneldump_arg *kdap) +{ + pid_t pid; + int error, filedes[2], status; + ssize_t bytes; + + if (pipe2(filedes, O_CLOEXEC) != 0) + err(1, "pipe"); + pid = fork(); + switch (pid) { + case -1: + err(1, "fork"); + break; + case 0: + close(filedes[0]); + _genkey(pubkeyfile, kdap); + /* Write the new kdap back to the parent. */ + bytes = write(filedes[1], kdap, sizeof(*kdap)); + if (bytes != sizeof(*kdap)) + err(1, "genkey pipe write"); + _exit(0); + } + close(filedes[1]); + /* Read in the child's genkey() result into kdap. */ + bytes = read(filedes[0], kdap, sizeof(*kdap)); + if (bytes != sizeof(*kdap)) + errx(1, "genkey pipe read"); + error = waitpid(pid, &status, WEXITED); + if (error == -1) + err(1, "waitpid"); + if (WIFEXITED(status) && WEXITSTATUS(status) != 0) + errx(1, "genkey child exited with status %d", + WEXITSTATUS(status)); + else if (WIFSIGNALED(status)) + errx(1, "genkey child exited with signal %d", + WTERMSIG(status)); + close(filedes[0]); +} #endif static void From owner-dev-commits-src-all@freebsd.org Mon Jul 26 20:54: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 C83C5674A15; Mon, 26 Jul 2021 20:54: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 4GYXHD53ZNz4b0Z; Mon, 26 Jul 2021 20:54: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 8C9061E00A; Mon, 26 Jul 2021 20:54: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 16QKsmQw080022; Mon, 26 Jul 2021 20:54:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QKsmC2080021; Mon, 26 Jul 2021 20:54:48 GMT (envelope-from git) Date: Mon, 26 Jul 2021 20:54:48 GMT Message-Id: <202107262054.16QKsmC2080021@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 45cd18ec73dc - main - 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/main X-Git-Reftype: branch X-Git-Commit: 45cd18ec73dcd262612898bf1a263cacde17d348 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, 26 Jul 2021 20:54:49 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=45cd18ec73dcd262612898bf1a263cacde17d348 commit 45cd18ec73dcd262612898bf1a263cacde17d348 Author: Mark Johnston AuthorDate: 2021-07-26 20:40:16 +0000 Commit: Mark Johnston CommitDate: 2021-07-26 20:40:16 +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 MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31306 --- 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 Jul 26 20:54: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 A95D7674B46; Mon, 26 Jul 2021 20:54: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 4GYXHC41lBz4b4Q; Mon, 26 Jul 2021 20:54: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 71E781E009; Mon, 26 Jul 2021 20:54: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 16QKslqv079998; Mon, 26 Jul 2021 20:54:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QKslN3079997; Mon, 26 Jul 2021 20:54:47 GMT (envelope-from git) Date: Mon, 26 Jul 2021 20:54:47 GMT Message-Id: <202107262054.16QKslN3079997@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: ba2182520273 - main - 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/main X-Git-Reftype: branch X-Git-Commit: ba21825202737a8b7e90e1ef669c7fe7e7d50325 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, 26 Jul 2021 20:54:47 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=ba21825202737a8b7e90e1ef669c7fe7e7d50325 commit ba21825202737a8b7e90e1ef669c7fe7e7d50325 Author: Mark Johnston AuthorDate: 2021-07-26 20:39:18 +0000 Commit: Mark Johnston CommitDate: 2021-07-26 20:39:37 +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 MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31302 --- 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 Jul 26 20:54: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 007A56746B9; Mon, 26 Jul 2021 20:54: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 4GYXHF6Q6gz4b4c; Mon, 26 Jul 2021 20:54: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 B5C5D1D9E9; Mon, 26 Jul 2021 20:54: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 16QKsnA8080046; Mon, 26 Jul 2021 20:54:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QKsnUQ080045; Mon, 26 Jul 2021 20:54:49 GMT (envelope-from git) Date: Mon, 26 Jul 2021 20:54:49 GMT Message-Id: <202107262054.16QKsnUQ080045@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: d8787d4f7848 - main - crypto: Constify all transform descriptors MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d8787d4f7848bad8bd69325969806e1a76d0c3df 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, 26 Jul 2021 20:54:51 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=d8787d4f7848bad8bd69325969806e1a76d0c3df commit d8787d4f7848bad8bd69325969806e1a76d0c3df Author: Mark Johnston AuthorDate: 2021-07-26 20:41:05 +0000 Commit: Mark Johnston CommitDate: 2021-07-26 20:41:05 +0000 crypto: Constify all transform descriptors No functional change intended. Reviewed by: ae, jhb MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31196 --- sys/crypto/blake2/blake2-sw.c | 4 +-- sys/crypto/ccp/ccp.c | 4 +-- sys/crypto/ccp/ccp.h | 2 +- sys/crypto/ccp/ccp_hardware.c | 6 ++--- sys/crypto/chacha20/chacha-sw.c | 2 +- sys/crypto/via/padlock.h | 2 +- sys/crypto/via/padlock_hash.c | 16 +++++------ sys/dev/cxgbe/adapter.h | 3 ++- sys/dev/cxgbe/crypto/t4_crypto.c | 18 ++++++------- sys/dev/cxgbe/crypto/t4_keyctx.c | 4 +-- sys/dev/glxsb/glxsb.h | 2 +- sys/dev/glxsb/glxsb_hash.c | 4 +-- sys/dev/safexcel/safexcel.c | 4 +-- sys/opencrypto/crypto.c | 6 ++--- sys/opencrypto/cryptodev.c | 6 ++--- sys/opencrypto/cryptodev.h | 4 +-- sys/opencrypto/cryptosoft.c | 46 ++++++++++++++++---------------- sys/opencrypto/xform_aes_icm.c | 6 ++--- sys/opencrypto/xform_aes_xts.c | 2 +- sys/opencrypto/xform_auth.h | 46 ++++++++++++++++---------------- sys/opencrypto/xform_cbc_mac.c | 6 ++--- sys/opencrypto/xform_chacha20_poly1305.c | 4 +-- sys/opencrypto/xform_cml.c | 2 +- sys/opencrypto/xform_comp.h | 2 +- sys/opencrypto/xform_deflate.c | 2 +- sys/opencrypto/xform_enc.h | 22 +++++++-------- sys/opencrypto/xform_gmac.c | 8 +++--- sys/opencrypto/xform_null.c | 4 +-- sys/opencrypto/xform_poly1305.c | 2 +- sys/opencrypto/xform_rijndael.c | 2 +- sys/opencrypto/xform_rmd160.c | 2 +- sys/opencrypto/xform_sha1.c | 4 +-- sys/opencrypto/xform_sha2.c | 16 +++++------ 33 files changed, 132 insertions(+), 131 deletions(-) diff --git a/sys/crypto/blake2/blake2-sw.c b/sys/crypto/blake2/blake2-sw.c index b7291ac6ef46..449ef2be94f5 100644 --- a/sys/crypto/blake2/blake2-sw.c +++ b/sys/crypto/blake2/blake2-sw.c @@ -82,7 +82,7 @@ blake2b_xform_final(uint8_t *out, void *vctx) panic("blake2b_final: invalid"); } -struct auth_hash auth_hash_blake2b = { +const struct auth_hash auth_hash_blake2b = { .type = CRYPTO_BLAKE2B, .name = "Blake2b", .keysize = BLAKE2B_KEYBYTES, @@ -150,7 +150,7 @@ blake2s_xform_final(uint8_t *out, void *vctx) panic("blake2s_final: invalid"); } -struct auth_hash auth_hash_blake2s = { +const struct auth_hash auth_hash_blake2s = { .type = CRYPTO_BLAKE2S, .name = "Blake2s", .keysize = BLAKE2S_KEYBYTES, diff --git a/sys/crypto/ccp/ccp.c b/sys/crypto/ccp/ccp.c index 7cc38b14f3fd..51679942c386 100644 --- a/sys/crypto/ccp/ccp.c +++ b/sys/crypto/ccp/ccp.c @@ -234,7 +234,7 @@ static void ccp_init_hmac_digest(struct ccp_session *s, const char *key, int klen) { union authctx auth_ctx; - struct auth_hash *axf; + const struct auth_hash *axf; u_int i; /* @@ -408,7 +408,7 @@ ccp_newsession(device_t dev, crypto_session_t cses, { struct ccp_softc *sc; struct ccp_session *s; - struct auth_hash *auth_hash; + const struct auth_hash *auth_hash; enum ccp_aes_mode cipher_mode; unsigned auth_mode; unsigned q; diff --git a/sys/crypto/ccp/ccp.h b/sys/crypto/ccp/ccp.h index 197cbc6b4c36..14e42a9e9d1f 100644 --- a/sys/crypto/ccp/ccp.h +++ b/sys/crypto/ccp/ccp.h @@ -64,7 +64,7 @@ enum sha_version { * than a single request in flight at a time. */ struct ccp_session_hmac { - struct auth_hash *auth_hash; + const struct auth_hash *auth_hash; int hash_len; unsigned int auth_mode; char ipad[CCP_HASH_MAX_BLOCK_SIZE]; diff --git a/sys/crypto/ccp/ccp_hardware.c b/sys/crypto/ccp/ccp_hardware.c index a2ca8e1cb71a..5175343ffc90 100644 --- a/sys/crypto/ccp/ccp_hardware.c +++ b/sys/crypto/ccp/ccp_hardware.c @@ -994,7 +994,7 @@ const struct SHA_Defn { enum sha_version version; const void *H_vectors; size_t H_size; - struct auth_hash *axf; + const struct auth_hash *axf; enum ccp_sha_type engine_type; } SHA_definitions[] = { { @@ -1206,7 +1206,7 @@ ccp_do_hmac_done(struct ccp_queue *qp, struct ccp_session *s, { char ihash[SHA2_512_HASH_LEN /* max hash len */]; union authctx auth_ctx; - struct auth_hash *axf; + const struct auth_hash *axf; axf = s->hmac.auth_hash; @@ -1260,7 +1260,7 @@ ccp_do_hmac(struct ccp_queue *qp, struct ccp_session *s, struct cryptop *crp, const struct ccp_completion_ctx *cctx) { device_t dev; - struct auth_hash *axf; + const struct auth_hash *axf; int error; dev = qp->cq_softc->dev; diff --git a/sys/crypto/chacha20/chacha-sw.c b/sys/crypto/chacha20/chacha-sw.c index 2c28b9a0c459..b1bf0a106bfd 100644 --- a/sys/crypto/chacha20/chacha-sw.c +++ b/sys/crypto/chacha20/chacha-sw.c @@ -39,7 +39,7 @@ chacha20_xform_crypt_last(void *ctx, const uint8_t *in, uint8_t *out, chacha_encrypt_bytes(ctx, in, out, len); } -struct enc_xform enc_xform_chacha20 = { +const struct enc_xform enc_xform_chacha20 = { .type = CRYPTO_CHACHA20, .name = "chacha20", .ctxsize = sizeof(struct chacha_ctx), diff --git a/sys/crypto/via/padlock.h b/sys/crypto/via/padlock.h index a22e88ba6ee9..da85771f3663 100644 --- a/sys/crypto/via/padlock.h +++ b/sys/crypto/via/padlock.h @@ -64,7 +64,7 @@ struct padlock_session { union padlock_cw ses_cw __aligned(16); uint32_t ses_ekey[4 * (RIJNDAEL_MAXNR + 1) + 4] __aligned(16); /* 128 bit aligned */ uint32_t ses_dkey[4 * (RIJNDAEL_MAXNR + 1) + 4] __aligned(16); /* 128 bit aligned */ - struct auth_hash *ses_axf; + const struct auth_hash *ses_axf; uint8_t *ses_ictx; uint8_t *ses_octx; int ses_mlen; diff --git a/sys/crypto/via/padlock_hash.c b/sys/crypto/via/padlock_hash.c index 1640bad4ea74..f09024af4ed5 100644 --- a/sys/crypto/via/padlock_hash.c +++ b/sys/crypto/via/padlock_hash.c @@ -78,7 +78,7 @@ static int padlock_sha_update(void *vctx, const void *buf, u_int bufsize); static void padlock_sha1_final(uint8_t *hash, void *vctx); static void padlock_sha256_final(uint8_t *hash, void *vctx); -static struct auth_hash padlock_hmac_sha1 = { +static const struct auth_hash padlock_hmac_sha1 = { .type = CRYPTO_SHA1_HMAC, .name = "HMAC-SHA1", .keysize = SHA1_BLOCK_LEN, @@ -90,7 +90,7 @@ static struct auth_hash padlock_hmac_sha1 = { .Final = padlock_sha1_final, }; -static struct auth_hash padlock_hmac_sha256 = { +static const struct auth_hash padlock_hmac_sha256 = { .type = CRYPTO_SHA2_256_HMAC, .name = "HMAC-SHA2-256", .keysize = SHA2_256_BLOCK_LEN, @@ -227,7 +227,7 @@ padlock_sha256_final(uint8_t *hash, void *vctx) } static void -padlock_copy_ctx(struct auth_hash *axf, void *sctx, void *dctx) +padlock_copy_ctx(const struct auth_hash *axf, void *sctx, void *dctx) { if ((via_feature_xcrypt & VIA_HAS_SHA) != 0 && @@ -245,7 +245,7 @@ padlock_copy_ctx(struct auth_hash *axf, void *sctx, void *dctx) } static void -padlock_free_ctx(struct auth_hash *axf, void *ctx) +padlock_free_ctx(const struct auth_hash *axf, void *ctx) { if ((via_feature_xcrypt & VIA_HAS_SHA) != 0 && @@ -259,7 +259,7 @@ static void padlock_hash_key_setup(struct padlock_session *ses, const uint8_t *key, int klen) { - struct auth_hash *axf; + const struct auth_hash *axf; axf = ses->ses_axf; @@ -282,7 +282,7 @@ static int padlock_authcompute(struct padlock_session *ses, struct cryptop *crp) { u_char hash[HASH_MAX_LEN], hash2[HASH_MAX_LEN]; - struct auth_hash *axf; + const struct auth_hash *axf; union authctx ctx; int error; @@ -319,10 +319,10 @@ padlock_authcompute(struct padlock_session *ses, struct cryptop *crp) } /* Find software structure which describes HMAC algorithm. */ -static struct auth_hash * +static const struct auth_hash * padlock_hash_lookup(int alg) { - struct auth_hash *axf; + const struct auth_hash *axf; switch (alg) { case CRYPTO_NULL_HMAC: diff --git a/sys/dev/cxgbe/adapter.h b/sys/dev/cxgbe/adapter.h index 2adc902cc9ac..3eb39ef5e987 100644 --- a/sys/dev/cxgbe/adapter.h +++ b/sys/dev/cxgbe/adapter.h @@ -1308,7 +1308,8 @@ struct tls_keyctx; void t4_aes_getdeckey(void *, const void *, unsigned int); void t4_copy_partial_hash(int, union authctx *, void *); void t4_init_gmac_hash(const char *, int, char *); -void t4_init_hmac_digest(struct auth_hash *, u_int, const char *, int, char *); +void t4_init_hmac_digest(const struct auth_hash *, u_int, const char *, int, + char *); #ifdef KERN_TLS u_int t4_tls_key_info_size(const struct ktls_session *); int t4_tls_proto_ver(const struct ktls_session *); diff --git a/sys/dev/cxgbe/crypto/t4_crypto.c b/sys/dev/cxgbe/crypto/t4_crypto.c index 0fc806dc2eb8..3ce3e5c916db 100644 --- a/sys/dev/cxgbe/crypto/t4_crypto.c +++ b/sys/dev/cxgbe/crypto/t4_crypto.c @@ -136,7 +136,7 @@ __FBSDID("$FreeBSD$"); static MALLOC_DEFINE(M_CCR, "ccr", "Chelsio T6 crypto"); struct ccr_session_hmac { - struct auth_hash *auth_hash; + const struct auth_hash *auth_hash; int hash_len; unsigned int partial_digest_len; unsigned int auth_mode; @@ -466,7 +466,7 @@ ccr_hash(struct ccr_softc *sc, struct ccr_session *s, struct cryptop *crp) { struct chcr_wr *crwr; struct wrqe *wr; - struct auth_hash *axf; + const struct auth_hash *axf; char *dst; u_int hash_size_in_response, kctx_flits, kctx_len, transhdr_len, wr_len; u_int hmac_ctrl, imm_len, iopad_size; @@ -803,7 +803,7 @@ ccr_eta(struct ccr_softc *sc, struct ccr_session *s, struct cryptop *crp) char iv[CHCR_MAX_CRYPTO_IV_LEN]; struct chcr_wr *crwr; struct wrqe *wr; - struct auth_hash *axf; + const struct auth_hash *axf; char *dst; u_int kctx_len, key_half, op_type, transhdr_len, wr_len; u_int hash_size_in_response, imm_len, iopad_size, iv_len; @@ -1402,8 +1402,8 @@ ccr_gcm_done(struct ccr_softc *sc, struct ccr_session *s, static void ccr_gcm_soft(struct ccr_session *s, struct cryptop *crp) { - struct auth_hash *axf; - struct enc_xform *exf; + const struct auth_hash *axf; + const struct enc_xform *exf; void *auth_ctx, *kschedule; char block[GMAC_BLOCK_LEN]; char digest[GMAC_DIGEST_LEN]; @@ -1892,8 +1892,8 @@ ccr_ccm_done(struct ccr_softc *sc, struct ccr_session *s, static void ccr_ccm_soft(struct ccr_session *s, struct cryptop *crp) { - struct auth_hash *axf; - struct enc_xform *exf; + const struct auth_hash *axf; + const struct enc_xform *exf; union authctx *auth_ctx; void *kschedule; char block[CCM_CBC_BLOCK_LEN]; @@ -2273,7 +2273,7 @@ static void ccr_init_hash_digest(struct ccr_session *s) { union authctx auth_ctx; - struct auth_hash *axf; + const struct auth_hash *axf; axf = s->hmac.auth_hash; axf->Init(&auth_ctx); @@ -2552,7 +2552,7 @@ ccr_newsession(device_t dev, crypto_session_t cses, { struct ccr_softc *sc; struct ccr_session *s; - struct auth_hash *auth_hash; + const struct auth_hash *auth_hash; unsigned int auth_mode, cipher_mode, mk_size; unsigned int partial_digest_len; diff --git a/sys/dev/cxgbe/crypto/t4_keyctx.c b/sys/dev/cxgbe/crypto/t4_keyctx.c index b64eb4ff23d7..136aba759a08 100644 --- a/sys/dev/cxgbe/crypto/t4_keyctx.c +++ b/sys/dev/cxgbe/crypto/t4_keyctx.c @@ -349,7 +349,7 @@ t4_copy_partial_hash(int alg, union authctx *auth_ctx, void *dst) } void -t4_init_hmac_digest(struct auth_hash *axf, u_int partial_digest_len, +t4_init_hmac_digest(const struct auth_hash *axf, u_int partial_digest_len, const char *key, int klen, char *dst) { union authctx auth_ctx; @@ -532,7 +532,7 @@ void t4_tls_key_ctx(const struct ktls_session *tls, int direction, struct tls_keyctx *kctx) { - struct auth_hash *axf; + const struct auth_hash *axf; u_int mac_key_size; char *hash; diff --git a/sys/dev/glxsb/glxsb.h b/sys/dev/glxsb/glxsb.h index 27e5bb44709c..50b30d718618 100644 --- a/sys/dev/glxsb/glxsb.h +++ b/sys/dev/glxsb/glxsb.h @@ -37,7 +37,7 @@ struct glxsb_session { uint32_t ses_key[4]; /* key */ - struct auth_hash *ses_axf; + const struct auth_hash *ses_axf; uint8_t *ses_ictx; uint8_t *ses_octx; int ses_mlen; diff --git a/sys/dev/glxsb/glxsb_hash.c b/sys/dev/glxsb/glxsb_hash.c index b9ceb27deb4d..320ffd66a81e 100644 --- a/sys/dev/glxsb/glxsb_hash.c +++ b/sys/dev/glxsb/glxsb_hash.c @@ -52,7 +52,7 @@ MALLOC_DECLARE(M_GLXSB); static void glxsb_hash_key_setup(struct glxsb_session *ses, const char *key, int klen) { - struct auth_hash *axf; + const struct auth_hash *axf; axf = ses->ses_axf; hmac_init_ipad(axf, key, klen, ses->ses_ictx); @@ -66,7 +66,7 @@ static int glxsb_authcompute(struct glxsb_session *ses, struct cryptop *crp) { u_char hash[HASH_MAX_LEN]; - struct auth_hash *axf; + const struct auth_hash *axf; union authctx ctx; int error; diff --git a/sys/dev/safexcel/safexcel.c b/sys/dev/safexcel/safexcel.c index 71300dcb0393..3940361561d0 100644 --- a/sys/dev/safexcel/safexcel.c +++ b/sys/dev/safexcel/safexcel.c @@ -1318,7 +1318,7 @@ safexcel_setkey_xcbcmac(const uint8_t *key, int klen, uint32_t *hashkey) } static void -safexcel_setkey_hmac_digest(struct auth_hash *ahash, union authctx *ctx, +safexcel_setkey_hmac_digest(const struct auth_hash *ahash, union authctx *ctx, char *buf) { int hashwords, i; @@ -1360,7 +1360,7 @@ safexcel_setkey_hmac(const struct crypto_session_params *csp, const uint8_t *key, int klen, uint8_t *ipad, uint8_t *opad) { union authctx ctx; - struct auth_hash *ahash; + const struct auth_hash *ahash; ahash = crypto_auth_hash(csp); hmac_init_ipad(ahash, key, klen, &ctx); diff --git a/sys/opencrypto/crypto.c b/sys/opencrypto/crypto.c index b6c4441b4284..9a992100f222 100644 --- a/sys/opencrypto/crypto.c +++ b/sys/opencrypto/crypto.c @@ -489,7 +489,7 @@ crypto_get_params(crypto_session_t crypto_session) return (&crypto_session->csp); } -struct auth_hash * +const struct auth_hash * crypto_auth_hash(const struct crypto_session_params *csp) { @@ -551,7 +551,7 @@ crypto_auth_hash(const struct crypto_session_params *csp) } } -struct enc_xform * +const struct enc_xform * crypto_cipher(const struct crypto_session_params *csp) { @@ -719,7 +719,7 @@ alg_is_aead(int alg) static bool check_csp(const struct crypto_session_params *csp) { - struct auth_hash *axf; + const struct auth_hash *axf; /* Mode-independent checks. */ if ((csp->csp_flags & ~(SUPPORTED_SES)) != 0) diff --git a/sys/opencrypto/cryptodev.c b/sys/opencrypto/cryptodev.c index d179dd6348e5..6bbcf977ac72 100644 --- a/sys/opencrypto/cryptodev.c +++ b/sys/opencrypto/cryptodev.c @@ -262,7 +262,7 @@ struct csession { uint32_t ses; struct mtx lock; /* for op submission */ - struct enc_xform *txform; + const struct enc_xform *txform; int hashsize; int ivsize; int mode; @@ -328,8 +328,8 @@ cse_create(struct fcrypt *fcr, struct session2_op *sop) { struct crypto_session_params csp; struct csession *cse; - struct enc_xform *txform; - struct auth_hash *thash; + const struct enc_xform *txform; + const struct auth_hash *thash; void *key = NULL; void *mackey = NULL; crypto_session_t cses; diff --git a/sys/opencrypto/cryptodev.h b/sys/opencrypto/cryptodev.h index ce5bfefaed9d..79dec8c44f51 100644 --- a/sys/opencrypto/cryptodev.h +++ b/sys/opencrypto/cryptodev.h @@ -589,8 +589,8 @@ uint32_t crypto_ses2caps(crypto_session_t crypto_session); void *crypto_get_driver_session(crypto_session_t crypto_session); const struct crypto_session_params *crypto_get_params( crypto_session_t crypto_session); -struct auth_hash *crypto_auth_hash(const struct crypto_session_params *csp); -struct enc_xform *crypto_cipher(const struct crypto_session_params *csp); +const struct auth_hash *crypto_auth_hash(const struct crypto_session_params *csp); +const struct enc_xform *crypto_cipher(const struct crypto_session_params *csp); MALLOC_DECLARE(M_CRYPTO_DATA); diff --git a/sys/opencrypto/cryptosoft.c b/sys/opencrypto/cryptosoft.c index 9e551ba9652b..ef927f117bcc 100644 --- a/sys/opencrypto/cryptosoft.c +++ b/sys/opencrypto/cryptosoft.c @@ -60,17 +60,17 @@ __FBSDID("$FreeBSD$"); struct swcr_auth { void *sw_ictx; void *sw_octx; - struct auth_hash *sw_axf; + const struct auth_hash *sw_axf; uint16_t sw_mlen; }; struct swcr_encdec { void *sw_kschedule; - struct enc_xform *sw_exf; + const struct enc_xform *sw_exf; }; struct swcr_compdec { - struct comp_algo *sw_cxf; + const struct comp_algo *sw_cxf; }; struct swcr_session { @@ -103,8 +103,8 @@ swcr_encdec(struct swcr_session *ses, struct cryptop *crp) unsigned char iv[EALG_MAX_BLOCK_LEN], blk[EALG_MAX_BLOCK_LEN]; unsigned char *ivp, *nivp, iv2[EALG_MAX_BLOCK_LEN]; const struct crypto_session_params *csp; + const struct enc_xform *exf; struct swcr_encdec *sw; - struct enc_xform *exf; size_t inlen, outlen; int i, blks, ivlen, resid; struct crypto_buffer_cursor cc_in, cc_out; @@ -278,7 +278,7 @@ swcr_encdec(struct swcr_session *ses, struct cryptop *crp) } static void -swcr_authprepare(struct auth_hash *axf, struct swcr_auth *sw, +swcr_authprepare(const struct auth_hash *axf, struct swcr_auth *sw, const uint8_t *key, int klen) { @@ -313,7 +313,7 @@ swcr_authcompute(struct swcr_session *ses, struct cryptop *crp) u_char aalg[HASH_MAX_LEN]; const struct crypto_session_params *csp; struct swcr_auth *sw; - struct auth_hash *axf; + const struct auth_hash *axf; union authctx ctx; int err; @@ -389,7 +389,7 @@ swcr_gmac(struct swcr_session *ses, struct cryptop *crp) const u_char *inblk; union authctx ctx; struct swcr_auth *swa; - struct auth_hash *axf; + const struct auth_hash *axf; uint32_t *blkp; size_t len; int blksz, error, ivlen, resid; @@ -468,8 +468,8 @@ swcr_gcm(struct swcr_session *ses, struct cryptop *crp) union authctx ctx; struct swcr_auth *swa; struct swcr_encdec *swe; - struct auth_hash *axf; - struct enc_xform *exf; + const struct auth_hash *axf; + const struct enc_xform *exf; uint32_t *blkp; size_t len; int blksz, error, ivlen, r, resid; @@ -645,7 +645,7 @@ swcr_ccm_cbc_mac(struct swcr_session *ses, struct cryptop *crp) u_char iv[AES_BLOCK_LEN]; union authctx ctx; struct swcr_auth *swa; - struct auth_hash *axf; + const struct auth_hash *axf; int error, ivlen; swa = &ses->swcr_auth; @@ -706,8 +706,8 @@ swcr_ccm(struct swcr_session *ses, struct cryptop *crp) union authctx ctx; struct swcr_auth *swa; struct swcr_encdec *swe; - struct auth_hash *axf; - struct enc_xform *exf; + const struct auth_hash *axf; + const struct enc_xform *exf; size_t len; int blksz, error, ivlen, r, resid; @@ -875,8 +875,8 @@ swcr_chacha20_poly1305(struct swcr_session *ses, struct cryptop *crp) union authctx ctx; struct swcr_auth *swa; struct swcr_encdec *swe; - struct auth_hash *axf; - struct enc_xform *exf; + const struct auth_hash *axf; + const struct enc_xform *exf; size_t len; int blksz, error, r, resid; @@ -1046,8 +1046,8 @@ swcr_eta(struct swcr_session *ses, struct cryptop *crp) static int swcr_compdec(struct swcr_session *ses, struct cryptop *crp) { + const struct comp_algo *cxf; uint8_t *data, *out; - struct comp_algo *cxf; int adj; uint32_t result; @@ -1131,7 +1131,7 @@ swcr_setup_cipher(struct swcr_session *ses, const struct crypto_session_params *csp) { struct swcr_encdec *swe; - struct enc_xform *txf; + const struct enc_xform *txf; int error; swe = &ses->swcr_encdec; @@ -1158,7 +1158,7 @@ swcr_setup_auth(struct swcr_session *ses, const struct crypto_session_params *csp) { struct swcr_auth *swa; - struct auth_hash *axf; + const struct auth_hash *axf; swa = &ses->swcr_auth; @@ -1242,7 +1242,7 @@ swcr_setup_gcm(struct swcr_session *ses, const struct crypto_session_params *csp) { struct swcr_auth *swa; - struct auth_hash *axf; + const struct auth_hash *axf; if (csp->csp_ivlen != AES_GCM_IV_LEN) return (EINVAL); @@ -1286,7 +1286,7 @@ swcr_setup_ccm(struct swcr_session *ses, const struct crypto_session_params *csp) { struct swcr_auth *swa; - struct auth_hash *axf; + const struct auth_hash *axf; if (csp->csp_ivlen != AES_CCM_IV_LEN) return (EINVAL); @@ -1330,7 +1330,7 @@ swcr_setup_chacha20_poly1305(struct swcr_session *ses, const struct crypto_session_params *csp) { struct swcr_auth *swa; - struct auth_hash *axf; + const struct auth_hash *axf; if (csp->csp_ivlen != CHACHA20_POLY1305_IV_LEN) return (EINVAL); @@ -1355,7 +1355,7 @@ swcr_setup_chacha20_poly1305(struct swcr_session *ses, static bool swcr_auth_supported(const struct crypto_session_params *csp) { - struct auth_hash *axf; + const struct auth_hash *axf; axf = crypto_auth_hash(csp); if (axf == NULL) @@ -1408,7 +1408,7 @@ swcr_auth_supported(const struct crypto_session_params *csp) static bool swcr_cipher_supported(const struct crypto_session_params *csp) { - struct enc_xform *txf; + const struct enc_xform *txf; txf = crypto_cipher(csp); if (txf == NULL) @@ -1496,7 +1496,7 @@ swcr_newsession(device_t dev, crypto_session_t cses, struct swcr_session *ses; struct swcr_encdec *swe; struct swcr_auth *swa; - struct comp_algo *cxf; + const struct comp_algo *cxf; int error; ses = crypto_get_driver_session(cses); diff --git a/sys/opencrypto/xform_aes_icm.c b/sys/opencrypto/xform_aes_icm.c index 5f81f8df8a87..618b812ceebf 100644 --- a/sys/opencrypto/xform_aes_icm.c +++ b/sys/opencrypto/xform_aes_icm.c @@ -60,7 +60,7 @@ static void aes_gcm_reinit(void *, const uint8_t *); static void aes_ccm_reinit(void *, const uint8_t *); /* Encryption instances */ -struct enc_xform enc_xform_aes_icm = { +const struct enc_xform enc_xform_aes_icm = { .type = CRYPTO_AES_ICM, .name = "AES-ICM", .ctxsize = sizeof(struct aes_icm_ctx), @@ -77,7 +77,7 @@ struct enc_xform enc_xform_aes_icm = { .decrypt_last = aes_icm_crypt_last, }; -struct enc_xform enc_xform_aes_nist_gcm = { +const struct enc_xform enc_xform_aes_nist_gcm = { .type = CRYPTO_AES_NIST_GCM_16, .name = "AES-GCM", .ctxsize = sizeof(struct aes_icm_ctx), @@ -94,7 +94,7 @@ struct enc_xform enc_xform_aes_nist_gcm = { .decrypt_last = aes_icm_crypt_last, }; -struct enc_xform enc_xform_ccm = { +const struct enc_xform enc_xform_ccm = { .type = CRYPTO_AES_CCM_16, .name = "AES-CCM", .ctxsize = sizeof(struct aes_icm_ctx), diff --git a/sys/opencrypto/xform_aes_xts.c b/sys/opencrypto/xform_aes_xts.c index 0b415f1d6346..457535621511 100644 --- a/sys/opencrypto/xform_aes_xts.c +++ b/sys/opencrypto/xform_aes_xts.c @@ -59,7 +59,7 @@ static void aes_xts_decrypt(void *, const uint8_t *, uint8_t *); static void aes_xts_reinit(void *, const uint8_t *); /* Encryption instances */ -struct enc_xform enc_xform_aes_xts = { +const struct enc_xform enc_xform_aes_xts = { .type = CRYPTO_AES_XTS, .name = "AES-XTS", .ctxsize = sizeof(struct aes_xts_ctx), diff --git a/sys/opencrypto/xform_auth.h b/sys/opencrypto/xform_auth.h index 6427965671d3..aa2f55564c5f 100644 --- a/sys/opencrypto/xform_auth.h +++ b/sys/opencrypto/xform_auth.h @@ -51,7 +51,7 @@ /* Declarations */ struct auth_hash { int type; - char *name; + const char *name; uint16_t keysize; uint16_t hashsize; uint16_t ctxsize; @@ -63,28 +63,28 @@ struct auth_hash { void (*Final) (uint8_t *, void *); }; -extern struct auth_hash auth_hash_null; -extern struct auth_hash auth_hash_hmac_sha1; -extern struct auth_hash auth_hash_hmac_ripemd_160; -extern struct auth_hash auth_hash_hmac_sha2_224; -extern struct auth_hash auth_hash_hmac_sha2_256; -extern struct auth_hash auth_hash_hmac_sha2_384; -extern struct auth_hash auth_hash_hmac_sha2_512; -extern struct auth_hash auth_hash_sha1; -extern struct auth_hash auth_hash_sha2_224; -extern struct auth_hash auth_hash_sha2_256; -extern struct auth_hash auth_hash_sha2_384; -extern struct auth_hash auth_hash_sha2_512; -extern struct auth_hash auth_hash_nist_gmac_aes_128; -extern struct auth_hash auth_hash_nist_gmac_aes_192; -extern struct auth_hash auth_hash_nist_gmac_aes_256; -extern struct auth_hash auth_hash_blake2b; -extern struct auth_hash auth_hash_blake2s; -extern struct auth_hash auth_hash_poly1305; -extern struct auth_hash auth_hash_ccm_cbc_mac_128; -extern struct auth_hash auth_hash_ccm_cbc_mac_192; -extern struct auth_hash auth_hash_ccm_cbc_mac_256; -extern struct auth_hash auth_hash_chacha20_poly1305; +extern const struct auth_hash auth_hash_null; +extern const struct auth_hash auth_hash_hmac_sha1; +extern const struct auth_hash auth_hash_hmac_ripemd_160; +extern const struct auth_hash auth_hash_hmac_sha2_224; +extern const struct auth_hash auth_hash_hmac_sha2_256; +extern const struct auth_hash auth_hash_hmac_sha2_384; +extern const struct auth_hash auth_hash_hmac_sha2_512; +extern const struct auth_hash auth_hash_sha1; +extern const struct auth_hash auth_hash_sha2_224; +extern const struct auth_hash auth_hash_sha2_256; +extern const struct auth_hash auth_hash_sha2_384; +extern const struct auth_hash auth_hash_sha2_512; +extern const struct auth_hash auth_hash_nist_gmac_aes_128; +extern const struct auth_hash auth_hash_nist_gmac_aes_192; +extern const struct auth_hash auth_hash_nist_gmac_aes_256; +extern const struct auth_hash auth_hash_blake2b; +extern const struct auth_hash auth_hash_blake2s; +extern const struct auth_hash auth_hash_poly1305; +extern const struct auth_hash auth_hash_ccm_cbc_mac_128; +extern const struct auth_hash auth_hash_ccm_cbc_mac_192; +extern const struct auth_hash auth_hash_ccm_cbc_mac_256; +extern const struct auth_hash auth_hash_chacha20_poly1305; union authctx { SHA1_CTX sha1ctx; diff --git a/sys/opencrypto/xform_cbc_mac.c b/sys/opencrypto/xform_cbc_mac.c index 755dd51d9517..d55e66e45255 100644 --- a/sys/opencrypto/xform_cbc_mac.c +++ b/sys/opencrypto/xform_cbc_mac.c @@ -5,7 +5,7 @@ __FBSDID("$FreeBSD$"); #include /* Authentication instances */ -struct auth_hash auth_hash_ccm_cbc_mac_128 = { +const struct auth_hash auth_hash_ccm_cbc_mac_128 = { .type = CRYPTO_AES_CCM_CBC_MAC, .name = "CBC-CCM-AES-128", .keysize = AES_128_CBC_MAC_KEY_LEN, @@ -18,7 +18,7 @@ struct auth_hash auth_hash_ccm_cbc_mac_128 = { .Update = AES_CBC_MAC_Update, .Final = AES_CBC_MAC_Final, }; -struct auth_hash auth_hash_ccm_cbc_mac_192 = { +const struct auth_hash auth_hash_ccm_cbc_mac_192 = { .type = CRYPTO_AES_CCM_CBC_MAC, .name = "CBC-CCM-AES-192", .keysize = AES_192_CBC_MAC_KEY_LEN, @@ -31,7 +31,7 @@ struct auth_hash auth_hash_ccm_cbc_mac_192 = { .Update = AES_CBC_MAC_Update, .Final = AES_CBC_MAC_Final, }; -struct auth_hash auth_hash_ccm_cbc_mac_256 = { +const struct auth_hash auth_hash_ccm_cbc_mac_256 = { .type = CRYPTO_AES_CCM_CBC_MAC, .name = "CBC-CCM-AES-256", .keysize = AES_256_CBC_MAC_KEY_LEN, diff --git a/sys/opencrypto/xform_chacha20_poly1305.c b/sys/opencrypto/xform_chacha20_poly1305.c index 3a72c06f931b..543c16bcc4e0 100644 --- a/sys/opencrypto/xform_chacha20_poly1305.c +++ b/sys/opencrypto/xform_chacha20_poly1305.c @@ -84,7 +84,7 @@ chacha20_poly1305_crypt_last(void *vctx, const uint8_t *in, uint8_t *out, KASSERT(error == 0, ("%s failed: %d", __func__, error)); } -struct enc_xform enc_xform_chacha20_poly1305 = { +const struct enc_xform enc_xform_chacha20_poly1305 = { .type = CRYPTO_CHACHA20_POLY1305, .name = "ChaCha20-Poly1305", .ctxsize = sizeof(struct chacha20_poly1305_cipher_ctx), @@ -148,7 +148,7 @@ chacha20_poly1305_Final(uint8_t *digest, void *vctx) crypto_onetimeauth_poly1305_final(&ctx->state, digest); } -struct auth_hash auth_hash_chacha20_poly1305 = { +const struct auth_hash auth_hash_chacha20_poly1305 = { .type = CRYPTO_POLY1305, .name = "ChaCha20-Poly1305", .keysize = POLY1305_KEY_LEN, diff --git a/sys/opencrypto/xform_cml.c b/sys/opencrypto/xform_cml.c index 3f25f2cb6aaf..ac1dabd90d30 100644 --- a/sys/opencrypto/xform_cml.c +++ b/sys/opencrypto/xform_cml.c @@ -58,7 +58,7 @@ static void cml_encrypt(void *, const uint8_t *, uint8_t *); static void cml_decrypt(void *, const uint8_t *, uint8_t *); /* Encryption instances */ -struct enc_xform enc_xform_camellia = { +const struct enc_xform enc_xform_camellia = { .type = CRYPTO_CAMELLIA_CBC, .name = "Camellia-CBC", .ctxsize = sizeof(camellia_ctx), diff --git a/sys/opencrypto/xform_comp.h b/sys/opencrypto/xform_comp.h index 1d0ba7a505bf..11bf59a94b39 100644 --- a/sys/opencrypto/xform_comp.h +++ b/sys/opencrypto/xform_comp.h @@ -46,6 +46,6 @@ struct comp_algo { uint32_t (*decompress) (uint8_t *, uint32_t, uint8_t **); }; -extern struct comp_algo comp_algo_deflate; +extern const struct comp_algo comp_algo_deflate; #endif /* _CRYPTO_XFORM_COMP_H_ */ diff --git a/sys/opencrypto/xform_deflate.c b/sys/opencrypto/xform_deflate.c index 8d93f4843244..b295ceb2ea9b 100644 --- a/sys/opencrypto/xform_deflate.c +++ b/sys/opencrypto/xform_deflate.c @@ -57,7 +57,7 @@ static uint32_t deflate_compress(uint8_t *, uint32_t, uint8_t **); static uint32_t deflate_decompress(uint8_t *, uint32_t, uint8_t **); /* Compression instance */ -struct comp_algo comp_algo_deflate = { +const struct comp_algo comp_algo_deflate = { CRYPTO_DEFLATE_COMP, "Deflate", 90, deflate_compress, deflate_decompress diff --git a/sys/opencrypto/xform_enc.h b/sys/opencrypto/xform_enc.h index e8325f20917b..6f95b49986c5 100644 --- a/sys/opencrypto/xform_enc.h +++ b/sys/opencrypto/xform_enc.h @@ -48,7 +48,7 @@ /* Declarations */ struct enc_xform { int type; - char *name; + const char *name; size_t ctxsize; uint16_t blocksize; /* Required input block size -- 1 for stream ciphers. */ uint16_t native_blocksize; /* Used for stream ciphers. */ @@ -73,16 +73,16 @@ struct enc_xform { }; -extern struct enc_xform enc_xform_null; -extern struct enc_xform enc_xform_rijndael128; -extern struct enc_xform enc_xform_aes_icm; -extern struct enc_xform enc_xform_aes_nist_gcm; -extern struct enc_xform enc_xform_aes_nist_gmac; -extern struct enc_xform enc_xform_aes_xts; -extern struct enc_xform enc_xform_camellia; -extern struct enc_xform enc_xform_chacha20; -extern struct enc_xform enc_xform_chacha20_poly1305; -extern struct enc_xform enc_xform_ccm; +extern const struct enc_xform enc_xform_null; +extern const struct enc_xform enc_xform_rijndael128; +extern const struct enc_xform enc_xform_aes_icm; +extern const struct enc_xform enc_xform_aes_nist_gcm; +extern const struct enc_xform enc_xform_aes_nist_gmac; +extern const struct enc_xform enc_xform_aes_xts; +extern const struct enc_xform enc_xform_camellia; +extern const struct enc_xform enc_xform_chacha20; +extern const struct enc_xform enc_xform_chacha20_poly1305; +extern const struct enc_xform enc_xform_ccm; struct aes_icm_ctx { uint32_t ac_ek[4*(RIJNDAEL_MAXNR + 1)]; diff --git a/sys/opencrypto/xform_gmac.c b/sys/opencrypto/xform_gmac.c index 0b981f2c95c3..0cd5ef9b60be 100644 --- a/sys/opencrypto/xform_gmac.c +++ b/sys/opencrypto/xform_gmac.c @@ -54,7 +54,7 @@ __FBSDID("$FreeBSD$"); #include /* Encryption instances */ -struct enc_xform enc_xform_aes_nist_gmac = { +const struct enc_xform enc_xform_aes_nist_gmac = { .type = CRYPTO_AES_NIST_GMAC, .name = "AES-GMAC", .blocksize = AES_ICM_BLOCK_LEN, @@ -64,7 +64,7 @@ struct enc_xform enc_xform_aes_nist_gmac = { }; /* Authentication instances */ -struct auth_hash auth_hash_nist_gmac_aes_128 = { +const struct auth_hash auth_hash_nist_gmac_aes_128 = { .type = CRYPTO_AES_NIST_GMAC, .name = "GMAC-AES-128", .keysize = AES_128_GMAC_KEY_LEN, @@ -78,7 +78,7 @@ struct auth_hash auth_hash_nist_gmac_aes_128 = { .Final = AES_GMAC_Final, }; -struct auth_hash auth_hash_nist_gmac_aes_192 = { +const struct auth_hash auth_hash_nist_gmac_aes_192 = { .type = CRYPTO_AES_NIST_GMAC, .name = "GMAC-AES-192", .keysize = AES_192_GMAC_KEY_LEN, @@ -92,7 +92,7 @@ struct auth_hash auth_hash_nist_gmac_aes_192 = { .Final = AES_GMAC_Final, }; -struct auth_hash auth_hash_nist_gmac_aes_256 = { +const struct auth_hash auth_hash_nist_gmac_aes_256 = { .type = CRYPTO_AES_NIST_GMAC, .name = "GMAC-AES-256", .keysize = AES_256_GMAC_KEY_LEN, diff --git a/sys/opencrypto/xform_null.c b/sys/opencrypto/xform_null.c index d1b79e1385b2..6cd49baab0ac 100644 --- a/sys/opencrypto/xform_null.c +++ b/sys/opencrypto/xform_null.c @@ -62,7 +62,7 @@ static int null_update(void *, const void *, u_int); static void null_final(uint8_t *, void *); /* Encryption instances */ -struct enc_xform enc_xform_null = { +const struct enc_xform enc_xform_null = { .type = CRYPTO_NULL_CBC, .name = "NULL", /* NB: blocksize of 4 is to generate a properly aligned ESP header */ @@ -76,7 +76,7 @@ struct enc_xform enc_xform_null = { }; /* Authentication instances */ -struct auth_hash auth_hash_null = { +const struct auth_hash auth_hash_null = { .type = CRYPTO_NULL_HMAC, .name = "NULL-HMAC", .keysize = 0, diff --git a/sys/opencrypto/xform_poly1305.c b/sys/opencrypto/xform_poly1305.c index d8ceab47deca..c885192f9df6 100644 --- a/sys/opencrypto/xform_poly1305.c +++ b/sys/opencrypto/xform_poly1305.c @@ -58,7 +58,7 @@ xform_Poly1305_Final(uint8_t *digest, void *ctx) panic("%s: Invariant violated: %d", __func__, rc); } -struct auth_hash auth_hash_poly1305 = { +const struct auth_hash auth_hash_poly1305 = { .type = CRYPTO_POLY1305, .name = "Poly-1305", .keysize = POLY1305_KEY_LEN, diff --git a/sys/opencrypto/xform_rijndael.c b/sys/opencrypto/xform_rijndael.c index d9e2497e7e53..685e53640c48 100644 --- a/sys/opencrypto/xform_rijndael.c +++ b/sys/opencrypto/xform_rijndael.c @@ -58,7 +58,7 @@ static void rijndael128_encrypt(void *, const uint8_t *, uint8_t *); static void rijndael128_decrypt(void *, const uint8_t *, uint8_t *); /* Encryption instances */ -struct enc_xform enc_xform_rijndael128 = { +const struct enc_xform enc_xform_rijndael128 = { .type = CRYPTO_RIJNDAEL128_CBC, .name = "Rijndael-128/AES", .ctxsize = sizeof(rijndael_ctx), diff --git a/sys/opencrypto/xform_rmd160.c b/sys/opencrypto/xform_rmd160.c *** 110 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Mon Jul 26 21:10: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 6C7A3674F0A; Mon, 26 Jul 2021 21:10: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 4GYXdf2ghSz4f6N; Mon, 26 Jul 2021 21:10: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 422831E053; Mon, 26 Jul 2021 21:10: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 16QLAkPn006537; Mon, 26 Jul 2021 21:10:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QLAkYa006536; Mon, 26 Jul 2021 21:10:46 GMT (envelope-from git) Date: Mon, 26 Jul 2021 21:10:46 GMT Message-Id: <202107262110.16QLAkYa006536@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: be79f30d6c3e - main - m_dup: Handle unmapped mbufs as an input mbuf. 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: be79f30d6c3e353856d4f82227b270abc26be702 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, 26 Jul 2021 21:10:46 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=be79f30d6c3e353856d4f82227b270abc26be702 commit be79f30d6c3e353856d4f82227b270abc26be702 Author: John Baldwin AuthorDate: 2021-07-26 21:03:28 +0000 Commit: John Baldwin CommitDate: 2021-07-26 21:09:16 +0000 m_dup: Handle unmapped mbufs as an input mbuf. Use m_copydata() instead of a direct bcopy() when copying data out of a source mbuf into a newly-allocated mbuf. PR: 256610 Reported by: Niels Bakker Reviewed by: markj MFC after: 2 weeks --- sys/kern/uipc_mbuf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c index 74c8ef62eb8d..0f1a0c5e4e0c 100644 --- a/sys/kern/uipc_mbuf.c +++ b/sys/kern/uipc_mbuf.c @@ -729,7 +729,7 @@ m_dup(const struct mbuf *m, int how) while (n->m_len < nsize && m != NULL) { int chunk = min(nsize - n->m_len, m->m_len - moff); - bcopy(m->m_data + moff, n->m_data + n->m_len, chunk); + m_copydata(m, moff, chunk, n->m_data + n->m_len); moff += chunk; n->m_len += chunk; remain -= chunk; From owner-dev-commits-src-all@freebsd.org Mon Jul 26 21:15: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 9B11967530A; Mon, 26 Jul 2021 21:15: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 4GYXkw3yLjz4gs1; Mon, 26 Jul 2021 21:15: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 6E8631E514; Mon, 26 Jul 2021 21:15: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 16QLFKVC008134; Mon, 26 Jul 2021 21:15:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QLFK6L008133; Mon, 26 Jul 2021 21:15:20 GMT (envelope-from git) Date: Mon, 26 Jul 2021 21:15:20 GMT Message-Id: <202107262115.16QLFK6L008133@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: 4b765ab4cda0 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 4b765ab4cda051a6d9ceb5fb9cac80c7f3b910bf 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, 26 Jul 2021 21:15:20 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=4b765ab4cda051a6d9ceb5fb9cac80c7f3b910bf commit 4b765ab4cda051a6d9ceb5fb9cac80c7f3b910bf Author: Kristof Provost AuthorDate: 2021-07-21 15:32:24 +0000 Commit: Kristof Provost CommitDate: 2021-07-26 21:13:31 +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") --- 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 Jul 26 21:15: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 2647867503A; Mon, 26 Jul 2021 21:15: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 4GYXkx6hJvz4gmN; Mon, 26 Jul 2021 21:15: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 A07E31DED4; Mon, 26 Jul 2021 21:15: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 16QLFLQm008158; Mon, 26 Jul 2021 21:15:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QLFLhJ008157; Mon, 26 Jul 2021 21:15:21 GMT (envelope-from git) Date: Mon, 26 Jul 2021 21:15:21 GMT Message-Id: <202107262115.16QLFLhJ008157@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: 1e7fe2fbb9c0 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 1e7fe2fbb9c0bed230d8db94d7444a90ca5ce199 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, 26 Jul 2021 21:15:22 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=1e7fe2fbb9c0bed230d8db94d7444a90ca5ce199 commit 1e7fe2fbb9c0bed230d8db94d7444a90ca5ce199 Author: Luiz Otavio O Souza AuthorDate: 2021-07-21 15:41:22 +0000 Commit: Kristof Provost CommitDate: 2021-07-26 21:13:31 +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 --- 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 ec05dd6d337b..ab09981ebf51 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)) @@ -977,6 +979,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); } @@ -1167,6 +1172,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) { @@ -1267,6 +1293,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); @@ -1356,6 +1385,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 @@ -1906,6 +1936,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 Jul 26 21:15: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 35E06674CEC; Mon, 26 Jul 2021 21:15: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 4GYXky71Plz4gsD; Mon, 26 Jul 2021 21:15: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 A46BA1E4CA; Mon, 26 Jul 2021 21:15: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 16QLFMTL008185; Mon, 26 Jul 2021 21:15:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QLFM58008184; Mon, 26 Jul 2021 21:15:22 GMT (envelope-from git) Date: Mon, 26 Jul 2021 21:15:22 GMT Message-Id: <202107262115.16QLFM58008184@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: 9ef8cd0b7906 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 9ef8cd0b7906371803421aa897056b6fc0710fcb 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, 26 Jul 2021 21:15:23 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=9ef8cd0b7906371803421aa897056b6fc0710fcb commit 9ef8cd0b7906371803421aa897056b6fc0710fcb Author: Kristof Provost AuthorDate: 2021-07-22 08:35:08 +0000 Commit: Kristof Provost CommitDate: 2021-07-26 21:13:31 +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 --- 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 ab09981ebf51..ff14152c086c 100644 --- a/sys/net/bpf.c +++ b/sys/net/bpf.c @@ -1172,27 +1172,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) { @@ -1294,7 +1273,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 39f767c2a603..39978afe7ce1 100644 --- a/sys/net/if_vlan.c +++ b/sys/net/if_vlan.c @@ -2040,7 +2040,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 ec2a5b1efc5f..e2dd3eb7c0de 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -2838,27 +2838,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) { @@ -6393,7 +6372,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; @@ -6842,7 +6821,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 Jul 26 21:15: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 61B36674CF5; Mon, 26 Jul 2021 21:15: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 4GYXl003jQz4gww; Mon, 26 Jul 2021 21:15: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 D168B1DED5; Mon, 26 Jul 2021 21:15: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 16QLFNLt008213; Mon, 26 Jul 2021 21:15:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QLFN1a008212; Mon, 26 Jul 2021 21:15:23 GMT (envelope-from git) Date: Mon, 26 Jul 2021 21:15:23 GMT Message-Id: <202107262115.16QLFN1a008212@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: 3e87f800f01b - main - 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/main X-Git-Reftype: branch X-Git-Commit: 3e87f800f01b6d2cbe49924a01038379889d8b3b 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, 26 Jul 2021 21:15:24 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=3e87f800f01b6d2cbe49924a01038379889d8b3b commit 3e87f800f01b6d2cbe49924a01038379889d8b3b Author: Kristof Provost AuthorDate: 2021-07-22 12:50:27 +0000 Commit: Kristof Provost CommitDate: 2021-07-26 21:13:31 +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 --- 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 Jul 26 22:02: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 00169675D03; Mon, 26 Jul 2021 22:02: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 4GYYn15Pl0z4vT4; Mon, 26 Jul 2021 22:02: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 A0C781E9FC; Mon, 26 Jul 2021 22:02: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 16QM2DLP074152; Mon, 26 Jul 2021 22:02:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QM2DT0074151; Mon, 26 Jul 2021 22:02:13 GMT (envelope-from git) Date: Mon, 26 Jul 2021 22:02:13 GMT Message-Id: <202107262202.16QM2DT0074151@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Navdeep Parhar Subject: git: 6e405dd9e48d - stable/13 - cxgbe(4): Remove some dead code. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 6e405dd9e48db9d088d6832efe8630c098bc4ce2 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, 26 Jul 2021 22:02:14 -0000 The branch stable/13 has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=6e405dd9e48db9d088d6832efe8630c098bc4ce2 commit 6e405dd9e48db9d088d6832efe8630c098bc4ce2 Author: Navdeep Parhar AuthorDate: 2021-05-19 06:16:03 +0000 Commit: Navdeep Parhar CommitDate: 2021-07-26 17:49:25 +0000 cxgbe(4): Remove some dead code. (cherry picked from commit 3965469eaa33aca03837baf5f88a55fa89f3f987) --- sys/dev/cxgbe/adapter.h | 10 ---------- sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h | 2 -- 2 files changed, 12 deletions(-) diff --git a/sys/dev/cxgbe/adapter.h b/sys/dev/cxgbe/adapter.h index 7bdad292c752..7f6e1ceb1550 100644 --- a/sys/dev/cxgbe/adapter.h +++ b/sys/dev/cxgbe/adapter.h @@ -68,16 +68,6 @@ MALLOC_DECLARE(M_CXGBE); #define CXGBE_UNIMPLEMENTED(s) \ panic("%s (%s, line %d) not implemented yet.", s, __FILE__, __LINE__) -#if defined(__i386__) || defined(__amd64__) -static __inline void -prefetch(void *x) -{ - __asm volatile("prefetcht0 %0" :: "m" (*(unsigned long *)x)); -} -#else -#define prefetch(x) __builtin_prefetch(x) -#endif - #ifndef SYSCTL_ADD_UQUAD #define SYSCTL_ADD_UQUAD SYSCTL_ADD_QUAD #define sysctl_handle_64 sysctl_handle_quad diff --git a/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h b/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h index 8314800c4e7b..1a717d6352c8 100644 --- a/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h +++ b/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h @@ -56,8 +56,6 @@ #include #include -#undef prefetch - #include "common/common.h" #include "common/t4_msg.h" #include "common/t4_regs.h" From owner-dev-commits-src-all@freebsd.org Mon Jul 26 22:41: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 AFD6F67623E; Mon, 26 Jul 2021 22:41: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 4GYZfV45zwz3LJ0; Mon, 26 Jul 2021 22:41: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 6268C1F4B0; Mon, 26 Jul 2021 22:41: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 16QMfcAh027597; Mon, 26 Jul 2021 22:41:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QMfcEW027596; Mon, 26 Jul 2021 22:41:38 GMT (envelope-from git) Date: Mon, 26 Jul 2021 22:41:38 GMT Message-Id: <202107262241.16QMfcEW027596@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: 4783fb730fa1 - main - Revert "loader: support.4th resets the read buffer incorrectly" MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4783fb730fa1cfdbe5c905bb23ac74f681e2df6b 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, 26 Jul 2021 22:41:38 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=4783fb730fa1cfdbe5c905bb23ac74f681e2df6b commit 4783fb730fa1cfdbe5c905bb23ac74f681e2df6b Author: Warner Losh AuthorDate: 2021-07-26 22:40:41 +0000 Commit: Warner Losh CommitDate: 2021-07-26 22:40:41 +0000 Revert "loader: support.4th resets the read buffer incorrectly" This reverts commit 9c1c02093b90ae49745a174eb26ea85dd1990eec. It seems to have broken all old nextboot.conf files causing hangs on boot. Sponsored by: Netflix --- stand/forth/support.4th | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stand/forth/support.4th b/stand/forth/support.4th index ec04b7e9e322..d87cf16a16dd 100644 --- a/stand/forth/support.4th +++ b/stand/forth/support.4th @@ -485,7 +485,7 @@ variable fd get-current ( -- wid ) previous definitions >search ( wid -- ) : reset_line_reading - 0 read_buffer .len ! + 0 to read_buffer_ptr ; : read_line From owner-dev-commits-src-all@freebsd.org Tue Jul 27 01:49: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 A425E654298; Tue, 27 Jul 2021 01:49: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 4GYfqK46qyz4vXG; Tue, 27 Jul 2021 01:49: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 6DB8C21D2C; Tue, 27 Jul 2021 01:49: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 16R1nXEp067308; Tue, 27 Jul 2021 01:49:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16R1nXvb067307; Tue, 27 Jul 2021 01:49:33 GMT (envelope-from git) Date: Tue, 27 Jul 2021 01:49:33 GMT Message-Id: <202107270149.16R1nXvb067307@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: 978804184224 - stable/13 - uart: Fix an out-of-bounds read in ns8250_bus_probe() 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: 97880418422475bc35c2485074ac77912f202305 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, 27 Jul 2021 01:49:33 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=97880418422475bc35c2485074ac77912f202305 commit 97880418422475bc35c2485074ac77912f202305 Author: Mark Johnston AuthorDate: 2021-07-13 21:49:39 +0000 Commit: Mark Johnston CommitDate: 2021-07-27 01:46:34 +0000 uart: Fix an out-of-bounds read in ns8250_bus_probe() The problem is that ns8250_bus_probe() accesses a field from the ns8250_softc, which embeds the generic UART softc, but the ns8250_softc hasn't yet been allocated because we're still probing. This is a regression from commit 0aefb0a63c50. This fixed a problem where one of the upper four IER bits, which are usually reserved, needs to be set in order to get RX interrupts before the RX FIFO is full. At the same time, we avoid clearing those reserved bits (see commit 58957d87173, though other UART drivers I looked at do not bother with this). So, copy what ns8250_init() does to disable interrupts, since we don't know what the "right" mask is at this point. Reported by: syzbot+f256beefd0df9eb796e7@syzkaller.appspotmail.com Reviewed by: imp Sponsored by: The FreeBSD Foundation (cherry picked from commit 4a9a41650c909706bc0b9a3f29817c11b262b0a0) --- sys/dev/uart/uart_dev_ns8250.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sys/dev/uart/uart_dev_ns8250.c b/sys/dev/uart/uart_dev_ns8250.c index 45b4d315c3d5..2b2f75cf5336 100644 --- a/sys/dev/uart/uart_dev_ns8250.c +++ b/sys/dev/uart/uart_dev_ns8250.c @@ -791,13 +791,11 @@ ns8250_bus_param(struct uart_softc *sc, int baudrate, int databits, int ns8250_bus_probe(struct uart_softc *sc) { - struct ns8250_softc *ns8250; struct uart_bas *bas; int count, delay, error, limit; uint8_t lsr, mcr, ier; uint8_t val; - ns8250 = (struct ns8250_softc *)sc; bas = &sc->sc_bas; error = ns8250_probe(bas); @@ -892,7 +890,8 @@ ns8250_bus_probe(struct uart_softc *sc) --limit) DELAY(delay); if (limit == 0) { - ier = uart_getreg(bas, REG_IER) & ns8250->ier_mask; + /* See the comment in ns8250_init(). */ + ier = uart_getreg(bas, REG_IER) & 0xe0; uart_setreg(bas, REG_IER, ier); uart_setreg(bas, REG_MCR, mcr); val = 0; From owner-dev-commits-src-all@freebsd.org Tue Jul 27 01:49: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 F028665429D; Tue, 27 Jul 2021 01:49: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 4GYfqL4lqJz4vjd; Tue, 27 Jul 2021 01:49: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 81A1421F91; Tue, 27 Jul 2021 01:49: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 16R1nYUl067332; Tue, 27 Jul 2021 01:49:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16R1nY1j067331; Tue, 27 Jul 2021 01:49:34 GMT (envelope-from git) Date: Tue, 27 Jul 2021 01:49:34 GMT Message-Id: <202107270149.16R1nY1j067331@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: b88a1996e218 - stable/13 - fifo: Explicitly initialize generation numbers when opening 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: b88a1996e2185b462f63108e96dd6f4226e8c7f6 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, 27 Jul 2021 01:49:35 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=b88a1996e2185b462f63108e96dd6f4226e8c7f6 commit b88a1996e2185b462f63108e96dd6f4226e8c7f6 Author: Mark Johnston AuthorDate: 2021-07-13 21:45:49 +0000 Commit: Mark Johnston CommitDate: 2021-07-27 01:46:45 +0000 fifo: Explicitly initialize generation numbers when opening The fi_rgen and fi_wgen fields are generation numbers used when sleeping waiting for the other end of the fifo to be opened. The fields were not explicitly initialized after allocation, but this was harmless. To avoid false positives from KMSAN, though, ensure that they get initialized to zero. Reported by: KMSAN Sponsored by: The FreeBSD Foundation (cherry picked from commit b9ca419a21d109948bf0fcea5c59725f1fe0cd7b) --- sys/fs/fifofs/fifo_vnops.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/fs/fifofs/fifo_vnops.c b/sys/fs/fifofs/fifo_vnops.c index 33c2c8ab2951..d2a51de84fba 100644 --- a/sys/fs/fifofs/fifo_vnops.c +++ b/sys/fs/fifofs/fifo_vnops.c @@ -154,9 +154,9 @@ fifo_open(ap) error = pipe_named_ctor(&fpipe, td); if (error != 0) return (error); - fip = malloc(sizeof(*fip), M_VNODE, M_WAITOK); + fip = malloc(sizeof(*fip), M_VNODE, M_WAITOK | M_ZERO); fip->fi_pipe = fpipe; - fpipe->pipe_wgen = fip->fi_readers = fip->fi_writers = 0; + fpipe->pipe_wgen = 0; KASSERT(vp->v_fifoinfo == NULL, ("fifo_open: v_fifoinfo race")); vp->v_fifoinfo = fip; } From owner-dev-commits-src-all@freebsd.org Tue Jul 27 01:49: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 05AD2654053; Tue, 27 Jul 2021 01:49: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 4GYfqN0w0Nz4vXN; Tue, 27 Jul 2021 01:49: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 A50D621B53; Tue, 27 Jul 2021 01:49: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 16R1nZ1F067356; Tue, 27 Jul 2021 01:49:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16R1nZkj067355; Tue, 27 Jul 2021 01:49:35 GMT (envelope-from git) Date: Tue, 27 Jul 2021 01:49:35 GMT Message-Id: <202107270149.16R1nZkj067355@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: a938bfca7a1a - stable/13 - graid3: Zero the metadata block before writing 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: a938bfca7a1ab2238c956e6098e78154da47ee2c 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, 27 Jul 2021 01:49:37 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=a938bfca7a1ab2238c956e6098e78154da47ee2c commit a938bfca7a1ab2238c956e6098e78154da47ee2c Author: Mark Johnston AuthorDate: 2021-07-13 21:46:02 +0000 Commit: Mark Johnston CommitDate: 2021-07-27 01:47:12 +0000 graid3: Zero the metadata block before writing Ensure that string buffers and pad bytes are zero-filled before writing graid3 metadata. Reported by: KMSAN Sponsored by: The FreeBSD Foundation (cherry picked from commit 39552dff7bb5463a74e5195d65a3252c583d9414) --- sys/geom/raid3/g_raid3.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/sys/geom/raid3/g_raid3.c b/sys/geom/raid3/g_raid3.c index 5fe67c00068d..159eff990892 100644 --- a/sys/geom/raid3/g_raid3.c +++ b/sys/geom/raid3/g_raid3.c @@ -743,6 +743,7 @@ g_raid3_fill_metadata(struct g_raid3_disk *disk, struct g_raid3_metadata *md) struct g_raid3_softc *sc; struct g_provider *pp; + bzero(md, sizeof(*md)); sc = disk->d_softc; strlcpy(md->md_magic, G_RAID3_MAGIC, sizeof(md->md_magic)); md->md_version = G_RAID3_VERSION; @@ -756,9 +757,7 @@ g_raid3_fill_metadata(struct g_raid3_disk *disk, struct g_raid3_metadata *md) md->md_no = disk->d_no; md->md_syncid = disk->d_sync.ds_syncid; md->md_dflags = (disk->d_flags & G_RAID3_DISK_FLAG_MASK); - if (disk->d_state != G_RAID3_DISK_STATE_SYNCHRONIZING) - md->md_sync_offset = 0; - else { + if (disk->d_state == G_RAID3_DISK_STATE_SYNCHRONIZING) { md->md_sync_offset = disk->d_sync.ds_offset_done / (sc->sc_ndisks - 1); } @@ -768,12 +767,8 @@ g_raid3_fill_metadata(struct g_raid3_disk *disk, struct g_raid3_metadata *md) pp = NULL; if ((disk->d_flags & G_RAID3_DISK_FLAG_HARDCODED) != 0 && pp != NULL) strlcpy(md->md_provider, pp->name, sizeof(md->md_provider)); - else - bzero(md->md_provider, sizeof(md->md_provider)); if (pp != NULL) md->md_provsize = pp->mediasize; - else - md->md_provsize = 0; } void From owner-dev-commits-src-all@freebsd.org Tue Jul 27 01:49: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 3AD1A654310; Tue, 27 Jul 2021 01:49: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 4GYfqP0mZPz4vjm; Tue, 27 Jul 2021 01:49: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 CB04821ECF; Tue, 27 Jul 2021 01:49: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 16R1naPY067385; Tue, 27 Jul 2021 01:49:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16R1na8S067384; Tue, 27 Jul 2021 01:49:36 GMT (envelope-from git) Date: Tue, 27 Jul 2021 01:49:36 GMT Message-Id: <202107270149.16R1na8S067384@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: f065d0bb299b - stable/13 - blist: Correct the node count computed in blist_create() 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: f065d0bb299bcedf1adc003397d340f88688ff75 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, 27 Jul 2021 01:49:37 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=f065d0bb299bcedf1adc003397d340f88688ff75 commit f065d0bb299bcedf1adc003397d340f88688ff75 Author: Mark Johnston AuthorDate: 2021-07-13 21:47:27 +0000 Commit: Mark Johnston CommitDate: 2021-07-27 01:47:20 +0000 blist: Correct the node count computed in blist_create() Commit bb4a27f927a1 added the ability to allocate a span of blocks crossing a meta node boundary. To ensure that blst_next_leaf_alloc() does not walk past the end of the tree, an extra all-zero meta node needs to be present at the end of the allocation, and blst_next_leaf_alloc() is implemented such that the presence of this node terminates the search. blist_create() computes the number of nodes required. It had two problems: 1. When the size of the blist is a power of BLIST_RADIX, we would unnecessarily allocate an extra level in the tree. 2. When the size of the blist is a multiple of BLIST_RADIX, we would fail to allocate a terminator node. In this case, blst_next_leaf_alloc() could scan beyond the bounds of the allocation. This was found using KASAN. Modify blist_create() to handle these cases correctly. Reported by: pho Reviewed by: dougm (cherry picked from commit 2783335caeae964bd8a1aa15726b523876613e45) --- sys/kern/subr_blist.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/sys/kern/subr_blist.c b/sys/kern/subr_blist.c index 27b226fd8a18..ba13fb4efd80 100644 --- a/sys/kern/subr_blist.c +++ b/sys/kern/subr_blist.c @@ -244,8 +244,16 @@ blist_create(daddr_t blocks, int flags) * Calculate the radix and node count used for scanning. */ nodes = 1; - for (radix = 1; radix <= blocks / BLIST_RADIX; radix *= BLIST_RADIX) - nodes += 1 + (blocks - 1) / radix / BLIST_RADIX; + for (radix = 1; (blocks - 1) / BLIST_RADIX / radix > 0; + radix *= BLIST_RADIX) + nodes += 1 + (blocks - 1) / BLIST_RADIX / radix; + + /* + * Include a sentinel node to ensure that cross-leaf scans stay within + * the bounds of the allocation. + */ + if (blocks % BLIST_RADIX == 0) + nodes++; bl = malloc(offsetof(struct blist, bl_root[nodes]), M_SWAP, flags | M_ZERO); From owner-dev-commits-src-all@freebsd.org Tue Jul 27 01:49: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 4852065405B; Tue, 27 Jul 2021 01:49: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 4GYfqQ291Kz4vlR; Tue, 27 Jul 2021 01:49: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 EB1CE21B54; Tue, 27 Jul 2021 01:49: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 16R1nbrt067411; Tue, 27 Jul 2021 01:49:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16R1nbIb067410; Tue, 27 Jul 2021 01:49:37 GMT (envelope-from git) Date: Tue, 27 Jul 2021 01:49:37 GMT Message-Id: <202107270149.16R1nbIb067410@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: 82b475c654ab - stable/13 - gmirror: Zero the metadata block before writing 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: 82b475c654abfaa9c28bb1e2e73dfbd15d3f45f4 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, 27 Jul 2021 01:49:39 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=82b475c654abfaa9c28bb1e2e73dfbd15d3f45f4 commit 82b475c654abfaa9c28bb1e2e73dfbd15d3f45f4 Author: Mark Johnston AuthorDate: 2021-07-13 21:45:57 +0000 Commit: Mark Johnston CommitDate: 2021-07-27 01:47:45 +0000 gmirror: Zero the metadata block before writing The mirror metadata fields contain string buffers and pad bytes, neither were being zeroed before metadata was written to disk. Also, the metadata structure is smaller than the sector size, and in one case gmirror was failing to zero-fill the full buffer before writing. Fix these problems by pre-zeroing the metadata structure and the sector buffer. Reported by: KMSAN Sponsored by: The FreeBSD Foundation (cherry picked from commit 7f053a44aef75eab395ce15a1c8a1399a2f89cad) --- sys/geom/mirror/g_mirror.c | 9 +-------- sys/geom/mirror/g_mirror_ctl.c | 2 +- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/sys/geom/mirror/g_mirror.c b/sys/geom/mirror/g_mirror.c index 51836b7eabb8..c0641d15673e 100644 --- a/sys/geom/mirror/g_mirror.c +++ b/sys/geom/mirror/g_mirror.c @@ -749,6 +749,7 @@ g_mirror_fill_metadata(struct g_mirror_softc *sc, struct g_mirror_disk *disk, struct g_mirror_metadata *md) { + bzero(md, sizeof(*md)); strlcpy(md->md_magic, G_MIRROR_MAGIC, sizeof(md->md_magic)); md->md_version = G_MIRROR_VERSION; strlcpy(md->md_name, sc->sc_name, sizeof(md->md_name)); @@ -760,14 +761,8 @@ g_mirror_fill_metadata(struct g_mirror_softc *sc, struct g_mirror_disk *disk, md->md_mediasize = sc->sc_mediasize; md->md_sectorsize = sc->sc_sectorsize; md->md_mflags = (sc->sc_flags & G_MIRROR_DEVICE_FLAG_MASK); - bzero(md->md_provider, sizeof(md->md_provider)); if (disk == NULL) { md->md_did = arc4random(); - md->md_priority = 0; - md->md_syncid = 0; - md->md_dflags = 0; - md->md_sync_offset = 0; - md->md_provsize = 0; } else { md->md_did = disk->d_id; md->md_priority = disk->d_priority; @@ -775,8 +770,6 @@ g_mirror_fill_metadata(struct g_mirror_softc *sc, struct g_mirror_disk *disk, md->md_dflags = (disk->d_flags & G_MIRROR_DISK_FLAG_MASK); if (disk->d_state == G_MIRROR_DISK_STATE_SYNCHRONIZING) md->md_sync_offset = disk->d_sync.ds_offset_done; - else - md->md_sync_offset = 0; if ((disk->d_flags & G_MIRROR_DISK_FLAG_HARDCODED) != 0) { strlcpy(md->md_provider, disk->d_consumer->provider->name, diff --git a/sys/geom/mirror/g_mirror_ctl.c b/sys/geom/mirror/g_mirror_ctl.c index 254841b6c04a..355504a6f90f 100644 --- a/sys/geom/mirror/g_mirror_ctl.c +++ b/sys/geom/mirror/g_mirror_ctl.c @@ -747,7 +747,7 @@ again: bzero(md.md_provider, sizeof(md.md_provider)); } md.md_provsize = pp->mediasize; - sector = g_malloc(pp->sectorsize, M_WAITOK); + sector = g_malloc(pp->sectorsize, M_WAITOK | M_ZERO); mirror_metadata_encode(&md, sector); error = g_write_data(disks[i].consumer, pp->mediasize - pp->sectorsize, sector, pp->sectorsize); From owner-dev-commits-src-all@freebsd.org Tue Jul 27 02:38: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 2653865700E; Tue, 27 Jul 2021 02:38: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 4GYgw20J8zz3Nmj; Tue, 27 Jul 2021 02:38: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 E5CAE22995; Tue, 27 Jul 2021 02:38: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 16R2cfLP034154; Tue, 27 Jul 2021 02:38:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16R2cfFS034153; Tue, 27 Jul 2021 02:38:41 GMT (envelope-from git) Date: Tue, 27 Jul 2021 02:38:41 GMT Message-Id: <202107270238.16R2cfFS034153@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: 320e5d7d398c - stable/13 - Revert "loader: support.4th resets the read buffer incorrectly" MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 320e5d7d398c9b66e73560e7789e39709d31ce7d 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, 27 Jul 2021 02:38:42 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=320e5d7d398c9b66e73560e7789e39709d31ce7d commit 320e5d7d398c9b66e73560e7789e39709d31ce7d Author: Warner Losh AuthorDate: 2021-07-26 22:40:41 +0000 Commit: Warner Losh CommitDate: 2021-07-27 02:37:40 +0000 Revert "loader: support.4th resets the read buffer incorrectly" This reverts commit 9c1c02093b90ae49745a174eb26ea85dd1990eec. It seems to have broken all old nextboot.conf files causing hangs on boot. PR: 239315 (cherry picked from commit 4783fb730fa1cfdbe5c905bb23ac74f681e2df6b) --- stand/forth/support.4th | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stand/forth/support.4th b/stand/forth/support.4th index ec04b7e9e322..d87cf16a16dd 100644 --- a/stand/forth/support.4th +++ b/stand/forth/support.4th @@ -485,7 +485,7 @@ variable fd get-current ( -- wid ) previous definitions >search ( wid -- ) : reset_line_reading - 0 read_buffer .len ! + 0 to read_buffer_ptr ; : read_line From owner-dev-commits-src-all@freebsd.org Tue Jul 27 02:45: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 4947865721E; Tue, 27 Jul 2021 02:45: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 4GYh3S13l2z3QJp; Tue, 27 Jul 2021 02:45: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 0300B22749; Tue, 27 Jul 2021 02:45: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 16R2j78b046881; Tue, 27 Jul 2021 02:45:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16R2j7Up046880; Tue, 27 Jul 2021 02:45:07 GMT (envelope-from git) Date: Tue, 27 Jul 2021 02:45:07 GMT Message-Id: <202107270245.16R2j7Up046880@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: ac56cd3ba627 - stable/12 - Revert "loader: support.4th resets the read buffer incorrectly" MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: ac56cd3ba627b403da2c52ae6cecb5b4143be6c7 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, 27 Jul 2021 02:45:08 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=ac56cd3ba627b403da2c52ae6cecb5b4143be6c7 commit ac56cd3ba627b403da2c52ae6cecb5b4143be6c7 Author: Warner Losh AuthorDate: 2021-07-26 22:40:41 +0000 Commit: Warner Losh CommitDate: 2021-07-27 02:38:58 +0000 Revert "loader: support.4th resets the read buffer incorrectly" This reverts commit 9c1c02093b90ae49745a174eb26ea85dd1990eec. It seems to have broken all old nextboot.conf files causing hangs on boot. PR: 239315 Sponsored by: Netflix (cherry picked from commit 4783fb730fa1cfdbe5c905bb23ac74f681e2df6b) --- stand/forth/support.4th | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stand/forth/support.4th b/stand/forth/support.4th index ed5e6a6da9ee..64c71e12ec26 100644 --- a/stand/forth/support.4th +++ b/stand/forth/support.4th @@ -410,7 +410,7 @@ variable fd get-current ( -- wid ) previous definitions >search ( wid -- ) : reset_line_reading - 0 read_buffer .len ! + 0 to read_buffer_ptr ; : read_line From owner-dev-commits-src-all@freebsd.org Tue Jul 27 09:14: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 3D12C65BADD; Tue, 27 Jul 2021 09:14: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 4GYrhZ0ySwz4vTC; Tue, 27 Jul 2021 09:14: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 F3C1827F76; Tue, 27 Jul 2021 09:14: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 16R9ELoc067746; Tue, 27 Jul 2021 09:14:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16R9ELwh067745; Tue, 27 Jul 2021 09:14:21 GMT (envelope-from git) Date: Tue, 27 Jul 2021 09:14:21 GMT Message-Id: <202107270914.16R9ELwh067745@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: 85ae35ef37c0 - main - /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/main X-Git-Reftype: branch X-Git-Commit: 85ae35ef37c07c32d4e923435b637cbf0df3e8a3 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, 27 Jul 2021 09:14:22 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=85ae35ef37c07c32d4e923435b637cbf0df3e8a3 commit 85ae35ef37c07c32d4e923435b637cbf0df3e8a3 Author: Konstantin Belousov AuthorDate: 2021-07-27 00:22:14 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-27 09:13:43 +0000 /dev/pci: clarify meaning of writeable file descriptor Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31317 --- 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 ef2f48ecb48d..e1813b67c05c 100644 --- a/sys/dev/pci/pci_user.c +++ b/sys/dev/pci/pci_user.c @@ -947,7 +947,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 Jul 27 11:46: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 1F96B65DB3E; Tue, 27 Jul 2021 11:46: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 4GYw4N02s3z3s1C; Tue, 27 Jul 2021 11:46: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 DDB8D1DF3; Tue, 27 Jul 2021 11:46: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 16RBkhpe067561; Tue, 27 Jul 2021 11:46:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RBkh6e067560; Tue, 27 Jul 2021 11:46:43 GMT (envelope-from git) Date: Tue, 27 Jul 2021 11:46:43 GMT Message-Id: <202107271146.16RBkh6e067560@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: 0df576d98e15 - stable/13 - pf: factor out pf_synproxy() 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: 0df576d98e15bbafa73522a099bf0f34990496b4 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, 27 Jul 2021 11:46:44 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=0df576d98e15bbafa73522a099bf0f34990496b4 commit 0df576d98e15bbafa73522a099bf0f34990496b4 Author: Kristof Provost AuthorDate: 2021-06-10 13:49:09 +0000 Commit: Kristof Provost CommitDate: 2021-07-27 07:42:13 +0000 pf: factor out pf_synproxy() MFC after: 1 week Sponsored by: Modirum MDPay Differential Revision: https://reviews.freebsd.org/D31137 (cherry picked from commit ee9c3d38039eb29966e1f0b8f617bc564c078289) --- sys/netpfil/pf/pf.c | 85 ++++++++++++++++++++++++++++++----------------------- 1 file changed, 49 insertions(+), 36 deletions(-) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index c47a0098550d..a08f38f3a286 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -4455,45 +4455,13 @@ pf_tcp_track_sloppy(struct pf_state_peer *src, struct pf_state_peer *dst, } static int -pf_test_state_tcp(struct pf_kstate **state, int direction, struct pfi_kkif *kif, - struct mbuf *m, int off, void *h, struct pf_pdesc *pd, - u_short *reason) +pf_synproxy(struct pf_pdesc *pd, struct pf_kstate **state, u_short *reason) { - struct pf_state_key_cmp key; + struct pf_state_key *sk = (*state)->key[pd->didx]; struct tcphdr *th = &pd->hdr.tcp; - int copyback = 0; - struct pf_state_peer *src, *dst; - struct pf_state_key *sk; - - bzero(&key, sizeof(key)); - key.af = pd->af; - key.proto = IPPROTO_TCP; - if (direction == PF_IN) { /* wire side, straight */ - PF_ACPY(&key.addr[0], pd->src, key.af); - PF_ACPY(&key.addr[1], pd->dst, key.af); - key.port[0] = th->th_sport; - key.port[1] = th->th_dport; - } else { /* stack side, reverse */ - PF_ACPY(&key.addr[1], pd->src, key.af); - PF_ACPY(&key.addr[0], pd->dst, key.af); - key.port[1] = th->th_sport; - key.port[0] = th->th_dport; - } - - STATE_LOOKUP(kif, &key, direction, *state, pd); - - if (direction == (*state)->direction) { - src = &(*state)->src; - dst = &(*state)->dst; - } else { - src = &(*state)->dst; - dst = &(*state)->src; - } - - sk = (*state)->key[pd->didx]; if ((*state)->src.state == PF_TCPS_PROXY_SRC) { - if (direction != (*state)->direction) { + if (pd->dir != (*state)->direction) { REASON_SET(reason, PFRES_SYNPROXY); return (PF_SYNPROXY_DROP); } @@ -4521,7 +4489,7 @@ pf_test_state_tcp(struct pf_kstate **state, int direction, struct pfi_kkif *kif, (*state)->src.state = PF_TCPS_PROXY_DST; } if ((*state)->src.state == PF_TCPS_PROXY_DST) { - if (direction == (*state)->direction) { + if (pd->dir == (*state)->direction) { if (((th->th_flags & (TH_SYN|TH_ACK)) != TH_ACK) || (ntohl(th->th_ack) != (*state)->src.seqhi + 1) || (ntohl(th->th_seq) != (*state)->src.seqlo + 1)) { @@ -4572,6 +4540,51 @@ pf_test_state_tcp(struct pf_kstate **state, int direction, struct pfi_kkif *kif, } } + return (PF_PASS); +} + +static int +pf_test_state_tcp(struct pf_kstate **state, int direction, struct pfi_kkif *kif, + struct mbuf *m, int off, void *h, struct pf_pdesc *pd, + u_short *reason) +{ + struct pf_state_key_cmp key; + struct tcphdr *th = &pd->hdr.tcp; + int copyback = 0; + int action; + struct pf_state_peer *src, *dst; + struct pf_state_key *sk; + + bzero(&key, sizeof(key)); + key.af = pd->af; + key.proto = IPPROTO_TCP; + if (direction == PF_IN) { /* wire side, straight */ + PF_ACPY(&key.addr[0], pd->src, key.af); + PF_ACPY(&key.addr[1], pd->dst, key.af); + key.port[0] = th->th_sport; + key.port[1] = th->th_dport; + } else { /* stack side, reverse */ + PF_ACPY(&key.addr[1], pd->src, key.af); + PF_ACPY(&key.addr[0], pd->dst, key.af); + key.port[1] = th->th_sport; + key.port[0] = th->th_dport; + } + + STATE_LOOKUP(kif, &key, direction, *state, pd); + + if (direction == (*state)->direction) { + src = &(*state)->src; + dst = &(*state)->dst; + } else { + src = &(*state)->dst; + dst = &(*state)->src; + } + + sk = (*state)->key[pd->didx]; + + if ((action = pf_synproxy(pd, state, reason)) != PF_PASS) + return (action); + if (((th->th_flags & (TH_SYN|TH_ACK)) == TH_SYN) && dst->state >= TCPS_FIN_WAIT_2 && src->state >= TCPS_FIN_WAIT_2) { From owner-dev-commits-src-all@freebsd.org Tue Jul 27 11:46: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 7AB9265DAC8; Tue, 27 Jul 2021 11:46: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 4GYw4N330Bz3sHM; Tue, 27 Jul 2021 11:46: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 50A351DF4; Tue, 27 Jul 2021 11:46: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 16RBkipG067667; Tue, 27 Jul 2021 11:46:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RBkibo067666; Tue, 27 Jul 2021 11:46:44 GMT (envelope-from git) Date: Tue, 27 Jul 2021 11:46:44 GMT Message-Id: <202107271146.16RBkibo067666@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: 57eda4b922b0 - stable/12 - pf: factor out pf_synproxy() 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: 57eda4b922b0d29c5971dbcb6b09b966b064cc3f 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, 27 Jul 2021 11:46:44 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=57eda4b922b0d29c5971dbcb6b09b966b064cc3f commit 57eda4b922b0d29c5971dbcb6b09b966b064cc3f Author: Kristof Provost AuthorDate: 2021-06-10 13:49:09 +0000 Commit: Kristof Provost CommitDate: 2021-07-27 07:42:40 +0000 pf: factor out pf_synproxy() MFC after: 1 week Sponsored by: Modirum MDPay Differential Revision: https://reviews.freebsd.org/D31137 (cherry picked from commit ee9c3d38039eb29966e1f0b8f617bc564c078289) --- sys/netpfil/pf/pf.c | 85 ++++++++++++++++++++++++++++++----------------------- 1 file changed, 49 insertions(+), 36 deletions(-) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index b313decc3806..8d0da5c6f209 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -4459,45 +4459,13 @@ pf_tcp_track_sloppy(struct pf_state_peer *src, struct pf_state_peer *dst, } static int -pf_test_state_tcp(struct pf_kstate **state, int direction, struct pfi_kkif *kif, - struct mbuf *m, int off, void *h, struct pf_pdesc *pd, - u_short *reason) +pf_synproxy(struct pf_pdesc *pd, struct pf_kstate **state, u_short *reason) { - struct pf_state_key_cmp key; + struct pf_state_key *sk = (*state)->key[pd->didx]; struct tcphdr *th = &pd->hdr.tcp; - int copyback = 0; - struct pf_state_peer *src, *dst; - struct pf_state_key *sk; - - bzero(&key, sizeof(key)); - key.af = pd->af; - key.proto = IPPROTO_TCP; - if (direction == PF_IN) { /* wire side, straight */ - PF_ACPY(&key.addr[0], pd->src, key.af); - PF_ACPY(&key.addr[1], pd->dst, key.af); - key.port[0] = th->th_sport; - key.port[1] = th->th_dport; - } else { /* stack side, reverse */ - PF_ACPY(&key.addr[1], pd->src, key.af); - PF_ACPY(&key.addr[0], pd->dst, key.af); - key.port[1] = th->th_sport; - key.port[0] = th->th_dport; - } - - STATE_LOOKUP(kif, &key, direction, *state, pd); - - if (direction == (*state)->direction) { - src = &(*state)->src; - dst = &(*state)->dst; - } else { - src = &(*state)->dst; - dst = &(*state)->src; - } - - sk = (*state)->key[pd->didx]; if ((*state)->src.state == PF_TCPS_PROXY_SRC) { - if (direction != (*state)->direction) { + if (pd->dir != (*state)->direction) { REASON_SET(reason, PFRES_SYNPROXY); return (PF_SYNPROXY_DROP); } @@ -4525,7 +4493,7 @@ pf_test_state_tcp(struct pf_kstate **state, int direction, struct pfi_kkif *kif, (*state)->src.state = PF_TCPS_PROXY_DST; } if ((*state)->src.state == PF_TCPS_PROXY_DST) { - if (direction == (*state)->direction) { + if (pd->dir == (*state)->direction) { if (((th->th_flags & (TH_SYN|TH_ACK)) != TH_ACK) || (ntohl(th->th_ack) != (*state)->src.seqhi + 1) || (ntohl(th->th_seq) != (*state)->src.seqlo + 1)) { @@ -4576,6 +4544,51 @@ pf_test_state_tcp(struct pf_kstate **state, int direction, struct pfi_kkif *kif, } } + return (PF_PASS); +} + +static int +pf_test_state_tcp(struct pf_kstate **state, int direction, struct pfi_kkif *kif, + struct mbuf *m, int off, void *h, struct pf_pdesc *pd, + u_short *reason) +{ + struct pf_state_key_cmp key; + struct tcphdr *th = &pd->hdr.tcp; + int copyback = 0; + int action; + struct pf_state_peer *src, *dst; + struct pf_state_key *sk; + + bzero(&key, sizeof(key)); + key.af = pd->af; + key.proto = IPPROTO_TCP; + if (direction == PF_IN) { /* wire side, straight */ + PF_ACPY(&key.addr[0], pd->src, key.af); + PF_ACPY(&key.addr[1], pd->dst, key.af); + key.port[0] = th->th_sport; + key.port[1] = th->th_dport; + } else { /* stack side, reverse */ + PF_ACPY(&key.addr[1], pd->src, key.af); + PF_ACPY(&key.addr[0], pd->dst, key.af); + key.port[1] = th->th_sport; + key.port[0] = th->th_dport; + } + + STATE_LOOKUP(kif, &key, direction, *state, pd); + + if (direction == (*state)->direction) { + src = &(*state)->src; + dst = &(*state)->dst; + } else { + src = &(*state)->dst; + dst = &(*state)->src; + } + + sk = (*state)->key[pd->didx]; + + if ((action = pf_synproxy(pd, state, reason)) != PF_PASS) + return (action); + if (((th->th_flags & (TH_SYN|TH_ACK)) == TH_SYN) && dst->state >= TCPS_FIN_WAIT_2 && src->state >= TCPS_FIN_WAIT_2) { From owner-dev-commits-src-all@freebsd.org Tue Jul 27 11:46: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 6108265E108; Tue, 27 Jul 2021 11:46: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 4GYw4P0syxz3s1F; Tue, 27 Jul 2021 11:46: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 06408211F; Tue, 27 Jul 2021 11:46: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 16RBkinT067691; Tue, 27 Jul 2021 11:46:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RBkiQF067690; Tue, 27 Jul 2021 11:46:44 GMT (envelope-from git) Date: Tue, 27 Jul 2021 11:46:44 GMT Message-Id: <202107271146.16RBkiQF067690@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: c3d03672e119 - stable/13 - pf: syncookie support 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: c3d03672e119df47a43014a212d65983ae2cf230 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, 27 Jul 2021 11:46:45 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=c3d03672e119df47a43014a212d65983ae2cf230 commit c3d03672e119df47a43014a212d65983ae2cf230 Author: Kristof Provost AuthorDate: 2021-05-20 09:54:41 +0000 Commit: Kristof Provost CommitDate: 2021-07-27 07:42:25 +0000 pf: syncookie support Import OpenBSD's syncookie support for pf. This feature help pf resist TCP SYN floods by only creating states once the remote host completes the TCP handshake rather than when the initial SYN packet is received. This is accomplished by using the initial sequence numbers to encode a cookie (hence the name) in the SYN+ACK response and verifying this on receipt of the client ACK. Reviewed by: kbowling Obtained from: OpenBSD MFC after: 1 week Sponsored by: Modirum MDPay Differential Revision: https://reviews.freebsd.org/D31138 (cherry picked from commit 8e1864ed07121b479b95d7e3a5931a9e0ffd4713) --- sys/modules/pf/Makefile | 2 +- sys/net/pfvar.h | 34 ++++ sys/netinet/tcp.h | 2 + sys/netpfil/pf/pf.c | 129 +++++++++++---- sys/netpfil/pf/pf.h | 3 +- sys/netpfil/pf/pf_ioctl.c | 3 +- sys/netpfil/pf/pf_mtag.h | 1 + sys/netpfil/pf/pf_syncookies.c | 350 +++++++++++++++++++++++++++++++++++++++++ 8 files changed, 492 insertions(+), 32 deletions(-) diff --git a/sys/modules/pf/Makefile b/sys/modules/pf/Makefile index 7293b30cda9d..d361ea0802fb 100644 --- a/sys/modules/pf/Makefile +++ b/sys/modules/pf/Makefile @@ -4,7 +4,7 @@ KMOD= pf SRCS= pf.c pf_if.c pf_lb.c pf_osfp.c pf_ioctl.c pf_norm.c pf_table.c \ - pf_ruleset.c pf_nv.c in4_cksum.c \ + pf_ruleset.c pf_nv.c pf_syncookies.c in4_cksum.c \ bus_if.h device_if.h \ opt_pf.h opt_inet.h opt_inet6.h opt_bpf.h opt_sctp.h opt_global.h diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 73f3168aa31f..50634f39a549 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -1132,6 +1132,12 @@ struct pf_pdesc { counter_u64_add(V_pf_status.counters[x], 1); \ } while (0) +enum pf_syncookies_mode { + PF_SYNCOOKIES_NEVER = 0, + PF_SYNCOOKIES_ALWAYS = 1, + PF_SYNCOOKIES_MODE_MAX = PF_SYNCOOKIES_ALWAYS +}; + struct pf_kstatus { counter_u64_t counters[PFRES_MAX]; /* reason for passing/dropping */ counter_u64_t lcounters[LCNT_MAX]; /* limit counters */ @@ -1146,6 +1152,8 @@ struct pf_kstatus { char ifname[IFNAMSIZ]; uint8_t pf_chksum[PF_MD5_DIGEST_LENGTH]; bool keep_counters; + enum pf_syncookies_mode syncookies_mode; + bool syncookies_active; }; struct pf_divert { @@ -1486,6 +1494,8 @@ struct pfioc_iface { #define DIOCKILLSRCNODES _IOWR('D', 91, struct pfioc_src_node_kill) #define DIOCKEEPCOUNTERS _IOWR('D', 92, struct pfioc_nv) #define DIOCGETSTATESV2 _IOWR('D', 93, struct pfioc_states_v2) +#define DIOCGETSYNCOOKIES _IOWR('D', 94, struct pfioc_nv) +#define DIOCSETSYNCOOKIES _IOWR('D', 95, struct pfioc_nv) struct pf_ifspeed_v0 { char ifname[IFNAMSIZ]; @@ -1816,6 +1826,30 @@ int pf_addr_cmp(struct pf_addr *, struct pf_addr *, sa_family_t); void pf_qid2qname(u_int32_t, char *); +u_int16_t pf_get_mss(struct mbuf *, int, u_int16_t, sa_family_t); +u_int8_t pf_get_wscale(struct mbuf *, int, u_int16_t, sa_family_t); +struct mbuf *pf_build_tcp(const struct pf_krule *, sa_family_t, + const struct pf_addr *, const struct pf_addr *, + u_int16_t, u_int16_t, u_int32_t, u_int32_t, + u_int8_t, u_int16_t, u_int16_t, u_int8_t, int, + u_int16_t); +void pf_send_tcp(const struct pf_krule *, sa_family_t, + const struct pf_addr *, const struct pf_addr *, + u_int16_t, u_int16_t, u_int32_t, u_int32_t, + u_int8_t, u_int16_t, u_int16_t, u_int8_t, int, + u_int16_t); + +void pf_syncookies_init(void); +int pf_syncookies_setmode(u_int8_t); +int pf_get_syncookies(struct pfioc_nv *); +int pf_set_syncookies(struct pfioc_nv *); +int pf_synflood_check(struct pf_pdesc *); +void pf_syncookie_send(struct mbuf *m, int off, + struct pf_pdesc *); +u_int8_t pf_syncookie_validate(struct pf_pdesc *); +struct mbuf * pf_syncookie_recreate_syn(uint8_t, int, + struct pf_pdesc *); + VNET_DECLARE(struct pf_kstatus, pf_status); #define V_pf_status VNET(pf_status) diff --git a/sys/netinet/tcp.h b/sys/netinet/tcp.h index 7273cb5104ea..4f062b31a051 100644 --- a/sys/netinet/tcp.h +++ b/sys/netinet/tcp.h @@ -105,6 +105,8 @@ struct tcphdr { #define TCPOPT_FAST_OPEN 34 #define TCPOLEN_FAST_OPEN_EMPTY 2 +#define MAX_TCPOPTLEN 40 /* Absolute maximum TCP options len */ + /* Miscellaneous constants */ #define MAX_SACK_BLKS 6 /* Max # SACK blocks stored at receiver side */ #define TCP_MAX_SACK 4 /* MAX # SACKs sent in any segment */ diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index a08f38f3a286..4005e453cfb7 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -243,11 +243,6 @@ static void pf_change_icmp(struct pf_addr *, u_int16_t *, struct pf_addr *, struct pf_addr *, u_int16_t, u_int16_t *, u_int16_t *, u_int16_t *, u_int16_t *, u_int8_t, sa_family_t); -static void pf_send_tcp(const struct pf_krule *, sa_family_t, - const struct pf_addr *, const struct pf_addr *, - u_int16_t, u_int16_t, u_int32_t, u_int32_t, - u_int8_t, u_int16_t, u_int16_t, u_int8_t, int, - u_int16_t); static void pf_send_icmp(struct mbuf *, u_int8_t, u_int8_t, sa_family_t, struct pf_krule *); static void pf_detach_state(struct pf_kstate *); @@ -289,10 +284,6 @@ static int pf_test_state_icmp(struct pf_kstate **, int, void *, struct pf_pdesc *, u_short *); static int pf_test_state_other(struct pf_kstate **, int, struct pfi_kkif *, struct mbuf *, struct pf_pdesc *); -static u_int8_t pf_get_wscale(struct mbuf *, int, u_int16_t, - sa_family_t); -static u_int16_t pf_get_mss(struct mbuf *, int, u_int16_t, - sa_family_t); static u_int16_t pf_calc_mss(struct pf_addr *, sa_family_t, int, u_int16_t); static int pf_check_proto_cksum(struct mbuf *, int, int, @@ -2460,14 +2451,13 @@ pf_modulate_sack(struct mbuf *m, int off, struct pf_pdesc *pd, return (copyback); } -static void -pf_send_tcp(const struct pf_krule *r, sa_family_t af, +struct mbuf * +pf_build_tcp(const struct pf_krule *r, sa_family_t af, const struct pf_addr *saddr, const struct pf_addr *daddr, u_int16_t sport, u_int16_t dport, u_int32_t seq, u_int32_t ack, u_int8_t flags, u_int16_t win, u_int16_t mss, u_int8_t ttl, int tag, u_int16_t rtag) { - struct pf_send_entry *pfse; struct mbuf *m; int len, tlen; #ifdef INET @@ -2503,22 +2493,16 @@ pf_send_tcp(const struct pf_krule *r, sa_family_t af, panic("%s: unsupported af %d", __func__, af); } - /* Allocate outgoing queue entry, mbuf and mbuf tag. */ - pfse = malloc(sizeof(*pfse), M_PFTEMP, M_NOWAIT); - if (pfse == NULL) - return; m = m_gethdr(M_NOWAIT, MT_DATA); - if (m == NULL) { - free(pfse, M_PFTEMP); - return; - } + if (m == NULL) + return (NULL); + #ifdef MAC mac_netinet_firewall_send(m); #endif if ((pf_mtag = pf_get_mtag(m)) == NULL) { - free(pfse, M_PFTEMP); m_freem(m); - return; + return (NULL); } if (tag) m->m_flags |= M_SKIP_FIREWALL; @@ -2599,8 +2583,6 @@ pf_send_tcp(const struct pf_krule *r, sa_family_t af, h->ip_len = htons(len); h->ip_ttl = ttl ? ttl : V_ip_defttl; h->ip_sum = 0; - - pfse->pfse_type = PFSE_IP; break; #endif /* INET */ #ifdef INET6 @@ -2611,11 +2593,48 @@ pf_send_tcp(const struct pf_krule *r, sa_family_t af, h6->ip6_vfc |= IPV6_VERSION; h6->ip6_hlim = IPV6_DEFHLIM; + break; +#endif /* INET6 */ + } + + return (m); +} + +void +pf_send_tcp(const struct pf_krule *r, sa_family_t af, + const struct pf_addr *saddr, const struct pf_addr *daddr, + u_int16_t sport, u_int16_t dport, u_int32_t seq, u_int32_t ack, + u_int8_t flags, u_int16_t win, u_int16_t mss, u_int8_t ttl, int tag, + u_int16_t rtag) +{ + struct pf_send_entry *pfse; + struct mbuf *m; + + m = pf_build_tcp(r, af, saddr, daddr, sport, dport, seq, ack, flags, + win, mss, ttl, tag, rtag); + if (m == NULL) + return; + + /* Allocate outgoing queue entry, mbuf and mbuf tag. */ + pfse = malloc(sizeof(*pfse), M_PFTEMP, M_NOWAIT); + if (pfse == NULL) { + m_freem(m); + return; + } + switch (af) { +#ifdef INET + case AF_INET: + pfse->pfse_type = PFSE_IP; + break; +#endif /* INET */ +#ifdef INET6 + case AF_INET6: pfse->pfse_type = PFSE_IP6; break; #endif /* INET6 */ } + pfse->pfse_m = m; pf_send(pfse); } @@ -3190,7 +3209,7 @@ pf_socket_lookup(int direction, struct pf_pdesc *pd, struct mbuf *m) return (1); } -static u_int8_t +u_int8_t pf_get_wscale(struct mbuf *m, int off, u_int16_t th_off, sa_family_t af) { int hlen; @@ -3230,7 +3249,7 @@ pf_get_wscale(struct mbuf *m, int off, u_int16_t th_off, sa_family_t af) return (wscale); } -static u_int16_t +u_int16_t pf_get_mss(struct mbuf *m, int off, u_int16_t th_off, sa_family_t af) { int hlen; @@ -6047,6 +6066,18 @@ pf_test(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, struct inpcb * goto done; } pd.p_len = pd.tot_len - off - (pd.hdr.tcp.th_off << 2); + + pd.sport = &pd.hdr.tcp.th_sport; + pd.dport = &pd.hdr.tcp.th_dport; + + /* Respond to SYN with a syncookie. */ + if ((pd.hdr.tcp.th_flags & (TH_SYN|TH_ACK|TH_RST)) == TH_SYN && + pd.dir == PF_IN && pf_synflood_check(&pd)) { + pf_syncookie_send(m, off, &pd); + action = PF_DROP; + break; + } + if ((pd.hdr.tcp.th_flags & TH_ACK) && pd.p_len == 0) pqid = 1; action = pf_normalize_tcp(dir, kif, m, 0, off, h, &pd); @@ -6060,9 +6091,49 @@ pf_test(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, struct inpcb * r = s->rule.ptr; a = s->anchor.ptr; log = s->log; - } else if (s == NULL) - action = pf_test_rule(&r, &s, dir, kif, m, off, &pd, - &a, &ruleset, inp); + } else if (s == NULL) { + /* Validate remote SYN|ACK, re-create original SYN if + * valid. */ + if ((pd.hdr.tcp.th_flags & (TH_SYN|TH_ACK|TH_RST)) == + TH_ACK && pf_syncookie_validate(&pd) && + pd.dir == PF_IN) { + struct mbuf *msyn; + + msyn = pf_syncookie_recreate_syn(h->ip_ttl, + off,&pd); + if (msyn == NULL) { + action = PF_DROP; + break; + } + + action = pf_test(dir, pflags, ifp, &msyn, inp); + m_freem(msyn); + + if (action == PF_PASS) { + action = pf_test_state_tcp(&s, dir, + kif, m, off, h, &pd, &reason); + if (action != PF_PASS || s == NULL) { + action = PF_DROP; + break; + } + + s->src.seqhi = ntohl(pd.hdr.tcp.th_ack) + - 1; + s->src.seqlo = ntohl(pd.hdr.tcp.th_seq) + - 1; + s->src.state = PF_TCPS_PROXY_DST; + + action = pf_synproxy(&pd, &s, &reason); + if (action != PF_PASS) + break; + } + break; + } + else { + action = pf_test_rule(&r, &s, dir, kif, m, off, + &pd, &a, &ruleset, inp); + } + } break; } diff --git a/sys/netpfil/pf/pf.h b/sys/netpfil/pf/pf.h index 011d69a746dd..869e8e32eb5c 100644 --- a/sys/netpfil/pf/pf.h +++ b/sys/netpfil/pf/pf.h @@ -159,7 +159,8 @@ enum { PF_ADDR_ADDRMASK, PF_ADDR_NOROUTE, PF_ADDR_DYNIFTL, #define LCNT_SRCCONNRATE 4 /* max-src-conn-rate */ #define LCNT_OVERLOAD_TABLE 5 /* entry added to overload table */ #define LCNT_OVERLOAD_FLUSH 6 /* state entries flushed */ -#define LCNT_MAX 7 /* total+1 */ +#define LCNT_SYNCOOKIES_VALID 7 /* syncookies validated */ /* XXX TODO: Ensure no API breakage! */ +#define LCNT_MAX 8 /* total+1 */ #define LCNT_NAMES { \ "max states per rule", \ diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index c9105bf22385..d5b33a48a57c 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -285,6 +285,7 @@ pfattach_vnet(void) pfr_initialize(); pfi_initialize_vnet(); pf_normalize_init(); + pf_syncookies_init(); V_pf_limits[PF_LIMIT_STATES].limit = PFSTATE_HIWAT; V_pf_limits[PF_LIMIT_SRC_NODES].limit = PFSNODE_HIWAT; @@ -5525,7 +5526,7 @@ pf_load(void) { int error; - rm_init(&pf_rules_lock, "pf rulesets"); + rm_init_flags(&pf_rules_lock, "pf rulesets", RM_RECURSE); sx_init(&pf_ioctl_lock, "pf ioctl"); sx_init(&pf_end_lock, "pf end thread"); diff --git a/sys/netpfil/pf/pf_mtag.h b/sys/netpfil/pf/pf_mtag.h index ad28ab7a7c30..2135c9e69dbd 100644 --- a/sys/netpfil/pf/pf_mtag.h +++ b/sys/netpfil/pf/pf_mtag.h @@ -43,6 +43,7 @@ #define PF_FASTFWD_OURS_PRESENT 0x10 #define PF_REASSEMBLED 0x20 #define PF_DUPLICATED 0x40 +#define PF_TAG_SYNCOOKIE_RECREATED 0x80 struct pf_mtag { void *hdr; /* saved hdr pos in mbuf, for ECN */ diff --git a/sys/netpfil/pf/pf_syncookies.c b/sys/netpfil/pf/pf_syncookies.c new file mode 100644 index 000000000000..0071bab0d7d5 --- /dev/null +++ b/sys/netpfil/pf/pf_syncookies.c @@ -0,0 +1,350 @@ +/* $OpenBSD: pf_syncookies.c,v 1.7 2018/09/10 15:54:28 henning Exp $ */ + +/* Copyright (c) 2016,2017 Henning Brauer + * Copyright (c) 2016 Alexandr Nedvedicky + * + * syncookie parts based on FreeBSD sys/netinet/tcp_syncache.c + * + * Copyright (c) 2001 McAfee, Inc. + * Copyright (c) 2006,2013 Andre Oppermann, Internet Business Solutions AG + * All rights reserved. + * + * This software was developed for the FreeBSD Project by Jonathan Lemon + * and McAfee Research, the Security Research Division of McAfee, Inc. under + * DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the + * DARPA CHATS research program. [2001 McAfee, Inc.] + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL 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. + */ + +/* + * when we're under synflood, we use syncookies to prevent state table + * exhaustion. Trigger for the synflood mode is the number of half-open + * connections in the state table. + * We leave synflood mode when the number of half-open states - including + * in-flight syncookies - drops far enough again + */ + +/* + * syncookie enabled Initial Sequence Number: + * 24 bit MAC + * 3 bit WSCALE index + * 3 bit MSS index + * 1 bit SACK permitted + * 1 bit odd/even secret + * + * References: + * RFC4987 TCP SYN Flooding Attacks and Common Mitigations + * http://cr.yp.to/syncookies.html (overview) + * http://cr.yp.to/syncookies/archive (details) + */ + +//#include "pflog.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +#define DPFPRINTF(n, x) if (V_pf_status.debug >= (n)) printf x + +union pf_syncookie { + uint8_t cookie; + struct { + uint8_t oddeven:1, + sack_ok:1, + wscale_idx:3, + mss_idx:3; + } flags; +}; + +#define PF_SYNCOOKIE_SECRET_SIZE SIPHASH_KEY_LENGTH +#define PF_SYNCOOKIE_SECRET_LIFETIME 15 /* seconds */ + +/* Protected by PF_RULES_xLOCK. */ +struct pf_syncookie_status { + struct callout keytimeout; + uint8_t oddeven; + uint8_t key[2][SIPHASH_KEY_LENGTH]; +}; +VNET_DEFINE_STATIC(struct pf_syncookie_status, pf_syncookie_status); +#define V_pf_syncookie_status VNET(pf_syncookie_status) + +void pf_syncookie_rotate(void *); +void pf_syncookie_newkey(void); +uint32_t pf_syncookie_mac(struct pf_pdesc *, union pf_syncookie, + uint32_t); +uint32_t pf_syncookie_generate(struct mbuf *m, int off, struct pf_pdesc *, + uint16_t); + +void +pf_syncookies_init(void) +{ + callout_init(&V_pf_syncookie_status.keytimeout, 1); + PF_RULES_WLOCK(); + pf_syncookies_setmode(PF_SYNCOOKIES_NEVER); + PF_RULES_WUNLOCK(); +} + +int +pf_syncookies_setmode(u_int8_t mode) +{ + if (mode > PF_SYNCOOKIES_MODE_MAX) + return (EINVAL); + + if (V_pf_status.syncookies_mode == mode) + return (0); + + V_pf_status.syncookies_mode = mode; + if (V_pf_status.syncookies_mode == PF_SYNCOOKIES_ALWAYS) { + pf_syncookie_newkey(); + V_pf_status.syncookies_active = true; + } + return (0); +} + +int +pf_synflood_check(struct pf_pdesc *pd) +{ + MPASS(pd->proto == IPPROTO_TCP); + PF_RULES_RASSERT(); + + if (pd->pf_mtag && (pd->pf_mtag->tag & PF_TAG_SYNCOOKIE_RECREATED)) + return (0); + + return (V_pf_status.syncookies_mode); +} + +void +pf_syncookie_send(struct mbuf *m, int off, struct pf_pdesc *pd) +{ + uint16_t mss; + uint32_t iss; + + mss = max(V_tcp_mssdflt, pf_get_mss(m, off, pd->hdr.tcp.th_off, pd->af)); + iss = pf_syncookie_generate(m, off, pd, mss); + pf_send_tcp(NULL, pd->af, pd->dst, pd->src, *pd->dport, *pd->sport, + iss, ntohl(pd->hdr.tcp.th_seq) + 1, TH_SYN|TH_ACK, 0, mss, + 0, 1, 0); +} + +uint8_t +pf_syncookie_validate(struct pf_pdesc *pd) +{ + uint32_t hash, ack, seq; + union pf_syncookie cookie; + + MPASS(pd->proto == IPPROTO_TCP); + PF_RULES_RASSERT(); + + seq = ntohl(pd->hdr.tcp.th_seq) - 1; + ack = ntohl(pd->hdr.tcp.th_ack) - 1; + cookie.cookie = (ack & 0xff) ^ (ack >> 24); + + hash = pf_syncookie_mac(pd, cookie, seq); + if ((ack & ~0xff) != (hash & ~0xff)) + return (0); + + counter_u64_add(V_pf_status.lcounters[LCNT_SYNCOOKIES_VALID], 1); + return (1); +} + +/* + * all following functions private + */ +void +pf_syncookie_rotate(void *arg) +{ + CURVNET_SET((struct vnet *)arg); + + /* do we want to disable syncookies? */ + if (V_pf_status.syncookies_active) { + V_pf_status.syncookies_active = false; + DPFPRINTF(PF_DEBUG_MISC, ("syncookies disabled")); + } + + /* nothing in flight any more? delete keys and return */ + if (!V_pf_status.syncookies_active) { + memset(V_pf_syncookie_status.key[0], 0, + PF_SYNCOOKIE_SECRET_SIZE); + memset(V_pf_syncookie_status.key[1], 0, + PF_SYNCOOKIE_SECRET_SIZE); + CURVNET_RESTORE(); + return; + } + + /* new key, including timeout */ + pf_syncookie_newkey(); + + CURVNET_RESTORE(); + printf("KP: %s() return\n", __func__); +} + +void +pf_syncookie_newkey(void) +{ + PF_RULES_WASSERT(); + + V_pf_syncookie_status.oddeven = (V_pf_syncookie_status.oddeven + 1) & 0x1; + arc4random_buf(V_pf_syncookie_status.key[V_pf_syncookie_status.oddeven], + PF_SYNCOOKIE_SECRET_SIZE); + callout_reset(&V_pf_syncookie_status.keytimeout, + PF_SYNCOOKIE_SECRET_LIFETIME, pf_syncookie_rotate, curvnet); +} + +/* + * Distribution and probability of certain MSS values. Those in between are + * rounded down to the next lower one. + * [An Analysis of TCP Maximum Segment Sizes, S. Alcock and R. Nelson, 2011] + * .2% .3% 5% 7% 7% 20% 15% 45% + */ +static int pf_syncookie_msstab[] = + { 216, 536, 1200, 1360, 1400, 1440, 1452, 1460 }; + +/* + * Distribution and probability of certain WSCALE values. + * The absence of the WSCALE option is encoded with index zero. + * [WSCALE values histograms, Allman, 2012] + * X 10 10 35 5 6 14 10% by host + * X 11 4 5 5 18 49 3% by connections + */ +static int pf_syncookie_wstab[] = { 0, 0, 1, 2, 4, 6, 7, 8 }; + +uint32_t +pf_syncookie_mac(struct pf_pdesc *pd, union pf_syncookie cookie, uint32_t seq) +{ + SIPHASH_CTX ctx; + uint32_t siphash[2]; + + PF_RULES_RASSERT(); + MPASS(pd->proto == IPPROTO_TCP); + + SipHash24_Init(&ctx); + SipHash_SetKey(&ctx, V_pf_syncookie_status.key[cookie.flags.oddeven]); + + switch (pd->af) { + case AF_INET: + SipHash_Update(&ctx, pd->src, sizeof(pd->src->v4)); + SipHash_Update(&ctx, pd->dst, sizeof(pd->dst->v4)); + break; + case AF_INET6: + SipHash_Update(&ctx, pd->src, sizeof(pd->src->v6)); + SipHash_Update(&ctx, pd->dst, sizeof(pd->dst->v6)); + break; + default: + panic("unknown address family"); + } + + SipHash_Update(&ctx, pd->sport, sizeof(*pd->sport)); + SipHash_Update(&ctx, pd->dport, sizeof(*pd->dport)); + SipHash_Update(&ctx, &seq, sizeof(seq)); + SipHash_Update(&ctx, &cookie, sizeof(cookie)); + SipHash_Final((uint8_t *)&siphash, &ctx); + + return (siphash[0] ^ siphash[1]); +} + +uint32_t +pf_syncookie_generate(struct mbuf *m, int off, struct pf_pdesc *pd, + uint16_t mss) +{ + uint8_t i, wscale; + uint32_t iss, hash; + union pf_syncookie cookie; + + PF_RULES_RASSERT(); + + cookie.cookie = 0; + + /* map MSS */ + for (i = nitems(pf_syncookie_msstab) - 1; + pf_syncookie_msstab[i] > mss && i > 0; i--) + /* nada */; + cookie.flags.mss_idx = i; + + /* map WSCALE */ + wscale = pf_get_wscale(m, off, pd->hdr.tcp.th_off, pd->af); + for (i = nitems(pf_syncookie_wstab) - 1; + pf_syncookie_wstab[i] > wscale && i > 0; i--) + /* nada */; + cookie.flags.wscale_idx = i; + cookie.flags.sack_ok = 0; /* XXX */ + + cookie.flags.oddeven = V_pf_syncookie_status.oddeven; + hash = pf_syncookie_mac(pd, cookie, ntohl(pd->hdr.tcp.th_seq)); + + /* + * Put the flags into the hash and XOR them to get better ISS number + * variance. This doesn't enhance the cryptographic strength and is + * done to prevent the 8 cookie bits from showing up directly on the + * wire. + */ + iss = hash & ~0xff; + iss |= cookie.cookie ^ (hash >> 24); + + return (iss); +} + +struct mbuf * +pf_syncookie_recreate_syn(uint8_t ttl, int off, struct pf_pdesc *pd) +{ + uint8_t wscale; + uint16_t mss; + uint32_t ack, seq; + union pf_syncookie cookie; + + seq = ntohl(pd->hdr.tcp.th_seq) - 1; + ack = ntohl(pd->hdr.tcp.th_ack) - 1; + cookie.cookie = (ack & 0xff) ^ (ack >> 24); + + if (cookie.flags.mss_idx >= nitems(pf_syncookie_msstab) || + cookie.flags.wscale_idx >= nitems(pf_syncookie_wstab)) + return (NULL); + + mss = pf_syncookie_msstab[cookie.flags.mss_idx]; + wscale = pf_syncookie_wstab[cookie.flags.wscale_idx]; + + return (pf_build_tcp(NULL, pd->af, pd->src, pd->dst, *pd->sport, + *pd->dport, seq, 0, TH_SYN, wscale, mss, ttl, 0, + PF_TAG_SYNCOOKIE_RECREATED)); +} From owner-dev-commits-src-all@freebsd.org Tue Jul 27 11:46: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 EED8265DF12; Tue, 27 Jul 2021 11:46: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 4GYw4P56Y2z3sHR; Tue, 27 Jul 2021 11:46: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 7439E1ADA; Tue, 27 Jul 2021 11:46: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 16RBkjST067717; Tue, 27 Jul 2021 11:46:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RBkj3X067716; Tue, 27 Jul 2021 11:46:45 GMT (envelope-from git) Date: Tue, 27 Jul 2021 11:46:45 GMT Message-Id: <202107271146.16RBkj3X067716@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: ba7edb52211a - stable/12 - pf: syncookie support 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: ba7edb52211a5fcf19ca41dbd5feea1147e03df3 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, 27 Jul 2021 11:46:46 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=ba7edb52211a5fcf19ca41dbd5feea1147e03df3 commit ba7edb52211a5fcf19ca41dbd5feea1147e03df3 Author: Kristof Provost AuthorDate: 2021-05-20 09:54:41 +0000 Commit: Kristof Provost CommitDate: 2021-07-27 11:24:23 +0000 pf: syncookie support Import OpenBSD's syncookie support for pf. This feature help pf resist TCP SYN floods by only creating states once the remote host completes the TCP handshake rather than when the initial SYN packet is received. This is accomplished by using the initial sequence numbers to encode a cookie (hence the name) in the SYN+ACK response and verifying this on receipt of the client ACK. Reviewed by: kbowling Obtained from: OpenBSD MFC after: 1 week Sponsored by: Modirum MDPay Differential Revision: https://reviews.freebsd.org/D31138 (cherry picked from commit 8e1864ed07121b479b95d7e3a5931a9e0ffd4713) --- sys/modules/pf/Makefile | 2 +- sys/net/pfvar.h | 34 ++++ sys/netinet/tcp.h | 2 + sys/netpfil/pf/pf.c | 129 +++++++++++---- sys/netpfil/pf/pf.h | 3 +- sys/netpfil/pf/pf_ioctl.c | 3 +- sys/netpfil/pf/pf_mtag.h | 1 + sys/netpfil/pf/pf_syncookies.c | 350 +++++++++++++++++++++++++++++++++++++++++ 8 files changed, 492 insertions(+), 32 deletions(-) diff --git a/sys/modules/pf/Makefile b/sys/modules/pf/Makefile index 7293b30cda9d..d361ea0802fb 100644 --- a/sys/modules/pf/Makefile +++ b/sys/modules/pf/Makefile @@ -4,7 +4,7 @@ KMOD= pf SRCS= pf.c pf_if.c pf_lb.c pf_osfp.c pf_ioctl.c pf_norm.c pf_table.c \ - pf_ruleset.c pf_nv.c in4_cksum.c \ + pf_ruleset.c pf_nv.c pf_syncookies.c in4_cksum.c \ bus_if.h device_if.h \ opt_pf.h opt_inet.h opt_inet6.h opt_bpf.h opt_sctp.h opt_global.h diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index dceebe1caf77..3a74709fecf5 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -1132,6 +1132,12 @@ struct pf_pdesc { counter_u64_add(V_pf_status.counters[x], 1); \ } while (0) +enum pf_syncookies_mode { + PF_SYNCOOKIES_NEVER = 0, + PF_SYNCOOKIES_ALWAYS = 1, + PF_SYNCOOKIES_MODE_MAX = PF_SYNCOOKIES_ALWAYS +}; + struct pf_kstatus { counter_u64_t counters[PFRES_MAX]; /* reason for passing/dropping */ counter_u64_t lcounters[LCNT_MAX]; /* limit counters */ @@ -1146,6 +1152,8 @@ struct pf_kstatus { char ifname[IFNAMSIZ]; uint8_t pf_chksum[PF_MD5_DIGEST_LENGTH]; bool keep_counters; + enum pf_syncookies_mode syncookies_mode; + bool syncookies_active; }; struct pf_divert { @@ -1487,6 +1495,8 @@ struct pfioc_iface { #define DIOCKILLSRCNODES _IOWR('D', 91, struct pfioc_src_node_kill) #define DIOCKEEPCOUNTERS _IOWR('D', 92, struct pfioc_nv) #define DIOCGETSTATESV2 _IOWR('D', 93, struct pfioc_states_v2) +#define DIOCGETSYNCOOKIES _IOWR('D', 94, struct pfioc_nv) +#define DIOCSETSYNCOOKIES _IOWR('D', 95, struct pfioc_nv) struct pf_ifspeed_v0 { char ifname[IFNAMSIZ]; @@ -1817,6 +1827,30 @@ int pf_addr_cmp(struct pf_addr *, struct pf_addr *, sa_family_t); void pf_qid2qname(u_int32_t, char *); +u_int16_t pf_get_mss(struct mbuf *, int, u_int16_t, sa_family_t); +u_int8_t pf_get_wscale(struct mbuf *, int, u_int16_t, sa_family_t); +struct mbuf *pf_build_tcp(const struct pf_krule *, sa_family_t, + const struct pf_addr *, const struct pf_addr *, + u_int16_t, u_int16_t, u_int32_t, u_int32_t, + u_int8_t, u_int16_t, u_int16_t, u_int8_t, int, + u_int16_t); +void pf_send_tcp(const struct pf_krule *, sa_family_t, + const struct pf_addr *, const struct pf_addr *, + u_int16_t, u_int16_t, u_int32_t, u_int32_t, + u_int8_t, u_int16_t, u_int16_t, u_int8_t, int, + u_int16_t); + +void pf_syncookies_init(void); +int pf_syncookies_setmode(u_int8_t); +int pf_get_syncookies(struct pfioc_nv *); +int pf_set_syncookies(struct pfioc_nv *); +int pf_synflood_check(struct pf_pdesc *); +void pf_syncookie_send(struct mbuf *m, int off, + struct pf_pdesc *); +u_int8_t pf_syncookie_validate(struct pf_pdesc *); +struct mbuf * pf_syncookie_recreate_syn(uint8_t, int, + struct pf_pdesc *); + VNET_DECLARE(struct pf_kstatus, pf_status); #define V_pf_status VNET(pf_status) diff --git a/sys/netinet/tcp.h b/sys/netinet/tcp.h index 3f5767d5a472..21922eb4df2e 100644 --- a/sys/netinet/tcp.h +++ b/sys/netinet/tcp.h @@ -105,6 +105,8 @@ struct tcphdr { #define TCPOPT_FAST_OPEN 34 #define TCPOLEN_FAST_OPEN_EMPTY 2 +#define MAX_TCPOPTLEN 40 /* Absolute maximum TCP options len */ + /* Miscellaneous constants */ #define MAX_SACK_BLKS 6 /* Max # SACK blocks stored at receiver side */ #define TCP_MAX_SACK 4 /* MAX # SACKs sent in any segment */ diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 8d0da5c6f209..4127d526f33c 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -244,11 +244,6 @@ static void pf_change_icmp(struct pf_addr *, u_int16_t *, struct pf_addr *, struct pf_addr *, u_int16_t, u_int16_t *, u_int16_t *, u_int16_t *, u_int16_t *, u_int8_t, sa_family_t); -static void pf_send_tcp(const struct pf_krule *, sa_family_t, - const struct pf_addr *, const struct pf_addr *, - u_int16_t, u_int16_t, u_int32_t, u_int32_t, - u_int8_t, u_int16_t, u_int16_t, u_int8_t, int, - u_int16_t); static void pf_send_icmp(struct mbuf *, u_int8_t, u_int8_t, sa_family_t, struct pf_krule *); static void pf_detach_state(struct pf_kstate *); @@ -290,10 +285,6 @@ static int pf_test_state_icmp(struct pf_kstate **, int, void *, struct pf_pdesc *, u_short *); static int pf_test_state_other(struct pf_kstate **, int, struct pfi_kkif *, struct mbuf *, struct pf_pdesc *); -static u_int8_t pf_get_wscale(struct mbuf *, int, u_int16_t, - sa_family_t); -static u_int16_t pf_get_mss(struct mbuf *, int, u_int16_t, - sa_family_t); static u_int16_t pf_calc_mss(struct pf_addr *, sa_family_t, int, u_int16_t); static int pf_check_proto_cksum(struct mbuf *, int, int, @@ -2461,14 +2452,13 @@ pf_modulate_sack(struct mbuf *m, int off, struct pf_pdesc *pd, return (copyback); } -static void -pf_send_tcp(const struct pf_krule *r, sa_family_t af, +struct mbuf * +pf_build_tcp(const struct pf_krule *r, sa_family_t af, const struct pf_addr *saddr, const struct pf_addr *daddr, u_int16_t sport, u_int16_t dport, u_int32_t seq, u_int32_t ack, u_int8_t flags, u_int16_t win, u_int16_t mss, u_int8_t ttl, int tag, u_int16_t rtag) { - struct pf_send_entry *pfse; struct mbuf *m; int len, tlen; #ifdef INET @@ -2504,22 +2494,16 @@ pf_send_tcp(const struct pf_krule *r, sa_family_t af, panic("%s: unsupported af %d", __func__, af); } - /* Allocate outgoing queue entry, mbuf and mbuf tag. */ - pfse = malloc(sizeof(*pfse), M_PFTEMP, M_NOWAIT); - if (pfse == NULL) - return; m = m_gethdr(M_NOWAIT, MT_DATA); - if (m == NULL) { - free(pfse, M_PFTEMP); - return; - } + if (m == NULL) + return (NULL); + #ifdef MAC mac_netinet_firewall_send(m); #endif if ((pf_mtag = pf_get_mtag(m)) == NULL) { - free(pfse, M_PFTEMP); m_freem(m); - return; + return (NULL); } if (tag) m->m_flags |= M_SKIP_FIREWALL; @@ -2600,8 +2584,6 @@ pf_send_tcp(const struct pf_krule *r, sa_family_t af, h->ip_len = htons(len); h->ip_ttl = ttl ? ttl : V_ip_defttl; h->ip_sum = 0; - - pfse->pfse_type = PFSE_IP; break; #endif /* INET */ #ifdef INET6 @@ -2612,11 +2594,48 @@ pf_send_tcp(const struct pf_krule *r, sa_family_t af, h6->ip6_vfc |= IPV6_VERSION; h6->ip6_hlim = IPV6_DEFHLIM; + break; +#endif /* INET6 */ + } + + return (m); +} + +void +pf_send_tcp(const struct pf_krule *r, sa_family_t af, + const struct pf_addr *saddr, const struct pf_addr *daddr, + u_int16_t sport, u_int16_t dport, u_int32_t seq, u_int32_t ack, + u_int8_t flags, u_int16_t win, u_int16_t mss, u_int8_t ttl, int tag, + u_int16_t rtag) +{ + struct pf_send_entry *pfse; + struct mbuf *m; + + m = pf_build_tcp(r, af, saddr, daddr, sport, dport, seq, ack, flags, + win, mss, ttl, tag, rtag); + if (m == NULL) + return; + + /* Allocate outgoing queue entry, mbuf and mbuf tag. */ + pfse = malloc(sizeof(*pfse), M_PFTEMP, M_NOWAIT); + if (pfse == NULL) { + m_freem(m); + return; + } + switch (af) { +#ifdef INET + case AF_INET: + pfse->pfse_type = PFSE_IP; + break; +#endif /* INET */ +#ifdef INET6 + case AF_INET6: pfse->pfse_type = PFSE_IP6; break; #endif /* INET6 */ } + pfse->pfse_m = m; pf_send(pfse); } @@ -3192,7 +3211,7 @@ pf_socket_lookup(int direction, struct pf_pdesc *pd, struct mbuf *m) return (1); } -static u_int8_t +u_int8_t pf_get_wscale(struct mbuf *m, int off, u_int16_t th_off, sa_family_t af) { int hlen; @@ -3232,7 +3251,7 @@ pf_get_wscale(struct mbuf *m, int off, u_int16_t th_off, sa_family_t af) return (wscale); } -static u_int16_t +u_int16_t pf_get_mss(struct mbuf *m, int off, u_int16_t th_off, sa_family_t af) { int hlen; @@ -6132,6 +6151,18 @@ pf_test(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, struct inpcb * goto done; } pd.p_len = pd.tot_len - off - (pd.hdr.tcp.th_off << 2); + + pd.sport = &pd.hdr.tcp.th_sport; + pd.dport = &pd.hdr.tcp.th_dport; + + /* Respond to SYN with a syncookie. */ + if ((pd.hdr.tcp.th_flags & (TH_SYN|TH_ACK|TH_RST)) == TH_SYN && + pd.dir == PF_IN && pf_synflood_check(&pd)) { + pf_syncookie_send(m, off, &pd); + action = PF_DROP; + break; + } + if ((pd.hdr.tcp.th_flags & TH_ACK) && pd.p_len == 0) pqid = 1; action = pf_normalize_tcp(dir, kif, m, 0, off, h, &pd); @@ -6145,9 +6176,49 @@ pf_test(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, struct inpcb * r = s->rule.ptr; a = s->anchor.ptr; log = s->log; - } else if (s == NULL) - action = pf_test_rule(&r, &s, dir, kif, m, off, &pd, - &a, &ruleset, inp); + } else if (s == NULL) { + /* Validate remote SYN|ACK, re-create original SYN if + * valid. */ + if ((pd.hdr.tcp.th_flags & (TH_SYN|TH_ACK|TH_RST)) == + TH_ACK && pf_syncookie_validate(&pd) && + pd.dir == PF_IN) { + struct mbuf *msyn; + + msyn = pf_syncookie_recreate_syn(h->ip_ttl, + off,&pd); + if (msyn == NULL) { + action = PF_DROP; + break; + } + + action = pf_test(dir, pflags, ifp, &msyn, inp); + m_freem(msyn); + + if (action == PF_PASS) { + action = pf_test_state_tcp(&s, dir, + kif, m, off, h, &pd, &reason); + if (action != PF_PASS || s == NULL) { + action = PF_DROP; + break; + } + + s->src.seqhi = ntohl(pd.hdr.tcp.th_ack) + - 1; + s->src.seqlo = ntohl(pd.hdr.tcp.th_seq) + - 1; + s->src.state = PF_TCPS_PROXY_DST; + + action = pf_synproxy(&pd, &s, &reason); + if (action != PF_PASS) + break; + } + break; + } + else { + action = pf_test_rule(&r, &s, dir, kif, m, off, + &pd, &a, &ruleset, inp); + } + } break; } diff --git a/sys/netpfil/pf/pf.h b/sys/netpfil/pf/pf.h index 011d69a746dd..869e8e32eb5c 100644 --- a/sys/netpfil/pf/pf.h +++ b/sys/netpfil/pf/pf.h @@ -159,7 +159,8 @@ enum { PF_ADDR_ADDRMASK, PF_ADDR_NOROUTE, PF_ADDR_DYNIFTL, #define LCNT_SRCCONNRATE 4 /* max-src-conn-rate */ #define LCNT_OVERLOAD_TABLE 5 /* entry added to overload table */ #define LCNT_OVERLOAD_FLUSH 6 /* state entries flushed */ -#define LCNT_MAX 7 /* total+1 */ +#define LCNT_SYNCOOKIES_VALID 7 /* syncookies validated */ /* XXX TODO: Ensure no API breakage! */ +#define LCNT_MAX 8 /* total+1 */ #define LCNT_NAMES { \ "max states per rule", \ diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 74f347ac1fa6..70cc4ff83d7b 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -285,6 +285,7 @@ pfattach_vnet(void) pfr_initialize(); pfi_initialize_vnet(); pf_normalize_init(); + pf_syncookies_init(); V_pf_limits[PF_LIMIT_STATES].limit = PFSTATE_HIWAT; V_pf_limits[PF_LIMIT_SRC_NODES].limit = PFSNODE_HIWAT; @@ -5575,7 +5576,7 @@ pf_load(void) { int error; - rm_init(&pf_rules_lock, "pf rulesets"); + rm_init_flags(&pf_rules_lock, "pf rulesets", RM_RECURSE); sx_init(&pf_ioctl_lock, "pf ioctl"); sx_init(&pf_end_lock, "pf end thread"); diff --git a/sys/netpfil/pf/pf_mtag.h b/sys/netpfil/pf/pf_mtag.h index 67c79350e8eb..b1402e1ac77f 100644 --- a/sys/netpfil/pf/pf_mtag.h +++ b/sys/netpfil/pf/pf_mtag.h @@ -42,6 +42,7 @@ #define PF_PACKET_LOOPED 0x08 #define PF_FASTFWD_OURS_PRESENT 0x10 #define PF_REASSEMBLED 0x20 +#define PF_TAG_SYNCOOKIE_RECREATED 0x80 struct pf_mtag { void *hdr; /* saved hdr pos in mbuf, for ECN */ diff --git a/sys/netpfil/pf/pf_syncookies.c b/sys/netpfil/pf/pf_syncookies.c new file mode 100644 index 000000000000..ee936b6662fa --- /dev/null +++ b/sys/netpfil/pf/pf_syncookies.c @@ -0,0 +1,350 @@ +/* $OpenBSD: pf_syncookies.c,v 1.7 2018/09/10 15:54:28 henning Exp $ */ + +/* Copyright (c) 2016,2017 Henning Brauer + * Copyright (c) 2016 Alexandr Nedvedicky + * + * syncookie parts based on FreeBSD sys/netinet/tcp_syncache.c + * + * Copyright (c) 2001 McAfee, Inc. + * Copyright (c) 2006,2013 Andre Oppermann, Internet Business Solutions AG + * All rights reserved. + * + * This software was developed for the FreeBSD Project by Jonathan Lemon + * and McAfee Research, the Security Research Division of McAfee, Inc. under + * DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the + * DARPA CHATS research program. [2001 McAfee, Inc.] + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL 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. + */ + +/* + * when we're under synflood, we use syncookies to prevent state table + * exhaustion. Trigger for the synflood mode is the number of half-open + * connections in the state table. + * We leave synflood mode when the number of half-open states - including + * in-flight syncookies - drops far enough again + */ + +/* + * syncookie enabled Initial Sequence Number: + * 24 bit MAC + * 3 bit WSCALE index + * 3 bit MSS index + * 1 bit SACK permitted + * 1 bit odd/even secret + * + * References: + * RFC4987 TCP SYN Flooding Attacks and Common Mitigations + * http://cr.yp.to/syncookies.html (overview) + * http://cr.yp.to/syncookies/archive (details) + */ + +//#include "pflog.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +#define DPFPRINTF(n, x) if (V_pf_status.debug >= (n)) printf x + +union pf_syncookie { + uint8_t cookie; + struct { + uint8_t oddeven:1, + sack_ok:1, + wscale_idx:3, + mss_idx:3; + } flags; +}; + +#define PF_SYNCOOKIE_SECRET_SIZE SIPHASH_KEY_LENGTH +#define PF_SYNCOOKIE_SECRET_LIFETIME 15 /* seconds */ + +/* Protected by PF_RULES_xLOCK. */ +struct pf_syncookie_status { + struct callout keytimeout; + uint8_t oddeven; + uint8_t key[2][SIPHASH_KEY_LENGTH]; +}; +VNET_DEFINE_STATIC(struct pf_syncookie_status, pf_syncookie_status); +#define V_pf_syncookie_status VNET(pf_syncookie_status) + +void pf_syncookie_rotate(void *); +void pf_syncookie_newkey(void); +uint32_t pf_syncookie_mac(struct pf_pdesc *, union pf_syncookie, + uint32_t); +uint32_t pf_syncookie_generate(struct mbuf *m, int off, struct pf_pdesc *, + uint16_t); + +void +pf_syncookies_init(void) +{ + callout_init(&V_pf_syncookie_status.keytimeout, 1); + PF_RULES_WLOCK(); + pf_syncookies_setmode(PF_SYNCOOKIES_NEVER); + PF_RULES_WUNLOCK(); +} + +int +pf_syncookies_setmode(u_int8_t mode) +{ + if (mode > PF_SYNCOOKIES_MODE_MAX) + return (EINVAL); + + if (V_pf_status.syncookies_mode == mode) + return (0); + + V_pf_status.syncookies_mode = mode; + if (V_pf_status.syncookies_mode == PF_SYNCOOKIES_ALWAYS) { + pf_syncookie_newkey(); + V_pf_status.syncookies_active = true; + } + return (0); +} + +int +pf_synflood_check(struct pf_pdesc *pd) +{ + MPASS(pd->proto == IPPROTO_TCP); + PF_RULES_RASSERT(); + + if (pd->pf_mtag && (pd->pf_mtag->tag & PF_TAG_SYNCOOKIE_RECREATED)) + return (0); + + return (V_pf_status.syncookies_mode); +} + +void +pf_syncookie_send(struct mbuf *m, int off, struct pf_pdesc *pd) +{ + uint16_t mss; + uint32_t iss; + + mss = max(V_tcp_mssdflt, pf_get_mss(m, off, pd->hdr.tcp.th_off, pd->af)); + iss = pf_syncookie_generate(m, off, pd, mss); + pf_send_tcp(NULL, pd->af, pd->dst, pd->src, *pd->dport, *pd->sport, + iss, ntohl(pd->hdr.tcp.th_seq) + 1, TH_SYN|TH_ACK, 0, mss, + 0, 1, 0); +} + +uint8_t +pf_syncookie_validate(struct pf_pdesc *pd) +{ + uint32_t hash, ack, seq; + union pf_syncookie cookie; + + MPASS(pd->proto == IPPROTO_TCP); + PF_RULES_RASSERT(); + + seq = ntohl(pd->hdr.tcp.th_seq) - 1; + ack = ntohl(pd->hdr.tcp.th_ack) - 1; + cookie.cookie = (ack & 0xff) ^ (ack >> 24); + + hash = pf_syncookie_mac(pd, cookie, seq); + if ((ack & ~0xff) != (hash & ~0xff)) + return (0); + + counter_u64_add(V_pf_status.lcounters[LCNT_SYNCOOKIES_VALID], 1); + return (1); +} + +/* + * all following functions private + */ +void +pf_syncookie_rotate(void *arg) +{ + CURVNET_SET((struct vnet *)arg); + + /* do we want to disable syncookies? */ + if (V_pf_status.syncookies_active) { + V_pf_status.syncookies_active = false; + DPFPRINTF(PF_DEBUG_MISC, ("syncookies disabled")); + } + + /* nothing in flight any more? delete keys and return */ + if (!V_pf_status.syncookies_active) { + memset(V_pf_syncookie_status.key[0], 0, + PF_SYNCOOKIE_SECRET_SIZE); + memset(V_pf_syncookie_status.key[1], 0, + PF_SYNCOOKIE_SECRET_SIZE); + CURVNET_RESTORE(); + return; + } + + /* new key, including timeout */ + pf_syncookie_newkey(); + + CURVNET_RESTORE(); + printf("KP: %s() return\n", __func__); +} + +void +pf_syncookie_newkey(void) +{ + PF_RULES_WASSERT(); + + V_pf_syncookie_status.oddeven = (V_pf_syncookie_status.oddeven + 1) & 0x1; + arc4random_buf(V_pf_syncookie_status.key[V_pf_syncookie_status.oddeven], + PF_SYNCOOKIE_SECRET_SIZE); + callout_reset(&V_pf_syncookie_status.keytimeout, + PF_SYNCOOKIE_SECRET_LIFETIME, pf_syncookie_rotate, curvnet); +} + +/* + * Distribution and probability of certain MSS values. Those in between are + * rounded down to the next lower one. + * [An Analysis of TCP Maximum Segment Sizes, S. Alcock and R. Nelson, 2011] + * .2% .3% 5% 7% 7% 20% 15% 45% + */ +static int pf_syncookie_msstab[] = + { 216, 536, 1200, 1360, 1400, 1440, 1452, 1460 }; + +/* + * Distribution and probability of certain WSCALE values. + * The absence of the WSCALE option is encoded with index zero. + * [WSCALE values histograms, Allman, 2012] + * X 10 10 35 5 6 14 10% by host + * X 11 4 5 5 18 49 3% by connections + */ +static int pf_syncookie_wstab[] = { 0, 0, 1, 2, 4, 6, 7, 8 }; + +uint32_t +pf_syncookie_mac(struct pf_pdesc *pd, union pf_syncookie cookie, uint32_t seq) +{ + SIPHASH_CTX ctx; + uint32_t siphash[2]; + + PF_RULES_RASSERT(); + MPASS(pd->proto == IPPROTO_TCP); + + SipHash24_Init(&ctx); + SipHash_SetKey(&ctx, V_pf_syncookie_status.key[cookie.flags.oddeven]); + + switch (pd->af) { + case AF_INET: + SipHash_Update(&ctx, pd->src, sizeof(pd->src->v4)); + SipHash_Update(&ctx, pd->dst, sizeof(pd->dst->v4)); + break; + case AF_INET6: + SipHash_Update(&ctx, pd->src, sizeof(pd->src->v6)); + SipHash_Update(&ctx, pd->dst, sizeof(pd->dst->v6)); + break; + default: + panic("unknown address family"); + } + + SipHash_Update(&ctx, pd->sport, sizeof(*pd->sport)); + SipHash_Update(&ctx, pd->dport, sizeof(*pd->dport)); + SipHash_Update(&ctx, &seq, sizeof(seq)); + SipHash_Update(&ctx, &cookie, sizeof(cookie)); + SipHash_Final((uint8_t *)&siphash, &ctx); + + return (siphash[0] ^ siphash[1]); +} + +uint32_t +pf_syncookie_generate(struct mbuf *m, int off, struct pf_pdesc *pd, + uint16_t mss) +{ + uint8_t i, wscale; + uint32_t iss, hash; + union pf_syncookie cookie; + + PF_RULES_RASSERT(); + + cookie.cookie = 0; + + /* map MSS */ + for (i = nitems(pf_syncookie_msstab) - 1; + pf_syncookie_msstab[i] > mss && i > 0; i--) + /* nada */; + cookie.flags.mss_idx = i; + + /* map WSCALE */ + wscale = pf_get_wscale(m, off, pd->hdr.tcp.th_off, pd->af); + for (i = nitems(pf_syncookie_wstab) - 1; + pf_syncookie_wstab[i] > wscale && i > 0; i--) + /* nada */; + cookie.flags.wscale_idx = i; + cookie.flags.sack_ok = 0; /* XXX */ + + cookie.flags.oddeven = V_pf_syncookie_status.oddeven; + hash = pf_syncookie_mac(pd, cookie, ntohl(pd->hdr.tcp.th_seq)); + + /* + * Put the flags into the hash and XOR them to get better ISS number + * variance. This doesn't enhance the cryptographic strength and is + * done to prevent the 8 cookie bits from showing up directly on the + * wire. + */ + iss = hash & ~0xff; + iss |= cookie.cookie ^ (hash >> 24); + + return (iss); +} + +struct mbuf * +pf_syncookie_recreate_syn(uint8_t ttl, int off, struct pf_pdesc *pd) +{ + uint8_t wscale; + uint16_t mss; + uint32_t ack, seq; + union pf_syncookie cookie; + + seq = ntohl(pd->hdr.tcp.th_seq) - 1; + ack = ntohl(pd->hdr.tcp.th_ack) - 1; + cookie.cookie = (ack & 0xff) ^ (ack >> 24); + + if (cookie.flags.mss_idx >= nitems(pf_syncookie_msstab) || + cookie.flags.wscale_idx >= nitems(pf_syncookie_wstab)) + return (NULL); + + mss = pf_syncookie_msstab[cookie.flags.mss_idx]; + wscale = pf_syncookie_wstab[cookie.flags.wscale_idx]; + + return (pf_build_tcp(NULL, pd->af, pd->src, pd->dst, *pd->sport, + *pd->dport, seq, 0, TH_SYN, wscale, mss, ttl, 0, + PF_TAG_SYNCOOKIE_RECREATED)); +} From owner-dev-commits-src-all@freebsd.org Tue Jul 27 11:46: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 8C8EF65DF13; Tue, 27 Jul 2021 11:46: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 4GYw4Q2Q8yz3s1K; Tue, 27 Jul 2021 11:46: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 2B21A1E6B; Tue, 27 Jul 2021 11:46: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 16RBkkXC067741; Tue, 27 Jul 2021 11:46:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RBkkrS067740; Tue, 27 Jul 2021 11:46:46 GMT (envelope-from git) Date: Tue, 27 Jul 2021 11:46:46 GMT Message-Id: <202107271146.16RBkkrS067740@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: 2987a3643be7 - stable/13 - pf: syncookie ioctl interface 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: 2987a3643be7d143c1ff22be3a7e4f485a7acc1f 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, 27 Jul 2021 11:46:46 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=2987a3643be7d143c1ff22be3a7e4f485a7acc1f commit 2987a3643be7d143c1ff22be3a7e4f485a7acc1f Author: Kristof Provost AuthorDate: 2021-05-26 08:18:19 +0000 Commit: Kristof Provost CommitDate: 2021-07-27 07:42:52 +0000 pf: syncookie ioctl interface Kernel side implementation to allow switching between on and off modes, and allow this configuration to be retrieved. MFC after: 1 week Sponsored by: Modirum MDPay Differential Revision: https://reviews.freebsd.org/D31139 (cherry picked from commit 231e83d3422ff58fe94de8375a9532a1726056ed) --- sys/net/pfvar.h | 2 +- sys/netpfil/pf/pf_ioctl.c | 18 +++++++++ sys/netpfil/pf/pf_syncookies.c | 84 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 103 insertions(+), 1 deletion(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 50634f39a549..b4a788436147 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -1572,6 +1572,7 @@ struct pf_idhash { struct mtx lock; }; +extern u_long pf_ioctl_maxcount; extern u_long pf_hashmask; extern u_long pf_srchashmask; #define PF_HASHSIZ (131072) @@ -1840,7 +1841,6 @@ void pf_send_tcp(const struct pf_krule *, sa_family_t, u_int16_t); void pf_syncookies_init(void); -int pf_syncookies_setmode(u_int8_t); int pf_get_syncookies(struct pfioc_nv *); int pf_set_syncookies(struct pfioc_nv *); int pf_synflood_check(struct pf_pdesc *); diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index d5b33a48a57c..96eb31b00ffb 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -276,6 +276,14 @@ pflog_packet_t *pflog_packet_ptr = NULL; extern u_long pf_ioctl_maxcount; +#define ERROUT_FUNCTION(target, x) \ + do { \ + error = (x); \ + SDT_PROBE3(pf, ioctl, function, error, __func__, error, \ + __LINE__); \ + goto target; \ + } while (0) + static void pfattach_vnet(void) { @@ -2137,6 +2145,7 @@ pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td case DIOCOSFPGET: case DIOCGETSRCNODES: case DIOCCLRSRCNODES: + case DIOCGETSYNCOOKIES: case DIOCIGETIFACES: case DIOCGIFSPEEDV0: case DIOCGIFSPEEDV1: @@ -2184,6 +2193,7 @@ pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td case DIOCRTSTADDRS: case DIOCOSFPGET: case DIOCGETSRCNODES: + case DIOCGETSYNCOOKIES: case DIOCIGETIFACES: case DIOCGIFSPEEDV1: case DIOCGIFSPEEDV0: @@ -4539,6 +4549,14 @@ DIOCCHANGEADDR_error: error = pf_keepcounters((struct pfioc_nv *)addr); break; + case DIOCGETSYNCOOKIES: + error = pf_get_syncookies((struct pfioc_nv *)addr); + break; + + case DIOCSETSYNCOOKIES: + error = pf_set_syncookies((struct pfioc_nv *)addr); + break; + case DIOCSETHOSTID: { u_int32_t *hostid = (u_int32_t *)addr; diff --git a/sys/netpfil/pf/pf_syncookies.c b/sys/netpfil/pf/pf_syncookies.c index 0071bab0d7d5..d51f89fb47d4 100644 --- a/sys/netpfil/pf/pf_syncookies.c +++ b/sys/netpfil/pf/pf_syncookies.c @@ -110,6 +110,7 @@ struct pf_syncookie_status { VNET_DEFINE_STATIC(struct pf_syncookie_status, pf_syncookie_status); #define V_pf_syncookie_status VNET(pf_syncookie_status) +static int pf_syncookies_setmode(u_int8_t); void pf_syncookie_rotate(void *); void pf_syncookie_newkey(void); uint32_t pf_syncookie_mac(struct pf_pdesc *, union pf_syncookie, @@ -127,6 +128,89 @@ pf_syncookies_init(void) } int +pf_get_syncookies(struct pfioc_nv *nv) +{ + nvlist_t *nvl = NULL; + void *nvlpacked = NULL; + + nvl = nvlist_create(0); + if (nvl == NULL) + return (ENOMEM); + + nvlist_add_bool(nvl, "enabled", + V_pf_status.syncookies_mode != PF_SYNCOOKIES_NEVER); + nvlist_add_bool(nvl, "adaptive", false); + + nvlpacked = nvlist_pack(nvl, &nv->len); + if (nvlpacked == NULL) { + nvlist_destroy(nvl); + return (ENOMEM); + } + if (nv->size == 0) { + nvlist_destroy(nvl); + free(nvlpacked, M_TEMP); + return (0); + } else if (nv->size < nv->len) { + nvlist_destroy(nvl); + free(nvlpacked, M_TEMP); + return (ENOSPC); + } + + return (copyout(nvlpacked, nv->data, nv->len)); +} + +int +pf_set_syncookies(struct pfioc_nv *nv) +{ + nvlist_t *nvl = NULL; + void *nvlpacked = NULL; + int error; + bool enabled, adaptive; + + if (nv->len > pf_ioctl_maxcount) + return (ENOMEM); + + nvlpacked = malloc(nv->len, M_TEMP, M_WAITOK); + if (nvlpacked == NULL) + return (ENOMEM); + + error = copyin(nv->data, nvlpacked, nv->len); + if (error) { + free(nvlpacked, M_TEMP); + return (error); + } + + nvl = nvlist_unpack(nvlpacked, nv->len, 0); + if (nvl == NULL) { + free(nvlpacked, M_TEMP); + return (EBADMSG); + } + + if (! nvlist_exists_bool(nvl, "enabled") + || ! nvlist_exists_bool(nvl, "adaptive")) { + nvlist_destroy(nvl); + free(nvlpacked, M_TEMP); + return (EBADMSG); + } + + enabled = nvlist_get_bool(nvl, "enabled"); + adaptive = nvlist_get_bool(nvl, "adaptive"); + + if (adaptive) { + nvlist_destroy(nvl); + free(nvlpacked, M_TEMP); + return (ENOTSUP); + } + + PF_RULES_WLOCK(); + error = pf_syncookies_setmode(enabled ? + PF_SYNCOOKIES_ALWAYS : PF_SYNCOOKIES_NEVER); + PF_RULES_WUNLOCK(); + + return (error); +} + +static int pf_syncookies_setmode(u_int8_t mode) { if (mode > PF_SYNCOOKIES_MODE_MAX) From owner-dev-commits-src-all@freebsd.org Tue Jul 27 11:46: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 C1CC965DED9; Tue, 27 Jul 2021 11:46: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 4GYw4R4bYhz3s30; Tue, 27 Jul 2021 11:46: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 492D21BC1; Tue, 27 Jul 2021 11:46: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 16RBklMh067789; Tue, 27 Jul 2021 11:46:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RBklR9067788; Tue, 27 Jul 2021 11:46:47 GMT (envelope-from git) Date: Tue, 27 Jul 2021 11:46:47 GMT Message-Id: <202107271146.16RBklR9067788@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: 720b82f8216d - stable/13 - pfctl: syncookie configuration 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: 720b82f8216d7c1f6a06993923e63df86f294069 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, 27 Jul 2021 11:46:47 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=720b82f8216d7c1f6a06993923e63df86f294069 commit 720b82f8216d7c1f6a06993923e63df86f294069 Author: Kristof Provost AuthorDate: 2021-05-26 11:41:34 +0000 Commit: Kristof Provost CommitDate: 2021-07-27 07:43:52 +0000 pfctl: syncookie configuration pfctl and libpfctl code required to enable/disable the syncookie feature. MFC after: 1 week Sponsored by: Modirum MDPay Differential Revision: https://reviews.freebsd.org/D31140 (cherry picked from commit c69121c473d75abab55f9ade8e8138ac09c0942c) --- lib/libpfctl/libpfctl.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++ lib/libpfctl/libpfctl.h | 11 +++++++++ sbin/pfctl/parse.y | 20 +++++++++++++++-- sbin/pfctl/pfctl.c | 30 +++++++++++++++++++++++-- sbin/pfctl/pfctl_parser.c | 7 +++++- sbin/pfctl/pfctl_parser.h | 3 ++- 6 files changed, 122 insertions(+), 6 deletions(-) diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c index 6421a2c752a8..ced130820d7d 100644 --- a/lib/libpfctl/libpfctl.c +++ b/lib/libpfctl/libpfctl.c @@ -816,3 +816,60 @@ pfctl_kill_states(int dev, const struct pfctl_kill *kill, unsigned int *killed) { return (_pfctl_clear_states(dev, kill, killed, DIOCKILLSTATESNV)); } + +int +pfctl_set_syncookies(int dev, const struct pfctl_syncookies *s) +{ + struct pfioc_nv nv; + nvlist_t *nvl; + int ret; + + nvl = nvlist_create(0); + + nvlist_add_bool(nvl, "enabled", s->mode != PFCTL_SYNCOOKIES_NEVER); + nvlist_add_bool(nvl, "adaptive", false); /* XXX TODO */ + + nv.data = nvlist_pack(nvl, &nv.len); + nv.size = nv.len; + nvlist_destroy(nvl); + nvl = NULL; + + ret = ioctl(dev, DIOCSETSYNCOOKIES, &nv); + + free(nv.data); + return (ret); +} + +int +pfctl_get_syncookies(int dev, struct pfctl_syncookies *s) +{ + struct pfioc_nv nv; + nvlist_t *nvl; + bool enabled, adaptive; + + bzero(s, sizeof(*s)); + + nv.data = malloc(128); + nv.len = nv.size = 128; + + if (ioctl(dev, DIOCGETSYNCOOKIES, &nv)) { + free(nv.data); + return (errno); + } + + nvl = nvlist_unpack(nv.data, nv.len, 0); + free(nv.data); + if (nvl == NULL) { + free(nv.data); + return (EIO); + } + + enabled = nvlist_get_bool(nvl, "enabled"); + adaptive = nvlist_get_bool(nvl, "adaptive"); + + s->mode = enabled ? PFCTL_SYNCOOKIES_ALWAYS : PFCTL_SYNCOOKIES_NEVER; + + nvlist_destroy(nvl); + + return (0); +} diff --git a/lib/libpfctl/libpfctl.h b/lib/libpfctl/libpfctl.h index 62866e17f904..d57241dd59fd 100644 --- a/lib/libpfctl/libpfctl.h +++ b/lib/libpfctl/libpfctl.h @@ -244,6 +244,15 @@ struct pfctl_states { size_t count; }; +enum pfctl_syncookies_mode { + PFCTL_SYNCOOKIES_NEVER, + PFCTL_SYNCOOKIES_ALWAYS +}; + +struct pfctl_syncookies { + enum pfctl_syncookies_mode mode; +}; + int pfctl_get_rule(int dev, u_int32_t nr, u_int32_t ticket, const char *anchor, u_int32_t ruleset, struct pfctl_rule *rule, char *anchor_call); @@ -260,5 +269,7 @@ int pfctl_clear_states(int dev, const struct pfctl_kill *kill, unsigned int *killed); int pfctl_kill_states(int dev, const struct pfctl_kill *kill, unsigned int *killed); +int pfctl_set_syncookies(int dev, const struct pfctl_syncookies *s); +int pfctl_get_syncookies(int dev, struct pfctl_syncookies *s); #endif diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index acd90e280b53..19fb87323060 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -464,7 +464,7 @@ int parseport(char *, struct range *r, int); %token REASSEMBLE FRAGDROP FRAGCROP ANCHOR NATANCHOR RDRANCHOR BINATANCHOR %token SET OPTIMIZATION TIMEOUT LIMIT LOGINTERFACE BLOCKPOLICY FAILPOLICY %token RANDOMID REQUIREORDER SYNPROXY FINGERPRINTS NOSYNC DEBUG SKIP HOSTID -%token ANTISPOOF FOR INCLUDE KEEPCOUNTERS +%token ANTISPOOF FOR INCLUDE KEEPCOUNTERS SYNCOOKIES %token BITMASK RANDOM SOURCEHASH ROUNDROBIN STATICPORT PROBABILITY MAPEPORTSET %token ALTQ CBQ CODEL PRIQ HFSC FAIRQ BANDWIDTH TBRSIZE LINKSHARE REALTIME %token UPPERLIMIT QUEUE PRIORITY QLIMIT HOGS BUCKETS RTABLE TARGET INTERVAL @@ -480,7 +480,7 @@ int parseport(char *, struct range *r, int); %type number icmptype icmp6type uid gid %type tos not yesno %type probability -%type no dir af fragcache optimizer +%type no dir af fragcache optimizer syncookie_val %type sourcetrack flush unaryop statelock %type action nataction natpasslog scrubaction %type flags flag blockspec prio @@ -725,6 +725,21 @@ option : SET OPTIMIZATION STRING { | SET KEEPCOUNTERS { pf->keep_counters = true; } + | SET SYNCOOKIES syncookie_val { + pf->syncookies = $3; + } + ; + +syncookie_val : STRING { + if (!strcmp($1, "never")) + $$ = PFCTL_SYNCOOKIES_NEVER; + else if (!strcmp($1, "always")) + $$ = PFCTL_SYNCOOKIES_ALWAYS; + else { + yyerror("illegal value for syncookies"); + YYERROR; + } + } ; stringall : STRING { $$ = $1; } @@ -5671,6 +5686,7 @@ lookup(char *s) { "state-policy", STATEPOLICY}, { "static-port", STATICPORT}, { "sticky-address", STICKYADDRESS}, + { "syncookies", SYNCOOKIES}, { "synproxy", SYNPROXY}, { "table", TABLE}, { "tag", TAG}, diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c index 14b7f3a01657..6c689edf7c43 100644 --- a/sbin/pfctl/pfctl.c +++ b/sbin/pfctl/pfctl.c @@ -93,6 +93,7 @@ int pfctl_load_timeout(struct pfctl *, unsigned int, unsigned int); int pfctl_load_debug(struct pfctl *, unsigned int); int pfctl_load_logif(struct pfctl *, char *); int pfctl_load_hostid(struct pfctl *, u_int32_t); +int pfctl_load_syncookies(struct pfctl *, u_int8_t); int pfctl_get_pool(int, struct pfctl_pool *, u_int32_t, u_int32_t, int, char *); void pfctl_print_rule_counters(struct pfctl_rule *, int); @@ -1307,15 +1308,20 @@ pfctl_show_states(int dev, const char *iface, int opts) int pfctl_show_status(int dev, int opts) { - struct pf_status status; + struct pf_status status; + struct pfctl_syncookies cookies; if (ioctl(dev, DIOCGETSTATUS, &status)) { warn("DIOCGETSTATUS"); return (-1); } + if (pfctl_get_syncookies(dev, &cookies)) { + warn("DIOCGETSYNCOOKIES"); + return (-1); + } if (opts & PF_OPT_SHOWALL) pfctl_print_title("INFO:"); - print_status(&status, opts); + print_status(&status, &cookies, opts); return (0); } @@ -1861,6 +1867,10 @@ pfctl_load_options(struct pfctl *pf) if (pfctl_set_keepcounters(pf->dev, pf->keep_counters)) error = 1; + /* load syncookies settings */ + if (pfctl_load_syncookies(pf, pf->syncookies)) + error = 1; + return (error); } @@ -2047,6 +2057,22 @@ pfctl_load_hostid(struct pfctl *pf, u_int32_t hostid) return (0); } +int +pfctl_load_syncookies(struct pfctl *pf, u_int8_t val) +{ + struct pfctl_syncookies cookies; + + bzero(&cookies, sizeof(cookies)); + + cookies.mode = val ? PFCTL_SYNCOOKIES_ALWAYS : PFCTL_SYNCOOKIES_NEVER; + + if (pfctl_set_syncookies(dev, &cookies)) { + warnx("DIOCSETSYNCOOKIES"); + return (1); + } + return (0); +} + int pfctl_set_debug(struct pfctl *pf, char *d) { diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c index b4a1cde967bd..e3efd20d3822 100644 --- a/sbin/pfctl/pfctl_parser.c +++ b/sbin/pfctl/pfctl_parser.c @@ -497,7 +497,7 @@ const char * const pf_fcounters[FCNT_MAX+1] = FCNT_NAMES; const char * const pf_scounters[FCNT_MAX+1] = FCNT_NAMES; void -print_status(struct pf_status *s, int opts) +print_status(struct pf_status *s, struct pfctl_syncookies *cookies, int opts) { char statline[80], *running; time_t runtime; @@ -627,6 +627,11 @@ print_status(struct pf_status *s, int opts) else printf("%14s\n", ""); } + + printf("Syncookies\n"); + printf(" %-25s %s\n", "mode", + cookies->mode == PFCTL_SYNCOOKIES_NEVER ? + "never" : "always"); } } diff --git a/sbin/pfctl/pfctl_parser.h b/sbin/pfctl/pfctl_parser.h index 5353900b380a..0c64238ecefa 100644 --- a/sbin/pfctl/pfctl_parser.h +++ b/sbin/pfctl/pfctl_parser.h @@ -100,6 +100,7 @@ struct pfctl { u_int32_t hostid; char *ifname; bool keep_counters; + u_int8_t syncookies; u_int8_t timeout_set[PFTM_MAX]; u_int8_t limit_set[PF_LIMIT_MAX]; @@ -278,7 +279,7 @@ void print_pool(struct pfctl_pool *, u_int16_t, u_int16_t, sa_family_t, int); void print_src_node(struct pf_src_node *, int); void print_rule(struct pfctl_rule *, const char *, int, int); void print_tabledef(const char *, int, int, struct node_tinithead *); -void print_status(struct pf_status *, int); +void print_status(struct pf_status *, struct pfctl_syncookies *, int); void print_running(struct pf_status *); int eval_pfaltq(struct pfctl *, struct pf_altq *, struct node_queue_bw *, From owner-dev-commits-src-all@freebsd.org Tue Jul 27 11:46: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 2E9D865E180; Tue, 27 Jul 2021 11:46: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 4GYw4Z3ZPqz3sKD; Tue, 27 Jul 2021 11:46: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 7A0501C41; Tue, 27 Jul 2021 11:46: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 16RBkrWc068060; Tue, 27 Jul 2021 11:46:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RBkr1O068059; Tue, 27 Jul 2021 11:46:53 GMT (envelope-from git) Date: Tue, 27 Jul 2021 11:46:53 GMT Message-Id: <202107271146.16RBkr1O068059@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: fbef5f8f7e85 - stable/12 - pf: clean up syncookie callout on vnet shutdown 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: fbef5f8f7e8506890c81a7a1c72cab587e9205e7 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, 27 Jul 2021 11:46:56 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=fbef5f8f7e8506890c81a7a1c72cab587e9205e7 commit fbef5f8f7e8506890c81a7a1c72cab587e9205e7 Author: Kristof Provost AuthorDate: 2021-07-20 19:03:08 +0000 Commit: Kristof Provost CommitDate: 2021-07-27 11:24:27 +0000 pf: clean up syncookie callout on vnet shutdown Ensure that we cancel any outstanding callouts for syncookies when we terminate the vnet. MFC after: 1 week Sponsored by: Modirum MDPay (cherry picked from commit 32271c4d383effeac7878201ef5cbdfaeedc3755) --- sys/net/pfvar.h | 1 + sys/netpfil/pf/pf_ioctl.c | 1 + sys/netpfil/pf/pf_syncookies.c | 6 ++++++ 3 files changed, 8 insertions(+) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index d072eedd3621..7d31e4ce21a0 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -1842,6 +1842,7 @@ void pf_send_tcp(const struct pf_krule *, sa_family_t, u_int16_t); void pf_syncookies_init(void); +void pf_syncookies_cleanup(void); int pf_get_syncookies(struct pfioc_nv *); int pf_set_syncookies(struct pfioc_nv *); int pf_synflood_check(struct pf_pdesc *); diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index dde2aecc8ef5..a3026d394bde 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -5633,6 +5633,7 @@ pf_unload_vnet(void) } PF_RULES_WLOCK(); + pf_syncookies_cleanup(); shutdown_pf(); PF_RULES_WUNLOCK(); diff --git a/sys/netpfil/pf/pf_syncookies.c b/sys/netpfil/pf/pf_syncookies.c index 43d3a0a0b036..bfcc4b3d4e82 100644 --- a/sys/netpfil/pf/pf_syncookies.c +++ b/sys/netpfil/pf/pf_syncookies.c @@ -127,6 +127,12 @@ pf_syncookies_init(void) PF_RULES_WUNLOCK(); } +void +pf_syncookies_cleanup(void) +{ + callout_stop(&V_pf_syncookie_status.keytimeout); +} + int pf_get_syncookies(struct pfioc_nv *nv) { From owner-dev-commits-src-all@freebsd.org Tue Jul 27 11:46: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 E75E165D9E1; Tue, 27 Jul 2021 11:46: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 4GYw4R65gPz3s5t; Tue, 27 Jul 2021 11:46: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 B0C631ADB; Tue, 27 Jul 2021 11:46: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 16RBklmJ067813; Tue, 27 Jul 2021 11:46:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RBkliO067812; Tue, 27 Jul 2021 11:46:47 GMT (envelope-from git) Date: Tue, 27 Jul 2021 11:46:47 GMT Message-Id: <202107271146.16RBkliO067812@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: a1d93f870a22 - stable/12 - pfctl: syncookie configuration 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: a1d93f870a22e368f01d43b1ae8acb5cdae0462d 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, 27 Jul 2021 11:46:48 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=a1d93f870a22e368f01d43b1ae8acb5cdae0462d commit a1d93f870a22e368f01d43b1ae8acb5cdae0462d Author: Kristof Provost AuthorDate: 2021-05-26 11:41:34 +0000 Commit: Kristof Provost CommitDate: 2021-07-27 11:24:25 +0000 pfctl: syncookie configuration pfctl and libpfctl code required to enable/disable the syncookie feature. MFC after: 1 week Sponsored by: Modirum MDPay Differential Revision: https://reviews.freebsd.org/D31140 (cherry picked from commit c69121c473d75abab55f9ade8e8138ac09c0942c) --- lib/libpfctl/libpfctl.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++ lib/libpfctl/libpfctl.h | 11 +++++++++ sbin/pfctl/parse.y | 20 +++++++++++++++-- sbin/pfctl/pfctl.c | 30 +++++++++++++++++++++++-- sbin/pfctl/pfctl_parser.c | 7 +++++- sbin/pfctl/pfctl_parser.h | 3 ++- 6 files changed, 122 insertions(+), 6 deletions(-) diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c index 6421a2c752a8..ced130820d7d 100644 --- a/lib/libpfctl/libpfctl.c +++ b/lib/libpfctl/libpfctl.c @@ -816,3 +816,60 @@ pfctl_kill_states(int dev, const struct pfctl_kill *kill, unsigned int *killed) { return (_pfctl_clear_states(dev, kill, killed, DIOCKILLSTATESNV)); } + +int +pfctl_set_syncookies(int dev, const struct pfctl_syncookies *s) +{ + struct pfioc_nv nv; + nvlist_t *nvl; + int ret; + + nvl = nvlist_create(0); + + nvlist_add_bool(nvl, "enabled", s->mode != PFCTL_SYNCOOKIES_NEVER); + nvlist_add_bool(nvl, "adaptive", false); /* XXX TODO */ + + nv.data = nvlist_pack(nvl, &nv.len); + nv.size = nv.len; + nvlist_destroy(nvl); + nvl = NULL; + + ret = ioctl(dev, DIOCSETSYNCOOKIES, &nv); + + free(nv.data); + return (ret); +} + +int +pfctl_get_syncookies(int dev, struct pfctl_syncookies *s) +{ + struct pfioc_nv nv; + nvlist_t *nvl; + bool enabled, adaptive; + + bzero(s, sizeof(*s)); + + nv.data = malloc(128); + nv.len = nv.size = 128; + + if (ioctl(dev, DIOCGETSYNCOOKIES, &nv)) { + free(nv.data); + return (errno); + } + + nvl = nvlist_unpack(nv.data, nv.len, 0); + free(nv.data); + if (nvl == NULL) { + free(nv.data); + return (EIO); + } + + enabled = nvlist_get_bool(nvl, "enabled"); + adaptive = nvlist_get_bool(nvl, "adaptive"); + + s->mode = enabled ? PFCTL_SYNCOOKIES_ALWAYS : PFCTL_SYNCOOKIES_NEVER; + + nvlist_destroy(nvl); + + return (0); +} diff --git a/lib/libpfctl/libpfctl.h b/lib/libpfctl/libpfctl.h index 62866e17f904..d57241dd59fd 100644 --- a/lib/libpfctl/libpfctl.h +++ b/lib/libpfctl/libpfctl.h @@ -244,6 +244,15 @@ struct pfctl_states { size_t count; }; +enum pfctl_syncookies_mode { + PFCTL_SYNCOOKIES_NEVER, + PFCTL_SYNCOOKIES_ALWAYS +}; + +struct pfctl_syncookies { + enum pfctl_syncookies_mode mode; +}; + int pfctl_get_rule(int dev, u_int32_t nr, u_int32_t ticket, const char *anchor, u_int32_t ruleset, struct pfctl_rule *rule, char *anchor_call); @@ -260,5 +269,7 @@ int pfctl_clear_states(int dev, const struct pfctl_kill *kill, unsigned int *killed); int pfctl_kill_states(int dev, const struct pfctl_kill *kill, unsigned int *killed); +int pfctl_set_syncookies(int dev, const struct pfctl_syncookies *s); +int pfctl_get_syncookies(int dev, struct pfctl_syncookies *s); #endif diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index 1083666e00ce..2655a7939503 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -464,7 +464,7 @@ int parseport(char *, struct range *r, int); %token REASSEMBLE FRAGDROP FRAGCROP ANCHOR NATANCHOR RDRANCHOR BINATANCHOR %token SET OPTIMIZATION TIMEOUT LIMIT LOGINTERFACE BLOCKPOLICY FAILPOLICY %token RANDOMID REQUIREORDER SYNPROXY FINGERPRINTS NOSYNC DEBUG SKIP HOSTID -%token ANTISPOOF FOR INCLUDE KEEPCOUNTERS +%token ANTISPOOF FOR INCLUDE KEEPCOUNTERS SYNCOOKIES %token BITMASK RANDOM SOURCEHASH ROUNDROBIN STATICPORT PROBABILITY MAPEPORTSET %token ALTQ CBQ CODEL PRIQ HFSC FAIRQ BANDWIDTH TBRSIZE LINKSHARE REALTIME %token UPPERLIMIT QUEUE PRIORITY QLIMIT HOGS BUCKETS RTABLE TARGET INTERVAL @@ -480,7 +480,7 @@ int parseport(char *, struct range *r, int); %type number icmptype icmp6type uid gid %type tos not yesno %type probability -%type no dir af fragcache optimizer +%type no dir af fragcache optimizer syncookie_val %type sourcetrack flush unaryop statelock %type action nataction natpasslog scrubaction %type flags flag blockspec prio @@ -725,6 +725,21 @@ option : SET OPTIMIZATION STRING { | SET KEEPCOUNTERS { pf->keep_counters = true; } + | SET SYNCOOKIES syncookie_val { + pf->syncookies = $3; + } + ; + +syncookie_val : STRING { + if (!strcmp($1, "never")) + $$ = PFCTL_SYNCOOKIES_NEVER; + else if (!strcmp($1, "always")) + $$ = PFCTL_SYNCOOKIES_ALWAYS; + else { + yyerror("illegal value for syncookies"); + YYERROR; + } + } ; stringall : STRING { $$ = $1; } @@ -5663,6 +5678,7 @@ lookup(char *s) { "state-policy", STATEPOLICY}, { "static-port", STATICPORT}, { "sticky-address", STICKYADDRESS}, + { "syncookies", SYNCOOKIES}, { "synproxy", SYNPROXY}, { "table", TABLE}, { "tag", TAG}, diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c index 14b7f3a01657..6c689edf7c43 100644 --- a/sbin/pfctl/pfctl.c +++ b/sbin/pfctl/pfctl.c @@ -93,6 +93,7 @@ int pfctl_load_timeout(struct pfctl *, unsigned int, unsigned int); int pfctl_load_debug(struct pfctl *, unsigned int); int pfctl_load_logif(struct pfctl *, char *); int pfctl_load_hostid(struct pfctl *, u_int32_t); +int pfctl_load_syncookies(struct pfctl *, u_int8_t); int pfctl_get_pool(int, struct pfctl_pool *, u_int32_t, u_int32_t, int, char *); void pfctl_print_rule_counters(struct pfctl_rule *, int); @@ -1307,15 +1308,20 @@ pfctl_show_states(int dev, const char *iface, int opts) int pfctl_show_status(int dev, int opts) { - struct pf_status status; + struct pf_status status; + struct pfctl_syncookies cookies; if (ioctl(dev, DIOCGETSTATUS, &status)) { warn("DIOCGETSTATUS"); return (-1); } + if (pfctl_get_syncookies(dev, &cookies)) { + warn("DIOCGETSYNCOOKIES"); + return (-1); + } if (opts & PF_OPT_SHOWALL) pfctl_print_title("INFO:"); - print_status(&status, opts); + print_status(&status, &cookies, opts); return (0); } @@ -1861,6 +1867,10 @@ pfctl_load_options(struct pfctl *pf) if (pfctl_set_keepcounters(pf->dev, pf->keep_counters)) error = 1; + /* load syncookies settings */ + if (pfctl_load_syncookies(pf, pf->syncookies)) + error = 1; + return (error); } @@ -2047,6 +2057,22 @@ pfctl_load_hostid(struct pfctl *pf, u_int32_t hostid) return (0); } +int +pfctl_load_syncookies(struct pfctl *pf, u_int8_t val) +{ + struct pfctl_syncookies cookies; + + bzero(&cookies, sizeof(cookies)); + + cookies.mode = val ? PFCTL_SYNCOOKIES_ALWAYS : PFCTL_SYNCOOKIES_NEVER; + + if (pfctl_set_syncookies(dev, &cookies)) { + warnx("DIOCSETSYNCOOKIES"); + return (1); + } + return (0); +} + int pfctl_set_debug(struct pfctl *pf, char *d) { diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c index c38411a145e7..7020a0f6a811 100644 --- a/sbin/pfctl/pfctl_parser.c +++ b/sbin/pfctl/pfctl_parser.c @@ -497,7 +497,7 @@ const char * const pf_fcounters[FCNT_MAX+1] = FCNT_NAMES; const char * const pf_scounters[FCNT_MAX+1] = FCNT_NAMES; void -print_status(struct pf_status *s, int opts) +print_status(struct pf_status *s, struct pfctl_syncookies *cookies, int opts) { char statline[80], *running; time_t runtime; @@ -627,6 +627,11 @@ print_status(struct pf_status *s, int opts) else printf("%14s\n", ""); } + + printf("Syncookies\n"); + printf(" %-25s %s\n", "mode", + cookies->mode == PFCTL_SYNCOOKIES_NEVER ? + "never" : "always"); } } diff --git a/sbin/pfctl/pfctl_parser.h b/sbin/pfctl/pfctl_parser.h index 5353900b380a..0c64238ecefa 100644 --- a/sbin/pfctl/pfctl_parser.h +++ b/sbin/pfctl/pfctl_parser.h @@ -100,6 +100,7 @@ struct pfctl { u_int32_t hostid; char *ifname; bool keep_counters; + u_int8_t syncookies; u_int8_t timeout_set[PFTM_MAX]; u_int8_t limit_set[PF_LIMIT_MAX]; @@ -278,7 +279,7 @@ void print_pool(struct pfctl_pool *, u_int16_t, u_int16_t, sa_family_t, int); void print_src_node(struct pf_src_node *, int); void print_rule(struct pfctl_rule *, const char *, int, int); void print_tabledef(const char *, int, int, struct node_tinithead *); -void print_status(struct pf_status *, int); +void print_status(struct pf_status *, struct pfctl_syncookies *, int); void print_running(struct pf_status *); int eval_pfaltq(struct pfctl *, struct pf_altq *, struct node_queue_bw *, From owner-dev-commits-src-all@freebsd.org Tue Jul 27 11:46: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 697DC65D779; Tue, 27 Jul 2021 11:46: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 4GYw4T4JHzz3rv4; Tue, 27 Jul 2021 11:46: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 D60C92120; Tue, 27 Jul 2021 11:46: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 16RBkmSN067868; Tue, 27 Jul 2021 11:46:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RBkmdJ067867; Tue, 27 Jul 2021 11:46:48 GMT (envelope-from git) Date: Tue, 27 Jul 2021 11:46:48 GMT Message-Id: <202107271146.16RBkmdJ067867@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: 91bf2e701ed7 - stable/12 - pf tests: Forwarding syncookie 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: 91bf2e701ed789c990f3c75c0d166c60a634d3f1 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, 27 Jul 2021 11:46:50 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=91bf2e701ed789c990f3c75c0d166c60a634d3f1 commit 91bf2e701ed789c990f3c75c0d166c60a634d3f1 Author: Kristof Provost AuthorDate: 2021-06-02 16:16:03 +0000 Commit: Kristof Provost CommitDate: 2021-07-27 11:24:26 +0000 pf tests: Forwarding syncookie test Test syncookies on a forwarding host. That is, in a setup where the machine (or vnet) running pf is not the same as the machine (or vnet) running the server it's protecting. MFC after: 1 week Sponsored by: Modirum MDPay Differential Revision: https://reviews.freebsd.org/D31141 (cherry picked from commit 3be9301a7e4fbd630cbde1bd3e1b59ac726e21af) --- tests/sys/netpfil/pf/Makefile | 1 + tests/sys/netpfil/pf/syncookie.sh | 84 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+) diff --git a/tests/sys/netpfil/pf/Makefile b/tests/sys/netpfil/pf/Makefile index 08174ad7ce19..fde02ea3933b 100644 --- a/tests/sys/netpfil/pf/Makefile +++ b/tests/sys/netpfil/pf/Makefile @@ -21,6 +21,7 @@ ATF_TESTS_SH+= anchor \ src_track \ rdr \ route_to \ + syncookie \ synproxy \ set_skip \ pfsync \ diff --git a/tests/sys/netpfil/pf/syncookie.sh b/tests/sys/netpfil/pf/syncookie.sh new file mode 100644 index 000000000000..7bd045249be6 --- /dev/null +++ b/tests/sys/netpfil/pf/syncookie.sh @@ -0,0 +1,84 @@ +# $FreeBSD$ +# +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2021 Modirum MDPay +# +# 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. + +. $(atf_get_srcdir)/utils.subr + +atf_test_case "forward" "cleanup" +forward_head() +{ + atf_set descr 'Syncookies for forwarded hosts' + atf_set require.user root +} + +forward_body() +{ + pft_init + + epair_in=$(vnet_mkepair) + epair_out=$(vnet_mkepair) + + vnet_mkjail fwd ${epair_in}b ${epair_out}a + vnet_mkjail srv ${epair_out}b + + jexec fwd ifconfig ${epair_in}b 192.0.2.1/24 up + jexec fwd ifconfig ${epair_out}a 198.51.100.1/24 up + jexec fwd sysctl net.inet.ip.forwarding=1 + + jexec srv ifconfig ${epair_out}b 198.51.100.2/24 up + jexec srv route add default 198.51.100.1 + jexec srv /usr/sbin/inetd -p inetd-alcatraz.pid \ + $(atf_get_srcdir)/echo_inetd.conf + + ifconfig ${epair_in}a 192.0.2.2/24 up + route add -net 198.51.100.0/24 192.0.2.1 + + jexec fwd pfctl -e + pft_set_rules fwd \ + "set syncookies always" \ + "pass in" \ + "pass out" + + # Sanity check + atf_check -s exit:0 -o ignore ping -c 1 198.51.100.2 + + reply=$(echo foo | nc -N -w 5 198.51.100.2 7) + if [ "${reply}" != "foo" ]; + then + atf_fail "Failed to connect to syncookie protected echo daemon" + fi +} + +forward_cleanup() +{ + rm -f inetd-alcatraz.pid + pft_cleanup +} + +atf_init_test_cases() +{ + atf_add_test_case "forward" +} From owner-dev-commits-src-all@freebsd.org Tue Jul 27 11:46: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 D990465D77A; Tue, 27 Jul 2021 11:46: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 4GYw4V1p3wz3sM7; Tue, 27 Jul 2021 11:46: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 01B501C3F; Tue, 27 Jul 2021 11:46: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 16RBknKT067916; Tue, 27 Jul 2021 11:46:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RBknKZ067915; Tue, 27 Jul 2021 11:46:49 GMT (envelope-from git) Date: Tue, 27 Jul 2021 11:46:49 GMT Message-Id: <202107271146.16RBknKZ067915@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: d0a815844eef - stable/12 - pf tests: ensure syncookie does not create state 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: d0a815844eefe6087fd170e6664286d2c9334a30 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, 27 Jul 2021 11:46:51 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=d0a815844eefe6087fd170e6664286d2c9334a30 commit d0a815844eefe6087fd170e6664286d2c9334a30 Author: Kristof Provost AuthorDate: 2021-06-30 13:27:46 +0000 Commit: Kristof Provost CommitDate: 2021-07-27 11:24:26 +0000 pf tests: ensure syncookie does not create state Test that with syncookies enabled pf does not create state for connections before the remote peer has replied to the SYN|ACK message. MFC after: 1 week Sponsored by: Modirum MDPay Differential Revision: https://reviews.freebsd.org/D31142 (cherry picked from commit 27ab791a55191c0b6503391d411303b042b41047) --- tests/sys/netpfil/pf/syncookie.sh | 49 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/tests/sys/netpfil/pf/syncookie.sh b/tests/sys/netpfil/pf/syncookie.sh index 7bd045249be6..49acd9fab11d 100644 --- a/tests/sys/netpfil/pf/syncookie.sh +++ b/tests/sys/netpfil/pf/syncookie.sh @@ -27,6 +27,8 @@ . $(atf_get_srcdir)/utils.subr +common_dir=$(atf_get_srcdir)/../common + atf_test_case "forward" "cleanup" forward_head() { @@ -78,7 +80,54 @@ forward_cleanup() pft_cleanup } +atf_test_case "nostate" "cleanup" +nostate_head() +{ + atf_set descr 'Ensure that we do not create until SYN|ACK' + atf_set require.user root + atf_set require.progs scapy +} + +nostate_body() +{ + pft_init + + epair=$(vnet_mkepair) + ifconfig ${epair}a 192.0.2.2/24 up + + vnet_mkjail alcatraz ${epair}b + jexec alcatraz ifconfig ${epair}b 192.0.2.1/24 up + + jexec alcatraz pfctl -e + pft_set_rules alcatraz \ + "set syncookies always" \ + "pass in" \ + "pass out" + + # Sanity check + atf_check -s exit:0 -o ignore ping -c 1 192.0.2.1 + + # Now syn flood to create many states + ${common_dir}/pft_synflood.py \ + --sendif ${epair}a \ + --to 192.0.2.2 \ + --count 20 + + states=$(jexec alcatraz pfctl -ss | grep tcp) + if [ -n "$states" ]; + then + echo "$states" + atf_fail "Found unexpected state" + fi +} + +nostate_cleanup() +{ + pft_cleanup +} + atf_init_test_cases() { atf_add_test_case "forward" + atf_add_test_case "nostate" } From owner-dev-commits-src-all@freebsd.org Tue Jul 27 11:46: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 5BBFF65E0AF; Tue, 27 Jul 2021 11:46: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 4GYw4T0hHGz3rx9; Tue, 27 Jul 2021 11:46: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 724271E6C; Tue, 27 Jul 2021 11:46: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 16RBkmVJ067844; Tue, 27 Jul 2021 11:46:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RBkmoV067843; Tue, 27 Jul 2021 11:46:48 GMT (envelope-from git) Date: Tue, 27 Jul 2021 11:46:48 GMT Message-Id: <202107271146.16RBkmoV067843@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: 1156a429ebb1 - stable/13 - pf tests: Forwarding syncookie 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/13 X-Git-Reftype: branch X-Git-Commit: 1156a429ebb13e18d41bbd7e18f612001733b493 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, 27 Jul 2021 11:46:51 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=1156a429ebb13e18d41bbd7e18f612001733b493 commit 1156a429ebb13e18d41bbd7e18f612001733b493 Author: Kristof Provost AuthorDate: 2021-06-02 16:16:03 +0000 Commit: Kristof Provost CommitDate: 2021-07-27 07:43:58 +0000 pf tests: Forwarding syncookie test Test syncookies on a forwarding host. That is, in a setup where the machine (or vnet) running pf is not the same as the machine (or vnet) running the server it's protecting. MFC after: 1 week Sponsored by: Modirum MDPay Differential Revision: https://reviews.freebsd.org/D31141 (cherry picked from commit 3be9301a7e4fbd630cbde1bd3e1b59ac726e21af) --- tests/sys/netpfil/pf/Makefile | 1 + tests/sys/netpfil/pf/syncookie.sh | 84 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+) diff --git a/tests/sys/netpfil/pf/Makefile b/tests/sys/netpfil/pf/Makefile index e5139b4262e1..cfa5f5c7c912 100644 --- a/tests/sys/netpfil/pf/Makefile +++ b/tests/sys/netpfil/pf/Makefile @@ -25,6 +25,7 @@ ATF_TESTS_SH+= anchor \ set_skip \ set_tos \ src_track \ + syncookie \ synproxy \ table \ tos diff --git a/tests/sys/netpfil/pf/syncookie.sh b/tests/sys/netpfil/pf/syncookie.sh new file mode 100644 index 000000000000..7bd045249be6 --- /dev/null +++ b/tests/sys/netpfil/pf/syncookie.sh @@ -0,0 +1,84 @@ +# $FreeBSD$ +# +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2021 Modirum MDPay +# +# 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. + +. $(atf_get_srcdir)/utils.subr + +atf_test_case "forward" "cleanup" +forward_head() +{ + atf_set descr 'Syncookies for forwarded hosts' + atf_set require.user root +} + +forward_body() +{ + pft_init + + epair_in=$(vnet_mkepair) + epair_out=$(vnet_mkepair) + + vnet_mkjail fwd ${epair_in}b ${epair_out}a + vnet_mkjail srv ${epair_out}b + + jexec fwd ifconfig ${epair_in}b 192.0.2.1/24 up + jexec fwd ifconfig ${epair_out}a 198.51.100.1/24 up + jexec fwd sysctl net.inet.ip.forwarding=1 + + jexec srv ifconfig ${epair_out}b 198.51.100.2/24 up + jexec srv route add default 198.51.100.1 + jexec srv /usr/sbin/inetd -p inetd-alcatraz.pid \ + $(atf_get_srcdir)/echo_inetd.conf + + ifconfig ${epair_in}a 192.0.2.2/24 up + route add -net 198.51.100.0/24 192.0.2.1 + + jexec fwd pfctl -e + pft_set_rules fwd \ + "set syncookies always" \ + "pass in" \ + "pass out" + + # Sanity check + atf_check -s exit:0 -o ignore ping -c 1 198.51.100.2 + + reply=$(echo foo | nc -N -w 5 198.51.100.2 7) + if [ "${reply}" != "foo" ]; + then + atf_fail "Failed to connect to syncookie protected echo daemon" + fi +} + +forward_cleanup() +{ + rm -f inetd-alcatraz.pid + pft_cleanup +} + +atf_init_test_cases() +{ + atf_add_test_case "forward" +} From owner-dev-commits-src-all@freebsd.org Tue Jul 27 11:46: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 685A165E0A9; Tue, 27 Jul 2021 11:46: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 4GYw4Q67cPz3s85; Tue, 27 Jul 2021 11:46: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 8DD421F7F; Tue, 27 Jul 2021 11:46: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 16RBkkdc067765; Tue, 27 Jul 2021 11:46:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RBkkYF067764; Tue, 27 Jul 2021 11:46:46 GMT (envelope-from git) Date: Tue, 27 Jul 2021 11:46:46 GMT Message-Id: <202107271146.16RBkkYF067764@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: 4c36e9454374 - stable/12 - pf: syncookie ioctl interface 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: 4c36e9454374fa200572ce4be5fb2570892c5634 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, 27 Jul 2021 11:46:47 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=4c36e9454374fa200572ce4be5fb2570892c5634 commit 4c36e9454374fa200572ce4be5fb2570892c5634 Author: Kristof Provost AuthorDate: 2021-05-26 08:18:19 +0000 Commit: Kristof Provost CommitDate: 2021-07-27 11:24:24 +0000 pf: syncookie ioctl interface Kernel side implementation to allow switching between on and off modes, and allow this configuration to be retrieved. MFC after: 1 week Sponsored by: Modirum MDPay Differential Revision: https://reviews.freebsd.org/D31139 (cherry picked from commit 231e83d3422ff58fe94de8375a9532a1726056ed) --- sys/net/pfvar.h | 2 +- sys/netpfil/pf/pf_ioctl.c | 18 +++++++++ sys/netpfil/pf/pf_syncookies.c | 84 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 103 insertions(+), 1 deletion(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 3a74709fecf5..d072eedd3621 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -1573,6 +1573,7 @@ struct pf_idhash { struct mtx lock; }; +extern u_long pf_ioctl_maxcount; extern u_long pf_hashmask; extern u_long pf_srchashmask; #define PF_HASHSIZ (131072) @@ -1841,7 +1842,6 @@ void pf_send_tcp(const struct pf_krule *, sa_family_t, u_int16_t); void pf_syncookies_init(void); -int pf_syncookies_setmode(u_int8_t); int pf_get_syncookies(struct pfioc_nv *); int pf_set_syncookies(struct pfioc_nv *); int pf_synflood_check(struct pf_pdesc *); diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 70cc4ff83d7b..dde2aecc8ef5 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -276,6 +276,14 @@ pflog_packet_t *pflog_packet_ptr = NULL; extern u_long pf_ioctl_maxcount; +#define ERROUT_FUNCTION(target, x) \ + do { \ + error = (x); \ + SDT_PROBE3(pf, ioctl, function, error, __func__, error, \ + __LINE__); \ + goto target; \ + } while (0) + static void pfattach_vnet(void) { @@ -2138,6 +2146,7 @@ pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td case DIOCOSFPGET: case DIOCGETSRCNODES: case DIOCCLRSRCNODES: + case DIOCGETSYNCOOKIES: case DIOCIGETIFACES: case DIOCGIFSPEEDV0: case DIOCGIFSPEEDV1: @@ -2185,6 +2194,7 @@ pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td case DIOCRTSTADDRS: case DIOCOSFPGET: case DIOCGETSRCNODES: + case DIOCGETSYNCOOKIES: case DIOCIGETIFACES: case DIOCGIFSPEEDV1: case DIOCGIFSPEEDV0: @@ -4602,6 +4612,14 @@ DIOCCHANGEADDR_error: error = pf_keepcounters((struct pfioc_nv *)addr); break; + case DIOCGETSYNCOOKIES: + error = pf_get_syncookies((struct pfioc_nv *)addr); + break; + + case DIOCSETSYNCOOKIES: + error = pf_set_syncookies((struct pfioc_nv *)addr); + break; + case DIOCSETHOSTID: { u_int32_t *hostid = (u_int32_t *)addr; diff --git a/sys/netpfil/pf/pf_syncookies.c b/sys/netpfil/pf/pf_syncookies.c index ee936b6662fa..c05aed605e06 100644 --- a/sys/netpfil/pf/pf_syncookies.c +++ b/sys/netpfil/pf/pf_syncookies.c @@ -110,6 +110,7 @@ struct pf_syncookie_status { VNET_DEFINE_STATIC(struct pf_syncookie_status, pf_syncookie_status); #define V_pf_syncookie_status VNET(pf_syncookie_status) +static int pf_syncookies_setmode(u_int8_t); void pf_syncookie_rotate(void *); void pf_syncookie_newkey(void); uint32_t pf_syncookie_mac(struct pf_pdesc *, union pf_syncookie, @@ -127,6 +128,89 @@ pf_syncookies_init(void) } int +pf_get_syncookies(struct pfioc_nv *nv) +{ + nvlist_t *nvl = NULL; + void *nvlpacked = NULL; + + nvl = nvlist_create(0); + if (nvl == NULL) + return (ENOMEM); + + nvlist_add_bool(nvl, "enabled", + V_pf_status.syncookies_mode != PF_SYNCOOKIES_NEVER); + nvlist_add_bool(nvl, "adaptive", false); + + nvlpacked = nvlist_pack(nvl, &nv->len); + if (nvlpacked == NULL) { + nvlist_destroy(nvl); + return (ENOMEM); + } + if (nv->size == 0) { + nvlist_destroy(nvl); + free(nvlpacked, M_TEMP); + return (0); + } else if (nv->size < nv->len) { + nvlist_destroy(nvl); + free(nvlpacked, M_TEMP); + return (ENOSPC); + } + + return (copyout(nvlpacked, nv->data, nv->len)); +} + +int +pf_set_syncookies(struct pfioc_nv *nv) +{ + nvlist_t *nvl = NULL; + void *nvlpacked = NULL; + int error; + bool enabled, adaptive; + + if (nv->len > pf_ioctl_maxcount) + return (ENOMEM); + + nvlpacked = malloc(nv->len, M_TEMP, M_WAITOK); + if (nvlpacked == NULL) + return (ENOMEM); + + error = copyin(nv->data, nvlpacked, nv->len); + if (error) { + free(nvlpacked, M_TEMP); + return (error); + } + + nvl = nvlist_unpack(nvlpacked, nv->len, 0); + if (nvl == NULL) { + free(nvlpacked, M_TEMP); + return (EBADMSG); + } + + if (! nvlist_exists_bool(nvl, "enabled") + || ! nvlist_exists_bool(nvl, "adaptive")) { + nvlist_destroy(nvl); + free(nvlpacked, M_TEMP); + return (EBADMSG); + } + + enabled = nvlist_get_bool(nvl, "enabled"); + adaptive = nvlist_get_bool(nvl, "adaptive"); + + if (adaptive) { + nvlist_destroy(nvl); + free(nvlpacked, M_TEMP); + return (ENOTSUP); + } + + PF_RULES_WLOCK(); + error = pf_syncookies_setmode(enabled ? + PF_SYNCOOKIES_ALWAYS : PF_SYNCOOKIES_NEVER); + PF_RULES_WUNLOCK(); + + return (error); +} + +static int pf_syncookies_setmode(u_int8_t mode) { if (mode > PF_SYNCOOKIES_MODE_MAX) From owner-dev-commits-src-all@freebsd.org Tue Jul 27 11:46: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 C052F65E121; Tue, 27 Jul 2021 11:46: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 4GYw4W6sdRz3sHx; Tue, 27 Jul 2021 11:46: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 27D7F1DF6; Tue, 27 Jul 2021 11:46: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 16RBkpO2067964; Tue, 27 Jul 2021 11:46:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RBkptm067963; Tue, 27 Jul 2021 11:46:51 GMT (envelope-from git) Date: Tue, 27 Jul 2021 11:46:51 GMT Message-Id: <202107271146.16RBkptm067963@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: 9b663cf5ca7e - stable/12 - pf: fix LINT build 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: 9b663cf5ca7ecd6a918343ee0d332026fb2d4ceb 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, 27 Jul 2021 11:46:53 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=9b663cf5ca7ecd6a918343ee0d332026fb2d4ceb commit 9b663cf5ca7ecd6a918343ee0d332026fb2d4ceb Author: Kristof Provost AuthorDate: 2021-07-20 14:48:35 +0000 Commit: Kristof Provost CommitDate: 2021-07-27 11:24:26 +0000 pf: fix LINT build We failed to list the new pf_syncookies.c file in sys/conf/files. This worked for the usual configurations, where pf is a module, but not for LINT builds. Reported by: lwhsu MFC after: 1 week Sponsored by: Modirum MDPay (cherry picked from commit b972a7fa9e1e01367435a5699b71cc7b5e494fee) --- sys/conf/files | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/conf/files b/sys/conf/files index 624be0a7240b..e9557a2cd01c 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -4511,6 +4511,7 @@ netpfil/pf/pf_norm.c optional pf inet netpfil/pf/pf_nv.c optional pf inet netpfil/pf/pf_osfp.c optional pf inet netpfil/pf/pf_ruleset.c optional pf inet +netpfil/pf/pf_syncookies.c optional pf inet netpfil/pf/pf_table.c optional pf inet netpfil/pf/in4_cksum.c optional pf inet netsmb/smb_conn.c optional netsmb From owner-dev-commits-src-all@freebsd.org Tue Jul 27 11:46: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 4087465E124; Tue, 27 Jul 2021 11:46: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 4GYw4Y6cL5z3s6G; Tue, 27 Jul 2021 11:46: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 0CF591C40; Tue, 27 Jul 2021 11:46: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 16RBkqcg068036; Tue, 27 Jul 2021 11:46:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RBkqGC068035; Tue, 27 Jul 2021 11:46:52 GMT (envelope-from git) Date: Tue, 27 Jul 2021 11:46:52 GMT Message-Id: <202107271146.16RBkqGC068035@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: 7d226e964ab7 - stable/13 - pf: clean up syncookie callout on vnet shutdown 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: 7d226e964ab78c704c9eec40daa95a4c6ab1b323 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, 27 Jul 2021 11:46:54 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=7d226e964ab78c704c9eec40daa95a4c6ab1b323 commit 7d226e964ab78c704c9eec40daa95a4c6ab1b323 Author: Kristof Provost AuthorDate: 2021-07-20 19:03:08 +0000 Commit: Kristof Provost CommitDate: 2021-07-27 07:45:41 +0000 pf: clean up syncookie callout on vnet shutdown Ensure that we cancel any outstanding callouts for syncookies when we terminate the vnet. MFC after: 1 week Sponsored by: Modirum MDPay (cherry picked from commit 32271c4d383effeac7878201ef5cbdfaeedc3755) --- sys/net/pfvar.h | 1 + sys/netpfil/pf/pf_ioctl.c | 1 + sys/netpfil/pf/pf_syncookies.c | 6 ++++++ 3 files changed, 8 insertions(+) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index b4a788436147..e54e734dcecf 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -1841,6 +1841,7 @@ void pf_send_tcp(const struct pf_krule *, sa_family_t, u_int16_t); void pf_syncookies_init(void); +void pf_syncookies_cleanup(void); int pf_get_syncookies(struct pfioc_nv *); int pf_set_syncookies(struct pfioc_nv *); int pf_synflood_check(struct pf_pdesc *); diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 96eb31b00ffb..6af5197ef07d 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -5574,6 +5574,7 @@ pf_unload_vnet(void) dehook_pf(); PF_RULES_WLOCK(); + pf_syncookies_cleanup(); shutdown_pf(); PF_RULES_WUNLOCK(); diff --git a/sys/netpfil/pf/pf_syncookies.c b/sys/netpfil/pf/pf_syncookies.c index 0313b817ad6d..8699ae855ec8 100644 --- a/sys/netpfil/pf/pf_syncookies.c +++ b/sys/netpfil/pf/pf_syncookies.c @@ -127,6 +127,12 @@ pf_syncookies_init(void) PF_RULES_WUNLOCK(); } +void +pf_syncookies_cleanup(void) +{ + callout_stop(&V_pf_syncookie_status.keytimeout); +} + int pf_get_syncookies(struct pfioc_nv *nv) { From owner-dev-commits-src-all@freebsd.org Tue Jul 27 11:46: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 931A665E0B7; Tue, 27 Jul 2021 11:46: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 4GYw4W0RWjz3rxN; Tue, 27 Jul 2021 11:46: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 BE3C91DF5; Tue, 27 Jul 2021 11:46: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 16RBkoWd067940; Tue, 27 Jul 2021 11:46:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RBkoCY067939; Tue, 27 Jul 2021 11:46:50 GMT (envelope-from git) Date: Tue, 27 Jul 2021 11:46:50 GMT Message-Id: <202107271146.16RBkoCY067939@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: eae9481e86ac - stable/13 - pf: fix LINT build 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: eae9481e86acfe95c721eccbad69b1530c3c58d5 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, 27 Jul 2021 11:46:51 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=eae9481e86acfe95c721eccbad69b1530c3c58d5 commit eae9481e86acfe95c721eccbad69b1530c3c58d5 Author: Kristof Provost AuthorDate: 2021-07-20 14:48:35 +0000 Commit: Kristof Provost CommitDate: 2021-07-27 07:45:23 +0000 pf: fix LINT build We failed to list the new pf_syncookies.c file in sys/conf/files. This worked for the usual configurations, where pf is a module, but not for LINT builds. Reported by: lwhsu MFC after: 1 week Sponsored by: Modirum MDPay (cherry picked from commit b972a7fa9e1e01367435a5699b71cc7b5e494fee) --- sys/conf/files | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/conf/files b/sys/conf/files index 3b8b761fde3a..b0f313bb39de 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -4531,6 +4531,7 @@ netpfil/pf/pf_norm.c optional pf inet netpfil/pf/pf_nv.c optional pf inet netpfil/pf/pf_osfp.c optional pf inet netpfil/pf/pf_ruleset.c optional pf inet +netpfil/pf/pf_syncookies.c optional pf inet netpfil/pf/pf_table.c optional pf inet netpfil/pf/in4_cksum.c optional pf inet netsmb/smb_conn.c optional netsmb From owner-dev-commits-src-all@freebsd.org Tue Jul 27 11:46: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 BFB8A65E123; Tue, 27 Jul 2021 11:46: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 4GYw4X4gHfz3sMF; Tue, 27 Jul 2021 11:46: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 DC4421BC2; Tue, 27 Jul 2021 11:46: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 16RBkpoI067988; Tue, 27 Jul 2021 11:46:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RBkpBO067987; Tue, 27 Jul 2021 11:46:51 GMT (envelope-from git) Date: Tue, 27 Jul 2021 11:46:51 GMT Message-Id: <202107271146.16RBkpBO067987@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: 00b005036b51 - stable/13 - pf: remove stray debug line 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: 00b005036b51631f71cb8ca40aa2d6723e623bef 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, 27 Jul 2021 11:46:54 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=00b005036b51631f71cb8ca40aa2d6723e623bef commit 00b005036b51631f71cb8ca40aa2d6723e623bef Author: Kristof Provost AuthorDate: 2021-07-20 19:02:33 +0000 Commit: Kristof Provost CommitDate: 2021-07-27 07:45:31 +0000 pf: remove stray debug line MFC after: 1 week Sponsored by: Modirum MDPay (cherry picked from commit 84db87b8dafd9e9970fd36ac48c11ffdc89d31d0) --- sys/netpfil/pf/pf_syncookies.c | 1 - 1 file changed, 1 deletion(-) diff --git a/sys/netpfil/pf/pf_syncookies.c b/sys/netpfil/pf/pf_syncookies.c index d51f89fb47d4..0313b817ad6d 100644 --- a/sys/netpfil/pf/pf_syncookies.c +++ b/sys/netpfil/pf/pf_syncookies.c @@ -301,7 +301,6 @@ pf_syncookie_rotate(void *arg) pf_syncookie_newkey(); CURVNET_RESTORE(); - printf("KP: %s() return\n", __func__); } void From owner-dev-commits-src-all@freebsd.org Tue Jul 27 11:46: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 09EC365E122; Tue, 27 Jul 2021 11:46: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 4GYw4X50Fzz3sMH; Tue, 27 Jul 2021 11:46: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 494A01E6D; Tue, 27 Jul 2021 11:46: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 16RBkq0W068012; Tue, 27 Jul 2021 11:46:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RBkqoV068011; Tue, 27 Jul 2021 11:46:52 GMT (envelope-from git) Date: Tue, 27 Jul 2021 11:46:52 GMT Message-Id: <202107271146.16RBkqoV068011@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: 3a6cc067e900 - stable/12 - pf: remove stray debug line 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: 3a6cc067e900b3ec4254c37b90efd844cbef0031 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, 27 Jul 2021 11:46:53 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=3a6cc067e900b3ec4254c37b90efd844cbef0031 commit 3a6cc067e900b3ec4254c37b90efd844cbef0031 Author: Kristof Provost AuthorDate: 2021-07-20 19:02:33 +0000 Commit: Kristof Provost CommitDate: 2021-07-27 11:24:27 +0000 pf: remove stray debug line MFC after: 1 week Sponsored by: Modirum MDPay (cherry picked from commit 84db87b8dafd9e9970fd36ac48c11ffdc89d31d0) --- sys/netpfil/pf/pf_syncookies.c | 1 - 1 file changed, 1 deletion(-) diff --git a/sys/netpfil/pf/pf_syncookies.c b/sys/netpfil/pf/pf_syncookies.c index c05aed605e06..43d3a0a0b036 100644 --- a/sys/netpfil/pf/pf_syncookies.c +++ b/sys/netpfil/pf/pf_syncookies.c @@ -301,7 +301,6 @@ pf_syncookie_rotate(void *arg) pf_syncookie_newkey(); CURVNET_RESTORE(); - printf("KP: %s() return\n", __func__); } void From owner-dev-commits-src-all@freebsd.org Tue Jul 27 11:46: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 4F44565DF3D; Tue, 27 Jul 2021 11:46: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 4GYw4V1qT8z3s34; Tue, 27 Jul 2021 11:46: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 A3CC41ADC; Tue, 27 Jul 2021 11:46: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 16RBkn1I067892; Tue, 27 Jul 2021 11:46:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RBknSv067891; Tue, 27 Jul 2021 11:46:49 GMT (envelope-from git) Date: Tue, 27 Jul 2021 11:46:49 GMT Message-Id: <202107271146.16RBknSv067891@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: 4aa52f90f71e - stable/13 - pf tests: ensure syncookie does not create state 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: 4aa52f90f71eb7d710da46e587354190d6df5566 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, 27 Jul 2021 11:46:51 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=4aa52f90f71eb7d710da46e587354190d6df5566 commit 4aa52f90f71eb7d710da46e587354190d6df5566 Author: Kristof Provost AuthorDate: 2021-06-30 13:27:46 +0000 Commit: Kristof Provost CommitDate: 2021-07-27 07:44:06 +0000 pf tests: ensure syncookie does not create state Test that with syncookies enabled pf does not create state for connections before the remote peer has replied to the SYN|ACK message. MFC after: 1 week Sponsored by: Modirum MDPay Differential Revision: https://reviews.freebsd.org/D31142 (cherry picked from commit 27ab791a55191c0b6503391d411303b042b41047) --- tests/sys/netpfil/pf/syncookie.sh | 49 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/tests/sys/netpfil/pf/syncookie.sh b/tests/sys/netpfil/pf/syncookie.sh index 7bd045249be6..49acd9fab11d 100644 --- a/tests/sys/netpfil/pf/syncookie.sh +++ b/tests/sys/netpfil/pf/syncookie.sh @@ -27,6 +27,8 @@ . $(atf_get_srcdir)/utils.subr +common_dir=$(atf_get_srcdir)/../common + atf_test_case "forward" "cleanup" forward_head() { @@ -78,7 +80,54 @@ forward_cleanup() pft_cleanup } +atf_test_case "nostate" "cleanup" +nostate_head() +{ + atf_set descr 'Ensure that we do not create until SYN|ACK' + atf_set require.user root + atf_set require.progs scapy +} + +nostate_body() +{ + pft_init + + epair=$(vnet_mkepair) + ifconfig ${epair}a 192.0.2.2/24 up + + vnet_mkjail alcatraz ${epair}b + jexec alcatraz ifconfig ${epair}b 192.0.2.1/24 up + + jexec alcatraz pfctl -e + pft_set_rules alcatraz \ + "set syncookies always" \ + "pass in" \ + "pass out" + + # Sanity check + atf_check -s exit:0 -o ignore ping -c 1 192.0.2.1 + + # Now syn flood to create many states + ${common_dir}/pft_synflood.py \ + --sendif ${epair}a \ + --to 192.0.2.2 \ + --count 20 + + states=$(jexec alcatraz pfctl -ss | grep tcp) + if [ -n "$states" ]; + then + echo "$states" + atf_fail "Found unexpected state" + fi +} + +nostate_cleanup() +{ + pft_cleanup +} + atf_init_test_cases() { atf_add_test_case "forward" + atf_add_test_case "nostate" } From owner-dev-commits-src-all@freebsd.org Tue Jul 27 13:35: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 4CF03660783; Tue, 27 Jul 2021 13:35: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 4GYyTX1QkVz4Tsk; Tue, 27 Jul 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 14C6132E8; Tue, 27 Jul 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 16RDZBip015586; Tue, 27 Jul 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 16RDZB9A015585; Tue, 27 Jul 2021 13:35:11 GMT (envelope-from git) Date: Tue, 27 Jul 2021 13:35:11 GMT Message-Id: <202107271335.16RDZB9A015585@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: 30c6d9821904 - main - linux: implement sigaltstack(2) on arm64 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: 30c6d982190482857883fc96eefafcc6fd769fa0 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, 27 Jul 2021 13:35:12 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=30c6d982190482857883fc96eefafcc6fd769fa0 commit 30c6d982190482857883fc96eefafcc6fd769fa0 Author: Edward Tomasz Napierala AuthorDate: 2021-07-26 23:43:09 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-07-27 13:34:49 +0000 linux: implement sigaltstack(2) on arm64 ... by making it machine-independent. Reviewed By: dchagin Sponsored By: EPSRC Differential Revision: https://reviews.freebsd.org/D31286 --- sys/amd64/linux/linux_machdep.c | 31 ------------------------------- sys/amd64/linux32/linux32_machdep.c | 28 ---------------------------- sys/arm64/linux/linux_machdep.c | 10 ---------- sys/compat/linux/linux_signal.c | 32 ++++++++++++++++++++++++++++++++ sys/i386/linux/linux.h | 2 +- sys/i386/linux/linux_machdep.c | 28 ---------------------------- sys/i386/linux/linux_sysvec.c | 4 ++-- 7 files changed, 35 insertions(+), 100 deletions(-) diff --git a/sys/amd64/linux/linux_machdep.c b/sys/amd64/linux/linux_machdep.c index b67bed524c79..5de27a7ee7d3 100644 --- a/sys/amd64/linux/linux_machdep.c +++ b/sys/amd64/linux/linux_machdep.c @@ -188,37 +188,6 @@ linux_pause(struct thread *td, struct linux_pause_args *args) return (kern_sigsuspend(td, sigmask)); } -int -linux_sigaltstack(struct thread *td, struct linux_sigaltstack_args *uap) -{ - stack_t ss, oss; - l_stack_t lss; - int error; - - memset(&lss, 0, sizeof(lss)); - LINUX_CTR2(sigaltstack, "%p, %p", uap->uss, uap->uoss); - - if (uap->uss != NULL) { - error = copyin(uap->uss, &lss, sizeof(l_stack_t)); - if (error) - return (error); - - ss.ss_sp = PTRIN(lss.ss_sp); - ss.ss_size = lss.ss_size; - ss.ss_flags = linux_to_bsd_sigaltstack(lss.ss_flags); - } - error = kern_sigaltstack(td, (uap->uss != NULL) ? &ss : NULL, - (uap->uoss != NULL) ? &oss : NULL); - if (!error && uap->uoss != NULL) { - lss.ss_sp = PTROUT(oss.ss_sp); - lss.ss_size = oss.ss_size; - lss.ss_flags = bsd_to_linux_sigaltstack(oss.ss_flags); - error = copyout(&lss, uap->uoss, sizeof(l_stack_t)); - } - - return (error); -} - int linux_arch_prctl(struct thread *td, struct linux_arch_prctl_args *args) { diff --git a/sys/amd64/linux32/linux32_machdep.c b/sys/amd64/linux32/linux32_machdep.c index 1cfda5d60e13..7ad05ec0de32 100644 --- a/sys/amd64/linux32/linux32_machdep.c +++ b/sys/amd64/linux32/linux32_machdep.c @@ -549,34 +549,6 @@ linux_pause(struct thread *td, struct linux_pause_args *args) return (kern_sigsuspend(td, sigmask)); } -int -linux_sigaltstack(struct thread *td, struct linux_sigaltstack_args *uap) -{ - stack_t ss, oss; - l_stack_t lss; - int error; - - if (uap->uss != NULL) { - error = copyin(uap->uss, &lss, sizeof(l_stack_t)); - if (error) - return (error); - - ss.ss_sp = PTRIN(lss.ss_sp); - ss.ss_size = lss.ss_size; - ss.ss_flags = linux_to_bsd_sigaltstack(lss.ss_flags); - } - error = kern_sigaltstack(td, (uap->uss != NULL) ? &ss : NULL, - (uap->uoss != NULL) ? &oss : NULL); - if (!error && uap->uoss != NULL) { - lss.ss_sp = PTROUT(oss.ss_sp); - lss.ss_size = oss.ss_size; - lss.ss_flags = bsd_to_linux_sigaltstack(oss.ss_flags); - error = copyout(&lss, uap->uoss, sizeof(l_stack_t)); - } - - return (error); -} - int linux_gettimeofday(struct thread *td, struct linux_gettimeofday_args *uap) { diff --git a/sys/arm64/linux/linux_machdep.c b/sys/arm64/linux/linux_machdep.c index 283562cc1028..bbd87eae28c4 100644 --- a/sys/arm64/linux/linux_machdep.c +++ b/sys/arm64/linux/linux_machdep.c @@ -55,7 +55,6 @@ LIN_SDT_PROVIDER_DECLARE(LINUX_DTRACE); /* DTrace probes */ LIN_SDT_PROBE_DEFINE0(machdep, linux_mmap2, todo); -LIN_SDT_PROBE_DEFINE0(machdep, linux_sigaltstack, todo); /* * LINUXTODO: deduplicate; linux_execve is common across archs, except that on @@ -123,15 +122,6 @@ linux_madvise(struct thread *td, struct linux_madvise_args *uap) return (linux_madvise_common(td, PTROUT(uap->addr), uap->len, uap->behav)); } -/* LINUXTODO: implement arm64 linux_sigaltstack */ -int -linux_sigaltstack(struct thread *td, struct linux_sigaltstack_args *uap) -{ - - LIN_SDT_PROBE0(machdep, linux_sigaltstack, todo); - return (EDOOFUS); -} - int linux_set_cloned_tls(struct thread *td, void *desc) { diff --git a/sys/compat/linux/linux_signal.c b/sys/compat/linux/linux_signal.c index 260352af5a54..0c71d510e0f2 100644 --- a/sys/compat/linux/linux_signal.c +++ b/sys/compat/linux/linux_signal.c @@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -184,6 +185,37 @@ linux_do_sigaction(struct thread *td, int linux_sig, l_sigaction_t *linux_nsa, return (0); } +int +linux_sigaltstack(struct thread *td, struct linux_sigaltstack_args *uap) +{ + stack_t ss, oss; + l_stack_t lss; + int error; + + memset(&lss, 0, sizeof(lss)); + LINUX_CTR2(sigaltstack, "%p, %p", uap->uss, uap->uoss); + + if (uap->uss != NULL) { + error = copyin(uap->uss, &lss, sizeof(l_stack_t)); + if (error != 0) + return (error); + + ss.ss_sp = PTRIN(lss.ss_sp); + ss.ss_size = lss.ss_size; + ss.ss_flags = linux_to_bsd_sigaltstack(lss.ss_flags); + } + error = kern_sigaltstack(td, (uap->uss != NULL) ? &ss : NULL, + (uap->uoss != NULL) ? &oss : NULL); + if (error == 0 && uap->uoss != NULL) { + lss.ss_sp = PTROUT(oss.ss_sp); + lss.ss_size = oss.ss_size; + lss.ss_flags = bsd_to_linux_sigaltstack(oss.ss_flags); + error = copyout(&lss, uap->uoss, sizeof(l_stack_t)); + } + + return (error); +} + #if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32)) int linux_signal(struct thread *td, struct linux_signal_args *args) diff --git a/sys/i386/linux/linux.h b/sys/i386/linux/linux.h index af7bb554b340..7fed468239a8 100644 --- a/sys/i386/linux/linux.h +++ b/sys/i386/linux/linux.h @@ -257,7 +257,7 @@ typedef struct { } l_sigaction_t; typedef struct { - void *ss_sp; + l_uintptr_t ss_sp; l_int ss_flags; l_size_t ss_size; } l_stack_t; diff --git a/sys/i386/linux/linux_machdep.c b/sys/i386/linux/linux_machdep.c index b2628738728f..1a51b7954063 100644 --- a/sys/i386/linux/linux_machdep.c +++ b/sys/i386/linux/linux_machdep.c @@ -517,34 +517,6 @@ linux_pause(struct thread *td, struct linux_pause_args *args) return (kern_sigsuspend(td, sigmask)); } -int -linux_sigaltstack(struct thread *td, struct linux_sigaltstack_args *uap) -{ - stack_t ss, oss; - l_stack_t lss; - int error; - - if (uap->uss != NULL) { - error = copyin(uap->uss, &lss, sizeof(l_stack_t)); - if (error) - return (error); - - ss.ss_sp = lss.ss_sp; - ss.ss_size = lss.ss_size; - ss.ss_flags = linux_to_bsd_sigaltstack(lss.ss_flags); - } - error = kern_sigaltstack(td, (uap->uss != NULL) ? &ss : NULL, - (uap->uoss != NULL) ? &oss : NULL); - if (!error && uap->uoss != NULL) { - lss.ss_sp = oss.ss_sp; - lss.ss_size = oss.ss_size; - lss.ss_flags = bsd_to_linux_sigaltstack(oss.ss_flags); - error = copyout(&lss, uap->uoss, sizeof(l_stack_t)); - } - - return (error); -} - int linux_set_thread_area(struct thread *td, struct linux_set_thread_area_args *args) { diff --git a/sys/i386/linux/linux_sysvec.c b/sys/i386/linux/linux_sysvec.c index 1fcc1b6eb5a0..f0f70c12e073 100644 --- a/sys/i386/linux/linux_sysvec.c +++ b/sys/i386/linux/linux_sysvec.c @@ -441,7 +441,7 @@ linux_rt_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask) frame.sf_sc.uc_flags = 0; /* XXX ??? */ frame.sf_sc.uc_link = NULL; /* XXX ??? */ - frame.sf_sc.uc_stack.ss_sp = td->td_sigstk.ss_sp; + frame.sf_sc.uc_stack.ss_sp = PTROUT(td->td_sigstk.ss_sp); frame.sf_sc.uc_stack.ss_size = td->td_sigstk.ss_size; frame.sf_sc.uc_stack.ss_flags = (td->td_pflags & TDP_ALTSTACK) ? ((oonstack) ? LINUX_SS_ONSTACK : 0) : LINUX_SS_DISABLE; @@ -751,7 +751,7 @@ linux_rt_sigreturn(struct thread *td, struct linux_rt_sigreturn_args *args) /* Call sigaltstack & ignore results. */ lss = &uc.uc_stack; - ss.ss_sp = lss->ss_sp; + ss.ss_sp = PTRIN(lss->ss_sp); ss.ss_size = lss->ss_size; ss.ss_flags = linux_to_bsd_sigaltstack(lss->ss_flags); From owner-dev-commits-src-all@freebsd.org Tue Jul 27 15:01: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 44EE3661887; Tue, 27 Jul 2021 15:01: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 4GZ0Nf1XBmz4cMs; Tue, 27 Jul 2021 15:01: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 11D094D92; Tue, 27 Jul 2021 15:01: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 16RF1627031743; Tue, 27 Jul 2021 15:01:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RF16oE031742; Tue, 27 Jul 2021 15:01:06 GMT (envelope-from git) Date: Tue, 27 Jul 2021 15:01:06 GMT Message-Id: <202107271501.16RF16oE031742@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: 366d68f28379 - main - LinuxKPI: add module_pci_driver() and pci_alloc_irq_vectors() 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: 366d68f283793df22392f9fb992c5029dfc293bb 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, 27 Jul 2021 15:01:06 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=366d68f283793df22392f9fb992c5029dfc293bb commit 366d68f283793df22392f9fb992c5029dfc293bb Author: Bjoern A. Zeeb AuthorDate: 2021-07-01 13:33:01 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-27 14:57:23 +0000 LinuxKPI: add module_pci_driver() and pci_alloc_irq_vectors() Add the two new functions needed by rtw88 to register the driver and handle the module bits as well as a version of pci_alloc_irq_vectors() for what is needed. Reviewed by: hselasky MFC after: 10 days Differential Revision: https://reviews.freebsd.org/D30981 --- sys/compat/linuxkpi/common/include/linux/pci.h | 59 ++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/pci.h b/sys/compat/linuxkpi/common/include/linux/pci.h index 4784799d82b5..a80e6965915d 100644 --- a/sys/compat/linuxkpi/common/include/linux/pci.h +++ b/sys/compat/linuxkpi/common/include/linux/pci.h @@ -186,6 +186,10 @@ typedef int pci_power_t; #define PCI_EXT_CAP_ID_ERR PCIZ_AER +#define PCI_IRQ_LEGACY 0x01 +#define PCI_IRQ_MSI 0x02 +#define PCI_IRQ_MSIX 0x04 + struct pci_dev; struct pci_driver { @@ -221,6 +225,25 @@ extern spinlock_t pci_lock; #define __devexit_p(x) x +#define module_pci_driver(_driver) \ + \ +static inline int \ +_pci_init(void) \ +{ \ + \ + return (linux_pci_register_driver(&_driver)); \ +} \ + \ +static inline void \ +_pci_exit(void) \ +{ \ + \ + linux_pci_unregister_driver(&_driver); \ +} \ + \ +module_init(_pci_init); \ +module_exit(_pci_exit) + /* * If we find drivers accessing this from multiple KPIs we may have to * refcount objects of this structure. @@ -817,6 +840,42 @@ pci_enable_msi(struct pci_dev *pdev) return (0); } +static inline int +pci_alloc_irq_vectors(struct pci_dev *pdev, int minv, int maxv, + unsigned int flags) +{ + int error; + + if (flags & PCI_IRQ_MSIX) { + struct msix_entry *entries; + int i; + + entries = kcalloc(maxv, sizeof(*entries), GFP_KERNEL); + if (entries == NULL) { + error = -ENOMEM; + goto out; + } + for (i = 0; i < maxv; ++i) + entries[i].entry = i; + error = pci_enable_msix(pdev, entries, maxv); +out: + kfree(entries); + if (error == 0 && pdev->msix_enabled) + return (pdev->dev.irq_end - pdev->dev.irq_start); + } + if (flags & PCI_IRQ_MSI) { + error = pci_enable_msi(pdev); + if (error == 0 && pdev->msi_enabled) + return (pdev->dev.irq_end - pdev->dev.irq_start); + } + if (flags & PCI_IRQ_LEGACY) { + if (pdev->irq) + return (1); + } + + return (-EINVAL); +} + static inline int pci_channel_offline(struct pci_dev *pdev) { From owner-dev-commits-src-all@freebsd.org Tue Jul 27 15:03: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 1BA5F6612E2; Tue, 27 Jul 2021 15:03: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 4GZ0RH09Ryz4d34; Tue, 27 Jul 2021 15:03: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 E26804CAD; Tue, 27 Jul 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 16RF3M0u035973; Tue, 27 Jul 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 16RF3MC6035972; Tue, 27 Jul 2021 15:03:22 GMT (envelope-from git) Date: Tue, 27 Jul 2021 15:03:22 GMT Message-Id: <202107271503.16RF3MC6035972@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: b9d984e2c5dc - main - LinuxKPI: add nexthdr definitions for IPv6 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: b9d984e2c5dcef277c49a576ccefada6519d9b53 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, 27 Jul 2021 15:03:23 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=b9d984e2c5dcef277c49a576ccefada6519d9b53 commit b9d984e2c5dcef277c49a576ccefada6519d9b53 Author: Bjoern A. Zeeb AuthorDate: 2021-07-27 13:39:15 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-27 15:00:21 +0000 LinuxKPI: add nexthdr definitions for IPv6 Add the nexthdr definitions for IPv6 which are used by wireless drivers and were previously placed in an 80211 header file by accident. Obtained from: bz_iwlwifi Sponsored by: The FreeBSD Foundation Reviewed by: hselasky MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D31321 --- sys/compat/linuxkpi/common/include/net/ipv6.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/net/ipv6.h b/sys/compat/linuxkpi/common/include/net/ipv6.h index 37c30ed6e793..dfe77ef1c6ed 100644 --- a/sys/compat/linuxkpi/common/include/net/ipv6.h +++ b/sys/compat/linuxkpi/common/include/net/ipv6.h @@ -38,6 +38,11 @@ #define IPV6_DEFAULT_HOPLIMIT 64 +#define NEXTHDR_HOP IPPROTO_HOPOPTS +#define NEXTHDR_ROUTING IPPROTO_ROUTING +#define NEXTHDR_NONE IPPROTO_NONE +#define NEXTHDR_DEST IPPROTO_DSTOPTS + #define ipv6_addr_loopback(addr) IN6_IS_ADDR_LOOPBACK(addr) #define ipv6_addr_any(addr) IN6_IS_ADDR_UNSPECIFIED(addr) From owner-dev-commits-src-all@freebsd.org Tue Jul 27 15:07: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 9829D661B80; Tue, 27 Jul 2021 15:07: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 4GZ0X23stBz4d88; Tue, 27 Jul 2021 15:07: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 6CEC84E90; Tue, 27 Jul 2021 15:07: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 16RF7UdV036352; Tue, 27 Jul 2021 15:07:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RF7UgO036351; Tue, 27 Jul 2021 15:07:30 GMT (envelope-from git) Date: Tue, 27 Jul 2021 15:07:30 GMT Message-Id: <202107271507.16RF7UgO036351@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: ea4dea83944a - main - LinuxKPI: add sign_extend32() 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: ea4dea83944ac6334d31e0364dd674eda250adde 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, 27 Jul 2021 15:07:30 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=ea4dea83944ac6334d31e0364dd674eda250adde commit ea4dea83944ac6334d31e0364dd674eda250adde Author: Bjoern A. Zeeb AuthorDate: 2021-07-01 13:14:19 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-27 15:03:38 +0000 LinuxKPI: add sign_extend32() Add sign_extend32() replicating the 64 version. This is needed by the rtw88 driver. MFC after: 10 days Reviewed by: imp, emaste, hselasky Differential Revision: https://reviews.freebsd.org/D30979 --- sys/compat/linuxkpi/common/include/linux/bitops.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/bitops.h b/sys/compat/linuxkpi/common/include/linux/bitops.h index 49bfc4cc7414..0d7ab376e02d 100644 --- a/sys/compat/linuxkpi/common/include/linux/bitops.h +++ b/sys/compat/linuxkpi/common/include/linux/bitops.h @@ -412,4 +412,12 @@ sign_extend64(uint64_t value, int index) return ((int64_t)(value << shift) >> shift); } +static inline uint32_t +sign_extend32(uint32_t value, int index) +{ + uint8_t shift = 31 - index; + + return ((int32_t)(value << shift) >> shift); +} + #endif /* _LINUX_BITOPS_H_ */ From owner-dev-commits-src-all@freebsd.org Tue Jul 27 15:33: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 AB4EB661BD9; Tue, 27 Jul 2021 15:33: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 4GZ15d4FfXz4fWZ; Tue, 27 Jul 2021 15:33: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 7AC065414; Tue, 27 Jul 2021 15:33: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 16RFX9m9075987; Tue, 27 Jul 2021 15:33:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RFX9rT075986; Tue, 27 Jul 2021 15:33:09 GMT (envelope-from git) Date: Tue, 27 Jul 2021 15:33:09 GMT Message-Id: <202107271533.16RFX9rT075986@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: 4e860bd5da14 - main - pf tests: make killstate:match more robust 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: 4e860bd5da1423aac9aed0541c484ebf9c1d1621 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, 27 Jul 2021 15:33:09 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=4e860bd5da1423aac9aed0541c484ebf9c1d1621 commit 4e860bd5da1423aac9aed0541c484ebf9c1d1621 Author: Kristof Provost AuthorDate: 2021-07-27 13:31:00 +0000 Commit: Kristof Provost CommitDate: 2021-07-27 13:32:48 +0000 pf tests: make killstate:match more robust Only lists the states relevant to the connection we're killing. Sometimes there are IPv6 related states (due to the usual IPv6 background traffic of router solicitations, DAD, ...) that causes us to think we failed to kill the state, which in turn caused the test to fail intermittently. MFC after: 3 days Sponsored by: Rubicon Communications, LLC ("Netgate") --- tests/sys/netpfil/pf/killstate.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/sys/netpfil/pf/killstate.sh b/tests/sys/netpfil/pf/killstate.sh index f53ede8c7578..e140ee4d144d 100644 --- a/tests/sys/netpfil/pf/killstate.sh +++ b/tests/sys/netpfil/pf/killstate.sh @@ -426,7 +426,7 @@ match_body() wait_for_state alcatraz 192.0.2.1 # Expect two states - states=$(jexec alcatraz pfctl -s s | wc -l) + states=$(jexec alcatraz pfctl -s s | grep 192.0.2.1 | wc -l) if [ $states -ne 2 ] ; then atf_fail "Expected two states, found $states" @@ -434,7 +434,7 @@ match_body() # If we don't kill the matching NAT state one should be left jexec alcatraz pfctl -k 192.0.2.1 - states=$(jexec alcatraz pfctl -s s | wc -l) + states=$(jexec alcatraz pfctl -s s | grep 192.0.2.1 | wc -l) if [ $states -ne 1 ] ; then atf_fail "Expected one states, found $states" @@ -448,7 +448,7 @@ match_body() # Kill matching states, expect all of them to be gone jexec alcatraz pfctl -M -k 192.0.2.1 - states=$(jexec alcatraz pfctl -s s | wc -l) + states=$(jexec alcatraz pfctl -s s | grep 192.0.2.1 | wc -l) if [ $states -ne 0 ] ; then atf_fail "Expected zero states, found $states" From owner-dev-commits-src-all@freebsd.org Tue Jul 27 16:06: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 EEB6A662A13; Tue, 27 Jul 2021 16:06: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 4GZ1r2684vz4gp3; Tue, 27 Jul 2021 16:06: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 ACEE15B2A; Tue, 27 Jul 2021 16:06: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 16RG6Q9B016951; Tue, 27 Jul 2021 16:06:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RG6Q9j016950; Tue, 27 Jul 2021 16:06:26 GMT (envelope-from git) Date: Tue, 27 Jul 2021 16:06:26 GMT Message-Id: <202107271606.16RG6Q9j016950@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: a573243370d3 - main - netdump: Fix leaking debugnet state on errors. 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: a573243370d3f4ffad81c740591004851f2beb45 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, 27 Jul 2021 16:06:27 -0000 The branch main has been updated by bdrewery: URL: https://cgit.FreeBSD.org/src/commit/?id=a573243370d3f4ffad81c740591004851f2beb45 commit a573243370d3f4ffad81c740591004851f2beb45 Author: Bryan Drewery AuthorDate: 2021-07-26 23:27:07 +0000 Commit: Bryan Drewery CommitDate: 2021-07-27 16:06:23 +0000 netdump: Fix leaking debugnet state on errors. Reviewed by: cem, markj Sponsored by: Dell EMC Differential Revision: https://reviews.freebsd.org/D31319 --- sys/netinet/netdump/netdump_client.c | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/sys/netinet/netdump/netdump_client.c b/sys/netinet/netdump/netdump_client.c index 06a833c20c07..2669ec879d75 100644 --- a/sys/netinet/netdump/netdump_client.c +++ b/sys/netinet/netdump/netdump_client.c @@ -85,6 +85,7 @@ __FBSDID("$FreeBSD$"); printf(("%s: " f), __func__, ## __VA_ARGS__); \ } while (0) +static void netdump_cleanup(void); static int netdump_configure(struct diocskerneldump_arg *, struct thread *); static int netdump_dumper(void *priv __unused, void *virtual, @@ -254,12 +255,13 @@ netdump_dumper(void *priv __unused, void *virtual, printf("failed to close the transaction\n"); else printf("\nnetdump finished.\n"); - debugnet_free(nd_conf.nd_pcb); - nd_conf.nd_pcb = NULL; + netdump_cleanup(); return (0); } - if (length > sizeof(nd_buf)) + if (length > sizeof(nd_buf)) { + netdump_cleanup(); return (ENOSPC); + } if (nd_conf.nd_buf_len + length > sizeof(nd_buf) || (nd_conf.nd_buf_len != 0 && nd_conf.nd_tx_off + @@ -267,6 +269,7 @@ netdump_dumper(void *priv __unused, void *virtual, error = netdump_flush_buf(); if (error != 0) { dump_failed = 1; + netdump_cleanup(); return (error); } nd_conf.nd_tx_off = offset; @@ -344,20 +347,37 @@ netdump_write_headers(struct dumperinfo *di, struct kerneldumpheader *kdh, error = netdump_flush_buf(); if (error != 0) - return (error); + goto out; memcpy(nd_buf, kdh, sizeof(*kdh)); error = debugnet_send(nd_conf.nd_pcb, NETDUMP_KDH, nd_buf, sizeof(*kdh), NULL); if (error == 0 && keysize > 0) { - if (keysize > sizeof(nd_buf)) - return (EINVAL); + if (keysize > sizeof(nd_buf)) { + error = EINVAL; + goto out; + } memcpy(nd_buf, key, keysize); error = debugnet_send(nd_conf.nd_pcb, NETDUMP_EKCD_KEY, nd_buf, keysize, NULL); } +out: + if (error != 0) + netdump_cleanup(); return (error); } +/* + * Cleanup routine for a possibly failed netdump. + */ +static void +netdump_cleanup(void) +{ + if (nd_conf.nd_pcb != NULL) { + debugnet_free(nd_conf.nd_pcb); + nd_conf.nd_pcb = NULL; + } +} + /*- * KLD specific code. */ From owner-dev-commits-src-all@freebsd.org Tue Jul 27 16:49: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 F3B6D663429; Tue, 27 Jul 2021 16:49: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 4GZ2pG6LrYz4mCY; Tue, 27 Jul 2021 16:49: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 BE4855F61; Tue, 27 Jul 2021 16:49: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 16RGnwip070247; Tue, 27 Jul 2021 16:49:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RGnwV1070246; Tue, 27 Jul 2021 16:49:58 GMT (envelope-from git) Date: Tue, 27 Jul 2021 16:49:58 GMT Message-Id: <202107271649.16RGnwV1070246@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alan Somers Subject: git: ba99ff623b80 - stable/12 - fusefs: improve warnings about buggy FUSE servers MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: ba99ff623b80d3b8173f6bd08758bc43626ea6d9 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, 27 Jul 2021 16:49:59 -0000 The branch stable/12 has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=ba99ff623b80d3b8173f6bd08758bc43626ea6d9 commit ba99ff623b80d3b8173f6bd08758bc43626ea6d9 Author: Alan Somers AuthorDate: 2021-06-15 20:24:05 +0000 Commit: Alan Somers CommitDate: 2021-07-27 16:20:46 +0000 fusefs: improve warnings about buggy FUSE servers The fusefs driver will print warning messages about FUSE servers that commit protocol violations. Previously it would print those warnings on every violation, but that could spam the console. Now it will print each warning no more than once per lifetime of the mount. There is also now a dtrace probe for each violation. Sponsored by: Axcient Reviewed by: emaste, pfg Differential Revision: https://reviews.freebsd.org/D30780 (cherry picked from commit 0b9a5c6fa1733e600dcdb3b9df3b3d0ad5996920) --- sys/fs/fuse/fuse_internal.c | 19 ++++++++----------- sys/fs/fuse/fuse_io.c | 8 ++++---- sys/fs/fuse/fuse_ipc.c | 14 ++++++++++++++ sys/fs/fuse/fuse_ipc.h | 8 ++++++++ sys/fs/fuse/fuse_vfsops.c | 23 ++++++++++++++++++++--- sys/fs/fuse/fuse_vnops.c | 18 +++++++++--------- 6 files changed, 63 insertions(+), 27 deletions(-) diff --git a/sys/fs/fuse/fuse_internal.c b/sys/fs/fuse/fuse_internal.c index 57ff01cd70b7..f70533b54028 100644 --- a/sys/fs/fuse/fuse_internal.c +++ b/sys/fs/fuse/fuse_internal.c @@ -871,9 +871,6 @@ fuse_internal_forget_send(struct mount *mp, fdisp_destroy(&fdi); } -SDT_PROBE_DEFINE2(fusefs, , internal, getattr_cache_incoherent, - "struct vnode*", "struct fuse_attr_out*"); - /* Fetch the vnode's attributes from the daemon*/ int fuse_internal_do_getattr(struct vnode *vp, struct vattr *vap, @@ -923,14 +920,14 @@ fuse_internal_do_getattr(struct vnode *vp, struct vattr *vap, * The server changed the file's size even though we had it * cached! That's a server bug. */ - SDT_PROBE2(fusefs, , internal, getattr_cache_incoherent, vp, - fao); - printf("%s: cache incoherent on %s! " - "Buggy FUSE server detected. To prevent data corruption, " - "disable the data cache by mounting with -o direct_io, or " - "as directed otherwise by your FUSE server's " - "documentation\n", __func__, - vnode_mount(vp)->mnt_stat.f_mntonname); + struct mount *mp = vnode_mount(vp); + struct fuse_data *data = fuse_get_mpdata(mp); + + fuse_warn(data, FSESS_WARN_CACHE_INCOHERENT, + "cache incoherent! " + "To prevent data corruption, disable the data cache " + "by mounting with -o direct_io, or as directed " + "otherwise by your FUSE server's documentation."); int iosize = fuse_iosize(vp); v_inval_buf_range(vp, 0, INT64_MAX, iosize); } diff --git a/sys/fs/fuse/fuse_io.c b/sys/fs/fuse/fuse_io.c index ea599e9aab34..5769ac8eccd1 100644 --- a/sys/fs/fuse/fuse_io.c +++ b/sys/fs/fuse/fuse_io.c @@ -616,16 +616,16 @@ retry: fvdat->flag &= ~FN_SIZECHANGE; if (diff < 0) { - printf("WARNING: misbehaving FUSE filesystem " - "wrote more data than we provided it\n"); + fuse_warn(data, FSESS_WARN_WROTE_LONG, + "wrote more data than we provided it."); err = EINVAL; break; } else if (diff > 0) { /* Short write */ if (!direct_io) { - printf("WARNING: misbehaving FUSE filesystem: " + fuse_warn(data, FSESS_WARN_SHORT_WRITE, "short writes are only allowed with " - "direct_io\n"); + "direct_io."); } if (ioflag & IO_DIRECT) { /* Return early */ diff --git a/sys/fs/fuse/fuse_ipc.c b/sys/fs/fuse/fuse_ipc.c index 514f7857faf5..e3be63b9d6d4 100644 --- a/sys/fs/fuse/fuse_ipc.c +++ b/sys/fs/fuse/fuse_ipc.c @@ -1095,3 +1095,17 @@ fuse_ipc_destroy(void) counter_u64_free(fuse_ticket_count); uma_zdestroy(ticket_zone); } + +SDT_PROBE_DEFINE3(fusefs,, ipc, warn, "struct fuse_data*", "unsigned", "char*"); +void +fuse_warn(struct fuse_data *data, unsigned flag, const char *msg) +{ + SDT_PROBE3(fusefs, , ipc, warn, data, flag, msg); + if (!(data->dataflags & flag)) { + printf("WARNING: FUSE protocol violation for server mounted at " + "%s: %s " + "This warning will not be repeated.\n", + data->mp->mnt_stat.f_mntonname, msg); + data->dataflags |= flag; + } +} diff --git a/sys/fs/fuse/fuse_ipc.h b/sys/fs/fuse/fuse_ipc.h index bedecefd157a..8e041529e119 100644 --- a/sys/fs/fuse/fuse_ipc.h +++ b/sys/fs/fuse/fuse_ipc.h @@ -231,6 +231,11 @@ struct fuse_data { #define FSESS_POSIX_LOCKS 0x2000 /* daemon supports POSIX locks */ #define FSESS_EXPORT_SUPPORT 0x10000 /* daemon supports NFS-style lookups */ #define FSESS_INTR 0x20000 /* interruptible mounts */ +#define FSESS_WARN_SHORT_WRITE 0x40000 /* Short write without direct_io */ +#define FSESS_WARN_WROTE_LONG 0x80000 /* Wrote more data than provided */ +#define FSESS_WARN_LSEXTATTR_LONG 0x100000 /* Returned too many extattrs */ +#define FSESS_WARN_CACHE_INCOHERENT 0x200000 /* Read cache incoherent */ +#define FSESS_WARN_WB_CACHE_INCOHERENT 0x400000 /* WB cache incoherent */ #define FSESS_MNTOPTS_MASK ( \ FSESS_DAEMON_CAN_SPY | FSESS_PUSH_SYMLINKS_IN | \ FSESS_DEFAULT_PERMISSIONS | FSESS_INTR) @@ -365,6 +370,9 @@ fuse_libabi_geq(struct fuse_data *data, uint32_t abi_maj, uint32_t abi_min) data->fuse_libabi_minor >= abi_min)); } +/* Print msg as a warning to the console, but no more than once per session */ +void fuse_warn(struct fuse_data *data, unsigned flag, const char *msg); + struct fuse_data *fdata_alloc(struct cdev *dev, struct ucred *cred); void fdata_trydestroy(struct fuse_data *data); void fdata_set_dead(struct fuse_data *data); diff --git a/sys/fs/fuse/fuse_vfsops.c b/sys/fs/fuse/fuse_vfsops.c index a31b95df3318..a4a0ce3b86d0 100644 --- a/sys/fs/fuse/fuse_vfsops.c +++ b/sys/fs/fuse/fuse_vfsops.c @@ -590,9 +590,26 @@ fuse_vfsop_vget(struct mount *mp, ino_t ino, int flags, struct vnode **vpp) if (vnode_isreg(*vpp) && filesize != fvdat->cached_attrs.va_size && fvdat->flag & FN_SIZECHANGE) { - printf("%s: WB cache incoherent on %s!\n", __func__, - vnode_mount(*vpp)->mnt_stat.f_mntonname); - + if (data->cache_mode == fuse_data_cache_mode) { + const char *msg; + + if (fuse_libabi_geq(data, 7, 23)) { + msg = "writeback cache incoherent!." + "To prevent data corruption, disable " + "the writeback cache according to your " + "FUSE server's documentation."; + } else { + msg = "writeback cache incoherent!." + "To prevent data corruption, disable " + "the writeback cache by setting " + "vfs.fusefs.data_cache_mode to 0 or 1."; + } + fuse_warn(data, FSESS_WARN_WB_CACHE_INCOHERENT, msg); + } else { + /* If we get here, it's likely a fusefs kernel bug */ + printf("%s: WB cache incoherent on %s!\n", __func__, + vnode_mount(*vpp)->mnt_stat.f_mntonname); + } fvdat->flag &= ~FN_SIZECHANGE; } diff --git a/sys/fs/fuse/fuse_vnops.c b/sys/fs/fuse/fuse_vnops.c index d30fc32d1dc5..1c1ac7680f0e 100644 --- a/sys/fs/fuse/fuse_vnops.c +++ b/sys/fs/fuse/fuse_vnops.c @@ -967,8 +967,6 @@ fuse_lookup_alloc(struct mount *mp, void *arg, int lkflags, struct vnode **vpp) SDT_PROBE_DEFINE3(fusefs, , vnops, cache_lookup, "int", "struct timespec*", "struct timespec*"); -SDT_PROBE_DEFINE2(fusefs, , vnops, lookup_cache_incoherent, - "struct vnode*", "struct fuse_entry_out*"); /* struct vnop_lookup_args { struct vnodeop_desc *a_desc; @@ -1177,20 +1175,19 @@ fuse_vnop_lookup(struct vop_lookup_args *ap) ((vap = VTOVA(vp)) && filesize != vap->va_size))) { - SDT_PROBE2(fusefs, , vnops, lookup_cache_incoherent, vp, feo); fvdat->flag &= ~FN_SIZECHANGE; /* * The server changed the file's size even * though we had it cached, or had dirty writes * in the WB cache! */ - printf("%s: cache incoherent on %s! " - "Buggy FUSE server detected. To prevent " + fuse_warn(data, FSESS_WARN_CACHE_INCOHERENT, + "cache incoherent! " + "To prevent " "data corruption, disable the data cache " "by mounting with -o direct_io, or as " "directed otherwise by your FUSE server's " - "documentation\n", __func__, - vnode_mount(vp)->mnt_stat.f_mntonname); + "documentation."); int iosize = fuse_iosize(vp); v_inval_buf_range(vp, 0, INT64_MAX, iosize); } @@ -2357,9 +2354,12 @@ fuse_vnop_listextattr(struct vop_listextattr_args *ap) linux_list = fdi.answ; /* FUSE doesn't allow the server to return more data than requested */ if (fdi.iosize > linux_list_len) { - printf("WARNING: FUSE protocol violation. Server returned " + struct fuse_data *data = fuse_get_mpdata(mp); + + fuse_warn(data, FSESS_WARN_LSEXTATTR_LONG, + "server returned " "more extended attribute data than requested; " - "should've returned ERANGE instead"); + "should've returned ERANGE instead."); } else { /* But returning less data is fine */ linux_list_len = fdi.iosize; From owner-dev-commits-src-all@freebsd.org Tue Jul 27 16:55: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 00F8866382A; Tue, 27 Jul 2021 16:55: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 4GZ2x36dRcz4nJP; Tue, 27 Jul 2021 16:55: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 C1A73661C; Tue, 27 Jul 2021 16:55: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 16RGtpxg082938; Tue, 27 Jul 2021 16:55:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RGtpUm082937; Tue, 27 Jul 2021 16:55:51 GMT (envelope-from git) Date: Tue, 27 Jul 2021 16:55:51 GMT Message-Id: <202107271655.16RGtpUm082937@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: fe787aa3b28b - main - calendars: fix tabs vs space indentation 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: fe787aa3b28bb2dc7b64b08ee172b1422ee386a2 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, 27 Jul 2021 16:55:52 -0000 The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=fe787aa3b28bb2dc7b64b08ee172b1422ee386a2 commit fe787aa3b28bb2dc7b64b08ee172b1422ee386a2 Author: Baptiste Daroussin AuthorDate: 2021-07-27 16:55:31 +0000 Commit: Baptiste Daroussin CommitDate: 2021-07-27 16:55:31 +0000 calendars: fix tabs vs space indentation --- usr.bin/calendar/calendars/calendar.freebsd | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/usr.bin/calendar/calendars/calendar.freebsd b/usr.bin/calendar/calendars/calendar.freebsd index 88bde011d3c7..c813f99b3664 100644 --- a/usr.bin/calendar/calendars/calendar.freebsd +++ b/usr.bin/calendar/calendars/calendar.freebsd @@ -83,8 +83,8 @@ 02/15 Hiren Panchasara born in Ahmedabad, Gujarat, India, 1984 02/15 Rajesh Kumar M A born in Erode, Tamilnadu, India, 1986 02/16 Justin Hibbits born in Toledo, Ohio, United States, 1983 -02/16 Tobias Christian Berner born in Bern, Switzerland, 1985 -02/18 Christoph Moench-Tegeder born in Hannover, Niedersachsen, Germany, 1980 +02/16 Tobias Christian Berner born in Bern, Switzerland, 1985 +02/18 Christoph Moench-Tegeder born in Hannover, Niedersachsen, Germany, 1980 02/19 Murray Stokely born in Jacksonville, Florida, United States, 1979 02/20 Anders Nordby born in Oslo, Norway, 1976 02/21 Alex Samorukov born in Kyiv, Ukraine, 1981 @@ -220,7 +220,7 @@ 05/23 Munechika Sumikawa born in Osaka, Osaka, Japan, 1972 05/24 Duncan McLennan Barclay born in London, Middlesex, United Kingdom, 1970 05/24 Oliver Lehmann born in Karlsburg, Germany, 1981 -05/25 Pawel Pekala born in Swidnica, Poland, 1980 +05/25 Pawel Pekala born in Swidnica, Poland, 1980 05/25 Tom Rhodes born in Ellwood City, Pennsylvania, United States, 1981 05/25 Roman Divacky born in Brno, Czech Republic, 1983 05/26 Jim Pirzyk born in Chicago, Illinois, United States, 1968 @@ -228,7 +228,7 @@ 05/27 Ollivier Robert born in Paris, France, 1967 05/29 Wilko Bulte born in Arnhem, the Netherlands, 1965 05/29 Seigo Tanimura born in Kitakyushu, Fukuoka, Japan, 1976 -05/30 Wen Heping born in Xiangxiang, Hunan, China, 1970 +05/30 Wen Heping born in Xiangxiang, Hunan, China, 1970 05/31 Ville Skytta born in Helsinki, Finland, 1974 06/02 Jean-Marc Zucconi born in Pontarlier, France, 1954 06/02 Alexander Botero-Lowry born in Austin, Texas, United States, 1986 From owner-dev-commits-src-all@freebsd.org Tue Jul 27 16:57: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 434846638C6; Tue, 27 Jul 2021 16:57: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 4GZ2yS1KkPz4nCj; Tue, 27 Jul 2021 16:57: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 15784661D; Tue, 27 Jul 2021 16:57: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 16RGv4kw083125; Tue, 27 Jul 2021 16:57:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RGv3Kb083124; Tue, 27 Jul 2021 16:57:03 GMT (envelope-from git) Date: Tue, 27 Jul 2021 16:57:03 GMT Message-Id: <202107271657.16RGv3Kb083124@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: dcd882f30236 - main - pci_vendors: update to 2021-07-25 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: dcd882f30236fdac6ce7f42129462d72a64daf0c 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, 27 Jul 2021 16:57:04 -0000 The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=dcd882f30236fdac6ce7f42129462d72a64daf0c commit dcd882f30236fdac6ce7f42129462d72a64daf0c Author: Baptiste Daroussin AuthorDate: 2021-07-27 16:56:39 +0000 Commit: Baptiste Daroussin CommitDate: 2021-07-27 16:56:39 +0000 pci_vendors: update to 2021-07-25 --- share/misc/pci_vendors | 431 +++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 396 insertions(+), 35 deletions(-) diff --git a/share/misc/pci_vendors b/share/misc/pci_vendors index 9deb7293e596..3e17bc47bf5f 100644 --- a/share/misc/pci_vendors +++ b/share/misc/pci_vendors @@ -1,8 +1,8 @@ # # List of PCI ID's # -# Version: 2021.05.04 -# Date: 2021-05-04 03:15:01 +# Version: 2021.07.25 +# Date: 2021-07-25 03:15:02 # # Maintained by Albert Pool, Martin Mares, and other volunteers from # the PCI ID Project at https://pci-ids.ucw.cz/. @@ -683,6 +683,32 @@ 1bd4 0026 12G SAS3008IT RACK 1bd4 0027 12G SAS3008IMR RACK 1bd4 0028 12G SAS3008IR RACK + 00a5 Fusion-MPT 24GSAS/PCIe SAS40xx + 1000 4600 MegaRAID 9670W-16i Tri-Mode Storage Adapter + 1000 4610 MegaRAID 9670-24i Tri-Mode Storage Adapter + 1000 4620 MegaRAID 9660-16i Tri-Mode Storage Adapter + 1000 4630 MegaRAID 9660-8i8e Tri-Mode Storage Adapter + 1000 4640 eHBA 9600W-16i Tri-Mode Storage Adapter + 1000 4650 eHBA 9600W-16e Tri-Mode Storage Adapter + 1000 4660 eHBA 9600-24i Tri-Mode Storage Adapter + 1000 4670 eHBA 9600-16i Tri-Mode Storage Adapter + 1000 4680 eHBA 9600-16e Tri-Mode Storage Adapter + 1000 4690 eHBA 9620-16i Tri-Mode Storage Adapter + 1000 46a0 MegaRAID 9660-24i Tri-Mode Storage Adapter + 1000 46b0 MegaRAID 9665W-16i Tri-Mode Storage Adapter + 1000 46c0 MegaRAID 9680W-16e Tri-Mode Storage Adapter + 1028 2114 PERC H965 Adapter + 1028 2115 PERC H965 Front + 1028 2117 PERC H965 MX + 1028 213a PERC H965e Adapter + 1028 213b PERC H765 Adapter + 1028 213c PERC H765 Front + 1028 213d PERC H765N Front + 1028 213e PERC H765 MX + 1028 213f PERC H365 Adapter + 1028 2140 PERC H365 Front + 1028 2141 PERC H360 MX + 1028 2142 HBA 465e Adapter 00ab SAS3516 Fusion-MPT Tri-Mode RAID On Chip (ROC) # 8 Internal and 8 External port channel 9400 HBA 1000 3040 HBA 9400-8i8e @@ -715,12 +741,18 @@ 00c2 SAS3324 PCI-Express Fusion-MPT SAS-3 00c3 SAS3324 PCI-Express Fusion-MPT SAS-3 00c4 SAS3224 PCI-Express Fusion-MPT SAS-3 +# SAS 9305 16 internal port HBA + 1000 3190 SAS9305-16i +# SAS 9305 24 internal port HBA + 1000 31a0 SAS9305-24i 1170 0002 SAS3224 PCI Express to 12Gb HBA MEZZ CARD 00c5 SAS3316 PCI-Express Fusion-MPT SAS-3 00c6 SAS3316 PCI-Express Fusion-MPT SAS-3 00c7 SAS3316 PCI-Express Fusion-MPT SAS-3 00c8 SAS3316 PCI-Express Fusion-MPT SAS-3 00c9 SAS3216 PCI-Express Fusion-MPT SAS-3 +# 9305 16 external port SAS HBA + 1000 3180 SAS9305-16e 00ce MegaRAID SAS-3 3316 [Intruder] 1000 9371 MegaRAID SAS 9361-16i 1000 9390 MegaRAID SAS 9380-8i8e @@ -771,8 +803,14 @@ 1028 200c HBA355i Front 1028 200d HBA355e Adapter 1028 200e HBA350i MX + 1028 2175 HBA350i Adapter 1d49 0205 ThinkSystem 440-16i SAS/SATA PCIe Gen4 12Gb Internal HBA 1d49 0206 ThinkSystem 440-16e SAS/SATA PCIe Gen4 12Gb HBA + 1d49 0207 ThinkSystem 440-8i SAS/SATA PCIe Gen4 12Gb HBA + 1d49 0208 ThinkSystem 440-16i SAS/SATA PCIe Gen4 12Gb HBA + 1d49 0209 ThinkSystem 440-8e SAS/SATA PCIe Gen4 12Gb HBA + 8086 4050 Storage Controller RS3P4QF160F + 8086 4070 Storage Controller RS3P4GF016F 00e7 Fusion-MPT 12GSAS/PCIe Unsupported SAS38xx # Tampered part 1028 200b HBA355i Adapter Tampered @@ -886,12 +924,21 @@ 1028 1ae1 PERC H755 Front 1028 1ae2 PERC H755N Front 1028 1ae3 PERC H755 MX + 1028 2171 PERC H750 Mini + 1028 2172 PERC H355 Adapter + 1028 2173 PERC H355 Front + 1028 2174 PERC H350 Mini + 1028 2176 PERC H750 Adapter + 1028 2177 PERC H350 Adapter 1d49 060a ThinkSystem RAID 940-8i 4GB Flash PCIe Gen4 12Gb Adapter 1d49 060b ThinkSystem RAID 940-8i 8GB Flash PCIe Gen4 12Gb Adapter 1d49 060c ThinkSystem RAID 940-16i 8GB Flash PCIe Gen4 12Gb Adapter 1d49 060d ThinkSystem RAID 940-16i 8GB Flash PCIe Gen4 12Gb Internal Adapter 1d49 060e ThinkSystem RAID 940-32i 8GB Flash PCIe Gen4 12Gb Adapter 1d49 060f ThinkSystem RAID 940-8e 4GB Flash PCIe Gen4 12Gb Adapter + 1d49 0610 ThinkSystem RAID 940-16i 4GB Flash PCIe Gen4 12Gb Adapter + 8086 4000 RAID Controller RS3P4TF160F + 8086 4020 RAID Controller RS3P4MF088F 10e3 MegaRAID 12GSAS/PCIe Unsupported SAS39xx 1028 1ae0 PERC H755 Adapter - Tampered Device 1028 1ae1 PERC H755 Front - Tampered Device @@ -900,6 +947,8 @@ 10e4 MegaRAID 12GSAS/PCIe Unsupported SAS38xx 10e5 MegaRAID 12GSAS/PCIe SAS38xx 10e6 MegaRAID 12GSAS/PCIe Secure SAS38xx + 1d49 0505 ThinkSystem RAID 540-8i PCIe Gen4 12Gb Adapter + 1d49 0506 ThinkSystem RAID 540-16i PCIe Gen4 12Gb Adapter 10e7 MegaRAID 12GSAS/PCIe Unsupported SAS38xx 1960 MegaRAID 1000 0518 MegaRAID 518 SCSI 320-2 Controller @@ -959,6 +1008,7 @@ 131c Kaveri [Radeon R7 Graphics] 131d Kaveri [Radeon R6 Graphics] 13e9 Ariel + 13fe Cyan Skillfish 1478 Navi 10 XL Upstream Port of PCI Express Switch 1479 Navi 10 XL Downstream Port of PCI Express Switch 154c Kryptos [Radeon RX 350] @@ -985,13 +1035,16 @@ 15df Raven/Raven2/Fenghuang/Renoir Cryptographic Coprocessor 103c 8615 Pavilion Laptop 15-cw1xxx ea50 ce19 mCOM10-L1900 + 15e7 Barcelo 15ff Fenghuang [Zhongshan Subor Z+] 1607 Arden 1636 Renoir + 1637 Renoir Radeon High Definition Audio Controller 1638 Cezanne 163f VanGogh 164c Lucienne 164d Rembrandt + 1681 Rembrandt 1714 BeaverCreek HDMI Audio [Radeon HD 6500D and 6400G-6600G series] 103c 168b ProBook 4535s 3150 RV380/M24 [Mobility Radeon X600] @@ -3474,6 +3527,7 @@ 174b e308 Radeon R9 380X Nitro 4G D5 17af 2006 Radeon R9 380X 6939 Tonga PRO [Radeon R9 285/380] + 1462 2015 Radeon R9 380 Gaming 4G 148c 9380 Radeon R9 380 # Make naming scheme consistent 174b e308 Radeon R9 380 Nitro 4G D5 @@ -3487,6 +3541,7 @@ 6985 Lexa XT [Radeon PRO WX 3100] 6986 Polaris12 6987 Lexa [Radeon 540X/550X/630 / RX 640 / E9171 MCM] + 698f Lexa XT [Radeon PRO WX 3100 / Barco MXRT 4700] 6995 Lexa XT [Radeon PRO WX 2100] 699f Lexa PRO [Radeon 540/540X/550/550X / RX 540X/550/550X] 1028 1720 Radeon RX 550X @@ -3658,6 +3713,7 @@ 7388 Arcturus GL-XL 738c Arcturus GL-XL [AMD Instinct MI100] 738e Arcturus GL-XL + 73a3 Navi 21 [Radeon PRO W6800] 73a4 Navi 21 USB 73af Navi 21 [Radeon RX 6900 XT] 73bf Navi 21 [Radeon RX 6800/6800 XT / 6900 XT] @@ -3669,6 +3725,9 @@ 73e1 Navi 23 73e4 Navi 23 USB 73ff Navi 23 [Radeon RX 6600/6600 XT/6600M] + 7408 Aldebaran + 740c Aldebaran + 740f Aldebaran 7833 RS350 Host Bridge 7834 RS350 [Radeon 9100 PRO/XT IGP] 7835 RS350M [Mobility Radeon 9000 IGP] @@ -3828,7 +3887,7 @@ 17aa 21bb Mobility Radeon HD 545v 9555 RV710/M92 [Mobility Radeon HD 4350/4550] 103c 1411 ProBook 4720s GPU (Mobility Radeon HD 4350) - 9557 RV711 GL [FirePro RG220] + 9557 RV711/M93 GL [FirePro RG220] 955f RV710/M92 [Mobility Radeon HD 4330] 9580 RV630 [Radeon HD 2600 PRO] 9581 RV630/M76 [Mobility Radeon HD 2600] @@ -4832,12 +4891,14 @@ 15d0 Raven/Raven2 Root Complex 103c 8615 Pavilion Laptop 15-cw1xxx 1043 876b PRIME B450M-A Motherboard + ea50 ce19 mCOM10-L1900 15d1 Raven/Raven2 IOMMU 103c 8615 Pavilion Laptop 15-cw1xxx 1043 876b PRIME B450M-A Motherboard ea50 ce19 mCOM10-L1900 15d2 Raven/Raven2 PCIe Dummy Host Bridge 15d3 Raven/Raven2 PCIe GPP Bridge [6:0] + ea50 ce19 mCOM10-L1900 15d4 FireFlight USB 3.1 15d5 FireFlight USB 3.1 15da Raven/Raven2 PCIe Dummy Host Bridge @@ -4862,14 +4923,17 @@ ea50 ce19 mCOM10-L1900 15e2 Raven/Raven2/FireFlight/Renoir Audio Processor 17aa 5124 ThinkPad E595 + ea50 ce19 mCOM10-L1900 15e3 Family 17h (Models 10h-1fh) HD Audio Controller 103c 8615 Pavilion Laptop 15-cw1xxx 1043 86c7 PRIME B450M-A Motherboard 17aa 5124 ThinkPad E595 15e4 Raven/Raven2/Renoir Sensor Fusion Hub 15e5 Raven2 USB 3.1 + ea50 ce19 mCOM10-L1900 15e6 Raven/Raven2/Renoir Non-Sensor Fusion Hub KMDF driver 1022 15e4 Raven/Raven2/Renoir Sensor Fusion Hub + ea50 ce19 mCOM10-L1900 15e8 Raven/Raven2 Device 24: Function 0 15e9 Raven/Raven2 Device 24: Function 1 15ea Raven/Raven2 Device 24: Function 2 @@ -4921,14 +4985,19 @@ 1629 Arden PCIe GPP Bridge 162a Arden Internal PCIe GPP Bridge 0 to bus X 162b Arden PCIe Non-Transparent Bridge - 1630 Renoir Root Complex - 1631 Renoir IOMMU + 1630 Renoir/Cezanne Root Complex + 1631 Renoir/Cezanne IOMMU 1632 Renoir PCIe Dummy Host Bridge 1633 Renoir PCIe GPP Bridge - 1634 Renoir PCIe GPP Bridge + 1634 Renoir/Cezanne PCIe GPP Bridge 1635 Renoir Internal PCIe GPP Bridge to Bus 1637 Renoir HD Audio Controller - 1639 Renoir USB 3.1 + 1639 Renoir/Cezanne USB 3.1 + 163a VanGogh USB0 + 163b VanGogh USB1 + 163c VanGogh SecUSB + 163d VanGogh SecureFunction + 163e VanGogh HSP 1641 Renoir 10GbE Controller Port 0 (XGBE0/1) 1642 Renoir WLAN 1643 Renoir BT @@ -5827,7 +5896,7 @@ 0325 315PRO PCI/AGP VGA Display Adapter 0330 330 [Xabre] PCI/AGP VGA Display Adapter 0406 85C501/2 - 0496 85C496 + 0496 SiS85C496 PCI & CPU Memory Controller (PCM) 0530 530 Host 0540 540 Host 0550 550 Host @@ -8646,13 +8715,18 @@ 8717 PEX 8717 16-lane, 8-Port PCI Express Gen 3 (8.0 GT/s) Switch with DMA 8718 PEX 8718 16-Lane, 5-Port PCI Express Gen 3 (8.0 GT/s) Switch 8724 PEX 8724 24-Lane, 6-Port PCI Express Gen 3 (8 GT/s) Switch, 19 x 19mm FCBGA + 8725 PEX 8725 24-Lane, 10-Port PCI Express Gen 3 (8.0 GT/s) Multi-Root Switch with DMA 8732 PEX 8732 32-lane, 8-Port PCI Express Gen 3 (8.0 GT/s) Switch 8734 PEX 8734 32-lane, 8-Port PCI Express Gen 3 (8.0GT/s) Switch 8747 PEX 8747 48-Lane, 5-Port PCI Express Gen 3 (8.0 GT/s) Switch 8748 PEX 8748 48-Lane, 12-Port PCI Express Gen 3 (8 GT/s) Switch, 27 x 27mm FCBGA -# This is the Non-Transparent-Bridge Virtualized Port as presented by the PLX PEX 8732 chip, the physical bridges show up at 10b5:8732 - 87b0 PEX 8732 32-lane, 8-Port PCI Express Gen 3 (8.0 GT/s) Switch + 8749 PEX 8749 48-Lane, 18-Port PCI Express Gen 3 (8.0 GT/s) Multi-Root Switch with DMA + 87a0 PEX PCI Express Switch NT0 Port Link Interface + 87a1 PEX PCI Express Switch NT1 Port Link Interface + 87b0 PEX PCI Express Switch NT0 Port Virtual Interface 1093 7761 PXIe-8830mc + 87b1 PEX PCI Express Switch NT1 Port Virtual Interface + 87d0 PEX PCI Express Switch DMA interface 9016 PLX 9016 8-port serial controller 9030 PCI9030 32-bit 33MHz PCI <-> IOBus Bridge 10b5 2695 Hilscher CIF50-PB/DPS Profibus @@ -8999,7 +9073,7 @@ 1449 M1449 1451 M1451 1461 M1461 - 1489 M1489 + 1489 M1489 Cache-Memory PCI Controller (CMP) [FinALi 486] CPU to PCI bridge 1511 M1511 [Aladdin] 1512 M1512 [Aladdin] 1513 M1513 [Aladdin] @@ -11993,6 +12067,10 @@ 10de 1141 VCA 6000 17f1 GM200GL [Quadro M6000 24GB] 17fd GM200GL [Tesla M40] + 1ad0 Tegra PCIe x8 Endpoint + 1ad1 Tegra PCIe x4/x8 Endpoint/Root Complex + 1ad2 Tegra PCIe x1 Root Complex + 1ad3 Xavier SATA Controller 1ad6 TU102 USB 3.1 Host Controller 1ad7 TU102 USB Type-C UCSI Controller 1ad8 TU104 USB 3.1 Host Controller @@ -12142,7 +12220,7 @@ 1e04 TU102 [GeForce RTX 2080 Ti] 1e07 TU102 [GeForce RTX 2080 Ti Rev. A] 1462 3715 RTX 2080 Ti GAMING X TRIO - 1e09 CMP 50HX + 1e09 TU102 [CMP 50HX] 1e2d TU102 [GeForce RTX 2080 Ti Engineering Sample] 1e2e TU102 [GeForce RTX 2080 Ti 12GB Engineering Sample] 1e30 TU102GL [Quadro RTX 6000/8000] @@ -12220,10 +12298,11 @@ 1f9d TU117M [GeForce GTX 1650 Mobile / Max-Q] 1fae TU117GL 1fb0 TU117GLM [Quadro T1000 Mobile] - 1fb1 TU117GLM [Quadro T600 Mobile] + 1fb1 TU117GL [T600] 1fb2 TU117GLM [Quadro T400 Mobile] 1fb8 TU117GLM [Quadro T2000 Mobile / Max-Q] 1fb9 TU117GLM [Quadro T1000 Mobile] + 1fba TU117GLM [T600 Mobile] 1fbb TU117GLM [Quadro T500 Mobile] 1fbf TU117GL 1fd9 TU117BM [GeForce GTX 1650 Mobile Refresh] @@ -12232,6 +12311,7 @@ 20b0 GA100 [A100 SXM4 40GB] 20b1 GA100 [A100 PCIe 40GB] 20b2 GA100 [A100 SXM4 80GB] + 20b5 GA100 [A100 PCIe 80GB] 20b6 GA100GL [PG506-232] 20b7 GA100GL [A30 PCIe] 20be GA100 [GRID A100A] @@ -12258,7 +12338,8 @@ 10de 146d GA102 [GeForce RTX 3080 20GB] 1462 3892 RTX 3080 10GB GAMING X TRIO 2208 GA102 [GeForce RTX 3080 Ti] - 220d GA102 + 220d GA102 [CMP 90HX] + 2216 GA102 [GeForce RTX 3080 Lite Hash Rate] 222b GA102 [GeForce RTX 3090 Engineering Sample] 222f GA102 [GeForce RTX 3080 11GB / 12GB Engineering Sample] 2230 GA102GL [RTX A6000] @@ -12268,6 +12349,7 @@ 2237 GA102GL [A10G] 223f GA102GL 228b GA104 High Definition Audio Controller + 2296 Tegra PCIe Endpoint Virtual Network 2302 GA103 2321 GA103 2482 GA104 [GeForce RTX 3070 Ti] @@ -12276,6 +12358,9 @@ 10de 146b GA104 [GeForce RTX 3070] 10de 14ae GA104 [GeForce RTX 3070 16GB] 2486 GA104 [GeForce RTX 3060 Ti] + 2488 GA104 [GeForce RTX 3070 Lite Hash Rate] + 2489 GA104 [GeForce RTX 3060 Ti Lite Hash Rate] + 248a GA104 [CMP 70HX] 249c GA104M [GeForce RTX 3080 Mobile / Max-Q 8GB/16GB] 249d GA104M [GeForce RTX 3070 Mobile / Max-Q] 249f GA104M @@ -12294,18 +12379,21 @@ 2504 GA106 [GeForce RTX 3060 Lite Hash Rate] 2505 GA106 2520 GA106M [GeForce RTX 3060 Mobile / Max-Q] + 2523 GA106M [GeForce RTX 3050 Ti Mobile / Max-Q] 252f GA106 [GeForce RTX 3060 Engineering Sample] 2560 GA106M [GeForce RTX 3060 Mobile / Max-Q] + 2563 GA106M [GeForce RTX 3050 Ti Mobile / Max-Q] 2583 GA107 [GeForce RTX 3050] 25a0 GA107M [GeForce RTX 3050 Ti Mobile] 25a2 GA107M [GeForce RTX 3050 Mobile] 25a4 GA107 - 25a5 GA107M + 25a5 GA107M [GeForce RTX 3050 Mobile] 25af GA107 [GeForce RTX 3050 Engineering Sample] 25b5 GA107GLM [RTX A4 Mobile] 25b8 GA107GLM [RTX A2000 Mobile] - 25e0 GA107BM - 25e2 GA107BM + 25e0 GA107BM [GeForce RTX 3050 Ti Mobile] + 25e2 GA107BM [GeForce RTX 3050 Mobile] + 25e5 GA107BM [GeForce RTX 3050 Mobile] 10df Emulex Corporation 0720 OneConnect NIC (Skyhawk) 103c 1934 FlexFabric 20Gb 2-port 650M Adapter @@ -12690,6 +12778,7 @@ ea50 ce19 mCOM10-L1900 816d RTL811x EHCI host controller ea50 ce19 mCOM10-L1900 + 816e Realtek RealManage BMC 8171 RTL8191SEvA Wireless LAN Controller 8172 RTL8191SEvB Wireless LAN Controller 8173 RTL8192SE Wireless LAN Controller @@ -14790,6 +14879,9 @@ 117c 00bc Celerity FC-321P 117c 00bd Celerity FC-322P 117c 00be Celerity FC-324P + 00c5 ExpressNVM PCIe Gen4 Switch + 117c 00c6 ExpressNVM S48F PCIe Gen4 + 117c 00c7 ExpressNVM S468 PCIe Gen4 00e6 ExpressSAS GT 12Gb/s SAS/SATA HBA 117c 00c0 ExpressSAS H1280 GT 117c 00c1 ExpressSAS H1208 GT @@ -15084,6 +15176,7 @@ # Nee Galileo Technology, Inc. 11ab Marvell Technology Group Ltd. 0100 88F3700 [Armada 3700 Family] ARM SoC + 0110 88F8040 PCI Express controller 0146 GT-64010/64010A System Controller 0f53 88E6318 Link Street network controller 11ab MV88SE614x SATA II PCI-E controller @@ -15632,7 +15725,12 @@ 8071 PM8071 Tachyon SPCve 12G eight-port SAS/SATA controller 8072 PM8072 Tachyon SPCv 12G 16-port SAS/SATA controller 8073 PM8073 Tachyon SPCve 12G 16-port SAS/SATA controller - 8531 PM8531 PFX 24xG3 Fanout PCIe Switches + 8531 PM8531 PFX 24xG3 PCIe Fanout Switch + 8532 PM8532 PFX 32xG3 PCIe Fanout Switch + 8533 PM8533 PFX 48xG3 PCIe Fanout Switch + 8534 PM8534 PFX 64xG3 PCIe Fanout Switch + 8535 PM8535 PFX 80xG3 PCIe Fanout Switch + 8536 PM8536 PFX 96xG3 PCIe Fanout Switch 8546 PM8546 B-FEIP PSX 96xG3 PCIe Storage Switch 8562 PM8562 Switchtec PFX-L 32xG3 Fanout-Lite PCIe Gen3 Switch 11f9 I-Cube Inc @@ -15640,7 +15738,8 @@ 11fb Datel Inc 11fc Silicon Magic 11fd High Street Consultants -11fe Pepperl+Fuchs Comtrol, Inc. +# nee Comtrol, Inc. +11fe Pepperl+Fuchs 0001 RocketPort PCI 32-port w/external I/F 0002 RocketPort PCI 8-port w/external I/F 0003 RocketPort PCI 16-port w/external I/F @@ -16135,7 +16234,7 @@ 1268 Tektronix 1269 Thomson-CSF/TTM # MBIM on top of MHI - 00b4 5G Data Card [Cinterion MV31-W] + 00b3 5G Data Card [Cinterion MV31-W] 126a Lexmark International, Inc. 126b Adax, Inc. 126c Northern Telecom @@ -17723,10 +17822,151 @@ 9513 OX16PCI954 (Quad 16950 UART) function 1 (parallel port) 9521 OX16PCI952 (Dual 16950 UART) 9523 OX16PCI952 Integrated Parallel Port - c158 OXPCIe952 Dual 16C950 UART +# Multifunction device with 3 function bits in ID + c000 OXPCIe840 Parallel Port + c004 OXPCIe840 Parallel Port + c006 OXPCIe840 GPIO +# Multifunction device with reset straps and function bits in ID + c100 OXPCIe952 Parallel Port + c101 OXPCIe952 Legacy 950 UART + c104 OXPCIe952 Parallel Port + c105 OXPCIe952 Legacy 950 UART + c106 OXPCIe952 GPIO + c108 OXPCIe952 Parallel Port + c109 OXPCIe952 Legacy 950 UART + c10c OXPCIe952 Parallel Port + c10d OXPCIe952 Legacy 950 UART + c10e OXPCIe952 GPIO + c110 OXPCIe952 Parallel Port + c114 OXPCIe952 Parallel Port + c118 OXPCIe952 Parallel Port + c11b OXPCIe952 Native 950 UART + c11c OXPCIe952 Parallel Port + c11e OXPCIe952 GPIO + c11f OXPCIe952 Native 950 UART + c120 OXPCIe952 Legacy 950 UART + c124 OXPCIe952 Legacy 950 UART + c126 OXPCIe952 GPIO + c128 OXPCIe952 Legacy 950 UART + c12c OXPCIe952 Legacy 950 UART + c12e OXPCIe952 GPIO + c134 OXPCIe952 GPIO + c138 OXPCIe952 Native 950 UART + c13c OXPCIe952 GPIO + c13d OXPCIe952 Native 950 UART + c140 OXPCIe952 Legacy 950 UART #1 + c141 OXPCIe952 Legacy 950 UART #2 + c144 OXPCIe952 Legacy 950 UART #1 + c145 OXPCIe952 Legacy 950 UART #2 + c146 OXPCIe952 GPIO + c148 OXPCIe952 Legacy 950 UART #1 + c149 OXPCIe952 Legacy 950 UART #2 + c14c OXPCIe952 Legacy 950 UART #1 + c14d OXPCIe952 Legacy 950 UART #2 + c14e OXPCIe952 GPIO + c154 OXPCIe952 GPIO + c158 OXPCIe952 Dual Native 950 UART e4bf c504 CP4-SCAT Wireless Technologies Carrier Board e4bf d551 DU1-MUSTANG Dual-Port RS-485 Interface - c308 EX-44016 16-port serial + c15c OXPCIe952 GPIO + c15d OXPCIe952 Dual Native 950 UART +# Multifunction device with 4 function bits in ID + c204 OXPCIe954 GPIO + c208 OXPCIe954 Quad Native 950 UART + c20c OXPCIe954 GPIO + c20d OXPCIe954 Quad Native 950 UART +# Multifunction device with 4 function bits in ID + c304 OXPCIe958 GPIO + c308 OXPCIe958 Quad Native 950 UART + c30c OXPCIe958 GPIO + c30d OXPCIe958 Quad Native 950 UART +# Multifunction device with 8 function bits in ID + c530 OXPCIe200 Dual OHCI USB Controller (ULPI/R-ULPI) + c531 OXPCIe200 Dual EHCI USB Controller (ULPI/R-ULPI) + c534 OXPCIe200 Dual OHCI USB Controller (ULPI/R-ULPI) + c535 OXPCIe200 Dual EHCI USB Controller (ULPI/R-ULPI) + c536 OXPCIe200 GPIO + c538 OXPCIe200 Dual OHCI USB Controller (ULPI/R-ULPI) + c539 OXPCIe200 Dual EHCI USB Controller (ULPI/R-ULPI) + c53b OXPCIe200 Native 950 UART + c53c OXPCIe200 Dual OHCI USB Controller (ULPI/R-ULPI) + c53d OXPCIe200 Dual EHCI USB Controller (ULPI/R-ULPI) + c53e OXPCIe200 GPIO + c53f OXPCIe200 Native 950 UART + c540 OXPCIe200 Dual OHCI USB Controller (R-ULPI) + c541 OXPCIe200 Dual EHCI USB Controller (R-ULPI) + c544 OXPCIe200 Dual OHCI USB Controller (R-ULPI) + c545 OXPCIe200 Dual EHCI USB Controller (R-ULPI) + c546 OXPCIe200 GPIO + c548 OXPCIe200 Dual OHCI USB Controller (R-ULPI) + c549 OXPCIe200 Dual EHCI USB Controller (R-ULPI) + c54b OXPCIe200 Native 950 UART + c54c OXPCIe200 Dual OHCI USB Controller (R-ULPI) + c54d OXPCIe200 Dual EHCI USB Controller (R-ULPI) + c54e OXPCIe200 Dual GPIO + c54f OXPCIe200 Native 950 UART + c560 OXPCIe200 Dual OHCI USB Controller (ULPI/analog) + c561 OXPCIe200 EHCI USB Controller (ULPI) + c564 OXPCIe200 Dual OHCI USB Controller (ULPI/analog) + c565 OXPCIe200 EHCI USB Controller (ULPI) + c566 OXPCIe200 GPIO + c568 OXPCIe200 Dual OHCI USB Controller (ULPI/analog) + c569 OXPCIe200 EHCI USB Controller (ULPI) + c56b OXPCIe200 Native 950 UART + c56c OXPCIe200 Dual OHCI USB Controller (ULPI/analog) + c56d OXPCIe200 EHCI USB Controller (ULPI) + c56e OXPCIe200 GPIO + c56f OXPCIe200 Native 950 UART + c570 OXPCIe200 Dual OHCI USB Controller (R-ULPI/analog) + c571 OXPCIe200 EHCI USB Controller (R-ULPI) + c574 OXPCIe200 Dual OHCI USB Controller (R-ULPI/analog) + c575 OXPCIe200 EHCI USB Controller (R-ULPI) + c576 OXPCIe200 GPIO + c578 OXPCIe200 Dual OHCI USB Controller (R-ULPI/analog) + c579 OXPCIe200 EHCI USB Controller (R-ULPI) + c57b OXPCIe200 Native 950 UART + c57c OXPCIe200 Dual OHCI USB Controller (R-ULPI/analog) + c57d OXPCIe200 EHCI USB Controller (R-ULPI) + c57e OXPCIe200 GPIO + c57f OXPCIe200 Native 950 UART + c5a0 OXPCIe200 OHCI USB Controller (ULPI) + c5a1 OXPCIe200 EHCI USB Controller (ULPI) + c5a2 OXPCIe200 Programmable Memory Interface + c5a4 OXPCIe200 OHCI USB Controller (ULPI) + c5a5 OXPCIe200 EHCI USB Controller (ULPI) + c5a6 OXPCIe200 Programmable Memory Interface & GPIO + c5a8 OXPCIe200 OHCI USB Controller (ULPI) + c5a9 OXPCIe200 EHCI USB Controller (ULPI) + c5aa OXPCIe200 Programmable Memory Interface + c5ab OXPCIe200 Native 950 UART + c5ac OXPCIe200 OHCI USB Controller (ULPI) + c5ad OXPCIe200 EHCI USB Controller (ULPI) + c5ae OXPCIe200 Programmable Memory Interface & GPIO + c5af OXPCIe200 Native 950 UART + c5b0 OXPCIe200 OHCI USB Controller (R-ULPI) + c5b1 OXPCIe200 EHCI USB Controller (R-ULPI) + c5b2 OXPCIe200 Programmable Memory Interface + c5b4 OXPCIe200 OHCI USB Controller (R-ULPI) + c5b5 OXPCIe200 EHCI USB Controller (R-ULPI) + c5b6 OXPCIe200 Programmable Memory Interface & GPIO + c5b8 OXPCIe200 OHCI USB Controller (R-ULPI) + c5b9 OXPCIe200 EHCI USB Controller (R-ULPI) + c5ba OXPCIe200 Programmable Memory Interface + c5bb OXPCIe200 Native 950 UART + c5bc OXPCIe200 OHCI USB Controller (R-ULPI) + c5bd OXPCIe200 EHCI USB Controller (R-ULPI) + c5be OXPCIe200 Programmable Memory Interface & GPIO + c5bf OXPCIe200 Native 950 UART + c5c0 OXPCIe200 OHCI USB Controller (analog) + c5c2 OXPCIe200 Programmable Memory Interface + c5c4 OXPCIe200 OHCI USB Controller (analog) + c5c6 OXPCIe200 Programmable Memory Interface & GPIO + c5c8 OXPCIe200 OHCI USB Controller (analog) + c5ca OXPCIe200 Programmable Memory Interface + c5cb OXPCIe200 Native 950 UART + c5cc OXPCIe200 OHCI USB Controller (analog) + c5ce OXPCIe200 Programmable Memory Interface & GPIO + c5cf OXPCIe200 Native 950 UART 1416 Multiwave Innovation pte Ltd 1417 Convergenet Technologies Inc 1418 Kyushu electronics systems Inc @@ -18488,7 +18728,15 @@ 144d a801 SM963 2.5" NVMe PCIe SSD a808 NVMe SSD Controller SM981/PM981/PM983 1d49 403b Thinksystem U.2 PM983 NVMe SSD - a80a NVMe SSD Controller PM9A1/980PRO + a80a NVMe SSD Controller PM9A1/PM9A3/980PRO + 0128 215a DC NVMe PM9A3 RI U.2 960GB + 0128 215b DC NVMe PM9A3 RI U.2 1.92TB + 0128 215c DC NVMe PM9A3 RI U.2 3.84TB + 0128 215d DC NVMe PM9A3 RI U.2 7.68TB + 0128 2166 DC NVMe PM9A3 RI 110M.2 960GB + 0128 2167 DC NVMe PM9A3 RI 110M.2 1.92TB + 0128 2168 DC NVMe PM9A3 RI 80M.2 480GB + 0128 2169 DC NVMe PM9A3 RI 80M.2 960GB a820 NVMe SSD Controller 171X 1028 1f95 Express Flash NVMe XS1715 SSD 400GB 1028 1f96 Express Flash NVMe XS1715 SSD 800GB @@ -18568,6 +18816,8 @@ 1028 2131 Ent NVMe v2 AGN RI U.2 7.68TB 1028 2132 Ent NVMe v2 AGN FIPS RI U.2 15.36TB 1028 2133 Ent NVMe v2 AGN RI U.2 15.36TB + a825 NVMe SSD Controller PM173Xa + a826 NVMe SSD Controller PM174X ecec Exynos 8895 PCIe Root Complex 144e OLITEC 144f Askey Computer Corp. @@ -18598,6 +18848,7 @@ 1462 Micro-Star International Co., Ltd. [MSI] # VIA Driver-inf 3483 MSI USB 3.0 (VIA VL80x-based xHCI USB Controller) + 7c56 Realtek Ethernet controller RTL8111H aaf0 Radeon RX 580 Gaming X 8G 1463 Fast Corporation 1464 Interactive Circuits & Systems Ltd @@ -18693,7 +18944,8 @@ 14a8 FEATRON Technologies Corporation 14a9 HIVERTEC Inc 14aa Advanced MOS Technology Inc -14ab Mentor Graphics Corp. +# nee Mentor Graphics Corp. +14ab Siemens Industry Software Inc. 14ac Novaweb Technologies Inc 14ad Time Space Radio AB 14ae CTI, Inc @@ -19270,9 +19522,12 @@ 14e4 1402 BCM957414A4142CC 10Gb/25Gb Ethernet PCIe 14e4 1404 BCM957414M4142C OCP 2x25G Type1 wRoCE 14e4 4140 NetXtreme E-Series Advanced Dual-port 25Gb SFP28 Network Daughter Card +# BCM957414M4143C + 14e4 4143 NetXtreme-E Single-port 40Gb/50Gb Ethernet OCP 2.0 Adapter (BCM957414M4143C) 14e4 4146 NetXtreme-E Dual-port 25G SFP28 Ethernet OCP 3.0 Adapter (BCM957414N4140C) 1590 020e Ethernet 25Gb 2-port 631SFP28 Adapter 1590 0211 Ethernet 25Gb 2-port 631FLR-SFP28 Adapter + 1eec 0101 VSE250231S Dual-port 10Gb/25Gb Ethernet PCIe 16d8 BCM57416 NetXtreme-E Dual-Media 10G RDMA Ethernet Controller 1028 1feb NetXtreme-E 10Gb SFP+ Adapter 14e4 4163 NetXtreme-E Dual-port 10GBASE-T Ethernet OCP 2.0 Adapter (BCM957416M4163C) @@ -19331,6 +19586,7 @@ 14e4 d124 NetXtreme-E P2100D BCM57508 2x100G QSFP PCIE 14e4 df24 BCM57508 NetXtreme-E NGM2100D 2x100G KR Mezz Ethernet 1751 BCM57504 NetXtreme-E 10Gb/25Gb/40Gb/50Gb/100Gb/200Gb Ethernet + 1028 09d4 PowerEdge XR11/XR12 LOM 14e4 5045 NetXtreme-E BCM57504 4x25G OCP3.0 14e4 5250 NetXtreme-E BCM57504 4x25G KR Mezz 14e4 d142 NetXtreme-E P425D BCM57504 4x25G SFP28 PCIE @@ -19341,7 +19597,7 @@ 14e4 df24 BCM57508 NetXtreme-E NGM2100D 2x100G KR Mezz Ethernet Partition 1803 BCM57502 NetXtreme-E RDMA Partition 1804 BCM57504 NetXtreme-E RDMA Partition - 1805 BCM57508 NetXtreme-E NGM2100D 2x100G KR Mezz RDMA Partition + 1805 BCM57508 NetXtreme-E RDMA Partition 14e4 df24 NetXtreme-E NGM2100D BCM57508 2x100G KR Mezz RDMA Partition 1806 BCM5750X NetXtreme-E Ethernet Virtual Function 14e4 df24 BCM57508 NetXtreme-E NGM2100D 2x100G KR Mezz Ethernet Virtual Function @@ -19635,6 +19891,7 @@ b960 Broadcom BCM56960 Switch ASIC # Tomahawk4 b990 BCM56990 Switch ASIC + c909 BCM78909 Switch ASIC d802 BCM58802 Stingray 50Gb Ethernet SoC 14e4 8021 Stingray Dual-Port 25Gb Ethernet PCIe SmartNIC w16GB DRAM (Part No BCM958802A8046C) 14e4 8023 PS410T-H04 NetXtreme-S 4x10G 10GBaseT PCIe SmartNIC @@ -20331,13 +20588,16 @@ 0252 Amos chiplet 0253 Amos GearBox Manager 0254 Spectrum-4, Flash recovery mode - 0255 Spectrum-4, Secure Flash recovery mode - 0256 Ofek chiplet + 0255 Spectrum-4 RMA + 0256 Abir GearBox 0257 Quantum-2 in Flash Recovery Mode + 0258 Quantum-2 RMA 0262 MT27710 [ConnectX-4 Lx Programmable] EN 0263 MT27710 [ConnectX-4 Lx Programmable Virtual Function] EN 0264 Innova-2 Flex Burn image 0281 NPS-600 Flash Recovery + 0357 Abir GearBox in Flash Recovery Mode + 0358 Abir GearBox in RMA 1002 MT25400 Family [ConnectX-2 Virtual Function] 1003 MT27500 Family [ConnectX-3] 1014 04b5 PCIe3 40GbE RoCE Converged Host Bus Adapter for Power @@ -21249,6 +21509,7 @@ 7029 AP342 14-bit, 12-Channel Isolated Simultaneous Conversion Analog Input Module 702a AP226 12-Bit, 8-Channel Isolated Analog Output Module 702b AP236 16-Bit, 8-Channel Isolated Analog Output Module + 702c AP560A Module 4 Independent isolated CAN bus channels 7031 AP441-1: 32-Channel Isolated Digital Input Module 7032 AP441-2: 32-Channel Isolated Digital Input Module 7033 AP441-3: 32-Channel Isolated Digital Input Module @@ -21259,6 +21520,7 @@ 7052 APA7-502 Reconfigurable Artix-7 52,160 Cell FPGA module 24 RS485 channels 7053 APA7-503 Reconfigurable Artix-7 52,160 Cell FPGA module 24 TTL & 12 RS485 channels 7054 APA7-504 Reconfigurable Artix-7 52,160 Cell FPGA module 24 LVDS channels + 7073 AP730 Multi-function I/O Module 16 Digital I/O 8 Differential Analog In 4 Analog Out 16da Advantech Co., Ltd. 0011 INES GPIB-PCI 16df PIKA Technologies Inc. @@ -21371,7 +21633,9 @@ 0004 Octeon (and older) FIPS 0005 Octeon CN38XX Network Processor Pass 3.x 0006 RoHS - 0010 Nitrox XL NPX + 0010 CN15XX/CN16XX [Nitrox PX] + 0011 CNN35XX [Nitrox III] + 0012 CNN55XX [Nitrox V] 0020 Octeon CN31XX Network Processor 0030 Octeon CN30XX Network Processor 0040 Octeon CN58XX Network Processor @@ -22022,6 +22286,7 @@ 18ec 4200 Flexible FlowMon (szedata2) 1x10G 18ec ff00 Testing design 18ec ff01 Boot design + c400 COMBO-400G1 18ee Chenming Mold Ind. Corp. 18f1 Spectrum GmbH 18f4 Napatech A/S @@ -22485,6 +22750,7 @@ 5012 E12 NVMe Controller 5013 PS5013 E13 NVMe Controller 5016 E16 PCIe4 NVMe Controller + 5018 E18 PCIe4 NVMe Controller 1989 Montilio Inc. 0001 RapidFile Bridge 8001 RapidFile @@ -22799,7 +23065,8 @@ 1ae3 SANBlaze Technology, Inc. 1ae7 First Wise Media GmbH 0520 HFC-S PCI A [X-TENSIONS XC-520] -1ae8 Silicon Software GmbH +# nee Silicon Software GmbH +1ae8 Basler AG # CameraLink frame grabber for Visual Applets 0751 mE5 marathon VCL # CameraLink HS frame grabber @@ -22848,6 +23115,12 @@ 0b61 mE6 Abacus 4TG # CoaXpress frame grabber 0b63 CXP-12 Interface Card 1C +# CoaXpress frame grabber + 0b64 CXP-12 Interface Card 4C +# CoaXpress frame grabber + 0b65 CXP-12 Interface Card 2C +# CoaXpress Thunderbolt frame grabber + 0b66 CXP-12 LightBridge 2C # GigE Vision frame grabber 0e42 microEnable IV AQ4-GE # GigE Vision frame grabber for Visual Applets @@ -22946,6 +23219,7 @@ 1343 ASM1143 USB 3.1 Host Controller 2142 ASM2142 USB 3.1 Host Controller 1462 7a72 H270 PC MATE + 2824 ASM2824 PCIe Gen3 Packet Switch 3242 ASM3242 USB 3.2 Host Controller 1b26 Netcope Technologies, a.s. c132 COMBO-LXT155 @@ -23295,7 +23569,7 @@ 1283 PC300 NVMe Solid State Drive 256GB 1284 PC300 NVMe Solid State Drive 512GB 1285 PC300 NVMe Solid State Drive 1TB - 1327 BC501 NVMe Solid State Drive 512GB + 1327 BC501 NVMe Solid State Drive 1339 BC511 1504 SC300 512GB M.2 2280 SATA Solid State Drive 1527 PC401 NVMe Solid State Drive 256GB @@ -23473,6 +23747,8 @@ 1d21 Allo 1d22 Baidu Technology 1380 Cloud Storage Device + 3684 Kunlun AI Accelerator + 3685 Kunlun2 AI Accelerator [VF] 1d26 Kalray Inc. 0040 Turbocard2 Accelerator 0080 Open Network Interface Card 80G @@ -23494,6 +23770,9 @@ 1d62 Nebbiolo Technologies 1d65 Imagine Communications Corp. 04de Taurus/McKinley +1d69 Celeno Communications + 2432 CL2432 + 2440 CL2440 1d6a Aquantia Corp. 0001 AQC107 NBase-T/IEEE 802.3bz Ethernet Controller [AQtion] 00b1 AQC100 10G Ethernet MAC controller [AQtion] @@ -23533,6 +23812,10 @@ 1017 AR-ARK-FX1 [Arkville 64B Multi-Homed Primary Endpoint] 1018 AR-ARK-FX1 [Arkville 64B Multi-Homed Secondary Endpoint] 1019 AR-ARK-FX1 [Arkville 64B Multi-Homed Tertiary Endpoint] + 101a AR-ARK-SRIOV-FX0 [Arkville 32B Primary Physical Function] + 101b AR-ARK-SRIOV-FX1 [Arkville 64B Primary Physical Function] + 101c AR-ARK-SRIOV-VF [Arkville Virtual Function] + 101d AR-ARK-NIC [Arkville ArkNIC Kernel Path Device] 4200 A5PL-E1-10GETI [10 GbE Ethernet Traffic Instrument] 1d72 Xiaomi 1d78 DERA Storage @@ -23562,6 +23845,7 @@ 1808 RK1808 Neural Network Processor Card 3566 RK3568 Remote Signal Processor 1d8f Enyx +1d92 Abaco Systems Inc. 1d93 YADRO 1d94 Chengdu Haiguang IC Design Co., Ltd. 1450 Root Complex @@ -23597,6 +23881,7 @@ 0001 Colossus GC2 [C2] 0002 Colossus GC1 [S1] 1d97 Shenzhen Longsys Electronics Co., Ltd. + 2263 SM2263EN/SM2263XT-based OEM SSD 1d9b Facebook, Inc. 0010 Networking DOM Engine 0011 IO Bridge @@ -23607,6 +23892,8 @@ 0001 HL-1000 AI Inference Accelerator [Goya] # PCIe accelerator card for Deep Learning training tasks 1000 HL-2000 AI Training Accelerator [Gaudi] +# PCIe accelerator card for Deep Learning training tasks with secured firmware + 1010 HL-2000 AI Training Accelerator [Gaudi secured] 1db2 ATP ELECTRONICS INC 1dbb NGD Systems, Inc. 1dbf Guizhou Huaxintong Semiconductor Technology Co., Ltd @@ -23614,6 +23901,8 @@ 1dc5 FADU Inc. 1dcd Liqid Inc. 1dd8 Pensando Systems + 0002 DSC2 Elba Upstream Port + 1dd8 5001 DSC2-200 50/100/200G 2-port 32G RAM 64G eMMC G2 Services Card 1000 DSC Capri Upstream Port 1dd8 4000 Naples 100Gb 2-port QSFP28 x16 8GB 1dd8 4001 Naples 100Gb 2-port QSFP28 x16 4GB @@ -23624,6 +23913,7 @@ 1dd8 400c DSC-25 10/25G 2-port 4G RAM 8G eMMC G1 Services Card 1dd8 400d DSP DSC-100 Ent 100Gb Card 1dd8 400e DSC-25 10/25G 2-port 4G RAM 8G eMMC G1 Services Card + 1dd8 4014 DSC-100 40/100G 2-port 8G RAM 16G eMMC G1 Services Card 1001 DSC Virtual Downstream Port 1dd8 4000 Naples 100Gb 2-port QSFP28 x16 8GB 1dd8 4001 Naples 100Gb 2-port QSFP28 x16 4GB @@ -23634,6 +23924,8 @@ 1dd8 400c DSC-25 10/25G 2-port 4G RAM 8G eMMC G1 Services Card 1dd8 400d DSP DSC-100 Ent 100Gb Card 1dd8 400e DSC-25 10/25G 2-port 4G RAM 8G eMMC G1 Services Card + 1dd8 4014 DSC-100 40/100G 2-port 8G RAM 16G eMMC G1 Services Card + 1dd8 5001 DSC2-200 50/100/200G 2-port 32G RAM 64G eMMC G2 Services Card 1002 DSC Ethernet Controller 1dd8 4000 Naples 100Gb 2-port QSFP28 x16 8GB 1dd8 4001 Naples 100Gb 2-port QSFP28 x16 4GB @@ -23644,6 +23936,8 @@ 1dd8 400c DSC-25 10/25G 2-port 4G RAM 8G eMMC G1 Services Card 1dd8 400d DSP DSC-100 Ent 100Gb Card 1dd8 400e DSC-25 10/25G 2-port 4G RAM 8G eMMC G1 Services Card + 1dd8 4014 DSC-100 40/100G 2-port 8G RAM 16G eMMC G1 Services Card + 1dd8 5001 DSC2-200 50/100/200G 2-port 32G RAM 64G eMMC G2 Services Card 1003 DSC Ethernet Controller VF 1dd8 4000 Naples 100Gb 2-port QSFP28 x16 8GB 1dd8 4001 Naples 100Gb 2-port QSFP28 x16 4GB @@ -23654,6 +23948,8 @@ 1dd8 400c DSC-25 10/25G 2-port 4G RAM 8G eMMC G1 Services Card 1dd8 400d DSP DSC-100 Ent 100Gb Card 1dd8 400e DSC-25 10/25G 2-port 4G RAM 8G eMMC G1 Services Card + 1dd8 4014 DSC-100 40/100G 2-port 8G RAM 16G eMMC G1 Services Card + 1dd8 5001 DSC2-200 50/100/200G 2-port 32G RAM 64G eMMC G2 Services Card 1004 DSC Management Controller 1dd8 4000 Naples 100Gb 2-port QSFP28 x16 8GB 1dd8 4001 Naples 100Gb 2-port QSFP28 x16 4GB @@ -23664,6 +23960,8 @@ 1dd8 400c DSC-25 10/25G 2-port 4G RAM 8G eMMC G1 Services Card 1dd8 400d DSP DSC-100 Ent 100Gb Card 1dd8 400e DSC-25 10/25G 2-port 4G RAM 8G eMMC G1 Services Card + 1dd8 4014 DSC-100 40/100G 2-port 8G RAM 16G eMMC G1 Services Card + 1dd8 5001 DSC2-200 50/100/200G 2-port 32G RAM 64G eMMC G2 Services Card 1007 DSC Storage Accelerator 1dd8 4000 Naples 100Gb 2-port QSFP28 x16 8GB 1dd8 4001 Naples 100Gb 2-port QSFP28 x16 4GB @@ -23674,6 +23972,8 @@ 1dd8 400c DSC-25 10/25G 2-port 4G RAM 8G eMMC G1 Services Card 1dd8 400d DSP DSC-100 Ent 100Gb Card 1dd8 400e DSC-25 10/25G 2-port 4G RAM 8G eMMC G1 Services Card + 1dd8 4014 DSC-100 40/100G 2-port 8G RAM 16G eMMC G1 Services Card + 1dd8 5001 DSC2-200 50/100/200G 2-port 32G RAM 64G eMMC G2 Services Card 1de0 Groq # rename due to conflict with a term in use by another company for an entirely different product. 0000 TSP100 Tensor Streaming Processor @@ -23807,12 +24107,14 @@ 1e36 Shanghai Enflame Technology Co. Ltd 0001 T10 [CloudBlazer] 0002 T11 [CloudBlazer] - 0003 T10s [CloudBlazer] + 0003 T10(QSFP-DD) [CloudBlazer] 8011 I10 [CloudBlazer] 8012 I10L [CloudBlazer] # nee Thinci, Inc 1e38 Blaize, Inc 0102 Xplorer X1600 +# https://www.medion.com/ +1e39 MEDION AG 1e3b Shenzhen DAPU Microelectronics Co., Ltd 1098 Haishen NVMe SSD 1e3b 0001 Enterprise NVMe SSD U.2 0.8TB (H2100) @@ -23827,6 +24129,9 @@ 1e3b 0015 Enterprise NVMe SSD U.2 3.84TB (H3200) 1e3b 0021 Enterprise NVMe SSD U.2 6.4TB (H3100) 1e3b 0022 Enterprise NVMe SSD U.2 7.68TB (H3200) + 1e3b 0052 Enterprise NVMe SSD U.2 0.8TB (H3900) + 1e3b 0053 Enterprise NVMe SSD U.2 1.6TB (H3900) + 1e3b 0059 Enterprise NVMe SSD U.2 0.75TB (H3900) 1e3b 0061 Enterprise NVMe SSD HHHL 0.8TB (H2100) 1e3b 0062 Enterprise NVMe SSD HHHL 0.96TB (H2200) 1e3b 0064 Enterprise NVMe SSD HHHL 1.6TB (H2100) @@ -23839,8 +24144,13 @@ 1e3b 007d Enterprise NVMe SSD HHHL 3.84TB (H3200) 1e3b 007f Enterprise NVMe SSD HHHL 6.4TB (H3100) 1e3b 0080 Enterprise NVMe SSD HHHL 7.68TB (H3200) + 1e3b 008a Enterprise NVMe SSD HHHL 0.8TB (H3900) + 1e3b 008b Enterprise NVMe SSD HHHL 1.6TB (H3900) + 1e3b 0091 Enterprise NVMe SSD HHHL 0.75TB (H3900) 1e3d Burlywood, Inc 1e49 Yangtze Memory Technologies Co.,Ltd +# YMTC PCIe/NVMe SSD + 1013 PC210 1e4b MAXIO Technology (Hangzhou) Ltd. 1001 NVMe SSD Controller MAP1001 1002 NVMe SSD Controller MAP1002 @@ -23855,12 +24165,15 @@ 1e57 Beijing Panyi Technology Co., Ltd 0100 The device has already been deleted. 0000 0100 PY8800 64GB Accelerator +1e59 Oxford Nanopore Technologies + 0001 MinION Mk1C 1e60 Hailo Technologies Ltd. 2864 Hailo-8 AI Processor 1e6b Axiado Corp. 1e7b Dataland 1e7c Brainchip Inc bca1 AKD1000 Neural Network Coprocessor [Akida] +1e81 Ramaxel Technology(Shenzhen) Limited 1e85 Heitec AG 1e89 ID Quantique SA 0002 Quantis-PCIe-40M @@ -23870,6 +24183,8 @@ 1e95 Solid State Storage Technology Corporation 1ea0 Tencent Technology (Shenzhen) Company Limited 2a16 Cloud Intelligent Inference Controller +1ea7 Intelliprop, Inc + 223a Typhon+ PCIe to Gen-Z Bridge 1eab Hefei DATANG Storage Technology Co.,LTD. 300a NVMe SSD Controller 300A 300b NVMe SSD Controller 300B @@ -23883,6 +24198,17 @@ 0101 FG4 PCIe Frame Grabber 1ed9 Myrtle.ai 1ee9 SUSE LLC +1eec Viscore Technologies Ltd +1efb Flexxon Pte Ltd +1f02 Beijing Dayu Technology +1f03 Shenzhen Shichuangyi Electronics Co., Ltd + 1202 MAP1202-Based NVMe SSD + 2262 SM2262EN-based OEM SSD + 2263 SM2263XT-Base NVMe SSD + 5216 IG5216-based NVMe SSD + 5220 IG5220-Based NVMe SSD + 5236 IG5236-Based NVMe SSD + 5636 IG5636-Based NVMe SSD # nee Tumsan Oy 1fc0 Ascom (Finland) Oy 0300 E2200 Dual E1/Rawpipe Card @@ -24359,6 +24685,8 @@ 0010 [mvHYPERION-16R16/-32R16] 16 Video Channel PCI Express x4 Frame Grabber 0020 [mvHYPERION-HD-SDI] HD-SDI PCI Express x4 Frame Grabber 0030 [mvHYPERION-HD-SDI-Merger] HD-SDI PCI Express x4 Frame Grabber *** 188 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Tue Jul 27 16:58: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 CE4C4663AA3; Tue, 27 Jul 2021 16:58: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 4GZ30b571mz4nD2; Tue, 27 Jul 2021 16:58: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 98621658E; Tue, 27 Jul 2021 16:58: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 16RGwt2H083438; Tue, 27 Jul 2021 16:58:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RGwtb1083437; Tue, 27 Jul 2021 16:58:55 GMT (envelope-from git) Date: Tue, 27 Jul 2021 16:58:55 GMT Message-Id: <202107271658.16RGwtb1083437@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: 7b7227c4a601 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 7b7227c4a601d92a46cf625ca7ae245664a809fe 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, 27 Jul 2021 16:58:55 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=7b7227c4a601d92a46cf625ca7ae245664a809fe commit 7b7227c4a601d92a46cf625ca7ae245664a809fe Author: Konstantin Belousov AuthorDate: 2021-07-20 00:48:49 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-27 16:58:47 +0000 null_bypass(): some style Reivewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31310 --- 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 aeebce4ed086..56973530fd95 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 Jul 27 16:58: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 0F18A663C0A; Tue, 27 Jul 2021 16:58: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 4GZ30c6LPCz4nK3; Tue, 27 Jul 2021 16:58: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 BA6EF64B7; Tue, 27 Jul 2021 16:58: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 16RGwukV083468; Tue, 27 Jul 2021 16:58:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RGwu3V083467; Tue, 27 Jul 2021 16:58:56 GMT (envelope-from git) Date: Tue, 27 Jul 2021 16:58:56 GMT Message-Id: <202107271658.16RGwu3V083467@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: 161e9a97363d - main - 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/main X-Git-Reftype: branch X-Git-Commit: 161e9a97363d17caf0b47983b28a37f3f59f9978 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, 27 Jul 2021 16:58:57 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=161e9a97363d17caf0b47983b28a37f3f59f9978 commit 161e9a97363d17caf0b47983b28a37f3f59f9978 Author: Konstantin Belousov AuthorDate: 2021-07-17 22:56:47 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-27 16:58:47 +0000 nullfs: provide custom null_advlock bypass The advlock VOP takes the vnode unlocked, which makes the normal bypass function racy. Same as null_pgcache_read(), nullfs implementation needs to take interlock and reference lower vnode under it. Reported and tested by: pho Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31310 --- 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 56973530fd95..0d5092f5e33d 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(). @@ -1052,6 +1074,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 Jul 27 16:58: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 336F6663C0D; Tue, 27 Jul 2021 16:58: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 4GZ30f0hVNz4nD7; Tue, 27 Jul 2021 16:58: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 E0C9B661E; Tue, 27 Jul 2021 16:58: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 16RGwvQT083493; Tue, 27 Jul 2021 16:58:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RGwvF2083492; Tue, 27 Jul 2021 16:58:57 GMT (envelope-from git) Date: Tue, 27 Jul 2021 16:58:57 GMT Message-Id: <202107271658.16RGwvF2083492@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: d5b078163e0d - main - 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/main X-Git-Reftype: branch X-Git-Commit: d5b078163e0d6bb2fe36f8e49a44853908d5e2db 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, 27 Jul 2021 16:58:58 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=d5b078163e0d6bb2fe36f8e49a44853908d5e2db commit d5b078163e0d6bb2fe36f8e49a44853908d5e2db Author: Konstantin Belousov AuthorDate: 2021-07-20 00:53:08 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-27 16:58:47 +0000 null_bypass(): prevent loosing the only reference to the lower vnode 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 vhold around VOP call. Reported and tested by: pho Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31310 --- 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 0d5092f5e33d..47b0bda32b6b 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 Jul 27 16:58: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 9DF00663B5A; Tue, 27 Jul 2021 16:58: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 4GZ30g12vlz4n8P; Tue, 27 Jul 2021 16:58: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 052716707; Tue, 27 Jul 2021 16:58: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 16RGww0T083517; Tue, 27 Jul 2021 16:58:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RGwwT1083516; Tue, 27 Jul 2021 16:58:58 GMT (envelope-from git) Date: Tue, 27 Jul 2021 16:58:58 GMT Message-Id: <202107271658.16RGwwT1083516@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: 4f21442e10db - main - 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/main X-Git-Reftype: branch X-Git-Commit: 4f21442e10dbb22f1bd4c990dc0b1a2aa51231b9 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, 27 Jul 2021 16:58:59 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=4f21442e10dbb22f1bd4c990dc0b1a2aa51231b9 commit 4f21442e10dbb22f1bd4c990dc0b1a2aa51231b9 Author: Konstantin Belousov AuthorDate: 2021-07-21 13:19:51 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-27 16:58:47 +0000 null_lookup: restore dvp lock always, not only on success Caller of VOP_LOOKUP() passes dvp locked and expect it locked on return. Relock of lower vnode in any case could leave upper vnode reclaimed and unlocked. Reported and tested by: pho Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31310 --- 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 47b0bda32b6b..43dc325a79f5 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 Jul 27 16:59: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 93CC0663B61; Tue, 27 Jul 2021 16:59: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 4GZ30h2Y0Bz4nPf; Tue, 27 Jul 2021 16:59: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 289036708; Tue, 27 Jul 2021 16:59: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 16RGx0uc083541; Tue, 27 Jul 2021 16:59:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RGx0Sf083540; Tue, 27 Jul 2021 16:59:00 GMT (envelope-from git) Date: Tue, 27 Jul 2021 16:59:00 GMT Message-Id: <202107271659.16RGx0Sf083540@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: 10db1896495b - main - 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/main X-Git-Reftype: branch X-Git-Commit: 10db1896495b744aa5b039dd4ef1973b7a339379 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, 27 Jul 2021 16:59:00 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=10db1896495b744aa5b039dd4ef1973b7a339379 commit 10db1896495b744aa5b039dd4ef1973b7a339379 Author: Konstantin Belousov AuthorDate: 2021-07-22 10:27:43 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-27 16:58:47 +0000 fifofs: fifo vnode might be relocked before VOP_OPEN() is called Handle it in fifo_close by checking for v_fifoinfo == NULL Reported and tested by: pho Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31310 --- 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 Jul 27 16:59: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 0EC05663C9A; Tue, 27 Jul 2021 16:59: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 4GZ30j5nCGz4nPn; Tue, 27 Jul 2021 16:59: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 5AE0E6694; Tue, 27 Jul 2021 16:59: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 16RGx1qB083565; Tue, 27 Jul 2021 16:59:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RGx1q4083564; Tue, 27 Jul 2021 16:59:01 GMT (envelope-from git) Date: Tue, 27 Jul 2021 16:59:01 GMT Message-Id: <202107271659.16RGx1q4083564@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: 26e72728ce12 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 26e72728ce12c8670894435fcef8055a0ecb6266 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, 27 Jul 2021 16:59:02 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=26e72728ce12c8670894435fcef8055a0ecb6266 commit 26e72728ce12c8670894435fcef8055a0ecb6266 Author: Konstantin Belousov AuthorDate: 2021-07-24 14:46:51 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-27 16:58:47 +0000 null_rename: some style Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31310 --- 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 43dc325a79f5..ce67d2760418 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 Jul 27 16:59: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 DA3DD663B69; Tue, 27 Jul 2021 16:59: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 4GZ30k546Yz4nDB; Tue, 27 Jul 2021 16:59: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 64D096709; Tue, 27 Jul 2021 16:59: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 16RGx2Xo083594; Tue, 27 Jul 2021 16:59:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RGx2Tq083592; Tue, 27 Jul 2021 16:59:02 GMT (envelope-from git) Date: Tue, 27 Jul 2021 16:59:02 GMT Message-Id: <202107271659.16RGx2Tq083592@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: 4eaf9609fe42 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 4eaf9609fe42878eccaaf5fe1873f792074a62e4 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, 27 Jul 2021 16:59:03 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=4eaf9609fe42878eccaaf5fe1873f792074a62e4 commit 4eaf9609fe42878eccaaf5fe1873f792074a62e4 Author: Konstantin Belousov AuthorDate: 2021-07-24 15:05:58 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-27 16:58:48 +0000 nullfs: provide custom null_rename bypass fdvp and fvp vnodes are not locked, and race with reclaim cannot be handled by the generic bypass routine. Reported and tested by: pho Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31310 --- 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 ce67d2760418..e3a320a22bfa 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 Jul 27 17:02: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 286866642DE; Tue, 27 Jul 2021 17:02: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 4GZ34M0XvBz4nld; Tue, 27 Jul 2021 17:02: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 EF38064D0; Tue, 27 Jul 2021 17:02: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 16RH2ALj094596; Tue, 27 Jul 2021 17:02:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RH2AOo094595; Tue, 27 Jul 2021 17:02:10 GMT (envelope-from git) Date: Tue, 27 Jul 2021 17:02:10 GMT Message-Id: <202107271702.16RH2AOo094595@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: d96f55bc7159 - main - 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/main X-Git-Reftype: branch X-Git-Commit: d96f55bc7159e8d018847abe5b1782d74c8aa415 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, 27 Jul 2021 17:02:11 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=d96f55bc7159e8d018847abe5b1782d74c8aa415 commit d96f55bc7159e8d018847abe5b1782d74c8aa415 Author: Konstantin Belousov AuthorDate: 2021-05-20 15:28:20 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-27 17:01:19 +0000 linuxkpi: remove global atomic counter of the task allocations Use thread_reap_barrier() to ensure that no threads are kept in the zombies list which could have the linuxkpi task allocated. Also fix order of initialization and teardown for current task allocation hooks and resources. Register current task allocator after zones are initialized. Deregister allocator before cycling over threads and zeroing task pointer. Reviewed by: hselasky, markj Sponsored by: Mellanox Technologies/NVidia Networking MFC after: 1 week Differential revision: https://reviews.freebsd.org/D30468 --- 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 Jul 27 17:04: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 4BB256646E7; Tue, 27 Jul 2021 17:04: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 4GZ37T1gl5z4nmJ; Tue, 27 Jul 2021 17:04: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 171C766B9; Tue, 27 Jul 2021 17:04: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 16RH4qHh097337; Tue, 27 Jul 2021 17:04:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RH4q6j097336; Tue, 27 Jul 2021 17:04:52 GMT (envelope-from git) Date: Tue, 27 Jul 2021 17:04:52 GMT Message-Id: <202107271704.16RH4q6j097336@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alan Somers Subject: git: 6b2266b050a6 - stable/12 - fusefs: support EVFILT_WRITE on /dev/fuse MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 6b2266b050a6e06f20c065323379eefc3b6ec2f5 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, 27 Jul 2021 17:04:53 -0000 The branch stable/12 has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=6b2266b050a6e06f20c065323379eefc3b6ec2f5 commit 6b2266b050a6e06f20c065323379eefc3b6ec2f5 Author: Alan Somers AuthorDate: 2021-06-15 23:17:28 +0000 Commit: Alan Somers CommitDate: 2021-07-27 17:03:38 +0000 fusefs: support EVFILT_WRITE on /dev/fuse /dev/fuse is always ready for writing, so it's kind of dumb to poll it. But some applications do it anyway. Better to return ready than EINVAL. Reviewed by: emaste, pfg Differential Revision: https://reviews.freebsd.org/D30784 (cherry picked from commit 7b8622fa220b9c08041102f638f848c48e022644) --- sys/fs/fuse/fuse_device.c | 22 +++++++++++++++++++++- tests/sys/fs/fusefs/mockfs.cc | 20 +++++++++++++++++--- 2 files changed, 38 insertions(+), 4 deletions(-) diff --git a/sys/fs/fuse/fuse_device.c b/sys/fs/fuse/fuse_device.c index 203da2c6f7ba..c918d593f1a4 100644 --- a/sys/fs/fuse/fuse_device.c +++ b/sys/fs/fuse/fuse_device.c @@ -116,6 +116,7 @@ static struct cdevsw fuse_device_cdevsw = { }; static int fuse_device_filt_read(struct knote *kn, long hint); +static int fuse_device_filt_write(struct knote *kn, long hint); static void fuse_device_filt_detach(struct knote *kn); struct filterops fuse_device_rfiltops = { @@ -124,6 +125,11 @@ struct filterops fuse_device_rfiltops = { .f_event = fuse_device_filt_read, }; +struct filterops fuse_device_wfiltops = { + .f_isfd = 1, + .f_event = fuse_device_filt_write, +}; + /**************************** * * >>> Fuse device op defs @@ -177,12 +183,14 @@ fuse_device_filter(struct cdev *dev, struct knote *kn) error = devfs_get_cdevpriv((void **)&data); - /* EVFILT_WRITE is not supported; the device is always ready to write */ if (error == 0 && kn->kn_filter == EVFILT_READ) { kn->kn_fop = &fuse_device_rfiltops; kn->kn_hook = data; knlist_add(&data->ks_rsel.si_note, kn, 0); error = 0; + } else if (error == 0 && kn->kn_filter == EVFILT_WRITE) { + kn->kn_fop = &fuse_device_wfiltops; + error = 0; } else if (error == 0) { error = EINVAL; kn->kn_data = error; @@ -228,6 +236,18 @@ fuse_device_filt_read(struct knote *kn, long hint) return (ready); } +static int +fuse_device_filt_write(struct knote *kn, long hint) +{ + int ready; + + /* The device is always ready to write */ + kn->kn_data = 0; + ready = 1; + + return (ready); +} + /* * Resources are set up on a per-open basis */ diff --git a/tests/sys/fs/fusefs/mockfs.cc b/tests/sys/fs/fusefs/mockfs.cc index f43afd247502..bbdd515f027d 100644 --- a/tests/sys/fs/fusefs/mockfs.cc +++ b/tests/sys/fs/fusefs/mockfs.cc @@ -820,8 +820,8 @@ void MockFS::read_request(mockfs_buf_in &in, ssize_t &res) { timeout_ts.tv_sec = 0; timeout_ts.tv_nsec = timeout_ms * 1'000'000; while (nready == 0) { - EV_SET(&changes[0], m_fuse_fd, EVFILT_READ, EV_ADD, 0, - 0, 0); + EV_SET(&changes[0], m_fuse_fd, EVFILT_READ, + EV_ADD | EV_ONESHOT, 0, 0, 0); nready = kevent(m_kq, &changes[0], 1, &events[0], 1, &timeout_ts); if (m_quit) @@ -883,12 +883,26 @@ void MockFS::read_request(mockfs_buf_in &in, ssize_t &res) { void MockFS::write_response(const mockfs_buf_out &out) { fd_set writefds; pollfd fds[1]; + struct kevent changes[1]; + struct kevent events[1]; int nready, nfds; ssize_t r; switch (m_pm) { case BLOCKING: - case KQ: /* EVFILT_WRITE is not supported */ + break; + case KQ: + EV_SET(&changes[0], m_fuse_fd, EVFILT_WRITE, + EV_ADD | EV_ONESHOT, 0, 0, 0); + nready = kevent(m_kq, &changes[0], 1, &events[0], 1, + NULL); + ASSERT_LE(0, nready) << strerror(errno); + ASSERT_EQ(events[0].ident, (uintptr_t)m_fuse_fd); + if (events[0].flags & EV_ERROR) + FAIL() << strerror(events[0].data); + else if (events[0].flags & EV_EOF) + FAIL() << strerror(events[0].fflags); + m_nready = events[0].data; break; case POLL: fds[0].fd = m_fuse_fd; From owner-dev-commits-src-all@freebsd.org Tue Jul 27 17:04: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 674E86644F3; Tue, 27 Jul 2021 17:04: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 4GZ37V2N7Bz4p5q; Tue, 27 Jul 2021 17:04: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 39DBA65A6; Tue, 27 Jul 2021 17:04: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 16RH4s23097362; Tue, 27 Jul 2021 17:04:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RH4sMX097361; Tue, 27 Jul 2021 17:04:54 GMT (envelope-from git) Date: Tue, 27 Jul 2021 17:04:54 GMT Message-Id: <202107271704.16RH4sMX097361@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alan Somers Subject: git: 3acfa48d1211 - stable/12 - Simplify fuse_device_filt_write MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 3acfa48d1211ef7dd2c3970ac121f0e679da567b 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, 27 Jul 2021 17:04:54 -0000 The branch stable/12 has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=3acfa48d1211ef7dd2c3970ac121f0e679da567b commit 3acfa48d1211ef7dd2c3970ac121f0e679da567b Author: gAlfonso-bit <83477269+gAlfonso-bit@users.noreply.github.com> AuthorDate: 2021-06-16 19:45:04 +0000 Commit: Alan Somers CommitDate: 2021-07-27 17:03:42 +0000 Simplify fuse_device_filt_write It always returns 1, so why bother having a variable. Pull Request: https://github.com/freebsd/freebsd-src/pull/478 (cherry picked from commit 9b876fbd504e5c718d8d0275b32d806ab14558c8) --- sys/fs/fuse/fuse_device.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/sys/fs/fuse/fuse_device.c b/sys/fs/fuse/fuse_device.c index c918d593f1a4..3022f8a1aa5b 100644 --- a/sys/fs/fuse/fuse_device.c +++ b/sys/fs/fuse/fuse_device.c @@ -239,13 +239,11 @@ fuse_device_filt_read(struct knote *kn, long hint) static int fuse_device_filt_write(struct knote *kn, long hint) { - int ready; - /* The device is always ready to write */ kn->kn_data = 0; - ready = 1; - return (ready); + /* The device is always ready to write, so we return 1*/ + return (1); } /* From owner-dev-commits-src-all@freebsd.org Tue Jul 27 17:04: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 B7BA9664826; Tue, 27 Jul 2021 17:04: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 4GZ37W4H5Yz4nvt; Tue, 27 Jul 2021 17:04: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 6EF976649; Tue, 27 Jul 2021 17:04: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 16RH4teq097386; Tue, 27 Jul 2021 17:04:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RH4tD9097385; Tue, 27 Jul 2021 17:04:55 GMT (envelope-from git) Date: Tue, 27 Jul 2021 17:04:55 GMT Message-Id: <202107271704.16RH4tD9097385@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alan Somers Subject: git: 0272e88a2e59 - stable/12 - fusefs: delete dead code MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 0272e88a2e59c1a2443bb78265fc43fe769fbdb1 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, 27 Jul 2021 17:04:55 -0000 The branch stable/12 has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=0272e88a2e59c1a2443bb78265fc43fe769fbdb1 commit 0272e88a2e59c1a2443bb78265fc43fe769fbdb1 Author: Alan Somers AuthorDate: 2021-06-18 00:14:57 +0000 Commit: Alan Somers CommitDate: 2021-07-27 17:03:47 +0000 fusefs: delete dead code It was always dead, accidentally included in SVN r345876. Reviewed by: pfg (cherry picked from commit b97c7abc1a1cee72ef62109add860c1e8e618efd) --- sys/fs/fuse/fuse_ipc.c | 6 ------ sys/fs/fuse/fuse_ipc.h | 2 -- 2 files changed, 8 deletions(-) diff --git a/sys/fs/fuse/fuse_ipc.c b/sys/fs/fuse/fuse_ipc.c index e3be63b9d6d4..4c2acfbd87c6 100644 --- a/sys/fs/fuse/fuse_ipc.c +++ b/sys/fs/fuse/fuse_ipc.c @@ -998,12 +998,6 @@ fdisp_refresh_vp(struct fuse_dispatcher *fdip, enum fuse_opcode op, td->td_proc->p_pid, cred); } -void -fdisp_refresh(struct fuse_dispatcher *fdip) -{ - fticket_refresh(fdip->tick); -} - SDT_PROBE_DEFINE2(fusefs, , ipc, fdisp_wait_answ_error, "char*", "int"); int diff --git a/sys/fs/fuse/fuse_ipc.h b/sys/fs/fuse/fuse_ipc.h index 8e041529e119..ea2eef2ea978 100644 --- a/sys/fs/fuse/fuse_ipc.h +++ b/sys/fs/fuse/fuse_ipc.h @@ -410,8 +410,6 @@ fdisp_destroy(struct fuse_dispatcher *fdisp) #endif } -void fdisp_refresh(struct fuse_dispatcher *fdip); - void fdisp_make(struct fuse_dispatcher *fdip, enum fuse_opcode op, struct mount *mp, uint64_t nid, struct thread *td, struct ucred *cred); From owner-dev-commits-src-all@freebsd.org Tue Jul 27 17:04: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 23607664753; Tue, 27 Jul 2021 17:04: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 4GZ37X4DJYz4npM; Tue, 27 Jul 2021 17:04: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 7554066BA; Tue, 27 Jul 2021 17:04: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 16RH4u5q097410; Tue, 27 Jul 2021 17:04:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RH4u1H097409; Tue, 27 Jul 2021 17:04:56 GMT (envelope-from git) Date: Tue, 27 Jul 2021 17:04:56 GMT Message-Id: <202107271704.16RH4u1H097409@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alan Somers Subject: git: 140aa8fff56c - stable/12 - fusefs: also debug INIT operations in the test suite MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 140aa8fff56c09e95f11320eec7a6b89093b8d00 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, 27 Jul 2021 17:04:57 -0000 The branch stable/12 has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=140aa8fff56c09e95f11320eec7a6b89093b8d00 commit 140aa8fff56c09e95f11320eec7a6b89093b8d00 Author: Alan Somers AuthorDate: 2021-06-17 22:06:43 +0000 Commit: Alan Somers CommitDate: 2021-07-27 17:03:49 +0000 fusefs: also debug INIT operations in the test suite Reviewed by: pfg (cherry picked from commit 77b040c993ba9d4844e36f1f5b057066a5b4015a) --- tests/sys/fs/fusefs/mockfs.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/sys/fs/fusefs/mockfs.cc b/tests/sys/fs/fusefs/mockfs.cc index bbdd515f027d..da634b5f15cd 100644 --- a/tests/sys/fs/fusefs/mockfs.cc +++ b/tests/sys/fs/fusefs/mockfs.cc @@ -655,6 +655,8 @@ void MockFS::init(uint32_t flags) { std::unique_ptr out(new mockfs_buf_out); read_request(*in, buflen); + if (verbosity > 0) + debug_request(*in, buflen); audit_request(*in, buflen); ASSERT_EQ(FUSE_INIT, in->header.opcode); From owner-dev-commits-src-all@freebsd.org Tue Jul 27 17:15: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 F3037664B22; Tue, 27 Jul 2021 17:15: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 4GZ3MW6S8Vz4pZm; Tue, 27 Jul 2021 17:15: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 C581467D9; Tue, 27 Jul 2021 17:15: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 16RHFJBG010736; Tue, 27 Jul 2021 17:15:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RHFJPe010735; Tue, 27 Jul 2021 17:15:19 GMT (envelope-from git) Date: Tue, 27 Jul 2021 17:15:19 GMT Message-Id: <202107271715.16RHFJPe010735@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alan Somers Subject: git: 43f57e98d032 - stable/12 - fusefs: delete some dead code MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 43f57e98d032414a313f1871b805d8f07a5c416d 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, 27 Jul 2021 17:15:20 -0000 The branch stable/12 has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=43f57e98d032414a313f1871b805d8f07a5c416d commit 43f57e98d032414a313f1871b805d8f07a5c416d Author: Alan Somers AuthorDate: 2020-12-24 19:21:00 +0000 Commit: Alan Somers CommitDate: 2021-07-27 17:10:47 +0000 fusefs: delete some dead code The original fusefs GSoC project seems to have envisioned exchanging two types of messages with FUSE servers. Perhaps vectored and non-vectored? But in practice only one type has ever been used. Delete the other type. Reviewed by: cem Differential Revision: https://reviews.freebsd.org/D27770 (cherry picked from commit 4f4111d2c5ab64591b9e15dab4257d8187458fd1) --- sys/fs/fuse/fuse_device.c | 64 ++++++++++++++++------------------------------- sys/fs/fuse/fuse_ipc.c | 33 ++---------------------- sys/fs/fuse/fuse_ipc.h | 7 ------ 3 files changed, 24 insertions(+), 80 deletions(-) diff --git a/sys/fs/fuse/fuse_device.c b/sys/fs/fuse/fuse_device.c index 3022f8a1aa5b..c634f903e519 100644 --- a/sys/fs/fuse/fuse_device.c +++ b/sys/fs/fuse/fuse_device.c @@ -302,9 +302,8 @@ fuse_device_read(struct cdev *dev, struct uio *uio, int ioflag) int err; struct fuse_data *data; struct fuse_ticket *tick; - void *buf[] = {NULL, NULL, NULL}; - int buflen[3]; - int i; + void *buf; + int buflen; SDT_PROBE2(fusefs, , device, trace, 1, "fuse device read"); @@ -367,46 +366,27 @@ again: SDT_PROBE2(fusefs, , device, trace, 1, "fuse device read message successfully"); - KASSERT(tick->tk_ms_bufdata || tick->tk_ms_bufsize == 0, - ("non-null buf pointer with positive size")); - - switch (tick->tk_ms_type) { - case FT_M_FIOV: - buf[0] = tick->tk_ms_fiov.base; - buflen[0] = tick->tk_ms_fiov.len; - break; - case FT_M_BUF: - buf[0] = tick->tk_ms_fiov.base; - buflen[0] = tick->tk_ms_fiov.len; - buf[1] = tick->tk_ms_bufdata; - buflen[1] = tick->tk_ms_bufsize; - break; - default: - panic("unknown message type for fuse_ticket %p", tick); - } + buf = tick->tk_ms_fiov.base; + buflen = tick->tk_ms_fiov.len; - for (i = 0; buf[i]; i++) { - /* - * Why not ban mercilessly stupid daemons who can't keep up - * with us? (There is no much use of a partial read here...) - */ - /* - * XXX note that in such cases Linux FUSE throws EIO at the - * syscall invoker and stands back to the message queue. The - * rationale should be made clear (and possibly adopt that - * behaviour). Keeping the current scheme at least makes - * fallacy as loud as possible... - */ - if (uio->uio_resid < buflen[i]) { - fdata_set_dead(data); - SDT_PROBE2(fusefs, , device, trace, 2, - "daemon is stupid, kick it off..."); - err = ENODEV; - break; - } - err = uiomove(buf[i], buflen[i], uio); - if (err) - break; + /* + * Why not ban mercilessly stupid daemons who can't keep up + * with us? (There is no much use of a partial read here...) + */ + /* + * XXX note that in such cases Linux FUSE throws EIO at the + * syscall invoker and stands back to the message queue. The + * rationale should be made clear (and possibly adopt that + * behaviour). Keeping the current scheme at least makes + * fallacy as loud as possible... + */ + if (uio->uio_resid < buflen) { + fdata_set_dead(data); + SDT_PROBE2(fusefs, , device, trace, 2, + "daemon is stupid, kick it off..."); + err = ENODEV; + } else { + err = uiomove(buf, buflen, uio); } FUSE_ASSERT_MS_DONE(tick); diff --git a/sys/fs/fuse/fuse_ipc.c b/sys/fs/fuse/fuse_ipc.c index 4c2acfbd87c6..73378dee959a 100644 --- a/sys/fs/fuse/fuse_ipc.c +++ b/sys/fs/fuse/fuse_ipc.c @@ -357,11 +357,9 @@ fticket_init(void *mem, int size, int flags) bzero(ftick, sizeof(struct fuse_ticket)); fiov_init(&ftick->tk_ms_fiov, sizeof(struct fuse_in_header)); - ftick->tk_ms_type = FT_M_FIOV; mtx_init(&ftick->tk_aw_mtx, "fuse answer delivery mutex", NULL, MTX_DEF); fiov_init(&ftick->tk_aw_fiov, 0); - ftick->tk_aw_type = FT_A_FIOV; return 0; } @@ -396,18 +394,11 @@ fticket_refresh(struct fuse_ticket *ftick) FUSE_ASSERT_AW_DONE(ftick); fiov_refresh(&ftick->tk_ms_fiov); - ftick->tk_ms_bufdata = NULL; - ftick->tk_ms_bufsize = 0; - ftick->tk_ms_type = FT_M_FIOV; bzero(&ftick->tk_aw_ohead, sizeof(struct fuse_out_header)); fiov_refresh(&ftick->tk_aw_fiov); ftick->tk_aw_errno = 0; - ftick->tk_aw_bufdata = NULL; - ftick->tk_aw_bufsize = 0; - ftick->tk_aw_type = FT_A_FIOV; - ftick->tk_flag = 0; } @@ -418,17 +409,9 @@ fticket_reset(struct fuse_ticket *ftick) FUSE_ASSERT_MS_DONE(ftick); FUSE_ASSERT_AW_DONE(ftick); - ftick->tk_ms_bufdata = NULL; - ftick->tk_ms_bufsize = 0; - ftick->tk_ms_type = FT_M_FIOV; - bzero(&ftick->tk_aw_ohead, sizeof(struct fuse_out_header)); ftick->tk_aw_errno = 0; - ftick->tk_aw_bufdata = NULL; - ftick->tk_aw_bufsize = 0; - ftick->tk_aw_type = FT_A_FIOV; - ftick->tk_flag = 0; } @@ -547,20 +530,8 @@ fticket_aw_pull_uio(struct fuse_ticket *ftick, struct uio *uio) size_t len = uio_resid(uio); if (len) { - switch (ftick->tk_aw_type) { - case FT_A_FIOV: - fiov_adjust(fticket_resp(ftick), len); - err = uiomove(fticket_resp(ftick)->base, len, uio); - break; - - case FT_A_BUF: - ftick->tk_aw_bufsize = len; - err = uiomove(ftick->tk_aw_bufdata, len, uio); - break; - - default: - panic("FUSE: unknown answer type for ticket %p", ftick); - } + fiov_adjust(fticket_resp(ftick), len); + err = uiomove(fticket_resp(ftick)->base, len, uio); } return err; } diff --git a/sys/fs/fuse/fuse_ipc.h b/sys/fs/fuse/fuse_ipc.h index ea2eef2ea978..980fb2541ca1 100644 --- a/sys/fs/fuse/fuse_ipc.h +++ b/sys/fs/fuse/fuse_ipc.h @@ -123,17 +123,10 @@ struct fuse_ticket { /* fields for initiating an upgoing message */ struct fuse_iov tk_ms_fiov; - void *tk_ms_bufdata; - size_t tk_ms_bufsize; - enum { FT_M_FIOV, FT_M_BUF } tk_ms_type; STAILQ_ENTRY(fuse_ticket) tk_ms_link; /* fields for handling answers coming from userspace */ struct fuse_iov tk_aw_fiov; - void *tk_aw_bufdata; - size_t tk_aw_bufsize; - enum { FT_A_FIOV, FT_A_BUF } tk_aw_type; - struct fuse_out_header tk_aw_ohead; int tk_aw_errno; struct mtx tk_aw_mtx; From owner-dev-commits-src-all@freebsd.org Tue Jul 27 17:20: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 8E47A664F8A; Tue, 27 Jul 2021 17:20: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 4GZ3Sz3STgz4pYB; Tue, 27 Jul 2021 17:20: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 501DD66E5; Tue, 27 Jul 2021 17:20: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 16RHK3lE013285; Tue, 27 Jul 2021 17:20:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RHK3i8013282; Tue, 27 Jul 2021 17:20:03 GMT (envelope-from git) Date: Tue, 27 Jul 2021 17:20:03 GMT Message-Id: <202107271720.16RHK3i8013282@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: d6717f877872 - main - amd64: rework AP startup 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: d6717f877872e62d9df1e0ce2d8856620c993924 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, 27 Jul 2021 17:20:03 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=d6717f877872e62d9df1e0ce2d8856620c993924 commit d6717f877872e62d9df1e0ce2d8856620c993924 Author: Konstantin Belousov AuthorDate: 2021-07-10 19:38:42 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-27 17:11:15 +0000 amd64: rework AP startup Stop using temporal page table with 1:1 mapping of low 1G populated over the whole VA. Use 1:1 mapping of low 4G temporarily installed in the normal kernel page table. The features are: - now there is one less step for startup asm to perform - the startup code still needs to be at lower 1G because CPU starts in real mode. But everything else can be located anywhere in low 4G because it is accessed by non-paged 32bit protected mode. Note that kernel page table root page is at low 4G, as well as the kernel itself. - the page table pages can be allocated by normal allocator, there is no need to carve them from the phys_avail segments at very early time. The allocation of the page for startup code still requires some magic. Pages are freed after APs are ignited. - la57 startup for APs is less tricky, we directly load the final page table and do not need to tweak the paging mode. Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31121 --- sys/amd64/amd64/machdep.c | 2 +- sys/amd64/amd64/mp_machdep.c | 187 ++++++++++++++++--------------------------- sys/amd64/amd64/mpboot.S | 64 +++++++-------- sys/amd64/include/smp.h | 1 - sys/x86/x86/mp_x86.c | 5 -- 5 files changed, 95 insertions(+), 164 deletions(-) diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index 1bd2c8c0afe0..49e245e1fdfe 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -1279,7 +1279,7 @@ getmemsize(caddr_t kmdp, u_int64_t first) * in real mode mode (e.g. SMP bare metal). */ #ifdef SMP - mp_bootaddress(physmap, &physmap_idx); + alloc_ap_trampoline(physmap, &physmap_idx); #endif /* call pmap initialization to make new kernel address space */ diff --git a/sys/amd64/amd64/mp_machdep.c b/sys/amd64/amd64/mp_machdep.c index 886ea3734a3f..df0270c543e6 100644 --- a/sys/amd64/amd64/mp_machdep.c +++ b/sys/amd64/amd64/mp_machdep.c @@ -105,6 +105,7 @@ static char *nmi_stack; static char *dbg_stack; extern u_int mptramp_la57; +extern u_int mptramp_nx; /* * Local data and functions. @@ -112,86 +113,6 @@ extern u_int mptramp_la57; static int start_ap(int apic_id); -static bool -is_kernel_paddr(vm_paddr_t pa) -{ - - return (pa >= trunc_2mpage(btext - KERNBASE) && - pa < round_page(_end - KERNBASE)); -} - -static bool -is_mpboot_good(vm_paddr_t start, vm_paddr_t end) -{ - - return (start + AP_BOOTPT_SZ <= GiB(4) && atop(end) < Maxmem); -} - -/* - * Calculate usable address in base memory for AP trampoline code. - */ -void -mp_bootaddress(vm_paddr_t *physmap, unsigned int *physmap_idx) -{ - vm_paddr_t start, end; - unsigned int i; - bool allocated; - - alloc_ap_trampoline(physmap, physmap_idx); - - /* - * Find a memory region big enough below the 4GB boundary to - * store the initial page tables. Region must be mapped by - * the direct map. - * - * Note that it needs to be aligned to a page boundary. - */ - allocated = false; - for (i = *physmap_idx; i <= *physmap_idx; i -= 2) { - /* - * First, try to chomp at the start of the physmap region. - * Kernel binary might claim it already. - */ - start = round_page(physmap[i]); - end = start + AP_BOOTPT_SZ; - if (start < end && end <= physmap[i + 1] && - is_mpboot_good(start, end) && - !is_kernel_paddr(start) && !is_kernel_paddr(end - 1)) { - allocated = true; - physmap[i] = end; - break; - } - - /* - * Second, try to chomp at the end. Again, check - * against kernel. - */ - end = trunc_page(physmap[i + 1]); - start = end - AP_BOOTPT_SZ; - if (start < end && start >= physmap[i] && - is_mpboot_good(start, end) && - !is_kernel_paddr(start) && !is_kernel_paddr(end - 1)) { - allocated = true; - physmap[i + 1] = start; - break; - } - } - if (allocated) { - mptramp_pagetables = start; - if (physmap[i] == physmap[i + 1] && *physmap_idx != 0) { - memmove(&physmap[i], &physmap[i + 2], - sizeof(*physmap) * (*physmap_idx - i + 2)); - *physmap_idx -= 2; - } - } else { - mptramp_pagetables = trunc_page(boot_address) - AP_BOOTPT_SZ; - if (bootverbose) - printf( -"Cannot find enough space for the initial AP page tables, placing them at %#x", - mptramp_pagetables); - } -} - /* * Initialize the IPI handlers and start up the AP's. */ @@ -243,6 +164,9 @@ cpu_mp_start(void) assign_cpu_ids(); mptramp_la57 = la57; + mptramp_nx = pg_nx != 0; + MPASS(kernel_pmap->pm_cr3 < (1UL << 32)); + mptramp_pagetables = kernel_pmap->pm_cr3; /* Start each Application Processor */ start_all_aps(); @@ -399,55 +323,67 @@ mp_realloc_pcpu(int cpuid, int domain) int start_all_aps(void) { - u_int64_t *pt5, *pt4, *pt3, *pt2; + vm_page_t m_pml4, m_pdp, m_pd[4]; + pml5_entry_t old_pml45; + pml4_entry_t *v_pml4; + pdp_entry_t *v_pdp; + pd_entry_t *v_pd; u_int32_t mpbioswarmvec; - int apic_id, cpu, domain, i, xo; + int apic_id, cpu, domain, i; u_char mpbiosreason; mtx_init(&ap_boot_mtx, "ap boot", NULL, MTX_SPIN); - /* copy the AP 1st level boot code */ - bcopy(mptramp_start, (void *)PHYS_TO_DMAP(boot_address), bootMP_size); - - /* Locate the page tables, they'll be below the trampoline */ + /* Create a transient 1:1 mapping of low 4G */ if (la57) { - pt5 = (uint64_t *)PHYS_TO_DMAP(mptramp_pagetables); - xo = 1; + m_pml4 = pmap_page_alloc_below_4g(true); + v_pml4 = (pml4_entry_t *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m_pml4)); } else { - xo = 0; + v_pml4 = &kernel_pmap->pm_pmltop[0]; } - pt4 = (uint64_t *)PHYS_TO_DMAP(mptramp_pagetables + xo * PAGE_SIZE); - pt3 = pt4 + (PAGE_SIZE) / sizeof(u_int64_t); - pt2 = pt3 + (PAGE_SIZE) / sizeof(u_int64_t); - - /* Create the initial 1GB replicated page tables */ - for (i = 0; i < 512; i++) { - if (la57) { - pt5[i] = (u_int64_t)(uintptr_t)(mptramp_pagetables + - PAGE_SIZE); - pt5[i] |= PG_V | PG_RW | PG_U; - } - - /* - * Each slot of the level 4 pages points to the same - * level 3 page. - */ - pt4[i] = (u_int64_t)(uintptr_t)(mptramp_pagetables + - (xo + 1) * PAGE_SIZE); - pt4[i] |= PG_V | PG_RW | PG_U; - - /* - * Each slot of the level 3 pages points to the same - * level 2 page. - */ - pt3[i] = (u_int64_t)(uintptr_t)(mptramp_pagetables + - ((xo + 2) * PAGE_SIZE)); - pt3[i] |= PG_V | PG_RW | PG_U; - - /* The level 2 page slots are mapped with 2MB pages for 1GB. */ - pt2[i] = i * (2 * 1024 * 1024); - pt2[i] |= PG_V | PG_RW | PG_PS | PG_U; + m_pdp = pmap_page_alloc_below_4g(true); + v_pdp = (pdp_entry_t *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m_pdp)); + m_pd[0] = pmap_page_alloc_below_4g(false); + v_pd = (pd_entry_t *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m_pd[0])); + for (i = 0; i < NPDEPG; i++) + v_pd[i] = (i << PDRSHIFT) | X86_PG_V | X86_PG_RW | X86_PG_A | + X86_PG_M | PG_PS; + m_pd[1] = pmap_page_alloc_below_4g(false); + v_pd = (pd_entry_t *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m_pd[1])); + for (i = 0; i < NPDEPG; i++) + v_pd[i] = (NBPDP + (i << PDRSHIFT)) | X86_PG_V | X86_PG_RW | + X86_PG_A | X86_PG_M | PG_PS; + m_pd[2] = pmap_page_alloc_below_4g(false); + v_pd = (pd_entry_t *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m_pd[2])); + for (i = 0; i < NPDEPG; i++) + v_pd[i] = (2UL * NBPDP + (i << PDRSHIFT)) | X86_PG_V | + X86_PG_RW | X86_PG_A | X86_PG_M | PG_PS; + m_pd[3] = pmap_page_alloc_below_4g(false); + v_pd = (pd_entry_t *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m_pd[3])); + for (i = 0; i < NPDEPG; i++) + v_pd[i] = (3UL * NBPDP + (i << PDRSHIFT)) | X86_PG_V | + X86_PG_RW | X86_PG_A | X86_PG_M | PG_PS; + v_pdp[0] = VM_PAGE_TO_PHYS(m_pd[0]) | X86_PG_V | + X86_PG_RW | X86_PG_A | X86_PG_M; + v_pdp[1] = VM_PAGE_TO_PHYS(m_pd[1]) | X86_PG_V | + X86_PG_RW | X86_PG_A | X86_PG_M; + v_pdp[2] = VM_PAGE_TO_PHYS(m_pd[2]) | X86_PG_V | + X86_PG_RW | X86_PG_A | X86_PG_M; + v_pdp[3] = VM_PAGE_TO_PHYS(m_pd[3]) | X86_PG_V | + X86_PG_RW | X86_PG_A | X86_PG_M; + old_pml45 = kernel_pmap->pm_pmltop[0]; + if (la57) { + kernel_pmap->pm_pmltop[0] = VM_PAGE_TO_PHYS(m_pml4) | + X86_PG_V | X86_PG_RW | X86_PG_A | X86_PG_M; } + v_pml4[0] = VM_PAGE_TO_PHYS(m_pdp) | X86_PG_V | + X86_PG_RW | X86_PG_A | X86_PG_M; + pmap_invalidate_all(kernel_pmap); + + /* copy the AP 1st level boot code */ + bcopy(mptramp_start, (void *)PHYS_TO_DMAP(boot_address), bootMP_size); + if (bootverbose) + printf("AP boot address %#x\n", boot_address); /* save the current value of the warm-start vector */ if (!efi_boot) @@ -515,6 +451,17 @@ start_all_aps(void) outb(CMOS_REG, BIOS_RESET); outb(CMOS_DATA, mpbiosreason); + /* Destroy transient 1:1 mapping */ + kernel_pmap->pm_pmltop[0] = old_pml45; + invlpg(0); + if (la57) + vm_page_free(m_pml4); + vm_page_free(m_pd[3]); + vm_page_free(m_pd[2]); + vm_page_free(m_pd[1]); + vm_page_free(m_pd[0]); + vm_page_free(m_pdp); + /* number of APs actually started */ return (mp_naps); } diff --git a/sys/amd64/amd64/mpboot.S b/sys/amd64/amd64/mpboot.S index e525102b5d3d..b6c599a2aff3 100644 --- a/sys/amd64/amd64/mpboot.S +++ b/sys/amd64/amd64/mpboot.S @@ -95,12 +95,25 @@ protmode: * is later enabled. */ mov %cr4, %eax - orl $CR4_PAE, %eax + orl $(CR4_PAE | CR4_PGE), %eax cmpb $0, mptramp_la57-mptramp_start(%ebx) je 1f orl $CR4_LA57, %eax 1: mov %eax, %cr4 + /* + * If the BSP reported NXE support, enable EFER.NXE for all APs + * prior to loading %cr3. This avoids page faults if the AP + * encounters memory marked with the NX bit prior to detecting and + * enabling NXE support. + */ + cmpb $0,mptramp_nx-mptramp_start(%ebx) + je 2f + movl $MSR_EFER, %ecx + rdmsr + orl $EFER_NXE, %eax + wrmsr +2: /* * Enable EFER.LME so that we get long mode when all the prereqs are * in place. In this case, it turns on when CR0_PG is finally enabled. @@ -112,12 +125,13 @@ protmode: wrmsr /* - * Point to the embedded page tables for startup. Note that this - * only gets accessed after we're actually in 64 bit mode, however - * we can only set the bottom 32 bits of %cr3 in this state. This - * means we are required to use a temporary page table that is below - * the 4GB limit. %ebx is still our relocation base. We could just - * subtract 3 * PAGE_SIZE, but that would be too easy. + * Load kernel page table pointer into %cr3. + * %ebx is still our relocation base. + * + * Note that this only gets accessed after we're actually in 64 bit + * mode, however we can only set the bottom 32 bits of %cr3 in this + * state. This means we depend on the kernel page table being + * allocated from the low 4G. */ leal mptramp_pagetables-mptramp_start(%ebx),%eax movl (%eax), %eax @@ -155,10 +169,8 @@ jmp_64: /* * Yeehar! We're running in 64 bit mode! We can mostly ignore our * segment registers, and get on with it. - * Note that we are running at the correct virtual address, but with - * a 1:1 1GB mirrored mapping over entire address space. We had better - * switch to a real %cr3 promptly so that we can get to the direct map - * space. Remember that jmp is relative and that we've been relocated, + * We are running at the correct virtual address space. + * Note that the jmp is relative and that we've been relocated, * so use an indirect jump. */ .code64 @@ -220,6 +232,10 @@ mptramp_pagetables: mptramp_la57: .long 0 + .globl mptramp_nx +mptramp_nx: + .long 0 + /* * The pseudo descriptor for lgdt to use. */ @@ -243,31 +259,5 @@ bootMP_size: .code64 .p2align 4,0 entry_64: - /* - * If the BSP reported NXE support, enable EFER.NXE for all APs - * prior to loading %cr3. This avoids page faults if the AP - * encounters memory marked with the NX bit prior to detecting and - * enabling NXE support. - */ - movq pg_nx, %rbx - testq %rbx, %rbx - je 1f - movl $MSR_EFER, %ecx - rdmsr - orl $EFER_NXE, %eax - wrmsr - -1: - /* - * Load a real %cr3 that has all the direct map stuff and switches - * off the 1GB replicated mirror. Load a stack pointer and jump - * into AP startup code in C. - */ - cmpl $0, la57 - jne 2f - movq KPML4phys, %rax - jmp 3f -2: movq KPML5phys, %rax -3: movq %rax, %cr3 movq bootSTK, %rsp jmp init_secondary diff --git a/sys/amd64/include/smp.h b/sys/amd64/include/smp.h index ac9ed5f61a23..cb8bbdcd7260 100644 --- a/sys/amd64/include/smp.h +++ b/sys/amd64/include/smp.h @@ -39,7 +39,6 @@ inthand_t void invlop_handler(void); int start_all_aps(void); -void mp_bootaddress(vm_paddr_t *, unsigned int *); #endif /* !LOCORE */ #endif /* SMP */ diff --git a/sys/x86/x86/mp_x86.c b/sys/x86/x86/mp_x86.c index 1f22b3a7886a..c98ac12a7c3f 100644 --- a/sys/x86/x86/mp_x86.c +++ b/sys/x86/x86/mp_x86.c @@ -1065,11 +1065,6 @@ init_secondary_tail(void) } #ifdef __amd64__ - /* - * Enable global pages TLB extension - * This also implicitly flushes the TLB - */ - load_cr4(rcr4() | CR4_PGE); if (pmap_pcid_enabled) load_cr4(rcr4() | CR4_PCIDE); load_ds(_udatasel); From owner-dev-commits-src-all@freebsd.org Tue Jul 27 17:33: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 48EED6659EA; Tue, 27 Jul 2021 17:33: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 4GZ3my1NXPz4qVD; Tue, 27 Jul 2021 17:33: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 16F1865F3; Tue, 27 Jul 2021 17:33: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 16RHXruP037488; Tue, 27 Jul 2021 17:33:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RHXr9Z037487; Tue, 27 Jul 2021 17:33:53 GMT (envelope-from git) Date: Tue, 27 Jul 2021 17:33:53 GMT Message-Id: <202107271733.16RHXr9Z037487@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alan Somers Subject: git: 46138f337bd8 - stable/12 - fusefs: ensure that FUSE ops' headers' unique values are actually unique MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 46138f337bd803f6546d0eae8b9b0f3879ca3224 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, 27 Jul 2021 17:33:54 -0000 The branch stable/12 has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=46138f337bd803f6546d0eae8b9b0f3879ca3224 commit 46138f337bd803f6546d0eae8b9b0f3879ca3224 Author: Alan Somers AuthorDate: 2021-06-18 00:04:59 +0000 Commit: Alan Somers CommitDate: 2021-07-27 17:15:40 +0000 fusefs: ensure that FUSE ops' headers' unique values are actually unique Every FUSE operation has a unique value in its header. As the name implies, these values are supposed to be unique among all outstanding operations. And since FUSE_INTERRUPT is asynchronous and racy, it is desirable that the unique values be unique among all operations that are "close in time". Ensure that they are actually unique by incrementing them whenever we reuse a fuse_dispatcher object, for example during fsync, write, and listextattr. PR: 244686 Reviewed by: pfg Differential Revision: https://reviews.freebsd.org/D30810 (cherry picked from commit 5403f2c163f7e3d1adb9431d216f88d57cf9d74b) --- sys/fs/fuse/fuse_ipc.c | 34 ++++++++++++++-------------------- tests/sys/fs/fusefs/mockfs.cc | 9 +++++++++ tests/sys/fs/fusefs/mockfs.hh | 3 +++ 3 files changed, 26 insertions(+), 20 deletions(-) diff --git a/sys/fs/fuse/fuse_ipc.c b/sys/fs/fuse/fuse_ipc.c index 73378dee959a..d871b7455450 100644 --- a/sys/fs/fuse/fuse_ipc.c +++ b/sys/fs/fuse/fuse_ipc.c @@ -103,6 +103,7 @@ static void fdisp_make_pid(struct fuse_dispatcher *fdip, enum fuse_opcode op, static void fuse_interrupt_send(struct fuse_ticket *otick, int err); static struct fuse_ticket *fticket_alloc(struct fuse_data *data); static void fticket_refresh(struct fuse_ticket *ftick); +static inline void fticket_reset(struct fuse_ticket *ftick); static void fticket_destroy(struct fuse_ticket *ftick); static int fticket_wait_answer(struct fuse_ticket *ftick); static inline int @@ -319,20 +320,12 @@ fticket_ctor(void *mem, int size, void *arg, int flags) FUSE_ASSERT_AW_DONE(ftick); ftick->tk_data = data; - - if (ftick->tk_unique != 0) - fticket_refresh(ftick); - - /* May be truncated to 32 bits */ - ftick->tk_unique = atomic_fetchadd_long(&data->ticketer, 1); - if (ftick->tk_unique == 0) - ftick->tk_unique = atomic_fetchadd_long(&data->ticketer, 1); - ftick->irq_unique = 0; - refcount_init(&ftick->tk_refcount, 1); counter_u64_add(fuse_ticket_count, 1); + fticket_refresh(ftick); + return 0; } @@ -386,26 +379,22 @@ fticket_destroy(struct fuse_ticket *ftick) return uma_zfree(ticket_zone, ftick); } -static inline -void +/* Prepare the ticket to be reused and clear its data buffers */ +static inline void fticket_refresh(struct fuse_ticket *ftick) { - FUSE_ASSERT_MS_DONE(ftick); - FUSE_ASSERT_AW_DONE(ftick); + fticket_reset(ftick); fiov_refresh(&ftick->tk_ms_fiov); - - bzero(&ftick->tk_aw_ohead, sizeof(struct fuse_out_header)); - fiov_refresh(&ftick->tk_aw_fiov); - ftick->tk_aw_errno = 0; - ftick->tk_flag = 0; } -/* Prepar the ticket to be reused, but don't clear its data buffers */ +/* Prepare the ticket to be reused, but don't clear its data buffers */ static inline void fticket_reset(struct fuse_ticket *ftick) { + struct fuse_data *data = ftick->tk_data; + FUSE_ASSERT_MS_DONE(ftick); FUSE_ASSERT_AW_DONE(ftick); @@ -413,6 +402,11 @@ fticket_reset(struct fuse_ticket *ftick) ftick->tk_aw_errno = 0; ftick->tk_flag = 0; + + /* May be truncated to 32 bits on LP32 arches */ + ftick->tk_unique = atomic_fetchadd_long(&data->ticketer, 1); + if (ftick->tk_unique == 0) + ftick->tk_unique = atomic_fetchadd_long(&data->ticketer, 1); } static int diff --git a/tests/sys/fs/fusefs/mockfs.cc b/tests/sys/fs/fusefs/mockfs.cc index da634b5f15cd..4effecc1cd82 100644 --- a/tests/sys/fs/fusefs/mockfs.cc +++ b/tests/sys/fs/fusefs/mockfs.cc @@ -370,6 +370,7 @@ MockFS::MockFS(int max_readahead, bool allow_other, bool default_permissions, m_pm = pm; m_time_gran = time_gran; m_quit = false; + m_last_unique = 0; if (m_pm == KQ) m_kq = kqueue(); else @@ -646,6 +647,14 @@ void MockFS::audit_request(const mockfs_buf_in &in, ssize_t buflen) { default: FAIL() << "Unknown opcode " << in.header.opcode; } + /* + * Check that the ticket's unique value is sequential. Technically it + * doesn't need to be sequential, merely unique. But the current + * fusefs driver _does_ make it sequential, and that's easy to check + * for. + */ + if (in.header.unique != ++m_last_unique) + FAIL() << "Non-sequential unique value"; } void MockFS::init(uint32_t flags) { diff --git a/tests/sys/fs/fusefs/mockfs.hh b/tests/sys/fs/fusefs/mockfs.hh index 4cf6daea7e76..be8a05c344fa 100644 --- a/tests/sys/fs/fusefs/mockfs.hh +++ b/tests/sys/fs/fusefs/mockfs.hh @@ -277,6 +277,9 @@ class MockFS { /* pid of the test process */ pid_t m_pid; + /* The unique value of the header of the last received operation */ + uint64_t m_last_unique; + /* Method the daemon should use for I/O to and from /dev/fuse */ enum poll_method m_pm; From owner-dev-commits-src-all@freebsd.org Tue Jul 27 17:40: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 AF335665674; Tue, 27 Jul 2021 17:40: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 4GZ3wV4d2xz4qXp; Tue, 27 Jul 2021 17:40: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 82ECC6D51; Tue, 27 Jul 2021 17:40: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 16RHeQw0046223; Tue, 27 Jul 2021 17:40:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RHeQ7Z046222; Tue, 27 Jul 2021 17:40:26 GMT (envelope-from git) Date: Tue, 27 Jul 2021 17:40:26 GMT Message-Id: <202107271740.16RHeQ7Z046222@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alan Somers Subject: git: 7d9771228715 - stable/12 - fusefs: correctly set lock owner during FUSE_SETLK MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 7d9771228715bf2a32c7db323accecfb7f2f861c 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, 27 Jul 2021 17:40:26 -0000 The branch stable/12 has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=7d9771228715bf2a32c7db323accecfb7f2f861c commit 7d9771228715bf2a32c7db323accecfb7f2f861c Author: Alan Somers AuthorDate: 2021-05-20 01:10:15 +0000 Commit: Alan Somers CommitDate: 2021-07-27 17:34:08 +0000 fusefs: correctly set lock owner during FUSE_SETLK During FUSE_SETLK, the owner field should uniquely identify the calling process. The fusefs module now sets it to the process's pid. Previously, it expected the calling process to set it directly, which was wrong. libfuse also apparently expects the owner field to be set during FUSE_GETLK, though I'm not sure why. PR: 256005 Reported by: Agata Reviewed by: pfg Differential Revision: https://reviews.freebsd.org/D30622 (cherry picked from commit 18b19f8c6e04935a63a951afe0e540674bc94455) --- sys/fs/fuse/fuse_vnops.c | 4 ++-- tests/sys/fs/fusefs/locks.cc | 50 ++++++++++++++++++++++++++------------------ 2 files changed, 32 insertions(+), 22 deletions(-) diff --git a/sys/fs/fuse/fuse_vnops.c b/sys/fs/fuse/fuse_vnops.c index 1c1ac7680f0e..9e79a376cccd 100644 --- a/sys/fs/fuse/fuse_vnops.c +++ b/sys/fs/fuse/fuse_vnops.c @@ -427,14 +427,14 @@ fuse_vnop_advlock(struct vop_advlock_args *ap) fdisp_make_vp(&fdi, op, vp, td, cred); fli = fdi.indata; fli->fh = fufh->fh_id; - fli->owner = fl->l_pid; + fli->owner = td->td_proc->p_pid; fli->lk.start = fl->l_start; if (fl->l_len != 0) fli->lk.end = fl->l_start + fl->l_len - 1; else fli->lk.end = INT64_MAX; fli->lk.type = fl->l_type; - fli->lk.pid = fl->l_pid; + fli->lk.pid = td->td_proc->p_pid; err = fdisp_wait_answ(&fdi); fdisp_destroy(&fdi); diff --git a/tests/sys/fs/fusefs/locks.cc b/tests/sys/fs/fusefs/locks.cc index 49f495412259..cace779e981a 100644 --- a/tests/sys/fs/fusefs/locks.cc +++ b/tests/sys/fs/fusefs/locks.cc @@ -228,7 +228,7 @@ TEST_F(GetlkFallback, local) ASSERT_LE(0, fd) << strerror(errno); fl.l_start = 10; fl.l_len = 1000; - fl.l_pid = getpid(); + fl.l_pid = 0; fl.l_type = F_RDLCK; fl.l_whence = SEEK_SET; fl.l_sysid = 0; @@ -247,7 +247,7 @@ TEST_F(Getlk, no_locks) uint64_t ino = 42; struct flock fl; int fd; - pid_t pid = 1234; + pid_t pid = getpid(); expect_lookup(RELPATH, ino); expect_open(ino, 0, 1); @@ -256,11 +256,16 @@ TEST_F(Getlk, no_locks) return (in.header.opcode == FUSE_GETLK && in.header.nodeid == ino && in.body.getlk.fh == FH && + /* + * Though it seems useless, libfuse expects the + * owner and pid fields to be set during + * FUSE_GETLK. + */ in.body.getlk.owner == (uint32_t)pid && + in.body.getlk.lk.pid == (uint64_t)pid && in.body.getlk.lk.start == 10 && in.body.getlk.lk.end == 1009 && - in.body.getlk.lk.type == F_RDLCK && - in.body.getlk.lk.pid == (uint64_t)pid); + in.body.getlk.lk.type == F_RDLCK); }, Eq(true)), _) ).WillOnce(Invoke(ReturnImmediate([=](auto in, auto& out) { @@ -273,7 +278,7 @@ TEST_F(Getlk, no_locks) ASSERT_LE(0, fd) << strerror(errno); fl.l_start = 10; fl.l_len = 1000; - fl.l_pid = pid; + fl.l_pid = 0; fl.l_type = F_RDLCK; fl.l_whence = SEEK_SET; fl.l_sysid = 0; @@ -290,7 +295,7 @@ TEST_F(Getlk, lock_exists) uint64_t ino = 42; struct flock fl; int fd; - pid_t pid = 1234; + pid_t pid = getpid(); pid_t pid2 = 1235; expect_lookup(RELPATH, ino); @@ -300,11 +305,16 @@ TEST_F(Getlk, lock_exists) return (in.header.opcode == FUSE_GETLK && in.header.nodeid == ino && in.body.getlk.fh == FH && + /* + * Though it seems useless, libfuse expects the + * owner and pid fields to be set during + * FUSE_GETLK. + */ in.body.getlk.owner == (uint32_t)pid && + in.body.getlk.lk.pid == (uint64_t)pid && in.body.getlk.lk.start == 10 && in.body.getlk.lk.end == 1009 && - in.body.getlk.lk.type == F_RDLCK && - in.body.getlk.lk.pid == (uint64_t)pid); + in.body.getlk.lk.type == F_RDLCK); }, Eq(true)), _) ).WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) { @@ -319,7 +329,7 @@ TEST_F(Getlk, lock_exists) ASSERT_LE(0, fd) << strerror(errno); fl.l_start = 10; fl.l_len = 1000; - fl.l_pid = pid; + fl.l_pid = 0; fl.l_type = F_RDLCK; fl.l_whence = SEEK_SET; fl.l_sysid = 0; @@ -368,7 +378,7 @@ TEST_F(Setlk, clear) uint64_t ino = 42; struct flock fl; int fd; - pid_t pid = 1234; + pid_t pid = getpid(); expect_lookup(RELPATH, ino); expect_open(ino, 0, 1); @@ -378,7 +388,7 @@ TEST_F(Setlk, clear) ASSERT_LE(0, fd) << strerror(errno); fl.l_start = 10; fl.l_len = 1000; - fl.l_pid = pid; + fl.l_pid = 0; fl.l_type = F_UNLCK; fl.l_whence = SEEK_SET; fl.l_sysid = 0; @@ -394,7 +404,7 @@ TEST_F(Setlk, set) uint64_t ino = 42; struct flock fl; int fd; - pid_t pid = 1234; + pid_t pid = getpid(); expect_lookup(RELPATH, ino); expect_open(ino, 0, 1); @@ -404,7 +414,7 @@ TEST_F(Setlk, set) ASSERT_LE(0, fd) << strerror(errno); fl.l_start = 10; fl.l_len = 1000; - fl.l_pid = pid; + fl.l_pid = 0; fl.l_type = F_RDLCK; fl.l_whence = SEEK_SET; fl.l_sysid = 0; @@ -420,7 +430,7 @@ TEST_F(Setlk, set_eof) uint64_t ino = 42; struct flock fl; int fd; - pid_t pid = 1234; + pid_t pid = getpid(); expect_lookup(RELPATH, ino); expect_open(ino, 0, 1); @@ -430,7 +440,7 @@ TEST_F(Setlk, set_eof) ASSERT_LE(0, fd) << strerror(errno); fl.l_start = 10; fl.l_len = 0; - fl.l_pid = pid; + fl.l_pid = 0; fl.l_type = F_RDLCK; fl.l_whence = SEEK_SET; fl.l_sysid = 0; @@ -446,7 +456,7 @@ TEST_F(Setlk, eagain) uint64_t ino = 42; struct flock fl; int fd; - pid_t pid = 1234; + pid_t pid = getpid(); expect_lookup(RELPATH, ino); expect_open(ino, 0, 1); @@ -456,7 +466,7 @@ TEST_F(Setlk, eagain) ASSERT_LE(0, fd) << strerror(errno); fl.l_start = 10; fl.l_len = 1000; - fl.l_pid = pid; + fl.l_pid = 0; fl.l_type = F_RDLCK; fl.l_whence = SEEK_SET; fl.l_sysid = 0; @@ -484,7 +494,7 @@ TEST_F(SetlkwFallback, local) ASSERT_LE(0, fd) << strerror(errno); fl.l_start = 10; fl.l_len = 1000; - fl.l_pid = getpid(); + fl.l_pid = 0; fl.l_type = F_RDLCK; fl.l_whence = SEEK_SET; fl.l_sysid = 0; @@ -504,7 +514,7 @@ TEST_F(Setlkw, set) uint64_t ino = 42; struct flock fl; int fd; - pid_t pid = 1234; + pid_t pid = getpid(); expect_lookup(RELPATH, ino); expect_open(ino, 0, 1); @@ -514,7 +524,7 @@ TEST_F(Setlkw, set) ASSERT_LE(0, fd) << strerror(errno); fl.l_start = 10; fl.l_len = 1000; - fl.l_pid = pid; + fl.l_pid = 0; fl.l_type = F_RDLCK; fl.l_whence = SEEK_SET; fl.l_sysid = 0; From owner-dev-commits-src-all@freebsd.org Tue Jul 27 17:41: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 EA693665E4E; Tue, 27 Jul 2021 17:41: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 4GZ3xv6MX3z4qrD; Tue, 27 Jul 2021 17:41: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 C227A6C3F; Tue, 27 Jul 2021 17:41: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 16RHfdmm050401; Tue, 27 Jul 2021 17:41:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RHfdm1050400; Tue, 27 Jul 2021 17:41:39 GMT (envelope-from git) Date: Tue, 27 Jul 2021 17:41:39 GMT Message-Id: <202107271741.16RHfdm1050400@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alan Somers Subject: git: 9dbef3827d55 - stable/12 - [skip ci] correct a few SPDX license tags MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 9dbef3827d55011175e40482333eebd13da4e445 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, 27 Jul 2021 17:41:40 -0000 The branch stable/12 has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=9dbef3827d55011175e40482333eebd13da4e445 commit 9dbef3827d55011175e40482333eebd13da4e445 Author: Alan Somers AuthorDate: 2021-07-07 19:52:20 +0000 Commit: Alan Somers CommitDate: 2021-07-27 17:41:29 +0000 [skip ci] correct a few SPDX license tags These were all incorrectly labeled as 2-clause BSD licenses by a semi-automated process, when in fact they are 3-clause. Discussed with: pfg, imp Sponsored by: Axcient (cherry picked from commit 3874c0abb0afaea6adc24ac96dc9dc5043f2b69e) --- lib/libgeom/geom_getxml.c | 2 +- lib/libgeom/geom_stats.c | 2 +- lib/libgeom/geom_xml2tree.c | 2 +- lib/libgeom/libgeom.h | 2 +- sbin/fsck_ffs/ea.c | 2 +- usr.sbin/gstat/gstat.c | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/libgeom/geom_getxml.c b/lib/libgeom/geom_getxml.c index f3d7ba9deb03..48565f707b03 100644 --- a/lib/libgeom/geom_getxml.c +++ b/lib/libgeom/geom_getxml.c @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-3-Clause-FreeBSD * * Copyright (c) 2003 Poul-Henning Kamp * All rights reserved. diff --git a/lib/libgeom/geom_stats.c b/lib/libgeom/geom_stats.c index 7c9191e29686..e8e2969e835f 100644 --- a/lib/libgeom/geom_stats.c +++ b/lib/libgeom/geom_stats.c @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-3-Clause-FreeBSD * * Copyright (c) 2003 Poul-Henning Kamp * All rights reserved. diff --git a/lib/libgeom/geom_xml2tree.c b/lib/libgeom/geom_xml2tree.c index 5f4636f9368b..824800070933 100644 --- a/lib/libgeom/geom_xml2tree.c +++ b/lib/libgeom/geom_xml2tree.c @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-3-Clause-FreeBSD * * Copyright (c) 2003 Poul-Henning Kamp * All rights reserved. diff --git a/lib/libgeom/libgeom.h b/lib/libgeom/libgeom.h index 075d2d21f26c..fc593b234302 100644 --- a/lib/libgeom/libgeom.h +++ b/lib/libgeom/libgeom.h @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-3-Clause-FreeBSD * * Copyright (c) 2003 Poul-Henning Kamp * All rights reserved. diff --git a/sbin/fsck_ffs/ea.c b/sbin/fsck_ffs/ea.c index 29e5f46d7651..cf048c51bcb9 100644 --- a/sbin/fsck_ffs/ea.c +++ b/sbin/fsck_ffs/ea.c @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-3-Clause-FreeBSD * * Copyright (c) 2002 Poul-Henning Kamp * Copyright (c) 2002 Networks Associates Technology, Inc. diff --git a/usr.sbin/gstat/gstat.c b/usr.sbin/gstat/gstat.c index 1c75fd5bf2d8..7eb193e26442 100644 --- a/usr.sbin/gstat/gstat.c +++ b/usr.sbin/gstat/gstat.c @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-3-Clause-FreeBSD * * Copyright (c) 2003 Poul-Henning Kamp * All rights reserved. From owner-dev-commits-src-all@freebsd.org Tue Jul 27 17:57: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 8CD8A666094; Tue, 27 Jul 2021 17:57: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 4GZ4Hj3JnTz4rnr; Tue, 27 Jul 2021 17:57: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 591B171B7; Tue, 27 Jul 2021 17:57: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 16RHv5VM063976; Tue, 27 Jul 2021 17:57:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RHv5ET063975; Tue, 27 Jul 2021 17:57:05 GMT (envelope-from git) Date: Tue, 27 Jul 2021 17:57:05 GMT Message-Id: <202107271757.16RHv5ET063975@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alan Somers Subject: git: c7fe00ae403f - stable/13 - fusefs: correctly set lock owner during FUSE_SETLK MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c7fe00ae403f08b17e8376cc98195171234bf3d9 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, 27 Jul 2021 17:57:05 -0000 The branch stable/13 has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=c7fe00ae403f08b17e8376cc98195171234bf3d9 commit c7fe00ae403f08b17e8376cc98195171234bf3d9 Author: Alan Somers AuthorDate: 2021-05-20 01:10:15 +0000 Commit: Alan Somers CommitDate: 2021-07-27 17:44:28 +0000 fusefs: correctly set lock owner during FUSE_SETLK During FUSE_SETLK, the owner field should uniquely identify the calling process. The fusefs module now sets it to the process's pid. Previously, it expected the calling process to set it directly, which was wrong. libfuse also apparently expects the owner field to be set during FUSE_GETLK, though I'm not sure why. PR: 256005 Reported by: Agata Reviewed by: pfg Differential Revision: https://reviews.freebsd.org/D30622 (cherry picked from commit 18b19f8c6e04935a63a951afe0e540674bc94455) --- sys/fs/fuse/fuse_vnops.c | 4 ++-- tests/sys/fs/fusefs/locks.cc | 50 ++++++++++++++++++++++++++------------------ 2 files changed, 32 insertions(+), 22 deletions(-) diff --git a/sys/fs/fuse/fuse_vnops.c b/sys/fs/fuse/fuse_vnops.c index c79d8d5b5223..adb297b6aacb 100644 --- a/sys/fs/fuse/fuse_vnops.c +++ b/sys/fs/fuse/fuse_vnops.c @@ -466,14 +466,14 @@ fuse_vnop_advlock(struct vop_advlock_args *ap) fdisp_make_vp(&fdi, op, vp, td, cred); fli = fdi.indata; fli->fh = fufh->fh_id; - fli->owner = fl->l_pid; + fli->owner = td->td_proc->p_pid; fli->lk.start = fl->l_start; if (fl->l_len != 0) fli->lk.end = fl->l_start + fl->l_len - 1; else fli->lk.end = INT64_MAX; fli->lk.type = fl->l_type; - fli->lk.pid = fl->l_pid; + fli->lk.pid = td->td_proc->p_pid; err = fdisp_wait_answ(&fdi); fdisp_destroy(&fdi); diff --git a/tests/sys/fs/fusefs/locks.cc b/tests/sys/fs/fusefs/locks.cc index 49f495412259..cace779e981a 100644 --- a/tests/sys/fs/fusefs/locks.cc +++ b/tests/sys/fs/fusefs/locks.cc @@ -228,7 +228,7 @@ TEST_F(GetlkFallback, local) ASSERT_LE(0, fd) << strerror(errno); fl.l_start = 10; fl.l_len = 1000; - fl.l_pid = getpid(); + fl.l_pid = 0; fl.l_type = F_RDLCK; fl.l_whence = SEEK_SET; fl.l_sysid = 0; @@ -247,7 +247,7 @@ TEST_F(Getlk, no_locks) uint64_t ino = 42; struct flock fl; int fd; - pid_t pid = 1234; + pid_t pid = getpid(); expect_lookup(RELPATH, ino); expect_open(ino, 0, 1); @@ -256,11 +256,16 @@ TEST_F(Getlk, no_locks) return (in.header.opcode == FUSE_GETLK && in.header.nodeid == ino && in.body.getlk.fh == FH && + /* + * Though it seems useless, libfuse expects the + * owner and pid fields to be set during + * FUSE_GETLK. + */ in.body.getlk.owner == (uint32_t)pid && + in.body.getlk.lk.pid == (uint64_t)pid && in.body.getlk.lk.start == 10 && in.body.getlk.lk.end == 1009 && - in.body.getlk.lk.type == F_RDLCK && - in.body.getlk.lk.pid == (uint64_t)pid); + in.body.getlk.lk.type == F_RDLCK); }, Eq(true)), _) ).WillOnce(Invoke(ReturnImmediate([=](auto in, auto& out) { @@ -273,7 +278,7 @@ TEST_F(Getlk, no_locks) ASSERT_LE(0, fd) << strerror(errno); fl.l_start = 10; fl.l_len = 1000; - fl.l_pid = pid; + fl.l_pid = 0; fl.l_type = F_RDLCK; fl.l_whence = SEEK_SET; fl.l_sysid = 0; @@ -290,7 +295,7 @@ TEST_F(Getlk, lock_exists) uint64_t ino = 42; struct flock fl; int fd; - pid_t pid = 1234; + pid_t pid = getpid(); pid_t pid2 = 1235; expect_lookup(RELPATH, ino); @@ -300,11 +305,16 @@ TEST_F(Getlk, lock_exists) return (in.header.opcode == FUSE_GETLK && in.header.nodeid == ino && in.body.getlk.fh == FH && + /* + * Though it seems useless, libfuse expects the + * owner and pid fields to be set during + * FUSE_GETLK. + */ in.body.getlk.owner == (uint32_t)pid && + in.body.getlk.lk.pid == (uint64_t)pid && in.body.getlk.lk.start == 10 && in.body.getlk.lk.end == 1009 && - in.body.getlk.lk.type == F_RDLCK && - in.body.getlk.lk.pid == (uint64_t)pid); + in.body.getlk.lk.type == F_RDLCK); }, Eq(true)), _) ).WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) { @@ -319,7 +329,7 @@ TEST_F(Getlk, lock_exists) ASSERT_LE(0, fd) << strerror(errno); fl.l_start = 10; fl.l_len = 1000; - fl.l_pid = pid; + fl.l_pid = 0; fl.l_type = F_RDLCK; fl.l_whence = SEEK_SET; fl.l_sysid = 0; @@ -368,7 +378,7 @@ TEST_F(Setlk, clear) uint64_t ino = 42; struct flock fl; int fd; - pid_t pid = 1234; + pid_t pid = getpid(); expect_lookup(RELPATH, ino); expect_open(ino, 0, 1); @@ -378,7 +388,7 @@ TEST_F(Setlk, clear) ASSERT_LE(0, fd) << strerror(errno); fl.l_start = 10; fl.l_len = 1000; - fl.l_pid = pid; + fl.l_pid = 0; fl.l_type = F_UNLCK; fl.l_whence = SEEK_SET; fl.l_sysid = 0; @@ -394,7 +404,7 @@ TEST_F(Setlk, set) uint64_t ino = 42; struct flock fl; int fd; - pid_t pid = 1234; + pid_t pid = getpid(); expect_lookup(RELPATH, ino); expect_open(ino, 0, 1); @@ -404,7 +414,7 @@ TEST_F(Setlk, set) ASSERT_LE(0, fd) << strerror(errno); fl.l_start = 10; fl.l_len = 1000; - fl.l_pid = pid; + fl.l_pid = 0; fl.l_type = F_RDLCK; fl.l_whence = SEEK_SET; fl.l_sysid = 0; @@ -420,7 +430,7 @@ TEST_F(Setlk, set_eof) uint64_t ino = 42; struct flock fl; int fd; - pid_t pid = 1234; + pid_t pid = getpid(); expect_lookup(RELPATH, ino); expect_open(ino, 0, 1); @@ -430,7 +440,7 @@ TEST_F(Setlk, set_eof) ASSERT_LE(0, fd) << strerror(errno); fl.l_start = 10; fl.l_len = 0; - fl.l_pid = pid; + fl.l_pid = 0; fl.l_type = F_RDLCK; fl.l_whence = SEEK_SET; fl.l_sysid = 0; @@ -446,7 +456,7 @@ TEST_F(Setlk, eagain) uint64_t ino = 42; struct flock fl; int fd; - pid_t pid = 1234; + pid_t pid = getpid(); expect_lookup(RELPATH, ino); expect_open(ino, 0, 1); @@ -456,7 +466,7 @@ TEST_F(Setlk, eagain) ASSERT_LE(0, fd) << strerror(errno); fl.l_start = 10; fl.l_len = 1000; - fl.l_pid = pid; + fl.l_pid = 0; fl.l_type = F_RDLCK; fl.l_whence = SEEK_SET; fl.l_sysid = 0; @@ -484,7 +494,7 @@ TEST_F(SetlkwFallback, local) ASSERT_LE(0, fd) << strerror(errno); fl.l_start = 10; fl.l_len = 1000; - fl.l_pid = getpid(); + fl.l_pid = 0; fl.l_type = F_RDLCK; fl.l_whence = SEEK_SET; fl.l_sysid = 0; @@ -504,7 +514,7 @@ TEST_F(Setlkw, set) uint64_t ino = 42; struct flock fl; int fd; - pid_t pid = 1234; + pid_t pid = getpid(); expect_lookup(RELPATH, ino); expect_open(ino, 0, 1); @@ -514,7 +524,7 @@ TEST_F(Setlkw, set) ASSERT_LE(0, fd) << strerror(errno); fl.l_start = 10; fl.l_len = 1000; - fl.l_pid = pid; + fl.l_pid = 0; fl.l_type = F_RDLCK; fl.l_whence = SEEK_SET; fl.l_sysid = 0; From owner-dev-commits-src-all@freebsd.org Tue Jul 27 17:57: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 036376660AC; Tue, 27 Jul 2021 17:57: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 4GZ4JB6jCfz4rVC; Tue, 27 Jul 2021 17:57: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 C3F41713B; Tue, 27 Jul 2021 17:57: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 16RHvUU6064122; Tue, 27 Jul 2021 17:57:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RHvU9Y064121; Tue, 27 Jul 2021 17:57:30 GMT (envelope-from git) Date: Tue, 27 Jul 2021 17:57:30 GMT Message-Id: <202107271757.16RHvU9Y064121@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alan Somers Subject: git: 1b58943ef867 - stable/13 - [skip ci] correct a few SPDX license tags MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 1b58943ef8679ce862a10ebc9f6fcb1d5d394db9 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, 27 Jul 2021 17:57:31 -0000 The branch stable/13 has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=1b58943ef8679ce862a10ebc9f6fcb1d5d394db9 commit 1b58943ef8679ce862a10ebc9f6fcb1d5d394db9 Author: Alan Somers AuthorDate: 2021-07-07 19:52:20 +0000 Commit: Alan Somers CommitDate: 2021-07-27 17:57:17 +0000 [skip ci] correct a few SPDX license tags These were all incorrectly labeled as 2-clause BSD licenses by a semi-automated process, when in fact they are 3-clause. Discussed with: pfg, imp Sponsored by: Axcient (cherry picked from commit 3874c0abb0afaea6adc24ac96dc9dc5043f2b69e) --- lib/libgeom/geom_getxml.c | 2 +- lib/libgeom/geom_stats.c | 2 +- lib/libgeom/geom_xml2tree.c | 2 +- lib/libgeom/libgeom.h | 2 +- sbin/fsck_ffs/ea.c | 2 +- usr.sbin/gstat/gstat.c | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/libgeom/geom_getxml.c b/lib/libgeom/geom_getxml.c index f3d7ba9deb03..48565f707b03 100644 --- a/lib/libgeom/geom_getxml.c +++ b/lib/libgeom/geom_getxml.c @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-3-Clause-FreeBSD * * Copyright (c) 2003 Poul-Henning Kamp * All rights reserved. diff --git a/lib/libgeom/geom_stats.c b/lib/libgeom/geom_stats.c index 7c9191e29686..e8e2969e835f 100644 --- a/lib/libgeom/geom_stats.c +++ b/lib/libgeom/geom_stats.c @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-3-Clause-FreeBSD * * Copyright (c) 2003 Poul-Henning Kamp * All rights reserved. diff --git a/lib/libgeom/geom_xml2tree.c b/lib/libgeom/geom_xml2tree.c index 5f4636f9368b..824800070933 100644 --- a/lib/libgeom/geom_xml2tree.c +++ b/lib/libgeom/geom_xml2tree.c @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-3-Clause-FreeBSD * * Copyright (c) 2003 Poul-Henning Kamp * All rights reserved. diff --git a/lib/libgeom/libgeom.h b/lib/libgeom/libgeom.h index 075d2d21f26c..fc593b234302 100644 --- a/lib/libgeom/libgeom.h +++ b/lib/libgeom/libgeom.h @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-3-Clause-FreeBSD * * Copyright (c) 2003 Poul-Henning Kamp * All rights reserved. diff --git a/sbin/fsck_ffs/ea.c b/sbin/fsck_ffs/ea.c index 7cf20196dfae..54353005bdc0 100644 --- a/sbin/fsck_ffs/ea.c +++ b/sbin/fsck_ffs/ea.c @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-3-Clause-FreeBSD * * Copyright (c) 2002 Poul-Henning Kamp * Copyright (c) 2002 Networks Associates Technology, Inc. diff --git a/usr.sbin/gstat/gstat.c b/usr.sbin/gstat/gstat.c index c2d28720205f..65388c3002ff 100644 --- a/usr.sbin/gstat/gstat.c +++ b/usr.sbin/gstat/gstat.c @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-3-Clause-FreeBSD * * Copyright (c) 2003 Poul-Henning Kamp * All rights reserved. From owner-dev-commits-src-all@freebsd.org Tue Jul 27 18:18: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 A1044666635; Tue, 27 Jul 2021 18:18: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 4GZ4mH45lsz4sW4; Tue, 27 Jul 2021 18:18: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 7468776E7; Tue, 27 Jul 2021 18:18: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 16RIIN2u091415; Tue, 27 Jul 2021 18:18:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RIIN9v091414; Tue, 27 Jul 2021 18:18:23 GMT (envelope-from git) Date: Tue, 27 Jul 2021 18:18:23 GMT Message-Id: <202107271818.16RIIN9v091414@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Somers Subject: git: 674400eb20b6 - main - ftpd: delete dead code MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 674400eb20b65369a88b1cb778d729bc297832c9 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, 27 Jul 2021 18:18:23 -0000 The branch main has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=674400eb20b65369a88b1cb778d729bc297832c9 commit 674400eb20b65369a88b1cb778d729bc297832c9 Author: Alan Somers AuthorDate: 2021-07-27 18:14:00 +0000 Commit: Alan Somers CommitDate: 2021-07-27 18:18:08 +0000 ftpd: delete dead code Delete code killed by SVN r13139 in 1996. Little chance that it would still compile today. PR: 257317 Reported by: Alan Shearer MFC after: 2 weeks Sponsored by: Axcient --- libexec/ftpd/extern.h | 3 --- libexec/ftpd/ftpd.c | 49 ------------------------------------------------- 2 files changed, 52 deletions(-) diff --git a/libexec/ftpd/extern.h b/libexec/ftpd/extern.h index 80d24b46d2e4..aa48ea67e320 100644 --- a/libexec/ftpd/extern.h +++ b/libexec/ftpd/extern.h @@ -59,9 +59,6 @@ char *renamefrom(char *); void reply(int, const char *, ...) __printflike(2, 3); void retrieve(char *, char *); void send_file_list(char *); -#ifdef OLD_SETPROCTITLE -void setproctitle(const char *, ...); -#endif void statcmd(void); void statfilecmd(char *); void store(char *, char *, int); diff --git a/libexec/ftpd/ftpd.c b/libexec/ftpd/ftpd.c index 25ae3fba956b..e23c06aaf143 100644 --- a/libexec/ftpd/ftpd.c +++ b/libexec/ftpd/ftpd.c @@ -205,10 +205,6 @@ int swaitmax = SWAITMAX; int swaitint = SWAITINT; #ifdef SETPROCTITLE -#ifdef OLD_SETPROCTITLE -char **Argv = NULL; /* pointer to argument vector */ -char *LastArgv = NULL; /* end of argv */ -#endif /* OLD_SETPROCTITLE */ char proctitle[LINE_MAX]; /* initial part of title */ #endif /* SETPROCTITLE */ @@ -280,16 +276,6 @@ main(int argc, char *argv[], char **envp) sigemptyset(&sa.sa_mask); sa.sa_flags = SA_RESTART; -#ifdef OLD_SETPROCTITLE - /* - * Save start and extent of argv for setproctitle. - */ - Argv = argv; - while (*envp) - envp++; - LastArgv = envp[-1] + strlen(envp[-1]); -#endif /* OLD_SETPROCTITLE */ - /* * Prevent diagnostic messages from appearing on stderr. * We run as a daemon or from inetd; in both cases, there's @@ -3329,41 +3315,6 @@ reapchild(int signo) while (waitpid(-1, NULL, WNOHANG) > 0); } -#ifdef OLD_SETPROCTITLE -/* - * Clobber argv so ps will show what we're doing. (Stolen from sendmail.) - * Warning, since this is usually started from inetd.conf, it often doesn't - * have much of an environment or arglist to overwrite. - */ -void -setproctitle(const char *fmt, ...) -{ - int i; - va_list ap; - char *p, *bp, ch; - char buf[LINE_MAX]; - - va_start(ap, fmt); - (void)vsnprintf(buf, sizeof(buf), fmt, ap); - - /* make ps print our process name */ - p = Argv[0]; - *p++ = '-'; - - i = strlen(buf); - if (i > LastArgv - p - 2) { - i = LastArgv - p - 2; - buf[i] = '\0'; - } - bp = buf; - while (ch = *bp++) - if (ch != '\n' && ch != '\r') - *p++ = ch; - while (p < LastArgv) - *p++ = ' '; -} -#endif /* OLD_SETPROCTITLE */ - static void appendf(char **strp, char *fmt, ...) { From owner-dev-commits-src-all@freebsd.org Tue Jul 27 18:51: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 853F7666E28; Tue, 27 Jul 2021 18:51: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 4GZ5Vs3Jt9z4vJ3; Tue, 27 Jul 2021 18:51: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 5AAB67578; Tue, 27 Jul 2021 18:51: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 16RIpnme042018; Tue, 27 Jul 2021 18:51:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RIpn8D042010; Tue, 27 Jul 2021 18:51:49 GMT (envelope-from git) Date: Tue, 27 Jul 2021 18:51:49 GMT Message-Id: <202107271851.16RIpn8D042010@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: 4e224e4be7c3 - main - pkgbase: accommodate pkg < 1.17 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: 4e224e4be7c37052567ec4cd2481f299487fc222 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, 27 Jul 2021 18:51:49 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=4e224e4be7c37052567ec4cd2481f299487fc222 commit 4e224e4be7c37052567ec4cd2481f299487fc222 Author: Ed Maste AuthorDate: 2021-07-27 16:44:45 +0000 Commit: Ed Maste CommitDate: 2021-07-27 18:50:06 +0000 pkgbase: accommodate pkg < 1.17 6cafdee71d2b adapted the pkgbase build for 1.17, but broke Cirrus-CI's use of PKG_FORMAT=tar (the quarterly package set still has pkg 1.16). Because of this I disabled the pkgbase build and test in 2bfba2a04b05. Now, check `pkg --version` and use the old logic for < 1.17. To be reverted once we no longer encounter pkg 1.16 in Cirrus-CI (i.e., via GCP cloud images) to avoid keeping this extra complexity around. PR: 257422 Reviewed by: manu Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31324 --- Makefile.inc1 | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index f7e8f9c41d2f..23fb4b5581ac 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -1857,9 +1857,15 @@ _pkgbootstrap: .PHONY @env ASSUME_ALWAYS_YES=YES pkg bootstrap .endif -.if make(create-world-packages-jobs) || make(create-kernel-packages*) || make(real-update-packages) +.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. '{print $$1 * 10000 + $$2 * 100 + $$3}' +.if ${PKG_BIN_VERSION} < 11700 +PKG_EXT= ${PKG_FORMAT} +.else +PKG_EXT= pkg +.endif .if !defined(PKG_VERSION_FROM) && make(real-update-packages) .if defined(PKG_ABI) @@ -1899,14 +1905,14 @@ real-update-packages: stage-packages .PHONY @echo "==> Checking for new packages (comparing ${PKG_VERSION} to ${PKG_VERSION_FROM})" @for pkg in ${PKG_VERSION_FROM_DIR}/${PKG_NAME_PREFIX}-*; do \ pkgname=$$(pkg query -F $${pkg} '%n' | sed 's/${PKG_NAME_PREFIX}-\(.*\)/\1/') ; \ - newpkgname=${PKG_NAME_PREFIX}-$${pkgname}-${PKG_VERSION}.pkg ; \ + newpkgname=${PKG_NAME_PREFIX}-$${pkgname}-${PKG_VERSION}.${PKG_EXT} ; \ oldsum=$$(pkg query -F $${pkg} '%X') ; \ if [ ! -f ${REPODIR}/${PKG_ABI}/${PKG_VERSION}/$${newpkgname} ]; then \ continue; \ fi ; \ newsum=$$(pkg query -F ${REPODIR}/${PKG_ABI}/${PKG_VERSION}/$${newpkgname} '%X') ; \ if [ "$${oldsum}" == "$${newsum}" ]; then \ - echo "==> Keeping old ${PKG_NAME_PREFIX}-$${pkgname}-${PKG_VERSION_FROM}.pkg" ; \ + echo "==> Keeping old ${PKG_NAME_PREFIX}-$${pkgname}-${PKG_VERSION_FROM}.${PKG_EXT}" ; \ rm ${REPODIR}/${PKG_ABI}/${PKG_VERSION}/$${newpkgname} ; \ cp $${pkg} ${REPODIR}/${PKG_ABI}/${PKG_VERSION} ; \ else \ @@ -2064,6 +2070,9 @@ create-kernel-packages-extra-flavor${flavor:C,^""$,${_default_flavor},}-${_kerne sign-packages: _pkgbootstrap .PHONY printf "version = 2;\n" > ${WSTAGEDIR}/meta +.if ${PKG_BIN_VERSION} < 11700 + printf "packing_format = \"${PKG_FORMAT}\";\n" >> ${WSTAGEDIR}/meta +.endif @[ -L "${REPODIR}/$$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/usr/bin/uname config ABI)/latest" ] && \ unlink ${REPODIR}/$$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/usr/bin/uname config ABI)/latest ; \ ${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/usr/bin/uname repo \ From owner-dev-commits-src-all@freebsd.org Tue Jul 27 19:20: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 8E08166778D; Tue, 27 Jul 2021 19:20: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 4GZ68B3TT4z4wrr; Tue, 27 Jul 2021 19:20: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 5FA0810519; Tue, 27 Jul 2021 19:20: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 16RJKghe080730; Tue, 27 Jul 2021 19:20:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RJKg8J080729; Tue, 27 Jul 2021 19:20:42 GMT (envelope-from git) Date: Tue, 27 Jul 2021 19:20:42 GMT Message-Id: <202107271920.16RJKg8J080729@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: 192a4072d7b3 - stable/13 - freebsd-update: Update URL of supported platforms information 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: 192a4072d7b3c28f5de40bafbb4d8f011a9820a8 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, 27 Jul 2021 19:20:42 -0000 The branch stable/13 has been updated by lwhsu: URL: https://cgit.FreeBSD.org/src/commit/?id=192a4072d7b3c28f5de40bafbb4d8f011a9820a8 commit 192a4072d7b3c28f5de40bafbb4d8f011a9820a8 Author: Li-Wen Hsu AuthorDate: 2021-07-04 13:45:08 +0000 Commit: Li-Wen Hsu CommitDate: 2021-07-27 19:19:55 +0000 freebsd-update: Update URL of supported platforms information MFC after: 3 days (cherry picked from commit 86d0d3aadb48a9a917167078ed197a061179fa4f) --- usr.sbin/freebsd-update/freebsd-update.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/freebsd-update/freebsd-update.sh b/usr.sbin/freebsd-update/freebsd-update.sh index 7f9b06f0221f..f82ec7d7730c 100644 --- a/usr.sbin/freebsd-update/freebsd-update.sh +++ b/usr.sbin/freebsd-update/freebsd-update.sh @@ -1041,7 +1041,7 @@ fetch_pick_server () { This may be because upgrading from this platform (${ARCH}) or release (${RELNUM}) is unsupported by `basename $0`. Only platforms with Tier 1 support can be upgraded by `basename $0`. - See https://www.freebsd.org/platforms/index.html for more info. + See https://www.freebsd.org/platforms/ for more info. If unsupported, FreeBSD must be upgraded by source. EOF From owner-dev-commits-src-all@freebsd.org Tue Jul 27 19:20: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 D2D6B66771D; Tue, 27 Jul 2021 19:20: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 4GZ68J5cK5z4wsB; Tue, 27 Jul 2021 19:20: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 A8A69106D7; Tue, 27 Jul 2021 19:20: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 16RJKmD2080850; Tue, 27 Jul 2021 19:20:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RJKmxY080849; Tue, 27 Jul 2021 19:20:48 GMT (envelope-from git) Date: Tue, 27 Jul 2021 19:20:48 GMT Message-Id: <202107271920.16RJKmxY080849@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: 5f94034cbfa5 - stable/12 - freebsd-update: Update URL of supported platforms information 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: 5f94034cbfa5b9c9f80d19404b4534687c7baca1 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, 27 Jul 2021 19:20:48 -0000 The branch stable/12 has been updated by lwhsu: URL: https://cgit.FreeBSD.org/src/commit/?id=5f94034cbfa5b9c9f80d19404b4534687c7baca1 commit 5f94034cbfa5b9c9f80d19404b4534687c7baca1 Author: Li-Wen Hsu AuthorDate: 2021-07-04 13:45:08 +0000 Commit: Li-Wen Hsu CommitDate: 2021-07-27 19:20:14 +0000 freebsd-update: Update URL of supported platforms information MFC after: 3 days (cherry picked from commit 86d0d3aadb48a9a917167078ed197a061179fa4f) --- usr.sbin/freebsd-update/freebsd-update.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/freebsd-update/freebsd-update.sh b/usr.sbin/freebsd-update/freebsd-update.sh index 7f9b06f0221f..f82ec7d7730c 100644 --- a/usr.sbin/freebsd-update/freebsd-update.sh +++ b/usr.sbin/freebsd-update/freebsd-update.sh @@ -1041,7 +1041,7 @@ fetch_pick_server () { This may be because upgrading from this platform (${ARCH}) or release (${RELNUM}) is unsupported by `basename $0`. Only platforms with Tier 1 support can be upgraded by `basename $0`. - See https://www.freebsd.org/platforms/index.html for more info. + See https://www.freebsd.org/platforms/ for more info. If unsupported, FreeBSD must be upgraded by source. EOF From owner-dev-commits-src-all@freebsd.org Tue Jul 27 19:21: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 2E1AE667828; Tue, 27 Jul 2021 19:21: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 4GZ69c0rYZz4x9b; Tue, 27 Jul 2021 19:21: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 05D2E10806; Tue, 27 Jul 2021 19:21: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 16RJLtrw081903; Tue, 27 Jul 2021 19:21:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RJLtsr081902; Tue, 27 Jul 2021 19:21:55 GMT (envelope-from git) Date: Tue, 27 Jul 2021 19:21:55 GMT Message-Id: <202107271921.16RJLtsr081902@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: 5201006cf97c - stable/13 - share/misc: Update FreeBSD.org URLs 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: 5201006cf97c8b91c56f1e6b7dcbb7abd0682943 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, 27 Jul 2021 19:21:56 -0000 The branch stable/13 has been updated by lwhsu: URL: https://cgit.FreeBSD.org/src/commit/?id=5201006cf97c8b91c56f1e6b7dcbb7abd0682943 commit 5201006cf97c8b91c56f1e6b7dcbb7abd0682943 Author: Li-Wen Hsu AuthorDate: 2021-07-04 14:04:33 +0000 Commit: Li-Wen Hsu CommitDate: 2021-07-27 19:21:19 +0000 share/misc: Update FreeBSD.org URLs MFC after: 3 days (cherry picked from commit 89c0640c7090d5dfbe46adbe50186399923f360f) --- share/misc/iso3166 | 2 +- share/misc/organization.dot | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/share/misc/iso3166 b/share/misc/iso3166 index 1e4cf98df12d..2410a9507ab7 100644 --- a/share/misc/iso3166 +++ b/share/misc/iso3166 @@ -1,6 +1,6 @@ # $FreeBSD$ # -# Please consult with https://www.FreeBSD.org/internal/i18n.html before +# Please consult with https://www.FreeBSD.org/internal/i18n/ before # making changes to this file. # # ISO 3166 country codes diff --git a/share/misc/organization.dot b/share/misc/organization.dot index 33a00452c607..b730b86be5b4 100644 --- a/share/misc/organization.dot +++ b/share/misc/organization.dot @@ -5,7 +5,7 @@ # each other. # For a detailed description of the responsibilities and duties of the listed # teams, please see our Administration page at -# https://www.freebsd.org/administration.html . +# https://www.freebsd.org/administration/ . # # The graphical output can be generated from this file with the following # command: From owner-dev-commits-src-all@freebsd.org Tue Jul 27 19:22: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 650496678C9; Tue, 27 Jul 2021 19:22: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 4GZ69k2DTkz4xPb; Tue, 27 Jul 2021 19:22: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 33CDC1079A; Tue, 27 Jul 2021 19:22: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 16RJM20s082034; Tue, 27 Jul 2021 19:22:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RJM2j5082033; Tue, 27 Jul 2021 19:22:02 GMT (envelope-from git) Date: Tue, 27 Jul 2021 19:22:02 GMT Message-Id: <202107271922.16RJM2j5082033@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: 828572a66d9b - stable/12 - share/misc: Update FreeBSD.org URLs 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: 828572a66d9b4281145ff2f19a4d822fac7d2ca3 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, 27 Jul 2021 19:22:02 -0000 The branch stable/12 has been updated by lwhsu: URL: https://cgit.FreeBSD.org/src/commit/?id=828572a66d9b4281145ff2f19a4d822fac7d2ca3 commit 828572a66d9b4281145ff2f19a4d822fac7d2ca3 Author: Li-Wen Hsu AuthorDate: 2021-07-04 14:04:33 +0000 Commit: Li-Wen Hsu CommitDate: 2021-07-27 19:21:22 +0000 share/misc: Update FreeBSD.org URLs MFC after: 3 days (cherry picked from commit 89c0640c7090d5dfbe46adbe50186399923f360f) --- share/misc/iso3166 | 2 +- share/misc/organization.dot | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/share/misc/iso3166 b/share/misc/iso3166 index 1e4cf98df12d..2410a9507ab7 100644 --- a/share/misc/iso3166 +++ b/share/misc/iso3166 @@ -1,6 +1,6 @@ # $FreeBSD$ # -# Please consult with https://www.FreeBSD.org/internal/i18n.html before +# Please consult with https://www.FreeBSD.org/internal/i18n/ before # making changes to this file. # # ISO 3166 country codes diff --git a/share/misc/organization.dot b/share/misc/organization.dot index 8eff9b6a01cc..c1cc5e3aa007 100644 --- a/share/misc/organization.dot +++ b/share/misc/organization.dot @@ -5,7 +5,7 @@ # each other. # For a detailed description of the responsibilities and duties of the listed # teams, please see our Administration page at -# https://www.freebsd.org/administration.html . +# https://www.freebsd.org/administration/ . # # The graphical output can be generated from this file with the following # command: From owner-dev-commits-src-all@freebsd.org Tue Jul 27 19:23: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 DEBE46678D7; Tue, 27 Jul 2021 19:23: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 4GZ6CB5yCSz4xGn; Tue, 27 Jul 2021 19:23: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 B47E5107A3; Tue, 27 Jul 2021 19:23: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 16RJNI9u085333; Tue, 27 Jul 2021 19:23:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RJNI8I085332; Tue, 27 Jul 2021 19:23:18 GMT (envelope-from git) Date: Tue, 27 Jul 2021 19:23:18 GMT Message-Id: <202107271923.16RJNI8I085332@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: f61cd3dbe4ad - stable/13 - man7: Update FreeBSD.org URLs 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: f61cd3dbe4ada4952ecb18194b4eef8de7bdb326 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, 27 Jul 2021 19:23:18 -0000 The branch stable/13 has been updated by lwhsu: URL: https://cgit.FreeBSD.org/src/commit/?id=f61cd3dbe4ada4952ecb18194b4eef8de7bdb326 commit f61cd3dbe4ada4952ecb18194b4eef8de7bdb326 Author: Li-Wen Hsu AuthorDate: 2021-07-04 14:07:23 +0000 Commit: Li-Wen Hsu CommitDate: 2021-07-27 19:22:25 +0000 man7: Update FreeBSD.org URLs MFC after: 3 days (cherry picked from commit 8dfb00245701a4f9290cd3a24e9bdcafa55a075b) --- share/man/man7/ports.7 | 4 ++-- share/man/man7/tests.7 | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/share/man/man7/ports.7 b/share/man/man7/ports.7 index d90a91630e77..1c3cce31d2f0 100644 --- a/share/man/man7/ports.7 +++ b/share/man/man7/ports.7 @@ -115,7 +115,7 @@ in .No \&: .Sm on .Pp -.Lk https://www.FreeBSD.org/doc/en/books/handbook/ports.html +.Lk https://docs.FreeBSD.org/en/books/handbook/ports/ .Pp For information about creating new ports, see .Sm off @@ -123,7 +123,7 @@ For information about creating new ports, see .No \&: .Sm on .Pp -.Lk https://www.FreeBSD.org/doc/en/books/porters-handbook/ +.Lk https://docs.FreeBSD.org/en/books/porters-handbook/ .Sh TARGETS Some of the .Xr make 1 diff --git a/share/man/man7/tests.7 b/share/man/man7/tests.7 index cb75b7f389f5..ab1a3fd1262f 100644 --- a/share/man/man7/tests.7 +++ b/share/man/man7/tests.7 @@ -194,7 +194,7 @@ For more details please refer to: .It .Lk https://lists.freebsd.org/ "FreeBSD Mailing Lists" .It -.Lk https://www.freebsd.org/support.html "Problem Reporting" +.Lk https://www.freebsd.org/support/ "Problem Reporting" .El .Sh FILES .Bl -tag -compact -width "/etc/kyua/kyua.conf" From owner-dev-commits-src-all@freebsd.org Tue Jul 27 19:23: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 CC1646678DB; Tue, 27 Jul 2021 19:23: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 4GZ6CJ39pbz4xXk; Tue, 27 Jul 2021 19:23: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 56E2610530; Tue, 27 Jul 2021 19:23: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 16RJNOCg085451; Tue, 27 Jul 2021 19:23:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RJNO3W085450; Tue, 27 Jul 2021 19:23:24 GMT (envelope-from git) Date: Tue, 27 Jul 2021 19:23:24 GMT Message-Id: <202107271923.16RJNO3W085450@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: 4e6b2537d1f7 - stable/12 - man7: Update FreeBSD.org URLs 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: 4e6b2537d1f717abea51adb3c03b74d97de7dfda 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, 27 Jul 2021 19:23:24 -0000 The branch stable/12 has been updated by lwhsu: URL: https://cgit.FreeBSD.org/src/commit/?id=4e6b2537d1f717abea51adb3c03b74d97de7dfda commit 4e6b2537d1f717abea51adb3c03b74d97de7dfda Author: Li-Wen Hsu AuthorDate: 2021-07-04 14:07:23 +0000 Commit: Li-Wen Hsu CommitDate: 2021-07-27 19:22:28 +0000 man7: Update FreeBSD.org URLs MFC after: 3 days (cherry picked from commit 8dfb00245701a4f9290cd3a24e9bdcafa55a075b) --- share/man/man7/ports.7 | 4 ++-- share/man/man7/tests.7 | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/share/man/man7/ports.7 b/share/man/man7/ports.7 index a7b46e2bdd11..33d04e318c9c 100644 --- a/share/man/man7/ports.7 +++ b/share/man/man7/ports.7 @@ -70,7 +70,7 @@ in .No \&: .Sm on .Pp -.Lk https://www.FreeBSD.org/doc/en/books/handbook/ports.html +.Lk https://docs.FreeBSD.org/en/books/handbook/ports/ .Pp For information about creating new ports, see .Sm off @@ -78,7 +78,7 @@ For information about creating new ports, see .No \&: .Sm on .Pp -.Lk https://www.FreeBSD.org/doc/en/books/porters-handbook/ +.Lk https://docs.FreeBSD.org/en/books/porters-handbook/ .Sh TARGETS Some of the .Xr make 1 diff --git a/share/man/man7/tests.7 b/share/man/man7/tests.7 index cdb242d1a0af..9b1b26c9e0fa 100644 --- a/share/man/man7/tests.7 +++ b/share/man/man7/tests.7 @@ -200,7 +200,7 @@ For more details please refer to: .It .Lk https://lists.freebsd.org/ "FreeBSD Mailing Lists" .It -.Lk https://www.freebsd.org/support.html "Problem Reporting" +.Lk https://www.freebsd.org/support/ "Problem Reporting" .El .Sh FILES .Bl -tag -compact -width usrXlocalXetcXkyuaXkyuaXconfXX From owner-dev-commits-src-all@freebsd.org Tue Jul 27 19:26: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 E7D66667AC5; Tue, 27 Jul 2021 19:26: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 4GZ6Gg6D5Pz4xtN; Tue, 27 Jul 2021 19:26: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 BC9A610531; Tue, 27 Jul 2021 19:26: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 16RJQJvv085758; Tue, 27 Jul 2021 19:26:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RJQJAG085757; Tue, 27 Jul 2021 19:26:19 GMT (envelope-from git) Date: Tue, 27 Jul 2021 19:26:19 GMT Message-Id: <202107271926.16RJQJAG085757@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: f4e3cb4b6bed - stable/13 - freebsd-tips: Use a fetchable URL as example 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: f4e3cb4b6bedf7325a6c44ff95c5f7a7ef76272d 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, 27 Jul 2021 19:26:20 -0000 The branch stable/13 has been updated by lwhsu: URL: https://cgit.FreeBSD.org/src/commit/?id=f4e3cb4b6bedf7325a6c44ff95c5f7a7ef76272d commit f4e3cb4b6bedf7325a6c44ff95c5f7a7ef76272d Author: Li-Wen Hsu AuthorDate: 2021-07-04 14:00:46 +0000 Commit: Li-Wen Hsu CommitDate: 2021-07-27 19:24:51 +0000 freebsd-tips: Use a fetchable URL as example MFC after: 3 days (cherry picked from commit ffe6afc4f0121f1909f2fa88694228f771dd3fcb) freebsd-tips: Fix the description of fetch(1) to match the command Reported by: jrtc27 MFC with: ffe6afc4f0121f1909f2fa88694228f771dd3fcb (cherry picked from commit 167897510919a76740eca0d79713abbd088660fe) --- usr.bin/fortune/datfiles/freebsd-tips | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr.bin/fortune/datfiles/freebsd-tips b/usr.bin/fortune/datfiles/freebsd-tips index 46f5ec31f8d6..aaee0ba6c400 100644 --- a/usr.bin/fortune/datfiles/freebsd-tips +++ b/usr.bin/fortune/datfiles/freebsd-tips @@ -443,9 +443,9 @@ You can use "pkg info" to see a list of packages you have installed. % You can use the 'fetch' command to retrieve files over ftp, http or https. - fetch https://www.FreeBSD.org/index.html + fetch https://www.FreeBSD.org/images/beastie.png -will download the front page of the FreeBSD web site. +will download the beastie image from the FreeBSD web site. % You can use "whereis" to search standard binary, manual page and source directories for the specified programs. This can be particularly handy From owner-dev-commits-src-all@freebsd.org Tue Jul 27 19:26: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 6A7DB667A59; Tue, 27 Jul 2021 19:26: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 4GZ6Gp20Qqz4y1t; Tue, 27 Jul 2021 19:26: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 0A7681098B; Tue, 27 Jul 2021 19:26: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 16RJQPCr085876; Tue, 27 Jul 2021 19:26:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RJQP41085875; Tue, 27 Jul 2021 19:26:25 GMT (envelope-from git) Date: Tue, 27 Jul 2021 19:26:25 GMT Message-Id: <202107271926.16RJQP41085875@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: 76b5de00137a - stable/12 - freebsd-tips: Use a fetchable URL as example 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: 76b5de00137a7ba8a872ce18e9ccacdb11acac8c 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, 27 Jul 2021 19:26:26 -0000 The branch stable/12 has been updated by lwhsu: URL: https://cgit.FreeBSD.org/src/commit/?id=76b5de00137a7ba8a872ce18e9ccacdb11acac8c commit 76b5de00137a7ba8a872ce18e9ccacdb11acac8c Author: Li-Wen Hsu AuthorDate: 2021-07-04 14:00:46 +0000 Commit: Li-Wen Hsu CommitDate: 2021-07-27 19:24:52 +0000 freebsd-tips: Use a fetchable URL as example MFC after: 3 days (cherry picked from commit ffe6afc4f0121f1909f2fa88694228f771dd3fcb) freebsd-tips: Fix the description of fetch(1) to match the command Reported by: jrtc27 MFC with: ffe6afc4f0121f1909f2fa88694228f771dd3fcb (cherry picked from commit 167897510919a76740eca0d79713abbd088660fe) --- usr.bin/fortune/datfiles/freebsd-tips | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr.bin/fortune/datfiles/freebsd-tips b/usr.bin/fortune/datfiles/freebsd-tips index 93075532cee4..761b6b172cd7 100644 --- a/usr.bin/fortune/datfiles/freebsd-tips +++ b/usr.bin/fortune/datfiles/freebsd-tips @@ -443,9 +443,9 @@ You can use "pkg info" to see a list of packages you have installed. % You can use the 'fetch' command to retrieve files over ftp, http or https. - fetch https://www.FreeBSD.org/index.html + fetch https://www.FreeBSD.org/images/beastie.png -will download the front page of the FreeBSD web site. +will download the beastie image from the FreeBSD web site. % You can use "whereis" to search standard binary, manual page and source directories for the specified programs. This can be particularly handy From owner-dev-commits-src-all@freebsd.org Tue Jul 27 19:59: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 254AC66848D; Tue, 27 Jul 2021 19:59: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 4GZ70Y0Fhgz50QV; Tue, 27 Jul 2021 19:59: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 E56D410E93; Tue, 27 Jul 2021 19:59: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 16RJx8Zd025945; Tue, 27 Jul 2021 19:59:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RJx8Wb025944; Tue, 27 Jul 2021 19:59:08 GMT (envelope-from git) Date: Tue, 27 Jul 2021 19:59:08 GMT Message-Id: <202107271959.16RJx8Wb025944@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: 933cb282b69d - stable/13 - Fix the 'linux' rc script on aarch64. 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: 933cb282b69d8ea606dab4980126805737e8d5fb 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, 27 Jul 2021 19:59:09 -0000 The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=933cb282b69d8ea606dab4980126805737e8d5fb commit 933cb282b69d8ea606dab4980126805737e8d5fb Author: Edward Tomasz Napierala AuthorDate: 2021-03-16 16:48:13 +0000 Commit: Ed Maste CommitDate: 2021-07-27 19:57:55 +0000 Fix the 'linux' rc script on aarch64. Previously it would try to load linux.ko instead of linux64.ko and fail. While here, don't try to match 'linuxaout'; even if implemented, it's the same module as `linuxelf`. Reviewed By: emaste Sponsored By: EPSRC Differential Revision: https://reviews.freebsd.org/D29288 (cherry picked from commit e026f4243c5a65d19a63d98f55be17e8294a1e87) --- libexec/rc/rc.d/linux | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libexec/rc/rc.d/linux b/libexec/rc/rc.d/linux index f44a9d02fc8d..c9c45ba8b338 100755 --- a/libexec/rc/rc.d/linux +++ b/libexec/rc/rc.d/linux @@ -19,11 +19,17 @@ linux_start() { local _emul_path _tmpdir - load_kld -e 'linux(aout|elf)' linux case `sysctl -n hw.machine_arch` in + aarch64) + load_kld -e 'linux64elf' linux64 + ;; amd64) + load_kld -e 'linuxelf' linux load_kld -e 'linux64elf' linux64 ;; + i386) + load_kld -e 'linuxelf' linux + ;; esac _emul_path="$(sysctl -n compat.linux.emul_path)" From owner-dev-commits-src-all@freebsd.org Tue Jul 27 20:06: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 06175668235; Tue, 27 Jul 2021 20:06: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 4GZ78m6kkxz512v; Tue, 27 Jul 2021 20:06: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 CB3AD10EAE; Tue, 27 Jul 2021 20:06: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 16RK6G49039631; Tue, 27 Jul 2021 20:06:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RK6GTg039630; Tue, 27 Jul 2021 20:06:16 GMT (envelope-from git) Date: Tue, 27 Jul 2021 20:06:16 GMT Message-Id: <202107272006.16RK6GTg039630@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Glen Barber Subject: git: c3c458ce3c91 - stable/13 - bsdinstall: Only show menu if there are more items to be installed MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gjb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c3c458ce3c9135bcb0aaa086d29a9b5e5492f25a 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, 27 Jul 2021 20:06:17 -0000 The branch stable/13 has been updated by gjb: URL: https://cgit.FreeBSD.org/src/commit/?id=c3c458ce3c9135bcb0aaa086d29a9b5e5492f25a commit c3c458ce3c9135bcb0aaa086d29a9b5e5492f25a Author: Renato Botelho AuthorDate: 2021-07-22 20:02:34 +0000 Commit: Glen Barber CommitDate: 2021-07-27 20:05:41 +0000 bsdinstall: Only show menu if there are more items to be installed Obtained from: Rubicon Communications, LLC ("Netgate") Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 95f0da5be1e3456c930f5f9538cbc099c65f2014) --- usr.sbin/bsdinstall/scripts/auto | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/usr.sbin/bsdinstall/scripts/auto b/usr.sbin/bsdinstall/scripts/auto index 68809a22671b..9f8946880f61 100755 --- a/usr.sbin/bsdinstall/scripts/auto +++ b/usr.sbin/bsdinstall/scripts/auto @@ -157,16 +157,18 @@ if [ -f $BSDINSTALL_DISTDIR/MANIFEST ]; then DISTMENU=`awk -F'\t' '!/^(kernel\.txz|base\.txz)/{print $1,$5,$6}' $BSDINSTALL_DISTDIR/MANIFEST` DISTMENU="$(echo ${DISTMENU} | sed -E 's/\.txz//g')" - exec 3>&1 - EXTRA_DISTS=$( eval dialog \ - --backtitle \"FreeBSD Installer\" \ - --title \"Distribution Select\" --nocancel --separate-output \ - --checklist \"Choose optional system components to install:\" \ - 0 0 0 $DISTMENU \ - 2>&1 1>&3 ) - for dist in $EXTRA_DISTS; do - export DISTRIBUTIONS="$DISTRIBUTIONS $dist.txz" - done + if [ -n "$DISTMENU" ]; then + exec 3>&1 + EXTRA_DISTS=$( eval dialog \ + --backtitle \"FreeBSD Installer\" \ + --title \"Distribution Select\" --nocancel --separate-output \ + --checklist \"Choose optional system components to install:\" \ + 0 0 0 $DISTMENU \ + 2>&1 1>&3 ) + for dist in $EXTRA_DISTS; do + export DISTRIBUTIONS="$DISTRIBUTIONS $dist.txz" + done + fi fi FETCH_DISTRIBUTIONS="" From owner-dev-commits-src-all@freebsd.org Tue Jul 27 20:06: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 D3C1D66841B; Tue, 27 Jul 2021 20:06: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 4GZ78x5hHxz50pn; Tue, 27 Jul 2021 20:06: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 ABA2711125; Tue, 27 Jul 2021 20:06: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 16RK6POJ039753; Tue, 27 Jul 2021 20:06:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RK6PlK039752; Tue, 27 Jul 2021 20:06:25 GMT (envelope-from git) Date: Tue, 27 Jul 2021 20:06:25 GMT Message-Id: <202107272006.16RK6PlK039752@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Glen Barber Subject: git: 3312bc6f109d - stable/12 - bsdinstall: Only show menu if there are more items to be installed MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gjb X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 3312bc6f109d16d082db771c38832649a668c4de 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, 27 Jul 2021 20:06:25 -0000 The branch stable/12 has been updated by gjb: URL: https://cgit.FreeBSD.org/src/commit/?id=3312bc6f109d16d082db771c38832649a668c4de commit 3312bc6f109d16d082db771c38832649a668c4de Author: Renato Botelho AuthorDate: 2021-07-22 20:02:34 +0000 Commit: Glen Barber CommitDate: 2021-07-27 20:05:08 +0000 bsdinstall: Only show menu if there are more items to be installed Obtained from: Rubicon Communications, LLC ("Netgate") Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 95f0da5be1e3456c930f5f9538cbc099c65f2014) --- usr.sbin/bsdinstall/scripts/auto | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/usr.sbin/bsdinstall/scripts/auto b/usr.sbin/bsdinstall/scripts/auto index f86ccb62c179..7e19f29c757f 100755 --- a/usr.sbin/bsdinstall/scripts/auto +++ b/usr.sbin/bsdinstall/scripts/auto @@ -118,16 +118,18 @@ if [ -f $BSDINSTALL_DISTDIR/MANIFEST ]; then DISTMENU=`awk -F'\t' '!/^(kernel\.txz|base\.txz)/{print $1,$5,$6}' $BSDINSTALL_DISTDIR/MANIFEST` DISTMENU="$(echo ${DISTMENU} | sed -E 's/\.txz//g')" - exec 3>&1 - EXTRA_DISTS=$( eval dialog \ - --backtitle \"FreeBSD Installer\" \ - --title \"Distribution Select\" --nocancel --separate-output \ - --checklist \"Choose optional system components to install:\" \ - 0 0 0 $DISTMENU \ - 2>&1 1>&3 ) - for dist in $EXTRA_DISTS; do - export DISTRIBUTIONS="$DISTRIBUTIONS $dist.txz" - done + if [ -n "$DISTMENU" ]; then + exec 3>&1 + EXTRA_DISTS=$( eval dialog \ + --backtitle \"FreeBSD Installer\" \ + --title \"Distribution Select\" --nocancel --separate-output \ + --checklist \"Choose optional system components to install:\" \ + 0 0 0 $DISTMENU \ + 2>&1 1>&3 ) + for dist in $EXTRA_DISTS; do + export DISTRIBUTIONS="$DISTRIBUTIONS $dist.txz" + done + fi fi LOCAL_DISTRIBUTIONS="MANIFEST" From owner-dev-commits-src-all@freebsd.org Tue Jul 27 20:13: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 0BC0D6686C9; Tue, 27 Jul 2021 20:13: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 4GZ7Kf6dc6z51C8; Tue, 27 Jul 2021 20:13: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 C16811141C; Tue, 27 Jul 2021 20:13: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 16RKDw6P052882; Tue, 27 Jul 2021 20:13:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RKDwAS052881; Tue, 27 Jul 2021 20:13:58 GMT (envelope-from git) Date: Tue, 27 Jul 2021 20:13:58 GMT Message-Id: <202107272013.16RKDwAS052881@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Glen Barber Subject: git: 27988b833300 - stable/11 - bsdinstall: Only show menu if there are more items to be installed MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gjb X-Git-Repository: src X-Git-Refname: refs/heads/stable/11 X-Git-Reftype: branch X-Git-Commit: 27988b8333007d319eb9e9929bda787c5012e59e 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, 27 Jul 2021 20:13:59 -0000 The branch stable/11 has been updated by gjb: URL: https://cgit.FreeBSD.org/src/commit/?id=27988b8333007d319eb9e9929bda787c5012e59e commit 27988b8333007d319eb9e9929bda787c5012e59e Author: Renato Botelho AuthorDate: 2021-07-22 20:02:34 +0000 Commit: Glen Barber CommitDate: 2021-07-27 20:13:41 +0000 bsdinstall: Only show menu if there are more items to be installed Obtained from: Rubicon Communications, LLC ("Netgate") Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 95f0da5be1e3456c930f5f9538cbc099c65f2014) --- usr.sbin/bsdinstall/scripts/auto | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/usr.sbin/bsdinstall/scripts/auto b/usr.sbin/bsdinstall/scripts/auto index 3fd1dae7ed70..3226f9758b05 100755 --- a/usr.sbin/bsdinstall/scripts/auto +++ b/usr.sbin/bsdinstall/scripts/auto @@ -118,16 +118,18 @@ if [ -f $BSDINSTALL_DISTDIR/MANIFEST ]; then DISTMENU=`awk -F'\t' '!/^(kernel\.txz|base\.txz)/{print $1,$5,$6}' $BSDINSTALL_DISTDIR/MANIFEST` DISTMENU="$(echo ${DISTMENU} | sed -E 's/\.txz//g')" - exec 3>&1 - EXTRA_DISTS=$( eval dialog \ - --backtitle \"FreeBSD Installer\" \ - --title \"Distribution Select\" --nocancel --separate-output \ - --checklist \"Choose optional system components to install:\" \ - 0 0 0 $DISTMENU \ - 2>&1 1>&3 ) - for dist in $EXTRA_DISTS; do - export DISTRIBUTIONS="$DISTRIBUTIONS $dist.txz" - done + if [ -n "$DISTMENU" ]; then + exec 3>&1 + EXTRA_DISTS=$( eval dialog \ + --backtitle \"FreeBSD Installer\" \ + --title \"Distribution Select\" --nocancel --separate-output \ + --checklist \"Choose optional system components to install:\" \ + 0 0 0 $DISTMENU \ + 2>&1 1>&3 ) + for dist in $EXTRA_DISTS; do + export DISTRIBUTIONS="$DISTRIBUTIONS $dist.txz" + done + fi fi LOCAL_DISTRIBUTIONS="MANIFEST" From owner-dev-commits-src-all@freebsd.org Tue Jul 27 20:29: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 E4D206686F1; Tue, 27 Jul 2021 20:29: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 4GZ7gb67gXz51cZ; Tue, 27 Jul 2021 20:29: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 BADE811649; Tue, 27 Jul 2021 20:29: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 16RKTVkp066990; Tue, 27 Jul 2021 20:29:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RKTVNP066989; Tue, 27 Jul 2021 20:29:31 GMT (envelope-from git) Date: Tue, 27 Jul 2021 20:29:31 GMT Message-Id: <202107272029.16RKTVNP066989@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: e1e9e084a706 - main - Revert "Cirrus-CI: Temporarily skip package build + test" 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: e1e9e084a706d0b28603f4741393a8b84878da86 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, 27 Jul 2021 20:29:32 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=e1e9e084a706d0b28603f4741393a8b84878da86 commit e1e9e084a706d0b28603f4741393a8b84878da86 Author: Ed Maste AuthorDate: 2021-07-26 15:49:15 +0000 Commit: Ed Maste CommitDate: 2021-07-27 20:28:47 +0000 Revert "Cirrus-CI: Temporarily skip package build + test" This reverts commit 2bfba2a04b05524d72a6190164aa5aaa1d29e337. As of commit 4e224e4be7c3 Makefile.inc1 works with old and new pkg. PR: 257422 Sponsored by: The FreeBSD Foundation --- .cirrus.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 6e1e515ff84b..f2e5f9766589 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -24,10 +24,10 @@ task: - chown user:user /usr/obj/$(pwd -P) script: - su user -c "make -j$(sysctl -n hw.ncpu) CROSS_TOOLCHAIN=llvm12 WITHOUT_TOOLCHAIN=yes buildworld buildkernel" -# package_script: -# - su user -c "make CROSS_TOOLCHAIN=llvm12 WITHOUT_TOOLCHAIN=yes PKG_FORMAT=tar packages" -# test_script: -# - sh tools/boot/ci-qemu-test.sh + package_script: + - su user -c "make CROSS_TOOLCHAIN=llvm12 WITHOUT_TOOLCHAIN=yes PKG_FORMAT=tar packages" + test_script: + - sh tools/boot/ci-qemu-test.sh post_script: - df -m - du -m -s /usr/obj From owner-dev-commits-src-all@freebsd.org Tue Jul 27 21:24: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 C195F669937; Tue, 27 Jul 2021 21:24: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 4GZ8vY56qYz55rK; Tue, 27 Jul 2021 21:24: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 95AEF12309; Tue, 27 Jul 2021 21:24: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 16RLOv8A046971; Tue, 27 Jul 2021 21:24:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RLOv5Z046970; Tue, 27 Jul 2021 21:24:57 GMT (envelope-from git) Date: Tue, 27 Jul 2021 21:24:57 GMT Message-Id: <202107272124.16RLOv5Z046970@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: 5f946c76c0cc - main - 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/main X-Git-Reftype: branch X-Git-Commit: 5f946c76c0cc2d1b4fa150f691764da163579d19 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, 27 Jul 2021 21:24:57 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=5f946c76c0cc2d1b4fa150f691764da163579d19 commit 5f946c76c0cc2d1b4fa150f691764da163579d19 Author: Ed Maste AuthorDate: 2021-07-27 21:18:41 +0000 Commit: Ed Maste CommitDate: 2021-07-27 21:18:41 +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 --- 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 79856e28c1aa..33fa2c4f1c97 100644 --- a/tools/build/options/WITHOUT_KERNEL_SYMBOLS +++ b/tools/build/options/WITHOUT_KERNEL_SYMBOLS @@ -1,5 +1,2 @@ .\" $FreeBSD$ -Do 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 Tue Jul 27 21:29: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 8A8F6669C3C; Tue, 27 Jul 2021 21:29: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 4GZ90X3J06z56JS; Tue, 27 Jul 2021 21:29: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 4AA82122CC; Tue, 27 Jul 2021 21:29: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 16RLTFrq047358; Tue, 27 Jul 2021 21:29:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RLTFcA047357; Tue, 27 Jul 2021 21:29:15 GMT (envelope-from git) Date: Tue, 27 Jul 2021 21:29:15 GMT Message-Id: <202107272129.16RLTFcA047357@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: 1a7c2789a9b9 - main - Regen src.conf.5 after 5f946c76c0cc 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: 1a7c2789a9b9d26d56cb49b597b94284a8310f45 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, 27 Jul 2021 21:29:16 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=1a7c2789a9b9d26d56cb49b597b94284a8310f45 commit 1a7c2789a9b9d26d56cb49b597b94284a8310f45 Author: Ed Maste AuthorDate: 2021-07-27 21:28:32 +0000 Commit: Ed Maste CommitDate: 2021-07-27 21:28:42 +0000 Regen src.conf.5 after 5f946c76c0cc --- 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 b08abf4888b7..658161f65d2f 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 6, 2021 +.Dd July 27, 2021 .Dt SRC.CONF 5 .Os .Sh NAME @@ -798,10 +798,7 @@ and Enable the "retpoline" mitigation for CVE-2017-5715 in the kernel build. .It Va WITHOUT_KERNEL_SYMBOLS -Do 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 Do not build the .Nm libkvm From owner-dev-commits-src-all@freebsd.org Tue Jul 27 23: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 6DD5A66B3BD; Tue, 27 Jul 2021 23: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 4GZDB42XR5z3Hkc; Tue, 27 Jul 2021 23: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 4068A13FE0; Tue, 27 Jul 2021 23: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 16RNqinr046323; Tue, 27 Jul 2021 23: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 16RNqipc046322; Tue, 27 Jul 2021 23:52:44 GMT (envelope-from git) Date: Tue, 27 Jul 2021 23:52:44 GMT Message-Id: <202107272352.16RNqipc046322@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: e0229c5110d2 - main - 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/main X-Git-Reftype: branch X-Git-Commit: e0229c5110d2a35e1cc464a596fff2498b836b1c 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, 27 Jul 2021 23:52:44 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=e0229c5110d2a35e1cc464a596fff2498b836b1c commit e0229c5110d2a35e1cc464a596fff2498b836b1c Author: Alexander Motin AuthorDate: 2021-07-27 23:50:52 +0000 Commit: Alexander Motin CommitDate: 2021-07-27 23:52:39 +0000 Remove opensolaris_atomic.S dependency. This file is no longer there, so this broke static zfs build. MFC after: 1 week --- sys/conf/files.i386 | 1 - 1 file changed, 1 deletion(-) diff --git a/sys/conf/files.i386 b/sys/conf/files.i386 index d0148f280903..8083392c53f6 100644 --- a/sys/conf/files.i386 +++ b/sys/conf/files.i386 @@ -22,7 +22,6 @@ cloudabi32_vdso_blob.o optional compat_cloudabi32 \ compile-with "${OBJCOPY} --input-target binary --output-target elf32-i386-freebsd --binary-architecture i386 cloudabi32_vdso.o ${.TARGET}" \ no-implicit-rule \ clean "cloudabi32_vdso_blob.o" -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}" crypto/aesni/aeskeys_i386.S optional aesni From owner-dev-commits-src-all@freebsd.org Wed Jul 28 00:09: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 5CCC666BAF4; Wed, 28 Jul 2021 00:09: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 4GZDYL1s9Rz3J9w; Wed, 28 Jul 2021 00:09: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 27971141E5; Wed, 28 Jul 2021 00:09: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 16S09Qbe060282; Wed, 28 Jul 2021 00:09:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16S09Q8P060281; Wed, 28 Jul 2021 00:09:26 GMT (envelope-from git) Date: Wed, 28 Jul 2021 00:09:26 GMT Message-Id: <202107280009.16S09Q8P060281@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: 941650aae976 - main - vnic: add TODO list item for non-promisc mode 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: 941650aae9762293f4c63788ddb17e0114828813 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, 28 Jul 2021 00:09:26 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=941650aae9762293f4c63788ddb17e0114828813 commit 941650aae9762293f4c63788ddb17e0114828813 Author: Ed Maste AuthorDate: 2021-07-27 21:51:21 +0000 Commit: Ed Maste CommitDate: 2021-07-28 00:09:01 +0000 vnic: add TODO list item for non-promisc mode Also drop ARM64TODO comments; this is an issue with this specific driver, not a general arm64 issue. PR: 223575 --- sys/dev/vnic/nic_main.c | 11 +++++++++++ sys/dev/vnic/nicvf_main.c | 6 ++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/sys/dev/vnic/nic_main.c b/sys/dev/vnic/nic_main.c index 8e6aa60f6ca8..1bc07b0291ea 100644 --- a/sys/dev/vnic/nic_main.c +++ b/sys/dev/vnic/nic_main.c @@ -27,6 +27,17 @@ * */ +/* + * Marvell/Cavium ThunderX vnic/bgx network controller + * + * UNIMPLEMENTED FEATURES + * ---------------------- + * A number of features supported by the hardware are not yet implemented in + * this driver: + * + * - PR223575 non-promiscuous mode (driver currently forces promisc) + */ + #include __FBSDID("$FreeBSD$"); diff --git a/sys/dev/vnic/nicvf_main.c b/sys/dev/vnic/nicvf_main.c index c8b088dee1fa..73591a0b161a 100644 --- a/sys/dev/vnic/nicvf_main.c +++ b/sys/dev/vnic/nicvf_main.c @@ -485,16 +485,14 @@ nicvf_if_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) if (if_getdrvflags(ifp) & IFF_DRV_RUNNING) { if ((flags ^ nic->if_flags) & IFF_PROMISC) { /* Change promiscous mode */ -#if 0 - /* ARM64TODO */ +#if 0 /* XXX* / nicvf_set_promiscous(nic); #endif } if ((flags ^ nic->if_flags) & IFF_ALLMULTI) { /* Change multicasting settings */ -#if 0 - /* ARM64TODO */ +#if 0 /* XXX */ nicvf_set_multicast(nic); #endif } From owner-dev-commits-src-all@freebsd.org Wed Jul 28 09:30: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 3E83765742C; Wed, 28 Jul 2021 09:30: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 4GZT0s1Lznz4ggv; Wed, 28 Jul 2021 09:30: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 173691B99A; Wed, 28 Jul 2021 09:30: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 16S9UbUU014778; Wed, 28 Jul 2021 09:30:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16S9Uakp014777; Wed, 28 Jul 2021 09:30:36 GMT (envelope-from git) Date: Wed, 28 Jul 2021 09:30:36 GMT Message-Id: <202107280930.16S9Uakp014777@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: 2531f067ea0e - main - Teach the arm64 kernel to identify the Arm AEM 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: 2531f067ea0e9c77b081445800de8e9584d7d4ab 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, 28 Jul 2021 09:30:37 -0000 The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=2531f067ea0e9c77b081445800de8e9584d7d4ab commit 2531f067ea0e9c77b081445800de8e9584d7d4ab Author: Andrew Turner AuthorDate: 2021-07-27 19:28:33 +0000 Commit: Andrew Turner CommitDate: 2021-07-27 19:33:21 +0000 Teach the arm64 kernel to identify the Arm AEM The Arm Architecture Envelope Model is a simulator that models the architecture rather than any specific implementation. Add its part ID macro and add it to the list of Arm CPUs we can decode. Sponsored by: The FreeBSD Foundation --- sys/arm64/arm64/identcpu.c | 1 + sys/arm64/include/cpu.h | 1 + 2 files changed, 2 insertions(+) diff --git a/sys/arm64/arm64/identcpu.c b/sys/arm64/arm64/identcpu.c index 233b036f4499..794b097195ef 100644 --- a/sys/arm64/arm64/identcpu.c +++ b/sys/arm64/arm64/identcpu.c @@ -190,6 +190,7 @@ struct cpu_implementers { */ /* ARM Ltd. */ static const struct cpu_parts cpu_parts_arm[] = { + { CPU_PART_AEM_V8, "AEMv8" }, { CPU_PART_FOUNDATION, "Foundation-Model" }, { CPU_PART_CORTEX_A35, "Cortex-A35" }, { CPU_PART_CORTEX_A53, "Cortex-A53" }, diff --git a/sys/arm64/include/cpu.h b/sys/arm64/include/cpu.h index 529f156f2e96..d58cf6f113c6 100644 --- a/sys/arm64/include/cpu.h +++ b/sys/arm64/include/cpu.h @@ -93,6 +93,7 @@ #define CPU_PART_NEOVERSE_N1 0xD0C #define CPU_PART_CORTEX_A77 0xD0D #define CPU_PART_CORTEX_A76AE 0xD0E +#define CPU_PART_AEM_V8 0xD0F /* Cavium Part numbers */ #define CPU_PART_THUNDERX 0x0A1 From owner-dev-commits-src-all@freebsd.org Wed Jul 28 09:30: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 5D7E365793A; Wed, 28 Jul 2021 09:30: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 4GZT0t2845z4grJ; Wed, 28 Jul 2021 09:30: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 325811BB2B; Wed, 28 Jul 2021 09:30: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 16S9UcNI014802; Wed, 28 Jul 2021 09:30:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16S9Uc2P014801; Wed, 28 Jul 2021 09:30:38 GMT (envelope-from git) Date: Wed, 28 Jul 2021 09:30:38 GMT Message-Id: <202107280930.16S9Uc2P014801@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: c007408c245b - main - Fix the spelling of '*/' in the vnic driver 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: c007408c245b7aff0f203b021e70f263e57d5173 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, 28 Jul 2021 09:30:38 -0000 The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=c007408c245b7aff0f203b021e70f263e57d5173 commit c007408c245b7aff0f203b021e70f263e57d5173 Author: Andrew Turner AuthorDate: 2021-07-27 19:43:08 +0000 Commit: Andrew Turner CommitDate: 2021-07-27 19:45:03 +0000 Fix the spelling of '*/' in the vnic driver Sponsored by: The FreeBSD Foundation --- sys/dev/vnic/nicvf_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/vnic/nicvf_main.c b/sys/dev/vnic/nicvf_main.c index 73591a0b161a..1dc49ee855a9 100644 --- a/sys/dev/vnic/nicvf_main.c +++ b/sys/dev/vnic/nicvf_main.c @@ -485,7 +485,7 @@ nicvf_if_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) if (if_getdrvflags(ifp) & IFF_DRV_RUNNING) { if ((flags ^ nic->if_flags) & IFF_PROMISC) { /* Change promiscous mode */ -#if 0 /* XXX* / +#if 0 /* XXX */ nicvf_set_promiscous(nic); #endif } From owner-dev-commits-src-all@freebsd.org Wed Jul 28 10:42: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 0FFEF658A98; Wed, 28 Jul 2021 10:42: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 4GZVbW74cbz4lxN; Wed, 28 Jul 2021 10:42: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 DB29C1C6E7; Wed, 28 Jul 2021 10:42: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 16SAgFsD012576; Wed, 28 Jul 2021 10:42:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16SAgFJb012575; Wed, 28 Jul 2021 10:42:15 GMT (envelope-from git) Date: Wed, 28 Jul 2021 10:42:15 GMT Message-Id: <202107281042.16SAgFJb012575@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: 9b6b793bd795 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 9b6b793bd79521edc082a89b264a30881cb65e22 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, 28 Jul 2021 10:42:16 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=9b6b793bd79521edc082a89b264a30881cb65e22 commit 9b6b793bd79521edc082a89b264a30881cb65e22 Author: Konstantin Belousov AuthorDate: 2021-07-19 15:40:38 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-28 10:21:12 +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 --- 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 69a82d642d79..af787908451a 100644 --- a/sys/kern/syscalls.master +++ b/sys/kern/syscalls.master @@ -2270,7 +2270,19 @@ int sig ); } -434-435 AUE_NULL RESERVED + +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 Wed Jul 28 10:42: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 34D4C658655; Wed, 28 Jul 2021 10:42: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 4GZVbY0rd4z4lph; Wed, 28 Jul 2021 10:42: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 04E091CA12; Wed, 28 Jul 2021 10:42: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 16SAgG3d012600; Wed, 28 Jul 2021 10:42:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16SAgGDD012599; Wed, 28 Jul 2021 10:42:16 GMT (envelope-from git) Date: Wed, 28 Jul 2021 10:42:16 GMT Message-Id: <202107281042.16SAgGDD012599@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: 273728b1257f - main - 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/main X-Git-Reftype: branch X-Git-Commit: 273728b1257fa4f6c945bca592227e29763fc4a7 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, 28 Jul 2021 10:42:17 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=273728b1257fa4f6c945bca592227e29763fc4a7 commit 273728b1257fa4f6c945bca592227e29763fc4a7 Author: Konstantin Belousov AuthorDate: 2021-07-27 22:00:18 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-28 10:21:22 +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/sys/syscall.h | 2 ++ sys/sys/syscall.mk | 2 ++ sys/sys/sysproto.h | 10 ++++++++++ 9 files changed, 34 insertions(+), 8 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 21377d961a98..bc5beb83cf3f 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 = reserved for local use */ - { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 435 = reserved for local use */ + { 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 f75e4aaea790..190c82dd4e5e 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 = reserved for local use */ - "#435", /* 435 = reserved for local use */ + "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/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 83b74f53df5e..f17b1951f559 100644 --- a/sys/sys/sysproto.h +++ b/sys/sys/sysproto.h @@ -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 Wed Jul 28 11:34: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 E9850658F61; Wed, 28 Jul 2021 11:34: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 4GZWmJ5xKdz4pmB; Wed, 28 Jul 2021 11:34: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 B3A1D1D708; Wed, 28 Jul 2021 11:34: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 16SBYuoW079974; Wed, 28 Jul 2021 11:34:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16SBYuKT079972; Wed, 28 Jul 2021 11:34:56 GMT (envelope-from git) Date: Wed, 28 Jul 2021 11:34:56 GMT Message-Id: <202107281134.16SBYuKT079972@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: b633e08c705f - main - ibcore: Kernel space update based on Linux 5.7-rc1. 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: b633e08c705fe43180567eae26923d6f6f98c8d9 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, 28 Jul 2021 11:34:57 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=b633e08c705fe43180567eae26923d6f6f98c8d9 commit b633e08c705fe43180567eae26923d6f6f98c8d9 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:02:00 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-28 11:28:29 +0000 ibcore: Kernel space update based on Linux 5.7-rc1. Overview: This is the first stage of a RDMA stack upgrade introducing kernel changes only based on Linux 5.7-rc1. This patch is based on about four main areas of work: - Update of the IB uobjects system: - The memory holding so-called AH, CQ, PD, SRQ and UCONTEXT objects is now managed by ibcore. This also require some changes in the kernel verbs API. The updated verbs changes are typically about initialize and deinitialize objects, and remove allocation and free of memory. - Update of the uverbs IOCTL framework: - The parsing and handling of user-space commands has been completely refactored to integrate with the updated IB uobjects system. - Various changes and updates to the generic uverbs interfaces in device drivers including the new uAPI surface. - The mlx5_ib_devx.c in mlx5ib and related mlx5 core changes. Dependencies: - The mlx4ib driver code has been updated with the minimum changes needed. - The mlx5ib driver code has been updated with the minimum changes needed including DV support. Compatibility: - All user-space facing APIs are backwards compatible after this change. - All kernel-space facing RDMA APIs are backwards compatible after this change, with exception of ib_create_ah() and ib_destroy_ah() which takes a new flag. - The "ib_device_ops" structure exist, but only contains the driver ID and some structure sizes. Differences from Linux: - Infiniband drivers must use the INIT_IB_DEVICE_OPS() macro to set the sizes needed for allocating various IB objects, when adding IB device instances. Security: - PRIV_NET_RAW is needed to use raw ethernet transmit features. - PRIV_DRIVER is needed to use other privileged operations. Based on upstream Linux, Torvalds (5.7-rc1): 8632e9b5645bbc2331d21d892b0d6961c1a08429 MFC after: 1 week Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D31149 Sponsored by: NVIDIA Networking --- sys/conf/files | 26 + sys/dev/cxgbe/iw_cxgbe/cq.c | 32 +- sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h | 36 +- sys/dev/cxgbe/iw_cxgbe/mem.c | 4 +- sys/dev/cxgbe/iw_cxgbe/provider.c | 96 +- sys/dev/cxgbe/iw_cxgbe/qp.c | 5 +- sys/dev/mlx4/mlx4_ib/mlx4_ib.h | 37 +- sys/dev/mlx4/mlx4_ib/mlx4_ib_ah.c | 74 +- sys/dev/mlx4/mlx4_ib/mlx4_ib_cq.c | 89 +- sys/dev/mlx4/mlx4_ib/mlx4_ib_mad.c | 65 +- sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c | 201 +- sys/dev/mlx4/mlx4_ib/mlx4_ib_mr.c | 9 +- sys/dev/mlx4/mlx4_ib/mlx4_ib_qp.c | 42 +- sys/dev/mlx4/mlx4_ib/mlx4_ib_srq.c | 84 +- sys/dev/mlx5/device.h | 22 +- sys/dev/mlx5/driver.h | 34 +- sys/dev/mlx5/mlx5_core/mlx5_eq.c | 8 +- sys/dev/mlx5/mlx5_core/mlx5_fw.c | 8 +- sys/dev/mlx5/mlx5_core/mlx5_mr.c | 12 +- sys/dev/mlx5/mlx5_core/mlx5_pd.c | 8 +- sys/dev/mlx5/mlx5_core/mlx5_tls.c | 2 +- sys/dev/mlx5/mlx5_core/mlx5_transobj.c | 15 +- sys/dev/mlx5/mlx5_core/transobj.h | 10 +- sys/dev/mlx5/mlx5_en/en.h | 2 +- sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 18 +- sys/dev/mlx5/mlx5_en/mlx5_en_rl.c | 2 +- sys/dev/mlx5/mlx5_ib/mlx5_ib.h | 132 +- sys/dev/mlx5/mlx5_ib/mlx5_ib_ah.c | 38 +- sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c | 88 +- sys/dev/mlx5/mlx5_ib/mlx5_ib_devx.c | 2930 ++++++++++++++ sys/dev/mlx5/mlx5_ib/mlx5_ib_gsi.c | 2 +- sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c | 525 ++- sys/dev/mlx5/mlx5_ib/mlx5_ib_mr.c | 8 +- sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c | 175 +- sys/dev/mlx5/mlx5_ib/mlx5_ib_srq.c | 126 +- sys/dev/mlx5/mlx5_ifc.h | 560 ++- sys/dev/mlx5/qp.h | 2 +- sys/dev/mlx5/srq.h | 1 + sys/dev/mthca/mthca_dev.h | 9 +- sys/dev/mthca/mthca_mad.c | 7 +- sys/dev/mthca/mthca_provider.c | 317 +- sys/dev/mthca/mthca_qp.c | 35 +- sys/dev/mthca/mthca_srq.c | 42 +- sys/dev/qlnx/qlnxr/qlnxr_def.h | 1 + sys/dev/qlnx/qlnxr/qlnxr_os.c | 7 + sys/dev/qlnx/qlnxr/qlnxr_verbs.c | 243 +- sys/dev/qlnx/qlnxr/qlnxr_verbs.h | 62 +- sys/modules/ibcore/Makefile | 13 + sys/modules/mlx5/Makefile | 1 + sys/modules/mlx5en/Makefile | 1 + sys/modules/mlx5fpga_tools/Makefile | 1 + sys/modules/mlx5ib/Makefile | 1 + sys/modules/mlxfw/Makefile | 1 + sys/ofed/drivers/infiniband/core/core_priv.h | 49 + sys/ofed/drivers/infiniband/core/ib_agent.c | 4 +- sys/ofed/drivers/infiniband/core/ib_cm.c | 6 +- sys/ofed/drivers/infiniband/core/ib_core_uverbs.c | 390 ++ sys/ofed/drivers/infiniband/core/ib_cq.c | 32 +- sys/ofed/drivers/infiniband/core/ib_mad_rmpp.c | 10 +- sys/ofed/drivers/infiniband/core/ib_rdma_core.c | 943 +++++ sys/ofed/drivers/infiniband/core/ib_sa_query.c | 4 +- sys/ofed/drivers/infiniband/core/ib_user_mad.c | 6 +- sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c | 4024 +++++++++----------- sys/ofed/drivers/infiniband/core/ib_uverbs_ioctl.c | 767 ++++ sys/ofed/drivers/infiniband/core/ib_uverbs_main.c | 1339 +++---- .../drivers/infiniband/core/ib_uverbs_std_types.c | 359 ++ .../infiniband/core/ib_uverbs_std_types_async_fd.c | 54 + .../infiniband/core/ib_uverbs_std_types_counters.c | 161 + .../infiniband/core/ib_uverbs_std_types_cq.c | 214 ++ .../infiniband/core/ib_uverbs_std_types_device.c | 261 ++ .../infiniband/core/ib_uverbs_std_types_dm.c | 118 + .../core/ib_uverbs_std_types_flow_action.c | 449 +++ .../infiniband/core/ib_uverbs_std_types_mr.c | 221 ++ sys/ofed/drivers/infiniband/core/ib_uverbs_uapi.c | 731 ++++ sys/ofed/drivers/infiniband/core/ib_verbs.c | 453 ++- sys/ofed/drivers/infiniband/core/rdma_core.h | 189 + sys/ofed/drivers/infiniband/core/uverbs.h | 215 +- sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c | 4 +- sys/ofed/drivers/infiniband/ulp/sdp/sdp_rx.c | 8 +- sys/ofed/drivers/infiniband/ulp/sdp/sdp_tx.c | 8 +- sys/ofed/include/rdma/ib_verbs.h | 959 +++-- sys/ofed/include/rdma/signature.h | 124 + sys/ofed/include/rdma/uverbs_ioctl.h | 958 +++++ sys/ofed/include/rdma/uverbs_named_ioctl.h | 124 + sys/ofed/include/rdma/uverbs_std_types.h | 193 + sys/ofed/include/rdma/uverbs_types.h | 210 + sys/ofed/include/uapi/rdma/ib_user_ioctl_cmds.h | 259 ++ sys/ofed/include/uapi/rdma/ib_user_ioctl_verbs.h | 211 + sys/ofed/include/uapi/rdma/ib_user_mad.h | 20 +- sys/ofed/include/uapi/rdma/ib_user_verbs.h | 424 ++- sys/ofed/include/uapi/rdma/mlx5-abi.h | 18 + sys/ofed/include/uapi/rdma/mlx5_user_ioctl_cmds.h | 283 ++ sys/ofed/include/uapi/rdma/mlx5_user_ioctl_verbs.h | 87 + sys/ofed/include/uapi/rdma/rdma_user_ioctl.h | 63 + sys/ofed/include/uapi/rdma/rdma_user_ioctl_cmds.h | 92 + 95 files changed, 16284 insertions(+), 5029 deletions(-) diff --git a/sys/conf/files b/sys/conf/files index 5e47c907e793..3d76d9909f77 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -4628,6 +4628,8 @@ ofed/drivers/infiniband/core/ib_cm.c optional ofed \ compile-with "${OFED_C}" ofed/drivers/infiniband/core/ib_cma.c optional ofed \ compile-with "${OFED_C}" +ofed/drivers/infiniband/core/ib_core_uverbs.c optional ofed \ + compile-with "${OFED_C}" ofed/drivers/infiniband/core/ib_cq.c optional ofed \ compile-with "${OFED_C}" ofed/drivers/infiniband/core/ib_device.c optional ofed \ @@ -4648,6 +4650,8 @@ ofed/drivers/infiniband/core/ib_multicast.c optional ofed \ compile-with "${OFED_C}" ofed/drivers/infiniband/core/ib_packer.c optional ofed \ compile-with "${OFED_C}" +ofed/drivers/infiniband/core/ib_rdma_core.c optional ofed \ + compile-with "${OFED_C}" ofed/drivers/infiniband/core/ib_roce_gid_mgmt.c optional ofed \ compile-with "${OFED_C}" ofed/drivers/infiniband/core/ib_sa_query.c optional ofed \ @@ -4668,10 +4672,30 @@ ofed/drivers/infiniband/core/ib_user_mad.c optional ofed \ compile-with "${OFED_C}" ofed/drivers/infiniband/core/ib_uverbs_cmd.c optional ofed \ compile-with "${OFED_C}" +ofed/drivers/infiniband/core/ib_uverbs_ioctl.c optional ofed \ + compile-with "${OFED_C}" ofed/drivers/infiniband/core/ib_uverbs_main.c optional ofed \ compile-with "${OFED_C}" ofed/drivers/infiniband/core/ib_uverbs_marshall.c optional ofed \ compile-with "${OFED_C}" +ofed/drivers/infiniband/core/ib_uverbs_std_types.c optional ofed \ + compile-with "${OFED_C}" +ofed/drivers/infiniband/core/ib_uverbs_std_types_async_fd.c optional ofed \ + compile-with "${OFED_C}" +ofed/drivers/infiniband/core/ib_uverbs_std_types_counters.c optional ofed \ + compile-with "${OFED_C}" +ofed/drivers/infiniband/core/ib_uverbs_std_types_cq.c optional ofed \ + compile-with "${OFED_C}" +ofed/drivers/infiniband/core/ib_uverbs_std_types_device.c optional ofed \ + compile-with "${OFED_C}" +ofed/drivers/infiniband/core/ib_uverbs_std_types_dm.c optional ofed \ + compile-with "${OFED_C}" +ofed/drivers/infiniband/core/ib_uverbs_std_types_flow_action.c optional ofed \ + compile-with "${OFED_C}" +ofed/drivers/infiniband/core/ib_uverbs_std_types_mr.c optional ofed \ + compile-with "${OFED_C}" +ofed/drivers/infiniband/core/ib_uverbs_uapi.c optional ofed \ + compile-with "${OFED_C}" ofed/drivers/infiniband/core/ib_verbs.c optional ofed \ compile-with "${OFED_C}" @@ -4827,6 +4851,8 @@ dev/mlx5/mlx5_ib/mlx5_ib_cong.c optional mlx5ib pci ofed \ compile-with "${OFED_C}" dev/mlx5/mlx5_ib/mlx5_ib_cq.c optional mlx5ib pci ofed \ compile-with "${OFED_C}" +dev/mlx5/mlx5_ib/mlx5_ib_devx.c optional mlx5ib pci ofed \ + compile-with "${OFED_C}" dev/mlx5/mlx5_ib/mlx5_ib_doorbell.c optional mlx5ib pci ofed \ compile-with "${OFED_C}" dev/mlx5/mlx5_ib/mlx5_ib_gsi.c optional mlx5ib pci ofed \ diff --git a/sys/dev/cxgbe/iw_cxgbe/cq.c b/sys/dev/cxgbe/iw_cxgbe/cq.c index 55d50d5caf18..ab49e643e02d 100644 --- a/sys/dev/cxgbe/iw_cxgbe/cq.c +++ b/sys/dev/cxgbe/iw_cxgbe/cq.c @@ -883,7 +883,7 @@ int c4iw_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *wc) return !err || err == -ENODATA ? npolled : err; } -int c4iw_destroy_cq(struct ib_cq *ib_cq) +void c4iw_destroy_cq(struct ib_cq *ib_cq, struct ib_udata *udata) { struct c4iw_cq *chp; struct c4iw_ucontext *ucontext; @@ -895,22 +895,20 @@ int c4iw_destroy_cq(struct ib_cq *ib_cq) atomic_dec(&chp->refcnt); wait_event(chp->wait, !atomic_read(&chp->refcnt)); - ucontext = ib_cq->uobject ? to_c4iw_ucontext(ib_cq->uobject->context) - : NULL; + ucontext = rdma_udata_to_drv_context(udata, struct c4iw_ucontext, + ibucontext); destroy_cq(&chp->rhp->rdev, &chp->cq, ucontext ? &ucontext->uctx : &chp->cq.rdev->uctx); - kfree(chp); - return 0; } -struct ib_cq * -c4iw_create_cq(struct ib_device *ibdev, const struct ib_cq_init_attr *attr, - struct ib_ucontext *ib_context, struct ib_udata *udata) +int c4iw_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr, + struct ib_udata *udata) { + struct ib_device *ibdev = ibcq->device; int entries = attr->cqe; int vector = attr->comp_vector; struct c4iw_dev *rhp; - struct c4iw_cq *chp; + struct c4iw_cq *chp = to_c4iw_cq(ibcq); struct c4iw_create_cq_resp uresp; struct c4iw_ucontext *ucontext = NULL; int ret; @@ -919,17 +917,12 @@ c4iw_create_cq(struct ib_device *ibdev, const struct ib_cq_init_attr *attr, CTR3(KTR_IW_CXGBE, "%s ib_dev %p entries %d", __func__, ibdev, entries); if (attr->flags) - return ERR_PTR(-EINVAL); + return -EINVAL; rhp = to_c4iw_dev(ibdev); - chp = kzalloc(sizeof(*chp), GFP_KERNEL); - if (!chp) - return ERR_PTR(-ENOMEM); - - - if (ib_context) - ucontext = to_c4iw_ucontext(ib_context); + ucontext = rdma_udata_to_drv_context(udata, struct c4iw_ucontext, + ibucontext); /* account for the status page. */ entries++; @@ -1020,7 +1013,7 @@ c4iw_create_cq(struct ib_device *ibdev, const struct ib_cq_init_attr *attr, "%s cqid 0x%0x chp %p size %u memsize %zu, dma_addr 0x%0llx", __func__, chp->cq.cqid, chp, chp->cq.size, chp->cq.memsize, (unsigned long long) chp->cq.dma_addr); - return &chp->ibcq; + return 0; err5: kfree(mm2); err4: @@ -1031,8 +1024,7 @@ err2: destroy_cq(&chp->rhp->rdev, &chp->cq, ucontext ? &ucontext->uctx : &rhp->rdev.uctx); err1: - kfree(chp); - return ERR_PTR(ret); + return ret; } int c4iw_resize_cq(struct ib_cq *cq, int cqe, struct ib_udata *udata) diff --git a/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h b/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h index 59ca38a96004..03d3b2b0ad38 100644 --- a/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h +++ b/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h @@ -55,6 +55,7 @@ #include #include +#include #include "common/common.h" #include "common/t4_msg.h" @@ -474,6 +475,14 @@ struct c4iw_qp_attributes { u8 send_term; }; +struct c4iw_ib_srq { + struct ib_srq ibsrq; +}; + +struct c4iw_ib_ah { + struct ib_ah ibah; +}; + struct c4iw_qp { struct ib_qp ibqp; struct c4iw_dev *rhp; @@ -501,7 +510,6 @@ struct c4iw_ucontext { u32 key; spinlock_t mmap_lock; struct list_head mmaps; - struct kref kref; }; static inline struct c4iw_ucontext *to_c4iw_ucontext(struct ib_ucontext *c) @@ -509,17 +517,6 @@ static inline struct c4iw_ucontext *to_c4iw_ucontext(struct ib_ucontext *c) return container_of(c, struct c4iw_ucontext, ibucontext); } -void _c4iw_free_ucontext(struct kref *kref); - -static inline void c4iw_put_ucontext(struct c4iw_ucontext *ucontext) -{ - kref_put(&ucontext->kref, _c4iw_free_ucontext); -} -static inline void c4iw_get_ucontext(struct c4iw_ucontext *ucontext) -{ - kref_get(&ucontext->kref); -} - struct c4iw_mm_entry { struct list_head entry; u64 addr; @@ -938,7 +935,7 @@ int c4iw_reject_cr(struct iw_cm_id *cm_id, const void *pdata, u8 pdata_len); void c4iw_qp_add_ref(struct ib_qp *qp); void c4iw_qp_rem_ref(struct ib_qp *qp); struct ib_mr *c4iw_alloc_mr(struct ib_pd *pd, enum ib_mr_type mr_type, - u32 max_num_sg); + u32 max_num_sg, struct ib_udata *udata); int c4iw_map_mr_sg(struct ib_mr *ibmr, struct scatterlist *sg, int sg_nents, unsigned int *sg_offset); int c4iw_dealloc_mw(struct ib_mw *mw); @@ -947,16 +944,15 @@ struct ib_mw *c4iw_alloc_mw(struct ib_pd *pd, enum ib_mw_type type, struct ib_mr *c4iw_reg_user_mr(struct ib_pd *pd, u64 start, u64 length, u64 virt, int acc, struct ib_udata *udata); struct ib_mr *c4iw_get_dma_mr(struct ib_pd *pd, int acc); -int c4iw_dereg_mr(struct ib_mr *ib_mr); +int c4iw_dereg_mr(struct ib_mr *ib_mr, struct ib_udata *udata); void c4iw_invalidate_mr(struct c4iw_dev *rhp, u32 rkey); -int c4iw_destroy_cq(struct ib_cq *ib_cq); -struct ib_cq *c4iw_create_cq(struct ib_device *ibdev, - const struct ib_cq_init_attr *attr, - struct ib_ucontext *ib_context, - struct ib_udata *udata); +void c4iw_destroy_cq(struct ib_cq *ib_cq, struct ib_udata *udata); +int c4iw_create_cq(struct ib_cq *ibcq, + const struct ib_cq_init_attr *attr, + struct ib_udata *udata); int c4iw_resize_cq(struct ib_cq *cq, int cqe, struct ib_udata *udata); int c4iw_arm_cq(struct ib_cq *ibcq, enum ib_cq_notify_flags flags); -int c4iw_destroy_qp(struct ib_qp *ib_qp); +int c4iw_destroy_qp(struct ib_qp *ib_qp, struct ib_udata *udata); struct ib_qp *c4iw_create_qp(struct ib_pd *pd, struct ib_qp_init_attr *attrs, struct ib_udata *udata); diff --git a/sys/dev/cxgbe/iw_cxgbe/mem.c b/sys/dev/cxgbe/iw_cxgbe/mem.c index dab812d58eec..c6eb8cff6da9 100644 --- a/sys/dev/cxgbe/iw_cxgbe/mem.c +++ b/sys/dev/cxgbe/iw_cxgbe/mem.c @@ -610,7 +610,7 @@ int c4iw_dealloc_mw(struct ib_mw *mw) struct ib_mr *c4iw_alloc_mr(struct ib_pd *pd, enum ib_mr_type mr_type, - u32 max_num_sg) + u32 max_num_sg, struct ib_udata *udata) { struct c4iw_dev *rhp; struct c4iw_pd *php; @@ -700,7 +700,7 @@ int c4iw_map_mr_sg(struct ib_mr *ibmr, struct scatterlist *sg, } -int c4iw_dereg_mr(struct ib_mr *ib_mr) +int c4iw_dereg_mr(struct ib_mr *ib_mr, struct ib_udata *udata) { struct c4iw_dev *rhp; struct c4iw_mr *mhp; diff --git a/sys/dev/cxgbe/iw_cxgbe/provider.c b/sys/dev/cxgbe/iw_cxgbe/provider.c index 02a32fa4c1fc..10b990e21f98 100644 --- a/sys/dev/cxgbe/iw_cxgbe/provider.c +++ b/sys/dev/cxgbe/iw_cxgbe/provider.c @@ -58,16 +58,15 @@ static int c4iw_modify_port(struct ib_device *ibdev, return -ENOSYS; } -static struct ib_ah *c4iw_ah_create(struct ib_pd *pd, - struct ib_ah_attr *ah_attr, - struct ib_udata *udata) +static int c4iw_ah_create(struct ib_ah *ah, + struct ib_ah_attr *ah_attr, u32 flags, + struct ib_udata *udata) { - return ERR_PTR(-ENOSYS); + return -ENOSYS; } -static int c4iw_ah_destroy(struct ib_ah *ah) +static void c4iw_ah_destroy(struct ib_ah *ah, u32 flags) { - return -ENOSYS; } static int c4iw_multicast_attach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid) @@ -93,35 +92,27 @@ static int c4iw_process_mad(struct ib_device *ibdev, int mad_flags, return -ENOSYS; } -void _c4iw_free_ucontext(struct kref *kref) +static void c4iw_dealloc_ucontext(struct ib_ucontext *context) { - struct c4iw_ucontext *ucontext; + struct c4iw_ucontext *ucontext = to_c4iw_ucontext(context); struct c4iw_dev *rhp; struct c4iw_mm_entry *mm, *tmp; - ucontext = container_of(kref, struct c4iw_ucontext, kref); + pr_debug("context %p\n", context); rhp = to_c4iw_dev(ucontext->ibucontext.device); CTR2(KTR_IW_CXGBE, "%s ucontext %p", __func__, ucontext); + list_for_each_entry_safe(mm, tmp, &ucontext->mmaps, entry) kfree(mm); c4iw_release_dev_ucontext(&rhp->rdev, &ucontext->uctx); - kfree(ucontext); } -static int c4iw_dealloc_ucontext(struct ib_ucontext *context) +static int c4iw_alloc_ucontext(struct ib_ucontext *ucontext, + struct ib_udata *udata) { - struct c4iw_ucontext *ucontext = to_c4iw_ucontext(context); - - CTR2(KTR_IW_CXGBE, "%s context %p", __func__, context); - c4iw_put_ucontext(ucontext); - return 0; -} - -static struct ib_ucontext *c4iw_alloc_ucontext(struct ib_device *ibdev, - struct ib_udata *udata) -{ - struct c4iw_ucontext *context; + struct ib_device *ibdev = ucontext->device; + struct c4iw_ucontext *context = to_c4iw_ucontext(ucontext); struct c4iw_dev *rhp = to_c4iw_dev(ibdev); static int warned; struct c4iw_alloc_ucontext_resp uresp; @@ -129,16 +120,9 @@ static struct ib_ucontext *c4iw_alloc_ucontext(struct ib_device *ibdev, struct c4iw_mm_entry *mm = NULL; PDBG("%s ibdev %p\n", __func__, ibdev); - context = kzalloc(sizeof(*context), GFP_KERNEL); - if (!context) { - ret = -ENOMEM; - goto err; - } - c4iw_init_dev_ucontext(&rhp->rdev, &context->uctx); INIT_LIST_HEAD(&context->mmaps); spin_lock_init(&context->mmap_lock); - kref_init(&context->kref); if (udata->outlen < sizeof(uresp) - sizeof(uresp.reserved)) { if (!warned++) @@ -150,7 +134,7 @@ static struct ib_ucontext *c4iw_alloc_ucontext(struct ib_device *ibdev, mm = kmalloc(sizeof *mm, GFP_KERNEL); if (!mm) - goto err_free; + goto err; uresp.status_page_size = PAGE_SIZE; @@ -169,13 +153,11 @@ static struct ib_ucontext *c4iw_alloc_ucontext(struct ib_device *ibdev, mm->len = PAGE_SIZE; insert_mmap(context, mm); } - return &context->ibucontext; + return 0; err_mm: kfree(mm); -err_free: - kfree(context); err: - return ERR_PTR(ret); + return ret; } static int c4iw_mmap(struct ib_ucontext *context, struct vm_area_struct *vma) @@ -226,8 +208,8 @@ static int c4iw_mmap(struct ib_ucontext *context, struct vm_area_struct *vma) return ret; } -static int -c4iw_deallocate_pd(struct ib_pd *pd) +static void +c4iw_deallocate_pd(struct ib_pd *pd, struct ib_udata *udata) { struct c4iw_pd *php = to_c4iw_pd(pd); struct c4iw_dev *rhp = php->rhp; @@ -238,36 +220,29 @@ c4iw_deallocate_pd(struct ib_pd *pd) mutex_lock(&rhp->rdev.stats.lock); rhp->rdev.stats.pd.cur--; mutex_unlock(&rhp->rdev.stats.lock); - kfree(php); - - return (0); } -static struct ib_pd * -c4iw_allocate_pd(struct ib_device *ibdev, struct ib_ucontext *context, - struct ib_udata *udata) +static int +c4iw_allocate_pd(struct ib_pd *pd, struct ib_udata *udata) { - struct c4iw_pd *php; + struct c4iw_pd *php = to_c4iw_pd(pd); + struct ib_device *ibdev = pd->device; u32 pdid; struct c4iw_dev *rhp; - CTR4(KTR_IW_CXGBE, "%s: ibdev %p, context %p, data %p", __func__, ibdev, - context, udata); + CTR4(KTR_IW_CXGBE, "%s: ibdev %p, pd %p, data %p", __func__, ibdev, + pd, udata); rhp = (struct c4iw_dev *) ibdev; pdid = c4iw_get_resource(&rhp->rdev.resource.pdid_table); if (!pdid) - return ERR_PTR(-EINVAL); - php = kzalloc(sizeof(*php), GFP_KERNEL); - if (!php) { - c4iw_put_resource(&rhp->rdev.resource.pdid_table, pdid); - return ERR_PTR(-ENOMEM); - } + return -EINVAL; + php->pdid = pdid; php->rhp = rhp; - if (context) { + if (udata) { if (ib_copy_to_udata(udata, &php->pdid, sizeof(u32))) { - c4iw_deallocate_pd(&php->ibpd); - return ERR_PTR(-EFAULT); + c4iw_deallocate_pd(&php->ibpd, udata); + return -EFAULT; } } mutex_lock(&rhp->rdev.stats.lock); @@ -276,10 +251,10 @@ c4iw_allocate_pd(struct ib_device *ibdev, struct ib_ucontext *context, rhp->rdev.stats.pd.max = rhp->rdev.stats.pd.cur; mutex_unlock(&rhp->rdev.stats.lock); - CTR6(KTR_IW_CXGBE, + CTR5(KTR_IW_CXGBE, "%s: ibdev %p, context %p, data %p, pddid 0x%x, pd %p", __func__, - ibdev, context, udata, pdid, php); - return (&php->ibpd); + ibdev, udata, pdid, php); + return (0); } static int @@ -436,6 +411,13 @@ c4iw_register_device(struct c4iw_dev *dev) ret = linux_pci_attach_device(sc->dev, NULL, NULL, &dev->pdev); if (ret) return (ret); + +#define c4iw_ib_cq c4iw_cq +#define c4iw_ib_pd c4iw_pd +#define c4iw_ib_qp c4iw_qp +#define c4iw_ib_ucontext c4iw_ucontext + INIT_IB_DEVICE_OPS(&ibdev->ops, c4iw, CXGB4); + strlcpy(ibdev->name, device_get_nameunit(sc->dev), sizeof(ibdev->name)); memset(&ibdev->node_guid, 0, sizeof(ibdev->node_guid)); memcpy(&ibdev->node_guid, sc->port[0]->vi[0].hw_addr, ETHER_ADDR_LEN); diff --git a/sys/dev/cxgbe/iw_cxgbe/qp.c b/sys/dev/cxgbe/iw_cxgbe/qp.c index c1006109762c..b2901f93988e 100644 --- a/sys/dev/cxgbe/iw_cxgbe/qp.c +++ b/sys/dev/cxgbe/iw_cxgbe/qp.c @@ -583,8 +583,6 @@ static void free_qp_work(struct work_struct *work) destroy_qp(&rhp->rdev, &qhp->wq, ucontext ? &ucontext->uctx : &rhp->rdev.uctx); - if (ucontext) - c4iw_put_ucontext(ucontext); kfree(qhp); } @@ -1678,7 +1676,7 @@ out: return ret; } -int c4iw_destroy_qp(struct ib_qp *ib_qp) +int c4iw_destroy_qp(struct ib_qp *ib_qp, struct ib_udata *udata) { struct c4iw_dev *rhp; struct c4iw_qp *qhp; @@ -1879,7 +1877,6 @@ c4iw_create_qp(struct ib_pd *pd, struct ib_qp_init_attr *attrs, rq_db_key_mm->len); insert_mmap(ucontext, rq_db_key_mm); - c4iw_get_ucontext(ucontext); qhp->ucontext = ucontext; } qhp->ibqp.qp_num = qhp->wq.sq.qid; diff --git a/sys/dev/mlx4/mlx4_ib/mlx4_ib.h b/sys/dev/mlx4/mlx4_ib/mlx4_ib.h index 544ed1913419..60b1de77a81b 100644 --- a/sys/dev/mlx4/mlx4_ib/mlx4_ib.h +++ b/sys/dev/mlx4/mlx4_ib/mlx4_ib.h @@ -83,16 +83,11 @@ enum hw_bar_type { HW_BAR_COUNT }; -struct mlx4_ib_vma_private_data { - struct vm_area_struct *vma; -}; - struct mlx4_ib_ucontext { struct ib_ucontext ibucontext; struct mlx4_uar uar; struct list_head db_page_list; struct mutex db_page_mutex; - struct mlx4_ib_vma_private_data hw_bar_info[HW_BAR_COUNT]; }; struct mlx4_ib_pd { @@ -726,39 +721,37 @@ int mlx4_ib_umem_write_mtt(struct mlx4_ib_dev *dev, struct mlx4_mtt *mtt, struct ib_mr *mlx4_ib_reg_user_mr(struct ib_pd *pd, u64 start, u64 length, u64 virt_addr, int access_flags, struct ib_udata *udata); -int mlx4_ib_dereg_mr(struct ib_mr *mr); +int mlx4_ib_dereg_mr(struct ib_mr *mr, struct ib_udata *udata); struct ib_mw *mlx4_ib_alloc_mw(struct ib_pd *pd, enum ib_mw_type type, struct ib_udata *udata); int mlx4_ib_dealloc_mw(struct ib_mw *mw); -struct ib_mr *mlx4_ib_alloc_mr(struct ib_pd *pd, - enum ib_mr_type mr_type, - u32 max_num_sg); +struct ib_mr *mlx4_ib_alloc_mr(struct ib_pd *pd, enum ib_mr_type mr_type, + u32 max_num_sg, struct ib_udata *udata); int mlx4_ib_map_mr_sg(struct ib_mr *ibmr, struct scatterlist *sg, int sg_nents, unsigned int *sg_offset); int mlx4_ib_modify_cq(struct ib_cq *cq, u16 cq_count, u16 cq_period); int mlx4_ib_resize_cq(struct ib_cq *ibcq, int entries, struct ib_udata *udata); -struct ib_cq *mlx4_ib_create_cq(struct ib_device *ibdev, - const struct ib_cq_init_attr *attr, - struct ib_ucontext *context, - struct ib_udata *udata); -int mlx4_ib_destroy_cq(struct ib_cq *cq); +int mlx4_ib_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr, + struct ib_udata *udata); +void mlx4_ib_destroy_cq(struct ib_cq *cq, struct ib_udata *udata); int mlx4_ib_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *wc); int mlx4_ib_arm_cq(struct ib_cq *cq, enum ib_cq_notify_flags flags); void __mlx4_ib_cq_clean(struct mlx4_ib_cq *cq, u32 qpn, struct mlx4_ib_srq *srq); void mlx4_ib_cq_clean(struct mlx4_ib_cq *cq, u32 qpn, struct mlx4_ib_srq *srq); -struct ib_ah *mlx4_ib_create_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr, - struct ib_udata *udata); +int mlx4_ib_create_ah(struct ib_ah *ah, struct ib_ah_attr *ah_attr, u32 flags, + struct ib_udata *udata); +int mlx4_ib_create_ah_slave(struct ib_ah *ah, struct ib_ah_attr *ah_attr, + int slave_sgid_index, u8 *s_mac, u16 vlan_tag); int mlx4_ib_query_ah(struct ib_ah *ibah, struct ib_ah_attr *ah_attr); -int mlx4_ib_destroy_ah(struct ib_ah *ah); +void mlx4_ib_destroy_ah(struct ib_ah *ah, u32 flags); -struct ib_srq *mlx4_ib_create_srq(struct ib_pd *pd, - struct ib_srq_init_attr *init_attr, - struct ib_udata *udata); +int mlx4_ib_create_srq(struct ib_srq *srq, struct ib_srq_init_attr *init_attr, + struct ib_udata *udata); int mlx4_ib_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr, enum ib_srq_attr_mask attr_mask, struct ib_udata *udata); int mlx4_ib_query_srq(struct ib_srq *srq, struct ib_srq_attr *srq_attr); -int mlx4_ib_destroy_srq(struct ib_srq *srq); +void mlx4_ib_destroy_srq(struct ib_srq *srq, struct ib_udata *udata); void mlx4_ib_free_srq_wqe(struct mlx4_ib_srq *srq, int wqe_index); int mlx4_ib_post_srq_recv(struct ib_srq *ibsrq, const struct ib_recv_wr *wr, const struct ib_recv_wr **bad_wr); @@ -766,7 +759,7 @@ int mlx4_ib_post_srq_recv(struct ib_srq *ibsrq, const struct ib_recv_wr *wr, struct ib_qp *mlx4_ib_create_qp(struct ib_pd *pd, struct ib_qp_init_attr *init_attr, struct ib_udata *udata); -int mlx4_ib_destroy_qp(struct ib_qp *qp); +int mlx4_ib_destroy_qp(struct ib_qp *qp, struct ib_udata *udata); int mlx4_ib_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask, struct ib_udata *udata); int mlx4_ib_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr, int qp_attr_mask, diff --git a/sys/dev/mlx4/mlx4_ib/mlx4_ib_ah.c b/sys/dev/mlx4/mlx4_ib/mlx4_ib_ah.c index 33c0f9e6b4e2..bb924a08fabb 100644 --- a/sys/dev/mlx4/mlx4_ib/mlx4_ib_ah.c +++ b/sys/dev/mlx4/mlx4_ib/mlx4_ib_ah.c @@ -42,10 +42,11 @@ #include "mlx4_ib.h" -static struct ib_ah *create_ib_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr, - struct mlx4_ib_ah *ah) +static int create_ib_ah(struct ib_ah *ib_ah, struct ib_ah_attr *ah_attr) { - struct mlx4_dev *dev = to_mdev(pd->device)->dev; + struct ib_pd *pd = ib_ah->pd; + struct mlx4_ib_ah *ah = to_mah(ib_ah); + struct mlx4_dev *dev = to_mdev(ib_ah->device)->dev; ah->av.ib.port_pd = cpu_to_be32(to_mpd(pd)->pdn | (ah_attr->port_num << 24)); ah->av.ib.g_slid = ah_attr->src_path_bits; @@ -67,14 +68,14 @@ static struct ib_ah *create_ib_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr, !(1 << ah->av.ib.stat_rate & dev->caps.stat_rate_support)) --ah->av.ib.stat_rate; } - - return &ah->ibah; + return 0; } -static struct ib_ah *create_iboe_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr, - struct mlx4_ib_ah *ah) +static int create_iboe_ah(struct ib_ah *ib_ah, struct ib_ah_attr *ah_attr) { - struct mlx4_ib_dev *ibdev = to_mdev(pd->device); + struct ib_pd *pd = ib_ah->pd; + struct mlx4_ib_dev *ibdev = to_mdev(ib_ah->device); + struct mlx4_ib_ah *ah = to_mah(ib_ah); struct mlx4_dev *dev = ibdev->dev; int is_mcast = 0; struct in6_addr in6; @@ -93,7 +94,7 @@ static struct ib_ah *create_iboe_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr ret = ib_get_cached_gid(pd->device, ah_attr->port_num, ah_attr->grh.sgid_index, &sgid, &gid_attr); if (ret) - return ERR_PTR(ret); + return ret; eth_zero_addr(ah->av.eth.s_mac); if (gid_attr.ndev) { vlan_tag = rdma_vlan_dev_vlan_id(gid_attr.ndev); @@ -105,7 +106,7 @@ static struct ib_ah *create_iboe_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr ah->av.eth.port_pd = cpu_to_be32(to_mpd(pd)->pdn | (ah_attr->port_num << 24)); ret = mlx4_ib_gid_index_to_real_index(ibdev, ah_attr->port_num, ah_attr->grh.sgid_index); if (ret < 0) - return ERR_PTR(ret); + return ret; ah->av.eth.gid_index = ret; ah->av.eth.vlan = cpu_to_be16(vlan_tag); ah->av.eth.hop_limit = ah_attr->grh.hop_limit; @@ -125,23 +126,15 @@ static struct ib_ah *create_iboe_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr memcpy(ah->av.eth.dgid, ah_attr->grh.dgid.raw, 16); ah->av.eth.sl_tclass_flowlabel = cpu_to_be32(ah_attr->sl << 29); - return &ah->ibah; + return 0; } -struct ib_ah *mlx4_ib_create_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr, - struct ib_udata *udata) - +int mlx4_ib_create_ah(struct ib_ah *ib_ah, struct ib_ah_attr *ah_attr, + u32 flags, struct ib_udata *udata) { - struct mlx4_ib_ah *ah; - struct ib_ah *ret; - - ah = kzalloc(sizeof *ah, GFP_ATOMIC); - if (!ah) - return ERR_PTR(-ENOMEM); - - if (rdma_port_get_link_layer(pd->device, ah_attr->port_num) == IB_LINK_LAYER_ETHERNET) { + if (rdma_port_get_link_layer(ib_ah->pd->device, ah_attr->port_num) == IB_LINK_LAYER_ETHERNET) { if (!(ah_attr->ah_flags & IB_AH_GRH)) { - ret = ERR_PTR(-EINVAL); + return -EINVAL; } else { /* * TBD: need to handle the case when we get @@ -151,15 +144,35 @@ struct ib_ah *mlx4_ib_create_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr, * local addresses which we can translate * without going to sleep. */ - ret = create_iboe_ah(pd, ah_attr, ah); + return create_iboe_ah(ib_ah, ah_attr); } + } + return create_ib_ah(ib_ah, ah_attr); +} - if (IS_ERR(ret)) - kfree(ah); +int mlx4_ib_create_ah_slave(struct ib_ah *ah, struct ib_ah_attr *ah_attr, + int slave_sgid_index, u8 *s_mac, u16 vlan_tag) +{ + struct ib_ah_attr slave_attr = *ah_attr; + struct mlx4_ib_ah *mah = to_mah(ah); + int ret; + slave_attr.grh.sgid_index = slave_sgid_index; + ret = mlx4_ib_create_ah(ah, &slave_attr, 0, NULL); + if (ret) return ret; - } else - return create_ib_ah(pd, ah_attr, ah); /* never fails */ + + /* get rid of force-loopback bit */ + mah->av.ib.port_pd &= cpu_to_be32(0x7FFFFFFF); + + if (rdma_port_get_link_layer(ah->pd->device, ah_attr->port_num) == IB_LINK_LAYER_ETHERNET) + memcpy(mah->av.eth.s_mac, s_mac, 6); + + if (vlan_tag < 0x1000) + vlan_tag |= (ah_attr->sl & 7) << 13; + mah->av.eth.vlan = cpu_to_be16(vlan_tag); + + return 0; } int mlx4_ib_query_ah(struct ib_ah *ibah, struct ib_ah_attr *ah_attr) @@ -195,8 +208,7 @@ int mlx4_ib_query_ah(struct ib_ah *ibah, struct ib_ah_attr *ah_attr) return 0; } -int mlx4_ib_destroy_ah(struct ib_ah *ah) +void mlx4_ib_destroy_ah(struct ib_ah *ah, u32 flags) { - kfree(to_mah(ah)); - return 0; + return; } diff --git a/sys/dev/mlx4/mlx4_ib/mlx4_ib_cq.c b/sys/dev/mlx4/mlx4_ib/mlx4_ib_cq.c index 215c428e7af7..87845ef1f17b 100644 --- a/sys/dev/mlx4/mlx4_ib/mlx4_ib_cq.c +++ b/sys/dev/mlx4/mlx4_ib/mlx4_ib_cq.c @@ -39,6 +39,7 @@ #include "mlx4_ib.h" #include +#include static void mlx4_ib_cq_comp(struct mlx4_cq *cq) { @@ -135,14 +136,16 @@ static void mlx4_ib_free_cq_buf(struct mlx4_ib_dev *dev, struct mlx4_ib_cq_buf * mlx4_buf_free(dev->dev, (cqe + 1) * buf->entry_size, &buf->buf); } -static int mlx4_ib_get_cq_umem(struct mlx4_ib_dev *dev, struct ib_ucontext *context, - struct mlx4_ib_cq_buf *buf, struct ib_umem **umem, - u64 buf_addr, int cqe) +static int mlx4_ib_get_cq_umem(struct mlx4_ib_dev *dev, struct ib_udata *udata, + struct mlx4_ib_cq_buf *buf, + struct ib_umem **umem, u64 buf_addr, int cqe) { int err; int cqe_size = dev->dev->caps.cqe_size; + struct mlx4_ib_ucontext *context = rdma_udata_to_drv_context( + udata, struct mlx4_ib_ucontext, ibucontext); - *umem = ib_umem_get(context, buf_addr, cqe * cqe_size, + *umem = ib_umem_get(&context->ibucontext, buf_addr, cqe * cqe_size, IB_ACCESS_LOCAL_WRITE, 1); if (IS_ERR(*umem)) return PTR_ERR(*umem); @@ -168,27 +171,25 @@ err_buf: } #define CQ_CREATE_FLAGS_SUPPORTED IB_CQ_FLAGS_TIMESTAMP_COMPLETION -struct ib_cq *mlx4_ib_create_cq(struct ib_device *ibdev, - const struct ib_cq_init_attr *attr, - struct ib_ucontext *context, - struct ib_udata *udata) +int mlx4_ib_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr, + struct ib_udata *udata) { + struct ib_device *ibdev = ibcq->device; int entries = attr->cqe; int vector = attr->comp_vector; struct mlx4_ib_dev *dev = to_mdev(ibdev); - struct mlx4_ib_cq *cq; + struct mlx4_ib_cq *cq = to_mcq(ibcq); struct mlx4_uar *uar; + void *buf_addr; int err; + struct mlx4_ib_ucontext *context = rdma_udata_to_drv_context( + udata, struct mlx4_ib_ucontext, ibucontext); if (entries < 1 || entries > dev->dev->caps.max_cqes) - return ERR_PTR(-EINVAL); + return -EINVAL; if (attr->flags & ~CQ_CREATE_FLAGS_SUPPORTED) - return ERR_PTR(-EINVAL); - - cq = kmalloc(sizeof *cq, GFP_KERNEL); - if (!cq) - return ERR_PTR(-ENOMEM); + return -EINVAL; entries = roundup_pow_of_two(entries + 1); cq->ibcq.cqe = entries - 1; @@ -200,7 +201,7 @@ struct ib_cq *mlx4_ib_create_cq(struct ib_device *ibdev, INIT_LIST_HEAD(&cq->send_qp_list); INIT_LIST_HEAD(&cq->recv_qp_list); - if (context) { + if (udata) { struct mlx4_ib_create_cq ucmd; if (ib_copy_from_udata(&ucmd, udata, sizeof ucmd)) { @@ -208,17 +209,17 @@ struct ib_cq *mlx4_ib_create_cq(struct ib_device *ibdev, goto err_cq; } - err = mlx4_ib_get_cq_umem(dev, context, &cq->buf, &cq->umem, + buf_addr = (void *)(unsigned long)ucmd.buf_addr; + err = mlx4_ib_get_cq_umem(dev, udata, &cq->buf, &cq->umem, ucmd.buf_addr, entries); if (err) goto err_cq; - err = mlx4_ib_db_map_user(to_mucontext(context), ucmd.db_addr, - &cq->db); + err = mlx4_ib_db_map_user(context, ucmd.db_addr, &cq->db); if (err) goto err_mtt; - uar = &to_mucontext(context)->uar; + uar = &context->uar; } else { err = mlx4_db_alloc(dev->dev, &cq->db, 1, GFP_KERNEL); if (err) @@ -233,6 +234,8 @@ struct ib_cq *mlx4_ib_create_cq(struct ib_device *ibdev, if (err) goto err_db; + buf_addr = &cq->buf.buf; + uar = &dev->priv_uar; } @@ -248,37 +251,33 @@ struct ib_cq *mlx4_ib_create_cq(struct ib_device *ibdev, cq->mcq.comp = mlx4_ib_cq_comp; cq->mcq.event = mlx4_ib_cq_event; *** 28581 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Wed Jul 28 11:43:40 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4A67E659078; Wed, 28 Jul 2021 11:43:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GZWyN1Qrrz4qCm; Wed, 28 Jul 2021 11:43: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 196371D905; Wed, 28 Jul 2021 11:43: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 16SBheWZ092822; Wed, 28 Jul 2021 11:43:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16SBhevM092820; Wed, 28 Jul 2021 11:43:40 GMT (envelope-from git) Date: Wed, 28 Jul 2021 11:43:40 GMT Message-Id: <202107281143.16SBhevM092820@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michal Meloun Subject: git: b07a6bd15a58 - main - booti: Enable loading the kernel image to any address aligned to 2 MB MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mmel X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b07a6bd15a58aa6e23761c51eba78d449cd2cbf3 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, 28 Jul 2021 11:43:40 -0000 The branch main has been updated by mmel: URL: https://cgit.FreeBSD.org/src/commit/?id=b07a6bd15a58aa6e23761c51eba78d449cd2cbf3 commit b07a6bd15a58aa6e23761c51eba78d449cd2cbf3 Author: Michal Meloun AuthorDate: 2021-07-09 17:33:36 +0000 Commit: Michal Meloun CommitDate: 2021-07-28 11:42:13 +0000 booti: Enable loading the kernel image to any address aligned to 2 MB We've supported this for a long time, plus most u-boot setups quietly expect it. Otherwise they fail with different levels of memory overwrites. MFC after: 2 weeks --- sys/tools/arm_kernel_boothdr.awk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/tools/arm_kernel_boothdr.awk b/sys/tools/arm_kernel_boothdr.awk index 5526102606f6..f22c6167c7b0 100644 --- a/sys/tools/arm_kernel_boothdr.awk +++ b/sys/tools/arm_kernel_boothdr.awk @@ -134,7 +134,7 @@ function write_v8booti() { write_le32(0) # code1 write_le64(0) # text_offset write_le64(gEndOff) # image_size - write_le64(0) # flags + write_le64(hexstr_to_num("8")) # flags write_le64(0) # res1[0] write_le64(0) # res1[1] write_le64(0) # res1[2] From owner-dev-commits-src-all@freebsd.org Wed Jul 28 11:47: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 EC81C6597BB; Wed, 28 Jul 2021 11:47: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 4GZX346C3mz4qWr; Wed, 28 Jul 2021 11:47: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 B887D1D6A4; Wed, 28 Jul 2021 11:47: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 16SBliU3093231; Wed, 28 Jul 2021 11:47:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16SBliv2093230; Wed, 28 Jul 2021 11:47:44 GMT (envelope-from git) Date: Wed, 28 Jul 2021 11:47:44 GMT Message-Id: <202107281147.16SBliv2093230@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: d2cbfbc57b20 - main - mlx5/mlx4: Bump driver version to 3.7 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: d2cbfbc57b20700d6eb04dbfc4d636ce6c92997c 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, 28 Jul 2021 11:47:45 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=d2cbfbc57b20700d6eb04dbfc4d636ce6c92997c commit d2cbfbc57b20700d6eb04dbfc4d636ce6c92997c Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:02:03 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-28 11:47:05 +0000 mlx5/mlx4: Bump driver version to 3.7 While at it only output driver version to dmesg(8) when hardware is present. Differential Revision: https://reviews.freebsd.org/D29100 MFC after: 1 week Reviewed by: kib and markj Sponsored by: NVIDIA Networking --- sys/dev/mlx4/mlx4_core/mlx4.h | 4 ++-- sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c | 4 ++-- sys/dev/mlx5/mlx5_core/mlx5_core.h | 4 ++-- sys/dev/mlx5/mlx5_core/mlx5_main.c | 7 ++++--- sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 16 ---------------- sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c | 18 ------------------ 6 files changed, 10 insertions(+), 43 deletions(-) diff --git a/sys/dev/mlx4/mlx4_core/mlx4.h b/sys/dev/mlx4/mlx4_core/mlx4.h index 8b1afc2838e6..f2cae9c5f38e 100644 --- a/sys/dev/mlx4/mlx4_core/mlx4.h +++ b/sys/dev/mlx4/mlx4_core/mlx4.h @@ -54,9 +54,9 @@ #define DRV_NAME "mlx4_core" #define PFX DRV_NAME ": " #ifndef DRV_VERSION -#define DRV_VERSION "3.6.0" +#define DRV_VERSION "3.7.0" #endif -#define DRV_RELDATE "December 2020" +#define DRV_RELDATE "July 2021" #define MLX4_FS_UDP_UC_EN (1 << 1) #define MLX4_FS_TCP_UC_EN (1 << 2) diff --git a/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c b/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c index 56c168f5afbf..f9ac3121199a 100644 --- a/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c +++ b/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c @@ -63,9 +63,9 @@ #define DRV_NAME MLX4_IB_DRV_NAME #ifndef DRV_VERSION -#define DRV_VERSION "3.6.0" +#define DRV_VERSION "3.7.0" #endif -#define DRV_RELDATE "December 2020" +#define DRV_RELDATE "July 2021" #define MLX4_IB_FLOW_MAX_PRIO 0xFFF #define MLX4_IB_FLOW_QPN_MASK 0xFFFFFF diff --git a/sys/dev/mlx5/mlx5_core/mlx5_core.h b/sys/dev/mlx5/mlx5_core/mlx5_core.h index a7ce1b31641c..f30f307b04a8 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_core.h +++ b/sys/dev/mlx5/mlx5_core/mlx5_core.h @@ -36,9 +36,9 @@ #define DRIVER_NAME "mlx5_core" #ifndef DRIVER_VERSION -#define DRIVER_VERSION "3.6.0" +#define DRIVER_VERSION "3.7.0" #endif -#define DRIVER_RELDATE "December 2020" +#define DRIVER_RELDATE "July 2021" extern int mlx5_core_debug_mask; diff --git a/sys/dev/mlx5/mlx5_core/mlx5_main.c b/sys/dev/mlx5/mlx5_core/mlx5_main.c index 7527af524456..5830d4510d7b 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_main.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_main.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2020, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2013-2021, Mellanox Technologies, Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -55,8 +55,7 @@ static const char mlx5_version[] = "Mellanox Core driver " DRIVER_VERSION " (" DRIVER_RELDATE ")"; -MODULE_AUTHOR("Eli Cohen "); -MODULE_DESCRIPTION("Mellanox Connect-IB, ConnectX-4 core driver"); +MODULE_DESCRIPTION("Mellanox ConnectX-4 and onwards core driver"); MODULE_LICENSE("Dual BSD/GPL"); MODULE_DEPEND(mlx5, linuxkpi, 1, 1, 1); MODULE_DEPEND(mlx5, mlxfw, 1, 1, 1); @@ -1317,6 +1316,8 @@ static int init_one(struct pci_dev *pdev, struct sysctl_oid *current_cap_sysctl_node; struct sysctl_oid *max_cap_sysctl_node; + printk_once("mlx5: %s", mlx5_version); + numa_node = dev_to_node(&pdev->dev); dev = kzalloc_node(sizeof(*dev), GFP_KERNEL, numa_node); diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index 514eefc613a7..40e0d2b0c342 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -35,14 +35,6 @@ #include -#ifndef ETH_DRIVER_VERSION -#define ETH_DRIVER_VERSION "3.6.0" -#endif -#define DRIVER_RELDATE "December 2020" - -static const char mlx5e_version[] = "mlx5en: Mellanox Ethernet driver " - ETH_DRIVER_VERSION " (" DRIVER_RELDATE ")\n"; - static int mlx5e_get_wqe_sz(struct mlx5e_priv *priv, u32 *wqe_sz, u32 *nsegs); struct mlx5e_channel_param { @@ -4910,14 +4902,6 @@ mlx5e_cleanup(void) mlx5_unregister_interface(&mlx5e_interface); } -static void -mlx5e_show_version(void __unused *arg) -{ - - printf("%s", mlx5e_version); -} -SYSINIT(mlx5e_show_version, SI_SUB_DRIVERS, SI_ORDER_ANY, mlx5e_show_version, NULL); - module_init_order(mlx5e_init, SI_ORDER_SIXTH); module_exit_order(mlx5e_cleanup, SI_ORDER_SIXTH); diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c b/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c index 641fc7bce2d5..9a3fdc4df89e 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c @@ -51,12 +51,6 @@ #include #include "mlx5_ib.h" -#define DRIVER_NAME "mlx5ib" -#ifndef DRIVER_VERSION -#define DRIVER_VERSION "3.6.0" -#endif -#define DRIVER_RELDATE "December 2020" - MODULE_DESCRIPTION("Mellanox Connect-IB HCA IB driver"); MODULE_LICENSE("Dual BSD/GPL"); MODULE_DEPEND(mlx5ib, linuxkpi, 1, 1, 1); @@ -64,10 +58,6 @@ MODULE_DEPEND(mlx5ib, mlx5, 1, 1, 1); MODULE_DEPEND(mlx5ib, ibcore, 1, 1, 1); MODULE_VERSION(mlx5ib, 1); -static const char mlx5_version[] = - DRIVER_NAME ": Mellanox Connect-IB Infiniband driver " - DRIVER_VERSION " (" DRIVER_RELDATE ")\n"; - enum { MLX5_ATOMIC_SIZE_QP_8BYTES = 1 << 3, }; @@ -3573,13 +3563,5 @@ static void __exit mlx5_ib_cleanup(void) mlx5_ib_odp_cleanup(); } -static void -mlx5_ib_show_version(void __unused *arg) -{ - - printf("%s", mlx5_version); -} -SYSINIT(mlx5_ib_show_version, SI_SUB_DRIVERS, SI_ORDER_ANY, mlx5_ib_show_version, NULL); - module_init_order(mlx5_ib_init, SI_ORDER_SEVENTH); module_exit_order(mlx5_ib_cleanup, SI_ORDER_SEVENTH); From owner-dev-commits-src-all@freebsd.org Wed Jul 28 12:21: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 6683965A796; Wed, 28 Jul 2021 12:21: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 4GZXpR20jnz4rx4; Wed, 28 Jul 2021 12:21: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 2C8B81DD60; Wed, 28 Jul 2021 12:21: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 16SCLp2C044008; Wed, 28 Jul 2021 12:21:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16SCLpFm044007; Wed, 28 Jul 2021 12:21:51 GMT (envelope-from git) Date: Wed, 28 Jul 2021 12:21:51 GMT Message-Id: <202107281221.16SCLpFm044007@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: da8d8b22e69c - main - pf: fix ABI breakage 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: da8d8b22e69c72f1d001d55b5eff5acbb0265cfc 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, 28 Jul 2021 12:21:51 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=da8d8b22e69c72f1d001d55b5eff5acbb0265cfc commit da8d8b22e69c72f1d001d55b5eff5acbb0265cfc Author: Kristof Provost AuthorDate: 2021-07-28 09:24:44 +0000 Commit: Kristof Provost CommitDate: 2021-07-28 10:16:33 +0000 pf: fix ABI breakage The introduction of synproxy support changed the size of struct pf_status, which in turn broke the userspace ABI. Revert the relevant change. More work is needed on the synproxy code to keep and expose the counters, but in the mean time this restores the ABI. PR: 257469 MFC after: 3 days Sponsored by: Modirum MDPay --- sys/netpfil/pf/pf.h | 3 +-- sys/netpfil/pf/pf_syncookies.c | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/sys/netpfil/pf/pf.h b/sys/netpfil/pf/pf.h index c8bf932af9c3..d8ee43506d99 100644 --- a/sys/netpfil/pf/pf.h +++ b/sys/netpfil/pf/pf.h @@ -160,8 +160,7 @@ enum { PF_ADDR_ADDRMASK, PF_ADDR_NOROUTE, PF_ADDR_DYNIFTL, #define LCNT_SRCCONNRATE 4 /* max-src-conn-rate */ #define LCNT_OVERLOAD_TABLE 5 /* entry added to overload table */ #define LCNT_OVERLOAD_FLUSH 6 /* state entries flushed */ -#define LCNT_SYNCOOKIES_VALID 7 /* syncookies validated */ /* XXX TODO: Ensure no API breakage! */ -#define LCNT_MAX 8 /* total+1 */ +#define LCNT_MAX 7 /* total+1 */ #define LCNT_NAMES { \ "max states per rule", \ diff --git a/sys/netpfil/pf/pf_syncookies.c b/sys/netpfil/pf/pf_syncookies.c index 8699ae855ec8..744a12e4e21d 100644 --- a/sys/netpfil/pf/pf_syncookies.c +++ b/sys/netpfil/pf/pf_syncookies.c @@ -275,7 +275,6 @@ pf_syncookie_validate(struct pf_pdesc *pd) if ((ack & ~0xff) != (hash & ~0xff)) return (0); - counter_u64_add(V_pf_status.lcounters[LCNT_SYNCOOKIES_VALID], 1); return (1); } From owner-dev-commits-src-all@freebsd.org Wed Jul 28 12:40: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 7AF7F659FFD; Wed, 28 Jul 2021 12:40: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 4GZYCx2qq6z4tDv; Wed, 28 Jul 2021 12:40: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 451DA1E312; Wed, 28 Jul 2021 12:40: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 16SCeTpD069158; Wed, 28 Jul 2021 12:40:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16SCeT7s069157; Wed, 28 Jul 2021 12:40:29 GMT (envelope-from git) Date: Wed, 28 Jul 2021 12:40:29 GMT Message-Id: <202107281240.16SCeT7s069157@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: e504e98ab5e6 - stable/13 - arm64: Print CPU features slightly earlier 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: e504e98ab5e6a3155054a98660a244075609db0b 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, 28 Jul 2021 12:40:29 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=e504e98ab5e6a3155054a98660a244075609db0b commit e504e98ab5e6a3155054a98660a244075609db0b Author: Mark Johnston AuthorDate: 2021-07-20 16:06:01 +0000 Commit: Mark Johnston CommitDate: 2021-07-28 12:40:25 +0000 arm64: Print CPU features slightly earlier In particular, print them before we release APs. Otherwise they tend to get mixed with other kernel messages. Reviewed by: andrew, manu Sponsored by: The FreeBSD Foundation (cherry picked from commit fa46a46a82498532f547be5f6b5a94d05f53b0be) --- sys/arm64/arm64/identcpu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/arm64/arm64/identcpu.c b/sys/arm64/arm64/identcpu.c index c3544e9de9aa..5dc3a91031b6 100644 --- a/sys/arm64/arm64/identcpu.c +++ b/sys/arm64/arm64/identcpu.c @@ -1241,7 +1241,8 @@ cpu_features_sysinit(void *dummy __unused) CPU_FOREACH(cpu) print_cpu_features(cpu); } -SYSINIT(cpu_features, SI_SUB_SMP, SI_ORDER_ANY, cpu_features_sysinit, NULL); +/* 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) From owner-dev-commits-src-all@freebsd.org Wed Jul 28 12:40: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 1880765A7E2; Wed, 28 Jul 2021 12:40: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 4GZYDL08Vrz4t3G; Wed, 28 Jul 2021 12:40: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 D80C61E313; Wed, 28 Jul 2021 12:40: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 16SCenCp069298; Wed, 28 Jul 2021 12:40:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16SCenMW069297; Wed, 28 Jul 2021 12:40:49 GMT (envelope-from git) Date: Wed, 28 Jul 2021 12:40:49 GMT Message-Id: <202107281240.16SCenMW069297@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: 7fa95d69f108 - stable/12 - dd a new option (-H) to daemon(8) to catch SIGHUP and re-open output_file file when received. 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: 7fa95d69f10827d0b02607682a2c4a1513d658e5 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, 28 Jul 2021 12:40:50 -0000 The branch stable/12 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=7fa95d69f10827d0b02607682a2c4a1513d658e5 commit 7fa95d69f10827d0b02607682a2c4a1513d658e5 Author: Maxim Sobolev AuthorDate: 2020-09-24 02:44:58 +0000 Commit: Mark Johnston CommitDate: 2021-07-28 12:38:38 +0000 dd a new option (-H) to daemon(8) to catch SIGHUP and re-open output_file file when received. The default system log rotation mechanism (newsyslog(8)) requires ability to send signal to a daemon in order to properly complete rotation of the logs in an "atomic" manner without having to making a copy and truncating original file. Unfortunately our built-in mechanism to convert "dumb" programs into daemons has no way to handle this rotation properly. This change adds this ability, to be enabled by supplying -H option in addition to the -o option. PR: 255198 Reviewed by: markj, rpokala (manpages) (cherry picked from commit 4cd407ec933b81d9d0f733532d29426416cccc06) --- usr.sbin/daemon/daemon.8 | 18 ++++++++++++-- usr.sbin/daemon/daemon.c | 63 ++++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 71 insertions(+), 10 deletions(-) diff --git a/usr.sbin/daemon/daemon.8 b/usr.sbin/daemon/daemon.8 index bd853652c03f..665108df6afc 100644 --- a/usr.sbin/daemon/daemon.8 +++ b/usr.sbin/daemon/daemon.8 @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 2, 2019 +.Dd September 22, 2020 .Dt DAEMON 8 .Os .Sh NAME @@ -34,7 +34,7 @@ .Nd run detached from the controlling terminal .Sh SYNOPSIS .Nm -.Op Fl cfrS +.Op Fl cfHrS .Op Fl p Ar child_pidfile .Op Fl P Ar supervisor_pidfile .Op Fl t Ar title @@ -68,6 +68,14 @@ or syslog output, the standard file descriptors are first redirected to .Pa /dev/null , then stdout and/or stderr is redirected to a file or to syslog as specified by the other options. +.It Fl H +Close +.Pa output_file +and re-open it when signal SIGHUP is received, for interoperability with +.Xr newsyslog 1 +and similar log rotation / archival mechanisms. If +.Fa o +is not specified, this flag is ignored. .It Fl S Enable syslog output. This is implicitly applied if other syslog parameters are provided. @@ -77,6 +85,12 @@ tag, respectively. Append output from the daemonized process to .Pa output_file . If the file does not exist, it is created with permissions 0600. +When this option is used together with options +.Fl c and +.Fl H +the absolute path needs to be provided to ensure +.Nm +can re-open the file after a SIGHUP. .It Fl m Ar output_mask Redirect output from the child process stdout (1), stderr (2), or both (3). This value specifies what is sent to syslog and the log file. diff --git a/usr.sbin/daemon/daemon.c b/usr.sbin/daemon/daemon.c index 7a245421e4df..d8a26132223b 100644 --- a/usr.sbin/daemon/daemon.c +++ b/usr.sbin/daemon/daemon.c @@ -61,11 +61,15 @@ struct log_params { int logpri; int noclose; int outfd; + const char *outfn; }; static void restrict_process(const char *); static void handle_term(int); static void handle_chld(int); +static void handle_hup(int); +static int open_log(const char *); +static void reopen_log(struct log_params *); static int listen_child(int, struct log_params *); static int get_log_mapping(const char *, const CODE *); static void open_pid_files(const char *, const char *, struct pidfh **, @@ -74,7 +78,8 @@ static void do_output(const unsigned char *, size_t, struct log_params *); static void daemon_sleep(time_t, long); static void usage(void); -static volatile sig_atomic_t terminate = 0, child_gone = 0, pid = 0; +static volatile sig_atomic_t terminate = 0, child_gone = 0, pid = 0, + do_log_reopen = 0; int main(int argc, char *argv[]) @@ -84,7 +89,7 @@ main(int argc, char *argv[]) sigset_t mask_susp, mask_orig, mask_read, mask_term; struct log_params logpar; int pfd[2] = { -1, -1 }, outfd = -1; - int stdmask, logpri, logfac; + int stdmask, logpri, logfac, log_reopen; struct pidfh *ppfh, *pfh; char *p; @@ -97,9 +102,10 @@ main(int argc, char *argv[]) logtag = "daemon"; restart = 0; dosyslog = 0; + log_reopen = 0; outfn = NULL; title = NULL; - while ((ch = getopt(argc, argv, "cfSp:P:ru:o:s:l:t:l:m:R:T:")) != -1) { + while ((ch = getopt(argc, argv, "cfHSp:P:ru:o:s:l:t:l:m:R:T:")) != -1) { switch (ch) { case 'c': nochdir = 0; @@ -107,6 +113,9 @@ main(int argc, char *argv[]) case 'f': noclose = 0; break; + case 'H': + log_reopen = 1; + break; case 'l': logfac = get_log_mapping(optarg, facilitynames); if (logfac == -1) @@ -168,7 +177,7 @@ main(int argc, char *argv[]) title = argv[0]; if (outfn) { - outfd = open(outfn, O_CREAT | O_WRONLY | O_APPEND | O_CLOEXEC, 0600); + outfd = open_log(outfn); if (outfd == -1) err(7, "open"); } @@ -201,7 +210,7 @@ main(int argc, char *argv[]) */ pid = -1; if (pidfile || ppidfile || restart || outfd != -1 || dosyslog) { - struct sigaction act_term, act_chld; + struct sigaction act_term, act_chld, act_hup; /* Avoid PID racing with SIGCHLD and SIGTERM. */ memset(&act_term, 0, sizeof(act_term)); @@ -214,6 +223,10 @@ main(int argc, char *argv[]) sigemptyset(&act_chld.sa_mask); sigaddset(&act_chld.sa_mask, SIGTERM); + memset(&act_hup, 0, sizeof(act_hup)); + act_hup.sa_handler = handle_hup; + sigemptyset(&act_hup.sa_mask); + /* Block these when avoiding racing before sigsuspend(). */ sigemptyset(&mask_susp); sigaddset(&mask_susp, SIGTERM); @@ -251,6 +264,12 @@ main(int argc, char *argv[]) logpar.dosyslog = dosyslog; logpar.logpri = logpri; logpar.noclose = noclose; + logpar.outfn = outfn; + if (log_reopen && outfd >= 0 && + sigaction(SIGHUP, &act_hup, NULL) == -1) { + warn("sigaction"); + goto exit; + } restart: if (pipe(pfd)) err(1, "pipe"); @@ -465,6 +484,8 @@ listen_child(int fd, struct log_params *logpar) assert(logpar); assert(bytes_read < LBUF_SIZE - 1); + if (do_log_reopen) + reopen_log(logpar); rv = read(fd, buf + bytes_read, LBUF_SIZE - bytes_read - 1); if (rv > 0) { unsigned char *cp; @@ -543,9 +564,9 @@ handle_term(int signo) } static void -handle_chld(int signo) +handle_chld(int signo __unused) { - (void)signo; + for (;;) { int rv = waitpid(-1, NULL, WNOHANG); if (pid == rv) { @@ -558,11 +579,37 @@ handle_chld(int signo) } } +static void +handle_hup(int signo __unused) +{ + + do_log_reopen = 1; +} + +static int +open_log(const char *outfn) +{ + + return open(outfn, O_CREAT | O_WRONLY | O_APPEND | O_CLOEXEC, 0600); +} + +static void +reopen_log(struct log_params *lpp) +{ + int outfd; + + do_log_reopen = 0; + outfd = open_log(lpp->outfn); + if (lpp->outfd >= 0) + close(lpp->outfd); + lpp->outfd = outfd; +} + static void usage(void) { (void)fprintf(stderr, - "usage: daemon [-cfrS] [-p child_pidfile] [-P supervisor_pidfile]\n" + "usage: daemon [-cfHrS] [-p child_pidfile] [-P supervisor_pidfile]\n" " [-u user] [-o output_file] [-t title]\n" " [-l syslog_facility] [-s syslog_priority]\n" " [-T syslog_tag] [-m output_mask] [-R restart_delay_secs]\n" From owner-dev-commits-src-all@freebsd.org Wed Jul 28 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 74CB065BB57; Wed, 28 Jul 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 4GZZQ02kcwz3F1D; Wed, 28 Jul 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 467CF1EBE1; Wed, 28 Jul 2021 13:34: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 16SDYGb6040108; Wed, 28 Jul 2021 13:34:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16SDYG7V040107; Wed, 28 Jul 2021 13:34:16 GMT (envelope-from git) Date: Wed, 28 Jul 2021 13:34:16 GMT Message-Id: <202107281334.16SDYG7V040107@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: ac134e762e69 - main - LinuxKPI: dmi.h do not rely on implicit includes 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: ac134e762e6908dcadd0c7cb7bcb3de0ed967f59 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, 28 Jul 2021 13:34:16 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=ac134e762e6908dcadd0c7cb7bcb3de0ed967f59 commit ac134e762e6908dcadd0c7cb7bcb3de0ed967f59 Author: Bjoern A. Zeeb AuthorDate: 2021-07-28 13:28:48 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-28 13:28:48 +0000 LinuxKPI: dmi.h do not rely on implicit includes Add sys/types.h to dmi.h and do not rely on other files to include all needed headers in Linux land. I ran into compile problems with rtw88 otherwise. MFC after: 3 days --- sys/compat/linuxkpi/common/include/linux/dmi.h | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/compat/linuxkpi/common/include/linux/dmi.h b/sys/compat/linuxkpi/common/include/linux/dmi.h index b921cc906917..6e450e156b73 100644 --- a/sys/compat/linuxkpi/common/include/linux/dmi.h +++ b/sys/compat/linuxkpi/common/include/linux/dmi.h @@ -31,6 +31,7 @@ #ifndef __LINUX_DMI_H__ #define __LINUX_DMI_H__ +#include #include int linux_dmi_check_system(const struct dmi_system_id *); From owner-dev-commits-src-all@freebsd.org Wed Jul 28 13:37: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 77DF965BA6B; Wed, 28 Jul 2021 13:37: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 4GZZVH2S4Kz3F3v; Wed, 28 Jul 2021 13:37: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 37B041F00F; Wed, 28 Jul 2021 13:37: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 16SDbxNi040554; Wed, 28 Jul 2021 13:37:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16SDbx8x040553; Wed, 28 Jul 2021 13:37:59 GMT (envelope-from git) Date: Wed, 28 Jul 2021 13:37:59 GMT Message-Id: <202107281337.16SDbx8x040553@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: cc2723370b48 - main - LinuxKPI: add fsleep() 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: cc2723370b482b923b2adeac3ad359d485f0bd82 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, 28 Jul 2021 13:37:59 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=cc2723370b482b923b2adeac3ad359d485f0bd82 commit cc2723370b482b923b2adeac3ad359d485f0bd82 Author: Bjoern A. Zeeb AuthorDate: 2021-07-27 15:22:02 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-28 13:35:34 +0000 LinuxKPI: add fsleep() Add fsleep() function now required by rtw88. This seems to be making a decision depending on time to sleep on how to sleep. Given our compat framework already is lenient on how long to sleep, this is a cut down version. MFC after: 10 days Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D31322 --- sys/compat/linuxkpi/common/include/linux/delay.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/delay.h b/sys/compat/linuxkpi/common/include/linux/delay.h index 1ed9dffed359..c13a1797adf9 100644 --- a/sys/compat/linuxkpi/common/include/linux/delay.h +++ b/sys/compat/linuxkpi/common/include/linux/delay.h @@ -76,4 +76,14 @@ usleep_range(unsigned long min, unsigned long max) extern unsigned int linux_msleep_interruptible(unsigned int ms); +static inline void +fsleep(unsigned long us) +{ + + if (us < 10) + udelay(us); + else + usleep_range(us, us); +} + #endif /* _LINUX_DELAY_H_ */ From owner-dev-commits-src-all@freebsd.org Wed Jul 28 13:39: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 5284265BC9E; Wed, 28 Jul 2021 13:39:44 +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 4GZZXH735sz3F8p; Wed, 28 Jul 2021 13:39:43 +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 16SDdaKZ023010; Wed, 28 Jul 2021 06:39:36 -0700 (PDT) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id 16SDdaqc023009; Wed, 28 Jul 2021 06:39:36 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <202107281339.16SDdaqc023009@gndrsh.dnsmgr.net> Subject: Re: git: 5f946c76c0cc - main - Update WITHOUT_KERNEL_SYMBOLS description In-Reply-To: <202107272124.16RLOv5Z046970@gitrepo.freebsd.org> To: Ed Maste Date: Wed, 28 Jul 2021 06:39:36 -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: 4GZZXH735sz3F8p 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, 28 Jul 2021 13:39:44 -0000 [ Charset UTF-8 unsupported, converting... ] > The branch main has been updated by emaste: > > URL: https://cgit.FreeBSD.org/src/commit/?id=5f946c76c0cc2d1b4fa150f691764da163579d19 > > commit 5f946c76c0cc2d1b4fa150f691764da163579d19 > Author: Ed Maste > AuthorDate: 2021-07-27 21:18:41 +0000 > Commit: Ed Maste > CommitDate: 2021-07-27 21:18:41 +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 > --- > 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 79856e28c1aa..33fa2c4f1c97 100644 > --- a/tools/build/options/WITHOUT_KERNEL_SYMBOLS > +++ b/tools/build/options/WITHOUT_KERNEL_SYMBOLS > @@ -1,5 +1,2 @@ > .\" $FreeBSD$ > -Do 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. This option is recommended for those people who have small /usr partitions. > -- Rod Grimes rgrimes@freebsd.org From owner-dev-commits-src-all@freebsd.org Wed Jul 28 14:41: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 3C5AF65C5CD; Wed, 28 Jul 2021 14:41: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 4GZbvc1HgZz3J3b; Wed, 28 Jul 2021 14:41: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 146C81FE83; Wed, 28 Jul 2021 14:41: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 16SEfVaN032727; Wed, 28 Jul 2021 14:41:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16SEfVwS032726; Wed, 28 Jul 2021 14:41:31 GMT (envelope-from git) Date: Wed, 28 Jul 2021 14:41:31 GMT Message-Id: <202107281441.16SEfVwS032726@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 2b82c57e3997 - main - pf: Initialize arrays before copying out to userland MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2b82c57e399700f5134c47d86d45ef2f2bd465e2 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, 28 Jul 2021 14:41:32 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=2b82c57e399700f5134c47d86d45ef2f2bd465e2 commit 2b82c57e399700f5134c47d86d45ef2f2bd465e2 Author: Mark Johnston AuthorDate: 2021-07-28 14:16:25 +0000 Commit: Mark Johnston CommitDate: 2021-07-28 14:40:49 +0000 pf: Initialize arrays before copying out to userland A number of pf ioctls populate an array of structures and copy it out. They have the following structures: - caller specifies the size of its output buffer - ioctl handler allocates a kernel buffer of the same size - ioctl handler populates the buffer, possibly leaving some items initialized if the caller provided more space than needed - ioctl handler copies the entire buffer out to userland Thus, if more space was provided than is required, we end up copying out uninitialized kernel memory. Simply zero the buffer at allocation time to prevent this. Reported by: KMSAN Reviewed by: kp MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31313 --- sys/netpfil/pf/pf_ioctl.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 33c38eaaf9fa..3dc52da05606 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -3824,7 +3824,7 @@ DIOCCHANGEADDR_error: totlen = io->pfrio_size * sizeof(struct pfr_table); pfrts = mallocarray(io->pfrio_size, sizeof(struct pfr_table), - M_TEMP, M_NOWAIT); + M_TEMP, M_NOWAIT | M_ZERO); if (pfrts == NULL) { error = ENOMEM; PF_RULES_RUNLOCK(); @@ -3862,7 +3862,7 @@ DIOCCHANGEADDR_error: totlen = io->pfrio_size * sizeof(struct pfr_tstats); pfrtstats = mallocarray(io->pfrio_size, - sizeof(struct pfr_tstats), M_TEMP, M_NOWAIT); + sizeof(struct pfr_tstats), M_TEMP, M_NOWAIT | M_ZERO); if (pfrtstats == NULL) { error = ENOMEM; PF_RULES_RUNLOCK(); @@ -4094,7 +4094,7 @@ DIOCCHANGEADDR_error: } totlen = io->pfrio_size * sizeof(struct pfr_addr); pfras = mallocarray(io->pfrio_size, sizeof(struct pfr_addr), - M_TEMP, M_WAITOK); + M_TEMP, M_WAITOK | M_ZERO); PF_RULES_RLOCK(); error = pfr_get_addrs(&io->pfrio_table, pfras, &io->pfrio_size, io->pfrio_flags | PFR_FLAG_USERIOCTL); @@ -4122,7 +4122,7 @@ DIOCCHANGEADDR_error: } totlen = io->pfrio_size * sizeof(struct pfr_astats); pfrastats = mallocarray(io->pfrio_size, - sizeof(struct pfr_astats), M_TEMP, M_WAITOK); + sizeof(struct pfr_astats), M_TEMP, M_WAITOK | M_ZERO); PF_RULES_RLOCK(); error = pfr_get_astats(&io->pfrio_table, pfrastats, &io->pfrio_size, io->pfrio_flags | PFR_FLAG_USERIOCTL); @@ -4626,7 +4626,7 @@ DIOCCHANGEADDR_error: bufsiz = io->pfiio_size * sizeof(struct pfi_kif); ifstore = mallocarray(io->pfiio_size, sizeof(struct pfi_kif), - M_TEMP, M_WAITOK); + M_TEMP, M_WAITOK | M_ZERO); PF_RULES_RLOCK(); pfi_get_ifaces(io->pfiio_name, ifstore, &io->pfiio_size); From owner-dev-commits-src-all@freebsd.org Wed Jul 28 14:41: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 918B165C5D0; Wed, 28 Jul 2021 14:41: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 4GZbvd2rqzz3J0p; Wed, 28 Jul 2021 14:41: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 3899E1FBDF; Wed, 28 Jul 2021 14:41: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 16SEfXeY032751; Wed, 28 Jul 2021 14:41:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16SEfX1J032750; Wed, 28 Jul 2021 14:41:33 GMT (envelope-from git) Date: Wed, 28 Jul 2021 14:41:33 GMT Message-Id: <202107281441.16SEfX1J032750@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 64432ad2a2c4 - main - pf: Validate user string nul-termination before copying MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 64432ad2a2c4b10d3d3411a8ca018e2a35cec97e 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, 28 Jul 2021 14:41:33 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=64432ad2a2c4b10d3d3411a8ca018e2a35cec97e commit 64432ad2a2c4b10d3d3411a8ca018e2a35cec97e Author: Mark Johnston AuthorDate: 2021-07-28 14:16:42 +0000 Commit: Mark Johnston CommitDate: 2021-07-28 14:41:01 +0000 pf: Validate user string nul-termination before copying Some pf ioctl handlers use strlcpy() to copy strings when converting from user structures to their in-kernel representations. strlcpy() ensures that the destination will be nul-terminated, but it assumes that the source is nul-terminated. In particular, it returns the full length of the source string, so if the source is not nul-terminated, strlcpy() will keep scanning until it finds a nul byte, and it may encounter an unmapped page first. Add a helper to validate user strings before copying. There are also places where we look up a ruleset using a user-provided anchor string. In some ioctl handlers we were already nul-terminating the string, avoiding the same problem, but in other places we were not. Fix those by nul-terminating as well. Aside from being consistent, anchors have a maximum length of MAXPATHLEN - 1 so calling strnlen() might not be so desirable. Reported by: syzbot+35a1549b4663e9483dd1@syzkaller.appspotmail.com Reviewed by: kp MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31169 --- sys/netpfil/pf/pf_ioctl.c | 123 ++++++++++++++++++++++++++++++++++------------ 1 file changed, 92 insertions(+), 31 deletions(-) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 3dc52da05606..c1dd4488e67d 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -275,6 +275,20 @@ pflog_packet_t *pflog_packet_ptr = NULL; extern u_long pf_ioctl_maxcount; +/* + * Copy a user-provided string, returning an error if truncation would occur. + * Avoid scanning past "sz" bytes in the source string since there's no + * guarantee that it's nul-terminated. + */ +static int +pf_user_strcpy(char *dst, const char *src, size_t sz) +{ + if (strnlen(src, sz) == sz) + return (EINVAL); + (void)strlcpy(dst, src, sz); + return (0); +} + static void pfattach_vnet(void) { @@ -1543,14 +1557,17 @@ pf_kpooladdr_to_pooladdr(const struct pf_kpooladdr *kpool, strlcpy(pool->ifname, kpool->ifname, sizeof(pool->ifname)); } -static void +static int pf_pooladdr_to_kpooladdr(const struct pf_pooladdr *pool, struct pf_kpooladdr *kpool) { + int ret; bzero(kpool, sizeof(*kpool)); bcopy(&pool->addr, &kpool->addr, sizeof(kpool->addr)); - strlcpy(kpool->ifname, pool->ifname, sizeof(kpool->ifname)); + ret = pf_user_strcpy(kpool->ifname, pool->ifname, + sizeof(kpool->ifname)); + return (ret); } static void @@ -1715,15 +1732,30 @@ pf_rule_to_krule(const struct pf_rule *rule, struct pf_krule *krule) bcopy(&rule->src, &krule->src, sizeof(rule->src)); bcopy(&rule->dst, &krule->dst, sizeof(rule->dst)); - strlcpy(krule->label[0], rule->label, sizeof(rule->label)); - strlcpy(krule->ifname, rule->ifname, sizeof(rule->ifname)); - strlcpy(krule->qname, rule->qname, sizeof(rule->qname)); - strlcpy(krule->pqname, rule->pqname, sizeof(rule->pqname)); - strlcpy(krule->tagname, rule->tagname, sizeof(rule->tagname)); - strlcpy(krule->match_tagname, rule->match_tagname, + ret = pf_user_strcpy(krule->label[0], rule->label, sizeof(rule->label)); + if (ret != 0) + return (ret); + ret = pf_user_strcpy(krule->ifname, rule->ifname, sizeof(rule->ifname)); + if (ret != 0) + return (ret); + ret = pf_user_strcpy(krule->qname, rule->qname, sizeof(rule->qname)); + if (ret != 0) + return (ret); + ret = pf_user_strcpy(krule->pqname, rule->pqname, sizeof(rule->pqname)); + if (ret != 0) + return (ret); + ret = pf_user_strcpy(krule->tagname, rule->tagname, + sizeof(rule->tagname)); + if (ret != 0) + return (ret); + ret = pf_user_strcpy(krule->match_tagname, rule->match_tagname, sizeof(rule->match_tagname)); - strlcpy(krule->overload_tblname, rule->overload_tblname, + if (ret != 0) + return (ret); + ret = pf_user_strcpy(krule->overload_tblname, rule->overload_tblname, sizeof(rule->overload_tblname)); + if (ret != 0) + return (ret); ret = pf_pool_to_kpool(&rule->rpool, &krule->rpool); if (ret != 0) @@ -1799,6 +1831,8 @@ static int pf_state_kill_to_kstate_kill(const struct pfioc_state_kill *psk, struct pf_kstate_kill *kill) { + int ret; + bzero(kill, sizeof(*kill)); bcopy(&psk->psk_pfcmp, &kill->psk_pfcmp, sizeof(kill->psk_pfcmp)); @@ -1806,8 +1840,14 @@ pf_state_kill_to_kstate_kill(const struct pfioc_state_kill *psk, kill->psk_proto = psk->psk_proto; bcopy(&psk->psk_src, &kill->psk_src, sizeof(kill->psk_src)); bcopy(&psk->psk_dst, &kill->psk_dst, sizeof(kill->psk_dst)); - strlcpy(kill->psk_ifname, psk->psk_ifname, sizeof(kill->psk_ifname)); - strlcpy(kill->psk_label, psk->psk_label, sizeof(kill->psk_label)); + ret = pf_user_strcpy(kill->psk_ifname, psk->psk_ifname, + sizeof(kill->psk_ifname)); + if (ret != 0) + return (ret); + ret = pf_user_strcpy(kill->psk_label, psk->psk_label, + sizeof(kill->psk_label)); + if (ret != 0) + return (ret); return (0); } @@ -2369,8 +2409,9 @@ DIOCADDRULENV_error: struct pf_krule *tail; int rs_num; - PF_RULES_WLOCK(); pr->anchor[sizeof(pr->anchor) - 1] = 0; + + PF_RULES_WLOCK(); ruleset = pf_find_kruleset(pr->anchor); if (ruleset == NULL) { PF_RULES_WUNLOCK(); @@ -2400,8 +2441,9 @@ DIOCADDRULENV_error: struct pf_krule *rule; int rs_num; - PF_RULES_WLOCK(); pr->anchor[sizeof(pr->anchor) - 1] = 0; + + PF_RULES_WLOCK(); ruleset = pf_find_kruleset(pr->anchor); if (ruleset == NULL) { PF_RULES_WUNLOCK(); @@ -2590,6 +2632,8 @@ DIOCGETRULENV_error: u_int32_t nr = 0; int rs_num; + pcr->anchor[sizeof(pcr->anchor) - 1] = 0; + if (pcr->action < PF_CHANGE_ADD_HEAD || pcr->action > PF_CHANGE_GET_TICKET) { error = EINVAL; @@ -3041,7 +3085,7 @@ DIOCGETSTATESV2_full: break; } PF_RULES_WLOCK(); - strlcpy(V_pf_status.ifname, pi->ifname, IFNAMSIZ); + error = pf_user_strcpy(V_pf_status.ifname, pi->ifname, IFNAMSIZ); PF_RULES_WUNLOCK(); break; } @@ -3207,19 +3251,23 @@ DIOCGETSTATESV2_full: struct pf_ifspeed_v1 ps; struct ifnet *ifp; - if (psp->ifname[0] != 0) { - /* Can we completely trust user-land? */ - strlcpy(ps.ifname, psp->ifname, IFNAMSIZ); - ifp = ifunit(ps.ifname); - if (ifp != NULL) { - psp->baudrate32 = - (u_int32_t)uqmin(ifp->if_baudrate, UINT_MAX); - if (cmd == DIOCGIFSPEEDV1) - psp->baudrate = ifp->if_baudrate; - } else - error = EINVAL; - } else + if (psp->ifname[0] == '\0') { + error = EINVAL; + break; + } + + error = pf_user_strcpy(ps.ifname, psp->ifname, IFNAMSIZ); + if (error != 0) + break; + ifp = ifunit(ps.ifname); + if (ifp != NULL) { + psp->baudrate32 = + (u_int32_t)uqmin(ifp->if_baudrate, UINT_MAX); + if (cmd == DIOCGIFSPEEDV1) + psp->baudrate = ifp->if_baudrate; + } else { error = EINVAL; + } break; } @@ -3446,7 +3494,9 @@ DIOCGETSTATESV2_full: break; } pa = malloc(sizeof(*pa), M_PFRULE, M_WAITOK); - pf_pooladdr_to_kpooladdr(&pp->addr, pa); + error = pf_pooladdr_to_kpooladdr(&pp->addr, pa); + if (error != 0) + break; if (pa->ifname[0]) kif = pf_kkif_create(M_WAITOK); PF_RULES_WLOCK(); @@ -3482,8 +3532,10 @@ DIOCGETSTATESV2_full: struct pf_kpool *pool; struct pf_kpooladdr *pa; - PF_RULES_RLOCK(); + pp->anchor[sizeof(pp->anchor) - 1] = 0; pp->nr = 0; + + PF_RULES_RLOCK(); pool = pf_get_kpool(pp->anchor, pp->ticket, pp->r_action, pp->r_num, 0, 1, 0); if (pool == NULL) { @@ -3503,6 +3555,8 @@ DIOCGETSTATESV2_full: struct pf_kpooladdr *pa; u_int32_t nr = 0; + pp->anchor[sizeof(pp->anchor) - 1] = 0; + PF_RULES_RLOCK(); pool = pf_get_kpool(pp->anchor, pp->ticket, pp->r_action, pp->r_num, 0, 1, 1); @@ -3534,6 +3588,8 @@ DIOCGETSTATESV2_full: struct pf_kruleset *ruleset; struct pfi_kkif *kif = NULL; + pca->anchor[sizeof(pca->anchor) - 1] = 0; + if (pca->action < PF_CHANGE_ADD_HEAD || pca->action > PF_CHANGE_REMOVE) { error = EINVAL; @@ -3665,8 +3721,9 @@ DIOCCHANGEADDR_error: struct pf_kruleset *ruleset; struct pf_kanchor *anchor; - PF_RULES_RLOCK(); pr->path[sizeof(pr->path) - 1] = 0; + + PF_RULES_RLOCK(); if ((ruleset = pf_find_kruleset(pr->path)) == NULL) { PF_RULES_RUNLOCK(); error = ENOENT; @@ -3693,8 +3750,9 @@ DIOCCHANGEADDR_error: struct pf_kanchor *anchor; u_int32_t nr = 0; - PF_RULES_RLOCK(); pr->path[sizeof(pr->path) - 1] = 0; + + PF_RULES_RLOCK(); if ((ruleset = pf_find_kruleset(pr->path)) == NULL) { PF_RULES_RUNLOCK(); error = ENOENT; @@ -4275,6 +4333,7 @@ DIOCCHANGEADDR_error: } PF_RULES_WLOCK(); for (i = 0, ioe = ioes; i < io->size; i++, ioe++) { + ioe->anchor[sizeof(ioe->anchor) - 1] = '\0'; switch (ioe->rs_num) { #ifdef ALTQ case PF_RULESET_ALTQ: @@ -4348,6 +4407,7 @@ DIOCCHANGEADDR_error: } PF_RULES_WLOCK(); for (i = 0, ioe = ioes; i < io->size; i++, ioe++) { + ioe->anchor[sizeof(ioe->anchor) - 1] = '\0'; switch (ioe->rs_num) { #ifdef ALTQ case PF_RULESET_ALTQ: @@ -4424,6 +4484,7 @@ DIOCCHANGEADDR_error: PF_RULES_WLOCK(); /* First makes sure everything will succeed. */ for (i = 0, ioe = ioes; i < io->size; i++, ioe++) { + ioe->anchor[sizeof(ioe->anchor) - 1] = 0; switch (ioe->rs_num) { #ifdef ALTQ case PF_RULESET_ALTQ: @@ -4490,7 +4551,7 @@ DIOCCHANGEADDR_error: struct pfr_table table; bzero(&table, sizeof(table)); - strlcpy(table.pfrt_anchor, ioe->anchor, + (void)strlcpy(table.pfrt_anchor, ioe->anchor, sizeof(table.pfrt_anchor)); if ((error = pfr_ina_commit(&table, ioe->ticket, NULL, NULL, 0))) { From owner-dev-commits-src-all@freebsd.org Wed Jul 28 15:20: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 AB91B65CC64; Wed, 28 Jul 2021 15:20: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 4GZcmy4WP6z3LBj; Wed, 28 Jul 2021 15:20: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 82D9920265; Wed, 28 Jul 2021 15:20: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 16SFKoIh083251; Wed, 28 Jul 2021 15:20:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16SFKolN083250; Wed, 28 Jul 2021 15:20:50 GMT (envelope-from git) Date: Wed, 28 Jul 2021 15:20:50 GMT Message-Id: <202107281520.16SFKolN083250@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: 10f6680faae0 - main - Add macros for arm64 special reg op and CR values 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: 10f6680faae0177cb5ab18754fb27dbb8a0cf226 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, 28 Jul 2021 15:20:50 -0000 The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=10f6680faae0177cb5ab18754fb27dbb8a0cf226 commit 10f6680faae0177cb5ab18754fb27dbb8a0cf226 Author: Andrew Turner AuthorDate: 2021-07-28 13:01:14 +0000 Commit: Andrew Turner CommitDate: 2021-07-28 01:34:21 +0000 Add macros for arm64 special reg op and CR values Use these to simplify the definition of the user_regs array. Reviewed by: imp, markj Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31333 --- sys/arm64/arm64/identcpu.c | 82 +++++++++------------------------------------ sys/arm64/include/armreg.h | 83 +++++++++++++++++++++++++++++++++++++++------- 2 files changed, 87 insertions(+), 78 deletions(-) diff --git a/sys/arm64/arm64/identcpu.c b/sys/arm64/arm64/identcpu.c index 794b097195ef..64b3b6a4ef27 100644 --- a/sys/arm64/arm64/identcpu.c +++ b/sys/arm64/arm64/identcpu.c @@ -1171,74 +1171,24 @@ struct mrs_user_reg { struct mrs_field *fields; }; +#define USER_REG(name, field_name) \ + { \ + .reg = name, \ + .CRm = name##_CRm, \ + .Op2 = name##_op2, \ + .offset = __offsetof(struct cpu_desc, field_name), \ + .fields = field_name##_fields, \ + } static struct mrs_user_reg user_regs[] = { - { /* id_aa64isar0_el1 */ - .reg = ID_AA64ISAR0_EL1, - .CRm = 6, - .Op2 = 0, - .offset = __offsetof(struct cpu_desc, id_aa64isar0), - .fields = id_aa64isar0_fields, - }, - { /* id_aa64isar1_el1 */ - .reg = ID_AA64ISAR1_EL1, - .CRm = 6, - .Op2 = 1, - .offset = __offsetof(struct cpu_desc, id_aa64isar1), - .fields = id_aa64isar1_fields, - }, - { /* id_aa64pfr0_el1 */ - .reg = ID_AA64PFR0_EL1, - .CRm = 4, - .Op2 = 0, - .offset = __offsetof(struct cpu_desc, id_aa64pfr0), - .fields = id_aa64pfr0_fields, - }, - { /* id_aa64pfr0_el1 */ - .reg = ID_AA64PFR1_EL1, - .CRm = 4, - .Op2 = 1, - .offset = __offsetof(struct cpu_desc, id_aa64pfr1), - .fields = id_aa64pfr1_fields, - }, - { /* id_aa64dfr0_el1 */ - .reg = ID_AA64DFR0_EL1, - .CRm = 5, - .Op2 = 0, - .offset = __offsetof(struct cpu_desc, id_aa64dfr0), - .fields = id_aa64dfr0_fields, - }, - { /* id_aa64mmfr0_el1 */ - .reg = ID_AA64MMFR0_EL1, - .CRm = 7, - .Op2 = 0, - .offset = __offsetof(struct cpu_desc, id_aa64mmfr0), - .fields = id_aa64mmfr0_fields, - }, + USER_REG(ID_AA64ISAR0_EL1, id_aa64isar0), + USER_REG(ID_AA64ISAR1_EL1, id_aa64isar1), + USER_REG(ID_AA64PFR0_EL1, id_aa64pfr0), + USER_REG(ID_AA64DFR0_EL1, id_aa64dfr0), + USER_REG(ID_AA64MMFR0_EL1, id_aa64mmfr0), #ifdef COMPAT_FREEBSD32 - { - /* id_isar5_el1 */ - .reg = ID_ISAR5_EL1, - .CRm = 2, - .Op2 = 5, - .offset = __offsetof(struct cpu_desc, id_isar5), - .fields = id_isar5_fields, - }, - { - /* mvfr0 */ - .reg = MVFR0_EL1, - .CRm = 3, - .Op2 = 0, - .offset = __offsetof(struct cpu_desc, mvfr0), - .fields = mvfr0_fields, - }, - { - /* mvfr1 */ - .reg = MVFR1_EL1, - .CRm = 3, - .Op2 = 1, - .offset = __offsetof(struct cpu_desc, mvfr1), - .fields = mvfr1_fields, - }, + USER_REG(ID_ISAR5_EL1, id_isar5), + USER_REG(MVFR0_EL1, mvfr0), + USER_REG(MVFR1_EL1, mvfr1), #endif /* COMPAT_FREEBSD32 */ }; diff --git a/sys/arm64/include/armreg.h b/sys/arm64/include/armreg.h index 819a1f807c69..6a5640ec5e3d 100644 --- a/sys/arm64/include/armreg.h +++ b/sys/arm64/include/armreg.h @@ -50,10 +50,14 @@ #define MRS_Op2_MASK 0x000000e0 #define MRS_Rt_SHIFT 0 #define MRS_Rt_MASK 0x0000001f -#define MRS_REG(op0, op1, crn, crm, op2) \ +#define __MRS_REG(op0, op1, crn, crm, op2) \ (((op0) << MRS_Op0_SHIFT) | ((op1) << MRS_Op1_SHIFT) | \ ((crn) << MRS_CRn_SHIFT) | ((crm) << MRS_CRm_SHIFT) | \ ((op2) << MRS_Op2_SHIFT)) +#define MRS_REG(reg) \ + __MRS_REG(reg##_op0, reg##_op1, reg##_CRn, reg##_CRm, reg##_op2) + + #define READ_SPECIALREG(reg) \ ({ uint64_t _val; \ @@ -258,7 +262,12 @@ #define ICC_SRE_EL1_SRE (1U << 0) /* ID_AA64DFR0_EL1 */ -#define ID_AA64DFR0_EL1 MRS_REG(3, 0, 0, 5, 0) +#define ID_AA64DFR0_EL1 MRS_REG(ID_AA64DFR0_EL1) +#define ID_AA64DFR0_EL1_op0 0x3 +#define ID_AA64DFR0_EL1_op1 0x0 +#define ID_AA64DFR0_EL1_CRn 0x0 +#define ID_AA64DFR0_EL1_CRm 0x5 +#define ID_AA64DFR0_EL1_op2 0x0 #define ID_AA64DFR0_DebugVer_SHIFT 0 #define ID_AA64DFR0_DebugVer_MASK (UL(0xf) << ID_AA64DFR0_DebugVer_SHIFT) #define ID_AA64DFR0_DebugVer_VAL(x) ((x) & ID_AA64DFR0_DebugVer_MASK) @@ -310,7 +319,12 @@ #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) +#define ID_AA64ISAR0_EL1 MRS_REG(ID_AA64ISAR0_EL1) +#define ID_AA64ISAR0_EL1_op0 0x3 +#define ID_AA64ISAR0_EL1_op1 0x0 +#define ID_AA64ISAR0_EL1_CRn 0x0 +#define ID_AA64ISAR0_EL1_CRm 0x6 +#define ID_AA64ISAR0_EL1_op2 0x0 #define ID_AA64ISAR0_AES_SHIFT 4 #define ID_AA64ISAR0_AES_MASK (UL(0xf) << ID_AA64ISAR0_AES_SHIFT) #define ID_AA64ISAR0_AES_VAL(x) ((x) & ID_AA64ISAR0_AES_MASK) @@ -387,7 +401,12 @@ #define ID_AA64ISAR0_RNDR_IMPL (UL(0x1) << ID_AA64ISAR0_RNDR_SHIFT) /* ID_AA64ISAR1_EL1 */ -#define ID_AA64ISAR1_EL1 MRS_REG(3, 0, 0, 6, 1) +#define ID_AA64ISAR1_EL1 MRS_REG(ID_AA64ISAR1_EL1) +#define ID_AA64ISAR1_EL1_op0 0x3 +#define ID_AA64ISAR1_EL1_op1 0x0 +#define ID_AA64ISAR1_EL1_CRn 0x0 +#define ID_AA64ISAR1_EL1_CRm 0x6 +#define ID_AA64ISAR1_EL1_op2 0x1 #define ID_AA64ISAR1_DPB_SHIFT 0 #define ID_AA64ISAR1_DPB_MASK (UL(0xf) << ID_AA64ISAR1_DPB_SHIFT) #define ID_AA64ISAR1_DPB_VAL(x) ((x) & ID_AA64ISAR1_DPB_MASK) @@ -464,7 +483,12 @@ #define ID_AA64ISAR1_I8MM_IMPL (UL(0x1) << ID_AA64ISAR1_I8MM_SHIFT) /* ID_AA64MMFR0_EL1 */ -#define ID_AA64MMFR0_EL1 MRS_REG(3, 0, 0, 7, 0) +#define ID_AA64MMFR0_EL1 MRS_REG(ID_AA64MMFR0_EL1) +#define ID_AA64MMFR0_EL1_op0 0x3 +#define ID_AA64MMFR0_EL1_op1 0x0 +#define ID_AA64MMFR0_EL1_CRn 0x0 +#define ID_AA64MMFR0_EL1_CRm 0x7 +#define ID_AA64MMFR0_EL1_op2 0x0 #define ID_AA64MMFR0_PARange_SHIFT 0 #define ID_AA64MMFR0_PARange_MASK (UL(0xf) << ID_AA64MMFR0_PARange_SHIFT) #define ID_AA64MMFR0_PARange_VAL(x) ((x) & ID_AA64MMFR0_PARange_MASK) @@ -535,7 +559,12 @@ #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) +#define ID_AA64MMFR1_EL1 MRS_REG(ID_AA64MMFR1_EL1) +#define ID_AA64MMFR1_EL1_op0 0x3 +#define ID_AA64MMFR1_EL1_op1 0x0 +#define ID_AA64MMFR1_EL1_CRn 0x0 +#define ID_AA64MMFR1_EL1_CRm 0x7 +#define ID_AA64MMFR1_EL1_op2 0x1 #define ID_AA64MMFR1_HAFDBS_SHIFT 0 #define ID_AA64MMFR1_HAFDBS_MASK (UL(0xf) << ID_AA64MMFR1_HAFDBS_SHIFT) #define ID_AA64MMFR1_HAFDBS_VAL(x) ((x) & ID_AA64MMFR1_HAFDBS_MASK) @@ -581,7 +610,12 @@ #define ID_AA64MMFR1_XNX_IMPL (UL(0x1) << ID_AA64MMFR1_XNX_SHIFT) /* ID_AA64MMFR2_EL1 */ -#define ID_AA64MMFR2_EL1 MRS_REG(3, 0, 0, 7, 2) +#define ID_AA64MMFR2_EL1 MRS_REG(ID_AA64MMFR2_EL1) +#define ID_AA64MMFR2_EL1_op0 0x3 +#define ID_AA64MMFR2_EL1_op1 0x0 +#define ID_AA64MMFR2_EL1_CRn 0x0 +#define ID_AA64MMFR2_EL1_CRm 0x7 +#define ID_AA64MMFR2_EL1_op2 0x2 #define ID_AA64MMFR2_CnP_SHIFT 0 #define ID_AA64MMFR2_CnP_MASK (UL(0xf) << ID_AA64MMFR2_CnP_SHIFT) #define ID_AA64MMFR2_CnP_VAL(x) ((x) & ID_AA64MMFR2_CnP_MASK) @@ -662,7 +696,12 @@ #define ID_AA64MMFR2_E0PD_IMPL (UL(0x1) << ID_AA64MMFR2_E0PD_SHIFT) /* ID_AA64PFR0_EL1 */ -#define ID_AA64PFR0_EL1 MRS_REG(3, 0, 0, 4, 0) +#define ID_AA64PFR0_EL1 MRS_REG(ID_AA64PFR0_EL1) +#define ID_AA64PFR0_EL1_op0 0x3 +#define ID_AA64PFR0_EL1_op1 0x0 +#define ID_AA64PFR0_EL1_CRn 0x0 +#define ID_AA64PFR0_EL1_CRm 0x4 +#define ID_AA64PFR0_EL1_op2 0x0 #define ID_AA64PFR0_EL0_SHIFT 0 #define ID_AA64PFR0_EL0_MASK (UL(0xf) << ID_AA64PFR0_EL0_SHIFT) #define ID_AA64PFR0_EL0_VAL(x) ((x) & ID_AA64PFR0_EL0_MASK) @@ -747,7 +786,12 @@ #define ID_AA64PFR0_CSV3_ISOLATED (UL(0x1) << ID_AA64PFR0_CSV3_SHIFT) /* ID_AA64PFR1_EL1 */ -#define ID_AA64PFR1_EL1 MRS_REG(3, 0, 0, 4, 1) +#define ID_AA64PFR1_EL1 MRS_REG(ID_AA64PFR1_EL1) +#define ID_AA64PFR1_EL1_op0 0x3 +#define ID_AA64PFR1_EL1_op1 0x0 +#define ID_AA64PFR1_EL1_CRn 0x0 +#define ID_AA64PFR1_EL1_CRm 0x4 +#define ID_AA64PFR1_EL1_op2 0x1 #define ID_AA64PFR1_BT_SHIFT 0 #define ID_AA64PFR1_BT_MASK (UL(0xf) << ID_AA64PFR1_BT_SHIFT) #define ID_AA64PFR1_BT_VAL(x) ((x) & ID_AA64PFR1_BT_MASK) @@ -772,7 +816,12 @@ #define ID_AA64PFR1_RAS_frac_V2 (UL(0x1) << ID_AA64PFR1_RAS_frac_SHIFT) /* ID_ISAR5_EL1 */ -#define ID_ISAR5_EL1 MRS_REG(3, 0, 0, 2, 5) +#define ID_ISAR5_EL1 MRS_REG(ID_ISAR5_EL1) +#define ID_ISAR5_EL1_op0 0x3 +#define ID_ISAR5_EL1_op1 0x0 +#define ID_ISAR5_EL1_CRn 0x0 +#define ID_ISAR5_EL1_CRm 0x2 +#define ID_ISAR5_EL1_op2 0x5 #define ID_ISAR5_SEVL_SHIFT 0 #define ID_ISAR5_SEVL_MASK (UL(0xf) << ID_ISAR5_SEVL_SHIFT) #define ID_ISAR5_SEVL_VAL(x) ((x) & ID_ISAR5_SEVL_MASK) @@ -820,7 +869,12 @@ #define MAIR_NORMAL_WB 0xff /* MVFR0_EL1 */ -#define MVFR0_EL1 MRS_REG(3, 0, 0, 3, 0) +#define MVFR0_EL1 MRS_REG(MVFR0_EL1) +#define MVFR0_EL1_op0 0x3 +#define MVFR0_EL1_op1 0x0 +#define MVFR0_EL1_CRn 0x0 +#define MVFR0_EL1_CRm 0x3 +#define MVFR0_EL1_op2 0x0 #define MVFR0_SIMDReg_SHIFT 0 #define MVFR0_SIMDReg_MASK (UL(0xf) << MVFR0_SIMDReg_SHIFT) #define MVFR0_SIMDReg_VAL(x) ((x) & MVFR0_SIMDReg_MASK) @@ -866,7 +920,12 @@ #define MVFR0_FPRound_IMPL (UL(0x1) << MVFR0_FPRound_SHIFT) /* MVFR1_EL1 */ -#define MVFR1_EL1 MRS_REG(3, 0, 0, 3, 1) +#define MVFR1_EL1 MRS_REG(MVFR1_EL1) +#define MVFR1_EL1_op0 0x3 +#define MVFR1_EL1_op1 0x0 +#define MVFR1_EL1_CRn 0x0 +#define MVFR1_EL1_CRm 0x3 +#define MVFR1_EL1_op2 0x1 #define MVFR1_FPFtZ_SHIFT 0 #define MVFR1_FPFtZ_MASK (UL(0xf) << MVFR1_FPFtZ_SHIFT) #define MVFR1_FPFtZ_VAL(x) ((x) & MVFR1_FPFtZ_MASK) From owner-dev-commits-src-all@freebsd.org Wed Jul 28 15:27: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 11E9265D0C5; Wed, 28 Jul 2021 15:27: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 4GZcwy6m8Tz3LMh; Wed, 28 Jul 2021 15:27: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 CC6A820789; Wed, 28 Jul 2021 15:27: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 16SFRkut087781; Wed, 28 Jul 2021 15:27:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16SFRkem087780; Wed, 28 Jul 2021 15:27:46 GMT (envelope-from git) Date: Wed, 28 Jul 2021 15:27:46 GMT Message-Id: <202107281527.16SFRkem087780@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: a48f7ba444fd - main - xen: move x86/xen/xenpv.c to dev/xen/bus/xenpv.c 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: a48f7ba444fdd8598635fc0330631fb293f7818f 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, 28 Jul 2021 15:27:47 -0000 The branch main has been updated by royger: URL: https://cgit.FreeBSD.org/src/commit/?id=a48f7ba444fdd8598635fc0330631fb293f7818f commit a48f7ba444fdd8598635fc0330631fb293f7818f Author: Julien Grall AuthorDate: 2014-01-14 01:41:10 +0000 Commit: Roger Pau Monné CommitDate: 2021-07-28 15:27:02 +0000 xen: move x86/xen/xenpv.c to dev/xen/bus/xenpv.c Minor changes are necessary to make this processor-independent, but moving the file out of x86 and into common is the first step (so others don't add /more/ x86-isms). Submitted by: Elliott Mitchell Reviewed by: royger Differential Revision: https://reviews.freebsd.org/D29042 --- sys/conf/files | 1 + sys/conf/files.x86 | 1 - sys/{x86/xen => dev/xen/bus}/xenpv.c | 0 3 files changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/conf/files b/sys/conf/files index 3d76d9909f77..efb0d4acac4a 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -3541,6 +3541,7 @@ dev/xdma/xdma_sglist.c optional xdma dev/xen/balloon/balloon.c optional xenhvm dev/xen/blkfront/blkfront.c optional xenhvm dev/xen/blkback/blkback.c optional xenhvm +dev/xen/bus/xenpv.c optional xenhvm dev/xen/console/xen_console.c optional xenhvm dev/xen/control/control.c optional xenhvm dev/xen/efi/pvefi.c optional xenhvm efirt diff --git a/sys/conf/files.x86 b/sys/conf/files.x86 index 2e30e33b4c48..b5bde6b87975 100644 --- a/sys/conf/files.x86 +++ b/sys/conf/files.x86 @@ -326,4 +326,3 @@ x86/x86/delay.c standard x86/xen/hvm.c optional xenhvm x86/xen/xen_intr.c optional xenhvm x86/xen/xen_apic.c optional xenhvm -x86/xen/xenpv.c optional xenhvm diff --git a/sys/x86/xen/xenpv.c b/sys/dev/xen/bus/xenpv.c similarity index 100% rename from sys/x86/xen/xenpv.c rename to sys/dev/xen/bus/xenpv.c From owner-dev-commits-src-all@freebsd.org Wed Jul 28 15:27: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 7049A65D617; Wed, 28 Jul 2021 15:27: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 4GZcx22R7Vz3LMj; Wed, 28 Jul 2021 15:27: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 3A53C201C5; Wed, 28 Jul 2021 15:27: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 16SFRoSH087870; Wed, 28 Jul 2021 15:27:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16SFRodA087869; Wed, 28 Jul 2021 15:27:50 GMT (envelope-from git) Date: Wed, 28 Jul 2021 15:27:50 GMT Message-Id: <202107281527.16SFRodA087869@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: d3705b5a7fac - main - xen/control: gate x86 specific code in the preprocessor 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: d3705b5a7faca20247b17ceacc7fdf7a8c5f4839 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, 28 Jul 2021 15:27:50 -0000 The branch main has been updated by royger: URL: https://cgit.FreeBSD.org/src/commit/?id=d3705b5a7faca20247b17ceacc7fdf7a8c5f4839 commit d3705b5a7faca20247b17ceacc7fdf7a8c5f4839 Author: Elliott Mitchell AuthorDate: 2021-04-06 08:18:47 +0000 Commit: Roger Pau Monné CommitDate: 2021-07-28 15:27:02 +0000 xen/control: gate x86 specific code in the preprocessor Commit 152265223048 was implemented strictly for x86. Unfortunately one of the pieces was mixed into a common area breaking other architectures. For now disable these bits on !x86, this should be cleaned up later. Fixes: 152265223048 ('xen: fix dropping bitmap IPIs during resume') Reviewed by: royger Differential Revision: https://reviews.freebsd.org/D29306 --- sys/dev/xen/control/control.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/dev/xen/control/control.c b/sys/dev/xen/control/control.c index a9738eeb7c2b..57251a10e6eb 100644 --- a/sys/dev/xen/control/control.c +++ b/sys/dev/xen/control/control.c @@ -132,7 +132,9 @@ __FBSDID("$FreeBSD$"); #include #include +#if defined(__amd64__) || defined(__i386__) #include +#endif #include #include @@ -289,8 +291,10 @@ xctrl_suspend() * resume CPUs. */ resume_cpus(cpu_suspend_map); +#if defined(__amd64__) || defined(__i386__) /* Send an IPI_BITMAP in case there are pending bitmap IPIs. */ lapic_ipi_vectored(IPI_BITMAP_VECTOR, APIC_IPI_DEST_ALL); +#endif } #endif From owner-dev-commits-src-all@freebsd.org Wed Jul 28 15:27: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 93F5E65D45D; Wed, 28 Jul 2021 15:27: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 4GZcx337Rlz3LRZ; Wed, 28 Jul 2021 15:27: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 4C663202BB; Wed, 28 Jul 2021 15:27: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 16SFRpsE087900; Wed, 28 Jul 2021 15:27:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16SFRpK7087899; Wed, 28 Jul 2021 15:27:51 GMT (envelope-from git) Date: Wed, 28 Jul 2021 15:27:51 GMT Message-Id: <202107281527.16SFRpK7087899@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: 5ca00e0c985f - main - xen/intr: use struct xenisrc * as xen_intr_handle_t 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: 5ca00e0c985f85a241bbb263c66225a8e9c54ae2 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, 28 Jul 2021 15:27:51 -0000 The branch main has been updated by royger: URL: https://cgit.FreeBSD.org/src/commit/?id=5ca00e0c985f85a241bbb263c66225a8e9c54ae2 commit 5ca00e0c985f85a241bbb263c66225a8e9c54ae2 Author: Elliott Mitchell AuthorDate: 2021-04-06 08:30:49 +0000 Commit: Roger Pau Monné CommitDate: 2021-07-28 15:27:03 +0000 xen/intr: use struct xenisrc * as xen_intr_handle_t Since xen_intr_handle_t is meant to be an opaque handle and the only use is retrieving the associated struct xenisrc *, directly use it as the opaque handler. Also add a wrapper function for converting the other direction. If some other value becomes appropriate in the future, these two functions will be the only spots needing modification. Reviewed by: mhorne, royger Differential Revision: https://reviews.freebsd.org/D29500 --- sys/x86/xen/xen_intr.c | 76 +++++++++++++++++++++++++++----------------------- 1 file changed, 41 insertions(+), 35 deletions(-) diff --git a/sys/x86/xen/xen_intr.c b/sys/x86/xen/xen_intr.c index c729ffddb345..ebbae25c2d9e 100644 --- a/sys/x86/xen/xen_intr.c +++ b/sys/x86/xen/xen_intr.c @@ -168,6 +168,38 @@ static u_int xen_intr_auto_vector_count; static struct xenisrc *xen_intr_port_to_isrc[NR_EVENT_CHANNELS]; /*------------------------- Private Functions --------------------------------*/ + +/** + * Retrieve a handle for a Xen interrupt source. + * + * \param isrc A valid Xen interrupt source structure. + * + * \returns A handle suitable for use with xen_intr_isrc_from_handle() + * to retrieve the original Xen interrupt source structure. + */ + +static inline xen_intr_handle_t +xen_intr_handle_from_isrc(struct xenisrc *isrc) +{ + return (isrc); +} + +/** + * Lookup a Xen interrupt source object given an interrupt binding handle. + * + * \param handle A handle initialized by a previous call to + * xen_intr_bind_isrc(). + * + * \returns A pointer to the Xen interrupt source object associated + * with the given interrupt handle. NULL if no association + * currently exists. + */ +static inline struct xenisrc * +xen_intr_isrc_from_handle(xen_intr_handle_t handle) +{ + return ((struct xenisrc *)handle); +} + /** * Disable signal delivery for an event channel port on the * specified CPU. @@ -393,8 +425,8 @@ xen_intr_bind_isrc(struct xenisrc **isrcp, evtchn_port_t local_port, refcount_init(&isrc->xi_refcount, 1); mtx_unlock(&xen_intr_isrc_lock); - /* Assign the opaque handler (the event channel port) */ - *port_handlep = &isrc->xi_vector; + /* Assign the opaque handler */ + *port_handlep = xen_intr_handle_from_isrc(isrc); #ifdef SMP if (type == EVTCHN_TYPE_PORT) { @@ -427,32 +459,6 @@ xen_intr_bind_isrc(struct xenisrc **isrcp, evtchn_port_t local_port, return (0); } -/** - * Lookup a Xen interrupt source object given an interrupt binding handle. - * - * \param handle A handle initialized by a previous call to - * xen_intr_bind_isrc(). - * - * \returns A pointer to the Xen interrupt source object associated - * with the given interrupt handle. NULL if no association - * currently exists. - */ -static struct xenisrc * -xen_intr_isrc(xen_intr_handle_t handle) -{ - int vector; - - if (handle == NULL) - return (NULL); - - vector = *(int *)handle; - KASSERT(vector >= first_evtchn_irq && - vector < (first_evtchn_irq + xen_intr_auto_vector_count), - ("Xen interrupt vector is out of range")); - - return ((struct xenisrc *)intr_lookup_source(vector)); -} - /** * Determine the event channel ports at the given section of the * event port bitmap which have pending events for the given cpu. @@ -1195,7 +1201,7 @@ xen_intr_describe(xen_intr_handle_t port_handle, const char *fmt, ...) struct xenisrc *isrc; va_list ap; - isrc = xen_intr_isrc(port_handle); + isrc = xen_intr_isrc_from_handle(port_handle); if (isrc == NULL) return (EINVAL); @@ -1213,7 +1219,7 @@ xen_intr_unbind(xen_intr_handle_t *port_handlep) KASSERT(port_handlep != NULL, ("NULL xen_intr_handle_t passed to xen_intr_unbind")); - isrc = xen_intr_isrc(*port_handlep); + isrc = xen_intr_isrc_from_handle(*port_handlep); *port_handlep = NULL; if (isrc == NULL) return; @@ -1235,7 +1241,7 @@ xen_intr_signal(xen_intr_handle_t handle) { struct xenisrc *isrc; - isrc = xen_intr_isrc(handle); + isrc = xen_intr_isrc_from_handle(handle); if (isrc != NULL) { KASSERT(isrc->xi_type == EVTCHN_TYPE_PORT || isrc->xi_type == EVTCHN_TYPE_IPI, @@ -1250,7 +1256,7 @@ xen_intr_port(xen_intr_handle_t handle) { struct xenisrc *isrc; - isrc = xen_intr_isrc(handle); + isrc = xen_intr_isrc_from_handle(handle); if (isrc == NULL) return (0); @@ -1265,7 +1271,7 @@ xen_intr_add_handler(const char *name, driver_filter_t filter, struct xenisrc *isrc; int error; - isrc = xen_intr_isrc(handle); + isrc = xen_intr_isrc_from_handle(handle); if (isrc == NULL || isrc->xi_cookie != NULL) return (EINVAL); @@ -1299,8 +1305,8 @@ xen_intr_get_evtchn_from_port(evtchn_port_t port, xen_intr_handle_t *handlep) refcount_acquire(&xen_intr_port_to_isrc[port]->xi_refcount); mtx_unlock(&xen_intr_isrc_lock); - /* Assign the opaque handler (the event channel port) */ - *handlep = &xen_intr_port_to_isrc[port]->xi_vector; + /* Assign the opaque handler */ + *handlep = xen_intr_handle_from_isrc(xen_intr_port_to_isrc[port]); return (0); } From owner-dev-commits-src-all@freebsd.org Wed Jul 28 15:27: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 19FD865D04E; Wed, 28 Jul 2021 15:27: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 4GZcx00FVFz3LPk; Wed, 28 Jul 2021 15:27: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 E5305206E4; Wed, 28 Jul 2021 15:27: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 16SFRlu9087809; Wed, 28 Jul 2021 15:27:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16SFRlVM087808; Wed, 28 Jul 2021 15:27:47 GMT (envelope-from git) Date: Wed, 28 Jul 2021 15:27:47 GMT Message-Id: <202107281527.16SFRlVM087808@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: b6ff9345a46a - main - xen: create VM_MEMATTR_XEN for Xen memory mappings 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: b6ff9345a46af564da32ad480490eaa97840d0b6 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, 28 Jul 2021 15:27:48 -0000 The branch main has been updated by royger: URL: https://cgit.FreeBSD.org/src/commit/?id=b6ff9345a46af564da32ad480490eaa97840d0b6 commit b6ff9345a46af564da32ad480490eaa97840d0b6 Author: Elliott Mitchell AuthorDate: 2021-04-06 07:59:30 +0000 Commit: Roger Pau Monné CommitDate: 2021-07-28 15:27:02 +0000 xen: create VM_MEMATTR_XEN for Xen memory mappings The requirements for pages shared with Xen/other VMs may vary from architecture to architecture. As such create a macro which various architectures can use. Remove a use of PAT_WRITE_BACK in xenstore.c. This is a x86-ism which shouldn't have been present in a common area. Original idea: Julien Grall , 2014-01-14 06:44:08 Approach suggested by: royger Reviewed by: royger, mhorne Differential Revision: https://reviews.freebsd.org/D29351 --- sys/dev/xen/bus/xenpv.c | 2 +- sys/dev/xen/console/xen_console.c | 2 +- sys/dev/xen/xenstore/xenstore.c | 2 +- sys/x86/include/xen/xen-os.h | 3 +++ 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/sys/dev/xen/bus/xenpv.c b/sys/dev/xen/bus/xenpv.c index d9db10b7005d..080c82c73f08 100644 --- a/sys/dev/xen/bus/xenpv.c +++ b/sys/dev/xen/bus/xenpv.c @@ -125,7 +125,7 @@ xenpv_alloc_physmem(device_t dev, device_t child, int *res_id, size_t size) phys_addr = rman_get_start(res); error = vm_phys_fictitious_reg_range(phys_addr, phys_addr + size, - VM_MEMATTR_DEFAULT); + VM_MEMATTR_XEN); if (error) { bus_release_resource(child, SYS_RES_MEMORY, *res_id, res); return (NULL); diff --git a/sys/dev/xen/console/xen_console.c b/sys/dev/xen/console/xen_console.c index 7eed30885e6b..8ad755dbf214 100644 --- a/sys/dev/xen/console/xen_console.c +++ b/sys/dev/xen/console/xen_console.c @@ -273,7 +273,7 @@ static void xencons_early_init_ring(struct xencons_priv *cons) { cons->intf = pmap_mapdev_attr(ptoa(xen_get_console_mfn()), PAGE_SIZE, - VM_MEMATTR_WRITE_BACK); + VM_MEMATTR_XEN); cons->evtchn = xen_get_console_evtchn(); } diff --git a/sys/dev/xen/xenstore/xenstore.c b/sys/dev/xen/xenstore/xenstore.c index 890cfe009411..dc00ed0d50b8 100644 --- a/sys/dev/xen/xenstore/xenstore.c +++ b/sys/dev/xen/xenstore/xenstore.c @@ -1130,7 +1130,7 @@ xs_attach(device_t dev) } else { xs.gpfn = xen_get_xenstore_mfn(); xen_store = pmap_mapdev_attr(ptoa(xs.gpfn), PAGE_SIZE, - PAT_WRITE_BACK); + VM_MEMATTR_XEN); xs.initialized = true; } diff --git a/sys/x86/include/xen/xen-os.h b/sys/x86/include/xen/xen-os.h index 86bacadc8521..78d44ad7c9d7 100644 --- a/sys/x86/include/xen/xen-os.h +++ b/sys/x86/include/xen/xen-os.h @@ -30,6 +30,9 @@ #ifndef _MACHINE_X86_XEN_XEN_OS_H_ #define _MACHINE_X86_XEN_XEN_OS_H_ +/* Shared memory needs write-back as its cache attribute for coherency. */ +#define VM_MEMATTR_XEN VM_MEMATTR_WRITE_BACK + /* Everything below this point is not included by assembler (.S) files. */ #ifndef __ASSEMBLY__ From owner-dev-commits-src-all@freebsd.org Wed Jul 28 15:27: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 68E1365D615; Wed, 28 Jul 2021 15:27: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 4GZcx12SFGz3LGm; Wed, 28 Jul 2021 15:27: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 2938E2078A; Wed, 28 Jul 2021 15:27: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 16SFRmCs087837; Wed, 28 Jul 2021 15:27:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16SFRmVY087836; Wed, 28 Jul 2021 15:27:48 GMT (envelope-from git) Date: Wed, 28 Jul 2021 15:27:48 GMT Message-Id: <202107281527.16SFRmVY087836@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: d561380eb31e - main - xen/xen-os: don't let anyone else defining __XEN_INTERFACE_VERSION__ 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: d561380eb31efcf2f79bce9be78c3d499e6efba4 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, 28 Jul 2021 15:27:49 -0000 The branch main has been updated by royger: URL: https://cgit.FreeBSD.org/src/commit/?id=d561380eb31efcf2f79bce9be78c3d499e6efba4 commit d561380eb31efcf2f79bce9be78c3d499e6efba4 Author: Julien Grall AuthorDate: 2015-10-16 18:59:45 +0000 Commit: Roger Pau Monné CommitDate: 2021-07-28 15:27:02 +0000 xen/xen-os: don't let anyone else defining __XEN_INTERFACE_VERSION__ FreeBSD should always use the same version across the source. If not it's a call for problem. Submitted by: Elliott Mitchell Reviewed by: royger Differential Revision: https://reviews.freebsd.org/D29407 --- sys/xen/xen-os.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/sys/xen/xen-os.h b/sys/xen/xen-os.h index cd8a53aab54f..fdec54936b0d 100644 --- a/sys/xen/xen-os.h +++ b/sys/xen/xen-os.h @@ -30,9 +30,7 @@ #ifndef _XEN_XEN_OS_H_ #define _XEN_XEN_OS_H_ -#if !defined(__XEN_INTERFACE_VERSION__) #define __XEN_INTERFACE_VERSION__ 0x00030208 -#endif #define GRANT_REF_INVALID 0xffffffff From owner-dev-commits-src-all@freebsd.org Wed Jul 28 15:27: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 99AF965D0E9; Wed, 28 Jul 2021 15:27: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 4GZcx8241Bz3LHJ; Wed, 28 Jul 2021 15:27: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 D81AE206E6; Wed, 28 Jul 2021 15:27: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 16SFRt0B088014; Wed, 28 Jul 2021 15:27:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16SFRtUL088013; Wed, 28 Jul 2021 15:27:55 GMT (envelope-from git) Date: Wed, 28 Jul 2021 15:27:55 GMT Message-Id: <202107281527.16SFRtUL088013@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: c89f1f12b07b - main - xen/xen-os: move inclusion of machine/xen-os.h later 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: c89f1f12b07be43df17cde53a0dcaf4f3a271eba 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, 28 Jul 2021 15:27:56 -0000 The branch main has been updated by royger: URL: https://cgit.FreeBSD.org/src/commit/?id=c89f1f12b07be43df17cde53a0dcaf4f3a271eba commit c89f1f12b07be43df17cde53a0dcaf4f3a271eba Author: Elliott Mitchell AuthorDate: 2021-04-17 01:49:25 +0000 Commit: Roger Pau Monné CommitDate: 2021-07-28 15:27:04 +0000 xen/xen-os: move inclusion of machine/xen-os.h later Several of x86 enable/disable functions depend upon the xen*domain() functions. As such the xen*domain() functions need to be declared before machine/xen-os.h. Officially declare direct inclusion of machine/xen/xen-os.h verboten as such will break these functions/macros. Remove one such soon to be broken inclusion. Reviewed by: royger Differential Revision: https://reviews.freebsd.org/D29811 --- sys/x86/include/xen/xen-os.h | 4 ++++ sys/x86/xen/xen_intr.c | 1 - sys/xen/xen-os.h | 12 ++++++------ 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/sys/x86/include/xen/xen-os.h b/sys/x86/include/xen/xen-os.h index 78d44ad7c9d7..7ca1075e61f3 100644 --- a/sys/x86/include/xen/xen-os.h +++ b/sys/x86/include/xen/xen-os.h @@ -30,6 +30,10 @@ #ifndef _MACHINE_X86_XEN_XEN_OS_H_ #define _MACHINE_X86_XEN_XEN_OS_H_ +#ifndef _XEN_XEN_OS_H_ +#error "do not #include machine/xen/xen-os.h, #include xen/xen-os.h instead" +#endif + /* Shared memory needs write-back as its cache attribute for coherency. */ #define VM_MEMATTR_XEN VM_MEMATTR_WRITE_BACK diff --git a/sys/x86/xen/xen_intr.c b/sys/x86/xen/xen_intr.c index 646c9b4728fc..bab86ccd295a 100644 --- a/sys/x86/xen/xen_intr.c +++ b/sys/x86/xen/xen_intr.c @@ -57,7 +57,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include diff --git a/sys/xen/xen-os.h b/sys/xen/xen-os.h index fdec54936b0d..3b963bd20f7a 100644 --- a/sys/xen/xen-os.h +++ b/sys/xen/xen-os.h @@ -71,12 +71,6 @@ xen_get_console_evtchn(void) return (hvm_get_parameter(HVM_PARAM_CONSOLE_EVTCHN)); } -#endif - -#include - -/* Everything below this point is not included by assembler (.S) files. */ -#ifndef __ASSEMBLY__ extern shared_info_t *HYPERVISOR_shared_info; @@ -117,6 +111,12 @@ xen_initial_domain(void) return (xen_domain() && (hvm_start_flags & SIF_INITDOMAIN) != 0); } +#endif + +#include + +/* Everything below this point is not included by assembler (.S) files. */ +#ifndef __ASSEMBLY__ /* * Based on ofed/include/linux/bitops.h From owner-dev-commits-src-all@freebsd.org Wed Jul 28 15:27: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 78F7E65D067; Wed, 28 Jul 2021 15:27: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 4GZcx91bT9z3LS2; Wed, 28 Jul 2021 15:27: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 121C31FFDE; Wed, 28 Jul 2021 15:27: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 16SFRuBq088046; Wed, 28 Jul 2021 15:27:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16SFRuFp088045; Wed, 28 Jul 2021 15:27:56 GMT (envelope-from git) Date: Wed, 28 Jul 2021 15:27:56 GMT Message-Id: <202107281527.16SFRuFp088045@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: 5f7000832791 - main - xen/netfront: introduce xen_pv_nics_disabled() 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: 5f7000832791716e63ca8481d6e5784915786ce0 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, 28 Jul 2021 15:27:57 -0000 The branch main has been updated by royger: URL: https://cgit.FreeBSD.org/src/commit/?id=5f7000832791716e63ca8481d6e5784915786ce0 commit 5f7000832791716e63ca8481d6e5784915786ce0 Author: Julien Grall AuthorDate: 2015-10-16 18:26:35 +0000 Commit: Roger Pau Monné CommitDate: 2021-07-28 15:27:04 +0000 xen/netfront: introduce xen_pv_nics_disabled() ARM guest is considered as HVM but it only supports PV nics (no emulation available). Submitted by: Elliott Mitchell Reviewed by: royger Differential Revision: https://reviews.freebsd.org/D29405 --- sys/dev/xen/netfront/netfront.c | 2 +- sys/x86/include/xen/xen-os.h | 10 ++++++++++ sys/xen/xen-os.h | 1 - 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/sys/dev/xen/netfront/netfront.c b/sys/dev/xen/netfront/netfront.c index 4b8bd5589283..fd2d97a7c70c 100644 --- a/sys/dev/xen/netfront/netfront.c +++ b/sys/dev/xen/netfront/netfront.c @@ -378,7 +378,7 @@ static int netfront_probe(device_t dev) { - if (xen_hvm_domain() && xen_disable_pv_nics != 0) + if (xen_pv_nics_disabled()) return (ENXIO); if (!strcmp(xenbus_get_type(dev), "vif")) { diff --git a/sys/x86/include/xen/xen-os.h b/sys/x86/include/xen/xen-os.h index 7ca1075e61f3..a6766190bfc2 100644 --- a/sys/x86/include/xen/xen-os.h +++ b/sys/x86/include/xen/xen-os.h @@ -43,6 +43,16 @@ /* If non-zero, the hypervisor has been configured to use a direct vector */ extern int xen_vector_callback_enabled; +/* tunable for disabling PV nics */ +extern int xen_disable_pv_nics; + +static inline bool +xen_pv_nics_disabled(void) +{ + + return (xen_hvm_domain() && xen_disable_pv_nics != 0); +} + #endif /* !__ASSEMBLY__ */ #endif /* _MACHINE_X86_XEN_XEN_OS_H_ */ diff --git a/sys/xen/xen-os.h b/sys/xen/xen-os.h index 3b963bd20f7a..6817e96c10fc 100644 --- a/sys/xen/xen-os.h +++ b/sys/xen/xen-os.h @@ -75,7 +75,6 @@ xen_get_console_evtchn(void) extern shared_info_t *HYPERVISOR_shared_info; extern int xen_disable_pv_disks; -extern int xen_disable_pv_nics; extern bool xen_suspend_cancelled; From owner-dev-commits-src-all@freebsd.org Wed Jul 28 15:27: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 2567565D473; Wed, 28 Jul 2021 15:27: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 4GZcxB2R6Xz3LS3; Wed, 28 Jul 2021 15:27: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 37A00205E9; Wed, 28 Jul 2021 15:27: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 16SFRwsm088074; Wed, 28 Jul 2021 15:27:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16SFRwYs088073; Wed, 28 Jul 2021 15:27:58 GMT (envelope-from git) Date: Wed, 28 Jul 2021 15:27:58 GMT Message-Id: <202107281527.16SFRwYs088073@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: 69c6eee7567b - main - xen: introduce xen_pv_disks_disabled() 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: 69c6eee7567ba17c9575c4bcc3bb9eb2666dd290 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, 28 Jul 2021 15:27:59 -0000 The branch main has been updated by royger: URL: https://cgit.FreeBSD.org/src/commit/?id=69c6eee7567ba17c9575c4bcc3bb9eb2666dd290 commit 69c6eee7567ba17c9575c4bcc3bb9eb2666dd290 Author: Julien Grall AuthorDate: 2015-10-16 18:18:21 +0000 Commit: Roger Pau Monné CommitDate: 2021-07-28 15:27:04 +0000 xen: introduce xen_pv_disks_disabled() ARM guest is considered as HVM in Freebsd but they only support PV disk (no emulation available). Submitted by: Elliott Mitchell Reviewed by: royger Differential Revision: https://reviews.freebsd.org/D29403 --- sys/dev/xen/blkfront/blkfront.c | 2 +- sys/x86/include/xen/xen-os.h | 10 ++++++++++ sys/xen/xen-os.h | 2 -- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/sys/dev/xen/blkfront/blkfront.c b/sys/dev/xen/blkfront/blkfront.c index 847644ca1e67..7078cb16caa1 100644 --- a/sys/dev/xen/blkfront/blkfront.c +++ b/sys/dev/xen/blkfront/blkfront.c @@ -1439,7 +1439,7 @@ xbd_probe(device_t dev) if (strcmp(xenbus_get_type(dev), "vbd") != 0) return (ENXIO); - if (xen_hvm_domain() && xen_disable_pv_disks != 0) + if (xen_pv_disks_disabled()) return (ENXIO); if (xen_hvm_domain()) { diff --git a/sys/x86/include/xen/xen-os.h b/sys/x86/include/xen/xen-os.h index a6766190bfc2..37463a8b069c 100644 --- a/sys/x86/include/xen/xen-os.h +++ b/sys/x86/include/xen/xen-os.h @@ -43,9 +43,19 @@ /* If non-zero, the hypervisor has been configured to use a direct vector */ extern int xen_vector_callback_enabled; +/* tunable for disabling PV disks */ +extern int xen_disable_pv_disks; + /* tunable for disabling PV nics */ extern int xen_disable_pv_nics; +static inline bool +xen_pv_disks_disabled(void) +{ + + return (xen_hvm_domain() && xen_disable_pv_disks != 0); +} + static inline bool xen_pv_nics_disabled(void) { diff --git a/sys/xen/xen-os.h b/sys/xen/xen-os.h index 6817e96c10fc..988da24dc878 100644 --- a/sys/xen/xen-os.h +++ b/sys/xen/xen-os.h @@ -74,8 +74,6 @@ xen_get_console_evtchn(void) extern shared_info_t *HYPERVISOR_shared_info; -extern int xen_disable_pv_disks; - extern bool xen_suspend_cancelled; enum xen_domain_type { From owner-dev-commits-src-all@freebsd.org Wed Jul 28 15:27: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 2768365CEE8; Wed, 28 Jul 2021 15:27: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 4GZcx44LHFz3L7S; Wed, 28 Jul 2021 15:27: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 70C55205E8; Wed, 28 Jul 2021 15:27: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 16SFRqWT087928; Wed, 28 Jul 2021 15:27:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16SFRqtb087927; Wed, 28 Jul 2021 15:27:52 GMT (envelope-from git) Date: Wed, 28 Jul 2021 15:27:52 GMT Message-Id: <202107281527.16SFRqtb087927@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: ae5981274815 - main - xen/timer: make xen timer optional 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: ae5981274815804e31f891f908627aa21696820e 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, 28 Jul 2021 15:27:53 -0000 The branch main has been updated by royger: URL: https://cgit.FreeBSD.org/src/commit/?id=ae5981274815804e31f891f908627aa21696820e commit ae5981274815804e31f891f908627aa21696820e Author: Julien Grall AuthorDate: 2014-01-14 01:41:14 +0000 Commit: Roger Pau Monné CommitDate: 2021-07-28 15:27:03 +0000 xen/timer: make xen timer optional The timer is not used on ARM. Submitted by: Elliott Mitchell Reviewed by: royger Differential Revision: https://reviews.freebsd.org/D29041 --- sys/amd64/conf/GENERIC | 4 +++- sys/conf/files | 2 +- sys/i386/conf/GENERIC | 4 +++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/sys/amd64/conf/GENERIC b/sys/amd64/conf/GENERIC index a28dc238af8d..fa531e13a3b9 100644 --- a/sys/amd64/conf/GENERIC +++ b/sys/amd64/conf/GENERIC @@ -380,9 +380,11 @@ device virtio_balloon # VirtIO Memory Balloon device device hyperv # HyperV drivers # Xen HVM Guest Optimizations -# NOTE: XENHVM depends on xenpci. They must be added or removed together. +# NOTE: XENHVM and xenpci interdepend. They must be added or removed +# together. xentimer depends on XENHVM and isn't required. options XENHVM # Xen HVM kernel infrastructure device xenpci # Xen HVM Hypervisor services driver +device xentimer # Xen x86 PV timer device # Netmap provides direct access to TX/RX rings on supported NICs device netmap # netmap(4) support diff --git a/sys/conf/files b/sys/conf/files index efb0d4acac4a..ae3fd61ed7a1 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -3548,8 +3548,8 @@ dev/xen/efi/pvefi.c optional xenhvm efirt dev/xen/grant_table/grant_table.c optional xenhvm dev/xen/netback/netback.c optional xenhvm dev/xen/netfront/netfront.c optional xenhvm +dev/xen/timer/timer.c optional xenhvm xentimer dev/xen/xenpci/xenpci.c optional xenpci -dev/xen/timer/timer.c optional xenhvm dev/xen/xenstore/xenstore.c optional xenhvm dev/xen/xenstore/xenstore_dev.c optional xenhvm dev/xen/xenstore/xenstored_dev.c optional xenhvm diff --git a/sys/i386/conf/GENERIC b/sys/i386/conf/GENERIC index 96d0803e1f2e..86c062effd81 100644 --- a/sys/i386/conf/GENERIC +++ b/sys/i386/conf/GENERIC @@ -343,9 +343,11 @@ options HYPERV # Kernel support for HyperV drivers device hyperv # HyperV drivers # Xen HVM Guest Optimizations -# NOTE: XENHVM depends on xenpci. They must be added or removed together. +# NOTE: XENHVM and xenpci interdepend. They must be added or removed +# together. xentimer depends on XENHVM and isn't required. 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 Wed Jul 28 15:27: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 CC6D965D45E; Wed, 28 Jul 2021 15:27: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 4GZcx55466z3LRl; Wed, 28 Jul 2021 15:27: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 8DB48206E5; Wed, 28 Jul 2021 15:27: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 16SFRrpF087956; Wed, 28 Jul 2021 15:27:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16SFRrs2087955; Wed, 28 Jul 2021 15:27:53 GMT (envelope-from git) Date: Wed, 28 Jul 2021 15:27:53 GMT Message-Id: <202107281527.16SFRrs2087955@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: 9976c5a540c1 - main - xen/intr: use __func__ instead of function names 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: 9976c5a540c1e140151e3d59bc4a0e0bdeef0cda 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, 28 Jul 2021 15:27:53 -0000 The branch main has been updated by royger: URL: https://cgit.FreeBSD.org/src/commit/?id=9976c5a540c1e140151e3d59bc4a0e0bdeef0cda commit 9976c5a540c1e140151e3d59bc4a0e0bdeef0cda Author: Elliott Mitchell AuthorDate: 2021-04-06 13:46:46 +0000 Commit: Roger Pau Monné CommitDate: 2021-07-28 15:27:03 +0000 xen/intr: use __func__ instead of function names Functions tend to get renamed and unless the developer is careful often debugging messages are missed. As such using func is far superior. Replace several instances of hard-coded function names. Reviewed by: royger Differential revision: https://reviews.freebsd.org/D29499 --- sys/x86/xen/xen_intr.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/sys/x86/xen/xen_intr.c b/sys/x86/xen/xen_intr.c index ebbae25c2d9e..646c9b4728fc 100644 --- a/sys/x86/xen/xen_intr.c +++ b/sys/x86/xen/xen_intr.c @@ -316,7 +316,7 @@ xen_intr_alloc_isrc(enum evtchn_type type) if (xen_intr_auto_vector_count > NR_EVENT_CHANNELS) { if (!warned) { warned = 1; - printf("xen_intr_alloc: Event channels exhausted.\n"); + printf("%s: Event channels exhausted.\n", __func__); } return (NULL); } @@ -406,8 +406,7 @@ xen_intr_bind_isrc(struct xenisrc **isrcp, evtchn_port_t local_port, *isrcp = NULL; if (port_handlep == NULL) { - printf("%s: xen_intr_bind_isrc: Bad event handle\n", - intr_owner); + printf("%s: %s: Bad event handle\n", intr_owner, __func__); return (EINVAL); } @@ -1217,7 +1216,7 @@ xen_intr_unbind(xen_intr_handle_t *port_handlep) struct xenisrc *isrc; KASSERT(port_handlep != NULL, - ("NULL xen_intr_handle_t passed to xen_intr_unbind")); + ("NULL xen_intr_handle_t passed to %s", __func__)); isrc = xen_intr_isrc_from_handle(*port_handlep); *port_handlep = NULL; @@ -1277,11 +1276,9 @@ xen_intr_add_handler(const char *name, driver_filter_t filter, error = intr_add_handler(name, isrc->xi_vector,filter, handler, arg, flags|INTR_EXCL, &isrc->xi_cookie, 0); - if (error != 0) { - printf( - "%s: xen_intr_add_handler: intr_add_handler failed: %d\n", - name, error); - } + if (error != 0) + printf("%s: %s: add handler failed: %d\n", name, __func__, + error); return (error); } From owner-dev-commits-src-all@freebsd.org Wed Jul 28 15:27: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 0944765D61E; Wed, 28 Jul 2021 15:27: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 4GZcx66dd1z3LTj; Wed, 28 Jul 2021 15:27: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 B886B2071B; Wed, 28 Jul 2021 15:27: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 16SFRs3o087984; Wed, 28 Jul 2021 15:27:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16SFRsUZ087983; Wed, 28 Jul 2021 15:27:54 GMT (envelope-from git) Date: Wed, 28 Jul 2021 15:27:54 GMT Message-Id: <202107281527.16SFRsUZ087983@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: e627e25d761f - main - xen/xenpv: remove low memory limit for non-x86 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: e627e25d761f8a11e9e5881e804fae5793404947 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, 28 Jul 2021 15:27:55 -0000 The branch main has been updated by royger: URL: https://cgit.FreeBSD.org/src/commit/?id=e627e25d761f8a11e9e5881e804fae5793404947 commit e627e25d761f8a11e9e5881e804fae5793404947 Author: Elliott Mitchell AuthorDate: 2021-04-06 09:28:38 +0000 Commit: Roger Pau Monné CommitDate: 2021-07-28 15:27:03 +0000 xen/xenpv: remove low memory limit for non-x86 For embedded devices reserved addresses will be known in advance. More recently added devices will also likely be correctly updated. As a result using any available address is reasonable on non-x86. Reviewed by: royger Differential Revision: https://reviews.freebsd.org/D29304 --- sys/dev/xen/bus/xenpv.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/dev/xen/bus/xenpv.c b/sys/dev/xen/bus/xenpv.c index 080c82c73f08..42f2c88a2885 100644 --- a/sys/dev/xen/bus/xenpv.c +++ b/sys/dev/xen/bus/xenpv.c @@ -55,13 +55,17 @@ __FBSDID("$FreeBSD$"); * * Since this is not possible on i386 just use any available memory * chunk above 1MB and hope we don't clash with anything else. + * + * Other architectures better document MMIO regions and drivers more + * reliably reserve them. As such, allow using any unpopulated memory + * region. */ #ifdef __amd64__ #define LOW_MEM_LIMIT 0x100000000ul #elif defined(__i386__) #define LOW_MEM_LIMIT 0x100000ul #else -#error "Unsupported architecture" +#define LOW_MEM_LIMIT 0 #endif static devclass_t xenpv_devclass; From owner-dev-commits-src-all@freebsd.org Wed Jul 28 15:27: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 9634965D694; Wed, 28 Jul 2021 15:27: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 4GZcxC3Mvhz3L0V; Wed, 28 Jul 2021 15:27: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 5699D205EA; Wed, 28 Jul 2021 15:27: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 16SFRxHh088102; Wed, 28 Jul 2021 15:27:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16SFRxLu088101; Wed, 28 Jul 2021 15:27:59 GMT (envelope-from git) Date: Wed, 28 Jul 2021 15:27:59 GMT Message-Id: <202107281527.16SFRxLu088101@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: 0b4f30c2366c - main - xen/control: introduce xen_pv_shutdown_handler() 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: 0b4f30c2366c658ea158590cfe621b8229a210e3 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, 28 Jul 2021 15:27:59 -0000 The branch main has been updated by royger: URL: https://cgit.FreeBSD.org/src/commit/?id=0b4f30c2366c658ea158590cfe621b8229a210e3 commit 0b4f30c2366c658ea158590cfe621b8229a210e3 Author: Julien Grall AuthorDate: 2014-04-04 23:52:05 +0000 Commit: Roger Pau Monné CommitDate: 2021-07-28 15:27:04 +0000 xen/control: introduce xen_pv_shutdown_handler() While x86 only register PV shutdown handler for PV guests. ARM guests are always using HVM and requires the PV shutdown handler. Submitted by: Elliott Mitchell Reviewed by: royger Differential Revision: https://reviews.freebsd.org/D29406 --- sys/dev/xen/control/control.c | 2 +- sys/x86/include/xen/xen-os.h | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/sys/dev/xen/control/control.c b/sys/dev/xen/control/control.c index 57251a10e6eb..f72193edceea 100644 --- a/sys/dev/xen/control/control.c +++ b/sys/dev/xen/control/control.c @@ -446,7 +446,7 @@ xctrl_attach(device_t dev) xctrl->xctrl_watch.max_pending = 1; xs_register_watch(&xctrl->xctrl_watch); - if (xen_pv_domain()) + if (xen_pv_shutdown_handler()) EVENTHANDLER_REGISTER(shutdown_final, xen_pv_shutdown_final, NULL, SHUTDOWN_PRI_LAST); diff --git a/sys/x86/include/xen/xen-os.h b/sys/x86/include/xen/xen-os.h index 37463a8b069c..5b3b912e0891 100644 --- a/sys/x86/include/xen/xen-os.h +++ b/sys/x86/include/xen/xen-os.h @@ -49,6 +49,13 @@ extern int xen_disable_pv_disks; /* tunable for disabling PV nics */ extern int xen_disable_pv_nics; +static inline bool +xen_pv_shutdown_handler(void) +{ + + return (xen_pv_domain()); +} + static inline bool xen_pv_disks_disabled(void) { From owner-dev-commits-src-all@freebsd.org Wed Jul 28 15:28: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 F128865D0F5; Wed, 28 Jul 2021 15:28: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 4GZcxF31Vbz3LdB; Wed, 28 Jul 2021 15:28: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 93466205EB; Wed, 28 Jul 2021 15:28: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 16SFS0kS088130; Wed, 28 Jul 2021 15:28:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16SFS0Uf088129; Wed, 28 Jul 2021 15:28:00 GMT (envelope-from git) Date: Wed, 28 Jul 2021 15:28:00 GMT Message-Id: <202107281528.16SFS0Uf088129@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: 7de88bb4a2e8 - main - xen/grant_table: cleanup max_nr_grant_frames() 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: 7de88bb4a2e872f72b6d443547c50178799b8366 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, 28 Jul 2021 15:28:02 -0000 The branch main has been updated by royger: URL: https://cgit.FreeBSD.org/src/commit/?id=7de88bb4a2e872f72b6d443547c50178799b8366 commit 7de88bb4a2e872f72b6d443547c50178799b8366 Author: Elliott Mitchell AuthorDate: 2021-04-10 06:12:25 +0000 Commit: Roger Pau Monné CommitDate: 2021-07-28 15:27:04 +0000 xen/grant_table: cleanup max_nr_grant_frames() This is no more or less than returning the smaller of two values. Since this is what min() does, use that to shrink max_nr_grant_frames() down to the single line. Reviewed by: royger Differential Revision: https://reviews.freebsd.org/D29840 --- sys/dev/xen/grant_table/grant_table.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/sys/dev/xen/grant_table/grant_table.c b/sys/dev/xen/grant_table/grant_table.c index ad43a4121728..6dc11cac1bc4 100644 --- a/sys/dev/xen/grant_table/grant_table.c +++ b/sys/dev/xen/grant_table/grant_table.c @@ -471,11 +471,8 @@ __max_nr_grant_frames(void) static inline unsigned int max_nr_grant_frames(void) { - unsigned int xen_max = __max_nr_grant_frames(); - if (xen_max > boot_max_nr_grant_frames) - return (boot_max_nr_grant_frames); - return (xen_max); + return (min(__max_nr_grant_frames(), boot_max_nr_grant_frames)); } #ifdef notyet From owner-dev-commits-src-all@freebsd.org Wed Jul 28 15:28: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 3E5C065D63C; Wed, 28 Jul 2021 15:28: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 4GZcxH00W3z3LdL; Wed, 28 Jul 2021 15:28: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 C18052078B; Wed, 28 Jul 2021 15:28: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 16SFS2iV088192; Wed, 28 Jul 2021 15:28:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16SFS2wZ088191; Wed, 28 Jul 2021 15:28:02 GMT (envelope-from git) Date: Wed, 28 Jul 2021 15:28:02 GMT Message-Id: <202107281528.16SFS2wZ088191@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: ac959cf54421 - main - xen: introduce xen_has_percpu_evtchn() 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: ac959cf54421bc560c93748b227f05f9b6583678 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, 28 Jul 2021 15:28:03 -0000 The branch main has been updated by royger: URL: https://cgit.FreeBSD.org/src/commit/?id=ac959cf54421bc560c93748b227f05f9b6583678 commit ac959cf54421bc560c93748b227f05f9b6583678 Author: Julien Grall AuthorDate: 2015-10-10 19:40:06 +0000 Commit: Roger Pau Monné CommitDate: 2021-07-28 15:27:05 +0000 xen: introduce xen_has_percpu_evtchn() xen_vector_callback_enabled is x86 specific and availability of per-cpu event channel delivery differs on other architectures. Introduce a new helper to check if there's support for per-cpu event channel injection. Submitted by: Elliott Mitchell Reviewed by: royger Differential Revision: https://reviews.freebsd.org/D29402 --- sys/dev/xen/debug/debug.c | 2 +- sys/x86/include/xen/xen-os.h | 7 +++++++ sys/x86/xen/xen_intr.c | 4 ++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/sys/dev/xen/debug/debug.c b/sys/dev/xen/debug/debug.c index 269d46d46afa..ec4585e64c62 100644 --- a/sys/dev/xen/debug/debug.c +++ b/sys/dev/xen/debug/debug.c @@ -97,7 +97,7 @@ xendebug_identify(driver_t *driver, device_t parent) KASSERT(xen_domain(), ("Trying to add Xen debug device to non-xen guest")); - if (xen_hvm_domain() && !xen_vector_callback_enabled) + if (!xen_has_percpu_evtchn()) return; if (BUS_ADD_CHILD(parent, 0, "debug", 0) == NULL) diff --git a/sys/x86/include/xen/xen-os.h b/sys/x86/include/xen/xen-os.h index 5b3b912e0891..9d0964c6631d 100644 --- a/sys/x86/include/xen/xen-os.h +++ b/sys/x86/include/xen/xen-os.h @@ -49,6 +49,13 @@ extern int xen_disable_pv_disks; /* tunable for disabling PV nics */ extern int xen_disable_pv_nics; +static inline bool +xen_has_percpu_evtchn(void) +{ + + return (!xen_hvm_domain() || xen_vector_callback_enabled); +} + static inline bool xen_pv_shutdown_handler(void) { diff --git a/sys/x86/xen/xen_intr.c b/sys/x86/xen/xen_intr.c index bab86ccd295a..a3d84965f0f2 100644 --- a/sys/x86/xen/xen_intr.c +++ b/sys/x86/xen/xen_intr.c @@ -510,7 +510,7 @@ xen_intr_handle_upcall(struct trapframe *trap_frame) s = HYPERVISOR_shared_info; v = DPCPU_GET(vcpu_info); - if (xen_hvm_domain() && !xen_vector_callback_enabled) { + if (!xen_has_percpu_evtchn()) { KASSERT((cpu == 0), ("Fired PCI event callback on wrong CPU")); } @@ -859,7 +859,7 @@ xen_intr_assign_cpu(struct intsrc *base_isrc, u_int apic_id) u_int to_cpu, vcpu_id; int error, masked; - if (xen_vector_callback_enabled == 0) + if (!xen_has_percpu_evtchn()) return (EOPNOTSUPP); to_cpu = apic_cpuid(apic_id); From owner-dev-commits-src-all@freebsd.org Wed Jul 28 15:28: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 332D265D6A5; Wed, 28 Jul 2021 15:28: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 4GZcxF6P9qz3LdH; Wed, 28 Jul 2021 15:28: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 9E260201C6; Wed, 28 Jul 2021 15:28: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 16SFS1aI088160; Wed, 28 Jul 2021 15:28:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16SFS1qh088159; Wed, 28 Jul 2021 15:28:01 GMT (envelope-from git) Date: Wed, 28 Jul 2021 15:28:01 GMT Message-Id: <202107281528.16SFS1qh088159@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: 46c46edd1889 - main - xen/control: print warning on call of xctrl_suspend() 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: 46c46edd18894e75a51b004f1abc1894c78864fe 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, 28 Jul 2021 15:28:03 -0000 The branch main has been updated by royger: URL: https://cgit.FreeBSD.org/src/commit/?id=46c46edd18894e75a51b004f1abc1894c78864fe commit 46c46edd18894e75a51b004f1abc1894c78864fe Author: Julien Grall AuthorDate: 2014-01-14 01:41:15 +0000 Commit: Roger Pau Monné CommitDate: 2021-07-28 15:27:05 +0000 xen/control: print warning on call of xctrl_suspend() Presently suspend/resume and migration aren't supported on Xen/ARM. As such this shouldn't ever occur. This likely applies to future Xen architectures (RISC-V) and xctrl_suspend() needs dependency on intr_machdep.h fixed. Submitted by: Elliott Mitchell Reviewed by: royger Differential Revision: https://reviews.freebsd.org/D29599 --- sys/dev/xen/control/control.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/sys/dev/xen/control/control.c b/sys/dev/xen/control/control.c index f72193edceea..234ebdf530b0 100644 --- a/sys/dev/xen/control/control.c +++ b/sys/dev/xen/control/control.c @@ -130,9 +130,9 @@ __FBSDID("$FreeBSD$"); #include #include +#if defined(__amd64__) || defined(__i386__) #include -#if defined(__amd64__) || defined(__i386__) #include #endif @@ -196,6 +196,13 @@ xctrl_reboot() shutdown_nice(0); } +#if !defined(__amd64__) && !defined(__i386__) +static void +xctrl_suspend() +{ + printf("WARNING: xen/control: Suspend not supported!\n"); +} +#else /* __amd64__ || __i386__ */ static void xctrl_suspend() { @@ -332,6 +339,7 @@ xctrl_suspend() printf("System resumed after suspension\n"); } +#endif /* __amd64__ || __i386__ */ static void xctrl_crash() From owner-dev-commits-src-all@freebsd.org Wed Jul 28 16:24: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 EE50165F104; Wed, 28 Jul 2021 16:24: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 4GZfBD4ZKGz3QR2; Wed, 28 Jul 2021 16:24: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 84B592124A; Wed, 28 Jul 2021 16:24: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 16SGOKnJ067329; Wed, 28 Jul 2021 16:24:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16SGOKM8067328; Wed, 28 Jul 2021 16:24:20 GMT (envelope-from git) Date: Wed, 28 Jul 2021 16:24:20 GMT Message-Id: <202107281624.16SGOKM8067328@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: fed248a6acb3 - main - LinuxKPI: add read_poll_timeout() 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: fed248a6acb33cf6d51880be8d5c774d89e75110 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, 28 Jul 2021 16:24:21 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=fed248a6acb33cf6d51880be8d5c774d89e75110 commit fed248a6acb33cf6d51880be8d5c774d89e75110 Author: Bjoern A. Zeeb AuthorDate: 2021-07-01 13:29:49 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-28 16:21:12 +0000 LinuxKPI: add read_poll_timeout() Add an implementation of read_poll_timeout() and the atomic variant which I did at some point last year for rtw88 and now updated based on feedback. MFC after: 10 days Reviewed by: hsealsky Differential Revision: https://reviews.freebsd.org/D30980 --- sys/compat/linuxkpi/common/include/linux/iopoll.h | 91 +++++++++++++++++++++++ 1 file changed, 91 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/iopoll.h b/sys/compat/linuxkpi/common/include/linux/iopoll.h new file mode 100644 index 000000000000..ea876042eab6 --- /dev/null +++ b/sys/compat/linuxkpi/common/include/linux/iopoll.h @@ -0,0 +1,91 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2020-2021 Bjoern A. Zeeb + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef __LINUXKPI_LINUX_IOPOLL_H +#define __LINUXKPI_LINUX_IOPOLL_H + +#include +#include +#include + +#define read_poll_timeout(_pollfp, _var, _cond, _us, _to, _early_sleep, ...) \ +({ \ + struct timeval __now, __end; \ + if (_to) { \ + __end.tv_sec = (_to) / USEC_PER_SEC; \ + __end.tv_usec = (_to) % USEC_PER_SEC; \ + microtime(&__now); \ + timevaladd(&__end, &__now); \ + } \ + \ + if ((_early_sleep) && (_us) > 0) \ + usleep_range(_us, _us); \ + do { \ + (_var) = _pollfp(__VA_ARGS__); \ + if (_cond) \ + break; \ + if (_to) { \ + microtime(&__now); \ + if (timevalcmp(&__now, &__end, >)) \ + break; \ + } \ + if ((_us) != 0) \ + usleep_range(_us, _us); \ + } while (1); \ + (_cond) ? 0 : (-ETIMEDOUT); \ +}) + +#define read_poll_timeout_atomic(_pollfp, _var, _cond, _us, _to, _early_sleep, ...) \ +({ \ + struct timeval __now, __end; \ + if (_to) { \ + __end.tv_sec = (_to) / USEC_PER_SEC; \ + __end.tv_usec = (_to) % USEC_PER_SEC; \ + microtime(&__now); \ + timevaladd(&__end, &__now); \ + } \ + \ + if ((_early_sleep) && (_us) > 0) \ + DELAY(_us); \ + do { \ + (_var) = _pollfp(__VA_ARGS__); \ + if (_cond) \ + break; \ + if (_to) { \ + microtime(&__now); \ + if (timevalcmp(&__now, &__end, >)) \ + break; \ + } \ + if ((_us) != 0) \ + DELAY(_us); \ + } while (1); \ + (_cond) ? 0 : (-ETIMEDOUT); \ +}) + +#endif /* __LINUXKPI_LINUX_IOPOLL_H */ From owner-dev-commits-src-all@freebsd.org Wed Jul 28 16:27: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 DEE2F65EAD3; Wed, 28 Jul 2021 16:27: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 4GZfFL5V5vz3QdD; Wed, 28 Jul 2021 16:27: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 A469F213A6; Wed, 28 Jul 2021 16:27: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 16SGR2pM067741; Wed, 28 Jul 2021 16:27:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16SGR2cO067740; Wed, 28 Jul 2021 16:27:02 GMT (envelope-from git) Date: Wed, 28 Jul 2021 16:27:02 GMT Message-Id: <202107281627.16SGR2cO067740@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Allan Jude Subject: git: 33ff39796ffe - main - Add zfskeys rc.d script for auto-loading encryption keys MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: allanjude X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 33ff39796ffe469a764e485ac49c31700a51fd6f 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, 28 Jul 2021 16:27:02 -0000 The branch main has been updated by allanjude: URL: https://cgit.FreeBSD.org/src/commit/?id=33ff39796ffe469a764e485ac49c31700a51fd6f commit 33ff39796ffe469a764e485ac49c31700a51fd6f Author: Eirik Øverby AuthorDate: 2021-07-28 16:11:35 +0000 Commit: Allan Jude CommitDate: 2021-07-28 16:26:45 +0000 Add zfskeys rc.d script for auto-loading encryption keys ZFS in 13 supports encryption, but for the use case where keys are available in plaintext on disk there is no mechanism for automatically loading keys on startup. This script will, by default, look for any dataset with encryption and keylocation prefixed with file://. It will attempt to unlock, timing out after 10 seconds for each dataset found. User can optionally specify explicitly which datasets to attempt to unlock. Also supports (optionally by force) unmounting filesystems and unloading associated keys. Sponsored by: Modirum Differential Revision: https://reviews.freebsd.org/D30015 --- libexec/rc/rc.d/zfskeys | 119 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 119 insertions(+) diff --git a/libexec/rc/rc.d/zfskeys b/libexec/rc/rc.d/zfskeys new file mode 100755 index 000000000000..c558eb3af5d7 --- /dev/null +++ b/libexec/rc/rc.d/zfskeys @@ -0,0 +1,119 @@ +#!/bin/sh + +# PROVIDE: zfskeys +# REQUIRE: zpool +# BEFORE: zfs zvol + +. /etc/rc.subr + +name="zfskeys" +desc="Load dataset keys" +rcvar="zfskeys_enable" +extra_commands="status" +start_cmd="load_zfs_keys" +stop_cmd="unload_zfs_keys" +status_cmd="status_zfs_keys" +required_modules="zfs" + +# Note that zfskeys_datasets must have any character found in IFS escaped. +# Forcibly unmounting/unloading only applies to filesystems; ignored for zvols. +: ${zfskeys_datasets:=''} +: ${zfskeys_timeout:=10} +: ${zfskeys_unload_force:='NO'} + +encode_args() +{ + shift && [ $# -gt 0 ] && printf "%s\0" "$@" | b64encode -r - +} + +list_datasets() +{ + if [ "$zfskeys_args" ]; then + echo "$zfskeys_args" | b64decode -r | + xargs -0 zfs get -H -s local -o value,name keylocation + elif [ ! "$zfskeys_datasets" ]; then + zfs get -H -t filesystem,volume -s local -o value,name keylocation + else + echo "$zfskeys_datasets" | xargs -n 1 zfs get -H -s local \ + -o value,name keylocation + fi +} + +unlock_fs() +{ + local fs="$1" + local kl="$2" + local k="${kl##file://}" + + if [ "$k" ] && [ -f "$k" ] && [ -s "$k" ] && [ -r "$k" ]; then + if [ "$(zfs get -Ho value keystatus "$fs")" = 'available' ]; then + echo "Key already loaded for $fs." + elif keytest=$(zfs load-key -n -L "$kl" "$fs" 2>&1); then + echo "Loading key for $fs from $kl.." + if ! keyload=$(timeout $zfskeys_timeout zfs load-key -L "$kl" "$fs" 2>&1) ; then + if [ $? -eq 124 ]; then + echo "Timed out loading key from $kl for $fs" + else + echo "Failed to load key from $kl for $fs:" + echo "$keyload" + fi + fi + else + echo "Could not verify key from $kl for $fs:" + echo "$keytest" + fi + else + echo "Key file $k not found, empty or unreadable. Skipping $fs.." + fi +} + +lock_fs() +{ + local fs=$1 + + if [ "$(zfs get -Ho value mounted "$fs")" = 'yes' ]; then + if checkyesno zfskeys_unload_force ; then + zfs unmount -f "$fs" && echo "Forcibly unmounted $fs." + else + zfs unmount "$fs" && echo "Unmounted $fs." + fi + fi + if [ "$?" -ne 0 ]; then + echo "Unmount failed for $fs" + elif [ "$(zfs get -Ho value keystatus "$fs")" = 'available' ]; then + zfs unload-key "$fs" && echo "Unloaded key for $fs." + else + echo "No key loaded for $fs." + fi +} + +status_zfs_keys() +{ + local IFS=$(printf "\t") + + list_datasets | while read kl fs ; do + echo "$fs: $(zfs get -Ho value keystatus "$fs")" + done +} + +load_zfs_keys() +{ + local IFS=$(printf "\t") + + list_datasets | while read kl fs ; do + unlock_fs "$fs" "$kl" + done +} + +unload_zfs_keys() +{ + local IFS=$(printf "\t") + + list_datasets | while read kl fs ; do + lock_fs "$fs" + done +} + +zfskeys_args=$(encode_args "$@") +load_rc_config $name +run_rc_command "$1" From owner-dev-commits-src-all@freebsd.org Wed Jul 28 16:35: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 4709E65F178; Wed, 28 Jul 2021 16:35: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 4GZfQs1Wwxz3R9B; Wed, 28 Jul 2021 16:35: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 1C7C5213E4; Wed, 28 Jul 2021 16:35: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 16SGZHFj081513; Wed, 28 Jul 2021 16:35:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16SGZHdx081512; Wed, 28 Jul 2021 16:35:17 GMT (envelope-from git) Date: Wed, 28 Jul 2021 16:35:17 GMT Message-Id: <202107281635.16SGZHdx081512@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: 7045b1603bdf - main - socket: Implement SO_RERROR 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/main X-Git-Reftype: branch X-Git-Commit: 7045b1603bdf054145dd958a4acc17b410fb62a0 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, 28 Jul 2021 16:35:17 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=7045b1603bdf054145dd958a4acc17b410fb62a0 commit 7045b1603bdf054145dd958a4acc17b410fb62a0 Author: Roy Marples AuthorDate: 2021-07-28 15:46:59 +0000 Commit: Kevin Bowling CommitDate: 2021-07-28 16:35:09 +0000 socket: Implement SO_RERROR SO_RERROR indicates that receive buffer overflows should be handled as errors. Historically receive buffer overflows have been ignored and programs could not tell if they missed messages or messages had been truncated because of overflows. Since programs historically do not expect to get receive overflow errors, this behavior is not the default. This is really really important for programs that use route(4) to keep in sync with the system. If we loose a message then we need to reload the full system state, otherwise the behaviour from that point is undefined and can lead to chasing bogus bug reports. Reviewed by: philip (network), kbowling (transport), gbe (manpages) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D26652 --- lib/libc/sys/getsockopt.2 | 10 +++++++- sbin/route/route.c | 13 +++++++++- sys/kern/uipc_sockbuf.c | 24 +++++++++++++++++ sys/kern/uipc_socket.c | 30 ++++++++++++++++------ sys/kern/uipc_usrreq.c | 2 +- sys/net/raw_usrreq.c | 11 ++++---- .../bluetooth/socket/ng_btsocket_hci_raw.c | 1 + sys/netgraph/ng_socket.c | 2 +- sys/netinet/ip_divert.c | 2 +- sys/netinet/ip_mroute.c | 2 +- sys/netinet/raw_ip.c | 3 +-- sys/netinet/udp_usrreq.c | 2 +- sys/netinet6/icmp6.c | 6 ++--- sys/netinet6/ip6_input.c | 1 + sys/netinet6/ip6_mroute.c | 3 ++- sys/netinet6/raw_ip6.c | 2 ++ sys/netinet6/send.c | 2 +- sys/netinet6/udp6_usrreq.c | 2 +- sys/netipsec/keysock.c | 10 ++++---- sys/sys/socket.h | 1 + sys/sys/socketvar.h | 6 ++++- 21 files changed, 100 insertions(+), 35 deletions(-) diff --git a/lib/libc/sys/getsockopt.2 b/lib/libc/sys/getsockopt.2 index 1e4ed6827170..3ff971a0e5db 100644 --- a/lib/libc/sys/getsockopt.2 +++ b/lib/libc/sys/getsockopt.2 @@ -28,7 +28,7 @@ .\" @(#)getsockopt.2 8.4 (Berkeley) 5/2/95 .\" $FreeBSD$ .\" -.Dd June 3, 2020 +.Dd February 8, 2021 .Dt GETSOCKOPT 2 .Os .Sh NAME @@ -177,6 +177,7 @@ for the socket .It Dv SO_PROTOCOL Ta "get the protocol number for the socket (get only)" .It Dv SO_PROTOTYPE Ta "SunOS alias for the Linux SO_PROTOCOL (get only)" .It Dv SO_ERROR Ta "get and clear error on the socket (get only)" +.It Dv SO_RERROR Ta "enables receive error reporting" .It Dv SO_SETFIB Ta "set the associated FIB (routing table) for the socket (set only)" .El .Pp @@ -514,6 +515,13 @@ returns any pending error on the socket and clears the error status. It may be used to check for asynchronous errors on connected datagram sockets or for other asynchronous errors. +.Dv SO_RERROR +indicates that receive buffer overflows should be handled as errors. +Historically receive buffer overflows have been ignored and programs +could not tell if they missed messages or messages had been truncated +because of overflows. +Since programs historically do not expect to get receive overflow errors, +this behavior is not the default. .Pp .Dv SO_LABEL returns the MAC label of the socket. diff --git a/sbin/route/route.c b/sbin/route/route.c index 51a0c68746a6..b16fb6d17a08 100644 --- a/sbin/route/route.c +++ b/sbin/route/route.c @@ -1444,9 +1444,20 @@ monitor(int argc, char *argv[]) interfaces(); exit(0); } + +#ifdef SO_RERROR + n = 1; + if (setsockopt(s, SOL_SOCKET, SO_RERROR, &n, sizeof(n)) == -1) + warn("SO_RERROR"); +#endif + for (;;) { time_t now; - n = read(s, msg, 2048); + n = read(s, msg, sizeof(msg)); + if (n == -1) { + warn("read"); + continue; + } now = time(NULL); (void)printf("\ngot message of size %d on %s", n, ctime(&now)); print_rtmsg((struct rt_msghdr *)(void *)msg, n); diff --git a/sys/kern/uipc_sockbuf.c b/sys/kern/uipc_sockbuf.c index 2c0e10ee1dc2..b2202fe15192 100644 --- a/sys/kern/uipc_sockbuf.c +++ b/sys/kern/uipc_sockbuf.c @@ -436,6 +436,30 @@ socantrcvmore(struct socket *so) mtx_assert(SOCKBUF_MTX(&so->so_rcv), MA_NOTOWNED); } +void +soroverflow_locked(struct socket *so) +{ + + SOCKBUF_LOCK_ASSERT(&so->so_rcv); + + if (so->so_options & SO_RERROR) { + so->so_rerror = ENOBUFS; + sorwakeup_locked(so); + } else + SOCKBUF_UNLOCK(&so->so_rcv); + + mtx_assert(SOCKBUF_MTX(&so->so_rcv), MA_NOTOWNED); +} + +void +soroverflow(struct socket *so) +{ + + SOCKBUF_LOCK(&so->so_rcv); + soroverflow_locked(so); + mtx_assert(SOCKBUF_MTX(&so->so_rcv), MA_NOTOWNED); +} + /* * Wait for data to arrive at/drain from a socket buffer. */ diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index ee3374137acd..602d6c8b4216 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -1952,12 +1952,19 @@ restart: KASSERT(m != NULL || !sbavail(&so->so_rcv), ("receive: m == %p sbavail == %u", m, sbavail(&so->so_rcv))); - if (so->so_error) { + if (so->so_error || so->so_rerror) { if (m != NULL) goto dontblock; - error = so->so_error; - if ((flags & MSG_PEEK) == 0) - so->so_error = 0; + if (so->so_error) + error = so->so_error; + else + error = so->so_rerror; + if ((flags & MSG_PEEK) == 0) { + if (so->so_error) + so->so_error = 0; + else + so->so_rerror = 0; + } SOCKBUF_UNLOCK(&so->so_rcv); goto release; } @@ -2302,7 +2309,7 @@ dontblock: while (flags & MSG_WAITALL && m == NULL && uio->uio_resid > 0 && !sosendallatonce(so) && nextrecord == NULL) { SOCKBUF_LOCK_ASSERT(&so->so_rcv); - if (so->so_error || + if (so->so_error || so->so_rerror || so->so_rcv.sb_state & SBS_CANTRCVMORE) break; /* @@ -3043,6 +3050,7 @@ sosetopt(struct socket *so, struct sockopt *sopt) case SO_NOSIGPIPE: case SO_NO_DDP: case SO_NO_OFFLOAD: + case SO_RERROR: error = sooptcopyin(sopt, &optval, sizeof optval, sizeof optval); if (error) @@ -3264,6 +3272,7 @@ sogetopt(struct socket *so, struct sockopt *sopt) case SO_NOSIGPIPE: case SO_NO_DDP: case SO_NO_OFFLOAD: + case SO_RERROR: optval = so->so_options & sopt->sopt_name; integer: error = sooptcopyout(sopt, &optval, sizeof optval); @@ -3283,8 +3292,13 @@ integer: case SO_ERROR: SOCK_LOCK(so); - optval = so->so_error; - so->so_error = 0; + if (so->so_error) { + optval = so->so_error; + so->so_error = 0; + } else { + optval = so->so_rerror; + so->so_rerror = 0; + } SOCK_UNLOCK(so); goto integer; @@ -3839,7 +3853,7 @@ filt_soread(struct knote *kn, long hint) kn->kn_flags |= EV_EOF; kn->kn_fflags = so->so_error; return (1); - } else if (so->so_error) /* temporary udp error */ + } else if (so->so_error || so->so_rerror) return (1); if (kn->kn_sfflags & NOTE_LOWAT) { diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c index eada98b48a1e..c736f35b5ee0 100644 --- a/sys/kern/uipc_usrreq.c +++ b/sys/kern/uipc_usrreq.c @@ -1060,7 +1060,7 @@ uipc_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *nam, m = NULL; control = NULL; } else { - SOCKBUF_UNLOCK(&so2->so_rcv); + soroverflow_locked(so2); error = ENOBUFS; } if (nam != NULL) diff --git a/sys/net/raw_usrreq.c b/sys/net/raw_usrreq.c index f43de7dae9ca..5d4e223e5a0a 100644 --- a/sys/net/raw_usrreq.c +++ b/sys/net/raw_usrreq.c @@ -100,10 +100,10 @@ raw_input_ext(struct mbuf *m0, struct sockproto *proto, struct sockaddr *src, n = m_copym(m, 0, M_COPYALL, M_NOWAIT); if (n) { if (sbappendaddr(&last->so_rcv, src, - n, (struct mbuf *)0) == 0) - /* should notify about lost packet */ + n, (struct mbuf *)0) == 0) { + soroverflow(last); m_freem(n); - else + } else sorwakeup(last); } } @@ -111,9 +111,10 @@ raw_input_ext(struct mbuf *m0, struct sockproto *proto, struct sockaddr *src, } if (last) { if (sbappendaddr(&last->so_rcv, src, - m, (struct mbuf *)0) == 0) + m, (struct mbuf *)0) == 0) { + soroverflow(last); m_freem(m); - else + } else sorwakeup(last); } else m_freem(m); diff --git a/sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.c b/sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.c index 5f6b98d03359..c82515f82631 100644 --- a/sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.c +++ b/sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.c @@ -539,6 +539,7 @@ ng_btsocket_hci_raw_data_input(struct mbuf *nam) NG_FREE_M(m); NG_FREE_M(ctl); + soroverflow(pcb->so); } } next: diff --git a/sys/netgraph/ng_socket.c b/sys/netgraph/ng_socket.c index 1c67099a4dc4..05f37579aba1 100644 --- a/sys/netgraph/ng_socket.c +++ b/sys/netgraph/ng_socket.c @@ -993,7 +993,7 @@ ngs_rcvmsg(node_p node, item_p item, hook_p lasthook) /* Send it up to the socket. */ if (sbappendaddr_locked(&so->so_rcv, (struct sockaddr *)&addr, m, NULL) == 0) { - SOCKBUF_UNLOCK(&so->so_rcv); + soroverflow_locked(so); TRAP_ERROR; m_freem(m); return (ENOBUFS); diff --git a/sys/netinet/ip_divert.c b/sys/netinet/ip_divert.c index 77a4bfcd08ac..4141386a6a2d 100644 --- a/sys/netinet/ip_divert.c +++ b/sys/netinet/ip_divert.c @@ -295,7 +295,7 @@ divert_packet(struct mbuf *m, bool incoming) if (sbappendaddr_locked(&sa->so_rcv, (struct sockaddr *)&divsrc, m, (struct mbuf *)0) == 0) { - SOCKBUF_UNLOCK(&sa->so_rcv); + soroverflow_locked(sa); sa = NULL; /* force mbuf reclaim below */ } else sorwakeup_locked(sa); diff --git a/sys/netinet/ip_mroute.c b/sys/netinet/ip_mroute.c index 72100b84fd59..b614f74cf7d3 100644 --- a/sys/netinet/ip_mroute.c +++ b/sys/netinet/ip_mroute.c @@ -1257,7 +1257,7 @@ socket_send(struct socket *s, struct mbuf *mm, struct sockaddr_in *src) sorwakeup_locked(s); return 0; } - SOCKBUF_UNLOCK(&s->so_rcv); + soroverflow_locked(s); } m_freem(mm); return -1; diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c index 996440227145..afbdc14e47c4 100644 --- a/sys/netinet/raw_ip.c +++ b/sys/netinet/raw_ip.c @@ -263,11 +263,10 @@ rip_append(struct inpcb *last, struct ip *ip, struct mbuf *n, SOCKBUF_LOCK(&so->so_rcv); if (sbappendaddr_locked(&so->so_rcv, (struct sockaddr *)ripsrc, n, opts) == 0) { - /* should notify about lost packet */ + soroverflow_locked(so); m_freem(n); if (opts) m_freem(opts); - SOCKBUF_UNLOCK(&so->so_rcv); } else sorwakeup_locked(so); } else diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c index 5c9dbd36a1d6..ed79ddce5109 100644 --- a/sys/netinet/udp_usrreq.c +++ b/sys/netinet/udp_usrreq.c @@ -379,7 +379,7 @@ udp_append(struct inpcb *inp, struct ip *ip, struct mbuf *n, int off, so = inp->inp_socket; SOCKBUF_LOCK(&so->so_rcv); if (sbappendaddr_locked(&so->so_rcv, append_sa, n, opts) == 0) { - SOCKBUF_UNLOCK(&so->so_rcv); + soroverflow(so); m_freem(n); if (opts) m_freem(opts); diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c index e17f82a54951..6b8f0f7be5bb 100644 --- a/sys/netinet6/icmp6.c +++ b/sys/netinet6/icmp6.c @@ -1974,13 +1974,11 @@ icmp6_rip6_input(struct mbuf **mp, int off) &last->inp_socket->so_rcv, (struct sockaddr *)&fromsa, n, opts) == 0) { - /* should notify about lost packet */ + soroverflow_locked(last->inp_socket); m_freem(n); if (opts) { m_freem(opts); } - SOCKBUF_UNLOCK( - &last->inp_socket->so_rcv); } else sorwakeup_locked(last->inp_socket); opts = NULL; @@ -2020,7 +2018,7 @@ icmp6_rip6_input(struct mbuf **mp, int off) m_freem(m); if (opts) m_freem(opts); - SOCKBUF_UNLOCK(&last->inp_socket->so_rcv); + soroverflow_locked(last->inp_socket); } else sorwakeup_locked(last->inp_socket); INP_RUNLOCK(last); diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c index 9ea578f88417..30ad9a53006a 100644 --- a/sys/netinet6/ip6_input.c +++ b/sys/netinet6/ip6_input.c @@ -1575,6 +1575,7 @@ ip6_notify_pmtu(struct inpcb *inp, struct sockaddr_in6 *dst, u_int32_t mtu) so = inp->inp_socket; if (sbappendaddr(&so->so_rcv, (struct sockaddr *)dst, NULL, m_mtu) == 0) { + soroverflow(so); m_freem(m_mtu); /* XXX: should count statistics */ } else diff --git a/sys/netinet6/ip6_mroute.c b/sys/netinet6/ip6_mroute.c index d2277e41110c..503c83490940 100644 --- a/sys/netinet6/ip6_mroute.c +++ b/sys/netinet6/ip6_mroute.c @@ -1038,7 +1038,8 @@ socket_send(struct socket *s, struct mbuf *mm, struct sockaddr_in6 *src) mm, (struct mbuf *)0) != 0) { sorwakeup(s); return (0); - } + } else + soroverflow(s); } m_freem(mm); return (-1); diff --git a/sys/netinet6/raw_ip6.c b/sys/netinet6/raw_ip6.c index ad64429b5890..aaba91c6d5e7 100644 --- a/sys/netinet6/raw_ip6.c +++ b/sys/netinet6/raw_ip6.c @@ -214,6 +214,7 @@ rip6_input(struct mbuf **mp, int *offp, int proto) if (sbappendaddr(&last->inp_socket->so_rcv, (struct sockaddr *)&fromsa, n, opts) == 0) { + soroverflow(last->inp_socket); m_freem(n); if (opts) m_freem(opts); @@ -325,6 +326,7 @@ skip_2: m_adj(m, *offp); if (sbappendaddr(&last->inp_socket->so_rcv, (struct sockaddr *)&fromsa, m, opts) == 0) { + soroverflow(last->inp_socket); m_freem(m); if (opts) m_freem(opts); diff --git a/sys/netinet6/send.c b/sys/netinet6/send.c index 677a83ab94cc..736039c695af 100644 --- a/sys/netinet6/send.c +++ b/sys/netinet6/send.c @@ -307,7 +307,7 @@ send_input(struct mbuf *m, struct ifnet *ifp, int direction, int msglen __unused SOCKBUF_LOCK(&V_send_so->so_rcv); if (sbappendaddr_locked(&V_send_so->so_rcv, (struct sockaddr *)&sendsrc, m, NULL) == 0) { - SOCKBUF_UNLOCK(&V_send_so->so_rcv); + soroverflow_locked(V_send_so); /* XXX stats. */ m_freem(m); } else { diff --git a/sys/netinet6/udp6_usrreq.c b/sys/netinet6/udp6_usrreq.c index 5841988f6113..6ee2abc4ea1b 100644 --- a/sys/netinet6/udp6_usrreq.c +++ b/sys/netinet6/udp6_usrreq.c @@ -197,7 +197,7 @@ udp6_append(struct inpcb *inp, struct mbuf *n, int off, SOCKBUF_LOCK(&so->so_rcv); if (sbappendaddr_locked(&so->so_rcv, (struct sockaddr *)&fromsa[0], n, opts) == 0) { - SOCKBUF_UNLOCK(&so->so_rcv); + soroverflow_locked(so); m_freem(n); if (opts) m_freem(opts); diff --git a/sys/netipsec/keysock.c b/sys/netipsec/keysock.c index 317eb53289cf..aa893b131a57 100644 --- a/sys/netipsec/keysock.c +++ b/sys/netipsec/keysock.c @@ -141,7 +141,6 @@ end: static int key_sendup0(struct rawcb *rp, struct mbuf *m, int promisc) { - int error; if (promisc) { struct sadb_msg *pmsg; @@ -165,11 +164,12 @@ key_sendup0(struct rawcb *rp, struct mbuf *m, int promisc) m, NULL)) { PFKEYSTAT_INC(in_nomem); m_freem(m); - error = ENOBUFS; - } else - error = 0; + soroverflow(rp->rcb_socket); + return ENOBUFS; + } + sorwakeup(rp->rcb_socket); - return error; + return 0; } /* so can be NULL if target != KEY_SENDUP_ONE */ diff --git a/sys/sys/socket.h b/sys/sys/socket.h index d9256fd7544a..2cb76f9c6d63 100644 --- a/sys/sys/socket.h +++ b/sys/sys/socket.h @@ -147,6 +147,7 @@ typedef __uintptr_t uintptr_t; #define SO_NO_OFFLOAD 0x00004000 /* socket cannot be offloaded */ #define SO_NO_DDP 0x00008000 /* disable direct data placement */ #define SO_REUSEPORT_LB 0x00010000 /* reuse with load balancing */ +#define SO_RERROR 0x00020000 /* keep track of receive errors */ /* * Additional options, not kept in so_options. diff --git a/sys/sys/socketvar.h b/sys/sys/socketvar.h index dbd9804a980d..47033fdabbfa 100644 --- a/sys/sys/socketvar.h +++ b/sys/sys/socketvar.h @@ -100,6 +100,7 @@ struct socket { struct protosw *so_proto; /* (a) protocol handle */ short so_timeo; /* (g) connection timeout */ u_short so_error; /* (f) error affecting connection */ + u_short so_rerror; /* (f) error affecting connection */ struct sigio *so_sigio; /* [sg] information for async I/O or out of band data (SIGURG) */ struct ucred *so_cred; /* (a) user credentials */ @@ -266,7 +267,8 @@ struct socket { /* can we read something from so? */ #define soreadabledata(so) \ - (sbavail(&(so)->so_rcv) >= (so)->so_rcv.sb_lowat || (so)->so_error) + (sbavail(&(so)->so_rcv) >= (so)->so_rcv.sb_lowat || \ + (so)->so_error || (so)->so_rerror) #define soreadable(so) \ (soreadabledata(so) || ((so)->so_rcv.sb_state & SBS_CANTRCVMORE)) @@ -480,6 +482,8 @@ void socantrcvmore(struct socket *so); void socantrcvmore_locked(struct socket *so); void socantsendmore(struct socket *so); void socantsendmore_locked(struct socket *so); +void soroverflow(struct socket *so); +void soroverflow_locked(struct socket *so); /* * Accept filter functions (duh). From owner-dev-commits-src-all@freebsd.org Wed Jul 28 16:37: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 1137165F598 for ; Wed, 28 Jul 2021 16:37:27 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qt1-x82d.google.com (mail-qt1-x82d.google.com [IPv6:2607:f8b0:4864:20::82d]) (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 4GZfTL6r4pz3R11 for ; Wed, 28 Jul 2021 16:37:26 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-qt1-x82d.google.com with SMTP id h10so1785764qth.5 for ; Wed, 28 Jul 2021 09:37:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=kuzIqyzHrMJhalv53ocYPw4ZLYICaIWBfe2tcLntNbg=; b=L8LZ56NDeaDS4ECRIKEtIarUanJmEIPL6HFje178y5oTn9ONtEPndVCkgEKkYn1HjC mpyGH98KgVHbxYzvbh8+uCy7pnmpGlRnTnFYfDiRlEmbMzf1zeHlt15VHiKhwSOnQyt4 uyFgYudbwxpSJ8IMjvGv+QtyCNEap4N9Y874bpfgzluW2E9tlZ8Cczo3KWmos51Zx2U8 BPi11A/HJOXz3I+8cvbFCeYa38HpXunO0AjFkqQblDqM0SW8r5wEU6Ans9k4rx3S7CLz h5XVZ39f7X0Lynowiy7H1WATNB8tC8xbquZCe0FGUCjvnd5EeMqaCLzf2b7vAqIZyRSZ incg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=kuzIqyzHrMJhalv53ocYPw4ZLYICaIWBfe2tcLntNbg=; b=lMTYXCBKdy3AmJPbkKRhqfi/JXrI/UX5MRfJ7x7gEujRMGzFCbsW2Mv2h4NhptCpEM PcMorLW/ntVMGyaUwDc8hvsb66BuEKVtn0XhSc2zQ5eeNSvavyg48AGFTFsXMr4ijMRi RmWoBHM1HPilGiC/4OE08dcTmwwpGBGLz9+jDCNlLHxx9fkPBxoz+FLDEp60Y/QRXzsc PSR2xxh6S5hxwu/FIeZhWHodGs/I4rnR+ybYqCbiGLCqhMEWG2uNWasZE+PoPk1xZ8Gg x/lrPQoAUHyEjb4jcEhvptoXnAM2Cb0H6R6fG30BNN/r6sTZFB+lwt3lGGzuHiuW9/sb NStg== X-Gm-Message-State: AOAM530CWIAyk8FzibL0AKOBFS+mkNIrx1VuM2LCiosL0Qup42xiAaQy ysN+fJhp++sJLZbAXs16fAsmDQ== X-Google-Smtp-Source: ABdhPJwUk3SA08SuWTVzs2kC9wuROgDuP/uXVp0ucwIeZK1lJgjGWLvq5lFg+FMO46awJbgxKkoJ0w== X-Received: by 2002:a05:622a:1805:: with SMTP id t5mr395845qtc.340.1627490246400; Wed, 28 Jul 2021 09:37:26 -0700 (PDT) Received: from mutt-hbsd (pool-100-16-224-136.bltmmd.fios.verizon.net. [100.16.224.136]) by smtp.gmail.com with ESMTPSA id f10sm158344qto.31.2021.07.28.09.37.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Jul 2021 09:37:25 -0700 (PDT) Date: Wed, 28 Jul 2021 12:37:25 -0400 From: Shawn Webb To: Kevin Bowling Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 7045b1603bdf - main - socket: Implement SO_RERROR Message-ID: <20210728163725.6qzqbvwynoeua2jo@mutt-hbsd> X-Operating-System: FreeBSD mutt-hbsd 14.0-CURRENT-HBSD FreeBSD 14.0-CURRENT-HBSD X-PGP-Key: https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/blob/master/Shawn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc References: <202107281635.16SGZHdx081512@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="inqfsygufoaszgwn" Content-Disposition: inline In-Reply-To: <202107281635.16SGZHdx081512@gitrepo.freebsd.org> X-Rspamd-Queue-Id: 4GZfTL6r4pz3R11 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, 28 Jul 2021 16:37:27 -0000 --inqfsygufoaszgwn Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jul 28, 2021 at 04:35:17PM +0000, Kevin Bowling wrote: > The branch main has been updated by kbowling (ports committer): >=20 > URL: https://cgit.FreeBSD.org/src/commit/?id=3D7045b1603bdf054145dd958a4a= cc17b410fb62a0 >=20 > commit 7045b1603bdf054145dd958a4acc17b410fb62a0 > Author: Roy Marples > AuthorDate: 2021-07-28 15:46:59 +0000 > Commit: Kevin Bowling > CommitDate: 2021-07-28 16:35:09 +0000 >=20 > socket: Implement SO_RERROR > =20 > SO_RERROR indicates that receive buffer overflows should be handled as > errors. Historically receive buffer overflows have been ignored and > programs could not tell if they missed messages or messages had been > truncated because of overflows. Since programs historically do not > expect to get receive overflow errors, this behavior is not the > default. > =20 > This is really really important for programs that use route(4) to keep > in sync with the system. If we loose a message then we need to reload > the full system state, otherwise the behaviour from that point is > undefined and can lead to chasing bogus bug reports. > =20 > Reviewed by: philip (network), kbowling (transport), gbe (manpages) > MFC after: 2 weeks > Differential Revision: https://reviews.freebsd.org/D26652 > --- > lib/libc/sys/getsockopt.2 | 10 +++++++- > sbin/route/route.c | 13 +++++++++- > sys/kern/uipc_sockbuf.c | 24 +++++++++++++++++ > sys/kern/uipc_socket.c | 30 ++++++++++++++++= ------ > sys/kern/uipc_usrreq.c | 2 +- > sys/net/raw_usrreq.c | 11 ++++---- > .../bluetooth/socket/ng_btsocket_hci_raw.c | 1 + > sys/netgraph/ng_socket.c | 2 +- > sys/netinet/ip_divert.c | 2 +- > sys/netinet/ip_mroute.c | 2 +- > sys/netinet/raw_ip.c | 3 +-- > sys/netinet/udp_usrreq.c | 2 +- > sys/netinet6/icmp6.c | 6 ++--- > sys/netinet6/ip6_input.c | 1 + > sys/netinet6/ip6_mroute.c | 3 ++- > sys/netinet6/raw_ip6.c | 2 ++ > sys/netinet6/send.c | 2 +- > sys/netinet6/udp6_usrreq.c | 2 +- > sys/netipsec/keysock.c | 10 ++++---- > sys/sys/socket.h | 1 + > sys/sys/socketvar.h | 6 ++++- > 21 files changed, 100 insertions(+), 35 deletions(-) Hey Kevin, Would this commit be a good candidate for bumping __FreeBSD_version? Thanks, --=20 Shawn Webb Cofounder / Security Engineer HardenedBSD https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/raw/master/Shawn_Webb/03A= 4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc --inqfsygufoaszgwn Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAmEBh8IACgkQ/y5nonf4 4fqpvw//eEP0BDGwrWTi2EsPmYDFiffnKkMiKBn30pXgOsyLyFdu1fUkiLQ8BH7n 3P0hNidpIGparuBwdgf34S2tOuz9ZW6iMmvc/RXq3D/lfl9t7wLowfZkAhzXq1zu lt4uxt7jM82LuZ+n1401eHKlnszVHO0bXJ7DMmc8xa8TFy9caAevvWoszCIYxayX LJZ10C4fws56DchCFZyJ8cG3iPwsDuqvLsSIIxhzHtxNKaALPzg/0HwlfRn7xOGN wuj+w2O1CUos/t7Z5732PbsNvYWr6955+msm14CbW5hfzcDGlMt4H7Zf0bpoQTwZ BJlnu3nwgUwvJ4yiLUq/fYnkajqcgRG844vuU0Gdpn5wo38BU3kGNCBpT/z0FlPW nxox1+LKDeMqi7Eh9lxzy6rUeiivsCL9K/4/yyzp2B2RM8E/7fr0uv3wX1MmLe/i YgRglWUmCDEs6XHuUh5YesDyBwpxoZxNcqsRMN5QIEAcyCe+O4eNsLaOuz9CFLvB o8ZjW18twwX70EQF0fNm2tygseQftELJBalAFhg5lTpniunRj5LbWFMgFivvXsAt UHHeS9X1fX8mvCP0XsFKfE53TzymwE+lmCvmF6g2Epeyc0LCkHmIeh2u5iIGICIU lB1czd85/Xp5X7nVDdsbMaW6ltpmLNm8vbwXLuhfpErA1ORDWzU= =EiqY -----END PGP SIGNATURE----- --inqfsygufoaszgwn-- From owner-dev-commits-src-all@freebsd.org Wed Jul 28 17:10: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 A2B39660CE7; Wed, 28 Jul 2021 17:10: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 4GZgCy3rs8z3jQn; Wed, 28 Jul 2021 17:10: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 6CE3221AEE; Wed, 28 Jul 2021 17:10: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 16SHAs7w031617; Wed, 28 Jul 2021 17:10:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16SHAsLc031616; Wed, 28 Jul 2021 17:10:54 GMT (envelope-from git) Date: Wed, 28 Jul 2021 17:10:54 GMT Message-Id: <202107281710.16SHAsLc031616@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Leandro Lupori Subject: git: 7844e5a4fc0a - main - powerpc: change mfpvr return type to uint32_t MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: luporl X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7844e5a4fc0a925a53a7e1969d12a84d1baa970f 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, 28 Jul 2021 17:10:54 -0000 The branch main has been updated by luporl: URL: https://cgit.FreeBSD.org/src/commit/?id=7844e5a4fc0a925a53a7e1969d12a84d1baa970f commit 7844e5a4fc0a925a53a7e1969d12a84d1baa970f Author: Leandro Lupori AuthorDate: 2021-07-28 17:03:53 +0000 Commit: Leandro Lupori CommitDate: 2021-07-28 17:08:19 +0000 powerpc: change mfpvr return type to uint32_t As the Processor Version Register (PVR) is a 32-bit PowerPC register, change mfpvr() return type to match it and avoid type casts on its callers. Suggested by: jhibbits Reviewed by: jhibbits, imp Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br) Differential Revision: https://reviews.freebsd.org/D31332 --- sys/dev/hwpmc/hwpmc_powerpc.c | 2 +- sys/powerpc/include/cpufunc.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/dev/hwpmc/hwpmc_powerpc.c b/sys/dev/hwpmc/hwpmc_powerpc.c index 407af94a07e1..0f14f93e6415 100644 --- a/sys/dev/hwpmc/hwpmc_powerpc.c +++ b/sys/dev/hwpmc/hwpmc_powerpc.c @@ -604,7 +604,7 @@ pmc_md_initialize() } /* Set the value for kern.hwpmc.cpuid */ - snprintf(pmc_cpuid, sizeof(pmc_cpuid), "%08jx", (uintmax_t)mfpvr()); + snprintf(pmc_cpuid, sizeof(pmc_cpuid), "%08x", mfpvr()); return (pmc_mdep); } diff --git a/sys/powerpc/include/cpufunc.h b/sys/powerpc/include/cpufunc.h index 7b0039166436..5ae2345bd717 100644 --- a/sys/powerpc/include/cpufunc.h +++ b/sys/powerpc/include/cpufunc.h @@ -125,10 +125,10 @@ mfdec(void) return (value); } -static __inline register_t +static __inline uint32_t mfpvr(void) { - register_t value; + uint32_t value; __asm __volatile ("mfpvr %0" : "=r"(value)); From owner-dev-commits-src-all@freebsd.org Wed Jul 28 18:27: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 BDB6B662B30 for ; Wed, 28 Jul 2021 18:27:34 +0000 (UTC) (envelope-from kevin.bowling@kev009.com) Received: from mail-yb1-xb2d.google.com (mail-yb1-xb2d.google.com [IPv6:2607:f8b0:4864:20::b2d]) (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 4GZhwQ4l01z4mL5 for ; Wed, 28 Jul 2021 18:27:34 +0000 (UTC) (envelope-from kevin.bowling@kev009.com) Received: by mail-yb1-xb2d.google.com with SMTP id p145so4470496ybg.6 for ; Wed, 28 Jul 2021 11:27:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kev009.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=O+Qa+2XLiDDQjFpXiOg7JEy/+ljXZECiS64vXfuAYAc=; b=nMADxTWp/YFZ00+YZ0SLo5BokpeRpkgzNm5uEnKp3o4aw8NPsR8Qd0ywO0DdrXxp0j 5s6z4uMVKN3UsTsJltu/FzHiefSJsjGcE+vhXIeDOwGr1aUJ+xQfRAxZAL+OUdVEysqe tH8ovWJhtkiEJQ5d2YxzY4QaFk+dtBQfNgIMU= 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=O+Qa+2XLiDDQjFpXiOg7JEy/+ljXZECiS64vXfuAYAc=; b=npAbMb432jt/JnJTFPBdkUUXD/uUEvqls+y8kSoq5Nc5h0sVHKk6Nh/HrFTzFHlGzY 7zGhYiOQAo910V4/cNlfPyhhsr76nkpLGeqPAuNi2X7KhlXwJlWKuh7MC30lY2jVxgbs w7Wc8pZJ2WuHwME9szG/VKFZEYE7Xho7jD4VBV/L631+4oyT8iG6pzW2V9kPSiZNbmGw zdekPWI19NyHzxVVCYd7ZSXj5nf3ajiCJkUwVBT3XFcJmd6qYVUpFufIzGOnRRRQ83nK DpgL7S5jAL/MZmrPifrCDCopUdBJ2FK35ZNPiNc9BMeHnzO26hau4fVTLYxI1RxEfBOK vGCw== X-Gm-Message-State: AOAM533s91CMBXFo+RA32B7as266J4Hq1JI51wxMhb3ciBY00GjzbUbm uQP67N0cOSZXJdydJsqknCudI6mF2mMZ9VpC9392zQ== X-Google-Smtp-Source: ABdhPJxVMYUO/fyB/U3NsCPyTRbp+GEB+E+O+2qA02u6hbBO5PRt3zO9OsWSw3JLvTegkODkNu4mM4fzeakhOsFhPE0= X-Received: by 2002:a25:18a:: with SMTP id 132mr1373733ybb.123.1627496848360; Wed, 28 Jul 2021 11:27:28 -0700 (PDT) MIME-Version: 1.0 References: <202107281635.16SGZHdx081512@gitrepo.freebsd.org> <20210728163725.6qzqbvwynoeua2jo@mutt-hbsd> In-Reply-To: <20210728163725.6qzqbvwynoeua2jo@mutt-hbsd> From: Kevin Bowling Date: Wed, 28 Jul 2021 11:27:17 -0700 Message-ID: Subject: Re: git: 7045b1603bdf - main - socket: Implement SO_RERROR To: Shawn Webb Cc: Kevin Bowling , src-committers , "" , "dev-commits-src-main@FreeBSD.org" Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4GZhwQ4l01z4mL5 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, 28 Jul 2021 18:27:34 -0000 On Wed, Jul 28, 2021 at 9:37 AM Shawn Webb wrote: > > On Wed, Jul 28, 2021 at 04:35:17PM +0000, Kevin Bowling wrote: > > The branch main has been updated by kbowling (ports committer): > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=7045b1603bdf054145dd958a4acc17b410fb62a0 > > > > commit 7045b1603bdf054145dd958a4acc17b410fb62a0 > > Author: Roy Marples > > AuthorDate: 2021-07-28 15:46:59 +0000 > > Commit: Kevin Bowling > > CommitDate: 2021-07-28 16:35:09 +0000 > > > > socket: Implement SO_RERROR > > > > SO_RERROR indicates that receive buffer overflows should be handled as > > errors. Historically receive buffer overflows have been ignored and > > programs could not tell if they missed messages or messages had been > > truncated because of overflows. Since programs historically do not > > expect to get receive overflow errors, this behavior is not the > > default. > > > > This is really really important for programs that use route(4) to keep > > in sync with the system. If we loose a message then we need to reload > > the full system state, otherwise the behaviour from that point is > > undefined and can lead to chasing bogus bug reports. > > > > Reviewed by: philip (network), kbowling (transport), gbe (manpages) > > MFC after: 2 weeks > > Differential Revision: https://reviews.freebsd.org/D26652 > > --- > > lib/libc/sys/getsockopt.2 | 10 +++++++- > > sbin/route/route.c | 13 +++++++++- > > sys/kern/uipc_sockbuf.c | 24 +++++++++++++++++ > > sys/kern/uipc_socket.c | 30 ++++++++++++++++------ > > sys/kern/uipc_usrreq.c | 2 +- > > sys/net/raw_usrreq.c | 11 ++++---- > > .../bluetooth/socket/ng_btsocket_hci_raw.c | 1 + > > sys/netgraph/ng_socket.c | 2 +- > > sys/netinet/ip_divert.c | 2 +- > > sys/netinet/ip_mroute.c | 2 +- > > sys/netinet/raw_ip.c | 3 +-- > > sys/netinet/udp_usrreq.c | 2 +- > > sys/netinet6/icmp6.c | 6 ++--- > > sys/netinet6/ip6_input.c | 1 + > > sys/netinet6/ip6_mroute.c | 3 ++- > > sys/netinet6/raw_ip6.c | 2 ++ > > sys/netinet6/send.c | 2 +- > > sys/netinet6/udp6_usrreq.c | 2 +- > > sys/netipsec/keysock.c | 10 ++++---- > > sys/sys/socket.h | 1 + > > sys/sys/socketvar.h | 6 ++++- > > 21 files changed, 100 insertions(+), 35 deletions(-) > > Hey Kevin, Hi > Would this commit be a good candidate for bumping __FreeBSD_version? Off hand I don't think so but this is a weakly held opinion. My reasoning is, this is just a new flag and doesn't affect the KBI or ABI directly. There are no MFC concerns I observe (other than localized issues past stable-13, I haven't looked at 12 yet to see if MFC is easy enough that I want to do it but I will to stable-13) If we import something into src that uses this like ntpd, at most we'd just enable the feature in its respective bmake or config.h or wherever. The ntpd bugzilla is down so I can't see how they accomplished this particular feature test but I suspect it is just an inline ifdef on SO_RERROR based on Roy's other patches. On the ports side I think most external projects would use a feature test macro of their respective build systems or ifdef on the SO_RERROR definition in the minimal case (all of the API usages I know of do it like that, see https://github.com/FRRouting/frr/pull/7242/files#diff-586e1a2c472fc93bf57ce9597b0ec6559e383bd161c959fd794d7316b23255dfR1429 for an example). If you can demonstrate a reason to do it I will prep a phabricator and seek review so I can commit it. > Thanks, > > -- > Shawn Webb > Cofounder / Security Engineer > HardenedBSD > > https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/raw/master/Shawn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc From owner-dev-commits-src-all@freebsd.org Wed Jul 28 19:24: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 0A50B663BB4; Wed, 28 Jul 2021 19:24: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 4GZk9f6PMtz3JWr; Wed, 28 Jul 2021 19:24: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 C48DB23464; Wed, 28 Jul 2021 19:24: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 16SJO6dc008568; Wed, 28 Jul 2021 19:24:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16SJO6aK008567; Wed, 28 Jul 2021 19:24:06 GMT (envelope-from git) Date: Wed, 28 Jul 2021 19:24:06 GMT Message-Id: <202107281924.16SJO6aK008567@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: 29e9b487c1d4 - main - vnic: add TODO list item for multicast filter support 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: 29e9b487c1d427409a8bf1f893bc71a57c76f4b0 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, 28 Jul 2021 19:24:07 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=29e9b487c1d427409a8bf1f893bc71a57c76f4b0 commit 29e9b487c1d427409a8bf1f893bc71a57c76f4b0 Author: Ed Maste AuthorDate: 2021-07-28 18:08:36 +0000 Commit: Ed Maste CommitDate: 2021-07-28 18:09:32 +0000 vnic: add TODO list item for multicast filter support PR: 223573 --- sys/dev/vnic/nic_main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/dev/vnic/nic_main.c b/sys/dev/vnic/nic_main.c index 1bc07b0291ea..08559442dbc7 100644 --- a/sys/dev/vnic/nic_main.c +++ b/sys/dev/vnic/nic_main.c @@ -35,6 +35,7 @@ * A number of features supported by the hardware are not yet implemented in * this driver: * + * - PR223573 multicast rx filter * - PR223575 non-promiscuous mode (driver currently forces promisc) */ From owner-dev-commits-src-all@freebsd.org Wed Jul 28 19:54: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 AA2E5663D40; Wed, 28 Jul 2021 19:54: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 4GZks649gmz3Km7; Wed, 28 Jul 2021 19:54: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 778F8242F3; Wed, 28 Jul 2021 19:54: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 16SJsoDo048313; Wed, 28 Jul 2021 19:54:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16SJso0S048312; Wed, 28 Jul 2021 19:54:50 GMT (envelope-from git) Date: Wed, 28 Jul 2021 19:54:50 GMT Message-Id: <202107281954.16SJso0S048312@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: 46dd3ef0338b - main - genassym.sh: Fix two minor issues found by shellcheck 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: 46dd3ef0338ba2ad24d05bab2a614410cf17b017 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, 28 Jul 2021 19:54:50 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=46dd3ef0338ba2ad24d05bab2a614410cf17b017 commit 46dd3ef0338ba2ad24d05bab2a614410cf17b017 Author: Warner Losh AuthorDate: 2021-07-28 19:42:29 +0000 Commit: Warner Losh CommitDate: 2021-07-28 19:49:16 +0000 genassym.sh: Fix two minor issues found by shellcheck o Remove redunant $ in $(( )) expression. o Quote arg passed to work so paths with spaces, etc will work. MFC After: 2 weeks Reviewed by: kib Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D31335 --- sys/kern/genassym.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/kern/genassym.sh b/sys/kern/genassym.sh index 0374c8844b9a..999090f22d0e 100644 --- a/sys/kern/genassym.sh +++ b/sys/kern/genassym.sh @@ -57,7 +57,7 @@ do *) usage;; esac done -shift $(($OPTIND - 1)) +shift $((OPTIND - 1)) case $# in 1) ;; *) usage;; @@ -65,8 +65,8 @@ esac if [ "$use_outfile" = "yes" ] then - work $1 3>"$outfile" >&3 3>&- + work "$1" 3>"$outfile" >&3 3>&- else - work $1 + work "$1" fi From owner-dev-commits-src-all@freebsd.org Wed Jul 28 19:54: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 02484663C6C; Wed, 28 Jul 2021 19:54: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 4GZks86Bxcz3Kvp; Wed, 28 Jul 2021 19:54: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 BCF08242F4; Wed, 28 Jul 2021 19:54: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 16SJsqPc048361; Wed, 28 Jul 2021 19:54:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16SJsq0D048360; Wed, 28 Jul 2021 19:54:52 GMT (envelope-from git) Date: Wed, 28 Jul 2021 19:54:52 GMT Message-Id: <202107281954.16SJsq0D048360@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: dbdf2b52f59d - main - loader: support.4th resets the read buffer incorrectly MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dbdf2b52f59df7374eb1f799b4df1b54e4502e40 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, 28 Jul 2021 19:54:53 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=dbdf2b52f59df7374eb1f799b4df1b54e4502e40 commit dbdf2b52f59df7374eb1f799b4df1b54e4502e40 Author: John Hood AuthorDate: 2021-07-28 19:43:02 +0000 Commit: Warner Losh CommitDate: 2021-07-28 19:50:38 +0000 loader: support.4th resets the read buffer incorrectly Large nextboot.conf files (over 80 bytes) are not read correctly by the Forth loader, causing file parsing to abort, and nextboot configuration fails to apply. Simple repro: nextboot -e foo=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx shutdown -r now That will cause the bug to cause a parse failure but shouldn't otherwise affect the boot. Depending on your loader configuration, you may also have to set beastie_disable and/or reduce the number of modules loaded to see the error on a small console screen. 12.0 or CURRENT users will also have to explicitly use the Forth loader instead of the Lua loader. The error will look something like: Warning: syntax error on file /boot/loader.conf.local foo="xxxxxxxxxxxxxxnextboot_enable="YES" ^ /boot/support.4th has crude file I/O buffering, which uses a buffer 'read_buffer', defined to be 80 bytes by the 'read_buffer_size' constant. The loader first tastes nextboot.conf, reading and parsing the first line in it for nextboot_enable="YES". If this is true, then it reopens the file and parses it like other loader .conf files. Unfortunately, the file I/O buffering code does not fully reset the buffer state in the reset_line_reading word. If the last file was read to the end, that doesn't matter; the file buffer is treated as empty anyway. But in the nextboot.conf case, the loader will not read to the end of file if it is over 80 bytes, and the file buffer may be reused when reading the next file. When the file is reread, the corrupt text may cause file parsing to abort on bad syntax (if the corrupt line has <>2 quotes in it), the wrong variable to be set, no variable to be set at all, or (if the splice happens to land at a line ending) something approximating normal operation. The bug is very old, dating back to at least 2000 if not before, and is still present in 12.0 and CURRENT r345863 (though it is now hidden by the Lua loader by default). Suggested one-line attached. This does change the behavior of the reset_line_reading word, which is exported in the line-reading dictionary (though the export is not documented in loader man pages). But repo history shows it was probably exported for the PNP support code, which was never included in the loader build, and was removed 5 months ago. One thing that puzzles me: how has this bug gone unnoticed/unfixed for nearly 2 decades? I find it hard to believe that nobody's tried to do something interesting with nextboot, like load a kernel and filesystem, which is what I'm doing. Tested by: Gary Jennejohn PR: 239315 MFC After: 3 weeks Reviewed by: imp (and correctly applied this time) Differential Revision: https://reviews.freebsd.org/D31328 --- stand/forth/support.4th | 1 + 1 file changed, 1 insertion(+) diff --git a/stand/forth/support.4th b/stand/forth/support.4th index d87cf16a16dd..999ac5005f5d 100644 --- a/stand/forth/support.4th +++ b/stand/forth/support.4th @@ -486,6 +486,7 @@ get-current ( -- wid ) previous definitions >search ( wid -- ) : reset_line_reading 0 to read_buffer_ptr + 0 read_buffer .len ! ; : read_line From owner-dev-commits-src-all@freebsd.org Wed Jul 28 19:54: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 CF08E664023; Wed, 28 Jul 2021 19:54: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 4GZks75BvYz3Kvk; Wed, 28 Jul 2021 19:54: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 99A9C24315; Wed, 28 Jul 2021 19:54: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 16SJspxo048337; Wed, 28 Jul 2021 19:54:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16SJspRh048336; Wed, 28 Jul 2021 19:54:51 GMT (envelope-from git) Date: Wed, 28 Jul 2021 19:54:51 GMT Message-Id: <202107281954.16SJspRh048336@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: 824897a3aea5 - main - genoffset: simplify and rewrite in sh MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 824897a3aea5ca22db8cb7d5b404697a1de1210a 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, 28 Jul 2021 19:54:51 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=824897a3aea5ca22db8cb7d5b404697a1de1210a commit 824897a3aea5ca22db8cb7d5b404697a1de1210a Author: Warner Losh AuthorDate: 2021-07-28 19:47:05 +0000 Commit: Warner Losh CommitDate: 2021-07-28 19:50:09 +0000 genoffset: simplify and rewrite in sh genoffset used the fully generic ASSYM macro to generate the offsets needed for the thread_lite structure. However, since these are offsets into a structure, they will always be necessarily small and positive. As such, just create a simple character array of the right size and use a naming convention such that we can recover the field name, structure name and type. Use nm -t d and sort -n to sort these into order, then loop over the resutls to generate the thread_lite structure. MFC After: 2 weeks Reviewed by: kib, markj (earlier versions) Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D31203 --- sys/kern/genoffset.sh | 117 ++++++++++++++++---------------------------------- sys/sys/assym.h | 4 +- 2 files changed, 39 insertions(+), 82 deletions(-) diff --git a/sys/kern/genoffset.sh b/sys/kern/genoffset.sh index 843c0cbcd862..f7185e7ae396 100644 --- a/sys/kern/genoffset.sh +++ b/sys/kern/genoffset.sh @@ -34,84 +34,43 @@ usage() exit 1 } - work() -{ - echo "#ifndef _OFFSET_INC_" - echo "#define _OFFSET_INC_" - echo "#if !defined(GENOFFSET) && (!defined(KLD_MODULE) || defined(KLD_TIED))" - ${NM:='nm'} ${NMFLAGS} "$1" | ${AWK:='awk'} ' - / C .*_datatype_*/ { - type = substr($3, match($3, "_datatype_") + length("_datatype_")) - } - / C .*_parenttype_*/ { - parent = substr($3, match($3, "_parenttype_") + length("_parenttype_")) - } - / C .*sign$/ { - sign = substr($1, length($1) - 3, 4) - sub("^0*", "", sign) - if (sign != "") - sign = "-" - } - / C .*w0$/ { - w0 = substr($1, length($1) - 3, 4) - } - / C .*w1$/ { - w1 = substr($1, length($1) - 3, 4) - } - / C .*w2$/ { - w2 = substr($1, length($1) - 3, 4) - } - / C .*w3$/ { - w3 = substr($1, length($1) - 3, 4) - w = w3 w2 w1 w0 - sub("^0*", "", w) - if (w == "") - w = "0" - hex = "" - if (w != "0") - hex = "0x" - sub("w3$", "", $3) - member = tolower($3) - # This still has minor problems representing INT_MIN, etc. - # E.g., - # with 32-bit 2''s complement ints, this prints -0x80000000, - # which has the wrong type (unsigned int). - offset = sprintf("%s%s%s", sign, hex, w) +( + local last off x1 x2 x3 struct field type lastoff lasttype - structures[parent] = sprintf("%s%s %s %s\n", - structures[parent], offset, type, member) - } - END { - for (struct in structures) { - printf("struct %s_lite {\n", struct); - n = split(structures[struct], members, "\n") - for (i = 1; i < n; i++) { - for (j = i + 1; j < n; j++) { - split(members[i], ivar, " ") - split(members[j], jvar, " ") - if (jvar[1] < ivar[1]) { - tmp = members[i] - members[i] = members[j] - members[j] = tmp - } - } - } - off = "0" - for (i = 1; i < n; i++) { - split(members[i], m, " ") - printf "\tu_char\tpad_%s[%s - %s];\n", m[3], m[1], off - printf "\t%s\t%s;\n", m[2], m[3] - off = sprintf("(%s + sizeof(%s))", m[1], m[2]) - } - printf("};\n"); - } - } - ' - - echo "#endif" - echo "#endif" -} + echo "#ifndef _OFFSET_INC_" + echo "#define _OFFSET_INC_" + echo "#if !defined(GENOFFSET) && (!defined(KLD_MODULE) || defined(KLD_TIED))" + last= + temp=$(mktemp -d genoffset.XXXXX) + trap "rm -rf ${temp}" EXIT + # Note: we need to print symbol values in decimal so the numeric sort works + ${NM:='nm'} ${NMFLAGS} -t d "$1" | grep __assym_offset__ | sed -e 's/__/ /g' | sort -k 4 -k 1 -n | + while read off x1 x2 struct field type x3; do + off=$(echo "$off" | sed -E 's/^0+//') + if [ "$last" != "$struct" ]; then + if [ -n "$last" ]; then + echo "};" + fi + echo "struct ${struct}_lite {" + last=$struct + printf "%b" "\tu_char\tpad_${field}[${off}];\n" + else + printf "%b" "\tu_char\tpad_${field}[${off} - (${lastoff} + sizeof(${lasttype}))];\n" + fi + printf "%b" "\t${type}\t${field};\n" + lastoff="$off" + lasttype="$type" + echo "_SA(${struct}, ${field}, ${off});" >> "$temp/asserts" + done + echo "};" + echo "#define _SA(s,f,o) _Static_assert(__builtin_offsetof(struct s ## _lite, f) == o, \\" + printf '\t"struct "#s"_lite field "#f" not at offset "#o)\n' + cat "$temp/asserts" + echo "#undef _SA" + echo "#endif" + echo "#endif" +) # @@ -126,7 +85,7 @@ do *) usage;; esac done -shift $(($OPTIND - 1)) +shift $((OPTIND - 1)) case $# in 1) ;; *) usage;; @@ -134,8 +93,8 @@ esac if [ "$use_outfile" = "yes" ] then - work $1 3>"$outfile" >&3 3>&- + work "$1" 3>"$outfile" >&3 3>&- else - work $1 + work "$1" fi diff --git a/sys/sys/assym.h b/sys/sys/assym.h index 858989fe505f..3cb4afd5803c 100644 --- a/sys/sys/assym.h +++ b/sys/sys/assym.h @@ -51,9 +51,7 @@ char name ## w3[((ASSYM_ABS(value) & 0xFFFF000000000000ULL) >> 48) + ASSYM_BIAS] #endif #define OFFSYM(name, parenttype, datatype) \ -ASSYM(name, offsetof(struct parenttype, name)); \ -char name ## _datatype_ ## datatype [1]; \ -char name ## _parenttype_ ## parenttype [1]; \ +char __assym_offset__ ## parenttype ## __ ## name ## __ ## datatype [offsetof(struct parenttype, name)]; \ CTASSERT(__builtin_types_compatible_p(__typeof(((struct parenttype *)(0x0))-> name), datatype)); \ OFFSET_CTASSERT(offsetof(struct parenttype, name) == offsetof(struct parenttype ## _lite, name)) From owner-dev-commits-src-all@freebsd.org Wed Jul 28 20:07: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 44A8B66424E; Wed, 28 Jul 2021 20:07: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 4GZl7d11rtz3NhY; Wed, 28 Jul 2021 20:07:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 051932440F; Wed, 28 Jul 2021 20:07:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16SK7OfC062485; Wed, 28 Jul 2021 20:07:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16SK7ObH062484; Wed, 28 Jul 2021 20:07:24 GMT (envelope-from git) Date: Wed, 28 Jul 2021 20:07:24 GMT Message-Id: <202107282007.16SK7ObH062484@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: 33306493825b - main - if_bridge: allow MTU changes 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: 33306493825b291a308c0d37396e82de458f6cfe 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, 28 Jul 2021 20:07:25 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=33306493825b291a308c0d37396e82de458f6cfe commit 33306493825b291a308c0d37396e82de458f6cfe Author: Kristof Provost AuthorDate: 2021-07-23 15:22:18 +0000 Commit: Kristof Provost CommitDate: 2021-07-28 20:01:12 +0000 if_bridge: allow MTU changes if_bridge used to only allow MTU changes if the new MTU matched that of all member interfaces. This doesn't really make much sense, in that we really shouldn't be allowed to change the MTU of bridge member in the first place. Instead we now change the MTU of all member interfaces. If one fails we revert all interfaces back to the original MTU. We do not address the issue where bridge member interface MTUs can be changed here. Reviewed by: donner Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31288 --- sys/net/if_bridge.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c index 3e6b5ba8e0c2..adf1c9155ee1 100644 --- a/sys/net/if_bridge.c +++ b/sys/net/if_bridge.c @@ -917,6 +917,8 @@ bridge_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) break; case SIOCSIFMTU: + oldmtu = sc->sc_ifp->if_mtu; + if (ifr->ifr_mtu < 576) { error = EINVAL; break; @@ -926,17 +928,27 @@ bridge_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) break; } CK_LIST_FOREACH(bif, &sc->sc_iflist, bif_next) { - if (bif->bif_ifp->if_mtu != ifr->ifr_mtu) { - log(LOG_NOTICE, "%s: invalid MTU: %u(%s)" - " != %d\n", sc->sc_ifp->if_xname, - bif->bif_ifp->if_mtu, - bif->bif_ifp->if_xname, ifr->ifr_mtu); + error = (*bif->bif_ifp->if_ioctl)(bif->bif_ifp, + SIOCSIFMTU, (caddr_t)ifr); + if (error != 0) { + log(LOG_NOTICE, "%s: invalid MTU: %u for" + " member %s\n", sc->sc_ifp->if_xname, + ifr->ifr_mtu, + bif->bif_ifp->if_xname); error = EINVAL; break; } } - if (!error) + if (error) { + /* Restore the previous MTU on all member interfaces. */ + ifr->ifr_mtu = oldmtu; + CK_LIST_FOREACH(bif, &sc->sc_iflist, bif_next) { + (*bif->bif_ifp->if_ioctl)(bif->bif_ifp, + SIOCSIFMTU, (caddr_t)ifr); + } + } else { sc->sc_ifp->if_mtu = ifr->ifr_mtu; + } break; default: /* From owner-dev-commits-src-all@freebsd.org Wed Jul 28 20:07: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 612A4664682; Wed, 28 Jul 2021 20:07:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GZl7f1ddpz3NrZ; Wed, 28 Jul 2021 20:07: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 1AE4023C69; Wed, 28 Jul 2021 20:07: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 16SK7Qlh062515; Wed, 28 Jul 2021 20:07:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16SK7QgI062514; Wed, 28 Jul 2021 20:07:26 GMT (envelope-from git) Date: Wed, 28 Jul 2021 20:07:26 GMT Message-Id: <202107282007.16SK7QgI062514@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: 6e439506408d - main - bridge tests: test changing the bridge MTU 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: 6e439506408d36a663e666d35a340595539270a4 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, 28 Jul 2021 20:07:26 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=6e439506408d36a663e666d35a340595539270a4 commit 6e439506408d36a663e666d35a340595539270a4 Author: Kristof Provost AuthorDate: 2021-07-23 15:46:10 +0000 Commit: Kristof Provost CommitDate: 2021-07-28 20:01:12 +0000 bridge tests: test changing the bridge MTU Changing the bridge MTU will now also change all of the member interface MTUs. Test this. Reviewed by: donner Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31289 --- tests/sys/net/if_bridge_test.sh | 68 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/tests/sys/net/if_bridge_test.sh b/tests/sys/net/if_bridge_test.sh index b029d8d60419..da797f4fd39a 100755 --- a/tests/sys/net/if_bridge_test.sh +++ b/tests/sys/net/if_bridge_test.sh @@ -517,6 +517,73 @@ gif_cleanup() vnet_cleanup } +atf_test_case "mtu" "cleanup" +mtu_head() +{ + atf_set descr 'Bridge MTU changes' + atf_set require.user root +} + +get_mtu() +{ + intf=$1 + + ifconfig ${intf} ether | awk '$5 == "mtu" { print $6 }' +} + +check_mtu() +{ + intf=$1 + expected=$2 + + mtu=$(get_mtu $intf) + if [ $mtu -ne $expected ]; + then + atf_fail "Expected MTU of $expected on $intf but found $mtu" + fi +} + +mtu_body() +{ + vnet_init + + epair=$(vnet_mkepair) + gif=$(ifconfig gif create) + echo ${gif} >> created_interfaces.lst + bridge=$(vnet_mkbridge) + + atf_check -s exit:0 \ + ifconfig ${bridge} addm ${epair}a + # Can't add an interface with an MTU mismatch + atf_check -s exit:1 -e ignore \ + ifconfig ${bridge} addm ${gif} + + ifconfig ${gif} mtu 1500 + atf_check -s exit:0 \ + ifconfig ${bridge} addm ${gif} + + # Changing MTU changes it for all member interfaces + atf_check -s exit:0 \ + ifconfig ${bridge} mtu 2000 + + check_mtu ${bridge} 2000 + check_mtu ${gif} 2000 + check_mtu ${epair}a 2000 + + # Rejected MTUs mean none of the MTUs change + atf_check -s exit:1 -e ignore \ + ifconfig ${bridge} mtu 9000 + + check_mtu ${bridge} 2000 + check_mtu ${gif} 2000 + check_mtu ${epair}a 2000 +} + +mtu_cleanup() +{ + vnet_cleanup +} + atf_init_test_cases() { atf_add_test_case "bridge_transmit_ipv4_unicast" @@ -529,4 +596,5 @@ atf_init_test_cases() atf_add_test_case "mac_conflict" atf_add_test_case "stp_validation" atf_add_test_case "gif" + atf_add_test_case "mtu" } From owner-dev-commits-src-all@freebsd.org Wed Jul 28 20:07: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 1452C664433; Wed, 28 Jul 2021 20:07: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 4GZl7h3sdGz3NZx; Wed, 28 Jul 2021 20:07: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 660E424411; Wed, 28 Jul 2021 20:07: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 16SK7S9g062564; Wed, 28 Jul 2021 20:07:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16SK7ShE062563; Wed, 28 Jul 2021 20:07:28 GMT (envelope-from git) Date: Wed, 28 Jul 2021 20:07:28 GMT Message-Id: <202107282007.16SK7ShE062563@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: 441d15a4825c - main - bridge tests: verify that we can't change MTU of bridge member interfaces 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: 441d15a4825c44bfea70e6e2b8317f2691dbf1c6 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, 28 Jul 2021 20:07:29 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=441d15a4825c44bfea70e6e2b8317f2691dbf1c6 commit 441d15a4825c44bfea70e6e2b8317f2691dbf1c6 Author: Kristof Provost AuthorDate: 2021-07-26 11:51:22 +0000 Commit: Kristof Provost CommitDate: 2021-07-28 20:03:38 +0000 bridge tests: verify that we can't change MTU of bridge member interfaces Reviewed by: donner Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31305 --- tests/sys/net/if_bridge_test.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/sys/net/if_bridge_test.sh b/tests/sys/net/if_bridge_test.sh index da797f4fd39a..3c0a31ca1076 100755 --- a/tests/sys/net/if_bridge_test.sh +++ b/tests/sys/net/if_bridge_test.sh @@ -577,6 +577,11 @@ mtu_body() check_mtu ${bridge} 2000 check_mtu ${gif} 2000 check_mtu ${epair}a 2000 + + # We're not allowed to change the MTU of a member interface + atf_check -s exit:1 -e ignore \ + ifconfig ${epair}a mtu 1900 + check_mtu ${epair}a 2000 } mtu_cleanup() From owner-dev-commits-src-all@freebsd.org Wed Jul 28 20:07: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 B87D66643B6; Wed, 28 Jul 2021 20:07:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GZl7g3xJFz3NpK; Wed, 28 Jul 2021 20:07:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3EBA424410; Wed, 28 Jul 2021 20:07:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16SK7R8D062540; Wed, 28 Jul 2021 20:07:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16SK7RwN062539; Wed, 28 Jul 2021 20:07:27 GMT (envelope-from git) Date: Wed, 28 Jul 2021 20:07:27 GMT Message-Id: <202107282007.16SK7RwN062539@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: 01ad0c007964 - main - net: disallow MTU changes on bridge member interfaces 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: 01ad0c0079646a31afa20e1f07e5b62b82613493 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, 28 Jul 2021 20:07:27 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=01ad0c0079646a31afa20e1f07e5b62b82613493 commit 01ad0c0079646a31afa20e1f07e5b62b82613493 Author: Kristof Provost AuthorDate: 2021-07-26 10:18:27 +0000 Commit: Kristof Provost CommitDate: 2021-07-28 20:03:30 +0000 net: disallow MTU changes on bridge member interfaces if_bridge member interfaces should always have the same MTU as the bridge itself, so disallow MTU changes on interfaces that are part of an if_bridge. Reviewed by: donner Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31304 --- sys/net/if.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/net/if.c b/sys/net/if.c index cfa795904bc9..8d2a66471836 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -2746,6 +2746,9 @@ ifhwioctl(u_long cmd, struct ifnet *ifp, caddr_t data, struct thread *td) return (EINVAL); if (ifp->if_ioctl == NULL) return (EOPNOTSUPP); + /* Disallow MTU changes on bridge member interfaces. */ + if (ifp->if_bridge) + return (EOPNOTSUPP); error = (*ifp->if_ioctl)(ifp, cmd, data); if (error == 0) { getmicrotime(&ifp->if_lastchange); From owner-dev-commits-src-all@freebsd.org Wed Jul 28 20:30: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 57B7E664D14; Wed, 28 Jul 2021 20:30: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 4GZlfZ1gltz3QXW; Wed, 28 Jul 2021 20:30: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 21B3D241FD; Wed, 28 Jul 2021 20:30: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 16SKUkum097927; Wed, 28 Jul 2021 20:30:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16SKUkKa097926; Wed, 28 Jul 2021 20:30:46 GMT (envelope-from git) Date: Wed, 28 Jul 2021 20:30:46 GMT Message-Id: <202107282030.16SKUkKa097926@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: cc55ee8009a5 - main - compilert-rt: build out-of-line LSE atomics helpers for aarch64 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: cc55ee8009a550810d38777fd6ace9abf3a2f6b4 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, 28 Jul 2021 20:30:46 -0000 The branch main has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=cc55ee8009a550810d38777fd6ace9abf3a2f6b4 commit cc55ee8009a550810d38777fd6ace9abf3a2f6b4 Author: Dimitry Andric AuthorDate: 2021-07-28 20:30:04 +0000 Commit: Dimitry Andric CommitDate: 2021-07-28 20:30:04 +0000 compilert-rt: build out-of-line LSE atomics helpers for aarch64 Both clang >= 12 and gcc >= 10.1 now default to -moutline-atomics for aarch64. This requires a bunch of helper functions in libcompiler_rt.a, to avoid link errors like "undefined symbol: __aarch64_ldadd8_acq_rel". (Note: of course you can use -mno-outline-atomics as a workaround too, but this would negate the potential performance benefit of the faster LSE instructions.) Bump __FreeBSD_version so ports maintainers can easily detect this. PR: 257392 MFC after: 2 weeks --- lib/libcompiler_rt/Makefile | 20 ++++++++++++++++++++ sys/sys/param.h | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/lib/libcompiler_rt/Makefile b/lib/libcompiler_rt/Makefile index a2325221d0b1..b23522b7e410 100644 --- a/lib/libcompiler_rt/Makefile +++ b/lib/libcompiler_rt/Makefile @@ -19,6 +19,26 @@ MK_WERROR.gcc= no .include "Makefile.inc" +# Out-of-line LSE atomics helpers for aarch64 +.if ${MACHINE_CPUARCH} == "aarch64" +. for pat in cas swp ldadd ldclr ldeor ldset +. for size in 1 2 4 8 16 +. for model in 1 2 3 4 +. if ${pat} == "cas" || ${size} != "16" +# Use .for to define lse_name, to get a special loop-local variable +. for lse_name in outline_atomic_${pat}${size}_${model}.S +CLEANFILES+= ${lse_name} +STATICOBJS+= ${lse_name:R}.o +ACFLAGS.${lse_name}+= -DL_${pat} -DSIZE=${size} -DMODEL=${model} -I${CRTSRC} +${lse_name}: lse.S + ln -sf ${.ALLSRC} ${.TARGET} +. endfor # lse_name +. endif +. endfor # model +. endfor # size +. endfor # pat +.endif + .if ${MK_INSTALLLIB} != "no" SYMLINKS+= libcompiler_rt.a ${LIBDIR}/libgcc.a .endif diff --git a/sys/sys/param.h b/sys/sys/param.h index f1dc6dd2fcd6..11d89ea08bba 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 1400026 +#define __FreeBSD_version 1400027 /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-dev-commits-src-all@freebsd.org Wed Jul 28 20:38: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 D141E664D47; Wed, 28 Jul 2021 20:38: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 4GZlq25Nmdz3h1P; Wed, 28 Jul 2021 20:38: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 9F8B024B54; Wed, 28 Jul 2021 20:38: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 16SKc6HK003166; Wed, 28 Jul 2021 20:38:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16SKc6R7003165; Wed, 28 Jul 2021 20:38:06 GMT (envelope-from git) Date: Wed, 28 Jul 2021 20:38:06 GMT Message-Id: <202107282038.16SKc6R7003165@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: 5a49f1914178 - main - Do not expose to scheduler caches of single CPU. 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: 5a49f1914178c5275105f2ab0d23a98118cd585f 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, 28 Jul 2021 20:38:06 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=5a49f1914178c5275105f2ab0d23a98118cd585f commit 5a49f1914178c5275105f2ab0d23a98118cd585f Author: Alexander Motin AuthorDate: 2021-07-28 20:15:43 +0000 Commit: Alexander Motin CommitDate: 2021-07-28 20:38:01 +0000 Do not expose to scheduler caches of single CPU. Before this change my dual-Xeon(R) Gold 6242R always reported 3 levels or topology (root, package/L3 and core/L2). But with SMT disabled core/L2 matches thread, so additional topology level only causes more traversal work. With this change SMT case is reported same as before, while non-SMT is reported with only 2 much more simple levels. MFC after: 2 weeks --- sys/x86/x86/mp_x86.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys/x86/x86/mp_x86.c b/sys/x86/x86/mp_x86.c index c98ac12a7c3f..0698cb51b2d0 100644 --- a/sys/x86/x86/mp_x86.c +++ b/sys/x86/x86/mp_x86.c @@ -829,6 +829,12 @@ x86topo_add_sched_group(struct topo_node *root, struct cpu_group *cg_root) node = topo_next_nonchild_node(root, node); } + /* + * We are not interested in nodes including only one CPU each. + */ + if (nchildren == root->cpu_count) + return; + cg_root->cg_child = smp_topo_alloc(nchildren); cg_root->cg_children = nchildren; From owner-dev-commits-src-all@freebsd.org Wed Jul 28 21:15: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 D4FC66651A4; Wed, 28 Jul 2021 21:15: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 4GZmfZ5DG5z3kNg; Wed, 28 Jul 2021 21:15: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 9B0CB24E7F; Wed, 28 Jul 2021 21:15: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 16SLFo8U056559; Wed, 28 Jul 2021 21:15:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16SLFok3056558; Wed, 28 Jul 2021 21:15:50 GMT (envelope-from git) Date: Wed, 28 Jul 2021 21:15:50 GMT Message-Id: <202107282115.16SLFok3056558@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: 4dbac528db60 - main - pkgbase: improve pkg --version parsing 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: 4dbac528db6040694cd57c42a64e036daa91db86 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, 28 Jul 2021 21:15:50 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=4dbac528db6040694cd57c42a64e036daa91db86 commit 4dbac528db6040694cd57c42a64e036daa91db86 Author: Ed Maste AuthorDate: 2021-07-28 20:02:49 +0000 Commit: Ed Maste CommitDate: 2021-07-28 21:14:33 +0000 pkgbase: improve pkg --version parsing In some cases `pkg --version` might produce unexpected or additional output. Use a regex /^[0-9.]+$/ to match only the line containing the version number. Reported by: Michael Butler on freebsd-current@ Fixes: 4e224e4be7c3 ("pkgbase: accommodate pkg < 1.17") Sponsored by: The FreeBSD Foundation --- Makefile.inc1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index 23fb4b5581ac..9ef954e0678c 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -1860,7 +1860,7 @@ _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. '{print $$1 * 10000 + $$2 * 100 + $$3}' +PKG_BIN_VERSION!=${PKG_CMD} --version | 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 Wed Jul 28 22:26: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 57FDB66612A; Wed, 28 Jul 2021 22:26: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 4GZpDF1mLzz3q8N; Wed, 28 Jul 2021 22:26: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 24D56261A5; Wed, 28 Jul 2021 22:26: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 16SMQbcW050962; Wed, 28 Jul 2021 22:26:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16SMQb7f050961; Wed, 28 Jul 2021 22:26:37 GMT (envelope-from git) Date: Wed, 28 Jul 2021 22:26:37 GMT Message-Id: <202107282226.16SMQb7f050961@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: 54ff3b398674 - main - nfscl: Set correct lockowner for "oneopenown" mount option MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 54ff3b3986741b9cd06ce20b90c96711cbe146d0 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, 28 Jul 2021 22:26:37 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=54ff3b3986741b9cd06ce20b90c96711cbe146d0 commit 54ff3b3986741b9cd06ce20b90c96711cbe146d0 Author: Rick Macklem AuthorDate: 2021-07-28 22:23:05 +0000 Commit: Rick Macklem CommitDate: 2021-07-28 22:23:05 +0000 nfscl: Set correct lockowner for "oneopenown" mount option For NFSv4.1/4.2, the client may use either an open, lock or delegation stateid as the stateid argument for an I/O operation. RFC 5661 defines an order of preference of delegation, then lock and finally open stateid for the argument, although NFSv4.1/4.2 servers are expected to handle any stateid type. For the "oneopenown" mount option, the lock owner was not being correctly generated and, as such, the I/O operation would use an open stateid, even when a lock stateid existed. Although this did not and should not affect an NFSv4.1/4.2 server's behaviour, this patch makes the behaviour for "oneopenown" the same as when the mount option is not specified. Found during inspection of packet captures. No failure during testing against NFSv4.1/4.2 servers of the unpatched code occurred. MFC after: 2 weeks --- sys/fs/nfsclient/nfs_clstate.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c index 406dcc9d9b80..b119f86e2267 100644 --- a/sys/fs/nfsclient/nfs_clstate.c +++ b/sys/fs/nfsclient/nfs_clstate.c @@ -528,7 +528,7 @@ nfscl_getstateid(vnode_t vp, u_int8_t *nfhp, int fhlen, u_int32_t mode, struct nfscldeleg *dp; struct nfsnode *np; struct nfsmount *nmp; - u_int8_t own[NFSV4CL_LOCKNAMELEN]; + u_int8_t own[NFSV4CL_LOCKNAMELEN], lockown[NFSV4CL_LOCKNAMELEN]; int error; bool done; @@ -603,9 +603,10 @@ nfscl_getstateid(vnode_t vp, u_int8_t *nfhp, int fhlen, u_int32_t mode, nfscl_filllockowner(NULL, own, F_POSIX); else nfscl_filllockowner(p->td_proc, own, F_POSIX); + nfscl_filllockowner(p->td_proc, lockown, F_POSIX); lp = NULL; error = nfscl_getopen(NULL, clp->nfsc_openhash, nfhp, fhlen, - own, own, mode, &lp, &op); + own, lockown, mode, &lp, &op); if (error == 0 && lp != NULL && fords == 0) { /* Don't return a lock stateid for a DS. */ if (NFSHASNFSV4N(nmp)) From owner-dev-commits-src-all@freebsd.org Wed Jul 28 22:52: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 F38EA666939; Wed, 28 Jul 2021 22:52: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 4GZpnp6XBhz3sYT; Wed, 28 Jul 2021 22:52: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 C85E326640; Wed, 28 Jul 2021 22:52: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 16SMqETt090096; Wed, 28 Jul 2021 22:52:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16SMqEGx090095; Wed, 28 Jul 2021 22:52:14 GMT (envelope-from git) Date: Wed, 28 Jul 2021 22:52:14 GMT Message-Id: <202107282252.16SMqEGx090095@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: efea1bc1fd93 - main - nfscl: Cache an open stateid for the "oneopenown" mount option MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: efea1bc1fd93831c29fa7594d67094e0c125fb88 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, 28 Jul 2021 22:52:15 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=efea1bc1fd93831c29fa7594d67094e0c125fb88 commit efea1bc1fd93831c29fa7594d67094e0c125fb88 Author: Rick Macklem AuthorDate: 2021-07-28 22:48:27 +0000 Commit: Rick Macklem CommitDate: 2021-07-28 22:48:27 +0000 nfscl: Cache an open stateid for the "oneopenown" mount option For NFSv4.1/4.2, if the "oneopenown" mount option is used, there is, at most, only one open stateid for each NFS vnode. When an open stateid for a file is acquired, set a pointer to the open structure in the NFS vnode. This pointer can be used to acquire the open stateid without searching the open linked list when the following is true: - No delegations have been issued for the file. Since delegations can outlive an NFS vnode for a file, use the global NFSMNTP_DELEGISSUED flag on the mount to determine this. - No lock stateid has been issued for the file. To determine this, a new NFS vnode flag called NMIGHTBELOCKED is set when a lock stateid is issued, which can then be tested. When this open structure pointer can be used, it avoids the need to acquire the NFSCLSTATELOCK() and searching the open structure list for an open. The NFSCLSTATELOCK() can be highly contended when there are a lot of opens issued for the NFSv4.1/4.2 mount. This patch only affects NFSv4.1/4.2 mounts when the "oneopenown" mount option is used. MFC after: 2 weeks --- sys/fs/nfsclient/nfs_clnode.c | 11 ++++++++--- sys/fs/nfsclient/nfs_clrpcops.c | 8 +++++++- sys/fs/nfsclient/nfs_clstate.c | 36 ++++++++++++++++++++++++++++++++++++ sys/fs/nfsclient/nfs_clvnops.c | 17 +++++++++++++++++ sys/fs/nfsclient/nfsnode.h | 2 ++ 5 files changed, 70 insertions(+), 4 deletions(-) diff --git a/sys/fs/nfsclient/nfs_clnode.c b/sys/fs/nfsclient/nfs_clnode.c index 1c0e855ff5a9..9718c2c36a3c 100644 --- a/sys/fs/nfsclient/nfs_clnode.c +++ b/sys/fs/nfsclient/nfs_clnode.c @@ -243,7 +243,11 @@ ncl_inactive(struct vop_inactive_args *ap) boolean_t retv; td = curthread; + np = VTONFS(vp); if (NFS_ISV4(vp) && vp->v_type == VREG) { + NFSLOCKNODE(np); + np->n_openstateid = NULL; + NFSUNLOCKNODE(np); /* * Since mmap()'d files do I/O after VOP_CLOSE(), the NFSv4 * Close operations are delayed until now. Any dirty @@ -263,7 +267,6 @@ ncl_inactive(struct vop_inactive_args *ap) } } - np = VTONFS(vp); NFSLOCKNODE(np); ncl_releasesillyrename(vp, td); @@ -303,9 +306,10 @@ ncl_reclaim(struct vop_reclaim_args *ap) NFSLOCKNODE(np); ncl_releasesillyrename(vp, td); - NFSUNLOCKNODE(np); if (NFS_ISV4(vp) && vp->v_type == VREG) { + np->n_openstateid = NULL; + NFSUNLOCKNODE(np); /* * We can now safely close any remaining NFSv4 Opens for * this file. Most opens will have already been closed by @@ -325,7 +329,8 @@ ncl_reclaim(struct vop_reclaim_args *ap) nfscl_delegreturnvp(vp, td); } else MNT_IUNLOCK(mp); - } + } else + NFSUNLOCKNODE(np); vfs_hash_remove(vp); diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c index acc4bc7b9f88..74803e255aae 100644 --- a/sys/fs/nfsclient/nfs_clrpcops.c +++ b/sys/fs/nfsclient/nfs_clrpcops.c @@ -457,8 +457,14 @@ else printf(" fhl=0\n"); * If error is non-zero, don't increment it, since the Open * hasn't succeeded yet. */ - if (!error) + if (!error) { op->nfso_opencnt++; + if (NFSHASNFSV4N(nmp) && NFSHASONEOPENOWN(nmp)) { + NFSLOCKNODE(np); + np->n_openstateid = op; + NFSUNLOCKNODE(np); + } + } nfscl_openrelease(nmp, op, error, newone); if (error == NFSERR_GRACE || error == NFSERR_STALECLIENTID || error == NFSERR_STALEDONTRECOVER || error == NFSERR_DELAY || diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c index b119f86e2267..bb2c78a72ed9 100644 --- a/sys/fs/nfsclient/nfs_clstate.c +++ b/sys/fs/nfsclient/nfs_clstate.c @@ -547,6 +547,34 @@ nfscl_getstateid(vnode_t vp, u_int8_t *nfhp, int fhlen, u_int32_t mode, return (EISDIR); np = VTONFS(vp); nmp = VFSTONFS(vp->v_mount); + + /* + * For "oneopenown" mounts, first check for a cached open in the + * NFS vnode, that can be used as a stateid. This can only be + * done if no delegations have been issued to the mount and no + * byte range file locking has been done for the file. + */ + if (NFSHASNFSV4N(nmp) && NFSHASONEOPENOWN(nmp) && fords == 0) { + NFSLOCKMNT(nmp); + NFSLOCKNODE(np); + if ((nmp->nm_privflag & NFSMNTP_DELEGISSUED) == 0 && + (np->n_flag & NMIGHTBELOCKED) == 0 && + np->n_openstateid != NULL) { + stateidp->seqid = 0; + stateidp->other[0] = + np->n_openstateid->nfso_stateid.other[0]; + stateidp->other[1] = + np->n_openstateid->nfso_stateid.other[1]; + stateidp->other[2] = + np->n_openstateid->nfso_stateid.other[2]; + NFSUNLOCKNODE(np); + NFSUNLOCKMNT(nmp); + return (0); + } + NFSUNLOCKNODE(np); + NFSUNLOCKMNT(nmp); + } + NFSLOCKCLSTATE(); clp = nfscl_findcl(nmp); if (clp == NULL) { @@ -4302,9 +4330,17 @@ nfscl_relock(vnode_t vp, struct nfsclclient *clp, struct nfsmount *nmp, { struct nfscllockowner *nlp; struct nfsfh *nfhp; + struct nfsnode *np; u_int64_t off, len; int error, newone, donelocally; + if (NFSHASNFSV4N(nmp) && NFSHASONEOPENOWN(nmp)) { + np = VTONFS(vp); + NFSLOCKNODE(np); + np->n_flag |= NMIGHTBELOCKED; + NFSUNLOCKNODE(np); + } + off = lop->nfslo_first; len = lop->nfslo_end - lop->nfslo_first; error = nfscl_getbytelock(vp, off, len, lop->nfslo_type, cred, p, diff --git a/sys/fs/nfsclient/nfs_clvnops.c b/sys/fs/nfsclient/nfs_clvnops.c index 2311ea099042..72d9eac8e962 100644 --- a/sys/fs/nfsclient/nfs_clvnops.c +++ b/sys/fs/nfsclient/nfs_clvnops.c @@ -3166,6 +3166,7 @@ nfs_advlock(struct vop_advlock_args *ap) struct vattr va; int ret, error; u_quad_t size; + struct nfsmount *nmp; error = NFSVOPLOCK(vp, LK_SHARED); if (error != 0) @@ -3195,6 +3196,22 @@ nfs_advlock(struct vop_advlock_args *ap) ap->a_flags)) (void) ncl_flush(vp, MNT_WAIT, td, 1, 0); + /* + * Mark NFS node as might have acquired a lock. + * This is separate from NHASBEENLOCKED, because it must + * be done before the nfsrpc_advlock() call, which might + * add a nfscllock structure to the client state. + * It is used to check for the case where a nfscllock + * state structure cannot exist for the file. + * Only done for "oneopenown" NFSv4.1/4.2 mounts. + */ + nmp = VFSTONFS(vp->v_mount); + if (NFSHASNFSV4N(nmp) && NFSHASONEOPENOWN(nmp)) { + NFSLOCKNODE(np); + np->n_flag |= NMIGHTBELOCKED; + NFSUNLOCKNODE(np); + } + /* * Loop around doing the lock op, while a blocking lock * must wait for the lock op to succeed. diff --git a/sys/fs/nfsclient/nfsnode.h b/sys/fs/nfsclient/nfsnode.h index 66a2de31551a..b34e362a8522 100644 --- a/sys/fs/nfsclient/nfsnode.h +++ b/sys/fs/nfsclient/nfsnode.h @@ -128,6 +128,7 @@ struct nfsnode { u_int64_t n_change; /* old Change attribute */ struct nfsv4node *n_v4; /* extra V4 stuff */ struct ucred *n_writecred; /* Cred. for putpages */ + struct nfsclopen *n_openstateid; /* Cached open stateid */ }; #define n_atim n_un1.nf_atim @@ -164,6 +165,7 @@ struct nfsnode { #define NHASBEENLOCKED 0x00080000 /* Has been file locked. */ #define NDSCOMMIT 0x00100000 /* Commit is done via the DS. */ #define NVNSETSZSKIP 0x00200000 /* Skipped vnode_pager_setsize() */ +#define NMIGHTBELOCKED 0x00400000 /* Might be file locked. */ /* * Convert between nfsnode pointers and vnode pointers From owner-dev-commits-src-all@freebsd.org Wed Jul 28 22:54: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 BAE1C666672; Wed, 28 Jul 2021 22:54: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 4GZpqx4t0pz3sL3; Wed, 28 Jul 2021 22:54: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 8EAF12689E; Wed, 28 Jul 2021 22:54: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 16SMs5uR090333; Wed, 28 Jul 2021 22:54:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16SMs5UV090332; Wed, 28 Jul 2021 22:54:05 GMT (envelope-from git) Date: Wed, 28 Jul 2021 22:54:05 GMT Message-Id: <202107282254.16SMs5UV090332@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: 07c4b78d0a1d - main - lua loader: Add disable-device to disable a device. 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: 07c4b78d0a1d26b6441cf3e52b917f20c932b9d0 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, 28 Jul 2021 22:54:05 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=07c4b78d0a1d26b6441cf3e52b917f20c932b9d0 commit 07c4b78d0a1d26b6441cf3e52b917f20c932b9d0 Author: Warner Losh AuthorDate: 2021-07-28 22:52:38 +0000 Commit: Warner Losh CommitDate: 2021-07-28 22:53:00 +0000 lua loader: Add disable-device to disable a device. disable-device fooX will set hint.foo.X.disabled=1 as a way to easily disable a device attaching during boot. Reviewed by: tsoome Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D31297 --- stand/lua/cli.lua | 15 +++++++++++++++ stand/lua/cli.lua.8 | 10 ++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/stand/lua/cli.lua b/stand/lua/cli.lua index cfdc69a520a0..12f6b57642db 100644 --- a/stand/lua/cli.lua +++ b/stand/lua/cli.lua @@ -240,6 +240,21 @@ cli["show-module-options"] = function() pager.close() end +cli["disable-device"] = function(...) + local _, argv = cli.arguments(...) + local d, u + + if #argv == 0 then + print("usage error: disable-device device") + return + end + + d, u = string.match(argv[1], "(%w*%a)(%d+)") + if d ~= nil then + loader.setenv("hint." .. d .. "." .. u .. ".disabled", "1") + end +end + -- Used for splitting cli varargs into cmd_name and the rest of argv function cli.arguments(...) local argv = {...} diff --git a/stand/lua/cli.lua.8 b/stand/lua/cli.lua.8 index 390831d21452..fe1cd0450557 100644 --- a/stand/lua/cli.lua.8 +++ b/stand/lua/cli.lua.8 @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 17, 2020 +.Dd July 24, 2021 .Dt CLI.LUA 8 .Os .Sh NAME @@ -91,10 +91,12 @@ module provides the following default commands: .It .Ic reload-conf .It -.Ic enable-module +.Ic device-disable .It .Ic disable-module .It +.Ic enable-module +.It .Ic toggle-module .It .Ic show-module-options @@ -131,6 +133,10 @@ The .Ic show-module-options command will dump the list of modules that loader has been made aware of and any applicable options using paged output. +.Pp +The +.Ic device-disable +command sets the environment variable that disables the device argument. .Ss Exported Functions The following functions are exported from .Nm : From owner-dev-commits-src-all@freebsd.org Wed Jul 28 23:34: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 973E0667514; Wed, 28 Jul 2021 23:34: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 4GZqkK3DgDz3ttd; Wed, 28 Jul 2021 23:34: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 5727D26CFC; Wed, 28 Jul 2021 23:34: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 16SNYHPN043599; Wed, 28 Jul 2021 23:34:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16SNYHVA043598; Wed, 28 Jul 2021 23:34:17 GMT (envelope-from git) Date: Wed, 28 Jul 2021 23:34:17 GMT Message-Id: <202107282334.16SNYHVA043598@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: 7cbf1de38e06 - main - debugnet: Fix false-positive assertions for dp_state 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: 7cbf1de38e06663c76f4f075db31ea25f429f1b3 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, 28 Jul 2021 23:34:17 -0000 The branch main has been updated by bdrewery: URL: https://cgit.FreeBSD.org/src/commit/?id=7cbf1de38e06663c76f4f075db31ea25f429f1b3 commit 7cbf1de38e06663c76f4f075db31ea25f429f1b3 Author: Bryan Drewery AuthorDate: 2021-07-27 20:12:37 +0000 Commit: Bryan Drewery CommitDate: 2021-07-28 23:34:14 +0000 debugnet: Fix false-positive assertions for dp_state debugnet_handle_arp: An assertion is present to ensure the pcb is only modified when the state is DN_STATE_INIT. Because debugnet_arp_gw() is asynchronous it is possible for ARP replies to come in after the gateway address is known and the state already changed. debugnet_handle_ip: Similarly it is possible for packets to come in, from the expected server, during the gateway mac discovery phase. This can happen from testing disconnects / reconnects in quick succession. This later causes some acks to be sent back but hit an assertion because the state is wrong. Reviewed by: cem, debugnet_handle_arp: markj, vangyzen Sponsored by: Dell EMC Differential Revision: https://reviews.freebsd.org/D31327 --- sys/net/debugnet_inet.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/sys/net/debugnet_inet.c b/sys/net/debugnet_inet.c index 837f838fa6d9..e7449113ba10 100644 --- a/sys/net/debugnet_inet.c +++ b/sys/net/debugnet_inet.c @@ -86,6 +86,9 @@ debugnet_handle_ip(struct debugnet_pcb *pcb, struct mbuf **mb) struct mbuf *m; unsigned short hlen; + if (pcb->dp_state < DN_STATE_HAVE_GW_MAC) + return; + /* IP processing. */ m = *mb; if (m->m_pkthdr.len < sizeof(struct ip)) { @@ -347,13 +350,19 @@ debugnet_handle_arp(struct debugnet_pcb *pcb, struct mbuf **mb) " server or gateway)\n", buf); return; } + if (pcb->dp_state >= DN_STATE_HAVE_GW_MAC) { + inet_ntoa_r(isaddr, buf); + DNETDEBUG("ignoring server ARP reply from %s (already" + " have gateway address)\n", buf); + return; + } + MPASS(pcb->dp_state == DN_STATE_INIT); memcpy(pcb->dp_gw_mac.octet, ar_sha(ah), min(ah->ar_hln, ETHER_ADDR_LEN)); DNETDEBUG("got server MAC address %6D\n", pcb->dp_gw_mac.octet, ":"); - MPASS(pcb->dp_state == DN_STATE_INIT); pcb->dp_state = DN_STATE_HAVE_GW_MAC; return; } From owner-dev-commits-src-all@freebsd.org Wed Jul 28 23:47:40 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1C91D6671C0 for ; Wed, 28 Jul 2021 23:47:40 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) (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 4GZr1l6hpfz3vZl for ; Wed, 28 Jul 2021 23:47:39 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wr1-f48.google.com with SMTP id j2so4479460wrx.9 for ; Wed, 28 Jul 2021 16:47:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=g+XWSYKTXh2XO6cRjyonw2GGhcoxUY8KHP+1rShENSo=; b=eNjy6PeQMByI1RWBFN3apngUmB5/3JB9SluWYAbFno9Ixm/DrIZgRT26LpcenA19CO jM8zgRzrUoX6TjCZGunQXc28C78q+CEI02Y1cS0WXvWOkz39Pkij3buUkw2nMRINqpGm nAh22oN8VjpWm+mZ+WIhkqSqp/rsS25E/RzPxtJ9csSkMbY0FFwXjjr9USDvBlpftjZ3 4DHWzk+XfyfX1SjkijXuNE07xQf3jqUEm5LIGaE4q2Pp1E8lmVaHwEv99web4mnWsa9i nF/GvIpWTLAx8EskezZnfM/Qrnj7rjgtSqOfjK4YaTo3Vtv1JbxZYW6kmI6ftmHfNc4G hvnw== X-Gm-Message-State: AOAM531qcCYftwPqGlLvImiqoVshh8D0ceY7P15PvmDszqvkG/50+aMF kMOjMz1cRZMYkuZi9ATW7yMlBg== X-Google-Smtp-Source: ABdhPJzpGaXWoEvlVuBu7DQCNXjFIkEK6sm3dCYk4rpI+nwZyRuFuU2qBqd3Kk/3LqLPW3iD9wQbvA== X-Received: by 2002:adf:eec5:: with SMTP id a5mr1630563wrp.317.1627516052645; Wed, 28 Jul 2021 16:47:32 -0700 (PDT) Received: from smtpclient.apple (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id b15sm1233175wrx.73.2021.07.28.16.47.32 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Jul 2021 16:47:32 -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: 07c4b78d0a1d - main - lua loader: Add disable-device to disable a device. From: Jessica Clarke In-Reply-To: <202107282254.16SMs5UV090332@gitrepo.freebsd.org> Date: Thu, 29 Jul 2021 00:47:31 +0100 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: References: <202107282254.16SMs5UV090332@gitrepo.freebsd.org> To: Warner Losh X-Mailer: Apple Mail (2.3654.100.0.2.22) X-Rspamd-Queue-Id: 4GZr1l6hpfz3vZl 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, 28 Jul 2021 23:47:40 -0000 On 28 Jul 2021, at 23:54, Warner Losh wrote: >=20 > The branch main has been updated by imp: >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3D07c4b78d0a1d26b6441cf3e52b917f20= c932b9d0 >=20 > commit 07c4b78d0a1d26b6441cf3e52b917f20c932b9d0 > Author: Warner Losh > AuthorDate: 2021-07-28 22:52:38 +0000 > Commit: Warner Losh > CommitDate: 2021-07-28 22:53:00 +0000 >=20 > lua loader: Add disable-device to disable a device. >=20 > disable-device fooX will set hint.foo.X.disabled=3D1 as a way to = easily > disable a device attaching during boot. >=20 > Reviewed by: tsoome > Sponsored by: Netflix > Differential Revision: https://reviews.freebsd.org/D31297 > --- > stand/lua/cli.lua | 15 +++++++++++++++ > stand/lua/cli.lua.8 | 10 ++++++++-- > 2 files changed, 23 insertions(+), 2 deletions(-) >=20 > diff --git a/stand/lua/cli.lua b/stand/lua/cli.lua > index cfdc69a520a0..12f6b57642db 100644 > --- a/stand/lua/cli.lua > +++ b/stand/lua/cli.lua > @@ -240,6 +240,21 @@ cli["show-module-options"] =3D function() > pager.close() > end >=20 > +cli["disable-device"] =3D function(...) > + local _, argv =3D cli.arguments(...) > + local d, u > + > + if #argv =3D=3D 0 then > + print("usage error: disable-device device") > + return > + end > + > + d, u =3D string.match(argv[1], "(%w*%a)(%d+)") > + if d ~=3D nil then > + loader.setenv("hint." .. d .. "." .. u .. ".disabled", = "1") > + end > +end > + > -- Used for splitting cli varargs into cmd_name and the rest of argv > function cli.arguments(...) > local argv =3D {...} > diff --git a/stand/lua/cli.lua.8 b/stand/lua/cli.lua.8 > index 390831d21452..fe1cd0450557 100644 > --- a/stand/lua/cli.lua.8 > +++ b/stand/lua/cli.lua.8 > @@ -26,7 +26,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd December 17, 2020 > +.Dd July 24, 2021 > .Dt CLI.LUA 8 > .Os > .Sh NAME > @@ -91,10 +91,12 @@ module provides the following default commands: > .It > .Ic reload-conf > .It > -.Ic enable-module > +.Ic device-disable This is round the wrong way (and repeated below). Jess > .It > .Ic disable-module > .It > +.Ic enable-module > +.It > .Ic toggle-module > .It > .Ic show-module-options > @@ -131,6 +133,10 @@ The > .Ic show-module-options > command will dump the list of modules that loader has been made aware = of and > any applicable options using paged output. > +.Pp > +The > +.Ic device-disable > +command sets the environment variable that disables the device = argument. > .Ss Exported Functions > The following functions are exported from > .Nm : From owner-dev-commits-src-all@freebsd.org Thu Jul 29 01: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 9906C668A9F; Thu, 29 Jul 2021 01:19:41 +0000 (UTC) (envelope-from koobs.freebsd@gmail.com) Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) (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 4GZt3x3JZWz4f1R; Thu, 29 Jul 2021 01:19:41 +0000 (UTC) (envelope-from koobs.freebsd@gmail.com) Received: by mail-pj1-x102d.google.com with SMTP id mz5-20020a17090b3785b0290176ecf64922so12983110pjb.3; Wed, 28 Jul 2021 18:19:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:message-id:date:mime-version:user-agent:reply-to:subject :content-language:to:references:from:cc:in-reply-to :content-transfer-encoding; bh=Nt2B+sQ4Xv86wj0xYvi0nxyZQwdNcRMZN4FmZS5LraE=; b=AVrD6X/B4V699BuFeTwDcA0eClhV3xdlOpc7CZ3V5Rtc5S9qTVsozVu1Yp77pm5+sV QCuu7sTVRBwNa4MpNkZikJzQSAK64PwshfOmp9vNhBIUw2FATg7HIohrwUOyHEfLjkqG epZg0ujIPgQeBy2pmNPDD2xKpMHgezXv9/g8W8q34J84pHr0Qh7Mt9DUsW833F/HPwnZ Zm0ifilbAGBqWW8odktO4MQlhLSNK4r9Noq+2qcE+FJbRhBOfLt+O+1Ey+qLS4Ht25ys KVAhoYVPpIiiKq3pHOPTus0rv0Ou3ZX/uZr1mrsUNaVbPgEX3A8vG/Hr7ymlMvC2f7MQ r38g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:message-id:date:mime-version:user-agent :reply-to:subject:content-language:to:references:from:cc:in-reply-to :content-transfer-encoding; bh=Nt2B+sQ4Xv86wj0xYvi0nxyZQwdNcRMZN4FmZS5LraE=; b=QIXwJow7fDLPyktOjw5ceFX705oRpp0s33Y9qjX5aY0xujaGOF2o09Jv/8Q8MRDBIe CKvTTDwPxcDx3DquaQC22XlkfqGJg7wGx4eBNAECZRj09uBZcswxxKwGoiLDzxjSsaDT Iu1gPNAyqLylNszBgncbz+4JRyGFu70vEFbXU7kCHPixNa1xfBHVrLTuE5c9RyB7Dpjf kTRd/SFQcjmy9J1I+fE/wameGs8ztI6MWSlc5Fqe34Yk3Mj3BaOenZoXGxlzO5gz+T8P NcgpCMEgCxFpithlywEpYJtmPCk7LIW9eXND2W8UWcb66JSMpNxIEGw7eLjYdMSSckn/ Stsg== X-Gm-Message-State: AOAM531EkFvZFuFnQXFjsMzY/IqBH+k8euIa2gcMV+BjX9f41LsDeuSy k7s/xp8PzUOXw2jKx7B0S09kNGUsU9xGfw== X-Google-Smtp-Source: ABdhPJyY193tSv3Q58joYob4Dx1QrPUjXpy7woG7VbdYmVFmuXDfQlolZynT1AYvSX4tvu7jlTysww== X-Received: by 2002:a65:654c:: with SMTP id a12mr1611121pgw.118.1627521580292; Wed, 28 Jul 2021 18:19:40 -0700 (PDT) Received: from ?IPV6:2403:5800:7500:3601:70f0:f452:bc82:11cb? (2403-5800-7500-3601-70f0-f452-bc82-11cb.ip6.aussiebb.net. [2403:5800:7500:3601:70f0:f452:bc82:11cb]) by smtp.gmail.com with UTF8SMTPSA id f4sm1215569pgi.68.2021.07.28.18.19.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 28 Jul 2021 18:19:39 -0700 (PDT) Sender: Kubilay Kocak Message-ID: Date: Thu, 29 Jul 2021 11:19:36 +1000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:92.0) Gecko/20100101 Thunderbird/92.0a1 Reply-To: koobs@FreeBSD.org Subject: Re: git: da8d8b22e69c - main - pf: fix ABI breakage Content-Language: en-US To: Kristof Provost References: <202107281221.16SCLpFm044007@gitrepo.freebsd.org> From: Kubilay Kocak Cc: dev-commits-src-all@FreeBSD.org, src-committers@FreeBSD.org, dev-commits-src-main@FreeBSD.org In-Reply-To: <202107281221.16SCLpFm044007@gitrepo.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4GZt3x3JZWz4f1R X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; TAGGED_FROM(0.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, 29 Jul 2021 01:19:41 -0000 On 28/07/2021 10:21 pm, Kristof Provost wrote: > The branch main has been updated by kp: > > URL: https://cgit.FreeBSD.org/src/commit/?id=da8d8b22e69c72f1d001d55b5eff5acbb0265cfc > > commit da8d8b22e69c72f1d001d55b5eff5acbb0265cfc > Author: Kristof Provost > AuthorDate: 2021-07-28 09:24:44 +0000 > Commit: Kristof Provost > CommitDate: 2021-07-28 10:16:33 +0000 > > pf: fix ABI breakage > > The introduction of synproxy support changed the size of struct > pf_status, which in turn broke the userspace ABI. > > Revert the relevant change. More work is needed on the synproxy code to > keep and expose the counters, but in the mean time this restores the > ABI. > > PR: 257469 > MFC after: 3 days > Sponsored by: Modirum MDPay > --- > sys/netpfil/pf/pf.h | 3 +-- > sys/netpfil/pf/pf_syncookies.c | 1 - > 2 files changed, 1 insertion(+), 3 deletions(-) > > diff --git a/sys/netpfil/pf/pf.h b/sys/netpfil/pf/pf.h > index c8bf932af9c3..d8ee43506d99 100644 > --- a/sys/netpfil/pf/pf.h > +++ b/sys/netpfil/pf/pf.h > @@ -160,8 +160,7 @@ enum { PF_ADDR_ADDRMASK, PF_ADDR_NOROUTE, PF_ADDR_DYNIFTL, > #define LCNT_SRCCONNRATE 4 /* max-src-conn-rate */ > #define LCNT_OVERLOAD_TABLE 5 /* entry added to overload table */ > #define LCNT_OVERLOAD_FLUSH 6 /* state entries flushed */ > -#define LCNT_SYNCOOKIES_VALID 7 /* syncookies validated */ /* XXX TODO: Ensure no API breakage! */ > -#define LCNT_MAX 8 /* total+1 */ > +#define LCNT_MAX 7 /* total+1 */ > > #define LCNT_NAMES { \ > "max states per rule", \ > diff --git a/sys/netpfil/pf/pf_syncookies.c b/sys/netpfil/pf/pf_syncookies.c > index 8699ae855ec8..744a12e4e21d 100644 > --- a/sys/netpfil/pf/pf_syncookies.c > +++ b/sys/netpfil/pf/pf_syncookies.c > @@ -275,7 +275,6 @@ pf_syncookie_validate(struct pf_pdesc *pd) > if ((ack & ~0xff) != (hash & ~0xff)) > return (0); > > - counter_u64_add(V_pf_status.lcounters[LCNT_SYNCOOKIES_VALID], 1); > return (1); > } > > _______________________________________________ > dev-commits-src-main@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main > To unsubscribe, send any mail to "dev-commits-src-main-unsubscribe@freebsd.org" > Are these ABI break^W changes being picked up automatically or via people watching commits? From owner-dev-commits-src-all@freebsd.org Thu Jul 29 02:00: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 DD635669296; Thu, 29 Jul 2021 02:00: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 4GZtz55jKSz4hPv; Thu, 29 Jul 2021 02:00: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 AC295DA4; Thu, 29 Jul 2021 02:00:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16T20Xmd038858; Thu, 29 Jul 2021 02:00:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16T20XOM038857; Thu, 29 Jul 2021 02:00:33 GMT (envelope-from git) Date: Thu, 29 Jul 2021 02:00:33 GMT Message-Id: <202107290200.16T20XOM038857@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: aefe0a8c32d3 - main - Refactor/optimize cpu_search_*(). 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: aefe0a8c32d370f2fdd0d0771eb59f8845beda17 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, 29 Jul 2021 02:00:33 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=aefe0a8c32d370f2fdd0d0771eb59f8845beda17 commit aefe0a8c32d370f2fdd0d0771eb59f8845beda17 Author: Alexander Motin AuthorDate: 2021-07-29 01:18:50 +0000 Commit: Alexander Motin CommitDate: 2021-07-29 02:00:29 +0000 Refactor/optimize cpu_search_*(). Remove cpu_search_both(), unused for many years. Without it there is less sense for the trick of compiling common cpu_search() into separate cpu_search_lowest() and cpu_search_highest(), so split them completely, making code more readable. While there, split iteration over children groups and CPUs, complicating code for very small deduplication. Stop passing cpuset_t arguments by value and avoid some manipulations. Since MAXCPU bump from 64 to 256, what was a single register turned into 32-byte memory array, requiring memory allocation and accesses. Splitting struct cpu_search into parameter and result parts allows to even more reduce stack usage, since the first can be passed through on recursion. Remove CPU_FFS() from the hot paths, precalculating first and last CPU for each CPU group in advance during initialization. Again, it was not a problem for 64 CPUs before, but for 256 FFS needs much more code. With these changes on 80-thread system doing ~260K uncached ZFS reads per second I observe ~30% reduction of time spent in cpu_search_*(). MFC after: 1 month --- sys/kern/sched_ule.c | 290 +++++++++++++++++++++------------------------------ sys/kern/subr_smp.c | 12 +++ sys/sys/smp.h | 2 + 3 files changed, 134 insertions(+), 170 deletions(-) diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c index 094a3fffef8c..3bb73d64a70c 100644 --- a/sys/kern/sched_ule.c +++ b/sys/kern/sched_ule.c @@ -631,170 +631,120 @@ sched_random(void) } struct cpu_search { - cpuset_t cs_mask; + cpuset_t *cs_mask; u_int cs_prefer; int cs_pri; /* Min priority for low. */ int cs_limit; /* Max load for low, min load for high. */ +}; + +struct cpu_search_res { int cs_cpu; int cs_load; }; -#define CPU_SEARCH_LOWEST 0x1 -#define CPU_SEARCH_HIGHEST 0x2 -#define CPU_SEARCH_BOTH (CPU_SEARCH_LOWEST|CPU_SEARCH_HIGHEST) - -static __always_inline int cpu_search(const struct cpu_group *cg, - struct cpu_search *low, struct cpu_search *high, const int match); -int __noinline cpu_search_lowest(const struct cpu_group *cg, - struct cpu_search *low); -int __noinline cpu_search_highest(const struct cpu_group *cg, - struct cpu_search *high); -int __noinline cpu_search_both(const struct cpu_group *cg, - struct cpu_search *low, struct cpu_search *high); - -/* - * Search the tree of cpu_groups for the lowest or highest loaded cpu - * according to the match argument. This routine actually compares the - * load on all paths through the tree and finds the least loaded cpu on - * the least loaded path, which may differ from the least loaded cpu in - * the system. This balances work among caches and buses. - * - * This inline is instantiated in three forms below using constants for the - * match argument. It is reduced to the minimum set for each case. It is - * also recursive to the depth of the tree. - */ -static __always_inline int -cpu_search(const struct cpu_group *cg, struct cpu_search *low, - struct cpu_search *high, const int match) -{ - struct cpu_search lgroup; - struct cpu_search hgroup; - cpuset_t cpumask; - struct cpu_group *child; +/* + * Search the tree of cpu_groups for the lowest or highest loaded CPU. + * These routines actually compare the load on all paths through the tree + * and find the least loaded cpu on the least loaded path, which may differ + * from the least loaded cpu in the system. This balances work among caches + * and buses. + */ +static int +cpu_search_lowest(const struct cpu_group *cg, const struct cpu_search *s, + struct cpu_search_res *r) +{ + struct cpu_search_res lr; struct tdq *tdq; - int cpu, i, hload, lload, load, total, rnd; + int c, bload, l, load, total; total = 0; - cpumask = cg->cg_mask; - if (match & CPU_SEARCH_LOWEST) { - lload = INT_MAX; - lgroup = *low; - } - if (match & CPU_SEARCH_HIGHEST) { - hload = INT_MIN; - hgroup = *high; - } + bload = INT_MAX; + r->cs_cpu = -1; - /* Iterate through the child CPU groups and then remaining CPUs. */ - for (i = cg->cg_children, cpu = mp_maxid; ; ) { - if (i == 0) { -#ifdef HAVE_INLINE_FFSL - cpu = CPU_FFS(&cpumask) - 1; -#else - while (cpu >= 0 && !CPU_ISSET(cpu, &cpumask)) - cpu--; -#endif - if (cpu < 0) - break; - child = NULL; - } else - child = &cg->cg_child[i - 1]; - - if (match & CPU_SEARCH_LOWEST) - lgroup.cs_cpu = -1; - if (match & CPU_SEARCH_HIGHEST) - hgroup.cs_cpu = -1; - if (child) { /* Handle child CPU group. */ - CPU_ANDNOT(&cpumask, &child->cg_mask); - switch (match) { - case CPU_SEARCH_LOWEST: - load = cpu_search_lowest(child, &lgroup); - break; - case CPU_SEARCH_HIGHEST: - load = cpu_search_highest(child, &hgroup); - break; - case CPU_SEARCH_BOTH: - load = cpu_search_both(child, &lgroup, &hgroup); - break; - } - } else { /* Handle child CPU. */ - CPU_CLR(cpu, &cpumask); - tdq = TDQ_CPU(cpu); - load = tdq->tdq_load * 256; - rnd = sched_random() % 32; - if (match & CPU_SEARCH_LOWEST) { - if (cpu == low->cs_prefer) - load -= 64; - /* If that CPU is allowed and get data. */ - if (tdq->tdq_lowpri > lgroup.cs_pri && - tdq->tdq_load <= lgroup.cs_limit && - CPU_ISSET(cpu, &lgroup.cs_mask)) { - lgroup.cs_cpu = cpu; - lgroup.cs_load = load - rnd; - } + /* Loop through children CPU groups if there are any. */ + if (cg->cg_children > 0) { + for (c = cg->cg_children - 1; c >= 0; c--) { + load = cpu_search_lowest(&cg->cg_child[c], s, &lr); + total += load; + if (lr.cs_cpu >= 0 && (load < bload || + (load == bload && lr.cs_load < r->cs_load))) { + bload = load; + r->cs_cpu = lr.cs_cpu; + r->cs_load = lr.cs_load; } - if (match & CPU_SEARCH_HIGHEST) - if (tdq->tdq_load >= hgroup.cs_limit && - tdq->tdq_transferable && - CPU_ISSET(cpu, &hgroup.cs_mask)) { - hgroup.cs_cpu = cpu; - hgroup.cs_load = load - rnd; - } } - total += load; + return (total); + } - /* We have info about child item. Compare it. */ - if (match & CPU_SEARCH_LOWEST) { - if (lgroup.cs_cpu >= 0 && - (load < lload || - (load == lload && lgroup.cs_load < low->cs_load))) { - lload = load; - low->cs_cpu = lgroup.cs_cpu; - low->cs_load = lgroup.cs_load; - } - } - if (match & CPU_SEARCH_HIGHEST) - if (hgroup.cs_cpu >= 0 && - (load > hload || - (load == hload && hgroup.cs_load > high->cs_load))) { - hload = load; - high->cs_cpu = hgroup.cs_cpu; - high->cs_load = hgroup.cs_load; - } - if (child) { - i--; - if (i == 0 && CPU_EMPTY(&cpumask)) - break; + /* Loop through children CPUs otherwise. */ + for (c = cg->cg_last; c >= cg->cg_first; c--) { + if (!CPU_ISSET(c, &cg->cg_mask)) + continue; + tdq = TDQ_CPU(c); + l = tdq->tdq_load; + load = l * 256; + if (c == s->cs_prefer) + load -= 128; + total += load; + if (l > s->cs_limit || tdq->tdq_lowpri <= s->cs_pri || + !CPU_ISSET(c, s->cs_mask)) + continue; + load -= sched_random() % 128; + if (load < bload) { + bload = load; + r->cs_cpu = c; } -#ifndef HAVE_INLINE_FFSL - else - cpu--; -#endif } + r->cs_load = bload; return (total); } -/* - * cpu_search instantiations must pass constants to maintain the inline - * optimization. - */ -int -cpu_search_lowest(const struct cpu_group *cg, struct cpu_search *low) +static int +cpu_search_highest(const struct cpu_group *cg, const struct cpu_search *s, + struct cpu_search_res *r) { - return cpu_search(cg, low, NULL, CPU_SEARCH_LOWEST); -} + struct cpu_search_res lr; + struct tdq *tdq; + int c, bload, l, load, total; -int -cpu_search_highest(const struct cpu_group *cg, struct cpu_search *high) -{ - return cpu_search(cg, NULL, high, CPU_SEARCH_HIGHEST); -} + total = 0; + bload = INT_MIN; + r->cs_cpu = -1; -int -cpu_search_both(const struct cpu_group *cg, struct cpu_search *low, - struct cpu_search *high) -{ - return cpu_search(cg, low, high, CPU_SEARCH_BOTH); + /* Loop through children CPU groups if there are any. */ + if (cg->cg_children > 0) { + for (c = cg->cg_children - 1; c >= 0; c--) { + load = cpu_search_highest(&cg->cg_child[c], s, &lr); + total += load; + if (lr.cs_cpu >= 0 && (load > bload || + (load == bload && lr.cs_load > r->cs_load))) { + bload = load; + r->cs_cpu = lr.cs_cpu; + r->cs_load = lr.cs_load; + } + } + return (total); + } + + /* Loop through children CPUs otherwise. */ + for (c = cg->cg_last; c >= cg->cg_first; c--) { + if (!CPU_ISSET(c, &cg->cg_mask)) + continue; + tdq = TDQ_CPU(c); + l = tdq->tdq_load; + load = l * 256; + total += load; + if (l < s->cs_limit || !tdq->tdq_transferable || + !CPU_ISSET(c, s->cs_mask)) + continue; + load -= sched_random() % 128; + if (load > bload) { + bload = load; + r->cs_cpu = c; + } + } + r->cs_load = bload; + return (total); } /* @@ -803,33 +753,33 @@ cpu_search_both(const struct cpu_group *cg, struct cpu_search *low, * acceptable. */ static inline int -sched_lowest(const struct cpu_group *cg, cpuset_t mask, int pri, int maxload, +sched_lowest(const struct cpu_group *cg, cpuset_t *mask, int pri, int maxload, int prefer) { - struct cpu_search low; + struct cpu_search s; + struct cpu_search_res r; - low.cs_cpu = -1; - low.cs_prefer = prefer; - low.cs_mask = mask; - low.cs_pri = pri; - low.cs_limit = maxload; - cpu_search_lowest(cg, &low); - return low.cs_cpu; + s.cs_prefer = prefer; + s.cs_mask = mask; + s.cs_pri = pri; + s.cs_limit = maxload; + cpu_search_lowest(cg, &s, &r); + return (r.cs_cpu); } /* * Find the cpu with the highest load via the highest loaded path. */ static inline int -sched_highest(const struct cpu_group *cg, cpuset_t mask, int minload) +sched_highest(const struct cpu_group *cg, cpuset_t *mask, int minload) { - struct cpu_search high; + struct cpu_search s; + struct cpu_search_res r; - high.cs_cpu = -1; - high.cs_mask = mask; - high.cs_limit = minload; - cpu_search_highest(cg, &high); - return high.cs_cpu; + s.cs_mask = mask; + s.cs_limit = minload; + cpu_search_highest(cg, &s, &r); + return (r.cs_cpu); } static void @@ -841,7 +791,7 @@ sched_balance_group(struct cpu_group *cg) CPU_FILL(&hmask); for (;;) { - high = sched_highest(cg, hmask, 2); + high = sched_highest(cg, &hmask, 2); /* Stop if there is no more CPU with transferrable threads. */ if (high == -1) break; @@ -853,7 +803,7 @@ sched_balance_group(struct cpu_group *cg) anylow = 1; tdq = TDQ_CPU(high); nextlow: - low = sched_lowest(cg, lmask, -1, tdq->tdq_load - 1, high); + low = sched_lowest(cg, &lmask, -1, tdq->tdq_load - 1, high); /* Stop if we looked well and found no less loaded CPU. */ if (anylow && low == -1) break; @@ -995,7 +945,7 @@ tdq_idled(struct tdq *tdq) restart: switchcnt = tdq->tdq_switchcnt + tdq->tdq_oldswitchcnt; for (cg = tdq->tdq_cg; ; ) { - cpu = sched_highest(cg, mask, steal_thresh); + cpu = sched_highest(cg, &mask, steal_thresh); /* * We were assigned a thread but not preempted. Returning * 0 here will cause our caller to switch to it. @@ -1244,7 +1194,7 @@ sched_pickcpu(struct thread *td, int flags) struct cpu_group *cg, *ccg; struct td_sched *ts; struct tdq *tdq; - cpuset_t mask; + cpuset_t *mask; int cpu, pri, self, intr; self = PCPU_GET(cpuid); @@ -1287,14 +1237,14 @@ sched_pickcpu(struct thread *td, int flags) SCHED_AFFINITY(ts, CG_SHARE_L2)) { if (cg->cg_flags & CG_FLAG_THREAD) { /* Check all SMT threads for being idle. */ - for (cpu = CPU_FFS(&cg->cg_mask) - 1; ; cpu++) { + for (cpu = cg->cg_first; cpu <= cg->cg_last; cpu++) { if (CPU_ISSET(cpu, &cg->cg_mask) && TDQ_CPU(cpu)->tdq_lowpri < PRI_MIN_IDLE) break; - if (cpu >= mp_maxid) { - SCHED_STAT_INC(pickcpu_idle_affinity); - return (ts->ts_cpu); - } + } + if (cpu > cg->cg_last) { + SCHED_STAT_INC(pickcpu_idle_affinity); + return (ts->ts_cpu); } } else { SCHED_STAT_INC(pickcpu_idle_affinity); @@ -1321,7 +1271,7 @@ llc: if (ccg == cpu_top) ccg = NULL; cpu = -1; - mask = td->td_cpuset->cs_mask; + mask = &td->td_cpuset->cs_mask; pri = td->td_priority; /* * Try hard to keep interrupts within found LLC. Search the LLC for @@ -1931,7 +1881,7 @@ tdq_trysteal(struct tdq *tdq) spinlock_enter(); TDQ_UNLOCK(tdq); for (i = 1, cg = tdq->tdq_cg; ; ) { - cpu = sched_highest(cg, mask, steal_thresh); + cpu = sched_highest(cg, &mask, steal_thresh); /* * If a thread was added while interrupts were disabled don't * steal one here. @@ -3002,7 +2952,7 @@ sysctl_kern_sched_topology_spec_internal(struct sbuf *sb, struct cpu_group *cg, sbuf_printf(sb, "%*s ", indent, "", cg->cg_count, cpusetobj_strprint(cpusetbuf, &cg->cg_mask)); first = TRUE; - for (i = 0; i < MAXCPU; i++) { + for (i = cg->cg_first; i <= cg->cg_last; i++) { if (CPU_ISSET(i, &cg->cg_mask)) { if (!first) sbuf_printf(sb, ", "); diff --git a/sys/kern/subr_smp.c b/sys/kern/subr_smp.c index 935fb6ee977c..bfe890d773f9 100644 --- a/sys/kern/subr_smp.c +++ b/sys/kern/subr_smp.c @@ -630,6 +630,17 @@ smp_rendezvous(void (* setup_func)(void *), static struct cpu_group group[MAXCPU * MAX_CACHE_LEVELS + 1]; +static void +smp_topo_fill(struct cpu_group *cg) +{ + int c; + + for (c = 0; c < cg->cg_children; c++) + smp_topo_fill(&cg->cg_child[c]); + cg->cg_first = CPU_FFS(&cg->cg_mask) - 1; + cg->cg_last = CPU_FLS(&cg->cg_mask) - 1; +} + struct cpu_group * smp_topo(void) { @@ -693,6 +704,7 @@ smp_topo(void) top = &top->cg_child[0]; top->cg_parent = NULL; } + smp_topo_fill(top); return (top); } diff --git a/sys/sys/smp.h b/sys/sys/smp.h index a971ffbbd91b..cee1199015a7 100644 --- a/sys/sys/smp.h +++ b/sys/sys/smp.h @@ -81,6 +81,8 @@ struct cpu_group { struct cpu_group *cg_child; /* Optional children groups. */ cpuset_t cg_mask; /* Mask of cpus in this group. */ int32_t cg_count; /* Count of cpus in this group. */ + int32_t cg_first; /* First cpu in this group. */ + int32_t cg_last; /* Last cpu in this group. */ int16_t cg_children; /* Number of children groups. */ int8_t cg_level; /* Shared cache level. */ int8_t cg_flags; /* Traversal modifiers. */ From owner-dev-commits-src-all@freebsd.org Thu Jul 29 02:55: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 9768B669D96; Thu, 29 Jul 2021 02:55: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 4GZw9x3rkqz4mZS; Thu, 29 Jul 2021 02:55: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 6C3E21E03; Thu, 29 Jul 2021 02:55: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 16T2t10m009361; Thu, 29 Jul 2021 02:55:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16T2t1dd009360; Thu, 29 Jul 2021 02:55:01 GMT (envelope-from git) Date: Thu, 29 Jul 2021 02:55:01 GMT Message-Id: <202107290255.16T2t1dd009360@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: 6b51baf6a8de - main - cli.lua.8: make the command match the code 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: 6b51baf6a8de7241a4e1b0c8436d70299cd55270 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, 29 Jul 2021 02:55:01 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=6b51baf6a8de7241a4e1b0c8436d70299cd55270 commit 6b51baf6a8de7241a4e1b0c8436d70299cd55270 Author: Warner Losh AuthorDate: 2021-07-29 02:53:18 +0000 Commit: Warner Losh CommitDate: 2021-07-29 02:54:14 +0000 cli.lua.8: make the command match the code It's disable-device, not device-disable Spotted by: jrtc27 Sponsored by: Netflix --- stand/lua/cli.lua.8 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stand/lua/cli.lua.8 b/stand/lua/cli.lua.8 index fe1cd0450557..2d6df3fd4e6b 100644 --- a/stand/lua/cli.lua.8 +++ b/stand/lua/cli.lua.8 @@ -91,7 +91,7 @@ module provides the following default commands: .It .Ic reload-conf .It -.Ic device-disable +.Ic disable-device .It .Ic disable-module .It @@ -135,7 +135,7 @@ command will dump the list of modules that loader has been made aware of and any applicable options using paged output. .Pp The -.Ic device-disable +.Ic disable-device command sets the environment variable that disables the device argument. .Ss Exported Functions The following functions are exported from From owner-dev-commits-src-all@freebsd.org Thu Jul 29 03:22: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 82A0866A413; Thu, 29 Jul 2021 03:22: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 4GZwnl2w4mz4pB4; Thu, 29 Jul 2021 03:22: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 4C8E720DA; Thu, 29 Jul 2021 03:22: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 16T3MZVu050521; Thu, 29 Jul 2021 03:22:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16T3MZ08050520; Thu, 29 Jul 2021 03:22:35 GMT (envelope-from git) Date: Thu, 29 Jul 2021 03:22:35 GMT Message-Id: <202107290322.16T3MZ08050520@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: e3707726c168 - main - kern: remove deprecated makesyscalls.sh 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: e3707726c168eeb0ba06d13873dd71590b77d604 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, 29 Jul 2021 03:22:35 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=e3707726c168eeb0ba06d13873dd71590b77d604 commit e3707726c168eeb0ba06d13873dd71590b77d604 Author: Kyle Evans AuthorDate: 2021-07-29 03:18:13 +0000 Commit: Kyle Evans CommitDate: 2021-07-29 03:22:23 +0000 kern: remove deprecated makesyscalls.sh makesyscalls was rewritten in Lua and introduced in d3276301ab. In the time since, no objections have risen and a warning was introduced long ago on invocation of makesyscalls.sh that it would be removed before FreeBSD 13. Belatedly follow through on that. --- sys/kern/makesyscalls.sh | 805 ----------------------------------------------- 1 file changed, 805 deletions(-) diff --git a/sys/kern/makesyscalls.sh b/sys/kern/makesyscalls.sh deleted file mode 100644 index 8cbd00a69fcd..000000000000 --- a/sys/kern/makesyscalls.sh +++ /dev/null @@ -1,805 +0,0 @@ -#! /bin/sh - -# @(#)makesyscalls.sh 8.1 (Berkeley) 6/10/93 -# $FreeBSD$ - -set -e - -# name of compat options: -compat=COMPAT_43 -compat4=COMPAT_FREEBSD4 -compat6=COMPAT_FREEBSD6 -compat7=COMPAT_FREEBSD7 -compat10=COMPAT_FREEBSD10 -compat11=COMPAT_FREEBSD11 -compat12=COMPAT_FREEBSD12 - -# output files: -sysnames="syscalls.c" -sysproto="../sys/sysproto.h" -sysproto_h=_SYS_SYSPROTO_H_ -syshdr="../sys/syscall.h" -sysmk="../sys/syscall.mk" -syssw="init_sysent.c" -syscallprefix="SYS_" -switchname="sysent" -namesname="syscallnames" -systrace="systrace_args.c" - -# tmp files: -sysaue="sysent.aue.$$" -sysdcl="sysent.dcl.$$" -syscompat="sysent.compat.$$" -syscompatdcl="sysent.compatdcl.$$" -syscompat4="sysent.compat4.$$" -syscompat4dcl="sysent.compat4dcl.$$" -syscompat6="sysent.compat6.$$" -syscompat6dcl="sysent.compat6dcl.$$" -syscompat7="sysent.compat7.$$" -syscompat7dcl="sysent.compat7dcl.$$" -syscompat10="sysent.compat10.$$" -syscompat10dcl="sysent.compat10dcl.$$" -syscompat11="sysent.compat11.$$" -syscompat11dcl="sysent.compat11dcl.$$" -syscompat12="sysent.compat12.$$" -syscompat12dcl="sysent.compat12dcl.$$" -sysent="sysent.switch.$$" -sysinc="sysinc.switch.$$" -sysarg="sysarg.switch.$$" -sysprotoend="sysprotoend.$$" -systracetmp="systrace.$$" -systraceret="systraceret.$$" -capabilities_conf="capabilities.conf" - -trap "rm $sysaue $sysdcl $syscompat $syscompatdcl $syscompat4 $syscompat4dcl $syscompat6 $syscompat6dcl $syscompat7 $syscompat7dcl $syscompat10 $syscompat10dcl $syscompat11 $syscompat11dcl $syscompat12 $syscompat12dcl $sysent $sysinc $sysarg $sysprotoend $systracetmp $systraceret" 0 - -touch $sysaue $sysdcl $syscompat $syscompatdcl $syscompat4 $syscompat4dcl $syscompat6 $syscompat6dcl $syscompat7 $syscompat7dcl $syscompat10 $syscompat10dcl $syscompat11 $syscompat11dcl $syscompat12 $syscompat12dcl $sysent $sysinc $sysarg $sysprotoend $systracetmp $systraceret - -case $# in - 0) echo "usage: $0 input-file " 1>&2 - exit 1 - ;; -esac - -1>&2 echo "$0: This script has been replaced by sys/tools/makesyscalls.lua and" -1>&2 echo "$0: will be removed before FreeBSD 13. See also: sys/conf/sysent.mk" - -if [ -n "$2" ]; then - . "$2" -fi - -if [ -n "$capenabled" ]; then - # do nothing -elif [ -r $capabilities_conf ]; then - capenabled=`egrep -v '^#|^$' $capabilities_conf` - capenabled=`echo $capenabled | sed 's/ /,/g'` -else - capenabled="" -fi - -sed -e ' - # FreeBSD ID, includes, comments, and blank lines - /.*\$FreeBSD/b done_joining - /^[#;]/b done_joining - /^$/b done_joining - - # Join lines ending in backslash -:joining - /\\$/{a\ - - N - s/\\\n// - b joining - } - - # OBSOL, etc lines without function signatures - /^[0-9][^{]*$/b done_joining - - # Join incomplete signatures. The { must appear on the first line - # and the } must appear on the last line (modulo lines joined by - # backslashes). - /^[^}]*$/{a\ - - N - s/\n// - b joining - } -:done_joining -2,${ - /^#/!s/\([{}()*,]\)/ \1 /g -} -' < $1 | awk " - BEGIN { - sysaue = \"$sysaue\" - sysdcl = \"$sysdcl\" - sysproto = \"$sysproto\" - sysprotoend = \"$sysprotoend\" - sysproto_h = \"$sysproto_h\" - syscompat = \"$syscompat\" - syscompatdcl = \"$syscompatdcl\" - syscompat4 = \"$syscompat4\" - syscompat4dcl = \"$syscompat4dcl\" - syscompat6 = \"$syscompat6\" - syscompat6dcl = \"$syscompat6dcl\" - syscompat7 = \"$syscompat7\" - syscompat7dcl = \"$syscompat7dcl\" - syscompat10 = \"$syscompat10\" - syscompat10dcl = \"$syscompat10dcl\" - syscompat11 = \"$syscompat11\" - syscompat11dcl = \"$syscompat11dcl\" - syscompat12 = \"$syscompat12\" - syscompat12dcl = \"$syscompat12dcl\" - sysent = \"$sysent\" - syssw = \"$syssw\" - sysinc = \"$sysinc\" - sysarg = \"$sysarg\" - sysnames = \"$sysnames\" - syshdr = \"$syshdr\" - sysmk = \"$sysmk\" - systrace = \"$systrace\" - systracetmp = \"$systracetmp\" - systraceret = \"$systraceret\" - compat = \"$compat\" - compat4 = \"$compat4\" - compat6 = \"$compat6\" - compat7 = \"$compat7\" - compat10 = \"$compat10\" - compat11 = \"$compat11\" - compat12 = \"$compat12\" - syscallprefix = \"$syscallprefix\" - switchname = \"$switchname\" - namesname = \"$namesname\" - infile = \"$1\" - abi_func_prefix = \"$abi_func_prefix\" - capenabled_string = \"$capenabled\" - "' - - # Avoid a literal generated file tag here. - generated = "@" "generated"; - - split(capenabled_string, capenabled, ","); - - printf "\n/* The casts are bogus but will do for now. */\n" > sysent - printf "struct sysent %s[] = {\n",switchname > sysent - - printf "/*\n * System call switch table.\n *\n" > syssw - printf " * DO NOT EDIT-- this file is automatically " generated ".\n" > syssw - printf " * $%s$\n", "FreeBSD" > syssw - printf " */\n\n" > syssw - - printf "/*\n * System call prototypes.\n *\n" > sysarg - printf " * DO NOT EDIT-- this file is automatically " generated ".\n" > sysarg - printf " * $%s$\n", "FreeBSD" > sysarg - printf " */\n\n" > sysarg - printf "#ifndef %s\n", sysproto_h > sysarg - printf "#define\t%s\n\n", sysproto_h > sysarg - printf "#include \n" > sysarg - printf "#include \n" > sysarg - printf "#include \n" > sysarg - printf "#include \n" > sysarg - printf "#include \n" > sysarg - printf "#include \n" > sysarg - printf "#include \n" > sysarg - printf "#include \n\n" > sysarg - printf "#include \n\n" > sysarg - printf "struct proc;\n\n" > sysarg - printf "struct thread;\n\n" > sysarg - printf "#define\tPAD_(t)\t(sizeof(register_t) <= sizeof(t) ? \\\n" > sysarg - printf "\t\t0 : sizeof(register_t) - sizeof(t))\n\n" > sysarg - printf "#if BYTE_ORDER == LITTLE_ENDIAN\n"> sysarg - printf "#define\tPADL_(t)\t0\n" > sysarg - printf "#define\tPADR_(t)\tPAD_(t)\n" > sysarg - printf "#else\n" > sysarg - printf "#define\tPADL_(t)\tPAD_(t)\n" > sysarg - printf "#define\tPADR_(t)\t0\n" > sysarg - printf "#endif\n\n" > sysarg - - printf "\n#ifdef %s\n\n", compat > syscompat - printf "\n#ifdef %s\n\n", compat4 > syscompat4 - printf "\n#ifdef %s\n\n", compat6 > syscompat6 - printf "\n#ifdef %s\n\n", compat7 > syscompat7 - printf "\n#ifdef %s\n\n", compat10 > syscompat10 - printf "\n#ifdef %s\n\n", compat11 > syscompat11 - printf "\n#ifdef %s\n\n", compat12 > syscompat12 - - printf "/*\n * System call names.\n *\n" > sysnames - printf " * DO NOT EDIT-- this file is automatically " generated ".\n" > sysnames - printf " * $%s$\n", "FreeBSD" > sysnames - printf " */\n\n" > sysnames - printf "const char *%s[] = {\n", namesname > sysnames - - printf "/*\n * System call numbers.\n *\n" > syshdr - printf " * DO NOT EDIT-- this file is automatically " generated ".\n" > syshdr - printf " * $%s$\n", "FreeBSD" > syshdr - printf " */\n\n" > syshdr - - printf "# FreeBSD system call object files.\n" > sysmk - printf "# DO NOT EDIT-- this file is automatically " generated ".\n" > sysmk - printf "# $%s$\n", "FreeBSD" > sysmk - printf "MIASM = " > sysmk - - printf "/*\n * System call argument to DTrace register array converstion.\n *\n" > systrace - printf " * DO NOT EDIT-- this file is automatically " generated ".\n" > systrace - printf " * $%s$\n", "FreeBSD" > systrace - printf " * This file is part of the DTrace syscall provider.\n */\n\n" > systrace - printf "static void\nsystrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)\n{\n" > systrace - printf "\tint64_t *iarg = (int64_t *) uarg;\n" > systrace - printf "\tswitch (sysnum) {\n" > systrace - - printf "static void\nsystrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)\n{\n\tconst char *p = NULL;\n" > systracetmp - printf "\tswitch (sysnum) {\n" > systracetmp - - printf "static void\nsystrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)\n{\n\tconst char *p = NULL;\n" > systraceret - printf "\tswitch (sysnum) {\n" > systraceret - } - NR == 1 { - next - } - NF == 0 || $1 ~ /^;/ { - next - } - $1 ~ /^#[ ]*include/ { - print > sysinc - next - } - $1 ~ /^#[ ]*if/ { - print > sysent - print > sysdcl - print > sysarg - print > syscompat - print > syscompat4 - print > syscompat6 - print > syscompat7 - print > syscompat10 - print > syscompat11 - print > syscompat12 - print > sysnames - print > systrace - print > systracetmp - print > systraceret - savesyscall = syscall - next - } - $1 ~ /^#[ ]*else/ { - print > sysent - print > sysdcl - print > sysarg - print > syscompat - print > syscompat4 - print > syscompat6 - print > syscompat7 - print > syscompat10 - print > syscompat11 - print > syscompat12 - print > sysnames - print > systrace - print > systracetmp - print > systraceret - syscall = savesyscall - next - } - $1 ~ /^#/ { - print > sysent - print > sysdcl - print > sysarg - print > syscompat - print > syscompat4 - print > syscompat6 - print > syscompat7 - print > syscompat10 - print > syscompat11 - print > syscompat12 - print > sysnames - print > systrace - print > systracetmp - print > systraceret - next - } - # Returns true if the type "name" is the first flag in the type field - function type(name, flags, n) { - n = split($3, flags, /\|/) - return (n > 0 && flags[1] == name) - } - # Returns true if the flag "name" is set in the type field - function flag(name, flags, i, n) { - n = split($3, flags, /\|/) - for (i = 1; i <= n; i++) - if (flags[i] == name) - return 1 - return 0 - } - { - n = split($1, syscall_range, /-/) - if (n == 1) { - syscall_range[2] = syscall_range[1] - } else if (n == 2) { - if (!type("UNIMPL")) { - printf "%s: line %d: range permitted only with UNIMPL\n", - infile, NR - exit 1 - } - } else { - printf "%s: line %d: invalid syscall number or range %s\n", - infile, NR, $1 - exit 1 - } - } - syscall != syscall_range[1] { - printf "%s: line %d: syscall number out of sync at %d\n", - infile, NR, syscall - printf "line is:\n" - print - exit 1 - } - function align_sysent_comment(column) { - printf("\t") > sysent - column = column + 8 - column % 8 - while (column < 56) { - printf("\t") > sysent - column = column + 8 - } - } - function parserr(was, wanted) { - printf "%s: line %d: unexpected %s (expected %s)\n", - infile, NR, was, wanted - exit 1 - } - function parseline() { - f=4 # toss number, type, audit event - ret_inc = 0 - argc= 0; - argssize = "0" - thr_flag = "SY_THR_STATIC" - if (flag("NOTSTATIC")) { - thr_flag = "SY_THR_ABSENT" - } - if ($NF != "}") { - funcalias=$(NF-2) - argalias=$(NF-1) - rettype=$NF - end=NF-3 - } else { - funcalias="" - argalias="" - rettype="int" - if ($(f+2) == "*") { - ret_inc = 1 - } - end=NF - } - if (flag("NODEF")) { - auditev="AUE_NULL" - funcname=$(4 + ret_inc) - argssize = "AS(" $(6 + ret_inc) ")" - return - } - if ($f != "{") - parserr($f, "{") - f++ - if ($end != "}") - parserr($end, "}") - end-- - if ($end != ";") - parserr($end, ";") - end-- - if ($end != ")") - parserr($end, ")") - end-- - - syscallret=$f - f++ - while (ret_inc > 0) { - syscallret=syscallret " " $f - f++ - ret_inc-- - } - - funcname=$f - - # - # We now know the func name, so define a flags field for it. - # Do this before any other processing as we may return early - # from it. - # - for (cap in capenabled) { - if (funcname == capenabled[cap] || - funcname == abi_func_prefix capenabled[cap]) { - flags = "SYF_CAPENABLED"; - break; - } - } - - if (funcalias == "") - funcalias = funcname - if (argalias == "") { - argalias = funcname "_args" - if (flag("COMPAT")) - argalias = "o" argalias - if (flag("COMPAT4")) - argalias = "freebsd4_" argalias - if (flag("COMPAT6")) - argalias = "freebsd6_" argalias - if (flag("COMPAT7")) - argalias = "freebsd7_" argalias - if (flag("COMPAT10")) - argalias = "freebsd10_" argalias - if (flag("COMPAT11")) - argalias = "freebsd11_" argalias - if (flag("COMPAT12")) - argalias = "freebsd12_" argalias - } - f++ - - if ($f != "(") - parserr($f, ")") - f++ - - if (f == end) { - if ($f != "void") - parserr($f, "argument definition") - return - } - - while (f <= end) { - argc++ - argtype[argc]="" - oldf="" - while (f < end && $(f+1) != ",") { - if (argtype[argc] != "" && oldf != "*") - argtype[argc] = argtype[argc]" "; - argtype[argc] = argtype[argc]$f; - oldf = $f; - f++ - } - if (argtype[argc] == "") - parserr($f, "argument definition") - - # The parser adds space around parens. - # Remove it from annotations. - gsub(/ \( /, "(", argtype[argc]); - gsub(/ \)/, ")", argtype[argc]); - - #remove annotations - gsub(/_In[^ ]*[_)] /, "", argtype[argc]); - gsub(/_Out[^ ]*[_)] /, "", argtype[argc]); - - argname[argc]=$f; - f += 2; # skip name, and any comma - } - if (argc != 0) - argssize = "AS(" argalias ")" - } - { comment = $4 - if (NF < 7) - for (i = 5; i <= NF; i++) - comment = comment " " $i - } - - # - # The AUE_ audit event identifier. - # - { - auditev = $2; - } - - # - # The flags, if any. - # - { - flags = "0"; - } - - type("STD") || type("NODEF") || type("NOARGS") || type("NOPROTO") \ - || type("NOSTD") { - parseline() - printf("\t/* %s */\n\tcase %d: {\n", funcname, syscall) > systrace - printf("\t/* %s */\n\tcase %d:\n", funcname, syscall) > systracetmp - printf("\t/* %s */\n\tcase %d:\n", funcname, syscall) > systraceret - if (argc > 0) { - printf("\t\tswitch(ndx) {\n") > systracetmp - printf("\t\tstruct %s *p = params;\n", argalias) > systrace - for (i = 1; i <= argc; i++) { - arg = argtype[i] - sub("__restrict$", "", arg) - if (index(arg, "*") > 0) - printf("\t\tcase %d:\n\t\t\tp = \"userland %s\";\n\t\t\tbreak;\n", i - 1, arg) > systracetmp - else - printf("\t\tcase %d:\n\t\t\tp = \"%s\";\n\t\t\tbreak;\n", i - 1, arg) > systracetmp - if (index(arg, "*") > 0 || arg == "caddr_t") - printf("\t\tuarg[%d] = (intptr_t) p->%s; /* %s */\n", \ - i - 1, \ - argname[i], arg) > systrace - else if (arg == "union l_semun") - printf("\t\tuarg[%d] = p->%s.buf; /* %s */\n", \ - i - 1, \ - argname[i], arg) > systrace - else if (substr(arg, 1, 1) == "u" || arg == "size_t") - printf("\t\tuarg[%d] = p->%s; /* %s */\n", \ - i - 1, \ - argname[i], arg) > systrace - else - printf("\t\tiarg[%d] = p->%s; /* %s */\n", \ - i - 1, \ - argname[i], arg) > systrace - } - printf("\t\tdefault:\n\t\t\tbreak;\n\t\t};\n") > systracetmp - - printf("\t\tif (ndx == 0 || ndx == 1)\n") > systraceret - printf("\t\t\tp = \"%s\";\n", syscallret) > systraceret - printf("\t\tbreak;\n") > systraceret - } - printf("\t\t*n_args = %d;\n\t\tbreak;\n\t}\n", argc) > systrace - printf("\t\tbreak;\n") > systracetmp - if (!flag("NOARGS") && !flag("NOPROTO") && !flag("NODEF")) { - if (argc != 0) { - printf("struct %s {\n", argalias) > sysarg - for (i = 1; i <= argc; i++) - printf("\tchar %s_l_[PADL_(%s)]; " \ - "%s %s; char %s_r_[PADR_(%s)];\n", - argname[i], argtype[i], - argtype[i], argname[i], - argname[i], argtype[i]) > sysarg - printf("};\n") > sysarg - } else - printf("struct %s {\n\tregister_t dummy;\n};\n", - argalias) > sysarg - } - if (!flag("NOPROTO") && !flag("NODEF")) { - if (funcname == "nosys" || funcname == "lkmnosys" || - funcname == "sysarch" || funcname ~ /^freebsd/ || - funcname ~ /^linux/ || funcname ~ /^cloudabi/) { - printf("%s\t%s(struct thread *, struct %s *)", - rettype, funcname, argalias) > sysdcl - } else { - printf("%s\tsys_%s(struct thread *, struct %s *)", - rettype, funcname, argalias) > sysdcl - } - printf(";\n") > sysdcl - printf("#define\t%sAUE_%s\t%s\n", syscallprefix, - funcalias, auditev) > sysaue - } - printf("\t{ %s, (sy_call_t *)", argssize) > sysent - column = 8 + 2 + length(argssize) + 15 - if (flag("NOSTD")) { - printf("lkmressys, AUE_NULL, NULL, 0, 0, %s, SY_THR_ABSENT },", flags) > sysent - column = column + length("lkmressys") + length("AUE_NULL") + 3 - } else { - if (funcname == "nosys" || funcname == "sysarch" || - funcname == "lkmnosys" || funcname ~ /^freebsd/ || - funcname ~ /^linux/ || funcname ~ /^cloudabi/) { - printf("%s, %s, NULL, 0, 0, %s, %s },", funcname, auditev, flags, thr_flag) > sysent - column = column + length(funcname) + length(auditev) + length(flags) + 3 - } else { - printf("sys_%s, %s, NULL, 0, 0, %s, %s },", funcname, auditev, flags, thr_flag) > sysent - column = column + length(funcname) + length(auditev) + length(flags) + 3 + 4 - } - } - align_sysent_comment(column) - printf("/* %d = %s */\n", syscall, funcalias) > sysent - printf("\t\"%s\",\t\t\t/* %d = %s */\n", - funcalias, syscall, funcalias) > sysnames - if (!flag("NODEF")) { - printf("#define\t%s%s\t%d\n", syscallprefix, - funcalias, syscall) > syshdr - printf(" \\\n\t%s.o", funcalias) > sysmk - } - syscall++ - next - } - type("COMPAT") || type("COMPAT4") || type("COMPAT6") || \ - type("COMPAT7") || type("COMPAT10") || type("COMPAT11") || \ - type("COMPAT12") { - if (flag("COMPAT")) { - ncompat++ - out = syscompat - outdcl = syscompatdcl - wrap = "compat" - prefix = "o" - descr = "old" - } else if (flag("COMPAT4")) { - ncompat4++ - out = syscompat4 - outdcl = syscompat4dcl - wrap = "compat4" - prefix = "freebsd4_" - descr = "freebsd4" - } else if (flag("COMPAT6")) { - ncompat6++ - out = syscompat6 - outdcl = syscompat6dcl - wrap = "compat6" - prefix = "freebsd6_" - descr = "freebsd6" - } else if (flag("COMPAT7")) { - ncompat7++ - out = syscompat7 - outdcl = syscompat7dcl - wrap = "compat7" - prefix = "freebsd7_" - descr = "freebsd7" - } else if (flag("COMPAT10")) { - ncompat10++ - out = syscompat10 - outdcl = syscompat10dcl - wrap = "compat10" - prefix = "freebsd10_" - descr = "freebsd10" - } else if (flag("COMPAT11")) { - ncompat11++ - out = syscompat11 - outdcl = syscompat11dcl - wrap = "compat11" - prefix = "freebsd11_" - descr = "freebsd11" - } else if (flag("COMPAT12")) { - ncompat12++ - out = syscompat12 - outdcl = syscompat12dcl - wrap = "compat12" - prefix = "freebsd12_" - descr = "freebsd12" - } - parseline() - if (argc != 0 && !flag("NOARGS") && !flag("NOPROTO") && \ - !flag("NODEF")) { - printf("struct %s {\n", argalias) > out - for (i = 1; i <= argc; i++) - printf("\tchar %s_l_[PADL_(%s)]; %s %s; " \ - "char %s_r_[PADR_(%s)];\n", - argname[i], argtype[i], - argtype[i], argname[i], - argname[i], argtype[i]) > out - printf("};\n") > out - } - else if (!flag("NOARGS") && !flag("NOPROTO") && !flag("NODEF")) - printf("struct %s {\n\tregister_t dummy;\n};\n", - argalias) > sysarg - if (!flag("NOPROTO") && !flag("NODEF")) { - printf("%s\t%s%s(struct thread *, struct %s *);\n", - rettype, prefix, funcname, argalias) > outdcl - printf("#define\t%sAUE_%s%s\t%s\n", syscallprefix, - prefix, funcname, auditev) > sysaue - } - if (flag("NOSTD")) { - printf("\t{ %s, (sy_call_t *)%s, %s, NULL, 0, 0, 0, SY_THR_ABSENT },", - "0", "lkmressys", "AUE_NULL") > sysent - align_sysent_comment(8 + 2 + length("0") + 15 + \ - length("lkmressys") + length("AUE_NULL") + 3) - } else { - printf("\t{ %s(%s,%s), %s, NULL, 0, 0, %s, %s },", - wrap, argssize, funcname, auditev, flags, thr_flag) > sysent - align_sysent_comment(8 + 9 + length(argssize) + 1 + \ - length(funcname) + length(auditev) + \ - length(flags) + 4) - } - printf("/* %d = %s %s */\n", syscall, descr, funcalias) > sysent - printf("\t\"%s.%s\",\t\t/* %d = %s %s */\n", - wrap, funcalias, syscall, descr, funcalias) > sysnames - # Do not provide freebsdN_* symbols in libc for < FreeBSD 7 - if (flag("COMPAT") || flag("COMPAT4") || flag("COMPAT6")) { - printf("\t\t\t\t/* %d is %s %s */\n", - syscall, descr, funcalias) > syshdr - } else if (!flag("NODEF")) { - printf("#define\t%s%s%s\t%d\n", syscallprefix, - prefix, funcalias, syscall) > syshdr - printf(" \\\n\t%s%s.o", prefix, funcalias) > sysmk - } - syscall++ - next - } - type("OBSOL") { - printf("\t{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT },") > sysent - align_sysent_comment(34) - printf("/* %d = obsolete %s */\n", syscall, comment) > sysent - printf("\t\"obs_%s\",\t\t\t/* %d = obsolete %s */\n", - $4, syscall, comment) > sysnames - printf("\t\t\t\t/* %d is obsolete %s */\n", - syscall, comment) > syshdr - syscall++ - next - } - type("UNIMPL") { - while (syscall <= syscall_range[2]) { - printf("\t{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT },\t\t\t/* %d = %s */\n", - syscall, comment) > sysent - printf("\t\"#%d\",\t\t\t/* %d = %s */\n", - syscall, syscall, comment) > sysnames - syscall++ - } - next - } - { - printf "%s: line %d: unrecognized keyword %s\n", infile, NR, $3 - exit 1 - } - END { - printf "\n#define AS(name) (sizeof(struct name) / sizeof(register_t))\n" > sysinc - - if (ncompat != 0) { - printf "\n#ifdef %s\n", compat > sysinc - printf "#define compat(n, name) n, (sy_call_t *)__CONCAT(o,name)\n" > sysinc - printf "#else\n" > sysinc - printf "#define compat(n, name) 0, (sy_call_t *)nosys\n" > sysinc - printf "#endif\n" > sysinc - } - - if (ncompat4 != 0) { - printf "\n#ifdef %s\n", compat4 > sysinc - printf "#define compat4(n, name) n, (sy_call_t *)__CONCAT(freebsd4_,name)\n" > sysinc - printf "#else\n" > sysinc - printf "#define compat4(n, name) 0, (sy_call_t *)nosys\n" > sysinc - printf "#endif\n" > sysinc - } - - if (ncompat6 != 0) { - printf "\n#ifdef %s\n", compat6 > sysinc - printf "#define compat6(n, name) n, (sy_call_t *)__CONCAT(freebsd6_,name)\n" > sysinc - printf "#else\n" > sysinc - printf "#define compat6(n, name) 0, (sy_call_t *)nosys\n" > sysinc - printf "#endif\n" > sysinc - } - - if (ncompat7 != 0) { - printf "\n#ifdef %s\n", compat7 > sysinc - printf "#define compat7(n, name) n, (sy_call_t *)__CONCAT(freebsd7_,name)\n" > sysinc - printf "#else\n" > sysinc - printf "#define compat7(n, name) 0, (sy_call_t *)nosys\n" > sysinc - printf "#endif\n" > sysinc - } - if (ncompat10 != 0) { - printf "\n#ifdef %s\n", compat10 > sysinc - printf "#define compat10(n, name) n, (sy_call_t *)__CONCAT(freebsd10_,name)\n" > sysinc - printf "#else\n" > sysinc - printf "#define compat10(n, name) 0, (sy_call_t *)nosys\n" > sysinc - printf "#endif\n" > sysinc - } - if (ncompat11 != 0) { - printf "\n#ifdef %s\n", compat11 > sysinc - printf "#define compat11(n, name) n, (sy_call_t *)__CONCAT(freebsd11_,name)\n" > sysinc - printf "#else\n" > sysinc - printf "#define compat11(n, name) 0, (sy_call_t *)nosys\n" > sysinc - printf "#endif\n" > sysinc - } - if (ncompat12 != 0) { - printf "\n#ifdef %s\n", compat12 > sysinc - printf "#define compat12(n, name) n, (sy_call_t *)__CONCAT(freebsd12_,name)\n" > sysinc - printf "#else\n" > sysinc - printf "#define compat12(n, name) 0, (sy_call_t *)nosys\n" > sysinc - printf "#endif\n" > sysinc - } - - printf("\n#endif /* %s */\n\n", compat) > syscompatdcl - printf("\n#endif /* %s */\n\n", compat4) > syscompat4dcl - printf("\n#endif /* %s */\n\n", compat6) > syscompat6dcl - printf("\n#endif /* %s */\n\n", compat7) > syscompat7dcl - printf("\n#endif /* %s */\n\n", compat10) > syscompat10dcl - printf("\n#endif /* %s */\n\n", compat11) > syscompat11dcl - printf("\n#endif /* %s */\n\n", compat12) > syscompat12dcl - - printf("\n#undef PAD_\n") > sysprotoend - printf("#undef PADL_\n") > sysprotoend - printf("#undef PADR_\n") > sysprotoend - printf("\n#endif /* !%s */\n", sysproto_h) > sysprotoend - - printf("\n") > sysmk - printf("};\n") > sysent - printf("};\n") > sysnames - printf("#define\t%sMAXSYSCALL\t%d\n", syscallprefix, syscall) \ - > syshdr - printf "\tdefault:\n\t\t*n_args = 0;\n\t\tbreak;\n\t};\n}\n" > systrace - printf "\tdefault:\n\t\tbreak;\n\t};\n\tif (p != NULL)\n\t\tstrlcpy(desc, p, descsz);\n}\n" > systracetmp - printf "\tdefault:\n\t\tbreak;\n\t};\n\tif (p != NULL)\n\t\tstrlcpy(desc, p, descsz);\n}\n" > systraceret - } ' - -cat $sysinc $sysent >> $syssw -cat $sysarg $sysdcl \ - $syscompat $syscompatdcl \ - $syscompat4 $syscompat4dcl \ - $syscompat6 $syscompat6dcl \ - $syscompat7 $syscompat7dcl \ - $syscompat10 $syscompat10dcl \ - $syscompat11 $syscompat11dcl \ - $syscompat12 $syscompat12dcl \ - $sysaue $sysprotoend > $sysproto -cat $systracetmp >> $systrace -cat $systraceret >> $systrace - From owner-dev-commits-src-all@freebsd.org Thu Jul 29 04:01: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 DD1D966A4D5; Thu, 29 Jul 2021 04:01: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 4GZxfC5Mn5z4rhx; Thu, 29 Jul 2021 04:01: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 A14572AB4; Thu, 29 Jul 2021 04:01: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 16T417Di099166; Thu, 29 Jul 2021 04:01:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16T417WC099165; Thu, 29 Jul 2021 04:01:07 GMT (envelope-from git) Date: Thu, 29 Jul 2021 04:01:07 GMT Message-Id: <202107290401.16T417WC099165@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Conrad Meyer Subject: git: 7f8f79a5c444 - main - libc qsort(3): Eliminate ambiguous sign comparison MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7f8f79a5c444a565a32b0c6578b07f8d496f6c49 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, 29 Jul 2021 04:01:07 -0000 The branch main has been updated by cem: URL: https://cgit.FreeBSD.org/src/commit/?id=7f8f79a5c444a565a32b0c6578b07f8d496f6c49 commit 7f8f79a5c444a565a32b0c6578b07f8d496f6c49 Author: Conrad Meyer AuthorDate: 2021-07-23 18:04:21 +0000 Commit: Conrad Meyer CommitDate: 2021-07-29 03:59:20 +0000 libc qsort(3): Eliminate ambiguous sign comparison The left side of the MIN() expression is the (signed) result of pointer subtraction (ptrdiff_t). The right hand side is the also the (signed) result of pointer subtraction, additionally subtracting the element size ('es'), which is unsigned size_t. This coerces the right-hand expression into an unsigned value. MIN(signed, unsigned) triggers -Wsign-compare. Sorting elements of size greater than SSIZE_MAX is nonsensical, so we can instead treat the element size as ssize_t, leaving the right-hand result the same signedness as the left. Reviewed by: arichardson, kib Differential Revision: https://reviews.freebsd.org/D31292 --- lib/libc/stdlib/Makefile.inc | 2 ++ lib/libc/stdlib/qsort.c | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/libc/stdlib/Makefile.inc b/lib/libc/stdlib/Makefile.inc index de8d8484e135..361761e73fdd 100644 --- a/lib/libc/stdlib/Makefile.inc +++ b/lib/libc/stdlib/Makefile.inc @@ -18,6 +18,8 @@ MISRCS+=C99_Exit.c a64l.c abort.c abs.c atexit.c atof.c atoi.c atol.c atoll.c \ strtol.c strtold.c strtoll.c strtoq.c strtoul.c strtonum.c strtoull.c \ strtoumax.c strtouq.c system.c tdelete.c tfind.c tsearch.c twalk.c +CFLAGS.qsort.c+= -Wsign-compare + # Work around an issue on case-insensitive file systems. # libc has both _Exit.c and _exit.s and they both yield # _exit.o (case insensitively speaking). diff --git a/lib/libc/stdlib/qsort.c b/lib/libc/stdlib/qsort.c index cfd2d99025f0..5016fff7895f 100644 --- a/lib/libc/stdlib/qsort.c +++ b/lib/libc/stdlib/qsort.c @@ -171,7 +171,12 @@ loop: pn = (char *)a + n * es; d1 = MIN(pa - (char *)a, pb - pa); vecswap(a, pb - d1, d1); - d1 = MIN(pd - pc, pn - pd - es); + /* + * Cast es to preserve signedness of right-hand side of MIN() + * expression, to avoid sign ambiguity in the implied comparison. es + * is safely within [0, SSIZE_MAX]. + */ + d1 = MIN(pd - pc, pn - pd - (ssize_t)es); vecswap(pb, pn - d1, d1); d1 = pb - pa; From owner-dev-commits-src-all@freebsd.org Thu Jul 29 06:07: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 741E866BA51 for ; Thu, 29 Jul 2021 06:07:57 +0000 (UTC) (envelope-from kevin.bowling@kev009.com) Received: from mail-yb1-xb2a.google.com (mail-yb1-xb2a.google.com [IPv6:2607:f8b0:4864:20::b2a]) (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 4Gb0SY2kHLz3F1v for ; Thu, 29 Jul 2021 06:07:57 +0000 (UTC) (envelope-from kevin.bowling@kev009.com) Received: by mail-yb1-xb2a.google.com with SMTP id x192so8425280ybe.0 for ; Wed, 28 Jul 2021 23:07:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kev009.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Ziguv4FopbVVvrHEJYzKHkwkBrvlagQSmvpD7cNccGA=; b=mVfrqcvi7Gyd/Q7c8EqXretJkuFf6KmZJdq0hAByxzvZ5uj7hIusTy6jwztyomd55t t0zLxOgxF7IN7sICNBehBw07FJj8XT01mt6s6xxdXTGWN3PRVqdf9aYLHVjcOyX0TZv1 PqgmoUn4LIA+5smKctM8kOuWlhgIyG2ugNDB0= 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=Ziguv4FopbVVvrHEJYzKHkwkBrvlagQSmvpD7cNccGA=; b=erIoUErGnmOIMy5wNjoqWPEqw81Uw6zAEy4KObsd7hOOGBRjQzi9m28arPqbTcRDuU 2oZipVUtEJbBz5gsZCsMqxbmNX+pR+WdkpG9g5VdcyjHgiO+QLVyiDDDlbvewcjXu+/3 kJRStYf1iW3GLJk90S+NJu4Ag3Eu6q8E+Cr6glYsvB6VdpbUypQItmPOuRJh72ippu6q FdyUMlNKlYhyiMZfNAVcCr+JEux071fzzp7zHb3rFGuzyg8rjVxfnInJ7lsayOinqzbU ZnG0PT71xW9hwE9hl7CQlUj0Tg/wiHOiDuFov2dJW88eEiAXACUcMDSvfr0hdQ172tpz kL5A== X-Gm-Message-State: AOAM531c/FDSvYFe8r1O4krcuKsl81voNibgFbbh/UdlPOhi7Xty3FD2 HVJoemP8bpCV+f/e63gwhxpUzEZUjmFkKYJbEnQw9w== X-Google-Smtp-Source: ABdhPJzMLiF480R8Pf/eVhWPtYqEgs+0iEhWAs9yuLTSvd314QFsIeGgwlGkliDvWw8+PF9JruG32dW9SrJ9p5DV0a0= X-Received: by 2002:a25:4187:: with SMTP id o129mr4506358yba.455.1627538876731; Wed, 28 Jul 2021 23:07:56 -0700 (PDT) MIME-Version: 1.0 References: <202107290200.16T20XOM038857@gitrepo.freebsd.org> In-Reply-To: <202107290200.16T20XOM038857@gitrepo.freebsd.org> From: Kevin Bowling Date: Wed, 28 Jul 2021 23:07:45 -0700 Message-ID: Subject: Re: git: aefe0a8c32d3 - main - Refactor/optimize cpu_search_*(). To: Alexander Motin Cc: dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org, src-committers@freebsd.org X-Rspamd-Queue-Id: 4Gb0SY2kHLz3F1v 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: Thu, 29 Jul 2021 06:07:57 -0000 On Wed, Jul 28, 2021 at 7:00 PM Alexander Motin wrote: > The branch main has been updated by mav: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=aefe0a8c32d370f2fdd0d0771eb59f8845beda17 > > commit aefe0a8c32d370f2fdd0d0771eb59f8845beda17 > Author: Alexander Motin > AuthorDate: 2021-07-29 01:18:50 +0000 > Commit: Alexander Motin > CommitDate: 2021-07-29 02:00:29 +0000 > > Refactor/optimize cpu_search_*(). > > Remove cpu_search_both(), unused for many years. Without it there is > less sense for the trick of compiling common cpu_search() into separate > cpu_search_lowest() and cpu_search_highest(), so split them completely, > making code more readable. While there, split iteration over children > groups and CPUs, complicating code for very small deduplication. > > Stop passing cpuset_t arguments by value and avoid some manipulations. > Since MAXCPU bump from 64 to 256, what was a single register turned > into 32-byte memory array, requiring memory allocation and accesses. > Splitting struct cpu_search into parameter and result parts allows to > even more reduce stack usage, since the first can be passed through > on recursion. > > Remove CPU_FFS() from the hot paths, precalculating first and last CPU > for each CPU group in advance during initialization. Again, it was > not a problem for 64 CPUs before, but for 256 FFS needs much more code. > > With these changes on 80-thread system doing ~260K uncached ZFS reads > per second I observe ~30% reduction of time spent in cpu_search_*(). Nice! I recall seeing contention here on other workloads on high core count systems. Regards, Kevin From owner-dev-commits-src-all@freebsd.org Thu Jul 29 06:41: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 0871D66C965; Thu, 29 Jul 2021 06:41: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 4Gb1CC6w62z3Hb6; Thu, 29 Jul 2021 06:41: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 D60604F7B; Thu, 29 Jul 2021 06:41: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 16T6fRXW013749; Thu, 29 Jul 2021 06:41:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16T6fRuN013748; Thu, 29 Jul 2021 06:41:27 GMT (envelope-from git) Date: Thu, 29 Jul 2021 06:41:27 GMT Message-Id: <202107290641.16T6fRuN013748@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Poul-Henning Kamp Subject: git: 272144ab4109 - main - hexdump: Flush stdout after '*' (repeat) lines. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: phk X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 272144ab410901f8b74db2ec97e09d64983d4b31 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, 29 Jul 2021 06:41:28 -0000 The branch main has been updated by phk: URL: https://cgit.FreeBSD.org/src/commit/?id=272144ab410901f8b74db2ec97e09d64983d4b31 commit 272144ab410901f8b74db2ec97e09d64983d4b31 Author: Poul-Henning Kamp AuthorDate: 2021-07-29 06:37:39 +0000 Commit: Poul-Henning Kamp CommitDate: 2021-07-29 06:40:57 +0000 hexdump: Flush stdout after '*' (repeat) lines. The canonical annoying example being: hexdump < /dev/zero | less --- usr.bin/hexdump/display.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/usr.bin/hexdump/display.c b/usr.bin/hexdump/display.c index 697443693d8e..5e5b30b73fd0 100644 --- a/usr.bin/hexdump/display.c +++ b/usr.bin/hexdump/display.c @@ -274,8 +274,10 @@ get(void) if (vflag != ALL && valid_save && bcmp(curp, savp, nread) == 0) { - if (vflag != DUP) + if (vflag != DUP) { (void)printf("*\n"); + (void)fflush(stdout); + } return((u_char *)NULL); } bzero((char *)curp + nread, need); @@ -305,8 +307,10 @@ get(void) vflag = WAIT; return(curp); } - if (vflag == WAIT) + if (vflag == WAIT) { (void)printf("*\n"); + (void)fflush(stdout); + } vflag = DUP; address += blocksize; need = blocksize; From owner-dev-commits-src-all@freebsd.org Thu Jul 29 06:58: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 EE8C466D0BE; Thu, 29 Jul 2021 06:58: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 4Gb1bC6Cnyz3Jcq; Thu, 29 Jul 2021 06:58: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 BEDEA5260; Thu, 29 Jul 2021 06:58: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 16T6wl8B028931; Thu, 29 Jul 2021 06:58:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16T6wlDT028930; Thu, 29 Jul 2021 06:58:47 GMT (envelope-from git) Date: Thu, 29 Jul 2021 06:58:47 GMT Message-Id: <202107290658.16T6wlDT028930@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: f33794014468 - main - linux(4): Fix gcc buld. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f33794014468562100f6f02ab8147b58bd9f82c0 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, 29 Jul 2021 06:58:48 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=f33794014468562100f6f02ab8147b58bd9f82c0 commit f33794014468562100f6f02ab8147b58bd9f82c0 Author: Dmitry Chagin AuthorDate: 2021-07-29 06:52:33 +0000 Commit: Dmitry Chagin CommitDate: 2021-07-29 06:52:33 +0000 linux(4): Fix gcc buld. gcc failed as it didn't inlined the builtins and generates calls to the libgcc, ld can't find libgcc as cross-toolchain libgcc is not installed. To avoid this add internal vDSO ffs functions without optimized builtins. Reported by: jhb MFC after: 2 weeks --- sys/amd64/linux/linux_vdso_gtod.c | 1 - sys/amd64/linux32/linux32_vdso_gtod.c | 1 - sys/arm64/linux/linux_vdso_gtod.c | 1 - sys/compat/linux/linux_vdso_gtod.inc | 34 ++++++++++++++++++++++++++++++++++ sys/i386/linux/linux_vdso_gtod.c | 1 - 5 files changed, 34 insertions(+), 4 deletions(-) diff --git a/sys/amd64/linux/linux_vdso_gtod.c b/sys/amd64/linux/linux_vdso_gtod.c index ad23dc33575a..57d3f4b45dd4 100644 --- a/sys/amd64/linux/linux_vdso_gtod.c +++ b/sys/amd64/linux/linux_vdso_gtod.c @@ -36,7 +36,6 @@ __FBSDID("$FreeBSD$"); #include #undef _KERNEL #include -#include #include #include diff --git a/sys/amd64/linux32/linux32_vdso_gtod.c b/sys/amd64/linux32/linux32_vdso_gtod.c index f1573ca3c1b1..0caf787c9503 100644 --- a/sys/amd64/linux32/linux32_vdso_gtod.c +++ b/sys/amd64/linux32/linux32_vdso_gtod.c @@ -37,7 +37,6 @@ __FBSDID("$FreeBSD$"); #include #undef _KERNEL #include -#include #include #include diff --git a/sys/arm64/linux/linux_vdso_gtod.c b/sys/arm64/linux/linux_vdso_gtod.c index 682735cf2fa1..6fdff8335f5d 100644 --- a/sys/arm64/linux/linux_vdso_gtod.c +++ b/sys/arm64/linux/linux_vdso_gtod.c @@ -38,7 +38,6 @@ __FBSDID("$FreeBSD$"); #include #undef _KERNEL #include -#include #include #include diff --git a/sys/compat/linux/linux_vdso_gtod.inc b/sys/compat/linux/linux_vdso_gtod.inc index a90b7dc8efdf..52fab2bbc5d7 100644 --- a/sys/compat/linux/linux_vdso_gtod.inc +++ b/sys/compat/linux/linux_vdso_gtod.inc @@ -26,6 +26,40 @@ * SUCH DAMAGE. */ +static int +fls(int mask) +{ + + if (mask == 0) + return (0); + return ((__builtin_clz(mask) ^ 0x1f) + 1); +} + +#ifdef _LP64 +static int +ffsl(long mask) +{ + int bit; + + if (mask == 0) + return (0); + for (bit = 1; !(mask & 1); bit++) + mask = (unsigned long)mask >> 1; + return (bit); +} +#else +static int +ffsll(long long mask) +{ + int bit; + + if (mask == 0) + return (0); + for (bit = 1; !(mask & 1); bit++) + mask = (unsigned long long)mask >> 1; + return (bit); +} +#endif static int __vdso_native_to_linux_timespec(struct l_timespec *lts, diff --git a/sys/i386/linux/linux_vdso_gtod.c b/sys/i386/linux/linux_vdso_gtod.c index b1e4a4620ee4..046b864c54f5 100644 --- a/sys/i386/linux/linux_vdso_gtod.c +++ b/sys/i386/linux/linux_vdso_gtod.c @@ -36,7 +36,6 @@ __FBSDID("$FreeBSD$"); #include #undef _KERNEL #include -#include #include #include From owner-dev-commits-src-all@freebsd.org Thu Jul 29 07:25: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 75F8866DA12; Thu, 29 Jul 2021 07:25:37 +0000 (UTC) (envelope-from kp@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 4Gb2B92f0Nz3P1g; Thu, 29 Jul 2021 07:25:37 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from venus.codepro.be (venus.codepro.be [5.9.86.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.codepro.be", Issuer "R3" (verified OK)) (Authenticated sender: kp) by smtp.freebsd.org (Postfix) with ESMTPSA id 29221C0BA; Thu, 29 Jul 2021 07:25:37 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: by venus.codepro.be (Postfix, authenticated sender kp) id BC85D4BE6B; Thu, 29 Jul 2021 09:25:34 +0200 (CEST) From: "Kristof Provost" To: "Kubilay Kocak" Cc: dev-commits-src-all@FreeBSD.org, src-committers@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: da8d8b22e69c - main - pf: fix ABI breakage Date: Thu, 29 Jul 2021 09:25:33 +0200 X-Mailer: MailMate (1.13.2r5673) Message-ID: In-Reply-To: References: <202107281221.16SCLpFm044007@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: quoted-printable X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-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, 29 Jul 2021 07:25:37 -0000 On 29 Jul 2021, at 3:19, Kubilay Kocak wrote: > On 28/07/2021 10:21 pm, Kristof Provost wrote: >> The branch main has been updated by kp: >> >> URL: = >> https://cgit.FreeBSD.org/src/commit/?id=3Dda8d8b22e69c72f1d001d55b5eff= 5acbb0265cfc >> >> commit da8d8b22e69c72f1d001d55b5eff5acbb0265cfc >> Author: Kristof Provost >> AuthorDate: 2021-07-28 09:24:44 +0000 >> Commit: Kristof Provost >> CommitDate: 2021-07-28 10:16:33 +0000 >> >> pf: fix ABI breakage >> The introduction of synproxy support changed the size of = >> struct >> pf_status, which in turn broke the userspace ABI. >> Revert the relevant change. More work is needed on the = >> synproxy code to >> keep and expose the counters, but in the mean time this restores = >> the >> ABI. >> PR: 257469 >> MFC after: 3 days >> Sponsored by: Modirum MDPay >> --- >> sys/netpfil/pf/pf.h | 3 +-- >> sys/netpfil/pf/pf_syncookies.c | 1 - >> 2 files changed, 1 insertion(+), 3 deletions(-) >> >> diff --git a/sys/netpfil/pf/pf.h b/sys/netpfil/pf/pf.h >> index c8bf932af9c3..d8ee43506d99 100644 >> --- a/sys/netpfil/pf/pf.h >> +++ b/sys/netpfil/pf/pf.h >> @@ -160,8 +160,7 @@ enum { PF_ADDR_ADDRMASK, PF_ADDR_NOROUTE, = >> PF_ADDR_DYNIFTL, >> #define LCNT_SRCCONNRATE 4 /* max-src-conn-rate */ >> #define LCNT_OVERLOAD_TABLE 5 /* entry added to overload table */ >> #define LCNT_OVERLOAD_FLUSH 6 /* state entries flushed */ >> -#define LCNT_SYNCOOKIES_VALID 7 /* syncookies validated */ /* XXX = >> TODO: Ensure no API breakage! */ >> -#define LCNT_MAX 8 /* total+1 */ >> +#define LCNT_MAX 7 /* total+1 */ >> #define LCNT_NAMES { \ >> "max states per rule", \ >> diff --git a/sys/netpfil/pf/pf_syncookies.c = >> b/sys/netpfil/pf/pf_syncookies.c >> index 8699ae855ec8..744a12e4e21d 100644 >> --- a/sys/netpfil/pf/pf_syncookies.c >> +++ b/sys/netpfil/pf/pf_syncookies.c >> @@ -275,7 +275,6 @@ pf_syncookie_validate(struct pf_pdesc *pd) >> if ((ack & ~0xff) !=3D (hash & ~0xff)) >> return (0); >> - counter_u64_add(V_pf_status.lcounters[LCNT_SYNCOOKIES_VALID], 1); >> return (1); >> } >> _______________________________________________ >> dev-commits-src-main@freebsd.org mailing list >> https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main >> To unsubscribe, send any mail to = >> "dev-commits-src-main-unsubscribe@freebsd.org" >> > > Are these ABI break^W changes being picked up automatically or via = > people watching commits? > This was a user submitted bug report. I=E2=80=99m not aware of any ABI monitoring tooling. Best regards, Kristof From owner-dev-commits-src-all@freebsd.org Thu Jul 29 07:37: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 9160766DA4B; Thu, 29 Jul 2021 07:37: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 4Gb2Rx3kNPz3Px6; Thu, 29 Jul 2021 07:37: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 64D805867; Thu, 29 Jul 2021 07:37: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 16T7bXSR082074; Thu, 29 Jul 2021 07:37:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16T7bXtr082073; Thu, 29 Jul 2021 07:37:33 GMT (envelope-from git) Date: Thu, 29 Jul 2021 07:37:33 GMT Message-Id: <202107290737.16T7bXtr082073@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: 728958fb1bea - main - UPDATING: document if_bridge MTU changes 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: 728958fb1bea785e37dda4475568421ab796f8d4 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, 29 Jul 2021 07:37:33 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=728958fb1bea785e37dda4475568421ab796f8d4 commit 728958fb1bea785e37dda4475568421ab796f8d4 Author: Kristof Provost AuthorDate: 2021-07-29 07:36:52 +0000 Commit: Kristof Provost CommitDate: 2021-07-29 07:36:52 +0000 UPDATING: document if_bridge MTU changes Sponsored by: Rubicon Communications, LLC ("Netgate") --- UPDATING | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/UPDATING b/UPDATING index 7e45e9aa49fd..d109cb1594a5 100644 --- a/UPDATING +++ b/UPDATING @@ -27,6 +27,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 14.x IS SLOW: world, or to merely disable the most expensive debugging functionality at runtime, run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20210729: + As of commit 01ad0c007964 if_bridge member interfaces can no longer + change their MTU. Changing the MTU of the bridge itself will change the + MTU on all member interfaces instead. + 20210716: Commit ee29e6f31111 changed the internal KAPI between the nfscommon and nfsd modules. Therefore, both need to be rebuilt from sources. From owner-dev-commits-src-all@freebsd.org Thu Jul 29 07:55: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 D18D066E587; Thu, 29 Jul 2021 07:55: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 4Gb2rS5TDxz3hS7; Thu, 29 Jul 2021 07:55: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 A48B95F38; Thu, 29 Jul 2021 07:55: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 16T7tKgL008603; Thu, 29 Jul 2021 07:55:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16T7tK7d008602; Thu, 29 Jul 2021 07:55:20 GMT (envelope-from git) Date: Thu, 29 Jul 2021 07:55:20 GMT Message-Id: <202107290755.16T7tK7d008602@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: 5afe81a7b23a - main - 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/main X-Git-Reftype: branch X-Git-Commit: 5afe81a7b23afd27289ca40e04a6a764134d6273 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, 29 Jul 2021 07:55:20 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=5afe81a7b23afd27289ca40e04a6a764134d6273 commit 5afe81a7b23afd27289ca40e04a6a764134d6273 Author: Luiz Otavio O Souza AuthorDate: 2017-10-26 02:30:54 +0000 Commit: Kristof Provost CommitDate: 2021-07-29 05:54:39 +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") --- 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 Jul 29 08:32: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 5DF3966F18E; Thu, 29 Jul 2021 08:32: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 4Gb3fm1tKbz3kyn; Thu, 29 Jul 2021 08:32: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 290746A0D; Thu, 29 Jul 2021 08:32: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 16T8W0rQ061829; Thu, 29 Jul 2021 08:32:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16T8W0hA061828; Thu, 29 Jul 2021 08:32:00 GMT (envelope-from git) Date: Thu, 29 Jul 2021 08:32:00 GMT Message-Id: <202107290832.16T8W0hA061828@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: David Malone Subject: git: fd309107e9dc - main - Minor language improvements. Note that they can't be changed by sysctl (I think they can be changed as a tuneable.) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dwmalone X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fd309107e9dc403ef376bb1b992323977cc678f5 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, 29 Jul 2021 08:32:00 -0000 The branch main has been updated by dwmalone: URL: https://cgit.FreeBSD.org/src/commit/?id=fd309107e9dc403ef376bb1b992323977cc678f5 commit fd309107e9dc403ef376bb1b992323977cc678f5 Author: David Malone AuthorDate: 2021-07-29 08:23:39 +0000 Commit: David Malone CommitDate: 2021-07-29 08:26:19 +0000 Minor language improvements. Note that they can't be changed by sysctl (I think they can be changed as a tuneable.) --- share/man/man4/random.4 | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/share/man/man4/random.4 b/share/man/man4/random.4 index 3b3f9b2330e3..fb851cdb7ba1 100644 --- a/share/man/man4/random.4 +++ b/share/man/man4/random.4 @@ -44,9 +44,11 @@ state, and will block reads until it is seeded for the first time. .Pp To provide prompt access to the random device at boot time, .Fx -automatically persists some entropy data in +automatically saves some entropy data in .Pa /boot/entropy -for the loader to provide to the kernel. +for the +.Xr loader 8 +to provide to the kernel. Additional entropy is regularly saved in .Pa /var/db/entropy . This saved entropy is sufficient to unblock the random device on devices with @@ -95,7 +97,8 @@ Other than .Va kern.random.fortuna.minpoolsize , and .Va kern.random.harvest.mask , -all settings are read-only. +all settings are read-only via +.Xr sysctl 8 . .Pp The .Pa kern.random.fortuna.minpoolsize @@ -126,7 +129,7 @@ sysctls can be used to confirm settings in a human readable form. Disabled items -in the latter item +in the latter are listed in square brackets. See .Xr random_harvest 9 From owner-dev-commits-src-all@freebsd.org Thu Jul 29 08:48: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 1FCE166EF65; Thu, 29 Jul 2021 08:48: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 4Gb41w0Ly0z3lyY; Thu, 29 Jul 2021 08:48: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 E8A2069D0; Thu, 29 Jul 2021 08:48: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 16T8mZL1075453; Thu, 29 Jul 2021 08:48:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16T8mZCA075452; Thu, 29 Jul 2021 08:48:35 GMT (envelope-from git) Date: Thu, 29 Jul 2021 08:48:35 GMT Message-Id: <202107290848.16T8mZCA075452@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: c3f2fcf5b909 - main - Sort the arm64 ID_AA64* user 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/main X-Git-Reftype: branch X-Git-Commit: c3f2fcf5b90991c0155ed64bbf3d9468c3033ebc 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, 29 Jul 2021 08:48:36 -0000 The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=c3f2fcf5b90991c0155ed64bbf3d9468c3033ebc commit c3f2fcf5b90991c0155ed64bbf3d9468c3033ebc Author: Andrew Turner AuthorDate: 2021-07-28 18:30:09 +0000 Commit: Andrew Turner CommitDate: 2021-07-28 19:01:30 +0000 Sort the arm64 ID_AA64* user registers Sponsored by: The FreeBSD Foundation --- sys/arm64/arm64/identcpu.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sys/arm64/arm64/identcpu.c b/sys/arm64/arm64/identcpu.c index 64b3b6a4ef27..0220e47e8d7e 100644 --- a/sys/arm64/arm64/identcpu.c +++ b/sys/arm64/arm64/identcpu.c @@ -1180,13 +1180,18 @@ struct mrs_user_reg { .fields = field_name##_fields, \ } static struct mrs_user_reg user_regs[] = { + USER_REG(ID_AA64DFR0_EL1, id_aa64dfr0), + USER_REG(ID_AA64ISAR0_EL1, id_aa64isar0), USER_REG(ID_AA64ISAR1_EL1, id_aa64isar1), - USER_REG(ID_AA64PFR0_EL1, id_aa64pfr0), - USER_REG(ID_AA64DFR0_EL1, id_aa64dfr0), + USER_REG(ID_AA64MMFR0_EL1, id_aa64mmfr0), + + USER_REG(ID_AA64PFR0_EL1, id_aa64pfr0), + #ifdef COMPAT_FREEBSD32 USER_REG(ID_ISAR5_EL1, id_isar5), + USER_REG(MVFR0_EL1, mvfr0), USER_REG(MVFR1_EL1, mvfr1), #endif /* COMPAT_FREEBSD32 */ From owner-dev-commits-src-all@freebsd.org Thu Jul 29 08:48: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 6F6AC66EF66; Thu, 29 Jul 2021 08:48: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 4Gb41x1pkDz3m3Y; Thu, 29 Jul 2021 08:48: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 067E2645B; Thu, 29 Jul 2021 08:48: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 16T8maC1075477; Thu, 29 Jul 2021 08:48:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16T8maqP075476; Thu, 29 Jul 2021 08:48:36 GMT (envelope-from git) Date: Thu, 29 Jul 2021 08:48:36 GMT Message-Id: <202107290848.16T8maqP075476@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: 2d6d5f88d16f - main - Add missing arm64 ID 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/main X-Git-Reftype: branch X-Git-Commit: 2d6d5f88d16fc43b6e7ce2b71136ec6b04d10e6e 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, 29 Jul 2021 08:48:37 -0000 The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=2d6d5f88d16fc43b6e7ce2b71136ec6b04d10e6e commit 2d6d5f88d16fc43b6e7ce2b71136ec6b04d10e6e Author: Andrew Turner AuthorDate: 2021-07-28 19:00:36 +0000 Commit: Andrew Turner CommitDate: 2021-07-28 19:01:30 +0000 Add missing arm64 ID registers These may contain values we export to userpsace. Sponsored by: The FreeBSD Foundation --- sys/arm64/arm64/identcpu.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/arm64/arm64/identcpu.c b/sys/arm64/arm64/identcpu.c index 0220e47e8d7e..40f56017b9fd 100644 --- a/sys/arm64/arm64/identcpu.c +++ b/sys/arm64/arm64/identcpu.c @@ -1186,8 +1186,11 @@ static struct mrs_user_reg user_regs[] = { USER_REG(ID_AA64ISAR1_EL1, id_aa64isar1), USER_REG(ID_AA64MMFR0_EL1, id_aa64mmfr0), + USER_REG(ID_AA64MMFR1_EL1, id_aa64mmfr1), + USER_REG(ID_AA64MMFR2_EL1, id_aa64mmfr2), USER_REG(ID_AA64PFR0_EL1, id_aa64pfr0), + USER_REG(ID_AA64PFR1_EL1, id_aa64pfr1), #ifdef COMPAT_FREEBSD32 USER_REG(ID_ISAR5_EL1, id_isar5), From owner-dev-commits-src-all@freebsd.org Thu Jul 29 09:05: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 B5ADA66FC2B; Thu, 29 Jul 2021 09:05: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 4Gb4PY4l5dz3nSx; Thu, 29 Jul 2021 09:05: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 8A9076E4B; Thu, 29 Jul 2021 09:05: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 16T95b9n002806; Thu, 29 Jul 2021 09:05:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16T95bfd002805; Thu, 29 Jul 2021 09:05:37 GMT (envelope-from git) Date: Thu, 29 Jul 2021 09:05:37 GMT Message-Id: <202107290905.16T95bfd002805@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wojciech Macek Subject: git: fe8ce390b8bc - main - Fix mac_veriexec version mismatch MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wma X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fe8ce390b8bcf304a9956b0f7ca8421868c22492 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, 29 Jul 2021 09:05:37 -0000 The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=fe8ce390b8bcf304a9956b0f7ca8421868c22492 commit fe8ce390b8bcf304a9956b0f7ca8421868c22492 Author: Wojciech Macek AuthorDate: 2021-07-29 09:02:43 +0000 Commit: Wojciech Macek CommitDate: 2021-07-29 09:05:13 +0000 Fix mac_veriexec version mismatch mac_veriexec sets its version to 1, but the mac_veriexec_shaX modules which depend on it expect MAC_VERIEXEC_VERSION = 2. Be consistent and use MAC_VERIEXEC_VERSION everywhere. This unbreaks loading of mac_veriexec modules at boot time. Authored by: Kornel Duleba Obtained from: Semihalf Sponsored by: Stormshield Differential Revision: https://reviews.freebsd.org/D31268 --- sys/dev/veriexec/verified_exec.c | 3 ++- sys/security/mac_veriexec/mac_veriexec.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/dev/veriexec/verified_exec.c b/sys/dev/veriexec/verified_exec.c index 3c72d30155dd..d6fabf825212 100644 --- a/sys/dev/veriexec/verified_exec.c +++ b/sys/dev/veriexec/verified_exec.c @@ -266,4 +266,5 @@ veriexec_drvinit(void *unused __unused) } SYSINIT(veriexec, SI_SUB_PSEUDO, SI_ORDER_ANY, veriexec_drvinit, NULL); -MODULE_DEPEND(veriexec, mac_veriexec, 1, 1, 1); +MODULE_DEPEND(veriexec, mac_veriexec, MAC_VERIEXEC_VERSION, + MAC_VERIEXEC_VERSION, MAC_VERIEXEC_VERSION); diff --git a/sys/security/mac_veriexec/mac_veriexec.c b/sys/security/mac_veriexec/mac_veriexec.c index ecaa8cc35e09..dc95890f613e 100644 --- a/sys/security/mac_veriexec/mac_veriexec.c +++ b/sys/security/mac_veriexec/mac_veriexec.c @@ -737,7 +737,7 @@ static struct mac_policy_ops mac_veriexec_ops = MAC_POLICY_SET(&mac_veriexec_ops, mac_veriexec, MAC_VERIEXEC_FULLNAME, MPC_LOADTIME_FLAG_NOTLATE, &mac_veriexec_slot); -MODULE_VERSION(mac_veriexec, 1); +MODULE_VERSION(mac_veriexec, MAC_VERIEXEC_VERSION); static struct vnode * mac_veriexec_bottom_vnode(struct vnode *vp) From owner-dev-commits-src-all@freebsd.org Thu Jul 29 09:46: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 39347670014; Thu, 29 Jul 2021 09:46: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 4Gb5JC0xdpz3sFX; Thu, 29 Jul 2021 09:46: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 0643A7269; Thu, 29 Jul 2021 09:46: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 16T9k2xm056642; Thu, 29 Jul 2021 09:46:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16T9k2lu056641; Thu, 29 Jul 2021 09:46:02 GMT (envelope-from git) Date: Thu, 29 Jul 2021 09:46:02 GMT Message-Id: <202107290946.16T9k2lu056641@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: 32a18e9abd38 - main - freebsd32: Eliminate spaces at end of line. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 32a18e9abd3809cf265e0e2969cd942fa84ae32b 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, 29 Jul 2021 09:46:03 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=32a18e9abd3809cf265e0e2969cd942fa84ae32b commit 32a18e9abd3809cf265e0e2969cd942fa84ae32b Author: Dmitry Chagin AuthorDate: 2021-07-29 09:39:30 +0000 Commit: Dmitry Chagin CommitDate: 2021-07-29 09:39:30 +0000 freebsd32: Eliminate spaces at end of line. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D31245 MFC after: 2 weeks --- sys/compat/freebsd32/freebsd32_misc.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/compat/freebsd32/freebsd32_misc.h b/sys/compat/freebsd32/freebsd32_misc.h index 7db8fe6b84e0..9e0f55ae8478 100644 --- a/sys/compat/freebsd32/freebsd32_misc.h +++ b/sys/compat/freebsd32/freebsd32_misc.h @@ -38,12 +38,12 @@ #if BYTE_ORDER == BIG_ENDIAN #define PAIR32TO64(type, name) ((name ## 2) | ((type)(name ## 1) << 32)) -#define RETVAL_HI 0 -#define RETVAL_LO 1 +#define RETVAL_HI 0 +#define RETVAL_LO 1 #else #define PAIR32TO64(type, name) ((name ## 1) | ((type)(name ## 2) << 32)) -#define RETVAL_HI 1 -#define RETVAL_LO 0 +#define RETVAL_HI 1 +#define RETVAL_LO 0 #endif #endif /* !_COMPAT_FREEBSD32_MISC_H_ */ From owner-dev-commits-src-all@freebsd.org Thu Jul 29 09:46: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 94E7866FD5D; Thu, 29 Jul 2021 09:46: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 4Gb5JF37tzz3s5w; Thu, 29 Jul 2021 09:46: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 4A15878A8; Thu, 29 Jul 2021 09:46: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 16T9k5kp056697; Thu, 29 Jul 2021 09:46:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16T9k51h056696; Thu, 29 Jul 2021 09:46:05 GMT (envelope-from git) Date: Thu, 29 Jul 2021 09:46:05 GMT Message-Id: <202107290946.16T9k51h056696@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: 7cf06e075d1c - main - freebsd32: Remove the unnecessary spaces. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7cf06e075d1c28ad444e6b6beaf783210123c9d7 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, 29 Jul 2021 09:46:05 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=7cf06e075d1c28ad444e6b6beaf783210123c9d7 commit 7cf06e075d1c28ad444e6b6beaf783210123c9d7 Author: Dmitry Chagin AuthorDate: 2021-07-29 09:40:36 +0000 Commit: Dmitry Chagin CommitDate: 2021-07-29 09:40:36 +0000 freebsd32: Remove the unnecessary spaces. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D31247 MFC after: 2 weeks --- sys/compat/freebsd32/freebsd32_misc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c index 99154f41820f..736fd1123d53 100644 --- a/sys/compat/freebsd32/freebsd32_misc.c +++ b/sys/compat/freebsd32/freebsd32_misc.c @@ -402,7 +402,7 @@ freebsd32_exec_copyin_args(struct image_args *args, const char *fname, if (error != 0) goto err_exit; } - + /* * extract environment strings */ From owner-dev-commits-src-all@freebsd.org Thu Jul 29 09:46: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 05FEA66FDA3; Thu, 29 Jul 2021 09:46: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 4Gb5JG4tVlz3s60; Thu, 29 Jul 2021 09:46: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 6C82B7738; Thu, 29 Jul 2021 09:46: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 16T9k6S1056723; Thu, 29 Jul 2021 09:46:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16T9k6bn056722; Thu, 29 Jul 2021 09:46:06 GMT (envelope-from git) Date: Thu, 29 Jul 2021 09:46:06 GMT Message-Id: <202107290946.16T9k6bn056722@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: af29f3995882 - main - umtx: Split umtx.h on two counterparts. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: af29f3995882fac6e1c0360c2276c7a98056957f 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, 29 Jul 2021 09:46:07 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=af29f3995882fac6e1c0360c2276c7a98056957f commit af29f3995882fac6e1c0360c2276c7a98056957f Author: Dmitry Chagin AuthorDate: 2021-07-29 09:41:29 +0000 Commit: Dmitry Chagin CommitDate: 2021-07-29 09:41:29 +0000 umtx: Split umtx.h on two counterparts. To prevent umtx.h polluting by future changes split it on two headers: umtx.h - ABI header for userspace; umtxvar.h - the kernel staff. While here fix umtx_key_match style. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D31248 MFC after: 2 weeks --- sys/compat/cloudabi/cloudabi_futex.c | 2 +- sys/compat/linux/linux_futex.c | 2 +- sys/kern/kern_exec.c | 2 +- sys/kern/kern_exit.c | 2 +- sys/kern/kern_kthread.c | 2 +- sys/kern/kern_racct.c | 2 +- sys/kern/kern_resource.c | 2 +- sys/kern/kern_thr.c | 2 +- sys/kern/kern_thread.c | 2 +- sys/kern/kern_umtx.c | 1 + sys/kern/sched_4bsd.c | 2 +- sys/kern/sched_ule.c | 2 +- sys/sys/umtx.h | 73 ------------------------ sys/sys/umtxvar.h | 106 +++++++++++++++++++++++++++++++++++ 14 files changed, 118 insertions(+), 84 deletions(-) diff --git a/sys/compat/cloudabi/cloudabi_futex.c b/sys/compat/cloudabi/cloudabi_futex.c index 153e8bce8495..fd2a1d515483 100644 --- a/sys/compat/cloudabi/cloudabi_futex.c +++ b/sys/compat/cloudabi/cloudabi_futex.c @@ -35,7 +35,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #include diff --git a/sys/compat/linux/linux_futex.c b/sys/compat/linux/linux_futex.c index 1858c573a576..547d52c8ca4a 100644 --- a/sys/compat/linux/linux_futex.c +++ b/sys/compat/linux/linux_futex.c @@ -57,7 +57,7 @@ __KERNEL_RCSID(1, "$NetBSD: linux_futex.c,v 1.7 2006/07/24 19:01:49 manu Exp $") #include #include #include -#include +#include #include diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index e5944bfc5ac6..e6564ae48ced 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -70,7 +70,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #include #include #ifdef KTRACE diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index bfd25366b49c..1b2cf63c9b82 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -76,7 +76,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #ifdef KTRACE #include #endif diff --git a/sys/kern/kern_kthread.c b/sys/kern/kern_kthread.c index 32832bde2f53..2eef7798f3d6 100644 --- a/sys/kern/kern_kthread.c +++ b/sys/kern/kern_kthread.c @@ -41,7 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #include #include #include diff --git a/sys/kern/kern_racct.c b/sys/kern/kern_racct.c index 7d179fe69844..e2053de3dc2c 100644 --- a/sys/kern/kern_racct.c +++ b/sys/kern/kern_racct.c @@ -57,7 +57,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #include #ifdef RCTL diff --git a/sys/kern/kern_resource.c b/sys/kern/kern_resource.c index e14be34aa6e0..4c62961e1bc4 100644 --- a/sys/kern/kern_resource.c +++ b/sys/kern/kern_resource.c @@ -59,7 +59,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #include #include diff --git a/sys/kern/kern_thr.c b/sys/kern/kern_thr.c index 69259d78811a..18722cc6a73d 100644 --- a/sys/kern/kern_thr.c +++ b/sys/kern/kern_thr.c @@ -54,7 +54,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #include #ifdef HWPMC_HOOKS #include diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c index 328a69bc5f23..4cfd502664bd 100644 --- a/sys/kern/kern_thread.c +++ b/sys/kern/kern_thread.c @@ -56,7 +56,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #include #include #ifdef HWPMC_HOOKS diff --git a/sys/kern/kern_umtx.c b/sys/kern/kern_umtx.c index b76d080b8e06..c7f9afeb6c4d 100644 --- a/sys/kern/kern_umtx.c +++ b/sys/kern/kern_umtx.c @@ -63,6 +63,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include diff --git a/sys/kern/sched_4bsd.c b/sys/kern/sched_4bsd.c index 7e6123cdcf24..ddd65b94f0ff 100644 --- a/sys/kern/sched_4bsd.c +++ b/sys/kern/sched_4bsd.c @@ -56,7 +56,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #include #include diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c index 3bb73d64a70c..2b55b0a7a8c5 100644 --- a/sys/kern/sched_ule.c +++ b/sys/kern/sched_ule.c @@ -61,7 +61,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #include #include #include diff --git a/sys/sys/umtx.h b/sys/sys/umtx.h index 60e9dccdad91..82a8e0e4b0f0 100644 --- a/sys/sys/umtx.h +++ b/sys/sys/umtx.h @@ -132,83 +132,10 @@ struct umtx_robust_lists_params { uintptr_t robust_inact_offset; }; -#ifndef _KERNEL - __BEGIN_DECLS int _umtx_op(void *obj, int op, u_long val, void *uaddr, void *uaddr2); __END_DECLS -#else - -/* - * The umtx_key structure is used by both the Linux futex code and the - * umtx implementation to map userland addresses to unique keys. - */ - -enum { - TYPE_SIMPLE_WAIT, - TYPE_CV, - TYPE_SEM, - TYPE_SIMPLE_LOCK, - TYPE_NORMAL_UMUTEX, - TYPE_PI_UMUTEX, - TYPE_PP_UMUTEX, - TYPE_RWLOCK, - TYPE_FUTEX, - TYPE_SHM, - TYPE_PI_ROBUST_UMUTEX, - TYPE_PP_ROBUST_UMUTEX, -}; - -/* Key to represent a unique userland synchronous object */ -struct umtx_key { - int hash; - int type; - int shared; - union { - struct { - struct vm_object *object; - uintptr_t offset; - } shared; - struct { - struct vmspace *vs; - uintptr_t addr; - } private; - struct { - void *a; - uintptr_t b; - } both; - } info; -}; - -#define THREAD_SHARE 0 -#define PROCESS_SHARE 1 -#define AUTO_SHARE 2 - -struct thread; - -static inline int -umtx_key_match(const struct umtx_key *k1, const struct umtx_key *k2) -{ - return (k1->type == k2->type && - k1->info.both.a == k2->info.both.a && - k1->info.both.b == k2->info.both.b); -} - -int umtx_copyin_timeout(const void *, struct timespec *); -void umtx_exec(struct proc *p); -int umtx_key_get(const void *, int, int, struct umtx_key *); -void umtx_key_release(struct umtx_key *); -struct umtx_q *umtxq_alloc(void); -void umtxq_free(struct umtx_q *); -int kern_umtx_wake(struct thread *, void *, int, int); -void umtx_pi_adjust(struct thread *, u_char); -void umtx_thread_init(struct thread *); -void umtx_thread_fini(struct thread *); -void umtx_thread_alloc(struct thread *); -void umtx_thread_exit(struct thread *); - -#endif /* !_KERNEL */ #endif /* !_SYS_UMTX_H_ */ diff --git a/sys/sys/umtxvar.h b/sys/sys/umtxvar.h new file mode 100644 index 000000000000..b898c263201e --- /dev/null +++ b/sys/sys/umtxvar.h @@ -0,0 +1,106 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2002, Jeffrey Roberson + * All rights reserved. + * + * 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 unmodified, 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 ``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 BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + * + */ + +#ifndef _SYS_UMTXVAR_H_ +#define _SYS_UMTXVAR_H_ + +#ifdef _KERNEL + +/* + * The umtx_key structure is used by both the Linux futex code and the + * umtx implementation to map userland addresses to unique keys. + */ +enum { + TYPE_SIMPLE_WAIT, + TYPE_CV, + TYPE_SEM, + TYPE_SIMPLE_LOCK, + TYPE_NORMAL_UMUTEX, + TYPE_PI_UMUTEX, + TYPE_PP_UMUTEX, + TYPE_RWLOCK, + TYPE_FUTEX, + TYPE_SHM, + TYPE_PI_ROBUST_UMUTEX, + TYPE_PP_ROBUST_UMUTEX, +}; + +/* Key to represent a unique userland synchronous object */ +struct umtx_key { + int hash; + int type; + int shared; + union { + struct { + struct vm_object *object; + uintptr_t offset; + } shared; + struct { + struct vmspace *vs; + uintptr_t addr; + } private; + struct { + void *a; + uintptr_t b; + } both; + } info; +}; + +#define THREAD_SHARE 0 +#define PROCESS_SHARE 1 +#define AUTO_SHARE 2 + +struct thread; + +static inline int +umtx_key_match(const struct umtx_key *k1, const struct umtx_key *k2) +{ + + return (k1->type == k2->type && + k1->info.both.a == k2->info.both.a && + k1->info.both.b == k2->info.both.b); +} + +int umtx_copyin_timeout(const void *, struct timespec *); +void umtx_exec(struct proc *p); +int umtx_key_get(const void *, int, int, struct umtx_key *); +void umtx_key_release(struct umtx_key *); +struct umtx_q *umtxq_alloc(void); +void umtxq_free(struct umtx_q *); +int kern_umtx_wake(struct thread *, void *, int, int); +void umtx_pi_adjust(struct thread *, u_char); +void umtx_thread_init(struct thread *); +void umtx_thread_fini(struct thread *); +void umtx_thread_alloc(struct thread *); +void umtx_thread_exit(struct thread *); + +#endif /* _KERNEL */ +#endif /* !_SYS_UMTXVAR_H_ */ From owner-dev-commits-src-all@freebsd.org Thu Jul 29 09:46: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 60830670294; Thu, 29 Jul 2021 09:46: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 4Gb5JD26tvz3s3l; Thu, 29 Jul 2021 09:46: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 303CF78A7; Thu, 29 Jul 2021 09:46: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 16T9k4NG056666; Thu, 29 Jul 2021 09:46:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16T9k4Oc056665; Thu, 29 Jul 2021 09:46:04 GMT (envelope-from git) Date: Thu, 29 Jul 2021 09:46:04 GMT Message-Id: <202107290946.16T9k4Oc056665@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: 3c886cb6917f - main - freebsd32: Remove unused umtx.h include. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3c886cb6917f1ff89e5756916cc0ff011e22c74d 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, 29 Jul 2021 09:46:04 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=3c886cb6917f1ff89e5756916cc0ff011e22c74d commit 3c886cb6917f1ff89e5756916cc0ff011e22c74d Author: Dmitry Chagin AuthorDate: 2021-07-29 09:40:08 +0000 Commit: Dmitry Chagin CommitDate: 2021-07-29 09:40:08 +0000 freebsd32: Remove unused umtx.h include. Differential Revision: https://reviews.freebsd.org/D31246 MFC after: 2 weeks --- sys/compat/freebsd32/freebsd32_misc.c | 1 - 1 file changed, 1 deletion(-) diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c index 950631352f12..99154f41820f 100644 --- a/sys/compat/freebsd32/freebsd32_misc.c +++ b/sys/compat/freebsd32/freebsd32_misc.c @@ -85,7 +85,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include From owner-dev-commits-src-all@freebsd.org Thu Jul 29 09:46: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 E810266FFD8; Thu, 29 Jul 2021 09:46: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 4Gb5JJ62hNz3sPd; Thu, 29 Jul 2021 09:46: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 B6ED77551; Thu, 29 Jul 2021 09:46: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 16T9k8hs056773; Thu, 29 Jul 2021 09:46:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16T9k8V4056772; Thu, 29 Jul 2021 09:46:08 GMT (envelope-from git) Date: Thu, 29 Jul 2021 09:46:08 GMT Message-Id: <202107290946.16T9k8V4056772@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: 1fdcc87cfd67 - main - umtx: Expose some of the umtx structures and API to the rest of the kernel. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1fdcc87cfd6775896d3cb46bb677dc2a15cfd9ac 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, 29 Jul 2021 09:46:09 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=1fdcc87cfd6775896d3cb46bb677dc2a15cfd9ac commit 1fdcc87cfd6775896d3cb46bb677dc2a15cfd9ac Author: Dmitry Chagin AuthorDate: 2021-07-29 09:42:17 +0000 Commit: Dmitry Chagin CommitDate: 2021-07-29 09:42:17 +0000 umtx: Expose some of the umtx structures and API to the rest of the kernel. Differential Revision: https://reviews.freebsd.org/D31233 MFC after: 2 weeks --- sys/kern/kern_umtx.c | 148 +++------------------------------------------------ sys/sys/umtxvar.h | 134 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 141 insertions(+), 141 deletions(-) diff --git a/sys/kern/kern_umtx.c b/sys/kern/kern_umtx.c index 5d2523c422d8..ae80554cbbb8 100644 --- a/sys/kern/kern_umtx.c +++ b/sys/kern/kern_umtx.c @@ -89,104 +89,6 @@ __FBSDID("$FreeBSD$"); (((w) > (sw)) || ((w) == (sw) && (f) > (sf))) #endif -/* Priority inheritance mutex info. */ -struct umtx_pi { - /* Owner thread */ - struct thread *pi_owner; - - /* Reference count */ - int pi_refcount; - - /* List entry to link umtx holding by thread */ - TAILQ_ENTRY(umtx_pi) pi_link; - - /* List entry in hash */ - TAILQ_ENTRY(umtx_pi) pi_hashlink; - - /* List for waiters */ - TAILQ_HEAD(,umtx_q) pi_blocked; - - /* Identify a userland lock object */ - struct umtx_key pi_key; -}; - -/* A userland synchronous object user. */ -struct umtx_q { - /* Linked list for the hash. */ - TAILQ_ENTRY(umtx_q) uq_link; - - /* Umtx key. */ - struct umtx_key uq_key; - - /* Umtx flags. */ - int uq_flags; -#define UQF_UMTXQ 0x0001 - - /* The thread waits on. */ - struct thread *uq_thread; - - /* - * Blocked on PI mutex. read can use chain lock - * or umtx_lock, write must have both chain lock and - * umtx_lock being hold. - */ - struct umtx_pi *uq_pi_blocked; - - /* On blocked list */ - TAILQ_ENTRY(umtx_q) uq_lockq; - - /* Thread contending with us */ - TAILQ_HEAD(,umtx_pi) uq_pi_contested; - - /* Inherited priority from PP mutex */ - u_char uq_inherited_pri; - - /* Spare queue ready to be reused */ - struct umtxq_queue *uq_spare_queue; - - /* The queue we on */ - struct umtxq_queue *uq_cur_queue; -}; - -TAILQ_HEAD(umtxq_head, umtx_q); - -/* Per-key wait-queue */ -struct umtxq_queue { - struct umtxq_head head; - struct umtx_key key; - LIST_ENTRY(umtxq_queue) link; - int length; -}; - -LIST_HEAD(umtxq_list, umtxq_queue); - -/* Userland lock object's wait-queue chain */ -struct umtxq_chain { - /* Lock for this chain. */ - struct mtx uc_lock; - - /* List of sleep queues. */ - struct umtxq_list uc_queue[2]; -#define UMTX_SHARED_QUEUE 0 -#define UMTX_EXCLUSIVE_QUEUE 1 - - LIST_HEAD(, umtxq_queue) uc_spare_queue; - - /* Busy flag */ - char uc_busy; - - /* Chain lock waiters */ - int uc_waiters; - - /* All PI in the list */ - TAILQ_HEAD(,umtx_pi) uc_pi_list; - -#ifdef UMTX_PROFILING - u_int length; - u_int max_length; -#endif -}; - #define UMTXQ_LOCKED_ASSERT(uc) mtx_assert(&(uc)->uc_lock, MA_OWNED) /* @@ -268,15 +170,6 @@ static inline void umtx_abs_timeout_update(struct umtx_abs_timeout *timo); static void umtx_shm_init(void); static void umtxq_sysinit(void *); static void umtxq_hash(struct umtx_key *key); -static struct umtxq_chain *umtxq_getchain(struct umtx_key *key); -static void umtxq_unlock(struct umtx_key *key); -static void umtxq_busy(struct umtx_key *key); -static void umtxq_unbusy(struct umtx_key *key); -static void umtxq_insert_queue(struct umtx_q *uq, int q); -static void umtxq_remove_queue(struct umtx_q *uq, int q); -static int umtxq_sleep(struct umtx_q *uq, const char *wmesg, - struct umtx_abs_timeout *); -static int umtxq_count(struct umtx_key *key); static struct umtx_pi *umtx_pi_alloc(int); static void umtx_pi_free(struct umtx_pi *pi); static int do_unlock_pp(struct thread *td, struct umutex *m, uint32_t flags, @@ -285,8 +178,6 @@ static void umtx_thread_cleanup(struct thread *td); SYSINIT(umtx, SI_SUB_EVENTHANDLER+1, SI_ORDER_MIDDLE, umtxq_sysinit, NULL); #define umtxq_signal(key, nwake) umtxq_signal_queue((key), (nwake), UMTX_SHARED_QUEUE) -#define umtxq_insert(uq) umtxq_insert_queue((uq), UMTX_SHARED_QUEUE) -#define umtxq_remove(uq) umtxq_remove_queue((uq), UMTX_SHARED_QUEUE) static struct mtx umtx_lock; @@ -487,7 +378,7 @@ umtxq_hash(struct umtx_key *key) key->hash = ((n * GOLDEN_RATIO_PRIME) >> UMTX_SHIFTS) % UMTX_CHAINS; } -static inline struct umtxq_chain * +struct umtxq_chain * umtxq_getchain(struct umtx_key *key) { @@ -496,36 +387,11 @@ umtxq_getchain(struct umtx_key *key) return (&umtxq_chains[0][key->hash]); } -/* - * Lock a chain. - * - * The code is a macro so that file/line information is taken from the caller. - */ -#define umtxq_lock(key) do { \ - struct umtx_key *_key = (key); \ - struct umtxq_chain *_uc; \ - \ - _uc = umtxq_getchain(_key); \ - mtx_lock(&_uc->uc_lock); \ -} while (0) - -/* - * Unlock a chain. - */ -static inline void -umtxq_unlock(struct umtx_key *key) -{ - struct umtxq_chain *uc; - - uc = umtxq_getchain(key); - mtx_unlock(&uc->uc_lock); -} - /* * Set chain to busy state when following operation * may be blocked (kernel mutex can not be used). */ -static inline void +void umtxq_busy(struct umtx_key *key) { struct umtxq_chain *uc; @@ -556,7 +422,7 @@ umtxq_busy(struct umtx_key *key) /* * Unbusy a chain. */ -static inline void +void umtxq_unbusy(struct umtx_key *key) { struct umtxq_chain *uc; @@ -594,7 +460,7 @@ umtxq_queue_lookup(struct umtx_key *key, int q) return (NULL); } -static inline void +void umtxq_insert_queue(struct umtx_q *uq, int q) { struct umtxq_queue *uh; @@ -628,7 +494,7 @@ umtxq_insert_queue(struct umtx_q *uq, int q) return; } -static inline void +void umtxq_remove_queue(struct umtx_q *uq, int q) { struct umtxq_chain *uc; @@ -661,7 +527,7 @@ umtxq_remove_queue(struct umtx_q *uq, int q) /* * Check if there are multiple waiters */ -static int +int umtxq_count(struct umtx_key *key) { struct umtxq_queue *uh; @@ -807,7 +673,7 @@ umtx_unlock_val(uint32_t flags, bool rb) * Put thread into sleep state, before sleeping, check if * thread was removed from umtx queue. */ -static inline int +int umtxq_sleep(struct umtx_q *uq, const char *wmesg, struct umtx_abs_timeout *abstime) { diff --git a/sys/sys/umtxvar.h b/sys/sys/umtxvar.h index 3f2c0d9e29ec..68f261fe6abf 100644 --- a/sys/sys/umtxvar.h +++ b/sys/sys/umtxvar.h @@ -87,6 +87,104 @@ struct umtx_abs_timeout { struct thread; +/* Priority inheritance mutex info. */ +struct umtx_pi { + /* Owner thread */ + struct thread *pi_owner; + + /* Reference count */ + int pi_refcount; + + /* List entry to link umtx holding by thread */ + TAILQ_ENTRY(umtx_pi) pi_link; + + /* List entry in hash */ + TAILQ_ENTRY(umtx_pi) pi_hashlink; + + /* List for waiters */ + TAILQ_HEAD(,umtx_q) pi_blocked; + + /* Identify a userland lock object */ + struct umtx_key pi_key; +}; + +/* A userland synchronous object user. */ +struct umtx_q { + /* Linked list for the hash. */ + TAILQ_ENTRY(umtx_q) uq_link; + + /* Umtx key. */ + struct umtx_key uq_key; + + /* Umtx flags. */ + int uq_flags; +#define UQF_UMTXQ 0x0001 + + /* The thread waits on. */ + struct thread *uq_thread; + + /* + * Blocked on PI mutex. read can use chain lock + * or umtx_lock, write must have both chain lock and + * umtx_lock being hold. + */ + struct umtx_pi *uq_pi_blocked; + + /* On blocked list */ + TAILQ_ENTRY(umtx_q) uq_lockq; + + /* Thread contending with us */ + TAILQ_HEAD(,umtx_pi) uq_pi_contested; + + /* Inherited priority from PP mutex */ + u_char uq_inherited_pri; + + /* Spare queue ready to be reused */ + struct umtxq_queue *uq_spare_queue; + + /* The queue we on */ + struct umtxq_queue *uq_cur_queue; +}; + +TAILQ_HEAD(umtxq_head, umtx_q); + +/* Per-key wait-queue */ +struct umtxq_queue { + struct umtxq_head head; + struct umtx_key key; + LIST_ENTRY(umtxq_queue) link; + int length; +}; + +LIST_HEAD(umtxq_list, umtxq_queue); + +/* Userland lock object's wait-queue chain */ +struct umtxq_chain { + /* Lock for this chain. */ + struct mtx uc_lock; + + /* List of sleep queues. */ + struct umtxq_list uc_queue[2]; +#define UMTX_SHARED_QUEUE 0 +#define UMTX_EXCLUSIVE_QUEUE 1 + + LIST_HEAD(, umtxq_queue) uc_spare_queue; + + /* Busy flag */ + char uc_busy; + + /* Chain lock waiters */ + int uc_waiters; + + /* All PI in the list */ + TAILQ_HEAD(,umtx_pi) uc_pi_list; + +#ifdef UMTX_PROFILING + u_int length; + u_int max_length; +#endif +}; + static inline int umtx_key_match(const struct umtx_key *k1, const struct umtx_key *k2) { @@ -103,7 +201,15 @@ void umtx_exec(struct proc *p); int umtx_key_get(const void *, int, int, struct umtx_key *); void umtx_key_release(struct umtx_key *); struct umtx_q *umtxq_alloc(void); +void umtxq_busy(struct umtx_key *); +int umtxq_count(struct umtx_key *); void umtxq_free(struct umtx_q *); +struct umtxq_chain *umtxq_getchain(struct umtx_key *); +void umtxq_insert_queue(struct umtx_q *, int); +void umtxq_remove_queue(struct umtx_q *, int); +int umtxq_sleep(struct umtx_q *, const char *, + struct umtx_abs_timeout *); +void umtxq_unbusy(struct umtx_key *); int kern_umtx_wake(struct thread *, void *, int, int); void umtx_pi_adjust(struct thread *, u_char); void umtx_thread_init(struct thread *); @@ -111,5 +217,33 @@ void umtx_thread_fini(struct thread *); void umtx_thread_alloc(struct thread *); void umtx_thread_exit(struct thread *); +#define umtxq_insert(uq) umtxq_insert_queue((uq), UMTX_SHARED_QUEUE) +#define umtxq_remove(uq) umtxq_remove_queue((uq), UMTX_SHARED_QUEUE) + +/* + * Lock a chain. + * + * The code is a macro so that file/line information is taken from the caller. + */ +#define umtxq_lock(key) do { \ + struct umtx_key *_key = (key); \ + struct umtxq_chain *_uc; \ + \ + _uc = umtxq_getchain(_key); \ + mtx_lock(&_uc->uc_lock); \ +} while (0) + +/* + * Unlock a chain. + */ +static inline void +umtxq_unlock(struct umtx_key *key) +{ + struct umtxq_chain *uc; + + uc = umtxq_getchain(key); + mtx_unlock(&uc->uc_lock); +} + #endif /* _KERNEL */ #endif /* !_SYS_UMTXVAR_H_ */ From owner-dev-commits-src-all@freebsd.org Thu Jul 29 09:46: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 C9A8466FA79; Thu, 29 Jul 2021 09:46: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 4Gb5JH55TDz3sPY; Thu, 29 Jul 2021 09:46: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 91CE17933; Thu, 29 Jul 2021 09:46: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 16T9k7vr056747; Thu, 29 Jul 2021 09:46:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16T9k7Yp056746; Thu, 29 Jul 2021 09:46:07 GMT (envelope-from git) Date: Thu, 29 Jul 2021 09:46:07 GMT Message-Id: <202107290946.16T9k7Yp056746@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: 307a3dd35cd4 - main - umtx: Expose struct abs_timeout to the rest of the kernel. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 307a3dd35cd48ae39849192e0d7a7d34ac7e6ac8 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, 29 Jul 2021 09:46:08 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=307a3dd35cd48ae39849192e0d7a7d34ac7e6ac8 commit 307a3dd35cd48ae39849192e0d7a7d34ac7e6ac8 Author: Dmitry Chagin AuthorDate: 2021-07-29 09:41:58 +0000 Commit: Dmitry Chagin CommitDate: 2021-07-29 09:41:58 +0000 umtx: Expose struct abs_timeout to the rest of the kernel. Add umtx_ prefix to all abs_timeout facility and add declaration for it. For consistency with others abs_timeout mark inline abs_timeout_init2. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D31249 MFC after: 2 weeks --- sys/kern/kern_umtx.c | 95 ++++++++++++++++++++++++++-------------------------- sys/sys/umtxvar.h | 9 +++++ 2 files changed, 56 insertions(+), 48 deletions(-) diff --git a/sys/kern/kern_umtx.c b/sys/kern/kern_umtx.c index c7f9afeb6c4d..5d2523c422d8 100644 --- a/sys/kern/kern_umtx.c +++ b/sys/kern/kern_umtx.c @@ -213,13 +213,6 @@ struct umtxq_chain { #define BUSY_SPINS 200 -struct abs_timeout { - int clockid; - bool is_abs_real; /* TIMER_ABSTIME && CLOCK_REALTIME* */ - struct timespec cur; - struct timespec end; -}; - struct umtx_copyops { int (*copyin_timeout)(const void *uaddr, struct timespec *tsp); int (*copyin_umtx_time)(const void *uaddr, size_t size, @@ -267,7 +260,10 @@ static SYSCTL_NODE(_debug_umtx, OID_AUTO, chains, CTLFLAG_RD | CTLFLAG_MPSAFE, 0 "umtx chain stats"); #endif -static void abs_timeout_update(struct abs_timeout *timo); +static inline void umtx_abs_timeout_init2(struct umtx_abs_timeout *timo, + const struct _umtx_time *umtxtime); +static int umtx_abs_timeout_gethz(struct umtx_abs_timeout *timo); +static inline void umtx_abs_timeout_update(struct umtx_abs_timeout *timo); static void umtx_shm_init(void); static void umtxq_sysinit(void *); @@ -278,7 +274,8 @@ static void umtxq_busy(struct umtx_key *key); static void umtxq_unbusy(struct umtx_key *key); static void umtxq_insert_queue(struct umtx_q *uq, int q); static void umtxq_remove_queue(struct umtx_q *uq, int q); -static int umtxq_sleep(struct umtx_q *uq, const char *wmesg, struct abs_timeout *); +static int umtxq_sleep(struct umtx_q *uq, const char *wmesg, + struct umtx_abs_timeout *); static int umtxq_count(struct umtx_key *key); static struct umtx_pi *umtx_pi_alloc(int); static void umtx_pi_free(struct umtx_pi *pi); @@ -741,15 +738,15 @@ tstohz(const struct timespec *tsp) return tvtohz(&tv); } -static void -abs_timeout_init(struct abs_timeout *timo, int clockid, int absolute, - const struct timespec *timeout) +void +umtx_abs_timeout_init(struct umtx_abs_timeout *timo, int clockid, + int absolute, const struct timespec *timeout) { timo->clockid = clockid; if (!absolute) { timo->is_abs_real = false; - abs_timeout_update(timo); + umtx_abs_timeout_update(timo); timespecadd(&timo->cur, timeout, &timo->end); } else { timo->end = *timeout; @@ -761,28 +758,29 @@ abs_timeout_init(struct abs_timeout *timo, int clockid, int absolute, * after setting td_rtcgen; otherwise, read it here. */ if (!timo->is_abs_real) { - abs_timeout_update(timo); + umtx_abs_timeout_update(timo); } } } static void -abs_timeout_init2(struct abs_timeout *timo, const struct _umtx_time *umtxtime) +umtx_abs_timeout_init2(struct umtx_abs_timeout *timo, + const struct _umtx_time *umtxtime) { - abs_timeout_init(timo, umtxtime->_clockid, + umtx_abs_timeout_init(timo, umtxtime->_clockid, (umtxtime->_flags & UMTX_ABSTIME) != 0, &umtxtime->_timeout); } -static inline void -abs_timeout_update(struct abs_timeout *timo) +static void +umtx_abs_timeout_update(struct umtx_abs_timeout *timo) { kern_clock_gettime(curthread, timo->clockid, &timo->cur); } static int -abs_timeout_gethz(struct abs_timeout *timo) +umtx_abs_timeout_gethz(struct umtx_abs_timeout *timo) { struct timespec tts; @@ -810,14 +808,15 @@ umtx_unlock_val(uint32_t flags, bool rb) * thread was removed from umtx queue. */ static inline int -umtxq_sleep(struct umtx_q *uq, const char *wmesg, struct abs_timeout *abstime) +umtxq_sleep(struct umtx_q *uq, const char *wmesg, + struct umtx_abs_timeout *abstime) { struct umtxq_chain *uc; int error, timo; if (abstime != NULL && abstime->is_abs_real) { curthread->td_rtcgen = atomic_load_acq_int(&rtc_generation); - abs_timeout_update(abstime); + umtx_abs_timeout_update(abstime); } uc = umtxq_getchain(&uq->uq_key); @@ -828,7 +827,7 @@ umtxq_sleep(struct umtx_q *uq, const char *wmesg, struct abs_timeout *abstime) break; } if (abstime != NULL) { - timo = abs_timeout_gethz(abstime); + timo = umtx_abs_timeout_gethz(abstime); if (timo < 0) { error = ETIMEDOUT; break; @@ -844,7 +843,7 @@ umtxq_sleep(struct umtx_q *uq, const char *wmesg, struct abs_timeout *abstime) if (abstime->is_abs_real) curthread->td_rtcgen = atomic_load_acq_int(&rtc_generation); - abs_timeout_update(abstime); + umtx_abs_timeout_update(abstime); } umtxq_lock(&uq->uq_key); } @@ -917,7 +916,7 @@ static int do_lock_umtx(struct thread *td, struct umtx *umtx, u_long id, const struct timespec *timeout) { - struct abs_timeout timo; + struct umtx_abs_timeout timo; struct umtx_q *uq; u_long owner; u_long old; @@ -925,7 +924,7 @@ do_lock_umtx(struct thread *td, struct umtx *umtx, u_long id, uq = td->td_umtxq; if (timeout != NULL) - abs_timeout_init(&timo, CLOCK_REALTIME, 0, timeout); + umtx_abs_timeout_init(&timo, CLOCK_REALTIME, 0, timeout); /* * Care must be exercised when dealing with umtx structure. It @@ -1098,7 +1097,7 @@ static int do_lock_umtx32(struct thread *td, uint32_t *m, uint32_t id, const struct timespec *timeout) { - struct abs_timeout timo; + struct umtx_abs_timeout timo; struct umtx_q *uq; uint32_t owner; uint32_t old; @@ -1107,7 +1106,7 @@ do_lock_umtx32(struct thread *td, uint32_t *m, uint32_t id, uq = td->td_umtxq; if (timeout != NULL) - abs_timeout_init(&timo, CLOCK_REALTIME, 0, timeout); + umtx_abs_timeout_init(&timo, CLOCK_REALTIME, 0, timeout); /* * Care must be exercised when dealing with umtx structure. It @@ -1279,7 +1278,7 @@ static int do_wait(struct thread *td, void *addr, u_long id, struct _umtx_time *timeout, int compat32, int is_private) { - struct abs_timeout timo; + struct umtx_abs_timeout timo; struct umtx_q *uq; u_long tmp; uint32_t tmp32; @@ -1291,7 +1290,7 @@ do_wait(struct thread *td, void *addr, u_long id, return (error); if (timeout != NULL) - abs_timeout_init2(&timo, timeout); + umtx_abs_timeout_init2(&timo, timeout); umtxq_lock(&uq->uq_key); umtxq_insert(uq); @@ -1352,7 +1351,7 @@ static int do_lock_normal(struct thread *td, struct umutex *m, uint32_t flags, struct _umtx_time *timeout, int mode) { - struct abs_timeout timo; + struct umtx_abs_timeout timo; struct umtx_q *uq; uint32_t owner, old, id; int error, rv; @@ -1361,7 +1360,7 @@ do_lock_normal(struct thread *td, struct umutex *m, uint32_t flags, uq = td->td_umtxq; error = 0; if (timeout != NULL) - abs_timeout_init2(&timo, timeout); + umtx_abs_timeout_init2(&timo, timeout); /* * Care must be exercised when dealing with umtx structure. It @@ -2020,7 +2019,7 @@ umtx_pi_adjust(struct thread *td, u_char oldpri) */ static int umtxq_sleep_pi(struct umtx_q *uq, struct umtx_pi *pi, uint32_t owner, - const char *wmesg, struct abs_timeout *timo, bool shared) + const char *wmesg, struct umtx_abs_timeout *timo, bool shared) { struct thread *td, *td1; struct umtx_q *uq1; @@ -2158,7 +2157,7 @@ static int do_lock_pi(struct thread *td, struct umutex *m, uint32_t flags, struct _umtx_time *timeout, int try) { - struct abs_timeout timo; + struct umtx_abs_timeout timo; struct umtx_q *uq; struct umtx_pi *pi, *new_pi; uint32_t id, old_owner, owner, old; @@ -2173,7 +2172,7 @@ do_lock_pi(struct thread *td, struct umutex *m, uint32_t flags, return (error); if (timeout != NULL) - abs_timeout_init2(&timo, timeout); + umtx_abs_timeout_init2(&timo, timeout); umtxq_lock(&uq->uq_key); pi = umtx_pi_lookup(&uq->uq_key); @@ -2494,7 +2493,7 @@ static int do_lock_pp(struct thread *td, struct umutex *m, uint32_t flags, struct _umtx_time *timeout, int try) { - struct abs_timeout timo; + struct umtx_abs_timeout timo; struct umtx_q *uq, *uq2; struct umtx_pi *pi; uint32_t ceiling; @@ -2509,7 +2508,7 @@ do_lock_pp(struct thread *td, struct umutex *m, uint32_t flags, return (error); if (timeout != NULL) - abs_timeout_init2(&timo, timeout); + umtx_abs_timeout_init2(&timo, timeout); su = (priv_check(td, PRIV_SCHED_RTPRIO) == 0); for (;;) { @@ -2899,7 +2898,7 @@ static int do_cv_wait(struct thread *td, struct ucond *cv, struct umutex *m, struct timespec *timeout, u_long wflags) { - struct abs_timeout timo; + struct umtx_abs_timeout timo; struct umtx_q *uq; uint32_t flags, clockid, hasw; int error; @@ -2946,8 +2945,8 @@ do_cv_wait(struct thread *td, struct ucond *cv, struct umutex *m, error = do_unlock_umutex(td, m, false); if (timeout != NULL) - abs_timeout_init(&timo, clockid, (wflags & CVWAIT_ABSTIME) != 0, - timeout); + umtx_abs_timeout_init(&timo, clockid, + (wflags & CVWAIT_ABSTIME) != 0, timeout); umtxq_lock(&uq->uq_key); if (error == 0) { @@ -3047,7 +3046,7 @@ static int do_rw_rdlock(struct thread *td, struct urwlock *rwlock, long fflag, struct _umtx_time *timeout) { - struct abs_timeout timo; + struct umtx_abs_timeout timo; struct umtx_q *uq; uint32_t flags, wrflags; int32_t state, oldstate; @@ -3063,7 +3062,7 @@ do_rw_rdlock(struct thread *td, struct urwlock *rwlock, long fflag, return (error); if (timeout != NULL) - abs_timeout_init2(&timo, timeout); + umtx_abs_timeout_init2(&timo, timeout); wrflags = URWLOCK_WRITE_OWNER; if (!(fflag & URWLOCK_PREFER_READER) && !(flags & URWLOCK_PREFER_READER)) @@ -3232,7 +3231,7 @@ sleep: static int do_rw_wrlock(struct thread *td, struct urwlock *rwlock, struct _umtx_time *timeout) { - struct abs_timeout timo; + struct umtx_abs_timeout timo; struct umtx_q *uq; uint32_t flags; int32_t state, oldstate; @@ -3249,7 +3248,7 @@ do_rw_wrlock(struct thread *td, struct urwlock *rwlock, struct _umtx_time *timeo return (error); if (timeout != NULL) - abs_timeout_init2(&timo, timeout); + umtx_abs_timeout_init2(&timo, timeout); blocked_readers = 0; for (;;) { @@ -3527,7 +3526,7 @@ out: static int do_sem_wait(struct thread *td, struct _usem *sem, struct _umtx_time *timeout) { - struct abs_timeout timo; + struct umtx_abs_timeout timo; struct umtx_q *uq; uint32_t flags, count, count1; int error, rv, rv1; @@ -3541,7 +3540,7 @@ do_sem_wait(struct thread *td, struct _usem *sem, struct _umtx_time *timeout) return (error); if (timeout != NULL) - abs_timeout_init2(&timo, timeout); + umtx_abs_timeout_init2(&timo, timeout); again: umtxq_lock(&uq->uq_key); @@ -3632,7 +3631,7 @@ do_sem_wake(struct thread *td, struct _usem *sem) static int do_sem2_wait(struct thread *td, struct _usem2 *sem, struct _umtx_time *timeout) { - struct abs_timeout timo; + struct umtx_abs_timeout timo; struct umtx_q *uq; uint32_t count, flags; int error, rv; @@ -3640,7 +3639,7 @@ do_sem2_wait(struct thread *td, struct _usem2 *sem, struct _umtx_time *timeout) uq = td->td_umtxq; flags = fuword32(&sem->_flags); if (timeout != NULL) - abs_timeout_init2(&timo, timeout); + umtx_abs_timeout_init2(&timo, timeout); again: error = umtx_key_get(sem, TYPE_SEM, GET_SHARE(flags), &uq->uq_key); @@ -3699,7 +3698,7 @@ again: if (error == ERESTART) error = EINTR; if (error == EINTR) { - abs_timeout_update(&timo); + umtx_abs_timeout_update(&timo); timespecsub(&timo.end, &timo.cur, &timeout->_timeout); } diff --git a/sys/sys/umtxvar.h b/sys/sys/umtxvar.h index b898c263201e..3f2c0d9e29ec 100644 --- a/sys/sys/umtxvar.h +++ b/sys/sys/umtxvar.h @@ -78,6 +78,13 @@ struct umtx_key { #define PROCESS_SHARE 1 #define AUTO_SHARE 2 +struct umtx_abs_timeout { + int clockid; + bool is_abs_real; /* TIMER_ABSTIME && CLOCK_REALTIME* */ + struct timespec cur; + struct timespec end; +}; + struct thread; static inline int @@ -89,6 +96,8 @@ umtx_key_match(const struct umtx_key *k1, const struct umtx_key *k2) k1->info.both.b == k2->info.both.b); } +void umtx_abs_timeout_init(struct umtx_abs_timeout *, int, int, + const struct timespec *); int umtx_copyin_timeout(const void *, struct timespec *); void umtx_exec(struct proc *p); int umtx_key_get(const void *, int, int, struct umtx_key *); From owner-dev-commits-src-all@freebsd.org Thu Jul 29 09:46: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 610E766FED9; Thu, 29 Jul 2021 09:46: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 4Gb5JN1r5Fz3sFv; Thu, 29 Jul 2021 09:46: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 1452C7934; Thu, 29 Jul 2021 09:46: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 16T9kCDf056853; Thu, 29 Jul 2021 09:46:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16T9kCf4056852; Thu, 29 Jul 2021 09:46:12 GMT (envelope-from git) Date: Thu, 29 Jul 2021 09:46:12 GMT Message-Id: <202107290946.16T9kCf4056852@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: 0dc38e33031b - main - linux(4): Reimplement futexes using umtx. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0dc38e33031b353468888fe25a6f8ba1f910dd26 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, 29 Jul 2021 09:46:12 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=0dc38e33031b353468888fe25a6f8ba1f910dd26 commit 0dc38e33031b353468888fe25a6f8ba1f910dd26 Author: Dmitry Chagin AuthorDate: 2021-07-29 09:43:48 +0000 Commit: Dmitry Chagin CommitDate: 2021-07-29 09:43:48 +0000 linux(4): Reimplement futexes using umtx. Differential Revision: https://reviews.freebsd.org/D31236 MFC after: 2 weeks --- sys/compat/linux/linux.c | 3 - sys/compat/linux/linux.h | 3 - sys/compat/linux/linux_common.c | 4 - sys/compat/linux/linux_fork.c | 9 +- sys/compat/linux/linux_futex.c | 719 ++++++++-------------------------------- sys/compat/linux/linux_futex.h | 1 + sys/compat/linux/linux_util.c | 2 - sys/compat/linux/linux_util.h | 2 - sys/i386/linux/linux_sysvec.c | 5 - 9 files changed, 135 insertions(+), 613 deletions(-) diff --git a/sys/compat/linux/linux.c b/sys/compat/linux/linux.c index e72e5cbc7bfc..8cc678e1ec7d 100644 --- a/sys/compat/linux/linux.c +++ b/sys/compat/linux/linux.c @@ -56,9 +56,6 @@ __FBSDID("$FreeBSD$"); #include #include -struct futex_list futex_list; -struct mtx futex_mtx; /* protects the futex list */ - CTASSERT(LINUX_IFNAMSIZ == IFNAMSIZ); static int bsd_to_linux_sigtbl[LINUX_SIGTBLSZ] = { diff --git a/sys/compat/linux/linux.h b/sys/compat/linux/linux.h index 730aece66a6a..cd123622d14a 100644 --- a/sys/compat/linux/linux.h +++ b/sys/compat/linux/linux.h @@ -173,9 +173,6 @@ void bsd_to_linux_sigset(sigset_t *, l_sigset_t *); int linux_to_bsd_signal(int sig); int bsd_to_linux_signal(int sig); -extern LIST_HEAD(futex_list, futex) futex_list; -extern struct mtx futex_mtx; - void linux_dev_shm_create(void); void linux_dev_shm_destroy(void); diff --git a/sys/compat/linux/linux_common.c b/sys/compat/linux/linux_common.c index 4d81470649de..0009d9d26164 100644 --- a/sys/compat/linux/linux_common.c +++ b/sys/compat/linux/linux_common.c @@ -34,7 +34,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include @@ -64,15 +63,12 @@ linux_common_modevent(module_t mod, int type, void *data) linux_osd_jail_register(); SET_FOREACH(ldhp, linux_device_handler_set) linux_device_register_handler(*ldhp); - LIST_INIT(&futex_list); - mtx_init(&futex_mtx, "ftllk", NULL, MTX_DEF); break; case MOD_UNLOAD: linux_dev_shm_destroy(); linux_osd_jail_deregister(); SET_FOREACH(ldhp, linux_device_handler_set) linux_device_unregister_handler(*ldhp); - mtx_destroy(&futex_mtx); break; default: return (EOPNOTSUPP); diff --git a/sys/compat/linux/linux_fork.c b/sys/compat/linux/linux_fork.c index 8230d5b4108b..ff2d5dcfc957 100644 --- a/sys/compat/linux/linux_fork.c +++ b/sys/compat/linux/linux_fork.c @@ -407,7 +407,6 @@ linux_set_tid_address(struct thread *td, struct linux_set_tid_address_args *args void linux_thread_detach(struct thread *td) { - struct linux_sys_futex_args cup; struct linux_emuldata *em; int *child_clear_tid; int error; @@ -429,13 +428,7 @@ linux_thread_detach(struct thread *td) if (error != 0) return; - cup.uaddr = child_clear_tid; - cup.op = LINUX_FUTEX_WAKE; - cup.val = 1; /* wake one */ - cup.timeout = NULL; - cup.uaddr2 = NULL; - cup.val3 = 0; - error = linux_sys_futex(td, &cup); + error = futex_wake(td, child_clear_tid, 1, false); /* * this cannot happen at the moment and if this happens it * probably means there is a user space bug diff --git a/sys/compat/linux/linux_futex.c b/sys/compat/linux/linux_futex.c index 547d52c8ca4a..df6c7cdbf74a 100644 --- a/sys/compat/linux/linux_futex.c +++ b/sys/compat/linux/linux_futex.c @@ -77,62 +77,21 @@ __KERNEL_RCSID(1, "$NetBSD: linux_futex.c,v 1.7 2006/07/24 19:01:49 manu Exp $") /* DTrace init */ LIN_SDT_PROVIDER_DECLARE(LINUX_DTRACE); -/** - * Futex part for the special DTrace module "locks". - */ -LIN_SDT_PROBE_DEFINE1(locks, futex_mtx, locked, "struct mtx *"); -LIN_SDT_PROBE_DEFINE1(locks, futex_mtx, unlock, "struct mtx *"); - -/** - * Per futex probes. - */ -LIN_SDT_PROBE_DEFINE1(futex, futex, create, "struct sx *"); -LIN_SDT_PROBE_DEFINE1(futex, futex, destroy, "struct sx *"); - /** * DTrace probes in this module. */ -LIN_SDT_PROBE_DEFINE3(futex, futex_put, destroy, "uint32_t *", "uint32_t", - "int"); -LIN_SDT_PROBE_DEFINE3(futex, futex_put, unlock, "uint32_t *", "uint32_t", - "int"); -LIN_SDT_PROBE_DEFINE1(futex, futex_get0, umtx_key_get_error, "int"); -LIN_SDT_PROBE_DEFINE3(futex, futex_get0, shared, "uint32_t *", "uint32_t", - "int"); -LIN_SDT_PROBE_DEFINE1(futex, futex_get0, null, "uint32_t *"); -LIN_SDT_PROBE_DEFINE3(futex, futex_get0, new, "uint32_t *", "uint32_t", "int"); -LIN_SDT_PROBE_DEFINE0(futex, futex_get, error); -LIN_SDT_PROBE_DEFINE5(futex, futex_sleep, requeue_error, "int", "uint32_t *", - "struct waiting_proc *", "uint32_t *", "uint32_t"); -LIN_SDT_PROBE_DEFINE3(futex, futex_sleep, sleep_error, "int", "uint32_t *", - "struct waiting_proc *"); -LIN_SDT_PROBE_DEFINE3(futex, futex_wake, iterate, "uint32_t", - "struct waiting_proc *", "uint32_t"); -LIN_SDT_PROBE_DEFINE1(futex, futex_wake, wakeup, "struct waiting_proc *"); -LIN_SDT_PROBE_DEFINE1(futex, futex_requeue, wakeup, "struct waiting_proc *"); -LIN_SDT_PROBE_DEFINE3(futex, futex_requeue, requeue, "uint32_t *", - "struct waiting_proc *", "uint32_t"); -LIN_SDT_PROBE_DEFINE1(futex, futex_wait, sleep_error, "int"); LIN_SDT_PROBE_DEFINE4(futex, futex_atomic_op, decoded_op, "int", "int", "int", "int"); LIN_SDT_PROBE_DEFINE1(futex, futex_atomic_op, unimplemented_op, "int"); LIN_SDT_PROBE_DEFINE1(futex, futex_atomic_op, unimplemented_cmp, "int"); -LIN_SDT_PROBE_DEFINE0(futex, linux_futex, unimplemented_clockswitch); -LIN_SDT_PROBE_DEFINE1(futex, linux_futex, copyin_error, "int"); -LIN_SDT_PROBE_DEFINE0(futex, linux_futex, invalid_cmp_requeue_use); LIN_SDT_PROBE_DEFINE3(futex, linux_futex, debug_wait, "uint32_t *", "uint32_t", "uint32_t"); -LIN_SDT_PROBE_DEFINE4(futex, linux_futex, debug_wait_value_neq, - "uint32_t *", "uint32_t", "int", "uint32_t"); LIN_SDT_PROBE_DEFINE3(futex, linux_futex, debug_wake, "uint32_t *", "uint32_t", "uint32_t"); LIN_SDT_PROBE_DEFINE5(futex, linux_futex, debug_cmp_requeue, "uint32_t *", "uint32_t", "uint32_t", "uint32_t *", "struct l_timespec *"); -LIN_SDT_PROBE_DEFINE2(futex, linux_futex, debug_cmp_requeue_value_neq, - "uint32_t", "int"); LIN_SDT_PROBE_DEFINE5(futex, linux_futex, debug_wake_op, "uint32_t *", "int", "uint32_t", "uint32_t *", "uint32_t"); -LIN_SDT_PROBE_DEFINE0(futex, linux_futex, unhandled_efault); LIN_SDT_PROBE_DEFINE0(futex, linux_futex, unimplemented_lock_pi); LIN_SDT_PROBE_DEFINE0(futex, linux_futex, unimplemented_unlock_pi); LIN_SDT_PROBE_DEFINE0(futex, linux_futex, unimplemented_trylock_pi); @@ -146,77 +105,10 @@ LIN_SDT_PROBE_DEFINE1(futex, handle_futex_death, copyin_error, "int"); LIN_SDT_PROBE_DEFINE1(futex, fetch_robust_entry, copyin_error, "int"); LIN_SDT_PROBE_DEFINE1(futex, release_futexes, copyin_error, "int"); -struct futex; +#define FUTEX_SHARED 0x8 /* shared futex */ -struct waiting_proc { - uint32_t wp_flags; - struct futex *wp_futex; - TAILQ_ENTRY(waiting_proc) wp_list; -}; - -struct futex { - struct mtx f_lck; - uint32_t *f_uaddr; /* user-supplied value, for debug */ - struct umtx_key f_key; - uint32_t f_refcount; - uint32_t f_bitset; - LIST_ENTRY(futex) f_list; - TAILQ_HEAD(lf_waiting_proc, waiting_proc) f_waiting_proc; -}; +#define GET_SHARED(a) (a->flags & FUTEX_SHARED) ? AUTO_SHARE : THREAD_SHARE -#define FUTEX_LOCK(f) mtx_lock(&(f)->f_lck) -#define FUTEX_LOCKED(f) mtx_owned(&(f)->f_lck) -#define FUTEX_UNLOCK(f) mtx_unlock(&(f)->f_lck) -#define FUTEX_INIT(f) do { \ - mtx_init(&(f)->f_lck, "ftlk", NULL, \ - MTX_DUPOK); \ - LIN_SDT_PROBE1(futex, futex, create, \ - &(f)->f_lck); \ - } while (0) -#define FUTEX_DESTROY(f) do { \ - LIN_SDT_PROBE1(futex, futex, destroy, \ - &(f)->f_lck); \ - mtx_destroy(&(f)->f_lck); \ - } while (0) -#define FUTEX_ASSERT_LOCKED(f) mtx_assert(&(f)->f_lck, MA_OWNED) -#define FUTEX_ASSERT_UNLOCKED(f) mtx_assert(&(f)->f_lck, MA_NOTOWNED) - -#define FUTEXES_LOCK do { \ - mtx_lock(&futex_mtx); \ - LIN_SDT_PROBE1(locks, futex_mtx, \ - locked, &futex_mtx); \ - } while (0) -#define FUTEXES_UNLOCK do { \ - LIN_SDT_PROBE1(locks, futex_mtx, \ - unlock, &futex_mtx); \ - mtx_unlock(&futex_mtx); \ - } while (0) - -/* flags for futex_get() */ -#define FUTEX_CREATE_WP 0x1 /* create waiting_proc */ -#define FUTEX_DONTCREATE 0x2 /* don't create futex if not exists */ -#define FUTEX_DONTEXISTS 0x4 /* return EINVAL if futex exists */ -#define FUTEX_SHARED 0x8 /* shared futex */ -#define FUTEX_DONTLOCK 0x10 /* don't lock futex */ - -/* wp_flags */ -#define FUTEX_WP_REQUEUED 0x1 /* wp requeued - wp moved from wp_list - * of futex where thread sleep to wp_list - * of another futex. - */ -#define FUTEX_WP_REMOVED 0x2 /* wp is woken up and removed from futex - * wp_list to prevent double wakeup. - */ - -static void futex_put(struct futex *, struct waiting_proc *); -static int futex_get0(uint32_t *, struct futex **f, uint32_t); -static int futex_get(uint32_t *, struct waiting_proc **, struct futex **, - uint32_t); -static int futex_sleep(struct futex *, struct waiting_proc *, struct timespec *); -static int futex_wake(struct futex *, int, uint32_t); -static int futex_requeue(struct futex *, int, struct futex *, int); -static void futex_lock(struct futex *); -static void futex_unlock(struct futex *); static int futex_atomic_op(struct thread *, int, uint32_t *); static int handle_futex_death(struct linux_emuldata *, uint32_t *, unsigned int); @@ -236,320 +128,27 @@ struct linux_futex_args { struct timespec kts; }; +static void linux_umtx_abs_timeout_init(struct umtx_abs_timeout *, + struct linux_futex_args *); static int linux_futex(struct thread *, struct linux_futex_args *); static int linux_futex_wait(struct thread *, struct linux_futex_args *); static int linux_futex_wake(struct thread *, struct linux_futex_args *); static int linux_futex_requeue(struct thread *, struct linux_futex_args *); static int linux_futex_wakeop(struct thread *, struct linux_futex_args *); -static void -futex_put(struct futex *f, struct waiting_proc *wp) -{ - - if (wp != NULL) { - if ((wp->wp_flags & FUTEX_WP_REMOVED) == 0) - TAILQ_REMOVE(&f->f_waiting_proc, wp, wp_list); - free(wp, M_FUTEX_WP); - } - - FUTEXES_LOCK; - if (--f->f_refcount == 0) { - LIST_REMOVE(f, f_list); - FUTEXES_UNLOCK; - if (FUTEX_LOCKED(f)) - futex_unlock(f); - - LIN_SDT_PROBE3(futex, futex_put, destroy, f->f_uaddr, - f->f_refcount, f->f_key.shared); - LINUX_CTR3(sys_futex, "futex_put destroy uaddr %p ref %d " - "shared %d", f->f_uaddr, f->f_refcount, f->f_key.shared); - umtx_key_release(&f->f_key); - FUTEX_DESTROY(f); - free(f, M_FUTEX); - return; - } - - LIN_SDT_PROBE3(futex, futex_put, unlock, f->f_uaddr, f->f_refcount, - f->f_key.shared); - LINUX_CTR3(sys_futex, "futex_put uaddr %p ref %d shared %d", - f->f_uaddr, f->f_refcount, f->f_key.shared); - if (FUTEX_LOCKED(f)) - futex_unlock(f); - FUTEXES_UNLOCK; -} - -static int -futex_get0(uint32_t *uaddr, struct futex **newf, uint32_t flags) -{ - struct futex *f, *tmpf; - struct umtx_key key; - int error; - - *newf = tmpf = NULL; - - error = umtx_key_get(uaddr, TYPE_FUTEX, (flags & FUTEX_SHARED) ? - AUTO_SHARE : THREAD_SHARE, &key); - if (error) { - LIN_SDT_PROBE1(futex, futex_get0, umtx_key_get_error, error); - return (error); - } -retry: - FUTEXES_LOCK; - LIST_FOREACH(f, &futex_list, f_list) { - if (umtx_key_match(&f->f_key, &key)) { - if (tmpf != NULL) { - if (FUTEX_LOCKED(tmpf)) - futex_unlock(tmpf); - FUTEX_DESTROY(tmpf); - free(tmpf, M_FUTEX); - } - if (flags & FUTEX_DONTEXISTS) { - FUTEXES_UNLOCK; - umtx_key_release(&key); - - return (EINVAL); - } - - /* - * Increment refcount of the found futex to - * prevent it from deallocation before FUTEX_LOCK() - */ - ++f->f_refcount; - FUTEXES_UNLOCK; - umtx_key_release(&key); - - if ((flags & FUTEX_DONTLOCK) == 0) - futex_lock(f); - *newf = f; - LIN_SDT_PROBE3(futex, futex_get0, shared, uaddr, - f->f_refcount, f->f_key.shared); - LINUX_CTR3(sys_futex, "futex_get uaddr %p ref %d shared %d", - uaddr, f->f_refcount, f->f_key.shared); - - return (0); - } - } - - if (flags & FUTEX_DONTCREATE) { - FUTEXES_UNLOCK; - umtx_key_release(&key); - LIN_SDT_PROBE1(futex, futex_get0, null, uaddr); - LINUX_CTR1(sys_futex, "futex_get uaddr %p null", uaddr); - - return (0); - } - - if (tmpf == NULL) { - FUTEXES_UNLOCK; - tmpf = malloc(sizeof(*tmpf), M_FUTEX, M_WAITOK | M_ZERO); - tmpf->f_uaddr = uaddr; - tmpf->f_key = key; - tmpf->f_refcount = 1; - tmpf->f_bitset = FUTEX_BITSET_MATCH_ANY; - FUTEX_INIT(tmpf); - TAILQ_INIT(&tmpf->f_waiting_proc); - - /* - * Lock the new futex before an insert into the futex_list - * to prevent futex usage by other. - */ - if ((flags & FUTEX_DONTLOCK) == 0) - futex_lock(tmpf); - goto retry; - } - - LIST_INSERT_HEAD(&futex_list, tmpf, f_list); - FUTEXES_UNLOCK; - - LIN_SDT_PROBE3(futex, futex_get0, new, uaddr, tmpf->f_refcount, - tmpf->f_key.shared); - LINUX_CTR3(sys_futex, "futex_get uaddr %p ref %d shared %d new", - uaddr, tmpf->f_refcount, tmpf->f_key.shared); - *newf = tmpf; - - return (0); -} - -static int -futex_get(uint32_t *uaddr, struct waiting_proc **wp, struct futex **f, - uint32_t flags) -{ - int error; - - if (flags & FUTEX_CREATE_WP) { - *wp = malloc(sizeof(struct waiting_proc), M_FUTEX_WP, M_WAITOK); - (*wp)->wp_flags = 0; - } - error = futex_get0(uaddr, f, flags); - if (error) { - LIN_SDT_PROBE0(futex, futex_get, error); - - if (flags & FUTEX_CREATE_WP) - free(*wp, M_FUTEX_WP); - - return (error); - } - if (flags & FUTEX_CREATE_WP) { - TAILQ_INSERT_HEAD(&(*f)->f_waiting_proc, *wp, wp_list); - (*wp)->wp_futex = *f; - } - - return (error); -} - -static inline void -futex_lock(struct futex *f) -{ - - LINUX_CTR3(sys_futex, "futex_lock uaddr %p ref %d shared %d", - f->f_uaddr, f->f_refcount, f->f_key.shared); - FUTEX_ASSERT_UNLOCKED(f); - FUTEX_LOCK(f); -} - -static inline void -futex_unlock(struct futex *f) -{ - - LINUX_CTR3(sys_futex, "futex_unlock uaddr %p ref %d shared %d", - f->f_uaddr, f->f_refcount, f->f_key.shared); - FUTEX_ASSERT_LOCKED(f); - FUTEX_UNLOCK(f); -} - -static int -futex_sleep(struct futex *f, struct waiting_proc *wp, struct timespec *ts) -{ - sbintime_t sbt, prec, tmp; - time_t over; - int error; - - FUTEX_ASSERT_LOCKED(f); - if (ts != NULL) { - if (ts->tv_sec > INT32_MAX / 2) { - over = ts->tv_sec - INT32_MAX / 2; - ts->tv_sec -= over; - } - tmp = tstosbt(*ts); - if (TIMESEL(&sbt, tmp)) - sbt += tc_tick_sbt; - sbt += tmp; - prec = tmp; - prec >>= tc_precexp; - } else { - sbt = 0; - prec = 0; - } - LINUX_CTR4(sys_futex, "futex_sleep enter uaddr %p wp %p timo %ld ref %d", - f->f_uaddr, wp, sbt, f->f_refcount); - - error = msleep_sbt(wp, &f->f_lck, PCATCH, "futex", sbt, prec, C_ABSOLUTE); - if (wp->wp_flags & FUTEX_WP_REQUEUED) { - KASSERT(f != wp->wp_futex, ("futex != wp_futex")); - - if (error) { - LIN_SDT_PROBE5(futex, futex_sleep, requeue_error, error, - f->f_uaddr, wp, wp->wp_futex->f_uaddr, - wp->wp_futex->f_refcount); - } - - LINUX_CTR5(sys_futex, "futex_sleep out error %d uaddr %p wp" - " %p requeued uaddr %p ref %d", - error, f->f_uaddr, wp, wp->wp_futex->f_uaddr, - wp->wp_futex->f_refcount); - futex_put(f, NULL); - f = wp->wp_futex; - futex_lock(f); - } else { - if (error) { - LIN_SDT_PROBE3(futex, futex_sleep, sleep_error, error, - f->f_uaddr, wp); - } - LINUX_CTR3(sys_futex, "futex_sleep out error %d uaddr %p wp %p", - error, f->f_uaddr, wp); - } - - futex_put(f, wp); - - return (error); -} - -static int -futex_wake(struct futex *f, int n, uint32_t bitset) +int +futex_wake(struct thread *td, uint32_t *uaddr, int val, bool shared) { - struct waiting_proc *wp, *wpt; - int count = 0; + struct linux_futex_args args; - if (bitset == 0) - return (EINVAL); + bzero(&args, sizeof(args)); + args.op = LINUX_FUTEX_WAKE; + args.uaddr = uaddr; + args.flags = shared == true ? FUTEX_SHARED : 0; + args.val = val; + args.val3 = FUTEX_BITSET_MATCH_ANY; - FUTEX_ASSERT_LOCKED(f); - TAILQ_FOREACH_SAFE(wp, &f->f_waiting_proc, wp_list, wpt) { - LIN_SDT_PROBE3(futex, futex_wake, iterate, f->f_uaddr, wp, - f->f_refcount); - LINUX_CTR3(sys_futex, "futex_wake uaddr %p wp %p ref %d", - f->f_uaddr, wp, f->f_refcount); - /* - * Unless we find a matching bit in - * the bitset, continue searching. - */ - if (!(wp->wp_futex->f_bitset & bitset)) - continue; - - wp->wp_flags |= FUTEX_WP_REMOVED; - TAILQ_REMOVE(&f->f_waiting_proc, wp, wp_list); - LIN_SDT_PROBE1(futex, futex_wake, wakeup, wp); - wakeup_one(wp); - if (++count == n) - break; - } - - return (count); -} - -static int -futex_requeue(struct futex *f, int nrwake, struct futex *f2, - int nrrequeue) -{ - struct waiting_proc *wp, *wpt; - int count = 0; - - FUTEX_ASSERT_LOCKED(f); - FUTEX_ASSERT_LOCKED(f2); - - TAILQ_FOREACH_SAFE(wp, &f->f_waiting_proc, wp_list, wpt) { - if (++count <= nrwake) { - LINUX_CTR2(sys_futex, "futex_req_wake uaddr %p wp %p", - f->f_uaddr, wp); - wp->wp_flags |= FUTEX_WP_REMOVED; - TAILQ_REMOVE(&f->f_waiting_proc, wp, wp_list); - LIN_SDT_PROBE1(futex, futex_requeue, wakeup, wp); - wakeup_one(wp); - } else { - LIN_SDT_PROBE3(futex, futex_requeue, requeue, - f->f_uaddr, wp, f2->f_uaddr); - LINUX_CTR3(sys_futex, "futex_requeue uaddr %p wp %p to %p", - f->f_uaddr, wp, f2->f_uaddr); - wp->wp_flags |= FUTEX_WP_REQUEUED; - /* Move wp to wp_list of f2 futex */ - TAILQ_REMOVE(&f->f_waiting_proc, wp, wp_list); - TAILQ_INSERT_HEAD(&f2->f_waiting_proc, wp, wp_list); - - /* - * Thread which sleeps on wp after waking should - * acquire f2 lock, so increment refcount of f2 to - * prevent it from premature deallocation. - */ - wp->wp_futex = f2; - FUTEXES_LOCK; - ++f2->f_refcount; - FUTEXES_UNLOCK; - if (count - nrwake >= nrrequeue) - break; - } - } - - return (count); + return (linux_futex_wake(td, &args)); } static int @@ -631,20 +230,8 @@ linux_futex(struct thread *td, struct linux_futex_args *args) } else args->flags = FUTEX_SHARED; - /* - * Currently support for switching between CLOCK_MONOTONIC and - * CLOCK_REALTIME is not present. However Linux forbids the use of - * FUTEX_CLOCK_REALTIME with any op except FUTEX_WAIT_BITSET and - * FUTEX_WAIT_REQUEUE_PI. - */ args->clockrt = args->op & LINUX_FUTEX_CLOCK_REALTIME; args->op = args->op & ~LINUX_FUTEX_CLOCK_REALTIME; - if (args->clockrt && args->op != LINUX_FUTEX_WAIT_BITSET && - args->op != LINUX_FUTEX_WAIT_REQUEUE_PI) { - LIN_SDT_PROBE0(futex, linux_futex, - unimplemented_clockswitch); - return (ENOSYS); - } switch (args->op) { case LINUX_FUTEX_WAIT: @@ -785,87 +372,68 @@ linux_futex(struct thread *td, struct linux_futex_args *args) static int linux_futex_wakeop(struct thread *td, struct linux_futex_args *args) { + struct umtx_key key, key2; int nrwake, op_ret, ret; - struct futex *f, *f2; - int error, save; - uint32_t val; + int error, count; if (args->uaddr == args->uaddr2) return (EINVAL); -retry: - f = f2 = NULL; - error = futex_get(args->uaddr, NULL, &f, args->flags | FUTEX_DONTLOCK); + error = umtx_key_get(args->uaddr, TYPE_FUTEX, GET_SHARED(args), &key); if (error != 0) return (error); - - error = futex_get(args->uaddr2, NULL, &f2, args->flags | FUTEX_DONTLOCK); + error = umtx_key_get(args->uaddr2, TYPE_FUTEX, GET_SHARED(args), &key2); if (error != 0) { - futex_put(f, NULL); + umtx_key_release(&key); return (error); } - futex_lock(f); - futex_lock(f2); - - /* - * This function returns positive number as results and - * negative as errors - */ - save = vm_fault_disable_pagefaults(); + umtxq_lock(&key); + umtxq_busy(&key); + umtxq_unlock(&key); op_ret = futex_atomic_op(td, args->val3, args->uaddr2); - vm_fault_enable_pagefaults(save); - - LINUX_CTR2(sys_futex, "WAKE_OP atomic_op uaddr %p ret 0x%x", - args->uaddr, op_ret); - if (op_ret < 0) { - if (f2 != NULL) - futex_put(f2, NULL); - futex_put(f, NULL); if (op_ret == -ENOSYS) - return (ENOSYS); - error = copyin(args->uaddr2, &val, sizeof(val)); - if (error == 0) - goto retry; - return (error); + error = ENOSYS; + else + error = EFAULT; } - - ret = futex_wake(f, args->val, args->val3); - + umtxq_lock(&key); + umtxq_unbusy(&key); + if (error != 0) + goto out; + ret = umtxq_signal_mask(&key, args->val, args->val3); if (op_ret > 0) { - op_ret = 0; nrwake = (int)(unsigned long)args->ts; - - if (f2 != NULL) - op_ret += futex_wake(f2, nrwake, args->val3); + umtxq_lock(&key2); + count = umtxq_count(&key2); + if (count > 0) + ret += umtxq_signal_mask(&key2, nrwake, args->val3); else - op_ret += futex_wake(f, nrwake, args->val3); - ret += op_ret; + ret += umtxq_signal_mask(&key, nrwake, args->val3); + umtxq_unlock(&key2); } - if (f2 != NULL) - futex_put(f2, NULL); - futex_put(f, NULL); td->td_retval[0] = ret; - return (0); +out: + umtxq_unlock(&key); + umtx_key_release(&key2); + umtx_key_release(&key); + return (error); } static int linux_futex_requeue(struct thread *td, struct linux_futex_args *args) { int nrwake, nrrequeue; - struct futex *f, *f2; + struct umtx_key key, key2; int error; - uint32_t val; + uint32_t uval; /* * Linux allows this, we would not, it is an incorrect * usage of declared ABI, so return EINVAL. */ - if (args->uaddr == args->uaddr2) { - LIN_SDT_PROBE0(futex, linux_futex, - invalid_cmp_requeue_use); + if (args->uaddr == args->uaddr2) return (EINVAL); - } nrrequeue = (int)(unsigned long)args->ts; nrwake = args->val; @@ -876,136 +444,121 @@ linux_futex_requeue(struct thread *td, struct linux_futex_args *args) if (nrwake < 0 || nrrequeue < 0) return (EINVAL); -retry: - f = f2 = NULL; - error = futex_get(args->uaddr, NULL, &f, args->flags | FUTEX_DONTLOCK); + error = umtx_key_get(args->uaddr, TYPE_FUTEX, GET_SHARED(args), &key); if (error != 0) return (error); - - /* - * To avoid deadlocks return EINVAL if second futex - * exists at this time. - * - * Glibc fall back to FUTEX_WAKE in case of any error - * returned by FUTEX_CMP_REQUEUE. - */ - error = futex_get(args->uaddr2, NULL, &f2, - args->flags | FUTEX_DONTEXISTS | FUTEX_DONTLOCK); - if (error != 0) { - futex_put(f, NULL); - return (error); - } - futex_lock(f); - futex_lock(f2); - error = copyin_nofault(args->uaddr, &val, sizeof(val)); + error = umtx_key_get(args->uaddr2, TYPE_FUTEX, GET_SHARED(args), &key2); if (error != 0) { - futex_put(f2, NULL); - futex_put(f, NULL); - error = copyin(args->uaddr, &val, sizeof(val)); - if (error == 0) - goto retry; - LIN_SDT_PROBE1(futex, linux_futex, copyin_error, - error); - LINUX_CTR1(sys_futex, "CMP_REQUEUE copyin failed %d", - error); + umtx_key_release(&key); return (error); } - if (args->val3_compare == true && val != args->val3) { - LIN_SDT_PROBE2(futex, linux_futex, - debug_cmp_requeue_value_neq, args->val, val); - LINUX_CTR2(sys_futex, "CMP_REQUEUE val 0x%x != uval 0x%x", - args->val, val); - futex_put(f2, NULL); - futex_put(f, NULL); - return (EAGAIN); - } - - td->td_retval[0] = futex_requeue(f, nrwake, f2, nrrequeue); - futex_put(f2, NULL); - futex_put(f, NULL); - return (0); + umtxq_lock(&key); + umtxq_busy(&key); + umtxq_unlock(&key); + error = fueword32(args->uaddr, &uval); + if (error != 0) + error = EFAULT; + else if (args->val3_compare == true && uval != args->val3) + error = EWOULDBLOCK; + umtxq_lock(&key); + umtxq_unbusy(&key); + if (error == 0) { + umtxq_lock(&key2); + td->td_retval[0] = umtxq_requeue(&key, nrwake, &key2, nrrequeue); + umtxq_unlock(&key2); + } + umtxq_unlock(&key); + umtx_key_release(&key2); + umtx_key_release(&key); + return (error); } static int linux_futex_wake(struct thread *td, struct linux_futex_args *args) { - struct futex *f; + struct umtx_key key; int error; - f = NULL; - error = futex_get(args->uaddr, NULL, &f, args->flags | FUTEX_DONTCREATE); - if (error != 0) - return (error); + if (args->val3 == 0) + return (EINVAL); - if (f == NULL) { - td->td_retval[0] = 0; + error = umtx_key_get(args->uaddr, TYPE_FUTEX, GET_SHARED(args), &key); + if (error != 0) return (error); - } - td->td_retval[0] = futex_wake(f, args->val, args->val3); - futex_put(f, NULL); + umtxq_lock(&key); + td->td_retval[0] = umtxq_signal_mask(&key, args->val, args->val3); + umtxq_unlock(&key); + umtx_key_release(&key); return (0); } static int linux_futex_wait(struct thread *td, struct linux_futex_args *args) { - struct waiting_proc *wp; - struct timespec kts; - struct futex *f; + struct umtx_abs_timeout timo; + struct umtx_q *uq; + uint32_t uval; int error; - uint32_t val; - - if (args->ts != NULL) { - if (args->clockrt) { - nanotime(&kts); - timespecsub(args->ts, &kts, args->ts); - } else if (args->op == LINUX_FUTEX_WAIT_BITSET) { - nanouptime(&kts); - timespecsub(args->ts, &kts, args->ts); - } - } -retry: - f = NULL; - error = futex_get(args->uaddr, &wp, &f, args->flags | FUTEX_CREATE_WP); - if (error != 0) - return (error); + if (args->val3 == 0) + error = EINVAL; - error = copyin_nofault(args->uaddr, &val, sizeof(val)); - if (error != 0) { - futex_put(f, wp); - error = copyin(args->uaddr, &val, sizeof(val)); - if (error == 0) - goto retry; - LIN_SDT_PROBE1(futex, linux_futex, copyin_error, error); - LINUX_CTR1(sys_futex, "WAIT copyin failed %d", error); + uq = td->td_umtxq; + error = umtx_key_get(args->uaddr, TYPE_FUTEX, GET_SHARED(args), + &uq->uq_key); + if (error != 0) return (error); - } - if (val != args->val) { - LIN_SDT_PROBE4(futex, linux_futex, - debug_wait_value_neq, args->uaddr, args->val, val, - args->val3); - LINUX_CTR3(sys_futex, - "WAIT uaddr %p val 0x%x != uval 0x%x", - args->uaddr, args->val, val); - futex_put(f, wp); - return (EWOULDBLOCK); - } - - if (args->val3 == 0) { - futex_put(f, wp); - return (EINVAL); - } - - f->f_bitset = args->val3; - error = futex_sleep(f, wp, args->ts); + if (args->ts != NULL) + linux_umtx_abs_timeout_init(&timo, args); + umtxq_lock(&uq->uq_key); + umtxq_busy(&uq->uq_key); + uq->uq_bitset = args->val3; + umtxq_insert(uq); + umtxq_unlock(&uq->uq_key); + error = fueword32(args->uaddr, &uval); if (error != 0) - LIN_SDT_PROBE1(futex, futex_wait, sleep_error, error); - if (error == EWOULDBLOCK) - error = ETIMEDOUT; + error = EFAULT; + else if (uval != args->val) + error = EWOULDBLOCK; + umtxq_lock(&uq->uq_key); + umtxq_unbusy(&uq->uq_key); + if (error == 0) { + error = umtxq_sleep(uq, "futex", + args->ts == NULL ? NULL : &timo); + if ((uq->uq_flags & UQF_UMTXQ) == 0) + error = 0; + else + umtxq_remove(uq); + } else if ((uq->uq_flags & UQF_UMTXQ) != 0) { + umtxq_remove(uq); + } + umtxq_unlock(&uq->uq_key); + umtx_key_release(&uq->uq_key); + if (error == ERESTART) + error = EINTR; return (error); } +static void +linux_umtx_abs_timeout_init(struct umtx_abs_timeout *timo, + struct linux_futex_args *args) +{ + int clockid, absolute; + + /* + * The FUTEX_CLOCK_REALTIME option bit can be employed only with the + * FUTEX_WAIT_BITSET, FUTEX_WAIT_REQUEUE_PI. + * For FUTEX_WAIT, timeout is interpreted as a relative value, for other + * futex operations timeout is interpreted as an absolute value. + * If FUTEX_CLOCK_REALTIME option bit is set, the Linux kernel measures + * the timeout against the CLOCK_REALTIME clock, otherwise the kernel + * measures the timeout against the CLOCK_MONOTONIC clock. + */ + clockid = args->clockrt ? CLOCK_REALTIME : CLOCK_MONOTONIC; + absolute = args->op == LINUX_FUTEX_WAIT ? false : true; + umtx_abs_timeout_init(timo, clockid, absolute, args->ts); +} + int linux_sys_futex(struct thread *td, struct linux_sys_futex_args *args) { @@ -1149,7 +702,6 @@ handle_futex_death(struct linux_emuldata *em, uint32_t *uaddr, unsigned int pi) { uint32_t uval, nval, mval; - struct futex *f; int error; retry: @@ -1169,14 +721,9 @@ retry: goto retry; if (!pi && (uval & FUTEX_WAITERS)) { - error = futex_get(uaddr, NULL, &f, - FUTEX_DONTCREATE | FUTEX_SHARED); - if (error) + error = futex_wake(curthread, uaddr, 1, true); + if (error != 0) return (error); - if (f != NULL) { - futex_wake(f, 1, FUTEX_BITSET_MATCH_ANY); - futex_put(f, NULL); - } } } diff --git a/sys/compat/linux/linux_futex.h b/sys/compat/linux/linux_futex.h index 6ea873d98411..4255cbdc7363 100644 --- a/sys/compat/linux/linux_futex.h +++ b/sys/compat/linux/linux_futex.h @@ -83,6 +83,7 @@ int futex_addl(int oparg, uint32_t *uaddr, int *oldval); int futex_orl(int oparg, uint32_t *uaddr, int *oldval); int futex_andl(int oparg, uint32_t *uaddr, int *oldval); int futex_xorl(int oparg, uint32_t *uaddr, int *oldval); +int futex_wake(struct thread *td, uint32_t *uaddr, int val, bool shared); void release_futexes(struct thread *, *** 60 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Thu Jul 29 09:46: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 DF2EC66FFE5; Thu, 29 Jul 2021 09:46: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 4Gb5JM1W06z3sFt; Thu, 29 Jul 2021 09:46: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 ECD4C76AB; Thu, 29 Jul 2021 09:46: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 16T9kA1c056829; Thu, 29 Jul 2021 09:46:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16T9kAl4056828; Thu, 29 Jul 2021 09:46:10 GMT (envelope-from git) Date: Thu, 29 Jul 2021 09:46:10 GMT Message-Id: <202107290946.16T9kAl4056828@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: 8e4d22c01d8f - main - umtx: Add umtxq_requeue Linux emulation layer extension. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8e4d22c01d8f76ae144f32b4c5fac40451429891 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, 29 Jul 2021 09:46:12 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=8e4d22c01d8f76ae144f32b4c5fac40451429891 commit 8e4d22c01d8f76ae144f32b4c5fac40451429891 Author: Dmitry Chagin AuthorDate: 2021-07-29 09:43:07 +0000 Commit: Dmitry Chagin CommitDate: 2021-07-29 09:43:07 +0000 umtx: Add umtxq_requeue Linux emulation layer extension. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D31235 MFC after: 2 weeks --- sys/kern/kern_umtx.c | 37 +++++++++++++++++++++++++++++++++++++ sys/sys/umtxvar.h | 1 + 2 files changed, 38 insertions(+) diff --git a/sys/kern/kern_umtx.c b/sys/kern/kern_umtx.c index d869d5870000..7c850c0d78d8 100644 --- a/sys/kern/kern_umtx.c +++ b/sys/kern/kern_umtx.c @@ -621,6 +621,43 @@ umtxq_signal_thread(struct umtx_q *uq) wakeup(uq); } +/* + * Wake up a maximum of n_wake threads that are waiting on an userland + * object identified by key. The remaining threads are removed from queue + * identified by key and added to the queue identified by key2 (requeued). + * The n_requeue specifies an upper limit on the number of threads that + * are requeued to the second queue. + */ +int +umtxq_requeue(struct umtx_key *key, int n_wake, struct umtx_key *key2, + int n_requeue) +{ + struct umtxq_queue *uh, *uh2; + struct umtx_q *uq, *uq_temp; + int ret; + + ret = 0; + UMTXQ_LOCKED_ASSERT(umtxq_getchain(key)); + UMTXQ_LOCKED_ASSERT(umtxq_getchain(key2)); + uh = umtxq_queue_lookup(key, UMTX_SHARED_QUEUE); + uh2 = umtxq_queue_lookup(key2, UMTX_SHARED_QUEUE); + if (uh == NULL) + return (0); + TAILQ_FOREACH_SAFE(uq, &uh->head, uq_link, uq_temp) { + if (++ret <= n_wake) { + umtxq_remove(uq); + wakeup_one(uq); + } else { + umtxq_remove(uq); + uq->uq_key = *key2; + umtxq_insert(uq); + if (ret - n_wake == n_requeue) + break; + } + } + return (ret); +} + static inline int tstohz(const struct timespec *tsp) { diff --git a/sys/sys/umtxvar.h b/sys/sys/umtxvar.h index de1b649ed8d7..ed2d8046a5fb 100644 --- a/sys/sys/umtxvar.h +++ b/sys/sys/umtxvar.h @@ -210,6 +210,7 @@ void umtxq_free(struct umtx_q *); struct umtxq_chain *umtxq_getchain(struct umtx_key *); void umtxq_insert_queue(struct umtx_q *, int); void umtxq_remove_queue(struct umtx_q *, int); +int umtxq_requeue(struct umtx_key *, int, struct umtx_key *, int); int umtxq_signal_mask(struct umtx_key *, int, u_int); int umtxq_sleep(struct umtx_q *, const char *, struct umtx_abs_timeout *); From owner-dev-commits-src-all@freebsd.org Thu Jul 29 09:46: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 1F6A066FED5; Thu, 29 Jul 2021 09:46: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 4Gb5JK73WFz3sK7; Thu, 29 Jul 2021 09:46: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 D7274726A; Thu, 29 Jul 2021 09:46: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 16T9k9bC056797; Thu, 29 Jul 2021 09:46:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16T9k9d6056796; Thu, 29 Jul 2021 09:46:09 GMT (envelope-from git) Date: Thu, 29 Jul 2021 09:46:09 GMT Message-Id: <202107290946.16T9k9d6056796@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: 7caa29115b4a - main - umtx: Add bitset conditional wakeup functionality. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7caa29115b4a2023128ed07942b71074507a44a1 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, 29 Jul 2021 09:46:10 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=7caa29115b4a2023128ed07942b71074507a44a1 commit 7caa29115b4a2023128ed07942b71074507a44a1 Author: Dmitry Chagin AuthorDate: 2021-07-29 09:42:49 +0000 Commit: Dmitry Chagin CommitDate: 2021-07-29 09:42:49 +0000 umtx: Add bitset conditional wakeup functionality. The bitset is a Linux emulation layer extension. This 32-bit mask, in which at least one bit must be set, is used to select which threads should be woken up. The bitset is stored in the umtx_q structure, which is used to enqueue the waiter into the umtx waitqueue. Put the bitset into the hole, that appeared on LP64 due to data alignment, to prevent the growth of the struct umtx_q. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D31234 MFC after: 2 weeks --- sys/kern/kern_umtx.c | 26 ++++++++++++++++++++++++++ sys/sys/umtxvar.h | 4 ++++ 2 files changed, 30 insertions(+) diff --git a/sys/kern/kern_umtx.c b/sys/kern/kern_umtx.c index ae80554cbbb8..d869d5870000 100644 --- a/sys/kern/kern_umtx.c +++ b/sys/kern/kern_umtx.c @@ -558,6 +558,32 @@ umtxq_count_pi(struct umtx_key *key, struct umtx_q **first) return (0); } +/* + * Wake up threads waiting on an userland object by a bit mask. + */ +int +umtxq_signal_mask(struct umtx_key *key, int n_wake, u_int bitset) +{ + struct umtxq_queue *uh; + struct umtx_q *uq, *uq_temp; + int ret; + + ret = 0; + UMTXQ_LOCKED_ASSERT(umtxq_getchain(key)); + uh = umtxq_queue_lookup(key, UMTX_SHARED_QUEUE); + if (uh == NULL) + return (0); + TAILQ_FOREACH_SAFE(uq, &uh->head, uq_link, uq_temp) { + if ((uq->uq_bitset & bitset) == 0) + continue; + umtxq_remove_queue(uq, UMTX_SHARED_QUEUE); + wakeup_one(uq); + if (++ret >= n_wake) + break; + } + return (ret); +} + /* * Wake up threads waiting on an userland object. */ diff --git a/sys/sys/umtxvar.h b/sys/sys/umtxvar.h index 68f261fe6abf..de1b649ed8d7 100644 --- a/sys/sys/umtxvar.h +++ b/sys/sys/umtxvar.h @@ -120,6 +120,9 @@ struct umtx_q { int uq_flags; #define UQF_UMTXQ 0x0001 + /* Futex bitset mask */ + u_int uq_bitset; + /* The thread waits on. */ struct thread *uq_thread; @@ -207,6 +210,7 @@ void umtxq_free(struct umtx_q *); struct umtxq_chain *umtxq_getchain(struct umtx_key *); void umtxq_insert_queue(struct umtx_q *, int); void umtxq_remove_queue(struct umtx_q *, int); +int umtxq_signal_mask(struct umtx_key *, int, u_int); int umtxq_sleep(struct umtx_q *, const char *, struct umtx_abs_timeout *); void umtxq_unbusy(struct umtx_key *); From owner-dev-commits-src-all@freebsd.org Thu Jul 29 09:58: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 CEDEE670907; Thu, 29 Jul 2021 09:58: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 4Gb5Zk5GZlz3t6W; Thu, 29 Jul 2021 09:58: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 9DB2079A6; Thu, 29 Jul 2021 09:58: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 16T9wcRH070187; Thu, 29 Jul 2021 09:58:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16T9wchf070186; Thu, 29 Jul 2021 09:58:38 GMT (envelope-from git) Date: Thu, 29 Jul 2021 09:58:38 GMT Message-Id: <202107290958.16T9wchf070186@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: b9c89fa39e1e - main - linux(4): Eliminate unused includes. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b9c89fa39e1e20e9929eeec76c745f80e74e68a4 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, 29 Jul 2021 09:58:38 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=b9c89fa39e1e20e9929eeec76c745f80e74e68a4 commit b9c89fa39e1e20e9929eeec76c745f80e74e68a4 Author: Dmitry Chagin AuthorDate: 2021-07-29 09:46:35 +0000 Commit: Dmitry Chagin CommitDate: 2021-07-29 09:46:35 +0000 linux(4): Eliminate unused includes. MFC after: 2 weeks --- sys/compat/linux/linux_util.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/sys/compat/linux/linux_util.c b/sys/compat/linux/linux_util.c index ace8c26d7d00..eddfd4f28868 100644 --- a/sys/compat/linux/linux_util.c +++ b/sys/compat/linux/linux_util.c @@ -39,11 +39,9 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include -#include #include #include #include From owner-dev-commits-src-all@freebsd.org Thu Jul 29 09:58:40 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 122B067090C; Thu, 29 Jul 2021 09:58:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gb5Zl6Nbtz3t0L; Thu, 29 Jul 2021 09:58: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 C060B79A7; Thu, 29 Jul 2021 09:58: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 16T9wdPc070211; Thu, 29 Jul 2021 09:58:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16T9wdw4070210; Thu, 29 Jul 2021 09:58:39 GMT (envelope-from git) Date: Thu, 29 Jul 2021 09:58:39 GMT Message-Id: <202107290958.16T9wdw4070210@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: 09f55e600246 - main - umtx: Expose some of the pi umtx structures and API to the rest of the kernel. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 09f55e60024662d7a9da248257ec72cd86767cea 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, 29 Jul 2021 09:58:40 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=09f55e60024662d7a9da248257ec72cd86767cea commit 09f55e60024662d7a9da248257ec72cd86767cea Author: Dmitry Chagin AuthorDate: 2021-07-29 09:46:58 +0000 Commit: Dmitry Chagin CommitDate: 2021-07-29 09:46:58 +0000 umtx: Expose some of the pi umtx structures and API to the rest of the kernel. Differential Revision: https://reviews.freebsd.org/D31237 MFC after: 2 weeks --- sys/kern/kern_umtx.c | 20 +++++++++----------- sys/sys/umtxvar.h | 10 ++++++++++ 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/sys/kern/kern_umtx.c b/sys/kern/kern_umtx.c index 7c850c0d78d8..7528561bb25c 100644 --- a/sys/kern/kern_umtx.c +++ b/sys/kern/kern_umtx.c @@ -170,8 +170,6 @@ static inline void umtx_abs_timeout_update(struct umtx_abs_timeout *timo); static void umtx_shm_init(void); static void umtxq_sysinit(void *); static void umtxq_hash(struct umtx_key *key); -static struct umtx_pi *umtx_pi_alloc(int); -static void umtx_pi_free(struct umtx_pi *pi); static int do_unlock_pp(struct thread *td, struct umutex *m, uint32_t flags, bool rb); static void umtx_thread_cleanup(struct thread *td); @@ -435,7 +433,7 @@ umtxq_unbusy(struct umtx_key *key) wakeup_one(uc); } -static inline void +void umtxq_unbusy_unlocked(struct umtx_key *key) { @@ -1668,7 +1666,7 @@ do_wake2_umutex(struct thread *td, struct umutex *m, uint32_t flags) return (error); } -static inline struct umtx_pi * +struct umtx_pi * umtx_pi_alloc(int flags) { struct umtx_pi *pi; @@ -1679,7 +1677,7 @@ umtx_pi_alloc(int flags) return (pi); } -static inline void +void umtx_pi_free(struct umtx_pi *pi) { uma_zfree(umtx_pi_zone, pi); @@ -1888,7 +1886,7 @@ umtx_pi_disown(struct umtx_pi *pi) /* * Claim ownership of a PI mutex. */ -static int +int umtx_pi_claim(struct umtx_pi *pi, struct thread *owner) { struct umtx_q *uq; @@ -1946,7 +1944,7 @@ umtx_pi_adjust(struct thread *td, u_char oldpri) /* * Sleep on a PI mutex. */ -static int +int umtxq_sleep_pi(struct umtx_q *uq, struct umtx_pi *pi, uint32_t owner, const char *wmesg, struct umtx_abs_timeout *timo, bool shared) { @@ -2014,7 +2012,7 @@ umtxq_sleep_pi(struct umtx_q *uq, struct umtx_pi *pi, uint32_t owner, /* * Add reference count for a PI mutex. */ -static void +void umtx_pi_ref(struct umtx_pi *pi) { @@ -2026,7 +2024,7 @@ umtx_pi_ref(struct umtx_pi *pi) * Decrease reference count for a PI mutex, if the counter * is decreased to zero, its memory space is freed. */ -static void +void umtx_pi_unref(struct umtx_pi *pi) { struct umtxq_chain *uc; @@ -2049,7 +2047,7 @@ umtx_pi_unref(struct umtx_pi *pi) /* * Find a PI mutex in hash table. */ -static struct umtx_pi * +struct umtx_pi * umtx_pi_lookup(struct umtx_key *key) { struct umtxq_chain *uc; @@ -2069,7 +2067,7 @@ umtx_pi_lookup(struct umtx_key *key) /* * Insert a PI mutex into hash table. */ -static inline void +void umtx_pi_insert(struct umtx_pi *pi) { struct umtxq_chain *uc; diff --git a/sys/sys/umtxvar.h b/sys/sys/umtxvar.h index ed2d8046a5fb..fd193de5818b 100644 --- a/sys/sys/umtxvar.h +++ b/sys/sys/umtxvar.h @@ -214,9 +214,19 @@ int umtxq_requeue(struct umtx_key *, int, struct umtx_key *, int); int umtxq_signal_mask(struct umtx_key *, int, u_int); int umtxq_sleep(struct umtx_q *, const char *, struct umtx_abs_timeout *); +int umtxq_sleep_pi(struct umtx_q *, struct umtx_pi *, uint32_t, + const char *, struct umtx_abs_timeout *, bool); void umtxq_unbusy(struct umtx_key *); +void umtxq_unbusy_unlocked(struct umtx_key *); int kern_umtx_wake(struct thread *, void *, int, int); void umtx_pi_adjust(struct thread *, u_char); +struct umtx_pi *umtx_pi_alloc(int); +int umtx_pi_claim(struct umtx_pi *, struct thread *); +void umtx_pi_free(struct umtx_pi *); +void umtx_pi_insert(struct umtx_pi *); +struct umtx_pi *umtx_pi_lookup(struct umtx_key *); +void umtx_pi_ref(struct umtx_pi *); +void umtx_pi_unref(struct umtx_pi *); void umtx_thread_init(struct thread *); void umtx_thread_fini(struct thread *); void umtx_thread_alloc(struct thread *); From owner-dev-commits-src-all@freebsd.org Thu Jul 29 09:58: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 544CB670655; Thu, 29 Jul 2021 09:58: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 4Gb5Zn1R1lz3swK; Thu, 29 Jul 2021 09:58: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 EC4E5776C; Thu, 29 Jul 2021 09:58: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 16T9wekD070237; Thu, 29 Jul 2021 09:58:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16T9welO070236; Thu, 29 Jul 2021 09:58:40 GMT (envelope-from git) Date: Thu, 29 Jul 2021 09:58:40 GMT Message-Id: <202107290958.16T9welO070236@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: 9e32efa79bf2 - main - umtx: Split do_unlock_pi on two counterparts. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9e32efa79bf2dc95dab86d801c08cffcd6e171db 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, 29 Jul 2021 09:58:41 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=9e32efa79bf2dc95dab86d801c08cffcd6e171db commit 9e32efa79bf2dc95dab86d801c08cffcd6e171db Author: Dmitry Chagin AuthorDate: 2021-07-29 09:47:39 +0000 Commit: Dmitry Chagin CommitDate: 2021-07-29 09:47:39 +0000 umtx: Split do_unlock_pi on two counterparts. The umtx_pi_frop() will be used by Linux emulation layer. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D31238 MFC after: 2 weeks --- sys/kern/kern_umtx.c | 144 ++++++++++++++++++++++++++++++--------------------- sys/sys/umtxvar.h | 1 + 2 files changed, 87 insertions(+), 58 deletions(-) diff --git a/sys/kern/kern_umtx.c b/sys/kern/kern_umtx.c index 7528561bb25c..ea87259161c8 100644 --- a/sys/kern/kern_umtx.c +++ b/sys/kern/kern_umtx.c @@ -90,6 +90,17 @@ __FBSDID("$FreeBSD$"); #endif #define UMTXQ_LOCKED_ASSERT(uc) mtx_assert(&(uc)->uc_lock, MA_OWNED) +#ifdef INVARIANTS +#define UMTXQ_ASSERT_LOCKED_BUSY(key) do { \ + struct umtxq_chain *uc; \ + \ + uc = umtxq_getchain(key); \ + mtx_assert(&uc->uc_lock, MA_OWNED); \ + KASSERT(uc->uc_busy != 0, ("umtx chain is not busy")); \ +} while (0) +#else +#define UMTXQ_ASSERT_LOCKED_BUSY(key) do {} while (0) +#endif /* * Don't propagate time-sharing priority, there is a security reason, @@ -2077,6 +2088,73 @@ umtx_pi_insert(struct umtx_pi *pi) TAILQ_INSERT_TAIL(&uc->uc_pi_list, pi, pi_hashlink); } +/* + * Drop a PI mutex and wakeup a top waiter. + */ +int +umtx_pi_drop(struct thread *td, struct umtx_key *key, bool rb, int *count) +{ + struct umtx_q *uq_first, *uq_first2, *uq_me; + struct umtx_pi *pi, *pi2; + int pri; + + UMTXQ_ASSERT_LOCKED_BUSY(key); + *count = umtxq_count_pi(key, &uq_first); + if (uq_first != NULL) { + mtx_lock(&umtx_lock); + pi = uq_first->uq_pi_blocked; + KASSERT(pi != NULL, ("pi == NULL?")); + if (pi->pi_owner != td && !(rb && pi->pi_owner == NULL)) { + mtx_unlock(&umtx_lock); + /* userland messed the mutex */ + return (EPERM); + } + uq_me = td->td_umtxq; + if (pi->pi_owner == td) + umtx_pi_disown(pi); + /* get highest priority thread which is still sleeping. */ + uq_first = TAILQ_FIRST(&pi->pi_blocked); + while (uq_first != NULL && + (uq_first->uq_flags & UQF_UMTXQ) == 0) { + uq_first = TAILQ_NEXT(uq_first, uq_lockq); + } + pri = PRI_MAX; + TAILQ_FOREACH(pi2, &uq_me->uq_pi_contested, pi_link) { + uq_first2 = TAILQ_FIRST(&pi2->pi_blocked); + if (uq_first2 != NULL) { + if (pri > UPRI(uq_first2->uq_thread)) + pri = UPRI(uq_first2->uq_thread); + } + } + thread_lock(td); + sched_lend_user_prio(td, pri); + thread_unlock(td); + mtx_unlock(&umtx_lock); + if (uq_first) + umtxq_signal_thread(uq_first); + } else { + pi = umtx_pi_lookup(key); + /* + * A umtx_pi can exist if a signal or timeout removed the + * last waiter from the umtxq, but there is still + * a thread in do_lock_pi() holding the umtx_pi. + */ + if (pi != NULL) { + /* + * The umtx_pi can be unowned, such as when a thread + * has just entered do_lock_pi(), allocated the + * umtx_pi, and unlocked the umtxq. + * If the current thread owns it, it must disown it. + */ + mtx_lock(&umtx_lock); + if (pi->pi_owner == td) + umtx_pi_disown(pi); + mtx_unlock(&umtx_lock); + } + } + return (0); +} + /* * Lock a PI mutex. */ @@ -2287,10 +2365,8 @@ static int do_unlock_pi(struct thread *td, struct umutex *m, uint32_t flags, bool rb) { struct umtx_key key; - struct umtx_q *uq_first, *uq_first2, *uq_me; - struct umtx_pi *pi, *pi2; uint32_t id, new_owner, old, owner; - int count, error, pri; + int count, error; id = td->td_tid; @@ -2331,61 +2407,13 @@ usrloop: umtxq_lock(&key); umtxq_busy(&key); - count = umtxq_count_pi(&key, &uq_first); - if (uq_first != NULL) { - mtx_lock(&umtx_lock); - pi = uq_first->uq_pi_blocked; - KASSERT(pi != NULL, ("pi == NULL?")); - if (pi->pi_owner != td && !(rb && pi->pi_owner == NULL)) { - mtx_unlock(&umtx_lock); - umtxq_unbusy(&key); - umtxq_unlock(&key); - umtx_key_release(&key); - /* userland messed the mutex */ - return (EPERM); - } - uq_me = td->td_umtxq; - if (pi->pi_owner == td) - umtx_pi_disown(pi); - /* get highest priority thread which is still sleeping. */ - uq_first = TAILQ_FIRST(&pi->pi_blocked); - while (uq_first != NULL && - (uq_first->uq_flags & UQF_UMTXQ) == 0) { - uq_first = TAILQ_NEXT(uq_first, uq_lockq); - } - pri = PRI_MAX; - TAILQ_FOREACH(pi2, &uq_me->uq_pi_contested, pi_link) { - uq_first2 = TAILQ_FIRST(&pi2->pi_blocked); - if (uq_first2 != NULL) { - if (pri > UPRI(uq_first2->uq_thread)) - pri = UPRI(uq_first2->uq_thread); - } - } - thread_lock(td); - sched_lend_user_prio(td, pri); - thread_unlock(td); - mtx_unlock(&umtx_lock); - if (uq_first) - umtxq_signal_thread(uq_first); - } else { - pi = umtx_pi_lookup(&key); - /* - * A umtx_pi can exist if a signal or timeout removed the - * last waiter from the umtxq, but there is still - * a thread in do_lock_pi() holding the umtx_pi. - */ - if (pi != NULL) { - /* - * The umtx_pi can be unowned, such as when a thread - * has just entered do_lock_pi(), allocated the - * umtx_pi, and unlocked the umtxq. - * If the current thread owns it, it must disown it. - */ - mtx_lock(&umtx_lock); - if (pi->pi_owner == td) - umtx_pi_disown(pi); - mtx_unlock(&umtx_lock); - } + error = umtx_pi_drop(td, &key, rb, &count); + if (error != 0) { + umtxq_unbusy(&key); + umtxq_unlock(&key); + umtx_key_release(&key); + /* userland messed the mutex */ + return (error); } umtxq_unlock(&key); diff --git a/sys/sys/umtxvar.h b/sys/sys/umtxvar.h index fd193de5818b..a0ef7931a88d 100644 --- a/sys/sys/umtxvar.h +++ b/sys/sys/umtxvar.h @@ -222,6 +222,7 @@ int kern_umtx_wake(struct thread *, void *, int, int); void umtx_pi_adjust(struct thread *, u_char); struct umtx_pi *umtx_pi_alloc(int); int umtx_pi_claim(struct umtx_pi *, struct thread *); +int umtx_pi_drop(struct thread *, struct umtx_key *, bool, int *); void umtx_pi_free(struct umtx_pi *); void umtx_pi_insert(struct umtx_pi *); struct umtx_pi *umtx_pi_lookup(struct umtx_key *); From owner-dev-commits-src-all@freebsd.org Thu Jul 29 09:58: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 6895F67071E; Thu, 29 Jul 2021 09:58: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 4Gb5Zq2Lqtz3t8x; Thu, 29 Jul 2021 09:58: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 36BDE7967; Thu, 29 Jul 2021 09:58: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 16T9whj0070290; Thu, 29 Jul 2021 09:58:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16T9whtl070289; Thu, 29 Jul 2021 09:58:43 GMT (envelope-from git) Date: Thu, 29 Jul 2021 09:58:43 GMT Message-Id: <202107290958.16T9whtl070289@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: cb01cc4a1020 - main - linux(4): Replace copyin() by fueword32() in handle_futex_death(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cb01cc4a1020d7916bcf0f1e774156745c387409 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, 29 Jul 2021 09:58:43 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=cb01cc4a1020d7916bcf0f1e774156745c387409 commit cb01cc4a1020d7916bcf0f1e774156745c387409 Author: Dmitry Chagin AuthorDate: 2021-07-29 09:48:59 +0000 Commit: Dmitry Chagin CommitDate: 2021-07-29 09:48:59 +0000 linux(4): Replace copyin() by fueword32() in handle_futex_death(). According to fetch(9) fueword facility designed to fetch atomically small amount of data from user space. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D31239 MFC after: 2 weeks --- sys/compat/linux/linux_futex.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/sys/compat/linux/linux_futex.c b/sys/compat/linux/linux_futex.c index df6c7cdbf74a..9dab78a75af2 100644 --- a/sys/compat/linux/linux_futex.c +++ b/sys/compat/linux/linux_futex.c @@ -101,7 +101,6 @@ LIN_SDT_PROBE_DEFINE0(futex, linux_futex, unimplemented_cmp_requeue_pi); LIN_SDT_PROBE_DEFINE1(futex, linux_futex, unknown_operation, "int"); LIN_SDT_PROBE_DEFINE0(futex, linux_set_robust_list, size_error); LIN_SDT_PROBE_DEFINE1(futex, linux_get_robust_list, copyout_error, "int"); -LIN_SDT_PROBE_DEFINE1(futex, handle_futex_death, copyin_error, "int"); LIN_SDT_PROBE_DEFINE1(futex, fetch_robust_entry, copyin_error, "int"); LIN_SDT_PROBE_DEFINE1(futex, release_futexes, copyin_error, "int"); @@ -705,11 +704,9 @@ handle_futex_death(struct linux_emuldata *em, uint32_t *uaddr, int error; retry: - error = copyin(uaddr, &uval, 4); - if (error) { - LIN_SDT_PROBE1(futex, handle_futex_death, copyin_error, error); + error = fueword32(uaddr, &uval); + if (error != 0) return (EFAULT); - } if ((uval & FUTEX_TID_MASK) == em->em_tid) { mval = (uval & FUTEX_WAITERS) | FUTEX_OWNER_DIED; nval = casuword32(uaddr, uval, mval); From owner-dev-commits-src-all@freebsd.org Thu Jul 29 09:58: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 674E067071C; Thu, 29 Jul 2021 09:58: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 4Gb5Zp1gkBz3smp; Thu, 29 Jul 2021 09:58: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 1245A7B07; Thu, 29 Jul 2021 09:58: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 16T9wfnL070266; Thu, 29 Jul 2021 09:58:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16T9wfNt070265; Thu, 29 Jul 2021 09:58:41 GMT (envelope-from git) Date: Thu, 29 Jul 2021 09:58:41 GMT Message-Id: <202107290958.16T9wfNt070265@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: 20979f38c186 - main - umtx: Add new pi_futex type. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 20979f38c18665efbd9dd17eb4d6ab43d253eca4 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, 29 Jul 2021 09:58:42 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=20979f38c18665efbd9dd17eb4d6ab43d253eca4 commit 20979f38c18665efbd9dd17eb4d6ab43d253eca4 Author: Dmitry Chagin AuthorDate: 2021-07-29 09:48:34 +0000 Commit: Dmitry Chagin CommitDate: 2021-07-29 09:48:34 +0000 umtx: Add new pi_futex type. Differential Revision: https://reviews.freebsd.org/D31250 MFC after: 2 weeks --- sys/sys/umtxvar.h | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/sys/umtxvar.h b/sys/sys/umtxvar.h index a0ef7931a88d..b6d89b6b8559 100644 --- a/sys/sys/umtxvar.h +++ b/sys/sys/umtxvar.h @@ -51,6 +51,7 @@ enum { TYPE_SHM, TYPE_PI_ROBUST_UMUTEX, TYPE_PP_ROBUST_UMUTEX, + TYPE_PI_FUTEX, }; /* Key to represent a unique userland synchronous object */ From owner-dev-commits-src-all@freebsd.org Thu Jul 29 09:58: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 432926703FB; Thu, 29 Jul 2021 09:58: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 4Gb5Zt0L3Yz3t6v; Thu, 29 Jul 2021 09:58: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 7CD1278DF; Thu, 29 Jul 2021 09:58: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 16T9wjSd070338; Thu, 29 Jul 2021 09:58:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16T9wjo9070337; Thu, 29 Jul 2021 09:58:45 GMT (envelope-from git) Date: Thu, 29 Jul 2021 09:58:45 GMT Message-Id: <202107290958.16T9wjo9070337@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: 4f34dc64536f - main - linux(4): Replace casuword32 by casueword32. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4f34dc64536f7de8324ca1a494aee88e64c7de70 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, 29 Jul 2021 09:58:47 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=4f34dc64536f7de8324ca1a494aee88e64c7de70 commit 4f34dc64536f7de8324ca1a494aee88e64c7de70 Author: Dmitry Chagin AuthorDate: 2021-07-29 09:50:11 +0000 Commit: Dmitry Chagin CommitDate: 2021-07-29 09:50:11 +0000 linux(4): Replace casuword32 by casueword32. Follow the r349951 (30b3018d), add check to react to stops and requests to terminate between retries. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D31254 MFC after: 2 weeks --- sys/compat/linux/linux_futex.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/sys/compat/linux/linux_futex.c b/sys/compat/linux/linux_futex.c index 441a26d4d317..82a1eb55d618 100644 --- a/sys/compat/linux/linux_futex.c +++ b/sys/compat/linux/linux_futex.c @@ -107,8 +107,8 @@ LIN_SDT_PROBE_DEFINE1(futex, release_futexes, copyin_error, "int"); #define GET_SHARED(a) (a->flags & FUTEX_SHARED) ? AUTO_SHARE : THREAD_SHARE static int futex_atomic_op(struct thread *, int, uint32_t *); -static int handle_futex_death(struct linux_emuldata *, uint32_t *, - unsigned int); +static int handle_futex_death(struct thread *td, struct linux_emuldata *, + uint32_t *, unsigned int); static int fetch_robust_entry(struct linux_robust_list **, struct linux_robust_list **, unsigned int *); @@ -982,7 +982,7 @@ linux_get_robust_list(struct thread *td, struct linux_get_robust_list_args *args } static int -handle_futex_death(struct linux_emuldata *em, uint32_t *uaddr, +handle_futex_death(struct thread *td, struct linux_emuldata *em, uint32_t *uaddr, unsigned int pi) { uint32_t uval, nval, mval; @@ -994,20 +994,22 @@ retry: return (EFAULT); if ((uval & FUTEX_TID_MASK) == em->em_tid) { mval = (uval & FUTEX_WAITERS) | FUTEX_OWNER_DIED; - nval = casuword32(uaddr, uval, mval); - - if (nval == -1) + error = casueword32(uaddr, uval, &nval, mval); + if (error == -1) return (EFAULT); - - if (nval != uval) + if (error == 1) { + error = thread_check_susp(td, false); + if (error != 0) + return (error); goto retry; + } if (!pi && (uval & FUTEX_WAITERS)) { - error = futex_wake(curthread, uaddr, 1, true); + error = futex_wake(td, uaddr, 1, true); if (error != 0) return (error); } else if (pi && (uval & FUTEX_WAITERS)) { - error = futex_wake_pi(curthread, uaddr, true); + error = futex_wake_pi(td, uaddr, true); if (error != 0) return (error); } @@ -1067,7 +1069,7 @@ release_futexes(struct thread *td, struct linux_emuldata *em) rc = fetch_robust_entry(&next_entry, PTRIN(&entry->next), &next_pi); if (entry != pending) - if (handle_futex_death(em, + if (handle_futex_death(td, em, (uint32_t *)((caddr_t)entry + futex_offset), pi)) { return; } @@ -1084,5 +1086,6 @@ release_futexes(struct thread *td, struct linux_emuldata *em) } if (pending) - handle_futex_death(em, (uint32_t *)((caddr_t)pending + futex_offset), pip); + handle_futex_death(td, em, + (uint32_t *)((caddr_t)pending + futex_offset), pip); } From owner-dev-commits-src-all@freebsd.org Thu Jul 29 09: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 F2BD7670922; Thu, 29 Jul 2021 09:58: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 4Gb5Zx1nB3z3t9R; Thu, 29 Jul 2021 09:58: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 E4144776E; Thu, 29 Jul 2021 09:58: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 16T9wmee070416; Thu, 29 Jul 2021 09:58:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16T9wmIk070415; Thu, 29 Jul 2021 09:58:48 GMT (envelope-from git) Date: Thu, 29 Jul 2021 09:58:48 GMT Message-Id: <202107290958.16T9wmIk070415@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: b59cf25eac06 - main - linux(4): Handle special case for regular futex in handle_futex_death(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b59cf25eac06c1feb2d35a5a3d8a089ae62fd0df 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, 29 Jul 2021 09:58:50 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=b59cf25eac06c1feb2d35a5a3d8a089ae62fd0df commit b59cf25eac06c1feb2d35a5a3d8a089ae62fd0df Author: Dmitry Chagin AuthorDate: 2021-07-29 09:51:39 +0000 Commit: Dmitry Chagin CommitDate: 2021-07-29 09:51:39 +0000 linux(4): Handle special case for regular futex in handle_futex_death(). Handle some races in handle_futex_death() which can prevents a wakeup of potential waiters which can cause these waiters to block forever. Differential Revision: https://reviews.freebsd.org/D31280 MFC after: 2 weeks --- sys/compat/linux/linux_futex.c | 54 +++++++++++++++++++++++++++++++++++------- 1 file changed, 45 insertions(+), 9 deletions(-) diff --git a/sys/compat/linux/linux_futex.c b/sys/compat/linux/linux_futex.c index c81fe20212a2..8bc8879c92c6 100644 --- a/sys/compat/linux/linux_futex.c +++ b/sys/compat/linux/linux_futex.c @@ -108,7 +108,7 @@ LIN_SDT_PROBE_DEFINE1(futex, release_futexes, copyin_error, "int"); static int futex_atomic_op(struct thread *, int, uint32_t *); static int handle_futex_death(struct thread *td, struct linux_emuldata *, - uint32_t *, unsigned int); + uint32_t *, unsigned int, bool); static int fetch_robust_entry(struct linux_robust_list **, struct linux_robust_list **, unsigned int *); @@ -995,7 +995,7 @@ linux_get_robust_list(struct thread *td, struct linux_get_robust_list_args *args static int handle_futex_death(struct thread *td, struct linux_emuldata *em, uint32_t *uaddr, - unsigned int pi) + unsigned int pi, bool pending_op) { uint32_t uval, nval, mval; int error; @@ -1004,6 +1004,31 @@ retry: error = fueword32(uaddr, &uval); if (error != 0) return (EFAULT); + + /* + * Special case for regular (non PI) futexes. The unlock path in + * user space has two race scenarios: + * + * 1. The unlock path releases the user space futex value and + * before it can execute the futex() syscall to wake up + * waiters it is killed. + * + * 2. A woken up waiter is killed before it can acquire the + * futex in user space. + * + * In both cases the TID validation below prevents a wakeup of + * potential waiters which can cause these waiters to block + * forever. + * + * In both cases it is safe to attempt waking up a potential + * waiter without touching the user space futex value and trying + * to set the OWNER_DIED bit. + */ + if (pending_op && !pi && !uval) { + (void)futex_wake(td, uaddr, 1, true); + return (0); + } + if ((uval & FUTEX_TID_MASK) == em->em_tid) { mval = (uval & FUTEX_WAITERS) | FUTEX_OWNER_DIED; error = casueword32(uaddr, uval, &nval, mval); @@ -1049,6 +1074,9 @@ fetch_robust_entry(struct linux_robust_list **entry, return (0); } +#define LINUX_HANDLE_DEATH_PENDING true +#define LINUX_HANDLE_DEATH_LIST false + /* This walks the list of robust futexes releasing them. */ void release_futexes(struct thread *td, struct linux_emuldata *em) @@ -1056,6 +1084,7 @@ release_futexes(struct thread *td, struct linux_emuldata *em) struct linux_robust_list_head *head = NULL; struct linux_robust_list *entry, *next_entry, *pending; unsigned int limit = 2048, pi, next_pi, pip; + uint32_t *uaddr; l_long futex_offset; int rc, error; @@ -1080,11 +1109,16 @@ release_futexes(struct thread *td, struct linux_emuldata *em) while (entry != &head->list) { rc = fetch_robust_entry(&next_entry, PTRIN(&entry->next), &next_pi); - if (entry != pending) - if (handle_futex_death(td, em, - (uint32_t *)((caddr_t)entry + futex_offset), pi)) { + /* + * A pending lock might already be on the list, so + * don't process it twice. + */ + if (entry != pending) { + uaddr = (uint32_t *)((caddr_t)entry + futex_offset); + if (handle_futex_death(td, em, uaddr, pi, + LINUX_HANDLE_DEATH_LIST)) return; - } + } if (rc) return; @@ -1097,7 +1131,9 @@ release_futexes(struct thread *td, struct linux_emuldata *em) sched_relinquish(curthread); } - if (pending) - handle_futex_death(td, em, - (uint32_t *)((caddr_t)pending + futex_offset), pip); + if (pending) { + uaddr = (uint32_t *)((caddr_t)pending + futex_offset); + (void)handle_futex_death(td, em, uaddr, pip, + LINUX_HANDLE_DEATH_PENDING); + } } From owner-dev-commits-src-all@freebsd.org Thu Jul 29 09:58: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 0C62D67089A; Thu, 29 Jul 2021 09:58: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 4Gb5Zr3kMdz3tCN; Thu, 29 Jul 2021 09:58: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 5B6BA776D; Thu, 29 Jul 2021 09:58: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 16T9wiYM070314; Thu, 29 Jul 2021 09:58:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16T9wi3h070313; Thu, 29 Jul 2021 09:58:44 GMT (envelope-from git) Date: Thu, 29 Jul 2021 09:58:44 GMT Message-Id: <202107290958.16T9wi3h070313@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: 7a718f293a1e - main - linux(4): Implement pi futexes using umtx. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7a718f293a1ec59d7f59e5637e098c212adfb23b 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, 29 Jul 2021 09:58:45 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=7a718f293a1ec59d7f59e5637e098c212adfb23b commit 7a718f293a1ec59d7f59e5637e098c212adfb23b Author: Dmitry Chagin AuthorDate: 2021-07-29 09:49:42 +0000 Commit: Dmitry Chagin CommitDate: 2021-07-29 09:49:42 +0000 linux(4): Implement pi futexes using umtx. Differential Revision: https://reviews.freebsd.org/D31240 MFC after: 2 weeks --- sys/compat/linux/linux_fork.c | 7 + sys/compat/linux/linux_futex.c | 349 +++++++++++++++++++++++++++++++++++++---- 2 files changed, 326 insertions(+), 30 deletions(-) diff --git a/sys/compat/linux/linux_fork.c b/sys/compat/linux/linux_fork.c index ff2d5dcfc957..bc7704795127 100644 --- a/sys/compat/linux/linux_fork.c +++ b/sys/compat/linux/linux_fork.c @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -436,4 +437,10 @@ linux_thread_detach(struct thread *td) if (error != 0) linux_msg(td, "futex stuff in thread_detach failed."); } + + /* + * Do not rely on the robust list which is maintained by userspace, + * cleanup remaining pi (if any) after release_futexes anyway. + */ + umtx_thread_exit(td); } diff --git a/sys/compat/linux/linux_futex.c b/sys/compat/linux/linux_futex.c index 9dab78a75af2..441a26d4d317 100644 --- a/sys/compat/linux/linux_futex.c +++ b/sys/compat/linux/linux_futex.c @@ -71,6 +71,7 @@ __KERNEL_RCSID(1, "$NetBSD: linux_futex.c,v 1.7 2006/07/24 19:01:49 manu Exp $") #include #include #include +#include #include #include @@ -92,9 +93,6 @@ LIN_SDT_PROBE_DEFINE5(futex, linux_futex, debug_cmp_requeue, "uint32_t *", "uint32_t", "uint32_t", "uint32_t *", "struct l_timespec *"); LIN_SDT_PROBE_DEFINE5(futex, linux_futex, debug_wake_op, "uint32_t *", "int", "uint32_t", "uint32_t *", "uint32_t"); -LIN_SDT_PROBE_DEFINE0(futex, linux_futex, unimplemented_lock_pi); -LIN_SDT_PROBE_DEFINE0(futex, linux_futex, unimplemented_unlock_pi); -LIN_SDT_PROBE_DEFINE0(futex, linux_futex, unimplemented_trylock_pi); LIN_SDT_PROBE_DEFINE0(futex, linux_futex, deprecated_requeue); LIN_SDT_PROBE_DEFINE0(futex, linux_futex, unimplemented_wait_requeue_pi); LIN_SDT_PROBE_DEFINE0(futex, linux_futex, unimplemented_cmp_requeue_pi); @@ -134,6 +132,10 @@ static int linux_futex_wait(struct thread *, struct linux_futex_args *); static int linux_futex_wake(struct thread *, struct linux_futex_args *); static int linux_futex_requeue(struct thread *, struct linux_futex_args *); static int linux_futex_wakeop(struct thread *, struct linux_futex_args *); +static int linux_futex_lock_pi(struct thread *, bool, struct linux_futex_args *); +static int linux_futex_unlock_pi(struct thread *, bool, + struct linux_futex_args *); +static int futex_wake_pi(struct thread *, uint32_t *, bool); int futex_wake(struct thread *td, uint32_t *uaddr, int val, bool shared) @@ -150,6 +152,19 @@ futex_wake(struct thread *td, uint32_t *uaddr, int val, bool shared) return (linux_futex_wake(td, &args)); } +static int +futex_wake_pi(struct thread *td, uint32_t *uaddr, bool shared) +{ + struct linux_futex_args args; + + bzero(&args, sizeof(args)); + args.op = LINUX_FUTEX_UNLOCK_PI; + args.uaddr = uaddr; + args.flags = shared == true ? FUTEX_SHARED : 0; + + return (linux_futex_unlock_pi(td, true, &args)); +} + static int futex_atomic_op(struct thread *td, int encoded_op, uint32_t *uaddr) { @@ -306,37 +321,23 @@ linux_futex(struct thread *td, struct linux_futex_args *args) return (linux_futex_wakeop(td, args)); case LINUX_FUTEX_LOCK_PI: - /* not yet implemented */ - pem = pem_find(td->td_proc); - if ((pem->flags & LINUX_XUNSUP_FUTEXPIOP) == 0) { - linux_msg(td, "unsupported FUTEX_LOCK_PI"); - pem->flags |= LINUX_XUNSUP_FUTEXPIOP; - LIN_SDT_PROBE0(futex, linux_futex, - unimplemented_lock_pi); - } - return (ENOSYS); + args->clockrt = true; + LINUX_CTR2(sys_futex, "LOCKPI uaddr %p val 0x%x", + args->uaddr, args->val); + + return (linux_futex_lock_pi(td, false, args)); case LINUX_FUTEX_UNLOCK_PI: - /* not yet implemented */ - pem = pem_find(td->td_proc); - if ((pem->flags & LINUX_XUNSUP_FUTEXPIOP) == 0) { - linux_msg(td, "unsupported FUTEX_UNLOCK_PI"); - pem->flags |= LINUX_XUNSUP_FUTEXPIOP; - LIN_SDT_PROBE0(futex, linux_futex, - unimplemented_unlock_pi); - } - return (ENOSYS); + LINUX_CTR1(sys_futex, "UNLOCKPI uaddr %p", + args->uaddr); + + return (linux_futex_unlock_pi(td, false, args)); case LINUX_FUTEX_TRYLOCK_PI: - /* not yet implemented */ - pem = pem_find(td->td_proc); - if ((pem->flags & LINUX_XUNSUP_FUTEXPIOP) == 0) { - linux_msg(td, "unsupported FUTEX_TRYLOCK_PI"); - pem->flags |= LINUX_XUNSUP_FUTEXPIOP; - LIN_SDT_PROBE0(futex, linux_futex, - unimplemented_trylock_pi); - } - return (ENOSYS); + LINUX_CTR1(sys_futex, "TRYLOCKPI uaddr %p", + args->uaddr); + + return (linux_futex_lock_pi(td, true, args)); case LINUX_FUTEX_WAIT_REQUEUE_PI: /* not yet implemented */ @@ -368,6 +369,288 @@ linux_futex(struct thread *td, struct linux_futex_args *args) } } +/* + * pi protocol: + * - 0 futex word value means unlocked. + * - TID futex word value means locked. + * Userspace uses atomic ops to lock/unlock these futexes without entering the + * kernel. If the lock-acquire fastpath fails, (transition from 0 to TID fails), + * then FUTEX_LOCK_PI is called. + * The kernel atomically set FUTEX_WAITERS bit in the futex word value, if no + * other waiters exists looks up the thread that owns the futex (it has put its + * own TID into the futex value) and made this thread the owner of the internal + * pi-aware lock object (mutex). Then the kernel tries to lock the internal lock + * object, on which it blocks. Once it returns, it has the mutex acquired, and it + * sets the futex value to its own TID and returns (futex value contains + * FUTEX_WAITERS|TID). + * The unlock fastpath would fail (because the FUTEX_WAITERS bit is set) and + * FUTEX_UNLOCK_PI will be called. + * If a futex is found to be held at exit time, the kernel sets the OWNER_DIED + * bit of the futex word and wakes up the next futex waiter (if any), WAITERS + * bit is preserved (if any). + * If OWNER_DIED bit is set the kernel sanity checks the futex word value against + * the internal futex state and if correct, acquire futex. + */ +static int +linux_futex_lock_pi(struct thread *td, bool try, struct linux_futex_args *args) +{ + struct umtx_abs_timeout timo; + struct linux_emuldata *em; + struct umtx_pi *pi, *new_pi; + struct thread *td1; + struct umtx_q *uq; + int error, rv; + uint32_t owner, old_owner; + + em = em_find(td); + uq = td->td_umtxq; + error = umtx_key_get(args->uaddr, TYPE_PI_FUTEX, GET_SHARED(args), + &uq->uq_key); + if (error != 0) + return (error); + if (args->ts != NULL) + linux_umtx_abs_timeout_init(&timo, args); + + umtxq_lock(&uq->uq_key); + pi = umtx_pi_lookup(&uq->uq_key); + if (pi == NULL) { + new_pi = umtx_pi_alloc(M_NOWAIT); + if (new_pi == NULL) { + umtxq_unlock(&uq->uq_key); + new_pi = umtx_pi_alloc(M_WAITOK); + umtxq_lock(&uq->uq_key); + pi = umtx_pi_lookup(&uq->uq_key); + if (pi != NULL) { + umtx_pi_free(new_pi); + new_pi = NULL; + } + } + if (new_pi != NULL) { + new_pi->pi_key = uq->uq_key; + umtx_pi_insert(new_pi); + pi = new_pi; + } + } + umtx_pi_ref(pi); + umtxq_unlock(&uq->uq_key); + for (;;) { + /* Try uncontested case first. */ + rv = casueword32(args->uaddr, 0, &owner, em->em_tid); + /* The acquire succeeded. */ + if (rv == 0) { + error = 0; + break; + } + if (rv == -1) { + error = EFAULT; + break; + } + + /* + * Avoid overwriting a possible error from sleep due + * to the pending signal with suspension check result. + */ + if (error == 0) { + error = thread_check_susp(td, true); + if (error != 0) + break; + } + + /* The futex word at *uaddr is already locked by the caller. */ + if ((owner & FUTEX_TID_MASK) == em->em_tid) { + error = EDEADLK; + break; + } + + /* + * Futex owner died, handle_futex_death() set the OWNER_DIED bit + * and clear tid. Try to acquire it. + */ + if ((owner & FUTEX_TID_MASK) == 0) { + old_owner = owner; + owner = owner & (FUTEX_WAITERS | FUTEX_OWNER_DIED); + owner |= em->em_tid; + rv = casueword32(args->uaddr, old_owner, &owner, owner); + if (rv == -1) { + error = EFAULT; + break; + } + if (rv == 1) { + if (error == 0) { + error = thread_check_susp(td, true); + if (error != 0) + break; + } + + /* + * If this failed the lock could + * changed, restart. + */ + continue; + } + + umtxq_lock(&uq->uq_key); + umtxq_busy(&uq->uq_key); + error = umtx_pi_claim(pi, td); + umtxq_unbusy(&uq->uq_key); + umtxq_unlock(&uq->uq_key); + if (error != 0) { + /* + * Since we're going to return an + * error, restore the futex to its + * previous, unowned state to avoid + * compounding the problem. + */ + (void)casuword32(args->uaddr, owner, old_owner); + } + break; + } + + /* + * Inconsistent state: OWNER_DIED is set and tid is not 0. + * Linux does some checks of futex state, we return EINVAL, + * as the user space can take care of this. + */ + if ((owner & FUTEX_OWNER_DIED) != 0) { + error = EINVAL; + break; + } + + if (try != 0) { + error = EBUSY; + break; + } + + /* + * If we caught a signal, we have retried and now + * exit immediately. + */ + if (error != 0) + break; + + umtxq_lock(&uq->uq_key); + umtxq_busy(&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. + */ + rv = casueword32(args->uaddr, owner, &owner, + owner | FUTEX_WAITERS); + if (rv == -1) { + umtxq_unbusy_unlocked(&uq->uq_key); + error = EFAULT; + break; + } + if (rv == 1) { + umtxq_unbusy_unlocked(&uq->uq_key); + error = thread_check_susp(td, true); + if (error != 0) + break; + + /* + * The lock changed and we need to retry or we + * lost a race to the thread unlocking the umtx. + */ + continue; + } + + /* + * Substitute Linux thread id by native thread id to + * avoid refactoring code of umtxq_sleep_pi(). + */ + td1 = linux_tdfind(td, owner & FUTEX_TID_MASK, -1); + if (td1 != NULL) { + owner = td1->td_tid; + PROC_UNLOCK(td1->td_proc); + } else { + umtxq_unbusy_unlocked(&uq->uq_key); + error = EINVAL; + break; + } + + umtxq_lock(&uq->uq_key); + + /* We set the contested bit, sleep. */ + error = umtxq_sleep_pi(uq, pi, owner, "futexp", + args->ts == NULL ? NULL : &timo, + (args->flags & FUTEX_SHARED) != 0); + if (error != 0) + continue; + + error = thread_check_susp(td, false); + if (error != 0) + break; + } + + umtxq_lock(&uq->uq_key); + umtx_pi_unref(pi); + umtxq_unlock(&uq->uq_key); + umtx_key_release(&uq->uq_key); + return (error); +} + +static int +linux_futex_unlock_pi(struct thread *td, bool rb, struct linux_futex_args *args) +{ + struct linux_emuldata *em; + struct umtx_key key; + uint32_t old, owner, new_owner; + int count, error; + + em = em_find(td); + + /* + * Make sure we own this mtx. + */ + error = fueword32(args->uaddr, &owner); + if (error == -1) + return (EFAULT); + if (!rb && (owner & FUTEX_TID_MASK) != em->em_tid) + return (EPERM); + + error = umtx_key_get(args->uaddr, TYPE_PI_FUTEX, GET_SHARED(args), &key); + if (error != 0) + return (error); + umtxq_lock(&key); + umtxq_busy(&key); + error = umtx_pi_drop(td, &key, rb, &count); + if (error != 0 || rb) { + umtxq_unbusy(&key); + umtxq_unlock(&key); + umtx_key_release(&key); + return (error); + } + umtxq_unlock(&key); + + /* + * When unlocking the futex, it must be marked as unowned if + * there is zero or one thread only waiting for it. + * Otherwise, it must be marked as contested. + */ + if (count > 1) + new_owner = FUTEX_WAITERS; + else + new_owner = 0; + +again: + error = casueword32(args->uaddr, owner, &old, new_owner); + if (error == 1) { + error = thread_check_susp(td, false); + if (error == 0) + goto again; + } + umtxq_unbusy_unlocked(&key); + umtx_key_release(&key); + if (error == -1) + return (EFAULT); + if (error == 0 && old != owner) + return (EINVAL); + return (error); +} + static int linux_futex_wakeop(struct thread *td, struct linux_futex_args *args) { @@ -576,6 +859,7 @@ linux_sys_futex(struct thread *td, struct linux_sys_futex_args *args) switch (args->op & LINUX_FUTEX_CMD_MASK) { case LINUX_FUTEX_WAIT: case LINUX_FUTEX_WAIT_BITSET: + case LINUX_FUTEX_LOCK_PI: if (args->timeout != NULL) { error = copyin(args->timeout, <s, sizeof(lts)); if (error != 0) @@ -611,6 +895,7 @@ linux_sys_futex_time64(struct thread *td, switch (args->op & LINUX_FUTEX_CMD_MASK) { case LINUX_FUTEX_WAIT: case LINUX_FUTEX_WAIT_BITSET: + case LINUX_FUTEX_LOCK_PI: if (args->timeout != NULL) { error = copyin(args->timeout, <s, sizeof(lts)); if (error != 0) @@ -721,6 +1006,10 @@ retry: error = futex_wake(curthread, uaddr, 1, true); if (error != 0) return (error); + } else if (pi && (uval & FUTEX_WAITERS)) { + error = futex_wake_pi(curthread, uaddr, true); + if (error != 0) + return (error); } } From owner-dev-commits-src-all@freebsd.org Thu Jul 29 09:58: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 1920167098C; Thu, 29 Jul 2021 09:58: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 4Gb5Zv6GX3z3swY; Thu, 29 Jul 2021 09:58: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 BA8317B08; Thu, 29 Jul 2021 09:58: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 16T9wlfF070392; Thu, 29 Jul 2021 09:58:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16T9wl5e070391; Thu, 29 Jul 2021 09:58:47 GMT (envelope-from git) Date: Thu, 29 Jul 2021 09:58:47 GMT Message-Id: <202107290958.16T9wl5e070391@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: dad107705667 - main - linux(4): Futex address must be 32-bit aligned. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dad107705667dfca89db796c1c075a782f4666d4 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, 29 Jul 2021 09:58:48 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=dad107705667dfca89db796c1c075a782f4666d4 commit dad107705667dfca89db796c1c075a782f4666d4 Author: Dmitry Chagin AuthorDate: 2021-07-29 09:50:58 +0000 Commit: Dmitry Chagin CommitDate: 2021-07-29 09:50:58 +0000 linux(4): Futex address must be 32-bit aligned. Linux futex documentation explicitly states that EINVAL is returned if the futex is not 4-byte aligned. Check futex alignment as a Linux do and return EINVAL. Differential Revision: https://reviews.freebsd.org/D31279 MFC after: 2 weeks --- sys/compat/linux/linux_futex.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/sys/compat/linux/linux_futex.c b/sys/compat/linux/linux_futex.c index b002d7281171..c81fe20212a2 100644 --- a/sys/compat/linux/linux_futex.c +++ b/sys/compat/linux/linux_futex.c @@ -125,6 +125,7 @@ struct linux_futex_args { struct timespec kts; }; +static inline int futex_key_get(const void *, int, int, struct umtx_key *); static void linux_umtx_abs_timeout_init(struct umtx_abs_timeout *, struct linux_futex_args *); static int linux_futex(struct thread *, struct linux_futex_args *); @@ -137,6 +138,16 @@ static int linux_futex_unlock_pi(struct thread *, bool, struct linux_futex_args *); static int futex_wake_pi(struct thread *, uint32_t *, bool); +static int +futex_key_get(const void *uaddr, int type, int share, struct umtx_key *key) +{ + + /* Check that futex address is a 32bit aligned. */ + if (!__is_aligned(uaddr, sizeof(uint32_t))) + return (EINVAL); + return (umtx_key_get(uaddr, type, share, key)); +} + int futex_wake(struct thread *td, uint32_t *uaddr, int val, bool shared) { @@ -404,7 +415,7 @@ linux_futex_lock_pi(struct thread *td, bool try, struct linux_futex_args *args) em = em_find(td); uq = td->td_umtxq; - error = umtx_key_get(args->uaddr, TYPE_PI_FUTEX, GET_SHARED(args), + error = futex_key_get(args->uaddr, TYPE_PI_FUTEX, GET_SHARED(args), &uq->uq_key); if (error != 0) return (error); @@ -611,7 +622,7 @@ linux_futex_unlock_pi(struct thread *td, bool rb, struct linux_futex_args *args) if (!rb && (owner & FUTEX_TID_MASK) != em->em_tid) return (EPERM); - error = umtx_key_get(args->uaddr, TYPE_PI_FUTEX, GET_SHARED(args), &key); + error = futex_key_get(args->uaddr, TYPE_PI_FUTEX, GET_SHARED(args), &key); if (error != 0) return (error); umtxq_lock(&key); @@ -661,10 +672,10 @@ linux_futex_wakeop(struct thread *td, struct linux_futex_args *args) if (args->uaddr == args->uaddr2) return (EINVAL); - error = umtx_key_get(args->uaddr, TYPE_FUTEX, GET_SHARED(args), &key); + error = futex_key_get(args->uaddr, TYPE_FUTEX, GET_SHARED(args), &key); if (error != 0) return (error); - error = umtx_key_get(args->uaddr2, TYPE_FUTEX, GET_SHARED(args), &key2); + error = futex_key_get(args->uaddr2, TYPE_FUTEX, GET_SHARED(args), &key2); if (error != 0) { umtx_key_release(&key); return (error); @@ -726,10 +737,10 @@ linux_futex_requeue(struct thread *td, struct linux_futex_args *args) if (nrwake < 0 || nrrequeue < 0) return (EINVAL); - error = umtx_key_get(args->uaddr, TYPE_FUTEX, GET_SHARED(args), &key); + error = futex_key_get(args->uaddr, TYPE_FUTEX, GET_SHARED(args), &key); if (error != 0) return (error); - error = umtx_key_get(args->uaddr2, TYPE_FUTEX, GET_SHARED(args), &key2); + error = futex_key_get(args->uaddr2, TYPE_FUTEX, GET_SHARED(args), &key2); if (error != 0) { umtx_key_release(&key); return (error); @@ -764,7 +775,7 @@ linux_futex_wake(struct thread *td, struct linux_futex_args *args) if (args->val3 == 0) return (EINVAL); - error = umtx_key_get(args->uaddr, TYPE_FUTEX, GET_SHARED(args), &key); + error = futex_key_get(args->uaddr, TYPE_FUTEX, GET_SHARED(args), &key); if (error != 0) return (error); umtxq_lock(&key); @@ -786,7 +797,7 @@ linux_futex_wait(struct thread *td, struct linux_futex_args *args) error = EINVAL; uq = td->td_umtxq; - error = umtx_key_get(args->uaddr, TYPE_FUTEX, GET_SHARED(args), + error = futex_key_get(args->uaddr, TYPE_FUTEX, GET_SHARED(args), &uq->uq_key); if (error != 0) return (error); From owner-dev-commits-src-all@freebsd.org Thu Jul 29 09:58: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 47DEA67066A; Thu, 29 Jul 2021 09:58: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 4Gb5b50nJnz3sx2; Thu, 29 Jul 2021 09:58: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 DC7657969; Thu, 29 Jul 2021 09:58: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 16T9wuxk070590; Thu, 29 Jul 2021 09:58:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16T9wuWR070589; Thu, 29 Jul 2021 09:58:56 GMT (envelope-from git) Date: Thu, 29 Jul 2021 09:58:56 GMT Message-Id: <202107290958.16T9wuWR070589@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: 49a5c0409bf1 - main - linux(4): Move len variable initialization to the appropriate place. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 49a5c0409bf15fc00bbe363fe7090d7b7c601985 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, 29 Jul 2021 09:58:57 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=49a5c0409bf15fc00bbe363fe7090d7b7c601985 commit 49a5c0409bf15fc00bbe363fe7090d7b7c601985 Author: Dmitry Chagin AuthorDate: 2021-07-29 09:54:16 +0000 Commit: Dmitry Chagin CommitDate: 2021-07-29 09:54:16 +0000 linux(4): Move len variable initialization to the appropriate place. MFC after: 2 weeks --- sys/compat/linux/linux_futex.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/compat/linux/linux_futex.c b/sys/compat/linux/linux_futex.c index ec65db3f8bd3..353b76afe8cc 100644 --- a/sys/compat/linux/linux_futex.c +++ b/sys/compat/linux/linux_futex.c @@ -893,7 +893,7 @@ linux_get_robust_list(struct thread *td, struct linux_get_robust_list_args *args { struct linux_emuldata *em; struct linux_robust_list_head *head; - l_size_t len = sizeof(struct linux_robust_list_head); + l_size_t len; struct thread *td2; int error; @@ -924,6 +924,7 @@ linux_get_robust_list(struct thread *td, struct linux_get_robust_list_args *args PROC_UNLOCK(td2->td_proc); } + len = sizeof(struct linux_robust_list_head); error = copyout(&len, args->len, sizeof(l_size_t)); if (error != 0) return (EFAULT); From owner-dev-commits-src-all@freebsd.org Thu Jul 29 09:58: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 2D0DC670668; Thu, 29 Jul 2021 09:58: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 4Gb5b36fDTz3tLC; Thu, 29 Jul 2021 09:58: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 B719F7B82; Thu, 29 Jul 2021 09:58: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 16T9wt7l070566; Thu, 29 Jul 2021 09:58:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16T9wtAb070565; Thu, 29 Jul 2021 09:58:55 GMT (envelope-from git) Date: Thu, 29 Jul 2021 09:58:55 GMT Message-Id: <202107290958.16T9wtAb070565@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: c8e9d2b7eb6e - main - linux(4): Use linux_tdfind() in get_robust_list. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c8e9d2b7eb6ef55e1386150458c58e6554762166 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, 29 Jul 2021 09:58:57 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=c8e9d2b7eb6ef55e1386150458c58e6554762166 commit c8e9d2b7eb6ef55e1386150458c58e6554762166 Author: Dmitry Chagin AuthorDate: 2021-07-29 09:53:59 +0000 Commit: Dmitry Chagin CommitDate: 2021-07-29 09:53:59 +0000 linux(4): Use linux_tdfind() in get_robust_list. In the Linux emulation layer linux_tdfind() has a special purpose to handle glibc specific TID mangling and we should use it instead of tdfind(). MFC after: 2 weeks --- sys/compat/linux/linux_futex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/compat/linux/linux_futex.c b/sys/compat/linux/linux_futex.c index 07623fbfe9e3..ec65db3f8bd3 100644 --- a/sys/compat/linux/linux_futex.c +++ b/sys/compat/linux/linux_futex.c @@ -902,7 +902,7 @@ linux_get_robust_list(struct thread *td, struct linux_get_robust_list_args *args KASSERT(em != NULL, ("get_robust_list: emuldata notfound.\n")); head = em->robust_futexes; } else { - td2 = tdfind(args->pid, -1); + td2 = linux_tdfind(td, args->pid, -1); if (td2 == NULL) return (ESRCH); if (SV_PROC_ABI(td2->td_proc) != SV_ABI_LINUX) { From owner-dev-commits-src-all@freebsd.org Thu Jul 29 09:59: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 540CF67067B; Thu, 29 Jul 2021 09:59: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 4Gb5bC0BSBz3tGB; Thu, 29 Jul 2021 09:59: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 8F87F7770; Thu, 29 Jul 2021 09:59: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 16T9x2bG070716; Thu, 29 Jul 2021 09:59:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16T9x2mO070715; Thu, 29 Jul 2021 09:59:02 GMT (envelope-from git) Date: Thu, 29 Jul 2021 09:59:02 GMT Message-Id: <202107290959.16T9x2mO070715@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: 2411ac0b89f3 - main - linux(4): Eliminate a now unused includes after futexes refactoring. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2411ac0b89f3a33aca93c62b53bd48deee123766 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, 29 Jul 2021 09:59:03 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=2411ac0b89f3a33aca93c62b53bd48deee123766 commit 2411ac0b89f3a33aca93c62b53bd48deee123766 Author: Dmitry Chagin AuthorDate: 2021-07-29 09:56:39 +0000 Commit: Dmitry Chagin CommitDate: 2021-07-29 09:56:39 +0000 linux(4): Eliminate a now unused includes after futexes refactoring. MFC after: 2 weeks --- sys/compat/linux/linux_futex.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/sys/compat/linux/linux_futex.c b/sys/compat/linux/linux_futex.c index edf059f74272..edd2e369f0cf 100644 --- a/sys/compat/linux/linux_futex.c +++ b/sys/compat/linux/linux_futex.c @@ -47,19 +47,13 @@ __KERNEL_RCSID(1, "$NetBSD: linux_futex.c,v 1.7 2006/07/24 19:01:49 manu Exp $") #include #include #include -#include #include -#include -#include #include #include #include -#include #include #include -#include - #ifdef COMPAT_LINUX32 #include #include From owner-dev-commits-src-all@freebsd.org Thu Jul 29 09:58: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 387BC6706C3; Thu, 29 Jul 2021 09:58: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 4Gb5Zt5sNlz3t0c; Thu, 29 Jul 2021 09:58: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 8B44B78E0; Thu, 29 Jul 2021 09:58: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 16T9wkrr070362; Thu, 29 Jul 2021 09:58:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16T9wkic070361; Thu, 29 Jul 2021 09:58:46 GMT (envelope-from git) Date: Thu, 29 Jul 2021 09:58:46 GMT Message-Id: <202107290958.16T9wkic070361@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: b33e4690271c - main - linux(4): Finish cf8d74e3fe63. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b33e4690271cb8084631db8ccb5ed8e2ecec48bd 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, 29 Jul 2021 09:58:47 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=b33e4690271cb8084631db8ccb5ed8e2ecec48bd commit b33e4690271cb8084631db8ccb5ed8e2ecec48bd Author: Dmitry Chagin AuthorDate: 2021-07-29 09:50:43 +0000 Commit: Dmitry Chagin CommitDate: 2021-07-29 09:50:43 +0000 linux(4): Finish cf8d74e3fe63. Add forgotten val3_compare initialization in case of time64 futex. MFC after: 2 weeks --- sys/compat/linux/linux_futex.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/compat/linux/linux_futex.c b/sys/compat/linux/linux_futex.c index 82a1eb55d618..b002d7281171 100644 --- a/sys/compat/linux/linux_futex.c +++ b/sys/compat/linux/linux_futex.c @@ -888,6 +888,7 @@ linux_sys_futex_time64(struct thread *td, .ts = NULL, .uaddr2 = args->uaddr2, .val3 = args->val3, + .val3_compare = true, }; struct l_timespec64 lts; int error; From owner-dev-commits-src-all@freebsd.org Thu Jul 29 09: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 AD663670665; Thu, 29 Jul 2021 09:58: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 4Gb5Zy35Klz3t9Z; Thu, 29 Jul 2021 09:58: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 12FBF72ED; Thu, 29 Jul 2021 09:58: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 16T9wnxl070440; Thu, 29 Jul 2021 09:58:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16T9wn2G070439; Thu, 29 Jul 2021 09:58:49 GMT (envelope-from git) Date: Thu, 29 Jul 2021 09:58:49 GMT Message-Id: <202107290958.16T9wn2G070439@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: 741f80df531c - main - linux(4): Eliminating an accidental comment. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 741f80df531cb58a38a8ec98203c7e315b6f9bca 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, 29 Jul 2021 09:58:50 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=741f80df531cb58a38a8ec98203c7e315b6f9bca commit 741f80df531cb58a38a8ec98203c7e315b6f9bca Author: Dmitry Chagin AuthorDate: 2021-07-29 09:51:56 +0000 Commit: Dmitry Chagin CommitDate: 2021-07-29 09:51:56 +0000 linux(4): Eliminating an accidental comment. MFC after: 2 weeks --- sys/i386/linux/linux_sysvec.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/sys/i386/linux/linux_sysvec.c b/sys/i386/linux/linux_sysvec.c index c2b24b1d8667..9261364e7a24 100644 --- a/sys/i386/linux/linux_sysvec.c +++ b/sys/i386/linux/linux_sysvec.c @@ -1169,8 +1169,3 @@ static moduledata_t linux_elf_mod = { DECLARE_MODULE_TIED(linuxelf, linux_elf_mod, SI_SUB_EXEC, SI_ORDER_ANY); FEATURE(linux, "Linux 32bit support"); - -/* - * linux_vdso_install() and linux_exec_sysvec_init() must be called - * after exec_sysvec_init() which is SI_SUB_EXEC (SI_ORDER_ANY). - */ From owner-dev-commits-src-all@freebsd.org Thu Jul 29 09:58: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 DD57E670A05; Thu, 29 Jul 2021 09:58: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 4Gb5b03lHhz3snG; Thu, 29 Jul 2021 09:58: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 4AF8C7968; Thu, 29 Jul 2021 09:58: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 16T9wqC6070488; Thu, 29 Jul 2021 09:58:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16T9wqPO070487; Thu, 29 Jul 2021 09:58:52 GMT (envelope-from git) Date: Thu, 29 Jul 2021 09:58:52 GMT Message-Id: <202107290958.16T9wqPO070487@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: 971b53fa04f9 - main - linux(4): style, wrap too long line. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 971b53fa04f96199889f6dd6a078d054772bc7c9 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, 29 Jul 2021 09:58:53 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=971b53fa04f96199889f6dd6a078d054772bc7c9 commit 971b53fa04f96199889f6dd6a078d054772bc7c9 Author: Dmitry Chagin AuthorDate: 2021-07-29 09:53:07 +0000 Commit: Dmitry Chagin CommitDate: 2021-07-29 09:53:07 +0000 linux(4): style, wrap too long line. MFC after: 2 weeks --- sys/compat/linux/linux_futex.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sys/compat/linux/linux_futex.c b/sys/compat/linux/linux_futex.c index 510b43f11ca4..f26a4edc7311 100644 --- a/sys/compat/linux/linux_futex.c +++ b/sys/compat/linux/linux_futex.c @@ -925,7 +925,7 @@ linux_get_robust_list(struct thread *td, struct linux_get_robust_list_args *args } error = copyout(&len, args->len, sizeof(l_size_t)); - if (error) + if (error != 0) return (EFAULT); return (copyout(&head, args->head, sizeof(head))); @@ -1001,7 +1001,7 @@ fetch_robust_entry(struct linux_robust_list **entry, int error; error = copyin((const void *)head, &uentry, sizeof(l_ulong)); - if (error) + if (error != 0) return (EFAULT); *entry = (void *)(uentry & ~1UL); @@ -1022,10 +1022,9 @@ release_futexes(struct thread *td, struct linux_emuldata *em) unsigned int limit = 2048, pi, next_pi, pip; uint32_t *uaddr; l_long futex_offset; - int rc, error; + int error; head = em->robust_futexes; - if (head == NULL) return; @@ -1034,14 +1033,15 @@ release_futexes(struct thread *td, struct linux_emuldata *em) error = copyin(&head->futex_offset, &futex_offset, sizeof(futex_offset)); - if (error) + if (error != 0) return; if (fetch_robust_entry(&pending, PTRIN(&head->pending_list), &pip)) return; while (entry != &head->list) { - rc = fetch_robust_entry(&next_entry, PTRIN(&entry->next), &next_pi); + error = fetch_robust_entry(&next_entry, PTRIN(&entry->next), + &next_pi); /* * A pending lock might already be on the list, so @@ -1053,7 +1053,7 @@ release_futexes(struct thread *td, struct linux_emuldata *em) LINUX_HANDLE_DEATH_LIST)) return; } - if (rc) + if (error != 0) return; entry = next_entry; From owner-dev-commits-src-all@freebsd.org Thu Jul 29 09:58: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 41B566706D0; Thu, 29 Jul 2021 09:58: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 4Gb5b14yDmz3t9r; Thu, 29 Jul 2021 09:58: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 7034A78E1; Thu, 29 Jul 2021 09:58: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 16T9wrOe070518; Thu, 29 Jul 2021 09:58:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16T9wr9B070517; Thu, 29 Jul 2021 09:58:53 GMT (envelope-from git) Date: Thu, 29 Jul 2021 09:58:53 GMT Message-Id: <202107290958.16T9wr9B070517@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: 6b68e8af1f87 - main - linux(4): Eliminate unnecessary head initialization. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6b68e8af1f8770bdc7aff66e1ae616efd9c9da46 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, 29 Jul 2021 09:58:54 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=6b68e8af1f8770bdc7aff66e1ae616efd9c9da46 commit 6b68e8af1f8770bdc7aff66e1ae616efd9c9da46 Author: Dmitry Chagin AuthorDate: 2021-07-29 09:53:25 +0000 Commit: Dmitry Chagin CommitDate: 2021-07-29 09:53:25 +0000 linux(4): Eliminate unnecessary head initialization. MFC after: 2 weeks --- sys/compat/linux/linux_futex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/compat/linux/linux_futex.c b/sys/compat/linux/linux_futex.c index f26a4edc7311..74c0bda9f96d 100644 --- a/sys/compat/linux/linux_futex.c +++ b/sys/compat/linux/linux_futex.c @@ -1017,7 +1017,7 @@ fetch_robust_entry(struct linux_robust_list **entry, void release_futexes(struct thread *td, struct linux_emuldata *em) { - struct linux_robust_list_head *head = NULL; + struct linux_robust_list_head *head; struct linux_robust_list *entry, *next_entry, *pending; unsigned int limit = 2048, pi, next_pi, pip; uint32_t *uaddr; From owner-dev-commits-src-all@freebsd.org Thu Jul 29 09:59: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 77EE8670A10; Thu, 29 Jul 2021 09:59: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 4Gb5b72J2Wz3tLG; Thu, 29 Jul 2021 09:58: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 2654D72EF; Thu, 29 Jul 2021 09:58: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 16T9wxpa070644; Thu, 29 Jul 2021 09:58:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16T9wx3u070643; Thu, 29 Jul 2021 09:58:59 GMT (envelope-from git) Date: Thu, 29 Jul 2021 09:58:59 GMT Message-Id: <202107290958.16T9wx3u070643@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: a9bb1b1c1883 - main - linux(4): Handle FUTEX_LOCK_PI2 oeration. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a9bb1b1c188339ed7658103ff5843c161df08799 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, 29 Jul 2021 09:59:01 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=a9bb1b1c188339ed7658103ff5843c161df08799 commit a9bb1b1c188339ed7658103ff5843c161df08799 Author: Dmitry Chagin AuthorDate: 2021-07-29 09:55:02 +0000 Commit: Dmitry Chagin CommitDate: 2021-07-29 09:55:02 +0000 linux(4): Handle FUTEX_LOCK_PI2 oeration. FUTEX_LOCK_PI2 was added to support clock selection as FUTEX_LOCK_PI uses a CLOCK_REALTIME based absolute value since it was implemented, but it does not require that the FUTEX_CLOCK_REALTIME bit is set, because that was introduced later. MFC after: 2 weeks --- sys/compat/linux/linux_futex.c | 7 ++++++- sys/compat/linux/linux_futex.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/sys/compat/linux/linux_futex.c b/sys/compat/linux/linux_futex.c index cc3a685fb14e..fcac2eba4956 100644 --- a/sys/compat/linux/linux_futex.c +++ b/sys/compat/linux/linux_futex.c @@ -288,6 +288,9 @@ linux_futex(struct thread *td, struct linux_futex_args *args) case LINUX_FUTEX_LOCK_PI: args->clockrt = true; + /* FALLTHROUGH */ + + case LINUX_FUTEX_LOCK_PI2: LINUX_CTR2(sys_futex, "LOCKPI uaddr %p val 0x%x", args->uaddr, args->val); @@ -789,7 +792,7 @@ linux_umtx_abs_timeout_init(struct umtx_abs_timeout *timo, /* * The FUTEX_CLOCK_REALTIME option bit can be employed only with the - * FUTEX_WAIT_BITSET, FUTEX_WAIT_REQUEUE_PI. + * FUTEX_WAIT_BITSET, FUTEX_WAIT_REQUEUE_PI, FUTEX_LOCK_PI2. * For FUTEX_WAIT, timeout is interpreted as a relative value, for other * futex operations timeout is interpreted as an absolute value. * If FUTEX_CLOCK_REALTIME option bit is set, the Linux kernel measures @@ -820,6 +823,7 @@ linux_sys_futex(struct thread *td, struct linux_sys_futex_args *args) case LINUX_FUTEX_WAIT: case LINUX_FUTEX_WAIT_BITSET: case LINUX_FUTEX_LOCK_PI: + case LINUX_FUTEX_LOCK_PI2: if (args->timeout != NULL) { error = copyin(args->timeout, <s, sizeof(lts)); if (error != 0) @@ -857,6 +861,7 @@ linux_sys_futex_time64(struct thread *td, case LINUX_FUTEX_WAIT: case LINUX_FUTEX_WAIT_BITSET: case LINUX_FUTEX_LOCK_PI: + case LINUX_FUTEX_LOCK_PI2: if (args->timeout != NULL) { error = copyin(args->timeout, <s, sizeof(lts)); if (error != 0) diff --git a/sys/compat/linux/linux_futex.h b/sys/compat/linux/linux_futex.h index 4255cbdc7363..189db4e17c4f 100644 --- a/sys/compat/linux/linux_futex.h +++ b/sys/compat/linux/linux_futex.h @@ -51,6 +51,7 @@ #define LINUX_FUTEX_WAKE_BITSET 10 #define LINUX_FUTEX_WAIT_REQUEUE_PI 11 #define LINUX_FUTEX_CMP_REQUEUE_PI 12 +#define LINUX_FUTEX_LOCK_PI2 13 #define LINUX_FUTEX_PRIVATE_FLAG 128 #define LINUX_FUTEX_CLOCK_REALTIME 256 From owner-dev-commits-src-all@freebsd.org Thu Jul 29 09:59: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 7C532670A13; Thu, 29 Jul 2021 09:59: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 4Gb5b84NrFz3tRM; Thu, 29 Jul 2021 09:59: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 531B57B0C; Thu, 29 Jul 2021 09:59: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 16T9x03J070668; Thu, 29 Jul 2021 09:59:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16T9x0p0070667; Thu, 29 Jul 2021 09:59:00 GMT (envelope-from git) Date: Thu, 29 Jul 2021 09:59:00 GMT Message-Id: <202107290959.16T9x0p0070667@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: 626cbd464814 - main - linux(4): Handle incorrect FUTEX_CLOCK_REALTIME option bit. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 626cbd4648141929502b953111dc8a71d550c7e8 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, 29 Jul 2021 09:59:02 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=626cbd4648141929502b953111dc8a71d550c7e8 commit 626cbd4648141929502b953111dc8a71d550c7e8 Author: Dmitry Chagin AuthorDate: 2021-07-29 09:55:33 +0000 Commit: Dmitry Chagin CommitDate: 2021-07-29 09:55:33 +0000 linux(4): Handle incorrect FUTEX_CLOCK_REALTIME option bit. Return ENOSYS if the FUTEX_CLOCK_REALTIME option bit is specified for an inappropriate futex operation. MFC after: 2 weeks --- sys/compat/linux/linux_futex.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys/compat/linux/linux_futex.c b/sys/compat/linux/linux_futex.c index fcac2eba4956..5f18c93b0988 100644 --- a/sys/compat/linux/linux_futex.c +++ b/sys/compat/linux/linux_futex.c @@ -224,6 +224,12 @@ linux_futex(struct thread *td, struct linux_futex_args *args) args->clockrt = args->op & LINUX_FUTEX_CLOCK_REALTIME; args->op = args->op & ~LINUX_FUTEX_CLOCK_REALTIME; + if (args->clockrt && + args->op != LINUX_FUTEX_WAIT_BITSET && + args->op != LINUX_FUTEX_WAIT_REQUEUE_PI && + args->op != LINUX_FUTEX_LOCK_PI2) + return (ENOSYS); + switch (args->op) { case LINUX_FUTEX_WAIT: args->val3 = FUTEX_BITSET_MATCH_ANY; From owner-dev-commits-src-all@freebsd.org Thu Jul 29 09:58: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 AE6C367092D; Thu, 29 Jul 2021 09:58: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 4Gb5Zz3fg3z3tFM; Thu, 29 Jul 2021 09:58: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 2DC5A72EE; Thu, 29 Jul 2021 09:58: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 16T9wpMP070464; Thu, 29 Jul 2021 09:58:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16T9wpuC070463; Thu, 29 Jul 2021 09:58:51 GMT (envelope-from git) Date: Thu, 29 Jul 2021 09:58:51 GMT Message-Id: <202107290958.16T9wpuC070463@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: edd44176aa0e - main - linux(4): Eliminating remnants of futex sdt. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: edd44176aa0e1acdb3a97746c6fe595d12be0c45 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, 29 Jul 2021 09:58:51 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=edd44176aa0e1acdb3a97746c6fe595d12be0c45 commit edd44176aa0e1acdb3a97746c6fe595d12be0c45 Author: Dmitry Chagin AuthorDate: 2021-07-29 09:52:36 +0000 Commit: Dmitry Chagin CommitDate: 2021-07-29 09:52:36 +0000 linux(4): Eliminating remnants of futex sdt. MFC after: 2 weeks --- sys/compat/linux/check_error.d | 25 -------------- sys/compat/linux/linux_futex.c | 76 +++--------------------------------------- 2 files changed, 5 insertions(+), 96 deletions(-) diff --git a/sys/compat/linux/check_error.d b/sys/compat/linux/check_error.d index 389e768aa3f6..8ed87a397863 100644 --- a/sys/compat/linux/check_error.d +++ b/sys/compat/linux/check_error.d @@ -39,28 +39,6 @@ linuxulator*:dummy::not_implemented, linuxulator*:emul:linux_thread_detach:child_clear_tid_error, linuxulator*:emul:linux_thread_detach:futex_failed, linuxulator*:emul:linux_schedtail:copyout_error, -linuxulator*:futex:futex_get:error, -linuxulator*:futex:futex_sleep:requeue_error, -linuxulator*:futex:futex_sleep:sleep_error, -linuxulator*:futex:futex_wait:copyin_error, -linuxulator*:futex:futex_wait:itimerfix_error, -linuxulator*:futex:futex_wait:sleep_error, -linuxulator*:futex:futex_atomic_op:missing_access_check, -linuxulator*:futex:futex_atomic_op:unimplemented_op, -linuxulator*:futex:futex_atomic_op:unimplemented_cmp, -linuxulator*:futex:linux_sys_futex:unimplemented_clockswitch, -linuxulator*:futex:linux_sys_futex:copyin_error, -linuxulator*:futex:linux_sys_futex:unhandled_efault, -linuxulator*:futex:linux_sys_futex:unimplemented_lock_pi, -linuxulator*:futex:linux_sys_futex:unimplemented_unlock_pi, -linuxulator*:futex:linux_sys_futex:unimplemented_trylock_pi, -linuxulator*:futex:linux_sys_futex:unimplemented_wait_requeue_pi, -linuxulator*:futex:linux_sys_futex:unimplemented_cmp_requeue_pi, -linuxulator*:futex:linux_sys_futex:unknown_operation, -linuxulator*:futex:linux_get_robust_list:copyout_error, -linuxulator*:futex:handle_futex_death:copyin_error, -linuxulator*:futex:fetch_robust_entry:copyin_error, -linuxulator*:futex:release_futexes:copyin_error, linuxulator*:time:linux_clock_gettime:conversion_error, linuxulator*:time:linux_clock_gettime:gettime_error, linuxulator*:time:linux_clock_gettime:copyout_error, @@ -98,9 +76,6 @@ linuxulator*:mib:linux_prison_get:vfs_setopts_error linuxulator*:util:linux_driver_get_name_dev:nullcall, linuxulator*:util:linux_driver_get_major_minor:nullcall, -linuxulator*:futex:linux_sys_futex:invalid_cmp_requeue_use, -linuxulator*:futex:linux_sys_futex:deprecated_requeue, -linuxulator*:futex:linux_set_robust_list:size_error, linuxulator*:time:linux_clock_getres:nullcall { printf("WARNING: %s:%s:%s:%s in application %s, maybe an application error?\n", probename, probeprov, probemod, probefunc, execname); diff --git a/sys/compat/linux/linux_futex.c b/sys/compat/linux/linux_futex.c index 8bc8879c92c6..510b43f11ca4 100644 --- a/sys/compat/linux/linux_futex.c +++ b/sys/compat/linux/linux_futex.c @@ -56,7 +56,6 @@ __KERNEL_RCSID(1, "$NetBSD: linux_futex.c,v 1.7 2006/07/24 19:01:49 manu Exp $") #include #include #include -#include #include #include @@ -68,40 +67,12 @@ __KERNEL_RCSID(1, "$NetBSD: linux_futex.c,v 1.7 2006/07/24 19:01:49 manu Exp $") #include #include #endif -#include #include #include #include #include #include -/* DTrace init */ -LIN_SDT_PROVIDER_DECLARE(LINUX_DTRACE); - -/** - * DTrace probes in this module. - */ -LIN_SDT_PROBE_DEFINE4(futex, futex_atomic_op, decoded_op, "int", "int", "int", - "int"); -LIN_SDT_PROBE_DEFINE1(futex, futex_atomic_op, unimplemented_op, "int"); -LIN_SDT_PROBE_DEFINE1(futex, futex_atomic_op, unimplemented_cmp, "int"); -LIN_SDT_PROBE_DEFINE3(futex, linux_futex, debug_wait, "uint32_t *", - "uint32_t", "uint32_t"); -LIN_SDT_PROBE_DEFINE3(futex, linux_futex, debug_wake, "uint32_t *", - "uint32_t", "uint32_t"); -LIN_SDT_PROBE_DEFINE5(futex, linux_futex, debug_cmp_requeue, "uint32_t *", - "uint32_t", "uint32_t", "uint32_t *", "struct l_timespec *"); -LIN_SDT_PROBE_DEFINE5(futex, linux_futex, debug_wake_op, "uint32_t *", - "int", "uint32_t", "uint32_t *", "uint32_t"); -LIN_SDT_PROBE_DEFINE0(futex, linux_futex, deprecated_requeue); -LIN_SDT_PROBE_DEFINE0(futex, linux_futex, unimplemented_wait_requeue_pi); -LIN_SDT_PROBE_DEFINE0(futex, linux_futex, unimplemented_cmp_requeue_pi); -LIN_SDT_PROBE_DEFINE1(futex, linux_futex, unknown_operation, "int"); -LIN_SDT_PROBE_DEFINE0(futex, linux_set_robust_list, size_error); -LIN_SDT_PROBE_DEFINE1(futex, linux_get_robust_list, copyout_error, "int"); -LIN_SDT_PROBE_DEFINE1(futex, fetch_robust_entry, copyin_error, "int"); -LIN_SDT_PROBE_DEFINE1(futex, release_futexes, copyin_error, "int"); - #define FUTEX_SHARED 0x8 /* shared futex */ #define GET_SHARED(a) (a->flags & FUTEX_SHARED) ? AUTO_SHARE : THREAD_SHARE @@ -188,9 +159,6 @@ futex_atomic_op(struct thread *td, int encoded_op, uint32_t *uaddr) if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28)) oparg = 1 << oparg; - LIN_SDT_PROBE4(futex, futex_atomic_op, decoded_op, op, cmp, oparg, - cmparg); - switch (op) { case FUTEX_OP_SET: ret = futex_xchgl(oparg, uaddr, &oldval); @@ -208,7 +176,6 @@ futex_atomic_op(struct thread *td, int encoded_op, uint32_t *uaddr) ret = futex_xorl(oparg, uaddr, &oldval); break; default: - LIN_SDT_PROBE1(futex, futex_atomic_op, unimplemented_op, op); ret = -ENOSYS; break; } @@ -236,7 +203,6 @@ futex_atomic_op(struct thread *td, int encoded_op, uint32_t *uaddr) ret = (oldval > cmparg); break; default: - LIN_SDT_PROBE1(futex, futex_atomic_op, unimplemented_cmp, cmp); ret = -ENOSYS; } @@ -264,8 +230,6 @@ linux_futex(struct thread *td, struct linux_futex_args *args) /* FALLTHROUGH */ case LINUX_FUTEX_WAIT_BITSET: - LIN_SDT_PROBE3(futex, linux_futex, debug_wait, args->uaddr, - args->val, args->val3); LINUX_CTR3(sys_futex, "WAIT uaddr %p val 0x%x bitset 0x%x", args->uaddr, args->val, args->val3); @@ -276,8 +240,6 @@ linux_futex(struct thread *td, struct linux_futex_args *args) /* FALLTHROUGH */ case LINUX_FUTEX_WAKE_BITSET: - LIN_SDT_PROBE3(futex, linux_futex, debug_wake, args->uaddr, - args->val, args->val3); LINUX_CTR3(sys_futex, "WAKE uaddr %p nrwake 0x%x bitset 0x%x", args->uaddr, args->val, args->val3); @@ -294,8 +256,6 @@ linux_futex(struct thread *td, struct linux_futex_args *args) if ((pem->flags & LINUX_XDEPR_REQUEUEOP) == 0) { linux_msg(td, "unsupported FUTEX_REQUEUE"); pem->flags |= LINUX_XDEPR_REQUEUEOP; - LIN_SDT_PROBE0(futex, linux_futex, - deprecated_requeue); } /* @@ -311,9 +271,6 @@ linux_futex(struct thread *td, struct linux_futex_args *args) /* FALLTHROUGH */ case LINUX_FUTEX_CMP_REQUEUE: - LIN_SDT_PROBE5(futex, linux_futex, debug_cmp_requeue, - args->uaddr, args->val, args->val3, args->uaddr2, - args->ts); LINUX_CTR5(sys_futex, "CMP_REQUEUE uaddr %p " "nrwake 0x%x uval 0x%x uaddr2 %p nrequeue 0x%x", args->uaddr, args->val, args->val3, args->uaddr2, @@ -322,8 +279,6 @@ linux_futex(struct thread *td, struct linux_futex_args *args) return (linux_futex_requeue(td, args)); case LINUX_FUTEX_WAKE_OP: - LIN_SDT_PROBE5(futex, linux_futex, debug_wake_op, - args->uaddr, args->op, args->val, args->uaddr2, args->val3); LINUX_CTR5(sys_futex, "WAKE_OP " "uaddr %p nrwake 0x%x uaddr2 %p op 0x%x nrwake2 0x%x", args->uaddr, args->val, args->uaddr2, args->val3, @@ -356,8 +311,6 @@ linux_futex(struct thread *td, struct linux_futex_args *args) if ((pem->flags & LINUX_XUNSUP_FUTEXPIOP) == 0) { linux_msg(td, "unsupported FUTEX_WAIT_REQUEUE_PI"); pem->flags |= LINUX_XUNSUP_FUTEXPIOP; - LIN_SDT_PROBE0(futex, linux_futex, - unimplemented_wait_requeue_pi); } return (ENOSYS); @@ -367,15 +320,11 @@ linux_futex(struct thread *td, struct linux_futex_args *args) if ((pem->flags & LINUX_XUNSUP_FUTEXPIOP) == 0) { linux_msg(td, "unsupported FUTEX_CMP_REQUEUE_PI"); pem->flags |= LINUX_XUNSUP_FUTEXPIOP; - LIN_SDT_PROBE0(futex, linux_futex, - unimplemented_cmp_requeue_pi); } return (ENOSYS); default: linux_msg(td, "unsupported futex op %d", args->op); - LIN_SDT_PROBE1(futex, linux_futex, unknown_operation, - args->op); return (ENOSYS); } } @@ -930,10 +879,8 @@ linux_set_robust_list(struct thread *td, struct linux_set_robust_list_args *args { struct linux_emuldata *em; - if (args->len != sizeof(struct linux_robust_list_head)) { - LIN_SDT_PROBE0(futex, linux_set_robust_list, size_error); + if (args->len != sizeof(struct linux_robust_list_head)) return (EINVAL); - } em = em_find(td); em->robust_futexes = args->head; @@ -978,19 +925,10 @@ linux_get_robust_list(struct thread *td, struct linux_get_robust_list_args *args } error = copyout(&len, args->len, sizeof(l_size_t)); - if (error) { - LIN_SDT_PROBE1(futex, linux_get_robust_list, copyout_error, - error); + if (error) return (EFAULT); - } - - error = copyout(&head, args->head, sizeof(head)); - if (error) { - LIN_SDT_PROBE1(futex, linux_get_robust_list, copyout_error, - error); - } - return (error); + return (copyout(&head, args->head, sizeof(head))); } static int @@ -1063,10 +1001,8 @@ fetch_robust_entry(struct linux_robust_list **entry, int error; error = copyin((const void *)head, &uentry, sizeof(l_ulong)); - if (error) { - LIN_SDT_PROBE1(futex, fetch_robust_entry, copyin_error, error); + if (error) return (EFAULT); - } *entry = (void *)(uentry & ~1UL); *pi = uentry & 1; @@ -1098,10 +1034,8 @@ release_futexes(struct thread *td, struct linux_emuldata *em) error = copyin(&head->futex_offset, &futex_offset, sizeof(futex_offset)); - if (error) { - LIN_SDT_PROBE1(futex, release_futexes, copyin_error, error); + if (error) return; - } if (fetch_robust_entry(&pending, PTRIN(&head->pending_list), &pip)) return; From owner-dev-commits-src-all@freebsd.org Thu Jul 29 09:58: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 D634767099E; Thu, 29 Jul 2021 09:58: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 4Gb5b30Mcfz3t9y; Thu, 29 Jul 2021 09:58: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 989B47B09; Thu, 29 Jul 2021 09:58: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 16T9wsvd070542; Thu, 29 Jul 2021 09:58:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16T9wsfm070541; Thu, 29 Jul 2021 09:58:54 GMT (envelope-from git) Date: Thu, 29 Jul 2021 09:58:54 GMT Message-Id: <202107290958.16T9wsfm070541@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: f88d3c522f74 - main - linux(4): Eliminate unnecessary error initialization. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f88d3c522f743c0d948048de3c36f9bb9e0ca171 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, 29 Jul 2021 09:58:56 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=f88d3c522f743c0d948048de3c36f9bb9e0ca171 commit f88d3c522f743c0d948048de3c36f9bb9e0ca171 Author: Dmitry Chagin AuthorDate: 2021-07-29 09:53:41 +0000 Commit: Dmitry Chagin CommitDate: 2021-07-29 09:53:41 +0000 linux(4): Eliminate unnecessary error initialization. MFC after: 2 weeks --- sys/compat/linux/linux_futex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/compat/linux/linux_futex.c b/sys/compat/linux/linux_futex.c index 74c0bda9f96d..07623fbfe9e3 100644 --- a/sys/compat/linux/linux_futex.c +++ b/sys/compat/linux/linux_futex.c @@ -895,7 +895,7 @@ linux_get_robust_list(struct thread *td, struct linux_get_robust_list_args *args struct linux_robust_list_head *head; l_size_t len = sizeof(struct linux_robust_list_head); struct thread *td2; - int error = 0; + int error; if (!args->pid) { em = em_find(td); From owner-dev-commits-src-all@freebsd.org Thu Jul 29 09:59: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 623C6670678; Thu, 29 Jul 2021 09:59: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 4Gb5b94pQFz3tD8; Thu, 29 Jul 2021 09:59: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 6CAD8796C; Thu, 29 Jul 2021 09:59: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 16T9x16K070692; Thu, 29 Jul 2021 09:59:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16T9x1Ep070691; Thu, 29 Jul 2021 09:59:01 GMT (envelope-from git) Date: Thu, 29 Jul 2021 09:59:01 GMT Message-Id: <202107290959.16T9x1Ep070691@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: d90df8ac1324 - main - linux(4): Add a comment about wait/requeue pi operations. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d90df8ac1324d731f8423b5501158ee870fbd5ba 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, 29 Jul 2021 09:59:02 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=d90df8ac1324d731f8423b5501158ee870fbd5ba commit d90df8ac1324d731f8423b5501158ee870fbd5ba Author: Dmitry Chagin AuthorDate: 2021-07-29 09:55:59 +0000 Commit: Dmitry Chagin CommitDate: 2021-07-29 09:55:59 +0000 linux(4): Add a comment about wait/requeue pi operations. MFC after: 2 weeks --- sys/compat/linux/linux_futex.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sys/compat/linux/linux_futex.c b/sys/compat/linux/linux_futex.c index 5f18c93b0988..edf059f74272 100644 --- a/sys/compat/linux/linux_futex.c +++ b/sys/compat/linux/linux_futex.c @@ -314,6 +314,18 @@ linux_futex(struct thread *td, struct linux_futex_args *args) return (linux_futex_lock_pi(td, true, args)); + /* + * Current implementation of FUTEX_WAIT_REQUEUE_PI and FUTEX_CMP_REQUEUE_PI + * can't be used anymore to implement conditional variables. + * A detailed explanation can be found here: + * + * https://sourceware.org/bugzilla/show_bug.cgi?id=13165 + * and here http://austingroupbugs.net/view.php?id=609 + * + * And since commit + * https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=ed19993b5b0d05d62cc883571519a67dae481a14 + * glibc does not uses it. + */ case LINUX_FUTEX_WAIT_REQUEUE_PI: /* not yet implemented */ pem = pem_find(td->td_proc); From owner-dev-commits-src-all@freebsd.org Thu Jul 29 09:58: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 6776A67066E; Thu, 29 Jul 2021 09:58: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 4Gb5b61QtQz3t7c; Thu, 29 Jul 2021 09:58: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 0AC86796A; Thu, 29 Jul 2021 09:58: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 16T9wvij070614; Thu, 29 Jul 2021 09:58:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16T9wv5m070613; Thu, 29 Jul 2021 09:58:57 GMT (envelope-from git) Date: Thu, 29 Jul 2021 09:58:57 GMT Message-Id: <202107290958.16T9wv5m070613@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: bd25bf092ae9 - main - linux(4): Use variable name not type for sizeof() to calculate storage size. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bd25bf092ae92f5a46eed51a3152c9af4cb0f7b3 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, 29 Jul 2021 09:58:58 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=bd25bf092ae92f5a46eed51a3152c9af4cb0f7b3 commit bd25bf092ae92f5a46eed51a3152c9af4cb0f7b3 Author: Dmitry Chagin AuthorDate: 2021-07-29 09:54:32 +0000 Commit: Dmitry Chagin CommitDate: 2021-07-29 09:54:32 +0000 linux(4): Use variable name not type for sizeof() to calculate storage size. MFC after: 2 weeks --- sys/compat/linux/linux_futex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/compat/linux/linux_futex.c b/sys/compat/linux/linux_futex.c index 353b76afe8cc..cc3a685fb14e 100644 --- a/sys/compat/linux/linux_futex.c +++ b/sys/compat/linux/linux_futex.c @@ -1001,7 +1001,7 @@ fetch_robust_entry(struct linux_robust_list **entry, l_ulong uentry; int error; - error = copyin((const void *)head, &uentry, sizeof(l_ulong)); + error = copyin((const void *)head, &uentry, sizeof(uentry)); if (error != 0) return (EFAULT); From owner-dev-commits-src-all@freebsd.org Thu Jul 29 12:13: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 4C3AB673162; Thu, 29 Jul 2021 12:13: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 4Gb8Zp1HZ2z4b8Z; Thu, 29 Jul 2021 12:13: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 145CA11AA2; Thu, 29 Jul 2021 12:13: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 16TCDrR2056477; Thu, 29 Jul 2021 12:13:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16TCDr5o056476; Thu, 29 Jul 2021 12:13:53 GMT (envelope-from git) Date: Thu, 29 Jul 2021 12:13:53 GMT Message-Id: <202107291213.16TCDr5o056476@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: f9d3c6f4b5d1 - stable/13 - nfsclient: Avoid copying uninitialized bytes into statfs 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: f9d3c6f4b5d1a2a35b05a52bf598ebfca21d3322 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, 29 Jul 2021 12:13:54 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=f9d3c6f4b5d1a2a35b05a52bf598ebfca21d3322 commit f9d3c6f4b5d1a2a35b05a52bf598ebfca21d3322 Author: Mark Johnston AuthorDate: 2021-07-15 16:18:17 +0000 Commit: Mark Johnston CommitDate: 2021-07-29 12:11:16 +0000 nfsclient: Avoid copying uninitialized bytes into statfs hst will be nul-terminated but the remaining space in the buffer is left uninitialized. Avoid copying the entire buffer to ensure that uninitialized bytes are not leaked via statfs(2). Reported by: KMSAN Reviewed by: rmacklem Sponsored by: The FreeBSD Foundation (cherry picked from commit 44de1834b53f4654cc2f6d76406f5705f8167927) --- sys/fs/nfsclient/nfs_clvfsops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/fs/nfsclient/nfs_clvfsops.c b/sys/fs/nfsclient/nfs_clvfsops.c index 974bc684bf5b..2fe30035b904 100644 --- a/sys/fs/nfsclient/nfs_clvfsops.c +++ b/sys/fs/nfsclient/nfs_clvfsops.c @@ -1562,7 +1562,7 @@ mountnfs(struct nfs_args *argp, struct mount *mp, struct sockaddr *nam, nmp->nm_fhsize = argp->fhsize; if (nmp->nm_fhsize > 0) bcopy((caddr_t)argp->fh, (caddr_t)nmp->nm_fh, argp->fhsize); - bcopy(hst, mp->mnt_stat.f_mntfromname, MNAMELEN); + strlcpy(mp->mnt_stat.f_mntfromname, hst, MNAMELEN); nmp->nm_nam = nam; /* Set up the sockets and per-host congestion */ nmp->nm_sotype = argp->sotype; From owner-dev-commits-src-all@freebsd.org Thu Jul 29 12: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 617DC672C7A; Thu, 29 Jul 2021 12: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 4Gb8Zq258Dz4b15; Thu, 29 Jul 2021 12: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 279EB11668; Thu, 29 Jul 2021 12: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 16TCDtOo056503; Thu, 29 Jul 2021 12: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 16TCDtiv056502; Thu, 29 Jul 2021 12:13:55 GMT (envelope-from git) Date: Thu, 29 Jul 2021 12:13:55 GMT Message-Id: <202107291213.16TCDtiv056502@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: c2edab507e92 - stable/13 - man9: Remove stray .In macros 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: c2edab507e9227e30722b6c0b894c3eab864ff03 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, 29 Jul 2021 12:13:55 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=c2edab507e9227e30722b6c0b894c3eab864ff03 commit c2edab507e9227e30722b6c0b894c3eab864ff03 Author: Mark Johnston AuthorDate: 2021-07-22 16:47:43 +0000 Commit: Mark Johnston CommitDate: 2021-07-29 12:11:30 +0000 man9: Remove stray .In macros Fixes: 9c11d8d483c4 (cherry picked from commit 18c696c00159d1071ed17e3bed1863e412dd5cb5) --- share/man/man9/fetch.9 | 1 - share/man/man9/store.9 | 1 - 2 files changed, 2 deletions(-) diff --git a/share/man/man9/fetch.9 b/share/man/man9/fetch.9 index 5384c4f9204e..53927eb82584 100644 --- a/share/man/man9/fetch.9 +++ b/share/man/man9/fetch.9 @@ -67,7 +67,6 @@ .Fn fueword32 "volatile const void *base" "int32_t *val" .Ft int .Fn fueword64 "volatile const void *base" "int64_t *val" -.In sys/resourcevar.h .Sh DESCRIPTION The .Nm diff --git a/share/man/man9/store.9 b/share/man/man9/store.9 index 40a6d7e2b216..089949e53938 100644 --- a/share/man/man9/store.9 +++ b/share/man/man9/store.9 @@ -56,7 +56,6 @@ .Fn suword32 "volatile void *base" "int32_t word" .Ft int .Fn suword64 "volatile void *base" "int64_t word" -.In sys/resourcevar.h .Sh DESCRIPTION The .Nm From owner-dev-commits-src-all@freebsd.org Thu Jul 29 12:13: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 E0CBB6731A2; Thu, 29 Jul 2021 12:13: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 4Gb8Zs3zjzz4b8n; Thu, 29 Jul 2021 12:13: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 635B011937; Thu, 29 Jul 2021 12:13: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 16TCDvQn056556; Thu, 29 Jul 2021 12:13:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16TCDvfH056555; Thu, 29 Jul 2021 12:13:57 GMT (envelope-from git) Date: Thu, 29 Jul 2021 12:13:57 GMT Message-Id: <202107291213.16TCDvfH056555@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: 50b26566c7f4 - stable/13 - mmc: Drain the intrhook in mmc_detach() 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: 50b26566c7f4b605d5db4464e259d7db9626dd86 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, 29 Jul 2021 12:13:58 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=50b26566c7f4b605d5db4464e259d7db9626dd86 commit 50b26566c7f4b605d5db4464e259d7db9626dd86 Author: Yang Zhong AuthorDate: 2021-07-22 17:16:01 +0000 Commit: Mark Johnston CommitDate: 2021-07-29 12:11:50 +0000 mmc: Drain the intrhook in mmc_detach() Buggy SD card drivers may attach and detach a mmc(4) driver instance in quick succession. In this case mmc(4) must disestablish its intrhook callback during detach. Thus, this change adds a call to config_intrhook_drain(), which blocks or does nothing if the intrhook is running or has already ran (the SD card was plugged in), and disestablishes the hook if it hasn't ran yet (the SD card was not plugged in). PR: 254373 Reviewed by: imp, manu, markj Sponsored by: The FreeBSD Foundation (cherry picked from commit d5341d72a11be200e536ac7d8967449a3f521792) --- sys/dev/mmc/mmc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/dev/mmc/mmc.c b/sys/dev/mmc/mmc.c index ddbc2669b1f7..47df562e73fd 100644 --- a/sys/dev/mmc/mmc.c +++ b/sys/dev/mmc/mmc.c @@ -271,6 +271,7 @@ mmc_detach(device_t dev) struct mmc_softc *sc = device_get_softc(dev); int err; + config_intrhook_drain(&sc->config_intrhook); err = mmc_delete_cards(sc, true); if (err != 0) return (err); From owner-dev-commits-src-all@freebsd.org Thu Jul 29 12:13: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 79004673501; Thu, 29 Jul 2021 12:13: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 4Gb8Zr2YVjz4bM8; Thu, 29 Jul 2021 12:13: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 401E411936; Thu, 29 Jul 2021 12:13: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 16TCDuRG056532; Thu, 29 Jul 2021 12:13:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16TCDuI1056531; Thu, 29 Jul 2021 12:13:56 GMT (envelope-from git) Date: Thu, 29 Jul 2021 12:13:56 GMT Message-Id: <202107291213.16TCDuI1056531@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: 3afad070bddd - stable/13 - man9: Update guarantees for userspace fetch/store operations 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: 3afad070bdddb4718ccc8f2911551818f08a0840 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, 29 Jul 2021 12:13:56 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=3afad070bdddb4718ccc8f2911551818f08a0840 commit 3afad070bdddb4718ccc8f2911551818f08a0840 Author: Mark Johnston AuthorDate: 2021-07-22 17:08:42 +0000 Commit: Mark Johnston CommitDate: 2021-07-29 12:11:39 +0000 man9: Update guarantees for userspace fetch/store operations Platforms may either silently handle unaligned accesses or return an error. Atomicity is not guaranteed in this case, however. Reviewed by: kib Sponsored by: The FreeBSD Foundation (cherry picked from commit fd5827b1785a9363abe601cbd9d8558b0fc8d3e8) --- share/man/man9/fetch.9 | 8 +++++--- share/man/man9/store.9 | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/share/man/man9/fetch.9 b/share/man/man9/fetch.9 index 53927eb82584..16acb542c625 100644 --- a/share/man/man9/fetch.9 +++ b/share/man/man9/fetch.9 @@ -34,7 +34,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 23, 2020 +.Dd July 22, 2021 .Dt FETCH 9 .Os .Sh NAME @@ -72,8 +72,10 @@ The .Nm functions are designed to copy small amounts of data from user-space of the current process. -If read is successful, it is performed atomically. -The data read must be naturally aligned. +If the user address is naturally aligned, then the operation will be +performed atomically. +Otherwise it may fail or be performed non-atomically, depending on +the platform. .Pp The .Nm diff --git a/share/man/man9/store.9 b/share/man/man9/store.9 index 089949e53938..6492fdbc3924 100644 --- a/share/man/man9/store.9 +++ b/share/man/man9/store.9 @@ -34,7 +34,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 17, 2018 +.Dd July 22, 2021 .Dt STORE 9 .Os .Sh NAME @@ -60,8 +60,10 @@ The .Nm functions are designed to copy small amounts of data to user-space. -If write is successful, it is performed atomically. -The data written must be naturally aligned. +If the user address is naturally aligned, then the operation will be +performed atomically. +Otherwise it may fail or be performed non-atomically, depending on +the platform. .Pp The .Nm From owner-dev-commits-src-all@freebsd.org Thu Jul 29 12:14: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 68968672F6E; Thu, 29 Jul 2021 12:14: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 4Gb8Zx0RmWz4b36; Thu, 29 Jul 2021 12:14: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 D30B111669; Thu, 29 Jul 2021 12:14: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 16TCE0bL056628; Thu, 29 Jul 2021 12:14:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16TCE0As056627; Thu, 29 Jul 2021 12:14:00 GMT (envelope-from git) Date: Thu, 29 Jul 2021 12:14:00 GMT Message-Id: <202107291214.16TCE0As056627@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: 90ffac35b778 - stable/13 - eli: Zero pad bytes that arise when certain auth algorithms are used 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: 90ffac35b778564d1b4cb8ec7d2ff92ccc8e56dd 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, 29 Jul 2021 12:14:01 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=90ffac35b778564d1b4cb8ec7d2ff92ccc8e56dd commit 90ffac35b778564d1b4cb8ec7d2ff92ccc8e56dd Author: Mark Johnston AuthorDate: 2021-07-15 16:23:04 +0000 Commit: Mark Johnston CommitDate: 2021-07-29 12:12:22 +0000 eli: Zero pad bytes that arise when certain auth algorithms are used When authentication is configured, GELI ensures that the amount of data per sector is a multiple of 16 bytes. This is done in eli_metadata_softc(). When the digest size is not a multiple of 16 bytes, this leaves some extra pad bytes at the end of every sector, and they were not being zeroed before being written to disk. In particular, this happens with the HMAC/SHA1, HMAC/RIPEMD160 and HMAC/SHA384 data authentication algorithms. This change ensures that they are zeroed before being written to disk. Reported by: KMSAN Reviewed by: delphij, asomers Sponsored by: The FreeBSD Foundation (cherry picked from commit 0fcafe8516d170852aa73f029a6a28bed1e29292) --- sys/geom/eli/g_eli_integrity.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sys/geom/eli/g_eli_integrity.c b/sys/geom/eli/g_eli_integrity.c index 4cf982e3ddfa..d9ac0a2a3d72 100644 --- a/sys/geom/eli/g_eli_integrity.c +++ b/sys/geom/eli/g_eli_integrity.c @@ -510,6 +510,17 @@ g_eli_auth_run(struct g_eli_worker *wr, struct bio *bp) if (bp->bio_cmd == BIO_WRITE) memset(data + sc->sc_alen + data_secsize, 0, encr_secsize - sc->sc_alen - data_secsize); + } else if (data_secsize + sc->sc_alen != encr_secsize) { + /* + * If the HMAC size is not a multiple of 128 bits, the + * per-sector data size is rounded down to ensure that + * encryption can be performed without requiring any + * padding. In this case, each sector contains unused + * bytes. + */ + if (bp->bio_cmd == BIO_WRITE) + memset(data + sc->sc_alen + data_secsize, 0, + encr_secsize - sc->sc_alen - data_secsize); } if (bp->bio_cmd == BIO_WRITE) { From owner-dev-commits-src-all@freebsd.org Thu Jul 29 12:13: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 CF457673589; Thu, 29 Jul 2021 12:13: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 4Gb8Zt4dysz4b30; Thu, 29 Jul 2021 12:13: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 8628211829; Thu, 29 Jul 2021 12:13: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 16TCDwX7056580; Thu, 29 Jul 2021 12:13:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16TCDw9c056579; Thu, 29 Jul 2021 12:13:58 GMT (envelope-from git) Date: Thu, 29 Jul 2021 12:13:58 GMT Message-Id: <202107291213.16TCDw9c056579@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: 9f43633dd055 - stable/13 - pf: Constify tag name and queue name helper functions 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: 9f43633dd055ba4c99f27d1e64b7b95b462226c2 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, 29 Jul 2021 12:13:59 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=9f43633dd055ba4c99f27d1e64b7b95b462226c2 commit 9f43633dd055ba4c99f27d1e64b7b95b462226c2 Author: Mark Johnston AuthorDate: 2021-07-15 16:17:58 +0000 Commit: Mark Johnston CommitDate: 2021-07-29 12:12:01 +0000 pf: Constify tag name and queue name helper functions No functional change intended. Reviewed by: kp Sponsored by: The FreeBSD Foundation (cherry picked from commit 81f95106b8c14d7ce935864b4705d54a8e437ed6) --- sys/netpfil/pf/pf_ioctl.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 6af5197ef07d..01601db07ea0 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -100,8 +100,8 @@ SDT_PROBE_DEFINE3(pf, ioctl, function, error, "char *", "int", "int"); SDT_PROBE_DEFINE2(pf, ioctl, addrule, error, "int", "int"); SDT_PROBE_DEFINE2(pf, ioctl, nvchk, error, "int", "int"); -static struct pf_kpool *pf_get_kpool(char *, u_int32_t, u_int8_t, u_int32_t, - u_int8_t, u_int8_t, u_int8_t); +static struct pf_kpool *pf_get_kpool(const char *, u_int32_t, u_int8_t, + u_int32_t, u_int8_t, u_int8_t, u_int8_t); static void pf_mv_kpool(struct pf_kpalist *, struct pf_kpalist *); static void pf_empty_kpool(struct pf_kpalist *); @@ -113,7 +113,7 @@ static int pf_rollback_altq(u_int32_t); static int pf_commit_altq(u_int32_t); static int pf_enable_altq(struct pf_altq *); static int pf_disable_altq(struct pf_altq *); -static u_int32_t pf_qname2qid(char *); +static u_int32_t pf_qname2qid(const char *); static void pf_qid_unref(u_int32_t); #endif /* ALTQ */ static int pf_begin_rules(u_int32_t *, int, const char *); @@ -189,8 +189,8 @@ static void pf_init_tagset(struct pf_tagset *, unsigned int *, static void pf_cleanup_tagset(struct pf_tagset *); static uint16_t tagname2hashindex(const struct pf_tagset *, const char *); static uint16_t tag2hashindex(const struct pf_tagset *, uint16_t); -static u_int16_t tagname2tag(struct pf_tagset *, char *); -static u_int16_t pf_tagname2tag(char *); +static u_int16_t tagname2tag(struct pf_tagset *, const char *); +static u_int16_t pf_tagname2tag(const char *); static void tag_unref(struct pf_tagset *, u_int16_t); #define DPFPRINTF(n, x) if (V_pf_status.debug >= (n)) printf x @@ -366,7 +366,7 @@ pfattach_vnet(void) } static struct pf_kpool * -pf_get_kpool(char *anchor, u_int32_t ticket, u_int8_t rule_action, +pf_get_kpool(const char *anchor, u_int32_t ticket, u_int8_t rule_action, u_int32_t rule_number, u_int8_t r_last, u_int8_t active, u_int8_t check_ticket) { @@ -559,7 +559,7 @@ tag2hashindex(const struct pf_tagset *ts, uint16_t tag) } static u_int16_t -tagname2tag(struct pf_tagset *ts, char *tagname) +tagname2tag(struct pf_tagset *ts, const char *tagname) { struct pf_tagname *tag; u_int32_t index; @@ -638,14 +638,14 @@ tag_unref(struct pf_tagset *ts, u_int16_t tag) } static u_int16_t -pf_tagname2tag(char *tagname) +pf_tagname2tag(const char *tagname) { return (tagname2tag(&V_pf_tags, tagname)); } #ifdef ALTQ static u_int32_t -pf_qname2qid(char *qname) +pf_qname2qid(const char *qname) { return ((u_int32_t)tagname2tag(&V_pf_qids, qname)); } From owner-dev-commits-src-all@freebsd.org Thu Jul 29 12:14: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 10067673164; Thu, 29 Jul 2021 12:14: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 4Gb8Zv67NQz4bFm; Thu, 29 Jul 2021 12:13: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 B2A20117C1; Thu, 29 Jul 2021 12:13: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 16TCDxdM056604; Thu, 29 Jul 2021 12:13:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16TCDx7d056603; Thu, 29 Jul 2021 12:13:59 GMT (envelope-from git) Date: Thu, 29 Jul 2021 12:13:59 GMT Message-Id: <202107291213.16TCDx7d056603@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: 822c62b7db64 - stable/13 - Assert that valid PTEs are not overwritten when installing a new PTP 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: 822c62b7db64bd2a2326e460faf68b5442e4c52c 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, 29 Jul 2021 12:14:00 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=822c62b7db64bd2a2326e460faf68b5442e4c52c commit 822c62b7db64bd2a2326e460faf68b5442e4c52c Author: Mark Johnston AuthorDate: 2021-07-15 16:17:33 +0000 Commit: Mark Johnston CommitDate: 2021-07-29 12:12:12 +0000 Assert that valid PTEs are not overwritten when installing a new PTP amd64 and 32-bit ARM already had assertions to this effect. Add them to other pmaps. Reviewed by: alc, kib Sponsored by: The FreeBSD Foundation (cherry picked from commit b092c58c006fd5c5c051b30ab097f5c1655e0d53) --- sys/arm64/arm64/pmap.c | 6 ++++++ sys/i386/i386/pmap.c | 5 ++++- sys/mips/mips/pmap.c | 4 ++++ sys/powerpc/aim/mmu_radix.c | 8 ++++++-- sys/riscv/riscv/pmap.c | 4 ++++ 5 files changed, 24 insertions(+), 3 deletions(-) diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c index e9dd27981d61..e57a4033c3a3 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -1870,6 +1870,8 @@ _pmap_alloc_l3(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp) l0index = ptepindex - (NUL2E + NUL1E); l0 = &pmap->pm_l0[l0index]; + KASSERT((pmap_load(l0) & ATTR_DESCR_VALID) == 0, + ("%s: L0 entry %#lx is valid", __func__, pmap_load(l0))); pmap_store(l0, VM_PAGE_TO_PHYS(m) | L0_TABLE); } else if (ptepindex >= NUL2E) { vm_pindex_t l0index, l1index; @@ -1896,6 +1898,8 @@ _pmap_alloc_l3(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp) l1 = (pd_entry_t *)PHYS_TO_DMAP(pmap_load(l0) & ~ATTR_MASK); l1 = &l1[ptepindex & Ln_ADDR_MASK]; + KASSERT((pmap_load(l1) & ATTR_DESCR_VALID) == 0, + ("%s: L1 entry %#lx is valid", __func__, pmap_load(l1))); pmap_store(l1, VM_PAGE_TO_PHYS(m) | L1_TABLE); } else { vm_pindex_t l0index, l1index; @@ -1938,6 +1942,8 @@ _pmap_alloc_l3(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp) l2 = (pd_entry_t *)PHYS_TO_DMAP(pmap_load(l1) & ~ATTR_MASK); l2 = &l2[ptepindex & Ln_ADDR_MASK]; + KASSERT((pmap_load(l2) & ATTR_DESCR_VALID) == 0, + ("%s: L2 entry %#lx is valid", __func__, pmap_load(l2))); pmap_store(l2, VM_PAGE_TO_PHYS(m) | L2_TABLE); } diff --git a/sys/i386/i386/pmap.c b/sys/i386/i386/pmap.c index bc650cf378e0..b39f1c6f0a55 100644 --- a/sys/i386/i386/pmap.c +++ b/sys/i386/i386/pmap.c @@ -2157,8 +2157,11 @@ _pmap_allocpte(pmap_t pmap, u_int ptepindex, u_int flags) pmap->pm_stats.resident_count++; ptepa = VM_PAGE_TO_PHYS(m); + KASSERT((pmap->pm_pdir[ptepindex] & PG_V) == 0, + ("%s: page directory entry %#jx is valid", + __func__, (uintmax_t)pmap->pm_pdir[ptepindex])); pmap->pm_pdir[ptepindex] = - (pd_entry_t) (ptepa | PG_U | PG_RW | PG_V | PG_A | PG_M); + (pd_entry_t)(ptepa | PG_U | PG_RW | PG_V | PG_A | PG_M); return (m); } diff --git a/sys/mips/mips/pmap.c b/sys/mips/mips/pmap.c index 866013cbf38a..8b0eb1a3ce0b 100644 --- a/sys/mips/mips/pmap.c +++ b/sys/mips/mips/pmap.c @@ -1217,9 +1217,13 @@ _pmap_allocpte(pmap_t pmap, unsigned ptepindex, u_int flags) } /* Next level entry */ pde = (pd_entry_t *)*pdep; + KASSERT(pde[pdeindex] == 0, + ("%s: PTE %p is valid", __func__, pde[pdeindex])); pde[pdeindex] = (pd_entry_t)pageva; } #else + KASSERT(pmap->pm_segtab[ptepindex] == 0, + ("%s: PTE %p is valid", __func__, pmap->pm_segtab[ptepindex])); pmap->pm_segtab[ptepindex] = (pd_entry_t)pageva; #endif pmap->pm_stats.resident_count++; diff --git a/sys/powerpc/aim/mmu_radix.c b/sys/powerpc/aim/mmu_radix.c index 0f5aa2ec151e..b9ca10448f9f 100644 --- a/sys/powerpc/aim/mmu_radix.c +++ b/sys/powerpc/aim/mmu_radix.c @@ -4246,8 +4246,9 @@ _pmap_allocpte(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp) /* Wire up a new PDPE page */ pml1index = ptepindex - (NUPDE + NUPDPE); l1e = &pmap->pm_pml1[pml1index]; + KASSERT((be64toh(*l1e) & PG_V) == 0, + ("%s: L1 entry %#lx is valid", __func__, *l1e)); pde_store(l1e, VM_PAGE_TO_PHYS(m)); - } else if (ptepindex >= NUPDE) { vm_pindex_t pml1index; vm_pindex_t pdpindex; @@ -4276,8 +4277,9 @@ _pmap_allocpte(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp) /* Now find the pdp page */ l2e = &l2e[pdpindex & RPTE_MASK]; + KASSERT((be64toh(*l2e) & PG_V) == 0, + ("%s: L2 entry %#lx is valid", __func__, *l2e)); pde_store(l2e, VM_PAGE_TO_PHYS(m)); - } else { vm_pindex_t pml1index; vm_pindex_t pdpindex; @@ -4322,6 +4324,8 @@ _pmap_allocpte(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp) /* Now we know where the page directory page is */ l3e = &l3e[ptepindex & RPTE_MASK]; + KASSERT((be64toh(*l3e) & PG_V) == 0, + ("%s: L3 entry %#lx is valid", __func__, *l3e)); pde_store(l3e, VM_PAGE_TO_PHYS(m)); } diff --git a/sys/riscv/riscv/pmap.c b/sys/riscv/riscv/pmap.c index 9761d97f449a..9fd66f093d5e 100644 --- a/sys/riscv/riscv/pmap.c +++ b/sys/riscv/riscv/pmap.c @@ -1285,6 +1285,8 @@ _pmap_alloc_l3(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp) l1index = ptepindex - NUL1E; l1 = &pmap->pm_l1[l1index]; + KASSERT((pmap_load(l1) & PTE_V) == 0, + ("%s: L1 entry %#lx is valid", __func__, pmap_load(l1))); pn = (VM_PAGE_TO_PHYS(m) / PAGE_SIZE); entry = (PTE_V); @@ -1314,6 +1316,8 @@ _pmap_alloc_l3(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp) phys = PTE_TO_PHYS(pmap_load(l1)); l2 = (pd_entry_t *)PHYS_TO_DMAP(phys); l2 = &l2[ptepindex & Ln_ADDR_MASK]; + KASSERT((pmap_load(l2) & PTE_V) == 0, + ("%s: L2 entry %#lx is valid", __func__, pmap_load(l2))); pn = (VM_PAGE_TO_PHYS(m) / PAGE_SIZE); entry = (PTE_V); From owner-dev-commits-src-all@freebsd.org Thu Jul 29 13:35: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 6758E6742BE; Thu, 29 Jul 2021 13:35: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 4GbBNP285fz4gLG; Thu, 29 Jul 2021 13:35: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 2DF371245D; Thu, 29 Jul 2021 13:35: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 16TDZ1ta063268; Thu, 29 Jul 2021 13:35:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16TDZ1M0063267; Thu, 29 Jul 2021 13:35:01 GMT (envelope-from git) Date: Thu, 29 Jul 2021 13:35:01 GMT Message-Id: <202107291335.16TDZ1M0063267@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 98bfb9dac285 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 98bfb9dac28585fb5629c5fc951ce0d83490d446 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, 29 Jul 2021 13:35:01 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=98bfb9dac28585fb5629c5fc951ce0d83490d446 commit 98bfb9dac28585fb5629c5fc951ce0d83490d446 Author: Mark Johnston AuthorDate: 2021-07-29 13:14:50 +0000 Commit: Mark Johnston CommitDate: 2021-07-29 13:14:50 +0000 libc/locale: Use O_CLOEXEC when opening locale tables Reviewed by: kib MFC after: 1 week Sponsored by: The FreeBSD Foundation --- 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 Jul 29 14:49: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 EE4B8675472; Thu, 29 Jul 2021 14:49: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 4GbD1z6JFQz4mcs; Thu, 29 Jul 2021 14:49: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 BCA9013659; Thu, 29 Jul 2021 14:49: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 16TEnB1j055929; Thu, 29 Jul 2021 14:49:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16TEnBYC055928; Thu, 29 Jul 2021 14:49:11 GMT (envelope-from git) Date: Thu, 29 Jul 2021 14:49:11 GMT Message-Id: <202107291449.16TEnBYC055928@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 9e575fadf491 - main - link_elf_obj: Invoke fini callbacks MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9e575fadf491152fb3445d4837d49a9cb87dd6e2 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, 29 Jul 2021 14:49:12 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=9e575fadf491152fb3445d4837d49a9cb87dd6e2 commit 9e575fadf491152fb3445d4837d49a9cb87dd6e2 Author: Mark Johnston AuthorDate: 2021-07-29 13:46:25 +0000 Commit: Mark Johnston CommitDate: 2021-07-29 13:46:25 +0000 link_elf_obj: Invoke fini callbacks This is required for KASAN: when a module is unloaded, poisoned regions (e.g., pad areas between global variables) are left as such, so if they are reused as KLDs are loaded, false positives can arise. Reported by: pho, Jenkins Reviewed by: kib MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31339 --- sys/kern/kern_linker.c | 2 ++ sys/kern/link_elf_obj.c | 32 +++++++++++++++++++++++++++++--- sys/sys/linker.h | 6 ++++-- 3 files changed, 35 insertions(+), 5 deletions(-) diff --git a/sys/kern/kern_linker.c b/sys/kern/kern_linker.c index bb17c020e98a..c0005f2f5cf6 100644 --- a/sys/kern/kern_linker.c +++ b/sys/kern/kern_linker.c @@ -613,6 +613,8 @@ linker_make_file(const char *pathname, linker_class_t lc) return (NULL); lf->ctors_addr = 0; lf->ctors_size = 0; + lf->dtors_addr = 0; + lf->dtors_size = 0; lf->refs = 1; lf->userrefs = 0; lf->flags = 0; diff --git a/sys/kern/link_elf_obj.c b/sys/kern/link_elf_obj.c index 65b997b513e3..91852939e5e8 100644 --- a/sys/kern/link_elf_obj.c +++ b/sys/kern/link_elf_obj.c @@ -544,6 +544,17 @@ link_elf_link_preload(linker_class_t cls, const char *filename, lf->ctors_addr = ef->progtab[pb].addr; lf->ctors_size = shdr[i].sh_size; } + } else if ((ef->progtab[pb].name != NULL && + strcmp(ef->progtab[pb].name, ".dtors") == 0) || + shdr[i].sh_type == SHT_FINI_ARRAY) { + if (lf->dtors_addr != 0) { + printf( + "%s: multiple dtor sections in %s\n", + __func__, filename); + } else { + lf->dtors_addr = ef->progtab[pb].addr; + lf->dtors_size = shdr[i].sh_size; + } } /* Update all symbol values with the offset. */ @@ -612,7 +623,7 @@ out: } static void -link_elf_invoke_ctors(caddr_t addr, size_t size) +link_elf_invoke_cbs(caddr_t addr, size_t size) { void (**ctor)(void); size_t i, cnt; @@ -653,7 +664,7 @@ link_elf_link_preload_finish(linker_file_t lf) /* Apply protections now that relocation processing is complete. */ link_elf_protect(ef); - link_elf_invoke_ctors(lf->ctors_addr, lf->ctors_size); + link_elf_invoke_cbs(lf->ctors_addr, lf->ctors_size); return (0); } @@ -1012,6 +1023,19 @@ link_elf_load_file(linker_class_t cls, const char *filename, lf->ctors_size = shdr[i].sh_size; } + } else if (!strcmp(ef->progtab[pb].name, + ".dtors") || + shdr[i].sh_type == SHT_FINI_ARRAY) { + if (lf->dtors_addr != 0) { + printf( + "%s: multiple dtor sections in %s\n", + __func__, filename); + } else { + lf->dtors_addr = + (caddr_t)mapbase; + lf->dtors_size = + shdr[i].sh_size; + } } } else if (shdr[i].sh_type == SHT_PROGBITS) ef->progtab[pb].name = "<>"; @@ -1196,7 +1220,7 @@ link_elf_load_file(linker_class_t cls, const char *filename, #endif link_elf_protect(ef); - link_elf_invoke_ctors(lf->ctors_addr, lf->ctors_size); + link_elf_invoke_cbs(lf->ctors_addr, lf->ctors_size); *result = lf; out: @@ -1216,6 +1240,8 @@ link_elf_unload_file(linker_file_t file) elf_file_t ef = (elf_file_t) file; u_int i; + link_elf_invoke_cbs(file->dtors_addr, file->dtors_size); + /* Notify MD code that a module is being unloaded. */ elf_cpu_unload_file(file); diff --git a/sys/sys/linker.h b/sys/sys/linker.h index a3d5eb0e72cf..2d65630cd66b 100644 --- a/sys/sys/linker.h +++ b/sys/sys/linker.h @@ -82,8 +82,10 @@ struct linker_file { int id; /* unique id */ caddr_t address; /* load address */ size_t size; /* size of file */ - caddr_t ctors_addr; /* address of .ctors */ - size_t ctors_size; /* size of .ctors */ + caddr_t ctors_addr; /* address of .ctors/.init_array */ + size_t ctors_size; /* size of .ctors/.init_array */ + caddr_t dtors_addr; /* address of .dtors/.fini_array */ + size_t dtors_size; /* size of .dtors/.fini_array */ int ndeps; /* number of dependencies */ linker_file_t* deps; /* list of dependencies */ STAILQ_HEAD(, common_symbol) common; /* list of common symbols */ From owner-dev-commits-src-all@freebsd.org Thu Jul 29 14:49: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 0EABD6753AB; Thu, 29 Jul 2021 14:49: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 4GbD206vJtz4mPP; Thu, 29 Jul 2021 14:49: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 D5E1F1365A; Thu, 29 Jul 2021 14:49: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 16TEnCdO055953; Thu, 29 Jul 2021 14:49:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16TEnCMw055952; Thu, 29 Jul 2021 14:49:12 GMT (envelope-from git) Date: Thu, 29 Jul 2021 14:49:12 GMT Message-Id: <202107291449.16TEnCMw055952@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: e15374508381 - main - amd64: Set MSR_KGSBASE to 0 during AP startup MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e1537450838134daaf584d1f17e661673b2c4c76 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, 29 Jul 2021 14:49:13 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=e1537450838134daaf584d1f17e661673b2c4c76 commit e1537450838134daaf584d1f17e661673b2c4c76 Author: Mark Johnston AuthorDate: 2021-07-29 14:14:05 +0000 Commit: Mark Johnston CommitDate: 2021-07-29 14:14:05 +0000 amd64: Set MSR_KGSBASE to 0 during AP startup There is no reason to initialize it to anything else, and this matches initialization of the BSP. No functional change intended. Reviewed by: kib MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31336 --- sys/amd64/amd64/mp_machdep.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/amd64/amd64/mp_machdep.c b/sys/amd64/amd64/mp_machdep.c index df0270c543e6..86a5d78c8a8e 100644 --- a/sys/amd64/amd64/mp_machdep.c +++ b/sys/amd64/amd64/mp_machdep.c @@ -262,8 +262,8 @@ init_secondary(void) lgdt(&ap_gdt); /* does magic intra-segment return */ wrmsr(MSR_FSBASE, 0); /* User value */ - wrmsr(MSR_GSBASE, (u_int64_t)pc); - wrmsr(MSR_KGSBASE, (u_int64_t)pc); /* XXX User value while we're in the kernel */ + wrmsr(MSR_GSBASE, (uint64_t)pc); + wrmsr(MSR_KGSBASE, 0); /* User value */ fix_cpuid(); lidt(&r_idt); From owner-dev-commits-src-all@freebsd.org Thu Jul 29 14:49: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 98622675477; Thu, 29 Jul 2021 14:49: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 4GbD220zclz4md3; Thu, 29 Jul 2021 14:49: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 EFDA313C2F; Thu, 29 Jul 2021 14:49: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 16TEnDN3055977; Thu, 29 Jul 2021 14:49:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16TEnD5U055976; Thu, 29 Jul 2021 14:49:13 GMT (envelope-from git) Date: Thu, 29 Jul 2021 14:49:13 GMT Message-Id: <202107291449.16TEnD5U055976@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 4b136ef259ce - main - amd64: Set GS.base before calling init_secondary() on APs MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4b136ef259cefedc9b6404afc09138aeb8acbd91 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, 29 Jul 2021 14:49:14 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=4b136ef259cefedc9b6404afc09138aeb8acbd91 commit 4b136ef259cefedc9b6404afc09138aeb8acbd91 Author: Mark Johnston AuthorDate: 2021-07-29 14:22:37 +0000 Commit: Mark Johnston CommitDate: 2021-07-29 14:22:37 +0000 amd64: Set GS.base before calling init_secondary() on APs KMSAN instrumentation requires thread-local storage to track initialization state for function parameters and return values. This buffer is accessed as part of each function prologue. It is provided by the KMSAN runtime, which looks up a pointer in the current thread's structure. When KMSAN is configured, init_secondary() is instrumented, but this means that GS.base must be initialized first, otherwise the runtime cannot safely access curthread. Work around this by loading GS.base before calling init_secondary(), so that the runtime can at least check curthread == NULL and return a pointer to some dummy storage. Note that init_secondary() still must reload GS.base after calling lgdt(), which loads a selector into %gs, which in turn clears the base register. Reviewed by: kib MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31336 --- sys/amd64/amd64/mp_machdep.c | 8 ++++---- sys/amd64/amd64/mpboot.S | 17 +++++++++++++++++ 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/sys/amd64/amd64/mp_machdep.c b/sys/amd64/amd64/mp_machdep.c index 86a5d78c8a8e..343589ae4c6a 100644 --- a/sys/amd64/amd64/mp_machdep.c +++ b/sys/amd64/amd64/mp_machdep.c @@ -103,6 +103,7 @@ static char *doublefault_stack; static char *mce_stack; static char *nmi_stack; static char *dbg_stack; +void *bootpcpu; extern u_int mptramp_la57; extern u_int mptramp_nx; @@ -197,10 +198,8 @@ init_secondary(void) /* Update microcode before doing anything else. */ ucode_load_ap(cpu); - /* Get per-cpu data and save */ - pc = &__pcpu[cpu]; - - /* prime data page for it to use */ + /* Initialize the PCPU area. */ + pc = bootpcpu; pcpu_init(pc, cpu, sizeof(struct pcpu)); dpcpu_init(dpcpu, cpu); pc->pc_apic_id = cpu_apic_ids[cpu]; @@ -431,6 +430,7 @@ start_all_aps(void) dpcpu = (void *)kmem_malloc_domainset(DOMAINSET_PREF(domain), DPCPU_SIZE, M_WAITOK | M_ZERO); + bootpcpu = &__pcpu[cpu]; bootSTK = (char *)bootstacks[cpu] + kstack_pages * PAGE_SIZE - 8; bootAP = cpu; diff --git a/sys/amd64/amd64/mpboot.S b/sys/amd64/amd64/mpboot.S index b6c599a2aff3..1b5657d3bef8 100644 --- a/sys/amd64/amd64/mpboot.S +++ b/sys/amd64/amd64/mpboot.S @@ -260,4 +260,21 @@ bootMP_size: .p2align 4,0 entry_64: movq bootSTK, %rsp + + /* + * Initialize the segment register used for the PCPU area. The PCPU + * area will be initialized by init_secondary(), but it should be + * accessible before that to support sanitizer instrumentation which + * accesses per-CPU variables. + * + * Note that GS.base is loaded again in init_secondary(). This is not + * redundant: lgdt() loads a selector into %gs and this has the side + * effect of clearing GS.base. + */ + movl $MSR_GSBASE, %ecx + movq bootpcpu, %rax + movq %rax, %rdx + shrq $32, %rdx + wrmsr + jmp init_secondary From owner-dev-commits-src-all@freebsd.org Thu Jul 29 15:01: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 62675675ACD; Thu, 29 Jul 2021 15:01: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 4GbDJZ210zz4pyS; Thu, 29 Jul 2021 15:01: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 2A1C214102; Thu, 29 Jul 2021 15:01: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 16TF1o6Q079884; Thu, 29 Jul 2021 15:01:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16TF1o84079883; Thu, 29 Jul 2021 15:01:50 GMT (envelope-from git) Date: Thu, 29 Jul 2021 15:01:50 GMT Message-Id: <202107291501.16TF1o84079883@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: cbf6f55e77a9 - main - 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/main X-Git-Reftype: branch X-Git-Commit: cbf6f55e77a9176572830a20804cf1d005dfea73 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, 29 Jul 2021 15:01:50 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=cbf6f55e77a9176572830a20804cf1d005dfea73 commit cbf6f55e77a9176572830a20804cf1d005dfea73 Author: Konstantin Belousov AuthorDate: 2021-07-29 01:26:38 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-29 15:01:24 +0000 x86 __vdso_gettc: add O_CLOEXEC flag to open of the /dev/hpet and /dev/hv_tsc devices, to not leak internal libc filedescriptors on exec. Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31344 --- 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 Jul 29 15:25: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 18575675CD1; Thu, 29 Jul 2021 15:25: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 4GbDqb70vyz4spT; Thu, 29 Jul 2021 15:25: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 D8A47141E8; Thu, 29 Jul 2021 15:25: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 16TFPFsx009624; Thu, 29 Jul 2021 15:25:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16TFPFBv009623; Thu, 29 Jul 2021 15:25:15 GMT (envelope-from git) Date: Thu, 29 Jul 2021 15:25:15 GMT Message-Id: <202107291525.16TFPFBv009623@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: 19135e372ff1 - stable/13 - arm64: Fix finding the pmc event ID 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 19135e372ff1627d2337f3014ee0bfe2e178d00a 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, 29 Jul 2021 15:25:16 -0000 The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=19135e372ff1627d2337f3014ee0bfe2e178d00a commit 19135e372ff1627d2337f3014ee0bfe2e178d00a Author: Andrew Turner AuthorDate: 2021-04-01 14:38:09 +0000 Commit: Mitchell Horne CommitDate: 2021-07-29 15:00:37 +0000 arm64: Fix finding the pmc event ID The lower pmc event bits were masked off to find the PMC event ID. The doesn't work when there are more events. Switch it to use the offser relative to the first event while also checking the ID is in the expected range. Reviewed by: gnn, ray Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D29600 (cherry picked from commit 24b2f4ea49229618c5608846acfc10be2eb0d567) --- sys/dev/hwpmc/hwpmc_arm64.c | 4 +++- sys/dev/hwpmc/hwpmc_arm64.h | 1 - 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/dev/hwpmc/hwpmc_arm64.c b/sys/dev/hwpmc/hwpmc_arm64.c index 49375219a485..050f861a74fe 100644 --- a/sys/dev/hwpmc/hwpmc_arm64.c +++ b/sys/dev/hwpmc/hwpmc_arm64.c @@ -181,7 +181,9 @@ arm64_allocate_pmc(int cpu, int ri, struct pmc *pm, } pe = a->pm_ev; - config = (pe & EVENT_ID_MASK); + config = (uint32_t)pe - PMC_EV_ARMV8_FIRST; + if (config > (PMC_EV_ARMV8_LAST - PMC_EV_ARMV8_FIRST)) + return (EINVAL); pm->pm_md.pm_arm64.pm_arm64_evsel = config; PMCDBG2(MDP, ALL, 2, "arm64-allocate ri=%d -> config=0x%x", ri, config); diff --git a/sys/dev/hwpmc/hwpmc_arm64.h b/sys/dev/hwpmc/hwpmc_arm64.h index f0d43aa58ef8..fb7637a39c60 100644 --- a/sys/dev/hwpmc/hwpmc_arm64.h +++ b/sys/dev/hwpmc/hwpmc_arm64.h @@ -40,7 +40,6 @@ #define ARMV8_RELOAD_COUNT_TO_PERFCTR_VALUE(R) (-(R)) #define ARMV8_PERFCTR_VALUE_TO_RELOAD_COUNT(P) (-(P)) -#define EVENT_ID_MASK 0xFF #ifdef _KERNEL /* MD extension for 'struct pmc' */ From owner-dev-commits-src-all@freebsd.org Thu Jul 29 15:25: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 4BE5967587D; Thu, 29 Jul 2021 15:25: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 4GbDqd1Mcbz4t4s; Thu, 29 Jul 2021 15:25: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 0706C142BF; Thu, 29 Jul 2021 15:25: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 16TFPGuT009648; Thu, 29 Jul 2021 15:25:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16TFPG5j009647; Thu, 29 Jul 2021 15:25:16 GMT (envelope-from git) Date: Thu, 29 Jul 2021 15:25:16 GMT Message-Id: <202107291525.16TFPG5j009647@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: c0960dc8c677 - stable/13 - libpmc: remove unused PMC_MDEP_INIT_INTEL_V2 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/stable/13 X-Git-Reftype: branch X-Git-Commit: c0960dc8c67727ce9c4fdde77aefada350d91ad0 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, 29 Jul 2021 15:25:17 -0000 The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=c0960dc8c67727ce9c4fdde77aefada350d91ad0 commit c0960dc8c67727ce9c4fdde77aefada350d91ad0 Author: Mitchell Horne AuthorDate: 2021-05-13 18:56:39 +0000 Commit: Mitchell Horne CommitDate: 2021-07-29 15:01:09 +0000 libpmc: remove unused PMC_MDEP_INIT_INTEL_V2 All uses of this macro were removed in e92a1350b50e. Remove cpu_has_iaf_counters as well. Reviewed by: ray, emaste MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30195 (cherry picked from commit 4d8d74a4f52efd078bd6298e0adbdd476ed70de9) --- lib/libpmc/libpmc.c | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/lib/libpmc/libpmc.c b/lib/libpmc/libpmc.c index 512f3957962a..e66ec5822226 100644 --- a/lib/libpmc/libpmc.c +++ b/lib/libpmc/libpmc.c @@ -1367,10 +1367,6 @@ pmc_init(void) uint32_t abi_version; struct module_stat pmc_modstat; struct pmc_op_getcpuinfo op_cpu_info; -#if defined(__amd64__) || defined(__i386__) - int cpu_has_iaf_counters; - unsigned int t; -#endif if (pmc_syscall != -1) /* already inited */ return (0); @@ -1446,15 +1442,6 @@ pmc_init(void) #if defined(__amd64__) || defined(__i386__) if (cpu_info.pm_cputype != PMC_CPU_GENERIC) pmc_class_table[n++] = &tsc_class_table_descr; - - /* - * Check if this CPU has fixed function counters. - */ - cpu_has_iaf_counters = 0; - for (t = 0; t < cpu_info.pm_nclass; t++) - if (cpu_info.pm_classes[t].pm_class == PMC_CLASS_IAF && - cpu_info.pm_classes[t].pm_num > 0) - cpu_has_iaf_counters = 1; #endif #define PMC_MDEP_INIT(C) do { \ @@ -1464,15 +1451,6 @@ pmc_init(void) PMC_TABLE_SIZE(C##_pmc_classes); \ } while (0) -#define PMC_MDEP_INIT_INTEL_V2(C) do { \ - PMC_MDEP_INIT(C); \ - pmc_class_table[n++] = &iaf_class_table_descr; \ - if (!cpu_has_iaf_counters) \ - pmc_mdep_event_aliases = \ - C##_aliases_without_iaf; \ - pmc_class_table[n] = &C##_class_table_descr; \ - } while (0) - /* Configure the event name parser. */ switch (cpu_info.pm_cputype) { #if defined(__amd64__) || defined(__i386__) From owner-dev-commits-src-all@freebsd.org Thu Jul 29 15:25: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 9C940675C23; Thu, 29 Jul 2021 15:25: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 4GbDqg339sz4sph; Thu, 29 Jul 2021 15:25: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 4778113FE3; Thu, 29 Jul 2021 15:25: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 16TFPJDq009705; Thu, 29 Jul 2021 15:25:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16TFPJla009704; Thu, 29 Jul 2021 15:25:19 GMT (envelope-from git) Date: Thu, 29 Jul 2021 15:25:19 GMT Message-Id: <202107291525.16TFPJla009704@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: dfb4fb41166b - stable/13 - libpmc: fall-back to kernel tables if pmu-events fails 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/stable/13 X-Git-Reftype: branch X-Git-Commit: dfb4fb41166bc35935e5f6fd9351a0ada0f71159 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, 29 Jul 2021 15:25:19 -0000 The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=dfb4fb41166bc35935e5f6fd9351a0ada0f71159 commit dfb4fb41166bc35935e5f6fd9351a0ada0f71159 Author: Mitchell Horne AuthorDate: 2021-05-13 18:57:37 +0000 Commit: Mitchell Horne CommitDate: 2021-07-29 15:01:09 +0000 libpmc: fall-back to kernel tables if pmu-events fails On x86, the pmu_events table is the source of truth for finding supported events. However, events not found there may still be present in the kernel's static event tables. For example, the pmc.soft(3) events will never be available from pmu-events. Update pmc_allocate() to search the legacy event tables if pmc_pmu_pmcallocate() fails to return a result. This allows both event sources to be consulted before giving up, thus restoring pmc.soft(3) and pmc.tsc(3) on x86. Reviewed by: emaste MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30216 (cherry picked from commit dfdc57e8aa8ba4b4e4484f736e8c7645ab69b54a) --- lib/libpmc/libpmc.c | 40 +++++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/lib/libpmc/libpmc.c b/lib/libpmc/libpmc.c index 6636c974cb73..e2422f167267 100644 --- a/lib/libpmc/libpmc.c +++ b/lib/libpmc/libpmc.c @@ -989,25 +989,25 @@ pmc_allocate(const char *ctrspec, enum pmc_mode mode, pmc_config.pm_count = count; if (PMC_IS_SAMPLING_MODE(mode)) pmc_config.pm_caps |= PMC_CAP_INTERRUPT; + /* - * Can we pull this straight from the pmu table? + * Try to pull the raw event ID directly from the pmu-events table. If + * this is unsupported on the platform, or the event is not found, + * continue with searching the regular event tables. */ r = spec_copy = strdup(ctrspec); ctrname = strsep(&r, ","); if (pmc_pmu_enabled()) { - if (pmc_pmu_pmcallocate(ctrname, &pmc_config) == 0) { - if (PMC_CALL(PMCALLOCATE, &pmc_config) < 0) { - goto out; - } - retval = 0; - *pmcid = pmc_config.pm_pmcid; - goto out; - } - errx(EX_USAGE, "ERROR: pmc_pmu_allocate failed, check for ctrname %s\n", ctrname); - } else { - free(spec_copy); - spec_copy = NULL; + if (pmc_pmu_pmcallocate(ctrname, &pmc_config) == 0) + goto found; + + /* Otherwise, reset any changes */ + pmc_config.pm_ev = 0; + pmc_config.pm_caps = 0; + pmc_config.pm_class = 0; } + free(spec_copy); + spec_copy = NULL; /* replace an event alias with the canonical event specifier */ if (pmc_mdep_event_aliases) @@ -1064,14 +1064,12 @@ pmc_allocate(const char *ctrspec, enum pmc_mode mode, goto out; } - if (PMC_CALL(PMCALLOCATE, &pmc_config) < 0) - goto out; - - *pmcid = pmc_config.pm_pmcid; - - retval = 0; - - out: +found: + if (PMC_CALL(PMCALLOCATE, &pmc_config) == 0) { + *pmcid = pmc_config.pm_pmcid; + retval = 0; + } +out: if (spec_copy) free(spec_copy); From owner-dev-commits-src-all@freebsd.org Thu Jul 29 15:25: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 91A7B675BCD; Thu, 29 Jul 2021 15:25: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 4GbDqf2lTtz4t2s; Thu, 29 Jul 2021 15:25: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 26F47141E9; Thu, 29 Jul 2021 15:25: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 16TFPIbe009678; Thu, 29 Jul 2021 15:25:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16TFPI03009677; Thu, 29 Jul 2021 15:25:18 GMT (envelope-from git) Date: Thu, 29 Jul 2021 15:25:18 GMT Message-Id: <202107291525.16TFPI03009677@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: 57caeb5109ee - stable/13 - libpmc: remove PMC_MDEP_TABLE logic 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 57caeb5109ee3f385fbabb667eca9588588bcc52 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, 29 Jul 2021 15:25:18 -0000 The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=57caeb5109ee3f385fbabb667eca9588588bcc52 commit 57caeb5109ee3f385fbabb667eca9588588bcc52 Author: Mitchell Horne AuthorDate: 2021-05-13 19:00:07 +0000 Commit: Mitchell Horne CommitDate: 2021-07-29 15:01:09 +0000 libpmc: remove PMC_MDEP_TABLE logic This logic was added for handling some of the complicated relationships between events and x86 CPU models. Since that logic has been mostly removed from libpmc(3) in favor of pmu-events, this no longer serves much of a purpose. Mapping CPU types to event tables is already handled by the switch statement in pmc_init(). Reviewed by: ray, emaste MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30196 (cherry picked from commit da13ef6aa0565c8d79326bba5606671062033bbf) --- lib/libpmc/libpmc.c | 54 ++++------------------------------------------------- 1 file changed, 4 insertions(+), 50 deletions(-) diff --git a/lib/libpmc/libpmc.c b/lib/libpmc/libpmc.c index e66ec5822226..6636c974cb73 100644 --- a/lib/libpmc/libpmc.c +++ b/lib/libpmc/libpmc.c @@ -177,32 +177,6 @@ static const struct pmc_event_descr cortex_a76_event_table[] = __PMC_EV_ALIAS_ARMV8_CORTEX_A76() }; -/* - * PMC_MDEP_TABLE(NAME, PRIMARYCLASS, ADDITIONAL_CLASSES...) - * - * Map a CPU to the PMC classes it supports. - */ -#define PMC_MDEP_TABLE(N,C,...) \ - static const enum pmc_class N##_pmc_classes[] = { \ - PMC_CLASS_##C, __VA_ARGS__ \ - } - -PMC_MDEP_TABLE(k8, K8, PMC_CLASS_SOFT, PMC_CLASS_TSC); -PMC_MDEP_TABLE(beri, BERI, PMC_CLASS_SOFT, PMC_CLASS_BERI); -PMC_MDEP_TABLE(cortex_a8, ARMV7, PMC_CLASS_SOFT, PMC_CLASS_ARMV7); -PMC_MDEP_TABLE(cortex_a9, ARMV7, PMC_CLASS_SOFT, PMC_CLASS_ARMV7); -PMC_MDEP_TABLE(cortex_a53, ARMV8, PMC_CLASS_SOFT, PMC_CLASS_ARMV8); -PMC_MDEP_TABLE(cortex_a57, ARMV8, PMC_CLASS_SOFT, PMC_CLASS_ARMV8); -PMC_MDEP_TABLE(cortex_a76, ARMV8, PMC_CLASS_SOFT, PMC_CLASS_ARMV8); -PMC_MDEP_TABLE(mips24k, MIPS24K, PMC_CLASS_SOFT, PMC_CLASS_MIPS24K); -PMC_MDEP_TABLE(mips74k, MIPS74K, PMC_CLASS_SOFT, PMC_CLASS_MIPS74K); -PMC_MDEP_TABLE(octeon, OCTEON, PMC_CLASS_SOFT, PMC_CLASS_OCTEON); -PMC_MDEP_TABLE(ppc7450, PPC7450, PMC_CLASS_SOFT, PMC_CLASS_PPC7450, PMC_CLASS_TSC); -PMC_MDEP_TABLE(ppc970, PPC970, PMC_CLASS_SOFT, PMC_CLASS_PPC970, PMC_CLASS_TSC); -PMC_MDEP_TABLE(power8, POWER8, PMC_CLASS_SOFT, PMC_CLASS_POWER8, PMC_CLASS_TSC); -PMC_MDEP_TABLE(e500, E500, PMC_CLASS_SOFT, PMC_CLASS_E500, PMC_CLASS_TSC); -PMC_MDEP_TABLE(generic, SOFT, PMC_CLASS_SOFT); - static const struct pmc_event_descr tsc_event_table[] = { __PMC_EV_TSC() @@ -264,9 +238,6 @@ static struct pmc_class_descr soft_class_table_descr = static const struct pmc_class_descr **pmc_class_table; #define PMC_CLASS_TABLE_SIZE cpu_info.pm_nclass -static const enum pmc_class *pmc_mdep_class_list; -static size_t pmc_mdep_class_list_size; - /* * Mapping tables, mapping enumeration values to human readable * strings. @@ -985,17 +956,6 @@ pmc_match_event_class(const char *name, return (NULL); } -static int -pmc_mdep_is_compatible_class(enum pmc_class pc) -{ - size_t n; - - for (n = 0; n < pmc_mdep_class_list_size; n++) - if (pmc_mdep_class_list[n] == pc) - return (1); - return (0); -} - /* * API entry points */ @@ -1070,9 +1030,8 @@ pmc_allocate(const char *ctrspec, enum pmc_mode mode, ev = NULL; for (n = 0; n < PMC_CLASS_TABLE_SIZE; n++) { pcd = pmc_class_table[n]; - if (pcd && pmc_mdep_is_compatible_class(pcd->pm_evc_class) && - strncasecmp(ctrname, pcd->pm_evc_name, - pcd->pm_evc_name_size) == 0) { + if (pcd != NULL && strncasecmp(ctrname, pcd->pm_evc_name, + pcd->pm_evc_name_size) == 0) { if ((ev = pmc_match_event_class(ctrname + pcd->pm_evc_name_size, pcd)) == NULL) { errno = EINVAL; @@ -1088,7 +1047,7 @@ pmc_allocate(const char *ctrspec, enum pmc_mode mode, */ for (n = 0; ev == NULL && n < PMC_CLASS_TABLE_SIZE; n++) { pcd = pmc_class_table[n]; - if (pcd && pmc_mdep_is_compatible_class(pcd->pm_evc_class)) + if (pcd != NULL) ev = pmc_match_event_class(ctrname, pcd); } @@ -1444,12 +1403,7 @@ pmc_init(void) pmc_class_table[n++] = &tsc_class_table_descr; #endif -#define PMC_MDEP_INIT(C) do { \ - pmc_mdep_event_aliases = C##_aliases; \ - pmc_mdep_class_list = C##_pmc_classes; \ - pmc_mdep_class_list_size = \ - PMC_TABLE_SIZE(C##_pmc_classes); \ - } while (0) +#define PMC_MDEP_INIT(C) pmc_mdep_event_aliases = C##_aliases /* Configure the event name parser. */ switch (cpu_info.pm_cputype) { From owner-dev-commits-src-all@freebsd.org Thu Jul 29 15:25: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 BD8F6675F02; Thu, 29 Jul 2021 15:25: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 4GbDqj4mt8z4smW; Thu, 29 Jul 2021 15:25: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 861C413FE5; Thu, 29 Jul 2021 15:25: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 16TFPLd4009755; Thu, 29 Jul 2021 15:25:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16TFPLdF009754; Thu, 29 Jul 2021 15:25:21 GMT (envelope-from git) Date: Thu, 29 Jul 2021 15:25:21 GMT Message-Id: <202107291525.16TFPLdF009754@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: eae121b18f5b - stable/13 - libpmc: fix "instructions" alias on Intel 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/stable/13 X-Git-Reftype: branch X-Git-Commit: eae121b18f5b2599e56c5101c40c9f71856246e7 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, 29 Jul 2021 15:25:21 -0000 The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=eae121b18f5b2599e56c5101c40c9f71856246e7 commit eae121b18f5b2599e56c5101c40c9f71856246e7 Author: Mitchell Horne AuthorDate: 2021-05-31 14:16:16 +0000 Commit: Mitchell Horne CommitDate: 2021-07-29 15:01:09 +0000 libpmc: fix "instructions" alias on Intel The typo prevents the counter from being allocated. This fixes e.g. pmcstat -s instructions sleep 5 Reviewed by: mizhka, gnn, ray, emaste MFC after: 5 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30527 (cherry picked from commit bc1a6a9d692a1f827514144b6bce0654a8be4f4d) --- lib/libpmc/libpmc_pmu_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libpmc/libpmc_pmu_util.c b/lib/libpmc/libpmc_pmu_util.c index d652573a883f..259a2a5faa47 100644 --- a/lib/libpmc/libpmc_pmu_util.c +++ b/lib/libpmc/libpmc_pmu_util.c @@ -72,7 +72,7 @@ static struct pmu_alias pmu_intel_alias_table[] = { {"BRANCH-MISSES-RETIRED", "BR_MISP_RETIRED.ALL_BRANCHES"}, {"cycles", "tsc-tsc"}, {"unhalted-cycles", "CPU_CLK_UNHALTED.THREAD_P_ANY"}, - {"instructions", "inst-retired.any_p"}, + {"instructions", "inst_retired.any_p"}, {"branch-mispredicts", "br_misp_retired.all_branches"}, {"branches", "br_inst_retired.all_branches"}, {"interrupts", "hw_interrupts.received"}, From owner-dev-commits-src-all@freebsd.org Thu Jul 29 15:25: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 E42F4675B59; Thu, 29 Jul 2021 15:25: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 4GbDqk5hdpz4spy; Thu, 29 Jul 2021 15:25: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 A7E2B141EA; Thu, 29 Jul 2021 15:25: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 16TFPMOM009779; Thu, 29 Jul 2021 15:25:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16TFPM4s009778; Thu, 29 Jul 2021 15:25:22 GMT (envelope-from git) Date: Thu, 29 Jul 2021 15:25:22 GMT Message-Id: <202107291525.16TFPM4s009778@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: b85044cea605 - stable/13 - libpmc: remove unused 'isfixed' variable 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/stable/13 X-Git-Reftype: branch X-Git-Commit: b85044cea6055c005f7a4ac816f5796da49b7ce9 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, 29 Jul 2021 15:25:23 -0000 The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=b85044cea6055c005f7a4ac816f5796da49b7ce9 commit b85044cea6055c005f7a4ac816f5796da49b7ce9 Author: Mitchell Horne AuthorDate: 2021-05-31 14:22:30 +0000 Commit: Mitchell Horne CommitDate: 2021-07-29 15:01:09 +0000 libpmc: remove unused 'isfixed' variable Reviewed by: gnn, emaste MFC after: 5 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30529 (cherry picked from commit 0092642f863946ee1edc88fa634887d7c8a54656) --- lib/libpmc/libpmc_pmu_util.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/libpmc/libpmc_pmu_util.c b/lib/libpmc/libpmc_pmu_util.c index 259a2a5faa47..1b2c10e07368 100644 --- a/lib/libpmc/libpmc_pmu_util.c +++ b/lib/libpmc/libpmc_pmu_util.c @@ -472,9 +472,7 @@ pmc_pmu_intel_pmcallocate(const char *event_name, struct pmc_op_pmcallocate *pm, struct pmu_event_desc *ped) { struct pmc_md_iap_op_pmcallocate *iap; - int isfixed; - isfixed = 0; iap = &pm->pm_md.pm_iap; if (strcasestr(event_name, "UNC_") == event_name || strcasestr(event_name, "uncore") != NULL) { From owner-dev-commits-src-all@freebsd.org Thu Jul 29 15:25: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 A5F8A675EE9; Thu, 29 Jul 2021 15:25: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 4GbDqh4Bbpz4t30; Thu, 29 Jul 2021 15:25: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 725A413FE4; Thu, 29 Jul 2021 15:25: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 16TFPKJT009731; Thu, 29 Jul 2021 15:25:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16TFPK6r009730; Thu, 29 Jul 2021 15:25:20 GMT (envelope-from git) Date: Thu, 29 Jul 2021 15:25:20 GMT Message-Id: <202107291525.16TFPK6r009730@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: 96da64391de9 - stable/13 - hwpmc: fix PMC_CPU_LAST 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 96da64391de97b2b6775e14d73a1749ea5c3030b 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, 29 Jul 2021 15:25:20 -0000 The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=96da64391de97b2b6775e14d73a1749ea5c3030b commit 96da64391de97b2b6775e14d73a1749ea5c3030b Author: Mitchell Horne AuthorDate: 2021-05-05 18:40:39 +0000 Commit: Mitchell Horne CommitDate: 2021-07-29 15:01:09 +0000 hwpmc: fix PMC_CPU_LAST It is unused, but incorrect. MFC after: 3 days Sponsored by: The FreeBSD Foundation (cherry picked from commit f59127dac5ca0be3648ecc0a031a21e472afb133) --- sys/sys/pmc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/sys/pmc.h b/sys/sys/pmc.h index 1486c7aa91c7..9328a7bdfa05 100644 --- a/sys/sys/pmc.h +++ b/sys/sys/pmc.h @@ -138,7 +138,7 @@ enum pmc_cputype { }; #define PMC_CPU_FIRST PMC_CPU_AMD_K7 -#define PMC_CPU_LAST PMC_CPU_GENERIC +#define PMC_CPU_LAST PMC_CPU_ARMV8_CORTEX_A76 /* * Classes of PMCs From owner-dev-commits-src-all@freebsd.org Thu Jul 29 15:25: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 75A53675F06; Thu, 29 Jul 2021 15:25: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 4GbDqm0MWTz4t3M; Thu, 29 Jul 2021 15:25: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 CD4C7142C0; Thu, 29 Jul 2021 15:25: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 16TFPNjm009805; Thu, 29 Jul 2021 15:25:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16TFPNYn009804; Thu, 29 Jul 2021 15:25:23 GMT (envelope-from git) Date: Thu, 29 Jul 2021 15:25:23 GMT Message-Id: <202107291525.16TFPNYn009804@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: b44f0bd4109f - stable/13 - libpmc: always generate libpmc_events.c 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/stable/13 X-Git-Reftype: branch X-Git-Commit: b44f0bd4109fd2dcbedd2dcab19c4bd1c3037153 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, 29 Jul 2021 15:25:24 -0000 The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=b44f0bd4109fd2dcbedd2dcab19c4bd1c3037153 commit b44f0bd4109fd2dcbedd2dcab19c4bd1c3037153 Author: Mitchell Horne AuthorDate: 2021-05-31 14:24:04 +0000 Commit: Mitchell Horne CommitDate: 2021-07-29 15:01:10 +0000 libpmc: always generate libpmc_events.c The jevents build tool will create an empty table if it doesn't find any events, so we can remove the extra $MACHINE_CPUARCH checks. Reviewed by: gnn, ray, emaste MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30531 (cherry picked from commit 689c7e7975cdee38ca6fd60ad3372d55c43c948c) --- Makefile.inc1 | 4 +--- Makefile.libcompat | 2 +- lib/libpmc/Makefile | 7 +++---- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index 288d16a7574e..a595dfbb76c9 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -2535,9 +2535,7 @@ _tcsh=bin/csh _libmagic=lib/libmagic .endif -.if ${MK_PMC} != "no" && \ - (${TARGET_ARCH} == "aarch64" || ${TARGET_ARCH} == "amd64" || \ - ${TARGET_ARCH} == "i386") +.if ${MK_PMC} != "no" _jevents=lib/libpmc/pmu-events .endif diff --git a/Makefile.libcompat b/Makefile.libcompat index e4d9cd94e835..779bcb163cf7 100644 --- a/Makefile.libcompat +++ b/Makefile.libcompat @@ -51,7 +51,7 @@ _LC_INCDIRS= \ .if ${MK_FILE} != "no" _libmagic= lib/libmagic .endif -.if ${MK_PMC} != "no" && ${TARGET_ARCH} == "amd64" +.if ${MK_PMC} != "no" _jevents= lib/libpmc/pmu-events .endif diff --git a/lib/libpmc/Makefile b/lib/libpmc/Makefile index 42aa14e58471..1006b6f93469 100644 --- a/lib/libpmc/Makefile +++ b/lib/libpmc/Makefile @@ -8,15 +8,15 @@ INCS= pmc.h pmclog.h pmcformat.h CFLAGS+= -I${SRCTOP}/${RELDIR:H}/libpmcstat LDADD+= -lc++ -.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_ARCH} == "amd64" || \ - ${MACHINE_ARCH} == "i386" - .if ${MACHINE_CPUARCH} == "aarch64" EVENT_ARCH="arm64" .elif ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386" EVENT_ARCH="x86" .elif ${MACHINE_ARCH} == "powerpc" EVENT_ARCH="powerpc" +.else +# This will generate an empty events table +EVENT_ARCH="none" .endif .if ${MK_DIRDEPS_BUILD} == "yes" @@ -40,7 +40,6 @@ libpmc_events.c: ${JEVENTS} .META fi CLEANFILES+= libpmc_events.c libpmc_events.c.tmp SRCS+= libpmc_events.c -.endif WARNS?= 3 From owner-dev-commits-src-all@freebsd.org Thu Jul 29 15:25: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 82BEF675F0A; Thu, 29 Jul 2021 15:25: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 4GbDqn1Yh8z4t5M; Thu, 29 Jul 2021 15:25: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 0264D1432A; Thu, 29 Jul 2021 15:25: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 16TFPOWf009835; Thu, 29 Jul 2021 15:25:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16TFPOgn009834; Thu, 29 Jul 2021 15:25:24 GMT (envelope-from git) Date: Thu, 29 Jul 2021 15:25:24 GMT Message-Id: <202107291525.16TFPOgn009834@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: 3a9b3a847026 - stable/13 - libpmc: remove pe->alias 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 3a9b3a8470261d052d25a2a2b628a0dd214d1091 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, 29 Jul 2021 15:25:25 -0000 The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=3a9b3a8470261d052d25a2a2b628a0dd214d1091 commit 3a9b3a8470261d052d25a2a2b628a0dd214d1091 Author: Mitchell Horne AuthorDate: 2021-05-31 14:23:19 +0000 Commit: Mitchell Horne CommitDate: 2021-07-29 15:01:10 +0000 libpmc: remove pe->alias It has never been a part of upstream's struct pmu_event. The jevents utility will not fill this field, so remove it. Reviewed by: gnn MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30530 (cherry picked from commit 0c915023dbb7000cd30bb768eb84f6dc757adcc5) --- lib/libpmc/libpmc_pmu_util.c | 4 ---- lib/libpmc/pmu-events/pmu-events.h | 1 - 2 files changed, 5 deletions(-) diff --git a/lib/libpmc/libpmc_pmu_util.c b/lib/libpmc/libpmc_pmu_util.c index 1b2c10e07368..6a287a66a2f8 100644 --- a/lib/libpmc/libpmc_pmu_util.c +++ b/lib/libpmc/libpmc_pmu_util.c @@ -302,8 +302,6 @@ pmc_pmu_sample_rate_get(const char *event_name) event_name = pmu_alias_get(event_name); if ((pe = pmu_event_get(NULL, event_name, NULL)) == NULL) return (DEFAULT_SAMPLE_COUNT); - if (pe->alias && (pe = pmu_event_get(NULL, pe->alias, NULL)) == NULL) - return (DEFAULT_SAMPLE_COUNT); if (pe->event == NULL) return (DEFAULT_SAMPLE_COUNT); if (pmu_parse_event(&ped, pe->event)) @@ -526,8 +524,6 @@ pmc_pmu_pmcallocate(const char *event_name, struct pmc_op_pmcallocate *pm) event_name = pmu_alias_get(event_name); if ((pe = pmu_event_get(NULL, event_name, &idx)) == NULL) return (ENOENT); - if (pe->alias && (pe = pmu_event_get(NULL, pe->alias, &idx)) == NULL) - return (ENOENT); assert(idx >= 0); pm->pm_ev = idx; diff --git a/lib/libpmc/pmu-events/pmu-events.h b/lib/libpmc/pmu-events/pmu-events.h index c4c01e20114d..cfc82f20364c 100644 --- a/lib/libpmc/pmu-events/pmu-events.h +++ b/lib/libpmc/pmu-events/pmu-events.h @@ -10,7 +10,6 @@ */ struct pmu_event { const char *name; - const char *alias; const char *event; const char *desc; const char *topic; From owner-dev-commits-src-all@freebsd.org Thu Jul 29 15:25: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 EC34D675BE2; Thu, 29 Jul 2021 15:25: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 4GbDqs5FYWz4t5b; Thu, 29 Jul 2021 15:25: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 93D47143A2; Thu, 29 Jul 2021 15:25: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 16TFPTp2009935; Thu, 29 Jul 2021 15:25:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16TFPTgh009934; Thu, 29 Jul 2021 15:25:29 GMT (envelope-from git) Date: Thu, 29 Jul 2021 15:25:29 GMT Message-Id: <202107291525.16TFPTgh009934@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: 6911f3988766 - stable/13 - libpmc: limit pmu-events to 64-bit powerpc 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 6911f39887662f95a2a20c521ce5b5a8d048f687 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, 29 Jul 2021 15:25:30 -0000 The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=6911f39887662f95a2a20c521ce5b5a8d048f687 commit 6911f39887662f95a2a20c521ce5b5a8d048f687 Author: Mitchell Horne AuthorDate: 2021-05-31 20:24:15 +0000 Commit: Mitchell Horne CommitDate: 2021-07-29 15:01:10 +0000 libpmc: limit pmu-events to 64-bit powerpc Although currently unused, there are only pmu event definitions for POWER8 and POWER9. There is no sense in building these on 32-bit platforms. Sponsored by: The FreeBSD Foundation (cherry picked from commit 507d68984a010dab0c3ecc5477c36526c3a7fa48) --- lib/libpmc/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libpmc/Makefile b/lib/libpmc/Makefile index da3f8a72d26b..285b6c539ece 100644 --- a/lib/libpmc/Makefile +++ b/lib/libpmc/Makefile @@ -12,7 +12,7 @@ LDADD+= -lc++ EVENT_ARCH="arm64" .elif ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" EVENT_ARCH="x86" -.elif ${MACHINE_ARCH} == "powerpc" +.elif ${MACHINE_CPUARCH} == "powerpc" && ${MACHINE_ARCH:Mpowerpc64*} != "" EVENT_ARCH="powerpc" .else # This will generate an empty events table From owner-dev-commits-src-all@freebsd.org Thu Jul 29 15:25: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 882B1675B60; Thu, 29 Jul 2021 15:25: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 4GbDqp317Rz4sjj; Thu, 29 Jul 2021 15:25: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 29BAC13FE6; Thu, 29 Jul 2021 15:25: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 16TFPQC7009859; Thu, 29 Jul 2021 15:25:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16TFPQOR009858; Thu, 29 Jul 2021 15:25:26 GMT (envelope-from git) Date: Thu, 29 Jul 2021 15:25:26 GMT Message-Id: <202107291525.16TFPQOR009858@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: b040b03d32c3 - stable/13 - libpmc: eliminate pmc_pmu_stat_mode() 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/stable/13 X-Git-Reftype: branch X-Git-Commit: b040b03d32c3deee6cfaf68e490558554cefb180 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, 29 Jul 2021 15:25:26 -0000 The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=b040b03d32c3deee6cfaf68e490558554cefb180 commit b040b03d32c3deee6cfaf68e490558554cefb180 Author: Mitchell Horne AuthorDate: 2021-05-31 14:21:57 +0000 Commit: Mitchell Horne CommitDate: 2021-07-29 15:01:10 +0000 libpmc: eliminate pmc_pmu_stat_mode() There is a single consumer, the pmc utility, that clearly has knowledge of which counters it is expecting. Remove this function and have it use common counter aliases instead. Reviewed by: gnn MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30528 (cherry picked from commit ec66cc955b629e614cf493bf168048de033f6a2c) --- lib/libpmc/libpmc_pmu_util.c | 22 ---------------------- lib/libpmc/pmc.h | 1 - usr.sbin/pmc/cmd_pmc_stat.c | 15 +++++++++++---- 3 files changed, 11 insertions(+), 27 deletions(-) diff --git a/lib/libpmc/libpmc_pmu_util.c b/lib/libpmc/libpmc_pmu_util.c index 6a287a66a2f8..90ce0feafa52 100644 --- a/lib/libpmc/libpmc_pmu_util.c +++ b/lib/libpmc/libpmc_pmu_util.c @@ -538,28 +538,6 @@ pmc_pmu_pmcallocate(const char *event_name, struct pmc_op_pmcallocate *pm) return (pmc_pmu_amd_pmcallocate(event_name, pm, &ped)); } -/* - * Ultimately rely on AMD calling theirs the same - */ -static const char *stat_mode_cntrs[] = { - "cpu_clk_unhalted.thread", - "inst_retired.any", - "br_inst_retired.all_branches", - "br_misp_retired.all_branches", - "longest_lat_cache.reference", - "longest_lat_cache.miss", -}; - -int -pmc_pmu_stat_mode(const char ***cntrs) -{ - if (pmc_pmu_enabled()) { - *cntrs = stat_mode_cntrs; - return (0); - } - return (EOPNOTSUPP); -} - #else uint64_t diff --git a/lib/libpmc/pmc.h b/lib/libpmc/pmc.h index 9d12085364e5..7579f93a42b1 100644 --- a/lib/libpmc/pmc.h +++ b/lib/libpmc/pmc.h @@ -122,7 +122,6 @@ uint64_t pmc_pmu_sample_rate_get(const char *); int pmc_pmu_pmcallocate(const char *, struct pmc_op_pmcallocate *); const char *pmc_pmu_event_get_by_idx(const char *, int idx); int pmc_pmu_idx_get_by_event(const char*, const char *); -int pmc_pmu_stat_mode(const char ***); __END_DECLS #endif diff --git a/usr.sbin/pmc/cmd_pmc_stat.c b/usr.sbin/pmc/cmd_pmc_stat.c index 44ca7b92dea7..55d1f1ca7a3b 100644 --- a/usr.sbin/pmc/cmd_pmc_stat.c +++ b/usr.sbin/pmc/cmd_pmc_stat.c @@ -104,6 +104,16 @@ static const char *pmc_stat_mode_names[] = { "cache-misses", }; +/* Common aliases for the desired stat counter */ +static const char *pmc_stat_mode_aliases[] = { + "unhalted-cycles", + "instructions", + "branches", + "branch-mispredicts", + "LLC-REFERENCE", + "LLC-MISSES", +}; + static int pmcstat_sockpair[NSOCKPAIRFD]; static void __dead2 @@ -153,7 +163,6 @@ static void pmc_stat_setup_stat(int system_mode, const char *arg) { const char *new_cntrs[STAT_MODE_NPMCS]; - static const char **pmc_stat_mode_cntrs; struct pmcstat_ev *ev; char *counters, *counter; int i, c, start, newcnt; @@ -164,13 +173,11 @@ pmc_stat_setup_stat(int system_mode, const char *arg) err(EX_OSERR, "ERROR: Cannot determine the root set of CPUs"); CPU_COPY(&rootmask, &cpumask); - if (pmc_pmu_stat_mode(&pmc_stat_mode_cntrs) != 0) - errx(EX_USAGE, "ERROR: hwmpc.ko not loaded or stat not supported on host."); if (system_mode && geteuid() != 0) errx(EX_USAGE, "ERROR: system mode counters can only be used as root"); counters = NULL; for (i = 0; i < STAT_MODE_NPMCS; i++) { - stat_mode_cntrs[i] = pmc_stat_mode_cntrs[i]; + stat_mode_cntrs[i] = pmc_stat_mode_aliases[i]; stat_mode_names[i] = pmc_stat_mode_names[i]; } if (arg) { From owner-dev-commits-src-all@freebsd.org Thu Jul 29 15:25: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 A582E675B62; Thu, 29 Jul 2021 15:25: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 4GbDqq32l0z4t3c; Thu, 29 Jul 2021 15:25: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 44ECB13F72; Thu, 29 Jul 2021 15:25: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 16TFPRAQ009885; Thu, 29 Jul 2021 15:25:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16TFPRgZ009884; Thu, 29 Jul 2021 15:25:27 GMT (envelope-from git) Date: Thu, 29 Jul 2021 15:25:27 GMT Message-Id: <202107291525.16TFPRgZ009884@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: 6b2ccad29745 - stable/13 - pmccontrol: improve -L with pmu-events 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 6b2ccad297459910f14ee7bdbbd517aacc64dafe 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, 29 Jul 2021 15:25:27 -0000 The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=6b2ccad297459910f14ee7bdbbd517aacc64dafe commit 6b2ccad297459910f14ee7bdbbd517aacc64dafe Author: Mitchell Horne AuthorDate: 2021-05-31 14:14:36 +0000 Commit: Mitchell Horne CommitDate: 2021-07-29 15:01:10 +0000 pmccontrol: improve -L with pmu-events Check if the pmu utils are supported rather than carrying a machine-dependent #ifdef. Reviewed by: gnn, ray, emaste MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30526 (cherry picked from commit 167cdaa7e30093215a753d4f788d921b1f7c1474) --- usr.sbin/pmccontrol/pmccontrol.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/usr.sbin/pmccontrol/pmccontrol.c b/usr.sbin/pmccontrol/pmccontrol.c index 147aab2d2ba1..9d57a2923784 100644 --- a/usr.sbin/pmccontrol/pmccontrol.c +++ b/usr.sbin/pmccontrol/pmccontrol.c @@ -282,14 +282,6 @@ pmcc_do_list_state(void) return 0; } -#if defined(__i386__) || defined(__amd64__) -static int -pmcc_do_list_events(void) -{ - pmc_pmu_print_counters(NULL); - return (0); -} -#else static int pmcc_do_list_events(void) { @@ -298,6 +290,13 @@ pmcc_do_list_events(void) const char **eventnamelist; const struct pmc_cpuinfo *ci; + /* First, try pmu events. */ + if (pmc_pmu_enabled()) { + pmc_pmu_print_counters(NULL); + return (0); + } + + /* Otherwise, use the legacy pmc(3) interfaces. */ if (pmc_cpuinfo(&ci) != 0) err(EX_OSERR, "Unable to determine CPU information"); @@ -319,7 +318,6 @@ pmcc_do_list_events(void) } return 0; } -#endif static int pmcc_show_statistics(void) From owner-dev-commits-src-all@freebsd.org Thu Jul 29 15:25: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 10072675F86; Thu, 29 Jul 2021 15:25: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 4GbDqr4R65z4t7l; Thu, 29 Jul 2021 15:25: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 6C613143A1; Thu, 29 Jul 2021 15:25: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 16TFPS5K009909; Thu, 29 Jul 2021 15:25:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16TFPSjB009908; Thu, 29 Jul 2021 15:25:28 GMT (envelope-from git) Date: Thu, 29 Jul 2021 15:25:28 GMT Message-Id: <202107291525.16TFPSjB009908@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: 440e5ecbe13d - stable/13 - libpmc: use $MACHINE_CPUARCH 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 440e5ecbe13d65fb2d4f01290ccb25217f8bc0b3 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, 29 Jul 2021 15:25:29 -0000 The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=440e5ecbe13d65fb2d4f01290ccb25217f8bc0b3 commit 440e5ecbe13d65fb2d4f01290ccb25217f8bc0b3 Author: Mitchell Horne AuthorDate: 2021-05-31 20:20:08 +0000 Commit: Mitchell Horne CommitDate: 2021-07-29 15:01:10 +0000 libpmc: use $MACHINE_CPUARCH This is preferred over $MACHINE_ARCH for these types of checks, although it makes no difference for amd64 or i386. No functional change intended. Sponsored by: The FreeBSD Foundation (cherry picked from commit 3864da302af34853ddb2c33a42de5668a0d68cdd) --- lib/libpmc/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libpmc/Makefile b/lib/libpmc/Makefile index 1006b6f93469..da3f8a72d26b 100644 --- a/lib/libpmc/Makefile +++ b/lib/libpmc/Makefile @@ -10,7 +10,7 @@ LDADD+= -lc++ .if ${MACHINE_CPUARCH} == "aarch64" EVENT_ARCH="arm64" -.elif ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386" +.elif ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" EVENT_ARCH="x86" .elif ${MACHINE_ARCH} == "powerpc" EVENT_ARCH="powerpc" From owner-dev-commits-src-all@freebsd.org Thu Jul 29 15:25: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 A2DBD675BE7; Thu, 29 Jul 2021 15:25:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GbDqx3HMcz4t87; Thu, 29 Jul 2021 15:25:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1EDDD1451B; Thu, 29 Jul 2021 15:25:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16TFPXCQ010015; Thu, 29 Jul 2021 15:25:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16TFPXeC010014; Thu, 29 Jul 2021 15:25:33 GMT (envelope-from git) Date: Thu, 29 Jul 2021 15:25:33 GMT Message-Id: <202107291525.16TFPXeC010014@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: d876c5a052fb - stable/13 - hwpmc_arm64: fill kern.hwpmc.cpuid 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/stable/13 X-Git-Reftype: branch X-Git-Commit: d876c5a052fb589f213d20da2c146e5471047044 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, 29 Jul 2021 15:25:33 -0000 The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=d876c5a052fb589f213d20da2c146e5471047044 commit d876c5a052fb589f213d20da2c146e5471047044 Author: Mitchell Horne AuthorDate: 2021-04-01 13:19:43 +0000 Commit: Mitchell Horne CommitDate: 2021-07-29 15:01:11 +0000 hwpmc_arm64: fill kern.hwpmc.cpuid This will be used to detect supported pmu events. The expected format is the MIDR register with the revision and variant fields masked. See also: lib/libpmc/pmu-events/arch/arm64/mapfile.csv. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30601 (cherry picked from commit 5867cccdc49df3e7eb3147d6516b488dd8384afe) --- sys/dev/hwpmc/hwpmc_arm64.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/sys/dev/hwpmc/hwpmc_arm64.c b/sys/dev/hwpmc/hwpmc_arm64.c index ba98eaefcc9a..be26605bad51 100644 --- a/sys/dev/hwpmc/hwpmc_arm64.c +++ b/sys/dev/hwpmc/hwpmc_arm64.c @@ -505,6 +505,7 @@ pmc_arm64_initialize() struct pmc_classdep *pcd; int idcode, impcode; int reg; + uint64_t midr; reg = arm64_pmcr_read(); arm64_npmcs = (reg & PMCR_N_MASK) >> PMCR_N_SHIFT; @@ -513,6 +514,18 @@ pmc_arm64_initialize() PMCDBG1(MDP, INI, 1, "arm64-init npmcs=%d", arm64_npmcs); + /* + * Write the CPU model to kern.hwpmc.cpuid. + * + * We zero the variant and revision fields. + * + * TODO: how to handle differences between cores due to big.LITTLE? + * For now, just use MIDR from CPU 0. + */ + midr = (uint64_t)(pcpu_find(0)->pc_midr); + midr &= ~(CPU_VAR_MASK | CPU_REV_MASK); + snprintf(pmc_cpuid, sizeof(pmc_cpuid), "0x%016lx", midr); + /* * Allocate space for pointers to PMC HW descriptors and for * the MDEP structure used by MI code. From owner-dev-commits-src-all@freebsd.org Thu Jul 29 15:25: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 DDCF3676093; Thu, 29 Jul 2021 15:25:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GbDqy3Qjmz4tBR; Thu, 29 Jul 2021 15:25:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 423DC142C1; Thu, 29 Jul 2021 15:25:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16TFPYnx010039; Thu, 29 Jul 2021 15:25:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16TFPYEe010038; Thu, 29 Jul 2021 15:25:34 GMT (envelope-from git) Date: Thu, 29 Jul 2021 15:25:34 GMT Message-Id: <202107291525.16TFPYEe010038@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: 83166f871407 - stable/13 - arm64 support for pmu-events 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 83166f87140764c36d7c6bdfab0433aceada66a9 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, 29 Jul 2021 15:25:35 -0000 The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=83166f87140764c36d7c6bdfab0433aceada66a9 commit 83166f87140764c36d7c6bdfab0433aceada66a9 Author: Mitchell Horne AuthorDate: 2021-05-19 16:11:33 +0000 Commit: Mitchell Horne CommitDate: 2021-07-29 15:02:05 +0000 arm64 support for pmu-events 8cc3815f: hwpmc_arm64: accept raw event codes for PMC_OP_PMCALLOCATE Make it possible to specify event codes without an offset of PMC_EV_ARMV8_FIRST, by setting a machine-dependent flag. This is required to make use of event definitions from pmu-events. Reviewed by: ray (slightly earlier version) MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30602 28dd6730: libpmc: enable pmu_utils on arm64 This allows supported libpmc to query/select from the pmu-events table, which may have a more complete set of events than what we define manually. A future update to these definitions should greatly improve this support. The alias table is empty for now, until this future import is complete. Add the Foundation's copyright for recent work on this file. Reviewed by: ray (slightly earlier version) MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30603 27ea55fc: libpmc/hwpmc: fix issues with arm64 pmu-events support Due to a mis-merge, the changes committed to libpmc never called pmu_parse_event(), or set pm->pm_ev. However, this field shouldn't be used to carry the actual pmc event code anyway, as it is expected to contain the index into the pmu event array (otherwise, it breaks event name lookup in pmclog_get_event()). Add a new MD field, pm_md.pm_md_config, to pass the raw event code to arm64_allocate_pmc(). Additionally, the change made to pmc_md_op_pmcallocate was incorrect, as this is a union, not a struct. Restore the proper padding size. Reviewed by: luporl, ray, andrew Fixes: 28dd6730a5d6 ("libpmc: enable pmu_utils on arm64") Fixes: 8cc3815f02be ("hwpmc_arm64: accept raw event codes...") Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31221 (cherry picked from commit 8cc3815f02be9fa2a96e47713ad989e6d787e12a) (cherry picked from commit 28dd6730a5d6bc73aca4c015c0ff875a9def25ac) (cherry picked from commit 27ea55fc655b0081f760a34ff5dd5526ba02a0fb) --- lib/libpmc/libpmc_pmu_util.c | 49 ++++++++++++++++++++++++++++++++++++++++++++ sys/arm64/include/pmc_mdep.h | 5 +++++ sys/dev/hwpmc/hwpmc_arm64.c | 11 ++++++---- 3 files changed, 61 insertions(+), 4 deletions(-) diff --git a/lib/libpmc/libpmc_pmu_util.c b/lib/libpmc/libpmc_pmu_util.c index 81320a3dc954..e6f74e6abe81 100644 --- a/lib/libpmc/libpmc_pmu_util.c +++ b/lib/libpmc/libpmc_pmu_util.c @@ -2,6 +2,10 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2018, Matthew Macy + * Copyright (c) 2021, The FreeBSD Foundation + * + * Portions of this software were developed by Mitchell Horne + * 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 @@ -139,6 +143,24 @@ pmu_alias_get(const char *name) return (name); } +#elif defined(__aarch64__) + +static struct pmu_alias pmu_armv8_alias_table[] = { + {NULL, NULL}, +}; + +static const char * +pmu_alias_get(const char *name) +{ + struct pmu_alias *pa; + + for (pa = pmu_armv8_alias_table; pa->pa_alias != NULL; pa++) + if (strcasecmp(name, pa->pa_alias) == 0) + return (pa->pa_name); + + return (name); +} + #else static const char * @@ -549,6 +571,33 @@ pmc_pmu_pmcallocate(const char *event_name, struct pmc_op_pmcallocate *pm) return (pmc_pmu_amd_pmcallocate(event_name, pm, &ped)); } +#elif defined(__aarch64__) + +int +pmc_pmu_pmcallocate(const char *event_name, struct pmc_op_pmcallocate *pm) +{ + const struct pmu_event *pe; + struct pmu_event_desc ped; + int idx = -1; + + event_name = pmu_alias_get(event_name); + if ((pe = pmu_event_get(NULL, event_name, &idx)) == NULL) + return (ENOENT); + if (pe->event == NULL) + return (ENOENT); + if (pmu_parse_event(&ped, pe->event)) + return (ENOENT); + + assert(idx >= 0); + pm->pm_ev = idx; + pm->pm_md.pm_md_config = ped.ped_event; + pm->pm_md.pm_md_flags |= PM_MD_RAW_EVENT; + pm->pm_class = PMC_CLASS_ARMV8; + pm->pm_caps |= (PMC_CAP_READ | PMC_CAP_WRITE); + + return (0); +} + #else int diff --git a/sys/arm64/include/pmc_mdep.h b/sys/arm64/include/pmc_mdep.h index bcf08a7f9551..dec90b386b13 100644 --- a/sys/arm64/include/pmc_mdep.h +++ b/sys/arm64/include/pmc_mdep.h @@ -38,6 +38,11 @@ #include union pmc_md_op_pmcallocate { + struct { + uint32_t pm_md_config; + uint32_t pm_md_flags; +#define PM_MD_RAW_EVENT 0x1 + }; uint64_t __pad[4]; }; diff --git a/sys/dev/hwpmc/hwpmc_arm64.c b/sys/dev/hwpmc/hwpmc_arm64.c index be26605bad51..06e2e66c7fda 100644 --- a/sys/dev/hwpmc/hwpmc_arm64.c +++ b/sys/dev/hwpmc/hwpmc_arm64.c @@ -181,11 +181,14 @@ arm64_allocate_pmc(int cpu, int ri, struct pmc *pm, } pe = a->pm_ev; - config = (uint32_t)pe - PMC_EV_ARMV8_FIRST; - if (config > (PMC_EV_ARMV8_LAST - PMC_EV_ARMV8_FIRST)) - return (EINVAL); + /* Adjust the config value if needed. */ + config = a->pm_md.pm_md_config; + if ((a->pm_md.pm_md_flags & PM_MD_RAW_EVENT) == 0) { + config = (uint32_t)pe - PMC_EV_ARMV8_FIRST; + if (config > (PMC_EV_ARMV8_LAST - PMC_EV_ARMV8_FIRST)) + return (EINVAL); + } pm->pm_md.pm_arm64.pm_arm64_evsel = config; - PMCDBG2(MDP, ALL, 2, "arm64-allocate ri=%d -> config=0x%x", ri, config); return (0); From owner-dev-commits-src-all@freebsd.org Thu Jul 29 15:25: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 AA3FF675F88; Thu, 29 Jul 2021 15:25: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 4GbDqv170tz4t5g; Thu, 29 Jul 2021 15:25: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 C3C9C1451A; Thu, 29 Jul 2021 15:25: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 16TFPUjP009965; Thu, 29 Jul 2021 15:25:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16TFPUoZ009964; Thu, 29 Jul 2021 15:25:30 GMT (envelope-from git) Date: Thu, 29 Jul 2021 15:25:30 GMT Message-Id: <202107291525.16TFPUoZ009964@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: 87c9a2933bdb - stable/13 - libpmc: make libpmc_pmu_utils.c more amenable to porting 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 87c9a2933bdb537cc163aaeb16e588d303dc1d50 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, 29 Jul 2021 15:25:31 -0000 The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=87c9a2933bdb537cc163aaeb16e588d303dc1d50 commit 87c9a2933bdb537cc163aaeb16e588d303dc1d50 Author: Mitchell Horne AuthorDate: 2021-05-31 14:24:44 +0000 Commit: Mitchell Horne CommitDate: 2021-07-29 15:01:10 +0000 libpmc: make libpmc_pmu_utils.c more amenable to porting The current version has every function stubbed out for !x86. Only two functions (pmu_alias_get() and pmc_pmu_pmcallocate() are really platform dependent, so reduce the width of the ifdefs and remove some of the stubs. Reviewed by: ray MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30532 (cherry picked from commit 0024f1aa7720d5f4f587a6c5911fc5238195ae49) --- lib/libpmc/libpmc_pmu_util.c | 65 ++++++++------------------------------------ 1 file changed, 12 insertions(+), 53 deletions(-) diff --git a/lib/libpmc/libpmc_pmu_util.c b/lib/libpmc/libpmc_pmu_util.c index 90ce0feafa52..81320a3dc954 100644 --- a/lib/libpmc/libpmc_pmu_util.c +++ b/lib/libpmc/libpmc_pmu_util.c @@ -43,12 +43,12 @@ #include #include "pmu-events/pmu-events.h" -#if defined(__amd64__) || defined(__i386__) struct pmu_alias { const char *pa_alias; const char *pa_name; }; +#if defined(__amd64__) || defined(__i386__) typedef enum { PMU_INVALID, PMU_INTEL, @@ -139,6 +139,16 @@ pmu_alias_get(const char *name) return (name); } +#else + +static const char * +pmu_alias_get(const char *name) +{ + + return (name); +} +#endif + struct pmu_event_desc { uint64_t ped_period; uint64_t ped_offcore_rsp; @@ -417,6 +427,7 @@ pmc_pmu_print_counter_full(const char *ev) } } +#if defined(__amd64__) || defined(__i386__) static int pmc_pmu_amd_pmcallocate(const char *event_name, struct pmc_op_pmcallocate *pm, struct pmu_event_desc *ped) @@ -540,61 +551,9 @@ pmc_pmu_pmcallocate(const char *event_name, struct pmc_op_pmcallocate *pm) #else -uint64_t -pmc_pmu_sample_rate_get(const char *event_name __unused) -{ - return (DEFAULT_SAMPLE_COUNT); -} - -void -pmc_pmu_print_counters(const char *event_name __unused) -{ -} - -void -pmc_pmu_print_counter_desc(const char *e __unused) -{ -} - -void -pmc_pmu_print_counter_desc_long(const char *e __unused) -{ -} - -void -pmc_pmu_print_counter_full(const char *e __unused) -{ - -} - -int -pmc_pmu_enabled(void) -{ - return (0); -} - int pmc_pmu_pmcallocate(const char *e __unused, struct pmc_op_pmcallocate *p __unused) { return (EOPNOTSUPP); } - -const char * -pmc_pmu_event_get_by_idx(const char *c __unused, int idx __unused) -{ - return (NULL); -} - -int -pmc_pmu_stat_mode(const char ***a __unused) -{ - return (EOPNOTSUPP); -} - -int -pmc_pmu_idx_get_by_event(const char *c __unused, const char *e __unused) -{ - return (-1); -} - #endif From owner-dev-commits-src-all@freebsd.org Thu Jul 29 15:25: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 59664675F30; Thu, 29 Jul 2021 15:25: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 4GbDr00ZBVz4t24; Thu, 29 Jul 2021 15:25: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 64C6113FE7; Thu, 29 Jul 2021 15:25: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 16TFPZJ3010065; Thu, 29 Jul 2021 15:25:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16TFPZT7010064; Thu, 29 Jul 2021 15:25:35 GMT (envelope-from git) Date: Thu, 29 Jul 2021 15:25:35 GMT Message-Id: <202107291525.16TFPZT7010064@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: 862ea25915cc - stable/13 - hwpmc_arm64: add a PMCDBG to the interrupt handler 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 862ea25915ccb70d8a25ee2b2e792c3974717e51 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, 29 Jul 2021 15:25:36 -0000 The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=862ea25915ccb70d8a25ee2b2e792c3974717e51 commit 862ea25915ccb70d8a25ee2b2e792c3974717e51 Author: Mitchell Horne AuthorDate: 2021-05-19 16:29:59 +0000 Commit: Mitchell Horne CommitDate: 2021-07-29 15:05:55 +0000 hwpmc_arm64: add a PMCDBG to the interrupt handler MFC after: 3 days Sponsored by: The FreeBSD Foundation (cherry picked from commit 13f5a3076bc8f3774b82f2d5ca29e2e0e2af997b) --- sys/dev/hwpmc/hwpmc_arm64.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/dev/hwpmc/hwpmc_arm64.c b/sys/dev/hwpmc/hwpmc_arm64.c index 06e2e66c7fda..8a149f5f508f 100644 --- a/sys/dev/hwpmc/hwpmc_arm64.c +++ b/sys/dev/hwpmc/hwpmc_arm64.c @@ -359,6 +359,9 @@ arm64_intr(struct trapframe *tf) KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), ("[arm64,%d] CPU %d out of range", __LINE__, cpu)); + PMCDBG3(MDP,INT,1, "cpu=%d tf=%p um=%d", cpu, (void *)tf, + TRAPF_USERMODE(tf)); + retval = 0; pc = arm64_pcpu[cpu]; From owner-dev-commits-src-all@freebsd.org Thu Jul 29 15:25: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 C0580676105; Thu, 29 Jul 2021 15:25: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 4GbDr070r1z4t67; Thu, 29 Jul 2021 15:25: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 94370142C2; Thu, 29 Jul 2021 15:25: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 16TFPagf010095; Thu, 29 Jul 2021 15:25:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16TFPaWf010094; Thu, 29 Jul 2021 15:25:36 GMT (envelope-from git) Date: Thu, 29 Jul 2021 15:25:36 GMT Message-Id: <202107291525.16TFPaWf010094@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: 28ff0070f7c8 - stable/13 - libpmc: Import AMD Zen 3 PMU events 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 28ff0070f7c81f8a65b94e2ff8bb1e9cda98b065 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, 29 Jul 2021 15:25:37 -0000 The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=28ff0070f7c81f8a65b94e2ff8bb1e9cda98b065 commit 28ff0070f7c81f8a65b94e2ff8bb1e9cda98b065 Author: Greg V AuthorDate: 2021-06-30 21:15:21 +0000 Commit: Mitchell Horne CommitDate: 2021-07-29 15:05:55 +0000 libpmc: Import AMD Zen 3 PMU events Reviewed by: mav, mhorne MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D30965 (cherry picked from commit 8c2dd68caa963f1900a8228b0732b04f5d530ffa) --- lib/libpmc/pmu-events/arch/x86/amdzen3/branch.json | 53 +++ lib/libpmc/pmu-events/arch/x86/amdzen3/cache.json | 402 +++++++++++++++++++ lib/libpmc/pmu-events/arch/x86/amdzen3/core.json | 137 +++++++ .../pmu-events/arch/x86/amdzen3/data-fabric.json | 98 +++++ .../arch/x86/amdzen3/floating-point.json | 139 +++++++ lib/libpmc/pmu-events/arch/x86/amdzen3/memory.json | 428 +++++++++++++++++++++ lib/libpmc/pmu-events/arch/x86/amdzen3/other.json | 103 +++++ .../pmu-events/arch/x86/amdzen3/recommended.json | 214 +++++++++++ lib/libpmc/pmu-events/arch/x86/mapfile.csv | 1 + 9 files changed, 1575 insertions(+) diff --git a/lib/libpmc/pmu-events/arch/x86/amdzen3/branch.json b/lib/libpmc/pmu-events/arch/x86/amdzen3/branch.json new file mode 100644 index 000000000000..018a7fe94fb9 --- /dev/null +++ b/lib/libpmc/pmu-events/arch/x86/amdzen3/branch.json @@ -0,0 +1,53 @@ +[ + { + "EventName": "bp_l1_btb_correct", + "EventCode": "0x8a", + "BriefDescription": "L1 Branch Prediction Overrides Existing Prediction (speculative)." + }, + { + "EventName": "bp_l2_btb_correct", + "EventCode": "0x8b", + "BriefDescription": "L2 Branch Prediction Overrides Existing Prediction (speculative)." + }, + { + "EventName": "bp_dyn_ind_pred", + "EventCode": "0x8e", + "BriefDescription": "Dynamic Indirect Predictions.", + "PublicDescription": "The number of times a branch used the indirect predictor to make a prediction." + }, + { + "EventName": "bp_de_redirect", + "EventCode": "0x91", + "BriefDescription": "Decode Redirects", + "PublicDescription": "The number of times the instruction decoder overrides the predicted target." + }, + { + "EventName": "bp_l1_tlb_fetch_hit", + "EventCode": "0x94", + "BriefDescription": "The number of instruction fetches that hit in the L1 ITLB.", + "UMask": "0xff" + }, + { + "EventName": "bp_l1_tlb_fetch_hit.if1g", + "EventCode": "0x94", + "BriefDescription": "The number of instruction fetches that hit in the L1 ITLB. L1 Instruction TLB hit (1G page size).", + "UMask": "0x04" + }, + { + "EventName": "bp_l1_tlb_fetch_hit.if2m", + "EventCode": "0x94", + "BriefDescription": "The number of instruction fetches that hit in the L1 ITLB. L1 Instruction TLB hit (2M page size).", + "UMask": "0x02" + }, + { + "EventName": "bp_l1_tlb_fetch_hit.if4k", + "EventCode": "0x94", + "BriefDescription": "The number of instruction fetches that hit in the L1 ITLB. L1 Instrcution TLB hit (4K or 16K page size).", + "UMask": "0x01" + }, + { + "EventName": "bp_tlb_rel", + "EventCode": "0x99", + "BriefDescription": "The number of ITLB reload requests." + } +] diff --git a/lib/libpmc/pmu-events/arch/x86/amdzen3/cache.json b/lib/libpmc/pmu-events/arch/x86/amdzen3/cache.json new file mode 100644 index 000000000000..fa1d7499a2e3 --- /dev/null +++ b/lib/libpmc/pmu-events/arch/x86/amdzen3/cache.json @@ -0,0 +1,402 @@ +[ + { + "EventName": "l2_request_g1.rd_blk_l", + "EventCode": "0x60", + "BriefDescription": "All L2 Cache Requests (Breakdown 1 - Common). Data cache reads (including hardware and software prefetch).", + "UMask": "0x80" + }, + { + "EventName": "l2_request_g1.rd_blk_x", + "EventCode": "0x60", + "BriefDescription": "All L2 Cache Requests (Breakdown 1 - Common). Data cache stores.", + "UMask": "0x40" + }, + { + "EventName": "l2_request_g1.ls_rd_blk_c_s", + "EventCode": "0x60", + "BriefDescription": "All L2 Cache Requests (Breakdown 1 - Common). Data cache shared reads.", + "UMask": "0x20" + }, + { + "EventName": "l2_request_g1.cacheable_ic_read", + "EventCode": "0x60", + "BriefDescription": "All L2 Cache Requests (Breakdown 1 - Common). Instruction cache reads.", + "UMask": "0x10" + }, + { + "EventName": "l2_request_g1.change_to_x", + "EventCode": "0x60", + "BriefDescription": "All L2 Cache Requests (Breakdown 1 - Common). Data cache state change requests. Request change to writable, check L2 for current state.", + "UMask": "0x08" + }, + { + "EventName": "l2_request_g1.prefetch_l2_cmd", + "EventCode": "0x60", + "BriefDescription": "All L2 Cache Requests (Breakdown 1 - Common). PrefetchL2Cmd.", + "UMask": "0x04" + }, + { + "EventName": "l2_request_g1.l2_hw_pf", + "EventCode": "0x60", + "BriefDescription": "All L2 Cache Requests (Breakdown 1 - Common). L2 Prefetcher. All prefetches accepted by L2 pipeline, hit or miss. Types of PF and L2 hit/miss broken out in a separate perfmon event.", + "UMask": "0x02" + }, + { + "EventName": "l2_request_g1.group2", + "EventCode": "0x60", + "BriefDescription": "Miscellaneous events covered in more detail by l2_request_g2 (PMCx061).", + "UMask": "0x01" + }, + { + "EventName": "l2_request_g1.all_no_prefetch", + "EventCode": "0x60", + "UMask": "0xf9" + }, + { + "EventName": "l2_request_g2.group1", + "EventCode": "0x61", + "BriefDescription": "Miscellaneous events covered in more detail by l2_request_g1 (PMCx060).", + "UMask": "0x80" + }, + { + "EventName": "l2_request_g2.ls_rd_sized", + "EventCode": "0x61", + "BriefDescription": "All L2 Cache Requests (Breakdown 2 - Rare). Data cache read sized.", + "UMask": "0x40" + }, + { + "EventName": "l2_request_g2.ls_rd_sized_nc", + "EventCode": "0x61", + "BriefDescription": "All L2 Cache Requests (Breakdown 2 - Rare). Data cache read sized non-cacheable.", + "UMask": "0x20" + }, + { + "EventName": "l2_request_g2.ic_rd_sized", + "EventCode": "0x61", + "BriefDescription": "All L2 Cache Requests (Breakdown 2 - Rare). Instruction cache read sized.", + "UMask": "0x10" + }, + { + "EventName": "l2_request_g2.ic_rd_sized_nc", + "EventCode": "0x61", + "BriefDescription": "All L2 Cache Requests (Breakdown 2 - Rare). Instruction cache read sized non-cacheable.", + "UMask": "0x08" + }, + { + "EventName": "l2_request_g2.smc_inval", + "EventCode": "0x61", + "BriefDescription": "All L2 Cache Requests (Breakdown 2 - Rare). Self-modifying code invalidates.", + "UMask": "0x04" + }, + { + "EventName": "l2_request_g2.bus_locks_originator", + "EventCode": "0x61", + "BriefDescription": "All L2 Cache Requests (Breakdown 2 - Rare). Bus locks.", + "UMask": "0x02" + }, + { + "EventName": "l2_request_g2.bus_locks_responses", + "EventCode": "0x61", + "BriefDescription": "All L2 Cache Requests (Breakdown 2 - Rare). Bus lock response.", + "UMask": "0x01" + }, + { + "EventName": "l2_latency.l2_cycles_waiting_on_fills", + "EventCode": "0x62", + "BriefDescription": "Total cycles spent waiting for L2 fills to complete from L3 or memory, divided by four. Event counts are for both threads. To calculate average latency, the number of fills from both threads must be used.", + "UMask": "0x01" + }, + { + "EventName": "l2_wcb_req.wcb_write", + "EventCode": "0x63", + "BriefDescription": "LS to L2 WCB write requests. LS (Load/Store unit) to L2 WCB (Write Combining Buffer) write requests.", + "UMask": "0x40" + }, + { + "EventName": "l2_wcb_req.wcb_close", + "EventCode": "0x63", + "BriefDescription": "LS to L2 WCB close requests. LS (Load/Store unit) to L2 WCB (Write Combining Buffer) close requests.", + "UMask": "0x20" + }, + { + "EventName": "l2_wcb_req.zero_byte_store", + "EventCode": "0x63", + "BriefDescription": "LS to L2 WCB zero byte store requests. LS (Load/Store unit) to L2 WCB (Write Combining Buffer) zero byte store requests.", + "UMask": "0x04" + }, + { + "EventName": "l2_wcb_req.cl_zero", + "EventCode": "0x63", + "BriefDescription": "LS to L2 WCB cache line zeroing requests. LS (Load/Store unit) to L2 WCB (Write Combining Buffer) cache line zeroing requests.", + "UMask": "0x01" + }, + { + "EventName": "l2_cache_req_stat.ls_rd_blk_cs", + "EventCode": "0x64", + "BriefDescription": "Core to L2 cacheable request access status (not including L2 Prefetch). Data cache shared read hit in L2", + "UMask": "0x80" + }, + { + "EventName": "l2_cache_req_stat.ls_rd_blk_l_hit_x", + "EventCode": "0x64", + "BriefDescription": "Core to L2 cacheable request access status (not including L2 Prefetch). Data cache read hit in L2. Modifiable.", + "UMask": "0x40" + }, + { + "EventName": "l2_cache_req_stat.ls_rd_blk_l_hit_s", + "EventCode": "0x64", + "BriefDescription": "Core to L2 cacheable request access status (not including L2 Prefetch). Data cache read hit non-modifiable line in L2.", + "UMask": "0x20" + }, + { + "EventName": "l2_cache_req_stat.ls_rd_blk_x", + "EventCode": "0x64", + "BriefDescription": "Core to L2 cacheable request access status (not including L2 Prefetch). Data cache store or state change hit in L2.", + "UMask": "0x10" + }, + { + "EventName": "l2_cache_req_stat.ls_rd_blk_c", + "EventCode": "0x64", + "BriefDescription": "Core to L2 cacheable request access status (not including L2 Prefetch). Data cache request miss in L2 (all types). Use l2_cache_misses_from_dc_misses instead.", + "UMask": "0x08" + }, + { + "EventName": "l2_cache_req_stat.ic_fill_hit_x", + "EventCode": "0x64", + "BriefDescription": "Core to L2 cacheable request access status (not including L2 Prefetch). Instruction cache hit modifiable line in L2.", + "UMask": "0x04" + }, + { + "EventName": "l2_cache_req_stat.ic_fill_hit_s", + "EventCode": "0x64", + "BriefDescription": "Core to L2 cacheable request access status (not including L2 Prefetch). Instruction cache hit non-modifiable line in L2.", + "UMask": "0x02" + }, + { + "EventName": "l2_cache_req_stat.ic_fill_miss", + "EventCode": "0x64", + "BriefDescription": "Core to L2 cacheable request access status (not including L2 Prefetch). Instruction cache request miss in L2. Use l2_cache_misses_from_ic_miss instead.", + "UMask": "0x01" + }, + { + "EventName": "l2_cache_req_stat.ic_access_in_l2", + "EventCode": "0x64", + "BriefDescription": "Core to L2 cacheable request access status (not including L2 Prefetch). Instruction cache requests in L2.", + "UMask": "0x07" + }, + { + "EventName": "l2_cache_req_stat.ic_dc_miss_in_l2", + "EventCode": "0x64", + "BriefDescription": "Core to L2 cacheable request access status (not including L2 Prefetch). Instruction cache request miss in L2 and Data cache request miss in L2 (all types).", + "UMask": "0x09" + }, + { + "EventName": "l2_cache_req_stat.ic_dc_hit_in_l2", + "EventCode": "0x64", + "BriefDescription": "Core to L2 cacheable request access status (not including L2 Prefetch). Instruction cache request hit in L2 and Data cache request hit in L2 (all types).", + "UMask": "0xf6" + }, + { + "EventName": "l2_fill_pending.l2_fill_busy", + "EventCode": "0x6d", + "BriefDescription": "Cycles with fill pending from L2. Total cycles spent with one or more fill requests in flight from L2.", + "UMask": "0x01" + }, + { + "EventName": "l2_pf_hit_l2", + "EventCode": "0x70", + "BriefDescription": "L2 prefetch hit in L2. Use l2_cache_hits_from_l2_hwpf instead.", + "UMask": "0xff" + }, + { + "EventName": "l2_pf_miss_l2_hit_l3", + "EventCode": "0x71", + "BriefDescription": "L2 prefetcher hits in L3. Counts all L2 prefetches accepted by the L2 pipeline which miss the L2 cache and hit the L3.", + "UMask": "0xff" + }, + { + "EventName": "l2_pf_miss_l2_l3", + "EventCode": "0x72", + "BriefDescription": "L2 prefetcher misses in L3. Counts all L2 prefetches accepted by the L2 pipeline which miss the L2 and the L3 caches.", + "UMask": "0xff" + }, + { + "EventName": "ic_fw32", + "EventCode": "0x80", + "BriefDescription": "The number of 32B fetch windows transferred from IC pipe to DE instruction decoder (includes non-cacheable and cacheable fill responses)." + }, + { + "EventName": "ic_fw32_miss", + "EventCode": "0x81", + "BriefDescription": "The number of 32B fetch windows tried to read the L1 IC and missed in the full tag." + }, + { + "EventName": "ic_cache_fill_l2", + "EventCode": "0x82", + "BriefDescription": "Instruction Cache Refills from L2. The number of 64 byte instruction cache line was fulfilled from the L2 cache." + }, + { + "EventName": "ic_cache_fill_sys", + "EventCode": "0x83", + "BriefDescription": "Instruction Cache Refills from System. The number of 64 byte instruction cache line fulfilled from system memory or another cache." + }, + { + "EventName": "bp_l1_tlb_miss_l2_tlb_hit", + "EventCode": "0x84", + "BriefDescription": "L1 ITLB Miss, L2 ITLB Hit. The number of instruction fetches that miss in the L1 ITLB but hit in the L2 ITLB." + }, + { + "EventName": "bp_l1_tlb_miss_l2_tlb_miss", + "EventCode": "0x85", + "BriefDescription": "The number of instruction fetches that miss in both the L1 and L2 TLBs.", + "UMask": "0xff" + }, + { + "EventName": "bp_l1_tlb_miss_l2_tlb_miss.coalesced_4k", + "EventCode": "0x85", + "BriefDescription": "The number of valid fills into the ITLB originating from the LS Page-Table Walker. Tablewalk requests are issued for L1-ITLB and L2-ITLB misses. Walk for >4K Coalesced page.", + "UMask": "0x08" + }, + { + "EventName": "bp_l1_tlb_miss_l2_tlb_miss.if1g", + "EventCode": "0x85", + "BriefDescription": "The number of valid fills into the ITLB originating from the LS Page-Table Walker. Tablewalk requests are issued for L1-ITLB and L2-ITLB misses. Walk for 1G page.", + "UMask": "0x04" + }, + { + "EventName": "bp_l1_tlb_miss_l2_tlb_miss.if2m", + "EventCode": "0x85", + "BriefDescription": "The number of valid fills into the ITLB originating from the LS Page-Table Walker. Tablewalk requests are issued for L1-ITLB and L2-ITLB misses. Walk for 2M page.", + "UMask": "0x02" + }, + { + "EventName": "bp_l1_tlb_miss_l2_tlb_miss.if4k", + "EventCode": "0x85", + "BriefDescription": "The number of valid fills into the ITLB originating from the LS Page-Table Walker. Tablewalk requests are issued for L1-ITLB and L2-ITLB misses. Walk to 4K page.", + "UMask": "0x01" + }, + { + "EventName": "bp_snp_re_sync", + "EventCode": "0x86", + "BriefDescription": "The number of pipeline restarts caused by invalidating probes that hit on the instruction stream currently being executed. This would happen if the active instruction stream was being modified by another processor in an MP system - typically a highly unlikely event." + }, + { + "EventName": "ic_fetch_stall.ic_stall_any", + "EventCode": "0x87", + "BriefDescription": "Instruction Pipe Stall. IC pipe was stalled during this clock cycle for any reason (nothing valid in pipe ICM1).", + "UMask": "0x04" + }, + { + "EventName": "ic_fetch_stall.ic_stall_dq_empty", + "EventCode": "0x87", + "BriefDescription": "Instruction Pipe Stall. IC pipe was stalled during this clock cycle (including IC to OC fetches) due to DQ empty.", + "UMask": "0x02" + }, + { + "EventName": "ic_fetch_stall.ic_stall_back_pressure", + "EventCode": "0x87", + "BriefDescription": "Instruction Pipe Stall. IC pipe was stalled during this clock cycle (including IC to OC fetches) due to back-pressure.", + "UMask": "0x01" + }, + { + "EventName": "ic_cache_inval.l2_invalidating_probe", + "EventCode": "0x8c", + "BriefDescription": "IC line invalidated due to L2 invalidating probe (external or LS). The number of instruction cache lines invalidated. A non-SMC event is CMC (cross modifying code), either from the other thread of the core or another core.", + "UMask": "0x02" + }, + { + "EventName": "ic_cache_inval.fill_invalidated", + "EventCode": "0x8c", + "BriefDescription": "IC line invalidated due to overwriting fill response. The number of instruction cache lines invalidated. A non-SMC event is CMC (cross modifying code), either from the other thread of the core or another core.", + "UMask": "0x01" + }, + { + "EventName": "ic_tag_hit_miss.all_instruction_cache_accesses", + "EventCode": "0x18e", + "BriefDescription": "All Instruction Cache Accesses. Counts various IC tag related hit and miss events.", + "UMask": "0x1f" + }, + { + "EventName": "ic_tag_hit_miss.instruction_cache_miss", + "EventCode": "0x18e", + "BriefDescription": "Instruction Cache Miss. Counts various IC tag related hit and miss events.", + "UMask": "0x18" + }, + { + "EventName": "ic_tag_hit_miss.instruction_cache_hit", + "EventCode": "0x18e", + "BriefDescription": "Instruction Cache Hit. Counts various IC tag related hit and miss events.", + "UMask": "0x07" + }, + { + "EventName": "ic_oc_mode_switch.oc_ic_mode_switch", + "EventCode": "0x28a", + "BriefDescription": "OC Mode Switch. OC to IC mode switch.", + "UMask": "0x02" + }, + { + "EventName": "ic_oc_mode_switch.ic_oc_mode_switch", + "EventCode": "0x28a", + "BriefDescription": "OC Mode Switch. IC to OC mode switch.", + "UMask": "0x01" + }, + { + "EventName": "op_cache_hit_miss.all_op_cache_accesses", + "EventCode": "0x28f", + "BriefDescription": "All Op Cache accesses. Counts Op Cache micro-tag hit/miss events", + "UMask": "0x07" + }, + { + "EventName": "op_cache_hit_miss.op_cache_miss", + "EventCode": "0x28f", + "BriefDescription": "Op Cache Miss. Counts Op Cache micro-tag hit/miss events", + "UMask": "0x04" + }, + { + "EventName": "op_cache_hit_miss.op_cache_hit", + "EventCode": "0x28f", + "BriefDescription": "Op Cache Hit. Counts Op Cache micro-tag hit/miss events", + "UMask": "0x03" + }, + { + "EventName": "l3_request_g1.caching_l3_cache_accesses", + "EventCode": "0x01", + "BriefDescription": "Caching: L3 cache accesses", + "UMask": "0x80", + "Unit": "L3PMC" + }, + { + "EventName": "l3_lookup_state.all_l3_req_typs", + "EventCode": "0x04", + "BriefDescription": "All L3 Request Types. All L3 cache Requests", + "UMask": "0xff", + "Unit": "L3PMC" + }, + { + "EventName": "l3_comb_clstr_state.other_l3_miss_typs", + "EventCode": "0x06", + "BriefDescription": "Other L3 Miss Request Types", + "UMask": "0xfe", + "Unit": "L3PMC" + }, + { + "EventName": "l3_comb_clstr_state.request_miss", + "EventCode": "0x06", + "BriefDescription": "L3 cache misses", + "UMask": "0x01", + "Unit": "L3PMC" + }, + { + "EventName": "xi_sys_fill_latency", + "EventCode": "0x90", + "BriefDescription": "L3 Cache Miss Latency. Total cycles for all transactions divided by 16. Ignores SliceMask and ThreadMask.", + "Unit": "L3PMC" + }, + { + "EventName": "xi_ccx_sdp_req1", + "EventCode": "0x9a", + "BriefDescription": "L3 Misses by Request Type. Ignores SliceID, EnAllSlices, CoreID, EnAllCores and ThreadMask. Requires unit mask 0xFF to engage event for counting.", + "UMask": "0xff", + "Unit": "L3PMC" + } +] diff --git a/lib/libpmc/pmu-events/arch/x86/amdzen3/core.json b/lib/libpmc/pmu-events/arch/x86/amdzen3/core.json new file mode 100644 index 000000000000..4e27a2be359e --- /dev/null +++ b/lib/libpmc/pmu-events/arch/x86/amdzen3/core.json @@ -0,0 +1,137 @@ +[ + { + "EventName": "ex_ret_instr", + "EventCode": "0xc0", + "BriefDescription": "Retired Instructions." + }, + { + "EventName": "ex_ret_ops", + "EventCode": "0xc1", + "BriefDescription": "Retired Ops. Use macro_ops_retired instead.", + "PublicDescription": "The number of macro-ops retired." + }, + { + "EventName": "ex_ret_brn", + "EventCode": "0xc2", + "BriefDescription": "Retired Branch Instructions.", + "PublicDescription": "The number of branch instructions retired. This includes all types of architectural control flow changes, including exceptions and interrupts." + }, + { + "EventName": "ex_ret_brn_misp", + "EventCode": "0xc3", + "BriefDescription": "Retired Branch Instructions Mispredicted.", + "PublicDescription": "The number of retired branch instructions, that were mispredicted." + }, + { + "EventName": "ex_ret_brn_tkn", + "EventCode": "0xc4", + "BriefDescription": "Retired Taken Branch Instructions.", + "PublicDescription": "The number of taken branches that were retired. This includes all types of architectural control flow changes, including exceptions and interrupts." + }, + { + "EventName": "ex_ret_brn_tkn_misp", + "EventCode": "0xc5", + "BriefDescription": "Retired Taken Branch Instructions Mispredicted.", + "PublicDescription": "The number of retired taken branch instructions that were mispredicted." + }, + { + "EventName": "ex_ret_brn_far", + "EventCode": "0xc6", + "BriefDescription": "Retired Far Control Transfers.", + "PublicDescription": "The number of far control transfers retired including far call/jump/return, IRET, SYSCALL and SYSRET, plus exceptions and interrupts. Far control transfers are not subject to branch prediction." + }, + { + "EventName": "ex_ret_brn_resync", + "EventCode": "0xc7", + "BriefDescription": "Retired Branch Resyncs.", + "PublicDescription": "The number of resync branches. These reflect pipeline restarts due to certain microcode assists and events such as writes to the active instruction stream, among other things. Each occurrence reflects a restart penalty similar to a branch mispredict. This is relatively rare." + }, + { + "EventName": "ex_ret_near_ret", + "EventCode": "0xc8", + "BriefDescription": "Retired Near Returns.", + "PublicDescription": "The number of near return instructions (RET or RET Iw) retired." + }, + { + "EventName": "ex_ret_near_ret_mispred", + "EventCode": "0xc9", + "BriefDescription": "Retired Near Returns Mispredicted.", + "PublicDescription": "The number of near returns retired that were not correctly predicted by the return address predictor. Each such mispredict incurs the same penalty as a mispredicted conditional branch instruction." + }, + { + "EventName": "ex_ret_brn_ind_misp", + "EventCode": "0xca", + "BriefDescription": "Retired Indirect Branch Instructions Mispredicted.", + "PublicDescription": "The number of indirect branches retired that were not correctly predicted. Each such mispredict incurs the same penalty as a mispredicted conditional branch instruction. Note that only EX mispredicts are counted." + }, + { + "EventName": "ex_ret_mmx_fp_instr.sse_instr", + "EventCode": "0xcb", + "BriefDescription": "SSE instructions (SSE, SSE2, SSE3, SSSE3, SSE4A, SSE41, SSE42, AVX).", + "PublicDescription": "The number of MMX, SSE or x87 instructions retired. The UnitMask allows the selection of the individual classes of instructions as given in the table. Each increment represents one complete instruction. Since this event includes non-numeric instructions it is not suitable for measuring MFLOPS.", + "UMask": "0x04" + }, + { + "EventName": "ex_ret_mmx_fp_instr.mmx_instr", + "EventCode": "0xcb", + "BriefDescription": "MMX instructions.", + "PublicDescription": "The number of MMX, SSE or x87 instructions retired. The UnitMask allows the selection of the individual classes of instructions as given in the table. Each increment represents one complete instruction. Since this event includes non-numeric instructions it is not suitable for measuring MFLOPS. MMX instructions.", + "UMask": "0x02" + }, + { + "EventName": "ex_ret_mmx_fp_instr.x87_instr", + "EventCode": "0xcb", + "BriefDescription": "x87 instructions.", + "PublicDescription": "The number of MMX, SSE or x87 instructions retired. The UnitMask allows the selection of the individual classes of instructions as given in the table. Each increment represents one complete instruction. Since this event includes non-numeric instructions it is not suitable for measuring MFLOPS. x87 instructions.", + "UMask": "0x01" + }, + { + "EventName": "ex_ret_ind_brch_instr", + "EventCode": "0xcc", + "BriefDescription": "Retired Indirect Branch Instructions. The number of indirect branches retired." + }, + { + "EventName": "ex_ret_cond", + "EventCode": "0xd1", + "BriefDescription": "Retired Conditional Branch Instructions." + }, + { + "EventName": "ex_div_busy", + "EventCode": "0xd3", + "BriefDescription": "Div Cycles Busy count." + }, + { + "EventName": "ex_div_count", + "EventCode": "0xd4", + "BriefDescription": "Div Op Count." + }, + { + "EventName": "ex_ret_msprd_brnch_instr_dir_msmtch", + "EventCode": "0x1c7", + "BriefDescription": "Retired Mispredicted Branch Instructions due to Direction Mismatch", + "PublicDescription": "The number of retired conditional branch instructions that were not correctly predicted because of a branch direction mismatch." + }, + { + "EventName": "ex_tagged_ibs_ops.ibs_count_rollover", + "EventCode": "0x1cf", + "BriefDescription": "Tagged IBS Ops. Number of times an op could not be tagged by IBS because of a previous tagged op that has not retired.", + "UMask": "0x04" + }, + { + "EventName": "ex_tagged_ibs_ops.ibs_tagged_ops_ret", + "EventCode": "0x1cf", + "BriefDescription": "Tagged IBS Ops. Number of Ops tagged by IBS that retired.", + "UMask": "0x02" + }, + { + "EventName": "ex_tagged_ibs_ops.ibs_tagged_ops", + "EventCode": "0x1cf", + "BriefDescription": "Tagged IBS Ops. Number of Ops tagged by IBS.", + "UMask": "0x01" + }, + { + "EventName": "ex_ret_fused_instr", + "EventCode": "0x1d0", + "BriefDescription": "Counts retired Fused Instructions." + } +] diff --git a/lib/libpmc/pmu-events/arch/x86/amdzen3/data-fabric.json b/lib/libpmc/pmu-events/arch/x86/amdzen3/data-fabric.json new file mode 100644 index 000000000000..40271df40015 --- /dev/null +++ b/lib/libpmc/pmu-events/arch/x86/amdzen3/data-fabric.json @@ -0,0 +1,98 @@ +[ + { + "EventName": "remote_outbound_data_controller_0", + "PublicDescription": "Remote Link Controller Outbound Packet Types: Data (32B): Remote Link Controller 0", + "EventCode": "0x7c7", + "UMask": "0x02", + "PerPkg": "1", + "Unit": "DFPMC" + }, + { + "EventName": "remote_outbound_data_controller_1", + "PublicDescription": "Remote Link Controller Outbound Packet Types: Data (32B): Remote Link Controller 1", + "EventCode": "0x807", + "UMask": "0x02", + "PerPkg": "1", + "Unit": "DFPMC" + }, + { + "EventName": "remote_outbound_data_controller_2", + "PublicDescription": "Remote Link Controller Outbound Packet Types: Data (32B): Remote Link Controller 2", + "EventCode": "0x847", + "UMask": "0x02", + "PerPkg": "1", + "Unit": "DFPMC" + }, + { + "EventName": "remote_outbound_data_controller_3", + "PublicDescription": "Remote Link Controller Outbound Packet Types: Data (32B): Remote Link Controller 3", + "EventCode": "0x887", + "UMask": "0x02", + "PerPkg": "1", + "Unit": "DFPMC" + }, + { + "EventName": "dram_channel_data_controller_0", + "PublicDescription": "DRAM Channel Controller Request Types: Requests with Data (64B): DRAM Channel Controller 0", + "EventCode": "0x07", + "UMask": "0x38", + "PerPkg": "1", + "Unit": "DFPMC" + }, + { + "EventName": "dram_channel_data_controller_1", + "PublicDescription": "DRAM Channel Controller Request Types: Requests with Data (64B): DRAM Channel Controller 0", + "EventCode": "0x47", + "UMask": "0x38", + "PerPkg": "1", + "Unit": "DFPMC" + }, + { + "EventName": "dram_channel_data_controller_2", + "PublicDescription": "DRAM Channel Controller Request Types: Requests with Data (64B): DRAM Channel Controller 0", + "EventCode": "0x87", + "UMask": "0x38", + "PerPkg": "1", + "Unit": "DFPMC" + }, + { + "EventName": "dram_channel_data_controller_3", + "PublicDescription": "DRAM Channel Controller Request Types: Requests with Data (64B): DRAM Channel Controller 0", + "EventCode": "0xc7", + "UMask": "0x38", + "PerPkg": "1", + "Unit": "DFPMC" + }, + { + "EventName": "dram_channel_data_controller_4", + "PublicDescription": "DRAM Channel Controller Request Types: Requests with Data (64B): DRAM Channel Controller 0", + "EventCode": "0x107", + "UMask": "0x38", + "PerPkg": "1", + "Unit": "DFPMC" + }, + { + "EventName": "dram_channel_data_controller_5", + "PublicDescription": "DRAM Channel Controller Request Types: Requests with Data (64B): DRAM Channel Controller 0", + "EventCode": "0x147", + "UMask": "0x38", + "PerPkg": "1", + "Unit": "DFPMC" + }, + { + "EventName": "dram_channel_data_controller_6", + "PublicDescription": "DRAM Channel Controller Request Types: Requests with Data (64B): DRAM Channel Controller 0", + "EventCode": "0x187", + "UMask": "0x38", + "PerPkg": "1", + "Unit": "DFPMC" + }, + { + "EventName": "dram_channel_data_controller_7", + "PublicDescription": "DRAM Channel Controller Request Types: Requests with Data (64B): DRAM Channel Controller 0", + "EventCode": "0x1c7", + "UMask": "0x38", + "PerPkg": "1", + "Unit": "DFPMC" + } +] diff --git a/lib/libpmc/pmu-events/arch/x86/amdzen3/floating-point.json b/lib/libpmc/pmu-events/arch/x86/amdzen3/floating-point.json new file mode 100644 index 000000000000..98cfcb9c78ec --- /dev/null +++ b/lib/libpmc/pmu-events/arch/x86/amdzen3/floating-point.json @@ -0,0 +1,139 @@ +[ + { + "EventName": "fpu_pipe_assignment.total", + "EventCode": "0x00", + "BriefDescription": "Total number of fp uOps.", + "PublicDescription": "Total number of fp uOps. The number of operations (uOps) dispatched to each of the 4 FPU execution pipelines. This event reflects how busy the FPU pipelines are and may be used for workload characterization. This includes all operations performed by x87, MMX, and SSE instructions, including moves. Each increment represents a one- cycle dispatch event. This event is a speculative event. Since this event includes non-numeric operations it is not suitable for measuring MFLOPS.", + "UMask": "0x0f" + }, + { + "EventName": "fpu_pipe_assignment.total3", + "EventCode": "0x00", + "BriefDescription": "Total number uOps assigned to pipe 3.", + "PublicDescription": "The number of operations (uOps) dispatched to each of the 4 FPU execution pipelines. This event reflects how busy the FPU pipelines are and may be used for workload characterization. This includes all operations performed by x87, MMX, and SSE instructions, including moves. Each increment represents a one-cycle dispatch event. This event is a speculative event. Since this event includes non-numeric operations it is not suitable for measuring MFLOPS. Total number uOps assigned to pipe 3.", + "UMask": "0x08" + }, + { + "EventName": "fpu_pipe_assignment.total2", + "EventCode": "0x00", + "BriefDescription": "Total number uOps assigned to pipe 2.", + "PublicDescription": "The number of operations (uOps) dispatched to each of the 4 FPU execution pipelines. This event reflects how busy the FPU pipelines are and may be used for workload characterization. This includes all operations performed by x87, MMX, and SSE instructions, including moves. Each increment represents a one- cycle dispatch event. This event is a speculative event. Since this event includes non-numeric operations it is not suitable for measuring MFLOPS. Total number uOps assigned to pipe 2.", + "UMask": "0x04" + }, + { + "EventName": "fpu_pipe_assignment.total1", + "EventCode": "0x00", + "BriefDescription": "Total number uOps assigned to pipe 1.", + "PublicDescription": "The number of operations (uOps) dispatched to each of the 4 FPU execution pipelines. This event reflects how busy the FPU pipelines are and may be used for workload characterization. This includes all operations performed by x87, MMX, and SSE instructions, including moves. Each increment represents a one- cycle dispatch event. This event is a speculative event. Since this event includes non-numeric operations it is not suitable for measuring MFLOPS. Total number uOps assigned to pipe 1.", + "UMask": "0x02" + }, + { + "EventName": "fpu_pipe_assignment.total0", + "EventCode": "0x00", + "BriefDescription": "Total number of fp uOps on pipe 0.", + "PublicDescription": "The number of operations (uOps) dispatched to each of the 4 FPU execution pipelines. This event reflects how busy the FPU pipelines are and may be used for workload characterization. This includes all operations performed by x87, MMX, and SSE instructions, including moves. Each increment represents a one- cycle dispatch event. This event is a speculative event. Since this event includes non-numeric operations it is not suitable for measuring MFLOPS. Total number uOps assigned to pipe 0.", + "UMask": "0x01" + }, + { + "EventName": "fp_ret_sse_avx_ops.all", + "EventCode": "0x03", + "BriefDescription": "All FLOPS. This is a retire-based event. The number of retired SSE/AVX FLOPS. The number of events logged per cycle can vary from 0 to 64. This event can count above 15.", + "UMask": "0xff" + }, + { + "EventName": "fp_ret_sse_avx_ops.mac_flops", + "EventCode": "0x03", + "BriefDescription": "Multiply-Accumulate FLOPs. Each MAC operation is counted as 2 FLOPS. This is a retire-based event. The number of retired SSE/AVX FLOPs. The number of events logged per cycle can vary from 0 to 64. This event requires the use of the MergeEvent since it can count above 15 events per cycle. See 2.1.17.3 [Large Increment per Cycle Events]. It does not provide a useful count without the use of the MergeEvent.", + "UMask": "0x08" + }, + { + "EventName": "fp_ret_sse_avx_ops.div_flops", + "EventCode": "0x03", + "BriefDescription": "Divide/square root FLOPs. This is a retire-based event. The number of retired SSE/AVX FLOPs. The number of events logged per cycle can vary from 0 to 64. This event requires the use of the MergeEvent since it can count above 15 events per cycle. See 2.1.17.3 [Large Increment per Cycle Events]. It does not provide a useful count without the use of the MergeEvent.", + "UMask": "0x04" + }, + { + "EventName": "fp_ret_sse_avx_ops.mult_flops", + "EventCode": "0x03", + "BriefDescription": "Multiply FLOPs. This is a retire-based event. The number of retired SSE/AVX FLOPs. The number of events logged per cycle can vary from 0 to 64. This event requires the use of the MergeEvent since it can count above 15 events per cycle. See 2.1.17.3 [Large Increment per Cycle Events]. It does not provide a useful count without the use of the MergeEvent.", + "UMask": "0x02" + }, + { + "EventName": "fp_ret_sse_avx_ops.add_sub_flops", + "EventCode": "0x03", + "BriefDescription": "Add/subtract FLOPs. This is a retire-based event. The number of retired SSE/AVX FLOPs. The number of events logged per cycle can vary from 0 to 64. This event requires the use of the MergeEvent since it can count above 15 events per cycle. See 2.1.17.3 [Large Increment per Cycle Events]. It does not provide a useful count without the use of the MergeEvent.", + "UMask": "0x01" + }, + { + "EventName": "fp_num_mov_elim_scal_op.optimized", + "EventCode": "0x04", + "BriefDescription": "Number of Scalar Ops optimized. This is a dispatch based speculative event, and is useful for measuring the effectiveness of the Move elimination and Scalar code optimization schemes.", + "UMask": "0x08" + }, + { + "EventName": "fp_num_mov_elim_scal_op.opt_potential", + "EventCode": "0x04", + "BriefDescription": "Number of Ops that are candidates for optimization (have Z-bit either set or pass). This is a dispatch based speculative event, and is useful for measuring the effectiveness of the Move elimination and Scalar code optimization schemes.", + "UMask": "0x04" + }, + { + "EventName": "fp_num_mov_elim_scal_op.sse_mov_ops_elim", + "EventCode": "0x04", + "BriefDescription": "Number of SSE Move Ops eliminated. This is a dispatch based speculative event, and is useful for measuring the effectiveness of the Move elimination and Scalar code optimization schemes.", + "UMask": "0x02" + }, + { + "EventName": "fp_num_mov_elim_scal_op.sse_mov_ops", + "EventCode": "0x04", + "BriefDescription": "Number of SSE Move Ops. This is a dispatch based speculative event, and is useful for measuring the effectiveness of the Move elimination and Scalar code optimization schemes.", + "UMask": "0x01" + }, + { + "EventName": "fp_retired_ser_ops.sse_bot_ret", + "EventCode": "0x05", + "BriefDescription": "SSE/AVX bottom-executing ops retired. The number of serializing Ops retired.", + "UMask": "0x08" + }, + { + "EventName": "fp_retired_ser_ops.sse_ctrl_ret", + "EventCode": "0x05", + "BriefDescription": "SSE/AVX control word mispredict traps. The number of serializing Ops retired.", + "UMask": "0x04" + }, + { + "EventName": "fp_retired_ser_ops.x87_bot_ret", + "EventCode": "0x05", + "BriefDescription": "x87 bottom-executing ops retired. The number of serializing Ops retired.", + "UMask": "0x02" + }, + { + "EventName": "fp_retired_ser_ops.x87_ctrl_ret", + "EventCode": "0x05", + "BriefDescription": "x87 control word mispredict traps due to mispredictions in RC or PC, or changes in mask bits. The number of serializing Ops retired.", + "UMask": "0x01" + }, + { + "EventName": "fp_disp_faults.ymm_spill_fault", + "EventCode": "0x0e", + "BriefDescription": "Floating Point Dispatch Faults. YMM spill fault.", + "UMask": "0x08" + }, + { + "EventName": "fp_disp_faults.ymm_fill_fault", + "EventCode": "0x0e", + "BriefDescription": "Floating Point Dispatch Faults. YMM fill fault.", + "UMask": "0x04" + }, + { + "EventName": "fp_disp_faults.xmm_fill_fault", + "EventCode": "0x0e", + "BriefDescription": "Floating Point Dispatch Faults. XMM fill fault.", + "UMask": "0x02" + }, + { + "EventName": "fp_disp_faults.x87_fill_fault", + "EventCode": "0x0e", + "BriefDescription": "Floating Point Dispatch Faults. x87 fill fault.", + "UMask": "0x01" + } +] diff --git a/lib/libpmc/pmu-events/arch/x86/amdzen3/memory.json b/lib/libpmc/pmu-events/arch/x86/amdzen3/memory.json new file mode 100644 index 000000000000..a2833955dcd2 --- /dev/null +++ b/lib/libpmc/pmu-events/arch/x86/amdzen3/memory.json @@ -0,0 +1,428 @@ +[ + { + "EventName": "ls_bad_status2.stli_other", + "EventCode": "0x24", + "BriefDescription": "Non-forwardable conflict; used to reduce STLI's via software. All reasons. Store To Load Interlock (STLI) are loads that were unable to complete because of a possible match with an older store, and the older store could not do STLF for some reason.", + "PublicDescription" : "Store-to-load conflicts: A load was unable to complete due to a non-forwardable conflict with an older store. Most commonly, a load's address range partially but not completely overlaps with an uncompleted older store. Software can avoid this problem by using same-size and same-alignment loads and stores when accessing the same data. Vector/SIMD code is particularly susceptible to this problem; software should construct wide vector stores by manipulating vector elements in registers using shuffle/blend/swap instructions prior to storing to memory, instead of using narrow element-by-element stores.", + "UMask": "0x02" + }, + { + "EventName": "ls_locks.spec_lock_hi_spec", + "EventCode": "0x25", + "BriefDescription": "Retired lock instructions. High speculative cacheable lock speculation succeeded.", + "UMask": "0x08" + }, + { + "EventName": "ls_locks.spec_lock_lo_spec", + "EventCode": "0x25", + "BriefDescription": "Retired lock instructions. Low speculative cacheable lock speculation succeeded.", + "UMask": "0x04" + }, + { + "EventName": "ls_locks.non_spec_lock", + "EventCode": "0x25", + "BriefDescription": "Retired lock instructions. Non-speculative lock succeeded.", + "UMask": "0x02" + }, + { + "EventName": "ls_locks.bus_lock", + "EventCode": "0x25", + "BriefDescription": "Retired lock instructions. Comparable to legacy bus lock.", + "UMask": "0x01" + }, + { + "EventName": "ls_ret_cl_flush", + "EventCode": "0x26", + "BriefDescription": "The number of retired CLFLUSH instructions. This is a non-speculative event." + }, + { + "EventName": "ls_ret_cpuid", + "EventCode": "0x27", + "BriefDescription": "The number of CPUID instructions retired." + }, + { + "EventName": "ls_dispatch.ld_st_dispatch", + "EventCode": "0x29", + "BriefDescription": "Load-op-Store Dispatch. Dispatch of a single op that performs a load from and store to the same memory address. Counts the number of operations dispatched to the LS unit. Unit Masks ADDed.", + "UMask": "0x04" + }, + { + "EventName": "ls_dispatch.store_dispatch", + "EventCode": "0x29", + "BriefDescription": "Dispatch of a single op that performs a memory store. Counts the number of operations dispatched to the LS unit. Unit Masks ADDed.", + "UMask": "0x02" + }, + { + "EventName": "ls_dispatch.ld_dispatch", + "EventCode": "0x29", + "BriefDescription": "Dispatch of a single op that performs a memory load. Counts the number of operations dispatched to the LS unit. Unit Masks ADDed.", + "UMask": "0x01" + }, + { + "EventName": "ls_smi_rx", + "EventCode": "0x2b", + "BriefDescription": "Counts the number of SMIs received." + }, + { + "EventName": "ls_int_taken", + "EventCode": "0x2c", + "BriefDescription": "Counts the number of interrupts taken." + }, + { + "EventName": "ls_rdtsc", + "EventCode": "0x2d", + "BriefDescription": "Number of reads of the TSC (RDTSC instructions). The count is speculative." + }, + { + "EventName": "ls_stlf", + "EventCode": "0x35", + "BriefDescription": "Number of STLF hits." + }, + { + "EventName": "ls_st_commit_cancel2.st_commit_cancel_wcb_full", + "EventCode": "0x37", + "BriefDescription": "A non-cacheable store and the non-cacheable commit buffer is full.", + "UMask": "0x01" + }, + { + "EventName": "ls_dc_accesses", + "EventCode": "0x40", + "BriefDescription": "Number of accesses to the dcache for load/store references.", + "PublicDescription": "The number of accesses to the data cache for load and store references. This may include certain microcode scratchpad accesses, although these are generally rare. Each increment represents an eight-byte access, although the instruction may only be accessing a portion of that. This event is a speculative event." + }, + { *** 674 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Thu Jul 29 15:25: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 85B18676087; Thu, 29 Jul 2021 15:25: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 4GbDqw1lMnz4tB7; Thu, 29 Jul 2021 15:25: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 EB8EB143A3; Thu, 29 Jul 2021 15:25: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 16TFPV0v009989; Thu, 29 Jul 2021 15:25:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16TFPV0x009988; Thu, 29 Jul 2021 15:25:31 GMT (envelope-from git) Date: Thu, 29 Jul 2021 15:25:31 GMT Message-Id: <202107291525.16TFPV0x009988@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: a2d252f89fbc - stable/13 - hwpmc_arm64.c: fix return style 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/stable/13 X-Git-Reftype: branch X-Git-Commit: a2d252f89fbccae119c8401a6c9a89d8f088b765 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, 29 Jul 2021 15:25:32 -0000 The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=a2d252f89fbccae119c8401a6c9a89d8f088b765 commit a2d252f89fbccae119c8401a6c9a89d8f088b765 Author: Mitchell Horne AuthorDate: 2021-06-14 15:21:08 +0000 Commit: Mitchell Horne CommitDate: 2021-07-29 15:01:10 +0000 hwpmc_arm64.c: fix return style In accordance to style(9). MFC after: 3 days Sponsored by: The FreeBSD Foundation (cherry picked from commit 2129c8f6771a9a33253a1fe2d4e9d3494bc77f10) --- sys/dev/hwpmc/hwpmc_arm64.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sys/dev/hwpmc/hwpmc_arm64.c b/sys/dev/hwpmc/hwpmc_arm64.c index 050f861a74fe..ba98eaefcc9a 100644 --- a/sys/dev/hwpmc/hwpmc_arm64.c +++ b/sys/dev/hwpmc/hwpmc_arm64.c @@ -188,7 +188,7 @@ arm64_allocate_pmc(int cpu, int ri, struct pmc *pm, PMCDBG2(MDP, ALL, 2, "arm64-allocate ri=%d -> config=0x%x", ri, config); - return 0; + return (0); } @@ -231,7 +231,7 @@ arm64_read_pmc(int cpu, int ri, pmc_value_t *v) else *v = tmp; - return 0; + return (0); } static int @@ -254,7 +254,7 @@ arm64_write_pmc(int cpu, int ri, pmc_value_t v) pm->pm_pcpu_state[cpu].pps_overflowcnt = v >> 32; arm64_pmcn_write(ri, v); - return 0; + return (0); } static int @@ -277,7 +277,7 @@ arm64_config_pmc(int cpu, int ri, struct pmc *pm) phw->phw_pmc = pm; - return 0; + return (0); } static int @@ -305,7 +305,7 @@ arm64_start_pmc(int cpu, int ri) arm64_interrupt_enable(ri); arm64_counter_enable(ri); - return 0; + return (0); } static int @@ -323,7 +323,7 @@ arm64_stop_pmc(int cpu, int ri) arm64_counter_disable(ri); arm64_interrupt_disable(ri); - return 0; + return (0); } static int @@ -340,7 +340,7 @@ arm64_release_pmc(int cpu, int ri, struct pmc *pmc) KASSERT(phw->phw_pmc == NULL, ("[arm64,%d] PHW pmc %p non-NULL", __LINE__, phw->phw_pmc)); - return 0; + return (0); } static int From owner-dev-commits-src-all@freebsd.org Thu Jul 29 17:57: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 879E66512CB; Thu, 29 Jul 2021 17:57: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 4GbJC5390hz3swT; Thu, 29 Jul 2021 17:57: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 54FFF163AC; Thu, 29 Jul 2021 17:57: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 16THvLui009261; Thu, 29 Jul 2021 17:57:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16THvLSG009260; Thu, 29 Jul 2021 17:57:21 GMT (envelope-from git) Date: Thu, 29 Jul 2021 17:57:21 GMT Message-Id: <202107291757.16THvLSG009260@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Leandro Lupori Subject: git: 95d619a8ea1f - main - hwpmc: remove static POWER8 definitions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: luporl X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 95d619a8ea1f410ecea58bc534af770a010069ab 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, 29 Jul 2021 17:57:21 -0000 The branch main has been updated by luporl: URL: https://cgit.FreeBSD.org/src/commit/?id=95d619a8ea1f410ecea58bc534af770a010069ab commit 95d619a8ea1f410ecea58bc534af770a010069ab Author: Leandro Lupori AuthorDate: 2021-07-29 17:37:32 +0000 Commit: Leandro Lupori CommitDate: 2021-07-29 17:52:00 +0000 hwpmc: remove static POWER8 definitions After b48a2770d48b, static POWER8 definitions became unnecessary, as all of them (and much more) are already present in libpmc's PMU events. Submitted by: Leonardo Bianconi (initial version) Reviewed by: kbowling, mhorne Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br) Differential Revision: https://reviews.freebsd.org/D31334 --- lib/libpmc/libpmc.c | 21 +------ sys/dev/hwpmc/hwpmc_power8.c | 130 ------------------------------------------- sys/dev/hwpmc/pmc_events.h | 39 +------------ 3 files changed, 2 insertions(+), 188 deletions(-) diff --git a/lib/libpmc/libpmc.c b/lib/libpmc/libpmc.c index e2422f167267..4ff7eb893959 100644 --- a/lib/libpmc/libpmc.c +++ b/lib/libpmc/libpmc.c @@ -144,7 +144,6 @@ PMC_CLASSDEP_TABLE(mips74k, MIPS74K); PMC_CLASSDEP_TABLE(octeon, OCTEON); PMC_CLASSDEP_TABLE(ppc7450, PPC7450); PMC_CLASSDEP_TABLE(ppc970, PPC970); -PMC_CLASSDEP_TABLE(power8, POWER8); PMC_CLASSDEP_TABLE(e500, E500); static struct pmc_event_descr soft_event_table[PMC_EV_DYN_COUNT]; @@ -219,7 +218,6 @@ PMC_CLASS_TABLE_DESC(octeon, OCTEON, octeon, mips); #if defined(__powerpc__) PMC_CLASS_TABLE_DESC(ppc7450, PPC7450, ppc7450, powerpc); PMC_CLASS_TABLE_DESC(ppc970, PPC970, ppc970, powerpc); -PMC_CLASS_TABLE_DESC(power8, POWER8, power8, powerpc); PMC_CLASS_TABLE_DESC(e500, E500, e500, powerpc); #endif @@ -855,12 +853,6 @@ static struct pmc_event_alias ppc970_aliases[] = { EV_ALIAS(NULL, NULL) }; -static struct pmc_event_alias power8_aliases[] = { - EV_ALIAS("instructions", "INSTR_COMPLETED"), - EV_ALIAS("cycles", "CYCLES"), - EV_ALIAS(NULL, NULL) -}; - static struct pmc_event_alias e500_aliases[] = { EV_ALIAS("instructions", "INSTR_COMPLETED"), EV_ALIAS("cycles", "CYCLES"), @@ -1243,10 +1235,6 @@ pmc_event_names_of_class(enum pmc_class cl, const char ***eventnames, ev = ppc970_event_table; count = PMC_EVENT_TABLE_SIZE(ppc970); break; - case PMC_CLASS_POWER8: - ev = power8_event_table; - count = PMC_EVENT_TABLE_SIZE(power8); - break; case PMC_CLASS_E500: ev = e500_event_table; count = PMC_EVENT_TABLE_SIZE(e500); @@ -1465,10 +1453,6 @@ pmc_init(void) PMC_MDEP_INIT(ppc970); pmc_class_table[n] = &ppc970_class_table_descr; break; - case PMC_CPU_PPC_POWER8: - PMC_MDEP_INIT(power8); - pmc_class_table[n] = &power8_class_table_descr; - break; case PMC_CPU_PPC_E500: PMC_MDEP_INIT(e500); pmc_class_table[n] = &e500_class_table_descr; @@ -1480,7 +1464,7 @@ pmc_init(void) * about. This shouldn't happen since the abi version check * should have caught this. */ -#if defined(__amd64__) || defined(__i386__) +#if defined(__amd64__) || defined(__i386__) || defined(__powerpc64__) break; #endif errno = ENXIO; @@ -1604,9 +1588,6 @@ _pmc_name_of_event(enum pmc_event pe, enum pmc_cputype cpu) } else if (pe >= PMC_EV_PPC970_FIRST && pe <= PMC_EV_PPC970_LAST) { ev = ppc970_event_table; evfence = ppc970_event_table + PMC_EVENT_TABLE_SIZE(ppc970); - } else if (pe >= PMC_EV_POWER8_FIRST && pe <= PMC_EV_POWER8_LAST) { - ev = power8_event_table; - evfence = power8_event_table + PMC_EVENT_TABLE_SIZE(power8); } else if (pe >= PMC_EV_E500_FIRST && pe <= PMC_EV_E500_LAST) { ev = e500_event_table; evfence = e500_event_table + PMC_EVENT_TABLE_SIZE(e500); diff --git a/sys/dev/hwpmc/hwpmc_power8.c b/sys/dev/hwpmc/hwpmc_power8.c index ce063a57a10e..0d93e4ae2964 100644 --- a/sys/dev/hwpmc/hwpmc_power8.c +++ b/sys/dev/hwpmc/hwpmc_power8.c @@ -49,135 +49,6 @@ __FBSDID("$FreeBSD$"); #define PM_CYC 0x1e #define PM_INST_CMPL 0x02 -static struct pmc_ppc_event power8_event_codes[] = { - {PMC_EV_POWER8_INSTR_COMPLETED, - .pe_flags = PMC_FLAG_PMC5, - .pe_code = 0x00 - }, - /* - * PMC1 can also count cycles, but as PMC6 can only count cycles - * it's better to always use it and leave PMC1 free to count - * other events. - */ - {PMC_EV_POWER8_CYCLES, - .pe_flags = PMC_FLAG_PMC6, - .pe_code = 0xf0 - }, - {PMC_EV_POWER8_CYCLES_WITH_INSTRS_COMPLETED, - .pe_flags = PMC_FLAG_PMC1, - .pe_code = 0xf2 - }, - {PMC_EV_POWER8_FPU_INSTR_COMPLETED, - .pe_flags = PMC_FLAG_PMC1, - .pe_code = 0xf4 - }, - {PMC_EV_POWER8_ERAT_INSTR_MISS, - .pe_flags = PMC_FLAG_PMC1, - .pe_code = 0xf6 - }, - {PMC_EV_POWER8_CYCLES_IDLE, - .pe_flags = PMC_FLAG_PMC1, - .pe_code = 0xf8 - }, - {PMC_EV_POWER8_CYCLES_WITH_ANY_THREAD_RUNNING, - .pe_flags = PMC_FLAG_PMC1, - .pe_code = 0xfa - }, - {PMC_EV_POWER8_STORE_COMPLETED, - .pe_flags = PMC_FLAG_PMC2, - .pe_code = 0xf0 - }, - {PMC_EV_POWER8_INSTR_DISPATCHED, - .pe_flags = PMC_FLAG_PMC2 | PMC_FLAG_PMC3, - .pe_code = 0xf2 - }, - {PMC_EV_POWER8_CYCLES_RUNNING, - .pe_flags = PMC_FLAG_PMC2, - .pe_code = 0xf4 - }, - {PMC_EV_POWER8_ERAT_DATA_MISS, - .pe_flags = PMC_FLAG_PMC2, - .pe_code = 0xf6 - }, - {PMC_EV_POWER8_EXTERNAL_INTERRUPT, - .pe_flags = PMC_FLAG_PMC2, - .pe_code = 0xf8 - }, - {PMC_EV_POWER8_BRANCH_TAKEN, - .pe_flags = PMC_FLAG_PMC2, - .pe_code = 0xfa - }, - {PMC_EV_POWER8_L1_INSTR_MISS, - .pe_flags = PMC_FLAG_PMC2, - .pe_code = 0xfc - }, - {PMC_EV_POWER8_L2_LOAD_MISS, - .pe_flags = PMC_FLAG_PMC2, - .pe_code = 0xfe - }, - {PMC_EV_POWER8_STORE_NO_REAL_ADDR, - .pe_flags = PMC_FLAG_PMC3, - .pe_code = 0xf0 - }, - {PMC_EV_POWER8_INSTR_COMPLETED_WITH_ALL_THREADS_RUNNING, - .pe_flags = PMC_FLAG_PMC3, - .pe_code = 0xf4 - }, - {PMC_EV_POWER8_L1_LOAD_MISS, - .pe_flags = PMC_FLAG_PMC3, - .pe_code = 0xf6 - }, - {PMC_EV_POWER8_TIMEBASE_EVENT, - .pe_flags = PMC_FLAG_PMC3, - .pe_code = 0xf8 - }, - {PMC_EV_POWER8_L3_INSTR_MISS, - .pe_flags = PMC_FLAG_PMC3, - .pe_code = 0xfa - }, - {PMC_EV_POWER8_TLB_DATA_MISS, - .pe_flags = PMC_FLAG_PMC3, - .pe_code = 0xfc - }, - {PMC_EV_POWER8_L3_LOAD_MISS, - .pe_flags = PMC_FLAG_PMC3, - .pe_code = 0xfe - }, - {PMC_EV_POWER8_LOAD_NO_REAL_ADDR, - .pe_flags = PMC_FLAG_PMC4, - .pe_code = 0xf0 - }, - {PMC_EV_POWER8_CYCLES_WITH_INSTRS_DISPATCHED, - .pe_flags = PMC_FLAG_PMC4, - .pe_code = 0xf2 - }, - {PMC_EV_POWER8_CYCLES_RUNNING_PURR_INC, - .pe_flags = PMC_FLAG_PMC4, - .pe_code = 0xf4 - }, - {PMC_EV_POWER8_BRANCH_MISPREDICTED, - .pe_flags = PMC_FLAG_PMC4, - .pe_code = 0xf6 - }, - {PMC_EV_POWER8_PREFETCHED_INSTRS_DISCARDED, - .pe_flags = PMC_FLAG_PMC4, - .pe_code = 0xf8 - }, - {PMC_EV_POWER8_INSTR_COMPLETED_RUNNING, - .pe_flags = PMC_FLAG_PMC4, - .pe_code = 0xfa - }, - {PMC_EV_POWER8_TLB_INSTR_MISS, - .pe_flags = PMC_FLAG_PMC4, - .pe_code = 0xfc - }, - {PMC_EV_POWER8_CACHE_LOAD_MISS, - .pe_flags = PMC_FLAG_PMC4, - .pe_code = 0xfe - } -}; -static size_t power8_event_codes_size = nitems(power8_event_codes); - static void power8_set_pmc(int cpu, int ri, int config) { @@ -358,7 +229,6 @@ pmc_power8_initialize(struct pmc_mdep *pmc_mdep) pmc_mdep->pmd_npmc += POWER8_MAX_PMCS; pmc_mdep->pmd_intr = powerpc_pmc_intr; - ppc_event_codes_size = power8_event_codes_size; ppc_max_pmcs = POWER8_MAX_PMCS; powerpc_set_pmc = power8_set_pmc; diff --git a/sys/dev/hwpmc/pmc_events.h b/sys/dev/hwpmc/pmc_events.h index df56d728907a..ae56685f5fc5 100644 --- a/sys/dev/hwpmc/pmc_events.h +++ b/sys/dev/hwpmc/pmc_events.h @@ -1640,41 +1640,6 @@ __PMC_EV_ALIAS("unhalted-core-cycles", IAP_ARCH_UNH_COR_CYC) #define PMC_EV_PPC970_FIRST PMC_EV_PPC970_INSTR_COMPLETED #define PMC_EV_PPC970_LAST PMC_EV_PPC970_ADDER -#define __PMC_EV_POWER8() \ - __PMC_EV(POWER8, CYCLES) \ - __PMC_EV(POWER8, CYCLES_WITH_INSTRS_COMPLETED) \ - __PMC_EV(POWER8, FPU_INSTR_COMPLETED) \ - __PMC_EV(POWER8, ERAT_INSTR_MISS) \ - __PMC_EV(POWER8, CYCLES_IDLE) \ - __PMC_EV(POWER8, CYCLES_WITH_ANY_THREAD_RUNNING) \ - __PMC_EV(POWER8, STORE_COMPLETED) \ - __PMC_EV(POWER8, INSTR_DISPATCHED) \ - __PMC_EV(POWER8, CYCLES_RUNNING) \ - __PMC_EV(POWER8, ERAT_DATA_MISS) \ - __PMC_EV(POWER8, EXTERNAL_INTERRUPT) \ - __PMC_EV(POWER8, BRANCH_TAKEN) \ - __PMC_EV(POWER8, L1_INSTR_MISS) \ - __PMC_EV(POWER8, L2_LOAD_MISS) \ - __PMC_EV(POWER8, STORE_NO_REAL_ADDR) \ - __PMC_EV(POWER8, INSTR_COMPLETED_WITH_ALL_THREADS_RUNNING) \ - __PMC_EV(POWER8, L1_LOAD_MISS) \ - __PMC_EV(POWER8, TIMEBASE_EVENT) \ - __PMC_EV(POWER8, L3_INSTR_MISS) \ - __PMC_EV(POWER8, TLB_DATA_MISS) \ - __PMC_EV(POWER8, L3_LOAD_MISS) \ - __PMC_EV(POWER8, LOAD_NO_REAL_ADDR) \ - __PMC_EV(POWER8, CYCLES_WITH_INSTRS_DISPATCHED) \ - __PMC_EV(POWER8, CYCLES_RUNNING_PURR_INC) \ - __PMC_EV(POWER8, BRANCH_MISPREDICTED) \ - __PMC_EV(POWER8, PREFETCHED_INSTRS_DISCARDED) \ - __PMC_EV(POWER8, INSTR_COMPLETED_RUNNING) \ - __PMC_EV(POWER8, TLB_INSTR_MISS) \ - __PMC_EV(POWER8, CACHE_LOAD_MISS) \ - __PMC_EV(POWER8, INSTR_COMPLETED) - -#define PMC_EV_POWER8_FIRST PMC_EV_POWER8_CYCLES -#define PMC_EV_POWER8_LAST PMC_EV_POWER8_INSTR_COMPLETED - #define __PMC_EV_E500() \ __PMC_EV(E500, CYCLES) \ __PMC_EV(E500, INSTR_COMPLETED) \ @@ -1860,7 +1825,7 @@ __PMC_EV_ALIAS("unhalted-core-cycles", IAP_ARCH_UNH_COR_CYC) * 0x11600 0x00FF BERI statcounters * 0x13000 0x00FF MPC7450 events * 0x13100 0x00FF IBM PPC970 events - * 0x13200 0x00FF IBM POWER8 events + * 0x13200 0x00FF free (was IBM POWER8 events) * 0x13300 0x00FF Freescale e500 events * 0x14000 0x0100 ARMv7 events * 0x14100 0x0100 ARMv8 events @@ -1889,8 +1854,6 @@ __PMC_EV_ALIAS("unhalted-core-cycles", IAP_ARCH_UNH_COR_CYC) __PMC_EV_PPC7450() \ __PMC_EV_BLOCK(PPC970, 0x13100) \ __PMC_EV_PPC970() \ - __PMC_EV_BLOCK(POWER8, 0x13200) \ - __PMC_EV_POWER8() \ __PMC_EV_BLOCK(E500, 0x13300) \ __PMC_EV_E500() \ __PMC_EV_BLOCK(ARMV7, 0x14000) \ From owner-dev-commits-src-all@freebsd.org Thu Jul 29 20: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 2226865285B for ; Thu, 29 Jul 2021 20: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 4GbMJl0QDcz4bQv; Thu, 29 Jul 2021 20: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 E75FA17DE8; Thu, 29 Jul 2021 20: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 16TKHQYC097701; Thu, 29 Jul 2021 20: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 16TKHQPZ097700; Thu, 29 Jul 2021 20:17:26 GMT (envelope-from git) Date: Thu, 29 Jul 2021 20:17:26 GMT Message-Id: <202107292017.16TKHQPZ097700@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Dimitry Andric Subject: git: 9ee1ac1034a2 - Create tag vendor/llvm-project/llvmorg-13-init-16847-g88e66fa60ae5 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/tags/vendor/llvm-project/llvmorg-13-init-16847-g88e66fa60ae5 X-Git-Reftype: annotated tag X-Git-Commit: 9ee1ac1034a27913411dd7073f16f20810c8051a 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, 29 Jul 2021 20:17:27 -0000 The annotated tag vendor/llvm-project/llvmorg-13-init-16847-g88e66fa60ae5 has been created by dim: URL: https://cgit.FreeBSD.org/src/tag/?h=vendor/llvm-project/llvmorg-13-init-16847-g88e66fa60ae5 tag vendor/llvm-project/llvmorg-13-init-16847-g88e66fa60ae5 Tagger: Dimitry Andric TaggerDate: 2021-07-29 20:16:18 +0000 Tag llvm-project main 88e66fa60ae5, the last commit before the upstream release/13.x branch was created. commit 344a3780b2e33f6ca763666c380202b18aab72a3 Author: Dimitry Andric AuthorDate: 2021-07-29 20:15:26 +0000 Commit: Dimitry Andric CommitDate: 2021-07-29 20:15:26 +0000 Vendor import of llvm-project main 88e66fa60ae5, the last commit before the upstream release/13.x branch was created. From owner-dev-commits-src-all@freebsd.org Thu Jul 29 20: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 079056532C1 for ; Thu, 29 Jul 2021 20: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 4GbMJk6Tqjz4bTX; Thu, 29 Jul 2021 20:17: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 BC58A180A7; Thu, 29 Jul 2021 20: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 16TKHQom097677; Thu, 29 Jul 2021 20: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 16TKHQBI097676; Thu, 29 Jul 2021 20:17:26 GMT (envelope-from git) Date: Thu, 29 Jul 2021 20:17:26 GMT Message-Id: <202107292017.16TKHQBI097676@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Dimitry Andric Subject: git: b60736ec1405..344a3780b2e3 - vendor/llvm-project/main - vendor branch updated 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/vendor/llvm-project/main X-Git-Reftype: branch X-Git-Commit: 344a3780b2e33f6ca763666c380202b18aab72a3 X-Git-Oldrev: b60736ec1405bb0a8dd40989f67ef4c93da068ab X-Git-Newrev: 344a3780b2e33f6ca763666c380202b18aab72a3 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, 29 Jul 2021 20:17:27 -0000 The branch vendor/llvm-project/main has been updated by dim: URL: https://cgit.FreeBSD.org/src/log/?id=b60736ec1405..344a3780b2e3 344a3780b2e3 Vendor import of llvm-project main 88e66fa60ae5, the last commit before the upstream release/13.x branch was created. From owner-dev-commits-src-all@freebsd.org Thu Jul 29 20:21: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 B5483653165 for ; Thu, 29 Jul 2021 20:21: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 4GbMPH4lxgz4bS1; Thu, 29 Jul 2021 20:21: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 8BE8018269; Thu, 29 Jul 2021 20:21: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 16TKLNTo010542; Thu, 29 Jul 2021 20:21:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16TKLNfF010541; Thu, 29 Jul 2021 20:21:23 GMT (envelope-from git) Date: Thu, 29 Jul 2021 20:21:23 GMT Message-Id: <202107292021.16TKLNfF010541@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Dimitry Andric Subject: git: c26f77a99c9f - Create tag vendor/llvm-project/llvmorg-12.0.1-rc2-0-ge7dac564cd0e 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/tags/vendor/llvm-project/llvmorg-12.0.1-rc2-0-ge7dac564cd0e X-Git-Reftype: annotated tag X-Git-Commit: c26f77a99c9f6891e1c8339c432f345a33328d41 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, 29 Jul 2021 20:21:23 -0000 The annotated tag vendor/llvm-project/llvmorg-12.0.1-rc2-0-ge7dac564cd0e has been created by dim: URL: https://cgit.FreeBSD.org/src/tag/?h=vendor/llvm-project/llvmorg-12.0.1-rc2-0-ge7dac564cd0e tag vendor/llvm-project/llvmorg-12.0.1-rc2-0-ge7dac564cd0e Tagger: Dimitry Andric TaggerDate: 2021-07-29 20:20:07 +0000 Tag llvm-project branch release/12.x llvmorg-12.0.1-rc2-0-ge7dac564cd0e, a.k.a. 12.0.1 rc2. commit 344a3780b2e33f6ca763666c380202b18aab72a3 Author: Dimitry Andric AuthorDate: 2021-07-29 20:15:26 +0000 Commit: Dimitry Andric CommitDate: 2021-07-29 20:15:26 +0000 Vendor import of llvm-project main 88e66fa60ae5, the last commit before the upstream release/13.x branch was created. From owner-dev-commits-src-all@freebsd.org Thu Jul 29 20:21: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 9520C65375C for ; Thu, 29 Jul 2021 20:21: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 4GbMPH3p1cz4bkF; Thu, 29 Jul 2021 20:21: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 6A88E18132; Thu, 29 Jul 2021 20:21: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 16TKLNo9010518; Thu, 29 Jul 2021 20:21:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16TKLN4t010517; Thu, 29 Jul 2021 20:21:23 GMT (envelope-from git) Date: Thu, 29 Jul 2021 20:21:23 GMT Message-Id: <202107292021.16TKLN4t010517@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Dimitry Andric Subject: git: 76b868dbf37c - Create tag vendor/llvm-project/llvmorg-12.0.1-0-gfed41342a82f 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/tags/vendor/llvm-project/llvmorg-12.0.1-0-gfed41342a82f X-Git-Reftype: annotated tag X-Git-Commit: 76b868dbf37c75d5cc6fe65136f266422e70e731 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, 29 Jul 2021 20:21:23 -0000 The annotated tag vendor/llvm-project/llvmorg-12.0.1-0-gfed41342a82f has been created by dim: URL: https://cgit.FreeBSD.org/src/tag/?h=vendor/llvm-project/llvmorg-12.0.1-0-gfed41342a82f tag vendor/llvm-project/llvmorg-12.0.1-0-gfed41342a82f Tagger: Dimitry Andric TaggerDate: 2021-07-29 20:20:37 +0000 Tag llvm-project branch release/12.x llvmorg-12.0.1-0-gfed41342a82f, a.k.a. 12.0.1 release. commit 344a3780b2e33f6ca763666c380202b18aab72a3 Author: Dimitry Andric AuthorDate: 2021-07-29 20:15:26 +0000 Commit: Dimitry Andric CommitDate: 2021-07-29 20:15:26 +0000 Vendor import of llvm-project main 88e66fa60ae5, the last commit before the upstream release/13.x branch was created. From owner-dev-commits-src-all@freebsd.org Thu Jul 29 20:32: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 DA603653A07 for ; Thu, 29 Jul 2021 20:32: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 4GbMf35kYbz4ddL; Thu, 29 Jul 2021 20:32: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 AE020180DB; Thu, 29 Jul 2021 20:32: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 16TKWRtE024339; Thu, 29 Jul 2021 20:32:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16TKWR9A024338; Thu, 29 Jul 2021 20:32:27 GMT (envelope-from git) Date: Thu, 29 Jul 2021 20:32:27 GMT Message-Id: <202107292032.16TKWR9A024338@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Dimitry Andric Subject: git: c36c0cb23362 - Create tag vendor/llvm-project/llvmorg-13-init-16854-g6b2e4c5a58d7 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/tags/vendor/llvm-project/llvmorg-13-init-16854-g6b2e4c5a58d7 X-Git-Reftype: annotated tag X-Git-Commit: c36c0cb23362d33eb3a9152a8f369d905f5341fd 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, 29 Jul 2021 20:32:27 -0000 The annotated tag vendor/llvm-project/llvmorg-13-init-16854-g6b2e4c5a58d7 has been created by dim: URL: https://cgit.FreeBSD.org/src/tag/?h=vendor/llvm-project/llvmorg-13-init-16854-g6b2e4c5a58d7 tag vendor/llvm-project/llvmorg-13-init-16854-g6b2e4c5a58d7 Tagger: Dimitry Andric TaggerDate: 2021-07-29 20:31:51 +0000 Tag llvm-project branch release/13.x llvmorg-13-init-16854-g6b2e4c5a58d7. commit fa40418fea35c68de2a358bce3539cdc5cbcd21a Author: Dimitry Andric AuthorDate: 2021-07-29 20:31:35 +0000 Commit: Dimitry Andric CommitDate: 2021-07-29 20:31:35 +0000 Vendor import of llvm-project branch release/13.x llvmorg-13-init-16854-g6b2e4c5a58d7. From owner-dev-commits-src-all@freebsd.org Thu Jul 29 20:32: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 C70C2653A06 for ; Thu, 29 Jul 2021 20:32: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 4GbMf359dLz4dk3; Thu, 29 Jul 2021 20:32: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 9AEA3183FA; Thu, 29 Jul 2021 20:32: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 16TKWRNG024315; Thu, 29 Jul 2021 20:32:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16TKWRrP024314; Thu, 29 Jul 2021 20:32:27 GMT (envelope-from git) Date: Thu, 29 Jul 2021 20:32:27 GMT Message-Id: <202107292032.16TKWRrP024314@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Dimitry Andric Subject: git: fa40418fea35 - vendor/llvm-project/release-13.x - vendor branch created 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/vendor/llvm-project/release-13.x X-Git-Reftype: branch X-Git-Commit: fa40418fea35c68de2a358bce3539cdc5cbcd21a X-Git-Oldrev: 0000000000000000000000000000000000000000 X-Git-Newrev: fa40418fea35c68de2a358bce3539cdc5cbcd21a 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, 29 Jul 2021 20:32:27 -0000 The branch vendor/llvm-project/release-13.x has been created by dim: URL: https://cgit.FreeBSD.org/src/log/?id=fa40418fea35 009b1c42aa62 Import LLVM, at r72732. ec2b103c267a Import Clang, at r72732. 33a8e4360f50 Import LLVM, at r72770. 922a2097733e Import Clang, at r72770. 68eb509bdc5c Import LLVM, at r72805, which fixes PR4315 and PR4316. 2659aeb5e51f Import Clang, at r72805. f4fe016fa15f Import LLVM, at r72995. 37f6c480c696 Import clang, at r72995. d2a7037439ec Import LLVM r73021. 70b4596d9d0d Import Clang r73021. 93338c197185 Import LLVM r73070. 8ba99c00327a Import Clang r73070. 600c6fa13de5 Import LLVM r73340. 7ef7bab7e3d0 Import Clang r73340. b2f21fb044b6 Update LLVM sources to r73879. b897c8660c4f Update Clang sources to r73879. 0408e1d309a7 Import LLVM r73954. d6aff018d446 Import Clang r73954. f76359690a70 Import LLVM r73984. f698f7e71940 Import Clang r73984. f859468f5a21 Import LLVM r74383. 4ebdf5c4f587 Import Clang r74383. 18f153bdb9db Import LLVM 74788. 5362a71c02e7 Import Clang r74788. 59850d087442 Update llvm to r84119. 4c8b24812ddc Update clang to r84119. 98781354c33b Update clang to 84175. 26137f35958f Update llvm to r84175. 5cd822fa9bbb Delete all stale files. a505eb93f43f Delete stale files. a5f348eb914e Delete some more files. 4a142eb28942 Update LLVM to r84949. 73490b890977 Update clang to r84949. bd3c9c2e3e89 These files does not belong here. f9666f9b3a3d This was removed upstream. 36bf506ad3c9 Update LLVM to r86025. 51fb8b013e77 Update clang to r86025. fc25e9aa5245 Delete this file. 72cc50852bec Update LLVM to r86140. 8f57cb030523 Update clang to r86140. 907da171cc91 Update LLVM to r89205. b3d5a323a5ca Update clang to r89205. 7d4538633051 Update LLVM to r89337. f5bd02d290ff Update clang to r89337. 76e2e0ebfdd3 Remove includes that were removed upstream. 06f9d4012fb8 Update LLVM to r90226. 1569ce68681d Update clang to r90226. 571945e6affd Update LLVM to 91430. 34d02d0b37f1 Update clang to 91430. 1e7804dbd25b Update LLVM to 92395. abe15e553e58 Updaet clang to 92395. 829000e035f4 Update LLVM to 93512. ee791dde723a Update clang to r93512. 989df958a10f Update LLVM to r94309. 5044f5c816ad Update clang to r94309. 6fe5c7aa327e Update LLVM to r96341. ecb7e5c8afe9 Update clang to r96341. 67a71b3184ce Update LLVM to 97654. 79ade4e02893 Update clang to 97654. f5a3459adfde Update LLVM to r97873. dd5132ce2569 Update clang to r97873. ea5b2dd11c05 Update LLVM to r98164. a16e9ac1f192 Update clang to r98164. c69102774f97 Update LLVM to r98631. 4a37f65f1c13 Update clang to r98631. 2f12f10af369 Update LLVM to r99115. c0c7bca4e5b8 Update clang to r99115. 104bd8179fb5 Update LLVM to r100181. 11d2b2d2bb70 Update clang to r100181. b5efedaf2ab2 Update LLVM to r100285. 2c56c396ce59 Update clang to r100285. 9f4a1da9a0a5 Update LLVM to r100520. 60bfabcd8ce6 Update clang to r100520. d7f7719e5e08 Update LLVM to r103004. 0883ccd9eac3 Update clang to r103004. 59161dfae322 Update LLVM to r103052. be17651f5cd2 Update clang to r103052. abdf259d4871 Update LLVM to r104832. d7279c4c177b Update clang to r104832. 66e41e3c6e8b Update LLVM to r108243. 4ba675006b5a Update clang to r108243. *** 492 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Thu Jul 29 21:28: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 2E7BF654476; Thu, 29 Jul 2021 21:28: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 4GbNtK0YJKz4krW; Thu, 29 Jul 2021 21:28: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 EF4B818EA8; Thu, 29 Jul 2021 21:28: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 16TLS8Io091188; Thu, 29 Jul 2021 21:28:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16TLS8OD091187; Thu, 29 Jul 2021 21:28:08 GMT (envelope-from git) Date: Thu, 29 Jul 2021 21:28:08 GMT Message-Id: <202107292128.16TLS8OD091187@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: 4c8af633d101 - main - LinuxKPI: bitfield.h cleanup 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: 4c8af633d10104c793673ee1f6e7b96f113cce5a 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, 29 Jul 2021 21:28:09 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=4c8af633d10104c793673ee1f6e7b96f113cce5a commit 4c8af633d10104c793673ee1f6e7b96f113cce5a Author: Bjoern A. Zeeb AuthorDate: 2021-07-29 21:24:35 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-29 21:24:35 +0000 LinuxKPI: bitfield.h cleanup Add a missing tab and remove an unnecessary return. No functional changes. MFC after: 3 days --- sys/compat/linuxkpi/common/include/linux/bitfield.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/bitfield.h b/sys/compat/linuxkpi/common/include/linux/bitfield.h index 4749cc4454e7..27082cbd4886 100644 --- a/sys/compat/linuxkpi/common/include/linux/bitfield.h +++ b/sys/compat/linuxkpi/common/include/linux/bitfield.h @@ -77,7 +77,7 @@ _uX_encode_bits(8) #define _leX_encode_bits(_n) \ static __inline uint ## _n ## _t \ - le ## _n ## _encode_bits(__le ## _n v, uint ## _n ## _t f)\ + le ## _n ## _encode_bits(__le ## _n v, uint ## _n ## _t f) \ { \ return (cpu_to_le ## _n((v & ___bitmask(f)) * ___lsb(f))); \ } @@ -91,7 +91,6 @@ le32p_replace_bits(uint32_t *p, uint32_t v, uint32_t f) { *p = (*p & ~(cpu_to_le32(v))) | le32_encode_bits(v, f); - return; } #define __bf_shf(x) (__builtin_ffsll(x) - 1) From owner-dev-commits-src-all@freebsd.org Thu Jul 29 21:46: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 F0519655056; Thu, 29 Jul 2021 21:46: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 4GbPHb6Tx1z4lqq; Thu, 29 Jul 2021 21:46: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 C2E831964F; Thu, 29 Jul 2021 21:46: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 16TLkZdS017141; Thu, 29 Jul 2021 21:46:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16TLkZ0Z017140; Thu, 29 Jul 2021 21:46:35 GMT (envelope-from git) Date: Thu, 29 Jul 2021 21:46:35 GMT Message-Id: <202107292146.16TLkZ0Z017140@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: 59b83c47e215 - main - awk: Note awk upgrades. 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: 59b83c47e21520954178204d15ea3ba5df28a894 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, 29 Jul 2021 21:46:36 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=59b83c47e21520954178204d15ea3ba5df28a894 commit 59b83c47e21520954178204d15ea3ba5df28a894 Author: Warner Losh AuthorDate: 2021-07-29 21:41:16 +0000 Commit: Warner Losh CommitDate: 2021-07-29 21:45:25 +0000 awk: Note awk upgrades. Note the high level differences with the latest one true awk import. This list may grow as we learn more troublesome areas. Updated description of the format fo the file to match the file. I'll likely merge this change (and any followups) by direct commit to stable/13 and stable/12 in a couple of weeks. Sponsored by: Netflix --- RELNOTES | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/RELNOTES b/RELNOTES index 173878640975..5f8c75081cc0 100644 --- a/RELNOTES +++ b/RELNOTES @@ -5,11 +5,25 @@ users of binary FreeBSD releases. Each entry should describe the change in no more than several sentences and should reference manual pages where an interested user can find more information. Entries should wrap after 80 columns. Each entry should begin with one or more commit IDs on one line, -specified as a comma separated list and/or range, followed by a colon and a -newline. Entries should be separated by a newline. +specified as a comma separated list and/or range. Entries should be separated +by a newline. Changes to this file should not be MFCed. +various + One True Awk has been updated to the latest from upstream + (20210215). All the FreeBSD patches, but one, have now been + either up streamed or discarded. Notable changes include: + o Locale is no longer used for ranges + o Various bugs fixed + o Better compatibility with gawk and mawk + + The one FreeBSD change, likely to be removed in FreeBSD 14, is that + we still allow hex numbers, prefixed with 0x, to be parsed and + interpreted as hex numbers while all other awks (including one + true awk now) interpret them as 0 in line with awk's historic + behavior. + ee29e6f31111 Commit ee29e6f31111 added a new sysctl called vfs.nfsd.srvmaxio that can be used to increase the maximum I/O size for the NFS From owner-dev-commits-src-all@freebsd.org Thu Jul 29 22:21: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 D5F8D655759; Thu, 29 Jul 2021 22:21: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 4GbQ3Q5ls0z4nLL; Thu, 29 Jul 2021 22:21: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 AEB3219ABC; Thu, 29 Jul 2021 22:21: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 16TML6w3068864; Thu, 29 Jul 2021 22:21:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16TML6dK068848; Thu, 29 Jul 2021 22:21:06 GMT (envelope-from git) Date: Thu, 29 Jul 2021 22:21:06 GMT Message-Id: <202107292221.16TML6dK068848@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: b27fe1c3ba2a - main - amd64: stop doing special allocation for the AP startup trampoline 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: b27fe1c3ba2a1302c2866751e0c618b5a697bf30 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, 29 Jul 2021 22:21:06 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=b27fe1c3ba2a1302c2866751e0c618b5a697bf30 commit b27fe1c3ba2a1302c2866751e0c618b5a697bf30 Author: Konstantin Belousov AuthorDate: 2021-07-29 00:22:35 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-29 22:20:45 +0000 amd64: stop doing special allocation for the AP startup trampoline There is no reason now why do we need to allocate trampoline page very early in the boot process. The only requirement for the page is that it is below 1M to be usable by the real mode during init. This can be handled by vm_alloc_contig() when we do the startup. Also assert that startup trampoline fits into single page. In principle we can do multi-page allocation if needed, but it is not. Move the alloc_ap_trampoline() function and the boot_address variable to i386/mp_machdep.c. Keep existing mechanism of early alloc on i386. Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D31343 --- sys/amd64/amd64/machdep.c | 10 -------- sys/amd64/amd64/mp_machdep.c | 19 +++++++++++---- sys/i386/i386/mp_machdep.c | 55 ++++++++++++++++++++++++++++++++++++++++++++ sys/x86/include/x86_smp.h | 10 ++++++-- sys/x86/x86/mp_x86.c | 54 ------------------------------------------- 5 files changed, 77 insertions(+), 71 deletions(-) diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index 49e245e1fdfe..0cb72314e68d 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -1272,16 +1272,6 @@ getmemsize(caddr_t kmdp, u_int64_t first) (boothowto & RB_VERBOSE)) printf("Physical memory use set to %ldK\n", Maxmem * 4); - /* - * Make hole for "AP -> long mode" bootstrap code. The - * mp_bootaddress vector is only available when the kernel - * is configured to support APs and APs for the system start - * in real mode mode (e.g. SMP bare metal). - */ -#ifdef SMP - alloc_ap_trampoline(physmap, &physmap_idx); -#endif - /* call pmap initialization to make new kernel address space */ pmap_bootstrap(&first); diff --git a/sys/amd64/amd64/mp_machdep.c b/sys/amd64/amd64/mp_machdep.c index 343589ae4c6a..62f715fd6ed3 100644 --- a/sys/amd64/amd64/mp_machdep.c +++ b/sys/amd64/amd64/mp_machdep.c @@ -112,7 +112,7 @@ extern u_int mptramp_nx; * Local data and functions. */ -static int start_ap(int apic_id); +static int start_ap(int apic_id, vm_paddr_t boot_address); /* * Initialize the IPI handlers and start up the AP's. @@ -322,17 +322,25 @@ mp_realloc_pcpu(int cpuid, int domain) int start_all_aps(void) { - vm_page_t m_pml4, m_pdp, m_pd[4]; + vm_page_t m_boottramp, m_pml4, m_pdp, m_pd[4]; pml5_entry_t old_pml45; pml4_entry_t *v_pml4; pdp_entry_t *v_pdp; pd_entry_t *v_pd; + vm_paddr_t boot_address; u_int32_t mpbioswarmvec; int apic_id, cpu, domain, i; u_char mpbiosreason; mtx_init(&ap_boot_mtx, "ap boot", NULL, MTX_SPIN); + MPASS(bootMP_size <= PAGE_SIZE); + m_boottramp = vm_page_alloc_contig(NULL, 0, VM_ALLOC_NORMAL | + VM_ALLOC_NOBUSY | VM_ALLOC_NOOBJ, 1, 0, + (1ULL << 20), /* Trampoline should be below 1M for real mode */ + PAGE_SIZE, 0, VM_MEMATTR_DEFAULT); + boot_address = VM_PAGE_TO_PHYS(m_boottramp); + /* Create a transient 1:1 mapping of low 4G */ if (la57) { m_pml4 = pmap_page_alloc_below_4g(true); @@ -382,7 +390,7 @@ start_all_aps(void) /* copy the AP 1st level boot code */ bcopy(mptramp_start, (void *)PHYS_TO_DMAP(boot_address), bootMP_size); if (bootverbose) - printf("AP boot address %#x\n", boot_address); + printf("AP boot address %#lx\n", boot_address); /* save the current value of the warm-start vector */ if (!efi_boot) @@ -436,7 +444,7 @@ start_all_aps(void) bootAP = cpu; /* attempt to start the Application Processor */ - if (!start_ap(apic_id)) { + if (!start_ap(apic_id, boot_address)) { /* restore the warmstart vector */ *(u_int32_t *) WARMBOOT_OFF = mpbioswarmvec; panic("AP #%d (PHY# %d) failed!", cpu, apic_id); @@ -461,6 +469,7 @@ start_all_aps(void) vm_page_free(m_pd[1]); vm_page_free(m_pd[0]); vm_page_free(m_pdp); + vm_page_free(m_boottramp); /* number of APs actually started */ return (mp_naps); @@ -474,7 +483,7 @@ start_all_aps(void) * but it seems to work. */ static int -start_ap(int apic_id) +start_ap(int apic_id, vm_paddr_t boot_address) { int vector, ms; int cpus; diff --git a/sys/i386/i386/mp_machdep.c b/sys/i386/i386/mp_machdep.c index 91ca6945f1ae..156702118c45 100644 --- a/sys/i386/i386/mp_machdep.c +++ b/sys/i386/i386/mp_machdep.c @@ -147,6 +147,61 @@ static int start_ap(int apic_id); static char *ap_copyout_buf; static char *ap_tramp_stack_base; + +unsigned int boot_address; + +#define MiB(v) (v ## ULL << 20) + +/* Allocate memory for the AP trampoline. */ +void +alloc_ap_trampoline(vm_paddr_t *physmap, unsigned int *physmap_idx) +{ + unsigned int i; + bool allocated; + + allocated = false; + for (i = *physmap_idx; i <= *physmap_idx; i -= 2) { + /* + * Find a memory region big enough and below the 1MB boundary + * for the trampoline code. + * NB: needs to be page aligned. + */ + if (physmap[i] >= MiB(1) || + (trunc_page(physmap[i + 1]) - round_page(physmap[i])) < + round_page(bootMP_size)) + continue; + + allocated = true; + /* + * Try to steal from the end of the region to mimic previous + * behaviour, else fallback to steal from the start. + */ + if (physmap[i + 1] < MiB(1)) { + boot_address = trunc_page(physmap[i + 1]); + if ((physmap[i + 1] - boot_address) < bootMP_size) + boot_address -= round_page(bootMP_size); + physmap[i + 1] = boot_address; + } else { + boot_address = round_page(physmap[i]); + physmap[i] = boot_address + round_page(bootMP_size); + } + if (physmap[i] == physmap[i + 1] && *physmap_idx != 0) { + memmove(&physmap[i], &physmap[i + 2], + sizeof(*physmap) * (*physmap_idx - i + 2)); + *physmap_idx -= 2; + } + break; + } + + if (!allocated) { + boot_address = basemem * 1024 - bootMP_size; + if (bootverbose) + printf( +"Cannot find enough space for the boot trampoline, placing it at %#x", + boot_address); + } +} + /* * Initialize the IPI handlers and start up the AP's. */ diff --git a/sys/x86/include/x86_smp.h b/sys/x86/include/x86_smp.h index e01f869a58f6..b9a1febb70f2 100644 --- a/sys/x86/include/x86_smp.h +++ b/sys/x86/include/x86_smp.h @@ -23,6 +23,10 @@ struct pmap; +#ifdef __i386__ +extern unsigned int boot_address; +#endif + /* global data in mp_x86.c */ extern int mp_naps; extern int boot_cpu_id; @@ -32,7 +36,6 @@ extern int bootAP; extern void *dpcpu; extern char *bootSTK; extern void *bootstacks[]; -extern unsigned int boot_address; extern unsigned int bootMP_size; extern volatile int aps_ready; extern struct mtx ap_boot_mtx; @@ -84,12 +87,15 @@ inthand_t typedef void (*smp_invl_cb_t)(struct pmap *, vm_offset_t addr1, vm_offset_t addr2); +#ifdef __i386__ +void alloc_ap_trampoline(vm_paddr_t *physmap, unsigned int *physmap_idx); +#endif + /* functions in x86_mp.c */ void assign_cpu_ids(void); void cpu_add(u_int apic_id, char boot_cpu); void cpustop_handler(void); void cpususpend_handler(void); -void alloc_ap_trampoline(vm_paddr_t *physmap, unsigned int *physmap_idx); void init_secondary_tail(void); void init_secondary(void); void ipi_startup(int apic_id, int vector); diff --git a/sys/x86/x86/mp_x86.c b/sys/x86/x86/mp_x86.c index 0698cb51b2d0..5e9a9735b09a 100644 --- a/sys/x86/x86/mp_x86.c +++ b/sys/x86/x86/mp_x86.c @@ -168,14 +168,10 @@ struct cache_info { int present; } static caches[MAX_CACHE_LEVELS]; -unsigned int boot_address; - static bool stop_mwait = false; SYSCTL_BOOL(_machdep, OID_AUTO, stop_mwait, CTLFLAG_RWTUN, &stop_mwait, 0, "Use MONITOR/MWAIT when stopping CPU, if available"); -#define MiB(v) (v ## ULL << 20) - void mem_range_AP_init(void) { @@ -939,56 +935,6 @@ cpu_mp_probe(void) return (mp_ncpus > 1); } -/* Allocate memory for the AP trampoline. */ -void -alloc_ap_trampoline(vm_paddr_t *physmap, unsigned int *physmap_idx) -{ - unsigned int i; - bool allocated; - - allocated = false; - for (i = *physmap_idx; i <= *physmap_idx; i -= 2) { - /* - * Find a memory region big enough and below the 1MB boundary - * for the trampoline code. - * NB: needs to be page aligned. - */ - if (physmap[i] >= MiB(1) || - (trunc_page(physmap[i + 1]) - round_page(physmap[i])) < - round_page(bootMP_size)) - continue; - - allocated = true; - /* - * Try to steal from the end of the region to mimic previous - * behaviour, else fallback to steal from the start. - */ - if (physmap[i + 1] < MiB(1)) { - boot_address = trunc_page(physmap[i + 1]); - if ((physmap[i + 1] - boot_address) < bootMP_size) - boot_address -= round_page(bootMP_size); - physmap[i + 1] = boot_address; - } else { - boot_address = round_page(physmap[i]); - physmap[i] = boot_address + round_page(bootMP_size); - } - if (physmap[i] == physmap[i + 1] && *physmap_idx != 0) { - memmove(&physmap[i], &physmap[i + 2], - sizeof(*physmap) * (*physmap_idx - i + 2)); - *physmap_idx -= 2; - } - break; - } - - if (!allocated) { - boot_address = basemem * 1024 - bootMP_size; - if (bootverbose) - printf( -"Cannot find enough space for the boot trampoline, placing it at %#x", - boot_address); - } -} - /* * AP CPU's call this to initialize themselves. */ From owner-dev-commits-src-all@freebsd.org Thu Jul 29 22:21: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 1ACC9655A68; Thu, 29 Jul 2021 22:21: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 4GbQ3R6zygz4nlP; Thu, 29 Jul 2021 22:21: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 D1A0219ABD; Thu, 29 Jul 2021 22:21: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 16TML7RY069141; Thu, 29 Jul 2021 22:21:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16TML7F3069140; Thu, 29 Jul 2021 22:21:07 GMT (envelope-from git) Date: Thu, 29 Jul 2021 22:21:07 GMT Message-Id: <202107292221.16TML7F3069140@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: 2572376f7f64 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 2572376f7f6412bc69bd6138e9ac9a6efd7642af 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, 29 Jul 2021 22:21:08 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=2572376f7f6412bc69bd6138e9ac9a6efd7642af commit 2572376f7f6412bc69bd6138e9ac9a6efd7642af Author: Konstantin Belousov AuthorDate: 2021-07-29 13:18:19 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-29 22:20:45 +0000 amd64: do not touch low memory in AP startup unless we used legacy boot This fixes several ommisions in 48216088b1157a22b955 Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D31343 --- 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 62f715fd6ed3..6c66bd622855 100644 --- a/sys/amd64/amd64/mp_machdep.c +++ b/sys/amd64/amd64/mp_machdep.c @@ -446,7 +446,8 @@ start_all_aps(void) /* attempt to start the Application Processor */ if (!start_ap(apic_id, boot_address)) { /* 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); } @@ -454,7 +455,8 @@ 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 Thu Jul 29 23:14: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 610656564B4; Thu, 29 Jul 2021 23:14: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 4GbRDx1wWsz4qhr; Thu, 29 Jul 2021 23:14: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 2A81C1A8A6; Thu, 29 Jul 2021 23:14: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 16TNEPlc036934; Thu, 29 Jul 2021 23:14:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16TNEPsc036933; Thu, 29 Jul 2021 23:14:25 GMT (envelope-from git) Date: Thu, 29 Jul 2021 23:14:25 GMT Message-Id: <202107292314.16TNEPsc036933@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kirk McKusick Subject: git: 412b5e40a721 - main - Diagnotic improvement to soft dependency structure management. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mckusick X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 412b5e40a721430adba1b4abae210641f733f976 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, 29 Jul 2021 23:14:25 -0000 The branch main has been updated by mckusick: URL: https://cgit.FreeBSD.org/src/commit/?id=412b5e40a721430adba1b4abae210641f733f976 commit 412b5e40a721430adba1b4abae210641f733f976 Author: Kirk McKusick AuthorDate: 2021-07-29 23:11:58 +0000 Commit: Kirk McKusick CommitDate: 2021-07-29 23:13:54 +0000 Diagnotic improvement to soft dependency structure management. The soft updates diagnotic code keeps a list for each type of soft update dependency. When a new block is allocated for a file it is initially tracked by a "newblk" dependency. The "newblk" dependency eventually becomes either an "allocdirect" dependency or an "indiralloc" dependency. The diagnotic code failed to move the "newblk" from the list of "newblk"s to its new type list. No functional change intended. Reviewed by: Chuck Silvers (as part of a larger change) Tested by: Peter Holm (as part of a larger change) Sponsored by: Netflix --- sys/ufs/ffs/ffs_softdep.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c index 75120175e4a1..da80f28bc814 100644 --- a/sys/ufs/ffs/ffs_softdep.c +++ b/sys/ufs/ffs/ffs_softdep.c @@ -1293,6 +1293,10 @@ workitem_reassign(item, newtype) dep_total[newtype]++; FREE_GBLLOCK(&lk); item->wk_type = newtype; +#ifdef INVARIANTS + LIST_REMOVE(item, wk_all); + LIST_INSERT_HEAD(&ump->softdep_alldeps[newtype], item, wk_all); +#endif } /* From owner-dev-commits-src-all@freebsd.org Thu Jul 29 23:32: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 29BDD656639; Thu, 29 Jul 2021 23:32: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 4GbRdY0Y0fz4rWZ; Thu, 29 Jul 2021 23:32: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 EF0621AA1F; Thu, 29 Jul 2021 23:32: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 16TNWGwl063358; Thu, 29 Jul 2021 23:32:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16TNWGk2063357; Thu, 29 Jul 2021 23:32:16 GMT (envelope-from git) Date: Thu, 29 Jul 2021 23:32:16 GMT Message-Id: <202107292332.16TNWGk2063357@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kirk McKusick Subject: git: a91716efeb68 - main - Clean up orphaned indirdep dependency structures after disk failure. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mckusick X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a91716efeb684c50289c0e1136f5432f880dc873 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, 29 Jul 2021 23:32:17 -0000 The branch main has been updated by mckusick: URL: https://cgit.FreeBSD.org/src/commit/?id=a91716efeb684c50289c0e1136f5432f880dc873 commit a91716efeb684c50289c0e1136f5432f880dc873 Author: Kirk McKusick AuthorDate: 2021-07-29 23:31:16 +0000 Commit: Kirk McKusick CommitDate: 2021-07-29 23:31:16 +0000 Clean up orphaned indirdep dependency structures after disk failure. During forcible unmount after a disk failure there is a bug that causes one or more indirdep dependency structures to fail to be deallocated. Until we manage to track down why they fail to get cleaned up, this code tracks them down and eliminates them so that the unmount can succeed. Reported by: Peter Holm Help from: kib Reviewed by: Chuck Silvers Tested by: Peter Holm MFC after: 7 days Sponsored by: Netflix --- sys/ufs/ffs/ffs_softdep.c | 54 ++++++++++++++++++++++++++++++++++++++++------- sys/ufs/ffs/softdep.h | 4 +--- 2 files changed, 47 insertions(+), 11 deletions(-) diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c index da80f28bc814..e518cc5c5deb 100644 --- a/sys/ufs/ffs/ffs_softdep.c +++ b/sys/ufs/ffs/ffs_softdep.c @@ -1233,9 +1233,7 @@ workitem_free(item, type) ump->um_fs->fs_fsmnt, TYPENAME(item->wk_type))); atomic_subtract_long(&dep_current[item->wk_type], 1); ump->softdep_curdeps[item->wk_type] -= 1; -#ifdef INVARIANTS LIST_REMOVE(item, wk_all); -#endif free(item, DtoM(type)); } @@ -1262,9 +1260,7 @@ workitem_alloc(item, type, mp) ump->softdep_curdeps[type] += 1; ump->softdep_deps++; ump->softdep_accdeps++; -#ifdef INVARIANTS LIST_INSERT_HEAD(&ump->softdep_alldeps[type], item, wk_all); -#endif FREE_LOCK(ump); } @@ -1293,10 +1289,8 @@ workitem_reassign(item, newtype) dep_total[newtype]++; FREE_GBLLOCK(&lk); item->wk_type = newtype; -#ifdef INVARIANTS LIST_REMOVE(item, wk_all); LIST_INSERT_HEAD(&ump->softdep_alldeps[newtype], item, wk_all); -#endif } /* @@ -2713,10 +2707,8 @@ softdep_mount(devvp, mp, fs, cred) sdp->sd_indirhashsize = i - 1; for (i = 0; i <= sdp->sd_indirhashsize; i++) TAILQ_INIT(&sdp->sd_indirhash[i]); -#ifdef INVARIANTS for (i = 0; i <= D_LAST; i++) LIST_INIT(&sdp->sd_alldeps[i]); -#endif ACQUIRE_GBLLOCK(&lk); TAILQ_INSERT_TAIL(&softdepmounts, sdp, sd_next); FREE_GBLLOCK(&lk); @@ -14793,9 +14785,12 @@ softdep_check_suspend(struct mount *mp, int secondary_writes, int secondary_accwrites) { + struct buf *bp; struct bufobj *bo; struct ufsmount *ump; struct inodedep *inodedep; + struct indirdep *indirdep; + struct worklist *wk, *nextwk; int error, unlinked; bo = &devvp->v_bufobj; @@ -14871,9 +14866,52 @@ softdep_check_suspend(struct mount *mp, } } + /* + * XXX Check for orphaned indirdep dependency structures. + * + * During forcible unmount after a disk failure there is a + * bug that causes one or more indirdep dependency structures + * to fail to be deallocated. We check for them here and clean + * them up so that the unmount can succeed. + */ + if ((ump->um_flags & UM_FSFAIL_CLEANUP) != 0 && ump->softdep_deps > 0 && + ump->softdep_deps == ump->softdep_curdeps[D_INDIRDEP]) { + LIST_FOREACH_SAFE(wk, &ump->softdep_alldeps[D_INDIRDEP], + wk_all, nextwk) { + indirdep = WK_INDIRDEP(wk); + if ((indirdep->ir_state & (GOINGAWAY | DEPCOMPLETE)) != + (GOINGAWAY | DEPCOMPLETE) || + !TAILQ_EMPTY(&indirdep->ir_trunc) || + !LIST_EMPTY(&indirdep->ir_completehd) || + !LIST_EMPTY(&indirdep->ir_writehd) || + !LIST_EMPTY(&indirdep->ir_donehd) || + !LIST_EMPTY(&indirdep->ir_deplisthd) || + indirdep->ir_saveddata != NULL || + indirdep->ir_savebp == NULL) { + printf("%s: skipping orphaned indirdep %p\n", + __FUNCTION__, indirdep); + continue; + } + printf("%s: freeing orphaned indirdep %p\n", + __FUNCTION__, indirdep); + bp = indirdep->ir_savebp; + indirdep->ir_savebp = NULL; + free_indirdep(indirdep); + FREE_LOCK(ump); + brelse(bp); + while (!TRY_ACQUIRE_LOCK(ump)) { + BO_UNLOCK(bo); + ACQUIRE_LOCK(ump); + FREE_LOCK(ump); + BO_LOCK(bo); + } + } + } + /* * Reasons for needing more work before suspend: * - Dirty buffers on devvp. + * - Dependency structures still exist * - Softdep activity occurred after start of vnode sync loop * - Secondary writes occurred after start of vnode sync loop */ diff --git a/sys/ufs/ffs/softdep.h b/sys/ufs/ffs/softdep.h index 3493aadafc98..41728be3ec0f 100644 --- a/sys/ufs/ffs/softdep.h +++ b/sys/ufs/ffs/softdep.h @@ -213,10 +213,10 @@ struct worklist { struct mount *wk_mp; /* Mount we live in */ unsigned int wk_type:8, /* type of request */ wk_state:24; /* state flags */ + LIST_ENTRY(worklist) wk_all; /* list of deps of this type */ #ifdef INVARIANTS const char *wk_func; /* func where added / removed */ int wk_line; /* line where added / removed */ - LIST_ENTRY(worklist) wk_all; /* list of deps of this type */ #endif }; #define WK_DATA(wk) ((void *)(wk)) @@ -1075,9 +1075,7 @@ struct mount_softdeps { TAILQ_ENTRY(mount_softdeps) sd_next; /* List of softdep filesystem */ struct ufsmount *sd_ump; /* our ufsmount structure */ u_long sd_curdeps[D_LAST + 1]; /* count of current deps */ -#ifdef INVARIANTS struct workhead sd_alldeps[D_LAST + 1];/* Lists of all deps */ -#endif }; /* * Flags for communicating with the syncer thread. From owner-dev-commits-src-all@freebsd.org Thu Jul 29 23: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 1C077656937; Thu, 29 Jul 2021 23: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 4GbRhq014Jz4rXY; Thu, 29 Jul 2021 23: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 CE43A1ABC7; Thu, 29 Jul 2021 23:35: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 16TNZ6Qi063715; Thu, 29 Jul 2021 23: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 16TNZ6Jc063714; Thu, 29 Jul 2021 23:35:06 GMT (envelope-from git) Date: Thu, 29 Jul 2021 23:35:06 GMT Message-Id: <202107292335.16TNZ6Jc063714@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: 67495c13d0bc - main - cxgbei: Wait for socket to close in icl_cxgbei_conn_close. 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: 67495c13d0bc25c57ebf0103e9d2af7c4a3088c9 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, 29 Jul 2021 23:35:07 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=67495c13d0bc25c57ebf0103e9d2af7c4a3088c9 commit 67495c13d0bc25c57ebf0103e9d2af7c4a3088c9 Author: John Baldwin AuthorDate: 2021-07-29 23:34:46 +0000 Commit: John Baldwin CommitDate: 2021-07-29 23:34:46 +0000 cxgbei: Wait for socket to close in icl_cxgbei_conn_close. This ensures the TOE has finished processing any in-flight received data before returning to the caller. The caller assumes it is safe to free any open tasks or transfers (and associated buffers) after this function returns. Previously, data placed directly via DDP could be written to buffers after the caller had freed the buffers. Reported by: Jithesh Arakkan @ Chelsio Sponsored by: Chelsio Communications --- sys/dev/cxgbe/cxgbei/icl_cxgbei.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c index e974ad73a935..4a6cf0a19d44 100644 --- a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c @@ -881,7 +881,14 @@ icl_cxgbei_conn_close(struct icl_conn *ic) INP_WLOCK(inp); if (toep != NULL) { /* NULL if connection was never offloaded. */ toep->ulpcb = NULL; + + /* Discard PDUs queued for TX. */ mbufq_drain(&toep->ulp_pduq); + + /* + * Wait for the cwt threads to stop processing this + * connection. + */ SOCKBUF_LOCK(sb); if (icc->rx_flags & RXF_ACTIVE) { volatile u_int *p = &icc->rx_flags; @@ -896,6 +903,10 @@ icl_cxgbei_conn_close(struct icl_conn *ic) SOCKBUF_LOCK(sb); } + /* + * Discard received PDUs not passed to the iSCSI + * layer. + */ while (!STAILQ_EMPTY(&icc->rcvd_pdus)) { ip = STAILQ_FIRST(&icc->rcvd_pdus); STAILQ_REMOVE_HEAD(&icc->rcvd_pdus, ip_next); @@ -914,7 +925,22 @@ icl_cxgbei_conn_close(struct icl_conn *ic) * queues were purged instead of delivered reliably but soabort isn't * really general purpose and wouldn't do the right thing here. */ + soref(so); soclose(so); + + /* + * Wait for the socket to fully close. This ensures any + * pending received data has been received (and in particular, + * any data that would be received by DDP has been handled). + * Callers assume that it is safe to free buffers for tasks + * and transfers after this function returns. + */ + SOCK_LOCK(so); + while ((so->so_state & SS_ISDISCONNECTED) == 0) + mtx_sleep(&so->so_timeo, SOCK_MTX(so), PSOCK, "conclo2", 0); + CURVNET_SET(so->so_vnet); + sorele(so); + CURVNET_RESTORE(); } static void From owner-dev-commits-src-all@freebsd.org Thu Jul 29 23: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 46163655EF7; Thu, 29 Jul 2021 23: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 4GbRhr0h13z4rgK; Thu, 29 Jul 2021 23: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 EBBD11AABF; Thu, 29 Jul 2021 23: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 16TNZ7tw063739; Thu, 29 Jul 2021 23:35:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16TNZ78k063738; Thu, 29 Jul 2021 23:35:07 GMT (envelope-from git) Date: Thu, 29 Jul 2021 23:35:07 GMT Message-Id: <202107292335.16TNZ78k063738@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: 5b5d78897c8b - main - Use a more specific type for geom_disk.d_event. 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: 5b5d78897c8b1ec6b6e1dd8dd9cdbf19fee32149 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, 29 Jul 2021 23:35:08 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=5b5d78897c8b1ec6b6e1dd8dd9cdbf19fee32149 commit 5b5d78897c8b1ec6b6e1dd8dd9cdbf19fee32149 Author: John Baldwin AuthorDate: 2021-07-29 23:34:46 +0000 Commit: John Baldwin CommitDate: 2021-07-29 23:34:46 +0000 Use a more specific type for geom_disk.d_event. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D31353 --- sys/geom/geom_disk.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/geom/geom_disk.h b/sys/geom/geom_disk.h index 7dd6e34c9ae2..10a14c9c1da7 100644 --- a/sys/geom/geom_disk.h +++ b/sys/geom/geom_disk.h @@ -125,7 +125,7 @@ struct disk { /* Fields private to geom_disk, to be moved on next version bump */ LIST_HEAD(,disk_alias) d_aliases; - void *d_event; + struct g_event *d_event; }; #define DISKFLAG_RESERVED 0x0001 /* Was NEEDSGIANT */ From owner-dev-commits-src-all@freebsd.org Fri Jul 30 00:09: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 04B2E657381; Fri, 30 Jul 2021 00:09: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 4GbST16Rqhz4tLK; Fri, 30 Jul 2021 00:09: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 C5EDD1B062; Fri, 30 Jul 2021 00:09: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 16U09vbi004444; Fri, 30 Jul 2021 00:09:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16U09vhB004443; Fri, 30 Jul 2021 00:09:57 GMT (envelope-from git) Date: Fri, 30 Jul 2021 00:09:57 GMT Message-Id: <202107300009.16U09vhB004443@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: 419d406e4ee0 - main - geom_vfs: Pre-allocate event for g_vfs_destroy. 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: 419d406e4ee068644218fb881bc80f79f8191970 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, 30 Jul 2021 00:09:58 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=419d406e4ee068644218fb881bc80f79f8191970 commit 419d406e4ee068644218fb881bc80f79f8191970 Author: John Baldwin AuthorDate: 2021-07-30 00:09:23 +0000 Commit: John Baldwin CommitDate: 2021-07-30 00:09:23 +0000 geom_vfs: Pre-allocate event for g_vfs_destroy. When an active g_vfs is orphaned due to an underlying disk going away the destroy is deferred until the filesystem is unmounted in g_vfs_done(). However, g_vfs_done() is invoked from a non-sleepable context and cannot use M_WAITOK to allocate the event. Instead, allocate the event in g_vfs_orphan() and save it in the softc to be retrieved by the last call to g_vfs_done(). Reported by: Jithesh Arakkan @ Chelsio Reviewed by: imp Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D31354 --- sys/geom/geom_vfs.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/sys/geom/geom_vfs.c b/sys/geom/geom_vfs.c index f01765b8ee30..592062b8b12a 100644 --- a/sys/geom/geom_vfs.c +++ b/sys/geom/geom_vfs.c @@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$"); struct g_vfs_softc { struct mtx sc_mtx; struct bufobj *sc_bo; + struct g_event *sc_event; int sc_active; int sc_orphaned; int sc_enxio_active; @@ -96,6 +97,7 @@ static void g_vfs_done(struct bio *bip) { struct g_consumer *cp; + struct g_event *event; struct g_vfs_softc *sc; struct buf *bp; int destroy; @@ -157,9 +159,14 @@ g_vfs_done(struct bio *bip) mtx_lock(&sc->sc_mtx); destroy = ((--sc->sc_active) == 0 && sc->sc_orphaned); + if (destroy) { + event = sc->sc_event; + sc->sc_event = NULL; + } else + event = NULL; mtx_unlock(&sc->sc_mtx); if (destroy) - g_post_event(g_vfs_destroy, cp, M_WAITOK, NULL); + g_post_event_ep(g_vfs_destroy, cp, event, NULL); bufdone(bp); } @@ -212,6 +219,7 @@ static void g_vfs_orphan(struct g_consumer *cp) { struct g_geom *gp; + struct g_event *event; struct g_vfs_softc *sc; int destroy; @@ -222,12 +230,20 @@ g_vfs_orphan(struct g_consumer *cp) sc = gp->softc; if (sc == NULL) return; + event = g_alloc_event(M_WAITOK); mtx_lock(&sc->sc_mtx); + KASSERT(sc->sc_event == NULL, ("g_vfs %p already has an event", sc)); sc->sc_orphaned = 1; destroy = (sc->sc_active == 0); + if (!destroy) { + sc->sc_event = event; + event = NULL; + } mtx_unlock(&sc->sc_mtx); - if (destroy) + if (destroy) { + g_free(event); g_vfs_destroy(cp, 0); + } /* * Do not destroy the geom. Filesystem will do that during unmount. @@ -297,5 +313,6 @@ g_vfs_close(struct g_consumer *cp) mtx_destroy(&sc->sc_mtx); if (!sc->sc_orphaned || cp->provider == NULL) g_wither_geom_close(gp, ENXIO); + KASSERT(sc->sc_event == NULL, ("g_vfs %p event is non-NULL", sc)); g_free(sc); } From owner-dev-commits-src-all@freebsd.org Fri Jul 30 00:31: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 9C2406570F5; Fri, 30 Jul 2021 00:31: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 4GbSxP3zwHz4vQY; Fri, 30 Jul 2021 00:31: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 723B91B7A8; Fri, 30 Jul 2021 00:31: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 16U0V5C6038562; Fri, 30 Jul 2021 00:31:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16U0V5QW038561; Fri, 30 Jul 2021 00:31:05 GMT (envelope-from git) Date: Fri, 30 Jul 2021 00:31:05 GMT Message-Id: <202107300031.16U0V5QW038561@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: fe6803c18e81 - stable/13 - ixgbe: Clean up ix_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: fe6803c18e814d3fdf901ecec3442f7ad959b6a4 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, 30 Jul 2021 00:31:05 -0000 The branch stable/13 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=fe6803c18e814d3fdf901ecec3442f7ad959b6a4 commit fe6803c18e814d3fdf901ecec3442f7ad959b6a4 Author: Kevin Bowling AuthorDate: 2021-07-18 06:24:28 +0000 Commit: Kevin Bowling CommitDate: 2021-07-30 00:27:24 +0000 ixgbe: Clean up ix_txrx The intention here is to reduce differences with D30072. The only functional change is logical simplification in ixgbe_rx_checksum. Reviewed by: gallatin Differential Revision: https://reviews.freebsd.org/D30074 (cherry picked from commit 51e46835e10a2628482deefc0efd356fb733337a) --- sys/dev/ixgbe/ix_txrx.c | 87 +++++++++++++++++++++++-------------------------- 1 file changed, 40 insertions(+), 47 deletions(-) diff --git a/sys/dev/ixgbe/ix_txrx.c b/sys/dev/ixgbe/ix_txrx.c index 9d31e0b1b43e..fe38919fc594 100644 --- a/sys/dev/ixgbe/ix_txrx.c +++ b/sys/dev/ixgbe/ix_txrx.c @@ -50,16 +50,19 @@ static void ixgbe_isc_txd_flush(void *arg, uint16_t txqid, qidx_t pidx); static int ixgbe_isc_txd_credits_update(void *arg, uint16_t txqid, bool clear); static void ixgbe_isc_rxd_refill(void *arg, if_rxd_update_t iru); -static void ixgbe_isc_rxd_flush(void *arg, uint16_t qsidx, uint8_t flidx __unused, qidx_t pidx); +static void ixgbe_isc_rxd_flush(void *arg, uint16_t qsidx, + uint8_t flidx __unused, qidx_t pidx); static int ixgbe_isc_rxd_available(void *arg, uint16_t qsidx, qidx_t pidx, - qidx_t budget); + qidx_t budget); static int ixgbe_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri); -static void ixgbe_rx_checksum(u32 staterr, if_rxd_info_t ri, u32 ptype); -static int ixgbe_tx_ctx_setup(struct ixgbe_adv_tx_context_desc *, if_pkt_info_t); +static void ixgbe_rx_checksum(uint32_t staterr, if_rxd_info_t ri, + uint32_t ptype); +static int ixgbe_tx_ctx_setup(struct ixgbe_adv_tx_context_desc *, + if_pkt_info_t); extern void ixgbe_if_enable_intr(if_ctx_t ctx); -static int ixgbe_determine_rsstype(u16 pkt_info); +static int ixgbe_determine_rsstype(uint16_t pkt_info); struct if_txrx ixgbe_txrx = { .ift_txd_encap = ixgbe_isc_txd_encap, @@ -81,8 +84,8 @@ struct if_txrx ixgbe_txrx = { static int ixgbe_tx_ctx_setup(struct ixgbe_adv_tx_context_desc *TXD, if_pkt_info_t pi) { - u32 vlan_macip_lens, type_tucmd_mlhl; - u32 olinfo_status, mss_l4len_idx, pktlen, offload; + uint32_t vlan_macip_lens, type_tucmd_mlhl; + uint32_t olinfo_status, mss_l4len_idx, pktlen, offload; u8 ehdrlen; offload = TRUE; @@ -150,7 +153,7 @@ ixgbe_tx_ctx_setup(struct ixgbe_adv_tx_context_desc *TXD, if_pkt_info_t pi) offload = FALSE; break; } -/* Insert L4 checksum into data descriptors */ + /* Insert L4 checksum into data descriptors */ if (offload) olinfo_status |= IXGBE_TXD_POPTS_TXSM << 8; @@ -180,7 +183,7 @@ ixgbe_isc_txd_encap(void *arg, if_pkt_info_t pi) union ixgbe_adv_tx_desc *txd = NULL; struct ixgbe_adv_tx_context_desc *TXD; int i, j, first, pidx_last; - u32 olinfo_status, cmd, flags; + uint32_t olinfo_status, cmd, flags; qidx_t ntxd; cmd = (IXGBE_ADVTXD_DTYP_DATA | @@ -364,7 +367,7 @@ ixgbe_isc_rxd_available(void *arg, uint16_t qsidx, qidx_t pidx, qidx_t budget) struct ix_rx_queue *que = &sc->rx_queues[qsidx]; struct rx_ring *rxr = &que->rxr; union ixgbe_adv_rx_desc *rxd; - u32 staterr; + uint32_t staterr; int cnt, i, nrxd; nrxd = sc->shared->isc_nrxd[0]; @@ -400,11 +403,11 @@ ixgbe_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) struct ifnet *ifp = iflib_get_ifp(adapter->ctx); union ixgbe_adv_rx_desc *rxd; - u16 pkt_info, len, cidx, i; - u16 vtag = 0; - u32 ptype; - u32 staterr = 0; - bool eop; + uint16_t pkt_info, len, cidx, i; + uint16_t vtag = 0; + uint32_t ptype; + uint32_t staterr = 0; + bool eop; i = 0; cidx = ri->iri_cidx; @@ -434,11 +437,8 @@ ixgbe_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) /* Make sure bad packets are discarded */ if (eop && (staterr & IXGBE_RXDADV_ERR_FRAME_ERR_MASK) != 0) { - -#if __FreeBSD_version >= 1100036 if (adapter->feat_en & IXGBE_FEATURE_VF) if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); -#endif rxr->rx_discarded++; return (EBADMSG); @@ -483,35 +483,28 @@ ixgbe_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) * doesn't spend time verifying the checksum. ************************************************************************/ static void -ixgbe_rx_checksum(u32 staterr, if_rxd_info_t ri, u32 ptype) +ixgbe_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; - - if ((ptype & IXGBE_RXDADV_PKTTYPE_ETQF) == 0 && - (ptype & IXGBE_RXDADV_PKTTYPE_SCTP) != 0) - sctp = TRUE; - - /* IPv4 checksum */ - if (status & IXGBE_RXD_STAT_IPCS) { - if (!(errors & IXGBE_RXD_ERR_IPE)) { - /* IP Checksum Good */ - ri->iri_csum_flags = CSUM_IP_CHECKED | CSUM_IP_VALID; - } else - ri->iri_csum_flags = 0; - } - /* TCP/UDP/SCTP checksum */ - if (status & IXGBE_RXD_STAT_L4CS) { - u64 type = (CSUM_DATA_VALID | CSUM_PSEUDO_HDR); -#if __FreeBSD_version >= 800000 - if (sctp) - type = CSUM_SCTP_VALID; -#endif - if (!(errors & IXGBE_RXD_ERR_TCPE)) { - ri->iri_csum_flags |= type; - if (!sctp) - ri->iri_csum_data = htons(0xffff); + uint16_t status = (uint16_t)staterr; + uint8_t errors = (uint8_t)(staterr >> 24); + + /* If there is a layer 3 or 4 error we are done */ + if (__predict_false(errors & (IXGBE_RXD_ERR_IPE | IXGBE_RXD_ERR_TCPE))) + return; + + /* IP Checksum Good */ + if (status & IXGBE_RXD_STAT_IPCS) + ri->iri_csum_flags = (CSUM_IP_CHECKED | CSUM_IP_VALID); + + /* Valid L4E checksum */ + if (__predict_true(status & IXGBE_RXD_STAT_L4CS)) { + /* SCTP header present. */ + if (__predict_false((ptype & IXGBE_RXDADV_PKTTYPE_ETQF) == 0 && + (ptype & IXGBE_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); } } } /* ixgbe_rx_checksum */ @@ -522,7 +515,7 @@ ixgbe_rx_checksum(u32 staterr, if_rxd_info_t ri, u32 ptype) * Parse the packet type to determine the appropriate hash ************************************************************************/ static int -ixgbe_determine_rsstype(u16 pkt_info) +ixgbe_determine_rsstype(uint16_t pkt_info) { switch (pkt_info & IXGBE_RXDADV_RSSTYPE_MASK) { case IXGBE_RXDADV_RSSTYPE_IPV4_TCP: From owner-dev-commits-src-all@freebsd.org Fri Jul 30 00:31: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 C276B6576EC; Fri, 30 Jul 2021 00:31: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 4GbSxN31TXz4vQW; Fri, 30 Jul 2021 00:31: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 4FFD91B889; Fri, 30 Jul 2021 00:31: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 16U0V4rG038538; Fri, 30 Jul 2021 00:31:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16U0V4ic038537; Fri, 30 Jul 2021 00:31:04 GMT (envelope-from git) Date: Fri, 30 Jul 2021 00:31:04 GMT Message-Id: <202107300031.16U0V4ic038537@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: ebdd2bc44108 - stable/13 - ixgbe: Print FW NVM and Option ROM versions 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: ebdd2bc441082a874407cb4e220391b46ca36595 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, 30 Jul 2021 00:31:04 -0000 The branch stable/13 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=ebdd2bc441082a874407cb4e220391b46ca36595 commit ebdd2bc441082a874407cb4e220391b46ca36595 Author: Kevin Bowling AuthorDate: 2021-07-16 06:50:14 +0000 Commit: Kevin Bowling CommitDate: 2021-07-30 00:26:45 +0000 ixgbe: Print FW NVM and Option ROM versions It can be useful for system operators to see this kind of information when correlating issues or requesting support from the OEM or Intel for hardware and firmware issues. Reviewed by: gallatin MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D30178 (cherry picked from commit 7660e4ea5cb750ded38a0bd81cde2e2b130222df) --- sys/dev/ixgbe/if_ix.c | 100 +++++++++++++++++++++++++++++++++++++++++++++ sys/dev/ixgbe/ixgbe_type.h | 2 +- 2 files changed, 101 insertions(+), 1 deletion(-) diff --git a/sys/dev/ixgbe/if_ix.c b/sys/dev/ixgbe/if_ix.c index fbe4f1df38ca..8e14a008e09b 100644 --- a/sys/dev/ixgbe/if_ix.c +++ b/sys/dev/ixgbe/if_ix.c @@ -173,6 +173,8 @@ static void ixgbe_initialize_transmit_units(if_ctx_t ctx); static int ixgbe_setup_interface(if_ctx_t ctx); static void ixgbe_init_device_features(struct adapter *adapter); static void ixgbe_check_fan_failure(struct adapter *, u32, bool); +static void ixgbe_sbuf_fw_version(struct ixgbe_hw *, struct sbuf *); +static void ixgbe_print_fw_version(if_ctx_t ctx); static void ixgbe_add_media_types(if_ctx_t ctx); static void ixgbe_update_stats_counters(struct adapter *adapter); static void ixgbe_config_link(if_ctx_t ctx); @@ -196,6 +198,7 @@ static int ixgbe_sysctl_interrupt_rate_handler(SYSCTL_HANDLER_ARGS); static int ixgbe_sysctl_dmac(SYSCTL_HANDLER_ARGS); static int ixgbe_sysctl_phy_temp(SYSCTL_HANDLER_ARGS); static int ixgbe_sysctl_phy_overtemp_occurred(SYSCTL_HANDLER_ARGS); +static int ixgbe_sysctl_print_fw_version(SYSCTL_HANDLER_ARGS); #ifdef IXGBE_DEBUG static int ixgbe_sysctl_power_state(SYSCTL_HANDLER_ARGS); static int ixgbe_sysctl_print_rss_config(SYSCTL_HANDLER_ARGS); @@ -1119,6 +1122,9 @@ ixgbe_if_attach_post(if_ctx_t ctx) */ ixgbe_bypass_init(adapter); + /* Display NVM and Option ROM versions */ + ixgbe_print_fw_version(ctx); + /* Set an initial dmac value */ adapter->dmac = 0; /* Set initial advertised speeds (if applicable) */ @@ -2648,6 +2654,10 @@ ixgbe_add_device_sysctls(if_ctx_t ctx) SYSCTL_ADD_INT(ctx_list, child, OID_AUTO, "enable_aim", CTLFLAG_RW, &adapter->enable_aim, 0, "Interrupt Moderation"); + SYSCTL_ADD_PROC(ctx_list, child, OID_AUTO, "fw_version", + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT, adapter, 0, + ixgbe_sysctl_print_fw_version, "A", "Prints FW/NVM Versions"); + #ifdef IXGBE_DEBUG /* testing sysctls (for all devices) */ SYSCTL_ADD_PROC(ctx_list, child, OID_AUTO, "power_state", @@ -4674,3 +4684,93 @@ ixgbe_check_fan_failure(struct adapter *adapter, u32 reg, bool in_interrupt) if (reg & mask) device_printf(adapter->dev, "\nCRITICAL: FAN FAILURE!! REPLACE IMMEDIATELY!!\n"); } /* ixgbe_check_fan_failure */ + +/************************************************************************ + * ixgbe_sbuf_fw_version + ************************************************************************/ +static void +ixgbe_sbuf_fw_version(struct ixgbe_hw *hw, struct sbuf *buf) +{ + struct ixgbe_nvm_version nvm_ver = {0}; + uint16_t phyfw = 0; + int status; + + ixgbe_get_oem_prod_version(hw, &nvm_ver); /* OEM's NVM version */ + ixgbe_get_orom_version(hw, &nvm_ver); /* Option ROM */ + ixgbe_get_etk_id(hw, &nvm_ver); /* eTrack identifies a build in Intel's SCM */ + status = ixgbe_get_phy_firmware_version(hw, &phyfw); + + if (nvm_ver.oem_valid) + sbuf_printf(buf, "NVM OEM V%d.%d R%d ", nvm_ver.oem_major, + nvm_ver.oem_minor, nvm_ver.oem_release); + + if (nvm_ver.or_valid) + sbuf_printf(buf, "Option ROM V%d-b%d-p%d ", nvm_ver.or_major, + nvm_ver.or_build, nvm_ver.or_patch); + + if (nvm_ver.etk_id != ((NVM_VER_INVALID << NVM_ETK_SHIFT) | NVM_VER_INVALID)) + sbuf_printf(buf, "eTrack 0x%08x ", nvm_ver.etk_id); + + if (phyfw != 0 && status == IXGBE_SUCCESS) + sbuf_printf(buf, "PHY FW V%d ", phyfw); + + sbuf_trim(buf); +} /* ixgbe_sbuf_fw_version */ + +/************************************************************************ + * ixgbe_print_fw_version + ************************************************************************/ +static void +ixgbe_print_fw_version(if_ctx_t ctx) +{ + struct adapter *adapter = iflib_get_softc(ctx); + struct ixgbe_hw *hw = &adapter->hw; + device_t dev = adapter->dev; + struct sbuf *buf; + int error = 0; + + buf = sbuf_new_auto(); + if (!buf) { + device_printf(dev, "Could not allocate sbuf for output.\n"); + return; + } + + ixgbe_sbuf_fw_version(hw, buf); + + error = sbuf_finish(buf); + if (error) + device_printf(dev, "Error finishing sbuf: %d\n", error); + else if (sbuf_len(buf)) + device_printf(dev, "%s\n", sbuf_data(buf)); + + sbuf_delete(buf); +} /* ixgbe_print_fw_version */ + +/************************************************************************ + * ixgbe_sysctl_print_fw_version + ************************************************************************/ +static int +ixgbe_sysctl_print_fw_version(SYSCTL_HANDLER_ARGS) +{ + struct adapter *adapter = (struct adapter *)arg1; + struct ixgbe_hw *hw = &adapter->hw; + device_t dev = adapter->dev; + struct sbuf *buf; + int error = 0; + + buf = sbuf_new_for_sysctl(NULL, NULL, 128, req); + if (!buf) { + device_printf(dev, "Could not allocate sbuf for output.\n"); + return (ENOMEM); + } + + ixgbe_sbuf_fw_version(hw, buf); + + error = sbuf_finish(buf); + if (error) + device_printf(dev, "Error finishing sbuf: %d\n", error); + + sbuf_delete(buf); + + return (0); +} /* ixgbe_sysctl_print_fw_version */ diff --git a/sys/dev/ixgbe/ixgbe_type.h b/sys/dev/ixgbe/ixgbe_type.h index fc5f191ee65e..1d00eadc890a 100644 --- a/sys/dev/ixgbe/ixgbe_type.h +++ b/sys/dev/ixgbe/ixgbe_type.h @@ -306,7 +306,7 @@ #define NVM_VER_INVALID 0xFFFF #define NVM_ETK_VALID 0x8000 #define NVM_INVALID_PTR 0xFFFF -#define NVM_VER_SIZE 32 /* version sting size */ +#define NVM_VER_SIZE 32 /* version string size */ struct ixgbe_nvm_version { u32 etk_id; From owner-dev-commits-src-all@freebsd.org Fri Jul 30 00:33: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 6E08E657A32; Fri, 30 Jul 2021 00:33: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 4GbSzt2jqjz4vdC; Fri, 30 Jul 2021 00: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 4551F1B999; Fri, 30 Jul 2021 00: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 16U0XEiJ043597; Fri, 30 Jul 2021 00: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 16U0XEAi043596; Fri, 30 Jul 2021 00:33:14 GMT (envelope-from git) Date: Fri, 30 Jul 2021 00:33:14 GMT Message-Id: <202107300033.16U0XEAi043596@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: b76e41fca95f - stable/13 - Add required sysctl name length checks to various handlers 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: b76e41fca95f189a1bc759f3318c96ff8653ba01 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, 30 Jul 2021 00:33:14 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=b76e41fca95f189a1bc759f3318c96ff8653ba01 commit b76e41fca95f189a1bc759f3318c96ff8653ba01 Author: Mark Johnston AuthorDate: 2021-07-23 14:37:11 +0000 Commit: Mark Johnston CommitDate: 2021-07-30 00:32:58 +0000 Add required sysctl name length checks to various handlers Reported by: KMSAN Sponsored by: The FreeBSD Foundation (cherry picked from commit 0dcef81de9915e8ce1e3985204bebe7026d96b6f) --- sys/kern/kern_descrip.c | 20 ++++++++++++++++++++ sys/kern/kern_proc.c | 16 +++++++++++++++- sys/net/rtsock.c | 5 ++++- 3 files changed, 39 insertions(+), 2 deletions(-) diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index 36092c9acd42..c7269e4b33a9 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -4092,8 +4092,13 @@ sysctl_kern_proc_nfds(SYSCTL_HANDLER_ARGS) { NDSLOTTYPE *map; struct filedesc *fdp; + u_int namelen; int count, off, minoff; + namelen = arg2; + if (namelen != 1) + return (EINVAL); + if (*(int *)arg1 != 0) return (EINVAL); @@ -4482,8 +4487,13 @@ sysctl_kern_proc_filedesc(SYSCTL_HANDLER_ARGS) struct sbuf sb; struct proc *p; ssize_t maxlen; + u_int namelen; int error, error2, *name; + namelen = arg2; + if (namelen != 1) + return (EINVAL); + name = (int *)arg1; sbuf_new_for_sysctl(&sb, NULL, FILEDESC_SBUF_SIZE, req); @@ -4561,10 +4571,15 @@ sysctl_kern_proc_ofiledesc(SYSCTL_HANDLER_ARGS) struct filedesc *fdp; struct pwddesc *pdp; struct pwd *pwd; + u_int namelen; int error, i, lastfile, *name; struct file *fp; struct proc *p; + namelen = arg2; + if (namelen != 1) + return (EINVAL); + name = (int *)arg1; error = pget((pid_t)name[0], PGET_CANDEBUG | PGET_NOTWEXIT, &p); if (error != 0) @@ -4706,8 +4721,13 @@ sysctl_kern_proc_cwd(SYSCTL_HANDLER_ARGS) struct sbuf sb; struct proc *p; ssize_t maxlen; + u_int namelen; int error, error2, *name; + namelen = arg2; + if (namelen != 1) + return (EINVAL); + name = (int *)arg1; sbuf_new_for_sysctl(&sb, NULL, sizeof(struct kinfo_file), req); diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index ec732e8db060..2017f824f6ad 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -2297,7 +2297,7 @@ static int sysctl_kern_proc_ovmmap(SYSCTL_HANDLER_ARGS) { vm_map_entry_t entry, tmp_entry; - unsigned int last_timestamp; + unsigned int last_timestamp, namelen; char *fullpath, *freepath; struct kinfo_ovmentry *kve; struct vattr va; @@ -2308,6 +2308,10 @@ sysctl_kern_proc_ovmmap(SYSCTL_HANDLER_ARGS) vm_map_t map; struct vmspace *vm; + namelen = arg2; + if (namelen != 1) + return (EINVAL); + name = (int *)arg1; error = pget((pid_t)name[0], PGET_WANTREAD, &p); if (error != 0) @@ -2678,8 +2682,13 @@ sysctl_kern_proc_vmmap(SYSCTL_HANDLER_ARGS) { struct proc *p; struct sbuf sb; + u_int namelen; int error, error2, *name; + namelen = arg2; + if (namelen != 1) + return (EINVAL); + name = (int *)arg1; sbuf_new_for_sysctl(&sb, NULL, sizeof(struct kinfo_vmentry), req); sbuf_clear_flags(&sb, SBUF_INCLUDENUL); @@ -2705,6 +2714,11 @@ sysctl_kern_proc_kstack(SYSCTL_HANDLER_ARGS) struct stack *st; struct sbuf sb; struct proc *p; + u_int namelen; + + namelen = arg2; + if (namelen != 1) + return (EINVAL); name = (int *)arg1; error = pget((pid_t)name[0], PGET_NOTINEXEC | PGET_WANTREAD, &p); diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index 3cb645f42e4c..1f898c739725 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -2563,7 +2563,10 @@ sysctl_rtsock(SYSCTL_HANDLER_ARGS) u_char af; struct walkarg w; - name ++; + if (namelen < 3) + return (EINVAL); + + name++; namelen--; if (req->newptr) return (EPERM); From owner-dev-commits-src-all@freebsd.org Fri Jul 30 00: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 B309A657C0C; Fri, 30 Jul 2021 00: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 4GbSzv4ZFlz4vTr; Fri, 30 Jul 2021 00:33: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 6ED931B99A; Fri, 30 Jul 2021 00:33: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 16U0XFGm043621; Fri, 30 Jul 2021 00:33:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16U0XFx0043620; Fri, 30 Jul 2021 00:33:15 GMT (envelope-from git) Date: Fri, 30 Jul 2021 00:33:15 GMT Message-Id: <202107300033.16U0XFx0043620@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: a67749ac451e - stable/13 - vfs: Initialize "lastfail" in vfs_mountroot_wait() 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: a67749ac451e1ca22bde3c2a63db9ec0e962aa21 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, 30 Jul 2021 00:33:15 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=a67749ac451e1ca22bde3c2a63db9ec0e962aa21 commit a67749ac451e1ca22bde3c2a63db9ec0e962aa21 Author: Mark Johnston AuthorDate: 2021-07-23 16:04:02 +0000 Commit: Mark Johnston CommitDate: 2021-07-30 00:32:58 +0000 vfs: Initialize "lastfail" in vfs_mountroot_wait() This variable is only used to rate-limit "Root mount waiting for: ..." messages using ppsratecheck(). Reported by: KMSAN Sponsored by: The FreeBSD Foundation (cherry picked from commit 048cd371f3d793fa354f1d3a1d484bc2725a3fc1) --- sys/kern/vfs_mountroot.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/kern/vfs_mountroot.c b/sys/kern/vfs_mountroot.c index 3b968fd19bbd..a34ae3fe06e3 100644 --- a/sys/kern/vfs_mountroot.c +++ b/sys/kern/vfs_mountroot.c @@ -982,6 +982,7 @@ vfs_mountroot_wait(void) TSENTER(); curfail = 0; + lastfail.tv_sec = 0; while (1) { g_waitidle(); mtx_lock(&root_holds_mtx); From owner-dev-commits-src-all@freebsd.org Fri Jul 30 00:33: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 570586579C1; Fri, 30 Jul 2021 00:33: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 4GbSzy6z8Mz4vgn; Fri, 30 Jul 2021 00:33: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 D25F91B7CD; Fri, 30 Jul 2021 00:33: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 16U0XIg9043700; Fri, 30 Jul 2021 00:33:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16U0XIdu043699; Fri, 30 Jul 2021 00:33:18 GMT (envelope-from git) Date: Fri, 30 Jul 2021 00:33:18 GMT Message-Id: <202107300033.16U0XIdu043699@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: 9ac0aec3a32c - stable/13 - lio_listio: Don't post a completion notification if none was requested 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: 9ac0aec3a32c84599cfbcc9f70ca2e035a3ddc0b 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, 30 Jul 2021 00:33:19 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=9ac0aec3a32c84599cfbcc9f70ca2e035a3ddc0b commit 9ac0aec3a32c84599cfbcc9f70ca2e035a3ddc0b Author: Mark Johnston AuthorDate: 2021-07-16 02:38:46 +0000 Commit: Mark Johnston CommitDate: 2021-07-30 00:32:58 +0000 lio_listio: Don't post a completion notification if none was requested One is allowed to use LIO_NOWAIT without specifying a sigevent. In this case, lj->lioj_signal is left uninitialized, but several code paths examine liov_signal.sigev_notify to figure out which notification to post. Unconditionally initialize that field to SIGEV_NONE. Add a dumb test case which triggers the bug. Reported by: KMSAN+syzkaller Reviewed by: asomers Sponsored by: The FreeBSD Foundation (cherry picked from commit 2e5f6152952e4cfbaab3d96368c3dc4218786632) --- sys/kern/vfs_aio.c | 1 + tests/sys/aio/lio_test.c | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/sys/kern/vfs_aio.c b/sys/kern/vfs_aio.c index 640e82b6f0ff..7d4d9ac3e94b 100644 --- a/sys/kern/vfs_aio.c +++ b/sys/kern/vfs_aio.c @@ -2246,6 +2246,7 @@ kern_lio_listio(struct thread *td, int mode, struct aiocb * const *uacb_list, lj->lioj_flags = 0; lj->lioj_count = 0; lj->lioj_finished_count = 0; + lj->lioj_signal.sigev_notify = SIGEV_NONE; knlist_init_mtx(&lj->klist, AIO_MTX(ki)); ksiginfo_init(&lj->lioj_ksi); diff --git a/tests/sys/aio/lio_test.c b/tests/sys/aio/lio_test.c index fb519aac978d..a4f5a6a38632 100644 --- a/tests/sys/aio/lio_test.c +++ b/tests/sys/aio/lio_test.c @@ -133,6 +133,15 @@ ATF_TC_BODY(lio_listio_empty_wait, tc) ATF_REQUIRE_EQ(0, lio_listio(LIO_WAIT, &list, 0, NULL)); } +/* With LIO_NOWAIT, an empty lio_listio should return immediately */ +ATF_TC_WITHOUT_HEAD(lio_listio_empty_nowait); +ATF_TC_BODY(lio_listio_empty_nowait, tc) +{ + struct aiocb *list = NULL; + + ATF_REQUIRE_EQ(0, lio_listio(LIO_NOWAIT, &list, 0, NULL)); +} + /* * With LIO_NOWAIT, an empty lio_listio should send completion notification * immediately @@ -253,6 +262,7 @@ ATF_TP_ADD_TCS(tp) { ATF_TP_ADD_TC(tp, lio_listio_eagain_kevent); + ATF_TP_ADD_TC(tp, lio_listio_empty_nowait); ATF_TP_ADD_TC(tp, lio_listio_empty_nowait_kevent); ATF_TP_ADD_TC(tp, lio_listio_empty_nowait_signal); ATF_TP_ADD_TC(tp, lio_listio_empty_nowait_thread); From owner-dev-commits-src-all@freebsd.org Fri Jul 30 00:33: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 E3D6F657D87; Fri, 30 Jul 2021 00:33: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 4GbSzw4v1nz4vn8; Fri, 30 Jul 2021 00:33: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 8DA7D1B90B; Fri, 30 Jul 2021 00:33: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 16U0XGRl043645; Fri, 30 Jul 2021 00:33:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16U0XGaW043644; Fri, 30 Jul 2021 00:33:16 GMT (envelope-from git) Date: Fri, 30 Jul 2021 00:33:16 GMT Message-Id: <202107300033.16U0XGaW043644@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: fdeacf8fdf65 - stable/13 - acct: Zero pad bytes in accounting records 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: fdeacf8fdf653805084d6a72292f902ed019ef23 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, 30 Jul 2021 00:33:17 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=fdeacf8fdf653805084d6a72292f902ed019ef23 commit fdeacf8fdf653805084d6a72292f902ed019ef23 Author: Mark Johnston AuthorDate: 2021-07-23 14:29:57 +0000 Commit: Mark Johnston CommitDate: 2021-07-30 00:32:58 +0000 acct: Zero pad bytes in accounting records Reported by: KMSAN Sponsored by: The FreeBSD Foundation (cherry picked from commit 90959dd1e50ee820e84bed4bc63fbed140298441) --- sys/kern/kern_acct.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/kern/kern_acct.c b/sys/kern/kern_acct.c index 4c1efada10da..ad272676083e 100644 --- a/sys/kern/kern_acct.c +++ b/sys/kern/kern_acct.c @@ -349,6 +349,8 @@ acct_process(struct thread *td) if (acct_vp == NULL || acct_suspended) return (0); + memset(&acct, 0, sizeof(acct)); + sx_slock(&acct_sx); /* From owner-dev-commits-src-all@freebsd.org Fri Jul 30 00:33: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 8976A657D92; Fri, 30 Jul 2021 00:33: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 4GbT001YVfz4vgy; Fri, 30 Jul 2021 00:33: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 F15C71B462; Fri, 30 Jul 2021 00:33: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 16U0XJ3x043724; Fri, 30 Jul 2021 00:33:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16U0XJ5F043723; Fri, 30 Jul 2021 00:33:19 GMT (envelope-from git) Date: Fri, 30 Jul 2021 00:33:19 GMT Message-Id: <202107300033.16U0XJ5F043723@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: 61acafc6c67e - stable/13 - rtld/arm64: Remove checks for undefined symbols when processing TPREL64 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: 61acafc6c67e1930803f70002d3a610f4314042a 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, 30 Jul 2021 00:33:20 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=61acafc6c67e1930803f70002d3a610f4314042a commit 61acafc6c67e1930803f70002d3a610f4314042a Author: Mark Johnston AuthorDate: 2021-07-16 02:26:25 +0000 Commit: Mark Johnston CommitDate: 2021-07-30 00:32:58 +0000 rtld/arm64: Remove checks for undefined symbols when processing TPREL64 lld emits several GOT relocations referencing the null sumbol in libc.so when compiled with -ftls-model=initial-exec. This symbol is specified to be undefined. We generally do not handle dynamic TLS relocations against weak, undefined symbols, so avoid printing a warning here. This makes it possible to compile libc.so using the initial-exec TLS model on arm64. Reviewed by: jrtc27, kib Sponsored by: The FreeBSD Foundation (cherry picked from commit f238ebd1429312ac2a4cb9f764babc4b6f69721e) --- libexec/rtld-elf/aarch64/reloc.c | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/libexec/rtld-elf/aarch64/reloc.c b/libexec/rtld-elf/aarch64/reloc.c index 8d9c23a41aa5..8cc66c87d698 100644 --- a/libexec/rtld-elf/aarch64/reloc.c +++ b/libexec/rtld-elf/aarch64/reloc.c @@ -479,25 +479,8 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int flags, return (-1); } } - /* Test weak undefined thread variable */ - if (def->st_shndx != SHN_UNDEF) { - *where = def->st_value + rela->r_addend + - defobj->tlsoffset; - } else { - /* - * XXX We should relocate undefined thread - * weak variable address to NULL, but how? - * Can we return error in this situation? - */ - rtld_printf("%s: Unable to relocate undefined " - "weak TLS variable\n", obj->path); -#if 0 - return (-1); -#else - *where = def->st_value + rela->r_addend + - defobj->tlsoffset; -#endif - } + *where = def->st_value + rela->r_addend + + defobj->tlsoffset; break; /* From owner-dev-commits-src-all@freebsd.org Fri Jul 30 00:33: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 7DD45657D14; Fri, 30 Jul 2021 00:33: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 4GbT011tbqz4vh2; Fri, 30 Jul 2021 00:33: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 1D5551B634; Fri, 30 Jul 2021 00:33: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 16U0XLC8043750; Fri, 30 Jul 2021 00:33:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16U0XLQq043749; Fri, 30 Jul 2021 00:33:21 GMT (envelope-from git) Date: Fri, 30 Jul 2021 00:33:21 GMT Message-Id: <202107300033.16U0XLQq043749@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: d364264b29bc - stable/13 - cdefs: Add a default definition for __nosanitizememory 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: d364264b29bca40de1a8fd728637be42644c4259 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, 30 Jul 2021 00:33:21 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=d364264b29bca40de1a8fd728637be42644c4259 commit d364264b29bca40de1a8fd728637be42644c4259 Author: Mark Johnston AuthorDate: 2021-07-23 14:30:00 +0000 Commit: Mark Johnston CommitDate: 2021-07-30 00:32:58 +0000 cdefs: Add a default definition for __nosanitizememory Sponsored by: The FreeBSD Foundation (cherry picked from commit 4cd7e82a4c7aed19dd722afa809466d5a45765d6) --- sys/sys/cdefs.h | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h index ff461db9ec2e..85e9ea227150 100644 --- a/sys/sys/cdefs.h +++ b/sys/sys/cdefs.h @@ -872,6 +872,7 @@ #define __nosanitizethread __attribute__((no_sanitize("thread"))) #else #define __nosanitizeaddress +#define __nosanitizememory #define __nosanitizethread #endif From owner-dev-commits-src-all@freebsd.org Fri Jul 30 00:33: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 0794C657C0E; Fri, 30 Jul 2021 00:33: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 4GbSzx61rNz4vLn; Fri, 30 Jul 2021 00:33: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 B3C431B633; Fri, 30 Jul 2021 00:33: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 16U0XHna043675; Fri, 30 Jul 2021 00:33:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16U0XHHu043674; Fri, 30 Jul 2021 00:33:17 GMT (envelope-from git) Date: Fri, 30 Jul 2021 00:33:17 GMT Message-Id: <202107300033.16U0XHHu043674@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: 24c558ca3c04 - stable/13 - imgact_elf: Avoid redefining suword() 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: 24c558ca3c04e23681ddefe13d0cd5f98bba9fac 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, 30 Jul 2021 00:33:18 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=24c558ca3c04e23681ddefe13d0cd5f98bba9fac commit 24c558ca3c04e23681ddefe13d0cd5f98bba9fac Author: Mark Johnston AuthorDate: 2021-07-23 19:40:54 +0000 Commit: Mark Johnston CommitDate: 2021-07-30 00:32:58 +0000 imgact_elf: Avoid redefining suword() Otherwise this interferes with the definition for sanitizer interceptors. Sponsored by: The FreeBSD Foundation (cherry picked from commit ebf9886654f42718229011524a81e2b36e51f9b1) --- sys/kern/imgact_elf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c index 563629b747b5..9d039b914fb5 100644 --- a/sys/kern/imgact_elf.c +++ b/sys/kern/imgact_elf.c @@ -1345,7 +1345,7 @@ ret: return (error); } -#define suword __CONCAT(suword, __ELF_WORD_SIZE) +#define elf_suword __CONCAT(suword, __ELF_WORD_SIZE) int __elfN(freebsd_copyout_auxargs)(struct image_params *imgp, uintptr_t base) @@ -1418,7 +1418,7 @@ __elfN(freebsd_fixup)(uintptr_t *stack_base, struct image_params *imgp) base = (Elf_Addr *)*stack_base; base--; - if (suword(base, imgp->args->argc) == -1) + if (elf_suword(base, imgp->args->argc) == -1) return (EFAULT); *stack_base = (uintptr_t)base; return (0); From owner-dev-commits-src-all@freebsd.org Fri Jul 30 00:33: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 04F7C657A47; Fri, 30 Jul 2021 00:33: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 4GbT023SyCz4vnT; Fri, 30 Jul 2021 00:33: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 43D741B7CE; Fri, 30 Jul 2021 00:33: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 16U0XMT4043774; Fri, 30 Jul 2021 00:33:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16U0XMnA043773; Fri, 30 Jul 2021 00:33:22 GMT (envelope-from git) Date: Fri, 30 Jul 2021 00:33:22 GMT Message-Id: <202107300033.16U0XMnA043773@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: 3e148d60295d - stable/13 - select: Define select_flags[] as const 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: 3e148d60295d08a0dc42efcc58a35f00f8e89d54 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, 30 Jul 2021 00:33:23 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=3e148d60295d08a0dc42efcc58a35f00f8e89d54 commit 3e148d60295d08a0dc42efcc58a35f00f8e89d54 Author: Mark Johnston AuthorDate: 2021-07-23 14:30:32 +0000 Commit: Mark Johnston CommitDate: 2021-07-30 00:32:59 +0000 select: Define select_flags[] as const Sponsored by: The FreeBSD Foundation (cherry picked from commit cae3f9dd01fd1f8d579546b359305e985f8087d8) --- sys/kern/sys_generic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c index 6fcdee7a088f..09c60611e755 100644 --- a/sys/kern/sys_generic.c +++ b/sys/kern/sys_generic.c @@ -1244,7 +1244,7 @@ done: * The backend always returns POLLHUP/POLLERR if appropriate and we * return this as a set bit in any set. */ -static int select_flags[3] = { +static const int select_flags[3] = { POLLRDNORM | POLLHUP | POLLERR, POLLWRNORM | POLLHUP | POLLERR, POLLRDBAND | POLLERR From owner-dev-commits-src-all@freebsd.org Fri Jul 30 00:33: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 5A9C9657A4A; Fri, 30 Jul 2021 00:33: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 4GbT0354d4z4vtk; Fri, 30 Jul 2021 00:33: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 556721B90C; Fri, 30 Jul 2021 00:33: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 16U0XNBx043804; Fri, 30 Jul 2021 00:33:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16U0XNLQ043803; Fri, 30 Jul 2021 00:33:23 GMT (envelope-from git) Date: Fri, 30 Jul 2021 00:33:23 GMT Message-Id: <202107300033.16U0XNLQ043803@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: 057275e4be56 - stable/13 - ktrace: Zero request structures when populating the pool 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: 057275e4be560e02b5ba31918dc262beb474188d 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, 30 Jul 2021 00:33:24 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=057275e4be560e02b5ba31918dc262beb474188d commit 057275e4be560e02b5ba31918dc262beb474188d Author: Mark Johnston AuthorDate: 2021-07-23 14:29:53 +0000 Commit: Mark Johnston CommitDate: 2021-07-30 00:32:59 +0000 ktrace: Zero request structures when populating the pool Otherwise uninitialized pad bytes may be copied into the ktrace log file. Reported by: KMSAN Sponsored by: The FreeBSD Foundation (cherry picked from commit 5c18bf9d5fd7684024e0a55da1e8537d4cfaf0bf) --- sys/kern/kern_ktrace.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/kern/kern_ktrace.c b/sys/kern/kern_ktrace.c index 1b9e0942b702..9221a9ceb765 100644 --- a/sys/kern/kern_ktrace.c +++ b/sys/kern/kern_ktrace.c @@ -219,7 +219,8 @@ ktrace_init(void *dummy) sx_init(&ktrace_sx, "ktrace_sx"); STAILQ_INIT(&ktr_free); for (i = 0; i < ktr_requestpool; i++) { - req = malloc(sizeof(struct ktr_request), M_KTRACE, M_WAITOK); + req = malloc(sizeof(struct ktr_request), M_KTRACE, M_WAITOK | + M_ZERO); STAILQ_INSERT_HEAD(&ktr_free, req, ktr_list); } } @@ -285,7 +286,7 @@ ktrace_resize_pool(u_int oldsize, u_int newsize) STAILQ_INIT(&ktr_new); while (bound-- > 0) { req = malloc(sizeof(struct ktr_request), M_KTRACE, - M_WAITOK); + M_WAITOK | M_ZERO); STAILQ_INSERT_HEAD(&ktr_new, req, ktr_list); } mtx_lock(&ktrace_mtx); From owner-dev-commits-src-all@freebsd.org Fri Jul 30 00:42: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 40FC565A04B; Fri, 30 Jul 2021 00:42: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 4GbTB70kS1z3CDm; Fri, 30 Jul 2021 00:42: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 01C591B9B8; Fri, 30 Jul 2021 00:42: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 16U0g6gU056773; Fri, 30 Jul 2021 00:42:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16U0g6bg056772; Fri, 30 Jul 2021 00:42:06 GMT (envelope-from git) Date: Fri, 30 Jul 2021 00:42:06 GMT Message-Id: <202107300042.16U0g6bg056772@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: 07ab33cfc108 - stable/12 - ixgbe: Print FW NVM and Option ROM versions 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: 07ab33cfc108618ce0ba48cabfbabbb1ebcc6538 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, 30 Jul 2021 00:42:07 -0000 The branch stable/12 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=07ab33cfc108618ce0ba48cabfbabbb1ebcc6538 commit 07ab33cfc108618ce0ba48cabfbabbb1ebcc6538 Author: Kevin Bowling AuthorDate: 2021-07-16 06:50:14 +0000 Commit: Kevin Bowling CommitDate: 2021-07-30 00:41:14 +0000 ixgbe: Print FW NVM and Option ROM versions It can be useful for system operators to see this kind of information when correlating issues or requesting support from the OEM or Intel for hardware and firmware issues. Reviewed by: gallatin MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D30178 (cherry picked from commit 7660e4ea5cb750ded38a0bd81cde2e2b130222df) --- sys/dev/ixgbe/if_ix.c | 100 +++++++++++++++++++++++++++++++++++++++++++++ sys/dev/ixgbe/ixgbe_type.h | 2 +- 2 files changed, 101 insertions(+), 1 deletion(-) diff --git a/sys/dev/ixgbe/if_ix.c b/sys/dev/ixgbe/if_ix.c index 144204f98fdc..d9fa2f4f77c5 100644 --- a/sys/dev/ixgbe/if_ix.c +++ b/sys/dev/ixgbe/if_ix.c @@ -173,6 +173,8 @@ static void ixgbe_initialize_transmit_units(if_ctx_t ctx); static int ixgbe_setup_interface(if_ctx_t ctx); static void ixgbe_init_device_features(struct adapter *adapter); static void ixgbe_check_fan_failure(struct adapter *, u32, bool); +static void ixgbe_sbuf_fw_version(struct ixgbe_hw *, struct sbuf *); +static void ixgbe_print_fw_version(if_ctx_t ctx); static void ixgbe_add_media_types(if_ctx_t ctx); static void ixgbe_update_stats_counters(struct adapter *adapter); static void ixgbe_config_link(if_ctx_t ctx); @@ -196,6 +198,7 @@ static int ixgbe_sysctl_interrupt_rate_handler(SYSCTL_HANDLER_ARGS); static int ixgbe_sysctl_dmac(SYSCTL_HANDLER_ARGS); static int ixgbe_sysctl_phy_temp(SYSCTL_HANDLER_ARGS); static int ixgbe_sysctl_phy_overtemp_occurred(SYSCTL_HANDLER_ARGS); +static int ixgbe_sysctl_print_fw_version(SYSCTL_HANDLER_ARGS); #ifdef IXGBE_DEBUG static int ixgbe_sysctl_power_state(SYSCTL_HANDLER_ARGS); static int ixgbe_sysctl_print_rss_config(SYSCTL_HANDLER_ARGS); @@ -1109,6 +1112,9 @@ ixgbe_if_attach_post(if_ctx_t ctx) */ ixgbe_bypass_init(adapter); + /* Display NVM and Option ROM versions */ + ixgbe_print_fw_version(ctx); + /* Set an initial dmac value */ adapter->dmac = 0; /* Set initial advertised speeds (if applicable) */ @@ -2557,6 +2563,10 @@ ixgbe_add_device_sysctls(if_ctx_t ctx) CTLTYPE_INT | CTLFLAG_RW, adapter, 0, ixgbe_sysctl_advertise, "I", IXGBE_SYSCTL_DESC_ADV_SPEED); + SYSCTL_ADD_PROC(ctx_list, child, OID_AUTO, "fw_version", + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT, adapter, 0, + ixgbe_sysctl_print_fw_version, "A", "Prints FW/NVM Versions"); + #ifdef IXGBE_DEBUG /* testing sysctls (for all devices) */ SYSCTL_ADD_PROC(ctx_list, child, OID_AUTO, "power_state", @@ -4580,3 +4590,93 @@ ixgbe_check_fan_failure(struct adapter *adapter, u32 reg, bool in_interrupt) if (reg & mask) device_printf(adapter->dev, "\nCRITICAL: FAN FAILURE!! REPLACE IMMEDIATELY!!\n"); } /* ixgbe_check_fan_failure */ + +/************************************************************************ + * ixgbe_sbuf_fw_version + ************************************************************************/ +static void +ixgbe_sbuf_fw_version(struct ixgbe_hw *hw, struct sbuf *buf) +{ + struct ixgbe_nvm_version nvm_ver = {0}; + uint16_t phyfw = 0; + int status; + + ixgbe_get_oem_prod_version(hw, &nvm_ver); /* OEM's NVM version */ + ixgbe_get_orom_version(hw, &nvm_ver); /* Option ROM */ + ixgbe_get_etk_id(hw, &nvm_ver); /* eTrack identifies a build in Intel's SCM */ + status = ixgbe_get_phy_firmware_version(hw, &phyfw); + + if (nvm_ver.oem_valid) + sbuf_printf(buf, "NVM OEM V%d.%d R%d ", nvm_ver.oem_major, + nvm_ver.oem_minor, nvm_ver.oem_release); + + if (nvm_ver.or_valid) + sbuf_printf(buf, "Option ROM V%d-b%d-p%d ", nvm_ver.or_major, + nvm_ver.or_build, nvm_ver.or_patch); + + if (nvm_ver.etk_id != ((NVM_VER_INVALID << NVM_ETK_SHIFT) | NVM_VER_INVALID)) + sbuf_printf(buf, "eTrack 0x%08x ", nvm_ver.etk_id); + + if (phyfw != 0 && status == IXGBE_SUCCESS) + sbuf_printf(buf, "PHY FW V%d ", phyfw); + + sbuf_trim(buf); +} /* ixgbe_sbuf_fw_version */ + +/************************************************************************ + * ixgbe_print_fw_version + ************************************************************************/ +static void +ixgbe_print_fw_version(if_ctx_t ctx) +{ + struct adapter *adapter = iflib_get_softc(ctx); + struct ixgbe_hw *hw = &adapter->hw; + device_t dev = adapter->dev; + struct sbuf *buf; + int error = 0; + + buf = sbuf_new_auto(); + if (!buf) { + device_printf(dev, "Could not allocate sbuf for output.\n"); + return; + } + + ixgbe_sbuf_fw_version(hw, buf); + + error = sbuf_finish(buf); + if (error) + device_printf(dev, "Error finishing sbuf: %d\n", error); + else if (sbuf_len(buf)) + device_printf(dev, "%s\n", sbuf_data(buf)); + + sbuf_delete(buf); +} /* ixgbe_print_fw_version */ + +/************************************************************************ + * ixgbe_sysctl_print_fw_version + ************************************************************************/ +static int +ixgbe_sysctl_print_fw_version(SYSCTL_HANDLER_ARGS) +{ + struct adapter *adapter = (struct adapter *)arg1; + struct ixgbe_hw *hw = &adapter->hw; + device_t dev = adapter->dev; + struct sbuf *buf; + int error = 0; + + buf = sbuf_new_for_sysctl(NULL, NULL, 128, req); + if (!buf) { + device_printf(dev, "Could not allocate sbuf for output.\n"); + return (ENOMEM); + } + + ixgbe_sbuf_fw_version(hw, buf); + + error = sbuf_finish(buf); + if (error) + device_printf(dev, "Error finishing sbuf: %d\n", error); + + sbuf_delete(buf); + + return (0); +} /* ixgbe_sysctl_print_fw_version */ diff --git a/sys/dev/ixgbe/ixgbe_type.h b/sys/dev/ixgbe/ixgbe_type.h index fc5f191ee65e..1d00eadc890a 100644 --- a/sys/dev/ixgbe/ixgbe_type.h +++ b/sys/dev/ixgbe/ixgbe_type.h @@ -306,7 +306,7 @@ #define NVM_VER_INVALID 0xFFFF #define NVM_ETK_VALID 0x8000 #define NVM_INVALID_PTR 0xFFFF -#define NVM_VER_SIZE 32 /* version sting size */ +#define NVM_VER_SIZE 32 /* version string size */ struct ixgbe_nvm_version { u32 etk_id; From owner-dev-commits-src-all@freebsd.org Fri Jul 30 00:42: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 512F165A230; Fri, 30 Jul 2021 00:42: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 4GbTB81mdqz3CBR; Fri, 30 Jul 2021 00:42: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 24AD71B9BA; Fri, 30 Jul 2021 00:42: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 16U0g8mb056797; Fri, 30 Jul 2021 00:42:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16U0g8te056796; Fri, 30 Jul 2021 00:42:08 GMT (envelope-from git) Date: Fri, 30 Jul 2021 00:42:08 GMT Message-Id: <202107300042.16U0g8te056796@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: fd350dd7ff94 - stable/12 - ixgbe: Clean up ix_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: fd350dd7ff94d3f77804d55ee57ecd1820f8d25d 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, 30 Jul 2021 00:42:08 -0000 The branch stable/12 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=fd350dd7ff94d3f77804d55ee57ecd1820f8d25d commit fd350dd7ff94d3f77804d55ee57ecd1820f8d25d Author: Kevin Bowling AuthorDate: 2021-07-18 06:24:28 +0000 Commit: Kevin Bowling CommitDate: 2021-07-30 00:41:30 +0000 ixgbe: Clean up ix_txrx The intention here is to reduce differences with D30072. The only functional change is logical simplification in ixgbe_rx_checksum. Reviewed by: gallatin Differential Revision: https://reviews.freebsd.org/D30074 (cherry picked from commit 51e46835e10a2628482deefc0efd356fb733337a) --- sys/dev/ixgbe/ix_txrx.c | 87 +++++++++++++++++++++++-------------------------- 1 file changed, 40 insertions(+), 47 deletions(-) diff --git a/sys/dev/ixgbe/ix_txrx.c b/sys/dev/ixgbe/ix_txrx.c index 43e64b0c0df0..b566bce3d7c7 100644 --- a/sys/dev/ixgbe/ix_txrx.c +++ b/sys/dev/ixgbe/ix_txrx.c @@ -50,16 +50,19 @@ static void ixgbe_isc_txd_flush(void *arg, uint16_t txqid, qidx_t pidx); static int ixgbe_isc_txd_credits_update(void *arg, uint16_t txqid, bool clear); static void ixgbe_isc_rxd_refill(void *arg, if_rxd_update_t iru); -static void ixgbe_isc_rxd_flush(void *arg, uint16_t qsidx, uint8_t flidx __unused, qidx_t pidx); +static void ixgbe_isc_rxd_flush(void *arg, uint16_t qsidx, + uint8_t flidx __unused, qidx_t pidx); static int ixgbe_isc_rxd_available(void *arg, uint16_t qsidx, qidx_t pidx, - qidx_t budget); + qidx_t budget); static int ixgbe_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri); -static void ixgbe_rx_checksum(u32 staterr, if_rxd_info_t ri, u32 ptype); -static int ixgbe_tx_ctx_setup(struct ixgbe_adv_tx_context_desc *, if_pkt_info_t); +static void ixgbe_rx_checksum(uint32_t staterr, if_rxd_info_t ri, + uint32_t ptype); +static int ixgbe_tx_ctx_setup(struct ixgbe_adv_tx_context_desc *, + if_pkt_info_t); extern void ixgbe_if_enable_intr(if_ctx_t ctx); -static int ixgbe_determine_rsstype(u16 pkt_info); +static int ixgbe_determine_rsstype(uint16_t pkt_info); struct if_txrx ixgbe_txrx = { .ift_txd_encap = ixgbe_isc_txd_encap, @@ -83,8 +86,8 @@ extern if_shared_ctx_t ixgbe_sctx; static int ixgbe_tx_ctx_setup(struct ixgbe_adv_tx_context_desc *TXD, if_pkt_info_t pi) { - u32 vlan_macip_lens, type_tucmd_mlhl; - u32 olinfo_status, mss_l4len_idx, pktlen, offload; + uint32_t vlan_macip_lens, type_tucmd_mlhl; + uint32_t olinfo_status, mss_l4len_idx, pktlen, offload; u8 ehdrlen; offload = TRUE; @@ -152,7 +155,7 @@ ixgbe_tx_ctx_setup(struct ixgbe_adv_tx_context_desc *TXD, if_pkt_info_t pi) offload = FALSE; break; } -/* Insert L4 checksum into data descriptors */ + /* Insert L4 checksum into data descriptors */ if (offload) olinfo_status |= IXGBE_TXD_POPTS_TXSM << 8; @@ -182,7 +185,7 @@ ixgbe_isc_txd_encap(void *arg, if_pkt_info_t pi) union ixgbe_adv_tx_desc *txd = NULL; struct ixgbe_adv_tx_context_desc *TXD; int i, j, first, pidx_last; - u32 olinfo_status, cmd, flags; + uint32_t olinfo_status, cmd, flags; qidx_t ntxd; cmd = (IXGBE_ADVTXD_DTYP_DATA | @@ -366,7 +369,7 @@ ixgbe_isc_rxd_available(void *arg, uint16_t qsidx, qidx_t pidx, qidx_t budget) struct ix_rx_queue *que = &sc->rx_queues[qsidx]; struct rx_ring *rxr = &que->rxr; union ixgbe_adv_rx_desc *rxd; - u32 staterr; + uint32_t staterr; int cnt, i, nrxd; nrxd = sc->shared->isc_nrxd[0]; @@ -402,11 +405,11 @@ ixgbe_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) struct ifnet *ifp = iflib_get_ifp(adapter->ctx); union ixgbe_adv_rx_desc *rxd; - u16 pkt_info, len, cidx, i; - u16 vtag = 0; - u32 ptype; - u32 staterr = 0; - bool eop; + uint16_t pkt_info, len, cidx, i; + uint16_t vtag = 0; + uint32_t ptype; + uint32_t staterr = 0; + bool eop; i = 0; cidx = ri->iri_cidx; @@ -436,11 +439,8 @@ ixgbe_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) /* Make sure bad packets are discarded */ if (eop && (staterr & IXGBE_RXDADV_ERR_FRAME_ERR_MASK) != 0) { - -#if __FreeBSD_version >= 1100036 if (adapter->feat_en & IXGBE_FEATURE_VF) if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); -#endif rxr->rx_discarded++; return (EBADMSG); @@ -485,35 +485,28 @@ ixgbe_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) * doesn't spend time verifying the checksum. ************************************************************************/ static void -ixgbe_rx_checksum(u32 staterr, if_rxd_info_t ri, u32 ptype) +ixgbe_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; - - if ((ptype & IXGBE_RXDADV_PKTTYPE_ETQF) == 0 && - (ptype & IXGBE_RXDADV_PKTTYPE_SCTP) != 0) - sctp = TRUE; - - /* IPv4 checksum */ - if (status & IXGBE_RXD_STAT_IPCS) { - if (!(errors & IXGBE_RXD_ERR_IPE)) { - /* IP Checksum Good */ - ri->iri_csum_flags = CSUM_IP_CHECKED | CSUM_IP_VALID; - } else - ri->iri_csum_flags = 0; - } - /* TCP/UDP/SCTP checksum */ - if (status & IXGBE_RXD_STAT_L4CS) { - u64 type = (CSUM_DATA_VALID | CSUM_PSEUDO_HDR); -#if __FreeBSD_version >= 800000 - if (sctp) - type = CSUM_SCTP_VALID; -#endif - if (!(errors & IXGBE_RXD_ERR_TCPE)) { - ri->iri_csum_flags |= type; - if (!sctp) - ri->iri_csum_data = htons(0xffff); + uint16_t status = (uint16_t)staterr; + uint8_t errors = (uint8_t)(staterr >> 24); + + /* If there is a layer 3 or 4 error we are done */ + if (__predict_false(errors & (IXGBE_RXD_ERR_IPE | IXGBE_RXD_ERR_TCPE))) + return; + + /* IP Checksum Good */ + if (status & IXGBE_RXD_STAT_IPCS) + ri->iri_csum_flags = (CSUM_IP_CHECKED | CSUM_IP_VALID); + + /* Valid L4E checksum */ + if (__predict_true(status & IXGBE_RXD_STAT_L4CS)) { + /* SCTP header present. */ + if (__predict_false((ptype & IXGBE_RXDADV_PKTTYPE_ETQF) == 0 && + (ptype & IXGBE_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); } } } /* ixgbe_rx_checksum */ @@ -524,7 +517,7 @@ ixgbe_rx_checksum(u32 staterr, if_rxd_info_t ri, u32 ptype) * Parse the packet type to determine the appropriate hash ************************************************************************/ static int -ixgbe_determine_rsstype(u16 pkt_info) +ixgbe_determine_rsstype(uint16_t pkt_info) { switch (pkt_info & IXGBE_RXDADV_RSSTYPE_MASK) { case IXGBE_RXDADV_RSSTYPE_IPV4_TCP: From owner-dev-commits-src-all@freebsd.org Fri Jul 30 01:14: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 1D9FE65CF39; Fri, 30 Jul 2021 01:14: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 4GbTvw0NjQz3Fpq; Fri, 30 Jul 2021 01:14: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 E9E061C2D9; Fri, 30 Jul 2021 01:14: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 16U1EpJU097380; Fri, 30 Jul 2021 01:14:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16U1Ep1S097379; Fri, 30 Jul 2021 01:14:51 GMT (envelope-from git) Date: Fri, 30 Jul 2021 01:14:51 GMT Message-Id: <202107300114.16U1Ep1S097379@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: a90d053b8422 - main - Simplify kernel sanitizer interceptors MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a90d053b84223a4e5cb65852a9b6193570ab1c7d 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, 30 Jul 2021 01:14:52 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=a90d053b84223a4e5cb65852a9b6193570ab1c7d commit a90d053b84223a4e5cb65852a9b6193570ab1c7d Author: Mark Johnston AuthorDate: 2021-07-19 20:09:42 +0000 Commit: Mark Johnston CommitDate: 2021-07-30 01:13:32 +0000 Simplify kernel sanitizer interceptors KASAN and KCSAN implement interceptors for various primitive operations that are not instrumented by the compiler. KMSAN requires them as well. Rather than adding new cases for each sanitizer which requires interceptors, implement the following protocol: - When interceptor definitions are required, define SAN_NEEDS_INTERCEPTORS and SANITIZER_INTERCEPTOR_PREFIX. - In headers that declare functions which need to be intercepted by a sanitizer runtime, use SANITIZER_INTERCEPTOR_PREFIX to provide declarations. - When SAN_RUNTIME is defined, do not redefine the names of intercepted functions. This is typically the case in files which implement sanitizer runtimes but is also needed in, for example, files which define ifunc selectors for intercepted operations. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation --- sys/amd64/amd64/copyout.c | 8 ++++---- sys/amd64/include/atomic.h | 12 ++---------- sys/arm64/include/bus.h | 12 ++---------- sys/conf/kern.pre.mk | 6 ++++-- sys/kern/subr_asan.c | 2 -- sys/kern/subr_csan.c | 2 -- sys/sys/atomic_san.h | 10 +++------- sys/sys/bus_san.h | 11 ++++------- sys/sys/libkern.h | 16 ++++++++++------ sys/sys/systm.h | 34 ++++++++++++++-------------------- sys/x86/include/bus.h | 12 ++---------- 11 files changed, 45 insertions(+), 80 deletions(-) diff --git a/sys/amd64/amd64/copyout.c b/sys/amd64/amd64/copyout.c index 0e96944c4a23..36e817635694 100644 --- a/sys/amd64/amd64/copyout.c +++ b/sys/amd64/amd64/copyout.c @@ -32,6 +32,10 @@ #include __FBSDID("$FreeBSD$"); +#ifdef SAN_NEEDS_INTERCEPTORS +#define SAN_RUNTIME +#endif + #include #include @@ -146,10 +150,6 @@ DEFINE_IFUNC(, int, casueword, (volatile u_long *, u_long, u_long *, u_long)) casueword_smap : casueword_nosmap); } -#undef copyinstr -#undef copyin -#undef copyout - int copyinstr_nosmap(const void *udaddr, void *kaddr, size_t len, size_t *lencopied); int copyinstr_smap(const void *udaddr, void *kaddr, size_t len, diff --git a/sys/amd64/include/atomic.h b/sys/amd64/include/atomic.h index c821e77e5b8b..4a9095ca831b 100644 --- a/sys/amd64/include/atomic.h +++ b/sys/amd64/include/atomic.h @@ -68,15 +68,7 @@ #define OFFSETOF_MONITORBUF 0x100 #endif -#ifndef SAN_RUNTIME -#if defined(KASAN) -#define ATOMIC_SAN_PREFIX kasan -#elif defined(KCSAN) -#define ATOMIC_SAN_PREFIX kcsan -#endif -#endif - -#ifdef ATOMIC_SAN_PREFIX +#if defined(SAN_NEEDS_INTERCEPTORS) && !defined(SAN_RUNTIME) #include #else #include @@ -687,6 +679,6 @@ u_long atomic_swap_long(volatile u_long *p, u_long v); #endif /* !WANT_FUNCTIONS */ -#endif /* !ATOMIC_SAN_PREFIX */ +#endif /* !SAN_NEEDS_INTERCEPTORS || SAN_RUNTIME */ #endif /* !_MACHINE_ATOMIC_H_ */ diff --git a/sys/arm64/include/bus.h b/sys/arm64/include/bus.h index 61573b27728d..a87577b00f0c 100644 --- a/sys/arm64/include/bus.h +++ b/sys/arm64/include/bus.h @@ -92,15 +92,7 @@ #define BUS_SPACE_BARRIER_READ 0x01 #define BUS_SPACE_BARRIER_WRITE 0x02 -#ifndef SAN_RUNTIME -#if defined(KASAN) -#define BUS_SAN_PREFIX kasan -#elif defined(KCSAN) -#define BUS_SAN_PREFIX kcsan -#endif -#endif - -#ifdef BUS_SAN_PREFIX +#ifdef SAN_NEEDS_INTERCEPTORS #include #else @@ -506,7 +498,7 @@ struct bus_space { #define bus_space_peek_4(t, h, o, vp) __bs_peek(4, (t), (h), (o), (vp)) #define bus_space_peek_8(t, h, o, vp) __bs_peek(8, (t), (h), (o), (vp)) -#endif +#endif /* !SAN_NEEDS_INTERCEPTORS */ #include diff --git a/sys/conf/kern.pre.mk b/sys/conf/kern.pre.mk index 539605f60ca0..221c0aa22d9d 100644 --- a/sys/conf/kern.pre.mk +++ b/sys/conf/kern.pre.mk @@ -94,7 +94,8 @@ ASM_CFLAGS= -x assembler-with-cpp -DLOCORE ${CFLAGS} ${ASM_CFLAGS.${.IMPSRC:T}} KASAN_ENABLED!= grep KASAN opt_global.h || true ; echo .if !empty(KASAN_ENABLED) -SAN_CFLAGS+= -fsanitize=kernel-address \ +SAN_CFLAGS+= -DSAN_NEEDS_INTERCEPTORS -DSAN_INTERCEPTOR_PREFIX=kasan \ + -fsanitize=kernel-address \ -mllvm -asan-stack=true \ -mllvm -asan-instrument-dynamic-allocas=true \ -mllvm -asan-globals=true \ @@ -104,7 +105,8 @@ SAN_CFLAGS+= -fsanitize=kernel-address \ KCSAN_ENABLED!= grep KCSAN opt_global.h || true ; echo .if !empty(KCSAN_ENABLED) -SAN_CFLAGS+= -fsanitize=thread +SAN_CFLAGS+= -DSAN_NEEDS_INTERCEPTORS -DSAN_INTERCEPTOR_PREFIX=kcsan \ + -fsanitize=thread .endif KUBSAN_ENABLED!= grep KUBSAN opt_global.h || true ; echo diff --git a/sys/kern/subr_asan.c b/sys/kern/subr_asan.c index 825d7d4228c0..7083a8e64540 100644 --- a/sys/kern/subr_asan.c +++ b/sys/kern/subr_asan.c @@ -523,7 +523,6 @@ kasan_copyout(const void *kaddr, void *uaddr, size_t len) /* -------------------------------------------------------------------------- */ #include -#define ATOMIC_SAN_PREFIX kasan #include #define _ASAN_ATOMIC_FUNC_ADD(name, type) \ @@ -785,7 +784,6 @@ kasan_atomic_interrupt_fence(void) #include #include -#define BUS_SAN_PREFIX kasan #include int diff --git a/sys/kern/subr_csan.c b/sys/kern/subr_csan.c index 56d2e59ff12c..7bed25076fa9 100644 --- a/sys/kern/subr_csan.c +++ b/sys/kern/subr_csan.c @@ -374,7 +374,6 @@ kcsan_copyout(const void *kaddr, void *uaddr, size_t len) /* -------------------------------------------------------------------------- */ #include -#define ATOMIC_SAN_PREFIX kcsan #include #define _CSAN_ATOMIC_FUNC_ADD(name, type) \ @@ -689,7 +688,6 @@ kcsan_atomic_interrupt_fence(void) #include #include -#define BUS_SAN_PREFIX kcsan #include int diff --git a/sys/sys/atomic_san.h b/sys/sys/atomic_san.h index 5d10f58f7565..30bd01c97cf2 100644 --- a/sys/sys/atomic_san.h +++ b/sys/sys/atomic_san.h @@ -43,10 +43,6 @@ #error do not include this header, use machine/atomic.h #endif -#ifndef ATOMIC_SAN_PREFIX -#error No sanitizer prefix available -#endif - #define ATOMIC_SAN_FUNC_1(sp, op, name, type) \ void sp##_atomic_##op##_##name(volatile type *, type); \ void sp##_atomic_##op##_acq_##name(volatile type *, type); \ @@ -104,7 +100,7 @@ ATOMIC_SAN_THREAD_FENCE(sp); #define ATOMIC_SAN_FUNCS(name, type) \ - _ATOMIC_SAN_FUNCS(ATOMIC_SAN_PREFIX, name, type) + _ATOMIC_SAN_FUNCS(SAN_INTERCEPTOR_PREFIX, name, type) ATOMIC_SAN_FUNCS(char, uint8_t); ATOMIC_SAN_FUNCS(short, uint16_t); @@ -123,8 +119,8 @@ ATOMIC_SAN_FUNCS(64, uint64_t); * For instance, KASAN callers of atomic_add_char() will be redirected to * kasan_atomic_add_char(). */ -#define ATOMIC_SAN(func) \ - __CONCAT(ATOMIC_SAN_PREFIX, __CONCAT(_atomic_, func)) +#define ATOMIC_SAN(func) \ + __CONCAT(SAN_INTERCEPTOR_PREFIX, __CONCAT(_atomic_, func)) #define atomic_add_char ATOMIC_SAN(add_char) #define atomic_add_acq_char ATOMIC_SAN(add_acq_char) diff --git a/sys/sys/bus_san.h b/sys/sys/bus_san.h index 05d5ecd4b844..fd3c4c803675 100644 --- a/sys/sys/bus_san.h +++ b/sys/sys/bus_san.h @@ -43,10 +43,6 @@ #error do not include this header, use machine/bus.h #endif -#ifndef BUS_SAN_PREFIX -#error No sanitizer prefix defined -#endif - #define BUS_SAN_MULTI(sp, rw, width, type) \ void sp##_bus_space_##rw##_multi_##width(bus_space_tag_t, \ bus_space_handle_t, bus_size_t, type *, bus_size_t); \ @@ -122,7 +118,7 @@ BUS_SAN_MISC(sp); #define BUS_SAN_FUNCS(width, type) \ - _BUS_SAN_FUNCS(BUS_SAN_PREFIX, width, type) + _BUS_SAN_FUNCS(SAN_INTERCEPTOR_PREFIX, width, type) BUS_SAN_FUNCS(1, uint8_t); BUS_SAN_FUNCS(2, uint16_t); @@ -131,7 +127,8 @@ BUS_SAN_FUNCS(8, uint64_t); #ifndef SAN_RUNTIME -#define BUS_SAN(func) __CONCAT(BUS_SAN_PREFIX, __CONCAT(_bus_space_, func)) +#define BUS_SAN(func) \ + __CONCAT(SAN_INTERCEPTOR_PREFIX, __CONCAT(_bus_space_, func)) #define bus_space_map BUS_SAN(map) #define bus_space_unmap BUS_SAN(unmap) @@ -224,6 +221,6 @@ BUS_SAN_FUNCS(8, uint64_t); #define bus_space_poke_8 BUS_SAN(poke_8) #define bus_space_peek_8 BUS_SAN(peek_8) -#endif /* !KCSAN_RUNTIME */ +#endif /* !SAN_RUNTIME */ #endif /* !_SYS_BUS_SAN_H_ */ diff --git a/sys/sys/libkern.h b/sys/sys/libkern.h index d8d3dce1b705..147eba9bd1bd 100644 --- a/sys/sys/libkern.h +++ b/sys/sys/libkern.h @@ -193,7 +193,11 @@ size_t strspn(const char *, const char *); char *strstr(const char *, const char *); int strvalid(const char *, size_t); -#ifdef SAN_PREFIX +#ifdef SAN_NEEDS_INTERCEPTORS +#ifndef SAN_INTERCEPTOR +#define SAN_INTERCEPTOR(func) \ + __CONCAT(SAN_INTERCEPTOR_PREFIX, __CONCAT(_, func)) +#endif char *SAN_INTERCEPTOR(strcpy)(char *, const char *); int SAN_INTERCEPTOR(strcmp)(const char *, const char *); size_t SAN_INTERCEPTOR(strlen)(const char *); @@ -202,11 +206,11 @@ size_t SAN_INTERCEPTOR(strlen)(const char *); #define strcmp(s1, s2) SAN_INTERCEPTOR(strcmp)((s1), (s2)) #define strlen(s) SAN_INTERCEPTOR(strlen)(s) #endif /* !SAN_RUNTIME */ -#else -#define strcpy(d, s) __builtin_strcpy((d), (s)) -#define strcmp(s1, s2) __builtin_strcmp((s1), (s2)) -#define strlen(s) __builtin_strlen((s)) -#endif /* SAN_PREFIX */ +#else /* !SAN_NEEDS_INTERCEPTORS */ +#define strcpy(d, s) __builtin_strcpy((d), (s)) +#define strcmp(s1, s2) __builtin_strcmp((s1), (s2)) +#define strlen(s) __builtin_strlen((s)) +#endif /* SAN_NEEDS_INTERCEPTORS */ static __inline char * index(const char *p, int ch) diff --git a/sys/sys/systm.h b/sys/sys/systm.h index 8080f22266e2..671b5c2b8d38 100644 --- a/sys/sys/systm.h +++ b/sys/sys/systm.h @@ -351,15 +351,9 @@ void *memcpy(void * _Nonnull to, const void * _Nonnull from, size_t len); void *memmove(void * _Nonnull dest, const void * _Nonnull src, size_t n); int memcmp(const void *b1, const void *b2, size_t len); -#if defined(KASAN) -#define SAN_PREFIX kasan_ -#elif defined(KCSAN) -#define SAN_PREFIX kcsan_ -#endif - -#ifdef SAN_PREFIX -#define SAN_INTERCEPTOR(func) __CONCAT(SAN_PREFIX, func) - +#ifdef SAN_NEEDS_INTERCEPTORS +#define SAN_INTERCEPTOR(func) \ + __CONCAT(SAN_INTERCEPTOR_PREFIX, __CONCAT(_, func)) void *SAN_INTERCEPTOR(memset)(void *, int, size_t); void *SAN_INTERCEPTOR(memcpy)(void *, const void *, size_t); void *SAN_INTERCEPTOR(memmove)(void *, const void *, size_t); @@ -373,15 +367,15 @@ int SAN_INTERCEPTOR(memcmp)(const void *, const void *, size_t); #define memmove(dest, src, n) SAN_INTERCEPTOR(memmove)((dest), (src), (n)) #define memcmp(b1, b2, len) SAN_INTERCEPTOR(memcmp)((b1), (b2), (len)) #endif /* !SAN_RUNTIME */ -#else -#define bcopy(from, to, len) __builtin_memmove((to), (from), (len)) -#define bzero(buf, len) __builtin_memset((buf), 0, (len)) -#define bcmp(b1, b2, len) __builtin_memcmp((b1), (b2), (len)) -#define memset(buf, c, len) __builtin_memset((buf), (c), (len)) -#define memcpy(to, from, len) __builtin_memcpy((to), (from), (len)) -#define memmove(dest, src, n) __builtin_memmove((dest), (src), (n)) -#define memcmp(b1, b2, len) __builtin_memcmp((b1), (b2), (len)) -#endif /* !SAN_PREFIX */ +#else /* !SAN_NEEDS_INTERCEPTORS */ +#define bcopy(from, to, len) __builtin_memmove((to), (from), (len)) +#define bzero(buf, len) __builtin_memset((buf), 0, (len)) +#define bcmp(b1, b2, len) __builtin_memcmp((b1), (b2), (len)) +#define memset(buf, c, len) __builtin_memset((buf), (c), (len)) +#define memcpy(to, from, len) __builtin_memcpy((to), (from), (len)) +#define memmove(dest, src, n) __builtin_memmove((dest), (src), (n)) +#define memcmp(b1, b2, len) __builtin_memcmp((b1), (b2), (len)) +#endif /* SAN_NEEDS_INTERCEPTORS */ void *memset_early(void * _Nonnull buf, int c, size_t len); #define bzero_early(buf, len) memset_early((buf), 0, (len)) @@ -412,7 +406,7 @@ int copyout(const void * _Nonnull __restrict kaddr, int copyout_nofault(const void * _Nonnull __restrict kaddr, void * __restrict udaddr, size_t len); -#ifdef SAN_PREFIX +#ifdef SAN_NEEDS_INTERCEPTORS int SAN_INTERCEPTOR(copyin)(const void *, void *, size_t); int SAN_INTERCEPTOR(copyinstr)(const void *, void *, size_t, size_t *); int SAN_INTERCEPTOR(copyout)(const void *, void *, size_t); @@ -421,7 +415,7 @@ int SAN_INTERCEPTOR(copyout)(const void *, void *, size_t); #define copyinstr(u, k, l, lc) SAN_INTERCEPTOR(copyinstr)((u), (k), (l), (lc)) #define copyout(k, u, l) SAN_INTERCEPTOR(copyout)((k), (u), (l)) #endif /* !SAN_RUNTIME */ -#endif /* SAN_PREFIX */ +#endif /* SAN_NEEDS_INTERCEPTORS */ int fubyte(volatile const void *base); long fuword(volatile const void *base); diff --git a/sys/x86/include/bus.h b/sys/x86/include/bus.h index 0ba68e250b3d..9522e5db7c78 100644 --- a/sys/x86/include/bus.h +++ b/sys/x86/include/bus.h @@ -135,15 +135,7 @@ #define BUS_SPACE_BARRIER_READ 0x01 /* force read barrier */ #define BUS_SPACE_BARRIER_WRITE 0x02 /* force write barrier */ -#ifndef SAN_RUNTIME -#if defined(KASAN) -#define BUS_SAN_PREFIX kasan -#elif defined(KCSAN) -#define BUS_SAN_PREFIX kcsan -#endif -#endif - -#ifdef BUS_SAN_PREFIX +#if defined(SAN_NEEDS_INTERCEPTORS) && !defined(SAN_RUNTIME) #include #else @@ -1129,6 +1121,6 @@ BUS_POKE_FUNC(4, uint32_t) BUS_POKE_FUNC(8, uint64_t) #endif -#endif /* !BUS_SAN_PREFIX */ +#endif /* !SAN_NEEDS_INTERCEPTORS && SAN_RUNTIME */ #endif /* !_MACHINE_BUS_H_ */ From owner-dev-commits-src-all@freebsd.org Fri Jul 30 01:14: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 53E1B65D090; Fri, 30 Jul 2021 01:14: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 4GbTvx1dhYz3FbX; Fri, 30 Jul 2021 01:14: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 184011BCC3; Fri, 30 Jul 2021 01:14: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 16U1ErcU097404; Fri, 30 Jul 2021 01:14:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16U1EqPT097403; Fri, 30 Jul 2021 01:14:52 GMT (envelope-from git) Date: Fri, 30 Jul 2021 01:14:52 GMT Message-Id: <202107300114.16U1EqPT097403@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 6f179693c5c4 - main - Add interceptors for atomic operations on userspace memory MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6f179693c5c4509a10eb76732dc98a7d01b0582f 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, 30 Jul 2021 01:14:53 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=6f179693c5c4509a10eb76732dc98a7d01b0582f commit 6f179693c5c4509a10eb76732dc98a7d01b0582f Author: Mark Johnston AuthorDate: 2021-07-30 01:05:03 +0000 Commit: Mark Johnston CommitDate: 2021-07-30 01:14:36 +0000 Add interceptors for atomic operations on userspace memory Implement them for KASAN. KCSAN interceptors are left unimplemented for now. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation --- sys/kern/subr_asan.c | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++++ sys/sys/systm.h | 31 ++++++++++++++++++++ 2 files changed, 114 insertions(+) diff --git a/sys/kern/subr_asan.c b/sys/kern/subr_asan.c index 7083a8e64540..5441d7be39a1 100644 --- a/sys/kern/subr_asan.c +++ b/sys/kern/subr_asan.c @@ -522,6 +522,89 @@ kasan_copyout(const void *kaddr, void *uaddr, size_t len) /* -------------------------------------------------------------------------- */ +int +kasan_fubyte(volatile const void *base) +{ + return (fubyte(base)); +} + +int +kasan_fuword16(volatile const void *base) +{ + return (fuword16(base)); +} + +int +kasan_fueword(volatile const void *base, long *val) +{ + kasan_shadow_check((unsigned long)val, sizeof(*val), true, __RET_ADDR); + return (fueword(base, val)); +} + +int +kasan_fueword32(volatile const void *base, int32_t *val) +{ + kasan_shadow_check((unsigned long)val, sizeof(*val), true, __RET_ADDR); + return (fueword32(base, val)); +} + +int +kasan_fueword64(volatile const void *base, int64_t *val) +{ + kasan_shadow_check((unsigned long)val, sizeof(*val), true, __RET_ADDR); + return (fueword64(base, val)); +} + +int +kasan_subyte(volatile void *base, int byte) +{ + return (subyte(base, byte)); +} + +int +kasan_suword(volatile void *base, long word) +{ + return (suword(base, word)); +} + +int +kasan_suword16(volatile void *base, int word) +{ + return (suword16(base, word)); +} + +int +kasan_suword32(volatile void *base, int32_t word) +{ + return (suword32(base, word)); +} + +int +kasan_suword64(volatile void *base, int64_t word) +{ + return (suword64(base, word)); +} + +int +kasan_casueword32(volatile uint32_t *base, uint32_t oldval, uint32_t *oldvalp, + uint32_t newval) +{ + kasan_shadow_check((unsigned long)oldvalp, sizeof(*oldvalp), true, + __RET_ADDR); + return (casueword32(base, oldval, oldvalp, newval)); +} + +int +kasan_casueword(volatile u_long *base, u_long oldval, u_long *oldvalp, + u_long newval) +{ + kasan_shadow_check((unsigned long)oldvalp, sizeof(*oldvalp), true, + __RET_ADDR); + return (casueword(base, oldval, oldvalp, newval)); +} + +/* -------------------------------------------------------------------------- */ + #include #include diff --git a/sys/sys/systm.h b/sys/sys/systm.h index 671b5c2b8d38..da20492966cd 100644 --- a/sys/sys/systm.h +++ b/sys/sys/systm.h @@ -437,6 +437,37 @@ int casueword32(volatile uint32_t *base, uint32_t oldval, uint32_t *oldvalp, int casueword(volatile u_long *p, u_long oldval, u_long *oldvalp, u_long newval); +#if defined(SAN_NEEDS_INTERCEPTORS) && !defined(KCSAN) +int SAN_INTERCEPTOR(fubyte)(volatile const void *base); +int SAN_INTERCEPTOR(fuword16)(volatile const void *base); +int SAN_INTERCEPTOR(fueword)(volatile const void *base, long *val); +int SAN_INTERCEPTOR(fueword32)(volatile const void *base, int32_t *val); +int SAN_INTERCEPTOR(fueword64)(volatile const void *base, int64_t *val); +int SAN_INTERCEPTOR(subyte)(volatile void *base, int byte); +int SAN_INTERCEPTOR(suword)(volatile void *base, long word); +int SAN_INTERCEPTOR(suword16)(volatile void *base, int word); +int SAN_INTERCEPTOR(suword32)(volatile void *base, int32_t word); +int SAN_INTERCEPTOR(suword64)(volatile void *base, int64_t word); +int SAN_INTERCEPTOR(casueword32)(volatile uint32_t *base, uint32_t oldval, + uint32_t *oldvalp, uint32_t newval); +int SAN_INTERCEPTOR(casueword)(volatile u_long *p, u_long oldval, + u_long *oldvalp, u_long newval); +#ifndef SAN_RUNTIME +#define fubyte(b) SAN_INTERCEPTOR(fubyte)((b)) +#define fuword16(b) SAN_INTERCEPTOR(fuword16)((b)) +#define fueword(b, v) SAN_INTERCEPTOR(fueword)((b), (v)) +#define fueword32(b, v) SAN_INTERCEPTOR(fueword32)((b), (v)) +#define fueword64(b, v) SAN_INTERCEPTOR(fueword64)((b), (v)) +#define subyte(b, w) SAN_INTERCEPTOR(subyte)((b), (w)) +#define suword(b, w) SAN_INTERCEPTOR(suword)((b), (w)) +#define suword16(b, w) SAN_INTERCEPTOR(suword16)((b), (w)) +#define suword32(b, w) SAN_INTERCEPTOR(suword32)((b), (w)) +#define suword64(b, w) SAN_INTERCEPTOR(suword64)((b), (w)) +#define casueword32(b, o, p, n) SAN_INTERCEPTOR(casueword32)((b), (o), (p), (n)) +#define casueword(b, o, p, n) SAN_INTERCEPTOR(casueword)((b), (o), (p), (n)) +#endif /* !SAN_RUNTIME */ +#endif /* SAN_NEEDS_INTERCEPTORS && !KCSAN */ + void realitexpire(void *); int sysbeep(int hertz, int period); From owner-dev-commits-src-all@freebsd.org Fri Jul 30 02:34: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 CC6CF65E83A; Fri, 30 Jul 2021 02:34: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 4GbWh15Bpqz3Km7; Fri, 30 Jul 2021 02:34: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 9B95B1D384; Fri, 30 Jul 2021 02:34: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 16U2YfMf003061; Fri, 30 Jul 2021 02:34:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16U2Yflv003060; Fri, 30 Jul 2021 02:34:41 GMT (envelope-from git) Date: Fri, 30 Jul 2021 02:34:41 GMT Message-Id: <202107300234.16U2Yflv003060@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: e1d7668f872d - stable/12 - ixgbe: Fix the build 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: e1d7668f872d7c7f9c814c918890bfaaebdee858 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, 30 Jul 2021 02:34:41 -0000 The branch stable/12 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=e1d7668f872d7c7f9c814c918890bfaaebdee858 commit e1d7668f872d7c7f9c814c918890bfaaebdee858 Author: Kevin Bowling AuthorDate: 2021-07-30 02:32:22 +0000 Commit: Kevin Bowling CommitDate: 2021-07-30 02:32:22 +0000 ixgbe: Fix the build I forgot to amend my commit after dropping CTLFLAG_NEEDGIANT. Reported by: jenkins Fixes: 07ab33cfc108 --- sys/dev/ixgbe/if_ix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/ixgbe/if_ix.c b/sys/dev/ixgbe/if_ix.c index d9fa2f4f77c5..740c8e224653 100644 --- a/sys/dev/ixgbe/if_ix.c +++ b/sys/dev/ixgbe/if_ix.c @@ -2564,7 +2564,7 @@ ixgbe_add_device_sysctls(if_ctx_t ctx) IXGBE_SYSCTL_DESC_ADV_SPEED); SYSCTL_ADD_PROC(ctx_list, child, OID_AUTO, "fw_version", - CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT, adapter, 0, + CTLTYPE_STRING | CTLFLAG_RD, adapter, 0, ixgbe_sysctl_print_fw_version, "A", "Prints FW/NVM Versions"); #ifdef IXGBE_DEBUG From owner-dev-commits-src-all@freebsd.org Fri Jul 30 03:26: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 6047965EED5; Fri, 30 Jul 2021 03:26: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 4GbXqX225Sz3NBx; Fri, 30 Jul 2021 03:26: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 239191DCB1; Fri, 30 Jul 2021 03:26: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 16U3QG8d070205; Fri, 30 Jul 2021 03:26:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16U3QGHR070204; Fri, 30 Jul 2021 03:26:16 GMT (envelope-from git) Date: Fri, 30 Jul 2021 03:26:16 GMT Message-Id: <202107300326.16U3QGHR070204@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: 74f80bc1af2f - main - coretemp(4): Switch to smp_rendezvous_cpus(). 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: 74f80bc1af2ffd56ec290f610c80e46f768731a0 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, 30 Jul 2021 03:26:16 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=74f80bc1af2ffd56ec290f610c80e46f768731a0 commit 74f80bc1af2ffd56ec290f610c80e46f768731a0 Author: Alexander Motin AuthorDate: 2021-07-30 03:16:22 +0000 Commit: Alexander Motin CommitDate: 2021-07-30 03:26:10 +0000 coretemp(4): Switch to smp_rendezvous_cpus(). Use of smp_rendezvous_cpus() instead of sched_bind() allows to not block indefinitely if target CPU is running some thread with higher priority, while all we need is single rdmsr/wrmsr instruction call. I guess it should also be much cheaper than full thread migration. MFC after: 2 weeks Sponsored by: iXsystems, Inc. --- sys/dev/coretemp/coretemp.c | 59 ++++++++++++++++++++++++++++----------------- 1 file changed, 37 insertions(+), 22 deletions(-) diff --git a/sys/dev/coretemp/coretemp.c b/sys/dev/coretemp/coretemp.c index 884ed6309f0e..53a2434254f6 100644 --- a/sys/dev/coretemp/coretemp.c +++ b/sys/dev/coretemp/coretemp.c @@ -42,7 +42,7 @@ __FBSDID("$FreeBSD$"); #include #include #include /* for curthread */ -#include +#include #include #include @@ -310,14 +310,32 @@ coretemp_detach(device_t dev) return (0); } +struct coretemp_args { + u_int msr; + 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); +} + static uint64_t coretemp_get_thermal_msr(int cpu) { - uint64_t msr; - - thread_lock(curthread); - sched_bind(curthread, cpu); - thread_unlock(curthread); + struct coretemp_args args; + cpuset_t cpus; /* * The digital temperature reading is located at bit 16 @@ -329,27 +347,24 @@ coretemp_get_thermal_msr(int cpu) * The temperature is computed by subtracting the temperature * reading by Tj(max). */ - msr = rdmsr(MSR_THERM_STATUS); - - thread_lock(curthread); - sched_unbind(curthread); - thread_unlock(curthread); - - return (msr); + 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); } static void coretemp_clear_thermal_msr(int cpu) { - thread_lock(curthread); - sched_bind(curthread, cpu); - thread_unlock(curthread); - - wrmsr(MSR_THERM_STATUS, 0); - - thread_lock(curthread); - sched_unbind(curthread); - thread_unlock(curthread); + 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); } static int From owner-dev-commits-src-all@freebsd.org Fri Jul 30 03:54: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 B726865F435; Fri, 30 Jul 2021 03:54: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 4GbYRf4cjxz3Nx4; Fri, 30 Jul 2021 03:54: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 86AA91E347; Fri, 30 Jul 2021 03:54: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 16U3s6ak009860; Fri, 30 Jul 2021 03:54:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16U3s6Sn009859; Fri, 30 Jul 2021 03:54:06 GMT (envelope-from git) Date: Fri, 30 Jul 2021 03:54:06 GMT Message-Id: <202107300354.16U3s6Sn009859@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: 9d3b47abbba7 - main - ipmi(4): Add more watchdog error checks. 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: 9d3b47abbba74830661e90206cc0f692b159c432 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, 30 Jul 2021 03:54:06 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=9d3b47abbba74830661e90206cc0f692b159c432 commit 9d3b47abbba74830661e90206cc0f692b159c432 Author: Alexander Motin AuthorDate: 2021-07-30 03:39:04 +0000 Commit: Alexander Motin CommitDate: 2021-07-30 03:39:04 +0000 ipmi(4): Add more watchdog error checks. Add request submission status checks before checking req->ir_compcode, otherwise it may be zero just because of initialization. Add checks for req->ir_compcode errors in ipmi_reset_watchdog() and ipmi_set_watchdog(). In first case explicitly check for 0x80, which means timer was not previously set, that I found happening after BMC cold reset. This change makes watchdog timer to recover instead of permanently ignoring reset errors after BMC reset or upgraded. MFC after: 2 weeks Sponsored by: iXsystems, Inc. --- sys/dev/ipmi/ipmi.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/sys/dev/ipmi/ipmi.c b/sys/dev/ipmi/ipmi.c index 25077500d835..cd2a289b25cb 100644 --- a/sys/dev/ipmi/ipmi.c +++ b/sys/dev/ipmi/ipmi.c @@ -638,8 +638,15 @@ ipmi_reset_watchdog(struct ipmi_softc *sc) IPMI_ALLOC_DRIVER_REQUEST(req, IPMI_ADDR(IPMI_APP_REQUEST, 0), IPMI_RESET_WDOG, 0, 0); error = ipmi_submit_driver_request(sc, req, 0); - if (error) + if (error) { device_printf(sc->ipmi_dev, "Failed to reset watchdog\n"); + } else if (req->ir_compcode == 0x80) { + error = ENOENT; + } else if (req->ir_compcode != 0) { + device_printf(sc->ipmi_dev, "Watchdog reset returned 0x%x\n", + req->ir_compcode); + error = EINVAL; + } return (error); } @@ -671,8 +678,13 @@ ipmi_set_watchdog(struct ipmi_softc *sc, unsigned int sec) req->ir_request[5] = 0; } error = ipmi_submit_driver_request(sc, req, 0); - if (error) + if (error) { device_printf(sc->ipmi_dev, "Failed to set watchdog\n"); + } else if (req->ir_compcode != 0) { + device_printf(sc->ipmi_dev, "Watchdog set returned 0x%x\n", + req->ir_compcode); + error = EINVAL; + } return (error); } @@ -886,9 +898,9 @@ ipmi_startup(void *arg) IPMI_GET_CHANNEL_INFO, 1, 0); req->ir_request[0] = i; - ipmi_submit_driver_request(sc, req, 0); + error = ipmi_submit_driver_request(sc, req, 0); - if (req->ir_compcode != 0) + if (error != 0 || req->ir_compcode != 0) break; } device_printf(dev, "Number of channels %d\n", i); @@ -901,9 +913,9 @@ ipmi_startup(void *arg) IPMI_INIT_DRIVER_REQUEST(req, IPMI_ADDR(IPMI_APP_REQUEST, 0), IPMI_GET_WDOG, 0, 0); - ipmi_submit_driver_request(sc, req, 0); + error = ipmi_submit_driver_request(sc, req, 0); - if (req->ir_compcode == 0x00) { + if (error == 0 && req->ir_compcode == 0x00) { device_printf(dev, "Attached watchdog\n"); /* register the watchdog event handler */ sc->ipmi_watchdog_tag = EVENTHANDLER_REGISTER( From owner-dev-commits-src-all@freebsd.org Fri Jul 30 04:01: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 D68F465FC02; Fri, 30 Jul 2021 04:01:32 +0000 (UTC) (envelope-from koobs.freebsd@gmail.com) Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) (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 4GbYcD5Kvsz3PQy; Fri, 30 Jul 2021 04:01:32 +0000 (UTC) (envelope-from koobs.freebsd@gmail.com) Received: by mail-pj1-x1033.google.com with SMTP id l19so13321075pjz.0; Thu, 29 Jul 2021 21:01:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:message-id:date:mime-version:user-agent:reply-to:subject :content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=x6WUr7L5tnOHdXrKvg97J2W2UVb43BfJ2gc5jcpEpMA=; b=i6BCWbldH0YWHUNSqV7o3JHCD+lNlUlsrs3kUEWMR/Mg6Lj+gFpRwVjWLz4KDWaX6r IQOmX+W7vbM3NqsefpsKh/kqDIqBQu7E/yx58dKLRvdaI/RMUCoDEGwE9jocjT1HWPLQ 65j0auH6OWXhqiPKo4Vp6qt1gmrjFBWvfP7EGE+YfHMS6kd6aGjh4ZsQbhVYLSuhZiF5 +gmWjwBWTaS+ydYWrYRgwjeXKYc8hBude19fZXVqvcDRoAXvAzFgcgVFpVNWIuWwvBVI tK1qboN/ER9v/2tPmSDr5Z/lnbRDmzrkcOouxqpVW/33QNkcQxqHvfPfmHjJ/LWguoUo qz9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:message-id:date:mime-version:user-agent :reply-to:subject:content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=x6WUr7L5tnOHdXrKvg97J2W2UVb43BfJ2gc5jcpEpMA=; b=PrRJnmA/MCZno9A+PagzOva1K7waghUdC14xLtKKuHWcNfJKGajE6S2laIsWSiTHKi QAOzdxoWZQwj5lfUi40H1AuOFzBBEH9Mg6TZYGVj2Yz4Kcxk9feb8Zb4Lp6qS44/9ddg VcpqkP5/q8X6IfH9xs2OJiWDjCUi1xrQF7jkRrFDC9h0q2ZzfZ0QOUGWMyt5WUD1HwpV iZukCcENVs1lxkUA3dHqPHxalJQnUnfCmTfN5LjQqkD4JN2hrsu2GpnkaO9vdKHLOGcZ uvrbKwzBVCVVDLEmp4yB2I/FDGgAcvt9uRPHh7r2lOzG0Xx/cDFFb5mmDadfSgH3Rkxs W//A== X-Gm-Message-State: AOAM533335Ta5Kc+9h5oinlCYUPrxvs7eC/y5rLpxpcYDS7ZrZwogQwP qk/UpHtDFkI/m4J8pUU1dv9A9tT8eNZ7CQ== X-Google-Smtp-Source: ABdhPJw5C7FpiXbLKzHNrOSIxx7QUnfxeDVBWPhraTYy4ay796Yytfy1v/jKxObWz+735vPUeexQQg== X-Received: by 2002:a17:90a:ba09:: with SMTP id s9mr879962pjr.126.1627617691799; Thu, 29 Jul 2021 21:01:31 -0700 (PDT) Received: from ?IPV6:2403:5800:7500:3601:a18a:8235:5cb4:170b? (2403-5800-7500-3601-a18a-8235-5cb4-170b.ip6.aussiebb.net. [2403:5800:7500:3601:a18a:8235:5cb4:170b]) by smtp.gmail.com with UTF8SMTPSA id x14sm393604pfq.143.2021.07.29.21.01.29 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 29 Jul 2021 21:01:31 -0700 (PDT) Sender: Kubilay Kocak Message-ID: <7a677c67-ea2d-aaf5-6254-334bfe93f6b3@FreeBSD.org> Date: Fri, 30 Jul 2021 14:01:24 +1000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:92.0) Gecko/20100101 Thunderbird/92.0a1 Reply-To: koobs@FreeBSD.org Subject: Re: git: fe8ce390b8bc - main - Fix mac_veriexec version mismatch Content-Language: en-US To: Wojciech Macek , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202107290905.16T95bfd002805@gitrepo.freebsd.org> From: Kubilay Kocak In-Reply-To: <202107290905.16T95bfd002805@gitrepo.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4GbYcD5Kvsz3PQy X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; TAGGED_FROM(0.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, 30 Jul 2021 04:01:32 -0000 On 29/07/2021 7:05 pm, Wojciech Macek wrote: > The branch main has been updated by wma: > > URL: https://cgit.FreeBSD.org/src/commit/?id=fe8ce390b8bcf304a9956b0f7ca8421868c22492 > > commit fe8ce390b8bcf304a9956b0f7ca8421868c22492 > Author: Wojciech Macek > AuthorDate: 2021-07-29 09:02:43 +0000 > Commit: Wojciech Macek > CommitDate: 2021-07-29 09:05:13 +0000 > > Fix mac_veriexec version mismatch > > mac_veriexec sets its version to 1, but the mac_veriexec_shaX modules which depend on it expect MAC_VERIEXEC_VERSION = 2. > Be consistent and use MAC_VERIEXEC_VERSION everywhere. > This unbreaks loading of mac_veriexec modules at boot time. > > Authored by: Kornel Duleba > Obtained from: Semihalf > Sponsored by: Stormshield > Differential Revision: https://reviews.freebsd.org/D31268 > --- > sys/dev/veriexec/verified_exec.c | 3 ++- > sys/security/mac_veriexec/mac_veriexec.c | 2 +- > 2 files changed, 3 insertions(+), 2 deletions(-) > > diff --git a/sys/dev/veriexec/verified_exec.c b/sys/dev/veriexec/verified_exec.c > index 3c72d30155dd..d6fabf825212 100644 > --- a/sys/dev/veriexec/verified_exec.c > +++ b/sys/dev/veriexec/verified_exec.c > @@ -266,4 +266,5 @@ veriexec_drvinit(void *unused __unused) > } > > SYSINIT(veriexec, SI_SUB_PSEUDO, SI_ORDER_ANY, veriexec_drvinit, NULL); > -MODULE_DEPEND(veriexec, mac_veriexec, 1, 1, 1); > +MODULE_DEPEND(veriexec, mac_veriexec, MAC_VERIEXEC_VERSION, > + MAC_VERIEXEC_VERSION, MAC_VERIEXEC_VERSION); > diff --git a/sys/security/mac_veriexec/mac_veriexec.c b/sys/security/mac_veriexec/mac_veriexec.c > index ecaa8cc35e09..dc95890f613e 100644 > --- a/sys/security/mac_veriexec/mac_veriexec.c > +++ b/sys/security/mac_veriexec/mac_veriexec.c > @@ -737,7 +737,7 @@ static struct mac_policy_ops mac_veriexec_ops = > > MAC_POLICY_SET(&mac_veriexec_ops, mac_veriexec, MAC_VERIEXEC_FULLNAME, > MPC_LOADTIME_FLAG_NOTLATE, &mac_veriexec_slot); > -MODULE_VERSION(mac_veriexec, 1); > +MODULE_VERSION(mac_veriexec, MAC_VERIEXEC_VERSION); > > static struct vnode * > mac_veriexec_bottom_vnode(struct vnode *vp) > _______________________________________________ > dev-commits-src-main@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main > To unsubscribe, send any mail to "dev-commits-src-main-unsubscribe@freebsd.org" > Any chance of getting this available (not enabled) in default (GENERIC) builds? Has come up a few times in the community From owner-dev-commits-src-all@freebsd.org Fri Jul 30 11:59: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 AC216665FCD; Fri, 30 Jul 2021 11:59: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 4GbmCP4V1Jz4htB; Fri, 30 Jul 2021 11:59: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 824D724373; Fri, 30 Jul 2021 11:59: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 16UBxDDe050620; Fri, 30 Jul 2021 11:59:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16UBxDhL050619; Fri, 30 Jul 2021 11:59:13 GMT (envelope-from git) Date: Fri, 30 Jul 2021 11:59:13 GMT Message-Id: <202107301159.16UBxDhL050619@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: 6581afbb3335 - stable/12 - pf tests: make killstate:match more robust 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: 6581afbb3335a620ba5f219011ccc898ea2a32ba 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, 30 Jul 2021 11:59:13 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=6581afbb3335a620ba5f219011ccc898ea2a32ba commit 6581afbb3335a620ba5f219011ccc898ea2a32ba Author: Kristof Provost AuthorDate: 2021-07-27 13:31:00 +0000 Commit: Kristof Provost CommitDate: 2021-07-30 11:57:02 +0000 pf tests: make killstate:match more robust Only lists the states relevant to the connection we're killing. Sometimes there are IPv6 related states (due to the usual IPv6 background traffic of router solicitations, DAD, ...) that causes us to think we failed to kill the state, which in turn caused the test to fail intermittently. MFC after: 3 days Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 4e860bd5da1423aac9aed0541c484ebf9c1d1621) --- tests/sys/netpfil/pf/killstate.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/sys/netpfil/pf/killstate.sh b/tests/sys/netpfil/pf/killstate.sh index 2b77ea189294..adf229945911 100644 --- a/tests/sys/netpfil/pf/killstate.sh +++ b/tests/sys/netpfil/pf/killstate.sh @@ -354,7 +354,7 @@ match_body() wait_for_state alcatraz 192.0.2.1 # Expect two states - states=$(jexec alcatraz pfctl -s s | wc -l) + states=$(jexec alcatraz pfctl -s s | grep 192.0.2.1 | wc -l) if [ $states -ne 2 ] ; then atf_fail "Expected two states, found $states" @@ -362,7 +362,7 @@ match_body() # If we don't kill the matching NAT state one should be left jexec alcatraz pfctl -k 192.0.2.1 - states=$(jexec alcatraz pfctl -s s | wc -l) + states=$(jexec alcatraz pfctl -s s | grep 192.0.2.1 | wc -l) if [ $states -ne 1 ] ; then atf_fail "Expected one states, found $states" @@ -376,7 +376,7 @@ match_body() # Kill matching states, expect all of them to be gone jexec alcatraz pfctl -M -k 192.0.2.1 - states=$(jexec alcatraz pfctl -s s | wc -l) + states=$(jexec alcatraz pfctl -s s | grep 192.0.2.1 | wc -l) if [ $states -ne 0 ] ; then atf_fail "Expected zero states, found $states" From owner-dev-commits-src-all@freebsd.org Fri Jul 30 11:59: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 4FDEA665FCA; Fri, 30 Jul 2021 11:59: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 4GbmCP1ZqDz4hnf; Fri, 30 Jul 2021 11:59: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 1E1D9246AE; Fri, 30 Jul 2021 11:59: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 16UBxDTI050543; Fri, 30 Jul 2021 11:59:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16UBxDmB050542; Fri, 30 Jul 2021 11:59:13 GMT (envelope-from git) Date: Fri, 30 Jul 2021 11:59:13 GMT Message-Id: <202107301159.16UBxDmB050542@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: efe3bf0fb092 - stable/13 - pf tests: make killstate:match more robust 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: efe3bf0fb092ebf79c04c760b8b6d703817c37c0 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, 30 Jul 2021 11:59:13 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=efe3bf0fb092ebf79c04c760b8b6d703817c37c0 commit efe3bf0fb092ebf79c04c760b8b6d703817c37c0 Author: Kristof Provost AuthorDate: 2021-07-27 13:31:00 +0000 Commit: Kristof Provost CommitDate: 2021-07-30 07:51:04 +0000 pf tests: make killstate:match more robust Only lists the states relevant to the connection we're killing. Sometimes there are IPv6 related states (due to the usual IPv6 background traffic of router solicitations, DAD, ...) that causes us to think we failed to kill the state, which in turn caused the test to fail intermittently. MFC after: 3 days Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 4e860bd5da1423aac9aed0541c484ebf9c1d1621) --- tests/sys/netpfil/pf/killstate.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/sys/netpfil/pf/killstate.sh b/tests/sys/netpfil/pf/killstate.sh index f53ede8c7578..e140ee4d144d 100644 --- a/tests/sys/netpfil/pf/killstate.sh +++ b/tests/sys/netpfil/pf/killstate.sh @@ -426,7 +426,7 @@ match_body() wait_for_state alcatraz 192.0.2.1 # Expect two states - states=$(jexec alcatraz pfctl -s s | wc -l) + states=$(jexec alcatraz pfctl -s s | grep 192.0.2.1 | wc -l) if [ $states -ne 2 ] ; then atf_fail "Expected two states, found $states" @@ -434,7 +434,7 @@ match_body() # If we don't kill the matching NAT state one should be left jexec alcatraz pfctl -k 192.0.2.1 - states=$(jexec alcatraz pfctl -s s | wc -l) + states=$(jexec alcatraz pfctl -s s | grep 192.0.2.1 | wc -l) if [ $states -ne 1 ] ; then atf_fail "Expected one states, found $states" @@ -448,7 +448,7 @@ match_body() # Kill matching states, expect all of them to be gone jexec alcatraz pfctl -M -k 192.0.2.1 - states=$(jexec alcatraz pfctl -s s | wc -l) + states=$(jexec alcatraz pfctl -s s | grep 192.0.2.1 | wc -l) if [ $states -ne 0 ] ; then atf_fail "Expected zero states, found $states" From owner-dev-commits-src-all@freebsd.org Fri Jul 30 12:24: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 964466666A6; Fri, 30 Jul 2021 12:24: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 4Gbmm43dZjz4k30; Fri, 30 Jul 2021 12:24: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 6467A2508C; Fri, 30 Jul 2021 12:24: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 16UCO4hi091519; Fri, 30 Jul 2021 12:24:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16UCO4PR091518; Fri, 30 Jul 2021 12:24:04 GMT (envelope-from git) Date: Fri, 30 Jul 2021 12:24:04 GMT Message-Id: <202107301224.16UCO4PR091518@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: b69019c14cd8 - main - 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/main X-Git-Reftype: branch X-Git-Commit: b69019c14cd89a5e699bc6e69941aec5b1041b1e 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, 30 Jul 2021 12:24:04 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=b69019c14cd89a5e699bc6e69941aec5b1041b1e commit b69019c14cd89a5e699bc6e69941aec5b1041b1e Author: Kristof Provost AuthorDate: 2021-07-06 11:13:24 +0000 Commit: Kristof Provost CommitDate: 2021-07-30 09:45:28 +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 --- 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 e13b3b61c1a3..17d1e8c1a047 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -1671,7 +1671,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 c1dd4488e67d..7c506b79295b 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -208,7 +208,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 *); @@ -2185,7 +2184,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: @@ -2240,7 +2238,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: @@ -3039,11 +3036,6 @@ DIOCGETSTATESV2_full: break; } - case DIOCGETSTATESNV: { - error = pf_getstates((struct pfioc_nv *)addr); - break; - } - case DIOCGETSTATUS: { struct pf_status *s = (struct pf_status *)addr; @@ -5296,84 +5288,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 Jul 30 12:24: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 E2CF4666930; Fri, 30 Jul 2021 12:24: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 4Gbmm54xxsz4jY6; Fri, 30 Jul 2021 12:24: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 8717324CB5; Fri, 30 Jul 2021 12:24: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 16UCO5Cc091543; Fri, 30 Jul 2021 12:24:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16UCO5Y7091542; Fri, 30 Jul 2021 12:24:05 GMT (envelope-from git) Date: Fri, 30 Jul 2021 12:24:05 GMT Message-Id: <202107301224.16UCO5Y7091542@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: 3412900333e6 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 3412900333e659124f61ada6389ef40dd0f3ddd4 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, 30 Jul 2021 12:24:06 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=3412900333e659124f61ada6389ef40dd0f3ddd4 commit 3412900333e659124f61ada6389ef40dd0f3ddd4 Author: Kristof Provost AuthorDate: 2021-07-14 13:51:36 +0000 Commit: Kristof Provost CommitDate: 2021-07-30 12:23:40 +0000 UPDATING: Document the removal of DIOCGETSTATESNV MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") --- UPDATING | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/UPDATING b/UPDATING index d109cb1594a5..e8be8cd6165e 100644 --- a/UPDATING +++ b/UPDATING @@ -27,6 +27,12 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 14.x IS SLOW: world, or to merely disable the most expensive debugging functionality at runtime, run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +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. + 20210729: As of commit 01ad0c007964 if_bridge member interfaces can no longer change their MTU. Changing the MTU of the bridge itself will change the From owner-dev-commits-src-all@freebsd.org Fri Jul 30 13:34:40 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1457A668339; Fri, 30 Jul 2021 13:34:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GbpKW6wTNz4p3v; Fri, 30 Jul 2021 13:34:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D660025E26; Fri, 30 Jul 2021 13:34:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16UDYd0d084215; Fri, 30 Jul 2021 13:34:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16UDYdt2084214; Fri, 30 Jul 2021 13:34:39 GMT (envelope-from git) Date: Fri, 30 Jul 2021 13:34:39 GMT Message-Id: <202107301334.16UDYdt2084214@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Tom Jones Subject: git: 0943200b1308 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 0943200b1308bcf2e2b331f6aba514d64d74545f 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, 30 Jul 2021 13:34:40 -0000 The branch main has been updated by thj: URL: https://cgit.FreeBSD.org/src/commit/?id=0943200b1308bcf2e2b331f6aba514d64d74545f commit 0943200b1308bcf2e2b331f6aba514d64d74545f Author: Tom Jones AuthorDate: 2021-07-30 13:23:39 +0000 Commit: Tom Jones CommitDate: 2021-07-30 13:23:39 +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 --- 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 Fri Jul 30 19:22: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 67D7F66C04F; Fri, 30 Jul 2021 19:22: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 4Gby2d2Qfnz3QnL; Fri, 30 Jul 2021 19: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 3BC02299B; Fri, 30 Jul 2021 19: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 16UJMHEm051776; Fri, 30 Jul 2021 19: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 16UJMH3d051775; Fri, 30 Jul 2021 19:22:17 GMT (envelope-from git) Date: Fri, 30 Jul 2021 19:22:17 GMT Message-Id: <202107301922.16UJMH3d051775@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: b2ed7e988a34 - main - bus: Convert to the new interceptor scheme MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b2ed7e988a34f373b13f4832e639ae9054d93aae 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, 30 Jul 2021 19:22:17 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=b2ed7e988a34f373b13f4832e639ae9054d93aae commit b2ed7e988a34f373b13f4832e639ae9054d93aae Author: Mark Johnston AuthorDate: 2021-07-30 19:15:27 +0000 Commit: Mark Johnston CommitDate: 2021-07-30 19:15:27 +0000 bus: Convert to the new interceptor scheme This was missed in commit a90d053b8422. Fixes: a90d053b8422 MFC after: 2 weeks Sponsored by: The FreeBSD Foundation --- sys/x86/x86/bus_machdep.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/x86/x86/bus_machdep.c b/sys/x86/x86/bus_machdep.c index 3dc203f65694..2a5b6d8976ad 100644 --- a/sys/x86/x86/bus_machdep.c +++ b/sys/x86/x86/bus_machdep.c @@ -24,13 +24,13 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#if defined(KASAN) || defined(KCSAN) -#define SAN_RUNTIME -#endif - #include __FBSDID("$FreeBSD$"); +#ifdef SAN_NEEDS_INTERCEPTORS +#define SAN_RUNTIME +#endif + #include #include #include From owner-dev-commits-src-all@freebsd.org Fri Jul 30 20:01: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 8A85866D133; Fri, 30 Jul 2021 20:01: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 4GbywP3KS6z3kR7; Fri, 30 Jul 2021 20:01: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 5A7C631A9; Fri, 30 Jul 2021 20:01: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 16UK1vVQ004427; Fri, 30 Jul 2021 20:01:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16UK1vei004426; Fri, 30 Jul 2021 20:01:57 GMT (envelope-from git) Date: Fri, 30 Jul 2021 20:01:57 GMT Message-Id: <202107302001.16UK1vei004426@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: a191b4018f1d - main - UPDATING: fix incorrect hash 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: a191b4018f1d05527dce4ac3d52596a12a09775b 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, 30 Jul 2021 20:01:57 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=a191b4018f1d05527dce4ac3d52596a12a09775b commit a191b4018f1d05527dce4ac3d52596a12a09775b Author: Kristof Provost AuthorDate: 2021-07-30 18:00:47 +0000 Commit: Kristof Provost CommitDate: 2021-07-30 18:01:24 +0000 UPDATING: fix incorrect hash Pointed out by: lwhsu --- UPDATING | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UPDATING b/UPDATING index e8be8cd6165e..4aaac623c61f 100644 --- a/UPDATING +++ b/UPDATING @@ -31,7 +31,7 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 14.x IS SLOW: 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. + past b69019c14cd8 without first updating userspace past be70c7a50d32. 20210729: As of commit 01ad0c007964 if_bridge member interfaces can no longer From owner-dev-commits-src-all@freebsd.org Fri Jul 30 20:51: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 0DFC866DF34; Fri, 30 Jul 2021 20:51: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 4Gc018711hz3nTC; Fri, 30 Jul 2021 20:51: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 D8EC53B34; Fri, 30 Jul 2021 20:51: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 16UKp8nc066363; Fri, 30 Jul 2021 20:51:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16UKp8vd066362; Fri, 30 Jul 2021 20:51:08 GMT (envelope-from git) Date: Fri, 30 Jul 2021 20:51:08 GMT Message-Id: <202107302051.16UKp8vd066362@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: d0d631d5f443 - main - cxgbei: Round up the maximum PDU data length by the MSS for TXDATAPLEN_MAX. 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: d0d631d5f4437223664f7bbdfdb421ec05cf9657 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, 30 Jul 2021 20:51:09 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=d0d631d5f4437223664f7bbdfdb421ec05cf9657 commit d0d631d5f4437223664f7bbdfdb421ec05cf9657 Author: John Baldwin AuthorDate: 2021-07-29 21:17:45 +0000 Commit: John Baldwin CommitDate: 2021-07-30 20:27:24 +0000 cxgbei: Round up the maximum PDU data length by the MSS for TXDATAPLEN_MAX. Recent firmware versions round down the value passed here by the MSS and subsequently mishandle transmitted PDUs larger than the rounded down value. Reported by: Jithesh Arakkan @ Chelsio Sponsored by: Chelsio Communications --- sys/dev/cxgbe/cxgbei/icl_cxgbei.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c index 4a6cf0a19d44..7d8ebd1e040f 100644 --- a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c @@ -826,7 +826,8 @@ icl_cxgbei_conn_handoff(struct icl_conn *ic, int fd) toep->params.ulp_mode = ULP_MODE_ISCSI; toep->ulpcb = icc; - send_iscsi_flowc_wr(icc->sc, toep, ci->max_tx_pdu_len); + send_iscsi_flowc_wr(icc->sc, toep, roundup(ci->max_tx_pdu_len, + tp->t_maxseg)); set_ulp_mode_iscsi(icc->sc, toep, icc->ulp_submode); error = 0; } From owner-dev-commits-src-all@freebsd.org Fri Jul 30 22:56: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 C480266F3CF; Fri, 30 Jul 2021 22:56: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 4Gc2nx4vlwz3tYs; Fri, 30 Jul 2021 22:56: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 909575A80; Fri, 30 Jul 2021 22:56: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 16UMubfh030559; Fri, 30 Jul 2021 22:56:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16UMubD0030558; Fri, 30 Jul 2021 22:56:37 GMT (envelope-from git) Date: Fri, 30 Jul 2021 22:56:37 GMT Message-Id: <202107302256.16UMubD0030558@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: 9ed1e98abfe4 - main - nanobsd: adopt dhcpd to latest conventions 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: 9ed1e98abfe470a958a55b4fc6d6391ca8e4478d 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, 30 Jul 2021 22:56:37 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=9ed1e98abfe470a958a55b4fc6d6391ca8e4478d commit 9ed1e98abfe470a958a55b4fc6d6391ca8e4478d Author: Warner Losh AuthorDate: 2021-07-30 22:55:43 +0000 Commit: Warner Losh CommitDate: 2021-07-30 22:55:43 +0000 nanobsd: adopt dhcpd to latest conventions Adopt the dhcpd build to use nanobsd-build top level directory that other nanobsd builds are using. Sponsored by: Netflix --- tools/tools/nanobsd/dhcpd/common | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/tools/nanobsd/dhcpd/common b/tools/tools/nanobsd/dhcpd/common index 0c801318609e..07b3f3963d0b 100644 --- a/tools/tools/nanobsd/dhcpd/common +++ b/tools/tools/nanobsd/dhcpd/common @@ -41,11 +41,11 @@ NANO_CFG_BASE=$(pwd) NANO_CFG_BASE=${NANO_CFG_BASE%/dhcpd} NANO_SRC=$(pwd) NANO_SRC=${NANO_SRC%/tools/tools/nanobsd/dhcpd} -NANO_OBJ=${NANO_SRC}/../dhcpd/obj +NANO_OBJ=${NANO_SRC}/../nanobsd-builds/dhcpd/obj # Where cust_pkg() finds packages to install #XXX: Is this the right place? -#NANO_PORTS=$(realpath ${NANO_SRC}/../ports) -NANO_PORTS=/usr/ports +NANO_PORTS=$(realpath ${NANO_SRC}/../ports) +#NANO_PORTS=/usr/ports NANO_PACKAGE_DIR=${NANO_SRC}/${NANO_TOOLS}/Pkg NANO_DATADIR=${NANO_OBJ}/_.data NANO_DATASIZE=40960 From owner-dev-commits-src-all@freebsd.org Fri Jul 30 23:09: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 93ED366F726; Fri, 30 Jul 2021 23:09: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 4Gc34b3Sq3z3vHj; Fri, 30 Jul 2021 23:09: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 5EC835C19; Fri, 30 Jul 2021 23:09: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 16UN9J3q044604; Fri, 30 Jul 2021 23:09:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16UN9J8u044603; Fri, 30 Jul 2021 23:09:19 GMT (envelope-from git) Date: Fri, 30 Jul 2021 23:09:19 GMT Message-Id: <202107302309.16UN9J8u044603@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: cda1f88da530 - main - RELNOTES: Put the old descripiton back 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: cda1f88da5301a47e53e6aeead739e440233d052 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, 30 Jul 2021 23:09:19 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=cda1f88da5301a47e53e6aeead739e440233d052 commit cda1f88da5301a47e53e6aeead739e440233d052 Author: Warner Losh AuthorDate: 2021-07-30 23:07:52 +0000 Commit: Warner Losh CommitDate: 2021-07-30 23:07:52 +0000 RELNOTES: Put the old descripiton back After looking at the RELNOTES files on the stable branches, restore the old description and update the file to match the format it's supposed to have. Sponsored by: Netflix --- RELNOTES | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/RELNOTES b/RELNOTES index 5f8c75081cc0..d70d58428dff 100644 --- a/RELNOTES +++ b/RELNOTES @@ -5,12 +5,12 @@ users of binary FreeBSD releases. Each entry should describe the change in no more than several sentences and should reference manual pages where an interested user can find more information. Entries should wrap after 80 columns. Each entry should begin with one or more commit IDs on one line, -specified as a comma separated list and/or range. Entries should be separated -by a newline. +specified as a comma separated list and/or range, followed by a colon and a +newline. Entries should be separated by a newline. Changes to this file should not be MFCed. -various +various: One True Awk has been updated to the latest from upstream (20210215). All the FreeBSD patches, but one, have now been either up streamed or discarded. Notable changes include: @@ -24,7 +24,7 @@ various true awk now) interpret them as 0 in line with awk's historic behavior. -ee29e6f31111 +ee29e6f31111: Commit ee29e6f31111 added a new sysctl called vfs.nfsd.srvmaxio that can be used to increase the maximum I/O size for the NFS server to any power of 2 up to 1Mbyte while the nfsd(8) is not running. @@ -34,15 +34,15 @@ ee29e6f31111 kern.ipc.maxsockbuf will need to be increased. A console message will suggest a setting for it. -d575e81fbcfa +d575e81fbcfa: gconcat(8) has added support for appending devices to the device not present at creation time. -76681661be28 +76681661be28: Remove support for asymmetric cryptographic operations from the kernel open cryptographic framework (OCF). -a145cf3f73c7 +a145cf3f73c7: The NFSv4 client now uses the highest minor version of NFSv4 supported by the NFSv4 server by default instead of minor version 0, for NFSv4 mounts. From owner-dev-commits-src-all@freebsd.org Fri Jul 30 23:34: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 5860066F574; Fri, 30 Jul 2021 23:34: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 4Gc3dL20GMz4R0c; Fri, 30 Jul 2021 23:34: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 2C9116301; Fri, 30 Jul 2021 23:34: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 16UNYEYU084172; Fri, 30 Jul 2021 23:34:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16UNYEFW084171; Fri, 30 Jul 2021 23:34:14 GMT (envelope-from git) Date: Fri, 30 Jul 2021 23:34:14 GMT Message-Id: <202107302334.16UNYEFW084171@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: 631cf89fd4c8 - stable/13 - boot: fix OBJS to not include BTX's crt0.o 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: 631cf89fd4c869d3688a63402199e0500b1a65a8 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, 30 Jul 2021 23:34:14 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=631cf89fd4c869d3688a63402199e0500b1a65a8 commit 631cf89fd4c869d3688a63402199e0500b1a65a8 Author: Warner Losh AuthorDate: 2021-05-06 19:05:09 +0000 Commit: Warner Losh CommitDate: 2021-07-30 23:00:17 +0000 boot: fix OBJS to not include BTX's crt0.o According to comments in the Makefile, to make pxeboot work we need to have crt0.o first. This is needed because the simplified loader in pxeboot assumes that the startup code is at offset 0 in this binary. In normal booting, the start address can be obtained from headers of the binary, but since pxeboot encodes this as a pure binary, it has no way of knowing where that is and assumes 0. Added comments to that effect in the Makefile. We've done this by adding it to OBJS before all the other .o's are added. However, there's a problem. This also adds it to the CLEANFILES variable, which causes it to be removed from multiple places. The dependencies may also cause it to be re-built at a time that's after boot2 is built. This causes installs to fail because at install time boot2 is considered to be out of date and the programs to rebuild it are no longer in the path. Cope with this problem by just adding it to LDFLAGS instead. Glanced at by: kevans ("I thought that went in ages ago") Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D28876 (cherry picked from commit e713d3a013882893fceb84dd14569052271497a9) --- stand/i386/loader/Makefile | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/stand/i386/loader/Makefile b/stand/i386/loader/Makefile index ad95948ec50a..dcae7bd67a14 100644 --- a/stand/i386/loader/Makefile +++ b/stand/i386/loader/Makefile @@ -89,8 +89,18 @@ LINKS+= ${BINDIR}/${LOADER} ${BINDIR}/loader FILES+= ${LOADER} FILESMODE_${LOADER}= ${BINMODE} -b -# XXX crt0.o needs to be first for pxeboot(8) to work -OBJS= ${BTXCRT} +# Note: crt0.o needs to be first for pxeboot(8) to work. It assumes that the +# startup code is located at the start of the loader and will jump +# there. Although btx is more flexible than this, the emulated boot2 environment +# that pxeloader provides has none of that flexibility because it lacks access +# to the a.out/elf headers and assumes an entry point of 0. +# +# We must add it to the LDFLAGS instead of the OBJS becauce the former won't try +# to clean it. When it is in OBJS, this cleaning can lead to races where +# btxcrt.o is rebuilt, but boot2 isn't, leading to errors at installation time. +# LDFLAGS does not have this baggage and will be included first in the list of +# files. +LDFLAGS+= ${BTXCRT} DPADD= ${LDR_INTERP32} ${LIBFIREWIRE} ${LIBI386} ${LIBSA32} LDADD= ${LDR_INTERP32} ${LIBFIREWIRE} ${LIBI386} ${LIBSA32} From owner-dev-commits-src-all@freebsd.org Fri Jul 30 23:34: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 84F5166FB5C; Fri, 30 Jul 2021 23:34: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 4Gc3dM304Qz4R0f; Fri, 30 Jul 2021 23:34: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 4B42D612C; Fri, 30 Jul 2021 23: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 16UNYFLk084196; Fri, 30 Jul 2021 23: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 16UNYF2w084195; Fri, 30 Jul 2021 23:34:15 GMT (envelope-from git) Date: Fri, 30 Jul 2021 23:34:15 GMT Message-Id: <202107302334.16UNYF2w084195@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: a05125907261 - stable/13 - typo: becauce -> because 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: a051259072615dfa2e8c86cb8e08f0016f611c65 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, 30 Jul 2021 23:34:15 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=a051259072615dfa2e8c86cb8e08f0016f611c65 commit a051259072615dfa2e8c86cb8e08f0016f611c65 Author: Warner Losh AuthorDate: 2021-07-22 02:02:44 +0000 Commit: Warner Losh CommitDate: 2021-07-30 23:02:07 +0000 typo: becauce -> because Noticed by: Piotr P. Stefaniak Sponsored by: Netflix (cherry picked from commit 2b720db8d409f6fcdffa7f06b1d8c1b981435a83) --- stand/i386/loader/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stand/i386/loader/Makefile b/stand/i386/loader/Makefile index dcae7bd67a14..0abf6120c1e3 100644 --- a/stand/i386/loader/Makefile +++ b/stand/i386/loader/Makefile @@ -95,7 +95,7 @@ FILESMODE_${LOADER}= ${BINMODE} -b # that pxeloader provides has none of that flexibility because it lacks access # to the a.out/elf headers and assumes an entry point of 0. # -# We must add it to the LDFLAGS instead of the OBJS becauce the former won't try +# We must add it to the LDFLAGS instead of the OBJS because the former won't try # to clean it. When it is in OBJS, this cleaning can lead to races where # btxcrt.o is rebuilt, but boot2 isn't, leading to errors at installation time. # LDFLAGS does not have this baggage and will be included first in the list of From owner-dev-commits-src-all@freebsd.org Fri Jul 30 23: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 C537566F7AB; Fri, 30 Jul 2021 23: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 4Gc3dN4m32z3wXs; Fri, 30 Jul 2021 23: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 7BB1E5FDA; Fri, 30 Jul 2021 23:34: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 16UNYGMY084220; Fri, 30 Jul 2021 23:34:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16UNYGRs084219; Fri, 30 Jul 2021 23:34:16 GMT (envelope-from git) Date: Fri, 30 Jul 2021 23:34:16 GMT Message-Id: <202107302334.16UNYGRs084219@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: ea4936b4708e - stable/13 - awk: Reduce diffs with upstream to almost nothing. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: ea4936b4708ec3ba8f0ce67a161d136c35d71d63 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, 30 Jul 2021 23:34:16 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=ea4936b4708ec3ba8f0ce67a161d136c35d71d63 commit ea4936b4708ec3ba8f0ce67a161d136c35d71d63 Author: Warner Losh AuthorDate: 2021-07-09 03:51:24 +0000 Commit: Warner Losh CommitDate: 2021-07-30 23:02:12 +0000 awk: Reduce diffs with upstream to almost nothing. In the merge of 20210215, I left two merge conflicts #if 0'd by mistake to check later rather than resolve them as part of the merge. This code turns out to be from the original one-true-awk import and not FreeBSD specific, so remove them. Remove a extra definition of HAT. Remove a stylistic change that also appears to be a mismerge along the way. Remove FREEBSD-upgrade. Nobody has updated it since the original 2007 cvs import. It talks about old CVS branches that never made it into svn, let alone git. New imports will follow the standard practices now, so there's nothing left to document. Move README to README.md and copy the README.md from upstream over. This leaves just the $FreeBSD$ lines (which remain for the stable/12 merge) and the strcoll part of ru@'s r201989/d98dd8e5f94c as the only diffs with upstream. FreeBSD also still has its own man page, which I don't plan on changing. Once this commit is merged to stable/12, I plan no further merges to stable/12. Sometime after that I'll remove the $FreeBSD$ lines to reduce the diffs even more (though i want to make sure plans won't change first). I also plan to talk to upstream about this change... MFC After: 2 weeks Sponsored by: Netflix (cherry picked from commit f68a53dba933f9c1143863603f5a16fdbe5f070e) --- contrib/one-true-awk/FREEBSD-upgrade | 24 ------- contrib/one-true-awk/README | 94 --------------------------- contrib/one-true-awk/README.md | 119 +++++++++++++++++++++++++++++++++++ contrib/one-true-awk/awk.h | 2 - contrib/one-true-awk/b.c | 32 +--------- 5 files changed, 120 insertions(+), 151 deletions(-) diff --git a/contrib/one-true-awk/FREEBSD-upgrade b/contrib/one-true-awk/FREEBSD-upgrade deleted file mode 100644 index f0f70ab7b17b..000000000000 --- a/contrib/one-true-awk/FREEBSD-upgrade +++ /dev/null @@ -1,24 +0,0 @@ -# $FreeBSD$ - -Import of the 2005/04/24 version of the "one true awk", as described -in "The AWK Programming Language", by Al Aho, Brian Kernighan, and -Peter Weinberger (Addison-Wesley, 1988, ISBN 0-201-07981-X). - -Original sources were taken from the Brian Kernighan's AWK page -http://www.cs.princeton.edu/~bwk/btl.mirror -and include bug fixes up thru Oct 23, 2007. - -The following files were removed for this import: - - buildwin.bat - makefile.win - missing95.c - vcvars32.bat - ytab.c - ytab.h - ytabc.bak - ytabh.bak - -The vendor import was done by: - - cvs import src/contrib/one-true-awk BELL_LABS bwk_20071023 diff --git a/contrib/one-true-awk/README b/contrib/one-true-awk/README deleted file mode 100644 index 24aaf9092d58..000000000000 --- a/contrib/one-true-awk/README +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************** -Copyright (C) Lucent Technologies 1997 -All Rights Reserved - -Permission to use, copy, modify, and distribute this software and -its documentation for any purpose and without fee is hereby -granted, provided that the above copyright notice appear in all -copies and that both that the copyright notice and this -permission notice and warranty disclaimer appear in supporting -documentation, and that the name Lucent Technologies or any of -its entities not be used in advertising or publicity pertaining -to distribution of the software without specific, written prior -permission. - -LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. -IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY -SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER -IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF -THIS SOFTWARE. -****************************************************************/ - -This is the version of awk described in "The AWK Programming Language", -by Al Aho, Brian Kernighan, and Peter Weinberger -(Addison-Wesley, 1988, ISBN 0-201-07981-X). - -Changes, mostly bug fixes and occasional enhancements, are listed -in FIXES. If you distribute this code further, please please please -distribute FIXES with it. If you find errors, please report them -to bwk@cs.princeton.edu. Thanks. - -The program itself is created by - make -which should produce a sequence of messages roughly like this: - - yacc -d awkgram.y - -conflicts: 43 shift/reduce, 85 reduce/reduce - mv y.tab.c ytab.c - mv y.tab.h ytab.h - cc -c ytab.c - cc -c b.c - cc -c main.c - cc -c parse.c - cc maketab.c -o maketab - ./maketab >proctab.c - cc -c proctab.c - cc -c tran.c - cc -c lib.c - cc -c run.c - cc -c lex.c - cc ytab.o b.o main.o parse.o proctab.o tran.o lib.o run.o lex.o -lm - -This produces an executable a.out; you will eventually want to -move this to some place like /usr/bin/awk. - -If your system does not have yacc or bison (the GNU -equivalent), you must compile the pieces manually. We have -included yacc output in ytab.c and ytab.h, and backup copies in -case you overwrite them. We have also included a copy of -proctab.c so you do not need to run maketab. - -NOTE: This version uses ANSI C, as you should also. We have -compiled this without any changes using gcc -Wall and/or local C -compilers on a variety of systems, but new systems or compilers -may raise some new complaint; reports of difficulties are -welcome. - -This also compiles with Visual C++ on all flavors of Windows, -*if* you provide versions of popen and pclose. The file -missing95.c contains versions that can be used to get started -with, though the underlying support has mysterious properties, -the symptom of which can be truncated pipe output. Beware. The -file makefile.win gives hints on how to proceed; if you run -vcvars32.bat, it will set up necessary paths and parameters so -you can subsequently run nmake -f makefile.win. Beware also that -when running on Windows under command.com, various quoting -conventions are different from Unix systems: single quotes won't -work around arguments, and various characters like % are -interpreted within double quotes. - -This compiles without change on Macintosh OS X using gcc and -the standard developer tools. - -This is also said to compile on Macintosh OS 9 systems, using the -file "buildmac" provided by Dan Allen (danallen@microsoft.com), -to whom many thanks. - -The version of malloc that comes with some systems is sometimes -astonishly slow. If awk seems slow, you might try fixing that. -More generally, turning on optimization can significantly improve -awk's speed, perhaps by 1/3 for highest levels. diff --git a/contrib/one-true-awk/README.md b/contrib/one-true-awk/README.md new file mode 100644 index 000000000000..b8089b3a4803 --- /dev/null +++ b/contrib/one-true-awk/README.md @@ -0,0 +1,119 @@ +# The One True Awk + +This is the version of `awk` described in _The AWK Programming Language_, +by Al Aho, Brian Kernighan, and Peter Weinberger +(Addison-Wesley, 1988, ISBN 0-201-07981-X). + +## Copyright + +Copyright (C) Lucent Technologies 1997
+All Rights Reserved + +Permission to use, copy, modify, and distribute this software and +its documentation for any purpose and without fee is hereby +granted, provided that the above copyright notice appear in all +copies and that both that the copyright notice and this +permission notice and warranty disclaimer appear in supporting +documentation, and that the name Lucent Technologies or any of +its entities not be used in advertising or publicity pertaining +to distribution of the software without specific, written prior +permission. + +LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. +IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY +SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER +IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. + +## Distribution and Reporting Problems + +Changes, mostly bug fixes and occasional enhancements, are listed +in `FIXES`. If you distribute this code further, please please please +distribute `FIXES` with it. + +If you find errors, please report them +to bwk@cs.princeton.edu. +Please _also_ open an issue in the GitHub issue tracker, to make +it easy to track issues. +Thanks. + +## Submitting Pull Requests + +Pull requests are welcome. Some guidelines: + +* Please do not use functions or facilities that are not standard (e.g., +`strlcpy()`, `fpurge()`). + +* Please run the test suite and make sure that your changes pass before +posting the pull request. To do so: + + 1. Save the previous version of `awk` somewhere in your path. Call it `nawk` (for example). + 1. Run `oldawk=nawk make check > check.out 2>&1`. + 1. Search for `BAD` or `error` in the result. In general, look over it manually to make sure there are no errors. + +* Please create the pull request with a request +to merge into the `staging` branch instead of into the `master` branch. +This allows us to do testing, and to make any additional edits or changes +after the merge but before merging to `master`. + +## Building + +The program itself is created by + + make + +which should produce a sequence of messages roughly like this: + + yacc -d awkgram.y + conflicts: 43 shift/reduce, 85 reduce/reduce + mv y.tab.c ytab.c + mv y.tab.h ytab.h + cc -c ytab.c + cc -c b.c + cc -c main.c + cc -c parse.c + cc maketab.c -o maketab + ./maketab >proctab.c + cc -c proctab.c + cc -c tran.c + cc -c lib.c + cc -c run.c + cc -c lex.c + cc ytab.o b.o main.o parse.o proctab.o tran.o lib.o run.o lex.o -lm + +This produces an executable `a.out`; you will eventually want to +move this to some place like `/usr/bin/awk`. + +If your system does not have `yacc` or `bison` (the GNU +equivalent), you need to install one of them first. + +NOTE: This version uses ANSI C (C 99), as you should also. We have +compiled this without any changes using `gcc -Wall` and/or local C +compilers on a variety of systems, but new systems or compilers +may raise some new complaint; reports of difficulties are +welcome. + +This compiles without change on Macintosh OS X using `gcc` and +the standard developer tools. + +You can also use `make CC=g++` to build with the GNU C++ compiler, +should you choose to do so. + +The version of `malloc` that comes with some systems is sometimes +astonishly slow. If `awk` seems slow, you might try fixing that. +More generally, turning on optimization can significantly improve +`awk`'s speed, perhaps by 1/3 for highest levels. + +## A Note About Maintenance + +NOTICE! Maintenance of this program is on a ``best effort'' +basis. We try to get to issues and pull requests as quickly +as we can. Unfortunately, however, keeping this program going +is not at the top of our priority list. + +#### Last Updated + +Fri Dec 25 16:53:34 EST 2020 diff --git a/contrib/one-true-awk/awk.h b/contrib/one-true-awk/awk.h index 230eac41548c..51c00df9f279 100644 --- a/contrib/one-true-awk/awk.h +++ b/contrib/one-true-awk/awk.h @@ -237,8 +237,6 @@ extern int pairstack[], paircnt; /* watch out in match(), etc. */ #define HAT (NCHARS+2) /* matches ^ in regular expr */ #define NSTATES 32 -#define HAT (NCHARS+2) /* matches ^ in regular expr */ - /* NCHARS is 2**n */ typedef struct rrow { long ltype; /* long avoids pointer warnings on 64-bit */ diff --git a/contrib/one-true-awk/b.c b/contrib/one-true-awk/b.c index 20f4a8bee7f9..dd64f09647b0 100644 --- a/contrib/one-true-awk/b.c +++ b/contrib/one-true-awk/b.c @@ -614,22 +614,7 @@ int pmatch(fa *f, const char *p0) /* longest match, for sub */ } nextin: s = 2; -#if 0 /* XXX */ - if (f->reset) { - for (i = 2; i <= f->curstat; i++) -n xfree(f->posns[i]); - k = *f->posns[0]; - if ((f->posns[2] = (int *) calloc(k+1, sizeof(int))) == NULL) - overflo("out of space in pmatch"); - for (i = 0; i <= k; i++) - (f->posns[2])[i] = (f->posns[0])[i]; - f->initstat = f->curstat = 2; - f->out[2] = f->out[0]; - for (i = 0; i < NCHARS; i++) - f->gototab[2][i] = 0; - } -#endif - } while (*p++ != 0); + } while (*p++); return (0); } @@ -670,21 +655,6 @@ int nematch(fa *f, const char *p0) /* non-empty match, for sub */ } nnextin: s = 2; -#if 0 /* XXX */ - if (f->reset) { - for (i = 2; i <= f->curstat; i++) - xfree(f->posns[i]); - k = *f->posns[0]; - if ((f->posns[2] = (int *) calloc(k+1, sizeof(int))) == NULL) - overflo("out of state space"); - for (i = 0; i <= k; i++) - (f->posns[2])[i] = (f->posns[0])[i]; - f->initstat = f->curstat = 2; - f->out[2] = f->out[0]; - for (i = 0; i < NCHARS; i++) - f->gototab[2][i] = 0; - } -#endif p++; } return (0); From owner-dev-commits-src-all@freebsd.org Fri Jul 30 23:34: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 090AB66F9B3; Fri, 30 Jul 2021 23:34: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 4Gc3dQ5dSSz4R41; Fri, 30 Jul 2021 23:34: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 A65AD6192; Fri, 30 Jul 2021 23:34: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 16UNYIjU084275; Fri, 30 Jul 2021 23:34:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16UNYIht084274; Fri, 30 Jul 2021 23:34:18 GMT (envelope-from git) Date: Fri, 30 Jul 2021 23:34:18 GMT Message-Id: <202107302334.16UNYIht084274@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: 5193261c3631 - stable/13 - awk: Remove last markings we have on awk 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: 5193261c3631cca7accbff77d66cd38572d491b6 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, 30 Jul 2021 23:34:19 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=5193261c3631cca7accbff77d66cd38572d491b6 commit 5193261c3631cca7accbff77d66cd38572d491b6 Author: Warner Losh AuthorDate: 2021-07-22 02:24:57 +0000 Commit: Warner Losh CommitDate: 2021-07-30 23:02:13 +0000 awk: Remove last markings we have on awk We normally don't add $FreeBSD$ to contrib software. However, these changes date back to the CVS era of source code management and have been overlooked. Now that all these files are back to the same as the upstream bsd-features branch, remove the FreeBSD specific changes, which are now just $FreeBSD$ and the (FreeBSD) in the version string. MFC After: 2 weeks Sponsored by: Netflix (cherry picked from commit 5ab82b00cca74feb9d047e9c8aa29e5118810edc) --- contrib/one-true-awk/b.c | 3 --- contrib/one-true-awk/main.c | 4 +--- contrib/one-true-awk/run.c | 3 --- 3 files changed, 1 insertion(+), 9 deletions(-) diff --git a/contrib/one-true-awk/b.c b/contrib/one-true-awk/b.c index 01119470de05..f889ee57b3fb 100644 --- a/contrib/one-true-awk/b.c +++ b/contrib/one-true-awk/b.c @@ -24,9 +24,6 @@ THIS SOFTWARE. /* lasciate ogne speranza, voi ch'intrate. */ -#include -__FBSDID("$FreeBSD$"); - #define DEBUG #include diff --git a/contrib/one-true-awk/main.c b/contrib/one-true-awk/main.c index 95eeba00d9ca..f3936341ae75 100644 --- a/contrib/one-true-awk/main.c +++ b/contrib/one-true-awk/main.c @@ -22,9 +22,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ****************************************************************/ -#include -__FBSDID("$FreeBSD$"); -const char *version = "version 20210215 (FreeBSD)"; +const char *version = "version 20210215"; #define DEBUG #include diff --git a/contrib/one-true-awk/run.c b/contrib/one-true-awk/run.c index 3342eb274e3a..117fb0748bd8 100644 --- a/contrib/one-true-awk/run.c +++ b/contrib/one-true-awk/run.c @@ -22,9 +22,6 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ****************************************************************/ -#include -__FBSDID("$FreeBSD$"); - #define DEBUG #include #include From owner-dev-commits-src-all@freebsd.org Fri Jul 30 23:34: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 9C76566FD1C; Fri, 30 Jul 2021 23:34: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 4Gc3dR6vbXz4R1v; Fri, 30 Jul 2021 23:34: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 CCEC65DD0; Fri, 30 Jul 2021 23:34: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 16UNYJmS084299; Fri, 30 Jul 2021 23:34:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16UNYJU7084298; Fri, 30 Jul 2021 23:34:19 GMT (envelope-from git) Date: Fri, 30 Jul 2021 23:34:19 GMT Message-Id: <202107302334.16UNYJU7084298@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: f4ed53c6f525 - stable/13 - awk: Make -F '' and -v FS="" behave the same 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: f4ed53c6f5254edcc28c34cbe67d698bd93cb05e 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, 30 Jul 2021 23:34:20 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=f4ed53c6f5254edcc28c34cbe67d698bd93cb05e commit f4ed53c6f5254edcc28c34cbe67d698bd93cb05e Author: Warner Losh AuthorDate: 2021-07-20 04:47:30 +0000 Commit: Warner Losh CommitDate: 2021-07-30 23:02:13 +0000 awk: Make -F '' and -v FS="" behave the same IEEE Std 1003.1-2008 mandates that -F str be treated the same as -v FS=str. For a null string, this was not the case. Since awk(1) documents that a null string for FS has a specific behavior, make -F '' behave consistently with -v FS="". PR: 241441 Upstream issue: https://github.com/onetrueawk/awk/issues/127 Upstream pull request: https://github.com/onetrueawk/awk/pull/128 MFC After: 2 weeks Sponsored by: Netflix (cherry picked from commit a2e3e1187309f9404940b61ca49a93bd0536559d) --- contrib/one-true-awk/main.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/contrib/one-true-awk/main.c b/contrib/one-true-awk/main.c index f3936341ae75..4e68bfb46d27 100644 --- a/contrib/one-true-awk/main.c +++ b/contrib/one-true-awk/main.c @@ -91,9 +91,7 @@ setfs(char *p) /* wart: t=>\t */ if (p[0] == 't' && p[1] == '\0') return "\t"; - else if (p[0] != '\0') - return p; - return NULL; + return p; } static char * @@ -169,8 +167,6 @@ int main(int argc, char *argv[]) break; case 'F': /* set field separator */ fs = setfs(getarg(&argc, &argv, "no field separator")); - if (fs == NULL) - WARNING("field separator FS is empty"); break; case 'v': /* -v a=1 to be done NOW. one -v for each */ vn = getarg(&argc, &argv, "no variable name"); From owner-dev-commits-src-all@freebsd.org Fri Jul 30 23:34: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 8EE0E66F9B7; Fri, 30 Jul 2021 23:34: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 4Gc3dV2JLhz4QqJ; Fri, 30 Jul 2021 23:34: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 1A194612E; Fri, 30 Jul 2021 23:34: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 16UNYMCR084347; Fri, 30 Jul 2021 23:34:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16UNYM7c084346; Fri, 30 Jul 2021 23:34:22 GMT (envelope-from git) Date: Fri, 30 Jul 2021 23:34:22 GMT Message-Id: <202107302334.16UNYM7c084346@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: d2d322b0123e - stable/13 - Fix the pattern for changing PermitRootLogin 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: d2d322b0123e7654529c800664861b836de0daf2 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, 30 Jul 2021 23:34:23 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=d2d322b0123e7654529c800664861b836de0daf2 commit d2d322b0123e7654529c800664861b836de0daf2 Author: Jose Luis Duran AuthorDate: 2021-07-16 17:11:47 +0000 Commit: Warner Losh CommitDate: 2021-07-30 23:02:13 +0000 Fix the pattern for changing PermitRootLogin The previous pattern had the (harmless) side-effect of duplicating the entry in the config file. No functional change intended. Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/510 (cherry picked from commit 73358cd2cfccf9aafde069ffcb8185a0f3420ffd) --- tools/tools/nanobsd/defaults.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/tools/nanobsd/defaults.sh b/tools/tools/nanobsd/defaults.sh index 77c0e216ec80..45d9fe44c650 100755 --- a/tools/tools/nanobsd/defaults.sh +++ b/tools/tools/nanobsd/defaults.sh @@ -728,7 +728,7 @@ cust_comconsole ( ) ( # Allow root login via ssh cust_allow_ssh_root ( ) ( - sed -i "" -e '/PermitRootLogin/s/.*/PermitRootLogin yes/' \ + sed -i "" -E 's/^#?PermitRootLogin.*/PermitRootLogin yes/' \ ${NANO_WORLDDIR}/etc/ssh/sshd_config ) From owner-dev-commits-src-all@freebsd.org Fri Jul 30 23:34: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 5E56666F7CC; Fri, 30 Jul 2021 23:34: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 4Gc3dT1SlSz4R4C; Fri, 30 Jul 2021 23:34: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 ED4BB6302; Fri, 30 Jul 2021 23:34: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 16UNYKSl084323; Fri, 30 Jul 2021 23:34:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16UNYKwK084322; Fri, 30 Jul 2021 23:34:20 GMT (envelope-from git) Date: Fri, 30 Jul 2021 23:34:20 GMT Message-Id: <202107302334.16UNYKwK084322@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: 2cbf9eff2d97 - stable/13 - nanobsd: fix typo in NANO_WORLDDIR 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: 2cbf9eff2d97a8e87f55928f6dbd8bcb1799e98d 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, 30 Jul 2021 23:34:21 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=2cbf9eff2d97a8e87f55928f6dbd8bcb1799e98d commit 2cbf9eff2d97a8e87f55928f6dbd8bcb1799e98d Author: Yann Kerherve AuthorDate: 2021-07-20 17:10:28 +0000 Commit: Warner Losh CommitDate: 2021-07-30 23:02:13 +0000 nanobsd: fix typo in NANO_WORLDDIR Reviewed by: imp PR: 257299 (cherry picked from commit 5a9e5a5111af59dbc96383fcd73129e31648e017) --- tools/tools/nanobsd/embedded/common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/tools/nanobsd/embedded/common b/tools/tools/nanobsd/embedded/common index 013495997554..7186aa5ba4b5 100644 --- a/tools/tools/nanobsd/embedded/common +++ b/tools/tools/nanobsd/embedded/common @@ -297,7 +297,7 @@ create_diskimage_mbr ( ) ( # and p5 is alt-root (after resize) mkimg -a 2 ${fmtarg} ${bootmbr} -s gpt \ -p efi:=${NANO_WORLDDIR}/boot/efiboot.img \ - -p freebsd-boot:=${NAANO_WORLDDIR}/boot/gptboot \ + -p freebsd-boot:=${NANO_WORLDDIR}/boot/gptboot \ -p ${p3}:=${NANO_LOG}/_.p3 \ -p ${p4}:=${NANO_LOG}/_.p4 \ -o ${out} From owner-dev-commits-src-all@freebsd.org Fri Jul 30 23:34: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 E182666FD11; Fri, 30 Jul 2021 23:34: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 4Gc3dP52PKz4R5n; Fri, 30 Jul 2021 23:34: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 91650612D; Fri, 30 Jul 2021 23:34: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 16UNYHV5084244; Fri, 30 Jul 2021 23:34:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16UNYHmV084243; Fri, 30 Jul 2021 23:34:17 GMT (envelope-from git) Date: Fri, 30 Jul 2021 23:34:17 GMT Message-Id: <202107302334.16UNYHmV084243@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: da30af61b5af - stable/13 - awk: revert to upstream behavior for ranges for gawk compatibility 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: da30af61b5af3353a0e2156fc027dd2fe38cc753 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, 30 Jul 2021 23:34:18 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=da30af61b5af3353a0e2156fc027dd2fe38cc753 commit da30af61b5af3353a0e2156fc027dd2fe38cc753 Author: Warner Losh AuthorDate: 2021-07-22 02:22:43 +0000 Commit: Warner Losh CommitDate: 2021-07-30 23:02:12 +0000 awk: revert to upstream behavior for ranges for gawk compatibility In 2005, FreeBSD changed one-true-awk to honor the locale's collating order. This was billed as a temporary patch. It was also compatible with the then-current behavior of gawk. That temporary patch has lasted 16 years now. However, IEEE Std 1003.1-2008 changed the behaivor of ranges in regular expressions outside of the "C" and "POSIX" locales to be undefined. Starting in 2011, gawk 4.0 stopped using the locale for the range regular expressions and used the traditional behavior only. The maintainer had grown weary of answering why '[A-Z]' would sometimes match lower-case expressions. The details about are explained here: https://www.gnu.org/software/gawk/manual/html_node/Ranges-and-Locales.html To restore compatibility with other implementaitons of awk, revert this patch. FreeBSD is the odd-system out. It also has the nice side effect of eliminating the last of our differences with upstream one-true-awk. Reviewed by: cy, rgrimes MFC After: 2 weeks Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D31114 (cherry picked from commit 628bd30ab5a492839b84dbf2aaf25848dae3866a) --- contrib/one-true-awk/b.c | 22 ++++------------------ contrib/one-true-awk/main.c | 1 - contrib/one-true-awk/run.c | 2 +- 3 files changed, 5 insertions(+), 20 deletions(-) diff --git a/contrib/one-true-awk/b.c b/contrib/one-true-awk/b.c index dd64f09647b0..01119470de05 100644 --- a/contrib/one-true-awk/b.c +++ b/contrib/one-true-awk/b.c @@ -361,20 +361,9 @@ int quoted(const uschar **pp) /* pick up next thing after a \\ */ return c; } -static int collate_range_cmp(int a, int b) -{ - static char s[2][2]; - - if ((uschar)a == (uschar)b) - return 0; - s[0][0] = a; - s[1][0] = b; - return (strcoll(s[0], s[1])); -} - char *cclenter(const char *argp) /* add a character class */ { - int i, c, c2, j; + int i, c, c2; const uschar *op, *p = (const uschar *) argp; uschar *bp; static uschar *buf = NULL; @@ -393,18 +382,15 @@ char *cclenter(const char *argp) /* add a character class */ c2 = *p++; if (c2 == '\\') c2 = quoted(&p); - if (collate_range_cmp(c, c2) > 0) { + if (c > c2) { /* empty; ignore */ bp--; i--; continue; } - for (j = 0; j < NCHARS; j++) { - if ((collate_range_cmp(c, j) > 0) || - collate_range_cmp(j, c2) > 0) - continue; + while (c < c2) { if (!adjbuf((char **) &buf, &bufsz, bp-buf+2, 100, (char **) &bp, "cclenter1")) FATAL("out of space for character class [%.10s...] 2", p); - *bp++ = j; + *bp++ = ++c; i++; } continue; diff --git a/contrib/one-true-awk/main.c b/contrib/one-true-awk/main.c index cfe3fafaf7fe..95eeba00d9ca 100644 --- a/contrib/one-true-awk/main.c +++ b/contrib/one-true-awk/main.c @@ -117,7 +117,6 @@ int main(int argc, char *argv[]) char *fn, *vn; setlocale(LC_CTYPE, ""); - setlocale(LC_COLLATE, ""); setlocale(LC_NUMERIC, "C"); /* for parsing cmdline & prog */ cmdname = argv[0]; if (argc == 1) { diff --git a/contrib/one-true-awk/run.c b/contrib/one-true-awk/run.c index 9752cd773630..3342eb274e3a 100644 --- a/contrib/one-true-awk/run.c +++ b/contrib/one-true-awk/run.c @@ -665,7 +665,7 @@ Cell *relop(Node **a, int n) /* a[0 < a[1], etc. */ j = x->fval - y->fval; i = j<0? -1: (j>0? 1: 0); } else { - i = strcoll(getsval(x), getsval(y)); + i = strcmp(getsval(x), getsval(y)); } tempfree(x); tempfree(y); From owner-dev-commits-src-all@freebsd.org Fri Jul 30 23:34: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 88C5066F5F8; Fri, 30 Jul 2021 23:34: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 4Gc3dW2xk5z4QtP; Fri, 30 Jul 2021 23:34: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 40AB662F1; Fri, 30 Jul 2021 23:34: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 16UNYNQo084371; Fri, 30 Jul 2021 23:34:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16UNYNXG084370; Fri, 30 Jul 2021 23:34:23 GMT (envelope-from git) Date: Fri, 30 Jul 2021 23:34:23 GMT Message-Id: <202107302334.16UNYNXG084370@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: b96680d9ca08 - stable/13 - RELNOTES: add notes about awk updates 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: b96680d9ca08c1001868778ff9764b93e20f59be 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, 30 Jul 2021 23:34:23 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=b96680d9ca08c1001868778ff9764b93e20f59be commit b96680d9ca08c1001868778ff9764b93e20f59be Author: Warner Losh AuthorDate: 2021-07-30 23:04:53 +0000 Commit: Warner Losh CommitDate: 2021-07-30 23:04:53 +0000 RELNOTES: add notes about awk updates Direct commit to stable/13 to note user-visible changes in the awk update. Sponsored by: Netflix --- RELNOTES | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/RELNOTES b/RELNOTES index 1e8c23f98703..376615308ada 100644 --- a/RELNOTES +++ b/RELNOTES @@ -10,6 +10,20 @@ newline. Entries should be separated by a newline. Changes to this file should not be MFCed. +various: + One True Awk has been updated to the latest from upstream + (20210215). All the FreeBSD patches, but one, have now been + either up streamed or discarded. Notable changes include: + o Locale is no longer used for ranges + o Various bugs fixed + o Better compatibility with gawk and mawk + + The one FreeBSD change, likely to be removed in FreeBSD 14, is that + we still allow hex numbers, prefixed with 0x, to be parsed and + interpreted as hex numbers while all other awks (including one + true awk now) interpret them as 0 in line with awk's historic + behavior. + 8a04edfdcbd2: Change the default minor version used for an NFSv4 mount to the highest minor version supported by the NFSv4 server. From owner-dev-commits-src-all@freebsd.org Sat Jul 31 00:03: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 DA882650549; Sat, 31 Jul 2021 00:03: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 4Gc4HV5Ztlz4SmM; Sat, 31 Jul 2021 00:03: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 A7B2C689A; Sat, 31 Jul 2021 00:03: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 16V03ojj024496; Sat, 31 Jul 2021 00:03:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V03o1o024495; Sat, 31 Jul 2021 00:03:50 GMT (envelope-from git) Date: Sat, 31 Jul 2021 00:03:50 GMT Message-Id: <202107310003.16V03o1o024495@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: 7b797ba27a71 - main - time.h: reduce CLOCK_ namespace pollution, move to _clock_id.h 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: 7b797ba27a714594dac910035d857e653d566b19 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, 31 Jul 2021 00:03:50 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=7b797ba27a714594dac910035d857e653d566b19 commit 7b797ba27a714594dac910035d857e653d566b19 Author: Warner Losh AuthorDate: 2021-07-30 23:10:56 +0000 Commit: Warner Losh CommitDate: 2021-07-30 23:20:22 +0000 time.h: reduce CLOCK_ namespace pollution, move to _clock_id.h Attempt to comply with the strict namespace pollution requirements of _POSIX_C_SOURCE. Add guards to limit visitbility of CLOCK_ and TIMER_ defines as appropriate. Only define the CLOCK_ variables relevant to the specific standards. Move all the sharing to sys/_clock_id.h and make time.h and sys/time.h both include that rather than copy due to the now large number of clocks and compat defines. Please note: The old time.h previously used these newer dates: CLOCK_REALTIME 199506 CLOCK_MONOTONIC 200112 CLOCK_THREAD_CPUTIME_ID 200112 CLOCK_PROCESS_CPUTIME_ID 200112 but glibc defines all of these for 199309. glibc uses this date for all these values, however, only CLOCK_REALTIME was in IEEE 1003.1b. Add a comment about this to document it. A large number of programs and libraries assume that these will be defined for _POSIX_C_SOURCE = 199309. In addition, leak CLOCK_UPTIME_FAST for the pocl package until it can be updated to use a simple CLOCK_MONOTONIC. Reviewed by: kib Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D31056 --- include/time.h | 30 +---------------- sys/sys/_clock_id.h | 95 +++++++++++++++++++++++++++++++++++++++++++++++++++++ sys/sys/time.h | 28 +--------------- 3 files changed, 97 insertions(+), 56 deletions(-) diff --git a/include/time.h b/include/time.h index 2a9bcb6a1107..a64a331ee52e 100644 --- a/include/time.h +++ b/include/time.h @@ -46,6 +46,7 @@ #include #include #include +#include #if __POSIX_VISIBLE > 0 && __POSIX_VISIBLE < 200112 || __BSD_VISIBLE /* @@ -97,35 +98,6 @@ typedef __pid_t pid_t; #endif #endif -/* These macros are also in sys/time.h. */ -#if !defined(CLOCK_REALTIME) && __POSIX_VISIBLE >= 199506 -#define CLOCK_REALTIME 0 -#endif /* !defined(CLOCK_REALTIME) && __POSIX_VISIBLE >= 199506 */ -#if !defined(CLOCK_VIRTUAL) && __BSD_VISIBLE -#define CLOCK_VIRTUAL 1 -#define CLOCK_PROF 2 -#endif /* !defined(CLOCK_VIRTUAL) && __BSD_VISIBLE */ -#if !defined(CLOCK_MONOTONIC) && __POSIX_VISIBLE >= 200112 -#define CLOCK_MONOTONIC 4 -#define CLOCK_UPTIME 5 /* FreeBSD-specific. */ -#define CLOCK_UPTIME_PRECISE 7 /* FreeBSD-specific. */ -#define CLOCK_UPTIME_FAST 8 /* FreeBSD-specific. */ -#define CLOCK_REALTIME_PRECISE 9 /* FreeBSD-specific. */ -#define CLOCK_REALTIME_FAST 10 /* FreeBSD-specific. */ -#define CLOCK_MONOTONIC_PRECISE 11 /* FreeBSD-specific. */ -#define CLOCK_MONOTONIC_FAST 12 /* FreeBSD-specific. */ -#define CLOCK_SECOND 13 /* FreeBSD-specific. */ -#define CLOCK_THREAD_CPUTIME_ID 14 -#define CLOCK_PROCESS_CPUTIME_ID 15 -#endif /* !defined(CLOCK_MONOTONIC) && __POSIX_VISIBLE >= 200112 */ - -#if __BSD_VISIBLE -#define TIMER_RELTIME 0x0 /* relative timer */ -#endif -#if !defined(TIMER_ABSTIME) && __POSIX_VISIBLE >= 199506 -#define TIMER_ABSTIME 0x1 /* absolute timer */ -#endif /* !defined(TIMER_ABSTIME) && __POSIX_VISIBLE >= 199506 */ - struct tm { int tm_sec; /* seconds after the minute [0-60] */ int tm_min; /* minutes after the hour [0-59] */ diff --git a/sys/sys/_clock_id.h b/sys/sys/_clock_id.h new file mode 100644 index 000000000000..f0a25ce0f3f1 --- /dev/null +++ b/sys/sys/_clock_id.h @@ -0,0 +1,95 @@ +/*- + * SPDX-License-Identifier: BSD-3-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. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the 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 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS 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. + * + * @(#)time.h 8.3 (Berkeley) 1/21/94 + */ + +#ifndef _SYS_SYS__CLOCK_ID_H +#define _SYS_SYS__CLOCK_ID_H + +/* + * These macros are shared between time.h and sys/time.h. + */ + +/* + * Note: The values shown below as a comment for the __POSIX_VISIBLE values are + * the ones FreeBSD traditionally used based on our reading of the POSIX + * standards. However, glibc uses 199309 for all of them, even those many were + * not defined there. To remain bug compatible with glibc means more software + * that relied on the glibc behavior will compile easily on FreeBSD. + * + * Also, CLOCK_UPTIME_FAST is improperly visible temporarily for the lang/pocl + * port until it can be updated properly. It incorrectly assumes that this was a + * standard value. It will be moved back to the __BSD_VISIBLE section once the + * issue is corrected. + */ + +#if __POSIX_VISIBLE >= 199309 /* 199506 */ +#define CLOCK_REALTIME 0 +#endif /* __POSIX_VISIBLE >= 199309 */ +#ifdef __BSD_VISIBLE +#define CLOCK_VIRTUAL 1 +#define CLOCK_PROF 2 +#endif /* __BSD_VISIBLE */ +#if __POSIX_VISIBLE >= 199309 /* 200112 */ +#define CLOCK_MONOTONIC 4 +#define CLOCK_UPTIME_FAST 8 +#endif /* __POSIX_VISIBLE >= 199309 */ +#ifdef __BSD_VISIBLE +/* + * FreeBSD-specific clocks. + */ +#define CLOCK_UPTIME 5 +#define CLOCK_UPTIME_PRECISE 7 +#define CLOCK_REALTIME_PRECISE 9 +#define CLOCK_REALTIME_FAST 10 +#define CLOCK_MONOTONIC_PRECISE 11 +#define CLOCK_MONOTONIC_FAST 12 +#define CLOCK_SECOND 13 +#endif /* __BSD_VISIBLE */ + +#if __POSIX_VISIBLE >= 199309 /* 200112 */ +#define CLOCK_THREAD_CPUTIME_ID 14 +#define CLOCK_PROCESS_CPUTIME_ID 15 +#endif /* __POSIX_VISIBLE >= 199309 */ + +#if __BSD_VISIBLE +#define TIMER_RELTIME 0x0 /* relative timer */ +#endif +#if __POSIX_VISIBLE >= 199309 +#define TIMER_ABSTIME 0x1 /* absolute timer */ +#endif /* __POSIX_VISIBLE >= 199309 */ + +#endif /* _SYS_SYS__CLOCK_ID_H */ diff --git a/sys/sys/time.h b/sys/sys/time.h index a48aa3fe5548..866a9e788cd0 100644 --- a/sys/sys/time.h +++ b/sys/sys/time.h @@ -38,6 +38,7 @@ #include #include #include +#include struct timezone { int tz_minuteswest; /* minutes west of Greenwich */ @@ -471,33 +472,6 @@ struct clockinfo { int profhz; /* profiling clock frequency */ }; -/* These macros are also in time.h. */ -#ifndef CLOCK_REALTIME -#define CLOCK_REALTIME 0 -#endif -#ifndef CLOCK_VIRTUAL -#define CLOCK_VIRTUAL 1 -#define CLOCK_PROF 2 -#endif -#ifndef CLOCK_MONOTONIC -#define CLOCK_MONOTONIC 4 -#define CLOCK_UPTIME 5 /* FreeBSD-specific. */ -#define CLOCK_UPTIME_PRECISE 7 /* FreeBSD-specific. */ -#define CLOCK_UPTIME_FAST 8 /* FreeBSD-specific. */ -#define CLOCK_REALTIME_PRECISE 9 /* FreeBSD-specific. */ -#define CLOCK_REALTIME_FAST 10 /* FreeBSD-specific. */ -#define CLOCK_MONOTONIC_PRECISE 11 /* FreeBSD-specific. */ -#define CLOCK_MONOTONIC_FAST 12 /* FreeBSD-specific. */ -#define CLOCK_SECOND 13 /* FreeBSD-specific. */ -#define CLOCK_THREAD_CPUTIME_ID 14 -#define CLOCK_PROCESS_CPUTIME_ID 15 -#endif - -#ifndef TIMER_ABSTIME -#define TIMER_RELTIME 0x0 /* relative timer */ -#define TIMER_ABSTIME 0x1 /* absolute timer */ -#endif - #if __BSD_VISIBLE #define CPUCLOCK_WHICH_PID 0 #define CPUCLOCK_WHICH_TID 1 From owner-dev-commits-src-all@freebsd.org Sat Jul 31 00:03: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 25516650934; Sat, 31 Jul 2021 00:03: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 4Gc4HW72zzz4Sbv; Sat, 31 Jul 2021 00:03: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 D333A6821; Sat, 31 Jul 2021 00:03: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 16V03pOC024520; Sat, 31 Jul 2021 00:03:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V03pAc024519; Sat, 31 Jul 2021 00:03:51 GMT (envelope-from git) Date: Sat, 31 Jul 2021 00:03:51 GMT Message-Id: <202107310003.16V03pAc024519@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: 155f15118a77 - main - clock_gettime: Add Linux aliases for CLOCK_* 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: 155f15118a77d2aeab7b177ada78c848778d7d80 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, 31 Jul 2021 00:03:52 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=155f15118a77d2aeab7b177ada78c848778d7d80 commit 155f15118a77d2aeab7b177ada78c848778d7d80 Author: Warner Losh AuthorDate: 2021-07-30 23:11:43 +0000 Commit: Warner Losh CommitDate: 2021-07-30 23:20:22 +0000 clock_gettime: Add Linux aliases for CLOCK_* Linux standardized what we call CLOCK_{REALTIME,MONOTONIC}_FAST as CLOCK_{REALTIME,MONOTONIC}_COARSE. In addition, Linux spells CLOCK_UPTIME as CLOCK_BOOTTIME. Add aliases to time.h and document these new aliases in clock_gettime(2). Reviewed by: vangyzen, kib (prior), dchagin (prior) Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D30988 --- lib/libc/sys/clock_gettime.2 | 15 ++++++++++++++- sys/sys/_clock_id.h | 9 +++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/lib/libc/sys/clock_gettime.2 b/lib/libc/sys/clock_gettime.2 index 4552819ea902..d620ed0f03f2 100644 --- a/lib/libc/sys/clock_gettime.2 +++ b/lib/libc/sys/clock_gettime.2 @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 13, 2021 +.Dd July 1, 2021 .Dt CLOCK_GETTIME 2 .Os .Sh NAME @@ -68,14 +68,17 @@ as well as the following values: .It Dv CLOCK_REALTIME .It Dv CLOCK_REALTIME_PRECISE .It Dv CLOCK_REALTIME_FAST +.It Dv CLOCK_REALTIME_COARSE Increments as a wall clock should. .It Dv CLOCK_MONOTONIC .It Dv CLOCK_MONOTONIC_PRECISE .It Dv CLOCK_MONOTONIC_FAST +.It Dv CLOCK_MONOTONIC_COARSE Increments in SI seconds. .It Dv CLOCK_UPTIME .It Dv CLOCK_UPTIME_PRECISE .It Dv CLOCK_UPTIME_FAST +.It Dv CLOCK_BOOTTIME Starts at zero when the kernel boots and increments monotonically in SI seconds while the machine is running. .It Dv CLOCK_VIRTUAL @@ -104,6 +107,16 @@ Similarly, .Fa CLOCK_UPTIME_PRECISE are used to get the most exact value as possible, at the expense of execution time. +The clock IDs +.Fa CLOCK_REALTIME_COARSE , +.Fa CLOCK_MONOTONIC_COARSE +are aliases of corresponding IDs with _FAST suffix for compatibility with other +systems. +Finally, +.Dv CLOCK_BOOTTIME +is an alias for +.Dv CLOCK_UPTIME +for compatibility with other systems. .Pp The structure pointed to by .Fa tp diff --git a/sys/sys/_clock_id.h b/sys/sys/_clock_id.h index f0a25ce0f3f1..a88eb063122f 100644 --- a/sys/sys/_clock_id.h +++ b/sys/sys/_clock_id.h @@ -85,6 +85,15 @@ #define CLOCK_PROCESS_CPUTIME_ID 15 #endif /* __POSIX_VISIBLE >= 199309 */ +/* + * Linux compatible names. + */ +#if __BSD_VISIBLE +#define CLOCK_BOOTTIME CLOCK_UPTIME +#define CLOCK_REALTIME_COARSE CLOCK_REALTIME_FAST +#define CLOCK_MONOTONIC_COARSE CLOCK_MONOTONIC_FAST +#endif + #if __BSD_VISIBLE #define TIMER_RELTIME 0x0 /* relative timer */ #endif From owner-dev-commits-src-all@freebsd.org Sat Jul 31 00:11: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 D2327650C36 for ; Sat, 31 Jul 2021 00:11: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 4Gc4Rv5f8Zz4SvP; Sat, 31 Jul 2021 00:11: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 A95C661F7; Sat, 31 Jul 2021 00:11: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 16V0B71G033631; Sat, 31 Jul 2021 00:11:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V0B7sC033630; Sat, 31 Jul 2021 00:11:07 GMT (envelope-from git) Date: Sat, 31 Jul 2021 00:11:07 GMT Message-Id: <202107310011.16V0B7sC033630@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Jung-uk Kim Subject: git: ad291e8998ba - Create tag vendor/acpica/20210730 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/tags/vendor/acpica/20210730 X-Git-Reftype: annotated tag X-Git-Commit: ad291e8998ba5d64dd76b4cfcebb1f7f7c3d8cd9 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, 31 Jul 2021 00:11:07 -0000 The annotated tag vendor/acpica/20210730 has been created by jkim: URL: https://cgit.FreeBSD.org/src/tag/?h=vendor/acpica/20210730 tag vendor/acpica/20210730 Tagger: Jung-uk Kim TaggerDate: 2021-07-31 00:10:12 +0000 Tag ACPICA 20210730 commit 34cfdff1f386b2d7bf0a8ea873acf604753991e6 Author: Jung-uk Kim AuthorDate: 2021-07-31 00:05:50 +0000 Commit: Jung-uk Kim CommitDate: 2021-07-31 00:05:50 +0000 Import ACPICA 20210730 From owner-dev-commits-src-all@freebsd.org Sat Jul 31 00:11: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 D6C26650DC0 for ; Sat, 31 Jul 2021 00:11: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 4Gc4Rv5bBBz4T0Z; Sat, 31 Jul 2021 00:11: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 970656B31; Sat, 31 Jul 2021 00:11: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 16V0B7Tq033607; Sat, 31 Jul 2021 00:11:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V0B73R033606; Sat, 31 Jul 2021 00:11:07 GMT (envelope-from git) Date: Sat, 31 Jul 2021 00:11:07 GMT Message-Id: <202107310011.16V0B73R033606@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Jung-uk Kim Subject: git: 395770967c36..34cfdff1f386 - vendor/acpica - vendor branch updated 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/vendor/acpica X-Git-Reftype: branch X-Git-Commit: 34cfdff1f386b2d7bf0a8ea873acf604753991e6 X-Git-Oldrev: 395770967c3664ec744e63fa47acc19670d32f47 X-Git-Newrev: 34cfdff1f386b2d7bf0a8ea873acf604753991e6 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, 31 Jul 2021 00:11:07 -0000 The branch vendor/acpica has been updated by jkim: URL: https://cgit.FreeBSD.org/src/log/?id=395770967c36..34cfdff1f386 34cfdff1f386 Import ACPICA 20210730 From owner-dev-commits-src-all@freebsd.org Sat Jul 31 00:21: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 E642E650AE5; Sat, 31 Jul 2021 00:21: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 4Gc4gS67Zdz4VTM; Sat, 31 Jul 2021 00:21: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 BBDFF6C29; Sat, 31 Jul 2021 00:21: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 16V0L8cT047870; Sat, 31 Jul 2021 00:21:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V0L8Xw047869; Sat, 31 Jul 2021 00:21:08 GMT (envelope-from git) Date: Sat, 31 Jul 2021 00:21:08 GMT Message-Id: <202107310021.16V0L8Xw047869@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: b2577d0cbcb4 - stable/12 - awk: Reduce diffs with upstream to almost nothing. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: b2577d0cbcb43d6ffeaadb79bbaf60497198b6c4 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, 31 Jul 2021 00:21:09 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=b2577d0cbcb43d6ffeaadb79bbaf60497198b6c4 commit b2577d0cbcb43d6ffeaadb79bbaf60497198b6c4 Author: Warner Losh AuthorDate: 2021-07-09 03:51:24 +0000 Commit: Warner Losh CommitDate: 2021-07-31 00:02:50 +0000 awk: Reduce diffs with upstream to almost nothing. In the merge of 20210215, I left two merge conflicts #if 0'd by mistake to check later rather than resolve them as part of the merge. This code turns out to be from the original one-true-awk import and not FreeBSD specific, so remove them. Remove a extra definition of HAT. Remove a stylistic change that also appears to be a mismerge along the way. Remove FREEBSD-upgrade. Nobody has updated it since the original 2007 cvs import. It talks about old CVS branches that never made it into svn, let alone git. New imports will follow the standard practices now, so there's nothing left to document. Move README to README.md and copy the README.md from upstream over. This leaves just the $FreeBSD$ lines (which remain for the stable/12 merge) and the strcoll part of ru@'s r201989/d98dd8e5f94c as the only diffs with upstream. FreeBSD also still has its own man page, which I don't plan on changing. Once this commit is merged to stable/12, I plan no further merges to stable/12. Sometime after that I'll remove the $FreeBSD$ lines to reduce the diffs even more (though i want to make sure plans won't change first). I also plan to talk to upstream about this change... MFC After: 2 weeks Sponsored by: Netflix (cherry picked from commit f68a53dba933f9c1143863603f5a16fdbe5f070e) --- contrib/one-true-awk/FREEBSD-upgrade | 24 ------- contrib/one-true-awk/README | 94 --------------------------- contrib/one-true-awk/README.md | 119 +++++++++++++++++++++++++++++++++++ contrib/one-true-awk/awk.h | 2 - contrib/one-true-awk/b.c | 32 +--------- 5 files changed, 120 insertions(+), 151 deletions(-) diff --git a/contrib/one-true-awk/FREEBSD-upgrade b/contrib/one-true-awk/FREEBSD-upgrade deleted file mode 100644 index f0f70ab7b17b..000000000000 --- a/contrib/one-true-awk/FREEBSD-upgrade +++ /dev/null @@ -1,24 +0,0 @@ -# $FreeBSD$ - -Import of the 2005/04/24 version of the "one true awk", as described -in "The AWK Programming Language", by Al Aho, Brian Kernighan, and -Peter Weinberger (Addison-Wesley, 1988, ISBN 0-201-07981-X). - -Original sources were taken from the Brian Kernighan's AWK page -http://www.cs.princeton.edu/~bwk/btl.mirror -and include bug fixes up thru Oct 23, 2007. - -The following files were removed for this import: - - buildwin.bat - makefile.win - missing95.c - vcvars32.bat - ytab.c - ytab.h - ytabc.bak - ytabh.bak - -The vendor import was done by: - - cvs import src/contrib/one-true-awk BELL_LABS bwk_20071023 diff --git a/contrib/one-true-awk/README b/contrib/one-true-awk/README deleted file mode 100644 index 24aaf9092d58..000000000000 --- a/contrib/one-true-awk/README +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************** -Copyright (C) Lucent Technologies 1997 -All Rights Reserved - -Permission to use, copy, modify, and distribute this software and -its documentation for any purpose and without fee is hereby -granted, provided that the above copyright notice appear in all -copies and that both that the copyright notice and this -permission notice and warranty disclaimer appear in supporting -documentation, and that the name Lucent Technologies or any of -its entities not be used in advertising or publicity pertaining -to distribution of the software without specific, written prior -permission. - -LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. -IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY -SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER -IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF -THIS SOFTWARE. -****************************************************************/ - -This is the version of awk described in "The AWK Programming Language", -by Al Aho, Brian Kernighan, and Peter Weinberger -(Addison-Wesley, 1988, ISBN 0-201-07981-X). - -Changes, mostly bug fixes and occasional enhancements, are listed -in FIXES. If you distribute this code further, please please please -distribute FIXES with it. If you find errors, please report them -to bwk@cs.princeton.edu. Thanks. - -The program itself is created by - make -which should produce a sequence of messages roughly like this: - - yacc -d awkgram.y - -conflicts: 43 shift/reduce, 85 reduce/reduce - mv y.tab.c ytab.c - mv y.tab.h ytab.h - cc -c ytab.c - cc -c b.c - cc -c main.c - cc -c parse.c - cc maketab.c -o maketab - ./maketab >proctab.c - cc -c proctab.c - cc -c tran.c - cc -c lib.c - cc -c run.c - cc -c lex.c - cc ytab.o b.o main.o parse.o proctab.o tran.o lib.o run.o lex.o -lm - -This produces an executable a.out; you will eventually want to -move this to some place like /usr/bin/awk. - -If your system does not have yacc or bison (the GNU -equivalent), you must compile the pieces manually. We have -included yacc output in ytab.c and ytab.h, and backup copies in -case you overwrite them. We have also included a copy of -proctab.c so you do not need to run maketab. - -NOTE: This version uses ANSI C, as you should also. We have -compiled this without any changes using gcc -Wall and/or local C -compilers on a variety of systems, but new systems or compilers -may raise some new complaint; reports of difficulties are -welcome. - -This also compiles with Visual C++ on all flavors of Windows, -*if* you provide versions of popen and pclose. The file -missing95.c contains versions that can be used to get started -with, though the underlying support has mysterious properties, -the symptom of which can be truncated pipe output. Beware. The -file makefile.win gives hints on how to proceed; if you run -vcvars32.bat, it will set up necessary paths and parameters so -you can subsequently run nmake -f makefile.win. Beware also that -when running on Windows under command.com, various quoting -conventions are different from Unix systems: single quotes won't -work around arguments, and various characters like % are -interpreted within double quotes. - -This compiles without change on Macintosh OS X using gcc and -the standard developer tools. - -This is also said to compile on Macintosh OS 9 systems, using the -file "buildmac" provided by Dan Allen (danallen@microsoft.com), -to whom many thanks. - -The version of malloc that comes with some systems is sometimes -astonishly slow. If awk seems slow, you might try fixing that. -More generally, turning on optimization can significantly improve -awk's speed, perhaps by 1/3 for highest levels. diff --git a/contrib/one-true-awk/README.md b/contrib/one-true-awk/README.md new file mode 100644 index 000000000000..b8089b3a4803 --- /dev/null +++ b/contrib/one-true-awk/README.md @@ -0,0 +1,119 @@ +# The One True Awk + +This is the version of `awk` described in _The AWK Programming Language_, +by Al Aho, Brian Kernighan, and Peter Weinberger +(Addison-Wesley, 1988, ISBN 0-201-07981-X). + +## Copyright + +Copyright (C) Lucent Technologies 1997
+All Rights Reserved + +Permission to use, copy, modify, and distribute this software and +its documentation for any purpose and without fee is hereby +granted, provided that the above copyright notice appear in all +copies and that both that the copyright notice and this +permission notice and warranty disclaimer appear in supporting +documentation, and that the name Lucent Technologies or any of +its entities not be used in advertising or publicity pertaining +to distribution of the software without specific, written prior +permission. + +LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. +IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY +SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER +IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. + +## Distribution and Reporting Problems + +Changes, mostly bug fixes and occasional enhancements, are listed +in `FIXES`. If you distribute this code further, please please please +distribute `FIXES` with it. + +If you find errors, please report them +to bwk@cs.princeton.edu. +Please _also_ open an issue in the GitHub issue tracker, to make +it easy to track issues. +Thanks. + +## Submitting Pull Requests + +Pull requests are welcome. Some guidelines: + +* Please do not use functions or facilities that are not standard (e.g., +`strlcpy()`, `fpurge()`). + +* Please run the test suite and make sure that your changes pass before +posting the pull request. To do so: + + 1. Save the previous version of `awk` somewhere in your path. Call it `nawk` (for example). + 1. Run `oldawk=nawk make check > check.out 2>&1`. + 1. Search for `BAD` or `error` in the result. In general, look over it manually to make sure there are no errors. + +* Please create the pull request with a request +to merge into the `staging` branch instead of into the `master` branch. +This allows us to do testing, and to make any additional edits or changes +after the merge but before merging to `master`. + +## Building + +The program itself is created by + + make + +which should produce a sequence of messages roughly like this: + + yacc -d awkgram.y + conflicts: 43 shift/reduce, 85 reduce/reduce + mv y.tab.c ytab.c + mv y.tab.h ytab.h + cc -c ytab.c + cc -c b.c + cc -c main.c + cc -c parse.c + cc maketab.c -o maketab + ./maketab >proctab.c + cc -c proctab.c + cc -c tran.c + cc -c lib.c + cc -c run.c + cc -c lex.c + cc ytab.o b.o main.o parse.o proctab.o tran.o lib.o run.o lex.o -lm + +This produces an executable `a.out`; you will eventually want to +move this to some place like `/usr/bin/awk`. + +If your system does not have `yacc` or `bison` (the GNU +equivalent), you need to install one of them first. + +NOTE: This version uses ANSI C (C 99), as you should also. We have +compiled this without any changes using `gcc -Wall` and/or local C +compilers on a variety of systems, but new systems or compilers +may raise some new complaint; reports of difficulties are +welcome. + +This compiles without change on Macintosh OS X using `gcc` and +the standard developer tools. + +You can also use `make CC=g++` to build with the GNU C++ compiler, +should you choose to do so. + +The version of `malloc` that comes with some systems is sometimes +astonishly slow. If `awk` seems slow, you might try fixing that. +More generally, turning on optimization can significantly improve +`awk`'s speed, perhaps by 1/3 for highest levels. + +## A Note About Maintenance + +NOTICE! Maintenance of this program is on a ``best effort'' +basis. We try to get to issues and pull requests as quickly +as we can. Unfortunately, however, keeping this program going +is not at the top of our priority list. + +#### Last Updated + +Fri Dec 25 16:53:34 EST 2020 diff --git a/contrib/one-true-awk/awk.h b/contrib/one-true-awk/awk.h index 230eac41548c..51c00df9f279 100644 --- a/contrib/one-true-awk/awk.h +++ b/contrib/one-true-awk/awk.h @@ -237,8 +237,6 @@ extern int pairstack[], paircnt; /* watch out in match(), etc. */ #define HAT (NCHARS+2) /* matches ^ in regular expr */ #define NSTATES 32 -#define HAT (NCHARS+2) /* matches ^ in regular expr */ - /* NCHARS is 2**n */ typedef struct rrow { long ltype; /* long avoids pointer warnings on 64-bit */ diff --git a/contrib/one-true-awk/b.c b/contrib/one-true-awk/b.c index 20f4a8bee7f9..dd64f09647b0 100644 --- a/contrib/one-true-awk/b.c +++ b/contrib/one-true-awk/b.c @@ -614,22 +614,7 @@ int pmatch(fa *f, const char *p0) /* longest match, for sub */ } nextin: s = 2; -#if 0 /* XXX */ - if (f->reset) { - for (i = 2; i <= f->curstat; i++) -n xfree(f->posns[i]); - k = *f->posns[0]; - if ((f->posns[2] = (int *) calloc(k+1, sizeof(int))) == NULL) - overflo("out of space in pmatch"); - for (i = 0; i <= k; i++) - (f->posns[2])[i] = (f->posns[0])[i]; - f->initstat = f->curstat = 2; - f->out[2] = f->out[0]; - for (i = 0; i < NCHARS; i++) - f->gototab[2][i] = 0; - } -#endif - } while (*p++ != 0); + } while (*p++); return (0); } @@ -670,21 +655,6 @@ int nematch(fa *f, const char *p0) /* non-empty match, for sub */ } nnextin: s = 2; -#if 0 /* XXX */ - if (f->reset) { - for (i = 2; i <= f->curstat; i++) - xfree(f->posns[i]); - k = *f->posns[0]; - if ((f->posns[2] = (int *) calloc(k+1, sizeof(int))) == NULL) - overflo("out of state space"); - for (i = 0; i <= k; i++) - (f->posns[2])[i] = (f->posns[0])[i]; - f->initstat = f->curstat = 2; - f->out[2] = f->out[0]; - for (i = 0; i < NCHARS; i++) - f->gototab[2][i] = 0; - } -#endif p++; } return (0); From owner-dev-commits-src-all@freebsd.org Sat Jul 31 00:21: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 7FCE1651205; Sat, 31 Jul 2021 00:21: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 4Gc4gV2bXCz4VKy; Sat, 31 Jul 2021 00:21: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 E933B68F6; Sat, 31 Jul 2021 00:21: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 16V0L9bw047901; Sat, 31 Jul 2021 00:21:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V0L9En047900; Sat, 31 Jul 2021 00:21:09 GMT (envelope-from git) Date: Sat, 31 Jul 2021 00:21:09 GMT Message-Id: <202107310021.16V0L9En047900@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: c26dea4361ae - stable/12 - nanobsd: fix typo in NANO_WORLDDIR 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/12 X-Git-Reftype: branch X-Git-Commit: c26dea4361aebff81ac8b1a7e0fac362d94216fa 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, 31 Jul 2021 00:21:10 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=c26dea4361aebff81ac8b1a7e0fac362d94216fa commit c26dea4361aebff81ac8b1a7e0fac362d94216fa Author: Yann Kerherve AuthorDate: 2021-07-20 17:10:28 +0000 Commit: Warner Losh CommitDate: 2021-07-31 00:02:50 +0000 nanobsd: fix typo in NANO_WORLDDIR Reviewed by: imp PR: 257299 (cherry picked from commit 5a9e5a5111af59dbc96383fcd73129e31648e017) --- tools/tools/nanobsd/embedded/common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/tools/nanobsd/embedded/common b/tools/tools/nanobsd/embedded/common index 72461fff8062..47a13f4cd43e 100644 --- a/tools/tools/nanobsd/embedded/common +++ b/tools/tools/nanobsd/embedded/common @@ -311,7 +311,7 @@ create_diskimage_mbr ( ) ( # and p5 is alt-root (after resize) mkimg -a 2 ${fmtarg} ${bootmbr} -s gpt \ -p efi:=${NANO_WORLDDIR}/boot/boot1.efifat \ - -p freebsd-boot:=${NAANO_WORLDDIR}/boot/gptboot \ + -p freebsd-boot:=${NANO_WORLDDIR}/boot/gptboot \ -p ${p3}:=${NANO_LOG}/_.p3 \ -p ${p4}:=${NANO_LOG}/_.p4 \ -o ${out} From owner-dev-commits-src-all@freebsd.org Sat Jul 31 00:21: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 40C39651191; Sat, 31 Jul 2021 00:21: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 4Gc4gW15zNz4VWR; Sat, 31 Jul 2021 00:21: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 0B60C6C94; Sat, 31 Jul 2021 00:21: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 16V0LAEl047925; Sat, 31 Jul 2021 00:21:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V0LAhk047924; Sat, 31 Jul 2021 00:21:10 GMT (envelope-from git) Date: Sat, 31 Jul 2021 00:21:10 GMT Message-Id: <202107310021.16V0LAhk047924@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: 831859f8ee49 - stable/12 - type: becauce -> because 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/12 X-Git-Reftype: branch X-Git-Commit: 831859f8ee49ba994a20a91eb8146cc8d8be6969 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, 31 Jul 2021 00:21:11 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=831859f8ee49ba994a20a91eb8146cc8d8be6969 commit 831859f8ee49ba994a20a91eb8146cc8d8be6969 Author: Warner Losh AuthorDate: 2021-07-22 02:02:44 +0000 Commit: Warner Losh CommitDate: 2021-07-31 00:02:51 +0000 type: becauce -> because Noticed by: Piotr P. Stefaniak Sponsored by: Netflix (cherry picked from commit 2b720db8d409f6fcdffa7f06b1d8c1b981435a83) --- stand/i386/loader/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stand/i386/loader/Makefile b/stand/i386/loader/Makefile index 8fbea355d726..d332ea0530c7 100644 --- a/stand/i386/loader/Makefile +++ b/stand/i386/loader/Makefile @@ -81,7 +81,7 @@ FILESMODE_${LOADER}= ${BINMODE} -b # that pxeloader provides has none of that flexibility because it lacks access # to the a.out/elf headers and assumes an entry point of 0. # -# We must add it to the LDFLAGS instead of the OBJS becauce the former won't try +# We must add it to the LDFLAGS instead of the OBJS because the former won't try # to clean it. When it is in OBJS, this cleaning can lead to races where # btxcrt.o is rebuilt, but boot2 isn't, leading to errors at installation time. # LDFLAGS does not have this baggage and will be included first in the list of From owner-dev-commits-src-all@freebsd.org Sat Jul 31 00:21: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 85AB365119C; Sat, 31 Jul 2021 00:21: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 4Gc4gX2p6Lz4VQR; Sat, 31 Jul 2021 00:21: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 364346A58; Sat, 31 Jul 2021 00:21: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 16V0LC14047949; Sat, 31 Jul 2021 00:21:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V0LC5h047948; Sat, 31 Jul 2021 00:21:12 GMT (envelope-from git) Date: Sat, 31 Jul 2021 00:21:12 GMT Message-Id: <202107310021.16V0LC5h047948@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: a32cc696990e - stable/12 - awk: revert to upstream behavior for ranges for gawk compatibility 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/12 X-Git-Reftype: branch X-Git-Commit: a32cc696990ea7b21fe7005ec2b5637fa9e3a6e9 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, 31 Jul 2021 00:21:12 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=a32cc696990ea7b21fe7005ec2b5637fa9e3a6e9 commit a32cc696990ea7b21fe7005ec2b5637fa9e3a6e9 Author: Warner Losh AuthorDate: 2021-07-22 02:22:43 +0000 Commit: Warner Losh CommitDate: 2021-07-31 00:02:51 +0000 awk: revert to upstream behavior for ranges for gawk compatibility In 2005, FreeBSD changed one-true-awk to honor the locale's collating order. This was billed as a temporary patch. It was also compatible with the then-current behavior of gawk. That temporary patch has lasted 16 years now. However, IEEE Std 1003.1-2008 changed the behaivor of ranges in regular expressions outside of the "C" and "POSIX" locales to be undefined. Starting in 2011, gawk 4.0 stopped using the locale for the range regular expressions and used the traditional behavior only. The maintainer had grown weary of answering why '[A-Z]' would sometimes match lower-case expressions. The details about are explained here: https://www.gnu.org/software/gawk/manual/html_node/Ranges-and-Locales.html To restore compatibility with other implementaitons of awk, revert this patch. FreeBSD is the odd-system out. It also has the nice side effect of eliminating the last of our differences with upstream one-true-awk. Reviewed by: cy, rgrimes MFC After: 2 weeks Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D31114 (cherry picked from commit 628bd30ab5a492839b84dbf2aaf25848dae3866a) --- contrib/one-true-awk/b.c | 22 ++++------------------ contrib/one-true-awk/main.c | 1 - contrib/one-true-awk/run.c | 2 +- 3 files changed, 5 insertions(+), 20 deletions(-) diff --git a/contrib/one-true-awk/b.c b/contrib/one-true-awk/b.c index dd64f09647b0..01119470de05 100644 --- a/contrib/one-true-awk/b.c +++ b/contrib/one-true-awk/b.c @@ -361,20 +361,9 @@ int quoted(const uschar **pp) /* pick up next thing after a \\ */ return c; } -static int collate_range_cmp(int a, int b) -{ - static char s[2][2]; - - if ((uschar)a == (uschar)b) - return 0; - s[0][0] = a; - s[1][0] = b; - return (strcoll(s[0], s[1])); -} - char *cclenter(const char *argp) /* add a character class */ { - int i, c, c2, j; + int i, c, c2; const uschar *op, *p = (const uschar *) argp; uschar *bp; static uschar *buf = NULL; @@ -393,18 +382,15 @@ char *cclenter(const char *argp) /* add a character class */ c2 = *p++; if (c2 == '\\') c2 = quoted(&p); - if (collate_range_cmp(c, c2) > 0) { + if (c > c2) { /* empty; ignore */ bp--; i--; continue; } - for (j = 0; j < NCHARS; j++) { - if ((collate_range_cmp(c, j) > 0) || - collate_range_cmp(j, c2) > 0) - continue; + while (c < c2) { if (!adjbuf((char **) &buf, &bufsz, bp-buf+2, 100, (char **) &bp, "cclenter1")) FATAL("out of space for character class [%.10s...] 2", p); - *bp++ = j; + *bp++ = ++c; i++; } continue; diff --git a/contrib/one-true-awk/main.c b/contrib/one-true-awk/main.c index cfe3fafaf7fe..95eeba00d9ca 100644 --- a/contrib/one-true-awk/main.c +++ b/contrib/one-true-awk/main.c @@ -117,7 +117,6 @@ int main(int argc, char *argv[]) char *fn, *vn; setlocale(LC_CTYPE, ""); - setlocale(LC_COLLATE, ""); setlocale(LC_NUMERIC, "C"); /* for parsing cmdline & prog */ cmdname = argv[0]; if (argc == 1) { diff --git a/contrib/one-true-awk/run.c b/contrib/one-true-awk/run.c index 9752cd773630..3342eb274e3a 100644 --- a/contrib/one-true-awk/run.c +++ b/contrib/one-true-awk/run.c @@ -665,7 +665,7 @@ Cell *relop(Node **a, int n) /* a[0 < a[1], etc. */ j = x->fval - y->fval; i = j<0? -1: (j>0? 1: 0); } else { - i = strcoll(getsval(x), getsval(y)); + i = strcmp(getsval(x), getsval(y)); } tempfree(x); tempfree(y); From owner-dev-commits-src-all@freebsd.org Sat Jul 31 00:21: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 DFCC66512BE; Sat, 31 Jul 2021 00:21: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 4Gc4gZ4TJFz4Vgl; Sat, 31 Jul 2021 00:21: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 6976B6DC2; Sat, 31 Jul 2021 00:21: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 16V0LE0H048719; Sat, 31 Jul 2021 00:21:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V0LEuo048718; Sat, 31 Jul 2021 00:21:14 GMT (envelope-from git) Date: Sat, 31 Jul 2021 00:21:14 GMT Message-Id: <202107310021.16V0LEuo048718@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: ab1dedd49460 - stable/12 - awk: Make -F '' and -v FS="" behave the same 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/12 X-Git-Reftype: branch X-Git-Commit: ab1dedd4946098fe7202e825d299a2cbec81dae0 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, 31 Jul 2021 00:21:15 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=ab1dedd4946098fe7202e825d299a2cbec81dae0 commit ab1dedd4946098fe7202e825d299a2cbec81dae0 Author: Warner Losh AuthorDate: 2021-07-20 04:47:30 +0000 Commit: Warner Losh CommitDate: 2021-07-31 00:02:51 +0000 awk: Make -F '' and -v FS="" behave the same IEEE Std 1003.1-2008 mandates that -F str be treated the same as -v FS=str. For a null string, this was not the case. Since awk(1) documents that a null string for FS has a specific behavior, make -F '' behave consistently with -v FS="". PR: 241441 Upstream issue: https://github.com/onetrueawk/awk/issues/127 Upstream pull request: https://github.com/onetrueawk/awk/pull/128 MFC After: 2 weeks Sponsored by: Netflix (cherry picked from commit a2e3e1187309f9404940b61ca49a93bd0536559d) --- contrib/one-true-awk/main.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/contrib/one-true-awk/main.c b/contrib/one-true-awk/main.c index f3936341ae75..4e68bfb46d27 100644 --- a/contrib/one-true-awk/main.c +++ b/contrib/one-true-awk/main.c @@ -91,9 +91,7 @@ setfs(char *p) /* wart: t=>\t */ if (p[0] == 't' && p[1] == '\0') return "\t"; - else if (p[0] != '\0') - return p; - return NULL; + return p; } static char * @@ -169,8 +167,6 @@ int main(int argc, char *argv[]) break; case 'F': /* set field separator */ fs = setfs(getarg(&argc, &argv, "no field separator")); - if (fs == NULL) - WARNING("field separator FS is empty"); break; case 'v': /* -v a=1 to be done NOW. one -v for each */ vn = getarg(&argc, &argv, "no variable name"); From owner-dev-commits-src-all@freebsd.org Sat Jul 31 00:21: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 7666F650AFC; Sat, 31 Jul 2021 00:21: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 4Gc4gb5Qjdz4VX2; Sat, 31 Jul 2021 00:21: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 80A456BA8; Sat, 31 Jul 2021 00:21: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 16V0LFnW048747; Sat, 31 Jul 2021 00:21:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V0LF1v048746; Sat, 31 Jul 2021 00:21:15 GMT (envelope-from git) Date: Sat, 31 Jul 2021 00:21:15 GMT Message-Id: <202107310021.16V0LF1v048746@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: f8b424526bcc - stable/12 - Fix the pattern for changing PermitRootLogin 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/12 X-Git-Reftype: branch X-Git-Commit: f8b424526bcc259b1cd2b46a4612b55f1b598db3 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, 31 Jul 2021 00:21:16 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=f8b424526bcc259b1cd2b46a4612b55f1b598db3 commit f8b424526bcc259b1cd2b46a4612b55f1b598db3 Author: Jose Luis Duran AuthorDate: 2021-07-16 17:11:47 +0000 Commit: Warner Losh CommitDate: 2021-07-31 00:02:51 +0000 Fix the pattern for changing PermitRootLogin The previous pattern had the (harmless) side-effect of duplicating the entry in the config file. No functional change intended. Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/510 (cherry picked from commit 73358cd2cfccf9aafde069ffcb8185a0f3420ffd) --- tools/tools/nanobsd/defaults.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/tools/nanobsd/defaults.sh b/tools/tools/nanobsd/defaults.sh index cc75e3527bca..4e219531b0f1 100755 --- a/tools/tools/nanobsd/defaults.sh +++ b/tools/tools/nanobsd/defaults.sh @@ -731,7 +731,7 @@ cust_comconsole ( ) ( # Allow root login via ssh cust_allow_ssh_root ( ) ( - sed -i "" -e '/PermitRootLogin/s/.*/PermitRootLogin yes/' \ + sed -i "" -E 's/^#?PermitRootLogin.*/PermitRootLogin yes/' \ ${NANO_WORLDDIR}/etc/ssh/sshd_config ) From owner-dev-commits-src-all@freebsd.org Sat Jul 31 00:21: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 A2F1365131B; Sat, 31 Jul 2021 00:21: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 4Gc4gc60nXz4VQj; Sat, 31 Jul 2021 00:21: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 A089568FD; Sat, 31 Jul 2021 00:21: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 16V0LGNh048773; Sat, 31 Jul 2021 00:21:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V0LG3Y048772; Sat, 31 Jul 2021 00:21:16 GMT (envelope-from git) Date: Sat, 31 Jul 2021 00:21:16 GMT Message-Id: <202107310021.16V0LG3Y048772@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: 718283a2b709 - stable/12 - Generate a devctl event for interesting events 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/12 X-Git-Reftype: branch X-Git-Commit: 718283a2b7098e8f48b0bd003066d7c3e72a1513 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, 31 Jul 2021 00:21:17 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=718283a2b7098e8f48b0bd003066d7c3e72a1513 commit 718283a2b7098e8f48b0bd003066d7c3e72a1513 Author: Warner Losh AuthorDate: 2020-04-30 00:27:19 +0000 Commit: Warner Losh CommitDate: 2021-07-31 00:02:51 +0000 Generate a devctl event for interesting events When we reset the controller, and when the controller tells us about a critical warning, send an event. (cherry picked from commit 244b805397208842e4d8bbf1ad5b1b83dbcd4c91) --- sys/dev/nvme/nvme_ctrlr.c | 51 +++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 43 insertions(+), 8 deletions(-) diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c index d011eec99722..18a22aa4f041 100644 --- a/sys/dev/nvme/nvme_ctrlr.c +++ b/sys/dev/nvme/nvme_ctrlr.c @@ -40,7 +40,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include +#include #include #include "nvme_private.h" @@ -50,6 +52,34 @@ __FBSDID("$FreeBSD$"); static void nvme_ctrlr_construct_and_submit_aer(struct nvme_controller *ctrlr, struct nvme_async_event_request *aer); +static void +nvme_ctrlr_devctl_log(struct nvme_controller *ctrlr, const char *type, const char *msg, ...) +{ + struct sbuf sb; + va_list ap; + int error; + + sbuf_new(&sb, NULL, 0, SBUF_AUTOEXTEND | SBUF_NOWAIT); + sbuf_printf(&sb, "%s: ", device_get_nameunit(ctrlr->dev)); + va_start(ap, msg); + sbuf_vprintf(&sb, msg, ap); + va_end(ap); + error = sbuf_finish(&sb); + if (error == 0) + printf("%s\n", sbuf_data(&sb)); + + sbuf_clear(&sb); + sbuf_printf(&sb, "name=\"%s\" reason=\"", device_get_nameunit(ctrlr->dev)); + va_start(ap, msg); + sbuf_vprintf(&sb, msg, ap); + va_end(ap); + sbuf_printf(&sb, "\""); + error = sbuf_finish(&sb); + if (error == 0) + devctl_notify("nvme", "controller", type, sbuf_data(&sb)); + sbuf_delete(&sb); +} + static int nvme_ctrlr_construct_admin_qpair(struct nvme_controller *ctrlr) { @@ -606,23 +636,28 @@ nvme_ctrlr_log_critical_warnings(struct nvme_controller *ctrlr, { if (state & NVME_CRIT_WARN_ST_AVAILABLE_SPARE) - nvme_printf(ctrlr, "available spare space below threshold\n"); + nvme_ctrlr_devctl_log(ctrlr, "critical", + "available spare space below threshold"); if (state & NVME_CRIT_WARN_ST_TEMPERATURE) - nvme_printf(ctrlr, "temperature above threshold\n"); + nvme_ctrlr_devctl_log(ctrlr, "critical", + "temperature above threshold"); if (state & NVME_CRIT_WARN_ST_DEVICE_RELIABILITY) - nvme_printf(ctrlr, "device reliability degraded\n"); + nvme_ctrlr_devctl_log(ctrlr, "critical", + "device reliability degraded"); if (state & NVME_CRIT_WARN_ST_READ_ONLY) - nvme_printf(ctrlr, "media placed in read only mode\n"); + nvme_ctrlr_devctl_log(ctrlr, "critical", + "media placed in read only mode"); if (state & NVME_CRIT_WARN_ST_VOLATILE_MEMORY_BACKUP) - nvme_printf(ctrlr, "volatile memory backup device failed\n"); + nvme_ctrlr_devctl_log(ctrlr, "critical", + "volatile memory backup device failed"); if (state & NVME_CRIT_WARN_ST_RESERVED_MASK) - nvme_printf(ctrlr, - "unknown critical warning(s): state = 0x%02x\n", state); + nvme_ctrlr_devctl_log(ctrlr, "critical", + "unknown critical warning(s): state = 0x%02x", state); } static void @@ -1129,7 +1164,7 @@ nvme_ctrlr_reset_task(void *arg, int pending) struct nvme_controller *ctrlr = arg; int status; - nvme_printf(ctrlr, "resetting controller\n"); + nvme_ctrlr_devctl_log(ctrlr, "RESET", "resetting controller"); status = nvme_ctrlr_hw_reset(ctrlr); /* * Use pause instead of DELAY, so that we yield to any nvme interrupt From owner-dev-commits-src-all@freebsd.org Sat Jul 31 00:21: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 43177651061; Sat, 31 Jul 2021 00:21: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 4Gc4gj6LRgz4VnJ; Sat, 31 Jul 2021 00:21: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 36AB26C2F; Sat, 31 Jul 2021 00:21: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 16V0LL4X048872; Sat, 31 Jul 2021 00:21:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V0LLpc048870; Sat, 31 Jul 2021 00:21:21 GMT (envelope-from git) Date: Sat, 31 Jul 2021 00:21:21 GMT Message-Id: <202107310021.16V0LLpc048870@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: 5afd13ff5b6a - stable/12 - Report cpi->hba_* for nda(4) because why not. 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/12 X-Git-Reftype: branch X-Git-Commit: 5afd13ff5b6a7a828dffa505e984fec6946ca5b3 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, 31 Jul 2021 00:21:22 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=5afd13ff5b6a7a828dffa505e984fec6946ca5b3 commit 5afd13ff5b6a7a828dffa505e984fec6946ca5b3 Author: Alexander Motin AuthorDate: 2020-08-12 20:05:43 +0000 Commit: Warner Losh CommitDate: 2021-07-31 00:02:52 +0000 Report cpi->hba_* for nda(4) because why not. MFC after: 1 week --- sys/dev/nvme/nvme_sim.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/dev/nvme/nvme_sim.c b/sys/dev/nvme/nvme_sim.c index c9d8d94543d7..efec8d34868a 100644 --- a/sys/dev/nvme/nvme_sim.c +++ b/sys/dev/nvme/nvme_sim.c @@ -197,8 +197,12 @@ nvme_sim_action(struct cam_sim *sim, union ccb *ccb) cpi->xport_specific.nvme.slot = pci_get_slot(dev); cpi->xport_specific.nvme.function = pci_get_function(dev); cpi->xport_specific.nvme.extra = 0; - strncpy(cpi->xport_specific.nvme.dev_name, device_get_nameunit(ctrlr->dev), + strncpy(cpi->xport_specific.nvme.dev_name, device_get_nameunit(dev), sizeof(cpi->xport_specific.nvme.dev_name)); + cpi->hba_vendor = pci_get_vendor(dev); + cpi->hba_device = pci_get_device(dev); + cpi->hba_subvendor = pci_get_subvendor(dev); + cpi->hba_subdevice = pci_get_subdevice(dev); cpi->ccb_h.status = CAM_REQ_CMP; break; } From owner-dev-commits-src-all@freebsd.org Sat Jul 31 00:21: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 E82FD6512B4; Sat, 31 Jul 2021 00:21: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 4Gc4gY4GpNz4Vgb; Sat, 31 Jul 2021 00:21: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 47B8F6C96; Sat, 31 Jul 2021 00:21: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 16V0LDst048049; Sat, 31 Jul 2021 00:21:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V0LDq7048037; Sat, 31 Jul 2021 00:21:13 GMT (envelope-from git) Date: Sat, 31 Jul 2021 00:21:13 GMT Message-Id: <202107310021.16V0LDq7048037@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: 97de70c68dd7 - stable/12 - awk: Remove last markings we have on awk 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/12 X-Git-Reftype: branch X-Git-Commit: 97de70c68dd78ec73f30d07ab46b5b4dd490e031 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, 31 Jul 2021 00:21:14 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=97de70c68dd78ec73f30d07ab46b5b4dd490e031 commit 97de70c68dd78ec73f30d07ab46b5b4dd490e031 Author: Warner Losh AuthorDate: 2021-07-22 02:24:57 +0000 Commit: Warner Losh CommitDate: 2021-07-31 00:02:51 +0000 awk: Remove last markings we have on awk We normally don't add $FreeBSD$ to contrib software. However, these changes date back to the CVS era of source code management and have been overlooked. Now that all these files are back to the same as the upstream bsd-features branch, remove the FreeBSD specific changes, which are now just $FreeBSD$ and the (FreeBSD) in the version string. MFC After: 2 weeks Sponsored by: Netflix (cherry picked from commit 5ab82b00cca74feb9d047e9c8aa29e5118810edc) --- contrib/one-true-awk/b.c | 3 --- contrib/one-true-awk/main.c | 4 +--- contrib/one-true-awk/run.c | 3 --- 3 files changed, 1 insertion(+), 9 deletions(-) diff --git a/contrib/one-true-awk/b.c b/contrib/one-true-awk/b.c index 01119470de05..f889ee57b3fb 100644 --- a/contrib/one-true-awk/b.c +++ b/contrib/one-true-awk/b.c @@ -24,9 +24,6 @@ THIS SOFTWARE. /* lasciate ogne speranza, voi ch'intrate. */ -#include -__FBSDID("$FreeBSD$"); - #define DEBUG #include diff --git a/contrib/one-true-awk/main.c b/contrib/one-true-awk/main.c index 95eeba00d9ca..f3936341ae75 100644 --- a/contrib/one-true-awk/main.c +++ b/contrib/one-true-awk/main.c @@ -22,9 +22,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ****************************************************************/ -#include -__FBSDID("$FreeBSD$"); -const char *version = "version 20210215 (FreeBSD)"; +const char *version = "version 20210215"; #define DEBUG #include diff --git a/contrib/one-true-awk/run.c b/contrib/one-true-awk/run.c index 3342eb274e3a..117fb0748bd8 100644 --- a/contrib/one-true-awk/run.c +++ b/contrib/one-true-awk/run.c @@ -22,9 +22,6 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ****************************************************************/ -#include -__FBSDID("$FreeBSD$"); - #define DEBUG #include #include From owner-dev-commits-src-all@freebsd.org Sat Jul 31 00:21: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 06F14651056; Sat, 31 Jul 2021 00:21: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 4Gc4gd6T7kz4VhY; Sat, 31 Jul 2021 00:21: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 BF7A36BAA; Sat, 31 Jul 2021 00:21: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 16V0LHCj048797; Sat, 31 Jul 2021 00:21:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V0LHZL048796; Sat, 31 Jul 2021 00:21:17 GMT (envelope-from git) Date: Sat, 31 Jul 2021 00:21:17 GMT Message-Id: <202107310021.16V0LHZL048796@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: 26fd09ae5fc4 - stable/12 - Make sure that we get the sbuf resources we need. 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/12 X-Git-Reftype: branch X-Git-Commit: 26fd09ae5fc4c1865d7ca15fc33e808c51a8ef52 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, 31 Jul 2021 00:21:18 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=26fd09ae5fc4c1865d7ca15fc33e808c51a8ef52 commit 26fd09ae5fc4c1865d7ca15fc33e808c51a8ef52 Author: Warner Losh AuthorDate: 2020-04-30 00:43:11 +0000 Commit: Warner Losh CommitDate: 2021-07-31 00:02:51 +0000 Make sure that we get the sbuf resources we need. Since we're calling sbuf_new with NOWAIT, make sure it can allocate a buffer to use. Don't print anything if we can't get it. Noticed by: rpokala (cherry picked from commit 4e6a434b6bb81a7ae80911ec6730ff79b9352a88) --- sys/dev/nvme/nvme_ctrlr.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c index 18a22aa4f041..a6e2429dbd19 100644 --- a/sys/dev/nvme/nvme_ctrlr.c +++ b/sys/dev/nvme/nvme_ctrlr.c @@ -59,7 +59,8 @@ nvme_ctrlr_devctl_log(struct nvme_controller *ctrlr, const char *type, const cha va_list ap; int error; - sbuf_new(&sb, NULL, 0, SBUF_AUTOEXTEND | SBUF_NOWAIT); + if (sbuf_new(&sb, NULL, 0, SBUF_AUTOEXTEND | SBUF_NOWAIT) == NULL) + return; sbuf_printf(&sb, "%s: ", device_get_nameunit(ctrlr->dev)); va_start(ap, msg); sbuf_vprintf(&sb, msg, ap); From owner-dev-commits-src-all@freebsd.org Sat Jul 31 00:21: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 91AF9651336; Sat, 31 Jul 2021 00:21: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 4Gc4gq0Ss5z4Vnn; Sat, 31 Jul 2021 00:21: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 BB3366B6B; Sat, 31 Jul 2021 00:21: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 16V0LQaQ051989; Sat, 31 Jul 2021 00:21:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V0LQZd051988; Sat, 31 Jul 2021 00:21:26 GMT (envelope-from git) Date: Sat, 31 Jul 2021 00:21:26 GMT Message-Id: <202107310021.16V0LQZd051988@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: f12339d9c14e - stable/12 - Always use the __unused attribute even for potentially unused parameters. 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/12 X-Git-Reftype: branch X-Git-Commit: f12339d9c14ecfd0f1d02ee8692df94a89181311 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, 31 Jul 2021 00:21:27 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=f12339d9c14ecfd0f1d02ee8692df94a89181311 commit f12339d9c14ecfd0f1d02ee8692df94a89181311 Author: Michal Meloun AuthorDate: 2020-12-01 08:52:13 +0000 Commit: Warner Losh CommitDate: 2021-07-31 00:02:52 +0000 Always use the __unused attribute even for potentially unused parameters. Requested by: ian, imp MFC with: r368167 (cherry picked from commit cf7c06293236710cc33de029fccd1185cb38c5fb) --- sys/dev/nvme/nvme.h | 41 +++++++++++++++++------------------------ 1 file changed, 17 insertions(+), 24 deletions(-) diff --git a/sys/dev/nvme/nvme.h b/sys/dev/nvme/nvme.h index 4ca4ea3373f6..982c994d6433 100644 --- a/sys/dev/nvme/nvme.h +++ b/sys/dev/nvme/nvme.h @@ -1738,15 +1738,9 @@ extern int nvme_use_nvd; #endif /* _KERNEL */ -#if _BYTE_ORDER != _LITTLE_ENDIAN -#define MODIF -#else -#define MODIF __unused -#endif - /* Endianess conversion functions for NVMe structs */ static inline -void nvme_completion_swapbytes(struct nvme_completion *s MODIF) +void nvme_completion_swapbytes(struct nvme_completion *s __unused) { #if _BYTE_ORDER != _LITTLE_ENDIAN @@ -1760,7 +1754,7 @@ void nvme_completion_swapbytes(struct nvme_completion *s MODIF) } static inline -void nvme_power_state_swapbytes(struct nvme_power_state *s MODIF) +void nvme_power_state_swapbytes(struct nvme_power_state *s __unused) { #if _BYTE_ORDER != _LITTLE_ENDIAN @@ -1773,7 +1767,7 @@ void nvme_power_state_swapbytes(struct nvme_power_state *s MODIF) } static inline -void nvme_controller_data_swapbytes(struct nvme_controller_data *s MODIF) +void nvme_controller_data_swapbytes(struct nvme_controller_data *s __unused) { #if _BYTE_ORDER != _LITTLE_ENDIAN int i; @@ -1825,7 +1819,7 @@ void nvme_controller_data_swapbytes(struct nvme_controller_data *s MODIF) } static inline -void nvme_namespace_data_swapbytes(struct nvme_namespace_data *s MODIF) +void nvme_namespace_data_swapbytes(struct nvme_namespace_data *s __unused) { #if _BYTE_ORDER != _LITTLE_ENDIAN int i; @@ -1855,7 +1849,7 @@ void nvme_namespace_data_swapbytes(struct nvme_namespace_data *s MODIF) static inline void nvme_error_information_entry_swapbytes( - struct nvme_error_information_entry *s MODIF) + struct nvme_error_information_entry *s __unused) { #if _BYTE_ORDER != _LITTLE_ENDIAN @@ -1872,7 +1866,7 @@ void nvme_error_information_entry_swapbytes( } static inline -void nvme_le128toh(void *p MODIF) +void nvme_le128toh(void *p __unused) { #if _BYTE_ORDER != _LITTLE_ENDIAN /* Swap 16 bytes in place */ @@ -1889,7 +1883,7 @@ void nvme_le128toh(void *p MODIF) static inline void nvme_health_information_page_swapbytes( - struct nvme_health_information_page *s MODIF) + struct nvme_health_information_page *s __unused) { #if _BYTE_ORDER != _LITTLE_ENDIAN int i; @@ -1918,7 +1912,7 @@ void nvme_health_information_page_swapbytes( static inline -void nvme_firmware_page_swapbytes(struct nvme_firmware_page *s MODIF) +void nvme_firmware_page_swapbytes(struct nvme_firmware_page *s __unused) { #if _BYTE_ORDER != _LITTLE_ENDIAN int i; @@ -1929,7 +1923,7 @@ void nvme_firmware_page_swapbytes(struct nvme_firmware_page *s MODIF) } static inline -void nvme_ns_list_swapbytes(struct nvme_ns_list *s MODIF) +void nvme_ns_list_swapbytes(struct nvme_ns_list *s __unused) { #if _BYTE_ORDER != _LITTLE_ENDIAN int i; @@ -1941,7 +1935,7 @@ void nvme_ns_list_swapbytes(struct nvme_ns_list *s MODIF) static inline void nvme_command_effects_page_swapbytes( - struct nvme_command_effects_page *s MODIF) + struct nvme_command_effects_page *s __unused) { #if _BYTE_ORDER != _LITTLE_ENDIAN int i; @@ -1955,7 +1949,7 @@ void nvme_command_effects_page_swapbytes( static inline void nvme_res_notification_page_swapbytes( - struct nvme_res_notification_page *s MODIF) + struct nvme_res_notification_page *s __unused) { #if _BYTE_ORDER != _LITTLE_ENDIAN s->log_page_count = le64toh(s->log_page_count); @@ -1965,7 +1959,7 @@ void nvme_res_notification_page_swapbytes( static inline void nvme_sanitize_status_page_swapbytes( - struct nvme_sanitize_status_page *s MODIF) + struct nvme_sanitize_status_page *s __unused) { #if _BYTE_ORDER != _LITTLE_ENDIAN s->sprog = le16toh(s->sprog); @@ -1981,7 +1975,7 @@ void nvme_sanitize_status_page_swapbytes( } static inline -void intel_log_temp_stats_swapbytes(struct intel_log_temp_stats *s MODIF) +void intel_log_temp_stats_swapbytes(struct intel_log_temp_stats *s __unused) { #if _BYTE_ORDER != _LITTLE_ENDIAN @@ -1998,8 +1992,8 @@ void intel_log_temp_stats_swapbytes(struct intel_log_temp_stats *s MODIF) } static inline -void nvme_resv_status_swapbytes(struct nvme_resv_status *s MODIF, - size_t size MODIF) +void nvme_resv_status_swapbytes(struct nvme_resv_status *s __unused, + size_t size __unused) { #if _BYTE_ORDER != _LITTLE_ENDIAN u_int i, n; @@ -2016,8 +2010,8 @@ void nvme_resv_status_swapbytes(struct nvme_resv_status *s MODIF, } static inline -void nvme_resv_status_ext_swapbytes(struct nvme_resv_status_ext *s MODIF, - size_t size MODIF) +void nvme_resv_status_ext_swapbytes(struct nvme_resv_status_ext *s __unused, + size_t size __unused) { #if _BYTE_ORDER != _LITTLE_ENDIAN u_int i, n; @@ -2032,6 +2026,5 @@ void nvme_resv_status_ext_swapbytes(struct nvme_resv_status_ext *s MODIF, } #endif } -#undef MODIF #endif /* __NVME_H__ */ From owner-dev-commits-src-all@freebsd.org Sat Jul 31 00:21: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 906CB6511F6; Sat, 31 Jul 2021 00:21: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 4Gc4gl6w4kz4Vhr; Sat, 31 Jul 2021 00:21: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 67F186B68; Sat, 31 Jul 2021 00:21: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 16V0LNan050307; Sat, 31 Jul 2021 00:21:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V0LN4w050294; Sat, 31 Jul 2021 00:21:23 GMT (envelope-from git) Date: Sat, 31 Jul 2021 00:21:23 GMT Message-Id: <202107310021.16V0LN4w050294@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: 88cf6df20468 - stable/12 - nvme: Remove compat code for older kernels 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/12 X-Git-Reftype: branch X-Git-Commit: 88cf6df204683da0e71ac7f5de062686ad8445b7 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, 31 Jul 2021 00:21:25 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=88cf6df204683da0e71ac7f5de062686ad8445b7 commit 88cf6df204683da0e71ac7f5de062686ad8445b7 Author: Warner Losh AuthorDate: 2020-10-24 01:59:01 +0000 Commit: Warner Losh CommitDate: 2021-07-31 00:02:52 +0000 nvme: Remove compat code for older kernels Remove code that supported pre-2011 kernels. CTLTYPE_S64 was defined in rev 217616. All supported branches have it, so remove its compat definition as OBE. (cherry picked from commit 0fc1d2088169456d469b53ecbe7832349917c29d) --- sys/dev/nvme/nvme_sysctl.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/sys/dev/nvme/nvme_sysctl.c b/sys/dev/nvme/nvme_sysctl.c index fc67f2c87fd5..327c3ddbfc99 100644 --- a/sys/dev/nvme/nvme_sysctl.c +++ b/sys/dev/nvme/nvme_sysctl.c @@ -51,16 +51,6 @@ SYSCTL_BOOL(_hw_nvme, OID_AUTO, verbose_cmd_dump, CTLFLAG_RWTUN, &nvme_verbose_cmd_dump, 0, "enable verbose command printting when a command fails"); -/* - * CTLTYPE_S64 and sysctl_handle_64 were added in r217616. Define these - * explicitly here for older kernels that don't include the r217616 - * changeset. - */ -#ifndef CTLTYPE_S64 -#define CTLTYPE_S64 CTLTYPE_QUAD -#define sysctl_handle_64 sysctl_handle_quad -#endif - static void nvme_dump_queue(struct nvme_qpair *qpair) { From owner-dev-commits-src-all@freebsd.org Sat Jul 31 00:21: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 9DD1E65116C; Sat, 31 Jul 2021 00:21: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 4Gc4gv4cxLz4Vx5; Sat, 31 Jul 2021 00:21: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 3A8196C9E; Sat, 31 Jul 2021 00:21: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 16V0LV17052091; Sat, 31 Jul 2021 00:21:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V0LVCt052090; Sat, 31 Jul 2021 00:21:31 GMT (envelope-from git) Date: Sat, 31 Jul 2021 00:21:31 GMT Message-Id: <202107310021.16V0LVCt052090@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: f5a43e10fe4d - stable/12 - fix big-endian platforms after 6733401935f8 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/12 X-Git-Reftype: branch X-Git-Commit: f5a43e10fe4d0fcc13f64d14e4c6c7ba285d8b3c 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, 31 Jul 2021 00:21:33 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=f5a43e10fe4d0fcc13f64d14e4c6c7ba285d8b3c commit f5a43e10fe4d0fcc13f64d14e4c6c7ba285d8b3c Author: Chuck Tuffli AuthorDate: 2021-01-08 22:36:37 +0000 Commit: Warner Losh CommitDate: 2021-07-31 00:02:53 +0000 fix big-endian platforms after 6733401935f8 The NVMe byte-swap routines for big-endian platforms used memcpy() to move the unaligned 64-bit value into a temp register to byte swap it. Instead of introducing a dependency, manually byte-swap the values in place. Point hat: me (cherry picked from commit e83fdf8bb391579fa422d34663cd8c1f82a00dc0) --- sys/dev/nvme/nvme.h | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/sys/dev/nvme/nvme.h b/sys/dev/nvme/nvme.h index f42d1e9caa3b..2caf8171be5b 100644 --- a/sys/dev/nvme/nvme.h +++ b/sys/dev/nvme/nvme.h @@ -2053,16 +2053,20 @@ static inline void nvme_device_self_test_swapbytes(struct nvme_device_self_test_page *s __unused) { #if _BYTE_ORDER != _LITTLE_ENDIAN - uint64_t failing_lba; - uint32_t r; + uint8_t *tmp; + uint32_t r, i; + uint8_t b; for (r = 0; r < 20; r++) { s->result[r].poh = le64toh(s->result[r].poh); s->result[r].nsid = le32toh(s->result[r].nsid); /* Unaligned 64-bit loads fail on some architectures */ - memcpy(&failing_lba, s->result[r].failing_lba, sizeof(failing_lba)); - failing_lba = le64toh(failing_lba); - memcpy(s->result[r].failing_lba, &failing_lba, sizeof(failing_lba)); + tmp = s->result[r].failing_lba; + for (i = 0; i < 4; i++) { + b = tmp[i]; + tmp[i] = tmp[7-i]; + tmp[7-i] = b; + } } #endif } From owner-dev-commits-src-all@freebsd.org Sat Jul 31 00:21: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 A8BA86512DB; Sat, 31 Jul 2021 00:21: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 4Gc4gt6H9kz4Vp8; Sat, 31 Jul 2021 00:21: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 226546C9C; Sat, 31 Jul 2021 00:21: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 16V0LUgR052067; Sat, 31 Jul 2021 00:21:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V0LUet052066; Sat, 31 Jul 2021 00:21:30 GMT (envelope-from git) Date: Sat, 31 Jul 2021 00:21:30 GMT Message-Id: <202107310021.16V0LUet052066@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: 0980844b7fe7 - stable/12 - nvmecontrol: add device self-test op and log page 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/12 X-Git-Reftype: branch X-Git-Commit: 0980844b7fe76f5dd782cacd17edac59d2bc6c12 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, 31 Jul 2021 00:21:31 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=0980844b7fe76f5dd782cacd17edac59d2bc6c12 commit 0980844b7fe76f5dd782cacd17edac59d2bc6c12 Author: Chuck Tuffli AuthorDate: 2021-01-08 17:19:37 +0000 Commit: Warner Losh CommitDate: 2021-07-31 00:02:52 +0000 nvmecontrol: add device self-test op and log page Add decoding of the Device Self-test log page and the ability to start or abort a test. Reviewed by: imp, mav Tested by: Muhammad Ahmad MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D27517 (cherry picked from commit 6733401935f83754b4b2744bc3d33ef84b1271e0) --- sbin/nvmecontrol/Makefile | 1 + sbin/nvmecontrol/logpage.c | 103 ++++++++++++++++++++++++++++++- sbin/nvmecontrol/nvmecontrol.8 | 23 +++++++ sbin/nvmecontrol/selftest.c | 137 +++++++++++++++++++++++++++++++++++++++++ sys/dev/nvme/nvme.h | 39 ++++++++++++ 5 files changed, 302 insertions(+), 1 deletion(-) diff --git a/sbin/nvmecontrol/Makefile b/sbin/nvmecontrol/Makefile index 71212930a6c4..b5ceb350ed0d 100644 --- a/sbin/nvmecontrol/Makefile +++ b/sbin/nvmecontrol/Makefile @@ -9,6 +9,7 @@ SRCS+= devlist.c firmware.c format.c identify.c logpage.c ns.c nsid.c SRCS+= perftest.c power.c reset.c resv.c sanitize.c SRCS+= passthru.c SRCS+= identify_ext.c nvme_util.c nc_util.c +SRCS+= selftest.c MAN= nvmecontrol.8 LDFLAGS+= -rdynamic LIBADD+= util diff --git a/sbin/nvmecontrol/logpage.c b/sbin/nvmecontrol/logpage.c index 2f7cec005592..f00d5d94897b 100644 --- a/sbin/nvmecontrol/logpage.c +++ b/sbin/nvmecontrol/logpage.c @@ -239,6 +239,10 @@ read_logpage(int fd, uint8_t log_page, uint32_t nsid, uint8_t lsp, case NVME_LOG_CHANGED_NAMESPACE: nvme_ns_list_swapbytes((struct nvme_ns_list *)payload); break; + case NVME_LOG_DEVICE_SELF_TEST: + nvme_device_self_test_swapbytes( + (struct nvme_device_self_test_page *)payload); + break; case NVME_LOG_COMMAND_EFFECT: nvme_command_effects_page_swapbytes( (struct nvme_command_effects_page *)payload); @@ -588,6 +592,103 @@ print_log_sanitize_status(const struct nvme_controller_data *cdata __unused, printf("Time For Crypto Erase No-Deallocate: %u sec\n", ss->etfcewnd); } +static const char * +self_test_res[] = { + [0] = "completed without error", + [1] = "aborted by a Device Self-test command", + [2] = "aborted by a Controller Level Reset", + [3] = "aborted due to namespace removal", + [4] = "aborted due to Format NVM command", + [5] = "failed due to fatal or unknown test error", + [6] = "completed with an unknown segment that failed", + [7] = "completed with one or more failed segments", + [8] = "aborted for unknown reason", + [9] = "aborted due to a sanitize operation", +}; +static uint32_t self_test_res_max = nitems(self_test_res); + +static void +print_log_self_test_status(const struct nvme_controller_data *cdata __unused, + void *buf, uint32_t size __unused) +{ + struct nvme_device_self_test_page *dst; + uint32_t r; + + dst = buf; + printf("Device Self-test Status\n"); + printf("=======================\n"); + + printf("Current Operation: "); + switch (dst->curr_operation) { + case 0x0: + printf("No device self-test operation in progress\n"); + break; + case 0x1: + printf("Short device self-test operation in progress\n"); + break; + case 0x2: + printf("Extended device self-test operation in progress\n"); + break; + case 0xe: + printf("Vendor specific\n"); + break; + default: + printf("Reserved (0x%x)\n", dst->curr_operation); + } + + if (dst->curr_operation != 0) + printf("Current Completion: %u%%\n", dst->curr_compl & 0x7f); + + printf("Results\n"); + for (r = 0; r < 20; r++) { + uint64_t failing_lba; + uint8_t code, res; + + code = (dst->result[r].status >> 4) & 0xf; + res = dst->result[r].status & 0xf; + + if (res == 0xf) + continue; + + printf("[%2u] ", r); + switch (code) { + case 0x1: + printf("Short device self-test"); + break; + case 0x2: + printf("Extended device self-test"); + break; + case 0xe: + printf("Vendor specific"); + break; + default: + printf("Reserved (0x%x)", code); + } + if (res < self_test_res_max) + printf(" %s", self_test_res[res]); + else + printf(" Reserved status 0x%x", res); + + if (res == 7) + printf(" starting in segment %u", dst->result[r].segment_num); + +#define BIT(b) (1 << (b)) + if (dst->result[r].valid_diag_info & BIT(0)) + printf(" NSID=0x%x", dst->result[r].nsid); + if (dst->result[r].valid_diag_info & BIT(1)) { + memcpy(&failing_lba, dst->result[r].failing_lba, + sizeof(failing_lba)); + printf(" FLBA=0x%lx", failing_lba); + } + if (dst->result[r].valid_diag_info & BIT(2)) + printf(" SCT=0x%x", dst->result[r].status_code_type); + if (dst->result[r].valid_diag_info & BIT(3)) + printf(" SC=0x%x", dst->result[r].status_code); +#undef BIT + printf("\n"); + } +} + /* * Table of log page printer / sizing. * @@ -611,7 +712,7 @@ NVME_LOGPAGE(ce, print_log_command_effects, sizeof(struct nvme_command_effects_page)); NVME_LOGPAGE(dst, NVME_LOG_DEVICE_SELF_TEST, NULL, "Device Self-test", - NULL, 564); + print_log_self_test_status, sizeof(struct nvme_device_self_test_page)); NVME_LOGPAGE(thi, NVME_LOG_TELEMETRY_HOST_INITIATED, NULL, "Telemetry Host-Initiated", NULL, DEFAULT_SIZE); diff --git a/sbin/nvmecontrol/nvmecontrol.8 b/sbin/nvmecontrol/nvmecontrol.8 index 976532932a69..2d634eb54216 100644 --- a/sbin/nvmecontrol/nvmecontrol.8 +++ b/sbin/nvmecontrol/nvmecontrol.8 @@ -177,6 +177,10 @@ .Op Fl p power_state .Op Fl w workload_hint .Nm +.Ic selftest +.Aq Fl c Ar code +.Aq Ar device-id | Ar namespace-id +.Nm .Ic wdc cap-diag .Op Fl o path_template .Aq Ar device-id @@ -254,6 +258,8 @@ Firmware Information Changed Namespace List .It Dv Page 0x05 Commands Supported and Effects +.It Dv Page 0x06 +Device Self-test .It Dv Page 0x80 Reservation Notification .It Dv Page 0x81 @@ -464,6 +470,23 @@ Run in mode. This will report status on a sanitize that is already running on the drive. .El +.Ss selftest +Start the specified device self-test: +.Bl -tag -width 6n +.It Fl c Ar code +Specify the device self-test command code. +Common codes are: +.Bl -tag -compact -width 6n +.It Dv 0x1 +Start a short device self-test operation +.It Dv 0x2 +Start an extended device self-test operation +.It Dv 0xe +Start a vendor specific device self-test operation +.It Dv 0xf +Abort the device self-test operation +.El +.El .Ss wdc The various wdc command retrieve log data from the wdc/hgst drives. The diff --git a/sbin/nvmecontrol/selftest.c b/sbin/nvmecontrol/selftest.c new file mode 100644 index 000000000000..17945248f8e3 --- /dev/null +++ b/sbin/nvmecontrol/selftest.c @@ -0,0 +1,137 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2020 Chuck Tuffli + * + * 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 "nvmecontrol.h" + +#define SELFTEST_CODE_NONE 0xffu +#define SELFTEST_CODE_MAX 0xfu + +static struct options { + const char *dev; + uint8_t stc; /* Self-test Code */ +} opt = { + .dev = NULL, + .stc = SELFTEST_CODE_NONE, +}; + +static void +selftest_op(int fd, uint32_t nsid, uint8_t stc) +{ + struct nvme_pt_command pt; + + memset(&pt, 0, sizeof(pt)); + pt.cmd.opc = NVME_OPC_DEVICE_SELF_TEST; + pt.cmd.nsid = htole32(nsid); + pt.cmd.cdw10 = htole32(stc); + + if (ioctl(fd, NVME_PASSTHROUGH_CMD, &pt) < 0) + err(EX_IOERR, "self-test request failed"); + + if (NVME_STATUS_GET_SCT(pt.cpl.status) == NVME_SCT_COMMAND_SPECIFIC && + NVME_STATUS_GET_SC(pt.cpl.status) == NVME_SC_SELF_TEST_IN_PROGRESS) + errx(EX_UNAVAILABLE, "device self-test in progress"); + else if (nvme_completion_is_error(&pt.cpl)) + errx(EX_IOERR, "self-test request returned error"); +} + +static void +selftest(const struct cmd *f, int argc, char *argv[]) +{ + struct nvme_controller_data cdata; + int fd; + char *path; + uint32_t nsid; + + if (arg_parse(argc, argv, f)) + return; + + open_dev(opt.dev, &fd, 1, 1); + get_nsid(fd, &path, &nsid); + if (nsid != 0) { + close(fd); + open_dev(path, &fd, 1, 1); + } + free(path); + + if (opt.stc == SELFTEST_CODE_NONE) + errx(EX_USAGE, "must specify a Self-test Code"); + else if (opt.stc > SELFTEST_CODE_MAX) + errx(EX_DATAERR, "illegal Self-test Code 0x%x", opt.stc); + + if (read_controller_data(fd, &cdata)) + errx(EX_IOERR, "Identify request failed"); + + if (((cdata.oacs >> NVME_CTRLR_DATA_OACS_SELFTEST_SHIFT) & + NVME_CTRLR_DATA_OACS_SELFTEST_MASK) == 0) + errx(EX_UNAVAILABLE, "controller does not support self-test"); + + selftest_op(fd, nsid, opt.stc); + + close(fd); + exit(0); +} + +static const struct opts selftest_opts[] = { +#define OPT(l, s, t, opt, addr, desc) { l, s, t, &opt.addr, desc } + OPT("test-code", 'c', arg_uint8, opt, stc, + "Self-test Code to execute"), + { NULL, 0, arg_none, NULL, NULL } +}; +#undef OPT + +static struct args selftest_args[] = { + { arg_string, &opt.dev, "controller-id|namespace-id" }, + { arg_none, NULL, NULL }, +}; + +static struct cmd selftest_cmd = { + .name = "selftest", + .fn = selftest, + .descr = "Start device self-test", + .ctx_size = sizeof(opt), + .opts = selftest_opts, + .args = selftest_args, +}; + +CMD_COMMAND(selftest_cmd); diff --git a/sys/dev/nvme/nvme.h b/sys/dev/nvme/nvme.h index 982c994d6433..f42d1e9caa3b 100644 --- a/sys/dev/nvme/nvme.h +++ b/sys/dev/nvme/nvme.h @@ -1403,6 +1403,28 @@ struct nvme_command_effects_page { _Static_assert(sizeof(struct nvme_command_effects_page) == 4096, "bad size for nvme_command_effects_page"); +struct nvme_device_self_test_page { + uint8_t curr_operation; + uint8_t curr_compl; + uint8_t rsvd2[2]; + struct { + uint8_t status; + uint8_t segment_num; + uint8_t valid_diag_info; + uint8_t rsvd3; + uint64_t poh; + uint32_t nsid; + /* Define as an array to simplify alignment issues */ + uint8_t failing_lba[8]; + uint8_t status_code_type; + uint8_t status_code; + uint8_t vendor_specific[2]; + } __packed result[20]; +} __packed __aligned(4); + +_Static_assert(sizeof(struct nvme_device_self_test_page) == 564, + "bad size for nvme_device_self_test_page"); + struct nvme_res_notification_page { uint64_t log_page_count; uint8_t log_page_type; @@ -2027,4 +2049,21 @@ void nvme_resv_status_ext_swapbytes(struct nvme_resv_status_ext *s __unused, #endif } +static inline void +nvme_device_self_test_swapbytes(struct nvme_device_self_test_page *s __unused) +{ +#if _BYTE_ORDER != _LITTLE_ENDIAN + uint64_t failing_lba; + uint32_t r; + + for (r = 0; r < 20; r++) { + s->result[r].poh = le64toh(s->result[r].poh); + s->result[r].nsid = le32toh(s->result[r].nsid); + /* Unaligned 64-bit loads fail on some architectures */ + memcpy(&failing_lba, s->result[r].failing_lba, sizeof(failing_lba)); + failing_lba = le64toh(failing_lba); + memcpy(s->result[r].failing_lba, &failing_lba, sizeof(failing_lba)); + } +#endif +} #endif /* __NVME_H__ */ From owner-dev-commits-src-all@freebsd.org Sat Jul 31 00:21: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 28A29651423; Sat, 31 Jul 2021 00:21: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 4Gc4gs60g5z4Vp2; Sat, 31 Jul 2021 00:21: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 0703A6C31; Sat, 31 Jul 2021 00:21: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 16V0LSKG052043; Sat, 31 Jul 2021 00:21:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V0LSE2052042; Sat, 31 Jul 2021 00:21:28 GMT (envelope-from git) Date: Sat, 31 Jul 2021 00:21:28 GMT Message-Id: <202107310021.16V0LSE2052042@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: 644837397fa7 - stable/12 - nvme: Remove a wmb() that's not necessary. 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/12 X-Git-Reftype: branch X-Git-Commit: 644837397fa7fbc6f5bdd7d885c6347045c18bf3 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, 31 Jul 2021 00:21:31 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=644837397fa7fbc6f5bdd7d885c6347045c18bf3 commit 644837397fa7fbc6f5bdd7d885c6347045c18bf3 Author: Warner Losh AuthorDate: 2020-12-04 21:34:48 +0000 Commit: Warner Losh CommitDate: 2021-07-31 00:02:52 +0000 nvme: Remove a wmb() that's not necessary. bus_dmamap_sync() ensures that memory that's prepared for PREWRITE can be DMA'd immediately after it returns. The details differ, but this mirrors atomic thread release semantics, at least for the buffers synced. For non-x86 platforms, bus_dmamap_sync() has the right syncing and fences. So in the past, wmb() had been omitted for them. For x86 platforms, the memory ordering is already strong enough to ensure DMA to the device sees the current contents. As such, we don't need the wmb() here. It translates to an sfence which is only needed for writes to regions that have the write combining attribute set or when some exotic opcodes are used. The nvme driver does neither of these. Since bus_dmamap_sync() includes atomic_thread_fence_rel, we can be assured any optimizer won't reorder the bus_dmamap_sync and the bus_space_write operations. The wmb() was a vestiage of the pre-busdma version initially committed to the tree. Reviewed by: kib@, gallatin@, chuck@, mav@ Differential Revision: https://reviews.freebsd.org/D27448 (cherry picked from commit 082905cad121bf6721606b6b9ba20a09bc6e56d0) --- sys/dev/nvme/nvme_qpair.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/sys/dev/nvme/nvme_qpair.c b/sys/dev/nvme/nvme_qpair.c index e43e8285e9bb..651eee121be1 100644 --- a/sys/dev/nvme/nvme_qpair.c +++ b/sys/dev/nvme/nvme_qpair.c @@ -987,14 +987,6 @@ nvme_qpair_submit_tracker(struct nvme_qpair *qpair, struct nvme_tracker *tr) bus_dmamap_sync(qpair->dma_tag, qpair->queuemem_map, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); -#if !defined( __powerpc__) && !defined( __aarch64__) && !defined( __arm__) - /* - * powerpc's bus_dmamap_sync() already includes a heavyweight sync, but - * no other archs do. - */ - wmb(); -#endif - bus_space_write_4(qpair->ctrlr->bus_tag, qpair->ctrlr->bus_handle, qpair->sq_tdbl_off, qpair->sq_tail); qpair->num_cmds++; From owner-dev-commits-src-all@freebsd.org Sat Jul 31 00:21: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 DFA8F65149D; Sat, 31 Jul 2021 00:21: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 4Gc4gz0TYVz4Vtd; Sat, 31 Jul 2021 00:21: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 A7E366CA1; Sat, 31 Jul 2021 00:21: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 16V0LY2Q052169; Sat, 31 Jul 2021 00:21:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V0LYrt052168; Sat, 31 Jul 2021 00:21:34 GMT (envelope-from git) Date: Sat, 31 Jul 2021 00:21:34 GMT Message-Id: <202107310021.16V0LYrt052168@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: 5b59c5186902 - stable/12 - nvme: use config_intrhook_drain to avoid removable card races 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/12 X-Git-Reftype: branch X-Git-Commit: 5b59c5186902f8ac402b89796567fa630abb10c2 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, 31 Jul 2021 00:21:36 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=5b59c5186902f8ac402b89796567fa630abb10c2 commit 5b59c5186902f8ac402b89796567fa630abb10c2 Author: Warner Losh AuthorDate: 2021-03-11 15:42:44 +0000 Commit: Warner Losh CommitDate: 2021-07-31 00:02:53 +0000 nvme: use config_intrhook_drain to avoid removable card races nvme drives are configured early in boot. However, a number of the configuration steps takes which take a while, so we defer those to a config intrhook that runs before the root filesystem is mounted. At the same time, the PCI hot plug wakes up and tests the status of the card. It may decide that the card has gone away and deletes the child. As part of that process nvme_detach is called. If this call happens after the config_intrhook starts to run, but before it is finished, there's a race where we can tear down the device's soft state while the config_intrhook is still using it. Use the new config_intrhook_drain to disestablish the hook. Either it will be removed w/o running, or the routine will wait for it to finish. This closes the race and allows safe hotplug at any time, even very early in boot. Sponsored by: Netflix, Inc Reviewed by: jhb, mav Differential Revision: https://reviews.freebsd.org/D29006 (cherry picked from commit 8423f5d4c127f18e7500bc455bc7b6b1691385ef) --- sys/dev/nvme/nvme.c | 5 +---- sys/dev/nvme/nvme_ctrlr.c | 2 -- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/sys/dev/nvme/nvme.c b/sys/dev/nvme/nvme.c index 8e5bc11b35d4..17ee7b19177d 100644 --- a/sys/dev/nvme/nvme.c +++ b/sys/dev/nvme/nvme.c @@ -144,10 +144,7 @@ nvme_detach(device_t dev) { struct nvme_controller *ctrlr = DEVICE2SOFTC(dev); - if (ctrlr->config_hook.ich_arg != NULL) { - config_intrhook_disestablish(&ctrlr->config_hook); - ctrlr->config_hook.ich_arg = NULL; - } + config_intrhook_drain(&ctrlr->config_hook); nvme_ctrlr_destruct(ctrlr, dev); return (0); diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c index d4d472878b82..007e0758023a 100644 --- a/sys/dev/nvme/nvme_ctrlr.c +++ b/sys/dev/nvme/nvme_ctrlr.c @@ -1135,7 +1135,6 @@ nvme_ctrlr_start_config_hook(void *arg) fail: nvme_ctrlr_fail(ctrlr); config_intrhook_disestablish(&ctrlr->config_hook); - ctrlr->config_hook.ich_arg = NULL; return; } @@ -1154,7 +1153,6 @@ fail: nvme_sysctl_initialize_ctrlr(ctrlr); config_intrhook_disestablish(&ctrlr->config_hook); - ctrlr->config_hook.ich_arg = NULL; ctrlr->is_initialized = 1; nvme_notify_new_controller(ctrlr); From owner-dev-commits-src-all@freebsd.org Sat Jul 31 00:21: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 F0F68651328; Sat, 31 Jul 2021 00: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 4Gc4gg18R5z4VR3; Sat, 31 Jul 2021 00: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 E55D66C99; Sat, 31 Jul 2021 00:21: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 16V0LI2E048821; Sat, 31 Jul 2021 00:21:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V0LIPV048820; Sat, 31 Jul 2021 00:21:18 GMT (envelope-from git) Date: Sat, 31 Jul 2021 00:21:18 GMT Message-Id: <202107310021.16V0LIPV048820@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: 8ed05c686fba - stable/12 - Rename ns notification function... 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/12 X-Git-Reftype: branch X-Git-Commit: 8ed05c686fba2300cc66a89418c14ab84e033c5f 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, 31 Jul 2021 00:21:20 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=8ed05c686fba2300cc66a89418c14ab84e033c5f commit 8ed05c686fba2300cc66a89418c14ab84e033c5f Author: Warner Losh AuthorDate: 2020-05-01 21:24:15 +0000 Commit: Warner Losh CommitDate: 2021-07-31 00:02:51 +0000 Rename ns notification function... This function is called whenever the namespace is added, deleted or changes. Update the name to reflect that. No functional change. (cherry picked from commit 950475ca2062b5d95efcf4d758cb5f33d7710aed) --- sys/dev/nvme/nvme_sim.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/dev/nvme/nvme_sim.c b/sys/dev/nvme/nvme_sim.c index b66126b11bce..c9d8d94543d7 100644 --- a/sys/dev/nvme/nvme_sim.c +++ b/sys/dev/nvme/nvme_sim.c @@ -315,7 +315,7 @@ err1: } static void * -nvme_sim_new_ns(struct nvme_namespace *ns, void *sc_arg) +nvme_sim_ns_change(struct nvme_namespace *ns, void *sc_arg) { struct nvme_sim_softc *sc = sc_arg; union ccb *ccb; @@ -339,7 +339,7 @@ nvme_sim_new_ns(struct nvme_namespace *ns, void *sc_arg) } xpt_rescan(ccb); - return (ns); + return (sc_arg); } static void @@ -362,7 +362,7 @@ nvme_sim_init(void) if (nvme_use_nvd) return; - consumer_cookie = nvme_register_consumer(nvme_sim_new_ns, + consumer_cookie = nvme_register_consumer(nvme_sim_ns_change, nvme_sim_new_controller, NULL, nvme_sim_controller_fail); } From owner-dev-commits-src-all@freebsd.org Sat Jul 31 00:21: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 28FD56512CB; Sat, 31 Jul 2021 00:21: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 4Gc4gh3Xqvz4VRB; Sat, 31 Jul 2021 00:21: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 162DD6DC3; Sat, 31 Jul 2021 00:21: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 16V0LJUr048845; Sat, 31 Jul 2021 00: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 16V0LJSM048844; Sat, 31 Jul 2021 00:21:19 GMT (envelope-from git) Date: Sat, 31 Jul 2021 00:21:19 GMT Message-Id: <202107310021.16V0LJSM048844@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: 90a63b91ec09 - stable/12 - Add KASSERT to ensure sane nsid. 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/12 X-Git-Reftype: branch X-Git-Commit: 90a63b91ec092e94f97d87f0f187cf1d393ee4a0 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, 31 Jul 2021 00:21:21 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=90a63b91ec092e94f97d87f0f187cf1d393ee4a0 commit 90a63b91ec092e94f97d87f0f187cf1d393ee4a0 Author: Warner Losh AuthorDate: 2020-05-01 21:24:19 +0000 Commit: Warner Losh CommitDate: 2021-07-31 00:02:51 +0000 Add KASSERT to ensure sane nsid. All callers are currently filtering bad nsid to this function, however, we'll have undefined behavior if that's not true. Add the KASSERT to prevent that. (cherry picked from commit d5cc572ce6009993fb3c4f6c887194b9ec3c9815) --- sys/dev/nvme/nvme.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sys/dev/nvme/nvme.c b/sys/dev/nvme/nvme.c index 97f35afb36da..843aa80bb4fb 100644 --- a/sys/dev/nvme/nvme.c +++ b/sys/dev/nvme/nvme.c @@ -291,13 +291,18 @@ void nvme_notify_ns(struct nvme_controller *ctrlr, int nsid) { struct nvme_consumer *cons; - struct nvme_namespace *ns = &ctrlr->ns[nsid - 1]; + struct nvme_namespace *ns; void *ctrlr_cookie; uint32_t i; + KASSERT(nsid <= NVME_MAX_NAMESPACES, + ("%s: Namespace notification to nsid %d exceeds range\n", + device_get_nameunit(ctrlr->dev), nsid)); + if (!ctrlr->is_initialized) return; + ns = &ctrlr->ns[nsid - 1]; for (i = 0; i < NVME_MAX_CONSUMERS; i++) { cons = &nvme_consumer[i]; if (cons->id != INVALID_CONSUMER_ID && cons->ns_fn != NULL && From owner-dev-commits-src-all@freebsd.org Sat Jul 31 00:21: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 4F9F1651330; Sat, 31 Jul 2021 00:21: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 4Gc4gk4mngz4VYx; Sat, 31 Jul 2021 00:21: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 54C3C6A59; Sat, 31 Jul 2021 00:21: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 16V0LMkj048919; Sat, 31 Jul 2021 00:21:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V0LMQH048910; Sat, 31 Jul 2021 00:21:22 GMT (envelope-from git) Date: Sat, 31 Jul 2021 00:21:22 GMT Message-Id: <202107310021.16V0LMQH048910@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: d46fa8be05a7 - stable/12 - Use symbolic names for asych events 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/12 X-Git-Reftype: branch X-Git-Commit: d46fa8be05a75e1d580e3311f87e0c0d63db7de9 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, 31 Jul 2021 00:21:23 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=d46fa8be05a75e1d580e3311f87e0c0d63db7de9 commit d46fa8be05a75e1d580e3311f87e0c0d63db7de9 Author: Warner Losh AuthorDate: 2020-08-31 19:38:03 +0000 Commit: Warner Losh CommitDate: 2021-07-31 00:02:52 +0000 Use symbolic names for asych events Rather than |= 0x300, define and use asyn event names for the name space changes and the firmware activations that we're asking for. (cherry picked from commit 881534f09cccbf4bc749be22eb34ad57b5c13563) --- sys/dev/nvme/nvme.h | 2 ++ sys/dev/nvme/nvme_ctrlr.c | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/dev/nvme/nvme.h b/sys/dev/nvme/nvme.h index 41d5362f6982..982c994d6433 100644 --- a/sys/dev/nvme/nvme.h +++ b/sys/dev/nvme/nvme.h @@ -497,6 +497,8 @@ enum nvme_critical_warning_state { NVME_CRIT_WARN_ST_VOLATILE_MEMORY_BACKUP = 0x10, }; #define NVME_CRIT_WARN_ST_RESERVED_MASK (0xE0) +#define NVME_ASYNC_EVENT_NS_ATTRIBUTE (0x100) +#define NVME_ASYNC_EVENT_FW_ACTIVATE (0x200) /* slot for current FW */ #define NVME_FIRMWARE_PAGE_AFI_SLOT_SHIFT (0) diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c index a6e2429dbd19..efc8fbcdf567 100644 --- a/sys/dev/nvme/nvme_ctrlr.c +++ b/sys/dev/nvme/nvme_ctrlr.c @@ -834,7 +834,8 @@ nvme_ctrlr_configure_aer(struct nvme_controller *ctrlr) NVME_CRIT_WARN_ST_READ_ONLY | NVME_CRIT_WARN_ST_VOLATILE_MEMORY_BACKUP; if (ctrlr->cdata.ver >= NVME_REV(1, 2)) - ctrlr->async_event_config |= 0x300; + ctrlr->async_event_config |= NVME_ASYNC_EVENT_NS_ATTRIBUTE | + NVME_ASYNC_EVENT_FW_ACTIVATE; status.done = 0; nvme_ctrlr_cmd_get_feature(ctrlr, NVME_FEAT_TEMPERATURE_THRESHOLD, From owner-dev-commits-src-all@freebsd.org Sat Jul 31 00:21: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 32147651096; Sat, 31 Jul 2021 00:21: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 4Gc4h40grXz4Vk1; Sat, 31 Jul 2021 00:21: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 3A5326BB1; Sat, 31 Jul 2021 00:21: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 16V0LdR7052271; Sat, 31 Jul 2021 00:21:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V0LdN3052270; Sat, 31 Jul 2021 00:21:39 GMT (envelope-from git) Date: Sat, 31 Jul 2021 00:21:39 GMT Message-Id: <202107310021.16V0LdN3052270@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: f76c34659f9d - stable/12 - nvme: coherently read status of completion records 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/12 X-Git-Reftype: branch X-Git-Commit: f76c34659f9d94683e1161b8913b6466a2fdbaba 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, 31 Jul 2021 00:21:41 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=f76c34659f9d94683e1161b8913b6466a2fdbaba commit f76c34659f9d94683e1161b8913b6466a2fdbaba Author: Warner Losh AuthorDate: 2021-07-02 22:00:42 +0000 Commit: Warner Losh CommitDate: 2021-07-31 00:02:53 +0000 nvme: coherently read status of completion records Coherently read the phase bit of the status completion record. We loop over the completion record array, looking for all the transactions in the same phase that have been completed. In doing that, we have to be careful to read the status field first, and if it indicates a complete record, we need to read and process that record. Otherwise, the host might be overtaken by device when reading this completion record, leading to a mistaken belief that the record is in phase. This leads to the code using old values and looking at an already completed entry, which has no current tracker. To work around this problem, we read the status and make sure it is in phase, we then re-read the entire completion record guaranteeing it's complete, valid, and consistent . In addition we resync the dmatag to reflect changes since the prior loop for the bouncing dma case. Reviewed by: jrtc27@, chuck@ Found by: jrtc27 (this fix is based in part on her D30995 fix) Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D31002 (cherry picked from commit aa0ab681ae755e01cd69435fab50f6852f248c42) --- sys/dev/nvme/nvme_qpair.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/sys/dev/nvme/nvme_qpair.c b/sys/dev/nvme/nvme_qpair.c index e188ef9e3ebd..d126b9dbeb18 100644 --- a/sys/dev/nvme/nvme_qpair.c +++ b/sys/dev/nvme/nvme_qpair.c @@ -586,13 +586,30 @@ nvme_qpair_process_completions(struct nvme_qpair *qpair) } while (1) { - cpl = qpair->cpl[qpair->cq_head]; + uint16_t status; - /* Convert to host endian */ + /* + * We need to do this dance to avoid a race between the host and + * the device where the device overtakes the host while the host + * is reading this record, leaving the status field 'new' and + * the sqhd and cid fields potentially stale. If the phase + * doesn't match, that means status hasn't yet been updated and + * we'll get any pending changes next time. It also means that + * the phase must be the same the second time. We have to sync + * before reading to ensure any bouncing completes. + */ + status = le16toh(qpair->cpl[qpair->cq_head].status); + if (NVME_STATUS_GET_P(status) != qpair->phase) + break; + + bus_dmamap_sync(qpair->dma_tag, qpair->queuemem_map, + BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); + cpl = qpair->cpl[qpair->cq_head]; nvme_completion_swapbytes(&cpl); - if (NVME_STATUS_GET_P(cpl.status) != qpair->phase) - break; + KASSERT( + NVME_STATUS_GET_P(status) == NVME_STATUS_GET_P(cpl.status), + ("Phase unexpectedly inconsistent")); tr = qpair->act_tr[cpl.cid]; From owner-dev-commits-src-all@freebsd.org Sat Jul 31 00:21: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 AA7D36512E7; Sat, 31 Jul 2021 00:21: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 4Gc4h21Fg7z4Vjr; Sat, 31 Jul 2021 00:21: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 EEFE56E07; Sat, 31 Jul 2021 00:21: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 16V0La7T052217; Sat, 31 Jul 2021 00:21:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V0La0L052216; Sat, 31 Jul 2021 00:21:36 GMT (envelope-from git) Date: Sat, 31 Jul 2021 00:21:36 GMT Message-Id: <202107310021.16V0La0L052216@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: 4fad4eeb75fe - stable/12 - nvme: style nit 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/12 X-Git-Reftype: branch X-Git-Commit: 4fad4eeb75fe440a9f307af4804cc211a451e603 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, 31 Jul 2021 00:21:39 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=4fad4eeb75fe440a9f307af4804cc211a451e603 commit 4fad4eeb75fe440a9f307af4804cc211a451e603 Author: Warner Losh AuthorDate: 2021-07-02 21:58:14 +0000 Commit: Warner Losh CommitDate: 2021-07-31 00:02:53 +0000 nvme: style nit Put the { on the same line as the struct nvme_foo when we define these structures. It's FreeBSD standard and these were inconsistent. Sponsored by: Netflix (cherry picked from commit 80a75155e1601bddc2c595c06ab6ea916c603071) --- sys/dev/nvme/nvme.h | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/sys/dev/nvme/nvme.h b/sys/dev/nvme/nvme.h index 2caf8171be5b..d53bf3dd9357 100644 --- a/sys/dev/nvme/nvme.h +++ b/sys/dev/nvme/nvme.h @@ -546,8 +546,7 @@ enum shst_value { NVME_SHST_COMPLETE = 0x2, }; -struct nvme_registers -{ +struct nvme_registers { uint32_t cap_lo; /* controller capabilities */ uint32_t cap_hi; uint32_t vs; /* version */ @@ -584,8 +583,7 @@ struct nvme_registers _Static_assert(sizeof(struct nvme_registers) == 0x1008, "bad size for nvme_registers"); -struct nvme_command -{ +struct nvme_command { /* dword 0 */ uint8_t opc; /* opcode */ uint8_t fuse; /* fused operation */ @@ -1453,8 +1451,7 @@ struct nvme_sanitize_status_page { _Static_assert(sizeof(struct nvme_sanitize_status_page) == 512, "bad size for nvme_sanitize_status_page"); -struct intel_log_temp_stats -{ +struct intel_log_temp_stats { uint64_t current; uint64_t overtemp_flag_last; uint64_t overtemp_flag_life; @@ -1468,8 +1465,7 @@ struct intel_log_temp_stats _Static_assert(sizeof(struct intel_log_temp_stats) == 13 * 8, "bad size for intel_log_temp_stats"); -struct nvme_resv_reg_ctrlr -{ +struct nvme_resv_reg_ctrlr { uint16_t ctrlr_id; /* Controller ID */ uint8_t rcsts; /* Reservation Status */ uint8_t reserved3[5]; @@ -1479,8 +1475,7 @@ struct nvme_resv_reg_ctrlr _Static_assert(sizeof(struct nvme_resv_reg_ctrlr) == 24, "bad size for nvme_resv_reg_ctrlr"); -struct nvme_resv_reg_ctrlr_ext -{ +struct nvme_resv_reg_ctrlr_ext { uint16_t ctrlr_id; /* Controller ID */ uint8_t rcsts; /* Reservation Status */ uint8_t reserved3[5]; @@ -1491,8 +1486,7 @@ struct nvme_resv_reg_ctrlr_ext _Static_assert(sizeof(struct nvme_resv_reg_ctrlr_ext) == 64, "bad size for nvme_resv_reg_ctrlr_ext"); -struct nvme_resv_status -{ +struct nvme_resv_status { uint32_t gen; /* Generation */ uint8_t rtype; /* Reservation Type */ uint8_t regctl[2]; /* Number of Registered Controllers */ @@ -1504,8 +1498,7 @@ struct nvme_resv_status _Static_assert(sizeof(struct nvme_resv_status) == 24, "bad size for nvme_resv_status"); -struct nvme_resv_status_ext -{ +struct nvme_resv_status_ext { uint32_t gen; /* Generation */ uint8_t rtype; /* Reservation Type */ uint8_t regctl[2]; /* Number of Registered Controllers */ From owner-dev-commits-src-all@freebsd.org Sat Jul 31 00:21: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 B09126513A8; Sat, 31 Jul 2021 00:21: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 4Gc4gr2lgGz4VlM; Sat, 31 Jul 2021 00:21: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 D9BFF6C9B; Sat, 31 Jul 2021 00:21: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 16V0LRnX052019; Sat, 31 Jul 2021 00:21:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V0LRjv052018; Sat, 31 Jul 2021 00:21:27 GMT (envelope-from git) Date: Sat, 31 Jul 2021 00:21:27 GMT Message-Id: <202107310021.16V0LRjv052018@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: 696065e4f21a - stable/12 - NVME: Multiple busdma related fixes. 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/12 X-Git-Reftype: branch X-Git-Commit: 696065e4f21ad9bb52def38726c2f4ed593a2602 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, 31 Jul 2021 00:21:29 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=696065e4f21ad9bb52def38726c2f4ed593a2602 commit 696065e4f21ad9bb52def38726c2f4ed593a2602 Author: Michal Meloun AuthorDate: 2020-12-02 16:54:24 +0000 Commit: Warner Losh CommitDate: 2021-07-31 00:02:52 +0000 NVME: Multiple busdma related fixes. - in nvme_qpair_process_completions() do dma sync before completion buffer is used. - in nvme_qpair_submit_tracker(), don't do explicit wmb() also for arm and arm64. Bus_dmamap_sync() on these architectures is sufficient to ensure that all CPU stores are visible to external (including DMA) observers. - Allocate completion buffer as BUS_DMA_COHERENT. On not-DMA coherent systems, buffers continuously owned (and accessed) by DMA must be allocated with this flag. Note that BUS_DMA_COHERENT flag is no-op on DMA coherent systems (or coherent buses in mixed systems). MFC after: 4 weeks Reviewed by: mav, imp Differential Revision: https://reviews.freebsd.org/D27446 (cherry picked from commit 8f9d5a8dbf4ea69c5f9a1e3a36e23732ffaa5c75) --- sys/dev/nvme/nvme_qpair.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/dev/nvme/nvme_qpair.c b/sys/dev/nvme/nvme_qpair.c index 9be4fc67b923..e43e8285e9bb 100644 --- a/sys/dev/nvme/nvme_qpair.c +++ b/sys/dev/nvme/nvme_qpair.c @@ -550,6 +550,8 @@ nvme_qpair_process_completions(struct nvme_qpair *qpair) if (!qpair->is_enabled) return (false); + bus_dmamap_sync(qpair->dma_tag, qpair->queuemem_map, + BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); /* * A panic can stop the CPU this routine is running on at any point. If * we're called during a panic, complete the sq_head wrap protocol for @@ -583,8 +585,6 @@ nvme_qpair_process_completions(struct nvme_qpair *qpair) } } - bus_dmamap_sync(qpair->dma_tag, qpair->queuemem_map, - BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); while (1) { cpl = qpair->cpl[qpair->cq_head]; @@ -701,7 +701,7 @@ nvme_qpair_construct(struct nvme_qpair *qpair, bus_dma_tag_set_domain(qpair->dma_tag, qpair->domain); if (bus_dmamem_alloc(qpair->dma_tag, (void **)&queuemem, - BUS_DMA_NOWAIT, &qpair->queuemem_map)) { + BUS_DMA_COHERENT | BUS_DMA_NOWAIT, &qpair->queuemem_map)) { nvme_printf(ctrlr, "failed to alloc qpair memory\n"); goto out; } @@ -987,7 +987,7 @@ nvme_qpair_submit_tracker(struct nvme_qpair *qpair, struct nvme_tracker *tr) bus_dmamap_sync(qpair->dma_tag, qpair->queuemem_map, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); -#ifndef __powerpc__ +#if !defined( __powerpc__) && !defined( __aarch64__) && !defined( __arm__) /* * powerpc's bus_dmamap_sync() already includes a heavyweight sync, but * no other archs do. From owner-dev-commits-src-all@freebsd.org Sat Jul 31 00:21: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 304AF651495; Sat, 31 Jul 2021 00:21: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 4Gc4gw5MKwz4VZS; Sat, 31 Jul 2021 00:21: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 675B46DC5; Sat, 31 Jul 2021 00:21: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 16V0LWxg052115; Sat, 31 Jul 2021 00:21:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V0LWxD052114; Sat, 31 Jul 2021 00:21:32 GMT (envelope-from git) Date: Sat, 31 Jul 2021 00:21:32 GMT Message-Id: <202107310021.16V0LWxD052114@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: c7064b73eda5 - stable/12 - nvme: use NVME_GONE rather than hard-coded 0xffffffff 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/12 X-Git-Reftype: branch X-Git-Commit: c7064b73eda5984afddd80b3ec518312b5f307b6 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, 31 Jul 2021 00:21:33 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=c7064b73eda5984afddd80b3ec518312b5f307b6 commit c7064b73eda5984afddd80b3ec518312b5f307b6 Author: Warner Losh AuthorDate: 2021-02-08 20:08:48 +0000 Commit: Warner Losh CommitDate: 2021-07-31 00:02:53 +0000 nvme: use NVME_GONE rather than hard-coded 0xffffffff Make it clearer that the value 0xfffffff is being used to detect the device is gone. We use it other places in the driver for other meanings. (cherry picked from commit 9600aa31aa633bbb9e8a56d91a781d5a7ce2bff6) --- sys/dev/nvme/nvme_ctrlr.c | 6 +++--- sys/dev/nvme/nvme_private.h | 2 ++ sys/dev/nvme/nvme_qpair.c | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c index efc8fbcdf567..2bc0e1081d2b 100644 --- a/sys/dev/nvme/nvme_ctrlr.c +++ b/sys/dev/nvme/nvme_ctrlr.c @@ -260,7 +260,7 @@ nvme_ctrlr_wait_for_ready(struct nvme_controller *ctrlr, int desired_val) while (1) { csts = nvme_mmio_read_4(ctrlr, csts); - if (csts == 0xffffffff) /* Hot unplug. */ + if (csts == NVME_GONE) /* Hot unplug. */ return (ENXIO); if (((csts >> NVME_CSTS_REG_RDY_SHIFT) & NVME_CSTS_REG_RDY_MASK) == desired_val) @@ -1483,7 +1483,7 @@ nvme_ctrlr_destruct(struct nvme_controller *ctrlr, device_t dev) * Check whether it is a hot unplug or a clean driver detach. * If device is not there any more, skip any shutdown commands. */ - gone = (nvme_mmio_read_4(ctrlr, csts) == 0xffffffff); + gone = (nvme_mmio_read_4(ctrlr, csts) == NVME_GONE); if (gone) nvme_ctrlr_fail(ctrlr); else @@ -1561,7 +1561,7 @@ nvme_ctrlr_shutdown(struct nvme_controller *ctrlr) ((uint64_t)ctrlr->cdata.rtd3e * hz + 999999) / 1000000); while (1) { csts = nvme_mmio_read_4(ctrlr, csts); - if (csts == 0xffffffff) /* Hot unplug. */ + if (csts == NVME_GONE) /* Hot unplug. */ break; if (NVME_CSTS_GET_SHST(csts) == NVME_SHST_COMPLETE) break; diff --git a/sys/dev/nvme/nvme_private.h b/sys/dev/nvme/nvme_private.h index 39b5af66501f..f26afbe29542 100644 --- a/sys/dev/nvme/nvme_private.h +++ b/sys/dev/nvme/nvme_private.h @@ -104,6 +104,8 @@ MALLOC_DECLARE(M_NVME); #define CACHE_LINE_SIZE (64) #endif +#define NVME_GONE 0xfffffffful + extern int32_t nvme_retry_count; extern bool nvme_verbose_cmd_dump; diff --git a/sys/dev/nvme/nvme_qpair.c b/sys/dev/nvme/nvme_qpair.c index 651eee121be1..e188ef9e3ebd 100644 --- a/sys/dev/nvme/nvme_qpair.c +++ b/sys/dev/nvme/nvme_qpair.c @@ -950,7 +950,7 @@ nvme_timeout(void *arg) nvme_abort_complete, tr); } else { nvme_printf(ctrlr, "Resetting controller due to a timeout%s.\n", - (csts == 0xffffffff) ? " and possible hot unplug" : + (csts == NVME_GONE) ? " and possible hot unplug" : (cfs ? " and fatal error status" : "")); nvme_ctrlr_reset(ctrlr); } From owner-dev-commits-src-all@freebsd.org Sat Jul 31 00:21: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 04E30651410; Sat, 31 Jul 2021 00:21: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 4Gc4gm6Lqkz4VtG; Sat, 31 Jul 2021 00:21: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 7C3AC6BAC; Sat, 31 Jul 2021 00:21: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 16V0LOCE051409; Sat, 31 Jul 2021 00:21:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V0LOem051400; Sat, 31 Jul 2021 00:21:24 GMT (envelope-from git) Date: Sat, 31 Jul 2021 00:21:24 GMT Message-Id: <202107310021.16V0LOem051400@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: f502f8abe08b - stable/12 - nvme: change namei_request_zone into a malloc type 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/12 X-Git-Reftype: branch X-Git-Commit: f502f8abe08b1b39ec3b53eeaadf7dfad8930574 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, 31 Jul 2021 00:21:26 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=f502f8abe08b1b39ec3b53eeaadf7dfad8930574 commit f502f8abe08b1b39ec3b53eeaadf7dfad8930574 Author: Mateusz Guzik AuthorDate: 2020-11-05 21:44:58 +0000 Commit: Warner Losh CommitDate: 2021-07-31 00:02:52 +0000 nvme: change namei_request_zone into a malloc type Both the size (128 bytes) and ephemeral nature of allocations make it a great fit for malloc. A dedicated zone unnecessarily avoids sharing buckets with 128-byte objects. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D27103 (cherry picked from commit 71460dfcb275f0a2a20b39a332b0e1149c6e7e3f) --- sys/dev/nvme/nvme.c | 5 ----- sys/dev/nvme/nvme_private.h | 5 ++--- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/sys/dev/nvme/nvme.c b/sys/dev/nvme/nvme.c index 843aa80bb4fb..8e5bc11b35d4 100644 --- a/sys/dev/nvme/nvme.c +++ b/sys/dev/nvme/nvme.c @@ -49,7 +49,6 @@ struct nvme_consumer { struct nvme_consumer nvme_consumer[NVME_MAX_CONSUMERS]; #define INVALID_CONSUMER_ID 0xFFFF -uma_zone_t nvme_request_zone; int32_t nvme_retry_count; @@ -62,9 +61,6 @@ nvme_init(void) { uint32_t i; - nvme_request_zone = uma_zcreate("nvme_request", - sizeof(struct nvme_request), NULL, NULL, NULL, NULL, 0, 0); - for (i = 0; i < NVME_MAX_CONSUMERS; i++) nvme_consumer[i].id = INVALID_CONSUMER_ID; } @@ -74,7 +70,6 @@ SYSINIT(nvme_register, SI_SUB_DRIVERS, SI_ORDER_SECOND, nvme_init, NULL); static void nvme_uninit(void) { - uma_zdestroy(nvme_request_zone); } SYSUNINIT(nvme_unregister, SI_SUB_DRIVERS, SI_ORDER_SECOND, nvme_uninit, NULL); diff --git a/sys/dev/nvme/nvme_private.h b/sys/dev/nvme/nvme_private.h index 2e2c383f455f..39b5af66501f 100644 --- a/sys/dev/nvme/nvme_private.h +++ b/sys/dev/nvme/nvme_private.h @@ -104,7 +104,6 @@ MALLOC_DECLARE(M_NVME); #define CACHE_LINE_SIZE (64) #endif -extern uma_zone_t nvme_request_zone; extern int32_t nvme_retry_count; extern bool nvme_verbose_cmd_dump; @@ -488,7 +487,7 @@ _nvme_allocate_request(nvme_cb_fn_t cb_fn, void *cb_arg) { struct nvme_request *req; - req = uma_zalloc(nvme_request_zone, M_NOWAIT | M_ZERO); + req = malloc(sizeof(*req), M_NVME, M_NOWAIT | M_ZERO); if (req != NULL) { req->cb_fn = cb_fn; req->cb_arg = cb_arg; @@ -550,7 +549,7 @@ nvme_allocate_request_ccb(union ccb *ccb, nvme_cb_fn_t cb_fn, void *cb_arg) return (req); } -#define nvme_free_request(req) uma_zfree(nvme_request_zone, req) +#define nvme_free_request(req) free(req, M_NVME) void nvme_notify_async_consumers(struct nvme_controller *ctrlr, const struct nvme_completion *async_cpl, From owner-dev-commits-src-all@freebsd.org Sat Jul 31 00:21: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 F41D665106B; Sat, 31 Jul 2021 00:21: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 4Gc4gn6HpSz4Vl3; Sat, 31 Jul 2021 00:21: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 9A9D26A5A; Sat, 31 Jul 2021 00:21: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 16V0LPMY051963; Sat, 31 Jul 2021 00:21:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V0LPji051962; Sat, 31 Jul 2021 00:21:25 GMT (envelope-from git) Date: Sat, 31 Jul 2021 00:21:25 GMT Message-Id: <202107310021.16V0LPji051962@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: 2c54d6d4df6d - stable/12 - Unbreak r368167 in userland. Decorate unused arguments. 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/12 X-Git-Reftype: branch X-Git-Commit: 2c54d6d4df6de4bf3ae79c61cc61e9738ffdc171 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, 31 Jul 2021 00:21:27 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=2c54d6d4df6de4bf3ae79c61cc61e9738ffdc171 commit 2c54d6d4df6de4bf3ae79c61cc61e9738ffdc171 Author: Michal Meloun AuthorDate: 2020-11-30 14:51:48 +0000 Commit: Warner Losh CommitDate: 2021-07-31 00:02:52 +0000 Unbreak r368167 in userland. Decorate unused arguments. Reported by: kp, tuexen, jenkins, and many others MFC with: r368167 (cherry picked from commit b2e9e573a392a973bea0ff180932913b7aa0eb66) --- sys/dev/nvme/nvme.h | 41 ++++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/sys/dev/nvme/nvme.h b/sys/dev/nvme/nvme.h index 982c994d6433..4ca4ea3373f6 100644 --- a/sys/dev/nvme/nvme.h +++ b/sys/dev/nvme/nvme.h @@ -1738,9 +1738,15 @@ extern int nvme_use_nvd; #endif /* _KERNEL */ +#if _BYTE_ORDER != _LITTLE_ENDIAN +#define MODIF +#else +#define MODIF __unused +#endif + /* Endianess conversion functions for NVMe structs */ static inline -void nvme_completion_swapbytes(struct nvme_completion *s __unused) +void nvme_completion_swapbytes(struct nvme_completion *s MODIF) { #if _BYTE_ORDER != _LITTLE_ENDIAN @@ -1754,7 +1760,7 @@ void nvme_completion_swapbytes(struct nvme_completion *s __unused) } static inline -void nvme_power_state_swapbytes(struct nvme_power_state *s __unused) +void nvme_power_state_swapbytes(struct nvme_power_state *s MODIF) { #if _BYTE_ORDER != _LITTLE_ENDIAN @@ -1767,7 +1773,7 @@ void nvme_power_state_swapbytes(struct nvme_power_state *s __unused) } static inline -void nvme_controller_data_swapbytes(struct nvme_controller_data *s __unused) +void nvme_controller_data_swapbytes(struct nvme_controller_data *s MODIF) { #if _BYTE_ORDER != _LITTLE_ENDIAN int i; @@ -1819,7 +1825,7 @@ void nvme_controller_data_swapbytes(struct nvme_controller_data *s __unused) } static inline -void nvme_namespace_data_swapbytes(struct nvme_namespace_data *s __unused) +void nvme_namespace_data_swapbytes(struct nvme_namespace_data *s MODIF) { #if _BYTE_ORDER != _LITTLE_ENDIAN int i; @@ -1849,7 +1855,7 @@ void nvme_namespace_data_swapbytes(struct nvme_namespace_data *s __unused) static inline void nvme_error_information_entry_swapbytes( - struct nvme_error_information_entry *s __unused) + struct nvme_error_information_entry *s MODIF) { #if _BYTE_ORDER != _LITTLE_ENDIAN @@ -1866,7 +1872,7 @@ void nvme_error_information_entry_swapbytes( } static inline -void nvme_le128toh(void *p __unused) +void nvme_le128toh(void *p MODIF) { #if _BYTE_ORDER != _LITTLE_ENDIAN /* Swap 16 bytes in place */ @@ -1883,7 +1889,7 @@ void nvme_le128toh(void *p __unused) static inline void nvme_health_information_page_swapbytes( - struct nvme_health_information_page *s __unused) + struct nvme_health_information_page *s MODIF) { #if _BYTE_ORDER != _LITTLE_ENDIAN int i; @@ -1912,7 +1918,7 @@ void nvme_health_information_page_swapbytes( static inline -void nvme_firmware_page_swapbytes(struct nvme_firmware_page *s __unused) +void nvme_firmware_page_swapbytes(struct nvme_firmware_page *s MODIF) { #if _BYTE_ORDER != _LITTLE_ENDIAN int i; @@ -1923,7 +1929,7 @@ void nvme_firmware_page_swapbytes(struct nvme_firmware_page *s __unused) } static inline -void nvme_ns_list_swapbytes(struct nvme_ns_list *s __unused) +void nvme_ns_list_swapbytes(struct nvme_ns_list *s MODIF) { #if _BYTE_ORDER != _LITTLE_ENDIAN int i; @@ -1935,7 +1941,7 @@ void nvme_ns_list_swapbytes(struct nvme_ns_list *s __unused) static inline void nvme_command_effects_page_swapbytes( - struct nvme_command_effects_page *s __unused) + struct nvme_command_effects_page *s MODIF) { #if _BYTE_ORDER != _LITTLE_ENDIAN int i; @@ -1949,7 +1955,7 @@ void nvme_command_effects_page_swapbytes( static inline void nvme_res_notification_page_swapbytes( - struct nvme_res_notification_page *s __unused) + struct nvme_res_notification_page *s MODIF) { #if _BYTE_ORDER != _LITTLE_ENDIAN s->log_page_count = le64toh(s->log_page_count); @@ -1959,7 +1965,7 @@ void nvme_res_notification_page_swapbytes( static inline void nvme_sanitize_status_page_swapbytes( - struct nvme_sanitize_status_page *s __unused) + struct nvme_sanitize_status_page *s MODIF) { #if _BYTE_ORDER != _LITTLE_ENDIAN s->sprog = le16toh(s->sprog); @@ -1975,7 +1981,7 @@ void nvme_sanitize_status_page_swapbytes( } static inline -void intel_log_temp_stats_swapbytes(struct intel_log_temp_stats *s __unused) +void intel_log_temp_stats_swapbytes(struct intel_log_temp_stats *s MODIF) { #if _BYTE_ORDER != _LITTLE_ENDIAN @@ -1992,8 +1998,8 @@ void intel_log_temp_stats_swapbytes(struct intel_log_temp_stats *s __unused) } static inline -void nvme_resv_status_swapbytes(struct nvme_resv_status *s __unused, - size_t size __unused) +void nvme_resv_status_swapbytes(struct nvme_resv_status *s MODIF, + size_t size MODIF) { #if _BYTE_ORDER != _LITTLE_ENDIAN u_int i, n; @@ -2010,8 +2016,8 @@ void nvme_resv_status_swapbytes(struct nvme_resv_status *s __unused, } static inline -void nvme_resv_status_ext_swapbytes(struct nvme_resv_status_ext *s __unused, - size_t size __unused) +void nvme_resv_status_ext_swapbytes(struct nvme_resv_status_ext *s MODIF, + size_t size MODIF) { #if _BYTE_ORDER != _LITTLE_ENDIAN u_int i, n; @@ -2026,5 +2032,6 @@ void nvme_resv_status_ext_swapbytes(struct nvme_resv_status_ext *s __unused, } #endif } +#undef MODIF #endif /* __NVME_H__ */ From owner-dev-commits-src-all@freebsd.org Sat Jul 31 00:21: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 17D506512E1; Sat, 31 Jul 2021 00:21: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 4Gc4gy179Hz4VZX; Sat, 31 Jul 2021 00:21: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 8D45A6B6E; Sat, 31 Jul 2021 00:21: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 16V0LXpj052145; Sat, 31 Jul 2021 00:21:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V0LXq7052144; Sat, 31 Jul 2021 00:21:33 GMT (envelope-from git) Date: Sat, 31 Jul 2021 00:21:33 GMT Message-Id: <202107310021.16V0LXq7052144@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: d0f91d7de3f9 - stable/12 - nvme: Make nvme_ctrlr_hw_reset static 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/12 X-Git-Reftype: branch X-Git-Commit: d0f91d7de3f97259fc86bf615da5cf9357a3d066 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, 31 Jul 2021 00:21:35 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=d0f91d7de3f97259fc86bf615da5cf9357a3d066 commit d0f91d7de3f97259fc86bf615da5cf9357a3d066 Author: Warner Losh AuthorDate: 2021-02-08 20:28:18 +0000 Commit: Warner Losh CommitDate: 2021-07-31 00:02:53 +0000 nvme: Make nvme_ctrlr_hw_reset static nvme_ctrlr_hw_reset is no longer used outside of nvme_ctrlr.c, so make it static. If we need to change this in the future we can. (cherry picked from commit dd2516fc078f15633ad5aedaad6de140cb491f80) --- sys/dev/nvme/nvme_ctrlr.c | 2 +- sys/dev/nvme/nvme_private.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c index 2bc0e1081d2b..d4d472878b82 100644 --- a/sys/dev/nvme/nvme_ctrlr.c +++ b/sys/dev/nvme/nvme_ctrlr.c @@ -402,7 +402,7 @@ nvme_ctrlr_disable_qpairs(struct nvme_controller *ctrlr) } } -int +static int nvme_ctrlr_hw_reset(struct nvme_controller *ctrlr) { int err; diff --git a/sys/dev/nvme/nvme_private.h b/sys/dev/nvme/nvme_private.h index f26afbe29542..001d45f2acc4 100644 --- a/sys/dev/nvme/nvme_private.h +++ b/sys/dev/nvme/nvme_private.h @@ -405,7 +405,6 @@ void nvme_completion_poll_cb(void *arg, const struct nvme_completion *cpl); int nvme_ctrlr_construct(struct nvme_controller *ctrlr, device_t dev); void nvme_ctrlr_destruct(struct nvme_controller *ctrlr, device_t dev); void nvme_ctrlr_shutdown(struct nvme_controller *ctrlr); -int nvme_ctrlr_hw_reset(struct nvme_controller *ctrlr); void nvme_ctrlr_reset(struct nvme_controller *ctrlr); /* ctrlr defined as void * to allow use with config_intrhook. */ void nvme_ctrlr_start_config_hook(void *ctrlr_arg); From owner-dev-commits-src-all@freebsd.org Sat Jul 31 00:21: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 42F72651087; Sat, 31 Jul 2021 00:21: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 4Gc4h24MmCz4W0m; Sat, 31 Jul 2021 00:21: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 1F2366E09; Sat, 31 Jul 2021 00:21: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 16V0Lc3g052241; Sat, 31 Jul 2021 00:21:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V0LctC052240; Sat, 31 Jul 2021 00:21:38 GMT (envelope-from git) Date: Sat, 31 Jul 2021 00:21:38 GMT Message-Id: <202107310021.16V0LctC052240@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: d85d7244d8bb - stable/12 - nvme: Fix alignment on nvme structures 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/12 X-Git-Reftype: branch X-Git-Commit: d85d7244d8bb20d5d5040045856c8038333736ce 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, 31 Jul 2021 00:21:39 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=d85d7244d8bb20d5d5040045856c8038333736ce commit d85d7244d8bb20d5d5040045856c8038333736ce Author: Warner Losh AuthorDate: 2021-07-02 21:58:19 +0000 Commit: Warner Losh CommitDate: 2021-07-31 00:02:53 +0000 nvme: Fix alignment on nvme structures Remove __packed from nvme_command, nvme_completion and nvme_dsm_trim. Add super-alignment to nvme_completion since it's always at least that aligned in hardware (and in our existing uses of it embedded in structures). It generates better code in nvme_qpair_process_completions on riscv64 because otherwise the ABI assumes a 4-byte alignment, and the same on all other platforms. Reviewed by: jrtc27@, mav@, chuck@ Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D31001 (cherry picked from commit fea3cf1d6da0acf40bc1d3dadeeea7eeccbc10dd) --- sys/dev/nvme/nvme.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sys/dev/nvme/nvme.h b/sys/dev/nvme/nvme.h index d53bf3dd9357..fa0ac546e9c8 100644 --- a/sys/dev/nvme/nvme.h +++ b/sys/dev/nvme/nvme.h @@ -578,8 +578,8 @@ struct nvme_registers { struct { uint32_t sq_tdbl; /* submission queue tail doorbell */ uint32_t cq_hdbl; /* completion queue head doorbell */ - } doorbell[1] __packed; -} __packed; + } doorbell[1]; +}; _Static_assert(sizeof(struct nvme_registers) == 0x1008, "bad size for nvme_registers"); @@ -612,7 +612,7 @@ struct nvme_command { uint32_t cdw13; /* command-specific */ uint32_t cdw14; /* command-specific */ uint32_t cdw15; /* command-specific */ -} __packed; +}; _Static_assert(sizeof(struct nvme_command) == 16 * 4, "bad size for nvme_command"); @@ -631,7 +631,7 @@ struct nvme_completion { /* dword 3 */ uint16_t cid; /* command identifier */ uint16_t status; -} __packed; +} __aligned(8); /* riscv: nvme_qpair_process_completions has better code gen */ _Static_assert(sizeof(struct nvme_completion) == 4 * 4, "bad size for nvme_completion"); @@ -639,7 +639,7 @@ struct nvme_dsm_range { uint32_t attributes; uint32_t length; uint64_t starting_lba; -} __packed; +}; /* Largest DSM Trim that can be done */ #define NVME_MAX_DSM_TRIM 4096 From owner-dev-commits-src-all@freebsd.org Sat Jul 31 00:21: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 B0871651177; Sat, 31 Jul 2021 00:21: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 4Gc4h02BRZz4Vtf; Sat, 31 Jul 2021 00:21: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 CB8CD6DC6; Sat, 31 Jul 2021 00:21: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 16V0LZLg052193; Sat, 31 Jul 2021 00:21:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V0LZrM052192; Sat, 31 Jul 2021 00:21:35 GMT (envelope-from git) Date: Sat, 31 Jul 2021 00:21:35 GMT Message-Id: <202107310021.16V0LZrM052192@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: 225c0eda7efb - stable/12 - nvme: fix a race between failing the controller and failing requests 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/12 X-Git-Reftype: branch X-Git-Commit: 225c0eda7efb73c9af75fc54c434b0ec694f506a 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, 31 Jul 2021 00:21:37 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=225c0eda7efb73c9af75fc54c434b0ec694f506a commit 225c0eda7efb73c9af75fc54c434b0ec694f506a Author: Warner Losh AuthorDate: 2021-05-29 05:01:52 +0000 Commit: Warner Losh CommitDate: 2021-07-31 00:02:53 +0000 nvme: fix a race between failing the controller and failing requests Part of the nvme recovery process for errors is to reset the card. Sometimes, this results in failing the entire controller. When nda is in use, we free the sim, which will sleep until all the I/O has completed. However, with only one thread, the request fail task never runs once the reset thread sleeps here. Create two threads to allow I/O to fail until it's all processed and the reset task can proceed. This is a temporary kludge until I can work out questions that arose during the review, not least is what was the race that queueing to a failure task solved. The original commit is vague and other error paths in the same context do a direct failure. I'll investigate that more completely before committing changing that to a direct failure. mav@ raised this issue during the review, but didn't otherwise object. Multiple threads, though, solve the problem in the mean time until other such means can be perfected. Reviewed by: jhb@ Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D30366 (cherry picked from commit f0f47121653e88197d8537572294b90f5aef7f17) --- sys/dev/nvme/nvme_ctrlr.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c index 007e0758023a..0cd2c31ab086 100644 --- a/sys/dev/nvme/nvme_ctrlr.c +++ b/sys/dev/nvme/nvme_ctrlr.c @@ -1442,9 +1442,20 @@ nvme_ctrlr_construct(struct nvme_controller *ctrlr, device_t dev) if (nvme_ctrlr_construct_admin_qpair(ctrlr) != 0) return (ENXIO); + /* + * Create 2 threads for the taskqueue. The reset thread will block when + * it detects that the controller has failed until all I/O has been + * failed up the stack. The fail_req task needs to be able to run in + * this case to finish the request failure for some cases. + * + * We could partially solve this race by draining the failed requeust + * queue before proceding to free the sim, though nothing would stop + * new I/O from coming in after we do that drain, but before we reach + * cam_sim_free, so this big hammer is used instead. + */ ctrlr->taskqueue = taskqueue_create("nvme_taskq", M_WAITOK, taskqueue_thread_enqueue, &ctrlr->taskqueue); - taskqueue_start_threads(&ctrlr->taskqueue, 1, PI_DISK, "nvme taskq"); + taskqueue_start_threads(&ctrlr->taskqueue, 2, PI_DISK, "nvme taskq"); ctrlr->is_resetting = 0; ctrlr->is_initialized = 0; From owner-dev-commits-src-all@freebsd.org Sat Jul 31 02:02: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 AE3E46534E0; Sat, 31 Jul 2021 02:02: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 4Gc6wG4PGNz4jHh; Sat, 31 Jul 2021 02:02: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 7F3AE10622; Sat, 31 Jul 2021 02:02: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 16V22MWq085065; Sat, 31 Jul 2021 02:02:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V22MXs085064; Sat, 31 Jul 2021 02:02:22 GMT (envelope-from git) Date: Sat, 31 Jul 2021 02:02:22 GMT Message-Id: <202107310202.16V22MXs085064@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: 3ff5432f9262 - stable/12 - Fix 32-bit build post 6733401935f83754b4b2744bc3d33ef84b1271e0 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/12 X-Git-Reftype: branch X-Git-Commit: 3ff5432f9262b69db4fdac328c16ae6381e837ac 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, 31 Jul 2021 02:02:22 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=3ff5432f9262b69db4fdac328c16ae6381e837ac commit 3ff5432f9262b69db4fdac328c16ae6381e837ac Author: Dimitry Andric AuthorDate: 2021-01-08 22:38:21 +0000 Commit: Warner Losh CommitDate: 2021-07-31 02:01:01 +0000 Fix 32-bit build post 6733401935f83754b4b2744bc3d33ef84b1271e0 The general style in sbin/nvmecontrol apppears to print uint64_t types using %j, so I'm using that instead of the more general (but admittedly ugly) PRIu64. (cherry picked from commit a82f07fc2e2456b0ddc847d611f56a3152a6f940) --- sbin/nvmecontrol/logpage.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sbin/nvmecontrol/logpage.c b/sbin/nvmecontrol/logpage.c index f00d5d94897b..7daf012499a2 100644 --- a/sbin/nvmecontrol/logpage.c +++ b/sbin/nvmecontrol/logpage.c @@ -678,7 +678,7 @@ print_log_self_test_status(const struct nvme_controller_data *cdata __unused, if (dst->result[r].valid_diag_info & BIT(1)) { memcpy(&failing_lba, dst->result[r].failing_lba, sizeof(failing_lba)); - printf(" FLBA=0x%lx", failing_lba); + printf(" FLBA=0x%jx", failing_lba); } if (dst->result[r].valid_diag_info & BIT(2)) printf(" SCT=0x%x", dst->result[r].status_code_type); From owner-dev-commits-src-all@freebsd.org Sat Jul 31 04:16: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 86DD5654FDD; Sat, 31 Jul 2021 04:16:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gc9vT2vFHz4sCq; Sat, 31 Jul 2021 04:16:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4B746122E0; Sat, 31 Jul 2021 04:16: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 16V4Gr0s060353; Sat, 31 Jul 2021 04:16:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V4GrTh060352; Sat, 31 Jul 2021 04:16:53 GMT (envelope-from git) Date: Sat, 31 Jul 2021 04:16:53 GMT Message-Id: <202107310416.16V4GrTh060352@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: 97c0b5ab18b6 - main - acpica: Import ACPICA 20210730 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: 97c0b5ab18b6131ab11ed03b38d5e239fc811a3e 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, 31 Jul 2021 04:16:53 -0000 The branch main has been updated by jkim: URL: https://cgit.FreeBSD.org/src/commit/?id=97c0b5ab18b6131ab11ed03b38d5e239fc811a3e commit 97c0b5ab18b6131ab11ed03b38d5e239fc811a3e Author: Jung-uk Kim AuthorDate: 2021-07-31 00:05:50 +0000 Commit: Jung-uk Kim CommitDate: 2021-07-31 04:16:27 +0000 acpica: Import ACPICA 20210730 (cherry picked from commit 34cfdff1f386b2d7bf0a8ea873acf604753991e6) --- sys/contrib/dev/acpica/changes.txt | 42 ++++ sys/contrib/dev/acpica/common/adisasm.c | 2 +- sys/contrib/dev/acpica/common/ahtable.c | 1 + sys/contrib/dev/acpica/common/dmtable.c | 147 ++++++++++++++ sys/contrib/dev/acpica/common/dmtbdump1.c | 219 +++++++++++++++++++++ sys/contrib/dev/acpica/common/dmtbdump3.c | 14 +- sys/contrib/dev/acpica/common/dmtbinfo1.c | 138 +++++++++++++ sys/contrib/dev/acpica/common/dmtbinfo3.c | 3 +- sys/contrib/dev/acpica/compiler/aslmethod.c | 83 +++++++- sys/contrib/dev/acpica/compiler/aslutils.c | 6 +- sys/contrib/dev/acpica/compiler/dtcompiler.h | 5 + sys/contrib/dev/acpica/compiler/dtfield.c | 4 +- sys/contrib/dev/acpica/compiler/dttable1.c | 217 ++++++++++++++++++++ sys/contrib/dev/acpica/compiler/dttable2.c | 26 ++- sys/contrib/dev/acpica/compiler/dttemplate.h | 94 +++++++++ sys/contrib/dev/acpica/compiler/dtutils.c | 10 +- .../dev/acpica/components/dispatcher/dswexec.c | 2 +- sys/contrib/dev/acpica/include/acdisasm.h | 22 +++ sys/contrib/dev/acpica/include/acnames.h | 1 + sys/contrib/dev/acpica/include/acoutput.h | 2 +- sys/contrib/dev/acpica/include/acpixf.h | 2 +- sys/contrib/dev/acpica/include/actbinfo.h | 15 ++ sys/contrib/dev/acpica/include/actbl1.h | 16 +- sys/contrib/dev/acpica/include/actbl2.h | 194 ++++++++++++++++++ sys/contrib/dev/acpica/include/actbl3.h | 6 + 25 files changed, 1242 insertions(+), 29 deletions(-) diff --git a/sys/contrib/dev/acpica/changes.txt b/sys/contrib/dev/acpica/changes.txt index 31b4eaff62fb..64ca5cccdce4 100644 --- a/sys/contrib/dev/acpica/changes.txt +++ b/sys/contrib/dev/acpica/changes.txt @@ -1,3 +1,45 @@ +---------------------------------------- +30 July 2021. Summary of changes for version 20210730: + +This release is available at https://acpica.org/downloads + +1) ACPICA kernel-resident subsystem: + +2) iASL Compiler/Disassembler and ACPICA tools: + +iasl: Check usage of _CRS, _DIS, _PRS, and _SRS objects (July 2021). + Under the Device Object: + 1) If _DIS is present, must have a _CRS and _SRS + 2) If _PRS is present, must have a _CRS, _DIS, and _SRS + 3) If _SRS is present, must have a _CRS and _DIS +A warning will be issued for each of these cases. +Note: For existing ASL/projects, these warnings may be disabled by +specifying this on the command line: +"-vw 3141" + +iASL Table Disassembler/Table compiler: Fix for WPBT table with no +command-line arguments. Handle the case where the Command-line +Arguments table field does not exist (zero). + +Headers: Add new DBG2 Serial Port Subtypes +The Microsoft Debug Port Table 2 (DBG2) specification revision +September 21, 2020 comprises additional Serial Port Subtypes [1]. +Reflect that in the actbl1.h header file. Submitted by: +semihalf-wojtas-marcin + +iASL: Add full support for the AEST table (data compiler) +Includes support in the table compiler and the disassembler. + +Add PRMT module header to facilitate parsing. +This structure is used in to parse PRMT in other Operating Systems +that relies on using subtable headers in order to parse ACPI tables. +Although the PRMT doesn't have "subtables" it has a list of module +information structures that act as subtables. + +iASL: Table disassembler: Add missing strings to decode subtable types. +Includes the MADT and CEDT tables. + + ---------------------------------------- 04 June 2021. Summary of changes for version 20210604: diff --git a/sys/contrib/dev/acpica/common/adisasm.c b/sys/contrib/dev/acpica/common/adisasm.c index 1c45e52413fd..40ca45dc7bfd 100644 --- a/sys/contrib/dev/acpica/common/adisasm.c +++ b/sys/contrib/dev/acpica/common/adisasm.c @@ -478,7 +478,7 @@ AdDisassembleOneTable ( AcpiOsPrintf (" * ACPI Data Table [%4.4s]\n *\n", Table->Signature); AcpiOsPrintf (" * Format: [HexOffset DecimalOffset ByteLength] " - "FieldName : FieldValue\n */\n\n"); + "FieldName : FieldValue (in hex)\n */\n\n"); AcpiDmDumpDataTable (Table); fprintf (stderr, "Acpi Data Table [%4.4s] decoded\n", diff --git a/sys/contrib/dev/acpica/common/ahtable.c b/sys/contrib/dev/acpica/common/ahtable.c index b1da441deda4..d0eb397126f2 100644 --- a/sys/contrib/dev/acpica/common/ahtable.c +++ b/sys/contrib/dev/acpica/common/ahtable.c @@ -199,6 +199,7 @@ AcpiAhGetTableInfo ( */ const AH_TABLE AcpiGbl_SupportedTables[] = { + {ACPI_SIG_AEST, "Arm Error Source Table"}, {ACPI_SIG_ASF, "Alert Standard Format Table"}, {ACPI_SIG_BDAT, "BIOS Data ACPI Table"}, {ACPI_SIG_BERT, "Boot Error Record Table"}, diff --git a/sys/contrib/dev/acpica/common/dmtable.c b/sys/contrib/dev/acpica/common/dmtable.c index cc72fa0512a8..cbef83364e73 100644 --- a/sys/contrib/dev/acpica/common/dmtable.c +++ b/sys/contrib/dev/acpica/common/dmtable.c @@ -174,6 +174,55 @@ AcpiAhGetTableInfo ( /* These tables map a subtable type to a description string */ +static const char *AcpiDmAestResourceNames[] = +{ + "Cache Resource", + "TLB Resource", + "Generic Resource", + "Unknown Resource Type" /* Reserved */ +}; + +static const char *AcpiDmAestSubnames[] = +{ + "Processor Error Node", + "Memory Error Node", + "SMMU Error Node", + "Vendor-defined Error Node", + "GIC Error Node", + "Unknown Subtable Type" /* Reserved */ +}; + +static const char *AcpiDmAestCacheNames[] = +{ + "Data Cache", + "Instruction Cache", + "Unified Cache", + "Unknown Cache Type" /* Reserved */ +}; + +static const char *AcpiDmAestGicNames[] = +{ + "GIC CPU", + "GIC Distributor", + "GIC Redistributor", + "GIC ITS", + "Unknown GIC Interface Type" /* Reserved */ +}; + +static const char *AcpiDmAestXfaceNames[] = +{ + "System Register Interface", + "Memory Mapped Interface", + "Unknown Interface Type" /* Reserved */ +}; + +static const char *AcpiDmAestXruptNames[] = +{ + "Fault Handling Interrupt", + "Error Recovery Interrupt", + "Unknown Interrupt Type" /* Reserved */ +}; + static const char *AcpiDmAsfSubnames[] = { "ASF Information", @@ -533,6 +582,7 @@ static const char *AcpiDmGasAccessWidth[] = const ACPI_DMTABLE_DATA AcpiDmTableData[] = { + {ACPI_SIG_AEST, NULL, AcpiDmDumpAest, DtCompileAest, TemplateAest}, {ACPI_SIG_ASF, NULL, AcpiDmDumpAsf, DtCompileAsf, TemplateAsf}, {ACPI_SIG_BDAT, AcpiDmTableInfoBdat, NULL, NULL, TemplateBdat}, {ACPI_SIG_BERT, AcpiDmTableInfoBert, NULL, NULL, TemplateBert}, @@ -1006,6 +1056,10 @@ AcpiDmDumpTable ( case ACPI_DMT_RGRT: case ACPI_DMT_SDEV: case ACPI_DMT_SRAT: + case ACPI_DMT_AEST: + case ACPI_DMT_AEST_RES: + case ACPI_DMT_AEST_XFACE: + case ACPI_DMT_AEST_XRUPT: case ACPI_DMT_ASF: case ACPI_DMT_HESTNTYP: case ACPI_DMT_FADTPM: @@ -1035,6 +1089,8 @@ AcpiDmDumpTable ( break; case ACPI_DMT_UINT32: + case ACPI_DMT_AEST_CACHE: + case ACPI_DMT_AEST_GIC: case ACPI_DMT_NAME4: case ACPI_DMT_SIG: case ACPI_DMT_LPIT: @@ -1087,6 +1143,12 @@ AcpiDmDumpTable ( ByteLength = 128; break; + case ACPI_DMT_WPBT_UNICODE: + + ByteLength = SubtableLength; + CurrentOffset = sizeof (ACPI_TABLE_WPBT); + break; + case ACPI_DMT_UNICODE: case ACPI_DMT_BUFFER: case ACPI_DMT_RAW_BUFFER: @@ -1418,6 +1480,90 @@ AcpiDmDumpTable ( LastOutputBlankLine = TRUE; break; + case ACPI_DMT_AEST: + + /* AEST subtable types */ + + Temp8 = *Target; + if (Temp8 > ACPI_AEST_NODE_TYPE_RESERVED) + { + Temp8 = ACPI_AEST_NODE_TYPE_RESERVED; + } + + AcpiOsPrintf (UINT8_FORMAT, *Target, + AcpiDmAestSubnames[Temp8]); + break; + + case ACPI_DMT_AEST_CACHE: + + /* AEST cache resource subtable */ + + Temp32 = *Target; + if (Temp32 > ACPI_AEST_CACHE_RESERVED) + { + Temp32 = ACPI_AEST_CACHE_RESERVED; + } + + AcpiOsPrintf (UINT32_FORMAT, *Target, + AcpiDmAestCacheNames[Temp32]); + break; + + case ACPI_DMT_AEST_GIC: + + /* AEST GIC error subtable */ + + Temp32 = *Target; + if (Temp32 > ACPI_AEST_GIC_RESERVED) + { + Temp32 = ACPI_AEST_GIC_RESERVED; + } + + AcpiOsPrintf (UINT32_FORMAT, *Target, + AcpiDmAestGicNames[Temp32]); + break; + + case ACPI_DMT_AEST_RES: + + /* AEST resource type subtable */ + + Temp8 = *Target; + if (Temp8 > ACPI_AEST_RESOURCE_RESERVED) + { + Temp8 = ACPI_AEST_RESOURCE_RESERVED; + } + + AcpiOsPrintf (UINT8_FORMAT, *Target, + AcpiDmAestResourceNames[Temp8]); + break; + + case ACPI_DMT_AEST_XFACE: + + /* AEST interface structure types */ + + Temp8 = *Target; + if (Temp8 > ACPI_AEST_XFACE_RESERVED) + { + Temp8 = ACPI_AEST_XFACE_RESERVED; + } + + AcpiOsPrintf (UINT8_FORMAT, *Target, + AcpiDmAestXfaceNames[Temp8]); + break; + + case ACPI_DMT_AEST_XRUPT: + + /* AEST interrupt structure types */ + + Temp8 = *Target; + if (Temp8 > ACPI_AEST_XRUPT_RESERVED) + { + Temp8 = ACPI_AEST_XRUPT_RESERVED; + } + + AcpiOsPrintf (UINT8_FORMAT, *Target, + AcpiDmAestXruptNames[Temp8]); + break; + case ACPI_DMT_ASF: /* ASF subtable types */ @@ -1704,6 +1850,7 @@ AcpiDmDumpTable ( break; case ACPI_DMT_UNICODE: + case ACPI_DMT_WPBT_UNICODE: if (ByteLength == 0) { diff --git a/sys/contrib/dev/acpica/common/dmtbdump1.c b/sys/contrib/dev/acpica/common/dmtbdump1.c index d134c63f856a..a3f7f0a3c9d3 100644 --- a/sys/contrib/dev/acpica/common/dmtbdump1.c +++ b/sys/contrib/dev/acpica/common/dmtbdump1.c @@ -160,6 +160,225 @@ ACPI_MODULE_NAME ("dmtbdump1") +/******************************************************************************* + * + * FUNCTION: AcpiDmDumpAest + * + * PARAMETERS: Table - A AEST table + * + * RETURN: None + * + * DESCRIPTION: Format the contents of a AEST table + * + * NOTE: Assumes the following table structure: + * For all AEST Error Nodes: + * 1) An AEST Error Node, followed immediately by: + * 2) Any node-specific data + * 3) An Interface Structure (one) + * 4) A list (array) of Interrupt Structures + * + * AEST - ARM Error Source table. Conforms to: + * ACPI for the Armv8 RAS Extensions 1.1 Platform Design Document Sep 2020 + * + ******************************************************************************/ + +void +AcpiDmDumpAest ( + ACPI_TABLE_HEADER *Table) +{ + ACPI_STATUS Status; + UINT32 Offset = sizeof (ACPI_TABLE_HEADER); + ACPI_AEST_HEADER *Subtable; + ACPI_AEST_HEADER *NodeHeader; + ACPI_AEST_PROCESSOR *ProcessorSubtable; + ACPI_DMTABLE_INFO *InfoTable; + ACPI_SIZE Length; + UINT8 Type; + + + /* Very small, generic main table. AEST consists of mostly subtables */ + + while (Offset < Table->Length) + { + NodeHeader = ACPI_ADD_PTR (ACPI_AEST_HEADER, Table, Offset); + + /* Dump the common error node (subtable) header */ + + Status = AcpiDmDumpTable (Table->Length, Offset, NodeHeader, + NodeHeader->Length, AcpiDmTableInfoAestHdr); + if (ACPI_FAILURE (Status)) + { + return; + } + + Type = NodeHeader->Type; + + /* Setup the node-specific subtable based on the header Type field */ + + switch (Type) + { + case ACPI_AEST_PROCESSOR_ERROR_NODE: + InfoTable = AcpiDmTableInfoAestProcError; + Length = sizeof (ACPI_AEST_PROCESSOR); + break; + + case ACPI_AEST_MEMORY_ERROR_NODE: + InfoTable = AcpiDmTableInfoAestMemError; + Length = sizeof (ACPI_AEST_MEMORY); + break; + + case ACPI_AEST_SMMU_ERROR_NODE: + InfoTable = AcpiDmTableInfoAestSmmuError; + Length = sizeof (ACPI_AEST_SMMU); + break; + + case ACPI_AEST_VENDOR_ERROR_NODE: + InfoTable = AcpiDmTableInfoAestVendorError; + Length = sizeof (ACPI_AEST_VENDOR); + break; + + case ACPI_AEST_GIC_ERROR_NODE: + InfoTable = AcpiDmTableInfoAestGicError; + Length = sizeof (ACPI_AEST_GIC); + break; + + /* Error case below */ + default: + + AcpiOsPrintf ("\n**** Unknown AEST Error Subtable type 0x%X\n", + Type); + return; + } + + /* Point past the common header (to the node-specific data) */ + + Offset += sizeof (ACPI_AEST_HEADER); + Subtable = ACPI_ADD_PTR (ACPI_AEST_HEADER, Table, Offset); + AcpiOsPrintf ("\n"); + + /* Dump the node-specific subtable */ + + Status = AcpiDmDumpTable (Table->Length, Offset, Subtable, Length, + InfoTable); + if (ACPI_FAILURE (Status)) + { + return; + } + AcpiOsPrintf ("\n"); + + if (Type == ACPI_AEST_PROCESSOR_ERROR_NODE) + { + /* + * Special handling for PROCESSOR_ERROR_NODE subtables + * (to handle the Resource Substructure via the ResourceType + * field). + */ + + /* Point past the node-specific data */ + + Offset += Length; + ProcessorSubtable = ACPI_CAST_PTR (ACPI_AEST_PROCESSOR, Subtable); + + switch (ProcessorSubtable->ResourceType) + { + /* Setup the Resource Substructure subtable */ + + case ACPI_AEST_CACHE_RESOURCE: + InfoTable = AcpiDmTableInfoAestCacheRsrc; + Length = sizeof (ACPI_AEST_PROCESSOR_CACHE); + break; + + case ACPI_AEST_TLB_RESOURCE: + InfoTable = AcpiDmTableInfoAestTlbRsrc; + Length = sizeof (ACPI_AEST_PROCESSOR_TLB); + break; + + case ACPI_AEST_GENERIC_RESOURCE: + InfoTable = AcpiDmTableInfoAestGenRsrc; + Length = sizeof (ACPI_AEST_PROCESSOR_GENERIC); + AcpiOsPrintf ("Generic Resource Type (%X) is not supported at this time\n", + ProcessorSubtable->ResourceType); + break; + + /* Error case below */ + default: + AcpiOsPrintf ("\n**** Unknown AEST Processor Resource type 0x%X\n", + ProcessorSubtable->ResourceType); + return; + } + + ProcessorSubtable = ACPI_ADD_PTR (ACPI_AEST_PROCESSOR, Table, + Offset); + + /* Dump the resource substructure subtable */ + + Status = AcpiDmDumpTable (Table->Length, Offset, ProcessorSubtable, + Length, InfoTable); + if (ACPI_FAILURE (Status)) + { + return; + } + + AcpiOsPrintf ("\n"); + } + + /* Point past the resource substructure or the node-specific data */ + + Offset += Length; + + /* Dump the interface structure, required to be present */ + + Subtable = ACPI_ADD_PTR (ACPI_AEST_HEADER, Table, Offset); + if (Subtable->Type >= ACPI_AEST_XFACE_RESERVED) + { + AcpiOsPrintf ("\n**** Unknown AEST Node Interface type 0x%X\n", + Subtable->Type); + return; + } + + Status = AcpiDmDumpTable (Table->Length, Offset, Subtable, + sizeof (ACPI_AEST_NODE_INTERFACE), AcpiDmTableInfoAestXface); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* Point past the interface structure */ + + AcpiOsPrintf ("\n"); + Offset += sizeof (ACPI_AEST_NODE_INTERFACE); + + /* Dump the entire interrupt structure array, if present */ + + if (NodeHeader->NodeInterruptOffset) + { + Length = NodeHeader->NodeInterruptCount; + Subtable = ACPI_ADD_PTR (ACPI_AEST_HEADER, Table, Offset); + + while (Length) + { + /* Dump the interrupt structure */ + + Status = AcpiDmDumpTable (Table->Length, Offset, Subtable, + sizeof (ACPI_AEST_NODE_INTERRUPT), + AcpiDmTableInfoAestXrupt); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* Point to the next interrupt structure */ + + Offset += sizeof (ACPI_AEST_NODE_INTERRUPT); + Subtable = ACPI_ADD_PTR (ACPI_AEST_HEADER, Table, Offset); + Length--; + AcpiOsPrintf ("\n"); + } + } + } +} + + /******************************************************************************* * * FUNCTION: AcpiDmDumpAsf diff --git a/sys/contrib/dev/acpica/common/dmtbdump3.c b/sys/contrib/dev/acpica/common/dmtbdump3.c index 38404bc3317c..26cfe2f9b695 100644 --- a/sys/contrib/dev/acpica/common/dmtbdump3.c +++ b/sys/contrib/dev/acpica/common/dmtbdump3.c @@ -681,7 +681,7 @@ AcpiDmDumpViot ( ACPI_TABLE_VIOT *Viot; ACPI_VIOT_HEADER *ViotHeader; UINT16 Length; - UINT16 Offset; + UINT32 Offset; ACPI_DMTABLE_INFO *InfoTable; /* Main table */ @@ -833,13 +833,12 @@ AcpiDmDumpWpbt ( { ACPI_STATUS Status; ACPI_TABLE_WPBT *Subtable; - UINT32 Length = Table->Length; UINT16 ArgumentsLength; /* Dump the main table */ - Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoWpbt); + Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoWpbt); if (ACPI_FAILURE (Status)) { return; @@ -850,8 +849,11 @@ AcpiDmDumpWpbt ( Subtable = ACPI_CAST_PTR (ACPI_TABLE_WPBT, Table); ArgumentsLength = Subtable->ArgumentsLength; - /* Dump the arguments buffer */ + /* Dump the arguments buffer if present */ - (void) AcpiDmDumpTable (Table->Length, 0, Table, ArgumentsLength, - AcpiDmTableInfoWpbt0); + if (ArgumentsLength) + { + (void) AcpiDmDumpTable (Table->Length, 0, Table, ArgumentsLength, + AcpiDmTableInfoWpbt0); + } } diff --git a/sys/contrib/dev/acpica/common/dmtbinfo1.c b/sys/contrib/dev/acpica/common/dmtbinfo1.c index a6c46e55bf0a..ff072285b64b 100644 --- a/sys/contrib/dev/acpica/common/dmtbinfo1.c +++ b/sys/contrib/dev/acpica/common/dmtbinfo1.c @@ -191,6 +191,144 @@ */ +/******************************************************************************* + * + * AEST - ARM Error Source table. Conforms to: + * ACPI for the Armv8 RAS Extensions 1.1 Platform Design Document Sep 2020 + * + ******************************************************************************/ + +/* Common Subtable header (one per Subtable) */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoAestHdr[] = +{ + {ACPI_DMT_AEST, ACPI_AESTH_OFFSET (Type), "Subtable Type", 0}, + {ACPI_DMT_UINT16, ACPI_AESTH_OFFSET (Length), "Length", DT_LENGTH}, + {ACPI_DMT_UINT8, ACPI_AESTH_OFFSET (Reserved), "Reserved", 0}, + {ACPI_DMT_UINT32, ACPI_AESTH_OFFSET (NodeSpecificOffset), "Node Specific Offset", 0}, + {ACPI_DMT_UINT32, ACPI_AESTH_OFFSET (NodeInterfaceOffset), "Node Interface Offset", 0}, + {ACPI_DMT_UINT32, ACPI_AESTH_OFFSET (NodeInterruptOffset), "Node Interrupt Array Offset", 0}, + {ACPI_DMT_UINT32, ACPI_AESTH_OFFSET (NodeInterruptCount), "Node Interrupt Array Count", 0}, + {ACPI_DMT_UINT64, ACPI_AESTH_OFFSET (TimestampRate), "Timestamp Rate", 0}, + {ACPI_DMT_UINT64, ACPI_AESTH_OFFSET (Reserved1), "Reserved", 0}, + {ACPI_DMT_UINT64, ACPI_AESTH_OFFSET (ErrorInjectionRate), "Error Injection Rate", 0}, + ACPI_DMT_TERMINATOR +}; + +/* + * AEST subtables (nodes) + */ + +/* 0: Processor Error */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoAestProcError[] = +{ + {ACPI_DMT_UINT32, ACPI_AEST0_OFFSET (ProcessorId), "Processor ID", 0}, + {ACPI_DMT_AEST_RES, ACPI_AEST0_OFFSET (ResourceType), "Resource Type", 0}, + {ACPI_DMT_UINT8, ACPI_AEST0_OFFSET (Reserved), "Reserved", 0}, + {ACPI_DMT_UINT8, ACPI_AEST0_OFFSET (Flags), "Flags (decoded Below)", 0}, + {ACPI_DMT_FLAG0, ACPI_AEST0_FLAG_OFFSET (Flags, 0), "Global", 0}, + {ACPI_DMT_FLAG1, ACPI_AEST0_FLAG_OFFSET (Flags, 0), "Shared", 0}, + {ACPI_DMT_UINT8, ACPI_AEST0_OFFSET (Revision), "Revision", 0}, + {ACPI_DMT_UINT64, ACPI_AEST0_OFFSET (ProcessorAffinity), "Processor Affinity Structure", 0}, + ACPI_DMT_TERMINATOR +}; + +/* 0RT: Processor Cache Resource */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoAestCacheRsrc[] = +{ + {ACPI_DMT_UINT32, ACPI_AEST0A_OFFSET (CacheReference), "Cache Reference", 0}, + {ACPI_DMT_UINT32, ACPI_AEST0A_OFFSET (Reserved), "Reserved", 0}, + ACPI_DMT_TERMINATOR +}; + +/* 1RT: ProcessorTLB Resource */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoAestTlbRsrc[] = +{ + {ACPI_DMT_UINT32, ACPI_AEST0B_OFFSET (TlbLevel), "TLB Level", 0}, + {ACPI_DMT_UINT32, ACPI_AEST0B_OFFSET (Reserved), "Reserved", 0}, + ACPI_DMT_TERMINATOR +}; + +/* 2RT: Processor Generic Resource */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoAestGenRsrc[] = +{ + {ACPI_DMT_RAW_BUFFER, 0, "Resource", 0}, + ACPI_DMT_TERMINATOR +}; + +/* 1: Memory Error */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoAestMemError[] = +{ + {ACPI_DMT_UINT32, ACPI_AEST1_OFFSET (SratProximityDomain), "Srat Proximity Domain", 0}, + ACPI_DMT_TERMINATOR +}; + +/* 2: Smmu Error */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoAestSmmuError[] = +{ + {ACPI_DMT_UINT32, ACPI_AEST2_OFFSET (IortNodeReference), "Iort Node Reference", 0}, + {ACPI_DMT_UINT32, ACPI_AEST2_OFFSET (SubcomponentReference), "Subcomponent Reference", 0}, + ACPI_DMT_TERMINATOR +}; + +/* 3: Vendor Defined */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoAestVendorError[] = +{ + {ACPI_DMT_UINT32, ACPI_AEST3_OFFSET (AcpiHid), "ACPI HID", 0}, + {ACPI_DMT_UINT32, ACPI_AEST3_OFFSET (AcpiUid), "ACPI UID", 0}, + {ACPI_DMT_BUF16, ACPI_AEST3_OFFSET (VendorSpecificData), "Vendor Specific Data", 0}, + ACPI_DMT_TERMINATOR +}; + +/* 4: Gic Error */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoAestGicError[] = +{ + {ACPI_DMT_AEST_GIC, ACPI_AEST4_OFFSET (InterfaceType), "GIC Interface Type", 0}, + {ACPI_DMT_UINT32, ACPI_AEST4_OFFSET (InstanceId), "Instance ID", 0}, + ACPI_DMT_TERMINATOR +}; + +/* AestXface: Node Interface Structure */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoAestXface[] = +{ + {ACPI_DMT_AEST_XFACE, ACPI_AEST0D_OFFSET (Type), "Interface Type", 0}, + {ACPI_DMT_UINT24, ACPI_AEST0D_OFFSET (Reserved[0]), "Reserved", 0}, + {ACPI_DMT_UINT32, ACPI_AEST0D_OFFSET (Flags), "Flags (decoded below)", 0}, + {ACPI_DMT_FLAG0, ACPI_AEST0D_FLAG_OFFSET (Flags, 0), "Shared Interface", 0}, + {ACPI_DMT_FLAG1, ACPI_AEST0D_FLAG_OFFSET (Flags, 0), "Clear MISCx Registers", 0}, + {ACPI_DMT_UINT64, ACPI_AEST0D_OFFSET (Address), "Address", 0}, + {ACPI_DMT_UINT32, ACPI_AEST0D_OFFSET (ErrorRecordIndex), "Error Record Index", 0}, + {ACPI_DMT_UINT32, ACPI_AEST0D_OFFSET (ErrorRecordCount), "Error Record Count", 0}, + {ACPI_DMT_UINT64, ACPI_AEST0D_OFFSET (ErrorRecordImplemented),"Error Record Implemented", 0}, + {ACPI_DMT_UINT64, ACPI_AEST0D_OFFSET (ErrorStatusReporting), "Error Status Reporting", 0}, + {ACPI_DMT_UINT64, ACPI_AEST0D_OFFSET (AddressingMode), "Addressing Mode", 0}, + ACPI_DMT_TERMINATOR +}; + +/* AestXrupt: Node Interrupt Structure */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoAestXrupt[] = +{ + {ACPI_DMT_AEST_XRUPT, ACPI_AEST0E_OFFSET (Type), "Interrupt Type", 0}, + {ACPI_DMT_UINT16, ACPI_AEST0E_OFFSET (Reserved), "Reserved", 0}, + {ACPI_DMT_UINT8, ACPI_AEST0E_OFFSET (Flags), "Flags (decoded below)", 0}, + {ACPI_DMT_FLAG0, ACPI_AEST0E_FLAG_OFFSET (Flags, 0), "Level Triggered", 0}, + {ACPI_DMT_UINT32, ACPI_AEST0E_OFFSET (Gsiv), "Gsiv", 0}, + {ACPI_DMT_UINT8, ACPI_AEST0E_OFFSET (IortId), "IortId", 0}, + {ACPI_DMT_UINT24, ACPI_AEST0E_OFFSET (Reserved1[0]), "Reserved", 0}, + ACPI_DMT_TERMINATOR +}; + + /******************************************************************************* * * ASF - Alert Standard Format table (Signature "ASF!") diff --git a/sys/contrib/dev/acpica/common/dmtbinfo3.c b/sys/contrib/dev/acpica/common/dmtbinfo3.c index b34d59ced086..9b2e30814921 100644 --- a/sys/contrib/dev/acpica/common/dmtbinfo3.c +++ b/sys/contrib/dev/acpica/common/dmtbinfo3.c @@ -759,7 +759,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoWpbt[] = ACPI_DMTABLE_INFO AcpiDmTableInfoWpbt0[] = { - {ACPI_DMT_UNICODE, sizeof (ACPI_TABLE_WPBT), "Command-line Arguments", 0}, + {ACPI_DMT_WPBT_UNICODE, ACPI_WPBT2_OFFSET (UnicodeString), "Command-line Arguments", DT_DESCRIBES_OPTIONAL}, ACPI_DMT_TERMINATOR }; @@ -834,6 +834,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoGeneric[][2] = ACPI_DM_GENERIC_ENTRY (ACPI_DMT_STRING, "String"), ACPI_DM_GENERIC_ENTRY (ACPI_DMT_UNICODE, "Unicode"), ACPI_DM_GENERIC_ENTRY (ACPI_DMT_BUFFER, "Buffer"), + ACPI_DM_GENERIC_ENTRY (ACPI_DMT_BUF16, "BUF16"), ACPI_DM_GENERIC_ENTRY (ACPI_DMT_UUID, "GUID"), ACPI_DM_GENERIC_ENTRY (ACPI_DMT_STRING, "DevicePath"), ACPI_DM_GENERIC_ENTRY (ACPI_DMT_LABEL, "Label"), diff --git a/sys/contrib/dev/acpica/compiler/aslmethod.c b/sys/contrib/dev/acpica/compiler/aslmethod.c index 53b6e0b1962b..a0cb02ae6dc8 100644 --- a/sys/contrib/dev/acpica/compiler/aslmethod.c +++ b/sys/contrib/dev/acpica/compiler/aslmethod.c @@ -205,6 +205,10 @@ MtMethodAnalysisWalkBegin ( UINT8 ActualArgs = 0; BOOLEAN HidExists; BOOLEAN AdrExists; + BOOLEAN PrsExists; + BOOLEAN CrsExists; + BOOLEAN SrsExists; + BOOLEAN DisExists; /* Build cross-reference output file if requested */ @@ -536,8 +540,8 @@ MtMethodAnalysisWalkBegin ( if (!HidExists && !AdrExists) { - AslError (ASL_WARNING, ASL_MSG_MISSING_DEPENDENCY, Op, - "Device object requires a _HID or _ADR in same scope"); + AslError (ASL_ERROR, ASL_MSG_MISSING_DEPENDENCY, Op, + "Device object requires a _HID or _ADR"); } else if (HidExists && AdrExists) { @@ -549,6 +553,81 @@ MtMethodAnalysisWalkBegin ( AslError (ASL_WARNING, ASL_MSG_MULTIPLE_TYPES, Op, "Device object requires either a _HID or _ADR, but not both"); } + + /* + * Check usage of _CRS, _DIS, _PRS, and _SRS objects (July 2021). + * + * Under the Device Object: + * + * 1) If _DIS is present, must have a _CRS, _PRS, and _SRS + * 2) If _PRS is present, must have a _CRS and _SRS + * 3) If _SRS is present, must have a _CRS and _PRS + */ + CrsExists = ApFindNameInDeviceTree (METHOD_NAME__CRS, Op); + DisExists = ApFindNameInDeviceTree (METHOD_NAME__DIS, Op); + PrsExists = ApFindNameInDeviceTree (METHOD_NAME__PRS, Op); + SrsExists = ApFindNameInDeviceTree (METHOD_NAME__SRS, Op); + + /* 1) If _DIS is present, must have a _CRS, _PRS, and _SRS */ + + if (DisExists) + { + if (!CrsExists) + { + AslError (ASL_WARNING, ASL_MSG_MISSING_DEPENDENCY, Op, + "_DIS is missing a _CRS, requires a _CRS, _PRS, and a _SRS"); + } + + if (!PrsExists) + { + AslError (ASL_WARNING, ASL_MSG_MISSING_DEPENDENCY, Op, + "_DIS is missing a _PRS, requires a _CRS, _PRS, and a _SRS"); + } + + if (!SrsExists) + { + AslError (ASL_WARNING, ASL_MSG_MISSING_DEPENDENCY, Op, + "_DIS is missing a _SRS, requires a _CRS, _PRS, and a _SRS"); + } + } + + /* 2) If _PRS is present, must have a _CRS and _SRS */ + + if (PrsExists) + { + if (!CrsExists) + { + AslError (ASL_WARNING, ASL_MSG_MISSING_DEPENDENCY, Op, + "_PRS is missing a _CRS, requires a _CRS and a _SRS"); + } + + if (!SrsExists) + { + AslError (ASL_WARNING, ASL_MSG_MISSING_DEPENDENCY, Op, + "_PRS is missing a _SRS, requires a _CRS and a _SRS"); + } + } + + /* 3) If _SRS is present, must have a _CRS and _PRS */ + + if (SrsExists) + { + if (!CrsExists) + { + AslError (ASL_WARNING, ASL_MSG_MISSING_DEPENDENCY, Op, + "_SRS is missing a _CRS, requires a _CRS and a _PRS"); + } + if (!PrsExists) + { + AslError (ASL_WARNING, ASL_MSG_MISSING_DEPENDENCY, Op, + "_SRS is missing a _PRS, requires a _CRS and a _PRS"); + } + if (!DisExists) + { + AslError (ASL_REMARK, ASL_MSG_MISSING_DEPENDENCY, Op, + "_SRS is missing a _DIS"); + } + } break; case PARSEOP_EVENT: diff --git a/sys/contrib/dev/acpica/compiler/aslutils.c b/sys/contrib/dev/acpica/compiler/aslutils.c index ea5a7bf1fbf2..9c0fd5955ca0 100644 --- a/sys/contrib/dev/acpica/compiler/aslutils.c +++ b/sys/contrib/dev/acpica/compiler/aslutils.c @@ -434,18 +434,20 @@ UtDisplaySupportedTables ( printf ("\nACPI tables supported by iASL version %8.8X:\n" - " (Compiler, Disassembler, Template Generator)\n\n", + " (Compiler, Disassembler, Template Generator)\n", ACPI_CA_VERSION); /* All ACPI tables with the common table header */ - printf ("\n Supported ACPI tables:\n"); + printf ("\nKnown/Supported ACPI tables:\n"); for (TableData = AcpiGbl_SupportedTables, i = 1; TableData->Signature; TableData++, i++) { printf ("%8u) %s %s\n", i, TableData->Signature, TableData->Description); } + + printf ("\nTotal %u ACPI tables\n\n", i-1); } diff --git a/sys/contrib/dev/acpica/compiler/dtcompiler.h b/sys/contrib/dev/acpica/compiler/dtcompiler.h index 2d563aecbc11..c58ad55cd6cb 100644 --- a/sys/contrib/dev/acpica/compiler/dtcompiler.h +++ b/sys/contrib/dev/acpica/compiler/dtcompiler.h @@ -565,6 +565,10 @@ ACPI_STATUS DtCompileRsdp ( DT_FIELD **PFieldList); +ACPI_STATUS +DtCompileAest ( + void **PFieldList); + ACPI_STATUS DtCompileAsf ( void **PFieldList); @@ -753,6 +757,7 @@ DtGetGenericTableInfo ( /* ACPI Table templates */ +extern const unsigned char TemplateAest[]; extern const unsigned char TemplateAsf[]; extern const unsigned char TemplateBoot[]; extern const unsigned char TemplateBdat[]; diff --git a/sys/contrib/dev/acpica/compiler/dtfield.c b/sys/contrib/dev/acpica/compiler/dtfield.c index 77862a7ac45c..d80be9bcc6c6 100644 --- a/sys/contrib/dev/acpica/compiler/dtfield.c +++ b/sys/contrib/dev/acpica/compiler/dtfield.c @@ -434,14 +434,14 @@ DtCompileInteger ( { if (Value != 1) { - DtError (ASL_WARNING, ASL_MSG_RESERVED_FIELD, Field, + DtError (ASL_ERROR, ASL_MSG_RESERVED_FIELD, Field, "Must be one, setting to one"); Value = 1; } } else if (Value != 0) { - DtError (ASL_WARNING, ASL_MSG_RESERVED_FIELD, Field, + DtError (ASL_ERROR, ASL_MSG_RESERVED_FIELD, Field, "Must be zero, setting to zero"); Value = 0; } diff --git a/sys/contrib/dev/acpica/compiler/dttable1.c b/sys/contrib/dev/acpica/compiler/dttable1.c index a533a51ab697..0ac3c147743a 100644 --- a/sys/contrib/dev/acpica/compiler/dttable1.c +++ b/sys/contrib/dev/acpica/compiler/dttable1.c @@ -170,6 +170,223 @@ static ACPI_DMTABLE_INFO TableInfoDmarPciPath[] = }; +/****************************************************************************** + * + * FUNCTION: DtCompileAest + * + * PARAMETERS: List - Current field list pointer + * + * RETURN: Status + * + * DESCRIPTION: Compile AEST. + * + * NOTE: Assumes the following table structure: + * For all AEST Error Nodes: + * 1) An AEST Error Node, followed immediately by: + * 2) Any node-specific data + * 3) An Interface Structure (one) + * 4) A list (array) of Interrupt Structures, the count as specified + * in the NodeInterruptCount field of the Error Node header. + * + * AEST - ARM Error Source table. Conforms to: + * ACPI for the Armv8 RAS Extensions 1.1 Platform Design Document Sep 2020 + * + *****************************************************************************/ + +ACPI_STATUS +DtCompileAest ( + void **List) +{ + ACPI_AEST_HEADER *ErrorNodeHeader; + ACPI_AEST_PROCESSOR *AestProcessor; + DT_SUBTABLE *Subtable; + DT_SUBTABLE *ParentTable; + ACPI_DMTABLE_INFO *InfoTable; + ACPI_STATUS Status; + UINT32 i; + UINT32 Offset; + DT_FIELD **PFieldList = (DT_FIELD **) List; + + + while (*PFieldList) + { + /* Compile the common error node header */ *** 807 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Sat Jul 31 05:06: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 6AFBD6558AB; Sat, 31 Jul 2021 05:06: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 4GcC192L3cz4txQ; Sat, 31 Jul 2021 05:06: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 383E112EB0; Sat, 31 Jul 2021 05:06: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 16V56rSu026884; Sat, 31 Jul 2021 05:06:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V56rn0026883; Sat, 31 Jul 2021 05:06:53 GMT (envelope-from git) Date: Sat, 31 Jul 2021 05:06:53 GMT Message-Id: <202107310506.16V56rn0026883@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: 51a4fad8d0bd - stable/12 - nvmecontrol: fix typo (s/Managment/Management/) 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/12 X-Git-Reftype: branch X-Git-Commit: 51a4fad8d0bd11dfb34541eae98b0a42d34088c1 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, 31 Jul 2021 05:06:53 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=51a4fad8d0bd11dfb34541eae98b0a42d34088c1 commit 51a4fad8d0bd11dfb34541eae98b0a42d34088c1 Author: Edward Tomasz Napierala AuthorDate: 2021-05-07 12:12:30 +0000 Commit: Warner Losh CommitDate: 2021-07-31 05:02:13 +0000 nvmecontrol: fix typo (s/Managment/Management/) Reported By: pstef (cherry picked from commit 95a74ab4fb0879da270342bc98719b0e735694f3) --- sbin/nvmecontrol/identify_ext.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sbin/nvmecontrol/identify_ext.c b/sbin/nvmecontrol/identify_ext.c index 6e30ef0487a8..311c8cba09a9 100644 --- a/sbin/nvmecontrol/identify_ext.c +++ b/sbin/nvmecontrol/identify_ext.c @@ -138,7 +138,7 @@ nvme_print_controller(struct nvme_controller_data *cdata) fmt ? "Supported" : "Not Supported"); printf("Firmware Activate/Download: %s\n", fw ? "Supported" : "Not Supported"); - printf("Namespace Managment: %s\n", + printf("Namespace Management: %s\n", nsmgmt ? "Supported" : "Not Supported"); printf("Device Self-test: %sSupported\n", ((oacs >> NVME_CTRLR_DATA_OACS_SELFTEST_SHIFT) & From owner-dev-commits-src-all@freebsd.org Sat Jul 31 05:06: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 B725E655572; Sat, 31 Jul 2021 05:06: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 4GcC1C4jMNz4vBn; Sat, 31 Jul 2021 05:06: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 8119F12EB2; Sat, 31 Jul 2021 05:06: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 16V56tqh026932; Sat, 31 Jul 2021 05:06:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V56tuW026931; Sat, 31 Jul 2021 05:06:55 GMT (envelope-from git) Date: Sat, 31 Jul 2021 05:06:55 GMT Message-Id: <202107310506.16V56tuW026931@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: bf7ea64d79bd - stable/12 - Add SPDX tag. 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/12 X-Git-Reftype: branch X-Git-Commit: bf7ea64d79bd9b9bc3265f28a843fac9df2bf36b 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, 31 Jul 2021 05:06:55 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=bf7ea64d79bd9b9bc3265f28a843fac9df2bf36b commit bf7ea64d79bd9b9bc3265f28a843fac9df2bf36b Author: Warner Losh AuthorDate: 2019-02-28 02:29:48 +0000 Commit: Warner Losh CommitDate: 2021-07-31 05:03:35 +0000 Add SPDX tag. (cherry picked from commit e96f6eda1b292c9d91051be0fbe7070a5f83a464) --- sbin/nvmecontrol/nc_util.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sbin/nvmecontrol/nc_util.c b/sbin/nvmecontrol/nc_util.c index 8f73256003a5..e2ad59b2fd23 100644 --- a/sbin/nvmecontrol/nc_util.c +++ b/sbin/nvmecontrol/nc_util.c @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2017 Netflix, Inc. * * Redistribution and use in source and binary forms, with or without From owner-dev-commits-src-all@freebsd.org Sat Jul 31 05:06: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 8D3A9655A2B; Sat, 31 Jul 2021 05:06: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 4GcC1B3LsYz4v37; Sat, 31 Jul 2021 05:06: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 58BBA12EB1; Sat, 31 Jul 2021 05:06: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 16V56sc7026908; Sat, 31 Jul 2021 05:06:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V56s1r026907; Sat, 31 Jul 2021 05:06:54 GMT (envelope-from git) Date: Sat, 31 Jul 2021 05:06:54 GMT Message-Id: <202107310506.16V56s1r026907@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: 4905e7273229 - stable/12 - nvmecontrol: document power command MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 4905e7273229106f7fc62d2801f5295d50d718d0 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, 31 Jul 2021 05:06:54 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=4905e7273229106f7fc62d2801f5295d50d718d0 commit 4905e7273229106f7fc62d2801f5295d50d718d0 Author: Warner Losh AuthorDate: 2021-07-10 16:51:15 +0000 Commit: Warner Losh CommitDate: 2021-07-31 05:02:56 +0000 nvmecontrol: document power command The description of the power command is missing. While the synopsis is present, there's no explanation. Add one. Reviewed by: mav, chuck PR: 237866 Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D31122 (cherry picked from commit 445b5554bf97254a0ead3d70f801871d62dcfb62) --- sbin/nvmecontrol/nvmecontrol.8 | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/sbin/nvmecontrol/nvmecontrol.8 b/sbin/nvmecontrol/nvmecontrol.8 index 2d634eb54216..7d70e1762f73 100644 --- a/sbin/nvmecontrol/nvmecontrol.8 +++ b/sbin/nvmecontrol/nvmecontrol.8 @@ -470,6 +470,37 @@ Run in mode. This will report status on a sanitize that is already running on the drive. .El +.Ss power +Manage the power modes of the NVMe controller. +.Bl -tag -width 6n +.It Fl l +List all supported power modes. +.It Fl p Ar mode +Set the power mode to +.Ar mode . +This must be a mode listed with the +.Dl nvmecontrol power -l +command. +.It Fl w Ar hint +Set the workload hint for automatic power mode control. +.Bl -tag -compact -width 6n +.It 0 +No workload hint is provided. +.It 1 +Extended idle period workload. +The device is often idle for minutes at a time. +A burst of write commands comes in over a period of seconds. +Then the device returns to being idle. +.It 2 +Heavy sequential writes. +A huge number of sequential writes will be submitted, filling the submission queues. +.It Other +All other values are reserved and have no standard meaning. +.El +Please see the +.Dq NVM Subsystem Workloads +section of the relevant NVM Express Base Standard for details. +.El .Ss selftest Start the specified device self-test: .Bl -tag -width 6n @@ -505,7 +536,7 @@ and commands send NVMe commands to either the administrative or the data part of the device. These commands are expected to be compatible with nvme-cli. -Please see the NVMe Standard for details. +Please see the NVM Express Base Standard for details. .Bl -tag -width 16n .It Fl o -opcode Ar opcode Opcode to send. From owner-dev-commits-src-all@freebsd.org Sat Jul 31 05:06: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 88D2D655AB6; Sat, 31 Jul 2021 05:06: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 4GcC1F6f9Gz4vMn; Sat, 31 Jul 2021 05:06: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 C241812CED; Sat, 31 Jul 2021 05:06: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 16V56vpC026987; Sat, 31 Jul 2021 05:06:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V56vFY026986; Sat, 31 Jul 2021 05:06:57 GMT (envelope-from git) Date: Sat, 31 Jul 2021 05:06:57 GMT Message-Id: <202107310506.16V56vFY026986@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: e605851b118c - stable/12 - nvmecontrol: update copyright on passthru command MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: e605851b118cb5870bfa250cb5577ca269400fee 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, 31 Jul 2021 05:06:58 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=e605851b118cb5870bfa250cb5577ca269400fee commit e605851b118cb5870bfa250cb5577ca269400fee Author: Warner Losh AuthorDate: 2021-05-06 22:05:42 +0000 Commit: Warner Losh CommitDate: 2021-07-31 05:04:52 +0000 nvmecontrol: update copyright on passthru command I wrote this code, not Intel, so put my copyright on this. I mistakenly copied it for the initial commit. Sponsored by: Netflix (cherry picked from commit 6d6cca363392943689204f920fa2da9226e42056) --- sbin/nvmecontrol/passthru.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sbin/nvmecontrol/passthru.c b/sbin/nvmecontrol/passthru.c index 8284261b769b..0b24d7b1ea1f 100644 --- a/sbin/nvmecontrol/passthru.c +++ b/sbin/nvmecontrol/passthru.c @@ -1,8 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (C) 2012-2013 Intel Corporation - * All rights reserved. + * Copyright (c) 2019-2021 Netflix, Inc * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions From owner-dev-commits-src-all@freebsd.org Sat Jul 31 05:06: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 038D3655AAC; Sat, 31 Jul 2021 05:06: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 4GcC1D5sjzz4v8Z; Sat, 31 Jul 2021 05:06: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 A22E312CEC; Sat, 31 Jul 2021 05:06: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 16V56u1m026962; Sat, 31 Jul 2021 05:06:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V56uFO026961; Sat, 31 Jul 2021 05:06:56 GMT (envelope-from git) Date: Sat, 31 Jul 2021 05:06:56 GMT Message-Id: <202107310506.16V56uFO026961@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: abb811c40c94 - stable/12 - nvmecontrol: Report status from passthru commands 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/12 X-Git-Reftype: branch X-Git-Commit: abb811c40c9458976ff1935cd50b95fab0bad643 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, 31 Jul 2021 05:06:57 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=abb811c40c9458976ff1935cd50b95fab0bad643 commit abb811c40c9458976ff1935cd50b95fab0bad643 Author: Warner Losh AuthorDate: 2021-03-25 07:41:53 +0000 Commit: Warner Losh CommitDate: 2021-07-31 05:04:16 +0000 nvmecontrol: Report status from passthru commands Report status from dword0 for passthru commands. Many commands report some status or information here, so reporting it can help know what's going on. Sponsored by: Netflix (cherry picked from commit 510a3da1477a917aa2aaf6b9e3cd6fd50dd13206) --- sbin/nvmecontrol/passthru.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sbin/nvmecontrol/passthru.c b/sbin/nvmecontrol/passthru.c index add6cf1cc7ca..8284261b769b 100644 --- a/sbin/nvmecontrol/passthru.c +++ b/sbin/nvmecontrol/passthru.c @@ -246,7 +246,8 @@ passthru(const struct cmd *f, int argc, char *argv[]) errno = 0; if (ioctl(fd, NVME_PASSTHROUGH_CMD, &pt) < 0) err(EX_IOERR, "passthrough request failed"); - /* XXX report status */ + if (!opt.binary) + printf("DWORD0 status= %#x\n", pt.cpl.cdw0); if (opt.read) { if (opt.binary) write(STDOUT_FILENO, data, opt.data_len); From owner-dev-commits-src-all@freebsd.org Sat Jul 31 05:43: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 A0F266565A9; Sat, 31 Jul 2021 05:43: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 4GcCqB42C4z3DTd; Sat, 31 Jul 2021 05:43: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 726931357A; Sat, 31 Jul 2021 05:43: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 16V5hInQ079262; Sat, 31 Jul 2021 05:43:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V5hIUF079261; Sat, 31 Jul 2021 05:43:18 GMT (envelope-from git) Date: Sat, 31 Jul 2021 05:43:18 GMT Message-Id: <202107310543.16V5hIUF079261@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: 4e52f5db352f - main - awk: Flag -Ft as deprecated behavior 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: 4e52f5db352fe54d6ba342bcde01228096db8b19 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, 31 Jul 2021 05:43:18 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=4e52f5db352fe54d6ba342bcde01228096db8b19 commit 4e52f5db352fe54d6ba342bcde01228096db8b19 Author: Warner Losh AuthorDate: 2021-07-31 05:19:58 +0000 Commit: Warner Losh CommitDate: 2021-07-31 05:33:37 +0000 awk: Flag -Ft as deprecated behavior Upstream is poised to deprecate the -Ft wart in one true awk. None of the other awks do this, and the gawk maintainer says that he's had no requests for it in gawk in 30 years maintaining it. github can find a few instances of it in the wild. As such, warn that it's deprecated and will go away in the future. MFC After: 3 days Sponsored by: Netflix --- contrib/one-true-awk/main.c | 4 +++- usr.bin/awk/awk.1 | 10 +++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/contrib/one-true-awk/main.c b/contrib/one-true-awk/main.c index 4e68bfb46d27..35d0ca7d098f 100644 --- a/contrib/one-true-awk/main.c +++ b/contrib/one-true-awk/main.c @@ -89,8 +89,10 @@ static const char * setfs(char *p) { /* wart: t=>\t */ - if (p[0] == 't' && p[1] == '\0') + if (p[0] == 't' && p[1] == '\0') { + WARNING("-Ft to imply tab separator is deprecated behavior."); return "\t"; + } return p; } diff --git a/usr.bin/awk/awk.1 b/usr.bin/awk/awk.1 index b85efe9d87cd..20bb510a1516 100644 --- a/usr.bin/awk/awk.1 +++ b/usr.bin/awk/awk.1 @@ -23,7 +23,7 @@ .\" THIS SOFTWARE. .\" .\" $FreeBSD$ -.Dd $Mdocdate: June 6 2020 $ +.Dd July 30, 2021 .Dt AWK 1 .Os .Sh NAME @@ -812,3 +812,11 @@ to it. .Pp The scope rules for variables in functions are a botch; the syntax is worse. +.Sh DEPRECATED BEHAVIOR +One True Awk has accpeted +.Fl Ft +to mean the same as +.Fl F\t +to make it easier to specify tabs as the separator character. +Upstream One True Awk has deprecated this wart in the name of better +compatibility with other awk implementations like gawk and mawk. From owner-dev-commits-src-all@freebsd.org Sat Jul 31 05:43: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 CA3EE65648B; Sat, 31 Jul 2021 05:43: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 4GcCqC549wz3DRH; Sat, 31 Jul 2021 05:43: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 8FDF013379; Sat, 31 Jul 2021 05:43: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 16V5hJdt079286; Sat, 31 Jul 2021 05:43:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V5hJki079285; Sat, 31 Jul 2021 05:43:19 GMT (envelope-from git) Date: Sat, 31 Jul 2021 05:43:19 GMT Message-Id: <202107310543.16V5hJki079285@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: f7f76c200a8c - main - awk: Document deprecated behavior of hex constants and locales. 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: f7f76c200a8c33822a25ae36e4399c9896efa951 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, 31 Jul 2021 05:43:19 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=f7f76c200a8c33822a25ae36e4399c9896efa951 commit f7f76c200a8c33822a25ae36e4399c9896efa951 Author: Warner Losh AuthorDate: 2021-07-31 05:31:00 +0000 Commit: Warner Losh CommitDate: 2021-07-31 05:41:39 +0000 awk: Document deprecated behavior of hex constants and locales. FreeBSD will convert "0x12" from hex and print it as 18. Other awks will convert it to 0. This extension has been removed upstream, and will be removed in FreeBSD 14.0. FreeBSD used to set the locale on startup, and make the ranges use that locale. This lead to weird results like "[A-Z]" matching lower case characters in some locales. This bug has been fixed. MFC After: 3 days Sponsored by: Netflix --- usr.bin/awk/awk.1 | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/usr.bin/awk/awk.1 b/usr.bin/awk/awk.1 index 20bb510a1516..35d5e8d9d29b 100644 --- a/usr.bin/awk/awk.1 +++ b/usr.bin/awk/awk.1 @@ -814,9 +814,44 @@ The scope rules for variables in functions are a botch; the syntax is worse. .Sh DEPRECATED BEHAVIOR One True Awk has accpeted -.Fl Ft +.Fl F Ar t to mean the same as -.Fl F\t +.Fl F Ar to make it easier to specify tabs as the separator character. Upstream One True Awk has deprecated this wart in the name of better compatibility with other awk implementations like gawk and mawk. +.Pp +Historically, +.Nm +did not accept +.Dq 0x +as a hex string. +However, since One True Awk used strtod to convert strings to floats, and since +.Dq 0x12 +is a valid hexadecimal representation of a floating point number, +On +.Fx , +.Nm +has accepted this notation as an extension since One True Awk was imported in +.Fx 5.0 . +Upstream One True Awk has restored the historical behavior for better +compatibility between the different awk implementations. +Both gawk and mawk already behave similarly. +Starting with +.Fx 14.0 +.Nm +will no longer accept this extension. +.Pp +The +.Fx +.Nm +sets the locale for many years to match the environment it was running in. +This lead to pattern ranges, like +.Dq "[A-Z]" +sometimes matching lower case characters in some locales. +This misbehavior was never in upstream One True Awk and has been removed as a +bug in +.Fx 12.3 , +.Fx 13.1 , +and +.Fx 14.0 . From owner-dev-commits-src-all@freebsd.org Sat Jul 31 09:11: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 C869A658976; Sat, 31 Jul 2021 09:11:54 +0000 (UTC) (envelope-from kp@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 4GcJRt531Vz3m4C; Sat, 31 Jul 2021 09:11:54 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from venus.codepro.be (venus.codepro.be [5.9.86.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.codepro.be", Issuer "R3" (verified OK)) (Authenticated sender: kp) by smtp.freebsd.org (Postfix) with ESMTPSA id 6CA9641FD; Sat, 31 Jul 2021 09:11:54 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: by venus.codepro.be (Postfix, authenticated sender kp) id 5201E10DF5; Sat, 31 Jul 2021 11:11:52 +0200 (CEST) From: "Kristof Provost" To: "Warner Losh" Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: Re: git: 6edf5082bab7 - stable/12 - one-true-awk: import 20210221 (1e4bc42c53a1) which fixes a number of bugs Date: Sat, 31 Jul 2021 11:11:51 +0200 X-Mailer: MailMate (1.13.2r5673) Message-ID: <4AD3AB8C-A960-43BE-A89B-5D9C4CD077DD@FreeBSD.org> In-Reply-To: <202107101712.16AHCwoE088447@gitrepo.freebsd.org> References: <202107101712.16AHCwoE088447@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-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, 31 Jul 2021 09:11:54 -0000 Hi Warner, On 10 Jul 2021, at 19:12, Warner Losh wrote: > The branch stable/12 has been updated by imp: > > URL: = > https://cgit.FreeBSD.org/src/commit/?id=3D6edf5082bab71cf923efff9f18e38= efe5b83b0ec > > commit 6edf5082bab71cf923efff9f18e38efe5b83b0ec > Author: Warner Losh > AuthorDate: 2021-07-07 23:30:35 +0000 > Commit: Warner Losh > CommitDate: 2021-07-10 17:11:15 +0000 > > one-true-awk: import 20210221 (1e4bc42c53a1) which fixes a number = > of bugs > > Import the latest bsd-features branch of the one-true-awk = > upstream: > > o Move to bison for $YACC > o Set close-on-exec flag for file and pipe redirects that aren't = > std* > o lots of little fixes to modernize ocde base > o free sval member before setting it > o fix a bug where a{0,3} could match aaaa > o pull in systime and strftime from NetBSD awk > o pull in fixes from {Net,Free,Open}BSD (normalized our code with = > them) > o add BSD extensions and, or, xor, compl, lsheift, rshift (mostly = > a nop) > > Also revert a few of the trivial FreeBSD changes that were done = > slightly > differently in the upstreaming process. Also, our PR database may = > have > been mined by upstream for these fixes, and Mikolaj Golub may = > deserve > credit for some of the fixes in this update. > > Suggested by: Mikolaj Golub > PR: = > 143363,143365,143368,143369,143373,143375,214782 > Sponsored by: Netflix > > (cherry picked from commit = > f39dd6a9784467f0db5886012b3f4b13899be6b8) I *think* this is the relevant commit, but I=E2=80=99m not 100% sure. Anyway, I=E2=80=99ve recently started seeing issues building pfSense for = aarch64. I=E2=80=99ve finally narrowed it down, and replicated the proble= m on = base FreeBSD (stable/12, but I assume other branches are affected too). It fails to build proctab.c. This file is generated by maketab, a tool = built as part of the build process. In my case this tool is built for = aarch64, which makes executing it on amd64 less successful than we=E2=80=99= d = like. This only happens when building with META_MODE though. I do not = understand the build system sufficiently to debug why. Hopefully = you=E2=80=99ll have a better idea. This triggers the build failure: % cat /usr/src/src_env.conf WITH_META_MODE=3Dyes % env SRC_ENV_CONF=3D/usr/src/src_env.conf TARGET_ARCH=3Daarch64 make -j= 8 = buildworld =E2=80=A6 --- proctab.c --- *** [proctab.c] Error code 255 make[4]: stopped in /usr/src/usr.bin/awk .ERROR_TARGET=3D'proctab.c' .ERROR_META_FILE=3D'/usr/obj/usr/src/arm64.aarch64/usr.bin/awk/proctab.c= =2Emeta' .MAKE.LEVEL=3D'4' MAKEFILE=3D'' .MAKE.MODE=3D'meta missing-filemon=3Dyes missing-meta=3Dyes silent=3Dyes= = verbose' _ERROR_CMD=3D'./maketab awkgram.h > proctab.c;' .CURDIR=3D'/usr/src/usr.bin/awk' .MAKE=3D'make' .OBJDIR=3D'/usr/obj/usr/src/arm64.aarch64/usr.bin/awk' .TARGETS=3D'all' DESTDIR=3D'/usr/obj/usr/src/arm64.aarch64/tmp' LD_LIBRARY_PATH=3D'' MACHINE=3D'arm64' MACHINE_ARCH=3D'aarch64' MAKEOBJDIRPREFIX=3D'' MAKESYSPATH=3D'/usr/src/share/mk' MAKE_VERSION=3D'20200710' Further up in the build output: --- maketab --- cc -target aarch64-unknown-freebsd12.2 = --sysroot=3D/usr/obj/usr/src/arm64.aarch64/tmp = -B/usr/obj/usr/src/arm64.aarch64/tmp/usr/bin -O2 -pipe -fno-common = -DHAS_ISBLANK -I. -I/usr/src/contrib/one-true-awk -DFOPEN_MAX=3D64 -g = -std=3Dgnu99 -Wno-format-zero-length -fstack-protector-strong = -Wsystem-headers -Werror -Wno-pointer-sign -Wno-empty-body = -Wno-string-plus-int -Wno-unused-const-variable = -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality = -Wno-unused-function -Wno-enum-conversion -Wno-unused-local-typedef = -Wno-address-of-packed-member -Wno-switch -Wno-switch-enum = -Wno-knr-promoted-parameter -Wno-parentheses -Qunused-arguments = /usr/src/contrib/one-true-awk/maketab.c -o maketab Without META_MODE maketab is built as an amd64 binary, and the entire = build succeeds. Best regards, Kristof From owner-dev-commits-src-all@freebsd.org Sat Jul 31 12:48:40 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A9D9365BBAB; Sat, 31 Jul 2021 12:48:40 +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 4GcPFz4212z4S0F; Sat, 31 Jul 2021 12:48:39 +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 16VCmVYo080354 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Sat, 31 Jul 2021 15:48:34 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 16VCmVYo080354 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 16VCmV1q080353; Sat, 31 Jul 2021 15:48:31 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 31 Jul 2021 15:48:31 +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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202107300326.16U3QGHR070204@gitrepo.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: 4GcPFz4212z4S0F X-Spamd-Bar: ++ Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=gmail.com (policy=none); spf=softfail (mx1.freebsd.org: 2001:470:d5e7:1::1 is neither permitted nor denied by domain of kostikbel@gmail.com) smtp.mailfrom=kostikbel@gmail.com X-Spamd-Result: default: False [2.62 / 15.00]; ARC_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; FREEMAIL_FROM(0.00)[gmail.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; R_SPF_SOFTFAIL(0.00)[~all:c]; NEURAL_SPAM_MEDIUM(0.99)[0.990]; TO_DN_SOME(0.00)[]; NEURAL_SPAM_SHORT(1.00)[1.000]; NEURAL_SPAM_LONG(0.63)[0.629]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main]; DMARC_POLICY_SOFTFAIL(0.10)[gmail.com : No valid SPF, No valid DKIM,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: Sat, 31 Jul 2021 12:48:40 -0000 On Fri, Jul 30, 2021 at 03:26:16AM +0000, Alexander Motin wrote: > The branch main has been updated by mav: > > URL: https://cgit.FreeBSD.org/src/commit/?id=74f80bc1af2ffd56ec290f610c80e46f768731a0 > > commit 74f80bc1af2ffd56ec290f610c80e46f768731a0 > Author: Alexander Motin > AuthorDate: 2021-07-30 03:16:22 +0000 > Commit: Alexander Motin > CommitDate: 2021-07-30 03:26:10 +0000 > > coretemp(4): Switch to smp_rendezvous_cpus(). > > Use of smp_rendezvous_cpus() instead of sched_bind() allows to not > block indefinitely if target CPU is running some thread with higher > priority, while all we need is single rdmsr/wrmsr instruction call. > I guess it should also be much cheaper than full thread migration. > > MFC after: 2 weeks > Sponsored by: iXsystems, Inc. > --- > sys/dev/coretemp/coretemp.c | 59 ++++++++++++++++++++++++++++----------------- > 1 file changed, 37 insertions(+), 22 deletions(-) > > diff --git a/sys/dev/coretemp/coretemp.c b/sys/dev/coretemp/coretemp.c > index 884ed6309f0e..53a2434254f6 100644 > --- a/sys/dev/coretemp/coretemp.c > +++ b/sys/dev/coretemp/coretemp.c > @@ -42,7 +42,7 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include /* for curthread */ > -#include > +#include > #include > #include > > @@ -310,14 +310,32 @@ coretemp_detach(device_t dev) > return (0); > } > > +struct coretemp_args { > + u_int msr; > + 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); > +} We have x86_msr_op(). It covers coretemp_wrmsr(), and with slight change of the interface would also handle the functionality of coretemp_rdmsr(). > + > static uint64_t > coretemp_get_thermal_msr(int cpu) > { > - uint64_t msr; > - > - thread_lock(curthread); > - sched_bind(curthread, cpu); > - thread_unlock(curthread); > + struct coretemp_args args; > + cpuset_t cpus; > > /* > * The digital temperature reading is located at bit 16 > @@ -329,27 +347,24 @@ coretemp_get_thermal_msr(int cpu) > * The temperature is computed by subtracting the temperature > * reading by Tj(max). > */ > - msr = rdmsr(MSR_THERM_STATUS); > - > - thread_lock(curthread); > - sched_unbind(curthread); > - thread_unlock(curthread); > - > - return (msr); > + 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); > } > > static void > coretemp_clear_thermal_msr(int cpu) > { > - thread_lock(curthread); > - sched_bind(curthread, cpu); > - thread_unlock(curthread); > - > - wrmsr(MSR_THERM_STATUS, 0); > - > - thread_lock(curthread); > - sched_unbind(curthread); > - thread_unlock(curthread); > + 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); > } > > static int From owner-dev-commits-src-all@freebsd.org Sat Jul 31 13:03: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 9624065C467; Sat, 31 Jul 2021 13:03: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 4GcPbW3Zx5z4SVH; Sat, 31 Jul 2021 13:03: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 634A919497; Sat, 31 Jul 2021 13:03: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 16VD3pqD066309; Sat, 31 Jul 2021 13:03:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16VD3pJA066308; Sat, 31 Jul 2021 13:03:51 GMT (envelope-from git) Date: Sat, 31 Jul 2021 13:03:51 GMT Message-Id: <202107311303.16VD3pJA066308@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: b0e7f371cde1 - stable/13 - Add FEATURE sysctls for ALTQ disciplines 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: b0e7f371cde199895a9071046e951beb38b1f4b4 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, 31 Jul 2021 13:03:51 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=b0e7f371cde199895a9071046e951beb38b1f4b4 commit b0e7f371cde199895a9071046e951beb38b1f4b4 Author: Kristof Provost AuthorDate: 2021-01-23 09:36:33 +0000 Commit: Kristof Provost CommitDate: 2021-07-31 08:12:01 +0000 Add FEATURE sysctls for ALTQ disciplines This will allow userspace to more easily figure out if ALTQ is built into the kernel and what disciplines are supported. Reviewed by: donner@ Differential Revision: https://reviews.freebsd.org/D28302 (cherry picked from commit e111d79806fe3652bc85593ca77ee1b4ff85498d) --- sys/net/altq/altq_subr.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/sys/net/altq/altq_subr.c b/sys/net/altq/altq_subr.c index ba1d3af5f5fd..609c18482845 100644 --- a/sys/net/altq/altq_subr.c +++ b/sys/net/altq/altq_subr.c @@ -114,6 +114,38 @@ static struct ip4_frag *ip4f_alloc(void); static void ip4f_free(struct ip4_frag *); #endif /* ALTQ3_CLFIER_COMPAT */ +#ifdef ALTQ +SYSCTL_NODE(_kern_features, OID_AUTO, altq, CTLFLAG_RD | CTLFLAG_CAPRD, 0, + "ALTQ packet queuing"); + +#define ALTQ_FEATURE(name, desc) \ + SYSCTL_INT_WITH_LABEL(_kern_features_altq, OID_AUTO, name, \ + CTLFLAG_RD | CTLFLAG_CAPRD, SYSCTL_NULL_INT_PTR, 1, \ + desc, "feature") + +#ifdef ALTQ_CBQ +ALTQ_FEATURE(cbq, "ATLQ Class Based Queuing discipline"); +#endif +#ifdef ALTQ_CODEL +ALTQ_FEATURE(codel, "ALTQ Controlled Delay discipline"); +#endif +#ifdef ALTQ_RED +ALTQ_FEATURE(red, "ALTQ Random Early Detection discipline"); +#endif +#ifdef ALTQ_RIO +ALTQ_FEATURE(rio, "ALTQ Random Early Drop discipline"); +#endif +#ifdef ALTQ_HFSC +ALTQ_FEATURE(hfsc, "ALTQ Hierarchical Packet Scheduler discipline"); +#endif +#ifdef ALTQ_PRIQ +ALTQ_FEATURE(priq, "ATLQ Priority Queuing discipline"); +#endif +#ifdef ALTQ_FAIRQ +ALTQ_FEATURE(fairq, "ALTQ Fair Queuing discipline"); +#endif +#endif + /* * alternate queueing support routines */ From owner-dev-commits-src-all@freebsd.org Sat Jul 31 13:03: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 A768B65C46C; Sat, 31 Jul 2021 13:03: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 4GcPbX47N1z4Skb; Sat, 31 Jul 2021 13:03: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 76D7019511; Sat, 31 Jul 2021 13:03: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 16VD3qxA066381; Sat, 31 Jul 2021 13:03:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16VD3qZO066380; Sat, 31 Jul 2021 13:03:52 GMT (envelope-from git) Date: Sat, 31 Jul 2021 13:03:52 GMT Message-Id: <202107311303.16VD3qZO066380@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: 5a1bc5f9028e - stable/13 - altq: Fix typo in features sysctl description 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: 5a1bc5f9028ec0087f4f4e096afd29bb6fd62f0a 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, 31 Jul 2021 13:03:52 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=5a1bc5f9028ec0087f4f4e096afd29bb6fd62f0a commit 5a1bc5f9028ec0087f4f4e096afd29bb6fd62f0a Author: Kristof Provost AuthorDate: 2021-01-26 15:02:45 +0000 Commit: Kristof Provost CommitDate: 2021-07-31 08:12:01 +0000 altq: Fix typo in features sysctl description Reported by: Jose Luis Duran (cherry picked from commit 35dabb7b9cff601045b623aeca59ccc68930d520) --- sys/net/altq/altq_subr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/net/altq/altq_subr.c b/sys/net/altq/altq_subr.c index 609c18482845..68ec9cd80418 100644 --- a/sys/net/altq/altq_subr.c +++ b/sys/net/altq/altq_subr.c @@ -124,7 +124,7 @@ SYSCTL_NODE(_kern_features, OID_AUTO, altq, CTLFLAG_RD | CTLFLAG_CAPRD, 0, desc, "feature") #ifdef ALTQ_CBQ -ALTQ_FEATURE(cbq, "ATLQ Class Based Queuing discipline"); +ALTQ_FEATURE(cbq, "ALTQ Class Based Queuing discipline"); #endif #ifdef ALTQ_CODEL ALTQ_FEATURE(codel, "ALTQ Controlled Delay discipline"); From owner-dev-commits-src-all@freebsd.org Sat Jul 31 13:03: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 F2AEF65C09B; Sat, 31 Jul 2021 13:03: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 4GcPbX5PlKz4SYR; Sat, 31 Jul 2021 13:03: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 9BD8E19498; Sat, 31 Jul 2021 13:03: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 16VD3qsY066437; Sat, 31 Jul 2021 13:03:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16VD3qON066436; Sat, 31 Jul 2021 13:03:52 GMT (envelope-from git) Date: Sat, 31 Jul 2021 13:03:52 GMT Message-Id: <202107311303.16VD3qON066436@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: 58ca52f752a8 - stable/12 - Add FEATURE sysctls for ALTQ disciplines 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: 58ca52f752a81cd670e3f7fc6f300c5667ffe4b3 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, 31 Jul 2021 13:03:53 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=58ca52f752a81cd670e3f7fc6f300c5667ffe4b3 commit 58ca52f752a81cd670e3f7fc6f300c5667ffe4b3 Author: Kristof Provost AuthorDate: 2021-01-23 09:36:33 +0000 Commit: Kristof Provost CommitDate: 2021-07-31 09:12:51 +0000 Add FEATURE sysctls for ALTQ disciplines This will allow userspace to more easily figure out if ALTQ is built into the kernel and what disciplines are supported. Reviewed by: donner@ Differential Revision: https://reviews.freebsd.org/D28302 (cherry picked from commit e111d79806fe3652bc85593ca77ee1b4ff85498d) --- sys/net/altq/altq_subr.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/sys/net/altq/altq_subr.c b/sys/net/altq/altq_subr.c index 01aa1efef53d..f28a4383364a 100644 --- a/sys/net/altq/altq_subr.c +++ b/sys/net/altq/altq_subr.c @@ -117,6 +117,38 @@ static struct ip4_frag *ip4f_alloc(void); static void ip4f_free(struct ip4_frag *); #endif /* ALTQ3_CLFIER_COMPAT */ +#ifdef ALTQ +SYSCTL_NODE(_kern_features, OID_AUTO, altq, CTLFLAG_RD | CTLFLAG_CAPRD, 0, + "ALTQ packet queuing"); + +#define ALTQ_FEATURE(name, desc) \ + SYSCTL_INT_WITH_LABEL(_kern_features_altq, OID_AUTO, name, \ + CTLFLAG_RD | CTLFLAG_CAPRD, SYSCTL_NULL_INT_PTR, 1, \ + desc, "feature") + +#ifdef ALTQ_CBQ +ALTQ_FEATURE(cbq, "ATLQ Class Based Queuing discipline"); +#endif +#ifdef ALTQ_CODEL +ALTQ_FEATURE(codel, "ALTQ Controlled Delay discipline"); +#endif +#ifdef ALTQ_RED +ALTQ_FEATURE(red, "ALTQ Random Early Detection discipline"); +#endif +#ifdef ALTQ_RIO +ALTQ_FEATURE(rio, "ALTQ Random Early Drop discipline"); +#endif +#ifdef ALTQ_HFSC +ALTQ_FEATURE(hfsc, "ALTQ Hierarchical Packet Scheduler discipline"); +#endif +#ifdef ALTQ_PRIQ +ALTQ_FEATURE(priq, "ATLQ Priority Queuing discipline"); +#endif +#ifdef ALTQ_FAIRQ +ALTQ_FEATURE(fairq, "ALTQ Fair Queuing discipline"); +#endif +#endif + /* * alternate queueing support routines */ From owner-dev-commits-src-all@freebsd.org Sat Jul 31 13:03: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 DB6B765C0A0; Sat, 31 Jul 2021 13:03: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 4GcPbY5GF5z4SSr; Sat, 31 Jul 2021 13:03: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 90F9719426; Sat, 31 Jul 2021 13:03: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 16VD3rpu066461; Sat, 31 Jul 2021 13:03:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16VD3rhq066460; Sat, 31 Jul 2021 13:03:53 GMT (envelope-from git) Date: Sat, 31 Jul 2021 13:03:53 GMT Message-Id: <202107311303.16VD3rhq066460@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: 2400173b9377 - stable/13 - altq tests: Basic ALTQ 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/13 X-Git-Reftype: branch X-Git-Commit: 2400173b937739966d2bf0cc305c564243074cc9 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, 31 Jul 2021 13:03:54 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=2400173b937739966d2bf0cc305c564243074cc9 commit 2400173b937739966d2bf0cc305c564243074cc9 Author: Kristof Provost AuthorDate: 2021-01-23 09:37:03 +0000 Commit: Kristof Provost CommitDate: 2021-07-31 08:12:02 +0000 altq tests: Basic ALTQ test Activate ALTQ_HFSC, crudely check if it really limits bandwidth as we'd expect. Reviewed by: donner@ Differential Revision: https://reviews.freebsd.org/D28303 (cherry picked from commit 16b3833344ad04194f10b567bc6fae829a52a850) --- tests/sys/netpfil/pf/Makefile | 3 ++- tests/sys/netpfil/pf/altq.sh | 49 +++++++++++++++++++++++++++++++++++++++++ tests/sys/netpfil/pf/utils.subr | 24 ++++++++++++++++++++ 3 files changed, 75 insertions(+), 1 deletion(-) diff --git a/tests/sys/netpfil/pf/Makefile b/tests/sys/netpfil/pf/Makefile index cfa5f5c7c912..2f9ce73f381b 100644 --- a/tests/sys/netpfil/pf/Makefile +++ b/tests/sys/netpfil/pf/Makefile @@ -5,7 +5,8 @@ PACKAGE= tests TESTSDIR= ${TESTSBASE}/sys/netpfil/pf TESTS_SUBDIRS+= ioctl -ATF_TESTS_SH+= anchor \ +ATF_TESTS_SH+= altq \ + anchor \ checksum \ dup \ forward \ diff --git a/tests/sys/netpfil/pf/altq.sh b/tests/sys/netpfil/pf/altq.sh new file mode 100644 index 000000000000..89da4c0deb6f --- /dev/null +++ b/tests/sys/netpfil/pf/altq.sh @@ -0,0 +1,49 @@ +. $(atf_get_srcdir)/utils.subr + +atf_test_case "hfsc" "cleanup" +hfsc_head() +{ + atf_set descr 'Basic HFSC test' + atf_set require.user root +} + +hfsc_body() +{ + altq_init + is_altq_supported hfsc + + epair=$(vnet_mkepair) + vnet_mkjail altq_hfsc ${epair}b + + ifconfig ${epair}a 192.0.2.1/24 up + jexec altq_hfsc ifconfig ${epair}b 192.0.2.2/24 up + + # Sanity check + atf_check -s exit:0 -o ignore ping -i .1 -c 3 -s 1200 192.0.2.2 + + jexec altq_hfsc pfctl -e + pft_set_rules altq_hfsc \ + "altq on ${epair}b bandwidth 100b hfsc queue { default }" \ + "queue default hfsc(default linkshare 80b)" \ + "pass proto icmp " + + # single ping succeeds just fine + atf_check -s exit:0 -o ignore ping -c 1 192.0.2.2 + + # "Saturate the link" + ping -i .1 -c 5 -s 1200 192.0.2.2 + + # We should now be hitting the limits and get this packet dropped. + atf_check -s exit:2 -o ignore ping -c 1 -s 1200 192.0.2.2 +} + +hfsc_cleanup() +{ + altq_cleanup +} + +atf_init_test_cases() +{ + atf_add_test_case "hfsc" +} + diff --git a/tests/sys/netpfil/pf/utils.subr b/tests/sys/netpfil/pf/utils.subr index 62e85d5cc463..d7df2a6747da 100644 --- a/tests/sys/netpfil/pf/utils.subr +++ b/tests/sys/netpfil/pf/utils.subr @@ -79,3 +79,27 @@ pfsynct_cleanup() { pft_cleanup } + +is_altq_supported() +{ + sysctl -q kern.features.altq >/dev/null || \ + atf_skip "Test requires ALTQ" + + while [ -n "$1" ] + do + sysctl -q kern.features.altq.${1} >/dev/null || \ + atf_skip "Test required ALTQ_${1}" + shift + done +} + +altq_init() +{ + pft_init + is_altq_supported +} + +altq_cleanup() +{ + pft_cleanup +} From owner-dev-commits-src-all@freebsd.org Sat Jul 31 13:03: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 7A91165C46E; Sat, 31 Jul 2021 13:03: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 4GcPbZ6Lj7z4SYZ; Sat, 31 Jul 2021 13:03: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 B80FB18ECD; Sat, 31 Jul 2021 13:03: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 16VD3s9C066509; Sat, 31 Jul 2021 13:03:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16VD3soN066508; Sat, 31 Jul 2021 13:03:54 GMT (envelope-from git) Date: Sat, 31 Jul 2021 13:03:54 GMT Message-Id: <202107311303.16VD3soN066508@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: 70d4a7a966ef - stable/13 - pf: match keyword support 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: 70d4a7a966ef083892f055ef56eb14bba10ff5e9 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, 31 Jul 2021 13:03:55 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=70d4a7a966ef083892f055ef56eb14bba10ff5e9 commit 70d4a7a966ef083892f055ef56eb14bba10ff5e9 Author: Kristof Provost AuthorDate: 2021-03-02 15:01:04 +0000 Commit: Kristof Provost CommitDate: 2021-07-31 08:12:02 +0000 pf: match keyword support Support the 'match' keyword. Note that support is limited to adding queuing information, so without ALTQ support in the kernel setting match rules is pointless. For the avoidance of doubt: this is NOT full support for the match keyword as found in OpenBSD's pf. That could potentially be built on top of this, but this commit is NOT that. MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31115 (cherry picked from commit ef950daa35d43dd396958ca28ce9de0514daf873) --- sbin/pfctl/parse.y | 4 ++- sbin/pfctl/pf_ruleset.c | 1 + sbin/pfctl/pfctl_parser.c | 4 ++- sys/net/pfvar.h | 8 +++++ sys/netpfil/pf/pf.c | 81 +++++++++++++++++++++++++++++++++++++-------- sys/netpfil/pf/pf.h | 3 +- sys/netpfil/pf/pf_ruleset.c | 1 + 7 files changed, 85 insertions(+), 17 deletions(-) diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index 19fb87323060..dbfe299cf34f 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -456,7 +456,7 @@ int parseport(char *, struct range *r, int); %} -%token PASS BLOCK SCRUB RETURN IN OS OUT LOG QUICK ON FROM TO FLAGS +%token PASS BLOCK MATCH SCRUB RETURN IN OS OUT LOG QUICK ON FROM TO FLAGS %token RETURNRST RETURNICMP RETURNICMP6 PROTO INET INET6 ALL ANY ICMPTYPE %token ICMP6TYPE CODE KEEP MODULATE STATE PORT RDR NAT BINAT ARROW NODF %token MINTTL ERROR ALLOWOPTS FASTROUTE FILENAME ROUTETO DUPTO REPLYTO NO LABEL @@ -2692,6 +2692,7 @@ action : PASS { $$.w = returnicmpdefault; $$.w2 = returnicmp6default; } + | MATCH { $$.b1 = PF_MATCH; $$.b2 = $$.w = 0; } | BLOCK blockspec { $$ = $2; $$.b1 = PF_DROP; } ; @@ -5627,6 +5628,7 @@ lookup(char *s) { "log", LOG}, { "loginterface", LOGINTERFACE}, { "map-e-portset", MAPEPORTSET}, + { "match", MATCH}, { "max", MAXIMUM}, { "max-mss", MAXMSS}, { "max-src-conn", MAXSRCCONN}, diff --git a/sbin/pfctl/pf_ruleset.c b/sbin/pfctl/pf_ruleset.c index f5cddf481871..480e0f0c9b45 100644 --- a/sbin/pfctl/pf_ruleset.c +++ b/sbin/pfctl/pf_ruleset.c @@ -106,6 +106,7 @@ pf_get_ruleset_number(u_int8_t action) break; case PF_PASS: case PF_DROP: + case PF_MATCH: return (PF_RULESET_FILTER); break; case PF_NAT: diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c index e3efd20d3822..8991073ec693 100644 --- a/sbin/pfctl/pfctl_parser.c +++ b/sbin/pfctl/pfctl_parser.c @@ -713,7 +713,9 @@ print_rule(struct pfctl_rule *r, const char *anchor_call, int verbose, int numer if (verbose) printf("@%d ", r->nr); - if (r->action > PF_NORDR) + if (r->action == PF_MATCH) + printf("match"); + else if (r->action > PF_NORDR) printf("action(%d)", r->action); else if (anchor_call[0]) { if (anchor_call[0] == '_') { diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index e54e734dcecf..7a244ac13d72 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -339,6 +339,11 @@ struct pf_kpool { u_int8_t opts; }; +struct pf_rule_actions { + u_int32_t qid; + u_int32_t pqid; +}; + union pf_krule_ptr { struct pf_krule *ptr; u_int32_t nr; @@ -625,6 +630,8 @@ struct pf_kstate { u_int32_t creation; u_int32_t expire; u_int32_t pfsync_time; + u_int32_t qid; + u_int32_t pqid; u_int16_t tag; u_int8_t log; }; @@ -1068,6 +1075,7 @@ struct pf_pdesc { u_int16_t *sport; u_int16_t *dport; struct pf_mtag *pf_mtag; + struct pf_rule_actions act; u_int32_t p_len; /* total length of payload */ diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 4005e453cfb7..87912046f8d3 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -251,6 +251,8 @@ static int pf_state_key_attach(struct pf_state_key *, static void pf_state_key_detach(struct pf_kstate *, int); static int pf_state_key_ctor(void *, int, void *, int); static u_int32_t pf_tcp_iss(struct pf_pdesc *); +void pf_rule_to_actions(struct pf_krule *, + struct pf_rule_actions *); static int pf_test_rule(struct pf_krule **, struct pf_kstate **, int, struct pfi_kkif *, struct mbuf *, int, struct pf_pdesc *, struct pf_krule **, @@ -3133,6 +3135,15 @@ pf_addr_inc(struct pf_addr *addr, sa_family_t af) } #endif /* INET6 */ +void +pf_rule_to_actions(struct pf_krule *r, struct pf_rule_actions *a) +{ + if (r->qid) + a->qid = r->qid; + if (r->pqid) + a->pqid = r->pqid; +} + int pf_socket_lookup(int direction, struct pf_pdesc *pd, struct mbuf *m) { @@ -3641,10 +3652,20 @@ pf_test_rule(struct pf_krule **rm, struct pf_kstate **sm, int direction, if (r->rtableid >= 0) rtableid = r->rtableid; if (r->anchor == NULL) { - match = 1; - *rm = r; - *am = a; - *rsm = ruleset; + if (r->action == PF_MATCH) { + counter_u64_add(r->packets[direction == PF_OUT], 1); + counter_u64_add(r->bytes[direction == PF_OUT], pd->tot_len); + pf_rule_to_actions(r, &pd->act); + if (r->log) + PFLOG_PACKET(kif, m, af, + direction, PFRES_MATCH, r, + a, ruleset, pd, 1); + } else { + match = 1; + *rm = r; + *am = a; + *rsm = ruleset; + } if ((*rm)->quick) break; r = TAILQ_NEXT(r, entries); @@ -3663,6 +3684,9 @@ pf_test_rule(struct pf_krule **rm, struct pf_kstate **sm, int direction, REASON_SET(&reason, PFRES_MATCH); + /* apply actions for last matching pass/block rule */ + pf_rule_to_actions(r, &pd->act); + if (r->log || (nr != NULL && nr->log)) { if (rewrite) m_copyback(m, off, hdrlen, pd->hdr.any); @@ -3781,6 +3805,8 @@ pf_create_state(struct pf_krule *r, struct pf_krule *nr, struct pf_krule *a, s->state_flags |= PFSTATE_SLOPPY; s->log = r->log & PF_LOG_ALL; s->sync_state = PFSYNC_S_NONE; + s->qid = pd->act.qid; + s->pqid = pd->act.pqid; if (nr != NULL) s->log |= nr->log & PF_LOG_ALL; switch (pd->proto) { @@ -4040,10 +4066,20 @@ pf_test_fragment(struct pf_krule **rm, int direction, struct pfi_kkif *kif, r = TAILQ_NEXT(r, entries); else { if (r->anchor == NULL) { - match = 1; - *rm = r; - *am = a; - *rsm = ruleset; + if (r->action == PF_MATCH) { + counter_u64_add(r->packets[direction == PF_OUT], 1); + counter_u64_add(r->bytes[direction == PF_OUT], pd->tot_len); + pf_rule_to_actions(r, &pd->act); + if (r->log) + PFLOG_PACKET(kif, m, af, + direction, PFRES_MATCH, r, + a, ruleset, pd, 1); + } else { + match = 1; + *rm = r; + *am = a; + *rsm = ruleset; + } if ((*rm)->quick) break; r = TAILQ_NEXT(r, entries); @@ -4062,6 +4098,9 @@ pf_test_fragment(struct pf_krule **rm, int direction, struct pfi_kkif *kif, REASON_SET(&reason, PFRES_MATCH); + /* apply actions for last matching pass/block rule */ + pf_rule_to_actions(r, &pd->act); + if (r->log) PFLOG_PACKET(kif, m, af, direction, reason, r, a, ruleset, pd, 1); @@ -6237,7 +6276,14 @@ done: } #ifdef ALTQ - if (action == PF_PASS && r->qid) { + if (s && s->qid) { + pd.act.pqid = s->pqid; + pd.act.qid = s->qid; + } else if (r->qid) { + pd.act.pqid = r->pqid; + pd.act.qid = r->qid; + } + if (action == PF_PASS && pd.act.qid) { if (pd.pf_mtag == NULL && ((pd.pf_mtag = pf_get_mtag(m)) == NULL)) { action = PF_DROP; @@ -6246,9 +6292,9 @@ done: if (s != NULL) pd.pf_mtag->qid_hash = pf_state_hash(s); if (pqid || (pd.tos & IPTOS_LOWDELAY)) - pd.pf_mtag->qid = r->pqid; + pd.pf_mtag->qid = pd.act.pqid; else - pd.pf_mtag->qid = r->qid; + pd.pf_mtag->qid = pd.act.qid; /* Add hints for ecn. */ pd.pf_mtag->hdr = h; } @@ -6677,7 +6723,14 @@ done: } #ifdef ALTQ - if (action == PF_PASS && r->qid) { + if (s && s->qid) { + pd.act.pqid = s->pqid; + pd.act.qid = s->qid; + } else if (r->qid) { + pd.act.pqid = r->pqid; + pd.act.qid = r->qid; + } + if (action == PF_PASS && pd.act.qid) { if (pd.pf_mtag == NULL && ((pd.pf_mtag = pf_get_mtag(m)) == NULL)) { action = PF_DROP; @@ -6686,9 +6739,9 @@ done: if (s != NULL) pd.pf_mtag->qid_hash = pf_state_hash(s); if (pd.tos & IPTOS_LOWDELAY) - pd.pf_mtag->qid = r->pqid; + pd.pf_mtag->qid = pd.act.pqid; else - pd.pf_mtag->qid = r->qid; + pd.pf_mtag->qid = pd.act.qid; /* Add hints for ecn. */ pd.pf_mtag->hdr = h; } diff --git a/sys/netpfil/pf/pf.h b/sys/netpfil/pf/pf.h index 869e8e32eb5c..245d68b4be45 100644 --- a/sys/netpfil/pf/pf.h +++ b/sys/netpfil/pf/pf.h @@ -49,7 +49,8 @@ enum { PF_INOUT, PF_IN, PF_OUT }; enum { PF_PASS, PF_DROP, PF_SCRUB, PF_NOSCRUB, PF_NAT, PF_NONAT, - PF_BINAT, PF_NOBINAT, PF_RDR, PF_NORDR, PF_SYNPROXY_DROP, PF_DEFER }; + PF_BINAT, PF_NOBINAT, PF_RDR, PF_NORDR, PF_SYNPROXY_DROP, PF_DEFER, + PF_MATCH }; enum { PF_RULESET_SCRUB, PF_RULESET_FILTER, PF_RULESET_NAT, PF_RULESET_BINAT, PF_RULESET_RDR, PF_RULESET_MAX }; enum { PF_OP_NONE, PF_OP_IRG, PF_OP_EQ, PF_OP_NE, PF_OP_LT, diff --git a/sys/netpfil/pf/pf_ruleset.c b/sys/netpfil/pf/pf_ruleset.c index ad1b07f69fe6..c21f4dfdd4a0 100644 --- a/sys/netpfil/pf/pf_ruleset.c +++ b/sys/netpfil/pf/pf_ruleset.c @@ -95,6 +95,7 @@ pf_get_ruleset_number(u_int8_t action) return (PF_RULESET_SCRUB); break; case PF_PASS: + case PF_MATCH: case PF_DROP: return (PF_RULESET_FILTER); break; From owner-dev-commits-src-all@freebsd.org Sat Jul 31 13:03: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 96D9765C31C; Sat, 31 Jul 2021 13:03: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 4GcPbc2Kdvz4SDH; Sat, 31 Jul 2021 13:03: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 D489E191AB; Sat, 31 Jul 2021 13:03: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 16VD3tPO066559; Sat, 31 Jul 2021 13:03:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16VD3tSj066558; Sat, 31 Jul 2021 13:03:55 GMT (envelope-from git) Date: Sat, 31 Jul 2021 13:03:55 GMT Message-Id: <202107311303.16VD3tSj066558@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: c1bb4edaa06d - stable/13 - pf tests: Test the match keyword 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: c1bb4edaa06dd1d8d81fadc9b6aa6d87693976b9 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, 31 Jul 2021 13:03:56 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=c1bb4edaa06dd1d8d81fadc9b6aa6d87693976b9 commit c1bb4edaa06dd1d8d81fadc9b6aa6d87693976b9 Author: Kristof Provost AuthorDate: 2021-03-02 15:57:27 +0000 Commit: Kristof Provost CommitDate: 2021-07-31 08:12:02 +0000 pf tests: Test the match keyword The new match keyword can currently only assign queues, so we can only test it with ALTQ. Set up a basic scenario where we use 'match' to assign ICMP traffic to a slow queue, and confirm that it's really getting slowed down. MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31116 (cherry picked from commit d363ebc78cbb50bc334d74fb5bb755af53c69ff0) --- tests/sys/netpfil/pf/altq.sh | 45 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/tests/sys/netpfil/pf/altq.sh b/tests/sys/netpfil/pf/altq.sh index 89da4c0deb6f..294c01e9f8bd 100644 --- a/tests/sys/netpfil/pf/altq.sh +++ b/tests/sys/netpfil/pf/altq.sh @@ -42,8 +42,53 @@ hfsc_cleanup() altq_cleanup } +atf_test_case "match" "cleanup" +match_head() +{ + atf_set descr 'Basic match keyword test' + atf_set require.user root +} + +match_body() +{ + altq_init + is_altq_supported hfsc + + epair=$(vnet_mkepair) + vnet_mkjail altq_match ${epair}b + + ifconfig ${epair}a 192.0.2.1/24 up + jexec altq_match ifconfig ${epair}b 192.0.2.2/24 up + + # Sanity check + atf_check -s exit:0 -o ignore ping -i .1 -c 3 -s 1200 192.0.2.2 + + jexec altq_match pfctl -e + pft_set_rules altq_match \ + "altq on ${epair}b bandwidth 100000000b hfsc queue { default, slow }" \ + "queue default hfsc(default linkshare 80000000b)" \ + "queue slow hfsc(linkshare 80b upperlimit 80b)" \ + "match proto icmp queue slow" \ + "pass" + + # single ping succeeds just fine + atf_check -s exit:0 -o ignore ping -c 1 192.0.2.2 + + # "Saturate the link" + ping -i .1 -c 5 -s 1200 192.0.2.2 + + # We should now be hitting the limits and get this packet dropped. + atf_check -s exit:2 -o ignore ping -c 1 -s 1200 192.0.2.2 +} + +match_cleanup() +{ + altq_cleanup +} + atf_init_test_cases() { atf_add_test_case "hfsc" + atf_add_test_case "match" } From owner-dev-commits-src-all@freebsd.org Sat Jul 31 13:03: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 9404265C0AA; Sat, 31 Jul 2021 13:03: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 4GcPbd2g5vz4SbZ; Sat, 31 Jul 2021 13:03: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 2CFDD193BE; Sat, 31 Jul 2021 13:03: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 16VD3vrM066636; Sat, 31 Jul 2021 13:03:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16VD3vN4066635; Sat, 31 Jul 2021 13:03:57 GMT (envelope-from git) Date: Sat, 31 Jul 2021 13:03:57 GMT Message-Id: <202107311303.16VD3vN4066635@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: 4f2821ab53db - stable/12 - pf tests: Test the match keyword 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: 4f2821ab53dbfbe08ecf02caff78afff54bdedaa 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, 31 Jul 2021 13:03:58 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=4f2821ab53dbfbe08ecf02caff78afff54bdedaa commit 4f2821ab53dbfbe08ecf02caff78afff54bdedaa Author: Kristof Provost AuthorDate: 2021-03-02 15:57:27 +0000 Commit: Kristof Provost CommitDate: 2021-07-31 09:14:31 +0000 pf tests: Test the match keyword The new match keyword can currently only assign queues, so we can only test it with ALTQ. Set up a basic scenario where we use 'match' to assign ICMP traffic to a slow queue, and confirm that it's really getting slowed down. MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31116 (cherry picked from commit d363ebc78cbb50bc334d74fb5bb755af53c69ff0) --- tests/sys/netpfil/pf/altq.sh | 45 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/tests/sys/netpfil/pf/altq.sh b/tests/sys/netpfil/pf/altq.sh index 89da4c0deb6f..294c01e9f8bd 100644 --- a/tests/sys/netpfil/pf/altq.sh +++ b/tests/sys/netpfil/pf/altq.sh @@ -42,8 +42,53 @@ hfsc_cleanup() altq_cleanup } +atf_test_case "match" "cleanup" +match_head() +{ + atf_set descr 'Basic match keyword test' + atf_set require.user root +} + +match_body() +{ + altq_init + is_altq_supported hfsc + + epair=$(vnet_mkepair) + vnet_mkjail altq_match ${epair}b + + ifconfig ${epair}a 192.0.2.1/24 up + jexec altq_match ifconfig ${epair}b 192.0.2.2/24 up + + # Sanity check + atf_check -s exit:0 -o ignore ping -i .1 -c 3 -s 1200 192.0.2.2 + + jexec altq_match pfctl -e + pft_set_rules altq_match \ + "altq on ${epair}b bandwidth 100000000b hfsc queue { default, slow }" \ + "queue default hfsc(default linkshare 80000000b)" \ + "queue slow hfsc(linkshare 80b upperlimit 80b)" \ + "match proto icmp queue slow" \ + "pass" + + # single ping succeeds just fine + atf_check -s exit:0 -o ignore ping -c 1 192.0.2.2 + + # "Saturate the link" + ping -i .1 -c 5 -s 1200 192.0.2.2 + + # We should now be hitting the limits and get this packet dropped. + atf_check -s exit:2 -o ignore ping -c 1 -s 1200 192.0.2.2 +} + +match_cleanup() +{ + altq_cleanup +} + atf_init_test_cases() { atf_add_test_case "hfsc" + atf_add_test_case "match" } From owner-dev-commits-src-all@freebsd.org Sat Jul 31 13:03: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 7B6D965C323; Sat, 31 Jul 2021 13:03: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 4GcPbd2fdSz4SYj; Sat, 31 Jul 2021 13:03: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 EBD7A18ECE; Sat, 31 Jul 2021 13:03: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 16VD3uiI066611; Sat, 31 Jul 2021 13:03:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16VD3uqX066610; Sat, 31 Jul 2021 13:03:56 GMT (envelope-from git) Date: Sat, 31 Jul 2021 13:03:56 GMT Message-Id: <202107311303.16VD3uqX066610@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: 7408fb55f03c - stable/13 - pf.conf.5: Document new 'match' keyword 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: 7408fb55f03c71f73fca50be36a864c468713293 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, 31 Jul 2021 13:03:58 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=7408fb55f03c71f73fca50be36a864c468713293 commit 7408fb55f03c71f73fca50be36a864c468713293 Author: Kristof Provost AuthorDate: 2021-03-02 19:34:41 +0000 Commit: Kristof Provost CommitDate: 2021-07-31 08:12:10 +0000 pf.conf.5: Document new 'match' keyword Reviewed by: bcr Obtained from: pfSense MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31117 (cherry picked from commit 0351b9875a3eb5eb4b502a4106b1917ce954e959) --- share/man/man5/pf.conf.5 | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/share/man/man5/pf.conf.5 b/share/man/man5/pf.conf.5 index 00fbd4421e7f..7b97657d7d1c 100644 --- a/share/man/man5/pf.conf.5 +++ b/share/man/man5/pf.conf.5 @@ -1236,8 +1236,10 @@ below. .Xr pf 4 has the ability to .Ar block -and +, .Ar pass +and +.Ar match packets based on attributes of their layer 3 (see .Xr ip 4 and @@ -1253,7 +1255,15 @@ assigned to queues for the purpose of bandwidth control. .Pp For each packet processed by the packet filter, the filter rules are evaluated in sequential order, from first to last. -The last matching rule decides what action is taken. +For +.Ar block +and +.Ar pass +, the last matching rule decides what action is taken. +For +.Ar match +, rules are evaulated every time they match; the pass/block state of a packet +remains unchanged. If no rule matches the packet, the default action is to pass the packet. .Pp @@ -1301,6 +1311,21 @@ packets that match explicit rules is specify a first filter rule of: .Bd -literal -offset indent block all .Ed +.It Ar match +The packet is matched. +This mechanism is used to provide fine grained filtering without altering the +block/pass state of a packet. +.Ar match +rules differ from +.Ar block +and +.Ar pass +rules in that parameters are set every time a packet matches the rule, not only +on the last matching rule. +For the following parameters, this means that the parameter effectively becomes +"sticky" until explicitly overridden: +.Ar queue +. .It Ar pass The packet is passed; state is created unless the From owner-dev-commits-src-all@freebsd.org Sat Jul 31 13:03: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 6D8F565C508; Sat, 31 Jul 2021 13:03: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 4GcPbg1lpqz4Sl2; Sat, 31 Jul 2021 13:03: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 514F218ECF; Sat, 31 Jul 2021 13:03: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 16VD3wov066684; Sat, 31 Jul 2021 13:03:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16VD3wpl066683; Sat, 31 Jul 2021 13:03:58 GMT (envelope-from git) Date: Sat, 31 Jul 2021 13:03:58 GMT Message-Id: <202107311303.16VD3wpl066683@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: 5d1a26544c90 - stable/12 - pf.conf.5: Document new 'match' keyword 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: 5d1a26544c9065075dc0095b9eb356bfc5987986 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, 31 Jul 2021 13:03:59 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=5d1a26544c9065075dc0095b9eb356bfc5987986 commit 5d1a26544c9065075dc0095b9eb356bfc5987986 Author: Kristof Provost AuthorDate: 2021-03-02 19:34:41 +0000 Commit: Kristof Provost CommitDate: 2021-07-31 09:14:36 +0000 pf.conf.5: Document new 'match' keyword Reviewed by: bcr Obtained from: pfSense MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31117 (cherry picked from commit 0351b9875a3eb5eb4b502a4106b1917ce954e959) --- share/man/man5/pf.conf.5 | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/share/man/man5/pf.conf.5 b/share/man/man5/pf.conf.5 index ca0f0da02047..48902f11cf15 100644 --- a/share/man/man5/pf.conf.5 +++ b/share/man/man5/pf.conf.5 @@ -1237,8 +1237,10 @@ below. .Xr pf 4 has the ability to .Ar block -and +, .Ar pass +and +.Ar match packets based on attributes of their layer 3 (see .Xr ip 4 and @@ -1254,7 +1256,15 @@ assigned to queues for the purpose of bandwidth control. .Pp For each packet processed by the packet filter, the filter rules are evaluated in sequential order, from first to last. -The last matching rule decides what action is taken. +For +.Ar block +and +.Ar pass +, the last matching rule decides what action is taken. +For +.Ar match +, rules are evaulated every time they match; the pass/block state of a packet +remains unchanged. If no rule matches the packet, the default action is to pass the packet. .Pp @@ -1302,6 +1312,21 @@ packets that match explicit rules is specify a first filter rule of: .Bd -literal -offset indent block all .Ed +.It Ar match +The packet is matched. +This mechanism is used to provide fine grained filtering without altering the +block/pass state of a packet. +.Ar match +rules differ from +.Ar block +and +.Ar pass +rules in that parameters are set every time a packet matches the rule, not only +on the last matching rule. +For the following parameters, this means that the parameter effectively becomes +"sticky" until explicitly overridden: +.Ar queue +. .It Ar pass The packet is passed; state is created unless the From owner-dev-commits-src-all@freebsd.org Sat Jul 31 13:03: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 61A2F65C484; Sat, 31 Jul 2021 13:03: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 4GcPbZ0tGJz4SYX; Sat, 31 Jul 2021 13:03: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 BEB0219499; Sat, 31 Jul 2021 13:03: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 16VD3rv3066485; Sat, 31 Jul 2021 13:03:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16VD3rvd066484; Sat, 31 Jul 2021 13:03:53 GMT (envelope-from git) Date: Sat, 31 Jul 2021 13:03:53 GMT Message-Id: <202107311303.16VD3rvd066484@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: 8e1505eed376 - stable/12 - altq: Fix typo in features sysctl description 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: 8e1505eed376267fec4b89f655226c8ef16ab6f0 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, 31 Jul 2021 13:03:54 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=8e1505eed376267fec4b89f655226c8ef16ab6f0 commit 8e1505eed376267fec4b89f655226c8ef16ab6f0 Author: Kristof Provost AuthorDate: 2021-01-26 15:02:45 +0000 Commit: Kristof Provost CommitDate: 2021-07-31 09:13:20 +0000 altq: Fix typo in features sysctl description Reported by: Jose Luis Duran (cherry picked from commit 35dabb7b9cff601045b623aeca59ccc68930d520) --- sys/net/altq/altq_subr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/net/altq/altq_subr.c b/sys/net/altq/altq_subr.c index f28a4383364a..e69fbdf15020 100644 --- a/sys/net/altq/altq_subr.c +++ b/sys/net/altq/altq_subr.c @@ -127,7 +127,7 @@ SYSCTL_NODE(_kern_features, OID_AUTO, altq, CTLFLAG_RD | CTLFLAG_CAPRD, 0, desc, "feature") #ifdef ALTQ_CBQ -ALTQ_FEATURE(cbq, "ATLQ Class Based Queuing discipline"); +ALTQ_FEATURE(cbq, "ALTQ Class Based Queuing discipline"); #endif #ifdef ALTQ_CODEL ALTQ_FEATURE(codel, "ALTQ Controlled Delay discipline"); From owner-dev-commits-src-all@freebsd.org Sat Jul 31 13:03: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 CCBA665C1BA; Sat, 31 Jul 2021 13:03: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 4GcPbf2xdNz4Sky; Sat, 31 Jul 2021 13:03: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 0BF7E19513; Sat, 31 Jul 2021 13:03: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 16VD3vOh066660; Sat, 31 Jul 2021 13:03:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16VD3vgs066659; Sat, 31 Jul 2021 13:03:57 GMT (envelope-from git) Date: Sat, 31 Jul 2021 13:03:57 GMT Message-Id: <202107311303.16VD3vgs066659@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: adde304e5348 - stable/13 - pf: fix ABI breakage 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: adde304e53488bec9ec5ba4d589f365e9e0c4aad 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, 31 Jul 2021 13:03:58 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=adde304e53488bec9ec5ba4d589f365e9e0c4aad commit adde304e53488bec9ec5ba4d589f365e9e0c4aad Author: Kristof Provost AuthorDate: 2021-07-28 09:24:44 +0000 Commit: Kristof Provost CommitDate: 2021-07-31 08:12:20 +0000 pf: fix ABI breakage The introduction of synproxy support changed the size of struct pf_status, which in turn broke the userspace ABI. Revert the relevant change. More work is needed on the synproxy code to keep and expose the counters, but in the mean time this restores the ABI. PR: 257469 MFC after: 3 days Sponsored by: Modirum MDPay (cherry picked from commit da8d8b22e69c72f1d001d55b5eff5acbb0265cfc) --- sys/netpfil/pf/pf.h | 3 +-- sys/netpfil/pf/pf_syncookies.c | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/sys/netpfil/pf/pf.h b/sys/netpfil/pf/pf.h index 245d68b4be45..e030f1e59de0 100644 --- a/sys/netpfil/pf/pf.h +++ b/sys/netpfil/pf/pf.h @@ -160,8 +160,7 @@ enum { PF_ADDR_ADDRMASK, PF_ADDR_NOROUTE, PF_ADDR_DYNIFTL, #define LCNT_SRCCONNRATE 4 /* max-src-conn-rate */ #define LCNT_OVERLOAD_TABLE 5 /* entry added to overload table */ #define LCNT_OVERLOAD_FLUSH 6 /* state entries flushed */ -#define LCNT_SYNCOOKIES_VALID 7 /* syncookies validated */ /* XXX TODO: Ensure no API breakage! */ -#define LCNT_MAX 8 /* total+1 */ +#define LCNT_MAX 7 /* total+1 */ #define LCNT_NAMES { \ "max states per rule", \ diff --git a/sys/netpfil/pf/pf_syncookies.c b/sys/netpfil/pf/pf_syncookies.c index 8699ae855ec8..744a12e4e21d 100644 --- a/sys/netpfil/pf/pf_syncookies.c +++ b/sys/netpfil/pf/pf_syncookies.c @@ -275,7 +275,6 @@ pf_syncookie_validate(struct pf_pdesc *pd) if ((ack & ~0xff) != (hash & ~0xff)) return (0); - counter_u64_add(V_pf_status.lcounters[LCNT_SYNCOOKIES_VALID], 1); return (1); } From owner-dev-commits-src-all@freebsd.org Sat Jul 31 13:03: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 7DD4065C493; Sat, 31 Jul 2021 13:03: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 4GcPbb1Lwfz4SmN; Sat, 31 Jul 2021 13:03: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 E6AD219512; Sat, 31 Jul 2021 13:03: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 16VD3spt066533; Sat, 31 Jul 2021 13:03:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16VD3sRB066532; Sat, 31 Jul 2021 13:03:54 GMT (envelope-from git) Date: Sat, 31 Jul 2021 13:03:54 GMT Message-Id: <202107311303.16VD3sRB066532@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: e02597d7ce67 - stable/12 - altq tests: Basic ALTQ 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: e02597d7ce67b109a2e9aa4ee552cc7bc096131e 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, 31 Jul 2021 13:03:55 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=e02597d7ce67b109a2e9aa4ee552cc7bc096131e commit e02597d7ce67b109a2e9aa4ee552cc7bc096131e Author: Kristof Provost AuthorDate: 2021-01-23 09:37:03 +0000 Commit: Kristof Provost CommitDate: 2021-07-31 09:14:08 +0000 altq tests: Basic ALTQ test Activate ALTQ_HFSC, crudely check if it really limits bandwidth as we'd expect. Reviewed by: donner@ Differential Revision: https://reviews.freebsd.org/D28303 (cherry picked from commit 16b3833344ad04194f10b567bc6fae829a52a850) --- tests/sys/netpfil/pf/Makefile | 3 ++- tests/sys/netpfil/pf/altq.sh | 49 +++++++++++++++++++++++++++++++++++++++++ tests/sys/netpfil/pf/utils.subr | 24 ++++++++++++++++++++ 3 files changed, 75 insertions(+), 1 deletion(-) diff --git a/tests/sys/netpfil/pf/Makefile b/tests/sys/netpfil/pf/Makefile index fde02ea3933b..3882db287f5a 100644 --- a/tests/sys/netpfil/pf/Makefile +++ b/tests/sys/netpfil/pf/Makefile @@ -5,7 +5,8 @@ PACKAGE= tests TESTSDIR= ${TESTSBASE}/sys/netpfil/pf TESTS_SUBDIRS+= ioctl -ATF_TESTS_SH+= anchor \ +ATF_TESTS_SH+= altq \ + anchor \ pass_block \ checksum \ forward \ diff --git a/tests/sys/netpfil/pf/altq.sh b/tests/sys/netpfil/pf/altq.sh new file mode 100644 index 000000000000..89da4c0deb6f --- /dev/null +++ b/tests/sys/netpfil/pf/altq.sh @@ -0,0 +1,49 @@ +. $(atf_get_srcdir)/utils.subr + +atf_test_case "hfsc" "cleanup" +hfsc_head() +{ + atf_set descr 'Basic HFSC test' + atf_set require.user root +} + +hfsc_body() +{ + altq_init + is_altq_supported hfsc + + epair=$(vnet_mkepair) + vnet_mkjail altq_hfsc ${epair}b + + ifconfig ${epair}a 192.0.2.1/24 up + jexec altq_hfsc ifconfig ${epair}b 192.0.2.2/24 up + + # Sanity check + atf_check -s exit:0 -o ignore ping -i .1 -c 3 -s 1200 192.0.2.2 + + jexec altq_hfsc pfctl -e + pft_set_rules altq_hfsc \ + "altq on ${epair}b bandwidth 100b hfsc queue { default }" \ + "queue default hfsc(default linkshare 80b)" \ + "pass proto icmp " + + # single ping succeeds just fine + atf_check -s exit:0 -o ignore ping -c 1 192.0.2.2 + + # "Saturate the link" + ping -i .1 -c 5 -s 1200 192.0.2.2 + + # We should now be hitting the limits and get this packet dropped. + atf_check -s exit:2 -o ignore ping -c 1 -s 1200 192.0.2.2 +} + +hfsc_cleanup() +{ + altq_cleanup +} + +atf_init_test_cases() +{ + atf_add_test_case "hfsc" +} + diff --git a/tests/sys/netpfil/pf/utils.subr b/tests/sys/netpfil/pf/utils.subr index 62e85d5cc463..d7df2a6747da 100644 --- a/tests/sys/netpfil/pf/utils.subr +++ b/tests/sys/netpfil/pf/utils.subr @@ -79,3 +79,27 @@ pfsynct_cleanup() { pft_cleanup } + +is_altq_supported() +{ + sysctl -q kern.features.altq >/dev/null || \ + atf_skip "Test requires ALTQ" + + while [ -n "$1" ] + do + sysctl -q kern.features.altq.${1} >/dev/null || \ + atf_skip "Test required ALTQ_${1}" + shift + done +} + +altq_init() +{ + pft_init + is_altq_supported +} + +altq_cleanup() +{ + pft_cleanup +} From owner-dev-commits-src-all@freebsd.org Sat Jul 31 13:03: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 962F665C495; Sat, 31 Jul 2021 13:03: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 4GcPbc2NTdz4SYf; Sat, 31 Jul 2021 13:03: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 1AA5719669; Sat, 31 Jul 2021 13:03: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 16VD3tvI066585; Sat, 31 Jul 2021 13:03:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16VD3tEw066584; Sat, 31 Jul 2021 13:03:55 GMT (envelope-from git) Date: Sat, 31 Jul 2021 13:03:55 GMT Message-Id: <202107311303.16VD3tEw066584@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: c6fd64da525a - stable/12 - pf: match keyword support 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: c6fd64da525a31890e42cef5665daeba665570d0 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, 31 Jul 2021 13:03:56 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=c6fd64da525a31890e42cef5665daeba665570d0 commit c6fd64da525a31890e42cef5665daeba665570d0 Author: Kristof Provost AuthorDate: 2021-03-02 15:01:04 +0000 Commit: Kristof Provost CommitDate: 2021-07-31 09:14:27 +0000 pf: match keyword support Support the 'match' keyword. Note that support is limited to adding queuing information, so without ALTQ support in the kernel setting match rules is pointless. For the avoidance of doubt: this is NOT full support for the match keyword as found in OpenBSD's pf. That could potentially be built on top of this, but this commit is NOT that. MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31115 (cherry picked from commit ef950daa35d43dd396958ca28ce9de0514daf873) --- sbin/pfctl/parse.y | 4 ++- sbin/pfctl/pf_ruleset.c | 1 + sbin/pfctl/pfctl_parser.c | 4 ++- sys/net/pfvar.h | 8 +++++ sys/netpfil/pf/pf.c | 81 +++++++++++++++++++++++++++++++++++++-------- sys/netpfil/pf/pf.h | 3 +- sys/netpfil/pf/pf_ruleset.c | 1 + 7 files changed, 85 insertions(+), 17 deletions(-) diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index 2655a7939503..0320cdc7ec00 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -456,7 +456,7 @@ int parseport(char *, struct range *r, int); %} -%token PASS BLOCK SCRUB RETURN IN OS OUT LOG QUICK ON FROM TO FLAGS +%token PASS BLOCK MATCH SCRUB RETURN IN OS OUT LOG QUICK ON FROM TO FLAGS %token RETURNRST RETURNICMP RETURNICMP6 PROTO INET INET6 ALL ANY ICMPTYPE %token ICMP6TYPE CODE KEEP MODULATE STATE PORT RDR NAT BINAT ARROW NODF %token MINTTL ERROR ALLOWOPTS FASTROUTE FILENAME ROUTETO DUPTO REPLYTO NO LABEL @@ -2684,6 +2684,7 @@ action : PASS { $$.w = returnicmpdefault; $$.w2 = returnicmp6default; } + | MATCH { $$.b1 = PF_MATCH; $$.b2 = $$.w = 0; } | BLOCK blockspec { $$ = $2; $$.b1 = PF_DROP; } ; @@ -5619,6 +5620,7 @@ lookup(char *s) { "log", LOG}, { "loginterface", LOGINTERFACE}, { "map-e-portset", MAPEPORTSET}, + { "match", MATCH}, { "max", MAXIMUM}, { "max-mss", MAXMSS}, { "max-src-conn", MAXSRCCONN}, diff --git a/sbin/pfctl/pf_ruleset.c b/sbin/pfctl/pf_ruleset.c index f5cddf481871..480e0f0c9b45 100644 --- a/sbin/pfctl/pf_ruleset.c +++ b/sbin/pfctl/pf_ruleset.c @@ -106,6 +106,7 @@ pf_get_ruleset_number(u_int8_t action) break; case PF_PASS: case PF_DROP: + case PF_MATCH: return (PF_RULESET_FILTER); break; case PF_NAT: diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c index 7020a0f6a811..dc2a460a087f 100644 --- a/sbin/pfctl/pfctl_parser.c +++ b/sbin/pfctl/pfctl_parser.c @@ -713,7 +713,9 @@ print_rule(struct pfctl_rule *r, const char *anchor_call, int verbose, int numer if (verbose) printf("@%d ", r->nr); - if (r->action > PF_NORDR) + if (r->action == PF_MATCH) + printf("match"); + else if (r->action > PF_NORDR) printf("action(%d)", r->action); else if (anchor_call[0]) { if (anchor_call[0] == '_') { diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 7d31e4ce21a0..35e2f0f717ba 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -339,6 +339,11 @@ struct pf_kpool { u_int8_t opts; }; +struct pf_rule_actions { + u_int32_t qid; + u_int32_t pqid; +}; + union pf_krule_ptr { struct pf_krule *ptr; u_int32_t nr; @@ -625,6 +630,8 @@ struct pf_kstate { u_int32_t creation; u_int32_t expire; u_int32_t pfsync_time; + u_int32_t qid; + u_int32_t pqid; u_int16_t tag; u_int8_t log; }; @@ -1068,6 +1075,7 @@ struct pf_pdesc { u_int16_t *sport; u_int16_t *dport; struct pf_mtag *pf_mtag; + struct pf_rule_actions act; u_int32_t p_len; /* total length of payload */ diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 4127d526f33c..7b2812a952ce 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -252,6 +252,8 @@ static int pf_state_key_attach(struct pf_state_key *, static void pf_state_key_detach(struct pf_kstate *, int); static int pf_state_key_ctor(void *, int, void *, int); static u_int32_t pf_tcp_iss(struct pf_pdesc *); +void pf_rule_to_actions(struct pf_krule *, + struct pf_rule_actions *); static int pf_test_rule(struct pf_krule **, struct pf_kstate **, int, struct pfi_kkif *, struct mbuf *, int, struct pf_pdesc *, struct pf_krule **, @@ -3135,6 +3137,15 @@ pf_addr_inc(struct pf_addr *addr, sa_family_t af) } #endif /* INET6 */ +void +pf_rule_to_actions(struct pf_krule *r, struct pf_rule_actions *a) +{ + if (r->qid) + a->qid = r->qid; + if (r->pqid) + a->pqid = r->pqid; +} + int pf_socket_lookup(int direction, struct pf_pdesc *pd, struct mbuf *m) { @@ -3642,10 +3653,20 @@ pf_test_rule(struct pf_krule **rm, struct pf_kstate **sm, int direction, if (r->rtableid >= 0) rtableid = r->rtableid; if (r->anchor == NULL) { - match = 1; - *rm = r; - *am = a; - *rsm = ruleset; + if (r->action == PF_MATCH) { + counter_u64_add(r->packets[direction == PF_OUT], 1); + counter_u64_add(r->bytes[direction == PF_OUT], pd->tot_len); + pf_rule_to_actions(r, &pd->act); + if (r->log) + PFLOG_PACKET(kif, m, af, + direction, PFRES_MATCH, r, + a, ruleset, pd, 1); + } else { + match = 1; + *rm = r; + *am = a; + *rsm = ruleset; + } if ((*rm)->quick) break; r = TAILQ_NEXT(r, entries); @@ -3664,6 +3685,9 @@ pf_test_rule(struct pf_krule **rm, struct pf_kstate **sm, int direction, REASON_SET(&reason, PFRES_MATCH); + /* apply actions for last matching pass/block rule */ + pf_rule_to_actions(r, &pd->act); + if (r->log || (nr != NULL && nr->log)) { if (rewrite) m_copyback(m, off, hdrlen, pd->hdr.any); @@ -3782,6 +3806,8 @@ pf_create_state(struct pf_krule *r, struct pf_krule *nr, struct pf_krule *a, s->state_flags |= PFSTATE_SLOPPY; s->log = r->log & PF_LOG_ALL; s->sync_state = PFSYNC_S_NONE; + s->qid = pd->act.qid; + s->pqid = pd->act.pqid; if (nr != NULL) s->log |= nr->log & PF_LOG_ALL; switch (pd->proto) { @@ -4041,10 +4067,20 @@ pf_test_fragment(struct pf_krule **rm, int direction, struct pfi_kkif *kif, r = TAILQ_NEXT(r, entries); else { if (r->anchor == NULL) { - match = 1; - *rm = r; - *am = a; - *rsm = ruleset; + if (r->action == PF_MATCH) { + counter_u64_add(r->packets[direction == PF_OUT], 1); + counter_u64_add(r->bytes[direction == PF_OUT], pd->tot_len); + pf_rule_to_actions(r, &pd->act); + if (r->log) + PFLOG_PACKET(kif, m, af, + direction, PFRES_MATCH, r, + a, ruleset, pd, 1); + } else { + match = 1; + *rm = r; + *am = a; + *rsm = ruleset; + } if ((*rm)->quick) break; r = TAILQ_NEXT(r, entries); @@ -4063,6 +4099,9 @@ pf_test_fragment(struct pf_krule **rm, int direction, struct pfi_kkif *kif, REASON_SET(&reason, PFRES_MATCH); + /* apply actions for last matching pass/block rule */ + pf_rule_to_actions(r, &pd->act); + if (r->log) PFLOG_PACKET(kif, m, af, direction, reason, r, a, ruleset, pd, 1); @@ -6322,7 +6361,14 @@ done: } #ifdef ALTQ - if (action == PF_PASS && r->qid) { + if (s && s->qid) { + pd.act.pqid = s->pqid; + pd.act.qid = s->qid; + } else if (r->qid) { + pd.act.pqid = r->pqid; + pd.act.qid = r->qid; + } + if (action == PF_PASS && pd.act.qid) { if (pd.pf_mtag == NULL && ((pd.pf_mtag = pf_get_mtag(m)) == NULL)) { action = PF_DROP; @@ -6331,9 +6377,9 @@ done: if (s != NULL) pd.pf_mtag->qid_hash = pf_state_hash(s); if (pqid || (pd.tos & IPTOS_LOWDELAY)) - pd.pf_mtag->qid = r->pqid; + pd.pf_mtag->qid = pd.act.pqid; else - pd.pf_mtag->qid = r->qid; + pd.pf_mtag->qid = pd.act.qid; /* Add hints for ecn. */ pd.pf_mtag->hdr = h; } @@ -6767,7 +6813,14 @@ done: } #ifdef ALTQ - if (action == PF_PASS && r->qid) { + if (s && s->qid) { + pd.act.pqid = s->pqid; + pd.act.qid = s->qid; + } else if (r->qid) { + pd.act.pqid = r->pqid; + pd.act.qid = r->qid; + } + if (action == PF_PASS && pd.act.qid) { if (pd.pf_mtag == NULL && ((pd.pf_mtag = pf_get_mtag(m)) == NULL)) { action = PF_DROP; @@ -6776,9 +6829,9 @@ done: if (s != NULL) pd.pf_mtag->qid_hash = pf_state_hash(s); if (pd.tos & IPTOS_LOWDELAY) - pd.pf_mtag->qid = r->pqid; + pd.pf_mtag->qid = pd.act.pqid; else - pd.pf_mtag->qid = r->qid; + pd.pf_mtag->qid = pd.act.qid; /* Add hints for ecn. */ pd.pf_mtag->hdr = h; } diff --git a/sys/netpfil/pf/pf.h b/sys/netpfil/pf/pf.h index 869e8e32eb5c..245d68b4be45 100644 --- a/sys/netpfil/pf/pf.h +++ b/sys/netpfil/pf/pf.h @@ -49,7 +49,8 @@ enum { PF_INOUT, PF_IN, PF_OUT }; enum { PF_PASS, PF_DROP, PF_SCRUB, PF_NOSCRUB, PF_NAT, PF_NONAT, - PF_BINAT, PF_NOBINAT, PF_RDR, PF_NORDR, PF_SYNPROXY_DROP, PF_DEFER }; + PF_BINAT, PF_NOBINAT, PF_RDR, PF_NORDR, PF_SYNPROXY_DROP, PF_DEFER, + PF_MATCH }; enum { PF_RULESET_SCRUB, PF_RULESET_FILTER, PF_RULESET_NAT, PF_RULESET_BINAT, PF_RULESET_RDR, PF_RULESET_MAX }; enum { PF_OP_NONE, PF_OP_IRG, PF_OP_EQ, PF_OP_NE, PF_OP_LT, diff --git a/sys/netpfil/pf/pf_ruleset.c b/sys/netpfil/pf/pf_ruleset.c index 227157c2876d..5adc7bfc2bf6 100644 --- a/sys/netpfil/pf/pf_ruleset.c +++ b/sys/netpfil/pf/pf_ruleset.c @@ -95,6 +95,7 @@ pf_get_ruleset_number(u_int8_t action) return (PF_RULESET_SCRUB); break; case PF_PASS: + case PF_MATCH: case PF_DROP: return (PF_RULESET_FILTER); break; From owner-dev-commits-src-all@freebsd.org Sat Jul 31 13:04: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 F146C65BA6E; Sat, 31 Jul 2021 13:04: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 4GcPbh0yP3z4SYw; Sat, 31 Jul 2021 13:03: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 7620D1966A; Sat, 31 Jul 2021 13:03: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 16VD3x5J066768; Sat, 31 Jul 2021 13:03:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16VD3x0c066767; Sat, 31 Jul 2021 13:03:59 GMT (envelope-from git) Date: Sat, 31 Jul 2021 13:03:59 GMT Message-Id: <202107311303.16VD3x0c066767@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: bca83d9e7f5b - stable/12 - pf: fix ABI breakage 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: bca83d9e7f5b7faa925ca7edde6129f57adcd09d 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, 31 Jul 2021 13:04:01 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=bca83d9e7f5b7faa925ca7edde6129f57adcd09d commit bca83d9e7f5b7faa925ca7edde6129f57adcd09d Author: Kristof Provost AuthorDate: 2021-07-28 09:24:44 +0000 Commit: Kristof Provost CommitDate: 2021-07-31 09:14:44 +0000 pf: fix ABI breakage The introduction of synproxy support changed the size of struct pf_status, which in turn broke the userspace ABI. Revert the relevant change. More work is needed on the synproxy code to keep and expose the counters, but in the mean time this restores the ABI. PR: 257469 MFC after: 3 days Sponsored by: Modirum MDPay (cherry picked from commit da8d8b22e69c72f1d001d55b5eff5acbb0265cfc) --- sys/netpfil/pf/pf.h | 3 +-- sys/netpfil/pf/pf_syncookies.c | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/sys/netpfil/pf/pf.h b/sys/netpfil/pf/pf.h index 245d68b4be45..e030f1e59de0 100644 --- a/sys/netpfil/pf/pf.h +++ b/sys/netpfil/pf/pf.h @@ -160,8 +160,7 @@ enum { PF_ADDR_ADDRMASK, PF_ADDR_NOROUTE, PF_ADDR_DYNIFTL, #define LCNT_SRCCONNRATE 4 /* max-src-conn-rate */ #define LCNT_OVERLOAD_TABLE 5 /* entry added to overload table */ #define LCNT_OVERLOAD_FLUSH 6 /* state entries flushed */ -#define LCNT_SYNCOOKIES_VALID 7 /* syncookies validated */ /* XXX TODO: Ensure no API breakage! */ -#define LCNT_MAX 8 /* total+1 */ +#define LCNT_MAX 7 /* total+1 */ #define LCNT_NAMES { \ "max states per rule", \ diff --git a/sys/netpfil/pf/pf_syncookies.c b/sys/netpfil/pf/pf_syncookies.c index bfcc4b3d4e82..a02ab0370204 100644 --- a/sys/netpfil/pf/pf_syncookies.c +++ b/sys/netpfil/pf/pf_syncookies.c @@ -275,7 +275,6 @@ pf_syncookie_validate(struct pf_pdesc *pd) if ((ack & ~0xff) != (hash & ~0xff)) return (0); - counter_u64_add(V_pf_status.lcounters[LCNT_SYNCOOKIES_VALID], 1); return (1); } From owner-dev-commits-src-all@freebsd.org Sat Jul 31 13:38: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 5C85065E38C; Sat, 31 Jul 2021 13:38: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 4GcQMc2DG8z4XCl; Sat, 31 Jul 2021 13:38: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 3092419A3B; Sat, 31 Jul 2021 13:38: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 16VDcaHj006995; Sat, 31 Jul 2021 13:38:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16VDcaSh006994; Sat, 31 Jul 2021 13:38:36 GMT (envelope-from git) Date: Sat, 31 Jul 2021 13:38:36 GMT Message-Id: <202107311338.16VDcaSh006994@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: 469884cf04a9 - main - LinuxKPI: Make FPU sections thread-safe and use the NOCTX flag. 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: 469884cf04a9b92677c7c83e229ca6b8814f8b0a 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, 31 Jul 2021 13:38:36 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=469884cf04a9b92677c7c83e229ca6b8814f8b0a 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(-) diff --git a/sys/compat/linuxkpi/common/include/asm/fpu/api.h b/sys/compat/linuxkpi/common/include/asm/fpu/api.h index 035ec3620fdd..9c63b2e972bf 100644 --- a/sys/compat/linuxkpi/common/include/asm/fpu/api.h +++ b/sys/compat/linuxkpi/common/include/asm/fpu/api.h @@ -28,41 +28,13 @@ #ifndef _FPU_API_H_ #define _FPU_API_H_ -#if defined(__aarch64__) || defined(__amd64__) || defined(__i386__) +#define kernel_fpu_begin() \ + lkpi_kernel_fpu_begin() -#include +#define kernel_fpu_end() \ + lkpi_kernel_fpu_end() -extern struct fpu_kern_ctx *__lkpi_fpu_ctx; -extern unsigned int __lkpi_fpu_ctx_level; - -static inline void -kernel_fpu_begin() -{ - if (__lkpi_fpu_ctx_level++ == 0) { - fpu_kern_enter(curthread, __lkpi_fpu_ctx, FPU_KERN_NORMAL); - } -} - -static inline void -kernel_fpu_end() -{ - if (--__lkpi_fpu_ctx_level == 0) { - fpu_kern_leave(curthread, __lkpi_fpu_ctx); - } -} - -#else - -static inline void -kernel_fpu_begin() -{ -} - -static inline void -kernel_fpu_end() -{ -} - -#endif +extern void lkpi_kernel_fpu_begin(void); +extern void lkpi_kernel_fpu_end(void); #endif /* _FPU_API_H_ */ diff --git a/sys/compat/linuxkpi/common/include/linux/sched.h b/sys/compat/linuxkpi/common/include/linux/sched.h index 937e9f27870c..5954b16f6496 100644 --- a/sys/compat/linuxkpi/common/include/linux/sched.h +++ b/sys/compat/linuxkpi/common/include/linux/sched.h @@ -82,7 +82,8 @@ struct task_struct { int bsd_interrupt_value; struct work_struct *work; /* current work struct, if set */ struct task_struct *group_leader; - unsigned rcu_section[TS_RCU_TYPE_MAX]; + unsigned rcu_section[TS_RCU_TYPE_MAX]; + unsigned int fpu_ctx_level; }; #define current ({ \ diff --git a/sys/compat/linuxkpi/common/src/linux_fpu.c b/sys/compat/linuxkpi/common/src/linux_fpu.c index 976e55e68ca1..08f7e075d827 100644 --- a/sys/compat/linuxkpi/common/src/linux_fpu.c +++ b/sys/compat/linuxkpi/common/src/linux_fpu.c @@ -30,21 +30,44 @@ #include #include +#include + +#include + +#if defined(__aarch64__) || defined(__amd64__) || defined(__i386__) + #include -struct fpu_kern_ctx *__lkpi_fpu_ctx; -unsigned int __lkpi_fpu_ctx_level = 0; +/* + * Technically the Linux API isn't supposed to allow nesting sections + * either, but currently used versions of GPU drivers rely on nesting + * working, so we only enter the section on the outermost level. + */ + +void +lkpi_kernel_fpu_begin(void) +{ + if ((current->fpu_ctx_level)++ == 0) + fpu_kern_enter(curthread, NULL, FPU_KERN_NOCTX); +} + +void +lkpi_kernel_fpu_end(void) +{ + if (--(current->fpu_ctx_level) == 0) + fpu_kern_leave(curthread, NULL); +} + +#else -static void -linux_fpu_init(void *arg __unused) +void +lkpi_kernel_fpu_begin(void) { - __lkpi_fpu_ctx = fpu_kern_alloc_ctx(0); } -SYSINIT(linux_fpu, SI_SUB_EVENTHANDLER, SI_ORDER_SECOND, linux_fpu_init, NULL); -static void -linux_fpu_uninit(void *arg __unused) +void +lkpi_kernel_fpu_end(void) { - fpu_kern_free_ctx(__lkpi_fpu_ctx); } -SYSUNINIT(linux_fpu, SI_SUB_EVENTHANDLER, SI_ORDER_SECOND, linux_fpu_uninit, NULL); + +#endif diff --git a/sys/conf/files.amd64 b/sys/conf/files.amd64 index 2bc68f6ac9b9..d58cf7927206 100644 --- a/sys/conf/files.amd64 +++ b/sys/conf/files.amd64 @@ -398,9 +398,6 @@ x86/x86/mptable_pci.c optional mptable pci x86/x86/msi.c optional pci x86/xen/pv.c optional xenhvm -compat/linuxkpi/common/src/linux_fpu.c optional compat_linuxkpi \ - compile-with "${LINUXKPI_C}" - contrib/openzfs/module/zcommon/zfs_fletcher_avx512.c optional zfs compile-with "${ZFS_C}" contrib/openzfs/module/zcommon/zfs_fletcher_intel.c optional zfs compile-with "${ZFS_C}" contrib/openzfs/module/zcommon/zfs_fletcher_sse.c optional zfs compile-with "${ZFS_C}" diff --git a/sys/conf/files.arm64 b/sys/conf/files.arm64 index 48ad00e064d5..3bc534073634 100644 --- a/sys/conf/files.arm64 +++ b/sys/conf/files.arm64 @@ -560,10 +560,6 @@ arm64/rockchip/clk/rk3399_pmucru.c optional fdt soc_rockchip_rk3399 # Xilinx arm/xilinx/uart_dev_cdnc.c optional uart soc_xilinx_zynq -# Linuxkpi -compat/linuxkpi/common/src/linux_fpu.c optional compat_linuxkpi \ - compile-with "${LINUXKPI_C}" - # Cloudabi arm64/cloudabi32/cloudabi32_sysvec.c optional compat_cloudabi32 arm64/cloudabi64/cloudabi64_sysvec.c optional compat_cloudabi64 diff --git a/sys/conf/files.i386 b/sys/conf/files.i386 index 8083392c53f6..4f5c1c3cc5d4 100644 --- a/sys/conf/files.i386 +++ b/sys/conf/files.i386 @@ -182,6 +182,3 @@ x86/x86/local_apic.c optional apic x86/x86/mptable.c optional apic x86/x86/mptable_pci.c optional apic pci x86/x86/msi.c optional apic pci - -compat/linuxkpi/common/src/linux_fpu.c optional compat_linuxkpi \ - compile-with "${LINUXKPI_C}" diff --git a/sys/modules/linuxkpi/Makefile b/sys/modules/linuxkpi/Makefile index 81aa607f1302..f922a1fc85a2 100644 --- a/sys/modules/linuxkpi/Makefile +++ b/sys/modules/linuxkpi/Makefile @@ -8,6 +8,7 @@ SRCS= linux_compat.c \ linux_dmi.c \ linux_domain.c \ linux_firmware.c \ + linux_fpu.c \ linux_hrtimer.c \ linux_idr.c \ linux_kmod.c \ @@ -29,7 +30,7 @@ SRCS= linux_compat.c \ .if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "amd64" || \ ${MACHINE_CPUARCH} == "i386" -SRCS+= opt_acpi.h acpi_if.h linux_acpi.c linux_fpu.c +SRCS+= opt_acpi.h acpi_if.h linux_acpi.c .endif SRCS+= ${LINUXKPI_GENSRCS} From owner-dev-commits-src-all@freebsd.org Sat Jul 31 13:41: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 0847B65E2D2; Sat, 31 Jul 2021 13:41: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 4GcQQz6mddz4XDR; Sat, 31 Jul 2021 13:41: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 D068019B6E; Sat, 31 Jul 2021 13:41: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 16VDfV8O015495; Sat, 31 Jul 2021 13:41:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16VDfV2P015494; Sat, 31 Jul 2021 13:41:31 GMT (envelope-from git) Date: Sat, 31 Jul 2021 13:41:31 GMT Message-Id: <202107311341.16VDfV2P015494@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: 792b602a337d - main - Bump the FreeBSD version after making FPU sections thread-safe in the LinuxKPI. 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: 792b602a337ddc5efaa5e5326d9433fe3da7f303 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, 31 Jul 2021 13:41:32 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=792b602a337ddc5efaa5e5326d9433fe3da7f303 commit 792b602a337ddc5efaa5e5326d9433fe3da7f303 Author: Hans Petter Selasky AuthorDate: 2021-07-31 13:40:35 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-31 13:40:57 +0000 Bump the FreeBSD version after making FPU sections thread-safe in the LinuxKPI. Differential Revision: https://reviews.freebsd.org/D29921 MFC after: 1 week Sponsored by: NVIDIA Networking --- 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 11d89ea08bba..de7607e6f90d 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 1400027 +#define __FreeBSD_version 1400028 /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-dev-commits-src-all@freebsd.org Sat Jul 31 13:54: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 E26E965E71B; Sat, 31 Jul 2021 13:54: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 4GcQjc5r5kz4Xd6; Sat, 31 Jul 2021 13:54: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 AF8BA19CC8; Sat, 31 Jul 2021 13:54: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 16VDsCwB033385; Sat, 31 Jul 2021 13:54:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16VDsCY9033384; Sat, 31 Jul 2021 13:54:12 GMT (envelope-from git) Date: Sat, 31 Jul 2021 13:54:12 GMT Message-Id: <202107311354.16VDsCY9033384@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: e18380e34141 - main - amd64: do not assume that kernel is loaded at 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: e18380e341410ce70d97560a22827591f4b2d373 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, 31 Jul 2021 13:54:13 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=e18380e341410ce70d97560a22827591f4b2d373 commit e18380e341410ce70d97560a22827591f4b2d373 Author: Konstantin Belousov AuthorDate: 2021-07-10 19:48:02 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-31 13:53:42 +0000 amd64: do not assume that kernel is loaded at 2M physical Allow any 2M aligned contiguous location below 4G for the staging area location. It should still be mapped by loader at KERNBASE. The assumption kernel makes about loader->kernel handoff with regard to the MMU programming are explicitly listed at the beginning of hammer_time(), where kernphys is calculated. Now kernphys is the variable instead of symbol designating the physical address. Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31121 --- sys/amd64/amd64/machdep.c | 38 ++++++++++++++++++++++-- sys/amd64/amd64/pmap.c | 70 +++++++++++++++++++++++++++------------------ sys/amd64/include/md_var.h | 7 ++--- sys/amd64/include/vmparam.h | 16 +++++++++-- sys/conf/ldscript.amd64 | 5 ++-- 5 files changed, 95 insertions(+), 41 deletions(-) diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index 0cb72314e68d..8599dc2fa8f6 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -1590,7 +1590,10 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) int gsel_tss, x; struct pcpu *pc; struct xstate_hdr *xhdr; - u_int64_t rsp0; + uint64_t cr3, rsp0; + pml4_entry_t *pml4e; + pdp_entry_t *pdpe; + pd_entry_t *pde; char *env; struct user_segment_descriptor *gdt; struct region_descriptor r_gdt; @@ -1599,6 +1602,35 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) TSRAW(&thread0, TS_ENTER, __func__, NULL); + /* + * Calculate kernphys by inspecting page table created by loader. + * The assumptions: + * - kernel is mapped at KERNBASE, backed by contiguous phys memory + * aligned at 2M, below 4G (the latter is important for AP startup) + * - there is a 2M hole at KERNBASE + * - kernel is mapped with 2M superpages + * - all participating memory, i.e. kernel, modules, metadata, + * page table is accessible by pre-created 1:1 mapping + * (right now loader creates 1:1 mapping for lower 4G, and all + * memory is from there) + * - there is a usable memory block right after the end of the + * mapped kernel and all modules/metadata, pointed to by + * physfree, for early allocations + */ + cr3 = rcr3(); + pml4e = (pml4_entry_t *)(cr3 & ~PAGE_MASK) + pmap_pml4e_index( + (vm_offset_t)hammer_time); + pdpe = (pdp_entry_t *)(*pml4e & ~PAGE_MASK) + pmap_pdpe_index( + (vm_offset_t)hammer_time); + pde = (pd_entry_t *)(*pdpe & ~PAGE_MASK) + pmap_pde_index( + (vm_offset_t)hammer_time); + kernphys = (vm_paddr_t)(*pde & ~PDRMASK) - + (vm_paddr_t)(((vm_offset_t)hammer_time - KERNBASE) & ~PDRMASK); + + /* Fix-up for 2M hole */ + physfree += kernphys; + kernphys += NBPDR; + kmdp = init_ops.parse_preload_data(modulep); efi_boot = preload_search_info(kmdp, MODINFO_METADATA | @@ -1644,7 +1676,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) /* Init basic tunables, hz etc */ init_param1(); - thread0.td_kstack = physfree + KERNBASE; + thread0.td_kstack = physfree - kernphys + KERNSTART; thread0.td_kstack_pages = kstack_pages; kstack0_sz = thread0.td_kstack_pages * PAGE_SIZE; bzero((void *)thread0.td_kstack, kstack0_sz); @@ -1681,7 +1713,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) wrmsr(MSR_GSBASE, (u_int64_t)pc); wrmsr(MSR_KGSBASE, 0); /* User value while in the kernel */ - dpcpu_init((void *)(physfree + KERNBASE), 0); + dpcpu_init((void *)(physfree - kernphys + KERNSTART), 0); physfree += DPCPU_SIZE; amd64_bsp_pcpu_init1(pc); /* Non-late cninit() and printf() can be moved up to here. */ diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index 47315c560831..bc203990faa1 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -436,7 +436,8 @@ static u_int64_t DMPDphys; /* phys addr of direct mapped level 2 */ static u_int64_t DMPDPphys; /* phys addr of direct mapped level 3 */ static int ndmpdpphys; /* number of DMPDPphys pages */ -static vm_paddr_t KERNend; /* phys addr of end of bootstrap data */ +vm_paddr_t kernphys; /* phys addr of start of bootstrap data */ +vm_paddr_t KERNend; /* and the end */ /* * pmap_mapdev support pre initialization (i.e. console) @@ -1554,7 +1555,7 @@ nkpt_init(vm_paddr_t addr) #ifdef NKPT pt_pages = NKPT; #else - pt_pages = howmany(addr, NBPDR); + pt_pages = howmany(addr - kernphys, NBPDR) + 1; /* +1 for 2M hole @0 */ pt_pages += NKPDPE(pt_pages); /* @@ -1594,7 +1595,6 @@ nkpt_init(vm_paddr_t addr) static inline pt_entry_t bootaddr_rwx(vm_paddr_t pa) { - /* * The kernel is loaded at a 2MB-aligned address, and memory below that * need not be executable. The .bss section is padded to a 2MB @@ -1602,8 +1602,8 @@ bootaddr_rwx(vm_paddr_t pa) * either. Preloaded kernel modules have their mapping permissions * fixed up by the linker. */ - if (pa < trunc_2mpage(btext - KERNBASE) || - pa >= trunc_2mpage(_end - KERNBASE)) + if (pa < trunc_2mpage(kernphys + btext - KERNSTART) || + pa >= trunc_2mpage(kernphys + _end - KERNSTART)) return (X86_PG_RW | pg_nx); /* @@ -1612,7 +1612,7 @@ bootaddr_rwx(vm_paddr_t pa) * impact read-only data. However, in any case, any page with * read-write data needs to be read-write. */ - if (pa >= trunc_2mpage(brwsection - KERNBASE)) + if (pa >= trunc_2mpage(kernphys + brwsection - KERNSTART)) return (X86_PG_RW | pg_nx); /* @@ -1624,7 +1624,7 @@ bootaddr_rwx(vm_paddr_t pa) * Note that fixups to the .text section will still work until we * set CR0.WP. */ - if (pa < round_2mpage(etext - KERNBASE)) + if (pa < round_2mpage(kernphys + etext - KERNSTART)) return (0); return (pg_nx); } @@ -1636,6 +1636,7 @@ create_pagetables(vm_paddr_t *firstaddr) pdp_entry_t *pdp_p; pml4_entry_t *p4_p; uint64_t DMPDkernphys; + vm_paddr_t pax; #ifdef KASAN pt_entry_t *pt_p; uint64_t KASANPDphys, KASANPTphys, KASANphys; @@ -1670,9 +1671,11 @@ create_pagetables(vm_paddr_t *firstaddr) /* * Allocate 2M pages for the kernel. These will be used in - * place of the first one or more 1G pages from ndm1g. + * place of the one or more 1G pages from ndm1g that maps + * kernel memory into DMAP. */ - nkdmpde = howmany((vm_offset_t)(brwsection - KERNBASE), NBPDP); + nkdmpde = howmany((vm_offset_t)brwsection - KERNSTART + + kernphys - rounddown2(kernphys, NBPDP), NBPDP); DMPDkernphys = allocpages(firstaddr, nkdmpde); } if (ndm1g < ndmpdp) @@ -1719,14 +1722,18 @@ create_pagetables(vm_paddr_t *firstaddr) pd_p[i] = (KPTphys + ptoa(i)) | X86_PG_RW | X86_PG_V; /* - * Map from physical address zero to the end of loader preallocated - * memory using 2MB pages. This replaces some of the PD entries - * created above. + * Map from start of the kernel in physical memory (staging + * area) to the end of loader preallocated memory using 2MB + * pages. This replaces some of the PD entries created above. + * For compatibility, identity map 2M at the start. */ - for (i = 0; (i << PDRSHIFT) < KERNend; i++) + pd_p[0] = X86_PG_V | PG_PS | pg_g | X86_PG_M | X86_PG_A | + X86_PG_RW | pg_nx; + for (i = 1, pax = kernphys; pax < KERNend; i++, pax += NBPDR) { /* Preset PG_M and PG_A because demotion expects it. */ - pd_p[i] = (i << PDRSHIFT) | X86_PG_V | PG_PS | pg_g | - X86_PG_M | X86_PG_A | bootaddr_rwx(i << PDRSHIFT); + pd_p[i] = pax | X86_PG_V | PG_PS | pg_g | X86_PG_M | + X86_PG_A | bootaddr_rwx(pax); + } /* * Because we map the physical blocks in 2M pages, adjust firstaddr @@ -1792,15 +1799,18 @@ create_pagetables(vm_paddr_t *firstaddr) * use 2M pages with read-only and no-execute permissions. (If using 1G * pages, this will partially overwrite the PDPEs above.) */ - if (ndm1g) { + if (ndm1g > 0) { pd_p = (pd_entry_t *)DMPDkernphys; - for (i = 0; i < (NPDEPG * nkdmpde); i++) - pd_p[i] = (i << PDRSHIFT) | X86_PG_V | PG_PS | pg_g | - X86_PG_M | X86_PG_A | pg_nx | - bootaddr_rwx(i << PDRSHIFT); - for (i = 0; i < nkdmpde; i++) - pdp_p[i] = (DMPDkernphys + ptoa(i)) | X86_PG_RW | - X86_PG_V | pg_nx; + for (i = 0, pax = rounddown2(kernphys, NBPDP); + i < NPDEPG * nkdmpde; i++, pax += NBPDR) { + pd_p[i] = pax | X86_PG_V | PG_PS | pg_g | X86_PG_M | + X86_PG_A | pg_nx | bootaddr_rwx(pax); + } + j = rounddown2(kernphys, NBPDP) >> PDPSHIFT; + for (i = 0; i < nkdmpde; i++) { + pdp_p[i + j] = (DMPDkernphys + ptoa(i)) | + X86_PG_RW | X86_PG_V | pg_nx; + } } /* And recursively map PML4 to itself in order to get PTmap */ @@ -1876,7 +1886,8 @@ pmap_bootstrap(vm_paddr_t *firstaddr) /* * Account for the virtual addresses mapped by create_pagetables(). */ - virtual_avail = (vm_offset_t)KERNBASE + round_2mpage(KERNend); + virtual_avail = (vm_offset_t)KERNSTART + round_2mpage(KERNend - + (vm_paddr_t)kernphys); virtual_end = VM_MAX_KERNEL_ADDRESS; /* @@ -2414,7 +2425,8 @@ pmap_init(void) * Collect the page table pages that were replaced by a 2MB * page in create_pagetables(). They are zero filled. */ - if ((vm_paddr_t)i << PDRSHIFT < KERNend && + if ((i == 0 || + kernphys + ((vm_paddr_t)(i - 1) << PDRSHIFT) < KERNend) && pmap_insert_pt_page(kernel_pmap, mpte, false)) panic("pmap_init: pmap_insert_pt_page failed"); } @@ -6681,7 +6693,9 @@ setpte: mpte < &vm_page_array[vm_page_array_size], ("pmap_promote_pde: page table page is out of range")); KASSERT(mpte->pindex == pmap_pde_pindex(va), - ("pmap_promote_pde: page table page's pindex is wrong")); + ("pmap_promote_pde: page table page's pindex is wrong " + "mpte %p pidx %#lx va %#lx va pde pidx %#lx", + mpte, mpte->pindex, va, pmap_pde_pindex(va))); if (pmap_insert_pt_page(pmap, mpte, true)) { counter_u64_add(pmap_pde_p_failures, 1); CTR2(KTR_PMAP, @@ -10751,8 +10765,8 @@ 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)KERNBASE + NBPDR, - (vm_offset_t)etext, true); + pmap_pti_add_kva_locked((vm_offset_t)KERNSTART, (vm_offset_t)etext, + true); pti_finalized = true; VM_OBJECT_WUNLOCK(pti_obj); } diff --git a/sys/amd64/include/md_var.h b/sys/amd64/include/md_var.h index b66e314d99b1..53139711bbff 100644 --- a/sys/amd64/include/md_var.h +++ b/sys/amd64/include/md_var.h @@ -49,11 +49,8 @@ extern vm_paddr_t intel_graphics_stolen_size; extern int la57; -/* - * The file "conf/ldscript.amd64" defines the symbol "kernphys". Its - * value is the physical address at which the kernel is loaded. - */ -extern char kernphys[]; +extern vm_paddr_t kernphys; +extern vm_paddr_t KERNend; extern bool efi_boot; diff --git a/sys/amd64/include/vmparam.h b/sys/amd64/include/vmparam.h index 6dd76063bf3f..88fd29b80be3 100644 --- a/sys/amd64/include/vmparam.h +++ b/sys/amd64/include/vmparam.h @@ -151,8 +151,10 @@ #endif /* - * Kernel physical load address. Needs to be aligned at 2MB superpage - * boundary. + * Kernel physical load address for non-UEFI boot and for legacy UEFI loader. + * Newer UEFI loader loads kernel anywhere below 4G, with memory allocated + * by boot services. + * Needs to be aligned at 2MB superpage boundary. */ #ifndef KERNLOAD #define KERNLOAD 0x200000 @@ -192,7 +194,17 @@ #define LARGEMAP_MIN_ADDRESS KV4ADDR(LMSPML4I, 0, 0, 0) #define LARGEMAP_MAX_ADDRESS KV4ADDR(LMEPML4I + 1, 0, 0, 0) +/* + * Formally kernel mapping starts at KERNBASE, but kernel linker + * script leaves first PDE reserved. For legacy BIOS boot, kernel is + * loaded at KERNLOAD = 2M, and initial kernel page table maps + * physical memory from zero to KERNend starting at KERNBASE. + * + * KERNSTART is where the first actual kernel page is mapped, after + * the compatibility mapping. + */ #define KERNBASE KV4ADDR(KPML4I, KPDPI, 0, 0) +#define KERNSTART (KERNBASE + NBPDR) #define UPT_MAX_ADDRESS KV4ADDR(PML4PML4I, PML4PML4I, PML4PML4I, PML4PML4I) #define UPT_MIN_ADDRESS KV4ADDR(PML4PML4I, 0, 0, 0) diff --git a/sys/conf/ldscript.amd64 b/sys/conf/ldscript.amd64 index c11ffb6ea49f..68085ff7435c 100644 --- a/sys/conf/ldscript.amd64 +++ b/sys/conf/ldscript.amd64 @@ -5,15 +5,14 @@ ENTRY(btext) SEARCH_DIR("/usr/lib"); SECTIONS { - kernphys = kernload; /* Read-only sections, merged into text segment: */ - . = kernbase + kernphys + SIZEOF_HEADERS; + . = kernbase + kernload + SIZEOF_HEADERS; /* * Use the AT keyword in order to set the right LMA that contains * the physical address where the section should be loaded. This is * needed for the Xen loader which honours the LMA. */ - .interp : AT (kernphys + SIZEOF_HEADERS) { *(.interp) } + .interp : AT (kernload + SIZEOF_HEADERS) { *(.interp) } .hash : { *(.hash) } .gnu.hash : { *(.gnu.hash) } .dynsym : { *(.dynsym) } From owner-dev-commits-src-all@freebsd.org Sat Jul 31 13:54: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 3A47265E515; Sat, 31 Jul 2021 13:54: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 4GcQjd6qQWz4YG3; Sat, 31 Jul 2021 13:54: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 D1A041A113; Sat, 31 Jul 2021 13:54: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 16VDsDfK033409; Sat, 31 Jul 2021 13:54:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16VDsDNn033408; Sat, 31 Jul 2021 13:54:13 GMT (envelope-from git) Date: Sat, 31 Jul 2021 13:54:13 GMT Message-Id: <202107311354.16VDsDNn033408@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: 041b7317f75e - main - Add pmap_vm_page_alloc_check() 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: 041b7317f75ecc5e1629e2dd6786c8bdbe1b19eb 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, 31 Jul 2021 13:54:14 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=041b7317f75ecc5e1629e2dd6786c8bdbe1b19eb commit 041b7317f75ecc5e1629e2dd6786c8bdbe1b19eb Author: Konstantin Belousov AuthorDate: 2021-07-10 19:53:41 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-31 13:53:42 +0000 Add pmap_vm_page_alloc_check() which is the place to put MD asserts about allocated pages. On amd64, verify that allocated page does not belong to the kernel (text, data) or early allocated pages. Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31121 --- sys/amd64/include/pmap.h | 4 ++++ sys/arm/include/pmap.h | 2 ++ sys/arm64/include/pmap.h | 2 ++ sys/i386/include/pmap.h | 2 ++ sys/mips/include/pmap.h | 2 ++ sys/powerpc/include/pmap.h | 2 ++ sys/riscv/include/pmap.h | 2 ++ sys/vm/vm_page.c | 1 + 8 files changed, 17 insertions(+) diff --git a/sys/amd64/include/pmap.h b/sys/amd64/include/pmap.h index e9117481a41e..401eae0044f9 100644 --- a/sys/amd64/include/pmap.h +++ b/sys/amd64/include/pmap.h @@ -456,6 +456,10 @@ extern int invpcid_works; #define pmap_page_is_write_mapped(m) (((m)->a.flags & PGA_WRITEABLE) != 0) #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", m)); + struct thread; void pmap_activate_boot(pmap_t pmap); diff --git a/sys/arm/include/pmap.h b/sys/arm/include/pmap.h index 2f407a9c8760..d06d44d648d5 100644 --- a/sys/arm/include/pmap.h +++ b/sys/arm/include/pmap.h @@ -73,5 +73,7 @@ pmap_vmspace_copy(pmap_t dst_pmap __unused, pmap_t src_pmap __unused) #define PMAP_ENTER_QUICK_LOCKED 0x10000000 +#define pmap_vm_page_alloc_check(m) + #endif /* _KERNEL */ #endif /* !_MACHINE_PMAP_H_ */ diff --git a/sys/arm64/include/pmap.h b/sys/arm64/include/pmap.h index 61fba1e3c1f8..3b71e79f45ad 100644 --- a/sys/arm64/include/pmap.h +++ b/sys/arm64/include/pmap.h @@ -162,6 +162,8 @@ extern vm_offset_t virtual_end; #define L1_MAPPABLE_P(va, pa, size) \ ((((va) | (pa)) & L1_OFFSET) == 0 && (size) >= L1_SIZE) +#define pmap_vm_page_alloc_check(m) + void pmap_activate_vm(pmap_t); void pmap_bootstrap(vm_offset_t, vm_offset_t, vm_paddr_t, vm_size_t); int pmap_change_attr(vm_offset_t va, vm_size_t size, int mode); diff --git a/sys/i386/include/pmap.h b/sys/i386/include/pmap.h index f2e65c829ff4..5ac99b92cad3 100644 --- a/sys/i386/include/pmap.h +++ b/sys/i386/include/pmap.h @@ -238,6 +238,8 @@ pmap_vmspace_copy(pmap_t dst_pmap __unused, pmap_t src_pmap __unused) struct sf_buf; +#define pmap_vm_page_alloc_check(m) + /* * Only the following functions or macros may be used before pmap_bootstrap() * is called: pmap_kenter(), pmap_kextract(), pmap_kremove(), vtophys(), and diff --git a/sys/mips/include/pmap.h b/sys/mips/include/pmap.h index 6678f8264ad7..fb186011bd85 100644 --- a/sys/mips/include/pmap.h +++ b/sys/mips/include/pmap.h @@ -166,6 +166,8 @@ extern vm_offset_t virtual_end; #define pmap_page_is_mapped(m) (!TAILQ_EMPTY(&(m)->md.pv_list)) #define pmap_page_is_write_mapped(m) (((m)->a.flags & PGA_WRITEABLE) != 0) +#define pmap_vm_page_alloc_check(m) + void pmap_bootstrap(void); void *pmap_mapdev(vm_paddr_t, vm_size_t); void *pmap_mapdev_attr(vm_paddr_t, vm_size_t, vm_memattr_t); diff --git a/sys/powerpc/include/pmap.h b/sys/powerpc/include/pmap.h index a292be660b09..2f1886a27093 100644 --- a/sys/powerpc/include/pmap.h +++ b/sys/powerpc/include/pmap.h @@ -301,6 +301,8 @@ extern struct pmap kernel_pmap_store; #define pmap_page_is_write_mapped(m) (((m)->a.flags & PGA_WRITEABLE) != 0) +#define pmap_vm_page_alloc_check(m) + void pmap_bootstrap(vm_offset_t, vm_offset_t); void pmap_kenter(vm_offset_t va, vm_paddr_t pa); void pmap_kenter_attr(vm_offset_t va, vm_paddr_t pa, vm_memattr_t); diff --git a/sys/riscv/include/pmap.h b/sys/riscv/include/pmap.h index 64b529e95887..599adfa4ce19 100644 --- a/sys/riscv/include/pmap.h +++ b/sys/riscv/include/pmap.h @@ -139,6 +139,8 @@ extern vm_offset_t virtual_end; struct thread; +#define pmap_vm_page_alloc_check(m) + void pmap_activate_boot(pmap_t); void pmap_activate_sw(struct thread *); void pmap_bootstrap(vm_offset_t, vm_paddr_t, vm_size_t); diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index 953120e25b4e..d435b871b7cb 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -2416,6 +2416,7 @@ vm_page_alloc_check(vm_page_t m) ("page %p has unexpected memattr %d", m, pmap_page_get_memattr(m))); KASSERT(m->valid == 0, ("free page %p is valid", m)); + pmap_vm_page_alloc_check(m); } /* From owner-dev-commits-src-all@freebsd.org Sat Jul 31 14: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 123EF65E91F for ; Sat, 31 Jul 2021 14:08:00 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk1-x735.google.com (mail-qk1-x735.google.com [IPv6:2607:f8b0:4864:20::735]) (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 4GcR1W6W1Cz4YdG for ; Sat, 31 Jul 2021 14:07:59 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x735.google.com with SMTP id b20so12320175qkj.3 for ; Sat, 31 Jul 2021 07:07:59 -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=WChS9ED6kXrkCAMIJGH1fgBBPx5XGUxS+t+cL48J2p0=; b=DZD1rrtv2W34F8p0Wmj2tv5YGNMGsnaUnaVZioxZZ34r46rby62rAQi3fhZ8tLWo+B ZDKLm1qPxM7q9LiP+yTInjBJjVBRDVhvBjuJ/6kjME1aPD9UnZFDF+zGLAXvP+rS5/dL O/oV7+f8ANq5wjDfw3SlEsZ72KUmxlggPeu6BnXjCpgM3Q8DB0s4JAqN0AuLv9HxXfwm M1d17NLiul7k1buANmrvh56PKEU9+DLqxJw/7mnBpqNhPeH0xw+984G1Rehi4fQo/GOr BjEI1OOF1p+SXG/nDGzdPyZ/Jq3BbIFoNes9/tKT0mpUKG49T1A/qTjwp21bCDB9W5sP oOQw== 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=WChS9ED6kXrkCAMIJGH1fgBBPx5XGUxS+t+cL48J2p0=; b=rGPg/KGWfCaYtf00OL+fGYUd3W6AQFKrSK66Lh1W814CD0LLUR/NnRHTcsPRipuY49 qbuXlgQBkzUk9QUlb1FJ0NyKbR9Q6o3hZZR9vEap5H4kEb2b/+prsbklO4ONUxtnC4yW 38/QTkex2jrTK6LOr5HIpKg8EuSdc33FkTmJAUxxo/nhcsCvgZ01z0jmBH6IX1ncdVxa B3pClqcEtNVbOqAlGcE5I7KPJCHUT3im2nhnroboC0VDTW2Dz4F1wuRDDs6W8TnWG79E 6BxUvv4o90/LHkft6p7pcDDxycB33eW1QD9izyo25D61T+A6PFKDwsi6iGXVcboLR7E5 Eozg== X-Gm-Message-State: AOAM5306NGyAvw1C6k0GulIXly5QeoW4cXHY0fktui079ftHrNoDxUhq w2KKi9MhJ2JzZGX8Huj5r+GFHFyW0I5y3O+LkkVgtw== X-Google-Smtp-Source: ABdhPJwsPLqp5FLdWccCIayLPUi+O5jvZzjsowpftPugCrRdOt58B7ykeqhSD/1tQxRVG9f/vZuh7Vs18UtUT2EW4GU= X-Received: by 2002:a05:620a:45:: with SMTP id t5mr6862413qkt.206.1627740472992; Sat, 31 Jul 2021 07:07:52 -0700 (PDT) MIME-Version: 1.0 References: <202107101712.16AHCwoE088447@gitrepo.freebsd.org> <4AD3AB8C-A960-43BE-A89B-5D9C4CD077DD@FreeBSD.org> In-Reply-To: <4AD3AB8C-A960-43BE-A89B-5D9C4CD077DD@FreeBSD.org> From: Warner Losh Date: Sat, 31 Jul 2021 08:07:42 -0600 Message-ID: Subject: Re: git: 6edf5082bab7 - stable/12 - one-true-awk: import 20210221 (1e4bc42c53a1) which fixes a number of bugs To: Kristof Provost Cc: Warner Losh , src-committers , "" , dev-commits-src-branches@freebsd.org X-Rspamd-Queue-Id: 4GcR1W6W1Cz4YdG 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" 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: Sat, 31 Jul 2021 14:08:00 -0000 On Sat, Jul 31, 2021 at 3:11 AM Kristof Provost wrote: > Hi Warner, > > On 10 Jul 2021, at 19:12, Warner Losh wrote: > > The branch stable/12 has been updated by imp: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=3D6edf5082bab71cf923efff9f18e38ef= e5b83b0ec > > commit 6edf5082bab71cf923efff9f18e38efe5b83b0ec > Author: Warner Losh > AuthorDate: 2021-07-07 23:30:35 +0000 > Commit: Warner Losh > CommitDate: 2021-07-10 17:11:15 +0000 > > one-true-awk: import 20210221 (1e4bc42c53a1) which fixes a number of bugs > > Import the latest bsd-features branch of the one-true-awk upstream: > > o Move to bison for $YACC > o Set close-on-exec flag for file and pipe redirects that aren't std* > o lots of little fixes to modernize ocde base > o free sval member before setting it > o fix a bug where a{0,3} could match aaaa > o pull in systime and strftime from NetBSD awk > o pull in fixes from {Net,Free,Open}BSD (normalized our code with them) > o add BSD extensions and, or, xor, compl, lsheift, rshift (mostly a nop) > > Also revert a few of the trivial FreeBSD changes that were done slightly > differently in the upstreaming process. Also, our PR database may have > been mined by upstream for these fixes, and Mikolaj Golub may deserve > credit for some of the fixes in this update. > > Suggested by: Mikolaj Golub > PR: 143363,143365,143368,143369,143373,143375,214782 > Sponsored by: Netflix > > (cherry picked from commit f39dd6a9784467f0db5886012b3f4b13899be6b8) > > I *think* this is the relevant commit, but I=E2=80=99m not 100% sure. > > Anyway, I=E2=80=99ve recently started seeing issues building pfSense for = aarch64. > I=E2=80=99ve finally narrowed it down, and replicated the problem on base= FreeBSD > (stable/12, but I assume other branches are affected too). > > It fails to build proctab.c. This file is generated by maketab, a tool > built as part of the build process. In my case this tool is built for > aarch64, which makes executing it on amd64 less successful than we=E2=80= =99d like. > > This only happens when building with META_MODE though. I do not understan= d > the build system sufficiently to debug why. Hopefully you=E2=80=99ll have= a better > idea. > Generally I do, but this one is a bit weird. Also, the amount of context you've included omits the actual error :( Though I'm guessing it's wrong arch for the build tool... I rarely use meta mode, and understand it not at all, but awk follows the same patterns as /bin/sh and /bin/csh does. Warner This triggers the build failure: > > % cat /usr/src/src_env.conf > WITH_META_MODE=3Dyes > % env SRC_ENV_CONF=3D/usr/src/src_env.conf TARGET_ARCH=3Daarch64 make -j = 8 buildworld > > =E2=80=A6 > --- proctab.c --- > *** [proctab.c] Error code 255 > > make[4]: stopped in /usr/src/usr.bin/awk > .ERROR_TARGET=3D'proctab.c' > .ERROR_META_FILE=3D'/usr/obj/usr/src/arm64.aarch64/usr.bin/awk/proctab.c.= meta' > .MAKE.LEVEL=3D'4' > MAKEFILE=3D'' > .MAKE.MODE=3D'meta missing-filemon=3Dyes missing-meta=3Dyes silent=3Dyes = verbose' > _ERROR_CMD=3D'./maketab awkgram.h > proctab.c;' > .CURDIR=3D'/usr/src/usr.bin/awk' > .MAKE=3D'make' > .OBJDIR=3D'/usr/obj/usr/src/arm64.aarch64/usr.bin/awk' > .TARGETS=3D'all' > DESTDIR=3D'/usr/obj/usr/src/arm64.aarch64/tmp' > LD_LIBRARY_PATH=3D'' > MACHINE=3D'arm64' > MACHINE_ARCH=3D'aarch64' > MAKEOBJDIRPREFIX=3D'' > MAKESYSPATH=3D'/usr/src/share/mk' > MAKE_VERSION=3D'20200710' > > Further up in the build output: > > --- maketab --- > cc -target aarch64-unknown-freebsd12.2 --sysroot=3D/usr/obj/usr/src/arm64= .aarch64/tmp -B/usr/obj/usr/src/arm64.aarch64/tmp/usr/bin -O2 -pipe -fno-co= mmon -DHAS_ISBLANK -I. -I/usr/src/contrib/one-true-awk -DFOPEN_MAX=3D64 -= g -std=3Dgnu99 -Wno-format-zero-length -fstack-protector-strong -Wsystem-he= aders -Werror -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int -Wno-u= nused-const-variable -Wno-tautological-compare -Wno-unused-value -Wno-paren= theses-equality -Wno-unused-function -Wno-enum-conversion -Wno-unused-local= -typedef -Wno-address-of-packed-member -Wno-switch -Wno-switch-enum -Wno-kn= r-promoted-parameter -Wno-parentheses -Qunused-arguments /usr/src/contr= ib/one-true-awk/maketab.c -o maketab > > Without META_MODE maketab is built as an amd64 binary, and the entire > build succeeds. > > Best regards, > Kristof > From owner-dev-commits-src-all@freebsd.org Sat Jul 31 14:15: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 9CF9565EC52; Sat, 31 Jul 2021 14:15: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 4GcR9g3nzjz4bhT; Sat, 31 Jul 2021 14:15: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 6A60E1A166; Sat, 31 Jul 2021 14:15: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 16VEF32E060444; Sat, 31 Jul 2021 14:15:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16VEF3T4060443; Sat, 31 Jul 2021 14:15:03 GMT (envelope-from git) Date: Sat, 31 Jul 2021 14:15:03 GMT Message-Id: <202107311415.16VEF3T4060443@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: 32d55be1c1c9 - stable/12 - awk: remove proctab.c 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/12 X-Git-Reftype: branch X-Git-Commit: 32d55be1c1c9ed1bccfce1196e8fbfbbf814f1db 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, 31 Jul 2021 14:15:03 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=32d55be1c1c9ed1bccfce1196e8fbfbbf814f1db commit 32d55be1c1c9ed1bccfce1196e8fbfbbf814f1db Author: Warner Losh AuthorDate: 2021-07-12 03:26:08 +0000 Commit: Warner Losh CommitDate: 2021-07-31 14:14:08 +0000 awk: remove proctab.c proctab.c is a generated file and never should have been committed to the tree. This file has been added and removed a couple of times, most recently added by me in my 2019 updates. Sponsored by: Netflix (cherry picked from commit 0c92d88c9180bf25187f01f1d7e419edea9a0fef) --- contrib/one-true-awk/proctab.c | 213 ----------------------------------------- 1 file changed, 213 deletions(-) diff --git a/contrib/one-true-awk/proctab.c b/contrib/one-true-awk/proctab.c deleted file mode 100644 index 96fad36e601c..000000000000 --- a/contrib/one-true-awk/proctab.c +++ /dev/null @@ -1,213 +0,0 @@ -#include -#include "awk.h" -#include "awkgram.tab.h" - -static const char * const printname[96] = { - "FIRSTTOKEN", /* 258 */ - "PROGRAM", /* 259 */ - "PASTAT", /* 260 */ - "PASTAT2", /* 261 */ - "XBEGIN", /* 262 */ - "XEND", /* 263 */ - "NL", /* 264 */ - "ARRAY", /* 265 */ - "MATCH", /* 266 */ - "NOTMATCH", /* 267 */ - "MATCHOP", /* 268 */ - "FINAL", /* 269 */ - "DOT", /* 270 */ - "ALL", /* 271 */ - "CCL", /* 272 */ - "NCCL", /* 273 */ - "CHAR", /* 274 */ - "OR", /* 275 */ - "STAR", /* 276 */ - "QUEST", /* 277 */ - "PLUS", /* 278 */ - "EMPTYRE", /* 279 */ - "ZERO", /* 280 */ - "AND", /* 281 */ - "BOR", /* 282 */ - "APPEND", /* 283 */ - "EQ", /* 284 */ - "GE", /* 285 */ - "GT", /* 286 */ - "LE", /* 287 */ - "LT", /* 288 */ - "NE", /* 289 */ - "IN", /* 290 */ - "ARG", /* 291 */ - "BLTIN", /* 292 */ - "BREAK", /* 293 */ - "CLOSE", /* 294 */ - "CONTINUE", /* 295 */ - "DELETE", /* 296 */ - "DO", /* 297 */ - "EXIT", /* 298 */ - "FOR", /* 299 */ - "FUNC", /* 300 */ - "GENSUB", /* 301 */ - "SUB", /* 302 */ - "GSUB", /* 303 */ - "IF", /* 304 */ - "INDEX", /* 305 */ - "LSUBSTR", /* 306 */ - "MATCHFCN", /* 307 */ - "NEXT", /* 308 */ - "NEXTFILE", /* 309 */ - "ADD", /* 310 */ - "MINUS", /* 311 */ - "MULT", /* 312 */ - "DIVIDE", /* 313 */ - "MOD", /* 314 */ - "ASSIGN", /* 315 */ - "ASGNOP", /* 316 */ - "ADDEQ", /* 317 */ - "SUBEQ", /* 318 */ - "MULTEQ", /* 319 */ - "DIVEQ", /* 320 */ - "MODEQ", /* 321 */ - "POWEQ", /* 322 */ - "PRINT", /* 323 */ - "PRINTF", /* 324 */ - "SPRINTF", /* 325 */ - "ELSE", /* 326 */ - "INTEST", /* 327 */ - "CONDEXPR", /* 328 */ - "POSTINCR", /* 329 */ - "PREINCR", /* 330 */ - "POSTDECR", /* 331 */ - "PREDECR", /* 332 */ - "VAR", /* 333 */ - "IVAR", /* 334 */ - "VARNF", /* 335 */ - "CALL", /* 336 */ - "NUMBER", /* 337 */ - "STRING", /* 338 */ - "REGEXPR", /* 339 */ - "GETLINE", /* 340 */ - "RETURN", /* 341 */ - "SPLIT", /* 342 */ - "SUBSTR", /* 343 */ - "WHILE", /* 344 */ - "CAT", /* 345 */ - "NOT", /* 346 */ - "UMINUS", /* 347 */ - "UPLUS", /* 348 */ - "POWER", /* 349 */ - "DECR", /* 350 */ - "INCR", /* 351 */ - "INDIRECT", /* 352 */ - "LASTTOKEN", /* 353 */ -}; - - -Cell *(*proctab[96])(Node **, int) = { - nullproc, /* FIRSTTOKEN */ - program, /* PROGRAM */ - pastat, /* PASTAT */ - dopa2, /* PASTAT2 */ - nullproc, /* XBEGIN */ - nullproc, /* XEND */ - nullproc, /* NL */ - array, /* ARRAY */ - matchop, /* MATCH */ - matchop, /* NOTMATCH */ - nullproc, /* MATCHOP */ - nullproc, /* FINAL */ - nullproc, /* DOT */ - nullproc, /* ALL */ - nullproc, /* CCL */ - nullproc, /* NCCL */ - nullproc, /* CHAR */ - nullproc, /* OR */ - nullproc, /* STAR */ - nullproc, /* QUEST */ - nullproc, /* PLUS */ - nullproc, /* EMPTYRE */ - nullproc, /* ZERO */ - boolop, /* AND */ - boolop, /* BOR */ - nullproc, /* APPEND */ - relop, /* EQ */ - relop, /* GE */ - relop, /* GT */ - relop, /* LE */ - relop, /* LT */ - relop, /* NE */ - instat, /* IN */ - arg, /* ARG */ - bltin, /* BLTIN */ - jump, /* BREAK */ - closefile, /* CLOSE */ - jump, /* CONTINUE */ - awkdelete, /* DELETE */ - dostat, /* DO */ - jump, /* EXIT */ - forstat, /* FOR */ - nullproc, /* FUNC */ - gensub, /* GENSUB */ - sub, /* SUB */ - gsub, /* GSUB */ - ifstat, /* IF */ - sindex, /* INDEX */ - nullproc, /* LSUBSTR */ - matchop, /* MATCHFCN */ - jump, /* NEXT */ - jump, /* NEXTFILE */ - arith, /* ADD */ - arith, /* MINUS */ - arith, /* MULT */ - arith, /* DIVIDE */ - arith, /* MOD */ - assign, /* ASSIGN */ - nullproc, /* ASGNOP */ - assign, /* ADDEQ */ - assign, /* SUBEQ */ - assign, /* MULTEQ */ - assign, /* DIVEQ */ - assign, /* MODEQ */ - assign, /* POWEQ */ - printstat, /* PRINT */ - awkprintf, /* PRINTF */ - awksprintf, /* SPRINTF */ - nullproc, /* ELSE */ - intest, /* INTEST */ - condexpr, /* CONDEXPR */ - incrdecr, /* POSTINCR */ - incrdecr, /* PREINCR */ - incrdecr, /* POSTDECR */ - incrdecr, /* PREDECR */ - nullproc, /* VAR */ - nullproc, /* IVAR */ - getnf, /* VARNF */ - call, /* CALL */ - nullproc, /* NUMBER */ - nullproc, /* STRING */ - nullproc, /* REGEXPR */ - awkgetline, /* GETLINE */ - jump, /* RETURN */ - split, /* SPLIT */ - substr, /* SUBSTR */ - whilestat, /* WHILE */ - cat, /* CAT */ - boolop, /* NOT */ - arith, /* UMINUS */ - arith, /* UPLUS */ - arith, /* POWER */ - nullproc, /* DECR */ - nullproc, /* INCR */ - indirect, /* INDIRECT */ - nullproc, /* LASTTOKEN */ -}; - -const char *tokname(int n) -{ - static char buf[100]; - - if (n < FIRSTTOKEN || n > LASTTOKEN) { - snprintf(buf, sizeof(buf), "token %d", n); - return buf; - } - return printname[n-FIRSTTOKEN]; -} From owner-dev-commits-src-all@freebsd.org Sat Jul 31 14:15: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 08F9965EE0A; Sat, 31 Jul 2021 14:15: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 4GcRBF6rwZz4bsn; Sat, 31 Jul 2021 14:15: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 D3A631A581; Sat, 31 Jul 2021 14:15: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 16VEFXvU060589; Sat, 31 Jul 2021 14:15:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16VEFX8Z060588; Sat, 31 Jul 2021 14:15:33 GMT (envelope-from git) Date: Sat, 31 Jul 2021 14:15:33 GMT Message-Id: <202107311415.16VEFX8Z060588@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: 83dea422ac8d - stable/13 - awk: remove proctab.c 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: 83dea422ac8d4a8323e64203c2eadaa813768717 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, 31 Jul 2021 14:15:34 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=83dea422ac8d4a8323e64203c2eadaa813768717 commit 83dea422ac8d4a8323e64203c2eadaa813768717 Author: Warner Losh AuthorDate: 2021-07-12 03:26:08 +0000 Commit: Warner Losh CommitDate: 2021-07-31 14:14:43 +0000 awk: remove proctab.c proctab.c is a generated file and never should have been committed to the tree. This file has been added and removed a couple of times, most recently added by me in my 2019 updates. Sponsored by: Netflix (cherry picked from commit 0c92d88c9180bf25187f01f1d7e419edea9a0fef) --- contrib/one-true-awk/proctab.c | 213 ----------------------------------------- 1 file changed, 213 deletions(-) diff --git a/contrib/one-true-awk/proctab.c b/contrib/one-true-awk/proctab.c deleted file mode 100644 index 96fad36e601c..000000000000 --- a/contrib/one-true-awk/proctab.c +++ /dev/null @@ -1,213 +0,0 @@ -#include -#include "awk.h" -#include "awkgram.tab.h" - -static const char * const printname[96] = { - "FIRSTTOKEN", /* 258 */ - "PROGRAM", /* 259 */ - "PASTAT", /* 260 */ - "PASTAT2", /* 261 */ - "XBEGIN", /* 262 */ - "XEND", /* 263 */ - "NL", /* 264 */ - "ARRAY", /* 265 */ - "MATCH", /* 266 */ - "NOTMATCH", /* 267 */ - "MATCHOP", /* 268 */ - "FINAL", /* 269 */ - "DOT", /* 270 */ - "ALL", /* 271 */ - "CCL", /* 272 */ - "NCCL", /* 273 */ - "CHAR", /* 274 */ - "OR", /* 275 */ - "STAR", /* 276 */ - "QUEST", /* 277 */ - "PLUS", /* 278 */ - "EMPTYRE", /* 279 */ - "ZERO", /* 280 */ - "AND", /* 281 */ - "BOR", /* 282 */ - "APPEND", /* 283 */ - "EQ", /* 284 */ - "GE", /* 285 */ - "GT", /* 286 */ - "LE", /* 287 */ - "LT", /* 288 */ - "NE", /* 289 */ - "IN", /* 290 */ - "ARG", /* 291 */ - "BLTIN", /* 292 */ - "BREAK", /* 293 */ - "CLOSE", /* 294 */ - "CONTINUE", /* 295 */ - "DELETE", /* 296 */ - "DO", /* 297 */ - "EXIT", /* 298 */ - "FOR", /* 299 */ - "FUNC", /* 300 */ - "GENSUB", /* 301 */ - "SUB", /* 302 */ - "GSUB", /* 303 */ - "IF", /* 304 */ - "INDEX", /* 305 */ - "LSUBSTR", /* 306 */ - "MATCHFCN", /* 307 */ - "NEXT", /* 308 */ - "NEXTFILE", /* 309 */ - "ADD", /* 310 */ - "MINUS", /* 311 */ - "MULT", /* 312 */ - "DIVIDE", /* 313 */ - "MOD", /* 314 */ - "ASSIGN", /* 315 */ - "ASGNOP", /* 316 */ - "ADDEQ", /* 317 */ - "SUBEQ", /* 318 */ - "MULTEQ", /* 319 */ - "DIVEQ", /* 320 */ - "MODEQ", /* 321 */ - "POWEQ", /* 322 */ - "PRINT", /* 323 */ - "PRINTF", /* 324 */ - "SPRINTF", /* 325 */ - "ELSE", /* 326 */ - "INTEST", /* 327 */ - "CONDEXPR", /* 328 */ - "POSTINCR", /* 329 */ - "PREINCR", /* 330 */ - "POSTDECR", /* 331 */ - "PREDECR", /* 332 */ - "VAR", /* 333 */ - "IVAR", /* 334 */ - "VARNF", /* 335 */ - "CALL", /* 336 */ - "NUMBER", /* 337 */ - "STRING", /* 338 */ - "REGEXPR", /* 339 */ - "GETLINE", /* 340 */ - "RETURN", /* 341 */ - "SPLIT", /* 342 */ - "SUBSTR", /* 343 */ - "WHILE", /* 344 */ - "CAT", /* 345 */ - "NOT", /* 346 */ - "UMINUS", /* 347 */ - "UPLUS", /* 348 */ - "POWER", /* 349 */ - "DECR", /* 350 */ - "INCR", /* 351 */ - "INDIRECT", /* 352 */ - "LASTTOKEN", /* 353 */ -}; - - -Cell *(*proctab[96])(Node **, int) = { - nullproc, /* FIRSTTOKEN */ - program, /* PROGRAM */ - pastat, /* PASTAT */ - dopa2, /* PASTAT2 */ - nullproc, /* XBEGIN */ - nullproc, /* XEND */ - nullproc, /* NL */ - array, /* ARRAY */ - matchop, /* MATCH */ - matchop, /* NOTMATCH */ - nullproc, /* MATCHOP */ - nullproc, /* FINAL */ - nullproc, /* DOT */ - nullproc, /* ALL */ - nullproc, /* CCL */ - nullproc, /* NCCL */ - nullproc, /* CHAR */ - nullproc, /* OR */ - nullproc, /* STAR */ - nullproc, /* QUEST */ - nullproc, /* PLUS */ - nullproc, /* EMPTYRE */ - nullproc, /* ZERO */ - boolop, /* AND */ - boolop, /* BOR */ - nullproc, /* APPEND */ - relop, /* EQ */ - relop, /* GE */ - relop, /* GT */ - relop, /* LE */ - relop, /* LT */ - relop, /* NE */ - instat, /* IN */ - arg, /* ARG */ - bltin, /* BLTIN */ - jump, /* BREAK */ - closefile, /* CLOSE */ - jump, /* CONTINUE */ - awkdelete, /* DELETE */ - dostat, /* DO */ - jump, /* EXIT */ - forstat, /* FOR */ - nullproc, /* FUNC */ - gensub, /* GENSUB */ - sub, /* SUB */ - gsub, /* GSUB */ - ifstat, /* IF */ - sindex, /* INDEX */ - nullproc, /* LSUBSTR */ - matchop, /* MATCHFCN */ - jump, /* NEXT */ - jump, /* NEXTFILE */ - arith, /* ADD */ - arith, /* MINUS */ - arith, /* MULT */ - arith, /* DIVIDE */ - arith, /* MOD */ - assign, /* ASSIGN */ - nullproc, /* ASGNOP */ - assign, /* ADDEQ */ - assign, /* SUBEQ */ - assign, /* MULTEQ */ - assign, /* DIVEQ */ - assign, /* MODEQ */ - assign, /* POWEQ */ - printstat, /* PRINT */ - awkprintf, /* PRINTF */ - awksprintf, /* SPRINTF */ - nullproc, /* ELSE */ - intest, /* INTEST */ - condexpr, /* CONDEXPR */ - incrdecr, /* POSTINCR */ - incrdecr, /* PREINCR */ - incrdecr, /* POSTDECR */ - incrdecr, /* PREDECR */ - nullproc, /* VAR */ - nullproc, /* IVAR */ - getnf, /* VARNF */ - call, /* CALL */ - nullproc, /* NUMBER */ - nullproc, /* STRING */ - nullproc, /* REGEXPR */ - awkgetline, /* GETLINE */ - jump, /* RETURN */ - split, /* SPLIT */ - substr, /* SUBSTR */ - whilestat, /* WHILE */ - cat, /* CAT */ - boolop, /* NOT */ - arith, /* UMINUS */ - arith, /* UPLUS */ - arith, /* POWER */ - nullproc, /* DECR */ - nullproc, /* INCR */ - indirect, /* INDIRECT */ - nullproc, /* LASTTOKEN */ -}; - -const char *tokname(int n) -{ - static char buf[100]; - - if (n < FIRSTTOKEN || n > LASTTOKEN) { - snprintf(buf, sizeof(buf), "token %d", n); - return buf; - } - return printname[n-FIRSTTOKEN]; -} From owner-dev-commits-src-all@freebsd.org Sat Jul 31 14:20: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 28A4F65EDFE for ; Sat, 31 Jul 2021 14:20:50 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk1-x72c.google.com (mail-qk1-x72c.google.com [IPv6:2607:f8b0:4864:20::72c]) (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 4GcRJK3TzLz4c6l for ; Sat, 31 Jul 2021 14:20:49 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x72c.google.com with SMTP id az7so12340041qkb.5 for ; Sat, 31 Jul 2021 07:20:49 -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=uGCstSf2y6eKOGdrS6H9f/Q8TVOlsjqs1IjZT7v2xuw=; b=TVkxIKsDZi7NiL/7RQyoosEYd/XqFnjyA0POn3Ts5xwzoBA4AKYuHImjml3qxDoibU 1ppKP9UIOG+jNEH9kcYVSU6LojwIuIEGrSnN48fvF9vgLbl0JsfbaEkc+8HI60FYn9j+ jNMkirdS1G1RiwQGn95xM6sNDSZkb1M42i8plnqXzIaWxZIlJ231CkOE+Slm+LS3l7/n xaB3Aqji9iJcKoEjjNFLPnYKb/M+funplyM2tlbZCX7vJgy56wgxvDJ8ZryV3fumtMWu XW9nwD87yTRFIF5oVZ/I7/DBmq8ML5m3dutrqbzRoxLgqoVJykIQILikkD8CSg3K4fyh Cmqg== 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=uGCstSf2y6eKOGdrS6H9f/Q8TVOlsjqs1IjZT7v2xuw=; b=jK01wFgKSqQdhaHE1o6wAEuhL3EWDFdaapQBec3xdSIeXcPu+p18Sxh353ELT7+g0k f4zMnYLIrXblNRBq9rQ64TuHCoGZmH8Y2hMLtYeJuIZoa82L4KAXyAYJLsOtsPiIemnF CM7Lnf2Ui3Lz9xqmVzZqf5VnXpadOIx9UVq8P1fjgUEO2C9v8EVUrXrL1U3+vx6tFjkI SVWUJAsgn58pVHW/ZQ75BmtWECWVDoCRRuLumf5BqDP3nRJ20SEkW+NER3FV4BO2IE6z owJYzx4gT9/PNNc0a9Z3wYdK1NqFfTnFxAX0gMYhA3gF7qENv0fYNw4KJrNAvqxna6og fqzA== X-Gm-Message-State: AOAM531yX0LhzbC8TZEoybBUfNRXScU+BAHGksvBywKqm6QmNjbyV5qD GccjjqrkQErqxbZlIDCJ8tP7nisKLUlqKmPAoxndqg== X-Google-Smtp-Source: ABdhPJxGlDp12C8kJwMVi6AIn4b3NDGGn0vqb5OBt+/QxsQ2EA8caFLWlmznFvsgBvMRxNUS96vcaWyUxnIMZLrNZ6M= X-Received: by 2002:a37:e4f:: with SMTP id 76mr7063468qko.44.1627741249050; Sat, 31 Jul 2021 07:20:49 -0700 (PDT) MIME-Version: 1.0 References: <202107101712.16AHCwoE088447@gitrepo.freebsd.org> <4AD3AB8C-A960-43BE-A89B-5D9C4CD077DD@FreeBSD.org> In-Reply-To: From: Warner Losh Date: Sat, 31 Jul 2021 08:20:39 -0600 Message-ID: Subject: Re: git: 6edf5082bab7 - stable/12 - one-true-awk: import 20210221 (1e4bc42c53a1) which fixes a number of bugs To: Kristof Provost Cc: Warner Losh , src-committers , "" , dev-commits-src-branches@freebsd.org X-Rspamd-Queue-Id: 4GcRJK3TzLz4c6l X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=TVkxIKsD; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::72c) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-2.99 / 15.00]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[dev-commits-src-all@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; RCPT_COUNT_FIVE(0.00)[5]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; NEURAL_HAM_SHORT(-0.99)[-0.988]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::72c:from]; R_SPF_NA(0.00)[no SPF record]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; RCVD_COUNT_TWO(0.00)[2]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[dev-commits-src-all] 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: Sat, 31 Jul 2021 14:20:50 -0000 On Sat, Jul 31, 2021 at 8:07 AM Warner Losh wrote: > > > On Sat, Jul 31, 2021 at 3:11 AM Kristof Provost wrote: > >> Hi Warner, >> >> On 10 Jul 2021, at 19:12, Warner Losh wrote: >> >> The branch stable/12 has been updated by imp: >> >> URL: >> https://cgit.FreeBSD.org/src/commit/?id=3D6edf5082bab71cf923efff9f18e38e= fe5b83b0ec >> >> commit 6edf5082bab71cf923efff9f18e38efe5b83b0ec >> Author: Warner Losh >> AuthorDate: 2021-07-07 23:30:35 +0000 >> Commit: Warner Losh >> CommitDate: 2021-07-10 17:11:15 +0000 >> >> one-true-awk: import 20210221 (1e4bc42c53a1) which fixes a number of bug= s >> >> Import the latest bsd-features branch of the one-true-awk upstream: >> >> o Move to bison for $YACC >> o Set close-on-exec flag for file and pipe redirects that aren't std* >> o lots of little fixes to modernize ocde base >> o free sval member before setting it >> o fix a bug where a{0,3} could match aaaa >> o pull in systime and strftime from NetBSD awk >> o pull in fixes from {Net,Free,Open}BSD (normalized our code with them) >> o add BSD extensions and, or, xor, compl, lsheift, rshift (mostly a nop) >> >> Also revert a few of the trivial FreeBSD changes that were done slightly >> differently in the upstreaming process. Also, our PR database may have >> been mined by upstream for these fixes, and Mikolaj Golub may deserve >> credit for some of the fixes in this update. >> >> Suggested by: Mikolaj Golub >> PR: 143363,143365,143368,143369,143373,143375,214782 >> Sponsored by: Netflix >> >> (cherry picked from commit f39dd6a9784467f0db5886012b3f4b13899be6b8) >> >> I *think* this is the relevant commit, but I=E2=80=99m not 100% sure. >> >> Anyway, I=E2=80=99ve recently started seeing issues building pfSense for= aarch64. >> I=E2=80=99ve finally narrowed it down, and replicated the problem on bas= e FreeBSD >> (stable/12, but I assume other branches are affected too). >> >> It fails to build proctab.c. This file is generated by maketab, a tool >> built as part of the build process. In my case this tool is built for >> aarch64, which makes executing it on amd64 less successful than we=E2=80= =99d like. >> >> This only happens when building with META_MODE though. I do not >> understand the build system sufficiently to debug why. Hopefully you=E2= =80=99ll >> have a better idea. >> > Generally I do, but this one is a bit weird. Also, the amount of context > you've included omits the actual error :( Though I'm guessing it's wrong > arch for the build tool... > > I rarely use meta mode, and understand it not at all, but awk follows the > same patterns as /bin/sh and /bin/csh does > [[ stupid gmail ]] I've just pushed removal of proctab.c. That may fix this, though I'm not hopeful. I've rarely used metamode, and not for quite some time, but this an extra file that would confuse things so that maketab might not be built during build-tools and instead is built later. Please give that a try, and I'll start a meta build, but that takes a while, not least because I have to re-leran how to do that :) I've also noticed a few things I can do to cleanup the main build to eliminate the awkward symlinks, but I'll do those separately. Warner > Warner > > This triggers the build failure: >> >> % cat /usr/src/src_env.conf >> WITH_META_MODE=3Dyes >> % env SRC_ENV_CONF=3D/usr/src/src_env.conf TARGET_ARCH=3Daarch64 make -j= 8 buildworld >> >> =E2=80=A6 >> --- proctab.c --- >> *** [proctab.c] Error code 255 >> >> make[4]: stopped in /usr/src/usr.bin/awk >> .ERROR_TARGET=3D'proctab.c' >> .ERROR_META_FILE=3D'/usr/obj/usr/src/arm64.aarch64/usr.bin/awk/proctab.c= .meta' >> .MAKE.LEVEL=3D'4' >> MAKEFILE=3D'' >> .MAKE.MODE=3D'meta missing-filemon=3Dyes missing-meta=3Dyes silent=3Dyes= verbose' >> _ERROR_CMD=3D'./maketab awkgram.h > proctab.c;' >> .CURDIR=3D'/usr/src/usr.bin/awk' >> .MAKE=3D'make' >> .OBJDIR=3D'/usr/obj/usr/src/arm64.aarch64/usr.bin/awk' >> .TARGETS=3D'all' >> DESTDIR=3D'/usr/obj/usr/src/arm64.aarch64/tmp' >> LD_LIBRARY_PATH=3D'' >> MACHINE=3D'arm64' >> MACHINE_ARCH=3D'aarch64' >> MAKEOBJDIRPREFIX=3D'' >> MAKESYSPATH=3D'/usr/src/share/mk' >> MAKE_VERSION=3D'20200710' >> >> Further up in the build output: >> >> --- maketab --- >> cc -target aarch64-unknown-freebsd12.2 --sysroot=3D/usr/obj/usr/src/arm6= 4.aarch64/tmp -B/usr/obj/usr/src/arm64.aarch64/tmp/usr/bin -O2 -pipe -fno-c= ommon -DHAS_ISBLANK -I. -I/usr/src/contrib/one-true-awk -DFOPEN_MAX=3D64 = -g -std=3Dgnu99 -Wno-format-zero-length -fstack-protector-strong -Wsystem-h= eaders -Werror -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int -Wno-= unused-const-variable -Wno-tautological-compare -Wno-unused-value -Wno-pare= ntheses-equality -Wno-unused-function -Wno-enum-conversion -Wno-unused-loca= l-typedef -Wno-address-of-packed-member -Wno-switch -Wno-switch-enum -Wno-k= nr-promoted-parameter -Wno-parentheses -Qunused-arguments /usr/src/cont= rib/one-true-awk/maketab.c -o maketab >> >> Without META_MODE maketab is built as an amd64 binary, and the entire >> build succeeds. >> >> Best regards, >> Kristof >> > From owner-dev-commits-src-all@freebsd.org Sat Jul 31 14:57: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 19E7C65F2C4; Sat, 31 Jul 2021 14:57: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 4GcS6n75N9z4dfs; Sat, 31 Jul 2021 14:57: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 DB6FD1AAB3; Sat, 31 Jul 2021 14:57: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 16VEvbRD013899; Sat, 31 Jul 2021 14:57:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16VEvbJs013898; Sat, 31 Jul 2021 14:57:37 GMT (envelope-from git) Date: Sat, 31 Jul 2021 14:57:37 GMT Message-Id: <202107311457.16VEvbJs013898@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: f4855954c207 - stable/12 - smartpqi: Maintenance commit of Microchip smartpqi 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/12 X-Git-Reftype: branch X-Git-Commit: f4855954c2078cc53ef01cd00e5cf18ef266e441 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, 31 Jul 2021 14:57:38 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=f4855954c2078cc53ef01cd00e5cf18ef266e441 commit f4855954c2078cc53ef01cd00e5cf18ef266e441 Author: Papani Srikanth AuthorDate: 2021-07-30 23:49:53 +0000 Commit: Warner Losh CommitDate: 2021-07-31 14:55:44 +0000 smartpqi: Maintenance commit of Microchip smartpqi Newly added features and bug fixes in latest Microchip SmartPQI driver. 1) Newly added TMF feature. 2) Added newly Huawei & Inspur PCI ID's 3) Fixed smartpqi driver hangs in Z-Pool while running on FreeBSD12.1 4) Fixed flooding dmesg in kernel while the controller is offline during in ioctls. 5) Avoided unnecessary host memory allocation for rcb sg buffers. 6) Fixed race conditions while accessing internal rcb structure. 7) Fixed where Logical volumes exposing two different names to the OS it's due to the system memory is overwritten with DMA stale data. 8) Fixed dynamically unloading a smartpqi driver. 9) Added device_shutdown callback instead of deprecated shutdown_final kernel event in smartpqi driver. 10) Fixed where Os is crashed during physical drive hot removal during heavy IO. 11) Fixed OS crash during controller lockup/offline during heavy IO. 12) Fixed coverity issues in smartpqi driver 13) Fixed system crash while creating and deleting logical volume in a continuous loop. 14) Fixed where the volume size is not exposing to OS when it expands. 15) Added HC3 pci id's. 16) Fixed compiler issues in 12.2 kernel. Note: this is a direct commit, submitted by the vendor to support stable/12 Reviewed by: imp, Murthy Bhat, Scott Benesh Differential Revision: https://reviews.freebsd.org/D24428 --- sys/dev/smartpqi/smartpqi_cam.c | 599 +++++++++++++++++----------- sys/dev/smartpqi/smartpqi_cmd.c | 13 +- sys/dev/smartpqi/smartpqi_defines.h | 441 ++++++++++++++------- sys/dev/smartpqi/smartpqi_discovery.c | 702 +++++++++++++++++++++------------ sys/dev/smartpqi/smartpqi_event.c | 137 +++---- sys/dev/smartpqi/smartpqi_helper.c | 302 +++++++++++--- sys/dev/smartpqi/smartpqi_includes.h | 6 +- sys/dev/smartpqi/smartpqi_init.c | 483 +++++++++++++++++------ sys/dev/smartpqi/smartpqi_intr.c | 158 ++++---- sys/dev/smartpqi/smartpqi_ioctl.c | 127 +++--- sys/dev/smartpqi/smartpqi_ioctl.h | 24 +- sys/dev/smartpqi/smartpqi_main.c | 251 +++++++----- sys/dev/smartpqi/smartpqi_mem.c | 77 +++- sys/dev/smartpqi/smartpqi_misc.c | 85 ++-- sys/dev/smartpqi/smartpqi_prototypes.h | 63 ++- sys/dev/smartpqi/smartpqi_queue.c | 313 ++++++++------- sys/dev/smartpqi/smartpqi_request.c | 513 ++++++++++++++++++------ sys/dev/smartpqi/smartpqi_response.c | 185 +++++++-- sys/dev/smartpqi/smartpqi_sis.c | 96 +++-- sys/dev/smartpqi/smartpqi_structures.h | 589 +++++++++++++++++---------- sys/dev/smartpqi/smartpqi_tag.c | 123 +++--- 21 files changed, 3490 insertions(+), 1797 deletions(-) diff --git a/sys/dev/smartpqi/smartpqi_cam.c b/sys/dev/smartpqi/smartpqi_cam.c index 5e72846d70cd..3d39e1ffbdd4 100644 --- a/sys/dev/smartpqi/smartpqi_cam.c +++ b/sys/dev/smartpqi/smartpqi_cam.c @@ -1,6 +1,5 @@ /*- - * Copyright (c) 2018 Microsemi Corporation. - * All rights reserved. + * Copyright 2016-2021 Microchip Technology, Inc. and/or its subsidiaries. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -34,11 +33,15 @@ /* * Set cam sim properties of the smartpqi adapter. */ -static void update_sim_properties(struct cam_sim *sim, struct ccb_pathinq *cpi) +static void +update_sim_properties(struct cam_sim *sim, struct ccb_pathinq *cpi) { pqisrc_softstate_t *softs = (struct pqisrc_softstate *) cam_sim_softc(sim); + + device_t dev = softs->os_specific.pqi_dev; + DBG_FUNC("IN\n"); cpi->version_num = 1; @@ -50,9 +53,9 @@ static void update_sim_properties(struct cam_sim *sim, struct ccb_pathinq *cpi) cpi->max_target = 1088; cpi->maxio = (softs->pqi_cap.max_sg_elem - 1) * PAGE_SIZE; cpi->initiator_id = 255; - strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN); - strncpy(cpi->hba_vid, "Microsemi", HBA_IDLEN); - strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN); + strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN); + strlcpy(cpi->hba_vid, "Microsemi", HBA_IDLEN); + strlcpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN); cpi->unit_number = cam_sim_unit(sim); cpi->bus_id = cam_sim_bus(sim); cpi->base_transfer_speed = 1200000; /* Base bus speed in KB/sec */ @@ -61,6 +64,11 @@ static void update_sim_properties(struct cam_sim *sim, struct ccb_pathinq *cpi) cpi->transport = XPORT_SPI; cpi->transport_version = 2; cpi->ccb_h.status = CAM_REQ_CMP; + cpi->hba_vendor = pci_get_vendor(dev); + cpi->hba_device = pci_get_device(dev); + cpi->hba_subvendor = pci_get_subvendor(dev); + cpi->hba_subdevice = pci_get_subdevice(dev); + DBG_FUNC("OUT\n"); } @@ -68,7 +76,8 @@ static void update_sim_properties(struct cam_sim *sim, struct ccb_pathinq *cpi) /* * Get transport settings of the smartpqi adapter */ -static void get_transport_settings(struct pqisrc_softstate *softs, +static void +get_transport_settings(struct pqisrc_softstate *softs, struct ccb_trans_settings *cts) { struct ccb_trans_settings_scsi *scsi = &cts->proto_specific.scsi; @@ -94,8 +103,10 @@ static void get_transport_settings(struct pqisrc_softstate *softs, /* * Add the target to CAM layer and rescan, when a new device is found */ -void os_add_device(pqisrc_softstate_t *softs, pqi_scsi_dev_t *device) { - union ccb *ccb; +void +os_add_device(pqisrc_softstate_t *softs, pqi_scsi_dev_t *device) +{ + union ccb *ccb; DBG_FUNC("IN\n"); @@ -121,8 +132,9 @@ void os_add_device(pqisrc_softstate_t *softs, pqi_scsi_dev_t *device) { /* * Remove the device from CAM layer when deleted or hot removed */ -void os_remove_device(pqisrc_softstate_t *softs, - pqi_scsi_dev_t *device) { +void +os_remove_device(pqisrc_softstate_t *softs, pqi_scsi_dev_t *device) +{ struct cam_path *tmppath; DBG_FUNC("IN\n"); @@ -136,6 +148,7 @@ void os_remove_device(pqisrc_softstate_t *softs, } xpt_async(AC_LOST_DEVICE, tmppath, NULL); xpt_free_path(tmppath); + softs->device_list[device->target][device->lun] = NULL; pqisrc_free_device(softs, device); } @@ -146,7 +159,8 @@ void os_remove_device(pqisrc_softstate_t *softs, /* * Function to release the frozen simq */ -static void pqi_release_camq( rcb_t *rcb ) +static void +pqi_release_camq(rcb_t *rcb) { pqisrc_softstate_t *softs; struct ccb_scsiio *csio; @@ -167,18 +181,12 @@ static void pqi_release_camq( rcb_t *rcb ) DBG_FUNC("OUT\n"); } -/* - * Function to dma-unmap the completed request - */ -static void pqi_unmap_request(void *arg) +static void +pqi_synch_request(rcb_t *rcb) { - pqisrc_softstate_t *softs; - rcb_t *rcb; - - DBG_IO("IN rcb = %p\n", arg); + pqisrc_softstate_t *softs = rcb->softs; - rcb = (rcb_t *)arg; - softs = rcb->softs; + DBG_IO("IN rcb = %p\n", rcb); if (!(rcb->cm_flags & PQI_CMD_MAPPED)) return; @@ -199,9 +207,21 @@ static void pqi_unmap_request(void *arg) if(rcb->sgt && rcb->nseg) os_mem_free(rcb->softs, (void*)rcb->sgt, - rcb->nseg*sizeof(sgt_t)); + rcb->nseg*sizeof(sgt_t)); - pqisrc_put_tag(&softs->taglist, rcb->tag); + DBG_IO("OUT\n"); +} + +/* + * Function to dma-unmap the completed request + */ +static inline void +pqi_unmap_request(rcb_t *rcb) +{ + DBG_IO("IN rcb = %p\n", rcb); + + pqi_synch_request(rcb); + pqisrc_put_tag(&rcb->softs->taglist, rcb->tag); DBG_IO("OUT\n"); } @@ -218,9 +238,12 @@ smartpqi_fix_ld_inquiry(pqisrc_softstate_t *softs, struct ccb_scsiio *csio) DBG_FUNC("IN\n"); + if (pqisrc_ctrl_offline(softs)) + return; + cdb = (csio->ccb_h.flags & CAM_CDB_POINTER) ? (uint8_t *)csio->cdb_io.cdb_ptr : csio->cdb_io.cdb_bytes; - if(cdb[0] == INQUIRY && + if(cdb[0] == INQUIRY && (cdb[1] & SI_EVPD) == 0 && (csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN && csio->dxfer_len >= SHORT_INQUIRY_LENGTH) { @@ -231,49 +254,87 @@ smartpqi_fix_ld_inquiry(pqisrc_softstate_t *softs, struct ccb_scsiio *csio) /* Let the disks be probed and dealt with via CAM. Only for LD let it fall through and inquiry be tweaked */ - if( !device || !pqisrc_is_logical_device(device) || - (device->devtype != DISK_DEVICE) || + if (!device || !pqisrc_is_logical_device(device) || + (device->devtype != DISK_DEVICE) || pqisrc_is_external_raid_device(device)) { return; } - strncpy(inq->vendor, "MSCC", - SID_VENDOR_SIZE); - strncpy(inq->product, - pqisrc_raidlevel_to_string(device->raid_level), - SID_PRODUCT_SIZE); + strncpy(inq->vendor, device->vendor, + SID_VENDOR_SIZE); + strncpy(inq->product, + pqisrc_raidlevel_to_string(device->raid_level), + SID_PRODUCT_SIZE); strncpy(inq->revision, device->volume_offline?"OFF":"OK", - SID_REVISION_SIZE); + SID_REVISION_SIZE); } DBG_FUNC("OUT\n"); } +static void +pqi_complete_scsi_io(struct ccb_scsiio *csio, rcb_t *rcb) +{ + uint32_t release_tag; + pqisrc_softstate_t *softs = rcb->softs; + + DBG_IO("IN scsi io = %p\n", csio); + + pqi_synch_request(rcb); + smartpqi_fix_ld_inquiry(rcb->softs, csio); + pqi_release_camq(rcb); + release_tag = rcb->tag; + os_reset_rcb(rcb); + pqisrc_put_tag(&softs->taglist, release_tag); + xpt_done((union ccb *)csio); + + DBG_FUNC("OUT\n"); +} + /* * Handle completion of a command - pass results back through the CCB */ void os_io_response_success(rcb_t *rcb) { - struct ccb_scsiio *csio; + struct ccb_scsiio *csio; DBG_IO("IN rcb = %p\n", rcb); - if (rcb == NULL) + if (rcb == NULL) panic("rcb is null"); csio = (struct ccb_scsiio *)&rcb->cm_ccb->csio; - - if (csio == NULL) + + if (csio == NULL) panic("csio is null"); rcb->status = REQUEST_SUCCESS; csio->ccb_h.status = CAM_REQ_CMP; - smartpqi_fix_ld_inquiry(rcb->softs, csio); - pqi_release_camq(rcb); - pqi_unmap_request(rcb); - xpt_done((union ccb *)csio); + pqi_complete_scsi_io(csio, rcb); + + DBG_IO("OUT\n"); +} + +static void +copy_sense_data_to_csio(struct ccb_scsiio *csio, + uint8_t *sense_data, uint16_t sense_data_len) +{ + DBG_IO("IN csio = %p\n", csio); + + memset(&csio->sense_data, 0, csio->sense_len); + + sense_data_len = (sense_data_len > csio->sense_len) ? + csio->sense_len : sense_data_len; + + if (sense_data) + memcpy(&csio->sense_data, sense_data, sense_data_len); + + if (csio->sense_len > sense_data_len) + csio->sense_resid = csio->sense_len - sense_data_len; + else + csio->sense_resid = 0; DBG_IO("OUT\n"); } @@ -281,7 +342,8 @@ os_io_response_success(rcb_t *rcb) /* * Error response handling for raid IO */ -void os_raid_response_error(rcb_t *rcb, raid_path_error_info_elem_t *err_info) +void +os_raid_response_error(rcb_t *rcb, raid_path_error_info_elem_t *err_info) { struct ccb_scsiio *csio; pqisrc_softstate_t *softs; @@ -295,10 +357,16 @@ void os_raid_response_error(rcb_t *rcb, raid_path_error_info_elem_t *err_info) softs = rcb->softs; - ASSERT(err_info != NULL); - csio->scsi_status = err_info->status; csio->ccb_h.status = CAM_REQ_CMP_ERR; + if (!err_info || !rcb->dvp) { + DBG_ERR("couldn't be accessed! error info = %p, rcb->dvp = %p\n", + err_info, rcb->dvp); + goto error_out; + } + + csio->scsi_status = err_info->status; + if (csio->ccb_h.func_code == XPT_SCSI_IO) { /* * Handle specific SCSI status values. @@ -306,30 +374,18 @@ void os_raid_response_error(rcb_t *rcb, raid_path_error_info_elem_t *err_info) switch(csio->scsi_status) { case PQI_RAID_STATUS_QUEUE_FULL: csio->ccb_h.status = CAM_REQ_CMP; - DBG_ERR("Queue Full error"); + DBG_ERR("Queue Full error\n"); break; /* check condition, sense data included */ case PQI_RAID_STATUS_CHECK_CONDITION: { - uint16_t sense_data_len = - LE_16(err_info->sense_data_len); - uint8_t *sense_data = NULL; - if (sense_data_len) - sense_data = err_info->data; - memset(&csio->sense_data, 0, csio->sense_len); - sense_data_len = (sense_data_len > - csio->sense_len) ? - csio->sense_len : - sense_data_len; - if (sense_data) - memcpy(&csio->sense_data, sense_data, - sense_data_len); - if (csio->sense_len > sense_data_len) - csio->sense_resid = csio->sense_len - - sense_data_len; - else - csio->sense_resid = 0; - csio->ccb_h.status = CAM_SCSI_STATUS_ERROR + uint16_t sense_data_len = + LE_16(err_info->sense_data_len); + uint8_t *sense_data = NULL; + if (sense_data_len) + sense_data = err_info->data; + copy_sense_data_to_csio(csio, sense_data, sense_data_len); + csio->ccb_h.status = CAM_SCSI_STATUS_ERROR | CAM_AUTOSNS_VALID | CAM_REQ_CMP_ERR; @@ -338,44 +394,36 @@ void os_raid_response_error(rcb_t *rcb, raid_path_error_info_elem_t *err_info) case PQI_RAID_DATA_IN_OUT_UNDERFLOW: { - uint32_t resid = 0; - resid = rcb->bcount-err_info->data_out_transferred; - csio->resid = resid; - csio->ccb_h.status = CAM_REQ_CMP; - break; + uint32_t resid = 0; + resid = rcb->bcount-err_info->data_out_transferred; + csio->resid = resid; + csio->ccb_h.status = CAM_REQ_CMP; } + break; default: csio->ccb_h.status = CAM_REQ_CMP; break; } } - if (softs->os_specific.pqi_flags & PQI_FLAG_BUSY) { - softs->os_specific.pqi_flags &= ~PQI_FLAG_BUSY; - if (csio->ccb_h.status & CAM_RELEASE_SIMQ) - xpt_release_simq(xpt_path_sim(csio->ccb_h.path), 0); - else - csio->ccb_h.status |= CAM_RELEASE_SIMQ; - } - - pqi_unmap_request(rcb); - xpt_done((union ccb *)csio); +error_out: + pqi_complete_scsi_io(csio, rcb); DBG_IO("OUT\n"); } - /* * Error response handling for aio. */ -void os_aio_response_error(rcb_t *rcb, aio_path_error_info_elem_t *err_info) +void +os_aio_response_error(rcb_t *rcb, aio_path_error_info_elem_t *err_info) { struct ccb_scsiio *csio; pqisrc_softstate_t *softs; DBG_IO("IN\n"); - if (rcb == NULL) + if (rcb == NULL) panic("rcb is null"); rcb->status = REQUEST_SUCCESS; @@ -385,6 +433,13 @@ void os_aio_response_error(rcb_t *rcb, aio_path_error_info_elem_t *err_info) softs = rcb->softs; + if (!err_info || !rcb->dvp) { + csio->ccb_h.status = CAM_REQ_CMP_ERR; + DBG_ERR("couldn't be accessed! error info = %p, rcb->dvp = %p\n", + err_info, rcb->dvp); + goto error_out; + } + switch (err_info->service_resp) { case PQI_AIO_SERV_RESPONSE_COMPLETE: csio->ccb_h.status = err_info->status; @@ -405,6 +460,14 @@ void os_aio_response_error(rcb_t *rcb, aio_path_error_info_elem_t *err_info) break; case PQI_AIO_STATUS_AIO_PATH_DISABLED: DBG_WARN_BTL(rcb->dvp,"AIO Path Disabled\n"); + /* Timed out TMF response comes here */ + if (rcb->tm_req) { + rcb->req_pending = false; + rcb->status = REQUEST_SUCCESS; + DBG_ERR("AIO Disabled for TMF\n"); + return; + } + rcb->dvp->aio_enabled = false; rcb->dvp->offload_enabled = false; csio->ccb_h.status |= CAM_REQUEUE_REQ; break; @@ -420,18 +483,24 @@ void os_aio_response_error(rcb_t *rcb, aio_path_error_info_elem_t *err_info) break; case PQI_AIO_SERV_RESPONSE_TMF_COMPLETE: case PQI_AIO_SERV_RESPONSE_TMF_SUCCEEDED: - csio->ccb_h.status = CAM_REQ_CMP; - break; + DBG_ERR("PQI_AIO_SERV_RESPONSE_TMF %s\n", + (err_info->service_resp == PQI_AIO_SERV_RESPONSE_TMF_COMPLETE) ? "COMPLETE" : "SUCCEEDED"); + rcb->status = REQUEST_SUCCESS; + rcb->req_pending = false; + return; case PQI_AIO_SERV_RESPONSE_TMF_REJECTED: case PQI_AIO_SERV_RESPONSE_TMF_INCORRECT_LUN: - DBG_WARN_BTL(rcb->dvp,"TMF rejected/Incorrect Lun\n"); - csio->ccb_h.status |= CAM_SCSI_STATUS_ERROR; - break; + DBG_ERR("PQI_AIO_SERV_RESPONSE_TMF %s\n", + (err_info->service_resp == PQI_AIO_SERV_RESPONSE_TMF_REJECTED) ? "REJECTED" : "INCORRECT LUN"); + rcb->status = REQUEST_FAILED; + rcb->req_pending = false; + return; default: DBG_WARN_BTL(rcb->dvp,"Scsi Status Error\n"); csio->ccb_h.status |= CAM_SCSI_STATUS_ERROR; break; } + if(err_info->data_pres == DATA_PRESENT_SENSE_DATA ) { csio->scsi_status = PQI_AIO_STATUS_CHECK_CONDITION; uint8_t *sense_data = NULL; @@ -440,56 +509,52 @@ void os_aio_response_error(rcb_t *rcb, aio_path_error_info_elem_t *err_info) sense_data = err_info->data; DBG_ERR_BTL(rcb->dvp, "SCSI_STATUS_CHECK_COND sense size %u\n", sense_data_len); - memset(&csio->sense_data, 0, csio->sense_len); - if (sense_data) - memcpy(&csio->sense_data, sense_data, ((sense_data_len > - csio->sense_len) ? csio->sense_len : sense_data_len)); - if (csio->sense_len > sense_data_len) - csio->sense_resid = csio->sense_len - sense_data_len; - else - csio->sense_resid = 0; + copy_sense_data_to_csio(csio, sense_data, sense_data_len); csio->ccb_h.status = CAM_SCSI_STATUS_ERROR | CAM_AUTOSNS_VALID; } - smartpqi_fix_ld_inquiry(softs, csio); - pqi_release_camq(rcb); - pqi_unmap_request(rcb); - xpt_done((union ccb *)csio); +error_out: + pqi_complete_scsi_io(csio, rcb); DBG_IO("OUT\n"); } +static void +pqi_freeze_ccb(union ccb *ccb) +{ + if ((ccb->ccb_h.status & CAM_DEV_QFRZN) == 0) { + ccb->ccb_h.status |= CAM_DEV_QFRZN; + xpt_freeze_devq(ccb->ccb_h.path, 1); + } +} + /* * Command-mapping helper function - populate this command's s/g table. */ static void pqi_request_map_helper(void *arg, bus_dma_segment_t *segs, int nseg, int error) { - pqisrc_softstate_t *softs; - rcb_t *rcb; - - rcb = (rcb_t *)arg; - softs = rcb->softs; + rcb_t *rcb = (rcb_t *)arg; + pqisrc_softstate_t *softs = rcb->softs; + union ccb *ccb; - if( error || nseg > softs->pqi_cap.max_sg_elem ) - { - xpt_freeze_simq(softs->os_specific.sim, 1); - rcb->cm_ccb->ccb_h.status |= (CAM_REQUEUE_REQ| - CAM_RELEASE_SIMQ); - DBG_ERR_BTL(rcb->dvp, "map failed err = %d or nseg(%d) > sgelem(%d)\n", + if (error || nseg > softs->pqi_cap.max_sg_elem) { + DBG_ERR_BTL(rcb->dvp, "map failed err = %d or nseg(%d) > sgelem(%d)\n", error, nseg, softs->pqi_cap.max_sg_elem); - pqi_unmap_request(rcb); - xpt_done((union ccb *)rcb->cm_ccb); - return; + goto error_io; + } + + rcb->sgt = os_mem_alloc(softs, nseg * sizeof(sgt_t)); + + if (!rcb->sgt) { + DBG_ERR_BTL(rcb->dvp, "os_mem_alloc() failed; nseg = %d\n", nseg); + goto error_io; } - rcb->sgt = os_mem_alloc(softs, nseg * sizeof(rcb_t)); rcb->nseg = nseg; - if (rcb->sgt != NULL) { - for (int i = 0; i < nseg; i++) { - rcb->sgt[i].addr = segs[i].ds_addr; - rcb->sgt[i].len = segs[i].ds_len; - rcb->sgt[i].flags = 0; - } + for (int i = 0; i < nseg; i++) { + rcb->sgt[i].addr = segs[i].ds_addr; + rcb->sgt[i].len = segs[i].ds_len; + rcb->sgt[i].flags = 0; } if (rcb->data_dir == SOP_DATA_DIR_FROM_DEVICE) @@ -506,39 +571,46 @@ pqi_request_map_helper(void *arg, bus_dma_segment_t *segs, int nseg, int error) if (error) { rcb->req_pending = false; - xpt_freeze_simq(softs->os_specific.sim, 1); - rcb->cm_ccb->ccb_h.status |= (CAM_REQUEUE_REQ - |CAM_RELEASE_SIMQ); DBG_ERR_BTL(rcb->dvp, "Build IO failed, error = %d\n", error); - pqi_unmap_request(rcb); - xpt_done((union ccb *)rcb->cm_ccb); + } else { + /* Successfully IO was submitted to the device. */ return; } + +error_io: + ccb = rcb->cm_ccb; + ccb->ccb_h.status = CAM_RESRC_UNAVAIL; + pqi_freeze_ccb(ccb); + pqi_unmap_request(rcb); + xpt_done(ccb); + return; } /* - * Function to dma-map the request buffer + * Function to dma-map the request buffer */ -static int pqi_map_request( rcb_t *rcb ) +static int +pqi_map_request(rcb_t *rcb) { pqisrc_softstate_t *softs = rcb->softs; - int error = PQI_STATUS_SUCCESS; + int bsd_status = BSD_SUCCESS; union ccb *ccb = rcb->cm_ccb; DBG_FUNC("IN\n"); /* check that mapping is necessary */ if (rcb->cm_flags & PQI_CMD_MAPPED) - return(0); + return BSD_SUCCESS; + rcb->cm_flags |= PQI_CMD_MAPPED; if (rcb->bcount) { - error = bus_dmamap_load_ccb(softs->os_specific.pqi_buffer_dmat, + bsd_status = bus_dmamap_load_ccb(softs->os_specific.pqi_buffer_dmat, rcb->cm_datamap, ccb, pqi_request_map_helper, rcb, 0); - if (error != 0){ - DBG_ERR_BTL(rcb->dvp, "bus_dmamap_load_ccb failed = %d count = %d\n", - error, rcb->bcount); - return error; + if (bsd_status != BSD_SUCCESS && bsd_status != EINPROGRESS) { + DBG_ERR_BTL(rcb->dvp, "bus_dmamap_load_ccb failed, return status = %d transfer length = %d\n", + bsd_status, rcb->bcount); + return bsd_status; } } else { /* @@ -549,19 +621,21 @@ static int pqi_map_request( rcb_t *rcb ) /* Call IO functions depending on pd or ld */ rcb->status = REQUEST_PENDING; - error = pqisrc_build_send_io(softs, rcb); - + if (pqisrc_build_send_io(softs, rcb) != PQI_STATUS_SUCCESS) { + bsd_status = EIO; + } } - DBG_FUNC("OUT error = %d\n", error); + DBG_FUNC("OUT error = %d\n", bsd_status); - return error; + return bsd_status; } /* * Function to clear the request control block */ -void os_reset_rcb( rcb_t *rcb ) +void +os_reset_rcb(rcb_t *rcb) { rcb->error_info = NULL; rcb->req = NULL; @@ -572,7 +646,7 @@ void os_reset_rcb( rcb_t *rcb ) rcb->softs = NULL; rcb->cm_flags = 0; rcb->cm_data = NULL; - rcb->bcount = 0; + rcb->bcount = 0; rcb->nseg = 0; rcb->sgt = NULL; rcb->cm_ccb = NULL; @@ -580,12 +654,14 @@ void os_reset_rcb( rcb_t *rcb ) rcb->ioaccel_handle = 0; rcb->resp_qid = 0; rcb->req_pending = false; + rcb->tm_req = false; } /* * Callback function for the lun rescan */ -static void smartpqi_lunrescan_cb(struct cam_periph *periph, union ccb *ccb) +static void +smartpqi_lunrescan_cb(struct cam_periph *periph, union ccb *ccb) { xpt_free_path(ccb->ccb_h.path); xpt_free_ccb(ccb); @@ -595,16 +671,22 @@ static void smartpqi_lunrescan_cb(struct cam_periph *periph, union ccb *ccb) /* * Function to rescan the lun */ -static void smartpqi_lun_rescan(struct pqisrc_softstate *softs, int target, +static void +smartpqi_lun_rescan(struct pqisrc_softstate *softs, int target, int lun) { - union ccb *ccb = NULL; - cam_status status = 0; - struct cam_path *path = NULL; + union ccb *ccb = NULL; + cam_status status = 0; + struct cam_path *path = NULL; DBG_FUNC("IN\n"); ccb = xpt_alloc_ccb_nowait(); + if (ccb == NULL) { + DBG_ERR("Unable to alloc ccb for lun rescan\n"); + return; + } + status = xpt_create_path(&path, NULL, cam_sim_path(softs->os_specific.sim), target, lun); if (status != CAM_REQ_CMP) { @@ -628,7 +710,8 @@ static void smartpqi_lun_rescan(struct pqisrc_softstate *softs, int target, /* * Function to rescan the lun under each target */ -void smartpqi_target_rescan(struct pqisrc_softstate *softs) +void +smartpqi_target_rescan(struct pqisrc_softstate *softs) { int target = 0, lun = 0; @@ -648,7 +731,8 @@ void smartpqi_target_rescan(struct pqisrc_softstate *softs) /* * Set the mode of tagged command queueing for the current task. */ -uint8_t os_get_task_attr(rcb_t *rcb) +uint8_t +os_get_task_attr(rcb_t *rcb) { union ccb *ccb = rcb->cm_ccb; uint8_t tag_action = SOP_TASK_ATTRIBUTE_SIMPLE; @@ -671,19 +755,24 @@ uint8_t os_get_task_attr(rcb_t *rcb) /* * Complete all outstanding commands */ -void os_complete_outstanding_cmds_nodevice(pqisrc_softstate_t *softs) +void +os_complete_outstanding_cmds_nodevice(pqisrc_softstate_t *softs) { int tag = 0; + pqi_scsi_dev_t *dvp = NULL; DBG_FUNC("IN\n"); - for (tag = 1; tag < softs->max_outstanding_io; tag++) { + for (tag = 1; tag <= softs->max_outstanding_io; tag++) { rcb_t *prcb = &softs->rcb[tag]; + dvp = prcb->dvp; if(prcb->req_pending && prcb->cm_ccb ) { prcb->req_pending = false; prcb->cm_ccb->ccb_h.status = CAM_REQ_ABORTED | CAM_REQ_CMP; - xpt_done((union ccb *)prcb->cm_ccb); - prcb->cm_ccb = NULL; + pqi_complete_scsi_io(&prcb->cm_ccb->csio, prcb); + if (dvp) + pqisrc_decrement_device_active_io(softs, dvp); + } } @@ -693,21 +782,22 @@ void os_complete_outstanding_cmds_nodevice(pqisrc_softstate_t *softs) /* * IO handling functionality entry point */ -static int pqisrc_io_start(struct cam_sim *sim, union ccb *ccb) +static int +pqisrc_io_start(struct cam_sim *sim, union ccb *ccb) { rcb_t *rcb; uint32_t tag, no_transfer = 0; pqisrc_softstate_t *softs = (struct pqisrc_softstate *) cam_sim_softc(sim); - int32_t error = PQI_STATUS_FAILURE; + int32_t error; pqi_scsi_dev_t *dvp; DBG_FUNC("IN\n"); - - if( softs->device_list[ccb->ccb_h.target_id][ccb->ccb_h.target_lun] == NULL ) { + + if (softs->device_list[ccb->ccb_h.target_id][ccb->ccb_h.target_lun] == NULL) { ccb->ccb_h.status = CAM_DEV_NOT_THERE; DBG_INFO("Device = %d not there\n", ccb->ccb_h.target_id); - return PQI_STATUS_FAILURE; + return ENXIO; } dvp = softs->device_list[ccb->ccb_h.target_id][ccb->ccb_h.target_lun]; @@ -716,40 +806,40 @@ static int pqisrc_io_start(struct cam_sim *sim, union ccb *ccb) ccb->ccb_h.status = CAM_SCSI_BUS_RESET | CAM_BUSY | CAM_REQ_INPROG; DBG_WARN("Device = %d BUSY/IN_RESET\n", ccb->ccb_h.target_id); - return error; + return ENXIO; } /* Check device state */ if (pqisrc_ctrl_offline(softs) || DEV_GONE(dvp)) { ccb->ccb_h.status = CAM_DEV_NOT_THERE | CAM_REQ_CMP; DBG_WARN("Device = %d GONE/OFFLINE\n", ccb->ccb_h.target_id); - return error; + return ENXIO; } /* Check device reset */ - if (dvp->reset_in_progress) { + if (DEVICE_RESET(dvp)) { ccb->ccb_h.status = CAM_SCSI_BUSY | CAM_REQ_INPROG | CAM_BUSY; DBG_WARN("Device %d reset returned busy\n", ccb->ccb_h.target_id); - return error; + return EBUSY; } if (dvp->expose_device == false) { ccb->ccb_h.status = CAM_DEV_NOT_THERE; DBG_INFO("Device = %d not exposed\n", ccb->ccb_h.target_id); - return error; + return ENXIO; } tag = pqisrc_get_tag(&softs->taglist); - if( tag == INVALID_ELEM ) { + if (tag == INVALID_ELEM) { DBG_ERR("Get Tag failed\n"); xpt_freeze_simq(softs->os_specific.sim, 1); softs->os_specific.pqi_flags |= PQI_FLAG_BUSY; ccb->ccb_h.status |= (CAM_REQUEUE_REQ | CAM_RELEASE_SIMQ); - return PQI_STATUS_FAILURE; + return EIO; } DBG_IO("tag = %d &softs->taglist : %p\n", tag, &softs->taglist); rcb = &softs->rcb[tag]; - os_reset_rcb( rcb ); + os_reset_rcb(rcb); rcb->tag = tag; rcb->softs = softs; rcb->cmdlen = ccb->csio.cdb_len; @@ -786,57 +876,72 @@ static int pqisrc_io_start(struct cam_sim *sim, union ccb *ccb) * if we ever learn a transport layer other than simple, may fail * if the adapter rejects the command). */ - if ((error = pqi_map_request(rcb)) != 0) { - rcb->req_pending = false; + if ((error = pqi_map_request(rcb)) != BSD_SUCCESS) { xpt_freeze_simq(softs->os_specific.sim, 1); - ccb->ccb_h.status |= CAM_RELEASE_SIMQ; if (error == EINPROGRESS) { - DBG_WARN("In Progress on %d\n", ccb->ccb_h.target_id); - error = 0; + /* Release simq in the completion */ + softs->os_specific.pqi_flags |= PQI_FLAG_BUSY; + error = BSD_SUCCESS; } else { - ccb->ccb_h.status |= CAM_REQUEUE_REQ; + rcb->req_pending = false; + ccb->ccb_h.status |= CAM_REQUEUE_REQ | CAM_RELEASE_SIMQ; DBG_WARN("Requeue req error = %d target = %d\n", error, ccb->ccb_h.target_id); pqi_unmap_request(rcb); + error = EIO; } } DBG_FUNC("OUT error = %d\n", error); + return error; } +static inline int +pqi_tmf_status_to_bsd_tmf_status(int pqi_status, rcb_t *rcb) +{ + if (PQI_STATUS_SUCCESS == pqi_status && + REQUEST_SUCCESS == rcb->status) + return BSD_SUCCESS; + else + return EIO; +} + /* * Abort a task, task management functionality */ static int pqisrc_scsi_abort_task(pqisrc_softstate_t *softs, union ccb *ccb) { - rcb_t *rcb = ccb->ccb_h.sim_priv.entries[0].ptr; - uint32_t abort_tag = rcb->tag; - uint32_t tag = 0; - int rval = PQI_STATUS_SUCCESS; - uint16_t qid; - - DBG_FUNC("IN\n"); + struct ccb_hdr *ccb_h = &ccb->ccb_h; + rcb_t *rcb = NULL; + rcb_t *prcb = ccb->ccb_h.sim_priv.entries[0].ptr; + uint32_t tag; + int rval; - qid = (uint16_t)rcb->resp_qid; + DBG_FUNC("IN\n"); tag = pqisrc_get_tag(&softs->taglist); rcb = &softs->rcb[tag]; rcb->tag = tag; - rcb->resp_qid = qid; - rval = pqisrc_send_tmf(softs, rcb->dvp, rcb, abort_tag, + if (!rcb->dvp) { + DBG_ERR("dvp is null, tmf type : 0x%x\n", ccb_h->func_code); + rval = ENXIO; + goto error_tmf; + } + + rcb->tm_req = true; + + rval = pqisrc_send_tmf(softs, rcb->dvp, rcb, prcb, SOP_TASK_MANAGEMENT_FUNCTION_ABORT_TASK); - if (PQI_STATUS_SUCCESS == rval) { - rval = rcb->status; - if (REQUEST_SUCCESS == rval) { - ccb->ccb_h.status = CAM_REQ_ABORTED; - } - } - pqisrc_put_tag(&softs->taglist, abort_tag); - pqisrc_put_tag(&softs->taglist,rcb->tag); + if ((rval = pqi_tmf_status_to_bsd_tmf_status(rval, rcb)) == BSD_SUCCESS) + ccb->ccb_h.status = CAM_REQ_ABORTED; + +error_tmf: + os_reset_rcb(rcb); + pqisrc_put_tag(&softs->taglist, tag); DBG_FUNC("OUT rval = %d\n", rval); @@ -849,9 +954,10 @@ pqisrc_scsi_abort_task(pqisrc_softstate_t *softs, union ccb *ccb) static int pqisrc_scsi_abort_task_set(pqisrc_softstate_t *softs, union ccb *ccb) { + struct ccb_hdr *ccb_h = &ccb->ccb_h; rcb_t *rcb = NULL; - uint32_t tag = 0; - int rval = PQI_STATUS_SUCCESS; + uint32_t tag; + int rval; DBG_FUNC("IN\n"); @@ -859,14 +965,22 @@ pqisrc_scsi_abort_task_set(pqisrc_softstate_t *softs, union ccb *ccb) rcb = &softs->rcb[tag]; rcb->tag = tag; - rval = pqisrc_send_tmf(softs, rcb->dvp, rcb, 0, + if (!rcb->dvp) { *** 9666 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Sat Jul 31 15:01: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 396DE65FA84; Sat, 31 Jul 2021 15:01: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 4GcSCY0sKvz4dkk; Sat, 31 Jul 2021 15:01: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 062B91AA33; Sat, 31 Jul 2021 15:01: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 16VF1inB027284; Sat, 31 Jul 2021 15:01:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16VF1il7027283; Sat, 31 Jul 2021 15:01:44 GMT (envelope-from git) Date: Sat, 31 Jul 2021 15:01:44 GMT Message-Id: <202107311501.16VF1il7027283@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: d02e436353d2 - main - igc: sync igc_txrx with igb(4) 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/main X-Git-Reftype: branch X-Git-Commit: d02e436353d292e6fd50f70ea80507095543764e 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, 31 Jul 2021 15:01:45 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=d02e436353d292e6fd50f70ea80507095543764e commit d02e436353d292e6fd50f70ea80507095543764e Author: Kevin Bowling AuthorDate: 2021-07-31 15:00:16 +0000 Commit: Kevin Bowling CommitDate: 2021-07-31 15:00:16 +0000 igc: sync igc_txrx with igb(4) Reviewed by: grehan MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31227 --- sys/dev/igc/igc_txrx.c | 92 +++++++++++++++++++++++++++++--------------------- 1 file changed, 53 insertions(+), 39 deletions(-) diff --git a/sys/dev/igc/igc_txrx.c b/sys/dev/igc/igc_txrx.c index 2636aa77069a..ee4d5a5c0c6b 100644 --- a/sys/dev/igc/igc_txrx.c +++ b/sys/dev/igc/igc_txrx.c @@ -52,16 +52,20 @@ static int igc_isc_txd_credits_update(void *arg, uint16_t txqid, bool clear); static void igc_isc_rxd_refill(void *arg, if_rxd_update_t iru); -static void igc_isc_rxd_flush(void *arg, uint16_t rxqid, uint8_t flid __unused, qidx_t pidx); -static int igc_isc_rxd_available(void *arg, uint16_t rxqid, qidx_t idx, qidx_t budget); +static void igc_isc_rxd_flush(void *arg, uint16_t rxqid, uint8_t flid __unused, + qidx_t pidx); +static int igc_isc_rxd_available(void *arg, uint16_t rxqid, qidx_t idx, + qidx_t budget); static int igc_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri); -static int igc_tx_ctx_setup(struct tx_ring *txr, if_pkt_info_t pi, u32 *cmd_type_len, u32 *olinfo_status); -static int igc_tso_setup(struct tx_ring *txr, if_pkt_info_t pi, u32 *cmd_type_len, u32 *olinfo_status); +static int igc_tx_ctx_setup(struct tx_ring *txr, if_pkt_info_t pi, + uint32_t *cmd_type_len, uint32_t *olinfo_status); +static int igc_tso_setup(struct tx_ring *txr, if_pkt_info_t pi, + uint32_t *cmd_type_len, uint32_t *olinfo_status); -static void igc_rx_checksum(u32 staterr, if_rxd_info_t ri, u32 ptype); -static int igc_determine_rsstype(u16 pkt_info); +static void igc_rx_checksum(uint32_t staterr, if_rxd_info_t ri, uint32_t ptype); +static int igc_determine_rsstype(uint16_t pkt_info); extern void igc_if_enable_intr(if_ctx_t ctx); extern int igc_intr(void *arg); @@ -119,12 +123,13 @@ igc_dump_rs(struct igc_adapter *adapter) * **********************************************************************/ static int -igc_tso_setup(struct tx_ring *txr, if_pkt_info_t pi, u32 *cmd_type_len, u32 *olinfo_status) +igc_tso_setup(struct tx_ring *txr, if_pkt_info_t pi, uint32_t *cmd_type_len, + uint32_t *olinfo_status) { struct igc_adv_tx_context_desc *TXD; - 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: @@ -179,11 +184,12 @@ igc_tso_setup(struct tx_ring *txr, if_pkt_info_t pi, u32 *cmd_type_len, u32 *oli * **********************************************************************/ static int -igc_tx_ctx_setup(struct tx_ring *txr, if_pkt_info_t pi, u32 *cmd_type_len, u32 *olinfo_status) +igc_tx_ctx_setup(struct tx_ring *txr, if_pkt_info_t pi, uint32_t *cmd_type_len, + uint32_t *olinfo_status) { struct igc_adv_tx_context_desc *TXD; - u32 vlan_macip_lens, type_tucmd_mlhl; - u32 mss_l4len_idx; + 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 */ @@ -242,7 +248,7 @@ igc_tx_ctx_setup(struct tx_ring *txr, if_pkt_info_t pi, u32 *cmd_type_len, u32 * type_tucmd_mlhl |= IGC_ADVTXD_TUCMD_L4T_SCTP; *olinfo_status |= IGC_TXD_POPTS_TXSM << 8; } - break; + break; default: break; } @@ -267,7 +273,7 @@ igc_isc_txd_encap(void *arg, if_pkt_info_t pi) bus_dma_segment_t *segs = pi->ipi_segs; union igc_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; @@ -422,7 +428,7 @@ igc_isc_rxd_available(void *arg, uint16_t rxqid, qidx_t idx, qidx_t budget) struct igc_rx_queue *que = &sc->rx_queues[rxqid]; struct rx_ring *rxr = &que->rxr; union igc_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;) { @@ -453,16 +459,15 @@ igc_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) if_softc_ctx_t scctx = adapter->shared; struct igc_rx_queue *que = &adapter->rx_queues[ri->iri_qsidx]; struct rx_ring *rxr = &que->rxr; - struct ifnet *ifp = iflib_get_ifp(adapter->ctx); union igc_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 igc_adv_rx_desc *)&rxr->rx_base[cidx]; @@ -507,14 +512,15 @@ igc_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) igc_rx_checksum(staterr, ri, ptype); - if ((ifp->if_capenable & IFCAP_VLAN_HWTAGGING) != 0 && + if ((scctx->isc_capenable & IFCAP_VLAN_HWTAGGING) != 0 && (staterr & IGC_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 = igc_determine_rsstype(pkt_info); @@ -531,26 +537,34 @@ igc_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) * *********************************************************************/ static void -igc_rx_checksum(u32 staterr, if_rxd_info_t ri, u32 ptype) +igc_rx_checksum(uint32_t staterr, if_rxd_info_t ri, uint32_t ptype) { - u16 status = (u16)staterr; - u8 errors = (u8) (staterr >> 24); + uint16_t status = (uint16_t)staterr; + uint8_t errors = (uint8_t)(staterr >> 24); - /* Ignore Checksum bit is set */ - if (status & IGC_RXD_STAT_IXSM) { - ri->iri_csum_flags = 0; + if (__predict_false(status & IGC_RXD_STAT_IXSM)) return; - } - if (status & (IGC_RXD_STAT_TCPCS | IGC_RXD_STAT_UDPCS)) { - u64 type = (CSUM_DATA_VALID | CSUM_PSEUDO_HDR); - /* Did it pass? */ - if (!(errors & IGC_RXD_ERR_TCPE)) { - ri->iri_csum_flags |= type; + /* If there is a layer 3 or 4 error we are done */ + if (__predict_false(errors & (IGC_RXD_ERR_IPE | IGC_RXD_ERR_TCPE))) + return; + + /* IP Checksum Good */ + if (status & IGC_RXD_STAT_IPCS) + ri->iri_csum_flags = (CSUM_IP_CHECKED | CSUM_IP_VALID); + + /* Valid L4E checksum */ + if (__predict_true(status & + (IGC_RXD_STAT_TCPCS | IGC_RXD_STAT_UDPCS))) { + /* SCTP header present */ + if (__predict_false((ptype & IGC_RXDADV_PKTTYPE_ETQF) == 0 && + (ptype & IGC_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 +573,7 @@ igc_rx_checksum(u32 staterr, if_rxd_info_t ri, u32 ptype) * ******************************************************************/ static int -igc_determine_rsstype(u16 pkt_info) +igc_determine_rsstype(uint16_t pkt_info) { switch (pkt_info & IGC_RXDADV_RSSTYPE_MASK) { case IGC_RXDADV_RSSTYPE_IPV4_TCP: From owner-dev-commits-src-all@freebsd.org Sat Jul 31 15:05: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 DD99565FC09; Sat, 31 Jul 2021 15:05: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 4GcSJ05jkVz4dvH; Sat, 31 Jul 2021 15:05: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 AC4CA1ACD5; Sat, 31 Jul 2021 15:05: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 16VF5aBV027639; Sat, 31 Jul 2021 15:05:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16VF5aPE027638; Sat, 31 Jul 2021 15:05:36 GMT (envelope-from git) Date: Sat, 31 Jul 2021 15:05:36 GMT Message-Id: <202107311505.16VF5aPE027638@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: ff01d6343f1f - main - 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/main X-Git-Reftype: branch X-Git-Commit: ff01d6343f1f0c6550e4072eddda91dabd366d09 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, 31 Jul 2021 15:05:36 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=ff01d6343f1f0c6550e4072eddda91dabd366d09 commit ff01d6343f1f0c6550e4072eddda91dabd366d09 Author: Kevin Bowling AuthorDate: 2021-07-31 15:04:25 +0000 Commit: Kevin Bowling CommitDate: 2021-07-31 15:04:25 +0000 igb: clean up igb_txrx comments Reviewed by: grehan MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D31227 --- 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 Sat Jul 31 15:37: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 AD43D65FF50; Sat, 31 Jul 2021 15:37:58 +0000 (UTC) (envelope-from kp@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 4GcT1L4Gl0z4g3T; Sat, 31 Jul 2021 15:37:58 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from venus.codepro.be (venus.codepro.be [5.9.86.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.codepro.be", Issuer "R3" (verified OK)) (Authenticated sender: kp) by smtp.freebsd.org (Postfix) with ESMTPSA id 6184A7A8D; Sat, 31 Jul 2021 15:37:58 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: by venus.codepro.be (Postfix, authenticated sender kp) id AAFA8154AC; Sat, 31 Jul 2021 17:37:56 +0200 (CEST) From: "Kristof Provost" To: "Warner Losh" Cc: "Warner Losh" , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-branches@freebsd.org Subject: Re: git: 6edf5082bab7 - stable/12 - one-true-awk: import 20210221 (1e4bc42c53a1) which fixes a number of bugs Date: Sat, 31 Jul 2021 17:37:55 +0200 X-Mailer: MailMate (1.13.2r5673) Message-ID: <8300183E-DD11-4C2F-AE5A-0B6FDE6E9E8F@FreeBSD.org> In-Reply-To: References: <202107101712.16AHCwoE088447@gitrepo.freebsd.org> <4AD3AB8C-A960-43BE-A89B-5D9C4CD077DD@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: quoted-printable X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-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, 31 Jul 2021 15:37:58 -0000 On 31 Jul 2021, at 16:20, Warner Losh wrote: > On Sat, Jul 31, 2021 at 8:07 AM Warner Losh wrote: > >> >> >> On Sat, Jul 31, 2021 at 3:11 AM Kristof Provost = >> wrote: >> >>> Hi Warner, >>> >>> On 10 Jul 2021, at 19:12, Warner Losh wrote: >>> >>> The branch stable/12 has been updated by imp: >>> >>> URL: >>> https://cgit.FreeBSD.org/src/commit/?id=3D6edf5082bab71cf923efff9f18e= 38efe5b83b0ec >>> >>> commit 6edf5082bab71cf923efff9f18e38efe5b83b0ec >>> Author: Warner Losh >>> AuthorDate: 2021-07-07 23:30:35 +0000 >>> Commit: Warner Losh >>> CommitDate: 2021-07-10 17:11:15 +0000 >>> >>> one-true-awk: import 20210221 (1e4bc42c53a1) which fixes a number of = >>> bugs >>> >>> Import the latest bsd-features branch of the one-true-awk upstream: >>> >>> o Move to bison for $YACC >>> o Set close-on-exec flag for file and pipe redirects that aren't = >>> std* >>> o lots of little fixes to modernize ocde base >>> o free sval member before setting it >>> o fix a bug where a{0,3} could match aaaa >>> o pull in systime and strftime from NetBSD awk >>> o pull in fixes from {Net,Free,Open}BSD (normalized our code with = >>> them) >>> o add BSD extensions and, or, xor, compl, lsheift, rshift (mostly a = >>> nop) >>> >>> Also revert a few of the trivial FreeBSD changes that were done = >>> slightly >>> differently in the upstreaming process. Also, our PR database may = >>> have >>> been mined by upstream for these fixes, and Mikolaj Golub may = >>> deserve >>> credit for some of the fixes in this update. >>> >>> Suggested by: Mikolaj Golub >>> PR: 143363,143365,143368,143369,143373,143375,214782 >>> Sponsored by: Netflix >>> >>> (cherry picked from commit f39dd6a9784467f0db5886012b3f4b13899be6b8) >>> >>> I *think* this is the relevant commit, but I=E2=80=99m not 100% sure.= >>> >>> Anyway, I=E2=80=99ve recently started seeing issues building pfSense = for = >>> aarch64. >>> I=E2=80=99ve finally narrowed it down, and replicated the problem on = base = >>> FreeBSD >>> (stable/12, but I assume other branches are affected too). >>> >>> It fails to build proctab.c. This file is generated by maketab, a = >>> tool >>> built as part of the build process. In my case this tool is built = >>> for >>> aarch64, which makes executing it on amd64 less successful than = >>> we=E2=80=99d like. >>> >>> This only happens when building with META_MODE though. I do not >>> understand the build system sufficiently to debug why. Hopefully = >>> you=E2=80=99ll >>> have a better idea. >>> >> Generally I do, but this one is a bit weird. Also, the amount of = >> context >> you've included omits the actual error :( Though I'm guessing it's = >> wrong >> arch for the build tool... >> >> I rarely use meta mode, and understand it not at all, but awk follows = >> the >> same patterns as /bin/sh and /bin/csh does >> > > [[ stupid gmail ]] > > I've just pushed removal of proctab.c. That may fix this, though I'm = > not > hopeful. Unfortunately that didn=E2=80=99t help. > I've rarely used metamode, and not for quite some time, but this > an extra file that would confuse things so that maketab might not be = > built > during build-tools and instead is built later. Please give that a try, = > and > I'll start a meta build, but that takes a while, not least because I = > have > to re-leran how to do that :) > I=E2=80=99ve posted my build log and the proctab.c.meta and maketab.meta = files = on https://people.freebsd.org/~kp/meta/ I=E2=80=99m a little confused by maketab.meta, because what=E2=80=99s in = the meta = file doesn=E2=80=99t seem to match the build command seen in the metamode= =2Elog = file. Best regards, Kristof From owner-dev-commits-src-all@freebsd.org Sat Jul 31 17:28: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 F2B93661B21 for ; Sat, 31 Jul 2021 17:28:33 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qv1-xf36.google.com (mail-qv1-xf36.google.com [IPv6:2607:f8b0:4864:20::f36]) (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 4GcWSx5xXQz4mHk for ; Sat, 31 Jul 2021 17:28:33 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qv1-xf36.google.com with SMTP id m12so6287733qvt.1 for ; Sat, 31 Jul 2021 10:28:33 -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=ZVe9EjNfIuGlRbgqt3pyhcHYsK+8Lz9AFbp1LhKyR+k=; b=piOGmEF7OU0+U1xP7YdobbOrI0qM9GAtvJqxBnW4OEz/TXMl5nWnAPIrIeKNp/BecX FNotTmpfcja4jEG2mPbF4Ybjdl+jxyPypunlZwSRIoDqHlnc6/utZfMS9aJOdn0aRsjE l8qINuV0GlwzFuhd5P2kngpp5T5jlplTgvXAeOOIGidnce0rki7nAAOCiRtTcHiR/oTP OG3noM86I1mnOOagvZxFt9beUBd+yy7AVEn4LRk8pI/2vwS+G4coFkGq5dZmlSTHha5d 1hG1yko3sH0a8Qx98lHI+XY8LcfCG3NRNw2jHwi9eItbkYDNuB+weP3NbBsGzWhqz2SQ XI+w== 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=ZVe9EjNfIuGlRbgqt3pyhcHYsK+8Lz9AFbp1LhKyR+k=; b=pR8AdtSPfeUdyUSujeiIwWoavBLfIsW4OO8jeMxH52MeJVtsgmsuLSsVRXAQKEQLcO HbWUiOppQsxQ7c5B2oLUM42OkQ6iOJECH32JkaUBgUkV3FHLybJDwKG2jlovBZLYjOqy 1FkwEzsa0i96vtH9LrpOlrXuPvGV1mlCL4MULcPwcRSi9hSN+YjOwkBkNAP0D1l5ekex H6QPDHNJaN3hrq71x7l4J/Z4L+HCcJ9vqrIOORq25oXFysKnK+nA1INocqVANuQVlKXD 1yDanPipaDL1BAwgRKSJqIX8k/XHWFPT23RcpYIP+HLvOoonMfHJ90YAndjaVMgNRVY5 /fdg== X-Gm-Message-State: AOAM531FOiV78a7fMvE2+VRFDfHfwSZdgb5/5DvhoYB+sDdknw1TBPsx /rYacMrIIVeoh6t2dI6IXnX+/9/w6JqiDsKMQbEcxw== X-Google-Smtp-Source: ABdhPJw/Z2CK47hSZJ+9xuPJ8QbULhlx6X9TiWoAaOkU7FmlJj6pbbWK5RfSOaOu33uPbPg13NFaZPwdv+PGxBd7k14= X-Received: by 2002:a05:6214:17cb:: with SMTP id cu11mr8984194qvb.28.1627752513386; Sat, 31 Jul 2021 10:28:33 -0700 (PDT) MIME-Version: 1.0 References: <202107101712.16AHCwoE088447@gitrepo.freebsd.org> <4AD3AB8C-A960-43BE-A89B-5D9C4CD077DD@FreeBSD.org> <8300183E-DD11-4C2F-AE5A-0B6FDE6E9E8F@FreeBSD.org> In-Reply-To: <8300183E-DD11-4C2F-AE5A-0B6FDE6E9E8F@FreeBSD.org> From: Warner Losh Date: Sat, 31 Jul 2021 11:28:22 -0600 Message-ID: Subject: Re: git: 6edf5082bab7 - stable/12 - one-true-awk: import 20210221 (1e4bc42c53a1) which fixes a number of bugs To: Kristof Provost Cc: Warner Losh , src-committers , "" , dev-commits-src-branches@freebsd.org X-Rspamd-Queue-Id: 4GcWSx5xXQz4mHk 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" 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: Sat, 31 Jul 2021 17:28:34 -0000 On Sat, Jul 31, 2021 at 9:37 AM Kristof Provost wrote: > On 31 Jul 2021, at 16:20, Warner Losh wrote: > > On Sat, Jul 31, 2021 at 8:07 AM Warner Losh wrote: > > > >> > >> > >> On Sat, Jul 31, 2021 at 3:11 AM Kristof Provost > >> wrote: > >> > >>> Hi Warner, > >>> > >>> On 10 Jul 2021, at 19:12, Warner Losh wrote: > >>> > >>> The branch stable/12 has been updated by imp: > >>> > >>> URL: > >>> > https://cgit.FreeBSD.org/src/commit/?id=3D6edf5082bab71cf923efff9f18e38ef= e5b83b0ec > >>> > >>> commit 6edf5082bab71cf923efff9f18e38efe5b83b0ec > >>> Author: Warner Losh > >>> AuthorDate: 2021-07-07 23:30:35 +0000 > >>> Commit: Warner Losh > >>> CommitDate: 2021-07-10 17:11:15 +0000 > >>> > >>> one-true-awk: import 20210221 (1e4bc42c53a1) which fixes a number of > >>> bugs > >>> > >>> Import the latest bsd-features branch of the one-true-awk upstream: > >>> > >>> o Move to bison for $YACC > >>> o Set close-on-exec flag for file and pipe redirects that aren't > >>> std* > >>> o lots of little fixes to modernize ocde base > >>> o free sval member before setting it > >>> o fix a bug where a{0,3} could match aaaa > >>> o pull in systime and strftime from NetBSD awk > >>> o pull in fixes from {Net,Free,Open}BSD (normalized our code with > >>> them) > >>> o add BSD extensions and, or, xor, compl, lsheift, rshift (mostly a > >>> nop) > >>> > >>> Also revert a few of the trivial FreeBSD changes that were done > >>> slightly > >>> differently in the upstreaming process. Also, our PR database may > >>> have > >>> been mined by upstream for these fixes, and Mikolaj Golub may > >>> deserve > >>> credit for some of the fixes in this update. > >>> > >>> Suggested by: Mikolaj Golub > >>> PR: 143363,143365,143368,143369,143373,143375,214782 > >>> Sponsored by: Netflix > >>> > >>> (cherry picked from commit f39dd6a9784467f0db5886012b3f4b13899be6b8) > >>> > >>> I *think* this is the relevant commit, but I=E2=80=99m not 100% sure. > >>> > >>> Anyway, I=E2=80=99ve recently started seeing issues building pfSense = for > >>> aarch64. > >>> I=E2=80=99ve finally narrowed it down, and replicated the problem on = base > >>> FreeBSD > >>> (stable/12, but I assume other branches are affected too). > >>> > >>> It fails to build proctab.c. This file is generated by maketab, a > >>> tool > >>> built as part of the build process. In my case this tool is built > >>> for > >>> aarch64, which makes executing it on amd64 less successful than > >>> we=E2=80=99d like. > >>> > >>> This only happens when building with META_MODE though. I do not > >>> understand the build system sufficiently to debug why. Hopefully > >>> you=E2=80=99ll > >>> have a better idea. > >>> > >> Generally I do, but this one is a bit weird. Also, the amount of > >> context > >> you've included omits the actual error :( Though I'm guessing it's > >> wrong > >> arch for the build tool... > >> > >> I rarely use meta mode, and understand it not at all, but awk follows > >> the > >> same patterns as /bin/sh and /bin/csh does > >> > > > > [[ stupid gmail ]] > > > > I've just pushed removal of proctab.c. That may fix this, though I'm > > not > > hopeful. > Unfortunately that didn=E2=80=99t help. > > > I've rarely used metamode, and not for quite some time, but this > > an extra file that would confuse things so that maketab might not be > > built > > during build-tools and instead is built later. Please give that a try, > > and > > I'll start a meta build, but that takes a while, not least because I > > have > > to re-leran how to do that :) > > > I=E2=80=99ve posted my build log and the proctab.c.meta and maketab.meta = files > on https://people.freebsd.org/~kp/meta/ > > I=E2=80=99m a little confused by maketab.meta, because what=E2=80=99s in = the meta > file doesn=E2=80=99t seem to match the build command seen in the metamode= .log > file. > Yea. It's getting confused and rebuilding it bogusly. For the mknodes in sh, we don't see the naked cc command, but we do for maketab. I'm testing a fix right now, though, and we'll see if that fixes things. I think I know what's going on. Warner From owner-dev-commits-src-all@freebsd.org Sat Jul 31 18:06: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 1043F66238E; Sat, 31 Jul 2021 18:06: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 4GcXJd6ngXz4pBn; Sat, 31 Jul 2021 18:06: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 D177B1D62E; Sat, 31 Jul 2021 18:06: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 16VI6PgI066209; Sat, 31 Jul 2021 18:06:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16VI6PeP066208; Sat, 31 Jul 2021 18:06:25 GMT (envelope-from git) Date: Sat, 31 Jul 2021 18:06:25 GMT Message-Id: <202107311806.16VI6PeP066208@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: 1dfb6e5d1f46 - stable/12 - awk: merge fixes to metamode 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/12 X-Git-Reftype: branch X-Git-Commit: 1dfb6e5d1f462af4f4df818ee93766f09f3aa787 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, 31 Jul 2021 18:06:26 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=1dfb6e5d1f462af4f4df818ee93766f09f3aa787 commit 1dfb6e5d1f462af4f4df818ee93766f09f3aa787 Author: Warner Losh AuthorDate: 2021-07-31 17:57:21 +0000 Commit: Warner Losh CommitDate: 2021-07-31 18:05:34 +0000 awk: merge fixes to metamode This is a partial MFC of c63c5ab001106/r349062. The whole thing doesn't apply cleanly, but this bit, at least, is needed to fix metamode on stable/12 after the changes to awk were merged from head. Rather than risk breaking other things, I'm just merging the bit I know that's needed. All build tools need to be in DEPENDOBJ so the dependency order is correct and they get built with host tools. Reported by: kp Sponsored by: Netflix --- usr.bin/awk/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/usr.bin/awk/Makefile b/usr.bin/awk/Makefile index d31e811bbec5..82de7d56a415 100644 --- a/usr.bin/awk/Makefile +++ b/usr.bin/awk/Makefile @@ -25,6 +25,7 @@ awkgram.tab.h: awkgram.h proctab.c: maketab ${BTOOLSPATH:U.}/maketab awkgram.h > proctab.c +DEPENDOBJS+= maketab build-tools: maketab maketab: awkgram.tab.h maketab.c ${BUILD_TOOLS_META} From owner-dev-commits-src-all@freebsd.org Sat Jul 31 18:08: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 5025C6624AE for ; Sat, 31 Jul 2021 18:08:19 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk1-x729.google.com (mail-qk1-x729.google.com [IPv6:2607:f8b0:4864:20::729]) (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 4GcXLp2RFzz4pCJ for ; Sat, 31 Jul 2021 18:08:18 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x729.google.com with SMTP id t66so12798330qkb.0 for ; Sat, 31 Jul 2021 11:08:18 -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=X3LmiCM4sHpwWMFEZobq0F67XDchpsF8RWPfdPhJ9fg=; b=piwCWbI+A63tVsHgYAQP/eKD0jDEkEfXv5e7DXVoYOUSmuwlPmJztocDRnizW0c4k2 VDTb85LAnlRti3/eBnzL2j+vU+AFiNjIdvXtLcfZcJEG8vconqrip9jYvW9Je6b14GXF 1t5ORtUrbjIz/sucSqpeyb+iAvy+dEavHzq511/9334mX6MBn0k3jeVkgbR0mJ3sCnj/ bWOk2JcrLcwgfWiuv4lE8FN8VW4d7kpP+c2RR6PlB7vhljXgEMQvOEXHUwvDucvamJwb BUK7MHvG1wtJOLbUyfjrEclv/nnwDigL4WFwFjwVNydjStzIsrwPxzGJEfY7qOhuUtdD wmEw== 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=X3LmiCM4sHpwWMFEZobq0F67XDchpsF8RWPfdPhJ9fg=; b=MwHGTQCI9a9nflxkArN0pwoVVSbKn1UUwPEI4kK6uzEhZSfzPD758masbkdyamcPiA nPciEDgeuKsS1VIaV7dZ5IrJ7tnFa17A5CvMgM39aLMTmntpqcW5osIkkg7YBQszcazw ZBK1MI0jyUjQIPmYtjwNf9XfrPiZfL0KdukUNHPbfpNQTrRBgseb2owbr//icd7+e335 Q4LKMZqkt5+n6l/1nGMTbb0oEIsyxaum5NCx1gFTegd/ZLdDkjsiGT3MRFZJ0o700Upx i0cc5INz7wIoIPJxXgA8fP8goFzBvvda+IX6vm0PdJdHNMWsY15Yy83jUNdp01AI5CPl TcVw== X-Gm-Message-State: AOAM530gMhcjn4m+gNfbxfN7mDH9SyED0aJI2YcgHrApxQVs1LTQQXOm qKc/XWDpYx/FIyolonMQJpALHjqnmHCilHUSuSI04A== X-Google-Smtp-Source: ABdhPJyG+p5RGwkOt9CeYKjYu/Ceejo6vjTaPNHa0CzthB39Q2VGRjjm1V3/pNCTjMiW9Q/iO9ELlmz4yU326RzTzxE= X-Received: by 2002:a05:620a:5f6:: with SMTP id z22mr7962507qkg.195.1627754892042; Sat, 31 Jul 2021 11:08:12 -0700 (PDT) MIME-Version: 1.0 References: <202107101712.16AHCwoE088447@gitrepo.freebsd.org> <4AD3AB8C-A960-43BE-A89B-5D9C4CD077DD@FreeBSD.org> <8300183E-DD11-4C2F-AE5A-0B6FDE6E9E8F@FreeBSD.org> In-Reply-To: From: Warner Losh Date: Sat, 31 Jul 2021 12:08:01 -0600 Message-ID: Subject: Re: git: 6edf5082bab7 - stable/12 - one-true-awk: import 20210221 (1e4bc42c53a1) which fixes a number of bugs To: Kristof Provost Cc: Warner Losh , src-committers , "" , dev-commits-src-branches@freebsd.org X-Rspamd-Queue-Id: 4GcXLp2RFzz4pCJ X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=piwCWbI+; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::729) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-3.00 / 15.00]; RCVD_TLS_ALL(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[dev-commits-src-all@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; RCPT_COUNT_FIVE(0.00)[5]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; NEURAL_HAM_SHORT(-1.00)[-0.997]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::729:from]; R_SPF_NA(0.00)[no SPF record]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; MAILMAN_DEST(0.00)[dev-commits-src-all]; RCVD_COUNT_TWO(0.00)[2] 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: Sat, 31 Jul 2021 18:08:19 -0000 On Sat, Jul 31, 2021 at 11:28 AM Warner Losh wrote: > > > On Sat, Jul 31, 2021 at 9:37 AM Kristof Provost wrote: > >> On 31 Jul 2021, at 16:20, Warner Losh wrote: >> > On Sat, Jul 31, 2021 at 8:07 AM Warner Losh wrote: >> > >> >> >> >> >> >> On Sat, Jul 31, 2021 at 3:11 AM Kristof Provost >> >> wrote: >> >> >> >>> Hi Warner, >> >>> >> >>> On 10 Jul 2021, at 19:12, Warner Losh wrote: >> >>> >> >>> The branch stable/12 has been updated by imp: >> >>> >> >>> URL: >> >>> >> https://cgit.FreeBSD.org/src/commit/?id=3D6edf5082bab71cf923efff9f18e38e= fe5b83b0ec >> >>> >> >>> commit 6edf5082bab71cf923efff9f18e38efe5b83b0ec >> >>> Author: Warner Losh >> >>> AuthorDate: 2021-07-07 23:30:35 +0000 >> >>> Commit: Warner Losh >> >>> CommitDate: 2021-07-10 17:11:15 +0000 >> >>> >> >>> one-true-awk: import 20210221 (1e4bc42c53a1) which fixes a number of >> >>> bugs >> >>> >> >>> Import the latest bsd-features branch of the one-true-awk upstream: >> >>> >> >>> o Move to bison for $YACC >> >>> o Set close-on-exec flag for file and pipe redirects that aren't >> >>> std* >> >>> o lots of little fixes to modernize ocde base >> >>> o free sval member before setting it >> >>> o fix a bug where a{0,3} could match aaaa >> >>> o pull in systime and strftime from NetBSD awk >> >>> o pull in fixes from {Net,Free,Open}BSD (normalized our code with >> >>> them) >> >>> o add BSD extensions and, or, xor, compl, lsheift, rshift (mostly a >> >>> nop) >> >>> >> >>> Also revert a few of the trivial FreeBSD changes that were done >> >>> slightly >> >>> differently in the upstreaming process. Also, our PR database may >> >>> have >> >>> been mined by upstream for these fixes, and Mikolaj Golub may >> >>> deserve >> >>> credit for some of the fixes in this update. >> >>> >> >>> Suggested by: Mikolaj Golub >> >>> PR: 143363,143365,143368,143369,143373,143375,214782 >> >>> Sponsored by: Netflix >> >>> >> >>> (cherry picked from commit f39dd6a9784467f0db5886012b3f4b13899be6b8) >> >>> >> >>> I *think* this is the relevant commit, but I=E2=80=99m not 100% sure= . >> >>> >> >>> Anyway, I=E2=80=99ve recently started seeing issues building pfSense= for >> >>> aarch64. >> >>> I=E2=80=99ve finally narrowed it down, and replicated the problem on= base >> >>> FreeBSD >> >>> (stable/12, but I assume other branches are affected too). >> >>> >> >>> It fails to build proctab.c. This file is generated by maketab, a >> >>> tool >> >>> built as part of the build process. In my case this tool is built >> >>> for >> >>> aarch64, which makes executing it on amd64 less successful than >> >>> we=E2=80=99d like. >> >>> >> >>> This only happens when building with META_MODE though. I do not >> >>> understand the build system sufficiently to debug why. Hopefully >> >>> you=E2=80=99ll >> >>> have a better idea. >> >>> >> >> Generally I do, but this one is a bit weird. Also, the amount of >> >> context >> >> you've included omits the actual error :( Though I'm guessing it's >> >> wrong >> >> arch for the build tool... >> >> >> >> I rarely use meta mode, and understand it not at all, but awk follows >> >> the >> >> same patterns as /bin/sh and /bin/csh does >> >> >> > >> > [[ stupid gmail ]] >> > >> > I've just pushed removal of proctab.c. That may fix this, though I'm >> > not >> > hopeful. >> Unfortunately that didn=E2=80=99t help. >> >> > I've rarely used metamode, and not for quite some time, but this >> > an extra file that would confuse things so that maketab might not be >> > built >> > during build-tools and instead is built later. Please give that a try, >> > and >> > I'll start a meta build, but that takes a while, not least because I >> > have >> > to re-leran how to do that :) >> > >> I=E2=80=99ve posted my build log and the proctab.c.meta and maketab.meta= files >> on https://people.freebsd.org/~kp/meta/ >> >> I=E2=80=99m a little confused by maketab.meta, because what=E2=80=99s in= the meta >> file doesn=E2=80=99t seem to match the build command seen in the metamod= e.log >> file. >> > > Yea. It's getting confused and rebuilding it bogusly. For the mknodes in > sh, we don't see the naked cc command, but we do for maketab. > > I'm testing a fix right now, though, and we'll see if that fixes things. = I > think I know what's going on. > I just pushed 1dfb6e5d1f462af4f4df818ee93766f09f3aa787, which fixed the issues I was seeing. Does that do the trick for you as well? Warner From owner-dev-commits-src-all@freebsd.org Sat Jul 31 18:59: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 29521662D8B; Sat, 31 Jul 2021 18:59: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 4GcYTn5yBvz4rsw; Sat, 31 Jul 2021 18:59: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 B4BE41E107; Sat, 31 Jul 2021 18:59: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 16VIxP2h031857; Sat, 31 Jul 2021 18:59:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16VIxDnn031848; Sat, 31 Jul 2021 18:59:13 GMT (envelope-from git) Date: Sat, 31 Jul 2021 18:59:13 GMT Message-Id: <202107311859.16VIxDnn031848@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dimitry Andric Subject: git: af732203b8f7 - stable/13 - Merge llvm-project 12.0.1 release and follow-up fixes 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/stable/13 X-Git-Reftype: branch X-Git-Commit: af732203b8f7f006927528db5497f5cbc4c4742a 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, 31 Jul 2021 18:59:26 -0000 The branch stable/13 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=af732203b8f7f006927528db5497f5cbc4c4742a commit af732203b8f7f006927528db5497f5cbc4c4742a Author: Dimitry Andric AuthorDate: 2021-06-13 19:31:46 +0000 Commit: Dimitry Andric CommitDate: 2021-07-31 18:56:55 +0000 Merge llvm-project 12.0.1 release and follow-up fixes Merge llvm-project main llvmorg-12-init-17869-g8e464dd76bef This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp to llvmorg-12-init-17869-g8e464dd76bef, the last commit before the upstream release/12.x branch was created. PR: 255570 (cherry picked from commit e8d8bef961a50d4dc22501cde4fb9fb0be1b2532) Merge llvm-project 12.0.0 release This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp to llvmorg-12.0.0-0-gd28af7c654d8, a.k.a. 12.0.0 release. PR: 255570 (cherry picked from commit d409305fa3838fb39b38c26fc085fb729b8766d5) Disable strict-fp for powerpcspe, as it does not work properly yet Merge commit 5c18d1136665 from llvm git (by Qiu Chaofan) [SPE] Disable strict-fp for SPE by default As discussed in PR50385, strict-fp on PowerPC SPE has not been handled well. This patch disables it by default for SPE. Reviewed By: nemanjai, vit9696, jhibbits Differential Revision: https://reviews.llvm.org/D103235 PR: 255570 (cherry picked from commit 715df83abc049b23d9acddc81f2480bd4c056d64) Apply upstream libc++ fix to allow building with devel/xxx-xtoolchain-gcc Merge commit 52e9d80d5db2 from llvm git (by Jason Liu): [libc++] add `inline` for __open's definition in ifstream and ofstream Summary: When building with gcc on AIX, it seems that gcc does not like the `always_inline` without the `inline` keyword. So adding the inline keywords in for __open in ifstream and ofstream. That will also make it consistent with __open in basic_filebuf (it seems we added `inline` there before for gcc build as well). Differential Revision: https://reviews.llvm.org/D99422 PR: 255570 (cherry picked from commit d099db25464b826c5724cf2fb5b22292bbe15f6e) Undefine HAVE_(DE)REGISTER_FRAME in llvm's config.h on arm Otherwise, the lli tool (enable by WITH_CLANG_EXTRAS) won't link on arm, stating that __register_frame is undefined. This function is normally provided by libunwind, but explicitly not for the ARM Exception ABI. Reported by: oh PR: 255570 (cherry picked from commit f336b45e943c7f9a90ffcea1a6c4c7039e54c73c) Merge llvm-project 12.0.1 rc2 This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp to llvmorg-12.0.1-rc2-0-ge7dac564cd0e, a.k.a. 12.0.1 rc2. PR: 255570 (cherry picked from commit 23408297fbf3089f0388a8873b02fa75ab3f5bb9) Revert libunwind change to fix backtrace segfault on aarch64 Revert commit 22b615a96593 from llvm git (by Daniel Kiss): [libunwind] Support for leaf function unwinding. Unwinding leaf function is useful in cases when the backtrace finds a leaf function for example when it caused a signal. This patch also add the support for the DW_CFA_undefined because it marks the end of the frames. Ryan Prichard provided code for the tests. Reviewed By: #libunwind, mstorsjo Differential Revision: https://reviews.llvm.org/D83573 Reland with limit the test to the x86_64-linux target. Bisection has shown that this particular upstream commit causes programs using backtrace(3) on aarch64 to segfault. This affects the lang/rust port, for instance. Until we can upstream to fix this problem, revert the commit for now. Reported by: mikael PR: 256864 (cherry picked from commit 5866c369e4fd917c0d456f0f10b92ee354b82279) Merge llvm-project 12.0.1 release This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp to llvmorg-12.0.1-0-gfed41342a82f, a.k.a. 12.0.1 release. PR: 255570 (cherry picked from commit 4652422eb477731f284b1345afeefef7f269da50) compilert-rt: build out-of-line LSE atomics helpers for aarch64 Both clang >= 12 and gcc >= 10.1 now default to -moutline-atomics for aarch64. This requires a bunch of helper functions in libcompiler_rt.a, to avoid link errors like "undefined symbol: __aarch64_ldadd8_acq_rel". (Note: of course you can use -mno-outline-atomics as a workaround too, but this would negate the potential performance benefit of the faster LSE instructions.) Bump __FreeBSD_version so ports maintainers can easily detect this. PR: 257392 (cherry picked from commit cc55ee8009a550810d38777fd6ace9abf3a2f6b4) --- ObsoleteFiles.inc | 574 +++ contrib/llvm-project/clang/include/clang-c/Index.h | 88 +- .../llvm-project/clang/include/clang-c/Rewrite.h | 63 + .../include/clang/APINotes/APINotesYAMLCompiler.h | 24 + .../clang/include/clang/APINotes/Types.h | 734 +++ .../clang/include/clang/ARCMigrate/FileRemapper.h | 8 + .../llvm-project/clang/include/clang/AST/APValue.h | 163 +- .../clang/include/clang/AST/ASTContext.h | 130 +- .../llvm-project/clang/include/clang/AST/ASTFwd.h | 6 +- .../clang/include/clang/AST/ASTImporter.h | 8 + .../clang/include/clang/AST/ASTNodeTraverser.h | 72 +- .../include/clang/AST/ASTStructuralEquivalence.h | 7 + .../clang/include/clang/AST/ASTTypeTraits.h | 74 +- .../clang/include/clang/AST/AbstractBasicReader.h | 34 + .../clang/include/clang/AST/AbstractBasicWriter.h | 35 + .../llvm-project/clang/include/clang/AST/Attr.h | 39 +- .../clang/include/clang/AST/CXXInheritance.h | 10 - .../clang/AST/CXXRecordDeclDefinitionBits.def | 7 + .../clang/include/clang/AST/CanonicalType.h | 4 +- .../clang/include/clang/AST/CommentLexer.h | 31 +- .../clang/include/clang/AST/ComputeDependence.h | 4 +- .../llvm-project/clang/include/clang/AST/Decl.h | 123 +- .../clang/include/clang/AST/DeclBase.h | 3 +- .../llvm-project/clang/include/clang/AST/DeclCXX.h | 102 +- .../clang/include/clang/AST/DeclObjC.h | 45 +- .../clang/include/clang/AST/DeclOpenMP.h | 246 +- .../clang/include/clang/AST/DeclTemplate.h | 117 +- .../clang/include/clang/AST/DeclarationName.h | 23 +- .../clang/include/clang/AST/DependenceFlags.h | 1 + .../clang/include/clang/AST/DependentDiagnostic.h | 10 +- .../llvm-project/clang/include/clang/AST/Expr.h | 399 +- .../llvm-project/clang/include/clang/AST/ExprCXX.h | 297 +- .../clang/include/clang/AST/ExprConcepts.h | 6 +- .../clang/include/clang/AST/ExprObjC.h | 4 +- .../clang/include/clang/AST/ExternalASTSource.h | 4 - .../clang/include/clang/AST/GlobalDecl.h | 1 + .../clang/include/clang/AST/IgnoreExpr.h | 161 + .../llvm-project/clang/include/clang/AST/Mangle.h | 20 +- .../include/clang/AST/MangleNumberingContext.h | 5 + .../clang/include/clang/AST/NestedNameSpecifier.h | 34 +- .../clang/include/clang/AST/OpenMPClause.h | 494 +- .../clang/include/clang/AST/OperationKinds.def | 11 +- .../clang/include/clang/AST/OptionalDiagnostic.h | 2 +- .../clang/include/clang/AST/ParentMap.h | 4 +- .../clang/include/clang/AST/ParentMapContext.h | 13 +- .../clang/include/clang/AST/PrettyPrinter.h | 40 +- .../clang/include/clang/AST/PropertiesBase.td | 308 ++ .../clang/include/clang/AST/RecordLayout.h | 65 +- .../clang/include/clang/AST/RecursiveASTVisitor.h | 68 +- .../clang/include/clang/AST/Redeclarable.h | 15 + .../llvm-project/clang/include/clang/AST/Stmt.h | 60 +- .../clang/include/clang/AST/StmtIterator.h | 9 +- .../clang/include/clang/AST/StmtOpenMP.h | 1653 +++--- .../clang/include/clang/AST/TemplateBase.h | 72 +- .../clang/include/clang/AST/TemplateName.h | 6 +- .../clang/include/clang/AST/TextNodeDumper.h | 3 + .../llvm-project/clang/include/clang/AST/Type.h | 163 +- .../llvm-project/clang/include/clang/AST/TypeLoc.h | 93 +- .../clang/include/clang/AST/TypeProperties.td | 12 +- .../include/clang/ASTMatchers/ASTMatchFinder.h | 4 + .../clang/include/clang/ASTMatchers/ASTMatchers.h | 574 ++- .../clang/ASTMatchers/ASTMatchersInternal.h | 996 ++-- .../include/clang/ASTMatchers/ASTMatchersMacros.h | 58 +- .../clang/ASTMatchers/Dynamic/VariantValue.h | 40 +- .../clang/Analysis/Analyses/CalledOnceCheck.h | 112 + .../include/clang/Analysis/Analyses/Dominators.h | 70 - .../clang/Analysis/Analyses/LiveVariables.h | 18 +- .../include/clang/Analysis/Analyses/ThreadSafety.h | 8 + .../clang/Analysis/Analyses/ThreadSafetyTIL.h | 4 +- .../clang/include/clang/Analysis/CallGraph.h | 4 +- .../clang/include/clang/Analysis/IssueHash.h | 49 + .../clang/include/clang/Analysis/PathDiagnostic.h | 39 + .../clang/include/clang/Basic/AddressSpaces.h | 2 + .../clang/include/clang/Basic/AlignedAllocation.h | 2 + .../llvm-project/clang/include/clang/Basic/Attr.td | 286 +- .../clang/include/clang/Basic/AttrDocs.td | 1102 +++- .../clang/include/clang/Basic/Builtins.def | 58 + .../clang/include/clang/Basic/BuiltinsAArch64.def | 11 + .../clang/include/clang/Basic/BuiltinsAMDGPU.def | 6 + .../clang/include/clang/Basic/BuiltinsBPF.def | 8 +- .../clang/include/clang/Basic/BuiltinsNVPTX.def | 2 +- .../clang/include/clang/Basic/BuiltinsPPC.def | 236 +- .../include/clang/Basic/BuiltinsWebAssembly.def | 136 +- .../clang/include/clang/Basic/BuiltinsX86.def | 51 +- .../clang/include/clang/Basic/BuiltinsX86_64.def | 11 + .../clang/include/clang/Basic/CodeGenOptions.def | 53 +- .../clang/include/clang/Basic/CodeGenOptions.h | 52 +- .../llvm-project/clang/include/clang/Basic/Cuda.h | 8 + .../clang/include/clang/Basic/DebugInfoOptions.h | 6 +- .../clang/include/clang/Basic/DeclNodes.td | 1 + .../clang/include/clang/Basic/Diagnostic.h | 408 +- .../clang/include/clang/Basic/Diagnostic.td | 10 + .../clang/include/clang/Basic/DiagnosticAST.h | 2 +- .../include/clang/Basic/DiagnosticASTKinds.td | 11 +- .../clang/include/clang/Basic/DiagnosticAnalysis.h | 2 +- .../clang/include/clang/Basic/DiagnosticComment.h | 2 +- .../include/clang/Basic/DiagnosticCommonKinds.td | 6 + .../clang/include/clang/Basic/DiagnosticCrossTU.h | 2 +- .../clang/include/clang/Basic/DiagnosticDriver.h | 2 +- .../include/clang/Basic/DiagnosticDriverKinds.td | 39 +- .../clang/include/clang/Basic/DiagnosticFrontend.h | 2 +- .../include/clang/Basic/DiagnosticFrontendKinds.td | 22 +- .../clang/include/clang/Basic/DiagnosticGroups.td | 46 +- .../clang/include/clang/Basic/DiagnosticIDs.h | 12 +- .../clang/include/clang/Basic/DiagnosticLex.h | 2 +- .../include/clang/Basic/DiagnosticLexKinds.td | 9 +- .../include/clang/Basic/DiagnosticOptions.def | 1 + .../clang/include/clang/Basic/DiagnosticOptions.h | 12 + .../clang/include/clang/Basic/DiagnosticParse.h | 2 +- .../include/clang/Basic/DiagnosticParseKinds.td | 86 +- .../include/clang/Basic/DiagnosticRefactoring.h | 2 +- .../clang/include/clang/Basic/DiagnosticSema.h | 2 +- .../include/clang/Basic/DiagnosticSemaKinds.td | 386 +- .../include/clang/Basic/DiagnosticSerialization.h | 2 +- .../clang/Basic/DiagnosticSerializationKinds.td | 19 +- .../clang/include/clang/Basic/DirectoryEntry.h | 298 ++ .../clang/include/clang/Basic/FPOptions.def | 4 +- .../clang/include/clang/Basic/Features.def | 3 + .../clang/include/clang/Basic/FileEntry.h | 406 ++ .../clang/include/clang/Basic/FileManager.h | 158 +- .../llvm-project/clang/include/clang/Basic/LLVM.h | 1 + .../clang/include/clang/Basic/LangOptions.def | 42 +- .../clang/include/clang/Basic/LangOptions.h | 165 +- .../clang/include/clang/Basic/LangStandard.h | 14 +- .../clang/include/clang/Basic/LangStandards.def | 14 + .../clang/include/clang/Basic/Module.h | 55 +- .../clang/include/clang/Basic/OpenCLExtensions.def | 142 +- .../clang/include/clang/Basic/OpenCLOptions.h | 213 +- .../clang/include/clang/Basic/OpenMPKinds.def | 20 +- .../clang/include/clang/Basic/OpenMPKinds.h | 23 +- .../clang/include/clang/Basic/OperatorKinds.h | 5 + .../clang/include/clang/Basic/PPCTypes.def | 38 + .../clang/include/clang/Basic/PartialDiagnostic.h | 277 +- .../clang/include/clang/Basic/ProfileList.h | 58 + .../clang/include/clang/Basic/Sanitizers.def | 4 +- .../clang/include/clang/Basic/SourceLocation.h | 31 + .../clang/include/clang/Basic/SourceManager.h | 1022 ++-- .../clang/include/clang/Basic/Specifiers.h | 34 +- .../clang/include/clang/Basic/TargetCXXABI.h | 25 +- .../clang/include/clang/Basic/TargetID.h | 56 + .../clang/include/clang/Basic/TargetInfo.h | 78 +- .../clang/include/clang/Basic/TargetOptions.h | 8 +- .../clang/include/clang/Basic/TokenKinds.def | 17 +- .../clang/include/clang/Basic/arm_mve.td | 12 +- .../clang/include/clang/Basic/arm_mve_defs.td | 8 +- .../clang/include/clang/Basic/arm_neon.td | 73 +- .../clang/include/clang/CodeGen/BackendUtil.h | 5 - .../clang/include/clang/CodeGen/CGFunctionInfo.h | 60 +- .../clang/include/clang/Driver/Compilation.h | 17 + .../clang/include/clang/Driver/Distro.h | 17 +- .../clang/include/clang/Driver/Driver.h | 4 +- .../llvm-project/clang/include/clang/Driver/Job.h | 29 +- .../clang/include/clang/Driver/Options.h | 8 +- .../clang/include/clang/Driver/Options.td | 3043 ++++++++---- .../clang/include/clang/Driver/SanitizerArgs.h | 5 +- .../clang/include/clang/Driver/ToolChain.h | 32 +- .../clang/include/clang/Driver/XRayArgs.h | 2 + .../clang/include/clang/Edit/EditedSource.h | 2 +- .../clang/include/clang/Format/Format.h | 1081 +++- .../clang/include/clang/Frontend/ASTUnit.h | 18 +- .../include/clang/Frontend/CompilerInstance.h | 68 +- .../include/clang/Frontend/CompilerInvocation.h | 22 +- .../clang/include/clang/Frontend/FrontendAction.h | 2 +- .../clang/include/clang/Frontend/FrontendActions.h | 2 + .../clang/include/clang/Frontend/FrontendOptions.h | 35 +- .../include/clang/Frontend/PrecompiledPreamble.h | 9 +- .../clang/include/clang/Frontend/Utils.h | 8 +- .../SerializablePathCollection.h | 129 + .../clang/include/clang/Lex/HeaderSearch.h | 34 + .../clang/include/clang/Lex/HeaderSearchOptions.h | 9 +- .../llvm-project/clang/include/clang/Lex/Lexer.h | 10 +- .../clang/include/clang/Lex/ModuleMap.h | 13 +- .../clang/include/clang/Lex/Preprocessor.h | 24 + ...cessorExcludedConditionalDirectiveSkipMapping.h | 3 +- .../clang/include/clang/Lex/PreprocessorOptions.h | 26 +- .../clang/include/clang/Lex/VariadicMacroSupport.h | 10 +- .../clang/include/clang/Parse/Parser.h | 70 +- .../include/clang/Sema/CodeCompleteConsumer.h | 3 - .../clang/include/clang/Sema/DeclSpec.h | 581 +-- .../clang/include/clang/Sema/DelayedDiagnostic.h | 19 +- .../clang/include/clang/Sema/Designator.h | 49 +- .../clang/include/clang/Sema/Initialization.h | 61 +- .../clang/Sema/MultiplexExternalSemaSource.h | 2 - .../clang/include/clang/Sema/Overload.h | 6 + .../clang/include/clang/Sema/Ownership.h | 23 +- .../clang/include/clang/Sema/ParsedAttr.h | 44 +- .../clang/include/clang/Sema/ScopeInfo.h | 15 +- .../llvm-project/clang/include/clang/Sema/Sema.h | 839 ++-- .../clang/include/clang/Sema/Template.h | 2 +- .../include/clang/Serialization/ASTBitCodes.h | 10 +- .../clang/include/clang/Serialization/ASTReader.h | 51 +- .../include/clang/Serialization/ASTRecordReader.h | 6 +- .../include/clang/Serialization/ASTRecordWriter.h | 15 +- .../clang/include/clang/Serialization/ASTWriter.h | 10 + .../clang/include/clang/Serialization/ModuleFile.h | 19 +- .../include/clang/Serialization/ModuleManager.h | 6 +- .../clang/StaticAnalyzer/Checkers/Checkers.td | 16 +- .../clang/StaticAnalyzer/Core/AnalyzerOptions.h | 34 +- .../Core/BugReporter/BugReporterVisitors.h | 5 +- .../include/clang/StaticAnalyzer/Core/IssueHash.h | 50 - .../StaticAnalyzer/Core/PathDiagnosticConsumers.h | 7 +- .../Core/PathSensitive/BasicValueFactory.h | 16 +- .../StaticAnalyzer/Core/PathSensitive/CallEvent.h | 56 +- .../Core/PathSensitive/CheckerContext.h | 20 + .../StaticAnalyzer/Core/PathSensitive/ExprEngine.h | 17 + .../Core/PathSensitive/RangedConstraintManager.h | 22 +- .../Core/PathSensitive/SMTConstraintManager.h | 3 +- .../StaticAnalyzer/Core/PathSensitive/SMTConv.h | 18 +- .../Core/PathSensitive/SValBuilder.h | 2 +- .../StaticAnalyzer/Core/PathSensitive/SVals.h | 14 +- .../StaticAnalyzer/Core/PathSensitive/SymExpr.h | 3 + .../Core/PathSensitive/SymbolManager.h | 12 +- .../clang/include/clang/Testing/TestClangConfig.h | 2 + .../include/clang/Tooling/CompilationDatabase.h | 22 +- .../clang/Tooling/Inclusions/HeaderIncludes.h | 2 - .../clang/Tooling/Inclusions/IncludeStyle.h | 21 +- .../clang/Tooling/{Core => Refactoring}/Lookup.h | 6 +- .../Tooling/Refactoring/RefactoringRuleContext.h | 2 +- .../Tooling/Refactoring/Rename/SymbolOccurrences.h | 13 +- .../clang/include/clang/Tooling/Syntax/BuildTree.h | 35 +- .../clang/include/clang/Tooling/Syntax/Nodes.h | 648 +-- .../clang/include/clang/Tooling/Syntax/Nodes.td | 296 ++ .../clang/include/clang/Tooling/Syntax/Syntax.td | 85 + .../clang/include/clang/Tooling/Syntax/Tokens.h | 12 +- .../clang/include/clang/Tooling/Syntax/Tree.h | 216 +- .../clang/include/clang/Tooling/Tooling.h | 11 - .../clang/Tooling/Transformer/MatchConsumer.h | 6 - .../clang/Tooling/Transformer/RangeSelector.h | 29 +- .../clang/Tooling/Transformer/RewriteRule.h | 290 +- .../include/clang/Tooling/Transformer/Stencil.h | 11 +- .../clang/include/clang/module.modulemap | 1 + .../clang/lib/APINotes/APINotesFormat.h | 255 + .../clang/lib/APINotes/APINotesTypes.cpp | 107 + .../clang/lib/APINotes/APINotesYAMLCompiler.cpp | 598 +++ .../llvm-project/clang/lib/ARCMigrate/ARCMT.cpp | 8 +- .../clang/lib/ARCMigrate/FileRemapper.cpp | 15 + .../llvm-project/clang/lib/ARCMigrate/ObjCMT.cpp | 39 +- .../clang/lib/ARCMigrate/TransGCAttrs.cpp | 22 +- .../clang/lib/ARCMigrate/TransProperties.cpp | 17 +- .../llvm-project/clang/lib/ARCMigrate/Transforms.h | 6 +- contrib/llvm-project/clang/lib/AST/APValue.cpp | 538 +- contrib/llvm-project/clang/lib/AST/ASTContext.cpp | 441 +- .../llvm-project/clang/lib/AST/ASTDiagnostic.cpp | 15 +- contrib/llvm-project/clang/lib/AST/ASTDumper.cpp | 8 +- contrib/llvm-project/clang/lib/AST/ASTImporter.cpp | 563 ++- .../clang/lib/AST/ASTImporterLookupTable.cpp | 14 + .../clang/lib/AST/ASTStructuralEquivalence.cpp | 496 +- .../llvm-project/clang/lib/AST/ASTTypeTraits.cpp | 58 +- contrib/llvm-project/clang/lib/AST/AttrImpl.cpp | 53 +- contrib/llvm-project/clang/lib/AST/CXXABI.h | 5 +- .../llvm-project/clang/lib/AST/CXXInheritance.cpp | 150 +- .../llvm-project/clang/lib/AST/CommentLexer.cpp | 9 +- .../clang/lib/AST/ComparisonCategories.cpp | 2 +- .../clang/lib/AST/ComputeDependence.cpp | 138 +- contrib/llvm-project/clang/lib/AST/Decl.cpp | 306 +- contrib/llvm-project/clang/lib/AST/DeclBase.cpp | 58 +- contrib/llvm-project/clang/lib/AST/DeclCXX.cpp | 145 +- contrib/llvm-project/clang/lib/AST/DeclObjC.cpp | 45 +- contrib/llvm-project/clang/lib/AST/DeclOpenMP.cpp | 112 +- contrib/llvm-project/clang/lib/AST/DeclPrinter.cpp | 28 +- .../llvm-project/clang/lib/AST/DeclTemplate.cpp | 77 +- contrib/llvm-project/clang/lib/AST/Expr.cpp | 482 +- contrib/llvm-project/clang/lib/AST/ExprCXX.cpp | 207 +- .../clang/lib/AST/ExprClassification.cpp | 4 +- .../llvm-project/clang/lib/AST/ExprConstant.cpp | 1535 ++++-- .../llvm-project/clang/lib/AST/Interp/Disasm.cpp | 4 +- .../llvm-project/clang/lib/AST/Interp/State.cpp | 2 +- .../llvm-project/clang/lib/AST/ItaniumCXXABI.cpp | 6 + .../llvm-project/clang/lib/AST/ItaniumMangle.cpp | 1388 +++++- .../llvm-project/clang/lib/AST/JSONNodeDumper.cpp | 8 +- contrib/llvm-project/clang/lib/AST/Linkage.h | 2 + contrib/llvm-project/clang/lib/AST/Mangle.cpp | 72 +- .../llvm-project/clang/lib/AST/MicrosoftCXXABI.cpp | 33 +- .../llvm-project/clang/lib/AST/MicrosoftMangle.cpp | 424 +- contrib/llvm-project/clang/lib/AST/NSAPI.cpp | 3 + .../llvm-project/clang/lib/AST/OpenMPClause.cpp | 178 +- .../clang/lib/AST/ParentMapContext.cpp | 117 +- .../clang/lib/AST/PrintfFormatString.cpp | 3 + .../llvm-project/clang/lib/AST/RecordLayout.cpp | 41 +- .../clang/lib/AST/RecordLayoutBuilder.cpp | 380 +- contrib/llvm-project/clang/lib/AST/Stmt.cpp | 110 +- contrib/llvm-project/clang/lib/AST/StmtOpenMP.cpp | 1135 ++--- contrib/llvm-project/clang/lib/AST/StmtPrinter.cpp | 25 +- contrib/llvm-project/clang/lib/AST/StmtProfile.cpp | 9 +- .../llvm-project/clang/lib/AST/TemplateBase.cpp | 35 +- .../llvm-project/clang/lib/AST/TemplateName.cpp | 18 +- .../llvm-project/clang/lib/AST/TextNodeDumper.cpp | 51 +- contrib/llvm-project/clang/lib/AST/Type.cpp | 108 +- contrib/llvm-project/clang/lib/AST/TypeLoc.cpp | 5 +- contrib/llvm-project/clang/lib/AST/TypePrinter.cpp | 314 +- .../clang/lib/ASTMatchers/ASTMatchFinder.cpp | 471 +- .../clang/lib/ASTMatchers/ASTMatchersInternal.cpp | 152 +- .../clang/lib/ASTMatchers/Dynamic/Marshallers.cpp | 11 +- .../clang/lib/ASTMatchers/Dynamic/Marshallers.h | 208 +- .../clang/lib/ASTMatchers/Dynamic/Registry.cpp | 11 +- .../clang/lib/ASTMatchers/Dynamic/VariantValue.cpp | 30 + .../clang/lib/ASTMatchers/GtestMatchers.cpp | 4 +- .../llvm-project/clang/lib/Analysis/BodyFarm.cpp | 40 +- contrib/llvm-project/clang/lib/Analysis/CFG.cpp | 35 +- .../clang/lib/Analysis/CalledOnceCheck.cpp | 1525 ++++++ .../clang/lib/Analysis/ExprMutationAnalyzer.cpp | 300 +- .../Core => Analysis}/IssueHash.cpp | 41 +- .../clang/lib/Analysis/LiveVariables.cpp | 102 +- .../clang/lib/Analysis/PathDiagnostic.cpp | 46 +- .../clang/lib/Analysis/ThreadSafety.cpp | 29 +- .../clang/lib/Analysis/ThreadSafetyCommon.cpp | 4 +- contrib/llvm-project/clang/lib/Basic/Cuda.cpp | 43 +- .../llvm-project/clang/lib/Basic/Diagnostic.cpp | 35 +- .../llvm-project/clang/lib/Basic/DiagnosticIDs.cpp | 109 +- contrib/llvm-project/clang/lib/Basic/FileEntry.cpp | 24 + .../llvm-project/clang/lib/Basic/FileManager.cpp | 181 +- .../clang/lib/Basic/IdentifierTable.cpp | 5 + .../llvm-project/clang/lib/Basic/LangOptions.cpp | 2 +- contrib/llvm-project/clang/lib/Basic/Module.cpp | 21 +- .../llvm-project/clang/lib/Basic/OpenCLOptions.cpp | 106 + .../llvm-project/clang/lib/Basic/OpenMPKinds.cpp | 50 +- .../llvm-project/clang/lib/Basic/ProfileList.cpp | 114 + .../clang/lib/Basic/SourceLocation.cpp | 21 +- .../llvm-project/clang/lib/Basic/SourceManager.cpp | 506 +- contrib/llvm-project/clang/lib/Basic/TargetID.cpp | 169 + .../llvm-project/clang/lib/Basic/TargetInfo.cpp | 1 + contrib/llvm-project/clang/lib/Basic/Targets.cpp | 51 +- .../clang/lib/Basic/Targets/AArch64.cpp | 48 +- .../llvm-project/clang/lib/Basic/Targets/AArch64.h | 6 + .../clang/lib/Basic/Targets/AMDGPU.cpp | 36 +- .../llvm-project/clang/lib/Basic/Targets/AMDGPU.h | 77 +- .../llvm-project/clang/lib/Basic/Targets/ARM.cpp | 2 + .../llvm-project/clang/lib/Basic/Targets/AVR.cpp | 7 + .../clang/lib/Basic/Targets/Hexagon.cpp | 3 +- .../clang/lib/Basic/Targets/MSP430.cpp | 1 + .../llvm-project/clang/lib/Basic/Targets/Mips.cpp | 1 - .../llvm-project/clang/lib/Basic/Targets/NVPTX.cpp | 8 + .../llvm-project/clang/lib/Basic/Targets/NVPTX.h | 22 +- .../clang/lib/Basic/Targets/OSTargets.h | 76 +- .../llvm-project/clang/lib/Basic/Targets/PPC.cpp | 85 +- contrib/llvm-project/clang/lib/Basic/Targets/PPC.h | 34 +- .../llvm-project/clang/lib/Basic/Targets/RISCV.cpp | 131 +- .../llvm-project/clang/lib/Basic/Targets/RISCV.h | 34 +- .../llvm-project/clang/lib/Basic/Targets/SPIR.h | 6 +- .../llvm-project/clang/lib/Basic/Targets/Sparc.cpp | 23 +- .../llvm-project/clang/lib/Basic/Targets/Sparc.h | 11 +- .../llvm-project/clang/lib/Basic/Targets/SystemZ.h | 4 + contrib/llvm-project/clang/lib/Basic/Targets/TCE.h | 2 + contrib/llvm-project/clang/lib/Basic/Targets/VE.h | 16 +- .../llvm-project/clang/lib/Basic/Targets/X86.cpp | 60 +- contrib/llvm-project/clang/lib/Basic/Targets/X86.h | 36 +- contrib/llvm-project/clang/lib/Basic/Version.cpp | 2 - contrib/llvm-project/clang/lib/Basic/Warnings.cpp | 7 +- contrib/llvm-project/clang/lib/CodeGen/ABIInfo.h | 2 +- .../llvm-project/clang/lib/CodeGen/BackendUtil.cpp | 560 +-- .../llvm-project/clang/lib/CodeGen/CGAtomic.cpp | 60 +- .../llvm-project/clang/lib/CodeGen/CGBlocks.cpp | 17 +- .../llvm-project/clang/lib/CodeGen/CGBuiltin.cpp | 2359 ++++++--- .../llvm-project/clang/lib/CodeGen/CGCUDANV.cpp | 117 +- .../llvm-project/clang/lib/CodeGen/CGCUDARuntime.h | 7 +- .../llvm-project/clang/lib/CodeGen/CGCXXABI.cpp | 26 +- contrib/llvm-project/clang/lib/CodeGen/CGCXXABI.h | 13 +- contrib/llvm-project/clang/lib/CodeGen/CGCall.cpp | 344 +- contrib/llvm-project/clang/lib/CodeGen/CGCall.h | 6 +- contrib/llvm-project/clang/lib/CodeGen/CGClass.cpp | 103 +- contrib/llvm-project/clang/lib/CodeGen/CGCleanup.h | 1 + .../llvm-project/clang/lib/CodeGen/CGDebugInfo.cpp | 269 +- .../llvm-project/clang/lib/CodeGen/CGDebugInfo.h | 14 +- contrib/llvm-project/clang/lib/CodeGen/CGDecl.cpp | 158 +- .../llvm-project/clang/lib/CodeGen/CGDeclCXX.cpp | 113 +- .../llvm-project/clang/lib/CodeGen/CGException.cpp | 28 +- contrib/llvm-project/clang/lib/CodeGen/CGExpr.cpp | 244 +- .../llvm-project/clang/lib/CodeGen/CGExprAgg.cpp | 131 +- .../llvm-project/clang/lib/CodeGen/CGExprCXX.cpp | 28 +- .../clang/lib/CodeGen/CGExprComplex.cpp | 11 +- .../clang/lib/CodeGen/CGExprConstant.cpp | 32 +- .../clang/lib/CodeGen/CGExprScalar.cpp | 440 +- .../llvm-project/clang/lib/CodeGen/CGLoopInfo.cpp | 93 +- .../llvm-project/clang/lib/CodeGen/CGLoopInfo.h | 15 +- contrib/llvm-project/clang/lib/CodeGen/CGObjC.cpp | 243 +- .../llvm-project/clang/lib/CodeGen/CGObjCGNU.cpp | 54 +- .../llvm-project/clang/lib/CodeGen/CGObjCMac.cpp | 98 +- .../clang/lib/CodeGen/CGObjCRuntime.cpp | 10 + .../llvm-project/clang/lib/CodeGen/CGObjCRuntime.h | 14 + .../clang/lib/CodeGen/CGOpenMPRuntime.cpp | 1877 ++++--- .../clang/lib/CodeGen/CGOpenMPRuntime.h | 69 +- .../clang/lib/CodeGen/CGOpenMPRuntimeAMDGCN.cpp | 60 + .../clang/lib/CodeGen/CGOpenMPRuntimeAMDGCN.h | 43 + .../clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp | 4864 ++++++++++++++++++ .../clang/lib/CodeGen/CGOpenMPRuntimeGPU.h | 504 ++ .../clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp | 5233 +------------------ .../clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.h | 465 +- .../clang/lib/CodeGen/CGRecordLayout.h | 17 +- .../clang/lib/CodeGen/CGRecordLayoutBuilder.cpp | 187 +- contrib/llvm-project/clang/lib/CodeGen/CGStmt.cpp | 301 +- .../clang/lib/CodeGen/CGStmtOpenMP.cpp | 205 +- contrib/llvm-project/clang/lib/CodeGen/CGVTT.cpp | 13 +- .../llvm-project/clang/lib/CodeGen/CGVTables.cpp | 96 +- contrib/llvm-project/clang/lib/CodeGen/CGValue.h | 2 +- .../clang/lib/CodeGen/CodeGenAction.cpp | 220 +- .../clang/lib/CodeGen/CodeGenFunction.cpp | 350 +- .../clang/lib/CodeGen/CodeGenFunction.h | 268 +- .../clang/lib/CodeGen/CodeGenModule.cpp | 410 +- .../llvm-project/clang/lib/CodeGen/CodeGenModule.h | 58 +- .../llvm-project/clang/lib/CodeGen/CodeGenPGO.cpp | 55 +- .../llvm-project/clang/lib/CodeGen/CodeGenPGO.h | 2 +- .../clang/lib/CodeGen/CodeGenTypeCache.h | 3 + .../clang/lib/CodeGen/CodeGenTypes.cpp | 22 +- .../clang/lib/CodeGen/CoverageMappingGen.cpp | 350 +- .../clang/lib/CodeGen/CoverageMappingGen.h | 50 +- .../clang/lib/CodeGen/ItaniumCXXABI.cpp | 183 +- .../clang/lib/CodeGen/MicrosoftCXXABI.cpp | 103 +- .../CodeGen/ObjectFilePCHContainerOperations.cpp | 10 +- .../clang/lib/CodeGen/SwiftCallingConv.cpp | 33 +- .../llvm-project/clang/lib/CodeGen/TargetInfo.cpp | 608 +-- .../llvm-project/clang/lib/CodeGen/TargetInfo.h | 8 +- .../clang/lib/CrossTU/CrossTranslationUnit.cpp | 12 +- .../llvm-project/clang/lib/Driver/Compilation.cpp | 2 + contrib/llvm-project/clang/lib/Driver/Distro.cpp | 180 +- contrib/llvm-project/clang/lib/Driver/Driver.cpp | 347 +- contrib/llvm-project/clang/lib/Driver/Job.cpp | 22 +- .../clang/lib/Driver/SanitizerArgs.cpp | 42 +- .../llvm-project/clang/lib/Driver/ToolChain.cpp | 139 +- .../clang/lib/Driver/ToolChains/AIX.cpp | 62 +- .../llvm-project/clang/lib/Driver/ToolChains/AIX.h | 7 + .../clang/lib/Driver/ToolChains/AMDGPU.cpp | 135 +- .../clang/lib/Driver/ToolChains/AMDGPU.h | 14 +- .../clang/lib/Driver/ToolChains/AVR.cpp | 306 +- .../clang/lib/Driver/ToolChains/Ananas.cpp | 10 +- .../clang/lib/Driver/ToolChains/Arch/AArch64.cpp | 20 +- .../clang/lib/Driver/ToolChains/Arch/ARM.cpp | 261 +- .../clang/lib/Driver/ToolChains/Arch/ARM.h | 2 + .../clang/lib/Driver/ToolChains/Arch/Mips.cpp | 2 - .../clang/lib/Driver/ToolChains/Arch/PPC.cpp | 1 - .../clang/lib/Driver/ToolChains/Arch/RISCV.cpp | 40 +- .../clang/lib/Driver/ToolChains/Arch/VE.cpp | 4 - .../clang/lib/Driver/ToolChains/Arch/VE.h | 2 - .../clang/lib/Driver/ToolChains/Arch/X86.cpp | 29 +- .../clang/lib/Driver/ToolChains/Arch/X86.h | 2 +- .../clang/lib/Driver/ToolChains/BareMetal.cpp | 146 +- .../clang/lib/Driver/ToolChains/BareMetal.h | 15 +- .../clang/lib/Driver/ToolChains/Clang.cpp | 646 ++- .../clang/lib/Driver/ToolChains/CloudABI.cpp | 5 +- .../clang/lib/Driver/ToolChains/CommonArgs.cpp | 249 +- .../clang/lib/Driver/ToolChains/CommonArgs.h | 10 +- .../clang/lib/Driver/ToolChains/CrossWindows.cpp | 15 +- .../clang/lib/Driver/ToolChains/CrossWindows.h | 6 +- .../clang/lib/Driver/ToolChains/Cuda.cpp | 102 +- .../clang/lib/Driver/ToolChains/Cuda.h | 6 +- .../clang/lib/Driver/ToolChains/Darwin.cpp | 132 +- .../clang/lib/Driver/ToolChains/Darwin.h | 21 +- .../clang/lib/Driver/ToolChains/DragonFly.cpp | 16 +- .../clang/lib/Driver/ToolChains/Flang.cpp | 44 +- .../clang/lib/Driver/ToolChains/Flang.h | 9 + .../clang/lib/Driver/ToolChains/FreeBSD.cpp | 18 +- .../clang/lib/Driver/ToolChains/Fuchsia.cpp | 29 +- .../clang/lib/Driver/ToolChains/Fuchsia.h | 6 +- .../clang/lib/Driver/ToolChains/Gnu.cpp | 154 +- .../llvm-project/clang/lib/Driver/ToolChains/Gnu.h | 6 +- .../clang/lib/Driver/ToolChains/HIP.cpp | 56 +- .../clang/lib/Driver/ToolChains/Hexagon.cpp | 10 +- .../clang/lib/Driver/ToolChains/InterfaceStubs.cpp | 2 +- .../clang/lib/Driver/ToolChains/Linux.cpp | 27 +- .../clang/lib/Driver/ToolChains/MSP430.cpp | 159 +- .../clang/lib/Driver/ToolChains/MSP430.h | 13 + .../clang/lib/Driver/ToolChains/MSVC.cpp | 71 +- .../clang/lib/Driver/ToolChains/MinGW.cpp | 25 +- .../clang/lib/Driver/ToolChains/Minix.cpp | 10 +- .../clang/lib/Driver/ToolChains/Myriad.cpp | 10 +- .../clang/lib/Driver/ToolChains/NaCl.cpp | 5 +- .../clang/lib/Driver/ToolChains/NetBSD.cpp | 10 +- .../clang/lib/Driver/ToolChains/OpenBSD.cpp | 11 +- .../clang/lib/Driver/ToolChains/OpenBSD.h | 6 +- .../clang/lib/Driver/ToolChains/PS4CPU.cpp | 47 +- .../clang/lib/Driver/ToolChains/PS4CPU.h | 6 +- .../clang/lib/Driver/ToolChains/RISCVToolchain.cpp | 21 +- .../clang/lib/Driver/ToolChains/RISCVToolchain.h | 1 + .../clang/lib/Driver/ToolChains/ROCm.h | 13 +- .../clang/lib/Driver/ToolChains/Solaris.cpp | 4 +- .../clang/lib/Driver/ToolChains/Solaris.h | 5 + .../clang/lib/Driver/ToolChains/VEToolchain.cpp | 31 +- .../clang/lib/Driver/ToolChains/VEToolchain.h | 1 + .../clang/lib/Driver/ToolChains/WebAssembly.cpp | 28 +- .../clang/lib/Driver/ToolChains/XCore.cpp | 4 +- .../clang/lib/Driver/ToolChains/ZOS.cpp | 33 + .../llvm-project/clang/lib/Driver/ToolChains/ZOS.h | 40 + contrib/llvm-project/clang/lib/Driver/Types.cpp | 4 +- contrib/llvm-project/clang/lib/Driver/XRayArgs.cpp | 26 + .../llvm-project/clang/lib/Edit/EditedSource.cpp | 4 +- .../clang/lib/Edit/RewriteObjCFoundationAPI.cpp | 2 + .../clang/lib/Format/BreakableToken.cpp | 92 +- .../llvm-project/clang/lib/Format/BreakableToken.h | 1 - .../clang/lib/Format/ContinuationIndenter.cpp | 59 +- contrib/llvm-project/clang/lib/Format/Format.cpp | 167 +- .../llvm-project/clang/lib/Format/FormatInternal.h | 1 - .../llvm-project/clang/lib/Format/FormatToken.cpp | 5 +- .../llvm-project/clang/lib/Format/FormatToken.h | 279 +- .../clang/lib/Format/FormatTokenLexer.cpp | 23 +- .../clang/lib/Format/MacroExpander.cpp | 224 + contrib/llvm-project/clang/lib/Format/Macros.h | 141 + .../clang/lib/Format/TokenAnnotator.cpp | 243 +- .../clang/lib/Format/UnwrappedLineFormatter.cpp | 78 +- .../clang/lib/Format/UnwrappedLineParser.cpp | 307 +- .../clang/lib/Format/UnwrappedLineParser.h | 17 +- .../clang/lib/Format/WhitespaceManager.cpp | 86 +- .../llvm-project/clang/lib/Frontend/ASTUnit.cpp | 103 +- .../clang/lib/Frontend/ChainedIncludesSource.cpp | 11 +- .../clang/lib/Frontend/CompilerInstance.cpp | 280 +- .../clang/lib/Frontend/CompilerInvocation.cpp | 2176 +++----- .../Frontend/CreateInvocationFromCommandLine.cpp | 4 +- .../clang/lib/Frontend/DependencyFile.cpp | 17 +- .../clang/lib/Frontend/FrontendAction.cpp | 19 +- .../clang/lib/Frontend/FrontendActions.cpp | 58 +- .../clang/lib/Frontend/FrontendOptions.cpp | 2 +- .../clang/lib/Frontend/InitPreprocessor.cpp | 30 +- .../lib/Frontend/ModuleDependencyCollector.cpp | 52 +- .../clang/lib/Frontend/PrecompiledPreamble.cpp | 51 +- .../clang/lib/Frontend/Rewrite/HTMLPrint.cpp | 2 +- .../lib/Frontend/Rewrite/InclusionRewriter.cpp | 78 +- .../clang/lib/Frontend/Rewrite/RewriteMacros.cpp | 2 +- .../lib/Frontend/Rewrite/RewriteModernObjC.cpp | 57 +- .../clang/lib/Frontend/Rewrite/RewriteObjC.cpp | 47 +- .../clang/lib/Frontend/TextDiagnostic.cpp | 5 +- .../clang/lib/Frontend/TextDiagnosticPrinter.cpp | 8 +- .../lib/Frontend/VerifyDiagnosticConsumer.cpp | 12 +- .../clang/lib/Headers/__clang_cuda_builtin_vars.h | 9 + .../clang/lib/Headers/__clang_cuda_cmath.h | 50 +- .../lib/Headers/__clang_cuda_complex_builtins.h | 30 +- .../clang/lib/Headers/__clang_cuda_math.h | 9 +- .../Headers/__clang_cuda_math_forward_declares.h | 3 + .../lib/Headers/__clang_cuda_runtime_wrapper.h | 28 +- .../clang/lib/Headers/__clang_hip_cmath.h | 664 +++ .../lib/Headers/__clang_hip_libdevice_declares.h | 26 +- .../clang/lib/Headers/__clang_hip_math.h | 1148 +++-- .../lib/Headers/__clang_hip_runtime_wrapper.h | 5 + contrib/llvm-project/clang/lib/Headers/altivec.h | 1037 +++- contrib/llvm-project/clang/lib/Headers/amxintrin.h | 97 +- contrib/llvm-project/clang/lib/Headers/arm_acle.h | 26 + .../llvm-project/clang/lib/Headers/avx512fintrin.h | 165 +- .../clang/lib/Headers/avx512vlvnniintrin.h | 205 +- contrib/llvm-project/clang/lib/Headers/avxintrin.h | 6 +- .../llvm-project/clang/lib/Headers/avxvnniintrin.h | 225 + contrib/llvm-project/clang/lib/Headers/cpuid.h | 8 + .../clang/lib/Headers/cuda_wrappers/algorithm | 2 +- .../clang/lib/Headers/cuda_wrappers/new | 2 +- contrib/llvm-project/clang/lib/Headers/emmintrin.h | 2 +- .../llvm-project/clang/lib/Headers/gfniintrin.h | 181 +- .../llvm-project/clang/lib/Headers/hresetintrin.h | 49 + .../llvm-project/clang/lib/Headers/ia32intrin.h | 97 +- contrib/llvm-project/clang/lib/Headers/immintrin.h | 12 + contrib/llvm-project/clang/lib/Headers/intrin.h | 24 +- .../clang/lib/Headers/keylockerintrin.h | 506 ++ contrib/llvm-project/clang/lib/Headers/mm_malloc.h | 6 + .../llvm-project/clang/lib/Headers/opencl-c-base.h | 18 + contrib/llvm-project/clang/lib/Headers/opencl-c.h | 2 + .../clang/lib/Headers/openmp_wrappers/cmath | 5 +- .../clang/lib/Headers/openmp_wrappers/complex | 25 + .../lib/Headers/openmp_wrappers/complex_cmath.h | 388 ++ .../llvm-project/clang/lib/Headers/popcntintrin.h | 11 +- .../clang/lib/Headers/ppc_wrappers/smmintrin.h | 24 + .../clang/lib/Headers/ppc_wrappers/xmmintrin.h | 9 +- .../llvm-project/clang/lib/Headers/uintrintrin.h | 150 + .../llvm-project/clang/lib/Headers/wasm_simd128.h | 112 +- .../llvm-project/clang/lib/Headers/x86gprintrin.h | 23 + .../clang/lib/Index/FileIndexRecord.cpp | 2 +- contrib/llvm-project/clang/lib/Index/IndexBody.cpp | 4 +- .../clang/lib/Index/IndexTypeSourceInfo.cpp | 21 + .../clang/lib/Index/IndexingAction.cpp | 11 +- .../clang/lib/Index/SimpleFormatContext.h | 72 - .../llvm-project/clang/lib/Index/USRGeneration.cpp | 3 + .../SerializablePathCollection.cpp | 91 + .../llvm-project/clang/lib/Lex/HeaderSearch.cpp | 58 +- contrib/llvm-project/clang/lib/Lex/Lexer.cpp | 49 +- .../llvm-project/clang/lib/Lex/LiteralSupport.cpp | 4 +- contrib/llvm-project/clang/lib/Lex/ModuleMap.cpp | 76 +- .../llvm-project/clang/lib/Lex/PPDirectives.cpp | 12 +- .../llvm-project/clang/lib/Lex/PPLexerChange.cpp | 27 +- .../clang/lib/Lex/PPMacroExpansion.cpp | 31 +- contrib/llvm-project/clang/lib/Lex/Pragma.cpp | 2 +- .../llvm-project/clang/lib/Lex/Preprocessor.cpp | 24 +- .../llvm-project/clang/lib/Lex/ScratchBuffer.cpp | 8 +- .../clang/lib/Parse/ParseCXXInlineMethods.cpp | 23 +- contrib/llvm-project/clang/lib/Parse/ParseDecl.cpp | 303 +- .../llvm-project/clang/lib/Parse/ParseDeclCXX.cpp | 107 +- contrib/llvm-project/clang/lib/Parse/ParseExpr.cpp | 96 +- .../llvm-project/clang/lib/Parse/ParseExprCXX.cpp | 71 +- contrib/llvm-project/clang/lib/Parse/ParseObjc.cpp | 37 +- .../llvm-project/clang/lib/Parse/ParseOpenMP.cpp | 456 +- .../llvm-project/clang/lib/Parse/ParsePragma.cpp | 311 +- contrib/llvm-project/clang/lib/Parse/ParseStmt.cpp | 57 +- .../llvm-project/clang/lib/Parse/ParseStmtAsm.cpp | 2 +- .../llvm-project/clang/lib/Parse/ParseTemplate.cpp | 21 +- .../clang/lib/Parse/ParseTentative.cpp | 13 +- contrib/llvm-project/clang/lib/Parse/Parser.cpp | 66 +- .../llvm-project/clang/lib/Rewrite/HTMLRewrite.cpp | 22 +- .../llvm-project/clang/lib/Rewrite/Rewriter.cpp | 8 +- .../clang/lib/Rewrite/TokenRewriter.cpp | 2 +- .../clang/lib/Sema/AnalysisBasedWarnings.cpp | 102 +- .../clang/lib/Sema/CodeCompleteConsumer.cpp | 6 +- contrib/llvm-project/clang/lib/Sema/DeclSpec.cpp | 167 +- .../clang/lib/Sema/JumpDiagnostics.cpp | 17 + .../clang/lib/Sema/MultiplexExternalSemaSource.cpp | 7 - contrib/llvm-project/clang/lib/Sema/ScopeInfo.cpp | 1 + contrib/llvm-project/clang/lib/Sema/Sema.cpp | 190 +- contrib/llvm-project/clang/lib/Sema/SemaAccess.cpp | 3 +- contrib/llvm-project/clang/lib/Sema/SemaAttr.cpp | 345 +- contrib/llvm-project/clang/lib/Sema/SemaCUDA.cpp | 103 +- contrib/llvm-project/clang/lib/Sema/SemaCast.cpp | 81 +- .../llvm-project/clang/lib/Sema/SemaChecking.cpp | 1022 +++- .../clang/lib/Sema/SemaCodeComplete.cpp | 109 +- .../llvm-project/clang/lib/Sema/SemaConcept.cpp | 23 +- .../llvm-project/clang/lib/Sema/SemaCoroutine.cpp | 100 +- contrib/llvm-project/clang/lib/Sema/SemaDecl.cpp | 1142 +++-- .../llvm-project/clang/lib/Sema/SemaDeclAttr.cpp | 1054 +++- .../llvm-project/clang/lib/Sema/SemaDeclCXX.cpp | 225 +- .../llvm-project/clang/lib/Sema/SemaDeclObjC.cpp | 76 +- .../clang/lib/Sema/SemaExceptionSpec.cpp | 4 +- contrib/llvm-project/clang/lib/Sema/SemaExpr.cpp | 1004 ++-- .../llvm-project/clang/lib/Sema/SemaExprCXX.cpp | 176 +- .../llvm-project/clang/lib/Sema/SemaExprMember.cpp | 119 +- .../llvm-project/clang/lib/Sema/SemaExprObjC.cpp | 88 +- contrib/llvm-project/clang/lib/Sema/SemaInit.cpp | 356 +- contrib/llvm-project/clang/lib/Sema/SemaLambda.cpp | 152 +- contrib/llvm-project/clang/lib/Sema/SemaLookup.cpp | 371 +- contrib/llvm-project/clang/lib/Sema/SemaModule.cpp | 2 +- .../clang/lib/Sema/SemaObjCProperty.cpp | 14 +- contrib/llvm-project/clang/lib/Sema/SemaOpenMP.cpp | 1056 ++-- .../llvm-project/clang/lib/Sema/SemaOverload.cpp | 978 ++-- contrib/llvm-project/clang/lib/Sema/SemaSYCL.cpp | 20 +- contrib/llvm-project/clang/lib/Sema/SemaStmt.cpp | 217 +- .../llvm-project/clang/lib/Sema/SemaStmtAsm.cpp | 6 +- .../llvm-project/clang/lib/Sema/SemaStmtAttr.cpp | 78 +- .../llvm-project/clang/lib/Sema/SemaTemplate.cpp | 636 ++- .../clang/lib/Sema/SemaTemplateDeduction.cpp | 372 +- .../clang/lib/Sema/SemaTemplateInstantiate.cpp | 187 +- .../clang/lib/Sema/SemaTemplateInstantiateDecl.cpp | 403 +- .../clang/lib/Sema/SemaTemplateVariadic.cpp | 60 +- contrib/llvm-project/clang/lib/Sema/SemaType.cpp | 1104 +++-- .../llvm-project/clang/lib/Sema/TreeTransform.h | 212 +- .../clang/lib/Serialization/ASTCommon.cpp | 6 + .../clang/lib/Serialization/ASTReader.cpp | 422 +- .../clang/lib/Serialization/ASTReaderDecl.cpp | 157 +- .../clang/lib/Serialization/ASTReaderStmt.cpp | 365 +- .../clang/lib/Serialization/ASTWriter.cpp | 178 +- .../clang/lib/Serialization/ASTWriterDecl.cpp | 59 +- .../clang/lib/Serialization/ASTWriterStmt.cpp | 158 +- .../clang/lib/Serialization/GlobalModuleIndex.cpp | 7 +- .../clang/lib/Serialization/ModuleManager.cpp | 61 +- .../Checkers/BasicObjCFoundationChecks.cpp | 3 +- .../StaticAnalyzer/Checkers/CastValueChecker.cpp | 4 +- .../StaticAnalyzer/Checkers/CheckObjCDealloc.cpp | 2 +- .../lib/StaticAnalyzer/Checkers/DebugCheckers.cpp | 10 +- .../StaticAnalyzer/Checkers/DereferenceChecker.cpp | 69 +- .../Checkers/ExprInspectionChecker.cpp | 4 +- .../Checkers/FuchsiaHandleChecker.cpp | 312 +- .../Checkers/GenericTaintChecker.cpp | 5 +- .../StaticAnalyzer/Checkers/IteratorModeling.cpp | 103 +- .../Checkers/IteratorRangeChecker.cpp | 2 + .../Checkers/LocalizationChecker.cpp | 7 +- .../Checkers/MacOSKeychainAPIChecker.cpp | 2 +- .../lib/StaticAnalyzer/Checkers/MallocChecker.cpp | 15 +- .../lib/StaticAnalyzer/Checkers/MoveChecker.cpp | 4 +- .../StaticAnalyzer/Checkers/OSObjectCStyleCast.cpp | 21 +- .../Checkers/ObjCMissingSuperCallChecker.cpp | 7 +- .../lib/StaticAnalyzer/Checkers/PaddingChecker.cpp | 5 +- .../StaticAnalyzer/Checkers/PthreadLockChecker.cpp | 271 +- .../RetainCountChecker/RetainCountDiagnostics.cpp | 4 +- .../Checkers/ReturnPointerRangeChecker.cpp | 7 +- .../clang/lib/StaticAnalyzer/Checkers/SmartPtr.h | 2 + .../StaticAnalyzer/Checkers/SmartPtrChecker.cpp | 48 +- .../StaticAnalyzer/Checkers/SmartPtrModeling.cpp | 514 +- .../Checkers/StdLibraryFunctionsChecker.cpp | 2058 +++++--- .../lib/StaticAnalyzer/Checkers/StreamChecker.cpp | 70 +- .../clang/lib/StaticAnalyzer/Checkers/Taint.cpp | 2 +- .../StaticAnalyzer/Checkers/UndefBranchChecker.cpp | 7 +- .../StaticAnalyzer/Checkers/VirtualCallChecker.cpp | 4 +- .../StaticAnalyzer/Checkers/WebKit/ASTUtils.cpp | 4 +- .../Checkers/WebKit/NoUncountedMembersChecker.cpp | 7 +- .../Checkers/WebKit/PtrTypesSemantics.cpp | 58 +- .../Checkers/WebKit/PtrTypesSemantics.h | 23 +- .../WebKit/RefCntblBaseVirtualDtorChecker.cpp | 12 +- .../Checkers/WebKit/UncountedCallArgsChecker.cpp | 3 +- .../WebKit/UncountedLambdaCapturesChecker.cpp | 107 + .../Checkers/WebKit/UncountedLocalVarsChecker.cpp | 251 + .../lib/StaticAnalyzer/Core/AnalyzerOptions.cpp | 2 +- .../lib/StaticAnalyzer/Core/BasicValueFactory.cpp | 25 +- .../clang/lib/StaticAnalyzer/Core/BugReporter.cpp | 13 +- .../StaticAnalyzer/Core/BugReporterVisitors.cpp | 7 +- .../clang/lib/StaticAnalyzer/Core/CallEvent.cpp | 2 +- .../lib/StaticAnalyzer/Core/CheckerContext.cpp | 2 +- .../clang/lib/StaticAnalyzer/Core/Environment.cpp | 21 +- .../clang/lib/StaticAnalyzer/Core/ExprEngine.cpp | 153 +- .../clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp | 7 +- .../lib/StaticAnalyzer/Core/ExprEngineCXX.cpp | 26 +- .../Core/ExprEngineCallAndReturn.cpp | 14 +- .../lib/StaticAnalyzer/Core/ExprEngineObjC.cpp | 13 +- .../lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp | 47 +- .../lib/StaticAnalyzer/Core/PlistDiagnostics.cpp | 400 +- .../clang/lib/StaticAnalyzer/Core/ProgramState.cpp | 3 - .../StaticAnalyzer/Core/RangeConstraintManager.cpp | 1114 ++++- .../Core/RangedConstraintManager.cpp | 41 +- .../clang/lib/StaticAnalyzer/Core/SValBuilder.cpp | 23 +- .../clang/lib/StaticAnalyzer/Core/SVals.cpp | 48 +- .../lib/StaticAnalyzer/Core/SarifDiagnostics.cpp | 16 +- .../Core/SimpleConstraintManager.cpp | 4 +- .../lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp | 19 +- .../lib/StaticAnalyzer/Core/SymbolManager.cpp | 28 +- .../lib/StaticAnalyzer/Core/TextDiagnostics.cpp | 49 +- .../StaticAnalyzer/Frontend/AnalysisConsumer.cpp | 4 +- .../clang/lib/Tooling/AllTUsExecution.cpp | 2 +- .../clang/lib/Tooling/ArgumentsAdjusters.cpp | 34 +- .../clang/lib/Tooling/CompilationDatabase.cpp | 58 +- .../clang/lib/Tooling/Core/Replacement.cpp | 2 +- .../DependencyScanningFilesystem.cpp | 20 +- .../DependencyScanningWorker.cpp | 24 +- .../DependencyScanning/ModuleDepCollector.cpp | 13 +- .../clang/lib/Tooling/FileMatchTrie.cpp | 14 +- .../lib/Tooling/Inclusions/HeaderIncludes.cpp | 52 +- .../clang/lib/Tooling/Inclusions/IncludeStyle.cpp | 1 + .../clang/lib/Tooling/JSONCompilationDatabase.cpp | 48 +- .../clang/lib/Tooling/Refactoring/ASTSelection.cpp | 2 +- .../lib/Tooling/{Core => Refactoring}/Lookup.cpp | 2 +- .../lib/Tooling/Refactoring/RefactoringActions.cpp | 4 +- .../Refactoring/Rename/SymbolOccurrences.cpp | 5 +- .../lib/Tooling/Refactoring/Rename/USRFinder.cpp | 4 +- .../Refactoring/Rename/USRFindingAction.cpp | 52 +- .../Tooling/Refactoring/Rename/USRLocFinder.cpp | 2 +- .../clang/lib/Tooling/Syntax/BuildTree.cpp | 819 ++- .../lib/Tooling/Syntax/ComputeReplacements.cpp | 15 +- .../clang/lib/Tooling/Syntax/Mutations.cpp | 36 +- .../clang/lib/Tooling/Syntax/Nodes.cpp | 604 +-- .../clang/lib/Tooling/Syntax/Synthesis.cpp | 224 +- .../clang/lib/Tooling/Syntax/Tokens.cpp | 89 +- .../llvm-project/clang/lib/Tooling/Syntax/Tree.cpp | 412 +- contrib/llvm-project/clang/lib/Tooling/Tooling.cpp | 71 +- .../clang/lib/Tooling/Transformer/Parsing.cpp | 8 +- .../lib/Tooling/Transformer/RangeSelector.cpp | 26 +- .../clang/lib/Tooling/Transformer/RewriteRule.cpp | 262 +- .../clang/lib/Tooling/Transformer/Stencil.cpp | 77 +- .../clang/lib/Tooling/Transformer/Transformer.cpp | 42 +- .../clang/tools/clang-format/ClangFormat.cpp | 32 +- .../llvm-project/clang/tools/driver/cc1_main.cpp | 10 +- .../llvm-project/clang/tools/driver/cc1as_main.cpp | 29 +- contrib/llvm-project/clang/tools/driver/driver.cpp | 7 + .../utils/TableGen/ClangASTPropertiesEmitter.cpp | 12 +- .../clang/utils/TableGen/ClangAttrEmitter.cpp | 56 +- .../utils/TableGen/ClangDiagnosticsEmitter.cpp | 5 + .../clang/utils/TableGen/ClangOptionDocEmitter.cpp | 2 - .../clang/utils/TableGen/ClangSyntaxEmitter.cpp | 236 + .../clang/utils/TableGen/NeonEmitter.cpp | 25 +- .../clang/utils/TableGen/SveEmitter.cpp | 20 +- .../llvm-project/clang/utils/TableGen/TableGen.cpp | 12 + .../clang/utils/TableGen/TableGenBackends.h | 8 +- contrib/llvm-project/compiler-rt/.clang-tidy | 2 + .../include/fuzzer/FuzzedDataProvider.h | 9 + .../compiler-rt/include/profile/InstrProfData.inc | 139 +- .../compiler-rt/include/sanitizer/asan_interface.h | 16 +- .../include/sanitizer/common_interface_defs.h | 9 +- .../include/sanitizer/dfsan_interface.h | 8 +- .../include/sanitizer/hwasan_interface.h | 3 + .../include/sanitizer/memprof_interface.h | 65 + .../compiler-rt/include/sanitizer/msan_interface.h | 3 + .../include/sanitizer/netbsd_syscall_hooks.h | 213 +- .../compiler-rt/lib/asan/asan_allocator.cpp | 479 +- .../compiler-rt/lib/asan/asan_allocator.h | 11 +- .../compiler-rt/lib/asan/asan_flags.cpp | 10 +- .../compiler-rt/lib/asan/asan_fuchsia.cpp | 35 +- .../compiler-rt/lib/asan/asan_interceptors.cpp | 41 +- .../compiler-rt/lib/asan/asan_interceptors.h | 22 +- .../compiler-rt/lib/asan/asan_interceptors_vfork.S | 3 +- .../compiler-rt/lib/asan/asan_interface_internal.h | 4 +- .../compiler-rt/lib/asan/asan_internal.h | 2 - .../compiler-rt/lib/asan/asan_linux.cpp | 45 +- .../llvm-project/compiler-rt/lib/asan/asan_mac.cpp | 48 +- .../compiler-rt/lib/asan/asan_malloc_linux.cpp | 10 +- .../compiler-rt/lib/asan/asan_malloc_local.h | 2 +- .../compiler-rt/lib/asan/asan_mapping.h | 21 + .../compiler-rt/lib/asan/asan_poisoning.cpp | 6 - .../compiler-rt/lib/asan/asan_premap_shadow.cpp | 18 +- .../compiler-rt/lib/asan/asan_report.cpp | 5 +- .../compiler-rt/lib/asan/asan_rtems.cpp | 6 + .../llvm-project/compiler-rt/lib/asan/asan_rtl.cpp | 5 +- .../compiler-rt/lib/asan/asan_shadow_setup.cpp | 45 +- .../llvm-project/compiler-rt/lib/asan/asan_stack.h | 5 - .../compiler-rt/lib/asan/asan_thread.cpp | 27 +- .../compiler-rt/lib/asan/asan_thread.h | 7 +- .../llvm-project/compiler-rt/lib/asan/asan_win.cpp | 19 +- .../compiler-rt/lib/builtins/README.txt | 2 + .../compiler-rt/lib/builtins/aarch64/lse.S | 236 + .../compiler-rt/lib/builtins/assembly.h | 93 +- .../llvm-project/compiler-rt/lib/builtins/atomic.c | 93 +- .../compiler-rt/lib/builtins/clear_cache.c | 10 +- .../compiler-rt/lib/builtins/cpu_model.c | 63 +- .../llvm-project/compiler-rt/lib/builtins/divdf3.c | 189 +- .../llvm-project/compiler-rt/lib/builtins/divdi3.c | 15 +- .../compiler-rt/lib/builtins/divmoddi4.c | 13 +- .../compiler-rt/lib/builtins/divmodsi4.c | 13 +- .../compiler-rt/lib/builtins/divmodti4.c | 32 + .../llvm-project/compiler-rt/lib/builtins/divsf3.c | 174 +- .../llvm-project/compiler-rt/lib/builtins/divsi3.c | 25 +- .../llvm-project/compiler-rt/lib/builtins/divtf3.c | 203 +- .../llvm-project/compiler-rt/lib/builtins/divti3.c | 15 +- .../llvm-project/compiler-rt/lib/builtins/emutls.c | 7 +- .../compiler-rt/lib/builtins/extendhfsf2.c | 6 +- .../compiler-rt/lib/builtins/extendhftf2.c | 23 + .../compiler-rt/lib/builtins/fp_div_impl.inc | 419 ++ .../compiler-rt/lib/builtins/fp_extend.h | 4 + .../llvm-project/compiler-rt/lib/builtins/fp_lib.h | 7 + .../compiler-rt/lib/builtins/fp_trunc.h | 4 + .../compiler-rt/lib/builtins/int_div_impl.inc | 25 + .../compiler-rt/lib/builtins/int_mulo_impl.inc | 49 + .../compiler-rt/lib/builtins/int_mulv_impl.inc | 47 + .../compiler-rt/lib/builtins/int_util.h | 16 + .../llvm-project/compiler-rt/lib/builtins/moddi3.c | 16 +- .../llvm-project/compiler-rt/lib/builtins/modti3.c | 16 +- .../compiler-rt/lib/builtins/mulodi4.c | 33 +- .../compiler-rt/lib/builtins/mulosi4.c | 33 +- .../compiler-rt/lib/builtins/muloti4.c | 33 +- .../compiler-rt/lib/builtins/mulvdi3.c | 33 +- .../compiler-rt/lib/builtins/mulvsi3.c | 33 +- .../compiler-rt/lib/builtins/mulvti3.c | 33 +- .../compiler-rt/lib/builtins/os_version_check.c | 108 +- .../compiler-rt/lib/builtins/paritydi2.c | 6 +- .../compiler-rt/lib/builtins/parityti2.c | 8 +- .../lib/builtins/riscv/int_mul_impl.inc | 6 +- .../compiler-rt/lib/builtins/truncdfhf2.c | 4 +- .../compiler-rt/lib/builtins/truncsfhf2.c | 6 +- .../compiler-rt/lib/builtins/trunctfhf2.c | 23 + contrib/llvm-project/compiler-rt/lib/cfi/cfi.cpp | 2 +- .../llvm-project/compiler-rt/lib/crt/crtbegin.c | 8 + .../llvm-project/compiler-rt/lib/dfsan/dfsan.cpp | 100 +- .../compiler-rt/lib/dfsan/dfsan_custom.cpp | 201 +- .../compiler-rt/lib/dfsan/dfsan_flags.inc | 4 - .../compiler-rt/lib/dfsan/dfsan_interceptors.cpp | 41 +- .../compiler-rt/lib/dfsan/done_abilist.txt | 85 + .../compiler-rt/lib/fuzzer/FuzzerCorpus.h | 62 +- .../compiler-rt/lib/fuzzer/FuzzerDataFlowTrace.cpp | 2 +- .../compiler-rt/lib/fuzzer/FuzzerDriver.cpp | 91 +- .../lib/fuzzer/FuzzerExtFunctionsWeak.cpp | 2 +- .../compiler-rt/lib/fuzzer/FuzzerExtraCounters.cpp | 2 +- .../compiler-rt/lib/fuzzer/FuzzerFlags.def | 37 +- .../compiler-rt/lib/fuzzer/FuzzerFork.cpp | 14 +- .../compiler-rt/lib/fuzzer/FuzzerIO.cpp | 45 + .../llvm-project/compiler-rt/lib/fuzzer/FuzzerIO.h | 6 + .../compiler-rt/lib/fuzzer/FuzzerIOPosix.cpp | 8 +- .../compiler-rt/lib/fuzzer/FuzzerIOWindows.cpp | 14 +- .../compiler-rt/lib/fuzzer/FuzzerInterceptors.cpp | 253 + .../compiler-rt/lib/fuzzer/FuzzerInternal.h | 4 +- .../compiler-rt/lib/fuzzer/FuzzerLoop.cpp | 69 +- .../compiler-rt/lib/fuzzer/FuzzerMutate.cpp | 40 +- *** 884946 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Sat Jul 31 19:21:40 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 399CC66353F; Sat, 31 Jul 2021 19:21:40 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GcYzS165Rz4tDk; Sat, 31 Jul 2021 19:21:40 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from venus.codepro.be (venus.codepro.be [5.9.86.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.codepro.be", Issuer "R3" (verified OK)) (Authenticated sender: kp) by smtp.freebsd.org (Postfix) with ESMTPSA id D27C9982A; Sat, 31 Jul 2021 19:21:39 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: by venus.codepro.be (Postfix, authenticated sender kp) id 29483157D7; Sat, 31 Jul 2021 21:21:38 +0200 (CEST) From: "Kristof Provost" To: "Warner Losh" Cc: "Warner Losh" , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-branches@freebsd.org Subject: Re: git: 6edf5082bab7 - stable/12 - one-true-awk: import 20210221 (1e4bc42c53a1) which fixes a number of bugs Date: Sat, 31 Jul 2021 21:21:37 +0200 X-Mailer: MailMate (1.13.2r5673) Message-ID: In-Reply-To: References: <202107101712.16AHCwoE088447@gitrepo.freebsd.org> <4AD3AB8C-A960-43BE-A89B-5D9C4CD077DD@FreeBSD.org> <8300183E-DD11-4C2F-AE5A-0B6FDE6E9E8F@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: quoted-printable X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-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, 31 Jul 2021 19:21:40 -0000 On 31 Jul 2021, at 20:08, Warner Losh wrote: > On Sat, Jul 31, 2021 at 11:28 AM Warner Losh wrote: > >> >> >> On Sat, Jul 31, 2021 at 9:37 AM Kristof Provost = >> wrote: >> >>> On 31 Jul 2021, at 16:20, Warner Losh wrote: >>>> On Sat, Jul 31, 2021 at 8:07 AM Warner Losh wrote: >>>> >>>>> >>>>> >>>>> On Sat, Jul 31, 2021 at 3:11 AM Kristof Provost >>>>> wrote: >>>>> >>>>>> Hi Warner, >>>>>> >>>>>> On 10 Jul 2021, at 19:12, Warner Losh wrote: >>>>>> >>>>>> The branch stable/12 has been updated by imp: >>>>>> >>>>>> URL: >>>>>> >>> https://cgit.FreeBSD.org/src/commit/?id=3D6edf5082bab71cf923efff9f18e= 38efe5b83b0ec >>>>>> >>>>>> commit 6edf5082bab71cf923efff9f18e38efe5b83b0ec >>>>>> Author: Warner Losh >>>>>> AuthorDate: 2021-07-07 23:30:35 +0000 >>>>>> Commit: Warner Losh >>>>>> CommitDate: 2021-07-10 17:11:15 +0000 >>>>>> >>>>>> one-true-awk: import 20210221 (1e4bc42c53a1) which fixes a number = >>>>>> of >>>>>> bugs >>>>>> >>>>>> Import the latest bsd-features branch of the one-true-awk = >>>>>> upstream: >>>>>> >>>>>> o Move to bison for $YACC >>>>>> o Set close-on-exec flag for file and pipe redirects that aren't >>>>>> std* >>>>>> o lots of little fixes to modernize ocde base >>>>>> o free sval member before setting it >>>>>> o fix a bug where a{0,3} could match aaaa >>>>>> o pull in systime and strftime from NetBSD awk >>>>>> o pull in fixes from {Net,Free,Open}BSD (normalized our code with >>>>>> them) >>>>>> o add BSD extensions and, or, xor, compl, lsheift, rshift (mostly = >>>>>> a >>>>>> nop) >>>>>> >>>>>> Also revert a few of the trivial FreeBSD changes that were done >>>>>> slightly >>>>>> differently in the upstreaming process. Also, our PR database may >>>>>> have >>>>>> been mined by upstream for these fixes, and Mikolaj Golub may >>>>>> deserve >>>>>> credit for some of the fixes in this update. >>>>>> >>>>>> Suggested by: Mikolaj Golub >>>>>> PR: 143363,143365,143368,143369,143373,143375,214782 >>>>>> Sponsored by: Netflix >>>>>> >>>>>> (cherry picked from commit = >>>>>> f39dd6a9784467f0db5886012b3f4b13899be6b8) >>>>>> >>>>>> I *think* this is the relevant commit, but I=E2=80=99m not 100% su= re. >>>>>> >>>>>> Anyway, I=E2=80=99ve recently started seeing issues building pfSen= se = >>>>>> for >>>>>> aarch64. >>>>>> I=E2=80=99ve finally narrowed it down, and replicated the problem = on = >>>>>> base >>>>>> FreeBSD >>>>>> (stable/12, but I assume other branches are affected too). >>>>>> >>>>>> It fails to build proctab.c. This file is generated by maketab, a >>>>>> tool >>>>>> built as part of the build process. In my case this tool is built >>>>>> for >>>>>> aarch64, which makes executing it on amd64 less successful than >>>>>> we=E2=80=99d like. >>>>>> >>>>>> This only happens when building with META_MODE though. I do not >>>>>> understand the build system sufficiently to debug why. Hopefully >>>>>> you=E2=80=99ll >>>>>> have a better idea. >>>>>> >>>>> Generally I do, but this one is a bit weird. Also, the amount of >>>>> context >>>>> you've included omits the actual error :( Though I'm guessing it's >>>>> wrong >>>>> arch for the build tool... >>>>> >>>>> I rarely use meta mode, and understand it not at all, but awk = >>>>> follows >>>>> the >>>>> same patterns as /bin/sh and /bin/csh does >>>>> >>>> >>>> [[ stupid gmail ]] >>>> >>>> I've just pushed removal of proctab.c. That may fix this, though = >>>> I'm >>>> not >>>> hopeful. >>> Unfortunately that didn=E2=80=99t help. >>> >>>> I've rarely used metamode, and not for quite some time, but this >>>> an extra file that would confuse things so that maketab might not = >>>> be >>>> built >>>> during build-tools and instead is built later. Please give that a = >>>> try, >>>> and >>>> I'll start a meta build, but that takes a while, not least because = >>>> I >>>> have >>>> to re-leran how to do that :) >>>> >>> I=E2=80=99ve posted my build log and the proctab.c.meta and maketab.m= eta = >>> files >>> on https://people.freebsd.org/~kp/meta/ >>> >>> I=E2=80=99m a little confused by maketab.meta, because what=E2=80=99s= in the = >>> meta >>> file doesn=E2=80=99t seem to match the build command seen in the = >>> metamode.log >>> file. >>> >> >> Yea. It's getting confused and rebuilding it bogusly. For the mknodes = >> in >> sh, we don't see the naked cc command, but we do for maketab. >> >> I'm testing a fix right now, though, and we'll see if that fixes = >> things. I >> think I know what's going on. >> > > I just pushed 1dfb6e5d1f462af4f4df818ee93766f09f3aa787, which fixed = > the > issues I was seeing. Does that do the trick for you as well? > Unfortunately that doesn=E2=80=99t appear to have worked. I=E2=80=99ve uploaded the log of this build run (after I=E2=80=99d delete= d = everything in /usr/obj) here: = https://people.freebsd.org/~kp/meta/metamode_1dfb6e5d1f462af.log Best regards, Kristof From owner-dev-commits-src-all@freebsd.org Sat Jul 31 19:31: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 86F16663680 for ; Sat, 31 Jul 2021 19:31:59 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qt1-x82d.google.com (mail-qt1-x82d.google.com [IPv6:2607:f8b0:4864:20::82d]) (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 4GcZCM2gkWz4tp5 for ; Sat, 31 Jul 2021 19:31:59 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qt1-x82d.google.com with SMTP id d9so8943562qty.12 for ; Sat, 31 Jul 2021 12:31:59 -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=xEP1g0PublskGl+FMV1aIVA4/AT0BW0l/VYSZV+SkUk=; b=Tj/hUru4ayg+8FsbjrkmG2mfn4uDQiWj5UMJxVkL4CXRidXzQyHccBTy4xiWjzG6yT zvvB3XaV937nYRaBbNwmAhUDVkUz5eDLWDNIwBxXQ05huEp9o2LmCPNxYuOtQXCadeFd r+aKuUdp1I72evkNpfyBkS8BZTOfLGkGSZxgqBW9+9v95nzWDTenVhtNNfFFQt+pkQRF yU5i8UHGySrFi/wGHJ9O+vpj90v+bEXOKk/D/7u28RLXf7srwPdLr/EsOARP9mfBEsPn 9rI3YlPPdJPS91RLpAukuFZltRamM3P2Gvu355pbSd8yOvFB2x/seiz2cyJvfLSF2NO0 YClg== 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=xEP1g0PublskGl+FMV1aIVA4/AT0BW0l/VYSZV+SkUk=; b=Hb3PBb44FrmivCdaIpWgqyQPeQOYmbmk/YSax4uQiB/NwxQdwtVny6IkVMd/ftvZB3 KSWmf0R3xjz1ymOBElLzBjcfvCjh5XLJPMLu57Z1wGeYrpRzVx+dNlytiKVNojKGz4Eb Qab/R9VfTN5lvdR1JbzROEnZibeAa9VwiDdoD4/iv/bXelxKhS28jbpT2+sm3cc4nn7W YQcXvgOeDvI9v6hhxvze7aZ4Bx+/fTLitaw2D81qcZJHmzbjOp6v0JdRtwBQVNQSPVql qaHahaDHKhgXCHWemh+3V1aC2b+MGWgXqG0e9g0aD1l66DchiU1x3PB9xW4VGaQ3vsHc V0sg== X-Gm-Message-State: AOAM531+Ui107Yrw0RVlthMqRRQAXD7Psyl/N/J0e4+fwG5lfA6zg2BM ZWLB4cePLKP+qJVpxtl7WiFD6kkWwofbb2xt9PkLlw== X-Google-Smtp-Source: ABdhPJzNNxpZis6KqSPGbsqbXs/3A8IxOplwTJsK+obXxQNdaCaUd5WCrKBoxdGFKVjYAEC3kc4D1713AEED+xcyRwo= X-Received: by 2002:ac8:734a:: with SMTP id q10mr7719576qtp.73.1627759912705; Sat, 31 Jul 2021 12:31:52 -0700 (PDT) MIME-Version: 1.0 References: <202107101712.16AHCwoE088447@gitrepo.freebsd.org> <4AD3AB8C-A960-43BE-A89B-5D9C4CD077DD@FreeBSD.org> <8300183E-DD11-4C2F-AE5A-0B6FDE6E9E8F@FreeBSD.org> In-Reply-To: From: Warner Losh Date: Sat, 31 Jul 2021 13:31:41 -0600 Message-ID: Subject: Re: git: 6edf5082bab7 - stable/12 - one-true-awk: import 20210221 (1e4bc42c53a1) which fixes a number of bugs To: Kristof Provost Cc: Warner Losh , src-committers , "" , dev-commits-src-branches@freebsd.org Content-Type: multipart/mixed; boundary="00000000000060b43f05c87063d3" X-Rspamd-Queue-Id: 4GcZCM2gkWz4tp5 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] 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: Sat, 31 Jul 2021 19:31:59 -0000 --00000000000060b43f05c87063d3 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hmmm, maketab keeps getting rebuilt, which is the issue. It looks like it has extra depends that don't trip up -current but do trip up stable/12. I've enclosed a patch that seems to work for me as well. It looks like the earlier patch moved the race for me, but maketab was still built twice, like your logs show (the 2nd time was after proctab.c was built in my logs, a detail I didn't notice until now). Please try the attached patch. Warner On Sat, Jul 31, 2021 at 1:21 PM Kristof Provost wrote: > On 31 Jul 2021, at 20:08, Warner Losh wrote: > > On Sat, Jul 31, 2021 at 11:28 AM Warner Losh wrote: > > > >> > >> > >> On Sat, Jul 31, 2021 at 9:37 AM Kristof Provost > >> wrote: > >> > >>> On 31 Jul 2021, at 16:20, Warner Losh wrote: > >>>> On Sat, Jul 31, 2021 at 8:07 AM Warner Losh wrote: > >>>> > >>>>> > >>>>> > >>>>> On Sat, Jul 31, 2021 at 3:11 AM Kristof Provost > >>>>> wrote: > >>>>> > >>>>>> Hi Warner, > >>>>>> > >>>>>> On 10 Jul 2021, at 19:12, Warner Losh wrote: > >>>>>> > >>>>>> The branch stable/12 has been updated by imp: > >>>>>> > >>>>>> URL: > >>>>>> > >>> > https://cgit.FreeBSD.org/src/commit/?id=3D6edf5082bab71cf923efff9f18e38ef= e5b83b0ec > >>>>>> > >>>>>> commit 6edf5082bab71cf923efff9f18e38efe5b83b0ec > >>>>>> Author: Warner Losh > >>>>>> AuthorDate: 2021-07-07 23:30:35 +0000 > >>>>>> Commit: Warner Losh > >>>>>> CommitDate: 2021-07-10 17:11:15 +0000 > >>>>>> > >>>>>> one-true-awk: import 20210221 (1e4bc42c53a1) which fixes a number > >>>>>> of > >>>>>> bugs > >>>>>> > >>>>>> Import the latest bsd-features branch of the one-true-awk > >>>>>> upstream: > >>>>>> > >>>>>> o Move to bison for $YACC > >>>>>> o Set close-on-exec flag for file and pipe redirects that aren't > >>>>>> std* > >>>>>> o lots of little fixes to modernize ocde base > >>>>>> o free sval member before setting it > >>>>>> o fix a bug where a{0,3} could match aaaa > >>>>>> o pull in systime and strftime from NetBSD awk > >>>>>> o pull in fixes from {Net,Free,Open}BSD (normalized our code with > >>>>>> them) > >>>>>> o add BSD extensions and, or, xor, compl, lsheift, rshift (mostly > >>>>>> a > >>>>>> nop) > >>>>>> > >>>>>> Also revert a few of the trivial FreeBSD changes that were done > >>>>>> slightly > >>>>>> differently in the upstreaming process. Also, our PR database may > >>>>>> have > >>>>>> been mined by upstream for these fixes, and Mikolaj Golub may > >>>>>> deserve > >>>>>> credit for some of the fixes in this update. > >>>>>> > >>>>>> Suggested by: Mikolaj Golub > >>>>>> PR: 143363,143365,143368,143369,143373,143375,214782 > >>>>>> Sponsored by: Netflix > >>>>>> > >>>>>> (cherry picked from commit > >>>>>> f39dd6a9784467f0db5886012b3f4b13899be6b8) > >>>>>> > >>>>>> I *think* this is the relevant commit, but I=E2=80=99m not 100% su= re. > >>>>>> > >>>>>> Anyway, I=E2=80=99ve recently started seeing issues building pfSen= se > >>>>>> for > >>>>>> aarch64. > >>>>>> I=E2=80=99ve finally narrowed it down, and replicated the problem = on > >>>>>> base > >>>>>> FreeBSD > >>>>>> (stable/12, but I assume other branches are affected too). > >>>>>> > >>>>>> It fails to build proctab.c. This file is generated by maketab, a > >>>>>> tool > >>>>>> built as part of the build process. In my case this tool is built > >>>>>> for > >>>>>> aarch64, which makes executing it on amd64 less successful than > >>>>>> we=E2=80=99d like. > >>>>>> > >>>>>> This only happens when building with META_MODE though. I do not > >>>>>> understand the build system sufficiently to debug why. Hopefully > >>>>>> you=E2=80=99ll > >>>>>> have a better idea. > >>>>>> > >>>>> Generally I do, but this one is a bit weird. Also, the amount of > >>>>> context > >>>>> you've included omits the actual error :( Though I'm guessing it's > >>>>> wrong > >>>>> arch for the build tool... > >>>>> > >>>>> I rarely use meta mode, and understand it not at all, but awk > >>>>> follows > >>>>> the > >>>>> same patterns as /bin/sh and /bin/csh does > >>>>> > >>>> > >>>> [[ stupid gmail ]] > >>>> > >>>> I've just pushed removal of proctab.c. That may fix this, though > >>>> I'm > >>>> not > >>>> hopeful. > >>> Unfortunately that didn=E2=80=99t help. > >>> > >>>> I've rarely used metamode, and not for quite some time, but this > >>>> an extra file that would confuse things so that maketab might not > >>>> be > >>>> built > >>>> during build-tools and instead is built later. Please give that a > >>>> try, > >>>> and > >>>> I'll start a meta build, but that takes a while, not least because > >>>> I > >>>> have > >>>> to re-leran how to do that :) > >>>> > >>> I=E2=80=99ve posted my build log and the proctab.c.meta and maketab.m= eta > >>> files > >>> on https://people.freebsd.org/~kp/meta/ > >>> > >>> I=E2=80=99m a little confused by maketab.meta, because what=E2=80=99s= in the > >>> meta > >>> file doesn=E2=80=99t seem to match the build command seen in the > >>> metamode.log > >>> file. > >>> > >> > >> Yea. It's getting confused and rebuilding it bogusly. For the mknodes > >> in > >> sh, we don't see the naked cc command, but we do for maketab. > >> > >> I'm testing a fix right now, though, and we'll see if that fixes > >> things. I > >> think I know what's going on. > >> > > > > I just pushed 1dfb6e5d1f462af4f4df818ee93766f09f3aa787, which fixed > > the > > issues I was seeing. Does that do the trick for you as well? > > > Unfortunately that doesn=E2=80=99t appear to have worked. > > I=E2=80=99ve uploaded the log of this build run (after I=E2=80=99d delete= d > everything in /usr/obj) here: > https://people.freebsd.org/~kp/meta/metamode_1dfb6e5d1f462af.log > > Best regards, > Kristof > --00000000000060b43f05c87063d3 Content-Type: application/octet-stream; name="awk-fix.diff" Content-Disposition: attachment; filename="awk-fix.diff" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_krs65uar0 L2hvbWUvaW1wL2dpdC9zdGFibGUtMTIK --00000000000060b43f05c87063d3-- From owner-dev-commits-src-all@freebsd.org Sat Jul 31 21: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 68433665384; Sat, 31 Jul 2021 21: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 4GcdFy28ZXz3JZr; Sat, 31 Jul 2021 21: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 2DE97201C6; Sat, 31 Jul 2021 21: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 16VLnQsD059230; Sat, 31 Jul 2021 21: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 16VLnQ2K059229; Sat, 31 Jul 2021 21:49:26 GMT (envelope-from git) Date: Sat, 31 Jul 2021 21:49:26 GMT Message-Id: <202107312149.16VLnQ2K059229@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: c50c8502cb62 - main - awk: Fix dependencies 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: c50c8502cb629571f35089690d6e9a9bc4d60813 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, 31 Jul 2021 21:49:26 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=c50c8502cb629571f35089690d6e9a9bc4d60813 commit c50c8502cb629571f35089690d6e9a9bc4d60813 Author: Warner Losh AuthorDate: 2021-07-31 21:41:29 +0000 Commit: Warner Losh CommitDate: 2021-07-31 21:48:26 +0000 awk: Fix dependencies proctab.c is generated from awktab.h, so needs to depend on it. maketab does not depend on awktab.h, and gets the maketab.c dependency automatically, so remove them both. Normally, these don't matter. However, for a meta build, they can cause us to build maketab twice (once host, once for target) resulting in a binary that can't run on the host due to proctab.c racing maketab in parallel legs. In stable/12, this was a reliably lost race, while in main I've been unable to trigger the race at all (maybe due to dirdep changes making main more robust). MFC After: 1 day (build breakage) Reported by: kp Sponsored by: Netflix --- usr.bin/awk/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr.bin/awk/Makefile b/usr.bin/awk/Makefile index 82de7d56a415..cc740a46b82c 100644 --- a/usr.bin/awk/Makefile +++ b/usr.bin/awk/Makefile @@ -22,12 +22,12 @@ CLEANFILES= maketab proctab.c awkgram.tab.h awkgram.tab.h: awkgram.h ln -sf ${.ALLSRC:M*.h} ${.TARGET} -proctab.c: maketab +proctab.c: maketab awkgram.h ${BTOOLSPATH:U.}/maketab awkgram.h > proctab.c DEPENDOBJS+= maketab build-tools: maketab -maketab: awkgram.tab.h maketab.c ${BUILD_TOOLS_META} +maketab: ${BUILD_TOOLS_META} # awk needs some work before we can connect these tests to the build #HAS_TESTS= From owner-dev-commits-src-all@freebsd.org Sat Jul 31 22:18:40 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 77D006657FD; Sat, 31 Jul 2021 22:18:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gcdvh2ltkz3LBy; Sat, 31 Jul 2021 22:18: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 46BA1208B4; Sat, 31 Jul 2021 22:18: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 16VMIeKO099490; Sat, 31 Jul 2021 22:18:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16VMIepQ099489; Sat, 31 Jul 2021 22:18:40 GMT (envelope-from git) Date: Sat, 31 Jul 2021 22:18:40 GMT Message-Id: <202107312218.16VMIepQ099489@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: 22e20d852ff4 - main - LinuxKPI: fix bug in le32p_replace_bits() 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: 22e20d852ff400a486da24e5d1d92c841a3e39d9 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, 31 Jul 2021 22:18:40 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=22e20d852ff400a486da24e5d1d92c841a3e39d9 commit 22e20d852ff400a486da24e5d1d92c841a3e39d9 Author: Bjoern A. Zeeb AuthorDate: 2021-07-29 21:27:21 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-31 22:15:35 +0000 LinuxKPI: fix bug in le32p_replace_bits() Fix a bug that slipped in in 90707c4e44de03ea36be183ef2226601c66169cb using the correct field in le32p_replace_bits(). MFC after: 3 days Reviewed by: hselasky Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31352 --- sys/compat/linuxkpi/common/include/linux/bitfield.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/compat/linuxkpi/common/include/linux/bitfield.h b/sys/compat/linuxkpi/common/include/linux/bitfield.h index 27082cbd4886..a805c1bca5a1 100644 --- a/sys/compat/linuxkpi/common/include/linux/bitfield.h +++ b/sys/compat/linuxkpi/common/include/linux/bitfield.h @@ -90,7 +90,7 @@ static __inline void le32p_replace_bits(uint32_t *p, uint32_t v, uint32_t f) { - *p = (*p & ~(cpu_to_le32(v))) | le32_encode_bits(v, f); + *p = (*p & ~(cpu_to_le32(f))) | le32_encode_bits(v, f); } #define __bf_shf(x) (__builtin_ffsll(x) - 1) From owner-dev-commits-src-all@freebsd.org Sat Jul 31 22:25: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 7932E665A10; Sat, 31 Jul 2021 22:25: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 4Gcf3631Ypz3MGm; Sat, 31 Jul 2021 22:25: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 4FEC620E00; Sat, 31 Jul 2021 22:25: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 16VMP60f012335; Sat, 31 Jul 2021 22:25:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16VMP67g012334; Sat, 31 Jul 2021 22:25:06 GMT (envelope-from git) Date: Sat, 31 Jul 2021 22:25:06 GMT Message-Id: <202107312225.16VMP67g012334@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: a226a9cf8ecf - main - awk: use awkgram.tab.h consistently 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: a226a9cf8ecf429c3fd60b24e25e0bdb546a58b7 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, 31 Jul 2021 22:25:06 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=a226a9cf8ecf429c3fd60b24e25e0bdb546a58b7 commit a226a9cf8ecf429c3fd60b24e25e0bdb546a58b7 Author: Warner Losh AuthorDate: 2021-07-31 22:17:44 +0000 Commit: Warner Losh CommitDate: 2021-07-31 22:24:12 +0000 awk: use awkgram.tab.h consistently yacc makes awkgram.h. However, one true awk includes awkgram.tab.h, so we link to for the builds. Make sure that we consistently link to it. Also, restore the awkgram.tab.h dependency to maketab. It should not have been deleted, despite apparently making meta build on stable/12 work. The important missing arc was proctab.c's dependence on awkgram.tab.h. MFC After: 1 day (build breakage) Fixes: c50c8502cb629571f35089690d6e9a9bc4d60813 Sponsored by: Netflix --- usr.bin/awk/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/usr.bin/awk/Makefile b/usr.bin/awk/Makefile index cc740a46b82c..89dbf4460f45 100644 --- a/usr.bin/awk/Makefile +++ b/usr.bin/awk/Makefile @@ -22,12 +22,12 @@ CLEANFILES= maketab proctab.c awkgram.tab.h awkgram.tab.h: awkgram.h ln -sf ${.ALLSRC:M*.h} ${.TARGET} -proctab.c: maketab awkgram.h - ${BTOOLSPATH:U.}/maketab awkgram.h > proctab.c +proctab.c: maketab awkgram.tab.h + ${BTOOLSPATH:U.}/maketab awkgram.tab.h > proctab.c DEPENDOBJS+= maketab build-tools: maketab -maketab: ${BUILD_TOOLS_META} +maketab: awkgram.tab.h ${BUILD_TOOLS_META} # awk needs some work before we can connect these tests to the build #HAS_TESTS= From owner-dev-commits-src-all@freebsd.org Sat Jul 31 22:43: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 3E605665DB3; Sat, 31 Jul 2021 22:43: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 4GcfSZ1LPHz3MrT; Sat, 31 Jul 2021 22:43: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 1710E20ECE; Sat, 31 Jul 2021 22:43: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 16VMhftw038776; Sat, 31 Jul 2021 22:43:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16VMhf2q038775; Sat, 31 Jul 2021 22:43:41 GMT (envelope-from git) Date: Sat, 31 Jul 2021 22:43:41 GMT Message-Id: <202107312243.16VMhf2q038775@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Li-Wen Hsu Subject: git: de0c7fbe280a - main - 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/main X-Git-Reftype: branch X-Git-Commit: de0c7fbe280a1e0946afb111cf7a9811364c4bd6 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, 31 Jul 2021 22:43:42 -0000 The branch main has been updated by lwhsu: URL: https://cgit.FreeBSD.org/src/commit/?id=de0c7fbe280a1e0946afb111cf7a9811364c4bd6 commit de0c7fbe280a1e0946afb111cf7a9811364c4bd6 Author: Li-Wen Hsu AuthorDate: 2021-07-31 22:41:49 +0000 Commit: Li-Wen Hsu CommitDate: 2021-07-31 22:41:49 +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 --- 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 Sun Aug 1 07:11: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 55DB7656739; Sun, 1 Aug 2021 07:11: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 4Gcskd21dFz51lQ; Sun, 1 Aug 2021 07:11: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 2D9AB2796E; Sun, 1 Aug 2021 07:11: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 1717Bb3G017408; Sun, 1 Aug 2021 07:11:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1717Bbuv017407; Sun, 1 Aug 2021 07:11:37 GMT (envelope-from git) Date: Sun, 1 Aug 2021 07:11:37 GMT Message-Id: <202108010711.1717Bbuv017407@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: bbb539b83cec - main - loader: cstyle cleanup of libsa/lseek.c 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: bbb539b83ceced2d355893ead5987193737833fd 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, 01 Aug 2021 07:11:37 -0000 The branch main has been updated by tsoome: URL: https://cgit.FreeBSD.org/src/commit/?id=bbb539b83ceced2d355893ead5987193737833fd commit bbb539b83ceced2d355893ead5987193737833fd Author: Toomas Soome AuthorDate: 2021-08-01 07:07:32 +0000 Commit: Toomas Soome CommitDate: 2021-08-01 07:11:17 +0000 loader: cstyle cleanup of libsa/lseek.c Clean up lseek.c, no functional changes intended. This is pre-patch for open file list rewrite. MFC after: 1 week --- stand/libsa/lseek.c | 137 ++++++++++++++++++++++++++-------------------------- 1 file changed, 69 insertions(+), 68 deletions(-) diff --git a/stand/libsa/lseek.c b/stand/libsa/lseek.c index df2591acd76d..1a39eb31421b 100644 --- a/stand/libsa/lseek.c +++ b/stand/libsa/lseek.c @@ -32,30 +32,30 @@ * SUCH DAMAGE. * * @(#)lseek.c 8.1 (Berkeley) 6/11/93 - * + * * * Copyright (c) 1989, 1990, 1991 Carnegie Mellon University * All Rights Reserved. * * Author: Alessandro Forin - * + * * Permission to use, copy, modify and distribute this software and its * documentation is hereby granted, provided that both the copyright * notice and this permission notice appear in all copies of the * software, derivative works or modified versions, and any portions * thereof, and that both notices appear in supporting documentation. - * + * * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * + * * Carnegie Mellon requests users of this software to return to - * + * * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU * School of Computer Science * Carnegie Mellon University * Pittsburgh PA 15213-3890 - * + * * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. */ @@ -68,74 +68,75 @@ __FBSDID("$FreeBSD$"); off_t lseek(int fd, off_t offset, int where) { - off_t bufpos, filepos, target; - struct open_file *f = &files[fd]; + off_t bufpos, filepos, target; + struct open_file *f = &files[fd]; - if ((unsigned)fd >= SOPEN_MAX || f->f_flags == 0) { - errno = EBADF; - return (-1); - } - - if (f->f_flags & F_RAW) { - /* - * On RAW devices, update internal offset. - */ - switch (where) { - case SEEK_SET: - f->f_offset = offset; - break; - case SEEK_CUR: - f->f_offset += offset; - break; - default: - errno = EOFFSET; - return (-1); + if ((unsigned)fd >= SOPEN_MAX || f->f_flags == 0) { + errno = EBADF; + return (-1); } - return (f->f_offset); - } - /* - * If there is some unconsumed data in the readahead buffer and it - * contains the desired offset, simply adjust the buffer offset and - * length. We don't bother with SEEK_END here, since the code to - * handle it would fail in the same cases where the non-readahead - * code fails (namely, for streams which cannot seek backward and whose - * size isn't known in advance). - */ - if (f->f_ralen != 0 && where != SEEK_END) { - if ((filepos = (f->f_ops->fo_seek)(f, (off_t)0, SEEK_CUR)) == -1) - return (-1); - bufpos = filepos - f->f_ralen; - switch (where) { - case SEEK_SET: - target = offset; - break; - case SEEK_CUR: - target = bufpos + offset; - break; - default: - errno = EINVAL; - return (-1); + if (f->f_flags & F_RAW) { + /* + * On RAW devices, update internal offset. + */ + switch (where) { + case SEEK_SET: + f->f_offset = offset; + break; + case SEEK_CUR: + f->f_offset += offset; + break; + default: + errno = EOFFSET; + return (-1); + } + return (f->f_offset); } - if (bufpos <= target && target < filepos) { - f->f_raoffset += target - bufpos; - f->f_ralen -= target - bufpos; - return (target); + + /* + * If there is some unconsumed data in the readahead buffer and it + * contains the desired offset, simply adjust the buffer offset and + * length. We don't bother with SEEK_END here, since the code to + * handle it would fail in the same cases where the non-readahead + * code fails (namely, for streams which cannot seek backward and whose + * size isn't known in advance). + */ + if (f->f_ralen != 0 && where != SEEK_END) { + filepos = (f->f_ops->fo_seek)(f, 0, SEEK_CUR); + if (filepos == -1) + return (-1); + bufpos = filepos - f->f_ralen; + switch (where) { + case SEEK_SET: + target = offset; + break; + case SEEK_CUR: + target = bufpos + offset; + break; + default: + errno = EINVAL; + return (-1); + } + if (bufpos <= target && target < filepos) { + f->f_raoffset += target - bufpos; + f->f_ralen -= target - bufpos; + return (target); + } } - } - /* - * If this is a relative seek, we need to correct the offset for - * bytes that we have already read but the caller doesn't know - * about. - */ - if (where == SEEK_CUR) - offset -= f->f_ralen; + /* + * If this is a relative seek, we need to correct the offset for + * bytes that we have already read but the caller doesn't know + * about. + */ + if (where == SEEK_CUR) + offset -= f->f_ralen; - /* - * Invalidate the readahead buffer. - */ - f->f_ralen = 0; + /* + * Invalidate the readahead buffer. + */ + f->f_ralen = 0; - return (f->f_ops->fo_seek)(f, offset, where); + return (f->f_ops->fo_seek)(f, offset, where); } From owner-dev-commits-src-all@freebsd.org Sun Aug 1 09:14: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 BEFE466F43B; Sun, 1 Aug 2021 09:14: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 4GcwS54qGWz3Dt2; Sun, 1 Aug 2021 09:14: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 8D8851732; Sun, 1 Aug 2021 09:14: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 1719EDK6080986; Sun, 1 Aug 2021 09:14:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1719EDsK080985; Sun, 1 Aug 2021 09:14:13 GMT (envelope-from git) Date: Sun, 1 Aug 2021 09:14:13 GMT Message-Id: <202108010914.1719EDsK080985@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wolfram Schneider Subject: git: 99feb137f5f6 - main - `make buildworld' with time logging for each stage MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wosch X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 99feb137f5f66f903bba816c1d98ced2a92bef12 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, 01 Aug 2021 09:14:13 -0000 The branch main has been updated by wosch: URL: https://cgit.FreeBSD.org/src/commit/?id=99feb137f5f66f903bba816c1d98ced2a92bef12 commit 99feb137f5f66f903bba816c1d98ced2a92bef12 Author: Wolfram Schneider AuthorDate: 2021-08-01 09:10:49 +0000 Commit: Wolfram Schneider CommitDate: 2021-08-01 09:10:49 +0000 `make buildworld' with time logging for each stage PR: 257141 Reviewed by: sjg,emaste Approved by: emaste Differential Revision: https://reviews.freebsd.org/D31154 --- Makefile.inc1 | 13 +++++++------ Makefile.libcompat | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index 9ef954e0678c..3d54a088d070 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -59,6 +59,7 @@ _MKSHOWCONFIG= t SRCDIR?= ${.CURDIR} LOCALBASE?= /usr/local +TIME_ENV ?= time env .include "share/mk/src.tools.mk" @@ -722,7 +723,7 @@ BSARGS= DESTDIR= \ MK_INCLUDES=yes BMAKE= \ - ${BMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \ + ${TIME_ENV} ${BMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \ ${BSARGS} .if empty(.MAKEOVERRIDES:MMK_LLVM_TARGET_ALL) BMAKE+= MK_LLVM_TARGET_ALL=no @@ -730,7 +731,7 @@ BMAKE+= MK_LLVM_TARGET_ALL=no # build-tools stage TMAKE= \ - ${BMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \ + ${TIME_ENV} ${BMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \ TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ DESTDIR= \ BOOTSTRAPPING=${BOOTSTRAPPING_OSRELDATE} \ @@ -754,7 +755,7 @@ KTMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \ WORLDTMP=${WORLDTMP} \ MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" -KTMAKE= \ +KTMAKE= ${TIME_ENV} \ TOOLS_PREFIX=${TOOLS_PREFIX_UNDEF:U${WORLDTMP}} \ ${KTMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \ DESTDIR= \ @@ -882,12 +883,12 @@ host-osreldate.h: # DO NOT ADD /usr/include/osreldate.h here @echo "#endif" >> ${.TARGET} .endif -WMAKE= ${WMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \ +WMAKE= ${TIME_ENV} ${WMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \ BWPHASE=${.TARGET:C,^_,,} \ DESTDIR=${WORLDTMP} IMAKEENV= ${CROSSENV} -IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1 \ +IMAKE= ${TIME_ENV} ${IMAKEENV} ${MAKE} -f Makefile.inc1 \ ${IMAKE_INSTALL} ${IMAKE_MTREE} .if empty(.MAKEFLAGS:M-n) IMAKEENV+= PATH=${STRICTTMPPATH}:${INSTALLTMP} \ @@ -951,7 +952,7 @@ DESTDIR_MTREE= ${DISTR_MTREE} ${DESTDIR_MTREEFLAGS} # kernel stage KMAKEENV= ${WMAKEENV:NSYSROOT=*} -KMAKE= ${KMAKEENV} ${MAKE} ${.MAKEFLAGS} ${KERNEL_FLAGS} KERNEL=${INSTKERNNAME} +KMAKE= ${TIME_ENV} ${KMAKEENV} ${MAKE} ${.MAKEFLAGS} ${KERNEL_FLAGS} KERNEL=${INSTKERNNAME} # # buildworld diff --git a/Makefile.libcompat b/Makefile.libcompat index 779bcb163cf7..c400cef6fbe3 100644 --- a/Makefile.libcompat +++ b/Makefile.libcompat @@ -28,7 +28,7 @@ LIBCOMPATWMAKEFLAGS+= CC="${XCC} ${LIBCOMPATCFLAGS}" \ MK_CTF=no \ -DNO_LINT \ MK_TESTS=no -LIBCOMPATWMAKE+= ${LIBCOMPATWMAKEENV} ${MAKE} ${LIBCOMPATWMAKEFLAGS} \ +LIBCOMPATWMAKE+= ${TIME_ENV} ${LIBCOMPATWMAKEENV} ${MAKE} ${LIBCOMPATWMAKEFLAGS} \ OBJTOP=${LIBCOMPAT_OBJTOP} \ OBJROOT='$${OBJTOP}/' \ MAKEOBJDIRPREFIX= \ From owner-dev-commits-src-all@freebsd.org Sun Aug 1 09:51: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 9436F659540; Sun, 1 Aug 2021 09:51: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 4GcxHD3kVlz3K8w; Sun, 1 Aug 2021 09:51: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 686191EC6; Sun, 1 Aug 2021 09:51: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 1719paoT033828; Sun, 1 Aug 2021 09:51:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1719pa1r033827; Sun, 1 Aug 2021 09:51:36 GMT (envelope-from git) Date: Sun, 1 Aug 2021 09:51:36 GMT Message-Id: <202108010951.1719pa1r033827@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: 60fb9e10c74c - main - cam: enable kern.cam.da.enable_uma_ccbs by default MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 60fb9e10c74cfca8656181dd238fcf966bc3f5c8 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, 01 Aug 2021 09:51:36 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=60fb9e10c74cfca8656181dd238fcf966bc3f5c8 commit 60fb9e10c74cfca8656181dd238fcf966bc3f5c8 Author: Edward Tomasz Napierala AuthorDate: 2021-08-01 09:40:38 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-08-01 09:40:42 +0000 cam: enable kern.cam.da.enable_uma_ccbs by default This makes the da(4) driver use UMA for its CCBs by default, like ada(4) already does. Please let me know via email if you notice any suspicious kernel messages, Reviewed By: imp Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D31257 --- sys/cam/scsi/scsi_da.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/cam/scsi/scsi_da.c b/sys/cam/scsi/scsi_da.c index ad4c2611333a..676bf33d0bf8 100644 --- a/sys/cam/scsi/scsi_da.c +++ b/sys/cam/scsi/scsi_da.c @@ -1558,7 +1558,7 @@ static sbintime_t da_default_softtimeout = DA_DEFAULT_SOFTTIMEOUT; static int da_send_ordered = DA_DEFAULT_SEND_ORDERED; static int da_disable_wp_detection = 0; static int da_enable_biospeedup = 1; -static int da_enable_uma_ccbs = 0; +static int da_enable_uma_ccbs = 1; static SYSCTL_NODE(_kern_cam, OID_AUTO, da, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "CAM Direct Access Disk driver"); From owner-dev-commits-src-all@freebsd.org Sun Aug 1 10:32: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 E21FC65A899; Sun, 1 Aug 2021 10:32:43 +0000 (UTC) (envelope-from vishwin@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 4GcyBg5jCyz3N4d; Sun, 1 Aug 2021 10:32:43 +0000 (UTC) (envelope-from vishwin@freebsd.org) Received: from [IPv6:2601:98a:600:3c20:56ee:75ff:fe50:69b5] (unknown [IPv6:2601:98a:600:3c20:56ee:75ff:fe50:69b5]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: vishwin/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 7C45E20463; Sun, 1 Aug 2021 10:32:43 +0000 (UTC) (envelope-from vishwin@freebsd.org) To: Hans Petter Selasky , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202107311338.16VDcaSh006994@gitrepo.freebsd.org> From: Charlie Li Subject: Re: git: 469884cf04a9 - main - LinuxKPI: Make FPU sections thread-safe and use the NOCTX flag. Organization: FreeBSD Project Message-ID: Date: Sun, 1 Aug 2021 06:32:42 -0400 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: <202107311338.16VDcaSh006994@gitrepo.freebsd.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="yxdJvIGndVFNqJYJvYkKUhs4OFIEbWq1c" X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-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, 01 Aug 2021 10:32:44 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --yxdJvIGndVFNqJYJvYkKUhs4OFIEbWq1c Content-Type: multipart/mixed; boundary="OZp0Dhagv1rCNgNjuIQvYqG2kmBGhWQku"; protected-headers="v1" From: Charlie Li To: Hans Petter Selasky , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Message-ID: Subject: Re: git: 469884cf04a9 - main - LinuxKPI: Make FPU sections thread-safe and use the NOCTX flag. References: <202107311338.16VDcaSh006994@gitrepo.freebsd.org> In-Reply-To: <202107311338.16VDcaSh006994@gitrepo.freebsd.org> --OZp0Dhagv1rCNgNjuIQvYqG2kmBGhWQku Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: quoted-printable 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 >=20 > LinuxKPI: Make FPU sections thread-safe and use the NOCTX flag. > =20 > 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(-) >=20 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 --=20 Charlie Li =E2=80=A6nope, still don't have an exit line. --OZp0Dhagv1rCNgNjuIQvYqG2kmBGhWQku-- --yxdJvIGndVFNqJYJvYkKUhs4OFIEbWq1c Content-Type: application/pgp-signature; name="OpenPGP_signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="OpenPGP_signature" -----BEGIN PGP SIGNATURE----- wsF5BAABCAAjFiEEJXd5utNNhpeHcBMx/reFK+KbPocFAmEGeEoFAwAAAAAACgkQ/reFK+KbPofQ ERAAhyNv5UqpLEUf5BfqlYkjuMeXL0Txz1gQ3t5IEtYr0w9g0BAzmNvSNC9Xb+MbGvur6ayNzhSj GQmqBIUQt4/hrmx8oyQ1owiKgMbn8Ig2FH4M0579XIZAKbHm3nTW9xUXIEmnFG+/GfbYbwO5wwfD VZNFX1/lDw3XnWwFHaD9sWFxK6ZgKvNhvUUJ0Ea1LUexLoELtQXia089yGv7A30iVFtPt0dY1YK7 vYMgOf6GM6JXtEnpy5EzddqXjm2VGrtn1H9/oJP9ApcMAjns+huMHlQ8orz+Br6tUl/XnX60goyS BPUhveAeE120RCZ6RzYAh6kA5+oVvQxh71Hr/vIARrVXM/0CDhEV+mB0SqtkfWpVpLyYwp5+vb1u SUaMkEtlBTXG3IK15MFmoDrbsjMIR207SOgsib1TQFQME9n1ZJYXzpiC4oo2gZS/60UDeKM1F5j2 8QcExQlE5IKbE5Eaxh9rIOefn4X8Iq0ZjVdUQ4H+C0wLvQ/+qmRcWctikqFye5koQlq3ICm7IiVO lHJyjy0fMGL6Ca3LRCbWiz2/9mbdM61kLFKRF3axXZZwtl711aMRGZ+hHvUmGuxZG+OjeyWixD0X F/e11lyJM9F5Ol4N7cjMXfzXjSGzKfm27QqDzXYTENdq/llsJ0JT4sN70kLXFfjtsTbcXFzLqV64 /uM= =Esxi -----END PGP SIGNATURE----- --yxdJvIGndVFNqJYJvYkKUhs4OFIEbWq1c-- From owner-dev-commits-src-all@freebsd.org Sun Aug 1 10:50: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 B510165ADE0; Sun, 1 Aug 2021 10:50: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 4GcybC4VQcz3NHh; Sun, 1 Aug 2021 10:50: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 829272AFC; Sun, 1 Aug 2021 10:50: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 171AoVq7010044; Sun, 1 Aug 2021 10:50:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 171AoViq010043; Sun, 1 Aug 2021 10:50:31 GMT (envelope-from git) Date: Sun, 1 Aug 2021 10:50:31 GMT Message-Id: <202108011050.171AoViq010043@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: 054948bd81bb - main - [multipath][nhops] Fix random crashes with high route churn rate. 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: 054948bd81bb9e4e32449cf351b62e501b8831ff 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, 01 Aug 2021 10:50:31 -0000 The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=054948bd81bb9e4e32449cf351b62e501b8831ff commit 054948bd81bb9e4e32449cf351b62e501b8831ff Author: Alexander V. Chernikov AuthorDate: 2021-08-01 09:46:05 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-08-01 10:07:37 +0000 [multipath][nhops] Fix random crashes with high route churn rate. When certain multipath route begins flapping really fast, it may result in creating multiple identical nexthop groups. The code responsible for unlinking unused nexthop groups had an implicit assumption that there could be only one nexthop group for the same combination of nexthops with weights. This assumption resulted in always unlinking the first "identical" group, instead of the desired one. Such action, in turn, produced a used-but-unlinked nhg along with freed-and-linked nhg, ending up in random crashes. Similarly, it is possible that multiple identical nexthops gets created in the case of high route churn, resulting in the same problem when deleting one of such nexthops. Fix by matching the nexthop/nexhop group pointer when deleting the item. Reported by: avg MFC after: 1 week --- sys/net/route/nhgrp.c | 2 +- sys/net/route/nhop.c | 2 +- sys/net/route/nhop_utils.h | 23 +++-------------------- 3 files changed, 5 insertions(+), 22 deletions(-) diff --git a/sys/net/route/nhgrp.c b/sys/net/route/nhgrp.c index f763cc25fd5c..982ff2a72f15 100644 --- a/sys/net/route/nhgrp.c +++ b/sys/net/route/nhgrp.c @@ -187,7 +187,7 @@ unlink_nhgrp(struct nh_control *ctl, struct nhgrp_priv *key) NHOPS_WLOCK(ctl); - CHT_SLIST_REMOVE_BYOBJ(&ctl->gr_head, mpath, key, nhg_priv_ret); + CHT_SLIST_REMOVE(&ctl->gr_head, mpath, key, nhg_priv_ret); if (nhg_priv_ret == NULL) { DPRINTF("Unable to find nhop group!"); diff --git a/sys/net/route/nhop.c b/sys/net/route/nhop.c index 0db47db9916e..ab5e393ae56a 100644 --- a/sys/net/route/nhop.c +++ b/sys/net/route/nhop.c @@ -337,7 +337,7 @@ unlink_nhop(struct nh_control *ctl, struct nhop_priv *nh_priv_del) idx = 0; NHOPS_WLOCK(ctl); - CHT_SLIST_REMOVE_BYOBJ(&ctl->nh_head, nhops, nh_priv_del, priv_ret); + CHT_SLIST_REMOVE(&ctl->nh_head, nhops, nh_priv_del, priv_ret); if (priv_ret != NULL) { idx = priv_ret->nh_idx; diff --git a/sys/net/route/nhop_utils.h b/sys/net/route/nhop_utils.h index a0d7cd564e72..1f56f4cb8b0b 100644 --- a/sys/net/route/nhop_utils.h +++ b/sys/net/route/nhop_utils.h @@ -115,31 +115,13 @@ struct _HNAME##_head { \ (_head)->items_count++; \ } while(0) -#define CHT_SLIST_REMOVE(_head, _PX, _key, _ret) do { \ - typeof(*(_head)->ptr) _tmp; \ - uint32_t _buck = CHT_GET_BUCK(_head, _PX, _key); \ - _ret = CHT_FIRST(_head, _buck); \ - _tmp = NULL; \ - for ( ; _ret != NULL; _tmp = _ret, _ret = _PX##_next(_ret)) { \ - if (_PX##_cmp(_key, _ret)) \ - break; \ - } \ - if (_ret != NULL) { \ - if (_tmp == NULL) \ - CHT_FIRST(_head, _buck) = _PX##_next(_ret); \ - else \ - _PX##_next(_tmp) = _PX##_next(_ret); \ - (_head)->items_count--; \ - } \ -} while(0) - -#define CHT_SLIST_REMOVE_BYOBJ(_head, _PX, _obj, _ret) do { \ +#define CHT_SLIST_REMOVE(_head, _PX, _obj, _ret) do { \ typeof(*(_head)->ptr) _tmp; \ uint32_t _buck = CHT_GET_BUCK_OBJ(_head, _PX, _obj); \ _ret = CHT_FIRST(_head, _buck); \ _tmp = NULL; \ for ( ; _ret != NULL; _tmp = _ret, _ret = _PX##_next(_ret)) { \ - if (_PX##_cmp(_obj, _ret)) \ + if (_obj == _ret) \ break; \ } \ if (_ret != NULL) { \ @@ -150,6 +132,7 @@ struct _HNAME##_head { \ (_head)->items_count--; \ } \ } while(0) +#define CHT_SLIST_REMOVE_BYOBJ CHT_SLIST_REMOVE #define CHT_SLIST_FOREACH(_head, _PX, _x) \ for (uint32_t _i = 0; _i < (_head)->hash_size; _i++) { \ From owner-dev-commits-src-all@freebsd.org Sun Aug 1 12:57: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 0E36965E97C; Sun, 1 Aug 2021 12:57: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 4Gd1Px6ls6z3t7s; Sun, 1 Aug 2021 12:57: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 CC43F494D; Sun, 1 Aug 2021 12:57: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 171CvfUH075455; Sun, 1 Aug 2021 12:57:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 171CvfgV075454; Sun, 1 Aug 2021 12:57:41 GMT (envelope-from git) Date: Sun, 1 Aug 2021 12:57:41 GMT Message-Id: <202108011257.171CvfgV075454@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Tom Jones Subject: git: 44752e92e134 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 44752e92e134167e9a0ecd277e32608a5595e6d1 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, 01 Aug 2021 12:57:42 -0000 The branch main has been updated by thj: URL: https://cgit.FreeBSD.org/src/commit/?id=44752e92e134167e9a0ecd277e32608a5595e6d1 commit 44752e92e134167e9a0ecd277e32608a5595e6d1 Author: Tom Jones AuthorDate: 2021-08-01 12:52:07 +0000 Commit: Tom Jones CommitDate: 2021-08-01 12:55:24 +0000 Correct section reference for examples in RFC3542 Reviewed by: bz, network MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D26272 --- 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 Sun Aug 1 13:27:40 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 01ACB65F6F3; Sun, 1 Aug 2021 13:27: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 4Gd24W6Sbjz4RdS; Sun, 1 Aug 2021 13:27: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 C243A5096; Sun, 1 Aug 2021 13:27: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 171DRdKQ015959; Sun, 1 Aug 2021 13:27:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 171DRdpv015958; Sun, 1 Aug 2021 13:27:39 GMT (envelope-from git) Date: Sun, 1 Aug 2021 13:27:39 GMT Message-Id: <202108011327.171DRdpv015958@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wolfram Schneider Subject: git: bbd16236e986 - main - add the time(1) command to the list of install tools MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wosch X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bbd16236e986ef1b0e1da37c9c8a7f9dd2d63b5d 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, 01 Aug 2021 13:27:40 -0000 The branch main has been updated by wosch: URL: https://cgit.FreeBSD.org/src/commit/?id=bbd16236e986ef1b0e1da37c9c8a7f9dd2d63b5d commit bbd16236e986ef1b0e1da37c9c8a7f9dd2d63b5d Author: Wolfram Schneider AuthorDate: 2021-08-01 13:25:00 +0000 Commit: Wolfram Schneider CommitDate: 2021-08-01 13:25:00 +0000 add the time(1) command to the list of install tools Reported by: dhw Approved by: dhw Differential Revision: https://reviews.freebsd.org/D31373 --- Makefile.inc1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index 3d54a088d070..213b32a97ed3 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -1300,7 +1300,7 @@ _sysctl=sysctl ITOOLS= [ awk cap_mkdb cat chflags chmod chown cmp cp \ date echo egrep find grep id install ${_install-info} \ ln make mkdir mtree mv pwd_mkdb \ - rm sed services_mkdb sh sort strip ${_sysctl} test true uname wc \ + rm sed services_mkdb sh sort strip ${_sysctl} test time true uname wc \ ${_zoneinfo} ${LOCAL_ITOOLS} # Needed for share/man From owner-dev-commits-src-all@freebsd.org Sun Aug 1 13:41: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 2801165FC58; Sun, 1 Aug 2021 13:41: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 4Gd2N30DqPz4Stx; Sun, 1 Aug 2021 13:41: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 E47EB51F9; Sun, 1 Aug 2021 13:41: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 171Df6jF037671; Sun, 1 Aug 2021 13:41:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 171Df6cZ037670; Sun, 1 Aug 2021 13:41:06 GMT (envelope-from git) Date: Sun, 1 Aug 2021 13:41:06 GMT Message-Id: <202108011341.171Df6cZ037670@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: 5b42b494d543 - main - Fix typo in rib_unsibscribe<_locked>(). 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: 5b42b494d54365254176dd0ef688cd96edabe657 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, 01 Aug 2021 13:41:07 -0000 The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=5b42b494d54365254176dd0ef688cd96edabe657 commit 5b42b494d54365254176dd0ef688cd96edabe657 Author: Alexander V. Chernikov AuthorDate: 2021-08-01 13:28:41 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-08-01 13:29:52 +0000 Fix typo in rib_unsibscribe<_locked>(). Submitted by: Zhenlei Huang Differential Revision: https://reviews.freebsd.org/D31356 --- sys/net/route/fib_algo.c | 2 +- sys/net/route/route_ctl.c | 4 ++-- sys/net/route/route_ctl.h | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sys/net/route/fib_algo.c b/sys/net/route/fib_algo.c index 3a09408c92b1..4bae9e5edd6c 100644 --- a/sys/net/route/fib_algo.c +++ b/sys/net/route/fib_algo.c @@ -1028,7 +1028,7 @@ schedule_destroy_fd_instance(struct fib_data *fd, bool in_callout) FD_PRINTF(LOG_INFO, fd, "DETACH"); if (fd->fd_rs != NULL) - rib_unsibscribe_locked(fd->fd_rs); + rib_unsubscribe_locked(fd->fd_rs); /* * After rib_unsubscribe() no _new_ handle_rtable_change_cb() calls diff --git a/sys/net/route/route_ctl.c b/sys/net/route/route_ctl.c index a0c4a2283a00..582901d67a8d 100644 --- a/sys/net/route/route_ctl.c +++ b/sys/net/route/route_ctl.c @@ -1477,7 +1477,7 @@ rib_subscribe_locked(struct rib_head *rnh, rib_subscription_cb_t *f, void *arg, * Needs to be run in network epoch. */ void -rib_unsibscribe(struct rib_subscription *rs) +rib_unsubscribe(struct rib_subscription *rs) { struct rib_head *rnh = rs->rnh; @@ -1492,7 +1492,7 @@ rib_unsibscribe(struct rib_subscription *rs) } void -rib_unsibscribe_locked(struct rib_subscription *rs) +rib_unsubscribe_locked(struct rib_subscription *rs) { struct rib_head *rnh = rs->rnh; diff --git a/sys/net/route/route_ctl.h b/sys/net/route/route_ctl.h index 4fe45cc8a970..229c762d4a73 100644 --- a/sys/net/route/route_ctl.h +++ b/sys/net/route/route_ctl.h @@ -154,7 +154,7 @@ struct rib_subscription *rib_subscribe_internal(struct rib_head *rnh, bool waitok); struct rib_subscription *rib_subscribe_locked(struct rib_head *rnh, rib_subscription_cb_t *f, void *arg, enum rib_subscription_type type); -void rib_unsibscribe(struct rib_subscription *rs); -void rib_unsibscribe_locked(struct rib_subscription *rs); +void rib_unsubscribe(struct rib_subscription *rs); +void rib_unsubscribe_locked(struct rib_subscription *rs); #endif From owner-dev-commits-src-all@freebsd.org Sun Aug 1 13:42: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 3031D65FBD8; Sun, 1 Aug 2021 13:42: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 4Gd2PN0wXtz4TDb; Sun, 1 Aug 2021 13:42: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 07FF150E8; Sun, 1 Aug 2021 13:42: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 171DgFtC041762; Sun, 1 Aug 2021 13:42:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 171DgFMd041761; Sun, 1 Aug 2021 13:42:15 GMT (envelope-from git) Date: Sun, 1 Aug 2021 13:42:15 GMT Message-Id: <202108011342.171DgFMd041761@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: 1a55a3a729cd - main - amd64 pmap_vm_page_alloc_check(): print more data for failed 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: 1a55a3a729cd4424e17308d3e86b54b9a6e68f7b 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, 01 Aug 2021 13:42:16 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=1a55a3a729cd4424e17308d3e86b54b9a6e68f7b commit 1a55a3a729cd4424e17308d3e86b54b9a6e68f7b Author: Konstantin Belousov AuthorDate: 2021-08-01 13:38:17 +0000 Commit: Konstantin Belousov CommitDate: 2021-08-01 13:42:02 +0000 amd64 pmap_vm_page_alloc_check(): print more data for failed assert Sponsored by: The FreeBSD Foundation MFC after: 1 week --- sys/amd64/include/pmap.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/amd64/include/pmap.h b/sys/amd64/include/pmap.h index 401eae0044f9..518dc544ac0d 100644 --- a/sys/amd64/include/pmap.h +++ b/sys/amd64/include/pmap.h @@ -458,7 +458,8 @@ extern int invpcid_works; #define pmap_vm_page_alloc_check(m) \ KASSERT(m->phys_addr < kernphys || m->phys_addr >= KERNend, \ - ("allocating kernel page %p", m)); + ("allocating kernel page %p pa %#lx kernphys %#lx kernend %#lx", \ + m, m->phys_addr, kernphys, KERNend)); struct thread; From owner-dev-commits-src-all@freebsd.org Sun Aug 1 15:09: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 A05D8660A2C; Sun, 1 Aug 2021 15:09: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 4Gd4Kf3xGDz4bVj; Sun, 1 Aug 2021 15:09: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 6AD69644F; Sun, 1 Aug 2021 15:09: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 171F9AvQ049396; Sun, 1 Aug 2021 15:09:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 171F9Apn049395; Sun, 1 Aug 2021 15:09:10 GMT (envelope-from git) Date: Sun, 1 Aug 2021 15:09:10 GMT Message-Id: <202108011509.171F9Apn049395@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: a61c24ddb7d6 - main - udp: Fix soroverflow SOCKBUF unlocking 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/main X-Git-Reftype: branch X-Git-Commit: a61c24ddb7d677337d6184ffcee34a6e902d72d7 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, 01 Aug 2021 15:09:10 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=a61c24ddb7d677337d6184ffcee34a6e902d72d7 commit a61c24ddb7d677337d6184ffcee34a6e902d72d7 Author: Konstantin Kukushkin AuthorDate: 2021-08-01 14:41:38 +0000 Commit: Kevin Bowling CommitDate: 2021-08-01 15:07:33 +0000 udp: Fix soroverflow SOCKBUF unlocking We hold the SOCKBUF_LOCK so use soroverflow_locked here. This bug may manifest as a non-killable process stuck in [*so_rcv]. Approved by: scottl Reviewed by: Roy Marples Fixes: 7045b1603bdf MFC after: 10 days Differential Revision: https://reviews.freebsd.org/D31374 --- sys/netinet/udp_usrreq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c index ed79ddce5109..76ed063391eb 100644 --- a/sys/netinet/udp_usrreq.c +++ b/sys/netinet/udp_usrreq.c @@ -379,7 +379,7 @@ udp_append(struct inpcb *inp, struct ip *ip, struct mbuf *n, int off, so = inp->inp_socket; SOCKBUF_LOCK(&so->so_rcv); if (sbappendaddr_locked(&so->so_rcv, append_sa, n, opts) == 0) { - soroverflow(so); + soroverflow_locked(so); m_freem(n); if (opts) m_freem(opts); From owner-dev-commits-src-all@freebsd.org Sun Aug 1 16:20: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 BA255661CEC for ; Sun, 1 Aug 2021 16:20: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 4Gd5vQ4z3Hz4k7R; Sun, 1 Aug 2021 16:20: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 83DB17358; Sun, 1 Aug 2021 16:20: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 171GK2hn045458; Sun, 1 Aug 2021 16:20:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 171GK2Fn045455; Sun, 1 Aug 2021 16:20:02 GMT (envelope-from git) Date: Sun, 1 Aug 2021 16:20:02 GMT Message-Id: <202108011620.171GK2Fn045455@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Warner Losh Subject: git: 3c2508565f71 - Create tag vendor/one-true-awk/0592de4a 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/tags/vendor/one-true-awk/0592de4a X-Git-Reftype: annotated tag X-Git-Commit: 3c2508565f71d78cdae04c29dc0e5070b077c7c5 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, 01 Aug 2021 16:20:02 -0000 The annotated tag vendor/one-true-awk/0592de4a has been created by imp: URL: https://cgit.FreeBSD.org/src/tag/?h=vendor/one-true-awk/0592de4a tag vendor/one-true-awk/0592de4a Tagger: Warner Losh TaggerDate: 2021-08-01 16:18:51 +0000 awk: import 20210729 from upstream Changes since last import: July 27, 2021: As per IEEE Std 1003.1-2008, -F "str" is now consistent with -v FS="str" when str is null. Thanks to Warner Losh. July 24, 2021: Fix readrec's definition of a record. This fixes an issue with NetBSD's RS regular expression support that can cause an infinite read loop. Thanks to Miguel Pineiro Jr. Fix regular expression RS ^-anchoring. RS ^-anchoring needs to know if it is reading the first record of a file. This change restores a missing line that was overlooked when porting NetBSD's RS regex functionality. Thanks to Miguel Pineiro Jr. Fix size computation in replace_repeat() for special case REPEAT_WITH_Q. Thanks to Todd C. Miller. -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQJEBAABCgAuFiEEIDX4lLAKo898zeG3bBzRKH2wEQAFAmEGyW0QHGltcEBmcmVl YnNkLm9yZwAKCRBsHNEofbARAKOTEACTvtq64/aesbVuyyp8qY31hm/mn4ZaZmrq QXuvZFR2UbnfVD385g4nagmLyVf9hAEMydvJUScU1l9UIWyP/rYoGSTp5dL/hnfU z3infO4agCESLXyc0gOv92Om5g1Rym89VkLorClheF6kzMj6wlbqGwnB8Vnj5HFb NsTU09TzYYFFQi0SVUaqSC+I+I3uuXzINBqWni8X54qj/hRGeXEowSXc4lbYyWK4 1X+kC2OWc96eT4qqZ4/ECH05QQ/c8odcKY/pmNHRx5QAgANnL3DNqYe3CXUdiePc re+t0NjtyEVub9enK1PzUhtQyXEjD0/ZOa5kynHDufFOya5jrh7UwTjSz28qyco9 dSBBM+N37fC6kmd4wrQNaFE8F+jot45i8vmdczAjDy2O1TZo4Pp846L7dJMjHIcy Rp+euGSK1MukASQyOMrm7P3amCV6XDd3z+RxMwXw8TJn9i6pjA/9v3KiKiUIncQz ugkeCU22kqpTgRUSi8uZevrMBxOq6eYu8qVj81/85xmgOBHMAuGXYwvKy/75tC1y a4+O/WVt1DmqAQbqI5P9X3PTRwVd3z5mOkT6f5CdGVUWlJk7vDsQL3HP3nWcFVdL ZAL7P/KxWJseZ+Vg1xpOZdUOzQwNhJInGPjHGeugZF8/dwquUcK4DFtDHnfWk60M V5HHIxqzUQ== =WP8j -----END PGP SIGNATURE----- commit f9002b85613065121199880071419cf6fbda050f Author: Warner Losh AuthorDate: 2021-08-01 16:02:22 +0000 Commit: Warner Losh CommitDate: 2021-08-01 16:04:30 +0000 awk: bring in vendor branch from upstream 20210727 Changes since the last import: July 27, 2021: As per IEEE Std 1003.1-2008, -F "str" is now consistent with -v FS="str" when str is null. Thanks to Warner Losh. July 24, 2021: Fix readrec's definition of a record. This fixes an issue with NetBSD's RS regular expression support that can cause an infinite read loop. Thanks to Miguel Pineiro Jr. Fix regular expression RS ^-anchoring. RS ^-anchoring needs to know if it is reading the first record of a file. This change restores a missing line that was overlooked when porting NetBSD's RS regex functionality. Thanks to Miguel Pineiro Jr. Fix size computation in replace_repeat() for special case REPEAT_WITH_Q. Thanks to Todd C. Miller. Also, for the first time, import all the tests. Sponsored by: Netflix From owner-dev-commits-src-all@freebsd.org Sun Aug 1 16:20: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 9C4A0661467 for ; Sun, 1 Aug 2021 16:20: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 4Gd5vQ42j9z4jtC; Sun, 1 Aug 2021 16:20: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 68BD3759B; Sun, 1 Aug 2021 16:20: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 171GK2KH045420; Sun, 1 Aug 2021 16:20:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 171GK2tK045417; Sun, 1 Aug 2021 16:20:02 GMT (envelope-from git) Date: Sun, 1 Aug 2021 16:20:02 GMT Message-Id: <202108011620.171GK2tK045417@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Warner Losh Subject: git: 746b7396bb3e..f9002b856130 - vendor/one-true-awk - vendor branch updated 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/vendor/one-true-awk X-Git-Reftype: branch X-Git-Commit: f9002b85613065121199880071419cf6fbda050f X-Git-Oldrev: 746b7396bb3e85208573892a0f314e0b4e7dacf4 X-Git-Newrev: f9002b85613065121199880071419cf6fbda050f 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, 01 Aug 2021 16:20:02 -0000 The branch vendor/one-true-awk has been updated by imp: URL: https://cgit.FreeBSD.org/src/log/?id=746b7396bb3e..f9002b856130 f9002b856130 awk: bring in vendor branch from upstream 20210727 From owner-dev-commits-src-all@freebsd.org Sun Aug 1 17:01: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 8BA9F6625D6; Sun, 1 Aug 2021 17:01: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 4Gd6qX3XWJz4qCg; Sun, 1 Aug 2021 17:01: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 62D177BB8; Sun, 1 Aug 2021 17:01: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 171H1iSS006542; Sun, 1 Aug 2021 17:01:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 171H1ijr006537; Sun, 1 Aug 2021 17:01:44 GMT (envelope-from git) Date: Sun, 1 Aug 2021 17:01:44 GMT Message-Id: <202108011701.171H1ijr006537@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: 23f24377b1a9 - main - awk: Merge 20210729 from One True Awk upstream (0592de4a) 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: 23f24377b1a9ab6677f00f2302484d6658d94cab 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, 01 Aug 2021 17:01:44 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=23f24377b1a9ab6677f00f2302484d6658d94cab commit 23f24377b1a9ab6677f00f2302484d6658d94cab Merge: a61c24ddb7d6 f9002b856130 Author: Warner Losh AuthorDate: 2021-08-01 16:22:39 +0000 Commit: Warner Losh CommitDate: 2021-08-01 16:22:39 +0000 awk: Merge 20210729 from One True Awk upstream (0592de4a) July 27, 2021: As per IEEE Std 1003.1-2008, -F "str" is now consistent with -v FS="str" when str is null. Thanks to Warner Losh. July 24, 2021: Fix readrec's definition of a record. This fixes an issue with NetBSD's RS regular expression support that can cause an infinite read loop. Thanks to Miguel Pineiro Jr. Fix regular expression RS ^-anchoring. RS ^-anchoring needs to know if it is reading the first record of a file. This change restores a missing line that was overlooked when porting NetBSD's RS regex functionality. Thanks to Miguel Pineiro Jr. Fix size computation in replace_repeat() for special case REPEAT_WITH_Q. Thanks to Todd C. Miller. Also, included the tests from upstream, though they aren't yet connected to the tree. Sponsored by: Netflix contrib/one-true-awk/FIXES | 17 + contrib/one-true-awk/README.md | 8 +- contrib/one-true-awk/TODO | 19 + contrib/one-true-awk/b.c | 9 +- contrib/one-true-awk/bugs-fixed/REGRESS | 28 + contrib/one-true-awk/bugs-fixed/fs-overflow.ok | 1 + .../one-true-awk/bugs-fixed/inf-nan-torture.awk | 4 + contrib/one-true-awk/bugs-fixed/inf-nan-torture.in | 1 + contrib/one-true-awk/bugs-fixed/inf-nan-torture.ok | 16 + contrib/one-true-awk/bugs-fixed/pfile-overflow.awk | 1 + contrib/one-true-awk/bugs-fixed/pfile-overflow.ok | 4 + contrib/one-true-awk/bugs-fixed/rs_underflow.awk | 1 + contrib/one-true-awk/bugs-fixed/rs_underflow.in | 1 + contrib/one-true-awk/bugs-fixed/rs_underflow.ok | 1 + contrib/one-true-awk/lib.c | 4 +- contrib/one-true-awk/main.c | 2 +- contrib/one-true-awk/testdir/Compare.T1 | 10 + contrib/one-true-awk/testdir/Compare.drek | 35 + contrib/one-true-awk/testdir/Compare.p | 17 + contrib/one-true-awk/testdir/Compare.t | 17 + contrib/one-true-awk/testdir/Compare.tt | 49 + contrib/one-true-awk/testdir/NOTES | 10 + contrib/one-true-awk/testdir/README.TESTS | 44 + contrib/one-true-awk/testdir/REGRESS | 21 + contrib/one-true-awk/testdir/T.-f-f | 35 + contrib/one-true-awk/testdir/T.argv | 144 + contrib/one-true-awk/testdir/T.arnold | 19 + contrib/one-true-awk/testdir/T.beebe | 8 + contrib/one-true-awk/testdir/T.builtin | 90 + contrib/one-true-awk/testdir/T.chem | 11 + contrib/one-true-awk/testdir/T.close | 36 + contrib/one-true-awk/testdir/T.clv | 181 + contrib/one-true-awk/testdir/T.csconcat | 29 + contrib/one-true-awk/testdir/T.delete | 21 + contrib/one-true-awk/testdir/T.errmsg | 215 + contrib/one-true-awk/testdir/T.expr | 235 + contrib/one-true-awk/testdir/T.exprconv | 21 + contrib/one-true-awk/testdir/T.flags | 24 + contrib/one-true-awk/testdir/T.func | 196 + contrib/one-true-awk/testdir/T.gawk | 390 + contrib/one-true-awk/testdir/T.getline | 98 + contrib/one-true-awk/testdir/T.int-expr | 124 + contrib/one-true-awk/testdir/T.latin1 | 37 + contrib/one-true-awk/testdir/T.lilly | 28 + contrib/one-true-awk/testdir/T.main | 32 + contrib/one-true-awk/testdir/T.misc | 506 + contrib/one-true-awk/testdir/T.nextfile | 86 + contrib/one-true-awk/testdir/T.overflow | 86 + contrib/one-true-awk/testdir/T.re | 340 + contrib/one-true-awk/testdir/T.recache | 33 + contrib/one-true-awk/testdir/T.redir | 38 + contrib/one-true-awk/testdir/T.split | 224 + contrib/one-true-awk/testdir/T.sub | 315 + contrib/one-true-awk/testdir/T.system | 15 + contrib/one-true-awk/testdir/arnold-fixes.tar | Bin 0 -> 30720 bytes contrib/one-true-awk/testdir/beebe.tar | Bin 0 -> 389120 bytes contrib/one-true-awk/testdir/bib | 31102 +++++++++++++++++++ contrib/one-true-awk/testdir/bundle.awk | 3 + contrib/one-true-awk/testdir/chem.awk | 492 + contrib/one-true-awk/testdir/cleanup | 5 + contrib/one-true-awk/testdir/countries | 11 + contrib/one-true-awk/testdir/ctimes | 40 + contrib/one-true-awk/testdir/echo.c | 19 + contrib/one-true-awk/testdir/funstack.awk | 977 + contrib/one-true-awk/testdir/funstack.in | 27220 ++++++++++++++++ contrib/one-true-awk/testdir/funstack.ok | 3705 +++ contrib/one-true-awk/testdir/ind | 1 + contrib/one-true-awk/testdir/latin1 | 11 + contrib/one-true-awk/testdir/lilly.ifile | 16 + contrib/one-true-awk/testdir/lilly.out | 1258 + contrib/one-true-awk/testdir/lilly.progs | 126 + contrib/one-true-awk/testdir/lsd1.p | 15 + contrib/one-true-awk/testdir/p.1 | 1 + contrib/one-true-awk/testdir/p.10 | 1 + contrib/one-true-awk/testdir/p.11 | 1 + contrib/one-true-awk/testdir/p.12 | 1 + contrib/one-true-awk/testdir/p.13 | 1 + contrib/one-true-awk/testdir/p.14 | 1 + contrib/one-true-awk/testdir/p.15 | 1 + contrib/one-true-awk/testdir/p.16 | 1 + contrib/one-true-awk/testdir/p.17 | 1 + contrib/one-true-awk/testdir/p.18 | 1 + contrib/one-true-awk/testdir/p.19 | 2 + contrib/one-true-awk/testdir/p.2 | 1 + contrib/one-true-awk/testdir/p.20 | 1 + contrib/one-true-awk/testdir/p.21 | 1 + contrib/one-true-awk/testdir/p.21a | 1 + contrib/one-true-awk/testdir/p.22 | 1 + contrib/one-true-awk/testdir/p.23 | 1 + contrib/one-true-awk/testdir/p.24 | 1 + contrib/one-true-awk/testdir/p.25 | 1 + contrib/one-true-awk/testdir/p.26 | 3 + contrib/one-true-awk/testdir/p.26a | 3 + contrib/one-true-awk/testdir/p.27 | 2 + contrib/one-true-awk/testdir/p.28 | 1 + contrib/one-true-awk/testdir/p.29 | 1 + contrib/one-true-awk/testdir/p.3 | 1 + contrib/one-true-awk/testdir/p.30 | 1 + contrib/one-true-awk/testdir/p.31 | 2 + contrib/one-true-awk/testdir/p.32 | 1 + contrib/one-true-awk/testdir/p.33 | 2 + contrib/one-true-awk/testdir/p.34 | 1 + contrib/one-true-awk/testdir/p.35 | 4 + contrib/one-true-awk/testdir/p.36 | 2 + contrib/one-true-awk/testdir/p.37 | 1 + contrib/one-true-awk/testdir/p.38 | 6 + contrib/one-true-awk/testdir/p.39 | 6 + contrib/one-true-awk/testdir/p.4 | 1 + contrib/one-true-awk/testdir/p.40 | 3 + contrib/one-true-awk/testdir/p.41 | 3 + contrib/one-true-awk/testdir/p.42 | 4 + contrib/one-true-awk/testdir/p.43 | 4 + contrib/one-true-awk/testdir/p.44 | 7 + contrib/one-true-awk/testdir/p.45 | 2 + contrib/one-true-awk/testdir/p.46 | 1 + contrib/one-true-awk/testdir/p.47 | 2 + contrib/one-true-awk/testdir/p.48 | 4 + contrib/one-true-awk/testdir/p.48a | 6 + contrib/one-true-awk/testdir/p.48b | 5 + contrib/one-true-awk/testdir/p.49 | 1 + contrib/one-true-awk/testdir/p.5 | 3 + contrib/one-true-awk/testdir/p.50 | 4 + contrib/one-true-awk/testdir/p.51 | 7 + contrib/one-true-awk/testdir/p.52 | 16 + contrib/one-true-awk/testdir/p.5a | 3 + contrib/one-true-awk/testdir/p.6 | 1 + contrib/one-true-awk/testdir/p.7 | 1 + contrib/one-true-awk/testdir/p.8 | 1 + contrib/one-true-awk/testdir/p.9 | 1 + contrib/one-true-awk/testdir/p.table | 33 + contrib/one-true-awk/testdir/penicil.p | 39 + contrib/one-true-awk/testdir/res.p | 26 + contrib/one-true-awk/testdir/sgi.ctimes | 40 + contrib/one-true-awk/testdir/t.0 | 1 + contrib/one-true-awk/testdir/t.0a | 1 + contrib/one-true-awk/testdir/t.1 | 2 + contrib/one-true-awk/testdir/t.1.x | 1 + contrib/one-true-awk/testdir/t.2 | 2 + contrib/one-true-awk/testdir/t.2.x | 1 + contrib/one-true-awk/testdir/t.3 | 1 + contrib/one-true-awk/testdir/t.3.x | 7 + contrib/one-true-awk/testdir/t.4 | 1 + contrib/one-true-awk/testdir/t.4.x | 1 + contrib/one-true-awk/testdir/t.5.x | 1 + contrib/one-true-awk/testdir/t.6 | 8 + contrib/one-true-awk/testdir/t.6.x | 1 + contrib/one-true-awk/testdir/t.6a | 5 + contrib/one-true-awk/testdir/t.6b | 5 + contrib/one-true-awk/testdir/t.8.x | 4 + contrib/one-true-awk/testdir/t.8.y | 7 + contrib/one-true-awk/testdir/t.NF | 1 + contrib/one-true-awk/testdir/t.a | 6 + contrib/one-true-awk/testdir/t.addops | 24 + contrib/one-true-awk/testdir/t.aeiou | 1 + contrib/one-true-awk/testdir/t.aeiouy | 1 + contrib/one-true-awk/testdir/t.arith | 6 + contrib/one-true-awk/testdir/t.array | 13 + contrib/one-true-awk/testdir/t.array1 | 10 + contrib/one-true-awk/testdir/t.array2 | 4 + contrib/one-true-awk/testdir/t.assert | 9 + contrib/one-true-awk/testdir/t.avg | 5 + contrib/one-true-awk/testdir/t.b.x | 1 + contrib/one-true-awk/testdir/t.be | 6 + contrib/one-true-awk/testdir/t.beginexit | 6 + contrib/one-true-awk/testdir/t.beginnext | 6 + contrib/one-true-awk/testdir/t.break | 7 + contrib/one-true-awk/testdir/t.break1 | 10 + contrib/one-true-awk/testdir/t.break2 | 10 + contrib/one-true-awk/testdir/t.break3 | 8 + contrib/one-true-awk/testdir/t.bug1 | 3 + contrib/one-true-awk/testdir/t.builtins | 6 + contrib/one-true-awk/testdir/t.cat | 4 + contrib/one-true-awk/testdir/t.cat1 | 1 + contrib/one-true-awk/testdir/t.cat2 | 1 + contrib/one-true-awk/testdir/t.cmp | 1 + contrib/one-true-awk/testdir/t.coerce | 4 + contrib/one-true-awk/testdir/t.coerce2 | 7 + contrib/one-true-awk/testdir/t.comment | 5 + contrib/one-true-awk/testdir/t.comment1 | 7 + contrib/one-true-awk/testdir/t.concat | 1 + contrib/one-true-awk/testdir/t.cond | 3 + contrib/one-true-awk/testdir/t.contin | 9 + contrib/one-true-awk/testdir/t.count | 1 + contrib/one-true-awk/testdir/t.crlf | 4 + contrib/one-true-awk/testdir/t.cum | 4 + contrib/one-true-awk/testdir/t.d.x | 2 + contrib/one-true-awk/testdir/t.delete0 | 11 + contrib/one-true-awk/testdir/t.delete1 | 7 + contrib/one-true-awk/testdir/t.delete2 | 12 + contrib/one-true-awk/testdir/t.delete3 | 7 + contrib/one-true-awk/testdir/t.do | 14 + contrib/one-true-awk/testdir/t.e | 1 + contrib/one-true-awk/testdir/t.else | 3 + contrib/one-true-awk/testdir/t.exit | 2 + contrib/one-true-awk/testdir/t.exit1 | 15 + contrib/one-true-awk/testdir/t.f | 1 + contrib/one-true-awk/testdir/t.f.x | 1 + contrib/one-true-awk/testdir/t.f0 | 1 + contrib/one-true-awk/testdir/t.f1 | 1 + contrib/one-true-awk/testdir/t.f2 | 1 + contrib/one-true-awk/testdir/t.f3 | 1 + contrib/one-true-awk/testdir/t.f4 | 1 + contrib/one-true-awk/testdir/t.for | 3 + contrib/one-true-awk/testdir/t.for1 | 9 + contrib/one-true-awk/testdir/t.for2 | 7 + contrib/one-true-awk/testdir/t.for3 | 8 + contrib/one-true-awk/testdir/t.format4 | 9 + contrib/one-true-awk/testdir/t.fun | 3 + contrib/one-true-awk/testdir/t.fun0 | 2 + contrib/one-true-awk/testdir/t.fun1 | 2 + contrib/one-true-awk/testdir/t.fun2 | 10 + contrib/one-true-awk/testdir/t.fun3 | 3 + contrib/one-true-awk/testdir/t.fun4 | 9 + contrib/one-true-awk/testdir/t.fun5 | 9 + contrib/one-true-awk/testdir/t.getline1 | 10 + contrib/one-true-awk/testdir/t.getval | 6 + contrib/one-true-awk/testdir/t.gsub | 1 + contrib/one-true-awk/testdir/t.gsub1 | 1 + contrib/one-true-awk/testdir/t.gsub3 | 1 + contrib/one-true-awk/testdir/t.gsub4 | 4 + contrib/one-true-awk/testdir/t.i.x | 2 + contrib/one-true-awk/testdir/t.if | 1 + contrib/one-true-awk/testdir/t.in | 9 + contrib/one-true-awk/testdir/t.in1 | 7 + contrib/one-true-awk/testdir/t.in2 | 4 + contrib/one-true-awk/testdir/t.in3 | 7 + contrib/one-true-awk/testdir/t.incr | 2 + contrib/one-true-awk/testdir/t.incr2 | 8 + contrib/one-true-awk/testdir/t.incr3 | 5 + contrib/one-true-awk/testdir/t.index | 10 + contrib/one-true-awk/testdir/t.intest | 9 + contrib/one-true-awk/testdir/t.intest2 | 16 + contrib/one-true-awk/testdir/t.j.x | 2 + contrib/one-true-awk/testdir/t.longstr | 5 + contrib/one-true-awk/testdir/t.makef | 1 + contrib/one-true-awk/testdir/t.match | 1 + contrib/one-true-awk/testdir/t.match1 | 6 + contrib/one-true-awk/testdir/t.max | 2 + contrib/one-true-awk/testdir/t.mod | 1 + contrib/one-true-awk/testdir/t.monotone | 1 + contrib/one-true-awk/testdir/t.nameval | 7 + contrib/one-true-awk/testdir/t.next | 2 + contrib/one-true-awk/testdir/t.not | 4 + contrib/one-true-awk/testdir/t.null0 | 15 + contrib/one-true-awk/testdir/t.ofmt | 2 + contrib/one-true-awk/testdir/t.ofs | 2 + contrib/one-true-awk/testdir/t.ors | 2 + contrib/one-true-awk/testdir/t.pat | 4 + contrib/one-true-awk/testdir/t.pipe | 1 + contrib/one-true-awk/testdir/t.pp | 1 + contrib/one-true-awk/testdir/t.pp1 | 3 + contrib/one-true-awk/testdir/t.pp2 | 3 + contrib/one-true-awk/testdir/t.printf | 5 + contrib/one-true-awk/testdir/t.printf2 | 6 + contrib/one-true-awk/testdir/t.quote | 1 + contrib/one-true-awk/testdir/t.randk | 13 + contrib/one-true-awk/testdir/t.re1 | 2 + contrib/one-true-awk/testdir/t.re1a | 6 + contrib/one-true-awk/testdir/t.re2 | 2 + contrib/one-true-awk/testdir/t.re3 | 6 + contrib/one-true-awk/testdir/t.re4 | 10 + contrib/one-true-awk/testdir/t.re5 | 3 + contrib/one-true-awk/testdir/t.re7 | 1 + contrib/one-true-awk/testdir/t.reFS | 2 + contrib/one-true-awk/testdir/t.rec | 1 + contrib/one-true-awk/testdir/t.redir1 | 2 + contrib/one-true-awk/testdir/t.reg | 4 + contrib/one-true-awk/testdir/t.roff | 23 + contrib/one-true-awk/testdir/t.sep | 2 + contrib/one-true-awk/testdir/t.seqno | 1 + contrib/one-true-awk/testdir/t.set0 | 3 + contrib/one-true-awk/testdir/t.set0a | 1 + contrib/one-true-awk/testdir/t.set0b | 3 + contrib/one-true-awk/testdir/t.set1 | 3 + contrib/one-true-awk/testdir/t.set2 | 4 + contrib/one-true-awk/testdir/t.set3 | 1 + contrib/one-true-awk/testdir/t.split1 | 2 + contrib/one-true-awk/testdir/t.split2 | 1 + contrib/one-true-awk/testdir/t.split2a | 4 + contrib/one-true-awk/testdir/t.split3 | 4 + contrib/one-true-awk/testdir/t.split4 | 4 + contrib/one-true-awk/testdir/t.split8 | 9 + contrib/one-true-awk/testdir/t.split9 | 8 + contrib/one-true-awk/testdir/t.split9a | 9 + contrib/one-true-awk/testdir/t.stately | 1 + contrib/one-true-awk/testdir/t.strcmp | 1 + contrib/one-true-awk/testdir/t.strcmp1 | 1 + contrib/one-true-awk/testdir/t.strnum | 1 + contrib/one-true-awk/testdir/t.sub0 | 18 + contrib/one-true-awk/testdir/t.sub1 | 1 + contrib/one-true-awk/testdir/t.sub2 | 2 + contrib/one-true-awk/testdir/t.sub3 | 1 + contrib/one-true-awk/testdir/t.substr | 3 + contrib/one-true-awk/testdir/t.substr1 | 1 + contrib/one-true-awk/testdir/t.time | 18 + contrib/one-true-awk/testdir/t.vf | 3 + contrib/one-true-awk/testdir/t.vf1 | 7 + contrib/one-true-awk/testdir/t.vf2 | 1 + contrib/one-true-awk/testdir/t.vf3 | 2 + contrib/one-true-awk/testdir/t.x | 1 + contrib/one-true-awk/testdir/td.1 | 1397 + contrib/one-true-awk/testdir/test.countries | 10 + contrib/one-true-awk/testdir/test.data | 199 + contrib/one-true-awk/testdir/time.c | 31 + contrib/one-true-awk/testdir/try | 10 + contrib/one-true-awk/testdir/tt.01 | 1 + contrib/one-true-awk/testdir/tt.02 | 1 + contrib/one-true-awk/testdir/tt.02a | 1 + contrib/one-true-awk/testdir/tt.03 | 2 + contrib/one-true-awk/testdir/tt.03a | 2 + contrib/one-true-awk/testdir/tt.04 | 3 + contrib/one-true-awk/testdir/tt.05 | 6 + contrib/one-true-awk/testdir/tt.06 | 7 + contrib/one-true-awk/testdir/tt.07 | 1 + contrib/one-true-awk/testdir/tt.08 | 1 + contrib/one-true-awk/testdir/tt.09 | 1 + contrib/one-true-awk/testdir/tt.10 | 1 + contrib/one-true-awk/testdir/tt.10a | 2 + contrib/one-true-awk/testdir/tt.11 | 1 + contrib/one-true-awk/testdir/tt.12 | 1 + contrib/one-true-awk/testdir/tt.13 | 5 + contrib/one-true-awk/testdir/tt.13a | 5 + contrib/one-true-awk/testdir/tt.14 | 7 + contrib/one-true-awk/testdir/tt.15 | 33 + contrib/one-true-awk/testdir/tt.16 | 6 + contrib/one-true-awk/testdir/tt.big | 51 + contrib/one-true-awk/testdir/u.main | 9 + contrib/one-true-awk/testdir/unbundle.awk | 4 + contrib/one-true-awk/testdir/xc | 17 + contrib/one-true-awk/testdir/yc | 17 + 330 files changed, 71810 insertions(+), 10 deletions(-) diff --cc contrib/one-true-awk/README.md index b8089b3a4803,000000000000..76ae3d48c983 mode 100644,000000..100644 --- a/contrib/one-true-awk/README.md +++ b/contrib/one-true-awk/README.md @@@ -1,119 -1,0 +1,123 @@@ +# The One True Awk + +This is the version of `awk` described in _The AWK Programming Language_, +by Al Aho, Brian Kernighan, and Peter Weinberger +(Addison-Wesley, 1988, ISBN 0-201-07981-X). + +## Copyright + +Copyright (C) Lucent Technologies 1997
+All Rights Reserved + +Permission to use, copy, modify, and distribute this software and +its documentation for any purpose and without fee is hereby +granted, provided that the above copyright notice appear in all +copies and that both that the copyright notice and this +permission notice and warranty disclaimer appear in supporting +documentation, and that the name Lucent Technologies or any of +its entities not be used in advertising or publicity pertaining +to distribution of the software without specific, written prior +permission. + +LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. +IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY +SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER +IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. + +## Distribution and Reporting Problems + +Changes, mostly bug fixes and occasional enhancements, are listed +in `FIXES`. If you distribute this code further, please please please +distribute `FIXES` with it. + +If you find errors, please report them +to bwk@cs.princeton.edu. +Please _also_ open an issue in the GitHub issue tracker, to make +it easy to track issues. +Thanks. + +## Submitting Pull Requests + +Pull requests are welcome. Some guidelines: + +* Please do not use functions or facilities that are not standard (e.g., +`strlcpy()`, `fpurge()`). + +* Please run the test suite and make sure that your changes pass before +posting the pull request. To do so: + + 1. Save the previous version of `awk` somewhere in your path. Call it `nawk` (for example). + 1. Run `oldawk=nawk make check > check.out 2>&1`. + 1. Search for `BAD` or `error` in the result. In general, look over it manually to make sure there are no errors. + +* Please create the pull request with a request +to merge into the `staging` branch instead of into the `master` branch. +This allows us to do testing, and to make any additional edits or changes +after the merge but before merging to `master`. + +## Building + +The program itself is created by + + make + +which should produce a sequence of messages roughly like this: + + yacc -d awkgram.y + conflicts: 43 shift/reduce, 85 reduce/reduce + mv y.tab.c ytab.c + mv y.tab.h ytab.h + cc -c ytab.c + cc -c b.c + cc -c main.c + cc -c parse.c + cc maketab.c -o maketab + ./maketab >proctab.c + cc -c proctab.c + cc -c tran.c + cc -c lib.c + cc -c run.c + cc -c lex.c + cc ytab.o b.o main.o parse.o proctab.o tran.o lib.o run.o lex.o -lm + +This produces an executable `a.out`; you will eventually want to +move this to some place like `/usr/bin/awk`. + +If your system does not have `yacc` or `bison` (the GNU +equivalent), you need to install one of them first. + +NOTE: This version uses ANSI C (C 99), as you should also. We have +compiled this without any changes using `gcc -Wall` and/or local C +compilers on a variety of systems, but new systems or compilers +may raise some new complaint; reports of difficulties are +welcome. + +This compiles without change on Macintosh OS X using `gcc` and +the standard developer tools. + +You can also use `make CC=g++` to build with the GNU C++ compiler, +should you choose to do so. + +The version of `malloc` that comes with some systems is sometimes +astonishly slow. If `awk` seems slow, you might try fixing that. +More generally, turning on optimization can significantly improve +`awk`'s speed, perhaps by 1/3 for highest levels. + ++## A Note About Releases ++ ++We don't do releases. ++ +## A Note About Maintenance + - NOTICE! Maintenance of this program is on a ``best effort'' ++NOTICE! Maintenance of this program is on a ''best effort'' +basis. We try to get to issues and pull requests as quickly +as we can. Unfortunately, however, keeping this program going +is not at the top of our priority list. + +#### Last Updated + - Fri Dec 25 16:53:34 EST 2020 ++Sat Jul 25 14:00:07 EDT 2021 diff --cc contrib/one-true-awk/TODO index 000000000000,13f2925544b7..13f2925544b7 mode 000000,100644..100644 --- a/contrib/one-true-awk/TODO +++ b/contrib/one-true-awk/TODO diff --cc contrib/one-true-awk/bugs-fixed/REGRESS index 000000000000,07160031ca07..07160031ca07 mode 000000,100755..100755 --- a/contrib/one-true-awk/bugs-fixed/REGRESS +++ b/contrib/one-true-awk/bugs-fixed/REGRESS diff --cc contrib/one-true-awk/bugs-fixed/fs-overflow.ok index 000000000000,257cc5642cb1..257cc5642cb1 mode 000000,100644..100644 --- a/contrib/one-true-awk/bugs-fixed/fs-overflow.ok +++ b/contrib/one-true-awk/bugs-fixed/fs-overflow.ok diff --cc contrib/one-true-awk/bugs-fixed/inf-nan-torture.awk index 000000000000,8d145f2a5496..8d145f2a5496 mode 000000,100644..100644 --- a/contrib/one-true-awk/bugs-fixed/inf-nan-torture.awk +++ b/contrib/one-true-awk/bugs-fixed/inf-nan-torture.awk diff --cc contrib/one-true-awk/bugs-fixed/inf-nan-torture.in index 000000000000,45dfdc85d556..45dfdc85d556 mode 000000,100644..100644 --- a/contrib/one-true-awk/bugs-fixed/inf-nan-torture.in +++ b/contrib/one-true-awk/bugs-fixed/inf-nan-torture.in diff --cc contrib/one-true-awk/bugs-fixed/inf-nan-torture.ok index 000000000000,40d3194207c6..40d3194207c6 mode 000000,100644..100644 --- a/contrib/one-true-awk/bugs-fixed/inf-nan-torture.ok +++ b/contrib/one-true-awk/bugs-fixed/inf-nan-torture.ok diff --cc contrib/one-true-awk/bugs-fixed/pfile-overflow.awk index 000000000000,b7d5379f9e3b..b7d5379f9e3b mode 000000,100644..100644 --- a/contrib/one-true-awk/bugs-fixed/pfile-overflow.awk +++ b/contrib/one-true-awk/bugs-fixed/pfile-overflow.awk diff --cc contrib/one-true-awk/bugs-fixed/pfile-overflow.ok index 000000000000,a0de50f9007f..a0de50f9007f mode 000000,100644..100644 --- a/contrib/one-true-awk/bugs-fixed/pfile-overflow.ok +++ b/contrib/one-true-awk/bugs-fixed/pfile-overflow.ok diff --cc contrib/one-true-awk/bugs-fixed/rs_underflow.awk index 000000000000,4cf17026d760..4cf17026d760 mode 000000,100644..100644 --- a/contrib/one-true-awk/bugs-fixed/rs_underflow.awk +++ b/contrib/one-true-awk/bugs-fixed/rs_underflow.awk diff --cc contrib/one-true-awk/bugs-fixed/rs_underflow.in index 000000000000,74c803545d16..74c803545d16 mode 000000,100644..100644 --- a/contrib/one-true-awk/bugs-fixed/rs_underflow.in +++ b/contrib/one-true-awk/bugs-fixed/rs_underflow.in diff --cc contrib/one-true-awk/bugs-fixed/rs_underflow.ok index 000000000000,74c803545d16..74c803545d16 mode 000000,100644..100644 --- a/contrib/one-true-awk/bugs-fixed/rs_underflow.ok +++ b/contrib/one-true-awk/bugs-fixed/rs_underflow.ok diff --cc contrib/one-true-awk/lib.c index 6bfe5e8eaad9,000000000000..ee77207564b7 mode 100644,000000..100644 --- a/contrib/one-true-awk/lib.c +++ b/contrib/one-true-awk/lib.c @@@ -1,847 -1,0 +1,849 @@@ +/**************************************************************** +Copyright (C) Lucent Technologies 1997 +All Rights Reserved + +Permission to use, copy, modify, and distribute this software and +its documentation for any purpose and without fee is hereby +granted, provided that the above copyright notice appear in all +copies and that both that the copyright notice and this +permission notice and warranty disclaimer appear in supporting +documentation, and that the name Lucent Technologies or any of +its entities not be used in advertising or publicity pertaining +to distribution of the software without specific, written prior +permission. + +LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. +IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY +SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER +IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. +****************************************************************/ + +#define DEBUG +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "awk.h" + +char EMPTY[] = { '\0' }; +FILE *infile = NULL; +bool innew; /* true = infile has not been read by readrec */ +char *file = EMPTY; +char *record; +int recsize = RECSIZE; +char *fields; +int fieldssize = RECSIZE; + +Cell **fldtab; /* pointers to Cells */ +static size_t len_inputFS = 0; +static char *inputFS = NULL; /* FS at time of input, for field splitting */ + +#define MAXFLD 2 +int nfields = MAXFLD; /* last allocated slot for $i */ + +bool donefld; /* true = implies rec broken into fields */ +bool donerec; /* true = record is valid (no flds have changed) */ + +int lastfld = 0; /* last used field */ +int argno = 1; /* current input argument number */ +extern Awkfloat *ARGC; + +static Cell dollar0 = { OCELL, CFLD, NULL, EMPTY, 0.0, REC|STR|DONTFREE, NULL, NULL }; +static Cell dollar1 = { OCELL, CFLD, NULL, EMPTY, 0.0, FLD|STR|DONTFREE, NULL, NULL }; + +void recinit(unsigned int n) +{ + if ( (record = (char *) malloc(n)) == NULL + || (fields = (char *) malloc(n+1)) == NULL + || (fldtab = (Cell **) calloc(nfields+2, sizeof(*fldtab))) == NULL + || (fldtab[0] = (Cell *) malloc(sizeof(**fldtab))) == NULL) + FATAL("out of space for $0 and fields"); + *record = '\0'; + *fldtab[0] = dollar0; + fldtab[0]->sval = record; + fldtab[0]->nval = tostring("0"); + makefields(1, nfields); +} + +void makefields(int n1, int n2) /* create $n1..$n2 inclusive */ +{ + char temp[50]; + int i; + + for (i = n1; i <= n2; i++) { + fldtab[i] = (Cell *) malloc(sizeof(**fldtab)); + if (fldtab[i] == NULL) + FATAL("out of space in makefields %d", i); + *fldtab[i] = dollar1; + snprintf(temp, sizeof(temp), "%d", i); + fldtab[i]->nval = tostring(temp); + } +} + +void initgetrec(void) +{ + int i; + char *p; + + for (i = 1; i < *ARGC; i++) { + p = getargv(i); /* find 1st real filename */ + if (p == NULL || *p == '\0') { /* deleted or zapped */ + argno++; + continue; + } + if (!isclvar(p)) { + setsval(lookup("FILENAME", symtab), p); + return; + } + setclvar(p); /* a commandline assignment before filename */ + argno++; + } + infile = stdin; /* no filenames, so use stdin */ + innew = true; +} + +/* + * POSIX specifies that fields are supposed to be evaluated as if they were + * split using the value of FS at the time that the record's value ($0) was + * read. + * + * Since field-splitting is done lazily, we save the current value of FS + * whenever a new record is read in (implicitly or via getline), or when + * a new value is assigned to $0. + */ +void savefs(void) +{ + size_t len; + if ((len = strlen(getsval(fsloc))) < len_inputFS) { + strcpy(inputFS, *FS); /* for subsequent field splitting */ + return; + } + + len_inputFS = len + 1; + inputFS = (char *) realloc(inputFS, len_inputFS); + if (inputFS == NULL) + FATAL("field separator %.10s... is too long", *FS); + memcpy(inputFS, *FS, len_inputFS); +} + +static bool firsttime = true; + +int getrec(char **pbuf, int *pbufsize, bool isrecord) /* get next input record */ +{ /* note: cares whether buf == record */ + int c; + char *buf = *pbuf; + uschar saveb0; + int bufsize = *pbufsize, savebufsize = bufsize; + + if (firsttime) { + firsttime = false; + initgetrec(); + } + DPRINTF("RS=<%s>, FS=<%s>, ARGC=%g, FILENAME=%s\n", + *RS, *FS, *ARGC, *FILENAME); + if (isrecord) { + donefld = false; + donerec = true; + savefs(); + } + saveb0 = buf[0]; + buf[0] = 0; + while (argno < *ARGC || infile == stdin) { + DPRINTF("argno=%d, file=|%s|\n", argno, file); + if (infile == NULL) { /* have to open a new file */ + file = getargv(argno); + if (file == NULL || *file == '\0') { /* deleted or zapped */ + argno++; + continue; + } + if (isclvar(file)) { /* a var=value arg */ + setclvar(file); + argno++; + continue; + } + *FILENAME = file; + DPRINTF("opening file %s\n", file); + if (*file == '-' && *(file+1) == '\0') + infile = stdin; + else if ((infile = fopen(file, "r")) == NULL) + FATAL("can't open file %s", file); ++ innew = true; + setfval(fnrloc, 0.0); + } + c = readrec(&buf, &bufsize, infile, innew); + if (innew) + innew = false; + if (c != 0 || buf[0] != '\0') { /* normal record */ + if (isrecord) { + double result; + + if (freeable(fldtab[0])) + xfree(fldtab[0]->sval); + fldtab[0]->sval = buf; /* buf == record */ + fldtab[0]->tval = REC | STR | DONTFREE; + if (is_number(fldtab[0]->sval, & result)) { + fldtab[0]->fval = result; + fldtab[0]->tval |= NUM; + } + } + setfval(nrloc, nrloc->fval+1); + setfval(fnrloc, fnrloc->fval+1); + *pbuf = buf; + *pbufsize = bufsize; + return 1; + } + /* EOF arrived on this file; set up next */ + if (infile != stdin) + fclose(infile); + infile = NULL; + argno++; + } + buf[0] = saveb0; + *pbuf = buf; + *pbufsize = savebufsize; + return 0; /* true end of file */ +} + +void nextfile(void) +{ + if (infile != NULL && infile != stdin) + fclose(infile); + infile = NULL; + argno++; +} + +int readrec(char **pbuf, int *pbufsize, FILE *inf, bool newflag) /* read one record into buf */ +{ + int sep, c, isrec; + char *rr, *buf = *pbuf; + int bufsize = *pbufsize; + char *rs = getsval(rsloc); + + if (*rs && rs[1]) { + bool found; + + fa *pfa = makedfa(rs, 1); + if (newflag) + found = fnematch(pfa, inf, &buf, &bufsize, recsize); + else { + int tempstat = pfa->initstat; + pfa->initstat = 2; + found = fnematch(pfa, inf, &buf, &bufsize, recsize); + pfa->initstat = tempstat; + } + if (found) + setptr(patbeg, '\0'); ++ isrec = (found == 0 && *buf == '\0') ? false : true; + } else { + if ((sep = *rs) == 0) { + sep = '\n'; + while ((c=getc(inf)) == '\n' && c != EOF) /* skip leading \n's */ + ; + if (c != EOF) + ungetc(c, inf); + } + for (rr = buf; ; ) { + for (; (c=getc(inf)) != sep && c != EOF; ) { + if (rr-buf+1 > bufsize) + if (!adjbuf(&buf, &bufsize, 1+rr-buf, + recsize, &rr, "readrec 1")) + FATAL("input record `%.30s...' too long", buf); + *rr++ = c; + } + if (*rs == sep || c == EOF) + break; + if ((c = getc(inf)) == '\n' || c == EOF) /* 2 in a row */ + break; + if (!adjbuf(&buf, &bufsize, 2+rr-buf, recsize, &rr, + "readrec 2")) + FATAL("input record `%.30s...' too long", buf); + *rr++ = '\n'; + *rr++ = c; + } + if (!adjbuf(&buf, &bufsize, 1+rr-buf, recsize, &rr, "readrec 3")) + FATAL("input record `%.30s...' too long", buf); + *rr = 0; ++ isrec = (c == EOF && rr == buf) ? false : true; + } + *pbuf = buf; + *pbufsize = bufsize; - isrec = *buf || !feof(inf); + DPRINTF("readrec saw <%s>, returns %d\n", buf, isrec); + return isrec; +} + +char *getargv(int n) /* get ARGV[n] */ +{ + Cell *x; + char *s, temp[50]; + extern Array *ARGVtab; + + snprintf(temp, sizeof(temp), "%d", n); + if (lookup(temp, ARGVtab) == NULL) + return NULL; + x = setsymtab(temp, "", 0.0, STR, ARGVtab); + s = getsval(x); + DPRINTF("getargv(%d) returns |%s|\n", n, s); + return s; +} + +void setclvar(char *s) /* set var=value from s */ +{ + char *p; + Cell *q; + double result; + + for (p=s; *p != '='; p++) + ; + *p++ = 0; + p = qstring(p, '\0'); + q = setsymtab(s, p, 0.0, STR, symtab); + setsval(q, p); + if (is_number(q->sval, & result)) { + q->fval = result; + q->tval |= NUM; + } + DPRINTF("command line set %s to |%s|\n", s, p); +} + + +void fldbld(void) /* create fields from current record */ +{ + /* this relies on having fields[] the same length as $0 */ + /* the fields are all stored in this one array with \0's */ + /* possibly with a final trailing \0 not associated with any field */ + char *r, *fr, sep; + Cell *p; + int i, j, n; + + if (donefld) + return; + if (!isstr(fldtab[0])) + getsval(fldtab[0]); + r = fldtab[0]->sval; + n = strlen(r); + if (n > fieldssize) { + xfree(fields); + if ((fields = (char *) malloc(n+2)) == NULL) /* possibly 2 final \0s */ + FATAL("out of space for fields in fldbld %d", n); + fieldssize = n; + } + fr = fields; + i = 0; /* number of fields accumulated here */ + if (inputFS == NULL) /* make sure we have a copy of FS */ + savefs(); + if (strlen(inputFS) > 1) { /* it's a regular expression */ + i = refldbld(r, inputFS); + } else if ((sep = *inputFS) == ' ') { /* default whitespace */ + for (i = 0; ; ) { + while (*r == ' ' || *r == '\t' || *r == '\n') + r++; + if (*r == 0) + break; + i++; + if (i > nfields) + growfldtab(i); + if (freeable(fldtab[i])) + xfree(fldtab[i]->sval); + fldtab[i]->sval = fr; + fldtab[i]->tval = FLD | STR | DONTFREE; + do + *fr++ = *r++; + while (*r != ' ' && *r != '\t' && *r != '\n' && *r != '\0'); + *fr++ = 0; + } + *fr = 0; + } else if ((sep = *inputFS) == 0) { /* new: FS="" => 1 char/field */ + for (i = 0; *r != '\0'; r += n) { + char buf[MB_LEN_MAX + 1]; + + i++; + if (i > nfields) + growfldtab(i); + if (freeable(fldtab[i])) + xfree(fldtab[i]->sval); + n = mblen(r, MB_LEN_MAX); + if (n < 0) + n = 1; + memcpy(buf, r, n); + buf[n] = '\0'; + fldtab[i]->sval = tostring(buf); + fldtab[i]->tval = FLD | STR; + } + *fr = 0; + } else if (*r != 0) { /* if 0, it's a null field */ + /* subtlecase : if length(FS) == 1 && length(RS > 0) + * \n is NOT a field separator (cf awk book 61,84). + * this variable is tested in the inner while loop. + */ + int rtest = '\n'; /* normal case */ + if (strlen(*RS) > 0) + rtest = '\0'; + for (;;) { + i++; + if (i > nfields) + growfldtab(i); + if (freeable(fldtab[i])) + xfree(fldtab[i]->sval); + fldtab[i]->sval = fr; + fldtab[i]->tval = FLD | STR | DONTFREE; + while (*r != sep && *r != rtest && *r != '\0') /* \n is always a separator */ + *fr++ = *r++; + *fr++ = 0; + if (*r++ == 0) + break; + } + *fr = 0; + } + if (i > nfields) + FATAL("record `%.30s...' has too many fields; can't happen", r); + cleanfld(i+1, lastfld); /* clean out junk from previous record */ + lastfld = i; + donefld = true; + for (j = 1; j <= lastfld; j++) { + double result; + + p = fldtab[j]; + if(is_number(p->sval, & result)) { + p->fval = result; + p->tval |= NUM; + } + } + setfval(nfloc, (Awkfloat) lastfld); + donerec = true; /* restore */ + if (dbg) { + for (j = 0; j <= lastfld; j++) { + p = fldtab[j]; + printf("field %d (%s): |%s|\n", j, p->nval, p->sval); + } + } *** 2256 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Sun Aug 1 17:10: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 F3A03662DB5; Sun, 1 Aug 2021 17:10: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 4Gd7296dq6z4qsj; Sun, 1 Aug 2021 17:10: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 CCE107BCC; Sun, 1 Aug 2021 17:10: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 171HAvCH019553; Sun, 1 Aug 2021 17:10:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 171HAvOj019552; Sun, 1 Aug 2021 17:10:57 GMT (envelope-from git) Date: Sun, 1 Aug 2021 17:10:57 GMT Message-Id: <202108011710.171HAvOj019552@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: 818edf67bda2 - main - RELNOTES: update the runing entry on awk. 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: 818edf67bda228d66ea57c1dbbfcf164c27aff4f 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, 01 Aug 2021 17:10:58 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=818edf67bda228d66ea57c1dbbfcf164c27aff4f commit 818edf67bda228d66ea57c1dbbfcf164c27aff4f Author: Warner Losh AuthorDate: 2021-08-01 17:07:29 +0000 Commit: Warner Losh CommitDate: 2021-08-01 17:08:53 +0000 RELNOTES: update the runing entry on awk. Dig up the major commits and document the coming -Ft change. Sponsored by: Netflix --- RELNOTES | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/RELNOTES b/RELNOTES index d70d58428dff..a33128e7370f 100644 --- a/RELNOTES +++ b/RELNOTES @@ -10,9 +10,9 @@ newline. Entries should be separated by a newline. Changes to this file should not be MFCed. -various: +f39dd6a97844,23f24377b1a9,628bd30ab5a4: One True Awk has been updated to the latest from upstream - (20210215). All the FreeBSD patches, but one, have now been + (20210727). All the FreeBSD patches, but one, have now been either up streamed or discarded. Notable changes include: o Locale is no longer used for ranges o Various bugs fixed @@ -24,6 +24,10 @@ various: true awk now) interpret them as 0 in line with awk's historic behavior. + A second change, less likely to be noticed, is the historic wart + if -Ft meaning to use hard tab characters as the field separator + is deprecated and will likely be removed in FreeBSD 14. + ee29e6f31111: Commit ee29e6f31111 added a new sysctl called vfs.nfsd.srvmaxio that can be used to increase the maximum I/O size for the NFS From owner-dev-commits-src-all@freebsd.org Sun Aug 1 17:33: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 F1810663768; Sun, 1 Aug 2021 17:33: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 4Gd7Xj3Nr9z4t1k; Sun, 1 Aug 2021 17:33: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 4DF24108B8; Sun, 1 Aug 2021 17:33: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 171HXvsg050866; Sun, 1 Aug 2021 17:33:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 171HXvMe050865; Sun, 1 Aug 2021 17:33:57 GMT (envelope-from git) Date: Sun, 1 Aug 2021 17:33:57 GMT Message-Id: <202108011733.171HXvMe050865@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: fd2a4a31d9df - main - awk: document updating 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: fd2a4a31d9df9beb793c892af72aeb1c1bf5dd42 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, 01 Aug 2021 17:33:58 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=fd2a4a31d9df9beb793c892af72aeb1c1bf5dd42 commit fd2a4a31d9df9beb793c892af72aeb1c1bf5dd42 Author: Warner Losh AuthorDate: 2021-08-01 17:31:50 +0000 Commit: Warner Losh CommitDate: 2021-08-01 17:31:50 +0000 awk: document updating Fill in all the details to the standard process so they are hand in one place and don't need to be re-remembered or rediscovered for the next import. Sponsored by: Netflix --- contrib/one-true-awk/FREEBSD-upgrade | 58 ++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/contrib/one-true-awk/FREEBSD-upgrade b/contrib/one-true-awk/FREEBSD-upgrade new file mode 100644 index 000000000000..9fdce55e4223 --- /dev/null +++ b/contrib/one-true-awk/FREEBSD-upgrade @@ -0,0 +1,58 @@ +Notes on upgrading awk from upstream + +FreeBSD imports awk from the one true awk github project. This is the blessed +successor to Brian Kernighan's efforts to maintain awk after he left Lucent. + +git@github.com:onetrueawk/awk.git + +We also track the bsd-features branch. This is a branch that takes the +traditional one true awk and adds features that the BSD projects have added over +the years that are useful, but not too over the top (like bit functions). + +The typical update cycle goes something like: + +(1) Create a work tree for the vendor/one-true-awk branch + % cd freebsd-main + % git worktree create ../ota vendor/one-true-awk +(2) Update the onetrueawk github + % cd ../awk + % git pull --rebase + % git branch --show-current + bsd-features + % git show-ref HEAD + f9affa922c5e074990a999d486d4bc823590fd93 refs/remotes/origin/HEAD +(3) Copy that to the vendor branch and push upstream + % rm -rf ../ota/* # trailing /* is important + % cp -a * ../ota + % cd ../ota + % git add * + % git commit -m"Import awk YYYYMMDD hash f9affa922c5e" # 12 places + % git commit --amend + + % diff -ur ../awk . + # Sanity check to make sure it looks good. The vendor branch should + # contain the unaltered sources from upstream since it's active + # again (for a while we were importing submitted patches to the + # vendor branch given the long lag with the old upstream, but no more) + % git tag -a -s vendor/one-true-awk/f9affa92 # 8 places + + % git push --follow-tags freebsd vendor/one-true-awk +(4) Merge this into main + % git subtree merge -P contrib/one-true-awk vendor/one-true-awk + # resolve any conflicts and commit + # Be sure to use the same or similar commit message as you did for + # the import. If you import multiple versions before merging to head + # you may need to combine the messages. Also, if there's more than + # a screen of changes, you may want to abstract them down into an + # easy to digest summary. + % cd usr.bin/awk + % sudo make check + # make sure all the tests pass + % cd ../.. + # awk is a build tool, so test the builds + % make buildworld / buildkernel for amd64, armv7, i386 and aarch64 (or + make universe/tinderbox if there's a lot of changes). + % git push freebsd +(5) Oops, lost the race to push while testing, the following will rebase things + % git fetch freebsd + % git rebase --rebase-merges -i freebsd/main From owner-dev-commits-src-all@freebsd.org Sun Aug 1 20:54: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 89CA0665CED; Sun, 1 Aug 2021 20:54: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 4GdD0f30JSz3RL4; Sun, 1 Aug 2021 20:54: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 4CFD913420; Sun, 1 Aug 2021 20:54: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 171KswT1015987; Sun, 1 Aug 2021 20:54:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 171KswFj015986; Sun, 1 Aug 2021 20:54:58 GMT (envelope-from git) Date: Sun, 1 Aug 2021 20:54:58 GMT Message-Id: <202108012054.171KswFj015986@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: 56be282bc999 - main - bhyve: net_backends, automatically IFF_UP tap devices 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: 56be282bc999cc05dcd1ccb163b108d54f3ff448 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, 01 Aug 2021 20:54:58 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=56be282bc999cc05dcd1ccb163b108d54f3ff448 commit 56be282bc999cc05dcd1ccb163b108d54f3ff448 Author: Bjoern A. Zeeb AuthorDate: 2021-07-28 22:53:25 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-08-01 20:50:53 +0000 bhyve: net_backends, automatically IFF_UP tap devices If you want communications with the outside world and tell bhyve to create an interfaces then it should be usable as well. Rather than relying on the sysctl net.link.tap.up_on_open automatically try to IFF_UP the opened tap device. MFC after: 10 days Reviewed by: markj, grehan Differential Revision: https://reviews.freebsd.org/D31342 --- usr.sbin/bhyve/net_backends.c | 51 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/usr.sbin/bhyve/net_backends.c b/usr.sbin/bhyve/net_backends.c index 30c26aea458b..cb1730fc77df 100644 --- a/usr.sbin/bhyve/net_backends.c +++ b/usr.sbin/bhyve/net_backends.c @@ -46,6 +46,9 @@ __FBSDID("$FreeBSD$"); #include #include +#if defined(INET6) || defined(INET) +#include +#endif #include #include #define NETMAP_WITH_LIBS @@ -179,6 +182,17 @@ SET_DECLARE(net_backend_set, struct net_backend); * The tap backend */ +#if defined(INET6) || defined(INET) +const int pf_list[] = { +#if defined(INET6) + PF_INET6, +#endif +#if defined(INET) + PF_INET, +#endif +}; +#endif + struct tap_priv { struct mevent *mevp; /* @@ -211,6 +225,10 @@ tap_init(struct net_backend *be, const char *devname, struct tap_priv *priv = (struct tap_priv *)be->opaque; char tbuf[80]; int opt = 1; +#if defined(INET6) || defined(INET) + struct ifreq ifrq; + int i, s; +#endif #ifndef WITHOUT_CAPSICUM cap_rights_t rights; #endif @@ -238,6 +256,39 @@ tap_init(struct net_backend *be, const char *devname, goto error; } +#if defined(INET6) || defined(INET) + /* + * Try to UP the interface rather than relying on + * net.link.tap.up_on_open. + */ + bzero(&ifrq, sizeof(ifrq)); + if (ioctl(be->fd, TAPGIFNAME, &ifrq) < 0) { + WPRINTF(("Could not get interface name")); + goto error; + } + + s = -1; + for (i = 0; s == -1 && i < nitems(pf_list); i++) + s = socket(pf_list[i], SOCK_DGRAM, 0); + if (s == -1) { + WPRINTF(("Could open socket")); + goto error; + } + + if (ioctl(s, SIOCGIFFLAGS, &ifrq) < 0) { + (void)close(s); + WPRINTF(("Could not get interface flags")); + goto error; + } + ifrq.ifr_flags |= IFF_UP; + if (ioctl(s, SIOCSIFFLAGS, &ifrq) < 0) { + (void)close(s); + WPRINTF(("Could not set interface flags")); + goto error; + } + (void)close(s); +#endif + #ifndef WITHOUT_CAPSICUM cap_rights_init(&rights, CAP_EVENT, CAP_READ, CAP_WRITE); if (caph_rights_limit(be->fd, &rights) == -1)