All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gleb Natapov <gleb@redhat.com>
To: Igor Mammedov <imammedo@redhat.com>
Cc: kvm@vger.kernel.org, avi@redhat.com, marcelo@redhat.com
Subject: Re: [PATCHv2] Add async page fault test
Date: Wed, 9 May 2012 15:45:47 +0300	[thread overview]
Message-ID: <20120509124547.GW15960@redhat.com> (raw)
In-Reply-To: <4FAA66BA.5040607@redhat.com>

On Wed, May 09, 2012 at 02:44:42PM +0200, Igor Mammedov wrote:
> On 05/09/2012 12:33 PM, Gleb Natapov wrote:
> >The test checks that when hypervisor prefaults swapped in page it does
> >not generates spurious #PFs in case page was unmapped while it was
> >swapped out.
> >
> >diff --git a/config-x86-common.mak b/config-x86-common.mak
> >index c8fbda7..6976f78 100644
> >--- a/config-x86-common.mak
> >+++ b/config-x86-common.mak
> >@@ -34,7 +34,7 @@ tests-common = $(TEST_DIR)/vmexit.flat $(TEST_DIR)/tsc.flat \
> >                 $(TEST_DIR)/realmode.flat $(TEST_DIR)/msr.flat \
> >                 $(TEST_DIR)/hypercall.flat $(TEST_DIR)/sieve.flat \
> >                 $(TEST_DIR)/kvmclock_test.flat  $(TEST_DIR)/eventinj.flat \
> >-               $(TEST_DIR)/s3.flat $(TEST_DIR)/pmu.flat
> >+               $(TEST_DIR)/s3.flat $(TEST_DIR)/pmu.flat $(TEST_DIR)/asyncpf.flat
> >
> >  ifdef API
> >  tests-common += api/api-sample
> >@@ -90,6 +90,8 @@ $(TEST_DIR)/s3.elf: $(cstart.o) $(TEST_DIR)/s3.o
> >
> >  $(TEST_DIR)/pmu.elf: $(cstart.o) $(TEST_DIR)/pmu.o
> >
> >+$(TEST_DIR)/asyncpf.elf: $(cstart.o) $(TEST_DIR)/asyncpf.o
> >+
> >  arch_clean:
> >  	$(RM) $(TEST_DIR)/*.o $(TEST_DIR)/*.flat $(TEST_DIR)/*.elf \
> >  	$(TEST_DIR)/.*.d $(TEST_DIR)/lib/.*.d $(TEST_DIR)/lib/*.o
> >diff --git a/lib/x86/processor.h b/lib/x86/processor.h
> >index c7e1afb..e46d8d0 100644
> >--- a/lib/x86/processor.h
> >+++ b/lib/x86/processor.h
> >@@ -302,4 +302,9 @@ static inline void invlpg(void *va)
> >  {
> >  	asm volatile("invlpg (%0)" ::"r" (va) : "memory");
> >  }
> >+
> >+static inline void safe_halt(void)
> >+{
> >+	asm volatile("sti; hlt");
> >+}
> >  #endif
> >diff --git a/lib/x86/vm.c b/lib/x86/vm.c
> >index 550ec9b..71b70fd 100644
> >--- a/lib/x86/vm.c
> >+++ b/lib/x86/vm.c
> >@@ -219,6 +219,11 @@ void *vmalloc(unsigned long size)
> >      return mem;
> >  }
> >
> >+uint64_t virt_to_phys_cr3(void *mem)
> >+{
> >+    return (get_pte(phys_to_virt(read_cr3()), mem)&  PTE_ADDR) + ((ulong)mem&  (PAGE_SIZE - 1));
> >+}
> >+
> >  void vfree(void *mem)
> >  {
> >      unsigned long size = ((unsigned long *)mem)[-1];
> >diff --git a/lib/x86/vm.h b/lib/x86/vm.h
> >index 71ab4a8..3473f8d 100644
> >--- a/lib/x86/vm.h
> >+++ b/lib/x86/vm.h
> >@@ -22,6 +22,7 @@ void vfree(void *mem);
> >  void *vmap(unsigned long long phys, unsigned long size);
> >  void *alloc_vpage(void);
> >  void *alloc_vpages(ulong nr);
> >+uint64_t virt_to_phys_cr3(void *mem);
> >
> >  void install_pte(unsigned long *cr3,
> >                          int pte_level,
> >diff --git a/x86/asyncpf.c b/x86/asyncpf.c
> >new file mode 100644
> >index 0000000..62c0455
> >--- /dev/null
> >+++ b/x86/asyncpf.c
> >@@ -0,0 +1,113 @@
> >+/*
> >+ * Async PF test. For the test to actually do anywathing it ineeds to be started
>                                                  ^^^^^^^^^^^^^^^^^^^^ typo?
> 
Either that, or a new word!

--
			Gleb.

  reply	other threads:[~2012-05-09 12:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-09 10:33 [PATCHv2] Add async page fault test Gleb Natapov
2012-05-09 12:44 ` Igor Mammedov
2012-05-09 12:45   ` Gleb Natapov [this message]
2012-05-14 22:30 ` Marcelo Tosatti

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=20120509124547.GW15960@redhat.com \
    --to=gleb@redhat.com \
    --cc=avi@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=marcelo@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.