perfctr_watchdog: do not BUG_ON() when MSR is unknown
PATCH 1/1 perfctr_watchdog: do not BUG_ON() when MSR is unknown
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
arch/i386/kernel/cpu/perfctr-watchdog.c +12 -4
@@ -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); }
Quoted 11 lines · 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 insteadSigned-off-by Stephane Eranian <[email protected]>
Applied both patches, but can you in future patches please not indent the Signed-off-by and also capitalize it properly? Thanks.
-Andi