• Srinivas Pandruvada's avatar
    cpufreq: intel_pstate: Adjust policy->max · 3be9200d
    Srinivas Pandruvada authored
    When policy->max is changed via _PPC or sysfs and is more than the max non
    turbo frequency, it does not really change resulting performance in some
    processors. When policy->max results in a P-State ratio more than the
    turbo activation ratio, then processor can choose any P-State up to max
    turbo. So the user or _PPC setting has no value, but this can cause
    undesirable side effects like:
    - Showing reduced max percentage in Intel P-State sysfs
    - It can cause reduced max performance under certain boundary conditions:
    The requested max scaling frequency either via _PPC or via cpufreq-sysfs,
    will be converted into a fixed floating point max percent scale. In
    majority of the cases this will result in correct max. But not 100% of the
    time. If the _PPC is requested at a point where the calculation lead to a
    lower max, this can result in a lower P-State then expected and it will
    impact performance.
    Example of this condition using a Broadwell laptop with config TDP.
    
    ACPI _PSS table from a Broadwell laptop
    2301000 2300000 2200000 2000000 1900000 1800000 1700000 1500000 1400000
    1300000 1100000 1000000 900000 800000 600000 500000
    
    The actual results by disabling config TDP so that we can get what is
    requested on or below 2300000Khz.
    
    scaling_max_freq        Max Requested P-State   Resultant scaling
    max
    ---------------------------------------- ----------------------
    2400000                 18                      2900000 (max
    turbo)
    2300000                 17                      2300000 (max
    physical non turbo)
    2200000                 15                      2100000
    2100000                 15                      2100000
    2000000                 13                      1900000
    1900000                 13                      1900000
    1800000                 12                      1800000
    1700000                 11                      1700000
    1600000                 10                      1600000
    1500000                 f                       1500000
    1400000                 e                       1400000
    1300000                 d                       1300000
    1200000                 c                       1200000
    1100000                 a                       1000000
    1000000                 a                       1000000
    900000                  9                        900000
    800000                  8                        800000
    700000                  7                        700000
    600000                  6                        600000
    500000                  5                        500000
    ------------------------------------------------------------------
    
    Now set the config TDP level 1 ratio as 0x0b (equivalent to 1100000KHz)
    in BIOS (not every system will let you adjust this).
    The turbo activation ratio will be set to one less than that, which will
    be 0x0a (So any request above 1000000KHz should result in turbo region
    assuming no thermal limits).
    Here _PPC will request max to 1100000KHz (which basically should still
    result in turbo as this is more than the turbo activation ratio up to
    max allowable turbo frequency), but actual calculation resulted in a max
    ceiling P-State which is 0x0a. So under any load condition, this driver
    will not request turbo P-States. This will be a huge performance hit.
    
    When config TDP feature is ON, if the _PPC points to a frequency above
    turbo activation ratio, the performance can still reach max turbo. In this
    case we don't need to treat this as the reduced frequency in set_policy
    callback.
    
    In this change when config TDP is active (by checking if the physical max
    non turbo ratio is more than the current max non turbo ratio), any request
    above current max non turbo is treated as full performance.
    Signed-off-by: default avatarSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
    [ rjw : Minor cleanups ]
    Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
    3be9200d
intel_pstate.c 45.9 KB