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 A9557A00C5 for ; Fri, 12 Jun 2020 09:26:07 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 38EB42C15; Fri, 12 Jun 2020 09:26:07 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id 5D8F6F12; Fri, 12 Jun 2020 09:26:02 +0200 (CEST) IronPort-SDR: 810zdUA8+vkgBk6CIZTA9UKyAfc+QRRaIX8No/QfL3YWrvhPfNkC1xRgQqQclDvqDFUImFrwxq wtdQk5GU39Gw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2020 00:26:01 -0700 IronPort-SDR: Bp0WrCFakVe+jYP9HDqoi7YHTyIrRy51TWeMwo5DgLKeQlIc2th100BQnf1Nor/l84ZFyi1lZz CcmCekd0nV/A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,502,1583222400"; d="scan'208";a="296869731" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga004.fm.intel.com with ESMTP; 12 Jun 2020 00:26:01 -0700 Received: from fmsmsx113.amr.corp.intel.com (10.18.116.7) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 12 Jun 2020 00:26:00 -0700 Received: from FMSEDG002.ED.cps.intel.com (10.1.192.134) by FMSMSX113.amr.corp.intel.com (10.18.116.7) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 12 Jun 2020 00:26:00 -0700 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (104.47.70.109) by edgegateway.intel.com (192.55.55.69) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 12 Jun 2020 00:26:00 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=k4eahUQSG6iGWcJA4peKgNmbrgSAeZsr/7jh6UnlVMqqagJV/JX54h+KmZtOAQbhCFf46UxLZaJ4SKxkz300tJiRgoHag+0ce7KHRp/ySTXLQsM52bsgNxXBxWVjZkEimrOwtBc3pcWLNxnq7BkuKyc20rNwuucD2Afo0xkyxuSAGEnVeD3NBrJEBqlW9IHoLr9lH0neC454CtyIM4b3rE5t4BAPkv3LWBF75mBb7UOCMHsDNW9jtGi2Nt1L+jDduwrbP4MDRGBCYxI4tmf1rXB9J/qYcZC1H7zIAtKqh8cnbQT4kE+huGSmKu2+GLHMl8hj4wRJSYieJBYr/fK7rw== 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=EXgVFi33U6bcRsO/PoXy8WjvbIfnU2NphjNhQ/CjtDI=; b=j4zgUJPZiEJfA0uJprn7G4w2LZcZHazsU503R6RDfGBWEmktSHwVOs/luqUvVEiDa2W0nhhYQoQxOsZsuds3Y2ATJnH1bQVkkw5pgAqhNBoO0NnTzx43He0jgZbrOI9xM640MblSvZ3ays3oysL1JFVAOoyeuAlksMHZYUeWGCd6Kd/W719Oa+TMl70xwT4pX5rgkYXcvNQplzjBcla6p2O37JAulWymSp06wgZG0o2YqMIJyE7PPYgOqyvgXarfAHRlOZiGUw27xmJuAP7FnK+N26U7PvoR04lHW8VIWmhZyESTyjAYOMv/YBSARbsL5ON/tasU4nRIw0MnGMNHzw== 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=EXgVFi33U6bcRsO/PoXy8WjvbIfnU2NphjNhQ/CjtDI=; b=ptyPlgzzMA846zGVRyknxSR6hlrRe+XNqfNxiKsSsbcuOFJjr48YJMXNCIKiBwZLSVar130G4RBmF/DbK1D/BUaO+ruJn+ayFPfpeFCpghheaaZ81ha+XbLAk7y4+E6oTOHriEd4il3VGAWbgh+t9SnKMpOnNspSACUpIH4wmjo= Received: from MN2PR11MB4063.namprd11.prod.outlook.com (2603:10b6:208:13f::22) by MN2PR11MB3632.namprd11.prod.outlook.com (2603:10b6:208:ec::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.24; Fri, 12 Jun 2020 07:25:58 +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.023; Fri, 12 Jun 2020 07:25:58 +0000 From: "Xia, Chenbo" To: Matan Azrad , 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: AQHWQAe/lk58cnHHtUW3UfEt3zjeK6jUky0w Date: Fri, 12 Jun 2020 07:25:57 +0000 Message-ID: References: <1591890450-63055-1-git-send-email-matan@mellanox.com> In-Reply-To: <1591890450-63055-1-git-send-email-matan@mellanox.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: 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.46.36] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: fadebec1-3124-4871-26fa-08d80ea1d9fa x-ms-traffictypediagnostic: MN2PR11MB3632: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:4125; x-forefront-prvs: 0432A04947 x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: ED1PEjyaXzxUUQYBN/BjtHlY+MMmKS8oNPT8gobk9HtCvD/+bGTd3wMq7BQkVSIwgVutDsb3lfEB/nXxLSAiT1FMbol3VZe0FPMtH5xCozcFVvRG2VkL12RoSIpNVwZRy6UEyd9yq6tFNvsjc1SAO8zbxI1l1F0TfMOkLG66bTu/GPBq1dOsCaFGUWuXNjgfxv8SQ5lkLIzLox6zZw3k6TPo1ZAZq1VqQ86mCoXKcudJgr4kP6b0DzPfdwhafhH7iN/LiFEnDNfuqo3G+to6j/hqn4KuVpOQ1b6T4Ow8F3h+ITzCmh9rmggtFtiaKRh0zNX5acOtieYI0zWOd1l+kg== 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:(136003)(396003)(39860400002)(346002)(376002)(366004)(66476007)(66556008)(64756008)(66446008)(66946007)(8936002)(478600001)(186003)(9686003)(5660300002)(110136005)(83380400001)(316002)(2906002)(54906003)(4326008)(86362001)(55016002)(71200400001)(33656002)(53546011)(6506007)(76116006)(26005)(7696005)(52536014)(8676002); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: DCcrf21kvJpmi0gBK9oPyNEdsbUmDK4tvO03Z0CFBNpTLlTZjzsO4vRdxH9jfWZpQEgi/H8HD0+Gez8BezzsPrrqsCmSR2yz/W0m3qolX0erjhFAcsTi7elARwd6KlqU+7BozdE+8/uxe591hcFN3yXJjISkqX6ccZaPA1XP7JYzOYyLQA+R2ffMeQp2G8WLKieCHjdEhlqbrYgdzwWl0cQjnpXhzodUzQTXf6P/gZdVy7xiA48IEPFWrgGyHfBhHS/3d+6rBaD0V9EvCg1cpKGQMFJgDkuiybgJm71+JXuqorHmRJg55IUuxyQDoLPRd/AjiJKYm6Zf5rlOLs5/6/ThxIsBD3/ifC7xkdN1CO3gVr6iOSsMOvxCsc/DY8EL6HHdKneuRH+owhUt9RkJ6CMF75jeiiKOzQ+jN5OU0T13rMtC+PmMe8fqmiEzAzhVXLpUXLoE+tlA25ao8EF2jrV/NayKO3X0g+xCqSV+6+U= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: fadebec1-3124-4871-26fa-08d80ea1d9fa X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Jun 2020 07:25:58.1119 (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: an2BLOSVw3NFfCIs6NzKc54Ubsr3iewS96dN61hqtrTt0gyFxS0e3hRYRhrSKd/XE09e2Go+UZGfYXDE+Cts0g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB3632 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: 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 >=20 > A vDPA driver can configure its device FD to be notified directly by the = guest > memory mapping using `rte_vhost_host_notifier_ctrl` API. >=20 > The driver request is managed by the dpdk vhost management and is forward= ed > to the QEMU, the vhost massage includes reply request in order to be sure= that > the memory mapping was done correctly by the QEMU. >=20 > When QEMU finishes the configuration, it marks that its replay is valid i= n 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. >=20 > 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 configuration. >=20 > Handle VHOST_USER_REPLY_MASK flag to validate that slave FD includes a re= ply > data. >=20 > Fixes: d90cf7d111ac ("vhost: support host notifier") > Cc: stable@dpdk.org >=20 > Signed-off-by: Matan Azrad > --- > lib/librte_vhost/vhost_user.c | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) >=20 > 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; >=20 > - 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. 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_U= SER_NEED_REPLY_MASK no matter the handle is correct. Do I miss something? Please correct me. Thanks! Chenbo >=20 > ret =3D read_vhost_message(dev->slave_req_fd, &msg_reply); > if (ret <=3D 0) { > -- > 1.8.3.1