Skip to content

Commit 399ead3

Browse files
committed
Merge tag 'uml-for-linux-6.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/uml/linux
Pull UML updates from Johannes Berg: "Apart from the usual small churn, we have - initial SMP support (only kernel) - major vDSO cleanups (and fixes for 32-bit)" * tag 'uml-for-linux-6.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/uml/linux: (33 commits) um: Disable KASAN_INLINE when STATIC_LINK is selected um: Don't rename vmap to kernel_vmap um: drivers: virtio: use string choices helper um: Always set up AT_HWCAP and AT_PLATFORM x86/um: Remove FIXADDR_USER_START and FIXADDR_USE_END um: Remove __access_ok_vsyscall() um: Remove redundant range check from __access_ok_vsyscall() um: Remove fixaddr_user_init() x86/um: Drop gate area handling x86/um: Do not inherit vDSO from host um: Split out default elf_aux_hwcap x86/um: Move ELF_PLATFORM fallback to x86-specific code um: Split out default elf_aux_platform um: Avoid circular dependency on asm-offsets in pgtable.h um: Enable SMP support on x86 asm-generic: percpu: Add assembly guard um: vdso: Remove getcpu support on x86 um: Add initial SMP support um: Define timers on a per-CPU basis um: Determine sleep based on need_resched() ...
2 parents 07025b5 + a3209bb commit 399ead3

64 files changed

Lines changed: 972 additions & 865 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Documentation/features/core/generic-idle-thread/arch-support.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
| s390: | ok |
2525
| sh: | ok |
2626
| sparc: | ok |
27-
| um: | TODO |
27+
| um: | ok |
2828
| x86: | ok |
2929
| xtensa: | ok |
3030
-----------------------

arch/um/Kconfig

Lines changed: 44 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ menu "UML-specific options"
55
config UML
66
bool
77
default y
8+
select ARCH_DISABLE_KASAN_INLINE if STATIC_LINK
89
select ARCH_NEEDS_DEFER_KASAN if STATIC_LINK
910
select ARCH_WANTS_DYNAMIC_TASK_STRUCT
1011
select ARCH_HAS_CACHE_LINE_SIZE
@@ -28,6 +29,7 @@ config UML
2829
select OF_EARLY_FLATTREE if OF
2930
select GENERIC_IRQ_SHOW
3031
select GENERIC_CPU_DEVICES
32+
select GENERIC_SMP_IDLE_THREAD
3133
select HAVE_GCC_PLUGINS
3234
select ARCH_SUPPORTS_LTO_CLANG
3335
select ARCH_SUPPORTS_LTO_CLANG_THIN
@@ -81,10 +83,48 @@ config HZ
8183
int
8284
default 100
8385

84-
config NR_CPUS
86+
config UML_SUBARCH_SUPPORTS_SMP
87+
bool
88+
89+
config SMP
90+
bool "Symmetric multi-processing support"
91+
default n
92+
depends on UML_SUBARCH_SUPPORTS_SMP
93+
help
94+
This option enables UML SMP support.
95+
96+
With this enabled, users can tell UML to start multiple virtual
97+
processors. Each virtual processor is represented as a separate
98+
host thread.
99+
100+
In UML, kthreads and normal threads (when running in kernel mode)
101+
can be scheduled and executed simultaneously on different virtual
102+
processors. However, the userspace code of normal threads still
103+
runs within their respective single-threaded stubs.
104+
105+
That is, SMP support is available both within the kernel and
106+
across different processes, but remains limited within threads
107+
of the same process in userspace.
108+
109+
config NR_CPUS_RANGE_BEGIN
85110
int
86-
range 1 1
87-
default 1
111+
default 1 if !SMP
112+
default 2
113+
114+
config NR_CPUS_RANGE_END
115+
int
116+
default 1 if !SMP
117+
default 64
118+
119+
config NR_CPUS_DEFAULT
120+
int
121+
default 1 if !SMP
122+
default 2
123+
124+
config NR_CPUS
125+
int "Maximum number of CPUs" if SMP
126+
range NR_CPUS_RANGE_BEGIN NR_CPUS_RANGE_END
127+
default NR_CPUS_DEFAULT
88128

89129
source "arch/$(HEADER_ARCH)/um/Kconfig"
90130

@@ -200,12 +240,6 @@ config KERNEL_STACK_ORDER
200240
increase in the size of the state which needs to be saved when handling
201241
signals.
202242

203-
config MMAPPER
204-
tristate "iomem emulation driver"
205-
help
206-
This driver allows a host file to be used as emulated IO memory inside
207-
UML.
208-
209243
config PGTABLE_LEVELS
210244
int
211245
default 4 if 64BIT
@@ -260,6 +294,7 @@ source "arch/um/drivers/Kconfig"
260294

261295
config ARCH_SUSPEND_POSSIBLE
262296
def_bool y
297+
depends on !SMP
263298

264299
menu "Power management options"
265300

arch/um/Makefile

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,19 +46,17 @@ ARCH_INCLUDE := -I$(srctree)/$(SHARED_HEADERS)
4646
ARCH_INCLUDE += -I$(srctree)/$(HOST_DIR)/um/shared
4747
KBUILD_CPPFLAGS += -I$(srctree)/$(HOST_DIR)/um
4848

49-
# -Dvmap=kernel_vmap prevents anything from referencing the libpcap.o symbol so
50-
# named - it's a common symbol in libpcap, so we get a binary which crashes.
51-
#
52-
# Same things for in6addr_loopback and mktime - found in libc. For these two we
53-
# only get link-time error, luckily.
49+
# -Dstrrchr=kernel_strrchr (as well as the various in6addr symbols) prevents
50+
# anything from referencing
51+
# libc symbols with the same name, which can cause a linker error.
5452
#
5553
# -Dlongjmp=kernel_longjmp prevents anything from referencing the libpthread.a
5654
# embedded copy of longjmp, same thing for setjmp.
5755
#
58-
# These apply to USER_CFLAGS to.
56+
# These apply to USER_CFLAGS too.
5957

6058
KBUILD_CFLAGS += $(CFLAGS) $(CFLAGS-y) -D__arch_um__ \
61-
$(ARCH_INCLUDE) $(MODE_INCLUDE) -Dvmap=kernel_vmap \
59+
$(ARCH_INCLUDE) $(MODE_INCLUDE) \
6260
-Dlongjmp=kernel_longjmp -Dsetjmp=kernel_setjmp \
6361
-Din6addr_loopback=kernel_in6addr_loopback \
6462
-Din6addr_any=kernel_in6addr_any -Dstrrchr=kernel_strrchr \

arch/um/drivers/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ obj-$(CONFIG_STDERR_CONSOLE) += stderr_console.o
2929

3030
obj-$(CONFIG_UML_NET_VECTOR) += vector.o
3131
obj-$(CONFIG_MCONSOLE) += mconsole.o
32-
obj-$(CONFIG_MMAPPER) += mmapper_kern.o
3332
obj-$(CONFIG_BLK_DEV_UBD) += ubd.o
3433
obj-$(CONFIG_UML_SOUND) += hostaudio.o
3534
obj-$(CONFIG_NULL_CHAN) += null.o

arch/um/drivers/mmapper_kern.c

Lines changed: 0 additions & 135 deletions
This file was deleted.

arch/um/drivers/virtio_uml.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <linux/of.h>
2525
#include <linux/platform_device.h>
2626
#include <linux/slab.h>
27+
#include <linux/string_choices.h>
2728
#include <linux/virtio.h>
2829
#include <linux/virtio_config.h>
2930
#include <linux/virtio_ring.h>
@@ -1151,8 +1152,7 @@ void virtio_uml_set_no_vq_suspend(struct virtio_device *vdev,
11511152
return;
11521153

11531154
vu_dev->no_vq_suspend = no_vq_suspend;
1154-
dev_info(&vdev->dev, "%sabled VQ suspend\n",
1155-
no_vq_suspend ? "dis" : "en");
1155+
dev_info(&vdev->dev, "%s VQ suspend\n", str_disabled_enabled(no_vq_suspend));
11561156
}
11571157

11581158
static void vu_of_conn_broken(struct work_struct *wk)

arch/um/include/asm/current.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,16 @@
77

88
#ifndef __ASSEMBLER__
99

10+
#include <shared/smp.h>
11+
1012
struct task_struct;
1113
extern struct task_struct *cpu_tasks[NR_CPUS];
1214

1315
static __always_inline struct task_struct *get_current(void)
1416
{
15-
return cpu_tasks[0];
17+
return cpu_tasks[uml_curr_cpu()];
1618
}
1719

18-
1920
#define current get_current()
2021

2122
#endif /* __ASSEMBLER__ */

arch/um/include/asm/hardirq.h

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,30 @@
22
#ifndef __ASM_UM_HARDIRQ_H
33
#define __ASM_UM_HARDIRQ_H
44

5-
#include <asm-generic/hardirq.h>
5+
#include <linux/cache.h>
6+
#include <linux/threads.h>
67

78
#define __ARCH_IRQ_EXIT_IRQS_DISABLED 1
89

10+
typedef struct {
11+
unsigned int __softirq_pending;
12+
#if IS_ENABLED(CONFIG_SMP)
13+
unsigned int irq_resched_count;
14+
unsigned int irq_call_count;
15+
#endif
16+
} ____cacheline_aligned irq_cpustat_t;
17+
18+
DECLARE_PER_CPU_SHARED_ALIGNED(irq_cpustat_t, irq_stat);
19+
20+
#define __ARCH_IRQ_STAT
21+
22+
#define inc_irq_stat(member) this_cpu_inc(irq_stat.member)
23+
24+
#include <linux/irq.h>
25+
26+
static inline void ack_bad_irq(unsigned int irq)
27+
{
28+
pr_crit("unexpected IRQ trap at vector %02x\n", irq);
29+
}
30+
931
#endif /* __ASM_UM_HARDIRQ_H */

arch/um/include/asm/irqflags.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
#ifndef __UM_IRQFLAGS_H
33
#define __UM_IRQFLAGS_H
44

5-
extern int signals_enabled;
5+
int um_get_signals(void);
66
int um_set_signals(int enable);
77
void block_signals(void);
88
void unblock_signals(void);
99

1010
#define arch_local_save_flags arch_local_save_flags
1111
static inline unsigned long arch_local_save_flags(void)
1212
{
13-
return signals_enabled;
13+
return um_get_signals();
1414
}
1515

1616
#define arch_local_irq_restore arch_local_irq_restore

arch/um/include/asm/kasan.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@
2424

2525
#ifdef CONFIG_KASAN
2626
void kasan_init(void);
27-
28-
#if defined(CONFIG_STATIC_LINK) && defined(CONFIG_KASAN_INLINE)
29-
#error UML does not work in KASAN_INLINE mode with STATIC_LINK enabled!
30-
#endif
3127
#else
3228
static inline void kasan_init(void) { }
3329
#endif /* CONFIG_KASAN */

0 commit comments

Comments
 (0)