linux/arch/x86/lib
Jiri Slaby 4c45c5167c x86/timer: Make delay() work during early bootup
When a panic happens during bootup, "Rebooting in X seconds.." is
shown, but reboot happens immediatelly. It is because panic() uses mdelay()
and mdelay() calls __const_udelay() immediately, which does not
work while booting.

The per_cpu cpu_info.loops_per_jiffy value is not initialized yet, so
__const_udelay() actually multiplies the number of loops by zero. This
results in __const_udelay() to delay the execution only by a nanosecond
or so.

So check whether cpu_info.loops_per_jiffy is zero and use
loops_per_jiffy in that case. mdelay() will not be so precise without
proper calibration, but it works relatively well.

Before:

  [    0.170039] delaying 100ms
  [    0.170828] done

After

  [    0.214042] delaying 100ms
  [    0.313974] done

I do not think the added check matters given we are about to spin the
processor in the next few hundred cycles.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20170119114730.2670-1-jslaby@suse.cz
[ Minor edits. ]
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2017-01-22 10:03:12 +01:00
..
.gitignore x86: Gitignore: arch/x86/lib/inat-tables.c 2009-11-04 13:11:28 +01:00
atomic64_32.c x86: Adjust asm constraints in atomic64 wrappers 2012-01-20 17:29:31 -08:00
atomic64_386_32.S x86/debug: Remove perpetually broken, unmaintainable dwarf annotations 2015-06-02 07:57:48 +02:00
atomic64_cx8_32.S x86/debug: Remove perpetually broken, unmaintainable dwarf annotations 2015-06-02 07:57:48 +02:00
cache-smp.c x86/lib: Audit and remove any unnecessary uses of module.h 2016-07-14 15:06:58 +02:00
checksum_32.S x86: move exports to actual definitions 2016-08-07 23:47:15 -04:00
clear_page_64.S x86: move exports to actual definitions 2016-08-07 23:47:15 -04:00
cmdline.c x86/boot: Pass in size to early cmdline parsing 2016-02-03 12:03:18 +01:00
cmpxchg8b_emu.S x86: move exports to actual definitions 2016-08-07 23:47:15 -04:00
cmpxchg16b_emu.S x86/debug: Remove perpetually broken, unmaintainable dwarf annotations 2015-06-02 07:57:48 +02:00
copy_page_64.S x86: move exports to actual definitions 2016-08-07 23:47:15 -04:00
copy_user_64.S x86/copy_user: Unify the code by removing the 64-bit asm _copy_*_user() variants 2016-11-01 07:41:27 +01:00
cpu.c x86/lib: Audit and remove any unnecessary uses of module.h 2016-07-14 15:06:58 +02:00
csum-copy_64.S x86/debug: Remove perpetually broken, unmaintainable dwarf annotations 2015-06-02 07:57:48 +02:00
csum-partial_64.c x86: move exports to actual definitions 2016-08-07 23:47:15 -04:00
csum-wrappers_64.c Merge branch 'x86-headers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2016-08-01 14:23:42 -04:00
delay.c x86/timer: Make delay() work during early bootup 2017-01-22 10:03:12 +01:00
getuser.S x86: move exports to actual definitions 2016-08-07 23:47:15 -04:00
hweight.S Merge branch 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild 2016-10-14 14:26:58 -07:00
inat.c x86: Fix to decode grouped AVX with VEX pp bits 2012-02-11 15:11:35 +01:00
insn.c x86/insn: Add AVX-512 support to the instruction decoder 2016-07-21 09:37:11 -03:00
iomap_copy_64.S x86/debug: Remove perpetually broken, unmaintainable dwarf annotations 2015-06-02 07:57:48 +02:00
kaslr.c x86/mm/kaslr: Fix -Wformat-security warning 2016-08-11 10:58:12 +02:00
Makefile Merge branch 'x86-boot-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2016-07-25 17:32:28 -07:00
memcpy_32.c x86/lib: Audit and remove any unnecessary uses of module.h 2016-07-14 15:06:58 +02:00
memcpy_64.S Merge branch 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild 2016-10-14 14:26:58 -07:00
memmove_64.S x86: move exports to actual definitions 2016-08-07 23:47:15 -04:00
memset_64.S x86: move exports to actual definitions 2016-08-07 23:47:15 -04:00
misc.c x86/boot: Further compress CPUs bootup message 2013-10-01 10:52:30 +02:00
mmx_32.c x86/lib: Audit and remove any unnecessary uses of module.h 2016-07-14 15:06:58 +02:00
msr-reg-export.c x86/lib: Audit and remove any unnecessary uses of module.h 2016-07-14 15:06:58 +02:00
msr-reg.S x86/debug: Remove perpetually broken, unmaintainable dwarf annotations 2015-06-02 07:57:48 +02:00
msr-smp.c x86/lib: Audit and remove any unnecessary uses of module.h 2016-07-14 15:06:58 +02:00
msr.c x86/msr: Cleanup/streamline MSR helpers 2016-11-16 10:23:02 +01:00
putuser.S x86: move exports to actual definitions 2016-08-07 23:47:15 -04:00
rwsem.S locking/rwsem: Fix comment on register clobbering 2016-05-16 12:35:40 +02:00
string_32.c x86/lib: Audit and remove any unnecessary uses of module.h 2016-07-14 15:06:58 +02:00
strstr_32.c x86: move exports to actual definitions 2016-08-07 23:47:15 -04:00
usercopy_32.c Replace <asm/uaccess.h> with <linux/uaccess.h> globally 2016-12-24 11:46:01 -08:00
usercopy_64.c Merge branch 'x86-headers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2016-08-01 14:23:42 -04:00
usercopy.c x86/copy_user: Unify the code by removing the 64-bit asm _copy_*_user() variants 2016-11-01 07:41:27 +01:00
x86-opcode-map.txt libnvdimm for 4.8 2016-07-28 17:38:16 -07:00