From: Peter Feiner <pfeiner@google.com>
To: kvm@vger.kernel.org, jan.kiszka@siemens.com, drjones@redhat.com,
pbonzini@redhat.com
Cc: pfeiner@google.com
Subject: [kvm-unit-tests v3 6/6] x86: vmx: don't explicitly split identity EPT map
Date: Wed, 2 Mar 2016 09:10:57 -0800 [thread overview]
Message-ID: <1456938657-20850-7-git-send-email-pfeiner@google.com> (raw)
In-Reply-To: <1456938657-20850-1-git-send-email-pfeiner@google.com>
Since install_ept_entry automatically splits large EPTEs, it's no
longer necessary to explicitly pave the EPT identity map with 4K
entries mapping [base_addr1, base_addr1 + PAGE_SIZE_2M). I.e.,
install_ept(data_page1, data_page2) does the paving before installing
the 4k data_page1 -> data_page2 mapping.
The other setup_ept_range call was unnecessary.
Note that there was benign bug in the deleted code. The third argument
of setup_ept_range is length not end! Thus the range of GPA mappings
being split was [base_addr1, base_addr1 * 2 + PAGE_SIZE_2M).
Signed-off-by: Peter Feiner <pfeiner@google.com>
---
x86/vmx_tests.c | 7 -------
1 file changed, 7 deletions(-)
diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c
index bb65c06..4ef2247 100644
--- a/x86/vmx_tests.c
+++ b/x86/vmx_tests.c
@@ -954,7 +954,6 @@ static int apic_version;
static int ept_init()
{
- unsigned long base_addr1, base_addr2;
u32 ctrl_cpu[2];
if (!(ctrl_cpu_rev[0].clr & CPU_SECONDARY) ||
@@ -979,12 +978,6 @@ static int ept_init()
memset(data_page2, 0x0, PAGE_SIZE);
*((u32 *)data_page1) = MAGIC_VAL_1;
*((u32 *)data_page2) = MAGIC_VAL_2;
- base_addr1 = (unsigned long)data_page1 & PAGE_MASK_2M;
- base_addr2 = (unsigned long)data_page2 & PAGE_MASK_2M;
- setup_ept_range(pml4, base_addr1, base_addr1 + PAGE_SIZE_2M, 0, 0,
- EPT_WA | EPT_RA | EPT_EA);
- setup_ept_range(pml4, base_addr2, base_addr2 + PAGE_SIZE_2M, 0, 0,
- EPT_WA | EPT_RA | EPT_EA);
install_ept(pml4, (unsigned long)data_page1, (unsigned long)data_page2,
EPT_RA | EPT_WA | EPT_EA);
--
2.7.0.rc3.207.g0ac5344
prev parent reply other threads:[~2016-03-02 17:11 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-01 19:30 [kvm-unit-tests 0/5] Split large EPT mappings properly Peter Feiner
2016-03-01 19:30 ` [kvm-unit-tests 1/5] x86: vmx.h: trivial whitespace fixes Peter Feiner
2016-03-01 19:30 ` [kvm-unit-tests 2/5] x86: vmx: Named constant: EPT_ADDR_MASK Peter Feiner
2016-03-01 21:12 ` Paolo Bonzini
2016-03-01 21:16 ` Peter Feiner
2016-03-01 21:27 ` Jan Kiszka
2016-03-01 21:36 ` Paolo Bonzini
2016-03-01 19:30 ` [kvm-unit-tests 3/5] x86: vmx: Named constant: EPT_LEVEL_SHIFT Peter Feiner
2016-03-01 19:30 ` [kvm-unit-tests 4/5] x86: vmx: split large EPTEs in install_ept_entry Peter Feiner
2016-03-01 19:30 ` [kvm-unit-tests 5/5] x86: vmx: don't explicitly split identity EPT map Peter Feiner
2016-03-01 21:13 ` [kvm-unit-tests 0/5] Split large EPT mappings properly Paolo Bonzini
2016-03-01 22:34 ` [kvm-unit-tests v2 0/6] " Peter Feiner
2016-03-01 22:34 ` [kvm-unit-tests v2 1/6] x86: vmx.h: trivial whitespace fixes Peter Feiner
2016-03-01 22:34 ` [kvm-unit-tests v2 2/6] lib: generic bitops.h Peter Feiner
2016-03-01 22:34 ` [kvm-unit-tests v2 3/6] x86: vmx: Named constant: EPT_ADDR_MASK Peter Feiner
2016-03-02 6:24 ` Jan Kiszka
2016-03-02 8:47 ` Paolo Bonzini
2016-03-02 16:50 ` Peter Feiner
2016-03-01 22:34 ` [kvm-unit-tests v2 4/6] x86: vmx: Named constant: EPT_LEVEL_SHIFT Peter Feiner
2016-03-01 22:34 ` [kvm-unit-tests v2 5/6] x86: vmx: split large EPTEs in install_ept_entry Peter Feiner
2016-03-01 22:34 ` [kvm-unit-tests v2 6/6] x86: vmx: don't explicitly split identity EPT map Peter Feiner
2016-03-02 17:10 ` [kvm-unit-tests v3 0/6] Split large EPT mappings properly Peter Feiner
2016-03-02 17:10 ` [kvm-unit-tests v3 1/6] x86: vmx.h: trivial whitespace fixes Peter Feiner
2016-03-02 17:10 ` [kvm-unit-tests v3 2/6] lib: generic bitops.h Peter Feiner
2016-03-02 18:13 ` Andrew Jones
2016-03-02 17:10 ` [kvm-unit-tests v3 3/6] x86: vmx: Named constant: EPT_ADDR_MASK Peter Feiner
2016-03-02 17:10 ` [kvm-unit-tests v3 4/6] x86: vmx: Named constant: EPT_LEVEL_SHIFT Peter Feiner
2016-03-02 17:10 ` [kvm-unit-tests v3 5/6] x86: vmx: split large EPTEs in install_ept_entry Peter Feiner
2016-03-02 17:10 ` Peter Feiner [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1456938657-20850-7-git-send-email-pfeiner@google.com \
--to=pfeiner@google.com \
--cc=drjones@redhat.com \
--cc=jan.kiszka@siemens.com \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox