Commit d48fc63f6f3f485ed5aa9cf019d8e8e3a7d10263

Authored by Thomas Gleixner
1 parent fa4da365bc

Revert "clocksource: Load the ACPI PM clocksource asynchronously"

This reverts commit b519508298e0292e1771eecf14aaf67755adc39d.

The reason for this revert is that making the frequency verification
preemptible and interruptible is not working reliably. Michaels
machine failed to use PM-timer with the message:

  PM-Timer running at invalid rate: 113% of normal - aborting.

That's not a surprise as the frequency verification does rely on
interrupts being disabled. With a async scheduled thread there is no
guarantee to achieve the same result. Also some driver might fiddle
with the CTC channel 2 during the verification period, which makes the
result even more random and unpredictable.

This can be solved by using the same mechanism as we use in the
deferred TSC validation code, but that only will work if we verified a
working HPET _BEFORE_ trying to do the PM-Timer lazy validation.

So for now reverting is the safe option.

Bisected-by: Michael Witten <mfwitten@gmail.com>
Cc: Arjan van de Ven <arjanvandeven@gmail.com>
Cc: Arjan van de Ven <arjan@infradead.org>
Cc: John Stultz <johnstul@us.ibm.com>
Cc: Len Brown <lenb@kernel.org>
LKML-Reference: <alpine.LFD.2.02.1204112303270.2542@ionos>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

Showing 1 changed file with 8 additions and 16 deletions Side-by-side Diff

drivers/clocksource/acpi_pm.c
... ... @@ -23,7 +23,6 @@
23 23 #include <linux/init.h>
24 24 #include <linux/pci.h>
25 25 #include <linux/delay.h>
26   -#include <linux/async.h>
27 26 #include <asm/io.h>
28 27  
29 28 /*
30 29  
31 30  
... ... @@ -180,15 +179,17 @@
180 179 /* Number of reads we try to get two different values */
181 180 #define ACPI_PM_READ_CHECKS 10000
182 181  
183   -static void __init acpi_pm_clocksource_async(void *unused, async_cookie_t cookie)
  182 +static int __init init_acpi_pm_clocksource(void)
184 183 {
185 184 cycle_t value1, value2;
186 185 unsigned int i, j = 0;
187 186  
  187 + if (!pmtmr_ioport)
  188 + return -ENODEV;
188 189  
189 190 /* "verify" this timing source: */
190 191 for (j = 0; j < ACPI_PM_MONOTONICITY_CHECKS; j++) {
191   - usleep_range(100 * j, 100 * j + 100);
  192 + udelay(100 * j);
192 193 value1 = clocksource_acpi_pm.read(&clocksource_acpi_pm);
193 194 for (i = 0; i < ACPI_PM_READ_CHECKS; i++) {
194 195 value2 = clocksource_acpi_pm.read(&clocksource_acpi_pm);
195 196  
196 197  
197 198  
198 199  
... ... @@ -202,32 +203,23 @@
202 203 " 0x%#llx, 0x%#llx - aborting.\n",
203 204 value1, value2);
204 205 pmtmr_ioport = 0;
205   - return;
  206 + return -EINVAL;
206 207 }
207 208 if (i == ACPI_PM_READ_CHECKS) {
208 209 printk(KERN_INFO "PM-Timer failed consistency check "
209 210 " (0x%#llx) - aborting.\n", value1);
210 211 pmtmr_ioport = 0;
211   - return;
  212 + return -ENODEV;
212 213 }
213 214 }
214 215  
215 216 if (verify_pmtmr_rate() != 0){
216 217 pmtmr_ioport = 0;
217   - return;
  218 + return -ENODEV;
218 219 }
219 220  
220   - clocksource_register_hz(&clocksource_acpi_pm,
  221 + return clocksource_register_hz(&clocksource_acpi_pm,
221 222 PMTMR_TICKS_PER_SEC);
222   -}
223   -
224   -static int __init init_acpi_pm_clocksource(void)
225   -{
226   - if (!pmtmr_ioport)
227   - return -ENODEV;
228   -
229   - async_schedule(acpi_pm_clocksource_async, NULL);
230   - return 0;
231 223 }
232 224  
233 225 /* We use fs_initcall because we want the PCI fixups to have run