On 9/4/26 2:50 PM, Christian Zigotzky wrote:

On 04 September 2026 at 10:56 Christian Zigotzky <[email protected]> wrote:

On 03 September 2026 at 07:23 Shrikanth Hegde <[email protected]> wrote:

Friendly LLM analysis says preemption is enabled too early and before
completing kvmppc_handle_exit_hv() / kvmppc_handle_nested_exit()

Below is ONLY a speculation and completely UNTESTED.
Maybe worth a try.

---
diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
index 0409ac9e7b31..78d2b0618887 100644
--- a/arch/powerpc/kvm/book3s_hv.c
+++ b/arch/powerpc/kvm/book3s_hv.c
@@ -5049,8 +5049,6 @@ int kvmhv_run_single_vcpu(struct kvm_vcpu *vcpu, u64 
time_limit,

       powerpc_local_irq_pmu_restore(flags);

-       preempt_enable();
-
       /*
        * cancel pending decrementer exception if DEC is now positive, or if
        * entering a nested guest in which case the decrementer is now owned
@@ -5072,6 +5070,8 @@ int kvmhv_run_single_vcpu(struct kvm_vcpu *vcpu, u64 
time_limit,
       }
       vcpu->arch.ret = r;

+       preempt_enable();
+
       if (is_kvmppc_resume_guest(r) && !kvmppc_vcpu_check_block(vcpu)) {
               kvmppc_set_timer(vcpu);


Michal

- - -

Michal,

Sorry, I meant Shrikanth.


Leave that patch, it was only a speculation.


Is this patch also for the issues with KVM PR and KVM HV if PREEMPT is 
activated?

The entire FSL Cyrus+ board freezes when using KVM HV with PREEMPT.


You have any logs? can you try with latest code? maybe 7.2? there is usage
of generic api to handle the work now which renders the patch shared long back
which you tried irrelevant.

The guest kernel doesn't boot if we use KVM PR with a PREEMPT kernel on
the PA Semi Nemo board.

Bug report: https://github.com/chzigotzky/kernels/issues/19

Thanks,
Christian



Reply via email to