Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci aq(4): Remove incorrect ASSERT_SLEEPABLE introdu...



details:   https://anonhg.NetBSD.org/src/rev/34873a21d8e5
branches:  trunk
changeset: 371964:34873a21d8e5
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Fri Oct 21 09:29:32 2022 +0000

description:
aq(4): Remove incorrect ASSERT_SLEEPABLE introduced in 1.33.

It is true that aq_stop must be sleepable, and that aq_stop_locked
may sleep, but aq_stop_locked will release sc->sc_mutex when it
sleeps, which ASSERT_SLEEPABLE doesn't know about.  Since that is a
spin lock, ASSERT_SLEEPABLE trips over it and crashes.

This is not quite right: aq_stop should really only take the lock
over specific things that need the lock to synchronize with other
threads, like mii_down; aq_init and aq_stop are already serialized by
IFNET_LOCK.  sc->sc_mutex is used for too much and should have its
scope narrowed like I did recently in usbnet(9).  But this small
change will at least remove a source of crashes for now.

diffstat:

 sys/dev/pci/if_aq.c |  5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diffs (26 lines):

diff -r 3ed764ff2f35 -r 34873a21d8e5 sys/dev/pci/if_aq.c
--- a/sys/dev/pci/if_aq.c       Fri Oct 21 09:21:17 2022 +0000
+++ b/sys/dev/pci/if_aq.c       Fri Oct 21 09:29:32 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_aq.c,v 1.37 2022/10/17 10:39:27 riastradh Exp $     */
+/*     $NetBSD: if_aq.c,v 1.38 2022/10/21 09:29:32 riastradh Exp $     */
 
 /**
  * aQuantia Corporation Network Driver
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.37 2022/10/17 10:39:27 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.38 2022/10/21 09:29:32 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_if_aq.h"
@@ -4871,7 +4871,6 @@
        struct aq_softc * const sc = ifp->if_softc;
        int i;
 
-       ASSERT_SLEEPABLE();
        KASSERT(IFNET_LOCKED(ifp));
        AQ_LOCKED(sc);
 



Home | Main Index | Thread Index | Old Index