From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758240AbdKOPJx (ORCPT ); Wed, 15 Nov 2017 10:09:53 -0500 Received: from mx1.redhat.com ([209.132.183.28]:53676 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757929AbdKOPJg (ORCPT ); Wed, 15 Nov 2017 10:09:36 -0500 Subject: Re: [PATCH 1/2] x86,kvm: move qemu/guest FPU switching out to vcpu_run To: Rik van Riel , "quan.xu04@gmail.com" Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, david@redhat.com, borntraeger@de.ibm.com, tglx@linutronix.de, rkrcmar@redhat.com, Quan Xu References: <20171114215424.32214-1-riel@redhat.com> <20171114215424.32214-2-riel@redhat.com> <2e83dd3f-8f03-03ac-45e0-f2fae1d17013@gmail.com> <1510756981.21121.291.camel@redhat.com> From: Paolo Bonzini Message-ID: <9bd489dd-942b-71a3-aa0b-34387e113485@redhat.com> Date: Wed, 15 Nov 2017 16:09:23 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <1510756981.21121.291.camel@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 15 Nov 2017 15:09:36 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 15/11/2017 15:43, Rik van Riel wrote: >> Rik, be careful with VM migration. with you patch, I don't think you  >> could load fpu/xstate >>    context accurately after VM migration. > Can you explain why you believe that? > > Getting the guest FPU or XSTATE is done under the vcpu->mutex. > > This patch switches out guest and userspace FPU/XSTATE under the > vcpu->mutex, and switches it back before releasing the vcpu->mutex. > > By the time a KVM_GET_FPU has obtained the vcpu->mutex, the guest > FPU state will be in vcpu->arch.guest_fpu.state, where you expect > it to be. > > What am I missing? Nothing as far as I can see. :) Paolo