protocol threads mpsafe mode
Sepherosa Ziehau
sepherosa at gmail.com
Mon Sep 22 06:37:01 PDT 2008
On Mon, Sep 22, 2008 at 3:18 AM, Matthew Dillon
<dillon at apollo.backplane.com> wrote:
> I think we can go with something similar, allowing you to start
> committing the work without interfering with stability on HEAD.
> How about a few cleanups though. For testing purposes we don't
> really care about another few nanoseconds so:
>
> * Always start the protocol threads TDF_MPSAFE. LWKT is MP-SAFE so
> there is no need to conditionalize it. The msgport code is also
> MP-SAFE, so we really only have to worry about the function dispatch.
>
> * You might as well not bother with two different netmsg_service_loop
> threads. Just have one, acquire and release the mp lock based on
> NETISR_FLAG_MPSAFE and netisr_mpsafe_thread.
>
>
> Here's what I'm thinking. This is untested but note that the critical
> path is handled nicely.
Looks good, this also gives us the ability to change mpsafe mode
dynamicly on a running system, see the new patch.
>
> --
>
> netisr_run(): I'm not sure you need any MP tests at all in this
> code, won't it already be properly held or not held due already having
> been resolved by the original dispatch? This routine is only called
> on re-dispatch.
Nah, it is called on the critical path:
NIC intr mport and sends msg to proto threads, the msg's handler is
ether_input_oncpu() which calls netisr_run().
ether_input_oncpu() has three major functionality:
1) bridge input, which is mpsafe
2) fastforward, which is mpsafe
3) call NETISR handler (netisr_run)
With few changes, I could make major parts of ether_input_oncpu()
mpsafe, thus to turn on MSGF_MPSAFE in the msg sent by NIC intr. Once
ether_input_oncpu() runs without BGL, then the mpsafe testing in
netisr_run() is necessary.
>
> netisr_queue(): Would check the netisr flag and set or clear TDF_MPSAFE
> appropriately.
>
> schednetisr(): Would check the netisr flag and set or clear TDF_MPSAFE
> appropriately.
Ah, I forgot these two :), added in the new patch.
New patch is here, please review:
http://leaf.dragonflybsd.org/~sephe/proto.diff2
Best Regards,
sephe
--
Live Free or Die
More information about the Kernel
mailing list