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

Re: [Xen-devel] [PATCH 22/22] mini-os: support idle for HVMlite



Juergen Gross, on Tue 23 Aug 2016 17:16:08 +0200, wrote:
> Instead of calling HYPERVISOR_sched_op(SCHEDOP_block, 0) we need to use
> the "hlt" instruction with interrupts enabled to switch to idle when
> running as HVMlite domain.
> 
> This requires to setup a new timer in the timer handler as there is no
> guarantee the original timer event we are waiting for won't fire
> between enabling interrupts and calling "hlt".
> 
> Signed-off-by: Juergen Gross <jgross@xxxxxxxx>

Reviewed-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxx>

> ---
>  arch/x86/time.c | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/x86/time.c b/arch/x86/time.c
> index af45e56..3658142 100644
> --- a/arch/x86/time.c
> +++ b/arch/x86/time.c
> @@ -212,17 +212,20 @@ void block_domain(s_time_t until)
>      if(monotonic_clock() < until)
>      {
>          HYPERVISOR_set_timer_op(until);
> +#ifdef CONFIG_PARAVIRT
>          HYPERVISOR_sched_op(SCHEDOP_block, 0);
> +#else
> +        local_irq_enable();
> +        asm volatile ( "hlt" : : : "memory" );
> +#endif
>          local_irq_disable();
> +        HYPERVISOR_set_timer_op(0);
>      }
>  }
>  
> -
> -/*
> - * Just a dummy
> - */
>  static void timer_handler(evtchn_port_t ev, struct pt_regs *regs, void *ign)
>  {
> +    HYPERVISOR_set_timer_op(monotonic_clock() + MILLISECS(1));
>  }
>  
>  
> -- 
> 2.6.6
> 

-- 
Samuel
Linux, c'est simple : ça s'adresse à une machine qui est parfois un peu
maraboutée mais qui d'habitude n'a pas d'états d'âme. Sur Usenet y'a
plein d'humains et de primates, et ça devient vraiment gore par moment.
-+- TP in : Guide du linuxien pervers - "Le linuxien a-t-il une âme ?" -+-

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

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