Skip to contentSkip to conversation

perf, x86: P4 PMU - Drop redundant WARN_ON_ONCE

PATCH In review Cyrill Gorcunov 2 participants 3 messages Jul 6, 2011

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

PATCH 1/1 perf, x86: P4 PMU - Drop redundant WARN_ON_ONCE

This WARN_ON_ONCE triggers a false alarm on SMP because nmi-watchdog uses a single global 'wd_hw_attr' variable to serve perf event attributes and once p4_hw_watchdog_set_attr has modified it subsequent calls on the rest cpus trigger the warning.

It is safe to simply drop it since we know the caller may pass already altered type and config.

---
 arch/x86/kernel/cpu/perf_event_p4.c |    3 ---
 1 file changed, 3 deletions(-)
arch/x86/kernel/cpu/perf_event_p4.c +0 -3
Index: linux-2.6.git/arch/x86/kernel/cpu/perf_event_p4.c
===================================================================
@@ -726,9 +726,6 @@ static void p4_hw_watchdog_set_attr(stru
 	 * that named "non-sleeping" ticks as recommended
 	 * by Intel SDM Vol3b.
 	 */
-	WARN_ON_ONCE(wd_attr->type	!= PERF_TYPE_HARDWARE ||
-		     wd_attr->config	!= PERF_COUNT_HW_CPU_CYCLES);
-
 	wd_attr->type	= PERF_TYPE_RAW;
 	wd_attr->config	=
 		p4_config_pack_escr(P4_ESCR_EVENT(P4_EVENT_EXECUTION_EVENT)		|
#1 lore raw
Quoted 10 lines · Cyrill Gorcunov

This WARN_ON_ONCE triggers a false alarm on SMP because nmi-watchdog uses a single global 'wd_hw_attr' variable to serve perf event attributes and once p4_hw_watchdog_set_attr has modified it subsequent calls on the rest cpus trigger the warning.

It is safe to simply drop it since we know the caller may pass already altered type and config.

Repoted? Hmm, maybe symbolically I put this code in a different pot.

-- Steve

Quoted 19 lines
---
 arch/x86/kernel/cpu/perf_event_p4.c |    3 ---
 1 file changed, 3 deletions(-)

Index: linux-2.6.git/arch/x86/kernel/cpu/perf_event_p4.c
===================================================================

arch/x86/kernel/cpu/perf_event_p4.c +0 -3
@@ -726,9 +726,6 @@ static void p4_hw_watchdog_set_attr(stru
 	 * that named "non-sleeping" ticks as recommended
 	 * by Intel SDM Vol3b.
 	 */
-	WARN_ON_ONCE(wd_attr->type	!= PERF_TYPE_HARDWARE ||
-		     wd_attr->config	!= PERF_COUNT_HW_CPU_CYCLES);
-
 	wd_attr->type	= PERF_TYPE_RAW;
 	wd_attr->config	=
 		p4_config_pack_escr(P4_ESCR_EVENT(P4_EVENT_EXECUTION_EVENT)		|
#2 lore raw
Quoted 7 lines · Steven Rostedt
Quoted 6 lines · Cyrill Gorcunov

This WARN_ON_ONCE triggers a false alarm on SMP because nmi-watchdog uses a single global 'wd_hw_attr' variable to serve perf event attributes and once p4_hw_watchdog_set_attr has modified it subsequent calls on the rest cpus trigger the warning.

Quoted 9 lines
Quoted 4 lines

It is safe to simply drop it since we know the caller may pass already altered type and config.

Repoted? Hmm, maybe symbolically I put this code in a different pot.

Oh, really sorry, Steven :/ Fingers... Just to have all in place.
---
perf, x86: P4 PMU - Drop redundant WARN_ON_ONCE

This WARN_ON_ONCE triggers a false alarm on SMP because nmi-watchdog uses a single global 'wd_hw_attr' variable to serve perf event attributes and once p4_hw_watchdog_set_attr has modified it subsequent calls on the rest cpus trigger the warning.

It is safe to simply drop it since we know the caller may pass already altered type and config.

---
 arch/x86/kernel/cpu/perf_event_p4.c |    3 ---
 1 file changed, 3 deletions(-)
arch/x86/kernel/cpu/perf_event_p4.c +0 -3
Index: linux-2.6.git/arch/x86/kernel/cpu/perf_event_p4.c
===================================================================
@@ -726,9 +726,6 @@ static void p4_hw_watchdog_set_attr(stru
 	 * that named "non-sleeping" ticks as recommended
 	 * by Intel SDM Vol3b.
 	 */
-	WARN_ON_ONCE(wd_attr->type	!= PERF_TYPE_HARDWARE ||
-		     wd_attr->config	!= PERF_COUNT_HW_CPU_CYCLES);
-
 	wd_attr->type	= PERF_TYPE_RAW;
 	wd_attr->config	=
 		p4_config_pack_escr(P4_ESCR_EVENT(P4_EVENT_EXECUTION_EVENT)		|