From: Jiri Slaby <jirislaby@gmail.com>
To: <linux-kernel@vger.kernel.org>
Cc: Frank Seidel <fseidel@suse.de>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Subject: [RFC! 10/13] Char: nozomi, fix tty_flip_buffer_push
Date: Fri, 9 Nov 2007 18:49:33 -0500 [thread overview]
Message-ID: <259691270825982947.slaby@pripojeni.net> (raw)
In-Reply-To: <10551261882075921134.slaby@pripojeni.net>
Especially on this I would like to see feedback. Unlock and lock the
spinlock just around the tty_flip_buffer_push would be much more easier, but
won't it break anything?
--
nozomi, fix tty_flip_buffer_push
tty_flip_buffer_push call may deadlock when invoking it while holding
spinlock used in e.g. throttle too. Nozomi sets low_latency tty and that
means, that ldisc flush will be called immediately and it can call some
nozomi functions back. Solve it by invoking tty_flip_buffer_push after
releasing the spinlock.
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
---
commit 2bd359aea85cf712d4d161a83e940fe5e1202ee8
tree 0de7cbb0d78d1ff24d6be957b85ee30d4fc01a63
parent 19a0196a97ed70efdc421b359e28684e058d7121
author Jiri Slaby <jirislaby@gmail.com> Mon, 05 Nov 2007 15:19:55 +0100
committer Jiri Slaby <jirislaby@gmail.com> Sat, 10 Nov 2007 00:14:41 +0100
drivers/char/nozomi.c | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/char/nozomi.c b/drivers/char/nozomi.c
index 2c4d388..3e0b18e 100644
--- a/drivers/char/nozomi.c
+++ b/drivers/char/nozomi.c
@@ -414,7 +414,7 @@ struct port {
/* Private data one for each card in the system */
struct nozomi {
void __iomem *base_addr;
- u8 closing;
+ u32 flip;
/* Pointers to registers */
void __iomem *reg_iir;
@@ -1000,7 +1000,7 @@ static int receive_data(enum port_type index, struct nozomi *dc)
}
}
- tty_flip_buffer_push(tty);
+ set_bit(index, &dc->flip);
return 1;
}
@@ -1290,6 +1290,7 @@ static int handle_data_ul(struct nozomi *dc, enum port_type port, u16 read_iir)
static irqreturn_t interrupt_handler(int irq, void *dev_id)
{
struct nozomi *dc = dev_id;
+ unsigned int a;
u16 read_iir;
spin_lock(&dc->spin_mutex);
@@ -1397,6 +1398,9 @@ static irqreturn_t interrupt_handler(int irq, void *dev_id)
exit_handler:
spin_unlock(&dc->spin_mutex);
+ for (a = 0; a < NOZOMI_MAX_PORTS; a++)
+ if (test_and_clear_bit(a, &dc->flip))
+ tty_flip_buffer_push(dc->port[a].tty);
return IRQ_HANDLED;
none:
spin_unlock(&dc->spin_mutex);
@@ -1426,7 +1430,7 @@ static void nozomi_setup_private_data(struct nozomi *dc)
dc->reg_iir = (void __iomem *)(offset + R_IIR);
dc->reg_ier = (void __iomem *)(offset + R_IER);
dc->last_ier = 0;
- dc->closing = 0;
+ dc->flip = 0;
dc->port[PORT_MDM].token_dl = MDM_DL;
dc->port[PORT_DIAG].token_dl = DIAG_DL;
next prev parent reply other threads:[~2007-11-09 23:49 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-09 23:43 [RFC 1/13] Char: nozomi, remove unneded stuff Jiri Slaby
2007-11-09 23:44 ` [RFC 2/13] Char: nozomi, expand some functions Jiri Slaby
2007-11-10 15:41 ` Frank Seidel
2007-11-09 23:44 ` [RFC 3/13] Char: nozomi, fix fail paths Jiri Slaby
2007-11-10 15:41 ` Frank Seidel
2007-11-09 23:45 ` [RFC 4/13] Char: nozomi, tty index cleanup Jiri Slaby
2007-11-10 15:41 ` Frank Seidel
2007-11-10 15:50 ` Jiri Slaby
2007-11-09 23:46 ` [RFC 5/13] Char: nozomi, ioctls cleanup Jiri Slaby
2007-11-10 15:41 ` Frank Seidel
2007-11-09 23:46 ` [RFC 6/13] Char: nozomi, reorder and cleanup probe, remove Jiri Slaby
2007-11-10 15:42 ` Frank Seidel
2007-11-09 23:47 ` [RFC 7/13] Char: nozomi, remove struct irq Jiri Slaby
2007-11-10 15:42 ` Frank Seidel
2007-11-12 15:11 ` Frank Seidel
2007-11-09 23:48 ` [RFC 8/13] Char: nozomi, tty cleanup Jiri Slaby
2007-11-10 15:42 ` Frank Seidel
2007-11-12 18:43 ` Frank Seidel
2007-11-09 23:48 ` [RFC 9/13] Char: nozomi, lock cleanup Jiri Slaby
2007-11-10 15:42 ` Frank Seidel
2007-11-09 23:49 ` Jiri Slaby [this message]
2007-11-10 15:43 ` [RFC! 10/13] Char: nozomi, fix tty_flip_buffer_push Frank Seidel
2007-11-09 23:50 ` [RFC 11/13] Char: nozomi, remove unused includes Jiri Slaby
2007-11-10 15:43 ` Frank Seidel
2007-11-09 23:50 ` [RFC 12/13] Char: nozomi, remove void acc char2 char3 more mp mp.c mp.yy m1 nozomi2 proto rej slock1 casts Jiri Slaby
2007-11-10 15:43 ` Frank Seidel
2007-11-09 23:51 ` [RFC 13/13] Char: nozomi, cleanup read and write Jiri Slaby
2007-11-10 15:43 ` Frank Seidel
2007-11-10 16:15 ` Adrian Bunk
2007-11-10 22:04 ` Jiri Slaby
2007-11-11 2:37 ` Frank Seidel
2007-11-11 16:02 ` Frank Seidel
2007-11-12 7:54 ` Adrian Bunk
2007-11-12 9:43 ` Frank Seidel
2007-11-10 15:41 ` [RFC 1/13] Char: nozomi, remove unneded stuff Frank Seidel
2007-11-10 15:55 ` Jiri Slaby
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=259691270825982947.slaby@pripojeni.net \
--to=jirislaby@gmail.com \
--cc=fseidel@suse.de \
--cc=linux-kernel@vger.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 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®