mirror of
https://github.com/xemu-project/xemu.git
synced 2024-11-26 21:10:42 +00:00
cpus: Introduce cpu_list_generation_id
Introduce cpu_list_generation_id to track cpu list generation so that cpu hotplug/unplug can be detected during measurement of dirty page rate. cpu_list_generation_id could be used to detect changes of cpu list, which is prepared for dirty page rate measurement. Signed-off-by: Hyman Huang(黄勇) <huangy81@chinatelecom.cn> Reviewed-by: Peter Xu <peterx@redhat.com> Message-Id: <06e1f1362b2501a471dce796abb065b04f320fa5.1656177590.git.huangy81@chinatelecom.cn> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
This commit is contained in:
parent
1667e2b97b
commit
ab1a161fe3
@ -73,6 +73,12 @@ static int cpu_get_free_index(void)
|
||||
}
|
||||
|
||||
CPUTailQ cpus = QTAILQ_HEAD_INITIALIZER(cpus);
|
||||
static unsigned int cpu_list_generation_id;
|
||||
|
||||
unsigned int cpu_list_generation_id_get(void)
|
||||
{
|
||||
return cpu_list_generation_id;
|
||||
}
|
||||
|
||||
void cpu_list_add(CPUState *cpu)
|
||||
{
|
||||
@ -84,6 +90,7 @@ void cpu_list_add(CPUState *cpu)
|
||||
assert(!cpu_index_auto_assigned);
|
||||
}
|
||||
QTAILQ_INSERT_TAIL_RCU(&cpus, cpu, node);
|
||||
cpu_list_generation_id++;
|
||||
}
|
||||
|
||||
void cpu_list_remove(CPUState *cpu)
|
||||
@ -96,6 +103,7 @@ void cpu_list_remove(CPUState *cpu)
|
||||
|
||||
QTAILQ_REMOVE_RCU(&cpus, cpu, node);
|
||||
cpu->cpu_index = UNASSIGNED_CPU_INDEX;
|
||||
cpu_list_generation_id++;
|
||||
}
|
||||
|
||||
CPUState *qemu_get_cpu(int index)
|
||||
|
@ -35,6 +35,7 @@ extern intptr_t qemu_host_page_mask;
|
||||
void qemu_init_cpu_list(void);
|
||||
void cpu_list_lock(void);
|
||||
void cpu_list_unlock(void);
|
||||
unsigned int cpu_list_generation_id_get(void);
|
||||
|
||||
void tcg_flush_softmmu_tlb(CPUState *cs);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user