Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp1112286pxx; Tue, 27 Oct 2020 08:31:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyu8IqmGfXCPRUczX2AjnJkuohkwqNCjzpnDRpR2338c80a2z5LkbWGq3jXsKFP+nlwPsnX X-Received: by 2002:a17:906:5e4f:: with SMTP id b15mr3019527eju.353.1603812673453; Tue, 27 Oct 2020 08:31:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603812673; cv=none; d=google.com; s=arc-20160816; b=WOVMqwXqZKYFBLuheoz6EmQfSVlMvSojmM7o75bOmAoO7HzMUS1fKJZDCbnl/gJ7+6 zNuNC9wBtYABC1b+F6W8g6HQar3JLwE4yUP7S7fvfL04xP3npVYif/EXn5Op/FYU1Npt Un73Lg5hiwSqFXXNELJGzjsd/obvnf1WlUJrrdZttvggDs1jcspkdoXoqivlnDDSociI 0Cp6mUkq/qKP+vxhmwraW5nxRLYazIjGAwvMb34Lrmrdpo8OprzepLTh/yuxw4hL9V3J cI9B+PJlDNz0AWqtS2K24gu8+EQsSwdpqC4dFTYYv21cvXrN5Mst3bc31tsABptAc35W 6HgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0f1due1QXeuKT+qMcLB/yy8sPmS4hla/Yk4FS62OnlI=; b=Vv6gXIW9dDXiKjF/mLaC49oYulpmeKkKFYufP/Rq4itq1DS92IuJ6PPZvclIAjz7Je /V+SgPz1bH3BlEWREax/fFMZwv1R7S6ps/Z6s2dPNWTlqphh2UbG+mg4ICgzwUbitJKA lIsxAdJafQolwMJl+LUp1M99Wr8T1zBaop4scTIdkWFg9tV/gkhDi4QwhbZG5d2I2ENv k86k8X9UwWSxaN9plk57BpmumDFI3sUDeI9fJUSON7vcMZbugD/AmZV8JosrqekCQpsJ P2FblAjkl3hmxxVWPqf/43pGqfbfmN39jtWUUUTCm7GH3rMluodx/zq5aeBY9T2w1sh9 ErHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=wpAVDz16; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g13si1113733edu.259.2020.10.27.08.30.48; Tue, 27 Oct 2020 08:31:13 -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; dkim=pass header.i=@kernel.org header.s=default header.b=wpAVDz16; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1749982AbgJ0OjO (ORCPT + 99 others); Tue, 27 Oct 2020 10:39:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:38434 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1761369AbgJ0OjK (ORCPT ); Tue, 27 Oct 2020 10:39:10 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 95834206B2; Tue, 27 Oct 2020 14:39:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603809549; bh=IvND95GBLZEuAHJ61yF4+ncQOUBoXxn2dVgElRHcMeE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wpAVDz16U+t0aIJpMWpNfNeuqri+CiR9FClm8wFUzsKe2M91gldElKB33hWfq+SKT AJLvY5Ja8H99rvJqLr4s1Hl0fnxPWfljx5bWUvKhIdeGTH+9KK8tZLcs2QRQmDnT+G L1g/MEWakDdL1qQGLgc7Wj1RhqumD6A8jlEUg3WE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jin Yao , Arnaldo Carvalho de Melo , Alexander Shishkin , Andi Kleen , Jin Yao , Jiri Olsa , Kan Liang , Peter Zijlstra , Sasha Levin Subject: [PATCH 5.4 235/408] perf stat: Skip duration_time in setup_system_wide Date: Tue, 27 Oct 2020 14:52:53 +0100 Message-Id: <20201027135505.960416652@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135455.027547757@linuxfoundation.org> References: <20201027135455.027547757@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jin Yao [ Upstream commit 002a3d690f95804bdef6b70b26154103518e13d9 ] Some metrics (such as DRAM_BW_Use) consists of uncore events and duration_time. For uncore events, counter->core.system_wide is true. But for duration_time, counter->core.system_wide is false so target.system_wide is set to false. Then 'enable_on_exec' is set in perf_event_attr of uncore event. Kernel will return error when trying to open the uncore event. This patch skips the duration_time in setup_system_wide then target.system_wide will be set to true for the evlist of uncore events + duration_time. Before (tested on skylake desktop): # perf stat -M DRAM_BW_Use -- sleep 1 Error: The sys_perf_event_open() syscall returned with 22 (Invalid argument) for event (arb/event=0x84,umask=0x1/). /bin/dmesg | grep -i perf may provide additional information. After: # perf stat -M DRAM_BW_Use -- sleep 1 Performance counter stats for 'system wide': 169 arb/event=0x84,umask=0x1/ # 0.00 DRAM_BW_Use 40,427 arb/event=0x81,umask=0x1/ 1,000,902,197 ns duration_time 1.000902197 seconds time elapsed Fixes: e3ba76deef23064f ("perf tools: Force uncore events to system wide monitoring") Signed-off-by: Jin Yao Tested-by: Arnaldo Carvalho de Melo Cc: Alexander Shishkin Cc: Andi Kleen Cc: Jin Yao Cc: Jiri Olsa Cc: Kan Liang Cc: Peter Zijlstra Link: http://lore.kernel.org/lkml/20200922015004.30114-1-yao.jin@linux.intel.com Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin --- tools/perf/builtin-stat.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index ac2feddc75fdd..ea183922c4ef1 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -1671,8 +1671,10 @@ static void setup_system_wide(int forks) struct evsel *counter; evlist__for_each_entry(evsel_list, counter) { - if (!counter->core.system_wide) + if (!counter->core.system_wide && + strcmp(counter->name, "duration_time")) { return; + } } if (evsel_list->core.nr_entries) -- 2.25.1