Re: [PATCH v2 1/3] KVM: arm64: Add helper vgic_write_guest_lock()

From: Gavin Shan
Date: Thu Jan 26 2023 - 19:03:57 EST


Hi Oliver,

On 1/27/23 7:20 AM, Oliver Upton wrote:
On Fri, Jan 20, 2023 at 07:44:03AM +0800, Gavin Shan wrote:
Currently, the unknown no-running-vcpu sites are reported when a
dirty page is tracked by mark_page_dirty_in_slot(). Until now, the
only known no-running-vcpu site is saving vgic/its tables through
KVM_DEV_ARM_{VGIC_GRP_CTRL, ITS_SAVE_TABLES} command on KVM device
"kvm-arm-vgic-its". Unfortunately, there are more unknown sites to
be handled and no-running-vcpu context will be allowed in these
sites: (1) KVM_DEV_ARM_{VGIC_GRP_CTRL, ITS_RESTORE_TABLES} command
on KVM device "kvm-arm-vgic-its" to restore vgic/its tables. The
vgic3 LPI pending status could be restored. (2) Save vgic3 pending
table through KVM_DEV_ARM_{VGIC_GRP_CTRL, VGIC_SAVE_PENDING_TABLES}
command on KVM device "kvm-arm-vgic-v3".

In order to handle those unknown cases, we need a unified helper
vgic_write_guest_lock(). struct vgic_dist::save_its_tables_in_progress
is also renamed to struct vgic_dist::save_tables_in_progress. Besides,
"asm/kvm_mmu.h" needs to be included for "vgic.h" for the definition
of kvm_write_guest_lock().

No functional change intended.

Suggested-by: Oliver Upton <oliver.upton@xxxxxxxxx>
Signed-off-by: Gavin Shan <gshan@xxxxxxxxxx>
---
arch/arm64/kvm/vgic-sys-reg-v3.c | 1 +
arch/arm64/kvm/vgic/vgic-irqfd.c | 1 +
arch/arm64/kvm/vgic/vgic-its.c | 13 +++++--------
arch/arm64/kvm/vgic/vgic-mmio-v2.c | 1 +
arch/arm64/kvm/vgic/vgic-mmio.c | 1 +
arch/arm64/kvm/vgic/vgic-v4.c | 1 +
arch/arm64/kvm/vgic/vgic.c | 1 +
arch/arm64/kvm/vgic/vgic.h | 13 +++++++++++++
include/kvm/arm_vgic.h | 2 +-
9 files changed, 25 insertions(+), 9 deletions(-)

You wouldn't have to add the include all around the shop if you instead
just stuck it in vgic.h...

Having said that, we really ought to get a fix in for this sooner rather
than later. I just hit it myself testing kvmarm/next.

Marc, could you take care of the include fix when applying?


I've posted v3 to have a separate PATCH[1/4] where the header file inclusions
are handled, to save Marc's valuable time. After 'kvm_mmu.h' is included to
'vgic.h', the duplicate inclusions of 'kvm_mmu.h' needs to be removed. A separate
patch would make the follow-up patches clean.

https://lore.kernel.org/kvmarm/20230126235451.469087-1-gshan@xxxxxxxxxx/T/#t

Thanks,
Gavin