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

Re: [Minios-devel] [PATCH 2/2] Save/Restore Support: Replace exit logic for kernel_shutdown logic.



On 22/03/18 15:48, Bruno Alvisio wrote:
> 
> 
> On Wed, Mar 21, 2018 at 10:52 PM, Juergen Gross <jgross@xxxxxxxx
> <mailto:jgross@xxxxxxxx>> wrote:
> 
>     On 21/03/18 19:48, Bruno Alvisio wrote:
>     > Moved the exit logic to the kernel_shutdown function in shutdown.c
>     >
>     > Signed-off-by: Bruno Alvisio <bruno.alvisio@xxxxxxxxx
>     <mailto:bruno.alvisio@xxxxxxxxx>>
>     > ---
>     >  main.c | 9 ++-------
>     >  1 file changed, 2 insertions(+), 7 deletions(-)
>     >
>     > diff --git a/main.c b/main.c
>     > index 4e42f53..513a22d 100644
>     > --- a/main.c
>     > +++ b/main.c
>     > @@ -17,6 +17,7 @@
>     >  #include <unistd.h>
>     >  #include <xenbus.h>
>     >  #include <events.h>
>     > +#include <shutdown.h>
>     >  #include <mini-os/lib.h>
>     >
>     >  extern int main(int argc, char *argv[], char *envp[]);
>     > @@ -177,13 +178,7 @@ void _exit(int ret)
>     >  #if defined(HAVE_LWIP) && defined(CONFIG_NETFRONT)
>     >      stop_networking();
>     >  #endif
>     > -    stop_kernel();
>     > -    if (!ret) {
>     > -     /* No problem, just shutdown.  */
>     > -        struct sched_shutdown sched_shutdown = { .reason =
>     SHUTDOWN_poweroff };
>     > -        HYPERVISOR_sched_op(SCHEDOP_shutdown, &sched_shutdown);
>     > -    }
>     > -    do_exit();
>     > +    kernel_shutdown(ret);
> 
>     You are assuming that ret is a valid shutdown reason here.
> 
>     Are you sure this is true?
> 
> With this patch:
>  
> In the case:
> -> ret == 0:  it will perform a shutdown with reason power_off
> -> ret == 1: it will do a shutdown with reason reboot
> -> 0 > ret or ret >= 2:  (Default case): it will do a shutdown with
> reason crash.
> 
> Maybe it should be modified so that:
> -> ret == 0:  it will perform a shutdown with reason power_off
> -> ret != 0: it will do a shutdown with reason crash.
> 
> Is that correct?

I'd say so, yes.


Juergen

_______________________________________________
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®.