Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1887096pxb; Fri, 25 Mar 2022 07:23:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz9uGcxe10QfOnYVH4qePRVV4xwu1/bFjOdVAji9zgG/nNSWO/aJVFMkXouJ6oqgkGV2UBl X-Received: by 2002:a17:902:7d93:b0:14d:d401:f59b with SMTP id a19-20020a1709027d9300b0014dd401f59bmr12214765plm.14.1648218230556; Fri, 25 Mar 2022 07:23:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648218230; cv=none; d=google.com; s=arc-20160816; b=AHx0pG3YQK5xZ9bErUXcm9er1uIN//lpcrc88vYJyPKBvqbRsVe//1BR52rcB83sGG L/hrQF8hmhL2k5dLKpm8QSnhLrbiwPhLO2Z0MtMeB50v+ukwobmNNKT7euTT1/bFymgm hMiWXvPO2E53Brf8AW9ptP+gzWEEhJLjztj/hpZEuarfy6JQ66Lcs/MNKtQTnrhhnHgx nENsKKO0E5U5DqfSngy2TSE6iEGzyvFOZbFD1Kd48S3XruuDvohol4bLCe9cYP/bbCmm 6Dy/nEg3SqjCRQxcMTrvSkG/iuF4l4VEywq2YDq2iW5etT7krCfQunZ+vJL2mV4Dnyc4 0YZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=IXFrpdSrsWxPJJKP0L3fMCW4KHzAGEDahZ4BTeY25yA=; b=fu03H8ds3SLaBKjfCi9X0lq7OjvWHzRBhTXqH56pDUNGobZR1TlXtjvnFWnX5QjOUp qqbOGbHABeU7yPUEf/arYcc3lp1JrLleY0PQfJWGMoME3PxVcOLvP2pGAzIuVTTDOqhF o8nGDUXe4924VQteEBpFE3bVg4t8DvYdl8TxBLwwaleVzoMAOV/fov2BXkAzQEKwLxuy j1xdkOOugRNildHfnvekQdKmw/ui2PC/KwM9fJDsxNIJtg2DLlj53rY+Jy1ElkG6O6CE pTi9NDCb9KwH22GhBkWx50AjxxQf8fgKoMp93qNJFfCi5XspGoj0dxLhfktrtmBACwKV fU/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="Q9pj/sZr"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b2-20020a170902b60200b00153b9c989ebsi2391209pls.502.2022.03.25.07.23.36; Fri, 25 Mar 2022 07:23:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="Q9pj/sZr"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357785AbiCYCep (ORCPT + 99 others); Thu, 24 Mar 2022 22:34:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357774AbiCYCem (ORCPT ); Thu, 24 Mar 2022 22:34:42 -0400 Received: from mail-qk1-x72e.google.com (mail-qk1-x72e.google.com [IPv6:2607:f8b0:4864:20::72e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E46AE1A; Thu, 24 Mar 2022 19:33:08 -0700 (PDT) Received: by mail-qk1-x72e.google.com with SMTP id d65so1563785qke.5; Thu, 24 Mar 2022 19:33:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=IXFrpdSrsWxPJJKP0L3fMCW4KHzAGEDahZ4BTeY25yA=; b=Q9pj/sZr5QY+q11G2WBBcCqSkmfQvsi70r24pAGLdOMDRpZ6IWjI8npDn67bPSf1wE oSy39cN+T/NitKrQRrw44b8NQdE41dDRLno4F3fLQGe9rbwo+rg0FBuXXYlqpLEnzuo7 aCYIF5U22rsDXy0sCTfhj6rr5TTi9CPNWlcy1/Tgkf1BWBtv5Rf3tdUKfMOxwYsBb29N HzewAy8WR+4b7HHI7R4SlmFkGT60EoUcC51YNJvNqkmo5VerJ4GhxExM3BAc36yYtebU yOlru3me8lMHMHFm+XvAzYo+se5C7NV2P/aA+/mCoPE7xO8vE+RBJSJGZO3eyPrBLTq9 eLng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=IXFrpdSrsWxPJJKP0L3fMCW4KHzAGEDahZ4BTeY25yA=; b=DSaj9Ibg4ggRXk9LturNVMNKQtfXKwM+T8z76Yva9xf0gyu1y2xP38Sylef2HwmXB6 4kyIBzjLch8Kbipb0v9xhUautJymbtSDCAR4BYA/tGQS+MNDPjWYBhK6rWoj7MGG2L++ bvOf0n/TlZfpDycw6SJYvzW1btJOfJL++PWV8flHyjapXfNgI/qOvvt5vhHyQgdXbhX9 +sBkGWrDP41VkfPxLNuPW5hitnciyhyWy7XMAD1iFDfcot0fs2AuOvKO75h4z6kGIAiq 0xnxsAzKX1lu82CXnr//VdieJHkQzd7oX962MnQnC3Fe4qUIMYawE80ccM2r0bL/ZO1+ r64Q== X-Gm-Message-State: AOAM532obIhCLV27TV8eO5JE/1FxwNqM1dif3i663r7H23alT2C/iIjs nVNX6VsogNq4wz9tRdK+/BI= X-Received: by 2002:a05:620a:4142:b0:67b:3150:219e with SMTP id k2-20020a05620a414200b0067b3150219emr5543922qko.189.1648175587692; Thu, 24 Mar 2022 19:33:07 -0700 (PDT) Received: from auth1-smtp.messagingengine.com (auth1-smtp.messagingengine.com. [66.111.4.227]) by smtp.gmail.com with ESMTPSA id j188-20020a3755c5000000b0067d1c76a09fsm2588391qkb.74.2022.03.24.19.33.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Mar 2022 19:33:06 -0700 (PDT) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailauth.nyi.internal (Postfix) with ESMTP id C55CC27C0054; Thu, 24 Mar 2022 22:33:05 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 24 Mar 2022 22:33:05 -0400 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrudehtddggeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeeuohhquhhn ucfhvghnghcuoegsohhquhhnrdhfvghnghesghhmrghilhdrtghomheqnecuggftrfgrth htvghrnhephedvveetfefgiedutedtfeevvddvleekjeeuffffleeguefhhfejteekieeu ueelnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepsg hoqhhunhdomhgvshhmthhprghuthhhphgvrhhsohhnrghlihhthidqieelvdeghedtieeg qddujeejkeehheehvddqsghoqhhunhdrfhgvnhhgpeepghhmrghilhdrtghomhesfhhigi hmvgdrnhgrmhgv X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 24 Mar 2022 22:33:05 -0400 (EDT) From: Boqun Feng To: Wei Liu Cc: Vitaly Kuznetsov , linux-hyperv@vger.kernel.org, "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Dexuan Cui , Michael Kelley , David Hildenbrand , linux-kernel@vger.kernel.org, Boqun Feng Subject: [PATCH v2 2/2] Drivers: hv: balloon: Disable balloon and hot-add accordingly Date: Fri, 25 Mar 2022 10:32:12 +0800 Message-Id: <20220325023212.1570049-3-boqun.feng@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220325023212.1570049-1-boqun.feng@gmail.com> References: <20220325023212.1570049-1-boqun.feng@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/hv/hv_balloon.c | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/drivers/hv/hv_balloon.c b/drivers/hv/hv_balloon.c index 062156b88a87..eee7402cfc02 100644 --- a/drivers/hv/hv_balloon.c +++ b/drivers/hv/hv_balloon.c @@ -1660,6 +1660,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; @@ -1731,8 +1763,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 -- 2.35.1