25 Mar, 2020

2 commits

  • The new macro set has a consistent namespace and uses C99 initializers
    instead of the grufty C89 ones.

    Get rid the of most local macro wrappers for consistency. The ones which
    make sense for readability are renamed to X86_MATCH*.

    In the centrino driver this also removes the two extra duplicates of family
    6 model 13 which have no value at all.

    Signed-off-by: Thomas Gleixner
    Signed-off-by: Borislav Petkov
    Reviewed-by: Greg Kroah-Hartman
    Acked-by: Rafael J. Wysocki
    Link: https://lkml.kernel.org/r/87eetheu88.fsf@nanos.tec.linutronix.de

    Thomas Gleixner
     
  • There is no reason that this gunk is in a generic header file. The wildcard
    defines need to stay as they are required by file2alias.

    Signed-off-by: Thomas Gleixner
    Signed-off-by: Borislav Petkov
    Reviewed-by: Greg Kroah-Hartman
    Link: https://lkml.kernel.org/r/20200320131508.736205164@linutronix.de

    Thomas Gleixner
     

31 May, 2019

1 commit

  • Based on 1 normalized pattern(s):

    this program is free software you can redistribute it and or modify
    it under the terms of the gnu general public license as published by
    the free software foundation either version 2 of the license or at
    your option any later version this program is distributed in the
    hope that it will be useful but without any warranty without even
    the implied warranty of merchantability or fitness for a particular
    purpose see the gnu general public license for more details you
    should have received a copy of the gnu general public license along
    with this program if not write to the free software foundation inc
    59 temple place suite 330 boston ma 02111 1307 usa

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-or-later

    has been chosen to replace the boilerplate/reference in 1334 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Allison Randal
    Reviewed-by: Richard Fontana
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190527070033.113240726@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

17 Apr, 2019

1 commit


20 Feb, 2019

1 commit

  • There is some rare cases where CPB (and possibly IDA) are missing on
    processors.

    This is the case fixed by commit f7f3dc00f612 ("x86/cpu/AMD: Fix
    erratum 1076 (CPB bit)") and following.

    In such context, the boost status isn't reported by
    /sys/devices/system/cpu/cpufreq/boost.

    This commit is about printing a message to report that the CPU
    doesn't expose the boost capabilities.

    This message could help debugging platforms hit by this phenomena.

    Signed-off-by: Erwan Velu
    [ rjw: Change the message text somewhat ]
    Signed-off-by: Rafael J. Wysocki

    Erwan Velu
     

28 Sep, 2018

1 commit

  • The Hygon Dhyana CPU supports ACPI P-States, and there is SMBus device
    (PCI device ID 0x790b) on the Hygon platform. Add Hygon Dhyana support
    to the cpufreq driver by using the code path of AMD family 17h.

    Signed-off-by: Pu Wen
    Signed-off-by: Borislav Petkov
    Acked-by: Rafael J. Wysocki
    Cc: rjw@rjwysocki.net
    Cc: viresh.kumar@linaro.org
    Cc: bp@alien8.de
    Cc: tglx@linutronix.de
    Cc: mingo@redhat.com
    Cc: hpa@zytor.com
    Cc: x86@kernel.org
    Cc: thomas.lendacky@amd.com
    Cc: rafael@kernel.org
    Cc: linux-pm@vger.kernel.org
    Link: https://lkml.kernel.org/r/4db6f0f8537a93c172430c446a0297a6ab1c3c2d.1537533369.git.puwen@hygon.cn

    Pu Wen
     

13 Jun, 2018

2 commits

  • Pull more power management updates from Rafael Wysocki:
    "These revert a recent PM core change that introduced a regression, fix
    the build when the recently added Kryo cpufreq driver is selected, add
    support for devices attached to multiple power domains to the generic
    power domains (genpd) framework, add support for iowait boosting on
    systens with hardware-managed P-states (HWP) enabled to the
    intel_pstate driver, modify the behavior of the wakeup_count device
    attribute in sysfs, fix a few issues and clean up some ugliness,
    mostly in cpufreq (core and drivers) and in the cpupower utility.

    Specifics:

    - Revert a recent PM core change that attempted to fix an issue
    related to device links, but introduced a regression (Rafael
    Wysocki)

    - Fix build when the recently added cpufreq driver for Kryo
    processors is selected by making it possible to build that driver
    as a module (Arnd Bergmann)

    - Fix the long idle detection mechanism in the out-of-band (ondemand
    and conservative) cpufreq governors (Chen Yu)

    - Add support for devices in multiple power domains to the generic
    power domains (genpd) framework (Ulf Hansson)

    - Add support for iowait boosting on systems with hardware-managed
    P-states (HWP) enabled to the intel_pstate driver and make it use
    that feature on systems with Skylake Xeon processors as it is
    reported to improve performance significantly on those systems
    (Srinivas Pandruvada)

    - Fix and update the acpi_cpufreq, ti-cpufreq and imx6q cpufreq
    drivers (Colin Ian King, Suman Anna, Sébastien Szymanski)

    - Change the behavior of the wakeup_count device attribute in sysfs
    to expose the number of events when the device might have aborted
    system suspend in progress (Ravi Chandra Sadineni)

    - Fix two minor issues in the cpupower utility (Abhishek Goel, Colin
    Ian King)"

    * tag 'pm-4.18-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
    Revert "PM / runtime: Fixup reference counting of device link suppliers at probe"
    cpufreq: imx6q: check speed grades for i.MX6ULL
    cpufreq: governors: Fix long idle detection logic in load calculation
    cpufreq: intel_pstate: enable boost for Skylake Xeon
    PM / wakeup: Export wakeup_count instead of event_count via sysfs
    PM / Domains: Add dev_pm_domain_attach_by_id() to manage multi PM domains
    PM / Domains: Add support for multi PM domains per device to genpd
    PM / Domains: Split genpd_dev_pm_attach()
    PM / Domains: Don't attach devices in genpd with multi PM domains
    PM / Domains: dt: Allow power-domain property to be a list of specifiers
    cpufreq: intel_pstate: New sysfs entry to control HWP boost
    cpufreq: intel_pstate: HWP boost performance on IO wakeup
    cpufreq: intel_pstate: Add HWP boost utility and sched util hooks
    cpufreq: ti-cpufreq: Use devres managed API in probe()
    cpufreq: ti-cpufreq: Fix an incorrect error return value
    cpufreq: ACPI: make function acpi_cpufreq_fast_switch() static
    cpufreq: kryo: allow building as a loadable module
    cpupower : Fix header name to read idle state name
    cpupower: fix spelling mistake: "logilename" -> "logfilename"

    Linus Torvalds
     
  • The kzalloc() function has a 2-factor argument form, kcalloc(). This
    patch replaces cases of:

    kzalloc(a * b, gfp)

    with:
    kcalloc(a * b, gfp)

    as well as handling cases of:

    kzalloc(a * b * c, gfp)

    with:

    kzalloc(array3_size(a, b, c), gfp)

    as it's slightly less ugly than:

    kzalloc_array(array_size(a, b), c, gfp)

    This does, however, attempt to ignore constant size factors like:

    kzalloc(4 * 1024, gfp)

    though any constants defined via macros get caught up in the conversion.

    Any factors with a sizeof() of "unsigned char", "char", and "u8" were
    dropped, since they're redundant.

    The Coccinelle script used for this was:

    // Fix redundant parens around sizeof().
    @@
    type TYPE;
    expression THING, E;
    @@

    (
    kzalloc(
    - (sizeof(TYPE)) * E
    + sizeof(TYPE) * E
    , ...)
    |
    kzalloc(
    - (sizeof(THING)) * E
    + sizeof(THING) * E
    , ...)
    )

    // Drop single-byte sizes and redundant parens.
    @@
    expression COUNT;
    typedef u8;
    typedef __u8;
    @@

    (
    kzalloc(
    - sizeof(u8) * (COUNT)
    + COUNT
    , ...)
    |
    kzalloc(
    - sizeof(__u8) * (COUNT)
    + COUNT
    , ...)
    |
    kzalloc(
    - sizeof(char) * (COUNT)
    + COUNT
    , ...)
    |
    kzalloc(
    - sizeof(unsigned char) * (COUNT)
    + COUNT
    , ...)
    |
    kzalloc(
    - sizeof(u8) * COUNT
    + COUNT
    , ...)
    |
    kzalloc(
    - sizeof(__u8) * COUNT
    + COUNT
    , ...)
    |
    kzalloc(
    - sizeof(char) * COUNT
    + COUNT
    , ...)
    |
    kzalloc(
    - sizeof(unsigned char) * COUNT
    + COUNT
    , ...)
    )

    // 2-factor product with sizeof(type/expression) and identifier or constant.
    @@
    type TYPE;
    expression THING;
    identifier COUNT_ID;
    constant COUNT_CONST;
    @@

    (
    - kzalloc
    + kcalloc
    (
    - sizeof(TYPE) * (COUNT_ID)
    + COUNT_ID, sizeof(TYPE)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(TYPE) * COUNT_ID
    + COUNT_ID, sizeof(TYPE)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(TYPE) * (COUNT_CONST)
    + COUNT_CONST, sizeof(TYPE)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(TYPE) * COUNT_CONST
    + COUNT_CONST, sizeof(TYPE)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(THING) * (COUNT_ID)
    + COUNT_ID, sizeof(THING)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(THING) * COUNT_ID
    + COUNT_ID, sizeof(THING)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(THING) * (COUNT_CONST)
    + COUNT_CONST, sizeof(THING)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(THING) * COUNT_CONST
    + COUNT_CONST, sizeof(THING)
    , ...)
    )

    // 2-factor product, only identifiers.
    @@
    identifier SIZE, COUNT;
    @@

    - kzalloc
    + kcalloc
    (
    - SIZE * COUNT
    + COUNT, SIZE
    , ...)

    // 3-factor product with 1 sizeof(type) or sizeof(expression), with
    // redundant parens removed.
    @@
    expression THING;
    identifier STRIDE, COUNT;
    type TYPE;
    @@

    (
    kzalloc(
    - sizeof(TYPE) * (COUNT) * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kzalloc(
    - sizeof(TYPE) * (COUNT) * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kzalloc(
    - sizeof(TYPE) * COUNT * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kzalloc(
    - sizeof(TYPE) * COUNT * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kzalloc(
    - sizeof(THING) * (COUNT) * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    kzalloc(
    - sizeof(THING) * (COUNT) * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    kzalloc(
    - sizeof(THING) * COUNT * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    kzalloc(
    - sizeof(THING) * COUNT * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    )

    // 3-factor product with 2 sizeof(variable), with redundant parens removed.
    @@
    expression THING1, THING2;
    identifier COUNT;
    type TYPE1, TYPE2;
    @@

    (
    kzalloc(
    - sizeof(TYPE1) * sizeof(TYPE2) * COUNT
    + array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
    , ...)
    |
    kzalloc(
    - sizeof(TYPE1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
    , ...)
    |
    kzalloc(
    - sizeof(THING1) * sizeof(THING2) * COUNT
    + array3_size(COUNT, sizeof(THING1), sizeof(THING2))
    , ...)
    |
    kzalloc(
    - sizeof(THING1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(THING1), sizeof(THING2))
    , ...)
    |
    kzalloc(
    - sizeof(TYPE1) * sizeof(THING2) * COUNT
    + array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
    , ...)
    |
    kzalloc(
    - sizeof(TYPE1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
    , ...)
    )

    // 3-factor product, only identifiers, with redundant parens removed.
    @@
    identifier STRIDE, SIZE, COUNT;
    @@

    (
    kzalloc(
    - (COUNT) * STRIDE * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kzalloc(
    - COUNT * (STRIDE) * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kzalloc(
    - COUNT * STRIDE * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kzalloc(
    - (COUNT) * (STRIDE) * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kzalloc(
    - COUNT * (STRIDE) * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kzalloc(
    - (COUNT) * STRIDE * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kzalloc(
    - (COUNT) * (STRIDE) * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kzalloc(
    - COUNT * STRIDE * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    )

    // Any remaining multi-factor products, first at least 3-factor products,
    // when they're not all constants...
    @@
    expression E1, E2, E3;
    constant C1, C2, C3;
    @@

    (
    kzalloc(C1 * C2 * C3, ...)
    |
    kzalloc(
    - (E1) * E2 * E3
    + array3_size(E1, E2, E3)
    , ...)
    |
    kzalloc(
    - (E1) * (E2) * E3
    + array3_size(E1, E2, E3)
    , ...)
    |
    kzalloc(
    - (E1) * (E2) * (E3)
    + array3_size(E1, E2, E3)
    , ...)
    |
    kzalloc(
    - E1 * E2 * E3
    + array3_size(E1, E2, E3)
    , ...)
    )

    // And then all remaining 2 factors products when they're not all constants,
    // keeping sizeof() as the second factor argument.
    @@
    expression THING, E1, E2;
    type TYPE;
    constant C1, C2, C3;
    @@

    (
    kzalloc(sizeof(THING) * C2, ...)
    |
    kzalloc(sizeof(TYPE) * C2, ...)
    |
    kzalloc(C1 * C2 * C3, ...)
    |
    kzalloc(C1 * C2, ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(TYPE) * (E2)
    + E2, sizeof(TYPE)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(TYPE) * E2
    + E2, sizeof(TYPE)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(THING) * (E2)
    + E2, sizeof(THING)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(THING) * E2
    + E2, sizeof(THING)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - (E1) * E2
    + E1, E2
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - (E1) * (E2)
    + E1, E2
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - E1 * E2
    + E1, E2
    , ...)
    )

    Signed-off-by: Kees Cook

    Kees Cook
     

06 Jun, 2018

1 commit

  • The acpi_cpufreq_fast_switch() function is local to the source and
    does not need to be in global scope, so make it static.

    Cleans up sparse warning:
    drivers/cpufreq/acpi-cpufreq.c:468:14: warning: symbol
    'acpi_cpufreq_fast_switch' was not declared. Should it be static?

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

    Colin Ian King
     

20 Mar, 2018

1 commit

  • The cpufreq core is already validating the CPU frequency table after
    calling the ->init() callback of the cpufreq drivers and the drivers
    don't need to do the same anymore. Though they need to set the
    policy->freq_table field directly from the ->init() callback now.

    Stop validating the frequency table in the acpi-cpufreq driver.

    The driver needs to crosscheck if the max frequency corresponds to the
    P-state 0 or not and the same is done from the ->ready() callback now.

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

    Viresh Kumar
     

15 Feb, 2018

1 commit

  • x86_mask is a confusing name which is hard to associate with the
    processor's stepping.

    Additionally, correct an indent issue in lib/cpu.c.

    Signed-off-by: Jia Zhang
    [ Updated it to more recent kernels. ]
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: bp@alien8.de
    Cc: tony.luck@intel.com
    Link: http://lkml.kernel.org/r/1514771530-70829-1-git-send-email-qianyue.zj@alibaba-inc.com
    Signed-off-by: Ingo Molnar

    Jia Zhang
     

21 Dec, 2016

1 commit

  • Since CPU hotplug callbacks are requested for CPUHP_AP_ONLINE_DYN state,
    successful callback initialization will result in cpuhp_setup_state()
    returning a positive value. Therefore acpi_cpufreq_online being zero
    indicates that callbacks have not been installed.

    This means that acpi_cpufreq_boost_exit() should only remove them if
    acpi_cpufreq_online is positive. Trying to call
    cpuhp_remove_state_nocalls(0) will cause a BUG().

    Signed-off-by: Boris Ostrovsky
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Rafael J. Wysocki

    Boris Ostrovsky
     

28 Nov, 2016

2 commits

  • The online / pre_down callback is invoked on the target CPU since commit
    1cf4f629d9d2 ("cpu/hotplug: Move online calls to hotplugged cpu") which means
    for the hotplug callback we can use rmdsrl() instead of rdmsr_on_cpus().

    This leaves us with set_boost() as the only user which still needs to
    read/write the MSR on different CPUs. There is no point in doing that
    update on all cpus with the read modify write magic via per cpu data. We
    simply can issue a function call on all online CPUs which also means that we
    need half that many IPIs.

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

    Sebastian Andrzej Siewior
     
  • Install the callbacks via the state machine.

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

    Sebastian Andrzej Siewior
     

22 Jul, 2016

1 commit


07 Jul, 2016

1 commit


09 Apr, 2016

4 commits


02 Apr, 2016

1 commit

  • Modify the ACPI cpufreq driver to provide a method for switching
    CPU frequencies from interrupt context and update the cpufreq core
    to support that method if available.

    Introduce a new cpufreq driver callback, ->fast_switch, to be
    invoked for frequency switching from interrupt context by (future)
    governors supporting that feature via (new) helper function
    cpufreq_driver_fast_switch().

    Add two new policy flags, fast_switch_possible, to be set by the
    cpufreq driver if fast frequency switching can be used for the
    given policy and fast_switch_enabled, to be set by the governor
    if it is going to use fast frequency switching for the given
    policy. Also add a helper for setting the latter.

    Since fast frequency switching is inherently incompatible with
    cpufreq transition notifiers, make it possible to set the
    fast_switch_enabled only if there are no transition notifiers
    already registered and make the registration of new transition
    notifiers fail if fast_switch_enabled is set for at least one
    policy.

    Implement the ->fast_switch callback in the ACPI cpufreq driver
    and make it set fast_switch_possible during policy initialization
    as appropriate.

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

    Rafael J. Wysocki
     

23 Mar, 2016

1 commit


20 Mar, 2016

1 commit

  • This driver has two issues. First, it tries to fiddle with the hot
    plugged CPU's MSR on the UP_PREPARE event, at a time when the CPU is
    not yet online. Second, the driver sets the "boost-disable" bit for a
    CPU when going down, but does not clear the bit again if the CPU comes
    up again due to DOWN_FAILED.

    This patch fixes the issues by changing the driver to react to the
    ONLINE/DOWN_FAILED events instead of UP_PREPARE. As an added benefit,
    the driver also becomes symmetric with respect to the hot plug
    mechanism.

    Signed-off-by: Richard Cochran
    Signed-off-by: Rafael J. Wysocki

    Richard Cochran
     

03 Mar, 2016

1 commit

  • Setting a new CPU frequency and reading the current request value
    in the ACPI cpufreq driver involves each at least two switch
    instructions (there's more if the policy is shared). One of
    them is present in drv_read/write() that prepares a command
    structure and the other happens in subsequent do_drv_read/write()
    when that structure is interpreted. However, all of those switches
    may be avoided by using function pointers.

    To that end, add two function pointers to struct acpi_cpufreq_data
    to represent read and write operations on the frequency register
    and set them up during policy intitialization to point to the pair
    of routines suitable for the given processor (Intel/AMD MSR access
    or I/O port access). Then, use those pointers in do_drv_read/write()
    and modify drv_read/write() to prepare the command structure for
    them without any checks.

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     

27 Feb, 2016

1 commit


01 Jan, 2016

2 commits

  • Notice that the boost_supported field in struct cpufreq_driver is
    redundant, because the driver's ->set_boost callback may be left
    unset if "boost" is not supported. Moreover, the only driver
    populating the ->set_boost callback is acpi_cpufreq, so make it
    avoid populating that callback if "boost" is not supported, rework
    the core to check ->set_boost instead of boost_supported to
    verify "boost" support and drop boost_supported which isn't
    used any more.

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

    Rafael J. Wysocki
     
  • The store_boost() routine is only used by store_cpb(), so move
    the code from it directly to that function and rename _store_boost()
    to set_boost() to make its name reflect the name of the driver
    callback pointing to it.

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

    Rafael J. Wysocki
     

09 Oct, 2015

1 commit

  • 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
     

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
     

23 Jul, 2015

3 commits

  • The cpb sysfs attribute is only exposed by the ACPI cpufreq driver
    after a runtime check. For this purpose, the driver keeps a NULL
    placeholder in its table of sysfs attributes and replaces the NULL
    with a pointer to an attribute structure if it decides to expose
    cpb.

    That is confusing, so make the driver set the pointer to the cpb
    attribute structure upfront and replace it with NULL if the
    attribute should not be exposed instead.

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

    Rafael J. Wysocki
     
  • After commit 8cfcfd39000d (acpi-cpufreq: Fix an ACPI perf unregister
    issue) we store both a pointer to per-CPU data of the first policy
    CPU and the number of that CPU which are redundant.

    Since the CPU number has to be stored anyway for the unregistration,
    the pointer to the CPU's per-CPU data may be dropped and we can
    access the data in question via per_cpu_ptr().

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

    Rafael J. Wysocki
     
  • acpi_processor_unregister_performance() actually doesn't use its
    first argument, so drop it and update the callers accordingly.

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

    Rafael J. Wysocki
     

17 Jul, 2015

2 commits

  • As policy->cpu may not be same in acpi_cpufreq_cpu_init() and
    acpi_cpufreq_cpu_exit(). There is a risk that we use different CPU
    to un/register ACPI performance. So acpi_processor_unregister_performance()
    may not be able to do the cleanup work. That causes a memory leak. And
    if there will be another acpi_processor_register_performance() call,
    it may also fail thanks to the internal check of pr->performace.

    So add a new struct acpi_cpufreq_data field, acpi_perf_cpu, to fix
    this issue.

    Signed-off-by: Pan Xinhui
    Acked-by: Viresh Kumar
    [ rjw: Changelog ]
    Signed-off-by: Rafael J. Wysocki

    Pan Xinhui
     
  • Drivers can store their internal per-policy information in
    policy->driver_data, lets use it.

    we have benefits after this replacing.
    1) memory saving.
    2) policy is shared by several cpus, per_cpu seems not correct. using
    *driver_data* is more reasonable.
    3) fix a memory leak in acpi_cpufreq_cpu_exit. as policy->cpu might
    change during cpu hotplug. So sometimes we cant't free *data*, use
    *driver_data* to fix it.
    4) fix a zero return value of get_cur_freq_on_cpu. Only per_cpu of
    policy->cpu is set to *data*, if we try to get cpufreq on other cpus, we
    get zero instead of correct values. Use *driver_data* to fix it.

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

    Pan Xinhui
     

27 May, 2015

1 commit

  • The former duplicate the functionalities of the latter but are
    neither documented nor arch-independent.

    Signed-off-by: Bartosz Golaszewski
    Acked-by: Viresh Kumar
    Acked-by: Rafael J. Wysocki
    Cc: Benoit Cousson
    Cc: Catalin Marinas
    Cc: Fenghua Yu
    Cc: Guenter Roeck
    Cc: Jean Delvare
    Cc: Jonathan Corbet
    Cc: Linus Torvalds
    Cc: Oleg Drokin
    Cc: Peter Zijlstra
    Cc: Russell King
    Cc: Thomas Gleixner
    Link: http://lkml.kernel.org/r/1432645896-12588-7-git-send-email-bgolaszewski@baylibre.com
    Signed-off-by: Ingo Molnar

    Bartosz Golaszewski
     

30 Apr, 2014

1 commit


08 Apr, 2014

2 commits

  • * pm-cpufreq:
    cpufreq: ppc: Remove duplicate inclusion of fsl_soc.h
    cpufreq: create another field .flags in cpufreq_frequency_table
    cpufreq: use kzalloc() to allocate memory for cpufreq_frequency_table
    cpufreq: don't print value of .driver_data from core
    cpufreq: ia64: don't set .driver_data to index
    cpufreq: powernv: Select CPUFreq related Kconfig options for powernv
    cpufreq: powernv: Use cpufreq_frequency_table.driver_data to store pstate ids
    cpufreq: powernv: cpufreq driver for powernv platform
    cpufreq: at32ap: don't declare local variable as static
    cpufreq: loongson2_cpufreq: don't declare local variable as static
    cpufreq: unicore32: fix typo issue for 'clk'
    cpufreq: exynos: Disable on multiplatform build

    Rafael J. Wysocki
     
  • Pull CPU hotplug notifiers registration fixes from Rafael Wysocki:
    "The purpose of this single series of commits from Srivatsa S Bhat
    (with a small piece from Gautham R Shenoy) touching multiple
    subsystems that use CPU hotplug notifiers is to provide a way to
    register them that will not lead to deadlocks with CPU online/offline
    operations as described in the changelog of commit 93ae4f978ca7f ("CPU
    hotplug: Provide lockless versions of callback registration
    functions").

    The first three commits in the series introduce the API and document
    it and the rest simply goes through the users of CPU hotplug notifiers
    and converts them to using the new method"

    * tag 'cpu-hotplug-3.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (52 commits)
    net/iucv/iucv.c: Fix CPU hotplug callback registration
    net/core/flow.c: Fix CPU hotplug callback registration
    mm, zswap: Fix CPU hotplug callback registration
    mm, vmstat: Fix CPU hotplug callback registration
    profile: Fix CPU hotplug callback registration
    trace, ring-buffer: Fix CPU hotplug callback registration
    xen, balloon: Fix CPU hotplug callback registration
    hwmon, via-cputemp: Fix CPU hotplug callback registration
    hwmon, coretemp: Fix CPU hotplug callback registration
    thermal, x86-pkg-temp: Fix CPU hotplug callback registration
    octeon, watchdog: Fix CPU hotplug callback registration
    oprofile, nmi-timer: Fix CPU hotplug callback registration
    intel-idle: Fix CPU hotplug callback registration
    clocksource, dummy-timer: Fix CPU hotplug callback registration
    drivers/base/topology.c: Fix CPU hotplug callback registration
    acpi-cpufreq: Fix CPU hotplug callback registration
    zsmalloc: Fix CPU hotplug callback registration
    scsi, fcoe: Fix CPU hotplug callback registration
    scsi, bnx2fc: Fix CPU hotplug callback registration
    scsi, bnx2i: Fix CPU hotplug callback registration
    ...

    Linus Torvalds
     

07 Apr, 2014

1 commit

  • Few drivers are using kmalloc() to allocate memory for frequency
    tables and since we will have an additional field '.flags' in
    'struct cpufreq_frequency_table', these might become unstable.
    Better get these fixed by replacing kmalloc() by kzalloc() instead.

    Along with that we also remove use of .driver_data from SPEAr driver
    as it doesn't use it at all. Also, writing zero to .driver_data is not
    required for powernow-k8 as it is already zero.

    Reported-and-reviewed-by: Gautham R. Shenoy
    Signed-off-by: Viresh Kumar
    Signed-off-by: Rafael J. Wysocki

    Viresh Kumar
     

20 Mar, 2014

1 commit

  • Subsystems that want to register CPU hotplug callbacks, as well as perform
    initialization for the CPUs that are already online, often do it as shown
    below:

    get_online_cpus();

    for_each_online_cpu(cpu)
    init_cpu(cpu);

    register_cpu_notifier(&foobar_cpu_notifier);

    put_online_cpus();

    This is wrong, since it is prone to ABBA deadlocks involving the
    cpu_add_remove_lock and the cpu_hotplug.lock (when running concurrently
    with CPU hotplug operations).

    Instead, the correct and race-free way of performing the callback
    registration is:

    cpu_notifier_register_begin();

    for_each_online_cpu(cpu)
    init_cpu(cpu);

    /* Note the use of the double underscored version of the API */
    __register_cpu_notifier(&foobar_cpu_notifier);

    cpu_notifier_register_done();

    Fix the acpi-cpufreq code by using this latter form of callback registration.

    Cc: Ingo Molnar
    Acked-by: Viresh Kumar
    Signed-off-by: Srivatsa S. Bhat
    Signed-off-by: Rafael J. Wysocki

    Srivatsa S. Bhat