[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v5 03/14] cpus: extract out TCG-specific code to accel/tcg
From: |
Richard Henderson |
Subject: |
Re: [PATCH v5 03/14] cpus: extract out TCG-specific code to accel/tcg |
Date: |
Fri, 14 Aug 2020 13:39:06 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 |
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~
- [PATCH v5 00/14] QEMU cpus.c refactoring part2, Claudio Fontana, 2020/08/12
- [PATCH v5 01/14] cpu-timers, icount: new modules, Claudio Fontana, 2020/08/12
- [PATCH v5 04/14] cpus: extract out qtest-specific code to accel/qtest, Claudio Fontana, 2020/08/12
- [PATCH v5 02/14] cpus: prepare new CpusAccel cpu accelerator interface, Claudio Fontana, 2020/08/12
- [PATCH v5 03/14] cpus: extract out TCG-specific code to accel/tcg, Claudio Fontana, 2020/08/12
- Re: [PATCH v5 03/14] cpus: extract out TCG-specific code to accel/tcg,
Richard Henderson <=
- [PATCH v5 06/14] cpus: extract out hax-specific code to target/i386/, Claudio Fontana, 2020/08/12
- [PATCH v5 11/14] hvf: remove hvf specific functions from global includes, Claudio Fontana, 2020/08/12
- [PATCH v5 09/14] cpus: cleanup now unneeded includes, Claudio Fontana, 2020/08/12
- [PATCH v5 07/14] cpus: extract out whpx-specific code to target/i386/, Claudio Fontana, 2020/08/12
- [PATCH v5 08/14] cpus: extract out hvf-specific code to target/i386/hvf/, Claudio Fontana, 2020/08/12