Discussion:
mpsafe-ing
(too old to reply)
c***@SDF.ORG
2017-03-20 17:20:41 UTC
Permalink
Hi, I experimented and made this diff some from freebsd:
http://coypu.sdf.org/alc2.diff
I'm using NET_MPSAFE and everything seems fine, but it's probably wrong
somewhere. How to tell if I'm doing things right?

Thanks.

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Ryota Ozaki
2017-03-21 08:55:33 UTC
Permalink
Post by c***@SDF.ORG
http://coypu.sdf.org/alc2.diff
I'm using NET_MPSAFE and everything seems fine, but it's probably wrong
somewhere.
Thank you for the effort!

Some comments to the patch from me:
- You need to set PCI_INTR_MPSAFE to pci_intr_establish
- Otherwise Rx interrupt handler runs with KERNEL_LOCK
- This means that Tx and Rx don't run in parallel normally
because all the socket APIs are executed with KERNEL_LOCK
- See wm(4) to know how to set the flag
- You may want to set IFEF_START_MPSAFE to if_extflags
- This flag unlocks KERNEL_LOCK on if_start (driver's Tx)
- This is needed to run Tx on IP forwarding without KERNEL_LOCK
- I guess you shouldn't call mii functions such as mii_tick and
mii_mediachg with holding ALC_LOCK (spin mutex)
- Because mii functions may sleep in some cases
- (Hmm, wm(4) calls mii_tick with WM_CORE_LOCK...)
Post by c***@SDF.ORG
How to tell if I'm doing things right?
- Repeat (a) drvctl -d alc0; drvctl -r pci0 or (b) unplug/plug the cable
under network loads of (i) IP forwarding or (ii) iperf from/to the host.
- Run the above trials for several hours continuously

Regards,
ozaki-r

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Darren Reed
2017-04-02 02:59:20 UTC
Permalink
Post by Ryota Ozaki
...
Post by c***@SDF.ORG
How to tell if I'm doing things right?
- Repeat (a) drvctl -d alc0; drvctl -r pci0 or (b) unplug/plug the cable
under network loads of (i) IP forwarding or (ii) iperf from/to the host.
- Run the above trials for several hours continuously
If you're looking to test potential race conditions, a method that I've
used successfully in the past is to use dtrace to insert relatively long
delays in places where a quick return otherwise hides a logic flaw.

Cheers,
Darren



--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Loading...