When a CPU is parked on RISC-V, we set the per-cpu VS-file in S-Mode.
The VS-file depends on the current cell. So if we park a CPU in case of
destruction of a cell, set the target cell first before parking the
remote CPU, to have the correct target VS-file in place.

This should not affect other architectures.

Signed-off-by: Ralf Ramsauer <ralf.ramsa...@oth-regensburg.de>
---
 hypervisor/control.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hypervisor/control.c b/hypervisor/control.c
index 7a5304a0..38b9086c 100644
--- a/hypervisor/control.c
+++ b/hypervisor/control.c
@@ -368,10 +368,10 @@ static void cell_destroy_internal(struct cell *cell)
        cell->comm_page.comm_region.cell_state = JAILHOUSE_CELL_SHUT_DOWN;
 
        for_each_cpu(cpu, &cell->cpu_set) {
+               public_per_cpu(cpu)->cell = &root_cell;
                arch_park_cpu(cpu);
 
                set_bit(cpu, root_cell.cpu_set.bitmap);
-               public_per_cpu(cpu)->cell = &root_cell;
                public_per_cpu(cpu)->failed = false;
                memset(public_per_cpu(cpu)->stats, 0,
                       sizeof(public_per_cpu(cpu)->stats));
-- 
2.40.1

-- 
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 jailhouse-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jailhouse-dev/20230519204033.643200-72-ralf.ramsauer%40oth-regensburg.de.

Reply via email to