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 D7FD0A0540; Tue, 8 Nov 2022 08:39:23 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7787D400D7; Tue, 8 Nov 2022 08:39:23 +0100 (CET) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id 91FAC4003C; Tue, 8 Nov 2022 08:39:21 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667893161; x=1699429161; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=G7rhhrWmBlMzECbeemq5bRb/DZy/fV54kKyikeBRNU8=; b=oFe+Cr5ULHR5SEAio3yVYL0HyW3HX5tM8B/rBFwcjJtD4KSsC/UilQsh IY7+q37CMvJYkCe7ugucZvVb6wyjwHqJJog5yqqHtUaEa87w9EVoZaObc Mt/URvJ2Qa7k1lKW+3fPqc08fqIn696rtnypqUx/FfY+sV6Gz3mq8SqfD Hr8APaQO2TN6S+oifQlakVV0QkDF8PT6mYO6Q0UWTP3ervbFH1g4aZOkG Ycgy464/7QSf1RQ5wyCZDnVDrB6vto+NSgFA6k3hRruDjLBaDG43cqNq/ tRtPBNR2ZNaqIL6MjLWWT10qPU8Ud5uDbvqHqqxCJDYMa2vMsYWvGPaRk g==; X-IronPort-AV: E=McAfee;i="6500,9779,10524"; a="312420319" X-IronPort-AV: E=Sophos;i="5.96,147,1665471600"; d="scan'208";a="312420319" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Nov 2022 23:39:20 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10524"; a="811146062" X-IronPort-AV: E=Sophos;i="5.96,147,1665471600"; d="scan'208";a="811146062" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by orsmga005.jf.intel.com with ESMTP; 07 Nov 2022 23:39:20 -0800 Received: from fmsmsx601.amr.corp.intel.com (10.18.126.81) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Mon, 7 Nov 2022 23:39:19 -0800 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) 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 via Frontend Transport; Mon, 7 Nov 2022 23:39:19 -0800 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (104.47.51.48) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2375.31; Mon, 7 Nov 2022 23:39:19 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kvDbTHPk3CbRGnKsAVk0hCTcnw4Rbi3yrt9IhGIxWDG80jetswuEy37lKZqXF8M4QUsPfSEn1f9KAY7yJd/sX5E2vfbbaaUGokKi7rmkrgdgPZIXBHXWWYy1a3fJh8BUbngIGlKdmzzmLLbxJOV5Lj0QK0Gc1GiVw0PdZef+Bjwesj2yadw9QN8CQT4ryW3yb73E8LiBaM6w0JRKRo0DQlJZwQSjQONi7xqvc8oOz+BXtbj9/NX+hjR0m6g2s34ymZ90N3NQutXFWHFY++vmTDAyE1WnguK1C2Ja54EHPN3XTuAvRfNRU44WQgDpyS/NjKydLAbpSx02ZXTT7e9Qhw== 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=JMvV5R6ILQvR/vLS/QAdeHEYkQCS9rT2u1Nn2uJBicI=; b=cln2Bi/8TdnMTOWCCKbRaJZ5V5H3otUqpGiJDX/SKWRzDui8VaVzhSoVAjlAyzFAdJZwmhEaq6PUo3ztd5rLLKGCosoEk1p5LZg+QD6jrIFmMW0TfEJOTMgDM91LV+NF6C3HGlCmH/Y2AOQZdKmZoMCPeNWkQUmiZ/OyZykLMjsmmhYwe7wnS7lBZtMEJShzVzCnEngF+06Yq3D5eFPEFFkq4vlsa2uqRWu7UR5SiKBcBBfLBdBTFGeIPhIhBi8xffhSDW4FvhYeWgIncgNRbFGmsu9TcO4ElMAzYa7fk1+t18+tz8WYch+eSRM6mS+0QUozQiISP5I+MOm23tB8/Q== 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 DM5PR11MB1739.namprd11.prod.outlook.com (2603:10b6:3:111::22) by PH7PR11MB5863.namprd11.prod.outlook.com (2603:10b6:510:135::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.27; Tue, 8 Nov 2022 07:39:12 +0000 Received: from DM5PR11MB1739.namprd11.prod.outlook.com ([fe80::8163:d995:db17:2bfa]) by DM5PR11MB1739.namprd11.prod.outlook.com ([fe80::8163:d995:db17:2bfa%2]) with mapi id 15.20.5791.026; Tue, 8 Nov 2022 07:39:12 +0000 From: "Pei, Andy" To: "Xia, Chenbo" , Taekyung Kim , "dev@dpdk.org" CC: "stable@dpdk.org" , "maxime.coquelin@redhat.com" , "Wang, Xiao W" Subject: RE: [PATCH v3] vdpa/ifc: fix update_datapath error handling Thread-Topic: [PATCH v3] vdpa/ifc: fix update_datapath error handling Thread-Index: AQHY8odmMbp1E9gIAk2goLguQTrE0640Qp2AgABiFdA= Date: Tue, 8 Nov 2022 07:39:12 +0000 Message-ID: References: <20221107053411.98653-1-kim.tae.kyung@navercorp.com> <20221107085943.116357-1-kim.tae.kyung@navercorp.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.6.500.17 dlp-reaction: no-action 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: DM5PR11MB1739:EE_|PH7PR11MB5863:EE_ x-ms-office365-filtering-correlation-id: 579f2416-5917-4507-3c49-08dac15c5463 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: S8o0qjB00XJPVMqtMQ3aL0oCBWp5Ilj5W3vNAi7P+7bw5tZ1LSthPos8EIA5EBAWl59GI8bSXiYjgt6Uid3YYn3X20Ov7Xvz/N9Fiw91JqdgGJvRuKQqxs2h+rKAEjbIgMYlF1RA9Z2KSd2GlpqcO+S1xOlUFX6eQZdg/bCjMgwhU6sG9gpVgegTJcXFhMIikjaZmryke6u18NXhq4DFRysOVGfIBRP3FvK5kA74UiZX5Gdw7zPCdX8g+RTfCeOaMzm+mJL+fqE2ycv+Usd+JADSl30MshIUniTP4XFOMnqBFNwMIMxy17vFR/Hi41eKuSh7/QIGJEWryjOOi/xAl5ixfO3LbGtWc6mvSRktCY78KQ3DtKvn1+NLUsl0J478CVd2M/sttvSjY+Y1UEi/siYtINGs+20khLVZyxrHkZvyGkvJpN26Twc+xAgmsHxu/uiRP2QFO4zBq+fSREueRvnfhOZDtbvh/Oyo7SkkL6nSR0+5EDW8i3gKWDuO245JpX2YeTFwaXeTTF+HN/YKptnyngvCrjIh0PMwc8TPWtQSvBsZPfeUAwzAdwWCp9QpPYqKTPhDtpqJpUVyBkM6feS8bsm7C2I1IE+FgUOrcSfgn4zoPSJlZNnW5r9z1XKpoZW4U81x6QY/IKsh/XEuHgbtPM6M8+P63CJ66pwFif72JY1tQT80kED4u6zUD6gYHRQS8/Ry5A0VxwiO+C6FQ6MAGM4NRg/IHKUMYEc4tHAvHoRm2ihWfHSU1FHyer2+Pew0Q0tnWre1Z0dbZV75wA== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR11MB1739.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(136003)(376002)(396003)(366004)(346002)(39860400002)(451199015)(8936002)(7696005)(6506007)(26005)(186003)(66476007)(9686003)(5660300002)(53546011)(66556008)(76116006)(66446008)(64756008)(66946007)(8676002)(316002)(4326008)(52536014)(54906003)(110136005)(41300700001)(33656002)(122000001)(82960400001)(38100700002)(107886003)(55016003)(83380400001)(86362001)(478600001)(38070700005)(15650500001)(71200400001)(2906002); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?JMPWgk0kZ8caAx/kGIGcCeCn0wZr6ZcrSfs+iFtjAsFljoyNYVk9pr5MUDft?= =?us-ascii?Q?XQevHw0S8d46QcyNCaG4+Krq/SxJuQWgqy8AwLdzA20BjHGT8xqpyMnOLums?= =?us-ascii?Q?PkFl4vE889oqeNizIm32vNyhY2Q8nyW93zHeDFwuYFx+sKsCdv0tCGBX49gL?= =?us-ascii?Q?uKhB7lzjwaqgK2OIJU3v8v6QvWT+QkNniDPy1A3+sFmu+MUNjLuJD2bBADN1?= =?us-ascii?Q?h7uj22LneweCRz9Eq5w/A9xQwv/gPjA7mLdfimPQrrGhK1J8N/hNA+d0TU9q?= =?us-ascii?Q?wBLqA+wXOAmbR7YSx+veTgCk7Bt5mE50njHuN2SH8twgL6aY77X82SqP46r+?= =?us-ascii?Q?WgcSN9YhQvIUGoMLt9g+j9ix17J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+C9NZYDsYd21J8fy1OXjZG8Aki71N0erh/NJ/aFWOssRCLLCBD1g+F5n?= =?us-ascii?Q?ODwYTlVyCmqEjk1CBeBGK02Q8d2yGQWX3Da8lYhU1LhBP+C6yw26Bndko7CH?= =?us-ascii?Q?0Ydt3eGYch6RToEG1InKn+sgAMdmX6unG+4EGeY0VYridmzp10IxYRCPWIRh?= =?us-ascii?Q?eElF6ni/OOcMCLsrILe/S1rGKd588DPUcJXdqMut5OmTO4FC6kNo4Bcf0g6g?= =?us-ascii?Q?nwogDGvbgtY383/b7P26ECwVHXUEmHZODEp/dwLMnRenXLOihLjU4fXclM5h?= =?us-ascii?Q?pIZzEkMPL4iqPydFro7l7OUC5TaTNGuEYegsx8e+?= 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: DM5PR11MB1739.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 579f2416-5917-4507-3c49-08dac15c5463 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Nov 2022 07:39:12.2819 (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: Y+zPMDF+DuFPRFc9qZDlhyAiK8bHcF/93XeTzw9lx1XdGxMb+7whAWS9tD2/NRDJm44Yl4ebQ4DXAHjFjhikZw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR11MB5863 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 Hi=20 See my reply inline. > -----Original Message----- > From: Xia, Chenbo > Sent: Tuesday, November 8, 2022 9:47 AM > To: Taekyung Kim ; dev@dpdk.org > Cc: stable@dpdk.org; maxime.coquelin@redhat.com; Wang, Xiao W > > Subject: RE: [PATCH v3] vdpa/ifc: fix update_datapath error handling >=20 > > -----Original Message----- > > From: Taekyung Kim > > Sent: Monday, November 7, 2022 5:00 PM > > To: dev@dpdk.org > > Cc: stable@dpdk.org; maxime.coquelin@redhat.com; Xia, Chenbo > > ; Wang, Xiao W ; > > kim.tae.kyung@navercorp.com > > Subject: [PATCH v3] vdpa/ifc: fix update_datapath error handling > > > > 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. > > > > Fixes: a3f8150eac6d ("net/ifcvf: add ifcvf vDPA driver") > > Cc: stable@dpdk.org > > > > Signed-off-by: Taekyung Kim > > --- > > v3: > > * Fix coding style > > > > v2: > > * Revert the prepared resources before returning an error > > * Rebase to 22.11 rc2 > > * Add fixes and cc for backport > > > > --- > > drivers/vdpa/ifc/ifcvf_vdpa.c | 26 ++++++++++++++++++++++---- > > 1 file changed, 22 insertions(+), 4 deletions(-) > > > > diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c > > b/drivers/vdpa/ifc/ifcvf_vdpa.c index 8dfd49336e..0396d49122 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; > > + } > > > > 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; > > + } > > } > > > > internal->configured =3D 0; > > @@ -1752,7 +1762,14 @@ ifcvf_pci_probe(struct rte_pci_driver *pci_drv > > __rte_unused, > > } > > > > 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); > > + pthread_mutex_lock(&internal_list_lock); > > + TAILQ_REMOVE(&internal_list, list, next); > > + pthread_mutex_unlock(&internal_list_lock); > > + goto error; > > + } > > Is it necessary to unregister vdpa device? > > rte_kvargs_free(kvlist); > > return 0; > > @@ -1781,7 +1798,8 @@ ifcvf_pci_remove(struct rte_pci_device *pci_dev) > > > > 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); > > > > rte_pci_unmap_device(internal->pdev); > > rte_vfio_container_destroy(internal->vfio_container_fd); > > -- > > 2.34.1 >=20 > Reviewed-by: Chenbo Xia