diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-12-12 22:56:15 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-12-12 22:56:15 -0500 |
| commit | 9465d9cc31fa732089cd8bec9f1bdfcdc174a5ce (patch) | |
| tree | fb31a0a6271b255ffe6e29b4f9eb4192253f8c7f /include | |
| parent | e71c3978d6f97659f6c3ee942c3e581299e4adf2 (diff) | |
| parent | c029a2bec66e42e57538cb65e28618baf6a4b311 (diff) | |
Merge branch 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull timer updates from Thomas Gleixner:
"The time/timekeeping/timer folks deliver with this update:
- Fix a reintroduced signed/unsigned issue and cleanup the whole
signed/unsigned mess in the timekeeping core so this wont happen
accidentaly again.
- Add a new trace clock based on boot time
- Prevent injection of random sleep times when PM tracing abuses the
RTC for storage
- Make posix timers configurable for real tiny systems
- Add tracepoints for the alarm timer subsystem so timer based
suspend wakeups can be instrumented
- The usual pile of fixes and updates to core and drivers"
* 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (23 commits)
timekeeping: Use mul_u64_u32_shr() instead of open coding it
timekeeping: Get rid of pointless typecasts
timekeeping: Make the conversion call chain consistently unsigned
timekeeping_Force_unsigned_clocksource_to_nanoseconds_conversion
alarmtimer: Add tracepoints for alarm timers
trace: Update documentation for mono, mono_raw and boot clock
trace: Add an option for boot clock as trace clock
timekeeping: Add a fast and NMI safe boot clock
timekeeping/clocksource_cyc2ns: Document intended range limitation
timekeeping: Ignore the bogus sleep time if pm_trace is enabled
selftests/timers: Fix spelling mistake "Asyncrhonous" -> "Asynchronous"
clocksource/drivers/bcm2835_timer: Unmap region obtained by of_iomap
clocksource/drivers/arm_arch_timer: Map frame with of_io_request_and_map()
arm64: dts: rockchip: Arch counter doesn't tick in system suspend
clocksource/drivers/arm_arch_timer: Don't assume clock runs in suspend
posix-timers: Make them configurable
posix_cpu_timers: Move the add_device_randomness() call to a proper place
timer: Move sys_alarm from timer.c to itimer.c
ptp_clock: Allow for it to be optional
Kconfig: Regenerate *.c_shipped files after previous changes
...
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/alarmtimer.h | 5 | ||||
| -rw-r--r-- | include/linux/clocksource.h | 5 | ||||
| -rw-r--r-- | include/linux/mc146818rtc.h | 1 | ||||
| -rw-r--r-- | include/linux/pm-trace.h | 9 | ||||
| -rw-r--r-- | include/linux/ptp_clock_kernel.h | 65 | ||||
| -rw-r--r-- | include/linux/time.h | 2 | ||||
| -rw-r--r-- | include/linux/timekeeping.h | 1 | ||||
| -rw-r--r-- | include/trace/events/alarmtimer.h | 96 |
8 files changed, 156 insertions, 28 deletions
diff --git a/include/linux/alarmtimer.h b/include/linux/alarmtimer.h index 9d8031257a90..c70aac13244a 100644 --- a/include/linux/alarmtimer.h +++ b/include/linux/alarmtimer.h | |||
| @@ -10,7 +10,12 @@ enum alarmtimer_type { | |||
| 10 | ALARM_REALTIME, | 10 | ALARM_REALTIME, |
| 11 | ALARM_BOOTTIME, | 11 | ALARM_BOOTTIME, |
| 12 | 12 | ||
| 13 | /* Supported types end here */ | ||
| 13 | ALARM_NUMTYPE, | 14 | ALARM_NUMTYPE, |
| 15 | |||
| 16 | /* Used for tracing information. No usable types. */ | ||
| 17 | ALARM_REALTIME_FREEZER, | ||
| 18 | ALARM_BOOTTIME_FREEZER, | ||
| 14 | }; | 19 | }; |
| 15 | 20 | ||
| 16 | enum alarmtimer_restart { | 21 | enum alarmtimer_restart { |
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h index 08398182f56e..65602d395a52 100644 --- a/include/linux/clocksource.h +++ b/include/linux/clocksource.h | |||
| @@ -169,7 +169,10 @@ static inline u32 clocksource_hz2mult(u32 hz, u32 shift_constant) | |||
| 169 | * @mult: cycle to nanosecond multiplier | 169 | * @mult: cycle to nanosecond multiplier |
| 170 | * @shift: cycle to nanosecond divisor (power of two) | 170 | * @shift: cycle to nanosecond divisor (power of two) |
| 171 | * | 171 | * |
| 172 | * Converts cycles to nanoseconds, using the given mult and shift. | 172 | * Converts clocksource cycles to nanoseconds, using the given @mult and @shift. |
| 173 | * The code is optimized for performance and is not intended to work | ||
| 174 | * with absolute clocksource cycles (as those will easily overflow), | ||
| 175 | * but is only intended to be used with relative (delta) clocksource cycles. | ||
| 173 | * | 176 | * |
| 174 | * XXX - This could use some mult_lxl_ll() asm optimization | 177 | * XXX - This could use some mult_lxl_ll() asm optimization |
| 175 | */ | 178 | */ |
diff --git a/include/linux/mc146818rtc.h b/include/linux/mc146818rtc.h index a585b4b5fa0e..0661af17a758 100644 --- a/include/linux/mc146818rtc.h +++ b/include/linux/mc146818rtc.h | |||
| @@ -16,6 +16,7 @@ | |||
| 16 | #include <asm/mc146818rtc.h> /* register access macros */ | 16 | #include <asm/mc146818rtc.h> /* register access macros */ |
| 17 | #include <linux/bcd.h> | 17 | #include <linux/bcd.h> |
| 18 | #include <linux/delay.h> | 18 | #include <linux/delay.h> |
| 19 | #include <linux/pm-trace.h> | ||
| 19 | 20 | ||
| 20 | #ifdef __KERNEL__ | 21 | #ifdef __KERNEL__ |
| 21 | #include <linux/spinlock.h> /* spinlock_t */ | 22 | #include <linux/spinlock.h> /* spinlock_t */ |
diff --git a/include/linux/pm-trace.h b/include/linux/pm-trace.h index ecbde7a5548e..7b78793f07d7 100644 --- a/include/linux/pm-trace.h +++ b/include/linux/pm-trace.h | |||
| @@ -1,11 +1,17 @@ | |||
| 1 | #ifndef PM_TRACE_H | 1 | #ifndef PM_TRACE_H |
| 2 | #define PM_TRACE_H | 2 | #define PM_TRACE_H |
| 3 | 3 | ||
| 4 | #include <linux/types.h> | ||
| 4 | #ifdef CONFIG_PM_TRACE | 5 | #ifdef CONFIG_PM_TRACE |
| 5 | #include <asm/pm-trace.h> | 6 | #include <asm/pm-trace.h> |
| 6 | #include <linux/types.h> | ||
| 7 | 7 | ||
| 8 | extern int pm_trace_enabled; | 8 | extern int pm_trace_enabled; |
| 9 | extern bool pm_trace_rtc_abused; | ||
| 10 | |||
| 11 | static inline bool pm_trace_rtc_valid(void) | ||
| 12 | { | ||
| 13 | return !pm_trace_rtc_abused; | ||
| 14 | } | ||
| 9 | 15 | ||
| 10 | static inline int pm_trace_is_enabled(void) | 16 | static inline int pm_trace_is_enabled(void) |
| 11 | { | 17 | { |
| @@ -24,6 +30,7 @@ extern int show_trace_dev_match(char *buf, size_t size); | |||
| 24 | 30 | ||
| 25 | #else | 31 | #else |
| 26 | 32 | ||
| 33 | static inline bool pm_trace_rtc_valid(void) { return true; } | ||
| 27 | static inline int pm_trace_is_enabled(void) { return 0; } | 34 | static inline int pm_trace_is_enabled(void) { return 0; } |
| 28 | 35 | ||
| 29 | #define TRACE_DEVICE(dev) do { } while (0) | 36 | #define TRACE_DEVICE(dev) do { } while (0) |
diff --git a/include/linux/ptp_clock_kernel.h b/include/linux/ptp_clock_kernel.h index b76d47aba564..a026bfd089db 100644 --- a/include/linux/ptp_clock_kernel.h +++ b/include/linux/ptp_clock_kernel.h | |||
| @@ -130,30 +130,6 @@ struct ptp_clock_info { | |||
| 130 | 130 | ||
| 131 | struct ptp_clock; | 131 | struct ptp_clock; |
| 132 | 132 | ||
| 133 | /** | ||
| 134 | * ptp_clock_register() - register a PTP hardware clock driver | ||
| 135 | * | ||
| 136 | * @info: Structure describing the new clock. | ||
| 137 | * @parent: Pointer to the parent device of the new clock. | ||
| 138 | * | ||
| 139 | * Returns a valid pointer on success or PTR_ERR on failure. If PHC | ||
| 140 | * support is missing at the configuration level, this function | ||
| 141 | * returns NULL, and drivers are expected to gracefully handle that | ||
| 142 | * case separately. | ||
| 143 | */ | ||
| 144 | |||
| 145 | extern struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info, | ||
| 146 | struct device *parent); | ||
| 147 | |||
| 148 | /** | ||
| 149 | * ptp_clock_unregister() - unregister a PTP hardware clock driver | ||
| 150 | * | ||
| 151 | * @ptp: The clock to remove from service. | ||
| 152 | */ | ||
| 153 | |||
| 154 | extern int ptp_clock_unregister(struct ptp_clock *ptp); | ||
| 155 | |||
| 156 | |||
| 157 | enum ptp_clock_events { | 133 | enum ptp_clock_events { |
| 158 | PTP_CLOCK_ALARM, | 134 | PTP_CLOCK_ALARM, |
| 159 | PTP_CLOCK_EXTTS, | 135 | PTP_CLOCK_EXTTS, |
| @@ -179,6 +155,31 @@ struct ptp_clock_event { | |||
| 179 | }; | 155 | }; |
| 180 | }; | 156 | }; |
| 181 | 157 | ||
| 158 | #if IS_REACHABLE(CONFIG_PTP_1588_CLOCK) | ||
| 159 | |||
| 160 | /** | ||
| 161 | * ptp_clock_register() - register a PTP hardware clock driver | ||
| 162 | * | ||
| 163 | * @info: Structure describing the new clock. | ||
| 164 | * @parent: Pointer to the parent device of the new clock. | ||
| 165 | * | ||
| 166 | * Returns a valid pointer on success or PTR_ERR on failure. If PHC | ||
| 167 | * support is missing at the configuration level, this function | ||
| 168 | * returns NULL, and drivers are expected to gracefully handle that | ||
| 169 | * case separately. | ||
| 170 | */ | ||
| 171 | |||
| 172 | extern struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info, | ||
| 173 | struct device *parent); | ||
| 174 | |||
| 175 | /** | ||
| 176 | * ptp_clock_unregister() - unregister a PTP hardware clock driver | ||
| 177 | * | ||
| 178 | * @ptp: The clock to remove from service. | ||
| 179 | */ | ||
| 180 | |||
| 181 | extern int ptp_clock_unregister(struct ptp_clock *ptp); | ||
| 182 | |||
| 182 | /** | 183 | /** |
| 183 | * ptp_clock_event() - notify the PTP layer about an event | 184 | * ptp_clock_event() - notify the PTP layer about an event |
| 184 | * | 185 | * |
| @@ -210,4 +211,20 @@ extern int ptp_clock_index(struct ptp_clock *ptp); | |||
| 210 | int ptp_find_pin(struct ptp_clock *ptp, | 211 | int ptp_find_pin(struct ptp_clock *ptp, |
| 211 | enum ptp_pin_function func, unsigned int chan); | 212 | enum ptp_pin_function func, unsigned int chan); |
| 212 | 213 | ||
| 214 | #else | ||
| 215 | static inline struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info, | ||
| 216 | struct device *parent) | ||
| 217 | { return NULL; } | ||
| 218 | static inline int ptp_clock_unregister(struct ptp_clock *ptp) | ||
| 219 | { return 0; } | ||
| 220 | static inline void ptp_clock_event(struct ptp_clock *ptp, | ||
| 221 | struct ptp_clock_event *event) | ||
| 222 | { } | ||
| 223 | static inline int ptp_clock_index(struct ptp_clock *ptp) | ||
| 224 | { return -1; } | ||
| 225 | static inline int ptp_find_pin(struct ptp_clock *ptp, | ||
| 226 | enum ptp_pin_function func, unsigned int chan) | ||
| 227 | { return -1; } | ||
| 228 | #endif | ||
| 229 | |||
| 213 | #endif | 230 | #endif |
diff --git a/include/linux/time.h b/include/linux/time.h index 4cea09d94208..23f0f5ce3090 100644 --- a/include/linux/time.h +++ b/include/linux/time.h | |||
| @@ -172,8 +172,6 @@ extern int do_setitimer(int which, struct itimerval *value, | |||
| 172 | struct itimerval *ovalue); | 172 | struct itimerval *ovalue); |
| 173 | extern int do_getitimer(int which, struct itimerval *value); | 173 | extern int do_getitimer(int which, struct itimerval *value); |
| 174 | 174 | ||
| 175 | extern unsigned int alarm_setitimer(unsigned int seconds); | ||
| 176 | |||
| 177 | extern long do_utimes(int dfd, const char __user *filename, struct timespec *times, int flags); | 175 | extern long do_utimes(int dfd, const char __user *filename, struct timespec *times, int flags); |
| 178 | 176 | ||
| 179 | struct tms; | 177 | struct tms; |
diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h index 09168c52ab64..361f8bf1429d 100644 --- a/include/linux/timekeeping.h +++ b/include/linux/timekeeping.h | |||
| @@ -249,6 +249,7 @@ static inline u64 ktime_get_raw_ns(void) | |||
| 249 | 249 | ||
| 250 | extern u64 ktime_get_mono_fast_ns(void); | 250 | extern u64 ktime_get_mono_fast_ns(void); |
| 251 | extern u64 ktime_get_raw_fast_ns(void); | 251 | extern u64 ktime_get_raw_fast_ns(void); |
| 252 | extern u64 ktime_get_boot_fast_ns(void); | ||
| 252 | 253 | ||
| 253 | /* | 254 | /* |
| 254 | * Timespec interfaces utilizing the ktime based ones | 255 | * Timespec interfaces utilizing the ktime based ones |
diff --git a/include/trace/events/alarmtimer.h b/include/trace/events/alarmtimer.h new file mode 100644 index 000000000000..a1c108c16c9c --- /dev/null +++ b/include/trace/events/alarmtimer.h | |||
| @@ -0,0 +1,96 @@ | |||
| 1 | #undef TRACE_SYSTEM | ||
| 2 | #define TRACE_SYSTEM alarmtimer | ||
| 3 | |||
| 4 | #if !defined(_TRACE_ALARMTIMER_H) || defined(TRACE_HEADER_MULTI_READ) | ||
| 5 | #define _TRACE_ALARMTIMER_H | ||
| 6 | |||
| 7 | #include <linux/alarmtimer.h> | ||
| 8 | #include <linux/rtc.h> | ||
| 9 | #include <linux/tracepoint.h> | ||
| 10 | |||
| 11 | TRACE_DEFINE_ENUM(ALARM_REALTIME); | ||
| 12 | TRACE_DEFINE_ENUM(ALARM_BOOTTIME); | ||
| 13 | TRACE_DEFINE_ENUM(ALARM_REALTIME_FREEZER); | ||
| 14 | TRACE_DEFINE_ENUM(ALARM_BOOTTIME_FREEZER); | ||
| 15 | |||
| 16 | #define show_alarm_type(type) __print_flags(type, " | ", \ | ||
| 17 | { 1 << ALARM_REALTIME, "REALTIME" }, \ | ||
| 18 | { 1 << ALARM_BOOTTIME, "BOOTTIME" }, \ | ||
| 19 | { 1 << ALARM_REALTIME_FREEZER, "REALTIME Freezer" }, \ | ||
| 20 | { 1 << ALARM_BOOTTIME_FREEZER, "BOOTTIME Freezer" }) | ||
| 21 | |||
| 22 | TRACE_EVENT(alarmtimer_suspend, | ||
| 23 | |||
| 24 | TP_PROTO(ktime_t expires, int flag), | ||
| 25 | |||
| 26 | TP_ARGS(expires, flag), | ||
| 27 | |||
| 28 | TP_STRUCT__entry( | ||
| 29 | __field(s64, expires) | ||
| 30 | __field(unsigned char, alarm_type) | ||
| 31 | ), | ||
| 32 | |||
| 33 | TP_fast_assign( | ||
| 34 | __entry->expires = expires.tv64; | ||
| 35 | __entry->alarm_type = flag; | ||
| 36 | ), | ||
| 37 | |||
| 38 | TP_printk("alarmtimer type:%s expires:%llu", | ||
| 39 | show_alarm_type((1 << __entry->alarm_type)), | ||
| 40 | __entry->expires | ||
| 41 | ) | ||
| 42 | ); | ||
| 43 | |||
| 44 | DECLARE_EVENT_CLASS(alarm_class, | ||
| 45 | |||
| 46 | TP_PROTO(struct alarm *alarm, ktime_t now), | ||
| 47 | |||
| 48 | TP_ARGS(alarm, now), | ||
| 49 | |||
| 50 | TP_STRUCT__entry( | ||
| 51 | __field(void *, alarm) | ||
| 52 | __field(unsigned char, alarm_type) | ||
| 53 | __field(s64, expires) | ||
| 54 | __field(s64, now) | ||
| 55 | ), | ||
| 56 | |||
| 57 | TP_fast_assign( | ||
| 58 | __entry->alarm = alarm; | ||
| 59 | __entry->alarm_type = alarm->type; | ||
| 60 | __entry->expires = alarm->node.expires.tv64; | ||
| 61 | __entry->now = now.tv64; | ||
| 62 | ), | ||
| 63 | |||
| 64 | TP_printk("alarmtimer:%p type:%s expires:%llu now:%llu", | ||
| 65 | __entry->alarm, | ||
| 66 | show_alarm_type((1 << __entry->alarm_type)), | ||
| 67 | __entry->expires, | ||
| 68 | __entry->now | ||
| 69 | ) | ||
| 70 | ); | ||
| 71 | |||
| 72 | DEFINE_EVENT(alarm_class, alarmtimer_fired, | ||
| 73 | |||
| 74 | TP_PROTO(struct alarm *alarm, ktime_t now), | ||
| 75 | |||
| 76 | TP_ARGS(alarm, now) | ||
| 77 | ); | ||
| 78 | |||
| 79 | DEFINE_EVENT(alarm_class, alarmtimer_start, | ||
| 80 | |||
| 81 | TP_PROTO(struct alarm *alarm, ktime_t now), | ||
| 82 | |||
| 83 | TP_ARGS(alarm, now) | ||
| 84 | ); | ||
| 85 | |||
| 86 | DEFINE_EVENT(alarm_class, alarmtimer_cancel, | ||
| 87 | |||
| 88 | TP_PROTO(struct alarm *alarm, ktime_t now), | ||
| 89 | |||
| 90 | TP_ARGS(alarm, now) | ||
| 91 | ); | ||
| 92 | |||
| 93 | #endif /* _TRACE_ALARMTIMER_H */ | ||
| 94 | |||
| 95 | /* This part must be outside protection */ | ||
| 96 | #include <trace/define_trace.h> | ||
