summaryrefslogtreecommitdiff
path: root/kernel/irq/handle.c
diff options
context:
space:
mode:
authorDaniel Lezcano <daniel.lezcano@linaro.org>2016-01-26 23:36:48 +0100
committerDaniel Lezcano <daniel.lezcano@linaro.org>2017-06-20 23:14:17 +0200
commitd883e1664730949d4f16353f41c414d945382ed9 (patch)
tree3867373c8d777485a63a8b6c3545c380fb4f31e8 /kernel/irq/handle.c
parent8573e6ec7b04603d45c815de5b6e92d3c952f461 (diff)
irq: Track the interrupt timings
The interrupt framework gives a lot of information about each interrupt. It does not keep track of when those interrupts occur though. This patch provides a mean to record the timestamp for each interrupt occurrences in a per-CPU circular buffer to help with the prediction of the next occurrence using a statistical model. Each CPU can store IRQ_TIMINGS_SIZE events <irq, timestamp>, the current value of IRQ_TIMINGS_SIZE is 32. Each event is encoded into a single u64, where the 48 bits are used for the timestamp and the next 16 bits are for the irq number. A static key is introduced so when the irq prediction is switched off at runtime, we can reduce the overhead near to zero. It results in most of the code in internals.h for inline reason and a very few in the new file timings.c. The latter will contain more in the next patch which will provide the statistical model for the next event prediction. Note this code is by default *not* compiled in the kernel. Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Rafael J. Wysocki <rafael@kernel.org> Cc: Vincent Guittot <vincent.guittot@linaro.org> --- Changelog: V11: - No changes V10: - No changes V9: - Changed indentation level by inverting the static key condition - Encoded interrupt and timestamp into a u64 variable - Boolean enable instead of refcount for the static key V8: - Replaced percpu field in the irqdesc by a percpu array containing the timings and the associated irq. The function irq_timings_get_next()is no longer needed, so it is removed - Removed all unused code resulting from the conversion irqdesc->percpu timings storage V7: - Mentionned in the irq_timings_get_next() function description, the function must be called inside a rcu read locked section V6: - Renamed handle_irq_timings to record_irq_time - Stored the event time instead of the interval time - Removed the 'timestamp' field from the timings structure - Moved _handle_irq_timings content inside record_irq_time V5: - Changed comment about 'deterministic' as the comment is confusing - Added license comment in the header - Replaced irq_timings_get/put by irq_timings_enable/disable - Moved IRQS_TIMINGS check in the handle_timings inline function - Dropped 'if !prev' as it is pointless - Stored time interval in nsec basis with u64 instead of u32 - Removed redundant store - Removed the math V4: - Added a static key - Added more comments for irq_timings_get_next() - Unified some function names to be prefixed by 'irq_timings_...' - Fixed a rebase error V3: - Replaced ktime_get() by local_clock() - Shared irq are not handled - Simplified code by adding the timing in the irqdesc struct - Added a function to browse the irq timings V2: - Fixed kerneldoc comment - Removed data field from the struct irq timing - Changed the lock section comment - Removed semi-colon style with empty stub - Replaced macro by static inline - Fixed static functions declaration RFC: - initial posting
Diffstat (limited to 'kernel/irq/handle.c')
-rw-r--r--kernel/irq/handle.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c
index d3f24905852c..eb4d3e8945b8 100644
--- a/kernel/irq/handle.c
+++ b/kernel/irq/handle.c
@@ -138,6 +138,8 @@ irqreturn_t __handle_irq_event_percpu(struct irq_desc *desc, unsigned int *flags
unsigned int irq = desc->irq_data.irq;
struct irqaction *action;
+ record_irq_time(desc);
+
for_each_action_of_desc(desc, action) {
irqreturn_t res;