From: Avi Kivity <avi@qumranet.com>
To: Muli Ben-Yehuda <muli@il.ibm.com>
Cc: kvm-devel@lists.sourceforge.net,
Andrea Arcangeli <andrea@qumranet.com>,
Ben-Ami Yassour1 <BENAMI@il.ibm.com>
Subject: Re: [PATCH] Handle vma regions with no backing page (v2)
Date: Wed, 30 Apr 2008 11:59:47 +0300 [thread overview]
Message-ID: <48183503.9050005@qumranet.com> (raw)
In-Reply-To: <20080430061140.GE7378@il.ibm.com>
Muli Ben-Yehuda wrote:
>> @@ -544,19 +545,35 @@ pfn_t gfn_to_pfn(struct kvm *kvm, gfn_t gfn)
>> npages = get_user_pages(current, current->mm, addr, 1, 1, 1, page,
>> NULL);
>>
>> - if (npages != 1) {
>> - get_page(bad_page);
>> - return page_to_pfn(bad_page);
>> - }
>> + if (unlikely(npages != 1)) {
>> + struct vm_area_struct *vma;
>>
>> - return page_to_pfn(page[0]);
>> + vma = find_vma(current->mm, addr);
>> + if (vma == NULL || addr >= vma->vm_start ||
>> + !(vma->vm_flags & VM_PFNMAP)) {
>>
>
> Isn't the check for addr backwards here? For the VMA we would like to
> to find, vma->vm_start <= addr < vma->vm_end.
>
>
The code is not trying to find a vma for the address, but a vma for the
address which also has VM_PFNMAP set. The cases for vma not found, or
vma found, but not VM_PFNMAP, are folded together.
--
Any sufficiently difficult bug is indistinguishable from a feature.
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
next prev parent reply other threads:[~2008-04-30 8:59 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-29 19:09 [PATCH] Handle vma regions with no backing page (v2) Anthony Liguori
2008-04-29 22:17 ` Avi Kivity
2008-04-29 22:25 ` Anthony Liguori
2008-04-29 22:42 ` Avi Kivity
2008-04-29 22:51 ` Anthony Liguori
2008-04-29 22:52 ` Avi Kivity
2008-04-29 22:57 ` Hollis Blanchard
2008-04-29 23:12 ` Anthony Liguori
2008-04-30 7:00 ` Andrea Arcangeli
2008-04-30 15:37 ` Anthony Liguori
2008-04-30 15:11 ` Hollis Blanchard
2008-04-30 7:59 ` Carsten Otte
2008-04-30 6:11 ` Muli Ben-Yehuda
2008-04-30 8:59 ` Avi Kivity [this message]
2008-04-30 9:13 ` Andrea Arcangeli
2008-04-30 9:15 ` Avi Kivity
2008-04-30 12:24 ` Anthony Liguori
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=48183503.9050005@qumranet.com \
--to=avi@qumranet.com \
--cc=BENAMI@il.ibm.com \
--cc=andrea@qumranet.com \
--cc=kvm-devel@lists.sourceforge.net \
--cc=muli@il.ibm.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