Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Fuad Tabba <fuad.tabba@linux.dev>
To: Dan Carpenter <dan@pereq.eu>
Cc: "Marc Zyngier" <maz@kernel.org>,
	"Oliver Upton" <oupton@kernel.org>,
	"Joey Gouly" <joey.gouly@arm.com>,
	"Steffen Eiden" <seiden@linux.ibm.com>,
	"Suzuki K Poulose" <suzuki.poulose@arm.com>,
	"Zenghui Yu" <yuzenghui@huawei.com>,
	"Catalin Marinas" <catalin.marinas@arm.com>,
	"Will Deacon" <will@kernel.org>,
	"Mark Rutland" <mark.rutland@arm.com>,
	"Karthik Bhargavan" <karthik@pereq.eu>,
	"Clément Blaudeau" <clement@cryspen.com>,
	linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev,
	"Fuad Tabba" <tabba@google.com>
Subject: Re: [PATCH] KVM: arm64: Drop a pending MMIO access when injecting an unmasked SError
Date: Sat, 28 Nov 2026 15:42:50 +0000	[thread overview]
Message-ID: <20261128154250.3059937-1-fuad.tabba@linux.dev> (raw)
In-Reply-To: <20261127-serror-drop-mmio-v2-v1-1-96bd01bef6d8@pereq.eu>

Hi Dan,

On Fri, 27 Nov 2026 17:52:37 +0000, Dan Carpenter <dan@pereq.eu> wrote:
[...]
> diff --git a/arch/arm64/kvm/inject_fault.c b/arch/arm64/kvm/inject_fault.c
[...]
> @@ -396,6 +396,13 @@ 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.
> +        */
> +       if (!(*vcpu_cpsr(vcpu) & PSR_A_BIT))
> +               vcpu->mmio_needed = false;

This is the check I suggested on v1, but after taking a closer look I
found an issue with the drop itself, which I missed then.

With the access dropped, the vcpu runs the same instruction again with
the vSError pending, and the instruction faults at stage 2 again. For
the first instruction after an exception return, R_RBZYL in the ARM ARM
states:

  If the first instruction after the Context synchronization event
  generates a synchronous exception, the architecture does not define
  whether the PE takes the asynchronous exception or the synchronous
  exception first.

If the PE takes the abort first, the vcpu exits on the same access
again and the next KVM_RUN completes it. The emulated entry isn't
affected, since KVM emulates it before the vcpu runs.

So I don't think the drop can be relied on, and I'd leave the code as
it is. Could you instead make your selftest not depend on whether the
access completes for a vcpu without EL2?

Regarding Sashiko's finding, that isn't an issue, since NMEA doesn't
affect a virtual SError. The description of SCTLR2_EL1.NMEA reads "This
field has no effect on the masking of virtual and delegated SError
interrupts."

Cheers,
/fuad


  reply	other threads:[~2026-11-28 15:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-27 17:52 [PATCH] KVM: arm64: Drop a pending MMIO access when injecting an unmasked SError Dan Carpenter
2026-11-28 15:42 ` Fuad Tabba [this message]
2026-11-28 17:48   ` Dan Carpenter
  -- strict thread matches above, loose matches on Subject: below --
2026-11-25 12:26 Dan Carpenter
2026-11-25 13:52 ` Fuad Tabba
2026-11-27 16:23   ` 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=20261128154250.3059937-1-fuad.tabba@linux.dev \
    --to=fuad.tabba@linux.dev \
    --cc=catalin.marinas@arm.com \
    --cc=clement@cryspen.com \
    --cc=dan@pereq.eu \
    --cc=joey.gouly@arm.com \
    --cc=karthik@pereq.eu \
    --cc=kvmarm@lists.linux.dev \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=mark.rutland@arm.com \
    --cc=maz@kernel.org \
    --cc=oupton@kernel.org \
    --cc=seiden@linux.ibm.com \
    --cc=suzuki.poulose@arm.com \
    --cc=tabba@google.com \
    --cc=will@kernel.org \
    --cc=yuzenghui@huawei.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