From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr150043.outbound.protection.outlook.com [40.107.15.43]) by dpdk.org (Postfix) with ESMTP id 7F7F91B10E for ; Tue, 11 Dec 2018 19:54:50 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qvU74HpE4fFIW+NqTmKJ0skve5smDm2eSkzrZvvoUS0=; b=B2QnWwgngzjyU1oZiT/JHPugDk7kQVqhGbuAf4q4wfxrL5AaubJ2WafRsMb0Ncmx+ccNQz5SiFxn+gTbWyDBx/OW5pUysIR+VFPGL5WD5Vd99y/TzwbNM0f2HTdHGGklAd0sgrRNy6R/NNhUx2B0CCmCX0JMrV+/DKNa/PTE4BE= Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com (52.134.72.27) by DB3PR0502MB3979.eurprd05.prod.outlook.com (52.134.67.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1404.22; Tue, 11 Dec 2018 18:54:48 +0000 Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::dcbc:4578:3018:50f3]) by DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::dcbc:4578:3018:50f3%5]) with mapi id 15.20.1404.026; Tue, 11 Dec 2018 18:54:48 +0000 From: Yongseok Koh To: Yahui Cao CC: "tiwei.bie@intel.com" , Yuanhan Liu , Maxime Coquelin , "stable@dpdk.org" , "zhihong.wang@intel.com" Thread-Topic: [dpdk-stable] [17.11] net/virtio-user: do not reset owner when driver resets Thread-Index: AQHUjfqEe599oBYhf0W0PMuqHA8UP6V56gSA Date: Tue, 11 Dec 2018 18:54:48 +0000 Message-ID: References: <20181207065850.14518-1-yahui.cao@intel.com> In-Reply-To: <20181207065850.14518-1-yahui.cao@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=yskoh@mellanox.com; x-originating-ip: [69.181.245.183] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB3PR0502MB3979; 6:VwoGnCtrOT2cx+bKFgjtoMHauEJPCAeKlrd1Jj7NM2g2BR8lOfd/2M9JtagnpBdbgRq6aoZA1/go6Uxt8Tzmy5DdHorPowVBHvEyRpe917I4Wg4X6yYwin+x5uwpLO+ujQ/4huRj7LGSGae35YgnnfEs/k/CgKNH4QUDT+pI188AihP614yR3bCbXpfiyhbmzSpKWk6KghK+AleBYE70UorBnxu5r/L03GjD7OuojshEJfBGiNvL5CtZQPXrUPbvM2LLyJj0cXT2+ZwCW+8G+Lc1DkIOsiSFAYUiFE6zfEPL7oDa3rwC6PaFu38knq9c1K9CkBOX3uFtl/pSS9R+c3cnMKolsnmAedeW6Lad0Xt1jJHRocd39m4gnLreNqDCIlSzBUB6bfhjmpcIz6mIO5rxyjz48xTMrDpQPL9DhrAjWt/r1YXGns1tfJsQOwR/XF1PxpTZ12aQthwOZoYp9g==; 5:q+Ggj35FTliHn9z0FjWfuLQ428x5+dtDSHPlZomTne82Gznpr9WF9tD++GawAVbG4UOInK1S4los1jCLKGyOmu161fUL/Jf2omLdEnqoyw61g5nEvWRvN6hkdlwZa2cmAw8cF+JacQ2W+cy8LT3q65B02oN1WZkmCWVbZqGY7rI=; 7:E+yUJphCsNkfwu31BFlhAiLLR2FvusX1FVel0VLJD11VlaLUcrBbw1HHnUDA4kAbuiNMnOaonJYWs8Mg6MTiWsHTB6UFnIN98oxvnvWCY4Z9o3A8GhFPhBHezI+xg6G2NK//ofIVavmGwNUIBbRUcw== x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-correlation-id: a8ab32fe-88b2-41c8-dafb-08d65f9a1fcf x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:DB3PR0502MB3979; x-ms-traffictypediagnostic: DB3PR0502MB3979: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(3230017)(999002)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3002001)(3231472)(944501520)(52105112)(6055026)(148016)(149066)(150057)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(20161123558120)(20161123560045)(201708071742011)(7699051)(76991095); SRVR:DB3PR0502MB3979; BCL:0; PCL:0; RULEID:; SRVR:DB3PR0502MB3979; x-forefront-prvs: 08831F51DC x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(136003)(396003)(39860400002)(346002)(376002)(366004)(189003)(199004)(7736002)(105586002)(81166006)(82746002)(575784001)(305945005)(86362001)(478600001)(14454004)(2906002)(97736004)(6486002)(25786009)(3846002)(6116002)(81156014)(6436002)(68736007)(33656002)(4326008)(8936002)(106356001)(6916009)(229853002)(99286004)(316002)(486006)(71190400001)(446003)(83716004)(71200400001)(6512007)(36756003)(476003)(2616005)(11346002)(14444005)(256004)(66066001)(76176011)(102836004)(6246003)(53546011)(26005)(5660300001)(186003)(6506007)(53936002)(54906003); DIR:OUT; SFP:1101; SCL:1; SRVR:DB3PR0502MB3979; H:DB3PR0502MB3980.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: 1cza4Bm5hudts2PzrEn2/WqDK95wfqlKs2u1GpIVzDx17AEknpFItLbNV3ARJnVMBFVc9r2s4NeLtkl7ju2bqCQnGgu4IRGBY5hhpPG47oA4PjwIFs5Umv5doAiILXUOKCNrFkgtIOPT2ZccYQb8zHu/Dy44wQ5t+MwZMWyHwEhynQh94R8QR19DOBEM9qpGYx2jalotJt4OCCge82pptDGxtV2JzpUiW8xja0Upb+0VLTeQLVA1CCRt0ITNAR0uHmq8WUNsv6Mn41GNqSR3Zq5uSXJErA5glzn3PfDh9suJxUdNlhtTmy3hAu6u6x1i spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-ID: <6E8A7AE365C83543A51D2F0385555DB2@eurprd05.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: a8ab32fe-88b2-41c8-dafb-08d65f9a1fcf X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Dec 2018 18:54:48.1480 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR0502MB3979 Subject: Re: [dpdk-stable] [17.11] net/virtio-user: do not reset owner when driver resets X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Dec 2018 18:54:50 -0000 > On Dec 6, 2018, at 10:58 PM, Yahui Cao wrote: >=20 > [ backported from upstream commit 74dc6746a0f195907ec487df7de18a856108482= f ] >=20 > When driver resets the device, virtio-user just needs to send > GET_VRING_BASE messages to stop the vhost backend, and that's > what QEMU does. With this change, we won't need to set owner > when starting virtio-user device anymore. This will help us to > get rid of below error message on startup: >=20 > vhost_kernel_ioctl(): VHOST_SET_OWNER failed: Device or resource busy >=20 > Fixes: bce7e9050f9b ("net/virtio-user: fix start with kernel vhost") > Fixes: 0d6a8752ac9d ("net/virtio-user: fix crash as features change") >=20 > Signed-off-by: Tiwei Bie > Reviewed-by: Maxime Coquelin > Signed-off-by: Yahui Cao > --- Applied to stable/17.11 Thanks, Yongseok > .../net/virtio/virtio_user/virtio_user_dev.c | 18 ++++++++++++++---- > 1 file changed, 14 insertions(+), 4 deletions(-) >=20 > diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/n= et/virtio/virtio_user/virtio_user_dev.c > index 7ce512c76..b13e77f5f 100644 > --- a/drivers/net/virtio/virtio_user/virtio_user_dev.c > +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c > @@ -166,17 +166,27 @@ virtio_user_start_device(struct virtio_user_dev *de= v) >=20 > int virtio_user_stop_device(struct virtio_user_dev *dev) > { > + struct vhost_vring_state state; > uint32_t i; > + int error =3D 0; >=20 > for (i =3D 0; i < dev->max_queue_pairs; ++i) > dev->ops->enable_qp(dev, i, 0); >=20 > - if (dev->ops->send_request(dev, VHOST_USER_RESET_OWNER, NULL) < 0) { > - PMD_DRV_LOG(INFO, "Failed to reset the device\n"); > - return -1; > + /* Stop the backend. */ > + for (i =3D 0; i < dev->max_queue_pairs * 2; ++i) { > + state.index =3D i; > + if (dev->ops->send_request(dev, VHOST_USER_GET_VRING_BASE, > + &state) < 0) { > + PMD_DRV_LOG(ERR, "get_vring_base failed, index=3D%u\n", > + i); > + error =3D -1; > + goto out; > + } > } >=20 > - return 0; > +out: > + return error; > } >=20 > static inline void > --=20 > 2.17.1 >=20