From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755344AbbINJKH (ORCPT ); Mon, 14 Sep 2015 05:10:07 -0400 Received: from terminus.zytor.com ([198.137.202.10]:32890 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753891AbbINJKE (ORCPT ); Mon, 14 Sep 2015 05:10:04 -0400 Date: Mon, 14 Sep 2015 02:09:42 -0700 From: tip-bot for Arnaldo Carvalho de Melo Message-ID: Cc: hpa@zytor.com, wangnan0@huawei.com, kan.liang@intel.com, tglx@linutronix.de, bp@suse.de, linux-kernel@vger.kernel.org, mingo@kernel.org, fweisbec@gmail.com, adrian.hunter@intel.com, namhyung@kernel.org, eranian@google.com, dsahern@gmail.com, acme@redhat.com, jolsa@kernel.org Reply-To: namhyung@kernel.org, eranian@google.com, dsahern@gmail.com, acme@redhat.com, jolsa@kernel.org, adrian.hunter@intel.com, bp@suse.de, linux-kernel@vger.kernel.org, mingo@kernel.org, fweisbec@gmail.com, hpa@zytor.com, wangnan0@huawei.com, tglx@linutronix.de, kan.liang@intel.com In-Reply-To: <20150911153323.GP23511@kernel.org> References: <20150911153323.GP23511@kernel.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/urgent] perf header: Fixup reading of HEADER_NRCPUS feature Git-Commit-ID: caa470475d9b59eeff093ae650800d34612c4379 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: caa470475d9b59eeff093ae650800d34612c4379 Gitweb: http://git.kernel.org/tip/caa470475d9b59eeff093ae650800d34612c4379 Author: Arnaldo Carvalho de Melo AuthorDate: Fri, 11 Sep 2015 12:36:12 -0300 Committer: Arnaldo Carvalho de Melo CommitDate: Sun, 13 Sep 2015 11:41:34 -0300 perf header: Fixup reading of HEADER_NRCPUS feature The original patch introducing this header wrote the number of CPUs available and online in one order and then swapped those values when reading, fix it. Before: # perf record usleep 1 # perf report --header-only | grep 'nrcpus \(online\|avail\)' # nrcpus online : 4 # nrcpus avail : 4 # echo 0 > /sys/devices/system/cpu/cpu2/online # perf record usleep 1 # perf report --header-only | grep 'nrcpus \(online\|avail\)' # nrcpus online : 4 # nrcpus avail : 3 # echo 0 > /sys/devices/system/cpu/cpu1/online # perf record usleep 1 # perf report --header-only | grep 'nrcpus \(online\|avail\)' # nrcpus online : 4 # nrcpus avail : 2 After the fix, bringing back the CPUs online: # perf report --header-only | grep 'nrcpus \(online\|avail\)' # nrcpus online : 2 # nrcpus avail : 4 # echo 1 > /sys/devices/system/cpu/cpu2/online # perf record usleep 1 # perf report --header-only | grep 'nrcpus \(online\|avail\)' # nrcpus online : 3 # nrcpus avail : 4 # echo 1 > /sys/devices/system/cpu/cpu1/online # perf record usleep 1 # perf report --header-only | grep 'nrcpus \(online\|avail\)' # nrcpus online : 4 # nrcpus avail : 4 Acked-by: Namhyung Kim Cc: Adrian Hunter Cc: Borislav Petkov Cc: David Ahern Cc: Frederic Weisbecker Cc: Jiri Olsa Cc: Kan Liang Cc: Stephane Eranian Cc: Wang Nan Fixes: fbe96f29ce4b ("perf tools: Make perf.data more self-descriptive (v8)") Link: http://lkml.kernel.org/r/20150911153323.GP23511@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/header.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c index 4181454..fce6634 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c @@ -1438,7 +1438,7 @@ static int process_nrcpus(struct perf_file_section *section __maybe_unused, if (ph->needs_swap) nr = bswap_32(nr); - ph->env.nr_cpus_online = nr; + ph->env.nr_cpus_avail = nr; ret = readn(fd, &nr, sizeof(nr)); if (ret != sizeof(nr)) @@ -1447,7 +1447,7 @@ static int process_nrcpus(struct perf_file_section *section __maybe_unused, if (ph->needs_swap) nr = bswap_32(nr); - ph->env.nr_cpus_avail = nr; + ph->env.nr_cpus_online = nr; return 0; }