debugfs_create_u*() not SMP-safe - Kernel
This is a discussion on debugfs_create_u*() not SMP-safe - Kernel ; Hi,
I noticed debugfs_create_u*() functions don't allow for any precautions
to be taken while doing r/w to the exported variables. Thus any export of a
variable isn't SMP-safe.
As far as I can tell, this only works safely for constant ...
-
debugfs_create_u*() not SMP-safe
Hi,
I noticed debugfs_create_u*() functions don't allow for any precautions
to be taken while doing r/w to the exported variables. Thus any export of a
variable isn't SMP-safe.
As far as I can tell, this only works safely for constant data. Let me
ask then, what is the purpose of these functions? Are they intended only
for unreliable data?
As I see it, they could be replaced by one of the following:
- Have them only export atomic data, that is atomic_t variables.
- Have them take a lock as a parameter, which the read() / write()
handler grabs. The kernel code that exported the variable should also
do r/w while holding that same lock.
Or am I wrong?
Thanks,
Eduard
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
-
Re: debugfs_create_u*() not SMP-safe
On Fri, Jul 18, 2008 at 06:52:37AM +0300, Eduard - Gabriel Munteanu wrote:
> Hi,
>
> I noticed debugfs_create_u*() functions don't allow for any precautions
> to be taken while doing r/w to the exported variables. Thus any export of a
> variable isn't SMP-safe.
That's true, so don't do multiple writes to a debugfs file at the same
time 
> As far as I can tell, this only works safely for constant data. Let me
> ask then, what is the purpose of these functions? Are they intended only
> for unreliable data?
This is for _debug_ data, not stuff that is "critical". This is for
informational or debug purposes only. If you really care about the data
always being correct here, then don't use debugfs, that's not what it is
for.
Hope this helps,
greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/