From patchwork Tue Nov 8 23:00:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Junaid Shahid X-Patchwork-Id: 9418217 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 E460C60720 for ; Tue, 8 Nov 2016 23:00:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D7DF928AD5 for ; Tue, 8 Nov 2016 23:00:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CC3CA28B38; Tue, 8 Nov 2016 23:00:49 +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.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID 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 6534B28AD5 for ; Tue, 8 Nov 2016 23:00:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932336AbcKHXAk (ORCPT ); Tue, 8 Nov 2016 18:00:40 -0500 Received: from mail-pf0-f171.google.com ([209.85.192.171]:33979 "EHLO mail-pf0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932255AbcKHXAf (ORCPT ); Tue, 8 Nov 2016 18:00:35 -0500 Received: by mail-pf0-f171.google.com with SMTP id n85so114981674pfi.1 for ; Tue, 08 Nov 2016 15:00:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=NbPtlwgpnZeLaJH6tBYC+09Fuocb4K8M/ouR/qGpxdQ=; b=jwrUQbFnMYJsbL6Xff7QS9Y8NZ3+Kx/OQ5c3isVpw3Dkt35uma1lPyOXi9lKvdw4jz FLA/2KXvBYPtwYPskio9gDmlJqP8xp3B+2iChjbIw7ExiM1urQ1KDEwunliDDroucuPo 6yM2DoMfAvBv+FzyD2BHqMwyHbIe/K8IrW+BNAMWP5kMlmxau4OpnRfL8x32dUvvHTCh bAmUIENlzdnp3LcjEQj4WjNrutrgu+lUddHJa5yNxaCnu0fFvRYhEypI+kivr2AwzhBl hlhmKL17JPEQXtl6BOIrnZX01vE1zfG+kFZc1fBUnnhb8HaL4KCfs+cU1GA38ZlufRAT Dk/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=NbPtlwgpnZeLaJH6tBYC+09Fuocb4K8M/ouR/qGpxdQ=; b=NTPa+UWBp5cbKjGr/Z08/k08Xb97drUPSWBZixn4o623YJe46Gye0EH6zkbLlwu03l T3ReaJGL/vH4SbbLOjPe/ccZwdqQKhaQT6LJFd54OEHtAD5ibWp3bqPxm02v42bOHa1y JBIdRaTQtaFMLl6BFcOyXFY8pyosdCo2L2kEGOHvFUYZ4x/o35BhAhVGDfJtoCnhkyvP c046+q4fj3L2Q4XYOUPLBKDvIJhS+YL+zt14EYIx74CgdWCGpz6yvZxKFgQhjigk33cU Q/Br58zcEzFunDi9jiTzYBDSiNHQsyILSdUt7BfRkCvqjZQ2hZdfTshgjIO7StWmsspe 8Mnw== X-Gm-Message-State: ABUngvcBGkiGDTbZpefRaNKILdXK2lYvto8yYx5Kq4wjyinLlMrHsIBDZvzyeJTij8RoKvHS X-Received: by 10.99.50.67 with SMTP id y64mr10105760pgy.146.1478646033991; Tue, 08 Nov 2016 15:00:33 -0800 (PST) Received: from js-desktop.mtv.corp.google.com ([172.17.128.41]) by smtp.gmail.com with ESMTPSA id w65sm17071416pfa.88.2016.11.08.15.00.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 08 Nov 2016 15:00:33 -0800 (PST) From: Junaid Shahid To: kvm@vger.kernel.org Cc: andreslc@google.com, pfeiner@google.com, pbonzini@redhat.com, guangrong.xiao@linux.intel.com Subject: [PATCH v2 2/5] kvm: x86: mmu: Rename spte_is_locklessly_modifiable() Date: Tue, 8 Nov 2016 15:00:27 -0800 Message-Id: <1478646030-101103-3-git-send-email-junaids@google.com> X-Mailer: git-send-email 2.8.0.rc3.226.g39d4020 In-Reply-To: <1478646030-101103-1-git-send-email-junaids@google.com> References: <1478646030-101103-1-git-send-email-junaids@google.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This change renames spte_is_locklessly_modifiable() to spte_can_locklessly_be_made_writable() to distinguish it from other forms of lockless modifications. The full set of lockless modifications is covered by spte_has_volatile_bits(). Signed-off-by: Junaid Shahid Reviewed-by: Paolo Bonzini --- arch/x86/kvm/mmu.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index d9c7e98..e580134 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c @@ -473,7 +473,7 @@ retry: } #endif -static bool spte_is_locklessly_modifiable(u64 spte) +static bool spte_can_locklessly_be_made_writable(u64 spte) { return (spte & (SPTE_HOST_WRITEABLE | SPTE_MMU_WRITEABLE)) == (SPTE_HOST_WRITEABLE | SPTE_MMU_WRITEABLE); @@ -487,7 +487,7 @@ static bool spte_has_volatile_bits(u64 spte) * also, it can help us to get a stable is_writable_pte() * to ensure tlb flush is not missed. */ - if (spte_is_locklessly_modifiable(spte)) + if (spte_can_locklessly_be_made_writable(spte)) return true; if (!shadow_accessed_mask) @@ -556,7 +556,7 @@ static bool mmu_spte_update(u64 *sptep, u64 new_spte) * we always atomically update it, see the comments in * spte_has_volatile_bits(). */ - if (spte_is_locklessly_modifiable(old_spte) && + if (spte_can_locklessly_be_made_writable(old_spte) && !is_writable_pte(new_spte)) ret = true; @@ -1212,7 +1212,7 @@ static bool spte_write_protect(u64 *sptep, bool pt_protect) u64 spte = *sptep; if (!is_writable_pte(spte) && - !(pt_protect && spte_is_locklessly_modifiable(spte))) + !(pt_protect && spte_can_locklessly_be_made_writable(spte))) return false; rmap_printk("rmap_write_protect: spte %p %llx\n", sptep, *sptep); @@ -2973,7 +2973,7 @@ static bool fast_page_fault(struct kvm_vcpu *vcpu, gva_t gva, int level, * Currently, to simplify the code, only the spte write-protected * by dirty-log can be fast fixed. */ - if (!spte_is_locklessly_modifiable(spte)) + if (!spte_can_locklessly_be_made_writable(spte)) goto exit; /*