public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@qumranet.com>
To: Anthony Liguori <anthony@codemonkey.ws>
Cc: Carsten Otte <cotte@de.ibm.com>,
	Andrea Arcangeli <andrea@qumranet.com>,
	Hollis Blanchard <hollisb@us.ibm.com>,
	kvm-devel@lists.sourceforge.net,
	Ben-Ami Yassour <benami@il.ibm.com>,
	"Zhang,  Xiantao" <xiantao.zhang@intel.com>
Subject: Re: [PATCH] Handle vma regions with no backing page (v2)
Date: Wed, 30 Apr 2008 01:42:21 +0300	[thread overview]
Message-ID: <4817A44D.5080808@qumranet.com> (raw)
In-Reply-To: <4817A06C.5000503@codemonkey.ws>

Anthony Liguori wrote:
>>
>>  
>>>  
>>>  struct page *gfn_to_page(struct kvm *kvm, gfn_t gfn)
>>>  {
>>> -    return pfn_to_page(gfn_to_pfn(kvm, gfn));
>>> +    pfn_t pfn;
>>> +
>>> +    pfn = gfn_to_pfn(kvm, gfn);
>>> +    if (pfn_valid(pfn))
>>> +        return pfn_to_page(pfn);
>>> +
>>> +    return NULL;
>>>  }
>>>       
>>
>> You're returning NULL here, not bad_page.
>>   
>
> My thinking was that bad_page indicates that the gfn is invalid.  This 
> is a different type of error though.  The problem is that the guest is 
> we are trying to kmap() a page that has no struct page associated with 
> it.  I'm not sure what the right thing to do here is.
>

It depends on what's going on?  Does a page table point to mmio?  Or the 
glommerclock?

Not sure there is a single answer.

> Perhaps we should be replacing consumers of gfn_to_page() with 
> copy_to_user() instead?

Indeed we should.  The problem is access in atomic contexts.  It's easy 
to detect failure, but not always easy to handle it.

-- 
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

  reply	other threads:[~2008-04-29 22:42 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 [this message]
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
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=4817A44D.5080808@qumranet.com \
    --to=avi@qumranet.com \
    --cc=andrea@qumranet.com \
    --cc=anthony@codemonkey.ws \
    --cc=benami@il.ibm.com \
    --cc=cotte@de.ibm.com \
    --cc=hollisb@us.ibm.com \
    --cc=kvm-devel@lists.sourceforge.net \
    --cc=xiantao.zhang@intel.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