linux-hyperv.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Boqun Feng <boqun.feng@gmail.com>
To: "Michael Kelley (LINUX)" <mikelley@microsoft.com>
Cc: Wei Liu <wei.liu@kernel.org>, vkuznets <vkuznets@redhat.com>,
	"linux-hyperv@vger.kernel.org" <linux-hyperv@vger.kernel.org>,
	KY Srinivasan <kys@microsoft.com>,
	Haiyang Zhang <haiyangz@microsoft.com>,
	Stephen Hemminger <sthemmin@microsoft.com>,
	Dexuan Cui <decui@microsoft.com>,
	David Hildenbrand <david@redhat.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [RFC v1.1] Drivers: hv: balloon: Disable balloon and hot-add accordingly
Date: Sat, 26 Feb 2022 09:30:50 +0800	[thread overview]
Message-ID: <YhmCys0dqkKCNQA0@boqun-archlinux> (raw)
In-Reply-To: <MN0PR21MB30984A8F1F71588DE6B1F366D73E9@MN0PR21MB3098.namprd21.prod.outlook.com>

On Fri, Feb 25, 2022 at 05:06:45PM +0000, Michael Kelley (LINUX) wrote:
> From: Boqun Feng <boqun.feng@gmail.com> Sent: Thursday, February 24, 2022 6:17 PM
> > 
> > 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.
> 
> The above problem occurs only when the guest page size is > 4 Kbytes.
> 

Ok, I wil call it out in next version.

> > 
> > *	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.
> 
> s/essiential/essential/
> 
> > 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.
> 
> Missing the word "disabling" in the first line?  Also the balloon

The phrasing that I was trying to use here is "Instead of A, B and C are
disabled" or "B and C are disabled instead of A". Looks like I'm
inventing my own English? Any I will add the "disabling" in the next
version ;-)

Regards,
Boqun

> function is disabled only if the page size is > 4 Kbytes.
> 
> > 
> > Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
> > ---
> > v1 --> v1.1:
> > 
> > *	Use HV_HYP_PAGE_SIZE instead of hard coding 4096 as suggested by
> > 	Michael.
> > 
> > *	Explicitly print out the disable message if a function is
> > 	disabled as suggested by Michael.
> > 
> >  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.
> 
> My interpretation of the conversations with Hyper-V is that that they clearly
> don't guarantee page ranges are guest page 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.33.0
> 
> The code looks good to me.
> 
> Michael

      reply	other threads:[~2022-02-26  1:31 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-23 13:15 [RFC 0/2] Drivers: hv: balloon: Temporary fixes for ARM64 Boqun Feng
2022-02-23 13:15 ` [RFC 1/2] Drivers: hv: balloon: Support status report for larger page sizes Boqun Feng
2022-02-23 16:45   ` Michael Kelley (LINUX)
2022-02-23 13:15 ` [RFC 2/2] Drivers: hv: balloon: Disable balloon and hot-add accordingly Boqun Feng
2022-02-23 16:55   ` Michael Kelley (LINUX)
2022-02-24  2:44     ` Boqun Feng
2022-02-24  4:44       ` Michael Kelley (LINUX)
2022-02-25  2:17   ` [RFC v1.1] " Boqun Feng
2022-02-25 17:06     ` Michael Kelley (LINUX)
2022-02-26  1:30       ` Boqun Feng [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YhmCys0dqkKCNQA0@boqun-archlinux \
    --to=boqun.feng@gmail.com \
    --cc=david@redhat.com \
    --cc=decui@microsoft.com \
    --cc=haiyangz@microsoft.com \
    --cc=kys@microsoft.com \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mikelley@microsoft.com \
    --cc=sthemmin@microsoft.com \
    --cc=vkuznets@redhat.com \
    --cc=wei.liu@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).