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: Proposed task.stp additions


Mike Mason wrote:
> A while back we discussed submitting changes to the list for review
and
> ACKS.  I realize this patch is relatively minor, but thought I'd get
the
> ball rolling.

Internally we've been playing with Review Board for stuff like this,
which works nicely.
http://reviewboard.chipx86.com/

> I'd like to add these functions to task.stp.  I've found them useful
in
> scripts I've written.

task_cputime() and is_kthread() look good, but I have similar concerns
as Frank with the other two.

It's unsafe to use d_path() because it takes locks.  Since we can call
from arbitrary contexts, this has the possibility to create a deadlock.
It also dereferences the pointers you give it, so you have to be 100%
sure that those pointers are valid.

Using pid2task() also has the possibility of the task disappearing from
under you later.  The proper method is to use (get|put)_task_struct(),
but put_task_struct() can't be used by modules.  Even if it could, we
still don't have a way to *guarantee* that the put() is called
eventually.

BUT, as long as *everything* you do with the result of pid2task() is
protected by kread(), this is probably OK.  In the rare case that the
task disappears, you may get corrupt data or an error from an invalid
dereference, but this won't impact system stability.

Josh


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