From: Christoph Hellwig <hch@lst.de>
To: Matthew Wilcox <willy@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
kernel test robot <fengguang.wu@intel.com>,
Christoph Hellwig <hch@lst.de>, LKP <lkp@01.org>,
linux-kernel@vger.kernel.org,
Linux Memory Management List <linux-mm@kvack.org>,
wfg@linux.intel.com, Stephen Rothwell <sfr@canb.auug.org.au>
Subject: Re: d1fc031747 ("sched/wait: assert the wait_queue_head lock is .."): EIP: __wake_up_common
Date: Thu, 14 Dec 2017 14:10:37 +0100 [thread overview]
Message-ID: <20171214131037.GD10791@lst.de> (raw)
In-Reply-To: <20171214125809.GB30288@bombadil.infradead.org>
On Thu, Dec 14, 2017 at 04:58:09AM -0800, Matthew Wilcox wrote:
> On Wed, Dec 13, 2017 at 05:03:00PM -0800, Andrew Morton wrote:
> > > sched/wait: assert the wait_queue_head lock is held in __wake_up_common
> > >
> > > Better ensure we actually hold the lock using lockdep than just commenting
> > > on it. Due to the various exported _locked interfaces it is far too easy
> > > to get the locking wrong.
> >
> > I'm probably sitting on an older version. I've dropped
> >
> > epoll: use the waitqueue lock to protect ep->wq
> > sched/wait: assert the wait_queue_head lock is held in __wake_up_common
>
> Looks pretty clear to me that userfaultfd is also abusing the wake_up_locked
> interfaces:
>
> spin_lock(&ctx->fault_pending_wqh.lock);
> __wake_up_locked_key(&ctx->fault_pending_wqh, TASK_NORMAL, &range);
> __wake_up_locked_key(&ctx->fault_wqh, TASK_NORMAL, &range);
> spin_unlock(&ctx->fault_pending_wqh.lock);
>
> Sure, it's locked, but not by the lock you thought it was going to be.
>
> There doesn't actually appear to be a bug here; fault_wqh is always serialised
> by fault_pending_wqh.lock, but lockdep can't know that. I think this patch
> will solve the problem.
Or userfaultfd could just always use the waitqueue lock, similar to what
we are doing in epoll.
But unless someone care about micro-optimizatations I'm tempted to
add your patch to the next iteration of the series.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2017-12-14 13:10 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-14 0:50 d1fc031747 ("sched/wait: assert the wait_queue_head lock is .."): EIP: __wake_up_common kernel test robot
2017-12-14 1:03 ` Andrew Morton
2017-12-14 4:58 ` Stephen Rothwell
2017-12-14 12:57 ` Christoph Hellwig
2017-12-14 12:58 ` Matthew Wilcox
2017-12-14 13:05 ` Matthew Wilcox
2017-12-14 13:10 ` Christoph Hellwig [this message]
2017-12-14 14:12 ` 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=20171214131037.GD10791@lst.de \
--to=hch@lst.de \
--cc=akpm@linux-foundation.org \
--cc=fengguang.wu@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lkp@01.org \
--cc=sfr@canb.auug.org.au \
--cc=wfg@linux.intel.com \
--cc=willy@infradead.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;
as well as URLs for NNTP newsgroup(s).