All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH net-next] virtio-net: restrict build_skb() use to some arches
@ 2021-04-20 21:53 ` Guenter Roeck
  0 siblings, 0 replies; 7+ messages in thread
From: Guenter Roeck @ 2021-04-20 21:53 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: David S . Miller, Jakub Kicinski, netdev, Eric Dumazet,
	Xuan Zhuo, Jason Wang, Michael S. Tsirkin, virtualization

On Tue, Apr 20, 2021 at 01:01:44PM -0700, Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@google.com>
> 
> build_skb() is supposed to be followed by
> skb_reserve(skb, NET_IP_ALIGN), so that IP headers are word-aligned.
> (Best practice is to reserve NET_IP_ALIGN+NET_SKB_PAD, but the NET_SKB_PAD
> part is only a performance optimization if tunnel encaps are added.)
> 
> Unfortunately virtio_net has not provisioned this reserve.
> We can only use build_skb() for arches where NET_IP_ALIGN == 0
> 
> We might refine this later, with enough testing.
> 
> Fixes: fb32856b16ad ("virtio-net: page_to_skb() use build_skb when there's sufficient tailroom")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Reported-by: Guenter Roeck <linux@roeck-us.net>
> Cc: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
> Cc: Jason Wang <jasowang@redhat.com>
> Cc: "Michael S. Tsirkin" <mst@redhat.com>
> Cc: virtualization@lists.linux-foundation.org

Tested-by: Guenter Roeck <linux@roeck-us.net>

on alpha, sh4 (little endian).

Thanks!

Guenter

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

* Re: [PATCH net-next] virtio-net: restrict build_skb() use to some arches
@ 2021-04-20 21:53 ` Guenter Roeck
  0 siblings, 0 replies; 7+ messages in thread
From: Guenter Roeck @ 2021-04-20 21:53 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: Xuan Zhuo, Michael S. Tsirkin, netdev, virtualization,
	Eric Dumazet, Jakub Kicinski, David S . Miller

On Tue, Apr 20, 2021 at 01:01:44PM -0700, Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@google.com>
> 
> build_skb() is supposed to be followed by
> skb_reserve(skb, NET_IP_ALIGN), so that IP headers are word-aligned.
> (Best practice is to reserve NET_IP_ALIGN+NET_SKB_PAD, but the NET_SKB_PAD
> part is only a performance optimization if tunnel encaps are added.)
> 
> Unfortunately virtio_net has not provisioned this reserve.
> We can only use build_skb() for arches where NET_IP_ALIGN == 0
> 
> We might refine this later, with enough testing.
> 
> Fixes: fb32856b16ad ("virtio-net: page_to_skb() use build_skb when there's sufficient tailroom")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Reported-by: Guenter Roeck <linux@roeck-us.net>
> Cc: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
> Cc: Jason Wang <jasowang@redhat.com>
> Cc: "Michael S. Tsirkin" <mst@redhat.com>
> Cc: virtualization@lists.linux-foundation.org

Tested-by: Guenter Roeck <linux@roeck-us.net>

on alpha, sh4 (little endian).

Thanks!

Guenter
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

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

* Re: [PATCH net-next] virtio-net: restrict build_skb() use to some arches
  2021-04-20 20:01 ` Eric Dumazet
@ 2021-04-21  2:18   ` Jason Wang
  -1 siblings, 0 replies; 7+ messages in thread
From: Jason Wang @ 2021-04-21  2:18 UTC (permalink / raw)
  To: Eric Dumazet, David S . Miller, Jakub Kicinski
  Cc: netdev, Eric Dumazet, Guenter Roeck, Xuan Zhuo,
	Michael S. Tsirkin, virtualization


在 2021/4/21 上午4:01, Eric Dumazet 写道:
> From: Eric Dumazet <edumazet@google.com>
>
> build_skb() is supposed to be followed by
> skb_reserve(skb, NET_IP_ALIGN), so that IP headers are word-aligned.
> (Best practice is to reserve NET_IP_ALIGN+NET_SKB_PAD, but the NET_SKB_PAD
> part is only a performance optimization if tunnel encaps are added.)
>
> Unfortunately virtio_net has not provisioned this reserve.
> We can only use build_skb() for arches where NET_IP_ALIGN == 0
>
> We might refine this later, with enough testing.
>
> Fixes: fb32856b16ad ("virtio-net: page_to_skb() use build_skb when there's sufficient tailroom")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Reported-by: Guenter Roeck <linux@roeck-us.net>
> Cc: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
> Cc: Jason Wang <jasowang@redhat.com>
> Cc: "Michael S. Tsirkin" <mst@redhat.com>
> Cc: virtualization@lists.linux-foundation.org


Acked-by: Jason Wang <jasowang@redhat.com>


> ---
>   drivers/net/virtio_net.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index 2e28c04aa6351d2b4016f7d277ce104c4970069d..74d2d49264f3f3b7039be70331d4a44c53b8cc28 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -416,7 +416,7 @@ static struct sk_buff *page_to_skb(struct virtnet_info *vi,
>   
>   	shinfo_size = SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
>   
> -	if (len > GOOD_COPY_LEN && tailroom >= shinfo_size) {
> +	if (!NET_IP_ALIGN && len > GOOD_COPY_LEN && tailroom >= shinfo_size) {
>   		skb = build_skb(p, truesize);
>   		if (unlikely(!skb))
>   			return NULL;


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

* Re: [PATCH net-next] virtio-net: restrict build_skb() use to some arches
@ 2021-04-21  2:18   ` Jason Wang
  0 siblings, 0 replies; 7+ messages in thread
From: Jason Wang @ 2021-04-21  2:18 UTC (permalink / raw)
  To: Eric Dumazet, David S . Miller, Jakub Kicinski
  Cc: Xuan Zhuo, Michael S. Tsirkin, netdev, virtualization,
	Eric Dumazet, Guenter Roeck


在 2021/4/21 上午4:01, Eric Dumazet 写道:
> From: Eric Dumazet <edumazet@google.com>
>
> build_skb() is supposed to be followed by
> skb_reserve(skb, NET_IP_ALIGN), so that IP headers are word-aligned.
> (Best practice is to reserve NET_IP_ALIGN+NET_SKB_PAD, but the NET_SKB_PAD
> part is only a performance optimization if tunnel encaps are added.)
>
> Unfortunately virtio_net has not provisioned this reserve.
> We can only use build_skb() for arches where NET_IP_ALIGN == 0
>
> We might refine this later, with enough testing.
>
> Fixes: fb32856b16ad ("virtio-net: page_to_skb() use build_skb when there's sufficient tailroom")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Reported-by: Guenter Roeck <linux@roeck-us.net>
> Cc: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
> Cc: Jason Wang <jasowang@redhat.com>
> Cc: "Michael S. Tsirkin" <mst@redhat.com>
> Cc: virtualization@lists.linux-foundation.org


Acked-by: Jason Wang <jasowang@redhat.com>


> ---
>   drivers/net/virtio_net.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index 2e28c04aa6351d2b4016f7d277ce104c4970069d..74d2d49264f3f3b7039be70331d4a44c53b8cc28 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -416,7 +416,7 @@ static struct sk_buff *page_to_skb(struct virtnet_info *vi,
>   
>   	shinfo_size = SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
>   
> -	if (len > GOOD_COPY_LEN && tailroom >= shinfo_size) {
> +	if (!NET_IP_ALIGN && len > GOOD_COPY_LEN && tailroom >= shinfo_size) {
>   		skb = build_skb(p, truesize);
>   		if (unlikely(!skb))
>   			return NULL;

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

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

* Re: [PATCH net-next] virtio-net: restrict build_skb() use to some arches
  2021-04-20 20:01 ` Eric Dumazet
  (?)
@ 2021-04-21  0:00 ` patchwork-bot+netdevbpf
  -1 siblings, 0 replies; 7+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-04-21  0:00 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: davem, kuba, netdev, edumazet, linux, xuanzhuo, jasowang, mst,
	virtualization

Hello:

This patch was applied to netdev/net-next.git (refs/heads/master):

On Tue, 20 Apr 2021 13:01:44 -0700 you wrote:
> From: Eric Dumazet <edumazet@google.com>
> 
> build_skb() is supposed to be followed by
> skb_reserve(skb, NET_IP_ALIGN), so that IP headers are word-aligned.
> (Best practice is to reserve NET_IP_ALIGN+NET_SKB_PAD, but the NET_SKB_PAD
> part is only a performance optimization if tunnel encaps are added.)
> 
> [...]

Here is the summary with links:
  - [net-next] virtio-net: restrict build_skb() use to some arches
    https://git.kernel.org/netdev/net-next/c/f5d7872a8b8a

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



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

* [PATCH net-next] virtio-net: restrict build_skb() use to some arches
@ 2021-04-20 20:01 ` Eric Dumazet
  0 siblings, 0 replies; 7+ messages in thread
From: Eric Dumazet @ 2021-04-20 20:01 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski
  Cc: netdev, Eric Dumazet, Eric Dumazet, Guenter Roeck, Xuan Zhuo,
	Jason Wang, Michael S. Tsirkin, virtualization

From: Eric Dumazet <edumazet@google.com>

build_skb() is supposed to be followed by
skb_reserve(skb, NET_IP_ALIGN), so that IP headers are word-aligned.
(Best practice is to reserve NET_IP_ALIGN+NET_SKB_PAD, but the NET_SKB_PAD
part is only a performance optimization if tunnel encaps are added.)

Unfortunately virtio_net has not provisioned this reserve.
We can only use build_skb() for arches where NET_IP_ALIGN == 0

We might refine this later, with enough testing.

Fixes: fb32856b16ad ("virtio-net: page_to_skb() use build_skb when there's sufficient tailroom")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Guenter Roeck <linux@roeck-us.net>
Cc: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Cc: Jason Wang <jasowang@redhat.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: virtualization@lists.linux-foundation.org
---
 drivers/net/virtio_net.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 2e28c04aa6351d2b4016f7d277ce104c4970069d..74d2d49264f3f3b7039be70331d4a44c53b8cc28 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -416,7 +416,7 @@ static struct sk_buff *page_to_skb(struct virtnet_info *vi,
 
 	shinfo_size = SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
 
-	if (len > GOOD_COPY_LEN && tailroom >= shinfo_size) {
+	if (!NET_IP_ALIGN && len > GOOD_COPY_LEN && tailroom >= shinfo_size) {
 		skb = build_skb(p, truesize);
 		if (unlikely(!skb))
 			return NULL;
-- 
2.31.1.368.gbe11c130af-goog


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

* [PATCH net-next] virtio-net: restrict build_skb() use to some arches
@ 2021-04-20 20:01 ` Eric Dumazet
  0 siblings, 0 replies; 7+ messages in thread
From: Eric Dumazet @ 2021-04-20 20:01 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski
  Cc: Xuan Zhuo, Eric Dumazet, Michael S. Tsirkin, netdev,
	virtualization, Eric Dumazet, Guenter Roeck

From: Eric Dumazet <edumazet@google.com>

build_skb() is supposed to be followed by
skb_reserve(skb, NET_IP_ALIGN), so that IP headers are word-aligned.
(Best practice is to reserve NET_IP_ALIGN+NET_SKB_PAD, but the NET_SKB_PAD
part is only a performance optimization if tunnel encaps are added.)

Unfortunately virtio_net has not provisioned this reserve.
We can only use build_skb() for arches where NET_IP_ALIGN == 0

We might refine this later, with enough testing.

Fixes: fb32856b16ad ("virtio-net: page_to_skb() use build_skb when there's sufficient tailroom")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Guenter Roeck <linux@roeck-us.net>
Cc: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Cc: Jason Wang <jasowang@redhat.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: virtualization@lists.linux-foundation.org
---
 drivers/net/virtio_net.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 2e28c04aa6351d2b4016f7d277ce104c4970069d..74d2d49264f3f3b7039be70331d4a44c53b8cc28 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -416,7 +416,7 @@ static struct sk_buff *page_to_skb(struct virtnet_info *vi,
 
 	shinfo_size = SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
 
-	if (len > GOOD_COPY_LEN && tailroom >= shinfo_size) {
+	if (!NET_IP_ALIGN && len > GOOD_COPY_LEN && tailroom >= shinfo_size) {
 		skb = build_skb(p, truesize);
 		if (unlikely(!skb))
 			return NULL;
-- 
2.31.1.368.gbe11c130af-goog

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

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

end of thread, other threads:[~2021-04-21  2:19 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-20 21:53 [PATCH net-next] virtio-net: restrict build_skb() use to some arches Guenter Roeck
2021-04-20 21:53 ` Guenter Roeck
  -- strict thread matches above, loose matches on Subject: below --
2021-04-20 20:01 Eric Dumazet
2021-04-20 20:01 ` Eric Dumazet
2021-04-21  0:00 ` patchwork-bot+netdevbpf
2021-04-21  2:18 ` Jason Wang
2021-04-21  2:18   ` Jason Wang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.