From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0078.outbound.protection.outlook.com [104.47.42.78]) by dpdk.org (Postfix) with ESMTP id DB4D65B2E; Thu, 20 Sep 2018 08:41:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7UcKbV/RoYgu5Mxpfwk6xcwQS5aq+zMBsiaQb98Li4k=; b=DbmB0Hbp9+/8NOGOQLqcuxTWPkmpRMwwgcJoPlpNxCX7aRfvJ+DHfoaYyVF6J69LJ/u6bzTdWGO8DXyCYH3GHXX/SuTBAQmvHNs+2FSUasG068CydJc/uqt2E3R4Yj6+/HojSJ9eDS7MyC4UPflUZAVZF1EfWcuECBNmAuRwzCw= Received: from BYAPR07MB4997.namprd07.prod.outlook.com (52.135.238.214) by BYAPR07MB4663.namprd07.prod.outlook.com (52.135.204.149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1143.15; Thu, 20 Sep 2018 06:41:26 +0000 Received: from BYAPR07MB4997.namprd07.prod.outlook.com ([fe80::c465:d2a1:d4ad:3af7]) by BYAPR07MB4997.namprd07.prod.outlook.com ([fe80::c465:d2a1:d4ad:3af7%5]) with mapi id 15.20.1143.017; Thu, 20 Sep 2018 06:41:26 +0000 From: Jerin Jacob To: Gavin Hu CC: "dev@dpdk.org" , "Honnappa.Nagarahalli@arm.com" , "steve.capper@arm.com" , "Ola.Liljedahl@arm.com" , "nd@arm.com" , "stable@dpdk.org" , "jia.he@hxt-semitech.com" Thread-Topic: [PATCH v4 2/4] ring: read tail using atomic load Thread-Index: AQHUTl4M0eEBoA1JzECgJ/n/BsSaBqT4vSGA Date: Thu, 20 Sep 2018 06:41:26 +0000 Message-ID: <20180920064117.GC2283@jerin> References: <20180917074735.28161-1-gavin.hu@arm.com> <1537171879-64390-1-git-send-email-gavin.hu@arm.com> <1537171879-64390-2-git-send-email-gavin.hu@arm.com> In-Reply-To: <1537171879-64390-2-git-send-email-gavin.hu@arm.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [111.93.218.67] x-clientproxiedby: DM5PR07CA0046.namprd07.prod.outlook.com (2603:10b6:3:16::32) To BYAPR07MB4997.namprd07.prod.outlook.com (2603:10b6:a03:5b::22) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Jerin.JacobKollanukkaran@cavium.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; BYAPR07MB4663; 6:tEPoyZBC67/Gaer6y41fzr7IB3DUhGDBh9NAhBuoX4SWyBW/kneSvoX4za0naRZIiB8QCqWcbMOPtF8IHJdwtSyJpoxWSVOs4PxameCeQCv+TsI4pyC86HI321zwqyKdTu5+EVJR5iIJQPq3fsrHNv8NiNue4hOaAIzNz6Gs5WdP6ja7dOmXrTlm0BlyQax5mBZtc6OcpS370aSXNpZ3sUzE7bNhH+bBGOHjzb3JVd60luOmrchaa4UsvJoAMSZlhhQyTJakM7d6Twr87S2h1r9xkqzcB+tQUKVCLfvlRr9a8nP3YKftZ06XbDLdkB1fQWzRPWwPSxoCZhk8EV0L5O+wL1VyuanNj5GTIc+4yP1NXwIGfdtK6i7UT+BDeTwjunV4cK9Nqd/kQQ24KGi0Jb9D7h1/ghFJe6aSXCVgoRsXT0vjT/c/WmqVQ7S/cgfASxv/M9m3S3FFZB5eEQER+w==; 5:4i/HZm+I5x4UqKgcUD0B4ejK/1jd96YBNhO0RM4bvxEg5szsUXzF/wk6afw/0Q5v6ySz91yQbM2HWwNM+xFlfoEi3nROlt8fPljR8uLo3rSu3DVqdEmiU3Q09uveIy7i7JJXQi6Ir1+hVWrvoL+d01+KYINvTwBxgL+EJR02xVs=; 7:RlrVT8gnNuRsWdOkDtdaiIXvfC8AQQ2iAsfoSMMWQ0YwIC0vgzbVZUYS16Eusb4VrdJ6iuS+lCsDAfFVf0l7azDjZHFR4UkDhSbOR5yKTNPGfCxz9ZQYAGXHR3bgDFhvqqmRDGLhfi1ap0Rs8fF4vGGV4J/vo3/Opu1m2Mb0iSrsQj0H/N4cIZG8YBY2pH6m9i5MpouI0YIsCRd4RSvRUujvXj3BprN3z5rFm6j0N9ZajuME2regwLvQARPinbOo x-ms-office365-filtering-correlation-id: b15ff1d7-70fc-46b9-26c7-08d61ec41692 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534165)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:BYAPR07MB4663; x-ms-traffictypediagnostic: BYAPR07MB4663: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(180628864354917); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(10201501046)(3231355)(944501410)(52105095)(93006095)(3002001)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123564045)(20161123560045)(20161123558120)(201708071742011)(7699051); SRVR:BYAPR07MB4663; BCL:0; PCL:0; RULEID:; SRVR:BYAPR07MB4663; x-forefront-prvs: 0801F2E62B x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(7916004)(376002)(346002)(39860400002)(396003)(366004)(136003)(13464003)(189003)(199004)(6486002)(99286004)(6436002)(7736002)(42882007)(1076002)(54906003)(305945005)(33716001)(52116002)(6116002)(3846002)(2906002)(8676002)(14454004)(478600001)(72206003)(102836004)(6246003)(6506007)(386003)(71190400001)(71200400001)(11346002)(186003)(5250100002)(486006)(446003)(476003)(81166006)(76176011)(4326008)(81156014)(25786009)(8936002)(229853002)(53936002)(105586002)(26005)(33656002)(97736004)(14444005)(106356001)(66066001)(256004)(68736007)(316002)(5660300001)(9686003)(6512007)(33896004)(2900100001)(6916009); DIR:OUT; SFP:1101; SCL:1; SRVR:BYAPR07MB4663; H:BYAPR07MB4997.namprd07.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: LwpW7fZchoYnOxFlFcnjs4RhlXTqpGE0u6X7h5WLVVOAHZbDo53RyM3ONBDNH9ino/rWNV9eweP9vReDRErtYT0uqSGQGJaMMTmWEgcx/vkCQtMiatlntfp5rq67U1BuNAoDXQ9e6leXO2Bb1VsV6/7/YhkWUJiD6wVezdZbrAk41SGghSYtimErUJD+PS9PX1mENogQAJGVC8KkMNNnDekgMvO5EqmANfQhaky/mt/6IsgnKElmWFwtjgRnqIEqcGTKFmAo/sLZImVHF6UaaZTbsLAQ12XkKQtGQCLMEKJ99+N6wGYx6OYoh2t70MKpsBwqqd8FuoROk5j7DX2CwnY8g+QpsRnITgyuLv7Dhyg= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-ID: <3438533554E3414CA6CE7B017B522717@namprd07.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-Network-Message-Id: b15ff1d7-70fc-46b9-26c7-08d61ec41692 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Sep 2018 06:41:26.4446 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR07MB4663 Subject: Re: [dpdk-dev] [PATCH v4 2/4] ring: read tail using atomic load 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: , X-List-Received-Date: Thu, 20 Sep 2018 06:41:29 -0000 -----Original Message----- > Date: Mon, 17 Sep 2018 16:11:17 +0800 > From: Gavin Hu > To: dev@dpdk.org > CC: gavin.hu@arm.com, Honnappa.Nagarahalli@arm.com, steve.capper@arm.com, > Ola.Liljedahl@arm.com, jerin.jacob@caviumnetworks.com, nd@arm.com, > stable@dpdk.org > Subject: [PATCH v4 2/4] ring: read tail using atomic load > X-Mailer: git-send-email 2.7.4 >=20 >=20 > In update_tail, read ht->tail using __atomic_load.Although the > compiler currently seems to be doing the right thing even without > _atomic_load, we don't want to give the compiler freedom to optimise > what should be an atomic load, it should not be arbitarily moved > around. >=20 > Fixes: 39368ebfc6 ("ring: introduce C11 memory model barrier option") > Cc: stable@dpdk.org + Jia He >=20 > Signed-off-by: Gavin Hu > Reviewed-by: Honnappa Nagarahalli > Reviewed-by: Steve Capper > Reviewed-by: Ola Liljedahl > --- > lib/librte_ring/rte_ring_c11_mem.h | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) >=20 > diff --git a/lib/librte_ring/rte_ring_c11_mem.h b/lib/librte_ring/rte_rin= g_c11_mem.h > index 94df3c4..234fea0 100644 > --- a/lib/librte_ring/rte_ring_c11_mem.h > +++ b/lib/librte_ring/rte_ring_c11_mem.h > @@ -21,7 +21,8 @@ update_tail(struct rte_ring_headtail *ht, uint32_t old_= val, uint32_t new_val, > * we need to wait for them to complete > */ > if (!single) > - while (unlikely(ht->tail !=3D old_val)) > + while (unlikely(old_val !=3D __atomic_load_n(&ht->tail, > + __ATOMIC_RELAXED))) > rte_pause(); >=20 > __atomic_store_n(&ht->tail, new_val, __ATOMIC_RELEASE); > -- > 2.7.4 >=20