From: Jan Beulich Date: Thu, 6 Dec 2018 11:19:04 +0000 (+0100) Subject: make domain_adjust_tot_pages() __must_check X-Git-Tag: archive/raspbian/4.14.0+80-gd101b417b7-1+rpi1^2~63^2~2794 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=c46dba0d72e519743823c76c676858ad1af48b90;p=xen.git make domain_adjust_tot_pages() __must_check 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 Acked-by: Andrew Cooper --- diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c index 28a003063e..b3350eee35 100644 --- 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; diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c index fd3b0aaa83..b314b5cee8 100644 --- 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++ ) diff --git a/xen/include/xen/mm.h b/xen/include/xen/mm.h index 054d02e6c0..e971147234 100644 --- a/xen/include/xen/mm.h +++ b/xen/include/xen/mm.h @@ -190,7 +190,8 @@ int destroy_xen_mappings(unsigned long v, unsigned long e); */ 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);