Message ID | 20180306205001.31698-1-rkrcmar@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 06/03/2018 21:50, Radim Krčmář wrote: > GCC 8 emitted MOVDQU when compiling vmx.elf, but we do not enable > CR4.OSFXSR in that test, so the instruction throws #UD. > This patch forbids all sse2 instructions, instead of enabling > CR4.OSFXSR, as I think it's better to keep the environment minimal. > > Signed-off-by: Radim Krčmář <rkrcmar@redhat.com> > --- > This probably hit a minor KVM bug: the instruction was "f3 0f 6f 41 28", > but KVM reported that #UD happened on "f3 0f 6f 41". That's probably just because "no opcode" does not decode mod/rm/sib. > --- > x86/Makefile.x86_64 | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/x86/Makefile.x86_64 b/x86/Makefile.x86_64 > index 623fc5b37726..6caa3a8863f1 100644 > --- a/x86/Makefile.x86_64 > +++ b/x86/Makefile.x86_64 > @@ -1,7 +1,7 @@ > cstart.o = $(TEST_DIR)/cstart64.o > bits = 64 > ldarch = elf64-x86-64 > -COMMON_CFLAGS += -mno-red-zone > +COMMON_CFLAGS += -mno-red-zone -mno-sse2 Why not -mno-sse? Paolo > cflatobjs += lib/x86/setjmp64.o > cflatobjs += lib/x86/intel-iommu.o
2018-03-07 12:50+0100, Paolo Bonzini: > On 06/03/2018 21:50, Radim Krčmář wrote: > > GCC 8 emitted MOVDQU when compiling vmx.elf, but we do not enable > > CR4.OSFXSR in that test, so the instruction throws #UD. > > This patch forbids all sse2 instructions, instead of enabling > > CR4.OSFXSR, as I think it's better to keep the environment minimal. > > > > Signed-off-by: Radim Krčmář <rkrcmar@redhat.com> > > --- > > This probably hit a minor KVM bug: the instruction was "f3 0f 6f 41 28", > > but KVM reported that #UD happened on "f3 0f 6f 41". > > That's probably just because "no opcode" does not decode mod/rm/sib. Good point, moving the EmulateOnUD check down gets the correct result. I'll send a patch as doing more decoding before dying isn't harmful. > > --- > > x86/Makefile.x86_64 | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/x86/Makefile.x86_64 b/x86/Makefile.x86_64 > > index 623fc5b37726..6caa3a8863f1 100644 > > --- a/x86/Makefile.x86_64 > > +++ b/x86/Makefile.x86_64 > > @@ -1,7 +1,7 @@ > > cstart.o = $(TEST_DIR)/cstart64.o > > bits = 64 > > ldarch = elf64-x86-64 > > -COMMON_CFLAGS += -mno-red-zone > > +COMMON_CFLAGS += -mno-red-zone -mno-sse2 > > Why not -mno-sse? We have asm some code with the "x" constraint and it wouldn't compile without -msse. Should I rewrite that to be explicit? Thanks.
On 07/03/2018 14:37, Radim Krčmář wrote: >>> x86/Makefile.x86_64 | 2 +- >>> 1 file changed, 1 insertion(+), 1 deletion(-) >>> >>> diff --git a/x86/Makefile.x86_64 b/x86/Makefile.x86_64 >>> index 623fc5b37726..6caa3a8863f1 100644 >>> --- a/x86/Makefile.x86_64 >>> +++ b/x86/Makefile.x86_64 >>> @@ -1,7 +1,7 @@ >>> cstart.o = $(TEST_DIR)/cstart64.o >>> bits = 64 >>> ldarch = elf64-x86-64 >>> -COMMON_CFLAGS += -mno-red-zone >>> +COMMON_CFLAGS += -mno-red-zone -mno-sse2 >> >> Why not -mno-sse? > > We have asm some code with the "x" constraint and it wouldn't compile > without -msse. Should I rewrite that to be explicit? You can wrap that code in x86/emulator.c with #pragma GCC push_options #pragma GCC target("sse") ... #pragma GCC pop_options Paolo
diff --git a/x86/Makefile.x86_64 b/x86/Makefile.x86_64 index 623fc5b37726..6caa3a8863f1 100644 --- a/x86/Makefile.x86_64 +++ b/x86/Makefile.x86_64 @@ -1,7 +1,7 @@ cstart.o = $(TEST_DIR)/cstart64.o bits = 64 ldarch = elf64-x86-64 -COMMON_CFLAGS += -mno-red-zone +COMMON_CFLAGS += -mno-red-zone -mno-sse2 cflatobjs += lib/x86/setjmp64.o cflatobjs += lib/x86/intel-iommu.o
GCC 8 emitted MOVDQU when compiling vmx.elf, but we do not enable CR4.OSFXSR in that test, so the instruction throws #UD. This patch forbids all sse2 instructions, instead of enabling CR4.OSFXSR, as I think it's better to keep the environment minimal. Signed-off-by: Radim Krčmář <rkrcmar@redhat.com> --- This probably hit a minor KVM bug: the instruction was "f3 0f 6f 41 28", but KVM reported that #UD happened on "f3 0f 6f 41". --- x86/Makefile.x86_64 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)