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: <20240722074540.15295-1-david@davidgow.net>
Date: Mon, 22 Jul 2024 15:45:38 +0800
From: David Gow <david@...idgow.net>
To: Christian König <ckoenig.leichtzumerken@...il.com>,
	Somalapuram Amaranath <Amaranath.Somalapuram@....com>,
	Thomas Hellström <thomas.hellstrom@...ux.intel.com>,
	Lucas De Marchi <lucas.demarchi@...el.com>,
	Andi Shyti <andi.shyti@...ux.intel.com>,
	Thomas Zimmermann <tzimmermann@...e.de>
Cc: David Gow <david@...idgow.net>,
	Jani Nikula <jani.nikula@...ux.intel.com>,
	Joonas Lahtinen <joonas.lahtinen@...ux.intel.com>,
	Rodrigo Vivi <rodrigo.vivi@...el.com>,
	Tvrtko Ursulin <tursulin@...ulin.net>,
	Ville Syrjälä <ville.syrjala@...ux.intel.com>,
	intel-gfx@...ts.freedesktop.org,
	dri-devel@...ts.freedesktop.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH] drm/i915: Allow evicting to use the requested placement

In a78a8da5 ("drm/ttm: replace busy placement with flags v6"), the old
system of having a separate placement list (for placements which should
be used without eviction) and a 'busy' placement list (for placements
which should be attempted if eviction is required) was replaced with a
new one where placements could be marked 'FALLBACK' (to be attempted if
eviction is required) or 'DESIRED' (to be attempted first, but not if
eviction is required).

i915 had always included the requested placement in the list of
'busy' placements: i.e., the placement could be used either if eviction
is required or not. But when the new system was put in place, the
requested (first) placement was marked 'DESIRED', so would never be used
if eviction became necessary. While a bug in the original commit
prevented this flag from working, when this was fixed in
4a0e7b3c ("drm/i915: fix applying placement flag"), it caused long hangs
on DG2 systems with small BAR.

Don't mark the requested placement DESIRED (or FALLBACK), allowing it to
be used in both situations. This matches the old behaviour, and resolves
the hangs.

Thanks to Justin Brewer for bisecting the issue.

Fixes: a78a8da51b36 ("drm/ttm: replace busy placement with flags v6")
Fixes: 4a0e7b3c3753 ("drm/i915: fix applying placement flag")
Link: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/11255
Signed-off-by: David Gow <david@...idgow.net>
---

I'm not 100% sure I understand exactly what went wrong here: I'm pretty
sure the patch is correct, but let me know if the commit description is
way off base.

My system works much better with this applied, but it's possible that it
could work better still with further changes: the buddy allocator is
still chewing up a lot of the CPU, and there are still cases where this
notably affects performance (though, in my experience, these are now
'hitches' rather than multi-minute hangs).

Cheers,
-- David

---
 drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c
index e6f177183c0f..fb848fd8ba15 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c
@@ -165,7 +165,6 @@ i915_ttm_placement_from_obj(const struct drm_i915_gem_object *obj,
 	i915_ttm_place_from_region(num_allowed ? obj->mm.placements[0] :
 				   obj->mm.region, &places[0], obj->bo_offset,
 				   obj->base.size, flags);
-	places[0].flags |= TTM_PL_FLAG_DESIRED;
 
 	/* Cache this on object? */
 	for (i = 0; i < num_allowed; ++i) {
-- 
2.45.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ