All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jan Beulich" <JBeulich@suse.com>
To: George Dunlap <george.dunlap@citrix.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>,
	Wei Liu <wei.liu2@citrix.com>,
	George Dunlap <George.Dunlap@eu.citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Ian Jackson <Ian.Jackson@eu.citrix.com>, Tim Deegan <tim@xen.org>,
	Julien Grall <julien.grall@arm.com>,
	xen-devel <xen-devel@lists.xenproject.org>
Subject: Re: [PATCH v2 1/2] x86/PoD: correctly handle non-order-0 decrease-reservation requests
Date: Fri, 19 Jan 2018 09:13:48 -0700	[thread overview]
Message-ID: <5A62274C02000078001A07F8@prv-mh.provo.novell.com> (raw)
In-Reply-To: <60012010-26ea-17a5-8fd3-fd0d69164c76@citrix.com>

>>> On 19.01.18 at 17:04, <george.dunlap@citrix.com> wrote:
> On 12/20/2017 09:34 AM, Jan Beulich wrote:
>> p2m_pod_decrease_reservation() at the moment only returns a boolean
>> value: true for "nothing more to do", false for "something more to do".
>> If it returns false, decrease_reservation() will loop over the entire
>> range, calling guest_remove_page() for each page.
>> 
>> Unfortunately, in the case p2m_pod_decrease_reservation() succeeds
>> partially, some of the memory in the range will be not-present; at which
>> point guest_remove_page() will return an error, and the entire operation
>> will fail.
>> 
>> Fix this by:
>> 1. Having p2m_pod_decrease_reservation() return exactly the number of
>>    gpfn pages it has handled (i.e., replaced with 'not present').
>> 2. Making guest_remove_page() return -ENOENT in the case that the gpfn
>>    in question was already empty (and in no other cases).
>> 3. When looping over guest_remove_page(), expect the number of -ENOENT
>>    failures to be no larger than the number of pages
>>    p2m_pod_decrease_reservation() removed.
>> 
>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>> Signed-off-by: George Dunlap <george.dunlap@citrix.com>
>> ---
>> v2: Re-written description (by George). Add comments (as suggested
>>     by George). Formatting.
> 
> One thing to double-check...
> 
>> @@ -335,10 +336,8 @@ int guest_remove_page(struct domain *d,
>>          rc = mem_sharing_unshare_page(d, gmfn, 0);
>>          if ( rc )
>>          {
>> -            put_gfn(d, gmfn);
>>              (void)mem_sharing_notify_enomem(d, gmfn, 0);
>> -
>> -            return rc;
>> +            goto out_put_gfn;
> 
> I take it you've checked to make sure that moving this put_gfn() over
> the notify call is OK?

Yes, in fact the stale-ness of the GFN is going to be slightly
reduced by the reference being held across that function (i.e.
now at least it's not stale at the time the event is put on the
ring). The function doesn't use it for anything other than
storing its value.

> I took a brief look and it seems OK to me; so if you're happy with that
> then:
> 
> Reviewed-by: George Dunlap <george.dunlap@citrix.com>

Thanks, it has gone in earlier today already anyway, based on
Andrew's ack (which admittedly he has given over irc rather
than by mail).

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2018-01-19 16:34 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-04 10:49 [PATCH 0/3] x86: XSA-246 / -247 follow-up Jan Beulich
2017-12-04 11:06 ` [PATCH 1/3] x86/PoD: correctly handle non-order-0 decrease-reservation requests Jan Beulich
2017-12-04 15:58   ` Andrew Cooper
2017-12-05  7:42     ` Jan Beulich
2017-12-07 12:56   ` George Dunlap
2017-12-07 13:07     ` Jan Beulich
2017-12-04 11:06 ` [PATCH 2/3] x86/mm: drop yet another relic of translated PV domains from new_guest_cr3() Jan Beulich
2017-12-04 15:58   ` Andrew Cooper
2017-12-04 11:07 ` [PATCH 3/3] x86/p2m: force return value checking of p2m_set_entry() Jan Beulich
2017-12-04 16:03   ` Andrew Cooper
2017-12-05  1:47   ` Tian, Kevin
2017-12-20  9:25 ` [PATCH v2 0/2] x86: XSA-246 / -247 follow-up Jan Beulich
2017-12-20  9:34   ` [PATCH v2 1/2] x86/PoD: correctly handle non-order-0 decrease-reservation requests Jan Beulich
2018-01-18 15:59     ` Ping: " Jan Beulich
2018-01-18 16:36       ` Julien Grall
2018-01-19 16:04     ` George Dunlap
2018-01-19 16:13       ` Jan Beulich [this message]
2017-12-20  9:35   ` [PATCH v2 2/2] x86/p2m: force return value checking of p2m_set_entry() Jan Beulich
2018-01-19 17:09     ` George Dunlap

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=5A62274C02000078001A07F8@prv-mh.provo.novell.com \
    --to=jbeulich@suse.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=george.dunlap@citrix.com \
    --cc=julien.grall@arm.com \
    --cc=sstabellini@kernel.org \
    --cc=tim@xen.org \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xenproject.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.