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 695AAA04FD; Thu, 10 Nov 2022 08:02:47 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5B69B40A7D; Thu, 10 Nov 2022 08:02:47 +0100 (CET) Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id AEBFC40A7D; Thu, 10 Nov 2022 08:02:45 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1668063766; x=1699599766; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=ZndPOKzXxJhFw5hOuqvlT9qorMGWvLX2CEuegcaBsLY=; b=JCWtZl1PnrO1JJdybH5iGw43KCnMDZnyqVM/eWAucJGERB35745nN/AZ RQeOoyvkSEd90zHHfKV8SuFLl+so+bki0GirOG9y/0BUiJBzyON0pwJ6J mUJ/RUOwSrbnWRX/SlK9zwoT3XeV+FM16W/y0QY5m9MoAeB2IsWX+aXF/ 9rSvHNI+Ne5/doYkuugdNV1HGB4gI7s60wW4ebFd9Zlu+JnJQAew2wC4M Kl71l7+Bzm6hP3xammWEg275FUSPyCu+QasAjb4UID5O3aqdDoyoNXsih rLH2FEnQZaNlbKObjIgrTUGpjPiQZqjxX8e4YO6LYeflNSzvKrwfq9dEu w==; X-IronPort-AV: E=McAfee;i="6500,9779,10526"; a="373347991" X-IronPort-AV: E=Sophos;i="5.96,153,1665471600"; d="scan'208";a="373347991" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Nov 2022 23:02:44 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10526"; a="670250569" X-IronPort-AV: E=Sophos;i="5.96,153,1665471600"; d="scan'208";a="670250569" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by orsmga001.jf.intel.com with ESMTP; 09 Nov 2022 23:02:44 -0800 Received: from fmsmsx603.amr.corp.intel.com (10.18.126.83) 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.2375.31; Wed, 9 Nov 2022 23:02:44 -0800 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31 via Frontend Transport; Wed, 9 Nov 2022 23:02:44 -0800 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.172) 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.2375.31; Wed, 9 Nov 2022 23:02:44 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DT6vCPpxkBgUTeV8UxcEO6j+ODi1Ihy0ZWIPxuYo5fT8OuxOpOT2sGaPVVRPA3kvERIpOKrI4vvmMszdI3ipoQly/+uZ9XE+67F8844vbDY8OO0672MujhcmrrAy/FCk5jI9HQ0lFSiWu9SZmsRTJuqKHafLbXidvW6VsaTUbajk2ltTJCRfHHeiAyWwKK8RZXNTDxt1uqLsE3Hbm3oXjp2eHG1bR0J7SjgmvPa6qDoKuPSvyVtVuoHePHi5B9Xm1etYzEiDKY3qU60hALeUhpQIaj7KmFAfvaKGjNuPxQ4BoaU1dmmWLgcVbvUlOuXC7jXXUiGqS/BrzgPUxbQQ3A== 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=pD7ZavsKI+sEwM6/vyBequDtBSbv6L4M5UXai+m3lII=; b=EXRo7zRakW1h/TALt9JMHGAzK4vdf6HrDMjUtLQqnhVf8cVk77eYPn+WkUTQpzZVcFE8aZxAqyinJ+/a4DqhWBTAlxeoWaTIpmZw4sg1Dq+H10h5/t3we6Yk0RlpZqVwleky41rJd3hs8f7JLDcYxCTVEaOg4ynAzFP/0JKBZ3WdW/LSWtcE7UpCogv1gm3gRU6rEzPlKnYpZ65rrJFGhzt8WF88yc4bXkc3H1YzvNioOTI9WP8+uNUQsmqlDYpnRQFd9couycczNeTLeg0w48QBhAFUueuefqrQoBhIfbvkx1+IOcV4Hhk4Qgqu9iHM08cfkJaWn7sLQOlAIvR6gA== 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 SN6PR11MB3504.namprd11.prod.outlook.com (2603:10b6:805:d0::17) by SA2PR11MB4905.namprd11.prod.outlook.com (2603:10b6:806:117::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5813.13; Thu, 10 Nov 2022 07:02:42 +0000 Received: from SN6PR11MB3504.namprd11.prod.outlook.com ([fe80::3c6a:7a7c:129d:aecb]) by SN6PR11MB3504.namprd11.prod.outlook.com ([fe80::3c6a:7a7c:129d:aecb%4]) with mapi id 15.20.5791.026; Thu, 10 Nov 2022 07:02:42 +0000 From: "Xia, Chenbo" To: Taekyung Kim , "dev@dpdk.org" CC: "Pei, Andy" , "maxime.coquelin@redhat.com" , "stable@dpdk.org" , "Wang, Xiao W" Subject: RE: [PATCH v5] vdpa/ifc: fix update_datapath error handling Thread-Topic: [PATCH v5] vdpa/ifc: fix update_datapath error handling Thread-Index: AQHY9Lpi8VgpeqppxU+LcpMiKb1yy643u1Gw Date: Thu, 10 Nov 2022 07:02:42 +0000 Message-ID: References: <20221110040943.82876-1-kim.tae.kyung@navercorp.com> In-Reply-To: <20221110040943.82876-1-kim.tae.kyung@navercorp.com> Accept-Language: en-US, zh-CN 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: SN6PR11MB3504:EE_|SA2PR11MB4905:EE_ x-ms-office365-filtering-correlation-id: 5ff2025b-bf1c-4a14-8649-08dac2e9900b x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: lsszHvbP+c4Nxniss3rudd82+YvARsMdD3Q/InapBY6aqPvG85iV/CsWUDLStDbKjfti2Bu0Re0wHBb6C+JbD5VCfBeF3OcoYuo5xb7j8FbuyRM508oRrAkD9NwbbN+KnOTqDwskxCbsTF9SazF9JTZi77q4wtlc3sQnhVZXwBBTmTrKdlf1094GXbDGGXxaO5ZT1ha0qy0MBHbiopkscokkYPNja8B3buPoJ+2m8pdWGk7klVx7YpLpwFUpVTp7AFb8zz0rSL7uSLfoCuWSHa4a6kYWMAAt37ftVfZbX+AvL6wpAsM30UHlYzpF45vyYfCGuMYbDa9u5imiF7cTSZAMAhVms2J8eEoyEgU77KBiZpAoyv5lwgidgVMdeFVSJeDun5gh37GDSsx9wrToyZB06MocnIM3s2VfScAFUnK9fd8zbcqMnR2/Uj5BogMBzrxa9LKg2BBOR5H1e/HJft4hETn3Yto3n9ZiYVusGYUjI/ocX5fz7ioIMvtNGGsY4Emwg4lyAtW9ZtLPPSTp/bKGXjRnj/tt6p1UMN4oBKWccd6xOOZUS+09Y7HLTfKQbWs5Q4ssfFLdFqkPr3BoQ9KAfiDq9RR7g4sIz42JSeDqt+bBEeKVGw3UKpT0gMUuqHOKE3eB7N5fr+43JY9q9tntJ574UnC9HCL/dwsBvZfX4SmGgKzq0HIi1lyik2Xi6Ba6gdYt4138zwvxivPO1n50IC/NN6ByP4r8/+Wt2KYHK/vYxrX6kE16ck2GrfhZJsjiDOqPSF8QVMQg6tEUgw== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SN6PR11MB3504.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(376002)(366004)(136003)(39860400002)(346002)(396003)(451199015)(41300700001)(83380400001)(38100700002)(4326008)(64756008)(8676002)(82960400001)(66446008)(66476007)(66556008)(76116006)(66946007)(122000001)(186003)(9686003)(478600001)(26005)(6506007)(7696005)(55016003)(33656002)(53546011)(107886003)(316002)(110136005)(54906003)(71200400001)(38070700005)(86362001)(5660300002)(2906002)(52536014)(8936002)(15650500001); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?pXf5o08mc9/KI8BL2f7L0O/AaWSaOHPdUQIt4gjrfoQAvaLbfAWDiQcYjdyP?= =?us-ascii?Q?7vM3fkDxOo+tnSpiYe5y5PlE1Wvgud09yBVb1mSho1Y/VyUVivcodYAIb4S6?= =?us-ascii?Q?crhevkMV8eLsNv/hrR4LVRa1MepFcwHxHPqkisQZ4YyIRlYC69jbxnB1bhM7?= =?us-ascii?Q?C7LBNbjCdQMQEhZF72T1JpSMEQUETcvjeuGu6Pp6XAcfWX5OijADM+lka42C?= =?us-ascii?Q?NIHjqWzESVIt0X/hrMx98OseLeuxAnM0GPUNDHGFGeaCHATDiR23XYBOXUfu?= =?us-ascii?Q?Y7INMbfiSxzc6ZPctEzjd0kNfPSgYQecoG2AqFThTZJs/8RZ2Ia2QDSFaq7q?= =?us-ascii?Q?bIDUQ6cBD9gVPeKjUY8ge2hFxlGTRI6ZLJ6Il+UX5aTSp3dPI5u45qjmgI+5?=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63nEFCq4geQ4gXezvKZSqJcMiiLHKpNQuyhDe5OTffCYmfz8wcf?= =?us-ascii?Q?ouYdrSqtZkRaiL70WC566etWEr9KhqxHNxY1CxdtVrFZEoJHrl+kDXmWbswh?= =?us-ascii?Q?8y0s4hHngqAEg6/zUck5etBg4zAD7hFvoUxT7xp1JkC6wikY04hem99dhGKA?= =?us-ascii?Q?DLeLNf9VQNmSLoMUKd2hPSFecCTjJMGbOPRPLnjki7C5jR4lLUhrl47lqs32?= =?us-ascii?Q?dyUsGU/WGhJKJStueWy801ZSJDYzgPILQhsG4i/ll7mDeiK/nzf+F8W5YNdm?= =?us-ascii?Q?UtwognxIK6OW7INKiLJIGrzPOj4YcnkmHzJup4cD?= 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: SN6PR11MB3504.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5ff2025b-bf1c-4a14-8649-08dac2e9900b X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Nov 2022 07:02:42.5876 (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: U+bb9Jtpgy9wyKBNzKtR8wkO7eEbwv9jnr+ZK1NPkZ9rBGC1Li4bIF7oawNm5MkSW4QzVqMbr9DIV3StuZIyEA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR11MB4905 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: Taekyung Kim > Sent: Thursday, November 10, 2022 12:10 PM > To: dev@dpdk.org > Cc: Xia, Chenbo ; Pei, Andy ; > kim.tae.kyung@navercorp.com; maxime.coquelin@redhat.com; stable@dpdk.org; > Wang, Xiao W > Subject: [PATCH v5] vdpa/ifc: fix update_datapath error handling >=20 > Stop and return the error code when update_datapath fails. > update_datapath prepares resources for the vdpa device. > The driver should not perform any further actions > if update_datapath returns an error. >=20 > Fixes: a3f8150eac6d ("net/ifcvf: add ifcvf vDPA driver") > Cc: stable@dpdk.org >=20 > Signed-off-by: Taekyung Kim > --- > v5: > * Resubmit to patchwork >=20 > v4: > * Add rte_vdpa_unregister_device in ifcvf_pci_probe >=20 > v3: > * Fix coding style >=20 > v2: > * Revert the prepared resources before returning an error > * Rebase to 22.11 rc2 > * Add fixes and cc for backport >=20 > --- > drivers/vdpa/ifc/ifcvf_vdpa.c | 27 +++++++++++++++++++++++---- > 1 file changed, 23 insertions(+), 4 deletions(-) >=20 > diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.= c > index 8dfd49336e..49d68ad1b1 100644 > --- a/drivers/vdpa/ifc/ifcvf_vdpa.c > +++ b/drivers/vdpa/ifc/ifcvf_vdpa.c > @@ -1098,7 +1098,12 @@ ifcvf_dev_config(int vid) > internal =3D list->internal; > internal->vid =3D vid; > rte_atomic32_set(&internal->dev_attached, 1); > - update_datapath(internal); > + if (update_datapath(internal) < 0) { > + DRV_LOG(ERR, "failed to update datapath for vDPA device %s", > + vdev->device->name); > + rte_atomic32_set(&internal->dev_attached, 0); > + return -1; > + } >=20 > hw =3D &internal->hw; > for (i =3D 0; i < hw->nr_vring; i++) { > @@ -1146,7 +1151,12 @@ ifcvf_dev_close(int vid) > internal->sw_fallback_running =3D false; > } else { > rte_atomic32_set(&internal->dev_attached, 0); > - update_datapath(internal); > + if (update_datapath(internal) < 0) { > + DRV_LOG(ERR, "failed to update datapath for vDPA > device %s", > + vdev->device->name); > + internal->configured =3D 0; > + return -1; > + } > } >=20 > internal->configured =3D 0; > @@ -1752,7 +1762,15 @@ ifcvf_pci_probe(struct rte_pci_driver *pci_drv > __rte_unused, > } >=20 > rte_atomic32_set(&internal->started, 1); > - update_datapath(internal); > + if (update_datapath(internal) < 0) { > + DRV_LOG(ERR, "failed to update datapath %s", pci_dev->name); > + rte_atomic32_set(&internal->started, 0); > + rte_vdpa_unregister_device(internal->vdev); > + pthread_mutex_lock(&internal_list_lock); > + TAILQ_REMOVE(&internal_list, list, next); > + pthread_mutex_unlock(&internal_list_lock); > + goto error; > + } >=20 > rte_kvargs_free(kvlist); > return 0; > @@ -1781,7 +1799,8 @@ ifcvf_pci_remove(struct rte_pci_device *pci_dev) >=20 > internal =3D list->internal; > rte_atomic32_set(&internal->started, 0); > - update_datapath(internal); > + if (update_datapath(internal) < 0) > + DRV_LOG(ERR, "failed to update datapath %s", pci_dev->name); >=20 > rte_pci_unmap_device(internal->pdev); > rte_vfio_container_destroy(internal->vfio_container_fd); > -- > 2.34.1 Applied to next-virtio/main, thanks