Skip to content

Commit ae817e6

Browse files
darcarirafaeljw
authored andcommitted
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: ebf5197 ("thermal: intel: powerclamp: Add two module parameters") Signed-off-by: David Arcari <[email protected]> Reviewed-by: Srinivas Pandruvada<[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent a57cc2d commit ae817e6

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

drivers/thermal/intel/intel_powerclamp.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,12 @@ static int max_idle_set(const char *arg, const struct kernel_param *kp)
235235
goto skip_limit_set;
236236
}
237237

238+
if (!cpumask_available(idle_injection_cpu_mask)) {
239+
ret = allocate_copy_idle_injection_mask(cpu_present_mask);
240+
if (ret)
241+
goto skip_limit_set;
242+
}
243+
238244
if (check_invalid(idle_injection_cpu_mask, new_max_idle)) {
239245
ret = -EINVAL;
240246
goto skip_limit_set;
@@ -791,7 +797,8 @@ static int __init powerclamp_init(void)
791797
return retval;
792798

793799
mutex_lock(&powerclamp_lock);
794-
retval = allocate_copy_idle_injection_mask(cpu_present_mask);
800+
if (!cpumask_available(idle_injection_cpu_mask))
801+
retval = allocate_copy_idle_injection_mask(cpu_present_mask);
795802
mutex_unlock(&powerclamp_lock);
796803

797804
if (retval)

0 commit comments

Comments
 (0)