public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Matthew Wilcox <matthew@wil.cx>
To: James.Smart@Emulex.Com
Cc: linux-scsi@vger.kernel.org
Subject: lpfc sleeps while holding a spinlock
Date: Thu, 9 Oct 2008 10:41:01 -0600	[thread overview]
Message-ID: <20081009164101.GX25780@parisc-linux.org> (raw)


This is with 2.6.27-rc9; most recent non-janitorial commit to the lpfc
directory is ff0f4cb5ea322dcc32d08bab2d758c050ba1ab07 (Update lpfc driver
version to 8.2.7).  The janitorial commits do not affect the code in
question.


This bug gets reported by lockdep as a mismatch between holding the
hbalock with interrupts on vs acquiring it in interrupt context, but
actually the problem is a GFP_KERNEL allocation while holding a spinlock:

lpfc_sli_hbqbuf_fill_hbqs(struct lpfc_hba *phba, uint32_t hbqno,
uint32_t count)
{
...
        spin_lock_irqsave(&phba->hbalock, flags);
...
        for (i = start; i < end; i++) {
                hbq_buffer = (phba->hbqs[hbqno].hbq_alloc_buffer)(phba);

where previously:
drivers/scsi/lpfc/lpfc_init.c: phba->hbqs[LPFC_ELS_HBQ].hbq_alloc_buffer = lpfc_els_hbq_alloc;

and:
lpfc_els_hbq_alloc(struct lpfc_hba *phba)
{
        struct hbq_dmabuf *hbqbp;
        hbqbp = kmalloc(sizeof(struct hbq_dmabuf), GFP_KERNEL);

Presumably these GFP_KERNEL should become GFP_ATOMIC, or the spinlock
shouldn't be taken at this point, but I haven't looked deeply enough
into the driver to determine which course of action is correct.

-- 
Matthew Wilcox				Intel Open Source Technology Centre
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."

             reply	other threads:[~2008-10-09 16:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-09 16:41 Matthew Wilcox [this message]
2008-10-09 16:50 ` lpfc sleeps while holding a spinlock James Smart
2008-10-09 17:19   ` Matthew Wilcox

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=20081009164101.GX25780@parisc-linux.org \
    --to=matthew@wil.cx \
    --cc=James.Smart@Emulex.Com \
    --cc=linux-scsi@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