1. 11 Nov, 2022 1 commit
    • Vitaly Kuznetsov's avatar
      x86/hyperv: Restore VP assist page after cpu offlining/onlining · ee681541
      Vitaly Kuznetsov authored
      Commit e5d9b714 ("x86/hyperv: fix root partition faults when writing
      to VP assist page MSR") moved 'wrmsrl(HV_X64_MSR_VP_ASSIST_PAGE)' under
      'if (*hvp)' condition. This works for root partition as hv_cpu_die()
      does memunmap() and sets 'hv_vp_assist_page[cpu]' to NULL but breaks
      non-root partitions as hv_cpu_die() doesn't free 'hv_vp_assist_page[cpu]'
      for them. This causes VP assist page to remain unset after CPU
      offline/online cycle:
      
      $ rdmsr -p 24 0x40000073
        10212f001
      $ echo 0 > /sys/devices/system/cpu/cpu24/online
      $ echo 1 > /sys/devices/system/cpu/cpu24/online
      $ rdmsr -p 24 0x40000073
        0
      
      Fix the issue by always writing to HV_X64_MSR_VP_ASSIST_PAGE in
      hv_cpu_init(). Note, checking 'if (!*hvp)', for root partition is
      pointless as hv_cpu_die() always sets 'hv_vp_assist_page[cpu]' to
      NULL (and it's also NULL initially).
      
      Note: the fact that 'hv_vp_assist_page[cpu]' is reset to NULL may
      present a (potential) issue for KVM. While Hyper-V uses
      CPUHP_AP_ONLINE_DYN stage in CPU hotplug, KVM uses CPUHP_AP_KVM_STARTING
      which comes earlier in CPU teardown sequence. It is theoretically
      possible that Enlightened VMCS is still in use. It is unclear if the
      issue is real and if using KVM with Hyper-V root partition is even
      possible.
      
      While on it, drop the unneeded smp_processor_id() call from hv_cpu_init().
      
      Fixes: e5d9b714 ("x86/hyperv: fix root partition faults when writing to VP assist page MSR")
      Signed-off-by: default avatarVitaly Kuznetsov <vkuznets@redhat.com>
      Reviewed-by: default avatarMichael Kelley <mikelley@microsoft.com>
      Link: https://lore.kernel.org/r/20221103190601.399343-1-vkuznets@redhat.comSigned-off-by: default avatarWei Liu <wei.liu@kernel.org>
      ee681541
  2. 03 Nov, 2022 4 commits
  3. 27 Oct, 2022 2 commits
  4. 23 Oct, 2022 9 commits
  5. 22 Oct, 2022 21 commits
  6. 21 Oct, 2022 3 commits