Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp497188pxx; Wed, 28 Oct 2020 09:39:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzqIqiNryE6CMhwi20sHQuR2izGItYmCduyfw1/EYyrhVKSekIJvnE2z9jJu164vFaBt07X X-Received: by 2002:a05:6402:1590:: with SMTP id c16mr8908130edv.359.1603903158653; Wed, 28 Oct 2020 09:39:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603903158; cv=none; d=google.com; s=arc-20160816; b=C6AW6Rmgo8zYVLiX4LpL61bKKLzUhwd9EBSG1TuB3QdyuePK4+mxqBGcMz0LZ2b1cA q04urpOu45rLYGFabUzO4zu+4pJUc7aESyki0h9H/cWwfxE/jyE0FOf9EKGvg9KiJ270 exr19+g1O01mS5N/HScsVIuNNnypU23sRZdcZqBniWaQirXwZ+7aGilvSCSRJISOMY1T SF8+l66nFowQUNWEpaRzS8UJPe+dLTvMDNNcINUQm6c2M21W3z+a5vMlYTIbHVb+8vdQ jBuQ8sIgKT95HJRodaTahGszWuOSBOFywEbRhWk+mEkSGEPCjn/ByZlPPI+QmisM1mYS 8E4A== 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=6/w9clZsZjZ9yYpSiXATjmG49BCDqr3sNgZ6+/bIBjg=; b=VjZKIiVFqaA+prMZodH/ChVznarbwfzFqt4jKq2VHzRho+P4TJwW04MzmK3zdn+sCO vZRFVZphPKRRUpkE2zdlJ2/a2Z15Ysf7/Ua7BXFGU6MVk94Sbu9ux1w0DViuu5lm8uwR /PXEF6sFSM4OZv/FhCJWp0yepxSAEoyI1ZVR//E6WobrZ26tYiiZZGnaJE12Nbg4j9dc xab9hz+eUVryDEWZ32ZJ0lwKcj/hCyhc8xWojYVGbHcmqduO/4Y5LiFVpAWtnVuHNw5K cIoCQZY4otW6HllmCc80sKmYDzr/9J5+cmfT6A1jVetUGGUooJilc3529Tghfj3mXEFV 0JOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=RNO6dsHm; 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 z17si3710274ejc.499.2020.10.28.09.38.56; Wed, 28 Oct 2020 09:39:18 -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=RNO6dsHm; 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 S1816503AbgJ0RHN (ORCPT + 99 others); Tue, 27 Oct 2020 13:07:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:41394 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1793541AbgJ0PGx (ORCPT ); Tue, 27 Oct 2020 11:06:53 -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 98F9A206E5; Tue, 27 Oct 2020 15:06:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603811213; bh=NMSAQXbqWvRJVC+cSkxvdVdlg0p4Ii6H3ElLoKNThXg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RNO6dsHmVYneRW37OEr8p5/gSvjG1hjQy8r9pvx1tQSXUuaZXdMaEGpJGYFirc35N ZMnqlaq2qUzZIDIvj5+qU950oGnAQZ2OVEqDdEQZXL/7HITstaRDy/4Kqmca3FeX6v 3979HzzXnm7P1TZRpC6Lu+DrPrB3gYp7M58m5bzg= 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.8 382/633] perf stat: Skip duration_time in setup_system_wide Date: Tue, 27 Oct 2020 14:52:05 +0100 Message-Id: <20201027135540.626511136@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135522.655719020@linuxfoundation.org> References: <20201027135522.655719020@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 6e2502de755a8..6494383687f89 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -1963,8 +1963,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