All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oliver Upton <oupton@kernel.org>
To: Wei-Lin Chang <weilin.chang@arm.com>
Cc: kvmarm@lists.linux.dev, Marc Zyngier <maz@kernel.org>,
	Joey Gouly <joey.gouly@arm.com>,
	Suzuki K Poulose <suzuki.poulose@arm.com>,
	Zenghui Yu <yuzenghui@huawei.com>,
	stable@vger.kernel.org, Sashiko <sashiko-bot@kernel.org>
Subject: Re: [PATCH RESEND v2 3/5] KVM: arm64: nv: Re-translate VNCR before injecting abort
Date: Thu, 18 Jun 2026 14:52:24 -0700	[thread overview]
Message-ID: <ajRomJ-Y3EOxJUU-@kernel.org> (raw)
In-Reply-To: <yw6b7zx2qxjckkut4lzkuqekh2omttwmulvqbslk27wt3vu6mp@ostr7avq6a7e>

Hey Wei-Lin,

Sorry for the latency on my end.

On Wed, Jun 10, 2026 at 02:46:18PM +0100, Wei-Lin Chang wrote:
> Just a comment using this thread:
> 
> While reading this, I found this part of the code (not this patch in
> particular) a little bit difficult to reason about. I think it's because
> kvm_translate_vncr() is doing many things, and there are multiple
> potential failure reasons e.g. s1 walk fault, no memslot, gmem/user mem
> faultin errors, MMU notifier check, etc., and they are all mux'ed into
> an error code with some context visible by the caller.
> 
> So in kvm_handle_vncr_abort() we demux the error code and handle the
> errors with the help of the context (vt, is_gmem). We essentially have
> to keep track of what error codes correspond to what error reasons.
> 
> Do you think it is better if we refactor and handle the errors when they
> occur? Like inject the exception back to vEL2 right after getting the
> results of __kvm_translate_va(), and finish up the abort handling there.
> Same for other cases.
> 
> I can try it out and make it concrete if you also think this is
> reasonable. Probably after this series gets applied when the comments
> from Marc & Sashiko are addressed. (I reviewed and don't have additional
> comments though.)

Yeah, returning error codes for 'normal' behavior is extremely difficult
to work with. TBH, I'd rather we go a step further and rework the whole
software PTW to only return errors in the case that we have to report it
to userspace.

Otherwise, aborted walks due to guest behavior should ideally return 1
and and inspect the walk result to differentiate between a successful /
aborted translation.

Thanks,
Oliver

  reply	other threads:[~2026-06-18 21:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-09 18:55 [PATCH RESEND v2 0/5] KVM: arm64: nv: Even more VNCR fixes Oliver Upton
2026-06-09 18:55 ` [PATCH RESEND v2 1/5] KVM: arm64: nv: Respect read-only PFN when mapping L1 VNCR Oliver Upton
2026-06-09 18:55 ` [PATCH RESEND v2 2/5] KVM: arm64: nv: Inject SEA if kvm_translate_vncr() can't resolve PFN Oliver Upton
2026-06-09 18:55 ` [PATCH RESEND v2 3/5] KVM: arm64: nv: Re-translate VNCR before injecting abort Oliver Upton
2026-06-10 12:42   ` Marc Zyngier
2026-06-10 13:46   ` Wei-Lin Chang
2026-06-18 21:52     ` Oliver Upton [this message]
2026-06-09 18:55 ` [PATCH RESEND v2 4/5] KVM: arm64: nv: Inject SEA if guest VNCR isn't normal memory Oliver Upton
2026-06-09 18:55 ` [PATCH RESEND v2 5/5] KVM: arm64: nv: Mark VM as bugged for unexpected VNCR abort Oliver Upton

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=ajRomJ-Y3EOxJUU-@kernel.org \
    --to=oupton@kernel.org \
    --cc=joey.gouly@arm.com \
    --cc=kvmarm@lists.linux.dev \
    --cc=maz@kernel.org \
    --cc=sashiko-bot@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=suzuki.poulose@arm.com \
    --cc=weilin.chang@arm.com \
    --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 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.