From: Ian Campbell <ian.campbell@citrix.com>
To: Ben Hutchings <ben@decadent.org.uk>,
Ian Jackson <Ian.Jackson@eu.citrix.com>,
stable@vger.kernel.org,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "osstest service owner" <osstest-admin@xenproject.org>,
xen-devel@lists.xensource.com,
"Marek Marczykowski-Górecki" <marmarek@invisiblethingslab.com>,
"David Vrabel" <david.vrabel@citrix.com>
Subject: Re: [linux-3.14 bisection] complete test-amd64-i386-xl-qcow2
Date: Fri, 9 Oct 2015 10:15:14 +0100 [thread overview]
Message-ID: <1444382114.1410.304.camel@citrix.com> (raw)
In-Reply-To: <1444342480.2956.274.camel@decadent.org.uk>
On Thu, 2015-10-08 at 23:14 +0100, Ben Hutchings wrote:
> On Wed, 2015-09-02 at 10:18 +0100, Ian Campbell wrote:
> > [resending to correct stable address, sorry folks]
> >
> > TL;DR: Any backport of 30b03d05e074 to earlier than commit 1401c00e59e
> > ("xen/gntdev: convert priv->lock to a mutex", which was added in v4.0)
> > needs $something doing to it, either s/mutex/spinlock/ or (more likely)
> > backporting of 1401c00e59e too.
> >
> > Looking at LTS:
> >
> > 3.18.y:> > Backported both.
> > 3.16.y:> > Has backported neither
> > 3.14.y:> > * Only backported 30b03d05e074
> > 3.12.y:> > Has backported neither
> > 3.10.y:> > * Only backported 30b03d05e074
> > 3.4.y:> > Has backported neither
> > 3.2.y:> > Has backported neither
> >
> > So AFAICT 3.14.y and 3.10.y need fixes, probably following 3.18 and
> > backporting 1401c00e59e.
> >
> > 3.16/12/4/2 might need to be careful if they subsequently pick up
> > 30b03d05.
> [...]
>
> I came up with the patch below for 3.2. Let me know if it's not
> correct.
FWIW most of the other stable branches just took 1401c00e59e which is now
pretty well baked in mainline as well as various stable trees and saves
having to reason about dropping the lock over gntdev_put_map. Was
backporting that one to 3.2 problematic?
I suppose it is safe to drop the lock because map is removed from the list
with the lock held, but I'm not 100% confident in that, and this gntdev
stuff isn't really my bailiwick anyway so I'll back away now...
Ian.
>
> Ben.
>
> ---
> From: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
> Date: Fri, 26 Jun 2015 03:28:24 +0200
> Subject: xen/gntdevt: Fix race condition in gntdev_release()
>
> commit 30b03d05e07467b8c6ec683ea96b5bffcbcd3931 upstream.
>
> While gntdev_release() is called the MMU notifier is still registered
> and can traverse priv->maps list even if no pages are mapped (which is
> the case -- gntdev_release() is called after all). But
> gntdev_release() will clear that list, so make sure that only one of
> those things happens at the same time.
>
> Signed-off-by: Marek Marczykowski-Górecki <
> marmarek@invisiblethingslab.com>
> Signed-off-by: David Vrabel <david.vrabel@citrix.com>
> [bwh: Backported to 3.2:
> - Adjust context
> - gntdev_priv::lock is a spinlock rather than a mutex. As
> gntdev_put_map()
> may sleep, we need to unlock inside the loop.]
> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
> ---
> --- a/drivers/xen/gntdev.c
> +++ b/drivers/xen/gntdev.c
> @@ -493,11 +493,15 @@ static int gntdev_release(struct inode *
>
> pr_debug("priv %p\n", priv);
>
> + spin_lock(&priv->lock);
> while (!list_empty(&priv->maps)) {
> map = list_entry(priv->maps.next, struct grant_map,
> next);
> list_del(&map->next);
> + spin_unlock(&priv->lock);
> gntdev_put_map(map);
> + spin_lock(&priv->lock);
> }
> + spin_unlock(&priv->lock);
>
> if (use_ptemod)
> mmu_notifier_unregister(&priv->mn, priv->mm);
>
next prev parent reply other threads:[~2015-10-09 9:15 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-26 20:02 [linux-3.14 bisection] complete test-amd64-i386-xl-qcow2 osstest service owner
2015-09-01 9:19 ` Ian Campbell
2015-09-01 9:38 ` Fabio Fantoni
2015-09-01 10:10 ` Ian Campbell
2015-09-01 9:57 ` Ian Jackson
2015-09-01 10:05 ` Ian Campbell
2015-09-02 9:03 ` Ian Campbell
2015-09-02 9:18 ` Ian Campbell
2015-09-03 11:05 ` Luis Henriques
2015-09-03 11:16 ` [Xen-devel] " David Vrabel
2015-09-03 12:21 ` Luis Henriques
2015-09-11 15:10 ` Ian Campbell
2015-09-11 15:51 ` Greg Kroah-Hartman
2015-09-11 15:55 ` Ian Campbell
2015-09-26 17:30 ` Greg Kroah-Hartman
2015-09-28 9:27 ` Ian Campbell
2015-09-28 9:43 ` Ian Campbell
2015-10-08 22:14 ` Ben Hutchings
2015-10-09 9:15 ` Ian Campbell [this message]
2015-10-12 10:11 ` [Xen-devel] " David Vrabel
2015-10-12 12:56 ` Ben Hutchings
2015-10-12 13:01 ` David Vrabel
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=1444382114.1410.304.camel@citrix.com \
--to=ian.campbell@citrix.com \
--cc=Ian.Jackson@eu.citrix.com \
--cc=ben@decadent.org.uk \
--cc=david.vrabel@citrix.com \
--cc=gregkh@linuxfoundation.org \
--cc=marmarek@invisiblethingslab.com \
--cc=osstest-admin@xenproject.org \
--cc=stable@vger.kernel.org \
--cc=xen-devel@lists.xensource.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;
as well as URLs for NNTP newsgroup(s).