[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <1235552836.4645.3089.camel@laptop>
Date: Wed, 25 Feb 2009 10:07:16 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Eric Anholt <eric@...olt.net>
Cc: Thomas Hellstrom <thomas@...pmail.org>,
Wang Chen <wangchen@...fujitsu.com>,
Nick Piggin <nickpiggin@...oo.com.au>,
Ingo Molnar <mingo@...e.hu>, dri-devel@...ts.sourceforge.net,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] drm: Fix lock order reversal between mmap_sem and
struct_mutex.
On Wed, 2009-02-25 at 00:15 -0800, Eric Anholt wrote:
> > Or you could get_user_pages() to fault the user pages and pin them, and
> > then do pagefault_disable() and use copy_from_user_inatomic or such, and
> > release the pages again.
>
> I started poking at this today, since the get_user_pages sounded like
> the solution. Only then I noticed: when we unbind an existing object,
> we have to unmap_mapping_range to clear the clients' mappings to it in
> the GTT, which needs to happen while the struct lock (protecting the gtt
> structure and the gtt to object mappings) is held. So for fault we have
> mmap_sem held to struct mutex taken for poking at the gtt structure, and
> for unbind we have struct mutex held to mmap_sem taken to clear
> mappings.
So it again comes down to the fact that you cannot pin a gtt object
without also holding this struct_mutex?
Normally such things are done by elevating a refcount so that both
regular frees and reclaim gets delayed until you're done with the
object.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists