ACPI / cpuidle: fix max idle state handling with hotplug CPU support
authorBartlomiej Zolnierkiewicz <[email protected]>
Fri, 20 Dec 2013 18:47:26 +0000 (19:47 +0100)
committerRafael J. Wysocki <[email protected]>
Sat, 11 Jan 2014 00:26:49 +0000 (01:26 +0100)
commit7ca380f60626d90cdd17cc60de5e756422e35b2a
tree6d7301a6da09d0804f948fcb9860d69c34926c98
parent7f74dc0f4f5fdb745d62ab2e8f6c60cd9e59a1ac
ACPI / cpuidle: fix max idle state handling with hotplug CPU support

acpi_processor_hotplug() calls acpi_processor_setup_cpuidle_cx()
without calling acpi_processor_setup_cpuidle_states() first so it
is possible that dev->state_count becomes different from
drv->state_count (in case of SMP system with unsupported C2/C3
states + enabled CPU hotplug and num_online_cpus() becoming > 1).

The driver code assumes that cpuidle core will handle such cases
but currently this is untrue (dev->state_count is used only for
handling cpuidle state sysfs entries and drv->state_count is used
for all other cases) and will not be fixed in the future as
dev->state_count is planned to be removed.

Fix the issue by checking for the max supported idle state in
C2/C3 state's ->enter handler (acpi_idle_enter_simple() for C2/C3
and acpi_idle_enter_bm() for C3 + bm_check flag set) and setting
the C1 state (instead of higher states) when needed.

Also remove no longer needed max idle state checks from
acpi_processor_setup_cpuidle_[states,cx]().

Signed-off-by: Bartlomiej Zolnierkiewicz <[email protected]>
Signed-off-by: Kyungmin Park <[email protected]>
Cc: Len Brown <[email protected]>
Signed-off-by: Rafael J. Wysocki <[email protected]>
drivers/acpi/processor_idle.c