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 3DC99A00BE; Fri, 12 Jun 2020 13:05:45 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A36D42C16; Fri, 12 Jun 2020 13:05:44 +0200 (CEST) Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50055.outbound.protection.outlook.com [40.107.5.55]) by dpdk.org (Postfix) with ESMTP id 25AF82C15; Fri, 12 Jun 2020 13:05:44 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=B5ANUCnn4KD/jERMgIfLat4GpvPRE4st3ErNtKOYsG/N09dXq6q5j62rCHVTxy3vUu5VQKLnrzAd0EEco/Gb94uKjGf8lUxXb59hxinj+zbTvB3Pfc3lpqyp68eKVQf1kzm0+e14TNKeHkbLy0ap43ptPA61AZGX1vHeEqJjMsgsOBu8GTOgHskcAX9f/6kCcLkL1Hfv+wQSsQB5J3ok4nU6b0lrcGp9I82QUafyiK7A0lrXtWkn8gqR+ByekN4YLvXQLT0jPwA9DzXggzvr2iF/4HsznwVmNptGD26iW6+IACA58UWToY7WMWDJdOsiOTScDts86CEEeAUxneBoWg== 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=sXlrSAMxLyB43ItT9i6KUFjmXnkppuWOYbpy/poK7h0=; b=MVtZyT+7niHqu0CWz9kRMFC/+9/BeTxAKLnFEJOYfFJAvKOR3IwAkaDAv3xhPc5PKewIzdvvTA3B+CazvtixE8kUMhhcGDqQWGLMen003emWvgui3udXk36dTuk/fXyNNUBzpITtEo879pgj38m1l/a/PtBHwFCIbDFbxaFBdaIog+PVvL8VK7LEZY3qxPyfOSB11Ul8w1l3jP0URR7/loBiD6TfmaGMsoYIUIjSgD+toploWuTqFsPG2wwKxSsyycemXG/AeujN4XvbA7Tywf/KPuNyIIlZ5SCHP3WV6Pq14qaGhT6XGZlD+9PY27Dpcds6OmToZ6Zv3qmJten4mw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none 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=sXlrSAMxLyB43ItT9i6KUFjmXnkppuWOYbpy/poK7h0=; b=iTtI+qsoi+FTK4R47sZqSXOZ0D1Uo/b4E1ILWCC2r0RNLiJAxBrqoyKHCgCUh22HC/ivYxJq71VmJln2LVt5rDbh6k2qx1KWA80PXdvZ/80TZiwmZd9mpPRC2ctZmR8CFvH+29uF39PrhyyevLgFiw9Kjn4/HzVl3Q5gXpU2wBc= Received: from AM0PR0502MB4019.eurprd05.prod.outlook.com (2603:10a6:208:f::11) by AM0PR0502MB3860.eurprd05.prod.outlook.com (2603:10a6:208:26::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3066.22; Fri, 12 Jun 2020 11:05:42 +0000 Received: from AM0PR0502MB4019.eurprd05.prod.outlook.com ([fe80::b189:d782:4c74:7998]) by AM0PR0502MB4019.eurprd05.prod.outlook.com ([fe80::b189:d782:4c74:7998%7]) with mapi id 15.20.3088.022; Fri, 12 Jun 2020 11:05:42 +0000 From: Matan Azrad To: "Xia, Chenbo" , Maxime Coquelin CC: "dev@dpdk.org" , "Wang, Xiao W" , Tiwei Bie , "stable@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] vhost: fix host notifier configuration error flow Thread-Index: AQHWQAemzWjdqjaFPU6OHcLoVl/KdKjUlV6AgAA7+cA= Date: Fri, 12 Jun 2020 11:05:41 +0000 Message-ID: References: <1591890450-63055-1-git-send-email-matan@mellanox.com> In-Reply-To: Accept-Language: en-US, he-IL Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=mellanox.com; x-originating-ip: [85.64.241.22] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: e43952e4-a421-4d33-a8e1-08d80ec08c2d x-ms-traffictypediagnostic: AM0PR0502MB3860: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6108; x-forefront-prvs: 0432A04947 x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: lOiNOM1Cr3j9hpZVHWDWWjtTdwhrRAfY/uBN51V2Y08okDdBV3lnSElbCWXD4HGeO4/wTq573AU5pfcWMQxei5pUcWJENVx31uapF47EgYxGnKbhNXXpvhIl5KK9gKz57S3AxmuMdOWtM8EiJFIaXrP0+tI4GKXaroXY5/qsHxj9x6nD9dkt4Ky4UkRfCuxi+eM2DNpXZae9PVh6bJNgqGwPVD6I7SOHhUjjR7FAr7tMTS/gGszE3oWkz6nbwrTkIR8XNBWxZtRG6ktbz1HWbZyW3OxhtTnOsa3g30T+QLAaSAuW0Z+9LTtBCB67bU3Z4Oei2eL46tb5uOKeCvt4pw== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR0502MB4019.eurprd05.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(366004)(346002)(39860400002)(376002)(396003)(136003)(316002)(186003)(66556008)(7696005)(52536014)(86362001)(64756008)(9686003)(76116006)(26005)(66476007)(53546011)(33656002)(66446008)(8676002)(55016002)(4326008)(71200400001)(66946007)(6506007)(5660300002)(2906002)(8936002)(83380400001)(110136005)(54906003)(478600001); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: iQjpzj7yyuS/oYuGTzoD1CsXYgg0kdAOB9HlQEuHFyrzS1eiNY1Ij0ScyWQY04hn4HhVY4CbXMKE96MeMINU32JPDHt8w+0yC+9fiLSj6h/AKifZTg7vIaII1J50U8aR579Yk394VipR3A6HL1vqJCiuX4QnGyq1P1k93WrtHLmj2XCvCwLgfgeEjB/DAKg9pce0rs3/a0iM4kIertYz44jpXToQcmQUE5hRqzo01vDuxLA/Qh04+aNvXd/VIuv7kMUdfpvZQlUT61eo+KiGKFPd7X9XhGxhwx4D6DoPuAeBeNN6NrJPQRpP0NXT1WhIu1nop2BwnLSLq1TeeO741QrEM4BOo4rjZ1DqTkWCz78ozvyhCwUZ5fOSFx8usuilX/CA3cSD4rS8DK5mEnn2Sy1ucPrMKdV0QsyJe4CnYoFt1lZ3tlbX61ghiEZXJKRcBs9crN8COcF11D6RsNex6PLmT5vg7WN/cwAXfuFXDv8= x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: e43952e4-a421-4d33-a8e1-08d80ec08c2d X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Jun 2020 11:05:42.0367 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: MAnHGJBXSqq5iJ1TnWpEOGPALtBlpBlZ0yPnqDVBcVlIVvlH2DUhy30lPm4NevDBigSZbPiT0C6fYPBFd4poxg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR0502MB3860 Subject: Re: [dpdk-dev] [PATCH] vhost: fix host notifier configuration error flow X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi Xia Thanks for the fast review. Please see inline. From: Xia, Chenbo: > Hi Matan, >=20 > > -----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 repl= y > 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 configuratio= n. > > > > 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; > > + } > > + } >=20 > Based on your commit log, I think you want to check the reply msg sent fr= om > qemu but msg is the request sent from vhost-user. 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. 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 wa= s stuck. Any idea? > Thanks! > Chenbo >=20 > > > > ret =3D read_vhost_message(dev->slave_req_fd, &msg_reply); > > if (ret <=3D 0) { > > -- > > 1.8.3.1