[PATCH] um: insert scheduler ticks when userspace does not yield

2024-09-13 Thread Benjamin Berg
From: Benjamin Berg In time-travel mode userspace can do a lot of work without any time passing. Unfortunately, this can result in OOM situations as the RCU core code will never be run. Work around this by keeping track of userspace processes that do not yield for a lot of operations. When this

Re: [PATCH v3 7/8] execmem: add support for cache of large ROX pages

2024-09-13 Thread Ard Biesheuvel
Hi Mike, On Mon, 9 Sept 2024 at 08:51, Mike Rapoport wrote: > > From: "Mike Rapoport (Microsoft)" > > Using large pages to map text areas reduces iTLB pressure and improves > performance. > > Extend execmem_alloc() with an ability to use huge pages with ROX > permissions as a cache for smaller a

[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: Tiwei Bie --- arch

[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/ker

[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 Bi

[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 |

[PATCH v2 4/5] um: Remove unused os_getpgrp function

2024-09-13 Thread Benjamin Berg
From: Benjamin Berg The function is not used anywhere. Signed-off-by: Benjamin Berg --- arch/um/include/shared/os.h | 1 - arch/um/os-Linux/process.c | 5 - 2 files changed, 6 deletions(-) diff --git a/arch/um/include/shared/os.h b/arch/um/include/shared/os.h index a94093bfa5e4..e54f64f5

[PATCH v2 5/5] um: Set HAVE_EFFICIENT_UNALIGNED_ACCESS for x86

2024-09-13 Thread Benjamin Berg
From: Benjamin Berg The x86 port of UM has efficient unaligned access. Set the option as it is appropriate and will e.g. cause UBSAN to not enable unaligned memory access checking by default. Signed-off-by: Benjamin Berg --- arch/x86/um/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git

[PATCH v2 3/5] um: Remove unused os_stop_process

2024-09-13 Thread Benjamin Berg
From: Benjamin Berg The function is not used anywhere. Signed-off-by: Benjamin Berg --- arch/um/include/shared/os.h | 1 - arch/um/os-Linux/process.c | 5 - 2 files changed, 6 deletions(-) diff --git a/arch/um/include/shared/os.h b/arch/um/include/shared/os.h index 4bdd4fb5dd80..a94093bf

[PATCH v2 2/5] um: Remove unused os_process_parent

2024-09-13 Thread Benjamin Berg
From: Benjamin Berg The function is not used anywhere. Signed-off-by: Benjamin Berg --- arch/um/include/shared/os.h | 1 - arch/um/os-Linux/process.c | 39 - 2 files changed, 40 deletions(-) diff --git a/arch/um/include/shared/os.h b/arch/um/include/share

[PATCH v2 0/5] Minor cleanups for UML

2024-09-13 Thread Benjamin Berg
From: Benjamin Berg This removes a set of unused functions and also selects HAVE_EFFICIENT_UNALIGNED_ACCESS on x86 to avoid UBSAN spewing warnings by default. v2: Add Signed-off-by to all patches Benjamin Berg (5): um: Remove unused os_process_pc um: Remove unused os_process_parent um: Re

[PATCH v2 1/5] um: Remove unused os_process_pc

2024-09-13 Thread Benjamin Berg
From: Benjamin Berg The function is not used anywhere in the codebase. Signed-off-by: Benjamin Berg --- arch/um/include/shared/os.h | 1 - arch/um/os-Linux/process.c | 33 - 2 files changed, 34 deletions(-) diff --git a/arch/um/include/shared/os.h b/arch/um/i

[PATCH v2] um: always use the internal copy of the FP registers

2024-09-13 Thread Benjamin Berg
From: Benjamin Berg When switching from userspace to the kernel, all registers including the FP registers are copied into the kernel and restored later on. As such, the true source for the FP register state is actually already in the kernel and they should never be grabbed from the userspace proc

[PATCH 5/5] um: Set HAVE_EFFICIENT_UNALIGNED_ACCESS for x86

2024-09-13 Thread Benjamin Berg
From: Benjamin Berg The x86 port of UM has efficient unaligned access. Set the option as it is appropriate and will e.g. cause UBSAN to not enable unaligned memory access checking by default. --- arch/x86/um/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/x86/um/Kconfig b/arch/x

[PATCH 4/5] um: Remove unused os_getpgrp function

2024-09-13 Thread Benjamin Berg
From: Benjamin Berg The function is not used anywhere. --- arch/um/include/shared/os.h | 1 - arch/um/os-Linux/process.c | 5 - 2 files changed, 6 deletions(-) diff --git a/arch/um/include/shared/os.h b/arch/um/include/shared/os.h index a94093bfa5e4..e54f64f55bb7 100644 --- a/arch/um/inclu

[PATCH 3/5] um: Remove unused os_stop_process

2024-09-13 Thread Benjamin Berg
From: Benjamin Berg The function is not used anywhere. --- arch/um/include/shared/os.h | 1 - arch/um/os-Linux/process.c | 5 - 2 files changed, 6 deletions(-) diff --git a/arch/um/include/shared/os.h b/arch/um/include/shared/os.h index 4bdd4fb5dd80..a94093bfa5e4 100644 --- a/arch/um/inclu

[PATCH 0/5] Minor cleanups for UML

2024-09-13 Thread Benjamin Berg
From: Benjamin Berg This removes a set of unused functions and also select HAVE_EFFICIENT_UNALIGNED_ACCESS on x86 to avoid UBSAN spewing warnings by default. Benjamin Berg (5): um: Remove unused os_process_pc um: Remove unused os_process_parent um: Remove unused os_stop_process um: Remov

[PATCH 2/5] um: Remove unused os_process_parent

2024-09-13 Thread Benjamin Berg
From: Benjamin Berg The function is not used anywhere. --- arch/um/include/shared/os.h | 1 - arch/um/os-Linux/process.c | 39 - 2 files changed, 40 deletions(-) diff --git a/arch/um/include/shared/os.h b/arch/um/include/shared/os.h index c8c1a93c8d2c..4bdd

[PATCH 1/5] um: Remove unused os_process_pc

2024-09-13 Thread Benjamin Berg
From: Benjamin Berg The function is not used anywhere in the codebase. --- arch/um/include/shared/os.h | 1 - arch/um/os-Linux/process.c | 33 - 2 files changed, 34 deletions(-) diff --git a/arch/um/include/shared/os.h b/arch/um/include/shared/os.h index 9a039d

Re: [PATCH] um: always use the internal copy of the FP registers

2024-09-13 Thread Benjamin Berg
Hi, On Fri, 2024-09-13 at 21:09 +0800, Tiwei Bie wrote: > On 2024/9/13 16:22, Benjamin Berg wrote: > > From: Benjamin Berg > > [SNIP] > > diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c > > index be2856af6d4c..ad798d40f8a4 100644 > > --- a/arch/um/kernel/process.c > > +++ b/arch/

Re: [PATCH] um: always use the internal copy of the FP registers

2024-09-13 Thread Tiwei Bie
On 2024/9/13 16:22, Benjamin Berg wrote: > From: Benjamin Berg > > When switching from userspace to the kernel, all registers including the > FP registers are copied into the kernel and restored later on. As such, > the true source for the FP register state is actually already in the > kernel and

Re: [PATCH] um: add RCU syscall hack for time-travel

2024-09-13 Thread Richard Weinberger
Hi! - Ursprüngliche Mail - > Von: "Benjamin Berg" > First, it doesn't seem like my patch actually works, so please do not > merge it. It actually appears that tree RCU and tiny RCU (which are > selected depending on the preemption setting) are behaving differently. > > So now I am wonder

Re: [PATCH] um: add RCU syscall hack for time-travel

2024-09-13 Thread Benjamin Berg
Hi First, it doesn't seem like my patch actually works, so please do not merge it. It actually appears that tree RCU and tiny RCU (which are selected depending on the preemption setting) are behaving differently. So now I am wondering if I can come up with a hack that works for both. On Fri, 202

Re: [PATCH] um: add RCU syscall hack for time-travel

2024-09-13 Thread Richard Weinberger
- Ursprüngliche Mail - > Von: "Benjamin Berg" >> While I acknowledge that time-travel itself is a beautiful hack, I'd >> like to keep the hacks >> to keep it working minimal. >> So, the problem here is that RCU callbacks never run and just pile up? > > Yes. A simple example of this is doi

Re: [PATCH] um: add RCU syscall hack for time-travel

2024-09-13 Thread Benjamin Berg
Hi, On Thu, 2024-09-12 at 21:02 +0200, Richard Weinberger wrote: > On Fri, Aug 30, 2024 at 5:38 PM Benjamin Berg > wrote: > > > > From: Benjamin Berg > > > > In time-travel mode userspace can do a lot of work without any time > > passing. Unfortunately, this can result in OOM situations as the

Re: [PATCH] um: always use the internal copy of the FP registers

2024-09-13 Thread Benjamin Berg
On Fri, 2024-09-13 at 10:22 +0200, Benjamin Berg wrote: > From: Benjamin Berg > > When switching from userspace to the kernel, all registers including the > FP registers are copied into the kernel and restored later on. As such, > the true source for the FP register state is actually already in t

[PATCH] um: always use the internal copy of the FP registers

2024-09-13 Thread Benjamin Berg
From: Benjamin Berg When switching from userspace to the kernel, all registers including the FP registers are copied into the kernel and restored later on. As such, the true source for the FP register state is actually already in the kernel and they should never be grabbed from the userspace proc