Skip to contentSkip to conversation

KVM: selftests: aarch64: Remove unused functions from vpmu test

PATCH Applied Raghavendra Rao Ananta 4 participants 5 messages Nov 22, 2023 – Feb 29, 2024

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

PATCH 1/1 KVM: selftests: aarch64: Remove unused functions from vpmu test

vpmu_counter_access's disable_counter() carries a bug that disables all the counters that are enabled, instead of just the requested one. Fortunately, it's not an issue as there are no callers of it. Hence, instead of fixing it, remove the definition entirely.

Remove enable_counter() as it's unused as well.

---
 .../selftests/kvm/aarch64/vpmu_counter_access.c  | 16 ----------------
 1 file changed, 16 deletions(-)
tools/testing/selftests/kvm/aarch64/vpmu_counter_access.c +0 -16
index 5ea78986e665f..e2f0b720cbfcf 100644
@@ -94,22 +94,6 @@ static inline void write_sel_evtyper(int sel, unsigned long val)
 	isb();
 }
 
-static inline void enable_counter(int idx)
-{
-	uint64_t v = read_sysreg(pmcntenset_el0);
-
-	write_sysreg(BIT(idx) | v, pmcntenset_el0);
-	isb();
-}
-
-static inline void disable_counter(int idx)
-{
-	uint64_t v = read_sysreg(pmcntenset_el0);
-
-	write_sysreg(BIT(idx) | v, pmcntenclr_el0);
-	isb();
-}
-
 static void pmu_disable_reset(void)
 {
 	uint64_t pmcr = read_sysreg(pmcr_el0);
Signature · 1 line
2.43.0.rc1.413.gea7ed67945-goog
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Raghavendra Rao Ananta

vpmu_counter_access's disable_counter() carries a bug that disables all the counters that are enabled, instead of just the requested one. Fortunately, it's not an issue as there are no callers of it. Hence, instead of fixing it, remove the definition entirely.

Remove enable_counter() as it's unused as well.

#2 lore raw
In reply to Raghavendra Rao Ananta

Hi Raghavendra,

Those functions might be useful for other pmu tests. Recently I just wrote a pmu_event_filter_test[1] and use the enable_counter().

There may have more pmu tests which can use the helper functions, so I think we can keep it now. And in my series[1], I have moved them into the lib/ as the helper function.

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

Thanks,
Shaoqin

Quoted 39 lines · Raghavendra Rao Ananta

vpmu_counter_access's disable_counter() carries a bug that disables all the counters that are enabled, instead of just the requested one. Fortunately, it's not an issue as there are no callers of it. Hence, instead of fixing it, remove the definition entirely.

Remove enable_counter() as it's unused as well.

---
  .../selftests/kvm/aarch64/vpmu_counter_access.c  | 16 ----------------
  1 file changed, 16 deletions(-)
tools/testing/selftests/kvm/aarch64/vpmu_counter_access.c +0 -16
index 5ea78986e665f..e2f0b720cbfcf 100644
@@ -94,22 +94,6 @@ static inline void write_sel_evtyper(int sel, unsigned long val)
  	isb();
  }
 
-static inline void enable_counter(int idx)
-{
-	uint64_t v = read_sysreg(pmcntenset_el0);
-
-	write_sysreg(BIT(idx) | v, pmcntenset_el0);
-	isb();
-}
-
-static inline void disable_counter(int idx)
-{
-	uint64_t v = read_sysreg(pmcntenset_el0);
-
-	write_sysreg(BIT(idx) | v, pmcntenclr_el0);
-	isb();
-}
-
  static void pmu_disable_reset(void)
  {
  	uint64_t pmcr = read_sysreg(pmcr_el0);
#3 lore raw

Hi Shaoqin,

Quoted 12 lines · Shaoqin Huang

Hi Raghavendra,

Those functions might be useful for other pmu tests. Recently I just wrote a pmu_event_filter_test[1] and use the enable_counter().

There may have more pmu tests which can use the helper functions, so I think we can keep it now. And in my series[1], I have moved them into the lib/ as the helper function.

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

Thanks for the pointer. If you are planning to use it, then we can abandon this patch. However, disable_counter() may need fixing. I'll comment directly on your patch.

Thank you.
Raghavendra

Quoted 44 lines

Thanks,
Shaoqin

Quoted 39 lines · Raghavendra Rao Ananta

vpmu_counter_access's disable_counter() carries a bug that disables all the counters that are enabled, instead of just the requested one. Fortunately, it's not an issue as there are no callers of it. Hence, instead of fixing it, remove the definition entirely.

Remove enable_counter() as it's unused as well.

---
  .../selftests/kvm/aarch64/vpmu_counter_access.c  | 16 ----------------
  1 file changed, 16 deletions(-)
tools/testing/selftests/kvm/aarch64/vpmu_counter_access.c +0 -16
index 5ea78986e665f..e2f0b720cbfcf 100644
@@ -94,22 +94,6 @@ static inline void write_sel_evtyper(int sel, unsigned long val)
      isb();
  }
 
-static inline void enable_counter(int idx)
-{
-     uint64_t v = read_sysreg(pmcntenset_el0);
-
-     write_sysreg(BIT(idx) | v, pmcntenset_el0);
-     isb();
-}
-
-static inline void disable_counter(int idx)
-{
-     uint64_t v = read_sysreg(pmcntenset_el0);
-
-     write_sysreg(BIT(idx) | v, pmcntenclr_el0);
-     isb();
-}
-
  static void pmu_disable_reset(void)
  {
      uint64_t pmcr = read_sysreg(pmcr_el0);
Applied
#4 lore raw
In reply to Raghavendra Rao Ananta
Quoted 8 lines · Raghavendra Rao Ananta

vpmu_counter_access's disable_counter() carries a bug that disables all the counters that are enabled, instead of just the requested one. Fortunately, it's not an issue as there are no callers of it. Hence, instead of fixing it, remove the definition entirely.

Remove enable_counter() as it's unused as well.

[...]

Applied to kvmarm/next, thanks!

[1/1] KVM: selftests: aarch64: Remove unused functions from vpmu test

      https://git.kernel.org/kvmarm/kvmarm/c/43b3bedb7cc4

--
Best,
Oliver