From patchwork Tue Jul 12 22:18:51 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bandan Das X-Patchwork-Id: 9226353 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D78DB60871 for ; Tue, 12 Jul 2016 22:21:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C5B2C27DCE for ; Tue, 12 Jul 2016 22:21:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BA0C627F9C; Tue, 12 Jul 2016 22:21:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 670EC27DCE for ; Tue, 12 Jul 2016 22:21:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752090AbcGLWTe (ORCPT ); Tue, 12 Jul 2016 18:19:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55015 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751858AbcGLWTd (ORCPT ); Tue, 12 Jul 2016 18:19:33 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id ACE4D1176CA; Tue, 12 Jul 2016 22:19:22 +0000 (UTC) Received: from gigantic.usersys.redhat.com (dhcp-17-169.bos.redhat.com [10.18.17.169]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u6CMJI2a027271; Tue, 12 Jul 2016 18:19:22 -0400 From: Bandan Das To: kvm@vger.kernel.org Cc: pbonzini@redhat.com, guangrong.xiao@linux.intel.com, kernellwp@gmail.com, linux-kernel@vger.kernel.org Subject: [PATCH v2 4/5] mmu: change unconditional setting of the u bit in fault bitmap Date: Tue, 12 Jul 2016 18:18:51 -0400 Message-Id: <1468361932-16580-5-git-send-email-bsd@redhat.com> In-Reply-To: <1468361932-16580-1-git-send-email-bsd@redhat.com> References: <1468361932-16580-1-git-send-email-bsd@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 12 Jul 2016 22:19:22 +0000 (UTC) Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP For the nested EPT case, we assume that the read bit (u) is always set since we used to unconditionally set it in set_spte(). Modify it to only be set when host ept execute only support isn't present. Signed-off-by: Bandan Das --- arch/x86/kvm/mmu.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index c364dcb..566eea5 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c @@ -3923,9 +3923,10 @@ static void update_permission_bitmask(struct kvm_vcpu *vcpu, * clearer. */ smap = cr4_smap && u && !uf && !ff; - } else - /* Not really needed: no U/S accesses on ept */ - u = 1; + } else { + if (shadow_present_mask) + u = 1; + } fault = (ff && !x) || (uf && !u) || (wf && !w) || (smapf && smap);