wangt13
wangt13

Reputation: 1215

Failed to change VM's activity state to HLT in VMX

I am studying Intel VMX, and wrote a Linux kernel module to run a VM.
The VM will execute 'hlt' instruction, and VMExit of 12 happens.
But after VMExit, the 'activity state' is 0, not 1. I checked the MSR of 0x485, it is 0x401E0, which means bit[6:8] are all 1, HLT state is supported.
Why isn't the activity state is NOT 1, when VM runs 'hlt' instruction?

Upvotes: 0

Views: 255

Answers (1)

prl
prl

Reputation: 12432

The vm exit occurs before the halt instruction is executed. If you want to enter the guest in a halt state, set the activity state and resume the guest.

If you turn off halt exiting, the guest will enter the halt state. If you have interrupt exiting enabled, when the vm exit occurs due to the next interrupt, you will see the activity state is ‘halted’.

Upvotes: 1

Related Questions