Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp1462325rdb; Tue, 30 Jan 2024 21:53:19 -0800 (PST) X-Google-Smtp-Source: AGHT+IE4WjqgqedXK8o30j4ESTaCQB13iGHl1u11pgh+WhGvj5KtsHKxNIoI2hJnMTqf8EbRZL5m X-Received: by 2002:a17:906:24cf:b0:a2d:52dc:1841 with SMTP id f15-20020a17090624cf00b00a2d52dc1841mr365756ejb.18.1706680399761; Tue, 30 Jan 2024 21:53:19 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVd/3sb9GmiuBpf9pDRRF7cjpEKE8HiW5UMphxOm9rymFoydsB8KfY/IwPn9qaFQhj8Msedgb34gzi3Go7Uad/PNW/jTBwGWD/OyHv28Q== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id hb5-20020a170906b88500b00a36854f63absi49559ejb.958.2024.01.30.21.53.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 21:53:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-45788-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=g1a8a6ov; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-45788-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45788-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 5CE741F281DA for ; Wed, 31 Jan 2024 05:53:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D04883D99B; Wed, 31 Jan 2024 05:52:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="g1a8a6ov" Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2064.outbound.protection.outlook.com [40.107.20.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 869243F8D8; Wed, 31 Jan 2024 05:52:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.20.64 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706680340; cv=fail; b=U3yt+qhXbrWJrw3nZ7sAL83QO0WXoLrRSX/zEyzbGxxp65fTC503sDaiVI5DoR1Exq5HsuaRgkxnHCacMmYntHiBnpoN/dWXxY2RVfJL4ldLbbjm956++BsoVyd/k+zxeDqeN0X20wBNyPSnkGuXmA31pQfPdhACBm5IJmve2Ww= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706680340; c=relaxed/simple; bh=T5fxuPF5b3VlmbxwO7pcQHKiMfW9oQTchAan1ngMoCM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=R5jPZMJrhNH2xaBlfFMXvab8YW+Vkc+uIC6x476dd7nop4ps4nk/oakWaocCq61NQ0woANASHDZl2uQ1XzEk0MZtfxzJbrWQhiWvYsYOixOCw5J5l3+NxiqTmE5dx1hL5fGLVOY0pkv+DWn4CZvTadrk+7D010YdBRHfhJ7NCfo= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=g1a8a6ov; arc=fail smtp.client-ip=40.107.20.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OED9MNAHo553+XSYURE0q4Kz+A0hHnePjcb0Gv93LQMQ1PT66/tR5dYh3fUuU2OlcOJ0d+rx1XEzdTnsXox7i0WQjcpiPOb5W0wkOeC6RvYVD5TMZarWKUsQ9bTbQj1K9BYwF/tzXEAqtJzmhGNBqsTbdiM/eYA2cuHkkvbrybVDh89j30EhiHpK7rLCmL7G6lcktwBjHEe51kTdS2ysfRfjEjyGnjbmFQRutUJ2BPI4SPMKhDIJiQxCbtmJxty33Mh+Z03qzRkHBocN9ZTgFIIjovmfynKCrMMfvb4c9NppLu+s3xCRyRjiCpOoY9YFrnwc/2155gju1aiGDCETXQ== 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=JxE+kbGqvwFdqguUylkKC9s3foHLtB9G/N8s8DJ5+Z8=; b=PlucF3x0eDoVhPMCfJk+dv+4XT/ZODRtegc8jOLb7qQ55mf6SJmXWZ/BDZgB7H5onC6UlK7uaQ5dhawba0OiFy6wesHqAVYcaYFCMBAjKeIKZUabXy6SSR7SUOQF4ENzz8QkFFMWGq0BnFuJMs1qRmud5lCAO9HEsdtnduBsy5XHos0o0VnwTOPSc15WpqXqP6ur3hnd69hnYa+Y2EpeFbiASeJ2dYhHLNAc0cnREY7I2h30b4QOh5YTjJa9jXkl22arv8hi/23SosQQJ9E+oUWsmczoadXxkbKNb/5hw5k4vWMMaxvl+9J0t3Ac3jY+b9lvDjRzLjDSxQFArjFCmQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=JxE+kbGqvwFdqguUylkKC9s3foHLtB9G/N8s8DJ5+Z8=; b=g1a8a6ov6/a9up0vgc7CYF7SHGL7PAI7rO6EU0RR7f00Y0P2P84zCDItOTXqyqOvTkui0t5mJAzIxhUYDbO7HzeQW3/NislU/n+toK4JOM7uzC/QJvPua/hoSDy9lxqiEDS7NEb8Lni8SJmWDEUUW5xUiWP1/SxH/zSf5bhWKEE= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from DU2PR04MB8822.eurprd04.prod.outlook.com (2603:10a6:10:2e1::11) by DU2PR04MB8917.eurprd04.prod.outlook.com (2603:10a6:10:2e0::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.24; Wed, 31 Jan 2024 05:52:15 +0000 Received: from DU2PR04MB8822.eurprd04.prod.outlook.com ([fe80::d45f:4483:c11:68b0]) by DU2PR04MB8822.eurprd04.prod.outlook.com ([fe80::d45f:4483:c11:68b0%7]) with mapi id 15.20.7228.029; Wed, 31 Jan 2024 05:52:15 +0000 From: Xu Yang To: Frank.li@nxp.com, will@kernel.org, mark.rutland@arm.com, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, john.g.garry@oracle.com, jolsa@kernel.org, namhyung@kernel.org, irogers@google.com Cc: linux-imx@nxp.com, mike.leach@linaro.org, leo.yan@linaro.org, peterz@infradead.org, mingo@redhat.com, acme@kernel.org, alexander.shishkin@linux.intel.com, adrian.hunter@intel.com, xu.yang_2@nxp.com, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, imx@lists.linux.dev Subject: [PATCH v4 5/6] perf: imx_perf: limit counter ID from user space and optimize counter usage Date: Wed, 31 Jan 2024 13:58:10 +0800 Message-Id: <20240131055811.3035741-5-xu.yang_2@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240131055811.3035741-1-xu.yang_2@nxp.com> References: <20240131055811.3035741-1-xu.yang_2@nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SI2PR02CA0041.apcprd02.prod.outlook.com (2603:1096:4:196::20) To DU2PR04MB8822.eurprd04.prod.outlook.com (2603:10a6:10:2e1::11) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PR04MB8822:EE_|DU2PR04MB8917:EE_ X-MS-Office365-Filtering-Correlation-Id: b34f514c-3b21-4c2e-7fba-08dc2220c732 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: W2zP3yQPR++QiuuQ6qe6Q/D/0Bx8xFOp6I0eZ1QDImrXdRTnXMtfGiCTc8ROPlbNd1b32uDV5Sir7lIFFGuPgPY2iI2x0XUJfnLWtaSf8Js49yyYOBf8T7CwbgzmHULaeuRjPke600d2HTF5Io2qHlHwSwUcEr9n63xU4tLylCH16litDLYMe89oCQRusYNq+845JpHLcSDzt+RKpTK31WM6qiVQNdDFt/bRHwiaThO/aGtH60V6cGV0Y5KJVANhyn1fK8oMsBWHitxPzKHY1JsT5kk75c4cZhKbSRwkLCr7X2wf4u3hyWZQ1jLBTD67x6uZozLJ7UZJv4npPmOzfA8kdxmMrndmR3PNFUePeYkpGDlp/2x6g04HPyimA7TUN5xisIRZL/M8U8PRi45sjElnm0qWe2xHaus5Oi/OwI/oxA8k84hat31t4gVPMI50Tgxi4KCNLvhANXAqkCezn1vZXcoJphuJTBzbYLpR/CSwYX1XCmof3rmAfsKMm6xsy7SW0EXX9sW+p8LfiHgDJ26mOd8UDy8XF/Hc/E2Bb0sDcNWS784na2P2p6WubbQxYMtFGOLq70W1y2If3EuQWjBNA4IY8GwZyNFs7ilJlhAVZcBDNWpla0QTWXsfsV6Swk5GlKCgfV6Juo3AF+Keew== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU2PR04MB8822.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(136003)(39860400002)(376002)(396003)(366004)(346002)(230922051799003)(64100799003)(186009)(451199024)(1800799012)(38350700005)(2906002)(36756003)(41300700001)(921011)(66946007)(66556008)(66476007)(316002)(86362001)(6666004)(2616005)(1076003)(6512007)(52116002)(6506007)(26005)(478600001)(83380400001)(6486002)(5660300002)(38100700002)(8936002)(8676002)(7416002)(4326008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?Ufg9od1pygUSCJAeNbBaQDJmM//ZUKpr06D3FQw52XHVShsbwFArt11ZVNiv?= =?us-ascii?Q?GV8EIDrMUzcGFvaKJaKlzd57S5anuvJ+XKaFqMYZ/h8ZlhS9gFd4eP48jK6e?= =?us-ascii?Q?1TogpCg4oQAO1rFNRK0mwqUaEg86d9dEpVDjUGDwZhw9VW8VMyKJoztwcF59?= =?us-ascii?Q?PeIt2Y5QqZrUNL6pO3f70Ti4FglrWzdXZrxKEviAacUNtjkrWruOudGt9Xmd?= =?us-ascii?Q?Q9M8HllbUk45MwTrfSd4kVHssYZnj6IvqIt9j3fvaAU7BctEhUFuY/MLTmDn?= =?us-ascii?Q?ZGMjMmpSeayOJ7wSBuTE5B5OC647A7hXCpl11FC6YJasD7muYW32elrqH7wf?= =?us-ascii?Q?xLGjqCFivzwbLyCNrNpUKZGaF2tWvkgmZoUhCL01jzSzhMhvDDS9vWmhxDTB?= =?us-ascii?Q?FGxCPpM6jOcCmE1lOh+dR6WXZoBz+GpnVFIy6S79/5HgnR3EJUa7aQdEv1ff?= =?us-ascii?Q?gNE+qfhO93DZpDB89ymUBzhDFgRGCF0ouphS/LAYczCsvgsYKmWPNMdCB5JP?= =?us-ascii?Q?bfdD+tRYFwRIFXxDSXCzG3SFwZqoCgVZqmccOkrvWTbdRm9g4Ny6aSi9e//h?= =?us-ascii?Q?WnUpyKOZGoeYor6pEpx2WvXdPJvfH0c6qpuK0m8fia5HhBA0E0KA44qFhAZR?= =?us-ascii?Q?zLvNq2YbNBwS4tnp/o0xTkoCxwDONd/oVG8bLXe2ifW6PP0zPmzlJ0Rqys4A?= =?us-ascii?Q?Yk87UYW5AC2h2tf8wgVX9eCEJwAj6Fqq5cz1Cnbdq7U32cYJH1f2sHovuuyo?= =?us-ascii?Q?an0C14oS573u40yBO6LULfaFz+ZZXLgzJXDdbVE6p4BTNMnu5y/BP3JctNfh?= =?us-ascii?Q?cNeXqIGVUeToZzByw7m7BnMuskSnsFuyhXUeWk3BKaIMjAp6cEMitThoB8CA?= =?us-ascii?Q?BxbUPtaHI527QfOnxKoU8lVsAqPujW9HfVBOQSV76oVHVGmwyiiywzwcXRHt?= =?us-ascii?Q?A62Yw3nam3PBjw/bXhrIzBDqBLzpc4M6ZJ6m9T8+7cQRvESO2vaRCWYnihUQ?= =?us-ascii?Q?BTqOnIQvFw5bgprtop9bzNklfDgVpM7XteSj/vugrsgzMZKg93GYZv53oN51?= =?us-ascii?Q?df347l9yvqPkUhMb8yglyU1F4R+NAYRhFkdOV9+MH96pw2VvZruPtraktUmD?= =?us-ascii?Q?nj/1XeVjkSw/zu3P3ZspoKiLn1t6p2TX7iio9FhKRvgf4K5YQ6gNLvhVgQ42?= =?us-ascii?Q?GtoolWRTCqN13zTWNjppeBjbIYKhZfQpp/Gad/BEO8nRcklRreXNKVX/byY0?= =?us-ascii?Q?YJl14tDfzLwveZ8NsPCHAaFmR+yQlo6G7QN11io2Nk7TSpfnYmtgf1TSEudB?= =?us-ascii?Q?+mNtnkrxnjKu3e/7fLVi8/xpUhWK8KtLpnkW7+2pHQmOVVJPFD31UgyGowDw?= =?us-ascii?Q?5a5VmzqGvZJbux5rVS6gu49KsfoEyvaoZJcjcM73HY/HoDcmTg4D5HxWTwtP?= =?us-ascii?Q?yuzhM1fH4PCgKdLOyPGpojdDGvE/4HULk+EWnDB6vEvpTz8XixQNDPGjZe5l?= =?us-ascii?Q?zM9yliFBhQ8FNxWTomhPRsFv7BPWGaQs1XOt3g8ZSs3TLjAwskNsQg8jZa4l?= =?us-ascii?Q?Hv0IxDcgI7xd2keBjy5wXsYWy7OHVeN9gvWt4xYt?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b34f514c-3b21-4c2e-7fba-08dc2220c732 X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8822.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Jan 2024 05:52:15.7731 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: tg2VMKrPwC7vjfs25GieTCub/iNKYUpz8kd8ncHyf6fHG+reCeoJE/J5SXxj2BLDA/HFB/9zh4xxjUvY0Z64eg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8917 The user can pass any counter ID to perf app. However, current pmu driver doesn't judge the validity of the counter ID. This will add necessary check for counter ID from user space. Besides, this pmu has 10 counters except cycle counter which can be used to count reference events and counter specific evnets. This will also add supports to auto allocate counter if the user doesn't pass it the perf. Then, the usage of counter will be optimized. Signed-off-by: Xu Yang --- Changes in v2: - limit counter ID from user to 0-10 - combine dynamic and static allocation of counter Changes in v3: - no changes Changes in v4: - rename ddr_perf_is_specific_event() - use macro definitions to parse config attr --- drivers/perf/fsl_imx9_ddr_perf.c | 72 +++++++++++++++++++++++++++++++- 1 file changed, 71 insertions(+), 1 deletion(-) diff --git a/drivers/perf/fsl_imx9_ddr_perf.c b/drivers/perf/fsl_imx9_ddr_perf.c index 94041f06c152..e71496809c52 100644 --- a/drivers/perf/fsl_imx9_ddr_perf.c +++ b/drivers/perf/fsl_imx9_ddr_perf.c @@ -51,6 +51,7 @@ #define NUM_COUNTERS 11 #define CYCLES_COUNTER 0 +#define CYCLES_EVENT_ID 0 #define CONFIG_EVENT_MASK 0x00FF #define CONFIG_EVENT_OFFSET 0 @@ -240,6 +241,19 @@ static struct attribute *ddr_perf_events_attrs[] = { NULL, }; +/* + * An event is either reference evnet or counter specific event. + * For counter specific event, the event count will only be incremented + * on the corresponding counter. + */ +static bool ddr_perf_is_counter_specific_event(int event) +{ + if (event >= 64 && event <= 73) + return true; + else + return false; +} + static const struct attribute_group ddr_perf_events_attr_group = { .name = "events", .attrs = ddr_perf_events_attrs, @@ -514,6 +528,7 @@ static int ddr_perf_event_init(struct perf_event *event) struct ddr_pmu *pmu = to_ddr_pmu(event->pmu); struct hw_perf_event *hwc = &event->hw; struct perf_event *sibling; + int event_id, counter; if (event->attr.type != event->pmu->type) return -ENOENT; @@ -526,6 +541,18 @@ static int ddr_perf_event_init(struct perf_event *event) return -EOPNOTSUPP; } + counter = (event->attr.config & CONFIG_COUNTER_MASK) >> CONFIG_COUNTER_OFFSET; + if (counter > NUM_COUNTERS) { + dev_warn(pmu->dev, "Only counter 0-10 is supported!\n"); + return -EINVAL; + } + + event_id = (event->attr.config & CONFIG_EVENT_MASK) >> CONFIG_EVENT_OFFSET; + if (ddr_perf_is_counter_specific_event(event_id) && counter == 0) { + dev_err(pmu->dev, "Need specify counter for counter specific events!\n"); + return -EINVAL; + } + /* * We must NOT create groups containing mixed PMUs, although software * events are acceptable (for example to create a CCN group @@ -559,6 +586,39 @@ static void ddr_perf_event_start(struct perf_event *event, int flags) hwc->state = 0; } +static int ddr_perf_alloc_counter(struct ddr_pmu *pmu, int event, int counter) +{ + int i; + + if (event == CYCLES_EVENT_ID) { + /* + * Always map cycle event to counter 0. + * Cycles counter is dedicated for cycle event + * can't used for the other counters. + */ + if (pmu->events[CYCLES_COUNTER] == NULL) + return CYCLES_COUNTER; + } else if (counter != 0) { + /* + * 1. ddr_perf_event_init() will make sure counter + * is not 0 for counter specific events. + * 2. Allow specify counter for referene event too. + */ + if (pmu->events[counter] == NULL) + return counter; + } else { + /* + * Counter may be 0 if user doesn't specify it. + * Auto allocate counter for referene event. + */ + for (i = 1; i < NUM_COUNTERS; i++) + if (pmu->events[i] == NULL) + return i; + } + + return -ENOENT; +} + static int ddr_perf_event_add(struct perf_event *event, int flags) { struct ddr_pmu *pmu = to_ddr_pmu(event->pmu); @@ -566,10 +626,18 @@ static int ddr_perf_event_add(struct perf_event *event, int flags) int cfg = event->attr.config; int cfg1 = event->attr.config1; int cfg2 = event->attr.config2; - int counter; + int event_id, counter; + event_id = (cfg & CONFIG_EVENT_MASK) >> CONFIG_EVENT_OFFSET; counter = (cfg & CONFIG_COUNTER_MASK) >> CONFIG_COUNTER_OFFSET; + /* check if counter is available or needs to allocate one */ + counter = ddr_perf_alloc_counter(pmu, event_id, counter); + if (counter < 0) { + dev_dbg(pmu->dev, "There are not enough counters\n"); + return -EOPNOTSUPP; + } + pmu->events[counter] = event; pmu->active_events++; hwc->idx = counter; @@ -604,9 +672,11 @@ static void ddr_perf_event_del(struct perf_event *event, int flags) { struct ddr_pmu *pmu = to_ddr_pmu(event->pmu); struct hw_perf_event *hwc = &event->hw; + int counter = hwc->idx; ddr_perf_event_stop(event, PERF_EF_UPDATE); + pmu->events[counter] = NULL; pmu->active_events--; hwc->idx = -1; } -- 2.34.1