From: Paolo Bonzini <pbonzini@redhat.com>
To: "Claudio Fontana" <cfontana@suse.de>,
"Thomas Huth" <thuth@redhat.com>,
"Laurent Vivier" <lvivier@redhat.com>,
"Alex Bennée" <alex.bennee@linaro.org>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Philippe Mathieu-Daudé" <philmd@redhat.com>,
"Roman Bolshakov" <r.bolshakov@yadro.com>,
"Markus Armbruster" <armbru@redhat.com>
Cc: Eduardo Habkost <ehabkost@redhat.com>,
Colin Xu <colin.xu@intel.com>,
Marcelo Tosatti <mtosatti@redhat.com>,
qemu-devel@nongnu.org, haxm-team@intel.com,
Wenchao Wang <wenchao.wang@intel.com>,
Sunil Muthuswamy <sunilmut@microsoft.com>,
Richard Henderson <rth@twiddle.net>
Subject: Re: [PATCH 3/3] cpu-timers, icount: new modules
Date: Sat, 11 Jul 2020 11:39:37 +0200 [thread overview]
Message-ID: <76aac4ac-40f5-4870-ed2b-bab8b68b0a64@redhat.com> (raw)
In-Reply-To: <e3cc11a4-8ba7-917a-844b-4f6ec69d140a@suse.de>
On 11/07/20 11:14, Claudio Fontana wrote:
> On 7/11/20 12:45 AM, Paolo Bonzini wrote:
>> On 10/07/20 06:36, Thomas Huth wrote:
>>>
>>> In short this goes away if I again set icount to enabled for qtest,
>>> basically ensuring that --enable-tcg is there and then reenabling icount.
>>>
>>> qtest was forcing icount and shift=0 by creating qemu options, in order to misuse its counter feature,
>>> instead of using a separate counter.
>>
>> Why would it need a separate counter? In both cases it's a
>> manually-updated counter that is used for QEMU_CLOCK_VIRTUAL. The only
>> difference is that shift > 0 doesn't make sense for qtest.
>
> I think I would reverse the question. Why reuse for qtest a counter that has absolutely nothing to do with it?
>
> qtest has nothing to do with instruction counting.
Apart from the name, icount is more like deterministic execution than
instruction counting (it's not a coincidence that record/replay is
fundamentally based on icount). qtests need to be deterministic and
describe which qtest instructions run before a given timer fires and
which run after.
And in both cases, determinism is achieved by controlling the
advancement of QEMU_CLOCK_VIRTUAL. It's only this central component of
icount that is shared by qtest and TCG, and I think the problem is that
this patch conflates all of them together:
- the basic "is QEMU_CLOCK_VIRTUAL software-driven" part is embedded in
qemu-timer and should not be carved out into a separate module. This
includes the use_icount variable, which should be kept in core QEMU code.
- the fact qtest uses -icount instead of configuring the variables
directly is definitely a hack and can be removed.
- the adaptive frequency adjustment is definitely TCG specific, and so
are the particular functions in cpus.c that test icount_enabled() and
broke with this patch. All this code should be included in the TCG
module only or, before that, should be made conditional on $(CONFIG_TCG).
So I think this patch should have been the last, not the first. :) Once
you move all the accelerator runtime code from cpus.c to separate files,
it will be possible to move the frequency adjustment and deadline
management code into accel/tcg. And then it will be obvious which code
is not TCG-specific and can be extracted for convenience into a
cpu-timers.c file.
Thanks,
Paolo
next prev parent reply other threads:[~2020-07-11 9:40 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-29 9:35 [PATCH 0/3] QEMU cpus.c refactoring part1 Claudio Fontana
2020-06-29 9:35 ` [PATCH 1/3] softmmu: move softmmu only files from root Claudio Fontana
2020-07-03 17:21 ` Paolo Bonzini
2020-06-29 9:35 ` [PATCH 2/3] cpu-throttle: new module, extracted from cpus.c Claudio Fontana
2020-06-29 9:35 ` [PATCH 3/3] cpu-timers, icount: new modules Claudio Fontana
2020-07-08 14:34 ` Paolo Bonzini
2020-07-08 15:00 ` Claudio Fontana
2020-07-08 15:05 ` Paolo Bonzini
2020-07-08 15:07 ` Thomas Huth
2020-07-08 15:12 ` Paolo Bonzini
2020-07-08 15:15 ` Claudio Fontana
2020-07-08 15:15 ` Thomas Huth
2020-07-08 15:17 ` Claudio Fontana
2020-07-08 15:23 ` Paolo Bonzini
2020-07-08 15:30 ` Claudio Fontana
2020-07-09 18:38 ` Claudio Fontana
2020-07-09 18:46 ` Claudio Fontana
2020-07-10 6:33 ` Cornelia Huck
2020-07-10 19:20 ` Claudio Fontana
2020-07-13 10:46 ` Cornelia Huck
2020-07-11 11:40 ` Claudio Fontana
2020-07-13 10:51 ` Cornelia Huck
2020-07-13 11:27 ` Claudio Fontana
2020-07-10 4:36 ` Thomas Huth
2020-07-10 22:45 ` Paolo Bonzini
2020-07-11 9:14 ` Claudio Fontana
2020-07-11 9:39 ` Paolo Bonzini [this message]
2020-07-11 11:49 ` Claudio Fontana
2020-07-11 12:19 ` Paolo Bonzini
2020-07-11 12:48 ` Claudio Fontana
2020-07-29 8:48 ` Claudio Fontana
2020-07-29 10:01 ` Paolo Bonzini
2020-07-30 16:33 ` Claudio Fontana
2020-07-30 22:09 ` Paolo Bonzini
2020-07-31 10:59 ` Claudio Fontana
2020-07-02 6:27 ` [PATCH 0/3] QEMU cpus.c refactoring part1 Claudio Fontana
2020-07-03 17:21 ` Paolo Bonzini
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=76aac4ac-40f5-4870-ed2b-bab8b68b0a64@redhat.com \
--to=pbonzini@redhat.com \
--cc=alex.bennee@linaro.org \
--cc=armbru@redhat.com \
--cc=cfontana@suse.de \
--cc=colin.xu@intel.com \
--cc=ehabkost@redhat.com \
--cc=haxm-team@intel.com \
--cc=lvivier@redhat.com \
--cc=mtosatti@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=r.bolshakov@yadro.com \
--cc=rth@twiddle.net \
--cc=sunilmut@microsoft.com \
--cc=thuth@redhat.com \
--cc=wenchao.wang@intel.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).