Message ID | 1698894265-22963-1-git-send-email-roretzla@linux.microsoft.com (mailing list archive) |
---|---|
Headers |
Return-Path: <dev-bounces@dpdk.org> X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C8CF443268; Thu, 2 Nov 2023 04:04:38 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 932BF402EC; Thu, 2 Nov 2023 04:04:34 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id D3C5B402C4 for <dev@dpdk.org>; Thu, 2 Nov 2023 04:04:31 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id D5CD920B74C0; Wed, 1 Nov 2023 20:04:30 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com D5CD920B74C0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1698894270; bh=yDaqyQxNhiokC1m4ft9pX/hac0/Xkfo4pUu/noiL0NQ=; h=From:To:Cc:Subject:Date:From; b=KL4TiNievGB7/qw0RcsYQ8GsU8ObGKQFs7taKgKxlwBkTjG13sBUt2K4CI0XuG6Pd UFj0tH6aOsiwsVQIZLxPXleBn58EcUdm9eSwF+SHI/P3F+SNEHEWUzM6P81eiRKkVK FqmvVGeaKsNarfVYb5fpEON9cF2Pwl3tzOa7ndy8= From: Tyler Retzlaff <roretzla@linux.microsoft.com> To: dev@dpdk.org Cc: Bruce Richardson <bruce.richardson@intel.com>, David Hunt <david.hunt@intel.com>, Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>, Jerin Jacob <jerinj@marvell.com>, Konstantin Ananyev <konstantin.v.ananyev@yandex.ru>, Sameh Gobriel <sameh.gobriel@intel.com>, Sunil Kumar Kori <skori@marvell.com>, Vladimir Medvedkin <vladimir.medvedkin@intel.com>, Yipeng Wang <yipeng1.wang@intel.com>, Tyler Retzlaff <roretzla@linux.microsoft.com> Subject: [PATCH 0/5] use rte atomic thread fence Date: Wed, 1 Nov 2023 20:04:20 -0700 Message-Id: <1698894265-22963-1-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions <dev.dpdk.org> List-Unsubscribe: <https://mails.dpdk.org/options/dev>, <mailto:dev-request@dpdk.org?subject=unsubscribe> List-Archive: <http://mails.dpdk.org/archives/dev/> List-Post: <mailto:dev@dpdk.org> List-Help: <mailto:dev-request@dpdk.org?subject=help> List-Subscribe: <https://mails.dpdk.org/listinfo/dev>, <mailto:dev-request@dpdk.org?subject=subscribe> Errors-To: dev-bounces@dpdk.org |
Series | use rte atomic thread fence | |
Message
Tyler Retzlaff
Nov. 2, 2023, 3:04 a.m. UTC
Replace use of __atomic_thread_fence with __rte_atomic_thread_fence. It may be appropriate to use rte_atomic_thread_fence instead but it will be up to maintainers to evaluate and make the change if appropriate. Tyler Retzlaff (5): distributor: use rte atomic thread fence eal: use rte atomic thread fence hash: use rte atomic thread fence ring: use rte atomic thread fence stack: use rte atomic thread fence lib/distributor/rte_distributor.c | 2 +- lib/eal/common/eal_common_trace.c | 2 +- lib/hash/rte_cuckoo_hash.c | 10 +++++----- lib/ring/rte_ring_c11_pvt.h | 4 ++-- lib/stack/rte_stack_lf_c11.h | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-)
Comments
> From: Tyler Retzlaff [mailto:roretzla@linux.microsoft.com] > Sent: Thursday, 2 November 2023 04.04 > > Replace use of __atomic_thread_fence with __rte_atomic_thread_fence. > > It may be appropriate to use rte_atomic_thread_fence instead but it > will be up to maintainers to evaluate and make the change if > appropriate. > > Tyler Retzlaff (5): > distributor: use rte atomic thread fence > eal: use rte atomic thread fence > hash: use rte atomic thread fence > ring: use rte atomic thread fence > stack: use rte atomic thread fence > > lib/distributor/rte_distributor.c | 2 +- > lib/eal/common/eal_common_trace.c | 2 +- > lib/hash/rte_cuckoo_hash.c | 10 +++++----- > lib/ring/rte_ring_c11_pvt.h | 4 ++-- > lib/stack/rte_stack_lf_c11.h | 2 +- > 5 files changed, 10 insertions(+), 10 deletions(-) > > -- > 1.8.3.1 Series-acked-by: Morten Brørup <mb@smartsharesystems.com>
02/11/2023 04:04, Tyler Retzlaff: > Replace use of __atomic_thread_fence with __rte_atomic_thread_fence. > > It may be appropriate to use rte_atomic_thread_fence instead but it > will be up to maintainers to evaluate and make the change if appropriate. I don't understand the use of __rte_atomic_thread_fence which is supposed to be EAL-internal only, isn't it? On x86, we have this: static __rte_always_inline void rte_atomic_thread_fence(rte_memory_order memorder) { if (memorder == rte_memory_order_seq_cst) rte_smp_mb(); else __rte_atomic_thread_fence(memorder); } This is skipped if you use __rte_atomic_thread_fence() directly.
On Wed, Nov 08, 2023 at 06:04:47PM +0100, Thomas Monjalon wrote: > 02/11/2023 04:04, Tyler Retzlaff: > > Replace use of __atomic_thread_fence with __rte_atomic_thread_fence. > > > > It may be appropriate to use rte_atomic_thread_fence instead but it > > will be up to maintainers to evaluate and make the change if appropriate. > > I don't understand the use of __rte_atomic_thread_fence > which is supposed to be EAL-internal only, isn't it? > > On x86, we have this: > static __rte_always_inline void > rte_atomic_thread_fence(rte_memory_order memorder) > { > if (memorder == rte_memory_order_seq_cst) > rte_smp_mb(); > else > __rte_atomic_thread_fence(memorder); > } > > This is skipped if you use __rte_atomic_thread_fence() directly. correct. that is on purpose because the original code was skipping condition by using __atomic_thread_fence directly. this series intends no functional change which is why the replacements are __rte_atomic_thread_fence instead of to rte_atomic_thread_fence. i would encourage the maintainers to evaluate whether the code can use rte_atomic_thread_fence directly without functional regression. ty
08/11/2023 19:49, Tyler Retzlaff: > On Wed, Nov 08, 2023 at 06:04:47PM +0100, Thomas Monjalon wrote: > > 02/11/2023 04:04, Tyler Retzlaff: > > > Replace use of __atomic_thread_fence with __rte_atomic_thread_fence. > > > > > > It may be appropriate to use rte_atomic_thread_fence instead but it > > > will be up to maintainers to evaluate and make the change if appropriate. > > > > I don't understand the use of __rte_atomic_thread_fence > > which is supposed to be EAL-internal only, isn't it? > > > > On x86, we have this: > > static __rte_always_inline void > > rte_atomic_thread_fence(rte_memory_order memorder) > > { > > if (memorder == rte_memory_order_seq_cst) > > rte_smp_mb(); > > else > > __rte_atomic_thread_fence(memorder); > > } > > > > This is skipped if you use __rte_atomic_thread_fence() directly. > > correct. that is on purpose because the original code was skipping > condition by using __atomic_thread_fence directly. There is chance that it was not skipping on purpose. > this series intends no functional change which is why the replacements > are __rte_atomic_thread_fence instead of to rte_atomic_thread_fence. We should take this opportunity to simplify the code, I mean we should avoid having 3 functions for the same thing. > i would encourage the maintainers to evaluate whether the code can use > rte_atomic_thread_fence directly without functional regression. Let's do the change so the maintainers can review what is changed. Note it should have no impact if not using rte_memory_order_seq_cst. If we discover later that something is broken, we have time to fix it. Note: lib/eal/include/rte_mcslock.h should not use __rte_atomic_thread_fence() and lib/lpm/rte_lpm.c should not use __atomic_thread_fence(). Can we replace and discourage all occurrences of __atomic_thread_fence() and __rte_atomic_thread_fence()? It would be simpler to recommend only rte_atomic_thread_fence(). Also in another patch, it would be nice to replace __ATOMIC_* with rte_memory_order_*, at least when used in rte_atomic_thread_fence().