Skip to contentSkip to conversation

KVM: selftests: a couple fixes

PATCH Applied Andrew Jones 2 participants 5 messages Jul 13, 2021 – Jul 14, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover KVM: selftests: a couple fixes

The first removes a compiler warning. The second does what a 6 patch patch series wanted to do, but apparently got too distracted with the preparation refactoring to actually do...

Andrew Jones (2):
KVM: selftests: change pthread_yield to sched_yield
KVM: arm64: selftests: get-reg-list: actually enable pmu regs in pmu
sublist

 tools/testing/selftests/kvm/aarch64/get-reg-list.c | 3 ++-
 tools/testing/selftests/kvm/steal_time.c           | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)
Signature · 1 line
2.31.1
#1 lore raw

PATCH 1/2 KVM: selftests: change pthread_yield to sched_yield

With later GCC we get

steal_time.c: In function ‘main’:
steal_time.c:323:25: warning: ‘pthread_yield’ is deprecated: pthread_yield is deprecated, use sched_yield instead [-Wdeprecated-declarations]

Let's follow the instructions and use sched_yield instead.

---
 tools/testing/selftests/kvm/steal_time.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/kvm/steal_time.c +1 -1
index b0031f2d38fd..ecec30865a74 100644
@@ -320,7 +320,7 @@ int main(int ac, char **av)
 		run_delay = get_run_delay();
 		pthread_create(&thread, &attr, do_steal_time, NULL);
 		do
-			pthread_yield();
+			sched_yield();
 		while (get_run_delay() - run_delay < MIN_RUN_DELAY_NS);
 		pthread_join(thread, NULL);
 		run_delay = get_run_delay() - run_delay;
Signature · 1 line
2.31.1
#2 lore raw

PATCH 2/2 KVM: arm64: selftests: get-reg-list: actually enable pmu regs in pmu sublist

In reply to Andrew Jones

We reworked get-reg-list to make it easier to enable optional register sublists by parametrizing their vcpu feature flags as well as making other generalizations. That was all to make sure we enable the PMU registers when we want to test them. Somehow we forgot to actually include the PMU feature flag in the PMU sublist description though! Do that now.

Fixes 313673bad871 ("KVM: arm64: selftests: get-reg-list: Split base and pmu registers")
---
 tools/testing/selftests/kvm/aarch64/get-reg-list.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tools/testing/selftests/kvm/aarch64/get-reg-list.c +2 -1
index a16c8f05366c..cc898181faab 100644
@@ -1019,7 +1019,8 @@ static __u64 sve_rejects_set[] = {
 #define VREGS_SUBLIST \
 	{ "vregs", .regs = vregs, .regs_n = ARRAY_SIZE(vregs), }
 #define PMU_SUBLIST \
-	{ "pmu", .regs = pmu_regs, .regs_n = ARRAY_SIZE(pmu_regs), }
+	{ "pmu", .capability = KVM_CAP_ARM_PMU_V3, .feature = KVM_ARM_VCPU_PMU_V3, \
+	  .regs = pmu_regs, .regs_n = ARRAY_SIZE(pmu_regs), }
 #define SVE_SUBLIST \
 	{ "sve", .capability = KVM_CAP_ARM_SVE, .feature = KVM_ARM_VCPU_SVE, .finalize = true, \
 	  .regs = sve_regs, .regs_n = ARRAY_SIZE(sve_regs), \
Signature · 1 line
2.31.1
maintainer
#3 lore raw

Re: [PATCH 2/2] KVM: arm64: selftests: get-reg-list: actually enable pmu regs in pmu sublist

Quoted 6 lines · Andrew Jones

We reworked get-reg-list to make it easier to enable optional register sublists by parametrizing their vcpu feature flags as well as making other generalizations. That was all to make sure we enable the PMU registers when we want to test them. Somehow we forgot to actually include the PMU feature flag in the PMU sublist description though! Do that now.

Ah! :D

Quoted 23 lines
Fixes 313673bad871 ("KVM: arm64: selftests: get-reg-list: Split base

and pmu registers")

---
 tools/testing/selftests/kvm/aarch64/get-reg-list.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tools/testing/selftests/kvm/aarch64/get-reg-list.c +2 -1
index a16c8f05366c..cc898181faab 100644
@@ -1019,7 +1019,8 @@ static __u64 sve_rejects_set[] = {
 #define VREGS_SUBLIST \
 	{ "vregs", .regs = vregs, .regs_n = ARRAY_SIZE(vregs), }
 #define PMU_SUBLIST \
-	{ "pmu", .regs = pmu_regs, .regs_n = ARRAY_SIZE(pmu_regs), }
+	{ "pmu", .capability = KVM_CAP_ARM_PMU_V3, .feature = 
 KVM_ARM_VCPU_PMU_V3, \
+	  .regs = pmu_regs, .regs_n = ARRAY_SIZE(pmu_regs), }
 #define SVE_SUBLIST \
 	{ "sve", .capability = KVM_CAP_ARM_SVE, .feature = KVM_ARM_VCPU_SVE,
Quoted 2 lines

.finalize = true, \
.regs = sve_regs, .regs_n = ARRAY_SIZE(sve_regs), \

Good timing, I'm queuing fixes. I'll pick those in a moment.

Thanks,

        M.
Signature · 1 line
Jazz is not dead. It just smells funny...
maintainer Applied
#4 lore raw
In reply to Andrew Jones
Quoted 10 lines · Andrew Jones

The first removes a compiler warning. The second does what a 6 patch patch series wanted to do, but apparently got too distracted with the preparation refactoring to actually do...

Andrew Jones (2):
KVM: selftests: change pthread_yield to sched_yield
KVM: arm64: selftests: get-reg-list: actually enable pmu regs in pmu
sublist

[...]

Applied to fixes, thanks!

[1/2] KVM: selftests: change pthread_yield to sched_yield

      commit: bac0b135907855e9f8c032877c3df3c60885a08f
[2/2] KVM: arm64: selftests: get-reg-list: actually enable pmu regs in pmu sublist
      commit: 5cf17746b302aa32a4f200cc6ce38865bfe4cf94

Cheers,

	M.
Signature · 1 line
Without deviation from the norm, progress is not possible.