Re: IOTLB support for vhost/vsock breaks crosvm on Android

2022-08-08 Thread Jason Wang
On Mon, Aug 8, 2022 at 8:45 PM Michael S. Tsirkin wrote: > > On Mon, Aug 08, 2022 at 11:18:50AM +0100, Will Deacon wrote: > > Hi Michael, > > > > On Sun, Aug 07, 2022 at 09:14:43AM -0400, Michael S. Tsirkin wrote: > > > Will, thanks very much for the analysis and the writeup! > > > > No problem,

Re: IOTLB support for vhost/vsock breaks crosvm on Android

2022-08-08 Thread Jason Wang
On Sun, Aug 7, 2022 at 9:14 PM Michael S. Tsirkin wrote: > > Will, thanks very much for the analysis and the writeup! > > On Fri, Aug 05, 2022 at 07:11:06PM +0100, Will Deacon wrote: > > So how should we fix this? One possibility is for us to hack crosvm to > > clear the VIRTIO_F_ACCESS_PLATFORM

Re: [virtio-dev] [PATCH] virtio-net: use mtu size as buffer length for big packets

2022-08-08 Thread Si-Wei Liu
On 8/8/2022 12:31 AM, Gavin Li wrote: On 8/6/2022 6:11 AM, Si-Wei Liu wrote: External email: Use caution opening links or attachments On 8/1/2022 9:45 PM, Gavin Li wrote: Currently add_recvbuf_big() allocates MAX_SKB_FRAGS segments for big packets even when GUEST_* offloads are not

Re: [PATCH v2 00/14] drm/format-helper: Move to struct iosys_map

2022-08-08 Thread Noralf Trønnes
Den 08.08.2022 14.53, skrev Thomas Zimmermann: > Change format-conversion helpers to use struct iosys_map for source > and destination buffers. Update all users. Also prepare interface for > multi-plane color formats. > > The format-conversion helpers mostly used to convert to I/O memory > or

Re: [PATCH v2 00/14] drm/format-helper: Move to struct iosys_map

2022-08-08 Thread Sam Ravnborg
Hi Thomas, On Mon, Aug 08, 2022 at 02:53:52PM +0200, Thomas Zimmermann wrote: > Change format-conversion helpers to use struct iosys_map for source > and destination buffers. Update all users. Also prepare interface for > multi-plane color formats. > > The format-conversion helpers mostly used

Re: [PATCH v2 14/14] drm/format-helper: Rename parameter vmap to src

2022-08-08 Thread Sam Ravnborg
Hi Thomas, On Mon, Aug 08, 2022 at 02:54:06PM +0200, Thomas Zimmermann wrote: > The name the parameter vmap to src in all functions. The parameter > contains the locations of the source data and the new name says that. > > Signed-off-by: Thomas Zimmermann Thanks, this helped in readability!

Re: [PATCH v2 13/14] drm/format-helper: Move destination-buffer handling into internal helper

2022-08-08 Thread Sam Ravnborg
Hi Thomas, On Mon, Aug 08, 2022 at 02:54:05PM +0200, Thomas Zimmermann wrote: > The format-convertion helpers handle several cases for different > values of destination buffer and pitch. Move that code into the > internal helper drm_fb_xfrm() and avoid quite a bit of duplication. > > v2: >

Re: [PATCH v2 04/14] drm/format-helper: Convert drm_fb_swab() to struct iosys_map

2022-08-08 Thread Sam Ravnborg
Hi Thomas, On Mon, Aug 08, 2022 at 02:53:56PM +0200, Thomas Zimmermann wrote: > Convert drm_fb_swab() to use struct iosys_map() and convert users. The > new interface supports multi-plane color formats, but implementation > only supports a single plane for now. > > v2: > * use

Re: [PATCH v2 03/14] drm/format-helper: Merge drm_fb_memcpy() and drm_fb_memcpy_toio()

2022-08-08 Thread Sam Ravnborg
Hi Thomas, On Mon, Aug 08, 2022 at 02:53:55PM +0200, Thomas Zimmermann wrote: > Merge drm_fb_memcpy() and drm_fb_memcpy_toio() into a drm_fb_memcpy() > that uses struct iosys_map for buffers. The new function also supports > multi-plane color formats. Convert all users of the original helpers. >

Re: [PATCH v2 01/14] iosys-map: Add IOSYS_MAP_INIT_VADDR_IOMEM()

2022-08-08 Thread Sam Ravnborg
On Mon, Aug 08, 2022 at 02:53:53PM +0200, Thomas Zimmermann wrote: > Add IOSYS_MAP_INIT_VADDR_IOMEM() for static init of variables of type > struct iosys_map. > > Signed-off-by: Thomas Zimmermann Reviewed-by: Sam Ravnborg > --- > include/linux/iosys-map.h | 15 ++- > 1 file

Re: [PATCH 12/12] drm/format-helper: Move destination-buffer handling into internal helper

2022-08-08 Thread Sam Ravnborg
Hi Thomas, > > > - static const unsigned int default_dst_pitch[DRM_FORMAT_MAX_PLANES] = { > > > - 0, 0, 0, 0 > > > - }; > > > const struct drm_format_info *format = fb->format; > > > - u8 cpp = format->cpp[0]; > > > void (*swab_line)(void *dbuf, const void *sbuf,

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

2022-08-08 Thread Cornelia Huck
On Thu, Aug 04 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 + >

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

2022-08-08 Thread Ricardo Cañuelo
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 + Documentation/driver-api/virtio/virtio.rst| 151 ++

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

2022-08-08 Thread Ricardo Cañuelo
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 +++--- include/linux/virtio_config.h| 6 +++---

[PATCH v3 0/2] docs: driver-api: virtio: virtio on Linux

2022-08-08 Thread Ricardo Cañuelo
Basic documentation about virtio in the kernel and a small tutorial for virtio drivers. Tested on linux-next (next-20220802) Changes in v3: - fix commit message in patch 1 - minor additional fixes to virtio kerneldocs - use proper Sphinx markup for links to references Changes in v2: -

[PATCH v2 13/14] drm/format-helper: Move destination-buffer handling into internal helper

2022-08-08 Thread Thomas Zimmermann
The format-convertion helpers handle several cases for different values of destination buffer and pitch. Move that code into the internal helper drm_fb_xfrm() and avoid quite a bit of duplication. v2: * remove a duplicated blank line (Jose) * use drm_format_info_bpp() (Sam)

[PATCH v2 14/14] drm/format-helper: Rename parameter vmap to src

2022-08-08 Thread Thomas Zimmermann
The name the parameter vmap to src in all functions. The parameter contains the locations of the source data and the new name says that. Signed-off-by: Thomas Zimmermann --- drivers/gpu/drm/drm_format_helper.c | 106 ++-- include/drm/drm_format_helper.h | 18 ++---

[PATCH v2 04/14] drm/format-helper: Convert drm_fb_swab() to struct iosys_map

2022-08-08 Thread Thomas Zimmermann
Convert drm_fb_swab() to use struct iosys_map() and convert users. The new interface supports multi-plane color formats, but implementation only supports a single plane for now. v2: * use drm_format_info_bpp() (Sam) * update documentation (Sam) * add TODO on vaddr location

[PATCH v2 10/14] drm/format-helper: Rework XRGB8888-to-XRGB2101010 conversion

2022-08-08 Thread Thomas Zimmermann
Update XRGB-to-XRGB2101010 conversion to support struct iosys_map and convert all users. Although these are single-plane color formats, the new interface supports multi-plane formats for consistency with drm_fb_blit(). v2: * update documentation (Sam) * add TODO on vaddr

[PATCH v2 01/14] iosys-map: Add IOSYS_MAP_INIT_VADDR_IOMEM()

2022-08-08 Thread Thomas Zimmermann
Add IOSYS_MAP_INIT_VADDR_IOMEM() for static init of variables of type struct iosys_map. Signed-off-by: Thomas Zimmermann --- include/linux/iosys-map.h | 15 ++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/include/linux/iosys-map.h b/include/linux/iosys-map.h index

[PATCH v2 12/14] drm/format-helper: Rework XRGB8888-to-MONO conversion

2022-08-08 Thread Thomas Zimmermann
Update XRGB-to-MONO conversion to support struct iosys_map and convert all users. Although these are single-plane color formats, the new interface supports multi-plane formats for consistency with drm_fb_blit(). v2: * rebase after renaming CMA helpers to DMA helpers * update

[PATCH v2 09/14] drm/format-helper: Rework RGB888-to-XRGB8888 conversion

2022-08-08 Thread Thomas Zimmermann
Update RGB888-to-XRGB conversion to support struct iosys_map and convert all users. Although these are single-plane color formats, the new interface supports multi-plane formats for consistency with drm_fb_blit(). v2: * add TODO on vaddr location (Sam) Signed-off-by: Thomas

[PATCH v2 11/14] drm/format-helper: Rework XRGB8888-to-GRAY8 conversion

2022-08-08 Thread Thomas Zimmermann
Update XRGB-to-GRAY8 conversion to support struct iosys_map and convert all users. Although these are single-plane color formats, the new interface supports multi-plane formats for consistency with drm_fb_blit(). v2: * update documentation (Sam) * add TODO on vaddr location

[PATCH v2 06/14] drm/format-helper: Rework XRGB8888-to-RGBG565 conversion

2022-08-08 Thread Thomas Zimmermann
Update XRGB-to-RGB565 conversion to support struct iosys_map and convert all users. Although these are single-plane color formats, the new interface supports multi-plane formats for consistency with drm_fb_blit(). v2: * update new Kunit tests * update documentation (Sam)

[PATCH v2 08/14] drm/format-helper: Rework RGB565-to-XRGB8888 conversion

2022-08-08 Thread Thomas Zimmermann
Update RGB565-to-XRGB conversion to support struct iosys_map and convert all users. Although these are single-plane color formats, the new interface supports multi-plane formats for consistency with drm_fb_blit(). v2: * add TODO on vaddr location (Sam) Signed-off-by: Thomas

[PATCH v2 05/14] drm/format-helper: Rework XRGB8888-to-RGBG332 conversion

2022-08-08 Thread Thomas Zimmermann
Update XRGB-to-RGB332 conversion to support struct iosys_map and convert all users. Although these are single-plane color formats, the new interface supports multi-plane formats for consistency with drm_fb_blit(). v2: * rebase onto refactored Kunit tests * update documentation

[PATCH v2 07/14] drm/format-helper: Rework XRGB8888-to-RGB888 conversion

2022-08-08 Thread Thomas Zimmermann
Update XRGB-to-RGB888 conversion to support struct iosys_map and convert all users. Although these are single-plane color formats, the new interface supports multi-plane formats for consistency with drm_fb_blit(). v2: * update documentation (Sam) * add TODO on vaddr location

[PATCH v2 03/14] drm/format-helper: Merge drm_fb_memcpy() and drm_fb_memcpy_toio()

2022-08-08 Thread Thomas Zimmermann
Merge drm_fb_memcpy() and drm_fb_memcpy_toio() into a drm_fb_memcpy() that uses struct iosys_map for buffers. The new function also supports multi-plane color formats. Convert all users of the original helpers. v2: * rebase onto refactored mgag200 * use drm_formap_info_bpp() (Sam)

[PATCH v2 02/14] drm/format-helper: Provide drm_fb_blit()

2022-08-08 Thread Thomas Zimmermann
Provide drm_fb_blit() that works with struct iosys_map. Update all users of drm_fb_blit_toio(), which required a destination buffer in I/O memory. This patch only updates the function's interface. The implementation still relies on the destination buffer to be located in I/O memory. See the

[PATCH v2 00/14] drm/format-helper: Move to struct iosys_map

2022-08-08 Thread Thomas Zimmermann
Change format-conversion helpers to use struct iosys_map for source and destination buffers. Update all users. Also prepare interface for multi-plane color formats. The format-conversion helpers mostly used to convert to I/O memory or system memory. To actual memory type depended on the usecase.

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

2022-08-08 Thread Ricardo Cañuelo
Hi Cornelia, thanks for the review: On lun, ago 08 2022 at 14:14:07, Cornelia Huck wrote: > Isn't that "kerneldoc"? But maybe I'm a bit behind on the current > terminology. Ugh what a silly slip. You're totally right, I got kerneldocs and htmldocs mixed in my head after so many "make htmldocs"

Re: IOTLB support for vhost/vsock breaks crosvm on Android

2022-08-08 Thread Michael S. Tsirkin
On Mon, Aug 08, 2022 at 11:18:50AM +0100, Will Deacon wrote: > Hi Michael, > > On Sun, Aug 07, 2022 at 09:14:43AM -0400, Michael S. Tsirkin wrote: > > Will, thanks very much for the analysis and the writeup! > > No problem, and thanks for following up. > > > On Fri, Aug 05, 2022 at 07:11:06PM

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

2022-08-08 Thread Michael S. Tsirkin
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 [1], "For the device-specific configuration > space, the driver MUST use

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

2022-08-08 Thread Cornelia Huck
On Thu, Aug 04 2022, Ricardo Cañuelo wrote: > Fix variable names in some htmldocs, naming in others. > Add htmldocs for struct vring_desc and vring_interrupt. Isn't that "kerneldoc"? But maybe I'm a bit behind on the current terminology. > > Signed-off-by: Ricardo Cañuelo > --- >

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

2022-08-08 Thread Igor Skalkin
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 [1], "For the device-specific configuration space, the driver MUST use 8 bit wide accesses for 8 bit wide fields, 16 bit wide and aligned accesses for 16 bit wide

Re: [PATCH 02/12] drm/format-helper: Merge drm_fb_memcpy() and drm_fb_memcpy_toio()

2022-08-08 Thread Thomas Zimmermann
Hi Sam, thanks for reviewing the patchset. Am 04.08.22 um 21:52 schrieb Sam Ravnborg: Hi Thomas, On Wed, Jul 27, 2022 at 01:33:02PM +0200, Thomas Zimmermann wrote: Merge drm_fb_memcpy() and drm_fb_memcpy() into drm_fb_memcpy() that One of these is drm_fb_memcpy_toio() I had to laugh when

Re: [PATCH 12/12] drm/format-helper: Move destination-buffer handling into internal helper

2022-08-08 Thread Thomas Zimmermann
Hi Sam Am 05.08.22 um 19:52 schrieb Sam Ravnborg: Hi Thomas, On Wed, Jul 27, 2022 at 01:33:12PM +0200, Thomas Zimmermann wrote: The format-convertion helpers handle several cases for different values of destination buffer and pitch. Move that code into the internal helper drm_fb_xfrm() and

Re: [RFC PATCH v3 0/9] vsock: updates for SO_RCVLOWAT handling

2022-08-08 Thread Stefano Garzarella
Hi Arseniy, On Wed, Aug 03, 2022 at 01:48:06PM +, Arseniy Krasnov wrote: Hello, This patchset includes some updates for SO_RCVLOWAT: I have reviewed all the patches, run tests and everything seems okay :-) I left some minor comments and asked Bryan and Vishnu to take a better look at

Re: [RFC PATCH v3 9/9] vsock_test: POLLIN + SO_RCVLOWAT test

2022-08-08 Thread Stefano Garzarella
On Wed, Aug 03, 2022 at 02:07:58PM +, Arseniy Krasnov wrote: This adds test to check,that when poll() returns POLLIN,POLLRDNORM bits, next read call won't block. Signed-off-by: Arseniy Krasnov --- tools/testing/vsock/vsock_test.c | 107 +++ 1 file changed, 107

Re: [RFC PATCH v3 9/9] vsock_test: POLLIN + SO_RCVLOWAT test

2022-08-08 Thread Stefano Garzarella
On Wed, Aug 03, 2022 at 02:07:58PM +, Arseniy Krasnov wrote: This adds test to check,that when poll() returns POLLIN,POLLRDNORM bits, next read call won't block. Signed-off-by: Arseniy Krasnov --- tools/testing/vsock/vsock_test.c | 107 +++ 1 file changed, 107

Re: [RFC PATCH v3 8/9] vmci/vsock: check SO_RCVLOWAT before wake up reader

2022-08-08 Thread Stefano Garzarella
On Wed, Aug 03, 2022 at 02:05:52PM +, Arseniy Krasnov wrote: This adds extra condition to wake up data reader: do it only when number of readable bytes >= SO_RCVLOWAT. Otherwise, there is no sense to kick user,because it will wait until SO_RCVLOWAT bytes will be dequeued. Ditto as previous

Re: [RFC PATCH v3 7/9] virtio/vsock: check SO_RCVLOWAT before wake up reader

2022-08-08 Thread Stefano Garzarella
On Wed, Aug 03, 2022 at 02:03:58PM +, Arseniy Krasnov wrote: This adds extra condition to wake up data reader: do it only when number of readable bytes >= SO_RCVLOWAT. Otherwise, there is no sense to kick user,because it will wait until SO_RCVLOWAT bytes will be dequeued. Maybe we can

Re: [RFC PATCH v3 6/9] vsock: add API call for data ready

2022-08-08 Thread Stefano Garzarella
On Wed, Aug 03, 2022 at 02:01:57PM +, Arseniy Krasnov wrote: This adds 'vsock_data_ready()' which must be called by transport to kick sleeping data readers. It checks for SO_RCVLOWAT value before waking user,thus preventing spurious wake ups.Based on 'tcp_data_ready()' logic. Since it's

Re: [RFC PATCH v3 5/9] vsock: pass sock_rcvlowat to notify_poll_in as target

2022-08-08 Thread Stefano Garzarella
On Wed, Aug 03, 2022 at 01:59:49PM +, Arseniy Krasnov wrote: This callback controls setting of POLLIN,POLLRDNORM output bits of poll() syscall,but in some cases,it is incorrectly to set it, when socket has at least 1 bytes of available data. I suggest you refrase the description a bit,

Re: [RFC PATCH v3 4/9] vmci/vsock: use 'target' in notify_poll_in callback

2022-08-08 Thread Stefano Garzarella
On Wed, Aug 03, 2022 at 01:57:54PM +, Arseniy Krasnov wrote: This callback controls setting of POLLIN,POLLRDNORM output bits of poll() syscall,but in some cases,it is incorrectly to set it, when socket has at least 1 bytes of available data. Use 'target' which is already exists and equal to

Re: [RFC PATCH v3 3/9] virtio/vsock: use 'target' in notify_poll_in callback

2022-08-08 Thread Stefano Garzarella
On Wed, Aug 03, 2022 at 01:55:36PM +, Arseniy Krasnov wrote: This callback controls setting of POLLIN,POLLRDNORM output bits of poll() syscall,but in some cases,it is incorrectly to set it, when socket has at least 1 bytes of available data. Use 'target' which is already exists and equal to

Re: [RFC PATCH v3 2/9] hv_sock: disable SO_RCVLOWAT support

2022-08-08 Thread Stefano Garzarella
On Wed, Aug 03, 2022 at 01:53:23PM +, Arseniy Krasnov wrote: For Hyper-V it is quiet difficult to support this socket option,due to transport internals, so disable it. Signed-off-by: Arseniy Krasnov Reviewed-by: Dexuan Cui --- net/vmw_vsock/hyperv_transport.c | 7 +++ 1 file changed, 7

Re: [RFC PATCH v3 1/9] vsock: SO_RCVLOWAT transport set callback

2022-08-08 Thread Stefano Garzarella
On Mon, Aug 8, 2022 at 12:23 PM Stefano Garzarella wrote: > > On Wed, Aug 03, 2022 at 01:51:05PM +, Arseniy Krasnov wrote: > >This adds transport specific callback for SO_RCVLOWAT, because in some > >transports it may be difficult to know current available number of bytes > >ready to read.

Re: [RFC PATCH v3 1/9] vsock: SO_RCVLOWAT transport set callback

2022-08-08 Thread Stefano Garzarella
On Wed, Aug 03, 2022 at 01:51:05PM +, Arseniy Krasnov wrote: This adds transport specific callback for SO_RCVLOWAT, because in some transports it may be difficult to know current available number of bytes ready to read. Thus, when SO_RCVLOWAT is set, transport may reject it. Signed-off-by:

Re: IOTLB support for vhost/vsock breaks crosvm on Android

2022-08-08 Thread Will Deacon
Hi Michael, On Sun, Aug 07, 2022 at 09:14:43AM -0400, Michael S. Tsirkin wrote: > Will, thanks very much for the analysis and the writeup! No problem, and thanks for following up. > On Fri, Aug 05, 2022 at 07:11:06PM +0100, Will Deacon wrote: > > So how should we fix this? One possibility is

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

2022-08-08 Thread Ricardo Cañuelo
Hi Bagas, Thanks for reviewing the patch, comments below: On sáb, ago 06 2022 at 14:58:08, Bagas Sanjaya wrote: > Sphinx citation syntax can be used for external references, like: > > diff --git a/Documentation/driver-api/virtio/virtio.rst > b/Documentation/driver-api/virtio/virtio.rst > index

Re: [PATCH net v2 2/2] vsock: Set socket state back to SS_UNCONNECTED in vsock_connect_timeout()

2022-08-08 Thread Stefano Garzarella
On Sun, Aug 07, 2022 at 02:00:46AM -0700, Peilin Ye wrote: From: Peilin Ye Imagine two non-blocking vsock_connect() requests on the same socket. The first request schedules @connect_work, and after it times out, vsock_connect_timeout() sets *sock* state back to TCP_CLOSE, but keeps *socket*

Re: [PATCH net v2 1/2] vsock: Fix memory leak in vsock_connect()

2022-08-08 Thread Stefano Garzarella
On Sun, Aug 07, 2022 at 02:00:11AM -0700, Peilin Ye wrote: From: Peilin Ye An O_NONBLOCK vsock_connect() request may try to reschedule @connect_work. Imagine the following sequence of vsock_connect() requests: 1. The 1st, non-blocking request schedules @connect_work, which will expire