From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 487792076A9 for ; Tue, 29 Oct 2024 19:02:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730228545; cv=none; b=fPSBT0xgv6Bw2GgZZW1cmHNV99J9QAorI6UA4oiPs17uXnfgJISj0u0U0S1nbRjCAg6eSqL5T90VYqhHVzeMvhAvonjTxne9NhD91fiVwyiUvEOdv5HC/C9xCLcBmOMqm0NQ2C+eLI2yU+2fkG2MyL5HyWfW8c/mpVu7tIFiJLA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730228545; c=relaxed/simple; bh=c3B6zM0g76ktl69lbL9/91FTBSkAtle6ro7RJaPmxWY=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=b79pWkKigIyAzvCr9ykPRSZ9BLUi3/iTz4TkUhlNPXVErOdih1/ZpTlQGsgU1fz5p9nJYBjaYVk+I4ZK1Gms/dDtaxGHwdzh8KTyCVZmT2NC1H0+igEj9bvfyxyr9YHX2UndQNRNJNCDjHi1lM92jzpDGXsbVt12ws831RJGkB0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=WzubmDqO; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="WzubmDqO" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C982CC4CECD; Tue, 29 Oct 2024 19:02:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1730228544; bh=c3B6zM0g76ktl69lbL9/91FTBSkAtle6ro7RJaPmxWY=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=WzubmDqOVvPIBDYTPKHnrbCuEngf55eh4KgIMF7AzODVZnGA9G3qv7CutXGTGPFDh Y3Xgo9b8ryQSaeDVbedWE0IY5mb54FNHd8Y/23J+WxqbhW9N4GpQFyaW8Y6UbCNSI1 GpyGgSH1fhyiGFd/K5dhdImQbZCRePwY5fZyT5yA5YurAl4lkPfc2iTeqy3q6RBSUf 9ZtVkKTF6/4MPKHOqsRAVMnwUDHZzIW70vVHhWERB8oDKx6WHHvrdvqtyEIjFlwgsE Qu2w98WUF+iz6cVlwLSsutRUrtRlyTw3f5PNtLgXwn8ACG1326UI/ikDEzOJYo2WZu 5JYXxP0zh4cfw== 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 1t5rTy-0081t7-Pc; Tue, 29 Oct 2024 19:02:22 +0000 Date: Tue, 29 Oct 2024 19:02:22 +0000 Message-ID: <864j4u3f7l.wl-maz@kernel.org> From: Marc Zyngier To: Yu Zhao Cc: Andrew Morton , Catalin Marinas , Muchun Song , Thomas Gleixner , Will Deacon , Douglas Anderson , Mark Rutland , Nanyong Sun , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH v1 3/6] irqchip/gic-v3: support SGI broadcast In-Reply-To: References: <20241021042218.746659-1-yuzhao@google.com> <20241021042218.746659-4-yuzhao@google.com> <86a5ew41tp.wl-maz@kernel.org> <86h6902m7y.wl-maz@kernel.org> 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/29.4 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: yuzhao@google.com, akpm@linux-foundation.org, catalin.marinas@arm.com, muchun.song@linux.dev, tglx@linutronix.de, will@kernel.org, dianders@chromium.org, mark.rutland@arm.com, sunnanyong@huawei.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false On Fri, 25 Oct 2024 18:31:01 +0100, Yu Zhao wrote: >=20 > On Fri, Oct 25, 2024 at 10:15=E2=80=AFAM Marc Zyngier wr= ote: > > > > On Fri, 25 Oct 2024 06:07:45 +0100, > > Yu Zhao wrote: > > > > > > Hi Marc, > > > > > > On Tue, Oct 22, 2024 at 9:03=E2=80=AFAM Marc Zyngier = wrote: > > > > > > > > On Mon, 21 Oct 2024 05:22:15 +0100, > > > > Yu Zhao wrote: > > > > > > > > > > @@ -1407,6 +1418,13 @@ static void gic_ipi_send_mask(struct irq_d= ata *d, const struct cpumask *mask) > > > > > */ > > > > > dsb(ishst); > > > > > > > > > > + cpumask_copy(&broadcast, cpu_present_mask); > > > > > > > > Why cpu_present_mask? I'd expect that cpu_online_mask should be the > > > > correct mask to use -- we don't IPI offline CPUs, in general. > > > > > > This is exactly because "we don't IPI offline CPUs, in general", > > > assuming "we" means the kernel, not GIC. > > > > > > My interpretation of what the GIC spec says ("0b1: Interrupts routed > > > to all PEs in the system, excluding self") is that it broadcasts IPIs= to > > > "cpu_present_mask" (minus the local one). So if the kernel uses > > > "cpu_online_mask" here, GIC would send IPIs to offline CPUs > > > (cpu_present_mask ^ cpu_online_mask), which I don't know whether it's > > > a defined behavior. >=20 > Thanks for clarifying. >=20 > > Offline CPUs are not known to the kernel. >=20 > I assume it wouldn't matter to firmware either, correct? IOW, we Firmware is on the secure side of the stack. > wouldn't cause firmware any trouble by letting GIC send IPIs to > (cpu_present_mask ^ cpu_online_mask), assuming those two masks can be > different on arm64 when hotplug is enabled? You can't send SGIs from non-secure to secure using ICC_SGI1R_EL1. You would need to use ICC_ASGI1R_EL1, and have secure to allow such brokenness via a configuration of GICR_NSACR. Linux doesn't use the former, and no sane software touches the latter. M. --=20 Without deviation from the norm, progress is not possible.