Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp3029389rdb; Mon, 4 Dec 2023 14:46:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IHNAROra/DiwKjjGbKdI3HmY1JP0OsRaGJ1rJm27IqavCTQWcuh1Lw7qxwYDHoNhHiv/Y7/ X-Received: by 2002:a17:903:1c5:b0:1d0:6ffd:adf7 with SMTP id e5-20020a17090301c500b001d06ffdadf7mr2554477plh.94.1701729985216; Mon, 04 Dec 2023 14:46:25 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1701729985; cv=pass; d=google.com; s=arc-20160816; b=YdmMiz1+Btr0gCEbkfDg+upKJ0odmyJdn2q7ol0/Za+ZUTLpo71eE/kbwTaBoYV5/v czo3ODFKwoArBlUCMCo8EQGrYrS21XLiO7QI53WEmieGge1HlnQkU+9+6nD7YrCHreGG KQ0pbKrHDB5CIvq/OrceJn25rHXMjXwQQi2HUVa0jym1g+U7uHFTsVwxlUcGUwuOie5x FMNB+zDa4RSPLESyU1cmnlrCvmStul5+fzHtNn0t9tHOld4Bc7Dhx7rya3i1DK7BLvnb cH8iXWCDAgplvfvMfdVRu+zkRb6yA9HUJs32JoVsOEKlqATMgPIaKLNDvQFaRoW/CI3o r7Rw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date:dkim-signature; bh=WhCVamRV+53hLBG1mG3wlCOZF33LLPkV09hqn+QHwZo=; fh=ZhCBVlnRg/e2FmminEkiqSSn86SA11rB8P2mAIahQI0=; b=isYJWpRK6SeZ+phkXFRhf3LYpfxQBg8kuwa80MOfjJnJlxZpTiCfpSgRiAi0+EdONn 4EUs8prTFEwhqNKQqbFK4NVc92y56Q9zCZ+2sucAGs/3YWaOgn00UmrGlLC5/uFNbKkz +AUsLpz1UQnbRvftOdZZ90taRQWFSjM1xLUIxOgxjtV2fJrE59Hk1PrQ8tLFnQWJYiuh LEleAjSzUQPnPRabGyefcIWRfeXYa/bRg7OBETbbPaPplZum+7FoKZ3tuKOhby+rqmjg 1ngzj/j1fHX+yIk87TEtKOYHOnDW1NCy4rBpLeqlwSHclMgs/UIBvl4O0PZJxz1begsH N4RQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@os.amperecomputing.com header.s=selector2 header.b="oX/eDsKk"; arc=pass (i=1 spf=pass spfdomain=os.amperecomputing.com dkim=pass dkdomain=os.amperecomputing.com dmarc=pass fromdomain=os.amperecomputing.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amperecomputing.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id t12-20020a170902a5cc00b001cfc3295702si8064810plq.109.2023.12.04.14.46.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 14:46:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@os.amperecomputing.com header.s=selector2 header.b="oX/eDsKk"; arc=pass (i=1 spf=pass spfdomain=os.amperecomputing.com dkim=pass dkdomain=os.amperecomputing.com dmarc=pass fromdomain=os.amperecomputing.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amperecomputing.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 8D54F807FCF7; Mon, 4 Dec 2023 14:45:34 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229925AbjLDWpQ (ORCPT + 99 others); Mon, 4 Dec 2023 17:45:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229847AbjLDWpP (ORCPT ); Mon, 4 Dec 2023 17:45:15 -0500 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2119.outbound.protection.outlook.com [40.107.223.119]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2BE79B; Mon, 4 Dec 2023 14:45:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=I2GcGVTUy7Rran3MeffMBZv65/ddAXBN6AnwpEaZt4axT2xKph6Pjk+ujKo2xWrs5p33vPaVOSl+ruSLrrHDExylxsXMh2hC57cK+wLqnLasSlnnOMQIBL3jjHONkR8QLCzT4EjKv6fMbRpvoaQg/eJ0FMBxxIWzVYecy1gPr3uPMmXIxcBbR1kj565CAm5U+13iubixEtXmpWlqs5JiolNYUPNQlnjz1Tus2+dGTSlPb4NED5RehAba55j/ppvX0oarPjolxsbQkePUha709RGKVJ+wHiCUB6En7p8ERbe0KUeXeYvdLoDHehoSFQCxb9I5tpWM0LM/TGEV8UqTgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=WhCVamRV+53hLBG1mG3wlCOZF33LLPkV09hqn+QHwZo=; b=EowWszPyn/PK4yRBwNWQI1z10JvS4Sdrat2X3btIEnO4sLECymX03V0yeI91TT6ioPcgc+kis8mvQahUsmhlMmgiEa0KRFztjjmdxLFWNyoTnlNXX8wQ6nZ3hev9YItnXzJxG8QiXydNlukRpat8SUMr4IxM74u9uhyrkHlpW68izqFESsfmuibxpjveicR4mIuTXFcGLEcjy9Xst2nPq0EPe5NRHr316VlHUeysvdJKQ4rPZrqUFsixt9Djeo/+2ZiDmRWtOKOWONWkl7Lhm/OONIxutRkucqOu2M/vhiaB5J05B+plcsy4hIApUQoDd0v+PA47rxpiZ+E0Jsk8aA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=os.amperecomputing.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WhCVamRV+53hLBG1mG3wlCOZF33LLPkV09hqn+QHwZo=; b=oX/eDsKkt12YkFzOoBiKKdJKr0AChbsVcc0Vd/LXzdr0nSo0v9niRZgtQRAG2Yxww2njvkIfc1ooVYEWm0xVnePJGnY5vJf4G/z8XN1rUEDFMj6UsYgds3SsOQyWf4ri+9FXFd6eVLiUP4FpBDERCTd+3/OO66bhIqHaMSDggLQ= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=os.amperecomputing.com; Received: from DM5PR0102MB3590.prod.exchangelabs.com (2603:10b6:4:a4::25) by SN7PR01MB8116.prod.exchangelabs.com (2603:10b6:806:357::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.34; Mon, 4 Dec 2023 22:45:17 +0000 Received: from DM5PR0102MB3590.prod.exchangelabs.com ([fe80::49fa:8dc0:6fd1:72e6]) by DM5PR0102MB3590.prod.exchangelabs.com ([fe80::49fa:8dc0:6fd1:72e6%4]) with mapi id 15.20.7046.033; Mon, 4 Dec 2023 22:45:16 +0000 Date: Mon, 4 Dec 2023 14:44:54 -0800 (PST) From: Ilkka Koskinen To: Ian Rogers cc: John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Adrian Hunter , Ilkka Koskinen , Kan Liang , Kajol Jain , linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v1 1/2] perf metrics: Avoid segv if default metricgroup isn't set In-Reply-To: <20231204182330.654255-1-irogers@google.com> Message-ID: References: <20231204182330.654255-1-irogers@google.com> Content-Type: text/plain; charset=US-ASCII; format=flowed X-ClientProxiedBy: CH2PR05CA0058.namprd05.prod.outlook.com (2603:10b6:610:38::35) To DM5PR0102MB3590.prod.exchangelabs.com (2603:10b6:4:a4::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR0102MB3590:EE_|SN7PR01MB8116:EE_ X-MS-Office365-Filtering-Correlation-Id: 916ec6fa-26e3-4e0c-3f7f-08dbf51aaf8a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Y3//THX1Zgk6QKSWh2GqWNgZalVbJWOVRArFboXjrImrbA5qMKZGoIomYM0QcDHxN4ZcZAJX9uEMbamyFZE47rvhVUpvHOOcsI6U5Rc4PSKvMFNlpCTs718ggqM53qcZ8thDTGJYGbFUUoLnZrRQ80H8cCfGX6yj4fh88gG6G0BsD2qpi26qDFawQYCwVSUqu78jQc21Q7x0EcxmksyXVohuyTG2Uj43ZA/0ZoAlzilaDCyuoBjP41iJrsTExkwoywYvEOYuLgz7r3p25zD2XfNZLzaSCLWOoLSFLf8V1hw51yOliay1kox5FzNlNoaMHjzC4768fMff9F9lCxCqPiFaprAI7E1a4hIu9lVUq+vtO7QQXKqXQLKXe9UHPdeqve53L43dGZBGugEuzbHrztLf168oYqzBl5sf9v6nD9TVALt3vzWAznhgXXCPoxE0CucFCq0osSN/gD6OPmpvxsA4bJbxOMGmho2cu++47eQhcGVdC4PRwV1lgFQQWmJKwkYLMUhRy3BSNHG6e71SHxFzpKg5vwGZMyvilQppA8knL7JFT2S7fXIkfkxniJ1TsI0bRY31W2Zvj031bpnN2Otsd11KzfPQNtpnUwrrNPt9TBed3jcLlwxU0Lsle/iB X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM5PR0102MB3590.prod.exchangelabs.com;PTR:;CAT:NONE;SFS:(13230031)(346002)(376002)(396003)(136003)(366004)(39850400004)(230922051799003)(1800799012)(64100799003)(451199024)(186009)(26005)(478600001)(6486002)(83380400001)(52116002)(6666004)(6506007)(6512007)(2616005)(316002)(66476007)(6916009)(54906003)(66946007)(66556008)(31686004)(38100700002)(5660300002)(4326008)(86362001)(2906002)(8936002)(8676002)(7416002)(31696002)(38350700005)(41300700001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?K7HtSOay6ufLi8ZoKldM/bPHuFLucsugpcSfmV2M6EP+l0sm7mUqYPRPIBXi?= =?us-ascii?Q?ER7E/Zg8oF9EABRG4cjFOsYkQE2CwIkWgN/4UfN5GMpGOAyhxLnqs+bjrq4A?= =?us-ascii?Q?5q/i/9baoSVh5PG0dXQVmnvZ5MZGmUdMBoedR8hCk1Hf9CbbQWBE9zGTJv0z?= =?us-ascii?Q?dTeVXDDmP6A32ntyVSbCBPZAdL7qsMYsNEj6g/0uWyxOhHViW1gBMhnr1+rI?= =?us-ascii?Q?mUJvfHlO7xkUL+UKNfwGLk1YCCacr4UPFi/ybp2Uocf4653jj8e8niYRQiqE?= =?us-ascii?Q?G9dH7tlZKw4IMMnQmD9OYkM4keKWfbLy/a+hE9Ei8BA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h/9jPiIgPpD4bKeeAdneazDlAgFz7Sx9kC+9q5XUUvaJ+o?= =?us-ascii?Q?tbW9L0xBD0gPuHNE7ntnC7GZ4S7+VdECziIGjkRVrv7og+PZFSUDSEnpLsQF?= =?us-ascii?Q?bYtX29MDP1P4j3dR07xGMiK3JJ3tFslWvCNj/s5qJSUnzIt9YYEXPZksjHg7?= =?us-ascii?Q?8GpHyNvgLo+wNTDZb6mO0LafySViuXahLpDxc+eeK7WWmHWliVllD/HU8562?= =?us-ascii?Q?YEFevZfq+WXKFuGFtkfGLYgSyClvUxYzBW7zRUfpIxu0RQ1SNwLKx01Yh4+h?= =?us-ascii?Q?/vLVd/oORDBYaoXGFOcyISzqc1rDzqEyTYW8OyBNn9MI7gjEq4quksdTCibB?= =?us-ascii?Q?G/fDd3xqLMFXpFtLfp9vNClh9tEd6w6xom1QQU6C0vdaZZEy8TNwgJilVZ3D?= =?us-ascii?Q?7QoFmipYQIuU4uHIqtmWeZQ=3D?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 916ec6fa-26e3-4e0c-3f7f-08dbf51aaf8a X-MS-Exchange-CrossTenant-AuthSource: DM5PR0102MB3590.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Dec 2023 22:45:16.8382 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Ph4yiv1lpWugDtHbFC2cIf97z9yqrG0mY6K86dR9COnlPz+4uLZv0ICotFxdmo0QODfx+evmE6p/ChQW4ni7Onb29cA0XiK8AAXLvWHuMmVQSmHpAsr0NN88QLyC6sjd X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR01MB8116 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.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 (agentk.vger.email [0.0.0.0]); Mon, 04 Dec 2023 14:45:34 -0800 (PST) On Mon, 4 Dec 2023, Ian Rogers wrote: > A metric is default by having "Default" within its groups. The default > metricgroup name needn't be set and this can result in segv in > default_metricgroup_cmp and perf_stat__print_shadow_stats_metricgroup > that assume it has a value when there is a Default metric group. To > avoid the segv initialize the value to "". > > Fixes: 1c0e47956a8e ("perf metrics: Sort the Default metricgroup") > Signed-off-by: Ian Rogers Thanks! I was going to look for the bug but got pulled to other tasks. The patch looks good to me and I tested it successfully on AmpereOne. Reviewed-and-tested-by: Ilkka Koskinen Cheers, Ilkka > --- > tools/perf/util/metricgroup.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tools/perf/util/metricgroup.c b/tools/perf/util/metricgroup.c > index 0484736d9fe4..ca3e0404f187 100644 > --- a/tools/perf/util/metricgroup.c > +++ b/tools/perf/util/metricgroup.c > @@ -225,7 +225,7 @@ static struct metric *metric__new(const struct pmu_metric *pm, > > m->pmu = pm->pmu ?: "cpu"; > m->metric_name = pm->metric_name; > - m->default_metricgroup_name = pm->default_metricgroup_name; > + m->default_metricgroup_name = pm->default_metricgroup_name ?: ""; > m->modifier = NULL; > if (modifier) { > m->modifier = strdup(modifier); > -- > 2.43.0.rc2.451.g8631bc7472-goog > >