On 2015-04-20 19:16, Radim Krčmář wrote: > 2015-04-20 18:14+0200, Radim Krčmář: >> Tested-by: Radim Krčmář <rkrc...@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 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html