Re: [PATCH V2] virtio-mmio: harden interrupt

2021-12-08 Thread Jason Wang
On Thu, Dec 9, 2021 at 2:55 PM Michael S. Tsirkin wrote: > > On Thu, Dec 09, 2021 at 10:06:34AM +0800, Jason Wang wrote: > > On Thu, Dec 9, 2021 at 4:27 AM Michael S. Tsirkin wrote: > > > > > > On Fri, Nov 26, 2021 at 12:41:02PM +0800, Jason Wang wrote: > > > > This patch tries to make sure the v

Re: [PATCH v1 1/7] vdpa: Provide interface to read driver features

2021-12-08 Thread Jason Wang
On Thu, Dec 9, 2021 at 3:07 PM Eli Cohen wrote: > > On Thu, Dec 09, 2021 at 01:33:01PM +0800, Jason Wang wrote: > > On Thu, Dec 9, 2021 at 4:14 AM Eli Cohen wrote: > > > > > > Provide an interface to read the negotiated features. This is needed > > > when building the netlink message in vdpa_dev_

Re: [PATCH v1 6/7] vdpa: Add support for querying control virtqueue index

2021-12-08 Thread Jason Wang
On Thu, Dec 9, 2021 at 3:09 PM Eli Cohen wrote: > > On Thu, Dec 09, 2021 at 01:44:56PM +0800, Jason Wang wrote: > > On Thu, Dec 9, 2021 at 4:15 AM Eli Cohen wrote: > > > > > > Add netlink attribute and callback function to query the control VQ > > > index of a device. > > > > > > Example: > > > >

Re: [PATCH V2] virtio-mmio: harden interrupt

2021-12-08 Thread Michael S. Tsirkin
On Thu, Dec 09, 2021 at 10:06:34AM +0800, Jason Wang wrote: > On Thu, Dec 9, 2021 at 4:27 AM Michael S. Tsirkin wrote: > > > > On Fri, Nov 26, 2021 at 12:41:02PM +0800, Jason Wang wrote: > > > This patch tries to make sure the virtio interrupt handler for MMIO > > > won't be called after a reset a

Re: [RFC PATCH] virtio: make sure legacy pci device gain 32bit-pfn vq

2021-12-08 Thread Michael S. Tsirkin
On Thu, Dec 09, 2021 at 11:00:55AM +0800, 王贇 wrote: > > > 在 2021/12/9 上午8:19, Michael S. Tsirkin 写道: > [snip] > > > > > > > > > > > > Hi, Michael > > > > > > > > > > Thanks for the comment, unfortunately modify device is not an option > > > > > for us > > > > > :-( > > > > > > > > > > Is ther

Re: [RFC PATCH] virtio: make sure legacy pci device gain 32bit-pfn vq

2021-12-08 Thread Michael S. Tsirkin
On Thu, Dec 09, 2021 at 11:21:36AM +0800, 王贇 wrote: > > > 在 2021/12/8 下午7:08, Michael S. Tsirkin 写道: > [snip] > > > > > > > > > > Hi, Michael > > > > > > > > > > Thanks for the comment, unfortunately modify device is not an option > > > > > for us > > > > > :-( > > > > > > > > > > Is there an

[PATCH 4/5] dax: remove the copy_from_iter and copy_to_iter methods

2021-12-08 Thread Christoph Hellwig
These methods indirect the actual DAX read/write path. In the end pmem uses magic flush and mc safe variants and fuse and dcssblk use plain ones while device mapper picks redirects to the underlying device. Add set_dax_virtual() and set_dax_nomcsafe() APIs for fuse to skip these special variants,

[PATCH 1/5] uio: remove copy_from_iter_flushcache() and copy_mc_to_iter()

2021-12-08 Thread Christoph Hellwig
These two wrappers are never used. Signed-off-by: Christoph Hellwig --- drivers/nvdimm/pmem.c | 4 ++-- include/linux/uio.h | 20 +--- 2 files changed, 3 insertions(+), 21 deletions(-) diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c index 4190c8c46ca88..8294f1c701b

[PATCH 3/5] dax: remove the DAXDEV_F_SYNC flag

2021-12-08 Thread Christoph Hellwig
Remove the DAXDEV_F_SYNC flag and thus the flags argument to alloc_dax and just let the drivers call set_dax_synchronous directly. Signed-off-by: Christoph Hellwig --- drivers/dax/bus.c| 3 ++- drivers/dax/super.c | 6 +- drivers/md/dm.c | 2 +- drivers/nvdi

[PATCH 5/5] dax: always use _copy_mc_to_iter in dax_copy_to_iter

2021-12-08 Thread Christoph Hellwig
While using the MC-safe copy routines is rather pointless on a virtual device like virtiofs, it also isn't harmful at all. So just use _copy_mc_to_iter unconditionally to simplify the code. Signed-off-by: Christoph Hellwig --- drivers/dax/super.c | 10 -- fs/fuse/virtio_fs.c | 1 - inc

devirtualize kernel access to DAX

2021-12-08 Thread Christoph Hellwig
Hi Dan, this series cleans up a few loose end ends and then removes the copy_from_iter and copy_to_iter dax_operations methods in favor of straight calls. Diffstat: drivers/dax/bus.c |3 + drivers/dax/super.c | 40 ++--- drivers/md/dm-linear.c|

[PATCH 2/5] dax: simplify dax_synchronous and set_dax_synchronous

2021-12-08 Thread Christoph Hellwig
Remove the pointless wrappers. Signed-off-by: Christoph Hellwig --- drivers/dax/super.c | 8 include/linux/dax.h | 12 ++-- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/drivers/dax/super.c b/drivers/dax/super.c index e7152a6c4cc40..e18155f43a635 100644 --- a/

Re: [PATCH v1 6/7] vdpa: Add support for querying control virtqueue index

2021-12-08 Thread Jason Wang
On Thu, Dec 9, 2021 at 4:15 AM Eli Cohen wrote: > > Add netlink attribute and callback function to query the control VQ > index of a device. > > Example: > > $ vdpa dev config show vdpa-a > vdpa-a: mac 00:00:00:00:88:88 link up link_announce false max_vq_pairs 5 \ > mtu 9000 ctrl_vq_idx 10 I

Re: [PATCH v1 5/7] vdpa/mlx5: Support configuring max data virtqueue pairs

2021-12-08 Thread Jason Wang
On Thu, Dec 9, 2021 at 4:15 AM Eli Cohen wrote: > > Check whether the max number of data virtqueue pairs was provided when a > adding a new device and verify the new value does not exceed device > capabilities. > > In addition, change the arrays holding virtqueue and callback contexts > to be dyna

Re: [PATCH v1 3/7] vdpa: Allow to configure max data virtqueues

2021-12-08 Thread Jason Wang
On Thu, Dec 9, 2021 at 8:25 AM Si-Wei Liu wrote: > > > > On 12/8/2021 12:14 PM, Eli Cohen wrote: > > Add netlink support to configure the max virtqueue pairs for a device. > > At least one pair is required. The maximum is dictated by the device. > > > > Example: > > > > $ vdpa dev add name vdpa-a

Re: [PATCH v1 1/7] vdpa: Provide interface to read driver features

2021-12-08 Thread Jason Wang
On Thu, Dec 9, 2021 at 4:14 AM Eli Cohen wrote: > > Provide an interface to read the negotiated features. This is needed > when building the netlink message in vdpa_dev_net_config_fill(). > > Also fix the implementation of vdpa_dev_net_config_fill() to use the > negotiated features instead of the

Re: [PATCH 2/2 v4] vdpa: check that offsets are within bounds

2021-12-08 Thread Jason Wang
On Wed, Dec 8, 2021 at 6:34 PM Dan Carpenter wrote: > > In this function "c->off" is a u32 and "size" is a long. On 64bit systems > if "c->off" is greater than "size" then "size - c->off" is a negative and > we always return -E2BIG. But on 32bit systems the subtraction is type > promoted to a hi

Re: [PATCH 1/2 v4] vduse: fix memory corruption in vduse_dev_ioctl()

2021-12-08 Thread Jason Wang
On Wed, Dec 8, 2021 at 6:33 PM Dan Carpenter wrote: > > The "config.offset" comes from the user. There needs to a check to > prevent it being out of bounds. The "config.offset" and > "dev->config_size" variables are both type u32. So if the offset if > out of bounds then the "dev->config_size -

Re: [PATCH V2] virtio-mmio: harden interrupt

2021-12-08 Thread Jason Wang
On Thu, Dec 9, 2021 at 4:27 AM Michael S. Tsirkin wrote: > > On Fri, Nov 26, 2021 at 12:41:02PM +0800, Jason Wang wrote: > > This patch tries to make sure the virtio interrupt handler for MMIO > > won't be called after a reset and before virtio_device_ready(). We > > can't use IRQF_NO_AUTOEN since

Re: [PATCH 5/7] vhost_vsock: simplify vhost_vsock_flush()

2021-12-08 Thread Jason Wang
On Thu, Dec 9, 2021 at 1:35 AM wrote: > > On 12/7/21 9:53 PM, Jason Wang wrote: > > On Tue, Dec 7, 2021 at 10:45 AM Mike Christie > > wrote: > >> > >> From: Andrey Ryabinin > >> > >> vhost_vsock_flush() calls vhost_work_dev_flush(vsock->vqs[i].poll.dev) > >> before vhost_work_dev_flush(&vsock->d

Re: [PATCH 6/7] vhost-scsi: drop flush after vhost_dev_cleanup

2021-12-08 Thread Jason Wang
On Thu, Dec 9, 2021 at 12:45 AM Mike Christie wrote: > > On 12/7/21 10:07 PM, Jason Wang wrote: > > On Tue, Dec 7, 2021 at 10:45 AM Mike Christie > > wrote: > >> > >> The flush after vhost_dev_cleanup is not needed because: > >> > >> 1. It doesn't do anything. vhost_dev_cleanup will stop the work

Re: [PATCH 1/7] vhost: get rid of vhost_poll_flush() wrapper

2021-12-08 Thread Jason Wang
On Thu, Dec 9, 2021 at 12:41 AM Mike Christie wrote: > > On 12/7/21 9:49 PM, Jason Wang wrote: > > On Tue, Dec 7, 2021 at 10:45 AM Mike Christie > > wrote: > >> > >> vhost_poll_flush() is a simple wrapper around vhost_work_dev_flush(). > >> It gives wrong impression that we are doing some work ov

Re: [PATCH v1 6/7] vdpa: Add support for querying control virtqueue index

2021-12-08 Thread Si-Wei Liu
On 12/8/2021 12:14 PM, Eli Cohen wrote: Add netlink attribute and callback function to query the control VQ index of a device. Example: $ vdpa dev config show vdpa-a vdpa-a: mac 00:00:00:00:88:88 link up link_announce false max_vq_pairs 5 \ mtu 9000 ctrl_vq_idx 10 First, I am not sure i

Re: [PATCH v1 3/7] vdpa: Allow to configure max data virtqueues

2021-12-08 Thread Si-Wei Liu
On 12/8/2021 12:14 PM, Eli Cohen wrote: Add netlink support to configure the max virtqueue pairs for a device. At least one pair is required. The maximum is dictated by the device. Example: $ vdpa dev add name vdpa-a mgmtdev auxiliary/mlx5_core.sf.1 max_vqp 5 Not this patch, but I think ther

Re: [RFC PATCH] virtio: make sure legacy pci device gain 32bit-pfn vq

2021-12-08 Thread Michael S. Tsirkin
On Wed, Dec 08, 2021 at 04:04:19PM +0800, 王贇 wrote: > > > 在 2021/12/8 下午3:23, Michael S. Tsirkin 写道: > > On Tue, Dec 07, 2021 at 05:09:56PM +0800, 王贇 wrote: > > > > > > > > > 在 2021/12/7 下午4:13, Michael S. Tsirkin 写道: > > > > On Tue, Dec 07, 2021 at 03:51:45PM +0800, 王贇 wrote: > > > > > We obse

Re: [PATCH v1 2/7] vdpa/mlx5: Distribute RX virtqueues in RQT object

2021-12-08 Thread Si-Wei Liu
On 12/8/2021 12:14 PM, Eli Cohen wrote: Distribute the available rx virtqueues amongst the available RQT entries. RQTs require to have a power of two entries. When creating or modifying the RQT, use the lowest number of power of two entries that is not less than the number of rx virtqueues. D

Re: [PATCH v1 1/7] vdpa: Provide interface to read driver features

2021-12-08 Thread Si-Wei Liu
On 12/8/2021 12:14 PM, Eli Cohen wrote: Provide an interface to read the negotiated features. This is needed when building the netlink message in vdpa_dev_net_config_fill(). Also fix the implementation of vdpa_dev_net_config_fill() to use the negotiated features instead of the device features

Re: [PATCH] eni_vdpa: alibaba: select VIRTIO_PCI_LIB

2021-12-08 Thread Michael S. Tsirkin
On Wed, Dec 08, 2021 at 10:31:03PM +0100, Arnd Bergmann wrote: > On Wed, Dec 8, 2021 at 8:56 PM Michael S. Tsirkin wrote: > > > > On Fri, Dec 03, 2021 at 07:55:14PM +0100, Arnd Bergmann wrote: > > > From: Arnd Bergmann > > > > > > When VIRTIO_PCI_LIB is not built-in but the alibaba driver is, the

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

2021-12-08 Thread michael . christie
On 12/8/21 2:34 PM, Michael S. Tsirkin wrote: > On Mon, Nov 29, 2021 at 01:46:57PM -0600, Mike Christie wrote: >> 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 ag

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

2021-12-08 Thread Michael S. Tsirkin
On Mon, Nov 29, 2021 at 01:46:57PM -0600, Mike Christie wrote: > 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 la

Re: [PATH v1 0/2] Support reading vendor statistics through iproute2/vdpa tool

2021-12-08 Thread Michael S. Tsirkin
On Wed, Nov 24, 2021 at 06:55:29PM +0200, Eli Cohen wrote: > The following patches add support for reading vdpa statistics > information from a vdpa instance using netlink messages. > > mlx5_vdpa is also implemented to provide that information. > > The supported statistics data are number of desc

Re: [PATCH V2] virtio-mmio: harden interrupt

2021-12-08 Thread Michael S. Tsirkin
On Fri, Nov 26, 2021 at 12:41:02PM +0800, Jason Wang wrote: > This patch tries to make sure the virtio interrupt handler for MMIO > won't be called after a reset and before virtio_device_ready(). We > can't use IRQF_NO_AUTOEN since we're using shared interrupt > (IRQF_SHARED). So this patch tracks

Re: [PATCH v3] i2c: virtio: fix completion handling

2021-12-08 Thread Michael S. Tsirkin
On Thu, Dec 02, 2021 at 04:32:14PM +0100, Vincent Whitchurch wrote: > The driver currently assumes that the notify callback is only received > when the device is done with all the queued buffers. > > However, this is not true, since the notify callback could be called > without any of the queued b

Re: [PATCH] eni_vdpa: alibaba: select VIRTIO_PCI_LIB

2021-12-08 Thread Michael S. Tsirkin
On Fri, Dec 03, 2021 at 07:55:14PM +0100, Arnd Bergmann wrote: > From: Arnd Bergmann > > When VIRTIO_PCI_LIB is not built-in but the alibaba driver is, the > kernel runs into a link error: > > x86_64-linux-ld: drivers/vdpa/alibaba/eni_vdpa.o: in function > `eni_vdpa_set_features': > eni_vdpa.c:

Re: [PATCH 5/7] vhost_vsock: simplify vhost_vsock_flush()

2021-12-08 Thread michael . christie
On 12/7/21 9:53 PM, Jason Wang wrote: > On Tue, Dec 7, 2021 at 10:45 AM Mike Christie > wrote: >> >> From: Andrey Ryabinin >> >> vhost_vsock_flush() calls vhost_work_dev_flush(vsock->vqs[i].poll.dev) >> before vhost_work_dev_flush(&vsock->dev). This seems pointless >> as vsock->vqs[i].poll.dev is

Re: [PATCH 6/7] vhost-scsi: drop flush after vhost_dev_cleanup

2021-12-08 Thread Mike Christie
On 12/7/21 10:07 PM, Jason Wang wrote: > On Tue, Dec 7, 2021 at 10:45 AM Mike Christie > wrote: >> >> The flush after vhost_dev_cleanup is not needed because: >> >> 1. It doesn't do anything. vhost_dev_cleanup will stop the worker thread >> so the flush call will just return since the worker has n

Re: [PATCH 1/7] vhost: get rid of vhost_poll_flush() wrapper

2021-12-08 Thread Mike Christie
On 12/7/21 9:49 PM, Jason Wang wrote: > On Tue, Dec 7, 2021 at 10:45 AM Mike Christie > wrote: >> >> vhost_poll_flush() is a simple wrapper around vhost_work_dev_flush(). >> It gives wrong impression that we are doing some work over vhost_poll, >> while in fact it flushes vhost_poll->dev. > > Thi

[PATCH] vduse: check that offset is within bounds in get_config()

2021-12-08 Thread Dan Carpenter
This condition checks "len" but it does not check "offset" and that could result in an out of bounds read if "offset > dev->config_size". The problem is that since both variables are unsigned the "dev->config_size - offset" subtraction would result in a very high unsigned value. I think these chec

Re: [RFC PATCH] virtio: make sure legacy pci device gain 32bit-pfn vq

2021-12-08 Thread Michael S. Tsirkin
On Wed, Dec 08, 2021 at 04:04:19PM +0800, 王贇 wrote: > > > 在 2021/12/8 下午3:23, Michael S. Tsirkin 写道: > > On Tue, Dec 07, 2021 at 05:09:56PM +0800, 王贇 wrote: > > > > > > > > > 在 2021/12/7 下午4:13, Michael S. Tsirkin 写道: > > > > On Tue, Dec 07, 2021 at 03:51:45PM +0800, 王贇 wrote: > > > > > We obse

[PATCH 2/2 v4] vdpa: check that offsets are within bounds

2021-12-08 Thread Dan Carpenter
In this function "c->off" is a u32 and "size" is a long. On 64bit systems if "c->off" is greater than "size" then "size - c->off" is a negative and we always return -E2BIG. But on 32bit systems the subtraction is type promoted to a high positive u32 value and basically any "c->len" is accepted.

[PATCH 1/2 v4] vduse: fix memory corruption in vduse_dev_ioctl()

2021-12-08 Thread Dan Carpenter
The "config.offset" comes from the user. There needs to a check to prevent it being out of bounds. The "config.offset" and "dev->config_size" variables are both type u32. So if the offset if out of bounds then the "dev->config_size - config.offset" subtraction results in a very high u32 value.

Re: [PATCH] drm: Return error codes from struct drm_driver.gem_create_object

2021-12-08 Thread Thomas Zimmermann
Hi Am 07.12.21 um 10:24 schrieb Thomas Zimmermann: Hi Am 07.12.21 um 09:55 schrieb Dan Carpenter: I appologize.  This thread has been really frustrating.  I got mixed up because I recently sent patches for ingenic and vc4.  Also we are working against different trees so maybe that is part of t