Skip to content

Descriptor table fixes / cleanup for i386

Zachary Amsden lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest21 patches 36 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/21i386 Pnp segments in segment hdrivers/pnp/pnpbios/bioscalls.c include/asm-i386/segment.h+14 -90 replies
2/21i386 Always relax segmentsarch/i386/kernel/apm.c+17 -380 replies
3/21i386 Apm seg in gdtarch/i386/kernel/apm.c arch/i386/kernel/head.S+5 -100 replies
4/21i386 Broken bios commonarch/i386/kernel/apm.c arch/i386/kernel/cpu/common.c arch/i386/kernel/head.S +2 more+23 -187 replies
5/21i386 Pnp byte granularityarch/i386/kernel/head.S include/asm-i386/system.h+7 -70 replies
6/21i386 Fixed pnp bios limitsarch/i386/kernel/head.S drivers/pnp/pnpbios/bioscalls.c+13 -150 replies
7/21i386 Losing fs gs to biosarch/i386/kernel/apm.c drivers/pnp/pnpbios/bioscalls.c include/asm-i386/desc.h+42 -561 reply
8/21i386 Segment protect properlydrivers/pnp/pnpbios/bioscalls.c include/asm-i386/desc.h include/asm-i386/system.h+12 -50 replies
9/21i386 Deprecate obsolete ldt accessorsinclude/asm-i386/system.h+0 -160 replies
10/21i386 Use protected segment for 16bit stackarch/i386/kernel/cpu/common.c+2 -40 replies
11/21i386 Stop deleting ntarch/i386/kernel/cpu/common.c+0 -50 replies
12/21i386 Deprecate descriptor asmarch/i386/kernel/apm.c arch/i386/kernel/cpu/common.c arch/i386/mm/fault.c +3 more+70 -583 replies
13/21i386 Gdt page isolationarch/i386/kernel/apm.c arch/i386/kernel/cpu/common.c arch/i386/kernel/head.S +4 more+19 -90 replies
14/21i386 Apm is on cpu zero onlyarch/i386/kernel/apm.c+11 -125 replies
15/21i386 Deprecate useless bugarch/i386/kernel/process.c+1 -110 replies
16/21i386 Eliminate duplicate segment macrosarch/i386/kernel/process.c arch/i386/kernel/ptrace.c include/asm-i386/desc.h+22 -632 replies
17/21i386 Ldt cleanups 1arch/i386/kernel/entry.S arch/i386/kernel/ptrace.c include/asm-i386/ldt.h +1 more+9 -40 replies
18/21i386 Ldt cleanups 2include/asm-i386/desc.h+18 -10 replies
19/21i386 Kprobes semaphore fixarch/i386/kernel/kprobes.c arch/i386/kernel/ptrace.c arch/i386/mm/fault.c +1 more+129 -11913 replies
20/21i386 Ldt cleanups 3arch/i386/kernel/ldt.c include/asm-i386/desc.h include/asm-i386/mmu.h+64 -560 replies
21/21i386 Ldt context inlinearch/i386/kernel/ldt.c include/asm-i386/desc.h include/asm-i386/mmu_context.h+24 -252 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/21] Descriptor table fixes / cleanup for i386

Patches to clean up descriptor access in Linux to make it friendly to virtualization environments. The basic problem is that the GDT must be write protected, which causes spurious overhead when the GDT lies on the same page as other data. This problem exists both for VMware and Xen; Xen actually requires page isolation, so we have implemented the most general and compatible solution. While VMware suffers only from false sharing, Xen suffers from the false-validation problem, which requires the extra space for the GDT page to be zeroed.

The GDTs for secondary processors are allocated dynamically to avoid bloating kernel static data with GDTs for not-present processors.

Along the way, I discovered two serious but subtle problems; there was no consistent mechanism for converting an EIP to a linear address, which presented a serious challenge for the kprobes code, since the LDT is protected by a semaphore which must be acquired in user context, with interrupts enabled. The second problem was that %fs, and %gs could end up loaded with bad cached values after a PnP or APM BIOS call.

Many other small enhancements to readability, compactness, correctness, and overall goodness were discovered along the way.

The core piece of these patches is getting the GDT page aligned; I wil rework or deprecate any other pieces of this that are not wanted / unnecessary / (hopefully not) buggy.

Testing: 4 way SMP boot-halts, kernel compiles, stress, UML, LDT
test suites, insane cross-modifying code for breakpoint testing.

Zachary Amsden <[email protected]>