Skip to content

Commit bc721c1

Browse files
committed
intel_idle: Clean up definitions of cpuidle callbacks
Add proper kerneldoc descriptions to intel_idle() and intel_idle_s2idle(), annotate the latter with __cpuidle and reorder the declarations of local variables in both of them to reflect the mwait_idle_with_hints() arguments order. No intentional functional impact. Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 40ab82e commit bc721c1

File tree

1 file changed

+27
-12
lines changed

1 file changed

+27
-12
lines changed

drivers/idle/intel_idle.c

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -892,19 +892,28 @@ static struct cpuidle_state dnv_cstates[] = {
892892
};
893893

894894
/**
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.
899908
*
900909
* Must be called under local_irq_disable().
901910
*/
902911
static __cpuidle int intel_idle(struct cpuidle_device *dev,
903912
struct cpuidle_driver *drv, int index)
904913
{
905-
unsigned long ecx = 1; /* break on interrupt flag */
906914
struct cpuidle_state *state = &drv->states[index];
907915
unsigned long eax = flg2MWAIT(state->flags);
916+
unsigned long ecx = 1; /* break on interrupt flag */
908917
bool uninitialized_var(tick);
909918
int cpu = smp_processor_id();
910919

@@ -937,16 +946,22 @@ static __cpuidle int intel_idle(struct cpuidle_device *dev,
937946
}
938947

939948
/**
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.
944959
*/
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)
947962
{
948-
unsigned long ecx = 1; /* break on interrupt flag */
949963
unsigned long eax = flg2MWAIT(drv->states[index].flags);
964+
unsigned long ecx = 1; /* break on interrupt flag */
950965

951966
mwait_idle_with_hints(eax, ecx);
952967
}

0 commit comments

Comments
 (0)