cpufreq Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Dominik Brodowski <linux@brodo.de>
To: davej@codemonkey.org.uk, cpufreq@www.linux.org.uk
Subject: [PATCH][BUG #1422] avoid hang with speedstep-smi on Dell Latitude C600
Date: Wed, 12 Nov 2003 18:58:49 +0100	[thread overview]
Message-ID: <20031112175849.GA5946@brodo.de> (raw)

[ http://bugme.osdl.org/show_bug.cgi?id=1422 ]

The speedstep_smi_get_freqs call caused a hang on a Dell C600. On
some other systems, the speedstep_smi_get_freqs call fails even though
this cpufreq driver works fine otherwise. All these systems have one
thing in common: ist_info.event is either 0x00000000 or 0x00ff0000. So,
don't call speedstep_smi_get_freqs on these systems.

diff -ruN linux-original/arch/i386/kernel/cpu/cpufreq/speedstep-smi.c linux/arch/i386/kernel/cpu/cpufreq/speedstep-smi.c
--- linux-original/arch/i386/kernel/cpu/cpufreq/speedstep-smi.c	2003-11-11 22:32:49.847042344 +0100
+++ linux/arch/i386/kernel/cpu/cpufreq/speedstep-smi.c	2003-11-11 22:38:01.990589312 +0100
@@ -86,6 +86,9 @@
 /**
  * speedstep_smi_get_freqs - get SpeedStep preferred & current freq.
  *
+ * Only available on later SpeedStep-enabled systems, returns false results or
+ * even hangs [cf. bugme.osdl.org # 1422] on earlier systems. Empirical testing
+ * shows that the latter occurs if !(ist_info.event & 0xFFFF).
  */
 static int speedstep_smi_get_freqs (unsigned int *low, unsigned int *high)
 {
@@ -226,17 +229,23 @@
 
 	result = speedstep_smi_ownership();
 
-	if (result)
+	if (result) {
 		dprintk(KERN_INFO "cpufreq: fails an aquiring ownership of a SMI interface.\n");
+		return -EINVAL;
+	}
 
 	/* detect low and high frequency */
-	result = speedstep_smi_get_freqs(&speedstep_freqs[SPEEDSTEP_LOW].frequency,
+	if (ist_info.event & 0xFFFF) {
+		result = speedstep_smi_get_freqs(&speedstep_freqs[SPEEDSTEP_LOW].frequency,
 				&speedstep_freqs[SPEEDSTEP_HIGH].frequency);
-	if (result) {
+		if (result) {
+			dprintk(KERN_INFO PFX "could not detect low and high frequencies by SMI call.\n");
+		}
+	}
+	if ((result) || !(ist_info.event & 0xFFFF)) {
 		/* fall back to speedstep_lib.c dection mechanism: try both states out */
 		unsigned int speedstep_processor = speedstep_detect_processor();
 
-		dprintk(KERN_INFO PFX "could not detect low and high frequencies by SMI call.\n");
 		if (!speedstep_processor)
 			return -ENODEV;
 
@@ -248,8 +257,7 @@
 		if (result) {
 			dprintk(KERN_INFO PFX "could not detect two different speeds -- aborting.\n");
 			return result;
-		} else
-			dprintk(KERN_INFO PFX "workaround worked.\n");
+		}
 	}
 
 	/* get current speed setting */

                 reply	other threads:[~2003-11-12 17:58 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20031112175849.GA5946@brodo.de \
    --to=linux@brodo.de \
    --cc=cpufreq@www.linux.org.uk \
    --cc=davej@codemonkey.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox