qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: "Claudio Fontana" <cfontana@suse.de>,
	"Paolo Bonzini" <pbonzini@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>
Cc: Laurent Vivier <lvivier@redhat.com>,
	Thomas Huth <thuth@redhat.com>,
	Eduardo Habkost <ehabkost@redhat.com>,
	Marcelo Tosatti <mtosatti@redhat.com>,
	qemu-devel@nongnu.org, Markus Armbruster <armbru@redhat.com>,
	Pavel Dovgalyuk <dovgaluk@ispras.ru>,
	Wenchao Wang <wenchao.wang@intel.com>,
	haxm-team@intel.com, Sunil Muthuswamy <sunilmut@microsoft.com>,
	Richard Henderson <rth@twiddle.net>,
	Colin Xu <colin.xu@intel.com>
Subject: Re: [PATCH v5 03/14] cpus: extract out TCG-specific code to accel/tcg
Date: Fri, 14 Aug 2020 13:39:06 -0700	[thread overview]
Message-ID: <6d14d386-231a-f3b5-8802-167c8979aa03@linaro.org> (raw)
In-Reply-To: <20200812183250.9221-4-cfontana@suse.de>

On 8/12/20 11:32 AM, Claudio Fontana wrote:
> +static int64_t tcg_get_virtual_clock(void)
> +{
> +    if (icount_enabled()) {
> +        return icount_get();
> +    }
> +    return cpu_get_clock();
> +}
> +
> +static int64_t tcg_get_elapsed_ticks(void)
> +{
> +    if (icount_enabled()) {
> +        return icount_get();
> +    }
> +    return cpu_get_ticks();
> +}
> +
> +CpusAccel tcg_cpus = {
> +    .create_vcpu_thread = tcg_start_vcpu_thread,
> +    .kick_vcpu_thread = tcg_kick_vcpu_thread,
> +    .get_virtual_clock = tcg_get_virtual_clock,
> +    .get_elapsed_ticks = tcg_get_elapsed_ticks,
> +};

I think this variable should be const.  Which of course means that the previous
patch needs to add const annotations.

I think you should actually have multiple dispatch variables: with icount and
without, with mttcg and without.  That way these methods don't have to check
icount_enabled() or qemu_tcg_mttcg_enabled() at runtime, only at startup.


r~


  reply	other threads:[~2020-08-14 20:39 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-12 18:32 [PATCH v5 00/14] QEMU cpus.c refactoring part2 Claudio Fontana
2020-08-12 18:32 ` [PATCH v5 01/14] cpu-timers, icount: new modules Claudio Fontana
2020-08-14 20:20   ` Richard Henderson
2020-08-19 13:49     ` Claudio Fontana
2020-08-12 18:32 ` [PATCH v5 02/14] cpus: prepare new CpusAccel cpu accelerator interface Claudio Fontana
2020-08-14 20:28   ` Richard Henderson
2020-08-19 13:49     ` Claudio Fontana
2020-08-12 18:32 ` [PATCH v5 03/14] cpus: extract out TCG-specific code to accel/tcg Claudio Fontana
2020-08-14 20:39   ` Richard Henderson [this message]
2020-08-19 13:49     ` Claudio Fontana
2020-08-12 18:32 ` [PATCH v5 04/14] cpus: extract out qtest-specific code to accel/qtest Claudio Fontana
2020-08-14 20:42   ` Richard Henderson
2020-08-12 18:32 ` [PATCH v5 05/14] cpus: extract out kvm-specific code to accel/kvm Claudio Fontana
2020-08-14 20:44   ` Richard Henderson
2020-08-12 18:32 ` [PATCH v5 06/14] cpus: extract out hax-specific code to target/i386/ Claudio Fontana
2020-08-14 20:48   ` Richard Henderson
2020-08-12 18:32 ` [PATCH v5 07/14] cpus: extract out whpx-specific " Claudio Fontana
2020-08-14 20:49   ` Richard Henderson
2020-08-12 18:32 ` [PATCH v5 08/14] cpus: extract out hvf-specific code to target/i386/hvf/ Claudio Fontana
2020-08-14 20:51   ` Richard Henderson
2020-08-12 18:32 ` [PATCH v5 09/14] cpus: cleanup now unneeded includes Claudio Fontana
2020-08-14 20:51   ` Richard Henderson
2020-08-12 18:32 ` [PATCH v5 10/14] cpus: add handle_interrupt to the CpusAccel interface Claudio Fontana
2020-08-14 21:01   ` Richard Henderson
2020-08-17 12:31     ` Roman Bolshakov
2020-08-19 13:50     ` Claudio Fontana
2020-08-12 18:32 ` [PATCH v5 11/14] hvf: remove hvf specific functions from global includes Claudio Fontana
2020-08-14 21:02   ` Richard Henderson
2020-08-12 18:32 ` [PATCH v5 12/14] whpx: remove whpx " Claudio Fontana
2020-08-14 21:03   ` Richard Henderson
2020-08-12 18:32 ` [PATCH v5 13/14] hax: remove hax " Claudio Fontana
2020-08-14 21:06   ` Richard Henderson
2020-08-12 18:32 ` [PATCH v5 14/14] kvm: remove kvm " Claudio Fontana
2020-08-14 21:07   ` Richard Henderson
2020-08-13 14:16 ` [PATCH v5 00/14] QEMU cpus.c refactoring part2 no-reply
2020-08-13 16:06   ` Claudio Fontana
2020-08-14  7:49     ` 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=6d14d386-231a-f3b5-8802-167c8979aa03@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=alex.bennee@linaro.org \
    --cc=armbru@redhat.com \
    --cc=cfontana@suse.de \
    --cc=colin.xu@intel.com \
    --cc=dovgaluk@ispras.ru \
    --cc=ehabkost@redhat.com \
    --cc=haxm-team@intel.com \
    --cc=lvivier@redhat.com \
    --cc=mtosatti@redhat.com \
    --cc=pbonzini@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).