• Thomas Renninger's avatar
    [CPUFREQ] Bail out of cpufreq_add_dev if the link for a managed CPU got created · 4bfa042c
    Thomas Renninger authored
    Doing:
    echo 0 >cpu1/online
    echo 1 >cpu1/online
    
    on a managed CPU will result in:
    Jul 22 15:15:37 linux kernel: [   80.013864] WARNING: at fs/sysfs/dir.c:487 sysfs_add_one+0xcf/0xe6()
    Jul 22 15:15:37 linux kernel: [   80.013866] Hardware name: To Be Filled By O.E.M.
    Jul 22 15:15:37 linux kernel: [   80.013868] sysfs: cannot create duplicate filename '/devices/system/cpu/cpu1/cpufreq'
    Jul 22 15:15:37 linux kernel: [   80.013870] Modules linked in: powernow_k8
    Jul 22 15:15:37 linux kernel: [   80.013874] Pid: 5750, comm: bash Not tainted 2.6.31-rc2 #40
    Jul 22 15:15:37 linux kernel: [   80.013876] Call Trace:
    Jul 22 15:15:37 linux kernel: [   80.013879]  [<ffffffff8112ebda>] ? sysfs_add_one+0xcf/0xe6
    Jul 22 15:15:37 linux kernel: [   80.013884]  [<ffffffff81041926>] warn_slowpath_common+0x77/0xa4
    Jul 22 15:15:37 linux kernel: [   80.013888]  [<ffffffff810419a0>] warn_slowpath_fmt+0x3c/0x3e
    Jul 22 15:15:37 linux kernel: [   80.013891]  [<ffffffff8112ebda>] sysfs_add_one+0xcf/0xe6
    Jul 22 15:15:37 linux kernel: [   80.013894]  [<ffffffff8112f213>] create_dir+0x58/0x87
    Jul 22 15:15:37 linux kernel: [   80.013898]  [<ffffffff8112f27a>] sysfs_create_dir+0x38/0x4f
    Jul 22 15:15:37 linux kernel: [   80.013902]  [<ffffffff811ffb8a>] kobject_add_internal+0x11f/0x1de
    Jul 22 15:15:37 linux kernel: [   80.013905]  [<ffffffff811ffd21>] kobject_add_varg+0x41/0x4e
    Jul 22 15:15:37 linux kernel: [   80.013908]  [<ffffffff811ffd7a>] kobject_init_and_add+0x4c/0x57
    Jul 22 15:15:37 linux kernel: [   80.013913]  [<ffffffff810667bc>] ? mark_lock+0x22/0x228
    Jul 22 15:15:37 linux kernel: [   80.013918]  [<ffffffff813e8a3b>] cpufreq_add_dev_interface+0x40/0x1e4
    ...
    
    This bug slipped in by git commit:
    150b06f7f223cfd0f808737a5243cceca8ea47fa
    
    When splitting up cpufreq_add_dev, the whole cpufreq_add_dev function
    is not left anymore, only cpufreq_add_dev_policy.
    This patch should reconstruct the identical functionality again as it
    was before the split.
    
    CC: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
    Signed-off-by: default avatarThomas Renninger <trenn@suse.de>
    Signed-off-by: default avatarDave Jones <davej@redhat.com>
    4bfa042c
cpufreq.c 48.7 KB