[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAP01T75B-UjoKugBsCHnfjwMmL5Bdfs+-YK3QH7mLUJs0+mmCA@mail.gmail.com>
Date: Thu, 6 Feb 2025 11:57:21 +0100
From: Kumar Kartikeya Dwivedi <memxor@...il.com>
To: Ankur Arora <ankur.a.arora@...cle.com>
Cc: bpf <bpf@...r.kernel.org>, Alexei Starovoitov <ast@...nel.org>, linux-kernel@...r.kernel.org,
linux-arch@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
arnd@...db.de, catalin.marinas@....com, will@...nel.org, peterz@...radead.org,
mark.rutland@....com, harisokn@...zon.com, cl@...two.org,
zhenglifeng1@...wei.com, joao.m.martins@...cle.com,
boris.ostrovsky@...cle.com, konrad.wilk@...cle.com
Subject: Re: [PATCH 0/4] barrier: Introduce smp_cond_load_*_timeout()
On Mon, 3 Feb 2025 at 22:49, Ankur Arora <ankur.a.arora@...cle.com> wrote:
>
> Hi,
>
> This series adds waited variants of the smp_cond_load() primitives:
> smp_cond_load_relaxed_timewait(), and smp_cond_load_acquire_timewait().
>
> There are two known users for these interfaces:
>
> - poll_idle() [1]
> - resilient queued spinlocks [2]
>
> For both of these cases we want to wait on a condition but also want
> to terminate the wait at some point.
>
> Now, in theory, that can be worked around by making the time check a
> part of the conditional expression provided to smp_cond_load_*():
>
> smp_cond_load_relaxed(&cvar, !VAL || time_check());
>
> That approach, however, runs into two problems:
>
> - smp_cond_load_*() only allow waiting on a condition: this might
> be okay when we are synchronously spin-waiting on the condition,
> but not on architectures where are actually waiting for a store
> to a cacheline.
>
> - this semantic problem becomes a real problem on arm64 if the
> event-stream is disabled. That means that there will be no
> asynchronous event (the event-stream) that periodically wakes
> the waiter, which might lead to an interminable wait if VAL is
> never written to.
>
> This series extends the smp_cond_load_*() interfaces by adding two
> arguments: a time-check expression and its associated time limit.
> This is sufficient to allow for both a synchronously waited
> implementation (like the generic cpu_relax() based loop), or one
> where the CPU waits for a store to a cacheline with an out-of-band
> timer.
>
> Any comments appreciated!
>
Thanks for splitting this and sending it out.
+cc bpf@ for visibility (please keep it in cc for subsequent versions).
>
> [...]
Powered by blists - more mailing lists