Re: [RFC v2 1/3] PM: Add a sysfs files to represent sleep duration

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Nov 15, 2022 at 6:58 PM Limonciello, Mario
<mario.limonciello@xxxxxxx> wrote:
>
> On 11/15/2022 11:52, Rafael J. Wysocki wrote:
> > On Tue, Nov 15, 2022 at 6:27 PM Limonciello, Mario
> > <mario.limonciello@xxxxxxx> wrote:
> >>
> >> On 11/15/2022 11:20, Raul Rangel wrote:
> >>>
> >>>
> >>> On Tue, Nov 15, 2022 at 9:35 AM Rafael J. Wysocki <rafael@xxxxxxxxxx
> >>> <mailto:rafael@xxxxxxxxxx>> wrote:
> >>>
> >>>      On Tue, Nov 15, 2022 at 4:17 PM Limonciello, Mario
> >>>      <mario.limonciello@xxxxxxx <mailto:mario.limonciello@xxxxxxx>> wrote:
> >>>       >
> >>>       > On 11/15/2022 08:45, Rafael J. Wysocki wrote:
> >>>       > > On Thu, Nov 10, 2022 at 7:49 AM Mario Limonciello
> >>>       > > <mario.limonciello@xxxxxxx <mailto:mario.limonciello@xxxxxxx>>
> >>>      wrote:
> >>>       > >>
> >>>       > >> Both AMD and Intel SoCs have a concept of reporting whether
> >>>      the hardware
> >>>       > >> reached a hardware sleep state over s2idle as well as how much
> >>>       > >> time was spent in such a state.
> >>>       > >>
> >>>       > >> This information is valuable to both chip designers and system
> >>>      designers
> >>>       > >> as it helps to identify when there are problems with power
> >>>      consumption
> >>>       > >> over an s2idle cycle.
> >>>       > >>
> >>>       > >> To make the information discoverable, create a new sysfs file
> >>>      and a symbol
> >>>       > >> that drivers from supported manufacturers can use to advertise
> >>>      this
> >>>       > >> information. This file will only be exported when the system
> >>>      supports low
> >>>       > >> power idle in the ACPI table.
> >>>       > >>
> >>>       > >> In order to effectively use this information you will ideally
> >>>      want to
> >>>       > >> compare against the total duration of sleep, so export a
> >>>      second sysfs file
> >>>       > >> that will show total time. This file will be exported on all
> >>>      systems and
> >>>       > >> used both for s2idle and s3.
> >>>       > >
> >>>       > > Well, my first question would be how this is related to
> >>>       > >
> >>>       > > /sys/devices/system/cpu/cpuidle/low_power_idle_system_residency_us
> >>>       > >
> >>>       >
> >>>       > This has a dependency on the platform firmware offering an ACPI LPIT
> >>>       > table.  I don't know how common that is.
> >>>
> >>>      Required for running Windows with Modern Standby AFAICS.
> >>>
> >>>       > As this series started from the needs on ChromeOS I would ask is
> >>>      that typically populated by coreboot?
> >>>
> >>>      It should be, but I'd need to ask for confirmation.
> >>>
> >>>
> >>> It looks like Intel platforms have support for the LPIT table:
> >>> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsource.chromium.org%2Fchromiumos%2Fchromiumos%2Fcodesearch%2F%2B%2Fmain%3Asrc%2Fthird_party%2Fcoreboot%2Fsrc%2Fsoc%2Fintel%2Fcommon%2Fblock%2Facpi%2Flpit.c%3Fq%3Df%3ALPIT%2520f%3Acoreboot%26ss%3Dchromiumos&amp;data=05%7C01%7Cmario.limonciello%40amd.com%7C37e6dda56f924fe641f008dac7323c01%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C638041315852648377%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=PusftlebIMFtbaMy1XkBjHFMXLjdOzt7hA%2Fm3AM7v7A%3D&amp;reserved=0 <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsource.chromium.org%2Fchromiumos%2Fchromiumos%2Fcodesearch%2F%2B%2Fmain%3Asrc%2Fthird_party%2Fcoreboot%2Fsrc%2Fsoc%2Fintel%2Fcommon%2Fblock%2Facpi%2Flpit.c%3Fq%3Df%3ALPIT%2520f%3Acoreboot%26ss%3Dchromiumos&amp;data=05%7C01%7Cmario.limonciello%40amd.com%7C37e6dda56f924fe641f008dac7323c01%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C638041315852648377%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=PusftlebIMFtbaMy1XkBjHFMXLjdOzt7hA%2Fm3AM7v7A%3D&amp;reserved=0>
> >>>
> >>> For AMD, we had some patches to add _LPIL
> >>> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Freview.coreboot.org%2Fc%2Fcoreboot%2F%2B%2F52381%2F1&amp;data=05%7C01%7Cmario.limonciello%40amd.com%7C37e6dda56f924fe641f008dac7323c01%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C638041315852648377%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=gUYdMWZBNVALF8Xzhgswlyw9hCUv7LQ6eomz6gfIYrk%3D&amp;reserved=0
> >>> <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Freview.coreboot.org%2Fc%2Fcoreboot%2F%2B%2F52381%2F1&amp;data=05%7C01%7Cmario.limonciello%40amd.com%7C37e6dda56f924fe641f008dac7323c01%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C638041315852648377%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=gUYdMWZBNVALF8Xzhgswlyw9hCUv7LQ6eomz6gfIYrk%3D&amp;reserved=0>
> >>> They never got merged though. We could add an LPIT table to coreboot for
> >>> AMD platforms if necessary.
> >>
> >> _LPI I don't think makes a lot of sense on X86 today, which is why this
> >> was sent up:
> >> eb087f305919e ("ACPI: processor idle: Check for architectural support
> >> for LPI")
> >
> > Well, LPI has nothing to do with LPIT.  [I guess this could not be
> > even more confusing, but that's what you get in the world of 4-letter
> > TLAs.]
> >
> >> As for LPIT - I've never seen LPIT on AMD UEFI systems either.  I guess
> >> it's an Intel specific table?
> >
> > It used to be.  The spec is UEFI-hosted now.
> >
>
> Got it.
>
> >>>
> >>>       > I would hope it's the same number that is populated in that file on
> >>>       > supported systems though.
> >>>
> >>>      Well, which is exactly where I'm going.
> >>>
> >>>      Since there is one sysfs file for exposing this value already and it
> >>>      is used (for example, by sleepgraph), perhaps the way to go would be
> >>>      to extend this interface to systems that don't have LPIT instead of
> >>>      introducing a new one possibly exposing the same value?
> >>>
> >>
> >> Ah; so since Raul confirmed coreboot on Chrome exports that maybe we
> >> just need to add another way to populate that sysfs file for systems
> >> without LPIT (IE AMD).  I think that's a very good idea; thanks.
> >>
> >> I think we still probably want to have a way to get the total suspend
> >> time out programmatically though to compare to.  So perhaps the other
> >> sysfs file I had in the RFC v2 makes sense still.
> >
> > Well there are trace points to get that (sleepgraph uses these too),
> > see Documentation/trace/events-power.rst (and you can git grep for
> > "machine_suspend" to find where this comes from).
> >
> > I guess there could be a sysfs file in addition to them, but I'm not
> > sure if the extra overhead would be worth the benefit.
>
> At least the way that I envisioned this all working was that userspace
> software that wanted to could query some sysfs files and figure out a
> percentage of time spent.  If it was below a threshold users could be
> notified, or logs can be sent up to a server for analysis etc.
>
> Trace points would mean that userspace software like systemd and powerd
> would need to turn on the tracing every time to get the raw total
> numbers to do such a comparison.

Fair enough, but there are quite some considerations to be made here
regarding what exactly is included in the "total sleep time" and how
to compare that with the residency value (note: this needs to work
cross-platform).



[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux