public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: fche@redhat.com (Frank Ch. Eigler)
To: Rajasekhar Duddu <rajduddu@linux.vnet.ibm.com>
Cc: systemtap@sources.redhat.com
Subject: Re: [PATCH v3] Tracepoint Tapset for Memory Subsystem
Date: Tue, 06 Oct 2009 19:01:00 -0000	[thread overview]
Message-ID: <y0mocokgxe2.fsf@fche.csb> (raw)
In-Reply-To: <20091002151344.GA9516@rajduddu> (Rajasekhar Duddu's message of "Fri, 2 Oct 2009 20:43:44 +0530")

Rajasekhar Duddu <rajduddu@linux.vnet.ibm.com> writes:

> [...]
> +/* Function to convert the GFP_FLAGS . */
> +
> +function gfp_flag_str:string (gfp_flag:long)
> +%{
> +int flags = (int)THIS->gfp_flag;
> +THIS->__retvalue[0] = '\0';
> +
> +#ifdef __GFP_HIGH
> +        if (flags & __GFP_HIGH)
> +                strlcat (THIS->__retvalue, "GFP_HIGH",MAXSTRINGLEN);
> +#endif
> +
> +#ifdef __GFP_WAIT
> +        if (flags & __GFP_WAIT)
> +                strlcat (THIS->__retvalue, "GFP_WAIT",MAXSTRINGLEN);
> +#endif
> +
> +#ifdef __GFP_IO
> +        if (flags & __GFP_IO)
> +                strlcat (THIS->__retvalue, "|GFP_IO",MAXSTRINGLEN);
> +#endif

Why no "|" before GFP_HIGH/GFP_WAIT?
Also, why no "__" before the stringified version?


> +#ifdef __GFP_FS
> +        if (flags & __GFP_FS)
> +                strlcat (THIS->__retvalue, "|GFP_FS",MAXSTRINGLEN);
> +#endif

(How about a macro to generate all these near-identical branches?)


> +%}


> +/**
> + * probe vm.kmalloc - Fires when <command>kmalloc</command> is requested.
> + * @call_site: Address of the caller function.
> + * @caller_function: Name of the caller function.
> + * @bytes_req: Requested Bytes
> + * @bytes_alloc: Allocated Bytes
> + * @gfp_flags: type of kmemory to allocate
> + * @ptr: Pointer to the kmemory allocated
> + */
> +
> +probe vm.kmalloc = kernel.trace("kmalloc") {
> +	name = "kmalloc"
> +	call_site = $call_site
> +	caller_function = symname(call_site)
> +	bytes_req = $bytes_req
> +	bytes_alloc = $bytes_alloc
> +	gfp_flags = gfp_flag_str($gfp_flags)
> +	ptr = $ptr
> +}

Nice.  I thought that the raison d'etre for these aliases was to
abstract the presence or absence of tracepoints, so is there no
fallback kprobe available?  Something like this:


> +probe __vm.kfree.kp = kernel.function("kfree") {
> +	name = "kfree"
> +	call_site = "0"

(Note though that this will fail type checking on a non-tracepoint
kernel -- have you tried it? -- it should be just 0 instead of "0".)

> +	caller_function = "unknown"
> +	ptr = $x
> +}
> +
> +probe __vm.kfree.tp = kernel.trace("kfree") {
> +	name = "kfree"
> +	call_site = $call_site
> +	caller_function = symname(call_site)
> +	ptr = $ptr
> +}
> +
> +/**
> + * probe vm.kfree - Fires when <command>kfree</comand> is requested.
> + * @call_site: Address of the caller function (displayed if available)
> + * @caller_function - Name of the caller function (displayed if available)
> + * @ptr: Pointer to the kmemory allocated which is returned by kmalloc
> + */
> +probe vm.kfree = __vm.kfree.tp !,
> +		   __vm.kfree.kp
> +{}

Right.


> +/**
> + * probe vm.kmalloc_node - Fires when <command>kmalloc_node</command> is requested.
> + * @call_site: Address of the caller function.
> + * @caller_function: Name of the caller function.
> + * @bytes_req: Requested Bytes
> + * @bytes_alloc: Allocated Bytes
> + * @gfp_flags: Type of kmemory to allocate
> + * @ptr: Pointer to the kmemory allocated
> + */

Please, no "<command>" markup in there, it is not valid.


> +probe vm.kmalloc_node = kernel.trace("kmalloc_node")? {
> [...]

Why is this marked with "?"?


> --- a/testsuite/buildok/vm.tracepoints.stp	1969-12-31 19:00:00.000000000 -0500
> +++ b/testsuite/buildok/vm.tracepoints.stp	2009-10-02 10:59:20.000000000 -0400
> @@ -0,0 +1,32 @@
> +#!/usr/bin/stp -up4

Other similar test cases just use

#! stap -up4



- FChE

  reply	other threads:[~2009-10-06 19:01 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-19  5:01 [PATCH] " Rajasekhar Duddu
2009-09-22 17:39 ` David Smith
2009-09-22 21:23   ` Frank Ch. Eigler
2009-09-22 22:05     ` David Smith
2009-09-24 18:08       ` [PATCH v2] " Rajasekhar Duddu
2009-09-25 19:19         ` David Smith
2009-09-25 20:07           ` Frank Ch. Eigler
2009-09-28 18:12           ` Jim Keniston
2009-09-29  8:58             ` K.Prasad
2009-09-25 21:50         ` Josh Stone
2009-09-30 10:12           ` Rajasekhar Duddu
2009-10-02 15:14             ` [PATCH v3] " Rajasekhar Duddu
2009-10-06 19:01               ` Frank Ch. Eigler [this message]
2009-10-07 13:07                 ` Rajasekhar Duddu
2009-10-07 19:51                   ` Frank Ch. Eigler
2009-10-09 17:08                     ` Rajasekhar Duddu
2009-10-09 17:38                       ` Frank Ch. Eigler
2009-10-14  8:32                         ` Rajasekhar Duddu
2009-11-09  7:10 [PATCH V3] " Rajasekhar Duddu
2009-11-09 17:02 ` Frank Ch. Eigler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=y0mocokgxe2.fsf@fche.csb \
    --to=fche@redhat.com \
    --cc=rajduddu@linux.vnet.ibm.com \
    --cc=systemtap@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).