未验证 提交 00fbb381 编写于 作者: O openeuler-ci-bot 提交者: Gitee

!405 kvm: arm64: fix some pvsched bugs

Merge Pull Request from: @yezengruan 
 
kvm: arm64: fix some pvsched bugs

1. Clear kvm_vcpu_arch::pvsched::base on vcpu reset
The guest memory will otherwise be corrupted by KVM if we reboot into
an old guest kernel which is **not** aware of the pvsched feature.

2. Fix boot cpu pvsched init abnormal
The pv_sched_init was called too early in the boot in setup_arch, hence
pvsched_vcpu_state was not initializedfo vcpu 0.

https://gitee.com/openeuler/kernel/issues/I6E2VI?from=project-issue 
 
Link:https://gitee.com/openeuler/kernel/pulls/405 

Reviewed-by: Kevin Zhu <zhukeqian1@huawei.com> 
Signed-off-by: Zheng Zengkai <zhengzengkai@huawei.com> 
...@@ -351,3 +351,4 @@ int __init pv_sched_init(void) ...@@ -351,3 +351,4 @@ int __init pv_sched_init(void)
return 0; return 0;
} }
early_initcall(pv_sched_init);
...@@ -407,8 +407,6 @@ void __init __no_sanitize_address setup_arch(char **cmdline_p) ...@@ -407,8 +407,6 @@ void __init __no_sanitize_address setup_arch(char **cmdline_p)
smp_init_cpus(); smp_init_cpus();
smp_build_mpidr_hash(); smp_build_mpidr_hash();
pv_sched_init();
/* Init percpu seeds for random tags after cpus are set up. */ /* Init percpu seeds for random tags after cpus are set up. */
kasan_init_tags(); kasan_init_tags();
......
...@@ -1140,6 +1140,8 @@ static int kvm_arch_vcpu_ioctl_vcpu_init(struct kvm_vcpu *vcpu, ...@@ -1140,6 +1140,8 @@ static int kvm_arch_vcpu_ioctl_vcpu_init(struct kvm_vcpu *vcpu,
else else
vcpu->arch.power_off = false; vcpu->arch.power_off = false;
kvm_arm_pvsched_vcpu_init(&vcpu->arch);
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册