From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0060.outbound.protection.outlook.com [104.47.33.60]) by dpdk.org (Postfix) with ESMTP id 2F7791B341 for ; Tue, 7 Nov 2017 05:37:18 +0100 (CET) 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; bh=r+eg+JfARPShnUBqx39LBaT8VyqHrw6DaGExrpaFXi4=; b=RAGYbwiN8VAMAox5hY+Sf8bAwrvigy4PfuFxNdLDhJYDJg6MLP4RnQOi4d2suCmCRJwBsxYHbjs9FLDYNDo3bCFQcQcz0QqNikcUkdm2QHcRq5lJrQa8RQ9B0EH2y9tKWEkJF+0n1lIR7Fyb/ApCft9/DdIabq2EKBoOu4mod48= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jerin.JacobKollanukkaran@cavium.com; Received: from jerin (111.93.218.67) by BN3PR07MB2515.namprd07.prod.outlook.com (10.167.4.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.197.13; Tue, 7 Nov 2017 04:37:12 +0000 Date: Tue, 7 Nov 2017 10:06:57 +0530 From: Jerin Jacob To: Jia He Cc: dev@dpdk.org, olivier.matz@6wind.com, konstantin.ananyev@intel.com, bruce.richardson@intel.com, jianbo.liu@arm.com, hemant.agrawal@nxp.com, jie2.liu@hxt-semitech.com, bing.zhao@hxt-semitech.com, jia.he@hxt-semitech.com Message-ID: <20171107043655.GA3244@jerin> References: <1509612210-5499-1-git-send-email-hejianet@gmail.com> <20171102172337.GB1478@jerin> <25192429-8369-ac3d-44b0-c1b1d7182ef0@gmail.com> <20171103125616.GB20326@jerin> <7b7f3677-8313-9a2f-868f-b3a6231548d6@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <7b7f3677-8313-9a2f-868f-b3a6231548d6@gmail.com> User-Agent: Mutt/1.9.1 (2017-09-22) X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: BM1PR01CA0100.INDPRD01.PROD.OUTLOOK.COM (10.174.208.16) To BN3PR07MB2515.namprd07.prod.outlook.com (10.167.4.140) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d8bed42a-185f-451c-0759-08d5259938dd X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(2017052603199); SRVR:BN3PR07MB2515; X-Microsoft-Exchange-Diagnostics: 1; BN3PR07MB2515; 3:J1phOpK2Jo4acPtaezqA9sNzXClS6KoLTmoNSm3bHF5wxP7ZXwpTks/tVJf/qfUo5wecgwDI+aQxdpe9fXgvz3LbxQ9C5wvCYP68RguN7RR75j6xZpgSipdeuL+cukbOIpmZT5THusiGPHlFGZVgmAZEjSoQNc9U2+aECowI5oGps96pXNkqKISzXesnm42EBDEQZTeu+XdO7q/8NlIgKSz4z2gl8H60ESBHresE80T437eklGEs/hzyooUQotSE; 25:VrZoPYibZzKTDITYfEdlGBuPGdpsGjcavqIT6nGQ1tra+kFzD23J1KYuKa+2bMBX/LLUXdgm7p++xWDgEY02SQj/nMGKcgHPnDJZA7XgKh7ud9hu5htXRJsN0JnCQch9amrkkm1b9IrSXjq6v4Ke76NwTI7MdSFiiizBax+LhfgJJyARwXn2haYOR88J6H2prQoUq14OMidA1e4+GqR5Fqq2lx0puHfY7hdfoeSo++KftDVo21gQgBpWYPUYSQ0IgjrRV4p1aY7Eal3utqQDSKyFnVf32CsIVVkE+MRaeQOr77ZsuPdQ1ipTJWvlNT/Th2r7cINR7QjwoEWsWUQZmQ==; 31:0FJdmQwIBMJ7OEZYBynGIXckTasNZ39SN9AO5Gp9rVT1eTMW/nXrPabiEcXl0OrTc/2ROGJveVWEL/FyV1JhnfB5bF4XJ25T4KvheFEf/IiQj8Q9wnRO5wEqE9NR4s4F+gPWdRObiLwIBDXV6oR0xCMgF65MPxrgvImwxA4zrTl2QkS8/hLV6sgZJefOI7SNp0JaoA6ZZCj93veBGWE99+LXzhf+VmIlRu5NaCQMp7U= X-MS-TrafficTypeDiagnostic: BN3PR07MB2515: X-Microsoft-Exchange-Diagnostics: 1; BN3PR07MB2515; 20:v3otEMNqTKelYn/f6WJk4kJparUqawlVwRRmA9Qm6XRV5cmYYWIqJ/SUFh29aC+osyRuJhUm3i6M1v7PwhqyHY6sydZUsbLtcevPxX6kL+RsDdhW60iklgCWKua2LkVxfoRHCLbl15vqIVQ58mJKqcyHucSaAokQU4OAAiCa1/eOi8i6xOqU6x9kOJVQeD3gmmTHGz5jYj8OvIzb5c8YRK+DS6LEBAWT3jz7dBsooIHHTzcoXTS3KoX09QqENd+C7tpzYBSIPKFqeINxv/RLEfl10s0NDU11OyD5efwNZd/OpuPLQ3+J+h6gknESKHAZjtiEkijkvDYWvTPA+rx/tZT8X37A8AdJ9tc9kfey313EaRHjH9VgBleJHZRRwm12DtLGkFAJ5Zty26JR7Sy9Fsgk5yXlOqb54F+a6FeoTJ14Cg8E3fND4XOFbfFfXRR2OTItw+5qS5V/ACz3Kry9RcV/JkA+RmpovXgWJqDACJDtMnZi18mYz1Cc2RdlGRdaPA/C7hsg1oZYv8FINs/7MM5FYOJToVIKLi2b4UsinPiLcff0gUEHMf7Rw1SQXM9OH519HK59PvG0bXEd5edtKoVfd5UlXPQ+k++ccGNL344= X-Exchange-Antispam-Report-Test: UriScan:(180628864354917)(185117386973197)(228905959029699); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(10201501046)(93006095)(100000703101)(100105400095)(3002001)(3231021)(6041248)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123560025)(20161123558100)(20161123562025)(20161123564025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BN3PR07MB2515; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BN3PR07MB2515; X-Microsoft-Exchange-Diagnostics: 1; BN3PR07MB2515; 4:KZ9evVsjgPPPN9ttxuksHJU8GimKyfbTood7ycfzpBCs5zyJg/PrhZi/cDF3w5Jog++0N9LL97+MDKLNez2R971IZJOrSrr1HutpntXrZKbaxLJ0fSI/uFurj9Z7j2Z3aUQw6W/4NAtCtElXgQdkqKMOUDDtA2SnhGOfGvjlvpNNn3Vgv6g0QsqVpX+UkRDTLAM1TWsAFV0V1R5rufMwDDkb1EPqDefn8vfuYZlK82Hz4G1ttbydTxcOKI2hQ5rYKEoGA5UZH7IyQediiW/Px2fMLXVpFuGgk8eS9F5hMUhz1yTRcrvD3Qz0qKCxhFquh7bvY3UBBq21Pvp728t88yseJn6qmbACIbgYrQBdp0a0YK3jU7GPmNU3h0FQxW74 X-Forefront-PRVS: 0484063412 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(346002)(376002)(51914003)(13464003)(189002)(199003)(24454002)(9686003)(66066001)(5660300001)(23676003)(305945005)(106356001)(33716001)(5009440100003)(7736002)(53936002)(6496005)(1076002)(97736004)(83506002)(3846002)(16526018)(7416002)(81156014)(8936002)(8676002)(50466002)(55016002)(81166006)(6116002)(8656006)(6666003)(2950100002)(6916009)(93886005)(2870700001)(72206003)(229853002)(42882006)(6246003)(4326008)(47776003)(478600001)(2906002)(50986999)(76176999)(58126008)(54356999)(25786009)(101416001)(68736007)(105586002)(39060400002)(316002)(1411001)(189998001)(33656002)(18370500001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN3PR07MB2515; H:jerin; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtCTjNQUjA3TUIyNTE1OzIzOjZ5QkR0dE9PTTBScW5Fb3c3elBWYWEwR1FQ?= =?utf-8?B?cVFVTjF4V0hOS3NhZmtkbk5KckIwaS9xMzZPR09OWjZLWG81RmpNRlNaOXNU?= =?utf-8?B?NXkwYnVRdUFnQUgzZjJnZ2tiV20wV2U1VUNldHovU2kvZFNKTStkcHBSb2JJ?= =?utf-8?B?aVZOM0tyN3JBeDdUU0NoTzVFaHdJeExIYmNuTm9rQW16MElOc3l5c0pacTNH?= =?utf-8?B?LzgwOWFVOVdzcXJCWGVvcXluMTBuNWQweGR1ZHhQUCthQ01sK05ydjNRQ1lH?= =?utf-8?B?ejV5bm5ZbmVneWNtRkthVVhneUpvSkliQWZuMDFvamtFVXJXcmFYTmc1UzBD?= =?utf-8?B?bjZIbDVwcHZ6bXE5UVJYRnZYdXZWR0lqTnZzUjVKa2J0clE1Wld3dFhQVnY0?= =?utf-8?B?b1ZmV0tqdmF5YXdaTS9GTlErelFScTVoWlB0TmdWeDgwZnUwL1BwSHZRRzVU?= =?utf-8?B?T0ZPTTh0ZHM2RjZ3WlRWUnM4K3NLVFl1YmJZMzgwSUlRQStHcVdLcDFmK1V2?= =?utf-8?B?RUVJd0F3K1lMOENuY3RnTGJjOWZNN2JKbWh2eUNVOUJTQkhCOTZkSjlvQy95?= =?utf-8?B?S1VyUXZnRzBtVWtzeGp5Q0svQ1pYSTFYRzBDRS96SHpJYXQ3UlJVRDNNb1RL?= =?utf-8?B?SEovRnRzaDVLQmx1YzIyaCtGeTVaQmxIZ0tHMU9pMjVYS3oyakxCRTVLS3JS?= =?utf-8?B?SzF1dzNjRDdMYW9jdmk4QlJQNGNyN3ZCZVNRSVYwVjUzK1ROZnFGelVQQmdi?= =?utf-8?B?RlN2Uzg1bE5KSVgzRndBM3RSZ1cvMnlmZjVTZC9pdkN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JFmmEZs5ndEkYOzbGZ35kBTQJo2tjrgACMqAL0Lio5M8soDWh3Lo2b1g8cZpWUO5hIRq SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2017 04:37:12.9995 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d8bed42a-185f-451c-0759-08d5259938dd X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR07MB2515 Subject: Re: [dpdk-dev] [PATCH v2] ring: guarantee ordering of cons/prod loading when doing 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: Tue, 07 Nov 2017 04:37:18 -0000 -----Original Message----- > Date: Mon, 6 Nov 2017 15:25:12 +0800 > From: Jia He > To: Jerin Jacob > Cc: dev@dpdk.org, olivier.matz@6wind.com, konstantin.ananyev@intel.com, > bruce.richardson@intel.com, jianbo.liu@arm.com, hemant.agrawal@nxp.com, > jie2.liu@hxt-semitech.com, bing.zhao@hxt-semitech.com, > jia.he@hxt-semitech.com > Subject: Re: [PATCH v2] ring: guarantee ordering of cons/prod loading when > doing > User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 > Thunderbird/52.4.0 > > Hi Jerin > > > On 11/3/2017 8:56 PM, Jerin Jacob Wrote: > > -----Original Message----- > > > > [...] > > > g like that. > > > Ok, but how to distinguish following 2 options? > > No clearly understood this question. For arm64 case, you can add > > CONFIG_RTE_RING_USE_C11_MEM_MODEL=y in config/defconfig_arm64-armv8a-* > Sorry for my unclear expressions. > I mean there should be one additional config macro besides > CONFIG_RTE_RING_USE_C11_MEM_MODEL > for users to choose? > > i.e. >  - On X86:CONFIG_RTE_RING_USE_C11_MEM_MODEL=n > include rte_ring_generic.h, no changes > - On arm64,CONFIG_RTE_RING_USE_C11_MEM_MODEL=y > include rte_ring_c11_mem.h by default. > In rte_ring_c11_mem.h, implement new version of > __rte_ring_move_prod_head/__rte_ring_move_cons_head/update_tail > > Then, how to distinguish the option of using rte_smp_rmb() or > __atomic_load/store_n()? On option could be to change the prototype of update_tail() and make compiler accommodate it for zero cost for arm64(Which I think, it it the case. But you can check the generated instructions) If not, move, __rte_ring_do_dequeue() and __rte_ring_do_enqueue() instead of __rte_ring_move_prod_head/__rte_ring_move_cons_head/update_tail() ➜ [master][dpdk.org] $ git diff diff --git a/lib/librte_ring/rte_ring.h b/lib/librte_ring/rte_ring.h index 5e9b3b7b4..b32648825 100644 --- a/lib/librte_ring/rte_ring.h +++ b/lib/librte_ring/rte_ring.h @@ -358,8 +358,12 @@ void rte_ring_dump(FILE *f, const struct rte_ring *r); static __rte_always_inline void update_tail(struct rte_ring_headtail *ht, uint32_t old_val, uint32_t new_val, - uint32_t single) + uint32_t single, const uint32_t enqueue) { + if (enqueue) + rte_smp_wmb(); + else + rte_smp_rmb(); /* * If there are other enqueues/dequeues in progress that * preceded us, * we need to wait for them to complete @@ -470,9 +474,8 @@ __rte_ring_do_enqueue(struct rte_ring *r, void * const *obj_table, goto end; ENQUEUE_PTRS(r, &r[1], prod_head, obj_table, n, void *); - rte_smp_wmb(); - update_tail(&r->prod, prod_head, prod_next, is_sp); + update_tail(&r->prod, prod_head, prod_next, is_sp, 1); end: if (free_space != NULL) *free_space = free_entries - n; @@ -575,9 +578,8 @@ __rte_ring_do_dequeue(struct rte_ring *r, void **obj_table, goto end; DEQUEUE_PTRS(r, &r[1], cons_head, obj_table, n, void *); - rte_smp_rmb(); - update_tail(&r->cons, cons_head, cons_next, is_sc); + update_tail(&r->cons, cons_head, cons_next, is_sc, 0); end: if (available != NULL) > > Thanks for the clarification. > > -- > Cheers, > Jia >