02 Nov, 2015

3 commits

  • * pm-opp:
    PM / OPP: passing NULL to PTR_ERR()
    PM / OPP: Move cpu specific code to opp/cpu.c
    PM / OPP: Move opp core to its own directory
    PM / OPP: Prefix exported opp routines with dev_pm_opp_
    PM / OPP: Rename opp init/free table routines
    PM / OPP: reuse of_parse_phandle()

    Rafael J. Wysocki
     
  • * pm-cpufreq:
    cpufreq: postfix policy directory with the first CPU in related_cpus
    cpufreq: create cpu/cpufreq/policyX directories
    cpufreq: remove cpufreq_sysfs_{create|remove}_file()
    cpufreq: create cpu/cpufreq at boot time
    cpufreq: Use cpumask_copy instead of cpumask_or to copy a mask
    cpufreq: ondemand: Drop unnecessary locks from update_sampling_rate()
    cpufreq: intel_pstate: Fix intel_pstate powersave min_perf_pct value
    cpufreq: intel_pstate: Avoid calculation for max/min
    Documentation: kernel_parameters for Intel P state driver
    cpufreq: intel_pstate: Use ACPI perf configuration
    cpufreq: intel-pstate: Use separate max pstate for scaling
    cpufreq: intel_pstate: get P1 from TAR when available
    cpufreq: Drop redundant check for inactive policies
    cpufreq : powernv: Report Pmax throttling if capped below nominal frequency
    cpufreq: imx: update the clock switch flow to support imx6ul
    cpufreq: tegra20: remove superfluous CONFIG_PM ifdefs
    cpufreq: conservative: remove 'enable' field
    cpufreq: integrator: Fix module autoload for OF platform driver

    * pm-cpuidle:
    cpuidle: mvebu: disable the bind/unbind attributes and use builtin_platform_driver
    cpuidle: mvebu: clean up multiple platform drivers

    Rafael J. Wysocki
     
  • * acpi-processor:
    ACPI / CPPC: Fix potential memory leak
    ACPI / CPPC: signedness bug in register_pcc_channel()
    ACPI: Allow selection of the ACPI processor driver for ARM64
    CPPC: Probe for CPPC tables for each ACPI Processor object
    ACPI: Add weak routines for ACPI CPU Hotplug
    ACPI / CPPC: Add a CPUFreq driver for use with CPPC
    ACPI: Introduce CPU performance controls using CPPC

    Rafael J. Wysocki
     

28 Oct, 2015

6 commits

  • The sysfs policy directory is postfixed currently with the CPU number
    for which the policy was created, which isn't necessarily the first CPU
    in related_cpus mask.

    To make it more consistent and predictable, lets postfix the policy with
    the first cpu in related-cpus mask.

    Suggested-by: Saravana Kannan
    Signed-off-by: Viresh Kumar
    Reviewed-by: Saravana Kannan
    Signed-off-by: Rafael J. Wysocki

    Viresh Kumar
     
  • The cpufreq sysfs interface had been a bit inconsistent as one of the
    CPUs for a policy had a real directory within its sysfs 'cpuX' directory
    and all other CPUs had links to it. That also made the code a bit
    complex as we need to take care of moving the sysfs directory if the CPU
    containing the real directory is getting physically hot-unplugged.

    Solve this by creating 'policyX' directories (per-policy) in
    /sys/devices/system/cpu/cpufreq/ directory, where X is the CPU for which
    the policy was first created.

    This also removes the need of keeping kobj_cpu and we can remove it now.

    Suggested-by: Saravana Kannan
    Signed-off-by: Viresh Kumar
    Reviewed-by: Saravana Kannan
    Acked-by: is more of a general agreement from the person that he is
    Reviewed-by: is a more strict tag and implies that the reviewer has
    Signed-off-by: Rafael J. Wysocki

    Viresh Kumar
     
  • They don't do anything special now, remove the unnecessary wrapper.

    Reviewed-by: Saravana Kannan
    Signed-off-by: Viresh Kumar
    Signed-off-by: Rafael J. Wysocki

    Viresh Kumar
     
  • Later patches will need to create policy specific directories in
    /sys/devices/system/cpu/cpufreq/ directory and so the cpufreq directory
    wouldn't be ever empty.

    And so no fun creating/destroying it on need basis anymore. Create it
    once on system boot.

    Reviewed-by: Saravana Kannan
    Signed-off-by: Viresh Kumar
    Signed-off-by: Rafael J. Wysocki

    Viresh Kumar
     
  • ->related_cpus is empty at this point of time and copying ->cpus to it
    or orring ->related_cpus with ->cpus would result in the same value. But
    cpumask_copy makes it rather clear.

    Reviewed-by: Saravana Kannan
    Signed-off-by: Viresh Kumar
    Signed-off-by: Rafael J. Wysocki

    Viresh Kumar
     
  • 'timer_mutex' is required to sync work-handlers of policy->cpus.
    update_sampling_rate() is just canceling the works and queuing them
    again. This isn't protecting anything at all in update_sampling_rate()
    and is not gonna be of any use.

    Even if a work-handler is already running for a CPU,
    cancel_delayed_work_sync() will wait for it to finish.

    Drop these unnecessary locks.

    Reviewed-by: Preeti U Murthy
    Signed-off-by: Viresh Kumar
    Signed-off-by: Rafael J. Wysocki

    Viresh Kumar
     

17 Oct, 2015

2 commits

  • On systems that initialize the intel_pstate driver with the performance
    governor, and then switch to the powersave governor will not transition to
    lower cpu frequencies until /sys/devices/system/cpu/intel_pstate/min_perf_pct
    is set to a low value.

    The behavior of governor switching changed after commit a04759924e25
    ("[cpufreq] intel_pstate: honor user space min_perf_pct override on
    resume"). The commit introduced tracking of performance percentage
    changes via sysfs in order to restore userspace changes during
    suspend/resume. The problem occurs because the global values of the newly
    introduced max_sysfs_pct and min_sysfs_pct are not lowered on the governor
    change and this causes the powersave governor to inherit the performance
    governor's settings.

    A simple change would have been to reset max_sysfs_pct to 100 and
    min_sysfs_pct to 0 on a governor change, which fixes the problem with
    governor switching. However, since we cannot break userspace[1] the fix
    is now to give each governor its own limits storage area so that governor
    specific changes are tracked.

    I successfully tested this by booting with both the performance governor
    and the powersave governor by default, and switching between the two
    governors (while monitoring /sys/devices/system/cpu/intel_pstate/ values,
    and looking at the output of cpupower frequency-info). Suspend/Resume
    testing was performed by Doug Smythies.

    [1] Systems which suspend/resume using the unmaintained pm-utils package
    will always transition to the performance governor before the suspend and
    after the resume. This means a system using the powersave governor will
    go from powersave to performance, then suspend/resume, performance to
    powersave. The simple change during governor changes would have been
    overwritten when the governor changed before and after the suspend/resume.
    I have submitted https://bugzilla.redhat.com/show_bug.cgi?id=1271225
    against Fedora to remove the 94cpufreq file that causes the problem. It
    should be noted that pm-utils is obsoleted with newer versions of systemd.

    Signed-off-by: Prarit Bhargava
    Acked-by: Kristen Carlson Accardi
    Signed-off-by: Rafael J. Wysocki

    Prarit Bhargava
     
  • Rafael J. Wysocki
     

16 Oct, 2015

1 commit

  • This is a workaround for KNL platform, where in some cases MPERF counter
    will not have updated value before next read of MSR_IA32_MPERF. In this
    case divide by zero will occur. This change ignores current sample for
    busy calculation in this case.

    Fixes: b34ef932d79a (intel_pstate: Knights Landing support)
    Signed-off-by: Srinivas Pandruvada
    Acked-by: Kristen Carlson Accardi
    Cc: 4.1+ # 4.1+
    Signed-off-by: Rafael J. Wysocki

    Srinivas Pandruvada
     

15 Oct, 2015

4 commits

  • When requested from cpufreq to set policy, look into _pss and get
    control values, instead of using max/min perf calculations. These
    calculation misses next control state in boundary conditions.

    Signed-off-by: Srinivas Pandruvada
    Acked-by: Kristen Carlson Accardi
    Signed-off-by: Rafael J. Wysocki

    Srinivas Pandruvada
     
  • Use ACPI _PSS to limit the Intel P State turbo, max and min ratios.
    This driver uses acpi processor perf lib calls to register performance.
    The following logic is used to adjust Intel P state driver limits:
    - If there is no turbo entry in _PSS, then disable Intel P state turbo
    and limit to non turbo max
    - If the non turbo max ratio is more than _PSS max non turbo value, then
    set the max non turbo ratio to _PSS non turbo max
    - If the min ratio is less than _PSS min then change the min ratio
    matching _PSS min
    - Scale the _PSS turbo frequency to max turbo frequency based on control
    value.
    This feature can be disabled by using kernel parameters:
    intel_pstate=no_acpi

    Signed-off-by: Srinivas Pandruvada
    Acked-by: Kristen Carlson Accardi
    Signed-off-by: Rafael J. Wysocki

    Srinivas Pandruvada
     
  • Systems with configurable TDP have multiple max non turbo p state. Intel
    P state uses max non turbo P state for scaling. But using the real max
    non turbo p state causes underestimation of next P state. So using
    the physical max non turbo P state as before for scaling.

    Signed-off-by: Srinivas Pandruvada
    Acked-by: Kristen Carlson Accardi
    Signed-off-by: Rafael J. Wysocki

    Srinivas Pandruvada
     
  • After Ivybridge, the max non turbo ratio obtained from platform info msr
    is not always guaranteed P1 on client platforms. The max non turbo
    activation ratio (TAR), determines the max for the current level of TDP.
    The ratio in platform info is physical max. The TAR MSR can be locked,
    so updating this value is not possible on all platforms.
    This change gets this ratio from MSR TURBO_ACTIVATION_RATIO if
    available,
    but also do some sanity checking to make sure that this value is
    correct.
    The sanity check involves reading the TDP ratio for the current tdp
    control value when platform has configurable TDP present and matching
    TAC
    with this.

    Signed-off-by: Srinivas Pandruvada
    Acked-by: Kristen Carlson Accardi
    Signed-off-by: Rafael J. Wysocki

    Srinivas Pandruvada
     

14 Oct, 2015

1 commit


13 Oct, 2015

2 commits


09 Oct, 2015

2 commits

  • When scaling_available_frequencies is read on an offlined cpu, then
    either lockup or junk values are displayed. This is caused by
    freed freq_table, which policy is using.

    Signed-off-by: Srinivas Pandruvada
    Acked-by: Viresh Kumar
    Signed-off-by: Rafael J. Wysocki

    Srinivas Pandruvada
     
  • When freqdomain_cpus attribute is read from an offlined cpu, it will
    cause crash. This change prevents calling cpufreq_show_cpus when
    policy driver_data is NULL.

    Crash info:

    [ 170.814949] BUG: unable to handle kernel NULL pointer dereference at 0000000000000018
    [ 170.814990] IP: [] _find_next_bit.part.0+0x10/0x70
    [ 170.815021] PGD 227d30067 PUD 229e56067 PMD 0
    [ 170.815043] Oops: 0000 [#2] SMP
    [ 170.816022] CPU: 3 PID: 3121 Comm: cat Tainted: G D OE 4.3.0-rc3+ #33
    ...
    ...
    [ 170.816657] Call Trace:
    [ 170.816672] [] ? find_next_bit+0x15/0x20
    [ 170.816696] [] cpufreq_show_cpus+0x5c/0xd0
    [ 170.816722] [] show_freqdomain_cpus+0x19/0x20 [acpi_cpufreq]
    [ 170.816749] [] show+0x3b/0x60
    [ 170.816769] [] sysfs_kf_seq_show+0xbc/0x130
    [ 170.816793] [] kernfs_seq_show+0x23/0x30
    [ 170.816816] [] seq_read+0xec/0x390
    [ 170.816837] [] kernfs_fop_read+0x10a/0x160
    [ 170.816861] [] __vfs_read+0x37/0x100
    [ 170.816883] [] ? security_file_permission+0xa0/0xc0
    [ 170.816909] [] vfs_read+0x83/0x130
    [ 170.816930] [] SyS_read+0x55/0xc0
    ...
    ...
    [ 170.817185] ---[ end trace bc6eadf82b2b965a ]---

    Signed-off-by: Srinivas Pandruvada
    Acked-by: Viresh Kumar
    Cc: 4.2+ # 4.2+
    Signed-off-by: Rafael J. Wysocki

    Srinivas Pandruvada
     

26 Sep, 2015

5 commits

  • Log a 'critical' message if the max frequency is reduced below nominal
    frequency. We already log 'info' message if the max frequency is
    capped below turbo frequency. CPU should guarantee atleast nominal
    frequency, but not turbo frequency in all system configurations and
    environments. So report the pmax throttling with severity when Pmax is
    dipped below nominal frequency.

    Signed-off-by: Shilpasri G Bhat
    Acked-by: Viresh Kumar
    Signed-off-by: Rafael J. Wysocki

    Shilpasri G Bhat
     
  • For i.MX6UL, the clock switch flow is slightly different from
    other i.MX6 SOCs. It has a 'secondary_sel' clk that will be used
    when the CPU freq is higher than 396MHz. So the clock switch flow in
    'set_target' callback need to update to support i.MX6UL in the common
    i.MX6 SOC cpufreq driver.

    Signed-off-by: Bai Ping
    Acked-by: Viresh Kumar
    Signed-off-by: Rafael J. Wysocki

    Bai Ping
     
  • CONFIG_PM ifdefs are superfluous and can be removed.

    Signed-off-by: Bartlomiej Zolnierkiewicz
    Acked-by: Viresh Kumar
    Signed-off-by: Rafael J. Wysocki

    Bartlomiej Zolnierkiewicz
     
  • Conservative governor has its own 'enable' field to check if
    conservative governor is used for a CPU or not

    This can be checked by policy->governor with 'cpufreq_gov_conservative'
    and so this field can be dropped.

    Because its not guaranteed that dbs_info->cdbs.shared will a valid
    pointer for all CPUs (will be NULL for CPUs that don't use
    ondemand/conservative governors), we can't use it anymore. Lets get
    policy with cpufreq_cpu_get_raw() instead.

    Signed-off-by: Viresh Kumar
    Signed-off-by: Rafael J. Wysocki

    Viresh Kumar
     
  • This platform driver has a OF device ID table but the OF module
    alias information is not created so module autoloading won't work.

    Signed-off-by: Luis de Bethencourt
    Acked-by: Viresh Kumar
    Signed-off-by: Rafael J. Wysocki

    Luis de Bethencourt
     

16 Sep, 2015

1 commit

  • cpufreq_cpu_get() called by get_cur_freq_on_cpu() is overkill,
    because the ->get() callback is always invoked in a context in
    which all of the conditions checked by cpufreq_cpu_get() are
    guaranteed to be satisfied.

    Use cpufreq_cpu_get_raw() instead of it and drop the
    corresponding cpufreq_cpu_put() from get_cur_freq_on_cpu().

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Viresh Kumar

    Rafael J. Wysocki
     

15 Sep, 2015

3 commits

  • OPP code is expanding and is already present in multiple directories
    (cpufreq and power). Lets move it to its own directory, to manage it
    better.

    This also moves/renames the cpufreq_opp file to cpu.c, as it will
    contain helpers for cpu device. Its not just about cpufreq, other
    frameworks can use OPPs as well.

    Reviewed-by: Stephen Boyd
    Signed-off-by: Viresh Kumar
    Signed-off-by: Rafael J. Wysocki

    Viresh Kumar
     
  • That's the naming convention followed in most of opp core, but few
    routines didn't follow this, fix them.

    Reviewed-by: Stephen Boyd
    Signed-off-by: Viresh Kumar
    Acked-by: Shawn Guo
    Signed-off-by: Rafael J. Wysocki

    Viresh Kumar
     
  • free-table routines are opposite of init-table ones, and must be named
    to make that clear. Opposite of 'init' is 'exit', but those doesn't suit
    really well.

    Replace 'init' with 'add' and 'free' with 'remove'.

    Reported-by: Pavel Machek
    Reviewed-by: Stephen Boyd
    Signed-off-by: Viresh Kumar
    Acked-by: Shawn Guo
    Signed-off-by: Rafael J. Wysocki

    Viresh Kumar
     

12 Sep, 2015

1 commit

  • Pull more power management and ACPI updates from Rafael Wysocki:
    "These are mostly fixes and cleanups on top of the previous PM+ACPI
    pull request (cpufreq core and drivers, cpuidle, generic power domains
    framework). Some of them didn't make to that pull request and some
    fix issues introduced by it.

    The only really new thing is the support for suspend frequency in the
    cpufreq-dt driver, but it is needed to fix an issue with Exynos
    platforms.

    Specifics:

    - build fix for the new Mediatek MT8173 cpufreq driver (Guenter
    Roeck).

    - generic power domains framework fixes (power on error code path,
    subdomain removal) and cleanup of a deprecated API user (Geert
    Uytterhoeven, Jon Hunter, Ulf Hansson).

    - cpufreq-dt driver fixes including two fixes for bugs related to the
    new Operating Performance Points Device Tree bindings introduced
    recently (Viresh Kumar).

    - suspend frequency support for the cpufreq-dt driver (Bartlomiej
    Zolnierkiewicz, Viresh Kumar).

    - cpufreq core cleanups (Viresh Kumar).

    - intel_pstate driver fixes (Chen Yu, Kristen Carlson Accardi).

    - additional sanity check in the cpuidle core (Xunlei Pang).

    - fix for a comment related to CPU power management (Lina Iyer)"

    * tag 'pm+acpi-4.3-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
    intel_pstate: fix PCT_TO_HWP macro
    intel_pstate: Fix user input of min/max to legal policy region
    PM / OPP: Return suspend_opp only if it is enabled
    cpufreq-dt: add suspend frequency support
    cpufreq: allow cpufreq_generic_suspend() to work without suspend frequency
    PM / OPP: add dev_pm_opp_get_suspend_opp() helper
    staging: board: Migrate away from __pm_genpd_name_add_device()
    cpufreq: Use __func__ to print function's name
    cpufreq: staticize cpufreq_cpu_get_raw()
    PM / Domains: Ensure subdomain is not in use before removing
    cpufreq: Add ARM_MT8173_CPUFREQ dependency on THERMAL
    cpuidle/coupled: Add sanity check for safe_state_index
    PM / Domains: Try power off masters in error path of __pm_genpd_poweron()
    cpufreq: dt: Tolerance applies on both sides of target voltage
    cpufreq: dt: Print error on failing to mark OPPs as shared
    cpufreq: dt: Check OPP count before marking them shared
    kernel/cpu_pm: fix cpu_cluster_pm_exit comment

    Linus Torvalds
     

11 Sep, 2015

2 commits

  • * pm-cpufreq:
    intel_pstate: fix PCT_TO_HWP macro
    intel_pstate: Fix user input of min/max to legal policy region
    cpufreq-dt: add suspend frequency support
    cpufreq: allow cpufreq_generic_suspend() to work without suspend frequency
    cpufreq: Use __func__ to print function's name
    cpufreq: staticize cpufreq_cpu_get_raw()
    cpufreq: Add ARM_MT8173_CPUFREQ dependency on THERMAL
    cpufreq: dt: Tolerance applies on both sides of target voltage
    cpufreq: dt: Print error on failing to mark OPPs as shared
    cpufreq: dt: Check OPP count before marking them shared

    Rafael J. Wysocki
     
  • Pull late ARM SoC updates from Kevin Hilman:
    "This is a collection of a few late fixes and other misc stuff that had
    dependencies on things being merged from other trees.

    The bulk of the changes are for samsung/exynos SoCs for some changes
    that needed a few minor reworks so ended up a bit late. The others
    are mainly for qcom SoCs: a couple fixes and some DTS updates"

    * tag 'armsoc-late' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (37 commits)
    ARM: multi_v7_defconfig: Enable PBIAS regulator
    soc: qcom: smd: Correct fBLOCKREADINTR handling
    soc: qcom: smd: Use correct remote processor ID
    soc: qcom: smem: Fix errant private access
    ARM: dts: qcom: msm8974-sony-xperia-honami: Use stdout-path
    ARM: dts: qcom: msm8960-cdp: Use stdout-path
    ARM: dts: qcom: msm8660-surf: Use stdout-path
    ARM: dts: qcom: ipq8064-ap148: Use stdout-path
    ARM: dts: qcom: apq8084-mtp: Use stdout-path
    ARM: dts: qcom: apq8084-ifc6540: Use stdout-path
    ARM: dts: qcom: apq8074-dragonboard: Use stdout-path
    ARM: dts: qcom: apq8064-ifc6410: Use stdout-path
    ARM: dts: qcom: apq8064-cm-qs600: Use stdout-path
    ARM: dts: qcom: Label serial nodes for aliasing and stdout-path
    reset: ath79: Fix missing spin_lock_init
    reset: Add (devm_)reset_control_get stub functions
    ARM: EXYNOS: switch to using generic cpufreq driver for exynos4x12
    cpufreq: exynos: Remove unselectable rule for arm-exynos-cpufreq.o
    ARM: dts: add iommu property to JPEG device for exynos4
    ARM: dts: enable SPI1 for exynos4412-odroidu3
    ...

    Linus Torvalds
     

10 Sep, 2015

2 commits

  • PCT_TO_HWP does not take the actual range of pstates exported
    by HWP_CAPABILITIES in account, and is broken on most platforms.
    Remove the macro and set the min and max pstate for hwp by
    determining the range and adjusting by the min and max percent
    limits values.

    Signed-off-by: Kristen Carlson Accardi
    Signed-off-by: Rafael J. Wysocki

    Kristen Carlson Accardi
     
  • In current code, max_perf_pct might be smaller than min_perf_pct
    by improper user input:

    $ grep . /sys/devices/system/cpu/intel_pstate/m*_perf_pct
    /sys/devices/system/cpu/intel_pstate/max_perf_pct:100
    /sys/devices/system/cpu/intel_pstate/min_perf_pct:100

    $ echo 80 > /sys/devices/system/cpu/intel_pstate/max_perf_pct

    $ grep . /sys/devices/system/cpu/intel_pstate/m*_perf_pct
    /sys/devices/system/cpu/intel_pstate/max_perf_pct:80
    /sys/devices/system/cpu/intel_pstate/min_perf_pct:100

    Fix this problem by 2 steps:
    1. Normalize the user input to [min_policy, max_policy].
    2. Make sure max_perf_pct>=min_perf_pct, suggested by Seiichi Ikarashi.

    Signed-off-by: Chen Yu
    Acked-by: Kristen Carlson Accardi
    Signed-off-by: Rafael J. Wysocki

    Chen Yu
     

09 Sep, 2015

2 commits


08 Sep, 2015

2 commits


05 Sep, 2015

1 commit

  • If ARM_MT8173_CPUFREQ is configured, and THERMAL is configured as module,
    the following build error is seen for arm:allmodconfig and
    arm64:allmodconfig.

    drivers/built-in.o: In function `mtk_cpufreq_ready':
    :(.text+0x32a20c): undefined reference to `of_cpufreq_cooling_register'
    drivers/built-in.o: In function `mtk_cpufreq_exit':
    :(.text+0x32a420): undefined reference to `cpufreq_cooling_unregister'

    The fix is similar to CPUFREQ_DT, but more restrictive since
    ARM_MT8173_CPUFREQ can not be built as module.

    Fixes: 1453863fb02a ("cpufreq: mediatek: Add MT8173 cpufreq driver")
    Signed-off-by: Guenter Roeck
    Acked-by: Viresh Kumar
    Signed-off-by: Rafael J. Wysocki

    Guenter Roeck