lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20090611152603.8510.31943.sendpatchset@linux-fd7s.americas.hpqcorp.net>
Date:	Thu, 11 Jun 2009 15:26:48 +0000 (UTC)
From:	Naga Chumbalkar <nagananda.chumbalkar@...com>
To:	davej@...emonkey.org.uk
Cc:	Naga Chumbalkar <nagananda.chumbalkar@...com>,
	andreas.herrmann3@....com, linux-kernel@...r.kernel.org,
	cpufreq@...r.kernel.org, mark.langsdorf@....com, trenn@...e.de
Subject: [PATCH 1/2] powernow-k8: read P-state from HW


By definition, "cpuinfo_cur_freq" should report the value from HW. So, don't
depend on the cached value. Instead read P-state directly from HW, while
taking into account the erratum 311 workaround for Fam 11h processors.


Cc: Andreas Herrmann <andreas.herrmann3@....com>
Cc: Langsdorf, Mark <mark.langsdorf@....com>
Cc: Thomas Renninger <trenn@...e.de>

Signed-off-by: Naga Chumbalkar <nagananda.chumbalkar@...com>
Reviewed-by: Andreas Herrmann <andreas.herrmann3@....com>
Tested-by: Andreas Herrmann <andreas.herrmann3@....com>
Acked-by: Langsdorf, Mark <mark.langsdorf@....com>
Signed-off-by: Thomas Renninger <trenn@...e.de>

---
 arch/x86/kernel/cpu/cpufreq/powernow-k8.c |   25 +++++++++++--------------
 1 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
index cf52215..700ede9 100644
--- a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
+++ b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
@@ -117,20 +117,17 @@ static int query_current_values_with_pending_wait(struct powernow_k8_data *data)
 	u32 i = 0;
 
 	if (cpu_family == CPU_HW_PSTATE) {
-		if (data->currpstate == HW_PSTATE_INVALID) {
-			/* read (initial) hw pstate if not yet set */
-			rdmsr(MSR_PSTATE_STATUS, lo, hi);
-			i = lo & HW_PSTATE_MASK;
-
-			/*
-			 * a workaround for family 11h erratum 311 might cause
-			 * an "out-of-range Pstate if the core is in Pstate-0
-			 */
-			if (i >= data->numps)
-				data->currpstate = HW_PSTATE_0;
-			else
-				data->currpstate = i;
-		}
+		rdmsr(MSR_PSTATE_STATUS, lo, hi);
+		i = lo & HW_PSTATE_MASK;
+		data->currpstate = i;
+
+		/*
+		 * a workaround for family 11h erratum 311 might cause
+		 * an "out-of-range Pstate if the core is in Pstate-0
+		 */
+		if ((boot_cpu_data.x86 == 0x11) && (i >= data->numps))
+			data->currpstate = HW_PSTATE_0;
+
 		return 0;
 	}
 	do {
-- 
1.6.2.2

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ