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 D00F9A057B; Mon, 23 Mar 2020 19:48:40 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 323E31C08E; Mon, 23 Mar 2020 19:48:40 +0100 (CET) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id 4CD0E1C07E for ; Mon, 23 Mar 2020 19:48:38 +0100 (CET) IronPort-SDR: HCHNNxyfebDQv/+GspM9FiXqX3EE5TKw7YTKzJk0J2oFaJ4LBn0ajr2UtRtX8Bh4yhMpow3lQE 3u60Fv3auU2g== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Mar 2020 11:48:37 -0700 IronPort-SDR: rmLzQxRIod0HeHBRTlww7O0t1vaq/HRx7UHeqVTnIMjYG3Kkexb/mLTCcc5Vu9v4KmwZ4z8H1C B0bCGS87o2Mw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,297,1580803200"; d="scan'208";a="246287096" Received: from orsmsx110.amr.corp.intel.com ([10.22.240.8]) by orsmga003.jf.intel.com with ESMTP; 23 Mar 2020 11:48:36 -0700 Received: from orsmsx602.amr.corp.intel.com (10.22.229.15) by ORSMSX110.amr.corp.intel.com (10.22.240.8) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 23 Mar 2020 11:48:35 -0700 Received: from orsmsx602.amr.corp.intel.com (10.22.229.15) by ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Mon, 23 Mar 2020 11:48:35 -0700 Received: from ORSEDG001.ED.cps.intel.com (10.7.248.4) by orsmsx602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1713.5 via Frontend Transport; Mon, 23 Mar 2020 11:48:35 -0700 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (104.47.57.171) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 23 Mar 2020 11:48:34 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LA8FU86nrILKOwC65/Ve8MsCSX4a3P7B4vYRskNs/6qPaG7B+6QO94vM1Lx9QveJTHfIlwSUGsm5+TEM5cAry9sGVBfetXjgT07TWbYxNgIO0UWk5W9J+lPkiJIF1ipHoG0+RExLkXuMcRhKniYvhY7AdWMcZt9GB0OrPWK1m4bQ+k/MlbjuRuWilwmgRbWuTC7g52Ld2amsy9n0ySQ4WsC4XOvYTH4bV1tPMbb1sbV+YdD6kSQQ63KQNReK3EbZxSRxpbCuHwZ8+Bz9j2zKrolsYHpm+jJBqI6H9upa+QP4GF+k05UFXq/YTk7GdtNQrN0b+9qVO3DpnefckP8WCg== 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=7NMCjqztzXHIhEE8KyvOq+evh5rqj2HB4e8lGTEthjo=; b=CvPoC5+u7/hyZdNSbsYnkhXob0E2vnQyW8ryggXfPrigvkXePxNnR9efRQ1Cy0daBKATiFSvHFT9FpJfUWoZrvvsTNnghChMUBAKuWUNmcXw5x6mLqVFVQVL+8r5k+fw052rafA3IrK8Em+nEZ5ZfOhAIcnhonFUG/2xrTruBO5PulSW3G5DrHqgkB10sk+neLDU7tbF2erSujUgGqr6hIb4bhHTPvmv/Rp5FooIzf8G5QmnJ4EtMR4GvDy794I8Cf10i4juDbfzDiFYlYqpK3sZvqXFBRcEnJXCrM2C802D8oz4vlAIsuvQgK2bGnKQFh/Bp4AYeyVhcxgfHFKODg== 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=7NMCjqztzXHIhEE8KyvOq+evh5rqj2HB4e8lGTEthjo=; b=B7qOcXfKwW9y466UHt6vG90bmNfeHhs/NXzyAKzNzM5hIPhU2MdUTtIm3nwHfxZ5ZUznEHSF2ZevRTtPr3ftmQARFygf7KNgHVl09uvwJqJGiPMPFiVv5xBGGphA6nZqD7WpWfiATJWdFtsyzjpgifSIVCLs+D74F8eR4QNaRUg= Received: from SN6PR11MB2558.namprd11.prod.outlook.com (2603:10b6:805:5d::19) by SN6PR11MB3520.namprd11.prod.outlook.com (2603:10b6:805:cf::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2835.22; Mon, 23 Mar 2020 18:48:30 +0000 Received: from SN6PR11MB2558.namprd11.prod.outlook.com ([fe80::5df7:d515:ec1d:8db1]) by SN6PR11MB2558.namprd11.prod.outlook.com ([fe80::5df7:d515:ec1d:8db1%7]) with mapi id 15.20.2835.021; Mon, 23 Mar 2020 18:48:30 +0000 From: "Ananyev, Konstantin" To: Phil Yang , "thomas@monjalon.net" , "Van Haaren, Harry" , "stephen@networkplumber.org" , "maxime.coquelin@redhat.com" , "dev@dpdk.org" , "Richardson, Bruce" CC: "david.marchand@redhat.com" , "jerinj@marvell.com" , "hemant.agrawal@nxp.com" , "Honnappa.Nagarahalli@arm.com" , "gavin.hu@arm.com" , "ruifeng.wang@arm.com" , "joyce.kong@arm.com" , "nd@arm.com" Thread-Topic: [PATCH v3 06/12] ipsec: optimize with c11 atomic for sa outbound sqn update Thread-Index: AQHV+/oXyqmxuvMqMkaN9n+g1LYtyqhWh04g Date: Mon, 23 Mar 2020 18:48:30 +0000 Message-ID: References: <1583999071-22872-1-git-send-email-phil.yang@arm.com> <1584407863-774-1-git-send-email-phil.yang@arm.com> <1584407863-774-7-git-send-email-phil.yang@arm.com> In-Reply-To: <1584407863-774-7-git-send-email-phil.yang@arm.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.2.0.6 authentication-results: spf=none (sender IP is ) smtp.mailfrom=konstantin.ananyev@intel.com; x-originating-ip: [192.198.151.182] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: b1a2c639-8705-46e1-2ef9-08d7cf5ac7cc x-ms-traffictypediagnostic: SN6PR11MB3520: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8273; x-forefront-prvs: 0351D213B3 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39860400002)(396003)(346002)(376002)(136003)(366004)(199004)(6636002)(86362001)(52536014)(26005)(186003)(71200400001)(478600001)(9686003)(4326008)(7696005)(6506007)(55016002)(7416002)(76116006)(33656002)(8936002)(81166006)(8676002)(81156014)(66556008)(2906002)(316002)(66446008)(110136005)(66476007)(64756008)(54906003)(66946007)(5660300002); DIR:OUT; SFP:1102; SCL:1; SRVR:SN6PR11MB3520; H:SN6PR11MB2558.namprd11.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: YXINnEz7qUrrC7L3bHwmwex6/txxnKd3KRsbJG+bzsX7tzXL3JNuWmhNJ4wKJ2WCV2mJsMaXtdUb4RSaFt2LFv1gxgxNpME0PfdNqm9B8Wy449olOkUa74gz1MHqC4i31vNQsfjkH8qRi2a0nS+nsyPivIvLpZq0KjNQsWlowk55w8L0hCeeI9TuxconnhXDQCak+jwf/FHpxehBLkdyIHwfKEDIlx2XeqhGaveMMNfD2J+A+X9fgHezsOeM/212LsyJECR0+rV42jQQHaxmFuVBDPf5QDk3dXVjfJnIh9jMnXTsy4L3YVP/X+fbcIzU4Mp+ni/s6AyY+BXRb2Y/4H/kzHybR1YygjPzoKslw8hiRqH6xIK6Yc1hTulyem59xcwkAtcqgA0yAEPmOzmOLCRjLYZA8LxFXkKoF5sby7QShruR6oWIJ6KJ3lC4SU6Z x-ms-exchange-antispam-messagedata: zyyfePhaDEx7mCvBP3ReoEPUQxGpFvfnRNfCCpiwLFGK8BxKu3Zew2JyNM8M7t78R4GAyW8ChX+/5fOq4aTVWcPRpWJwjAen9psjvNCWfiNhdonvSmZ2hhS5sjpCZ4EEZSQ77TjxH7BUtaUJ8OlDFQ== Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: b1a2c639-8705-46e1-2ef9-08d7cf5ac7cc X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Mar 2020 18:48:30.1078 (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: huPwehox8Cj/TBqRgWtTpiNiE+7+Na4SzduiEbG6U8q/09CGoHRjOroNtC2gJ9784obe4DikzaeIWkOkdVk5aBGD7d4BAGausFa9GncuOyY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR11MB3520 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v3 06/12] ipsec: optimize with c11 atomic for sa outbound sqn update 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 Phil, >=20 > For SA outbound packets, rte_atomic64_add_return is used to generate > SQN atomically. This introduced an unnecessary full barrier by calling > the '__sync' builtin implemented rte_atomic_XX API on aarch64. This > patch optimized it with c11 atomic and eliminated the expensive barrier > for aarch64. >=20 > Signed-off-by: Phil Yang > Reviewed-by: Ruifeng Wang > Reviewed-by: Gavin Hu > --- > lib/librte_ipsec/ipsec_sqn.h | 3 ++- > lib/librte_ipsec/sa.h | 2 +- > 2 files changed, 3 insertions(+), 2 deletions(-) >=20 > diff --git a/lib/librte_ipsec/ipsec_sqn.h b/lib/librte_ipsec/ipsec_sqn.h > index 0c2f76a..e884af7 100644 > --- a/lib/librte_ipsec/ipsec_sqn.h > +++ b/lib/librte_ipsec/ipsec_sqn.h > @@ -128,7 +128,8 @@ esn_outb_update_sqn(struct rte_ipsec_sa *sa, uint32_t= *num) >=20 > n =3D *num; > if (SQN_ATOMIC(sa)) > - sqn =3D (uint64_t)rte_atomic64_add_return(&sa->sqn.outb.atom, n); > + sqn =3D __atomic_add_fetch(&sa->sqn.outb.atom, n, > + __ATOMIC_RELAXED); One generic thing to note: clang for i686 in some cases will generate a proper function call for 64-bit __atomic builtins (gcc seems to always generate cmpxchng8b for such = cases). Does anyone consider it as a potential problem? It probably not a big deal, but would like to know broader opinion. > else { > sqn =3D sa->sqn.outb.raw + n; > sa->sqn.outb.raw =3D sqn; > diff --git a/lib/librte_ipsec/sa.h b/lib/librte_ipsec/sa.h > index d22451b..cab9a2e 100644 > --- a/lib/librte_ipsec/sa.h > +++ b/lib/librte_ipsec/sa.h > @@ -120,7 +120,7 @@ struct rte_ipsec_sa { > */ > union { > union { > - rte_atomic64_t atom; > + uint64_t atom; > uint64_t raw; > } outb; If we don't need rte_atomic64 here anymore, then I think we can collapse the union to just: uint64_t outb;=20 > struct { > -- > 2.7.4