From: "Jan Beulich" <JBeulich@suse.com>
To: xen-devel <xen-devel@lists.xenproject.org>
Cc: Stefano Stabellini <sstabellini@kernel.org>,
Wei Liu <wei.liu2@citrix.com>,
Konrad Rzeszutek Wilk <konrad.wilk@oracle.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>
Subject: [PATCH v2 2/2] make domain_adjust_tot_pages() __must_check
Date: Wed, 05 Dec 2018 09:17:24 -0700 [thread overview]
Message-ID: <5C07FA14020000780020336D@prv1-mh.provo.novell.com> (raw)
In-Reply-To: <5C07F95A0200007800203354@prv1-mh.provo.novell.com>
Even if unlikely, donate_page() should not ignore the possible need to
obtain a domain reference. To make people look more closely when they
add new uses of domain_adjust_tot_pages(), force its return value to be
checked. This in turn requires a benign change to assign_pages().
Signed-off-by: Jan Beulich <jbeulich@suse.com>
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -4009,7 +4009,8 @@ int donate_page(
{
if ( d->tot_pages >= d->max_pages )
goto fail;
- domain_adjust_tot_pages(d, 1);
+ if ( unlikely(domain_adjust_tot_pages(d, 1) == 1) )
+ get_knownalive_domain(d);
}
page->count_info = PGC_allocated | 1;
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -2273,10 +2273,8 @@ int assign_pages(
goto out;
}
- if ( unlikely(d->tot_pages == 0) )
+ if ( unlikely(domain_adjust_tot_pages(d, 1 << order) == (1 << order)) )
get_knownalive_domain(d);
-
- domain_adjust_tot_pages(d, 1 << order);
}
for ( i = 0; i < (1 << order); i++ )
--- a/xen/include/xen/mm.h
+++ b/xen/include/xen/mm.h
@@ -190,7 +190,8 @@ int destroy_xen_mappings(unsigned long v
*/
int populate_pt_range(unsigned long virt, unsigned long nr_mfns);
/* Claim handling */
-unsigned long domain_adjust_tot_pages(struct domain *d, long pages);
+unsigned long __must_check domain_adjust_tot_pages(struct domain *d,
+ long pages);
int domain_set_outstanding_pages(struct domain *d, unsigned long pages);
void get_outstanding_claims(uint64_t *free_pages, uint64_t *outstanding_pages);
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2018-12-05 16:17 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-20 16:12 [PATCH 0/4] XSA-276 follow-up Jan Beulich
2018-11-20 16:17 ` [PATCH 1/4] mm: disallow MEMF_no_refcount to be passed for domain-owned allocations Jan Beulich
2018-11-20 16:35 ` Andrew Cooper
2018-11-23 9:45 ` [PATCH v2] " Jan Beulich
2018-11-23 10:28 ` Andrew Cooper
2018-11-23 10:49 ` Jan Beulich
2018-11-23 10:50 ` Andrew Cooper
2018-11-20 16:18 ` [PATCH 2/4] x86: correct instances of PGC_allocated clearing Jan Beulich
2018-11-20 16:59 ` Andrew Cooper
2018-11-20 17:12 ` Jan Beulich
2018-11-21 2:47 ` Tamas K Lengyel
2018-11-20 16:19 ` [PATCH 3/4] x86: reduce code duplication in guest_remove_page() Jan Beulich
2018-11-20 17:06 ` Andrew Cooper
2018-11-21 9:28 ` Jan Beulich
2018-11-20 16:19 ` [PATCH 4/4] make domain_adjust_tot_pages() __must_check Jan Beulich
2018-12-05 16:14 ` [PATCH v2 0/2] remaining XSA-276 follow-up Jan Beulich
2018-12-05 16:17 ` [PATCH v2 1/2] x86: reduce code duplication in guest_remove_page() Jan Beulich
2018-12-05 20:03 ` Andrew Cooper
2018-12-05 16:17 ` Jan Beulich [this message]
2018-12-05 20:08 ` [PATCH v2 2/2] make domain_adjust_tot_pages() __must_check Andrew Cooper
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=5C07FA14020000780020336D@prv1-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=julien.grall@arm.com \
--cc=konrad.wilk@oracle.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 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).