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

2022-02-02 Thread Michael S. Tsirkin
On Wed, Feb 02, 2022 at 04:56:56PM +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 > ---

Re: [PATCH 7/8] VMCI: dma dg: add support for DMA datagrams sends

2022-02-02 Thread kernel test robot
Hi Jorgen, I love your patch! Perhaps something to improve: [auto build test WARNING on char-misc/char-misc-testing] [also build test WARNING on linux/master linus/master v5.17-rc2 next-20220202] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch

[RFC PATCH] VMCI: dma dg: vmci_write_data() can be static

2022-02-02 Thread kernel test robot
drivers/misc/vmw_vmci/vmci_guest.c:118:5: warning: symbol 'vmci_write_data' was not declared. Should it be static? Reported-by: kernel test robot Signed-off-by: kernel test robot --- vmci_guest.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/misc/vmw_vmci/vmci_

Re: [PATCH 7/8] VMCI: dma dg: add support for DMA datagrams sends

2022-02-02 Thread kernel test robot
Hi Jorgen, I love your patch! Perhaps something to improve: [auto build test WARNING on char-misc/char-misc-testing] [also build test WARNING on linux/master linus/master v5.17-rc2 next-20220202] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch

Re: [PATCH 6/8] VMCI: dma dg: allocate send and receive buffers for DMA datagrams

2022-02-02 Thread kernel test robot
Hi Jorgen, I love your patch! Perhaps something to improve: [auto build test WARNING on char-misc/char-misc-testing] [also build test WARNING on linux/master linus/master v5.17-rc2 next-20220202] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch

Re: [PATCH 2/8] VMCI: dma dg: add MMIO access to registers

2022-02-02 Thread kernel test robot
Hi Jorgen, I love your patch! Perhaps something to improve: [auto build test WARNING on char-misc/char-misc-testing] [also build test WARNING on linux/master linus/master v5.17-rc2 next-20220202] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch

Re: [PATCH 2/8] VMCI: dma dg: add MMIO access to registers

2022-02-02 Thread kernel test robot
Hi Jorgen, I love your patch! Perhaps something to improve: [auto build test WARNING on char-misc/char-misc-testing] [also build test WARNING on linux/master linus/master v5.17-rc2 next-20220202] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch

[RFC PATCH] VMCI: dma dg: vmci_read_reg() can be static

2022-02-02 Thread kernel test robot
drivers/misc/vmw_vmci/vmci_guest.c:93:14: warning: symbol 'vmci_read_reg' was not declared. Should it be static? drivers/misc/vmw_vmci/vmci_guest.c:100:6: warning: symbol 'vmci_write_reg' was not declared. Should it be static? Reported-by: kernel test robot Signed-off-by: kernel test robot ---

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

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

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

2022-02-02 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: Mike

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

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

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

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

Re: [PATCH V6 01/10] Use copy_process in vhost layer

2022-02-02 Thread Mike Christie
On 1/18/22 1:12 PM, Eric W. Biederman wrote: > Mike Christie writes: > >> On 1/17/22 11:31 AM, Eric W. Biederman wrote: >>> Mike Christie writes: >>> On 12/22/21 12:24 PM, Eric W. Biederman wrote: > All I am certain of is that you need to set > "args->exit_signal = -1;". This preve

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

2022-02-02 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 5/8] fork: allow kernel code to call copy_process

2022-02-02 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 6/8] vhost_task: Allow vhost layer to use copy_process

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

[PATCH 0/8] Use copy_process in vhost layer

2022-02-02 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, etc

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

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

Re: [PATCH 7/8] VMCI: dma dg: add support for DMA datagrams sends

2022-02-02 Thread kernel test robot
Hi Jorgen, I love your patch! Perhaps something to improve: [auto build test WARNING on char-misc/char-misc-testing] [also build test WARNING on linux/master linus/master v5.17-rc2 next-20220202] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch

Re: [PATCH 2/8] VMCI: dma dg: add MMIO access to registers

2022-02-02 Thread kernel test robot
Hi Jorgen, I love your patch! Perhaps something to improve: [auto build test WARNING on char-misc/char-misc-testing] [also build test WARNING on linux/master linus/master v5.17-rc2 next-20220202] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch

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

2022-02-02 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 deletions(-

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

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

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

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

2022-02-02 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 | 64 +++--- 1 file changed, 12 insertions(+), 52

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

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

add a ->free_disk block_device_operation

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

[PATCH 8/8] VMCI: dma dg: add support for DMA datagrams receive

2022-02-02 Thread Jorgen Hansen
Use the DMA based receive operation instead of the ioread8_rep based datagram receive when DMA datagrams are supported. In the receive operation, configure the header to point to the page aligned VMCI_MAX_DG_SIZE part of the receive buffer using s/g configuration for the header. This ensures that

[PATCH 6/8] VMCI: dma dg: allocate send and receive buffers for DMA datagrams

2022-02-02 Thread Jorgen Hansen
If DMA datagrams are used, allocate send and receive buffers in coherent DMA memory. This is done in preparation for the send and receive datagram operations, where the buffers are used for the exchange of data between driver and device. Reviewed-by: Vishnu Dasa Signed-off-by: Jorgen Hansen ---

[PATCH 7/8] VMCI: dma dg: add support for DMA datagrams sends

2022-02-02 Thread Jorgen Hansen
Use DMA based send operation from the transmit buffer instead of the iowrite8_rep based datagram send when DMA datagrams are supported. The outgoing datagram is sent as inline data in the VMCI transmit buffer. Once the header has been configured, the send is initiated by writing the lower 32 bit o

[PATCH 5/8] VMCI: dma dg: register dummy IRQ handlers for DMA datagrams

2022-02-02 Thread Jorgen Hansen
Register dummy interrupt handlers for DMA datagrams in preparation for DMA datagram receive operations. Reviewed-by: Vishnu Dasa Signed-off-by: Jorgen Hansen --- drivers/misc/vmw_vmci/vmci_guest.c | 42 +++--- include/linux/vmw_vmci_defs.h | 14 -- 2 files c

[PATCH 3/8] VMCI: dma dg: detect DMA datagram capability

2022-02-02 Thread Jorgen Hansen
Detect the VMCI DMA datagram capability, and if present, ack it to the device. Reviewed-by: Vishnu Dasa Signed-off-by: Jorgen Hansen --- drivers/misc/vmw_vmci/vmci_guest.c | 11 +++ include/linux/vmw_vmci_defs.h | 1 + 2 files changed, 12 insertions(+) diff --git a/drivers/misc/v

[PATCH 4/8] VMCI: dma dg: set OS page size

2022-02-02 Thread Jorgen Hansen
Tell the device the page size used by the OS. Reviewed-by: Vishnu Dasa Signed-off-by: Jorgen Hansen --- drivers/misc/vmw_vmci/vmci_guest.c | 9 + include/linux/vmw_vmci_defs.h | 1 + 2 files changed, 10 insertions(+) diff --git a/drivers/misc/vmw_vmci/vmci_guest.c b/drivers/misc/

[PATCH 1/8] VMCI: dma dg: whitespace formatting change for vmci register defines

2022-02-02 Thread Jorgen Hansen
Update formatting of existing register defines in preparation for adding additional register definitions for the VMCI device. Reviewed-by: Vishnu Dasa Signed-off-by: Jorgen Hansen --- include/linux/vmw_vmci_defs.h | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --

[PATCH 2/8] VMCI: dma dg: add MMIO access to registers

2022-02-02 Thread Jorgen Hansen
Detect the support for MMIO access through examination of the length of the region requested in BAR1. If it is 256KB, the VMCI device supports MMIO access to registers. If MMIO access is supported, map the area of the region used for MMIO access (64KB size at offset 128KB). Add wrapper functions

[PATCH 0/8] VMCI: dma dg: Add support for DMA datagrams

2022-02-02 Thread Jorgen Hansen
A new version of the VMCI device will introduce two new major changes: - support MMIO access to device registers - support send/receive of datagrams using DMA transfers instead of ioread8_rep/iowrite8_rep operations This patch series updates the VMCI driver to support these new features while mai

Re: [PATCH v3] vhost: cache avail index in vhost_enable_notify()

2022-02-02 Thread Stefano Garzarella
On Wed, Feb 02, 2022 at 06:24:05AM -0500, Michael S. Tsirkin wrote: On Wed, Feb 02, 2022 at 11:14:30AM +, Stefan Hajnoczi wrote: On Fri, Jan 28, 2022 at 10:41:29AM +0100, Stefano Garzarella wrote: > In vhost_enable_notify() we enable the notifications and we read > the avail index to check i

Re: [PATCH v4 3/7] mm: page_isolation: check specified range for unmovable pages

2022-02-02 Thread David Hildenbrand
On 02.02.22 13:18, Oscar Salvador wrote: > On Wed, Jan 19, 2022 at 02:06:19PM -0500, Zi Yan wrote: >> From: Zi Yan >> >> Enable set_migratetype_isolate() to check specified sub-range for >> unmovable pages during isolation. Page isolation is done >> at max(MAX_ORDER_NR_PAEGS, pageblock_nr_pages) g

Re: [PATCH v3] vhost: cache avail index in vhost_enable_notify()

2022-02-02 Thread Michael S. Tsirkin
On Wed, Feb 02, 2022 at 11:14:30AM +, Stefan Hajnoczi wrote: > On Fri, Jan 28, 2022 at 10:41:29AM +0100, Stefano Garzarella wrote: > > In vhost_enable_notify() we enable the notifications and we read > > the avail index to check if new buffers have become available in > > the meantime. > > > >

Re: [PATCH v3] vhost: cache avail index in vhost_enable_notify()

2022-02-02 Thread Stefan Hajnoczi
On Fri, Jan 28, 2022 at 10:41:29AM +0100, Stefano Garzarella wrote: > In vhost_enable_notify() we enable the notifications and we read > the avail index to check if new buffers have become available in > the meantime. > > We do not update the cached avail index value, so when the device > will cal