From patchwork Wed Nov 29 21:34:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 171578 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a5a7:0:b0:403:3b70:6f57 with SMTP id d7csp632781vqn; Wed, 29 Nov 2023 13:35:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IElwdh7ACIv31qFg3HWpQnJS4iap5Pg+xn1Gs3DRvQUmanjg9Je8tb73NmDI6j4+ukvMEI6 X-Received: by 2002:a05:6a20:9757:b0:189:bf74:19ce with SMTP id hs23-20020a056a20975700b00189bf7419cemr17808901pzc.4.1701293709636; Wed, 29 Nov 2023 13:35:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701293709; cv=none; d=google.com; s=arc-20160816; b=eNR4HhMJDCA+3zYM2PyDtvLm5e7DdrY5kR3fx8g12kLz95+e3nF/1h6xSPZgjSwJti oGo7RK0V/VAppOUFUL+Zr+v8pUh2ruUR4sCZlPzRDNiKZQFOEN9mhfy0m+WXrzG4w7ax cA5p8WVahhnZBykiASh1Ml78y5lfAV3eoCi2NY7J+IJ33tud4FZxdxRQwqdg36ixvDxO mPdrpnSPHu4IZTWayhelv54ua7NtSAV0Wx2gAKKpX2lYLwC3kVb3uWaYetfnfrysHkNB +odhle6QPf9k6UAZ/lmmO09IS2L2ey8IZF6r3uzrWTeaJ4dTe7wLmkPgPABjTHhVsOuf XZAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:from:subject:references:mime-version :message-id:in-reply-to:date:dkim-signature; bh=cizzxjAOXVtNMhutvuRuFXeQ97rL+0eSPOInOH69jLw=; fh=s+iVIXVUBgtmrgM30VqFskabmg0Jfr2GIun8/h4Dwpg=; b=uT/Hd8d15WmdVpgp2/Fg1qYCbAXUiNhL/mNs7XdexYHD7w/JDgTuYJHvDgRPpTN0r8 KtL0M2c6mbolQK6adbe6yDREDeTpjaOtprK1cqqGtu9aMAVq0OENEXXz6wfjt9o0qx4P AB3W27Wvgyb+wE9UMR1vF/d28h0wAILdI3W4jTWN0gH1ivMEuHMxattxvfg7dCo2+qdH xAMIzD60r0KB2YJIibogdm7N2hstvdwCphfQcBLoCkFkINzMUShorGHTH6EmC5JxfEZ1 GHeKC3FwYS10YIntN4MtyAcm8hk1BZusxlmdpyLawfBa0v0SNoOzzT5Qs2nJabt/tZ97 bgag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=Jyc6mdJl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id a31-20020a630b5f000000b005acb92781fbsi15089805pgl.415.2023.11.29.13.35.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 13:35:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=Jyc6mdJl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 21124801BA4E; Wed, 29 Nov 2023 13:35:07 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234456AbjK2Vev (ORCPT + 99 others); Wed, 29 Nov 2023 16:34:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229742AbjK2Vet (ORCPT ); Wed, 29 Nov 2023 16:34:49 -0500 Received: from mail-yw1-x114a.google.com (mail-yw1-x114a.google.com [IPv6:2607:f8b0:4864:20::114a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10C6C10C2 for ; Wed, 29 Nov 2023 13:34:56 -0800 (PST) Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-5c87663a873so3332657b3.2 for ; Wed, 29 Nov 2023 13:34:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1701293695; x=1701898495; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=cizzxjAOXVtNMhutvuRuFXeQ97rL+0eSPOInOH69jLw=; b=Jyc6mdJlqSGh9xCX+wfM42GM0qBnGD5xq2Oe1Q/ZhFBJ+UfF4AblVf9RHARky/hIig ztPcoXUdNalW/qrsjAUmWjj1hjgba/6ZexwnXmIYH+dFR0uhLx89qne/fQk9fvhSBlQl voc+aAcSqUsOkDhw4WABVcUCD23kmi5lwkHOLQXwsOYvpbdM2nt1eNRvQ7HlQyyHaYFb t1XhYlb4lm/y/dDlECVeDawqQ5QIygMVx9YGt6Bo9Xx+cVXmdWB8fLawvyVMbgAkScPv BlkF5ECe/9AnWYT0K3sPU5qPYrzwoDTmhPidNhiA6zLGvMI1c2oqP7BLJDOP9siqINMJ Ji0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701293695; x=1701898495; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=cizzxjAOXVtNMhutvuRuFXeQ97rL+0eSPOInOH69jLw=; b=b9lI1vUn29bWeVZv/Rcei9KRWZOvA+kQ+gLmqbYM0GxYZmr8sAvy7QEg+d0IVUjDwc 4Xuuvic12q510gp05MiXDQQAAyZTm1Dn4MXEjo0T/mGu7ARrR09I43bvG0MJvESxiSRd jap+ZUg/YhdG1aMVEdKK6hxaI2fSXj8r22/7jO1e1al3AyhGKVi5qOik0QpFeiXG4OvK RZ4y0Uq2qwXB6kraIaEdfei/ZdNHmSilDoBuNisjZInKpR+9jlhVyReN0mINjRuD60rK /k9OGXvEoHNjpwAFQAVgvz9+ohdMesxl/YqB0E90bFBdcc/5woswOLZDF5sSCsILAI17 3GCQ== X-Gm-Message-State: AOJu0YysMZIqr4fZSfy4cPx1ygAqcWJAUBSARYOQq/U5XxDb79UXkyKU W8P9ZZ8qE1oSdoNG97vqQQ4nIios5UsU X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:763b:80fa:23ca:96f8]) (user=irogers job=sendgmr) by 2002:a05:690c:2e05:b0:5ce:dff:f7a3 with SMTP id et5-20020a05690c2e0500b005ce0dfff7a3mr547030ywb.10.1701293695222; Wed, 29 Nov 2023 13:34:55 -0800 (PST) Date: Wed, 29 Nov 2023 13:34:26 -0800 In-Reply-To: <20231129213428.2227448-1-irogers@google.com> Message-Id: <20231129213428.2227448-2-irogers@google.com> Mime-Version: 1.0 References: <20231129213428.2227448-1-irogers@google.com> X-Mailer: git-send-email 2.43.0.rc1.413.gea7ed67945-goog Subject: [PATCH v2 2/4] perf list: Fix json segfault From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Adrian Hunter , Kan Liang , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, James Clark , Athira Rajeev X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Wed, 29 Nov 2023 13:35:07 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783935752729280215 X-GMAIL-MSGID: 1783935752729280215 Json output didn't set the skip_duplicate_pmus callback yielding a segfault. Fixes: cd4e1efbbc40 ("perf pmus: Skip duplicate PMUs and don't print list suffix by default") Signed-off-by: Ian Rogers --- tools/perf/builtin-list.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/perf/builtin-list.c b/tools/perf/builtin-list.c index a343823c8ddf..61c2c96cc070 100644 --- a/tools/perf/builtin-list.c +++ b/tools/perf/builtin-list.c @@ -434,6 +434,11 @@ static void json_print_metric(void *ps __maybe_unused, const char *group, strbuf_release(&buf); } +static bool json_skip_duplicate_pmus(void *ps __maybe_unused) +{ + return false; +} + static bool default_skip_duplicate_pmus(void *ps) { struct print_state *print_state = ps; @@ -503,6 +508,7 @@ int cmd_list(int argc, const char **argv) .print_end = json_print_end, .print_event = json_print_event, .print_metric = json_print_metric, + .skip_duplicate_pmus = json_skip_duplicate_pmus, }; ps = &json_ps; } else {