xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: "Andres Lagar-Cavilla" <andres@lagarcavilla.org>
To: Tim Deegan <tim@xen.org>
Cc: andres@gridcentric.ca,
	Andres Lagar-Cavilla <andres@lagarcavilla.org>,
	xen-devel@lists.xen.org
Subject: Re: [PATCH 2 of 2] x86/mem_sharing: Rectify test for "empty" physmap entry in sharing_add_to_physmap
Date: Wed, 25 Apr 2012 08:20:13 -0700	[thread overview]
Message-ID: <1eca79e04d540f6c44b72e865c19c3b9.squirrel@webmail.lagarcavilla.org> (raw)
In-Reply-To: <20120425124147.GD51354@ocelot.phlegethon.org>

> At 15:20 -0400 on 24 Apr (1335280819), Andres Lagar-Cavilla wrote:
>>  xen/arch/x86/mm/mem_sharing.c |  7 ++++---
>>  xen/include/asm-x86/p2m.h     |  8 ++++++++
>>  2 files changed, 12 insertions(+), 3 deletions(-)
>>
>>
>> Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
>>
>> diff -r 5be9a05f17fd -r 51646b89b182 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,10 @@ 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 */
>> -    if ( mfn_valid(cmfn) ||
>> -         (!(p2m_is_ram(cmfn_type))) )
>> +    /* Make sure the target page is a hole in the physmap. These are
>> typically
>> +     * p2m_mmio_dm, but also accept p2m_invalid and paged out pages.
>> See the
>> +     * definition of p2m_is_hole in p2m.h. */
>> +    if ( !p2m_is_hole(cmfn_type) || mfn_valid(cmfn) )
>
> Hmm.  Is the mfn_valid() to handle p2m_ram_paging_in entries sometimes
> having an MFN and sometimes not?  I think it would be nicer to either
> always replace paging-in pages or never do it.  In any case, it's bogus
> to test mfn_valid() for any of the other types.

Yes, that is the concern. paging_in entries may have a backing mfn. I am
not opposed to just replacing the entry if it is in paging_in state,
regardless of the mfn. It would be similar to any of the cases in which
guest_physmap_add_entry is used with a valid mfn in the entry to be
updated.

Andres

>
> Cheers,
>
> Tim.
>

      reply	other threads:[~2012-04-25 15:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-24 19:20 [PATCH 0 of 2] Sharing bug fixes Andres Lagar-Cavilla
2012-04-24 19:20 ` [PATCH 1 of 2] x86/mem_sharing: Fix saved mfns stat for failed unsharing Andres Lagar-Cavilla
2012-04-26  9:13   ` Tim Deegan
2012-04-24 19:20 ` [PATCH 2 of 2] x86/mem_sharing: Rectify test for "empty" physmap entry in sharing_add_to_physmap Andres Lagar-Cavilla
2012-04-25 12:41   ` Tim Deegan
2012-04-25 15:20     ` Andres Lagar-Cavilla [this message]

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=1eca79e04d540f6c44b72e865c19c3b9.squirrel@webmail.lagarcavilla.org \
    --to=andres@lagarcavilla.org \
    --cc=andres@gridcentric.ca \
    --cc=tim@xen.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).