Hello,
On Wed, Aug 18, 2010 at 8:07 PM, Parmenides <mobile.parmeni...@gmail.com> wrote:
> Hi,
>
> For a critical section protected by a spin lock, kernel preemption is
> disabled explicitly, probably to make the critical section atomic.
> But, suppose that an interrupt occures in this critical section,
> allowing interrupts can wreck the atomicity. So, why don't we disable
> interrupts as a critical section is executing?

Remember that you always must protect the data, and not the code.

If your data is never accessed from interrupt handlers, then spin_lock
is just enough. If instead, you access your data, both from interrupt and
process context than you should use spin_lock_irqsave ([1]).

thanks,
Daniel.

[1] http://lxr.linux.no/#linux+v2.6.35/Documentation/spinlocks.txt

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecar...@nl.linux.org
Please read the FAQ at http://kernelnewbies.org/FAQ

Reply via email to