Received: by 10.223.164.202 with SMTP id h10csp1486089wrb; Wed, 15 Nov 2017 22:02:34 -0800 (PST) X-Google-Smtp-Source: AGs4zMZkmadHL2yQnVmSgXsj8qKYLwrRhTmbfCWTBIq0uJBCnPTyUJ2x+GfV48V6cPyLIo5zEDSN X-Received: by 10.98.32.21 with SMTP id g21mr685095pfg.52.1510812154638; Wed, 15 Nov 2017 22:02:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510812154; cv=none; d=google.com; s=arc-20160816; b=ItUbSDicYYdGYV4DFRXx9Zv5JbZ4Sty7u5oJCrq0ZP++CtXbFqNBB9p5NQl//D+EcP 5u1z+BaHjnNGZ7BkOSlDxjtqkW/6TbiLQLgdDq1NoszppqRiaOIS5IzF87mYi7aZ2Kd8 lzFPOdkVhbNX3ProMO3rxXKTpsgbqAcktDdrojIfzqXj+a/3U4Yaunb1aAZQBUxSAscC nfIsOK8RDEe4Pw/7YfXB+oLmojD1lazuvnROuS1odjEKogwX7s7vmx1wOIn5ILKI2ms1 tc6tDGqcqIGGaGShqadZQGvZ76/wjE46UgBBxuJDuuh1WV5lqMMEUzCFaSmg1PO+EvHc NCJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:date:cc:to:from:subject :message-id:arc-authentication-results; bh=KXoa6m22fLpxD9dVCC0WllznyUIr/A+HKphBHR14eoc=; b=k6vRXqZEM2cBqNjPZIlHrasJfeE7+/qsYY8svVspfjfS0GzNVZhyIrDY7QNROBoNVz trBgKGrJITDRFwR4ohj0264rjAP5NBbZVKsCL4UhSJI+x5BZrxGxt4y/4+ivzsycL80a Vm/sAFT3qzPcsYuuumT1Yc8W9FfYcP68cnLVk99SSybVe0q7bykVG+hGRGUjsYddWNe5 WQO43t3jUFVY98wUP9Zlfdb9vyTePOfYkU9nIxr2ew66pOmYp+gkUkBO376n1W5E1mvM D/m3JzJnEGlnuaKWYL1YVv6h4hBq/Kuz0Oy7VSjD4t69LG+/+GgJcSY2M8pLTCJAynvb 7sVA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l185si347563pfc.43.2017.11.15.22.02.22; Wed, 15 Nov 2017 22:02:34 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758126AbdKPEVq (ORCPT + 89 others); Wed, 15 Nov 2017 23:21:46 -0500 Received: from mx1.redhat.com ([209.132.183.28]:56984 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751455AbdKPEVh (ORCPT ); Wed, 15 Nov 2017 23:21:37 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B1DF2356C1; Thu, 16 Nov 2017 04:21:37 +0000 (UTC) Received: from annuminas.surriel.com (ovpn-126-55.rdu2.redhat.com [10.10.126.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id B13AE6266D; Thu, 16 Nov 2017 04:21:34 +0000 (UTC) Message-ID: <1510806094.21121.303.camel@redhat.com> Subject: Re: [PATCH 1/2] x86,kvm: move qemu/guest FPU switching out to vcpu_run From: Rik van Riel To: Quan Xu , "quan.xu04@gmail.com" , pbonzini@redhat.com Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, david@redhat.com, borntraeger@de.ibm.com, tglx@linutronix.de, rkrcmar@redhat.com Date: Wed, 15 Nov 2017 23:21:34 -0500 In-Reply-To: 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> Organization: Red Hat, Inc Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 16 Nov 2017 04:21:37 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2017-11-16 at 10:50 +0800, Quan Xu wrote: > > On 2017-11-15 22:43, Rik van Riel wrote: > > Can you explain why you believe that? > > for example, a vcpu thread is running in kvm mode under cretical > condition to stop. QEMU send an IPI to cause a VM-exit to happen > immediately, and this IPI doesn't make vcpu return to QEMU. IIUC > this vcpu thread will still continue to run in kvm mode when is > waked up at targer machine. with your patch, I don't see a chance > to load guest FPU or XSTATE, until return to QEMU and run kvm mode > again. > > then the FPU or XSTATE status is inconsistent for a small window, > what's  > even > worse is that the vcpu is running. > > Did I misunderstand? 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. When the VCPU thread is scheduled back in, the context switch code will restore current->thread.fpu to the FPU registers. The VCPU thread will never run with anything else than the guest FPU state, while inside the KVM_RUN code. From 1584194693657119671@xxx Thu Nov 16 04:16:31 +0000 2017 X-GM-THRID: 1584017174910331026 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread