On 2017-04-05 13:43, Måns Rullgård wrote: > Ralf Ramsauer <[email protected]> writes: > >> Hi, >> >> I need spinlocks in inmates on ARM, so I simply included asm/spinlock.h. >> Taking locks in inmates on ARM somehow doesn't work at all, but that's >> not the main issue. As soon as I try to take locks, cells can not be >> destroyed any longer, the whole system freezes on cell destroy. >> >> I was able to trace this down to the 'ldrex' instruction. This minimal >> example triggers this behavior (tested on a TK1, can not test it on >> other boards): >> >> #include <inmate.h> >> >> void inmate_main(void) >> { >> unsigned int foo = 0, bar = 0; >> >> printk("Foo!\n"); >> asm volatile("ldrex %0, [%1]\n\t" >> : "=&r" (foo) : "r" (bar)); >> >> printk("Bar!\n"); >> while(1); >> asm volatile("wfi"); >> } >> >> The example code successfully finishes, I can read Foo and Bar on my >> serial console. But I am not able to destroy the cell afterwards. My >> system completely hangs on "jailhouse cell destroy". >> >> Curiously the cell can be re-loaded and started over again. Leaving out >> the ldrex instruction does not trigger the bug. >> >> - How can ldrex prevent my cell from being destroyed? >> >> Does it change some 'internal state' where jailhouse is not aware >> about?
Is your inmate opting-out from the Comm Region protocol (JAILHOUSE_CELL_PASSIVE_COMMREG)? >> >> - Why do spinlocks not work at all in inmates? >> >> spin_lock(&lock) never returns in inmates on a fresh spin lock. >> Does the ARM implementation of spinlocks require some special >> global initialisation that I don't know of? > > Spinlocks use ldrex/strex pairs, so if ldrex is broken, I wouldn't > expect spinlocks to work either. > ...and Linux use them heavily. All our ARM SMP Linux inmates would be broken then. There must be more involved. Jan -- Siemens AG, Corporate Technology, CT RDA ITP SES-DE 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]. For more options, visit https://groups.google.com/d/optout.
