• E
    tcg: fix corruption of code_time profiling counter upon tb_flush · 0aecede6
    Emilio G. Cota 提交于
    Whenever there is an overflow in code_gen_buffer (e.g. we run out
    of space in it and have to flush it), the code_time profiling counter
    ends up with an invalid value (that is, code_time -= profile_getclock(),
    without later on getting += profile_getclock() due to the goto).
    
    Fix it by using the ti variable, so that we only update code_time
    when there is no overflow. Note that in case there is an overflow
    we fail to account for the elapsed coding time, but this is quite rare
    so we can probably live with it.
    
    "info jit" before/after, roughly at the same time during debian-arm bootup:
    
    - before:
    Statistics:
    TB flush count      1
    TB invalidate count 4665
    TLB flush count     998
    JIT cycles          -615191529184601 (-256329.804 s at 2.4 GHz)
    translated TBs      302310 (aborted=0 0.0%)
    avg ops/TB          48.4 max=438
    deleted ops/TB      8.54
    avg temps/TB        32.31 max=38
    avg host code/TB    361.5
    avg search data/TB  24.5
    cycles/op           -42014693.0
    cycles/in byte      -121444900.2
    cycles/out byte     -5629031.1
    cycles/search byte     -83114481.0
      gen_interm time   -0.0%
      gen_code time     100.0%
    optim./code time    -0.0%
    liveness/code time  -0.0%
    cpu_restore count   6236
      avg cycles        110.4
    
    - after:
    Statistics:
    TB flush count      1
    TB invalidate count 4665
    TLB flush count     1010
    JIT cycles          1996899624 (0.832 s at 2.4 GHz)
    translated TBs      297961 (aborted=0 0.0%)
    avg ops/TB          48.5 max=438
    deleted ops/TB      8.56
    avg temps/TB        32.31 max=38
    avg host code/TB    361.8
    avg search data/TB  24.5
    cycles/op           138.2
    cycles/in byte      398.4
    cycles/out byte     18.5
    cycles/search byte     273.1
      gen_interm time   14.0%
      gen_code time     86.0%
    optim./code time    19.4%
    liveness/code time  10.3%
    cpu_restore count   6372
      avg cycles        111.0
    Reviewed-by: NRichard Henderson <rth@twiddle.net>
    Reviewed-by: NAlex Bennée <alex.bennee@linaro.org>
    Reviewed-by: NPhilippe Mathieu-Daudé <f4bug@amsat.org>
    Signed-off-by: NEmilio G. Cota <cota@braap.org>
    Signed-off-by: NRichard Henderson <richard.henderson@linaro.org>
    0aecede6
translate-all.c 65.8 KB