You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
perf test: fix a build error on builtin-test
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 <vlee@twitter.com>
Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Vinson Lee <vlee@twitter.com>
Cc: Zheng Liu <wenqing.lz@taobao.com>
Cc: stable@vger.kernel.org
Link: http://lkml.kernel.org/r/1352422726-31114-1-git-send-email-vlee@twitter.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
committed by
Arnaldo Carvalho de Melo
parent
69d2591a82
commit
12f8f74b2a
@@ -605,19 +605,13 @@ out_free_threads:
|
|||||||
#undef nsyscalls
|
#undef nsyscalls
|
||||||
}
|
}
|
||||||
|
|
||||||
static int sched__get_first_possible_cpu(pid_t pid, cpu_set_t **maskp,
|
static int sched__get_first_possible_cpu(pid_t pid, cpu_set_t *maskp)
|
||||||
size_t *sizep)
|
|
||||||
{
|
{
|
||||||
cpu_set_t *mask;
|
|
||||||
size_t size;
|
|
||||||
int i, cpu = -1, nrcpus = 1024;
|
int i, cpu = -1, nrcpus = 1024;
|
||||||
realloc:
|
realloc:
|
||||||
mask = CPU_ALLOC(nrcpus);
|
CPU_ZERO(maskp);
|
||||||
size = CPU_ALLOC_SIZE(nrcpus);
|
|
||||||
CPU_ZERO_S(size, mask);
|
|
||||||
|
|
||||||
if (sched_getaffinity(pid, size, mask) == -1) {
|
if (sched_getaffinity(pid, sizeof(*maskp), maskp) == -1) {
|
||||||
CPU_FREE(mask);
|
|
||||||
if (errno == EINVAL && nrcpus < (1024 << 8)) {
|
if (errno == EINVAL && nrcpus < (1024 << 8)) {
|
||||||
nrcpus = nrcpus << 2;
|
nrcpus = nrcpus << 2;
|
||||||
goto realloc;
|
goto realloc;
|
||||||
@@ -627,19 +621,14 @@ realloc:
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < nrcpus; i++) {
|
for (i = 0; i < nrcpus; i++) {
|
||||||
if (CPU_ISSET_S(i, size, mask)) {
|
if (CPU_ISSET(i, maskp)) {
|
||||||
if (cpu == -1) {
|
if (cpu == -1)
|
||||||
cpu = i;
|
cpu = i;
|
||||||
*maskp = mask;
|
else
|
||||||
*sizep = size;
|
CPU_CLR(i, maskp);
|
||||||
} else
|
|
||||||
CPU_CLR_S(i, size, mask);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cpu == -1)
|
|
||||||
CPU_FREE(mask);
|
|
||||||
|
|
||||||
return cpu;
|
return cpu;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -654,8 +643,8 @@ static int test__PERF_RECORD(void)
|
|||||||
.freq = 10,
|
.freq = 10,
|
||||||
.mmap_pages = 256,
|
.mmap_pages = 256,
|
||||||
};
|
};
|
||||||
cpu_set_t *cpu_mask = NULL;
|
cpu_set_t cpu_mask;
|
||||||
size_t cpu_mask_size = 0;
|
size_t cpu_mask_size = sizeof(cpu_mask);
|
||||||
struct perf_evlist *evlist = perf_evlist__new(NULL, NULL);
|
struct perf_evlist *evlist = perf_evlist__new(NULL, NULL);
|
||||||
struct perf_evsel *evsel;
|
struct perf_evsel *evsel;
|
||||||
struct perf_sample sample;
|
struct perf_sample sample;
|
||||||
@@ -719,8 +708,7 @@ static int test__PERF_RECORD(void)
|
|||||||
evsel->attr.sample_type |= PERF_SAMPLE_TIME;
|
evsel->attr.sample_type |= PERF_SAMPLE_TIME;
|
||||||
perf_evlist__config_attrs(evlist, &opts);
|
perf_evlist__config_attrs(evlist, &opts);
|
||||||
|
|
||||||
err = sched__get_first_possible_cpu(evlist->workload.pid, &cpu_mask,
|
err = sched__get_first_possible_cpu(evlist->workload.pid, &cpu_mask);
|
||||||
&cpu_mask_size);
|
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
pr_debug("sched__get_first_possible_cpu: %s\n", strerror(errno));
|
pr_debug("sched__get_first_possible_cpu: %s\n", strerror(errno));
|
||||||
goto out_delete_evlist;
|
goto out_delete_evlist;
|
||||||
@@ -731,9 +719,9 @@ static int test__PERF_RECORD(void)
|
|||||||
/*
|
/*
|
||||||
* So that we can check perf_sample.cpu on all the samples.
|
* 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));
|
pr_debug("sched_setaffinity: %s\n", strerror(errno));
|
||||||
goto out_free_cpu_mask;
|
goto out_delete_evlist;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -917,8 +905,6 @@ found_exit:
|
|||||||
}
|
}
|
||||||
out_err:
|
out_err:
|
||||||
perf_evlist__munmap(evlist);
|
perf_evlist__munmap(evlist);
|
||||||
out_free_cpu_mask:
|
|
||||||
CPU_FREE(cpu_mask);
|
|
||||||
out_delete_evlist:
|
out_delete_evlist:
|
||||||
perf_evlist__delete(evlist);
|
perf_evlist__delete(evlist);
|
||||||
out:
|
out:
|
||||||
|
|||||||
Reference in New Issue
Block a user