[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <00231a24-f1a2-324e-1c32-0a5a7a3995f1@redhat.com>
Date: Thu, 16 Nov 2017 13:18:34 +0100
From: Paolo Bonzini <pbonzini@...hat.com>
To: Quan Xu <quan.xu0@...il.com>, Rik van Riel <riel@...hat.com>,
"quan.xu04@...il.com" <quan.xu04@...il.com>
Cc: kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
david@...hat.com, borntraeger@...ibm.com, tglx@...utronix.de,
rkrcmar@...hat.com
Subject: Re: [PATCH 1/2] x86,kvm: move qemu/guest FPU switching out to
vcpu_run
On 16/11/2017 13:12, Quan Xu wrote:
> However it seems there is still some gap..
>
> as Rik said, "at context switch time, the context switch code will save
> the guest FPU state to current->thread.fpu when the VCPU thread is scheduled out."
By "guest FPU state" Rik means "guest FPU with host PKRU".
Guest PKRU is always stored in vcpu->arch.pkru rather than in the guest
FPU state, so guest PKRU will never be in current->thread.fpu.state either.
KVM_GET_XSAVE will the guest FPU state with vcpu->arch.pkru and
migration will work properly.
Thanks,
Paolo
> after preempt_enable() in vcpu_enter_guest(), the vcpu thread is
> scheduled out,
> in kvm_x86_ops->run, the PKRU has been restored with host_pkru (IF
> guest_pkru != host_pkru)..
> instead of guest_pkru..
>
> then the PKRU is host_pkru, how to save guest_pkru current->thread.fpu?
>
> as mentioned, all this _assumes_ that the pkru is in
> current->thread.fpu.state as well.
>
>
> thanks,
>
> Quan
> Alibaba Cloud
>
>> Context switching will only happen in vcpu_enter_guest() after
>> preempt_enable() for a preemptible kernel, or in vcpu_run via
>> cond_resched() for a non-preemptible kernel.
>>
>> Thanks,
>>
>> Paolo
>>
>>> VM migration again, in case,
>>> source_host_pkru_value != guest_pkru_value,
>>> target_host_pkru_value == guest_pkru_value..
>>>
>>> the pkru status would be inconsistent..
>>
>
Powered by blists - more mailing lists