From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933304AbdKOS2K (ORCPT ); Wed, 15 Nov 2017 13:28:10 -0500 Received: from Galois.linutronix.de ([146.0.238.70]:42847 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932438AbdKOS2C (ORCPT ); Wed, 15 Nov 2017 13:28:02 -0500 Message-Id: <20171115182657.224628544@linutronix.de> User-Agent: quilt/0.63-1 Date: Wed, 15 Nov 2017 19:15:32 +0100 From: Thomas Gleixner To: LKML Cc: Linus Torvalds , Prarit Bhargava , Mark Salyzyn , Petr Mladek , Ingo Molnar , "H. Peter Anvin" , Peter Zijlstra , Andrew Morton , Sergey Senozhatsky , Steven Rostedt , Joe Perches Subject: [RFC patch 1/7] timekeeping: Do not unconditionally suspend NMI safe timekeepers References: <20171115181531.322572387@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Disposition: inline; filename=timekeeping--Do-not-unconditionally-suspend-fast-timekeepers.patch Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If the current clocksource can be accessed safely after timekeeping is suspended then there is no reason to suspend the NMI safe timekeepers. Signed-off-by: Thomas Gleixner --- include/linux/clocksource.h | 3 ++- kernel/time/timekeeping.c | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) --- a/include/linux/clocksource.h +++ b/include/linux/clocksource.h @@ -119,7 +119,8 @@ struct clocksource { #define CLOCK_SOURCE_VALID_FOR_HRES 0x20 #define CLOCK_SOURCE_UNSTABLE 0x40 #define CLOCK_SOURCE_SUSPEND_NONSTOP 0x80 -#define CLOCK_SOURCE_RESELECT 0x100 +#define CLOCK_SOURCE_SUSPEND_ACCESS_OK 0x100 +#define CLOCK_SOURCE_RESELECT 0x200 /* simplify initialization of mask field */ #define CLOCKSOURCE_MASK(bits) GENMASK_ULL((bits) - 1, 0) --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -545,6 +545,9 @@ static void halt_fast_timekeeper(struct static struct tk_read_base tkr_dummy; struct tk_read_base *tkr = &tk->tkr_mono; + if (tkr->clock->flags & CLOCK_SOURCE_SUSPEND_ACCESS_OK) + return; + memcpy(&tkr_dummy, tkr, sizeof(tkr_dummy)); cycles_at_suspend = tk_clock_read(tkr); tkr_dummy.clock = &dummy_clock;