From: sashiko-bot@kernel.org
To: "Dan Carpenter" <dan@pereq.eu>
Cc: kvmarm@lists.linux.dev, "Oliver Upton" <oupton@kernel.org>,
"Marc Zyngier" <maz@kernel.org>
Subject: Re: [PATCH] KVM: arm64: Drop a pending MMIO access when injecting an unmasked SError
Date: Wed, 25 Nov 2026 12:40:53 +0000 [thread overview]
Message-ID: <sashiko-outbox-233383@kernel.org> (raw)
In-Reply-To: <20261125-serror-drop-mmio-v1-1-48076f59608c@pereq.eu>
Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [High] KVM: arm64: nv: sleep in atomic in kvm_pmu_nested_transition()
during KVM_RUN [1]
--
commit 0b7882ef6381cc8daa05a0be58edf59878cf99df
Author: Dan Carpenter <dan@pereq.eu>
KVM: arm64: Drop a pending MMIO access when injecting an unmasked SError
This commit drops any pending MMIO access in kvm_inject_serror_esr() when
injecting an unmasked SError into a non-protected vCPU without nested
virtualization, matching the emulated exception entry path.
> diff --git a/arch/arm64/kvm/inject_fault.c b/arch/arm64/kvm/inject_fault.c
> index aa2011cc0d5a0..01bc8f098cf6e 100644
> --- a/arch/arm64/kvm/inject_fault.c
> +++ b/arch/arm64/kvm/inject_fault.c
> @@ -386,6 +386,14 @@ int kvm_inject_serror_esr(struct kvm_vcpu *vcpu, u64 esr)
> return 1;
> }
>
> + /*
> + * Like the emulated entry above, an unmasked SError cancels the MMIO
> + * access the vcpu exited on. The host's copy of a protected vcpu's
> + * PSTATE is stale so checking serror_is_masked() doesn't make sense.
> + */
> + if (!vcpu_is_protected(vcpu) && !serror_is_masked(vcpu))
> + vcpu->mmio_needed = false;
> +
> vcpu_set_vsesr(vcpu, esr & ESR_ELx_ISS_MASK);
> *vcpu_hcr(vcpu) |= HCR_EL2_VSE;
> return 1;
[Severity: High]
This problem wasn't introduced by this patch, but can
kvm_inject_serror_esr() sleep in atomic context [1] when routing a
pending SError to vEL2?
kvm_arch_vcpu_ioctl_run() calls kvm_nested_flush_hwstate() with preemption
disabled:
arch/arm64/kvm/arm.c:kvm_arch_vcpu_ioctl_run() {
...
preempt_disable();
if (kvm_vcpu_has_pmu(vcpu))
kvm_pmu_flush_hwstate(vcpu);
kvm_nested_flush_hwstate(vcpu);
...
}
When NESTED_SERROR_PENDING is set and the SError targets vEL2,
kvm_nested_flush_hwstate() calls kvm_inject_serror_esr() ->
kvm_inject_nested_serror() -> kvm_inject_nested() ->
kvm_pmu_nested_transition(). If an enabled PMU counter has different EL1
and EL2 event filters, kvm_pmu_nested_transition() calls
kvm_pmu_create_perf_event(), which calls perf_event_release_kernel() and
perf_event_create_kernel_counter() and sleeps on mutexes while preemption
is disabled.
[1] https://sashiko.dev/#/bug/linux-aa99e2cc-de31-4882-82e9-68786cf22648
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261125-serror-drop-mmio-v1-1-48076f59608c@pereq.eu?part=1
next prev parent reply other threads:[~2026-11-25 12:40 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 12:26 [PATCH] KVM: arm64: Drop a pending MMIO access when injecting an unmasked SError Dan Carpenter
2026-11-25 12:40 ` sashiko-bot [this message]
2026-11-25 12:57 ` Dan Carpenter
2026-11-25 13:52 ` Fuad Tabba
2026-11-27 16:23 ` Dan Carpenter
-- strict thread matches above, loose matches on Subject: below --
2026-11-27 17:52 Dan Carpenter
2026-11-27 18:14 ` sashiko-bot
2026-11-28 8:59 ` Dan Carpenter
2026-11-28 15:42 ` Fuad Tabba
2026-11-28 17:48 ` Dan Carpenter
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=sashiko-outbox-233383@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dan@pereq.eu \
--cc=kvmarm@lists.linux.dev \
--cc=maz@kernel.org \
--cc=oupton@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.