From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id E92FEA04C0; Tue, 29 Sep 2020 13:59:30 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2986E1BE86; Tue, 29 Sep 2020 13:59:28 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 2FB401BDDC for ; Tue, 29 Sep 2020 13:59:24 +0200 (CEST) IronPort-SDR: uwW6FJSrFcKf0yegGCtGQXlA45FHHngp1UhHWjLDOSl1X5owWHOIZBZaDcprw75nn2mxh0Ra6A UAeMcgQxPgPw== X-IronPort-AV: E=McAfee;i="6000,8403,9758"; a="223762336" X-IronPort-AV: E=Sophos;i="5.77,318,1596524400"; d="scan'208";a="223762336" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Sep 2020 04:58:57 -0700 IronPort-SDR: 7gKPg2h6TryAzcwcGHqOylJeypkF0u+iTjOlYwritVdw1t7928SPIwF9aG3vf65fIy/sVdK4b/ tOAoNKSbltRQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,318,1596524400"; d="scan'208";a="514647547" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by fmsmga005.fm.intel.com with ESMTP; 29 Sep 2020 04:58:56 -0700 Received: from fmsmsx608.amr.corp.intel.com (10.18.126.88) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Tue, 29 Sep 2020 04:58:56 -0700 Received: from fmsmsx604.amr.corp.intel.com (10.18.126.84) by fmsmsx608.amr.corp.intel.com (10.18.126.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Tue, 29 Sep 2020 04:58:56 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx604.amr.corp.intel.com (10.18.126.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5 via Frontend Transport; Tue, 29 Sep 2020 04:58:55 -0700 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.171) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.1713.5; Tue, 29 Sep 2020 04:58:55 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=I9nHBe75rdZH6bsj1t6b+iXXS0LJf6TzsbFOo75IDNlvn5jiRDGxlX9bXAwQKSvxNg2VMbueFlDzfitnxevqySfcR+PO1Hr78VuQ3R6NaVymgCIjB7yHbLtFRBSFbkuCLUPY7gLjPxP7Hel6jfeTSvkPyjf2NsDK5ATb6NRcHyjcwaLfX9gxPGetlH++UsvluusVFz3hy/fubejS2Sb3xAe9O+A2IFgt1/19AxFM6uUv0Tg8mhQS2NFMgco2qfFx5vGZcTtk3oW6YXL07LzJYrTiLgBeJUcFxJQfqPm96/EgMld/gy5Yx1hoyV4hzfcIbp8aJseDxDVFIkWF4efD3w== 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=VYBAy1QpZ/qRUZCKYacPIiPLUg5SAOqkcYF3jvQnZpI=; b=JRgdvsO4P1toJCdaBADOjlnY08SnBiyZd4e87Ts4+00mgT00Ol1haSjxkVnjLhOVQd1W598iItuT7FPj9p2EUCgMCoKBNU5H9fqANLAbkdZS4ZS1mo+aOh+JSctIbaM94dxMn67HfLIHuyC68DJNIxFvTdP/x2VyxIIb/fmy4fk+Qq4PDEeHNwpCQqybcNNDU5/sG4PS6uZOcDYThvWzXWr01e61l+mYtJK6/1Q6GKQm7Nvb4oTVVDj/ipF0uffpjkAo9EHcfVq8GPqksfLb5ZJzT3RSoc6mfopQCP2HPBD3Qwj23kg3CzlQP+vAGHhA0CTAPsCSJwdoFEDiSmldAA== 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=VYBAy1QpZ/qRUZCKYacPIiPLUg5SAOqkcYF3jvQnZpI=; b=tZJQExH+vDhNvGGoLdE70w1+qMzwUn+q0j9q9kpokW64D15BK7bVgrCBteFWvh2H7MDYuliF/PXhg+nRKSdgwJA5B4xNNS0k7T8q5cfADLbT5gEk8Yt9j8NJH5/1LL92G9aJnFvsB1vk5XwJnVXNvlW2+bjWIOCAiWc6X12FRMo= Received: from BN8PR11MB3795.namprd11.prod.outlook.com (2603:10b6:408:82::31) by BN6PR1101MB2115.namprd11.prod.outlook.com (2603:10b6:405:50::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3433.32; Tue, 29 Sep 2020 11:58:52 +0000 Received: from BN8PR11MB3795.namprd11.prod.outlook.com ([fe80::e4a8:91ab:e032:b8ae]) by BN8PR11MB3795.namprd11.prod.outlook.com ([fe80::e4a8:91ab:e032:b8ae%5]) with mapi id 15.20.3412.029; Tue, 29 Sep 2020 11:58:52 +0000 From: "Wang, Haiyue" To: Thomas Monjalon , Maxime Coquelin CC: "dev@dpdk.org" , "Yigit, Ferruh" , "arybchenko@solarflare.com" , Shepard Siegel , Ed Czeck , "John Miller" , Igor Russkikh , Pavel Belous , Somalapuram Amaranath , Ajit Khaparde , Somnath Kotur , Chas Williams , "Wei Hu (Xavier)" , Hemant Agrawal , Sachin Saxena , "Guo, Jia" , Marcin Wojtas , Michal Krawczyk , Guy Tzalik , Evgeny Schemeilin , Igor Chauskin , "Zhang, Qi Z" , "Wang, Xiao W" , Ziyang Xuan , Xiaoyun Wang , Guoyang Zhou , "Min Hu (Connor)" , Yisen Zhuang , "Xing, Beilei" , "Wu, Jingjing" , "Yang, Qiming" , "Alfredo Cardigliano" , Shijith Thotton , Srisivasubramanian Srinivasan , Stephen Hemminger , "K. Y. Srinivasan" , "Haiyang Zhang" , Long Li , Harman Kalra , Rasesh Mody , Shahed Shaikh , "Wiles, Keith" , "Xia, Chenbo" , "Wang, Zhihong" , Yong Wang , "matan@nvidia.com" Thread-Topic: [PATCH v3 28/29] ethdev: reset all when releasing a port Thread-Index: AQHWle1hwMmktRydX0Ww2yZ88Lrhn6l/ajgAgAACsQCAABXNIA== Date: Tue, 29 Sep 2020 11:58:51 +0000 Message-ID: References: <20200913220711.3768597-1-thomas@monjalon.net> <20200928231437.414489-29-thomas@monjalon.net> <269736e1-bf3f-a010-914f-904f86e8c947@redhat.com> <6133857.dQzx89rgS5@thomas> In-Reply-To: <6133857.dQzx89rgS5@thomas> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.5.1.3 authentication-results: monjalon.net; dkim=none (message not signed) header.d=none;monjalon.net; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.198.147.205] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 0fce7509-64ae-4351-acbb-08d8646f08b1 x-ms-traffictypediagnostic: BN6PR1101MB2115: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2582; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: K6vljzh32ioRVEz1u3brdJdBCPAL7MOSg9j1hUlzpvSQH7S6GLd2vSl7iVbArp++fyclwe4PVWwJS2+63pC/hzRl64cHOQ+j5GQRpPPe5/Gn4vpFcQH5jYZYqJR6OvHgPcStxQtJZy86eR3Nw7irXMJH7VvFyFbLAHL45QbH4XT5cBkqjzgAl68PmHPgTlWuSEfXpbxA0MSXTQsdUWILDf+LI6KGFJXkkZhwrcruyRvKks7CyRdKjkR59nGESnQnpG4mowmcZN2UrtjESioxW9yOvtx0HAv8tzhU61YrqsRcjaWIuom9d5nNtXhpZOLD4ggRc+wqyspnqQijssVxDd+q9+OnlD+C8KbGVB01GlgDwjGc+SH/uD/9sQegBPo/Mj+huJHowYusUrwFl7ZGyA== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BN8PR11MB3795.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(39860400002)(366004)(396003)(346002)(376002)(4326008)(9686003)(7416002)(7406005)(2906002)(83080400001)(55016002)(8936002)(83380400001)(478600001)(76116006)(8676002)(54906003)(316002)(966005)(86362001)(110136005)(5660300002)(7696005)(6506007)(52536014)(53546011)(26005)(186003)(64756008)(33656002)(66946007)(66446008)(66556008)(66476007)(71200400001); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: ty9G3p6DOG54FIAUXdPvHBRTo523Ni9gtdLRVurMgFOnwp1Jz6ksN4MYwRc/UG61Ta0UI+OTaKJ3VET4aA7Zw10H701tsCnnUlavwbGKlM0xcDFD0r8iqERlN0ycKLXtsZrVrWUa9cgxwawDOoAM9HXFCU/MxrV1M02NhWEgSULTP/25DvFyqP17zLeXKQFafQK+Lgz9SEBLUM8fS9iIBC/qM9YROtlNEbfZRxuJZhQdAt8mmyTkkdeHIQ/0tSrpaORM+r4rY4u1XM7lJ/5zWTCXD7W5JZbN+x1subM/zSUOBzBIDFfiHt5ftFLOX5NsLeGER3UUFprVOQHvzbvmpl3phTgVUwa7/p6BUjztMYilsBmC+bhOLOtWtaBBS9x68MGAHbMThE3TAFIKH7YnQmT1a/0xwHe9pJGE00t+5fpFcj92bkly5Vi3ZZU6DXA+F3CNxTZ9fRLYBjmZAqFNppr3BG2yuR9vTGDEEc651eNeLwyGW8TOtMh5Y2/e0F12IOA7dM9nyg0bMG7yLj+bX6+ADdxp7k1TNvCQlWlXmrqMLq4wGPM4v+cFO5Ezis6KxXAlXHbuZzgvMkHmbLcIXD8RnNvcCq83nVN/MWgpK0uVKDwdRO7R2yII0onYF522acKtmIxxr9S3vw/Y1XKBvg== 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: BN8PR11MB3795.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0fce7509-64ae-4351-acbb-08d8646f08b1 X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Sep 2020 11:58:51.9046 (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: go4Slp7CVBoY6mnei1vs4ZcxLXQaClt0Hqb/oI2X6wOBCWaiz4nt/5B/J0QaBYxIxTIXr53Hg+6sT3WYADZpxg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR1101MB2115 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v3 28/29] ethdev: reset all when releasing a port X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" > -----Original Message----- > From: Thomas Monjalon > Sent: Tuesday, September 29, 2020 18:36 > To: Maxime Coquelin > Cc: dev@dpdk.org; Yigit, Ferruh ; arybchenko@sola= rflare.com; Shepard Siegel > ; Ed Czeck ; Jo= hn Miller > ; Igor Russkikh = ; Pavel Belous > ; Somalapuram Amaranath ; Aj= it Khaparde > ; Somnath Kotur ;= Chas Williams > ; Wei Hu (Xavier) ; Hemant Agrawa= l ; > Sachin Saxena ; Guo, Jia ; = Wang, Haiyue > ; Marcin Wojtas ; Michal Krawczyk= ; Guy > Tzalik ; Evgeny Schemeilin ; Igor= Chauskin ; > Zhang, Qi Z ; Wang, Xiao W ;= Ziyang Xuan > ; Xiaoyun Wang ; Gu= oyang Zhou > ; Min Hu (Connor) ; Yisen Zhu= ang ; > Xing, Beilei ; Wu, Jingjing ; Yang, Qiming > ; Alfredo Cardigliano ; Shij= ith Thotton > ; Srisivasubramanian Srinivasan ; Stephen Hemminger > ; K. Y. Srinivasan ; Haiyang Z= hang ; > Long Li ; Harman Kalra ; Rasesh= Mody ; > Shahed Shaikh ; Wiles, Keith ; Xia, Chenbo > ; Wang, Zhihong ; Yong Wang= ; > matan@nvidia.com > Subject: Re: [PATCH v3 28/29] ethdev: reset all when releasing a port >=20 > 29/09/2020 12:26, Maxime Coquelin: > > On 9/29/20 1:14 AM, Thomas Monjalon wrote: > > > The function rte_eth_dev_release_port() was resetting partially > > > the struct rte_eth_dev. The drivers were completing it > > > with more pointers set to NULL in the close or remove operations. > > > > > > A full memset is done so most of those assignments become useless. > [...] > > With this patch, I get following segfault at init time with Virtio PMD: > > > > Program received signal SIGSEGV, Segmentation fault. > > 0x0000000000854c9b in rte_eth_dev_callback_register (port_id=3D= 32, > > event=3DRTE_ETH_EVENT_UNKNOWN, cb_fn=3D0x4b24de > > , > > cb_arg=3D0x0) at ../lib/librte_ethdev/rte_ethdev.c:4042 > > 4042 > > TAILQ_INSERT_TAIL(&(dev->link_intr_cbs), >=20 > Yes this is because after closing a port, everything is resetted, > including .link_intr_cbs which is set only once in a constructor: > http://git.dpdk.org/dpdk/commit/?id=3D9ec0b3869d8 >=20 > I can change this patch to selectively set pointers to NULL. >=20 > Or if we prefer a big memset 0, we need to rework how RTE_ETH_ALL > is managed to register a callback for any event. > Instead of setting the callback for all ports, we could have > a special catch-call callback list which is called for all events. > This way we could revert initializing .link_intr_cbs in eth_dev_get(). >=20 >=20 Move 'struct rte_eth_dev_cb_list link_intr_cbs' to the end of 'struct rte_e= th_dev', and starting from link_intr_cbs, these members will be kept after closed ? = :-) memset(eth_dev, 0, offsetof(struct rte_eth_dev, link_intr_cbs));