From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 74A39A05D3 for ; Wed, 24 Apr 2019 12:03:45 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1FFB01B4BD; Wed, 24 Apr 2019 12:03:44 +0200 (CEST) Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr150043.outbound.protection.outlook.com [40.107.15.43]) by dpdk.org (Postfix) with ESMTP id EB6361B399 for ; Wed, 24 Apr 2019 12:03:41 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector1-arm-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MxibR2hiIC7Zwj+YhBGoky1XFbfTX+/01jrGjxXyJoE=; b=mgZaDD4gSkYfn7bF8OQ49RMDr1mr1xbiPyeKFdqLT7dDtTmUpeRathxrT1z+0KQhTXNJtvaXSrszZlx8MQOlicJDpKOpD6oopANBXIaMEdaRFz6zqbQ66XzCg/xrVeFB9hlDv66O8c0Mkm2SPTy4fIp/1Hbjt1sx9hGmC3Qbu3Q= Received: from AM0PR08MB4418.eurprd08.prod.outlook.com (20.179.35.207) by AM0PR08MB3523.eurprd08.prod.outlook.com (20.177.109.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1813.16; Wed, 24 Apr 2019 10:03:40 +0000 Received: from AM0PR08MB4418.eurprd08.prod.outlook.com ([fe80::21aa:85a4:d79:8f94]) by AM0PR08MB4418.eurprd08.prod.outlook.com ([fe80::21aa:85a4:d79:8f94%5]) with mapi id 15.20.1813.017; Wed, 24 Apr 2019 10:03:40 +0000 From: "Ruifeng Wang (Arm Technology China)" To: Honnappa Nagarahalli , "konstantin.ananyev@intel.com" , "stephen@networkplumber.org" , "paulmck@linux.ibm.com" , "marko.kovacevic@intel.com" , "dev@dpdk.org" CC: Honnappa Nagarahalli , "Gavin Hu (Arm Technology China)" , Dharmik Thakkar , Malvika Gupta , nd Thread-Topic: [dpdk-dev] [PATCH v7 1/3] rcu: add RCU library supporting QSBR mechanism Thread-Index: AQHU+Y7F7Vv8mRTtQk+aUor+LOxy/KZLANiQ Date: Wed, 24 Apr 2019 10:03:40 +0000 Message-ID: References: <20181122033055.3431-1-honnappa.nagarahalli@arm.com> <20190423043130.18153-1-honnappa.nagarahalli@arm.com> <20190423043130.18153-2-honnappa.nagarahalli@arm.com> In-Reply-To: <20190423043130.18153-2-honnappa.nagarahalli@arm.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Ruifeng.Wang@arm.com; x-originating-ip: [113.29.88.7] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: cdaea530-0525-4589-0871-08d6c89c20b4 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600141)(711020)(4605104)(4618075)(2017052603328)(7193020); SRVR:AM0PR08MB3523; x-ms-traffictypediagnostic: AM0PR08MB3523: nodisclaimer: True x-microsoft-antispam-prvs: x-forefront-prvs: 00179089FD x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(346002)(136003)(366004)(396003)(376002)(39860400002)(199004)(189003)(13464003)(66946007)(110136005)(54906003)(476003)(316002)(486006)(14454004)(66476007)(73956011)(81156014)(66446008)(76116006)(33656002)(71200400001)(14444005)(256004)(9686003)(66556008)(52536014)(64756008)(97736004)(99286004)(6436002)(71190400001)(2501003)(229853002)(6116002)(3846002)(68736007)(76176011)(11346002)(2906002)(7696005)(25786009)(81166006)(66066001)(186003)(72206003)(6246003)(8936002)(446003)(4326008)(2201001)(478600001)(102836004)(55016002)(6506007)(55236004)(305945005)(74316002)(7736002)(26005)(53936002)(86362001)(5660300002)(53546011); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR08MB3523; H:AM0PR08MB4418.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: NO+KhVr1Cpjov2QJLANMzgg70sEStud7eXz++ELHMtsAfHZ4Y/cE+p+NjZEGgCoAwviTHUfD2Tejjp6t7zVSpSpGN0xJp5jC0gnO4/UjwUHftQpxAhSYMVIeOg0q+/Dz4O65KALdQ6LHWNCKAR/d2w94if8hgYN+9HUsrQyfSirWXVY6ms4H6wTPYdMzjDA9WSLdlrA6egLaBW6R0MrEhvhvnquvFZxvpSl+gV95yg1Rz6ce4cst/moGoiFtnEJHPJKIKuQismc+GmYHdmxHRtq9oEct2KVlGUbLRqgN04LO8VkTQyNxC4x0l6B7nOa3J8lx+KfivC7Te6H2Wm/H+dRIKnTUMC0jYRNArtHL2EtobZfKzlRMAKPGE0MyLQLcZmLd2rJyK/hqjytVf346JzI22h7vYwAZbHmkbLfT4QM= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-Network-Message-Id: cdaea530-0525-4589-0871-08d6c89c20b4 X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Apr 2019 10:03:40.7385 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3523 Subject: Re: [dpdk-dev] [PATCH v7 1/3] rcu: add RCU library supporting QSBR mechanism 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" Message-ID: <20190424100340.PvqghbPRoZMsn12UkAmqwKxuWrWKYdvZ6GDfgniMdq8@z> Hi Honnappa, > -----Original Message----- > From: dev On Behalf Of Honnappa Nagarahalli > Sent: Tuesday, April 23, 2019 12:31 > To: konstantin.ananyev@intel.com; stephen@networkplumber.org; > paulmck@linux.ibm.com; marko.kovacevic@intel.com; dev@dpdk.org > Cc: Honnappa Nagarahalli ; Gavin Hu (Arm > Technology China) ; Dharmik Thakkar > ; Malvika Gupta > Subject: [dpdk-dev] [PATCH v7 1/3] rcu: add RCU library supporting QSBR > mechanism >=20 *snip* > +int __rte_experimental > +rte_rcu_qsbr_thread_unregister(struct rte_rcu_qsbr *v, unsigned int > +thread_id) { > + unsigned int i, id, success; > + uint64_t old_bmap, new_bmap; > + > + if (v =3D=3D NULL || thread_id >=3D v->max_threads) { > + rte_log(RTE_LOG_ERR, rcu_log_type, > + "%s(): Invalid input parameter\n", __func__); > + rte_errno =3D EINVAL; > + > + return 1; > + } > + > + RCU_IS_LOCK_CNT_ZERO(v, thread_id, ERR, "Lock counter %u\n", > + v->qsbr_cnt[thread_id].lock_cnt); > + > + id =3D thread_id & RTE_QSBR_THRID_MASK; > + i =3D thread_id >> RTE_QSBR_THRID_INDEX_SHIFT; > + > + /* Make sure that the counter for registered threads does not > + * go out of sync. Hence, additional checks are required. > + */ > + /* Check if the thread is already unregistered */ > + old_bmap =3D __atomic_load_n(RTE_QSBR_THRID_ARRAY_ELM(v, i), > + __ATOMIC_RELAXED); > + if (old_bmap & ~(1UL << id)) If I understand correctly, here should be (!(old_bmap & 1UL << id)) Can you please check? > + return 0; > + > + do { > + new_bmap =3D old_bmap & ~(1UL << id); > + /* Make sure any loads of the shared data structure are > + * completed before removal of the thread from the list of > + * reporting threads. > + */ > + success =3D __atomic_compare_exchange( > + RTE_QSBR_THRID_ARRAY_ELM(v, i), > + &old_bmap, &new_bmap, 0, > + __ATOMIC_RELEASE, > __ATOMIC_RELAXED); > + > + if (success) > + __atomic_fetch_sub(&v->num_threads, > + 1, __ATOMIC_RELAXED); > + else if (old_bmap & ~(1UL << id)) Same comment as previous. > + /* Someone else unregistered this thread. > + * Counter should not be incremented. > + */ > + return 0; > + } while (success =3D=3D 0); > + > + return 0; > +} *snip*