* [PATCH] clocksource/drivers/hyper-v: Re-enable VDSO_CLOCKMODE_HVCLOCK on X86 @ 2021-05-12 8:46 Vitaly Kuznetsov 2021-05-12 16:03 ` Michael Kelley 2021-05-12 20:27 ` Thomas Gleixner 0 siblings, 2 replies; 4+ messages in thread From: Vitaly Kuznetsov @ 2021-05-12 8:46 UTC (permalink / raw) To: linux-hyperv Cc: Daniel Lezcano, Michael Kelley, Mohammed Gamal, Wei Liu, K. Y. Srinivasan, Haiyang Zhang, Dexuan Cui, Stephen Hemminger, linux-kernel Mohammed reports (https://bugzilla.kernel.org/show_bug.cgi?id=213029) the commit e4ab4658f1cf ("clocksource/drivers/hyper-v: Handle vDSO differences inline") broke vDSO on x86. The problem appears to be that VDSO_CLOCKMODE_HVCLOCK is an enum value in 'enum vdso_clock_mode' and '#ifdef VDSO_CLOCKMODE_HVCLOCK' branch evaluates to false (it is not a define). Replace it with CONFIG_X86 as it is the only arch which has this mode currently. Reported-by: Mohammed Gamal <mgamal@redhat.com> Fixes: e4ab4658f1cf ("clocksource/drivers/hyper-v: Handle vDSO differences inline") Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com> --- drivers/clocksource/hyperv_timer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/clocksource/hyperv_timer.c b/drivers/clocksource/hyperv_timer.c index 977fd05ac35f..e17421f5e47d 100644 --- a/drivers/clocksource/hyperv_timer.c +++ b/drivers/clocksource/hyperv_timer.c @@ -419,7 +419,7 @@ static void resume_hv_clock_tsc(struct clocksource *arg) hv_set_register(HV_REGISTER_REFERENCE_TSC, tsc_msr); } -#ifdef VDSO_CLOCKMODE_HVCLOCK +#ifdef CONFIG_X86 static int hv_cs_enable(struct clocksource *cs) { vclocks_set_used(VDSO_CLOCKMODE_HVCLOCK); @@ -435,7 +435,7 @@ static struct clocksource hyperv_cs_tsc = { .flags = CLOCK_SOURCE_IS_CONTINUOUS, .suspend= suspend_hv_clock_tsc, .resume = resume_hv_clock_tsc, -#ifdef VDSO_CLOCKMODE_HVCLOCK +#ifdef CONFIG_X86 .enable = hv_cs_enable, .vdso_clock_mode = VDSO_CLOCKMODE_HVCLOCK, #else -- 2.31.1 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* RE: [PATCH] clocksource/drivers/hyper-v: Re-enable VDSO_CLOCKMODE_HVCLOCK on X86 2021-05-12 8:46 [PATCH] clocksource/drivers/hyper-v: Re-enable VDSO_CLOCKMODE_HVCLOCK on X86 Vitaly Kuznetsov @ 2021-05-12 16:03 ` Michael Kelley 2021-05-12 20:27 ` Thomas Gleixner 1 sibling, 0 replies; 4+ messages in thread From: Michael Kelley @ 2021-05-12 16:03 UTC (permalink / raw) To: vkuznets, linux-hyperv Cc: Daniel Lezcano, Mohammed Gamal, Wei Liu, KY Srinivasan, Haiyang Zhang, Dexuan Cui, Stephen Hemminger, linux-kernel From: Vitaly Kuznetsov <vkuznets@redhat.com> Sent: Wednesday, May 12, 2021 1:47 AM > > Mohammed reports (https://bugzilla.kernel.org/show_bug.cgi?id=213029) > the commit e4ab4658f1cf ("clocksource/drivers/hyper-v: Handle vDSO > differences inline") broke vDSO on x86. The problem appears to be that > VDSO_CLOCKMODE_HVCLOCK is an enum value in 'enum vdso_clock_mode' and > '#ifdef VDSO_CLOCKMODE_HVCLOCK' branch evaluates to false (it is not > a define). Replace it with CONFIG_X86 as it is the only arch which > has this mode currently. > > Reported-by: Mohammed Gamal <mgamal@redhat.com> > Fixes: e4ab4658f1cf ("clocksource/drivers/hyper-v: Handle vDSO differences inline") > Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com> > --- > drivers/clocksource/hyperv_timer.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/clocksource/hyperv_timer.c b/drivers/clocksource/hyperv_timer.c > index 977fd05ac35f..e17421f5e47d 100644 > --- a/drivers/clocksource/hyperv_timer.c > +++ b/drivers/clocksource/hyperv_timer.c > @@ -419,7 +419,7 @@ static void resume_hv_clock_tsc(struct clocksource *arg) > hv_set_register(HV_REGISTER_REFERENCE_TSC, tsc_msr); > } > > -#ifdef VDSO_CLOCKMODE_HVCLOCK > +#ifdef CONFIG_X86 > static int hv_cs_enable(struct clocksource *cs) > { > vclocks_set_used(VDSO_CLOCKMODE_HVCLOCK); > @@ -435,7 +435,7 @@ static struct clocksource hyperv_cs_tsc = { > .flags = CLOCK_SOURCE_IS_CONTINUOUS, > .suspend= suspend_hv_clock_tsc, > .resume = resume_hv_clock_tsc, > -#ifdef VDSO_CLOCKMODE_HVCLOCK > +#ifdef CONFIG_X86 > .enable = hv_cs_enable, > .vdso_clock_mode = VDSO_CLOCKMODE_HVCLOCK, > #else > -- > 2.31.1 Well, bummer. I thought I was being so clever. I hate having to base the behavior directly on the architecture instead of the actual VDSO feature, but I don't see a way to detect whether VDSO_CLOCKMODE_HVCLOCK is defined or not. The other alternative would be to add another #define such as VDSO_CLOCKMODE_HVCLOCK_PRESENT in arch/x86/include/asm/vdso/clocksource.h, and use it in the #ifdefs here. But that's a bit messy too, and I'm not sure it's worth the trouble. So, Reviewed-by: Michael Kelley <mikelley@microsoft.com> Mohammed -- Thanks for finding this! ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] clocksource/drivers/hyper-v: Re-enable VDSO_CLOCKMODE_HVCLOCK on X86 2021-05-12 8:46 [PATCH] clocksource/drivers/hyper-v: Re-enable VDSO_CLOCKMODE_HVCLOCK on X86 Vitaly Kuznetsov 2021-05-12 16:03 ` Michael Kelley @ 2021-05-12 20:27 ` Thomas Gleixner 2021-05-13 7:18 ` Vitaly Kuznetsov 1 sibling, 1 reply; 4+ messages in thread From: Thomas Gleixner @ 2021-05-12 20:27 UTC (permalink / raw) To: Vitaly Kuznetsov, linux-hyperv Cc: Daniel Lezcano, Michael Kelley, Mohammed Gamal, Wei Liu, K. Y. Srinivasan, Haiyang Zhang, Dexuan Cui, Stephen Hemminger, linux-kernel On Wed, May 12 2021 at 10:46, Vitaly Kuznetsov wrote: > Mohammed reports (https://bugzilla.kernel.org/show_bug.cgi?id=213029) > the commit e4ab4658f1cf ("clocksource/drivers/hyper-v: Handle vDSO > differences inline") broke vDSO on x86. The problem appears to be that > VDSO_CLOCKMODE_HVCLOCK is an enum value in 'enum vdso_clock_mode' and > '#ifdef VDSO_CLOCKMODE_HVCLOCK' branch evaluates to false (it is not > a define). Replace it with CONFIG_X86 as it is the only arch which > has this mode currently. > > Reported-by: Mohammed Gamal <mgamal@redhat.com> > Fixes: e4ab4658f1cf ("clocksource/drivers/hyper-v: Handle vDSO differences inline") > Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com> > --- > drivers/clocksource/hyperv_timer.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/clocksource/hyperv_timer.c b/drivers/clocksource/hyperv_timer.c > index 977fd05ac35f..e17421f5e47d 100644 > --- a/drivers/clocksource/hyperv_timer.c > +++ b/drivers/clocksource/hyperv_timer.c > @@ -419,7 +419,7 @@ static void resume_hv_clock_tsc(struct clocksource *arg) > hv_set_register(HV_REGISTER_REFERENCE_TSC, tsc_msr); > } > > -#ifdef VDSO_CLOCKMODE_HVCLOCK > +#ifdef CONFIG_X86 > static int hv_cs_enable(struct clocksource *cs) > { > vclocks_set_used(VDSO_CLOCKMODE_HVCLOCK); > @@ -435,7 +435,7 @@ static struct clocksource hyperv_cs_tsc = { > .flags = CLOCK_SOURCE_IS_CONTINUOUS, > .suspend= suspend_hv_clock_tsc, > .resume = resume_hv_clock_tsc, > -#ifdef VDSO_CLOCKMODE_HVCLOCK > +#ifdef CONFIG_X86 > .enable = hv_cs_enable, > .vdso_clock_mode = VDSO_CLOCKMODE_HVCLOCK, > #else That's lame as it needs to be patched differently once ARM64 gains support. What about the below? Thanks, tglx --- --- a/arch/x86/include/asm/vdso/clocksource.h +++ b/arch/x86/include/asm/vdso/clocksource.h @@ -7,4 +7,6 @@ VDSO_CLOCKMODE_PVCLOCK, \ VDSO_CLOCKMODE_HVCLOCK +#define HAVE_VDSO_CLOCKMODE_HVCLOCK + #endif /* __ASM_VDSO_CLOCKSOURCE_H */ --- a/drivers/clocksource/hyperv_timer.c +++ b/drivers/clocksource/hyperv_timer.c @@ -419,7 +419,7 @@ static void resume_hv_clock_tsc(struct c hv_set_register(HV_REGISTER_REFERENCE_TSC, tsc_msr); } -#ifdef VDSO_CLOCKMODE_HVCLOCK +#ifdef HAVE_VDSO_CLOCKMODE_HVCLOCK static int hv_cs_enable(struct clocksource *cs) { vclocks_set_used(VDSO_CLOCKMODE_HVCLOCK); @@ -435,7 +435,7 @@ static struct clocksource hyperv_cs_tsc .flags = CLOCK_SOURCE_IS_CONTINUOUS, .suspend= suspend_hv_clock_tsc, .resume = resume_hv_clock_tsc, -#ifdef VDSO_CLOCKMODE_HVCLOCK +#ifdef HAVE_VDSO_CLOCKMODE_HVCLOCK .enable = hv_cs_enable, .vdso_clock_mode = VDSO_CLOCKMODE_HVCLOCK, #else ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] clocksource/drivers/hyper-v: Re-enable VDSO_CLOCKMODE_HVCLOCK on X86 2021-05-12 20:27 ` Thomas Gleixner @ 2021-05-13 7:18 ` Vitaly Kuznetsov 0 siblings, 0 replies; 4+ messages in thread From: Vitaly Kuznetsov @ 2021-05-13 7:18 UTC (permalink / raw) To: Thomas Gleixner, linux-hyperv Cc: Daniel Lezcano, Michael Kelley, Mohammed Gamal, Wei Liu, K. Y. Srinivasan, Haiyang Zhang, Dexuan Cui, Stephen Hemminger, linux-kernel Thomas Gleixner <tglx@linutronix.de> writes: > On Wed, May 12 2021 at 10:46, Vitaly Kuznetsov wrote: >> Mohammed reports (https://bugzilla.kernel.org/show_bug.cgi?id=213029) >> the commit e4ab4658f1cf ("clocksource/drivers/hyper-v: Handle vDSO >> differences inline") broke vDSO on x86. The problem appears to be that >> VDSO_CLOCKMODE_HVCLOCK is an enum value in 'enum vdso_clock_mode' and >> '#ifdef VDSO_CLOCKMODE_HVCLOCK' branch evaluates to false (it is not >> a define). Replace it with CONFIG_X86 as it is the only arch which >> has this mode currently. >> >> Reported-by: Mohammed Gamal <mgamal@redhat.com> >> Fixes: e4ab4658f1cf ("clocksource/drivers/hyper-v: Handle vDSO differences inline") >> Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com> >> --- >> drivers/clocksource/hyperv_timer.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/clocksource/hyperv_timer.c b/drivers/clocksource/hyperv_timer.c >> index 977fd05ac35f..e17421f5e47d 100644 >> --- a/drivers/clocksource/hyperv_timer.c >> +++ b/drivers/clocksource/hyperv_timer.c >> @@ -419,7 +419,7 @@ static void resume_hv_clock_tsc(struct clocksource *arg) >> hv_set_register(HV_REGISTER_REFERENCE_TSC, tsc_msr); >> } >> >> -#ifdef VDSO_CLOCKMODE_HVCLOCK >> +#ifdef CONFIG_X86 >> static int hv_cs_enable(struct clocksource *cs) >> { >> vclocks_set_used(VDSO_CLOCKMODE_HVCLOCK); >> @@ -435,7 +435,7 @@ static struct clocksource hyperv_cs_tsc = { >> .flags = CLOCK_SOURCE_IS_CONTINUOUS, >> .suspend= suspend_hv_clock_tsc, >> .resume = resume_hv_clock_tsc, >> -#ifdef VDSO_CLOCKMODE_HVCLOCK >> +#ifdef CONFIG_X86 >> .enable = hv_cs_enable, >> .vdso_clock_mode = VDSO_CLOCKMODE_HVCLOCK, >> #else > > That's lame as it needs to be patched differently once ARM64 gains > support. What about the below? > The solution I liked the most was Michael's: no need to do anything except for adding VDSO_CLOCKMODE_HVCLOCK to the enum. Too bad it didn't work) You proposal seems to be slightly better than mine: when adding VDSO_CLOCKMODE_HVCLOCK to ARM the change will be limited to drivers/clocksource/hyperv_timer.c will stay intact. I'll send v2 shortly, thanks! > Thanks, > > tglx > --- > --- a/arch/x86/include/asm/vdso/clocksource.h > +++ b/arch/x86/include/asm/vdso/clocksource.h > @@ -7,4 +7,6 @@ > VDSO_CLOCKMODE_PVCLOCK, \ > VDSO_CLOCKMODE_HVCLOCK > > +#define HAVE_VDSO_CLOCKMODE_HVCLOCK > + > #endif /* __ASM_VDSO_CLOCKSOURCE_H */ > --- a/drivers/clocksource/hyperv_timer.c > +++ b/drivers/clocksource/hyperv_timer.c > @@ -419,7 +419,7 @@ static void resume_hv_clock_tsc(struct c > hv_set_register(HV_REGISTER_REFERENCE_TSC, tsc_msr); > } > > -#ifdef VDSO_CLOCKMODE_HVCLOCK > +#ifdef HAVE_VDSO_CLOCKMODE_HVCLOCK > static int hv_cs_enable(struct clocksource *cs) > { > vclocks_set_used(VDSO_CLOCKMODE_HVCLOCK); > @@ -435,7 +435,7 @@ static struct clocksource hyperv_cs_tsc > .flags = CLOCK_SOURCE_IS_CONTINUOUS, > .suspend= suspend_hv_clock_tsc, > .resume = resume_hv_clock_tsc, > -#ifdef VDSO_CLOCKMODE_HVCLOCK > +#ifdef HAVE_VDSO_CLOCKMODE_HVCLOCK > .enable = hv_cs_enable, > .vdso_clock_mode = VDSO_CLOCKMODE_HVCLOCK, > #else > -- Vitaly ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-05-13 7:18 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-05-12 8:46 [PATCH] clocksource/drivers/hyper-v: Re-enable VDSO_CLOCKMODE_HVCLOCK on X86 Vitaly Kuznetsov 2021-05-12 16:03 ` Michael Kelley 2021-05-12 20:27 ` Thomas Gleixner 2021-05-13 7:18 ` Vitaly Kuznetsov
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).