All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Juan Quintela <quintela@redhat.com>,
	QEMU Developers <qemu-devel@nongnu.org>,
	Laurent Vivier <lvivier@redhat.com>,
	"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
	Peter Xu <peterx@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] tcg: Fix complilation with TCG
Date: Wed, 22 Nov 2017 13:08:28 +0100	[thread overview]
Message-ID: <e384f727-0cdd-9fcd-a50f-a9f89ae2272a@linaro.org> (raw)
In-Reply-To: <CAFEAcA_i2rumOMHVa7t4nQhHoM6zWgD1mPC5QbcqGermiO3eeQ@mail.gmail.com>

On 11/22/2017 01:03 PM, Peter Maydell wrote:
> On 22 November 2017 at 12:01, Richard Henderson
> <richard.henderson@linaro.org> 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 <peter.maydell@linaro.org>
>>> 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 <quintela@redhat.com>
>>> ---
>>>  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~

  reply	other threads:[~2017-11-22 12:08 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-22  8:41 [Qemu-devel] [PATCH] tcg: Fix complilation with TCG Juan Quintela
2017-11-22  9:09 ` no-reply
2017-11-22 12:01 ` Richard Henderson
2017-11-22 12:03   ` Peter Maydell
2017-11-22 12:08     ` Richard Henderson [this message]
2017-11-22 12:14       ` Peter Maydell
2017-11-23 22:08         ` Paolo Bonzini
2017-11-24 10:07           ` Peter Maydell
2017-11-24 10:09             ` Paolo Bonzini
2017-11-22 12:19       ` Dr. David Alan Gilbert
2017-11-22 12:01 ` Peter Maydell
2017-11-22 12:05   ` Juan Quintela
2017-11-22 12:32 ` Philippe Mathieu-Daudé
2017-11-22 22:45   ` Emilio G. Cota
2017-11-23 10:46 ` Peter Maydell

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=e384f727-0cdd-9fcd-a50f-a9f89ae2272a@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=dgilbert@redhat.com \
    --cc=lvivier@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.