Skip to contentSkip to conversation

perf test pmu: Remove unused test_pmus

PATCH Applied [email protected] 3 participants 5 messages Jul 27, 2024 – Jul 30, 2024 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf test pmu: Remove unused test_pmus

From: "Dr. David Alan Gilbert" <[email protected]>

Commit aa1551f299ba ("perf test pmu: Refactor format test and exposed test APIs") added the 'test_pmus' list, but didn't use it. (It seems to put them on the other_pmus list?)

Remove it.

---
 tools/perf/tests/pmu.c | 3 ---
 1 file changed, 3 deletions(-)
tools/perf/tests/pmu.c +0 -3
index 40132655ccd1..0b2f04a55d7b 100644
@@ -18,9 +18,6 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 
-/* Fake PMUs created in temp directory. */
-static LIST_HEAD(test_pmus);
-
 /* Cleanup test PMU directory. */
 static int test_pmu_put(const char *dir, struct perf_pmu *pmu)
 {
Signature · 1 line
2.45.2
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · On Sat, Jul 27, 2024 at 10:59 AM <[email protected]> wrote:

From: "Dr. David Alan Gilbert" <[email protected]>

Commit aa1551f299ba ("perf test pmu: Refactor format test and exposed test APIs") added the 'test_pmus' list, but didn't use it. (It seems to put them on the other_pmus list?)

Remove it.

Strange that the compiler doesn't warn about unused stuff like this, we get unused variables within a function and unused static functions...

Possibly:

Fixes aa1551f299ba ("perf test pmu: Refactor format test and exposed

test APIs")

Thanks,
Ian

Quoted 21 lines
---
 tools/perf/tests/pmu.c | 3 ---
 1 file changed, 3 deletions(-)
tools/perf/tests/pmu.c +0 -4
index 40132655ccd1..0b2f04a55d7b 100644
@@ -18,9 +18,6 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 
-/* Fake PMUs created in temp directory. */
-static LIST_HEAD(test_pmus);
-
 /* Cleanup test PMU directory. */
 static int test_pmu_put(const char *dir, struct perf_pmu *pmu)
 {
--

2.45.2

#2 lore raw
Quoted 8 lines · * Ian Rogers ([email protected]) wrote:
Quoted 7 lines · On Sat, Jul 27, 2024 at 10:59 AM <[email protected]> wrote:

From: "Dr. David Alan Gilbert" <[email protected]>

Commit aa1551f299ba ("perf test pmu: Refactor format test and exposed test APIs") added the 'test_pmus' list, but didn't use it. (It seems to put them on the other_pmus list?)

Quoted 7 lines
Quoted 3 lines

Remove it.

Strange that the compiler doesn't warn about unused stuff like this, we get unused variables within a function and unused static functions...

The problem is that LIST_HEAD initialises the list to point to itself; so it *is* used - but only in it's own initialiser.
I did file:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115027

Quoted 1 line

Thanks,

Quoted 3 lines

Possibly:

Fixes aa1551f299ba ("perf test pmu: Refactor format test and exposed

test APIs")

Given it's got no actual effect other than a few bytes saved, I'm not sure it's worth the Fixes.

Dave

Quoted 24 lines

Thanks,
Ian

Quoted 21 lines
---
 tools/perf/tests/pmu.c | 3 ---
 1 file changed, 3 deletions(-)
tools/perf/tests/pmu.c +0 -4
index 40132655ccd1..0b2f04a55d7b 100644
@@ -18,9 +18,6 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 
-/* Fake PMUs created in temp directory. */
-static LIST_HEAD(test_pmus);
-
 /* Cleanup test PMU directory. */
 static int test_pmu_put(const char *dir, struct perf_pmu *pmu)
 {
--

2.45.2

Signature · 4 lines
 -----Open up your eyes, open up your mind, open up your code -------   
/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \ 
\        dave @ treblig.org |                               | In Hex /
 \ _________________________|_____ http://www.treblig.org   |_______/
reviewer
#3 lore raw
Quoted 14 lines · Dr. David Alan Gilbert
Quoted 12 lines · * Ian Rogers ([email protected]) wrote:
Quoted 10 lines · On Sat, Jul 27, 2024 at 10:59 AM <[email protected]> wrote:

From: "Dr. David Alan Gilbert" <[email protected]>

Commit aa1551f299ba ("perf test pmu: Refactor format test and exposed test APIs") added the 'test_pmus' list, but didn't use it. (It seems to put them on the other_pmus list?)

Remove it.

Quoted 8 lines
Quoted 3 lines

Strange that the compiler doesn't warn about unused stuff like this, we get unused variables within a function and unused static functions...

The problem is that LIST_HEAD initialises the list to point to itself; so it *is* used - but only in it's own initialiser.
I did file:

   https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115027

Nice, the bug already has a fix - good work! Hopefully clang can follow suit.

Quoted 10 lines
Quoted 1 line

Thanks,

Quoted 3 lines

Possibly:

Fixes aa1551f299ba ("perf test pmu: Refactor format test and exposed

test APIs")

Given it's got no actual effect other than a few bytes saved, I'm not sure it's worth the Fixes.

Ack. I mention it so the maintainers can make a decision about fixing in 6.11 (still in rc stage) or whether to hold for 6.12. It seems pretty safe either way, but for 6.11 probably better to have a fixes tag. If the GCC warning becomes a thing there's a chance the code won't build without the fix :-)

Thanks,
Ian

Quoted 31 lines

Dave

Quoted 15 lines

Thanks,
Ian

Quoted 12 lines
---
 tools/perf/tests/pmu.c | 3 ---
 1 file changed, 3 deletions(-)
tools/perf/tests/pmu.c +0 -0
index 40132655ccd1..0b2f04a55d7b 100644
@@ -18,9 +18,6 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 
Quoted 9 lines
Quoted 9 lines
tools/perf/tests/pmu.c +0 -4
-/* Fake PMUs created in temp directory. */
-static LIST_HEAD(test_pmus);
-
 /* Cleanup test PMU directory. */
 static int test_pmu_put(const char *dir, struct perf_pmu *pmu)
 {
--

2.45.2

--
-----Open up your eyes, open up your mind, open up your code -------

/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \
\        dave @ treblig.org |                               | In Hex /
 \ _________________________|_____ http://www.treblig.org   |_______/
maintainer Applied
#4 lore raw
In reply to Ian Rogers
Quoted 10 lines · Ian Rogers
Quoted 9 lines · On Sat, Jul 27, 2024 at 10:59 AM <[email protected]> wrote:

From: "Dr. David Alan Gilbert" <[email protected]>

Commit aa1551f299ba ("perf test pmu: Refactor format test and exposed test APIs") added the 'test_pmus' list, but didn't use it. (It seems to put them on the other_pmus list?)

Remove it.

Quoted 7 lines
Quoted 1 line

Strange that the compiler doesn't warn about unused stuff like this, we get unused variables within a function and unused static functions...

Thanks, applied to tmp.perf-tools-next,

- Arnaldo

Quoted 28 lines

Possibly:

Fixes aa1551f299ba ("perf test pmu: Refactor format test and exposed

test APIs")

Thanks,
Ian

Quoted 21 lines
---
 tools/perf/tests/pmu.c | 3 ---
 1 file changed, 3 deletions(-)
tools/perf/tests/pmu.c +0 -4
index 40132655ccd1..0b2f04a55d7b 100644
@@ -18,9 +18,6 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 
-/* Fake PMUs created in temp directory. */
-static LIST_HEAD(test_pmus);
-
 /* Cleanup test PMU directory. */
 static int test_pmu_put(const char *dir, struct perf_pmu *pmu)
 {
--

2.45.2