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

Re: [Xen-ia64-devel] [Patch] fix pal halt of para domain



Hi Akio,

   Sorry, I should have responded to your last email on this topic.  I
still have issues with this approach.  Comments below.

On Fri, 2007-02-02 at 01:28 +0900, Akio Takebe wrote:
> diff -r ef646312685f linux-2.6-xen-sparse/arch/ia64/kernel/setup.c
> --- a/linux-2.6-xen-sparse/arch/ia64/kernel/setup.c     Wed Jan 31
> 10:59:56 2007 -0700
> +++ b/linux-2.6-xen-sparse/arch/ia64/kernel/setup.c     Fri Feb 02
> 01:44:36 2007 +0900
> @@ -63,6 +63,7 @@
>  #ifdef CONFIG_XEN
>  #include <asm/hypervisor.h>
>  #include <asm/xen/xencomm.h>
> +#include <asm/kdebug.h>
>  #endif
>  #include <linux/dma-mapping.h>
>  
> @@ -95,6 +96,18 @@ static struct notifier_block xen_panic_b
>  static struct notifier_block xen_panic_block = {
>         xen_panic_event, NULL, 0 /* try to go last */
>  };
> +static int
> +xen_poweroff_event(struct notifier_block *this, unsigned long event,
> void *ptr)
> +{
> +       if ( event == DIE_MACHINE_HALT )
> +               HYPERVISOR_shutdown(SHUTDOWN_poweroff);
> +       return NOTIFY_DONE;
> +}
> +
> +static struct notifier_block xen_poweroff_block = {
> +       xen_poweroff_event, NULL, 0 /* try to go last */
> +};
> +

   machine_halt() isn't supposed to power off the system.  The
processors should be left spinning and the domain will be halted, but
still in place.  machine_power_off() should certainly shutdown the
domain, but that's where the pm_power_off hook is useful.

>  #endif
>  
>  extern void ia64_setup_printk_clock(void);
> @@ -456,6 +469,7 @@ setup_arch (char **cmdline_p)
>                 /* Register a call for panic conditions. */
>                 atomic_notifier_chain_register(&panic_notifier_list,
>                                                &xen_panic_block);
> +               register_die_notifier(&xen_poweroff_block);
>         }
>  #endif
>  
> diff -r ef646312685f xen/arch/ia64/xen/fw_emul.c
> --- a/xen/arch/ia64/xen/fw_emul.c       Wed Jan 31 10:59:56 2007 -0700
> +++ b/xen/arch/ia64/xen/fw_emul.c       Fri Feb 02 01:44:36 2007 +0900
> @@ -385,6 +385,8 @@ xen_pal_emulator(unsigned long index, u6
>         unsigned long r10 = 0;
>         unsigned long r11 = 0;
>         long status = PAL_STATUS_UNIMPLEMENTED;
> +       struct vcpu *v;
> +       volatile unsigned long nr_online_vcpus;
>  
>         if (running_on_sim)
>                 return pal_emulator_static(index);
> @@ -606,8 +608,24 @@ xen_pal_emulator(unsigned long index, u6
>                         console_start_sync();
>                         (*efi.reset_system)(EFI_RESET_SHUTDOWN,0,0,NULL);
>                 }
> -               else
> -                       domain_shutdown(current->domain,
> SHUTDOWN_poweroff);
> +               else{
> +                       set_bit(_VCPUF_down, &current->vcpu_flags);
> +                       vcpu_sleep_nosync(current);
> +
> +                       LOCK_BIGLOCK(current->domain);
> +                       nr_online_vcpus = 0;
> +                       for_each_vcpu( current->domain, v ){
> +                               if ( !test_bit(_VCPUF_down,
> &v->vcpu_flags) ){
> +                                       nr_online_vcpus ++;
> +                               }
> +                       }       
> +                       UNLOCK_BIGLOCK(current->domain);
> +
> +                       if ( nr_online_vcpus == 0 ){
> +                               domain_shutdown(current->domain,
> SHUTDOWN_poweroff);
> +                       }
> +                       status = PAL_STATUS_SUCCESS;
> +               }

   I though we didn't need this since qemu emulates the S5 power off and
we can hook into pm_power_off for PV domains.  Did we figure out that
doesn't work?  Thanks,

        Alex

-- 
Alex Williamson                             HP Open Source & Linux Org.


_______________________________________________
Xen-ia64-devel mailing list
Xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ia64-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.