Date: Tue, 3 Sep 2002 23:06:55 +0100 From: Dominic Marks <dominic_marks@btinternet.com> To: freebsd-hackers@freebsd.org Subject: network interface lock order reversal question Message-ID: <20020903220655.GA1545@gallium>
next in thread | raw e-mail | index | archive | help
Hey,
Just put -CURRENT back on an AMD Athlon machine I have after a three or
four month absense, looking through dmesg I see the following:
vr0: <VIA VT6102 Rhine II 10/100BaseTX> port 0xd400-0xd4ff mem
0xd8000000-0xd80000ff irq 11 at device 9.0 on pci0
/usr/src/sys/vm/uma_core.c:1332: could sleep with "vr0" locked from
/usr/src/sys/pci/if_vr.c:659
/usr/src/sys/vm/uma_core.c:1332: could sleep with "vr0" locked from
/usr/src/sys/pci/if_vr.c:659
lock order reversal
1st 0xc2667a90 vr0 (network driver) @ /usr/src/sys/pci/if_vr.c:659
2nd 0xc0488140 allproc (allproc) @ /usr/src/sys/kern/kern_fork.c:317
/usr/src/sys/vm/uma_core.c:1332: could sleep with "vr0" locked from
/usr/src/sys/pci/if_vr.c:659
/usr/src/sys/vm/uma_core.c:1332: could sleep with "vr0" locked from
/usr/src/sys/pci/if_vr.c:659
/usr/src/sys/vm/uma_core.c:1332: could sleep with "vr0" locked from
/usr/src/sys/pci/if_vr.c:659
/usr/src/sys/vm/uma_core.c:1332: could sleep with "vr0" locked from
/usr/src/sys/pci/if_vr.c:659
>> /usr/src/sys/pci/if_vr.c ~ 659 (vr_attach)
mtx_init(&sc->vr_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK,
MTX_DEF | MTX_RECURSE);
VR_LOCK(sc);
<<
>> /usr/src/sys/pci/if_vrreg.h ~ 468
#define VR_LOCK(_sc) mtx_lock(&(_sc)->vr_mtx)
<<
>> /usr/src/sys/vm/uma_core.c ~ 1332 (uma_zalloc_arg)
if (!(flags & M_NOWAIT)) {
KASSERT(curthread->td_intr_nesting_level == 0,
("malloc(M_WAITOK) in interrupt context"));
WITNESS_SLEEP(1, NULL);
}
<<
>> /usr/src/sys/sys/lock.h ~ 233
#define WITNESS_SLEEP(check, lock) \
witness_sleep((check), (lock), __FILE__, __LINE__)
<<
The solution, if I understand correctly is to drop the lock before
entering the UMA code. The call of contigmalloc() in the vr driver is, I
guess the route into the UMA code (via the vm ?), so would dropping the
lock around the call to contigmalloc() be a solution, or am I missing
the big picture?
RFC?
--
Dominic Marks
Computer & Politics Geek
[work]::[npl.co.uk] << dominic.marks at npl.co.uk >>
[educ]::[umist.ac.uk] << notyet-known at umist.ac.uk >>
[home]::[btinternet] << dominic_marks at btinternet.com >>
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020903220655.GA1545>
