2019-08-28 08:10:17

by Tianyu Lan

[permalink] [raw]
Subject: [PATCH] x86/Hyper-V: Fix reference of pv_ops with CONFIG_PARAVIRT=N

From: Tianyu Lan <[email protected]>

hv_setup_sched_clock() references pv_ops and this should
be under CONFIG_PARAVIRT=Y. Fix it.

Signed-off-by: Tianyu Lan <[email protected]>
---
This patch is based on git://git.kernel.org/pub/scm/linux/
kernel/git/tip/tip.git timers/core.

arch/x86/kernel/cpu/mshyperv.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c
index 53afd33990eb..267daad8c036 100644
--- a/arch/x86/kernel/cpu/mshyperv.c
+++ b/arch/x86/kernel/cpu/mshyperv.c
@@ -346,7 +346,9 @@ static void __init ms_hyperv_init_platform(void)

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 = {
--
2.14.5


Subject: [tip: timers/core] x86/hyperv: Hide pv_ops access for CONFIG_PARAVIRT=n

The following commit has been merged into the timers/core branch of tip:

Commit-ID: 41cfe2a2a7f4fad5647031ad3a1da166452b5437
Gitweb: https://git.kernel.org/tip/41cfe2a2a7f4fad5647031ad3a1da166452b5437
Author: Tianyu Lan <[email protected]>
AuthorDate: Wed, 28 Aug 2019 16:07:47 +08:00
Committer: Thomas Gleixner <[email protected]>
CommitterDate: Wed, 28 Aug 2019 12:25:06 +02:00

x86/hyperv: Hide pv_ops access for CONFIG_PARAVIRT=n

hv_setup_sched_clock() references pv_ops which is only available when
CONFIG_PARAVIRT=Y.

Wrap it into a #ifdef

Signed-off-by: Tianyu Lan <[email protected]>
Signed-off-by: Thomas Gleixner <[email protected]>
Link: https://lkml.kernel.org/r/[email protected]

---
arch/x86/kernel/cpu/mshyperv.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c
index 53afd33..267daad 100644
--- a/arch/x86/kernel/cpu/mshyperv.c
+++ b/arch/x86/kernel/cpu/mshyperv.c
@@ -346,7 +346,9 @@ static void __init ms_hyperv_init_platform(void)

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 = {

2019-09-02 15:32:25

by Wei Liu

[permalink] [raw]
Subject: Re: [PATCH] x86/Hyper-V: Fix reference of pv_ops with CONFIG_PARAVIRT=N

On Wed, Aug 28, 2019 at 04:07:47PM +0800, [email protected] wrote:
> From: Tianyu Lan <[email protected]>
>
> hv_setup_sched_clock() references pv_ops and this should
> be under CONFIG_PARAVIRT=Y. Fix it.
>
> Signed-off-by: Tianyu Lan <[email protected]>

Reviewed-by: Wei Liu <[email protected]>