Re: [PATCH 2/5] x86_64: inline copy_page() at call site

From: Alexey Dobriyan
Date: Tue May 02 2017 - 07:49:09 EST


On Sat, Apr 29, 2017 at 12:04 AM, Borislav Petkov <bp@xxxxxxxxx> wrote:
> On Wed, Apr 26, 2017 at 09:28:06PM +0300, Alexey Dobriyan wrote:

>> +static __always_inline void copy_page(void *to, void *from)
>> +{
>> + alternative_call_2(
>
> Please align at the opening brace, like clear_page() above it:

Then I'd have to split clobber list and no lines will be saved.

> alternative_call_2(copy_page_mov,
> copy_page_rep_movsq, X86_FEATURE_REP_GOOD,
> ...
>
>
>> + copy_page_rep_movsb, X86_FEATURE_ERMS,
>> + ASM_OUTPUT2("=D" (to), "=S" (from)),
>> + "0" (to), "1" (from)
>> + : "rax", "rcx", "rdx", "r8", "r9", "r10", "r11", "cc", "memory"
>> + );
>> +}
>> #endif /* !__ASSEMBLY__ */
>>
>> #ifdef CONFIG_X86_VSYSCALL_EMULATION
>
> ...
>
>> ENTRY(copy_page_rep_movsb)
>> mov $4096, %ecx
>> rep movsb
>> ret
>> ENDPROC(copy_page_rep_movsb)
>> +EXPORT_SYMBOL(copy_page_rep_movsb)
>>
>> -ENTRY(copy_page_regs)
>> +ENTRY(copy_page_mov)
>
> copy_page_regs() is a better name IMO. copy_page_mov() doesn't tell me
> anything - all three use "mov". copy_page_unrolled() sounds ok too.

It says unambiguously which instruction does the actual copying.