freebsd-dev/sys
Coleman Kane 21a6592999 Convert ndis_spinlock to ndis_mtx and start using the sleepable
mtx interface for NDIS_LOCK/UNLOCK. This should result in less
CPU utilization on behalf of the ndis driver. Additionally, this
commit also fixes a potential LOR in the ndis_tick code, by
not locking inside the ndis_tick function, but instead delegating
that work to the helpers called through IoQueueWorkItem. The
way that this is currently set up for NDIS prevents us from
simply implementing a callout_init_mtx mechanism.

However, the helper functions that handle the various timeout
cases implement fine-grained locking using the spinlocks provided
by the NDIS-compat layer, and using the mtx that is added with
this commit. This leaves the following ndis_softc members operated
on in ndis_tick in an unlocked context:

  * ndis_hang_timer - Only modified outside of ndis_tick once, before
                      the first callout_reset to schedule ndis_tick
  * ifp->if_oerrors - Only incremented in two places, which should be
                      an atomic op
  * ndis_tx_timer   - Assigned to 5 (when guaranteed to be 0) or 0
                      (in txeof), to indicate to ndis_tick what to
                      do. This is the only member of which I was
                      suspicious for needing the NDIS_LOCK here. My
                      testing (and another's) have been fine so far.
  * ndis_stat_callout - Only uses a simple set of callout routines,
                        callout_reset only called by ndis_tick after
                        the initial reset, and then callout_drain is
                        used exactly once in shutdown code.

The benefit is that ndis_tick doesn't acquire NDIS_LOCK unless one of
the timeout conditions is flagged, and it still obeys the locking
order semantics that are dictated by the NDIS layer at the moment. I
have been investigating a more thorough s/spinlock/mtx/ of the NDIS
layer, but the simplest naive approach (replace KeAcquireSpinLock
with an mtx implementation) has anti-succeeded for me so far. This
is a good first step though.

Tested by:	onemda@gmail.com
Reviewed by:	current@, jhb, thompsa
Proposed by:	jhb
2008-06-11 13:40:15 +00:00
..
amd64 Correct an error in pmap_promote_pde() that may result in an errant 2008-06-01 07:36:59 +00:00
arm Add the pxa_teardown_intr() bus method function to de-associate the 2008-06-10 06:06:15 +00:00
boot Fix the incorrect calculation of a block address within a single indirect 2008-06-07 05:49:24 +00:00
bsm Merge OpenBSM 1.0 changes to src/sys/bsm: 2007-10-29 18:47:25 +00:00
cam Locking in the ses_ioctl handler doesn't have to be so strict because 2008-03-17 17:18:16 +00:00
cddl Merge a recent change from the OpenSolaris source tree. 2008-06-01 01:46:37 +00:00
compat fix a page fault that it occurred during ifp is NULL. This bug happens 2008-06-11 07:55:07 +00:00
conf Remove some sparc-specific stuff from my earlier sun4v work in p4. 2008-06-09 06:31:17 +00:00
contrib Fix range check for rtable id. 2008-06-05 19:30:20 +00:00
crypto Make test00 compilable again. 2008-01-15 18:34:47 +00:00
ddb Rename debug.ddb.capture.bytes sysctl to debug.ddb.capture.bufoff in 2008-04-25 13:23:36 +00:00
dev Convert ndis_spinlock to ndis_mtx and start using the sleepable 2008-06-11 13:40:15 +00:00
fs In cd9660_readdir vop, always initialize the idp->uio_off member. 2008-06-11 12:46:09 +00:00
gdb Commit SYSINIT() ;-adding patch missed in previous pass. 2008-03-16 13:02:04 +00:00
geom Remove the distinction between device minor and unit numbers. 2008-05-29 12:50:46 +00:00
gnu Move the head of byte-level advisory lock list from the 2008-04-16 11:33:32 +00:00
i386 After probing the available frequency settings, restore the CPU to run at 2008-05-30 22:01:09 +00:00
ia64 Work-around a compiler optimization bug, that broke libthr. Massive 2008-05-28 16:41:02 +00:00
isa atrtc.c is a repocopy of the RTC device driver from i386/isa/clock.c 2008-04-14 07:57:15 +00:00
kern Keep proper track of nsegs counter: sem_free is called for all 2008-06-10 20:55:10 +00:00
libkern Add prototype for __cmpd2(). 2008-02-23 22:40:05 +00:00
mips Fix spelling of "virtual". 2008-06-08 08:56:46 +00:00
modules Add support for the Apple Big Mac (BMAC) Ethernet controller, 2008-06-07 22:58:32 +00:00
net When RADIX_MPATH is enabled, the route selection is not rotating 2008-05-30 09:34:35 +00:00
net80211 Change the calling convention for ic_node_alloc to deal with 2008-06-07 18:38:02 +00:00
netatalk Add code to allow the system to handle multiple routing tables. 2008-05-09 23:03:00 +00:00
netgraph Pass really available buffer size to libalias instead of MCLBYTES constant. 2008-06-01 15:13:32 +00:00
netinet Sort IP addresses before hashing them for the signature. Otherwise carp is 2008-06-02 18:58:07 +00:00
netinet6 Employ read locks on UDP inpcbs, rather than write locks, when 2008-05-29 08:27:14 +00:00
netipsec In addition to the ipsec_osdep.h removal a week ago, now also eliminate 2008-05-24 15:32:46 +00:00
netipx Rather than m_free(dtom(si)) in spx_reass(), return (1) which causes the 2008-05-29 07:18:43 +00:00
netnatm
netncp lockmgrs need to be released before to be destroyed and draining doesn't 2008-03-30 18:16:33 +00:00
netsmb Really, smb_iod_main() is not totally MPSAFE, so just acquire and drop 2008-03-27 01:23:59 +00:00
nfs Replaced the misleading uses of a historical artefact M_TRYWAIT with M_WAIT. 2008-03-25 09:39:02 +00:00
nfs4client Once the ENOLCK is detected we expect to retry the acquisition. 2008-05-27 00:20:19 +00:00
nfsclient Once the ENOLCK is detected we expect to retry the acquisition. 2008-05-27 00:20:19 +00:00
nfsserver Change the fix in the rev. 1.179 to use nfsrv_lockedpair_nd(). 2008-05-28 16:23:17 +00:00
nlm Back out the nlm_global_lock part of the last change - I forgot that only 2008-06-03 08:10:58 +00:00
opencrypto Make ftruncate a 'struct file' operation rather than a vnode operation. 2008-01-07 20:05:19 +00:00
pc98 Remove ISDN4BSD (I4B) from HEAD as it is not MPSAFE and 2008-05-26 10:40:09 +00:00
pccard
pci - Use bus_foo() rather than bus_space_foo() and remove bus space tag/handle 2008-06-06 18:29:56 +00:00
powerpc Move bm(4) from the sys/conf/NOTES to sys/powerpc/conf/NOTES. 2008-06-08 01:58:11 +00:00
rpc Fix some issues that showed up during Kris' testing. 2008-04-11 10:34:59 +00:00
security When the file-system containing the audit log file is running low on 2008-06-10 20:05:32 +00:00
sparc64 The VM system no longer uses setPQL2(). Remove it and its helpers. 2008-05-23 04:03:54 +00:00
sun4v Use the "options " spelling (vs. "options<TAB>") so that commented lines 2008-05-21 03:36:53 +00:00
sys Provide the mutual exclusion between the nfs export list modifications 2008-06-09 10:31:38 +00:00
tools Introduce a standalone shell script for embedding MFS image. 2008-02-05 10:46:30 +00:00
ufs Fix comments to replace SBSIZE with SBLOCKSIZE, since SBSIZE 2008-05-24 20:44:14 +00:00
vm Essentially, neither madvise(..., MADV_DONTNEED) nor madvise(..., MADV_FREE) 2008-06-06 18:38:43 +00:00
xdr Add the new kernel-mode NFS Lock Manager. To use it instead of the 2008-03-26 15:23:12 +00:00
Makefile Remove ISDN4BSD (I4B) from HEAD as it is not MPSAFE and 2008-05-26 10:40:09 +00:00