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: discussion about registering task_finder in user space probing


Hi Wenji,

On Tue, 2009-03-24 at 17:57 +0800, Wenji Huang wrote:
> Mark Wielaard wrote:
> > I was just looking at this since I am doing something similar on the
> > pr6866 branch (not just for uprobes, but also for utrace and itrace
> > probes). My idea was to have stap_register_task_finder_target ()
> > recognize when the callback is already registered for that particular
> > pathname/pid. stap_register_task_finder_target () already avoids
> > duplication when it sees an existing entry for pathname/pid. So where
> Yes, it will search the existing entry before adding entry to list.
> 
> > there is now a
> > 
> >     // Add this target to the callback list for this task.
> >     list_add_tail(&new_tgt->callback_list, &tgt->callback_list_head);
> > 
> > We could do a lookup of whether the callback is already in the list and
> > only add it when it isn't already there. What do you think?
> 
> Sounds good. Current code is harmless, but it's better if we could make 
> it more graceful.

Unfortunately this doesn't work for the way uprobes registers itself. I
was looking into it to see if it could be used as a way to solve PR9940.
But the uprobes task finder callbacks use a trick to get at the original
struct stap_uprobe_spec. It makes the struct stap_task_finder_target the
first argument, then uses container_of in its own callback to cast the
struct stap_task_finder_target* to a struct stap_uprobe_spec*. Which
"works" since the struct stap_task_finder_target is the first member of
the struct stap_uprobe_spec and so a pointer to that field is the same
as a pointer to the containing struct. So when you remove duplicate
stap_task_finder_target registrations with the same callback field you
disrupt how uprobes currently uses them, because it expects to get
duplicate calls and go through (de)registration for each of them.

Cheers,

Mark


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