[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20230622130853.GP4253@hirez.programming.kicks-ass.net>
Date: Thu, 22 Jun 2023 15:08:53 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Josh Poimboeuf <jpoimboe@...nel.org>
Cc: Waiman Long <longman@...hat.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>,
"H. Peter Anvin" <hpa@...or.com>,
Pawan Gupta <pawan.kumar.gupta@...ux.intel.com>,
Jacob Pan <jacob.jun.pan@...ux.intel.com>,
Len Brown <lenb@...nel.org>, linux-kernel@...r.kernel.org,
x86@...nel.org, linux-pm@...r.kernel.org,
Robin Jarry <rjarry@...hat.com>, Joe Mario <jmario@...hat.com>
Subject: Re: [PATCH v3 2/3] intel_idle: Sync up the SPEC_CTRL MSR value to
x86_spec_ctrl_current
On Thu, Jun 22, 2023 at 11:38:28AM +0200, Peter Zijlstra wrote:
> Both this and the play_dead case can't use update_spec_ctrl() because
> RCU isn't there anymore and all that is noinstr. Additionally, both
> sites rely on preemption being off already, where update_spec_ctrl()
> can't do that.
Oh, I might be wrong about the preemption thing; it doesn't make sense
to do wrmsr with preemption on, so it could be simpler.
> That said, I suppose one could write it like so:
>
> static __always_inline __update_spec_ctrl(u64 val)
> {
> __this_cpu_write(x86_spec_ctrl_current, val);
> native_wrmsrl(MSR_IA32_SPEC_CTRL, val);
> }
>
> static void update_spec_ctrl(u64 val)
> {
> preempt_disable();
> __update_spec_ctrl(val);
> preempt_enable();
> }
>
> And then you can use __update_spec_ctrl(). But that would need a wee
> audit of using native_wrmsrl() in all places, probably ok, IIRC Xen
> wasn't using our IBRS stuff anyway.
Powered by blists - more mailing lists