Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp3740764pxb; Mon, 27 Sep 2021 01:14:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyb6uSep5qufsdhgz51qxNlBtdjWwGlFqu9EP3Yw3AxohIpbtMChhQvJwqVpX5qi3J0Yayw X-Received: by 2002:a50:9552:: with SMTP id v18mr10053900eda.395.1632730447269; Mon, 27 Sep 2021 01:14:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632730447; cv=none; d=google.com; s=arc-20160816; b=p6lD2KamfkEBpJnoiZc6EiibWIDPYNR5+80oNHigRq+hyGdFW5JCBr1xq7rdMbNnMA v/TCf9Uppp12Ctx+Vv2hhIGPSX6X7sWDQVq0O5pkAZ/wHPen5/imDKr/eVotyUz03Iez adkmNZu10HwpwgXcGMkzwl7meEBUWZyYb4vS0E994N5SJB/i15XcZMOWi8zrZl4XzmKu rG6w9ZZAj9ZvXGrOp3Koy+4N192XVsRNYJHKdWUZsEaquVKIyMb5qn7XImL6TpSt2keZ 1a5EpS5lPvjui0aFYKJgWgNlZwW3vAiM19OmGYMjF7cKLoo+ErIpnngVKutxLdjp7uLr coyA== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=zxvzFa9w3gy+pI90d1imU3SqTdR9iq61CTXXXTfiPYU=; b=OjCGeKZzYdCujNlMQuc2bt3PGpXkPmbk2QkH99MlNTUsm5vemvnRTtMfEt3PBz5pKa os0YquyiAEsDSEyOWrBPFmFgVh7X6BFFkTdGHk5fJKtDaam0QX0Jf9+x2Z02pmx+18gZ IKv0uJfCuvYJlY3wkKxkbQa6Gcyb2u/Fspr3xOwaqOFI6yR0JpOj1xNe3iceSL4175wv 9ECYrLCRhIQoUU6QipqqUCbN4bA4WfC01m+rMQqGC9Qj35VE9ro46s2Wyz5X9PFLILEY 45t2JrWkLoD8EMdet/a+Xmgf/9CXRSE4gphCW8kXHOSV5t8Hml+VQhJSiK53N2/3TVWU g/iw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=W91OP6iT; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e8si17936965edv.247.2021.09.27.01.13.44; Mon, 27 Sep 2021 01:14:07 -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=@gmail.com header.s=20210112 header.b=W91OP6iT; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233454AbhI0INK (ORCPT + 99 others); Mon, 27 Sep 2021 04:13:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233414AbhI0IND (ORCPT ); Mon, 27 Sep 2021 04:13:03 -0400 Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0E16C061575; Mon, 27 Sep 2021 01:11:25 -0700 (PDT) Received: by mail-pj1-x1029.google.com with SMTP id d4-20020a17090ad98400b0019ece228690so3107314pjv.5; Mon, 27 Sep 2021 01:11:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=zxvzFa9w3gy+pI90d1imU3SqTdR9iq61CTXXXTfiPYU=; b=W91OP6iT8BNmHcq2e4lnkgtoJTJ1hzJZvw2nRfall/c6XPNqapmymnMVruc1+IvBHE zmlWhQ0K2wF+mX+DppWhehPQVX1bS4hditALICwFEZKJb5b+klzzQfwiabLwuf065pia atKoqpDD+HyI1zmJ+X5wKagrdct9uOwoGX1Ej8bkiiD2zKLRzbuJ2Z5xL1WEQ+Vv7rJZ OKxvdUh/Vz8nbssaSUSEcNM4p5FZ9ijWtfRZ9c9jw1lX24S8ZULbdzkEokdj0diTepzK L9Gh7JSYF3rKpiNhyEmyupciX8LdcP9ZDLOBEJJZNTS1YYZzcjl82b/DXk1JhDRsCTS0 4/4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=zxvzFa9w3gy+pI90d1imU3SqTdR9iq61CTXXXTfiPYU=; b=MKgMVgogwiIz6DFvlpZOxJ7Rrh1oSihZH9GNv6DSmat8soWcV184qdHT6+hOsaHE6r Or9DQ1gI1y6tr5I5604Rup4iB99HIuUKdEEP9D/IZk3tnizDnUZS/gOeXDcOCmJ5Fz7W kCo+8ct8VpFJJ89gcgKBrcNRySNIouH4Z4sKudSXSM+Vvf6D8zzqWgG0RWZ3MQY1k5Cf PDJi26yVFyXSa5bfi/+Oxpnk88To5HDbga1gUuLgbDTMLo3Lzs6CCHlv3jHDFAe7h4S4 eutP3Xt7irV0Di2hDwfJo+Hs+ZPwgEUYOrC0iB4tiZ8TocpsLbevUaobuTbfEJLp13el QEMg== X-Gm-Message-State: AOAM532IcGvWlKBfzn4kWGnHYOz9fZw/Oo3YGBgzHK2va3sg5k8X0jUq xFMrr4rU5EMgEOS8mIHVjA8= X-Received: by 2002:a17:902:758b:b0:13e:8b1:e49f with SMTP id j11-20020a170902758b00b0013e08b1e49fmr10049707pll.6.1632730285241; Mon, 27 Sep 2021 01:11:25 -0700 (PDT) Received: from localhost.localdomain ([103.7.29.32]) by smtp.gmail.com with ESMTPSA id y80sm16042240pfb.196.2021.09.27.01.11.22 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 Sep 2021 01:11:24 -0700 (PDT) From: Like Xu X-Google-Original-From: Like Xu To: Arnaldo Carvalho de Melo , Ian Rogers Cc: Alexander Antonov , Jiri Olsa , Alexander Shishkin , Namhyung Kim , Mark Rutland , Stephane Eranian , Peter Zijlstra , Ingo Molnar , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] perf iostat: Use system-wide mode if the target cpu_list is unspecified Date: Mon, 27 Sep 2021 16:11:14 +0800 Message-Id: <20210927081115.39568-1-likexu@tencent.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Like Xu An iostate use case like "perf iostat 0000:16,0000:97 -- ls" should be implemented to work in system-wide mode to ensure that the output from print_header() is consistent with the user documentation perf-iostat.txt, rather than incorrectly assuming that the kernel does not support it: Error: The sys_perf_event_open() syscall returned with 22 (Invalid argument) \ for event (uncore_iio_0/event=0x83,umask=0x04,ch_mask=0xF,fc_mask=0x07/). /bin/dmesg | grep -i perf may provide additional information. This error is easily fixed by assigning system-wide mode by default for IOSTAT_RUN only when the target cpu_list is unspecified. Signed-off-by: Like Xu --- tools/perf/builtin-stat.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index f6e87b7be5fa..f0ecfda34ece 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -2408,6 +2408,8 @@ int cmd_stat(int argc, const char **argv) goto out; } else if (verbose) iostat_list(evsel_list, &stat_config); + if (iostat_mode == IOSTAT_RUN && !target__has_cpu(&target)) + target.system_wide = true; } if (add_default_attributes()) -- 2.32.0