qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] tests/tcg/x86_64: add cross-modifying code test


From: Ilya Leoshkevich
Subject: Re: [PATCH] tests/tcg/x86_64: add cross-modifying code test
Date: Mon, 05 Sep 2022 17:44:27 +0200
User-agent: Evolution 3.42.4 (3.42.4-2.fc35)

On Sat, 2022-09-03 at 10:13 +0100, Alex Bennée wrote:
> 
> Ilya Leoshkevich <iii@linux.ibm.com> writes:
> 
> > commit f025692c992c ("accel/tcg: Clear PAGE_WRITE before
> > translation")
> > fixed cross-modifying code handling, but did not add a test. The
> > changed code was further improved recently [1], and I was not sure
> > whether these modifications were safe (spoiler: they were fine).
> > 
> > Add a test to make sure there are no regressions.
> > 
> > [1]
> > https://lists.gnu.org/archive/html/qemu-devel/2022-09/msg00034.html
> > 
> > Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
> > ---
> >  tests/tcg/x86_64/Makefile.target        |  6 +-
> >  tests/tcg/x86_64/cross-modifying-code.c | 80
> > +++++++++++++++++++++++++
> >  2 files changed, 85 insertions(+), 1 deletion(-)
> >  create mode 100644 tests/tcg/x86_64/cross-modifying-code.c
> > 
> > diff --git a/tests/tcg/x86_64/Makefile.target
> > b/tests/tcg/x86_64/Makefile.target
> > index b71a6bcd5e..58e7bfd681 100644
> > --- a/tests/tcg/x86_64/Makefile.target
> > +++ b/tests/tcg/x86_64/Makefile.target
> > @@ -10,6 +10,7 @@ include
> > $(SRC_PATH)/tests/tcg/i386/Makefile.target
> >  
> >  ifeq ($(filter %-linux-user, $(TARGET)),$(TARGET))
> >  X86_64_TESTS += vsyscall
> > +X86_64_TESTS += cross-modifying-code
> >  TESTS=$(MULTIARCH_TESTS) $(X86_64_TESTS) test-x86_64
> >  else
> >  TESTS=$(MULTIARCH_TESTS)
> > @@ -20,5 +21,8 @@ test-x86_64: LDFLAGS+=-lm -lc
> >  test-x86_64: test-i386.c test-i386.h test-i386-shift.h test-i386-
> > muldiv.h
> >         $(CC) $(CFLAGS) $< -o $@ $(LDFLAGS)
> >  
> > -vsyscall: $(SRC_PATH)/tests/tcg/x86_64/vsyscall.c
> > +%: $(SRC_PATH)/tests/tcg/x86_64/%.c
> >         $(CC) $(CFLAGS) $< -o $@ $(LDFLAGS)
> 
> You shouldn't need to redefine the default rule when you can tweak
> the flags

Without this rule, I get:

make[1]: *** No rule to make target 'vsyscall', needed by 'all'.  Stop.

I think this is because the default rule has %.c as a dependency, and
we run from a different directory here.

> > +
> > +smc: CFLAGS+=-pthread
> > +smc: LDFLAGS+=-pthread
> 
> I think this must be from an old iteration because:
> 
> make[1]: Entering directory
> '/home/alex/lsrc/qemu.git/builds/all/tests/tcg/x86_64-linux-user'
> cc -Wall -Werror -O0 -g -fno-strict-aliasing
> /home/alex/lsrc/qemu.git/tests/tcg/x86_64/cross-modifying-code.c -o
> cross-modifying-code -static
> /usr/bin/ld: /tmp/ccK05RAk.o: in function `main':
> /home/alex/lsrc/qemu.git/tests/tcg/x86_64/cross-modifying-code.c:64:
> undefined reference to `pthread_create'
> /usr/bin/ld: /home/alex/lsrc/qemu.git/tests/tcg/x86_64/cross-
> modifying-code.c:73: undefined reference to `pthread_join'
> collect2: error: ld returned 1 exit status
> make[1]: ***
> [/home/alex/lsrc/qemu.git/tests/tcg/x86_64/Makefile.target:25: cross-
> modifying-code] Error 1
> make[1]: Leaving directory
> '/home/alex/lsrc/qemu.git/builds/all/tests/tcg/x86_64-linux-user'
> make: *** [/home/alex/lsrc/qemu.git/tests/Makefile.include:52: build-
> tcg-tests-x86_64-linux-user] Error 2

Sorry about that, I should have tested a clean build.
I will send a v2.

Best regards,
Ilya



reply via email to

[Prev in Thread] Current Thread [Next in Thread]