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 B6F7CA052B; Wed, 29 Jul 2020 04:53:04 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0B37F4C93; Wed, 29 Jul 2020 04:53:04 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id EA4C14C8E for ; Wed, 29 Jul 2020 04:53:01 +0200 (CEST) IronPort-SDR: quVrTsM8Nma9zfQsRLEAeT9mLgNOJqMVuLsj3jym0L1ScXibrIMSlf/beChqn2v1wXApHxCsMH FJDovnGLW5gQ== X-IronPort-AV: E=McAfee;i="6000,8403,9696"; a="149195692" X-IronPort-AV: E=Sophos;i="5.75,408,1589266800"; d="scan'208";a="149195692" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Jul 2020 19:53:00 -0700 IronPort-SDR: wCWawpNGQWgTj97Z7vmkfGt0K6QdzSOzbdOtKBQSbPYPXH00682z7aHhyFLzceoGK4dwsbUG6G 9b0QmHTwk4LQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,408,1589266800"; d="scan'208";a="328530616" Received: from orsmsx601.amr.corp.intel.com ([10.22.229.14]) by FMSMGA003.fm.intel.com with ESMTP; 28 Jul 2020 19:53:00 -0700 Received: from orsmsx608.amr.corp.intel.com (10.22.229.21) by ORSMSX601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Tue, 28 Jul 2020 19:52:59 -0700 Received: from ORSEDG002.ED.cps.intel.com (10.7.248.5) by orsmsx608.amr.corp.intel.com (10.22.229.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1713.5 via Frontend Transport; Tue, 28 Jul 2020 19:52:59 -0700 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (104.47.66.42) by edgegateway.intel.com (134.134.137.101) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 28 Jul 2020 19:52:59 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OIq4OjKMQL3tiVCIlydKEjKpLPOCWhqyZAUtv3VPrY0DL2fL2GWv/DQV6pQU3HJcCbQJJOd59Y476B/ODrXlpBemZLuqq4M0YcVoPQZCpBtMOXpd0fe278ElO333y60rWanxqf6jNcfNWzPvk5iX4XxSVL47RQO81Ix/lAVBH9tvQ+/IdO/zX1dFsTmBvKJJ3gIgeJcujLbfhunWen2k48TrukFF2J4KHzhdh6BONlqI/NP/NIP0TsOi1eRQnxEAkbJiPY8c22TOZAb0WFe3kCA5AwyoYpB6HWVVjKenktKaXalEFcvautubrtgVfIM9+A2NtICGzHTkuHXOwOStHw== 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=vAq34AxtLfi1Ga+7nfn91UCY1aH1WLGSVRZGm2X3bdQ=; b=HP5ngtY509TMP0Me9foAN5tizHSBBR+fTL6XbA22tAamBSh1l4IoXNZ+ZG5yH05fCLpK/Ri8B7e0xYGDMaWbnGCi0uq2F3Tkhamrt4IjRXUVxO6xFFvMbk3+GaDIqgSF7wyATE0ULjDKMjC6pylq6Cld7xEIN+utgmRGg8mxn8pakgPy4KdxldJYxC0LzWQ0ax17BpFH088vw/5Md/e1m2Zsb7P/ql4ihgOuJohHy79Ln7vPIY9kysf42ukOwC45SJAAsjfkGG72xbaP1sdYvaZ5JPpEPOBn46MQy0LmGwuDwJqIyevfny3Dr/aVGN4ntFJtjI31JDtJQ/hOBbUAXg== 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=vAq34AxtLfi1Ga+7nfn91UCY1aH1WLGSVRZGm2X3bdQ=; b=Dw+KMQN2l4OIt2wsuKMzwZLk/m58nxsbk1hN8dFkZOmrCs+6yqOaFdVp+hQHnxMKAtOANidxkDbVadSepSzd5Xqxb1ebgJdmn7AKTqf//n7p3zrRCOPzfXqdKiAVCPPPA+L5YJuG7i4/byU2SSTQhlFtVXLapG/cFbdkqpT69qo= Received: from MN2PR11MB4063.namprd11.prod.outlook.com (2603:10b6:208:13f::22) by MN2PR11MB3551.namprd11.prod.outlook.com (2603:10b6:208:ea::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.20; Wed, 29 Jul 2020 02:52:54 +0000 Received: from MN2PR11MB4063.namprd11.prod.outlook.com ([fe80::b898:36f5:61cb:42ca]) by MN2PR11MB4063.namprd11.prod.outlook.com ([fe80::b898:36f5:61cb:42ca%7]) with mapi id 15.20.3216.033; Wed, 29 Jul 2020 02:52:54 +0000 From: "Xia, Chenbo" To: Maxime Coquelin , "dev@dpdk.org" , "matan@mellanox.com" , "Liu, Yong" , "Wang, Yinan" CC: "thomas@monjalon.net" , "Yigit, Ferruh" , "david.marchand@redhat.com" Thread-Topic: [PATCH v2 2/3] net/vhost: fix queue update Thread-Index: AQHWZP9HVloPgY4p8EqykYo+QiRl6qkd3KbA Date: Wed, 29 Jul 2020 02:52:54 +0000 Message-ID: References: <20200728165021.216291-1-maxime.coquelin@redhat.com> <20200728165021.216291-3-maxime.coquelin@redhat.com> In-Reply-To: <20200728165021.216291-3-maxime.coquelin@redhat.com> Accept-Language: en-US, zh-CN Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.198.147.217] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 0326f4dc-4ec0-4f36-955c-08d8336a7e05 x-ms-traffictypediagnostic: MN2PR11MB3551: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7691; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: v3IDt9Oo8Fe7evXY9v/TWH9xdyELwd+SzB9SvlewfNeG4lOG5slXDfjdGMJT6iMlWWZFDhg9mQg6ttVbdR9In87KEwhGEvAcyH4zeVhHU3Jgb17MZMWG2LlZo3k/HRoAgw8mGXkpF6NQbPsHL4dyduF2Mr1Je7RcS1gKdRgVVWjEggEu2AbayuZfUnRq1Dn7cQG4mmZcCa0IQ5A9+HZiuvePhcwz3GuA7im/mwlo88Xpii+YtJPoz/2uIkCaPWL4BVnOl/RtBm5ASpjw56bTnAqrBbqilzwMoYOmF+RBXtG3QxyCz2uWz89E+ZrPmAhPkjg3aCs8yZLTA3ast0zdDg== 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:(4636009)(366004)(76116006)(66946007)(2906002)(55016002)(66476007)(9686003)(64756008)(66556008)(66446008)(26005)(6636002)(498600001)(8936002)(54906003)(71200400001)(186003)(110136005)(8676002)(5660300002)(52536014)(53546011)(6506007)(15650500001)(4326008)(83380400001)(7696005)(86362001)(33656002); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: evkCkjFKKn2mABYIthZHKD5Eg9R97Z6X8ZJqPV8/GBWoyYQv203GkNi6M7N5aXU8EKBr8HYmADKB4IYIdJNpDThN0MKD+YW9lc/swzkNPWg7vZBuISUpSPG2rvk50TJZiYJqWs/i+LRJE4DzXS/4UMZtccB56Ra3mFOrYEk1RU6cCfaKC7nlpXmvnGvXYOrdXEEua+5rttkyDbKNeMnC8keirKKvidtvotYnJyQXlGhiOyo35RGuwyuv2QUjo0Xw5lg2GBPyV7n2nHBoiY6X++7uztyvWtxOxfi2pZwsExfuTDo2q+w0l0rtRUxOGd3utRxjYYqs0M687VGCwsXzMMaw8CUa/k+RAUuuFaNDJW6jLq0Etv/npTDMp/U+S3yXwlQa341PRM6dZS3QedCbTTyKImesHyNS/PQJQLIo9RaXlthYdd7VACENw2LRPAIEKeN1iLLn6plmpkLVOJV8kHVNR/WpdBRhxVy76zYoDAfp8BEX9KE1BdA5WzVdLMkx 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: MN2PR11MB4063.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0326f4dc-4ec0-4f36-955c-08d8336a7e05 X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Jul 2020 02:52:54.4751 (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: Gc7sG/4q/yMdWed2Q4aO06t46t68peUKCdSB3njVfOPjh2dc80P8cFRKRtzuSh0Rx8cJCeWkYYuB1o6wACc3vg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB3551 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v2 2/3] net/vhost: fix queue update 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" > -----Original Message----- > From: Maxime Coquelin > Sent: Wednesday, July 29, 2020 12:50 AM > To: dev@dpdk.org; matan@mellanox.com; Xia, Chenbo > ; Liu, Yong ; Wang, Yinan > > Cc: thomas@monjalon.net; Yigit, Ferruh ; > david.marchand@redhat.com; Maxime Coquelin > > Subject: [PATCH v2 2/3] net/vhost: fix queue update >=20 > Now that the vhost library saves the guest notifications enablement value= in its > virtqueues metadata, it is not necessary to do it in the vring_state_chan= ged > callback. >=20 > One effect of the patch is also to prevent possible deadlock happening in= vhost > library. >=20 > Fixes: 604052ae5395 ("net/vhost: support queue update") >=20 > Reported-by: Yinan Wang > Tested-by: Yinan Wang > Signed-off-by: Maxime Coquelin > --- > drivers/net/vhost/rte_eth_vhost.c | 28 +++++++++------------------- > 1 file changed, 9 insertions(+), 19 deletions(-) >=20 > diff --git a/drivers/net/vhost/rte_eth_vhost.c > b/drivers/net/vhost/rte_eth_vhost.c > index bbf79b2c0e..951929c663 100644 > --- a/drivers/net/vhost/rte_eth_vhost.c > +++ b/drivers/net/vhost/rte_eth_vhost.c > @@ -94,7 +94,6 @@ struct vhost_queue { > struct rte_mempool *mb_pool; > uint16_t port; > uint16_t virtqueue_id; > - bool intr_en; > struct vhost_stats stats; > }; >=20 > @@ -547,8 +546,6 @@ eth_rxq_intr_enable(struct rte_eth_dev *dev, uint16_t > qid) > rte_vhost_enable_guest_notification(vq->vid, (qid << 1) + 1, 1); > rte_wmb(); >=20 > - vq->intr_en =3D true; > - > return ret; > } >=20 > @@ -574,8 +571,6 @@ eth_rxq_intr_disable(struct rte_eth_dev *dev, uint16_= t > qid) > rte_vhost_enable_guest_notification(vq->vid, (qid << 1) + 1, 0); > rte_wmb(); >=20 > - vq->intr_en =3D false; > - > return 0; > } >=20 > @@ -841,7 +836,6 @@ vring_conf_update(int vid, struct rte_eth_dev *eth_de= v, > uint16_t vring_id) > struct rte_eth_conf *dev_conf =3D ð_dev->data->dev_conf; > struct pmd_internal *internal =3D eth_dev->data->dev_private; > struct rte_vhost_vring vring; > - struct vhost_queue *vq; > int rx_idx =3D vring_id % 2 ? (vring_id - 1) >> 1 : -1; > int ret =3D 0; >=20 > @@ -853,21 +847,17 @@ vring_conf_update(int vid, struct rte_eth_dev > *eth_dev, uint16_t vring_id) > rte_atomic32_read(&internal->dev_attached) && > rte_atomic32_read(&internal->started) && > dev_conf->intr_conf.rxq) { > - vq =3D eth_dev->data->rx_queues[rx_idx]; > ret =3D rte_vhost_get_vhost_vring(vid, vring_id, &vring); > - if (!ret) { > - if (vring.kickfd !=3D > - eth_dev->intr_handle->efds[rx_idx]) { > - VHOST_LOG(INFO, > - "kickfd for rxq-%d was changed.\n", > - rx_idx); > - eth_dev->intr_handle->efds[rx_idx] =3D > - vring.kickfd; > - } > + if (ret) { > + VHOST_LOG(ERR, "Failed to get vring %d > information.\n", > + vring_id); > + return ret; > + } >=20 > - rte_vhost_enable_guest_notification(vid, vring_id, > - vq->intr_en); > - rte_wmb(); > + if (vring.kickfd !=3D eth_dev->intr_handle->efds[rx_idx]) { > + VHOST_LOG(INFO, "kickfd for rxq-%d was changed.\n", > + rx_idx); > + eth_dev->intr_handle->efds[rx_idx] =3D vring.kickfd; > } > } >=20 > -- > 2.26.2 Reviewed-by: Chenbo Xia