> -----Original Message----- > From: Jan Kiszka <[email protected]> > Sent: donderdag 10 juni 2021 19:36 > To: Bram Hooimeijer <[email protected]>; > [email protected] > Cc: Ralf Ramsauer <[email protected]> > Subject: Re: [PATCH V2 1/1] inmates/lib: Set cell-state to shutdown in stop() > > [EXTERNAL] > > > On 10.06.21 18:43, Bram Hooimeijer wrote: > > From c310558edba8441fcb017592d55cb0a09f7f196a Mon Sep 17 00:00:00 > 2001 > > From: Bram Hooimeijer <[email protected]> > > Date: Thu, 10 Jun 2021 17:27:57 +0200 > > Subject: [PATCH V2 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 a return to > > inmate_main() shuts down the cell. > > > > Signed-off-by: Bram Hooimeijer > > <[email protected]> > > --- > > inmates/lib/include/inmate_common.h | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/inmates/lib/include/inmate_common.h > > b/inmates/lib/include/inmate_common.h > > index 1c20a0af..56cef77d 100644 > > --- a/inmates/lib/include/inmate_common.h > > +++ b/inmates/lib/include/inmate_common.h > > @@ -93,6 +93,7 @@ typedef enum { true = 1, false = 0 } bool; static > > inline void __attribute__((noreturn)) stop(void) { > > disable_irqs(); > > + comm_region->cell_state = JAILHOUSE_CELL_SHUT_DOWN; > > halt(); > > } > > > > > > Unfortunately, this overwrite the CELL_FAILED set in x86's > exception_handler(), > e.g. > > Which call paths were you addressing? Either move into the paths that miss to > set the state or add a test for CELL_RUNNING/_LOCKED before setting to > SHUT_DOWN here.
Foremostly, the call to stop() from c_entry(). However, I would prefer the latter option as that would allow the user to call stop() as well from their own exception handlers. I'll send a patch with the revision. Thanks for looking into it, Bram > > Jan > > -- > Siemens AG, T RDA IOT > Corporate Competence Center Embedded Linux -- 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/AS8PR02MB6663F0A20C8E0BBCB16AD7C2B6349%40AS8PR02MB6663.eurprd02.prod.outlook.com.
