Re: svn commit: r357312 - head/sys/kern
On Thu, Jan 30, 2020 at 08:05:05PM +, Mateusz Guzik wrote: > New Revision: 357312 > URL: https://svnweb.freebsd.org/changeset/base/357312 > > Log: > Remove duplicated empty lines from kern/*.c Thank you. Every once in a while when I want/need to hack on src code base, these superfluous newlines drive me away. :-( ./danfe ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r357314 - in head/sys: conf kern sys vm
In message <202001310049.00v0np1a077...@repo.freebsd.org>, Jeff Roberson writes : > Author: jeff > Date: Fri Jan 31 00:49:51 2020 > New Revision: 357314 > URL: https://svnweb.freebsd.org/changeset/base/357314 > > Log: > Implement a safe memory reclamation feature that is tightly coupled with UM > A. > > This is in the same family of algorithms as Epoch/QSBR/RCU/PARSEC but is > a unique algorithm. This has 3x the performance of epoch in a write heavy > workload with less than half of the read side cost. The memory overhead > is significantly lessened by limiting the free-to-use latency. A synthetic > test uses 1/20th of the memory vs Epoch. There is significant further > discussion in the comments and code review. > > This code should be considered experimental. I will write a man page after > it has settled. After further validation the VM will begin using this > feature to permit lockless page lookups. > > Both markj and cperciva tested on arm64 at large core counts to verify > fences on weaker ordering architectures. I will commit a stress testing > tool in a follow-up. > > Reviewed by:mmacy, markj, rlibby, hselasky > Discussed with: sbahara > Differential Revision: https://reviews.freebsd.org/D22586 > > Added: > head/sys/kern/subr_smr.c (contents, props changed) > head/sys/sys/_smr.h (contents, props changed) > head/sys/sys/smr.h (contents, props changed) > Modified: > head/sys/conf/files > head/sys/vm/uma.h > head/sys/vm/uma_core.c > head/sys/vm/uma_int.h > Thank you for all your hard work Jeff. -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r357318 - head/sys/netinet6
Author: np Date: Fri Jan 31 02:23:48 2020 New Revision: 357318 URL: https://svnweb.freebsd.org/changeset/base/357318 Log: Fix NOINET builds. Modified: head/sys/netinet6/udp6_usrreq.c Modified: head/sys/netinet6/udp6_usrreq.c == --- head/sys/netinet6/udp6_usrreq.c Fri Jan 31 02:18:56 2020 (r357317) +++ head/sys/netinet6/udp6_usrreq.c Fri Jan 31 02:23:48 2020 (r357318) @@ -1177,7 +1177,9 @@ udp6_close(struct socket *so) static int udp6_connect(struct socket *so, struct sockaddr *nam, struct thread *td) { +#ifdef INET struct epoch_tracker et; +#endif struct inpcb *inp; struct inpcbinfo *pcbinfo; struct sockaddr_in6 *sin6; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r357317 - in head/tools/uma: . smrstress
Author: jeff Date: Fri Jan 31 02:18:56 2020 New Revision: 357317 URL: https://svnweb.freebsd.org/changeset/base/357317 Log: Implement a simple UMA SMR stress testing tool. Added: head/tools/uma/ head/tools/uma/smrstress/ head/tools/uma/smrstress/Makefile (contents, props changed) head/tools/uma/smrstress/smrstress.c (contents, props changed) Added: head/tools/uma/smrstress/Makefile == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/uma/smrstress/Makefile Fri Jan 31 02:18:56 2020 (r357317) @@ -0,0 +1,8 @@ +# +# $FreeBSD$ +# + +KMOD= smrstress +SRCS= smrstress.c + +.include Added: head/tools/uma/smrstress/smrstress.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/uma/smrstress/smrstress.cFri Jan 31 02:18:56 2020 (r357317) @@ -0,0 +1,227 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2020 Jeffrey Roberson + * + * 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$ + * + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +static uma_zone_t smrs_zone; +static smr_t smrs_smr; + +static int smrs_cpus; +static int smrs_writers; +static int smrs_started; +static int smrs_iterations = 1000; +static int smrs_failures = 0; +static volatile int smrs_completed; + +struct smrs { + int generation; + volatile u_int count; +}; + +uintptr_t smrs_current; + +static void +smrs_error(struct smrs *smrs, const char *fmt, ...) +{ + va_list ap; + + atomic_add_int(_failures, 1); + printf("SMR ERROR: wr_seq %d, rd_seq %d, c_seq %d, generation %d, count %d ", + smrs_smr->c_shared->s_wr_seq, smrs_smr->c_shared->s_rd_seq, + zpcpu_get(smrs_smr)->c_seq, smrs->generation, smrs->count); + va_start(ap, fmt); + (void)vprintf(fmt, ap); + va_end(ap); +} + +static void +smrs_read(void) +{ + struct smrs *cur; + int cnt; + + /* Wait for the writer to exit. */ + while (smrs_completed == 0) { + smr_enter(smrs_smr); + cur = (void *)atomic_load_ptr(_current); + if (cur->generation == -1) + smrs_error(cur, "read early: Use after free!\n"); + atomic_add_int(>count, 1); + DELAY(100); + cnt = atomic_fetchadd_int(>count, -1); + if (cur->generation == -1) + smrs_error(cur, "read late: Use after free!\n"); + else if (cnt <= 0) + smrs_error(cur, "Invalid ref\n"); + smr_exit(smrs_smr); + maybe_yield(); + } +} + +static void +smrs_write(void) +{ + struct smrs *cur; + int i; + + for (i = 0; i < smrs_iterations; i++) { + cur = uma_zalloc_smr(smrs_zone, M_WAITOK); + cur = (void *)atomic_swap_ptr(_current, (uintptr_t)cur); + uma_zfree_smr(smrs_zone, cur); + } +} + +static void +smrs_thread(void *arg) +{ + int rw = (intptr_t)arg; + + if (rw < smrs_writers) + smrs_write(); + else + smrs_read(); + atomic_add_int(_completed, 1); +} + +static void +smrs_start(void) +{ + struct smrs *cur; + int i; + + smrs_cpus = mp_ncpus; + if (mp_ncpus > 3) + smrs_writers = 2; + else + smrs_writers = 1; + smrs_started = smrs_cpus; + smrs_completed =
svn commit: r357316 - in head/sys: kern sys
Author: jeff Date: Fri Jan 31 02:08:09 2020 New Revision: 357316 URL: https://svnweb.freebsd.org/changeset/base/357316 Log: Don't use "All rights reserved" in new copyrights. Requested by: rgrimes Modified: head/sys/kern/subr_smr.c head/sys/sys/_smr.h head/sys/sys/smr.h Modified: head/sys/kern/subr_smr.c == --- head/sys/kern/subr_smr.cFri Jan 31 02:03:22 2020(r357315) +++ head/sys/kern/subr_smr.cFri Jan 31 02:08:09 2020(r357316) @@ -1,8 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 2019 Jeffrey Roberson - * All rights reserved. + * Copyright (c) 2019,2020 Jeffrey Roberson * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/sys/_smr.h == --- head/sys/sys/_smr.h Fri Jan 31 02:03:22 2020(r357315) +++ head/sys/sys/_smr.h Fri Jan 31 02:08:09 2020(r357316) @@ -1,8 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 2019,2020 Jeffrey Roberson - * All rights reserved. + * Copyright (c) 2019, 2020 Jeffrey Roberson * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/sys/smr.h == --- head/sys/sys/smr.h Fri Jan 31 02:03:22 2020(r357315) +++ head/sys/sys/smr.h Fri Jan 31 02:08:09 2020(r357316) @@ -1,8 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 2019,2020 Jeffrey Roberson - * All rights reserved. + * Copyright (c) 2019, 2020 Jeffrey Roberson * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r357315 - head/sys/vm
Author: jeff Date: Fri Jan 31 02:03:22 2020 New Revision: 357315 URL: https://svnweb.freebsd.org/changeset/base/357315 Log: Fix LINT build with MEMGUARD. Modified: head/sys/vm/uma_core.c Modified: head/sys/vm/uma_core.c == --- head/sys/vm/uma_core.c Fri Jan 31 00:49:51 2020(r357314) +++ head/sys/vm/uma_core.c Fri Jan 31 02:03:22 2020(r357315) @@ -2980,7 +2980,7 @@ uma_zalloc_debug(uma_zone_t zone, void **itemp, void * #endif #ifdef DEBUG_MEMGUARD - if ((zone->uz_flags & UMA_ZONE_SMR == 0) && memguard_cmp_zone(zone)) { + if ((zone->uz_flags & UMA_ZONE_SMR) == 0 && memguard_cmp_zone(zone)) { void *item; item = memguard_alloc(zone->uz_size, flags); if (item != NULL) { @@ -3014,7 +3014,7 @@ uma_zfree_debug(uma_zone_t zone, void *item, void *uda ("uma_zfree_debug: called with spinlock or critical section held")); #ifdef DEBUG_MEMGUARD - if ((zone->uz_flags & UMA_ZONE_SMR == 0) && is_memguard_addr(item)) { + if ((zone->uz_flags & UMA_ZONE_SMR) == 0 && is_memguard_addr(item)) { if (zone->uz_dtor != NULL) zone->uz_dtor(item, zone->uz_size, udata); if (zone->uz_fini != NULL) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r357138 - head/bin/pwait
On 26-01-2020 11:49, Pawel Jakub Dawidek wrote: Author: pjd Date: Sun Jan 26 10:49:24 2020 New Revision: 357138 URL: https://svnweb.freebsd.org/changeset/base/357138 Log: - Be consistent with using sysexits(3) codes. - Turn fprintf()+exit() into errx(). Sponsored by: Fudo Security Modified: head/bin/pwait/pwait.c Modified: head/bin/pwait/pwait.c == --- head/bin/pwait/pwait.c Sun Jan 26 07:24:49 2020(r357137) +++ head/bin/pwait/pwait.c Sun Jan 26 10:49:24 2020(r357138) @@ -53,8 +53,7 @@ static void usage(void) { - fprintf(stderr, "usage: pwait [-t timeout] [-v] pid ...\n"); - exit(EX_USAGE); + errx(EX_USAGE, "usage: pwait [-t timeout] [-v] pid ..."); This adds a "pwait: " before the line, which most other programs do not do. -- Jilles Tjoelker ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r357313 - head/sys/riscv/riscv
Author: jhb Date: Thu Jan 30 22:19:48 2020 New Revision: 357313 URL: https://svnweb.freebsd.org/changeset/base/357313 Log: Trim duplicate CSR swaps from user exceptions. The stack pointer is swapped with the sscratch CSR just before the jump to cpu_exception_handler_user where the first instruction swaps it again. The two swaps together are a no-op, but the csr swap instructions can be expensive (e.g. on Bluespec RISC-V cores csr swap instructions force a full pipeline stall). Reported by: jrtc27 Reviewed by: br MFC after:2 weeks Sponsored by: DARPA Differential Revision:https://reviews.freebsd.org/D23394 Modified: head/sys/riscv/riscv/exception.S Modified: head/sys/riscv/riscv/exception.S == --- head/sys/riscv/riscv/exception.SThu Jan 30 20:05:05 2020 (r357312) +++ head/sys/riscv/riscv/exception.SThu Jan 30 22:19:48 2020 (r357313) @@ -208,7 +208,6 @@ ENTRY(cpu_exception_handler) csrrw sp, sscratch, sp beqzsp, 1f /* User mode detected */ - csrrw sp, sscratch, sp j cpu_exception_handler_user 1: /* Supervisor mode detected */ @@ -225,7 +224,6 @@ ENTRY(cpu_exception_handler_supervisor) END(cpu_exception_handler_supervisor) ENTRY(cpu_exception_handler_user) - csrrw sp, sscratch, sp save_registers 0 mv a0, sp call_C_LABEL(do_trap_user) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r357293 - head/sys/net
On Thu, 30 Jan 2020, Hans Petter Selasky wrote: On 2020-01-30 21:56, Gleb Smirnoff wrote: On Thu, Jan 30, 2020 at 12:04:03PM +, Hans Petter Selasky wrote: H> Author: hselasky H> Date: Thu Jan 30 12:04:02 2020 H> New Revision: 357293 H> URL: https://svnweb.freebsd.org/changeset/base/357293 H> H> Log: H> Widen EPOCH(9) usage in netisr. H> H> Software interrupt handlers are allowed to sleep. In swi_net() there H> is a read lock behind NETISR_RLOCK() which in turn ends up calling H> msleep() which means the whole of swi_net() cannot be protected by an H> EPOCH(9) section. By default the NETISR_LOCKING feature is disabled. H> H> This issue was introduced by r357004. This is a preparation step for H> replacing the functionality provided by r357004. H> H> Found by: kib@ H> Sponsored by: Mellanox Technologies What?! NETISR_RLOCK() which in turn ends up calling msleep()? Can you please explain this nonsense? See rms_rlock_fallback() in kern_rmlock.c . The network stack uses rm_ not rms_. Jeff --HPS ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r357293 - head/sys/net
On 2020-01-30 21:56, Gleb Smirnoff wrote: On Thu, Jan 30, 2020 at 12:04:03PM +, Hans Petter Selasky wrote: H> Author: hselasky H> Date: Thu Jan 30 12:04:02 2020 H> New Revision: 357293 H> URL: https://svnweb.freebsd.org/changeset/base/357293 H> H> Log: H> Widen EPOCH(9) usage in netisr. H> H> Software interrupt handlers are allowed to sleep. In swi_net() there H> is a read lock behind NETISR_RLOCK() which in turn ends up calling H> msleep() which means the whole of swi_net() cannot be protected by an H> EPOCH(9) section. By default the NETISR_LOCKING feature is disabled. H> H> This issue was introduced by r357004. This is a preparation step for H> replacing the functionality provided by r357004. H> H> Found by: kib@ H> Sponsored by: Mellanox Technologies What?! NETISR_RLOCK() which in turn ends up calling msleep()? Can you please explain this nonsense? See rms_rlock_fallback() in kern_rmlock.c . --HPS ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r357293 - head/sys/net
On Thu, 30 Jan 2020, Gleb Smirnoff wrote: On Thu, Jan 30, 2020 at 12:04:03PM +, Hans Petter Selasky wrote: H> Author: hselasky H> Date: Thu Jan 30 12:04:02 2020 H> New Revision: 357293 H> URL: https://svnweb.freebsd.org/changeset/base/357293 H> H> Log: H> Widen EPOCH(9) usage in netisr. H> H> Software interrupt handlers are allowed to sleep. In swi_net() there H> is a read lock behind NETISR_RLOCK() which in turn ends up calling H> msleep() which means the whole of swi_net() cannot be protected by an H> EPOCH(9) section. By default the NETISR_LOCKING feature is disabled. H> H> This issue was introduced by r357004. This is a preparation step for H> replacing the functionality provided by r357004. H> H> Found by: kib@ H> Sponsored by: Mellanox Technologies What?! NETISR_RLOCK() which in turn ends up calling msleep()? Can you please explain this nonsense? It does not look like NETISR_RLOCK is configured as sleepable so it just uses a mtx. Jeff -- Gleb Smirnoff ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r357291 - in head/sys/dev: bwi bwn ipw iwi iwm iwn malo mwl ral rtwn/pci wi wpi wtap
On Thu, Jan 30, 2020 at 10:51:23AM -1000, Jeff Roberson wrote: J> On Thu, 30 Jan 2020, Gleb Smirnoff wrote: J> J> > On Thu, Jan 30, 2020 at 10:28:01AM +, Hans Petter Selasky wrote: J> > H> Author: hselasky J> > H> Date: Thu Jan 30 10:28:01 2020 J> > H> New Revision: 357291 J> > H> URL: https://svnweb.freebsd.org/changeset/base/357291 J> > H> J> > H> Log: J> > H> Widen EPOCH(9) usage in PCI WLAN drivers. J> > H> J> > H> Make sure all occurrences of ieee80211_input_xxx() in sys/dev are J> > H> covered by a network epoch section. Do not depend on the interrupt J> > H> handler nor any taskqueues being in a network epoch section. J> > H> J> > H> This patch should unbreak the PCI WLAN drivers after r357004. J> > H> J> > H> Pointy hat: glebius@ J> > H> Sponsored by: Mellanox Technologies J> > J> > Hey, I have reviewed all of them. J> > J> > The following drivers were not broken, and your change does 100% J> > recursive epoch_enter: J> > J> > bwi, ipw, iwi, iwm, iwn, ral, rtwn, wi, wpi J> > J> > The following drivers use taskq and would be fixed by D23408: J> > J> > bwn, malo, mwl, wtap J> > J> > P.S. A funny note about wtap. You modified even a function that J> > is a dead code - wtap_rx_deliver(). Gives some clue on quality J> > of your sweep over all drivers. J> J> I would strongly suggest that we not make more changes to this area J> without a discussion on a review to make sure we're all in agreement. J> There are some fine technical details which would benefit from multiple J> eyes and failing to act together is creating more conflict than is J> necessary. I volunteer to be on the reviews as an impartial third party. Don't worry, I'm not going to participate in the commit war Hans started. -- Gleb Smirnoff ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r357293 - head/sys/net
On Thu, Jan 30, 2020 at 12:04:03PM +, Hans Petter Selasky wrote: H> Author: hselasky H> Date: Thu Jan 30 12:04:02 2020 H> New Revision: 357293 H> URL: https://svnweb.freebsd.org/changeset/base/357293 H> H> Log: H> Widen EPOCH(9) usage in netisr. H> H> Software interrupt handlers are allowed to sleep. In swi_net() there H> is a read lock behind NETISR_RLOCK() which in turn ends up calling H> msleep() which means the whole of swi_net() cannot be protected by an H> EPOCH(9) section. By default the NETISR_LOCKING feature is disabled. H> H> This issue was introduced by r357004. This is a preparation step for H> replacing the functionality provided by r357004. H> H> Found by: kib@ H> Sponsored by: Mellanox Technologies What?! NETISR_RLOCK() which in turn ends up calling msleep()? Can you please explain this nonsense? -- Gleb Smirnoff ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r357291 - in head/sys/dev: bwi bwn ipw iwi iwm iwn malo mwl ral rtwn/pci wi wpi wtap
On Thu, 30 Jan 2020, Gleb Smirnoff wrote: On Thu, Jan 30, 2020 at 10:28:01AM +, Hans Petter Selasky wrote: H> Author: hselasky H> Date: Thu Jan 30 10:28:01 2020 H> New Revision: 357291 H> URL: https://svnweb.freebsd.org/changeset/base/357291 H> H> Log: H> Widen EPOCH(9) usage in PCI WLAN drivers. H> H> Make sure all occurrences of ieee80211_input_xxx() in sys/dev are H> covered by a network epoch section. Do not depend on the interrupt H> handler nor any taskqueues being in a network epoch section. H> H> This patch should unbreak the PCI WLAN drivers after r357004. H> H> Pointy hat: glebius@ H> Sponsored by: Mellanox Technologies Hey, I have reviewed all of them. The following drivers were not broken, and your change does 100% recursive epoch_enter: bwi, ipw, iwi, iwm, iwn, ral, rtwn, wi, wpi The following drivers use taskq and would be fixed by D23408: bwn, malo, mwl, wtap P.S. A funny note about wtap. You modified even a function that is a dead code - wtap_rx_deliver(). Gives some clue on quality of your sweep over all drivers. I would strongly suggest that we not make more changes to this area without a discussion on a review to make sure we're all in agreement. There are some fine technical details which would benefit from multiple eyes and failing to act together is creating more conflict than is necessary. I volunteer to be on the reviews as an impartial third party. Thanks, Jeff -- Gleb Smirnoff ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r357291 - in head/sys/dev: bwi bwn ipw iwi iwm iwn malo mwl ral rtwn/pci wi wpi wtap
On Thu, Jan 30, 2020 at 10:28:01AM +, Hans Petter Selasky wrote: H> Author: hselasky H> Date: Thu Jan 30 10:28:01 2020 H> New Revision: 357291 H> URL: https://svnweb.freebsd.org/changeset/base/357291 H> H> Log: H> Widen EPOCH(9) usage in PCI WLAN drivers. H> H> Make sure all occurrences of ieee80211_input_xxx() in sys/dev are H> covered by a network epoch section. Do not depend on the interrupt H> handler nor any taskqueues being in a network epoch section. H> H> This patch should unbreak the PCI WLAN drivers after r357004. H> H> Pointy hat:glebius@ H> Sponsored by: Mellanox Technologies Hey, I have reviewed all of them. The following drivers were not broken, and your change does 100% recursive epoch_enter: bwi, ipw, iwi, iwm, iwn, ral, rtwn, wi, wpi The following drivers use taskq and would be fixed by D23408: bwn, malo, mwl, wtap P.S. A funny note about wtap. You modified even a function that is a dead code - wtap_rx_deliver(). Gives some clue on quality of your sweep over all drivers. -- Gleb Smirnoff ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r357291 - in head/sys/dev: bwi bwn ipw iwi iwm iwn malo mwl ral rtwn/pci wi wpi wtap
On Thu, 30 Jan 2020, Hans Petter Selasky wrote: Author: hselasky Date: Thu Jan 30 10:28:01 2020 New Revision: 357291 URL: https://svnweb.freebsd.org/changeset/base/357291 Log: Widen EPOCH(9) usage in PCI WLAN drivers. Make sure all occurrences of ieee80211_input_xxx() in sys/dev are covered by a network epoch section. Do not depend on the interrupt handler nor any taskqueues being in a network epoch section. This patch should unbreak the PCI WLAN drivers after r357004. Pointy hat:glebius@ I understand your frustration at the bugs introduced by this change but the passive aggressive "pointy hat" is not appropriate. It is sufficient to note the revision. Jeff Sponsored by: Mellanox Technologies Modified: head/sys/dev/bwi/if_bwi.c head/sys/dev/bwn/if_bwn.c head/sys/dev/ipw/if_ipw.c head/sys/dev/iwi/if_iwi.c head/sys/dev/iwm/if_iwm.c head/sys/dev/iwn/if_iwn.c head/sys/dev/malo/if_malo.c head/sys/dev/mwl/if_mwl.c head/sys/dev/ral/rt2560.c head/sys/dev/ral/rt2661.c head/sys/dev/ral/rt2860.c head/sys/dev/rtwn/pci/rtwn_pci_rx.c head/sys/dev/wi/if_wi.c head/sys/dev/wpi/if_wpi.c head/sys/dev/wtap/if_wtap.c Modified: head/sys/dev/bwi/if_bwi.c == --- head/sys/dev/bwi/if_bwi.c Thu Jan 30 09:56:57 2020(r357290) +++ head/sys/dev/bwi/if_bwi.c Thu Jan 30 10:28:01 2020(r357291) @@ -1506,6 +1506,7 @@ bwi_stop_locked(struct bwi_softc *sc, int statechg) void bwi_intr(void *xsc) { + struct epoch_tracker et; struct bwi_softc *sc = xsc; struct bwi_mac *mac; uint32_t intr_status; @@ -1625,7 +1626,9 @@ bwi_intr(void *xsc) device_printf(sc->sc_dev, "intr noise\n"); if (txrx_intr_status[0] & BWI_TXRX_INTR_RX) { + NET_EPOCH_ENTER(et); rx_data = sc->sc_rxeof(sc); + NET_EPOCH_EXIT(et); if (sc->sc_flags & BWI_F_STOP) { BWI_UNLOCK(sc); return; Modified: head/sys/dev/bwn/if_bwn.c == --- head/sys/dev/bwn/if_bwn.c Thu Jan 30 09:56:57 2020(r357290) +++ head/sys/dev/bwn/if_bwn.c Thu Jan 30 10:28:01 2020(r357291) @@ -5072,6 +5072,7 @@ bwn_intr(void *arg) static void bwn_intrtask(void *arg, int npending) { + struct epoch_tracker et; struct bwn_mac *mac = arg; struct bwn_softc *sc = mac->mac_sc; uint32_t merged = 0; @@ -5132,6 +5133,7 @@ bwn_intrtask(void *arg, int npending) if (mac->mac_reason_intr & BWN_INTR_NOISESAMPLE_OK) bwn_intr_noise(mac); + NET_EPOCH_ENTER(et); if (mac->mac_flags & BWN_MAC_FLAG_DMA) { if (mac->mac_reason[0] & BWN_DMAINTR_RX_DONE) { bwn_dma_rx(mac->mac_method.dma.rx); @@ -5139,6 +5141,7 @@ bwn_intrtask(void *arg, int npending) } } else rx = bwn_pio_rx(>mac_method.pio.rx); + NET_EPOCH_EXIT(et); KASSERT(!(mac->mac_reason[1] & BWN_DMAINTR_RX_DONE), ("%s", __func__)); KASSERT(!(mac->mac_reason[2] & BWN_DMAINTR_RX_DONE), ("%s", __func__)); Modified: head/sys/dev/ipw/if_ipw.c == --- head/sys/dev/ipw/if_ipw.c Thu Jan 30 09:56:57 2020(r357290) +++ head/sys/dev/ipw/if_ipw.c Thu Jan 30 10:28:01 2020(r357291) @@ -1159,6 +1159,7 @@ static void ipw_rx_data_intr(struct ipw_softc *sc, struct ipw_status *status, struct ipw_soft_bd *sbd, struct ipw_soft_buf *sbuf) { + struct epoch_tracker et; struct ieee80211com *ic = >sc_ic; struct mbuf *mnew, *m; struct ieee80211_node *ni; @@ -1230,11 +1231,13 @@ ipw_rx_data_intr(struct ipw_softc *sc, struct ipw_stat IPW_UNLOCK(sc); ni = ieee80211_find_rxnode(ic, mtod(m, struct ieee80211_frame_min *)); + NET_EPOCH_ENTER(et); if (ni != NULL) { (void) ieee80211_input(ni, m, rssi - nf, nf); ieee80211_free_node(ni); } else (void) ieee80211_input_all(ic, m, rssi - nf, nf); + NET_EPOCH_EXIT(et); IPW_LOCK(sc); bus_dmamap_sync(sc->rbd_dmat, sc->rbd_map, BUS_DMASYNC_PREWRITE); Modified: head/sys/dev/iwi/if_iwi.c == --- head/sys/dev/iwi/if_iwi.c Thu Jan 30 09:56:57 2020(r357290) +++ head/sys/dev/iwi/if_iwi.c Thu Jan 30 10:28:01 2020(r357291) @@ -1181,6 +1181,7 @@ static void iwi_frame_intr(struct iwi_softc *sc, struct iwi_rx_data *data, int i, struct iwi_frame *frame) { + struct epoch_tracker et; struct ieee80211com *ic = >sc_ic; struct mbuf *mnew, *m; struct ieee80211_node *ni; @@ -1270,11 +1271,13 @@ iwi_frame_intr(struct iwi_softc *sc, struct iwi_rx_dat IWI_UNLOCK(sc);
Re: svn commit: r357291 - in head/sys/dev: bwi bwn ipw iwi iwm iwn malo mwl ral rtwn/pci wi wpi wtap
On Thu, Jan 30, 2020 at 10:28:01AM +, Hans Petter Selasky wrote: H> Author: hselasky H> Date: Thu Jan 30 10:28:01 2020 H> New Revision: 357291 H> URL: https://svnweb.freebsd.org/changeset/base/357291 H> H> Log: H> Widen EPOCH(9) usage in PCI WLAN drivers. H> H> Make sure all occurrences of ieee80211_input_xxx() in sys/dev are H> covered by a network epoch section. Do not depend on the interrupt H> handler nor any taskqueues being in a network epoch section. H> H> This patch should unbreak the PCI WLAN drivers after r357004. H> H> Pointy hat:glebius@ H> Sponsored by: Mellanox Technologies Just looking at the very first driver in the patch - bwi. Why do you call it "broken"? It doesn't need any "unbreaking after r357004". Can you please show me a callgraph where epoch_enter you added to bwi_intr() will not be unnecessary? -- Gleb Smirnoff ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r357312 - head/sys/kern
Author: mjg Date: Thu Jan 30 20:05:05 2020 New Revision: 357312 URL: https://svnweb.freebsd.org/changeset/base/357312 Log: Remove duplicated empty lines from kern/*.c No functional changes. Modified: head/sys/kern/imgact_binmisc.c head/sys/kern/imgact_elf.c head/sys/kern/init_main.c head/sys/kern/kern_alq.c head/sys/kern/kern_conf.c head/sys/kern/kern_exit.c head/sys/kern/kern_hhook.c head/sys/kern/kern_jail.c head/sys/kern/kern_kcov.c head/sys/kern/kern_kthread.c head/sys/kern/kern_linker.c head/sys/kern/kern_lockf.c head/sys/kern/kern_mib.c head/sys/kern/kern_mtxpool.c head/sys/kern/kern_pmc.c head/sys/kern/kern_poll.c head/sys/kern/kern_resource.c head/sys/kern/kern_sig.c head/sys/kern/kern_switch.c head/sys/kern/kern_sysctl.c head/sys/kern/kern_tc.c head/sys/kern/kern_time.c head/sys/kern/kern_ubsan.c head/sys/kern/kern_umtx.c head/sys/kern/link_elf.c head/sys/kern/link_elf_obj.c head/sys/kern/sched_4bsd.c head/sys/kern/sched_ule.c head/sys/kern/subr_acl_posix1e.c head/sys/kern/subr_blist.c head/sys/kern/subr_bufring.c head/sys/kern/subr_bus.c head/sys/kern/subr_clock.c head/sys/kern/subr_csan.c head/sys/kern/subr_fattime.c head/sys/kern/subr_filter.c head/sys/kern/subr_gtaskqueue.c head/sys/kern/subr_hints.c head/sys/kern/subr_intr.c head/sys/kern/subr_kdb.c head/sys/kern/subr_sbuf.c head/sys/kern/subr_sleepqueue.c head/sys/kern/subr_smp.c head/sys/kern/subr_stats.c head/sys/kern/subr_unit.c head/sys/kern/subr_vmem.c head/sys/kern/subr_witness.c head/sys/kern/sys_generic.c head/sys/kern/sys_pipe.c head/sys/kern/sys_process.c head/sys/kern/sysv_msg.c head/sys/kern/sysv_shm.c head/sys/kern/uipc_mbuf.c head/sys/kern/uipc_usrreq.c head/sys/kern/vfs_acl.c head/sys/kern/vfs_bio.c head/sys/kern/vfs_cluster.c head/sys/kern/vfs_extattr.c head/sys/kern/vfs_init.c head/sys/kern/vfs_subr.c head/sys/kern/vfs_syscalls.c head/sys/kern/vfs_vnops.c Modified: head/sys/kern/imgact_binmisc.c == --- head/sys/kern/imgact_binmisc.c Thu Jan 30 20:02:14 2020 (r357311) +++ head/sys/kern/imgact_binmisc.c Thu Jan 30 20:05:05 2020 (r357312) @@ -609,7 +609,6 @@ imgact_binmisc_exec(struct image_params *imgp) fname = sbuf_data(sname); } - /* * We need to "push" the interpreter in the arg[] list. To do this, * we first shift all the other values in the `begin_argv' area to @@ -706,7 +705,6 @@ imgact_binmisc_exec(struct image_params *imgp) if (!error) imgp->interpreter_name = imgp->args->begin_argv; - done: if (sname) Modified: head/sys/kern/imgact_elf.c == --- head/sys/kern/imgact_elf.c Thu Jan 30 20:02:14 2020(r357311) +++ head/sys/kern/imgact_elf.c Thu Jan 30 20:05:05 2020(r357312) @@ -630,7 +630,6 @@ __elfN(load_section)(struct image_params *imgp, vm_oof return (0); } - /* * We have to get the remaining bit of the file into the first part * of the oversized map segment. This is normally because the .data Modified: head/sys/kern/init_main.c == --- head/sys/kern/init_main.c Thu Jan 30 20:02:14 2020(r357311) +++ head/sys/kern/init_main.c Thu Jan 30 20:05:05 2020(r357312) @@ -115,7 +115,6 @@ linux_alloc_current_noop(struct thread *td __unused, i } int (*lkpi_alloc_current)(struct thread *, int) = linux_alloc_current_noop; - #ifndef BOOTHOWTO #defineBOOTHOWTO 0 #endif Modified: head/sys/kern/kern_alq.c == --- head/sys/kern/kern_alq.cThu Jan 30 20:02:14 2020(r357311) +++ head/sys/kern/kern_alq.cThu Jan 30 20:05:05 2020(r357312) @@ -120,7 +120,6 @@ static void alq_shutdown(struct alq *); static void alq_destroy(struct alq *); static int alq_doio(struct alq *); - /* * Add a new queue to the global list. Fail if we're shutting down. */ @@ -422,7 +421,6 @@ static struct kproc_desc ald_kp = { SYSINIT(aldthread, SI_SUB_KTHREAD_IDLE, SI_ORDER_ANY, kproc_start, _kp); SYSINIT(ald, SI_SUB_LOCK, SI_ORDER_ANY, ald_startup, NULL); - /* User visible queue functions */ /* @@ -501,7 +499,6 @@ alq_open(struct alq **alqp, const char *file, struct u return (ret); } - /* * Copy a new entry into the queue. If the operation would block either Modified: head/sys/kern/kern_conf.c == --- head/sys/kern/kern_conf.c Thu Jan 30 20:02:14 2020(r357311) +++ head/sys/kern/kern_conf.c Thu Jan 30 20:05:05 2020(r357312) @@ -950,7 +950,6 @@
svn commit: r357311 - head/sys/kern
Author: mjg Date: Thu Jan 30 20:02:14 2020 New Revision: 357311 URL: https://svnweb.freebsd.org/changeset/base/357311 Log: Tidy up 2 comments in smp_rendezvous_cpus. Modified: head/sys/kern/subr_smp.c Modified: head/sys/kern/subr_smp.c == --- head/sys/kern/subr_smp.cThu Jan 30 19:57:05 2020(r357310) +++ head/sys/kern/subr_smp.cThu Jan 30 20:02:14 2020(r357311) @@ -550,7 +550,7 @@ smp_rendezvous_cpus(cpuset_t map, { int curcpumap, i, ncpus = 0; - /* Look comments in the !SMP case. */ + /* See comments in the !SMP case. */ if (!smp_started) { spinlock_enter(); if (setup_func != NULL) @@ -565,7 +565,7 @@ smp_rendezvous_cpus(cpuset_t map, /* * Make sure we come here with interrupts enabled. Otherwise we -* livelock if smp_ipi_mtx is owned by a thread which sent as an IPI. +* livelock if smp_ipi_mtx is owned by a thread which sent us an IPI. */ MPASS(curthread->td_md.md_spinlock_count == 0); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r357309 - head/sys/amd64/amd64
Author: mjg Date: Thu Jan 30 19:56:22 2020 New Revision: 357309 URL: https://svnweb.freebsd.org/changeset/base/357309 Log: amd64: speed up failing case for memcmp Instead of branching on up to 8 bytes, drop the size to 4. Assorted clean ups while here. Validated with glibc test suite. Modified: head/sys/amd64/amd64/support.S Modified: head/sys/amd64/amd64/support.S == --- head/sys/amd64/amd64/support.S Thu Jan 30 19:38:51 2020 (r357308) +++ head/sys/amd64/amd64/support.S Thu Jan 30 19:56:22 2020 (r357309) @@ -107,7 +107,7 @@ END(sse2_pagezero) /* * memcmpy(b1, b2, len) - *rdi,rsi,len + *rdi,rsi,rdx */ ENTRY(memcmp) PUSH_FRAME_POINTER @@ -123,7 +123,7 @@ ENTRY(memcmp) movq(%rdi),%r8 movq(%rsi),%r9 cmpq%r8,%r9 - jne 1f + jne 80f movq-8(%rdi,%rdx),%r8 movq-8(%rsi,%rdx),%r9 cmpq%r8,%r9 @@ -133,25 +133,25 @@ ENTRY(memcmp) 100408: cmpb$4,%dl jl 100204f - movl(%rsi),%r8d - movl(%rdi),%r9d + movl(%rdi),%r8d + movl(%rsi),%r9d cmpl%r8d,%r9d - jne 1f - movl-4(%rsi,%rdx),%r8d - movl-4(%rdi,%rdx),%r9d + jne 80f + movl-4(%rdi,%rdx),%r8d + movl-4(%rsi,%rdx),%r9d cmpl%r8d,%r9d - jne 1f + jne 10040804f POP_FRAME_POINTER ret 100204: cmpb$2,%dl jl 11f - movzwl (%rsi),%r8d - movzwl (%rdi),%r9d + movzwl (%rdi),%r8d + movzwl (%rsi),%r9d cmpl%r8d,%r9d jne 1f - movzwl -2(%rsi,%rdx),%r8d - movzwl -2(%rdi,%rdx),%r9d + movzwl -2(%rdi,%rdx),%r8d + movzwl -2(%rsi,%rdx),%r9d cmpl%r8d,%r9d jne 1f POP_FRAME_POINTER @@ -159,10 +159,9 @@ ENTRY(memcmp) 11: cmpb$1,%dl jl 10f - movzbl (%rdi),%r8d - movzbl (%rsi),%r9d - cmpb%r8b,%r9b - jne 1f + movzbl (%rdi),%eax + movzbl (%rsi),%r8d + subl%r8d,%eax 10: POP_FRAME_POINTER ret @@ -173,11 +172,11 @@ ALIGN_TEXT movq(%rdi),%r8 movq(%rsi),%r9 cmpq%r8,%r9 - jne 1f + jne 80f movq8(%rdi),%r8 movq8(%rsi),%r9 cmpq%r8,%r9 - jne 10163208f + jne 10163208f movq-16(%rdi,%rdx),%r8 movq-16(%rsi,%rdx),%r9 cmpq%r8,%r9 @@ -194,14 +193,14 @@ ALIGN_TEXT movq8(%rdi),%r9 subq(%rsi),%r8 subq8(%rsi),%r9 - or %r8,%r9 + orq %r8,%r9 jnz 1032f movq16(%rdi),%r8 movq24(%rdi),%r9 subq16(%rsi),%r8 subq24(%rsi),%r9 - or %r8,%r9 + orq %r8,%r9 jnz 10320016f leaq32(%rdi),%rdi @@ -214,40 +213,57 @@ ALIGN_TEXT POP_FRAME_POINTER ret +/* + * Mismatch was found. + * + * Before we compute it we narrow down the range (16 -> 8 -> 4 bytes). + */ +ALIGN_TEXT 10320016: leaq16(%rdi),%rdi leaq16(%rsi),%rsi 1032: -/* - * Mismatch was found within a 16 bytes range. The part of the routine - * which calculates it only operates on sizes up to 8 bytes. Find the - * right part. - */ movq(%rdi),%r8 movq(%rsi),%r9 cmpq%r8,%r9 - jne 1f + jne 80f leaq8(%rdi),%rdi leaq8(%rsi),%rsi - jmp 1f + jmp 80f +ALIGN_TEXT +10081608: 10163224: leaq-8(%rdi,%rdx),%rdi leaq-8(%rsi,%rdx),%rsi - jmp 1f + jmp 80f +ALIGN_TEXT 10163216: leaq-16(%rdi,%rdx),%rdi leaq-16(%rsi,%rdx),%rsi - jmp 1f + jmp 80f +ALIGN_TEXT 10163208: -10081608: leaq8(%rdi),%rdi leaq8(%rsi),%rsi + jmp 80f +ALIGN_TEXT +10040804: + leaq-4(%rdi,%rdx),%rdi + leaq-4(%rsi,%rdx),%rsi jmp 1f +ALIGN_TEXT +80: + movl(%rdi),%r8d + movl(%rsi),%r9d + cmpl%r8d,%r9d + jne 1f + leaq4(%rdi),%rdi + leaq4(%rsi),%rsi + /* - * Mismatch was found. We have no more than 8 bytes to inspect. + * We have up to 4 bytes to inspect. */ -ALIGN_TEXT 1: movzbl (%rdi),%eax movzbl (%rsi),%r8d @@ -266,32 +282,6 @@ ALIGN_TEXT movzbl 3(%rdi),%eax movzbl 3(%rsi),%r8d - cmpb%r8b,%al - jne 2f - - movzbl 4(%rdi),%eax - movzbl 4(%rsi),%r8d - cmpb%r8b,%al - jne 2f - - movzbl 5(%rdi),%eax - movzbl 5(%rsi),%r8d - cmpb%r8b,%al - jne 2f - - movzbl 6(%rdi),%eax -
svn commit: r357310 - head/lib/libc/amd64/string
Author: mjg Date: Thu Jan 30 19:57:05 2020 New Revision: 357310 URL: https://svnweb.freebsd.org/changeset/base/357310 Log: amd64: sync up libc memcmp with the kernel version (r357309) Modified: head/lib/libc/amd64/string/memcmp.S Modified: head/lib/libc/amd64/string/memcmp.S == --- head/lib/libc/amd64/string/memcmp.S Thu Jan 30 19:56:22 2020 (r357309) +++ head/lib/libc/amd64/string/memcmp.S Thu Jan 30 19:57:05 2020 (r357310) @@ -45,7 +45,7 @@ ENTRY(memcmp) movq(%rdi),%r8 movq(%rsi),%r9 cmpq%r8,%r9 - jne 1f + jne 80f movq-8(%rdi,%rdx),%r8 movq-8(%rsi,%rdx),%r9 cmpq%r8,%r9 @@ -54,34 +54,33 @@ ENTRY(memcmp) 100408: cmpb$4,%dl jl 100204f - movl(%rsi),%r8d - movl(%rdi),%r9d + movl(%rdi),%r8d + movl(%rsi),%r9d cmpl%r8d,%r9d - jne 1f - movl-4(%rsi,%rdx),%r8d - movl-4(%rdi,%rdx),%r9d + jne 80f + movl-4(%rdi,%rdx),%r8d + movl-4(%rsi,%rdx),%r9d cmpl%r8d,%r9d - jne 1f + jne 10040804f ret 100204: cmpb$2,%dl jl 11f - movzwl (%rsi),%r8d - movzwl (%rdi),%r9d + movzwl (%rdi),%r8d + movzwl (%rsi),%r9d cmpl%r8d,%r9d jne 1f - movzwl -2(%rsi,%rdx),%r8d - movzwl -2(%rdi,%rdx),%r9d + movzwl -2(%rdi,%rdx),%r8d + movzwl -2(%rsi,%rdx),%r9d cmpl%r8d,%r9d jne 1f ret 11: cmpb$1,%dl jl 10f - movzbl (%rdi),%r8d - movzbl (%rsi),%r9d - cmpb%r8b,%r9b - jne 1f + movzbl (%rdi),%eax + movzbl (%rsi),%r8d + subl%r8d,%eax 10: ret ALIGN_TEXT @@ -91,11 +90,11 @@ ALIGN_TEXT movq(%rdi),%r8 movq(%rsi),%r9 cmpq%r8,%r9 - jne 1f + jne 80f movq8(%rdi),%r8 movq8(%rsi),%r9 cmpq%r8,%r9 - jne 10163208f + jne 10163208f movq-16(%rdi,%rdx),%r8 movq-16(%rsi,%rdx),%r9 cmpq%r8,%r9 @@ -111,14 +110,14 @@ ALIGN_TEXT movq8(%rdi),%r9 subq(%rsi),%r8 subq8(%rsi),%r9 - or %r8,%r9 + orq %r8,%r9 jnz 1032f movq16(%rdi),%r8 movq24(%rdi),%r9 subq16(%rsi),%r8 subq24(%rsi),%r9 - or %r8,%r9 + orq %r8,%r9 jnz 10320016f leaq32(%rdi),%rdi @@ -130,40 +129,57 @@ ALIGN_TEXT jne 10b ret +/* + * Mismatch was found. + * + * Before we compute it we narrow down the range (16 -> 8 -> 4 bytes). + */ +ALIGN_TEXT 10320016: leaq16(%rdi),%rdi leaq16(%rsi),%rsi 1032: -/* - * Mismatch was found within a 16 bytes range. The part of the routine - * which calculates it only operates on sizes up to 8 bytes. Find the - * right part. - */ movq(%rdi),%r8 movq(%rsi),%r9 cmpq%r8,%r9 - jne 1f + jne 80f leaq8(%rdi),%rdi leaq8(%rsi),%rsi - jmp 1f + jmp 80f +ALIGN_TEXT +10081608: 10163224: leaq-8(%rdi,%rdx),%rdi leaq-8(%rsi,%rdx),%rsi - jmp 1f + jmp 80f +ALIGN_TEXT 10163216: leaq-16(%rdi,%rdx),%rdi leaq-16(%rsi,%rdx),%rsi - jmp 1f + jmp 80f +ALIGN_TEXT 10163208: -10081608: leaq8(%rdi),%rdi leaq8(%rsi),%rsi + jmp 80f +ALIGN_TEXT +10040804: + leaq-4(%rdi,%rdx),%rdi + leaq-4(%rsi,%rdx),%rsi jmp 1f +ALIGN_TEXT +80: + movl(%rdi),%r8d + movl(%rsi),%r9d + cmpl%r8d,%r9d + jne 1f + leaq4(%rdi),%rdi + leaq4(%rsi),%rsi + /* - * Mismatch was found. We have no more than 8 bytes to inspect. + * We have up to 4 bytes to inspect. */ -ALIGN_TEXT 1: movzbl (%rdi),%eax movzbl (%rsi),%r8d @@ -182,31 +198,6 @@ ALIGN_TEXT movzbl 3(%rdi),%eax movzbl 3(%rsi),%r8d - cmpb%r8b,%al - jne 2f - - movzbl 4(%rdi),%eax - movzbl 4(%rsi),%r8d - cmpb%r8b,%al - jne 2f - - movzbl 5(%rdi),%eax - movzbl 5(%rsi),%r8d - cmpb%r8b,%al - jne 2f - - movzbl 6(%rdi),%eax - movzbl 6(%rsi),%r8d - cmpb%r8b,%al - jne 2f - - movzbl 7(%rdi),%eax - movzbl 7(%rsi),%r8d - cmpb%r8b,%al - jne 2f - - xorl%eax,%eax - ret 2: subl%r8d,%eax ret ___ svn-src-head@freebsd.org mailing list
svn commit: r357308 - head/sys/kern
Author: mjg Date: Thu Jan 30 19:38:51 2020 New Revision: 357308 URL: https://svnweb.freebsd.org/changeset/base/357308 Log: Assert that smp_rendezvous_cpus is called with interrupts enabled. Modified: head/sys/kern/subr_smp.c Modified: head/sys/kern/subr_smp.c == --- head/sys/kern/subr_smp.cThu Jan 30 19:38:12 2020(r357307) +++ head/sys/kern/subr_smp.cThu Jan 30 19:38:51 2020(r357308) @@ -563,6 +563,12 @@ smp_rendezvous_cpus(cpuset_t map, return; } + /* +* Make sure we come here with interrupts enabled. Otherwise we +* livelock if smp_ipi_mtx is owned by a thread which sent as an IPI. +*/ + MPASS(curthread->td_md.md_spinlock_count == 0); + CPU_FOREACH(i) { if (CPU_ISSET(i, )) ncpus++; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r357307 - head/sys/kern
Author: mjg Date: Thu Jan 30 19:38:12 2020 New Revision: 357307 URL: https://svnweb.freebsd.org/changeset/base/357307 Log: vfs: keep the mount point referenced across sys_quotactl Otherwise we risk running into use-after-free. In particular this codepath ends up dropping all protection before suspending writes: ufs_quotactl -> quotaoff_inchange -> vfs_write_suspend_umnt Reported by: pho Modified: head/sys/kern/vfs_syscalls.c Modified: head/sys/kern/vfs_syscalls.c == --- head/sys/kern/vfs_syscalls.cThu Jan 30 19:34:37 2020 (r357306) +++ head/sys/kern/vfs_syscalls.cThu Jan 30 19:38:12 2020 (r357307) @@ -189,9 +189,10 @@ sys_quotactl(struct thread *td, struct quotactl_args * vfs_ref(mp); vput(nd.ni_vp); error = vfs_busy(mp, 0); - vfs_rel(mp); - if (error != 0) + if (error != 0) { + vfs_rel(mp); return (error); + } error = VFS_QUOTACTL(mp, uap->cmd, uap->uid, uap->arg); /* @@ -208,6 +209,7 @@ sys_quotactl(struct thread *td, struct quotactl_args * if ((uap->cmd >> SUBCMDSHIFT) != Q_QUOTAON && (uap->cmd >> SUBCMDSHIFT) != Q_QUOTAOFF) vfs_unbusy(mp); + vfs_rel(mp); return (error); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r357306 - head/sys/fs/nullfs
Author: kib Date: Thu Jan 30 19:34:37 2020 New Revision: 357306 URL: https://svnweb.freebsd.org/changeset/base/357306 Log: Fix a bug in r357199. Around a generic call to null_nodeget(), there is nothing that would prevent the unmount of the nullfs mp until we process to the insmntque1() point. Calculate the VV_ROOT flag after insmntque1() to not access mp->mnt_data before we have an exclusively locked vnode from this mount point on the mp vnode list. Reported and tested by: pho Sponsored by: The FreeBSD Foundation MFC after:1 week Modified: head/sys/fs/nullfs/null_subr.c Modified: head/sys/fs/nullfs/null_subr.c == --- head/sys/fs/nullfs/null_subr.c Thu Jan 30 19:15:27 2020 (r357305) +++ head/sys/fs/nullfs/null_subr.c Thu Jan 30 19:34:37 2020 (r357306) @@ -252,11 +252,12 @@ null_nodeget(mp, lowervp, vpp) vp->v_type = lowervp->v_type; vp->v_data = xp; vp->v_vnlock = lowervp->v_vnlock; - if (lowervp == MOUNTTONULLMOUNT(mp)->nullm_lowerrootvp) - vp->v_vflag |= VV_ROOT; error = insmntque1(vp, mp, null_insmntque_dtr, xp); if (error != 0) return (error); + if (lowervp == MOUNTTONULLMOUNT(mp)->nullm_lowerrootvp) + vp->v_vflag |= VV_ROOT; + /* * Atomically insert our new node into the hash or vget existing * if someone else has beaten us to it. ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r357305 - in head/sys/riscv: include riscv
Author: jhb Date: Thu Jan 30 19:15:27 2020 New Revision: 357305 URL: https://svnweb.freebsd.org/changeset/base/357305 Log: Remove unused fields from struct pcb. cpu_switch/throw() and savectx() do not save or restore any values in these fields which mostly held non-callee-save registers. makectx() copied these fields from kdb_frame, but they weren't used except for PC_REGS using pcb_sepc. Change PC_REGS to use kdb_frame->tf_sepc directly instead. Reviewed by: br MFC after:2 weeks Sponsored by: DARPA Differential Revision:https://reviews.freebsd.org/D23395 Modified: head/sys/riscv/include/db_machdep.h head/sys/riscv/include/pcb.h head/sys/riscv/riscv/genassym.c head/sys/riscv/riscv/machdep.c Modified: head/sys/riscv/include/db_machdep.h == --- head/sys/riscv/include/db_machdep.h Thu Jan 30 18:49:19 2020 (r357304) +++ head/sys/riscv/include/db_machdep.h Thu Jan 30 19:15:27 2020 (r357305) @@ -47,7 +47,7 @@ typedef vm_offset_tdb_addr_t; typedef long db_expr_t; -#definePC_REGS() ((db_addr_t)kdb_thrctx->pcb_sepc) +#definePC_REGS() ((db_addr_t)kdb_frame->tf_sepc) #defineBKPT_INST (0x00100073) #defineBKPT_SIZE (INSN_SIZE) Modified: head/sys/riscv/include/pcb.h == --- head/sys/riscv/include/pcb.hThu Jan 30 18:49:19 2020 (r357304) +++ head/sys/riscv/include/pcb.hThu Jan 30 19:15:27 2020 (r357305) @@ -46,15 +46,12 @@ struct pcb { uint64_tpcb_sp; /* Stack pointer */ uint64_tpcb_gp; /* Global pointer */ uint64_tpcb_tp; /* Thread pointer */ - uint64_tpcb_t[7]; /* Temporary registers */ uint64_tpcb_s[12]; /* Saved registers */ - uint64_tpcb_a[8]; /* Argument registers */ uint64_tpcb_x[32][2]; /* Floating point registers */ uint64_tpcb_fcsr; /* Floating point control reg */ uint64_tpcb_fpflags;/* Floating point flags */ #definePCB_FP_STARTED 0x1 #definePCB_FP_USERMASK 0x1 - uint64_tpcb_sepc; /* Supervisor exception pc */ vm_offset_t pcb_onfault;/* Copyinout fault handler */ }; Modified: head/sys/riscv/riscv/genassym.c == --- head/sys/riscv/riscv/genassym.c Thu Jan 30 18:49:19 2020 (r357304) +++ head/sys/riscv/riscv/genassym.c Thu Jan 30 19:15:27 2020 (r357305) @@ -69,9 +69,7 @@ ASSYM(PCB_RA, offsetof(struct pcb, pcb_ra)); ASSYM(PCB_SP, offsetof(struct pcb, pcb_sp)); ASSYM(PCB_GP, offsetof(struct pcb, pcb_gp)); ASSYM(PCB_TP, offsetof(struct pcb, pcb_tp)); -ASSYM(PCB_T, offsetof(struct pcb, pcb_t)); ASSYM(PCB_S, offsetof(struct pcb, pcb_s)); -ASSYM(PCB_A, offsetof(struct pcb, pcb_a)); ASSYM(PCB_X, offsetof(struct pcb, pcb_x)); ASSYM(PCB_FCSR, offsetof(struct pcb, pcb_fcsr)); Modified: head/sys/riscv/riscv/machdep.c == --- head/sys/riscv/riscv/machdep.c Thu Jan 30 18:49:19 2020 (r357304) +++ head/sys/riscv/riscv/machdep.c Thu Jan 30 19:15:27 2020 (r357305) @@ -558,15 +558,12 @@ void makectx(struct trapframe *tf, struct pcb *pcb) { - memcpy(pcb->pcb_t, tf->tf_t, sizeof(tf->tf_t)); memcpy(pcb->pcb_s, tf->tf_s, sizeof(tf->tf_s)); - memcpy(pcb->pcb_a, tf->tf_a, sizeof(tf->tf_a)); pcb->pcb_ra = tf->tf_ra; pcb->pcb_sp = tf->tf_sp; pcb->pcb_gp = tf->tf_gp; pcb->pcb_tp = tf->tf_tp; - pcb->pcb_sepc = tf->tf_sepc; } void ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r357288 - head/sys/dev/usb/wlan
On Thu, 2020-01-30 at 09:41 +, Hans Petter Selasky wrote: > Author: hselasky > Date: Thu Jan 30 09:41:48 2020 > New Revision: 357288 > URL: https://svnweb.freebsd.org/changeset/base/357288 > > Log: > Widen EPOCH(9) usage in USB WLAN drivers. > > This patch should unbreak the USB WLAN drivers after r357004. > > Pointy hat: glebius@ > Sponsored by: Mellanox Technologies > > Modified: > head/sys/dev/usb/wlan/if_rum.c > head/sys/dev/usb/wlan/if_run.c > head/sys/dev/usb/wlan/if_uath.c > head/sys/dev/usb/wlan/if_upgt.c > head/sys/dev/usb/wlan/if_ural.c > head/sys/dev/usb/wlan/if_urtw.c > head/sys/dev/usb/wlan/if_zyd.c > This is another piece of evidence illustratitng what a bad idea it was to try to handle network interrupts as some sort of special case in the wrong layer of the OS. Network drivers know who they are and can do the right thing. The interrupt dispatching code can only guess at what's going on by using flags that were intended for a whole other purpose. We now how multiple demonstrations of the fact that those flags cannot reliably be used as an indication of whether network packets are going to be handled during the interrupt or not. -- Ian ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r357304 - head/sys/arm64/arm64
Author: andrew Date: Thu Jan 30 18:49:19 2020 New Revision: 357304 URL: https://svnweb.freebsd.org/changeset/base/357304 Log: Shift the ITS processor ID after reading it. When using the processor ID value we mask off the low and high bits that should be zero. Unfortunatly we don't shift the ID value so it won't be affected. Add the shift when reading the ID as this will need to align with the address based target value. MFC after:2 weeks Sponsored by: DARPA, AFRL Modified: head/sys/arm64/arm64/gicv3_its.c Modified: head/sys/arm64/arm64/gicv3_its.c == --- head/sys/arm64/arm64/gicv3_its.cThu Jan 30 18:34:08 2020 (r357303) +++ head/sys/arm64/arm64/gicv3_its.cThu Jan 30 18:49:19 2020 (r357304) @@ -685,7 +685,8 @@ its_init_cpu(device_t dev, struct gicv3_its_softc *sc) target = vtophys(rman_get_virtual(>res)); } else { /* This ITS wants the unique processor number */ - target = GICR_TYPER_CPUNUM(gic_r_read_8(gicv3, GICR_TYPER)); + target = GICR_TYPER_CPUNUM(gic_r_read_8(gicv3, GICR_TYPER)) << + CMD_TARGET_SHIFT; } sc->sc_its_cols[cpuid]->col_target = target; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r357303 - head/usr.sbin/makefs/msdos
Author: brooks Date: Thu Jan 30 18:34:08 2020 New Revision: 357303 URL: https://svnweb.freebsd.org/changeset/base/357303 Log: Fix an indentation bug in r357169. Modified: head/usr.sbin/makefs/msdos/msdosfs_denode.c Modified: head/usr.sbin/makefs/msdos/msdosfs_denode.c == --- head/usr.sbin/makefs/msdos/msdosfs_denode.c Thu Jan 30 18:28:02 2020 (r357302) +++ head/usr.sbin/makefs/msdos/msdosfs_denode.c Thu Jan 30 18:34:08 2020 (r357303) @@ -287,7 +287,7 @@ detrunc(struct denode *dep, u_long length, int flags, return (error); } memset(bp->b_data + boff, 0, pmp->pm_bpcluster - boff); - bwrite(bp); + bwrite(bp); } } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r357302 - head/sys/kern
Author: jhb Date: Thu Jan 30 18:28:02 2020 New Revision: 357302 URL: https://svnweb.freebsd.org/changeset/base/357302 Log: Fix use of an uninitialized variable. ctx (and thus ctx.flags) is stack garbage at the start of this function, so initialize ctx.flags to an explicit value instead of using binary operations on the garbage. Reported by: gcc9 Reviewed by: imp Differential Revision:https://reviews.freebsd.org/D23368 Modified: head/sys/kern/subr_stats.c Modified: head/sys/kern/subr_stats.c == --- head/sys/kern/subr_stats.c Thu Jan 30 18:12:41 2020(r357301) +++ head/sys/kern/subr_stats.c Thu Jan 30 18:28:02 2020(r357302) @@ -1583,9 +1583,7 @@ stats_v1_blob_iter(struct statsblobv1 *sb, stats_v1_bl int i, j, firstvoi; ctx.usrctx = usrctx; - ctx.flags |= SB_IT_FIRST_CB; - ctx.flags &= ~(SB_IT_FIRST_VOI | SB_IT_LAST_VOI | SB_IT_FIRST_VOISTAT | - SB_IT_LAST_VOISTAT); + ctx.flags = SB_IT_FIRST_CB; firstvoi = 1; for (i = 0; i < NVOIS(sb); i++) { ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r357300 - head/sys/dev/aic7xxx
Author: cem Date: Thu Jan 30 18:12:24 2020 New Revision: 357300 URL: https://svnweb.freebsd.org/changeset/base/357300 Log: aic7xxx(4): Fix unintended sign extension in ahd_inq() ahd_inb() returns type uint8_t. The shift left by untyped 24 implicitly promotes the result to type (signed) int. Then the binary OR with uint64_t values sign-extends the integer. If bit 31 of the read value happened to be set, the 64-bit result would have all upper 32 bits set to 1 due to OR. This is clearly not intended. Reported by: Coverity CID: 980473 (old one!) Modified: head/sys/dev/aic7xxx/aic79xx_inline.h Modified: head/sys/dev/aic7xxx/aic79xx_inline.h == --- head/sys/dev/aic7xxx/aic79xx_inline.h Thu Jan 30 17:50:51 2020 (r357299) +++ head/sys/dev/aic7xxx/aic79xx_inline.h Thu Jan 30 18:12:24 2020 (r357300) @@ -567,7 +567,7 @@ ahd_inq(struct ahd_softc *ahd, u_int port) return ((ahd_inb(ahd, port)) | (ahd_inb(ahd, port+1) << 8) | (ahd_inb(ahd, port+2) << 16) - | (ahd_inb(ahd, port+3) << 24) + | (((uint64_t)ahd_inb(ahd, port+3)) << 24) | (((uint64_t)ahd_inb(ahd, port+4)) << 32) | (((uint64_t)ahd_inb(ahd, port+5)) << 40) | (((uint64_t)ahd_inb(ahd, port+6)) << 48) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r357301 - head/contrib/apr/random/unix
Author: cem Date: Thu Jan 30 18:12:41 2020 New Revision: 357301 URL: https://svnweb.freebsd.org/changeset/base/357301 Log: contrib/apr: Rip out bogus [CS]PRNG implementation This construction used some relatively slow design involving SHA2; even if it were fed real entropy (unclear; external to the design), it did not handle fork in a safe way, and it was difficult to audit for correctness. So just rip it out and use the very simple and known-correct arc4random(3) interface in its place. Modified: head/contrib/apr/random/unix/apr_random.c Modified: head/contrib/apr/random/unix/apr_random.c == --- head/contrib/apr/random/unix/apr_random.c Thu Jan 30 18:12:24 2020 (r357300) +++ head/contrib/apr/random/unix/apr_random.c Thu Jan 30 18:12:41 2020 (r357301) @@ -13,285 +13,51 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/* - * See the paper "On Randomness" by Ben Laurie for an explanation of this PRNG. - * http://www.apache-ssl.org/randomness.pdf - * XXX: Is there a formal proof of this PRNG? Couldn't we use the more popular - * Mersenne Twister PRNG (and BSD licensed)? - */ #include "apr.h" #include "apr_pools.h" #include "apr_random.h" #include "apr_thread_proc.h" #include +#include -#ifdef min -#undef min -#endif -#define min(a,b) ((a) < (b) ? (a) : (b)) - -#define APR_RANDOM_DEFAULT_POOLS 32 -#define APR_RANDOM_DEFAULT_REHASH_SIZE 1024 -#define APR_RANDOM_DEFAULT_RESEED_SIZE 32 -#define APR_RANDOM_DEFAULT_HASH_SECRET_SIZE 32 -#define APR_RANDOM_DEFAULT_G_FOR_INSECURE 32 -#define APR_RANDOM_DEFAULT_G_FOR_SECURE 320 - -typedef struct apr_random_pool_t { -unsigned char *pool; -unsigned int bytes; -unsigned int pool_size; -} apr_random_pool_t; - -#define hash_init(h)(h)->init(h) -#define hash_add(h,b,n) (h)->add(h,b,n) -#define hash_finish(h,r)(h)->finish(h,r) - -#define hash(h,r,b,n) hash_init(h),hash_add(h,b,n),hash_finish(h,r) - -#define crypt_setkey(c,k) (c)->set_key((c)->data,k) -#define crypt_crypt(c,out,in) (c)->crypt((c)->date,out,in) - -struct apr_random_t { -apr_pool_t *apr_pool; -apr_crypto_hash_t *pool_hash; -unsigned int npools; -apr_random_pool_t *pools; -unsigned int next_pool; -unsigned int generation; -apr_size_t rehash_size; -apr_size_t reseed_size; -apr_crypto_hash_t *key_hash; -#define K_size(g) ((g)->key_hash->size) -apr_crypto_hash_t *prng_hash; -#define B_size(g) ((g)->prng_hash->size) - -unsigned char *H; -unsigned char *H_waiting; -#define H_size(g) (B_size(g)+K_size(g)) -#define H_current(g) (((g)->insecure_started && !(g)->secure_started) \ - ? (g)->H_waiting : (g)->H) - -unsigned char *randomness; -apr_size_t random_bytes; -unsigned int g_for_insecure; -unsigned int g_for_secure; -unsigned int secure_base; -unsigned int insecure_started:1; -unsigned int secure_started:1; - -apr_random_t *next; -}; - -static apr_random_t *all_random; - -static apr_status_t random_cleanup(void *data) -{ -apr_random_t *remove_this = data, - *cur = all_random, - **prev_ptr = _random; -while (cur) { -if (cur == remove_this) { -*prev_ptr = cur->next; -break; -} -prev_ptr = >next; -cur = cur->next; -} -return APR_SUCCESS; -} - - APR_DECLARE(void) apr_random_init(apr_random_t *g,apr_pool_t *p, apr_crypto_hash_t *pool_hash, apr_crypto_hash_t *key_hash, apr_crypto_hash_t *prng_hash) { -unsigned int n; - -g->apr_pool = p; - -g->pool_hash = pool_hash; -g->key_hash = key_hash; -g->prng_hash = prng_hash; - -g->npools = APR_RANDOM_DEFAULT_POOLS; -g->pools = apr_palloc(p,g->npools*sizeof *g->pools); -for (n = 0; n < g->npools; ++n) { -g->pools[n].bytes = g->pools[n].pool_size = 0; -g->pools[n].pool = NULL; -} -g->next_pool = 0; - -g->generation = 0; - -g->rehash_size = APR_RANDOM_DEFAULT_REHASH_SIZE; -/* Ensure that the rehash size is twice the size of the pool hasher */ -g->rehash_size = ((g->rehash_size+2*g->pool_hash->size-1)/g->pool_hash->size -/2)*g->pool_hash->size*2; -g->reseed_size = APR_RANDOM_DEFAULT_RESEED_SIZE; - -g->H = apr_pcalloc(p,H_size(g)); -g->H_waiting = apr_pcalloc(p,H_size(g)); - -g->randomness = apr_palloc(p,B_size(g)); -g->random_bytes = 0; - -g->g_for_insecure = APR_RANDOM_DEFAULT_G_FOR_INSECURE; -g->secure_base = 0; -g->g_for_secure = APR_RANDOM_DEFAULT_G_FOR_SECURE; -g->secure_started = g->insecure_started = 0; - -g->next = all_random; -all_random = g; -apr_pool_cleanup_register(p, g,
svn commit: r357299 - head/contrib/apr/strings
Author: cem Date: Thu Jan 30 17:50:51 2020 New Revision: 357299 URL: https://svnweb.freebsd.org/changeset/base/357299 Log: contrib/apr: Remove scope leak UB In apr_vformatter, the variable buf was declared inside a limited scope region, but a pointer to it is leaked outside of that region and used later. This is undefined behavior. Fix by moving the buf variable to function scope. Reported by: Coverity CID: 1192541 Modified: head/contrib/apr/strings/apr_snprintf.c Modified: head/contrib/apr/strings/apr_snprintf.c == --- head/contrib/apr/strings/apr_snprintf.c Thu Jan 30 17:30:04 2020 (r357298) +++ head/contrib/apr/strings/apr_snprintf.c Thu Jan 30 17:50:51 2020 (r357299) @@ -708,6 +708,7 @@ APR_DECLARE(int) apr_vformatter(int (*flush_func)(apr_ char num_buf[NUM_BUF_SIZE]; char char_buf[2];/* for printing %% and % */ +char buf[5]; /* for printing %B, %F, and %S */ enum var_type_enum { IS_QUAD, IS_LONG, IS_SHORT, IS_INT @@ -1246,7 +1247,6 @@ APR_DECLARE(int) apr_vformatter(int (*flush_func)(apr_ case 'F': case 'S': { -char buf[5]; apr_off_t size = 0; if (*fmt == 'B') { ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r357298 - head/lib/libusb
Author: hselasky Date: Thu Jan 30 17:30:04 2020 New Revision: 357298 URL: https://svnweb.freebsd.org/changeset/base/357298 Log: Add missing mutex unlock in failure case. Differential Revision:https://reviews.freebsd.org/D23430 Submitted by: cem Reported by: Coverity Coverity CID: 1368773 MFC after:3 days Sponsored by: Mellanox Technologies Modified: head/lib/libusb/libusb10_hotplug.c Modified: head/lib/libusb/libusb10_hotplug.c == --- head/lib/libusb/libusb10_hotplug.c Thu Jan 30 16:38:40 2020 (r357297) +++ head/lib/libusb/libusb10_hotplug.c Thu Jan 30 17:30:04 2020 (r357298) @@ -123,8 +123,10 @@ libusb_hotplug_scan(void *arg) TAILQ_INIT(_devs); if (ctx->hotplug_handler != NO_THREAD) { - if (libusb_hotplug_enumerate(ctx, _devs) < 0) + if (libusb_hotplug_enumerate(ctx, _devs) < 0) { + HOTPLUG_UNLOCK(ctx); continue; + } } else { do_loop = 0; } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r357233 - head/sys/net
On Tue, Jan 28, 2020 at 10:44:25PM +, Kristof Provost wrote: K> Author: kp K> Date: Tue Jan 28 22:44:24 2020 K> New Revision: 357233 K> URL: https://svnweb.freebsd.org/changeset/base/357233 K> K> Log: K> epair: Do not abuse params to register the second interface K> K> if_epair used the 'params' argument to pass a pointer to the b interface K> through if_clone_create(). K> This pointer can be controlled by userspace, which means it could be abused to K> trigger a panic. While this requires PRIV_NET_IFCREATE K> privileges those are assigned to vnet jails, which means that vnet jails K> could panic the system. K> K> Reported by: Ilja Van Sprundel ... K> Modified: head/sys/net/if_clone.h K> == K> --- head/sys/net/if_clone.h Tue Jan 28 21:46:59 2020(r357232) K> +++ head/sys/net/if_clone.h Tue Jan 28 22:44:24 2020(r357233) K> @@ -79,7 +79,8 @@ intif_clone_list(struct if_clonereq *); K> struct if_clone *if_clone_findifc(struct ifnet *); K> voidif_clone_addgroup(struct ifnet *, struct if_clone *); K> K> -/* The below interface used only by epair(4). */ K> +/* The below interfaces are used only by epair(4). */ K> +voidif_clone_addif(struct if_clone *, struct ifnet *); K> int if_clone_destroyif(struct if_clone *, struct ifnet *); IMHO, makes sense to move all these declaration into if_epair.c itself. -- Gleb Smirnoff ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r357203 - head/sys/compat/linux
On Tue, 28 Jan 2020 at 18:55, Gleb Smirnoff wrote: > > On Tue, Jan 28, 2020 at 01:57:25PM +, Edward Tomasz Napierala wrote: > E> Author: trasz > E> Date: Tue Jan 28 13:57:24 2020 > E> New Revision: 357203 > E> URL: https://svnweb.freebsd.org/changeset/base/357203 > E> > E> Log: > E> Add TCP_CORK support to linux(4). This fixes one of the things Nginx > E> trips over. > E> > E> MFC after: 2 weeks > E> Sponsored by: The FreeBSD Foundation > E> Differential Revision: https://reviews.freebsd.org/D23171 > > Again, out of curiosity: what is any good reason to run linux nginx > binary on FreeBSD? To lose all the nice features of FreeBSD kernel > that nginx supports? Docker, obviously. Seriously though - Nginx, or whatever other application you can see in my commit messages, is not the goal itself; it's more of a test case, so I can easily reproduce/retest it in the future, should I need to. The goal is fixing TCP_CORK, for whatever Linux app that needs it. ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r357294 - in head/sys/dev/mlx5: . mlx5_core mlx5_en
Author: hselasky Date: Thu Jan 30 12:35:13 2020 New Revision: 357294 URL: https://svnweb.freebsd.org/changeset/base/357294 Log: Widen EPOCH(9) usage in mlx5en(4). Make completion event path mostly lockless using EPOCH(9). Implement a mechanism using EPOCH(9) which allows us to make the callback path for completion events mostly lockless. Simplify draining callback events using epoch_wait(). While at it make sure all receive completion callbacks are covered by the network EPOCH(9), because this is required when calling if_input() and ether_input() after r357012. Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/cq.h head/sys/dev/mlx5/driver.h head/sys/dev/mlx5/mlx5_core/mlx5_cq.c head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Modified: head/sys/dev/mlx5/cq.h == --- head/sys/dev/mlx5/cq.h Thu Jan 30 12:04:02 2020(r357293) +++ head/sys/dev/mlx5/cq.h Thu Jan 30 12:35:13 2020(r357294) @@ -38,8 +38,6 @@ struct mlx5_core_cq { int cqe_sz; __be32 *set_ci_db; __be32 *arm_db; - atomic_trefcount; - struct completion free; unsignedvector; int irqn; void (*comp)(struct mlx5_core_cq *); Modified: head/sys/dev/mlx5/driver.h == --- head/sys/dev/mlx5/driver.h Thu Jan 30 12:04:02 2020(r357293) +++ head/sys/dev/mlx5/driver.h Thu Jan 30 12:35:13 2020(r357294) @@ -514,21 +514,17 @@ struct mlx5_core_health { struct workqueue_struct*wq_cmd; }; -#ifdef RATELIMIT -#defineMLX5_CQ_LINEAR_ARRAY_SIZE (128 * 1024) -#else #defineMLX5_CQ_LINEAR_ARRAY_SIZE 1024 -#endif struct mlx5_cq_linear_array_entry { - spinlock_t lock; struct mlx5_core_cq * volatile cq; }; struct mlx5_cq_table { /* protect radix tree */ - spinlock_t lock; + spinlock_t writerlock; + atomic_twritercount; struct radix_tree_root tree; struct mlx5_cq_linear_array_entry linear_array[MLX5_CQ_LINEAR_ARRAY_SIZE]; }; Modified: head/sys/dev/mlx5/mlx5_core/mlx5_cq.c == --- head/sys/dev/mlx5/mlx5_core/mlx5_cq.c Thu Jan 30 12:04:02 2020 (r357293) +++ head/sys/dev/mlx5/mlx5_core/mlx5_cq.c Thu Jan 30 12:35:13 2020 (r357294) @@ -33,72 +33,91 @@ #include #include "mlx5_core.h" +#include + +static void +mlx5_cq_table_write_lock(struct mlx5_cq_table *table) +{ + + atomic_inc(>writercount); + /* make sure all see the updated writercount */ + NET_EPOCH_WAIT(); + spin_lock(>writerlock); +} + +static void +mlx5_cq_table_write_unlock(struct mlx5_cq_table *table) +{ + + spin_unlock(>writerlock); + atomic_dec(>writercount); + /* drain all pending CQ callers */ + NET_EPOCH_WAIT(); +} + void mlx5_cq_completion(struct mlx5_core_dev *dev, u32 cqn) { - struct mlx5_core_cq *cq; struct mlx5_cq_table *table = >priv.cq_table; + struct mlx5_core_cq *cq; + struct epoch_tracker et; + bool do_lock; - if (cqn < MLX5_CQ_LINEAR_ARRAY_SIZE) { - struct mlx5_cq_linear_array_entry *entry; + NET_EPOCH_ENTER(et); - entry = >linear_array[cqn]; - spin_lock(>lock); - cq = entry->cq; - if (cq == NULL) { - mlx5_core_warn(dev, - "Completion event for bogus CQ 0x%x\n", cqn); - } else { - ++cq->arm_sn; - cq->comp(cq); - } - spin_unlock(>lock); - return; - } + do_lock = atomic_read(>writercount) != 0; + if (unlikely(do_lock)) + spin_lock(>writerlock); - spin_lock(>lock); - cq = radix_tree_lookup(>tree, cqn); - if (likely(cq)) - atomic_inc(>refcount); - spin_unlock(>lock); + if (likely(cqn < MLX5_CQ_LINEAR_ARRAY_SIZE)) + cq = table->linear_array[cqn].cq; + else + cq = radix_tree_lookup(>tree, cqn); - if (!cq) { - mlx5_core_warn(dev, "Completion event for bogus CQ 0x%x\n", cqn); - return; + if (unlikely(do_lock)) + spin_unlock(>writerlock); + + if (likely(cq != NULL)) { + ++cq->arm_sn; + cq->comp(cq); + } else { + mlx5_core_warn(dev, + "Completion event for bogus CQ 0x%x\n", cqn); } - ++cq->arm_sn; - - cq->comp(cq); - - if (atomic_dec_and_test(>refcount))
svn commit: r357293 - head/sys/net
Author: hselasky Date: Thu Jan 30 12:04:02 2020 New Revision: 357293 URL: https://svnweb.freebsd.org/changeset/base/357293 Log: Widen EPOCH(9) usage in netisr. Software interrupt handlers are allowed to sleep. In swi_net() there is a read lock behind NETISR_RLOCK() which in turn ends up calling msleep() which means the whole of swi_net() cannot be protected by an EPOCH(9) section. By default the NETISR_LOCKING feature is disabled. This issue was introduced by r357004. This is a preparation step for replacing the functionality provided by r357004. Found by: kib@ Sponsored by: Mellanox Technologies Modified: head/sys/net/netisr.c Modified: head/sys/net/netisr.c == --- head/sys/net/netisr.c Thu Jan 30 10:40:38 2020(r357292) +++ head/sys/net/netisr.c Thu Jan 30 12:04:02 2020(r357293) @@ -920,6 +920,7 @@ netisr_process_workstream_proto(struct netisr_workstre static void swi_net(void *arg) { + struct epoch_tracker et; #ifdef NETISR_LOCKING struct rm_priotracker tracker; #endif @@ -931,7 +932,9 @@ swi_net(void *arg) #ifdef DEVICE_POLLING KASSERT(nws_count == 1, ("%s: device_polling but nws_count != 1", __func__)); + NET_EPOCH_ENTER(et); netisr_poll(); + NET_EPOCH_EXIT(et); #endif #ifdef NETISR_LOCKING NETISR_RLOCK(); @@ -940,6 +943,7 @@ swi_net(void *arg) KASSERT(!(nwsp->nws_flags & NWS_RUNNING), ("swi_net: running")); if (nwsp->nws_flags & NWS_DISPATCHING) goto out; + NET_EPOCH_ENTER(et); nwsp->nws_flags |= NWS_RUNNING; nwsp->nws_flags &= ~NWS_SCHEDULED; while ((bits = nwsp->nws_pendingbits) != 0) { @@ -950,6 +954,7 @@ swi_net(void *arg) } } nwsp->nws_flags &= ~NWS_RUNNING; + NET_EPOCH_EXIT(et); out: NWS_UNLOCK(nwsp); #ifdef NETISR_LOCKING ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r357292 - head/sys/dev/acpi_support
Author: philip Date: Thu Jan 30 10:40:38 2020 New Revision: 357292 URL: https://svnweb.freebsd.org/changeset/base/357292 Log: acpi_ibm: add support for ThinkPad PrivacyGuard ThinkPad PrivacyGuard is a built-in toggleable privacy filter that restricts viewing angles when on. It is an available on some new ThinkPad models such as the X1 Carbon 7th gen (as an optional HW upgrade). The privacy filter can be enabled/disabled via an ACPI call. This commit adds a sysctl under dev.acpi_ibm that allows for getting and setting the PrivacyGuard state. Submitted by: Kamila Součková Reviewed By:cem, philip MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D23370 Modified: head/sys/dev/acpi_support/acpi_ibm.c Modified: head/sys/dev/acpi_support/acpi_ibm.c == --- head/sys/dev/acpi_support/acpi_ibm.cThu Jan 30 10:28:01 2020 (r357291) +++ head/sys/dev/acpi_support/acpi_ibm.cThu Jan 30 10:40:38 2020 (r357292) @@ -75,6 +75,7 @@ ACPI_MODULE_NAME("IBM") #define ACPI_IBM_METHOD_THERMAL13 #define ACPI_IBM_METHOD_HANDLEREVENTS 14 #define ACPI_IBM_METHOD_MIC_LED15 +#define ACPI_IBM_METHOD_PRIVACYGUARD 16 /* Hotkeys/Buttons */ #define IBM_RTC_HOTKEY10x64 @@ -123,6 +124,8 @@ ACPI_MODULE_NAME("IBM") #define IBM_NAME_MASK_WLAN (1 << 2) #define IBM_NAME_THERMAL_GET "TMP7" #define IBM_NAME_THERMAL_UPDT "UPDT" +#define IBM_NAME_PRIVACYGUARD_GET "GSSS" +#define IBM_NAME_PRIVACYGUARD_SET "" #define IBM_NAME_EVENTS_STATUS_GET "DHKC" #define IBM_NAME_EVENTS_MASK_GET "DHKN" @@ -146,6 +149,10 @@ ACPI_MODULE_NAME("IBM") #define IBM_EVENT_MUTE 0x17 #define IBM_EVENT_ACCESS_IBM_BUTTON0x18 +/* Device-specific register flags */ +#define IBM_FLAG_PRIVACYGUARD_DEVICE_PRESENT 0x1 +#define IBM_FLAG_PRIVACYGUARD_ON 0x1 + #define ABS(x) (((x) < 0)? -(x) : (x)) struct acpi_ibm_softc { @@ -268,6 +275,11 @@ static struct { .method = ACPI_IBM_METHOD_MIC_LED, .description= "Mic led", }, + { +.name = "privacyguard", +.method= ACPI_IBM_METHOD_PRIVACYGUARD, +.description = "PrivacyGuard enable", + }, { NULL, 0, NULL, 0 } }; @@ -327,7 +339,12 @@ static int acpi_ibm_bluetooth_set(struct acpi_ibm_soft static int acpi_ibm_thinklight_set(struct acpi_ibm_softc *sc, int arg); static int acpi_ibm_volume_set(struct acpi_ibm_softc *sc, int arg); static int acpi_ibm_mute_set(struct acpi_ibm_softc *sc, int arg); +static int acpi_ibm_privacyguard_get(struct acpi_ibm_softc *sc); +static ACPI_STATUS acpi_ibm_privacyguard_set(struct acpi_ibm_softc *sc, int arg); +static ACPI_STATUS acpi_ibm_privacyguard_acpi_call(struct acpi_ibm_softc *sc, bool write, int *arg); +static int acpi_status_to_errno(ACPI_STATUS status); + static device_method_t acpi_ibm_methods[] = { /* Device interface */ DEVMETHOD(device_probe, acpi_ibm_probe), @@ -351,6 +368,19 @@ DRIVER_MODULE(acpi_ibm, acpi, acpi_ibm_driver, acpi_ib MODULE_DEPEND(acpi_ibm, acpi, 1, 1, 1); static char*ibm_ids[] = {"IBM0068", "LEN0068", "LEN0268", NULL}; +static int +acpi_status_to_errno(ACPI_STATUS status) +{ + switch (status) { + case AE_OK: + return (0); + case AE_BAD_PARAMETER: + return (EINVAL); + default: + return (ENODEV); + } +} + static void ibm_led(void *softc, int onoff) { @@ -821,6 +851,11 @@ acpi_ibm_sysctl_get(struct acpi_ibm_softc *sc, int met else val = -1; break; + + case ACPI_IBM_METHOD_PRIVACYGUARD: + val = acpi_ibm_privacyguard_get(sc); + break; + } return (val); @@ -877,6 +912,10 @@ acpi_ibm_sysctl_set(struct acpi_ibm_softc *sc, int met return acpi_ibm_bluetooth_set(sc, arg); break; + case ACPI_IBM_METHOD_PRIVACYGUARD: + return (acpi_status_to_errno(acpi_ibm_privacyguard_set(sc, arg))); + break; + case ACPI_IBM_METHOD_FANLEVEL: if (arg < 0 || arg > 7) return (EINVAL); @@ -1008,6 +1047,10 @@ acpi_ibm_sysctl_init(struct acpi_ibm_softc *sc, int me case ACPI_IBM_METHOD_HANDLEREVENTS: return (TRUE); + + case ACPI_IBM_METHOD_PRIVACYGUARD: + return (acpi_ibm_privacyguard_get(sc) != -1); + } return (FALSE); } @@ -1223,6 +1266,60 @@ acpi_ibm_thinklight_set(struct acpi_ibm_softc *sc, int } return (0); +} + +/* + * Helper function to make a get or set ACPI call to the PrivacyGuard handle. + * Only meant to be used internally by the
svn commit: r357291 - in head/sys/dev: bwi bwn ipw iwi iwm iwn malo mwl ral rtwn/pci wi wpi wtap
Author: hselasky Date: Thu Jan 30 10:28:01 2020 New Revision: 357291 URL: https://svnweb.freebsd.org/changeset/base/357291 Log: Widen EPOCH(9) usage in PCI WLAN drivers. Make sure all occurrences of ieee80211_input_xxx() in sys/dev are covered by a network epoch section. Do not depend on the interrupt handler nor any taskqueues being in a network epoch section. This patch should unbreak the PCI WLAN drivers after r357004. Pointy hat: glebius@ Sponsored by: Mellanox Technologies Modified: head/sys/dev/bwi/if_bwi.c head/sys/dev/bwn/if_bwn.c head/sys/dev/ipw/if_ipw.c head/sys/dev/iwi/if_iwi.c head/sys/dev/iwm/if_iwm.c head/sys/dev/iwn/if_iwn.c head/sys/dev/malo/if_malo.c head/sys/dev/mwl/if_mwl.c head/sys/dev/ral/rt2560.c head/sys/dev/ral/rt2661.c head/sys/dev/ral/rt2860.c head/sys/dev/rtwn/pci/rtwn_pci_rx.c head/sys/dev/wi/if_wi.c head/sys/dev/wpi/if_wpi.c head/sys/dev/wtap/if_wtap.c Modified: head/sys/dev/bwi/if_bwi.c == --- head/sys/dev/bwi/if_bwi.c Thu Jan 30 09:56:57 2020(r357290) +++ head/sys/dev/bwi/if_bwi.c Thu Jan 30 10:28:01 2020(r357291) @@ -1506,6 +1506,7 @@ bwi_stop_locked(struct bwi_softc *sc, int statechg) void bwi_intr(void *xsc) { + struct epoch_tracker et; struct bwi_softc *sc = xsc; struct bwi_mac *mac; uint32_t intr_status; @@ -1625,7 +1626,9 @@ bwi_intr(void *xsc) device_printf(sc->sc_dev, "intr noise\n"); if (txrx_intr_status[0] & BWI_TXRX_INTR_RX) { + NET_EPOCH_ENTER(et); rx_data = sc->sc_rxeof(sc); + NET_EPOCH_EXIT(et); if (sc->sc_flags & BWI_F_STOP) { BWI_UNLOCK(sc); return; Modified: head/sys/dev/bwn/if_bwn.c == --- head/sys/dev/bwn/if_bwn.c Thu Jan 30 09:56:57 2020(r357290) +++ head/sys/dev/bwn/if_bwn.c Thu Jan 30 10:28:01 2020(r357291) @@ -5072,6 +5072,7 @@ bwn_intr(void *arg) static void bwn_intrtask(void *arg, int npending) { + struct epoch_tracker et; struct bwn_mac *mac = arg; struct bwn_softc *sc = mac->mac_sc; uint32_t merged = 0; @@ -5132,6 +5133,7 @@ bwn_intrtask(void *arg, int npending) if (mac->mac_reason_intr & BWN_INTR_NOISESAMPLE_OK) bwn_intr_noise(mac); + NET_EPOCH_ENTER(et); if (mac->mac_flags & BWN_MAC_FLAG_DMA) { if (mac->mac_reason[0] & BWN_DMAINTR_RX_DONE) { bwn_dma_rx(mac->mac_method.dma.rx); @@ -5139,6 +5141,7 @@ bwn_intrtask(void *arg, int npending) } } else rx = bwn_pio_rx(>mac_method.pio.rx); + NET_EPOCH_EXIT(et); KASSERT(!(mac->mac_reason[1] & BWN_DMAINTR_RX_DONE), ("%s", __func__)); KASSERT(!(mac->mac_reason[2] & BWN_DMAINTR_RX_DONE), ("%s", __func__)); Modified: head/sys/dev/ipw/if_ipw.c == --- head/sys/dev/ipw/if_ipw.c Thu Jan 30 09:56:57 2020(r357290) +++ head/sys/dev/ipw/if_ipw.c Thu Jan 30 10:28:01 2020(r357291) @@ -1159,6 +1159,7 @@ static void ipw_rx_data_intr(struct ipw_softc *sc, struct ipw_status *status, struct ipw_soft_bd *sbd, struct ipw_soft_buf *sbuf) { + struct epoch_tracker et; struct ieee80211com *ic = >sc_ic; struct mbuf *mnew, *m; struct ieee80211_node *ni; @@ -1230,11 +1231,13 @@ ipw_rx_data_intr(struct ipw_softc *sc, struct ipw_stat IPW_UNLOCK(sc); ni = ieee80211_find_rxnode(ic, mtod(m, struct ieee80211_frame_min *)); + NET_EPOCH_ENTER(et); if (ni != NULL) { (void) ieee80211_input(ni, m, rssi - nf, nf); ieee80211_free_node(ni); } else (void) ieee80211_input_all(ic, m, rssi - nf, nf); + NET_EPOCH_EXIT(et); IPW_LOCK(sc); bus_dmamap_sync(sc->rbd_dmat, sc->rbd_map, BUS_DMASYNC_PREWRITE); Modified: head/sys/dev/iwi/if_iwi.c == --- head/sys/dev/iwi/if_iwi.c Thu Jan 30 09:56:57 2020(r357290) +++ head/sys/dev/iwi/if_iwi.c Thu Jan 30 10:28:01 2020(r357291) @@ -1181,6 +1181,7 @@ static void iwi_frame_intr(struct iwi_softc *sc, struct iwi_rx_data *data, int i, struct iwi_frame *frame) { + struct epoch_tracker et; struct ieee80211com *ic = >sc_ic; struct mbuf *mnew, *m; struct ieee80211_node *ni; @@ -1270,11 +1271,13 @@ iwi_frame_intr(struct iwi_softc *sc, struct iwi_rx_dat IWI_UNLOCK(sc); ni = ieee80211_find_rxnode(ic, mtod(m, struct ieee80211_frame_min *)); + NET_EPOCH_ENTER(et); if (ni != NULL) { type = ieee80211_input(ni, m, rssi, nf);
svn commit: r357288 - head/sys/dev/usb/wlan
Author: hselasky Date: Thu Jan 30 09:41:48 2020 New Revision: 357288 URL: https://svnweb.freebsd.org/changeset/base/357288 Log: Widen EPOCH(9) usage in USB WLAN drivers. This patch should unbreak the USB WLAN drivers after r357004. Pointy hat: glebius@ Sponsored by: Mellanox Technologies Modified: head/sys/dev/usb/wlan/if_rum.c head/sys/dev/usb/wlan/if_run.c head/sys/dev/usb/wlan/if_uath.c head/sys/dev/usb/wlan/if_upgt.c head/sys/dev/usb/wlan/if_ural.c head/sys/dev/usb/wlan/if_urtw.c head/sys/dev/usb/wlan/if_zyd.c Modified: head/sys/dev/usb/wlan/if_rum.c == --- head/sys/dev/usb/wlan/if_rum.c Thu Jan 30 08:56:22 2020 (r357287) +++ head/sys/dev/usb/wlan/if_rum.c Thu Jan 30 09:41:48 2020 (r357288) @@ -1168,6 +1168,7 @@ rum_bulk_read_callback(struct usb_xfer *xfer, usb_erro struct ieee80211com *ic = >sc_ic; struct ieee80211_frame_min *wh; struct ieee80211_node *ni; + struct epoch_tracker et; struct mbuf *m = NULL; struct usb_page_cache *pc; uint32_t flags; @@ -1286,6 +1287,7 @@ tr_setup: else ni = NULL; + NET_EPOCH_ENTER(et); if (ni != NULL) { (void) ieee80211_input(ni, m, rssi, RT2573_NOISE_FLOOR); @@ -1293,6 +1295,7 @@ tr_setup: } else (void) ieee80211_input_all(ic, m, rssi, RT2573_NOISE_FLOOR); + NET_EPOCH_EXIT(et); } RUM_LOCK(sc); rum_start(sc); Modified: head/sys/dev/usb/wlan/if_run.c == --- head/sys/dev/usb/wlan/if_run.c Thu Jan 30 08:56:22 2020 (r357287) +++ head/sys/dev/usb/wlan/if_run.c Thu Jan 30 09:41:48 2020 (r357288) @@ -2811,6 +2811,7 @@ run_rx_frame(struct run_softc *sc, struct mbuf *m, uin struct ieee80211com *ic = >sc_ic; struct ieee80211_frame *wh; struct ieee80211_node *ni; + struct epoch_tracker et; struct rt2870_rxd *rxd; struct rt2860_rxwi *rxwi; uint32_t flags; @@ -2929,12 +2930,14 @@ run_rx_frame(struct run_softc *sc, struct mbuf *m, uin } } + NET_EPOCH_ENTER(et); if (ni != NULL) { (void)ieee80211_input(ni, m, rssi, nf); ieee80211_free_node(ni); } else { (void)ieee80211_input_all(ic, m, rssi, nf); } + NET_EPOCH_EXIT(et); return; Modified: head/sys/dev/usb/wlan/if_uath.c == --- head/sys/dev/usb/wlan/if_uath.c Thu Jan 30 08:56:22 2020 (r357287) +++ head/sys/dev/usb/wlan/if_uath.c Thu Jan 30 09:41:48 2020 (r357288) @@ -2705,6 +2705,7 @@ uath_bulk_rx_callback(struct usb_xfer *xfer, usb_error struct ieee80211com *ic = >sc_ic; struct ieee80211_frame *wh; struct ieee80211_node *ni; + struct epoch_tracker et; struct mbuf *m = NULL; struct uath_data *data; struct uath_rx_desc *desc = NULL; @@ -2751,6 +2752,7 @@ setup: ni = ieee80211_find_rxnode(ic, (struct ieee80211_frame_min *)wh); nf = -95; /* XXX */ + NET_EPOCH_ENTER(et); if (ni != NULL) { (void) ieee80211_input(ni, m, (int)be32toh(desc->rssi), nf); @@ -2759,6 +2761,7 @@ setup: } else (void) ieee80211_input_all(ic, m, (int)be32toh(desc->rssi), nf); + NET_EPOCH_EXIT(et); m = NULL; desc = NULL; } Modified: head/sys/dev/usb/wlan/if_upgt.c == --- head/sys/dev/usb/wlan/if_upgt.c Thu Jan 30 08:56:22 2020 (r357287) +++ head/sys/dev/usb/wlan/if_upgt.c Thu Jan 30 09:41:48 2020 (r357288) @@ -2211,6 +2211,7 @@ upgt_bulk_rx_callback(struct usb_xfer *xfer, usb_error struct ieee80211com *ic = >sc_ic; struct ieee80211_frame *wh; struct ieee80211_node *ni; + struct epoch_tracker et; struct mbuf *m = NULL; struct upgt_data *data; int8_t nf; @@ -2248,12 +2249,14 @@ setup: ni = ieee80211_find_rxnode(ic, (struct ieee80211_frame_min *)wh); nf = -95; /* XXX */ + NET_EPOCH_ENTER(et);
svn commit: r357287 - in head/sys: fs/nullfs sys
Author: mjg Date: Thu Jan 30 08:56:22 2020 New Revision: 357287 URL: https://svnweb.freebsd.org/changeset/base/357287 Log: vfs: remove the never set VDESC_NOMAP_VPP flag Modified: head/sys/fs/nullfs/null_vnops.c head/sys/sys/vnode.h Modified: head/sys/fs/nullfs/null_vnops.c == --- head/sys/fs/nullfs/null_vnops.c Thu Jan 30 05:37:35 2020 (r357286) +++ head/sys/fs/nullfs/null_vnops.c Thu Jan 30 08:56:22 2020 (r357287) @@ -310,9 +310,7 @@ 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 && - !(descp->vdesc_flags & VDESC_NOMAP_VPP) && - !error) { + if (descp->vdesc_vpp_offset != VDESC_NO_OFFSET && !error) { /* * XXX - even though some ops have vpp returned vp's, * several ops actually vrele this before returning. Modified: head/sys/sys/vnode.h == --- head/sys/sys/vnode.hThu Jan 30 05:37:35 2020(r357286) +++ head/sys/sys/vnode.hThu Jan 30 08:56:22 2020(r357287) @@ -463,7 +463,6 @@ extern struct vattr va_null; /* predefined null vattr #defineVDESC_VP1_WILLRELE 0x0002 #defineVDESC_VP2_WILLRELE 0x0004 #defineVDESC_VP3_WILLRELE 0x0008 -#defineVDESC_NOMAP_VPP 0x0100 #defineVDESC_VPP_WILLRELE 0x0200 /* ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"