ARM WFET application scenario consultation

Catalin Marinas catalin.marinas at arm.com
Mon Apr 12 13:46:37 BST 2021


On Mon, Apr 12, 2021 at 08:08:23PM +0800, yangwendong wrote:
> Recently, a new feature of WFE with timeouts has been added to ARMv8.
> I have some doubts about the application scenarios of this feature.
> 
> 1) Arm spec said that WFE or WFET can be used in spinlock. Since the
> thread using spinlock can't be sleep, if we use the wfet instruction, we
> can do nothing but wait when timeout,  so what's the difference between
> the two instructions in this scenario?

Not much point in using it it in a classic spinlock, unless you have
some specific implementation that's supposed to time out.

Note that we already enabled the event stream in Linux so that an event
is generated at 100KHz waking up any WFE. One reason we had for this was
some hardware errata where events between clusters were not generated.
Another was some small delays required in in certain user programs
without going through a kernel syscall, though not sure anyone's
actually using it.

> 2) Are there any other special scenarios where using wfet instructions
> can be beneficial ?

In the kernel we could replace our udelay loop with WFIT for example
(not WFET because of the event stream). As for user, we can expose a
HWCAP but it's up to user libraries to make use of it.

-- 
Catalin



More information about the linux-arm-kernel mailing list