tech-kern archive

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

separate L3 output KERNEL_LOCK



Hi,

Currently, L3 output processing call L2 (or L3 tunneling) output routine
holding KERNEL_LOCK. This KERNEL_LOCK is controled by NET_MPSAFE kernel
option. e.g.
    https://nxr.netbsd.org/xref/src/sys/netinet/ip_output.c#215

That is, if NET_MPSAFE is enabled at current implementation, L2 and device
driver output processing run without KERNEL_LOCK whether the L2 component
and the device driver is MP-safe or not.

To enable NET_MPSAFE safely in the future, it is required to separete the
KERNEL_LOCK to each L2 component and device drivers, and then enable
KERNEL_LOCK for each component which is not MP-safe yet.

The design to implement this concept is consisted of below two parts.
    1. at L3 output processing call L2 output routine
       - remove KERNEL_LOCK from caller(L3)
       - wrap callee(L2) ifp->if_output with KERNEL_LOCK if necessary
    2. at L2 output processing call device driver output routine
       - check device driver MP-safe flags (*)
       - if device driver has MP-safe flag, call without KERNEL_LOCK and
         vice versa

      (*) Unfortunately, struct ifnet->if_flags is already used all bit.
          So, I change if__pad1 to if_extflags and use it as flags.

Here is the patch series,
    http://www.netbsd.org/~knakahara/separate-l3-lock/separate-l3-lock.tgz
and unified patch.
    http://www.netbsd.org/~knakahara/separate-l3-lock/unified-separate-l3-lock.patch

Could you comment this design or implementation?


Thanks,

-- 
//////////////////////////////////////////////////////////////////////
Internet Initiative Japan Inc.

Device Engineering Section,
IoT Platform Development Department,
Network Division,
Technology Unit

Kengo NAKAHARA <k-nakahara%iij.ad.jp@localhost>


Home | Main Index | Thread Index | Old Index