xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
	"Wei Liu" <wl@xen.org>, "Roger Pau Monné" <roger.pau@citrix.com>
Subject: Re: [Xen-devel] [PATCH 5/5] x86emul: disable FPU/MMX/SIMD insn emulation when !HVM
Date: Fri, 20 Dec 2019 17:20:15 +0100	[thread overview]
Message-ID: <97c93132-8037-3e41-52ca-1afc2444f0b4@suse.com> (raw)
In-Reply-To: <dbc03c9d-bfc2-3313-1ffe-8ffe79b2c1e1@citrix.com>

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@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2019-12-20 16:20 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-20 13:37 [Xen-devel] [PATCH 0/5] x86emul: allow suppressing FPU/MMX/SIMD insn emulation Jan Beulich
2019-12-20 13:39 ` [Xen-devel] [PATCH 1/5] x86emul: use CASE_SIMD_PACKED_INT() where possible Jan Beulich
2019-12-20 15:35   ` Andrew Cooper
2019-12-20 13:39 ` [Xen-devel] [PATCH 2/5] x86emul: introduce CASE_SIMD_PACKED_INT_VEX() Jan Beulich
2019-12-20 15:42   ` Andrew Cooper
2019-12-20 13:40 ` [Xen-devel] [PATCH 3/5] x86emul: drop CASE_SIMD_DOUBLE_FP() Jan Beulich
2019-12-20 15:48   ` Andrew Cooper
2019-12-20 13:40 ` [Xen-devel] [PATCH 4/5] x86emul: introduce CASE_SIMD_..._FP_VEX() Jan Beulich
2019-12-20 15:49   ` Andrew Cooper
2019-12-20 13:41 ` [Xen-devel] [PATCH 5/5] x86emul: disable FPU/MMX/SIMD insn emulation when !HVM Jan Beulich
2019-12-20 16:01   ` Andrew Cooper
2019-12-20 16:20     ` Jan Beulich [this message]
2020-04-02 22:18     ` Andrew Cooper
2020-04-03  7:52       ` Jan Beulich
2020-03-24 12:10   ` [Xen-devel] Ping: " Jan Beulich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=97c93132-8037-3e41-52ca-1afc2444f0b4@suse.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=roger.pau@citrix.com \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).