Skip to contentSkip to conversation

perf bench: Fix two numa NDEBUG warnings

PATCH Applied Ian Rogers 4 participants 6 messages Apr 28, 2022 – Apr 30, 2022 perf events

lore
Share & tools
lore

Ian Rogers

author reviewer
#0 lore raw

PATCH 1/2 perf bench: Fix two numa NDEBUG warnings

BUG_ON is a no-op if NDEBUG is defined, otherwise it is an assert. Compiling with NDEBUG yields:

bench/numa.c: In function ‘bind_to_cpu’:
bench/numa.c:314:1: error: control reaches end of non-void function [-Werror=return-type]
314 | }

      | ^
bench/numa.c: In function ‘bind_to_node’:
bench/numa.c:367:1: error: control reaches end of non-void function [-Werror=return-type]
  367 | }
      | ^

Add return statements to cover this case.

---
 tools/perf/bench/numa.c | 2 ++
 1 file changed, 2 insertions(+)
tools/perf/bench/numa.c +2 -0
index 44e1f8a44087..d5289fa58a4f 100644
@@ -311,6 +311,7 @@ static cpu_set_t *bind_to_cpu(int target_cpu)
 
 	/* BUG_ON due to failure in allocation of orig_mask/mask */
 	BUG_ON(-1);
+	return NULL;
 }
 
 static cpu_set_t *bind_to_node(int target_node)
@@ -364,6 +365,7 @@ static cpu_set_t *bind_to_node(int target_node)
 
 	/* BUG_ON due to failure in allocation of orig_mask/mask */
 	BUG_ON(-1);
+	return NULL;
 }
 
 static void bind_to_cpumask(cpu_set_t *mask)
Signature · 1 line
2.36.0.464.gb9c8b46e94-goog
author reviewer
#1 lore raw

PATCH 2/2 perf vendor events intel: Add cpuid for sapphirerapids

Fixes compile time warnings:

pmu-events/pmu-events.c:27238:31: error: ‘pme_sapphirerapids’ defined but not used [-Werror=unused-const-variable=]

27238 | static const struct pmu_event pme_sapphirerapids[] = {
      |                               ^~~~~~~~~~~~~~~~~~
---
 tools/perf/pmu-events/arch/x86/mapfile.csv | 1 +
 1 file changed, 1 insertion(+)
tools/perf/pmu-events/arch/x86/mapfile.csv +1 -0
index 963a76fec277..4b47ac1b806d 100644
@@ -41,6 +41,7 @@ GenuineIntel-6-A7,v1,icelake,core
 GenuineIntel-6-6A,v1,icelakex,core
 GenuineIntel-6-6C,v1,icelakex,core
 GenuineIntel-6-86,v1,tremontx,core
+GenuineIntel-6-8F,v1,sapphirerapids,core
 GenuineIntel-6-96,v1,elkhartlake,core
 GenuineIntel-6-97,v1,alderlake,core
 GenuineIntel-6-9A,v1,alderlake,core
Signature · 1 line
2.36.0.464.gb9c8b46e94-goog
#2 lore raw

Re: [PATCH 2/2] perf vendor events intel: Add cpuid for sapphirerapids

Quoted 16 lines · Ian Rogers

Fixes compile time warnings:

pmu-events/pmu-events.c:27238:31: error: ‘pme_sapphirerapids’ defined but not used [-Werror=unused-const-variable=]

27238 | static const struct pmu_event pme_sapphirerapids[] = {
       |                               ^~~~~~~~~~~~~~~~~~
---
  tools/perf/pmu-events/arch/x86/mapfile.csv | 1 +
  1 file changed, 1 insertion(+)
tools/perf/pmu-events/arch/x86/mapfile.csv +0 -0
index 963a76fec277..4b47ac1b806d 100644

tools/perf/pmu-events/arch/x86/mapfile.csv GenuineIntel-6-A7,v1,icelake,core · line 44

Quoted 4 lines
tools/perf/pmu-events/arch/x86/mapfile.csv +1 -0
@@ -41,6 +41,7 @@ GenuineIntel-6-A7,v1,icelake,core
  GenuineIntel-6-6A,v1,icelakex,core
  GenuineIntel-6-6C,v1,icelakex,core
  GenuineIntel-6-86,v1,tremontx,core
+GenuineIntel-6-8F,v1,sapphirerapids,core

In https://lore.kernel.org/all/[email protected]/, it has already added the cpuid for sapphirerapids

Quoted 3 lines
tools/perf/pmu-events/arch/x86/mapfile.csv +0 -0
  GenuineIntel-6-96,v1,elkhartlake,core
  GenuineIntel-6-97,v1,alderlake,core
  GenuineIntel-6-9A,v1,alderlake,core
Signature · 1 line
Zhengjun Xing
Reviewed-by on v1 1/2
#3 lore raw
In reply to Ian Rogers
Quoted 10 lines · Ian Rogers

BUG_ON is a no-op if NDEBUG is defined, otherwise it is an assert. Compiling with NDEBUG yields:

bench/numa.c: In function ‘bind_to_cpu’:
bench/numa.c:314:1: error: control reaches end of non-void function [-Werror=return-type]
314 | }

Quoted 7 lines
     | ^
bench/numa.c: In function ‘bind_to_node’:
bench/numa.c:367:1: error: control reaches end of non-void function [-Werror=return-type]
 367 | }
     | ^

Add return statements to cover this case.

Looks fine to me

Thanks
Athira

Quoted 29 lines

---
tools/perf/bench/numa.c | 2 ++

1 file changed, 2 insertions(+)
tools/perf/bench/numa.c +2 -0
index 44e1f8a44087..d5289fa58a4f 100644
@@ -311,6 +311,7 @@ static cpu_set_t *bind_to_cpu(int target_cpu)
 
 	/* BUG_ON due to failure in allocation of orig_mask/mask */
 	BUG_ON(-1);
+	return NULL;
 }
 
 static cpu_set_t *bind_to_node(int target_node)
@@ -364,6 +365,7 @@ static cpu_set_t *bind_to_node(int target_node)
 
 	/* BUG_ON due to failure in allocation of orig_mask/mask */
 	BUG_ON(-1);
+	return NULL;
 }
 
 static void bind_to_cpumask(cpu_set_t *mask)
Signature · 1 line
2.36.0.464.gb9c8b46e94-goog
author reviewer
#4 lore raw
Quoted 17 lines · Athira Rajeev
Quoted 17 lines · Ian Rogers

BUG_ON is a no-op if NDEBUG is defined, otherwise it is an assert. Compiling with NDEBUG yields:

bench/numa.c: In function ‘bind_to_cpu’:
bench/numa.c:314:1: error: control reaches end of non-void function [-Werror=return-type]
314 | }

     | ^
bench/numa.c: In function ‘bind_to_node’:
bench/numa.c:367:1: error: control reaches end of non-void function [-Werror=return-type]
 367 | }
     | ^
Quoted 8 lines
Quoted 1 line

Add return statements to cover this case.

Looks fine to me

Thanks
Athira

Thanks Athira :-) Arnaldo, could we get this in the 5th batch for 5.18 to keep NDEBUG building? It looks like there is a missing build test for NDEBUG too.

Thanks,
Ian

Quoted 30 lines
Quoted 29 lines

---
tools/perf/bench/numa.c | 2 ++

1 file changed, 2 insertions(+)
tools/perf/bench/numa.c +2 -1
index 44e1f8a44087..d5289fa58a4f 100644
@@ -311,6 +311,7 @@ static cpu_set_t *bind_to_cpu(int target_cpu)
 
      /* BUG_ON due to failure in allocation of orig_mask/mask */
      BUG_ON(-1);
+     return NULL;
 }
 
 static cpu_set_t *bind_to_node(int target_node)
@@ -364,6 +365,7 @@ static cpu_set_t *bind_to_node(int target_node)
 
      /* BUG_ON due to failure in allocation of orig_mask/mask */
      BUG_ON(-1);
+     return NULL;
 }
 
 static void bind_to_cpumask(cpu_set_t *mask)
--

2.36.0.464.gb9c8b46e94-goog

maintainer Applied
#5 lore raw

Em Fri, Apr 29, 2022 at 06:58:22PM -0700, Ian Rogers escreveu:

Quoted 23 lines
Quoted 21 lines · Athira Rajeev
Quoted 11 lines · Ian Rogers

BUG_ON is a no-op if NDEBUG is defined, otherwise it is an assert. Compiling with NDEBUG yields:

bench/numa.c: In function ‘bind_to_cpu’:
bench/numa.c:314:1: error: control reaches end of non-void function [-Werror=return-type]
314 | }

Quoted 7 lines
     | ^
bench/numa.c: In function ‘bind_to_node’:
bench/numa.c:367:1: error: control reaches end of non-void function [-Werror=return-type]
 367 | }
     | ^

Add return statements to cover this case.

Looks fine to me

Quoted 8 lines
Quoted 4 lines

Thanks
Athira

Thanks Athira :-) Arnaldo, could we get this in the 5th batch for 5.18 to keep NDEBUG building? It looks like there is a missing build test for NDEBUG too.

Applied to perf/urgent.

Thanks,

- Arnaldo