RE: [PATCH 2/3] virtio-crypto: introduce akcipher service

2022-02-09 Thread Gonglei (Arei) via Virtualization
> -Original Message- > From: zhenwei pi [mailto:pizhen...@bytedance.com] > Sent: Friday, January 21, 2022 10:25 AM > To: m...@redhat.com; Gonglei (Arei) > Cc: jasow...@redhat.com; virtualization@lists.linux-foundation.org; > linux-cry...@vger.kernel.org; linux-ker...@vger.kernel.org; >

Re: PING: [PATCH 0/3] Introduce akcipher service for virtio-crypto

2022-02-09 Thread Michael S. Tsirkin
On Thu, Feb 10, 2022 at 03:17:38PM +0800, Jason Wang wrote: > On Thu, Feb 10, 2022 at 2:58 PM zhenwei pi wrote: > > > > PING! > > I think it would be helpful to get ack/reviewing from crypto gurus. For sure, but with the robot warning some people might just assume there's a problem and wait for

RE: [PATCH 1/3] virtio_crypto: Introduce VIRTIO_CRYPTO_NOSPC

2022-02-09 Thread Gonglei (Arei) via Virtualization
> -Original Message- > From: zhenwei pi [mailto:pizhen...@bytedance.com] > Sent: Friday, January 21, 2022 10:25 AM > To: m...@redhat.com; Gonglei (Arei) > Cc: jasow...@redhat.com; virtualization@lists.linux-foundation.org; > linux-cry...@vger.kernel.org; linux-ker...@vger.kernel.org; >

Re: PING: [PATCH 0/3] Introduce akcipher service for virtio-crypto

2022-02-09 Thread Jason Wang
On Thu, Feb 10, 2022 at 2:58 PM zhenwei pi wrote: > > PING! I think it would be helpful to get ack/reviewing from crypto gurus. Maybe Herbert? Thanks > > PS: Please ignore the warning from kernel test robot, I'll fix it in > next version. > > On 1/21/22 10:24 AM, zhenwei pi wrote: > >

PING: [PATCH 0/3] Introduce akcipher service for virtio-crypto

2022-02-09 Thread zhenwei pi
PING! PS: Please ignore the warning from kernel test robot, I'll fix it in next version. On 1/21/22 10:24 AM, zhenwei pi wrote: Introduce akcipher service, implement RSA algorithm, and a minor fix. zhenwei pi (3): virtio_crypto: Introduce VIRTIO_CRYPTO_NOSPC virtio-crypto: introduce

[PATCH V8 2/8] fork/vm: Move common PF_IO_WORKER behavior to new flag

2022-02-09 Thread Mike Christie
This adds a new flag, PF_USER_WORKER, that's used for behavior common to to both PF_IO_WORKER and users like vhost which will use a new helper instead of create_io_thread because they require different behavior. The common behavior PF_USER_WORKER covers is the initial frame and fpu setup and the

[PATCH V8 5/8] fork: allow kernel code to call copy_process

2022-02-09 Thread Mike Christie
The next patch adds helpers like create_io_thread, but for use by the vhost layer. There are several functions, so they are in their own file instead of cluttering up fork.c. This patch allows that new file to call copy_process. Signed-off-by: Mike Christie --- include/linux/sched/task.h | 2 ++

[PATCH V8 7/8] vhost: move worker thread fields to new struct

2022-02-09 Thread Mike Christie
This is just a prep patch. It moves the worker related fields to a new vhost_worker struct and moves the code around to create some helpers that will be used in the next patch. Signed-off-by: Mike Christie Reviewed-by: Stefan Hajnoczi Acked-by: Michael S. Tsirkin Reviewed-by: Christoph Hellwig

[PATCH V8 8/8] vhost: use vhost_tasks for worker threads

2022-02-09 Thread Mike Christie
For vhost workers we use the kthread API which inherit's its values from and checks against the kthreadd thread. This results in the wrong RLIMITs being checked, so while tools like libvirt try to control the number of threads based on the nproc rlimit setting we can end up creating more threads

[PATCH V8 3/8] fork: add USER_WORKER flag to not dup/clone files

2022-02-09 Thread Mike Christie
Each vhost device gets a thread that is used to perform IO and management operations. Instead of a thread that is accessing a device, the thread is part of the device, so when it creates a thread using a helper based on copy_process we can't dup or clone the parent's files/FDS because it would do

[PATCH V8 6/8] vhost_task: Allow vhost layer to use copy_process

2022-02-09 Thread Mike Christie
Qemu will create vhost devices in the kernel which perform network, SCSI, etc IO and management operations from worker threads created by the kthread API. Because the kthread API does a copy_process on the kthreadd thread, the vhost layer has to use kthread_use_mm to access the Qemu thread's

[PATCH V8 1/8] fork: Make IO worker options flag based

2022-02-09 Thread Mike Christie
This patchset adds a couple new options to kernel_clone_args for the vhost layer which is going to work like PF_IO_WORKER but will differ enough that we will need to add several fields to kernel_clone_args. This patch moves us to a flags based approach for these types of users. Signed-off-by:

[PATCH V8 4/8] fork: Add USER_WORKER flag to ignore signals

2022-02-09 Thread Mike Christie
From: Christian Brauner Since: commit 10ab825bdef8 ("change kernel threads to ignore signals instead of blocking them") kthreads have been ignoring signals by default, and the vhost layer has never had a need to change that. This patch adds an option flag, USER_WORKER_SIG_IGN, handled in

[PATCH V8 0/8] Use copy_process in vhost layer

2022-02-09 Thread Mike Christie
The following patches made over Linus's tree, allow the vhost layer to do a copy_process on the thread that does the VHOST_SET_OWNER ioctl like how io_uring does a copy_process against its userspace app. This allows the vhost layer's worker threads to inherit cgroups, namespaces, address space,

[PATCH v2 1/2] drm/gem-shmem: Set vm_ops in static initializer

2022-02-09 Thread Thomas Zimmermann
Initialize default vm_ops in static initialization of the GEM SHMEM funcs, instead of the mmap code. It's simply better style. GEM helpers will later set a VMA's vm_ops from the default automatically. v2: * also update the drivers that build upon GEM SHMEM Signed-off-by: Thomas

[PATCH v2 0/2] drm/gem-shmem: Various improvements

2022-02-09 Thread Thomas Zimmermann
Two patches for GEM's SHMEM-backed implementation. v2: * update drivers after vm_ops change Thomas Zimmermann (2): drm/gem-shmem: Set vm_ops in static initializer drm/gem-shmem: Don't store mmap'ed buffers in core dumps drivers/gpu/drm/drm_gem_shmem_helper.c | 7 ---

[PATCH v2 2/2] drm/gem-shmem: Don't store mmap'ed buffers in core dumps

2022-02-09 Thread Thomas Zimmermann
Set the VM_DONTDUMP flag on mmap'ed VMAs to omit them from core dumps. It's display-buffer memory; who knows what secrets these buffers contain. Signed-off-by: Thomas Zimmermann --- drivers/gpu/drm/drm_gem_shmem_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

[PATCH v4 14/14] virtio_pci: queue_reset: support VIRTIO_F_RING_RESET

2022-02-09 Thread Xuan Zhuo
This patch implements virtio pci support for QUEUE RESET. Performing reset on a queue is divided into these steps: 1. reset_vq: reset one vq 2. recycle the buffer from vq by virtqueue_detach_unused_buf() 3. release the ring of the vq by vring_release_virtqueue() 4. enable_reset_vq: re-enable the

[PATCH v4 10/14] virtio_pci: queue_reset: update struct virtio_pci_common_cfg and option functions

2022-02-09 Thread Xuan Zhuo
Add queue_reset in virtio_pci_common_cfg, and add related operation functions. For not breaks uABI, add a new struct virtio_pci_common_cfg_reset. Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_pci_modern_dev.c | 36 ++ include/linux/virtio_pci_modern.h | 2 ++

[PATCH v4 13/14] virtio_pci: queue_reset: vp_setup_vq() support ring_num

2022-02-09 Thread Xuan Zhuo
vp_setup_vq() adds parameter ring_num to allow specifying ring num during setup. This can be used to implement virtio-net support set_ringparm(ethtool -G eth0 rx 128 tx 128) Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_pci_common.c | 8 drivers/virtio/virtio_pci_common.h | 5

[PATCH v4 11/14] virtio_pci: queue_reset: release vq by vp_dev->vqs

2022-02-09 Thread Xuan Zhuo
In the process of queue reset, vq leaves vdev->vqs, so the original processing logic may miss some vq. So modify the processing method of releasing vq. Release vq by listing vqs. Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_pci_common.c | 22 ++

[PATCH v4 12/14] virtio_pci: queue_reset: setup_vq() support vring_setup_virtqueue()

2022-02-09 Thread Xuan Zhuo
modern setup_vq() replaces vring_create_virtqueue() with vring_setup_virtqueue() vp_setup_vq() can pass the original vq(from info->vq) to re-enable vq. Allow direct calls to vp_setup_vq() in virtio_pci_modern.c Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_pci_common.c | 31

[PATCH v4 09/14] virtio: queue_reset: struct virtio_config_ops add callbacks for queue_reset

2022-02-09 Thread Xuan Zhuo
Performing reset on a queue is divided into four steps: 1. reset_vq: reset one vq 2. recycle the buffer from vq by virtqueue_detach_unused_buf() 3. release the ring of the vq by vring_release_virtqueue() 4. enable_reset_vq: re-enable the reset queue So add two callbacks reset_vq, enable_reset_vq

[PATCH v4 08/14] virtio_ring: queue_reset: add vring_release_virtqueue()

2022-02-09 Thread Xuan Zhuo
Added vring_release_virtqueue() to release the ring of the vq. In this process, vq is removed from the vdev->vqs queue. And the memory of the ring is released Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_ring.c | 13 - include/linux/virtio.h | 5 + 2 files changed,

[PATCH v4 06/14] virtio_ring: queue_reset: packed: support enable reset queue

2022-02-09 Thread Xuan Zhuo
The purpose of this patch is to make vring packed support re-enable reset vq. Based on whether the incoming vq passed by vring_setup_virtqueue() is NULL or not, distinguish whether it is a normal create virtqueue or re-enable a reset queue. When re-enable a reset queue, reuse the original

[PATCH v4 05/14] virtio_ring: queue_reset: split: support enable reset queue

2022-02-09 Thread Xuan Zhuo
The purpose of this patch is to make vring split support re-enable reset vq. Based on whether the incoming vq passed by vring_setup_virtqueue() is NULL or not, distinguish whether it is a normal create virtqueue or re-enable a reset queue. When re-enable a reset queue, reuse the original

[PATCH v4 07/14] virtio_ring: queue_reset: extract the release function of the vq ring

2022-02-09 Thread Xuan Zhuo
Extract a function __vring_del_virtqueue() from vring_del_virtqueue() to handle releasing vq's ring. Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_ring.c | 13 + 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/virtio/virtio_ring.c

[PATCH v4 02/14] virtio: queue_reset: add VIRTIO_F_RING_RESET

2022-02-09 Thread Xuan Zhuo
Added VIRTIO_F_RING_RESET, it came from here https://github.com/oasis-tcs/virtio-spec/issues/124 Signed-off-by: Xuan Zhuo --- include/uapi/linux/virtio_config.h | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/include/uapi/linux/virtio_config.h

[PATCH v4 00/14] virtio pci support VIRTIO_F_RING_RESET

2022-02-09 Thread Xuan Zhuo
The virtio spec already supports the virtio queue reset function. This patch set is to add this function to the kernel. The relevant virtio spec information is here: https://github.com/oasis-tcs/virtio-spec/issues/124 Also regarding MMIO support for queue reset, I plan to support it after

[PATCH v4 01/14] virtio_pci: struct virtio_pci_common_cfg add queue_notify_data

2022-02-09 Thread Xuan Zhuo
Add queue_notify_data in struct virtio_pci_common_cfg, which comes from here https://github.com/oasis-tcs/virtio-spec/issues/89 For not breaks uABI, add a new struct virtio_pci_common_cfg_notify. Since I want to add queue_reset after queue_notify_data, I submitted this patch first.

[PATCH v4 04/14] virtio_ring: queue_reset: split: add __vring_init_virtqueue()

2022-02-09 Thread Xuan Zhuo
Extract vq's initialization function __vring_init_virtqueue() from __vring_new_virtqueue() Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_ring.c | 61 +--- 1 file changed, 42 insertions(+), 19 deletions(-) diff --git a/drivers/virtio/virtio_ring.c

[PATCH v4 03/14] virtio_ring: queue_reset: add function vring_setup_virtqueue()

2022-02-09 Thread Xuan Zhuo
Added function vring_setup_virtqueue() to allow passing existing vq without reallocating vq. The purpose of adding this function is to not break the form of vring_create_virtqueue(). Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_ring.c | 7 --- include/linux/virtio_ring.h | 37

Re: [PATCH 5/5] virtio_blk: simplify refcounting

2022-02-09 Thread Stefan Hajnoczi
On Wed, Feb 09, 2022 at 09:21:20AM +0100, Christoph Hellwig wrote: > Implement the ->free_disk method to free the virtio_blk structure only > once the last gendisk reference goes away instead of keeping a local > refcount. > > Signed-off-by: Christoph Hellwig > --- > drivers/block/virtio_blk.c

Re: [PATCH 5/5] virtio_blk: simplify refcounting

2022-02-09 Thread Michael S. Tsirkin
On Wed, Feb 09, 2022 at 09:21:20AM +0100, Christoph Hellwig wrote: > Implement the ->free_disk method to free the virtio_blk structure only > once the last gendisk reference goes away instead of keeping a local > refcount. > > Signed-off-by: Christoph Hellwig Acked-by: Michael S. Tsirkin >

[PATCH 5/5] virtio_blk: simplify refcounting

2022-02-09 Thread Christoph Hellwig
Implement the ->free_disk method to free the virtio_blk structure only once the last gendisk reference goes away instead of keeping a local refcount. Signed-off-by: Christoph Hellwig --- drivers/block/virtio_blk.c | 74 +++--- 1 file changed, 21 insertions(+), 53

[PATCH 2/5] memstick/ms_block: simplify refcounting

2022-02-09 Thread Christoph Hellwig
Implement the ->free_disk method to free the msb_data structure only once the last gendisk reference goes away instead of keeping a local refcount. Signed-off-by: Christoph Hellwig --- drivers/memstick/core/ms_block.c | 64 drivers/memstick/core/ms_block.h | 1

[PATCH 4/5] memstick/mspro_block: simplify refcounting

2022-02-09 Thread Christoph Hellwig
Implement the ->free_disk method to free the msb_data structure only once the last gendisk reference goes away instead of keeping a local refcount. Signed-off-by: Christoph Hellwig --- drivers/memstick/core/mspro_block.c | 49 + 1 file changed, 7 insertions(+), 42

[PATCH 3/5] memstick/mspro_block: fix handling of read-only devices

2022-02-09 Thread Christoph Hellwig
Use set_disk_ro to propagate the read-only state to the block layer instead of checking for it in ->open and leaking a reference in case of a read-only device. Signed-off-by: Christoph Hellwig --- drivers/memstick/core/mspro_block.c | 10 -- 1 file changed, 4 insertions(+), 6

add a ->free_disk block_device_operation v2

2022-02-09 Thread Christoph Hellwig
Hi Jens, this series adds a ->free_disk method to struct block_device_operation so that drivers can defer freeing their disk private data until the gendisk goes away and don't need to play games with the validity of ->private_data. This also converts three simple drivers over as example, but

[PATCH 1/5] block: add a ->free_disk method

2022-02-09 Thread Christoph Hellwig
Add a method to notify the driver that the gendisk is about to be freed. This allows drivers to tie the lifetime of their private data to that of the gendisk and thus deal with device removal races without expensive synchronization and boilerplate code. Signed-off-by: Christoph Hellwig ---