From: Peter Zijlstra <peterz@infradead.org>
To: Ilya Dryomov <ilya.dryomov@inktank.com>
Cc: Mike Galbraith <umgwanakikbuti@gmail.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Ingo Molnar <mingo@kernel.org>,
Ceph Development <ceph-devel@vger.kernel.org>,
davidlohr@hp.com, jason.low2@hp.com, axboe@kernel.dk
Subject: Re: [PATCH] locking/mutexes: Revert "locking/mutexes: Add extra reschedule point"
Date: Fri, 1 Aug 2014 15:27:54 +0200 [thread overview]
Message-ID: <20140801132754.GI19379@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <CALFYKtBnK4uaq-37O3gWVQLuQZ9Vrs8oNhdvcUWEPqgpge-pdw@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2211 bytes --]
On Fri, Aug 01, 2014 at 04:56:27PM +0400, Ilya Dryomov wrote:
> I'm going to fix up rbd_request_fn(), but I want to make sure
> I understand this in full.
>
> - Previously the danger of calling blocking primitives on the way to
> schedule(), i.e. with task->state != TASK_RUNNING, was that if the
> blocking primitive was indeed to block the task state would be set
> back to TASK_RUNNING and the schedule() that that task was on the way
> to wouldn't have any effect. Your "Add extra reschedule point" patch
> essentially made calling mutex_lock() and probably others much more
> wrong that it used to be, because mutex_lock() may now reschedule
> when the task is not on the mutex wait queue.
Right and in general we cannot allow spurious wakeups (although we try
very hard to deal with them in generic code, which is why things more or
less worked).
But if you do a patch that 'randomly' ignores ->state on schedule (I did
one) stuff comes apart _real_ quick.
Therefore you should very much not destroy ->state on the way to
schedule.
> - There is nothing wrong with releasing queue_lock and reenabling IRQs
> in rbd_request_fn() as long as it doesn't block and I remember to
> disable IRQs and take queue_lock back on return.
Releasing queue_lock might be ok, dunno about the blk locking, however
reenabling IRQs it is actually wrong as per blk_flush_plug_list() since
that uses local_irq_save()/restore() which means it can be called from
contexts which cannot deal with enabling IRQs, and then your
->request_fn() goes and does that.
Now maybe blk_flush_plug_list() is overly paranoid and it could use
local_irq_disable()/enable() instead, I don't know. But until it does, a
request_fn() should never reenable IRQs.
> I'm asking because rbd_request_fn() is probably not the only broken in
> this way code path. I poked around and found read_events() in aio.c,
> it seems to have been written with the "danger" assumption that
> I outlined above and there is even a comment to it.
I'm fairly sure there's more broken stuff, I didn't dare looking.
> Does that above make sense or am I missing something?
I think that's about it.
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2014-08-01 13:28 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-31 10:16 [PATCH] locking/mutexes: Revert "locking/mutexes: Add extra reschedule point" Ilya Dryomov
2014-07-31 11:57 ` Peter Zijlstra
2014-07-31 12:37 ` Ilya Dryomov
2014-07-31 13:13 ` Peter Zijlstra
2014-07-31 13:25 ` Ilya Dryomov
2014-07-31 13:44 ` Ingo Molnar
2014-07-31 13:56 ` Peter Zijlstra
2014-08-02 20:04 ` [RFC][PATCH] locking: Debug nested wait/locking primitives Peter Zijlstra
2014-07-31 14:30 ` [PATCH] locking/mutexes: Revert "locking/mutexes: Add extra reschedule point" Mike Galbraith
2014-07-31 14:37 ` Ilya Dryomov
2014-07-31 14:39 ` Peter Zijlstra
2014-08-01 12:56 ` Ilya Dryomov
2014-08-01 13:27 ` Peter Zijlstra [this message]
2014-08-01 13:50 ` Ilya Dryomov
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=20140801132754.GI19379@twins.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=axboe@kernel.dk \
--cc=ceph-devel@vger.kernel.org \
--cc=davidlohr@hp.com \
--cc=ilya.dryomov@inktank.com \
--cc=jason.low2@hp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=umgwanakikbuti@gmail.com \
/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