Re: [PATCH v2 00/10] arm64: Add initial support for FEAT_WFxT

Marc Zyngier
2022-04-20T18:50:36Z

On Wed, 20 Apr 2022 18:24:31 +0100,
Catalin Marinas <catalin.marinas@arm.com> wrote:
>
> On Tue, Apr 19, 2022 at 07:27:45PM +0100, Marc Zyngier wrote:
> > A potential addition to this series would be to remove the event
> > generation from the counters, and rely on the timeout where it
> > matters (spinlocks?). Feedback welcome.
>
> I think we still need to keep the event generation around, at least for
> hardware bugs we don't know about. I don't think user-space rely on it
> though, people tend to come up with weird delays like isb ;). But yes,
> the WFET should be handy when it turns up in hardware.

My hope was that the trick of using the event generation to work
around systems failing to broadcast events could become a thing of the
past when WFET is present in the HW. After all, they serve the same
purpose (generate a local event to un-wedge the CPU).

But the more I look at it, the more I hate the potential solution. One
of the issues is that WFxT takes an absolute deadline, rather than a
relative one. So you end up with things like:

ISB
MRS x0, CNTVCT_EL0
ADD x0, x0, #some_small_value
WFET x0

which is really heavy handed for the slow path of an atomic operation.
Even if you have ECV and CNTVCTSS_EL0 (which allows you to get rid of
the ISB), it is a royal pain.

It would be much better if there was a *relative* version of WFET that
would directly take a timeout relative to the current virtual count,
but I can sense HW designers calling me names already, so I'll shut
up.

M.

--
Without deviation from the norm, progress is not possible.