Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1303026
| Path | csiph.com!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | John Stultz <john.stultz@linaro.org> |
| Newsgroups | linux.kernel |
| Subject | Re: [RFC v5 4/6] Remove duplicate code from ktime_get_raw_and_real code |
| Date | Wed, 06 Jan 2016 20:50:02 +0100 |
| Message-ID | <qO2fM-5vA-7@gated-at.bofh.it> (permalink) |
| References | <qNjsm-7U0-13@gated-at.bofh.it> <qNjsn-7U0-21@gated-at.bofh.it> |
| X-Original-To | "Christopher S. Hall" <christopher.s.hall@intel.com> |
| Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=hfHk4YsW6KtYjeGyP8XdmGqdFufEyAHsOOkWMhQoWs4=; b=TPg5xw6wubiPPuQVhHZRAawGh+m6CORj62uQO/LZYgecdY/vLxl7gngk6m36NSjTvf HFuhbWh2WPVrE4UuhoGQmyf1cCJulH5xuQxKjgxLUn8cF6Zo0jg0CRaPEKTD7oE6uqRM zQN6O7k0Y3eypWg6r0vkvtV2ce+/NWBHLyHSY= |
| X-Google-Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=hfHk4YsW6KtYjeGyP8XdmGqdFufEyAHsOOkWMhQoWs4=; b=A4Fy0B/keKYpcc379JxDuU4+y/5vazLmVWNGVnO/jXBZ9GgA5GBfNb270iQm3UqQoZ FbnKE0FjcTjW9vSCS19Wqh9U+cggvzzKGavaSQ4dYI9/zqxZioekdDym/ksHD0+xGG50 yx4iLs/DTz5i1apaMrsoB8rwnjsGkbfFpXxndQVnu4yBwYsOSXSAOy5RM/hHHxmvYskQ 6dsndWQ3P6KYMoJQoerltjUgrN8toxMJERL5spgYVLFMFWkHc8VhL/NXV4dT9oodjQW4 ke8dlbvoS5WI+KulaYJeQd9Jfh2fsl6lWqVjn0YULRTjqIJaMR+bicfbXFF9R3CsKsym PNkQ== |
| X-Gm-Message-State | ALoCoQn3HkuVGbTYcLXYCYZVoKG3NixM3TU5JupLK6nOX1uWlYZ4J8Lg8lC/fKouK5aP1YfG1H9ngX7ED2vZhNjLwU5kqa+wjxwxn0D7wcxfcfGY65Yc7HE= |
| MIME-Version | 1.0 |
| X-Received | by 10.129.119.87 with SMTP id s84mr75567384ywc.55.1452109378150; Wed, 06 Jan 2016 11:42:58 -0800 (PST) |
| Content-Type | text/plain; charset=UTF-8 |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 59 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | Thomas Gleixner <tglx@linutronix.de>, Richard Cochran <richardcochran@gmail.com>, Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>, Jeff Kirsher <jeffrey.t.kirsher@intel.com>, "x86@kernel.org" <x86@kernel.org>, lkml <linux-kernel@vger.kernel.org>, intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, "Stanton, Kevin B" <kevin.b.stanton@intel.com> |
| X-Original-Date | Wed, 6 Jan 2016 11:42:58 -0800 |
| X-Original-Message-ID | <CALAqxLVmQEXLGoq1k7S-Y97gLb_FSMbxzkZ6bFmnPH_sKt5X1A@mail.gmail.com> |
| X-Original-References | <1451911523-8534-1-git-send-email-christopher.s.hall@intel.com> <1451911523-8534-5-git-send-email-christopher.s.hall@intel.com> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1303026 |
Show key headers only | View raw
On Mon, Jan 4, 2016 at 4:45 AM, Christopher S. Hall
<christopher.s.hall@intel.com> wrote:
> The code in ktime_get_snapshot() is a superset of the code in
> ktime_get_raw_and_real() code. Changes the latter to call the former. A
> side effect of this is that ktime_get_raw_and_real() returns two clock
> times corresponding to the *exact* same clock tick. Previously, this
> code read the underlying counter twice.
>
> Signed-off-by: Christopher S. Hall <christopher.s.hall@intel.com>
> ---
> kernel/time/timekeeping.c | 20 ++++----------------
> 1 file changed, 4 insertions(+), 16 deletions(-)
>
> diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
> index 5a7f784..a0f096c 100644
> --- a/kernel/time/timekeeping.c
> +++ b/kernel/time/timekeeping.c
> @@ -910,26 +910,14 @@ EXPORT_SYMBOL_GPL(ktime_get_snapshot);
> */
> void ktime_get_raw_and_real_ts64(struct timespec64 *ts_raw, struct timespec64 *ts_real)
> {
> - struct timekeeper *tk = &tk_core.timekeeper;
> - unsigned long seq;
> - s64 nsecs_raw, nsecs_real;
> + struct system_time_snapshot snap;
>
> WARN_ON_ONCE(timekeeping_suspended);
>
> - do {
> - seq = read_seqcount_begin(&tk_core.seq);
> -
> - *ts_raw = tk->raw_time;
> - ts_real->tv_sec = tk->xtime_sec;
> - ts_real->tv_nsec = 0;
> -
> - nsecs_raw = timekeeping_get_ns(&tk->tkr_raw);
> - nsecs_real = timekeeping_get_ns(&tk->tkr_mono);
> -
> - } while (read_seqcount_retry(&tk_core.seq, seq));
> + ktime_get_snapshot(&snap);
>
> - timespec64_add_ns(ts_raw, nsecs_raw);
> - timespec64_add_ns(ts_real, nsecs_real);
> + *ts_raw = ktime_to_timespec64(snap.raw);
> + *ts_real = ktime_to_timespec64(snap.real);
> }
> EXPORT_SYMBOL(ktime_get_raw_and_real_ts64);
Looks sane, but you might even be able to get rid of this function
entirely and modify the one user (pps_get_ts()) to use
ktime_get_snapshot().
thanks
-john
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[RFC v5 0/6] Patchset enabling hardware based cross-timestamps for next gen Intel platforms "Christopher S. Hall" <christopher.s.hall@intel.com> - 2016-01-04 21:00 +0100
[RFC v5 4/6] Remove duplicate code from ktime_get_raw_and_real code "Christopher S. Hall" <christopher.s.hall@intel.com> - 2016-01-04 21:00 +0100
Re: [RFC v5 4/6] Remove duplicate code from ktime_get_raw_and_real code John Stultz <john.stultz@linaro.org> - 2016-01-06 20:50 +0100
[RFC v5 3/6] Add history to cross timestamp interface supporting slower devices "Christopher S. Hall" <christopher.s.hall@intel.com> - 2016-01-04 21:00 +0100
Re: [RFC v5 3/6] Add history to cross timestamp interface supporting slower devices John Stultz <john.stultz@linaro.org> - 2016-01-06 20:40 +0100
Re: [RFC v5 3/6] Add history to cross timestamp interface supporting slower devices "Christopher Hall" <christopher.s.hall@intel.com> - 2016-01-08 02:10 +0100
Re: [RFC v5 3/6] Add history to cross timestamp interface supporting slower devices John Stultz <john.stultz@linaro.org> - 2016-01-08 02:20 +0100
Re: [RFC v5 3/6] Add history to cross timestamp interface supporting slower devices Thomas Gleixner <tglx@linutronix.de> - 2016-01-08 15:10 +0100
Re: [RFC v5 3/6] Add history to cross timestamp interface supporting slower devices "Christopher Hall" <christopher.s.hall@intel.com> - 2016-01-08 23:30 +0100
[RFC v5 6/6] Adds hardware supported cross timestamp "Christopher S. Hall" <christopher.s.hall@intel.com> - 2016-01-04 21:00 +0100
[RFC v5 2/6] Always Running Timer (ART) correlated clocksource "Christopher S. Hall" <christopher.s.hall@intel.com> - 2016-01-04 21:00 +0100
[RFC v5 1/6] Timekeeping cross timestamp interface for device drivers "Christopher S. Hall" <christopher.s.hall@intel.com> - 2016-01-04 21:00 +0100
Re: [RFC v5 1/6] Timekeeping cross timestamp interface for device drivers John Stultz <john.stultz@linaro.org> - 2016-01-06 20:00 +0100
Re: [RFC v5 1/6] Timekeeping cross timestamp interface for device drivers "Christopher Hall" <christopher.s.hall@intel.com> - 2016-01-08 01:50 +0100
Re: [RFC v5 1/6] Timekeeping cross timestamp interface for device drivers John Stultz <john.stultz@linaro.org> - 2016-01-08 02:10 +0100
Re: [RFC v5 1/6] Timekeeping cross timestamp interface for device drivers Richard Cochran <richardcochran@gmail.com> - 2016-01-08 10:20 +0100
[RFC v5 5/6] Add PTP_SYS_OFFSET_PRECISE for driver crosstimestamping "Christopher S. Hall" <christopher.s.hall@intel.com> - 2016-01-04 21:00 +0100
Re: [RFC v5 5/6] Add PTP_SYS_OFFSET_PRECISE for driver crosstimestamping Richard Cochran <richardcochran@gmail.com> - 2016-01-05 16:30 +0100
Re: [RFC v5 5/6] Add PTP_SYS_OFFSET_PRECISE for driver crosstimestamping "Christopher Hall" <christopher.s.hall@intel.com> - 2016-01-07 02:50 +0100
csiph-web