Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/567105/?format=api
{ "id": 567105, "url": "http://patchwork.ozlabs.org/api/patches/567105/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/1452687149-11281-6-git-send-email-christopher.s.hall@intel.com/", "project": { "id": 46, "url": "http://patchwork.ozlabs.org/api/projects/46/?format=api", "name": "Intel Wired Ethernet development", "link_name": "intel-wired-lan", "list_id": "intel-wired-lan.osuosl.org", "list_email": "intel-wired-lan@osuosl.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<1452687149-11281-6-git-send-email-christopher.s.hall@intel.com>", "list_archive_url": null, "date": "2016-01-13T12:12:25", "name": "[v6,5/9] Add timekeeping snapshot code capturing system time and counter", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "b2a6107a1bf5ceae21cc88a50f0930753292abd4", "submitter": { "id": 66720, "url": "http://patchwork.ozlabs.org/api/people/66720/?format=api", "name": "Hall, Christopher S", "email": "christopher.s.hall@intel.com" }, "delegate": { "id": 68, "url": "http://patchwork.ozlabs.org/api/users/68/?format=api", "username": "jtkirshe", "first_name": "Jeff", "last_name": "Kirsher", "email": "jeffrey.t.kirsher@intel.com" }, "mbox": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/1452687149-11281-6-git-send-email-christopher.s.hall@intel.com/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/567105/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/567105/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<intel-wired-lan-bounces@lists.osuosl.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "intel-wired-lan@lists.osuosl.org" ], "Delivered-To": [ "patchwork-incoming@bilbo.ozlabs.org", "intel-wired-lan@lists.osuosl.org" ], "Received": [ "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\tby ozlabs.org (Postfix) with ESMTP id 75155140297\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 14 Jan 2016 06:18:42 +1100 (AEDT)", "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id C41D694988;\n\tWed, 13 Jan 2016 19:18:41 +0000 (UTC)", "from hemlock.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id 75HhNHYfrh6g; Wed, 13 Jan 2016 19:18:40 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id C13BE945C9;\n\tWed, 13 Jan 2016 19:18:40 +0000 (UTC)", "from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n\tby ash.osuosl.org (Postfix) with ESMTP id 22B801C0F8E\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 13 Jan 2016 19:18:39 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 5113A8C949\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 13 Jan 2016 19:18:38 +0000 (UTC)", "from whitealder.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id g+boQ8cUCvLE for <intel-wired-lan@lists.osuosl.org>;\n\tWed, 13 Jan 2016 19:18:37 +0000 (UTC)", "from mga11.intel.com (mga11.intel.com [192.55.52.93])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id CAA228C942\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 13 Jan 2016 19:18:37 +0000 (UTC)", "from fmsmga003.fm.intel.com ([10.253.24.29])\n\tby fmsmga102.fm.intel.com with ESMTP; 13 Jan 2016 11:18:38 -0800", "from foofoo.jf.intel.com (HELO localhost.localdomain)\n\t([134.134.172.151])\n\tby FMSMGA003.fm.intel.com with ESMTP; 13 Jan 2016 11:18:38 -0800" ], "X-Virus-Scanned": [ "amavisd-new at osuosl.org", "amavisd-new at osuosl.org" ], "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.22,290,1449561600\"; d=\"scan'208\";a=\"632939101\"", "From": "\"Christopher S. Hall\" <christopher.s.hall@intel.com>", "To": "tglx@linutronix.de, richardcochran@gmail.com, mingo@redhat.com,\n\tjohn.stultz@linaro.org, hpa@zytor.com, jeffrey.t.kirsher@intel.com", "Date": "Wed, 13 Jan 2016 04:12:25 -0800", "Message-Id": "<1452687149-11281-6-git-send-email-christopher.s.hall@intel.com>", "X-Mailer": "git-send-email 2.1.4", "In-Reply-To": "<1452687149-11281-1-git-send-email-christopher.s.hall@intel.com>", "References": "<1452687149-11281-1-git-send-email-christopher.s.hall@intel.com>", "Cc": "\"Christopher S. Hall\" <christopher.s.hall@intel.com>,\n\tkevin.b.stanton@intel.com, netdev@vger.kernel.org, x86@kernel.org,\n\tlinux-kernel@vger.kernel.org, intel-wired-lan@lists.osuosl.org", "Subject": "[Intel-wired-lan] [PATCH v6 5/9] Add timekeeping snapshot code\n\tcapturing system time and counter", "X-BeenThere": "intel-wired-lan@lists.osuosl.org", "X-Mailman-Version": "2.1.18-1", "Precedence": "list", "List-Id": "Intel Wired Ethernet Linux Kernel Driver Development\n\t<intel-wired-lan.lists.osuosl.org>", "List-Unsubscribe": "<http://lists.osuosl.org/mailman/options/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@lists.osuosl.org?subject=unsubscribe>", "List-Archive": "<http://lists.osuosl.org/pipermail/intel-wired-lan/>", "List-Post": "<mailto:intel-wired-lan@lists.osuosl.org>", "List-Help": "<mailto:intel-wired-lan-request@lists.osuosl.org?subject=help>", "List-Subscribe": "<http://lists.osuosl.org/mailman/listinfo/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@lists.osuosl.org?subject=subscribe>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Errors-To": "intel-wired-lan-bounces@lists.osuosl.org", "Sender": "\"Intel-wired-lan\" <intel-wired-lan-bounces@lists.osuosl.org>" }, "content": "In the current timekeeping code there isn't any interface to\natomically capture the current relationship between the system counter\nand system time. ktime_get_snapshot() returns this triple (counter,\nmonotonic raw, realtime) in the system_time_snapshot struct.\n\nSigned-off-by: Christopher S. Hall <christopher.s.hall@intel.com>\n---\n include/linux/clocksource.h | 13 +++++++++++++\n include/linux/timekeeping.h | 6 ++++++\n kernel/time/timekeeping.c | 31 +++++++++++++++++++++++++++++++\n 3 files changed, 50 insertions(+)", "diff": "diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h\nindex 726ca68..cccbd1c 100644\n--- a/include/linux/clocksource.h\n+++ b/include/linux/clocksource.h\n@@ -281,4 +281,17 @@ struct correlated_cs {\n \t\t\t\t\t cycle_t cycles);\n };\n \n+/*\n+ * struct system_time_snapshot - simultaneous raw/real time capture with\n+ *\tcounter value\n+ * @cycles:\tClocksource counter value to produce the system times\n+ * @real:\tRealtime system time\n+ * @raw:\tMonotonic raw system time\n+ */\n+struct system_time_snapshot {\n+\tcycles_t\tcycles;\n+\tktime_t\t\treal;\n+\tktime_t\t\traw;\n+};\n+\n #endif /* _LINUX_CLOCKSOURCE_H */\ndiff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h\nindex 2651e0a..f5fe657 100644\n--- a/include/linux/timekeeping.h\n+++ b/include/linux/timekeeping.h\n@@ -301,6 +301,12 @@ struct sync_device_time_cb {\n extern int get_device_system_crosststamp(struct sync_device_time_cb *cb,\n \t\t\t\t\t struct system_device_crosststamp *ts);\n \n+struct system_time_snapshot;\n+/*\n+ * Simultaneously snapshot realtime and monotonic raw clocks\n+ */\n+extern void ktime_get_snapshot(struct system_time_snapshot *systime_snapshot);\n+\n /*\n * Persistent clock related interfaces\n */\ndiff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c\nindex 84534f8..26049df 100644\n--- a/kernel/time/timekeeping.c\n+++ b/kernel/time/timekeeping.c\n@@ -862,6 +862,37 @@ time64_t ktime_get_real_seconds(void)\n }\n EXPORT_SYMBOL_GPL(ktime_get_real_seconds);\n \n+/**\n+ * ktime_get_snapshot - snapshots the realtime/monotonic raw clocks with counter\n+ * @systime_snapshot:\tpointer to struct receiving the system time snapshot\n+ */\n+void ktime_get_snapshot(struct system_time_snapshot *systime_snapshot)\n+{\n+\tstruct timekeeper *tk = &tk_core.timekeeper;\n+\tunsigned long seq;\n+\tktime_t base_raw;\n+\tktime_t base_real;\n+\ts64 nsec_raw;\n+\ts64 nsec_real;\n+\tcycle_t now;\n+\n+\tdo {\n+\t\tseq = read_seqcount_begin(&tk_core.seq);\n+\n+\t\tnow = tk->tkr_mono.read(tk->tkr_mono.clock);\n+\t\tbase_real = ktime_add(tk->tkr_mono.base,\n+\t\t\t\t tk_core.timekeeper.offs_real);\n+\t\tbase_raw = tk->tkr_raw.base;\n+\t\tnsec_real = timekeeping_cycles_to_ns(&tk->tkr_mono, now);\n+\t\tnsec_raw = timekeeping_cycles_to_ns(&tk->tkr_raw, now);\n+\t} while (read_seqcount_retry(&tk_core.seq, seq));\n+\n+\tsystime_snapshot->cycles = now;\n+\tsystime_snapshot->real = ktime_add_ns(base_real, nsec_real);\n+\tsystime_snapshot->raw = ktime_add_ns(base_raw, nsec_raw);\n+}\n+EXPORT_SYMBOL_GPL(ktime_get_snapshot);\n+\n #ifdef CONFIG_NTP_PPS\n \n /**\n", "prefixes": [ "v6", "5/9" ] }