lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1309511902-3080-1-git-send-email-stefan.bader@canonical.com>
Date:	Fri,  1 Jul 2011 10:18:22 +0100
From:	Stefan Bader <stefan.bader@...onical.com>
To:	Chris Wilson <chris@...is-wilson.co.uk>
Cc:	Seth Forshee <seth.forshee@...onical.com>,
	Stefan Bader <stefan.bader@...onical.com>,
	linux-kernel@...r.kernel.org, stable@...nel.org
Subject: [2.6.32+drm33-longterm] Patch "Subject: [PATCH 07/10] drm/i915/evict: Ensure we completely cleanup on failure" has been added to staging queue

This is a note to let you know that I have just added a patch titled

    Subject: [PATCH 07/10] drm/i915/evict: Ensure we completely cleanup on failure

to the drm-next branch of the 2.6.32+drm33-longterm tree which can be found at

  http://git.kernel.org/?p=linux/kernel/git/smb/linux-2.6.32.y-drm33.z.git;a=shortlog;h=refs/heads/drm-next

If you, or anyone else, feels it should not be added to the drm33-longterm tree,
please reply to this email not later than 8 days after this email was sent.

Thanks.
-Stefan

------

>From 2f4f8bc3da84232a25e0ced165d4bb5643d3aaad Mon Sep 17 00:00:00 2001
From: Chris Wilson <chris@...is-wilson.co.uk>
Date: Fri, 17 Jun 2011 10:04:22 -0500
Subject: [PATCH 07/10] drm/i915/evict: Ensure we completely cleanup on failure

BugLink: http://bugs.launchpad.net/bugs/599017

... and not leave the objects in a inconsistent state.

[seth.forshee@...onical.com: Also backported similar cleanups in success
 path from commit e39a01501b228e1be2037d5bddccae2a820af902]
Signed-off-by: Chris Wilson <chris@...is-wilson.co.uk>
Cc: stable@...nel.org
(backported from commit 092de6f225638ec300936bfcbdc67805733cc78c upstream)

Signed-off-by: Seth Forshee <seth.forshee@...onical.com>
Signed-off-by: Stefan Bader <stefan.bader@...onical.com>
---
 drivers/gpu/drm/i915/i915_gem_evict.c |   32 ++++++++++++++++++++------------
 1 files changed, 20 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_evict.c b/drivers/gpu/drm/i915/i915_gem_evict.c
index 84ed1a7..9c1ec78 100644
--- a/drivers/gpu/drm/i915/i915_gem_evict.c
+++ b/drivers/gpu/drm/i915/i915_gem_evict.c
@@ -134,9 +134,15 @@ i915_gem_evict_something(struct drm_device *dev, int min_size, unsigned alignmen
 	}

 	/* Nothing found, clean up and bail out! */
-	list_for_each_entry(obj_priv, &unwind_list, evict_list) {
+	while (!list_empty(&unwind_list)) {
+		obj_priv = list_first_entry(&unwind_list,
+					    struct drm_i915_gem_object,
+					    evict_list);
+
 		ret = drm_mm_scan_remove_block(obj_priv->gtt_space);
 		BUG_ON(ret);
+
+		list_del_init(&obj_priv->evict_list);
 	}

 	/* We expect the caller to unpin, evict all and try again, or give up.
@@ -145,26 +151,28 @@ i915_gem_evict_something(struct drm_device *dev, int min_size, unsigned alignmen
 	return -ENOSPC;

 found:
+	/* drm_mm doesn't allow any other other operations while
+	 * scanning, therefore store to be evicted objects on a
+	 * temporary list. */
 	INIT_LIST_HEAD(&eviction_list);
 	list_for_each_entry_safe(obj_priv, tmp_obj_priv,
 				 &unwind_list, evict_list) {
 		if (drm_mm_scan_remove_block(obj_priv->gtt_space)) {
-			/* drm_mm doesn't allow any other other operations while
-			 * scanning, therefore store to be evicted objects on a
-			 * temporary list. */
 			list_move(&obj_priv->evict_list, &eviction_list);
+			continue;
 		}
+		list_del_init(&obj_priv->evict_list);
 	}

 	/* Unbinding will emit any required flushes */
-	list_for_each_entry_safe(obj_priv, tmp_obj_priv,
-				 &eviction_list, evict_list) {
-#if WATCH_LRU
-		DRM_INFO("%s: evicting %p\n", __func__, obj);
-#endif
-		ret = i915_gem_object_unbind(obj_priv->obj);
-		if (ret)
-			return ret;
+	while (!list_empty(&eviction_list)) {
+		obj_priv = list_first_entry(&eviction_list,
+					    struct drm_i915_gem_object,
+					    evict_list);
+		if (ret == 0)
+			ret = i915_gem_object_unbind(obj_priv->obj);
+
+		list_del_init(&obj_priv->evict_list);
 	}

 	/* The just created free hole should be on the top of the free stack
--
1.7.4.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ