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 16744A0562; Fri, 3 Apr 2020 10:55:50 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id F1D081C136; Fri, 3 Apr 2020 10:55:49 +0200 (CEST) Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80051.outbound.protection.outlook.com [40.107.8.51]) by dpdk.org (Postfix) with ESMTP id AE32B1C124 for ; Fri, 3 Apr 2020 10:55:48 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=oJUuhZahl3zxmk8KahjTV7oEBxiRVgMwkgFsMd8kczU=; b=TIunMycnRoU+vuopdwceZu0mkzyH6qIDWM1KzKMxJF8tyIgdX+sSr3k1hWTISkQF04fb3/+7N/bLzhte3sKGU1ecXjH/3S0t73wl2PjKqplQD2s03i2xaCrqLQigTi3hISR5t1tfQDMFUkGTH84iumx1CUSLbYvz6fWTgLWveBc= Received: from AM7PR02CA0014.eurprd02.prod.outlook.com (2603:10a6:20b:100::24) by VE1PR08MB4973.eurprd08.prod.outlook.com (2603:10a6:803:113::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2878.16; Fri, 3 Apr 2020 08:55:47 +0000 Received: from VE1EUR03FT026.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:100:cafe::2) by AM7PR02CA0014.outlook.office365.com (2603:10a6:20b:100::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2878.15 via Frontend Transport; Fri, 3 Apr 2020 08:55:47 +0000 Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dpdk.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dpdk.org; dmarc=bestguesspass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT026.mail.protection.outlook.com (10.152.18.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2856.17 via Frontend Transport; Fri, 3 Apr 2020 08:55:46 +0000 Received: ("Tessian outbound 5345ff401cf8:v50"); Fri, 03 Apr 2020 08:55:46 +0000 X-CR-MTA-TID: 64aa7808 Received: from da91ab5f1338.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 8AE8EB2D-E8AC-4AD6-80C4-666C90B31FFA.1; Fri, 03 Apr 2020 08:55:40 +0000 Received: from EUR04-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id da91ab5f1338.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 03 Apr 2020 08:55:40 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XBqsBg8Edeg60tjy8Z7SzVW+5MWNWqqKcUVXXYo6whuMFRyvuuTQ2VsAtseeuBB5lYebd7vuedTVWbi8BFKsDo6Y4HLgAAVoMQhQyKnMWcyxT7eGRkWMZ2UxQIWFTxQbj0tjEktWMhvzw+4WjlNxh5yTK/zX9wH/ZjFLmi2G2vVt6n3z0yrp5W7UPKKywKd+bp1qur6MaQQABDg+9L9FoqqZPFZLaGPMzqIUeGXhzgN40x+oAEzkS0W5DzZ20ng1FgDll4PWn6MJeCd686MPCE6rtfm1X8g3IkAZjE9sIg1/3zsyLrjyVtuGk4vck2IF4Pv/uDyHKF28cuMCtZPW5w== 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=oJUuhZahl3zxmk8KahjTV7oEBxiRVgMwkgFsMd8kczU=; b=dHCGdgI2DO5mg03vL6dpLB3COF6DiwfGrC7i3OhUAovxMLo3HPk5Z1BxH38EOH6S84MD4Jh53yVFYw2kJtLpj0emACDzgpcZAnvXItlw1x4RrlTbGkCZKDhTjqsPn1cOugbYeFH6VRoGNTMmvRTdAXIUxJQeiGqbGlRn+P5DutiUxNbsSTXPvce+yM6qIiok4Yv0DAMbjw92kBsRVaIZr48hZscH+wVr4cJAIXmx2YFJdfmQPqmwoDGR/4u1fJ7lv5VPOtm7+HVgiqqoH30TNHuQdh9cxyaS5gO1SXpqdgPLw9+WIIT7D5uzjrmOC1nltNmvUd5tEmPU8MMB1VtDRg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=oJUuhZahl3zxmk8KahjTV7oEBxiRVgMwkgFsMd8kczU=; b=TIunMycnRoU+vuopdwceZu0mkzyH6qIDWM1KzKMxJF8tyIgdX+sSr3k1hWTISkQF04fb3/+7N/bLzhte3sKGU1ecXjH/3S0t73wl2PjKqplQD2s03i2xaCrqLQigTi3hISR5t1tfQDMFUkGTH84iumx1CUSLbYvz6fWTgLWveBc= Received: from VI1PR08MB5376.eurprd08.prod.outlook.com (10.255.196.79) by VI1PR08MB3453.eurprd08.prod.outlook.com (20.177.60.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2878.15; Fri, 3 Apr 2020 08:55:38 +0000 Received: from VI1PR08MB5376.eurprd08.prod.outlook.com ([fe80::a0e2:2a9f:be7b:4b15]) by VI1PR08MB5376.eurprd08.prod.outlook.com ([fe80::a0e2:2a9f:be7b:4b15%3]) with mapi id 15.20.2878.016; Fri, 3 Apr 2020 08:55:38 +0000 From: Gavin Hu To: Stephen Hemminger , Joyce Kong CC: "maxime.coquelin@redhat.com" , "tiwei.bie@intel.com" , "zhihong.wang@intel.com" , "thomas@monjalon.net" , "jerinj@marvell.com" , "yinan.wang@intel.com" , Honnappa Nagarahalli , nd , "dev@dpdk.org" , nd Thread-Topic: [dpdk-dev] [PATCH v2 1/2] virtio: one way barrier for split vring used idx Thread-Index: AQHWCJqay/G1YKOMkkm9BCfXbfpwfahl+vIAgAEdtuA= Date: Fri, 3 Apr 2020 08:55:38 +0000 Message-ID: References: <20200402025753.31420-1-joyce.kong@arm.com> <20200402025753.31420-2-joyce.kong@arm.com> <20200402084756.2dc243ae@hermes.lan> In-Reply-To: <20200402084756.2dc243ae@hermes.lan> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: a4381f15-faf8-4d7f-9749-b47fd16930bf.0 x-checkrecipientchecked: true Authentication-Results-Original: spf=none (sender IP is ) smtp.mailfrom=Gavin.Hu@arm.com; x-originating-ip: [113.29.88.7] x-ms-publictraffictype: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: f370a8e1-e065-4fbd-11b1-08d7d7accce3 x-ms-traffictypediagnostic: VI1PR08MB3453:|VI1PR08MB3453:|VE1PR08MB4973: x-ld-processed: f34e5979-57d9-4aaa-ad4d-b122a662184d,ExtAddr x-ms-exchange-transport-forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true nodisclaimer: true x-ms-oob-tlc-oobclassifiers: OLM:7691;OLM:7691; x-forefront-prvs: 0362BF9FDB X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR08MB5376.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(10009020)(4636009)(39860400002)(346002)(376002)(396003)(136003)(366004)(6506007)(53546011)(66946007)(5660300002)(55236004)(9686003)(64756008)(4326008)(110136005)(66446008)(55016002)(66476007)(76116006)(66556008)(7696005)(316002)(54906003)(2906002)(71200400001)(26005)(33656002)(478600001)(52536014)(186003)(8936002)(81166006)(86362001)(81156014)(6636002)(8676002); DIR:OUT; SFP:1101; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: GBgvCQ2/5SCCESorKQ2gPp41A4aCbY3BqbDaQTipsEPl9TBFvh/XvArgS/MCarXUcGNyWCkH3i+Gwom7I4qwV/w3YgaOmCAIx5viEpgOW+LH/Gc9S4lqetvyuHPpQaiumYqfnCg5pI3w7gb3M42IWgRn46PR0P9LR2SXIO7J2QBAEotGyNA7gNWblWP9JlGALdVHySd/7gtOTWrXaMrZqK6N96xNVx7fpLdDQoomP9NDozKP5BNrznTU525cAMcETAt3TZD6cU7DuOpf2vvDSBmjXkXRW5kCLOw4Ta88VkgLRMjlbHuZJb0tMjXcliB6faL13n88TCOs+TOg8fb0S7LvDDeDavksFOw0QZG+kvUy+0ZFphH7GaZQotDGjQGUBop7Xb4XPZld2ZuTH9M2vTBvCuXvfxC+ejEbz6D7rhmCiiEJ88imzaEVhRLvhcGl x-ms-exchange-antispam-messagedata: geq3vpmY+yr7bm+CZ7YGfmqMiraAz7dVBZO2rnklp/Lxr6RJwOo4QHM+hjruKV+uc/Qi+tzDTRzqnWQa6m4cai9qsDI9Oyf898SpbNn3r6/ZbwhAXKj02maiIvHNYKQfo/MMCjIc8/xHyDfQs7gDfg== Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB3453 Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Gavin.Hu@arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT026.eop-EUR03.prod.protection.outlook.com X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFTY:; SFS:(10009020)(4636009)(346002)(39860400002)(136003)(396003)(376002)(46966005)(478600001)(5660300002)(26826003)(8676002)(54906003)(81156014)(52536014)(110136005)(81166006)(4326008)(8936002)(7696005)(6636002)(336012)(70586007)(86362001)(53546011)(36906005)(82740400003)(26005)(186003)(6506007)(316002)(356004)(33656002)(55016002)(9686003)(47076004)(70206006)(2906002); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: 53b502c6-ec8b-4c63-53ac-08d7d7acc7fc X-Forefront-PRVS: 0362BF9FDB X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ar8SfVljD7Q0IJJutrwvZqmr4t/kq+arTDlsaXBpl42YJj7O9UHHkV8u9rP+ScuXOc+ZG7GOpu8LjShgkl5l+0WFygRTKEIeBEiLjXy7fX1ap+uq+h9phQbUUI8BR1cKIxt1jO0kmYZVEt5pCe1fbsZ8SBOMPxHnKCWiNX7SmezdttEu+44SVLbQ3/EARCfmQGCMeaJN4NudAn3Gqxo7cRzNsiFMDujx7SYGRSlvg2+eIGkCVmRf5MLIXbGxY8tyPBWCjl1e3CSbHPXEGPauCiHAg4y3a5zA02Y6+ND+2xm4bgxm32Xk2JHVhqFT8CdY5LORhqK6UkVXuJuM4DGfiy1b2pcefp3NN81udTtQVXN2y8/jxgsL2lWCl3uHgd5DZHRWBC9B051KCUXqOJa8WAcgC4O50cx7dygm4/hgH0UI7mdcN6y2FEMXIWRdH1Dkusyjm/lrlcw2A4vtvxVmR2oXLkKzo63otZM1aXiKo1FBiQ+LKOslNUWZh4btdehpQ0QejpR/uf00zjLHXBDHLQ== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Apr 2020 08:55:46.6253 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f370a8e1-e065-4fbd-11b1-08d7d7accce3 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB4973 Subject: Re: [dpdk-dev] [PATCH v2 1/2] virtio: one way barrier for split vring used idx 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 Stephen,=20 > -----Original Message----- > From: Stephen Hemminger > Sent: Thursday, April 2, 2020 11:48 PM > To: Joyce Kong > Cc: maxime.coquelin@redhat.com; tiwei.bie@intel.com; > zhihong.wang@intel.com; thomas@monjalon.net; jerinj@marvell.com; > yinan.wang@intel.com; Honnappa Nagarahalli > ; Gavin Hu ; nd > ; dev@dpdk.org > Subject: Re: [dpdk-dev] [PATCH v2 1/2] virtio: one way barrier for split = vring > used idx >=20 > On Thu, 2 Apr 2020 10:57:52 +0800 > Joyce Kong wrote: >=20 > > - (vq)->vq_used_cons_idx)) > > +static inline uint16_t > > +virtqueue_nused(struct virtqueue *vq) > vq is unmodified and should be const >=20 > > +{ > > + uint16_t idx; > > + if (vq->hw->weak_barriers) { > Put blank line between declaration and if statement Will fix in v3. >=20 > > +/* x86 prefers to using rte_smp_rmb over __atomic_load_n as it reports > > + * a slightly better perf, which comes from the saved branch by the > compiler. > > + * The if and else branches are identical with the smp and cio barrier= s > both > > + * defined as compiler barriers on x86. > > + */ >=20 > Do not put comments on left margin (except in function prolog). Will fix in v3. >=20 > > +#ifdef RTE_ARCH_X86_64 > > + idx =3D vq->vq_split.ring.used->idx; > > + rte_smp_rmb(); > > +#else > > + idx =3D __atomic_load_n(&(vq)->vq_split.ring.used->idx, > > + __ATOMIC_ACQUIRE); > > +#endif > > + } else { > > + idx =3D vq->vq_split.ring.used->idx; > > + rte_cio_rmb(); > > + } > > + return (idx - vq->vq_used_cons_idx); >=20 > Parenthesis around arguments to return are unnecessary. > BSD code likes it, Linux style does not. Will fix in v3. >=20 > > +} >=20 > This kind of arch specific code is hard to maintain. > Does it really make that much difference. Yes, a stronger than required barrier is a performance killer, especially i= n the fast path. The test was conducted on the ThunderX2+Intel XL710 testbed, the PVP test c= ase. /Gavin