Re: [RFC PATCH 23/23] x86/process: Reset hardware history in context switch

From: Ricardo Neri
Date: Mon Oct 03 2022 - 19:01:48 EST


On Tue, Sep 27, 2022 at 02:52:24PM +0200, Peter Zijlstra wrote:
> On Fri, Sep 09, 2022 at 04:12:05PM -0700, Ricardo Neri wrote:
>
> > +void reset_hardware_history(void)
> > +{
> > + if (!static_cpu_has(X86_FEATURE_HRESET))
> > + return;

If I used cpu_feature_enabled(X86_FEATURE_ITD) along with the CONFIG_HFI_
THERMAL and its corresponding DISABLE_MASK bit the code below would be
compiled out.

> > +
> > + asm volatile("mov %0, %%eax;" __ASM_HRESET "\n" : :
> > + "r" (hardware_history_features) : "%rax");
> > +}
>
> asm_inline volatile (ALTERNATIVE("", __ASM_HRESET, X86_FEATURE_HRESET)
> : : "a" (hardware_history_features) : "memory");

Do you still prefer have implemented as an ALTERNATIVE?

Thanks and BR,
Ricardo
>