summaryrefslogtreecommitdiffstats
path: root/kernel/irq/manage.c
diff options
context:
space:
mode:
authorDaniel Lezcano <daniel.lezcano@linaro.org>2017-06-23 10:11:07 -0400
committerThomas Gleixner <tglx@linutronix.de>2017-06-24 05:44:11 -0400
commitb2d3d61adb7b73cfe5f82404f7a130a76fc64232 (patch)
treea82a3e94b60f69dfd7607bee494c3f980b518177 /kernel/irq/manage.c
parentc2ce34c0a0e5187195ecade872be950d2611ba68 (diff)
genirq/timings: Add infrastructure to 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, which is a prerequisite for estimating the next interrupt arrival for power management purposes. Add a mechanism 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 up to 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 high 48 bits are used for the timestamp and the low 16 bits are for the irq number. A static key is introduced so when the irq prediction is switched off at runtime, the overhead is near to zero. It results in most of the code in internals.h for inline reasons 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. Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org> Cc: Jens Axboe <axboe@kernel.dk> Cc: Hannes Reinecke <hare@suse.com> Cc: Vincent Guittot <vincent.guittot@linaro.org> Cc: "Rafael J . Wysocki" <rafael@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Bjorn Helgaas <bhelgaas@google.com> Link: http://lkml.kernel.org/r/1498227072-5980-1-git-send-email-daniel.lezcano@linaro.org
Diffstat (limited to 'kernel/irq/manage.c')
-rw-r--r--kernel/irq/manage.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 3577c091ac7b..5c11c1730ba5 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -1348,6 +1348,8 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new)
1348 1348
1349 raw_spin_unlock_irqrestore(&desc->lock, flags); 1349 raw_spin_unlock_irqrestore(&desc->lock, flags);
1350 1350
1351 irq_setup_timings(desc, new);
1352
1351 /* 1353 /*
1352 * Strictly no need to wake it up, but hung_task complains 1354 * Strictly no need to wake it up, but hung_task complains
1353 * when no hard interrupt wakes the thread up. 1355 * when no hard interrupt wakes the thread up.
@@ -1474,6 +1476,7 @@ static struct irqaction *__free_irq(unsigned int irq, void *dev_id)
1474 irq_settings_clr_disable_unlazy(desc); 1476 irq_settings_clr_disable_unlazy(desc);
1475 irq_shutdown(desc); 1477 irq_shutdown(desc);
1476 irq_release_resources(desc); 1478 irq_release_resources(desc);
1479 irq_remove_timings(desc);
1477 } 1480 }
1478 1481
1479#ifdef CONFIG_SMP 1482#ifdef CONFIG_SMP