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=-11.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SIGNED_OFF_BY,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 F1ED1C33CAF for ; Thu, 16 Jan 2020 20:28:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CBCAA2072E for ; Thu, 16 Jan 2020 20:28:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387846AbgAPU2z (ORCPT ); Thu, 16 Jan 2020 15:28:55 -0500 Received: from Galois.linutronix.de ([193.142.43.55]:53286 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731117AbgAPU2y (ORCPT ); Thu, 16 Jan 2020 15:28:54 -0500 Received: from [5.158.153.53] (helo=tip-bot2.lab.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1isBl5-0000hN-2T; Thu, 16 Jan 2020 21:28:51 +0100 Received: from [127.0.1.1] (localhost [IPv6:::1]) by tip-bot2.lab.linutronix.de (Postfix) with ESMTP id 3E3FE1C0E34; Thu, 16 Jan 2020 21:28:50 +0100 (CET) Date: Thu, 16 Jan 2020 20:28:49 -0000 From: "tip-bot2 for Christophe Leroy" Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: timers/core] lib/vdso: Only read hrtimer_res when needed in __cvdso_clock_getres() Cc: Christophe Leroy , Thomas Gleixner , x86 , LKML In-Reply-To: =?utf-8?q?=3C7ac2f0d21652f95e2bbdfa6bd514ae6c7caf53ab=2E15791?= =?utf-8?q?96675=2Egit=2Echristophe=2Eleroy=40c-s=2Efr=3E?= References: =?utf-8?q?=3C7ac2f0d21652f95e2bbdfa6bd514ae6c7caf53ab=2E157919?= =?utf-8?q?6675=2Egit=2Echristophe=2Eleroy=40c-s=2Efr=3E?= MIME-Version: 1.0 Message-ID: <157920652995.396.11214684857545426237.tip-bot2@tip-bot2> X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the timers/core branch of tip: Commit-ID: 49a101d7169c7729c7bab6b2f896faae34bd6c3d Gitweb: https://git.kernel.org/tip/49a101d7169c7729c7bab6b2f896faae34bd6c3d Author: Christophe Leroy AuthorDate: Thu, 16 Jan 2020 17:58:27 Committer: Thomas Gleixner CommitterDate: Thu, 16 Jan 2020 21:24:46 +01:00 lib/vdso: Only read hrtimer_res when needed in __cvdso_clock_getres() Only perform READ_ONCE(vd[CS_HRES_COARSE].hrtimer_res) for HRES and RAW clocks. Signed-off-by: Christophe Leroy Signed-off-by: Thomas Gleixner Link: https://lore.kernel.org/r/7ac2f0d21652f95e2bbdfa6bd514ae6c7caf53ab.1579196675.git.christophe.leroy@c-s.fr --- lib/vdso/gettimeofday.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/vdso/gettimeofday.c b/lib/vdso/gettimeofday.c index f342ac1..f8b8ec5 100644 --- a/lib/vdso/gettimeofday.c +++ b/lib/vdso/gettimeofday.c @@ -312,7 +312,6 @@ static __maybe_unused int __cvdso_clock_getres_common(clockid_t clock, struct __kernel_timespec *res) { const struct vdso_data *vd = __arch_get_vdso_data(); - u64 hrtimer_res; u32 msk; u64 ns; @@ -323,7 +322,6 @@ int __cvdso_clock_getres_common(clockid_t clock, struct __kernel_timespec *res) if (IS_ENABLED(CONFIG_TIME_NS) && vd->clock_mode == VCLOCK_TIMENS) vd = __arch_get_timens_vdso_data(); - hrtimer_res = READ_ONCE(vd[CS_HRES_COARSE].hrtimer_res); /* * Convert the clockid to a bitmask and use it to check which * clocks are handled in the VDSO directly. @@ -333,7 +331,7 @@ int __cvdso_clock_getres_common(clockid_t clock, struct __kernel_timespec *res) /* * Preserves the behaviour of posix_get_hrtimer_res(). */ - ns = hrtimer_res; + ns = READ_ONCE(vd[CS_HRES_COARSE].hrtimer_res); } else if (msk & VDSO_COARSE) { /* * Preserves the behaviour of posix_get_coarse_res().