From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753756AbaETO3D (ORCPT ); Tue, 20 May 2014 10:29:03 -0400 Received: from mail-pd0-f178.google.com ([209.85.192.178]:49440 "EHLO mail-pd0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751483AbaETO3A (ORCPT ); Tue, 20 May 2014 10:29:00 -0400 Message-ID: <1400596136.5367.125.camel@edumazet-glaptop2.roam.corp.google.com> Subject: Re: [PATCH] Fixed zero copy GSO without orphaning the fragments From: Eric Dumazet To: Igor Royzis Cc: "David S. Miller" , "Michael S. Tsirkin" , Eric Dumazet , Tom Herbert , Daniel Borkmann , Nicolas Dichtel , Simon Horman , Joe Perches , Jiri Pirko , Florian Westphal , Paul Durrant , Thomas Graf , Jan Beulich , Herbert Xu , Miklos Szeredi , linux-kernel , netdev , Anton Nayshtut Date: Tue, 20 May 2014 07:28:56 -0700 In-Reply-To: <1400585062-13580-1-git-send-email-igorr@swortex.com> References: <1400585062-13580-1-git-send-email-igorr@swortex.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.2.3-0ubuntu6 Content-Transfer-Encoding: 7bit Mime-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2014-05-20 at 14:24 +0300, Igor Royzis wrote: > Fix accessing GSO fragments memory (and a possible corruption therefore) after > reporting completion in a zero copy callback. The previous fix in the commit 1fd819ec > orphaned frags which eliminates zero copy advantages. The fix makes the completion > called after all the fragments were processed avoiding unnecessary orphaning/copying > from userspace. > > The GSO fragments corruption issue was observed in a typical QEMU/KVM VM setup that > hosts a Windows guest (since QEMU virtio-net Windows driver doesn't support GRO). > The fix has been verified by running the HCK OffloadLSO test. > > Signed-off-by: Igor Royzis > Signed-off-by: Anton Nayshtut > --- > include/linux/skbuff.h | 1 + > net/core/skbuff.c | 18 +++++++++++++----- > 2 files changed, 14 insertions(+), 5 deletions(-) > > diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h > index 08074a8..8c49edc 100644 > --- a/include/linux/skbuff.h > +++ b/include/linux/skbuff.h > @@ -287,6 +287,7 @@ struct skb_shared_info { > struct sk_buff *frag_list; > struct skb_shared_hwtstamps hwtstamps; > __be32 ip6_frag_id; > + struct sk_buff *zcopy_src; > Before your patch : sizeof(struct skb_shared_info)=0x140 offsetof(struct skb_shared_info, frags[1])=0x40 SKB_DATA_ALIGN(sizeof(struct skb_shared_info)) -> 0x140 After your patch : sizeof(struct skb_shared_info)=0x148 offsetof(struct skb_shared_info, frags[1])=0x48 SKB_DATA_ALIGN(sizeof(struct skb_shared_info)) -> 0x180 Thats a serious bump, because it increases all skb truesizes, and typical skb with one fragment will use 2 cache lines instead of one in struct skb_shared_info, so this adds memory pressure in fast path. So while this patch might increase performance for some workloads, it generally decreases performance on many others.