public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* help needed to probe own modules
@ 2008-10-28 22:52 Kai_Wong
  2008-10-29  1:15 ` Frank Ch. Eigler
  0 siblings, 1 reply; 10+ messages in thread
From: Kai_Wong @ 2008-10-28 22:52 UTC (permalink / raw)
  To: systemtap


I'm a new systemtap user and am trying to use it to probe my own kernel
modules. I'm successful in running sample scripts such as top.stp in
/usr/share/doc/systemtap-0.5.12 on a RHEL 5 system.

I can also do things like:
stap -e 'probe module("ext3").function("*") {printf("%d %s(%d)\n",
gettimeofday_s(), execname(), pid())}'

However, for a module, vxlogmod, that I made and added using insmod and
showed up under lsmod:
[root@srlglm1 vxlog]#lsmod
Module                  Size  Used by
 ... <snipped> ...
vxlogmod              317560  1 vxglm

stap gave the following error:
# stap -e 'probe module("vxlogmod").function("*") {}'
semantic error: no match for probe point while resolving probe point
module("vxlogmod").function("*")
Pass 2: analysis failed.  Try again with more '-v' (verbose) options.

So, my questions are:
1. Does systemtap on RHEL5 support probing kernel modules that are built and
installed separately from the distro kernel?
2. If so, what do I need to do to make it recognize my modules?

Any help will be much appreciated.
Best,
Kai
-- 
View this message in context: http://www.nabble.com/help-needed-to-probe-own-modules-tp20217654p20217654.html
Sent from the Sourceware - systemtap mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: help needed to probe own modules
  2008-10-28 22:52 help needed to probe own modules Kai_Wong
@ 2008-10-29  1:15 ` Frank Ch. Eigler
       [not found]   ` <1A193CCB5218B14589B1979BC7D510E006F0EB1E@TUS1XCHCLUPIN11.enterprise.veritas.com>
  0 siblings, 1 reply; 10+ messages in thread
From: Frank Ch. Eigler @ 2008-10-29  1:15 UTC (permalink / raw)
  To: Kai_Wong; +Cc: systemtap


Kai_Wong <kai_wong@symantec.com> writes:

> [...]
> However, for a module, vxlogmod, that I made and added using insmod and
> showed up under lsmod:
> [root@srlglm1 vxlog]#lsmod
> Module                  Size  Used by
>  ... <snipped> ...
> vxlogmod              317560  1 vxglm
>
> stap gave the following error:
> # stap -e 'probe module("vxlogmod").function("*") {}'
> semantic error: no match for probe point while resolving probe point
> module("vxlogmod").function("*")
> [...]

You need to find out where vxlogmod.ko's debugging data is.  If your
build system does not strip it, it should still be in there.  Then you
just need to copy it to a place where systemtap will look for it by
default (such as /lib/modules/`uname -r`/ANYTHING), or make systemtap
look for it where you do have it (by adding the directory to the
SYSTEMTAP_DEBUGINFO_PATH environment variable appropriately; see
stap.1 for the default).


- FChE

^ permalink raw reply	[flat|nested] 10+ messages in thread

* question regarding accessing a target variable
       [not found]               ` <20081107020842.GG20928@redhat.com>
@ 2009-01-02 22:30                 ` Kai Wong
  2009-01-03  1:00                   ` Frank Ch. Eigler
  2009-01-03  1:30                 ` Kai Wong
                                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 10+ messages in thread
From: Kai Wong @ 2009-01-02 22:30 UTC (permalink / raw)
  To: systemtap; +Cc: Frank Ch. Eigler

Hi,

I try to access a target variable (e.g., block, which is a c local
variable within a probed function), but no matter what line number I
place the probe within the function (e.g., probe
module("vxglm").statement("vxg_recv_block_grant@/home2/kwong/glm-bld/50m
p3_clustrace/kernel/glm/smp/glmbpxy.c:67")), I get the following
message:

semantic error: not accessible at this address: identifier '$block' at
/usr/share/systemtap/tapset/glm/msgsup.stp:20:123

that target variable was actually assigned a valid value and referenced
in many different lines within the probed function. I have no trouble
with other target variables that are c local variables.

What can I do to make a c local variable more accessible to systemtap as
a target variable?

Kai 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: question regarding accessing a target variable
  2009-01-02 22:30                 ` question regarding accessing a target variable Kai Wong
@ 2009-01-03  1:00                   ` Frank Ch. Eigler
  0 siblings, 0 replies; 10+ messages in thread
From: Frank Ch. Eigler @ 2009-01-03  1:00 UTC (permalink / raw)
  To: Kai Wong; +Cc: systemtap

Hi -

On Fri, Jan 02, 2009 at 03:29:04PM -0700, Kai Wong wrote:
> [...]
> (e.g., probe
> module("vxglm").statement("vxg_recv_block_grant@/home2/kwong/glm-bld/50m
> p3_clustrace/kernel/glm/smp/glmbpxy.c:67")), I get the following
> message:
> 
> semantic error: not accessible at this address: identifier '$block' at
> /usr/share/systemtap/tapset/glm/msgsup.stp:20:123
> [...]
> What can I do to make a c local variable more accessible to systemtap as
> a target variable?

I jotted some melancholy notes on this in the wiki.
http://sources.redhat.com/systemtap/wiki/TipContextVariables

- FChE

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: question regarding accessing a target variable
       [not found]               ` <20081107020842.GG20928@redhat.com>
  2009-01-02 22:30                 ` question regarding accessing a target variable Kai Wong
@ 2009-01-03  1:30                 ` Kai Wong
  2009-01-03 13:50                   ` Frank Ch. Eigler
  2009-01-06  0:26                 ` Kai Wong
                                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 10+ messages in thread
From: Kai Wong @ 2009-01-03  1:30 UTC (permalink / raw)
  To: systemtap; +Cc: Frank Ch. Eigler

FChE wrote:
> I jotted some melancholy notes on this in the wiki.
> http://sources.redhat.com/systemtap/wiki/TipContextVariables

If none of the other options applies or works, but I can modify the
source of the probed software, does
inserting inline-assembly directives as shown in that example slow down
the performance of the probed software when not probed (assuming the
"volatile" directives stays)?

-Kai

-----Original Message-----
From: Kai Wong 
Sent: Friday, January 02, 2009 2:29 PM
To: 'systemtap@sources.redhat.com'
Cc: 'Frank Ch. Eigler'
Subject: question regarding accessing a target variable

Hi,

I try to access a target variable (e.g., block, which is a c local
variable within a probed function), but no matter what line number I
place the probe within the function (e.g., probe
module("vxglm").statement("vxg_recv_block_grant@/home2/kwong/glm-bld/50m
p3_clustrace/kernel/glm/smp/glmbpxy.c:67")), I get the following
message:

semantic error: not accessible at this address: identifier '$block' at
/usr/share/systemtap/tapset/glm/msgsup.stp:20:123

that target variable was actually assigned a valid value and referenced
in many different lines within the probed function. I have no trouble
with other target variables that are c local variables.

What can I do to make a c local variable more accessible to systemtap as
a target variable?

Kai 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: question regarding accessing a target variable
  2009-01-03  1:30                 ` Kai Wong
@ 2009-01-03 13:50                   ` Frank Ch. Eigler
  0 siblings, 0 replies; 10+ messages in thread
From: Frank Ch. Eigler @ 2009-01-03 13:50 UTC (permalink / raw)
  To: Kai Wong; +Cc: systemtap

Hi -

On Fri, Jan 02, 2009 at 06:28:59PM -0700, Kai Wong wrote:

> [...]  If none of the other options applies or works, but I can
> modify the source of the probed software, does inserting
> inline-assembly directives as shown in that example slow down the
> performance of the probed software when not probed (assuming the
> "volatile" directives stays)?

It should not, in any material way.  You can confirm with measurements
of course, or by looking over the assembly/object code before & after.

- FChE

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: question regarding accessing a target variable
       [not found]               ` <20081107020842.GG20928@redhat.com>
  2009-01-02 22:30                 ` question regarding accessing a target variable Kai Wong
  2009-01-03  1:30                 ` Kai Wong
@ 2009-01-06  0:26                 ` Kai Wong
  2009-01-24 14:27                 ` Kai Wong
       [not found]                 ` <1A193CCB5218B14589B1979BC7D510E00802FAFC@TUS1XCHCLUPIN12.enterprise.veritas.com>
  4 siblings, 0 replies; 10+ messages in thread
From: Kai Wong @ 2009-01-06  0:26 UTC (permalink / raw)
  To: systemtap; +Cc: Frank Ch. Eigler

FChE wrote:
> It should not, in any material way.  You can confirm with measurements
> of course, or by looking over the assembly/object code before & after.

It works, without any measurable performance degradation. Thank you very
much!!
-Kai

-----Original Message-----
From: Kai Wong 
Sent: Friday, January 02, 2009 5:29 PM
To: 'systemtap@sources.redhat.com'
Cc: 'Frank Ch. Eigler'
Subject: RE: question regarding accessing a target variable

FChE wrote:
> I jotted some melancholy notes on this in the wiki.
> http://sources.redhat.com/systemtap/wiki/TipContextVariables

If none of the other options applies or works, but I can modify the
source of the probed software, does
inserting inline-assembly directives as shown in that example slow down
the performance of the probed software when not probed (assuming the
"volatile" directives stays)?

-Kai

-----Original Message-----
From: Kai Wong 
Sent: Friday, January 02, 2009 2:29 PM
To: 'systemtap@sources.redhat.com'
Cc: 'Frank Ch. Eigler'
Subject: question regarding accessing a target variable

Hi,

I try to access a target variable (e.g., block, which is a c local
variable within a probed function), but no matter what line number I
place the probe within the function (e.g., probe
module("vxglm").statement("vxg_recv_block_grant@/home2/kwong/glm-bld/50m
p3_clustrace/kernel/glm/smp/glmbpxy.c:67")), I get the following
message:

semantic error: not accessible at this address: identifier '$block' at
/usr/share/systemtap/tapset/glm/msgsup.stp:20:123

that target variable was actually assigned a valid value and referenced
in many different lines within the probed function. I have no trouble
with other target variables that are c local variables.

What can I do to make a c local variable more accessible to systemtap as
a target variable?

Kai 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: question regarding accessing a target variable
       [not found]               ` <20081107020842.GG20928@redhat.com>
                                   ` (2 preceding siblings ...)
  2009-01-06  0:26                 ` Kai Wong
@ 2009-01-24 14:27                 ` Kai Wong
  2009-01-25  2:44                   ` Frank Ch. Eigler
       [not found]                 ` <1A193CCB5218B14589B1979BC7D510E00802FAFC@TUS1XCHCLUPIN12.enterprise.veritas.com>
  4 siblings, 1 reply; 10+ messages in thread
From: Kai Wong @ 2009-01-24 14:27 UTC (permalink / raw)
  To: systemtap; +Cc: Frank Ch. Eigler

Hi,

Although the "volatile" directive as in
<http://sources.redhat.com/systemtap/wiki/TipContextVariables> works in
most cases, it doesn't help if the target variable is used to merely
cast a function parameter as something else. For example, if I have a
probe to the following function:

void dummy_function(void *a) {
	typedef struct {
		int	x;
		int	y;
	} b_t; 
	b_t *b = (b_t*)a;
	 ...
}

I can't access the target variables x and y in a systemtap script using
$b->x and $b->y (I get " semantic error: not accessible at this
address").

Is there any support in the systemtap script language that lets me
access x and y without having to write a separate embedded-c function
for each as follows?

%{
	typedef struct {
		int	x;
		int	y;
	} b_t; 
%}

function get_x:long (a:long) %{
	b_t *b = (b_t *)(long)THIS->a;
	THIS->__retvalue = deref(sizeof(b->x), &(b->x));
	if (0) {
deref_fault:
		CONTEXT->last_error = "pointer dereference fault";
	}
%}

function get_y:long (a:long) %{
	b_t *b = (b_t *)(long)THIS->a;
	THIS->__retvalue = deref(sizeof(b->y), &(b->y));
	if (0) {
deref_fault:
		CONTEXT->last_error = "pointer dereference fault";
	}
%}

Or, if you see a simpler method to this, that'll also be helpful.

Kai


-----Original Message-----
From: Kai Wong 
Sent: Monday, January 05, 2009 4:25 PM
To: 'systemtap@sources.redhat.com'
Cc: 'Frank Ch. Eigler'
Subject: RE: question regarding accessing a target variable
Importance: High

FChE wrote:
> It should not, in any material way.  You can confirm with measurements
> of course, or by looking over the assembly/object code before & after.

It works, without any measurable performance degradation. Thank you very
much!!
-Kai

-----Original Message-----
From: Kai Wong 
Sent: Friday, January 02, 2009 5:29 PM
To: 'systemtap@sources.redhat.com'
Cc: 'Frank Ch. Eigler'
Subject: RE: question regarding accessing a target variable

FChE wrote:
> I jotted some melancholy notes on this in the wiki.
> http://sources.redhat.com/systemtap/wiki/TipContextVariables

If none of the other options applies or works, but I can modify the
source of the probed software, does
inserting inline-assembly directives as shown in that example slow down
the performance of the probed software when not probed (assuming the
"volatile" directives stays)?

-Kai

-----Original Message-----
From: Kai Wong 
Sent: Friday, January 02, 2009 2:29 PM
To: 'systemtap@sources.redhat.com'
Cc: 'Frank Ch. Eigler'
Subject: question regarding accessing a target variable

Hi,

I try to access a target variable (e.g., block, which is a c local
variable within a probed function), but no matter what line number I
place the probe within the function (e.g., probe
module("vxglm").statement("vxg_recv_block_grant@/home2/kwong/glm-bld/50m
p3_clustrace/kernel/glm/smp/glmbpxy.c:67")), I get the following
message:

semantic error: not accessible at this address: identifier '$block' at
/usr/share/systemtap/tapset/glm/msgsup.stp:20:123

that target variable was actually assigned a valid value and referenced
in many different lines within the probed function. I have no trouble
with other target variables that are c local variables.

What can I do to make a c local variable more accessible to systemtap as
a target variable?

Kai 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: question regarding accessing a target variable
  2009-01-24 14:27                 ` Kai Wong
@ 2009-01-25  2:44                   ` Frank Ch. Eigler
  0 siblings, 0 replies; 10+ messages in thread
From: Frank Ch. Eigler @ 2009-01-25  2:44 UTC (permalink / raw)
  To: Kai Wong; +Cc: systemtap

"Kai Wong" <kai_wong@symantec.com> writes:

> [...]
> void dummy_function(void *a) {
> 	typedef struct {
> 		int	x;
> 		int	y;
> 	} b_t;
> 	b_t *b = (b_t*)a;
> 	 ...
> }
>
> I can't access the target variables x and y in a systemtap script using
> $b->x and $b->y (I get " semantic error: not accessible at this
> address").
>
> Is there any support in the systemtap script language that lets me
> access x and y without having to write a separate embedded-c function
> for each as follows?
> [...]

I think sources.redhat.com/PR6704 (now 5634) should at some point
cover this, by allowing you write the cast from void* to "struct b_t".

Our pointer/typing operations are currently rather limited.  I've been
hoping that we wouldn't need the whole C suite of */&/(cast), but
maybe we'll have to bite that bullet and build it.

- FChE

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: question regarding accessing a target variable
       [not found]                 ` <1A193CCB5218B14589B1979BC7D510E00802FAFC@TUS1XCHCLUPIN12.enterprise.veritas.com>
@ 2009-01-27 21:40                   ` Frank Ch. Eigler
  0 siblings, 0 replies; 10+ messages in thread
From: Frank Ch. Eigler @ 2009-01-27 21:40 UTC (permalink / raw)
  To: Kai Wong; +Cc: systemtap

Hi -

kai_wong wrote:

> I don't see a resolution for PR 5634. Does it mean that there is still
> no casting and I still have to write embedded c-code to get around? [...]

Yes, that is unfortunately correct.

- FChE

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2009-01-27 16:50 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-28 22:52 help needed to probe own modules Kai_Wong
2008-10-29  1:15 ` Frank Ch. Eigler
     [not found]   ` <1A193CCB5218B14589B1979BC7D510E006F0EB1E@TUS1XCHCLUPIN11.enterprise.veritas.com>
     [not found]     ` <20081029201826.GC16968@redhat.com>
     [not found]       ` <1A193CCB5218B14589B1979BC7D510E006F0ECBC@TUS1XCHCLUPIN11.enterprise.veritas.com>
     [not found]         ` <1A193CCB5218B14589B1979BC7D510E007077719@TUS1XCHCLUPIN11.enterprise.veritas.com>
     [not found]           ` <20081104152629.GB28139@redhat.com>
     [not found]             ` <1A193CCB5218B14589B1979BC7D510E0070F51F0@TUS1XCHCLUPIN12.enterprise.veritas.com>
     [not found]               ` <20081107020842.GG20928@redhat.com>
2009-01-02 22:30                 ` question regarding accessing a target variable Kai Wong
2009-01-03  1:00                   ` Frank Ch. Eigler
2009-01-03  1:30                 ` Kai Wong
2009-01-03 13:50                   ` Frank Ch. Eigler
2009-01-06  0:26                 ` Kai Wong
2009-01-24 14:27                 ` Kai Wong
2009-01-25  2:44                   ` Frank Ch. Eigler
     [not found]                 ` <1A193CCB5218B14589B1979BC7D510E00802FAFC@TUS1XCHCLUPIN12.enterprise.veritas.com>
2009-01-27 21:40                   ` Frank Ch. Eigler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).