linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	alan@lxorguk.ukuu.org.uk, Vinson Lee <vlee@twitter.com>,
	Zheng Liu <wenqing.lz@taobao.com>,
	David Ahern <dsahern@gmail.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Mike Galbraith <efault@gmx.de>, Paul Mackerras <paulus@samba.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Stephane Eranian <eranian@google.com>,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [ 27/28] perf test: fix a build error on builtin-test
Date: Fri, 14 Dec 2012 14:26:44 -0800	[thread overview]
Message-ID: <20121214222256.408666949@linuxfoundation.org> (raw)
In-Reply-To: <20121214222250.501309822@linuxfoundation.org>

3.4-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Zheng Liu <gnehzuil.liu@gmail.com>

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 <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>
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 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:



  parent reply	other threads:[~2012-12-14 22:30 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-14 22:26 [ 00/28] 3.4.24-stable review Greg Kroah-Hartman
2012-12-14 22:26 ` [ 01/28] tmpfs: fix shared mempolicy leak Greg Kroah-Hartman
2012-12-14 22:26 ` [ 02/28] Revert misapplied "mmc: sh-mmcif: avoid oops on spurious interrupts" Greg Kroah-Hartman
2012-12-14 22:26 ` [ 03/28] mmc: sh-mmcif: avoid oops on spurious interrupts (second try) Greg Kroah-Hartman
2012-12-14 22:26 ` [ 04/28] ARM: 7566/1: vfp: fix save and restore when running on pre-VFPv3 and CONFIG_VFPv3 set Greg Kroah-Hartman
2012-12-14 22:26 ` [ 05/28] ASoC: dmaengine: Correct Makefile when sound is built as module Greg Kroah-Hartman
2012-12-14 22:26 ` [ 06/28] workqueue: convert BUG_ON()s in __queue_delayed_work() to WARN_ON_ONCE()s Greg Kroah-Hartman
2012-12-14 22:26 ` [ 07/28] drm/i915: do not ignore eDP bpc settings from vbt Greg Kroah-Hartman
2012-12-14 22:26 ` [ 08/28] drm/i915: do not default to 18 bpp for eDP if missing from VBT Greg Kroah-Hartman
2012-12-14 22:26 ` [ 09/28] mm: dmapool: use provided gfp flags for all dma_alloc_coherent() calls Greg Kroah-Hartman
2012-12-14 22:26 ` [ 10/28] x86,AMD: Power driver support for AMDs family 16h processors Greg Kroah-Hartman
2012-12-14 22:26 ` [ 11/28] telephony: ijx: buffer overflow in ixj_write_cid() Greg Kroah-Hartman
2012-12-14 22:26 ` [ 12/28] x86: hpet: Fix masking of MSI interrupts Greg Kroah-Hartman
2012-12-14 22:26 ` [ 13/28] USB: add new zte 3g-dongles pid to option.c Greg Kroah-Hartman
2012-12-14 22:26 ` [ 14/28] USB: option: blacklist network interface on Huawei E173 Greg Kroah-Hartman
2012-12-14 22:26 ` [ 15/28] USB: ftdi_sio: Add support for Newport AGILIS motor drivers Greg Kroah-Hartman
2012-12-14 22:26 ` [ 16/28] usb: ftdi_sio: fixup BeagleBone A5+ quirk Greg Kroah-Hartman
2012-12-14 22:26 ` [ 17/28] USB: cp210x: add Virtenio Preon32 device id Greg Kroah-Hartman
2012-12-14 22:26 ` [ 18/28] USB: mark uas driver as BROKEN Greg Kroah-Hartman
2012-12-14 22:26 ` [ 19/28] ACPI / battery: Correct battery capacity values on Thinkpads Greg Kroah-Hartman
2012-12-14 22:26 ` [ 20/28] ACPI / PM: Add Sony Vaio VPCEB1S1E to nonvs blacklist Greg Kroah-Hartman
2012-12-14 22:26 ` [ 21/28] ACPI / PNP: Do not crash due to stale pointer use during system resume Greg Kroah-Hartman
2012-12-14 22:26 ` [ 22/28] ACPI / video: ignore BIOS initial backlight value for HP Folio 13-2000 Greg Kroah-Hartman
2012-12-14 22:26 ` [ 23/28] USB: OHCI: workaround for hardware bug: retired TDs not added to the Done Queue Greg Kroah-Hartman
2012-12-14 22:26 ` [ 24/28] xhci: Extend Fresco Logic MSI quirk Greg Kroah-Hartman
2012-12-14 22:26 ` [ 25/28] ftrace: Clear bits properly in reset_iter_read() Greg Kroah-Hartman
2012-12-14 22:26 ` [ 26/28] cdc-acm: implement TIOCSSERIAL to avoid blocking close(2) Greg Kroah-Hartman
2012-12-14 22:26 ` Greg Kroah-Hartman [this message]
2012-12-14 22:26 ` [ 28/28] rcu: Fix batch-limit size problem Greg Kroah-Hartman
2012-12-15 14:21 ` [ 00/28] 3.4.24-stable review Satoru Takeuchi
2012-12-15 14:27 ` Shuah Khan
2012-12-15 20:48   ` Shuah Khan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20121214222256.408666949@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=acme@redhat.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=dsahern@gmail.com \
    --cc=efault@gmx.de \
    --cc=eranian@google.com \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulus@samba.org \
    --cc=peterz@infradead.org \
    --cc=stable@vger.kernel.org \
    --cc=vlee@twitter.com \
    --cc=wenqing.lz@taobao.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).