From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Hellstrom Subject: Re: [PATCH 3/6] drm/ttm: call ttm_bo_cleanup_refs with reservation and lru lock held, v3 Date: Thu, 29 Nov 2012 21:43:01 +0100 Message-ID: <50B7C8D5.7030204@vmware.com> References: <1354101944-10455-1-git-send-email-maarten.lankhorst@canonical.com> <1354101944-10455-3-git-send-email-maarten.lankhorst@canonical.com> <50B5FB82.9020904@vmware.com> <50B6006A.6030107@canonical.com> <50B60FBC.6090907@vmware.com> <50B617D2.4090109@canonical.com> <50B61E66.1040805@vmware.com> <50B623CE.5070801@canonical.com> <50B6294A.7070906@vmware.com> <50B658D0.2060800@canonical.com> <50B6642D.10706@vmware.com> <50B68F93.1090507@canonical.com> <50B72DED.1070705@vmware.com> <50B748D6.5070003@canonical.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: Received: from smtp-outbound-2.vmware.com (smtp-outbound-2.vmware.com [208.91.2.13]) by gabe.freedesktop.org (Postfix) with ESMTP id 2D12CE609C for ; Thu, 29 Nov 2012 12:43:08 -0800 (PST) In-Reply-To: <50B748D6.5070003@canonical.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org Errors-To: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org To: Maarten Lankhorst Cc: Maarten Lankhorst , dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org On 11/29/2012 12:36 PM, Maarten Lankhorst wrote: > By removing the unlocking of lru and retaking it immediately, a race is > removed where the bo is taken off the swap list or the lru list between > the unlock and relock. As such the cleanup_refs code can be simplified, > it will attempt to call ttm_bo_wait non-blockingly, and if it fails > it will drop the locks and perform a blocking wait, or return an error > if no_wait_gpu was set. > > The need for looping is also eliminated, since swapout and evict_mem_first > will always follow the destruction path, no new fence is allowed > to be attached. As far as I can see this may already have been the case, > but the unlocking / relocking required a complicated loop to deal with > re-reservation. > > Changes since v1: > - Simplify no_wait_gpu case by folding it in with empty ddestroy. > - Hold a reservation while calling ttm_bo_cleanup_memtype_use again. > Changes since v2: > - Do not remove bo from lru list while waiting > > Signed-off-by: Maarten Lankhorst Reviewed-by: Thomas Hellstrom