RE: [PATCH v3] x86/Hyper-V: Support for free page reporting

From: Michael Kelley
Date: Fri Feb 05 2021 - 17:38:33 EST


From: Michael Kelley <mikelley@xxxxxxxxxxxxx> Sent: Thursday, February 4, 2021 3:36 PM
>
> From: Sunil Muthuswamy <sunilmut@xxxxxxxxxxxxx> Sent: Wednesday, January 6, 2021
> 3:21 PM
> >
> > Linux has support for free page reporting now (36e66c554b5c) for
> > virtualized environment. On Hyper-V when virtually backed VMs are
> > configured, Hyper-V will advertise cold memory discard capability,
> > when supported. This patch adds the support to hook into the free
> > page reporting infrastructure and leverage the Hyper-V cold memory
> > discard hint hypercall to report/free these pages back to the host.
> >
> > Signed-off-by: Sunil Muthuswamy <sunilmut@xxxxxxxxxxxxx>
> > Tested-by: Matheus Castello <matheus@xxxxxxxxxxxxxxx>
> > ---
> > In V2:
> > - Addressed feedback comments
> > - Added page reporting config option tied to hyper-v balloon config
> >
> > In V3:
> > - Addressed feedback from Vitaly
> > ---
> > arch/x86/hyperv/hv_init.c | 31 +++++++++++
> > arch/x86/kernel/cpu/mshyperv.c | 6 +-
> > drivers/hv/Kconfig | 1 +
> > drivers/hv/hv_balloon.c | 93 +++++++++++++++++++++++++++++++
> > include/asm-generic/hyperv-tlfs.h | 32 ++++++++++-
> > include/asm-generic/mshyperv.h | 2 +
> > 6 files changed, 162 insertions(+), 3 deletions(-)
> >

[snip]

> > +
> > + BUILD_BUG_ON(PAGE_REPORTING_CAPACITY > HV_MEMORY_HINT_MAX_GPA_PAGE_RANGES);
> > + dm_device.pr_dev_info.report = hv_free_page_report;
> > + ret = page_reporting_register(&dm_device.pr_dev_info);
> > + if (ret < 0) {
> > + dm_device.pr_dev_info.report = NULL;
> > + pr_err("Failed to enable cold memory discard: %d\n", ret);
> > + } else {
> > + pr_info("Cold memory discard hint enabled\n");
> > + }
>
> Should the above two messages be prefixed with "Hyper-V: "?

Ignore the above comment. The lines will get prefixed with
"hv_balloon:", which is fine.

Michael