From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Hellstrom Subject: Re: [PATCH 03/10] drm/ttm: do not check if list is empty in ttm_bo_force_list_clean Date: Tue, 20 Nov 2012 08:42:46 +0100 Message-ID: <50AB3476.3040004@shipmail.org> References: <1352728811-21860-1-git-send-email-maarten.lankhorst@canonical.com> <1352728811-21860-3-git-send-email-maarten.lankhorst@canonical.com> <50AA352E.9010703@vmware.com> <50AA3DE7.3080503@canonical.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: Received: from GOTHNET-SMTP2.gothnet.se (ns2.gothnet.se [82.193.160.251]) by gabe.freedesktop.org (Postfix) with ESMTP id 08184E61E6 for ; Mon, 19 Nov 2012 23:42:50 -0800 (PST) In-Reply-To: <50AA3DE7.3080503@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: dri-devel@lists.freedesktop.org, Maarten Lankhorst List-Id: dri-devel@lists.freedesktop.org On 11/19/2012 03:10 PM, Maarten Lankhorst wrote: > Op 19-11-12 14:33, Thomas Hellstrom schreef: >> On 11/12/2012 03:00 PM, Maarten Lankhorst wrote: >>> Just use the return error from ttm_mem_evict_first instead. >> Here driver need to be able to evict a memory type completely, because they might shut down >> the memory type or clear it for some legacy usage, suspending or whatever, so returning 0 on -EBUSY isn't sufficient, >> we need at least a list empty check, and a shared reservation at this point is illegal. >> >> This is a point where the mechanism to exclude other reservers is needed, as we discussed previously. >> vmwgfx is using the ttm lock, but will of course adapt if a new mechanism is emerging. > Normally ttm_mem_evict_first only returns -EBUSY if the list is empty and no_wait = false, > so I thought using the return code would be equivalent. > > We could do spin_lock(&glob->lru_lock); WARN_ON(!list_empty(&man->lru_lock)); spin_unlock(&glob->lru_lock); to handle this after -EBUSY. > > With a lot of objects on the lru list, this would save taking lru_lock twice for each object. > > ~Maarten Sure, and in the allow_errors case we should return an error if the list isn't empty, to allow careful drivers to deal with that. /Thomas > > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/dri-devel