09 Aug, 2008

1 commit


31 Jul, 2008

1 commit

  • Ingo Molnar provided a fix to not call _PPC at processor driver
    initialization time in "[PATCH] ACPI: fix cpufreq regression" (git
    commit e4233dec749a3519069d9390561b5636a75c7579)

    But it can still happen that _PPC is called at processor driver
    initialization time.

    This patch should make sure that this is not possible anymore.

    Signed-off-by: Thomas Renninger
    Cc: Andi Kleen
    Cc: Len Brown
    Cc: Dave Jones
    Cc: Ingo Molnar
    Cc: Venkatesh Pallipadi
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Thomas Renninger
     

24 Jul, 2008

1 commit

  • * 'cpus4096-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (31 commits)
    NR_CPUS: Replace NR_CPUS in speedstep-centrino.c
    cpumask: Provide a generic set of CPUMASK_ALLOC macros, FIXUP
    NR_CPUS: Replace NR_CPUS in cpufreq userspace routines
    NR_CPUS: Replace per_cpu(..., smp_processor_id()) with __get_cpu_var
    NR_CPUS: Replace NR_CPUS in arch/x86/kernel/genapic_flat_64.c
    NR_CPUS: Replace NR_CPUS in arch/x86/kernel/genx2apic_uv_x.c
    NR_CPUS: Replace NR_CPUS in arch/x86/kernel/cpu/proc.c
    NR_CPUS: Replace NR_CPUS in arch/x86/kernel/cpu/mcheck/mce_64.c
    cpumask: Optimize cpumask_of_cpu in lib/smp_processor_id.c, fix
    cpumask: Use optimized CPUMASK_ALLOC macros in the centrino_target
    cpumask: Provide a generic set of CPUMASK_ALLOC macros
    cpumask: Optimize cpumask_of_cpu in lib/smp_processor_id.c
    cpumask: Optimize cpumask_of_cpu in kernel/time/tick-common.c
    cpumask: Optimize cpumask_of_cpu in drivers/misc/sgi-xp/xpc_main.c
    cpumask: Optimize cpumask_of_cpu in arch/x86/kernel/ldt.c
    cpumask: Optimize cpumask_of_cpu in arch/x86/kernel/io_apic_64.c
    cpumask: Replace cpumask_of_cpu with cpumask_of_cpu_ptr
    Revert "cpumask: introduce new APIs"
    cpumask: make for_each_cpu_mask a bit smaller
    net: Pass reference to cpumask variable in net/sunrpc/svc.c
    ...

    Fix up trivial conflicts in drivers/cpufreq/cpufreq.c manually

    Linus Torvalds
     

22 Jul, 2008

1 commit


20 Jul, 2008

1 commit

  • * Replace arrays sized by NR_CPUS with percpu variables.

    Prior reference: http://marc.info/?l=linux-kernel&m=120251421825989&w=4
    Subject: [PATCH 1/4] cpufreq: change cpu freq tables to per_cpu variables
    From: Mike Travis
    Date: 2008-02-08 23:37:39

    Signed-off-by: Mike Travis
    Signed-off-by: Ingo Molnar

    Mike Travis
     

06 Jul, 2008

1 commit


10 Jun, 2008

2 commits


07 Jun, 2008

1 commit

  • If cpu specific cpufreq driver(i.e. longrun) has "setpolicy" function,
    governor object isn't set into cpufreq_policy object at "__cpufreq_set_policy"
    function in driver/cpufreq/cpufreq.c .

    This causes a null object access at "store_scaling_setspeed" and
    "show_scaling_setspeed" function in driver/cpufreq/cpufreq.c when reading or
    writing through /sys interface (ex. cat
    /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed)

    Addresses:
    http://bugzilla.kernel.org/show_bug.cgi?id=10654
    https://bugzilla.redhat.com/show_bug.cgi?id=443354

    Signed-off-by: CHIKAMA Masaki
    Cc: Dave Jones
    Cc: Chuck Ebbert
    Acked-by: Dominik Brodowski
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    CHIKAMA masaki
     

30 May, 2008

1 commit

  • In drivers/cpufreq/cpufreq.c the function cpufreq_add_dev() takes the
    error exit 'err_out_unregister' from different places once with the
    'cpu_policy_rwsem' lock held, once with the lock released:
    | if (ret)
    | goto err_out_unregister;
    | }
    |
    | policy->governor = NULL; /* to assure that the starting sequence is
    | * run in cpufreq_set_policy */
    |
    | /* set default policy */
    | ret = __cpufreq_set_policy(policy, &new_policy);
    | policy->user_policy.policy = policy->policy;
    | policy->user_policy.governor = policy->governor;
    |
    | unlock_policy_rwsem_write(cpu);
    |
    | if (ret) {
    | dprintk("setting policy failed\n");
    | goto err_out_unregister;
    | }

    This leads to the following error message in case of a failing
    __cpufreq_set_policy() call:
    =====================================
    [ BUG: bad unlock balance detected! ]
    -------------------------------------
    swapper/1 is trying to release lock (&per_cpu(cpu_policy_rwsem, cpu)) at:
    [] unlock_policy_rwsem_write+0x30/0x40
    but there are no more locks to release!

    other info that might help us debug this:
    1 lock held by swapper/1:
    #0: (sysdev_drivers_lock){--..}, at: [] sysdev_driver_register+0x74/0x130

    stack backtrace:
    [] (dump_stack+0x0/0x14) from [] (print_unlock_inbalance_bug+0xc8/0x104)
    [] (print_unlock_inbalance_bug+0x0/0x104) from [] (lock_release_non_nested+0xc4/0x19c)
    r6:00000028 r5:c3c1ab80 r4:c01b4564
    [] (lock_release_non_nested+0x0/0x19c) from [] (lock_release+0x15c/0x18c)
    r8:60000013 r7:00000001 r6:c01b4564 r5:c0541bb4 r4:c3c1ab80
    [] (lock_release+0x0/0x18c) from [] (up_write+0x24/0x30)
    r8:c0541b80 r7:00000000 r6:ffffffea r5:c3c34828 r4:c0541b8c
    [] (up_write+0x0/0x30) from [] (unlock_policy_rwsem_write+0x30/0x40)
    r4:c3c34884
    [] (unlock_policy_rwsem_write+0x0/0x40) from [] (cpufreq_add_dev+0x324/0x398)
    [] (cpufreq_add_dev+0x0/0x398) from [] (sysdev_driver_register+0xc0/0x130)
    [] (sysdev_driver_register+0x0/0x130) from [] (cpufreq_register_driver+0xbc/0x174)

    Signed-off-by: Lothar Waßmann
    Signed-off-by: Dave Jones

    Lothar Waßmann
     

24 May, 2008

1 commit


23 May, 2008

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
     

29 Apr, 2008

9 commits


06 Mar, 2008

3 commits

  • Fix the following warnings:
    WARNING: vmlinux.o(.text+0xfe6711): Section mismatch in reference from the function cpufreq_unregister_driver() to the variable .cpuinit.data:cpufreq_cpu_notifier
    WARNING: vmlinux.o(.text+0xfe68af): Section mismatch in reference from the function cpufreq_register_driver() to the variable .cpuinit.data:cpufreq_cpu_notifier
    WARNING: vmlinux.o(.exit.text+0xc4fa): Section mismatch in reference from the function cpufreq_stats_exit() to the variable .cpuinit.data:cpufreq_stat_cpu_notifier

    The warnings were casued by references to unregister_hotcpu_notifier()
    from normal functions or exit functions.
    This is flagged by modpost as a potential error because
    it does not know that for the non HOTPLUG_CPU
    scenario the unregister_hotcpu_notifier() is a nop.
    Silence the warning by replacing the __initdata
    annotation with a __refdata annotation.

    Signed-off-by: Sam Ravnborg
    Signed-off-by: Dave Jones

    Sam Ravnborg
     
  • refactor to use gotos instead of explicit exit paths

    Signed-off-by: Dave Jones

    Dave Jones
     
  • refactor to use gotos instead of explicit exit paths

    Signed-off-by: Dave Jones

    Dave Jones
     

22 Feb, 2008

1 commit

  • The cpufreq core should not take an extra kobject reference count for no
    reason, and then refuse to release it. This has been reported as
    keeping machines from properly powering down all the way.

    Signed-off-by: Balaji Rao
    Cc: Dave Jones
    Cc: Yi Yang
    Cc: Alan Stern
    Cc: Frans Pop
    Cc: Yinghai Lu
    Cc: Ingo Molnar
    Signed-off-by: Greg Kroah-Hartman

    Balaji Rao
     

07 Feb, 2008

4 commits

  • cpufreq support can't be built as a module. Fix the related configuration
    help message.

    Signed-off-by: Stefano Brivio
    Signed-off-by: Dave Jones

    Stefano Brivio
     
  • Eliminate cpufreq_userspace scaling_setspeed deadlock.

    Luming Yu recently uncovered yet another cpufreq related deadlock.
    One thread that continuously switches the governors and the other thread that
    repeatedly cats the contents of cpufreq directory causes both these threads to
    go into a deadlock.

    Detailed examination of the deadlock showed the exact flow before the deadlock
    as:

    Thread 1 Thread 2
    ________ ________
    cats files under /sys/devices/.../cpufreq/
    Set governor to userspace
    Adds a new sysfs entry for
    scaling_setspeed
    cats files under /sys/devices/.../cpufreq/

    Set governor to performance
    Holds cpufreq_rw_sem in write
    mode
    Sends a STOP notify to
    userspace governor
    cat /sys/devices/.../cpufreq/scaling_setspeed
    Gets a handle on the above sysfs entry with
    sysfs_get_active
    Blocks while trying to get cpufreq_rw_sem
    in read mode
    Remove a sysfs entry for
    scaling_setspeed
    Blocks on sysfs_deactivate
    while waiting for earlier
    get_active (on other thread)
    to drain

    At this point both threads go into deadlock and any other thread that tries to
    do anything with sysfs cpufreq will also block.

    There seems to be no easy way to avoid this deadlock as long as
    cpufreq_userspace adds/removes the sysfs entry under same kobject as cpufreq.
    Below patch moves scaling_setspeed to cpufreq.c, keeping it always and calling
    back the governor on read/write. This is the cleanest fix I could think of,
    even though adding two callbacks in governor structure just for this seems
    unnecessary.

    Note that the change makes scaling_setspeed under /sys/.../cpufreq permanent
    and returns when governor is not userspace.

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

    Venki Pallipadi
     
  • In freq_table.c, show_available_freqs()'s comment is oberviously wrong.
    Change the comment to a new one to avoid confusion.

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

    Fenghua Yu
     
  • Signed-off-by: Joe Perches
    Signed-off-by: Dave Jones

    Joe Perches
     

30 Jan, 2008

1 commit

  • The function __cpufreq_set_policy in file drivers/cpufreq/cpufreq.c
    has a very obvious error:

    if (policy->min > data->min && policy->min > policy->max) {
    ret = -EINVAL;
    goto error_out;
    }

    This condtion statement is wrong because it returns -EINVAL only if
    policy->min is greater than policy->max (in this case,
    "policy->min > data->min" is true for ever.). In fact, it should
    return -EINVAL as well if policy->max is less than data->min.

    The correct condition should be:

    if (policy->min > data->max || policy->max < data->min) {

    The following test result testifies the above conclusion:

    Before applying this patch:

    [root@yangyi-dev /]# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies
    2394000 1596000
    [root@yangyi-dev /]# echo 1596000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
    [root@yangyi-dev /]# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
    1596000
    [root@yangyi-dev /]# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
    1596000
    [root@yangyi-dev /]# echo "2000000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
    -bash: echo: write error: Invalid argument
    [root@yangyi-dev /]# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
    1596000
    [root@yangyi-dev /]# echo "0" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
    [root@yangyi-dev /]# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
    1596000
    [root@yangyi-dev /]# echo "1595000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
    [root@yangyi-dev /]# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
    1596000
    [root@yangyi-dev /]#

    After applying this patch:

    [root@yangyi-dev /]# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies
    2394000 1596000
    [root@yangyi-dev /]# echo 1596000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
    [root@yangyi-dev /]# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
    1596000
    [root@yangyi-dev /]# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
    1596000
    [root@localhost /]# echo "2000000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
    -bash: echo: write error: Invalid argument
    [root@localhost /]# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
    1596000
    [root@localhost /]# echo "0" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
    -bash: echo: write error: Invalid argument
    [root@localhost /]# echo "1595000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
    -bash: echo: write error: Invalid argument
    [root@localhost /]# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
    1596000
    [root@localhost /]# echo "1596000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
    [root@localhost /]# echo "2394000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
    [root@localhost /]# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
    2394000
    [root@localhost /]

    Signed-off-by: Yi Yang
    Signed-off-by: Ingo Molnar
    Signed-off-by: Thomas Gleixner

    Yi Yang
     

25 Jan, 2008

2 commits


18 Jan, 2008

1 commit

  • When the cpufreq driver starts up at boot time, it calls into the default
    governor which might not be initialised yet. This hurts when the
    governor's worker function relies on memory that is not yet set up by its
    init function.

    This migrates all governors from module_init() to fs_initcall() when being
    the default, as was already done in cpufreq_performance when it was the
    only possible choice. The performance governor is always initialized early
    because it might be used as fallback even when not being the default.

    Fixes at least one actual oops where ondemand is the default governor and
    cpufreq_governor_dbs() uses the uninitialised kondemand_wq work-queue
    during boot-time.

    Signed-off-by: Johannes Weiner
    Cc: Dave Jones
    Cc: "Rafael J. Wysocki"
    Cc: Venkatesh Pallipadi
    Acked-by: Ingo Molnar
    Cc: Thomas Gleixner
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Johannes Weiner
     

18 Dec, 2007

2 commits

  • cpufreq_stats_free_table() mustn't be __cpuexit since it's called by the
    __cpuinit cpufreq_stat_cpu_callback().

    This patch fixes the following section mismatch reported by
    Chris Clayton:

    WARNING: vmlinux.o(.init.text+0x143dd): Section mismatch: reference to .exit.text:cpufreq_stats_free_table (between 'cpufreq_stat_cpu_callback' and 'cpufreq_stats_init')

    Signed-off-by: Adrian Bunk
    Cc: Chris Clayton
    Acked-by: Dave Jones
    Cc: Russell King
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Adrian Bunk
     
  • Ingo hit some BUG_ONs that were probably caused by these missing unlocks
    causing an unbalance. He couldn't reproduce the bug reliably, so it's
    unknown that it's definitly fixing the problem he hit, but it's a fairly
    good chance, and this fixes an obvious bug.

    [ Dave: "Ingo followed up that he hit some lockdep related output with
    this applied, so it may not be right. I'll look at it after
    xmas if no-one has it figured out before then."
    Akpm: "It looks pretty correct to me though." ]

    Signed-off-by: Dave Jones
    Cc: Ingo Molnar
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Dave Jones
     

23 Oct, 2007

2 commits


13 Oct, 2007

2 commits

  • * master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6: (75 commits)
    PM: merge device power-management source files
    sysfs: add copyrights
    kobject: update the copyrights
    kset: add some kerneldoc to help describe what these strange things are
    Driver core: rename ktype_edd and ktype_efivar
    Driver core: rename ktype_driver
    Driver core: rename ktype_device
    Driver core: rename ktype_class
    driver core: remove subsystem_init()
    sysfs: move sysfs file poll implementation to sysfs_open_dirent
    sysfs: implement sysfs_open_dirent
    sysfs: move sysfs_dirent->s_children into sysfs_dirent->s_dir
    sysfs: make sysfs_root a regular directory dirent
    sysfs: open code sysfs_attach_dentry()
    sysfs: make s_elem an anonymous union
    sysfs: make bin attr open get active reference of parent too
    sysfs: kill unnecessary NULL pointer check in sysfs_release()
    sysfs: kill unnecessary sysfs_get() in open paths
    sysfs: reposition sysfs_dirent->s_mode.
    sysfs: kill sysfs_update_file()
    ...

    Linus Torvalds
     
  • A number of different drivers incorrect access the kobject name field
    directly. This is not correct as the name might not be in the array.
    Use the proper accessor function instead.

    Greg Kroah-Hartman