* [PATCH] openvswitch: orphan frags on local receive
@ 2014-02-24 13:15 Qin Chuanyu
2014-02-24 13:30 ` Michael S. Tsirkin
2014-02-24 14:45 ` Zoltan Kiss
0 siblings, 2 replies; 4+ messages in thread
From: Qin Chuanyu @ 2014-02-24 13:15 UTC (permalink / raw)
To: davem, Michael S. Tsirkin; +Cc: KVM list, netdev
with vhost tx zero_copy, guest nic might get hang when host reserving
skb in socket queue delivered by guest, the case has been solved in
tun, it also been needed by openvswitch. This could easily happened
when a LAST_ACK state tcp occuring between guest and host.
Signed-off-by: Chuanyu Qin <qinchuanyu@huawei.com>
---
net/openvswitch/vport-internal_dev.c | 3 +++
net/openvswitch/vport.c | 1 +
2 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/net/openvswitch/vport-internal_dev.c
b/net/openvswitch/vport-internal_dev.c
index 729c687..adb25e2 100644
--- a/net/openvswitch/vport-internal_dev.c
+++ b/net/openvswitch/vport-internal_dev.c
@@ -212,6 +212,9 @@ static int internal_dev_recv(struct vport *vport,
struct sk_buff *skb)
struct net_device *netdev = netdev_vport_priv(vport)->dev;
int len;
+ if (unlikely(skb_orphan_frags(skb, GFP_ATOMIC)))
+ return -NET_RX_DROP;
+
len = skb->len;
skb_dst_drop(skb);
diff --git a/net/openvswitch/vport.c b/net/openvswitch/vport.c
index 208dd9a..04172d6 100644
--- a/net/openvswitch/vport.c
+++ b/net/openvswitch/vport.c
@@ -383,6 +383,7 @@ int ovs_vport_send(struct vport *vport, struct
sk_buff *skb)
u64_stats_update_end(&stats->syncp);
} else if (sent < 0) {
ovs_vport_record_error(vport, VPORT_E_TX_ERROR);
+ skb_tx_error(skb);
kfree_skb(skb);
} else
ovs_vport_record_error(vport, VPORT_E_TX_DROPPED);
--
1.7.3.1.msysgit.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] openvswitch: orphan frags on local receive
2014-02-24 13:15 [PATCH] openvswitch: orphan frags on local receive Qin Chuanyu
@ 2014-02-24 13:30 ` Michael S. Tsirkin
2014-02-24 14:45 ` Zoltan Kiss
1 sibling, 0 replies; 4+ messages in thread
From: Michael S. Tsirkin @ 2014-02-24 13:30 UTC (permalink / raw)
To: Qin Chuanyu; +Cc: davem, KVM list, netdev
On Mon, Feb 24, 2014 at 09:15:12PM +0800, Qin Chuanyu wrote:
> with vhost tx zero_copy, guest nic might get hang when host reserving
> skb in socket queue delivered by guest, the case has been solved in
> tun, it also been needed by openvswitch. This could easily happened
> when a LAST_ACK state tcp occuring between guest and host.
>
> Signed-off-by: Chuanyu Qin <qinchuanyu@huawei.com>
Same question as with bridge.
> ---
> net/openvswitch/vport-internal_dev.c | 3 +++
> net/openvswitch/vport.c | 1 +
> 2 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/net/openvswitch/vport-internal_dev.c
> b/net/openvswitch/vport-internal_dev.c
> index 729c687..adb25e2 100644
> --- a/net/openvswitch/vport-internal_dev.c
> +++ b/net/openvswitch/vport-internal_dev.c
> @@ -212,6 +212,9 @@ static int internal_dev_recv(struct vport
> *vport, struct sk_buff *skb)
> struct net_device *netdev = netdev_vport_priv(vport)->dev;
> int len;
>
> + if (unlikely(skb_orphan_frags(skb, GFP_ATOMIC)))
> + return -NET_RX_DROP;
> +
> len = skb->len;
>
> skb_dst_drop(skb);
> diff --git a/net/openvswitch/vport.c b/net/openvswitch/vport.c
> index 208dd9a..04172d6 100644
> --- a/net/openvswitch/vport.c
> +++ b/net/openvswitch/vport.c
> @@ -383,6 +383,7 @@ int ovs_vport_send(struct vport *vport, struct
> sk_buff *skb)
> u64_stats_update_end(&stats->syncp);
> } else if (sent < 0) {
> ovs_vport_record_error(vport, VPORT_E_TX_ERROR);
> + skb_tx_error(skb);
> kfree_skb(skb);
> } else
> ovs_vport_record_error(vport, VPORT_E_TX_DROPPED);
> --
> 1.7.3.1.msysgit.0
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] openvswitch: orphan frags on local receive
2014-02-24 13:15 [PATCH] openvswitch: orphan frags on local receive Qin Chuanyu
2014-02-24 13:30 ` Michael S. Tsirkin
@ 2014-02-24 14:45 ` Zoltan Kiss
2014-02-25 2:07 ` Qin Chuanyu
1 sibling, 1 reply; 4+ messages in thread
From: Zoltan Kiss @ 2014-02-24 14:45 UTC (permalink / raw)
To: Qin Chuanyu, davem, Michael S. Tsirkin; +Cc: KVM list, netdev
Hi,
I'm also planning a similar patch, but it will call skb_orphan_frags on
the skb in datapath.c::queue_userspace_packet, right before
skb_zerocopy, so packets sent up to userspace via Netlink doesn't harm
guests. I haven't checked your patch thoroughly, does it handle a
different scenario?
Regards,
Zoltan Kiss
On 24/02/14 13:15, Qin Chuanyu wrote:
> with vhost tx zero_copy, guest nic might get hang when host reserving
> skb in socket queue delivered by guest, the case has been solved in
> tun, it also been needed by openvswitch. This could easily happened
> when a LAST_ACK state tcp occuring between guest and host.
>
> Signed-off-by: Chuanyu Qin <qinchuanyu@huawei.com>
> ---
> net/openvswitch/vport-internal_dev.c | 3 +++
> net/openvswitch/vport.c | 1 +
> 2 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/net/openvswitch/vport-internal_dev.c
> b/net/openvswitch/vport-internal_dev.c
> index 729c687..adb25e2 100644
> --- a/net/openvswitch/vport-internal_dev.c
> +++ b/net/openvswitch/vport-internal_dev.c
> @@ -212,6 +212,9 @@ static int internal_dev_recv(struct vport *vport,
> struct sk_buff *skb)
> struct net_device *netdev = netdev_vport_priv(vport)->dev;
> int len;
>
> + if (unlikely(skb_orphan_frags(skb, GFP_ATOMIC)))
> + return -NET_RX_DROP;
> +
> len = skb->len;
>
> skb_dst_drop(skb);
> diff --git a/net/openvswitch/vport.c b/net/openvswitch/vport.c
> index 208dd9a..04172d6 100644
> --- a/net/openvswitch/vport.c
> +++ b/net/openvswitch/vport.c
> @@ -383,6 +383,7 @@ int ovs_vport_send(struct vport *vport, struct
> sk_buff *skb)
> u64_stats_update_end(&stats->syncp);
> } else if (sent < 0) {
> ovs_vport_record_error(vport, VPORT_E_TX_ERROR);
> + skb_tx_error(skb);
> kfree_skb(skb);
> } else
> ovs_vport_record_error(vport, VPORT_E_TX_DROPPED);
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] openvswitch: orphan frags on local receive
2014-02-24 14:45 ` Zoltan Kiss
@ 2014-02-25 2:07 ` Qin Chuanyu
0 siblings, 0 replies; 4+ messages in thread
From: Qin Chuanyu @ 2014-02-25 2:07 UTC (permalink / raw)
To: Zoltan Kiss, davem, Michael S. Tsirkin; +Cc: KVM list, netdev
On 2014/2/24 22:45, Zoltan Kiss wrote:
> Hi,
>
> I'm also planning a similar patch, but it will call skb_orphan_frags on
> the skb in datapath.c::queue_userspace_packet, right before
> skb_zerocopy, so packets sent up to userspace via Netlink doesn't harm
> guests. I haven't checked your patch thoroughly, does it handle a
> different scenario?
>
yes, it handle another scenario, and Michael had noted that
__netif_receive_skb_core could solve it.
I think your patch is still needed, because netif_receive_skb didn't
handle the netlink receive patch. and any skb reserved by host socket
queue might cause guest nic hang.
> Regards,
>
> Zoltan Kiss
>
> On 24/02/14 13:15, Qin Chuanyu wrote:
>> with vhost tx zero_copy, guest nic might get hang when host reserving
>> skb in socket queue delivered by guest, the case has been solved in
>> tun, it also been needed by openvswitch. This could easily happened
>> when a LAST_ACK state tcp occuring between guest and host.
>>
>> Signed-off-by: Chuanyu Qin <qinchuanyu@huawei.com>
>> ---
>> net/openvswitch/vport-internal_dev.c | 3 +++
>> net/openvswitch/vport.c | 1 +
>> 2 files changed, 4 insertions(+), 0 deletions(-)
>>
>> diff --git a/net/openvswitch/vport-internal_dev.c
>> b/net/openvswitch/vport-internal_dev.c
>> index 729c687..adb25e2 100644
>> --- a/net/openvswitch/vport-internal_dev.c
>> +++ b/net/openvswitch/vport-internal_dev.c
>> @@ -212,6 +212,9 @@ static int internal_dev_recv(struct vport *vport,
>> struct sk_buff *skb)
>> struct net_device *netdev = netdev_vport_priv(vport)->dev;
>> int len;
>>
>> + if (unlikely(skb_orphan_frags(skb, GFP_ATOMIC)))
>> + return -NET_RX_DROP;
>> +
>> len = skb->len;
>>
>> skb_dst_drop(skb);
>> diff --git a/net/openvswitch/vport.c b/net/openvswitch/vport.c
>> index 208dd9a..04172d6 100644
>> --- a/net/openvswitch/vport.c
>> +++ b/net/openvswitch/vport.c
>> @@ -383,6 +383,7 @@ int ovs_vport_send(struct vport *vport, struct
>> sk_buff *skb)
>> u64_stats_update_end(&stats->syncp);
>> } else if (sent < 0) {
>> ovs_vport_record_error(vport, VPORT_E_TX_ERROR);
>> + skb_tx_error(skb);
>> kfree_skb(skb);
>> } else
>> ovs_vport_record_error(vport, VPORT_E_TX_DROPPED);
>
>
> .
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-02-25 2:08 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-24 13:15 [PATCH] openvswitch: orphan frags on local receive Qin Chuanyu
2014-02-24 13:30 ` Michael S. Tsirkin
2014-02-24 14:45 ` Zoltan Kiss
2014-02-25 2:07 ` Qin Chuanyu
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).