On Fri, 22 Sep 2000, Takaya Ogawa wrote:

> Attached patch adds back the HLT in i386 UP case and
> seems to fix my problem, although I'm totally
> unfamiliar with SMP nor alpha.

This has the race bug that was fixed in rev.1.88 of swtch.s.

I use the folowing fix.  It also fixes the loss of page cleaning in the
idle routine.  It hasn't been committed mainly because idle page cleaning
hasn't been tested for the SMP case or implemented for alphas (the alpha's
vm_page_zero_idle() has apparently never been used).

Most of the #include changes are unrelated.  They are wrong fixes for spam
in <machine/globaldata.h>.

diff -c2 kern_idle.c~ kern_idle.c
*** kern_idle.c~        Sun Sep 17 04:27:14 2000
--- kern_idle.c Sun Sep 17 23:07:41 2000
***************
*** 29,34 ****
  #include <machine/ipl.h>
  #include <machine/mutex.h>
- #include <machine/smp.h>
  
  #include <machine/globaldata.h>
  #include <machine/globals.h>
--- 29,41 ----
  #include <machine/ipl.h>
  #include <machine/mutex.h>
  
+ #ifdef __i386__ /* XXX */
+ #ifdef SMP
+ #include <vm/pmap.h>
+ #endif
+ #include <machine/md_var.h>
+ #include <machine/segments.h>
+ #include <machine/tss.h>
+ #endif
  #include <machine/globaldata.h>
  #include <machine/globals.h>
***************
*** 40,43 ****
--- 47,52 ----
  #endif
  
+ extern void (*_hlt_vector)(void);
+ 
  static void idle_setup(void *dummy);
  SYSINIT(idle_setup, SI_SUB_SCHED_IDLE, SI_ORDER_FIRST, idle_setup, NULL)
***************
*** 84,88 ****
--- 93,107 ----
                count = 0;
  
+ #ifdef __i386__
+               disable_intr();
+ #endif
                while (count >= 0 && procrunnable() == 0) {
+ #ifdef __i386__
+                       if (vm_page_zero_idle() != 0)
+                               continue;
+                       (*_hlt_vector)();
+                       disable_intr();
+                       continue;
+ #endif
                /*
                 * This is a good place to put things to be done in
***************
*** 93,96 ****
--- 112,118 ----
                                    " for a process");
                }
+ #ifdef __i386__
+               enable_intr();
+ #endif
  
                mtx_enter(&sched_lock, MTX_SPIN);



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to