cvs commit: src/sys/compat/ndis kern_ndis.c ntoskrnl_var.h
subr_ndis.c subr_ntoskrnl.c
Bill Paul
wpaul at FreeBSD.org
Fri Jan 14 14:39:44 PST 2005
wpaul 2005-01-14 22:39:44 UTC
FreeBSD src repository
Modified files:
sys/compat/ndis kern_ndis.c ntoskrnl_var.h subr_ndis.c
subr_ntoskrnl.c
Log:
Fix a problem reported by Pierre Beyssac. Sometinmes when ndis_get_info()
calls MiniportQueryInformation(), it will return NDIS_STATUS_PENDING.
When this happens, ndis_get_info() will sleep waiting for a completion
event. If two threads call ndis_get_info() and both end up having to
sleep, they will both end up waiting on the same wait channel, which
can cause a panic in sleepq_add() if INVARIANTS are turned on.
Fix this by having ndis_get_info() use a common mutex rather than
using the process mutex with PROC_LOCK(). Also do the same for
ndis_set_info(). Note that Pierre's original patch also made ndis_thsuspend()
use the new mutex, but ndis_thsuspend() shouldn't need this since
it will make each thread that calls it sleep on a unique wait channel.
Also, it occured to me that we probably don't want to enter
MiniportQueryInformation() or MiniportSetInformation() from more
than one thread at any given time, so now we acquire a Windows
spinlock before calling either of them. The Microsoft documentation
says that MiniportQueryInformation() and MiniportSetInformation()
are called at DISPATCH_LEVEL, and previously we would call
KeRaiseIrql() to set the IRQL to DISPATCH_LEVEL before entering
either routine, but this only guarantees mutual exclusion on
uniprocessor machines. To make it SMP safe, we need to use a real
spinlock. For now, I'm abusing the spinlock embedded in the
NDIS_MINIPORT_BLOCK structure for this purpose. (This may need to be
applied to some of the other routines in kern_ndis.c at a later date.)
Export ntoskrnl_init_lock() (KeInitializeSpinlock()) from subr_ntoskrnl.c
since we need to use in in kern_ndis.c, and since it's technically part
of the Windows kernel DDK API along with the other spinlock routines. Use
it in subr_ndis.c too rather than frobbing the spinlock directly.
Revision Changes Path
1.62 +19 -14 src/sys/compat/ndis/kern_ndis.c
1.19 +1 -0 src/sys/compat/ndis/ntoskrnl_var.h
1.70 +2 -2 src/sys/compat/ndis/subr_ndis.c
1.46 +1 -2 src/sys/compat/ndis/subr_ntoskrnl.c
More information about the cvs-src
mailing list