2022-03-25 13:07:40

by Stefano Garzarella

[permalink] [raw]
Subject: [PATCH net v3 0/3] vsock/virtio: enable VQs early on probe and finish the setup before using them

The first patch fixes a virtio-spec violation. The other two patches
complete the driver configuration before using the VQs in the probe.

The patch order should simplify backporting in stable branches.

v3:
- re-ordered the patch to improve bisectability [MST]

v2: https://lore.kernel.org/netdev/[email protected]/
v1: https://lore.kernel.org/netdev/[email protected]/

Stefano Garzarella (3):
vsock/virtio: initialize vdev->priv before using VQs
vsock/virtio: read the negotiated features before using VQs
vsock/virtio: enable VQs early on probe

net/vmw_vsock/virtio_transport.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)

--
2.35.1


2022-03-25 17:30:59

by Stefano Garzarella

[permalink] [raw]
Subject: [PATCH net v3 3/3] vsock/virtio: enable VQs early on probe

virtio spec requires drivers to set DRIVER_OK before using VQs.
This is set automatically after probe returns, but virtio-vsock
driver uses VQs in the probe function to fill rx and event VQs
with new buffers.

Let's fix this, calling virtio_device_ready() before using VQs
in the probe function.

Fixes: 0ea9e1d3a9e3 ("VSOCK: Introduce virtio_transport.ko")
Signed-off-by: Stefano Garzarella <[email protected]>
---
net/vmw_vsock/virtio_transport.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/net/vmw_vsock/virtio_transport.c b/net/vmw_vsock/virtio_transport.c
index 3954d3be9083..ba1c8cc0c467 100644
--- a/net/vmw_vsock/virtio_transport.c
+++ b/net/vmw_vsock/virtio_transport.c
@@ -627,6 +627,8 @@ static int virtio_vsock_probe(struct virtio_device *vdev)

vdev->priv = vsock;

+ virtio_device_ready(vdev);
+
mutex_lock(&vsock->tx_lock);
vsock->tx_run = true;
mutex_unlock(&vsock->tx_lock);
--
2.35.1

2022-03-25 18:16:18

by Stefan Hajnoczi

[permalink] [raw]
Subject: Re: [PATCH net v3 0/3] vsock/virtio: enable VQs early on probe and finish the setup before using them

On Wed, Mar 23, 2022 at 06:36:22PM +0100, Stefano Garzarella wrote:
> The first patch fixes a virtio-spec violation. The other two patches
> complete the driver configuration before using the VQs in the probe.
>
> The patch order should simplify backporting in stable branches.
>
> v3:
> - re-ordered the patch to improve bisectability [MST]
>
> v2: https://lore.kernel.org/netdev/[email protected]/
> v1: https://lore.kernel.org/netdev/[email protected]/
>
> Stefano Garzarella (3):
> vsock/virtio: initialize vdev->priv before using VQs
> vsock/virtio: read the negotiated features before using VQs
> vsock/virtio: enable VQs early on probe
>
> net/vmw_vsock/virtio_transport.c | 11 +++++++----
> 1 file changed, 7 insertions(+), 4 deletions(-)
>
> --
> 2.35.1
>

A subtle point is that we still drop events and rx packets during the
window where DRIVER_OK has been set but vqs haven't been filled.
This is acceptable because it's unavoidable and equivalent to events
happening before DRIVER_OK is set. What this revision *does* fix is that
vq used buffer notifications are no longer lost. Good.

Reviewed-by: Stefan Hajnoczi <[email protected]>


Attachments:
(No filename) (1.22 kB)
signature.asc (499.00 B)
Download all attachments

2022-03-25 19:04:34

by patchwork-bot+netdevbpf

[permalink] [raw]
Subject: Re: [PATCH net v3 0/3] vsock/virtio: enable VQs early on probe and finish the setup before using them

Hello:

This series was applied to netdev/net.git (master)
by Jakub Kicinski <[email protected]>:

On Wed, 23 Mar 2022 18:36:22 +0100 you wrote:
> The first patch fixes a virtio-spec violation. The other two patches
> complete the driver configuration before using the VQs in the probe.
>
> The patch order should simplify backporting in stable branches.
>
> v3:
> - re-ordered the patch to improve bisectability [MST]
>
> [...]

Here is the summary with links:
- [net,v3,1/3] vsock/virtio: initialize vdev->priv before using VQs
https://git.kernel.org/netdev/net/c/4b5f1ad5566a
- [net,v3,2/3] vsock/virtio: read the negotiated features before using VQs
https://git.kernel.org/netdev/net/c/c1011c0b3a9c
- [net,v3,3/3] vsock/virtio: enable VQs early on probe
https://git.kernel.org/netdev/net/c/88704454ef8b

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html


2022-03-25 19:26:32

by Michael S. Tsirkin

[permalink] [raw]
Subject: Re: [PATCH net v3 0/3] vsock/virtio: enable VQs early on probe and finish the setup before using them

On Wed, Mar 23, 2022 at 06:36:22PM +0100, Stefano Garzarella wrote:
> The first patch fixes a virtio-spec violation. The other two patches
> complete the driver configuration before using the VQs in the probe.
>
> The patch order should simplify backporting in stable branches.


Series:

Acked-by: Michael S. Tsirkin <[email protected]>

> v3:
> - re-ordered the patch to improve bisectability [MST]
>
> v2: https://lore.kernel.org/netdev/[email protected]/
> v1: https://lore.kernel.org/netdev/[email protected]/
>
> Stefano Garzarella (3):
> vsock/virtio: initialize vdev->priv before using VQs
> vsock/virtio: read the negotiated features before using VQs
> vsock/virtio: enable VQs early on probe
>
> net/vmw_vsock/virtio_transport.c | 11 +++++++----
> 1 file changed, 7 insertions(+), 4 deletions(-)
>
> --
> 2.35.1