All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Valentine Sinitsyn <valentine.sinitsyn@gmail.com>,
	Jan Kiszka <jan.kiszka@siemens.com>,
	kvm@vger.kernel.org
Subject: Re: Nested paging in nested SVM setup
Date: Mon, 01 Sep 2014 18:11:37 +0200	[thread overview]
Message-ID: <54049AB9.20202@redhat.com> (raw)
In-Reply-To: <53F6C820.3070308@gmail.com>

Il 22/08/2014 06:33, Valentine Sinitsyn ha scritto:
> On 22.08.2014 02:31, Paolo Bonzini wrote:
>> VMX used the right access size already, the tests are separate for VMX
>> and SVM.
> Sure. So the bug is NPT-specific?

Hmm, unfortunately the test cannot reproduce the bug, at least with 3.16.
It only failed due to a (somewhat unbelievable...) typo:

diff --git a/x86/svm.c b/x86/svm.c
index 54d804b..ca1e64e 100644
--- a/x86/svm.c
+++ b/x86/svm.c
@@ -87,7 +87,7 @@ static void setup_svm(void)
         page = alloc_page();
 
         for (j = 0; j < 512; ++j)
-            page[j] = (u64)pte[(i * 514) + j] | 0x027ULL;
+            page[j] = (u64)pte[(i * 512) + j] | 0x027ULL;
 
         pde[i] = page;
     }

The trace correctly points at APIC_LVR for both the guest read:

 qemu-system-x86-23749 [019]  6718.397998: kvm_exit:             reason npf rip 0x4003ba info 100000004 fee00030
 qemu-system-x86-23749 [019]  6718.397998: kvm_nested_vmexit:    rip: 0x00000000004003ba reason: npf ext_inf1: 0x0000000100000004 ext_inf2: 0x00000000fee00030 ext_int: 0x00000000 ext_int_err: 0x00000000
 qemu-system-x86-23749 [019]  6718.397999: kvm_page_fault:       address fee00030 error_code 4
 qemu-system-x86-23749 [019]  6718.398009: kvm_emulate_insn:     0:4003ba:a1 30 00 e0 fe 00 00 00 00 (prot64)
 qemu-system-x86-23749 [019]  6718.398013: kvm_apic:             apic_read APIC_LVR = 0x1050014
 qemu-system-x86-23749 [019]  6718.398014: kvm_mmio:             mmio read len 4 gpa 0xfee00030 val 0x1050014
 qemu-system-x86-23749 [019]  6718.398015: kvm_entry:            vcpu 0

and the host read:

 qemu-system-x86-23749 [019]  6718.398035: kvm_entry:            vcpu 0
 qemu-system-x86-23749 [019]  6718.398036: kvm_exit:             reason npf rip 0x4003ca info 10000000d fee00030
 qemu-system-x86-23749 [019]  6718.398037: kvm_page_fault:       address fee00030 error_code d
 qemu-system-x86-23749 [019]  6718.398039: kvm_emulate_insn:     0:4003ca:a1 30 00 e0 fe 00 00 00 00 (prot64)
 qemu-system-x86-23749 [019]  6718.398040: kvm_apic:             apic_read APIC_LVR = 0x1050014
 qemu-system-x86-23749 [019]  6718.398040: kvm_mmio:             mmio read len 4 gpa 0xfee00030 val 0x1050014

The different error codes are because the first read will install the shadow
page.  If I change the test to do two reads, the error codes match.  I will
look at this more closely tomorrow.

Paolo

  parent reply	other threads:[~2014-09-01 16:11 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-18 11:36 Nested paging in nested SVM setup Valentine Sinitsyn
2014-06-18 12:47 ` Jan Kiszka
2014-06-18 16:59   ` Valentine Sinitsyn
2014-06-19  9:32     ` Paolo Bonzini
2014-06-19  5:03   ` Valentine Sinitsyn
2014-08-20  6:46   ` Valentine Sinitsyn
2014-08-20  6:55     ` Paolo Bonzini
2014-08-20  7:37       ` Valentine Sinitsyn
2014-08-20  8:11         ` Paolo Bonzini
2014-08-20  9:49           ` Valentine Sinitsyn
2014-08-21  6:28           ` Valentine Sinitsyn
2014-08-21  8:48             ` Valentine Sinitsyn
2014-08-21 11:04               ` Paolo Bonzini
2014-08-21 11:06                 ` Jan Kiszka
2014-08-21 11:12                   ` Valentine Sinitsyn
2014-08-21 11:16                 ` Valentine Sinitsyn
2014-08-21 11:24               ` Paolo Bonzini
2014-08-21 12:28                 ` Valentine Sinitsyn
2014-08-21 12:38                   ` Valentine Sinitsyn
2014-08-21 13:40                   ` Valentine Sinitsyn
2014-09-01 17:41                   ` Paolo Bonzini
2014-09-01 19:21                     ` Valentine Sinitsyn
2014-09-02  8:25                       ` Paolo Bonzini
2014-09-02  9:16                         ` Valentine Sinitsyn
2014-09-02 11:21                           ` Paolo Bonzini
2014-09-02 11:26                             ` Valentine Sinitsyn
2014-08-21 17:35                 ` Valentine Sinitsyn
2014-08-21 20:31                   ` Paolo Bonzini
2014-08-22  4:33                     ` Valentine Sinitsyn
2014-08-22  8:53                       ` Paolo Bonzini
2014-09-01 16:11                       ` Paolo Bonzini [this message]
2014-09-01 17:04     ` Paolo Bonzini
2014-09-02  6:09       ` Valentine Sinitsyn
2014-09-02  6:21         ` Valentine Sinitsyn
2014-09-02  9:45         ` Paolo Bonzini
2014-09-02  9:53           ` Valentine Sinitsyn
2014-09-02 11:48             ` Paolo Bonzini
2014-09-02 10:31           ` Valentine Sinitsyn

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=54049AB9.20202@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=jan.kiszka@siemens.com \
    --cc=kvm@vger.kernel.org \
    --cc=valentine.sinitsyn@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.