Patch "Drivers: hv: balloon: Disable balloon and hot-add accordingly" has been added to the 5.17-stable tree

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

 



This is a note to let you know that I've just added the patch titled

    Drivers: hv: balloon: Disable balloon and hot-add accordingly

to the 5.17-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     drivers-hv-balloon-disable-balloon-and-hot-add-accor.patch
and it can be found in the queue-5.17 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 39dbc5d040ac7115b8da9ad3b5ad7c36c8707d03
Author: Boqun Feng <boqun.feng@xxxxxxxxx>
Date:   Fri Mar 25 10:32:12 2022 +0800

    Drivers: hv: balloon: Disable balloon and hot-add accordingly
    
    [ Upstream commit be5802795cf8d0b881745fa9ba7790293b382280 ]
    
    Currently there are known potential issues for balloon and hot-add on
    ARM64:
    
    *       Unballoon requests from Hyper-V should only unballoon ranges
            that are guest page size aligned, otherwise guests cannot handle
            because it's impossible to partially free a page. This is a
            problem when guest page size > 4096 bytes.
    
    *       Memory hot-add requests from Hyper-V should provide the NUMA
            node id of the added ranges or ARM64 should have a functional
            memory_add_physaddr_to_nid(), otherwise the node id is missing
            for add_memory().
    
    These issues require discussions on design and implementation. In the
    meanwhile, post_status() is working and essential to guest monitoring.
    Therefore instead of disabling the entire hv_balloon driver, the
    ballooning (when page size > 4096 bytes) and hot-add are disabled
    accordingly for now. Once the issues are fixed, they can be re-enable in
    these cases.
    
    Signed-off-by: Boqun Feng <boqun.feng@xxxxxxxxx>
    Reviewed-by: Michael Kelley <mikelley@xxxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20220325023212.1570049-3-boqun.feng@xxxxxxxxx
    Signed-off-by: Wei Liu <wei.liu@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/hv/hv_balloon.c b/drivers/hv/hv_balloon.c
index 439f99b8b5de..3cf334c46c31 100644
--- a/drivers/hv/hv_balloon.c
+++ b/drivers/hv/hv_balloon.c
@@ -1653,6 +1653,38 @@ static void disable_page_reporting(void)
 	}
 }
 
+static int ballooning_enabled(void)
+{
+	/*
+	 * Disable ballooning if the page size is not 4k (HV_HYP_PAGE_SIZE),
+	 * since currently it's unclear to us whether an unballoon request can
+	 * make sure all page ranges are guest page size aligned.
+	 */
+	if (PAGE_SIZE != HV_HYP_PAGE_SIZE) {
+		pr_info("Ballooning disabled because page size is not 4096 bytes\n");
+		return 0;
+	}
+
+	return 1;
+}
+
+static int hot_add_enabled(void)
+{
+	/*
+	 * Disable hot add on ARM64, because we currently rely on
+	 * memory_add_physaddr_to_nid() to get a node id of a hot add range,
+	 * however ARM64's memory_add_physaddr_to_nid() always return 0 and
+	 * DM_MEM_HOT_ADD_REQUEST doesn't have the NUMA node information for
+	 * add_memory().
+	 */
+	if (IS_ENABLED(CONFIG_ARM64)) {
+		pr_info("Memory hot add disabled on ARM64\n");
+		return 0;
+	}
+
+	return 1;
+}
+
 static int balloon_connect_vsp(struct hv_device *dev)
 {
 	struct dm_version_request version_req;
@@ -1724,8 +1756,8 @@ static int balloon_connect_vsp(struct hv_device *dev)
 	 * currently still requires the bits to be set, so we have to add code
 	 * to fail the host's hot-add and balloon up/down requests, if any.
 	 */
-	cap_msg.caps.cap_bits.balloon = 1;
-	cap_msg.caps.cap_bits.hot_add = 1;
+	cap_msg.caps.cap_bits.balloon = ballooning_enabled();
+	cap_msg.caps.cap_bits.hot_add = hot_add_enabled();
 
 	/*
 	 * Specify our alignment requirements as it relates



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux