07 Jun, 2021

1 commit

  • The log messages in processor_perflib.c is not in consistency,
    we have some printk() calls with PREFIX, but some are not; we
    use pr_*() functions without prefix. So add pr_fmt() and unify
    them with pr_*() functions.

    While at it, fix some obvious coding style issues when going
    through the functions.

    Signed-off-by: Hanjun Guo
    Signed-off-by: Rafael J. Wysocki

    Hanjun Guo
     

26 Apr, 2021

1 commit

  • * acpi-misc:
    ACPI: dock: fix some coding style issues
    ACPI: sysfs: fix some coding style issues
    ACPI: PM: add a missed blank line after declarations
    ACPI: custom_method: fix a coding style issue
    ACPI: CPPC: fix some coding style issues
    ACPI: button: fix some coding style issues
    ACPI: battery: fix some coding style issues
    ACPI: acpi_pad: add a missed blank line after declarations
    ACPI: LPSS: add a missed blank line after declarations
    ACPI: ipmi: remove useless return statement for void function
    ACPI: processor: fix some coding style issues
    ACPI: APD: fix a block comment align issue
    ACPI: AC: fix some coding style issues
    ACPI: fix various typos in comments

    Rafael J. Wysocki
     

20 Mar, 2021

1 commit

  • Fix trivial ACPI driver comment typos.

    s/notifcations/notifications/
    s/Ajust/Adjust/
    s/preform/perform/
    s/atrributes/attributes/
    s/Souce/Source/
    s/Evalutes/Evaluates/
    s/Evalutes/Evaluates/
    s/specifiy/specify/
    s/promixity/proximity/
    s/presuambly/presumably/
    s/Evalute/Evaluate/
    s/specificed/specified/
    s/rountine/routine/
    s/previosuly/previously/

    Change comment referencing pcc_send_cmd to send_pcc_cmd.

    Signed-off-by: Tom Saeger
    Reviewed-by: Randy Dunlap
    Signed-off-by: Rafael J. Wysocki

    Tom Saeger
     

09 Mar, 2021

2 commits


08 Mar, 2021

2 commits

  • The ACPI_DEBUG_PRINT() and ACPI_EXCEPTION() macros are used for
    message printing in the ACPICA code and they should not be used
    elsewhere. Special configuration (either kernel command line or
    sysfs-based) is needed to see the messages printed by them and
    the format of those messages is also special and convoluted.

    For this reason, replace all of the ACPI_DEBUG_PRINT() and
    ACPI_EXCEPTION() instances in the ACPI processor driver with
    corresponding dev_*(), acpi_handle_*() and pr_*() calls depending
    on the context in which they appear.

    Also drop the ACPI_PROCESSOR_COMPONENT definition that is not going
    to be necessary any more.

    Signed-off-by: Rafael J. Wysocki
    Reviewed-by: Hanjun Guo

    Rafael J. Wysocki
     
  • Address the following checkpatch error:

    ERROR: do not initialise statics to false

    Signed-off-by: Tian Tao
    [ rjw: Subject and changelog edits ]
    Signed-off-by: Rafael J. Wysocki

    Tian Tao
     

23 Dec, 2020

1 commit

  • Pull more power management updates from Rafael Wysocki:
    "These update the CPPC cpufreq driver and intel_pstate (which involves
    updating the cpufreq core and the schedutil governor) and make
    janitorial changes in the ACPI code handling processor objects.

    Specifics:

    - Rework the passive-mode "fast switch" path in the intel_pstate
    driver to allow it receive the minimum (required) and target
    (desired) performance information from the schedutil governor so as
    to avoid running some workloads too fast (Rafael Wysocki).

    - Make the intel_pstate driver allow the policy max limit to be
    increased after the guaranteed performance value for the given CPU
    has increased (Rafael Wysocki).

    - Clean up the handling of CPU coordination types in the CPPC cpufreq
    driver and make it export frequency domains information to user
    space via sysfs (Ionela Voinescu).

    - Fix the ACPI code handling processor objects to use a correct
    coordination type when it fails to map frequency domains and drop a
    redundant CPU map initialization from it (Ionela Voinescu, Punit
    Agrawal)"

    * tag 'pm-5.11-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
    cpufreq: intel_pstate: Use most recent guaranteed performance values
    cpufreq: intel_pstate: Implement the ->adjust_perf() callback
    cpufreq: Add special-purpose fast-switching callback for drivers
    cpufreq: schedutil: Add util to struct sg_cpu
    cppc_cpufreq: replace per-cpu data array with a list
    cppc_cpufreq: expose information on frequency domains
    cppc_cpufreq: clarify support for coordination types
    cppc_cpufreq: use policy->cpu as driver of frequency setting
    ACPI: processor: fix NONE coordination for domain mapping failure

    Linus Torvalds
     

16 Dec, 2020

1 commit

  • For errors parsing the _PSD domains, a separate domain is returned for
    each CPU in the failed _PSD domain with no coordination (as per previous
    comment). But contrary to the intention, the code was setting
    CPUFREQ_SHARED_TYPE_ALL as coordination type.

    Change shared_type to CPUFREQ_SHARED_TYPE_NONE in case of errors parsing
    the domain information. The function still returns the error and the caller
    is free to bail out the domain initialisation altogether in that case.

    Given that both functions return domains with a single CPU, this change
    does not affect the functionality, but clarifies the intention.

    Signed-off-by: Ionela Voinescu
    Acked-by: Viresh Kumar
    [ rjw: Subject edit ]
    Signed-off-by: Rafael J. Wysocki

    Ionela Voinescu
     

15 Dec, 2020

1 commit

  • * acpi-apei:
    ACPI, APEI: make apei_resources_all static

    * acpi-misc:
    ACPI: acpi_drivers.h: Update the kernel doc
    ACPI: acpi_drivers.h: Remove the leftover dead code
    ACPI: tiny-power-button: Simplify the code using module_acpi_driver()
    ACPI: SBS: Simplify the code using module_acpi_driver()
    ACPI: SBS: Simplify the driver init code
    ACPI: debug: Remove the not used function
    ACPI: processor: Remove the duplicated ACPI_PROCESSOR_CLASS macro

    * acpi-processor:
    ACPI: processor: Drop duplicate setting of shared_cpu_map

    Rafael J. Wysocki
     

25 Nov, 2020

1 commit

  • 'shared_cpu_map', stored as part of the per-processor
    acpi_processor_performance structre, is used to store CPUs that share
    a performance domain. By definition it contains the owning CPU.

    While building the 'shared_cpu_map' it is being set twice - once while
    initialising the performance domains and again when matching CPUs
    belonging to the same domain.

    Drop the unnecessary initialisation.

    Signed-off-by: Punit Agrawal
    Signed-off-by: Rafael J. Wysocki

    Punit Agrawal
     

18 Nov, 2020

1 commit


10 Nov, 2020

1 commit


25 Oct, 2019

1 commit

  • The _PPC change notifications from the platform firmware are per-CPU,
    so acpi_processor_ppc_init() needs to add a frequency QoS request
    for each CPU covered by a cpufreq policy to take all of them into
    account.

    Even though ACPI thermal control of CPUs sets frequency limits
    per processor package, it also needs a frequency QoS request for each
    CPU in a cpufreq policy in case some of them are taken offline and
    the frequency limit needs to be set through the remaining online
    ones (this is slightly excessive, because all CPUs covered by one
    cpufreq policy will set the same frequency limit through their QoS
    requests, but it is not incorrect).

    Modify the code in accordance with the above observations.

    Fixes: d15ce412737a ("ACPI: cpufreq: Switch to QoS requests instead of cpufreq notifier")
    Signed-off-by: Rafael J. Wysocki
    Acked-by: Viresh Kumar

    Rafael J. Wysocki
     

21 Oct, 2019

1 commit

  • Replace the CPU device PM QoS used for the management of min and max
    frequency constraints in cpufreq (and its users) with per-policy
    frequency QoS to avoid problems with cpufreq policies covering
    more then one CPU.

    Namely, a cpufreq driver is registered with the subsys interface
    which calls cpufreq_add_dev() for each CPU, starting from CPU0, so
    currently the PM QoS notifiers are added to the first CPU in the
    policy (i.e. CPU0 in the majority of cases).

    In turn, when the cpufreq driver is unregistered, the subsys interface
    doing that calls cpufreq_remove_dev() for each CPU, starting from CPU0,
    and the PM QoS notifiers are only removed when cpufreq_remove_dev() is
    called for the last CPU in the policy, say CPUx, which as a rule is
    not CPU0 if the policy covers more than one CPU. Then, the PM QoS
    notifiers cannot be removed, because CPUx does not have them, and
    they are still there in the device PM QoS notifiers list of CPU0,
    which prevents new PM QoS notifiers from being registered for CPU0
    on the next attempt to register the cpufreq driver.

    The same issue occurs when the first CPU in the policy goes offline
    before unregistering the driver.

    After this change it does not matter which CPU is the policy CPU at
    the driver registration time and whether or not it is online all the
    time, because the frequency QoS is per policy and not per CPU.

    Fixes: 67d874c3b2c6 ("cpufreq: Register notifiers with the PM QoS framework")
    Reported-by: Dmitry Osipenko
    Tested-by: Dmitry Osipenko
    Reported-by: Sudeep Holla
    Tested-by: Sudeep Holla
    Diagnosed-by: Viresh Kumar
    Link: https://lore.kernel.org/linux-pm/5ad2624194baa2f53acc1f1e627eb7684c577a19.1562210705.git.viresh.kumar@linaro.org/T/#md2d89e95906b8c91c15f582146173dce2e86e99f
    Link: https://lore.kernel.org/linux-pm/20191017094612.6tbkwoq4harsjcqv@vireshk-i7/T/#m30d48cc23b9a80467fbaa16e30f90b3828a5a29b
    Signed-off-by: Rafael J. Wysocki
    Acked-by: Viresh Kumar

    Rafael J. Wysocki
     

16 Oct, 2019

1 commit

  • If there are neither processor objects nor processor device objects
    in the ACPI tables, the per-CPU processors table will not be
    initialized and attempting to dereference pointers from there will
    cause the kernel to crash. This happens in acpi_processor_ppc_init()
    and acpi_thermal_cpufreq_init() after commit d15ce412737a ("ACPI:
    cpufreq: Switch to QoS requests instead of cpufreq notifier")
    which didn't add the requisite NULL pointer checks in there.

    Add the NULL pointer checks to acpi_processor_ppc_init() and
    acpi_thermal_cpufreq_init(), and to the corresponding "exit"
    routines.

    While at it, drop redundant return instructions from
    acpi_processor_ppc_init() and acpi_thermal_cpufreq_init().

    Fixes: d15ce412737a ("ACPI: cpufreq: Switch to QoS requests instead of cpufreq notifier")
    Reported-by: Srinivas Pandruvada
    Signed-off-by: Rafael J. Wysocki
    Acked-by: Viresh Kumar

    Rafael J. Wysocki
     

28 Aug, 2019

1 commit


31 May, 2019

1 commit

  • Based on 3 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

    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 [author] [kishon] [vijay] [abraham]
    [i] [kishon]@[ti] [com] 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

    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 [author] [graeme] [gregory]
    [gg]@[slimlogic] [co] [uk] [author] [kishon] [vijay] [abraham] [i]
    [kishon]@[ti] [com] [based] [on] [twl6030]_[usb] [c] [author] [hema]
    [hk] [hemahk]@[ti] [com] 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

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-or-later

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

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

    Thomas Gleixner
     

02 Apr, 2019

1 commit

  • In some cases, the platform firmware disables or enables turbo
    frequencies for all CPUs globally before triggering a _PPC change
    notification for one of them. Obviously, that global change affects
    all CPUs, not just the notified one, and it needs to be acted upon by
    cpufreq.

    The intel_pstate driver is able to detect such global changes of
    the settings, but it also needs to update policy limits for all
    CPUs if that happens, in particular if turbo frequencies are
    enabled globally - to allow them to be used.

    For this reason, introduce a new cpufreq driver callback to be
    invoked on _PPC notifications, if present, instead of simply
    calling cpufreq_update_policy() for the notified CPU and make
    intel_pstate use it to trigger policy updates for all CPUs
    in the system if global settings change.

    Link: https://bugzilla.kernel.org/show_bug.cgi?id=200759
    Reported-by: Gabriele Mazzotta
    Tested-by: Gabriele Mazzotta
    Signed-off-by: Rafael J. Wysocki
    Acked-by: Viresh Kumar

    Rafael J. Wysocki
     

13 Jun, 2018

1 commit

  • The kmalloc() function has a 2-factor argument form, kmalloc_array(). This
    patch replaces cases of:

    kmalloc(a * b, gfp)

    with:
    kmalloc_array(a * b, gfp)

    as well as handling cases of:

    kmalloc(a * b * c, gfp)

    with:

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

    as it's slightly less ugly than:

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

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

    kmalloc(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 tools/ directory was manually excluded, since it has its own
    implementation of kmalloc().

    The Coccinelle script used for this was:

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

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

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

    (
    kmalloc(
    - sizeof(u8) * (COUNT)
    + COUNT
    , ...)
    |
    kmalloc(
    - sizeof(__u8) * (COUNT)
    + COUNT
    , ...)
    |
    kmalloc(
    - sizeof(char) * (COUNT)
    + COUNT
    , ...)
    |
    kmalloc(
    - sizeof(unsigned char) * (COUNT)
    + COUNT
    , ...)
    |
    kmalloc(
    - sizeof(u8) * COUNT
    + COUNT
    , ...)
    |
    kmalloc(
    - sizeof(__u8) * COUNT
    + COUNT
    , ...)
    |
    kmalloc(
    - sizeof(char) * COUNT
    + COUNT
    , ...)
    |
    kmalloc(
    - 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;
    @@

    (
    - kmalloc
    + kmalloc_array
    (
    - sizeof(TYPE) * (COUNT_ID)
    + COUNT_ID, sizeof(TYPE)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(TYPE) * COUNT_ID
    + COUNT_ID, sizeof(TYPE)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(TYPE) * (COUNT_CONST)
    + COUNT_CONST, sizeof(TYPE)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(TYPE) * COUNT_CONST
    + COUNT_CONST, sizeof(TYPE)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(THING) * (COUNT_ID)
    + COUNT_ID, sizeof(THING)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(THING) * COUNT_ID
    + COUNT_ID, sizeof(THING)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(THING) * (COUNT_CONST)
    + COUNT_CONST, sizeof(THING)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(THING) * COUNT_CONST
    + COUNT_CONST, sizeof(THING)
    , ...)
    )

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

    - kmalloc
    + kmalloc_array
    (
    - 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;
    @@

    (
    kmalloc(
    - sizeof(TYPE) * (COUNT) * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kmalloc(
    - sizeof(TYPE) * (COUNT) * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kmalloc(
    - sizeof(TYPE) * COUNT * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kmalloc(
    - sizeof(TYPE) * COUNT * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kmalloc(
    - sizeof(THING) * (COUNT) * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    kmalloc(
    - sizeof(THING) * (COUNT) * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    kmalloc(
    - sizeof(THING) * COUNT * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    kmalloc(
    - 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;
    @@

    (
    kmalloc(
    - sizeof(TYPE1) * sizeof(TYPE2) * COUNT
    + array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
    , ...)
    |
    kmalloc(
    - sizeof(TYPE1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
    , ...)
    |
    kmalloc(
    - sizeof(THING1) * sizeof(THING2) * COUNT
    + array3_size(COUNT, sizeof(THING1), sizeof(THING2))
    , ...)
    |
    kmalloc(
    - sizeof(THING1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(THING1), sizeof(THING2))
    , ...)
    |
    kmalloc(
    - sizeof(TYPE1) * sizeof(THING2) * COUNT
    + array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
    , ...)
    |
    kmalloc(
    - 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;
    @@

    (
    kmalloc(
    - (COUNT) * STRIDE * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kmalloc(
    - COUNT * (STRIDE) * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kmalloc(
    - COUNT * STRIDE * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kmalloc(
    - (COUNT) * (STRIDE) * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kmalloc(
    - COUNT * (STRIDE) * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kmalloc(
    - (COUNT) * STRIDE * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kmalloc(
    - (COUNT) * (STRIDE) * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kmalloc(
    - 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;
    @@

    (
    kmalloc(C1 * C2 * C3, ...)
    |
    kmalloc(
    - (E1) * E2 * E3
    + array3_size(E1, E2, E3)
    , ...)
    |
    kmalloc(
    - (E1) * (E2) * E3
    + array3_size(E1, E2, E3)
    , ...)
    |
    kmalloc(
    - (E1) * (E2) * (E3)
    + array3_size(E1, E2, E3)
    , ...)
    |
    kmalloc(
    - 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;
    @@

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

    Signed-off-by: Kees Cook

    Kees Cook
     

21 Mar, 2018

1 commit

  • All uploaded PM data from non-dom0 CPUs takes the info from vCPU 0 and
    changing only the acpi_id. For processors which P-state coordination type
    is HW_ALL (0xFD) it is OK to upload bogus P-state dependency information
    (_PSD), because Xen will ignore any cpufreq domains created for past CPUs.

    Albeit for platforms which expose coordination types as SW_ANY or SW_ALL,
    this will have some unintended side effects. Effectively, it will look at
    the P-state domain existence and *if it already exists* it will skip the
    acpi-cpufreq initialization and thus inherit the policy from the first CPU
    in the cpufreq domain. This will finally lead to the original cpu not
    changing target freq to P0 other than the first in the domain. Which will
    make turbo boost not getting enabled (e.g. for 'performance' governor) for
    all cpus.

    This patch fixes that, by also evaluating _PSD when we enumerate all ACPI
    processors and thus always uploading the correct info to Xen. We export
    acpi_processor_get_psd() for that this purpose, but change signature
    to not assume an existent of acpi_processor given that ACPI isn't creating
    an acpi_processor for non-dom0 CPUs.

    Signed-off-by: Joao Martins
    Reviewed-by: Boris Ostrovsky
    Acked-by: Rafael J. Wysocki
    Signed-off-by: Boris Ostrovsky

    Joao Martins
     

04 Feb, 2018

1 commit

  • The following warning was triggered after resumed from S3 -
    if all the nonboot CPUs were put offline before suspend:

    [ 1840.329515] unchecked MSR access error: RDMSR from 0x771 at rIP: 0xffffffff86061e3a (native_read_msr+0xa/0x30)
    [ 1840.329516] Call Trace:
    [ 1840.329521] __rdmsr_on_cpu+0x33/0x50
    [ 1840.329525] generic_exec_single+0x81/0xb0
    [ 1840.329527] smp_call_function_single+0xd2/0x100
    [ 1840.329530] ? acpi_ds_result_pop+0xdd/0xf2
    [ 1840.329532] ? acpi_ds_create_operand+0x215/0x23c
    [ 1840.329534] rdmsrl_on_cpu+0x57/0x80
    [ 1840.329536] ? cpumask_next+0x1b/0x20
    [ 1840.329538] ? rdmsrl_on_cpu+0x57/0x80
    [ 1840.329541] intel_pstate_update_perf_limits+0xf3/0x220
    [ 1840.329544] ? notifier_call_chain+0x4a/0x70
    [ 1840.329546] intel_pstate_set_policy+0x4e/0x150
    [ 1840.329548] cpufreq_set_policy+0xcd/0x2f0
    [ 1840.329550] cpufreq_update_policy+0xb2/0x130
    [ 1840.329552] ? cpufreq_update_policy+0x130/0x130
    [ 1840.329556] acpi_processor_ppc_has_changed+0x65/0x80
    [ 1840.329558] acpi_processor_notify+0x80/0x100
    [ 1840.329561] acpi_ev_notify_dispatch+0x44/0x5c
    [ 1840.329563] acpi_os_execute_deferred+0x14/0x20
    [ 1840.329565] process_one_work+0x193/0x3c0
    [ 1840.329567] worker_thread+0x35/0x3b0
    [ 1840.329569] kthread+0x125/0x140
    [ 1840.329571] ? process_one_work+0x3c0/0x3c0
    [ 1840.329572] ? kthread_park+0x60/0x60
    [ 1840.329575] ? do_syscall_64+0x67/0x180
    [ 1840.329577] ret_from_fork+0x25/0x30
    [ 1840.329585] unchecked MSR access error: WRMSR to 0x774 (tried to write 0x0000000000000000) at rIP: 0xffffffff86061f78 (native_write_msr+0x8/0x30)
    [ 1840.329586] Call Trace:
    [ 1840.329587] __wrmsr_on_cpu+0x37/0x40
    [ 1840.329589] generic_exec_single+0x81/0xb0
    [ 1840.329592] smp_call_function_single+0xd2/0x100
    [ 1840.329594] ? acpi_ds_create_operand+0x215/0x23c
    [ 1840.329595] ? cpumask_next+0x1b/0x20
    [ 1840.329597] wrmsrl_on_cpu+0x57/0x70
    [ 1840.329598] ? rdmsrl_on_cpu+0x57/0x80
    [ 1840.329599] ? wrmsrl_on_cpu+0x57/0x70
    [ 1840.329602] intel_pstate_hwp_set+0xd3/0x150
    [ 1840.329604] intel_pstate_set_policy+0x119/0x150
    [ 1840.329606] cpufreq_set_policy+0xcd/0x2f0
    [ 1840.329607] cpufreq_update_policy+0xb2/0x130
    [ 1840.329610] ? cpufreq_update_policy+0x130/0x130
    [ 1840.329613] acpi_processor_ppc_has_changed+0x65/0x80
    [ 1840.329615] acpi_processor_notify+0x80/0x100
    [ 1840.329617] acpi_ev_notify_dispatch+0x44/0x5c
    [ 1840.329619] acpi_os_execute_deferred+0x14/0x20
    [ 1840.329620] process_one_work+0x193/0x3c0
    [ 1840.329622] worker_thread+0x35/0x3b0
    [ 1840.329624] kthread+0x125/0x140
    [ 1840.329625] ? process_one_work+0x3c0/0x3c0
    [ 1840.329626] ? kthread_park+0x60/0x60
    [ 1840.329628] ? do_syscall_64+0x67/0x180
    [ 1840.329631] ret_from_fork+0x25/0x30

    This is because if there's only one online CPU, the MSR_PM_ENABLE
    (package wide)can not be enabled after resumed, due to
    intel_pstate_hwp_enable() will only be invoked on AP's online
    process after resumed - if there's no AP online, the HWP remains
    disabled after resumed (BIOS has disabled it in S3). Then if
    there comes a _PPC change notification which touches HWP register
    during this stage, the warning is triggered.

    Since we don't call acpi_processor_register_performance() when
    HWP is enabled, the pr->performance will be NULL. When this is
    NULL we don't need to do _PPC change notification.

    Reported-by: Doug Smythies
    Suggested-by: Srinivas Pandruvada
    Signed-off-by: Yu Chen
    Signed-off-by: Rafael J. Wysocki

    Chen Yu
     

04 Feb, 2017

1 commit

  • acpi_processor_ppc_notifier() can live without using CPUFREQ_START
    (which is gonna be removed soon), as it is only used while setting
    ignore_ppc to 0. This can be done with the help of "ignore_ppc < 0"
    check alone. The notifier function anyway ignores all events except
    CPUFREQ_ADJUST and dropping CPUFREQ_START wouldn't harm at all.

    Once CPUFREQ_START event is removed from the cpufreq core,
    acpi_processor_ppc_notifier() will get called only for CPUFREQ_NOTIFY or
    CPUFREQ_ADJUST event. Drop the return statement from the first if block
    to make sure we don't ignore any such events.

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

    Viresh Kumar
     

21 Nov, 2016

1 commit


18 Nov, 2016

1 commit

  • Currently, intel_pstate is unable to control P-states on my
    IvyBridge-based Acer Aspire S5, because they are controlled by SMM
    on that machine by default and it is necessary to request OS control
    of P-states from it via the SMI Command register exposed in the ACPI
    FADT. intel_pstate doesn't do that now, but acpi-cpufreq and other
    cpufreq drivers for x86 platforms do.

    Address this problem by making intel_pstate use the ACPI-defined
    mechanism as well. However, intel_pstate is not modular and it
    doesn't need the module refcount tricks played by
    acpi_processor_notify_smm(), so export the core of this function
    to it as acpi_processor_pstate_control() and make it call that.
    [The changes in processor_perflib.c related to this should not
    make any functional difference for the acpi_processor_notify_smm()
    users].

    To be safe, only call acpi_processor_notify_smm() from intel_pstate
    if ACPI _PPC support is enabled in it.

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

    Rafael J. Wysocki
     

01 Sep, 2015

2 commits

  • * pm-cpufreq: (53 commits)
    cpufreq: speedstep-lib: Use monotonic clock
    cpufreq: powernv: Increase the verbosity of OCC console messages
    cpufreq: sfi: use kmemdup rather than duplicating its implementation
    cpufreq: drop !cpufreq_driver check from cpufreq_parse_governor()
    cpufreq: rename cpufreq_real_policy as cpufreq_user_policy
    cpufreq: remove redundant 'policy' field from user_policy
    cpufreq: remove redundant 'governor' field from user_policy
    cpufreq: update user_policy.* on success
    cpufreq: use memcpy() to copy policy
    cpufreq: remove redundant CPUFREQ_INCOMPATIBLE notifier event
    cpufreq: mediatek: Add MT8173 cpufreq driver
    dt-bindings: mediatek: Add MT8173 CPU DVFS clock bindings
    intel_pstate: append more Oracle OEM table id to vendor bypass list
    intel_pstate: Add SKY-S support
    intel_pstate: Fix possible overflow complained by Coverity
    cpufreq: Correct a freq check in cpufreq_set_policy()
    cpufreq: Lock CPU online/offline in cpufreq_register_driver()
    cpufreq: Replace recover_policy with new_policy in cpufreq_online()
    cpufreq: Separate CPU device registration from CPU online
    cpufreq: powernv: Restore cpu frequency to policy->cur on unthrottling
    ...

    Rafael J. Wysocki
     
  • What's being done from CPUFREQ_INCOMPATIBLE, can also be done with
    CPUFREQ_ADJUST. There is nothing special with CPUFREQ_INCOMPATIBLE
    notifier.

    Kill CPUFREQ_INCOMPATIBLE and fix its usage sites.

    This also updates the numbering of notifier events to remove holes.

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

    Viresh Kumar
     

23 Jul, 2015

1 commit


08 Jul, 2015

1 commit


21 Feb, 2014

1 commit


07 Dec, 2013

1 commit

  • Replace direct inclusions of , and
    , which are incorrect, with
    inclusions and remove some inclusions of those files that aren't
    necessary.

    First of all, , and
    should not be included directly from any files that are built for
    CONFIG_ACPI unset, because that generally leads to build warnings about
    undefined symbols in !CONFIG_ACPI builds. For CONFIG_ACPI set,
    includes those files and for CONFIG_ACPI unset it
    provides stub ACPI symbols to be used in that case.

    Second, there are ordering dependencies between those files that always
    have to be met. Namely, it is required that be included
    prior to so that the acpi_pci_root declarations the
    latter depends on are always there. And which provides
    basic ACPICA type declarations should always be included prior to any other
    ACPI headers in CONFIG_ACPI builds. That also is taken care of including
    as appropriate.

    Signed-off-by: Lv Zheng
    Cc: Greg Kroah-Hartman
    Cc: Matthew Garrett
    Cc: Tony Luck
    Cc: "H. Peter Anvin"
    Acked-by: Bjorn Helgaas (drivers/pci stuff)
    Acked-by: Konrad Rzeszutek Wilk (Xen stuff)
    Signed-off-by: Rafael J. Wysocki

    Lv Zheng
     

30 Oct, 2013

1 commit

  • Function acpi_processor_load_module() used by the ACPI processor
    driver can only really work if the acpi-cpufreq module is available
    when acpi_processor_start() is executed which usually is not the case
    for systems loading the processor driver module from an initramfs.

    Moreover, that used to be a hackish workaround for module autoloading
    issues, but udev loads acpi-cpufreq just fine nowadays, so that
    function isn't really necessary any more. For this reason, drop
    acpi_processor_load_module() entirely.

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     

15 Jul, 2013

1 commit


26 Jun, 2013

1 commit


06 Mar, 2013

1 commit

  • The git commit d5aaffa9dd531c978c6f3fea06a2972653bd7fc8
    (cpufreq: handle cpufreq being disabled for all exported function)
    tightens the cpufreq API by returning errors when disable_cpufreq()
    had been called.

    The problem we are hitting is that the module xen-acpi-processor which
    uses the ACPI's functions: acpi_processor_register_performance,
    acpi_processor_preregister_performance, and acpi_processor_notify_smm
    fails at acpi_processor_register_performance with -22.

    Note that earlier during bootup in arch/x86/xen/setup.c there is also
    an call to cpufreq's API: disable_cpufreq().

    This is b/c we want the Linux kernel to parse the ACPI data, but leave
    the cpufreq decisions to the hypervisor.

    In v3.9 all the checks that d5aaffa9dd531c978c6f3fea06a2972653bd7fc8
    added are now hit and the calls to cpufreq_register_notifier will now
    fail. This means that acpi_processor_ppc_init ends up printing:

    "Warning: Processor Platform Limit not supported"

    and the acpi_processor_ppc_status is not set.

    The repercussions of that is that the call to
    acpi_processor_register_performance fails right away at:

    if (!(acpi_processor_ppc_status & PPC_REGISTERED))

    and we don't progress any further on parsing and extracting the _P*
    objects.

    The only reason the Xen code called that function was b/c it was
    exported and the only way to gather the P-states. But we can also
    just make acpi_processor_get_performance_info be exported and not
    use acpi_processor_register_performance. This patch does so.

    Acked-by: Rafael J. Wysocki
    Signed-off-by: Konrad Rzeszutek Wilk

    Konrad Rzeszutek Wilk
     

22 Jan, 2013

1 commit

  • To fix incorrect P-state frequencies which can happen on
    some AMD systems f594065faf4f9067c2283a34619fc0714e79a98d
    "ACPI: Add fixups for AMD P-state figures"
    introduced a quirk to obtain the correct values by reading
    from AMD specific MSRs.

    This did cause a regression when running a kernel using that
    quirk under Xen which does (currently) not pass through MSR
    reads to the HW. Instead the guest gets a 0 in return.
    And this seems to cause a failure to initialize the ondemand
    governour (hard to say for sure as all P-states appear to run
    at the same frequency).

    While this should also be fixed in the hypervisor (to allow
    a guest to read that MSR), this patch is intended to work
    around the issue in the meantime. In discussion it turned out
    that indeed real HW/BIOSes may choose to not set the valid bit
    and thus mark the P-state as invalid. So this could be considered
    a fix for broken BIOSes that also works around the issue on Xen.

    Signed-off-by: Stefan Bader
    Cc: 3.7+
    Acked-by: Borislav Petkov
    Signed-off-by: Rafael J. Wysocki

    Stefan Bader
     

10 Sep, 2012

1 commit

  • Some AMD systems may round the frequencies in ACPI tables to 100MHz
    boundaries. We can obtain the real frequencies from MSRs, so add a quirk
    to fix these frequencies up on AMD systems.

    Signed-off-by: Matthew Garrett
    Signed-off-by: Andre Przywara
    Signed-off-by: Rafael J. Wysocki

    Matthew Garrett
     

08 May, 2012

1 commit


27 Jan, 2012

1 commit

  • The only left over hole in automatic cpufreq driver loading was the loading
    of ACPI cpufreq. This driver should be loaded when ACPI supports a _PDC
    method and the CPU vendor wants to use acpi cpufreq.

    Simply add a request module call to the acpi processor core driver
    when this is true. This seems like the simplest solution for this.

    Cc: Len Brown
    Signed-off-by: Andi Kleen
    Signed-off-by: Thomas Renninger
    Acked-by: H. Peter Anvin
    Signed-off-by: Greg Kroah-Hartman

    Andi Kleen
     

04 May, 2011

1 commit

  • With dynamic debug having gained the capability to report debug messages
    also during the boot process, it offers a far superior interface for
    debug messages than the custom cpufreq infrastructure. As a first step,
    remove the old cpufreq_debug_printk() function and replace it with a call
    to the generic pr_debug() function.

    How can dynamic debug be used on cpufreq? You need a kernel which has
    CONFIG_DYNAMIC_DEBUG enabled.

    To enabled debugging during runtime, mount debugfs and

    $ echo -n 'module cpufreq +p' > /sys/kernel/debug/dynamic_debug/control

    for debugging the complete "cpufreq" module. To achieve the same goal during
    boot, append

    ddebug_query="module cpufreq +p"

    as a boot parameter to the kernel of your choice.

    For more detailled instructions, please see
    Documentation/dynamic-debug-howto.txt

    Signed-off-by: Dominik Brodowski
    Signed-off-by: Dave Jones

    Dominik Brodowski