From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1EB69CD1292 for ; Thu, 11 Apr 2024 07:37:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:Message-ID:In-Reply-To: Subject:cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=2yNE57QVOG5nVzGIdOiOWHvElbe6a0HL3lAxZ9HlSkc=; b=lv/xX2ZgWWmhC61RGiObdWfjqk NPguz3FsBSpiBQCov9KFtyuT9aMRxMtVRbXfe0YHv6qTs/Ff+loY56mQaCo4CiwpjbWcftp+S3orb +04rAgsMnEYW2AWRGb7eQ2wV3s9tm6J5GRt1fxR3w9Brur35qeOOWRnK/5jUiHMtH/w6QF04OB1wa 4tsHSbtaOlqb7lx3/xh5AjrCZ3l2NeO8/YnOSfGC6gjXYdaxc/Mce0hcSDa1FWhdj9ltNX66/w7u6 vpTXUmpeLHJ4njBDCCdgzg+74Oy+edkVkYvWqrCGe3jbPIKPus4aUM7CXfxB3Q6Y0T1tthg8WrVYO CXfLUvgw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1ruozR-0000000Asl6-1lxV; Thu, 11 Apr 2024 07:36:57 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1ruoyx-0000000Ascs-3F3a for linux-arm-kernel@bombadil.infradead.org; Thu, 11 Apr 2024 07:36:27 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=MIME-Version:Content-Type:References: Message-ID:In-Reply-To:Subject:cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=IsjRxTukVO31/H0pxAgtJqiJgotGfkdrQFMshdFsx7Y=; b=cXasNQJKBbEtmkFf3csfjdiEEV G4XOVXyl/tKoKDYmnwTVJOUqPVW/dxF7rcn2l/5wdgP40TIoZkuv2K7dA3CpEj06pmxBSJx1mqCJA 6qRdcLrMrka/zRUoX3JvFO1zCiO9TLTwPseFxQ0OCQ8Qzh7arTn76Fa4UunttcD/udkFTs8tP0tgj R2yOlHAgcZD420hQJyHUHzNeM384IZ6UWv0YfmORG7MTA3EbnxtNbtiUG1dAnziNz8pjIl7xSarXd uZVIlLX6Ou2BENle685neGHD/uDqaaKLJFwsv1g0pfDCKnsP5O2Sd0WYQzm12Cy/AQ8Ku9PWH1oz4 7WePYJLQ==; Received: from mail-mw2nam12on20701.outbound.protection.outlook.com ([2a01:111:f403:200a::701] helo=NAM12-MW2-obe.outbound.protection.outlook.com) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1ruoym-00000008ST6-0YA1 for linux-arm-kernel@lists.infradead.org; Thu, 11 Apr 2024 07:36:25 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IGX7aDi0ewMv7rGtu/gPdg9qQqrFo6Fk/0aMv+dwVPzwaRJfbQ7FnzldvXnDoQrmnmhbHlTCn4L58yGK/AM4S1VPg7N60JaWPe2xc/W6OAFbfv1EHx+GbwV09Rh9Lou+1s02Oe47wOq0ikOixU+ZRUnVMWqP7yWDnPx6F5Cb5HLKzEIMl+/ypsXa2eGMGdQHqpAEcmQ3v7Bxf1UDixzhf9ggxhcDq5+HLDsJB58dfe0M0sL30reB/5cGXhFL/g43yrpULY8T06ntYKZjkQhhAHU5MFO54BC2NlYwu3z1yl1o/Ghg064TFZBYpgTJ4L5AhzdB66YOMs7cHdGb9jchmw== 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=IsjRxTukVO31/H0pxAgtJqiJgotGfkdrQFMshdFsx7Y=; b=WOo2+lUf6cQbxXPvThPja2grxXTfVaoHtkulJ9IshC9czBaWk0zyaLr2hPxkvM7UeMLpDmXA4kvnzk0MIhG8lT99rjQ71zdkYfY+ldheb26CKLO+kPtVFZceuT+6VL5JWNDyd/Zz2REZbmILP56oC/cnXguuHH3VQMNIOaeQlR6+l0eXSDsLb+kvR08EfFU0MSW57ZzdoiSgwBCDD5Rx40hXYPQEW3Cc0OOjEY6/w5HuPfwgzbkEMoczfGCaiyzKITdzDTU3Lrwilw+0uh2uFDecWH4srLQFeoZhgE1owktgZJJTllDMEwU1ktpG54ZlqWPu3B5wZt4+mIqftc5P8g== 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=IsjRxTukVO31/H0pxAgtJqiJgotGfkdrQFMshdFsx7Y=; b=qEHvKVVGKWL9VCMKTDdnzWCarnTnVa2r7cqyIyglHOCHvHYvn+cJCjSSoflHVDKeOUdYR5JSBXdnLorl+0aQGExaY/3icomezDBLZc4gKlKzMapMisbiFRknvUAjofF06gDW4Snlvm8H97htHmXesqxDUKChMlYUchMs9hBZ7Ww= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=os.amperecomputing.com; Received: from BL0PR01MB4226.prod.exchangelabs.com (2603:10b6:208:49::30) by CYYPR01MB8411.prod.exchangelabs.com (2603:10b6:930:bc::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46; Thu, 11 Apr 2024 07:35:55 +0000 Received: from BL0PR01MB4226.prod.exchangelabs.com ([fe80::12be:916:b914:8b26]) by BL0PR01MB4226.prod.exchangelabs.com ([fe80::12be:916:b914:8b26%7]) with mapi id 15.20.7409.042; Thu, 11 Apr 2024 07:35:55 +0000 Date: Thu, 11 Apr 2024 00:35:44 -0700 (PDT) From: Ilkka Koskinen To: Robin Murphy cc: Ilkka Koskinen , Besar Wicaksono , Suzuki K Poulose , Will Deacon , Mark Rutland , Raag Jadav , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] perf: arm_cspmu: Don't touch interrupt registers if no interrupt was assigned In-Reply-To: <726d6946-6fc8-4c53-86ad-385ab24fa4c7@arm.com> Message-ID: References: <20240307193104.58302-1-ilkka@os.amperecomputing.com> <042bbb32-481e-40d8-a46a-472b724ec33f@arm.com> <89d7ff41-ce2a-fd95-ebfc-4df914efd4c8@os.amperecomputing.com> <8fdfceb2-90b3-a1a9-fa88-a45ece30c0bb@os.amperecomputing.com> <726d6946-6fc8-4c53-86ad-385ab24fa4c7@arm.com> X-ClientProxiedBy: CH0PR03CA0078.namprd03.prod.outlook.com (2603:10b6:610:cc::23) To BL0PR01MB4226.prod.exchangelabs.com (2603:10b6:208:49::30) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL0PR01MB4226:EE_|CYYPR01MB8411:EE_ X-MS-Office365-Filtering-Correlation-Id: 0445d817-3157-48d6-67ed-08dc59fa059b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: f5AFC97lLGglH/6Fheaubu7z41NpKxpCu6KJQRxgAzE3mASpTnW/uQ7VHzMoQpCuIBXNSrg8a/b3tVNfB2Ou9+eE1aOfANTN9AKdIOiwZO6p/l7UhZVFIar/gjOa+uS/P4fYlpy23mgR/GzwA8ZG/9JXGbJFmQN+lx2pwuZzWaUQ2U6ZWzg9pW8VIPS3gmJrdU+x9TslluHJq+HHDUhQFvGoFjtRH8s432N1DtPbe0NvMDVoNmcCspagWudZJZ1igEZypQxpSb6PyzaYhtLBxhFElkx9nmfGWL6Q6xYErT51/rKzdpI+5dKTB4pyT+eqnmoEUXhsV2VQshw7D3tIWUogqvwQR12FJr6SyMujXabfMf4aDm4ZJkw3HpE3rZFW7x1doVgILod0rbmplkIdnjeGhbOuAZbUHFHm/XLJkro/x5L67fmLXFjVHzr0D++fN+M/Ov0+Y+fW83IgVA9qb5ARs5wF00sYqHDST1Uh6O86PND7AOTFDM9LmCuK9OWtq/zy6I4sM5/wue1RH+Wcw03ineEmji4CFQy6ahbYtwXazs9vvXpMgUGacOoAdajzLP5IuE3OerzuLxu/F4nrOxaMsDjOHxBQHbiExVgGHQ+5tRueDusZSn/6oH+dhQh8zIIDSGxjou3ChfF8xoLvaGgMLLW+dou+PfmqthuOoRqtYHvziJnqF47a8ENfOiLrlwCzA57hg8pOlr4aZa0lRoskf7z5gj5pfH9jklorXmU= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BL0PR01MB4226.prod.exchangelabs.com;PTR:;CAT:NONE;SFS:(13230031)(366007)(376005)(1800799015)(52116005)(38350700005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-Ant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sCJ+6+NXD22NLoyG9fouHa9sVsRF+WDYXwQn?= =?us-ascii?Q?cElODQcX9bxfbJz+YnOfGiIObEavZTtKl1p+pqXmSA5+AGk6nx2354tjkbek?= =?us-ascii?Q?3KMlOOHypCpT/0BVPF95gaVNrYdza7agFu2C/afQbBqW+53y44KO8KTcKMuu?= =?us-ascii?Q?CS19h7doZL6dOPaIJQiH73VsrGMoul3sSVjM83FjTO8ZT2anceNBqujRBMv0?= =?us-ascii?Q?6o5P5GhiOPu2AvVpjyMdjxsVVrQrx0p8FjKccdOCFy+07cqweEA8VnfD3Rnr?= =?us-ascii?Q?1tu+axvMCao0SIQqhTXstQSliQVijzIQ9N3ypPJHff0hOFa9GGd61fvIUw2k?= =?us-ascii?Q?iJd+EkjwUOshWuniGwhv5o+W8TjQX1vcfgHLmiMk8M4DNuVTAW+Hx2hddzCT?= =?us-ascii?Q?AgXAm5+MOtHlsbZXyyMmGHiIxE+EM8r0ypcvagpaNXeaVa7Yg0FgUKUP7OVz?= =?us-ascii?Q?uFgCYj7mxnTElrl5/z5qoxmW057bKOljlzUtyWBAATabL/Xlne6+dpUAZ6nX?= =?us-ascii?Q?7VgD45dZTsdORu6ddrePkTIkVrGBmBxDiqd7FoinQ1y1qD2IJI/euDhB7zxf?= =?us-ascii?Q?l4bkRz85CvC5NVe0BqiaVEFYz2PONojZvX4tU+33DQu1tG64C7QV0NrQLizU?= =?us-ascii?Q?AJoTE2225c0dKxkfMjsLcZb/d/zTHgpzy2t+WfGsU7ZCWTsOIki23C6oqcBW?= =?us-ascii?Q?3Itz6ks3U7X3kxZMsVaITTEbvuppX7Ip+gMuCBf79q6tBHEfD47io4CJhTOG?= =?us-ascii?Q?pugYBqN0eLyyag7MsPbJ480=3D?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0445d817-3157-48d6-67ed-08dc59fa059b X-MS-Exchange-CrossTenant-AuthSource: BL0PR01MB4226.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Apr 2024 07:35:55.1945 (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: 7xBj3ur0cod0l/Vym9Ku+x1qmm1H+ddG2tT1cBeL6OHnYiUBZZjUSciJnFPRsIy2bjuiRbdw5gA4jD3STONemgkweZyJQa72Kd0wz9WuCg7Zgpeic32dNbMFFIIUy74N X-MS-Exchange-Transport-CrossTenantHeadersStamped: CYYPR01MB8411 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240411_083617_079043_91D5A63C X-CRM114-Status: GOOD ( 25.21 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, 9 Apr 2024, Robin Murphy wrote: > On 09/04/2024 2:05 am, Ilkka Koskinen wrote: >> >> On Mon, 8 Apr 2024, Robin Murphy wrote: >>> On 2024-04-05 11:33 pm, Ilkka Koskinen wrote: >>>> >>>> On Fri, 5 Apr 2024, Robin Murphy wrote: >>>>> On 2024-03-07 7:31 pm, Ilkka Koskinen wrote: >>>>>> The driver enabled and disabled interrupts even if no interrupt was >>>>>> assigned to the device. >>>>> >>>>> Why's that a concern - if the interrupt isn't routed anywhere, surely it >>>>> makes no difference what happens at the source end? >>>> >>>> The issue is that we have two PMUs attached to the same interrupt line. >>>> Unfortunately, I just don't seem to find time to add support for shared >>>> interrupts to the cspmu driver. Meanwhile, I assigned the interrupt to >>>> one of the PMUs while the other one has zero in the APMT table. >>> >>> I suspected something like that ;) >>> >>>> Without the patch, I can trigger "ghost interrupt" in the latter PMU. >>> >>> An occasional spurious interrupt should be no big deal. If it ends up as a >>> screaming spurious interrupt because we never handle the overflow >>> condition on the "other" PMU, then what matters most is that we never >>> handle the overflow, thus the "other" PMU is still useless since you can't >>> assume the user is going to read it frequently enough to avoid losing >>> information and getting nonsense counts back. So this hack really isn't a >>> viable solution for anything. >> >> IIRC, what happens is that kernel will disable the interrupt eventually due >> to unhandled spurious interrupts making the "working" PMU also useless. > > Indeed, but if having one inaccurate PMU is fine, having more than one is no > big deal either, right? The moral of the story is that hacking the firmware > to lie about the hardware is just not a great idea. Depends on the use case, of course :D > > TBH it's always seemed a bit broken that we allow probing without an IRQ but > then have no accommodation for overflow if so. Fixing that would be a good > thing in itself, and would at least have the side-effect of allowing your > hack to work, however much I may disapprove of that :) > > FWIW it is still lingering some way down my to-do list to factor out the > fiddly IRQ-sharing/migration code into at least a helper library (if not > further into perf core itself) before it gets copy-pasted much more, and it > occurs to me that I could then easily factor the IRQ-substitute timer > approach from e.g. arm-ccn into that as well... The more I think about it the > more I might just convince myself that I want it for the driver I'm currently > working on and justify bumping it up the list, let's see... That sounds like a great idea. Even plain helper library would keep the drivers a lot cleaner. Cheers, Ilkka _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel