02 Apr, 2014

1 commit

  • Pull ACPI and power management updates from Rafael Wysocki:
    "The majority of this material spent some time in linux-next, some of
    it even several weeks. There are a few relatively fresh commits in
    it, but they are mostly fixes and simple cleanups.

    ACPI took the lead this time, both in terms of the number of commits
    and the number of modified lines of code, cpufreq follows and there
    are a few changes in the PM core and in cpuidle too.

    A new feature that already got some LWN.net's attention is the device
    PM QoS extension allowing latency tolerance requirements to be
    propagated from leaf devices to their ancestors with hardware
    interfaces for specifying latency tolerance. That should help systems
    with hardware-driven power management to avoid going too far with it
    in cases when there are latency tolerance constraints.

    There also are some significant changes in the ACPI core related to
    the way in which hotplug notifications are handled. They affect PCI
    hotplug (ACPIPHP) and the ACPI dock station code too. The bottom line
    is that all those notification now go through the root notify handler
    and are propagated to the interested subsystems by means of callbacks
    instead of having to install a notify handler for each device object
    that we can potentially get hotplug notifications for.

    In addition to that ACPICA will now advertise "Windows 2013"
    compatibility for _OSI, because some systems out there don't work
    correctly if that is not done (some of them don't even boot).

    On the system suspend side of things, all of the device suspend and
    resume callbacks, except for ->prepare() and ->complete(), are now
    going to be executed asynchronously as that turns out to speed up
    system suspend and resume on some platforms quite significantly and we
    have a few more optimizations in that area.

    Apart from that, there are some new device IDs and fixes and cleanups
    all over. In particular, the system suspend and resume handling by
    cpufreq should be improved and the cpuidle menu governor should be a
    bit more robust now.

    Specifics:

    - Device PM QoS support for latency tolerance constraints on systems
    with hardware interfaces allowing such constraints to be specified.
    That is necessary to prevent hardware-driven power management from
    becoming overly aggressive on some systems and to prevent power
    management features leading to excessive latencies from being used
    in some cases.

    - Consolidation of the handling of ACPI hotplug notifications for
    device objects. This causes all device hotplug notifications to go
    through the root notify handler (that was executed for all of them
    anyway before) that propagates them to individual subsystems, if
    necessary, by executing callbacks provided by those subsystems
    (those callbacks are associated with struct acpi_device objects
    during device enumeration). As a result, the code in question
    becomes both smaller in size and more straightforward and all of
    those changes should not affect users.

    - ACPICA update, including fixes related to the handling of _PRT in
    cases when it is broken and the addition of "Windows 2013" to the
    list of supported "features" for _OSI (which is necessary to
    support systems that work incorrectly or don't even boot without
    it). Changes from Bob Moore and Lv Zheng.

    - Consolidation of ACPI _OST handling from Jiang Liu.

    - ACPI battery and AC fixes allowing unusual system configurations to
    be handled by that code from Alexander Mezin.

    - New device IDs for the ACPI LPSS driver from Chiau Ee Chew.

    - ACPI fan and thermal optimizations related to system suspend and
    resume from Aaron Lu.

    - Cleanups related to ACPI video from Jean Delvare.

    - Assorted ACPI fixes and cleanups from Al Stone, Hanjun Guo, Lan
    Tianyu, Paul Bolle, Tomasz Nowicki.

    - Intel RAPL (Running Average Power Limits) driver cleanups from
    Jacob Pan.

    - intel_pstate fixes and cleanups from Dirk Brandewie.

    - cpufreq fixes related to system suspend/resume handling from Viresh
    Kumar.

    - cpufreq core fixes and cleanups from Viresh Kumar, Stratos
    Karafotis, Saravana Kannan, Rashika Kheria, Joe Perches.

    - cpufreq drivers updates from Viresh Kumar, Zhuoyu Zhang, Rob
    Herring.

    - cpuidle fixes related to the menu governor from Tuukka Tikkanen.

    - cpuidle fix related to coupled CPUs handling from Paul Burton.

    - Asynchronous execution of all device suspend and resume callbacks,
    except for ->prepare and ->complete, during system suspend and
    resume from Chuansheng Liu.

    - Delayed resuming of runtime-suspended devices during system suspend
    for the PCI bus type and ACPI PM domain.

    - New set of PM helper routines to allow device runtime PM callbacks
    to be used during system suspend and resume more easily from Ulf
    Hansson.

    - Assorted fixes and cleanups in the PM core from Geert Uytterhoeven,
    Prabhakar Lad, Philipp Zabel, Rashika Kheria, Sebastian Capella.

    - devfreq fix from Saravana Kannan"

    * tag 'pm+acpi-3.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (162 commits)
    PM / devfreq: Rewrite devfreq_update_status() to fix multiple bugs
    PM / sleep: Correct whitespace errors in
    intel_pstate: Set core to min P state during core offline
    cpufreq: Add stop CPU callback to cpufreq_driver interface
    cpufreq: Remove unnecessary braces
    cpufreq: Fix checkpatch errors and warnings
    cpufreq: powerpc: add cpufreq transition latency for FSL e500mc SoCs
    MAINTAINERS: Reorder maintainer addresses for PM and ACPI
    PM / Runtime: Update runtime_idle() documentation for return value meaning
    video / output: Drop display output class support
    fujitsu-laptop: Drop unneeded include
    acer-wmi: Stop selecting VIDEO_OUTPUT_CONTROL
    ACPI / gpu / drm: Stop selecting VIDEO_OUTPUT_CONTROL
    ACPI / video: fix ACPI_VIDEO dependencies
    cpufreq: remove unused notifier: CPUFREQ_{SUSPENDCHANGE|RESUMECHANGE}
    cpufreq: Do not allow ->setpolicy drivers to provide ->target
    cpufreq: arm_big_little: set 'physical_cluster' for each CPU
    cpufreq: arm_big_little: make vexpress driver depend on bL core driver
    ACPI / button: Add ACPI Button event via netlink routine
    ACPI: Remove duplicate definitions of PREFIX
    ...

    Linus Torvalds
     

13 Mar, 2014

1 commit

  • The architectures that override cputime_t (s390, ppc) don't provide
    any version of nsecs_to_cputime(). Indeed this cputime_t implementation
    by backend only happens when CONFIG_VIRT_CPU_ACCOUNTING_NATIVE=y under
    which the core code doesn't make any use of nsecs_to_cputime().

    At least for now.

    We are going to make a broader use of it so lets provide a default
    version with a per usecs granularity. It should be good enough for most
    usecases.

    Cc: Ingo Molnar
    Cc: Marcelo Tosatti
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Acked-by: Rik van Riel
    Signed-off-by: Frederic Weisbecker

    Frederic Weisbecker
     

02 Mar, 2014

3 commits


17 Jan, 2014

4 commits

  • When cpufreq_stats is compiled in as a module, cpufreq driver would
    have already been registered. And so the CPUFREQ_CREATE_POLICY
    notifiers wouldn't be called for it. Hence no sysfs entries for stats. :(

    This patch calls cpufreq_stats_create_table() for each online CPU from
    cpufreq_stats_init() and so if policy is already created for CPUx then
    we will register sysfs stats for it.

    When its not compiled as module, we will return early as policy wouldn't
    be found for any of the CPUs.

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

    Viresh Kumar
     
  • We don't have code paths now where we need to do these two things
    separately, so it is better do them in a single routine. Just as
    they are allocated in a single routine.

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

    Viresh Kumar
     
  • Either CPUs are hot-unplugged or suspend/resume occurs, cpufreq core
    will send notifications to cpufreq-stats and stats structure and sysfs
    entries would be correctly handled..

    And so we don't actually need hotcpu notifiers in cpufreq-stats anymore.
    We were only handling cpu hot-unplug events here and that are already
    taken care of by POLICY notifiers.

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

    Viresh Kumar
     
  • There are several problems with cpufreq stats in the way it handles
    cpufreq_unregister_driver() and suspend/resume..

    - We must not lose data collected so far when suspend/resume happens
    and so stats directories must not be removed/allocated during these
    operations, which is done currently.

    - cpufreq_stat has registered notifiers with both cpufreq and hotplug.
    It adds sysfs stats directory with a cpufreq notifier: CPUFREQ_NOTIFY
    and removes this directory with a notifier from hotplug core.

    In case cpufreq_unregister_driver() is called (on rmmod cpufreq driver),
    stats directories per cpu aren't removed as CPUs are still online. The
    only call cpufreq_stats gets is cpufreq_stats_update_policy_cpu() for
    all CPUs except the last of each policy. And pointer to stat information
    is stored in the entry for last CPU in the per-cpu cpufreq_stats_table.
    But policy structure would be freed inside cpufreq core and so that will
    result in memory leak inside cpufreq stats (as we are never freeing
    memory for stats).

    Now if we again insert the module cpufreq_register_driver() will be
    called and we will again allocate stats data and put it on for first
    CPU of every policy. In case we only have a single CPU per policy, we
    will return with a error from cpufreq_stats_create_table() due to this
    code:

    if (per_cpu(cpufreq_stats_table, cpu))
    return -EBUSY;

    And so probably cpufreq stats directory would not show up anymore (as
    it was added inside last policies->kobj which doesn't exist anymore).
    I haven't tested it, though. Also the values in stats files wouldn't
    be refreshed as we are using the earlier stats structure.

    - CPUFREQ_NOTIFY is called from cpufreq_set_policy() which is called for
    scenarios where we don't really want cpufreq_stat_notifier_policy() to get
    called. For example whenever we are changing anything related to a policy:
    min/max/current freq, etc. cpufreq_set_policy() is called and so cpufreq
    stats is notified. Where we don't do any useful stuff other than simply
    returning with -EBUSY from cpufreq_stats_create_table(). And so this
    isn't the right notifier that cpufreq stats..

    Due to all above reasons this patch does following changes:
    - Add new notifiers CPUFREQ_CREATE_POLICY and CPUFREQ_REMOVE_POLICY,
    which are only called when policy is created/destroyed. They aren't
    called for suspend/resume paths..
    - Use these notifiers in cpufreq_stat_notifier_policy() to create/destory
    stats sysfs entries. And so cpufreq_unregister_driver() or suspend/resume
    shouldn't be a problem for cpufreq_stats.
    - Return early from cpufreq_stat_cpu_callback() for suspend/resume sequence,
    so that we don't free stats structure.

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

    Viresh Kumar
     

10 Sep, 2013

1 commit

  • The time spent by a CPU under a given frequency is stored in jiffies unit
    in the cpu var cpufreq_stats_table->time_in_state[i], i being the index of
    the frequency.

    This is what is displayed in the following file on the right column:

    cat /sys/devices/system/cpu/cpuX/cpufreq/stats/time_in_state
    2301000 19835820
    2300000 3172
    [...]

    Now cpufreq converts this jiffies unit delta to clock_t before returning it
    to the user as in the above file. And that conversion is achieved using the API
    cputime64_to_clock_t().

    Although it accidentally works on traditional tick based cputime accounting, where
    cputime_t maps directly to jiffies, it doesn't work with other types of cputime
    accounting such as CONFIG_VIRT_CPU_ACCOUNTING_* where cputime_t can map to nsecs
    or any granularity preffered by the architecture.

    For example we get a buggy zero delta on full dyntick configurations:

    cat /sys/devices/system/cpu/cpuX/cpufreq/stats/time_in_state
    2301000 0
    2300000 0
    [...]

    Fix this with using the proper jiffies_64_t to clock_t conversion.

    Reported-and-tested-by: Carsten Emde
    Signed-off-by: Andreas Schwab
    Signed-off-by: Frederic Weisbecker
    Acked-by: Paul E. McKenney
    Signed-off-by: Rafael J. Wysocki

    Andreas Schwab
     

08 Aug, 2013

5 commits

  • Chapter 14 of Documentation/CodingStyle says:

    The preferred form for passing a size of a struct is the following:

    p = kmalloc(sizeof(*p), ...);

    The alternative form where struct name is spelled out hurts
    readability and introduces an opportunity for a bug when the pointer
    variable type is changed but the corresponding sizeof that is passed
    to a memory allocator is not.

    This wasn't followed consistently in drivers/cpufreq, let's make it
    more consistent by always following this rule.

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

    Viresh Kumar
     
  • They are called policy, cur_policy, new_policy, data, etc. Just call
    them policy wherever possible.

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

    Viresh Kumar
     
  • This patch addresses the following issues in the header files in the
    cpufreq core:
    - Include headers in ascending order, so that we don't add same
    many times by mistake.
    - must be included after , so that they override
    whatever they need to.
    - Remove unnecessary includes.
    - Don't include files already included by cpufreq.h or
    cpufreq_governor.h.

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

    Viresh Kumar
     
  • Now that we have the infrastructure to perform a light-weight init/tear-down,
    use that in the cpufreq CPU hotplug notifier when invoked from the
    suspend/resume path.

    This also ensures that the file permissions of the cpufreq sysfs files are
    preserved across suspend/resume, something which commit a66b2e (cpufreq:
    Preserve sysfs files across suspend/resume) originally intended to do, but
    had to be reverted due to other problems.

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

    Srivatsa S. Bhat
     
  • The call to cpufreq_update_policy() is placed in the CPU hotplug callback
    of cpufreq_stats, which has a higher priority than the CPU hotplug callback
    of cpufreq-core. As a result, during CPU_ONLINE/CPU_ONLINE_FROZEN, we end up
    calling cpufreq_update_policy() *before* calling cpufreq_add_dev() !
    And for uninitialized CPUs, it just returns silently, not doing anything.

    To add to that, cpufreq_stats is not even the right place to call
    cpufreq_update_policy() to begin with. The cpufreq core ought to handle
    this in its own callback, from an elegance/relevance perspective.

    So move the invocation of cpufreq_update_policy() to cpufreq_cpu_callback,
    and place it *after* cpufreq_add_dev().

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

    Srivatsa S. Bhat
     

20 Jul, 2013

1 commit

  • Pull power management and ACPI fixes from Rafael Wysocki:
    "These are fixes collected over the last week, most importnatly two
    cpufreq reverts fixing regressions introduced in 3.10, an autoseelp
    fix preventing systems using it from crashing during shutdown and two
    ACPI scan fixes related to hotplug.

    Specifics:

    - Two cpufreq commits from the 3.10 cycle introduced regressions.
    The first of them was buggy (it did way much more than it needed to
    do) and the second one attempted to fix an issue introduced by the
    first one. Fixes from Srivatsa S Bhat revert both.

    - If autosleep triggers during system shutdown and the shutdown
    callbacks of some device drivers have been called already, it may
    crash the system. Fix from Liu Shuo prevents that from happening
    by making try_to_suspend() check system_state.

    - The ACPI memory hotplug driver doesn't clear its driver_data on
    errors which may cause a NULL poiter dereference to happen later.
    Fix from Toshi Kani.

    - The ACPI namespace scanning code should not try to attach scan
    handlers to device objects that have them already, which may
    confuse things quite a bit, and it should rescan the whole
    namespace branch starting at the given node after receiving a bus
    check notify event even if the device at that particular node has
    been discovered already. Fixes from Rafael J Wysocki.

    - New ACPI video blacklist entry for a system whose initial backlight
    setting from the BIOS doesn't make sense. From Lan Tianyu.

    - Garbage string output avoindance for ACPI PNP from Liu Shuo.

    - Two Kconfig fixes for issues introduced recently in the s3c24xx
    cpufreq driver (when moving the driver to drivers/cpufreq) from
    Paul Bolle.

    - Trivial comment fix in pm_wakeup.h from Chanwoo Choi"

    * tag 'pm+acpi-3.11-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
    ACPI / video: ignore BIOS initial backlight value for Fujitsu E753
    PNP / ACPI: avoid garbage in resource name
    cpufreq: Revert commit 2f7021a8 to fix CPU hotplug regression
    cpufreq: s3c24xx: fix "depends on ARM_S3C24XX" in Kconfig
    cpufreq: s3c24xx: rename CONFIG_CPU_FREQ_S3C24XX_DEBUGFS
    PM / Sleep: Fix comment typo in pm_wakeup.h
    PM / Sleep: avoid 'autosleep' in shutdown progress
    cpufreq: Revert commit a66b2e to fix suspend/resume regression
    ACPI / memhotplug: Fix a stale pointer in error path
    ACPI / scan: Always call acpi_bus_scan() for bus check notifications
    ACPI / scan: Do not try to attach scan handlers to devices having them

    Linus Torvalds
     

15 Jul, 2013

2 commits

  • The __cpuinit type of throwaway sections might have made sense
    some time ago when RAM was more constrained, but now the savings
    do not offset the cost and complications. For example, the fix in
    commit 5e427ec2d0 ("x86: Fix bit corruption at CPU resume time")
    is a good example of the nasty type of bugs that can be created
    with improper use of the various __init prefixes.

    After a discussion on LKML[1] it was decided that cpuinit should go
    the way of devinit and be phased out. Once all the users are gone,
    we can then finally remove the macros themselves from linux/init.h.

    This removes all the drivers/cpufreq uses of the __cpuinit macros
    from all C files.

    [1] https://lkml.org/lkml/2013/5/20/589

    [v2: leave 2nd lines of args misaligned as requested by Viresh]
    Cc: "Rafael J. Wysocki"
    Cc: Viresh Kumar
    Cc: cpufreq@vger.kernel.org
    Cc: linux-pm@vger.kernel.org
    Acked-by: Dirk Brandewie
    Acked-by: Viresh Kumar
    Signed-off-by: Paul Gortmaker

    Paul Gortmaker
     
  • commit a66b2e (cpufreq: Preserve sysfs files across suspend/resume)
    has unfortunately caused several things in the cpufreq subsystem to
    break subtly after a suspend/resume cycle.

    The intention of that patch was to retain the file permissions of the
    cpufreq related sysfs files across suspend/resume. To achieve that,
    the commit completely removed the calls to cpufreq_add_dev() and
    __cpufreq_remove_dev() during suspend/resume transitions. But the
    problem is that those functions do 2 kinds of things:
    1. Low-level initialization/tear-down that are critical to the
    correct functioning of cpufreq-core.
    2. Kobject and sysfs related initialization/teardown.

    Ideally we should have reorganized the code to cleanly separate these
    two responsibilities, and skipped only the sysfs related parts during
    suspend/resume. Since we skipped the entire callbacks instead (which
    also included some CPU and cpufreq-specific critical components),
    cpufreq subsystem started behaving erratically after suspend/resume.

    So revert the commit to fix the regression. We'll revisit and address
    the original goal of that commit separately, since it involves quite a
    bit of careful code reorganization and appears to be non-trivial.

    (While reverting the commit, note that another commit f51e1eb
    (cpufreq: Fix cpufreq regression after suspend/resume) already
    reverted part of the original set of changes. So revert only the
    remaining ones).

    Signed-off-by: Srivatsa S. Bhat
    Acked-by: Viresh Kumar
    Tested-by: Paul Bolle
    Cc: 3.10+
    Signed-off-by: Rafael J. Wysocki

    Srivatsa S. Bhat
     

01 Jul, 2013

1 commit

  • Toralf Förster reported that the cpufreq ondemand governor behaves erratically
    (doesn't scale well) after a suspend/resume cycle. The problem was that the
    cpufreq subsystem's idea of the cpu frequencies differed from the actual
    frequencies set in the hardware after a suspend/resume cycle. Toralf bisected
    the problem to commit a66b2e5 (cpufreq: Preserve sysfs files across
    suspend/resume).

    Among other (harmless) things, that commit skipped the call to
    cpufreq_update_policy() in the resume path. But cpufreq_update_policy() plays
    an important role during resume, because it is responsible for checking if
    the BIOS changed the cpu frequencies behind our back and resynchronize the
    cpufreq subsystem's knowledge of the cpu frequencies, and update them
    accordingly.

    So, restore the call to cpufreq_update_policy() in the resume path to fix
    the cpufreq regression.

    Reported-and-tested-by: Toralf Förster
    Signed-off-by: Srivatsa S. Bhat
    Cc: 3.10+
    Signed-off-by: Rafael J. Wysocki

    Srivatsa S. Bhat
     

21 Jun, 2013

1 commit

  • There were a few noticeable formatting issues in core cpufreq code.
    This cleans them up to make code look better. The changes include:
    - Whitespace cleanup.
    - Rearrangements of code.
    - Multiline comments fixes.
    - Formatting changes to fit 80 columns.

    Copyright information in cpufreq.c is also updated to include my name
    for 2013.

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

    Viresh Kumar
     

16 May, 2013

1 commit

  • The file permissions of cpufreq per-cpu sysfs files are not preserved
    across suspend/resume because we internally go through the CPU
    Hotplug path which reinitializes the file permissions on CPU online.

    But the user is not supposed to know that we are using CPU hotplug
    internally within suspend/resume (IOW, the kernel should not silently
    wreck the user-set file permissions across a suspend cycle).
    Therefore, we need to preserve the file permissions as they are
    across suspend/resume.

    The simplest way to achieve that is to just not touch the sysfs files
    at all - ie., just ignore the CPU hotplug notifications in the
    suspend/resume path (_FROZEN) in the cpufreq hotplug callback.

    Reported-by: Robert Jarzmik
    Reported-by: Durgadoss R
    Signed-off-by: Srivatsa S. Bhat
    Acked-by: Viresh Kumar
    Signed-off-by: Rafael J. Wysocki

    Srivatsa S. Bhat
     

25 Mar, 2013

1 commit

  • In cpufreq_stats_free_sysfs() we aren't balancing calls to
    cpufreq_cpu_get() with cpufreq_cpu_put(). This will never let us have
    ref count to policy->kobj as zero.

    We will get a hang if somehow cpufreq_driver_unregister() is called.
    And that can happen when we compile our driver as module and
    insmod/rmmod it.

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

    viresh kumar
     

09 Feb, 2013

2 commits


02 Feb, 2013

2 commits

  • Implement a generic helper function policy_is_shared() to replace the
    current dbs_sw_coordinated_cpus() at cpufreq level, so that it can be
    used by code other than cpufreq governors.

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

    Fabio Baltieri
     
  • __cpufreq_remove_dev() is called on multiple occasions: cpufreq_driver
    unregister and cpu removals.

    Current implementation of this routine is overly complex without much need. If
    the cpu to be removed is the policy->cpu, we remove the policy first and add all
    other cpus again from policy->cpus and then finally call __cpufreq_remove_dev()
    again to remove the cpu to be deleted. Haahhhh..

    There exist a simple solution to removal of a cpu:
    - Simply use the old policy structure
    - update its fields like: policy->cpu, etc.
    - notify any users of cpufreq, which depend on changing policy->cpu

    Hence this patch, which tries to implement the above theory. It is tested well
    by myself on ARM big.LITTLE TC2 SoC, which has 5 cores (2 A15 and 3 A7). Both
    A15's share same struct policy and all A7's share same policy structure.

    Signed-off-by: Viresh Kumar
    Tested-by: Shawn Guo
    Signed-off-by: Rafael J. Wysocki

    Viresh Kumar
     

03 Jan, 2013

1 commit

  • This patch forces complete struct cpufreq_stats allocation for all cpus before
    registering CPUFREQ_TRANSITION_NOTIFIER notifier, otherwise in some conditions
    cpufreq_stat_notifier_trans() can be called in the middle of stats allocation,
    in this case cpufreq_stats_table already exists, but stat->freq_table is NULL.

    Signed-off-by: Konstantin Khlebnikov
    Signed-off-by: Rafael J. Wysocki

    Konstantin Khlebnikov
     

15 Nov, 2012

1 commit


23 Oct, 2012

1 commit

  • When system enters sleep, non-boot CPUs will be disabled.
    Cpufreq stats sysfs is created when the CPU is up, but it is not
    freed when the CPU is going down. This will cause memory leak.

    Signed-off-by: xiaobing tu
    Signed-off-by: guifang tang
    Signed-off-by: Rafael J. Wysocki

    Tu, Xiaobing
     

08 Jan, 2012

1 commit

  • * 'driver-core-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (73 commits)
    arm: fix up some samsung merge sysdev conversion problems
    firmware: Fix an oops on reading fw_priv->fw in sysfs loading file
    Drivers:hv: Fix a bug in vmbus_driver_unregister()
    driver core: remove __must_check from device_create_file
    debugfs: add missing #ifdef HAS_IOMEM
    arm: time.h: remove device.h #include
    driver-core: remove sysdev.h usage.
    clockevents: remove sysdev.h
    arm: convert sysdev_class to a regular subsystem
    arm: leds: convert sysdev_class to a regular subsystem
    kobject: remove kset_find_obj_hinted()
    m86k: gpio - convert sysdev_class to a regular subsystem
    mips: txx9_sram - convert sysdev_class to a regular subsystem
    mips: 7segled - convert sysdev_class to a regular subsystem
    sh: dma - convert sysdev_class to a regular subsystem
    sh: intc - convert sysdev_class to a regular subsystem
    power: suspend - convert sysdev_class to a regular subsystem
    power: qe_ic - convert sysdev_class to a regular subsystem
    power: cmm - convert sysdev_class to a regular subsystem
    s390: time - convert sysdev_class to a regular subsystem
    ...

    Fix up conflicts with 'struct sysdev' removal from various platform
    drivers that got changed:
    - arch/arm/mach-exynos/cpu.c
    - arch/arm/mach-exynos/irq-eint.c
    - arch/arm/mach-s3c64xx/common.c
    - arch/arm/mach-s3c64xx/cpu.c
    - arch/arm/mach-s5p64x0/cpu.c
    - arch/arm/mach-s5pv210/common.c
    - arch/arm/plat-samsung/include/plat/cpu.h
    - arch/powerpc/kernel/sysfs.c
    and fix up cpu_is_hotpluggable() as per Greg in include/linux/cpu.h

    Linus Torvalds
     

22 Dec, 2011

1 commit

  • This moves the 'cpu sysdev_class' over to a regular 'cpu' subsystem
    and converts the devices to regular devices. The sysdev drivers are
    implemented as subsystem interfaces now.

    After all sysdev classes are ported to regular driver core entities, the
    sysdev implementation will be entirely removed from the kernel.

    Userspace relies on events and generic sysfs subsystem infrastructure
    from sysdev devices, which are made available with this conversion.

    Cc: Haavard Skinnemoen
    Cc: Hans-Christian Egtvedt
    Cc: Tony Luck
    Cc: Fenghua Yu
    Cc: Arnd Bergmann
    Cc: Benjamin Herrenschmidt
    Cc: Paul Mackerras
    Cc: Martin Schwidefsky
    Cc: Heiko Carstens
    Cc: Paul Mundt
    Cc: "David S. Miller"
    Cc: Chris Metcalf
    Cc: Thomas Gleixner
    Cc: Ingo Molnar
    Cc: "H. Peter Anvin"
    Cc: Borislav Petkov
    Cc: Tigran Aivazian
    Cc: Len Brown
    Cc: Zhang Rui
    Cc: Dave Jones
    Cc: Peter Zijlstra
    Cc: Russell King
    Cc: Andrew Morton
    Cc: Arjan van de Ven
    Cc: "Rafael J. Wysocki"
    Cc: "Srivatsa S. Bhat"
    Signed-off-by: Kay Sievers
    Signed-off-by: Greg Kroah-Hartman

    Kay Sievers
     

15 Dec, 2011

1 commit


01 Nov, 2011

1 commit


17 Jun, 2011

1 commit

  • If the driver submitted an non-existing pol>cur value (say it
    used the default initialized value of zero), when the cpufreq
    stats tries to setup its initial values it incorrectly sets
    stat->last_index to -1 (or 0xfffff...). And cpufreq_stats_update
    tries to update at that index location and fails.

    This can be caused by:

    stat->last_index = freq_table_get_index(stat, policy->cur);

    not finding the appropiate frequency in the table (b/c the policy->cur
    is wrong) and we end up crashing. The fix however is
    concentrated in the 'cpufreq_stats_update' as the last_index
    (and old_index) are updated there. Which means it can reset
    the last_index to -1 again and on the next iteration cause a crash.

    Without this patch, the following crash is observed:

    powernow-k8: Found 1 AMD Athlon(tm) 64 Processor 3700+ (1 cpu cores) (version 2.20.00)
    powernow-k8: fid 0x2 (1000 MHz), vid 0x12
    powernow-k8: fid 0xa (1800 MHz), vid 0xa
    powernow-k8: fid 0xc (2000 MHz), vid 0x8
    powernow-k8: fid 0xe (2200 MHz), vid 0x8
    Marking TSC unstable due to cpufreq changes
    powernow-k8: fid trans failed, fid 0x2, curr 0x0
    BUG: unable to handle kernel paging request at ffff880807e07b78
    IP: [] cpufreq_stats_update+0x46/0x5b
    .. snip..
    Pid: 1, comm: swapper Not tainted 3.0.0-rc2 #45 MICRO-STAR INTERNATIONAL CO., LTD MS-7094/MS-7094
    ..snip..
    Call Trace:
    [] cpufreq_stat_notifier_trans+0x48/0x7c
    [] notifier_call_chain+0x32/0x5e
    [] __srcu_notifier_call_chain+0x47/0x63
    [] srcu_notifier_call_chain+0xf/0x11
    [] cpufreq_notify_transition+0x111/0x134
    [] powernowk8_target+0x53b/0x617
    [] __cpufreq_driver_target+0x2e/0x30
    [] cpufreq_governor_dbs+0x339/0x356
    [] __cpufreq_governor+0xa8/0xe9
    [] __cpufreq_set_policy+0x132/0x13e
    [] cpufreq_add_dev_interface+0x272/0x28c

    Reported-by: Tobias Diedrich
    Tested-by: Tobias Diedrich
    Signed-off-by: Konrad Rzeszutek Wilk
    Signed-off-by: Dave Jones

    Konrad Rzeszutek Wilk
     

13 Jun, 2011

1 commit


04 May, 2011

2 commits


30 Mar, 2010

1 commit

  • …it slab.h inclusion from percpu.h

    percpu.h is included by sched.h and module.h and thus ends up being
    included when building most .c files. percpu.h includes slab.h which
    in turn includes gfp.h making everything defined by the two files
    universally available and complicating inclusion dependencies.

    percpu.h -> slab.h dependency is about to be removed. Prepare for
    this change by updating users of gfp and slab facilities include those
    headers directly instead of assuming availability. As this conversion
    needs to touch large number of source files, the following script is
    used as the basis of conversion.

    http://userweb.kernel.org/~tj/misc/slabh-sweep.py

    The script does the followings.

    * Scan files for gfp and slab usages and update includes such that
    only the necessary includes are there. ie. if only gfp is used,
    gfp.h, if slab is used, slab.h.

    * When the script inserts a new include, it looks at the include
    blocks and try to put the new include such that its order conforms
    to its surrounding. It's put in the include block which contains
    core kernel includes, in the same order that the rest are ordered -
    alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
    doesn't seem to be any matching order.

    * If the script can't find a place to put a new include (mostly
    because the file doesn't have fitting include block), it prints out
    an error message indicating which .h file needs to be added to the
    file.

    The conversion was done in the following steps.

    1. The initial automatic conversion of all .c files updated slightly
    over 4000 files, deleting around 700 includes and adding ~480 gfp.h
    and ~3000 slab.h inclusions. The script emitted errors for ~400
    files.

    2. Each error was manually checked. Some didn't need the inclusion,
    some needed manual addition while adding it to implementation .h or
    embedding .c file was more appropriate for others. This step added
    inclusions to around 150 files.

    3. The script was run again and the output was compared to the edits
    from #2 to make sure no file was left behind.

    4. Several build tests were done and a couple of problems were fixed.
    e.g. lib/decompress_*.c used malloc/free() wrappers around slab
    APIs requiring slab.h to be added manually.

    5. The script was run on all .h files but without automatically
    editing them as sprinkling gfp.h and slab.h inclusions around .h
    files could easily lead to inclusion dependency hell. Most gfp.h
    inclusion directives were ignored as stuff from gfp.h was usually
    wildly available and often used in preprocessor macros. Each
    slab.h inclusion directive was examined and added manually as
    necessary.

    6. percpu.h was updated not to include slab.h.

    7. Build test were done on the following configurations and failures
    were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
    distributed build env didn't work with gcov compiles) and a few
    more options had to be turned off depending on archs to make things
    build (like ipr on powerpc/64 which failed due to missing writeq).

    * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
    * powerpc and powerpc64 SMP allmodconfig
    * sparc and sparc64 SMP allmodconfig
    * ia64 SMP allmodconfig
    * s390 SMP allmodconfig
    * alpha SMP allmodconfig
    * um on x86_64 SMP allmodconfig

    8. percpu.h modifications were reverted so that it could be applied as
    a separate patch and serve as bisection point.

    Given the fact that I had only a couple of failures from tests on step
    6, I'm fairly confident about the coverage of this conversion patch.
    If there is a breakage, it's likely to be something in one of the arch
    headers which should be easily discoverable easily on most builds of
    the specific arch.

    Signed-off-by: Tejun Heo <tj@kernel.org>
    Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>

    Tejun Heo
     

25 Feb, 2009

1 commit


20 May, 2008

1 commit

  • Change cpufreq_policy and cpufreq_governor pointer tables
    from arrays to per_cpu variables in the cpufreq subsystem.

    Also some minor complaints from checkpatch.pl fixed.

    Based on:
    git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
    git://git.kernel.org/pub/scm/linux/kernel/git/x86/linux-2.6-x86.git

    Signed-off-by: Mike Travis
    Signed-off-by: Dave Jones

    Mike Travis