[PATCH v2] um: Add VFIO-based virtual PCI driver

2025-04-13 Thread Tiwei Bie
Implement a new virtual PCI driver based on the VFIO framework. This driver allows users to pass through PCI devices to UML via VFIO. Currently, only MSI-X capable devices are supported, and it is assumed that drivers will use MSI-X. Signed-off-by: Tiwei Bie --- This driver has been tested with

Re: [PATCH AUTOSEL 6.13 23/28] um: Rewrite the sigio workaround based on epoll and tgkill

2025-04-07 Thread Tiwei Bie
On 2025/4/8 02:12, Sasha Levin wrote: > From: Tiwei Bie > > [ Upstream commit 33c9da5dfb18c2ff5a88d01aca2cf253cd0ac3bc ] > > The existing sigio workaround implementation removes FDs from the > poll when events are triggered, requiring users to re-add them via > add_sigio_

Re: [PATCH AUTOSEL 6.13 22/28] um: Switch to the pthread-based helper in sigio workaround

2025-04-07 Thread Tiwei Bie
On 2025/4/8 02:12, Sasha Levin wrote: > From: Tiwei Bie > > [ Upstream commit d295beeed2552a987796d627ba7d0985b1e2d72f ] > > The write_sigio thread and UML kernel thread share the same errno, > which can lead to conflicts when both call syscalls concurrently. > Switch

Re: [PATCH AUTOSEL 6.14 26/31] um: Rewrite the sigio workaround based on epoll and tgkill

2025-04-07 Thread Tiwei Bie
On 2025/4/8 02:10, Sasha Levin wrote: > From: Tiwei Bie > > [ Upstream commit 33c9da5dfb18c2ff5a88d01aca2cf253cd0ac3bc ] > > The existing sigio workaround implementation removes FDs from the > poll when events are triggered, requiring users to re-add them via > add_sigio_

Re: [PATCH AUTOSEL 6.14 25/31] um: Switch to the pthread-based helper in sigio workaround

2025-04-07 Thread Tiwei Bie
On 2025/4/8 02:10, Sasha Levin wrote: > From: Tiwei Bie > > [ Upstream commit d295beeed2552a987796d627ba7d0985b1e2d72f ] > > The write_sigio thread and UML kernel thread share the same errno, > which can lead to conflicts when both call syscalls concurrently. > Switch

Re: [PATCH v3 4/4] um: Prohibit the VM_CLONE flag in run_helper_thread()

2025-04-05 Thread Tiwei Bie
On 2025/3/20 16:32, Johannes Berg wrote: > On Wed, 2025-03-19 at 21:55 +0800, Tiwei Bie wrote: >> Directly creating helper threads with VM_CLONE using clone can >> compromise the thread safety of errno. Since all these helper >> threads have been converted to use os_run_h

Re: [PATCH 3/3] um: Add VFIO-based virtual PCI driver

2025-04-04 Thread Tiwei Bie
On 2025/3/20 16:50, Johannes Berg wrote: > On Sun, 2025-03-16 at 00:19 +0800, Tiwei Bie wrote: >> Implement a new virtual PCI driver based on the VFIO framework. >> This driver allows users to pass through PCI devices to UML via >> VFIO. Currently, only MSI-X capable devic

[PATCH 2/2] um: xterm: Update options for gnome-terminal

2025-03-26 Thread Tiwei Bie
The -x option is deprecated and might be removed in a future release of gnome-terminal. Let's recommend using -- instead. Signed-off-by: Tiwei Bie --- arch/um/drivers/xterm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/um/drivers/xterm.c b/arch/um/drivers/xt

[PATCH 1/2] um: xterm: Add Wayland support

2025-03-26 Thread Tiwei Bie
Under Wayland, we should check WAYLAND_DISPLAY instead. Signed-off-by: Tiwei Bie --- arch/um/drivers/xterm.c | 9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/arch/um/drivers/xterm.c b/arch/um/drivers/xterm.c index e4316c7981e8..f607af738eac 100644 --- a/arch/um

[PATCH 0/2] um: Minor cleanups to xterm

2025-03-26 Thread Tiwei Bie
Tiwei Bie (2): um: xterm: Add Wayland support um: xterm: Update options for gnome-terminal arch/um/drivers/xterm.c | 11 --- 1 file changed, 4 insertions(+), 7 deletions(-) -- 2.34.1

Re: [PATCH v3 4/4] um: Prohibit the VM_CLONE flag in run_helper_thread()

2025-03-25 Thread Tiwei Bie
On 2025/3/20 16:32, Johannes Berg wrote: > On Wed, 2025-03-19 at 21:55 +0800, Tiwei Bie wrote: >> Directly creating helper threads with VM_CLONE using clone can >> compromise the thread safety of errno. Since all these helper >> threads have been converted to use os_run_h

Re: [PATCH v2 1/4] um: Add pthread-based helper support

2025-03-25 Thread Tiwei Bie
On 2025/3/26 00:31, Benjamin Berg wrote: > On Tue, 2025-03-18 at 22:55 +0800, Tiwei Bie wrote: >> On 2025/3/18 21:16, Johannes Berg wrote: >>> On Tue, 2025-03-18 at 14:06 +0100, Johannes Berg wrote: >>>> On Thu, 2025-03-06 at 23:07 +0800, Tiwei Bie wrote: >&g

[PATCH v3 2/4] um: ubd: Switch to the pthread-based helper

2025-03-19 Thread Tiwei Bie
The ubd io thread and UML kernel thread share the same errno, which can lead to conflicts when both call syscalls concurrently. Switch to the pthread-based helper to address this issue. Signed-off-by: Tiwei Bie --- arch/um/drivers/ubd.h | 6 -- arch/um/drivers/ubd_kern.c | 25

[PATCH v3 3/4] um: Switch to the pthread-based helper in sigio workaround

2025-03-19 Thread Tiwei Bie
The write_sigio thread and UML kernel thread share the same errno, which can lead to conflicts when both call syscalls concurrently. Switch to the pthread-based helper to address this issue. Signed-off-by: Tiwei Bie --- arch/um/os-Linux/sigio.c | 44 +--- 1

[PATCH v3 0/4] um: Make errno multi-thread safe

2025-03-19 Thread Tiwei Bie
/20250221084049.1332318-1-tiwei@antgroup.com/ Tiwei Bie (4): um: Add pthread-based helper support um: ubd: Switch to the pthread-based helper um: Switch to the pthread-based helper in sigio workaround um: Prohibit the VM_CLONE flag in run_helper_thread() arch/um/drivers/ubd.h | 6 ++-- arch/um

[PATCH v3 1/4] um: Add pthread-based helper support

2025-03-19 Thread Tiwei Bie
Introduce a new set of utility functions that can be used to create pthread-based helpers. Helper threads created in this way will ensure thread safety for errno while sharing the same memory space. Signed-off-by: Tiwei Bie --- arch/um/include/shared/os.h | 5 +++ arch/um/os-Linux/helper.c

[PATCH v3 4/4] um: Prohibit the VM_CLONE flag in run_helper_thread()

2025-03-19 Thread Tiwei Bie
Directly creating helper threads with VM_CLONE using clone can compromise the thread safety of errno. Since all these helper threads have been converted to use os_run_helper_thread(), let's prevent using this flag in run_helper_thread(). Signed-off-by: Tiwei Bie --- arch/um/os-Linux/hel

Re: [PATCH v2 1/4] um: Add pthread-based helper support

2025-03-19 Thread Tiwei Bie
On 2025/3/19 17:11, Johannes Berg wrote: > On Thu, 2025-03-06 at 23:07 +0800, Tiwei Bie wrote: >> +void os_kill_helper_thread(struct os_helper_thread *td) >> +{ >> +pthread_kill(td->handle, SIGKILL); > > This ends up killing everything. > [...] > > Any

Re: [PATCH v2 1/4] um: Add pthread-based helper support

2025-03-18 Thread Tiwei Bie
On 2025/3/18 21:16, Johannes Berg wrote: > On Tue, 2025-03-18 at 14:06 +0100, Johannes Berg wrote: >> On Thu, 2025-03-06 at 23:07 +0800, Tiwei Bie wrote: >>> Introduce a new set of utility functions that can be used to create >>> pthread-based helpers. Helper threa

Re: [PATCH v2 1/4] um: Add pthread-based helper support

2025-03-18 Thread Tiwei Bie
On 2025/3/18 21:06, Johannes Berg wrote: > On Thu, 2025-03-06 at 23:07 +0800, Tiwei Bie wrote: >> Introduce a new set of utility functions that can be used to create >> pthread-based helpers. Helper threads created in this way will ensure >> thread safety for errno while sh

[PATCH 1/3] um: Rewrite the sigio workaround based on epoll and tgkill

2025-03-15 Thread Tiwei Bie
is inefficient due to frequent FD removal and re-addition. Rewrite the implementation based on epoll and tgkill for improved efficiency and reliability. Signed-off-by: Tiwei Bie --- arch/um/drivers/random.c | 2 +- arch/um/drivers/rtc_user.c | 2 +- arch/um/include/shared/os.h

[PATCH 3/3] um: Add VFIO-based virtual PCI driver

2025-03-15 Thread Tiwei Bie
Implement a new virtual PCI driver based on the VFIO framework. This driver allows users to pass through PCI devices to UML via VFIO. Currently, only MSI-X capable devices are supported, and it is assumed that drivers will use MSI-X. Signed-off-by: Tiwei Bie --- arch/um/drivers/Kconfig

[PATCH 0/3] um: Add VFIO-based PCI passthrough support

2025-03-15 Thread Tiwei Bie
2926434-1-tiwei@antgroup.com/ v1: - Add more details in the commit log; RFC: https://lore.kernel.org/all/20250310074057.3977758-1-tiwei@antgroup.com/ Tiwei Bie (3): um: Rewrite the sigio workaround based on epoll and tgkill um: virt-pci: Refactor virtio_pcidev into its own module um:

[PATCH 2/3] um: virt-pci: Refactor virtio_pcidev into its own module

2025-03-15 Thread Tiwei Bie
Decouple virt-pci and virtio_pcidev, refactoring virtio_pcidev into its own module. Define a set of APIs for virt-pci. This allows for future addition of more PCI emulation implementations. Signed-off-by: Tiwei Bie --- arch/um/drivers/Kconfig | 12 +- arch/um/drivers/Makefile

[RFC PATCH 1/3] um: Rewrite the sigio workaround based on epoll and tgkill

2025-03-11 Thread Tiwei Bie
The current implementation is somewhat convoluted and inefficient, and can lead to race conditions when updating sigio fds. This change rewrites the implementation based on epoll and tgkill for improved scalability and reliability. Signed-off-by: Tiwei Bie --- arch/um/drivers/random.c

[PATCH v2 2/4] um: ubd: Switch to the pthread-based helper

2025-03-11 Thread Tiwei Bie
The ubd io thread and UML kernel thread share the same errno, which can lead to conflicts when both call syscalls concurrently. Switch to the pthread-based helper to address this issue. Signed-off-by: Tiwei Bie --- arch/um/drivers/ubd.h | 6 -- arch/um/drivers/ubd_kern.c | 25

[PATCH v2 0/4] um: Make errno multi-thread safe

2025-03-11 Thread Tiwei Bie
v2: - Do not define the thread handle type as void *; - Minor tweaks to commit messages, log and comments; v1: https://lore.kernel.org/all/20250221084049.1332318-1-tiwei@antgroup.com/ Tiwei Bie (4): um: Add pthread-based helper support um: ubd: Switch to the pthread-based helper um

[RFC PATCH 2/3] um: virt-pci: Refactor virtio_pcidev into its own module

2025-03-11 Thread Tiwei Bie
Decouple virt-pci and virtio_pcidev, refactoring virtio_pcidev into its own module. Define a set of APIs for virt-pci. This allows for future addition of more PCI emulation implementations. Signed-off-by: Tiwei Bie --- arch/um/drivers/Kconfig | 12 +- arch/um/drivers/Makefile

[RFC PATCH 0/3] um: Add VFIO-based PCI passthrough support

2025-03-10 Thread Tiwei Bie
p.com/ Tiwei Bie (3): um: Rewrite the sigio workaround based on epoll and tgkill um: virt-pci: Refactor virtio_pcidev into its own module um: Add VFIO-based virtual PCI driver arch/um/drivers/Kconfig | 20 +- arch/um/drivers/Makefile| 5 +- arch/um/drivers/random.c

[RFC PATCH 3/3] um: Add VFIO-based virtual PCI driver

2025-03-10 Thread Tiwei Bie
Implement a new virtual PCI driver based on the VFIO framework. This driver allows users to pass through PCI devices to UML via VFIO. Currently, only MSI-X capable devices are supported, and it is assumed that drivers will use MSI-X. Signed-off-by: Tiwei Bie --- arch/um/drivers/Kconfig

[PATCH v2 3/4] um: Switch to the pthread-based helper in sigio workaround

2025-03-06 Thread Tiwei Bie
The write_sigio thread and UML kernel thread share the same errno, which can lead to conflicts when both call syscalls concurrently. Switch to the pthread-based helper to address this issue. Signed-off-by: Tiwei Bie --- arch/um/os-Linux/sigio.c | 44 +--- 1

[PATCH v2 1/4] um: Add pthread-based helper support

2025-03-06 Thread Tiwei Bie
Introduce a new set of utility functions that can be used to create pthread-based helpers. Helper threads created in this way will ensure thread safety for errno while sharing the same memory space. Signed-off-by: Tiwei Bie --- arch/um/include/shared/os.h | 5 +++ arch/um/os-Linux/helper.c

[PATCH v2 4/4] um: Prohibit the VM_CLONE flag in run_helper_thread()

2025-03-06 Thread Tiwei Bie
Directly creating helper threads with VM_CLONE using clone can compromise the thread safety of errno. Since all these helper threads have been converted to use os_run_helper_thread(), let's prevent using this flag in run_helper_thread(). Signed-off-by: Tiwei Bie --- arch/um/os-Linux/hel

[PATCH 3/4] um: Switch to the pthread-based helper in sigio workaround

2025-02-21 Thread Tiwei Bie
The write_sigio thread and UML kernel thread share the same errno, which can lead to conflicts when both call syscalls concurrently. Switch to the pthread-based helper to address this issue. Signed-off-by: Tiwei Bie --- arch/um/os-Linux/sigio.c | 44 +--- 1

[PATCH 4/4] um: Prohibit the VM_CLONE flag in run_helper_thread()

2025-02-21 Thread Tiwei Bie
Directly creating helper threads with VM_CLONE using clone can compromise the thread safety of errno. Since all these helper threads have been converted to use os_run_helper_thread(), let's prevent using this flag in run_helper_thread(). Signed-off-by: Tiwei Bie --- arch/um/os-Linux/hel

[PATCH 2/4] um: ubd: Switch to the pthread-based helper

2025-02-21 Thread Tiwei Bie
The ubd io thread and UML kernel thread share the same errno, which can lead to conflicts when both call syscalls concurrently. Switch to the pthread-based helper to address this issue. Signed-off-by: Tiwei Bie --- arch/um/drivers/ubd.h | 4 ++-- arch/um/drivers/ubd_kern.c | 25

[PATCH 1/4] um: Add the pthread-based helper support

2025-02-21 Thread Tiwei Bie
Introduce a new set of utility functions that can be used to create pthread-based helpers. Helper threads created in this way will ensure thread safety for errno while sharing memory address space. Signed-off-by: Tiwei Bie --- arch/um/include/shared/os.h | 3 ++ arch/um/os-Linux/helper.c

[PATCH 0/4] um: Make errno multi-thread safe

2025-02-21 Thread Tiwei Bie
Tiwei Bie (4): um: Add the pthread-based helper support um: ubd: Switch to the pthread-based helper um: Switch to the pthread-based helper in sigio workaround um: Prohibit the VM_CLONE flag in run_helper_thread() arch/um/drivers/ubd.h | 4 +-- arch/um/drivers/ubd_kern.c | 25

[PATCH] um: Update min_low_pfn to match changes in uml_reserved

2025-02-20 Thread Tiwei Bie
When uml_reserved is updated, min_low_pfn must also be updated accordingly. Otherwise, min_low_pfn will not accurately reflect the lowest available PFN. Signed-off-by: Tiwei Bie --- arch/um/kernel/mem.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/um/kernel/mem.c b/arch/um/kernel

[PATCH] um: Allocate vdso page pointer statically

2025-02-11 Thread Tiwei Bie
Instead of dynamically allocating the pointer to the vdso page during boot, we can just allocate it statically. Doing so will reduce error handling and make the code slightly more readable. Signed-off-by: Tiwei Bie --- arch/x86/um/vdso/vma.c | 17 +++-- 1 file changed, 3 insertions

[PATCH 0/2] Fixes and cleanups for fixmap removal

2025-01-13 Thread Tiwei Bie
Tiwei Bie (2): um: Include missing headers in asm/pgtable.h um: Remove unused asm/archparam.h header arch/um/include/asm/pgtable.h | 3 +++ arch/x86/um/asm/archparam.h | 20 2 files changed, 3 insertions(+), 20 deletions(-) delete mode 100644 arch/x86/um/asm

[PATCH 2/2] um: Remove unused asm/archparam.h header

2025-01-13 Thread Tiwei Bie
This header is no longer used after the removal of fixmap support in commit 5bfc4a3a0af3 ("um: Remove obsolete fixmap support"). Signed-off-by: Tiwei Bie --- arch/x86/um/asm/archparam.h | 20 1 file changed, 20 deletions(-) delete mode 100644 arch/x86/um/asm/a

[PATCH 1/2] um: Include missing headers in asm/pgtable.h

2025-01-13 Thread Tiwei Bie
/202501131814.e6cxjull-...@intel.com/ Fixes: 5bfc4a3a0af3 ("um: Remove obsolete fixmap support") Signed-off-by: Tiwei Bie --- arch/um/include/asm/pgtable.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/um/include/asm/pgtable.h b/arch/um/include/asm/pgtable.h index 9be6daca95be..56

[PATCH 0/9] um: Some minor cleanups

2024-11-28 Thread Tiwei Bie
Tiwei Bie (9): um: Mark parse_host_cpu_flags as __init um: Mark parse_cache_line as __init um: Mark get_top_address as __init um: Mark set_stklim as __init um: Mark install_fatal_handler as __init um: Mark setup_env_path as __init um: Remove unused PGD_BOUND macro um: Remove unused

[PATCH 7/9] um: Remove unused PGD_BOUND macro

2024-11-28 Thread Tiwei Bie
It's no longer used since commit 11100b1dfb6e ("uml: delete unused code"). Signed-off-by: Tiwei Bie --- arch/um/os-Linux/main.c | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/um/os-Linux/main.c b/arch/um/os-Linux/main.c index 3f0be24b3633..13f3bfeb6378 100644 --- a/a

[PATCH 5/9] um: Mark install_fatal_handler as __init

2024-11-28 Thread Tiwei Bie
It's only invoked during boot from main(). Signed-off-by: Tiwei Bie --- arch/um/os-Linux/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/um/os-Linux/main.c b/arch/um/os-Linux/main.c index cf9697aa17f3..3f394f25e059 100644 --- a/arch/um/os-Linux/main.c +++ b

[PATCH 8/9] um: Remove unused THREAD_NAME_LEN macro

2024-11-28 Thread Tiwei Bie
It's no longer used since commit 42fda66387da ("uml: throw out CONFIG_MODE_TT"). Signed-off-by: Tiwei Bie --- arch/um/os-Linux/main.c | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/um/os-Linux/main.c b/arch/um/os-Linux/main.c index 13f3bfeb6378..3c63ce19e3bf 100644 -

[PATCH 6/9] um: Mark setup_env_path as __init

2024-11-28 Thread Tiwei Bie
It's only invoked during boot from main(). Signed-off-by: Tiwei Bie --- arch/um/os-Linux/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/um/os-Linux/main.c b/arch/um/os-Linux/main.c index 3f394f25e059..3f0be24b3633 100644 --- a/arch/um/os-Linux/main.c +++ b

[PATCH 2/9] um: Mark parse_cache_line as __init

2024-11-28 Thread Tiwei Bie
It's only invoked during boot from get_host_cpu_features(). Signed-off-by: Tiwei Bie --- arch/um/kernel/um_arch.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c index c5e91d3fb64e..852267542a06 100644 --- a/ar

[PATCH 4/9] um: Mark set_stklim as __init

2024-11-28 Thread Tiwei Bie
It's only invoked during boot from main(). Signed-off-by: Tiwei Bie --- arch/um/os-Linux/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/um/os-Linux/main.c b/arch/um/os-Linux/main.c index 0afcdeb8995b..cf9697aa17f3 100644 --- a/arch/um/os-Linux/main.c +++ b

[PATCH 9/9] um: Remove unused user_context function

2024-11-28 Thread Tiwei Bie
It's no longer used since commit 6aa802ce6acc ("uml: throw out CHOOSE_MODE"). Signed-off-by: Tiwei Bie --- arch/um/kernel/process.c | 8 arch/x86/um/shared/sysdep/ptrace.h | 2 -- 2 files changed, 10 deletions(-) diff --git a/arch/um/kernel/process.c b

[PATCH 1/9] um: Mark parse_host_cpu_flags as __init

2024-11-28 Thread Tiwei Bie
It's only invoked during boot from get_host_cpu_features(). Signed-off-by: Tiwei Bie --- arch/um/kernel/um_arch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c index 62ddb865eb91..c5e91d3fb64e 100644 --- a/arch/um/k

[PATCH 3/9] um: Mark get_top_address as __init

2024-11-28 Thread Tiwei Bie
It's only invoked during boot from linux_main(). Signed-off-by: Tiwei Bie --- arch/um/kernel/um_arch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c index 852267542a06..3e03a716c6ec 100644 --- a/arch/um/kernel/um_a

[PATCH 3/3] um: Count iomem_size only once in physmem calculation

2024-11-28 Thread Tiwei Bie
When calculating max_physmem, we've already factored in the space used by iomem. We don't need to subtract it again. Signed-off-by: Tiwei Bie --- arch/um/kernel/um_arch.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel

[PATCH 1/3] um: Remove unused MODULES_LEN macro

2024-11-28 Thread Tiwei Bie
It's not used anywhere. And its definition doesn't seem right. Signed-off-by: Tiwei Bie --- arch/um/include/asm/pgtable.h | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/um/include/asm/pgtable.h b/arch/um/include/asm/pgtable.h index 12bfc58a8580..79ff979520bb 100644 ---

[PATCH 0/3] um: Some mem cleanups

2024-11-28 Thread Tiwei Bie
Tiwei Bie (3): um: Remove unused MODULES_LEN macro um: Remove obsolete fixmap support um: Count iomem_size only once in physmem calculation arch/um/include/asm/fixmap.h | 56 --- arch/um/include/asm/pgtable.h | 6 +--- arch/um/kernel/mem.c | 15

[PATCH 2/3] um: Remove obsolete fixmap support

2024-11-28 Thread Tiwei Bie
It was added to support highmem. But since the highmem support has been removed by commit a98a6d864d3b ("um: Remove broken highmem support"), it is no longer needed. Remove it to simplify the code. Signed-off-by: Tiwei Bie --- arch/um/include/asm/fixm

[PATCH] um: Always dump trace for specified task in show_stack

2024-11-06 Thread Tiwei Bie
STACKTRACE") Signed-off-by: Tiwei Bie --- arch/um/kernel/sysrq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/um/kernel/sysrq.c b/arch/um/kernel/sysrq.c index 4bb8622dc512..e3b6a2fd75d9 100644 --- a/arch/um/kernel/sysrq.c +++ b/arch/um/kernel/sysrq.c @@ -52,5 +52

[PATCH 0/4] um: Some minor driver fixes

2024-11-04 Thread Tiwei Bie
Tiwei Bie (4): um: ubd: Initialize ubd's disk pointer in ubd_add um: ubd: Do not use drvdata in release um: net: Do not use drvdata in release um: vector: Do not use drvdata in release arch/um/drivers/net_kern.c| 2 +- arch/um/drivers/ubd_kern.c| 4 +++- arch/um/dr

[PATCH 2/4] um: ubd: Do not use drvdata in release

2024-11-04 Thread Tiwei Bie
1af/0x2c3 [<6004ede3>] ? assign_work+0x0/0x58 [<600527a1>] worker_thread+0x2f7/0x37a [<6004ee3b>] ? set_pf_worker+0x0/0x64 [<6005765d>] ? arch_local_irq_save+0x0/0x2d [<60058e07>] ? kthread_exit+0x0/0x3a [<600524aa>] ? worker_thread+0x0/0x37a [<60058f9f>] kthr

[PATCH 3/4] um: net: Do not use drvdata in release

2024-11-04 Thread Tiwei Bie
save+0x0/0x2d [<6005d748>] ? kthread_exit+0x0/0x3a [<60057d21>] ? worker_thread+0x0/0x293 [<6005dbf1>] kthread+0x126/0x12b [<600219c5>] new_thread_handler+0x85/0xb6 Cc: sta...@vger.kernel.org Signed-off-by: Tiwei Bie --- arch/um/drivers/net_kern.c | 2 +- 1 file chang

[PATCH 4/4] um: vector: Do not use drvdata in release

2024-11-04 Thread Tiwei Bie
save+0x0/0x2d [<6005d748>] ? kthread_exit+0x0/0x3a [<60057d21>] ? worker_thread+0x0/0x293 [<6005dbf1>] kthread+0x126/0x12b [<600219c5>] new_thread_handler+0x85/0xb6 Cc: sta...@vger.kernel.org Signed-off-by: Tiwei Bie --- arch/um/drivers/vector_kern.c | 3 ++- 1 file

[PATCH 1/4] um: ubd: Initialize ubd's disk pointer in ubd_add

2024-11-04 Thread Tiwei Bie
Currently, the initialization of the disk pointer in the ubd structure is missing. It should be initialized with the allocated gendisk pointer in ubd_add(). Fixes: 32621ad7a7ea ("ubd: remove the ubd_gendisk array") Signed-off-by: Tiwei Bie --- arch/um/drivers/ubd_kern.c | 2 ++ 1 fi

Re: [RFC PATCH 8/9] um: Implement kernel side of SECCOMP based process handling

2024-10-26 Thread Tiwei Bie
On 2024/10/26 20:56, Johannes Berg wrote: > On Sat, 2024-10-26 at 13:04 +0200, Benjamin Berg wrote: +#include >>> >>> Hmm. If this works, why do we have UML_CONFIG_64BIT? For ASM stuff? >> >> So, I just had a quick look. It seems that before commit a95b37e20db9 >> ("kbuild: get out of

[PATCH 3/4] um: Set parent-death signal for write_sigio thread/process

2024-10-25 Thread Tiwei Bie
The write_sigio thread is not really a traditional thread. Set the parent-death signal for it to ensure that it will be killed if the UML kernel dies unexpectedly without proper cleanup. Signed-off-by: Tiwei Bie --- arch/um/os-Linux/sigio.c | 1 + 1 file changed, 1 insertion(+) diff --git a

[PATCH 1/4] um: Add os_set_pdeathsig helper function

2024-10-25 Thread Tiwei Bie
This helper can be used to set the parent-death signal of the calling process to SIGKILL to ensure that the process will be killed if the UML kernel dies unexpectedly without proper cleanup. This helper will be used in the follow-up patches. Signed-off-by: Tiwei Bie --- arch/um/include/shared

[PATCH 4/4] um: Use os_set_pdeathsig helper in winch thread/process

2024-10-24 Thread Tiwei Bie
Since we have a helper now, let's switch to using it. It will make the code slightly more consistent. Signed-off-by: Tiwei Bie --- arch/um/drivers/chan_user.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/um/drivers/chan_user.c b/arch/um/drivers/chan_user.c

[PATCH 2/4] um: Set parent-death signal for ubd io thread/process

2024-10-24 Thread Tiwei Bie
The ubd io thread is not really a traditional thread. Set the parent-death signal for it to ensure that it will be killed if the UML kernel dies unexpectedly without proper cleanup. Signed-off-by: Tiwei Bie --- arch/um/drivers/ubd_kern.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch

[PATCH 0/4] um: Set parent-death signal for sub-processes

2024-10-24 Thread Tiwei Bie
The ubd io and write_sigio threads/processes may leak e.g. when the main process is killed by "kill -9". Fix it by setting the parent-death signal for them. Tiwei Bie (4): um: Add os_set_pdeathsig helper function um: Set parent-death signal for ubd io thread/process um: Set pa

Re: [RFC PATCH v2 9/9] um: pass FD for memory operations when needed

2024-10-24 Thread Tiwei Bie
On 2024/10/23 22:08, Benjamin Berg wrote: [...] > diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c > index c663b67c3fd3..a29957e021f3 100644 > --- a/arch/um/os-Linux/skas/process.c > +++ b/arch/um/os-Linux/skas/process.c > @@ -16,6 +16,7 @@ > #include > #include >

[PATCH v2 1/2] um: Abandon the _PAGE_NEWPROT bit

2024-10-11 Thread Tiwei Bie
code and remove the unreachable code. Reviewed-by: Benjamin Berg Signed-off-by: Tiwei Bie --- arch/um/include/asm/pgtable.h | 37 +++--- arch/um/include/asm/tlbflush.h | 4 +- arch/um/include/shared/os.h | 2 - arch/um/include/shared/skas/stub-data.h | 1

[PATCH v2 0/2] um: Some page bit cleanups

2024-10-11 Thread Tiwei Bie
g/all/20241011053843.1623089-1-tiwei@antgroup.com/ Tiwei Bie (2): um: Abandon the _PAGE_NEWPROT bit um: Rename _PAGE_NEWPAGE to _PAGE_NEEDSYNC arch/um/include/asm/page.h | 2 +- arch/um/include/asm/pgtable-2level.h| 2 +- arch/um/include/asm/pgtable-4level.h| 14 ++---

[PATCH v2 2/2] um: Rename _PAGE_NEWPAGE to _PAGE_NEEDSYNC

2024-10-11 Thread Tiwei Bie
The _PAGE_NEWPAGE bit does not really indicate that this is a new page, but rather whether this entry needs to be synced or not. Renaming it to _PAGE_NEEDSYNC will make it more clear how everything ties together. Suggested-by: Benjamin Berg Signed-off-by: Tiwei Bie --- arch/um/include/asm

Re: [PATCH] um: Abandon the _PAGE_NEWPROT bit

2024-10-11 Thread Tiwei Bie
Hi, On 2024/10/11 15:39, Benjamin Berg wrote: > Hi, > > On Fri, 2024-10-11 at 13:38 +0800, Tiwei Bie wrote: >> When a PTE is updated in the page table, the _PAGE_NEWPAGE bit will >> always be set. And the corresponding page will always be mapped or >> unmapped depe

Re: [PATCH] um: Abandon the _PAGE_NEWPROT bit

2024-10-11 Thread Tiwei Bie
Hi Johannes, On 2024/10/11 15:38, Johannes Berg wrote: > Hi Tiwei, > > So kind of a nit, but if the resulting code looks like this: > >> @@ -184,17 +172,14 @@ static inline pte_t pte_wrprotect(pte_t pte) >> { >> if (likely(pte_get_bits(pte, _PAGE_RW))) >> pte_clear_bits(pte, _

[PATCH] um: Abandon the _PAGE_NEWPROT bit

2024-10-10 Thread Tiwei Bie
code and remove the unreachable code. Signed-off-by: Tiwei Bie --- arch/um/include/asm/pgtable.h | 40 --- arch/um/include/shared/os.h | 2 - arch/um/include/shared/skas/stub-data.h | 1 - arch/um/kernel/skas/stub.c | 10 arch/um/kernel/tlb.c

[PATCH 1/9] um: Remove UML specific debug parameter

2024-10-10 Thread Tiwei Bie
It does nothing but emit a warning when 'debug' is provided in the kernel command line. It can be a bit annoying, as 'debug' is also a valid kernel parameter to enable kernel debugging. Signed-off-by: Tiwei Bie --- arch/um/kernel/um_arch.c | 13 - 1 file c

[PATCH 8/9] um: hostaudio: Do not propagate mixer parameter to kernel

2024-10-10 Thread Tiwei Bie
This parameter is UML specific and is unknown to kernel. It should not be propagated to kernel, otherwise it will trigger a warning and be passed to user space as an environment option. Signed-off-by: Tiwei Bie --- arch/um/drivers/hostaudio_kern.c | 1 + 1 file changed, 1 insertion(+) diff

[PATCH 6/9] hostfs: Do not propagate hostfs parameter to kernel

2024-10-10 Thread Tiwei Bie
ned-off-by: Tiwei Bie --- fs/hostfs/hostfs_kern.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c index 6d1cf2436ead..8d47c6b70c9f 100644 --- a/fs/hostfs/hostfs_kern.c +++ b/fs/hostfs/hostfs_kern.c @@ -57,6 +57,7 @@ static int __init hostfs

[PATCH 0/9] um: Some parameter cleanups

2024-10-10 Thread Tiwei Bie
Tiwei Bie (9): um: Remove UML specific debug parameter um: Do not propagate mem parameter to kernel um: Do not propagate uml_dir parameter to kernel um: Do not propagate dtb parameter to kernel um: Do not propagate noreboot parameter to kernel hostfs: Do not propagate hostfs parameter

[PATCH 5/9] um: Do not propagate noreboot parameter to kernel

2024-10-10 Thread Tiwei Bie
This parameter is UML specific and is unknown to kernel. It should not be propagated to kernel, otherwise it could be passed to user space as a command line option by kernel with a warning like: Unknown kernel command line parameters "noreboot", will be passed to user space. Signed-off

[PATCH 2/9] um: Do not propagate mem parameter to kernel

2024-10-10 Thread Tiwei Bie
This parameter is UML specific and is unknown to kernel. It should not be propagated to kernel, otherwise it will be passed to user space as an environment option by kernel with a warning like: Unknown kernel command line parameters "mem=2G", will be passed to user space. Signed-off

[PATCH 7/9] um: hostaudio: Do not propagate dsp parameter to kernel

2024-10-10 Thread Tiwei Bie
This parameter is UML specific and is unknown to kernel. It should not be propagated to kernel, otherwise it will trigger a warning and be passed to user space as an environment option. Signed-off-by: Tiwei Bie --- arch/um/drivers/hostaudio_kern.c | 1 + 1 file changed, 1 insertion(+) diff

[PATCH 4/9] um: Do not propagate dtb parameter to kernel

2024-10-10 Thread Tiwei Bie
This parameter is UML specific and is unknown to kernel. It should not be propagated to kernel, otherwise it will be passed to user space as an environment option by kernel with a warning like: Unknown kernel command line parameters "dtb=/foo", will be passed to user space. Signed-off

[PATCH 9/9] um: Do not propagate initrd parameter to kernel

2024-10-10 Thread Tiwei Bie
This parameter is UML specific. It specifies the name of the file containing the initrd image, which is unknown to kernel. Signed-off-by: Tiwei Bie --- arch/um/kernel/initrd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/um/kernel/initrd.c b/arch/um/kernel/initrd.c index

[PATCH 3/9] um: Do not propagate uml_dir parameter to kernel

2024-10-10 Thread Tiwei Bie
ned-off-by: Tiwei Bie --- arch/um/os-Linux/umid.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/um/os-Linux/umid.c b/arch/um/os-Linux/umid.c index e09d65b05d1c..eb523ab1e218 100644 --- a/arch/um/os-Linux/umid.c +++ b/arch/um/os-Linux/umid.c @@ -358,6 +358,8 @@ char *get_umid(void)

Re: [PATCH v8 2/7] um: use execveat to create userspace MMs

2024-09-19 Thread Tiwei Bie
On 2024/7/5 03:05, Benjamin Berg wrote: [...] > static int userspace_tramp(void *stack) > { > - struct sigaction sa; > - void *addr; > - int fd; > + char *const argv[] = { "uml-userspace", NULL }; > + int pipe_fds[2]; > unsigned long long offset; > - unsigned long se

Re: [PATCH v8 5/7] um: Discover host_task_size from envp

2024-09-19 Thread Tiwei Bie
On 2024/7/5 03:05, Benjamin Berg wrote: [...] > diff --git a/arch/x86/um/os-Linux/task_size.c > b/arch/x86/um/os-Linux/task_size.c > index 1dc9adc20b1c..a91599799b1a 100644 > --- a/arch/x86/um/os-Linux/task_size.c > +++ b/arch/x86/um/os-Linux/task_size.c > @@ -1,151 +1,19 @@ > // SPDX-License-Ide

Re: [PATCH] um: Remove 3-level page table support on i386

2024-09-19 Thread Tiwei Bie
On 2024/9/19 15:22, Benjamin Berg wrote: > On Thu, 2024-09-19 at 08:54 +0200, Johannes Berg wrote: >> On Wed, 2024-09-18 at 14:17 +0800, Tiwei Bie wrote: >>> The highmem support has been removed by commit a98a6d864d3b ("um: >>> Remove broken highmem supp

[PATCH] um: Remove 3-level page table support on i386

2024-09-17 Thread Tiwei Bie
The highmem support has been removed by commit a98a6d864d3b ("um: Remove broken highmem support"). The 2-level page table is sufficient on UML/i386 now. Remove the 3-level page table support on UML/i386 which is still marked as experimental. Suggested-by: Benjamin Berg Signed-off-by:

[PATCH v2 0/4] Minor physmem cleanups/fixes

2024-09-15 Thread Tiwei Bie
Changes in v2: - Add "um: Fix potential integer overflow during physmem setup"; v1: https://lore.kernel.org/all/20240913142137.248245-1-tiwei@antgroup.com/ Tiwei Bie (4): um: Remove the redundant declaration of high_physmem um: Fix potential integer overflow during physmem

[PATCH v2 1/4] um: Remove the redundant declaration of high_physmem

2024-09-15 Thread Tiwei Bie
high_physmem has already been declared in as-layout.h, so there is no need to declare it explicitly in the .c file again. While at it, group the declarations of __real_malloc and __real_free together to make the code slightly more readable. Signed-off-by: Tiwei Bie --- arch/um/os-Linux/main.c

[PATCH v2 3/4] um: Remove highmem leftovers

2024-09-15 Thread Tiwei Bie
Highmem was only supported on UML/i386. And the support has been removed by commit a98a6d864d3b ("um: Remove broken highmem support"). Remove the leftovers and stop UML from trying to setup highmem when the sum of physmem_size and iomem_size exceeds max_physmem. Signed-off-by:

[PATCH v2 4/4] um: Fix the definition for physmem_size

2024-09-15 Thread Tiwei Bie
Currently physmem_size is defined as long long but declared locally as unsigned long long before using it in separate .c files. Make them match by defining physmem_size as unsigned long long and also move the declaration to a common header to allow the compiler to check it. Signed-off-by: Tiwei

[PATCH v2 2/4] um: Fix potential integer overflow during physmem setup

2024-09-15 Thread Tiwei Bie
This issue happens when the real map size is greater than LONG_MAX, which can be easily triggered on UML/i386. Fixes: fe205bdd1321 ("um: Print minimum physical memory requirement") Signed-off-by: Tiwei Bie --- arch/um/kernel/physmem.c | 6 +++--- 1 file changed, 3 insertions(+), 3

Re: [PATCH 2/3] um: Remove highmem leftovers

2024-09-15 Thread Tiwei Bie
o too. Regards, Tiwei > > When I took a look at it for the 4-level page table support on 64 bit I > got a bit confused. But I had not realized that highmem support had > been removed. > > Benjamin > > On Fri, 2024-09-13 at 22:21 +0800, Tiwei Bie wrote: >> Highmem wa

[PATCH 2/3] um: Remove highmem leftovers

2024-09-13 Thread Tiwei Bie
Highmem was only supported on UML/i386. And the support has been removed by commit a98a6d864d3b ("um: Remove broken highmem support"). Remove the leftovers and stop UML from trying to setup highmem when the sum of physmem_size and iomem_size exceeds max_physmem. Signed-off-by:

[PATCH 0/3] Minor physmem cleanups/fixes

2024-09-13 Thread Tiwei Bie
Tiwei Bie (3): um: Remove the redundant declaration of high_physmem um: Remove highmem leftovers um: Fix the definition for physmem_size arch/um/drivers/virtio_uml.c | 9 - arch/um/include/shared/as-layout.h | 3 ++- arch/um/include/shared/mem_user.h | 5 ++--- arch/um

[PATCH 3/3] um: Fix the definition for physmem_size

2024-09-13 Thread Tiwei Bie
Currently physmem_size is defined as long long but declared locally as unsigned long long before using it in separate .c files. Make them match by defining physmem_size as unsigned long long and also move the declaration to a common header to allow the compiler to check it. Signed-off-by: Tiwei

[PATCH 1/3] um: Remove the redundant declaration of high_physmem

2024-09-13 Thread Tiwei Bie
high_physmem has already been declared in as-layout.h, so there is no need to declare it explicitly in the .c file again. While at it, group the declarations of __real_malloc and __real_free together to make the code slightly more readable. Signed-off-by: Tiwei Bie --- arch/um/os-Linux/main.c

  1   2   >