Re: [PATCH v5 3/4] drivers/net/virtio_net: Added RSS hash report.

2022-08-11 Thread Michael S. Tsirkin
On Mon, Mar 28, 2022 at 08:53:35PM +0300, Andrew Melnychenko wrote: > +static void virtio_skb_set_hash(const struct virtio_net_hdr_v1_hash > *hdr_hash, > + struct sk_buff *skb) > +{ > + enum pkt_hash_types rss_hash_type; > + > + if (!hdr_hash || !skb) > +

[bug report] vdpa/mlx5: Support different address spaces for control and data

2022-08-11 Thread Dan Carpenter
Hello Eli Cohen, The patch d5358cd0e369: "vdpa/mlx5: Support different address spaces for control and data" from Jul 14, 2022, leads to the following Smatch static checker warning: drivers/vdpa/mlx5/net/mlx5_vnet.c:2676 mlx5_vdpa_set_map() error: uninitialized symbol 'err'.

Re: [PATCH] virtio_bt: Fix alignment in configuration struct

2022-08-11 Thread Michael S. Tsirkin
On Mon, Aug 08, 2022 at 08:16:11AM -0400, Michael S. Tsirkin wrote: > On Mon, Aug 08, 2022 at 02:04:43PM +0200, Igor Skalkin wrote: > > On 8/8/22 01:00, Michael S. Tsirkin wrote: > > > > On Mon, Aug 08, 2022 at 12:11:52AM +0200, Igor Skalkin wrote: > > > > According to specification

Re: [PATCH vhost 0/2] virtio_net: fix for stuck when change ring size with dev down

2022-08-11 Thread Xuan Zhuo
On Thu, 11 Aug 2022 04:11:22 -0400, "Michael S. Tsirkin" wrote: > On Thu, Aug 11, 2022 at 04:02:56PM +0800, Xuan Zhuo wrote: > > When dev is set to DOWN state, napi has been disabled, if we modify the > > ring size at this time, we should not call napi_disable() again, which > > will cause

Re: [PATCH v7 3/4] vhost-vdpa: uAPI to suspend the device

2022-08-11 Thread Michael S. Tsirkin
On Wed, Aug 10, 2022 at 07:15:11PM +0200, Eugenio Pérez wrote: > The ioctl adds support for suspending the device from userspace. > > This is a must before getting virtqueue indexes (base) for live migration, > since the device could modify them after userland gets them. There are > individual

[PATCH 1/2] virtio_net: fix for stuck when change rx ring size with dev down

2022-08-11 Thread Xuan Zhuo
When dev is set to DOWN state, napi has been disabled, if we modify the ring size at this time, we should not call napi_disable() again, which will cause stuck. And all operations are under the protection of rtnl_lock, so there is no need to consider concurrency issues. Reported-by: Kangjie Xu

[PATCH vhost 0/2] virtio_net: fix for stuck when change ring size with dev down

2022-08-11 Thread Xuan Zhuo
When dev is set to DOWN state, napi has been disabled, if we modify the ring size at this time, we should not call napi_disable() again, which will cause stuck. And all operations are under the protection of rtnl_lock, so there is no need to consider concurrency issues. PS. Hi Michael, I don't

[PATCH 2/2] virtio_net: fix for stuck when change tx ring size with dev down

2022-08-11 Thread Xuan Zhuo
When dev is set to DOWN state, napi has been disabled, if we modify the ring size at this time, we should not call napi_disable() again, which will cause stuck. And all operations are under the protection of rtnl_lock, so there is no need to consider concurrency issues. Reported-by: Kangjie Xu

Re: [PATCH v7 1/4] vdpa: Add suspend operation

2022-08-11 Thread Michael S. Tsirkin
On Wed, Aug 10, 2022 at 07:15:09PM +0200, Eugenio Pérez wrote: > This operation is optional: It it's not implemented, backend feature bit > will not be exposed. > > Signed-off-by: Eugenio Pérez > Message-Id: <20220623160738.632852-2-epere...@redhat.com> > Signed-off-by: Michael S. Tsirkin What

Re: [PATCH vhost 0/2] virtio_net: fix for stuck when change ring size with dev down

2022-08-11 Thread Michael S. Tsirkin
On Thu, Aug 11, 2022 at 04:02:56PM +0800, Xuan Zhuo wrote: > When dev is set to DOWN state, napi has been disabled, if we modify the > ring size at this time, we should not call napi_disable() again, which > will cause stuck. > > And all operations are under the protection of rtnl_lock, so there

[PATCH v3 0/4] vdpa_sim_blk: add support for flush, discard, and write-zeroes

2022-08-11 Thread Stefano Garzarella
The first 2 patches are in preparation and generalize parts later used by the following patches that add handling of flush, discard, and write-zeroes requests. v3: - fixed clang issue reported by kernel test robot - used le*_to_cpu() to access virtio_blk_discard_write_zeroes fields v2:

[PATCH v3 2/4] vdpa_sim_blk: make vdpasim_blk_check_range usable by other requests

2022-08-11 Thread Stefano Garzarella
Next patches will add handling of other requests, where will be useful to reuse vdpasim_blk_check_range(). So let's make it more generic by adding the `max_sectors` parameter, since different requests allow different numbers of maximum sectors. Let's also print the messages directly in

[PATCH v3 1/4] vdpa_sim_blk: check if sector is 0 for commands other than read or write

2022-08-11 Thread Stefano Garzarella
VIRTIO spec states: "The sector number indicates the offset (multiplied by 512) where the read or write is to occur. This field is unused and set to 0 for commands other than read or write." Signed-off-by: Stefano Garzarella --- drivers/vdpa/vdpa_sim/vdpa_sim_blk.c | 10 ++ 1 file

[PATCH v3 4/4] vdpa_sim_blk: add support for discard and write-zeroes

2022-08-11 Thread Stefano Garzarella
Expose VIRTIO_BLK_F_DISCARD and VIRTIO_BLK_F_WRITE_ZEROES features to the drivers and handle VIRTIO_BLK_T_DISCARD and VIRTIO_BLK_T_WRITE_ZEROES requests checking ranges and flags. The simulator behaves like a ramdisk, so for VIRTIO_BLK_F_DISCARD does nothing, while for VIRTIO_BLK_T_WRITE_ZEROES

[PATCH v3 3/4] vdpa_sim_blk: add support for VIRTIO_BLK_T_FLUSH

2022-08-11 Thread Stefano Garzarella
The simulator behaves like a ramdisk, so we don't have to do anything when a VIRTIO_BLK_T_FLUSH request is received, but it could be useful to test driver behavior. Let's expose the VIRTIO_BLK_F_FLUSH feature to inform the driver that we support the flush command. Signed-off-by: Stefano

[PATCH] vdpa: fix warning casts when building with C=2

2022-08-11 Thread Stefano Garzarella
Use __virtio16_to_cpu() to read `max_virtqueue_pairs` field in virtio_net_config since its type is __virtio16. This silences the following warning when building with `make C=2`: ../drivers/vdpa/vdpa.c:811:19: warning: cast to restricted __le16 ../drivers/vdpa/vdpa.c:811:19: warning: cast

Re: [PATCH v7 1/4] vdpa: Add suspend operation

2022-08-11 Thread Dan Carpenter
On Thu, Aug 11, 2022 at 04:27:32AM -0400, Michael S. Tsirkin wrote: > On Wed, Aug 10, 2022 at 07:15:09PM +0200, Eugenio Pérez wrote: > > This operation is optional: It it's not implemented, backend feature bit > > will not be exposed. > > > > Signed-off-by: Eugenio Pérez > > Message-Id:

Re: [PATCH v7 1/4] vdpa: Add suspend operation

2022-08-11 Thread Michael S. Tsirkin
On Thu, Aug 11, 2022 at 01:15:08PM +0300, Dan Carpenter wrote: > On Thu, Aug 11, 2022 at 04:27:32AM -0400, Michael S. Tsirkin wrote: > > On Wed, Aug 10, 2022 at 07:15:09PM +0200, Eugenio Pérez wrote: > > > This operation is optional: It it's not implemented, backend feature bit > > > will not be

Re: [bug report] vdpa/mlx5: Support different address spaces for control and data

2022-08-11 Thread Michael S. Tsirkin
On Thu, Aug 11, 2022 at 01:11:11PM +, Eli Cohen wrote: > > From: Michael S. Tsirkin > > Sent: Thursday, August 11, 2022 4:09 PM > > To: Eli Cohen > > Cc: Dan Carpenter ; Jason Wang > > ; Eugenio Perez Martin > > ; virtualization@lists.linux-foundation.org > > Subject: Re: [bug report]

Re: [PATCH v7 1/4] vdpa: Add suspend operation

2022-08-11 Thread Dan Carpenter
On Thu, Aug 11, 2022 at 07:23:44AM -0400, Michael S. Tsirkin wrote: > On Thu, Aug 11, 2022 at 01:15:08PM +0300, Dan Carpenter wrote: > > On Thu, Aug 11, 2022 at 04:27:32AM -0400, Michael S. Tsirkin wrote: > > > On Wed, Aug 10, 2022 at 07:15:09PM +0200, Eugenio Pérez wrote: > > > > This operation

Re: [PATCH v4 1/2] virtio: kerneldocs fixes and enhancements

2022-08-11 Thread Cornelia Huck
On Wed, Aug 10 2022, Ricardo Cañuelo wrote: > Fix variable names in some kerneldocs, naming in others. > Add kerneldocs for struct vring_desc and vring_interrupt. > > Signed-off-by: Ricardo Cañuelo > --- > drivers/virtio/virtio_ring.c | 8 > include/linux/virtio.h | 6

[PATCH] virtio_net: fix endian-ness for RSS

2022-08-11 Thread Michael S. Tsirkin
Using native endian-ness for device supplied fields is wrong on BE platforms. Sparse warns about this. Fixes: 91f41f01d219 ("drivers/net/virtio_net: Added RSS hash report.") Cc: "Andrew Melnychenko" Signed-off-by: Michael S. Tsirkin --- drivers/net/virtio_net.c | 4 ++-- 1 file changed, 2

Re: [bug report] vdpa/mlx5: Support different address spaces for control and data

2022-08-11 Thread Michael S. Tsirkin
On Thu, Aug 11, 2022 at 12:40:09PM +, Eli Cohen wrote: > > From: Dan Carpenter > > Sent: Thursday, August 11, 2022 1:40 PM > > To: Eli Cohen > > Cc: virtualization@lists.linux-foundation.org > > Subject: [bug report] vdpa/mlx5: Support different address spaces for > > control and data > >

Re: [bug report] vdpa/mlx5: Support different address spaces for control and data

2022-08-11 Thread Michael S. Tsirkin
On Thu, Aug 11, 2022 at 12:40:09PM +, Eli Cohen wrote: > > From: Dan Carpenter > > Sent: Thursday, August 11, 2022 1:40 PM > > To: Eli Cohen > > Cc: virtualization@lists.linux-foundation.org > > Subject: [bug report] vdpa/mlx5: Support different address spaces for > > control and data > >

Re: [PATCH v4 2/2] docs: driver-api: virtio: virtio on Linux

2022-08-11 Thread Michael S. Tsirkin
On Thu, Aug 11, 2022 at 03:46:46PM +0200, Cornelia Huck wrote: > On Wed, Aug 10 2022, Ricardo Cañuelo wrote: > > > Basic doc about Virtio on Linux and a short tutorial on Virtio drivers. > > > > Signed-off-by: Ricardo Cañuelo > > --- > > Documentation/driver-api/index.rst| 1 + >

Re: [PATCH v4 2/2] docs: driver-api: virtio: virtio on Linux

2022-08-11 Thread Michael S. Tsirkin
On Wed, Aug 10, 2022 at 11:40:04AM +0200, Ricardo Cañuelo wrote: > Basic doc about Virtio on Linux and a short tutorial on Virtio drivers. > > Signed-off-by: Ricardo Cañuelo which tree is this for? Applying: docs: driver-api: virtio: virtio on Linux error: sha1 information is lacking or

Re: [PATCH v4 2/2] docs: driver-api: virtio: virtio on Linux

2022-08-11 Thread Cornelia Huck
On Wed, Aug 10 2022, Ricardo Cañuelo wrote: > Basic doc about Virtio on Linux and a short tutorial on Virtio drivers. > > Signed-off-by: Ricardo Cañuelo > --- > Documentation/driver-api/index.rst| 1 + > Documentation/driver-api/virtio/index.rst | 11 ++ >

Re: [PATCH v8 0/3] Implement vdpasim suspend operation

2022-08-11 Thread Michael S. Tsirkin
On Thu, Aug 11, 2022 at 03:53:50PM +0200, Eugenio Pérez wrote: > Implement suspend operation for vdpa_sim devices, so vhost-vdpa will offer > that backend feature and userspace can effectively suspend the device. > > This is a must before getting virtqueue indexes (base) for live migration, >

Re: [PATCH v4 2/2] docs: driver-api: virtio: virtio on Linux

2022-08-11 Thread Ricardo Cañuelo
Hi Michael, thanks for reviewing: On jue, ago 11 2022 at 09:32:05, "Michael S. Tsirkin" wrote: > which tree is this for? > > Applying: docs: driver-api: virtio: virtio on Linux > error: sha1 information is lacking or useless (MAINTAINERS). > error: could not build fake ancestor > Patch failed at

Re: build failure of next-20220811 due to d79b32c2e4a4 ("vdpa_sim_blk: add support for discard and write-zeroes")

2022-08-11 Thread Stefano Garzarella
Hi Sudip, On Thu, Aug 11, 2022 at 06:22:54PM +0100, Sudip Mukherjee (Codethink) wrote: Hi All, Not sure if it has been reported, builds of arm64 with clang failed to build next-20220811 with the error: drivers/vdpa/vdpa_sim/vdpa_sim_blk.c:201:3: error: expected expression

Re: [PATCH v2] virtio-blk: Avoid use-after-free on suspend/resume

2022-08-11 Thread Jens Axboe
On 8/10/22 10:09 AM, Shigeru Yoshida wrote: > +static inline struct virtio_blk_vq *get_virtio_blk_vq(struct blk_mq_hw_ctx > *hctx) > +{ > + struct virtio_blk *vblk = hctx->queue->queuedata; > + struct virtio_blk_vq *vq = >vqs[hctx->queue_num]; > + > + return vq; > +} Would probably

Re: build failure of next-20220811 due to d79b32c2e4a4 ("vdpa_sim_blk: add support for discard and write-zeroes")

2022-08-11 Thread Stefano Garzarella
On Thu, Aug 11, 2022 at 11:31:21AM -0700, Nathan Chancellor wrote: On Thu, Aug 11, 2022 at 06:22:54PM +0100, Sudip Mukherjee (Codethink) wrote: Hi All, Not sure if it has been reported, builds of arm64 with clang failed to build next-20220811 with the error: drivers/vdpa/vdpa_sim

build failure of next-20220811 due to d79b32c2e4a4 ("vdpa_sim_blk: add support for discard and write-zeroes")

2022-08-11 Thread Sudip Mukherjee (Codethink)
Hi All, Not sure if it has been reported, builds of arm64 with clang failed to build next-20220811 with the error: drivers/vdpa/vdpa_sim/vdpa_sim_blk.c:201:3: error: expected expression struct virtio_blk_discard_write_zeroes range; ^ drivers/vdpa/vdpa_sim

Re: [PATCH v2] virtio-blk: Avoid use-after-free on suspend/resume

2022-08-11 Thread Stefan Hajnoczi
On Thu, Aug 11, 2022 at 01:09:48AM +0900, Shigeru Yoshida wrote: > hctx->user_data is set to vq in virtblk_init_hctx(). However, vq is > freed on suspend and reallocated on resume. So, hctx->user_data is > invalid after resume, and it will cause use-after-free accessing which > will result in

Re: [PATCH vhost 0/2] virtio_net: fix for stuck when change ring size with dev down

2022-08-11 Thread Xuan Zhuo
On Thu, 11 Aug 2022 10:37:30 -0700, Jakub Kicinski wrote: > On Thu, 11 Aug 2022 04:11:22 -0400 Michael S. Tsirkin wrote: > > Which patches does this fix? > > Maybe I should squash. > > Side question to make sure I understand the terminology - this > is *not* a vhost patch, right? vhost is the