mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Andreas Mohr <andi@lisas.de>
Cc: linux-kernel@vger.kernel.org, Greg KH <greg@kroah.com>,
	Julia Lawall <julia@diku.dk>
Subject: Re: mcs7830 usb net: "scheduling while atomic" danger?
Date: Mon, 18 Jan 2010 21:47:59 +0100 (CET)	[thread overview]
Message-ID: <alpine.LFD.2.00.1001182145060.2906@localhost.localdomain> (raw)
In-Reply-To: <20100118184942.GA10171@rhlx01.hs-esslingen.de>

On Mon, 18 Jan 2010, Andreas Mohr wrote:

> Hi,
> 
> drivers/net/usb/mcs7830.c does several:
> 
>         mutex_lock(&dev->phy_mutex);
>         /* write the MII command */
>         ret = mcs7830_set_reg(dev, HIF_REG_PHY_CMD1, 2, cmd);
>         if (ret < 0)
>                 goto out;
> 
>         /* wait for the data to become valid, should be within < 1ms */
>         for (i = 0; i < 10; i++) {
>                 ret = mcs7830_get_reg(dev, HIF_REG_PHY_CMD1, 2, cmd);
>                 if ((ret < 0) || (cmd[1] &
> HIF_REG_PHY_CMD2_READY_FLAG_BIT))
>                         break;
>                 ret = -EIO;
>                 msleep(1);
>         }
> 
> 
> Forgive me, but doesn't that mutex_lock()/msleep() (ab)use mean
> risking a "scheduling while atomic"?
> (such as discussed in e.g.
> http://search.luky.org/linux-kernel.2004/msg92817.html )

No, that's different. You are allowed to sleep with a mutex held. The
thread is about spin_lock()/msleep().

spin_lock() is implicitly disabling preemption, mutex_lock() does not.

Thanks,

	tglx

  parent reply	other threads:[~2010-01-18 20:48 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-18 18:49 Andreas Mohr
2010-01-18 20:25 ` Julia Lawall
2010-01-18 20:47 ` Thomas Gleixner [this message]
2010-01-18 21:10 ` Julia Lawall
2010-01-18 21:23   ` Arnd Bergmann
2010-01-18 21:35     ` Julia Lawall
2010-01-18 22:25       ` Arnd Bergmann
2010-01-19  8:31         ` [PATCH] ehci: phy low power mode bug fixing alek du
2010-01-19  2:53     ` mcs7830 usb net: "scheduling while atomic" danger? Du, Alek
2010-01-19  6:25       ` Julia Lawall
2010-01-18 21:24   ` Thomas Gleixner
2010-01-18 21:32     ` Julia Lawall
2010-01-18 21:38       ` Thomas Gleixner

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=alpine.LFD.2.00.1001182145060.2906@localhost.localdomain \
    --to=tglx@linutronix.de \
    --cc=andi@lisas.de \
    --cc=greg@kroah.com \
    --cc=julia@diku.dk \
    --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®