From: Paolo Bonzini <pbonzini@redhat.com>
To: Brijesh Singh <brijesh.singh@amd.com>
Cc: kvm@vger.kernel.org, thomas lendacky <thomas.lendacky@amd.com>,
rkrcmar@redhat.com, joro@8bytes.org, x86@kernel.org,
linux-kernel@vger.kernel.org, mingo@redhat.com, hpa@zytor.com,
tglx@linutronix.de, bp@suse.de
Subject: Re: [PATCH v2 3/3] kvm: svm: Use the hardware provided GPA instead of page walk
Date: Tue, 13 Dec 2016 18:09:57 +0100 [thread overview]
Message-ID: <057d8a2e-0a3a-38d3-d9bf-9301e3eb8238@redhat.com> (raw)
In-Reply-To: <6e1fd4ba-016c-99ea-5b98-24f89479da4b@amd.com>
On 12/12/2016 18:51, Brijesh Singh wrote:
> As per the AMD BKDG [1] Section 2.7.1, we should not be using any of
> these instruction for MMIO access, the behavior is undefined.
>
> The question is, do we really need to add logic to detect the cross-page
> MMIO accesses and push/pop mem operations so that we pass the
> kvm-unit-test or we should update the unit test? Like you said
> cross-page MMIO access detection is going to be a bit tricky.
Actually there is a nice trick you can do to support cross-page
MMIO access detection:
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 37cd31645d45..754d251dc611 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -4549,6 +4549,7 @@ static int emulator_read_write_onepage(unsigned long addr, void *val,
*/
if (vcpu->arch.gpa_available &&
!emulator_is_string_op(ctxt) &&
+ (addr & ~PAGE_MASK) == (exception->address & ~PAGE_MASK) &&
vcpu_is_mmio_gpa(vcpu, addr, exception->address, write)) {
gpa = exception->address;
goto mmio;
It fixes the testcase for push/pop with two memory ops too,
but it's not reliable, so your change for TwoMemOp is still
necessary. Feel free to include it in your patch!
Regarding the replacement of emulator_is_string_op with
emulator_is_two_memory_op, what about REP prefixes? In that
case I think that you do need to reject string ops. So the
function would have to reject all TwoMemOps, and REP-prefixed
String operations.
Paolo
next prev parent reply other threads:[~2016-12-13 17:10 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-23 17:01 [PATCH v2 0/3] x86: SVM: add additional SVM NPF error and use HW GPA Brijesh Singh
2016-11-23 17:01 ` [PATCH v2 1/3] kvm: svm: Add support for additional SVM NPF error codes Brijesh Singh
2017-07-27 16:27 ` Paolo Bonzini
2017-07-31 13:30 ` Brijesh Singh
2017-07-31 15:44 ` Paolo Bonzini
2017-07-31 16:54 ` Brijesh Singh
2017-07-31 20:05 ` Paolo Bonzini
2017-08-01 13:36 ` Brijesh Singh
2017-08-02 10:42 ` Paolo Bonzini
2017-08-04 0:30 ` Brijesh Singh
2017-08-04 14:05 ` Paolo Bonzini
2017-08-04 14:23 ` Brijesh Singh
2016-11-23 17:01 ` [PATCH v2 2/3] kvm: svm: Add kvm_fast_pio_in support Brijesh Singh
2016-11-23 17:02 ` [PATCH v2 3/3] kvm: svm: Use the hardware provided GPA instead of page walk Brijesh Singh
2016-11-23 21:53 ` Paolo Bonzini
2016-12-08 14:52 ` Paolo Bonzini
2016-12-08 15:39 ` Brijesh Singh
2016-12-08 19:00 ` Brijesh Singh
2016-12-09 15:41 ` Paolo Bonzini
2016-12-12 17:51 ` Brijesh Singh
2016-12-13 17:09 ` Paolo Bonzini [this message]
2016-12-14 17:07 ` Brijesh Singh
2016-12-14 17:23 ` Paolo Bonzini
2016-12-14 18:39 ` Brijesh Singh
2016-12-14 18:47 ` Paolo Bonzini
2016-11-24 20:51 ` [PATCH v2 0/3] x86: SVM: add additional SVM NPF error and use HW GPA Radim Krčmář
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=057d8a2e-0a3a-38d3-d9bf-9301e3eb8238@redhat.com \
--to=pbonzini@redhat.com \
--cc=bp@suse.de \
--cc=brijesh.singh@amd.com \
--cc=hpa@zytor.com \
--cc=joro@8bytes.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=rkrcmar@redhat.com \
--cc=tglx@linutronix.de \
--cc=thomas.lendacky@amd.com \
--cc=x86@kernel.org \
/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
all inboxes | Powered by JetHome®