Re: [PATCH 21/21] KVM: TDX: Handle vCPU dissociation

From: Paolo Bonzini
Date: Tue Sep 10 2024 - 06:46:41 EST


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.

+ * 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.

Another more organizational question is whether to put this in the VM/vCPU series but I might be missing something obvious.

Paolo