summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authorwpaul <wpaul@FreeBSD.org>2005-01-14 22:39:44 +0000
committerwpaul <wpaul@FreeBSD.org>2005-01-14 22:39:44 +0000
commit2fe7b09cb198e42356fd30dbc005daff0809ff0c (patch)
tree3a9e5e53b82d220e5b1b19d590daa80a2ab1aafe /lib/libc
parentd6994ae2c3d702098728453f6996a26bbf5a2992 (diff)
downloadFreeBSD-src-2fe7b09cb198e42356fd30dbc005daff0809ff0c.zip
FreeBSD-src-2fe7b09cb198e42356fd30dbc005daff0809ff0c.tar.gz
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.
Diffstat (limited to 'lib/libc')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud