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 7D1F342545; Mon, 11 Sep 2023 02:55:52 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0558D40291; Mon, 11 Sep 2023 02:55:52 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id B1FF64021D for ; Mon, 11 Sep 2023 02:55:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1694393750; x=1725929750; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=NjZiftvkMd681/sQcdWZj+fqjRTtcU2vDE01DbzXg4E=; b=Bn3A0JEnp97RkAIJT75coPwrQEhADL64Mx6JyWe78l0Ny76ILdxwlp3+ w7jwdmxyMqSGX4Ta2FlWAbNGc3gXKusHkL/LUpHpx2i0U8Y6dzi635W9W BaqvZSf8mOR7bSAAgJEFLutqQRb10I7uD01j5OPdui6CYTekIdZ7e3SAf m8fUreQg0TI9JnSN7YXqVFhfRER409oWfJsmUUDyGUIm1cWeg70gR+WTE FX1SPdAVhJPE7FQW+bVyQ0o55DSVKRrKleILe6Jnaf8TgwJiBrauLEXtj kuiB8446e6y4YhQP8hTo5bdNQE1SFHtnIVg4WdIyFNE4fmsN+wFzUe4DD w==; X-IronPort-AV: E=McAfee;i="6600,9927,10829"; a="408934761" X-IronPort-AV: E=Sophos;i="6.02,243,1688454000"; d="scan'208";a="408934761" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Sep 2023 17:55:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10829"; a="746229841" X-IronPort-AV: E=Sophos;i="6.02,243,1688454000"; d="scan'208";a="746229841" Received: from orsmsx601.amr.corp.intel.com ([10.22.229.14]) by fmsmga007.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 10 Sep 2023 17:55:49 -0700 Received: from orsmsx602.amr.corp.intel.com (10.22.229.15) by ORSMSX601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32; Sun, 10 Sep 2023 17:55:49 -0700 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32 via Frontend Transport; Sun, 10 Sep 2023 17:55:49 -0700 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (104.47.74.42) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.27; Sun, 10 Sep 2023 17:55:48 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=E5YXwPdrPi46rfj2KndSZAv489a3WOPbkgo8UckKi5wD0mOAlfTDipiEWiMBn7lAb67SEremKi6eNSz8CNEgavhfq1Nij3ZKjstweyjJlFlMQK0W8Sh6gerjzElYtZbKB3vn1cHCxRejdRp3/cK82SRreTPXHLfhJBZ4z3aBjjcIEdxftjspHso5wExDaorGUsbNPfnpydPmn9Mx2iypY7R9anHu7281nRYr82OllYijNJUSCfHYYibCKigokKEen+OHCFlQPi5eQ8HYoTKKziZYQN5Tw3K5CB4KBJecv7bREPFhUQ86sPG8V15XSqZ/5rNTCd5yu/bNBkTv3ORzsw== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=NjZiftvkMd681/sQcdWZj+fqjRTtcU2vDE01DbzXg4E=; b=LzV7bUzL2ruWWUXrXdy1LegSiQh1Ly3g2eCbDUQwGmO+1ad8PqF4h/zyjxVM4hqldjB+zXL2xnmgMDUM2GM8R7tE0t0AW+VlKHxHHJ9I1bup38yK8UdBneRNC3jA5mxg/KJx22U/c6cao2EymVoHtI5snVDQTFQiaoYep/5vteG0BL9fyUb/wx+rd+BVIRHKWLInHScPhFGTdFDTPRRiwQ7Hqi8tZ/F+V7J4BZX4mfaOd9WffUNjSVUIoXUWbbupm0o2QunYR3H1fYPkyAuw58SVNN2nZGxgSWPS0whvvm6mQIKaJ4yBCemFyG6ubgbJLSlEbK2JnBs/GmcZ1oJIgQ== 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 Received: from DM4PR11MB5994.namprd11.prod.outlook.com (2603:10b6:8:5d::20) by DS7PR11MB7808.namprd11.prod.outlook.com (2603:10b6:8:ee::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6768.30; Mon, 11 Sep 2023 00:55:40 +0000 Received: from DM4PR11MB5994.namprd11.prod.outlook.com ([fe80::8a49:15a2:ab69:91c3]) by DM4PR11MB5994.namprd11.prod.outlook.com ([fe80::8a49:15a2:ab69:91c3%4]) with mapi id 15.20.6768.029; Mon, 11 Sep 2023 00:55:40 +0000 From: "Zhang, Qi Z" To: "Singhal, Saurabh" , Thomas Monjalon , "Wu, Jingjing" , "Xing, Beilei" CC: "dev@dpdk.org" , "Singhal, Saurabh" Subject: RE: [PATCH v4] net/iavf: unregister intr handler before FD close Thread-Topic: [PATCH v4] net/iavf: unregister intr handler before FD close Thread-Index: AQHZ4WT9OiyScz0iekuJk8xzAGMds7AU0lhg Date: Mon, 11 Sep 2023 00:55:40 +0000 Message-ID: References: <20230907031529.84232-1-saurabhs@arista.com> In-Reply-To: <20230907031529.84232-1-saurabhs@arista.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: DM4PR11MB5994:EE_|DS7PR11MB7808:EE_ x-ms-office365-filtering-correlation-id: 61189ca1-c1db-4fd1-071d-08dbb261d1d8 x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 1NFvF6MoQtGql3Py3sSX5cuxANKUBkrsNU9hHR7LeEcPcPu86o/aqfk+lFBbeO7nY36QzgnLxXIAeaGBkrQWPV1XW5tcfGfSjnKx14/ItmQqnw9vpqEm+6eA6FNnoyioKKLaWBcDZKvDYsAop5H+1yzDOs8BN04NYs++zMY+Fc7vuoY5swKkSVaSeYoHMIaxdN9wsY7qF2A4qKv12fzsErWblwbTI3TpWnO14JCbJQfyDuEkAw17Wil0GpArL7e6hLqVc+GcL+tjKnlKfFiD0CRj6ZdcAnmCKqzJv0uH2ujb6RurQ+Z9tg4tu0u2cMi3vdikPplzYrFvQ/rrWl27srmYiQlX+lER7e900Lse24poxz/q7gaMYRkEa56BRgUDfIypDyclVWLWpxPT45AwvzKXbEHttvB6Tkd4Z3qJ6aqtDBMeScXQpjts9lYA6r6og9y4jo5kN8jA3V1nrpfiTbC9Wnjb+nOtLKnLt1/tr5h26Kv/dSJHzkUAQ7yH6KDq6CLLuAMDrGNMEDF5L/0bqnuYj26okEEMBxaAwele9UKwul/zxZJtBgb3ZAGspRlU//4QF+mb5I+8H+kuROqi3HDz3QuwALRqOVCAFgLc34ziB3OM70EkX02zhzWL9qhv x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5994.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(136003)(376002)(346002)(366004)(39860400002)(1800799009)(186009)(451199024)(110136005)(5660300002)(53546011)(7696005)(6506007)(71200400001)(122000001)(55016003)(86362001)(33656002)(38100700002)(38070700005)(82960400001)(26005)(478600001)(9686003)(83380400001)(52536014)(41300700001)(8676002)(4326008)(2906002)(8936002)(316002)(66446008)(64756008)(6636002)(54906003)(66946007)(66476007)(76116006)(66556008); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?+9O2Rkqnhoips3VgYb3NIq7BhzrtBYQM29i9TFDCUtq8EYIAWAbsWC1osGAM?= =?us-ascii?Q?VWuNuMRG9jhutR9iqU2TNPRzwt2alFyu2fw4WAMI22u828kOp51d47LgJxhB?= =?us-ascii?Q?6XrHrnfAH+8sQcnblJTHIBbH1dX2SRAqLfDpmva+/aqKUr4OMEOytisXdE5i?= =?us-ascii?Q?OLz7DlfJOFGYNs+jVy5vAFCylVGHrfnjbi3NvIHaAitXBHIkwziftW7qGri7?= =?us-ascii?Q?0F94xObwWj3VzbDA+1shBnq8F1ji4CP7k+CddVA/1S3IoBtncEFU2P+Y8Bq9?= =?us-ascii?Q?QLB1ozXyPognDqssPrH/VzMCqr4xSPuEw+Pa2Ki/1+WE2NRGfFdnagMImirW?= =?us-ascii?Q?a94bBG/sLAcYupRIXNBJsUIJAlv/qhowmiKWLcz+g0iiqUSSgGc5/JEMkJne?= =?us-ascii?Q?UhmMfT31Zl8Ld8Jj5q35cy4ArTQcdeDxRDJvuGVfe97N4mHt9Sa//H+FZubV?= =?us-ascii?Q?UtgbORaLi0gn4LSSLJZLPrhP1mivjLAkGha02/YMcyurWrOnaH1ldUGpEpAW?= =?us-ascii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foyk0yGD4Mn8gvw8LAkHKPUnXPxTYtTIZ+E2NG?= =?us-ascii?Q?6XBrAXKkk8mKih3jY+7tIqhdgTsmXOCxYzYgTI3yLNf/lZdu9xyNgxO8Go7K?= =?us-ascii?Q?I6q83j9eBKPIhLwKkSuDIhqbwrua5JQNVaen1jVUp6v3OlVvsAHLlcmGGyQu?= =?us-ascii?Q?OQJfX2ulGXTXPt0SPND8w7pKKeZcz037vcyJDE6X?= 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: DM4PR11MB5994.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 61189ca1-c1db-4fd1-071d-08dbb261d1d8 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Sep 2023 00:55:40.4722 (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: XZVFgSSFZxlyAyCXWJTHsoaa1Zwc6zsIiRwukmS78Dt0slz87NEW6J4Mrlml49cSqmKW/WaUALeFurGtD8lxXQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR11MB7808 X-OriginatorOrg: intel.com 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 > -----Original Message----- > From: Saurabh Singhal > Sent: Thursday, September 7, 2023 11:15 AM > To: Thomas Monjalon ; Wu, Jingjing > ; Xing, Beilei > Cc: dev@dpdk.org; Singhal, Saurabh > Subject: [PATCH v4] net/iavf: unregister intr handler before FD close >=20 > Unregister VFIO interrupt handler before the interrupt fd gets closed in = case > iavf_dev_init() returns an error. >=20 > dpdk creates a standalone thread named eal-intr-thread for processing > interrupts for the PCI devices. The interrupt handler callbacks are regis= tered > by the VF driver(iavf, in this case). >=20 > When we do a PCI probe of the network interfaces, we register an interrup= t > handler, open a vfio-device fd using ioctl, and an eventfd in dpdk. These > interrupt sources are registered in a global linked list that the eal-int= r-thread > keeps iterating over for handling the interrupts. In our internal testing= , we see > eal-intr-thread crash in these two ways: >=20 > Error adding fd 660 epoll_ctl, Operation not permitted >=20 > or >=20 > Error adding fd 660 epoll_ctl, Bad file descriptor >=20 > epoll_ctl() returns EPERM if the target fd does not support poll. > It returns EBADF when the epoll fd itself is closed or the target fd is c= losed. >=20 > When the first type of crash happens, we see that the fd 660 is > anon_inode:[vfio-device] which does not support poll. >=20 > When the second type of crash happens, we could see from the fd map of > the crashing process that the fd 660 was already closed. >=20 > This means the said fd has been closed and in certain cases may have been > reassigned to a different device by the operating system but the eal-intr= - > thread does not know about it. >=20 > We observed that these crashes were always accompanied by an error in > iavf_dev_init() after rte_intr_callback_register() and > iavf_enable_irq0() have already happened. In the error path, the > intr_handle_fd was being closed but the interrupt handler wasn't being > unregistered. >=20 > The fix is to unregister the interrupt handle in the > iavf_dev_init() error path. >=20 > Ensure proper cleanup if iavf_security_init() or > iavf_security_ctx_create() fail. Earlier, we were leaking memory by simpl= y > returning from iavf_dev_init(). Fixes: 22b123a36d07 ("net/avf: initialize PMD") Fixes: 6bc987ecb860 ("net/iavf: support IPsec inline crypto") Cc: stable@dpdk.org >=20 > Signed-off-by: Saurabh Singhal Acked-by: Qi Zhang Applied to dpdk-next-net-intel. Thanks Qi