xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Tim Deegan <tim@xen.org>
To: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Cc: andres@gridcentric.ca, xen-devel@lists.xen.org
Subject: Re: [PATCH] x86/mem_sharing: Rectify test for "empty" physmap entry in sharing_add_to_physmap
Date: Wed, 18 Apr 2012 16:01:47 +0100	[thread overview]
Message-ID: <20120418150147.GI7013@ocelot.phlegethon.org> (raw)
In-Reply-To: <80232f2ec1589fa3d0be7f6a575eb7f1.squirrel@webmail.lagarcavilla.org>

At 07:18 -0700 on 18 Apr (1334733529), Andres Lagar-Cavilla wrote:
> > At 09:06 -0400 on 18 Apr (1334740000), Andres Lagar-Cavilla wrote:
> >>  xen/arch/x86/mm/mem_sharing.c |  6 ++++--
> >>  1 files changed, 4 insertions(+), 2 deletions(-)
> >>
> >>
> >> Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
> >>
> >> diff -r 8609bbbba141 -r 495d3df95c1d xen/arch/x86/mm/mem_sharing.c
> >> --- a/xen/arch/x86/mm/mem_sharing.c
> >> +++ b/xen/arch/x86/mm/mem_sharing.c
> >> @@ -1073,9 +1073,11 @@ int mem_sharing_add_to_physmap(struct do
> >>      if ( spage->sharing->handle != sh )
> >>          goto err_unlock;
> >>
> >> -    /* Make sure the target page is a hole in the physmap */
> >> +    /* Make sure the target page is a hole in the physmap. This is not
> >> as
> >> +     * simple a test as we'd like it to be. Non-existent p2m entries
> >> return
> >> +     * invalid mfn and p2m_mmio_dm type when queried. */
> >>      if ( mfn_valid(cmfn) ||
> >> -         (!(p2m_is_ram(cmfn_type))) )
> >> +         ( (!(p2m_is_ram(cmfn_type))) && (cmfn_type != p2m_mmio_dm) ) )
> >
> > This test looks wrong, even after the fix.  I think it should be testing
> > for cmfn_type == p2m_mmio_dm || cmfn_type == p2m_invalid and ignoring
> > mfn_valid().
> 
> Maybe :)
> 
> I'm coming up with the semantics for this one, loosely based on  the
> regular populate physmap code path. That one can end up replacing existing
> regular pages, or paged out entries, or PoD entries, with the new
> populated pages (in guest_physmap_add_entry). I don't know that all of the
> above is reasonable.
> 
> But certainly I would like to keep the ability to replace paged out
> entries with (identical) pages that are already present in other domains.

Fair enough.  Maybe you could define a new p2m-type-mask of all the
things you think it's OK to replace in this kind of situation, and apply
it in all cases?

Tim.

  reply	other threads:[~2012-04-18 15:01 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-18 13:06 [PATCH] x86/mem_sharing: Rectify test for "empty" physmap entry in sharing_add_to_physmap Andres Lagar-Cavilla
2012-04-18 13:59 ` Tim Deegan
2012-04-18 14:18   ` Andres Lagar-Cavilla
2012-04-18 15:01     ` Tim Deegan [this message]
2012-04-18 15:13       ` Andres Lagar-Cavilla
2012-04-18 15:17         ` Tim Deegan
2012-04-18 15:55           ` Andres Lagar-Cavilla
  -- strict thread matches above, loose matches on Subject: below --
2012-05-16 14:05 Andres Lagar-Cavilla
2012-05-17  9:40 ` Tim Deegan
2012-05-17 11:36   ` Andres Lagar-Cavilla
2012-05-17 12:02     ` Tim Deegan
2012-05-17 15:55       ` Andres Lagar-Cavilla
2012-05-18 15:22         ` Tim Deegan
2012-05-18 15:25           ` Andres Lagar-Cavilla
2012-05-23 14:34           ` Andres Lagar-Cavilla
2012-05-23 16:17             ` Tim Deegan

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=20120418150147.GI7013@ocelot.phlegethon.org \
    --to=tim@xen.org \
    --cc=andres@gridcentric.ca \
    --cc=andres@lagarcavilla.org \
    --cc=xen-devel@lists.xen.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).