From: Avi Kivity <avi@redhat.com>
To: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>, KVM list <kvm@vger.kernel.org>
Subject: Re: unit tests and get_user_pages_ptes_fast()
Date: Tue, 05 Oct 2010 09:36:59 +0200 [thread overview]
Message-ID: <4CAAD59B.5020003@redhat.com> (raw)
In-Reply-To: <20101004235953.GA1474@amt.cnet>
On 10/05/2010 01:59 AM, Marcelo Tosatti wrote:
> Yep, the drawback is the unnecessary write fault. What i have here is:
>
> --- kvm.orig/virt/kvm/kvm_main.c
> +++ kvm/virt/kvm/kvm_main.c
> @@ -827,7 +827,7 @@ unsigned long gfn_to_hva(struct kvm *kvm
> }
> EXPORT_SYMBOL_GPL(gfn_to_hva);
>
> -pfn_t gfn_to_pfn(struct kvm *kvm, gfn_t gfn)
> +pfn_t gfn_to_pfn(struct kvm *kvm, gfn_t gfn, int *writable)
> {
> struct page *page[1];
> unsigned long addr;
> @@ -842,8 +842,16 @@ pfn_t gfn_to_pfn(struct kvm *kvm, gfn_t
> return page_to_pfn(bad_page);
> }
>
> + *writable = 1;
> npages = get_user_pages_fast(addr, 1, 1, page);
>
> + /* attempt to map read-only */
> + if (unlikely(npages != 1)) {
> + npages = get_user_pages_fast(addr, 1, 0, page);
> + if (npages == 1)
> + *writable = 0;
> + }
> +
> if (unlikely(npages != 1)) {
> struct vm_area_struct *vma;
>
> Can rebase and resend, if you'd like.
>
That will work for me but not for ksm. I guess it's good to get things
going, so please to post it.
--
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.
next prev parent reply other threads:[~2010-10-05 7:37 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-04 9:35 unit tests and get_user_pages_ptes_fast() Avi Kivity
2010-10-04 13:40 ` Andrea Arcangeli
2010-10-04 23:59 ` Marcelo Tosatti
2010-10-05 7:36 ` Avi Kivity [this message]
2010-10-05 9:22 ` Marcelo Tosatti
2010-10-05 14:15 ` Andrea Arcangeli
2010-10-05 14:25 ` Avi Kivity
2010-10-05 14:32 ` Andrea Arcangeli
2010-10-05 14:36 ` Avi Kivity
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=4CAAD59B.5020003@redhat.com \
--to=avi@redhat.com \
--cc=aarcange@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox