From owner-dev-commits-src-main@freebsd.org Mon Jul 26 10:30:50 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-main@freebsd.org Mon Jul 26 11:20:14 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-main@freebsd.org Mon Jul 26 12:31:28 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-main@freebsd.org Mon Jul 26 13:30:41 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-main@freebsd.org Mon Jul 26 15:38:11 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-main@freebsd.org Mon Jul 26 16:36:50 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-main@freebsd.org Mon Jul 26 18:18:19 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-main@freebsd.org Mon Jul 26 18:29:44 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-main@freebsd.org Mon Jul 26 18:37:53 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 585CA6727FC for ; Mon, 26 Jul 2021 18:37:53 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYTFF1Vgrz3Gwp for ; Mon, 26 Jul 2021 18:37:53 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wr1-f44.google.com with SMTP id g15so12252584wrd.3 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=ZubeEZmPUPTB0ia0oYRonsQB22IzHYvurT7Vmq1kmuG8aADVKk8BwRTQardmvR0rCe MKDxOYS3mMYFzHUZAa4Z1rHAIMEMNCxjP21AkeV+ipO6rW6OGELvpVzeD5VtOM4unvjS 8TM3KpprltFe9UIKbKrLqpYypiaGYE6p+ZQ48cwvt+YNEIosKH3yvtSJ5Qvtv5yllWft gw4PXAKAlUfvPrIZDfj1lB7Asbdbmv2RrlsAx+wfy4YUExE/sDLMfbmf/hlYt+NnzsQC DDmb0TXThfoYyh3m4sk4awQa31FEexDMMQ3hqOZqf9QX6NSmfePhqjl0WlSvQ+JUQu6R JPoA== X-Gm-Message-State: AOAM5319dyP06WCtORS7O3tMUbXhDIC014eFTTQ7EbMpcytAAWMJeQqJ AJNObw8UgbZz8oo6xFlfmVbYaQ== 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: 4GYTFF1Vgrz3Gwp X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-main@freebsd.org Mon Jul 26 18:57:05 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-main@freebsd.org Mon Jul 26 19:28:36 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-main@freebsd.org Mon Jul 26 20:10:24 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-main@freebsd.org Mon Jul 26 20:10:23 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-main@freebsd.org Mon Jul 26 20:54:47 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-main@freebsd.org Mon Jul 26 20:54:51 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-main@freebsd.org Mon Jul 26 20:54:48 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 20:54:48 -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-main@freebsd.org Mon Jul 26 21:10:46 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-main@freebsd.org Mon Jul 26 21:15:20 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-main@freebsd.org Mon Jul 26 21:15:22 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-main@freebsd.org Mon Jul 26 21:15:23 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-main@freebsd.org Mon Jul 26 21:15:24 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-main@freebsd.org Mon Jul 26 22:41:38 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-main@freebsd.org Tue Jul 27 09:14:22 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-main@freebsd.org Tue Jul 27 13:35:12 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-main@freebsd.org Tue Jul 27 15:01:06 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-main@freebsd.org Tue Jul 27 15:03:23 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-main@freebsd.org Tue Jul 27 15:07:30 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-main@freebsd.org Tue Jul 27 15:33:09 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-main@freebsd.org Tue Jul 27 16:06:26 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-main@freebsd.org Tue Jul 27 16:55:52 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-main@freebsd.org Tue Jul 27 16:57:04 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-main@freebsd.org Tue Jul 27 16:58:55 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-main@freebsd.org Tue Jul 27 16:58:57 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-main@freebsd.org Tue Jul 27 16:58:58 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-main@freebsd.org Tue Jul 27 16:58:59 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-main@freebsd.org Tue Jul 27 16:59:02 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-main@freebsd.org Tue Jul 27 16:59:02 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-main@freebsd.org Tue Jul 27 16:59:00 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-main@freebsd.org Tue Jul 27 17:02:11 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-main@freebsd.org Tue Jul 27 17:20:03 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-main@freebsd.org Tue Jul 27 18:18:23 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-main@freebsd.org Tue Jul 27 18:51:49 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-main@freebsd.org Tue Jul 27 20:29:31 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-main@freebsd.org Tue Jul 27 21:24:57 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-main@freebsd.org Tue Jul 27 21:29:16 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-main@freebsd.org Tue Jul 27 23:52:44 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-main@freebsd.org Wed Jul 28 00:09:26 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Jul 28 07:35:19 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A149865589A for ; Wed, 28 Jul 2021 07:35:19 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic309-22.consmr.mail.gq1.yahoo.com (sonic309-22.consmr.mail.gq1.yahoo.com [98.137.65.148]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4GZQRp4r8rz4Wwm for ; Wed, 28 Jul 2021 07:35:18 +0000 (UTC) (envelope-from marklmi@yahoo.com) X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1627457711; bh=x5BlMfSo8xEKax72QdSZk/zrBVP3o/TXXUdv/N+Dnwn=; h=X-Sonic-MF:From:Subject:Date:To:From:Subject; b=UcCKj7dyw+hlMLC4bfvCLfULmdTt804gaS92ELK35jV/Rap0HBZcYtaiJy5oz6cs2VQ8bhmduxaNJodrELP6tt1cZSD9bfV9ssEJ4s6ZvHm0I5ajGFYKu//fZMxPXZ7VMnYBIai86wegGgi6+GS3lMOHqUZqHzLgUqVj9kom38e6Y8GvBjFAVuG4dbNcPfWqraMu61cEX6S63ekddsm8LQ5WxdmMlCTylRN/Dq8v++SMkcaftY9p84TDlx1jGdtOaBlkPu3bFdk7mIQy/FeN4aLsKsugku0hTbDMPfPKybWg7cQN2HDj0fHPbPy0Kvacp7J9rdmo5423QHJqQinrDA== X-YMail-OSG: MbfWvCUVM1mNe4KwncShkBW911YgJY1q7sB6UKM6DTzQhkoQq742menuvqUeLui bEcr3NVorsIcpbnwyCDTJTH1h_0gq1agTO3bb6CuL4o6DALv8ZbBYaoSWMPaivjePTc7ON8xBtBC az92iwnY3XSm7xm4UDgNPyotVjkciHHGdgts9cV7J.WAc2343AUUQPEO3FVZm47ZDqKwYgpgA4S0 4ImsP21JaEtHiHkhC8KU9PmtV96Lgll0DNwddWYa3fcntl8vD3CkhH68Vp1psXiq95DHAnPWb.MF sFVtPChYIL8Vg_M9emhVRS0ws2Jp21md0cOVEEUSUAzRIw8FJo4T7k.6wUQafuhokZsjYXQ54Pzy As9WRvU9I_CU.I6zl3_kq5.5DNe7eT2dTqSAVWNfS7_P13cvTfthABXnN8H3gw0DxwD4vwukKF6u hQtaGpUbCwvZKEIsuK8PGV0lYeEcpLt9NrllVWE2wjEGyRE6Lvh7HJsYcmtqG.rdSr_oyh8ePpqn XkZbMBUAKe5ACAKygSWObG8nThHNijqr8iTOF2zK4c5i7OzGM.0gI7eRPc3Rd5nw04MTReS0gLpl WTXZWDBwVaWbLiqknDXl73rNLQIZ8wp6a.uEmdj7mCt1BiH2bsOj7Ot4F_wKl1WklZ2emW.mtjUy vi4yT7IhHVPkZE7FCqSebjVgmWVghBqggYCv.P_3pGEgl488_HwvRDYSa3gUE1A1uKj.Fu4bhso6 VB4F3MH7ZbLmn86YXbWvdJ4ihcw7FZ7I.Yw.4n_XFGyFAESyFOCDC8o89B4lXdKyruEdKt3MOrV7 wyEgMgeLEYv0NvDS8cxmaIhdAzzQC4gJNrRdewWTudYiduiixOBC1VFsCpdoSsT_3PMSsZ6_49l1 YMi3rDCU.NUVR9KsN4uKMDa3xEjNJKzebpHr2djlW1pXCylRf4KzoQMx4091YJ0oHojg._m_YtU3 kDm4UqviEFPHAnITJ8sIWJaneXQVWv2H7mrn6hxJjYlf5OjgsZ6lxIUP2vRZHALMD426kGqH77l7 1Y0esuUcnwcK6MrLKUS8aRxy7bGyODSs3XGx0GYq4J27IJlKKkCYExmO3wha0_LCdbB9.diPosKn NiadAETEka6PLlUYWM.cI2sLhUReIxShBSMVVcE8We3iItdnXL3K6XbOhGgFsrodsKSB5OZQ8t4W 09d3kuEigTZ13oe_rTa7Tqog_sj1g4QbT6_wMUp6Lx_tx75y9sZcEqvcQFb4gluMJVaCU7_Mf31i OhGZr756q.zTRFpkIGIfFVxzk.G_b.ID05lvDjzeQketDfeYvaeunx_ZrimOPWdH1vh6_p61igsx 4p68j6dT5HnJqIz9JOdpzjz8vY3eo9P269.xKPechnqHpfK61EL5IGL_xaP4.z2oE46m6nhJXM2C wyYrfcElRGLnLPHER8gbDNWWHKSgQw7fDGtgQ2bLDJTs4SOzqhToIqE4GbEDzYEQQpakSZIt0HJw C_O1FA8c7uxhwigjjbHEMwo9PrCHICvgQSMBxB4pQsWMONOVG6KAgXt7WjineTlFQ0oFNuNOW5lo n_xJw3uZ3vNJa3FlNxzZXP0o7Fqrjx18YRzzECVPbKDng.SBeV4rWDdtaT7R6OBh5qTi1NLn2cOp RBBAGo9k645cVZE7qwZsRNjQHdla796hYM10pWkaXs8dhghmnmajCsBw4uUq6muDFwcYVCwKax6F gwj_6E.VGMK_bXTx4odEtbKefUBLabgElMYcXZ_xMyawamMSnTfwTrN4GAHFFcJCQkTRRlWZgxco _Ngh1e8SlQweOdAJNctxHFnHHP_1TSQ8rV_9JWH6H2RC2ItICD0UHeSfWpo6cafFWb_Wwl143rtI iZ6zuWTj.scJMkdQTNPOIla5sUce4Q.3N64egWHhMciRspE9i1KLMsQhH9r8eJLvEIs6b4xBECvL L9_e6QxRD7OSRJUQuhHwzoDuYLjc7caXDFqAtiA.y71SIaXxJZGlq3RTCN4xzRl_klB4_kfmax9J jdDyNW14y1yfINoJW52wOfcJ4pDapeLXe5W.sDU_xl1ryfEKWbPlUaNVqPwcHcvCQQacihtTnGuo PaYubqbBscdQhP0qxYnL4S6jNZudcC1amns10C6fbg1Hno_6AcOzz1S1U8yq.Rjdch5WyMQFaXal .dEU0su2AsN.ye0TUBT19vbJHzpFY8zZEg21epdRjpg4e4ERJCObAr6i2eI_tTbStDBxLbMc8W7D 4efTh5VpDghoYf6EQt8zntz96qK2J8MIKpRMC_exgACUMluGx37yn5SpROaq9syKA5gUvId_k6Un LlGg5q5IdPlyXj7KWGKeedOCcTL4RDGPEqiHQkOtrWdc5wXeMnZxsoVqWySoObk7gyW4Qyu5zFR_ Aj0YhF6TO1HGvRQLVmkcJhwkjqTB4jrDFjFmgNLpJUIFQ.tCVA4atOvW55ytntNaKohDUrETclom yFBMXow9AHcyclyAnT013rfek60UWx7ALFkKoCSKlSqpiEFYg.5toUwgQIQyye923Xwd0PTv2vBs s5ChmqJgQ_5i_v7Z.aR_bvcJb3PjXLcEfC0u2Pw-- X-Sonic-MF: Received: from sonic.gate.mail.ne1.yahoo.com by sonic309.consmr.mail.gq1.yahoo.com with HTTP; Wed, 28 Jul 2021 07:35:11 +0000 Received: by kubenode550.mail-prod1.omega.bf1.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID caa0123076c9d6eddd7bf6e19ff48873; Wed, 28 Jul 2021 07:35:06 +0000 (UTC) From: Mark Millard Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) Subject: Re: git: 5f946c76c0cc - main - Update WITHOUT_KERNEL_SYMBOLS description Message-Id: <9645F202-8D4D-4AAB-AC1C-4A4EC4214A42@yahoo.com> Date: Wed, 28 Jul 2021 00:35:03 -0700 To: Ed Maste , dev-commits-src-main@freebsd.org X-Mailer: Apple Mail (2.3654.120.0.1.13) References: <9645F202-8D4D-4AAB-AC1C-4A4EC4214A42.ref@yahoo.com> X-Rspamd-Queue-Id: 4GZQRp4r8rz4Wwm X-Spamd-Bar: - X-Spamd-Result: default: False [-1.50 / 15.00]; RCVD_TLS_LAST(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[yahoo.com:s=s2048]; MID_RHS_MATCH_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[yahoo.com]; MV_CASE(0.50)[]; MIME_GOOD(-0.10)[text/plain]; DWL_DNSWL_NONE(0.00)[yahoo.com:dkim]; R_SPF_ALLOW(-0.20)[+ptr:yahoo.com]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[yahoo.com:+]; RCPT_COUNT_TWO(0.00)[2]; RCVD_IN_DNSWL_NONE(0.00)[98.137.65.148:from]; NEURAL_HAM_SHORT(-1.00)[-0.999]; DMARC_POLICY_ALLOW(-0.50)[yahoo.com,reject]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[yahoo.com]; ASN(0.00)[asn:36647, ipnet:98.137.64.0/20, country:US]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[dev-commits-src-main]; RWL_MAILSPIKE_POSSIBLE(0.00)[98.137.65.148:from] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jul 2021 07:35:19 -0000 Ed Maste emaste at FreeBSD.org wrote on Tue Jul 27 21:24:57 UTC 2021 : . . . > 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 wording leaves open at least 2 possibilities: A) The kernel debug symbols are not stripped out and are left in the original kernel files, so the information is still available, just in a different place. B) The kernel debug symbols become not available by being stripped out of the original kernel files without being moved/copied to other files. =3D=3D=3D Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar) From owner-dev-commits-src-main@freebsd.org Wed Jul 28 09:30:37 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Jul 28 09:30:38 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Jul 28 10:42:16 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Jul 28 10:42:17 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Jul 28 11:34:56 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Jul 28 11:43:40 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Jul 28 11:47:44 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Jul 28 12:21:51 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Jul 28 13:34:16 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Jul 28 13:37:59 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Jul 28 13:39:44 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Jul 28 14:41:32 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Jul 28 14:41:33 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Jul 28 15:20:50 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Jul 28 15:27:48 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Jul 28 15:27:49 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Jul 28 15:27:51 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Jul 28 15:27:47 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Jul 28 15:27:53 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Jul 28 15:27:53 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Jul 28 15:27:56 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Jul 28 15:27:50 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Jul 28 15:27:55 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Jul 28 15:27:57 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Jul 28 15:27:59 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Jul 28 15:27:59 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Jul 28 15:28:03 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jul 2021 15:28:04 -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-main@freebsd.org Wed Jul 28 15:28:02 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jul 2021 15:28:02 -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-main@freebsd.org Wed Jul 28 15:28:02 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Jul 28 16:24:20 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Jul 28 16:27:02 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Jul 28 16:35:17 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Jul 28 16:37:32 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 60B9C65F681 for ; Wed, 28 Jul 2021 16:37:32 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qt1-x833.google.com (mail-qt1-x833.google.com [IPv6:2607:f8b0:4864:20::833]) (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 4GZfTS1nGwz3RBK for ; Wed, 28 Jul 2021 16:37:32 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-qt1-x833.google.com with SMTP id k13so1767661qth.10 for ; Wed, 28 Jul 2021 09:37:32 -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=SdivXWOjQW4CrS6juA3oGqDt7Ys54hKObKFrGIwmwCYebXG5fEJdTjWBJDHV5dMe0m wGW4WmO9NISXpTwpSbq8dkYtfj3kqWvb1Ykcw4OYL6obgZfx70zHVU5atSc6f6pd/2AJ UCS/gaVxFUwek97l60ZvN+UMjz4rD642mxUlRF8WKA5BUa0YGF5qBwk8GGk8ZXW8gQ9t uUuM7Hh0P/8axnPAfaFQ+EVq1ywkZJ4Tg+6xcpPjh2bm7OTsIbj8uucEh4fMNglMKEtd HvN1aaDKlo0oPNXwF9GvoGIrP3RHoKqRwh+2JBDnT0+L88ZAYD9hB5vuE0MKkMefQAKX dV5Q== X-Gm-Message-State: AOAM532EO/AOf6JbKr2o4h5pzGYLyQnXfhKZ1+0t9DgJqlzWEk42SreZ ldm8SN+/+30H0kSqjqJ6bX30Ow== 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: 4GZfTS1nGwz3RBK X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jul 2021 16:37:32 -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-main@freebsd.org Wed Jul 28 17:10:54 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Jul 28 18:27:34 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C57FF662A59 for ; Wed, 28 Jul 2021 18:27:34 +0000 (UTC) (envelope-from kevin.bowling@kev009.com) Received: from mail-yb1-xb34.google.com (mail-yb1-xb34.google.com [IPv6:2607:f8b0:4864:20::b34]) (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 4GZhwQ55Ckz4mCZ for ; Wed, 28 Jul 2021 18:27:34 +0000 (UTC) (envelope-from kevin.bowling@kev009.com) Received: by mail-yb1-xb34.google.com with SMTP id x192so5623265ybe.0 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=U9xVfTYGQ74x71dXiHspU39SN0otZGhWFH9LKVRGOG7z63WQHr2hP7r8h2C+Aw++L0 CNuAqiP6oFtr03GBBFCphAv+3knI5jxE9CXOdhqVL/ayGVr755YxUIVMrbp+JhwJYlYg tYel2No8201DZ5DiOtJNoVhhTRj7LW690OIEGyfr19i1UoQx4u4ji/H1I/z8ZrZQT+1O 9MJRRDGifKwbdfhtJ2SpkbT0Dv0VHpDb1azxN45JWgd9WQKEukYCHkWqeKlJBPhMlVxV QsYwO3f6E9iXNhDmaasvXOln4m4cnKtYKQukCiM8GCDXwCizpPTpXMBe2meqR0PDlH5i MEvA== X-Gm-Message-State: AOAM532E3SD+6KYA75i7LZFOqs2hoyu5ukBLWXCvUjIeWF+9OABzn0eE CzN4zQGaN35zs8aE+Wc6BONhW1danXBqdWD5xZCYyg== 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: 4GZhwQ55Ckz4mCZ X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Jul 28 19:24:07 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Jul 28 19:54:50 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Jul 28 19:54:53 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Jul 28 19:54:51 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Jul 28 20:07:25 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Jul 28 20:07:26 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Jul 28 20:07:29 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Jul 28 20:07:27 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Jul 28 20:30:46 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Jul 28 20:38:06 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Jul 28 21:15:50 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Jul 28 22:26:37 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Jul 28 22:52:15 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Jul 28 22:54:05 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Jul 28 23:34:17 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Jul 28 23:47:40 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1C5BA66752E for ; Wed, 28 Jul 2021 23:47:40 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) (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 4GZr1l6hqzz3vTt for ; Wed, 28 Jul 2021 23:47:39 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wr1-f46.google.com with SMTP id l18so4499515wrv.5 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=YgY8us/GxsBUvx8hKCAjEht7QwD1BB0+U+PudenxRR765x9r5BGhS7w05wFwtkyKUN zMxvjB3+4vup/BBbykzOxAI0jNG+xvK7nAuQm9DhI9Le4sembVMMjXptezDavqzQI8lW YVfR31EdDVF1yqJgtyf5RYst8U7IpMJ2CbTgCN+SXarm0GcwGjWSHNxIi0LDoND8jDBm Qf2pTxMsvtVMb0r15+s58uir7qo4hblAjilOvNHLi2mxpwlv8EKBrXBjYL3UyS3QLRN2 rXnuQkOisEmVrqgJ/LEqAUBmaVfPPEvDyMH/DImkpdjaqHxbxb+daD3SG8CGE9EnEMcJ 1TXg== X-Gm-Message-State: AOAM531uuT2znBG/Wmtf0MVU7Yo9lQmXsrLmuwwrwN7a02VDxpjtU+LL cZVVlnEeT9k+EHv8AbW6lDFVFTDbhmb8hQ== 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: 4GZr1l6hqzz3vTt X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Thu Jul 29 01:19:41 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Jul 29 02:00:33 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Jul 29 02:55:01 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Jul 29 03:22:35 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Jul 29 04:01:07 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Jul 29 06:07:57 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 539C666B856 for ; Thu, 29 Jul 2021 06:07:57 +0000 (UTC) (envelope-from kevin.bowling@kev009.com) Received: from mail-yb1-xb2c.google.com (mail-yb1-xb2c.google.com [IPv6:2607:f8b0:4864:20::b2c]) (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 4Gb0SY1j8tz3F1t for ; Thu, 29 Jul 2021 06:07:57 +0000 (UTC) (envelope-from kevin.bowling@kev009.com) Received: by mail-yb1-xb2c.google.com with SMTP id k65so8245417yba.13 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=oF/5Q2DwBODgIEQQ3VuyKKhtJFi6+oGHXQExFNjw1JHsEXaYtk1ykaW31oH5M0RZWp 0vbjqb63swkdouorw28CdS7FOtVckapJ+Lu10ka8HtQt0cuJJreUPFemIYan70+JJKaW fuOmIv+XXJqb9xj3SRyUa/YSIuMcnwnDuYZB4yydBGBfYZi2psNHRC5+8SRm4Zs7O01J +AVuCV8I7k5CaBOqIpHKhlKZltfvbk0yKl00fb87vyCnXVoIh+PxZ03qsZgPymTiY8UV FpDpXbgFTV0lCMxTS21+GDSaSlq5mFyNTsG4qHDh3E5muMCygZPQaoTqiGurrW29xXWs PkzQ== X-Gm-Message-State: AOAM533GJ0wyj2YCsqrGE4a2kjdmuLoQc8QIkURwkT1UcnroAx0P/B9Q X2O9H72I1SGQGYsxawtR61pxt+hWC4/t4oEsiLEe1Q== 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: 4Gb0SY1j8tz3F1t X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: 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-main@freebsd.org Thu Jul 29 06:41:28 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Jul 29 06:58:47 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Jul 29 07:25:37 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Jul 29 07:37:33 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Jul 29 07:55:20 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Jul 29 08:32:00 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Jul 29 08:48:36 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Jul 29 08:48:37 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Jul 29 09:05:37 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Jul 29 09:46:03 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Jul 29 09:46:04 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Jul 29 09:46:05 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Jul 29 09:46:07 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Jul 29 09:46:10 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Jul 29 09:46:08 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Jul 29 09:46:07 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Jul 29 09:46:12 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Jul 29 09:46:11 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Jul 29 09:58:38 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Jul 29 09:58:40 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Jul 29 09:58:41 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Jul 29 09:58:43 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Jul 29 09:58:42 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Jul 29 09:58:45 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Jul 29 09:58:47 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Jul 29 09:58:54 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Jul 29 09:58:57 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Jul 29 09:58:50 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Jul 29 09:58:51 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Jul 29 09:58:58 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Jul 29 09:59:00 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Jul 29 09:59:01 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jul 2021 09:59:01 -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-main@freebsd.org Thu Jul 29 09:59:02 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Jul 29 09:58:47 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Jul 29 09:58:48 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Jul 29 09:58:50 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Jul 29 09:58:55 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Jul 29 09:58:57 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Jul 29 09:58:52 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Jul 29 09:59:03 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Jul 29 13:35:01 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Jul 29 14:49:11 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Jul 29 14:49:13 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Jul 29 14:49:14 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Jul 29 15:01:50 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Jul 29 17:57:21 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Jul 29 21:28:09 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Jul 29 21:46:35 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Jul 29 22:21:06 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Jul 29 22:21:08 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Jul 29 23:14:25 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Jul 29 23:32:17 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Jul 29 23:35:07 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Jul 29 23:35:08 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Fri Jul 30 00:09:58 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-main@freebsd.org Fri Jul 30 01:14:52 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-main@freebsd.org Fri Jul 30 01:14:53 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-main@freebsd.org Fri Jul 30 03:26:16 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-main@freebsd.org Fri Jul 30 03:54:06 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-main@freebsd.org Fri Jul 30 04:01:32 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-main@freebsd.org Fri Jul 30 12:03:44 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E3EC9666601 for ; Fri, 30 Jul 2021 12:03:44 +0000 (UTC) (envelope-from bounces+17430347-76af-dev-commits-src-main=freebsd.org@em9210.fdc-k.or.ke) Received: from o50316380.outbound-mail.sendgrid.net (o50316380.outbound-mail.sendgrid.net [50.31.63.80]) (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 did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4GbmJc2jKTz4j6P for ; Fri, 30 Jul 2021 12:03:44 +0000 (UTC) (envelope-from bounces+17430347-76af-dev-commits-src-main=freebsd.org@em9210.fdc-k.or.ke) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fdc-k.or.ke; h=content-transfer-encoding:content-type:from:mime-version:subject:to: list-unsubscribe; s=s2; bh=M3ULpikj6SafTlas94PTX/JiT/+YmkdK2ti6ElqRNF8=; b=PmZG4Jf6dj3OHWaPxqvLTvymXB2VToWQa+s0iJI7iaapjiol+AyZpFtEcjzjn7SI2I5Z t+xXEVlwJdQLJtp3N8qcHzNDflxzlgcBAvZn6ddKEgHKjhqDiBYwj12NmUNpuVVkdykwCs HWRqlJ2CNLhuj8mLxz9a54h+p7I2FMB60= Received: by filterdrecv-canary-fbdb7768b-rss9j with SMTP id filterdrecv-canary-fbdb7768b-rss9j-1-6103EA87-49 2021-07-30 12:03:19.367457947 +0000 UTC m=+322637.152410157 Received: from MTc0MzAzNDc (unknown) by geopod-ismtpd-1-0 (SG) with HTTP id hO9PKnpERRCcnTSXVP5qtg Fri, 30 Jul 2021 12:03:19.329 +0000 (UTC) Date: Fri, 30 Jul 2021 12:03:43 +0000 (UTC) From: "FDC-K .ORG" Message-ID: Subject: Invitation to Monitoring and Evaluation for Food Security and Nutrition Workshop Oct 04 2021 X-SG-EID: =?us-ascii?Q?UEMqp3YVKKtUL01h4vS23ewQT=2FZe5x+tb1E7zy1tWm3=2FInm3qe8Nv6tqu+uGKn?= =?us-ascii?Q?tFqbxECCnXcuZFSvQjCVqbD5FE5En02KU21ngb+?= =?us-ascii?Q?L+SuWgDEmkDi9M+HaHkZFyESR0rOcFt8fiyvsBd?= =?us-ascii?Q?NIQH5NDtB1oVYO6=2FwZverbv6sYsM2pCTUOaXbMg?= =?us-ascii?Q?aKwGb9HExYGbhxWHRDAihrnUWGCCa=2Fo2fkHzt1E?= =?us-ascii?Q?sUVQZ4LFj9QlOUNUkJ86gmBLL061vRnXJMNynNn?= =?us-ascii?Q?dfb2s=2FU=2FR8l+qVjINV87w=3D=3D?= To: dev-commits-src-main@freebsd.org X-Entity-ID: lgZohGoWIjvYsKzlUpYsxA== X-Rspamd-Queue-Id: 4GbmJc2jKTz4j6P X-Spamd-Bar: +++++++++ Authentication-Results: mx1.freebsd.org; dkim=pass header.d=fdc-k.or.ke header.s=s2 header.b=PmZG4Jf6; dmarc=none; spf=pass (mx1.freebsd.org: domain of bounces@em9210.fdc-k.or.ke designates 50.31.63.80 as permitted sender) smtp.mailfrom=bounces@em9210.fdc-k.or.ke X-Spamd-Result: default: False [9.09 / 15.00]; R_SPF_ALLOW(0.00)[+ip4:50.31.32.0/19:c]; MV_CASE(0.50)[]; TO_DN_NONE(0.00)[]; DKIM_TRACE(0.00)[fdc-k.or.ke:+]; FORGED_SENDER(0.30)[workshops@fdc-k.or.ke,bounces@em9210.fdc-k.or.ke]; MIME_TRACE(0.00)[0:~]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:11377, ipnet:50.31.48.0/20, country:US]; TAGGED_FROM(0.00)[17430347-76af-dev-commits-src-main=freebsd.org]; FROM_NEQ_ENVFROM(0.00)[workshops@fdc-k.or.ke,bounces@em9210.fdc-k.or.ke]; ARC_NA(0.00)[]; RSPAMD_URIBL(4.50)[fdc-k.or.ke:dkim,fdc-k.or.ke:url,fdc-k.org:url,fdc-k.org:email]; R_DKIM_ALLOW(0.00)[fdc-k.or.ke:s=s2]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_SPAM_SHORT(1.00)[1.000]; DMARC_NA(0.00)[fdc-k.or.ke]; HAS_LIST_UNSUB(-0.01)[]; RCPT_COUNT_ONE(0.00)[1]; BAD_REP_POLICIES(0.10)[]; NEURAL_SPAM_MEDIUM(1.00)[1.000]; NEURAL_SPAM_LONG(1.00)[1.000]; MIME_HTML_ONLY(0.20)[]; RWL_MAILSPIKE_POSSIBLE(0.00)[50.31.63.80:from]; MID_RHS_NOT_FQDN(0.50)[]; RCVD_COUNT_TWO(0.00)[2]; GREYLIST(0.00)[pass,body]; MAILMAN_DEST(0.00)[dev-commits-src-main] X-Spam: Yes MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jul 2021 12:03:44 -0000 From owner-dev-commits-src-main@freebsd.org Fri Jul 30 12:24:04 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-main@freebsd.org Fri Jul 30 12:24:05 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-main@freebsd.org Fri Jul 30 13:34:40 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-main@freebsd.org Fri Jul 30 19:22:17 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-main@freebsd.org Fri Jul 30 20:01:57 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-main@freebsd.org Fri Jul 30 20:51:09 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-main@freebsd.org Fri Jul 30 22:56:37 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-main@freebsd.org Fri Jul 30 23:09:19 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-main@freebsd.org Sat Jul 31 00:03:50 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-main@freebsd.org Sat Jul 31 00:03:52 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-main@freebsd.org Sat Jul 31 04:16:53 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-main@freebsd.org Sat Jul 31 05:43:18 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-main@freebsd.org Sat Jul 31 05:43:19 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-main@freebsd.org Sat Jul 31 12:48:40 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-main@freebsd.org Sat Jul 31 13:38:36 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-main@freebsd.org Sat Jul 31 13:41:32 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-main@freebsd.org Sat Jul 31 13:54:12 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-main@freebsd.org Sat Jul 31 13:54:14 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-main@freebsd.org Sat Jul 31 15:01:45 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-main@freebsd.org Sat Jul 31 15:05:36 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-main@freebsd.org Sat Jul 31 21:49:26 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-main@freebsd.org Sat Jul 31 22:18:40 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-main@freebsd.org Sat Jul 31 22:25:06 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-main@freebsd.org Sat Jul 31 22:43:42 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-main@freebsd.org Sun Aug 1 07:11:37 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-main@freebsd.org Sun Aug 1 09:14:13 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-main@freebsd.org Sun Aug 1 09:51:36 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-main@freebsd.org Sun Aug 1 10:32:43 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-main@freebsd.org Sun Aug 1 10:50:31 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-main@freebsd.org Sun Aug 1 12:57:42 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-main@freebsd.org Sun Aug 1 13:27:40 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-main@freebsd.org Sun Aug 1 13:41:07 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-main@freebsd.org Sun Aug 1 13:42:16 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-main@freebsd.org Sun Aug 1 15:09:10 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-main@freebsd.org Sun Aug 1 17:01:44 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-main@freebsd.org Sun Aug 1 17:10:58 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-main@freebsd.org Sun Aug 1 17:33:57 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-main@freebsd.org Sun Aug 1 20:54:58 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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)