Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add initial support for DPTF adaptive performance policy #224

Closed
wants to merge 45 commits into from

Commits on Apr 13, 2020

  1. Don't hardcode the UUID for INT3400

    Different thermal policies require different UUIDs to be written to the
    INT3400 interface. Avoid hardcoding that and allow engines to override it
    as needed.
    mjg59 committed Apr 13, 2020
    Configuration menu
    Copy the full SHA
    57b9e52 View commit details
    Browse the repository at this point in the history
  2. Allow the XML parser to be disabled

    Systems may provide the DPTF policy information in an ACPI table. Allow
    that to be used directly, and disable parsing of XML config to avoid
    confusion.
    mjg59 committed Apr 13, 2020
    Configuration menu
    Copy the full SHA
    b5fd0d6 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    81e76d4 View commit details
    Browse the repository at this point in the history
  4. Improve handling of large binary sysfs files

    If we're going to read a binary sysfs file, we want to know how big it is
    in advance. Add a helper to do that. In addition, add support for reading
    files greater than a single page.
    mjg59 committed Apr 13, 2020
    Configuration menu
    Copy the full SHA
    68ecc48 View commit details
    Browse the repository at this point in the history
  5. Abstract get_ppcc_values

    We can obtain PPCC parameters from the firmware, so abstract that rather
    than calling directly into the XML parser code.
    mjg59 committed Apr 13, 2020
    Configuration menu
    Copy the full SHA
    1806ba0 View commit details
    Browse the repository at this point in the history
  6. Add support for passing adaptive target information to devices

    The adaptive target tables may include information targeted at specific
    device types. Add core support for passing that through to the cooling
    devices.
    mjg59 committed Apr 13, 2020
    Configuration menu
    Copy the full SHA
    6f1a3f2 View commit details
    Browse the repository at this point in the history
  7. Allow the DRAM RAPL device to use PPCC

    Firmware may provide multiple PPCC entries, including one for DRAM. Try to
    use it if we can, but fix up the XML parser to it makes sure that we don't
    break existing setups.
    mjg59 committed Apr 13, 2020
    Configuration menu
    Copy the full SHA
    cf256d6 View commit details
    Browse the repository at this point in the history
  8. Add an adaptive target callback into RAPL code

    Add support for setting RAPL parameters based on adaptive targets.
    Incomplete at present.
    mjg59 committed Apr 13, 2020
    Configuration menu
    Copy the full SHA
    e5e10a6 View commit details
    Browse the repository at this point in the history
  9. Allow engines to force the use of MMIO for RAPL

    In adaptive mode we prefer the use of the MMIO RAPL interface if available.
    mjg59 committed Apr 13, 2020
    Configuration menu
    Copy the full SHA
    c7794ac View commit details
    Browse the repository at this point in the history
  10. Make thd_engine_start() virtual

    We want engines to be able to override this.
    mjg59 committed Apr 13, 2020
    Configuration menu
    Copy the full SHA
    ffa7c93 View commit details
    Browse the repository at this point in the history
  11. Call into engines to update their state

    This is something of a hack right now (it should be event driven rather
    than polling), but we need to update the adaptive engine state to check
    whether we should transition to a new target.
    mjg59 committed Apr 13, 2020
    Configuration menu
    Copy the full SHA
    84632fc View commit details
    Browse the repository at this point in the history
  12. Enable and disable the INT3400 thermal zone

    The firmware doesn't pay attention to the configured UUID in the INT3400
    device until _OSC is called, and this only happens when we enable the
    associated thermal zone. Make sure we do so, and disable it again on exit.
    mjg59 committed Apr 13, 2020
    Configuration menu
    Copy the full SHA
    bd0a77a View commit details
    Browse the repository at this point in the history
  13. Add basic support for the DPTM adaptive power policy

    DPTM provides an adaptive power policy that allows for improved integration
    between the platform and the OS. Firmware can provide a set of complex
    conditions to the OS, and an OS agent (in this case thermal_daemon) is
    responsible for evaluating them, potentially making use of information that
    is easily available to the OS and not the firmware. The agent evaluates
    each set of conditions in turn, and once the first evaluates completely it
    triggers a set of actions.
    
    This implementation only covers a subset of the conditions - notably, it
    only currently handles conditions that are associated with OEM-specific
    variables exported via ACPI. It is also only currently capable of managing
    RAPL targets or loading new passive thermal policies, since that's all that
    my test system does.
    mjg59 committed Apr 13, 2020
    Configuration menu
    Copy the full SHA
    c31212c View commit details
    Browse the repository at this point in the history
  14. Add adaptive option

    Add a command line option to enable the use of the adaptive engine.
    mjg59 committed Apr 13, 2020
    Configuration menu
    Copy the full SHA
    ae2c0c7 View commit details
    Browse the repository at this point in the history
  15. Add necessary kernel patches

    mjg59 committed Apr 13, 2020
    Configuration menu
    Copy the full SHA
    e19ccf7 View commit details
    Browse the repository at this point in the history
  16. Configuration menu
    Copy the full SHA
    91cef64 View commit details
    Browse the repository at this point in the history
  17. Handle compressed GDDV payloads

    GDDV payloads can be compressed using LZMA. Add support for handling that.
    mjg59 committed Apr 13, 2020
    Configuration menu
    Copy the full SHA
    96af722 View commit details
    Browse the repository at this point in the history
  18. Harden PTTV parsing

    PTTV entries may have a uint64 rather than a string for the target argument,
    so make sure we handle that and also deal with cases where we have multiple
    PSVTs in the parent object rather than in the shared space by passing
    through a unique name.
    mjg59 committed Apr 13, 2020
    Configuration menu
    Copy the full SHA
    a9f91cc View commit details
    Browse the repository at this point in the history
  19. Fix offsets in APCT V2 table calculations

    Skipping a uint64 requires also skipping the type defintion, so fix up the
    offset calculations.
    mjg59 committed Apr 13, 2020
    Configuration menu
    Copy the full SHA
    fce2afd View commit details
    Browse the repository at this point in the history
  20. Don't make assumptions about key formatting

    We're not going to do anything with this data right now, so if it's not
    something we can parse, bail.
    mjg59 committed Apr 13, 2020
    Configuration menu
    Copy the full SHA
    5aab3b1 View commit details
    Browse the repository at this point in the history
  21. Don't crash out as soon as hitting an unsupported condition.

    This changes both the fatal into an error, and the loop to report _all_
    unsupported conditions at once.
    
    It should make it easier to gauge how much work is neded to support a
    certain firmware.
    Flameeyes authored and mjg59 committed Apr 13, 2020
    Configuration menu
    Copy the full SHA
    d3ccd5e View commit details
    Browse the repository at this point in the history
  22. Add support for APPC-based conditions

    Some systems use APPC to provide additional information associated with
    conditions. Parse that and then merge it into our conditions.
    mjg59 committed Apr 13, 2020
    Configuration menu
    Copy the full SHA
    1d61fba View commit details
    Browse the repository at this point in the history
  23. Fix up some more incorrect offset calculations

    Doing it this way was a bad idea, but here we are.
    mjg59 committed Apr 13, 2020
    Configuration menu
    Copy the full SHA
    2b712a4 View commit details
    Browse the repository at this point in the history
  24. Harden APAT parsing

    Make sure we don't inappropriately walk off the end of the APAT table.
    mjg59 committed Apr 13, 2020
    Configuration menu
    Copy the full SHA
    04df288 View commit details
    Browse the repository at this point in the history
  25. Handle multi-entry PSVT tables

    PSVT tables may contain multiple passive trip points. Add support for that.
    mjg59 committed Apr 13, 2020
    Configuration menu
    Copy the full SHA
    0bf7e22 View commit details
    Browse the repository at this point in the history
  26. Add support for temperature comparisons

    Add rough support for temperature comparisons. Right now this ignores
    hysteresis.
    mjg59 committed Apr 13, 2020
    Configuration menu
    Copy the full SHA
    1a5893f View commit details
    Browse the repository at this point in the history
  27. Harden against malformed APPC tables

    If the APPC doesn't have anything that looks like a legitimate version
    number at the start, ignore it.
    mjg59 committed Apr 13, 2020
    Configuration menu
    Copy the full SHA
    8636b66 View commit details
    Browse the repository at this point in the history
  28. Add support for reading lid state

    This relies on upower, so add a dependency on that as well.
    mjg59 committed Apr 13, 2020
    Configuration menu
    Copy the full SHA
    6fa65f9 View commit details
    Browse the repository at this point in the history
  29. Add power source condition

    Add support for conditions that depend on whether the system is on AC or not
    mjg59 committed Apr 13, 2020
    Configuration menu
    Copy the full SHA
    4c6386c View commit details
    Browse the repository at this point in the history
  30. Add stub workload condition handler

    Add a handler to report that the workload is bursty at all times - we don't
    currently have a good way to report something meaningful here.
    mjg59 committed Apr 13, 2020
    Configuration menu
    Copy the full SHA
    c9556ed View commit details
    Browse the repository at this point in the history
  31. Add support for platform type

    Requires that the platform provide a SW_TABLET_MODE switch, so this may not
    be reliable.
    mjg59 committed Apr 13, 2020
    Configuration menu
    Copy the full SHA
    bb94fda View commit details
    Browse the repository at this point in the history
  32. Add missing build dependencies

    SkUrRiEr authored and mjg59 committed Apr 13, 2020
    Configuration menu
    Copy the full SHA
    3e354b8 View commit details
    Browse the repository at this point in the history
  33. Fix build dependencies

    mjg59 committed Apr 13, 2020
    Configuration menu
    Copy the full SHA
    bb75239 View commit details
    Browse the repository at this point in the history

Commits on Apr 14, 2020

  1. Fix valgrind complaints

    Fix the free()ing of arrays allocated with new, and notice that we've hit
    the end of the data vault and are starting a new (currently unused) entry
    and avoid misparsing it.
    mjg59 committed Apr 14, 2020
    Configuration menu
    Copy the full SHA
    efd9261 View commit details
    Browse the repository at this point in the history
  2. Remove trailing _ from zone names

    Names are padded out to four characters using trailing _ characters, but
    device names aren't padded. Trim the trailing characters so we can match
    more easily.
    mjg59 committed Apr 14, 2020
    Configuration menu
    Copy the full SHA
    3cc5e95 View commit details
    Browse the repository at this point in the history
  3. Don't try to match supported UUIDs if the firmware doesn't give us data

    Current Intel platforms don't appear to provide supported UUIDs via ACPI,
    only via the data vault. Since we're not parsing that in-kernel, just
    assume it matches for now.
    mjg59 committed Apr 14, 2020
    Configuration menu
    Copy the full SHA
    8f096ea View commit details
    Browse the repository at this point in the history
  4. Remove TMEM zone hack

    I can't find any supporting evidence for special casing the TMEM zone to
    use dram RAPL rather than the CPU package, and there are machines with TMEM
    zones that don't have dram RAPL, so remove it for now.
    mjg59 committed Apr 14, 2020
    Configuration menu
    Copy the full SHA
    4900993 View commit details
    Browse the repository at this point in the history
  5. Add support for setting the TCC offset

    This should reduce CPU-based thermal throttling
    mjg59 committed Apr 14, 2020
    Configuration menu
    Copy the full SHA
    9db0434 View commit details
    Browse the repository at this point in the history

Commits on Apr 15, 2020

  1. Configure RAPL more correctly

    It seems like the PL1MAX target is intended to raise the maximum RAPL limit
    rather than to immediately change the limit - this is supported by various
    laptops that set PL1MAX and also set PL1PowerLimit in the same table,
    presumably to allow a gradual ramping up to avoid immediately crossing
    other trip points.
    mjg59 committed Apr 15, 2020
    Configuration menu
    Copy the full SHA
    030b538 View commit details
    Browse the repository at this point in the history
  2. Enforce RAPL limits immediately

    If the current state is outside the new RAPL limits, clamp it to the limit.
    mjg59 committed Apr 15, 2020
    Configuration menu
    Copy the full SHA
    f3c9e03 View commit details
    Browse the repository at this point in the history

Commits on Apr 16, 2020

  1. Set PL2 configuration

    Add support for statically updating the PL2 configuration when requested.
    mjg59 committed Apr 16, 2020
    Configuration menu
    Copy the full SHA
    fb0350f View commit details
    Browse the repository at this point in the history
  2. Add support for conditions with time constraints

    Conditions can specify that a condition must have held for more than or less
    than a given period of time. Add support for that.
    mjg59 committed Apr 16, 2020
    Configuration menu
    Copy the full SHA
    3270db5 View commit details
    Browse the repository at this point in the history
  3. Add support for setting passive trip points

    The PSV action appears to indicate that the passive trip point for the
    associated device should be updated, so try doing that.
    mjg59 committed Apr 16, 2020
    Configuration menu
    Copy the full SHA
    af56d7f View commit details
    Browse the repository at this point in the history

Commits on Apr 19, 2020

  1. Fix RAPL sysfs detection

    Clear the temporary string stream before testing each sysfs entry, to
    test the correct entry names.
    
    Ensure that pl2_index is set, rather than using uninitialized memory
    when the short_term window isn't found.
    saleemrashid authored and mjg59 committed Apr 19, 2020
    Configuration menu
    Copy the full SHA
    e140a95 View commit details
    Browse the repository at this point in the history

Commits on Apr 26, 2020

  1. Add some missing condition enum entries

    We were out of sync for higher conditions, which caused misinterpretation
    of legitimate values.
    mjg59 committed Apr 26, 2020
    Configuration menu
    Copy the full SHA
    05493d3 View commit details
    Browse the repository at this point in the history