Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753208AbbF3Qpc (ORCPT ); Tue, 30 Jun 2015 12:45:32 -0400 Received: from mga11.intel.com ([192.55.52.93]:35682 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752689AbbF3QpZ (ORCPT ); Tue, 30 Jun 2015 12:45:25 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,379,1432623600"; d="scan'208";a="755953293" From: "Liang, Kan" To: Stephane Eranian CC: Arnaldo Carvalho de Melo , Jiri Olsa , "ak@linux.intel.com" , Namhyung Kim , "Hunter, Adrian" , "David Ahern" , Peter Zijlstra , "mingo@redhat.com" , LKML Subject: RE: [PATCH 2/2] perf,tools: check and re-organize evsel cpu maps Thread-Topic: [PATCH 2/2] perf,tools: check and re-organize evsel cpu maps Thread-Index: AQHQsuIqb3BPXlxSTUu88+3PRlsTHp3ErYgAgACGgqA= Date: Tue, 30 Jun 2015 16:45:18 +0000 Message-ID: <37D7C6CF3E00A74B8858931C1DB2F07701883865@SHSMSX103.ccr.corp.intel.com> References: <1435607735-6332-1-git-send-email-kan.liang@intel.com> <1435607735-6332-2-git-send-email-kan.liang@intel.com> In-Reply-To: Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id t5UGjYGJ013047 Content-Length: 3273 Lines: 76 > > On Mon, Jun 29, 2015 at 12:55 PM, wrote: > > > > From: Kan Liang > > > > Some PMU events have cpumask, e.g uncore events. The cpu list set by > > user may be incompatible with event's cpumask. > > This patch will check the user defined cpu list. If the incompatible > > cpu is found, it will warn the user and discard the incompatible cpu. > > Only available cpu can be stored in evsel->cpus->map. If there is no > > cpu from cpu list compatible with event's cpumask. It will error out. > > > > Here is an example. > > According to cpumask, uncore should only available on CPU0 and CPU18. > > So the S0-C1 for uncore should not count. > > > I don't think this is correct. The cpumask is a default set of CPUs to be used > by perf. The cpumask does not indicate the ONLY CPUs on which to > monitor. It is just a default. You can monitor an uncore event using a CPU > not listed in the cpumask, unless the kernel code has changed recently. If > you are not on the default CPUs, the kernel will IPI. > Here I mean that the S0-C1 for uncore should show "", as we showed the same thing on "perf stat -a --per-core". Yes, in theory, user can use a CPU not listed in the cpumask. Because uncore is per-socket event. However, it brings error and confusion. - As the below example, if we run -C0,1, we get two results for socket 0. I think it's incorrect. Per-socket event should only have one result per socket. - Since the cpumask has already been exported to user space, I think users should follow it. Otherwise, why we export cpumask to user space? Implicitly changing the monitored CPU in kernel is not a good way I think. Thanks, Kan > > > > Without this patch > > $ sudo ./perf stat -e cycles,uncore_imc_0/cas_count_read/ -C0,1,18 > > --per-core sleep 2 > > > > Performance counter stats for 'CPU(s) 0,1,18': > > > > S0-C0 1 6749638 cycles > > S0-C0 1 0.83 MiB uncore_imc_0/cas_count_read/ > > (100.00%) > > S0-C1 1 232421 cycles > > S0-C1 1 0.83 MiB uncore_imc_0/cas_count_read/ > > S1-C0 1 236997 cycles > > S1-C0 1 0.35 MiB uncore_imc_0/cas_count_read/ > > > > 2.001094019 seconds time elapsed > > > > With this patch > > $ perf stat -e cycles,uncore_imc_0/cas_count_read/ -C0,1,18 > > --per-core sleep 2 event uncore_imc_0/cas_count_read/ can only be > > monitored on CPU 0 18. > > Other CPUs will be discard. > > > > Performance counter stats for 'CPU(s) 0,1,18': > > > > S0-C0 1 5557406 cycles > > S0-C0 1 0.21 MiB uncore_imc_0/cas_count_read/ > > S0-C1 1 1012534 cycles > > S0-C1 0 MiB uncore_imc_0/cas_count_read/ > > S1-C0 1 916130 cycles > > S1-C0 1 0.08 MiB uncore_imc_0/cas_count_read/ > > > > 2.001110843 seconds time elapsed > > > > Signed-off-by: Kan Liang ????{.n?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?