Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 25 Aug 2013 14:38:44 +0200
From:      Zbigniew Bodek <zbb@semihalf.com>
To:        Andrew Turner <andrew@fubar.geek.nz>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, Grzegorz Bernacki <gber@freebsd.org>, src-committers@freebsd.org, "freebsd-arm@freebsd.org" <freebsd-arm@freebsd.org>
Subject:   Re: svn commit: r251370 - head/sys/arm/arm
Message-ID:  <CAG7dG%2BzgM0Pzxs%2BRGA-TDtJ7Xa_8NaJNd08GgsFea_-TqLcdxw@mail.gmail.com>
In-Reply-To: <20130825131134.11815f5d@bender.Home>
References:  <201306040921.r549LI8t021617@svn.freebsd.org> <20130825131134.11815f5d@bender.Home>

next in thread | previous in thread | raw e-mail | index | archive | help
2013/8/25 Andrew Turner <andrew@fubar.geek.nz>

> On Tue, 4 Jun 2013 09:21:18 +0000 (UTC)
> Grzegorz Bernacki <gber@FreeBSD.org> wrote:
>
> > Author: gber
> > Date: Tue Jun  4 09:21:18 2013
> > New Revision: 251370
> > URL: http://svnweb.freebsd.org/changeset/base/251370
> >
> > Log:
> >   Implement pmap_copy() for ARMv6/v7.
> >
> >   Copy the given range of mappings from the source map to the
> >   destination map, thereby reducing the number of VM faults on fork.
> >
> >   Submitted by:   Zbigniew Bodek <zbb@semihalf.com>
> >   Sponsored by:   The FreeBSD Foundation, Semihalf
> >
> > Modified:
> >   head/sys/arm/arm/pmap-v6.c
>
> This change leads to a deadlock when I attempt to run make buildworld
> on my PandaBoard. The problem is you are locking
> pvh_global_lock, src_pmap, and dst_pmap then calling
> pmap_alloc_l2_bucket.
>
> This may unlock pvh_global_lock and dst_pmap, but it has no knowledge
> of src_pmap so it will keep it locked.
>
> If another thread needs to lock src_pmap, for example the pagedaemon
> may in pmap_clearbit, it will lock pvh_global_lock. This will succeed
> when pmap_alloc_l2_bucket unlocks it. It will then attempt to lock
> src_pmap but, as it is already locked, it will wait for pmap_copy to
> unlock it.
>
> At this point pmap_alloc_l2_bucket will attempt to lock pvh_global_lock
> again, however this lock is already held so it waits for the other
> thread to unlock it.
>
> At this point both threads are waiting on each other causing a deadlock.
>
> I don't know enough about the pmap or vm code to be able to fix this,
> other than reverting this commit.
>
> Andrew
>

Hello Andrew,

Yes, you are right.
We've already discussed this with Olivier (who found this and informed me)
and decided to comment this out
after committing superpages support.
Currently there is no other way to fix this due to pmap_alloc_l2_bucket()
implementation.
If you are in a great hurry with the commit reversal/commenting out
pmap_copy() then I see no problem to do so.

Best regards
Zbyszek Bodek



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAG7dG%2BzgM0Pzxs%2BRGA-TDtJ7Xa_8NaJNd08GgsFea_-TqLcdxw>