From mboxrd@z Thu Jan 1 00:00:00 1970 From: Maarten Lankhorst Subject: Re: [PATCH 03/10] drm/ttm: do not check if list is empty in ttm_bo_force_list_clean Date: Mon, 19 Nov 2012 15:10:47 +0100 Message-ID: <50AA3DE7.3080503@canonical.com> 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> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from youngberry.canonical.com (youngberry.canonical.com [91.189.89.112]) by gabe.freedesktop.org (Postfix) with ESMTP id 5EBC8E6126 for ; Mon, 19 Nov 2012 06:10:48 -0800 (PST) In-Reply-To: <50AA352E.9010703@vmware.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: Thomas Hellstrom Cc: dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org 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