Re: [RFC PATCH] tty, add kref to sysrq handlers
From: Prarit Bhargava
Date: Fri May 04 2012 - 09:00:28 EST
On 04/27/2012 01:39 PM, Alan Cox wrote:
>> If the lock were removed, however, there is one _unlikely_ circumstance in
>> which the array would be left unprotected. That would be the situation in
>> which a module was loaded and the sysrq handler was registered during the
>> execution of the module. Again, the possibility of the scenario is very
>> small and given the existing usage of unregister_sysrq_key() in the tree
>> it seems like removing the lock is sufficient.
>
> It's asking for later disasters I think.
>
> I'm not sure I see we need a kref - that looks like overkill, and its
> probably even more elegantly done with RCU ?
Alan,
Thanks for the suggestions. As always they are much appreciated.
I looked into this, and unfortunately the RCU implementation in the kernel is
dynamic-list based. I could do some funky stuff to make it work with an array
or even implement an RCU for arrays but I'm wondering if that is wasted code.
Most arrays in the kernel that require RCU-like locking seem to use seqlocks.
The problem with any lock, unfortunately, is that I would have to still block
irqs, which is exactly what I'm trying to avoid.
I'll submit my patch as a real PATCH and see what everyone thinks of it ...
P.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/