[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: high temperature with gnumach and hurd



Farid Hajji <farid.hajji@ob.kamp.net> writes:

> > > > just wanted to tell you, that the temperature of my cpu is raising to
> > > > very high values, while having the hurd system running.
> > > > 
> > > > If I am working with linux, the temperature of the cpu is somewhere
> > > > below 600C (under heavy load), but if I boot the hurd thing and don't do
> > > > anything, the temperature raises to higher 60's and the bios temperature
> > > > warning starts howling.
> > > 
> > > This is intended behaviour: GNU/Hurd is a *hot* OS :-)
> > > 
> > > > Did anyone else recognize this problem?
> > > 
> > > Maybe GNUmach should idle/hlt the CPU when all tasks/threads
> > > are idle?
> > 
> >  This was sort of brought up a while ago with respect to a laptop.
> > Mach actively sends idle instructions to the cpu, so the cpu is always
> > at full usage, this may be causing the heat up.
> 
> Exactly. On x86, sending a hlt instruction will block the CPU
> until an interrupt trickles in (e.g. hw clock, etc...). 
> 
> I don't have GNUmach sources on the box I'm posting from right now,
> so here's how it is done on FreeBSD -STABLE:
> 
>   /usr/src/sys/i386/i386/machdep.c:
> 
>   /*
>    * Shutdown the CPU as much as possible
>    */
>   void
>   cpu_halt(void)
>   {
>           for (;;)
>                   __asm__ ("hlt");
>   }
> 
>   /*
>    * Hook to idle the CPU when possible.   This is disabled by default for
>    * the SMP case as there is a small window of opportunity whereby a ready
>    * process is delayed to the next clock tick.  It should be safe to enable
>    * for SMP if power is a concern.
>    *
>    * On -stable, cpu_idle() is called with interrupts disabled and must
>    * return with them enabled.
>    */
>   #ifdef SMP
>   static int      cpu_idle_hlt = 0;
>   #else
>   static int      cpu_idle_hlt = 1;
>   #endif
>   SYSCTL_INT(_machdep, OID_AUTO, cpu_idle_hlt, CTLFLAG_RW,
>       &cpu_idle_hlt, 0, "Idle loop HLT enable");
> 
>   void
>   cpu_idle(void)
>   {
>           if (cpu_idle_hlt) {
>                   /*
>                    * We must guarentee that hlt is exactly the instruction
>                    * following the sti.
>                    */
>                   __asm __volatile("sti; hlt");
>           } else {
>                   __asm __volatile("sti");
>           }
>   }
> 
> cpu_halt() and cpu_idle() are called from the scheduler in
> /usr/src/sys/i386/i386/swtch.s, but that's off topic here,
> so no need to reproduce that code.
> 
> Anyone with GNUmach sources available: could you please
> post the code of the idle loop? A quick fix for single
> CPU systems should be possible and painless, though there
> _will_ be issues in the SMP case.


In oskit/x86/main.c:

void
machine_idle (int mycpu)
{
  asm volatile ("hlt" : : : "memory");
}

Same for GNUMach 1.3. In the GNUMach 1.3 changelog I see this function
was added a few days before 1.3 was released. Perhaps Jochen is using
GNUMach 1.2?

Thanks,
Marco



Reply to: