kernel_optimize_test/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
atomic64_32.c
atomic64_386_32.S
atomic64_cx8_32.S
cache-smp.c
checksum_32.S
clear_page_64.S
cmdline.c
cmpxchg8b_emu.S
cmpxchg16b_emu.S
copy_page_64.S
copy_user_64.S
cpu.c
csum-copy_64.S
csum-partial_64.c
csum-wrappers_64.c
delay.c x86/timer: Make delay() work during early bootup 2017-01-22 10:03:12 +01:00
getuser.S
hweight.S
inat.c
insn.c
iomap_copy_64.S
kaslr.c
Makefile
memcpy_32.c
memcpy_64.S
memmove_64.S
memset_64.S
misc.c
mmx_32.c
msr-reg-export.c
msr-reg.S
msr-smp.c
msr.c x86/msr: Cleanup/streamline MSR helpers 2016-11-16 10:23:02 +01:00
putuser.S
rwsem.S
string_32.c
strstr_32.c
usercopy_32.c Replace <asm/uaccess.h> with <linux/uaccess.h> globally 2016-12-24 11:46:01 -08:00
usercopy_64.c
usercopy.c
x86-opcode-map.txt