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 6C812A0528; Fri, 17 Jul 2020 10:09:32 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 535271BF46; Fri, 17 Jul 2020 10:09:32 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id C02792AA6 for ; Fri, 17 Jul 2020 10:09:30 +0200 (CEST) IronPort-SDR: GiZrBp9mcSDvByxRiNdriyoNATDiSXRk/vy8XiuTLI5H7/40OvFnEiyf9jSPJFa/+rqmK5kMo7 FTRDbV6xmdqQ== X-IronPort-AV: E=McAfee;i="6000,8403,9684"; a="147539890" X-IronPort-AV: E=Sophos;i="5.75,362,1589266800"; d="scan'208";a="147539890" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Jul 2020 01:09:29 -0700 IronPort-SDR: /dHh3oNTsvwzrlfqm+wD3qiERVEuXT7dCA2mhR8zZ4d/C2A9WVZCMdnAXSMPDBbsuGHj1hpX1b 6dvkfWjl/3yw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,362,1589266800"; d="scan'208";a="270768576" Received: from orsmsx605.amr.corp.intel.com ([10.22.229.18]) by fmsmga008.fm.intel.com with ESMTP; 17 Jul 2020 01:09:29 -0700 Received: from orsmsx605.amr.corp.intel.com (10.22.229.18) by ORSMSX605.amr.corp.intel.com (10.22.229.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Fri, 17 Jul 2020 01:09:29 -0700 Received: from ORSEDG002.ED.cps.intel.com (10.7.248.5) by orsmsx605.amr.corp.intel.com (10.22.229.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1713.5 via Frontend Transport; Fri, 17 Jul 2020 01:09:29 -0700 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (104.47.57.176) by edgegateway.intel.com (134.134.137.101) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 17 Jul 2020 01:09:21 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HfV/tZPNRC0SwC605tMDn5l02+cB8vexH1kTOaJerRhm6x1O7EF/f8VoF6Bu3NFCUWao8X51ePPBfc71KFMWaRL/EXGYIW0K+tfO0/jVB3wrdpvXYT0yc5XKCCrAf9WG/GkMMfUWc8MIpK0mAkxw2o8YUgiE+ZBDT5R0GRCb2gEmtv/xVfK2HVsOoHtqPF/vCo6BxzzGQobFB5ti1+nL0CBNMS+vDcPwmxe5iLE+7Fr5r4RQ/0Sht+/AYu0PmSKq9TKWW3OEfAMjdLvAniSzcB2bwoitV4dpMxUoYTFPfEdsKDFVdIoqEqAMdpQ2+ENqTLCLsVNwfZEK1Dc3GiRwCg== 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=P+mNi1b8akn+mh66ZUomWqQeVojcp37L3ZCjtoz4plo=; b=HKB6an+WwBX/A0ZCSws4+xdKTsU4SpmL/W5Wq1x3Wk0IbUg+BYUKXinNroFoRyWc2S0AIvtoOXxzcd4jAopm29keDwE9jN7YuY1kuLS4NjNXIRbYt8QPLbzRcZh7KNDdHlk0cm0xLw6uMj4hri156M9pdeaZXF3ymvWUrA4Na7rgQxpdKl5TO+3PqufITgMfWxDfeN7G5igdhY8LRsZsTtzz/yuMJi8r/AN+apa6m9IkDW6q+MrTbofRNo9u5U7N0XjgM/hpzeHi2CjMblIgLZZEwD2ULmp+kiwRzLQE7CVu97/jPDg7/RzGSceIS5gUGl/SCJP7jo5LOg9uD1x++w== 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=P+mNi1b8akn+mh66ZUomWqQeVojcp37L3ZCjtoz4plo=; b=pssxPUy6NQ5wDuWchwSnPbEuQywQ9+PtigfgxNAaYUkyVgpHJ/Cka50dLD85gaM7ma6Ru8GO6bCVxXTIDkYUIGFnyQrMYaWQDe1mxPLXyoV1k5xte3ieIwvChlGoltXibukhxhIU23E0dljO5T3lJOtJTorYSHOPPxi/pOWE1UY= Received: from MN2PR11MB4063.namprd11.prod.outlook.com (2603:10b6:208:13f::22) by MN2PR11MB3934.namprd11.prod.outlook.com (2603:10b6:208:152::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3174.20; Fri, 17 Jul 2020 08:09:19 +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.3174.025; Fri, 17 Jul 2020 08:09:19 +0000 From: "Xia, Chenbo" To: "Fu, Patrick" , "dev@dpdk.org" , "maxime.coquelin@redhat.com" Thread-Topic: [PATCH v1] vhost: add vq status check in async enqueue poll Thread-Index: AQHWW4Y2oXvqaPB8DUC+5Oj228zTx6kLbAjg Date: Fri, 17 Jul 2020 08:09:19 +0000 Message-ID: References: <20200716153010.2894802-1-patrick.fu@intel.com> In-Reply-To: <20200716153010.2894802-1-patrick.fu@intel.com> Accept-Language: en-US, zh-CN 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=intel.com; x-originating-ip: [192.198.147.217] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 15e63afc-b1e1-4161-b3c2-08d82a28b517 x-ms-traffictypediagnostic: MN2PR11MB3934: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:5797; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: MgQeyaFKSL0/+1nJoCoHQlKHCMGHBgO0AhHXKG6v3CzELUDZ09PXJCoAni8Dusn5urmCuH4DZdZt8LJf9DvZHPB7WBxxK8LCq16Arcgpr3oS3mubGSr/B4Qfx2GqRTv6plynWXZJsinM8oa3c/zYnl/UEO+TbYDq5563eWLTrJ7g0Dh2212JOhTHAkw0nRA4iMDkn2Lip35vco/IvEAAzWn6pJf3YkdoP90jjvYEXZTDgOFLPt/bLI5w8dp0nhuWPqnw3ckTVeLmmqxqFScpXvl8YQv3hwBlKWDrfS7lCmPBoaTQKrf+MyFbViw2wzRzN4Jruu51SXKpwgwVsfB+vA== 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)(39860400002)(376002)(366004)(136003)(346002)(396003)(478600001)(26005)(8676002)(33656002)(110136005)(55016002)(186003)(316002)(8936002)(9686003)(83380400001)(2906002)(66946007)(7696005)(6506007)(66446008)(71200400001)(66476007)(86362001)(52536014)(66556008)(5660300002)(64756008)(76116006)(53546011); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: rWlXH5l/15ikSrcsp7kwqk4HxpeAzjHcFEIEfgqXhS0O1o50ZbhgBVhgG6btxHLb365XvICTqBoAYVceVzUH937Qhaoph3guHJJIzUBByBrZxJqrJhI/b+aox3nIMig9oI6pnAFxIybw6l+0EJVQoO7CSKwEGsFLXrlkxokqc2zRad7QeD6F2fII2okoLKZlNpkq5F3jsV+IWSYCmKtH/Ygo6w3I7Txo5R32DmAIksk15mAI4Y37XhtTrhegwENdliawSrK7hJ8bZFgq15rIxx/2az2BHfzcz2VIT9MMgO27I2++sfsZQpIzi8/2V8V8kuqK4Yj/VmWalJJOpVN1OnA357MMFX/IVQEEzefkMs+3/esXwjdtkaq6xczTmyYGUaWVEm4NEtNk5mZr59dH9Kb9yQ/1y+cdsChK8OzZLX6a+k/NyoDYWbnTe09NdPj3v8XodWUKYrWZdrNkCpMvycoBE1l1ojdzGIBZE7vAEVNtInO4kQ9E7fWM72tvtpaM 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: 15e63afc-b1e1-4161-b3c2-08d82a28b517 X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Jul 2020 08:09:19.6524 (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: mOH6UEtnTJYRn9bKf4kpEeQ9kepv0l2SlnbABaIFOuiJDXW7T8F5lL8fA+/UXiWSkZresv+KxwBf2cHfOugBgw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB3934 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v1] vhost: add vq status check in async enqueue poll 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: Fu, Patrick > Sent: Thursday, July 16, 2020 11:30 PM > To: dev@dpdk.org; maxime.coquelin@redhat.com; Xia, Chenbo > > Cc: Fu, Patrick > Subject: [PATCH v1] vhost: add vq status check in async enqueue poll >=20 > From: Patrick Fu >=20 > Vring should not be touched if vq is disabled. This patch adds the vq sta= tus check > in async enqueue polling to avoid accessing to a disabled queue. >=20 > Fixes: cd6760da1076 ("vhost: introduce async enqueue for split ring") >=20 > Signed-off-by: Patrick Fu > --- > lib/librte_vhost/virtio_net.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) >=20 > diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.= c index > 1d0be3dd4..b197d76d3 100644 > --- a/lib/librte_vhost/virtio_net.c > +++ b/lib/librte_vhost/virtio_net.c > @@ -1686,9 +1686,11 @@ uint16_t rte_vhost_poll_enqueue_completed(int vid, > uint16_t queue_id, >=20 > if (n_pkts_put) { > vq->async_pkts_inflight_n -=3D n_pkts_put; > - __atomic_add_fetch(&vq->used->idx, n_descs, > __ATOMIC_RELEASE); > - > - vhost_vring_call_split(dev, vq); > + if (likely(vq->enabled && vq->access_ok)) { > + __atomic_add_fetch(&vq->used->idx, > + n_descs, __ATOMIC_RELEASE); > + vhost_vring_call_split(dev, vq); > + } > } >=20 > if (start_idx + n_pkts_put <=3D vq_size) { > -- > 2.18.4 Reviewed-by: Chenbo Xia