Source-Changes-D archive

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

Re: CVS commit: src/sys



On Thu, Aug 27, 2015 at 07:55:39PM +0200, Manuel Bouyer wrote:

> > Of course that prevents multiple threads to call diskstart.
> 
> does it implies that this prevents multiple outstanding transactions
> to the controller ?

No, it doesn't.

If I understand this correctly, then the old (non-MPSAFE) code is serialized
by KERNEL_LOCK. Only one thread can enter the block device strategy routine
and it will queue a buffer and serially send as many buffers to the
controller as it has openings.

The current code will effectively do the same. But in the MPSAFE case
(currently enabled for ld(4)), there is no KERNEL_LOCK. So multiple threads
can queue buffers in parallel (every queue has an individual lock)
and the controller start routine has another lock for hardware access.
Multiple threads can call the start routine, but for most controllers,
this will be serialized again by the hardware access lock.

My last suggestion would serialize the start routine in the caller
to prevent a race condition.

For most controllers there is no difference wether the serialization
happens in the caller or inside the start routine. But if you have
some hardware with multiple channels that can be accessed in parallel
without locking, or that even requires significant CPU assitance,
the serialization might hurt.
But it won't be worse than the non-MPSAFE case.



Greetings,
-- 
                                Michael van Elst
Internet: mlelstv%serpens.de@localhost
                                "A potential Snark may lurk in every tree."


Home | Main Index | Thread Index | Old Index