* debugfs_create_u*() not SMP-safe
@ 2008-07-18 3:52 Eduard - Gabriel Munteanu
2008-07-18 18:46 ` Greg KH
0 siblings, 1 reply; 2+ messages in thread
From: Eduard - Gabriel Munteanu @ 2008-07-18 3:52 UTC (permalink / raw)
To: greg; +Cc: torvalds, Randy Dunlap, linux-kernel, Pekka Enberg
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: debugfs_create_u*() not SMP-safe
2008-07-18 3:52 debugfs_create_u*() not SMP-safe Eduard - Gabriel Munteanu
@ 2008-07-18 18:46 ` Greg KH
0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2008-07-18 18:46 UTC (permalink / raw)
To: Eduard - Gabriel Munteanu
Cc: torvalds, Randy Dunlap, linux-kernel, Pekka Enberg
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-07-18 18:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-18 3:52 debugfs_create_u*() not SMP-safe Eduard - Gabriel Munteanu
2008-07-18 18:46 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox