From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751511AbbCSJiL (ORCPT ); Thu, 19 Mar 2015 05:38:11 -0400 Received: from casper.infradead.org ([85.118.1.10]:59827 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750837AbbCSJiI (ORCPT ); Thu, 19 Mar 2015 05:38:08 -0400 Message-Id: <20150319093400.562746929@infradead.org> User-Agent: quilt/0.61-1 Date: Thu, 19 Mar 2015 10:31:41 +0100 From: Peter Zijlstra To: john.stultz@linaro.org, tglx@linutronix.de Cc: pawel.moll@arm.com, adrian.hunter@intel.com, mingo@kernel.org, eranian@google.com, linux-kernel@vger.kernel.org, acme@kernel.org, dsahern@gmail.com, fweisbec@gmail.com, jolsa@redhat.com, namhyung@gmail.com, paulus@samba.org, rostedt@goodmis.org, sonnyrao@chromium.org, ak@linux.intel.com, vincent.weaver@maine.edu, peterz@infradead.org Subject: [RFC][PATCH 4/4] time: Introduce tk_fast_raw References: <20150319093137.149794496@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline; filename=peterz-fast-raw-4.patch Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add the NMI safe CLOCK_MONOTONIC_RAW accessor.. Signed-off-by: Peter Zijlstra (Intel) --- kernel/time/timekeeping.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -59,6 +59,7 @@ struct tk_fast { }; static struct tk_fast tk_fast_mono ____cacheline_aligned; +static struct tk_fast tk_fast_raw ____cacheline_aligned; /* flag for if timekeeping is suspended */ int __read_mostly timekeeping_suspended; @@ -434,6 +435,12 @@ u64 ktime_get_mono_fast_ns(void) } EXPORT_SYMBOL_GPL(ktime_get_mono_fast_ns); +u64 ktime_get_raw_fast_ns(void) +{ + return __ktime_get_fast_ns(&tk_fast_raw); +} +EXPORT_SYMBOL_GPL(ktime_get_raw_fast_ns); + /* Suspend-time cycles value for halted fast timekeeper. */ static cycle_t cycles_at_suspend; @@ -461,6 +468,11 @@ static void halt_fast_timekeeper(struct cycles_at_suspend = tkr->read(tkr->clock); tkr_dummy.read = dummy_clock_read; update_fast_timekeeper(&tkr_dummy, &tk_fast_mono); + + tkr = &tk->tkr_raw; + memcpy(&tkr_dummy, tkr, sizeof(tkr_dummy)); + tkr_dummy.read = dummy_clock_read; + update_fast_timekeeper(&tkr_dummy, &tk_fast_raw); } #ifdef CONFIG_GENERIC_TIME_VSYSCALL_OLD @@ -592,6 +604,7 @@ static void timekeeping_update(struct ti sizeof(tk_core.timekeeper)); update_fast_timekeeper(&tk->tkr_mono, &tk_fast_mono); + update_fast_timekeeper(&tk->tkr_raw, &tk_fast_raw); } /**