Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1649547

[PATCH v4 06/10] x86/hyper-v: implement rep hypercalls

From Vitaly Kuznetsov <vkuznets@redhat.com>
Newsgroups linux.kernel
Subject [PATCH v4 06/10] x86/hyper-v: implement rep hypercalls
Date 2017-05-24 14:10 +0200
Message-ID <tKDh0-2cD-13@gated-at.bofh.it> (permalink)
References <tKDh0-2cD-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Rep hypercalls are normal hypercalls which perform multiple actions at
once. Hyper-V guarantees to return exectution to the caller in not more
than 50us and the caller needs to use hypercall continuation. Touch NMI
watchdog between hypercall invocations.

This is going to be used for HvFlushVirtualAddressList hypercall for
remote TLB flushing.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Acked-by: K. Y. Srinivasan <kys@microsoft.com>
Tested-by: Simon Xiao <sixiao@microsoft.com>
Tested-by: Srikanth Myakam <v-srm@microsoft.com>
---
 arch/x86/include/asm/mshyperv.h | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/arch/x86/include/asm/mshyperv.h b/arch/x86/include/asm/mshyperv.h
index 52b3611..e0b4c70 100644
--- a/arch/x86/include/asm/mshyperv.h
+++ b/arch/x86/include/asm/mshyperv.h
@@ -4,6 +4,7 @@
 #include <linux/types.h>
 #include <linux/interrupt.h>
 #include <linux/clocksource.h>
+#include <linux/nmi.h>
 #include <asm/hyperv.h>
 
 /*
@@ -258,6 +259,31 @@ static inline u64 hv_do_fast_hypercall8(u16 code, u64 input1)
 #endif
 }
 
+/*
+ * Rep hypercalls. Callers of this functions are supposed to ensure that
+ * rep_count and vahead_size comply with union hv_hypercall_input definition.
+ */
+static inline u64 hv_do_rep_hypercall(u16 code, u16 rep_count, u16 varhead_size,
+				      void *input, void *output)
+{
+	union hv_hypercall_input hc_input = { .code = code,
+					      .varhead_size = varhead_size,
+					      .rep_count = rep_count};
+	u64 status;
+
+	do {
+		status = hv_do_hypercall(hc_input.as_uint64, input, output);
+		if ((status & 0xffff) != HV_STATUS_SUCCESS)
+			return status;
+
+		hc_input.rep_start = (status >> 32) & 0xfff;
+
+		touch_nmi_watchdog();
+	} while (hc_input.rep_start < hc_input.rep_count);
+
+	return status;
+}
+
 void hyperv_init(void);
 void hyperv_report_panic(struct pt_regs *regs);
 bool hv_is_hypercall_page_setup(void);
-- 
2.9.4

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v4 00/10] Hyper-V: praravirtualized remote TLB flushing and hypercall improvements Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-05-24 14:10 +0200
  [PATCH v4 06/10] x86/hyper-v: implement rep hypercalls Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-05-24 14:10 +0200
  [PATCH v4 09/10] x86/hyper-v: support extended CPU ranges for TLB flush hypercalls Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-05-24 14:10 +0200
    Re: [PATCH v4 09/10] x86/hyper-v: support extended CPU ranges for TLB  flush hypercalls Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-05-27 20:20 +0200
  [PATCH v4 01/10] x86/hyper-v: include hyperv/ only when CONFIG_HYPERV is set Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-05-24 14:10 +0200
  [PATCH v4 03/10] x86/hyper-v: make hv_do_hypercall() inline Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-05-24 14:10 +0200
    Re: [PATCH v4 03/10] x86/hyper-v: make hv_do_hypercall() inline Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-05-27 19:50 +0200
  [PATCH v4 04/10] x86/hyper-v: fast hypercall implementation Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-05-24 14:10 +0200
    Re: [PATCH v4 04/10] x86/hyper-v: fast hypercall implementation Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-05-27 19:50 +0200
  [PATCH v4 08/10] x86/hyper-v: use hypercall for remote TLB flush Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-05-24 14:10 +0200
  [PATCH v4 05/10] hyper-v: use fast hypercall for HVCALL_SIGNAL_EVENT Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-05-24 14:10 +0200
    Re: [PATCH v4 05/10] hyper-v: use fast hypercall for HVCALL_SIGNAL_EVENT Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-05-27 20:00 +0200
  [PATCH v4 02/10] x86/hyper-v: stash the max number of virtual/logical processor Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-05-24 14:10 +0200
    Re: [PATCH v4 02/10] x86/hyper-v: stash the max number of  virtual/logical processor Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-05-27 19:50 +0200
      Re: [PATCH v4 02/10] x86/hyper-v: stash the max number of  virtual/logical processor Steven Rostedt <rostedt@goodmis.org> - 2017-06-05 17:30 +0200
        Re: [PATCH v4 02/10] x86/hyper-v: stash the max number of  virtual/logical processor Stephen Hemminger <stephen@networkplumber.org> - 2017-06-05 17:40 +0200
  [PATCH v4 10/10] tracing/hyper-v: trace hyperv_mmu_flush_tlb_others() Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-05-24 14:10 +0200
    Re: [PATCH v4 10/10] tracing/hyper-v: trace  hyperv_mmu_flush_tlb_others() Steven Rostedt <rostedt@goodmis.org> - 2017-06-05 18:00 +0200
      Re: [PATCH v4 10/10] tracing/hyper-v: trace hyperv_mmu_flush_tlb_others() Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-06-05 18:20 +0200
        Re: [PATCH v4 10/10] tracing/hyper-v: trace  hyperv_mmu_flush_tlb_others() Steven Rostedt <rostedt@goodmis.org> - 2017-06-07 16:00 +0200
          Re: [PATCH v4 10/10] tracing/hyper-v: trace hyperv_mmu_flush_tlb_others() Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-06-07 16:10 +0200

csiph-web