From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4A583C43460 for ; Wed, 12 May 2021 20:46:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 372C161221 for ; Wed, 12 May 2021 20:46:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1388103AbhELUmK (ORCPT ); Wed, 12 May 2021 16:42:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1387260AbhELUd3 (ORCPT ); Wed, 12 May 2021 16:33:29 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8359C061345; Wed, 12 May 2021 13:29:32 -0700 (PDT) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1620851248; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=T8VGM7T2ebwxRKCm5/uITXAy1lYGXfvGxWTRjsElJlo=; b=tolPteYN+1BOe/u6A1hk+xYj0vM7JQBAx1QnrNmuv4xyd1EGQv/70l3ul3vocp9hyYA1zs WklamftkByCa5+e7/tOTgSQYo6JpeMsrWboXpiNtkpsyGy1U+qR773gqBbZ5tD+JNnbCD/ ibtkRiKfKSFRjqDMllzvVRqE1T7UHo/u6UUZ4EFjt3qHqUr/gwrhys+UhITVVWck5eqQPd h/tHkvkPcjYTnMK6105DE76hrQWSdDbjUJluIo4pMvGSD0TOAlyz629ncbP/xvvx6KF/kt w7zfZVs+a+309+mkLqfY/qOFcGhY8+EGBIVMtIlpz8/pZszMU2xcTjXL0IpA4Q== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1620851248; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=T8VGM7T2ebwxRKCm5/uITXAy1lYGXfvGxWTRjsElJlo=; b=EQTh/A7XSqo9mXKYkLMu0PQUecmLYJRHnb+Pm4yi3tEuGxUxVg7ubba0KNUejp7niMF6Ej 0w60bRAIGZVLDwCA== To: Vitaly Kuznetsov , linux-hyperv@vger.kernel.org Cc: Daniel Lezcano , Michael Kelley , Mohammed Gamal , Wei Liu , "K. Y. Srinivasan" , Haiyang Zhang , Dexuan Cui , Stephen Hemminger , linux-kernel@vger.kernel.org Subject: Re: [PATCH] clocksource/drivers/hyper-v: Re-enable VDSO_CLOCKMODE_HVCLOCK on X86 In-Reply-To: <20210512084630.1662011-1-vkuznets@redhat.com> References: <20210512084630.1662011-1-vkuznets@redhat.com> Date: Wed, 12 May 2021 22:27:28 +0200 Message-ID: <87tun766kv.ffs@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > Fixes: e4ab4658f1cf ("clocksource/drivers/hyper-v: Handle vDSO differences inline") > Signed-off-by: Vitaly Kuznetsov > --- > 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