mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Vegard Nossum <vegard.nossum@gmail.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: Jens Axboe <jens.axboe@oracle.com>,
	Arjan van de Ven <arjan@infradead.org>,
	Justin Madru <jdm64@gawab.com>,
	lkml <linux-kernel@vger.kernel.org>,
	"Rafael J. Wysocki" <rjw@sisk.pl>
Subject: Re: 2.6.30-rc1: invalid opcode with call trace
Date: Wed, 8 Apr 2009 18:15:21 +0200	[thread overview]
Message-ID: <19f34abd0904080915t1a47cab4jbfe748eeaa47d675@mail.gmail.com> (raw)
In-Reply-To: <20090408074832.GA11097@elte.hu>

[-- Attachment #1: Type: text/plain, Size: 1328 bytes --]

2009/4/8 Ingo Molnar <mingo@elte.hu>:
>
> * Jens Axboe <jens.axboe@oracle.com> wrote:
>
>> On Wed, Apr 08 2009, Vegard Nossum wrote:

>> > Would you please try this patch? It has the same symptoms as a few
>> > other reports, only that this is 32-bit (and that makes it a bit
>> > different).
>> >
>> > http://marc.info/?l=linux-kernel&m=123909566829773&w=2
>> >
>> > I think Len Brown has applied it to the ACPI tree already.
>>
>> Works for me!
>
> My 'boot hang' problem is independent of that bug i think.

I agree.

The problem is that you have two async port probes:

[   24.177306] calling  1_async_port_probe+0x0/0xaa @ 2841
[   24.177825] calling  2_async_port_probe+0x0/0xaa @ 2842

of which only the first completes, because the first async call itself
tries to flush the async list while holding a lock (the
&shost->scan_mutex in __scsi_add_device), causing deadlock.

In short, I don't think we should call async_synchronize_full() from
scsi_complete_async_scans() at all. I'm including a more detailed
description/justification in the patch (attached).

Arjan, can you comment?


Vegard

-- 
"The animistic metaphor of the bug that maliciously sneaked in while
the programmer was not looking is intellectually dishonest as it
disguises that the error is the programmer's own creation."
	-- E. W. Dijkstra, EWD1036

[-- Attachment #2: 0001-scsi-don-t-wait-for-async-operations-in-scsi_comple.patch --]
[-- Type: application/octet-stream, Size: 1759 bytes --]

From bd12de4e40743d94eb90caad7c49d05e4a045b1e Mon Sep 17 00:00:00 2001
From: Vegard Nossum <vegard.nossum@gmail.com>
Date: Wed, 8 Apr 2009 18:05:43 +0200
Subject: [PATCH] scsi: don't wait for async operations in scsi_complete_async_scans()

scsi_complete_async_scans() cannot call async_synchronize_full() because
it may hold the &shost->scan_mutex (in __scsi_add_device(), for example).

I think it was an error to introduce the call to async_synchronize_full()
in the first place, because according to scsi_complete_async_scans(), we
should only wait for those hosts which have started scanning, and not
all of them:

/**
 * scsi_complete_async_scans - Wait for asynchronous scans to complete
 *
 * When this function returns, any host which started scanning before
 * this function was called will have finished its scan.  Hosts which
 * started scanning after this function was called may or may not have
 * finished.
 */

Those async calls which have not even started will not count as having
started by the scsi code either, so even without this call, we are
entirely within the specification of what the function is supposed to
do.

This should fix the deadlock and not introduce any regressions.

Reported-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Vegard Nossum <vegard.nossum@gmail.com>
---
 drivers/scsi/scsi_scan.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index a14d245..6f51ca4 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -180,8 +180,6 @@ int scsi_complete_async_scans(void)
 	spin_unlock(&async_scan_lock);
 
 	kfree(data);
-	/* Synchronize async operations globally */
-	async_synchronize_full();
 	return 0;
 }
 
-- 
1.6.0.6


  parent reply	other threads:[~2009-04-08 16:15 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-08  5:30 Justin Madru
2009-04-08  6:32 ` Jens Axboe
2009-04-08  6:47   ` Ingo Molnar
2009-04-08  6:52     ` Ingo Molnar
2009-04-08  6:53       ` Jens Axboe
2009-04-08  7:11         ` Ingo Molnar
2009-04-08  7:15           ` Jens Axboe
2009-04-08  7:11         ` Justin Madru
2009-04-08  8:12       ` Ingo Molnar
2009-04-10  8:15       ` Heinz Diehl
2009-04-08  7:27     ` Vegard Nossum
2009-04-08  7:40       ` Jens Axboe
2009-04-08  7:48         ` Ingo Molnar
2009-04-08  7:56           ` Jens Axboe
2009-04-08 16:15           ` Vegard Nossum [this message]
2009-04-09 14:45             ` Cornelia Huck

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=19f34abd0904080915t1a47cab4jbfe748eeaa47d675@mail.gmail.com \
    --to=vegard.nossum@gmail.com \
    --cc=arjan@infradead.org \
    --cc=jdm64@gawab.com \
    --cc=jens.axboe@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=rjw@sisk.pl \
    /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®