From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0083.outbound.protection.outlook.com [104.47.33.83]) by dpdk.org (Postfix) with ESMTP id AE9845680 for ; Tue, 25 Oct 2016 13:53:05 +0200 (CEST) Received: from DM2PR03CA0026.namprd03.prod.outlook.com (10.141.96.25) by BY2PR0301MB1623.namprd03.prod.outlook.com (10.163.28.29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.669.16; Tue, 25 Oct 2016 11:53:04 +0000 Received: from BY2FFO11FD020.protection.gbl (2a01:111:f400:7c0c::111) by DM2PR03CA0026.outlook.office365.com (2a01:111:e400:2428::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.679.12 via Frontend Transport; Tue, 25 Oct 2016 11:53:04 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=fail action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BY2FFO11FD020.mail.protection.outlook.com (10.1.14.137) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.669.7 via Frontend Transport; Tue, 25 Oct 2016 11:53:03 +0000 Received: from [10.232.14.87] ([10.232.14.87]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id u9PBqv2t005038; Tue, 25 Oct 2016 04:53:00 -0700 To: Bruce Richardson References: <98CBD80474FA8B44BF855DF32C47DC359EA8B1@smartserver.smartshare.dk> <7910CF2F-7087-4307-A9AC-DE0287104185@intel.com> <20161024162538.GA34988@bricha3-MOBL3.ger.corp.intel.com> CC: "Wiles, Keith" , =?UTF-8?Q?Morten_Br=c3=b8rup?= , "dev@dpdk.org" , Olivier Matz From: Shreyansh Jain Message-ID: Date: Tue, 25 Oct 2016 17:24:28 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20161024162538.GA34988@bricha3-MOBL3.ger.corp.intel.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-Matching-Connectors: 131218699838858672; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(7916002)(2980300002)(1109001)(1110001)(339900001)(3190300001)(377454003)(189002)(52314003)(24454002)(199003)(586003)(85426001)(64126003)(8676002)(36756003)(221733001)(47776003)(15395725005)(65956001)(2870700001)(65806001)(83506001)(7116003)(23676002)(626004)(97736004)(68736007)(50466002)(5660300001)(4001350100001)(110136003)(189998001)(65826007)(2906002)(6916009)(2950100002)(6666003)(4326007)(87936001)(76176999)(7846002)(11100500001)(104016004)(86362001)(8936002)(77096005)(15975445007)(54356999)(305945005)(356003)(81156014)(33646002)(561944003)(106466001)(19580395003)(3480700004)(50986999)(19580405001)(92566002)(81166006)(105606002)(31686004)(31696002)(111123002); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR0301MB1623; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD020; 1:U5+MPRTMdWgeIfO988kELL7PcsbXH5/NL+yIsK4z63aX+H6XCrQLUPcvQ0OlJ9jQQD3s7epewJvtK28Ge33d8vl0zvSgvYsykFtdOZTXTA72BDfYcEmsoaEre68hwkKU1/JuyLS26SwQtX7VJbH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809HpemULH0EJ8fT/G8akL7hES X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY2PR0301MB1623; X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB1623; 25:o201nUNUfQGgOn1L2FivU4RHxBX8IBEDUDlG4WGkRVw7Fk/wNVq1T3QPcBvWDhzJrnZ/RYKsu5Gfuj+u/airwU2gNf/IyEr9JXIkp1w9/s5tleBDBYgb5GBy2uZEsc9j6bon610gRWFdwWup0W9rVE4e6W7m3NOtj/mfIu9Q24GQ+dqkjSdUq2+0NCf5qfRFaCirN7DQEjd000LRCwLtSZrk+59nu//6Y75KmpjW+LzEFQrpUlZfJtz+npsHhdDFy5R7kElP1HzTgwlLypqX2HyKlAJv0NRBJmm4WTJepxKM6FfSguWetToBLyrK4rNyTk2ioO7btqW/+5qZ0bX0K95MshRBPzdxhBGcvfObR1m3NkMhFfPTn1x4Au5nFsVQgQxqWl0ColD/YtuZVcMB8W0sElaYCaZu7c/MZK6LmJCoaNmluk8RdBVJQYTpvZppassdaFiJOwXFWVrtOZUyR92uFShs/A/F5msTFwstlSveCqx/c/jDtwF4ybF9TwNSWT1duVeyGTSS0XwSk7DWbMbiRHWVw/5/zdbGd4VEap7DfbByxZef/W/0WFFjbHQv7t4ZGbOr1mj9w2YTVMnRUpiMG2l0sOoW8u4IqXOfE8iYFqevQZQi0JnN208acayumXpyrQmPR1c2LgRyrDrIN2ciJbgbaBsXkNw6N9UkhUeb2sTl6zwL0u5aG1Cf6UHD/ReZp4mnJdGmgOPs8tT8U2iBd2pP1j38nvw2RIPYnxZ1RsiKxt6OP+5H4tmx3Kjh2ujJwxuE2Ed+8aDVgERUAxyyVFZpsjIAbIhM8PBUj4fSVD6njda42fkg0gy6PDB87rs2KLcujH5zqYua9feb40DzJtsinmjY1m442jUJC20= X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB1623; 31:xU46XRMf+ctAObE/fTmHS7CPQRh9+CxjgTrpZsRUi2DSKNc0GioGeZwjMo478yrTRF/TFAKQPFemw1c8EDTeRcNOiXkvYkdBNz8/TWpK/FagfjBw5AtESok+b8ec0IgStyxUxtlJ4Z6nzO2z2H0PdzkLehUfoVDDmm9HVF4Y2KwS+uErGF8/9D083w8Kw9QQOfj5GzwW4Ho4zVqD7dEoSNQU1R/QSPGk2IlIRGqkjp+MucbTqZmuwzQfQLN7Ynoa7C9qxhIfzeUV0s51zPWgfP1zWHaN3mZpMOdcp7BWHaU=; 4:d0Ymj1EuqLqr7C0hhjRoXc4uGnskgekRmP5ztpJN2p40wDawbJeT6m/ovnB+bei+ze2eBPMSk3tMw8lC1H3DBmBP26B2Vx7o5Wx0nDz3kgGXcUiAdFk3ko18cqU7DPC9V6nM/nHEcJSe+Jbp6V7hVBySsHIzljCRFU9WJQ2h8y0Medjz+t00iYjTCAN88VSLzev8/oq/m6A/CKUHGO+J4DnhZ9KENS3qAmEOWy0OcHXOkgBTpObXkf/cSNR13Fc+OvyrcRjvJC+5N8SC0DDXvkyYhVZHxa4A6KqWZubxqCHFk4u7Vk5zWRHy9/eIN/JFanjcSn2mY/HP2PJoEdM14+wTf9QFtTNfVEKpLeKM8YlVz1mVAG9ReRpxIC5AIafYjBpAFAFYf5o9lSDt6TxHnztZY85Nd2tBY57TvliTced0iaQid2Bz/thYPSxnsnTETDk/qRB6fHWN5aCyclPSmGNBoiar7LNbtOWpTIu/bGPNSvh5k4KnCDs1kpB0W5mmh6j9zZprm4/f0NUiWvT//F0r0SFmcorL3t/zxoP2XUVMk7BzyJoqGTHpbdhyHBtYgGEZt/L5wKEDARGhkaDAbQ== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(158342451672863)(100405760836317); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(5005006)(13023025)(13015025)(13024025)(8121501046)(13018025)(13017025)(10201501046)(3002001)(6055026); SRVR:BY2PR0301MB1623; BCL:0; PCL:0; RULEID:(400006); SRVR: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WsTZdrfK2h2KbQhJXoWxAe5RM8a+8Oz/E1iUn1cK4yqZJcI3x7EJbVy0Q= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB1623; 7:qWZHY4+qGHVd1G3qM9fp4MHWvemPzk41o0g+fZSN1hvNygF4Eruc9zrey4fWUzOcRtPNtnwOptKh9Wx0tldwd2PB3Ytmz8M1zPpn1jLALgi5LyBa7uCaKI+NM5Gc6Wbq6GvCiLhetY8RMzYA1XucU0aC5aC4XcV/o1k0wntKsyYdLkx9mYaYvMQ3vmN9ovhLhbeFv49yAkYI1snbiUZMMU6kGxt3YXI7thWPALNe4XnZ79KAWw1q5s4Fa/qC0GwQ8wEiynitFwolgJe2EetpD5K36x8sXA7hB7nqfGEw2ryzGkPUcFxKZewDYfGRG0cRhIAR/Pq66nXH/84jFZdL3UHYou831OjP1J0/fAjXOOI= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2016 11:53:03.5114 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR0301MB1623 Subject: Re: [dpdk-dev] mbuf changes X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Oct 2016 11:53:06 -0000 On Monday 24 October 2016 09:55 PM, Bruce Richardson wrote: > On Mon, Oct 24, 2016 at 04:11:33PM +0000, Wiles, Keith wrote: >> >>> On Oct 24, 2016, at 10:49 AM, Morten Brørup wrote: >>> >>> First of all: Thanks for a great DPDK Userspace 2016! >>> >>> >>> >>> Continuing the Userspace discussion about Olivier Matz’s proposed mbuf changes... > > Thanks for keeping the discussion going! >>> >>> >>> >>> 1. >>> >>> Stephen Hemminger had a noteworthy general comment about keeping metadata for the NIC in the appropriate section of the mbuf: Metadata generated by the NIC’s RX handler belongs in the first cache line, and metadata required by the NIC’s TX handler belongs in the second cache line. This also means that touching the second cache line on ingress should be avoided if possible; and Bruce Richardson mentioned that for this reason m->next was zeroed on free(). >>> > Thinking about it, I suspect there are more fields we can reset on free > to save time on alloc. Refcnt, as discussed below is one of them, but so > too could be the nb_segs field and possibly others. > >>> >>> >>> 2. >>> >>> There seemed to be consensus that the size of m->refcnt should match the size of m->port because a packet could be duplicated on all physical ports for L3 multicast and L2 flooding. >>> >>> Furthermore, although a single physical machine (i.e. a single server) with 255 physical ports probably doesn’t exist, it might contain more than 255 virtual machines with a virtual port each, so it makes sense extending these mbuf fields from 8 to 16 bits. >> >> I thought we also talked about removing the m->port from the mbuf as it is not really needed. >> > Yes, this was mentioned, and also the option of moving the port value to > the second cacheline, but it appears that NXP are using the port value > in their NIC drivers for passing in metadata, so we'd need their > agreement on any move (or removal). I am not sure where NXP's NIC came into picture on this, but now that it is highlighted, this field is required for libevent implementation [1]. A scheduler sending an event, which can be a packet, would only have information of a flow_id. From this matching it back to a port, without mbuf->port, would be very difficult (costly). There may be way around this but at least in current proposal I think port would be important to have - even if in second cache line. But, off the top of my head, as of now it is not being used for any specific purpose in NXP's PMD implementation. Even the SoC patches don't necessarily rely on it except using it because it is available. @Bruce: where did you get the NXP context here from? [1] http://dpdk.org/ml/archives/dev/2016-October/048592.html > >>> >>> >>> >>> 3. >>> >>> Someone (Bruce Richardson?) suggested moving m->refcnt and m->port to the second cache line, which then generated questions from the audience about the real life purpose of m->port, and if m->port could be removed from the mbuf structure. >>> >>> >>> >>> 4. >>> >>> I suggested using offset -1 for m->refcnt, so m->refcnt becomes 0 on first allocation. This is based on the assumption that other mbuf fields must be zeroed at alloc()/free() anyway, so zeroing m->refcnt is cheaper than setting it to 1. >>> >>> Furthermore (regardless of m->refcnt offset), I suggested that it is not required to modify m->refcnt when allocating and freeing the mbuf, thus saving one write operation on both alloc() and free(). However, this assumes that m->refcnt debugging, e.g. underrun detection, is not required. > > I don't think it really matters what sentinal value is used for the > refcnt because it can't be blindly assigned on free like other fields. > However, I think 0 as first reference value becomes more awkward > than 1, because we need to deal with underflow. Consider the situation > where we have two references to the mbuf, so refcnt is 1, and both are > freed at the same time. Since the refcnt is not-zero, then both cores > will do an atomic decrement simultaneously giving a refcnt of -1. We can > then set this back to zero before freeing, however, I'd still prefer to > have refcnt be an accurate value so that it always stays positive, and > we can still set it to "one" on free to avoid having to set on alloc. > > Also, if we set refcnt on free rather than alloc, it does set itself up > as a good candidate for moving to the second cacheline. Fast-path > processing does not normally update the value. > >>> >>> >>> >>> 5. >>> >>> And here’s something new to think about: >>> >>> m->next already reveals if there are more segments to a packet. Which purpose does m->nb_segs serve that is not already covered by m->next? > > It is duplicate info, but nb_segs can be used to check the validity of > the next pointer without having to read the second mbuf cacheline. > > Whether it's worth having is something I'm happy enough to discuss, > though. > > One other point I'll mention is that we need to have a discussion on > how/where to add in a timestamp value into the mbuf. Personally, I think > it can be in a union with the sequence number value, but I also suspect > that 32-bits of a timestamp is not going to be enough for many. > > Thoughts? > > /Bruce > -- - Shreyansh