27 Mar, 2007

1 commit

  • Ingo reported it on lkml in the thread
    "2.6.21-rc5: maxcpus=1 crash in cpufreq: kernel BUG at drivers/cpufreq/cpufreq.c:82!"

    This check added to remove_dev is symmetric to one in add_dev and handles
    callbacks for offline cpus cleanly.

    Signed-off-by: Venkatesh Pallipadi
    Acked-by: Ingo Molnar
    Signed-off-by: Linus Torvalds

    Venki Pallipadi
     

27 Feb, 2007

2 commits


23 Feb, 2007

1 commit


21 Feb, 2007

1 commit


17 Feb, 2007

1 commit

  • * master.kernel.org:/pub/scm/linux/kernel/git/davej/cpufreq:
    [CPUFREQ] Longhaul - Redo Longhaul ver. 2
    [CPUFREQ] EPS - Correct 2nd brand test
    [CPUFREQ] Longhaul - Separate frequency and voltage transition
    [CPUFREQ] Longhaul - Models of Nehemiah
    [CPUFREQ] Whitespace fixup
    [CPUFREQ] Longhaul - Simplier minmult
    [CPUFREQ] CPU_FREQ_TABLE shouldn't be a def_tristate
    [CPUFREQ] ondemand governor use new cpufreq rwsem locking in work callback
    [CPUFREQ] ondemand governor restructure the work callback
    [CPUFREQ] Rewrite lock in cpufreq to eliminate cpufreq/hotplug related issues
    [CPUFREQ] Remove hotplug cpu crap
    [CPUFREQ] Enhanced PowerSaver driver
    [CPUFREQ] Longhaul - Add VT8235 support
    [CPUFREQ] Longhaul - Fix guess_fsb function
    [CPUFREQ] Longhaul - Remove duplicate tables
    [CPUFREQ] Longhaul - Introduce Nehemiah C
    [CPUFREQ] fix cpuinfo_cur_freq for CPU_HW_PSTATE
    [CPUFREQ] Longhaul - Remove "ignore_latency" option

    Linus Torvalds
     

15 Feb, 2007

1 commit

  • After Al Viro (finally) succeeded in removing the sched.h #include in module.h
    recently, it makes sense again to remove other superfluous sched.h includes.
    There are quite a lot of files which include it but don't actually need
    anything defined in there. Presumably these includes were once needed for
    macros that used to live in sched.h, but moved to other header files in the
    course of cleaning it up.

    To ease the pain, this time I did not fiddle with any header files and only
    removed #includes from .c-files, which tend to cause less trouble.

    Compile tested against 2.6.20-rc2 and 2.6.20-rc2-mm2 (with offsets) on alpha,
    arm, i386, ia64, mips, powerpc, and x86_64 with allnoconfig, defconfig,
    allmodconfig, and allyesconfig as well as a few randconfigs on x86_64 and all
    configs in arch/arm/configs on arm. I also checked that no new warnings were
    introduced by the patch (actually, some warnings are removed that were emitted
    by unnecessarily included header files).

    Signed-off-by: Tim Schmielau
    Acked-by: Russell King
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Tim Schmielau
     

11 Feb, 2007

6 commits

  • Signed-off-by: Dave Jones

    Dave Jones
     
  • CPU_FREQ_TABLE enables helper code and gets select'ed when it's required.

    Building it as a module when it's not required doesn't seem to make much sense.

    Signed-off-by: Adrian Bunk
    Signed-off-by: Andrew Morton
    Signed-off-by: Dave Jones

    Adrian Bunk
     
  • Eliminate flush_workqueue in cpufreq_governor(STOP) callpath. Using flush
    there has a deadlock potential as in

    http://uwsg.iu.edu/hypermail/linux/kernel/0611.3/1223.html

    Also, cleanup the locking issues with do_dbs_timer delayed_work callback. As
    it changes the CPU frequency using __cpufreq_target, it needs to have
    policy_rwsem in write mode, which also protects it from hot plug.

    Signed-off-by: Venkatesh Pallipadi
    Cc: Gautham R Shenoy
    Signed-off-by: Andrew Morton
    Signed-off-by: Dave Jones

    Venkatesh Pallipadi
     
  • Restructure the delayed_work callback in ondemand.

    This eliminates the need for smp_processor_id in the callback function and
    also helps in proper locking and avoiding flush_workqueue when stopping the
    governor (done in subsequent patch).

    Signed-off-by: Venkatesh Pallipadi
    Cc: Gautham R Shenoy
    Signed-off-by: Andrew Morton
    Signed-off-by: Dave Jones

    Venkatesh Pallipadi
     
  • Yet another attempt to resolve cpufreq and hotplug locking issues.

    Patchset has 3 patches:
    * Rewrite the lock infrastructure of cpufreq using a per cpu rwsem.
    * Minor restructuring of work callback in ondemand driver.
    * Use the new cpufreq rwsem infrastructure in ondemand work.

    This patch:

    Convert policy->lock to rwsem and move it to per_cpu area.
    This rwsem will protect against both changing/accessing policy
    related parameters and CPU hot plug/unplug.

    [malattia@linux.it: fix oops in kref_put()]
    Cc: Gautham R Shenoy
    Signed-off-by: Venkatesh Pallipadi
    Cc: Gautham R Shenoy
    Signed-off-by: Mattia Dongili
    Signed-off-by: Andrew Morton
    Signed-off-by: Dave Jones

    Venkatesh Pallipadi
     
  • The hotplug CPU locking in cpufreq is horrendous. No-one seems to care
    enough to fix it, so just remove it so that the 99.9% of the real world
    users of this code can use cpufreq without being bothered by warnings.

    Signed-off-by: Andrew Morton
    Signed-off-by: Dave Jones

    Dave Jones
     

29 Jan, 2007

1 commit


23 Dec, 2006

1 commit

  • Fixes the oops in cpufreq_stats with acpi_cpufreq driver. The issue was
    that the frequency was reported as 0 in acpi-cpufreq.c. The bug is due to
    different indicies for freq_table and ACPI perf table.

    Also adds a check in cpufreq_stats to check for error return from
    freq_table_get_index() and avoid using the error return value.

    Patch fixes the issue reported at
    http://www.ussg.iu.edu/hypermail/linux/kernel/0611.2/0629.html
    and also other similar issue here
    http://bugme.osdl.org/show_bug.cgi?id=7383 comment 53

    Signed-off-by: Dhaval Giani
    Signed-off-by: Venkatesh Pallipadi
    Signed-off-by: Andrew Morton
    Signed-off-by: Dave Jones

    Venkatesh Pallipadi
     

13 Dec, 2006

2 commits


08 Dec, 2006

1 commit

  • There was lots of #ifdef noise in the kernel due to hotcpu_notifier(fn,
    prio) not correctly marking 'fn' as used in the !HOTPLUG_CPU case, and thus
    generating compiler warnings of unused symbols, hence forcing people to add
    #ifdefs.

    the compiler can skip truly unused functions just fine:

    text data bss dec hex filename
    1624412 728710 3674856 6027978 5bfaca vmlinux.before
    1624412 728710 3674856 6027978 5bfaca vmlinux.after

    [akpm@osdl.org: topology.c fix]
    Signed-off-by: Ingo Molnar
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ingo Molnar
     

22 Nov, 2006

3 commits

  • Fix up for make allyesconfig.

    Signed-Off-By: David Howells

    David Howells
     
  • Pass the work_struct pointer to the work function rather than context data.
    The work function can use container_of() to work out the data.

    For the cases where the container of the work_struct may go away the moment the
    pending bit is cleared, it is made possible to defer the release of the
    structure by deferring the clearing of the pending bit.

    To make this work, an extra flag is introduced into the management side of the
    work_struct. This governs auto-release of the structure upon execution.

    Ordinarily, the work queue executor would release the work_struct for further
    scheduling or deallocation by clearing the pending bit prior to jumping to the
    work function. This means that, unless the driver makes some guarantee itself
    that the work_struct won't go away, the work function may not access anything
    else in the work_struct or its container lest they be deallocated.. This is a
    problem if the auxiliary data is taken away (as done by the last patch).

    However, if the pending bit is *not* cleared before jumping to the work
    function, then the work function *may* access the work_struct and its container
    with no problems. But then the work function must itself release the
    work_struct by calling work_release().

    In most cases, automatic release is fine, so this is the default. Special
    initiators exist for the non-auto-release case (ending in _NAR).

    Signed-Off-By: David Howells

    David Howells
     
  • The ONDEMAND governor needs FREQ_TABLE

    Signed-off-by: Mattia Dongili
    Signed-off-by: Dave Jones
    Signed-off-by: Linus Torvalds

    Dave Jones
     

21 Nov, 2006

1 commit

  • This is a quick hack to overcome the fact that SRCU currently does not
    allow static initializers, and we need to sometimes initialize those
    things before any other initializers (even "core" ones) can do so.

    Currently we don't allow this at all for modules, and the only user that
    needs is right now is cpufreq. As reported by Thomas Gleixner:

    "Commit b4dfdbb3c707474a2254c5b4d7e62be31a4b7da9 ("[PATCH] cpufreq:
    make the transition_notifier chain use SRCU breaks cpu frequency
    notification users, which register the callback > on core_init
    level."

    Cc: Thomas Gleixner
    Cc: Ingo Molnar
    Cc: Arjan van de Ven
    Cc: Andrew Morton ,
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

07 Nov, 2006

1 commit


21 Oct, 2006

1 commit


16 Oct, 2006

1 commit

  • Enable ondemand governor and acpi-cpufreq to use IA32_APERF and IA32_MPERF MSR
    to get active frequency feedback for the last sampling interval. This will
    make ondemand take right frequency decisions when hardware coordination of
    frequency is going on.

    Without APERF/MPERF, ondemand can take wrong decision at times due
    to underlying hardware coordination or TM2.
    Example:
    * CPU 0 and CPU 1 are hardware cooridnated.
    * CPU 1 running at highest frequency.
    * CPU 0 was running at highest freq. Now ondemand reduces it to
    some intermediate frequency based on utilization.
    * Due to underlying hardware coordination with other CPU 1, CPU 0 continues to
    run at highest frequency (as long as other CPU is at highest).
    * When ondemand samples CPU 0 again next time, without actual frequency
    feedback from APERF/MPERF, it will think that previous frequency change
    was successful and can go to wrong target frequency. This is because it
    thinks that utilization it has got this sampling interval is when running at
    intermediate frequency, rather than actual highest frequency.

    More information about IA32_APERF IA32_MPERF MSR:
    Refer to IA-32 Intel® Architecture Software Developer's Manual at
    http://developer.intel.com

    Signed-off-by: Venkatesh Pallipadi
    Signed-off-by: Dave Jones

    Venkatesh Pallipadi
     

04 Oct, 2006

1 commit

  • This patch (as762) changes the cpufreq_transition_notifier_list from a
    blocking_notifier_head to an srcu_notifier_head. This will prevent errors
    caused attempting to call down_read() to access the notifier chain at a
    time when interrupts must remain disabled, during system suspend.

    It's not clear to me whether this is really necessary; perhaps the chain
    could be made into an atomic_notifier. However a couple of the callout
    routines do use blocking operations, so this approach seems safer.

    The head of the notifier chain needs to be initialized before use; this is
    done by an __init routine at core_initcall time. If this turns out not to
    be a good choice, it can easily be changed.

    Signed-off-by: Alan Stern
    Cc: "Paul E. McKenney"
    Cc: Jesse Brandeburg
    Cc: Dave Jones
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alan Stern
     

27 Sep, 2006

1 commit


23 Sep, 2006

1 commit

  • Lukewarm IQ detected in hotplug locking
    BUG: warning at kernel/cpu.c:38/lock_cpu_hotplug()
    [] lock_cpu_hotplug+0x42/0x65
    [] cpufreq_update_policy+0x25/0xad
    [] kprobe_flush_task+0x18/0x40
    [] schedule+0x63f/0x68b
    [] __link_module+0x0/0x1f
    [] __cond_resched+0x16/0x34
    [] cond_resched+0x26/0x31
    [] wait_for_completion+0x17/0xb1
    [] cpufreq_stat_cpu_callback+0x13/0x20 [cpufreq_stats]
    [] cpufreq_stats_init+0x74/0x8b [cpufreq_stats]
    [] sys_init_module+0x91/0x174
    [] sysenter_past_esp+0x56/0x79

    As there are other places that call cpufreq_update_policy without
    the hotplug lock, it seems better to keep the hotplug locking
    at the lower level for the time being until this is revamped.

    Signed-off-by: Dave Jones

    Dave Jones
     

06 Sep, 2006

1 commit


14 Aug, 2006

1 commit


12 Aug, 2006

3 commits

  • ondemand selects the minimum frequency that can retire
    a workload with negligible idle time -- ideally resulting in the highest
    performance/power efficiency with negligible performance impact.

    But on some systems and some workloads, this algorithm
    is more performance biased than necessary, and
    de-tuning it a bit to allow some performance impact
    can save measurable power.

    This patch adds a "powersave_bias" tunable to ondemand
    to allow it to reduce its target frequency by a specified percent.

    By default, the powersave_bias is 0 and has no effect.
    powersave_bias is in units of 0.1%, so it has an effective range
    of 1 through 1000, resulting in 0.1% to 100% impact.

    In practice, users will not be able to detect a difference between
    0.1% increments, but 1.0% increments turned out to be too large.
    Also, the max value of 1000 (100%) would simply peg the system
    in its deepest power saving P-state, unless the processor really has
    a hardware P-state at 0Hz:-)

    For example, If ondemand requests 2.0GHz based on utilization,
    and powersave_bias=100, this code will knock 10% off the target
    and seek a target of 1.8GHz instead of 2.0GHz until the
    next sampling. If 1.8 is an exact match with an hardware frequency
    we use it, otherwise we average our time between the frequency
    next higher than 1.8 and next lower than 1.8.

    Note that a user or administrative program can change powersave_bias
    at run-time depending on how they expect the system to be used.

    Signed-off-by: Venkatesh Pallipadi
    Signed-off-by: Alexey Starikovskiy
    Signed-off-by: Dave Jones

    Alexey Starikovskiy
     
  • Try to make dbs_check_cpu() call on all CPUs at the same jiffy.
    This will help when multiple cores share P-states via Hardware Coordination.

    Signed-off-by: Venkatesh Pallipadi
    Signed-off-by: Alexey Starikovskiy
    Signed-off-by: Dave Jones

    Alexey Starikovskiy
     
  • Signed-off-by: Dave Jones

    Dave Jones
     

01 Aug, 2006

3 commits

  • Demand-load cpufreq governor modules if needed.

    Signed-off-by: Jeremy Fitzhardinge
    Signed-off-by: Dave Jones

    Jeremy Fitzhardinge
     
  • Adds a __find_governor() helper function to look up a governor by
    name. Also restructures some error handling to conform to the
    "single-exit" model which is generally preferred for kernel code.

    Signed-off-by: Jeremy Fitzhardinge
    Signed-off-by: Dave Jones

    Jeremy Fitzhardinge
     
  • I just stumbled on this bug/feature, this is how to reproduce it:

    # echo 450000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
    # echo 450000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
    # echo powersave > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
    # cpufreq-info -p
    450000 450000 powersave
    # echo 1800000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq ; echo $?
    0
    # cpufreq-info -p
    450000 450000 powersave

    Here it is. The kernel refuses to set a min_freq higher than the
    max_freq but it allows a max_freq lower than min_freq (lowering min_freq
    also).

    This behaviour is pretty straightforward (but undocumented) and it
    doesn't return an error altough failing to accomplish the requested
    action (set min_freq).
    The problem (IMO) is basically that userspace is not allowed to set a
    full policy atomically while the kernel always does that thus it must
    enforce an ordering on operations.

    The attached patch returns -EINVAL if trying to increase frequencies
    starting from scaling_min_freq and documents the correct ordering of writes.

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

    --

    Mattia Dongili
     

26 Jul, 2006

1 commit

  • The patch below moves the cpu hotplugging higher up in the cpufreq
    layering; this is needed to avoid recursive taking of the cpu hotplug
    lock and to otherwise detangle the mess.

    The new rules are:
    1. you must do lock_cpu_hotplug() around the following functions:
    __cpufreq_driver_target
    __cpufreq_governor (for CPUFREQ_GOV_LIMITS operation only)
    __cpufreq_set_policy
    2. governer methods (.governer) must NOT take the lock_cpu_hotplug()
    lock in any way; they are called with the lock taken already
    3. if your governer spawns a thread that does things, like calling
    __cpufreq_driver_target, your thread must honor rule #1.
    4. the policy lock and other cpufreq internal locks nest within
    the lock_cpu_hotplug() lock.

    I'm not entirely happy about how the __cpufreq_governor rule ended up
    (conditional locking rule depending on the argument) but basically all
    callers pass this as a constant so it's not too horrible.

    The patch also removes the cpufreq_governor() function since during the
    locking audit it turned out to be entirely unused (so no need to fix it)

    The patch works on my testbox, but it could use more testing
    (otoh... it can't be much worse than the current code)

    Signed-off-by: Arjan van de Ven
    Signed-off-by: Linus Torvalds

    Arjan van de Ven
     

24 Jul, 2006

1 commit


08 Jul, 2006

1 commit

  • [ There's some not quite baked bits in cpufreq-git right now
    so sending this on as a patch instead ]

    On Thu, 2006-07-06 at 07:58 -0700, Tom London wrote:

    > After installing .2356 I get this each time I boot:
    > =======================================================
    > [ INFO: possible circular locking dependency detected ]
    > -------------------------------------------------------
    > S06cpuspeed/1620 is trying to acquire lock:
    > (dbs_mutex){--..}, at: [] mutex_lock+0x21/0x24
    >
    > but task is already holding lock:
    > (cpucontrol){--..}, at: [] mutex_lock+0x21/0x24
    >
    > which lock already depends on the new lock.
    >

    make sure the cpu hotplug recursive mutex (yuck) is taken early in the
    cpufreq codepaths to avoid a AB-BA deadlock.

    Signed-off-by: Arjan van de Ven
    Signed-off-by: Dave Jones
    Signed-off-by: Linus Torvalds

    Dave Jones
     

05 Jul, 2006

1 commit

  • * master.kernel.org:/pub/scm/linux/kernel/git/davej/cpufreq:
    Move workqueue exports to where the functions are defined.
    [CPUFREQ] Misc cleanups in ondemand.
    [CPUFREQ] Make ondemand sampling per CPU and remove the mutex usage in sampling path.
    [CPUFREQ] Add queue_delayed_work_on() interface for workqueues.
    [CPUFREQ] Remove slowdown from ondemand sampling path.

    Linus Torvalds