public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* RE: [PATCH]_stp_free_percpu function definition responding to _stp_alloc_percpu
@ 2006-10-18  0:05 Keshavamurthy, Anil S
  2006-10-18  4:09 ` bibo,mao
  0 siblings, 1 reply; 3+ messages in thread
From: Keshavamurthy, Anil S @ 2006-10-18  0:05 UTC (permalink / raw)
  To: Mao, Bibo, systemtap

Will this not break the older kernels? 

How can systemtap makes sure that it is 
backward compatible while supporting newer kernels?


-Anil Keshavamurthy
Open Source Technology Center/SSG
Intel Corp.

-----Original Message-----
From: systemtap-owner@sourceware.org
[mailto:systemtap-owner@sourceware.org] On Behalf Of bibo,mao
Sent: Monday, October 16, 2006 4:08 AM
To: systemtap@sourceware.org
Subject: [PATCH]_stp_free_percpu function definition responding to
_stp_alloc_percpu

Hi,
   On the newest 2.6.19-rc2 smp machines, stap fails to run. It
is because _stp_free_percpu is defined as free_percpu macro and
one function at the same time. This patch modifies this, and
replaces for_each_cpu with for_each_possible_cpu macro.

thanks
bibo,mao

--- src.org/runtime/alloc.c	2006-01-25 18:08:47.000000000 +0800
+++ src/runtime/alloc.c	2006-10-16 18:17:40.000000000 +0800
@@ -18,14 +18,9 @@
  #define kmalloc_node(size,flags,node) kmalloc(size,flags)
  #endif /* LINUX_VERSION_CODE */

-#ifdef CONFIG_SMP
-#define _stp_free_percpu(ptr) free_percpu(ptr)
-#else
-#define _stp_free_percpu(ptr) kfree(ptr)
-#endif
-
  #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15)
  #define _stp_alloc_percpu(size) __alloc_percpu(size, 8)
+#define _stp_free_percpu(ptr) free_percpu(ptr)
  #else
  #ifdef CONFIG_SMP
  /* This is like alloc_percpu() except it simply takes a size, instead 
of a type. */
@@ -37,7 +32,7 @@ void *_stp_alloc_percpu(size_t size)
  	if (!pdata)
  		return NULL;

-	for_each_cpu(i) {
+	for_each_possible_cpu(i) {
  		int node = cpu_to_node(i);

  		if (node_online(node))
@@ -68,7 +63,7 @@ void _stp_free_percpu(const void *objp)
  	int i;
  	struct percpu_data *p = (struct percpu_data *) (~(unsigned long)
objp);

-	for_each_cpu(i)
+	for_each_possible_cpu(i)
  		kfree(p->ptrs[i]);
  	kfree(p);
  }
@@ -80,6 +75,7 @@ void *_stp_alloc_percpu(size_t size)
                  memset(ret, 0, size);
          return ret;
  }
+#define _stp_free_percpu(ptr) kfree(ptr)
  #endif /* CONFIG_SMP */
  #endif /* LINUX_VERSION_CODE */
  #endif /* _ALLOC_C_ */

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

* Re: [PATCH]_stp_free_percpu function definition responding to _stp_alloc_percpu
  2006-10-18  0:05 [PATCH]_stp_free_percpu function definition responding to _stp_alloc_percpu Keshavamurthy, Anil S
@ 2006-10-18  4:09 ` bibo,mao
  0 siblings, 0 replies; 3+ messages in thread
From: bibo,mao @ 2006-10-18  4:09 UTC (permalink / raw)
  To: Keshavamurthy, Anil S; +Cc: systemtap

ooooh, this patch will break the older kernels,
for_each_possible_cpu macro is not defined before 2.6.16
version, but modification about _stp_free_percpu does not
break the older kernels. I verified it on 2.6.9 smp kernel
version.

thanks
bibo,mao

Keshavamurthy, Anil S wrote:
> Will this not break the older kernels? 
> 
> How can systemtap makes sure that it is 
> backward compatible while supporting newer kernels?
> 
> 
> -Anil Keshavamurthy
> Open Source Technology Center/SSG
> Intel Corp.
> 
> -----Original Message-----
> From: systemtap-owner@sourceware.org
> [mailto:systemtap-owner@sourceware.org] On Behalf Of bibo,mao
> Sent: Monday, October 16, 2006 4:08 AM
> To: systemtap@sourceware.org
> Subject: [PATCH]_stp_free_percpu function definition responding to
> _stp_alloc_percpu
> 
> Hi,
>    On the newest 2.6.19-rc2 smp machines, stap fails to run. It
> is because _stp_free_percpu is defined as free_percpu macro and
> one function at the same time. This patch modifies this, and
> replaces for_each_cpu with for_each_possible_cpu macro.
> 
> thanks
> bibo,mao
> 
> --- src.org/runtime/alloc.c	2006-01-25 18:08:47.000000000 +0800
> +++ src/runtime/alloc.c	2006-10-16 18:17:40.000000000 +0800
> @@ -18,14 +18,9 @@
>   #define kmalloc_node(size,flags,node) kmalloc(size,flags)
>   #endif /* LINUX_VERSION_CODE */
> 
> -#ifdef CONFIG_SMP
> -#define _stp_free_percpu(ptr) free_percpu(ptr)
> -#else
> -#define _stp_free_percpu(ptr) kfree(ptr)
> -#endif
> -
>   #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15)
>   #define _stp_alloc_percpu(size) __alloc_percpu(size, 8)
> +#define _stp_free_percpu(ptr) free_percpu(ptr)
>   #else
>   #ifdef CONFIG_SMP
>   /* This is like alloc_percpu() except it simply takes a size, instead 
> of a type. */
> @@ -37,7 +32,7 @@ void *_stp_alloc_percpu(size_t size)
>   	if (!pdata)
>   		return NULL;
> 
> -	for_each_cpu(i) {
> +	for_each_possible_cpu(i) {
>   		int node = cpu_to_node(i);
> 
>   		if (node_online(node))
> @@ -68,7 +63,7 @@ void _stp_free_percpu(const void *objp)
>   	int i;
>   	struct percpu_data *p = (struct percpu_data *) (~(unsigned long)
> objp);
> 
> -	for_each_cpu(i)
> +	for_each_possible_cpu(i)
>   		kfree(p->ptrs[i]);
>   	kfree(p);
>   }
> @@ -80,6 +75,7 @@ void *_stp_alloc_percpu(size_t size)
>                   memset(ret, 0, size);
>           return ret;
>   }
> +#define _stp_free_percpu(ptr) kfree(ptr)
>   #endif /* CONFIG_SMP */
>   #endif /* LINUX_VERSION_CODE */
>   #endif /* _ALLOC_C_ */

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

* [PATCH]_stp_free_percpu function definition responding to _stp_alloc_percpu
@ 2006-10-16 11:08 bibo,mao
  0 siblings, 0 replies; 3+ messages in thread
From: bibo,mao @ 2006-10-16 11:08 UTC (permalink / raw)
  To: systemtap

Hi,
   On the newest 2.6.19-rc2 smp machines, stap fails to run. It
is because _stp_free_percpu is defined as free_percpu macro and
one function at the same time. This patch modifies this, and
replaces for_each_cpu with for_each_possible_cpu macro.

thanks
bibo,mao

--- src.org/runtime/alloc.c	2006-01-25 18:08:47.000000000 +0800
+++ src/runtime/alloc.c	2006-10-16 18:17:40.000000000 +0800
@@ -18,14 +18,9 @@
  #define kmalloc_node(size,flags,node) kmalloc(size,flags)
  #endif /* LINUX_VERSION_CODE */

-#ifdef CONFIG_SMP
-#define _stp_free_percpu(ptr) free_percpu(ptr)
-#else
-#define _stp_free_percpu(ptr) kfree(ptr)
-#endif
-
  #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15)
  #define _stp_alloc_percpu(size) __alloc_percpu(size, 8)
+#define _stp_free_percpu(ptr) free_percpu(ptr)
  #else
  #ifdef CONFIG_SMP
  /* This is like alloc_percpu() except it simply takes a size, instead 
of a type. */
@@ -37,7 +32,7 @@ void *_stp_alloc_percpu(size_t size)
  	if (!pdata)
  		return NULL;

-	for_each_cpu(i) {
+	for_each_possible_cpu(i) {
  		int node = cpu_to_node(i);

  		if (node_online(node))
@@ -68,7 +63,7 @@ void _stp_free_percpu(const void *objp)
  	int i;
  	struct percpu_data *p = (struct percpu_data *) (~(unsigned long) objp);

-	for_each_cpu(i)
+	for_each_possible_cpu(i)
  		kfree(p->ptrs[i]);
  	kfree(p);
  }
@@ -80,6 +75,7 @@ void *_stp_alloc_percpu(size_t size)
                  memset(ret, 0, size);
          return ret;
  }
+#define _stp_free_percpu(ptr) kfree(ptr)
  #endif /* CONFIG_SMP */
  #endif /* LINUX_VERSION_CODE */
  #endif /* _ALLOC_C_ */

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

end of thread, other threads:[~2006-10-18  4:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-10-18  0:05 [PATCH]_stp_free_percpu function definition responding to _stp_alloc_percpu Keshavamurthy, Anil S
2006-10-18  4:09 ` bibo,mao
  -- strict thread matches above, loose matches on Subject: below --
2006-10-16 11:08 bibo,mao

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).