From patchwork Wed Nov 29 08:10:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 171145 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a5a7:0:b0:403:3b70:6f57 with SMTP id d7csp189170vqn; Wed, 29 Nov 2023 00:11:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IHr+cEdqux8xMw92MChcT3/pR5pHnueh2twa7wn4RnWOapg4tqStVH/x/jIQBEnShGjEB1L X-Received: by 2002:a05:6870:819d:b0:1e9:bfe7:e842 with SMTP id k29-20020a056870819d00b001e9bfe7e842mr21620695oae.32.1701245460397; Wed, 29 Nov 2023 00:11:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701245460; cv=none; d=google.com; s=arc-20160816; b=nzQ+Nxv0qgfae9h0m5rwQr58qDvwvtZJkNEat+5P4GYzCCytf+PJWaWqPspRlxwhxF P766NSmrPOezmXksJivrvdJAeo8Wl6ksdNyJEjY7Yi/3imYWoKhsjVUSP05JEbOPuau2 zecxXILKZwKWH7P/ij4FRf1i5e7S0cojZnxEQwoO01kyjxcUKBHmJBmm9Dor42eE7r1q xr5rUw6sls1SrKipIQ1dpyoA/IyD2OXZI/ZAgAMdKrCaJzRFyvQ/HvEvevtpjjxrMPGN aoKIEDXvwYRkopCT3xGOMLwbILmqEQkB1pYoEGYkJt7zurpt8oLnwUDnWiWmBYBuY5IH EkJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:from:subject:mime-version:message-id:date :dkim-signature; bh=cizzxjAOXVtNMhutvuRuFXeQ97rL+0eSPOInOH69jLw=; fh=OxO30iphCJ5T7Q0u7v9RAoN8TrpFE3bNOof1u+XBh30=; b=lrKZRpMz0IQuqtazYkQH9hbCa9qWWPVpxDnCroO/1tiL38jSqDMMGpQwT54Fvedrnw WDxJCmbuQ95YfLSAumolrgGkSWEfIKnlZ196ExkxjqOQU3Lgtg3EaIEn+FZJAWtbxNw/ F2I51KCqSAR7gunZakGg1okwt7Qjpz0vKNbZGkeqKfQIllrjNnlwZdZiIsfB3z4kj9BP U/hczPjd04eJlhEcMWTHpX9g3RhhmJFRo8VSaZoVdNoNL/5+gCNwv2EE6rJWDkg6KSVh RaxWcBVVXjixCwlM4dUpFqZkZqTZIYWpeU23W5ZDERHVYVNtvmfLqtGhCRHVgVRO3eXt qQ6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b="X/snFXEy"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id e12-20020a656bcc000000b00588fa0def2asi14108000pgw.778.2023.11.29.00.10.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 00:11:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b="X/snFXEy"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (Postfix) with ESMTP id 38172807AFD1; Wed, 29 Nov 2023 00:10:35 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229683AbjK2IK0 (ORCPT + 99 others); Wed, 29 Nov 2023 03:10:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229517AbjK2IKY (ORCPT ); Wed, 29 Nov 2023 03:10:24 -0500 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B491D1990 for ; Wed, 29 Nov 2023 00:10:30 -0800 (PST) Received: by mail-yb1-xb49.google.com with SMTP id 3f1490d57ef6-da39d244087so7772996276.3 for ; Wed, 29 Nov 2023 00:10:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1701245430; x=1701850230; darn=vger.kernel.org; h=to:from:subject:mime-version:message-id:date:from:to:cc:subject :date:message-id:reply-to; bh=cizzxjAOXVtNMhutvuRuFXeQ97rL+0eSPOInOH69jLw=; b=X/snFXEy8faZNX6QoGJzhEUbNV1WjZARbZDPCvqBThRN12rlcWhd6juUuU6E+vfzIF HDnaayxQuUF+Wg33rLzJp0HqET17oiK+ooFXT1yuMAzRpaUSIpAwy71YUDItnPoNdh9T zVpN+dx/k/AY3od4+skeLV+Dv3aOsP0PGgniJTo5cvZU2RmfXGZRJgTs1y6szv57iXsj kYThJ24xeEQVP4oG979Pe/oPCrj5/8mHHO/nRFYIGRh6cqVG9y/ZxVlxvWIeetXt9qNC 1q9m9mUF1pCKhbIY3iAntfnnQBzOIHX5QfWv8JNc8DstLN72noFnuMCUiV5TSpzsMoTz lxLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701245430; x=1701850230; h=to:from:subject:mime-version:message-id:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=cizzxjAOXVtNMhutvuRuFXeQ97rL+0eSPOInOH69jLw=; b=dV5iDfYEE5+ZKWtGYWQr5v3oDM6OaRUKV64H39Ogk9tvVw4UQTQD9hobeIjxoV6x5L mtgvvOo00GYFW/zHv+/fu6AODsH6SmRxRpCNdlzaMxbxQ0G/a/M66Jnoa1Yt6L4vIuVp G3C+P/9btHnd4vjHZDeKtJFXh1lbgauZBHPZDtUxIo2SBvMDLn6Tcexxwsk0ZLyNsZIo TousI0ySWkJ+0wdYJ2c6BBYcq+2uIc7YYZWt4oB9RFquJZXQdA/CbFSyc0wxHvXQvKOC MxQiggeaHPZLa93nsVAXBfM750KLI795M/CRdNzsJygmxmGYjj2EeLrATLd77pldJyi/ /pDg== X-Gm-Message-State: AOJu0Yy0NotXAzj2w1ZOxaN5W1FPa5Q4pw/BpZYOAG3Voo03Jrd+S6n1 h8SIbeyrl6XDL/LroQCBwpF6E9kwmb9V X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:763b:80fa:23ca:96f8]) (user=irogers job=sendgmr) by 2002:a25:ca04:0:b0:da3:a91c:7356 with SMTP id a4-20020a25ca04000000b00da3a91c7356mr440438ybg.8.1701245429912; Wed, 29 Nov 2023 00:10:29 -0800 (PST) Date: Wed, 29 Nov 2023 00:10:03 -0800 Message-Id: <20231129081004.1918096-1-irogers@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.43.0.rc1.413.gea7ed67945-goog Subject: [PATCH v1 1/2] 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 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 howler.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 (howler.vger.email [0.0.0.0]); Wed, 29 Nov 2023 00:10:35 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783885159539027759 X-GMAIL-MSGID: 1783885159539027759 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 {