From mboxrd@z Thu Jan 1 00:00:00 1970 From: Madalin-cristian Bucur Subject: RE: Explaining the XDP page-requirement (Was: [PATCH v2 net-next 0/8] dpaa2-eth: Introduce XDP support) Date: Wed, 9 Jan 2019 14:22:56 +0000 Message-ID: References: <1543249591-14563-1-git-send-email-ruxandra.radulescu@nxp.com> <20181205164502.5b11ff7e@redhat.com> <20181207172016.GA21965@apalos> <20181207175135.GA22649@apalos> <20181221163119.3fbef5dc@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Cc: Ilias Apalodimas , "netdev@vger.kernel.org" , "davem@davemloft.net" , Ioana Ciornei , "dsahern@gmail.com" , Camelia Alexandra Groza To: Jesper Dangaard Brouer , Ioana Ciocoi Radulescu Return-path: Received: from mail-eopbgr70087.outbound.protection.outlook.com ([40.107.7.87]:35648 "EHLO EUR04-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730017AbfAIOXD (ORCPT ); Wed, 9 Jan 2019 09:23:03 -0500 In-Reply-To: <20181221163119.3fbef5dc@redhat.com> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: > -----Original Message----- > From: netdev-owner@vger.kernel.org On > Behalf Of Jesper Dangaard Brouer > Sent: Friday, December 21, 2018 5:31 PM > To: Ioana Ciocoi Radulescu > Cc: Ilias Apalodimas ; > netdev@vger.kernel.org; davem@davemloft.net; Ioana Ciornei > ; dsahern@gmail.com; Camelia Alexandra Groza > ; brouer@redhat.com > Subject: Explaining the XDP page-requirement (Was: [PATCH v2 net-next 0/8= ] > dpaa2-eth: Introduce XDP support) >=20 > On Fri, 7 Dec 2018 18:07:49 +0000 > Ioana Ciocoi Radulescu wrote: >=20 > > Thanks a lot for the info, will look into this. Do you have any > > pointers as to why the full page restriction exists in the first > > place? Sorry if it's a dumb question, but I haven't found details on > > this and I'd really like to understand it. >=20 > Hi Ioana, >=20 > I promised (offlist) that I would get back to you explaining the XDP > page-requirement... >=20 > There are several reasons for XDP to require frames are backed by a > page. It started out with a focus on gaining speed via simplicity. >=20 > The overall requirement is: XDP frame in physical contigious memory > - which is a requirement from BPF Direct-Access, for validating > correcness. > - Implying you cannot split packet data over several pages. >=20 > An important part of the page-requirement is to allow creating SKB's > outside the driver code. This happen today in both cpumap and veth > (when doing XDP_REDIRECT). And we need to control and limit the > variations, to avoid having to handle all kind of SKB schemes. > Specifically we need enough tailroom for the skb-shared-info. >=20 > In the beginning we had the requirement of: 1-page per XDP frame. > - Gave us a simplified memory model > - Allow us to not touch atomic refcnt on page (always 1) > - Fixed 256 bytes headroom > - This gave us a lot of tailroom, expanding tail was trivial. >=20 > Eventually ixgbe+i40e force us to use a split-page model, allowing two > frames per page. > - This started to complicate memory model > - This unfortunately gave issue of unknown tailroom, which killed the > tailroom expand option. > - Changes XDP headroom to be variable (192 or 256 bytes) Hi Jesper, is the split page memory model supported now (with two frames per page)? Thanks, Madalin > E.g. I really want to allow bpf_xdp_adjust_tail() to *expand* the > frame size, but after allowing the split-page model, we couldn't allow > this easily. And SKB alloc in cpumap/veth was also complicated by not > knowing (implicit) xdp_frame "hard-end". (We might have to extend > xdp_buff with "data_hard_end"). >=20 > -- > Best regards, > Jesper Dangaard Brouer > MSc.CS, Principal Kernel Engineer at Red Hat > LinkedIn: > https://emea01.safelinks.protection.outlook.com/?url=3Dhttp%3A%2F%2Fwww.l= ink > edin.com%2Fin%2Fbrouer&data=3D02%7C01%7Cmadalin.bucur%40nxp.com%7C44c= 593 > 0f8a224fdd063208d66759613b%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C6= 3 > 6810030928918215&sdata=3DPIdwIEvOAPlyWPScMjOdWiauOp2wAI7QXu9FNJ0SHzs%= 3D& > amp;reserved=3D0