linux-hyperv.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hv_utils: Set the maximum packet size for VSS driver to the length of the receive buffer
@ 2021-08-25 13:38 Vitaly Kuznetsov
  2021-08-25 18:33 ` Michael Kelley
  0 siblings, 1 reply; 3+ messages in thread
From: Vitaly Kuznetsov @ 2021-08-25 13:38 UTC (permalink / raw)
  To: linux-hyperv
  Cc: Andres Beltran, Michael Kelley, Andrea Parri (Microsoft),
	Dexuan Cui, Wei Liu, Stephen Hemminger, Haiyang Zhang,
	K. Y. Srinivasan, linux-kernel

Commit adae1e931acd ("Drivers: hv: vmbus: Copy packets sent by Hyper-V out
of the ring buffer") introduced a notion of maximum packet size and for
KVM and FCOPY drivers set it to the length of the receive buffer. VSS
driver wasn't updated, this means that the maximum packet size is now
VMBUS_DEFAULT_MAX_PKT_SIZE (4k). Apparently, this is not enough. I'm
observing a packet of 6304 bytes which is being truncated to 4096. When
VSS driver tries to read next packet from ring buffer it starts from the
wrong offset and receives garbage.

Set the maximum packet size to 'HV_HYP_PAGE_SIZE * 2' in VSS driver. This
matches the length of the receive buffer and is in line with other utils
drivers.

Fixes: adae1e931acd ("Drivers: hv: vmbus: Copy packets sent by Hyper-V out of the ring buffer")
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
---
 drivers/hv/hv_snapshot.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/hv/hv_snapshot.c b/drivers/hv/hv_snapshot.c
index 2267bd4c3472..6018b9d1b1fb 100644
--- a/drivers/hv/hv_snapshot.c
+++ b/drivers/hv/hv_snapshot.c
@@ -375,6 +375,7 @@ hv_vss_init(struct hv_util_service *srv)
 	}
 	recv_buffer = srv->recv_buffer;
 	vss_transaction.recv_channel = srv->channel;
+	vss_transaction.recv_channel->max_pkt_size = HV_HYP_PAGE_SIZE * 2;
 
 	/*
 	 * When this driver loads, the user level daemon that
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [PATCH] hv_utils: Set the maximum packet size for VSS driver to the length of the receive buffer
  2021-08-25 13:38 [PATCH] hv_utils: Set the maximum packet size for VSS driver to the length of the receive buffer Vitaly Kuznetsov
@ 2021-08-25 18:33 ` Michael Kelley
  2021-08-25 19:02   ` Wei Liu
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Kelley @ 2021-08-25 18:33 UTC (permalink / raw)
  To: vkuznets, linux-hyperv
  Cc: Andres Beltran, Andrea Parri (Microsoft),
	Dexuan Cui, Wei Liu, Stephen Hemminger, Haiyang Zhang,
	KY Srinivasan, linux-kernel

From: Vitaly Kuznetsov <vkuznets@redhat.com> Sent: Wednesday, August 25, 2021 6:39 AM
> 
> Commit adae1e931acd ("Drivers: hv: vmbus: Copy packets sent by Hyper-V out
> of the ring buffer") introduced a notion of maximum packet size and for
> KVM and FCOPY drivers set it to the length of the receive buffer. VSS
> driver wasn't updated, this means that the maximum packet size is now
> VMBUS_DEFAULT_MAX_PKT_SIZE (4k). Apparently, this is not enough. I'm
> observing a packet of 6304 bytes which is being truncated to 4096. When
> VSS driver tries to read next packet from ring buffer it starts from the
> wrong offset and receives garbage.
> 
> Set the maximum packet size to 'HV_HYP_PAGE_SIZE * 2' in VSS driver. This
> matches the length of the receive buffer and is in line with other utils
> drivers.
> 
> Fixes: adae1e931acd ("Drivers: hv: vmbus: Copy packets sent by Hyper-V out of the ring buffer")
> Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
> ---
>  drivers/hv/hv_snapshot.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/hv/hv_snapshot.c b/drivers/hv/hv_snapshot.c
> index 2267bd4c3472..6018b9d1b1fb 100644
> --- a/drivers/hv/hv_snapshot.c
> +++ b/drivers/hv/hv_snapshot.c
> @@ -375,6 +375,7 @@ hv_vss_init(struct hv_util_service *srv)
>  	}
>  	recv_buffer = srv->recv_buffer;
>  	vss_transaction.recv_channel = srv->channel;
> +	vss_transaction.recv_channel->max_pkt_size = HV_HYP_PAGE_SIZE * 2;
> 
>  	/*
>  	 * When this driver loads, the user level daemon that
> --
> 2.31.1

Reviewed-by: Michael Kelley <mikelley@microsoft.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] hv_utils: Set the maximum packet size for VSS driver to the length of the receive buffer
  2021-08-25 18:33 ` Michael Kelley
@ 2021-08-25 19:02   ` Wei Liu
  0 siblings, 0 replies; 3+ messages in thread
From: Wei Liu @ 2021-08-25 19:02 UTC (permalink / raw)
  To: Michael Kelley
  Cc: vkuznets, linux-hyperv, Andres Beltran, Andrea Parri (Microsoft),
	Dexuan Cui, Wei Liu, Stephen Hemminger, Haiyang Zhang,
	KY Srinivasan, linux-kernel

On Wed, Aug 25, 2021 at 06:33:10PM +0000, Michael Kelley wrote:
> From: Vitaly Kuznetsov <vkuznets@redhat.com> Sent: Wednesday, August 25, 2021 6:39 AM
> > 
> > Commit adae1e931acd ("Drivers: hv: vmbus: Copy packets sent by Hyper-V out
> > of the ring buffer") introduced a notion of maximum packet size and for
> > KVM and FCOPY drivers set it to the length of the receive buffer. VSS
> > driver wasn't updated, this means that the maximum packet size is now
> > VMBUS_DEFAULT_MAX_PKT_SIZE (4k). Apparently, this is not enough. I'm
> > observing a packet of 6304 bytes which is being truncated to 4096. When
> > VSS driver tries to read next packet from ring buffer it starts from the
> > wrong offset and receives garbage.
> > 
> > Set the maximum packet size to 'HV_HYP_PAGE_SIZE * 2' in VSS driver. This
> > matches the length of the receive buffer and is in line with other utils
> > drivers.
> > 
> > Fixes: adae1e931acd ("Drivers: hv: vmbus: Copy packets sent by Hyper-V out of the ring buffer")
> > Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
[...]
> 
> Reviewed-by: Michael Kelley <mikelley@microsoft.com>

Given we're really close to the merge window I'm going to apply this to
hyperv-next.

Wei.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-08-25 19:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-25 13:38 [PATCH] hv_utils: Set the maximum packet size for VSS driver to the length of the receive buffer Vitaly Kuznetsov
2021-08-25 18:33 ` Michael Kelley
2021-08-25 19:02   ` Wei Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).