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

Re: [Xen-devel] [PATCH 5/5] x86emul: disable FPU/MMX/SIMD insn emulation when !HVM



On 20.12.2019 17:01, Andrew Cooper wrote:
> On 20/12/2019 13:41, Jan Beulich wrote:
>> In a pure PV environment (the PV shim in particular) we don't really
>> need emulation of all these. To limit #ifdef-ary utilize some of the
>> CASE_*() macros we have, by providing variants expanding to
>> (effectively) nothing (really a label, which in turn requires passing
>> -Wno-unused-label to the compiler when build such configurations).
>>
>> Due to the mixture of macro and #ifdef use, the placement of some of
>> the #ifdef-s is a little arbitrary.
>>
>> The resulting object file's .text is less than half the size of the
>> original, and looks to also be compiling a little more quickly.
>>
>> This is meant as a first step; more parts can likely be disabled down
>> the road.
> 
> Presumably we can drop everything but the onebyte and twobyte tables,
> and VEX/EVEX prefix parsing logic?

Depends on what we expect VEX-encoded GPR insns to be used on.
I wouldn't want to forbid their use on MMIO, for example. I did
actually take a few initial steps to hide the EVEX parsing
behind an #ifdef, but something then made me undo this at least
for now (I don't recall what exactly it was).

>> --- a/xen/arch/x86/Makefile
>> +++ b/xen/arch/x86/Makefile
>> @@ -79,6 +79,9 @@ obj-y += hpet.o
>>  obj-y += vm_event.o
>>  obj-y += xstate.o
>>  
>> +ifneq ($(CONFIG_HVM),y)
>> +x86_emulate.o: CFLAGS += -Wno-unused-label
>> +endif
>>  x86_emulate.o: x86_emulate/x86_emulate.c x86_emulate/x86_emulate.h
>>  
>>  efi-y := $(shell if [ ! -r $(BASEDIR)/include/xen/compile.h -o \
>> --- a/xen/arch/x86/x86_emulate.c
>> +++ b/xen/arch/x86/x86_emulate.c
>> @@ -42,6 +42,12 @@
>>      }                                                      \
>>  })
>>  
>> +#ifndef CONFIG_HVM
>> +# define X86EMUL_NO_FPU
>> +# define X86EMUL_NO_MMX
>> +# define X86EMUL_NO_SIMD
>> +#endif
> 
> ... isn't this going to cause problems for the emulator/fuzzer builds?

No, this file doesn't get used by them. That's why I placed these
here, rather than e.g. in x86_emulate/x86_emulate.h or in
x86_emulate/x86_emulate.c itself.

> On that subject, it would be very helpful to at least be able to
> configure reduced builds from these utilities.

Yes, I too have been thinking this way. I may get there eventually.

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®.