linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] x86/hyperv: Make hv_setup_sched_clock inline
@ 2020-08-10  1:29 Michael Kelley
  2020-08-10  9:47 ` Wei Liu
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Michael Kelley @ 2020-08-10  1:29 UTC (permalink / raw)
  To: linux-kernel, tglx, peterz, kys, sthemmin, wei.liu, mingo, bp,
	x86, hpa, linux-hyperv
  Cc: mikelley

Make hv_setup_sched_clock inline so the reference to pv_ops works
correctly with objtool updates to detect noinstr violations.
See https://lore.kernel.org/patchwork/patch/1283635/

Signed-off-by: Michael Kelley <mikelley@microsoft.com>
---
 arch/x86/include/asm/mshyperv.h | 12 ++++++++++++
 arch/x86/kernel/cpu/mshyperv.c  |  7 -------
 include/asm-generic/mshyperv.h  |  1 -
 3 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/arch/x86/include/asm/mshyperv.h b/arch/x86/include/asm/mshyperv.h
index 60b944d..4f77b8f 100644
--- a/arch/x86/include/asm/mshyperv.h
+++ b/arch/x86/include/asm/mshyperv.h
@@ -8,6 +8,7 @@
 #include <asm/io.h>
 #include <asm/hyperv-tlfs.h>
 #include <asm/nospec-branch.h>
+#include <asm/paravirt.h>
 
 typedef int (*hyperv_fill_flush_list_func)(
 		struct hv_guest_mapping_flush_list *flush,
@@ -54,6 +55,17 @@ typedef int (*hyperv_fill_flush_list_func)(
 	vclocks_set_used(VDSO_CLOCKMODE_HVCLOCK);
 #define hv_get_raw_timer() rdtsc_ordered()
 
+/*
+ * Reference to pv_ops must be inline so objtool
+ * detection of noinstr violations can work correctly.
+ */
+static __always_inline void hv_setup_sched_clock(void *sched_clock)
+{
+#ifdef CONFIG_PARAVIRT
+	pv_ops.time.sched_clock = sched_clock;
+#endif
+}
+
 void hyperv_vector_handler(struct pt_regs *regs);
 
 static inline void hv_enable_stimer0_percpu_irq(int irq) {}
diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c
index af94f05..3112544 100644
--- a/arch/x86/kernel/cpu/mshyperv.c
+++ b/arch/x86/kernel/cpu/mshyperv.c
@@ -361,13 +361,6 @@ static void __init ms_hyperv_init_platform(void)
 #endif
 }
 
-void hv_setup_sched_clock(void *sched_clock)
-{
-#ifdef CONFIG_PARAVIRT
-	pv_ops.time.sched_clock = sched_clock;
-#endif
-}
-
 const __initconst struct hypervisor_x86 x86_hyper_ms_hyperv = {
 	.name			= "Microsoft Hyper-V",
 	.detect			= ms_hyperv_platform,
diff --git a/include/asm-generic/mshyperv.h b/include/asm-generic/mshyperv.h
index 1c4fd95..c5edc5e 100644
--- a/include/asm-generic/mshyperv.h
+++ b/include/asm-generic/mshyperv.h
@@ -168,7 +168,6 @@ static inline int cpumask_to_vpset(struct hv_vpset *vpset,
 bool hv_is_hyperv_initialized(void);
 bool hv_is_hibernation_supported(void);
 void hyperv_cleanup(void);
-void hv_setup_sched_clock(void *sched_clock);
 #else /* CONFIG_HYPERV */
 static inline bool hv_is_hyperv_initialized(void) { return false; }
 static inline bool hv_is_hibernation_supported(void) { return false; }
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] x86/hyperv: Make hv_setup_sched_clock inline
  2020-08-10  1:29 [PATCH 1/1] x86/hyperv: Make hv_setup_sched_clock inline Michael Kelley
@ 2020-08-10  9:47 ` Wei Liu
  2020-08-10 11:18 ` peterz
  2020-08-10 20:08 ` Thomas Gleixner
  2 siblings, 0 replies; 6+ messages in thread
From: Wei Liu @ 2020-08-10  9:47 UTC (permalink / raw)
  To: Michael Kelley
  Cc: linux-kernel, tglx, peterz, kys, sthemmin, wei.liu, mingo, bp,
	x86, hpa, linux-hyperv

On Sun, Aug 09, 2020 at 06:29:51PM -0700, Michael Kelley wrote:
> Make hv_setup_sched_clock inline so the reference to pv_ops works
> correctly with objtool updates to detect noinstr violations.
> See https://lore.kernel.org/patchwork/patch/1283635/
> 

I read the reference link. This change looks sensible.

I will wait a few days before queueing this up in case other people have
an opinion on this.

Wei.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] x86/hyperv: Make hv_setup_sched_clock inline
  2020-08-10  1:29 [PATCH 1/1] x86/hyperv: Make hv_setup_sched_clock inline Michael Kelley
  2020-08-10  9:47 ` Wei Liu
@ 2020-08-10 11:18 ` peterz
  2020-08-10 20:08 ` Thomas Gleixner
  2 siblings, 0 replies; 6+ messages in thread
From: peterz @ 2020-08-10 11:18 UTC (permalink / raw)
  To: Michael Kelley
  Cc: linux-kernel, tglx, kys, sthemmin, wei.liu, mingo, bp, x86, hpa,
	linux-hyperv

On Sun, Aug 09, 2020 at 06:29:51PM -0700, Michael Kelley wrote:
> Make hv_setup_sched_clock inline so the reference to pv_ops works
> correctly with objtool updates to detect noinstr violations.
> See https://lore.kernel.org/patchwork/patch/1283635/
> 
> Signed-off-by: Michael Kelley <mikelley@microsoft.com>

Thanks!

Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] x86/hyperv: Make hv_setup_sched_clock inline
  2020-08-10  1:29 [PATCH 1/1] x86/hyperv: Make hv_setup_sched_clock inline Michael Kelley
  2020-08-10  9:47 ` Wei Liu
  2020-08-10 11:18 ` peterz
@ 2020-08-10 20:08 ` Thomas Gleixner
  2020-08-11 10:57   ` Wei Liu
  2 siblings, 1 reply; 6+ messages in thread
From: Thomas Gleixner @ 2020-08-10 20:08 UTC (permalink / raw)
  To: Michael Kelley, linux-kernel, peterz, kys, sthemmin, wei.liu,
	mingo, bp, x86, hpa, linux-hyperv
  Cc: mikelley

Michael Kelley <mikelley@microsoft.com> writes:
> Make hv_setup_sched_clock inline so the reference to pv_ops works
> correctly with objtool updates to detect noinstr violations.
> See https://lore.kernel.org/patchwork/patch/1283635/
>
> Signed-off-by: Michael Kelley <mikelley@microsoft.com>

Acked-by: Thomas Gleixner <tglx@linutronix.de>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] x86/hyperv: Make hv_setup_sched_clock inline
  2020-08-10 20:08 ` Thomas Gleixner
@ 2020-08-11 10:57   ` Wei Liu
  2020-08-11 11:24     ` Thomas Gleixner
  0 siblings, 1 reply; 6+ messages in thread
From: Wei Liu @ 2020-08-11 10:57 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Michael Kelley, linux-kernel, peterz, kys, sthemmin, wei.liu,
	mingo, bp, x86, hpa, linux-hyperv

On Mon, Aug 10, 2020 at 10:08:41PM +0200, Thomas Gleixner wrote:
> Michael Kelley <mikelley@microsoft.com> writes:
> > Make hv_setup_sched_clock inline so the reference to pv_ops works
> > correctly with objtool updates to detect noinstr violations.
> > See https://lore.kernel.org/patchwork/patch/1283635/
> >
> > Signed-off-by: Michael Kelley <mikelley@microsoft.com>
> 
> Acked-by: Thomas Gleixner <tglx@linutronix.de>

Thomas and Peter, thank you for your acks.

I have applied to hyperv-fixes and plan to submit it to Linus in a few
days' time.

Thomas, let me know if you want this patch to go through the tip tree. I
will revert it from hyperv-fixes if that's the case.

Wei.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] x86/hyperv: Make hv_setup_sched_clock inline
  2020-08-11 10:57   ` Wei Liu
@ 2020-08-11 11:24     ` Thomas Gleixner
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Gleixner @ 2020-08-11 11:24 UTC (permalink / raw)
  To: Wei Liu
  Cc: Michael Kelley, linux-kernel, peterz, kys, sthemmin, wei.liu,
	mingo, bp, x86, hpa, linux-hyperv

Wei Liu <wei.liu@kernel.org> writes:

> On Mon, Aug 10, 2020 at 10:08:41PM +0200, Thomas Gleixner wrote:
>> Michael Kelley <mikelley@microsoft.com> writes:
>> > Make hv_setup_sched_clock inline so the reference to pv_ops works
>> > correctly with objtool updates to detect noinstr violations.
>> > See https://lore.kernel.org/patchwork/patch/1283635/
>> >
>> > Signed-off-by: Michael Kelley <mikelley@microsoft.com>
>> 
>> Acked-by: Thomas Gleixner <tglx@linutronix.de>
>
> Thomas and Peter, thank you for your acks.
>
> I have applied to hyperv-fixes and plan to submit it to Linus in a few
> days' time.
>
> Thomas, let me know if you want this patch to go through the tip tree. I
> will revert it from hyperv-fixes if that's the case.

I acked it so you can pick it up :)

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-08-11 11:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-10  1:29 [PATCH 1/1] x86/hyperv: Make hv_setup_sched_clock inline Michael Kelley
2020-08-10  9:47 ` Wei Liu
2020-08-10 11:18 ` peterz
2020-08-10 20:08 ` Thomas Gleixner
2020-08-11 10:57   ` Wei Liu
2020-08-11 11:24     ` Thomas Gleixner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).