From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [PATCH 0/9] KVM, pkeys: add memory protection-key support Date: Mon, 9 Nov 2015 14:26:34 +0100 Message-ID: <56409F0A.6020204@redhat.com> References: <1447070055-4207-1-git-send-email-huaitong.han@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: kvm@vger.kernel.org To: Huaitong Han , gleb@kernel.org Return-path: Received: from mail-wm0-f48.google.com ([74.125.82.48]:36049 "EHLO mail-wm0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751649AbbKIN0h (ORCPT ); Mon, 9 Nov 2015 08:26:37 -0500 Received: by wmww144 with SMTP id w144so76044527wmw.1 for ; Mon, 09 Nov 2015 05:26:36 -0800 (PST) In-Reply-To: <1447070055-4207-1-git-send-email-huaitong.han@intel.com> Sender: kvm-owner@vger.kernel.org List-ID: On 09/11/2015 12:54, Huaitong Han wrote: > The protection-key feature provides an additional mechanism by which = IA-32e > paging controls access to usermode addresses. >=20 > Hardware support for protection keys for user pages is enumerated wit= h CPUID > feature flag CPUID.7.0.ECX[3]:PKU. Software support is CPUID.7.0.ECX[= 4]:OSPKE > with the setting of CR4.PKE(bit 22). >=20 > When CR4.PKE =3D 1, every linear address is associated with the 4-bit= protection > key located in bits 62:59 of the paging-structure entry that mapped t= he page > containing the linear address. The PKRU register determines, for each > protection key, whether user-mode addresses with that protection key = may be > read or written. >=20 > The PKRU register (protection key rights for user pages) is a 32-bit = register > with the following format: for each i (0 =E2=89=A4 i =E2=89=A4 15), P= KRU[2i] is the > access-disable bit for protection key i (ADi); PKRU[2i+1] is the writ= e-disable > bit for protection key i (WDi). >=20 > Software can use the RDPKRU and WRPKRU instructions with ECX =3D 0 to= read and > write PKRU. In addition, the PKRU register is XSAVE-managed state and= can thus > be read and written by instructions in the XSAVE feature set. Hi, this looks more or less okay. I made a few comments on the individual patches. Please add a test for PKRU to kvm-unit-tests' access.c. I will _not_ merge this feature without unit tests. I have merged nested VPID without, and it was a mistake because they were never submitted and probably never will. Thanks, Paolo