Re: [PATCH v2 4/7] kunit: Handle test faults

2024-03-11 Thread David Gow
On Sat, 2 Mar 2024 at 03:40, Mickaël Salaün wrote: > > Previously, when a kernel test thread crashed (e.g. NULL pointer > dereference, general protection fault), the KUnit test hanged for 30 > seconds and exited with a timeout error. > > Fix this issue by waiting on task_struct->vfork_done instead

Re: [PATCH v2 7/7] kunit: Add tests for fault

2024-03-11 Thread David Gow
On Sat, 2 Mar 2024 at 03:40, Mickaël Salaün wrote: > > Add a test case to check NULL pointer dereference and make sure it would > result as a failed test. > > The full kunit_fault test suite is marked as skipped when run on UML > because it would result to a kernel panic. > > Tested with: > ./tool

Re: [PATCH v2 6/7] kunit: Print last test location on fault

2024-03-11 Thread David Gow
On Sat, 2 Mar 2024 at 03:40, Mickaël Salaün wrote: > > This helps identify the location of test faults. > > Cc: Brendan Higgins > Cc: David Gow > Cc: Rae Moar > Cc: Shuah Khan > Reviewed-by: Kees Cook > Signed-off-by: Mickaël Salaün > Link: https://lore.kernel.org/r/20240301194037.532117-7-.

Re: [PATCH v2 5/7] kunit: Fix KUNIT_SUCCESS() calls in iov_iter tests

2024-03-11 Thread David Gow
On Sat, 2 Mar 2024 at 03:40, Mickaël Salaün wrote: > > Fix KUNIT_SUCCESS() calls to pass a test argument. > > This is a no-op for now because this macro does nothing, but it will be > required for the next commit. > > Cc: Brendan Higgins > Cc: David Gow > Cc: Rae Moar > Cc: Shuah Khan > Review

Re: [PATCH v2 3/7] kunit: Fix timeout message

2024-03-11 Thread David Gow
On Sat, 2 Mar 2024 at 03:40, Mickaël Salaün wrote: > > The exit code is always checked, so let's properly handle the -ETIMEDOUT > error code. > > Cc: Brendan Higgins > Cc: David Gow > Cc: Rae Moar > Cc: Shuah Khan > Reviewed-by: Kees Cook > Signed-off-by: Mickaël Salaün > Link: https://lore.

Re: [PATCH v2 2/7] kunit: Fix kthread reference

2024-03-11 Thread David Gow
On Sat, 2 Mar 2024 at 03:40, Mickaël Salaün wrote: > > There is a race condition when a kthread finishes after the deadline and > before the call to kthread_stop(), which may lead to use after free. > > Cc: Brendan Higgins > Cc: David Gow > Cc: Rae Moar > Cc: Shuah Khan > Reviewed-by: Kees Coo

Re: [PATCH v2 1/7] kunit: Handle thread creation error

2024-03-11 Thread David Gow
On Sat, 2 Mar 2024 at 03:40, Mickaël Salaün wrote: > > Previously, if a thread creation failed (e.g. -ENOMEM), the function was > called (kunit_catch_run_case or kunit_catch_run_case_cleanup) without > marking the test as failed. Instead, fill try_result with the error > code returned by kthread_

[PATCH vhost v3 3/4] virtio: vring_new_virtqueue(): pass struct instead of multi parameters

2024-03-11 Thread Xuan Zhuo
Now, we pass multi parameters to vring_new_virtqueue. These parameters may from transport or from driver. vring_new_virtqueue is called by many places. Every time, we try to add a new parameter, that is difficult. If parameters from the driver, that should directly be passed to vring. Then the vr

[PATCH vhost v3 1/4] virtio: find_vqs: pass struct instead of multi parameters

2024-03-11 Thread Xuan Zhuo
Now, we pass multi parameters to find_vqs. These parameters may work for transport or work for vring. And find_vqs has multi implements in many places: arch/um/drivers/virtio_uml.c drivers/platform/mellanox/mlxbf-tmfifo.c drivers/remoteproc/remoteproc_virtio.c drivers/s390/virtio/virtio_ccw.c

[PATCH vhost v3 0/4] refactor the params of find_vqs()

2024-03-11 Thread Xuan Zhuo
This pathset is splited from the http://lore.kernel.org/all/20240229072044.77388-1-xuanz...@linux.alibaba.com That may needs some cycles to discuss. But that notifies too many people. But just the four commits need to notify so many people. And four commits are independent. So I split that

[PATCH vhost v3 4/4] virtio_ring: simplify the parameters of the funcs related to vring_create/new_virtqueue()

2024-03-11 Thread Xuan Zhuo
As the refactor of find_vqs()/vring_new_virtqueue()/vring_create_virtqueue the struct cfg/tp_cfg are passed to vring. This patch refactors the vring by these structures. This can simplify the code. Signed-off-by: Xuan Zhuo Reviewed-by: Ilpo J=E4rvinen --- drivers/virtio/virtio_ring.c | 157 +++

[PATCH vhost v3 2/4] virtio: vring_create_virtqueue: pass struct instead of multi parameters

2024-03-11 Thread Xuan Zhuo
Now, we pass multi parameters to vring_create_virtqueue. These parameters may from transport or from driver. vring_create_virtqueue is called by many places. Every time, we try to add a new parameter, that is difficult. If parameters from the driver, that should directly be passed to vring. Then

Re: [PATCH v2 4/7] kunit: Handle test faults

2024-03-11 Thread Rae Moar
On Fri, Mar 1, 2024 at 2:40 PM Mickaël Salaün wrote: > > Previously, when a kernel test thread crashed (e.g. NULL pointer > dereference, general protection fault), the KUnit test hanged for 30 > seconds and exited with a timeout error. > > Fix this issue by waiting on task_struct->vfork_done inste

Re: [PATCH vhost v2 1/4] virtio: find_vqs: pass struct instead of multi parameters

2024-03-11 Thread Eric Farman
On Mon, 2024-03-11 at 15:21 +0800, Xuan Zhuo wrote: > Now, we pass multi parameters to find_vqs. These parameters > may work for transport or work for vring. > > And find_vqs has multi implements in many places: > >  arch/um/drivers/virtio_uml.c >  drivers/platform/mellanox/mlxbf-tmfifo.c >  driv

Re: [PATCH vhost v2 0/4] refactor the params of find_vqs()

2024-03-11 Thread Ilpo Järvinen
On Mon, 11 Mar 2024, Xuan Zhuo wrote: > This pathset is splited from the > > > http://lore.kernel.org/all/20240229072044.77388-1-xuanz...@linux.alibaba.com > > That may needs some cycles to discuss. But that notifies too many people. > > But just the four commits need to notify so many pe

Re: [PATCH 2/2] um: virtio_uml: Convert to platform remove callback returning void

2024-03-11 Thread Geert Uytterhoeven
On Sun, Mar 10, 2024 at 8:52 AM Uwe Kleine-König wrote: > The .remove() callback for a platform driver returns an int which makes > many driver authors wrongly assume it's possible to do error handling by > returning an error code. However the value returned is ignored (apart > from emitting a war

Re: [PATCH 1/2] um: rtc: Convert to platform remove callback returning void

2024-03-11 Thread Geert Uytterhoeven
On Sun, Mar 10, 2024 at 8:52 AM Uwe Kleine-König wrote: > The .remove() callback for a platform driver returns an int which makes > many driver authors wrongly assume it's possible to do error handling by > returning an error code. However the value returned is ignored (apart > from emitting a war

[PATCH vhost v2 3/4] virtio: vring_new_virtqueue(): pass struct instead of multi parameters

2024-03-11 Thread Xuan Zhuo
Now, we pass multi parameters to vring_new_virtqueue. These parameters may from transport or from driver. vring_new_virtqueue is called by many places. Every time, we try to add a new parameter, that is difficult. If parameters from the driver, that should directly be passed to vring. Then the vr

[PATCH vhost v2 1/4] virtio: find_vqs: pass struct instead of multi parameters

2024-03-11 Thread Xuan Zhuo
Now, we pass multi parameters to find_vqs. These parameters may work for transport or work for vring. And find_vqs has multi implements in many places: arch/um/drivers/virtio_uml.c drivers/platform/mellanox/mlxbf-tmfifo.c drivers/remoteproc/remoteproc_virtio.c drivers/s390/virtio/virtio_ccw.c

[PATCH vhost v2 4/4] virtio_ring: simplify the parameters of the funcs related to vring_create/new_virtqueue()

2024-03-11 Thread Xuan Zhuo
As the refactor of find_vqs()/vring_new_virtqueue()/vring_create_virtqueue the struct cfg/tp_cfg are passed to vring. This patch refactors the vring by these structures. This can simplify the code. Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_ring.c | 157 +++--

[PATCH vhost v2 2/4] virtio: vring_create_virtqueue: pass struct instead of multi parameters

2024-03-11 Thread Xuan Zhuo
Now, we pass multi parameters to vring_create_virtqueue. These parameters may from transport or from driver. vring_create_virtqueue is called by many places. Every time, we try to add a new parameter, that is difficult. If parameters from the driver, that should directly be passed to vring. Then

[PATCH vhost v2 0/4] refactor the params of find_vqs()

2024-03-11 Thread Xuan Zhuo
This pathset is splited from the http://lore.kernel.org/all/20240229072044.77388-1-xuanz...@linux.alibaba.com That may needs some cycles to discuss. But that notifies too many people. But just the four commits need to notify so many people. And four commits are independent. So I split that