Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1675827
| From | Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 4.9 26/44] arm64/vdso: Fix nsec handling for CLOCK_MONOTONIC_RAW |
| Date | 2017-06-27 16:40 +0200 |
| Message-ID | <tWZOP-1NK-37@gated-at.bofh.it> (permalink) |
| References | <tWZvs-1FM-23@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Will Deacon <will.deacon@arm.com>
commit dbb236c1ceb697a559e0694ac4c9e7b9131d0b16 upstream.
Recently vDSO support for CLOCK_MONOTONIC_RAW was added in
49eea433b326 ("arm64: Add support for CLOCK_MONOTONIC_RAW in
clock_gettime() vDSO"). Noticing that the core timekeeping code
never set tkr_raw.xtime_nsec, the vDSO implementation didn't
bother exposing it via the data page and instead took the
unshifted tk->raw_time.tv_nsec value which was then immediately
shifted left in the vDSO code.
Unfortunately, by accellerating the MONOTONIC_RAW clockid, it
uncovered potential 1ns time inconsistencies caused by the
timekeeping core not handing sub-ns resolution.
Now that the core code has been fixed and is actually setting
tkr_raw.xtime_nsec, we need to take that into account in the
vDSO by adding it to the shifted raw_time value, in order to
fix the user-visible inconsistency. Rather than do that at each
use (and expand the data page in the process), instead perform
the shift/addition operation when populating the data page and
remove the shift from the vDSO code entirely.
[jstultz: minor whitespace tweak, tried to improve commit
message to make it more clear this fixes a regression]
Reported-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Tested-by: Daniel Mentz <danielmentz@google.com>
Acked-by: Kevin Brodsky <kevin.brodsky@arm.com>
Cc: Prarit Bhargava <prarit@redhat.com>
Cc: Richard Cochran <richardcochran@gmail.com>
Cc: Stephen Boyd <stephen.boyd@linaro.org>
Cc: Miroslav Lichvar <mlichvar@redhat.com>
Link: http://lkml.kernel.org/r/1496965462-20003-4-git-send-email-john.stultz@linaro.org
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/arm64/kernel/vdso.c | 5 +++--
arch/arm64/kernel/vdso/gettimeofday.S | 1 -
2 files changed, 3 insertions(+), 3 deletions(-)
--- a/arch/arm64/kernel/vdso.c
+++ b/arch/arm64/kernel/vdso.c
@@ -217,10 +217,11 @@ void update_vsyscall(struct timekeeper *
/* tkr_mono.cycle_last == tkr_raw.cycle_last */
vdso_data->cs_cycle_last = tk->tkr_mono.cycle_last;
vdso_data->raw_time_sec = tk->raw_time.tv_sec;
- vdso_data->raw_time_nsec = tk->raw_time.tv_nsec;
+ vdso_data->raw_time_nsec = (tk->raw_time.tv_nsec <<
+ tk->tkr_raw.shift) +
+ tk->tkr_raw.xtime_nsec;
vdso_data->xtime_clock_sec = tk->xtime_sec;
vdso_data->xtime_clock_nsec = tk->tkr_mono.xtime_nsec;
- /* tkr_raw.xtime_nsec == 0 */
vdso_data->cs_mono_mult = tk->tkr_mono.mult;
vdso_data->cs_raw_mult = tk->tkr_raw.mult;
/* tkr_mono.shift == tkr_raw.shift */
--- a/arch/arm64/kernel/vdso/gettimeofday.S
+++ b/arch/arm64/kernel/vdso/gettimeofday.S
@@ -256,7 +256,6 @@ monotonic_raw:
seqcnt_check fail=monotonic_raw
/* All computations are done with left-shifted nsecs. */
- lsl x14, x14, x12
get_nsec_per_sec res=x9
lsl x9, x9, x12
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 4.9 00/44] 4.9.35-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-06-27 16:20 +0200
[PATCH 4.9 16/44] HID: Add quirk for Dell PIXART OEM mouse Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-06-27 16:20 +0200
[PATCH 4.9 14/44] CIFS: Improve readdir verbosity Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-06-27 16:20 +0200
[PATCH 4.9 42/44] net: phy: fix marvell phy status reading Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-06-27 16:20 +0200
[PATCH 4.9 10/44] perf/x86/intel: Add 1G DTLB load/store miss support for SKL Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-06-27 16:20 +0200
[PATCH 4.9 07/44] powerpc/perf: Fix oops when kthread execs user process Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-06-27 16:20 +0200
[PATCH 4.9 11/44] KVM: s390: gaccess: fix real-space designation asce handling for gmap shadows Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-06-27 16:20 +0200
[PATCH 4.9 21/44] brcmfmac: add parameter to pass error code in firmware callback Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-06-27 16:20 +0200
[PATCH 4.9 37/44] usb: gadget: f_fs: avoid out of bounds access on comp_desc Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-06-27 16:20 +0200
[PATCH 4.9 15/44] cxgb4: notify uP to route ctrlq compl to rdma rspq Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-06-27 16:20 +0200
[PATCH 4.9 35/44] of: Add check to of_scan_flat_dt() before accessing initial_boot_params Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-06-27 16:40 +0200
[PATCH 4.9 06/44] fs/exec.c: account for argv/envp pointers Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-06-27 16:40 +0200
[PATCH 4.9 27/44] target: Fix kref->refcount underflow in transport_cmd_finish_abort Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-06-27 16:40 +0200
[PATCH 4.9 12/44] KVM: PPC: Book3S HV: Preserve userspace HTM state properly Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-06-27 16:40 +0200
[PATCH 4.9 03/44] xen-blkback: dont leak stack data via response ring Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-06-27 16:40 +0200
[PATCH 4.9 09/44] lib/cmdline.c: fix get_options() overflow while parsing ranges Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-06-27 16:40 +0200
[PATCH 4.9 23/44] brcmfmac: unbind all devices upon failure in firmware callback Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-06-27 16:40 +0200
[PATCH 4.9 38/44] rt2x00: avoid introducing a USB dependency in the rt2x00lib module Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-06-27 16:40 +0200
[PATCH 4.9 28/44] iscsi-target: Fix delayed logout processing greater than SECONDS_FOR_LOGOUT_COMP Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-06-27 16:40 +0200
[PATCH 4.9 05/44] ALSA: pcm: Dont treat NULL chmap as a fatal error Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-06-27 16:40 +0200
[PATCH 4.9 30/44] drm/radeon: add a PX quirk for another K53TK variant Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-06-27 16:40 +0200
[PATCH 4.9 26/44] arm64/vdso: Fix nsec handling for CLOCK_MONOTONIC_RAW Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-06-27 16:40 +0200
[PATCH 4.9 22/44] brcmfmac: use firmware callback upon failure to load Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-06-27 16:40 +0200
[PATCH 4.9 04/44] ALSA: firewire-lib: Fix stall of process context at packet error Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-06-27 16:40 +0200
[PATCH 4.9 08/44] autofs: sanity check status reported with AUTOFS_DEV_IOCTL_FAIL Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-06-27 16:40 +0200
[PATCH 4.9 40/44] dmaengine: bcm2835: Fix cyclic DMA period splitting Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-06-27 16:40 +0200
[PATCH 4.9 31/44] drm/radeon: add a quirk for Toshiba Satellite L20-183 Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-06-27 16:40 +0200
[PATCH 4.9 19/44] powerpc/64s: Handle data breakpoints in Radix mode Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-06-27 16:40 +0200
[PATCH 4.9 39/44] net: phy: Initialize mdio clock at probe function Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-06-27 16:40 +0200
[PATCH 4.9 25/44] time: Fix CLOCK_MONOTONIC_RAW sub-nanosecond accounting Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-06-27 16:40 +0200
[PATCH 4.9 29/44] iscsi-target: Reject immediate data underflow larger than SCSI transfer length Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-06-27 16:40 +0200
[PATCH 4.9 20/44] Input: i8042 - add Fujitsu Lifebook AH544 to notimeout list Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-06-27 16:50 +0200
[PATCH 4.9 18/44] powerpc/kprobes: Pause function_graph tracing during jprobes handling Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-06-27 16:50 +0200
Re: [PATCH 4.9 00/44] 4.9.35-stable review Sumit Semwal <sumit.semwal@linaro.org> - 2017-06-27 19:40 +0200
Re: [PATCH 4.9 00/44] 4.9.35-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-06-28 14:10 +0200
Re: [PATCH 4.9 00/44] 4.9.35-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-06-27 20:40 +0200
Re: [PATCH 4.9 00/44] 4.9.35-stable review Guenter Roeck <linux@roeck-us.net> - 2017-06-27 21:10 +0200
Re: [PATCH 4.9 00/44] 4.9.35-stable review Shuah Khan <shuahkh@osg.samsung.com> - 2017-06-28 16:00 +0200
csiph-web