WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-ia64-devel

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

To: Akio Takebe <takebe_akio@xxxxxxxxxxxxxx>
Subject: Re: [Xen-ia64-devel] [Patch] fix pal halt of para domain
From: Alex Williamson <alex.williamson@xxxxxx>
Date: Thu, 01 Feb 2007 16:12:13 -0700
Cc: xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Thu, 01 Feb 2007 15:11:33 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <1FC7461E0229A8takebe_akio@xxxxxxxxxxxxxx>
List-help: <mailto:xen-ia64-devel-request@lists.xensource.com?subject=help>
List-id: Discussion of the ia64 port of Xen <xen-ia64-devel.lists.xensource.com>
List-post: <mailto:xen-ia64-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ia64-devel>, <mailto:xen-ia64-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ia64-devel>, <mailto:xen-ia64-devel-request@lists.xensource.com?subject=unsubscribe>
Organization: HP OSLO R&D
References: <1FC7461E0229A8takebe_akio@xxxxxxxxxxxxxx>
Sender: xen-ia64-devel-bounces@xxxxxxxxxxxxxxxxxxx
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