From: Tiwei Bie <tiwei.bie@linux.dev>
To: benjamin@sipsolutions.net
Cc: richard@nod.at, anton.ivanov@cambridgegreys.com,
johannes@sipsolutions.net, linux-um@lists.infradead.org,
tiwei.btw@antgroup.com, tiwei.bie@linux.dev
Subject: Re: [RFC PATCH 0/4] um: Add SMP support
Date: Mon, 14 Jul 2025 22:56:01 +0800 [thread overview]
Message-ID: <20250714145601.3504868-1-tiwei.bie@linux.dev> (raw)
In-Reply-To: <844b77adc65be7fa5cc0e7b1a89a76137bd686a3.camel@sipsolutions.net>
Hi Benjamin,
On Mon, 14 Jul 2025 14:37:33 +0200, Benjamin Berg wrote:
> Hi Tiwei,
>
> this is pretty cool, I really did not expect patches for SMP :-)
I'm really happy you like it. :)
>
> I have not dived in a lot. From a cursory glance, I expect that there
> are currently still issues if a process is actually multi-threaded. But
> even this state is really neat already.
>
> As for proper multi-threading support, I would like to make sure you
> are aware of the flush_tlb_* functions in tlbflush.h. These will need
> to be updated so that these flushes happen synchronously as another
> thread might otherwise access data for too long.
>
> There are probably a few things to figure out in that regard about
> where/when to flush the TLB entries in a multi-threaded userspace.
> After all, there can be up to the number of CPUs worker threads and one
> probably only wants one of them to sync the TLBs at any point in tmie.
That makes sense! Thanks for the heads-up! I'll take a closer look.
>
> Anyway, nice work!
Thanks! :)
Tiwei
> Benjamin
>
> On Mon, 2025-07-14 at 01:25 +0800, Tiwei Bie wrote:
> > From: Tiwei Bie <tiwei.btw@antgroup.com>
> >
> > This is a follow-up to the discussion in this thread:
> > https://lore.kernel.org/linux-um/20250711065021.2535362-4-tiwei.bie@linux.dev/
> >
> > Currently, this is still a PoC and requires further improvements.
> >
> > I performed a kernel build test inside UML with 8 virtual CPUs
> > enabled:
> >
> > $ tar xf linux-6.15.tar.gz
> > $ cd linux-6.15
> > $ make ARCH=um defconfig > /dev/null
> > $ time make ARCH=um -j16 > /dev/null
> >
> > real 6m2.529s
> > user 43m37.665s
> > sys 0m34.585s
> > $ ./linux --version
> > 6.15.0
> > $ cat /proc/cpuinfo | grep -c '^processor'
> > 8
> >
> > 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 nohz=n seccomp=on init=/bin/sh \
> > ubd0=$your_rootfs_image
> >
> > This patchset depends on the following patchset:
> > https://lore.kernel.org/linux-um/20250711065021.2535362-1-tiwei.bie@linux.dev/
> >
> > Tiwei Bie (4):
> > 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: Add SMP support
> >
> > arch/um/Kconfig | 28 ++-
> > 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 | 7 +
> > arch/um/include/asm/mmu_context.h | 11 --
> > arch/um/include/asm/pgtable.h | 2 +
> > arch/um/include/asm/processor-generic.h | 8 +-
> > arch/um/include/asm/smp.h | 31 +++-
> > arch/um/include/asm/spinlock.h | 8 +
> > arch/um/include/linux/smp-internal.h | 8 +
> > 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 | 12 +-
> > arch/um/include/shared/smp.h | 14 ++
> > arch/um/kernel/Makefile | 1 +
> > arch/um/kernel/irq.c | 31 +++-
> > arch/um/kernel/ksyms.c | 2 +-
> > arch/um/kernel/mem.c | 2 +
> > arch/um/kernel/process.c | 19 +-
> > arch/um/kernel/skas/mmu.c | 16 +-
> > arch/um/kernel/smp.c | 223
> > ++++++++++++++++++++++++
> > arch/um/kernel/time.c | 48 +++--
> > arch/um/kernel/tlb.c | 5 +-
> > arch/um/kernel/trap.c | 2 +-
> > arch/um/kernel/um_arch.c | 60 ++++++-
> > arch/um/os-Linux/Makefile | 4 +-
> > arch/um/os-Linux/file.c | 72 ++++++--
> > arch/um/os-Linux/main.c | 5 +-
> > arch/um/os-Linux/process.c | 15 ++
> > arch/um/os-Linux/signal.c | 16 +-
> > arch/um/os-Linux/skas/process.c | 1 +
> > arch/um/os-Linux/smp.c | 44 +++++
> > arch/um/os-Linux/start_up.c | 3 +
> > arch/um/os-Linux/time.c | 29 +--
> > arch/um/os-Linux/user_syms.c | 5 +
> > arch/x86/um/vdso/um_vdso.c | 18 +-
> > 39 files changed, 695 insertions(+), 99 deletions(-)
> > 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
> >
>
next prev parent reply other threads:[~2025-07-14 15:41 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-13 17:25 [RFC PATCH 0/4] um: Add SMP support Tiwei Bie
2025-07-13 17:25 ` [RFC PATCH 1/4] um: Stop tracking virtual CPUs via mm_cpumask() Tiwei Bie
2025-07-13 17:25 ` [RFC PATCH 2/4] um: Remove unused cpu_data and current_cpu_data macros Tiwei Bie
2025-07-13 17:25 ` [RFC PATCH 3/4] um: vdso: Implement __vdso_getcpu() via syscall Tiwei Bie
2025-07-13 17:25 ` [RFC PATCH 4/4] um: Add SMP support Tiwei Bie
2025-07-14 12:37 ` [RFC PATCH 0/4] " Benjamin Berg
2025-07-14 14:56 ` Tiwei Bie [this message]
2025-07-24 21:21 ` Richard Weinberger
2025-07-25 11:42 ` 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=20250714145601.3504868-1-tiwei.bie@linux.dev \
--to=tiwei.bie@linux.dev \
--cc=anton.ivanov@cambridgegreys.com \
--cc=benjamin@sipsolutions.net \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).