mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Oliver Upton <oupton@kernel.org>
To: Fuad Tabba <fuad.tabba@linux.dev>
Cc: maz@kernel.org, kvmarm@lists.linux.dev,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, catalin.marinas@arm.com,
	will@kernel.org, joey.gouly@arm.com, seiden@linux.ibm.com,
	suzuki.poulose@arm.com, yuzenghui@huawei.com,
	vdonnefort@google.com, qperret@google.com, tabba@google.com
Subject: Re: [PATCH v4] KVM: arm64: selftests: Check the pending SError state in external_aborts
Date: Tue, 6 Oct 2026 06:17:26 -0700	[thread overview]
Message-ID: <asT05hZqkMvVVnze@kernel.org> (raw)
In-Reply-To: <20261006092841.2202109-1-fuad.tabba@linux.dev>

On Tue, Oct 06, 2026 at 10:28:41AM +0100, Fuad Tabba wrote:
> None of the external abort tests look at the vCPU events once the guest
> is done, so an SError left pending after the guest took it, or dropped
> while the guest had it masked, goes unnoticed.
> 
> Read the vCPU events back at the end of every test that runs the guest.
> The SError must still be pending in the masked case, with the injected
> ESR when the vCPU has RAS, and no SError, injected or spurious, may be
> pending in any of the others.
> 
> Signed-off-by: Fuad Tabba <fuad.tabba@linux.dev>

Reviewed-by: Oliver Upton <oupton@kernel.org>

Thanks,
Oliver

> ---
> The check that no SError is left pending after the guest took it is
> what fails without commit 3708f6342f01 ("KVM: arm64: Sync HCR_EL2.VSE
> back to the host vCPU under pKVM"), in kvmarm/next.
> 
> Changes since v3 [1]:
> - Check the SError pending state at the end of every test that runs the
>   guest, and assert it is still pending, with the injected ESR, in the
>   masked case (Oliver [2]).
> 
> [1] https://lore.kernel.org/all/20261005050349.836795-1-fuad.tabba@linux.dev/
> [2] https://lore.kernel.org/all/asNdAXGkxagm88Su@kernel.org/
> 
>  .../selftests/kvm/arm64/external_aborts.c     | 20 +++++++++++++++++++
>  1 file changed, 20 insertions(+)
> 
> diff --git a/tools/testing/selftests/kvm/arm64/external_aborts.c b/tools/testing/selftests/kvm/arm64/external_aborts.c
> index 7836756a38a6c..1a858d0d82968 100644
> --- a/tools/testing/selftests/kvm/arm64/external_aborts.c
> +++ b/tools/testing/selftests/kvm/arm64/external_aborts.c
> @@ -75,6 +75,17 @@ static void vcpu_inject_serror(struct kvm_vcpu *vcpu)
>  	vcpu_events_set(vcpu, &events);
>  }
>  
> +static void vcpu_assert_serror_pending(struct kvm_vcpu *vcpu, bool pending)
> +{
> +	struct kvm_vcpu_events events;
> +
> +	vcpu_events_get(vcpu, &events);
> +	TEST_ASSERT_EQ(events.exception.serror_pending, pending);
> +
> +	if (pending && vcpu_has_ras(vcpu))
> +		TEST_ASSERT_EQ(events.exception.serror_esr, EXPECTED_SERROR_ISS);
> +}
> +
>  static void __vcpu_run_expect(struct kvm_vcpu *vcpu, unsigned int cmd)
>  {
>  	struct ucall uc;
> @@ -134,6 +145,7 @@ static void test_mmio_abort(void)
>  
>  	vcpu_inject_sea(vcpu);
>  	vcpu_run_expect_done(vcpu);
> +	vcpu_assert_serror_pending(vcpu, false);
>  	kvm_vm_free(vm);
>  }
>  
> @@ -162,6 +174,7 @@ static void test_mmio_nisv(void)
>  
>  	TEST_ASSERT(_vcpu_run(vcpu), "Expected nonzero return code from KVM_RUN");
>  	TEST_ASSERT_EQ(errno, ENOSYS);
> +	vcpu_assert_serror_pending(vcpu, false);
>  
>  	kvm_vm_free(vm);
>  }
> @@ -185,6 +198,7 @@ static void test_mmio_nisv_abort(void)
>  
>  	vcpu_inject_sea(vcpu);
>  	vcpu_run_expect_done(vcpu);
> +	vcpu_assert_serror_pending(vcpu, false);
>  	kvm_vm_free(vm);
>  }
>  
> @@ -212,6 +226,7 @@ static void test_serror_masked(void)
>  
>  	vcpu_inject_serror(vcpu);
>  	vcpu_run_expect_done(vcpu);
> +	vcpu_assert_serror_pending(vcpu, true);
>  	kvm_vm_free(vm);
>  }
>  
> @@ -247,6 +262,7 @@ static void test_serror(void)
>  
>  	vcpu_inject_serror(vcpu);
>  	vcpu_run_expect_done(vcpu);
> +	vcpu_assert_serror_pending(vcpu, false);
>  	kvm_vm_free(vm);
>  }
>  
> @@ -288,6 +304,7 @@ static void test_s1ptw_abort(void)
>  	*ptep |= bad_pa;
>  
>  	vcpu_run_expect_done(vcpu);
> +	vcpu_assert_serror_pending(vcpu, false);
>  	kvm_vm_free(vm);
>  }
>  
> @@ -313,6 +330,7 @@ static void test_serror_emulated(void)
>  	vcpu_run_expect_sync(vcpu);
>  	vcpu_inject_serror(vcpu);
>  	vcpu_run_expect_done(vcpu);
> +	vcpu_assert_serror_pending(vcpu, false);
>  	kvm_vm_free(vm);
>  }
>  
> @@ -356,6 +374,7 @@ static void test_mmio_ease(void)
>  
>  	vcpu_inject_sea(vcpu);
>  	vcpu_run_expect_done(vcpu);
> +	vcpu_assert_serror_pending(vcpu, false);
>  done:
>  	kvm_vm_free(vm);
>  }
> @@ -395,6 +414,7 @@ static void test_serror_amo(void)
>  	vcpu_run_expect_sync(vcpu);
>  	vcpu_inject_serror(vcpu);
>  	vcpu_run_expect_done(vcpu);
> +	vcpu_assert_serror_pending(vcpu, false);
>  	kvm_vm_free(vm);
>  }
>  
> 
> base-commit: fa22cd9947fc245d71bc40482f7f78eb0d5a4af0
> -- 
> 2.39.5
> 

      reply	other threads:[~2026-10-06 13:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-06  9:28 Fuad Tabba
2026-10-06 13:17 ` Oliver Upton [this message]

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=asT05hZqkMvVVnze@kernel.org \
    --to=oupton@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=fuad.tabba@linux.dev \
    --cc=joey.gouly@arm.com \
    --cc=kvmarm@lists.linux.dev \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maz@kernel.org \
    --cc=qperret@google.com \
    --cc=seiden@linux.ibm.com \
    --cc=suzuki.poulose@arm.com \
    --cc=tabba@google.com \
    --cc=vdonnefort@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

all inboxes | Powered by JetHome®