Re: [PATCH] kunit: make kunit_bus_type const

2024-02-14 Thread Greg Kroah-Hartman
On Wed, Feb 14, 2024 at 04:15:00PM -0300, Ricardo B. Marliere wrote: > Since commit d492cc2573a0 ("driver core: device.h: make struct > bus_type a const *"), the driver core can properly handle constant > struct bus_type, move the kunit_bus_type variable to be a constant > structure as well,

Re: [PATCH 02/31] ntsync: Introduce NTSYNC_IOC_CREATE_SEM.

2024-02-14 Thread Greg Kroah-Hartman
On Wed, Feb 14, 2024 at 05:36:38PM -0600, Elizabeth Figura wrote: > This corresponds to the NT syscall NtCreateSemaphore(). > > Semaphores are one of three types of object to be implemented in this driver, > the others being mutexes and events. > > An NT semaphore contains a 32-bit counter, and

Re: [PATCH 00/31] NT synchronization primitive driver

2024-02-14 Thread Greg Kroah-Hartman
On Wed, Feb 14, 2024 at 06:01:22PM -0600, Elizabeth Figura wrote: > On Wednesday, 14 February 2024 17:36:36 CST Elizabeth Figura wrote: > > This patch series introduces a new char misc driver, /dev/ntsync, which is > > used > > to implement Windows NT synchronization primitives. > > Ugh, sorry,

Re: [PATCH v2 09/12] selftests/mm: thp_settings: conform to TAP format output

2024-02-14 Thread Muhammad Usama Anjum
On 2/14/24 10:19 PM, Ryan Roberts wrote: > On 02/02/2024 11:31, Muhammad Usama Anjum wrote: >> Conform the layout, informational and status messages to TAP. No >> functional change is intended other than the layout of output messages. >> >> Signed-off-by: Muhammad Usama Anjum >> --- >>

Re: [PATCH RFT v5 3/7] mm: Introduce ARCH_HAS_USER_SHADOW_STACK

2024-02-14 Thread Deepak Gupta
On Fri, Feb 2, 2024 at 4:05 PM Mark Brown wrote: > > Since multiple architectures have support for shadow stacks and we need to > select support for this feature in several places in the generic code > provide a generic config option that the architectures can select. > > Suggested-by: David

Re: [PATCH RFT v5 1/7] Documentation: userspace-api: Add shadow stack API documentation

2024-02-14 Thread Deepak Gupta
On Fri, Feb 2, 2024 at 4:05 PM Mark Brown wrote: > > There are a number of architectures with shadow stack features which we are > presenting to userspace with as consistent an API as we can (though there > are some architecture specifics). Especially given that there are some > important

Re: [PATCH net] selftests: tls: increase the wait in poll_partial_rec_async

2024-02-14 Thread patchwork-bot+netdevbpf
Hello: This patch was applied to netdev/net.git (main) by Jakub Kicinski : On Tue, 13 Feb 2024 06:20:55 -0800 you wrote: > Test runners on debug kernels occasionally fail with: > > # # RUN tls_err.13_aes_gcm.poll_partial_rec_async ... > # #

Re: [PATCH 01/31] ntsync: Introduce the ntsync driver and character device.

2024-02-14 Thread Randy Dunlap
Hi, On 2/14/24 15:36, Elizabeth Figura wrote: > ntsync uses a misc device as the simplest and least intrusive uAPI interface. > > Each file description on the device represents an isolated NT instance, > intended > to correspond to a single NT virtual machine. > > Signed-off-by: Elizabeth

Re: [PATCH] selftests/mqueue: Set timeout to 100 seconds

2024-02-14 Thread SeongJae Park
A gentle reminder. Thanks, SJ On Fri, 9 Feb 2024 09:42:43 -0800 SeongJae Park wrote: > On Fri, 9 Feb 2024 10:30:38 + "Mohamed Abuelfotoh, Hazem" > wrote: > > > On 08/02/2024 21:29, SeongJae Park wrote: > > > CAUTION: This email originated from outside of the organization. Do not > > >

Re: [PATCH net-next 3/4] selftests: kselftest_harness: support using xfail

2024-02-14 Thread Kees Cook
On Wed, Feb 14, 2024 at 04:25:14PM -0800, Jakub Kicinski wrote: > On Wed, 14 Feb 2024 22:46:46 +0100 Jakub Sitnicki wrote: > > > On second thought, if I can suggest a follow up change so this: > > > > > > ok 17 # XFAIL SCTP doesn't support IP_BIND_ADDRESS_NO_PORT > > > > > > ... becomes this > > >

Re: [PATCH net-next 3/4] selftests: kselftest_harness: support using xfail

2024-02-14 Thread Jakub Kicinski
On Wed, 14 Feb 2024 22:46:46 +0100 Jakub Sitnicki wrote: > > On second thought, if I can suggest a follow up change so this: > > > > ok 17 # XFAIL SCTP doesn't support IP_BIND_ADDRESS_NO_PORT > > > > ... becomes this > > > > ok 17 ip_local_port_range.ip4_stcp.late_bind # XFAIL SCTP doesn't support

Re: [GIT PULL] KUnit fixes update for Linux 6.8-rc5

2024-02-14 Thread pr-tracker-bot
The pull request you sent on Tue, 13 Feb 2024 17:06:58 -0700: > git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest > tags/linux_kselftest-kunit-fixes-6.8-rc5 has been merged into torvalds/linux.git: https://git.kernel.org/torvalds/c/91f842ffe6ca1e97a3966e9e499c3ac6fbcc4bc4

Re: [PATCH 00/31] NT synchronization primitive driver

2024-02-14 Thread Elizabeth Figura
On Wednesday, 14 February 2024 17:36:36 CST Elizabeth Figura wrote: > This patch series introduces a new char misc driver, /dev/ntsync, which is > used > to implement Windows NT synchronization primitives. Ugh, sorry, I made a bit of a mess while sending this revision. I accidentally sent 000*

[PATCH 31/31] docs: ntsync: Add documentation for the ntsync uAPI.

2024-02-14 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 | 399 + 2 files changed,

[PATCH 29/31] selftests: ntsync: Add a stress test for contended waits.

2024-02-14 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

[PATCH 30/31] maintainers: Add an entry for ntsync.

2024-02-14 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 960512bec428..e80ed255951b 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -15591,6 +15591,15 @@ T:

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

2024-02-14 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

[PATCH 27/31] selftests: ntsync: Add tests for alertable waits.

2024-02-14 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

[PATCH 26/31] selftests: ntsync: Add some tests for wakeup signaling with events.

2024-02-14 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

[PATCH 25/31] selftests: ntsync: Add some tests for auto-reset event state.

2024-02-14 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

[PATCH 24/31] selftests: ntsync: Add some tests for manual-reset event state.

2024-02-14 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

[PATCH 23/31] selftests: ntsync: Add some tests for wakeup signaling with WINESYNC_IOC_WAIT_ALL.

2024-02-14 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

[PATCH 22/31] selftests: ntsync: Add some tests for wakeup signaling with WINESYNC_IOC_WAIT_ANY.

2024-02-14 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

[PATCH 21/31] selftests: ntsync: Add some tests for NTSYNC_IOC_WAIT_ALL.

2024-02-14 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

[PATCH 20/31] selftests: ntsync: Add some tests for NTSYNC_IOC_WAIT_ANY.

2024-02-14 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

[PATCH 19/31] selftests: ntsync: Add some tests for mutex state.

2024-02-14 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

[PATCH 18/31] selftests: ntsync: Add some tests for semaphore state.

2024-02-14 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

[PATCH 17/31] ntsync: Allow waits to use the REALTIME clock.

2024-02-14 Thread Elizabeth Figura
NtWaitForMultipleObjects() can receive a timeout in two forms, relative or absolute. Relative timeouts are unaffected by changes to the system time and do not count down while the system suspends; for absolute timeouts the opposite is true. In order to make the interface and implementation

[PATCH 00/31] NT synchronization primitive driver

2024-02-14 Thread Elizabeth Figura
This patch series introduces a new char misc driver, /dev/ntsync, which is used to implement Windows NT synchronization primitives. This was previously submitted as an RFC [1]. Since there were no major changes requested to the last RFC revision, I've stripped the RFC prefix. [1]

[PATCH 16/31] ntsync: Introduce alertable waits.

2024-02-14 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 made alerted while an alertable wait, the wait will return a special value, consume the "alerted"

[PATCH 15/31] ntsync: Introduce NTSYNC_IOC_EVENT_READ.

2024-02-14 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 | 21 + include/uapi/linux/ntsync.h | 1 + 2 files changed, 22 insertions(+)

[PATCH 01/31] ntsync: Introduce the ntsync driver and character device.

2024-02-14 Thread Elizabeth Figura
ntsync uses a misc device as the simplest and least intrusive uAPI interface. Each file description on the device represents an isolated NT instance, intended to correspond to a single NT virtual machine. Signed-off-by: Elizabeth Figura --- drivers/misc/Kconfig | 9

[PATCH 14/31] ntsync: Introduce NTSYNC_IOC_MUTEX_READ.

2024-02-14 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 | 23 +++ include/uapi/linux/ntsync.h | 1 + 2 files changed, 24 insertions(+)

[PATCH 13/31] ntsync: Introduce NTSYNC_IOC_SEM_READ.

2024-02-14 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 | 21 + include/uapi/linux/ntsync.h | 1 + 2 files changed, 22 insertions(+) diff

[PATCH 12/31] ntsync: Introduce NTSYNC_IOC_EVENT_PULSE.

2024-02-14 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

[PATCH 08/31] ntsync: Introduce NTSYNC_IOC_MUTEX_KILL.

2024-02-14 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. NT mutexes are robust (in the pthread sense). When an NT thread dies, any mutexes it owned are immediately released. Acquisition of those mutexes by other threads will

[PATCH 10/31] ntsync: Introduce NTSYNC_IOC_EVENT_SET.

2024-02-14 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 | 37 + include/uapi/linux/ntsync.h | 1 + 2 files changed, 38

[PATCH 11/31] ntsync: Introduce NTSYNC_IOC_EVENT_RESET.

2024-02-14 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 | 22 ++ include/uapi/linux/ntsync.h | 1 + 2 files changed, 23 insertions(+)

[PATCH 04/31] ntsync: Introduce NTSYNC_IOC_WAIT_ANY.

2024-02-14 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.

[PATCH 05/31] ntsync: Introduce NTSYNC_IOC_WAIT_ALL.

2024-02-14 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. Signed-off-by: Elizabeth Figura --- drivers/misc/ntsync.c | 242 ++--

[PATCH 02/31] ntsync: Introduce NTSYNC_IOC_CREATE_SEM.

2024-02-14 Thread Elizabeth Figura
This corresponds to the NT syscall NtCreateSemaphore(). Semaphores are one of three types of object to be implemented in this driver, the others being mutexes and events. An NT semaphore contains a 32-bit counter, and is signaled and can be acquired when the counter is nonzero. The counter has a

[PATCH 03/31] ntsync: Introduce NTSYNC_IOC_SEM_POST.

2024-02-14 Thread Elizabeth Figura
This corresponds to the NT syscall NtReleaseSemaphore(). This increases the semaphore's internal counter by the given value, and returns the previous value. If the counter would overflow the defined maximum, the function instead fails and returns -EOVERFLOW. Signed-off-by: Elizabeth Figura ---

[PATCH 06/31] ntsync: Introduce NTSYNC_IOC_CREATE_MUTEX.

2024-02-14 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. However, in order to keep this driver

[PATCH 07/31] ntsync: Introduce NTSYNC_IOC_MUTEX_UNLOCK.

2024-02-14 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 given owner ID, the function instead fails and returns -EPERM. Signed-off-by: Elizabeth Figura ---

[PATCH 09/31] ntsync: Introduce NTSYNC_IOC_CREATE_EVENT.

2024-02-14 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

Re: [PATCH net-next 3/4] selftests: kselftest_harness: support using xfail

2024-02-14 Thread Jakub Sitnicki
On Wed, Feb 14, 2024 at 08:40 PM +01, Jakub Sitnicki wrote: [...] > On second thought, if I can suggest a follow up change so this: > > ok 17 # XFAIL SCTP doesn't support IP_BIND_ADDRESS_NO_PORT > > ... becomes this > > ok 17 ip_local_port_range.ip4_stcp.late_bind # XFAIL SCTP doesn't support >

Re: [PATCH v9 12/25] security: Introduce file_post_open hook

2024-02-14 Thread Paul Moore
On Wed, Feb 14, 2024 at 3:07 PM Mimi Zohar wrote: > On Tue, 2024-02-13 at 10:33 -0500, Paul Moore wrote: > > On Tue, Feb 13, 2024 at 7:59 AM Roberto Sassu > > wrote: > > > On Mon, 2024-02-12 at 16:16 -0500, Paul Moore wrote: > > > > On Mon, Feb 12, 2024 at 4:06 PM Mimi Zohar wrote: > > > > > Hi

Re: [PATCH] selftests: fuxex: Report a unique test name per run of futex_requeue_pi

2024-02-14 Thread Davidlohr Bueso
On Tue, 13 Feb 2024, Mark Brown wrote: The futex_requeue_pi test program is run a number of times with different options to provide multiple test cases. Currently every time it runs it reports the result with a consistent string, meaning that automated systems parsing the TAP output from a test

Re: [PATCH v9 12/25] security: Introduce file_post_open hook

2024-02-14 Thread Mimi Zohar
On Tue, 2024-02-13 at 10:33 -0500, Paul Moore wrote: > On Tue, Feb 13, 2024 at 7:59 AM Roberto Sassu > wrote: > > On Mon, 2024-02-12 at 16:16 -0500, Paul Moore wrote: > > > On Mon, Feb 12, 2024 at 4:06 PM Mimi Zohar wrote: > > > > Hi Roberto, > > > > > > > > > > > > > diff --git

Re: [PATCH net-next 3/4] selftests: kselftest_harness: support using xfail

2024-02-14 Thread Jakub Sitnicki
On Tue, Feb 13, 2024 at 07:44 AM -08, Jakub Kicinski wrote: > Selftest summary includes XFAIL but there's no way to use > it from within the harness. Support it in a similar way to skip. > > Currently tests report skip for things they expect to fail > e.g. when given combination of parameters is

[PATCH] kunit: make kunit_bus_type const

2024-02-14 Thread Ricardo B. Marliere
; --- base-commit: 76021a887a50892fd969cd42a5f3467f5696e50e change-id: 20240214-bus_cleanup-kunit-840cd37b0e10 Best regards, -- Ricardo B. Marliere

Re: [PATCH v2 09/12] selftests/mm: thp_settings: conform to TAP format output

2024-02-14 Thread Ryan Roberts
On 14/02/2024 17:19, Ryan Roberts wrote: > On 02/02/2024 11:31, Muhammad Usama Anjum wrote: >> Conform the layout, informational and status messages to TAP. No >> functional change is intended other than the layout of output messages. >> >> Signed-off-by: Muhammad Usama Anjum >> --- >>

[RESEND PATCH v5 4/4] selftest/bpf: Test a perf bpf program that suppresses side effects.

2024-02-14 Thread Kyle Huey
The test sets a hardware breakpoint and uses a bpf program to suppress the side effects of a perf event sample, including I/O availability signals, SIGTRAPs, and decrementing the event counter limit, if the ip matches the expected value. Then the function with the breakpoint is executed multiple

Re: [PATCH v4 0/7] Split a folio to any lower order folios

2024-02-14 Thread Pankaj Raghav (Samsung)
On Wed, Feb 14, 2024 at 12:18:14PM -0500, Zi Yan wrote: > Hi Pankaj, > > On 13 Feb 2024, at 16:55, Zi Yan wrote: > > > From: Zi Yan > > > > Hi all, > > > > File folio supports any order and multi-size THP is upstreamed[1], so both > > file and anonymous folios can be >0 order. Currently,

[PATCH RFC bpf-next v2 10/10] selftests/hid: add test for bpf_timer

2024-02-14 Thread Benjamin Tissoires
This test checks that we can actually delay a workload in a sleepable context through bpf_timer. When an event is injected, we push it on a map of type queue and schedule a work. When that work kicks in, it pulls the event from the queue, and wakes up userspace through a ring buffer. The use of

[PATCH RFC bpf-next v2 09/10] HID: bpf: allow to use bpf_timer_set_sleepable_cb() in tracing callbacks.

2024-02-14 Thread Benjamin Tissoires
Export the sleepable kfuncs we have on HID-BPF in tracing bpf programs, but with the condition of being used in a sleepable context. This allows to use the bpf_timer when used in a sleepable context through bpf_timer_set_sleepable_cb() and initiate work from a device event. Signed-off-by:

[PATCH RFC bpf-next v2 08/10] selftests/hid: add tests for hid_bpf_input_report

2024-02-14 Thread Benjamin Tissoires
Usual way of testing, we call the function and ensures we receive the event Signed-off-by: Benjamin Tissoires --- no changes in v2 --- tools/testing/selftests/hid/hid_bpf.c | 49 +- tools/testing/selftests/hid/progs/hid.c| 22 ++

Re: [PATCH v2 09/12] selftests/mm: thp_settings: conform to TAP format output

2024-02-14 Thread Ryan Roberts
On 02/02/2024 11:31, Muhammad Usama Anjum wrote: > Conform the layout, informational and status messages to TAP. No > functional change is intended other than the layout of output messages. > > Signed-off-by: Muhammad Usama Anjum > --- > tools/testing/selftests/mm/khugepaged.c | 3 +- >

[PATCH RFC bpf-next v2 07/10] HID: bpf: allow to inject HID event from BPF

2024-02-14 Thread Benjamin Tissoires
It can be interesting to inject events from BPF as if the event were to come from the device. For example, some multitouch devices do not all the time send a proximity out event, and we might want to send it for the physical device. Compared to uhid, we can now inject events on any physical

[PATCH RFC bpf-next v2 06/10] selftests/hid: Add test for hid_bpf_hw_output_report

2024-02-14 Thread Benjamin Tissoires
This time we need to ensure uhid receives it, thus the new mutex and condition. Signed-off-by: Benjamin Tissoires --- no changes in v2 --- tools/testing/selftests/hid/hid_bpf.c | 63 ++ tools/testing/selftests/hid/progs/hid.c| 24 +

[PATCH RFC bpf-next v2 05/10] HID: bpf: export hid_hw_output_report as a BPF kfunc

2024-02-14 Thread Benjamin Tissoires
We currently only export hid_hw_raw_request() as a BPF kfunc. However, some devices require an explicit write on the Output Report instead of the use of the control channel. So also export hid_hw_output_report to BPF Signed-off-by: Benjamin Tissoires --- no changes in v2 ---

[PATCH RFC bpf-next v2 04/10] HID: bpf/dispatch: regroup kfuncs definitions

2024-02-14 Thread Benjamin Tissoires
No code change, just move down the hid_bpf_get_data() kfunc definition so we have only one block of __bpf_kfunc_start/end_defs() Signed-off-by: Benjamin Tissoires --- no changes in v2 --- drivers/hid/bpf/hid_bpf_dispatch.c | 80 ++ 1 file changed, 38

[PATCH RFC bpf-next v2 03/10] bpf/verifier: allow more maps in sleepable bpf programs

2024-02-14 Thread Benjamin Tissoires
These 2 maps types are required for HID-BPF when a user wants to do IO with a device from a sleepable tracing point. Allowing BPF_MAP_TYPE_QUEUE (and therefore BPF_MAP_TYPE_STACK) allows for a BPF program to prepare from an IRQ the list of HID commands to send back to the device and then these

[PATCH RFC bpf-next v2 02/10] bpf/helpers: introduce sleepable timers

2024-02-14 Thread Benjamin Tissoires
They are implemented as a kfunc, which means a little bit of tweaks in the verifier. Signed-off-by: Benjamin Tissoires --- changes in v2 (compared to the one attaches to v1 0/9): - make use of a kfunc - add a (non-used) BPF_F_TIMER_SLEEPABLE - the callback is *not* called, it makes the kernel

[PATCH RFC bpf-next v2 01/10] bpf/verifier: introduce in_sleepable() helper

2024-02-14 Thread Benjamin Tissoires
No code change, but it'll allow to have only one place to change everything when we add in_sleepable in cur_state. Signed-off-by: Benjamin Tissoires --- changes in v2 (compared to the one attaches to v1 0/9): - dropped the cur_state flag, so it can be put first --- kernel/bpf/verifier.c | 19

Re: [PATCH v4 0/7] Split a folio to any lower order folios

2024-02-14 Thread Zi Yan
Hi Pankaj, On 13 Feb 2024, at 16:55, Zi Yan wrote: > From: Zi Yan > > Hi all, > > File folio supports any order and multi-size THP is upstreamed[1], so both > file and anonymous folios can be >0 order. Currently, split_huge_page() > only splits a huge page to order-0 pages, but splitting to

[PATCH RFC bpf-next v2 00/10] allow HID-BPF to do device IOs

2024-02-14 Thread Benjamin Tissoires
[Still a RFC: there are a lot of FIXMEs in the code, and calling the sleepable timer cb actually crashes.] [Also using bpf-next as the base tree as there will be conflicting changes otherwise] This is crashing, and I have a few questions in the code (look for all of the FIXMEs), so sending this

Re: [PATCH RFC bpf-next 0/9] allow HID-BPF to do device IOs

2024-02-14 Thread Benjamin Tissoires
On Feb 13 2024, Kumar Kartikeya Dwivedi wrote: > On Tue, 13 Feb 2024 at 18:46, Benjamin Tissoires wrote: > > > > On Feb 12 2024, Alexei Starovoitov wrote: > > > On Mon, Feb 12, 2024 at 10:21 AM Benjamin Tissoires > > > wrote: > > > > > > > > On Mon, Feb 12, 2024 at 6:46 PM Toke Høiland-Jørgensen

Re: [PATCH v12 08/20] KVM: pfncache: allow a cache to be activated with a fixed (userspace) HVA

2024-02-14 Thread Paul Durrant
On 14/02/2024 16:20, Sean Christopherson wrote: On Wed, Feb 14, 2024, Paul Durrant wrote: On 07/02/2024 04:03, Sean Christopherson wrote: +s390 folks (question on kvm_is_error_gpa() for ya) But! kvm_is_error_gpa() already exists, and it very, very sneakily does a memslot lookup and checks

Re: [PATCH v4 5/7] mm: thp: split huge page to any lower order pages (except order-1).

2024-02-14 Thread Ryan Roberts
On 14/02/2024 16:28, Zi Yan wrote: > On 14 Feb 2024, at 11:22, Ryan Roberts wrote: > >> On 14/02/2024 16:11, Zi Yan wrote: >>> On 14 Feb 2024, at 5:38, Ryan Roberts wrote: >>> On 13/02/2024 21:55, Zi Yan wrote: > From: Zi Yan > > To split a THP to any lower order (except

Re: [PATCH v4 0/7] Split a folio to any lower order folios

2024-02-14 Thread Zi Yan
On 14 Feb 2024, at 5:55, David Hildenbrand wrote: > On 14.02.24 11:50, Ryan Roberts wrote: >> On 13/02/2024 22:31, Zi Yan wrote: >>> On 13 Feb 2024, at 17:21, David Hildenbrand wrote: >>> On 13.02.24 22:55, Zi Yan wrote: > From: Zi Yan > > Hi all, > > File folio supports

Re: [PATCH v4 5/7] mm: thp: split huge page to any lower order pages (except order-1).

2024-02-14 Thread Zi Yan
On 14 Feb 2024, at 11:22, Ryan Roberts wrote: > On 14/02/2024 16:11, Zi Yan wrote: >> On 14 Feb 2024, at 5:38, Ryan Roberts wrote: >> >>> On 13/02/2024 21:55, Zi Yan wrote: From: Zi Yan To split a THP to any lower order (except order-1) pages, we need to reform THPs on

Re: [PATCH v4 6/7] mm: truncate: split huge page cache page to a non-zero order if possible.

2024-02-14 Thread Ryan Roberts
On 14/02/2024 16:19, Zi Yan wrote: > On 14 Feb 2024, at 5:43, Ryan Roberts wrote: > >> On 13/02/2024 21:55, Zi Yan wrote: >>> From: Zi Yan >>> >>> To minimize the number of pages after a huge page truncation, we do not >>> need to split it all the way down to order-0. The huge page has at most

Re: [PATCH v4 5/7] mm: thp: split huge page to any lower order pages (except order-1).

2024-02-14 Thread Ryan Roberts
On 14/02/2024 16:11, Zi Yan wrote: > On 14 Feb 2024, at 5:38, Ryan Roberts wrote: > >> On 13/02/2024 21:55, Zi Yan wrote: >>> From: Zi Yan >>> >>> To split a THP to any lower order (except order-1) pages, we need to >>> reform THPs on subpages at given order and add page refcount based on the

Re: [PATCH v12 08/20] KVM: pfncache: allow a cache to be activated with a fixed (userspace) HVA

2024-02-14 Thread Sean Christopherson
On Wed, Feb 14, 2024, Paul Durrant wrote: > On 07/02/2024 04:03, Sean Christopherson wrote: > > +s390 folks (question on kvm_is_error_gpa() for ya) > > But! kvm_is_error_gpa() already exists, and it very, very sneakily does a > > memslot > > lookup and checks for a valid HVA. > > > > s390

Re: [PATCH v4 6/7] mm: truncate: split huge page cache page to a non-zero order if possible.

2024-02-14 Thread Zi Yan
On 14 Feb 2024, at 5:43, Ryan Roberts wrote: > On 13/02/2024 21:55, Zi Yan wrote: >> From: Zi Yan >> >> To minimize the number of pages after a huge page truncation, we do not >> need to split it all the way down to order-0. The huge page has at most >> three parts, the part before offset, the

Re: [PATCH v4 5/7] mm: thp: split huge page to any lower order pages (except order-1).

2024-02-14 Thread Zi Yan
On 14 Feb 2024, at 5:38, Ryan Roberts wrote: > On 13/02/2024 21:55, Zi Yan wrote: >> From: Zi Yan >> >> To split a THP to any lower order (except order-1) pages, we need to >> reform THPs on subpages at given order and add page refcount based on the >> new page order. Also we need to

Re: [PATCH v12 08/20] KVM: pfncache: allow a cache to be activated with a fixed (userspace) HVA

2024-02-14 Thread Paul Durrant
On 14/02/2024 16:01, Sean Christopherson wrote: On Tue, Feb 06, 2024, David Woodhouse wrote: On Tue, 2024-02-06 at 20:03 -0800, Sean Christopherson wrote: +s390 folks (question on kvm_is_error_gpa() for ya) On Mon, Jan 15, 2024, Paul Durrant wrote: @@ -1398,7 +1414,9 @@ void

Re: [PATCH v12 08/20] KVM: pfncache: allow a cache to be activated with a fixed (userspace) HVA

2024-02-14 Thread Sean Christopherson
On Tue, Feb 06, 2024, David Woodhouse wrote: > On Tue, 2024-02-06 at 20:03 -0800, Sean Christopherson wrote: > > +s390 folks (question on kvm_is_error_gpa() for ya) > > > > On Mon, Jan 15, 2024, Paul Durrant wrote: > > > @@ -1398,7 +1414,9 @@ void kvm_gpc_deactivate(struct gfn_to_pfn_cache > > >

Re: [RFC PATCH net-next v5 07/14] page_pool: devmem support

2024-02-14 Thread Pavel Begunkov
On 2/13/24 21:11, Mina Almasry wrote: On Tue, Feb 13, 2024 at 5:28 AM Pavel Begunkov wrote: ... A bit of a churn with the padding and nesting net_iov but looks sturdier. No duplication, and you can just check positions of the structure instead of per-field NET_IOV_ASSERT_OFFSET, which you

Re: [PATCH v4 4/7] mm: page_owner: add support for splitting to any order in split page_owner.

2024-02-14 Thread Zi Yan
On 14 Feb 2024, at 4:34, David Hildenbrand wrote: > On 13.02.24 22:55, Zi Yan wrote: >> From: Zi Yan >> >> It adds a new_order parameter to set new page order in page owner. >> It prepares for upcoming changes to support split huge page to any >> lower order. >> >> Signed-off-by: Zi Yan >> ---

Re: [PATCH v12 08/20] KVM: pfncache: allow a cache to be activated with a fixed (userspace) HVA

2024-02-14 Thread Paul Durrant
On 07/02/2024 04:03, Sean Christopherson wrote: +s390 folks (question on kvm_is_error_gpa() for ya) On Mon, Jan 15, 2024, Paul Durrant wrote: @@ -1398,7 +1414,9 @@ void kvm_gpc_deactivate(struct gfn_to_pfn_cache *gpc); static inline void kvm_gpc_mark_dirty(struct gfn_to_pfn_cache *gpc) {

Re: [PATCH v4 2/7] mm/page_owner: use order instead of nr in split_page_owner()

2024-02-14 Thread Zi Yan
On 14 Feb 2024, at 4:14, David Hildenbrand wrote: > On 13.02.24 22:55, Zi Yan wrote: >> From: Zi Yan >> >> We do not have non power of two pages, using nr is error prone if nr >> is not power-of-two. Use page order instead. >> >> Signed-off-by: Zi Yan >> --- >> include/linux/page_owner.h | 8

Re: [PATCH v4 1/7] mm/memcg: use order instead of nr in split_page_memcg()

2024-02-14 Thread Zi Yan
On 14 Feb 2024, at 4:12, David Hildenbrand wrote: > On 13.02.24 22:55, Zi Yan wrote: >> From: Zi Yan >> >> We do not have non power of two pages, using nr is error prone if nr >> is not power-of-two. Use page order instead. >> >> Signed-off-by: Zi Yan >> --- >> include/linux/memcontrol.h | 4

[PATCH v9 3/5] selftest mm/mseal memory sealing

2024-02-14 Thread jeffxu
From: Jeff Xu selftest for memory sealing change in mmap() and mseal(). Signed-off-by: Jeff Xu --- tools/testing/selftests/mm/.gitignore |1 + tools/testing/selftests/mm/Makefile |1 + tools/testing/selftests/mm/mseal_test.c | 1836 +++ 3 files changed, 1838

[PATCH v9 5/5] selftest mm/mseal read-only elf memory segment

2024-02-14 Thread jeffxu
From: Jeff Xu Sealing read-only of elf mapping so it can't be changed by mprotect. Signed-off-by: Jeff Xu --- tools/testing/selftests/mm/.gitignore | 1 + tools/testing/selftests/mm/Makefile | 1 + tools/testing/selftests/mm/seal_elf.c | 183 ++ 3 files changed,

[PATCH v9 4/5] mseal:add documentation

2024-02-14 Thread jeffxu
From: Jeff Xu Add documentation for mseal(). Signed-off-by: Jeff Xu --- Documentation/userspace-api/index.rst | 1 + Documentation/userspace-api/mseal.rst | 199 ++ 2 files changed, 200 insertions(+) create mode 100644 Documentation/userspace-api/mseal.rst diff

[PATCH v9 2/5] mseal: add mseal syscall

2024-02-14 Thread jeffxu
From: Jeff Xu The new mseal() is an syscall on 64 bit CPU, and with following signature: int mseal(void addr, size_t len, unsigned long flags) addr/len: memory range. flags: reserved. mseal() blocks following operations for the given memory range. 1> Unmapping, moving to another location, and

[PATCH v9 1/5] mseal: Wire up mseal syscall

2024-02-14 Thread jeffxu
From: Jeff Xu Wire up mseal syscall for all architectures. Signed-off-by: Jeff Xu --- arch/alpha/kernel/syscalls/syscall.tbl | 1 + arch/arm/tools/syscall.tbl | 1 + arch/arm64/include/asm/unistd.h | 2 +- arch/arm64/include/asm/unistd32.h | 2 ++

[PATCH v9 0/5] Introduce mseal

2024-02-14 Thread jeffxu
From: Jeff Xu This is V9 version, with removing MAP_SEALABLE and PROT_SEAL from mmap(), adding perfrmance benchmark and a test to demo the sealing of read-only memory segment of elf mapping. -- This patchset proposes a new mseal()

Re: [PATCH RFC bpf-next 0/9] allow HID-BPF to do device IOs

2024-02-14 Thread Toke Høiland-Jørgensen
Alexei Starovoitov writes: > On Tue, Feb 13, 2024 at 08:51:26PM +0100, Toke Høiland-Jørgensen wrote: >> Kumar Kartikeya Dwivedi writes: >> >> > On Tue, 13 Feb 2024 at 18:46, Benjamin Tissoires >> > wrote: >> >> >> >> On Feb 12 2024, Alexei Starovoitov wrote: >> >> > On Mon, Feb 12, 2024 at

[PATCH RFC] kunit: tool: add 'mte=on' qemu arg on arm64

2024-02-14 Thread Paul Heidekrüger
Hi! I was running some KASan tests with kunit.py recently and noticed that when KASan is run in hw tags mode, we manually have to add the required `mte=on` option to kunit_tool's qemu invocation, as the tests will otherwise crash. To make life easier, I was looking into ways for kunit.py to

[PATCH 5/5] KVM: riscv: selftests: Add Zacas extension to get-reg-list test

2024-02-14 Thread Anup Patel
The KVM RISC-V allows Zacas extension for Guest/VM so let us add this extension to get-reg-list test. Signed-off-by: Anup Patel --- tools/testing/selftests/kvm/riscv/get-reg-list.c | 4 1 file changed, 4 insertions(+) diff --git a/tools/testing/selftests/kvm/riscv/get-reg-list.c

[PATCH 4/5] RISC-V: KVM: Allow Zacas extension for Guest/VM

2024-02-14 Thread Anup Patel
We extend the KVM ISA extension ONE_REG interface to allow KVM user space to detect and enable Zacas extension for Guest/VM. Signed-off-by: Anup Patel --- arch/riscv/include/uapi/asm/kvm.h | 1 + arch/riscv/kvm/vcpu_onereg.c | 2 ++ 2 files changed, 3 insertions(+) diff --git

[PATCH 3/5] KVM: riscv: selftests: Add Ztso extension to get-reg-list test

2024-02-14 Thread Anup Patel
The KVM RISC-V allows Ztso extension for Guest/VM so let us add this extension to get-reg-list test. Signed-off-by: Anup Patel --- tools/testing/selftests/kvm/riscv/get-reg-list.c | 4 1 file changed, 4 insertions(+) diff --git a/tools/testing/selftests/kvm/riscv/get-reg-list.c

[PATCH 2/5] RISC-V: KVM: Allow Ztso extension for Guest/VM

2024-02-14 Thread Anup Patel
We extend the KVM ISA extension ONE_REG interface to allow KVM user space to detect and enable Ztso extension for Guest/VM. Signed-off-by: Anup Patel --- arch/riscv/include/uapi/asm/kvm.h | 1 + arch/riscv/kvm/vcpu_onereg.c | 2 ++ 2 files changed, 3 insertions(+) diff --git

[PATCH 1/5] RISC-V: KVM: Forward SEED CSR access to user space

2024-02-14 Thread Anup Patel
The SEED CSR access from VS/VU mode (guest) will always trap to HS-mode (KVM) when Zkr extension is available to the Guest/VM. We must forward this CSR access to KVM user space so that it can be emulated based on the method chosen by VMM. Fixes: f370b4e668f0 ("RISC-V: KVM: Allow scalar crypto

[PATCH 0/5] KVM RISC-V report few more ISA extensions through ONE_REG

2024-02-14 Thread Anup Patel
This series extends the KVM RISC-V ONE_REG interface to report few more ISA extensions namely: Ztso and Zacas. These extensions are already supported by the HWPROBE interface in Linux-6.8 kernel. To test these patches, use KVMTOOL from the riscv_more_exts_round2_v1 branch at:

Re: [PATCH v4 0/7] Split a folio to any lower order folios

2024-02-14 Thread David Hildenbrand
On 14.02.24 11:50, Ryan Roberts wrote: On 13/02/2024 22:31, Zi Yan wrote: On 13 Feb 2024, at 17:21, David Hildenbrand wrote: On 13.02.24 22:55, Zi Yan wrote: From: Zi Yan Hi all, File folio supports any order and multi-size THP is upstreamed[1], so both file and anonymous folios can be >0

Re: [PATCH v4 0/7] Split a folio to any lower order folios

2024-02-14 Thread Ryan Roberts
On 13/02/2024 22:31, Zi Yan wrote: > On 13 Feb 2024, at 17:21, David Hildenbrand wrote: > >> On 13.02.24 22:55, Zi Yan wrote: >>> From: Zi Yan >>> >>> Hi all, >>> >>> File folio supports any order and multi-size THP is upstreamed[1], so both >>> file and anonymous folios can be >0 order.

  1   2   >