Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp5609456ybl; Tue, 14 Jan 2020 11:50:25 -0800 (PST) X-Google-Smtp-Source: APXvYqyK0GQ5a9MNtj8wdUZWUZTqF1PJNwIqCLWNh78b2Ik0I2Bb4TLp/HTHopwgelIzC29m+/eD X-Received: by 2002:a54:4715:: with SMTP id k21mr18503038oik.163.1579031425091; Tue, 14 Jan 2020 11:50:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579031425; cv=none; d=google.com; s=arc-20160816; b=ZONJeOYC7VMANH6AtekDAJ4QR/mytz9lz+6ZEtuL9RPWgHFyY6ch11mM9XBWxu4PEX WPo35YsJRkyRV02Sqjyg8j9oEf9X4DNjpjGsmLY9JwXsXxPd4tlKX7OPRuIzRKO8U5Xe LCv90jkOdTMVNddDJAZbbvlVk7qwuGA+gGhmRpBAN53Mds961AEZTwpz2wC/XVhVPh0M /KC0PMENhRa5iGGcXiUwyFW65GgG4gd54q+KwywS8NlP719dqqye6LbzgDDjWcE3y5Pi 8uxQSUjqd0+i4YO3EC+2Gua6mgs/h9DNFS1wz0xjgB++VPdlFbHVldd0mqyJ68YCCQxT pvVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:subject:cc:to :from:date:user-agent:message-id; bh=XW3kZCyWTKyQmbe/fStgAyfIyNxFsRmmLu5AbqXsLEY=; b=QikHh8yA+pxC4hbMqdEU98CYQnYJGvwYB2yoyVuabOg916l/18YWu/3BcTPR07UQL8 ychfXQEfWVKqyH0nNMNXLoyYTkvFK53HqiCSIR3ehialT6dpiKkW4vPFqWbtpKvHEIs8 FSh+dzrv3/UrWizaxt9LbuVyCZu6GO8//Kr+NNWsWjFAnxt2eL33uNLWS+toaWgjPdQK b4NINOBUCxOI/W6TpGG3UC2yw8mMy5tsSpHPbOTpDxQDYnJzQltsrXFj0OCNLpRXmKKW 26/mRqO9wYWt2zDMxzl38oWrVieq1KCdbAcA8aRegWxtm5YrlhSiHSf6xyHFYaoWrgaL yiOw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w24si7462426oic.260.2020.01.14.11.50.13; Tue, 14 Jan 2020 11:50:25 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728984AbgANTtP (ORCPT + 99 others); Tue, 14 Jan 2020 14:49:15 -0500 Received: from Galois.linutronix.de ([193.142.43.55]:44812 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728961AbgANTtN (ORCPT ); Tue, 14 Jan 2020 14:49:13 -0500 Received: from localhost ([127.0.0.1] helo=nanos.tec.linutronix.de) by Galois.linutronix.de with esmtp (Exim 4.80) (envelope-from ) id 1irSBb-0005bG-Fw; Tue, 14 Jan 2020 20:49:11 +0100 Message-Id: <20200114185947.996078385@linutronix.de> User-Agent: quilt/0.65 Date: Tue, 14 Jan 2020 19:52:51 +0100 From: Thomas Gleixner To: LKML Cc: x86@kernel.org, John Stultz , Vincenzo Frascino , Andy Lutomirski , Christophe Leroy , Paolo Bonzini , Boris Ostrovsky , Juergen Gross , Haiyang Zhang , Sasha Levin , Ralf Baechle , Paul Burton , James Hogan , Russell King , Catalin Marinas , Will Deacon , Mark Rutland , Marc Zyngier Subject: [patch 14/15] lib/vdso: Avoid highres update if clocksource is not VDSO capable References: <20200114185237.273005683@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If the current clocksource is not VDSO capable there is no point in updating the high resolution parts of the VDSO data. Replace the architecture specific check with a check for a VDSO capable clocksource and skip the update if there is none. Signed-off-by: Thomas Gleixner --- arch/arm/include/asm/vdso/vsyscall.h | 7 ------- include/asm-generic/vdso/vsyscall.h | 7 ------- kernel/time/vsyscall.c | 14 +++++++------- 3 files changed, 7 insertions(+), 21 deletions(-) --- a/arch/arm/include/asm/vdso/vsyscall.h +++ b/arch/arm/include/asm/vdso/vsyscall.h @@ -22,13 +22,6 @@ struct vdso_data *__arm_get_k_vdso_data( #define __arch_get_k_vdso_data __arm_get_k_vdso_data static __always_inline -bool __arm_update_vdso_data(void) -{ - return cntvct_ok; -} -#define __arch_update_vdso_data __arm_update_vdso_data - -static __always_inline void __arm_sync_vdso_data(struct vdso_data *vdata) { flush_dcache_page(virt_to_page(vdata)); --- a/include/asm-generic/vdso/vsyscall.h +++ b/include/asm-generic/vdso/vsyscall.h @@ -11,13 +11,6 @@ static __always_inline struct vdso_data } #endif /* __arch_get_k_vdso_data */ -#ifndef __arch_update_vdso_data -static __always_inline bool __arch_update_vdso_data(void) -{ - return true; -} -#endif /* __arch_update_vdso_data */ - #ifndef __arch_update_vsyscall static __always_inline void __arch_update_vsyscall(struct vdso_data *vdata, struct timekeeper *tk) --- a/kernel/time/vsyscall.c +++ b/kernel/time/vsyscall.c @@ -71,15 +71,15 @@ void update_vsyscall(struct timekeeper * { struct vdso_data *vdata = __arch_get_k_vdso_data(); struct vdso_timestamp *vdso_ts; + s32 clock_mode; u64 nsec; - s32 mode; /* copy vsyscall data */ vdso_write_begin(vdata); - mode = tk->tkr_mono.clock->vdso_clock_mode; - vdata[CS_HRES_COARSE].clock_mode = mode; - vdata[CS_RAW].clock_mode = mode; + clock_mode = tk->tkr_mono.clock->vdso_clock_mode; + vdata[CS_HRES_COARSE].clock_mode = clock_mode; + vdata[CS_RAW].clock_mode = clock_mode; /* CLOCK_REALTIME also required for time() */ vdso_ts = &vdata[CS_HRES_COARSE].basetime[CLOCK_REALTIME]; @@ -105,10 +105,10 @@ void update_vsyscall(struct timekeeper * WRITE_ONCE(vdata[CS_HRES_COARSE].hrtimer_res, hrtimer_resolution); /* - * Architectures can opt out of updating the high resolution part - * of the VDSO. + * If the current clocksource is not VDSO capable, then spare the + * update of the high reolution parts. */ - if (__arch_update_vdso_data()) + if (clock_mode != VDSO_CLOCKMODE_NONE) update_vdso_data(vdata, tk); __arch_update_vsyscall(vdata, tk);