This is the mail archive of the
systemtap@sources.redhat.com
mailing list for the systemtap project.
Re: [RFC] Design + prototype: Multiple kprobes at an address - take 2]
- From: Maneesh Soni <maneesh at in dot ibm dot com>
- To: Ananth N Mavinakayanahalli <amavin at redhat dot com>
- Cc: systemtap at sources dot redhat dot com
- Date: Fri, 8 Apr 2005 11:29:07 +0530
- Subject: Re: [RFC] Design + prototype: Multiple kprobes at an address - take 2]
- References: <42552F3A.2070900@redhat.com>
- Reply-to: maneesh at in dot ibm dot com
On Thu, Apr 07, 2005 at 09:01:46AM -0400, Ananth N Mavinakayanahalli wrote:
> 2.3.1 Registering a kprobe
>
> 1. Kprobes are registered with a call to register_kprobe().
> 2. The kprobe infrastructure determines if a probe already exists at
> the requested location.
> 3. If this is a new kprobe, registration proceeds as it done
> currently.
> 4. If a kprobe already exists at the requested address:
> a. If the call is to register a jprobe, the new handler
> registration fails since we can't have a jprobe and a kprobe
> at the same address. Whether a registration is for a jprobe
> or not is determined by the presence of a break_handler.
> b. If the call is to register a kprobe and if the pre_handler
> for the existing kprobe is not aggr_pre_handler, we then:
> 1. Allocate a aggr_probe structure
> 2. Populate the aggr_probe's kprobe structure with
> appropriate values for the addr, opcode, ainsn fields
> 3. Set the handlers for the aggr_probe's kprobe to custom
> handlers with list walk logic
> 4. Add the existing kprobe to the aggr_probe's kprobes list
> 5. Initialize the new kprobe
> 6. Add the new kprobe to the aggr_probe's kprobes list
> c. If the call is to register a kprobe and if the pre_handler
> for the existing kprobe is aggr_pre_handler, it means that
> we already have an aggr_probe defined at this address.
> Unless the new probe to register is not a jprobe, it is
> initialized and added to the aggr_probe's "kprobes" list.
> The registration fails if the new probe is a jprobe.
>
> 2.3.2 Unregistering a kprobe
>
> 1. Kprobes are unregistered by making a call to unregister_kprobe()
> 2. If a kprobe exists and its pre_handler is aggr_pre_handler(),
> then, this is one of the possibly many kprobes at the address:
> a. Delete the kprobe from the aggr_probe's kprobes list.
> b. If the aggr_probe's kprobe list is empty, then we free the
> aggr_probe structure.
> 3. If the kprobe to be unregistered is the only one at the address,
> remove it as is done currently.
>
How about keeping the kprobe core as it is by moving the existing register
and unregistering functionality to (un)register_kprobe_single(struct kprobe *)
and the multiple handler probes are handled in (un)register_kprobe(), somewhat
like this
int register_kprobe(struct kprobe *kp)
{
err = register_kprobe(kp);
if (err == -EEXIST) {
err = add_aggr_kprobe(kp);
}
}
Thanks
Maneesh
--
Maneesh Soni
Linux Technology Center,
IBM India Software Labs,
Bangalore, India
email: maneesh@in.ibm.com
Phone: 91-80-25044990