Page MenuHomeFreeBSD

Simplify instruction restart logic in bhyve.
ClosedPublic

Authored by neel on Jan 14 2015, 8:51 AM.

Details

Summary

Keep track of the next instruction to be executed by the vcpu as 'nextrip'.
As a result the VM_RUN ioctl no longer takes the %rip where a vcpu should
start execution.

Also, instruction restart happens implicitly via 'vm_inject_exception()' or
explicitly via 'vm_restart_instruction()'. The APIs behave identically in
both kernel and userspace contexts. The main beneficiary is the instruction
emulation code that executes in both contexts.

bhyve(8) VM exit handlers now treat 'vmexit->rip' and 'vmexit->inst_length'
as readonly:

  • Restarting an instruction is now done by calling 'vm_restart_instruction()' as opposed to setting 'vmexit->inst_length' to 0 (e.g. emulate_inout())
  • Resuming vcpu at an arbitrary %rip is now done by setting VM_REG_GUEST_RIP as opposed to changing 'vmexit->rip' (e.g. vmexit_task_switch())
Test Plan
  • inout_str unit tests
  • i386 panic due to double fault (task switch)
  • exception tracing

Diff Detail

Repository
rS FreeBSD src repository
Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

neel updated this revision to Diff 3167.Jan 14 2015, 8:51 AM
neel retitled this revision from to Simplify instruction restart logic in bhyve..
neel updated this object.
neel edited the test plan for this revision. (Show Details)
neel added a reviewer: grehan.
grehan accepted this revision.Jan 17 2015, 6:09 AM
grehan edited edge metadata.
This revision is now accepted and ready to land.Jan 17 2015, 6:09 AM
neel closed this revision.Jan 18 2015, 3:08 AM
neel updated this revision to Diff 3231.

Closed by commit rS277310 (authored by @neel).