From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id CBC3BA054F; Mon, 15 Mar 2021 18:38:57 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9512E242752; Mon, 15 Mar 2021 18:38:57 +0100 (CET) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id 235074069F; Mon, 15 Mar 2021 18:38:55 +0100 (CET) IronPort-SDR: qPLYHIl/Kx5Ec1VeIAWM31a7x6X0brmjHolz9a1D7UhAyW2Ez7MM/Y1s3mfOK2uBpBMpuzX7uL isx/R6AcQYBA== X-IronPort-AV: E=McAfee;i="6000,8403,9924"; a="209037796" X-IronPort-AV: E=Sophos;i="5.81,251,1610438400"; d="scan'208";a="209037796" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Mar 2021 10:38:50 -0700 IronPort-SDR: DU6gRPn3dtqOQdfkON0pi6hcU8i8aqm7GeNc2iKiS0pw5Dk9eeaYllCIF4PilLjJFBqQ6ndIVI Hf6HcjYweK1w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,251,1610438400"; d="scan'208";a="410725018" Received: from fmsmsx605.amr.corp.intel.com ([10.18.126.85]) by orsmga007.jf.intel.com with ESMTP; 15 Mar 2021 10:38:48 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx605.amr.corp.intel.com (10.18.126.85) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Mon, 15 Mar 2021 10:38:48 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Mon, 15 Mar 2021 10:38:48 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2 via Frontend Transport; Mon, 15 Mar 2021 10:38:48 -0700 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.170) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2106.2; Mon, 15 Mar 2021 10:38:44 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=S+naCP1OqLbe5B/s5vpFsF1M/E/JReDCM1mXUA+JO4VDFPmK7QGtX90I9g0IuVasym8MZ6bTfWlQBNsAOA1fYHi+hprD6BI5KtpXQa6mW5qmJjgCnRKttyyku8El4Jw5g0MuqiT8dJ/VZabH+oyFaqJcN1JQ3MWVaXtOc8CSnFnP/czRV9doJKLChD8hI+khke1tbqIN34d6pLk81iMlbw59FyIfKbBEErA28AzTfftpduvPY3guhaqvBKxDptBrPL2+VMhqv0Ew9DYAmnYsn3+tsWa59Rb6qJvsgDhQApVtp6ebE0uGofhiueJAJB+rcz7SJ/FuSHUt4B+W3Y7G4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=L2jPZZ4SXPpgEHbl5prN5TCCsykVGRIhQP4sUvA6euo=; b=PRDYsXLVjA/Q/HUqTaELl6a0FrzkrJsDXJ/AhCruDQrL5PPaQTCwrYPOb/pxEfsADNpOknu3omASu4sI6OedxTfg/Mytteire+2grgbHXBDlMDuOvTPJtAJn//q8xVlvLAssjP34zSh8nEBZln3jdkbk1Hf4R6CvIypNkpIhxRfK2rpMa1X5cTci7sBsXWMLe425ASiVsSGuuXgb1kV2PGhRSTRNOGNjFExLgWsy0epGujwBQcY134LzDSOoq4qv/TW3ffKj6RqGo9qRtPeSQxAJQ+F1+BhFmWlIaJw9KG02tuNIXITyVOCpW5jG/wWgfzNSO6D+RHRNnnh+4uwFjA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=L2jPZZ4SXPpgEHbl5prN5TCCsykVGRIhQP4sUvA6euo=; b=WT0i5m0kNuhGBQkGXL0ELc7/Bv284c//SakZMQjpuLMifXq9RSj025nnz1FOgGYiA+yOUsYruhmA6rYxn/dpUkoEH6lAul3Ln3maxd07JVzNJYK0kImyID5GKjMrV5BWrnosxvzSwBSaBAPkHZ9scy9u0c1wbFYFARI7lXHR3WQ= Received: from MN2PR11MB3550.namprd11.prod.outlook.com (2603:10b6:208:ee::21) by MN2PR11MB3728.namprd11.prod.outlook.com (2603:10b6:208:f4::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3933.32; Mon, 15 Mar 2021 17:38:40 +0000 Received: from MN2PR11MB3550.namprd11.prod.outlook.com ([fe80::8824:3385:f40b:a60d]) by MN2PR11MB3550.namprd11.prod.outlook.com ([fe80::8824:3385:f40b:a60d%4]) with mapi id 15.20.3933.032; Mon, 15 Mar 2021 17:38:40 +0000 From: "Coyle, David" To: "Lu, Wenzhuo" , "dev@dpdk.org" CC: "Lu, Wenzhuo" , "stable@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH 3/3] net/i40e: fix segment fault in AVX512 Thread-Index: AQHXFt8PgavoJrnoV0Svfo8KA8NH1aqFU5wg Date: Mon, 15 Mar 2021 17:38:40 +0000 Message-ID: References: <1615512441-17495-1-git-send-email-wenzhuo.lu@intel.com> In-Reply-To: <1615512441-17495-1-git-send-email-wenzhuo.lu@intel.com> Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-reaction: no-action dlp-version: 11.5.1.3 dlp-product: dlpe-windows authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [109.78.96.244] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 0689c83f-39a6-4b58-d556-08d8e7d92bf5 x-ms-traffictypediagnostic: MN2PR11MB3728: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2803; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 5Q8zOdxBxjK54cahGnRf2MZGy6vISiNExjsNz3Dp3Cfa4Fq4IDWTMLeS8mNHd2VqOY4k7h+LVmf9FQYndkwZ/1g/bPmGWiSYFZuSbnJ46bmQCUifAaTQgBdZhVrsaYTlhg1KtFTIlaRiUJY4bhdm3riuVSlvkv9qYLOURNP+Wd7+G+iBfXnWZMkIrI6PgtN3wx/jnWG/yH24ykqZfUgOqT2oL1cW1RUNTirfaaGEE+ha9oXmAM0mRbYQWm5utYZjL+ykx6d7HsomiLMA0lGc/yBTYGV5v2cURuvADkhCuN4eBnCR3ak+Mtm06He8XAGFoTm9qto1MDTjXuRFpcyvRHU1mWmDaZQmEr/ZXjTKTVs/pYQd3W1b76/c6Fhsv9Tjuk1ZGzVUsuwLWECBevzpNksVQQlU71AADlJSL1SuUX//DY95npfSESxow+8N32DKU1cmFJPRr++/O0Zjfq6TWjElBuKY7H406THMqnSQPSFLNMEvfmWTvfG5cTBCllm1XDRiXzsM1EjWfnR/JrWaF4+/MzVQY/F9bu4dOraOTrHgq3vIo5HbRXPPqJzA9z9K x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MN2PR11MB3550.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(376002)(346002)(366004)(396003)(39860400002)(136003)(7696005)(316002)(33656002)(55016002)(478600001)(54906003)(110136005)(66476007)(9686003)(450100002)(66946007)(52536014)(64756008)(4326008)(83380400001)(86362001)(5660300002)(71200400001)(76116006)(66556008)(66446008)(2906002)(26005)(186003)(8936002)(8676002)(6506007)(53546011); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?xX5GZS22nQcMIaviEOv0gKv92MhmPIbK/wllfyy3WBIWXTD3gBjJ98hvGUwC?= =?us-ascii?Q?K68Td2VWmGK+lt1eWaR4h84DWyddY8pWfgH/bV5LKjAXhnTfz6dM55LVr8Iw?= =?us-ascii?Q?SPNHx/kSdDjc39yxHS/pr3+/UB6+k8tw/qaHc8jwYtbNehzNwnMMWfqyCGNs?= =?us-ascii?Q?t6M/Bip9NbdYhBcmi+fOdI2w2AvaoRWw2UZDVl0J10PVtxgpdnTrWuJtVsn+?= =?us-ascii?Q?V7gARhDIATc4OVD7bSikkiC8alNaVuL5zXeO1sG+VpqeDyWqAkpA4xYQqYd+?= =?us-ascii?Q?an03KdyPGoo8iuCtdIZHVn5WZhX4QBpXQqxVyoFayN6c0fsBLzYIpLwHBjp8?= =?us-ascii?Q?tsaimZuBQ/5B5uvzo4jv/pz4RLrlkhIOFML8mnIKw0Xbvbm319IC042tVckE?= =?us-ascii?Q?QhLFiTZlQpFX/6ZMQfUE33l08M9vqHd+MLCX72hAXLV68a29ZIvAvgfLWxNB?= =?us-ascii?Q?3LmHykTQlJZdFR42Wvlssv2AVWuJAaDzlGVqy5DxKptxtgchTdjgp9ZDnJUo?= =?us-ascii?Q?GZmX738Z9apTOHNUVNyEKZPrMMALcc0SGkJSDnWZKHjd394ErUnvrF0eiyAg?= =?us-ascii?Q?AjFMRSnSkpJTB+MVUi1Nii3VOAisgOZtfMVUOzM3QAy4PuAPmvnpp4Rmk+bJ?= =?us-ascii?Q?OjVoWGnxfbMO/foZMEQAySUUdfsbKkuB4wpXt2dBmpYNmJ6fuXHNA2R0A/Cl?= =?us-ascii?Q?jTyOoHbtcX3woY70GYDRp/XWPjjDYRmi9FHfwvB+uSBhtrHJ3Rgk8onEWEPz?= =?us-ascii?Q?vjq66QIYYJsmEGi4Zm+F4IszRQAnyHn7nE5eFnpHGoVvanXFRX7+3ogVBDEl?= =?us-ascii?Q?WnvtUsiWEpMBFUGWqUDL/drmY0809++/evn3CRUGaJjdhrZf0w5oiO8Hc69J?= =?us-ascii?Q?WxUENjzJz9GiVV3+Mk/a8hW+jc9bavF5ZjzsXt+7tsdJ4pJQJNKzUAET8dYL?= =?us-ascii?Q?74ES6PK4sXgQn/dUhzwk1nUmVSbQg2piE5xlzUyBu2iMR48uP6gbePSDkDlP?= =?us-ascii?Q?z57FkhZqXAQ8xlF6A3vAogzCtS2QlxEKB5PPxrUhTcWa9UzMfFPPbmCqayVv?= =?us-ascii?Q?za0guZcHC1p+Dbil/5Tfh4uWf3Nwy0P35sAuxLE/j0SAuwwMU4ZWqOb/wqfA?= =?us-ascii?Q?Gk3XHHs8MbA8Ku8dDHYuewbEDndBOWMKGSiym2bSW8NuKii/P81/F0e7BjXn?= =?us-ascii?Q?jDQY2Ee533Di+q5AScgEjXZQIGLp9jtBcXiuXRK1b7nIJtjmYGnuQXVbWoND?= =?us-ascii?Q?hChFRRu4Hww6zHNzyp+7NquKZWl+a38uMYH9PqnOhPws8/eziXSZOnpTOVa0?= =?us-ascii?Q?AZ/pzlaZrKII6UMBuwmwX3jX?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MN2PR11MB3550.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0689c83f-39a6-4b58-d556-08d8e7d92bf5 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Mar 2021 17:38:40.3026 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: oW9fkqZInimA6qoVbhb2x8B9nMXRxXNlJ7kb+bmDhR0NoJ37lKZuqgWbftUogP6tVb8wLw1sBXICGzTSOvz1cg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB3728 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH 3/3] net/i40e: fix segment fault in AVX512 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi Wenzhuo > -----Original Message----- > From: dev On Behalf Of Wenzhuo Lu > Sent: Friday, March 12, 2021 1:27 AM > To: dev@dpdk.org > Cc: Lu, Wenzhuo ; stable@dpdk.org > Subject: [dpdk-dev] [PATCH 3/3] net/i40e: fix segment fault in AVX512 >=20 > Fix segment fault when failing to get the memory from the pool. >=20 > Fixes: e6a6a138919f ("net/i40e: add AVX512 vector path") > Cc: stable@dpdk.org >=20 > Reported-by: David Coyle > Signed-off-by: Wenzhuo Lu > --- > drivers/net/i40e/i40e_rxtx_vec_avx512.c | 128 > ++++++++++++++++++++++++++++++++ > 1 file changed, 128 insertions(+) >=20 > diff --git a/drivers/net/i40e/i40e_rxtx_vec_avx512.c > b/drivers/net/i40e/i40e_rxtx_vec_avx512.c > index 862c916..36521da 100644 > --- a/drivers/net/i40e/i40e_rxtx_vec_avx512.c > +++ b/drivers/net/i40e/i40e_rxtx_vec_avx512.c > @@ -32,6 +32,9 @@ >=20 > rxdp =3D rxq->rx_ring + rxq->rxrearm_start; >=20 > + if (!cache) > + goto normal; [DC] Like in IAVF and ICE, should we also check for cache->len =3D=3D 0, li= ke is done in Tx path? > + > /* We need to pull 'n' more MBUFs into the software ring from > mempool > * We inline the mempool function here, so we can vectorize the > copy > * from the cache into the shadow ring. > @@ -132,7 +135,132 @@ > #endif > rxep +=3D 8, rxdp +=3D 8, cache->len -=3D 8; > } > + goto done; > + > +normal: > + /* Pull 'n' more MBUFs into the software ring */ > + if (rte_mempool_get_bulk(rxq->mp, > + (void *)rxep, > + RTE_I40E_RXQ_REARM_THRESH) < 0) { > + if (rxq->rxrearm_nb + RTE_I40E_RXQ_REARM_THRESH >=3D > + rxq->nb_rx_desc) { > + __m128i dma_addr0; > + > + dma_addr0 =3D _mm_setzero_si128(); > + for (i =3D 0; i < RTE_I40E_DESCS_PER_LOOP; i++) { > + rxep[i].mbuf =3D &rxq->fake_mbuf; > + _mm_store_si128((__m128i *)&rxdp[i].read, > + dma_addr0); > + } > + } > + rte_eth_devices[rxq->port_id].data->rx_mbuf_alloc_failed > +=3D > + RTE_I40E_RXQ_REARM_THRESH; > + return; > + } > + > +#ifndef RTE_LIBRTE_I40E_16BYTE_RX_DESC > + struct rte_mbuf *mb0, *mb1; > + __m128i dma_addr0, dma_addr1; > + __m128i hdr_room =3D _mm_set_epi64x(RTE_PKTMBUF_HEADROOM, > + RTE_PKTMBUF_HEADROOM); > + /* Initialize the mbufs in vector, process 4 mbufs in one loop */ [DC] Comment should say 2 mbufs > + for (i =3D 0; i < RTE_I40E_RXQ_REARM_THRESH; i +=3D 2, rxep +=3D 2) { > + __m128i vaddr0, vaddr1; > + > + mb0 =3D rxep[0].mbuf; > + mb1 =3D rxep[1].mbuf; > + > + /* load buf_addr(lo 64bit) and buf_physaddr(hi 64bit) */ > + RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, buf_iova) !=3D > + offsetof(struct rte_mbuf, buf_addr) + 8); > + vaddr0 =3D _mm_loadu_si128((__m128i *)&mb0->buf_addr); > + vaddr1 =3D _mm_loadu_si128((__m128i *)&mb1->buf_addr); > + > + /* convert pa to dma_addr hdr/data */ > + dma_addr0 =3D _mm_unpackhi_epi64(vaddr0, vaddr0); > + dma_addr1 =3D _mm_unpackhi_epi64(vaddr1, vaddr1); > + > + /* add headroom to pa values */ > + dma_addr0 =3D _mm_add_epi64(dma_addr0, hdr_room); > + dma_addr1 =3D _mm_add_epi64(dma_addr1, hdr_room); > + > + /* flush desc with pa dma_addr */ > + _mm_store_si128((__m128i *)&rxdp++->read, dma_addr0); > + _mm_store_si128((__m128i *)&rxdp++->read, dma_addr1); > + } > +#else > + struct rte_mbuf *mb0, *mb1, *mb2, *mb3; > + struct rte_mbuf *mb4, *mb5, *mb6, *mb7; > + __m512i dma_addr0_3, dma_addr4_7; > + __m512i hdr_room =3D > _mm512_set1_epi64(RTE_PKTMBUF_HEADROOM); > + /* Initialize the mbufs in vector, process 4 mbufs in one loop */ [DC] Comment should say 8 mbufs > + for (i =3D 0; i < RTE_I40E_RXQ_REARM_THRESH; > + i +=3D 8, rxep +=3D 8, rxdp +=3D 8) { > + __m128i vaddr0, vaddr1, vaddr2, vaddr3; > + __m128i vaddr4, vaddr5, vaddr6, vaddr7; > + vaddr6 =3D _mm_loadu_si128((__m128i *)&mb6->buf_addr); > + vaddr7 =3D _mm_loadu_si128((__m128i *)&mb7->buf_addr); > + > + /** > + * merge 0 & 1, by casting 0 to 256-bit and inserting 1 > + * into the high lanes. Similarly for 2 & 3 > + */ [DC] Comment should say "Similarly for 2 & 3, 4 & 5, 6 & 7" > + vaddr0_1 =3D > + > _mm256_inserti128_si256(_mm256_castsi128_si256(vaddr0), > + vaddr1, 1); > + /* flush desc with pa dma_addr */ > + _mm512_store_si512((__m512i *)&rxdp->read, > dma_addr0_3); > + _mm512_store_si512((__m512i *)&(rxdp + 4)->read, > dma_addr4_7); > + } > +#endif [DC] Again, there's common code here with the avx2 file and also with the I= AVF and ICE PMDs. As I said in other reviews, maybe it's not practical to share code across P= MDs. But might be good to have some common functions within each PMD for avx2 an= d avx512 paths >=20 > +done: > rxq->rxrearm_start +=3D RTE_I40E_RXQ_REARM_THRESH; > if (rxq->rxrearm_start >=3D rxq->nb_rx_desc) > rxq->rxrearm_start =3D 0; The patch fixes the seg fault, but note I have only tested the default '#if= ndef RTE_LIBRTE_I40E_16BYTE_RX_DESC ' path Tested-by: David Coyle