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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 66683C4332F for ; Fri, 3 Nov 2023 08:35:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346427AbjKCIfJ (ORCPT ); Fri, 3 Nov 2023 04:35:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235989AbjKCIfH (ORCPT ); Fri, 3 Nov 2023 04:35:07 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 188EFD47 for ; Fri, 3 Nov 2023 01:35:04 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 400A72F4; Fri, 3 Nov 2023 01:35:46 -0700 (PDT) Received: from [192.168.4.21] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 9D6693F64C; Fri, 3 Nov 2023 01:35:02 -0700 (PDT) Message-ID: <9ef78d40-fcdd-4ff8-b5ee-58b7478534a9@arm.com> Date: Fri, 3 Nov 2023 08:35:00 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] ARM: VDSO: remove cntvct_ok global variable To: Rasmus Villemoes , Russell King Cc: Florian Fainelli , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <20231103075800.3254680-1-linux@rasmusvillemoes.dk> Content-Language: en-US From: Vincenzo Frascino In-Reply-To: <20231103075800.3254680-1-linux@rasmusvillemoes.dk> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/3/23 07:57, Rasmus Villemoes wrote: > The cntvct_ok variable has not had any external user since commit > c7a18100bdff ("lib/vdso: Avoid highres update if clocksource is not > VDSO capable"). > > It also only has one user in vdso.c, once during init, so rather than > having the caller of patch_vdso() initialize cntvct_ok, just call > cntvct_functional() directly and avoid the global variable entirely. > > Signed-off-by: Rasmus Villemoes Fine by me. Reviewed-by: Vincenzo Frascino > --- > arch/arm/include/asm/vdso/vsyscall.h | 1 - > arch/arm/kernel/vdso.c | 10 +++------- > 2 files changed, 3 insertions(+), 8 deletions(-) > > diff --git a/arch/arm/include/asm/vdso/vsyscall.h b/arch/arm/include/asm/vdso/vsyscall.h > index 47e41ae8ccd0..9a2cd2673a82 100644 > --- a/arch/arm/include/asm/vdso/vsyscall.h > +++ b/arch/arm/include/asm/vdso/vsyscall.h > @@ -9,7 +9,6 @@ > #include > > extern struct vdso_data *vdso_data; > -extern bool cntvct_ok; > > /* > * Update the vDSO data page to keep in sync with kernel timekeeping. > diff --git a/arch/arm/kernel/vdso.c b/arch/arm/kernel/vdso.c > index f297d66a8a76..ba87ffc6f194 100644 > --- a/arch/arm/kernel/vdso.c > +++ b/arch/arm/kernel/vdso.c > @@ -67,11 +67,9 @@ struct elfinfo { > char *dynstr; /* ptr to .dynstr section */ > }; > > -/* Cached result of boot-time check for whether the arch timer exists, > - * and if so, whether the virtual counter is useable. > +/* Boot-time check for whether the arch timer exists, and if so, > + * whether the virtual counter is useable. > */ > -bool cntvct_ok __ro_after_init; > - > static bool __init cntvct_functional(void) > { > struct device_node *np; > @@ -172,7 +170,7 @@ static void __init patch_vdso(void *ehdr) > * want programs to incur the slight additional overhead of > * dispatching through the VDSO only to fall back to syscalls. > */ > - if (!cntvct_ok) { > + if (!cntvct_functional()) { > vdso_nullpatch_one(&einfo, "__vdso_gettimeofday"); > vdso_nullpatch_one(&einfo, "__vdso_clock_gettime"); > vdso_nullpatch_one(&einfo, "__vdso_clock_gettime64"); > @@ -213,8 +211,6 @@ static int __init vdso_init(void) > vdso_total_pages = 1; /* for the data/vvar page */ > vdso_total_pages += text_pages; > > - cntvct_ok = cntvct_functional(); > - > patch_vdso(vdso_start); > > return 0; -- Regards, Vincenzo