Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752220AbcJDCL1 (ORCPT ); Mon, 3 Oct 2016 22:11:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40150 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751469AbcJDCL0 (ORCPT ); Mon, 3 Oct 2016 22:11:26 -0400 Message-ID: <1475547077.21644.45.camel@redhat.com> Subject: Re: [PATCH RFC 2/5] x86,fpu: delay FPU register loading until switch to userspace From: Rik van Riel To: Andy Lutomirski Cc: Dave Hansen , "linux-kernel@vger.kernel.org" , X86 ML , Thomas Gleixner , Paolo Bonzini , Ingo Molnar , Andrew Lutomirski , "H. Peter Anvin" , Borislav Petkov Date: Mon, 03 Oct 2016 22:11:17 -0400 In-Reply-To: References: <1475353895-22175-1-git-send-email-riel@redhat.com> <1475353895-22175-3-git-send-email-riel@redhat.com> <1475366900.21644.8.camel@redhat.com> <1475529679.4622.27.camel@redhat.com> Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="=-wNTWuyw9926/3byx/GKH" Mime-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Tue, 04 Oct 2016 02:11:21 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1994 Lines: 59 --=-wNTWuyw9926/3byx/GKH Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, 2016-10-03 at 14:36 -0700, Andy Lutomirski wrote: >=C2=A0 > Anything else that tries to read task xstate from memory, i.e. MPX > and > PKRU.=C2=A0=C2=A0(Although if we switch to eager-switched PKRU, then PKRU= stops > mattering for this purpose.) >=20 > Actually, I don't see any way your patches can be compatible with > PKRU > without switching to eager-switched PKRU. There is one case where the in-register PKRU state matters: - user space accesses to memory There are several cases where the in-memory PKRU state would suffice: - get_user_pages(_fast) to the local task (could also use registers) - setting VMA/PTE permission bits (could also use registers) There is one case where only in-memory PKRU state works, where PKRU is currently simply ignored: - get_user_pages to another task's memory Dave, are there major obstacles to making read_pkru and write_pkru work with in-memory state? Would it be better for read/write_pkru to force the FPU state to get loaded into registers, under the assumption that if things like get_user_pages_fast happens, we will likely switch back to userspace soon, anyway? Would that assumption be wrong with KVM? :) --=20 All Rights Reversed. --=-wNTWuyw9926/3byx/GKH 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 iQEcBAABCAAGBQJX8w/GAAoJEM553pKExN6Dd2QIAJXClKXMMNd0W87wSpUFRcG7 WCx39aSIuv7FwouS38fpP4M6sW6qhWIn4cGSx00kGOrHhZnvN6aHSB4jds8DzkGJ TO9ePa8VIsnyHRn2UoXZOD5lRgXNUA8dxC0nxo7CY1Wy7VPj4N7z3dqLxjy9m9UC FeGjK2FqS2uPtgv3yhjzzeMzsYk1IykzD1JGN8P+C6Qxx3moDSvkZdceTz6ci69N Z2sL5CVB+xbdPkSumW0TjWXyAOC5g8UgSxHmPWNlJFg8mvR1/IuO0XbVsvzfnV8O R368F8JOcdq1FZ/X+lqzwk+R/nFLr1vAyzH8BSp7Ldd8lV7zQBJMd8/QdLcL9GU= =YIej -----END PGP SIGNATURE----- --=-wNTWuyw9926/3byx/GKH--