On 16/11/2017 14:35, Quan Xu wrote: > but we introduce another method: > > -- When the VCPU thread is scheduled back in, the context > switch code will restore current->thread.fpu to the FPU > registers. > > > there is still a window to restore current->thread.fpu to the FPU > registers before enter guest mode and > > preempt_disable(). That will always use the host PKRU. The guest PKRU is _never_ visible to the context switch code, because it's only ever used in a section that runs with preemption disabled. It's actually much simpler than before. Paolo > on target machine, after migration, the pkru value is source_host_pkru > in current->thread.fpu. > > in case, > > source_host_pkru_value != guest_pkru_value, > target_host_pkru_value == guest_pkru_value.. > > source_host_pkru_value may be restored to PKRU.. make pkru status > inconsistent..