linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/5] KVM: PPC: Book3S HV P9: Clear vcpu cpu fields before enabling host irqs
@ 2022-09-08 13:25 Nicholas Piggin
  2022-09-08 13:25 ` [PATCH 2/5] KVM: PPC: Book3S HV P9: Fix irq disabling in tick accounting Nicholas Piggin
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Nicholas Piggin @ 2022-09-08 13:25 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Nicholas Piggin

On guest entry, vcpu->cpu and vcpu->arch.thread_cpu are set after
disabling host irqs. On guest exit there is a window whre tick time
accounting briefly enables irqs before these fields are cleared.

Move them up to ensure they are cleared before host irqs are run.
This is possibly not a problem, but is more symmetric and makes the
fields less surprising.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 arch/powerpc/kvm/book3s_hv.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
index 57d0835e56fd..014575b31651 100644
--- a/arch/powerpc/kvm/book3s_hv.c
+++ b/arch/powerpc/kvm/book3s_hv.c
@@ -4615,6 +4615,9 @@ int kvmhv_run_single_vcpu(struct kvm_vcpu *vcpu, u64 time_limit,
 
 	set_irq_happened(trap);
 
+	vcpu->cpu = -1;
+	vcpu->arch.thread_cpu = -1;
+
 	context_tracking_guest_exit();
 	if (!vtime_accounting_enabled_this_cpu()) {
 		local_irq_enable();
@@ -4630,9 +4633,6 @@ int kvmhv_run_single_vcpu(struct kvm_vcpu *vcpu, u64 time_limit,
 	}
 	vtime_account_guest_exit();
 
-	vcpu->cpu = -1;
-	vcpu->arch.thread_cpu = -1;
-
 	powerpc_local_irq_pmu_restore(flags);
 
 	preempt_enable();
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-10-05  0:16 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-08 13:25 [PATCH 1/5] KVM: PPC: Book3S HV P9: Clear vcpu cpu fields before enabling host irqs Nicholas Piggin
2022-09-08 13:25 ` [PATCH 2/5] KVM: PPC: Book3S HV P9: Fix irq disabling in tick accounting Nicholas Piggin
2022-09-08 13:25 ` [PATCH 3/5] KVM: PPC: Book3S HV: Update guest state entry/exit accounting to new API Nicholas Piggin
2022-09-08 13:25 ` [PATCH 4/5] KVM: PPC: Book3S HV P9: Restore stolen time logging in dtl Nicholas Piggin
2022-09-08 13:25 ` [PATCH 5/5] KVM: PPC: Book3S HV: Implement scheduling wait interval counters in the VPA Nicholas Piggin
2022-10-04 13:26 ` (subset) [PATCH 1/5] KVM: PPC: Book3S HV P9: Clear vcpu cpu fields before enabling host irqs Michael Ellerman
2022-10-05  0:15 ` Michael Ellerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).