On Wed, Aug 12, 2026 at 02:57:07PM +0100, Marc Zyngier wrote:
> On Mon, 10 Aug 2026 22:22:37 +0100,
> Karl Mehltretter <[email protected]> wrote:
> > Is this closer to what you had in mind?
> 
> No. I want *all* RDs to be gone on failure, and the next successful
> registration to result in all possible RDs to be matched against a
> vcpu if there are enough of them. Effectively an atomic behaviour from
> the PoV of userspace.
> 
> See the patch below for what I came up with.
> 

Understood. I believe your sketch needs two small adjustments:

free_index must be incremented before kvm_io_bus_register_dev().
If registration fails, the current vCPU already has an RD assignment, but
there is otherwise no increment for the teardown path to undo.

The garbage collection in vgic_v3_free_redist_region() should remain.
VM teardown frees the regions before unregistering the RD iodevs, so
removing it would leave rdreg pointers referring to freed regions.

Does that look OK to you? If so, I could include both in v2.
I'll also split the selftest change and have it check only the
final state after the retry.

Thanks,
Karl

Reply via email to