This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [QUESTION] Is it safe to use lock in systemtap tapset?


spacewanderlzx wrote:

> I am searching for some information about lock usage in the systemtap
> tapset.

The general advice is to avoid explicit locking in embedded-C functions,
since they may in principle run in any context, including atomic.  I am
not sure how explicitly we spell this out in [man stap] or
tapset/DEVGUIDE.


> Is it safe to use lock in systemtap tapset?
> Maybe the answer is different for tapset used in different context
> (timers, kernel.function, process.function, etc.)?
> Which kind of lock should I use in the tapset?

It depends on the shared resource you are concerned about, in what
probe/context you want to access them, whether you want to read or
write, and whether you can tolerate corrupt data or not.

Note: systemtap's own script-level global variables (and hidden runtime
state) are all already protected automatically.  There's no need to
initialize or worry about locking them.  (This is a unique feature in
systemtap, in contrast to almost every other tracing/probing system.)


- FChE


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]