From 11c015d84facc299ebcb12771ccda1975333a6bc Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Tue, 29 Dec 2009 21:05:55 +0100 Subject: Fixup some memory tapset vm kernel function probe fallbacks. Older kernels don't have all GFP constants defined, and the fallback kernel function probe fallbacks don't have the same dwarf variable names as the kernel trace point probes. So replace them with variables that are available. bytes_alloc was sometimes a long and sometimes a string, this caused scripts to fail depending on which alternative was chosen for a particular kernel. So make it a long always. This isn't a full solution since kmalloc is always inlined which makes the kernel.function("kmalloc").return probe fail. * tapset/memory.stp: Define __GFP_THISNODE, __GFP_RECLAIMABLE, GFP_TEMPORARY, GFP_HIGHUSER_MOVABLE and GFP_THISNODE when not yet defined. (__vm.kmalloc.kp): Use $flags, not $gfp_flags. Set bytes_alloc equal to bytes_req. (__vm.kmem_cache_alloc.kp): Likewise. And use $cachep->buffer_size for bytes_req. (__vm.kmalloc_node.kp): Likewise. (__vm.kmem_cache_alloc_node.kp): Likewise. (__vm.kfree.kp): Use $ibjp for ptr, not $return. (__vm.kmem_cache_free.kp): Likewise. * testsuite/buildok/vm.tracepoints.stp: Move vm.kmalloc test to... * testsuite/buildok/vm.tracepoints.kmalloc.stp: ... here. --- tapset/memory.stp | 59 ++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 43 insertions(+), 16 deletions(-) (limited to 'tapset/memory.stp') diff --git a/tapset/memory.stp b/tapset/memory.stp index bd71a386..c170c5c7 100644 --- a/tapset/memory.stp +++ b/tapset/memory.stp @@ -217,6 +217,33 @@ function __gfp_flag_str:string(gfp_flag:long) %{ #endif #endif +#ifndef __GFP_THISNODE +#define __GFP_THISNODE ((__force gfp_t)0x40000u) +#endif + +#ifndef __GFP_RECLAIMABLE +#define __GFP_RECLAIMABLE ((__force gfp_t)0x80000u) +#endif + +#ifndef GFP_TEMPORARY +#define GFP_TEMPORARY (__GFP_WAIT | __GFP_IO | __GFP_FS | \ + __GFP_RECLAIMABLE) +#endif + +#ifndef GFP_HIGHUSER_MOVABLE +#define GFP_HIGHUSER_MOVABLE (__GFP_WAIT | __GFP_IO | __GFP_FS | \ + __GFP_HARDWALL | __GFP_HIGHMEM | \ + __GFP_MOVABLE) +#endif + +#ifndef GFP_THISNODE +#ifdef CONFIG_NUMA +#define GFP_THISNODE (__GFP_THISNODE | __GFP_NOWARN | __GFP_NORETRY) +#else +#define GFP_THISNODE ((__force gfp_t)0) +#endif +#endif + /* Macro for GFP Bitmasks. */ /* The resulted GFP_FLAGS may be either single or concatenation of the multiple bitmasks. */ @@ -298,9 +325,9 @@ probe __vm.kmalloc.kp = kernel.function("kmalloc").return { call_site = 0 caller_function = "unknown" bytes_req = $size - bytes_alloc = "unknown" - gfp_flags = $gfp_flags - gfp_flag_name = __gfp_flag_str($gfp_flags) + bytes_alloc = bytes_req // pretend they are always the same + gfp_flags = $flags + gfp_flag_name = __gfp_flag_str(gfp_flags) ptr = $return } @@ -334,10 +361,10 @@ probe __vm.kmem_cache_alloc.kp = kernel.function("kmem_cache_alloc").return { name = "kmem_cache_alloc" call_site = 0 caller_function = "unknown" - bytes_req = $size - bytes_alloc = "unknown" - gfp_flags = $gfp_flags - gfp_flag_name = __gfp_flag_str($gfp_flags) + bytes_req = $cachep->buffer_size + bytes_alloc = bytes_req // pretend they are always the same + gfp_flags = $flags + gfp_flag_name = __gfp_flag_str(gfp_flags) ptr = $return } @@ -373,9 +400,9 @@ probe __vm.kmalloc_node.kp = kernel.function("kmalloc_node").return? { call_site = 0 caller_function = "unknown" bytes_req = $size - bytes_alloc = "unknown" - gfp_flags = $gfp_flags - gfp_flag_name = __gfp_flag_str($gfp_flags) + bytes_alloc = bytes_req // pretend they are always the same + gfp_flags = $flags + gfp_flag_name = __gfp_flag_str(gfp_flags) ptr = $return } @@ -408,10 +435,10 @@ probe __vm.kmem_cache_alloc_node.kp = kernel.function("kmem_cache_alloc_node").r name = "kmem_cache_alloc_node" call_site = 0 caller_function = "unknown" - bytes_req = $size - bytes_alloc = "unknown" - gfp_flags = $gfp_flags - gfp_flag_name = __gfp_flag_str($gfp_flags) + bytes_req = $cachep->buffer_size + bytes_alloc = bytes_req // pretend they are always the same + gfp_flags = $flags + gfp_flag_name = __gfp_flag_str(gfp_flags) ptr = $return } @@ -442,7 +469,7 @@ probe __vm.kfree.kp = kernel.function("kfree").return { name = "kfree" call_site = 0 caller_function = "unknown" - ptr = $return + ptr = $objp } /** @@ -465,7 +492,7 @@ probe __vm.kmem_cache_free.kp = kernel.function("kmem_cache_free").return { name = "kmem_cache_free" call_site = 0 caller_function = "unknown" - ptr = $return + ptr = $objp } /** * probe vm.kmem_cache_free - Fires when \ -- cgit