[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <3642cfd1-7da6-4a75-80b7-00c21ab6955f@app.fastmail.com>
Date: Tue, 28 Oct 2025 09:42:50 +0100
From: "Arnd Bergmann" <arnd@...db.de>
To: "Ankur Arora" <ankur.a.arora@...cle.com>, linux-kernel@...r.kernel.org,
Linux-Arch <linux-arch@...r.kernel.org>,
linux-arm-kernel@...ts.infradead.org, linux-pm@...r.kernel.org,
bpf@...r.kernel.org
Cc: "Catalin Marinas" <catalin.marinas@....com>,
"Will Deacon" <will@...nel.org>, "Peter Zijlstra" <peterz@...radead.org>,
"Andrew Morton" <akpm@...ux-foundation.org>,
"Mark Rutland" <mark.rutland@....com>,
"Haris Okanovic" <harisokn@...zon.com>,
"Christoph Lameter (Ampere)" <cl@...two.org>,
"Alexei Starovoitov" <ast@...nel.org>,
"Rafael J . Wysocki" <rafael@...nel.org>,
"Daniel Lezcano" <daniel.lezcano@...aro.org>,
"Kumar Kartikeya Dwivedi" <memxor@...il.com>, zhenglifeng1@...wei.com,
xueshuai@...ux.alibaba.com, "Joao Martins" <joao.m.martins@...cle.com>,
"Boris Ostrovsky" <boris.ostrovsky@...cle.com>,
"Konrad Rzeszutek Wilk" <konrad.wilk@...cle.com>
Subject: Re: [RESEND PATCH v7 2/7] arm64: barrier: Support
smp_cond_load_relaxed_timeout()
On Tue, Oct 28, 2025, at 06:31, Ankur Arora wrote:
> Support waiting in smp_cond_load_relaxed_timeout() via
> __cmpwait_relaxed(). Limit this to when the event-stream is enabled,
> to ensure that we wake from WFE periodically and don't block forever
> if there are no stores to the cacheline.
>
> In the unlikely event that the event-stream is unavailable, fallback
> to spin-waiting.
>
> Also set SMP_TIMEOUT_POLL_COUNT to 1 so we do the time-check for each
> iteration in smp_cond_load_relaxed_timeout().
After I looked at the entire series again, this one feels like
a missed opportunity. Especially on low-power systems but possibly
on any ARMv9.2+ implementation including Cortex-A320, it would
be nice to be able to both turn off the event stream and also
make this function take fewer wakeups:
> +/* Re-declared here to avoid include dependency. */
> +extern bool arch_timer_evtstrm_available(void);
> +
> +#define cpu_poll_relax(ptr, val) \
> +do { \
> + if (arch_timer_evtstrm_available()) \
> + __cmpwait_relaxed(ptr, val); \
> + else \
> + cpu_relax(); \
> +} while (0)
> +
Since the caller knows exactly how long it wants to wait for,
we should be able to fit a 'wfet' based primitive in here and
pass the timeout as another argument.
Arnd
Powered by blists - more mailing lists