um: Add SMP support
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v4 Latest8 patches 0 repliesNew
- v37 patches 2 repliesSuperseded
- v210 patches 31 repliesSuperseded
Earlier versions · 1
| Version | Posted | Patches | Replies | Status |
|---|---|---|---|---|
| v1 | 9 patches | 10 replies | Superseded |
Changes in v4 from the cover letter
- Add SMP support for initial_jmpbuf and cb_{proc,arg,back};
- Do not disable kmalloc in initial_thread_cb();
- Collect the "Acked-by" from Arnd Bergmann;
- Misc fixes and cleanups;
Patches in v4 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/8 | um: Do not disable kmalloc in initial_thread_cb()arch/ | +0 | 0 replies | |
| 2/8 | um: Turn signals_* into thread-local variablesarch/ arch/ arch/ +2 more | +13 | 0 replies | |
| 3/8 | um: Determine sleep based on need_resched()arch/ arch/ arch/ +2 more | +26 | 0 replies | |
| 4/8 | um: Define timers on a per-CPU basisarch/ arch/ arch/ +3 more | +69 | 0 replies | |
| 5/8 | um: Add initial SMP supportDocumentation/ arch/ arch/ +26 more | +766 | 0 replies | |
| 6/8 | um: vdso: Remove getcpu support on x86arch/ arch/ | +0 | 0 replies | |
| 7/8 | asm-generic: percpu: Add assembly guardinclude/ | +3 | 0 replies | |
| 8/8 | um: Enable SMP support on x86arch/ arch/ | +11 | 0 replies |
Reviews trailers per patch
1 of 8 patches has a Reviewed-by or Acked-by.
| Patch | Arnd Bergmann |
|---|---|
| 1/8 | |
| 2/8 | |
| 3/8 | |
| 4/8 | |
| 5/8 | |
| 6/8 | |
| 7/8 | A-b |
| 8/8 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v4 0/8] um: Add SMP support
From: Tiwei Bie <[email protected]>
This series adds initial symmetric multi-processing (SMP) support to UML. With this support, it is now possible for users to tell UML to start multiple virtual CPUs, each represented as a separate host thread.
In UML, kthreads and normal threads (when running in kernel mode) can be scheduled and executed simultaneously on different virtual CPUs. However, the userspace code of normal threads currently still runs within their respective single-threaded stubs.
So SMP within the kernel is supported. SMP across different processes in userspace is also supported. Currently, the limitation is that multi-threading within the same process does not yet support true SMP in userspace, because it would require converting the stub into a multi-threaded implementation, which is not covered in this series.
Extending the stub to support true SMP in userspace within the same process could be done later and requires careful design. It may be better to handle it in a follow-up series.
Here are some steps to try out SMP support in UML:
1. Build UML with CONFIG_SMP=y and, for example, CONFIG_NR_CPUS=8.
2. Launch a UML instance with, for example, 8 virtual CPUs.
$ ./linux mem=16G ncpus=8 seccomp=on init=/bin/sh ubd0=$your_rootfs_image
v4:
- Add SMP support for initial_jmpbuf and cb_{proc,arg,back};
- Do not disable kmalloc in initial_thread_cb();
- Collect the "Acked-by" from Arnd Bergmann;
- Misc fixes and cleanups;
v3 (https://lore.kernel.org/all/[email protected]/):
- Fix need_resched based idle sleep; (Johannes)
- Remove getcpu support from the vdso on UML/x86; (Johannes)
- Describe 'cpu' parameter of os_timer_disable; ([email protected])
- Misc fixes and cleanups;
v2 (https://lore.kernel.org/all/[email protected]/):
- Implement IPI based on RT signal; (Johannes)
- Fix raw_smp_processor_id() for non-SMP case; (Johannes)
- Add sparse check for turnstile; (Johannes)
- Implement spinlock in $SUBARCH;
- Fix potential race on stub's siginfo;
- Rewrite AP bring-up (e.g. switch to generic idle thread);
- Misc fixes and cleanups;
v1: https://lore.kernel.org/all/[email protected]/
RFC: https://lore.kernel.org/all/[email protected]/
Tiwei Bie (8):
um: Do not disable kmalloc in initial_thread_cb()
um: Turn signals_* into thread-local variables
um: Determine sleep based on need_resched()
um: Define timers on a per-CPU basis
um: Add initial SMP support
um: vdso: Remove getcpu support on x86
asm-generic: percpu: Add assembly guard
um: Enable SMP support on x86
.../core/generic-idle-thread/arch-support.txt | 2 +- arch/um/Kconfig | 46 +++- arch/um/include/asm/current.h | 5 +- arch/um/include/asm/hardirq.h | 24 +- arch/um/include/asm/irqflags.h | 4 +- arch/um/include/asm/mmu.h | 10 + arch/um/include/asm/pgtable.h | 2 + arch/um/include/asm/smp.h | 15 +- arch/um/include/linux/smp-internal.h | 17 ++ arch/um/include/linux/time-internal.h | 3 + arch/um/include/shared/kern_util.h | 1 + arch/um/include/shared/longjmp.h | 3 +- arch/um/include/shared/os.h | 24 +- arch/um/include/shared/skas/mm_id.h | 5 + arch/um/include/shared/skas/skas.h | 2 + arch/um/include/shared/smp.h | 20 ++ arch/um/kernel/Makefile | 1 + arch/um/kernel/irq.c | 27 +- arch/um/kernel/ksyms.c | 2 +- arch/um/kernel/process.c | 14 +- arch/um/kernel/skas/mmu.c | 33 ++- arch/um/kernel/skas/process.c | 19 +- arch/um/kernel/smp.c | 242 ++++++++++++++++++ arch/um/kernel/time.c | 58 +++-- arch/um/kernel/tlb.c | 5 +- arch/um/kernel/trap.c | 2 +- arch/um/kernel/um_arch.c | 25 +- arch/um/os-Linux/Makefile | 4 +- arch/um/os-Linux/internal.h | 13 + arch/um/os-Linux/main.c | 2 +- arch/um/os-Linux/process.c | 20 ++ arch/um/os-Linux/signal.c | 46 +++- arch/um/os-Linux/skas/process.c | 39 ++- arch/um/os-Linux/smp.c | 148 +++++++++++ arch/um/os-Linux/start_up.c | 4 + arch/um/os-Linux/time.c | 78 ++++-- arch/x86/um/Kconfig | 3 + arch/x86/um/asm/spinlock.h | 8 + arch/x86/um/vdso/um_vdso.c | 20 -- arch/x86/um/vdso/vdso.lds.S | 2 - include/asm-generic/percpu.h | 3 + 41 files changed, 885 insertions(+), 116 deletions(-) create mode 100644 arch/um/include/linux/smp-internal.h create mode 100644 arch/um/include/shared/smp.h create mode 100644 arch/um/kernel/smp.c create mode 100644 arch/um/os-Linux/smp.c create mode 100644 arch/x86/um/asm/spinlock.h
base-commit: 211ddde0823f1442e4ad052a2f30f050145ccada
Signature · 1 line
2.34.1