tech-net archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: mpsafe-ing



On Tue, Mar 21, 2017 at 2:20 AM,  <coypu%sdf.org@localhost> wrote:
> 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.

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...)

> 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


Home | Main Index | Thread Index | Old Index