Skip to content

Rework stub syscall and page table handling

Benjamin Berg linux-um 4 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest12 patches 0 repliesNew
  2. v312 patches 4 repliesSuperseded
  3. v212 patches 0 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v112 patches6 repliesSuperseded

Changes in v4 from the cover letter

* Only clear memory up to TASK_SIZE

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/12um: Remove stub-data.h include from common-offsets.harch/um/include/shared/common-offsets.h arch/x86/um/shared/sysdep/stub_32.h arch/x86/um/shared/sysdep/stub_64.h+8 -110 replies
2/12um: Create signal stack memory assignment in stub_dataarch/um/include/shared/as-layout.h arch/um/include/shared/skas/stub-data.h arch/um/kernel/skas/clone.c +2 more+24 -80 replies
3/12um: Add generic stub_syscall6 functionarch/x86/um/shared/sysdep/stub_32.h arch/x86/um/shared/sysdep/stub_64.h+38 -00 replies
4/12um: Rework syscall handlingarch/um/include/shared/os.h arch/um/include/shared/skas/mm_id.h arch/um/include/shared/skas/stub-data.h +13 more+274 -2970 replies
5/12um: compress memory related stub syscalls while adding themarch/um/os-Linux/skas/mem.c+39 -00 replies
6/12um: remove LDT supportarch/um/include/asm/mmu.h arch/um/include/shared/skas/stub-data.h arch/um/kernel/skas/mmu.c +6 more+10 -4770 replies
7/12um: remove copy_context_skas0arch/um/include/shared/os.h arch/um/include/shared/skas/stub-data.h arch/um/kernel/skas/Makefile +6 more+10 -2290 replies
8/12um: Delay flushing syscalls until the thread is restartedarch/um/include/shared/os.h arch/um/include/shared/skas/mm_id.h arch/um/include/shared/skas/skas.h +4 more+49 -420 replies
9/12um: Do not flush MM in flush_threadarch/um/kernel/exec.c arch/um/kernel/skas/mmu.c+24 -50 replies
10/12um: remove force_flush_all from fork_handlerarch/um/include/asm/mmu_context.h arch/um/kernel/process.c arch/um/kernel/tlb.c+15 -330 replies
11/12um: simplify and consolidate TLB updatesarch/um/include/shared/os.h arch/um/kernel/tlb.c arch/um/os-Linux/skas/mem.c+99 -3170 replies
12/12um: refactor TLB update handlingarch/um/drivers/ubd_kern.c arch/um/include/asm/mmu.h arch/um/include/asm/pgtable.h +6 more+110 -1320 replies

Reviews trailers per patch

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

Read the v4 thread

Cover letter [PATCH v4 00/12] Rework stub syscall and page table handling

From: Benjamin Berg <[email protected]>

This patchset reworks the stub syscall handling and also redos how page table updates are tracked and synchronized. Some of this originated in the SECCOMP patchset, but it became clear that these refactorings make sense independently as they result in a considerably fewer page faults.

As an example, these changes bring the runtime of one of the hostapd hwsim test modules from 121 seconds down to 103 seconds. Actual results will depend heavily on how pagefault heavy the workload is.

Lowering the amount of pagefaults is due to proactively syncing PTEs that are set (and were previously unset) and also delaying synchronization so that multiple updates can be done in one step rather than requiring multiple task switches.

This refactoring also fixes various odd corner cases in how UML was handling memory and cloning of MMs. As part of this work, support for LDTs has been dropped. My expectation is that this is not a problem as it should only be needed by legacy applications.

Changes in v4:
* Only clear memory up to TASK_SIZE

Changes in v3:
* Remove more left over code from copy_context_skas0 removal
* Fix mprotect syscall in stub

Changes in v2:
* Address comments from Tiwei Bie
* Remove duplicate report_enomem declaration

Benjamin Berg (12):
um: Remove stub-data.h include from common-offsets.h
um: Create signal stack memory assignment in stub_data
um: Add generic stub_syscall6 function
um: Rework syscall handling
um: compress memory related stub syscalls while adding them
um: remove LDT support
um: remove copy_context_skas0
um: Delay flushing syscalls until the thread is restarted
um: Do not flush MM in flush_thread
um: remove force_flush_all from fork_handler
um: simplify and consolidate TLB updates
um: refactor TLB update handling

 arch/um/drivers/ubd_kern.c              |   2 -
 arch/um/include/asm/mmu.h               |  10 +-
 arch/um/include/asm/mmu_context.h       |   2 -
 arch/um/include/asm/pgtable.h           |  32 ++
 arch/um/include/asm/tlbflush.h          |  46 +-
 arch/um/include/shared/as-layout.h      |   2 +-
 arch/um/include/shared/common-offsets.h |   5 -
 arch/um/include/shared/os.h             |  27 +-
 arch/um/include/shared/skas/mm_id.h     |   2 +-
 arch/um/include/shared/skas/skas.h      |   2 +
 arch/um/include/shared/skas/stub-data.h |  36 +-
 arch/um/include/shared/user.h           |   8 +
 arch/um/kernel/exec.c                   |   9 -
 arch/um/kernel/process.c                |   2 -
 arch/um/kernel/skas/Makefile            |   9 +-
 arch/um/kernel/skas/clone.c             |  48 ---
 arch/um/kernel/skas/mmu.c               |  54 ++-
 arch/um/kernel/skas/process.c           |  18 +
 arch/um/kernel/skas/stub.c              |  69 +++
 arch/um/kernel/tlb.c                    | 545 ++++--------------------
 arch/um/kernel/trap.c                   |  15 +-
 arch/um/os-Linux/skas/mem.c             | 245 ++++++-----
 arch/um/os-Linux/skas/process.c         | 121 +-----
 arch/um/os-Linux/start_up.c             |   1 +
 arch/x86/um/Makefile                    |   4 +-
 arch/x86/um/asm/mm_context.h            |  70 ---
 arch/x86/um/ldt.c                       | 380 -----------------
 arch/x86/um/shared/sysdep/stub.h        |   2 +-
 arch/x86/um/shared/sysdep/stub_32.h     |  45 +-
 arch/x86/um/shared/sysdep/stub_64.h     |  41 +-
 arch/x86/um/stub_32.S                   |  56 ---
 arch/x86/um/stub_64.S                   |  50 ---
 arch/x86/um/tls_32.c                    |   1 +
 33 files changed, 554 insertions(+), 1405 deletions(-)
 delete mode 100644 arch/um/kernel/skas/clone.c
 create mode 100644 arch/um/kernel/skas/stub.c
 delete mode 100644 arch/x86/um/asm/mm_context.h
 delete mode 100644 arch/x86/um/ldt.c
 delete mode 100644 arch/x86/um/stub_32.S
 delete mode 100644 arch/x86/um/stub_64.S
Signature · 1 line
2.45.2