mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: ptb@lab.it.uc3m.es (Peter T. Breuer)
To: linux-kernel@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, ptb@lab.it.uc3m.es
Subject: Re: kernel analyser to detect sleep under spinlock
Date: Sat, 13 Nov 2004 12:09:29 +0100	[thread overview]
Message-ID: <9k6h62-a1v.ln1@news.it.uc3m.es> (raw)
In-Reply-To: <200411122345.iACNjqt09561@inv.it.uc3m.es>

Peter T. Breuer <ptb@inv.it.uc3m.es> wrote:
> I'll undertake a survey of the current kernel.

Just for kicks, I started with the DAC960.c driver (alphabet ..), and
it registered 6 alarms!

   Linux Driver for Mylex DAC960/AcceleRAID/eXtremeRAID PCI RAID Controllers

     Copyright 1998-2001 by Leonard N. Zubkoff <lnz@dandelion.com>

*  function                     line    calls (locks)
* - /usr/local/src/linux-2.6.3/drivers/block/DAC960.c
!! DAC960_BA_InterruptHandler   5219 DAC960_V2_ProcessCompletedCommand (1)
!! DAC960_LP_InterruptHandler   5262 DAC960_V2_ProcessCompletedCommand (1)
!! DAC960_V1_ExecuteUserCommand 5869    DAC960_WaitForCommand (1)
!! DAC960_V2_ExecuteUserCommand 6132    DAC960_WaitForCommand (1)
!! DAC960_gam_ioctl             6663    DAC960_WaitForCommand (1)
!! DAC960_gam_ioctl             6688    DAC960_WaitForCommand (1)

The ProcessCompletedCommand thing really is called under spinlock, but
it appears to be detected as sleepy because it calls kmalloc (and
kfree), however it calls kmalloc with GFP_ATOMIC, so it's not sleepy
and that's a false alarm. Ho hum ... I'll have to detect that.

The WaitForCommand is also definitely called under spinlock ... and is
thought to be sleepy because it calls schedule! Well, it calls
__wait_event(Controller->CommandWaitQueue, Controller->FreeCommands);
Is that going to schedule?  I suppose logically it should.

Anyway, that looks a legitimate complaint:

  spin_lock_irqsave(&Controller->queue_lock, flags);
  while ((Command = DAC960_AllocateCommand(Controller)) == NULL)
    DAC960_WaitForCommand(Controller);
  spin_unlock_irqrestore(&Controller->queue_lock, flags);

Looks like it waits under spinlock to me!

I'll go write the generic inference engine required to make this a bit
more accurate still.



Peter


  reply	other threads:[~2004-11-13 12:31 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-12 23:45 Peter T. Breuer
2004-11-13 11:09 ` Peter T. Breuer [this message]
2004-11-14 15:01   ` Jens Axboe
  -- strict thread matches above, loose matches on Subject: below --
2004-11-22 10:06 Peter T. Breuer
2004-11-11  4:29 Peter T. Breuer
2004-11-07 23:14 Peter T. Breuer
2004-11-07 23:14 Peter T. Breuer
2004-11-08  1:18 ` Randy.Dunlap
2004-11-08  4:39   ` Peter T. Breuer
2004-11-08  4:43     ` Randy.Dunlap

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=9k6h62-a1v.ln1@news.it.uc3m.es \
    --to=ptb@lab.it.uc3m.es \
    --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®