public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Fernando Lopez-Lezcano <nando@ccrma.Stanford.EDU>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	linux-kernel@vger.kernel.org, Matt Barber <brbrofsvl@gmail.com>
Subject: Re: [Fwd: [PlanetCCRMA] atl1 driver; sleeping function]
Date: Tue, 31 Jul 2007 10:51:22 +0200	[thread overview]
Message-ID: <20070731085122.GC14758@elte.hu> (raw)
In-Reply-To: <1185852942.32478.3.camel@cmn3.stanford.edu>


* Fernando Lopez-Lezcano <nando@ccrma.Stanford.EDU> wrote:

> Hi Ingo, I'm forwading this report from a Planet CCRMA user, this is 
> happening to him with 2.6.21.6-rt21...

thanks!

> BUG: sleeping function called from invalid context IRQ-219(2243) at
> kernel/rtmutex.c:613
> in_atomic():0 [00000000], irqs_disabled():1
>  [<c0405f88>] dump_trace+0x64/0x105
>  [<c0406041>] show_trace_log_lvl+0x18/0x2c
>  [<c040664e>] show_trace+0xf/0x11
>  [<c04066cf>] dump_stack+0x12/0x14
>  [<c060511d>] __rt_spin_lock+0x21/0x3d
>  [<f8a20e0c>] atl1_xmit_frame+0x66f/0x6c6 [atl1]
>  [<c05a3d96>] dev_hard_start_xmit+0x1c6/0x225
>  [<c05b29bd>] __qdisc_run+0xb7/0x1cf

could you try the patch below, does it fix the problem? The atl1 driver 
uses raw irq flags in combination with a spinlock that is a sleeping 
lock on -rt. (this is valid code on upstream, fortunately the -rt fix is 
also a cleanup and a small code reduction enhancement on upstream, so 
there's no problem pushing such fixes upstream.)

	Ingo

--------------------------->
Subject: [patch] drivers/net/atl1/atl1_main.c: use spin_trylock_irqsave()
From: Ingo Molnar <mingo@elte.hu>

use the simpler spin_trylock_irqsave() API to get the adapter lock.

[ this is also a fix for -rt where adapter->lock is a sleeping lock. ]

Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 drivers/net/atl1/atl1_main.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Index: linux-rt-rebase.q/drivers/net/atl1/atl1_main.c
===================================================================
--- linux-rt-rebase.q.orig/drivers/net/atl1/atl1_main.c
+++ linux-rt-rebase.q/drivers/net/atl1/atl1_main.c
@@ -1704,10 +1704,8 @@ static int atl1_xmit_frame(struct sk_buf
 		}
 	}
 
-	local_irq_save(flags);
-	if (!spin_trylock(&adapter->lock)) {
+	if (!spin_trylock_irqsave(&adapter->lock, flags)) {
 		/* Can't get lock - tell upper layer to requeue */
-		local_irq_restore(flags);
 		dev_printk(KERN_DEBUG, &adapter->pdev->dev, "tx locked\n");
 		return NETDEV_TX_LOCKED;
 	}

  reply	other threads:[~2007-07-31  8:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-31  3:35 [Fwd: [PlanetCCRMA] atl1 driver; sleeping function] Fernando Lopez-Lezcano
2007-07-31  8:51 ` Ingo Molnar [this message]
2007-08-01  4:13   ` Fernando Lopez-Lezcano

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=20070731085122.GC14758@elte.hu \
    --to=mingo@elte.hu \
    --cc=brbrofsvl@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nando@ccrma.Stanford.EDU \
    --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