From: Esben Nielsen <nielsen.esben@googlemail.com>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@elte.hu>
Subject: [patch 4/5] [PREEMPT_RT] Changing interrupt handlers from running in thread to hardirq and back runtime.
Date: Fri, 2 Jun 2006 23:23:41 +0100 (BST) [thread overview]
Message-ID: <Pine.LNX.4.64.0606022322140.9307@localhost> (raw)
In-Reply-To: 20060602165336.147812000@localhost
Makes it possible for the 8250 serial driver to have it's interrupt handler
in both hard-irq and threaded context under PREEMPT_RT.
Index: linux-2.6.16-rt23.spin_mutex/drivers/serial/8250.c
===================================================================
--- linux-2.6.16-rt23.spin_mutex.orig/drivers/serial/8250.c
+++ linux-2.6.16-rt23.spin_mutex/drivers/serial/8250.c
@@ -140,7 +140,7 @@ struct uart_8250_port {
};
struct irq_info {
- spinlock_t lock;
+ spin_mutex_t lock;
struct list_head *head;
};
@@ -1287,6 +1287,47 @@ serial8250_handle_port(struct uart_8250_
spin_unlock(&up->port.lock);
}
+
+static int serial8250_change_context(int irq, void *dev_id,
+ enum change_context_cmd cmd)
+{
+ struct irq_info *i = dev_id;
+ struct list_head *l;
+
+ switch(cmd) {
+ case IRQ_TO_HARDIRQ:
+ /* Spin mutexes not available: */
+ if(!spin_mutexes_can_spin())
+ return -ENOSYS;
+
+ /* First do the inner locks */
+ l = i->head;
+ do {
+ struct uart_8250_port *up;
+ up = list_entry(l, struct uart_8250_port, list);
+ spin_mutex_to_spin(&up->port.lock);
+ l = l->next;
+ } while(l != i->head && l != NULL);
+ spin_mutex_to_spin(&i->lock);
+ break;
+ case IRQ_CAN_THREAD:
+ break;
+ case IRQ_TO_THREADED:
+ spin_mutex_to_mutex(&i->lock);
+ l = i->head;
+
+ do {
+ struct uart_8250_port *up;
+ up = list_entry(l, struct uart_8250_port, list);
+ spin_mutex_to_mutex(&up->port.lock);
+ l = l->next;
+ } while(l != i->head && l != NULL);
+ break;
+ }
+
+ return 0;
+}
+
/*
* This is the serial driver's interrupt routine.
*
@@ -1393,8 +1434,10 @@ static int serial_link_irq_chain(struct
i->head = &up->list;
spin_unlock_irq(&i->lock);
- ret = request_irq(up->port.irq, serial8250_interrupt,
- irq_flags, "serial", i);
+ ret = request_irq2(up->port.irq, serial8250_interrupt,
+ irq_flags | SA_MUST_THREAD_RT,
+ "serial", i,
+ serial8250_change_context);
if (ret < 0)
serial_do_unlink(i, up);
}
Index: linux-2.6.16-rt23.spin_mutex/include/linux/serial_core.h
===================================================================
--- linux-2.6.16-rt23.spin_mutex.orig/include/linux/serial_core.h
+++ linux-2.6.16-rt23.spin_mutex/include/linux/serial_core.h
@@ -206,7 +206,7 @@ struct uart_icount {
typedef unsigned int __bitwise__ upf_t;
struct uart_port {
- spinlock_t lock; /* port lock */
+ spin_mutex_t lock; /* port lock */
unsigned int iobase; /* in/out[bwl] */
unsigned char __iomem *membase; /* read/write[bwl] */
unsigned int irq; /* irq number */
--
next prev parent reply other threads:[~2006-06-02 21:23 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20060602165336.147812000@localhost>
2006-06-02 22:23 ` [patch 1/5] [PREEMPT_RT] Changing interrupt handlers from running in thread to hardirq and back runtime Esben Nielsen
2006-06-02 22:23 ` [patch 2/5] " Esben Nielsen
2006-06-03 20:21 ` Steven Rostedt
2006-06-04 17:33 ` Esben Nielsen
2006-06-02 22:23 ` [patch 3/5] " Esben Nielsen
2006-06-03 20:39 ` Steven Rostedt
2006-06-04 17:34 ` Esben Nielsen
2006-06-02 22:23 ` Esben Nielsen [this message]
2006-06-03 21:30 ` [patch 4/5] " Steven Rostedt
2006-06-04 22:50 ` Esben Nielsen
2006-06-02 22:23 ` [patch 5/5] " Esben Nielsen
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=Pine.LNX.4.64.0606022322140.9307@localhost \
--to=nielsen.esben@googlemail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/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