[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAJZ5v0j6xDeQhiqEmCu5sfDBcWx9BvPo=8fXUrN93Exx0p=LTw@mail.gmail.com>
Date: Thu, 25 Aug 2022 13:43:57 +0200
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: Peter Shier <pshier@...gle.com>
Cc: Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>,
"the arch/x86 maintainers" <x86@...nel.org>,
"H. Peter Anvin" <hpa@...or.com>,
Jacob Pan <jacob.jun.pan@...ux.intel.com>,
Len Brown <lenb@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Michael Roth <michael.roth@....com>,
Alexei Starovoitov <ast@...nel.org>,
Josh Poimboeuf <jpoimboe@...nel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Linux PM <linux-pm@...r.kernel.org>
Subject: Re: [PATCH v2] intel_idle: avoid tracing MSR writes while idling
On Thu, Aug 25, 2022 at 1:42 AM Peter Shier <pshier@...gle.com> wrote:
>
> With commit bf5835bcdb963 ("intel_idle: Disable IBRS during long idle"),
> enabling wrmsr trace with CONFIG_LOCKDEP causes "suspicious
> rcu_dereference_check() usage" warning because do_trace_write_msr does not
> use trace_write_msr_rcuidle.
>
> Change intel_idle_ibrs to use native_wrmsr to avoid tracing
>
> Sample warning:
> ============================
> WARNING: suspicious RCU usage
> 6.0.0-dbg-DEV #7 Tainted: G S O
> -----------------------------
> arch/x86/include/asm/msr-trace.h:48 suspicious rcu_dereference_check() usage!
>
> other info that might help us debug this:
>
> rcu_scheduler_active = 2, debug_locks = 1
> RCU used illegally from extended quiescent state!
> no locks held by swapper/59/0.
>
> stack backtrace:
> CPU: 59 PID: 0 Comm: swapper/59 Tainted: G S O 6.0.0-dbg-DEV #7
> Call Trace:
> dump_stack_lvl
> dump_stack
> lockdep_rcu_suspicious
> trace_write_msr
> do_trace_write_msr
> intel_idle_ibrs
> cpuidle_enter_state
> cpuidle_enter
> do_idle
> cpu_startup_entry
> start_secondary
> secondary_startup_64_no_verify
>
> Tested on skylake using:
> echo "msr:write_msr" >/sys/kernel/debug/tracing/set_event
> with and without patch.
>
> Signed-off-by: Peter Shier <pshier@...gle.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
> ---
>
> v2:
> - changed to avoid tracing
>
> v1: https://lore.kernel.org/all/20220823234353.937002-1-pshier@google.com/
>
> drivers/idle/intel_idle.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c
> index 3e101719689a..df129c73786f 100644
> --- a/drivers/idle/intel_idle.c
> +++ b/drivers/idle/intel_idle.c
> @@ -187,12 +187,12 @@ static __cpuidle int intel_idle_ibrs(struct cpuidle_device *dev,
> int ret;
>
> if (smt_active)
> - wrmsrl(MSR_IA32_SPEC_CTRL, 0);
> + native_wrmsr(MSR_IA32_SPEC_CTRL, 0);
>
> ret = __intel_idle(dev, drv, index);
>
> if (smt_active)
> - wrmsrl(MSR_IA32_SPEC_CTRL, spec_ctrl);
> + native_wrmsr(MSR_IA32_SPEC_CTRL, spec_ctrl);
>
> return ret;
> }
> --
Powered by blists - more mailing lists