For example, a benchmark declares the vm as follows:
struct virtual_machine vm = {.halt_exit = true,};Which will force guests that halt to exit. Change-Id: Ie6368093072f324c86c9ace1807075cd073d540c Signed-off-by: Ronald G. Minnich <[email protected]> --- user/vmm/include/vmm/sched.h | 1 + user/vmm/include/vmm/vmm.h | 3 +++ user/vmm/vmexit.c | 2 ++ user/vmm/vthread.c | 1 + 4 files changed, 7 insertions(+) diff --git a/user/vmm/include/vmm/sched.h b/user/vmm/include/vmm/sched.h index 403ca3f..a098cf7 100644 --- a/user/vmm/include/vmm/sched.h +++ b/user/vmm/include/vmm/sched.h @@ -30,6 +30,7 @@ struct guest_thread { struct uthread uthread; struct ctlr_thread *buddy; unsigned int gpc_id; + bool halt_exit; uth_mutex_t halt_mtx; uth_cond_var_t halt_cv; }; diff --git a/user/vmm/include/vmm/vmm.h b/user/vmm/include/vmm/vmm.h index e5f3f35..65ddd4a 100644 --- a/user/vmm/include/vmm/vmm.h +++ b/user/vmm/include/vmm/vmm.h @@ -40,6 +40,9 @@ struct virtual_machine { * where all guests share a page table. It's not required * however. */ void *root; + + /* Default value for whether guest threads halt on an exit. */ + bool halt_exit; }; char *regname(uint8_t reg); diff --git a/user/vmm/vmexit.c b/user/vmm/vmexit.c index 9ab6f44..4404ec9 100644 --- a/user/vmm/vmexit.c +++ b/user/vmm/vmexit.c @@ -190,6 +190,8 @@ static bool handle_halt(struct guest_thread *gth) { struct vm_trapframe *vm_tf = gth_to_vmtf(gth); + if (gth->halt_exit) + return FALSE; /* It's possible the guest disabled IRQs and halted, perhaps waiting on an * NMI or something. If we need to support that, we can change this. */ sleep_til_irq(gth); diff --git a/user/vmm/vthread.c b/user/vmm/vthread.c index e7963e5..5ef8d4c 100644 --- a/user/vmm/vthread.c +++ b/user/vmm/vthread.c @@ -103,6 +103,7 @@ static int vmsetup(struct virtual_machine *vm, int flags) return ret; for (i = 0; i < vm->nr_gpcs; i++) { + vm->gths[i]->halt_exit = vm->halt_exit; vm_tf = gth_to_vmtf(vm->gths[i]); vm_tf->tf_cr3 = (uint64_t)p512; } -- 2.8.0.rc3.226.g39d4020 -- You received this message because you are subscribed to the Google Groups "Akaros" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. For more options, visit https://groups.google.com/d/optout.
