* Re: [PATCH] target/nios2: Use gen_io_start/end around wrctl instruction.
2020-06-18 11:41 [PATCH] target/nios2: Use gen_io_start/end around wrctl instruction wentongw
@ 2020-06-18 4:15 ` no-reply
2020-06-18 17:31 ` Peter Maydell
1 sibling, 0 replies; 4+ messages in thread
From: no-reply @ 2020-06-18 4:15 UTC (permalink / raw)
To: wentong.wu
Cc: marex, peter.maydell, wentong.wu, qemu-trivial, crwulff, qemu-devel
Patchew URL: https://patchew.org/QEMU/20200618114129.5636-1-wentong.wu@intel.com/
Hi,
This series failed the asan build test. Please find the testing commands and
their output below. If you have Docker installed, you can probably reproduce it
locally.
=== TEST SCRIPT BEGIN ===
#!/bin/bash
export ARCH=x86_64
make docker-image-fedora V=1 NETWORK=1
time make docker-test-debug@fedora TARGET_LIST=x86_64-softmmu J=14 NETWORK=1
=== TEST SCRIPT END ===
CC qga/qapi-generated/qga-qapi-visit.o
CC qga/qapi-generated/qga-qapi-commands.o
CC qga/qapi-generated/qga-qapi-init-commands.o
/usr/bin/ld: /usr/lib64/clang/10.0.0/lib/linux/libclang_rt.asan-x86_64.a(asan_interceptors_vfork.S.o): warning: common of `__interception::real_vfork' overridden by definition from /usr/lib64/clang/10.0.0/lib/linux/libclang_rt.asan-x86_64.a(asan_interceptors.cpp.o)
AR libqemuutil.a
LINK elf2dmp
CC qemu-img.o
---
GEN docs/interop/qemu-ga-ref.html
GEN docs/interop/qemu-ga-ref.txt
GEN docs/interop/qemu-ga-ref.7
/usr/bin/ld: /usr/lib64/clang/10.0.0/lib/linux/libclang_rt.asan-x86_64.a(asan_interceptors_vfork.S.o): warning: common of `__interception::real_vfork' overridden by definition from /usr/lib64/clang/10.0.0/lib/linux/libclang_rt.asan-x86_64.a(asan_interceptors.cpp.o)
LINK qemu-keymap
/usr/bin/ld: /usr/lib64/clang/10.0.0/lib/linux/libclang_rt.asan-x86_64.a(asan_interceptors_vfork.S.o): warning: common of `__interception::real_vfork' overridden by definition from /usr/lib64/clang/10.0.0/lib/linux/libclang_rt.asan-x86_64.a(asan_interceptors.cpp.o)
LINK ivshmem-client
LINK ivshmem-server
/usr/bin/ld: /usr/lib64/clang/10.0.0/lib/linux/libclang_rt.asan-x86_64.a(asan_interceptors_vfork.S.o): warning: common of `__interception::real_vfork' overridden by definition from /usr/lib64/clang/10.0.0/lib/linux/libclang_rt.asan-x86_64.a(asan_interceptors.cpp.o)
LINK qemu-nbd
AS pc-bios/optionrom/multiboot.o
AS pc-bios/optionrom/linuxboot.o
CC pc-bios/optionrom/linuxboot_dma.o
/usr/bin/ld: /usr/lib64/clang/10.0.0/lib/linux/libclang_rt.asan-x86_64.a(asan_interceptors_vfork.S.o): warning: common of `__interception::real_vfork' overridden by definition from /usr/lib64/clang/10.0.0/lib/linux/libclang_rt.asan-x86_64.a(asan_interceptors.cpp.o)
LINK qemu-storage-daemon
/usr/bin/ld: /usr/lib64/clang/10.0.0/lib/linux/libclang_rt.asan-x86_64.a(asan_interceptors_vfork.S.o): warning: common of `__interception::real_vfork' overridden by definition from /usr/lib64/clang/10.0.0/lib/linux/libclang_rt.asan-x86_64.a(asan_interceptors.cpp.o)
AS pc-bios/optionrom/kvmvapic.o
AS pc-bios/optionrom/pvh.o
CC pc-bios/optionrom/pvh_main.o
---
BUILD pc-bios/optionrom/multiboot.raw
BUILD pc-bios/optionrom/linuxboot.raw
SIGN pc-bios/optionrom/linuxboot_dma.bin
/usr/bin/ld: /usr/lib64/clang/10.0.0/lib/linux/libclang_rt.asan-x86_64.a(asan_interceptors_vfork.S.o): warning: common of `__interception::real_vfork' overridden by definition from /usr/lib64/clang/10.0.0/lib/linux/libclang_rt.asan-x86_64.a(asan_interceptors.cpp.o)
/usr/bin/ld: /usr/lib64/clang/10.0.0/lib/linux/libclang_rt.asan-x86_64.a(asan_interceptors_vfork.S.o): warning: common of `__interception::real_vfork' overridden by definition from /usr/lib64/clang/10.0.0/lib/linux/libclang_rt.asan-x86_64.a(asan_interceptors.cpp.o)
LINK qemu-edid
SIGN pc-bios/optionrom/multiboot.bin
/usr/bin/ld: /usr/lib64/clang/10.0.0/lib/linux/libclang_rt.asan-x86_64.a(asan_interceptors_vfork.S.o): warning: common of `__interception::real_vfork' overridden by definition from /usr/lib64/clang/10.0.0/lib/linux/libclang_rt.asan-x86_64.a(asan_interceptors.cpp.o)
LINK fsdev/virtfs-proxy-helper
SIGN pc-bios/optionrom/linuxboot.bin
/usr/bin/ld: /usr/lib64/clang/10.0.0/lib/linux/libclang_rt.asan-x86_64.a(asan_interceptors_vfork.S.o): warning: common of `__interception::real_vfork' overridden by definition from /usr/lib64/clang/10.0.0/lib/linux/libclang_rt.asan-x86_64.a(asan_interceptors.cpp.o)
BUILD pc-bios/optionrom/kvmvapic.img
BUILD pc-bios/optionrom/pvh.img
LINK scsi/qemu-pr-helper
/usr/bin/ld: /usr/lib64/clang/10.0.0/lib/linux/libclang_rt.asan-x86_64.a(asan_interceptors_vfork.S.o): warning: common of `__interception::real_vfork' overridden by definition from /usr/lib64/clang/10.0.0/lib/linux/libclang_rt.asan-x86_64.a(asan_interceptors.cpp.o)
BUILD pc-bios/optionrom/kvmvapic.raw
BUILD pc-bios/optionrom/pvh.raw
SIGN pc-bios/optionrom/kvmvapic.bin
SIGN pc-bios/optionrom/pvh.bin
LINK qemu-bridge-helper
/usr/bin/ld: /usr/lib64/clang/10.0.0/lib/linux/libclang_rt.asan-x86_64.a(asan_interceptors_vfork.S.o): warning: common of `__interception::real_vfork' overridden by definition from /usr/lib64/clang/10.0.0/lib/linux/libclang_rt.asan-x86_64.a(asan_interceptors.cpp.o)
LINK virtiofsd
/usr/bin/ld: /usr/lib64/clang/10.0.0/lib/linux/libclang_rt.asan-x86_64.a(asan_interceptors_vfork.S.o): warning: common of `__interception::real_vfork' overridden by definition from /usr/lib64/clang/10.0.0/lib/linux/libclang_rt.asan-x86_64.a(asan_interceptors.cpp.o)
/usr/bin/ld: /usr/lib64/clang/10.0.0/lib/linux/libclang_rt.asan-x86_64.a(asan_interceptors_vfork.S.o): warning: common of `__interception::real_vfork' overridden by definition from /usr/lib64/clang/10.0.0/lib/linux/libclang_rt.asan-x86_64.a(asan_interceptors.cpp.o)
LINK vhost-user-input
LINK qemu-ga
/usr/bin/ld: /usr/lib64/clang/10.0.0/lib/linux/libclang_rt.asan-x86_64.a(asan_interceptors_vfork.S.o): warning: common of `__interception::real_vfork' overridden by definition from /usr/lib64/clang/10.0.0/lib/linux/libclang_rt.asan-x86_64.a(asan_interceptors.cpp.o)
/usr/bin/ld: /usr/lib64/clang/10.0.0/lib/linux/libclang_rt.asan-x86_64.a(asan_interceptors_vfork.S.o): warning: common of `__interception::real_vfork' overridden by definition from /usr/lib64/clang/10.0.0/lib/linux/libclang_rt.asan-x86_64.a(asan_interceptors.cpp.o)
GEN x86_64-softmmu/config-target.h
GEN x86_64-softmmu/hmp-commands.h
GEN x86_64-softmmu/hmp-commands-info.h
---
CC x86_64-softmmu/hw/virtio/virtio-9p-pci.o
CC x86_64-softmmu/hw/virtio/virtio-scsi-pci.o
CC x86_64-softmmu/hw/virtio/virtio-blk-pci.o
/tmp/qemu-test/src/migration/ram.c:919:45: error: implicit conversion from 'unsigned long' to 'double' changes value from 18446744073709551615 to 18446744073709551616 [-Werror,-Wimplicit-int-float-conversion]
xbzrle_counters.encoding_rate = UINT64_MAX;
~ ^~~~~~~~~~
/usr/include/stdint.h:130:23: note: expanded from macro 'UINT64_MAX'
---
18446744073709551615UL
^~~~~~~~~~~~~~~~~~~~~~
1 error generated.
make[1]: *** [/tmp/qemu-test/src/rules.mak:69: migration/ram.o] Error 1
make[1]: *** Waiting for unfinished jobs....
/tmp/qemu-test/src/fpu/softfloat.c:3365:13: error: bitwise negation of a boolean expression; did you mean logical negation? [-Werror,-Wbool-operation]
absZ &= ~ ( ( ( roundBits ^ 0x40 ) == 0 ) & roundNearestEven );
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!
/tmp/qemu-test/src/fpu/softfloat.c:3423:18: error: bitwise negation of a boolean expression; did you mean logical negation? [-Werror,-Wbool-operation]
absZ0 &= ~ ( ( (uint64_t) ( absZ1<<1 ) == 0 ) & roundNearestEven );
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!
/tmp/qemu-test/src/fpu/softfloat.c:3483:18: error: bitwise negation of a boolean expression; did you mean logical negation? [-Werror,-Wbool-operation]
absZ0 &= ~(((uint64_t)(absZ1<<1) == 0) & roundNearestEven);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!
/tmp/qemu-test/src/fpu/softfloat.c:3606:13: error: bitwise negation of a boolean expression; did you mean logical negation? [-Werror,-Wbool-operation]
zSig &= ~ ( ( ( roundBits ^ 0x40 ) == 0 ) & roundNearestEven );
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!
/tmp/qemu-test/src/fpu/softfloat.c:3760:13: error: bitwise negation of a boolean expression; did you mean logical negation? [-Werror,-Wbool-operation]
zSig &= ~ ( ( ( roundBits ^ 0x200 ) == 0 ) & roundNearestEven );
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!
/tmp/qemu-test/src/fpu/softfloat.c:3987:21: error: bitwise negation of a boolean expression; did you mean logical negation? [-Werror,-Wbool-operation]
~ ( ( (uint64_t) ( zSig1<<1 ) == 0 ) & roundNearestEven );
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!
/tmp/qemu-test/src/fpu/softfloat.c:4003:22: error: bitwise negation of a boolean expression; did you mean logical negation? [-Werror,-Wbool-operation]
zSig0 &= ~ ( ( (uint64_t) ( zSig1<<1 ) == 0 ) & roundNearestEven );
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!
/tmp/qemu-test/src/fpu/softfloat.c:4273:18: error: bitwise negation of a boolean expression; did you mean logical negation? [-Werror,-Wbool-operation]
zSig1 &= ~ ( ( zSig2 + zSig2 == 0 ) & roundNearestEven );
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!
8 errors generated.
make[1]: *** [/tmp/qemu-test/src/rules.mak:69: fpu/softfloat.o] Error 1
make: *** [Makefile:527: x86_64-softmmu/all] Error 2
Traceback (most recent call last):
File "./tests/docker/docker.py", line 669, in <module>
sys.exit(main())
---
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['sudo', '-n', 'docker', 'run', '--label', 'com.qemu.instance.uuid=698a75c9f104494b8dd2631b0d649134', '-u', '1003', '--security-opt', 'seccomp=unconfined', '--rm', '-e', 'TARGET_LIST=x86_64-softmmu', '-e', 'EXTRA_CONFIGURE_OPTS=', '-e', 'V=', '-e', 'J=14', '-e', 'DEBUG=', '-e', 'SHOW_ENV=', '-e', 'CCACHE_DIR=/var/tmp/ccache', '-v', '/home/patchew2/.cache/qemu-docker-ccache:/var/tmp/ccache:z', '-v', '/var/tmp/patchew-tester-tmp-poj0l07r/src/docker-src.2020-06-18-00.09.58.15810:/var/tmp/qemu:z,ro', 'qemu:fedora', '/var/tmp/qemu/run', 'test-debug']' returned non-zero exit status 2.
filter=--filter=label=com.qemu.instance.uuid=698a75c9f104494b8dd2631b0d649134
make[1]: *** [docker-run] Error 1
make[1]: Leaving directory `/var/tmp/patchew-tester-tmp-poj0l07r/src'
make: *** [docker-run-test-debug@fedora] Error 2
real 5m31.764s
user 0m8.452s
The full log is available at
http://patchew.org/logs/20200618114129.5636-1-wentong.wu@intel.com/testing.asan/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] target/nios2: Use gen_io_start/end around wrctl instruction.
@ 2020-06-18 11:41 wentongw
2020-06-18 4:15 ` no-reply
2020-06-18 17:31 ` Peter Maydell
0 siblings, 2 replies; 4+ messages in thread
From: wentongw @ 2020-06-18 11:41 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-trivial, marex, crwulff, Wentong Wu, peter.maydell
From: Wentong Wu <wentong.wu@intel.com>
wrctl instruction on nios2 target will cause checking cpu interrupt,
but tcg_handle_interrupt() will call cpu_abort() if the CPU gets an
interrupt while it's not in a 'can do IO' state, so around wrctl
instruction add gen_io_start/end.
Signed-off-by: Wentong Wu <wentong.wu@intel.com>
---
target/nios2/translate.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/target/nios2/translate.c b/target/nios2/translate.c
index e17656e6..deaefcaf 100644
--- a/target/nios2/translate.c
+++ b/target/nios2/translate.c
@@ -32,6 +32,7 @@
#include "exec/cpu_ldst.h"
#include "exec/translator.h"
#include "qemu/qemu-print.h"
+#include "exec/gen-icount.h"
/* is_jmp field values */
#define DISAS_JUMP DISAS_TARGET_0 /* only pc was modified dynamically */
@@ -518,7 +519,13 @@ static void wrctl(DisasContext *dc, uint32_t code, uint32_t flags)
/* If interrupts were enabled using WRCTL, trigger them. */
#if !defined(CONFIG_USER_ONLY)
if ((instr.imm5 + CR_BASE) == CR_STATUS) {
+ if (tb_cflags(dc->tb) & CF_USE_ICOUNT) {
+ gen_io_start();
+ }
gen_helper_check_interrupts(dc->cpu_env);
+ if (tb_cflags(dc->tb) & CF_USE_ICOUNT) {
+ gen_io_end();
+ }
}
#endif
}
--
2.21.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] target/nios2: Use gen_io_start/end around wrctl instruction.
2020-06-18 11:41 [PATCH] target/nios2: Use gen_io_start/end around wrctl instruction wentongw
2020-06-18 4:15 ` no-reply
@ 2020-06-18 17:31 ` Peter Maydell
2020-06-19 12:41 ` Peter Maydell
1 sibling, 1 reply; 4+ messages in thread
From: Peter Maydell @ 2020-06-18 17:31 UTC (permalink / raw)
To: wentongw; +Cc: QEMU Trivial, Marek Vasut, Chris Wulff, QEMU Developers
On Thu, 18 Jun 2020 at 04:50, wentongw <wentong.wu@intel.com> wrote:
>
> From: Wentong Wu <wentong.wu@intel.com>
>
> wrctl instruction on nios2 target will cause checking cpu interrupt,
> but tcg_handle_interrupt() will call cpu_abort() if the CPU gets an
> interrupt while it's not in a 'can do IO' state, so around wrctl
> instruction add gen_io_start/end.
>
> Signed-off-by: Wentong Wu <wentong.wu@intel.com>
> ---
> target/nios2/translate.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/target/nios2/translate.c b/target/nios2/translate.c
> index e17656e6..deaefcaf 100644
> --- a/target/nios2/translate.c
> +++ b/target/nios2/translate.c
> @@ -32,6 +32,7 @@
> #include "exec/cpu_ldst.h"
> #include "exec/translator.h"
> #include "qemu/qemu-print.h"
> +#include "exec/gen-icount.h"
>
> /* is_jmp field values */
> #define DISAS_JUMP DISAS_TARGET_0 /* only pc was modified dynamically */
> @@ -518,7 +519,13 @@ static void wrctl(DisasContext *dc, uint32_t code, uint32_t flags)
> /* If interrupts were enabled using WRCTL, trigger them. */
> #if !defined(CONFIG_USER_ONLY)
> if ((instr.imm5 + CR_BASE) == CR_STATUS) {
> + if (tb_cflags(dc->tb) & CF_USE_ICOUNT) {
> + gen_io_start();
> + }
> gen_helper_check_interrupts(dc->cpu_env);
> + if (tb_cflags(dc->tb) & CF_USE_ICOUNT) {
> + gen_io_end();
> + }
You also need to end the TB, which we should do whether
we're using icount or not. This is awkward because nios2 has
not correctly implemented the DISAS_UPDATE that is the right
way to do that. So you'll need some preliminary patches:
Patch 1: Implement and use DISAS_NORETURN
+ the current places in t_gen_helper_raise_exception() and
gen_exception() that set dc->is_jmp = DISAS_UPDATE
should instead set it to DISAS_NORETURN. (This is because
they both call gen_helper_raise_exception() and at runtime
execution will never return from that helper call.)
+ In gen_intermediate_code(), in the "switch (dc->is_jmp)"
you need a new "case DISAS_NORETURN:" which goes with
DISAS_TB_JUMP as another kind of "nothing more to generate".
Patch 2: Make DISAS_UPDATE write PC back to CPU state
+ Move the "case DISAS_UPDATE:" from being like DISAS_JUMP
up so it does the same thing as DISAS_NEXT (ie explicitly
writes the PC back into the cpu state before doing a
tcg_gen_exit_tb()). This is OK because patch 1 removed
the only two previous users of it, so we don't break
anything by bringing its semantics into line with how
most targets use it.
Patch 3: this patch to use gen_io_start/end
+ You can now put "dc->is_jmp = DISAS_UPDATE;" inside the
"is this a CR_STATUS write" if() block, which should
cause the wrctl to always end the TB.
thanks
-- PMM
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] target/nios2: Use gen_io_start/end around wrctl instruction.
2020-06-18 17:31 ` Peter Maydell
@ 2020-06-19 12:41 ` Peter Maydell
0 siblings, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2020-06-19 12:41 UTC (permalink / raw)
To: wentongw; +Cc: QEMU Trivial, Marek Vasut, Chris Wulff, QEMU Developers
On Thu, 18 Jun 2020 at 18:31, Peter Maydell <peter.maydell@linaro.org> wrote:
>
> On Thu, 18 Jun 2020 at 04:50, wentongw <wentong.wu@intel.com> wrote:
> >
> > From: Wentong Wu <wentong.wu@intel.com>
> >
> > wrctl instruction on nios2 target will cause checking cpu interrupt,
> > but tcg_handle_interrupt() will call cpu_abort() if the CPU gets an
> > interrupt while it's not in a 'can do IO' state, so around wrctl
> > instruction add gen_io_start/end.
> >
> > Signed-off-by: Wentong Wu <wentong.wu@intel.com>
> > ---
> > target/nios2/translate.c | 7 +++++++
> > 1 file changed, 7 insertions(+)
> >
> > diff --git a/target/nios2/translate.c b/target/nios2/translate.c
> > index e17656e6..deaefcaf 100644
> > --- a/target/nios2/translate.c
> > +++ b/target/nios2/translate.c
> > @@ -32,6 +32,7 @@
> > #include "exec/cpu_ldst.h"
> > #include "exec/translator.h"
> > #include "qemu/qemu-print.h"
> > +#include "exec/gen-icount.h"
> >
> > /* is_jmp field values */
> > #define DISAS_JUMP DISAS_TARGET_0 /* only pc was modified dynamically */
> > @@ -518,7 +519,13 @@ static void wrctl(DisasContext *dc, uint32_t code, uint32_t flags)
> > /* If interrupts were enabled using WRCTL, trigger them. */
> > #if !defined(CONFIG_USER_ONLY)
> > if ((instr.imm5 + CR_BASE) == CR_STATUS) {
> > + if (tb_cflags(dc->tb) & CF_USE_ICOUNT) {
> > + gen_io_start();
> > + }
> > gen_helper_check_interrupts(dc->cpu_env);
> > + if (tb_cflags(dc->tb) & CF_USE_ICOUNT) {
> > + gen_io_end();
> > + }
>
> You also need to end the TB, which we should do whether
> we're using icount or not. This is awkward because nios2 has
> not correctly implemented the DISAS_UPDATE that is the right
> way to do that.
After some further discussion with other maintainers abotu
the gen_io_start/gen_io_end semantics, it turns out that
I was wrong about the need for gen_io_end -- if you are
going to end the TB after the I/O instruction (which you are
in this case) then you do not need the gen_io_end() call,
it is handled automatically for you by common code. So
you can drop that bit from the next version of this patch.
Sorry for the confusion.
thanks
-- PMM
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-06-19 12:42 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-18 11:41 [PATCH] target/nios2: Use gen_io_start/end around wrctl instruction wentongw
2020-06-18 4:15 ` no-reply
2020-06-18 17:31 ` Peter Maydell
2020-06-19 12:41 ` Peter Maydell
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).