aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/kernel/cpu/perfctr-watchdog.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/arch/x86/kernel/cpu/perfctr-watchdog.c b/arch/x86/kernel/cpu/perfctr-watchdog.c
index 54cdbf1a40f1..c02541e6e653 100644
--- a/arch/x86/kernel/cpu/perfctr-watchdog.c
+++ b/arch/x86/kernel/cpu/perfctr-watchdog.c
@@ -120,7 +120,9 @@ int reserve_perfctr_nmi(unsigned int msr)
120 unsigned int counter; 120 unsigned int counter;
121 121
122 counter = nmi_perfctr_msr_to_bit(msr); 122 counter = nmi_perfctr_msr_to_bit(msr);
123 BUG_ON(counter > NMI_MAX_COUNTER_BITS); 123 /* register not managed by the allocator? */
124 if (counter > NMI_MAX_COUNTER_BITS)
125 return 1;
124 126
125 if (!test_and_set_bit(counter, perfctr_nmi_owner)) 127 if (!test_and_set_bit(counter, perfctr_nmi_owner))
126 return 1; 128 return 1;
@@ -132,7 +134,9 @@ void release_perfctr_nmi(unsigned int msr)
132 unsigned int counter; 134 unsigned int counter;
133 135
134 counter = nmi_perfctr_msr_to_bit(msr); 136 counter = nmi_perfctr_msr_to_bit(msr);
135 BUG_ON(counter > NMI_MAX_COUNTER_BITS); 137 /* register not managed by the allocator? */
138 if (counter > NMI_MAX_COUNTER_BITS)
139 return;
136 140
137 clear_bit(counter, perfctr_nmi_owner); 141 clear_bit(counter, perfctr_nmi_owner);
138} 142}
@@ -142,7 +146,9 @@ int reserve_evntsel_nmi(unsigned int msr)
142 unsigned int counter; 146 unsigned int counter;
143 147
144 counter = nmi_evntsel_msr_to_bit(msr); 148 counter = nmi_evntsel_msr_to_bit(msr);
145 BUG_ON(counter > NMI_MAX_COUNTER_BITS); 149 /* register not managed by the allocator? */
150 if (counter > NMI_MAX_COUNTER_BITS)
151 return 1;
146 152
147 if (!test_and_set_bit(counter, evntsel_nmi_owner)) 153 if (!test_and_set_bit(counter, evntsel_nmi_owner))
148 return 1; 154 return 1;
@@ -154,7 +160,9 @@ void release_evntsel_nmi(unsigned int msr)
154 unsigned int counter; 160 unsigned int counter;
155 161
156 counter = nmi_evntsel_msr_to_bit(msr); 162 counter = nmi_evntsel_msr_to_bit(msr);
157 BUG_ON(counter > NMI_MAX_COUNTER_BITS); 163 /* register not managed by the allocator? */
164 if (counter > NMI_MAX_COUNTER_BITS)
165 return;
158 166
159 clear_bit(counter, evntsel_nmi_owner); 167 clear_bit(counter, evntsel_nmi_owner);
160} 168}