Skip to content

Commit

Permalink
i386: do not BUG_ON() when MSR is unknown
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
  • Loading branch information
Stephane Eranian authored and Thomas Gleixner committed Oct 19, 2007
1 parent 71b3123 commit 124d395
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions arch/x86/kernel/cpu/perfctr-watchdog.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
}
Expand All @@ -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;
Expand All @@ -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);
}
Expand Down

0 comments on commit 124d395

Please sign in to comment.