tech-kern archive

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

Re: RFC: mpsafe bridge and NIC drivers (vioif and wm)



On Sat, Jun 21, 2014 at 10:00 AM, Matt Thomas <matt%3am-software.com@localhost> 
wrote:
>
>
> On Jun 20, 2014, at 5:57 AM, Ryota Ozaki <ozaki-r%iij.ad.jp@localhost> wrote:
>
> > Hi,
> >
> > I've prepared a trial patch of MPSAFE networking.
> >
> >  http://www.netbsd.org/~ozaki-r/mpsafe-wm.diff
> >
>
> The kmutex_t in ifqueue, etc. should be pointers and not in the structure 
> themselves.
> That can simply the macros to test for a NULL pointer for the locks in the 
> non-WM case.
>
> Consider using mutex_obj_alloc to get mutexes instead of the embedding them 
> in the
> structures.

Well...do you mean that the macros should be like these?

#define WM_LOCK(_sc)   if ((_sc)->sc_txrx_lock) mutex_enter((_sc)->sc_txrx_lock)
#define WM_UNLOCK(_sc) if ((_sc)->sc_txrx_lock) mutex_exit((_sc)->sc_txrx_lock)

>
>
> Some of your macros are missing 'do's :)

Sure :)

Thanks!
  ozaki-r

>
> > It enables the interrupt handler of if_wm to run without
> > KERNEL_LOCK; an interrupt context and a LWP context (e.g.,
> > wm_start) run in parallel safely.
> >
> > You can try it by applying the patch to -current
> > and commenting in NET_MPSAFE in sys/net/if.h.
> >
> > A complete patch of my work can be found at usual places:
> > - http://www.netbsd.org/~ozaki-r/mpsafe-bridge-wm-vioif.diff
> > - 
> > https://github.com/ozaki-r/netbsd-src/tree/experimental/mpsafe-bridge-wm-vioif
> >
> >  ozaki-r
>


Home | Main Index | Thread Index | Old Index