From: sashiko-bot@kernel.org
To: "Vishal Chourasia" <vishalc@linux.ibm.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH v3 1/2] KVM: powerpc: Use generic xfer to guest work function
Date: Thu, 09 Jul 2026 06:52:47 +0000 [thread overview]
Message-ID: <20260709065247.955031F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260709062940.1679427-4-vishalc@linux.ibm.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Lockdep assertion failure in xfer_to_guest_mode_prepare() due to mismatched IRQ state on BookE architecture after emulated MTMSRWE.
--
--- Patch [1]: [PATCH v3 1/2] KVM: powerpc: Use generic xfer to guest work function ---
commit ad7243cc79a6e34d4784ae75e8ea35ce946a8343
Author: Vishal Chourasia <vishalc@linux.ibm.com>
KVM: powerpc: Use generic xfer to guest work function
This commit updates powerpc KVM run loops to use generic infrastructure for
checking and handling pending task_work before guest entry. It replaces
open-coded need_resched() checks and adds xfer_to_guest_mode_prepare() to
disable IRQs and handle TIF_NOTIFY_RESUME properly.
> diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
> index 00302399fc37b..be5e48ae0c6c2 100644
> --- a/arch/powerpc/kvm/powerpc.c
> +++ b/arch/powerpc/kvm/powerpc.c
> @@ -81,23 +81,41 @@ int kvmppc_prepare_to_enter(struct kvm_vcpu *vcpu)
> int r;
>
> WARN_ON(irqs_disabled());
> + /*
> + * local_irq_disable() first: on 32-bit, hard_irq_disable() alone is a
> + * raw MSR[EE] clear that bypasses the lockdep/irq-tracing state, and
> + * the xfer_to_guest_mode helpers assert IRQs are seen as disabled.
> + */
> + local_irq_disable();
> hard_irq_disable();
>
> while (true) {
> - if (need_resched()) {
> + xfer_to_guest_mode_prepare();
[Severity: High]
Can this trigger a lockdep assertion failure on BookE architecture?
When a BookE guest executes mtmsr to set the MSR_WE bit, it enters an idle
state and invokes kvmppc_core_prepare_to_enter(). This function enables
lockdep IRQs but disables hardware IRQs using a macro that bypasses lockdep
on 32-bit:
arch/powerpc/kvm/booke.c:kvmppc_core_prepare_to_enter() {
...
if (vcpu->arch.shared->msr & MSR_WE) {
local_irq_enable();
kvm_vcpu_halt(vcpu);
hard_irq_disable();
...
r = 1;
}
}
If kvmppc_core_prepare_to_enter() returns 1, the while loop later in
kvmppc_prepare_to_enter() continues:
arch/powerpc/kvm/powerpc.c:kvmppc_prepare_to_enter() {
...
if (kvmppc_core_prepare_to_enter(vcpu)) {
/* interrupts got enabled in between, so we
are back at square 1 */
continue;
}
}
This continues back to the start of the loop and invokes the newly added
xfer_to_guest_mode_prepare() check. Since hard_irq_disable() bypassed the
lockdep state update, lockdep still believes IRQs are enabled. Will this
cause xfer_to_guest_mode_prepare() to fail its lockdep_assert_irqs_disabled()
check and trigger a splat?
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260709062940.1679427-2-vishalc@linux.ibm.com?part=1
next prev parent reply other threads:[~2026-07-09 6:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-09 6:29 [PATCH v3 0/2] KVM: powerpc: Use generic xfer to guest work function Vishal Chourasia
2026-07-09 6:29 ` [PATCH v3 1/2] " Vishal Chourasia
2026-07-09 6:52 ` sashiko-bot [this message]
2026-07-09 6:29 ` [PATCH v3 2/2] powerpc: enable to run posix cpu timers in task context Vishal Chourasia
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260709065247.955031F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=vishalc@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox