Re: [RFC PATCH v3 13/15] context_tracking,x86: Add infrastructure to defer kernel TLBI

2024-12-09 Thread Petr Tesarik
On Mon, 09 Dec 2024 13:04:43 +0100 Valentin Schneider wrote: > On 05/12/24 18:31, Petr Tesarik wrote: > > On Thu, 21 Nov 2024 16:30:16 +0100 > > Peter Zijlstra wrote: > > > >> On Thu, Nov 21, 2024 at 07:07:44AM -0800, Dave Hansen wrote: > >> > On 11/21/24 03:12, Peter Zijlstra wrote: > >>

Re: [RFC PATCH v3 13/15] context_tracking,x86: Add infrastructure to defer kernel TLBI

2024-12-09 Thread Valentin Schneider
On 05/12/24 18:31, Petr Tesarik wrote: > On Thu, 21 Nov 2024 16:30:16 +0100 > Peter Zijlstra wrote: > >> On Thu, Nov 21, 2024 at 07:07:44AM -0800, Dave Hansen wrote: >> > On 11/21/24 03:12, Peter Zijlstra wrote: >> > >> I see e.g. ds_clear_cea() clears PTEs that can have the _PAGE_GLOBAL >> > >>

Re: [RFC PATCH v3 13/15] context_tracking,x86: Add infrastructure to defer kernel TLBI

2024-12-09 Thread Peter Zijlstra
On Mon, Dec 09, 2024 at 01:04:43PM +0100, Valentin Schneider wrote: > > But I wonder what exactly was the original scenario encountered by > > Valentin. I mean, if TLB entry invalidations were necessary to sync > > changes to kernel text after flipping a static branch, then it might be > > less ov

Media committers model postponed to 6.14 - Was: Re: [PATCH v3 0/3] Document the new media-committer's model

2024-12-09 Thread Mauro Carvalho Chehab
Em Tue, 3 Dec 2024 14:07:12 +0100 Mauro Carvalho Chehab escreveu: > > The idea is to gradually open media-committers to more people, as each > phase succeeds, addressing infra, procedures, etc. > > My rough idea is to do: > > - Phase 0.99: beta testers; > - Phase 1 is to invite people that reg

Re: [PATCH v2] arm64: Allow CONFIG_AUTOFDO_CLANG to be selected

2024-12-09 Thread Will Deacon
(Aside: please try to avoid top-posting on the public lists as it messes up the flow of conversation; I'll try to piece this back together.) On Mon, Dec 09, 2024 at 09:30:50AM -0800, Rong Xu wrote: > On Mon, Dec 9, 2024 at 8:20 AM Will Deacon wrote: > > On Mon, Nov 18, 2024 at 02:25:40PM -0800, Y

[PATCH v6 20/28] selftests: ntsync: Add some tests for manual-reset event state.

2024-12-09 Thread Elizabeth Figura
Test event-specific ioctls NTSYNC_IOC_EVENT_SET, NTSYNC_IOC_EVENT_RESET, NTSYNC_IOC_EVENT_PULSE, NTSYNC_IOC_EVENT_READ for manual-reset events, and waiting on manual-reset events. Signed-off-by: Elizabeth Figura --- .../testing/selftests/drivers/ntsync/ntsync.c | 89 +++ 1 file c

[PATCH v6 22/28] selftests: ntsync: Add some tests for wakeup signaling with events.

2024-12-09 Thread Elizabeth Figura
Expand the contended wait tests, which previously only covered events and semaphores, to cover events as well. Signed-off-by: Elizabeth Figura --- .../testing/selftests/drivers/ntsync/ntsync.c | 151 +- 1 file changed, 147 insertions(+), 4 deletions(-) diff --git a/tools/testing

[PATCH v6 17/28] selftests: ntsync: Add some tests for NTSYNC_IOC_WAIT_ALL.

2024-12-09 Thread Elizabeth Figura
Test basic synchronous functionality of NTSYNC_IOC_WAIT_ALL, and when objects are considered simultaneously signaled. Signed-off-by: Elizabeth Figura --- .../testing/selftests/drivers/ntsync/ntsync.c | 99 ++- 1 file changed, 97 insertions(+), 2 deletions(-) diff --git a/tools/t

[PATCH v6 18/28] selftests: ntsync: Add some tests for wakeup signaling with WINESYNC_IOC_WAIT_ANY.

2024-12-09 Thread Elizabeth Figura
Test contended "wait-for-any" waits, to make sure that scheduling and wakeup logic works correctly. Signed-off-by: Elizabeth Figura --- .../testing/selftests/drivers/ntsync/ntsync.c | 150 ++ 1 file changed, 150 insertions(+) diff --git a/tools/testing/selftests/drivers/ntsync/n

[PATCH v6 21/28] selftests: ntsync: Add some tests for auto-reset event state.

2024-12-09 Thread Elizabeth Figura
Test event-specific ioctls NTSYNC_IOC_EVENT_SET, NTSYNC_IOC_EVENT_RESET, NTSYNC_IOC_EVENT_PULSE, NTSYNC_IOC_EVENT_READ for auto-reset events, and waiting on auto-reset events. Signed-off-by: Elizabeth Figura --- .../testing/selftests/drivers/ntsync/ntsync.c | 59 +++ 1 file chang

[PATCH v6 19/28] selftests: ntsync: Add some tests for wakeup signaling with WINESYNC_IOC_WAIT_ALL.

2024-12-09 Thread Elizabeth Figura
Test contended "wait-for-all" waits, to make sure that scheduling and wakeup logic works correctly, and that the wait only exits once objects are all simultaneously signaled. Signed-off-by: Elizabeth Figura --- .../testing/selftests/drivers/ntsync/ntsync.c | 98 +++ 1 file change

[PATCH v6 24/28] selftests: ntsync: Add some tests for wakeup signaling via alerts.

2024-12-09 Thread Elizabeth Figura
Expand the alert tests to cover alerting a thread mid-wait, to test that the relevant scheduling logic works correctly. Signed-off-by: Elizabeth Figura --- .../testing/selftests/drivers/ntsync/ntsync.c | 62 +++ 1 file changed, 62 insertions(+) diff --git a/tools/testing/selftes

[PATCH v6 27/28] docs: ntsync: Add documentation for the ntsync uAPI.

2024-12-09 Thread Elizabeth Figura
Add an overall explanation of the driver architecture, and complete and precise specification for its intended behaviour. Signed-off-by: Elizabeth Figura --- Documentation/userspace-api/index.rst | 1 + Documentation/userspace-api/ntsync.rst | 398 + 2 files changed, 3

[PATCH v6 14/28] selftests: ntsync: Add some tests for semaphore state.

2024-12-09 Thread Elizabeth Figura
Wine has tests for its synchronization primitives, but these are more accessible to kernel developers, and also allow us to test some edge cases that Wine does not care about. This patch adds tests for semaphore-specific ioctls NTSYNC_IOC_SEM_POST and NTSYNC_IOC_SEM_READ, and waiting on semaphores

[PATCH v6 13/28] ntsync: Introduce alertable waits.

2024-12-09 Thread Elizabeth Figura
NT waits can optionally be made "alertable". This is a special channel for thread wakeup that is mildly similar to SIGIO. A thread has an internal single bit of "alerted" state, and if a thread is alerted while an alertable wait, the wait will return a special value, consume the "alerted" state, an

[PATCH v6 28/28] ntsync: No longer depend on BROKEN.

2024-12-09 Thread Elizabeth Figura
f5b335dc025cfee90957efa90dc72fada0d5abb4 ("misc: ntsync: mark driver as "broken" to prevent from building") was committed to avoid the driver being used while only part of its functionality was released. Since the rest of the functionality has now been committed, revert this. Signed-off-by: Elizab

[PATCH v6 16/28] selftests: ntsync: Add some tests for NTSYNC_IOC_WAIT_ANY.

2024-12-09 Thread Elizabeth Figura
Test basic synchronous functionality of NTSYNC_IOC_WAIT_ANY, when objects are considered signaled or not signaled, and how they are affected by a successful wait. Signed-off-by: Elizabeth Figura --- .../testing/selftests/drivers/ntsync/ntsync.c | 119 ++ 1 file changed, 119 inser

Re: [PATCH v2] arm64: Allow CONFIG_AUTOFDO_CLANG to be selected

2024-12-09 Thread Will Deacon
On Mon, Nov 18, 2024 at 02:25:40PM -0800, Yabin Cui wrote: > Select ARCH_SUPPORTS_AUTOFDO_CLANG to allow AUTOFDO_CLANG to be > selected. > > On ARM64, ETM traces can be recorded and converted to AutoFDO profiles. > Experiments on Android show 4% improvement in cold app startup time > and 13% impro

[PATCH v6 09/28] ntsync: Introduce NTSYNC_IOC_EVENT_PULSE.

2024-12-09 Thread Elizabeth Figura
This corresponds to the NT syscall NtPulseEvent(). This wakes up any waiters as if the event had been set, but does not set the event, instead resetting it if it had been signalled. Thus, for a manual-reset event, all waiters are woken, whereas for an auto-reset event, at most one waiter is woken.

[PATCH v6 11/28] ntsync: Introduce NTSYNC_IOC_MUTEX_READ.

2024-12-09 Thread Elizabeth Figura
This corresponds to the NT syscall NtQueryMutant(). This returns the recursion count, owner, and abandoned state of the mutex. Signed-off-by: Elizabeth Figura --- drivers/misc/ntsync.c | 28 include/uapi/linux/ntsync.h | 1 + 2 files changed, 29 insertions(+)

[PATCH v6 15/28] selftests: ntsync: Add some tests for mutex state.

2024-12-09 Thread Elizabeth Figura
Test mutex-specific ioctls NTSYNC_IOC_MUTEX_UNLOCK and NTSYNC_IOC_MUTEX_READ, and waiting on mutexes. Signed-off-by: Elizabeth Figura --- .../testing/selftests/drivers/ntsync/ntsync.c | 196 ++ 1 file changed, 196 insertions(+) diff --git a/tools/testing/selftests/drivers/ntsync

[PATCH v6 12/28] ntsync: Introduce NTSYNC_IOC_EVENT_READ.

2024-12-09 Thread Elizabeth Figura
This corresponds to the NT syscall NtQueryEvent(). This returns the signaled state of the event and whether it is manual-reset. Signed-off-by: Elizabeth Figura --- drivers/misc/ntsync.c | 26 ++ include/uapi/linux/ntsync.h | 1 + 2 files changed, 27 insertions(+)

[PATCH v6 26/28] maintainers: Add an entry for ntsync.

2024-12-09 Thread Elizabeth Figura
Add myself as maintainer, supported by CodeWeavers. Signed-off-by: Elizabeth Figura --- MAINTAINERS | 9 + 1 file changed, 9 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 1e930c7a58b1..8c3dd9077fc2 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -16708,6 +16708,15 @@ T: g

[PATCH v6 23/28] selftests: ntsync: Add tests for alertable waits.

2024-12-09 Thread Elizabeth Figura
Test the "alert" functionality of NTSYNC_IOC_WAIT_ALL and NTSYNC_IOC_WAIT_ANY, when a wait is woken with an alert and when it is woken by an object. Signed-off-by: Elizabeth Figura --- .../testing/selftests/drivers/ntsync/ntsync.c | 179 +- 1 file changed, 176 insertions(+), 3 de

[PATCH v6 25/28] selftests: ntsync: Add a stress test for contended waits.

2024-12-09 Thread Elizabeth Figura
Test a more realistic usage pattern, and one with heavy contention, in order to actually exercise ntsync's internal synchronization. This test has several threads in a tight loop acquiring a mutex, modifying some shared data, and then releasing the mutex. At the end we check if the data is consist

[PATCH v6 10/28] ntsync: Introduce NTSYNC_IOC_SEM_READ.

2024-12-09 Thread Elizabeth Figura
This corresponds to the NT syscall NtQuerySemaphore(). This returns the current count and maximum count of the semaphore. Signed-off-by: Elizabeth Figura --- drivers/misc/ntsync.c | 26 ++ include/uapi/linux/ntsync.h | 1 + 2 files changed, 27 insertions(+) diff

[PATCH v6 03/28] ntsync: Introduce NTSYNC_IOC_CREATE_MUTEX.

2024-12-09 Thread Elizabeth Figura
This corresponds to the NT syscall NtCreateMutant(). An NT mutex is recursive, with a 32-bit recursion counter. When acquired via NtWaitForMultipleObjects(), the recursion counter is incremented by one. The OS records the thread which acquired it. The OS records the thread which acquired it. Howe

[PATCH v6 04/28] ntsync: Introduce NTSYNC_IOC_MUTEX_UNLOCK.

2024-12-09 Thread Elizabeth Figura
This corresponds to the NT syscall NtReleaseMutant(). This syscall decrements the mutex's recursion count by one, and returns the previous value. If the mutex is not owned by the current task, the function instead fails and returns -EPERM. Signed-off-by: Elizabeth Figura --- drivers/misc/ntsync

[PATCH v6 08/28] ntsync: Introduce NTSYNC_IOC_EVENT_RESET.

2024-12-09 Thread Elizabeth Figura
This corresponds to the NT syscall NtResetEvent(). This sets the event to the unsignaled state, and returns its previous state. Signed-off-by: Elizabeth Figura --- drivers/misc/ntsync.c | 24 include/uapi/linux/ntsync.h | 1 + 2 files changed, 25 insertions(+) d

[PATCH v6 02/28] ntsync: Introduce NTSYNC_IOC_WAIT_ALL.

2024-12-09 Thread Elizabeth Figura
This is similar to NTSYNC_IOC_WAIT_ANY, but waits until all of the objects are simultaneously signaled, and then acquires all of them as a single atomic operation. Because acquisition of multiple objects is atomic, some complex locking is required. We cannot simply spin-lock multiple objects simul

[PATCH v6 00/28] NT synchronization primitive driver

2024-12-09 Thread Elizabeth Figura
This patch series implements a new char misc driver, /dev/ntsync, which is used to implement Windows NT synchronization primitives. NT synchronization primitives are unique in that the wait functions both are vectored, operate on multiple types of object with different behaviour (mutex, semaphor

[PATCH v6 06/28] ntsync: Introduce NTSYNC_IOC_CREATE_EVENT.

2024-12-09 Thread Elizabeth Figura
This correspond to the NT syscall NtCreateEvent(). An NT event holds a single bit of state denoting whether it is signaled or unsignaled. There are two types of events: manual-reset and automatic-reset. When an automatic-reset event is acquired via a wait function, its state is reset to unsignale

[PATCH v6 07/28] ntsync: Introduce NTSYNC_IOC_EVENT_SET.

2024-12-09 Thread Elizabeth Figura
This corresponds to the NT syscall NtSetEvent(). This sets the event to the signaled state, and returns its previous state. Signed-off-by: Elizabeth Figura --- drivers/misc/ntsync.c | 27 +++ include/uapi/linux/ntsync.h | 1 + 2 files changed, 28 insertions(+) di

[PATCH v6 05/28] ntsync: Introduce NTSYNC_IOC_MUTEX_KILL.

2024-12-09 Thread Elizabeth Figura
This does not correspond to any NT syscall. Rather, when a thread dies, it should be called by the NT emulator for each mutex, with the TID of the dying thread. NT mutexes are robust (in the pthread sense). When an NT thread dies, any mutexes it owned are immediately released. Acquisition of those

[PATCH v6 01/28] ntsync: Introduce NTSYNC_IOC_WAIT_ANY.

2024-12-09 Thread Elizabeth Figura
This corresponds to part of the functionality of the NT syscall NtWaitForMultipleObjects(). Specifically, it implements the behaviour where the third argument (wait_any) is TRUE, and it does not handle alertable waits. Those features have been split out into separate patches to ease review. This p

Re: [PATCH v6 00/28] NT synchronization primitive driver

2024-12-09 Thread Arnd Bergmann
On Mon, Dec 9, 2024, at 19:58, Elizabeth Figura wrote: > == Previous versions == > > No changes were made from v5 other than rebasing on top of the 6.13-rc1 > char-misc-next tree. > > I would like to repeat a question from the last round of review, though. Two > changes were suggested related to AP

Re: [PATCH v2] arm64: Allow CONFIG_AUTOFDO_CLANG to be selected

2024-12-09 Thread Rong Xu
Enabling an AutoFDO build requires users to explicitly set CONFIG_AUTOFDO_CLANG. The support code is in Commit 315ad8780a129e82 (kbuild: Add AutoFDO support for Clang build). The CONFIG_AUTOFDO_CLANG config, even if selected by the user, will not be enabled unless ARCH_SUPPORTS_AUTOFDO_CLANG is pr

Re: [RFC PATCH v3 13/15] context_tracking,x86: Add infrastructure to defer kernel TLBI

2024-12-09 Thread Petr Tesarik
On Mon, 9 Dec 2024 13:12:49 +0100 Peter Zijlstra wrote: > On Mon, Dec 09, 2024 at 01:04:43PM +0100, Valentin Schneider wrote: > > > > But I wonder what exactly was the original scenario encountered by > > > Valentin. I mean, if TLB entry invalidations were necessary to sync > > > changes to kern

Re: [PATCH v6 00/28] NT synchronization primitive driver

2024-12-09 Thread Elizabeth Figura
On Monday, 9 December 2024 14:24:36 CST Arnd Bergmann wrote: > On Mon, Dec 9, 2024, at 19:58, Elizabeth Figura wrote: > > == Previous versions == > > > > No changes were made from v5 other than rebasing on top of the 6.13-rc1 > > char-misc-next tree. > > > > I would like to repeat a question from t

Re: [PATCH v2] arm64: Allow CONFIG_AUTOFDO_CLANG to be selected

2024-12-09 Thread Yabin Cui
On Mon, Dec 9, 2024 at 10:56 AM Will Deacon wrote: > > (Aside: please try to avoid top-posting on the public lists as it messes up > the flow of conversation; I'll try to piece this back together.) > > On Mon, Dec 09, 2024 at 09:30:50AM -0800, Rong Xu wrote: > > On Mon, Dec 9, 2024 at 8:20 AM Wil