From: Tiwei Bie <tiwei.bie@linux.dev>
To: richard@nod.at, anton.ivanov@cambridgegreys.com,
johannes@sipsolutions.net
Cc: linux-um@lists.infradead.org, tiwei.btw@antgroup.com,
tiwei.bie@linux.dev
Subject: [PATCH 0/9] um: Add SMP support
Date: Sun, 27 Jul 2025 14:29:28 +0800 [thread overview]
Message-ID: <20250727062937.1369050-1-tiwei.bie@linux.dev> (raw)
From: Tiwei Bie <tiwei.btw@antgroup.com>
This series adds initial symmetric multi-processing (SMP) support
to UML. With this support, users can 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 guest
processes is also supported. Currently, the limitation is that
multi-threading within the same guest process does not yet support
true SMP in userspace, as 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 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
RFC: https://lore.kernel.org/linux-um/20250713172536.404809-1-tiwei.bie@linux.dev/
Tiwei Bie (9):
um: Stop tracking virtual CPUs via mm_cpumask()
um: Remove unused cpu_data and current_cpu_data macros
um: vdso: Implement __vdso_getcpu() via syscall
um: Preserve errno within signal handler
um: Turn signals_* into thread-local variables
um: Determine sleep based on need_resched()
um: Define timers on a per-CPU basis
um: Support directing IO signals to calling thread
um: Add initial SMP support
arch/um/Kconfig | 39 +++-
arch/um/include/asm/Kbuild | 3 +-
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/mmu_context.h | 11 -
arch/um/include/asm/percpu.h | 20 ++
arch/um/include/asm/pgtable.h | 2 +
arch/um/include/asm/processor-generic.h | 8 +-
arch/um/include/asm/smp.h | 23 +-
arch/um/include/asm/spinlock.h | 8 +
arch/um/include/linux/smp-internal.h | 21 ++
arch/um/include/linux/time-internal.h | 3 +
arch/um/include/shared/kern_util.h | 2 +
arch/um/include/shared/longjmp.h | 3 +-
arch/um/include/shared/os.h | 15 +-
arch/um/include/shared/skas/mm_id.h | 3 +
arch/um/include/shared/smp.h | 19 ++
arch/um/kernel/Makefile | 1 +
arch/um/kernel/irq.c | 35 +++-
arch/um/kernel/ksyms.c | 2 +-
arch/um/kernel/mem.c | 2 +
arch/um/kernel/process.c | 20 +-
arch/um/kernel/skas/mmu.c | 32 ++-
arch/um/kernel/smp.c | 266 ++++++++++++++++++++++++
arch/um/kernel/time.c | 54 +++--
arch/um/kernel/tlb.c | 5 +-
arch/um/kernel/trap.c | 2 +-
arch/um/kernel/um_arch.c | 24 ++-
arch/um/os-Linux/Makefile | 4 +-
arch/um/os-Linux/file.c | 10 +-
arch/um/os-Linux/main.c | 5 +-
arch/um/os-Linux/process.c | 10 +
arch/um/os-Linux/signal.c | 14 +-
arch/um/os-Linux/skas/process.c | 9 +
arch/um/os-Linux/smp.c | 86 ++++++++
arch/um/os-Linux/start_up.c | 4 +
arch/um/os-Linux/time.c | 42 ++--
arch/x86/um/vdso/um_vdso.c | 18 +-
40 files changed, 769 insertions(+), 99 deletions(-)
create mode 100644 arch/um/include/asm/percpu.h
create mode 100644 arch/um/include/asm/spinlock.h
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
--
2.34.1
next reply other threads:[~2025-07-27 6:30 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-27 6:29 Tiwei Bie [this message]
2025-07-27 6:29 ` [PATCH 1/9] um: Stop tracking virtual CPUs via mm_cpumask() Tiwei Bie
2025-07-27 6:29 ` [PATCH 2/9] um: Remove unused cpu_data and current_cpu_data macros Tiwei Bie
2025-07-27 6:29 ` [PATCH 3/9] um: vdso: Implement __vdso_getcpu() via syscall Tiwei Bie
2025-07-27 6:29 ` [PATCH 4/9] um: Preserve errno within signal handler Tiwei Bie
2025-07-27 6:29 ` [PATCH 5/9] um: Turn signals_* into thread-local variables Tiwei Bie
2025-07-27 6:29 ` [PATCH 6/9] um: Determine sleep based on need_resched() Tiwei Bie
2025-07-27 6:29 ` [PATCH 7/9] um: Define timers on a per-CPU basis Tiwei Bie
2025-07-27 6:29 ` [PATCH 8/9] um: Support directing IO signals to calling thread Tiwei Bie
2025-07-27 6:29 ` [PATCH 9/9] um: Add initial SMP support Tiwei Bie
2025-07-28 10:47 ` Johannes Berg
2025-07-28 15:28 ` Randy Dunlap
2025-07-28 16:04 ` Tiwei Bie
2025-07-28 16:27 ` Johannes Berg
2025-07-29 15:06 ` Tiwei Bie
2025-07-29 15:37 ` Johannes Berg
2025-07-30 4:18 ` Tiwei Bie
2025-08-10 4:33 ` Tiwei Bie
2025-07-28 13:55 ` Johannes Berg
2025-07-28 16:06 ` Tiwei Bie
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250727062937.1369050-1-tiwei.bie@linux.dev \
--to=tiwei.bie@linux.dev \
--cc=anton.ivanov@cambridgegreys.com \
--cc=johannes@sipsolutions.net \
--cc=linux-um@lists.infradead.org \
--cc=richard@nod.at \
--cc=tiwei.btw@antgroup.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.