* [PATCH] perfctr_watchdog: do not BUG_ON() when MSR is unknown
@ 2007-07-27 12:49 Stephane Eranian
2007-07-27 21:48 ` Andi Kleen
0 siblings, 1 reply; 2+ messages in thread
From: Stephane Eranian @ 2007-07-27 12:49 UTC (permalink / raw)
To: linux-kernel; +Cc: ak, akpm, Stephane Eranian, B.Steinbrink
Hi,
Here is a small patch to change the behavior of the PMU msr allocator
to avoid BUG_ON() when the MSR is unknwon. Instead, it now returns
ok, which means "I do not manage". The current allocator is not
yet managing the full set of PMU registers (e.g., GLOBAL_* on Core 2).
[watchdog] do not BUG_ON() in the MSR allocator if MSR is unknown, return ok instead
signed-off-by: Stephane Eranian <eranian@hpl.hp.com>
diff --git a/arch/i386/kernel/cpu/perfctr-watchdog.c b/arch/i386/kernel/cpu/perfctr-watchdog.c
index 4be488e..9b5d6af 100644
--- a/arch/i386/kernel/cpu/perfctr-watchdog.c
+++ b/arch/i386/kernel/cpu/perfctr-watchdog.c
@@ -120,7 +120,9 @@ int reserve_perfctr_nmi(unsigned int msr)
unsigned int counter;
counter = nmi_perfctr_msr_to_bit(msr);
- BUG_ON(counter > NMI_MAX_COUNTER_BITS);
+ /* register not managed by the allocator? */
+ if (counter > NMI_MAX_COUNTER_BITS)
+ return 1;
if (!test_and_set_bit(counter, perfctr_nmi_owner))
return 1;
@@ -132,7 +134,9 @@ void release_perfctr_nmi(unsigned int msr)
unsigned int counter;
counter = nmi_perfctr_msr_to_bit(msr);
- BUG_ON(counter > NMI_MAX_COUNTER_BITS);
+ /* register not managed by the allocator? */
+ if (counter > NMI_MAX_COUNTER_BITS)
+ return;
clear_bit(counter, perfctr_nmi_owner);
}
@@ -142,7 +146,9 @@ int reserve_evntsel_nmi(unsigned int msr)
unsigned int counter;
counter = nmi_evntsel_msr_to_bit(msr);
- BUG_ON(counter > NMI_MAX_COUNTER_BITS);
+ /* register not managed by the allocator? */
+ if (counter > NMI_MAX_COUNTER_BITS)
+ return 1;
if (!test_and_set_bit(counter, evntsel_nmi_owner))
return 1;
@@ -154,7 +160,9 @@ void release_evntsel_nmi(unsigned int msr)
unsigned int counter;
counter = nmi_evntsel_msr_to_bit(msr);
- BUG_ON(counter > NMI_MAX_COUNTER_BITS);
+ /* register not managed by the allocator? */
+ if (counter > NMI_MAX_COUNTER_BITS)
+ return;
clear_bit(counter, evntsel_nmi_owner);
}
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] perfctr_watchdog: do not BUG_ON() when MSR is unknown
2007-07-27 12:49 [PATCH] perfctr_watchdog: do not BUG_ON() when MSR is unknown Stephane Eranian
@ 2007-07-27 21:48 ` Andi Kleen
0 siblings, 0 replies; 2+ messages in thread
From: Andi Kleen @ 2007-07-27 21:48 UTC (permalink / raw)
To: eranian; +Cc: linux-kernel, akpm, B.Steinbrink
On Friday 27 July 2007 14:49:34 Stephane Eranian wrote:
> Hi,
>
> Here is a small patch to change the behavior of the PMU msr allocator
> to avoid BUG_ON() when the MSR is unknwon. Instead, it now returns
> ok, which means "I do not manage". The current allocator is not
> yet managing the full set of PMU registers (e.g., GLOBAL_* on Core 2).
>
>
> [watchdog] do not BUG_ON() in the MSR allocator if MSR is unknown, return ok instead
>
> signed-off-by: Stephane Eranian <eranian@hpl.hp.com>
Applied both patches, but can you in future patches please not indent
the Signed-off-by and also capitalize it properly? Thanks.
-Andi
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-07-27 21:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-27 12:49 [PATCH] perfctr_watchdog: do not BUG_ON() when MSR is unknown Stephane Eranian
2007-07-27 21:48 ` Andi Kleen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox