From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 70F46A04A5 for ; Sun, 14 Jun 2020 15:11:22 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4FE404C90; Sun, 14 Jun 2020 15:11:22 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 2EB42FFA; Sun, 14 Jun 2020 15:11:17 +0200 (CEST) IronPort-SDR: aeFmpZ6HZd6dlPiYAoJQInnJI+/FPlR+d/ByCZZcqAaxKpsV9HeK54kEDLcBZuSmfNlcJ4vWHG 4oyVAv590kRA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jun 2020 06:11:17 -0700 IronPort-SDR: pWZyVDSZHtSjwAPs1X3p1ZSJpL78W95RqWyBTPhf6l52deW1SCGhsAsaRlFkgh+NYEZ+nnd0G7 zN+AGrVK9wng== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,511,1583222400"; d="scan'208";a="262186404" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga008.fm.intel.com with ESMTP; 14 Jun 2020 06:11:16 -0700 Received: from fmsmsx607.amr.corp.intel.com (10.18.126.87) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 14 Jun 2020 06:11:16 -0700 Received: from fmsmsx607.amr.corp.intel.com (10.18.126.87) by fmsmsx607.amr.corp.intel.com (10.18.126.87) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Sun, 14 Jun 2020 06:11:16 -0700 Received: from FMSEDG001.ED.cps.intel.com (10.1.192.133) by fmsmsx607.amr.corp.intel.com (10.18.126.87) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1713.5 via Frontend Transport; Sun, 14 Jun 2020 06:11:16 -0700 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (104.47.55.173) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 14 Jun 2020 06:11:16 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gY1dPAtmQYbUmV4a5ud5MVwfXSBAZjXhgDHMB1QvMP8yiNG3YqVBJFI232Jl+BdPhTU2xXgD0C0yUjMEYyITd5mb1edyKiXzC+uGPj0M5gdKwXlgVoYSIH+J0oavBSvFTENqVQtRgw7rYmkjjuY+7I//mk+ihCNcO7nFf9HkiUV5VqKjFCfFMQAogalQeXI17DjCPrBWt7SsxZHOruwAt0gL4nf4ESyX0GmcokSqafaU3JHGcuH42hB1CEBuZk/ubKGSZ87fkpaK7GErGIGrwlBMi6N/ZELnXrJRx38pSnkp/MSaMxEDPueKEtrnYLY53bo8a4Hoa6pEUNHi3jSgSw== 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-SenderADCheck; bh=Ay/ch2dfdAxE2Cymk77KS4BYma5qKM2K3cXhgRX8vVA=; b=RkOKXQdTIa19E5FvTYCNb29+uDynlLin9jOcn6VrUHK43C4nxc1vKaAfnFSuOPcgCD8fH8dmKj4jU0E1IoeeFHGpcLWRE0A1qjWTCcTznrggUg/8Cb2C3Dg/BeNoQuXnatdkXAoOMxLT6JHi0QUhfQ1Vjc761l+hD3JuGhWNvOK2snhF2bpj3cHFntscTHVOpiA8hyDBhCNpupTlaM+qh/wZUXDKhx3A08ImMMF+YfA4L0AfmlZ1MR3f+8TyM4WMLcU8UgHjQ1UAgIpo0TAObmAC9hB+jp+tm1+AQdondF1s8ZmmWe7bteYPIXUu+/Wy8OzuTOu89R2bCdAmE+222g== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Ay/ch2dfdAxE2Cymk77KS4BYma5qKM2K3cXhgRX8vVA=; b=OGEEai7GBMuk9Wuf0ff0TnoS5/G+RG9HR2Iobp60In+DXphcKYuHUCPi7qjHRG3xCKJuHk8Ng9T9BAc5/H6PZ5PDeKYXPaFd2GIFpoJsuyJm7/V+3FXaj4SI4BacLhSEvhuTk/qz4RyWc8zF751RheMZcOXwKeVTBinwlCmF464= Received: from MN2PR11MB4063.namprd11.prod.outlook.com (10.255.180.22) by MN2PR11MB3821.namprd11.prod.outlook.com (20.178.253.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.18; Sun, 14 Jun 2020 13:11:14 +0000 Received: from MN2PR11MB4063.namprd11.prod.outlook.com ([fe80::7cde:8326:5010:c47e]) by MN2PR11MB4063.namprd11.prod.outlook.com ([fe80::7cde:8326:5010:c47e%7]) with mapi id 15.20.3088.026; Sun, 14 Jun 2020 13:11:14 +0000 From: "Xia, Chenbo" To: Matan Azrad , Maxime Coquelin CC: "dev@dpdk.org" , "Wang, Xiao W" , "stable@dpdk.org" , "Wang, Zhihong" Thread-Topic: [dpdk-dev] [PATCH] vhost: fix host notifier configuration error flow Thread-Index: AQHWQAe/lk58cnHHtUW3UfEt3zjeK6jUky0wgAA/lYCAA0NvcA== Date: Sun, 14 Jun 2020 13:11:14 +0000 Message-ID: References: <1591890450-63055-1-git-send-email-matan@mellanox.com> In-Reply-To: Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.2.0.6 authentication-results: mellanox.com; dkim=none (message not signed) header.d=none;mellanox.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.55.52.201] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 05bf262b-5d5a-411e-8702-08d810646aaf x-ms-traffictypediagnostic: MN2PR11MB3821: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:5516; x-forefront-prvs: 04347F8039 x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: EkJ2SrRXijp7//D7BlBz4wlG008fTMteCNx5zcz9iJHSNa8XJ1keepxjmB4BEHs8k77kn/fH9jKVqlGSeYjbb7GEXLClgcjd91AFNAfdhHVnQPjL79wCuv5Uq75ZpSe1NcjKUb1PeMwLLAtwN6y7K/noJC/qEuE/OeAXV34YumNz+bJDfMIdlSiUhCMOSF9RCxbjP/xsph7zgOj1naOqokf6jbYNXXBwoecWDHkyIxNQNYgPWoJjjJBVvZvzUvPmJSIBzl/5p1KNBN0QYzoQV66v/uNyTFYOF3JmxmLqkJ9G205Lb/f4JkMn2a1ANASyTMEIR5Pj22aHwmY75/ZTHA== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MN2PR11MB4063.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(346002)(366004)(396003)(39860400002)(136003)(376002)(8936002)(4326008)(5660300002)(71200400001)(8676002)(66556008)(107886003)(83380400001)(52536014)(9686003)(478600001)(64756008)(66476007)(2906002)(66946007)(76116006)(66446008)(86362001)(186003)(26005)(33656002)(316002)(55016002)(110136005)(7696005)(6506007)(54906003)(53546011); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: 8aaRqTIRpyloHY8izrfGUZnAdnUxaJUSawEg0f9dXsS2aHEn05qcVz6aa+RUbrr05mIyFIDljVMBQT8T5IsQuXSkX/8N8fj5vfNViRkEfnC5lZuq30EAtHYQLscZ6+3B3KpT812Tv2wxf3m418rZZdK2+ZI8YmZ2NAgp57qQFuh9LjFW+uS2a73XMxIQwJxzqXVHtGPlPtbbOTKwKJuapPGbGWYnxk9dz+D1iXBCkHMtkm/5hhfSh5QtCE1KS5vHltihIHoJCkBgHfSbpmUXP/i6HytzxTguFiNAuD5WNjAupgvoqdj/Qa0Y6YFeN/AHYror0uLG55HgTEu2kRtG/vgGerO5o5ZCS8PKEvQ1QD337kOHBdvYj9tk7YBjMTaZhs5G0rhL1aGiyzLuRXhbNSFNCuHcSpXW/Dy0w1rvumAHE5G98K5jt4BMiKFORKNebn3f6ga/LByXxSWW4mfZuy4KN09djXVunXSGI4jnTo4= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 05bf262b-5d5a-411e-8702-08d810646aaf X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Jun 2020 13:11:14.1969 (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: ffDf5Y9VJLudpRUiV6EzPY6Nt4kqRZiZ4hGPWiye+OU8IxH0IllbOjWM4KOVsaiNi0ASDwGmoKGOkd5HPA52+A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB3821 X-OriginatorOrg: intel.com Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH] vhost: fix host notifier configuration error flow 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: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi Matan, > -----Original Message----- > From: Matan Azrad > Sent: Friday, June 12, 2020 7:06 PM > To: Xia, Chenbo ; Maxime Coquelin > > Cc: dev@dpdk.org; Wang, Xiao W ; Tiwei Bie > ; stable@dpdk.org > Subject: RE: [dpdk-dev] [PATCH] vhost: fix host notifier configuration er= ror flow >=20 >=20 > Hi Xia > Thanks for the fast review. > Please see inline. >=20 > From: Xia, Chenbo: > > Hi Matan, > > > > > -----Original Message----- > > > From: dev On Behalf Of Matan Azrad > > > Sent: Thursday, June 11, 2020 11:48 PM > > > To: Maxime Coquelin > > > Cc: dev@dpdk.org; Wang, Xiao W ; Tiwei Bie > > > ; stable@dpdk.org > > > Subject: [dpdk-dev] [PATCH] vhost: fix host notifier configuration > > > error flow > > > > > > A vDPA driver can configure its device FD to be notified directly by > > > the guest memory mapping using `rte_vhost_host_notifier_ctrl` API. > > > > > > The driver request is managed by the dpdk vhost management and is > > > forwarded to the QEMU, the vhost massage includes reply request in > > > order to be sure that the memory mapping was done correctly by the > > QEMU. > > > > > > When QEMU finishes the configuration, it marks that its replay is > > > valid in the slave FD using VHOST_USER_REPLY_MASK flag. > > > The flag is set only in success and when the slave FD includes the > > > reply > > data. > > > > > > The vhost library didn't validate the above flag before accessing to > > > the slave FD, it leaded to the thread to be blocked on recvmsg call > > > forever in case the QEMU has some problems in the notifier configurat= ion. > > > > > > Handle VHOST_USER_REPLY_MASK flag to validate that slave FD includes > > > a reply data. > > > > > > Fixes: d90cf7d111ac ("vhost: support host notifier") > > > Cc: stable@dpdk.org > > > > > > Signed-off-by: Matan Azrad > > > --- > > > lib/librte_vhost/vhost_user.c | 10 ++++++++-- > > > 1 file changed, 8 insertions(+), 2 deletions(-) > > > > > > diff --git a/lib/librte_vhost/vhost_user.c > > > b/lib/librte_vhost/vhost_user.c index > > > 84bebad..aa19d15 100644 > > > --- a/lib/librte_vhost/vhost_user.c > > > +++ b/lib/librte_vhost/vhost_user.c > > > @@ -2833,8 +2833,14 @@ static int process_slave_message_reply(struct > > > virtio_net *dev, > > > struct VhostUserMsg msg_reply; > > > int ret; > > > > > > - if ((msg->flags & VHOST_USER_NEED_REPLY) =3D=3D 0) > > > - return 0; > > > + if (!(msg->flags & VHOST_USER_REPLY_MASK)) { > > > + if (msg->flags & VHOST_USER_NEED_REPLY) { > > > + ret =3D -1; > > > + goto out; > > > + } else { > > > + return 0; > > > + } > > > + } > > > > Based on your commit log, I think you want to check the reply msg sent > > from qemu but msg is the request sent from vhost-user. >=20 > Yes, looks like I missed here something. >=20 > > > > Also, could you clarify the problem based on that? Because I see in > > QEMU > > v5.0.0 that if vhost request has VHOST_USER_NEED_REPLY_MASK, qemu will > > set the reply mask with VHOST_USER_REPLY_MASK and without > > VHOST_USER_NEED_REPLY_MASK no matter the handle is correct. Do I miss > > something? Please correct me. >=20 > I got stuck in this function while receiving massage back from QEMU(4.2.0= ). > Looks like QEMU printed "Failed to read from slave. ". > In this case looks like QEMU doesn't reply and therefore the dpdk thread = was > stuck. > Any idea? I see in QEMU code that the error is caused by recv size not match, could y= ou check on the slave channel send/recv? I check in dpdk code that normally all the slave msg should have size large= r than VHOST_USER_HDR_SIZE. There is one possibility that dpdk close its socket for some reason so that recvmsg retu= rns 0. But I am sure. It's better to check on send/recv of slave chanel :) BRs, Chenbo >=20 >=20 >=20 >=20 > > Thanks! > > Chenbo > > > > > > > > ret =3D read_vhost_message(dev->slave_req_fd, &msg_reply); > > > if (ret <=3D 0) { > > > -- > > > 1.8.3.1