mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 08:13:54 -06:00
spapr: avoid overhead of finding vhyp class in critical operations
PPC_VIRTUAL_HYPERVISOR_GET_CLASS is used in critical operations like interrupts and TLB misses and is quite costly. Running the kvm-unit-tests sieve program with radix MMU enabled thrashes the TCG TLB and spends a lot of time in TLB and page table walking code. The test takes 67 seconds to complete with a lot of time being spent in code related to finding the vhyp class: 12.01% [.] g_str_hash 8.94% [.] g_hash_table_lookup 8.06% [.] object_class_dynamic_cast 6.21% [.] address_space_ldq 4.94% [.] __strcmp_avx2 4.28% [.] tlb_set_page_full 4.08% [.] address_space_translate_internal 3.17% [.] object_class_dynamic_cast_assert 2.84% [.] ppc_radix64_xlate Keep a pointer to the class and avoid this lookup. This reduces the execution time to 40 seconds. Reviewed-by: Harsh Prateek Bora <harshpb@linux.ibm.com> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
This commit is contained in:
parent
70581940ca
commit
c700b5e162
8 changed files with 17 additions and 40 deletions
|
@ -6661,6 +6661,7 @@ void cpu_ppc_set_vhyp(PowerPCCPU *cpu, PPCVirtualHypervisor *vhyp)
|
|||
CPUPPCState *env = &cpu->env;
|
||||
|
||||
cpu->vhyp = vhyp;
|
||||
cpu->vhyp_class = PPC_VIRTUAL_HYPERVISOR_GET_CLASS(vhyp);
|
||||
|
||||
/*
|
||||
* With a virtual hypervisor mode we never allow the CPU to go
|
||||
|
@ -7248,9 +7249,7 @@ static void ppc_cpu_exec_enter(CPUState *cs)
|
|||
PowerPCCPU *cpu = POWERPC_CPU(cs);
|
||||
|
||||
if (cpu->vhyp) {
|
||||
PPCVirtualHypervisorClass *vhc =
|
||||
PPC_VIRTUAL_HYPERVISOR_GET_CLASS(cpu->vhyp);
|
||||
vhc->cpu_exec_enter(cpu->vhyp, cpu);
|
||||
cpu->vhyp_class->cpu_exec_enter(cpu->vhyp, cpu);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7259,9 +7258,7 @@ static void ppc_cpu_exec_exit(CPUState *cs)
|
|||
PowerPCCPU *cpu = POWERPC_CPU(cs);
|
||||
|
||||
if (cpu->vhyp) {
|
||||
PPCVirtualHypervisorClass *vhc =
|
||||
PPC_VIRTUAL_HYPERVISOR_GET_CLASS(cpu->vhyp);
|
||||
vhc->cpu_exec_exit(cpu->vhyp, cpu);
|
||||
cpu->vhyp_class->cpu_exec_exit(cpu->vhyp, cpu);
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_TCG */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue