Skip to contentSkip to conversation

x86/Hyper-V: Fix build error with CONFIG_HYPERV_TSCPAGE=N

PATCH In review [email protected] 4 participants 7 messages Aug 22, 2019 – Aug 26, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/Hyper-V: Fix build error with CONFIG_HYPERV_TSCPAGE=N

From: Tianyu Lan <[email protected]>

Both Hyper-V tsc page and Hyper-V tsc MSR code use variable hv_sched_clock_offset for their sched clock callback and so define the variable regardless of CONFIG_HYPERV_TSCPAGE setting.

---
This patch is based on the top of "git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers/core".

 drivers/clocksource/hyperv_timer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clocksource/hyperv_timer.c +1 -1
index dad8af198e20..c322ab4d3689 100644
@@ -22,6 +22,7 @@
 #include <asm/mshyperv.h>
 
 static struct clock_event_device __percpu *hv_clock_event;
+static u64 hv_sched_clock_offset __ro_after_init;
 
 /*
  * If false, we're using the old mechanism for stimer0 interrupts
@@ -215,7 +216,6 @@ EXPORT_SYMBOL_GPL(hyperv_cs);
 #ifdef CONFIG_HYPERV_TSCPAGE
 
 static struct ms_hyperv_tsc_page tsc_pg __aligned(PAGE_SIZE);
-static u64 hv_sched_clock_offset __ro_after_init;
 
 struct ms_hyperv_tsc_page *hv_get_tsc_page(void)
 {
Signature · 1 line
2.14.5
#1 lore raw
Quoted 5 lines · [email protected] writes:

From: Tianyu Lan <[email protected]>

Both Hyper-V tsc page and Hyper-V tsc MSR code use variable hv_sched_clock_offset for their sched clock callback and so define the variable regardless of CONFIG_HYPERV_TSCPAGE setting.

CONFIG_HYPERV_TSCPAGE is gone after my "x86/hyper-v: enable TSC page clocksource on 32bit" patch. Do we still have an issue to fix?

Quoted 29 lines

---
This patch is based on the top of "git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers/core".

 drivers/clocksource/hyperv_timer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clocksource/hyperv_timer.c +1 -1
index dad8af198e20..c322ab4d3689 100644
@@ -22,6 +22,7 @@
 #include <asm/mshyperv.h>
 
 static struct clock_event_device __percpu *hv_clock_event;
+static u64 hv_sched_clock_offset __ro_after_init;
 
 /*
  * If false, we're using the old mechanism for stimer0 interrupts
@@ -215,7 +216,6 @@ EXPORT_SYMBOL_GPL(hyperv_cs);
 #ifdef CONFIG_HYPERV_TSCPAGE
 
 static struct ms_hyperv_tsc_page tsc_pg __aligned(PAGE_SIZE);
-static u64 hv_sched_clock_offset __ro_after_init;
 
 struct ms_hyperv_tsc_page *hv_get_tsc_page(void)
 {
Signature · 1 line
Vitaly
author
#2 lore raw
Quoted 12 lines · Vitaly Kuznetsov
Quoted 5 lines · [email protected] writes:

From: Tianyu Lan <[email protected]>

Both Hyper-V tsc page and Hyper-V tsc MSR code use variable hv_sched_clock_offset for their sched clock callback and so define the variable regardless of CONFIG_HYPERV_TSCPAGE setting.

CONFIG_HYPERV_TSCPAGE is gone after my "x86/hyper-v: enable TSC page clocksource on 32bit" patch. Do we still have an issue to fix?

Hi Vtialy:
Your patch also fixs the build issue. If it's not
necessary to have a dedicated patch
to fix the issue, please ignore it. Thanks.

Quoted 32 lines
Quoted 22 lines

---
This patch is based on the top of "git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers/core".

 drivers/clocksource/hyperv_timer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clocksource/hyperv_timer.c +1 -0
index dad8af198e20..c322ab4d3689 100644
@@ -22,6 +22,7 @@
 #include <asm/mshyperv.h>
 
 static struct clock_event_device __percpu *hv_clock_event;
+static u64 hv_sched_clock_offset __ro_after_init;
 
 /*
  * If false, we're using the old mechanism for stimer0 interrupts

drivers/clocksource/hyperv_timer.c EXPORT_SYMBOL_GPL(hyperv_cs); · line 221

Quoted 7 lines
drivers/clocksource/hyperv_timer.c +0 -1
@@ -215,7 +216,6 @@ EXPORT_SYMBOL_GPL(hyperv_cs);
 #ifdef CONFIG_HYPERV_TSCPAGE
 
 static struct ms_hyperv_tsc_page tsc_pg __aligned(PAGE_SIZE);
-static u64 hv_sched_clock_offset __ro_after_init;
 
 struct ms_hyperv_tsc_page *hv_get_tsc_page(void)
 {

--
Vitaly

Signature · 2 lines
Best regards
Tianyu Lan
#3 lore raw
In reply to Vitaly Kuznetsov
Quoted 10 lines · Vitaly Kuznetsov
Quoted 5 lines · [email protected] writes:

From: Tianyu Lan <[email protected]>

Both Hyper-V tsc page and Hyper-V tsc MSR code use variable hv_sched_clock_offset for their sched clock callback and so define the variable regardless of CONFIG_HYPERV_TSCPAGE setting.

CONFIG_HYPERV_TSCPAGE is gone after my "x86/hyper-v: enable TSC page clocksource on 32bit" patch. Do we still have an issue to fix?

Yes. Let's get it fixed on older kernels (as such we need to tag this one for stable). The 32bit TSC patch won't come in before 5.4 anyway.

Vitaly, does can you ack this patch? It might require you to re-spin your patch.

--
Thanks,
Sasha

author
#4 lore raw
Quoted 10 lines · Sasha Levin
Quoted 8 lines · Vitaly Kuznetsov
Quoted 5 lines · [email protected] writes:

From: Tianyu Lan <[email protected]>

Both Hyper-V tsc page and Hyper-V tsc MSR code use variable hv_sched_clock_offset for their sched clock callback and so define the variable regardless of CONFIG_HYPERV_TSCPAGE setting.

Quoted 9 lines
Quoted 2 lines

CONFIG_HYPERV_TSCPAGE is gone after my "x86/hyper-v: enable TSC page clocksource on 32bit" patch. Do we still have an issue to fix?

Yes. Let's get it fixed on older kernels (as such we need to tag this one for stable). The 32bit TSC patch won't come in before 5.4 anyway.

Vitaly, does can you ack this patch? It might require you to re-spin your patch.

Hi Sasha:
Thomas has foled this fix into original patch.
https://lkml.org/lkml/2019/8/23/600
--
Best regards
Tianyu Lan

#5 lore raw
In reply to Sasha Levin
Quoted 9 lines · Sasha Levin
Quoted 8 lines · Vitaly Kuznetsov
Quoted 5 lines · [email protected] writes:

From: Tianyu Lan <[email protected]>

Both Hyper-V tsc page and Hyper-V tsc MSR code use variable hv_sched_clock_offset for their sched clock callback and so define the variable regardless of CONFIG_HYPERV_TSCPAGE setting.

Quoted 9 lines
Quoted 2 lines

CONFIG_HYPERV_TSCPAGE is gone after my "x86/hyper-v: enable TSC page clocksource on 32bit" patch. Do we still have an issue to fix?

Yes. Let's get it fixed on older kernels (as such we need to tag this one for stable). The 32bit TSC patch won't come in before 5.4 anyway.

Vitaly, does can you ack this patch? It might require you to re-spin your patch.

Sure, no problem,

I, however, was under the impression the patch fixes the issue with the newly introduced sched clock:

commit b74e1d61dbc614ff35ef3ad9267c61ed06b09051

Author: Tianyu Lan <[email protected]>
Date:   Wed Aug 14 20:32:16 2019 +0800

clocksource/hyperv: Add Hyper-V specific sched clock function

(and Fixes: tag is missing)

and this is not in mainline as of v5.3-rc6. In tip/timers/core Thomas already picked my "clocksource/drivers/hyperv: Enable TSC page clocksource on 32bit" which also resolves the issue.

So my question is - which older/stable kernel do you have in mind?

Signature · 1 line
Vitaly
#6 lore raw
Quoted 32 lines · Vitaly Kuznetsov
Quoted 9 lines · Sasha Levin
Quoted 8 lines · Vitaly Kuznetsov
Quoted 5 lines · [email protected] writes:

From: Tianyu Lan <[email protected]>

Both Hyper-V tsc page and Hyper-V tsc MSR code use variable hv_sched_clock_offset for their sched clock callback and so define the variable regardless of CONFIG_HYPERV_TSCPAGE setting.

Quoted 9 lines
Quoted 2 lines

CONFIG_HYPERV_TSCPAGE is gone after my "x86/hyper-v: enable TSC page clocksource on 32bit" patch. Do we still have an issue to fix?

Yes. Let's get it fixed on older kernels (as such we need to tag this one for stable). The 32bit TSC patch won't come in before 5.4 anyway.

Vitaly, does can you ack this patch? It might require you to re-spin your patch.

Sure, no problem,

I, however, was under the impression the patch fixes the issue with the newly introduced sched clock:

commit b74e1d61dbc614ff35ef3ad9267c61ed06b09051

Author: Tianyu Lan <[email protected]>
Date:   Wed Aug 14 20:32:16 2019 +0800
Quoted 7 lines

clocksource/hyperv: Add Hyper-V specific sched clock function

(and Fixes: tag is missing)

and this is not in mainline as of v5.3-rc6. In tip/timers/core Thomas already picked my "clocksource/drivers/hyperv: Enable TSC page clocksource on 32bit" which also resolves the issue.

No. I folded Sashas fix into the original clocksource patch and then added yours on top.

Thanks,

tglx