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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7F7EBC3DA7A for ; Fri, 6 Jan 2023 11:56:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229837AbjAFL4I (ORCPT ); Fri, 6 Jan 2023 06:56:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229478AbjAFL4E (ORCPT ); Fri, 6 Jan 2023 06:56:04 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4123019C1D for ; Fri, 6 Jan 2023 03:56:00 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D41B1B81C0B for ; Fri, 6 Jan 2023 11:55:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 63228C433EF; Fri, 6 Jan 2023 11:55:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673006157; bh=QJdJJzHA84xosb3/5O3JTakwPPG3EeY41Ynnwj8ARTM=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=DpDlHEHmINK9zh3eUPid8aimfLcqD7iJqhxZBHW/4qxrIS2tC0i/LoM9wnQUOq1p6 EgRUahaB5GEGI9kqdZlwcchwywHKVh5GtTDDR3IWPNnQ02NDJVtYTh+ww+GE96desz s3dgKNfQroNKJQbR0VHNU2pQYtlt6UHvwy40H/qoVbGunW3sPVi881TiJHOrz2ZOyV xQ+dClwSo+18hrE/K2IB8yCfqiUijEyQr4pi5lbdlag8AJeMgL1jJIx4LcXai4XJKE mfTvh8LXf1xoOq4EZHSSSHvXPcZYUftkfuwU7CHG63UGsk7zVlBF9InsgluXV5usha 8LBJW2fo8IzeQ== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1pDlKF-00HGds-4S; Fri, 06 Jan 2023 11:55:55 +0000 Date: Fri, 06 Jan 2023 11:55:54 +0000 Message-ID: <86pmbrop11.wl-maz@kernel.org> From: Marc Zyngier To: Yipeng Zou Cc: , , , , , Subject: Re: [RFC PATCH] irqchip/gic-v3: wait irq done to set affinity In-Reply-To: <20230106082136.68501-1-zouyipeng@huawei.com> References: <20230106082136.68501-1-zouyipeng@huawei.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/28.2 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: zouyipeng@huawei.com, tglx@linutronix.de, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, hewenliang4@huawei.com, chris.zjh@huawei.com, liaochang1@huawei.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 06 Jan 2023 08:21:36 +0000, Yipeng Zou wrote: > > Recently we have some problem about gic set affinity in our test. > > This patch just aim to make some discuss about this problem. > > For now, the implementation of gic set affinity going to take effects > immediately, and without check if any irq are being processed. > > So, This leads to some problem, think about this scenario: > > 1. First, we have an irq was generated by an device. > > 2. In the processing of this irq(after handle event, before clear > IRQD_IRQ_INPROGRESS flag), we modify the route and the gic takes effect > immediately,at the same time the new one was generated again. How is that possible? If it is affected by GICD_IROUTERn (as your patch suggests), then it is a SPI. If it is a SPI, it has an active state. Which means it cannot fire again without a deactivation (EOI if EOImode=0, EOI+DIR if EOImode=1) having taken place. So either something has deactivated the interrupt without masking it beforehand, or the active state is not honoured. Either way, this is wrong. > > 3. The new irq will be processing in other cpu which different form the > old one. > > 4. The new irq going to be discarded because of the flag IRQD_IRQ_INPROGRESS > has been set. > > I notice that if we set IRQF_ONESHOT when register the irq, this problem > will gone. > > But I'm also thinking about change the gic_set_affinity function, to wait > current irq done on all cpus before gic_write_irouter. > I'm not sure if that's appropriate. The base architecture should guarantee that this is not a problem, thanks to the active state. If that was a LPI (which do not have an active state), that'd be a different problem. But this doesn't seem to be the case here. I'm afraid to say that what you describe seem like a bug of some sort, either HW or SW. Thanks, M. -- Without deviation from the norm, progress is not possible.