diff options
author | Sean Christopherson <[email protected]> | 2023-08-08 16:31:31 -0700 |
---|---|---|
committer | Sean Christopherson <[email protected]> | 2023-08-17 11:31:37 -0700 |
commit | 4c08e737f056fec930b416a2bd37ed266d724f95 (patch) | |
tree | 8ab5a24ad447e097c18c69b86c01b00b38518a97 /lib/memory-notifier-error-inject.c | |
parent | a85cd52d720588b0060a0ebac5c7f497ad6bcd86 (diff) |
KVM: SVM: Take and hold ir_list_lock when updating vCPU's Physical ID entry
Hoist the acquisition of ir_list_lock from avic_update_iommu_vcpu_affinity()
to its two callers, avic_vcpu_load() and avic_vcpu_put(), specifically to
encapsulate the write to the vCPU's entry in the AVIC Physical ID table.
This will allow a future fix to pull information from the Physical ID entry
when updating the IRTE, without potentially consuming stale information,
i.e. without racing with the vCPU being (un)loaded.
Add a comment to call out that ir_list_lock does NOT protect against
multiple writers, specifically that reading the Physical ID entry in
avic_vcpu_put() outside of the lock is safe.
To preserve some semblance of independence from ir_list_lock, keep the
READ_ONCE() in avic_vcpu_load() even though acuiring the spinlock
effectively ensures the load(s) will be generated after acquiring the
lock.
Cc: [email protected]
Tested-by: Alejandro Jimenez <[email protected]>
Reviewed-by: Joao Martins <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Sean Christopherson <[email protected]>
Diffstat (limited to 'lib/memory-notifier-error-inject.c')
0 files changed, 0 insertions, 0 deletions