[PATCH 1/3][4.17?] x86/pv-shim: correctly ignore empty onlining requests

Jan Beulich posted 3 patches 3 years, 3 months ago
[PATCH 1/3][4.17?] x86/pv-shim: correctly ignore empty onlining requests
Posted by Jan Beulich 3 years, 3 months ago
From: Igor Druzhinin <igor.druzhinin@citrix.com>

Mem-op requests may have zero extents. Such requests need treating as
no-ops. pv_shim_online_memory(), however, would have tried to take 2³²-1
order-sized pages from its balloon list (to then populate them),
typically ending when the entire set of ballooned pages of this order
was consumed.

Note that pv_shim_offline_memory() does not have such an issue.

Fixes: b2245acc60c3 ("xen/pvshim: memory hotplug")
Signed-off-by: Igor Druzhinin <igor.druzhinin@citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/arch/x86/pv/shim.c
+++ b/xen/arch/x86/pv/shim.c
@@ -944,6 +944,9 @@ void pv_shim_online_memory(unsigned int
     struct page_info *page, *tmp;
     PAGE_LIST_HEAD(list);
 
+    if ( !nr )
+        return;
+
     spin_lock(&balloon_lock);
     page_list_for_each_safe ( page, tmp, &balloon )
     {