[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.21.1803181638190.1509@nanos.tec.linutronix.de>
Date: Sun, 18 Mar 2018 16:42:34 +0100 (CET)
From: Thomas Gleixner <tglx@...utronix.de>
To: Vitaly Kuznetsov <vkuznets@...hat.com>
cc: kvm@...r.kernel.org, x86@...nel.org,
Paolo Bonzini <pbonzini@...hat.com>,
Radim Krčmář <rkrcmar@...hat.com>,
"K. Y. Srinivasan" <kys@...rosoft.com>,
Haiyang Zhang <haiyangz@...rosoft.com>,
Stephen Hemminger <sthemmin@...rosoft.com>,
"Michael Kelley (EOSG)" <Michael.H.Kelley@...rosoft.com>,
Mohammed Gamal <mmorsy@...hat.com>,
Cathy Avery <cavery@...hat.com>, Bandan Das <bsd@...hat.com>,
Christoph Hellwig <hch@...radead.org>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4 4/7] x86/hyper-v: allocate and use Virtual Processor
Assist Pages
On Fri, 16 Mar 2018, Vitaly Kuznetsov wrote:
> static int hv_cpu_init(unsigned int cpu)
> @@ -101,6 +104,23 @@ static int hv_cpu_init(unsigned int cpu)
> if (msr_vp_index > hv_max_vp_index)
> hv_max_vp_index = msr_vp_index;
>
> + if (!hv_vp_assist_page)
> + return 0;
> +
> + if (!hv_vp_assist_page[smp_processor_id()])
> + hv_vp_assist_page[smp_processor_id()] =
> + __vmalloc(PAGE_SIZE, GFP_KERNEL, PAGE_KERNEL);
Please avoid the ugly line break which makes the statement appear as
multiline - which would require curly braces for readability - and simply
have a local variable
struct hv_vp_assist_page **hvp = hv_vp_assist_page[smp_processor_id()];
and use that throughout the function.
> + if (hv_vp_assist_page[smp_processor_id()]) {
> + u64 val;
> +
> + val = vmalloc_to_pfn(hv_vp_assist_page[smp_processor_id()]);
> + val = (val << HV_X64_MSR_VP_ASSIST_PAGE_ADDRESS_SHIFT) |
> + HV_X64_MSR_VP_ASSIST_PAGE_ENABLE;
> +
> + wrmsrl(HV_X64_MSR_VP_ASSIST_PAGE, val);
> + }
> +
> return 0;
Other than that:
Reviewed-by: Thomas Gleixner <tglx@...utronix.de>
Powered by blists - more mailing lists