From: Torben Hohn <torbenh@gmx.de>
To: linux-kernel@vger.kernel.org
Cc: Thomas Gleixner <tglx@linutronix.de>,
linuxpps@ml.enneenne.com, Torben Hohn <torbenh@gmx.de>
Subject: [PATCH 3/5] RFC genirq: save irq timestamps in void *dev_id
Date: Mon, 21 Mar 2011 12:59:18 +0100 [thread overview]
Message-ID: <1300708760-27910-3-git-send-email-torbenh@gmx.de> (raw)
In-Reply-To: <1300708760-27910-1-git-send-email-torbenh@gmx.de>
To make the timestamps accessible to the irq handler,
we mandate that IRQF_TIMESTAMP irqs have their dev_id
point to a struct timespec, where the timestamp is stored.
Genirq will fill in the timestamp before calling the irq handler.
Signed-off-by: Torben Hohn <torbenh@gmx.de>
---
kernel/irq/handle.c | 6 ++++++
kernel/irq/manage.c | 9 +++++++++
2 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c
index 3540a71..4edcd03 100644
--- a/kernel/irq/handle.c
+++ b/kernel/irq/handle.c
@@ -64,6 +64,12 @@ irqreturn_t handle_IRQ_event(unsigned int irq, struct irqaction *action)
unsigned int status = 0;
do {
+ if (action->flags & IRQF_TIMESTAMP) {
+ struct timespec *ts = action->dev_id;
+ struct irq_desc *desc = irq_to_desc(irq);
+ *ts = desc->last_timestamp;
+ }
+
trace_irq_handler_entry(irq, action);
ret = action->handler(irq, action->dev_id);
trace_irq_handler_exit(irq, action, ret);
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index adbf6c9..b60350f 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -972,6 +972,8 @@ static struct irqaction *__free_irq(unsigned int irq, void *dev_id)
* 'real' IRQ doesn't run in * parallel with our fake. )
*/
if (action->flags & IRQF_SHARED) {
+ if (action->flags & IRQF_TIMESTAMP)
+ getrawmonotonic((struct timespec *)dev_id);
local_irq_save(flags);
action->handler(irq, dev_id);
local_irq_restore(flags);
@@ -1068,6 +1070,10 @@ EXPORT_SYMBOL(free_irq);
* IRQF_SHARED Interrupt is shared
* IRQF_SAMPLE_RANDOM The interrupt can be used for entropy
* IRQF_TRIGGER_* Specify active edge(s) or level
+ * IRQF_TIMESTAMP Interrupt gets timestamped. (in this
+ * case dev_id MUST point to a
+ * struct timespec which will be filled
+ * with the timestamp)
*
*/
int request_threaded_irq(unsigned int irq, irq_handler_t handler,
@@ -1127,6 +1133,9 @@ int request_threaded_irq(unsigned int irq, irq_handler_t handler,
*/
unsigned long flags;
+ if (irqflags & IRQF_TIMESTAMP)
+ getrawmonotonic((struct timespec *)dev_id);
+
disable_irq(irq);
local_irq_save(flags);
--
1.7.2.3
next prev parent reply other threads:[~2011-03-21 11:59 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-21 11:59 [PATCH 1/5] RFC genirq: Add IRQ timestamping Torben Hohn
2011-03-21 11:59 ` [PATCH 2/5] RFC genirq: add function to retrieve timestamp from irqdesc Torben Hohn
2011-03-21 11:59 ` Torben Hohn [this message]
2011-03-21 11:59 ` [PATCH 4/5] RFC genirq: allow dynamic switching of timestamping irqs Torben Hohn
2011-03-21 11:59 ` [PATCH 5/5] RFC genirq: enforce dev_id to be struct timespec * with IRQF_TIMESTAMP Torben Hohn
2011-03-21 12:43 ` [PATCH 1/5] RFC genirq: Add IRQ timestamping torbenh
2011-03-22 2:33 ` john stultz
2011-03-22 13:32 ` torbenh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1300708760-27910-3-git-send-email-torbenh@gmx.de \
--to=torbenh@gmx.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxpps@ml.enneenne.com \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®