From: Avi Kivity <avi@xxxxxxxxxx> cpu_count() is used in important places, like vmexit.flat's measuring loop, yet it is ridiculously slow as it talks to the firmware config interface. Speed it up by reading the value from memory. Signed-off-by: Avi Kivity <avi@xxxxxxxxxx> diff --git a/lib/x86/smp.c b/lib/x86/smp.c index 8da614a..d41c332 100644 --- a/lib/x86/smp.c +++ b/lib/x86/smp.c @@ -78,7 +78,7 @@ void spin_unlock(struct spinlock *lock) int cpu_count(void) { - return fwcfg_get_nb_cpus(); + return _cpu_count; } int smp_id(void) @@ -130,6 +130,8 @@ void smp_init(void) int i; void ipi_entry(void); + _cpu_count = fwcfg_get_nb_cpus(); + set_ipi_descriptor(ipi_entry); setup_smp_id(0); -- To unsubscribe from this list: send the line "unsubscribe kvm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html