qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Richard Henderson <richard.henderson@linaro.org>, qemu-devel@nongnu.org
Cc: qemu-arm@nongnu.org, "Pavel Dovgalyuk" <pavel.dovgaluk@ispras.ru>,
	"Fam Zheng" <fam@euphon.net>,
	"Stefan Hajnoczi" <stefanha@redhat.com>,
	qemu-block@nongnu.org, "Paolo Bonzini" <pbonzini@redhat.com>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>
Subject: Re: [PATCH v2 4/5] system/vl: Restrict icount to TCG emulation
Date: Fri, 8 Dec 2023 12:17:21 +0100	[thread overview]
Message-ID: <0c5b33a6-3f0d-4bc2-9627-da04d202b5aa@linaro.org> (raw)
In-Reply-To: <83f260a3-68e5-4041-9e92-d8250c327cf8@linaro.org>

On 7/12/23 23:38, Richard Henderson wrote:
> On 12/7/23 07:45, Philippe Mathieu-Daudé wrote:
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> ---
>>   stubs/icount.c | 6 ------
>>   system/vl.c    | 6 +++++-
>>   2 files changed, 5 insertions(+), 7 deletions(-)
>>
>> diff --git a/stubs/icount.c b/stubs/icount.c
>> index a5202e2dd9..b060b03a73 100644
>> --- a/stubs/icount.c
>> +++ b/stubs/icount.c
>> @@ -1,5 +1,4 @@
>>   #include "qemu/osdep.h"
>> -#include "qapi/error.h"
>>   #include "sysemu/cpu-timers.h"
>>   /* icount - Instruction Counter API */
>> @@ -10,11 +9,6 @@ void icount_update(CPUState *cpu)
>>   {
>>       abort();
>>   }
>> -void icount_configure(QemuOpts *opts, Error **errp)
>> -{
>> -    /* signal error */
>> -    error_setg(errp, "cannot configure icount, TCG support not 
>> available");
>> -}
>>   int64_t icount_get_raw(void)
>>   {
>>       abort();
>> diff --git a/system/vl.c b/system/vl.c
>> index 2bcd9efb9a..8c99c5f681 100644
>> --- a/system/vl.c
>> +++ b/system/vl.c
>> @@ -2270,7 +2270,11 @@ static void user_register_global_props(void)
>>   static int do_configure_icount(void *opaque, QemuOpts *opts, Error 
>> **errp)
>>   {
>> -    icount_configure(opts, errp);
>> +    if (tcg_enabled()) {
>> +        icount_configure(opts, errp);
>> +    } else {
>> +        error_setg(errp, "cannot configure icount, TCG support not 
>> available");
>> +    }
>>       return 0;
>>   }
> 
> This is called before the accelerator is chosen -- even before the set 
> of available accelerators is even found.  Indeed, that's the very next 
> thing that configure_accelerators does.
> 
> OTOH, I don't see why icount_configure is being called so early.

See commit 7f8b6126e7:

     vl: move icount configuration earlier

     Once qemu_tcg_configure is turned into a QOM property setter,
     it will not be able to set a default value for mttcg_enabled.
     Setting the default will move to the TCG instance_init function,
     which currently runs before "-icount" is processed.

     However, it is harmless to do configure_icount for all accelerators;
     we will just fail later if a non-TCG accelerator is selected.  So do
     that.

But few commits after we have 28a0961757 ("vl: merge -accel processing
into configure_accelerators"), so it shouldn't be an issue now. I'll
consolidate.


  reply	other threads:[~2023-12-08 11:18 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-07 15:45 [PATCH v2 0/5] sysemu/replay: Restrict icount to TCG system emulation Philippe Mathieu-Daudé
2023-12-07 15:45 ` [PATCH v2 1/5] sysemu/cpu-timers: Introduce ICountMode enumerator Philippe Mathieu-Daudé
2023-12-07 22:06   ` Richard Henderson
2023-12-07 15:45 ` [PATCH v2 2/5] target/arm: Ensure icount is enabled when emulating INST_RETIRED Philippe Mathieu-Daudé
2023-12-07 22:12   ` Richard Henderson
2023-12-08 10:36     ` Philippe Mathieu-Daudé
2023-12-08 10:59       ` Peter Maydell
2023-12-08 11:23         ` Philippe Mathieu-Daudé
2023-12-08 14:00           ` Philippe Mathieu-Daudé
2023-12-07 15:45 ` [PATCH v2 3/5] util/async: Only call icount_notify_exit() if icount is enabled Philippe Mathieu-Daudé
2023-12-07 22:17   ` Richard Henderson
2023-12-07 15:45 ` [PATCH v2 4/5] system/vl: Restrict icount to TCG emulation Philippe Mathieu-Daudé
2023-12-07 22:38   ` Richard Henderson
2023-12-08 11:17     ` Philippe Mathieu-Daudé [this message]
2023-12-07 15:45 ` [PATCH v2 5/5] sysemu/replay: Restrict icount to system emulation 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=0c5b33a6-3f0d-4bc2-9627-da04d202b5aa@linaro.org \
    --to=philmd@linaro.org \
    --cc=fam@euphon.net \
    --cc=marcandre.lureau@redhat.com \
    --cc=pavel.dovgaluk@ispras.ru \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=stefanha@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 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).