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

Re: [Minios-devel] [UNIKRAFT PATCHv4 38/43] plat/kvm: Implement shutdown for Arm64



Hi Julien,

> -----Original Message-----
> From: Julien Grall
> Sent: 2018年7月20日 15:55
> To: Wei Chen <Wei.Chen@xxxxxxx>; minios-devel@xxxxxxxxxxxxxxxxxxxx;
> simon.kuenzer@xxxxxxxxx
> Cc: nd <nd@xxxxxxx>; Kaly Xin <Kaly.Xin@xxxxxxx>
> Subject: Re: [Minios-devel] [UNIKRAFT PATCHv4 38/43] plat/kvm: Implement
> shutdown for Arm64
> 
> 
> 
> On 20/07/2018 03:39, Wei Chen wrote:
> > Hi Julien,
> 
> Hi Wei,
> 
> >
> >> -----Original Message-----
> >> From: Julien Grall <julien.grall@xxxxxxx>
> >> Sent: 2018年7月19日 21:40
> >> To: Wei Chen <Wei.Chen@xxxxxxx>; minios-devel@xxxxxxxxxxxxxxxxxxxx;
> >> simon.kuenzer@xxxxxxxxx
> >> Cc: Kaly Xin <Kaly.Xin@xxxxxxx>; nd <nd@xxxxxxx>
> >> Subject: Re: [Minios-devel] [UNIKRAFT PATCHv4 38/43] plat/kvm: Implement
> >> shutdown for Arm64
> >>
> >> Hi Wei,
> >>
> >> On 06/07/18 10:03, Wei Chen wrote:
> >>> QEMU/KVM provide a PSCI interface for virtual machine on
> >>> Arm64 platform. So we use this interface to implement
> >>> platform system off function.
> >>>
> >>> Signed-off-by: Wei Chen <Wei.Chen@xxxxxxx>
> >>> ---
> >>>    plat/kvm/shutdown.c | 11 +++++++++--
> >>>    1 file changed, 9 insertions(+), 2 deletions(-)
> >>>
> >>> diff --git a/plat/kvm/shutdown.c b/plat/kvm/shutdown.c
> >>> index a513df9..0f0a01f 100644
> >>> --- a/plat/kvm/shutdown.c
> >>> +++ b/plat/kvm/shutdown.c
> >>> @@ -22,7 +22,8 @@
> >>>     */
> >>>
> >>>    #include <errno.h>
> >>> -#include <x86/cpu.h>
> >>> +#include <cpu.h>
> >>> +#include <irq.h>
> >>>    #include <uk/print.h>
> >>>    #include <uk/plat/bootstrap.h>
> >>>
> >>> @@ -38,7 +39,11 @@ void ukplat_terminate(enum ukplat_gstate request
> __unused)
> >>>            * be 83 ('S', 41 << 1 | 1).
> >>>            */
> >>>           uk_printk("Unikraft halted\n");
> >>> +#if defined(__X86_64__)
> >>>           outw(0x501, 41);
> >>> +#elif defined(__ARM_64__)
> >>> + system_off();
> >>> +#endif
> >>>
> >>>           /*
> >>>            * If we got here, there is no way to initiate "shutdown" on
> virtio
> >>> @@ -49,7 +54,9 @@ void ukplat_terminate(enum ukplat_gstate request
> __unused)
> >>>
> >>>    static void cpu_halt(void)
> >>>    {
> >>> - __asm__ __volatile__("cli; hlt");
> >>> + local_irq_disable();
> >>> + halt();
> >>
> >> I think you want to move halt() in the for loop for Arm because WFI will
> >> come back when an interrupt is received. This means you will go into a
> >> busy loop wasting power.
> >>
> >
> > I think I don't want the WFI come back. The role of the cpu_halt is used
> > to hang up the system. It's not an idle.
> 
> You probably read my answer on patch #35. WFI will finish to execute
> when receiving an interrupt even with interrupts masked. An
> implementation is also free to implement WFI as a NOP.
> 
> What I suggested is to write:
> 
> for (;;)
>    halt();
> 
> So if you happen to exit halt, then you will call it again and go back
> to sleep. This is how usually you make your OS to stall forever (We use
> that on Xen).
> 

Oh, yes. This is a good method. I will use it in next version.

> Cheers,
> 
> --
> Julien Grall
_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

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