This is a note to let you know that I've just added the patch titled
perf test: fix a build error on builtin-test
to the 3.4-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
perf-test-fix-a-build-error-on-builtin-test.patch
and it can be found in the queue-3.4 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <[email protected]> know about it.
>From 12f8f74b2a4d26c4facfa7ef99487cf0930f6ef7 Mon Sep 17 00:00:00 2001
From: Zheng Liu <[email protected]>
Date: Thu, 8 Nov 2012 16:58:46 -0800
Subject: perf test: fix a build error on builtin-test
From: Zheng Liu <[email protected]>
commit 12f8f74b2a4d26c4facfa7ef99487cf0930f6ef7 upstream.
Recently I build perf and get a build error on builtin-test.c. The error is as
following:
$ make
CC perf.o
CC builtin-test.o
cc1: warnings being treated as errors
builtin-test.c: In function âsched__get_first_possible_cpuâ:
builtin-test.c:977: warning: implicit declaration of function âCPU_ALLOCâ
builtin-test.c:977: warning: nested extern declaration of âCPU_ALLOCâ
builtin-test.c:977: warning: assignment makes pointer from integer without a
cast
builtin-test.c:978: warning: implicit declaration of function
âCPU_ALLOC_SIZEâ
builtin-test.c:978: warning: nested extern declaration of âCPU_ALLOC_SIZEâ
builtin-test.c:979: warning: implicit declaration of function âCPU_ZERO_Sâ
builtin-test.c:979: warning: nested extern declaration of âCPU_ZERO_Sâ
builtin-test.c:982: warning: implicit declaration of function âCPU_FREEâ
builtin-test.c:982: warning: nested extern declaration of âCPU_FREEâ
builtin-test.c:992: warning: implicit declaration of function âCPU_ISSET_Sâ
builtin-test.c:992: warning: nested extern declaration of âCPU_ISSET_Sâ
builtin-test.c:998: warning: implicit declaration of function âCPU_CLR_Sâ
builtin-test.c:998: warning: nested extern declaration of âCPU_CLR_Sâ
make: *** [builtin-test.o] Error 1
This problem is introduced in 3e7c439a. CPU_ALLOC and related macros are
missing in sched__get_first_possible_cpu function. In 54489c18, commiter
mentioned that CPU_ALLOC has been removed. So CPU_ALLOC calls in this
function are removed to let perf to be built.
Signed-off-by: Vinson Lee <[email protected]>
Signed-off-by: Zheng Liu <[email protected]>
Cc: David Ahern <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: Mike Galbraith <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Stephane Eranian <[email protected]>
Cc: Vinson Lee <[email protected]>
Cc: Zheng Liu <[email protected]>
Link:
http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
tools/perf/builtin-test.c | 38 ++++++++++++--------------------------
1 file changed, 12 insertions(+), 26 deletions(-)
--- a/tools/perf/builtin-test.c
+++ b/tools/perf/builtin-test.c
@@ -1154,19 +1154,13 @@ static int test__parse_events(void)
return ret;
}
-static int sched__get_first_possible_cpu(pid_t pid, cpu_set_t **maskp,
- size_t *sizep)
+static int sched__get_first_possible_cpu(pid_t pid, cpu_set_t *maskp)
{
- cpu_set_t *mask;
- size_t size;
int i, cpu = -1, nrcpus = 1024;
realloc:
- mask = CPU_ALLOC(nrcpus);
- size = CPU_ALLOC_SIZE(nrcpus);
- CPU_ZERO_S(size, mask);
+ CPU_ZERO(maskp);
- if (sched_getaffinity(pid, size, mask) == -1) {
- CPU_FREE(mask);
+ if (sched_getaffinity(pid, sizeof(*maskp), maskp) == -1) {
if (errno == EINVAL && nrcpus < (1024 << 8)) {
nrcpus = nrcpus << 2;
goto realloc;
@@ -1176,19 +1170,14 @@ realloc:
}
for (i = 0; i < nrcpus; i++) {
- if (CPU_ISSET_S(i, size, mask)) {
- if (cpu == -1) {
+ if (CPU_ISSET(i, maskp)) {
+ if (cpu == -1)
cpu = i;
- *maskp = mask;
- *sizep = size;
- } else
- CPU_CLR_S(i, size, mask);
+ else
+ CPU_CLR(i, maskp);
}
}
- if (cpu == -1)
- CPU_FREE(mask);
-
return cpu;
}
@@ -1199,8 +1188,8 @@ static int test__PERF_RECORD(void)
.freq = 10,
.mmap_pages = 256,
};
- cpu_set_t *cpu_mask = NULL;
- size_t cpu_mask_size = 0;
+ cpu_set_t cpu_mask;
+ size_t cpu_mask_size = sizeof(cpu_mask);
struct perf_evlist *evlist = perf_evlist__new(NULL, NULL);
struct perf_evsel *evsel;
struct perf_sample sample;
@@ -1265,8 +1254,7 @@ static int test__PERF_RECORD(void)
evsel->attr.sample_type |= PERF_SAMPLE_TIME;
perf_evlist__config_attrs(evlist, &opts);
- err = sched__get_first_possible_cpu(evlist->workload.pid, &cpu_mask,
- &cpu_mask_size);
+ err = sched__get_first_possible_cpu(evlist->workload.pid, &cpu_mask);
if (err < 0) {
pr_debug("sched__get_first_possible_cpu: %s\n",
strerror(errno));
goto out_delete_evlist;
@@ -1277,9 +1265,9 @@ static int test__PERF_RECORD(void)
/*
* So that we can check perf_sample.cpu on all the samples.
*/
- if (sched_setaffinity(evlist->workload.pid, cpu_mask_size, cpu_mask) <
0) {
+ if (sched_setaffinity(evlist->workload.pid, cpu_mask_size, &cpu_mask) <
0) {
pr_debug("sched_setaffinity: %s\n", strerror(errno));
- goto out_free_cpu_mask;
+ goto out_delete_evlist;
}
/*
@@ -1472,8 +1460,6 @@ found_exit:
}
out_err:
perf_evlist__munmap(evlist);
-out_free_cpu_mask:
- CPU_FREE(cpu_mask);
out_delete_evlist:
perf_evlist__delete(evlist);
out:
Patches currently in stable-queue which might be from [email protected] are
queue-3.4/perf-test-fix-a-build-error-on-builtin-test.patch
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html