This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix the conflicted for_each_cpu macro with 2.6.28-rc4


This patch will change for_each_cpu macro definition to avoid
name collusion in 2.6.28-rc4. See mainline commit:
cb56d98e2a7530615899597551db685d68a2e852.

---
 runtime/counter.c          |    4 ++--
 runtime/map-stat.c         |    4 ++--
 runtime/map.c              |   14 +++++++-------
 runtime/pmap-gen.c         |    6 +++---
 runtime/runtime.h          |   10 ++++++++--
 runtime/stat.c             |    6 +++---
 runtime/transport/procfs.c |    6 +++---
 7 files changed, 28 insertions(+), 22 deletions(-)

diff --git a/runtime/counter.c b/runtime/counter.c
index d037654..a3c3669 100644
--- a/runtime/counter.c
+++ b/runtime/counter.c
@@ -58,7 +58,7 @@ Counter _stp_counter_init (void)
 #if NEED_COUNTER_LOCKS == 1
 	{
 		int i;
-		for_each_cpu(i) {
+		stp_for_each_cpu(i) {
 			Counter c = per_cpu_ptr (cnt, i);
 			spin_lock_init(c->lock);
 		}
@@ -119,7 +119,7 @@ int64_t _stp_counter_get (Counter cnt, int clear)
 	int i;
 	int64_t sum = 0;

- for_each_cpu(i) {
+ stp_for_each_cpu(i) {
Counter c = per_cpu_ptr (cnt, i);
COUNTER_LOCK(c);
sum += c->count;
diff --git a/runtime/map-stat.c b/runtime/map-stat.c
index dc3fd6a..c557d18 100644
--- a/runtime/map-stat.c
+++ b/runtime/map-stat.c
@@ -68,7 +68,7 @@ static PMAP _stp_pmap_new_hstat_linear (unsigned max_entries, int ksize, int sta
if (pmap) {
int i;
MAP m;
- for_each_cpu(i) {
+ stp_for_each_cpu(i) {
m = (MAP)per_cpu_ptr (pmap->map, i);
m->hist.type = HIST_LINEAR;
m->hist.start = start;
@@ -95,7 +95,7 @@ static PMAP _stp_pmap_new_hstat_log (unsigned max_entries, int key_size)
if (pmap) {
int i;
MAP m;
- for_each_cpu(i) {
+ stp_for_each_cpu(i) {
m = (MAP)per_cpu_ptr (pmap->map, i);
m->hist.type = HIST_LOG;
m->hist.buckets = HIST_LOG_BUCKETS;
diff --git a/runtime/map.c b/runtime/map.c
index bb221cd..5108e59 100644
--- a/runtime/map.c
+++ b/runtime/map.c
@@ -250,7 +250,7 @@ static PMAP _stp_pmap_new(unsigned max_entries, int type, int key_size, int data


/* initialize the memory lists first so if allocations fail */
/* at some point, it is easy to clean up. */
- for_each_cpu(i) {
+ stp_for_each_cpu(i) {
m = per_cpu_ptr (map, i);
INIT_LIST_HEAD(&m->pool);
INIT_LIST_HEAD(&m->head);
@@ -258,7 +258,7 @@ static PMAP _stp_pmap_new(unsigned max_entries, int type, int key_size, int data
INIT_LIST_HEAD(&pmap->agg.pool);
INIT_LIST_HEAD(&pmap->agg.head);


- for_each_cpu(i) {
+ stp_for_each_cpu(i) {
m = per_cpu_ptr (map, i);
if (_stp_map_init(m, max_entries, type, key_size, data_size, i)) {
goto err1;
@@ -271,7 +271,7 @@ static PMAP _stp_pmap_new(unsigned max_entries, int type, int key_size, int data
return pmap;


 err1:
-	for_each_cpu(i) {
+	stp_for_each_cpu(i) {
 		m = per_cpu_ptr (map, i);
 		__stp_map_del(m);
 	}
@@ -358,7 +358,7 @@ void _stp_pmap_clear(PMAP pmap)
 	if (pmap == NULL)
 		return;

-	for_each_cpu(i) {
+	stp_for_each_cpu(i) {
 		MAP m = per_cpu_ptr (pmap->map, i);
 #if NEED_MAP_LOCKS
 		spin_lock(&m->lock);
@@ -410,7 +410,7 @@ void _stp_pmap_del(PMAP pmap)
 	if (pmap == NULL)
 		return;

-	for_each_cpu(i) {
+	stp_for_each_cpu(i) {
 		MAP m = per_cpu_ptr (pmap->map, i);
 		__stp_map_del(m);
 	}
@@ -740,7 +740,7 @@ MAP _stp_pmap_agg (PMAP pmap)
 	/* every time we aggregate. which would be best? */
 	_stp_map_clear (agg);

-	for_each_cpu(i) {
+	stp_for_each_cpu(i) {
 		m = per_cpu_ptr (pmap->map, i);
 #if NEED_MAP_LOCKS
 		spin_lock(&m->lock);
@@ -916,7 +916,7 @@ int _stp_pmap_size (PMAP pmap)
 {
 	int i, num = 0;

- for_each_cpu(i) {
+ stp_for_each_cpu(i) {
MAP m = per_cpu_ptr (pmap->map, i);
num += m->num;
}
diff --git a/runtime/pmap-gen.c b/runtime/pmap-gen.c
index 8666549..7f7ddeb 100644
--- a/runtime/pmap-gen.c
+++ b/runtime/pmap-gen.c
@@ -406,7 +406,7 @@ PMAP KEYSYM(_stp_pmap_new) (unsigned max_entries)
if (pmap) {
int i;
MAP m;
- for_each_cpu(i) {
+ stp_for_each_cpu(i) {
m = (MAP)per_cpu_ptr (pmap->map, i);
m->get_key = KEYSYM(pmap_get_key);
m->copy = KEYSYM(pmap_copy_keys);
@@ -459,7 +459,7 @@ PMAP KEYSYM(_stp_pmap_new) (unsigned max_entries, int htype, ...)
if (pmap) {
int i;
MAP m;
- for_each_cpu(i) {
+ stp_for_each_cpu(i) {
m = per_cpu_ptr (pmap->map, i);
m->get_key = KEYSYM(pmap_get_key);
m->copy = KEYSYM(pmap_copy_keys);
@@ -649,7 +649,7 @@ VALTYPE KEYSYM(_stp_pmap_get) (PMAP pmap, ALLKEYSD(key))
}


 	/* now total each cpu */
-	for_each_cpu(cpu) {
+	stp_for_each_cpu(cpu) {
 		map = per_cpu_ptr (pmap->map, cpu);
 		head = &map->hashes[hv];

diff --git a/runtime/runtime.h b/runtime/runtime.h
index cd3d0b1..7507e59 100644
--- a/runtime/runtime.h
+++ b/runtime/runtime.h
@@ -39,8 +39,14 @@
 #define STP_OLD_TRANSPORT
 #endif

-#ifndef for_each_cpu
-#define for_each_cpu(cpu)  for_each_cpu_mask((cpu), cpu_possible_map)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28)
+#ifndef stp_for_each_cpu
+#define stp_for_each_cpu(cpu)  for_each_cpu((cpu), cpu_possible_map)
+#endif
+#else
+#ifndef stp_for_each_cpu
+#define stp_for_each_cpu(cpu)  for_each_cpu_mask((cpu), cpu_possible_map)
+#endif
 #endif

 static void _stp_dbug (const char *func, int line, const char *fmt, ...);
diff --git a/runtime/stat.c b/runtime/stat.c
index 8bd7bf1..e40a4f2 100644
--- a/runtime/stat.c
+++ b/runtime/stat.c
@@ -109,7 +109,7 @@ Stat _stp_stat_init (int type, ...)
 #if NEED_STAT_LOCKS == 1
 	{
 		int i;
-		for_each_cpu(i) {
+		stp_for_each_cpu(i) {
 			stat *sdp = per_cpu_ptr (sd, i);
 			spin_lock_init(sdp->lock);
 		}
@@ -210,7 +210,7 @@ stat *_stp_stat_get (Stat st, int clear)
 	STAT_LOCK(agg);
 	_stp_stat_clear_data (st, agg);

-	for_each_cpu(i) {
+	stp_for_each_cpu(i) {
 		stat *sd = per_cpu_ptr (st->sd, i);
 		STAT_LOCK(sd);
 		if (sd->count) {
@@ -245,7 +245,7 @@ stat *_stp_stat_get (Stat st, int clear)
 void _stp_stat_clear (Stat st)
 {
 	int i;
-	for_each_cpu(i) {
+	stp_for_each_cpu(i) {
 		stat *sd = per_cpu_ptr (st->sd, i);
 		STAT_LOCK(sd);
 		_stp_stat_clear_data (st, sd);
diff --git a/runtime/transport/procfs.c b/runtime/transport/procfs.c
index e0ecd9b..ca33e0f 100644
--- a/runtime/transport/procfs.c
+++ b/runtime/transport/procfs.c
@@ -328,7 +328,7 @@ static int _stp_register_ctl_channel(void)

 #ifdef STP_BULKMODE
 	/* now for each cpu "n", create /proc/systemtap/module_name/n  */
-	for_each_cpu(i) {
+	stp_for_each_cpu(i) {
 		sprintf(buf, "%d", i);
 		de = create_proc_entry(buf, 0600, _stp_proc_root);
 		if (de == NULL)
@@ -361,7 +361,7 @@ err1:
 #ifdef STP_BULKMODE
 	for (de = _stp_proc_root->subdir; de; de = de->next)
 		_stp_kfree(de->data);
-	for_each_cpu(j) {
+	stp_for_each_cpu(j) {
 		if (j == i)
 			break;
 		sprintf(buf, "%d", j);
@@ -389,7 +389,7 @@ static void _stp_unregister_ctl_channel(void)
 	for (de = _stp_proc_root->subdir; de; de = de->next)
 		_stp_kfree(de->data);

-	for_each_cpu(i) {
+	stp_for_each_cpu(i) {
 		sprintf(buf, "%d", i);
 		remove_proc_entry(buf, _stp_proc_root);
 	}
--
1.5.6


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]