1. 21 2月, 2016 1 次提交
  2. 02 1月, 2016 1 次提交
  3. 07 11月, 2015 2 次提交
    • V
      PM / OPP: Protect updates to list_dev with mutex · 87b4115d
      Viresh Kumar 提交于
      dev_opp_list_lock is used everywhere to protect device and OPP lists,
      but dev_pm_opp_set_sharing_cpus() is missed somehow. And instead we used
      rcu-lock, which wouldn't help here as we are adding a new list_dev.
      
      This also fixes a problem where we have called kzalloc(..., GFP_KERNEL)
      from within rcu-lock, which isn't allowed as kzalloc can sleep when
      called with GFP_KERNEL.
      
      With CONFIG_DEBUG_ATOMIC_SLEEP set, we get following lockdep-splat:
      
      include/linux/rcupdate.h:578 Illegal context switch in RCU read-side critical section!
      
      other info that might help us debug this:
      
      rcu_scheduler_active = 1, debug_locks = 0
      5 locks held by swapper/0/1:
       #0:  (&dev->mutex){......}, at: [<c02f68f4>] __driver_attach+0x48/0x98
       #1:  (&dev->mutex){......}, at: [<c02f6904>] __driver_attach+0x58/0x98
       #2:  (cpu_hotplug.lock){++++++}, at: [<c00249d0>] get_online_cpus+0x40/0xb0
       #3:  (subsys mutex#5){+.+.+.}, at: [<c02f4f8c>] subsys_interface_register+0x44/0xdc
       #4:  (rcu_read_lock){......}, at: [<c0305c80>] dev_pm_opp_set_sharing_cpus+0x0/0x1e4
      
      stack backtrace:
      CPU: 1 PID: 1 Comm: swapper/0 Tainted: G        W       4.3.0-rc7-00047-g81f5932958a8 #59
      Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
      [<c0016874>] (unwind_backtrace) from [<c001355c>] (show_stack+0x10/0x14)
      [<c001355c>] (show_stack) from [<c022553c>] (dump_stack+0x94/0xbc)
      [<c022553c>] (dump_stack) from [<c004904c>] (___might_sleep+0x24c/0x298)
      [<c004904c>] (___might_sleep) from [<c00f07e4>] (kmem_cache_alloc+0xe8/0x164)
      [<c00f07e4>] (kmem_cache_alloc) from [<c0305354>] (_add_list_dev+0x30/0x58)
      [<c0305354>] (_add_list_dev) from [<c0305d50>] (dev_pm_opp_set_sharing_cpus+0xd0/0x1e4)
      [<c0305d50>] (dev_pm_opp_set_sharing_cpus) from [<c040eda4>] (cpufreq_init+0x4cc/0x62c)
      [<c040eda4>] (cpufreq_init) from [<c040a964>] (cpufreq_online+0xbc/0x73c)
      [<c040a964>] (cpufreq_online) from [<c02f4fe0>] (subsys_interface_register+0x98/0xdc)
      [<c02f4fe0>] (subsys_interface_register) from [<c040a640>] (cpufreq_register_driver+0x110/0x17c)
      [<c040a640>] (cpufreq_register_driver) from [<c040ef64>] (dt_cpufreq_probe+0x60/0x8c)
      [<c040ef64>] (dt_cpufreq_probe) from [<c02f8084>] (platform_drv_probe+0x44/0xa4)
      [<c02f8084>] (platform_drv_probe) from [<c02f67c0>] (driver_probe_device+0x208/0x2f4)
      [<c02f67c0>] (driver_probe_device) from [<c02f6940>] (__driver_attach+0x94/0x98)
      [<c02f6940>] (__driver_attach) from [<c02f4c1c>] (bus_for_each_dev+0x68/0x9c)
      Reported-by: NMichael Turquette <mturquette@baylibre.com>
      Reviewed-by: NStephen Boyd <sboyd@codeaurora.org>
      Signed-off-by: NViresh Kumar <viresh.kumar@linaro.org>
      Cc: 4.3 <stable@vger.kernel.org> # 4.3
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      87b4115d
    • V
      PM / OPP: Propagate error properly from dev_pm_opp_set_sharing_cpus() · 1794ec1f
      Viresh Kumar 提交于
      We are returning 0 even in case of errors, fix it.
      
      Fixes: 8d4d4e98 ("PM / OPP: Add helpers for initializing CPU OPPs")
      Reported-by: NDan Carpenter <dan.carpenter@oracle.com>
      Reviewed-by: NStephen Boyd <sboyd@codeaurora.org>
      Signed-off-by: NViresh Kumar <viresh.kumar@linaro.org>
      Cc: 4.3 <stable@vger.kernel.org> # 4.3
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      1794ec1f
  4. 02 11月, 2015 1 次提交
  5. 10 10月, 2015 1 次提交
  6. 15 9月, 2015 2 次提交
  7. 07 8月, 2015 1 次提交
  8. 08 9月, 2014 1 次提交
  9. 07 8月, 2014 1 次提交
    • S
      cpufreq: OPP: Avoid sleeping while atomic · 3c5445ce
      Stephen Boyd 提交于
      We allocate the cpufreq table after calling rcu_read_lock(),
      which disables preemption. This causes scheduling while atomic
      warnings. Use GFP_ATOMIC instead of GFP_KERNEL and update for
      kcalloc while we're here.
      
      BUG: sleeping function called from invalid context at mm/slub.c:1246
      in_atomic(): 0, irqs_disabled(): 0, pid: 80, name: modprobe
      5 locks held by modprobe/80:
       #0:  (&dev->mutex){......}, at: [<c050d484>] __driver_attach+0x48/0x98
       #1:  (&dev->mutex){......}, at: [<c050d494>] __driver_attach+0x58/0x98
       #2:  (subsys mutex#5){+.+.+.}, at: [<c050c114>] subsys_interface_register+0x38/0xc8
       #3:  (cpufreq_rwsem){.+.+.+}, at: [<c05a9c8c>] __cpufreq_add_dev.isra.22+0x84/0x92c
       #4:  (rcu_read_lock){......}, at: [<c05ab24c>] dev_pm_opp_init_cpufreq_table+0x18/0x10c
      Preemption disabled at:[<  (null)>]   (null)
      
      CPU: 2 PID: 80 Comm: modprobe Not tainted 3.16.0-rc3-next-20140701-00035-g286857f216aa-dirty #217
      [<c0214da8>] (unwind_backtrace) from [<c02123f8>] (show_stack+0x10/0x14)
      [<c02123f8>] (show_stack) from [<c070141c>] (dump_stack+0x70/0xbc)
      [<c070141c>] (dump_stack) from [<c02f4cb0>] (__kmalloc+0x124/0x250)
      [<c02f4cb0>] (__kmalloc) from [<c05ab270>] (dev_pm_opp_init_cpufreq_table+0x3c/0x10c)
      [<c05ab270>] (dev_pm_opp_init_cpufreq_table) from [<bf000508>] (cpufreq_init+0x48/0x378 [cpufreq_generic])
      [<bf000508>] (cpufreq_init [cpufreq_generic]) from [<c05a9e08>] (__cpufreq_add_dev.isra.22+0x200/0x92c)
      [<c05a9e08>] (__cpufreq_add_dev.isra.22) from [<c050c160>] (subsys_interface_register+0x84/0xc8)
      [<c050c160>] (subsys_interface_register) from [<c05a9494>] (cpufreq_register_driver+0x108/0x2d8)
      [<c05a9494>] (cpufreq_register_driver) from [<bf000888>] (generic_cpufreq_probe+0x50/0x74 [cpufreq_generic])
      [<bf000888>] (generic_cpufreq_probe [cpufreq_generic]) from [<c050e994>] (platform_drv_probe+0x18/0x48)
      [<c050e994>] (platform_drv_probe) from [<c050d1f4>] (driver_probe_device+0x128/0x370)
      [<c050d1f4>] (driver_probe_device) from [<c050d4d0>] (__driver_attach+0x94/0x98)
      [<c050d4d0>] (__driver_attach) from [<c050b778>] (bus_for_each_dev+0x54/0x88)
      [<c050b778>] (bus_for_each_dev) from [<c050c894>] (bus_add_driver+0xe8/0x204)
      [<c050c894>] (bus_add_driver) from [<c050dd48>] (driver_register+0x78/0xf4)
      [<c050dd48>] (driver_register) from [<c0208870>] (do_one_initcall+0xac/0x1d8)
      [<c0208870>] (do_one_initcall) from [<c028b6b4>] (load_module+0x190c/0x21e8)
      [<c028b6b4>] (load_module) from [<c028c034>] (SyS_init_module+0xa4/0x110)
      [<c028c034>] (SyS_init_module) from [<c020f0c0>] (ret_fast_syscall+0x0/0x48)
      
      Fixes: a0dd7b79 (PM / OPP: Move cpufreq specific OPP functions out of generic OPP library)
      Signed-off-by: NStephen Boyd <sboyd@codeaurora.org>
      Acked-by: NViresh Kumar <viresh.kumar@linaro.org>
      Cc: 3.16+ <stable@vger.kernel.org> # 3.16+
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      3c5445ce
  10. 07 5月, 2014 1 次提交