[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] x86/Rules: Use -mskip-rax-setup if the compiler supports it



>>> On 08.01.18 at 13:10, <andrew.cooper3@xxxxxxxxxx> wrote:
> On 08/01/18 12:04, Jan Beulich wrote:
>>>>> On 08.01.18 at 11:46, <andrew.cooper3@xxxxxxxxxx> wrote:
>>> This option is available from GCC 5 onwards, and was specifically introduced
>>> as an optimisation for Linux.  When using varadic functions, the caller 
>>> needs
>>> to know how many floating point arguments were passed.  Xen, like Linux,
>>> doesn't uses floating point arguments, so doesn't need to emit code to 
>>> inform
>>> varadic functions such as printk() that there are zero arguments.
>>>
>>> The net delta for a release build is:
>>>
>>>   add/remove: 0/0 grow/shrink: 35/625 up/down: 603/-5489 (-4886)
>>>
>>> with the single biggest change being:
>>>
>>>   x86_emulate                               101933  101751    -182
>> What variadic function(s) are being used there? I can spot a couple
>> of calls to printk() and one call to cpu_has_amd_erratum(), but
>> that can hardly account to 182 saved bytes.
> 
> I wondered the same, until I remembered mkec(), which is behind every
> generate_exception().

But that's an inline function, which the compiler should be able
to avoid setting %eax without further help.

>>> --- a/xen/arch/x86/Rules.mk
>>> +++ b/xen/arch/x86/Rules.mk
>>> @@ -30,3 +30,7 @@ CFLAGS += -fno-asynchronous-unwind-tables
>>>  ifneq ($(call cc-option,$(CC),-fvisibility=hidden,n),n)
>>>  CFLAGS += -DGCC_HAS_VISIBILITY_ATTRIBUTE
>>>  endif
>>> +
>>> +# Xen doesn't ever pass SSE arguments.  Discard the SSE setup
>>> +# (i.e. `xor %eax, %eax`) before varadic function calls if possible.
>>> +$(call cc-option-add,CFLAGS,CC,-mskip-rax-setup)
>> Considering the gcc documentation for the option, I think this wants
>> to sit right next to -mno-sse. Also I think it is "variadic" (and then in
>> the description as well). With that
>> Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
> 
> I'll see what I can do.

Thanks. One more thing though: The description could also do with
some editing - it is not the fact that we never _pass_ any values in
XMM registers, but the fact that as of commit d80c482605 ("x86-64:
globally use -mno-sse") variadic functions have XMM-register-related
prologues generated which makes this change safe. Otherwise the
warning in the documentation would very much apply. Also
s/caller/callee/ in the second line.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.