Re: [PATCH] Speedstep bug

2014-05-10 Thread Philip Guenther
On Sat, May 10, 2014 at 4:06 AM, Benjamin Baier wrote:
>
> After setting cpu clock to the minimum value in my BIOS, SpeedStep paniced
> on me.
> dmesg before and after patching at
> http://netzbasis.de/openbsd/speedstep/
>
> The patch below works for me, tested on amd64.
> low == high == 800
> cpuspeed == 798 (!)
>

Thanks for the report!

kettenis@ noted that there's no point in enabling speedstep if there
nothing to range over, so I've committed a slightly different diff to do
that instead.

Philip Guenther


[PATCH] Speedstep bug

2014-05-10 Thread Benjamin Baier

Hi tech@

After setting cpu clock to the minimum value in my BIOS, SpeedStep 
paniced on me.

dmesg before and after patching at
http://netzbasis.de/openbsd/speedstep/

The patch below works for me, tested on amd64.
low == high == 800
cpuspeed == 798 (!)

--- sys/arch/amd64/amd64/est.c.orig Fri May  9 00:14:22 2014
+++ sys/arch/amd64/amd64/est.c  Sat May 10 11:40:01 2014
@@ -424,7 +424,11 @@

low = est_fqlist->table[est_fqlist->n - 1].mhz;
high = est_fqlist->table[0].mhz;
-   perflevel = (cpuspeed - low) * 100 / (high - low);
+   if (low == high) {
+   perflevel = 0;
+   } else {
+   perflevel = (cpuspeed - low) * 100 / (high - low);
+   }

/*
 * OK, tell the user the available frequencies.

--- sys/arch/i386/i386/est.c.orig   Fri May  9 00:14:22 2014
+++ sys/arch/i386/i386/est.cSat May 10 11:40:01 2014
@@ -424,7 +424,11 @@

low = est_fqlist->table[est_fqlist->n - 1].mhz;
high = est_fqlist->table[0].mhz;
-   perflevel = (cpuspeed - low) * 100 / (high - low);
+   if (low == high) {
+   perflevel = 0;
+   } else {
+   perflevel = (cpuspeed - low) * 100 / (high - low);
+   }

/*
 * OK, tell the user the available frequencies.