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 500CAA00C2 for ; Wed, 9 Nov 2022 03:39:16 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4683B42D2A; Wed, 9 Nov 2022 03:39:16 +0100 (CET) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mails.dpdk.org (Postfix) with ESMTP id 243F8400D4; Wed, 9 Nov 2022 03:39:12 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667961553; x=1699497553; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=hVhd5KWuy8bdUzatD49hJyRMMRb0onnOsw9Fb3u3Wic=; b=a+m9HQ4VEPa1799uoN98Bnt9qJdDlIoOSWUbcdLlkYv6XqE5iM31FFSx CHmeaP9uvO6Av4tb0M5prAx0u9s9pUTENU46xlXlqzXXZzMfBO90Kk7gr KJ4JLH2rorvEOztVzk0vaRD1m+pB6VpqX2srbJFPjgx+C3bTKPcBqmIcZ 7ChuLo84sChkpH8CluOR41ARDazswbnFX8FEy23yPi/iGc5aZXKG0DP7T jGbJQH1OAs15VkscvjWxsfHxfvBKvUznmi4njVWSaplzrvThuisI6YAhP vxSrUHdaGwo9glL/wabwg2nNpkhvnY8+MUKl/FeQDCCFcOUgO9qKk/0OH g==; X-IronPort-AV: E=McAfee;i="6500,9779,10525"; a="290587624" X-IronPort-AV: E=Sophos;i="5.96,149,1665471600"; d="scan'208";a="290587624" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Nov 2022 18:39:12 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10525"; a="614507322" X-IronPort-AV: E=Sophos;i="5.96,149,1665471600"; d="scan'208";a="614507322" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by orsmga006.jf.intel.com with ESMTP; 08 Nov 2022 18:39:11 -0800 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 8 Nov 2022 18:39:11 -0800 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx611.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31 via Frontend Transport; Tue, 8 Nov 2022 18:39:11 -0800 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.169) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2375.31; Tue, 8 Nov 2022 18:39:10 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Na1rP6lpcDYcfAk2Om9Q35L2wtY6MjY5yHy2/5sz2pVkfB/RPT7YC6ov9nCbiPyJU39wqdg33z/ZD+baUWiQHCEmUrmHljDa31evyfCQZjiiPc/aRW5CcrPLWehDYL/9N2H1ihX68+wSca3770tamH3+hSIsmWJP1j4d34veEh82ISomqVAetwf5u/onnNVht6gUM8TDxzEN/btbygtNvfwIfyJ1cVL7vVdBwsgcn9EOFyd1Lr1txW/WAatTPzkum6A32sDa8g3lf16akMHP+n3qyhXrIZUQ4UjfX6t7IlP7eQLjJqR0PlOi481I4hPOHv4rE3ReP4uLF+IZd9FUXw== 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=Arl59AVaEyLGYbtbnljWJb+I3LxujCs2Z37O8CAJ+BE=; b=R32e9KmVKRpK1y8DvW8BAmty7EvDh19jlYY/X/xJm61oW/DhWosvf29mgwUyAPpx/TL7gSfu5vtxJInQgAOGWw1/d/novOyUx4Yeczj99QirBw+zsE44GehVFb7CMvBrsFrkltfT0SquOyYOByGww9ZfFrsxREYv+CxA+smPKoAfRGSGF2I7ebJ09Kld5m/CIQB+K0oHiZcQegs3zuH7v7DbYfm6ke/ODQiyP3mI+oJhSC4ACOHdL0y0iKlQbEf+A/RC8t3k+VmZxGS4SfpVqWazELPqteJM8syjIOJoAh/OwWEbWbT1eMWtkt0A0fFBgsiqSt+8m/I0K7+yv2B8+A== 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 DM4PR11MB7253.namprd11.prod.outlook.com (2603:10b6:8:10f::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.27; Wed, 9 Nov 2022 02:39:09 +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; Wed, 9 Nov 2022 02:39:09 +0000 From: "Pei, Andy" To: Taekyung Kim , "dev@dpdk.org" CC: "Xia, Chenbo" , "maxime.coquelin@redhat.com" , "stable@dpdk.org" , "Wang, Xiao W" Subject: RE: [PATCH v4] vdpa/ifc: fix update_datapath error handling Thread-Topic: [PATCH v4] vdpa/ifc: fix update_datapath error handling Thread-Index: AQHY81AnQmnQC/1vUUWSAJaNFO1yoa414iGA Date: Wed, 9 Nov 2022 02:39:09 +0000 Message-ID: References: <20221108085624.53989-1-kim.tae.kyung@navercorp.com> In-Reply-To: <20221108085624.53989-1-kim.tae.kyung@navercorp.com> 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_|DM4PR11MB7253:EE_ x-ms-office365-filtering-correlation-id: 04b950e1-0584-4cc6-ddb8-08dac1fb942b x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 4dXgHfoYhTnSUeXhVs04tef+HkSC4eKYAR46njSeGP2T0BgOcxdqxi5eCNwVjCXccOBa/YKBGDtdcC86W3MDK7tpMNUqmbt9Or4Ojt8bmpeVcOgiwDpEYBXPDwwlU4rztMicQw8LOClQmjqPvA1+uVViTbutiPzYiUFhdPlSCdupwUVPKhLm86O1BTHOsofoVz5BWaIP1UcfZwO6eXXhp0asxMt3O7l0QMvJbJWUyd9wnhPL55hC2I+OYkSf9az55r4fLkq1KAYtO/k/9FxR6A51h3/ly83+d9MoevLZ8ie137Dv1ScSxiuAPbe8vJ1nBCJQ0vbkNG+1Z0jDfpmh4zAvGfEx0BoDCsKngJQ8SepcZxTkbUgA6yaBP/t1GiS1r6zmoE1OAU27tVLHv2Cyu9BpqnzRO3SWOHg41M5YGCGuUAB2QOAhs/vaNvufm5/9YXiOa0OekiVhEZIvzv8lrTGwppQNuWyTMAbH+612VlaDdFkvujMKdMypZn7E3GxZ7FYLHqeIcJ9Iq5X7IYL9IwTH9zfAeXW+MKFExNVjrd/wPdQhOnLtXXUVePoTFMjmZEf2p3nhMpY6wt0smGF3X6UxsXuQ8idYuShCxITfz8Gvm5T7I6UVLWgPwoTtyzTfaTznrfqp4tbpeFRdQhEH7vdJ67+xWa/iuoLc6/nGizYlFhRoEUcdMvXk0L6fXwwlhLVCVPKw2SP2TZTHW4cD0+jtRwNxSZ5aF5bRUfHAlMDtIx+dBrbQFuoI7Us/eh2kGNj+crTZ9geNAFy+2AovUQ== 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)(396003)(366004)(346002)(39860400002)(376002)(136003)(451199015)(2906002)(478600001)(71200400001)(15650500001)(186003)(83380400001)(122000001)(38100700002)(107886003)(33656002)(6506007)(7696005)(26005)(53546011)(9686003)(82960400001)(38070700005)(66446008)(64756008)(8676002)(316002)(4326008)(86362001)(66476007)(55016003)(66556008)(66946007)(76116006)(41300700001)(52536014)(8936002)(110136005)(5660300002)(54906003); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?AACXNzTqJvGIGECvsw8o78VvC5Jy6jlxuKYSemtxiBIK26fpBpO1lOMMkuqt?= =?us-ascii?Q?G/raVi5sYzIlyoelkKqCeodqyfKEGugva38gUxLnGZD960dvM5CZzAug22Aj?= =?us-ascii?Q?RAHxfh+Bx6t71Ejk+m+fb13fNn+5WAxq2rOOMF4aIlVEeyJt76xP1PbZlA5B?= =?us-ascii?Q?TtDS94/mdDp2H61Al78VaDNyp0ZX2GMiAMnlpdvNnjt6zkaNu7s5nja+CzGM?= =?us-ascii?Q?vHy9cDAdDuzGVgTEO+QzHRKyukYTKrfan7+ByCY+xeKYer1BRqRiNTH/NWaw?= =?us-ascii?Q?4/HuRrKGsVyB3SOgYVzSWFIxN0AshhILI7wVxGjTOxnNlFexJEqkY8SmkuBv?= =?us-ascii?Q?Mpu+WUDRn3EzhG14tGiPDf7G6Nt9G71qJjt/EdH1zdxA1ZVBxjec1nZUSx3R?=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MCbSxifxYBKzfO6uMH1Kk+JwB1dhoceaiUQAhf63kN?= =?us-ascii?Q?hhFa9uJyLVNOCG+4fr/1+SNzgKVVbRtHD8rgm2QtSy+FoviHSl+a8a39r8+o?= =?us-ascii?Q?qdYvVcqTniHl6kal8hMWzG99fQjgymj6YSk0Xvvopg5mqfRCPcsxQD3HkE5A?= =?us-ascii?Q?/H1cvwUFGVB3bS07nmGwEAIWJGJA70ELSz6MP3F3oyjqKPY0zFjDuURd9UK9?= =?us-ascii?Q?Qi1rwgatBTSSNeGQgxXed3Q2aK1yzTOv2KLXC1hYg9EzqsmQES2/k7vIK5aF?= =?us-ascii?Q?PoYqvzg3L4a5xnG+BUjvGEpXrI1thL0BawJgzaOE?= 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: 04b950e1-0584-4cc6-ddb8-08dac1fb942b X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Nov 2022 02:39:09.3045 (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: AVZrlKRpHUoJumyOOXteJZcaKxhF/u2GT8ebypJyme3Axl0wd/cfcPiAJ7FFL6ujxrV0ljKGIh6EYcQpfYDlQg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR11MB7253 X-OriginatorOrg: intel.com X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org > -----Original Message----- > From: Taekyung Kim > Sent: Tuesday, November 8, 2022 4:56 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 v4] 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 retu= rns an > error. >=20 > Fixes: a3f8150eac6d ("net/ifcvf: add ifcvf vDPA driver") > Cc: stable@dpdk.org >=20 > Signed-off-by: Taekyung Kim > --- > 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 Acked-by: Andy Pei