Re: [PATCH v4 03/10] x86/hyper-v: make hv_do_hypercall() inline

From: Andy Shevchenko
Date: Sat May 27 2017 - 13:46:47 EST


On Wed, May 24, 2017 at 3:03 PM, Vitaly Kuznetsov <vkuznets@xxxxxxxxxx> wrote:
> We have only three call sites for hv_do_hypercall() and we're going to
> change HVCALL_SIGNAL_EVENT to doing fast hypercall so we can inline this
> function for optimization.
>
> Hyper-V top level functional specification states that r9-r11 registers
> and flags may be clobbered by the hypervisor during hypercall and with
> inlining this is somewhat important, add the clobbers.

> + u32 control_hi = control >> 32;
> + u32 control_lo = control & 0xFFFFFFFF;
> + u32 input_address_hi = input_address >> 32;
> + u32 input_address_lo = input_address & 0xFFFFFFFF;
> + u32 output_address_hi = output_address >> 32;
> + u32 output_address_lo = output_address & 0xFFFFFFFF;

Yes, I have noticed it was in older code, but see, all conjunctions
above are redundant.

Besides that, you may consider to use upper_32_bits() / lower_32_bits() macros.

--
With Best Regards,
Andy Shevchenko