On 02.02.21 17:44, Bram Hooimeijer wrote: > This commit ensures that creating and destroying a cell returns the > ROOT_COS CBM to the prior state. > > Previously, the following sequence would change the CBM of the root > cell for a 10-way (bit) CBM: > jailhouse enable: creates a root cell with COS0 and CBM 3FF > jailhouse cell create: creates cell1 with COS1 and CBM 1FF > The root CBM is shrinked to 200 > jailhouse cell create: creates cell2 with COS2 and CBM 1F0 > The root CBM is unmodified. > jailhouse cell destroy: destroyes cell2 with CBM 1F0. > The root CBM is extended to 3F0. > > The last extension is considered undesirable, because the bits freed > from cell2 are still in use by cell1. Due to this, cell creation and > destruction are not inverse operations, but instead leave the system in > a different state. > > This patch checks whether the bits are in use by another cell, and > whether this cell allows the bits to be ROOTSHARED. If these bits are in > use, but not shared, they are not returned to the root. > > Additionally, the root_cell bits are removed from the freed_mask to > prevent merge_freed_mask_to_root() from considering these. >
Just like for memory regions or PIO ranges, this case is intentionally not supported by Jailhouse: You cannot take resources from the root cell and then share them between non-root cells. You either share them with the root cell (and then possibly also among non-root cells), or you do not give the resource to the root cell at all (on enable). Makes life-cycle management simpler as your patches demonstrates. 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/4cc2a021-5709-b7e4-4d88-e0a62b0c926b%40siemens.com.
