lkml.org 
[lkml]   [2018]   [Mar]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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@linutronix.de>

\
 
 \ /
  Last update: 2018-03-18 16:43    [W:0.061 / U:1.100 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site