Received: by 10.223.164.202 with SMTP id h10csp44389wrb; Tue, 14 Nov 2017 10:49:29 -0800 (PST) X-Google-Smtp-Source: AGs4zMbIA424jI6p5FUJTRcsDFvNgn03pV/JJRTkYEo6TYQyov1yiY/F73hrS48NHgDwVwRatdEC X-Received: by 10.101.69.76 with SMTP id x12mr13155138pgr.284.1510685369424; Tue, 14 Nov 2017 10:49:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510685369; cv=none; d=google.com; s=arc-20160816; b=KIKPk+NF7an21AH5AdOKucNOm7g4m8APG9mKDbp0PikJJAKfuqrqnB2G5cHaH+627F s6GnHcs+nwcBsx8fUg6c1zzXg3ETF4/9SfCt5A4hm7wREKsf4brop3t/BJuSonoAKJHh x4m6SW5kMCSqCGX+HdVt2yefqwK1ideujdPhgHD/IMgMKFJp70GXiRP2RaG2dhDM6Dzt hQfHY/kQ2weaNFJD6FAUX/IBb6h/rD7GSFrt2+FTWVAS9AZBXK+heQaPx5Y9wWQZHYrh 17L8ffGGJql1hnWoZz0obdQDBJowMq4C4hs0D43C3dg/kfQf8N8xvhjDgPJEzMbSl+XH FGyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to:date :cc:to:from:subject:message-id:arc-authentication-results; bh=3ulUdD64HW3p/V/uRPOjbmvmD+Lwm7KOTVxfYvjXeis=; b=xY42MCUSEfoDn4sMN68e/DcOoZrLkB6zqKU2k20kOLK2uB9pHHHdGei0cW7/0VlfD8 nfTpWLSivemCL/I+xMtIwBT4fDG/1AyEozGUCpHOch/+wfM3HF0ajJc+K92SpCRlaGSq mo9VW0E8uXne+9kQXLO9Am2DFEU661F0OW+SbKva88X5yxCRxYlZT6tl92UDaCJXgd6B 3pIW0MLidgOcho0Bafx1K+5O6gOFhYR/yhPi0y+VLWv29O/Pa7EMUT670+w9vBSGRVRv k/LzM1hrKxYhj6E34OC4/uUpU/i7hfbA6u7/x5xj8f+pl4xbCu1gmWRfqQhUSmULO0pf tcBQ== 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 b3si9130246pgr.683.2017.11.14.10.49.16; Tue, 14 Nov 2017 10:49:29 -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 S1754539AbdKNSIL (ORCPT + 88 others); Tue, 14 Nov 2017 13:08:11 -0500 Received: from mx1.redhat.com ([209.132.183.28]:54724 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751213AbdKNSIC (ORCPT ); Tue, 14 Nov 2017 13:08:02 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 60CC9231; Tue, 14 Nov 2017 18:08:02 +0000 (UTC) Received: from dhcp-17-33.bos.redhat.com (dhcp-17-33.bos.redhat.com [10.18.17.33]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6D2F188E07; Tue, 14 Nov 2017 18:07:59 +0000 (UTC) Message-ID: <1510682877.30057.1.camel@redhat.com> Subject: Re: [PATCH] x86,kvm: move qemu/guest FPU switching out to vcpu_run From: Rik van Riel To: David Hildenbrand , pbonzini@redhat.com Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, tglx@linutronix.de, rkrcmar@redhat.com, borntraeger@de.ibm.com Date: Tue, 14 Nov 2017 13:07:57 -0500 In-Reply-To: References: <20171114001223.441ea2ca@annuminas.surriel.com> Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="=-09DCwSgiYgl3vGfspZei" Mime-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 14 Nov 2017 18:08:02 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-09DCwSgiYgl3vGfspZei Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, 2017-11-14 at 17:57 +0100, David Hildenbrand wrote: >=20 > > diff --git a/arch/x86/include/asm/kvm_host.h > > b/arch/x86/include/asm/kvm_host.h > > index c73e493adf07..92e66685249e 100644 > > --- a/arch/x86/include/asm/kvm_host.h > > +++ b/arch/x86/include/asm/kvm_host.h >=20 > We should also get rid of guest_fpu_loaded now, right? Indeed, we no longer need that member. I'll get rid of it. > emulator_get_fpu() does a kvm_load_guest_fpu(). Doesn't that mean > that > this is now not needed anymore? (at least when emulator code is > called > from inside the loop?) Now that is a very good question! When called from inside the loop, it is indeed not needed. My question is, can the in-kernel emulator code ever be called from OUTSIDE the KVM_RUN ioctl loop? If so, we need to restore the user FPU context before returning from the emulator code. Given that the current emulator code does not do that, I suspect this is not the case. I also see no path from the kvm ioctl into the emulator code, other than via KVM_RUN. The FPU and XSAVE ioctls all work on the saved vcpu->arch.guest_fpu data, and never directly on the registers. Looks like we can completely get rid of .get_fpu and .put_fpu... Unless Paolo has any objection, I'll go do that :) > Also, what about preempt_diable() at that point, still needed? If the guest FPU context is the only FPU context loaded for the task at that point in time, we should not need to run with preemption disabled. After all, if we were to get preempted, the context switch code would automatically save and restore the guest FPU context for us. --=20 All rights reversed --=-09DCwSgiYgl3vGfspZei Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAABCAAGBQJaCzD9AAoJEM553pKExN6DyK8H/j9+qYqvsquddcqYj/C8jo+1 J+pOjNGODfvW9ZwgCFu9TOkUL1fNYrZ1+m5sMBMnAcPQEhXcP+p8TBWXIQZZXB6y D6Ay3ns+evE1OEVUPFRQ7/d/8m+lpSDB8cXv+SoguoWwj7ffWYh8Hw0GBkrF5ybs /+lRfB/jDoHML49QBIaLbBmsp8cLMqpkjQWhz/MyeDf3VkfLXWTPsn7IcoHO9GVQ 0Z6KNd371By/gYbI2E2M7KDjPgmMlWNS7uaLreofaB3pnznVE6src9hkmHmPbq/m EWNlIiEVGH+TwuiG6nnPOUYhkZZmm9HiI2tV/aEmSYFTPAbnJT+PWNdFFjVyDA4= =kU3M -----END PGP SIGNATURE----- --=-09DCwSgiYgl3vGfspZei-- From 1584066011160084555@xxx Tue Nov 14 18:11:10 +0000 2017 X-GM-THRID: 1584017174910331026 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread