[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] tcg: Fix complilation with TCG
From: |
Richard Henderson |
Subject: |
Re: [Qemu-devel] [PATCH] tcg: Fix complilation with TCG |
Date: |
Wed, 22 Nov 2017 13:08:28 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 |
On 11/22/2017 01:03 PM, Peter Maydell wrote:
> On 22 November 2017 at 12:01, Richard Henderson
> <address@hidden> wrote:
>> On 11/22/2017 09:41 AM, Juan Quintela wrote:
>>> This commit started use tb_unlock() and tlb_set_dirty() on non TCG
>>> code. Add the function as stubs.
>>>
>>> commit 27266271977c5a30f2f7d493e042be1897827bdd
>>> Author: Peter Maydell <address@hidden>
>>> Date: Mon Nov 20 18:08:27 2017 +0000
>>>
>>> exec.c: Factor out before/after actions for notdirty memory writes
>>> ....
>>>
>>> Signed-off-by: Juan Quintela <address@hidden>
>>> ---
>>> accel/stubs/tcg-stub.c | 8 ++++++++
>>> 1 file changed, 8 insertions(+)
>>
>> Hmm. An alternate solution is
>>
>>
>> diff --git a/exec.c b/exec.c
>> index 03238a3449..ac902da89d 100644
>> --- a/exec.c
>> +++ b/exec.c
>> @@ -2378,6 +2378,7 @@ void memory_notdirty_write_prepare(NotDirtyInfo *ndi,
>> /* Called within RCU critical section. */
>> void memory_notdirty_write_complete(NotDirtyInfo *ndi)
>> {
>> + assert(tcg_enabled());
>> if (ndi->locked) {
>> tb_unlock();
>> }
>>
>>
>> so that the rest of the function is compiled away.
>>
>> Thus my confusion about how Peter was adding any references to these
>> functions
>> -- he split half the function such that half is now not protected by an
>> assert.
>
> Wow, I totally do not expect "assert(tcg_enabled())" to mean
> "we rely on the compiler to be able to determine that this
> code is dead" (and in general I'm not a fan of the compilation
> relying on the compiler determining that code is dead).
We do this all of the time for more regular tests that are obviously
compile-time. I am a really big fan of this, because it makes sure that the
(usually 32-bit) else branch continues to compile.
It's just that with --disable-tcg, tcg_enabled() expands to the less-obviously
constant false.
r~
Re: [Qemu-devel] [PATCH] tcg: Fix complilation with TCG, Peter Maydell, 2017/11/22
Re: [Qemu-devel] [PATCH] tcg: Fix complilation with TCG, Philippe Mathieu-Daudé, 2017/11/22
Re: [Qemu-devel] [PATCH] tcg: Fix complilation with TCG, no-reply, 2017/11/22