From: Paolo Bonzini <pbonzini@redhat.com>
To: "Peter Maydell" <peter.maydell@linaro.org>,
"Philippe Mathieu-Daudé" <f4bug@amsat.org>
Cc: QEMU Developers <qemu-devel@nongnu.org>,
Richard Henderson <rth@twiddle.net>
Subject: Re: [Qemu-devel] [PATCH] tcg/ppc: disable atomic write check on ppc32
Date: Tue, 12 Sep 2017 23:04:15 +0200 [thread overview]
Message-ID: <4eddca72-c75e-0cbc-e07d-280c1cd0f095@redhat.com> (raw)
In-Reply-To: <CAFEAcA_61iw+u7aMp+vA-CNpmAPjvJ_ynUfHu8Y+p8jmgvbcdw@mail.gmail.com>
On 11/09/2017 23:37, Peter Maydell wrote:
> On 11 September 2017 at 21:49, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>> this fixes building for ppc64 on ppc32 (changed in 5964fca8a12c):
>>
>> qemu/tcg/ppc/tcg-target.inc.c: In function 'tb_target_set_jmp_target':
>> qemu/include/qemu/compiler.h:86:30: error: static assertion failed: "not expecting: sizeof(*(uint64_t *)jmp_addr) > ATOMIC_REG_SIZE"
>> QEMU_BUILD_BUG_ON(sizeof(*ptr) > ATOMIC_REG_SIZE); \
>> ^
>> qemu/tcg/ppc/tcg-target.inc.c:1377:9: note: in expansion of macro 'atomic_set'
>> atomic_set((uint64_t *)jmp_addr, pair);
>> ^
>>
>> Suggested-by: Richard Henderson <rth@twiddle.net>
>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>> ---
>> This fixes Shippable builds, see:
>> https://app.shippable.com/github/qemu/qemu/runs/434/10/console
>>
>> tcg/ppc/tcg-target.inc.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/tcg/ppc/tcg-target.inc.c b/tcg/ppc/tcg-target.inc.c
>> index 21d764c102..0417901289 100644
>> --- a/tcg/ppc/tcg-target.inc.c
>> +++ b/tcg/ppc/tcg-target.inc.c
>> @@ -1374,7 +1374,7 @@ void tb_target_set_jmp_target(uintptr_t tc_ptr, uintptr_t jmp_addr,
>> pair = (uint64_t)i2 << 32 | i1;
>> #endif
>>
>> - atomic_set((uint64_t *)jmp_addr, pair);
>> + atomic_set__nocheck((uint64_t *)jmp_addr, pair);
>> flush_icache_range(jmp_addr, jmp_addr + 8);
>> } else {
>> intptr_t diff = addr - jmp_addr;
>
> Can you explain why this is the right thing? On the
> face of it it looks correct to insist that we don't
> try to do an atomic set of something that's bigger
> than the host can actually handle...
Probably because this code is guarded by "if (TCG_TARGET_REG_BITS ==
64)", so actually it only ever runs with 64-bit targets.
I wonder if QEMU_BUILD_BUG_ON (at least in atomics) should not use a
static assertion, but rather the 'error ("MESSAGE")' attribute instead.
This way, if the code is dead it does not cause a build failure.
Paolo
next prev parent reply other threads:[~2017-09-12 21:04 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-11 20:49 [Qemu-devel] [PATCH] tcg/ppc: disable atomic write check on ppc32 Philippe Mathieu-Daudé
2017-09-11 21:37 ` Peter Maydell
2017-09-12 4:23 ` Richard Henderson
2017-09-12 9:08 ` Peter Maydell
2017-09-12 21:04 ` Paolo Bonzini [this message]
2017-09-13 16:45 ` Richard Henderson
2017-09-12 4:17 ` Richard Henderson
2017-09-12 17:01 ` Richard Henderson
2017-09-12 21:00 ` Philippe Mathieu-Daudé
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=4eddca72-c75e-0cbc-e07d-280c1cd0f095@redhat.com \
--to=pbonzini@redhat.com \
--cc=f4bug@amsat.org \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
/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).