[PATCH v6 0/2] x86, mwaitt: introduce AMD mwaitt support

From: Huang Rui
Date: Tue Aug 04 2015 - 23:35:28 EST


Hi,

This patch set introduces a new instruction support on AMD Carrizo (Family
15h, Model 60h-6fh). It adds mwaitx delay function with a configurable
timer.

Andy and Boris provide a suggestion which uses mwaitx on delay method.

As Peter's suggestion of last version (v5), the serial of patch set
provides a test result.
http://marc.info/?l=linux-kernel&m=143436586513713&w=2

Some discussions of the background, please see:
http://marc.info/?l=linux-kernel&m=143202042530498&w=2
http://marc.info/?l=linux-kernel&m=143161327003541&w=2
http://marc.info/?l=linux-kernel&m=143222815331016&w=2

Patch set is rebased on tip/master.

Changes from v1 -> v2
- Remove mwaitx idle implementation since some disputes without power
improvement.
- Add a patch which implement another use case on delay.
- Introduce a kernel parameter (delay) to make delay method configurable.

Changes from v2 -> v3
- Add compared data on commit message
- Remove kernel parameter
- Add hint to avoid to access deep state in future
- Update mwaitx delay method as Petter's suggestion

Changes from v3 -> v4
- Put the MONITORX/MWAITX description into comments

Changes from v4 -> v5
- Remove mwaitx function
- Use mwaitx_delay at init_amd
- Use cpu_tts as montioring address scope

Changes from v5 -> v6
- Move definitions into patch 1
- Completed the power consumption testing both with MWAITX and without
MWAITX
- Use mwaitx_delay at bsp_init_amd

In MWAITX delay, the CPU core will be quiesced in a waiting phase,
diminishing its power consumption.

Run a simple test to measure power consumption:

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;

* 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
fam15_power for which patches are forthcoming.

Thanks,
Rui

Huang Rui (2):
x86, mwaitt: add monitorx and mwaitx instruction
x86, mwaitt: introduce mwaitx delay with a configurable timer

arch/x86/include/asm/cpufeature.h | 1 +
arch/x86/include/asm/delay.h | 1 +
arch/x86/include/asm/mwait.h | 43 +++++++++++++++++++++++++++++++++++
arch/x86/kernel/cpu/amd.c | 4 ++++
arch/x86/lib/delay.c | 48 ++++++++++++++++++++++++++++++++++++++-
5 files changed, 96 insertions(+), 1 deletion(-)

--
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/