Skip to contentSkip to conversation

KVM: arm64: selftests: Check SError is not pending after delivery

PATCH In review Fuad Tabba 2 participants 3 messages Oct 5

Subsystems (3)
lore
Share & tools
lore

Fuad Tabba

author reviewer
#0 lore raw

PATCH v3 1/1 KVM: arm64: selftests: Check SError is not pending after delivery

test_serror() never looks at the vCPU after the SError is delivered, so a stale pending SError goes unnoticed. Read the vCPU events back and check the SError is no longer pending.

---
The fix from v2 was applied [1], but not this test.

Changes since v2 [2]:
- Dropped the fix, now in kvmarm/next.
- Rebased on kvmarm/next.

[1] https://lore.kernel.org/all/[email protected]/
[2] https://lore.kernel.org/all/[email protected]/

 tools/testing/selftests/kvm/arm64/external_aborts.c | 6 ++++++
 1 file changed, 6 insertions(+)
tools/testing/selftests/kvm/arm64/external_aborts.c +6 -0
index 7836756a38a6c..c35b0c87250a1 100644
@@ -239,6 +239,7 @@ static void test_serror_guest(void)
 
 static void test_serror(void)
 {
+	struct kvm_vcpu_events events;
 	struct kvm_vcpu *vcpu;
 	struct kvm_vm *vm = vm_create_with_dabt_handler(&vcpu, test_serror_guest,
 							unexpected_dabt_handler);
@@ -247,6 +248,11 @@ static void test_serror(void)
 
 	vcpu_inject_serror(vcpu);
 	vcpu_run_expect_done(vcpu);
+
+	vcpu_events_get(vcpu, &events);
+	TEST_ASSERT(!events.exception.serror_pending,
+		    "SError still pending after the guest took it");
+
 	kvm_vm_free(vm);
 }
 

base-commit: fa22cd9947fc245d71bc40482f7f78eb0d5a4af0

Signature · 1 line
2.39.5
maintainer
#1 lore raw

Hi Fuad,

Quoted 31 lines · Fuad Tabba

test_serror() never looks at the vCPU after the SError is delivered, so a stale pending SError goes unnoticed. Read the vCPU events back and check the SError is no longer pending.

---
The fix from v2 was applied [1], but not this test.

Changes since v2 [2]:
- Dropped the fix, now in kvmarm/next.
- Rebased on kvmarm/next.

[1] https://lore.kernel.org/all/[email protected]/
[2] https://lore.kernel.org/all/[email protected]/

 tools/testing/selftests/kvm/arm64/external_aborts.c | 6 ++++++
 1 file changed, 6 insertions(+)
tools/testing/selftests/kvm/arm64/external_aborts.c +1 -0
index 7836756a38a6c..c35b0c87250a1 100644
@@ -239,6 +239,7 @@ static void test_serror_guest(void)
 
 static void test_serror(void)
 {
+	struct kvm_vcpu_events events;
 	struct kvm_vcpu *vcpu;
 	struct kvm_vm *vm = vm_create_with_dabt_handler(&vcpu, test_serror_guest,
 							unexpected_dabt_handler);

tools/testing/selftests/kvm/arm64/external_aborts.c static void test_serror(void) · line 257

Quoted 10 lines
tools/testing/selftests/kvm/arm64/external_aborts.c +5 -0
@@ -247,6 +248,11 @@ static void test_serror(void)
 
 	vcpu_inject_serror(vcpu);
 	vcpu_run_expect_done(vcpu);
+
+	vcpu_events_get(vcpu, &events);
+	TEST_ASSERT(!events.exception.serror_pending,
+		    "SError still pending after the guest took it");
+
 	kvm_vm_free(vm);
 }

Can you add coverage for the vCPU events state to all the test cases? In addition to the case where the SError is taken, it'd be good to assert that the SError remains pending if the guest masked it.

Thanks,
Oliver

author reviewer
#2 lore raw

Hi Oliver,

Quoted 2 lines · Oliver Upton

Hi Fuad,

[...]

Quoted 4 lines

Can you add coverage for the vCPU events state to all the test cases? In addition to the case where the SError is taken, it'd be good to assert that the SError remains pending if the guest masked it.

Will do,
/fuad

Quoted 2 lines

Thanks,
Oliver