Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1670489
| Path | csiph.com!news.redatomik.org!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | guangrong.xiao@gmail.com |
| Newsgroups | linux.kernel |
| Subject | [PATCH v2 1/7] KVM: MMU: correct the behavior of mmu_spte_update_no_track |
| Date | Tue, 20 Jun 2017 11:20:02 +0200 |
| Message-ID | <tUnui-6Hb-13@gated-at.bofh.it> (permalink) |
| References | <tUnuh-6Hb-11@gated-at.bofh.it> |
| X-Original-To | pbonzini@redhat.com, mtosatti@redhat.com, avi.kivity@gmail.com, rkrcmar@redhat.com |
| Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=vZcoCSc9WxvlHIjp0cOrhqNjJq3cwt7Hl0zsOxg0HAo=; b=QTe+27rdxkvWcJ1oM9DvO1oKZ6Yl8+wIXT7vZ8oDXv3Z4x7IlAfdQ+eNlD4kGbHejP e78HoP1204kSAB6yLgTPWi31nRI2SndH3bC8NSTgFKabaNZank0qKY7hq/7sXzqGYB0/ qrKRauFzIeNN8sBvEoYCU1U/N3pkEqjjrhcBnsFTqUiIvJS1wlfd7a0rJAs4wBOKv4Vw 5PRhXyDlozK+8pAUPuK042J2StoK4s+s+HO/NNKoX4mrMKQrsHvkUwIqbSRuqSRphuNB 6RBDgpthDh6pAMFHzsR/ubDM+4n6AOZqFSuLhV3fgB61137+RMpAJ028LwtZXiyfXzW/ yf4w== |
| X-Google-Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=vZcoCSc9WxvlHIjp0cOrhqNjJq3cwt7Hl0zsOxg0HAo=; b=FdBHMsIz80NOM4aMbHSKqts9NvVTJZTk9SkJX8CRZPKV7GMF9ZfUw7hTJnmB3vKj/d +IlMH17CepVTUIlZOuMkEe3Bgdv6+MDF3Z5iPaWsHwkaqIbH9iInVerQrgqr0DDkm8T4 gJrA/aJ7Ow6lVDiKSi2xBbDX+Kp8ShX81YsNKhZ2sVnMtAFrsTXhKdHanSzdgRciDgux NI1XIA7mTefp5zdhVYkpzqgyKPSAirwy2FIgcTFPW1tRQ18XxriEUSIj5LPEwq0yzyBL TjrBXYwJVtl4rkRSQ/O0J6eZz0guq2bNqiszOHzwilfoH2fkEWY7WQOGcR2vg9SdbMLm yuuA== |
| X-Gm-Message-State | AKS2vOxoaKsMfuvo3i6pyEZwySZEeMrpnEKHglukDy62NigXqDAJ+fCS KhJyRP3X+p0GISjv |
| X-Received | by 10.98.198.201 with SMTP id x70mr26971619pfk.232.1497950144608; Tue, 20 Jun 2017 02:15:44 -0700 (PDT) |
| X-Google-Original-From | xiaoguangrong@tencent.com |
| X-Mailer | git-send-email 2.9.4 |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 65 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | kvm@vger.kernel.org, linux-kernel@vger.kernel.org, qemu-devel@nongnu.org, Xiao Guangrong <xiaoguangrong@tencent.com> |
| X-Original-Date | Tue, 20 Jun 2017 17:15:20 +0800 |
| X-Original-Message-ID | <20170620091526.4287-2-xiaoguangrong@tencent.com> |
| X-Original-References | <20170620091526.4287-1-xiaoguangrong@tencent.com> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1670489 |
Show key headers only | View raw
From: Xiao Guangrong <xiaoguangrong@tencent.com>
Current behavior of mmu_spte_update_no_track() does not match
the name of _no_track() as actually the A/D bits are tracked
and returned to the caller
This patch introduces the real _no_track() function to update
the spte regardless of A/D bits and rename the original function
to _track()
The _no_track() function will be used by later patches to update
upper spte which need not care of A/D bits indeed
Signed-off-by: Xiao Guangrong <xiaoguangrong@tencent.com>
---
arch/x86/kvm/mmu.c | 25 ++++++++++++++++++++++---
1 file changed, 22 insertions(+), 3 deletions(-)
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 5d3376f..d18c17c 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -583,10 +583,29 @@ static void mmu_spte_set(u64 *sptep, u64 new_spte)
}
/*
- * Update the SPTE (excluding the PFN), but do not track changes in its
+ * Update the SPTE (excluding the PFN) regardless of accessed/dirty
+ * status which is used to update the upper level spte.
+ */
+static void mmu_spte_update_no_track(u64 *sptep, u64 new_spte)
+{
+ u64 old_spte = *sptep;
+
+ WARN_ON(!is_shadow_present_pte(new_spte));
+
+ if (!is_shadow_present_pte(old_spte)) {
+ mmu_spte_set(sptep, new_spte);
+ return;
+ }
+
+ __update_clear_spte_fast(sptep, new_spte);
+}
+
+/*
+ * Update the SPTE (excluding the PFN), the original value is
+ * returned, based on it, the caller can track changes of its
* accessed/dirty status.
*/
-static u64 mmu_spte_update_no_track(u64 *sptep, u64 new_spte)
+static u64 mmu_spte_update_track(u64 *sptep, u64 new_spte)
{
u64 old_spte = *sptep;
@@ -621,7 +640,7 @@ static u64 mmu_spte_update_no_track(u64 *sptep, u64 new_spte)
static bool mmu_spte_update(u64 *sptep, u64 new_spte)
{
bool flush = false;
- u64 old_spte = mmu_spte_update_no_track(sptep, new_spte);
+ u64 old_spte = mmu_spte_update_track(sptep, new_spte);
if (!is_shadow_present_pte(old_spte))
return false;
--
2.9.4
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
[PATCH v2 1/7] KVM: MMU: correct the behavior of mmu_spte_update_no_track guangrong.xiao@gmail.com - 2017-06-20 11:20 +0200
csiph-web