[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJZ5v0g2+OVdFM-bUCOynNivUc4doxH=ukt9e9Z_nKpoZh6gPA@mail.gmail.com>
Date: Wed, 28 May 2025 16:25:19 +0200
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: Peter Zijlstra <peterz@...radead.org>
Cc: "Rafael J. Wysocki" <rafael@...nel.org>, "Rafael J. Wysocki" <rjw@...ysocki.net>,
x86 Maintainers <x86@...nel.org>, LKML <linux-kernel@...r.kernel.org>,
Linux PM <linux-pm@...r.kernel.org>, Len Brown <lenb@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>, Borislav Petkov <bp@...e.de>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Artem Bityutskiy <artem.bityutskiy@...ux.intel.com>,
"Gautham R. Shenoy" <gautham.shenoy@....com>, Ingo Molnar <mingo@...hat.com>,
Todd Brandt <todd.e.brandt@...ux.intel.com>
Subject: Re: [PATCH v1 0/2] x86/smp: Fix power regression introduced by commit 96040f7273e2
On Wed, May 28, 2025 at 3:45 PM Peter Zijlstra <peterz@...radead.org> wrote:
>
> On Wed, May 28, 2025 at 03:20:16PM +0200, Rafael J. Wysocki wrote:
> > On Wed, May 28, 2025 at 3:18 PM Peter Zijlstra <peterz@...radead.org> wrote:
> > >
> > > On Wed, May 28, 2025 at 02:53:13PM +0200, Rafael J. Wysocki wrote:
> > > > Hi Everyone,
> > > >
> > > > Commit 96040f7273e2 ("x86/smp: Eliminate mwait_play_dead_cpuid_hint()")
> > > > that shipped in 6.15 introduced a nasty power regression on systems that
> > > > start with "nosmt" in the kernel command line which prevents it from entering
> > > > deep package idle states (for instance, PC10) later on. Idle power, including
> > > > power in suspend-to-idle, goes up significantly on those systems as a result.
> > > >
> > > > Address this by reverting commit 96040f7273e2 (patch [1/2]) and using a
> > > > different approach, which is to retain mwait_play_dead_cpuid_hint() and
> > > > still prefer it to hlt_play_dead() in case it is needed when cpuidle is
> > > > not available, but prefer cpuidle_play_dead() to it by default (patch [2/2]).
> > >
> > > I don't understand. The revert says the reason it regresses is that it
> > > goes into play_dead before cpuidle is initialized. The fix is then to
> > > call cpuidle first.
> > >
> > > But if cpuidle isn't initialized yet, how does that fix anything?
> >
> > The revert fixes the bug.
>
> This is not what I asked.
>
> > The other patch does what the reverted commit was supposed to be
> > doing, but differently.
>
> No, it does not.
If cpuidle is available and works, it will do the same thing.
> The whole point was that mwait_play_dead did not DTRT because hints are
> stupid and it could not select the deepest C state in an unambiguous
> fashion.
Yes, on some systems.
> And now you're restoring that -- code you all argued was fundamentally
> buggered.
>
> Yes is 'fixes' things on old platforms, but it is equally broken on the
> new platforms where you all argued it was broken on. So either way
> around you're going to need to fix those, and this isn't it.
There are systems where mwait_play_dead_cpuid_hint() does not work and
there are systems where it works. Some of the latter are actually
new.
Regardless, if cpuidle_play_dead() runs before it and cpuidle is
there, the right thing will be done because cpuidle_play_dead() will
not return in that case.
The only question is what to do when cpuidle is not there.
The commit reverted by the first patch removed
mwait_play_dead_cpuid_hint() altogether, so it never runs and the only
fallback is hlt_play_dead(), but this doesn't work for disabling SMT
siblings.
If mwait_play_dead_cpuid_hint() is allowed to run before
hlt_play_dead() though, then worst-case it may use an unrecognized
MWAIT hint and the CPU should fall back to C1. If the MWAIT hint is
valid though, it will enter a deep idle state and that's what happens
on all of the systems tested in the lab (20+), including the most
recent ones.
> Now, SMT siblings are all AP, by definition. So can't we simply send
> them INIT instead of doing CLI;HLT, that way they drop into
> Wait-for-SIPI and the ucode can sort it out?
No, I don't think so. I don't think that Wait-for-SIPI is an idle state.
But we are discussing patch [2/2] here while really the problem is
that the commit in question is broken, so it needs to be reverted in
the first place.
Powered by blists - more mailing lists