Re: [PATCH vhost 00/17] virtio: drivers maintain dma info for premapped vq

2024-01-31 Thread Zhu Yanjun
在 2024/1/30 19:42, Xuan Zhuo 写道: As discussed: http://lore.kernel.org/all/cacgkmevq0no8qgc46u4mgsmtud44fd_cflcpavmj3rhyqrz...@mail.gmail.com If the virtio is premapped mode, the driver should manage the dma info by self. So the virtio core should not store the dma info. So we can release the mem

Re: [PATCH vhost 04/17] virtio_ring: split: remove double check of the unmap ops

2024-01-31 Thread Xuan Zhuo
On Wed, 31 Jan 2024 17:12:22 +0800, Jason Wang wrote: > On Tue, Jan 30, 2024 at 7:42 PM Xuan Zhuo wrote: > > > > In the functions vring_unmap_one_split and > > vring_unmap_one_split_indirect, > > multiple checks are made whether unmap is performed and whether it is > > INDIRECT. > > > > These two

Re: [PATCH vhost 06/17] virtio_ring: no store dma info when unmap is not needed

2024-01-31 Thread Xuan Zhuo
On Wed, 31 Jan 2024 17:12:29 +0800, Jason Wang wrote: > On Tue, Jan 30, 2024 at 7:42 PM Xuan Zhuo wrote: > > > > As discussed: > > http://lore.kernel.org/all/CACGkMEug-=C+VQhkMYSgUKMC==04m7-uem_yc21bggkkzh8...@mail.gmail.com > > > > When the vq is premapped mode, the driver manages the dma > > in

Re: [PATCH vhost 17/17] virtio_net: sq support premapped mode

2024-01-31 Thread Xuan Zhuo
On Thu, 1 Feb 2024 13:36:46 +0800, Jason Wang wrote: > On Thu, Feb 1, 2024 at 11:28 AM Xuan Zhuo wrote: > > > > On Wed, 31 Jan 2024 17:12:47 +0800, Jason Wang wrote: > > > On Tue, Jan 30, 2024 at 7:43 PM Xuan Zhuo > > > wrote: > > > > > > > > If the xsk is enabling, the xsk tx will share the s

Re: [PATCH vhost 04/17] virtio_ring: split: remove double check of the unmap ops

2024-01-31 Thread Jason Wang
On Wed, Jan 31, 2024 at 5:43 PM Michael S. Tsirkin wrote: > > On Wed, Jan 31, 2024 at 05:12:22PM +0800, Jason Wang wrote: > > I post a patch to store flags unconditionally at: > > > > https://lore.kernel.org/all/20220224122655-mutt-send-email-...@kernel.org/ > > what happened to it btw? Haven't g

Re: [PATCH vhost 17/17] virtio_net: sq support premapped mode

2024-01-31 Thread Jason Wang
On Thu, Feb 1, 2024 at 11:28 AM Xuan Zhuo wrote: > > On Wed, 31 Jan 2024 17:12:47 +0800, Jason Wang wrote: > > On Tue, Jan 30, 2024 at 7:43 PM Xuan Zhuo > > wrote: > > > > > > If the xsk is enabling, the xsk tx will share the send queue. > > > But the xsk requires that the send queue use the pr

Re: [PATCH vhost 17/17] virtio_net: sq support premapped mode

2024-01-31 Thread Xuan Zhuo
On Wed, 31 Jan 2024 17:12:47 +0800, Jason Wang wrote: > On Tue, Jan 30, 2024 at 7:43 PM Xuan Zhuo wrote: > > > > If the xsk is enabling, the xsk tx will share the send queue. > > But the xsk requires that the send queue use the premapped mode. > > So the send queue must support premapped mode. >

Re: [PATCH vhost 11/17] virtio_ring: export premapped to driver by struct virtqueue

2024-01-31 Thread Xuan Zhuo
On Wed, 31 Jan 2024 17:12:43 +0800, Jason Wang wrote: > On Tue, Jan 30, 2024 at 7:43 PM Xuan Zhuo wrote: > > > > Export the premapped to drivers, then drivers can check > > the vq premapped mode after the find_vqs(). > > This looks odd, it's the charge of the driver to set premapped, so it > sho

Re: [PATCH vhost 07/17] virtio: find_vqs: pass struct instead of multi parameters

2024-01-31 Thread Xuan Zhuo
On Wed, 31 Jan 2024 17:12:34 +0800, Jason Wang wrote: > On Tue, Jan 30, 2024 at 7:42 PM Xuan Zhuo wrote: > > > > Now, we pass multi parameters to find_vqs. These parameters > > may work for transport or work for vring. > > > > And find_vqs has multi implements in many places: > > > > But every ti

Re: [PATCH vhost 08/17] virtio: vring_new_virtqueue(): pass struct instead of multi parameters

2024-01-31 Thread Xuan Zhuo
On Wed, 31 Jan 2024 13:03:04 +0200 (EET), =?utf-8?q?Ilpo_J=C3=A4rvinen?= wrote: > On Tue, 30 Jan 2024, Xuan Zhuo wrote: > > > Just like find_vqs(), it is time to refactor the > > vring_new_virtqueue(). We pass the similar struct to > > vring_new_virtqueue. > > > > Signed-off-by: Xuan Zhuo > > --

Re: [PATCH vhost 03/17] virtio_ring: packed: structure the indirect desc table

2024-01-31 Thread Jason Wang
On Wed, Jan 31, 2024 at 6:01 PM Xuan Zhuo wrote: > > On Wed, 31 Jan 2024 17:12:10 +0800, Jason Wang wrote: > > On Tue, Jan 30, 2024 at 7:42 PM Xuan Zhuo > > wrote: > > > > > > This commit structure the indirect desc table. > > > Then we can get the desc num directly when doing unmap. > > > > >

Re: [PATCH v2 1/7] arm64: Unconditionally call unflatten_device_tree()

2024-01-31 Thread Stephen Boyd
Quoting Rob Herring (2024-01-31 12:54:05) > On Mon, Jan 29, 2024 at 04:45:00PM -0800, Stephen Boyd wrote: > > Call this function unconditionally so that we can populate an empty DTB > > on platforms that don't boot with a firmware provided or builtin DTB. > > Override 'initial_boot_params' to NULL

Re: [PATCH v2 1/7] arm64: Unconditionally call unflatten_device_tree()

2024-01-31 Thread Rob Herring
On Mon, Jan 29, 2024 at 04:45:00PM -0800, Stephen Boyd wrote: > Call this function unconditionally so that we can populate an empty DTB > on platforms that don't boot with a firmware provided or builtin DTB. > Override 'initial_boot_params' to NULL when ACPI is in use but the > bootloader has loade

Re: [PATCH vhost 11/17] virtio_ring: export premapped to driver by struct virtqueue

2024-01-31 Thread Jason Wang
On Tue, Jan 30, 2024 at 7:43 PM Xuan Zhuo wrote: > > Export the premapped to drivers, then drivers can check > the vq premapped mode after the find_vqs(). This looks odd, it's the charge of the driver to set premapped, so it should know it? Thanks

Re: [PATCH vhost 17/17] virtio_net: sq support premapped mode

2024-01-31 Thread Jason Wang
On Tue, Jan 30, 2024 at 7:43 PM Xuan Zhuo wrote: > > If the xsk is enabling, the xsk tx will share the send queue. > But the xsk requires that the send queue use the premapped mode. > So the send queue must support premapped mode. > > Signed-off-by: Xuan Zhuo > --- > drivers/net/virtio_net.c | 1

Re: [PATCH vhost 03/17] virtio_ring: packed: structure the indirect desc table

2024-01-31 Thread Xuan Zhuo
On Wed, 31 Jan 2024 17:12:10 +0800, Jason Wang wrote: > On Tue, Jan 30, 2024 at 7:42 PM Xuan Zhuo wrote: > > > > This commit structure the indirect desc table. > > Then we can get the desc num directly when doing unmap. > > > > And save the dma info to the struct, then the indirect > > will not u

Re: [PATCH vhost 08/17] virtio: vring_new_virtqueue(): pass struct instead of multi parameters

2024-01-31 Thread Ilpo Järvinen
On Tue, 30 Jan 2024, Xuan Zhuo wrote: > Just like find_vqs(), it is time to refactor the > vring_new_virtqueue(). We pass the similar struct to > vring_new_virtqueue. > > Signed-off-by: Xuan Zhuo > --- > diff --git a/tools/virtio/vringh_test.c b/tools/virtio/vringh_test.c > index 98ff808d6f0c..

Re: [PATCH vhost 07/17] virtio: find_vqs: pass struct instead of multi parameters

2024-01-31 Thread Jason Wang
On Tue, Jan 30, 2024 at 7:42 PM Xuan Zhuo wrote: > > Now, we pass multi parameters to find_vqs. These parameters > may work for transport or work for vring. > > And find_vqs has multi implements in many places: > > But every time, > arch/um/drivers/virtio_uml.c > drivers/platform/mellanox/mlxbf-

Re: [PATCH vhost 03/17] virtio_ring: packed: structure the indirect desc table

2024-01-31 Thread Jason Wang
On Tue, Jan 30, 2024 at 7:42 PM Xuan Zhuo wrote: > > This commit structure the indirect desc table. > Then we can get the desc num directly when doing unmap. > > And save the dma info to the struct, then the indirect > will not use the dma fields of the desc_extra. The subsequent > commits will ma

Re: [PATCH vhost 02/17] virtio_ring: packed: remove double check of the unmap ops

2024-01-31 Thread Xuan Zhuo
On Wed, 31 Jan 2024 17:12:19 +0800, Jason Wang wrote: > On Tue, Jan 30, 2024 at 7:42 PM Xuan Zhuo wrote: > > > > In the functions vring_unmap_extra_packed and vring_unmap_desc_packed, > > multiple checks are made whether unmap is performed and whether it is > > INDIRECT. > > > > These two functio

Re: [PATCH vhost 04/17] virtio_ring: split: remove double check of the unmap ops

2024-01-31 Thread Michael S. Tsirkin
On Wed, Jan 31, 2024 at 05:12:22PM +0800, Jason Wang wrote: > I post a patch to store flags unconditionally at: > > https://lore.kernel.org/all/20220224122655-mutt-send-email-...@kernel.org/ what happened to it btw? -- MST

Re: [PATCH vhost 08/17] virtio: vring_new_virtqueue(): pass struct instead of multi parameters

2024-01-31 Thread Jason Wang
On Tue, Jan 30, 2024 at 7:42 PM Xuan Zhuo wrote: > > Just like find_vqs(), it is time to refactor the > vring_new_virtqueue(). We pass the similar struct to > vring_new_virtqueue. > Well, the vring_create_virtqueue() is converted with a structure. We need to be consistent. And it seems better to

Re: [PATCH vhost 04/17] virtio_ring: split: remove double check of the unmap ops

2024-01-31 Thread Jason Wang
On Tue, Jan 30, 2024 at 7:42 PM Xuan Zhuo wrote: > > In the functions vring_unmap_one_split and > vring_unmap_one_split_indirect, > multiple checks are made whether unmap is performed and whether it is > INDIRECT. > > These two functions are usually called in a loop, and we should put the > check

Re: [PATCH vhost 05/17] virtio_ring: split: structure the indirect desc table

2024-01-31 Thread Jason Wang
On Tue, Jan 30, 2024 at 7:42 PM Xuan Zhuo wrote: > > This commit structure the indirect desc table. > Then we can get the desc num directly when doing unmap. > > And save the dma info to the struct, then the indirect > will not use the dma fields of the desc_extra. The subsequent > commits will ma

Re: [PATCH vhost 02/17] virtio_ring: packed: remove double check of the unmap ops

2024-01-31 Thread Jason Wang
On Tue, Jan 30, 2024 at 7:42 PM Xuan Zhuo wrote: > > In the functions vring_unmap_extra_packed and vring_unmap_desc_packed, > multiple checks are made whether unmap is performed and whether it is > INDIRECT. > > These two functions are usually called in a loop, and we should put the > check outsid

Re: [PATCH vhost 06/17] virtio_ring: no store dma info when unmap is not needed

2024-01-31 Thread Jason Wang
On Tue, Jan 30, 2024 at 7:42 PM Xuan Zhuo wrote: > > As discussed: > http://lore.kernel.org/all/CACGkMEug-=C+VQhkMYSgUKMC==04m7-uem_yc21bggkkzh8...@mail.gmail.com > > When the vq is premapped mode, the driver manages the dma > info is a good way. > > So this commit make the virtio core not to stor

Re: [PATCH vhost 01/17] virtio_ring: introduce vring_need_unmap_buffer

2024-01-31 Thread Jason Wang
On Tue, Jan 30, 2024 at 7:42 PM Xuan Zhuo wrote: > > To make the code readable, introduce vring_need_unmap_buffer() to > replace do_unmap. > >use_dma_api premapped -> vring_need_unmap_buffer() > 1. false falsefalse > 2. truefalsetrue > 3. truetrue