Commit a9f949c7 authored by Avi Kivity's avatar Avi Kivity
Browse files

smp: speed up cpu_count()



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: default avatarAvi Kivity <avi@redhat.com>
parent e7bc5602
......@@ -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);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment