From: Aurelien Degremont <aurelien.degremont@cea.fr>
To: Trond Myklebust <trond.myklebust@fys.uio.no>
Cc: Jacques-Charles Lafoucriere <jc.lafoucriere@cea.fr>,
Bruno Faccini <bruno.faccini@bull.net>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Fix deadlock in RPC scheduling code.
Date: Fri, 10 Mar 2006 16:10:25 +0100 [thread overview]
Message-ID: <200603101510.QAA17788@styx.bruyeres.cea.fr> (raw)
In-Reply-To: <1141915219.8293.5.camel@lade.trondhjem.org>
Trond Myklebust wrote:
> The real fix is the one I posted in response to this thread last week.
Oops, I missed it.
Ok for the patch, the list iteration will be better, but I don't
understand how this will prevent the race condition?
I do not think it is not a good idea to keep this lock order in
rpc_wake_up_task() anyway. I must be missing something but I
think this function should be modified in order to be in accordance with
the lock hierarchy in rpc code. It seems to me that the potential race
is still there.
Even if we cannot certify task->u.tk_wait.rpc_waitq is valid, the
current kernel code cannot either (err... I think it can't). So let's
try at least to improve it, even if we cannot set it totally harmless.
Warn me if I'm wrong :
When rpc_wake_up_task() is called, the calling context is helpless.
So we have absolutely no information on the task queue. We must
atomically check the "queued-ness" of the task and grab the queue lock
to prevent any error? Hmmm... So the matter is : the queue mustn't be
modified between the test and the lock? Have we some "magical" lock
somewhere which could help up? I didn't find it.
With the patch I propose (quite the same than Simon Derr's last week
proposal), the insertion of the RPC task is not a problem since the
QUEUED flag is set when the task is totally enqueued (in
__rpc_add_wait_queue(): task->u.tk_wait.list is modified and
task->u.tk_wait.rpc_waitq set), so if the test is
true, the task does have a queue. The task removal is more problematic.
The task could be executed and removed from the queue between the bit
test and the lock grabbing. I've checked the code responsible for this,
and it seems that the task->u.tk_wait.rpc_waitq pointer is still valid,
the task is just removed from wait queue list. So, we could still take
the queue lock and, with the lock taken, we just need to do one more
test to verify the task was not woken up and removed from the queue
since the test.
I do not really like this solution, that's not really clean, but, at
least, I hope my analysis is not too far from correct?
Please let me now where I wrong.
Cordially
--
Aurelien Degremont
next prev parent reply other threads:[~2006-03-10 15:11 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-09 10:35 Aurelien Degremont
2006-03-09 14:40 ` Trond Myklebust
2006-03-10 15:10 ` Aurelien Degremont [this message]
2006-03-10 15:24 ` Trond Myklebust
2006-03-13 10:07 ` Aurelien Degremont
2006-03-13 14:28 ` Trond Myklebust
2006-03-13 15:16 ` Aurelien Degremont
2006-03-13 16:08 ` Trond Myklebust
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=200603101510.QAA17788@styx.bruyeres.cea.fr \
--to=aurelien.degremont@cea.fr \
--cc=bruno.faccini@bull.net \
--cc=jc.lafoucriere@cea.fr \
--cc=linux-kernel@vger.kernel.org \
--cc=trond.myklebust@fys.uio.no \
/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®