Arnd Bergmann
df27067e60
pstore: Use ktime_get_real_fast_ns() instead of __getnstimeofday()
...
__getnstimeofday() is a rather odd interface, with a number of quirks:
- The caller may come from NMI context, but the implementation is not NMI safe,
one way to get there from NMI is
NMI handler:
something bad
panic()
kmsg_dump()
pstore_dump()
pstore_record_init()
__getnstimeofday()
- The calling conventions are different from any other timekeeping functions,
to deal with returning an error code during suspended timekeeping.
Address the above issues by using a completely different method to get the
time: ktime_get_real_fast_ns() is NMI safe and has a reasonable behavior
when timekeeping is suspended: it returns the time at which it got
suspended. As Thomas Gleixner explained, this is safe, as
ktime_get_real_fast_ns() does not call into the clocksource driver that
might be suspended.
The result can easily be transformed into a timespec structure. Since
ktime_get_real_fast_ns() was not exported to modules, add the export.
The pstore behavior for the suspended case changes slightly, as it now
stores the timestamp at which timekeeping was suspended instead of storing
a zero timestamp.
This change is not addressing y2038-safety, that's subject to a more
complex follow up patch.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Kees Cook <keescook@chromium.org>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Anton Vorontsov <anton@enomsg.org>
Cc: Stephen Boyd <sboyd@codeaurora.org>
Cc: John Stultz <john.stultz@linaro.org>
Cc: Colin Cross <ccross@android.com>
Link: https://lkml.kernel.org/r/20171110152530.1926955-1-arnd@arndb.de
2017-11-12 15:05:52 +01:00
..
bpf
bpf: fix ri->map_owner pointer on bpf_prog_realloc
2017-09-19 16:38:53 -07:00
cgroup
cgroup: Reinit cgroup_taskset structure before cgroup_migrate_execute() returns
2017-09-22 08:14:45 -07:00
configs
ANDROID: binder: add hwbinder,vndbinder to BINDER_DEVICES.
2017-08-22 18:43:23 -07:00
debug
sched/headers: Prepare for new header dependencies before moving code to <linux/sched/debug.h>
2017-03-02 08:42:34 +01:00
events
perf/aux: Only update ->aux_wakeup in non-overwrite mode
2017-09-29 10:06:45 +02:00
gcov
gcov: support GCC 7.1
2017-05-12 15:57:15 -07:00
irq
timer: Remove expires and data arguments from DEFINE_TIMER
2017-10-05 15:01:20 +02:00
livepatch
livepatch: Fix stacking of patches with respect to RCU
2017-06-20 10:42:19 +02:00
locking
locking/rwsem-xadd: Fix missed wakeup due to reordering of load
2017-09-29 10:10:20 +02:00
power
Merge branch 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
2017-09-12 11:30:56 -07:00
printk
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/pmladek/printk
2017-09-07 21:00:52 -07:00
rcu
rcu: Convert timers to use timer_setup()
2017-11-02 15:44:09 -07:00
sched
sched/debug: Ignore TASK_IDLE for SysRq-W
2017-09-29 11:02:57 +02:00
time
pstore: Use ktime_get_real_fast_ns() instead of __getnstimeofday()
2017-11-12 15:05:52 +01:00
trace
sched/tracing: Use common task-state helpers
2017-09-29 11:02:45 +02:00
.gitignore
acct.c
fs: make the buf argument to __kernel_write a void pointer
2017-09-04 19:05:15 -04:00
async.c
async: Adjust system_state checks
2017-05-23 10:01:37 +02:00
audit.c
audit: update the function comments
2017-09-05 09:46:59 -04:00
audit.h
ipc: mqueue: Replace timespec with timespec64
2017-09-03 20:21:24 -04:00
audit_fsnotify.c
Merge branch 'fsnotify' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs
2017-05-03 11:05:15 -07:00
audit_tree.c
Merge branch 'fsnotify' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs
2017-05-03 11:05:15 -07:00
audit_watch.c
audit/stable-4.13 PR 20170816
2017-08-16 16:48:34 -07:00
auditfilter.c
audit: kernel generated netlink traffic should have a portid of 0
2017-05-02 10:16:05 -04:00
auditsc.c
Merge branch 'work.ipc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
2017-09-14 17:37:26 -07:00
backtracetest.c
bounds.c
capability.c
compat.c
semtimedop(): move compat to native
2017-07-15 20:46:47 -04:00
configs.c
context_tracking.c
cpu.c
smp/hotplug: Hotplug state fail injection
2017-09-25 22:11:44 +02:00
cpu_pm.c
PM / CPU: replace raw_notifier with atomic_notifier
2017-07-31 13:09:49 +02:00
crash_core.c
kdump: protect vmcoreinfo data under the crash memory
2017-07-12 16:26:00 -07:00
crash_dump.c
cred.c
doc: ReSTify credentials.txt
2017-05-18 10:30:19 -06:00
delayacct.c
sched/headers: Prepare to move cputime functionality from <linux/sched.h> into <linux/sched/cputime.h>
2017-03-02 08:42:39 +01:00
dma.c
elfcore.c
exec_domain.c
exit.c
fix infoleak in waitid(2)
2017-09-29 13:43:15 -04:00
extable.c
extable: Enable RCU if it is not watching in kernel_text_address()
2017-09-23 16:50:20 -04:00
fork.c
selinux/stable-4.14 PR 20170831
2017-09-12 13:21:00 -07:00
freezer.c
futex.c
futex: Fix pi_state->owner serialization
2017-09-25 16:37:11 +02:00
futex_compat.c
groups.c
kernel/groups.c: use sort library function
2017-07-10 16:32:34 -07:00
hung_task.c
kernel/hung_task.c: defer showing held locks
2017-05-08 17:15:10 -07:00
irq_work.c
jump_label.c
jump_label: Provide hotplug context variants
2017-08-10 12:28:59 +02:00
kallsyms.c
kernel/kallsyms.c: replace all_var with IS_ENABLED(CONFIG_KALLSYMS_ALL)
2017-07-10 16:32:34 -07:00
kcmp.c
kcmp: add KCMP_EPOLL_TFD mode to compare epoll target files
2017-07-12 16:26:01 -07:00
Kconfig.freezer
Kconfig.hz
Kconfig.locks
Kconfig.preempt
kcov.c
kcov: support compat processes
2017-09-08 18:26:51 -07:00
kexec.c
kdump: protect vmcoreinfo data under the crash memory
2017-07-12 16:26:00 -07:00
kexec_core.c
x86/mm, kexec: Allow kexec to be used with SME
2017-07-18 11:38:04 +02:00
kexec_file.c
kexec_file: adjust declaration of kexec_purgatory
2017-07-12 16:26:02 -07:00
kexec_internal.h
kexec_file: adjust declaration of kexec_purgatory
2017-07-12 16:26:02 -07:00
kmod.c
kmod: move #ifdef CONFIG_MODULES wrapper to Makefile
2017-09-08 18:26:51 -07:00
kprobes.c
kprobes: Ensure that jprobe probepoints are at function entry
2017-07-08 11:05:35 +02:00
ksysfs.c
kexec: move vmcoreinfo out of the kernel's .bss section
2017-07-12 16:25:59 -07:00
kthread.c
kthread: Convert callback to use from_timer()
2017-10-05 15:01:22 +02:00
latencytop.c
sched/headers: Prepare to move sched_info_on() and force_schedstat_enabled() from <linux/sched.h> to <linux/sched/stat.h>
2017-03-02 08:42:39 +01:00
Makefile
kmod: move #ifdef CONFIG_MODULES wrapper to Makefile
2017-09-08 18:26:51 -07:00
memremap.c
mm/device-public-memory: device memory cache coherent with CPU
2017-09-08 18:26:46 -07:00
module-internal.h
module.c
module: fix ddebug_remove_module()
2017-07-25 15:08:32 +02:00
module_signing.c
notifier.c
kernel/notifier.c: simplify expression
2017-02-24 17:46:56 -08:00
nsproxy.c
perf: Add PERF_RECORD_NAMESPACES to include namespaces related info
2017-03-13 15:57:41 -03:00
padata.c
padata: Avoid nested calls to cpus_read_lock() in pcrypt_init_padata()
2017-05-26 10:10:37 +02:00
panic.c
locking/refcounts, x86/asm: Implement fast refcount overflow protection
2017-08-17 10:40:26 +02:00
params.c
boot/param: Move next_arg() function to lib/cmdline.c for later reuse
2017-04-18 10:37:13 +02:00
pid.c
pids: make task_tgid_nr_ns() safe
2017-08-21 12:47:31 -07:00
pid_namespace.c
userns,pidns: Verify the userns for new pid namespaces
2017-07-20 07:43:58 -05:00
profile.c
sched/headers: Prepare to move sched_info_on() and force_schedstat_enabled() from <linux/sched.h> to <linux/sched/stat.h>
2017-03-02 08:42:39 +01:00
ptrace.c
signal: Remove kernel interal si_code magic
2017-07-24 14:30:28 -05:00
range.c
reboot.c
relay.c
Merge branch 'work.splice' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
2017-05-02 11:38:06 -07:00
resource.c
seccomp.c
seccomp: fix the usage of get/put_seccomp_filter() in seccomp_get_filter()
2017-09-27 22:51:12 -07:00
signal.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace
2017-09-11 18:34:47 -07:00
smp.c
treewide: make "nr_cpu_ids" unsigned
2017-09-08 18:26:48 -07:00
smpboot.c
sched/headers: Prepare for new header dependencies before moving code to <linux/sched/task.h>
2017-03-02 08:42:35 +01:00
smpboot.h
softirq.c
sched/core: Remove 'task' parameter and rename tsk_restore_flags() to current_restore_flags()
2017-04-11 09:06:32 +02:00
stacktrace.c
stacktrace/x86: add function for detecting reliable stack traces
2017-03-08 09:18:02 +01:00
stop_machine.c
stop_machine: Provide stop_machine_cpuslocked()
2017-05-26 10:10:36 +02:00
sys.c
prctl: Allow local CAP_SYS_ADMIN changing exe_file
2017-07-20 07:46:07 -05:00
sys_ni.c
sysctl.c
sched/sysctl: Check user input value of sysctl_sched_time_avg
2017-09-29 13:20:13 +02:00
sysctl_binary.c
fs: fix kernel_write prototype
2017-09-04 19:05:15 -04:00
task_work.c
task_work: Replace spin_unlock_wait() with lock/unlock pair
2017-07-25 10:08:58 -07:00
taskstats.c
taskstats: add e/u/stime for TGID command
2017-05-08 17:15:12 -07:00
test_kprobes.c
torture.c
torture: Fix typo suppressing CPU-hotplug statistics
2017-07-25 13:04:45 -07:00
tracepoint.c
sched/headers: Prepare for new header dependencies before moving code to <linux/sched/task.h>
2017-03-02 08:42:35 +01:00
tsacct.c
sched/headers: Prepare to move cputime functionality from <linux/sched.h> into <linux/sched/cputime.h>
2017-03-02 08:42:39 +01:00
ucount.c
ucount: Remove the atomicity from ucount->count
2017-03-06 15:26:37 -06:00
uid16.c
sched/headers: Prepare to remove <linux/cred.h> inclusion from <linux/sched.h>
2017-03-02 08:42:31 +01:00
umh.c
kmod: split out umh code into its own file
2017-09-08 18:26:50 -07:00
up.c
smp: Avoid using two cache lines for struct call_single_data
2017-08-29 15:14:38 +02:00
user-return-notifier.c
user.c
sched/headers: Prepare for new header dependencies before moving code to <linux/sched/user.h>
2017-03-02 08:42:29 +01:00
user_namespace.c
userns,pidns: Verify the userns for new pid namespaces
2017-07-20 07:43:58 -05:00
utsname.c
sched/headers: Prepare to move the task_lock()/unlock() APIs to <linux/sched/task.h>
2017-03-02 08:42:38 +01:00
utsname_sysctl.c
sched/headers: Remove <linux/rwsem.h> from <linux/sched.h>
2017-03-03 01:45:36 +01:00
watchdog.c
kernel/watchdog: Prevent false positives with turbo modes
2017-08-18 12:35:02 +02:00
watchdog_hld.c
kernel/watchdog: Prevent false positives with turbo modes
2017-08-18 12:35:02 +02:00
workqueue.c
workqueue: Convert timers to use timer_setup() (part 2)
2017-10-18 17:04:25 +02:00
workqueue_internal.h