* Reading atomic variables in embedded C
@ 2007-09-24 22:47 Mike Mason
2007-09-25 14:59 ` Roland McGrath
0 siblings, 1 reply; 2+ messages in thread
From: Mike Mason @ 2007-09-24 22:47 UTC (permalink / raw)
To: SystemTAP
What's the proper way to read atomic variables in embedded C? Can we just use kread within a probe handler or is something like atomic_read() still necessary?
Thanks,
Mike
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Reading atomic variables in embedded C
2007-09-24 22:47 Reading atomic variables in embedded C Mike Mason
@ 2007-09-25 14:59 ` Roland McGrath
0 siblings, 0 replies; 2+ messages in thread
From: Roland McGrath @ 2007-09-25 14:59 UTC (permalink / raw)
To: Mike Mason; +Cc: SystemTAP
In every machine's asm/atomic.h, atomic_read(v) is actually just defined as
(v->counter) with no other magic. So, you can just use kread on that, or
use $foo->counter in script code. This encodes an assumption about the
kernel implementation, though the proper kernel API is to presume the
atomic_read macro might do some magic you need to use. But, there is no
way to use atomic_read and get the fault-protection of kread. So it's
improper by systemtap robustness rules to use atomic_read.
Thanks,
Roland
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-09-24 22:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-09-24 22:47 Reading atomic variables in embedded C Mike Mason
2007-09-25 14:59 ` Roland McGrath
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).