On 14/09/2017 09:14, Ladi Prosek wrote: > I would have to reorder some of the calls under "if (writeback)" in > x86_emulate_instruction to make it work. The hook needs to be called > after all vcpu state has been synced. For example now kvm_rip_write > runs after kvm_set_hflags so it would overwrite the rip restored by > the hook. > > The left_smm field is indeed not necessary though. What if I leave it > as a separate statement in x86_emulate_instruction to make the > ordering requirement explicit, but use hflags to detect that we've > left SMM? That'd be even better, yes. Paolo