qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH for-4.1 v2 32/36] cpu: Move icount_decr to CPUNe


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH for-4.1 v2 32/36] cpu: Move icount_decr to CPUNegativeOffsetState
Date: Mon, 29 Apr 2019 15:48:35 +0100

On Thu, 28 Mar 2019 at 23:28, Richard Henderson
<address@hidden> wrote:
>
> Amusingly, we had already ignored the comment to keep this value at the
> end of CPUState.  This restores the minimum negative offset from TCG_AREG0
> for code generation.
>
> For the couple of uses within qom/cpu.c, add a pointer from the CPUState
> object to the IcountDecr object within CPUNegativeOffsetState.
>
> Signed-off-by: Richard Henderson <address@hidden>


> diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
> index 45ef41ebb2..032a62672e 100644
> --- a/accel/tcg/cpu-exec.c
> +++ b/accel/tcg/cpu-exec.c
> @@ -54,7 +54,7 @@ typedef struct SyncClocks {
>  #define MAX_DELAY_PRINT_RATE 2000000000LL
>  #define MAX_NB_PRINTS 100
>
> -static void align_clocks(SyncClocks *sc, const CPUState *cpu)
> +static void align_clocks(SyncClocks *sc, CPUState *cpu)
>  {
>      int64_t cpu_icount;
>
> @@ -62,7 +62,7 @@ static void align_clocks(SyncClocks *sc, const CPUState 
> *cpu)
>          return;
>      }
>
> -    cpu_icount = cpu->icount_extra + cpu->icount_decr.u16.low;
> +    cpu_icount = cpu->icount_extra + cpu_neg(cpu)->icount_decr.u16.low;
>      sc->diff_clk += cpu_icount_to_ns(sc->last_cpu_icount - cpu_icount);
>      sc->last_cpu_icount = cpu_icount;

Why does this require that we remove the 'const' from the cpu
argument to the function ?


> @@ -1404,7 +1405,7 @@ static void process_icount_data(CPUState *cpu)
>          cpu_update_icount(cpu);
>
>          /* Reset the counters */
> -        cpu->icount_decr.u16.low = 0;
> +        cpu_neg(cpu)->icount_decr.u16.low = 0;
>          cpu->icount_extra = 0;
>          cpu->icount_budget = 0;
>


>  int cpu_write_elf32_qemunote(WriteCoreDumpFunction f, CPUState *cpu,
> @@ -265,7 +265,7 @@ static void cpu_common_reset(CPUState *cpu)
>      cpu->mem_io_pc = 0;
>      cpu->mem_io_vaddr = 0;
>      cpu->icount_extra = 0;
> -    atomic_set(&cpu->icount_decr.u32, 0);
> +    atomic_set(&cpu->icount_decr_ptr->u32, 0);
>      cpu->can_do_io = 1;
>      cpu->exception_index = -1;
>      cpu->crash_occurred = false;

What determines when we need to access the icount fields
via icount_decr_ptr versus when we can just directly
access icount_decr ?

thanks
-- PMM



reply via email to

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