Re: [PATCH v2 4/8] x86/spec_ctrl: Add sysctl knobs to enable/disable SPEC_CTRL feature

From: Tim Chen
Date: Sat Jan 06 2018 - 13:23:15 EST




On 01/06/2018 09:33 AM, Dave Hansen wrote:
> On 01/06/2018 06:41 AM, Konrad Rzeszutek Wilk wrote:
>>> .macro DISABLE_IBRS
>>> - ALTERNATIVE "jmp .Lskip_\@", "", X86_FEATURE_SPEC_CTRL
>>> + testl $1, dynamic_ibrs
>> On every system call we end up hammering on this 'dynamic_ibrs'
>> variable. And it looks like it can be flipped via the IPI mechanism.
>>
>> Would it make sense for this to be per-cpu?
>
> It's probably better to either just make it __read_mostly or get the
> static branches that folks were suggesting actually working.
>

dynamic_ibrs is indeed declared __read_mostly

+unsigned int dynamic_ibrs __read_mostly;
+EXPORT_SYMBOL_GPL(dynamic_ibrs);

Tim