From: Ingo Oeser <ioe-lkml@rameria.de>
To: Matthew Wilcox <matthew@wil.cx>
Cc: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@elte.hu>,
hch@infradead.org, linux-driver@qlogic.com
Subject: Re: [PATCH 1/2] Introduce mutex_lock_timeout
Date: Sun, 26 Nov 2006 12:00:50 +0100 [thread overview]
Message-ID: <200611261200.52297.ioe-lkml@rameria.de> (raw)
In-Reply-To: <20061125163242.GH14076@parisc-linux.org>
Hi Matthew,
On Saturday, 25. November 2006 17:32, Matthew Wilcox wrote:
> In the qla case, the mutex can be acquired by a thread which then waits
> for the hardware to do something. If the hardware locks up, it is
> preferable that the system not hang.
Ok, I looked at it (drivers/scsi/qla2xxx/qla_mbx.c)
and the solution seems simple:
- Introduce an busy flag, check that BEFORE this mutex_lock()
and don't protect it by that mutex.
- return -EBUSY to the upper layers, if mailbox still busy
- upper layers can either queue the command or use a retry mechanism
There are many examples for this in the kernel. NICs have the same problems
(transmitter busy or stuck) and have no problem handling that gracefully
since ages.
> I assumed that he'd spent enough time thinking about it that fixing it
> really wasn't feasible.
That doesn't depend on time, just whether you get the right idea or not.
Anyway I CCed the current maintainers.
So my point still stands: Timeout based locking is evil and hides bugs.
In this case the bugs are:
1. That mutex protects a code path (mailbox command submission
and retrieve) instead of data.
2. "Mailbox is free" is an event, so you should use wait_event_timout()
for that
Regards
Ingo Oeser
prev parent reply other threads:[~2006-11-26 11:01 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-09 18:27 Matthew Wilcox
2006-11-09 18:30 ` [PATCH 2/2] Use mutex_lock_timeout in qla2xxx driver Matthew Wilcox
2006-11-20 21:21 ` Andrew Vasquez
2006-11-20 21:13 ` [PATCH 1/2] Introduce mutex_lock_timeout Andrew Vasquez
2006-11-25 3:55 ` Matthew Wilcox
2006-11-25 16:00 ` Ingo Oeser
2006-11-25 16:32 ` Matthew Wilcox
2006-11-26 11:00 ` Ingo Oeser [this message]
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=200611261200.52297.ioe-lkml@rameria.de \
--to=ioe-lkml@rameria.de \
--cc=hch@infradead.org \
--cc=linux-driver@qlogic.com \
--cc=linux-kernel@vger.kernel.org \
--cc=matthew@wil.cx \
--cc=mingo@elte.hu \
/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®