Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp2245578rwl; Fri, 6 Jan 2023 04:02:41 -0800 (PST) X-Google-Smtp-Source: AMrXdXv8X7me1LvTRcPor0GtVZodKN1cGcJ5DIDe+JZzEWymk1PogQiKpN38CCTMEHHXvbjkcVq9 X-Received: by 2002:aa7:9683:0:b0:581:a8dc:8f94 with SMTP id f3-20020aa79683000000b00581a8dc8f94mr31042951pfk.27.1673006561230; Fri, 06 Jan 2023 04:02:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673006561; cv=none; d=google.com; s=arc-20160816; b=E7Vp3YKdh+vsWh6x29ftvqRRyMM0BeI6HpcDjiussbbM7yYmAVn5fDmymWXcp7+2AP +PDO1IGuLhffWq8OxXJoPKAEObU3Ee6KHHdyM82UzIDYrN2QRo5ZTOhcCq9bQXG5qsmH vdH/3fEO36RztCrN851IYk3Hh5o0ktV7czjs554Qiz2ckdKgSzxDlMS6km3lyF4jsdbQ 72VJ7ZMNmTcrTWjceSEiFtKnlPeXv0KTi79cXvdISkQoarKUZvHRu2l8sPaGY+clXHlh kFlp0PzRy67SRcNAPkHUynfbzRvY+KwroY6n2e/10ksDRHWwfagZGItstb2h7z1aJeme Jabg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date:dkim-signature; bh=9De5XMRf3dRd9z2tGHKPiKkbS/au/Q1YHcv9MdmbcHc=; b=GSN2hSQHD1Sxc8CgVex8Fka2SvnFS6EV65JtWZ9R1N0sujpw6GF+EHBVRSqJE/OMID KV3/TWczgT6fjLuYgXojUJ46o2DsFIvya8jGIgl0sMNeMexPwwquWINY6LgTSIOPtlKO r5m+n39qZt/xzqrVTWRo/CeFOQgbaV52sJPP9pRYs4hBhxkgYlQ/+Gp6HhPdboMsZuNh TOiE9Zaq5eozr8a15pUMU8YX0dls+s6ahfFg14MNMeY1w90sCXxo0AUa9qc/hzkwZNI2 b9ZhttdbBx/H6jLVQNW88rgk4alWvYm+6zFuvTwhw4bCzgv2UgXGCtLriXL+v72h2HFW 9R2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DpDlHEHm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f20-20020a056a001ad400b00579f5a64843si1378868pfv.96.2023.01.06.04.02.32; Fri, 06 Jan 2023 04:02:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DpDlHEHm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229586AbjAFL4G (ORCPT + 56 others); Fri, 6 Jan 2023 06:56:06 -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 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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.