powernow-k6: disable cache when changing frequency
authorMikulas Patocka <mpatocka@redhat.com>
Tue, 8 Apr 2014 22:03:54 +0000 (18:03 -0400)
committerWilly Tarreau <w@1wt.eu>
Mon, 19 May 2014 05:54:25 +0000 (07:54 +0200)
commit923a78074bfb799508bea3ca3700ee29da7fc58d
tree262b43d7cf8f18620970db646c96f161186fc258
parent9d73a68445d6a36c9fabd96906663c5db4a685ff
powernow-k6: disable cache when changing frequency

commit e20e1d0ac02308e2211306fc67abcd0b2668fb8b upstream

I found out that a system with k6-3+ processor is unstable during network
server load. The system locks up or the network card stops receiving. The
reason for the instability is the CPU frequency scaling.

During frequency transition the processor is in "EPM Stop Grant" state.
The documentation says that the processor doesn't respond to inquiry
requests in this state. Consequently, coherency of processor caches and
bus master devices is not maintained, causing the system instability.

This patch flushes the cache during frequency transition. It fixes the
instability.

Other minor changes:
* u64 invalue changed to unsigned long because the variable is 32-bit
* move the logic to set the multiplier to a separate function
  powernow_k6_set_cpu_multiplier
* preserve lower 5 bits of the powernow port instead of 4 (the voltage
  field has 5 bits)
* mask interrupts when reading the multiplier, so that the port is not
  open during other activity (running other kernel code with the port open
  shouldn't cause any misbehavior, but we should better be safe and keep
  the port closed)

This patch should be backported to all stable kernels. If it doesn't
apply cleanly, change it, or ask me to change it.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Willy Tarreau <w@1wt.eu>
arch/x86/kernel/cpu/cpufreq/powernow-k6.c