lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Yw+yWFFpU+mwT97H@boqun-archlinux>
Date:   Wed, 31 Aug 2022 12:11:20 -0700
From:   Boqun Feng <boqun.feng@...il.com>
To:     stable@...r.kernel.org,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Sasha Levin <sashal@...nel.org>
Cc:     Vitaly Kuznetsov <vkuznets@...hat.com>,
        linux-hyperv@...r.kernel.org,
        "K. Y. Srinivasan" <kys@...rosoft.com>,
        Haiyang Zhang <haiyangz@...rosoft.com>,
        Stephen Hemminger <sthemmin@...rosoft.com>,
        Dexuan Cui <decui@...rosoft.com>,
        Michael Kelley <mikelley@...rosoft.com>,
        David Hildenbrand <david@...hat.com>,
        linux-kernel@...r.kernel.org, Wei Liu <wei.liu@...nel.org>
Subject: Re: [PATCH v2 1/2] Drivers: hv: balloon: Support status report for
 larger page sizes

Hi,

I think we also want this patch in the 5.15 stable. Without this patch,
hv_balloon() will report incorrect memory usage to hypervisor when
running on ARM64 with PAGE_SIZE > 4k. Only 5.15 needs this because ARM64
support of HyperV guests arrived in 5.15.

Upstream id b3d6dd09ff00fdcf4f7c0cb54700ffd5dd343502

Cc: <stable@...r.kernel.org> # 5.15.x

Thanks!

Regards,
Boqun

On Fri, Mar 25, 2022 at 10:32:11AM +0800, Boqun Feng wrote:
> DM_STATUS_REPORT expects the numbers of pages in the unit of 4k pages
> (HV_HYP_PAGE) instead of guest pages, so to make it work when guest page
> sizes are larger than 4k, convert the numbers of guest pages into the
> numbers of HV_HYP_PAGEs.
> 
> Note that the numbers of guest pages are still used for tracing because
> tracing is internal to the guest kernel.
> 
> Reported-by: Vitaly Kuznetsov <vkuznets@...hat.com>
> Signed-off-by: Boqun Feng <boqun.feng@...il.com>
> Reviewed-by: Michael Kelley <mikelley@...rosoft.com>
> ---
>  drivers/hv/hv_balloon.c | 13 ++++++++++---
>  1 file changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/hv/hv_balloon.c b/drivers/hv/hv_balloon.c
> index f2d05bff4245..062156b88a87 100644
> --- a/drivers/hv/hv_balloon.c
> +++ b/drivers/hv/hv_balloon.c
> @@ -17,6 +17,7 @@
>  #include <linux/slab.h>
>  #include <linux/kthread.h>
>  #include <linux/completion.h>
> +#include <linux/count_zeros.h>
>  #include <linux/memory_hotplug.h>
>  #include <linux/memory.h>
>  #include <linux/notifier.h>
> @@ -1130,6 +1131,7 @@ static void post_status(struct hv_dynmem_device *dm)
>  	struct dm_status status;
>  	unsigned long now = jiffies;
>  	unsigned long last_post = last_post_time;
> +	unsigned long num_pages_avail, num_pages_committed;
>  
>  	if (pressure_report_delay > 0) {
>  		--pressure_report_delay;
> @@ -1154,16 +1156,21 @@ static void post_status(struct hv_dynmem_device *dm)
>  	 * num_pages_onlined) as committed to the host, otherwise it can try
>  	 * asking us to balloon them out.
>  	 */
> -	status.num_avail = si_mem_available();
> -	status.num_committed = vm_memory_committed() +
> +	num_pages_avail = si_mem_available();
> +	num_pages_committed = vm_memory_committed() +
>  		dm->num_pages_ballooned +
>  		(dm->num_pages_added > dm->num_pages_onlined ?
>  		 dm->num_pages_added - dm->num_pages_onlined : 0) +
>  		compute_balloon_floor();
>  
> -	trace_balloon_status(status.num_avail, status.num_committed,
> +	trace_balloon_status(num_pages_avail, num_pages_committed,
>  			     vm_memory_committed(), dm->num_pages_ballooned,
>  			     dm->num_pages_added, dm->num_pages_onlined);
> +
> +	/* Convert numbers of pages into numbers of HV_HYP_PAGEs. */
> +	status.num_avail = num_pages_avail * NR_HV_HYP_PAGES_IN_PAGE;
> +	status.num_committed = num_pages_committed * NR_HV_HYP_PAGES_IN_PAGE;
> +
>  	/*
>  	 * If our transaction ID is no longer current, just don't
>  	 * send the status. This can happen if we were interrupted
> -- 
> 2.35.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ