Skip to content

Baby steps toward cleaning up KERNEL_STACK_OFFSET

Andy Lutomirski lkml 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest6 patches 1 replyIn review
  2. v1 RFC3 patches 13 repliesSuperseded

Changes in v2 from the cover letter

- Fix missing export.
- Fix lguest code.
- Add more init_tss naming cleanups (Ingo's suggestion).
- Changelog improvements (Ingo).
- Improve the check in ist_begin_non_atomic (Denys).

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6x86: Add this_cpu_sp0() to read sp0 for the current cpuarch/x86/include/asm/processor.h arch/x86/kernel/process.c arch/x86/lguest/boot.c +1 more+8 -00 replies
2/6x86: Switch all C consumers of kernel_stack to this_cpu_sp0arch/x86/include/asm/thread_info.h arch/x86/kernel/traps.c+3 -40 replies
3/6x86, asm: Change the 32-bit sysenter code to use sp0arch/x86/ia32/ia32entry.S arch/x86/kernel/asm-offsets_64.c+2 -20 replies
4/6x86: Rename init_tss to cpu_tssarch/x86/ia32/ia32entry.S arch/x86/include/asm/processor.h arch/x86/kernel/cpu/common.c +7 more+16 -160 replies
5/6x86: Remove INIT_TSS and fold the definitions into cpu_tssarch/x86/include/asm/processor.h arch/x86/kernel/process.c+19 -210 replies
6/6x86, asm: Rename INIT_TSS_IST to TSS_ISTarch/x86/kernel/entry_64.S+3 -31 reply

Reviews trailers per patch

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

Read the v2 thread

Cover letter [PATCH v2 0/6] Baby steps toward cleaning up KERNEL_STACK_OFFSET

Denys is right that KERNEL_STACK_OFFSET is a mess. Let's start fixing it.

This removes all C code that *reads* kernel_stack. It also fixes the KERNEL_STACK_OFFSET abomination in ia32_sysenter_target.

It does not fix the KERNEL_STACK_OFFSET abomination in GET_THREAD_INFO and THREAD_INFO. I think that should be its own patch.

It also doesn't change the two syscall targets. To fix them, we should make a decision. Either we should make KERNEL_STACK_OFFSET have the correct nonzero value to save an instruction or we should get rid of kernel_stack entirely.

Changes from v1:
- Fix missing export.
- Fix lguest code.
- Add more init_tss naming cleanups (Ingo's suggestion).
- Changelog improvements (Ingo).
- Improve the check in ist_begin_non_atomic (Denys).

Andy Lutomirski (6):
x86: Add this_cpu_sp0() to read sp0 for the current cpu
x86: Switch all C consumers of kernel_stack to this_cpu_sp0 x86, asm: Change the 32-bit sysenter code to use sp0
x86: Rename init_tss to cpu_tss
x86: Remove INIT_TSS and fold the definitions into cpu_tss x86, asm: Rename INIT_TSS_IST to TSS_IST

 arch/x86/ia32/ia32entry.S          |  3 +--
 arch/x86/include/asm/processor.h   | 27 ++++++---------------------
 arch/x86/include/asm/thread_info.h |  3 +--
 arch/x86/kernel/asm-offsets_64.c   |  1 +
 arch/x86/kernel/cpu/common.c       |  6 +++---
 arch/x86/kernel/entry_64.S         |  6 +++---
 arch/x86/kernel/ioport.c           |  2 +-
 arch/x86/kernel/process.c          | 23 +++++++++++++++++++++--
 arch/x86/kernel/process_32.c       |  2 +-
 arch/x86/kernel/process_64.c       |  2 +-
 arch/x86/kernel/traps.c            |  4 ++--
 arch/x86/kernel/vm86_32.c          |  4 ++--
 arch/x86/lguest/boot.c             |  1 +
 arch/x86/power/cpu.c               |  2 +-
 arch/x86/xen/enlighten.c           |  1 +
 15 files changed, 46 insertions(+), 41 deletions(-)
Signature · 1 line
2.1.0