From: Jan Kiszka <jan.kiszka@siemens.com>
To: "Radim Krčmář" <rkrcmar@redhat.com>
Cc: kvm <kvm@vger.kernel.org>, Joel Schopp <joel.schopp@amd.com>
Subject: Re: [RFC][PATCH] KVM: SVM: Sync g_pat with guest-written PAT value
Date: Mon, 20 Apr 2015 19:21:53 +0200 [thread overview]
Message-ID: <553535B1.3050901@siemens.com> (raw)
In-Reply-To: <20150420171635.GC26491@potion.brq.redhat.com>
On 2015-04-20 19:16, Radim Krčmář wrote:
> 2015-04-20 18:14+0200, Radim Krčmář:
>> Tested-by: Radim Krčmář <rkrcmar@redhat.com>
>
> Uncached accesses were roughly 20x slower.
> In case anyone wanted to reproduce, I used this as a kvm-unit-test:
>
> ---
> #include "processor.h"
>
> #define NR_TOP_LOOPS 24
> #define NR_MEM_LOOPS 10
> #define MEM_ELEMENTS 1024
>
> static volatile u64 pat_test_memory[MEM_ELEMENTS];
>
> static void flush_tlb(void)
> {
> write_cr3(read_cr3());
> }
>
> static void set_pat(u64 val)
> {
> wrmsr(0x277, val);
> flush_tlb();
>
> }
>
> static u64 time_memory_accesses(void)
> {
> u64 tsc_before = rdtsc();
>
> for (unsigned loop = 0; loop < NR_MEM_LOOPS; loop++)
> for (unsigned i = 0; i < MEM_ELEMENTS; i++)
> pat_test_memory[i]++;
>
> return rdtsc() - tsc_before;
> }
>
> int main(int argc, char **argv)
> {
> unsigned error = 0;
>
> for (unsigned loop = 0; loop < NR_TOP_LOOPS; loop++) {
> u64 time_uc, time_wb;
>
> set_pat(0);
> time_uc = time_memory_accesses();
>
> set_pat(0x0606060606060606ULL);
> time_wb = time_memory_accesses();
>
> if (time_uc < time_wb * 4)
> error++;
>
> printf("%02d uc: %10lld wb: %8lld\n", loop, time_uc, time_wb);
> }
>
> report("guest PAT", !error);
>
> return report_summary();
> }
>
Great, thanks. Will you push it to the unit tests? Could raise
motivations to fix the !NPT/EPT case.
Jan
--
Siemens AG, Corporate Technology, CT RTC ITP SES-DE
Corporate Competence Center Embedded Linux
next prev parent reply other threads:[~2015-04-20 17:22 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-13 5:16 KVM: How does is PAT emulation supposed to work? Jan Kiszka
2015-04-13 6:58 ` [RFC][PATCH] KVM: SVM: Sync g_pat with guest-written PAT value Jan Kiszka
2015-04-17 16:59 ` Radim Krčmář
2015-04-20 16:14 ` Radim Krčmář
2015-04-20 17:16 ` Radim Krčmář
2015-04-20 17:21 ` Jan Kiszka [this message]
2015-04-20 17:33 ` Radim Krčmář
2015-04-20 17:37 ` Jan Kiszka
2015-04-20 17:45 ` Jan Kiszka
2015-04-20 18:33 ` Radim Krčmář
2015-04-20 18:41 ` Jan Kiszka
2015-04-21 12:10 ` Radim Krčmář
2015-04-21 12:11 ` Paolo Bonzini
2015-04-20 17:22 ` Radim Krčmář
2015-04-20 17:25 ` [PATCH v2] " Jan Kiszka
2015-04-20 17:35 ` Radim Krčmář
2015-04-21 11:09 ` Paolo Bonzini
2015-04-21 11:25 ` Jan Kiszka
2015-04-21 11:32 ` Paolo Bonzini
2015-04-21 11:56 ` Jan Kiszka
2015-04-21 12:12 ` Paolo Bonzini
2015-04-21 12:21 ` Radim Krčmář
2015-05-24 15:28 ` Jan Kiszka
2016-02-09 19:25 ` Jan Kiszka
2015-04-17 16:43 ` KVM: How does is PAT emulation supposed to work? Radim Krčmář
2015-04-17 17:12 ` Jan Kiszka
2015-04-17 20:28 ` 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=553535B1.3050901@siemens.com \
--to=jan.kiszka@siemens.com \
--cc=joel.schopp@amd.com \
--cc=kvm@vger.kernel.org \
--cc=rkrcmar@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 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.