add a ->free_disk block_device_operation v3

2022-02-15 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 3/5] memstick/mspro_block: fix handling of read-only devices

2022-02-15 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

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

2022-02-15 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 1/5] block: add a ->free_disk method

2022-02-15 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. A new flag is added so that ->free_disk is

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

2022-02-15 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 5/5] virtio_blk: simplify refcounting

2022-02-15 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 Reviewed-by: Stefan Hajnoczi Acked-by: Michael S. Tsirkin --- drivers/block/virtio_blk.c | 66

Re: [PATCH] Virtio-balloon: add user space API for sizing

2022-02-15 Thread David Hildenbrand
On 14.02.22 20:59, Kameron Lutes wrote: > This new linux API will allow user space applications to directly > control the size of the virtio-balloon. This is useful in > situations where the guest must quickly respond to drastically > increased memory pressure and cannot wait for the host to

Re: [PATCH V4 4/4] vDPA/ifcvf: implement shared IRQ feature

2022-02-15 Thread Michael S. Tsirkin
On Tue, Feb 15, 2022 at 11:34:31AM +0800, Jason Wang wrote: > On Mon, Feb 14, 2022 at 10:25 PM Michael S. Tsirkin wrote: > > > > On Mon, Feb 14, 2022 at 03:19:25PM +0800, Jason Wang wrote: > > > > > > 在 2022/2/3 下午3:27, Zhu Lingshan 写道: > > > > On some platforms/devices, there may not be enough

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

2022-02-15 Thread zhenwei pi
Hi, Lei Could you please review the V2 version? On 2/11/22 4:41 PM, zhenwei pi wrote: v1 -> v2: - Fix 1 compiling warning reported by kernel test robot - Put "__le32 akcipher_algo;" instead of "__le32 reserve;" field of struct virtio_crypto_config directly without size change. - Add

Re: [RFC v3 1/2] virtio-pmem: Async virtio-pmem flush

2022-02-15 Thread Dan Williams
On Tue, Jan 11, 2022 at 8:23 AM Pankaj Gupta wrote: > > Enable asynchronous flush for virtio pmem using work queue. Also, > coalesce the flush requests when a flush is already in process. > This functionality is copied from md/RAID code. > > When a flush is already in process, new flush requests

Re: [PATCH v5 06/22] virtio_ring: queue_reset: packed: support enable reset queue

2022-02-15 Thread Jason Wang
On Mon, Feb 14, 2022 at 4:14 PM Xuan Zhuo wrote: > > 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

Re: [PATCH v5 14/22] virtio_pci: queue_reset: support VIRTIO_F_RING_RESET

2022-02-15 Thread Jason Wang
On Mon, Feb 14, 2022 at 4:14 PM Xuan Zhuo wrote: > > 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

Re: [PATCH v5 20/22] virtio_net: set the default max ring num

2022-02-15 Thread Jason Wang
On Mon, Feb 14, 2022 at 4:14 PM Xuan Zhuo wrote: > > Sets the default maximum ring num based on virtio_set_max_ring_num(). > > The default maximum ring num is 1024. Having a default value is pretty useful, I see 32K is used by default for IFCVF. Rethink this, how about having a different

Re: [PATCH v5 17/22] virtio_net: support rx/tx queue reset

2022-02-15 Thread Jason Wang
On Mon, Feb 14, 2022 at 4:14 PM Xuan Zhuo wrote: > > This patch implements the reset function of the rx, tx queues. > > Based on this function, it is possible to modify the ring num of the > queue. And quickly recycle the buffer in the queue. > > In the process of the queue disable, in theory, as

Re: [PATCH v5 19/22] virtio: add helper virtio_set_max_ring_num()

2022-02-15 Thread Jason Wang
On Mon, Feb 14, 2022 at 4:15 PM Xuan Zhuo wrote: > > Added helper virtio_set_max_ring_num() to set the upper limit of ring > num when creating a virtqueue. > > Can be used to limit ring num before find_vqs() call. Or change ring num > when re-enable reset queue. Do we have a chance that RX and

Re: [RFC v3 2/2] pmem: enable pmem_submit_bio for asynchronous flush

2022-02-15 Thread Dan Williams
On Tue, Jan 11, 2022 at 8:21 AM Pankaj Gupta wrote: > > Return from "pmem_submit_bio" when asynchronous flush is > still in progress in other context. > > Signed-off-by: Pankaj Gupta > --- > drivers/nvdimm/pmem.c| 15 --- > drivers/nvdimm/region_devs.c | 4 +++- > 2 files

[PATCH] drm/virtio: Fix capset-id query size

2022-02-15 Thread Rob Clark
From: Rob Clark The UABI was already defined for pointer to 64b value, and all the userspace users of this ioctl that I could find are already using a uint64_t (but zeroing it out to work around kernel only copying 32b). Unfortunately this ioctl doesn't have a length field, so out of paranoia I

Re: [PATCH] drm/virtio: Fix capset-id query size

2022-02-15 Thread Gurchetan Singh
On Tue, Feb 15, 2022 at 5:15 PM Rob Clark wrote: > From: Rob Clark > > The UABI was already defined for pointer to 64b value, and all the > userspace users of this ioctl that I could find are already using a > uint64_t (but zeroing it out to work around kernel only copying 32b). > Unfortunately

Re: [PATCH v5 08/22] virtio_ring: queue_reset: add vring_release_virtqueue()

2022-02-15 Thread Jason Wang
On Mon, Feb 14, 2022 at 4:14 PM Xuan Zhuo wrote: > > 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 | 18

Re: [PATCH v5 22/22] virtio_net: support set_ringparam

2022-02-15 Thread Jason Wang
On Mon, Feb 14, 2022 at 4:15 PM Xuan Zhuo wrote: > > Support set_ringparam based on virtio queue reset. > > The rx,tx_pending required to be passed must be power of 2. > > Signed-off-by: Xuan Zhuo > --- > drivers/net/virtio_net.c | 50 > 1 file changed,

Re: [PATCH v5 22/22] virtio_net: support set_ringparam

2022-02-15 Thread Xuan Zhuo
On Wed, 16 Feb 2022 12:14:39 +0800, Jason Wang wrote: > On Mon, Feb 14, 2022 at 4:15 PM Xuan Zhuo wrote: > > > > Support set_ringparam based on virtio queue reset. > > > > The rx,tx_pending required to be passed must be power of 2. > > > > Signed-off-by: Xuan Zhuo > > --- > >

Re: [PATCH v5 20/22] virtio_net: set the default max ring num

2022-02-15 Thread Xuan Zhuo
On Wed, 16 Feb 2022 12:14:31 +0800, Jason Wang wrote: > On Mon, Feb 14, 2022 at 4:14 PM Xuan Zhuo wrote: > > > > Sets the default maximum ring num based on virtio_set_max_ring_num(). > > > > The default maximum ring num is 1024. > > Having a default value is pretty useful, I see 32K is used by

Re: [PATCH v5 19/22] virtio: add helper virtio_set_max_ring_num()

2022-02-15 Thread Xuan Zhuo
On Wed, 16 Feb 2022 12:14:04 +0800, Jason Wang wrote: > On Mon, Feb 14, 2022 at 4:15 PM Xuan Zhuo wrote: > > > > Added helper virtio_set_max_ring_num() to set the upper limit of ring > > num when creating a virtqueue. > > > > Can be used to limit ring num before find_vqs() call. Or change ring