From: Nam Cao <namcao@linutronix.de>
To: "André Almeida" <andrealmeid@igalia.com>
Cc: "Alexandre Ghiti" <alex@ghiti.fr>,
"Paul Walmsley" <pjw@kernel.org>,
linux-kernel@vger.kernel.org,
"Palmer Dabbelt" <palmer@dabbelt.com>,
linux-riscv@lists.infradead.org,
"Albert Ou" <aou@eecs.berkeley.edu>,
"Thomas Weißschuh" <thomas.weissschuh@linutronix.de>,
"Mathieu Desnoyers" <mathieu.desnoyers@efficios.com>,
"Thomas Gleixner" <tglx@kernel.org>,
"Peter Zijlstra" <peterz@infradead.org>,
"Sebastian Andrzej Siewior" <bigeasy@linutronix.de>,
kernel-dev@igalia.com
Subject: Re: [PATCH 5/5] riscv: vdso: Implement __vdso_futex_robust_try_unlock()
Date: Wed, 08 Jul 2026 22:46:34 +0200 [thread overview]
Message-ID: <87pl0xdxat.fsf@yellow.woof> (raw)
In-Reply-To: <874ii9pfdk.fsf@yellow.woof>
Nam Cao <namcao@linutronix.de> writes:
> André Almeida <andrealmeid@igalia.com> writes:
>> So if the build has support for CAS, the function overwrite what it had
>> just set. Why do it even writes it in the first place then, can't this
>> be an if/else?
>
> Functionally speaking, an if/else makes more sense. However, I cannot
> figure out how to do that without creating a complete mess, since
> *_try_unlock_cs_cas_start and *_try_unlock_cs_cas_end are not always
> available. If you have a suggestion, please do let me know. But doing
> it this way only costs us a few more instructions.
Look at this again, we can do something like below. Let me send v3.
#if defined(CONFIG_RISCV_ISA_ZACAS) && defined(CONFIG_TOOLCHAIN_HAS_ZACAS)
#define FUTEX_CAS_SET_VDSO_CS_RANGE(vdso, fd, idx, xlen, symbol) \
{ \
void *start = symbol(vdso, CONCAT3(futex_list, xlen, _try_unlock_cs_cas_start)); \
void *end = symbol(vdso, CONCAT3(futex_list, xlen, _try_unlock_cs_cas_end)); \
\
futex_set_vdso_cs_range(fd, idx, (uintptr_t)start, (uintptr_t)end, xlen == 32); \
}
#else
#define FUTEX_CAS_SET_VDSO_CS_RANGE(...) BUILD_BUG()
#endif
#define FUTEX_LRSC_SET_VDSO_CS_RANGE(vdso, fd, idx, xlen, symbol) \
{ \
void *start = symbol(vdso, CONCAT3(futex_list, xlen, _try_unlock_cs_lrsc_start)); \
void *end = symbol(vdso, CONCAT3(futex_list, xlen, _try_unlock_cs_lrsc_end)); \
\
futex_set_vdso_cs_range(fd, idx, (uintptr_t)start, (uintptr_t)end, xlen == 32); \
}
#define FUTEX_SET_VDSO_CS_RANGE(vdso, fd, idx, xlen, symbol) \
{ \
if (cpu_supports_zacas()) { \
FUTEX_CAS_SET_VDSO_CS_RANGE(vdso, fd, idx, xlen, symbol); \
} else { \
FUTEX_LRSC_SET_VDSO_CS_RANGE(vdso, fd, idx, xlen, symbol); \
} \
}
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
prev parent reply other threads:[~2026-07-08 20:46 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-19 14:11 [PATCH 0/5] riscv: vdso: Implement __vdso_futex_robust_try_unlock() Nam Cao
2026-06-19 14:11 ` [PATCH 1/5] riscv: compat_vdso: switch to standard kbuild rule Nam Cao
2026-06-19 14:11 ` [PATCH 2/5] riscv: compat_vdso: Allow *.c source files Nam Cao
2026-06-19 14:11 ` [PATCH 3/5] riscv: compat_vdso: Introduce COMPAT_MARCH variable Nam Cao
2026-06-19 14:11 ` [PATCH 4/5] riscv: compat_vdso: Build with zacas if available Nam Cao
2026-06-19 14:11 ` [PATCH 5/5] riscv: vdso: Implement __vdso_futex_robust_try_unlock() Nam Cao
2026-06-30 12:11 ` Thomas Weißschuh
2026-07-08 16:22 ` André Almeida
2026-07-08 17:20 ` Nam Cao
2026-07-08 20:46 ` Nam Cao [this message]
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=87pl0xdxat.fsf@yellow.woof \
--to=namcao@linutronix.de \
--cc=alex@ghiti.fr \
--cc=andrealmeid@igalia.com \
--cc=aou@eecs.berkeley.edu \
--cc=bigeasy@linutronix.de \
--cc=kernel-dev@igalia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=palmer@dabbelt.com \
--cc=peterz@infradead.org \
--cc=pjw@kernel.org \
--cc=tglx@kernel.org \
--cc=thomas.weissschuh@linutronix.de \
/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