• Rafael J. Wysocki's avatar
    cpuidle: Make cpuidle_enable_device() call poll_idle_init() · dbe128e9
    Rafael J. Wysocki authored
    commit d8c216cf upstream.
    
    The following scenario is possible with the current cpuidle code and
    the ACPI cpuidle driver:
    (1) acpi_processor_cst_has_changed() is called,
    (2) cpuidle_disable_device() is called,
    (3) cpuidle_remove_state_sysfs() is called to remove the (presumably
        outdated) states info from sysfs,
    (3) acpi_processor_get_power_info() is called, the first entry in the
        pr->power.states[] table is filled with zeros,
    (4) acpi_processor_setup_cpuidle() is called and it doesn't fill the
        first entry in pr->power.states[],
    (5) cpuidle_enable_device() is called,
    (6) __cpuidle_register_device() is _not_ called, since the device has
        already been registered,
    (7) Consequently, poll_idle_init() is _not_ called either,
    (8) cpuidle_add_state_sysfs() is called to create the sysfs attributes
        for the new states and it uses the bogus first table entry from
        acpi_processor_get_power_info() for creating state0.
    
    This problem is avoided if cpuidle_enable_device()
    unconditionally calls poll_idle_init().
    Reported-by: default avatarLen Brown <len.brown@intel.com>
    Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
    Signed-off-by: default avatarLen Brown <len.brown@intel.com>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
    dbe128e9
cpuidle.c 9.64 KB