From: Andrea Righi <andrea@betterlinux.com>
To: Dan Magenheimer <dan.magenheimer@oracle.com>
Cc: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Seth Jennings" <sjenning@linux.vnet.ibm.com>,
devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
stable@kernel.org,
"Alex Villacís Lasso" <a_villacis@palosanto.com>,
"Konrad Wilk" <konrad.wilk@oracle.com>
Subject: Re: [PATCH] zcache: avoid AB-BA deadlock condition
Date: Mon, 27 Feb 2012 18:29:30 +0100 [thread overview]
Message-ID: <20120227172930.GB1650@thinkpad> (raw)
In-Reply-To: <e60d5136-c2d2-45a4-97f4-5d8e58b12000@default>
On Mon, Feb 27, 2012 at 09:23:24AM -0800, Dan Magenheimer wrote:
> > From: Andrea Righi [mailto:andrea@betterlinux.com]
> > Sent: Monday, February 20, 2012 5:12 AM
> > To: Greg Kroah-Hartman
> > Cc: Dan Magenheimer; Seth Jennings; devel@driverdev.osuosl.org; linux-kernel@vger.kernel.org;
> > stable@kernel.org
> > Subject: [PATCH] zcache: avoid AB-BA deadlock condition
> >
> > Commit 9256a47 fixed a deadlock condition, being sure that the buddy
> > list spinlock is always taken before the page spinlock.
> >
> > However in zbud_free_and_delist() locking order is the opposite
> > (page lock -> list lock).
> >
> > Possible unsafe locking scenario (reported by lockdep):
> >
> > CPU0 CPU1
> > ---- ----
> > lock(&(&zbpg->lock)->rlock);
> > lock(zbud_budlists_spinlock);
> > lock(&(&zbpg->lock)->rlock);
> > lock(zbud_budlists_spinlock);
> >
> > Fix by grabbing the locks in opposite order in zbud_free_and_delist().
> >
> > Signed-off-by: Andrea Righi <andrea@betterlinux.com>
>
> Acked-by: Dan Magenheimer <dan.magenheimer@oracle.com>
>
> Thanks for catching this Andrea! (And thanks also to
> Alex Vallacis-Lasso for independently reporting and testing:
> http://permalink.gmane.org/gmane.linux.kernel/1257214 )
>
> Greg, this patch could be targeted for 3.3-rc6 and 3.2-stable.
> AFAIK, nobody has actually experienced a deadlock from this so
> if Linus has the screws down tight for -rc6, it could wait
> until the 3.4 window.
If it helps, without the fix I can easily trigger the lockdep splat
running a echo 3 > /proc/sys/vm/drop_caches.
-Andrea
next prev parent reply other threads:[~2012-02-27 17:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <<1329739909-3174-1-git-send-email-andrea@betterlinux.com>
2012-02-27 17:23 ` [PATCH] zcache: avoid AB-BA deadlock condition Dan Magenheimer
2012-02-27 17:29 ` Andrea Righi [this message]
2012-02-20 12:11 Andrea Righi
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=20120227172930.GB1650@thinkpad \
--to=andrea@betterlinux.com \
--cc=a_villacis@palosanto.com \
--cc=dan.magenheimer@oracle.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=konrad.wilk@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sjenning@linux.vnet.ibm.com \
--cc=stable@kernel.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).