Received: by 2002:ac2:5a04:0:0:0:0:0 with SMTP id q4csp1084241lfn; Wed, 23 Feb 2022 18:45:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJxD8DgE+kn2enwWmBMg2gjSNPkmLb+gyf2JcjWf2tfYf1qNDPELN6RXF/AZUvxeSOAeqBj5 X-Received: by 2002:a17:903:31c9:b0:14f:3f88:1aeb with SMTP id v9-20020a17090331c900b0014f3f881aebmr664430ple.130.1645670706770; Wed, 23 Feb 2022 18:45:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645670706; cv=none; d=google.com; s=arc-20160816; b=UM2HvOGUwsOY7ITKUYCTLlZ3wuQI3bzU9kZw1EvJHEjYmlH95S0d4ILb+drl6f+3I7 2oGeogjY5A/2ThPMOtkUlPrUz7CKWpEO2qPSxJ4mFvGVtA2l10FWws/tHP8AUxjPyw65 leCOjBpbeaVNeI1QXGkma0U6KSsPQSydAglwNlMu1YHTRUDMyodzhstSgw43vvb2BbBp EoMpTwFBlCfPeFh11I1Z7P/QXbammeDuMebDFkAPyFQ/asBUzk+vwFhaH7gTK0ItyAy+ DdS8I0RtOHcOk6NAt23Dyk0XbJxeK2tAY25Sfg2RUM9B05/eXPfttIWosmfgw5fB3AU/ ntjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=ni7aw7fzEAC4IJ89u6tGZffcuH52CHQfyjKILVom/D8=; b=Ohf8miUj+FU2BhjkgXjoSAHEP4hgRAr+ud9j7eEVVRZnyDnN7D4IXFbFxSgVA5fiaj PL0tyWHatsFeWwx5AmOOzxe/jBLsNyb07rtRWziUCYJG1EhEeQ4pnzwP1+hDs4uG1joE x8Y0VzkIK7TptkO4r2iMLu576e5+Kq9lWvj9W959UyVB4fypzuz6hAb8LlwFJOSwr5X4 YcmfYv97AH+ihqFYenSv1TJ6RsjMsTRaHuZyXyUYJLGxzlBydjUOHT0rJx+e3Cpv5aoY bnGy2ee0QvSubO7mvJ/ezwEqupjJVME5xQSfvj2q6I8mssksDvVq9Dl1ybbBhULZ6DYY tLgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=grdV9eAR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id d17si1500135plh.92.2022.02.23.18.45.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Feb 2022 18:45:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=grdV9eAR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 480E9235876; Wed, 23 Feb 2022 18:45:04 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230126AbiBXCpa (ORCPT + 99 others); Wed, 23 Feb 2022 21:45:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230077AbiBXCp3 (ORCPT ); Wed, 23 Feb 2022 21:45:29 -0500 Received: from mail-il1-x134.google.com (mail-il1-x134.google.com [IPv6:2607:f8b0:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2BBF23585D; Wed, 23 Feb 2022 18:45:00 -0800 (PST) Received: by mail-il1-x134.google.com with SMTP id j5so720647ila.2; Wed, 23 Feb 2022 18:45:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=ni7aw7fzEAC4IJ89u6tGZffcuH52CHQfyjKILVom/D8=; b=grdV9eAR1ENIl71q4henMp7Uizhrnas9AUa3ibHRhbcdHs1Nk2TQR2Hv3+RfENp+6T YTf8ayaXuNOUU0j5r07n+4W1LnX8z71OoefloePhkv5QXHRbQXMPPAeOJZ4XQ7mrxmix s40H/yy4h/cd+BBy1PGyhO1044kltJa8c3G5VaF6P3+SRnVc2m89uTVi6JPGdHbjtH6W PuSLIb80oQtE490viqcR17+CMRQPeMAwt+fhoLRXSyrUhnJjJvEr26v7Qw6FpRnLVmy3 mqDlhDAS1UGj1B8D4Ua5TQaM28PVhJcItJauSet7r2HLt+Ta09twUqXhZrk8KYfgJHCe wV5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=ni7aw7fzEAC4IJ89u6tGZffcuH52CHQfyjKILVom/D8=; b=3wRo+CGRvwyezf0dVB80RaXgZawVp3yg+LrBNBKQepWIWPOwpiD44/zHxk9XhVfyC6 BchTzM6GR47WDtesU8cRtJUpXtTXT2XWGPeamxir6BjzxfWce2jAqdB0KydII0X7USyI NvXuRzZvM9RwVm0omrhCRHzZIun+v7eltHDwNnfijWFPtxu0SI0Iy4nObNEbs/fw5SKw lAmDazTdPVSs6qMJ4Nbz5BkeQS6iqn24SDjYm71wIqnBb+x++JZ60JPJ/bJry8GBYLtM ndn1+wJra0R7d1gYdWsWjY0LGifPoQEv5L7DlJioMGAH4o7Kp3MH7ntyx3IRLs7PJv5s cFnA== X-Gm-Message-State: AOAM532/x1wzL5thEeqkGqjOOy+XfYqvu0EUBSB0f63fVrRhD6WKxoNn cBm+QV+z+tWnRqIlggTjj0h1Rr5N4Nk= X-Received: by 2002:a05:6e02:1947:b0:2c1:7096:8c8a with SMTP id x7-20020a056e02194700b002c170968c8amr520868ilu.309.1645670700063; Wed, 23 Feb 2022 18:45:00 -0800 (PST) Received: from auth2-smtp.messagingengine.com (auth2-smtp.messagingengine.com. [66.111.4.228]) by smtp.gmail.com with ESMTPSA id w19sm1051167iov.16.2022.02.23.18.44.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Feb 2022 18:44:58 -0800 (PST) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailauth.nyi.internal (Postfix) with ESMTP id 8BAAF27C0054; Wed, 23 Feb 2022 21:44:57 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Wed, 23 Feb 2022 21:44:57 -0500 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrledugdehtdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvuffkfhggtggujgesthdtredttddtvdenucfhrhhomhepuehoqhhunhcu hfgvnhhguceosghoqhhunhdrfhgvnhhgsehgmhgrihhlrdgtohhmqeenucggtffrrghtth gvrhhnpedvleeigedugfegveejhfejveeuveeiteejieekvdfgjeefudehfefhgfegvdeg jeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegsoh hquhhnodhmvghsmhhtphgruhhthhhpvghrshhonhgrlhhithihqdeiledvgeehtdeigedq udejjeekheehhedvqdgsohhquhhnrdhfvghngheppehgmhgrihhlrdgtohhmsehfihigmh gvrdhnrghmvg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 23 Feb 2022 21:44:56 -0500 (EST) Date: Thu, 24 Feb 2022 10:44:11 +0800 From: Boqun Feng To: "Michael Kelley (LINUX)" Cc: Wei Liu , vkuznets , "linux-hyperv@vger.kernel.org" , KY Srinivasan , Haiyang Zhang , Stephen Hemminger , Dexuan Cui , David Hildenbrand , "linux-kernel@vger.kernel.org" Subject: Re: [RFC 2/2] Drivers: hv: balloon: Disable balloon and hot-add accordingly Message-ID: References: <20220223131548.2234326-1-boqun.feng@gmail.com> <20220223131548.2234326-3-boqun.feng@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 On Wed, Feb 23, 2022 at 04:55:25PM +0000, Michael Kelley (LINUX) wrote: > From: Boqun Feng Sent: Wednesday, February 23, 2022 5:16 AM > > > > 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. > > > > * 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 essiential to guest monitoring. > > Therefore instead of the entire hv_balloon driver, the balloon 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 | 14 ++++++++++++-- > > 1 file changed, 12 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/hv/hv_balloon.c b/drivers/hv/hv_balloon.c > > index 062156b88a87..35dcda20be85 100644 > > --- a/drivers/hv/hv_balloon.c > > +++ b/drivers/hv/hv_balloon.c > > @@ -1730,9 +1730,19 @@ static int balloon_connect_vsp(struct hv_device *dev) > > * When hibernation (i.e. virtual ACPI S4 state) is enabled, the host > > * 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. > > + * > > + * We disable balloon if the page size is larger than 4k, since > > + * currently it's unclear to us whether an unballoon request can make > > + * sure all page ranges are guest page size aligned. > > + * > > + * We also 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(). > > */ > > - cap_msg.caps.cap_bits.balloon = 1; > > - cap_msg.caps.cap_bits.hot_add = 1; > > + cap_msg.caps.cap_bits.balloon = !(PAGE_SIZE > 4096UL); > > Any reasons not to use HV_HYP_PAGE_SIZE vs. open coding "4096"? So > > cap_msg.caps.cap_bits.balloon = (PAGE_SIZE == HV_HYP_PAGE_SIZE); > You're right. I will change that to it in the next version. > > + cap_msg.caps.cap_bits.hot_add = !IS_ENABLED(CONFIG_ARM64); > > I think we should output a message so that there's no mystery as to > whether ballooning and/or hot_add are disabled, and why. Each setting > should have its own message. Maybe something like: > > if (!cap_msg.caps.cap_bits.balloon) > pr_info("Ballooning disabled because page size is not 4096 bytes\n"); > > if (!cap_msg.cap_bits.hot_add) > pr_info("Memory hot add disabled on ARM64\n"); > I agree with your suggestion, however, while I'm at it, I think it's better that we have functions that check and print, and .balloon and .hot_add can rely on the return value, for example: static int balloon_enabled(void) { if (PAGE_SIZE != HV_HYP_PAGE_SIZE) { pr_info("Ballooning disabled because page size is not 4096 bytes\n"); return 0; } return 1; } // in balloon_vsp_connect() cap_msg.caps.cap_bits.balloon = balloon_enabled(); In this way, we keep the checking and reason printing in the same function and it's easier to maintain the consistency. Thoughts? Regards, Boqun > > > > /* > > * Specify our alignment requirements as it relates > > -- > > 2.35.1 >