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] [day] [month] [year] [list]
Message-ID: <SN4PR2101MB088078C9B0C7A6F41E7FC919C0D09@SN4PR2101MB0880.namprd21.prod.outlook.com>
Date:   Wed, 6 Jan 2021 23:04:01 +0000
From:   Sunil Muthuswamy <sunilmut@...rosoft.com>
To:     vkuznets <vkuznets@...hat.com>
CC:     "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Matheus Castello <matheus@...tello.eng.br>,
        KY Srinivasan <kys@...rosoft.com>,
        "linux-hyperv@...r.kernel.org" <linux-hyperv@...r.kernel.org>,
        Haiyang Zhang <haiyangz@...rosoft.com>,
        Stephen Hemminger <sthemmin@...rosoft.com>,
        Wei Liu <liuwe@...rosoft.com>,
        Michael Kelley <mikelley@...rosoft.com>,
        Tianyu Lan <Tianyu.Lan@...rosoft.com>,
        Wei Liu <wei.liu@...nel.org>
Subject: RE: [EXTERNAL] Re: [PATCH v2] x86/Hyper-V: Support for free page
 reporting

> > +// Bit mask of the extended capability to query: see HV_EXT_CAPABILITY_xxx
> 
> Please don't use '//' comments in Linux (here and below)
Will fix in v3.

> > +	/*
> > +	 * Repurpose the input page arg to accept output from Hyper-V for
> > +	 * now because this is the only call that needs output from the
> > +	 * hypervisor. It should be fixed properly by introducing an
> > +	 * output arg once we have more places that require output.
> > +	 */
> 
> I remember there was a patch from Wei (realter to running Linux as root
> partition) doing the job, we can probably merge it early to avoid this
> re-purposing.
I would prefer getting this in right now and we can update this once Wei's
patches gets merged.

> > -	pr_info("Hyper-V: features 0x%x, hints 0x%x, misc 0x%x\n",
> > -		ms_hyperv.features, ms_hyperv.hints, ms_hyperv.misc_features);
> > +	pr_info("Hyper-V: features 0x%x, privilege flags high: 0x%x, hints 0x%x, misc 0x%x\n",
> > +		ms_hyperv.features, ms_hyperv.priv_high, ms_hyperv.hints,
> > +		ms_hyperv.misc_features);
> 
> Even if we would like to avoid the curn and keep 'ms_hyperv.features',
> we could've reported this as
> 
> "privilege flags low:%0x%x high:0x%x" to avoid the misleading 'features'.
> 
Sure, will change it in v3.

> > +	WARN_ON(nents > HV_MEMORY_HINT_MAX_GPA_PAGE_RANGES);
> 
> WARN_ON_ONCE() maybe?
Sure, coming in v3.

> > +	for (i = 0, sg = sgl; sg; sg = sg_next(sg), i++) {
> 
> This looks like an open-coded for_each_sg() version.
Thanks, will change in v3.

> > +	BUILD_BUG_ON(pageblock_order < HV_MIN_PAGE_REPORTING_ORDER);
> > +	if (!hv_query_ext_cap(HV_EXT_CAPABILITY_MEMORY_COLD_DISCARD_HINT)) {
> > +		pr_info("Cold memory discard hint not supported by Hyper-V\n");
> > +		return;
> > +	}
> 
> Which Hyper-V versions/Azure instance types don't support it? In case
> there's something fairly modern on the list, I'd suggest to drop this
> pr_info (or convert it to pr_debug) to not mislead users into thinking
> there's something wrong. In case they don't see 'Cold memory discard
> hint enabled' they know it is unsupported.
> 
This is not available in Hypervisor spec 5.0 and was added in 6.0. I don't see any problems
with making it 'pr_debug'

> > +#define HV_EXT_MEMORY_HEAT_HINT_TYPE_COLD_DISCARD	2
> > +struct hv_memory_hint {
> > +	u64 type:2;
> > +	u64 reserved:62;
> > +	union hv_gpa_page_range ranges[];
> > +};
> 
> Other similar structures use '__packed' but I remember there was some
> disagreement if this is needed or not when everything is properly padded
> (or doesn't require padding like in this case).
> 
There are other places where we don't use '__packed' where everything is
properly aligned. But, I will add it as I don't see a problem with it.

- Sunil

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ