Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1109259pxa; Thu, 13 Aug 2020 00:12:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzzLmsBK3rSPkF9yM5mHzhlxIwJ6TyS8EZIHy7MR6QpqjU7r4B4OObxk905htfCLTrsWqRC X-Received: by 2002:a17:906:957:: with SMTP id j23mr3463614ejd.344.1597302773300; Thu, 13 Aug 2020 00:12:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597302773; cv=none; d=google.com; s=arc-20160816; b=Q4wMlJx8dcSgRi3NaWq0UE43MXMkIixY4MmCTmDV9I5WxlScyeDy7IR0eN59iouKm5 tfAzJFchZjBHCL4UiP5GEDJvrTfHkj/DxILeej5J+kom2jOaB0qg2illj8PY73eDlZu+ RcCElb2T7B3tp/VIVUovn97+izHsTjx3F2V+hHDy+W+bV2qT6b+LAd7Db82RzwTD+UBW WlZiRzmHN1Z4sH0cT5VXVpmyHgG+i7yE64VTbebUaqdd/yfN2Sw5QAomDHdTIEoRC0lQ xj8i6HeopumKzUUX7CdLYFbBo7CY2HTSRt+jW7vVmyYjDVgxhNpfsxzWTiiW0E2TC0Bg tlbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :ironport-sdr:ironport-sdr; bh=Q98jMXBTdA8wt54a/rXZQ9VvNR/nd1K/plvCFIlPEJw=; b=jwEcM4NxZxCRDLx/69iTy5cU0FOxT/p/WFRfBTRkZY8fwmgKtHY/Mc0SWKQRb1GITe qR++Sy2rjZcjUWTJva9M4bOJQcK0AqFTSvd3N1Z8I+DplR1K5wB2W4TdmeWN0fGalt/S phxGuO3xdHwzN8S0VC3JgcbZ/uJRUh83yVBTl6+vxA2haGbkil7jW9/wZuy7/w+s2eq6 a4j9jFGfnJZdmlwt5hiMr1k2F8LBaB+IRLTnHGPZOrGxZHx1hFwoqPFT5edZjpoJ+URk b2ctcBWAjiup+hp5G5IYtgJjYIE92JeNb3LDspS9bM7OkBBFn6h6SaLb2ZblmrPOQCXL AawA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lv10si2945850ejb.522.2020.08.13.00.12.30; Thu, 13 Aug 2020 00:12:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726639AbgHMHJa (ORCPT + 99 others); Thu, 13 Aug 2020 03:09:30 -0400 Received: from mga02.intel.com ([134.134.136.20]:12772 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726044AbgHMHJa (ORCPT ); Thu, 13 Aug 2020 03:09:30 -0400 IronPort-SDR: 1Ekkrbjno9bvoS0GYgdlAWZakXyNq2f0zQKW6V2hADf88sN8u+zgQOMFaECFGcrqkAVMdAEQlp Lxr5EptZlqXw== X-IronPort-AV: E=McAfee;i="6000,8403,9711"; a="142012455" X-IronPort-AV: E=Sophos;i="5.76,307,1592895600"; d="scan'208";a="142012455" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Aug 2020 00:09:29 -0700 IronPort-SDR: Lkmox1joMNeEgxcnKkXPiREXEoCTYDozJEdolZK2bynEQvCQlJklWzVjzCt7V7CmI+bGpVoGVw BUb10yKDpeEA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,307,1592895600"; d="scan'208";a="333032638" Received: from kbl-ppc.sh.intel.com ([10.239.159.55]) by FMSMGA003.fm.intel.com with ESMTP; 13 Aug 2020 00:09:26 -0700 From: Jin Yao To: acme@kernel.org, jolsa@kernel.org, peterz@infradead.org, mingo@redhat.com, alexander.shishkin@linux.intel.com Cc: Linux-kernel@vger.kernel.org, ak@linux.intel.com, kan.liang@intel.com, yao.jin@intel.com, like.xu@linux.intel.com, Jin Yao Subject: [PATCH v2] perf parse-events: Set exclude_guest for user-space counting Date: Thu, 13 Aug 2020 15:09:11 +0800 Message-Id: <20200813070911.26477-1-yao.jin@linux.intel.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently if we run 'perf record -e cycles:u', exclude_guest is 0. But it doesn't make sense that we request for user-space counting but we also get the guest report. To keep perf semantics consistent and clear, this patch sets exclude_guest for user-space counting. Before: perf record -e cycles:u ./div perf evlist -v cycles:u: ..., exclude_kernel: 1, exclude_hv: 1, ... After: perf record -e cycles:u ./div perf evlist -v cycles:u: ..., exclude_kernel: 1, exclude_hv: 1, exclude_guest: 1, ... perf test 6 6: Parse event definition strings : Ok Signed-off-by: Jin Yao --- v2: --- Fix the 'perf test 6' failure. tools/perf/tests/parse-events.c | 4 ++-- tools/perf/util/parse-events.c | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/perf/tests/parse-events.c b/tools/perf/tests/parse-events.c index 7f9f87a470c3..aae0fd9045c1 100644 --- a/tools/perf/tests/parse-events.c +++ b/tools/perf/tests/parse-events.c @@ -719,7 +719,7 @@ static int test__group2(struct evlist *evlist) TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user); TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel); TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv); - TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest); + TEST_ASSERT_VAL("wrong exclude guest", evsel->core.attr.exclude_guest); TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host); TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip); TEST_ASSERT_VAL("wrong leader", evsel__is_group_leader(evsel)); @@ -842,7 +842,7 @@ static int test__group3(struct evlist *evlist __maybe_unused) TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user); TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel); TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv); - TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest); + TEST_ASSERT_VAL("wrong exclude guest", evsel->core.attr.exclude_guest); TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host); TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip); TEST_ASSERT_VAL("wrong leader", evsel__is_group_leader(evsel)); diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index 9f7260e69113..4d809f1fe269 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c @@ -1794,6 +1794,8 @@ static int get_event_modifier(struct event_modifier *mod, char *str, if (*str == 'u') { if (!exclude) exclude = eu = ek = eh = 1; + if (!exclude_GH) + eG = 1; eu = 0; } else if (*str == 'k') { if (!exclude) -- 2.17.1