Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Jia He" <justin.he@arm.com>
Cc: kvmarm@lists.linux.dev, kvm@vger.kernel.org,
	"Oliver Upton" <oupton@kernel.org>,
	"Marc Zyngier" <maz@kernel.org>
Subject: Re: [PATCH v5 3/3] KVM: arm64: selftests: Add a test for VNCR_EL2 translation faults
Date: Sat, 05 Dec 2026 10:53:54 +0000	[thread overview]
Message-ID: <sashiko-outbox-251419@kernel.org> (raw)
In-Reply-To: <20261205103844.3405166-4-justin.he@arm.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] KVM: selftests: unconditional timed_out check races with SIGALRM
  in run_test()
--

commit 71d18da73eeef8268f65e690d36a5bf0724d34b9
Author: Jia He <justin.he@arm.com>

KVM: arm64: selftests: Add a test for VNCR_EL2 translation faults

This commit adds a new arm64 KVM selftest, nv_vncr_abort, that exercises
VNCR_EL2 translation faults from a nested context with read-write and
read-only page tables and hardware access-flag management.

> diff --git a/tools/testing/selftests/kvm/arm64/nv_vncr_abort.c b/tools/testing/selftests/kvm/arm64/nv_vncr_abort.c
> new file mode 100644
> index 0000000000000..017bc63cf99c4
> --- /dev/null
> +++ b/tools/testing/selftests/kvm/arm64/nv_vncr_abort.c
> @@ -0,0 +1,260 @@

[ ... ]

> +	timed_out = 0;
> +	TEST_ASSERT(!setitimer(ITIMER_REAL, &arm, NULL), "setitimer failed");
> +	do {
> +		ret = __vcpu_run(vcpu);
> +		err = errno;
> +	} while (ret && err == EINTR && !timed_out);
> +	TEST_ASSERT(!setitimer(ITIMER_REAL, &disarm, NULL),
> +		    "setitimer disarm failed");
> +
> +	if (timed_out)
> +		TEST_FAIL("%s: vCPU made no progress in %ds (%lu exits)",
> +			  mode_name[mode], TIMEOUT_SEC,
> +			  vcpu_get_stat(vcpu, exits));
> +	errno = err;
> +	TEST_ASSERT(!ret, KVM_IOCTL_ERROR(KVM_RUN, ret));

[Severity: Low]
Can a late SIGALRM falsely fail a completed __vcpu_run() here?

ITIMER_REAL stays armed until the second setitimer() call completes, so
SIGALRM can still fire after __vcpu_run() has already returned 0 (or a
non-EINTR error):

run_test()
  ret = __vcpu_run(vcpu)        /* returns 0 */
  <SIGALRM>
    sigalrm_handler()
      timed_out = 1
  setitimer(ITIMER_REAL, &disarm, NULL)
  if (timed_out)
    TEST_FAIL(...)              <-- false timeout failure

Checking (ret && err == EINTR && timed_out) ensures a timeout is only
reported when __vcpu_run() was actually interrupted by the timer, and
avoids masking a non-EINTR KVM_RUN error.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261205103844.3405166-1-justin.he@arm.com?part=3

  reply	other threads:[~2026-12-05 10:53 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-05 10:38 [PATCH v5 0/3] KVM: arm64: nv: VNCR page mapping fixes Jia He
2026-12-05 10:38 ` [PATCH v5 1/3] KVM: arm64: nv: Locate the VNCR page in the host page from its PA Jia He
2026-12-05 10:38 ` [PATCH v5 2/3] KVM: arm64: nv: Inject an SEA when the VNCR walk cannot set the AF Jia He
2026-12-05 10:38 ` [PATCH v5 3/3] KVM: arm64: selftests: Add a test for VNCR_EL2 translation faults Jia He
2026-12-05 10:53   ` sashiko-bot [this message]
2026-12-05 11:28     ` Justin He
2026-12-05 11:40       ` Marc Zyngier
2026-12-05 11:48         ` Justin He

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-251419@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=justin.he@arm.com \
    --cc=kvm@vger.kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox