Hi Ralf, 

Thanks for the quick reply.

> -----Original Message-----
> From: Ralf Ramsauer <[email protected]>
> Sent: donderdag 10 juni 2021 18:21
> To: Bram Hooimeijer <[email protected]>;
> [email protected]
> Subject: Re: [PATCH 1/1] inmates/lib: Set cell-state to shutdown in stop()
> 
> [EXTERNAL]
> 
> 
> On 10/06/2021 17:56, Bram Hooimeijer wrote:
> > From 6d0539fdcc4734cd0ae54df4b89df5a2664ac83f Mon Sep 17 00:00:00
> 2001
> > From: Bram Hooimeijer <[email protected]>
> > Date: Thu, 10 Jun 2021 17:27:57 +0200
> > Subject: [PATCH 1/1] inmates/lib: Set cell-state to shutdown in stop()
> >
> > Ensures that calls to stop(), defined in the inmate library, set the
> > cell-state to shutdown.
> >
> > This prevents the cell to be locked but unable to respond due to being
> > stuck in the halt() loop. It also ensures that returning in
> > inmate_main() shuts down the cell.
> >
> > Signed-off-by: Bram Hooimeijer
> > <[email protected]>
> > ---
> >  inmates/lib/include/inmate_common.h | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/inmates/lib/include/inmate_common.h
> > b/inmates/lib/include/inmate_common.h
> > index 1c20a0af..250531ea 100644
> > --- a/inmates/lib/include/inmate_common.h
> > +++ b/inmates/lib/include/inmate_common.h
> > @@ -92,6 +92,9 @@ typedef enum { true = 1, false = 0 } bool;
> >
> >  static inline void __attribute__((noreturn)) stop(void)  {
> > +     if(comm_region){
> 
> I think you don't have to check that. Generally, you can disable the
> communication region. But have a look at inmates/lib/setup.c: If you're using
> libinmate, the communication region must be present.

Good point, you'd always use the library completely. 
> 
> > +             comm_region->cell_state = JAILHOUSE_CELL_SHUT_DOWN;
> > +     }
> >       disable_irqs();
> 
> I'd do it right after disable_irqs().

I should have caught that one. 
Thanks for the feedback :).

Bram

> 
> Thanks
>   Ralf
> 
> >       halt();
> >  }
> >

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jailhouse-dev/AS8PR02MB66636AC2A9ACB84FB97589FFB6359%40AS8PR02MB6663.eurprd02.prod.outlook.com.

Reply via email to