[haiku-appserver] Re: CPU-idle-loop and HALT instruction?

  • From: "Rudolf" <drivers.be-hold@xxxxxxxxxxxx>
  • To: haiku-appserver@xxxxxxxxxxxxx
  • Date: Tue, 13 Dec 2005 22:11:11 +0100 CET

Hi folks :-)

So I take it I should find that file and simply remove the switch 
statement?
Thanks for the info :)

Rudolf.

BTW: Cool we have MTRR support! I'll try it asap :)

Rudolf.


> 
> On 2005-12-13 at 00:33:10 [+0100], Stephan Assmus <superstippi@xxxxxx
> > wrote:
> > On 2005-12-13 at 00:26:58 [+0100], Ingo Weinhold <bonefish@xxxxxx
> > berlin.de>
> > wrote:
> > > On 2005-12-12 at 23:52:06 [+0100], Stephan Assmus <
> > > superstippi@xxxxxx>
> > > wrote:
> > > > > > Or, is it already in there and can I somehow enable it?
> > > > > 
> > > > > From src/system/kernel/arch/x86/arch_cpu.c:
> > > > > 
> > > > > void
> > > > > arch_cpu_idle(void)
> > > > > {
> > > > >     switch (smp_get_num_cpus()) {
> > > > >         case 0:
> > > > >             panic("You need at least 1 CPU to run Haiku\n");
> > > > >         case 1:
> > > > >             asm("hlt");
> > > > >         default:
> > > > >             break;
> > > > >     }
> > > > > }
> > > > > 
> > > > > So, if you have more than one CPU, the only thing you can do 
> > > > > is change
> > > > > this
> > > > > code. There might be a reason, why it is implemented like it 
> > > > > is, 
> > > > > though.
> > > > > On
> > > > > the other hand there's also no comment that you computer will 
> > > > > explode
> > > > > when
> > > > > executing "hlt" on a multi CPU machine either...
> > > > 
> > > > I seem to recall that on my dual CPU machine, there is simply 
> > > > two idle
> > > > threads running. Or is my memory failing me?
> > > 
> > > No. The question was, what the idle threads are executing, 
> > > though. And
> > > that's
> > > the above function (in an endless loop).
> > 
> > Yeah, but why would a person with more than one CPU have to change 
> > that 
> > code,
> > if the real fix is making sure that there is simply as many idle 
> > threads as
> > CPUs? (Somewhere else form this code.) Or am I totally confused?
> 
> Yep, you're totally confused. ;-)
> There are as many idle threads as there are CPUs. Each of which 
> executing the 
> above function in a endless loop. The real fix is to change the above 
> code to 
> also execute "hlt" when there's more than one CPU. The only 
> suspicious thing 
> is why this hadn't been done in the first place.
> 
> CU, Ingo
> 
> 


Other related posts: