From: Tejun Heo <tj@kernel.org>
To: Jonathan Corbet <corbet@lwn.net>
Cc: mingo@elte.hu, tglx@linutronix.de, bphilips@suse.de,
yinghai@kernel.org, akpm@linux-foundation.org,
torvalds@linux-foundation.org, linux-kernel@vger.kernel.org,
jeff@garzik.org
Subject: Re: [PATCH 06/12 UPDATED] irq: implement irq_schedule_poll()
Date: Mon, 21 Jun 2010 15:26:18 +0200 [thread overview]
Message-ID: <4C1F687A.5030907@kernel.org> (raw)
In-Reply-To: <20100615114058.32e58afd@bike.lwn.net>
Implement and use irq_schedule_poll() to schedule desc->poll_timer
instead of calling mod_timer directly. irq_schedule_poll() is called
with desc->lock held and schedules the timer iff necessary - ie. if
the timer is offline or scheduled to expire later than requested.
This will be used to share desc->poll_timer.
* Jiri and Jonathan pointed out that IRQ_POLL_SLACK of HZ / 1000 would
yield 0 slack on the popular 250HZ config. Adjusted to HZ / 250.
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Jiri Slaby <jirislaby@gmail.com>
Cc: Jonathan Corbet <corbet@lwn.net>
---
Minor update. IRQ_POLL_SLACK bumped up to HZ / 250.
Thanks.
kernel/irq/spurious.c | 47 +++++++++++++++++++++++++++++++++++++++++------
1 file changed, 41 insertions(+), 6 deletions(-)
Index: work/kernel/irq/spurious.c
===================================================================
--- work.orig/kernel/irq/spurious.c
+++ work/kernel/irq/spurious.c
@@ -23,6 +23,8 @@ enum {
/* IRQ polling common parameters */
IRQ_POLL_INTV = HZ / 100, /* from the good ol' 100HZ tick */
+
+ IRQ_POLL_SLACK = HZ / 250, /* 1 tick slack w/ the popular 250HZ config */
};
int noirqdebug __read_mostly;
@@ -43,6 +45,38 @@ static void print_irq_handlers(struct ir
}
}
+static unsigned long irq_poll_slack(unsigned long intv)
+{
+ return IRQ_POLL_SLACK;
+}
+
+/**
+ * irq_schedule_poll - schedule IRQ poll
+ * @desc: IRQ desc to schedule poll for
+ * @intv: poll interval
+ *
+ * Schedules @desc->poll_timer. If the timer is already scheduled,
+ * it's modified iff jiffies + @intv + slack is before the timer's
+ * expires. poll_timers aren't taken offline behind this function's
+ * back and the users of this function are guaranteed that poll_irq()
+ * will be called at or before jiffies + @intv + slack.
+ *
+ * CONTEXT:
+ * desc->lock
+ */
+static void irq_schedule_poll(struct irq_desc *desc, unsigned long intv)
+{
+ unsigned long expires = jiffies + intv;
+ int slack = irq_poll_slack(intv);
+
+ if (timer_pending(&desc->poll_timer) &&
+ time_before_eq(desc->poll_timer.expires, expires + slack))
+ return;
+
+ set_timer_slack(&desc->poll_timer, slack);
+ mod_timer(&desc->poll_timer, expires);
+}
+
/*
* Recovery handler for misrouted interrupts.
*/
@@ -207,7 +241,9 @@ void __note_interrupt(unsigned int irq,
desc->depth++;
desc->chip->disable(irq);
- mod_timer(&desc->poll_timer, jiffies + IRQ_POLL_INTV);
+ raw_spin_lock(&desc->lock);
+ irq_schedule_poll(desc, IRQ_POLL_INTV);
+ raw_spin_unlock(&desc->lock);
}
desc->irqs_unhandled = 0;
}
@@ -221,9 +257,8 @@ void poll_irq(unsigned long arg)
raw_spin_lock_irq(&desc->lock);
try_one_irq(desc->irq, desc);
+ irq_schedule_poll(desc, IRQ_POLL_INTV);
raw_spin_unlock_irq(&desc->lock);
-
- mod_timer(&desc->poll_timer, jiffies + IRQ_POLL_INTV);
}
void irq_poll_action_added(struct irq_desc *desc, struct irqaction *action)
@@ -238,10 +273,10 @@ void irq_poll_action_added(struct irq_de
__enable_irq(desc, desc->irq, false);
}
- raw_spin_unlock_irqrestore(&desc->lock, flags);
-
if ((action->flags & IRQF_SHARED) && irqfixup >= IRQFIXUP_POLL)
- mod_timer(&desc->poll_timer, jiffies + IRQ_POLL_INTV);
+ irq_schedule_poll(desc, IRQ_POLL_INTV);
+
+ raw_spin_unlock_irqrestore(&desc->lock, flags);
}
void irq_poll_action_removed(struct irq_desc *desc, struct irqaction *action)
next prev parent reply other threads:[~2010-06-21 13:27 UTC|newest]
Thread overview: 90+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-13 15:31 [PATCHSET] irq: better lost/spurious irq handling Tejun Heo
2010-06-13 15:31 ` Tejun Heo
2010-06-13 15:31 ` [PATCH 01/12] irq: cleanup irqfixup Tejun Heo
2010-06-13 15:31 ` Tejun Heo
2010-06-13 15:31 ` [PATCH 02/12] irq: make spurious poll timer per desc Tejun Heo
2010-06-13 15:31 ` Tejun Heo
2010-06-15 5:10 ` Konrad Rzeszutek Wilk
2010-06-15 16:34 ` Tejun Heo
2010-06-13 15:31 ` [PATCH 03/12] irq: use desc->poll_timer for irqpoll Tejun Heo
2010-06-13 15:31 ` Tejun Heo
2010-06-13 15:31 ` [PATCH 04/12] irq: kill IRQF_IRQPOLL Tejun Heo
2010-06-13 15:31 ` Tejun Heo
2010-06-13 15:31 ` [PATCH 05/12] irq: misc preparations for further changes Tejun Heo
2010-06-13 15:31 ` Tejun Heo
2010-06-13 15:31 ` [PATCH 06/12] irq: implement irq_schedule_poll() Tejun Heo
2010-06-13 15:31 ` Tejun Heo
2010-06-15 17:40 ` Jonathan Corbet
2010-06-15 17:51 ` Tejun Heo
2010-06-21 13:26 ` Tejun Heo [this message]
2010-06-13 15:31 ` [PATCH 07/12] irq: improve spurious IRQ handling Tejun Heo
2010-06-13 15:31 ` Tejun Heo
2010-06-13 15:31 ` [PATCH 08/12] irq: implement IRQ watching Tejun Heo
2010-06-13 15:31 ` Tejun Heo
2010-06-13 15:31 ` [PATCH 09/12] irq: implement IRQ expecting Tejun Heo
2010-06-13 15:31 ` Tejun Heo
2010-06-14 9:21 ` Jiri Slaby
2010-06-14 9:43 ` Tejun Heo
2010-06-14 9:46 ` Tejun Heo
2010-06-17 3:48 ` Arjan van de Ven
2010-06-17 8:18 ` Tejun Heo
2010-06-17 11:12 ` Thomas Gleixner
2010-06-17 11:23 ` Tejun Heo
2010-06-17 11:43 ` Alan Cox
2010-06-17 15:54 ` Tejun Heo
2010-06-17 16:02 ` Arjan van de Ven
2010-06-17 16:47 ` Tejun Heo
2010-06-18 6:26 ` Arjan van de Ven
2010-06-18 9:23 ` Tejun Heo
2010-06-18 9:45 ` Thomas Gleixner
2010-06-19 8:35 ` Andi Kleen
2010-06-19 8:42 ` Tejun Heo
2010-06-19 9:00 ` Andi Kleen
2010-06-19 9:03 ` Tejun Heo
2010-06-19 14:54 ` Arjan van de Ven
2010-06-19 19:49 ` Andi Kleen
2010-06-19 20:07 ` Arjan van de Ven
2010-06-13 15:31 ` [PATCH 10/12] irq: add comment about overall design of lost/spurious IRQ handling Tejun Heo
2010-06-13 15:31 ` Tejun Heo
2010-06-13 15:31 ` [PATCH 11/12] libata: use IRQ expecting Tejun Heo
2010-06-21 13:52 ` Tejun Heo
2010-06-25 0:22 ` Jeff Garzik
2010-06-25 7:44 ` Tejun Heo
2010-06-25 9:48 ` Jeff Garzik
2010-06-25 9:51 ` Tejun Heo
2010-06-25 13:02 ` [PATCH 1/2 #upstream] sata_fsl,mv,nv: prepare for NCQ command completion update Tejun Heo
2010-06-25 13:03 ` [PATCH 2/2 #upstream] libata: always use ata_qc_complete_multiple() for NCQ command completions Tejun Heo
2010-08-17 22:03 ` Jeff Garzik
2010-08-01 23:47 ` [PATCH 1/2 #upstream] sata_fsl,mv,nv: prepare for NCQ command completion update Jeff Garzik
2010-08-02 7:18 ` Tejun Heo
2010-08-04 4:22 ` Jeff Garzik
2010-06-26 3:45 ` [PATCH 11/12] libata: use IRQ expecting Jeff Garzik
2010-06-26 3:52 ` Jeff Garzik
2010-06-26 8:31 ` Tejun Heo
2010-06-26 9:16 ` Jeff Garzik
2010-06-26 9:44 ` Tejun Heo
2010-07-02 14:41 ` Tejun Heo
2010-07-02 14:53 ` Tejun Heo
2010-07-10 10:06 ` Tejun Heo
2010-07-14 7:58 ` Jeff Garzik
2010-07-14 9:26 ` Tejun Heo
2010-07-27 17:37 ` Jeff Garzik
2010-06-13 15:31 ` Tejun Heo
2010-06-13 15:31 ` [PATCH 12/12] usb: use IRQ watching Tejun Heo
2010-06-13 15:31 ` Tejun Heo
2010-06-14 21:41 ` Greg KH
2010-06-14 21:52 ` Tejun Heo
2010-06-14 22:11 ` Greg KH
2010-06-14 22:19 ` Tejun Heo
2010-06-15 10:30 ` Kay Sievers
2010-06-15 11:05 ` Jean Delvare
2010-06-15 13:30 ` Kay Sievers
2010-06-15 11:20 ` Tejun Heo
2010-06-15 13:36 ` Kay Sievers
2010-06-15 17:36 ` Tejun Heo
2010-06-15 17:47 ` Greg KH
2010-06-15 17:52 ` Tejun Heo
2010-06-21 13:51 ` Tejun Heo
2010-06-21 20:27 ` Greg KH
2010-06-22 7:32 ` Tejun Heo
2010-07-02 14:59 ` [GIT PULL] irq: better lost/spurious irq handling Tejun Heo
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=4C1F687A.5030907@kernel.org \
--to=tj@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=bphilips@suse.de \
--cc=corbet@lwn.net \
--cc=jeff@garzik.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=yinghai@kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.