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 20B44A0588; Thu, 16 Apr 2020 06:40:59 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0B2F31DA6E; Thu, 16 Apr 2020 06:40:58 +0200 (CEST) Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80052.outbound.protection.outlook.com [40.107.8.52]) by dpdk.org (Postfix) with ESMTP id 04CFB1DA6C for ; Thu, 16 Apr 2020 06:40:56 +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=ROgUnOnlt4V3jvOb+6zqCeOzEuh5gZI0g5Wxcreh/Hg=; b=egsG3mGngeMjJcLgA1EagawBgAK/1/ghxMbrKyRnJRqnXDGIXXtvGWjKq2eQHuzO3RrVpZQhokujDDtIWzgMwELVSK0sMv1Lwd2xePxDBwIdbYXOFoXhrY6BMd1lIbnlq3WjJWwnNJJc3JySFiuooUcNpMWjdNtS7qbsoK6b/C4= Received: from DB6PR0601CA0048.eurprd06.prod.outlook.com (2603:10a6:4:17::34) by VI1PR0802MB2254.eurprd08.prod.outlook.com (2603:10a6:800:9c::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2900.15; Thu, 16 Apr 2020 04:40:54 +0000 Received: from DB5EUR03FT042.eop-EUR03.prod.protection.outlook.com (2603:10a6:4:17:cafe::b3) by DB6PR0601CA0048.outlook.office365.com (2603:10a6:4:17::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2921.25 via Frontend Transport; Thu, 16 Apr 2020 04:40:53 +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 DB5EUR03FT042.mail.protection.outlook.com (10.152.21.123) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2900.18 via Frontend Transport; Thu, 16 Apr 2020 04:40:53 +0000 Received: ("Tessian outbound 294df6cd3744:v50"); Thu, 16 Apr 2020 04:40:53 +0000 X-CR-MTA-TID: 64aa7808 Received: from 23f1074d2f25.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id C17955C0-70BE-404F-9F0A-127386701C4D.1; Thu, 16 Apr 2020 04:40:48 +0000 Received: from EUR03-VE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 23f1074d2f25.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 16 Apr 2020 04:40:48 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NPXdQH/fpVHm6J7p4+bJX4inyXT5pnCx20XmmDpiaHVGpI6qpv9gtLFirrzD9Sp7srP/EZiIAlyZj31GsL5zYyntEhTaiB9aKCvk8aMF2+a6xmQVAKRr3ilew77sdsV9xub4ta9SXVfwxufZlmacWqA9ZtAQ7ePeGdUbji/R3Zwj+Lig+5A1pKpaGyhQh1NP7ogQ9zzYzZAI3GHCjuisPFPsk5K4kcfUGC71bNXf4U2ToOS7CECREJgrgD2TTK6FxVld/Lo2WjxEm97Dw8Gax6svUk2P3IZlyFOy4ty0K9d3OJcCuiazodOgG4S8ldleqdpNiZuWILHiqhYNIh1A4g== 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=ROgUnOnlt4V3jvOb+6zqCeOzEuh5gZI0g5Wxcreh/Hg=; b=frDx86nv3nPBE2hqF9svKcwF+bflZBwqowomfRrEqIwJEZL2FKLqfOxu7zUqnumCaoAP6M4XYupjVTDX47lYHd91eeveRzk5UtRX8yLa/NcCbQnvh2Ey/8vLRmA564N0zZR4tHE7QB/Y0idKEI5JHxjd0GQWTPiwX6PfHh12tsbCHPAShXk9+VAfTOYrP9TNp0hCHI6w/SCy9NyrdI+PLR/2B6MceaTDZsfsj6Zp87tO0dTPKeswRM2TpokN5eA3584mq0W3IRm+hdH6ApPEElHBDw5m7nTD4STaXpedCJdiEpwvoWMPWAzkFjMNpwqqUz1L67gAJ8QEcKPqN47lrw== 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=ROgUnOnlt4V3jvOb+6zqCeOzEuh5gZI0g5Wxcreh/Hg=; b=egsG3mGngeMjJcLgA1EagawBgAK/1/ghxMbrKyRnJRqnXDGIXXtvGWjKq2eQHuzO3RrVpZQhokujDDtIWzgMwELVSK0sMv1Lwd2xePxDBwIdbYXOFoXhrY6BMd1lIbnlq3WjJWwnNJJc3JySFiuooUcNpMWjdNtS7qbsoK6b/C4= Received: from DBBPR08MB4646.eurprd08.prod.outlook.com (2603:10a6:10:f5::16) by DBBSPR01MB0007.eurprd08.prod.outlook.com (2603:10a6:10:de::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2921.25; Thu, 16 Apr 2020 04:40:44 +0000 Received: from DBBPR08MB4646.eurprd08.prod.outlook.com ([fe80::1870:afc4:b90f:609d]) by DBBPR08MB4646.eurprd08.prod.outlook.com ([fe80::1870:afc4:b90f:609d%5]) with mapi id 15.20.2921.027; Thu, 16 Apr 2020 04:40:44 +0000 From: Honnappa Nagarahalli To: Gavin Hu , 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" , nd , "dev@dpdk.org" , Honnappa Nagarahalli , nd Thread-Topic: [dpdk-dev] [PATCH v2 1/2] virtio: one way barrier for split vring used idx Thread-Index: AQHWCJqaaFlVIDYtt0GMdrIZzzHn+ahl+vIAgAEdtuCAFCeMcA== Date: Thu, 16 Apr 2020 04:40:44 +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: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: aea1c9de-0476-45cd-9670-f388122a9367.0 x-checkrecipientchecked: true Authentication-Results-Original: spf=none (sender IP is ) smtp.mailfrom=Honnappa.Nagarahalli@arm.com; x-originating-ip: [70.113.25.165] x-ms-publictraffictype: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: bc938798-a353-417f-74ed-08d7e1c058e3 x-ms-traffictypediagnostic: DBBSPR01MB0007:|DBBSPR01MB0007:|VI1PR0802MB2254: 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:8273;OLM:8273; x-forefront-prvs: 0375972289 X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DBBPR08MB4646.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(10009020)(4636009)(346002)(366004)(376002)(136003)(396003)(39860400002)(8676002)(81156014)(6636002)(5660300002)(71200400001)(66556008)(2906002)(66446008)(76116006)(52536014)(64756008)(66476007)(66946007)(26005)(6506007)(110136005)(54906003)(7696005)(9686003)(316002)(186003)(33656002)(8936002)(478600001)(86362001)(4326008)(55016002); 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: FPSbwCLEa4EYKPrf7YtY4zsEkoQn+dZ7Njlbgy3jBFgWXSMtF3RAx0kV6Mf3XnJJ043c6KQLQejaVwaSDXtjZXQGRA2gmgIeH3rXCfz54NLQbMX0Sr8EHleHyB3AEAl8lgAnQLps96BHv2xqOjiOSnqTCxrinH9+E362fzbsHtf8Dr5T8+6rJgsimjzgW+zKdL1tQNJJc43Ennqg6wFvbEsclO0T1wXV6452gEswjUk5+Ht6WXZp2l+c7Nnm2K33+X2wSObc6VooEXJrQtYQquJFrjzGM15F14kRH15Q9qR9jxIDYDnqLBbVjvRjdUCU3KTYvuPsG2xC2z+Pk2z/PImTWxY5z52lXrCvmQjb8cPce4whvzwSZgHMKDpSW9yuWbJPVFD0Szu3kg8hqNhZ2mzVG/bftU14ZHFtn0OyVSYSCet+TZLmBgo4ZKzm29eD x-ms-exchange-antispam-messagedata: pfsNzdGkQGxgQ34UJJzu5RmPy1qDEErp9FtP4Areg8v7bMph8XIgS5D08J42zXfpWgb2HW/RxBrpd6w7zSL8Sh3smlS2ZffaR29kl1J7OYxTp1aZf12WulFjim8oy/LYIUR+ECWJXY7eCPnK6nbH2g== Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBSPR01MB0007 Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Honnappa.Nagarahalli@arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT042.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)(396003)(136003)(376002)(39860400002)(46966005)(54906003)(33656002)(81166007)(86362001)(4326008)(82740400003)(47076004)(8936002)(356005)(478600001)(186003)(6636002)(26826003)(9686003)(81156014)(5660300002)(70206006)(316002)(70586007)(7696005)(8676002)(55016002)(2906002)(6506007)(52536014)(26005)(336012)(110136005); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: ee9c9395-731c-4431-7ab9-08d7e1c05398 X-Forefront-PRVS: 0375972289 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: egiGhHie1bnugIkVcY0yBM2iHGceAcT8ZSFqpasOPSQGF5SUTRhzmFZHvgMo4J30R5G2OlbsKzrNUAlWgYj2CqlAAf+X0IDXMsSiliS7soBPWBbIneaGIFmCf2kGma0RCIoYZHAB54Q9Gm2EvWrlnQWGG5BsnFFz5k5Mg3AVDgDCNDnylOrssUHILfEAPaaQ7QxNwliYQQOE/9j/hw+7yxTaeMqPTojqNsh7QpmQEDSA1gMXoUfl1CnikbZFMYb2OJI4nuwhzGfhYCVu3UjRIroEXBQ3fFkojlbAAumYrMi4Oy0wUrHtoq6Lca2O1eKpRISKfCldwMjRQhGH1HdWZdLya2Ns5zgSw3tOL2V4V+3g64FPWBoQGYIp6ownSi2BcYG0OekcMyTAkUZ5X1ead2LVLwpRs7AAj5SkNfOet6AhZ+qjndWSjccnjSfder1/cUk3UQp+WdoEH/JBYX4c+a75UbFPaSfNKH8uLFjvgA8NLo01CG73pVzrgZGddT3k X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Apr 2020 04:40:53.7406 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bc938798-a353-417f-74ed-08d7e1c058e3 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: VI1PR0802MB2254 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" > > Subject: Re: [dpdk-dev] [PATCH v2 1/2] virtio: one way barrier for > > split vring used idx > > > > On Thu, 2 Apr 2020 10:57:52 +0800 > > Joyce Kong wrote: > > > > > -(vq)->vq_used_cons_idx)) > > > +static inline uint16_t > > > +virtqueue_nused(struct virtqueue *vq) > > vq is unmodified and should be const > > > > > +{ > > > +uint16_t idx; > > > +if (vq->hw->weak_barriers) { > > Put blank line between declaration and if statement > Will fix in v3. > > > > > +/* 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 > > > + barriers > > both > > > + * defined as compiler barriers on x86. > > > + */ > > > > Do not put comments on left margin (except in function prolog). > Will fix in v3. > > > > > +#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); > > > > Parenthesis around arguments to return are unnecessary. > > BSD code likes it, Linux style does not. > Will fix in v3. > > > > > +} > > > > 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= in the > fast path. > The test was conducted on the ThunderX2+Intel XL710 testbed, the PVP test > case. I think if the performance deference is not much we should stay with C11 bu= ilt-ins for x86. How much is the performance difference on x86? > /Gavin