Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754371Ab2EGFLg (ORCPT ); Mon, 7 May 2012 01:11:36 -0400 Received: from LGEMRELSE7Q.lge.com ([156.147.1.151]:64230 "EHLO LGEMRELSE7Q.lge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751311Ab2EGFKb (ORCPT ); Mon, 7 May 2012 01:10:31 -0400 X-AuditID: 9c930197-b7badae000000cfd-c4-4fa75943134d From: Namhyung Kim To: Arnaldo Carvalho de Melo Cc: Peter Zijlstra , Paul Mackerras , Ingo Molnar , Namhyung Kim , LKML , David Ahern Subject: [PATCH 2/7] perf evlist: Fix creation of cpu map Date: Mon, 7 May 2012 14:08:59 +0900 Message-Id: <1336367344-28071-3-git-send-email-namhyung.kim@lge.com> X-Mailer: git-send-email 1.7.10.1 In-Reply-To: <1336367344-28071-1-git-send-email-namhyung.kim@lge.com> References: <1336367344-28071-1-git-send-email-namhyung.kim@lge.com> X-Brightmail-Tracker: AAAAAA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1674 Lines: 46 Currently, 'perf record -- sleep 1' creates a cpu map for all online cpus since it turns out calling cpu_map__new(NULL). Fix it. Also it is guaranteed that cpu_list is NULL if PID/TID is given by calling perf_target__validate(), so we can make the conditional bit simpler. This also fixes perf test 7 (Validate) failure on my 6 core machine: $ cat /sys/devices/system/cpu/online 0-11 $ ./perf test -v 7 7: Validate PERF_RECORD_* events & perf_sample fields: --- start --- perf_evlist__mmap: Operation not permitted ---- end ---- Validate PERF_RECORD_* events & perf_sample fields: FAILED! Signed-off-by: Namhyung Kim Reviewed-by: David Ahern --- tools/perf/util/evlist.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index 30328623cae6..183b199b0d09 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c @@ -609,8 +609,9 @@ int perf_evlist__create_maps(struct perf_evlist *evlist, if (evlist->threads == NULL) return -1; - if (target->uid != UINT_MAX || - (target->cpu_list == NULL && target->tid)) + if (target->uid != UINT_MAX || target->tid) + evlist->cpus = cpu_map__dummy_new(); + else if (!target->system_wide && target->cpu_list == NULL) evlist->cpus = cpu_map__dummy_new(); else evlist->cpus = cpu_map__new(target->cpu_list); -- 1.7.10.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/