From: Ashley Pittman <ashley@quadrics.com>
To: Dave Jones <davej@redhat.com>
Cc: cpufreq <cpufreq@www.linux.org.uk>
Subject: Re: Patch to stop i386 longhaul from deadlocking the kernel
Date: Thu, 20 Nov 2003 14:12:57 +0000 [thread overview]
Message-ID: <1069337577.26134.1366.camel@ashley> (raw)
In-Reply-To: <20031120134012.GG5653@redhat.com>
On Thu, 2003-11-20 at 13:40, Dave Jones wrote:
> On Thu, Nov 20, 2003 at 01:24:04PM +0000, Ashley Pittman wrote:
> > The computer is at home today but it's one of the 800Mhz boards, the fsb
> > is 133, multiplier of 60. The speed should therefore be 798 but cpu_khz
> > is reporting it as 800. Then it's just a case of how many bits you need
> > to remove of before 798==800. The result is that they both need to
> > equal 768. I've attached a user-space program which demonstrates this
> > with output.
>
> Right, so the anding is catching the case of overflow, but neglecting
> underflow. It seems to do the right thing if I change guess_fsb to do this..
> I need to think about this some more. I'm not entirely comfortable with
> that, it looks somewhat fragile, though I can see why it works.
Isn't the correct thing to do to increase the speed before anding it?
That way it will always end up in the right bin. The following code
works for me and does feel right. A value of 0x7 is all thats needed to
get the right answer on my machine in this case.
static int _guess (int guess, int maxmult)
{
int target;
target = ((maxmult/10)*guess);
if (maxmult%10 != 0)
target += (guess/2);
target += SPEEDKLUDGE/2;
target &= ~SPEEDKLUDGE;
printf("Working... guess %d maxmult %d target %d %#x\n",
guess,maxmult,target,target);
return target;
}
static int guess_fsb(int maxmult)
{
int speed = (cpu_khz/1000);
int i;
int speeds[3] = { 66, 100, 133 };
speed += SPEEDKLUDGE/2;
speed &= ~SPEEDKLUDGE;
printf("Kludge is %d %#x\n",(int)SPEEDKLUDGE,(int)SPEEDKLUDGE);
printf("Speed is %d %#x (%d %#x)\n",
speed,speed,
(cpu_khz/1000),(cpu_khz/1000));
for (i=0; i<3; i++) {
if (_guess(speeds[i],maxmult) == speed)
return speeds[i];
}
return 0;
}
prev parent reply other threads:[~2003-11-20 14:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-11-05 15:19 Patch to stop i386 longhaul from deadlocking the kernel Ashley Pittman
2003-11-20 12:46 ` Dave Jones
2003-11-20 13:24 ` Ashley Pittman
2003-11-20 13:40 ` Dave Jones
2003-11-20 14:12 ` Ashley Pittman [this message]
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=1069337577.26134.1366.camel@ashley \
--to=ashley@quadrics.com \
--cc=cpufreq@www.linux.org.uk \
--cc=davej@redhat.com \
/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