Pull extend-notify-die into release branch
authorTony Luck <tony.luck@intel.com>
Thu, 10 Nov 2005 18:39:09 +0000 (10:39 -0800)
committerTony Luck <tony.luck@intel.com>
Thu, 10 Nov 2005 18:39:09 +0000 (10:39 -0800)
1  2 
arch/ia64/kernel/process.c

index 640d6908f8ec9727525f798fd306af5f981617eb,c78355cb890223dca4f6fe305da9a1c610d5f49a..e92ea64d8040a807bc59800f266259859384683c
@@@ -4,6 -4,9 +4,9 @@@
   * Copyright (C) 1998-2003 Hewlett-Packard Co
   *    David Mosberger-Tang <davidm@hpl.hp.com>
   * 04/11/17 Ashok Raj <ashok.raj@intel.com> Added CPU Hotplug Support
+  *
+  * 2005-10-07 Keith Owens <kaos@sgi.com>
+  *          Add notify_die() hooks.
   */
  #define __KERNEL_SYSCALLS__   /* see <asm/unistd.h> */
  #include <linux/config.h>
@@@ -34,6 -37,7 +37,7 @@@
  #include <asm/elf.h>
  #include <asm/ia32.h>
  #include <asm/irq.h>
+ #include <asm/kdebug.h>
  #include <asm/pgalloc.h>
  #include <asm/processor.h>
  #include <asm/sal.h>
@@@ -197,15 -201,11 +201,15 @@@ voi
  default_idle (void)
  {
        local_irq_enable();
 -      while (!need_resched())
 -              if (can_do_pal_halt)
 -                      safe_halt();
 -              else
 +      while (!need_resched()) {
 +              if (can_do_pal_halt) {
 +                      local_irq_disable();
 +                      if (!need_resched())
 +                              safe_halt();
 +                      local_irq_enable();
 +              } else
                        cpu_relax();
 +      }
  }
  
  #ifdef CONFIG_HOTPLUG_CPU
@@@ -267,16 -267,16 +271,16 @@@ void __attribute__((noreturn)
  cpu_idle (void)
  {
        void (*mark_idle)(int) = ia64_mark_idle;
 +      int cpu = smp_processor_id();
 +      set_thread_flag(TIF_POLLING_NRFLAG);
  
        /* endless idle loop with no priority at all */
        while (1) {
 +              if (!need_resched()) {
 +                      void (*idle)(void);
  #ifdef CONFIG_SMP
 -              if (!need_resched())
                        min_xtp();
  #endif
 -              while (!need_resched()) {
 -                      void (*idle)(void);
 -
                        if (__get_cpu_var(cpu_idle_state))
                                __get_cpu_var(cpu_idle_state) = 0;
  
                        if (!idle)
                                idle = default_idle;
                        (*idle)();
 -              }
 -
 -              if (mark_idle)
 -                      (*mark_idle)(0);
 -
 +                      if (mark_idle)
 +                              (*mark_idle)(0);
  #ifdef CONFIG_SMP
 -              normal_xtp();
 +                      normal_xtp();
  #endif
 +              }
 +              preempt_enable_no_resched();
                schedule();
 +              preempt_disable();
                check_pgt_cache();
 -              if (cpu_is_offline(smp_processor_id()))
 +              if (cpu_is_offline(cpu))
                        play_dead();
        }
  }
@@@ -808,12 -808,14 +812,14 @@@ cpu_halt (void
  void
  machine_restart (char *restart_cmd)
  {
+       (void) notify_die(DIE_MACHINE_RESTART, restart_cmd, NULL, 0, 0, 0);
        (*efi.reset_system)(EFI_RESET_WARM, 0, 0, NULL);
  }
  
  void
  machine_halt (void)
  {
+       (void) notify_die(DIE_MACHINE_HALT, "", NULL, 0, 0, 0);
        cpu_halt();
  }