[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/3][4.17?] x86/pv-shim: correct ballooning up for compat guests


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Fri, 28 Oct 2022 09:22:28 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=z+zkDWf3de9+bRGdDawZnuvAUtR92dpvUXja9wCTUW8=; b=Sv74S8fykyVhVcgrsoWjdX3KKe1qoEs8wwyGGZPURZVlRBeTlgjKymayqL1Ii7zNdYdOYm5Ck7Wyy02bzm7XC0v/D0kN+7y2u8uthHeytlX9eej/D/WQLlUSaiJi/UQIrTIporFS9R+GVYbhDXTrnWUIlFYZW3YQ/ch5+wU6sZjaeTstQ7y0fvvs5vPsJ5+tWYhvBdQYVpHiHmTJxF/qa8SsGtOQHKPo2ectnqn6RWZOkOYGYVYV89VHsX62qSA6MNCcxlWEhk6REvMK3cHej9R60vABkF2SpUe1A3NN18vzQuuQGQh/11k6goDbVP63eysAvbp/GSXtHpykHIVIwQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gSAw//2uDBvNDvCJ4BvfD2gDBZuxtf8ZJuYTaPp/ic7C6qCZgNlZQmcxTaKCuEvQ/1qNOnTKWarTVJ5z25G+zrhhE7TIyiL4iPrk1m66ERRhwPrHqiI5lKW0XyuknNVg4UrbUMytxUn+XWcE1Y1qX96MqK3knqSZFL3yP/2xW5MyjZ1B7qnhR+aaszO1EOGDu+qKHliq3eM/kgv1xzNqeG0jdEOWE3+dojI22tmb91vrRzh7v+5/3vzeB5/hV4awsbHFWuaz10ovgrCwXuNNkTH2WT4Moo5Me6OuAVOLHBrlvH3DNsxG+F1pkf6fFLyexlvWLXrDxLROWUc5k2Ck0w==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Roger Pau Monné <roger.pau@xxxxxxxxxx>, Henry Wang <Henry.Wang@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Fri, 28 Oct 2022 07:22:34 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

From: Igor Druzhinin <igor.druzhinin@xxxxxxxxxx>

The compat layer for multi-extent memory ops may need to split incoming
requests. Since the guest handles in the interface structures may not be
altered, it does so by leveraging do_memory_op()'s continuation
handling: It hands on non-initial requests with a non-zero start extent,
with the (native) handle suitably adjusted down. As a result
do_memory_op() sees only the first of potentially several requests with
start extent being zero. It's only that case when the function would
issue a call to pv_shim_online_memory(), yet the range then covers only
the first sub-range that results from the split.

Address that breakage by making a complementary call to
pv_shim_online_memory() in compat layer.

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

--- a/xen/common/compat/memory.c
+++ b/xen/common/compat/memory.c
@@ -7,6 +7,7 @@ EMIT_FILE;
 #include <xen/event.h>
 #include <xen/mem_access.h>
 #include <asm/current.h>
+#include <asm/guest.h>
 #include <compat/memory.h>
 
 #define xen_domid_t domid_t
@@ -146,7 +147,10 @@ int compat_memory_op(unsigned int cmd, X
                 nat.rsrv->nr_extents = end_extent;
                 ++split;
             }
-
+           /* Avoid calling pv_shim_online_memory() when in a continuation. */
+           if ( pv_shim && op != XENMEM_decrease_reservation && !start_extent )
+               pv_shim_online_memory(cmp.rsrv.nr_extents - 
nat.rsrv->nr_extents,
+                                     cmp.rsrv.extent_order);
             break;
 
         case XENMEM_exchange:




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.