Re: [PATCH v3 2/3] x86/smp native_play_dead: Prefer cpuidle_play_dead() over mwait_play_dead()
From: Peter Zijlstra
Date: Fri Nov 15 2024 - 05:11:18 EST
On Thu, Nov 14, 2024 at 10:54:15PM +0530, Gautham R. Shenoy wrote:
> Hello Peter,
>
> On Thu, Nov 14, 2024 at 12:58:31PM +0100, Peter Zijlstra wrote:
> > On Wed, Nov 13, 2024 at 05:11:38PM +0530, Gautham R. Shenoy wrote:
> >
> > > AMD platforms won't be using FFH based states for offlined CPUs. We
> > > prefer IO based states when available, and HLT otherwise.
> > >
> > > >
> > > > Robustly we'd teach the ACPI driver about FFh and set enter_dead on
> > > > every state -- but we'd have to double check that with AMD.
> > >
> > > Works for us as long as those FFh states aren't used for play_dead on
> > > AMD platforms.
> >
> > AFAIU AMD doesn't want to use MWAIT -- ever, not only for offline.
> > Confirm?
> >
>
> AMD wants to use MWAIT for cpuidle and it does use MWAIT based C1
> state on both client and server parts.
>
> Eg: On my server box
>
> $ cpupower idle-info | grep "FFH" -B1 -A3
> C1:
> Flags/Description: ACPI FFH MWAIT 0x0
> Latency: 1
> Usage: 6591
> Duration: 1482606
>
> > But if it were to use MWAIT for regular idle, then surely it's OK for
> > offline too, right?
>
> I tried this out today and there is no functional issue.
>
> However, I would like to run some experiments on whether HLT provides
> better power savings than MWAIT C1 with CPUs offlined. I will get back
> with this information tomorrow.
Right, but in most cases you'll have C2/C3 with io ports specified and
those will be picked for play_dead anyway. It's just the exceptionally
weird BIOS case where you'll have C2/C3 as FFh -- because random BIOS
person was on drugs that day or something like that.
Anyway, what I'm trying to say is that you'll probably fine without
adding a bunch of if (AMD|HYGON) logic -- the less of that we have, the
better, etc..