1. 10 11月, 2017 2 次提交
  2. 13 9月, 2017 1 次提交
  3. 29 8月, 2017 1 次提交
  4. 11 8月, 2017 1 次提交
    • V
      x86/hyper-v: Use hypercall for remote TLB flush · 2ffd9e33
      Vitaly Kuznetsov 提交于
      Hyper-V host can suggest us to use hypercall for doing remote TLB flush,
      this is supposed to work faster than IPIs.
      
      Implementation details: to do HvFlushVirtualAddress{Space,List} hypercalls
      we need to put the input somewhere in memory and we don't really want to
      have memory allocation on each call so we pre-allocate per cpu memory areas
      on boot.
      
      pv_ops patching is happening very early so we need to separate
      hyperv_setup_mmu_ops() and hyper_alloc_mmu().
      
      It is possible and easy to implement local TLB flushing too and there is
      even a hint for that. However, I don't see a room for optimization on the
      host side as both hypercall and native tlb flush will result in vmexit. The
      hint is also not set on modern Hyper-V versions.
      Signed-off-by: NVitaly Kuznetsov <vkuznets@redhat.com>
      Reviewed-by: NAndy Shevchenko <andy.shevchenko@gmail.com>
      Reviewed-by: NStephen Hemminger <sthemmin@microsoft.com>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Haiyang Zhang <haiyangz@microsoft.com>
      Cc: Jork Loeser <Jork.Loeser@microsoft.com>
      Cc: K. Y. Srinivasan <kys@microsoft.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Simon Xiao <sixiao@microsoft.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: devel@linuxdriverproject.org
      Link: http://lkml.kernel.org/r/20170802160921.21791-8-vkuznets@redhat.comSigned-off-by: NIngo Molnar <mingo@kernel.org>
      2ffd9e33
  5. 17 7月, 2017 1 次提交
  6. 22 6月, 2017 2 次提交
  7. 09 4月, 2017 1 次提交
  8. 20 1月, 2017 2 次提交
  9. 19 1月, 2017 1 次提交
  10. 25 12月, 2016 1 次提交
  11. 20 12月, 2016 1 次提交
    • V
      x86/hyperv: Handle unknown NMIs on one CPU when unknown_nmi_panic · 59107e2f
      Vitaly Kuznetsov 提交于
      There is a feature in Hyper-V ('Debug-VM --InjectNonMaskableInterrupt')
      which injects NMI to the guest. We may want to crash the guest and do kdump
      on this NMI by enabling unknown_nmi_panic. To make kdump succeed we need to
      allow the kdump kernel to re-establish VMBus connection so it will see
      VMBus devices (storage, network,..).
      
      To properly unload VMBus making it possible to start over during kdump we
      need to do the following:
      
       - Send an 'unload' message to the hypervisor. This can be done on any CPU
         so we do this the crashing CPU.
      
       - Receive the 'unload finished' reply message. WS2012R2 delivers this
         message to the CPU which was used to establish VMBus connection during
         module load and this CPU may differ from the CPU sending 'unload'.
      
      Receiving a VMBus message means the following:
      
       - There is a per-CPU slot in memory for one message. This slot can in
         theory be accessed by any CPU.
      
       - We get an interrupt on the CPU when a message was placed into the slot.
      
       - When we read the message we need to clear the slot and signal the fact
         to the hypervisor. In case there are more messages to this CPU pending
         the hypervisor will deliver the next message. The signaling is done by
         writing to an MSR so this can only be done on the appropriate CPU.
      
      To avoid doing cross-CPU work on crash we have vmbus_wait_for_unload()
      function which checks message slots for all CPUs in a loop waiting for the
      'unload finished' messages. However, there is an issue which arises when
      these conditions are met:
      
       - We're crashing on a CPU which is different from the one which was used
         to initially contact the hypervisor.
      
       - The CPU which was used for the initial contact is blocked with interrupts
         disabled and there is a message pending in the message slot.
      
      In this case we won't be able to read the 'unload finished' message on the
      crashing CPU. This is reproducible when we receive unknown NMIs on all CPUs
      simultaneously: the first CPU entering panic() will proceed to crash and
      all other CPUs will stop themselves with interrupts disabled.
      
      The suggested solution is to handle unknown NMIs for Hyper-V guests on the
      first CPU which gets them only. This will allow us to rely on VMBus
      interrupt handler being able to receive the 'unload finish' message in
      case it is delivered to a different CPU.
      
      The issue is not reproducible on WS2016 as Debug-VM delivers NMI to the
      boot CPU only, WS2012R2 and earlier Hyper-V versions are affected.
      Signed-off-by: NVitaly Kuznetsov <vkuznets@redhat.com>
      Acked-by: NK. Y. Srinivasan <kys@microsoft.com>
      Cc: devel@linuxdriverproject.org
      Cc: Haiyang Zhang <haiyangz@microsoft.com>
      Link: http://lkml.kernel.org/r/20161202100720.28121-1-vkuznets@redhat.comSigned-off-by: NThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NIngo Molnar <mingo@kernel.org>
      59107e2f
  12. 10 12月, 2016 1 次提交
  13. 14 7月, 2016 1 次提交
    • P
      x86/kernel: Audit and remove any unnecessary uses of module.h · 186f4360
      Paul Gortmaker 提交于
      Historically a lot of these existed because we did not have
      a distinction between what was modular code and what was providing
      support to modules via EXPORT_SYMBOL and friends.  That changed
      when we forked out support for the latter into the export.h file.
      
      This means we should be able to reduce the usage of module.h
      in code that is obj-y Makefile or bool Kconfig.  The advantage
      in doing so is that module.h itself sources about 15 other headers;
      adding significantly to what we feed cpp, and it can obscure what
      headers we are effectively using.
      
      Since module.h was the source for init.h (for __init) and for
      export.h (for EXPORT_SYMBOL) we consider each obj-y/bool instance
      for the presence of either and replace as needed.  Build testing
      revealed some implicit header usage that was fixed up accordingly.
      
      Note that some bool/obj-y instances remain since module.h is
      the header for some exception table entry stuff, and for things
      like __init_or_module (code that is tossed when MODULES=n).
      Signed-off-by: NPaul Gortmaker <paul.gortmaker@windriver.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/20160714001901.31603-4-paul.gortmaker@windriver.comSigned-off-by: NIngo Molnar <mingo@kernel.org>
      186f4360
  14. 16 4月, 2016 1 次提交
    • V
      x86/hyperv: Avoid reporting bogus NMI status for Gen2 instances · 1e2ae9ec
      Vitaly Kuznetsov 提交于
      Generation2 instances don't support reporting the NMI status on port 0x61,
      read from there returns 'ff' and we end up reporting nonsensical PCI
      error (as there is no PCI bus in these instances) on all NMIs:
      
          NMI: PCI system error (SERR) for reason ff on CPU 0.
          Dazed and confused, but trying to continue
      
      Fix the issue by overriding x86_platform.get_nmi_reason. Use 'booted on
      EFI' flag to detect Gen2 instances.
      Signed-off-by: NVitaly Kuznetsov <vkuznets@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Cathy Avery <cavery@redhat.com>
      Cc: Haiyang Zhang <haiyangz@microsoft.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: K. Y. Srinivasan <kys@microsoft.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: devel@linuxdriverproject.org
      Link: http://lkml.kernel.org/r/1460728232-31433-1-git-send-email-vkuznets@redhat.comSigned-off-by: NIngo Molnar <mingo@kernel.org>
      1e2ae9ec
  15. 03 2月, 2016 1 次提交
  16. 30 9月, 2015 1 次提交
  17. 21 8月, 2015 1 次提交
    • V
      x86/hyperv: Mark the Hyper-V TSC as unstable · 88c9281a
      Vitaly Kuznetsov 提交于
      The Hyper-V top-level functional specification states, that
      "algorithms should be resilient to sudden jumps forward or
      backward in the TSC value", this means that we should consider
      TSC as unstable. In some cases tsc tests are able to detect the
      instability, it was detected in 543 out of 646 boots in my
      testing:
      
       Measured 6277 cycles TSC warp between CPUs, turning off TSC clock.
       tsc: Marking TSC unstable due to check_tsc_sync_source failed
      
      This is, however, just a heuristic. On Hyper-V platform there
      are two good clocksources: MSR-based hyperv_clocksource and
      recently introduced TSC page.
      Signed-off-by: NVitaly Kuznetsov <vkuznets@redhat.com>
      Cc: Haiyang Zhang <haiyangz@microsoft.com>
      Cc: K. Y. Srinivasan <kys@microsoft.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: devel@linuxdriverproject.org
      Link: http://lkml.kernel.org/r/1440003264-9949-1-git-send-email-vkuznets@redhat.comSigned-off-by: NIngo Molnar <mingo@kernel.org>
      88c9281a
  18. 05 8月, 2015 3 次提交
  19. 15 5月, 2015 1 次提交
  20. 20 1月, 2015 1 次提交
  21. 15 4月, 2014 1 次提交
    • K
      x86, irq, pic: Probe for legacy PIC and set legacy_pic appropriately · e179f691
      K. Y. Srinivasan 提交于
      The legacy PIC may or may not be available and we need a mechanism to
      detect the existence of the legacy PIC that is applicable for all
      hardware (both physical as well as virtual) currently supported by
      Linux.
      
      On Hyper-V, when our legacy firmware presented to the guests, emulates
      the legacy PIC while when our EFI based firmware is presented we do
      not emulate the PIC. To support Hyper-V EFI firmware, we had to set
      the legacy_pic to the null_legacy_pic since we had to bypass PIC based
      calibration in the early boot code. While, on the EFI firmware, we
      know we don't emulate the legacy PIC, we need a generic mechanism to
      detect the presence of the legacy PIC that is not based on boot time
      state - this became apparent when we tried to get kexec to work on
      Hyper-V EFI firmware.
      
      This patch implements the proposal put forth by H. Peter Anvin
      <hpa@linux.intel.com>: Write a known value to the PIC data port and
      read it back. If the value read is the value written, we do have the
      PIC, if not there is no PIC and we can safely set the legacy_pic to
      null_legacy_pic. Since the read from an unconnected I/O port returns
      0xff, we will use ~(1 << PIC_CASCADE_IR) (0xfb: mask all lines except
      the cascade line) to probe for the existence of the PIC.
      
      In version V1 of the patch, I had cleaned up the code based on comments from Peter.
      In version V2 of the patch, I have addressed additional comments from Peter.
      In version V3 of the patch, I have addressed Jan's comments (JBeulich@suse.com).
      In version V4 of the patch, I have addressed additional comments from Peter.
      Signed-off-by: NK. Y. Srinivasan <kys@microsoft.com>
      Link: http://lkml.kernel.org/r/1397501029-29286-1-git-send-email-kys@microsoft.com
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NH. Peter Anvin <hpa@linux.intel.com>
      e179f691
  22. 28 3月, 2014 1 次提交
  23. 05 3月, 2014 4 次提交
  24. 07 11月, 2013 1 次提交
  25. 31 10月, 2013 1 次提交
  26. 11 10月, 2013 2 次提交
  27. 05 8月, 2013 1 次提交
    • J
      x86: Correctly detect hypervisor · 9df56f19
      Jason Wang 提交于
      We try to handle the hypervisor compatibility mode by detecting hypervisor
      through a specific order. This is not robust, since hypervisors may implement
      each others features.
      
      This patch tries to handle this situation by always choosing the last one in the
      CPUID leaves. This is done by letting .detect() return a priority instead of
      true/false and just re-using the CPUID leaf where the signature were found as
      the priority (or 1 if it was found by DMI). Then we can just pick hypervisor who
      has the highest priority. Other sophisticated detection method could also be
      implemented on top.
      
      Suggested by H. Peter Anvin and Paolo Bonzini.
      Acked-by: NK. Y. Srinivasan <kys@microsoft.com>
      Cc: Haiyang Zhang <haiyangz@microsoft.com>
      Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Cc: Jeremy Fitzhardinge <jeremy@goop.org>
      Cc: Doug Covelli <dcovelli@vmware.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: Dan Hecht <dhecht@vmware.com>
      Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
      Cc: Marcelo Tosatti <mtosatti@redhat.com>
      Cc: Gleb Natapov <gleb@redhat.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Signed-off-by: NJason Wang <jasowang@redhat.com>
      Link: http://lkml.kernel.org/r/1374742475-2485-4-git-send-email-jasowang@redhat.comSigned-off-by: NH. Peter Anvin <hpa@linux.intel.com>
      9df56f19
  28. 18 4月, 2013 1 次提交
  29. 13 2月, 2013 3 次提交