mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
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
Date: Thu, 19 Mar 2015 10:31:41 +0100	[thread overview]
Message-ID: <20150319093400.562746929@infradead.org> (raw)
In-Reply-To: <20150319093137.149794496@infradead.org>

[-- Attachment #1: peterz-fast-raw-4.patch --]
[-- Type: text/plain, Size: 1463 bytes --]

Add the NMI safe CLOCK_MONOTONIC_RAW accessor..

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
 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);
 }
 
 /**



  parent reply	other threads:[~2015-03-19  9:38 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-19  9:31 [RFC][PATCH 0/4] Another go at ktime_get_raw_fast_ns() Peter Zijlstra
2015-03-19  9:31 ` [RFC][PATCH 1/4] time: Rename timekeeper::tkr to timekeeper::tkr_mono Peter Zijlstra
2015-03-27 11:44   ` [tip:perf/timer] time: Rename timekeeper::tkr to timekeeper:: tkr_mono tip-bot for Peter Zijlstra
2015-03-19  9:31 ` [RFC][PATCH 2/4] time: Add timerkeeper::tkr_raw Peter Zijlstra
2015-03-27 11:44   ` [tip:perf/timer] " tip-bot for Peter Zijlstra
2015-03-19  9:31 ` [RFC][PATCH 3/4] time: Parametrize all tk_fast_mono users Peter Zijlstra
2015-03-27 11:45   ` [tip:perf/timer] " tip-bot for Peter Zijlstra
2015-03-19  9:31 ` Peter Zijlstra [this message]
2015-03-27 11:45   ` [tip:perf/timer] time: Introduce tk_fast_raw tip-bot for Peter Zijlstra
2015-03-24 15:20 ` [RFC][PATCH 0/4] Another go at ktime_get_raw_fast_ns() John Stultz
2015-03-24 15:48   ` Peter Zijlstra
2015-03-24 16:00     ` John Stultz
2015-03-24 21:02       ` John Stultz
2015-03-25 14:58         ` Peter Zijlstra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150319093400.562746929@infradead.org \
    --to=peterz@infradead.org \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=ak@linux.intel.com \
    --cc=dsahern@gmail.com \
    --cc=eranian@google.com \
    --cc=fweisbec@gmail.com \
    --cc=john.stultz@linaro.org \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@gmail.com \
    --cc=paulus@samba.org \
    --cc=pawel.moll@arm.com \
    --cc=rostedt@goodmis.org \
    --cc=sonnyrao@chromium.org \
    --cc=tglx@linutronix.de \
    --cc=vincent.weaver@maine.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome