mirror of
https://github.com/torvalds/linux.git
synced 2026-11-25 16:02:57 +00:00
MWAITX can enable a timer and a corresponding timer value specified in SW P0 clocks. The SW P0 frequency is the same as TSC. The timer provides an upper bound on how long the instruction waits before exiting. This way, a delay function in the kernel can leverage that MWAITX timer of MWAITX. When a CPU core executes MWAITX, it will be quiesced in a waiting phase, diminishing its power consumption. This way, we can save power in comparison to our default TSC-based delays. A simple test shows that: $ cat /sys/bus/pci/devices/0000\:00\:18.4/hwmon/hwmon0/power1_acc $ sleep 10000s $ cat /sys/bus/pci/devices/0000\:00\:18.4/hwmon/hwmon0/power1_acc Results: * TSC-based default delay: 485115 uWatts average power * MWAITX-based delay: 252738 uWatts average power Thus, that's about 240 milliWatts less power consumption. The test method relies on the support of AMD CPU accumulated power algorithm in fam15h_power for which patches are forthcoming. Suggested-by: Andy Lutomirski <[email protected]> Suggested-by: Borislav Petkov <[email protected]> Suggested-by: Peter Zijlstra <[email protected]> Signed-off-by: Huang Rui <[email protected]> [ Fix delay truncation. ] Signed-off-by: Borislav Petkov <[email protected]> Cc: Aaron Lu <[email protected]> Cc: Andreas Herrmann <[email protected]> Cc: Aravind Gopalakrishnan <[email protected]> Cc: Fengguang Wu <[email protected]> Cc: Frédéric Weisbecker <[email protected]> Cc: H. Peter Anvin <[email protected]> Cc: Hector Marco-Gisbert <[email protected]> Cc: Jacob Shin <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: John Stultz <[email protected]> Cc: Len Brown <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Paolo Bonzini <[email protected]> Cc: Rafael J. Wysocki <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Tony Li <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
10 lines
169 B
C
10 lines
169 B
C
#ifndef _ASM_X86_DELAY_H
|
|
#define _ASM_X86_DELAY_H
|
|
|
|
#include <asm-generic/delay.h>
|
|
|
|
void use_tsc_delay(void);
|
|
void use_mwaitx_delay(void);
|
|
|
|
#endif /* _ASM_X86_DELAY_H */
|