@@ -892,19 +892,28 @@ static struct cpuidle_state dnv_cstates[] = {
892
892
};
893
893
894
894
/**
895
- * intel_idle
896
- * @dev: cpuidle_device
897
- * @drv: cpuidle driver
898
- * @index: index of cpuidle state
895
+ * intel_idle - Ask the processor to enter the given idle state.
896
+ * @dev: cpuidle device of the target CPU.
897
+ * @drv: cpuidle driver (assumed to point to intel_idle_driver).
898
+ * @index: Target idle state index.
899
+ *
900
+ * Use the MWAIT instruction to notify the processor that the CPU represented by
901
+ * @dev is idle and it can try to enter the idle state corresponding to @index.
902
+ *
903
+ * If the local APIC timer is not known to be reliable in the target idle state,
904
+ * enable one-shot tick broadcasting for the target CPU before executing MWAIT.
905
+ *
906
+ * Optionally call leave_mm() for the target CPU upfront to avoid wakeups due to
907
+ * flushing user TLBs.
899
908
*
900
909
* Must be called under local_irq_disable().
901
910
*/
902
911
static __cpuidle int intel_idle (struct cpuidle_device * dev ,
903
912
struct cpuidle_driver * drv , int index )
904
913
{
905
- unsigned long ecx = 1 ; /* break on interrupt flag */
906
914
struct cpuidle_state * state = & drv -> states [index ];
907
915
unsigned long eax = flg2MWAIT (state -> flags );
916
+ unsigned long ecx = 1 ; /* break on interrupt flag */
908
917
bool uninitialized_var (tick );
909
918
int cpu = smp_processor_id ();
910
919
@@ -937,16 +946,22 @@ static __cpuidle int intel_idle(struct cpuidle_device *dev,
937
946
}
938
947
939
948
/**
940
- * intel_idle_s2idle - simplified "enter" callback routine for suspend-to-idle
941
- * @dev: cpuidle_device
942
- * @drv: cpuidle driver
943
- * @index: state index
949
+ * intel_idle_s2idle - Ask the processor to enter the given idle state.
950
+ * @dev: cpuidle device of the target CPU.
951
+ * @drv: cpuidle driver (assumed to point to intel_idle_driver).
952
+ * @index: Target idle state index.
953
+ *
954
+ * Use the MWAIT instruction to notify the processor that the CPU represented by
955
+ * @dev is idle and it can try to enter the idle state corresponding to @index.
956
+ *
957
+ * Invoked as a suspend-to-idle callback routine with frozen user space, frozen
958
+ * scheduler tick and suspended scheduler clock on the target CPU.
944
959
*/
945
- static void intel_idle_s2idle (struct cpuidle_device * dev ,
946
- struct cpuidle_driver * drv , int index )
960
+ static __cpuidle void intel_idle_s2idle (struct cpuidle_device * dev ,
961
+ struct cpuidle_driver * drv , int index )
947
962
{
948
- unsigned long ecx = 1 ; /* break on interrupt flag */
949
963
unsigned long eax = flg2MWAIT (drv -> states [index ].flags );
964
+ unsigned long ecx = 1 ; /* break on interrupt flag */
950
965
951
966
mwait_idle_with_hints (eax , ecx );
952
967
}
0 commit comments