From patchwork Sat Nov 12 03:22:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Namhyung Kim X-Patchwork-Id: 19092 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1089622wru; Fri, 11 Nov 2022 19:24:38 -0800 (PST) X-Google-Smtp-Source: AA0mqf5e4Ga20SWdOwcy5JIplOuJ9Z94ZNTNcosBVdwHLDHki1fxpeJ7zB0FY/hjjyQpuLf/yLYT X-Received: by 2002:aa7:c983:0:b0:461:c6e8:452e with SMTP id c3-20020aa7c983000000b00461c6e8452emr3903042edt.298.1668223478146; Fri, 11 Nov 2022 19:24:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668223478; cv=none; d=google.com; s=arc-20160816; b=NEO0vCBn3x3TpdSblBk+Qbjb8fJ56u9OLt72Xlxjz85bj0emDbf5E4UIGY/wjpiNzA k6aHOxaMl8OOol/IF9u7Cips4IjqH1jIHap7Z0dT08RFI8FNUuboLgVbfGTYMoEO0gtz x1aDlPS7pS88pDhQcDernNlyAgH7iAbQYBaVUUOSNr18ViMFlVOKwsr1ffaZ6dS6DeTz EE+jcf8pftVcuqeW8Ly2Yqu5VC8q72vF9GRvJZuFeVC060TYDbz9iPHFakSj8NoZZ/RF KakG7VMi+zSu732eKto3ZkBfoQv2eNR5oGawbgRakzOwwBiJ5FpHx5RKRUGPi3oRqyT0 6jwQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from:sender :dkim-signature; bh=r0CN9KCdpK4u7NxmO5wQL4MzpD0DAJLpwtVLTuJk4vQ=; b=wMuQJTaKJHghmITgE+Z1g1HRmffvsrN8sZLnHJLcgWPmAEC0XaZTz8pAShY90Xu1qG HLtj9+EH6RI3sxEMllAJdvRdFN5XE7DMv7k4FY/XPeyykTq3d+bnc/HvWW28rnqo/NZI R7oSsmI73uutcOM0XzHcKZfnK/woKsiKo0dkV7R4uShVwp0lTobfnL6VOAkCnTl0TqXV /aIBo+ARSixp4Smqlg55sVpQLcU1N4IoXhyUrDjgBADPbiR1uO/I4VACrVWRuVs81IqG a3EszqmXoioAQkzLuZACyG+PNT4ikKtE4Qn5ads6zU5y5f9Z3djxUA6MHQ37b3HvwiwE JX6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Z6dvodBI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h12-20020a170906584c00b0078e1206d934si2600406ejs.162.2022.11.11.19.24.10; Fri, 11 Nov 2022 19:24:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Z6dvodBI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234387AbiKLDW6 (ORCPT + 99 others); Fri, 11 Nov 2022 22:22:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234190AbiKLDWw (ORCPT ); Fri, 11 Nov 2022 22:22:52 -0500 Received: from mail-pf1-x434.google.com (mail-pf1-x434.google.com [IPv6:2607:f8b0:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D845E6A748; Fri, 11 Nov 2022 19:22:49 -0800 (PST) Received: by mail-pf1-x434.google.com with SMTP id m6so6454015pfb.0; Fri, 11 Nov 2022 19:22:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=r0CN9KCdpK4u7NxmO5wQL4MzpD0DAJLpwtVLTuJk4vQ=; b=Z6dvodBIXjUdb9tCj4aXWOPOdkT6GbCOJdmAA+/maqCO+IkBju69uWmjHhg+RlTHlG iksnmwtHfVk01EYI7MNg3xOJWbkl6xcXgUqjJIv9yR5gskNmuOE6K4rOOj6FaKgtZOsk 2UmOFmfHZtrCo02fWNgzKBONepRjphNvMsQKBUZJIzfpwQT3IN7duWD+m7EcfcUzp2jY Z0usvoPV0eyQqUU1BbMJ9kpw5HL2ZUI52MRU8NK/wUJ+869v6mWV0b0ovqEwdwL2RG6X h3bS19nlYe6jihE7zldZG52zHgCjMB9cLUzARPYV5jYuVVjKjnawdPhKxwVS7iqnqTsw WXPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=r0CN9KCdpK4u7NxmO5wQL4MzpD0DAJLpwtVLTuJk4vQ=; b=BBL6VVVI/EJjc9MvetbuPJ3An1Lt3YtMUSrcVRT4NkXWI201CRWqCBuzX5ZIHo8mNv m5Y5zW+351PIFEiH1QlE0ACTCPwzTOxPxnbTdVBeHMoxMgqiGxPid9oSoXjza43eXpgp Cyx4dAIUlVY2Y4ljb6eEzY8zneoesF4lg0dOmHJXZf9KLgmgRd0IgC89pxewFV+OusQM iJwFou6VULSBrJ7cOR5Qd0pRZXXK3YiJuZNLdFDqBXDFjEdYCt60v3ThqpHo+og7yRCw SxVx09k2pCFezWFJM+5lnwqcICcm9TI+Lw29FrbzOv7ktA7Sy7Y2zkCeSdeHms0n80+K deGQ== X-Gm-Message-State: ANoB5pmHIJjLa1uZbzuW2P6k6RC0VafkYLxFpE9Tb8aNpwwrHMxMDJh6 x58W9KanV0avd5NsFrvUINI= X-Received: by 2002:a63:4a06:0:b0:46f:469a:249d with SMTP id x6-20020a634a06000000b0046f469a249dmr4158484pga.471.1668223369305; Fri, 11 Nov 2022 19:22:49 -0800 (PST) Received: from balhae.roam.corp.google.com ([2607:fb90:27dc:8408:33d7:3b01:eee1:84b]) by smtp.gmail.com with ESMTPSA id ij25-20020a170902ab5900b00186f0f59d1esm2434552plb.192.2022.11.11.19.22.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Nov 2022 19:22:48 -0800 (PST) Sender: Namhyung Kim From: Namhyung Kim To: Arnaldo Carvalho de Melo , Jiri Olsa Cc: Ingo Molnar , Peter Zijlstra , LKML , Ian Rogers , Adrian Hunter , linux-perf-users@vger.kernel.org, Kan Liang , Zhengjun Xing , James Clark Subject: [PATCH 01/11] perf stat: Fix crash with --per-node --metric-only in CSV mode Date: Fri, 11 Nov 2022 19:22:34 -0800 Message-Id: <20221112032244.1077370-2-namhyung@kernel.org> X-Mailer: git-send-email 2.38.1.493.g58b659f92b-goog In-Reply-To: <20221112032244.1077370-1-namhyung@kernel.org> References: <20221112032244.1077370-1-namhyung@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749259101731283587?= X-GMAIL-MSGID: =?utf-8?q?1749259101731283587?= The following command will get segfault due to missing aggr_header_csv for AGGR_NODE: $ sudo perf stat -a --per-node -x, --metric-only true Fixes: 86895b480a2f ("perf stat: Add --per-node agregation support") Signed-off-by: Namhyung Kim Acked-by: Ian Rogers --- tools/perf/util/stat-display.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c index 657434cd29ee..ea41e6308c50 100644 --- a/tools/perf/util/stat-display.c +++ b/tools/perf/util/stat-display.c @@ -534,7 +534,7 @@ static void printout(struct perf_stat_config *config, struct aggr_cpu_id id, int [AGGR_CORE] = 2, [AGGR_THREAD] = 1, [AGGR_UNSET] = 0, - [AGGR_NODE] = 0, + [AGGR_NODE] = 1, }; pm = config->metric_only ? print_metric_only_csv : print_metric_csv; @@ -819,6 +819,7 @@ static int aggr_header_lens[] = { [AGGR_SOCKET] = 12, [AGGR_NONE] = 6, [AGGR_THREAD] = 24, + [AGGR_NODE] = 6, [AGGR_GLOBAL] = 0, }; @@ -828,6 +829,7 @@ static const char *aggr_header_csv[] = { [AGGR_SOCKET] = "socket,cpus", [AGGR_NONE] = "cpu,", [AGGR_THREAD] = "comm-pid,", + [AGGR_NODE] = "node,", [AGGR_GLOBAL] = "" };