From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 959B3A0C4F for ; Mon, 12 Jul 2021 08:53:57 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 704864003C; Mon, 12 Jul 2021 08:53:57 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mails.dpdk.org (Postfix) with ESMTP id 6D4704003C; Mon, 12 Jul 2021 08:53:55 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10042"; a="190313821" X-IronPort-AV: E=Sophos;i="5.84,232,1620716400"; d="scan'208";a="190313821" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jul 2021 23:53:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,232,1620716400"; d="scan'208";a="629578346" Received: from fmsmsx605.amr.corp.intel.com ([10.18.126.85]) by orsmga005.jf.intel.com with ESMTP; 11 Jul 2021 23:53:53 -0700 Received: from fmsmsx607.amr.corp.intel.com (10.18.126.87) by fmsmsx605.amr.corp.intel.com (10.18.126.85) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4; Sun, 11 Jul 2021 23:53:53 -0700 Received: from fmsmsx601.amr.corp.intel.com (10.18.126.81) 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.2242.10; Sun, 11 Jul 2021 23:53:52 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10 via Frontend Transport; Sun, 11 Jul 2021 23:53:52 -0700 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (104.47.57.175) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.10; Sun, 11 Jul 2021 23:53:45 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=i0FavRLipD3ebWwV6wCv2+ytF2RVZIyLzv62beH0p1zQYRLz5PfM4RkbXlUCOjiALUKEJfBjjEr/cvkWzo9ItoUc/qao1M6i0jyUnqtD1116cR1MgQ5wkHyXs9HQULAE50QrohMKEowOtj0BvgwfGp8PZwOAM7H8OXSwD2fCpfnn1dKhodJH+rGJW+/FukL53E2hPxsO1NvRbOfxFwO5nqngWuE3UIZcz8Xvg8kvawStDkyOP974YHj8Zj2eJCq5FVDtYem//xTnpwBfXlhC0V1Q/1rl/VP2VSLkBkrKfjjcL2MhEdmEgnbDuNUqe8lV2nyNHXMtI7P1DszPFteRkg== 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=DubHUhB4OwIMOJJdnhXeobOTdIftWGtF/WR+vYh1wmk=; b=ZK2Jrcup4tzWlfOvNAaQJ7VG6IzzH9EViCexkzMZS80SxvfPbSsVXYXsG5lx9igdhdXN5XmEtyf7DvI39pOiRqD8mcKCQQ/HW7uYzyNK65gqir7Wet89eRuMcJ508mJBfBRQ26VW0yA0Dzs5tjc5A2wJwy2rEnbkjupJODlonMUJ9SDMmkx/baP9qt5oVcvBHfCzGbNOrdEwajvbdQMUVXVfPFy1YR19BdkzNdq4wT1p9m9eNEGcGhql3d4AsVg+UUfSbDUwZLIryX9Ltld8CRVmIYyN7Va9+GPL2pH2WjFTSjhxMJznZIHJiIpTdcCm/VWp2pRFoxkC0JcetrLr6Q== 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=DubHUhB4OwIMOJJdnhXeobOTdIftWGtF/WR+vYh1wmk=; b=lNHNgvpxMHQNsfbjKYy0Gbn9meLYE+WoNCR4O1z2GdVROTQee5LO/D5nTJYmXVKtakdxgI6tBhCfywowFx1UpgwWbf7gK+NPZzDbYAUtvZTwBbgGVqVHoc3pbvGjuxhp0jZdfqsEXBVtMdTEiCwR5HjC/lPBtR74KWow2ye1DY4= Received: from SJ0PR11MB5006.namprd11.prod.outlook.com (2603:10b6:a03:2db::22) by BYAPR11MB2920.namprd11.prod.outlook.com (2603:10b6:a03:82::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4308.21; Mon, 12 Jul 2021 06:53:13 +0000 Received: from SJ0PR11MB5006.namprd11.prod.outlook.com ([fe80::2005:352e:369a:e5f9]) by SJ0PR11MB5006.namprd11.prod.outlook.com ([fe80::2005:352e:369a:e5f9%8]) with mapi id 15.20.4308.026; Mon, 12 Jul 2021 06:53:13 +0000 From: "Jiang, Cheng1" To: Maxime Coquelin , "dev@dpdk.org" , "Xia, Chenbo" CC: "stable@dpdk.org" Thread-Topic: [PATCH v2] vhost: fix assuming packed ring size is a power of 2 Thread-Index: AQHXcxsfLhKNieSf3k2wtX3vWq6veqs3UYawgAeZxeA= Date: Mon, 12 Jul 2021 06:53:13 +0000 Message-ID: References: <20210707103004.317886-1-maxime.coquelin@redhat.com> In-Reply-To: Accept-Language: zh-CN, en-US 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-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 919a40fb-022e-40b1-a6b1-08d94501b819 x-ms-traffictypediagnostic: BYAPR11MB2920: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7219; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: HeKHceiKbvY33JPZ2xlSOhC3J9rdhH6JlFBrUs4OYcUPq74Y3F7HYg5V8imeqhD7YPP3Koq5RB6UQocrn0+7y83klRXIPHrSGxqbozjxm/masQYSHpV8acbTPefO79fHqMceV70s4ThH9RlTy+77+UgmnRm7Qa92CpQ/bRJs9HKsTWuC6cQeDLIsLY87luPNqJWK1OoEZCQRD6J+QAXB8TMUhaWBf15OFlvsc7lSHcYb69mgK/Az6JTceiZtqiTN8bxCndyegl0m3EYF1VioXH2PjImiDypa9Og8eK7I27shG84dC6WNDFlqASVjc7aGVhLtN7oWAR6ztV0FmMXIa6Hcp1WjNzCmOOg65IEcbkOmkjI8PvvLXOiZeNmm0Ut2i42LL66urosMFwj63aQ1ri43QLLZBOYUgipcvRDPSRS3Zl4ZHFZIh7I1L8Bh0yd9jtNRUWzue5hQdoQantNCOGDyRvLWsRw1YOmvbUR42jKKCyAWgkhdgfTuagMsZATbjEa4Dt5JttAiTHN/1cYuZm1QucNthQWci0ibRH6nbxDNl8UrRMqr41vGqJDBojimD2D3aMHV+ibPg21HIxNlQDb7v6wivtRaSQSyIhXrCnBec0iZKf+vf+8gMqFpwt5+b+kQKjFGjG7XxKfeih8Vrg== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR11MB5006.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(396003)(39860400002)(346002)(366004)(376002)(136003)(7696005)(8676002)(5660300002)(6636002)(33656002)(316002)(53546011)(9686003)(86362001)(52536014)(55016002)(38100700002)(122000001)(4326008)(8936002)(6506007)(2906002)(478600001)(83380400001)(66476007)(26005)(66556008)(186003)(71200400001)(66946007)(76116006)(64756008)(66446008)(110136005); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?pI119ioojtqZHsoMoMSP5xJseafUAqkl3b2I0ngsCWXgg6SCOnxYBv0bB/IE?= =?us-ascii?Q?0Uc3RouLs+VeHVs4Ue4CFb1xZmxihAXQYL0mk0pX5lFkzzPkXOJB0cJ2evtH?= =?us-ascii?Q?jYd3ldeTyS7+ZuSjuhed1FBZRbOC11ac1Gm8C7HiWqsIqc7+hSjDH3TEN2F5?= =?us-ascii?Q?/w+NyXXXWErnKP0frAig0YQT+68DjnUGb6YQ+DrftFDvh8qTMz/01/jAGaVP?= =?us-ascii?Q?VQe+LlhWfjo4z7tYPfp1fUqixxWdN/3F2JjVCtTMqJQkIKwc6yH9cUnp3WQD?= =?us-ascii?Q?S4a90wL4UV9Xw5goaleWLq0i47Z7oH4mmgJDGTHoaI7xSSbydROcBOb8bnYq?= =?us-ascii?Q?bX5Nmg6UzcqPjiWnp/RjtBgOFbCu77e0lr6h7qmunQ0agdjcqhtGCP0gBc4Z?= =?us-ascii?Q?yW8S9pXq205Ww2f1AcwOVKsQlvE03pnKORaVnnQjKcQ8XHCUMpXG0dP8pD7n?= =?us-ascii?Q?JM6JwfY5FG1zlEvbyXjNK2Qgjh8/RrMpNRIMvBjYRkRXj2Dwd5NZOOyQtpRS?= =?us-ascii?Q?ZFAgMZ9n5cEJ3wSxwE1HhMtyBXZSFBYu6JRgoZlsRNP2+e0t8vD61/RABHmm?= =?us-ascii?Q?X44cNW8mGSGhckQrFsUhIsHyEw/0lmP1O8J/FjH7/fYMs+Pyzp4ZBHCpCokd?= =?us-ascii?Q?3HClIagt5rs3RRqPmn2XEa08zz6DopN0Xwb0E3JyJAwxiP67/rnG8oDRZL6v?= =?us-ascii?Q?IkBVd8X8tiAUdFSyqmeHMaraZIJVqw0L4qIRPdjvY8/hR4NMgd3VtSgnPNVh?= =?us-ascii?Q?AWUpiyd9ukpLb7kGpV8kvJvBUsvJ2Nwgzl2jktRQLk82TISMJPin87Zus4T0?= =?us-ascii?Q?0JiB6oaWLrXRhu2ubQtdZ6v3RYxTG9plSuMzXsRPIX2MvEOFKAlK8dRyRMtw?= =?us-ascii?Q?IsX4YKT7dmsBpyjS5d0PhWN5cMJg4TjsZRVObO9qVUJ2dLjyHSrLrvKjJI2z?= =?us-ascii?Q?H22StezzII9YHhGOuFQ+brONBizQUzvAy+gRc8+Lf5qSgga90aDLI5EwAmyo?= =?us-ascii?Q?2G27WXmZ6QA4p478kfNz7D3HZPZY0J8vrjMOlWfafFzk5liBpXiPHt2LXxDk?= =?us-ascii?Q?nj8R2VP749LBgJpWqIhb5t+itlAo/zIMhdq19aggT0l6QeceWGWcqR3DgVnV?= =?us-ascii?Q?JWELD1j7LDXrKEbJWPuHS9XE/motsIQkThkg8SAqiGEf8IQUeJvrxVxdELhH?= =?us-ascii?Q?YcLWtkqkzQsR00+VYI1JzI9sf66wL+peNVjK2GAtOo78rC6vS5upBVeYR0os?= =?us-ascii?Q?1KeWdNa7QBCE80tJVmVLTqsyEIc5pWEXYPvlTKVqosBNEmN9erWuSTYhxd1d?= =?us-ascii?Q?ADE=3D?= 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: SJ0PR11MB5006.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 919a40fb-022e-40b1-a6b1-08d94501b819 X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Jul 2021 06:53:13.4503 (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: QBUguflBuEZec9gDubV83rPE9rei0wpoQfGxYHDvl5fR1JcRkpj+1gag/Ca3tMLh7rgLJjwawMyOvIfiqHRw3A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB2920 X-OriginatorOrg: intel.com Subject: Re: [dpdk-stable] [PATCH v2] vhost: fix assuming packed ring size is a power of 2 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 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 Maxime, I have noticed you changed the state this patch to Superseded. So are you going to submit a new version of this patch? Thanks, Cheng > -----Original Message----- > From: Jiang, Cheng1 > Sent: Wednesday, July 7, 2021 7:11 PM > To: Maxime Coquelin ; dev@dpdk.org; Xia, > Chenbo > Cc: stable@dpdk.org > Subject: RE: [PATCH v2] vhost: fix assuming packed ring size is a power o= f 2 >=20 > Hi Maxime, >=20 > I have also noticed the wrong calculation here, thanks for the timely hel= p. >=20 > Thanks, > Cheng >=20 > > -----Original Message----- > > From: Maxime Coquelin > > Sent: Wednesday, July 7, 2021 6:30 PM > > To: dev@dpdk.org; Jiang, Cheng1 ; Xia, Chenbo > > > > Cc: Maxime Coquelin ; stable@dpdk.org > > Subject: [PATCH v2] vhost: fix assuming packed ring size is a power of > > 2 > > > > Unlike split ring, packed ring does not mandate the ring size to be a > > power of 2. So we have to use a modulo operation when wrapping ring > index. > > > > Fixes: 873e8dad6f49 ("vhost: support packed ring in async datapath") > > Cc: stable@dpdk.org > > > > Signed-off-by: Maxime Coquelin > > --- > > > > V2: Also fix wrapping in virtio_dev_rx_async_get_info_idx which is > > used in the packed ring data path. > > > > lib/vhost/virtio_net.c | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/lib/vhost/virtio_net.c b/lib/vhost/virtio_net.c index > > b93482587c..0de5231db7 100644 > > --- a/lib/vhost/virtio_net.c > > +++ b/lib/vhost/virtio_net.c > > @@ -1470,7 +1470,7 @@ virtio_dev_rx_async_get_info_idx(uint16_t > > pkts_idx, > > uint16_t vq_size, uint16_t n_inflight) { > > return pkts_idx > n_inflight ? (pkts_idx - n_inflight) : > > - (vq_size - n_inflight + pkts_idx) & (vq_size - 1); > > + (vq_size - n_inflight + pkts_idx) % vq_size; > > } > > > > static __rte_always_inline void > > @@ -2131,7 +2131,7 @@ uint16_t rte_vhost_poll_enqueue_completed(int > > vid, uint16_t queue_id, > > > > if (vq_is_packed(dev)) { > > for (i =3D 0; i < n_pkts_put; i++) { > > - from =3D (start_idx + i) & (vq_size - 1); > > + from =3D (start_idx + i) % vq_size; > > n_buffers +=3D pkts_info[from].nr_buffers; > > pkts[i] =3D pkts_info[from].mbuf; > > } > > -- > > 2.31.1 >=20 >=20 > Acked-by: Cheng Jiang