mbox series

[PULL,00/21] tcg patch queue

Message ID 20181016174911.9052-1-richard.henderson@linaro.org
Headers show
Series tcg patch queue | expand

Message

Richard Henderson Oct. 16, 2018, 5:48 p.m. UTC
The following changes since commit ff56877e911782dedc9a424233fd3f62369c258c:

  Merge remote-tracking branch 'remotes/kraxel/tags/vga-20181015-pull-request' into staging (2018-10-15 15:03:45 +0100)

are available in the Git repository at:

  https://github.com/rth7680/qemu.git tags/pull-tcg-20181016

for you to fetch changes up to e3e9d1ea20c75718ce7c528c588a0a497f12f750:

  cputlb: read CPUTLBEntry.addr_write atomically (2018-10-16 10:04:27 -0700)

----------------------------------------------------------------
Queued tcg patches

----------------------------------------------------------------
Emilio G. Cota (10):
      tcg: access cpu->icount_decr.u16.high with atomics
      tcg: fix use of uninitialized variable under CONFIG_PROFILER
      tcg: plug holes in struct TCGProfile
      tcg: distribute tcg_time into TCG contexts
      target/alpha: remove tlb_flush from alpha_cpu_initfn
      target/unicore32: remove tlb_flush from uc32_init_fn
      exec: introduce tlb_init
      cputlb: fix assert_cpu_is_self macro
      cputlb: serialize tlb updates with env->tlb_lock
      cputlb: read CPUTLBEntry.addr_write atomically

Richard Henderson (11):
      tcg: Implement CPU_LOG_TB_NOCHAIN during expansion
      tcg: Add tlb_index and tlb_entry helpers
      tcg: Split CONFIG_ATOMIC128
      target/i386: Convert to HAVE_CMPXCHG128
      target/arm: Convert to HAVE_CMPXCHG128
      target/arm: Check HAVE_CMPXCHG128 at translate time
      target/ppc: Convert to HAVE_CMPXCHG128 and HAVE_ATOMIC128
      target/s390x: Convert to HAVE_CMPXCHG128 and HAVE_ATOMIC128
      target/s390x: Split do_cdsg, do_lpq, do_stpq
      target/s390x: Skip wout, cout helpers if op helper does not return
      target/s390x: Check HAVE_ATOMIC128 and HAVE_CMPXCHG128 at translate

 accel/tcg/atomic_template.h      |  20 +++-
 accel/tcg/softmmu_template.h     |  64 +++++-----
 include/exec/cpu-defs.h          |   3 +
 include/exec/cpu_ldst.h          |  30 ++++-
 include/exec/cpu_ldst_template.h |  25 ++--
 include/exec/exec-all.h          |   8 ++
 include/qemu/atomic128.h         | 155 ++++++++++++++++++++++++
 include/qemu/timer.h             |   1 -
 target/ppc/helper.h              |   2 +-
 tcg/tcg.h                        |  20 ++--
 accel/tcg/cpu-exec.c             |   2 +-
 accel/tcg/cputlb.c               | 235 +++++++++++++++++++-----------------
 accel/tcg/tcg-all.c              |   2 +-
 accel/tcg/translate-all.c        |   2 +-
 accel/tcg/user-exec.c            |   5 +-
 cpus.c                           |   3 +-
 exec.c                           |   1 +
 monitor.c                        |  13 +-
 qom/cpu.c                        |   2 +-
 target/alpha/cpu.c               |   1 -
 target/arm/helper-a64.c          | 251 +++++++++++++++++++--------------------
 target/arm/translate-a64.c       |  38 +++---
 target/i386/mem_helper.c         |   9 +-
 target/ppc/mem_helper.c          |  33 ++++-
 target/ppc/translate.c           | 115 +++++++++---------
 target/s390x/mem_helper.c        | 202 +++++++++++++++----------------
 target/s390x/translate.c         |  45 +++++--
 target/unicore32/cpu.c           |   2 -
 tcg/tcg-op.c                     |   9 +-
 tcg/tcg.c                        |  25 +++-
 configure                        |  19 +++
 31 files changed, 830 insertions(+), 512 deletions(-)
 create mode 100644 include/qemu/atomic128.h

Comments

Peter Maydell Oct. 18, 2018, 10:34 a.m. UTC | #1
On 16 October 2018 at 18:48, Richard Henderson
<richard.henderson@linaro.org> wrote:
> The following changes since commit ff56877e911782dedc9a424233fd3f62369c258c:

>

>   Merge remote-tracking branch 'remotes/kraxel/tags/vga-20181015-pull-request' into staging (2018-10-15 15:03:45 +0100)

>

> are available in the Git repository at:

>

>   https://github.com/rth7680/qemu.git tags/pull-tcg-20181016

>

> for you to fetch changes up to e3e9d1ea20c75718ce7c528c588a0a497f12f750:

>

>   cputlb: read CPUTLBEntry.addr_write atomically (2018-10-16 10:04:27 -0700)

>

> ----------------------------------------------------------------

> Queued tcg patches

>


Hi; I get compile failures, I'm afraid:

FreeBSD's compiler gives warnings:
In file included from /var/tmp/qemu-test.bVaUEj/accel/tcg/user-exec.c:28:
/var/tmp/qemu-test.bVaUEj/include/qemu/atomic128.h:148:23: warning:
unknown attribute 'error' ignored [-Wunknown-attributes]
Int128 __attribute__((error("unsupported atomic")))
                      ^
/var/tmp/qemu-test.bVaUEj/include/qemu/atomic128.h:150:21: warning:
unknown attribute 'error' ignored [-Wunknown-attributes]
void __attribute__((error("unsupported atomic")))
                    ^

x86-64 Linux clang fails with the same issue:
In file included from
/home/petmay01/linaro/qemu-for-merges/accel/tcg/user-exec.c:28:
/home/petmay01/linaro/qemu-for-merges/include/qemu/atomic128.h:148:23:
error: unknown attribute 'error' ignored
[-Werror,-Wunknown-attributes]
Int128 __attribute__((error("unsupported atomic")))
                      ^
/home/petmay01/linaro/qemu-for-merges/include/qemu/atomic128.h:150:21:
error: unknown attribute 'error' ignored
[-Werror,-Wunknown-attributes]
void __attribute__((error("unsupported atomic")))
                    ^


The win32 build fails with:

target/arm/helper-a64.o: In function `helper_paired_cmpxchg64_le_parallel':
/home/petmay01/qemu-for-merges/target/arm/helper-a64.c:573: undefined
reference to `helper_atomic_cmpxchgo_le_mmu'
target/arm/helper-a64.o: In function `helper_paired_cmpxchg64_be_parallel':
/home/petmay01/qemu-for-merges/target/arm/helper-a64.c:647: undefined
reference to `helper_atomic_cmpxchgo_be_mmu'
target/arm/helper-a64.o: In function `helper_casp_le_parallel':
/home/petmay01/qemu-for-merges/target/arm/helper-a64.c:669: undefined
reference to `helper_atomic_cmpxchgo_le_mmu'
target/arm/helper-a64.o: In function `helper_casp_be_parallel':
/home/petmay01/qemu-for-merges/target/arm/helper-a64.c:690: undefined
reference to `helper_atomic_cmpxchgo_be_mmu'


thanks
-- PMM
Richard Henderson Oct. 19, 2018, 6:10 a.m. UTC | #2
On 10/18/18 3:34 AM, Peter Maydell wrote:
> Hi; I get compile failures, I'm afraid:

> 

> FreeBSD's compiler gives warnings:

> In file included from /var/tmp/qemu-test.bVaUEj/accel/tcg/user-exec.c:28:

> /var/tmp/qemu-test.bVaUEj/include/qemu/atomic128.h:148:23: warning:

> unknown attribute 'error' ignored [-Wunknown-attributes]

> Int128 __attribute__((error("unsupported atomic")))

>                       ^

> /var/tmp/qemu-test.bVaUEj/include/qemu/atomic128.h:150:21: warning:

> unknown attribute 'error' ignored [-Wunknown-attributes]

> void __attribute__((error("unsupported atomic")))

>                     ^

> 

> x86-64 Linux clang fails with the same issue:

> In file included from

> /home/petmay01/linaro/qemu-for-merges/accel/tcg/user-exec.c:28:

> /home/petmay01/linaro/qemu-for-merges/include/qemu/atomic128.h:148:23:

> error: unknown attribute 'error' ignored

> [-Werror,-Wunknown-attributes]

> Int128 __attribute__((error("unsupported atomic")))

>                       ^

> /home/petmay01/linaro/qemu-for-merges/include/qemu/atomic128.h:150:21:

> error: unknown attribute 'error' ignored

> [-Werror,-Wunknown-attributes]

> void __attribute__((error("unsupported atomic")))


I used __has_attribute for this one.  Tested with clang 7.


> The win32 build fails with:

> 

> target/arm/helper-a64.o: In function `helper_paired_cmpxchg64_le_parallel':

> /home/petmay01/qemu-for-merges/target/arm/helper-a64.c:573: undefined

> reference to `helper_atomic_cmpxchgo_le_mmu'

> target/arm/helper-a64.o: In function `helper_paired_cmpxchg64_be_parallel':

> /home/petmay01/qemu-for-merges/target/arm/helper-a64.c:647: undefined

> reference to `helper_atomic_cmpxchgo_be_mmu'

> target/arm/helper-a64.o: In function `helper_casp_le_parallel':

> /home/petmay01/qemu-for-merges/target/arm/helper-a64.c:669: undefined

> reference to `helper_atomic_cmpxchgo_le_mmu'

> target/arm/helper-a64.o: In function `helper_casp_be_parallel':

> /home/petmay01/qemu-for-merges/target/arm/helper-a64.c:690: undefined

> reference to `helper_atomic_cmpxchgo_be_mmu'


This one I could not reproduce.  Tested with i686-w64-mingw32-gcc
and x86_64-w64-mingw32-gcc, both version 6.2.

I suspect configure misfired.  If you can, start this one over with a blank
build directory.

I've sent you a v2 pull.


r~
Peter Maydell Oct. 21, 2018, 3:01 p.m. UTC | #3
On 19 October 2018 at 07:10, Richard Henderson
<richard.henderson@linaro.org> wrote:
> On 10/18/18 3:34 AM, Peter Maydell wrote:

>> The win32 build fails with:

>>

>> target/arm/helper-a64.o: In function `helper_paired_cmpxchg64_le_parallel':

>> /home/petmay01/qemu-for-merges/target/arm/helper-a64.c:573: undefined

>> reference to `helper_atomic_cmpxchgo_le_mmu'

>> target/arm/helper-a64.o: In function `helper_paired_cmpxchg64_be_parallel':

>> /home/petmay01/qemu-for-merges/target/arm/helper-a64.c:647: undefined

>> reference to `helper_atomic_cmpxchgo_be_mmu'

>> target/arm/helper-a64.o: In function `helper_casp_le_parallel':

>> /home/petmay01/qemu-for-merges/target/arm/helper-a64.c:669: undefined

>> reference to `helper_atomic_cmpxchgo_le_mmu'

>> target/arm/helper-a64.o: In function `helper_casp_be_parallel':

>> /home/petmay01/qemu-for-merges/target/arm/helper-a64.c:690: undefined

>> reference to `helper_atomic_cmpxchgo_be_mmu'

>

> This one I could not reproduce.  Tested with i686-w64-mingw32-gcc

> and x86_64-w64-mingw32-gcc, both version 6.2.

>

> I suspect configure misfired.  If you can, start this one over with a blank

> build directory.


Something odd is going on here. My merge test when I merged your v2
passed (unless I managed to miss a failure message first time around
which isn't impossible). But on a subsequent test for a later merge,
I get the same error:

  LINK    aarch64-softmmu/qemu-system-aarch64w.exe
target/arm/helper-a64.o: In function `helper_paired_cmpxchg64_le_parallel':
/home/petmay01/qemu-for-merges/target/arm/helper-a64.c:573: undefined
reference to `helper_atomic_cmpxchgo_le_mmu'
target/arm/helper-a64.o: In function `helper_paired_cmpxchg64_be_parallel':
/home/petmay01/qemu-for-merges/target/arm/helper-a64.c:647: undefined
reference to `helper_atomic_cmpxchgo_be_mmu'
target/arm/helper-a64.o: In function `helper_casp_le_parallel':
/home/petmay01/qemu-for-merges/target/arm/helper-a64.c:669: undefined
reference to `helper_atomic_cmpxchgo_le_mmu'
target/arm/helper-a64.o: In function `helper_casp_be_parallel':
/home/petmay01/qemu-for-merges/target/arm/helper-a64.c:690: undefined
reference to `helper_atomic_cmpxchgo_be_mmu'
collect2: error: ld returned 1 exit status

I did a complete "blow away build/w32 entirely and
reconfigure" and the failure is still there.
config-host.mak defines neither CONFIG_ATOMIC128 nor CONFIG_CMPXCHG128,
which is what I'd expect for a w32 build. (The w64 build does
define CONFIG_ATOMIC128, and does build.)

Any idea what's going on here? tcg/tcg.h has a comment saying
 * The cmpxchg functions are only defined if HAVE_CMPXCHG128
so presumably the issue is that the helper-a64 code is
trying to refer to them anyway. There certainly doesn't
seem to be any kind of #defining around the listed functions
in helper-a64.c to stop them being compiled in this situation.

NB: I build with --enable-debug in this tree -- are you
perhaps accidentally relying on the compiler's optimisation
to discard these functions if they're not needed?

thanks
-- PMM
Peter Maydell Oct. 21, 2018, 3:21 p.m. UTC | #4
On 21 October 2018 at 16:01, Peter Maydell <peter.maydell@linaro.org> wrote:
> Any idea what's going on here? tcg/tcg.h has a comment saying

>  * The cmpxchg functions are only defined if HAVE_CMPXCHG128

> so presumably the issue is that the helper-a64 code is

> trying to refer to them anyway. There certainly doesn't

> seem to be any kind of #defining around the listed functions

> in helper-a64.c to stop them being compiled in this situation.

>

> NB: I build with --enable-debug in this tree -- are you

> perhaps accidentally relying on the compiler's optimisation

> to discard these functions if they're not needed?


Adding a #if HAVE_CMPXCHG128 around the helper-a64.c
functions just pushes the link error back a step to the
references to those helpers:
  LINK    aarch64-softmmu/qemu-system-aarch64w.exe
tcg/tcg.o:tcg.c:(.rdata+0x9810): undefined reference to
`helper_paired_cmpxchg64_le_parallel'
tcg/tcg.o:tcg.c:(.rdata+0x9830): undefined reference to
`helper_paired_cmpxchg64_be_parallel'
tcg/tcg.o:tcg.c:(.rdata+0x9840): undefined reference to
`helper_casp_le_parallel'
tcg/tcg.o:tcg.c:(.rdata+0x9850): undefined reference to
`helper_casp_be_parallel'

which in turn I guess is because they're in the array
of all helpers in tcg.c, so we need to also #if out the
prototypes in helper-a64.h, which is awkward because
there we don't have the HAVE_CMPXCHG128 defined...

thanks
-- PMM
Richard Henderson Oct. 22, 2018, 5:47 p.m. UTC | #5
On 10/21/18 4:21 PM, Peter Maydell wrote:
> On 21 October 2018 at 16:01, Peter Maydell <peter.maydell@linaro.org> wrote:

>> Any idea what's going on here? tcg/tcg.h has a comment saying

>>  * The cmpxchg functions are only defined if HAVE_CMPXCHG128

>> so presumably the issue is that the helper-a64 code is

>> trying to refer to them anyway. There certainly doesn't

>> seem to be any kind of #defining around the listed functions

>> in helper-a64.c to stop them being compiled in this situation.

>>

>> NB: I build with --enable-debug in this tree -- are you

>> perhaps accidentally relying on the compiler's optimisation

>> to discard these functions if they're not needed?

> 

> Adding a #if HAVE_CMPXCHG128 around the helper-a64.c

> functions just pushes the link error back a step to the

> references to those helpers:

>   LINK    aarch64-softmmu/qemu-system-aarch64w.exe

> tcg/tcg.o:tcg.c:(.rdata+0x9810): undefined reference to

> `helper_paired_cmpxchg64_le_parallel'

> tcg/tcg.o:tcg.c:(.rdata+0x9830): undefined reference to

> `helper_paired_cmpxchg64_be_parallel'

> tcg/tcg.o:tcg.c:(.rdata+0x9840): undefined reference to

> `helper_casp_le_parallel'

> tcg/tcg.o:tcg.c:(.rdata+0x9850): undefined reference to

> `helper_casp_be_parallel'

> 

> which in turn I guess is because they're in the array

> of all helpers in tcg.c, so we need to also #if out the

> prototypes in helper-a64.h, which is awkward because

> there we don't have the HAVE_CMPXCHG128 defined...


I spoke with Peter in person today about this.  For the list, I've reproduced
the problem, and I'm calling it a mingw bug.  A patch against qemu/osdep.h to
fix this once and for all shortly.


r~