From: Thomas Hellstrom <thellstrom@vmware.com>
To: Maarten Lankhorst <m.b.lankhorst@gmail.com>
Cc: dri-devel@lists.freedesktop.org
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 14:33:34 +0100 [thread overview]
Message-ID: <50AA352E.9010703@vmware.com> (raw)
In-Reply-To: <1352728811-21860-3-git-send-email-maarten.lankhorst@canonical.com>
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.
Thanks,
/Thomas
>
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
> ---
> drivers/gpu/drm/ttm/ttm_bo.c | 27 ++++++++-------------------
> 1 file changed, 8 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
> index 74d6e7c..a3383a7 100644
> --- a/drivers/gpu/drm/ttm/ttm_bo.c
> +++ b/drivers/gpu/drm/ttm/ttm_bo.c
> @@ -1302,29 +1302,18 @@ EXPORT_SYMBOL(ttm_bo_create);
> static int ttm_bo_force_list_clean(struct ttm_bo_device *bdev,
> unsigned mem_type, bool allow_errors)
> {
> - struct ttm_mem_type_manager *man = &bdev->man[mem_type];
> - struct ttm_bo_global *glob = bdev->glob;
> - int ret;
> -
> - /*
> - * Can't use standard list traversal since we're unlocking.
> - */
> + int ret = 0;
>
> - spin_lock(&glob->lru_lock);
> - while (!list_empty(&man->lru)) {
> - spin_unlock(&glob->lru_lock);
> + while (!ret) {
> ret = ttm_mem_evict_first(bdev, mem_type, false, false, false);
> - if (ret) {
> - if (allow_errors) {
> - return ret;
> - } else {
> - pr_err("Cleanup eviction failed\n");
> - }
> + if (ret == -EBUSY)
> + return 0;
> + else if (ret && !allow_errors) {
> + pr_err("Cleanup eviction failed\n");
> + ret = 0;
> }
> - spin_lock(&glob->lru_lock);
> }
> - spin_unlock(&glob->lru_lock);
> - return 0;
> + return ret;
> }
>
> int ttm_bo_clean_mm(struct ttm_bo_device *bdev, unsigned mem_type)
next prev parent reply other threads:[~2012-11-19 13:33 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-12 14:00 [PATCH 01/10] drm/radeon: allow move_notify to be called without reservation Maarten Lankhorst
2012-11-12 14:00 ` [PATCH 02/10] drm/ttm: remove ttm_bo_cleanup_memtype_use Maarten Lankhorst
2012-11-19 13:26 ` Thomas Hellstrom
2012-11-19 14:03 ` Maarten Lankhorst
2012-11-19 14:12 ` Thomas Hellstrom
2012-11-12 14:00 ` [PATCH 03/10] drm/ttm: do not check if list is empty in ttm_bo_force_list_clean Maarten Lankhorst
2012-11-19 13:33 ` Thomas Hellstrom [this message]
2012-11-19 14:10 ` Maarten Lankhorst
2012-11-20 7:42 ` Thomas Hellstrom
2012-11-12 14:00 ` [PATCH 04/10] drm/ttm: change fence_lock to inner lock, v3 Maarten Lankhorst
2012-11-19 14:17 ` Thomas Hellstrom
2012-11-19 15:04 ` Thomas Hellstrom
2012-11-19 15:33 ` Maarten Lankhorst
2012-11-20 7:48 ` Thomas Hellstrom
2012-11-20 11:33 ` Maarten Lankhorst
2012-11-20 11:59 ` Maarten Lankhorst
2012-11-20 12:03 ` Thomas Hellstrom
2012-11-20 13:13 ` Maarten Lankhorst
2012-11-20 15:08 ` Thomas Hellstrom
2012-11-21 11:38 ` Maarten Lankhorst
2012-11-21 12:42 ` Thomas Hellstrom
2012-11-21 13:12 ` Maarten Lankhorst
2012-11-21 13:27 ` Thomas Hellstrom
2012-11-22 15:51 ` Maarten Lankhorst
2012-11-22 20:29 ` Thomas Hellstrom
2012-11-27 12:35 ` Maarten Lankhorst
2012-11-12 14:00 ` [PATCH 05/10] drm/ttm: add sense to ttm_bo_cleanup_refs, v4 Maarten Lankhorst
2012-11-12 14:00 ` [PATCH 06/10] drm/ttm: remove no_wait_reserve, v2 Maarten Lankhorst
2012-11-12 14:00 ` [PATCH 07/10] drm/ttm: cope with reserved buffers on swap list in ttm_bo_swapout Maarten Lankhorst
2012-11-12 14:00 ` [PATCH 08/10] drm/ttm: cope with reserved buffers on lru list in ttm_mem_evict_first Maarten Lankhorst
2012-11-12 14:00 ` [PATCH 09/10] drm/ttm: remove lru_lock around ttm_bo_reserve Maarten Lankhorst
2012-11-12 14:00 ` [PATCH 10/10] drm/ttm: remove reliance on ttm_bo_wait_unreserved Maarten Lankhorst
2012-11-12 14:03 ` [PATCH 01/10] drm/radeon: allow move_notify to be called without reservation Maarten Lankhorst
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=50AA352E.9010703@vmware.com \
--to=thellstrom@vmware.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=m.b.lankhorst@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.