Re: [PATCH] x86/paravirt: convert simple paravirt functions to asm

2023-03-09 Thread Juergen Gross via Virtualization
On 09.03.23 14:39, Borislav Petkov wrote: On Wed, Mar 08, 2023 at 04:42:10PM +0100, Juergen Gross wrote: All functions referenced via __PV_IS_CALLEE_SAVE() need to be assembler functions, as those functions calls are hidden from gcc. In case the kernel is compiled with "-fzero-call-used-regs" th

[PATCH v2 2/3] virtio_ring: Avoid using inline for small functions

2023-03-09 Thread Feng Liu via Virtualization
According to kernel coding style [1], defining inline functions is not necessary and beneficial for simple functions. Hence clean up the code by removing the inline keyword. It is verified with GCC 12.2.0, the generated code with/without inline is same. Additionally tested with pktgen and iperf, a

[PATCH v2 1/3] virtio_pci_modern: Allow non power of 2 sizes for virtqueues

2023-03-09 Thread Feng Liu via Virtualization
According to the Virtio Specification, the Queue Size parameter of a virtqueue corresponds to the maximum number of descriptors in that queue, and it does not have to be a power of 2 for packed virtqueues. However, the virtio_pci_modern driver enforced a power of 2 check for virtqueue sizes, which

[PATCH v2 0/3] virtio_ring: Clean up code for virtio ring and pci

2023-03-09 Thread Feng Liu via Virtualization
This patch series performs a clean up of the code in virtio_ring and virtio_pci, modifying it to conform with the Linux kernel coding style guidance [1]. The modifications ensure the code easy to read and understand. This small series does few short cleanups in the code. Patch-1 Allow non power of

[PATCH v2 3/3] virtio_ring: Use const to annotate read-only pointer params

2023-03-09 Thread Feng Liu via Virtualization
Add const to make the read-only pointer parameters clear, similar to many existing functions. To implement this change, the commit also introduces the use of `container_of_const` to implement `to_vvq`, which ensures the const-ness of read-only parameters and avoids accidental modification of their

Re: [RFC PATCH v3 0/4] several updates to virtio/vsock

2023-03-09 Thread Stefano Garzarella
On Thu, Mar 09, 2023 at 07:20:20PM +0300, Arseniy Krasnov wrote: On 09.03.2023 19:21, Stefano Garzarella wrote: On Thu, Mar 09, 2023 at 01:10:36PM +0300, Arseniy Krasnov wrote: Hello, this patchset evolved from previous v2 version (see link below). It does several updates to virtio/vsock: 1)

Re: [RFC PATCH v3 4/4] test/vsock: copy to user failure test

2023-03-09 Thread Stefano Garzarella
On Thu, Mar 09, 2023 at 01:14:48PM +0300, Arseniy Krasnov wrote: This adds SOCK_STREAM and SOCK_SEQPACKET tests for invalid buffer case. It tries to read data to NULL buffer (data already presents in socket's queue), then uses valid buffer. For SOCK_STREAM second read must return data, because sk

Re: [RFC PATCH v3 3/4] virtio/vsock: don't drop skbuff on copy failure

2023-03-09 Thread Stefano Garzarella
On Thu, Mar 09, 2023 at 01:13:51PM +0300, Arseniy Krasnov wrote: This returns behaviour of SOCK_STREAM read as before skbuff usage. When So we need the Fixes tag: Fixes: 71dc9ec9ac7d ("virtio/vsock: replace virtio_vsock_pkt with sk_buff") The patch LGTM! Stefano copying to user fails curren

Re: [RFC PATCH v3 2/4] virtio/vsock: remove redundant 'skb_pull()' call

2023-03-09 Thread Stefano Garzarella
On Thu, Mar 09, 2023 at 01:12:42PM +0300, Arseniy Krasnov wrote: I would add: Since we now no longer use `skb->len` to update credit, ... There is no sense to update skbuff state, because it is used only once after dequeue to copy data and then will be released. Signed-off-by: Arseniy Krasnov

Re: [RFC PATCH v3 1/4] virtio/vsock: don't use skbuff state to account credit

2023-03-09 Thread Stefano Garzarella
On Thu, Mar 09, 2023 at 01:11:46PM +0300, Arseniy Krasnov wrote: This replaces use of skbuff state to calculate new 'rx_bytes'/'fwd_cnt' values with explicit value as input argument. This makes code more simple, because it is not needed to change skbuff state before each call to update 'rx_bytes'

Re: [RFC PATCH v3 0/4] several updates to virtio/vsock

2023-03-09 Thread Stefano Garzarella
On Thu, Mar 09, 2023 at 01:10:36PM +0300, Arseniy Krasnov wrote: Hello, this patchset evolved from previous v2 version (see link below). It does several updates to virtio/vsock: 1) Changes 'virtio_transport_inc/dec_rx_pkt()' interface. Now instead of using skbuff state ('head' and 'data' point

Re: [PATCH 3/3] virtio_ring: Use const to annotate read-only pointer params

2023-03-09 Thread Michael S. Tsirkin
On Thu, Mar 09, 2023 at 10:24:19AM +0100, Jiri Pirko wrote: > >Nice but the bigger problem is not the mistake - it is the posting of > >untested code. It might be an ok thing to do - as long as you make it > >super abundantrly clear that this is what it is, and explain why > >you are posting it now

Re: [PATCH] x86/paravirt: convert simple paravirt functions to asm

2023-03-09 Thread Borislav Petkov
On Wed, Mar 08, 2023 at 04:42:10PM +0100, Juergen Gross wrote: > All functions referenced via __PV_IS_CALLEE_SAVE() need to be assembler > functions, as those functions calls are hidden from gcc. In case the > kernel is compiled with "-fzero-call-used-regs" the compiler will > clobber caller-saved

[patch net-next v4] net: virtio_net: implement exact header length guest feature

2023-03-09 Thread Jiri Pirko
From: Jiri Pirko Virtio spec introduced a feature VIRTIO_NET_F_GUEST_HDRLEN which when set implicates that device benefits from knowing the exact size of the header. For compatibility, to signal to the device that the header is reliable driver also needs to set this feature. Without this feature

Re: [PATCH v2] tools/virtio: virtio_test -h,--help should return directly

2023-03-09 Thread Stefano Garzarella
On Thu, Mar 09, 2023 at 04:42:50PM +0800, Rong Tao wrote: From: Rong Tao When we get help information, we should return directly, and we should not execute test cases. Move the exit() directly into the help() function and remove it from case '?'. Signed-off-by: Rong Tao --- v2: help(): exit w

Re: [PATCH] tools/virtio: virtio_test -h,--help should return directly

2023-03-09 Thread Stefano Garzarella
On Thu, Mar 09, 2023 at 04:56:09PM +0800, Rong Tao wrote: Hi, Stefano. I'm wondering, does '-h,--help' help() should 'exit(0)'? Is '-h' considered a successful run and returns '0'. You're right. I thought -h would return an error, but that's not the case, so I guess this patch is fine! Thanks

Re: [PATCH v2] tools/virtio: virtio_test -h,--help should return directly

2023-03-09 Thread Stefano Garzarella
On Thu, Mar 09, 2023 at 04:42:50PM +0800, Rong Tao wrote: From: Rong Tao When we get help information, we should return directly, and we should not execute test cases. Move the exit() directly into the help() function and remove it from case '?'. Signed-off-by: Rong Tao --- v2: help(): exit w

Re: [PATCH] tools/virtio: virtio_test -h,--help should return directly

2023-03-09 Thread Stefano Garzarella
On Thu, Mar 09, 2023 at 02:13:13PM +0800, Rong Tao wrote: From: Rong Tao When we get help information, we should return directly, and we should not execute test cases. Move the exit() directly into the help() function and remove it from case '?'. Signed-off-by: Rong Tao --- tools/virtio/virti

Re: [PATCH] tools/virtio: virtio_test: Fix indentation

2023-03-09 Thread Stefano Garzarella
On Thu, Mar 09, 2023 at 02:13:20PM +0800, Rong Tao wrote: Replace eight spaces with Tab. Signed-off-by: Rong Tao --- tools/virtio/virtio_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Acked-by: Stefano Garzarella diff --git a/tools/virtio/virtio_test.c b/tools/virtio/virtio_t

Re: [PATCH] tools/virtio: Ignore virtio-trace/trace-agent

2023-03-09 Thread Stefano Garzarella
On Thu, Mar 09, 2023 at 02:13:07PM +0800, Rong Tao wrote: From: Rong Tao since commit 108fc82596e3("tools: Add guest trace agent as a user tool") introduce virtio-trace/trace-agent, it should be ignored in the git tree. Signed-off-by: Rong Tao --- tools/virtio/.gitignore | 1 + 1 file changed,