From: "Alex Bennée" <alex.bennee@linaro.org>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: "Richard Henderson" <rth@twiddle.net>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"QEMU Developers" <qemu-devel@nongnu.org>,
"MTTCG Devel" <mttcg@listserver.greensocs.com>,
"KONRAD Frédéric" <fred.konrad@greensocs.com>,
"Alvise Rigo" <a.rigo@virtualopensystems.com>,
"Emilio G. Cota" <cota@braap.org>,
"Pranith Kumar" <bobby.prani@gmail.com>,
"Nikunj A Dadhania" <nikunj@linux.vnet.ibm.com>,
"Peter Crosthwaite" <crosthwaite.peter@gmail.com>
Subject: Re: [Qemu-devel] [PATCH v2 04/11] translate: downgrade IRQ BQL asserts to tcg_debug_assert
Date: Fri, 03 Mar 2017 11:05:39 +0000 [thread overview]
Message-ID: <87pohy1uyk.fsf@linaro.org> (raw)
In-Reply-To: <CAFEAcA_REYx=z1x9K_P1UK4j-fNyZ3717UrHDCLVySPanb28KQ@mail.gmail.com>
Peter Maydell <peter.maydell@linaro.org> writes:
> On 2 March 2017 at 19:53, Alex Bennée <alex.bennee@linaro.org> wrote:
>> While on MTTCG hosts it is very important that updates to
>> cpu->interrupt_request are protected by the BQL not all guests have
>> been converted to the correct locking yet. As a result we are seeing
>> breaking on non-MTTCG enabled guests in production builds.
>>
>> The locking in the guests needs to be fixed but while running single
>> threaded they will continue to work. By moving the asserts to
>> tcg_debug_asserts() they will still be useful during conversion
>> work (much like the existing assert_memory_lock/assert_tb_lock
>> asserts).
>>
>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>> ---
>> translate-all.c | 2 +-
>> translate-common.c | 3 ++-
>> 2 files changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/translate-all.c b/translate-all.c
>> index 9bac061c9b..7ee273410d 100644
>> --- a/translate-all.c
>> +++ b/translate-all.c
>> @@ -1928,7 +1928,7 @@ void dump_opcount_info(FILE *f, fprintf_function cpu_fprintf)
>>
>> void cpu_interrupt(CPUState *cpu, int mask)
>> {
>> - g_assert(qemu_mutex_iothread_locked());
>> + tcg_debug_assert(qemu_mutex_iothread_locked());
>
> If CONFIG_DEBUG_TCG isn't enabled then tcg_debug_assert()
> turns into "if (!(X)) { __builtin_unreachable(); }", which
> means that instead of asserting we now run straight
> into compiler undefined behaviour, don't we?
According to the commit that added it
(c552d6c038f7cf4058d1fd5987118ffd41e0e050) it is meant to be a hint to
the compiler. Reading the GCC notes however seems to contradict that.
FWIW I did test it in both builds and we do used tese for a bunch of
other asserts and they haven't blown up.
> If what we want is "don't actually check this condition in
> the non-tcg-debug config" then we should do something
> that means we don't actually check the condition...
Hmm:
28 intptr_t qemu_real_host_page_mask;
29
30 #ifndef CONFIG_USER_ONLY
31 /* mask must never be zero, except for A20 change call */
32 static void tcg_handle_interrupt(CPUState *cpu, int mask)
33 {
34 int old_mask;
35 tcg_debug_assert(qemu_mutex_iothread_locked());
36
37 old_mask = cpu->interrupt_request;
Line 34 of "/home/alex/lsrc/qemu/qemu.git/translate-common.c" is at address 0x24db0a <tcg_handle_interrupt+10> but contains no code.
Line 35 of "/home/alex/lsrc/qemu/qemu.git/translate-common.c" starts at address 0x24db0a <tcg_handle_interrupt+10> and ends at 0x24db0f <tcg_handle_interrupt+15>.
Line 36 of "/home/alex/lsrc/qemu/qemu.git/translate-common.c" is at address 0x24db0f <tcg_handle_interrupt+15> but contains no code.
Line 37 of "/home/alex/lsrc/qemu/qemu.git/translate-common.c" starts at address 0x24db0f <tcg_handle_interrupt+15> and ends at 0x24db15 <tcg_handle_interrupt+21>.
0x24db0a <tcg_handle_interrupt+10>: callq 0x27a570 <qemu_mutex_iothread_locked>
0x24db0f <tcg_handle_interrupt+15>: mov 0xa8(%rbx),%ebp
0x24db15 <tcg_handle_interrupt+21>: mov %r12d,%eax
0x24db18 <tcg_handle_interrupt+24>: mov %rbx,%rdi
0x24db1b <tcg_handle_interrupt+27>: or %ebp,%eax
0x24db1d <tcg_handle_interrupt+29>: mov %eax,0xa8(%rbx)
0x24db23 <tcg_handle_interrupt+35>: callq 0x27a530 <qemu_cpu_is_self>
It certainly looks as though it makes the call but ignores the result?
>
> thanks
> -- PMM
--
Alex Bennée
next prev parent reply other threads:[~2017-03-03 11:05 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-02 19:53 [Qemu-devel] [PATCH v2 00/11] MTTCG fixups for 2.9 Alex Bennée
2017-03-02 19:53 ` [Qemu-devel] [PATCH v2 01/11] vl/cpus: be smarter with icount and MTTCG Alex Bennée
2017-03-02 19:53 ` [Qemu-devel] [PATCH v2 02/11] target/i386/cpu.h: declare TCG_GUEST_DEFAULT_MO Alex Bennée
2017-03-03 19:28 ` Eduardo Habkost
2017-03-02 19:53 ` [Qemu-devel] [PATCH v2 03/11] cpus.c: add additional error_report when !TARGET_SUPPORT_MTTCG Alex Bennée
2017-03-02 19:53 ` [Qemu-devel] [PATCH v2 04/11] translate: downgrade IRQ BQL asserts to tcg_debug_assert Alex Bennée
2017-03-03 10:08 ` Peter Maydell
2017-03-03 11:05 ` Alex Bennée [this message]
2017-03-03 11:19 ` Peter Maydell
2017-03-03 19:35 ` Richard Henderson
2017-03-03 19:47 ` Eric Blake
2017-03-03 19:48 ` Eric Blake
2017-03-03 11:49 ` Paolo Bonzini
2017-03-02 19:53 ` [Qemu-devel] [PATCH v2 05/11] translate-all: exit cpu_restore_state early if translating Alex Bennée
2017-03-02 21:46 ` Richard Henderson
2017-03-03 10:03 ` Alex Bennée
2017-03-03 19:50 ` Richard Henderson
2017-03-02 19:53 ` [Qemu-devel] [PATCH v2 06/11] sparc/sparc64: grab BQL before calling cpu_check_irqs Alex Bennée
2017-03-03 11:47 ` Paolo Bonzini
2017-03-06 10:28 ` Alex Bennée
2017-03-06 13:22 ` Paolo Bonzini
2017-03-02 19:53 ` [Qemu-devel] [PATCH v2 07/11] s390x/misc_helper.c: wrap IO instructions in BQL Alex Bennée
2017-03-02 19:53 ` [Qemu-devel] [PATCH v2 08/11] target/xtensa: hold BQL for interrupt processing Alex Bennée
2017-03-07 0:15 ` Max Filippov
2017-03-02 19:53 ` [Qemu-devel] [PATCH v2 09/11] target/mips/op_helper: hold BQL before calling cpu_mips_get_count Alex Bennée
2017-03-03 11:18 ` Yongbok Kim
2017-03-03 12:54 ` Alex Bennée
2017-03-03 13:00 ` Yongbok Kim
2017-03-02 19:53 ` [Qemu-devel] [PATCH v2 10/11] target/arm/helper: make it clear the EC field is also in hex Alex Bennée
2017-03-03 17:07 ` Frederic Konrad
2017-03-03 18:10 ` Peter Maydell
2017-03-02 19:53 ` [Qemu-devel] [PATCH v2 11/11] hw/intc/arm_gic: modernise the DPRINTF Alex Bennée
2017-03-03 17:05 ` Frederic Konrad
2017-03-03 17:09 ` Peter Maydell
2017-03-03 18:09 ` Peter Maydell
2017-03-03 17:38 ` [Qemu-devel] [PATCH v2 00/11] MTTCG fixups for 2.9 Frederic Konrad
2017-03-06 9:43 ` Alex Bennée
2017-03-06 10:45 ` Frederic Konrad
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=87pohy1uyk.fsf@linaro.org \
--to=alex.bennee@linaro.org \
--cc=a.rigo@virtualopensystems.com \
--cc=bobby.prani@gmail.com \
--cc=cota@braap.org \
--cc=crosthwaite.peter@gmail.com \
--cc=fred.konrad@greensocs.com \
--cc=mttcg@listserver.greensocs.com \
--cc=nikunj@linux.vnet.ibm.com \
--cc=pbonzini@redhat.com \
--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).