From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8848 invoked by alias); 6 Oct 2009 19:01:20 -0000 Received: (qmail 8645 invoked by uid 22791); 6 Oct 2009 19:01:18 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 06 Oct 2009 19:01:14 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n96J1CYe027430 for ; Tue, 6 Oct 2009 15:01:12 -0400 Received: from fche.csb (vpn-240-19.phx2.redhat.com [10.3.240.19]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n96J19Ji024971; Tue, 6 Oct 2009 15:01:12 -0400 Received: by fche.csb (Postfix, from userid 2569) id 52B8D58462; Tue, 6 Oct 2009 15:01:09 -0400 (EDT) To: Rajasekhar Duddu Cc: systemtap@sources.redhat.com Subject: Re: [PATCH v3] Tracepoint Tapset for Memory Subsystem References: <20090919050102.GA3767@rajduddu> <4AB90BE0.4030405@redhat.com> <4AB94A1B.4090801@redhat.com> <20090924180817.GA9698@rajduddu> <4ABD3B2B.4020107@redhat.com> <20090930101156.GA3792@rajduddu> <20091002151344.GA9516@rajduddu> From: fche@redhat.com (Frank Ch. Eigler) Date: Tue, 06 Oct 2009 19:01:00 -0000 In-Reply-To: <20091002151344.GA9516@rajduddu> (Rajasekhar Duddu's message of "Fri, 2 Oct 2009 20:43:44 +0530") Message-ID: User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Mailing-List: contact systemtap-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: systemtap-owner@sourceware.org X-SW-Source: 2009-q4/txt/msg00066.txt.bz2 Rajasekhar Duddu 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 kmalloc 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 kfree 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 kmalloc_node 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 "" 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