Re: [PATCH 21/21] KVM: TDX: Handle vCPU dissociation
From: Edgecombe, Rick P
Date: Tue Sep 10 2024 - 20:17:57 EST
On Tue, 2024-09-10 at 12:45 +0200, Paolo Bonzini wrote:
> On 9/4/24 05:07, Rick Edgecombe wrote:
> > +/*
> > + * A per-CPU list of TD vCPUs associated with a given CPU. Used when a CPU
> > + * is brought down to invoke TDH_VP_FLUSH on the appropriate TD vCPUS.
>
> ... or when a vCPU is migrated.
It would be better.
>
> > + * Protected by interrupt mask. This list is manipulated in process
> > context
> > + * of vCPU and IPI callback. See tdx_flush_vp_on_cpu().
> > + */
> > +static DEFINE_PER_CPU(struct list_head, associated_tdvcpus);
>
> It may be a bit more modern, or cleaner, to use a local_lock here
> instead of just relying on local_irq_disable/enable.
Hmm, yes. That is weird. If there is some reason it at least deserves a comment.
>
> Another more organizational question is whether to put this in the
> VM/vCPU series but I might be missing something obvious.
I moved it into this series because it intersected with the TLB flushing
functionality. In our internal analysis we considered all the TLB flushing
scenarios together. But yes, it kind of straddles two areas. If we think that
bit is discussed enough, we can move it back to its original series.