kvm-ppc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Scott Wood <scottwood@freescale.com>
To: kvm-ppc@vger.kernel.org
Subject: Re: [PATCH v5 5/5] KVM: PPC: e500: MMU API
Date: Mon, 08 Aug 2011 23:13:41 +0000	[thread overview]
Message-ID: <4E406DA5.7070803@freescale.com> (raw)
In-Reply-To: <20110707234159.GE6646@schlenkerla.am.freescale.net>

On 08/08/2011 03:49 AM, Johannes Weiner wrote:
> On Mon, Jul 25, 2011 at 11:50:50PM +0200, Alexander Graf wrote:
>>
>> Well, alternatively we could simply bail out if the memory is not
>> anonymous, right? Then the pinning on get_user_pages_fast should be
>> enough. Johannes, would there be any downside to this approach?
> 
> I don't see any correctness issues.  Maybe Andrea does?
> 
> While the userspace pages are never freed because of your reference,
> it does not prevent reclaim from writing them to swap und unmapping
> them from the user's page tables.

Being unmapped from the user's page tables isn't a problem, as long as
if the mapping is faulted back in before the I/O reference is released,
it points at the same physical page.  Anything else seems like it would
break using get_free_pages() to implement read() -- you could be
swapping out the wrong data.  I hope that the "there may even be a
completely different page there in some cases (eg. if mmapped pagecache
has been invalidated and subsequently re faulted)" in the
__get_user_pages() comment is referring to the !FOLL_WRITE case (or an
explicit mapping change from userspace).

This usage of get_free_pages() is pretty similar to how the guest's
memory is dealt with.  When the guest adds a TLB entry,
get_user_pages_fast() gets called.  It also doesn't get marked dirty
until just before release, and userspace may access the memory before
then (for debugging the guest, emulated DMA, etc).  If that's not a
problem, it shouldn't be a problem here either.

-Scott


  parent reply	other threads:[~2011-08-08 23:13 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-07 23:41 [PATCH v5 5/5] KVM: PPC: e500: MMU API Scott Wood
2011-07-08 12:57 ` Alexander Graf
2011-07-18 10:09 ` Alexander Graf
2011-07-18 16:18 ` Scott Wood
2011-07-18 16:33 ` Alexander Graf
2011-07-18 18:08 ` Scott Wood
2011-07-18 21:44 ` Alexander Graf
2011-07-19  8:36 ` Johannes Weiner
2011-07-19  8:51 ` Alexander Graf
2011-07-19 11:20 ` Johannes Weiner
2011-07-24  9:16 ` Alexander Graf
2011-07-25 19:25 ` Scott Wood
2011-07-25 21:50 ` Alexander Graf
2011-08-08  8:49 ` Johannes Weiner
2011-08-08 23:13 ` Scott Wood [this message]
2011-08-13 15:14 ` Benjamin Herrenschmidt
2011-08-15 15:03 ` Scott Wood
2011-08-15 15:15 ` Benjamin Herrenschmidt
2011-08-15 20:55 ` Scott Wood

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=4E406DA5.7070803@freescale.com \
    --to=scottwood@freescale.com \
    --cc=kvm-ppc@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).