cpu: init vmstate for ticks and clock offset
Ticks and clock offset used by CPU timers have to be saved in vmstate. But vmstate for these fields registered only in icount mode. Missing registration leads to breaking the continuity when vmstate is loaded. This patch introduces new initialization function which fixes this. Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
a6dead43e6
commit
4603ea0105
8
cpus.c
8
cpus.c
|
@ -493,13 +493,17 @@ static const VMStateDescription vmstate_timers = {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void cpu_ticks_init(void)
|
||||||
|
{
|
||||||
|
seqlock_init(&timers_state.vm_clock_seqlock, NULL);
|
||||||
|
vmstate_register(NULL, 0, &vmstate_timers, &timers_state);
|
||||||
|
}
|
||||||
|
|
||||||
void configure_icount(QemuOpts *opts, Error **errp)
|
void configure_icount(QemuOpts *opts, Error **errp)
|
||||||
{
|
{
|
||||||
const char *option;
|
const char *option;
|
||||||
char *rem_str = NULL;
|
char *rem_str = NULL;
|
||||||
|
|
||||||
seqlock_init(&timers_state.vm_clock_seqlock, NULL);
|
|
||||||
vmstate_register(NULL, 0, &vmstate_timers, &timers_state);
|
|
||||||
option = qemu_opt_get(opts, "shift");
|
option = qemu_opt_get(opts, "shift");
|
||||||
if (!option) {
|
if (!option) {
|
||||||
if (qemu_opt_get(opts, "align") != NULL) {
|
if (qemu_opt_get(opts, "align") != NULL) {
|
||||||
|
|
|
@ -105,6 +105,8 @@ static inline char *realpath(const char *path, char *resolved_path)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void cpu_ticks_init(void);
|
||||||
|
|
||||||
/* icount */
|
/* icount */
|
||||||
void configure_icount(QemuOpts *opts, Error **errp);
|
void configure_icount(QemuOpts *opts, Error **errp);
|
||||||
extern int use_icount;
|
extern int use_icount;
|
||||||
|
|
1
vl.c
1
vl.c
|
@ -4334,6 +4334,7 @@ int main(int argc, char **argv, char **envp)
|
||||||
qemu_spice_init();
|
qemu_spice_init();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
cpu_ticks_init();
|
||||||
if (icount_opts) {
|
if (icount_opts) {
|
||||||
if (kvm_enabled() || xen_enabled()) {
|
if (kvm_enabled() || xen_enabled()) {
|
||||||
fprintf(stderr, "-icount is not allowed with kvm or xen\n");
|
fprintf(stderr, "-icount is not allowed with kvm or xen\n");
|
||||||
|
|
Loading…
Reference in New Issue