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]

wrong calculation of kprobe.addr?


Hi,
 
I tried the following stap script:

probe kernel.function("elv_next_request")
{
    log("elv_next_request")
}

On my Power5(2.6.9-22) it runs as desired, lots of "elv_next_request"
is printed. But on my pc(2.6.14.2) it will print nothing, the probe 
seems never to be hit at all. I think it may be architecture related.

But I abandoned this idea after I modified the kernel src file
elevator.c on my pc to add a printk, to make sure if elv_next_request
really will never be called on my pc:

struct request *elv_next_request(request_queue_t *q)
{
        struct request *rq;
        int ret;
        printk(KERN_INFO "elv_next_req from printk");
        while ((rq = __elv_next_request(q)) != NULL) {


I recompiled my kernel(name it 2.6.14.2-custom), reboot, then 
/var/log/message shows that lots of "elv_next_req from printk". So 
you can see that elv_next_request is really called on my pc. 

Then I retry my script, this time it worked, lot of "elv_next_request"
is printed out.

So I am trying to figure out why my script doesn't work for me before.
The only differences between the working and not-working of my script
is that I added a printk inside elv_next_request.

The following is the address from /proc/kallsyms and the address
systemTap used to register a kprobe:

------2.6.14.2 kernel (not modified)------
from /proc/kallsyms:
c02402e0 T elv_next_request

snippet from the .c file got from: stap -p3 a.stp

static struct kprobe dwarf_kprobe_0[1]= {
  {.addr= (void *) 0xc02402e8}
};


------2.6.14.2-custom (modified kernel)------

from /proc/kallsyms:
c02402e0 T elv_next_request

snippet from the .c file got from: stap -p3 a.stp

static struct kprobe dwarf_kprobe_0[1]= {
  {.addr= (void *) 0xc02402f0}
};


So you can see, the address elv_next_request doesn't change between
the two kernels(c02402e0), but the address kprobe used changed(from
0xc02402e8 to 0xc02402f0). Is this as designed, or there is something
wrong with the calculation of kprobe address in systemTap?

Thanks in advance for your help

Best Regards,

Li Guanglei

- Linux Performance, China Systems & Technology Lab
China Development Labs, Beijing Tel: 86-10-82782244 Ext.3516  Email: 
liguangl@cn.ibm.com


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