netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] virtio_net: lower limit on buffer size
@ 2017-06-01 23:56 Michael S. Tsirkin
  2017-06-02  1:57 ` J. Bruce Fields
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Michael S. Tsirkin @ 2017-06-01 23:56 UTC (permalink / raw)
  To: linux-kernel; +Cc: J. Bruce Fields, netdev, Mikulas Patocka, virtualization

commit d85b758f72b0 "virtio_net: fix support for small rings"
was supposed to increase the buffer size for small rings
but had an unintentional side effect of decreasing
it for large rings. This seems to break some setups -
it's not yet clear why, but increasing buffer size
back to what it was before helps.

Fixes: d85b758f72b0 "virtio_net: fix support for small rings"
Reported-by: Mikulas Patocka <mpatocka@redhat.com>
Reported-by: "J. Bruce Fields" <bfields@fieldses.org>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---

Can reporters please confirm whether the following helps?
If it does I think we should queue it even though I expect I'll need to
investigate the exact reasons for the failure down the road - probably
a hypervisor bug.

 drivers/net/virtio_net.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 87b5c20..60abb5d 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -842,7 +842,7 @@ static unsigned int get_mergeable_buf_len(struct receive_queue *rq,
 	unsigned int len;
 
 	len = hdr_len + clamp_t(unsigned int, ewma_pkt_len_read(avg_pkt_len),
-				rq->min_buf_len - hdr_len, PAGE_SIZE - hdr_len);
+				rq->min_buf_len, PAGE_SIZE - hdr_len);
 	return ALIGN(len, L1_CACHE_BYTES);
 }
 
@@ -2039,7 +2039,8 @@ static unsigned int mergeable_min_buf_len(struct virtnet_info *vi, struct virtqu
 	unsigned int buf_len = hdr_len + ETH_HLEN + VLAN_HLEN + packet_len;
 	unsigned int min_buf_len = DIV_ROUND_UP(buf_len, rq_size);
 
-	return max(min_buf_len, hdr_len);
+	return max(max(min_buf_len, hdr_len) - hdr_len,
+		   (unsigned int)GOOD_PACKET_LEN);
 }
 
 static int virtnet_find_vqs(struct virtnet_info *vi)
-- 
MST

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

* Re: [PATCH] virtio_net: lower limit on buffer size
  2017-06-01 23:56 [PATCH] virtio_net: lower limit on buffer size Michael S. Tsirkin
@ 2017-06-02  1:57 ` J. Bruce Fields
  2017-06-02  9:34 ` Sergei Shtylyov
  2017-06-02 13:16 ` Mikulas Patocka
  2 siblings, 0 replies; 7+ messages in thread
From: J. Bruce Fields @ 2017-06-02  1:57 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: linux-kernel, Mikulas Patocka, Jason Wang, virtualization, netdev

On Fri, Jun 02, 2017 at 02:56:04AM +0300, Michael S. Tsirkin wrote:
> commit d85b758f72b0 "virtio_net: fix support for small rings"
> was supposed to increase the buffer size for small rings
> but had an unintentional side effect of decreasing
> it for large rings. This seems to break some setups -
> it's not yet clear why, but increasing buffer size
> back to what it was before helps.
> 
> Fixes: d85b758f72b0 "virtio_net: fix support for small rings"
> Reported-by: Mikulas Patocka <mpatocka@redhat.com>
> Reported-by: "J. Bruce Fields" <bfields@fieldses.org>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
> 
> Can reporters please confirm whether the following helps?

Works for me.

--b.

> If it does I think we should queue it even though I expect I'll need to
> investigate the exact reasons for the failure down the road - probably
> a hypervisor bug.
> 
>  drivers/net/virtio_net.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index 87b5c20..60abb5d 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -842,7 +842,7 @@ static unsigned int get_mergeable_buf_len(struct receive_queue *rq,
>  	unsigned int len;
>  
>  	len = hdr_len + clamp_t(unsigned int, ewma_pkt_len_read(avg_pkt_len),
> -				rq->min_buf_len - hdr_len, PAGE_SIZE - hdr_len);
> +				rq->min_buf_len, PAGE_SIZE - hdr_len);
>  	return ALIGN(len, L1_CACHE_BYTES);
>  }
>  
> @@ -2039,7 +2039,8 @@ static unsigned int mergeable_min_buf_len(struct virtnet_info *vi, struct virtqu
>  	unsigned int buf_len = hdr_len + ETH_HLEN + VLAN_HLEN + packet_len;
>  	unsigned int min_buf_len = DIV_ROUND_UP(buf_len, rq_size);
>  
> -	return max(min_buf_len, hdr_len);
> +	return max(max(min_buf_len, hdr_len) - hdr_len,
> +		   (unsigned int)GOOD_PACKET_LEN);
>  }
>  
>  static int virtnet_find_vqs(struct virtnet_info *vi)
> -- 
> MST

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

* Re: [PATCH] virtio_net: lower limit on buffer size
  2017-06-01 23:56 [PATCH] virtio_net: lower limit on buffer size Michael S. Tsirkin
  2017-06-02  1:57 ` J. Bruce Fields
@ 2017-06-02  9:34 ` Sergei Shtylyov
  2017-06-02 20:25   ` J. Bruce Fields
  2017-06-02 13:16 ` Mikulas Patocka
  2 siblings, 1 reply; 7+ messages in thread
From: Sergei Shtylyov @ 2017-06-02  9:34 UTC (permalink / raw)
  To: Michael S. Tsirkin, linux-kernel
  Cc: J. Bruce Fields, netdev, Mikulas Patocka, virtualization

Hello!

On 6/2/2017 2:56 AM, Michael S. Tsirkin wrote:

> commit d85b758f72b0 "virtio_net: fix support for small rings"

    Commit d85b758f72b0 ("virtio_net: fix support for small rings")

> was supposed to increase the buffer size for small rings
> but had an unintentional side effect of decreasing
> it for large rings. This seems to break some setups -
> it's not yet clear why, but increasing buffer size
> back to what it was before helps.
>
> Fixes: d85b758f72b0 "virtio_net: fix support for small rings"

Fixes: d85b758f72b0 ("virtio_net: fix support for small rings")

> Reported-by: Mikulas Patocka <mpatocka@redhat.com>
> Reported-by: "J. Bruce Fields" <bfields@fieldses.org>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
[...]

MBR, Sergei

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

* Re: [PATCH] virtio_net: lower limit on buffer size
  2017-06-01 23:56 [PATCH] virtio_net: lower limit on buffer size Michael S. Tsirkin
  2017-06-02  1:57 ` J. Bruce Fields
  2017-06-02  9:34 ` Sergei Shtylyov
@ 2017-06-02 13:16 ` Mikulas Patocka
  2 siblings, 0 replies; 7+ messages in thread
From: Mikulas Patocka @ 2017-06-02 13:16 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: linux-kernel, J. Bruce Fields, Jason Wang, virtualization, netdev



On Fri, 2 Jun 2017, Michael S. Tsirkin wrote:

> commit d85b758f72b0 "virtio_net: fix support for small rings"
> was supposed to increase the buffer size for small rings
> but had an unintentional side effect of decreasing
> it for large rings. This seems to break some setups -
> it's not yet clear why, but increasing buffer size
> back to what it was before helps.
> 
> Fixes: d85b758f72b0 "virtio_net: fix support for small rings"
> Reported-by: Mikulas Patocka <mpatocka@redhat.com>
> Reported-by: "J. Bruce Fields" <bfields@fieldses.org>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
> 
> Can reporters please confirm whether the following helps?
> If it does I think we should queue it even though I expect I'll need to
> investigate the exact reasons for the failure down the road - probably
> a hypervisor bug.

Hi

This patch fixes the problem for me.

Mikulas

>  drivers/net/virtio_net.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index 87b5c20..60abb5d 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -842,7 +842,7 @@ static unsigned int get_mergeable_buf_len(struct receive_queue *rq,
>  	unsigned int len;
>  
>  	len = hdr_len + clamp_t(unsigned int, ewma_pkt_len_read(avg_pkt_len),
> -				rq->min_buf_len - hdr_len, PAGE_SIZE - hdr_len);
> +				rq->min_buf_len, PAGE_SIZE - hdr_len);
>  	return ALIGN(len, L1_CACHE_BYTES);
>  }
>  
> @@ -2039,7 +2039,8 @@ static unsigned int mergeable_min_buf_len(struct virtnet_info *vi, struct virtqu
>  	unsigned int buf_len = hdr_len + ETH_HLEN + VLAN_HLEN + packet_len;
>  	unsigned int min_buf_len = DIV_ROUND_UP(buf_len, rq_size);
>  
> -	return max(min_buf_len, hdr_len);
> +	return max(max(min_buf_len, hdr_len) - hdr_len,
> +		   (unsigned int)GOOD_PACKET_LEN);
>  }
>  
>  static int virtnet_find_vqs(struct virtnet_info *vi)
> -- 
> MST
> 

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

* Re: [PATCH] virtio_net: lower limit on buffer size
  2017-06-02  9:34 ` Sergei Shtylyov
@ 2017-06-02 20:25   ` J. Bruce Fields
  2017-06-03 20:17     ` Sergei Shtylyov
  0 siblings, 1 reply; 7+ messages in thread
From: J. Bruce Fields @ 2017-06-02 20:25 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: Michael S. Tsirkin, linux-kernel, Mikulas Patocka, Jason Wang,
	virtualization, netdev

On Fri, Jun 02, 2017 at 12:34:57PM +0300, Sergei Shtylyov wrote:
> Hello!
> 
> On 6/2/2017 2:56 AM, Michael S. Tsirkin wrote:
> 
> >commit d85b758f72b0 "virtio_net: fix support for small rings"
> 
>    Commit d85b758f72b0 ("virtio_net: fix support for small rings")
> 
> >was supposed to increase the buffer size for small rings
> >but had an unintentional side effect of decreasing
> >it for large rings. This seems to break some setups -
> >it's not yet clear why, but increasing buffer size
> >back to what it was before helps.
> >
> >Fixes: d85b758f72b0 "virtio_net: fix support for small rings"
> 
> Fixes: d85b758f72b0 ("virtio_net: fix support for small rings")

I may be bikeshedding, but, personally I never do the parens--they're
redundant given the quotes, and space is often tight.

--b.

> 
> >Reported-by: Mikulas Patocka <mpatocka@redhat.com>
> >Reported-by: "J. Bruce Fields" <bfields@fieldses.org>
> >Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> [...]
> 
> MBR, Sergei

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

* Re: [PATCH] virtio_net: lower limit on buffer size
  2017-06-02 20:25   ` J. Bruce Fields
@ 2017-06-03 20:17     ` Sergei Shtylyov
  2017-06-05 19:36       ` J. Bruce Fields
  0 siblings, 1 reply; 7+ messages in thread
From: Sergei Shtylyov @ 2017-06-03 20:17 UTC (permalink / raw)
  To: J. Bruce Fields
  Cc: Michael S. Tsirkin, linux-kernel, Mikulas Patocka, Jason Wang,
	virtualization, netdev

On 06/02/2017 11:25 PM, J. Bruce Fields wrote:

>>> commit d85b758f72b0 "virtio_net: fix support for small rings"
>>
>>    Commit d85b758f72b0 ("virtio_net: fix support for small rings")
>>
>>> was supposed to increase the buffer size for small rings
>>> but had an unintentional side effect of decreasing
>>> it for large rings. This seems to break some setups -
>>> it's not yet clear why, but increasing buffer size
>>> back to what it was before helps.
>>>
>>> Fixes: d85b758f72b0 "virtio_net: fix support for small rings"
>>
>> Fixes: d85b758f72b0 ("virtio_net: fix support for small rings")
>
> I may be bikeshedding, but, personally I never do the parens--they're
> redundant given the quotes, and space is often tight.

    Just see Documetation/process/submitting-patches.rst.

MBR, Sergei

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

* Re: [PATCH] virtio_net: lower limit on buffer size
  2017-06-03 20:17     ` Sergei Shtylyov
@ 2017-06-05 19:36       ` J. Bruce Fields
  0 siblings, 0 replies; 7+ messages in thread
From: J. Bruce Fields @ 2017-06-05 19:36 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: Michael S. Tsirkin, linux-kernel, Mikulas Patocka, Jason Wang,
	virtualization, netdev

On Sat, Jun 03, 2017 at 11:17:30PM +0300, Sergei Shtylyov wrote:
> On 06/02/2017 11:25 PM, J. Bruce Fields wrote:
> 
> >>>commit d85b758f72b0 "virtio_net: fix support for small rings"
> >>
> >>   Commit d85b758f72b0 ("virtio_net: fix support for small rings")
> >>
> >>>was supposed to increase the buffer size for small rings
> >>>but had an unintentional side effect of decreasing
> >>>it for large rings. This seems to break some setups -
> >>>it's not yet clear why, but increasing buffer size
> >>>back to what it was before helps.
> >>>
> >>>Fixes: d85b758f72b0 "virtio_net: fix support for small rings"
> >>
> >>Fixes: d85b758f72b0 ("virtio_net: fix support for small rings")
> >
> >I may be bikeshedding, but, personally I never do the parens--they're
> >redundant given the quotes, and space is often tight.
> 
>    Just see Documetation/process/submitting-patches.rst.

Yeah, I know, I claim it's a bad rule (but I'm too lazy to send a patch,
so, weight my opinion accordingly).

--b.

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

end of thread, other threads:[~2017-06-05 19:36 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-01 23:56 [PATCH] virtio_net: lower limit on buffer size Michael S. Tsirkin
2017-06-02  1:57 ` J. Bruce Fields
2017-06-02  9:34 ` Sergei Shtylyov
2017-06-02 20:25   ` J. Bruce Fields
2017-06-03 20:17     ` Sergei Shtylyov
2017-06-05 19:36       ` J. Bruce Fields
2017-06-02 13:16 ` Mikulas Patocka

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).