mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Luiz Fernando N. Capitulino" <lcapitulino@mandriva.com.br>
To: akpm@osdl.org
Cc: LKML <linux-kernel@vger.kernel.org>,
	Paul Fulghum <paulkf@microgate.com>, Greg KH <gregkh@suse.de>,
	Russell King <rmk+lkml@arm.linux.org.uk>,
	Pete Zaitcev <zaitcev@redhat.com>,
	linux-usb-devel@lists.sourceforge.net
Subject: [PATCH] Serial-Core: adds atomic context debug code.
Date: Tue, 4 Jul 2006 16:41:38 -0300	[thread overview]
Message-ID: <20060704164138.0bfd6e27@doriath.conectiva> (raw)

 Andrew,

 While porting the USB-Serial layer to the Serial Core API [1], we found that
usb-serial devices must be able to sleep in the get_mctrl() and set_mctrl()
callbacks [2]. But, unfortunately, those callbacks are called with a spinlock
held.

 The solution is to switch from the spinlock to a mutex.

 But turns out that we have no sure whether uart_update_mctrl(),
uart_startup() and uart_configure_port() (which calls {get,set}_mctrl()) are
called from atomic context or not.

 This patch adds might_sleep() calls to them in order to help us to find the
answer.

 Please, note that this is just a debug patch to stay in -mm for a while,
ie, it's not a submission for mainline kernel.

[1] http://marc.theaimsgroup.com/?l=linux-usb-devel&m=114921742628790&w=2
[2] http://lkml.org/lkml/2006/6/13/242

Signed-off-by: Luiz Fernando N. Capitulino <lcapitulino@mandriva.com.br>

diff -purN linux-2.6.17.orig/drivers/serial/serial_core.c linux-2.6.17/drivers/serial/serial_core.c
--- linux-2.6.17.orig/drivers/serial/serial_core.c	2006-07-04 16:35:47.796329000 -0300
+++ linux-2.6.17/drivers/serial/serial_core.c	2006-07-04 16:35:47.820333205 -0300
@@ -128,6 +128,8 @@ uart_update_mctrl(struct uart_port *port
 	unsigned long flags;
 	unsigned int old;
 
+	might_sleep();
+
 	spin_lock_irqsave(&port->lock, flags);
 	old = port->mctrl;
 	port->mctrl = (old & ~clear) | set;
@@ -150,6 +152,8 @@ static int uart_startup(struct uart_stat
 	unsigned long page;
 	int retval = 0;
 
+	might_sleep();
+
 	if (info->flags & UIF_INITIALIZED)
 		return 0;
 
@@ -2055,6 +2059,8 @@ uart_configure_port(struct uart_driver *
 {
 	unsigned int flags;
 
+	might_sleep();
+
 	/*
 	 * If there isn't a port here, don't do anything further.
 	 */


-- 
Luiz Fernando N. Capitulino

                 reply	other threads:[~2006-07-04 19:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20060704164138.0bfd6e27@doriath.conectiva \
    --to=lcapitulino@mandriva.com.br \
    --cc=akpm@osdl.org \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb-devel@lists.sourceforge.net \
    --cc=paulkf@microgate.com \
    --cc=rmk+lkml@arm.linux.org.uk \
    --cc=zaitcev@redhat.com \
    /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®