提交 ae817e61 编写于 作者: D David Arcari 提交者: Rafael J. Wysocki

thermal: intel: powerclamp: Fix cpumask and max_idle module parameters

When cpumask is specified as a module parameter the value is
overwritten by the module init routine.  This can easily be fixed
by checking to see if the mask has already been allocated in the
init routine.

When max_idle is specified as a module parameter a panic will occur.
The problem is that the idle_injection_cpu_mask is not allocated until
the module init routine executes. This can easily be fixed by allocating
the cpumask if it's not already allocated.

Fixes: ebf51971 ("thermal: intel: powerclamp: Add two module parameters")
Signed-off-by: NDavid Arcari <darcari@redhat.com>
Reviewed-by: Srinivas Pandruvada<srinivas.pandruvada@linux.intel.com>
Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
上级 a57cc2db
...@@ -235,6 +235,12 @@ static int max_idle_set(const char *arg, const struct kernel_param *kp) ...@@ -235,6 +235,12 @@ static int max_idle_set(const char *arg, const struct kernel_param *kp)
goto skip_limit_set; goto skip_limit_set;
} }
if (!cpumask_available(idle_injection_cpu_mask)) {
ret = allocate_copy_idle_injection_mask(cpu_present_mask);
if (ret)
goto skip_limit_set;
}
if (check_invalid(idle_injection_cpu_mask, new_max_idle)) { if (check_invalid(idle_injection_cpu_mask, new_max_idle)) {
ret = -EINVAL; ret = -EINVAL;
goto skip_limit_set; goto skip_limit_set;
...@@ -791,6 +797,7 @@ static int __init powerclamp_init(void) ...@@ -791,6 +797,7 @@ static int __init powerclamp_init(void)
return retval; return retval;
mutex_lock(&powerclamp_lock); mutex_lock(&powerclamp_lock);
if (!cpumask_available(idle_injection_cpu_mask))
retval = allocate_copy_idle_injection_mask(cpu_present_mask); retval = allocate_copy_idle_injection_mask(cpu_present_mask);
mutex_unlock(&powerclamp_lock); mutex_unlock(&powerclamp_lock);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册