From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Hellstrom Subject: Re: [PATCH 2/2] drm/vmwgfx: Fix false lockdep warning Date: Fri, 15 Nov 2013 11:28:02 +0100 Message-ID: <5285F732.70001@vmware.com> References: <1384503872-3675-1-git-send-email-thellstrom@vmware.com> <1384503872-3675-3-git-send-email-thellstrom@vmware.com> <20131115092946.GQ22741@phenom.ffwll.local> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: Received: from smtp-outbound-1.vmware.com (smtp-outbound-1.vmware.com [208.91.2.12]) by gabe.freedesktop.org (Postfix) with ESMTP id 112BD105955 for ; Fri, 15 Nov 2013 02:28:08 -0800 (PST) In-Reply-To: <20131115092946.GQ22741@phenom.ffwll.local> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org To: Daniel Vetter Cc: jglisse@redhat.com, linux-graphics-maintainer@vmware.com, dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org On 11/15/2013 10:29 AM, Daniel Vetter wrote: > On Fri, Nov 15, 2013 at 12:24:32AM -0800, Thomas Hellstrom wrote: >> A lockdep warning is hit when evicting surfaces and reserving the backup >> buffer. Since this buffer can only be reserved by the process holding the >> surface reservation or by the buffer eviction processes that use tryreserve, >> there is no real deadlock here, but there's no other way to silence lockdep >> than to use a tryreserve. This means the reservation might fail if the buffer >> is about to be evicted or swapped out, but we now have code in place to >> handle that reasonably well. >> >> Signed-off-by: Thomas Hellstrom > Hm, for similar cases where there's an additional hirarchy imposed onto > the locking order lockdep supports subclases. Block devices use that to > nest partitions within the overall block device. > > Have you looked into wiring this up for ww_mutexes, i.e. fix lockdep > instaed of working around it in the code? I'm thinking of a > ww_mutex_lock_nested similar to mutex_lock_nested. > > Cheers, Daniel > Yeah, I've thought of that, and that would definitely come in handy for upcoming page-table-bos where reservation should not fail, and where I need to play other tricks, and I might have a chance to look at that before merging that code. However in this particular case I'm not sure it will work, because the same buffers can be reserved at different nesting levels either as part of command submission or as part of eviction. In the block device analogy, a mutex could be taken both as a device mutex or a partition mutex. I haven't looked into the lock_nested semantics close enough to figure out whether that would work or confuse lockdep beyond recovery :). In any case, this needs a quick workaround for now. /Thomas