This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: Reading atomic variables in embedded C
- From: Roland McGrath <roland at redhat dot com>
- To: Mike Mason <mmlnx at us dot ibm dot com>
- Cc: SystemTAP <systemtap at sources dot redhat dot com>
- Date: Mon, 24 Sep 2007 15:47:17 -0700 (PDT)
- Subject: Re: Reading atomic variables in embedded C
- References: <46F836CF.600@us.ibm.com>
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