On 16/11/2026 10:51, Lorenzo Pieralisi wrote:
On Mon, Nov 16, 2026 at 11:51:04AM +0530, Aneesh Kumar K.V wrote:
Marc Zyngier maz@kernel.org writes:
On Fri, 06 Nov 2026 15:45:29 +0000, Aneesh Kumar K.V aneesh.kumar@kernel.org wrote:
Marc Zyngier maz@kernel.org writes:
On Wed, 04 Nov 2026 16:45:55 +0000, "Aneesh Kumar K.V (Arm)" aneesh.kumar@kernel.org wrote:
VPE L1 tables are allocated from the CPU-starting callback, where sleeping is not allowed. Remove the page allocation from this atomic path.
Use a blocking allocation for the boot CPU and record the resulting table order. Allocate a page of that order from the sleepable CPU hotplug prepare stage for each secondary CPU. Consume the preallocated page only when the CPU cannot inherit an existing redistributor or ITS table.
Reclaim unused preallocations after the CPU reaches the online state, and from the prepare-state teardown when CPU bring-up aborts.
No. The way to do it is to move the ITS probing out of the non-sleepable CPU hotplug path.
I proposed a potential hack at [1] (which I find far more palatable than this proposal), but the real fix is to probe the ITSs as devices.
Could you share a bit more detail on what you have in mind?
Are you suggesting that we create a platform device for each ITS and initialize it through the driver's probe callback, while the rest of the GIC initialization stays in the existing early boot path?
Would that mean the main GIC is operational during early boot, while ITS-dependent features, such as MSI delivery and direct injection, become available after the ITS devices probe?
Is that the split you have in mind?
Yes. Then once this is done, all the tables become normal DMA allocations, for which there should already be adequate support.
Thanks for confirming. Can we handle the ITS platform-device conversion and the switch to DMA allocations in a separate series?
The existing VPE L1 allocation path calls set_memory_decrypted() from the non-sleepable CPU-starting callback, even though set_memory_decrypted() can sleep. This issue predates the shared-granule allocator changes.
If I may ask, why does the existing code ends up calling set_memory_decrypt(), or reworded, why does the VPE L1 allocation path goes through the ITS specific allocation function rather than using alloc_pages() (as it was before b08e2f42e86b5) ?
Because it needs to be accessible to the GIC "hardware". In this case the GIC is emulated by the hypervisor and the hypervisor for a realm can only see the unprotected memory.
Now I agree this is a little academic in practise because Linux (as a hypervisor) will not expose RVPEID - so allocate_vpe_l1_table() will early out. IIUC this would only actually be relevant in the case of nested virtualisation within a realm guest - which is a long way off if it ever happens.
Why did b08e2f42e86b5 patched allocate_vpe_l1_table() allocation and moved it to using its_alloc_pages() ?
In that commit I simply changed all the allocation paths which were allocating memory to be visible to the GIC to use the new allocator. As we "know" that the GIC can only access "decrypted" memory. Admittedly that could easily change in the future - but my expectation is that it will only change with the switch to GICv5.
Of course what I missed was that this specific allocation uses GFP_ATOMIC and that set_memory_decrypted() can sleep. This wouldn't have shown up on any testing because of the early exit:
if (!gic_rdists->has_rvpeid) return 0;
Thanks, Steve
Thanks, Lorenzo
Since fixing this properly needs a broader ITS rework, can we handle that separately and drop the preallocation patch from this series?
-aneesh