On Fri, 25 Oct 2024 18:31:01 +0100, Yu Zhao <yuzhao@xxxxxxxxxx> wrote: > > On Fri, Oct 25, 2024 at 10:15 AM Marc Zyngier <maz@xxxxxxxxxx> wrote: > > > > On Fri, 25 Oct 2024 06:07:45 +0100, > > Yu Zhao <yuzhao@xxxxxxxxxx> wrote: > > > > > > Hi Marc, > > > > > > On Tue, Oct 22, 2024 at 9:03 AM Marc Zyngier <maz@xxxxxxxxxx> wrote: > > > > > > > > On Mon, 21 Oct 2024 05:22:15 +0100, > > > > Yu Zhao <yuzhao@xxxxxxxxxx> wrote: > > > > > > > > > > @@ -1407,6 +1418,13 @@ static void gic_ipi_send_mask(struct irq_data *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. > > Thanks for clarifying. > > > Offline CPUs are not known to the kernel. > > 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. -- Without deviation from the norm, progress is not possible.