Re: [PATCH v4] virtio/vsock: replace virtio_vsock_pkt with sk_buff

From: Arseniy Krasnov
Date: Thu Nov 24 2022 - 10:13:58 EST


Hello Stefano

On 24.11.2022 18:00, Stefano Garzarella wrote:
> This is a net-next material, please remember to use net-next tag:
> https://www.kernel.org/doc/html/v6.0/process/maintainer-netdev.html#netdev-faq
>
> On Wed, Nov 23, 2022 at 10:07:49PM -0800, Bobby Eshleman wrote:
>> This commit changes virtio/vsock to use sk_buff instead of
>> virtio_vsock_pkt. Beyond better conforming to other net code, using
>> sk_buff allows vsock to use sk_buff-dependent features in the future
>> (such as sockmap) and improves throughput.
>>
>> This patch introduces the following performance changes:
>>
>> Tool/Config: uperf w/ 64 threads, SOCK_STREAM
>> Test Runs: 5, mean of results
>> Before: commit 95ec6bce2a0b ("Merge branch 'net-ipa-more-endpoints'")
>>
>> Test: 64KB, g2h
>> Before: 21.63 Gb/s
>> After: 25.59 Gb/s (+18%)
>>
>> Test: 16B, g2h
>> Before: 11.86 Mb/s
>> After: 17.41 Mb/s (+46%)
>>
>> Test: 64KB, h2g
>> Before: 2.15 Gb/s
>> After: 3.6 Gb/s (+67%)
>>
>> Test: 16B, h2g
>> Before: 14.38 Mb/s
>> After: 18.43 Mb/s (+28%)
>>
>> Signed-off-by: Bobby Eshleman <bobby.eshleman@xxxxxxxxxxxxx>
>> ---
>
> The patch LGTM. I run several tests (iperf3, vsock_test,
> vsock_diag_test, vhost-user-vsock, tcpdump) and IMO we are okay.
>
> I found the following problems that I would like to report:
>
> - vhost-user-vsock [1] is failing, but it is not an issue of this patch,
>   but a spec violation in the rust-vmm/vm-virtio/virtio-vsock crate as I
>   reported here [2]. We will fix it there, this patch is fine, indeed
>   trying a guest with the new layout (1 descriptor for both header and
>   data) with vhost-vsock in Linux 6.0, everything works perfectly.
>
> - the new "SOCK_SEQPACKET msg bounds" [3] reworked by Arseniy fails
>   intermittently with this patch.
>
>   Using the tests currently in the kernel tree everything is fine, so
>   I don't understand if it's a problem in the new test or in this
>   patch. I've looked at the code again and don't seem to see any
>   criticisms.
>
>   @Arseniy @Bobby can you take a look?
Seems i've found this problem here:

https://lkml.org/lkml/2022/11/24/708

Being fixed - all tests passes

Thank You!
>
>   I'll try to take a closer look too, and before I give my R-b I'd like
>   to make sure it's a problem in the test and not in this patch.
>
>   This is what I have (some times, not always) with both host and guest
>   with this patch and the series of [3] applied:
>
>   host$ ./vsock_test --control-host=192.168.133.3 --control-port=12345 \
>                      --mode=client --peer-cid=4
>   Control socket connected to 192.168.133.3:12345.
>   0 - SOCK_STREAM connection reset...ok
>   1 - SOCK_STREAM bind only...ok
>   2 - SOCK_STREAM client close...ok
>   3 - SOCK_STREAM server close...ok
>   4 - SOCK_STREAM multiple connections...ok
>   5 - SOCK_STREAM MSG_PEEK...ok
>   6 - SOCK_SEQPACKET msg bounds...ok
>   7 - SOCK_SEQPACKET MSG_TRUNC flag...recv: Connection reset by peer
>
>   guest$ ./vsock_test --control-port=12345 --mode=server --peer-cid=2
>   Control socket listening on 0.0.0.0:12345
>   Control socket connection accepted...
>   0 - SOCK_STREAM connection reset...ok
>   1 - SOCK_STREAM bind only...ok
>   2 - SOCK_STREAM client close...ok
>   3 - SOCK_STREAM server close...ok
>   4 - SOCK_STREAM multiple connections...ok
>   5 - SOCK_STREAM MSG_PEEK...ok
>   6 - SOCK_SEQPACKET msg bounds...Message bounds broken
>
> Thanks,
> Stefano
>
> [1] https://github.com/rust-vmm/vhost-device/tree/main/crates/vsock
> [2] https://github.com/rust-vmm/vm-virtio/issues/204
> [3] https://lore.kernel.org/lkml/c991dffd-1dbc-e1d1-b682-a3c71f6ce51c@xxxxxxxxxxxxxx/
>