qemu-devel
[Top][All Lists]
Advanced

[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: Claudio Fontana
Subject: Re: [PATCH v5 03/14] cpus: extract out TCG-specific code to accel/tcg
Date: Wed, 19 Aug 2020 15:49:59 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1

On 8/14/20 10:39 PM, Richard Henderson wrote:
> 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.

Will add.

> 
> 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.

I gave it a try, it would work, however it is basically a refactoring of the 
existing qemu_tcg_init_vcpu ,

I'd do it in a separate series if possible (with some help from Alex?)

Claudio

> 
> 
> r~
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]