qemu-e2k/target/ppc
Greg Kurz 9cbcfb5924 target/ppc/kvm: Cache timebase frequency
Each vCPU core exposes its timebase frequency in the DT. When running
under KVM, this means parsing /proc/cpuinfo in order to get the timebase
frequency of the host CPU.

The parsing appears to slow down the boot quite a bit with higher number
of cores:

# of cores     seconds spent in spapr_dt_cpus()
      8                  0.550122
     16                  1.342375
     32                  2.850316
     64                  5.922505
     96                  9.109224
    128                 12.245504
    256                 24.957236
    384                 37.389113

The timebase frequency of the host CPU is identical for all
cores and it is an invariant for the VM lifetime. Cache it
instead of doing the same expensive parsing again and again.

Rename kvmppc_get_tbfreq() to kvmppc_get_tbfreq_procfs() and
rename the 'retval' variable to make it clear it is used as
fallback only. Come up with a new version of kvmppc_get_tbfreq()
that calls kvmppc_get_tbfreq_procfs() only once and keep the
value in a static.

Zero is certainly not a valid value for the timebase frequency.
Treat atoi() returning zero as another parsing error and return
the fallback value instead. This allows kvmppc_get_tbfreq() to
use zero as an indicator that kvmppc_get_tbfreq_procfs() hasn't
been called yet.

With this patch applied:

    384                 0.518382

Signed-off-by: Greg Kurz <groug@kaod.org>
Message-Id: <161600382766.1780699.6787739229984093959.stgit@bahia.lan>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-03-31 11:10:50 +11:00
..
translate
arch_dump.c
compat.c
cpu-models.c
cpu-models.h
cpu-param.h
cpu-qom.h sysemu: Let VMChangeStateHandler take boolean 'running' argument 2021-03-09 23:13:57 +01:00
cpu.c
cpu.h target/ppc: Add E500 L2CSR0 write helper 2021-02-10 14:50:11 +11:00
dfp_helper.c
excp_helper.c
fpu_helper.c
gdbstub.c target/ppc: Drop use of gdb_get_float64() and ldfq_p() 2021-02-15 09:38:44 +00:00
helper_regs.h
helper.h
int_helper.c target/ppc: Fix bcdsub. emulation when result overflows 2021-03-10 09:07:09 +11:00
internal.h
kvm_ppc.h spapr: Add PEF based confidential guest support 2021-02-08 16:57:38 +11:00
kvm-stub.c
kvm.c target/ppc/kvm: Cache timebase frequency 2021-03-31 11:10:50 +11:00
machine.c
mem_helper.c
meson.build
mfrom_table_gen.c
mfrom_table.c.inc
misc_helper.c
mmu_helper.c
mmu-book3s-v3.c
mmu-book3s-v3.h
mmu-hash32.c
mmu-hash32.h
mmu-hash64.c
mmu-hash64.h
mmu-radix64.c
mmu-radix64.h
monitor.c
timebase_helper.c
trace-events
trace.h
translate_init.c.inc ppc patch queue for 2021-03-10 2021-03-12 11:30:55 +00:00
translate.c
user_only_helper.c