Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'hyperv-fixes-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux

Pull hyperv fix from Wei Liu:
"One patch from Vitaly to fix reenlightenment notifications"

* tag 'hyperv-fixes-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux:
x86/hyperv: Properly suspend/resume reenlightenment notifications

+17 -2
+17 -2
arch/x86/hyperv/hv_init.c
··· 226 226 227 227 rdmsrl(HV_X64_MSR_REENLIGHTENMENT_CONTROL, *((u64 *)&re_ctrl)); 228 228 if (re_ctrl.target_vp == hv_vp_index[cpu]) { 229 - /* Reassign to some other online CPU */ 229 + /* 230 + * Reassign reenlightenment notifications to some other online 231 + * CPU or just disable the feature if there are no online CPUs 232 + * left (happens on hibernation). 233 + */ 230 234 new_cpu = cpumask_any_but(cpu_online_mask, cpu); 231 235 232 - re_ctrl.target_vp = hv_vp_index[new_cpu]; 236 + if (new_cpu < nr_cpu_ids) 237 + re_ctrl.target_vp = hv_vp_index[new_cpu]; 238 + else 239 + re_ctrl.enabled = 0; 240 + 233 241 wrmsrl(HV_X64_MSR_REENLIGHTENMENT_CONTROL, *((u64 *)&re_ctrl)); 234 242 } 235 243 ··· 301 293 302 294 hv_hypercall_pg = hv_hypercall_pg_saved; 303 295 hv_hypercall_pg_saved = NULL; 296 + 297 + /* 298 + * Reenlightenment notifications are disabled by hv_cpu_die(0), 299 + * reenable them here if hv_reenlightenment_cb was previously set. 300 + */ 301 + if (hv_reenlightenment_cb) 302 + set_hv_tscchange_cb(hv_reenlightenment_cb); 304 303 } 305 304 306 305 /* Note: when the ops are called, only CPU0 is online and IRQs are disabled. */