From: Konstantin Ananyev <konstantin.v.ananyev@yandex.ru>
To: Nick Hudson <nhudson@akamai.com>, dev@dpdk.org
Cc: Wathsala Vithanage <wathsala.vithanage@arm.com>,
Konstantin Ananyev <konstantin.ananyev@huawei.com>,
Marat Khalili <qm2k21@gmail.com>
Subject: Re: [PATCH 3/3] bpf/arm64: detect atomics at build time or runtime
Date: Tue, 1 Dec 2026 10:57:33 +0000 [thread overview]
Message-ID: <65025e7b-e69f-4483-93dd-3e689fc03554@yandex.ru> (raw)
In-Reply-To: <20261130163306.11116-4-nhudson@akamai.com>
> Use LSE instructions when __ARM_FEATURE_ATOMICS or
> RTE_ARM_FEATURE_ATOMICS is defined. Otherwise, check runtime CPU flags
> before selecting LSE instructions for JIT-generated code.
Just to understand: so we'll have all other dpdk binaries build without
RM_FEATURE_ATOMICS,
i.e. not allowed to use stadd/swapl instructions, but we still want to
generate bpf binary code
that would use these instructions, correct?
If so, I wonder do we really want it, and if yes, then what for?
>
> Signed-off-by: Nick Hudson <nhudson@akamai.com>
> ---
> lib/bpf/bpf_jit_arm64.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/lib/bpf/bpf_jit_arm64.c b/lib/bpf/bpf_jit_arm64.c
> index 4b897dccb8..8e17c21e8f 100644
> --- a/lib/bpf/bpf_jit_arm64.c
> +++ b/lib/bpf/bpf_jit_arm64.c
> @@ -8,6 +8,7 @@
>
> #include <rte_common.h>
> #include <rte_byteorder.h>
> +#include <rte_cpuflags.h>
> #include <rte_debug.h>
>
> #include "bpf_impl.h"
> @@ -1031,15 +1032,14 @@ emit_stxr(struct a64_jit_ctx *ctx, bool is64, uint8_t rs, uint8_t rt,
> emit_insn(ctx, insn, check_reg(rs) || check_reg(rt) || check_reg(rn));
> }
>
> -static int
> +static bool
> has_atomics(void)
> {
> - int rc = 0;
> -
> #if defined(__ARM_FEATURE_ATOMICS) || defined(RTE_ARM_FEATURE_ATOMICS)
> - rc = 1;
> + return true;
> +#else
> + return rte_cpu_get_flag_enabled(RTE_CPUFLAG_ATOMICS) == 1;
> #endif
> - return rc;
> }
>
> static void
next prev parent reply other threads:[~2026-12-01 10:57 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 16:33 [PATCH 0/3] arm64: use LSE atomics when available Nick Hudson
2026-11-30 16:33 ` [PATCH 1/3] mailmap: add new contributor Nick Hudson
2026-11-30 16:33 ` [PATCH 2/3] eal: select 128-bit CAS by LSE support Nick Hudson
2026-11-30 16:33 ` [PATCH 3/3] bpf/arm64: detect atomics at build time or runtime Nick Hudson
2026-12-01 10:57 ` Konstantin Ananyev [this message]
2026-12-01 13:11 ` Hudson, Nick
2026-12-05 18:31 ` Marat Khalili
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=65025e7b-e69f-4483-93dd-3e689fc03554@yandex.ru \
--to=konstantin.v.ananyev@yandex.ru \
--cc=dev@dpdk.org \
--cc=konstantin.ananyev@huawei.com \
--cc=nhudson@akamai.com \
--cc=qm2k21@gmail.com \
--cc=wathsala.vithanage@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox