android_kernel_xiaomi_sm7250/include/asm-x86_64
Venkatesh Pallipadi 8a9e1b0f56 [PATCH] Platform SMIs and their interferance with tsc based delay calibration
Issue:
Current tsc based delay_calibration can result in significant errors in
loops_per_jiffy count when the platform events like SMIs
(System Management Interrupts that are non-maskable) are present. This could
lead to potential kernel panic(). This issue is becoming more visible with 2.6
kernel (as default HZ is 1000) and on platforms with higher SMI handling
latencies. During the boot time, SMIs are mostly used by BIOS (for things
like legacy keyboard emulation).

Description:
The psuedocode for current delay calibration with tsc based delay looks like
(0) Estimate a value for loops_per_jiffy
(1) While (loops_per_jiffy estimate is accurate enough)
(2)   wait for jiffy transition (jiffy1)
(3)   Note down current tsc (tsc1)
(4)   loop until tsc becomes tsc1 + loops_per_jiffy
(5)   check whether jiffy changed since jiffy1 or not and refine
loops_per_jiffy estimate

Consider the following cases
Case 1:
If SMIs happen between (2) and (3) above, we can end up with a
loops_per_jiffy value that is too low. This results in shorted delays and
kernel can panic () during boot (Mostly at IOAPIC timer initialization
timer_irq_works() as we don't have enough timer interrupts in a specified
interval).

Case 2:
If SMIs happen between (3) and (4) above, then we can end up with a
loops_per_jiffy value that is too high. And with current i386 code, too
high lpj value (greater than 17M) can result in a overflow in
delay.c:__const_udelay() again resulting in shorter delay and panic().

Solution:
The patch below makes the calibration routine aware of asynchronous events
like SMIs. We increase the delay calibration time and also identify any
significant errors (greater than 12.5%) in the calibration and notify it to
user.

Patch below changes both i386 and x86-64 architectures to use this
new and improved calibrate_delay_direct() routine.

Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-23 09:45:08 -07:00
..
8253pit.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
a.out.h [PATCH] x86_64: TASK_SIZE fixes for compatibility mode processes 2005-06-21 18:46:12 -07:00
acpi.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
agp.h [PATCH] AGP fix for Xen VMM 2005-06-07 12:35:43 -07:00
apic.h [PATCH] check nmi watchdog is broken 2005-05-01 08:58:48 -07:00
apicdef.h [PATCH] x86_64: Increase number of IO-APICs 2005-05-17 07:59:13 -07:00
atomic.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
bitops.h [PATCH] add x86-64 specific support for sparsemem 2005-06-23 09:45:07 -07:00
boot.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
bootsetup.h [PATCH] Increase number of e820 entries hard limit from 32 to 128 2005-05-01 08:58:51 -07:00
bug.h [PATCH] x86_64: CONFIG_BUG=n fixes 2005-05-25 15:31:28 -07:00
bugs.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
byteorder.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
cache.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
cacheflush.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
calling.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
checksum.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
compat.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
cpu.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
cpufeature.h [PATCH] CPUID bug and inconsistency fix 2005-05-01 08:58:49 -07:00
cputime.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
current.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
debugreg.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
delay.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
desc.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
div64.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
dma-mapping.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
dma.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
dwarf2.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
e820.h [PATCH] Increase number of e820 entries hard limit from 32 to 128 2005-05-01 08:58:51 -07:00
elf.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
errno.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
fcntl.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
fixmap.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
floppy.h [PATCH] make some things static 2005-05-05 16:36:47 -07:00
fpu32.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
genapic.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
hardirq.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
hdreg.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
hpet.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
hw_irq.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
i387.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ia32_unistd.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ia32.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ide.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
io_apic.h [PATCH] x86_64: Remove unique APIC/IO-APIC ID check 2005-05-17 07:59:14 -07:00
io.h [PATCH] reorganize x86-64 NUMA and DISCONTIGMEM config options 2005-06-23 09:45:06 -07:00
ioctl.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ioctls.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ipcbuf.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ipi.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
irq.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
kdebug.h [PATCH] x86_64: Keep only a single debug notifier chain 2005-04-16 15:25:13 -07:00
kmap_types.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
kprobes.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ldt.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
linkage.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
local.h [PATCH] x86_64: Correct wrong comment in local.h 2005-04-16 15:25:08 -07:00
mach_apic.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
mc146818rtc.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
mce.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
mman.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
mmsegment.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
mmu_context.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
mmu.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
mmx.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
mmzone.h [PATCH] reorganize x86-64 NUMA and DISCONTIGMEM config options 2005-06-23 09:45:06 -07:00
module.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
mpspec.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
msgbuf.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
msi.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
msr.h [PATCH] x86_64: Switch SMP bootup over to new CPU hotplug state machine 2005-04-16 15:25:19 -07:00
mtrr.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
namei.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
nmi.h [PATCH] x86_64: Collected NMI watchdog fixes. 2005-05-17 07:59:16 -07:00
node.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
numa.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
numnodes.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
page.h [PATCH] reorganize x86-64 NUMA and DISCONTIGMEM config options 2005-06-23 09:45:06 -07:00
param.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
parport.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
pci-direct.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
pci.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
pda.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
percpu.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
pgalloc.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
pgtable.h [PATCH] Hugepage consolidation 2005-06-21 18:46:15 -07:00
poll.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
posix_types.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
prctl.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
processor.h [PATCH] x86_64: TASK_SIZE fixes for compatibility mode processes 2005-06-21 18:46:12 -07:00
proto.h [PATCH] x86_64: Add pmtimer support 2005-05-17 07:59:15 -07:00
ptrace.h [PATCH] x86_64: Use a common function to find code segment bases 2005-04-16 15:24:59 -07:00
resource.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
rtc.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
rwlock.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
rwsem.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
scatterlist.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
seccomp.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
sections.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
segment.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
semaphore.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
sembuf.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
serial.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
setup.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
shmbuf.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
shmparam.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
sigcontext32.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
sigcontext.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
siginfo.h [PATCH] consolidate SIGEV_PAD_SIZE 2005-05-01 08:59:08 -07:00
signal.h [PATCH] asm/signal.h unification 2005-05-04 07:33:15 -07:00
smp.h [PATCH] smp_processor_id() cleanup 2005-06-21 18:46:13 -07:00
socket.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
sockios.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
sparsemem.h [PATCH] add x86-64 specific support for sparsemem 2005-06-23 09:45:07 -07:00
spinlock.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
stat.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
statfs.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
string.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
suspend.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
swiotlb.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
system.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
termbits.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
termios.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
thread_info.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
timex.h [PATCH] Platform SMIs and their interferance with tsc based delay calibration 2005-06-23 09:45:08 -07:00
tlb.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
tlbflush.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
topology.h [PATCH] reorganize x86-64 NUMA and DISCONTIGMEM config options 2005-06-23 09:45:06 -07:00
types.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
uaccess.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ucontext.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
unaligned.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
unistd.h [PATCH] consolidate sys_shmat 2005-05-01 08:59:12 -07:00
user32.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
user.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
vga.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
vsyscall32.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
vsyscall.h [PATCH] x86_64: Add pmtimer support 2005-05-17 07:59:15 -07:00
xor.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00