<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-stable.git/drivers/gpu/drm/ttm, branch linux-3.19.y</title>
<subtitle>Linux kernel stable tree</subtitle>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/'/>
<entry>
<title>drm/ttm: optionally move duplicates to a separate list</title>
<updated>2014-12-03T23:26:52+00:00</updated>
<author>
<name>Christian König</name>
<email>christian.koenig@amd.com</email>
</author>
<published>2014-12-03T14:46:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=aa35071c590461f95d0179cc8e730d49d610f773'/>
<id>aa35071c590461f95d0179cc8e730d49d610f773</id>
<content type='text'>
This patch adds an optional list_head parameter to ttm_eu_reserve_buffers.
If specified duplicates in the execbuf list are no longer reported as errors,
but moved to this list instead.

Reviewed-by: Thomas Hellstrom &lt;thellstrom@vmware.com&gt;
Signed-off-by: Christian König &lt;christian.koenig@amd.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch adds an optional list_head parameter to ttm_eu_reserve_buffers.
If specified duplicates in the execbuf list are no longer reported as errors,
but moved to this list instead.

Reviewed-by: Thomas Hellstrom &lt;thellstrom@vmware.com&gt;
Signed-off-by: Christian König &lt;christian.koenig@amd.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>drm/ttm: Avoid memory allocation from shrinker functions.</title>
<updated>2014-11-20T01:31:56+00:00</updated>
<author>
<name>Tetsuo Handa</name>
<email>penguin-kernel@I-love.SAKURA.ne.jp</email>
</author>
<published>2014-11-13T13:43:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=881fdaa5e4cb0d68e52acab0ad4e1820e2bfffa4'/>
<id>881fdaa5e4cb0d68e52acab0ad4e1820e2bfffa4</id>
<content type='text'>
Andrew Morton wrote:
&gt; On Wed, 12 Nov 2014 13:08:55 +0900 Tetsuo Handa &lt;penguin-kernel@i-love.sakura.ne.jp&gt; wrote:
&gt;
&gt; &gt; Andrew Morton wrote:
&gt; &gt; &gt; Poor ttm guys - this is a bit of a trap we set for them.
&gt; &gt;
&gt; &gt; Commit a91576d7916f6cce ("drm/ttm: Pass GFP flags in order to avoid deadlock.")
&gt; &gt; changed to use sc-&gt;gfp_mask rather than GFP_KERNEL.
&gt; &gt;
&gt; &gt; -       pages_to_free = kmalloc(npages_to_free * sizeof(struct page *),
&gt; &gt; -                       GFP_KERNEL);
&gt; &gt; +       pages_to_free = kmalloc(npages_to_free * sizeof(struct page *), gfp);
&gt; &gt;
&gt; &gt; But this bug is caused by sc-&gt;gfp_mask containing some flags which are not
&gt; &gt; in GFP_KERNEL, right? Then, I think
&gt; &gt;
&gt; &gt; -       pages_to_free = kmalloc(npages_to_free * sizeof(struct page *), gfp);
&gt; &gt; +       pages_to_free = kmalloc(npages_to_free * sizeof(struct page *), gfp &amp; GFP_KERNEL);
&gt; &gt;
&gt; &gt; would hide this bug.
&gt; &gt;
&gt; &gt; But I think we should use GFP_ATOMIC (or drop __GFP_WAIT flag)
&gt;
&gt; Well no - ttm_page_pool_free() should stop calling kmalloc altogether.
&gt; Just do
&gt;
&gt; 	struct page *pages_to_free[16];
&gt;
&gt; and rework the code to free 16 pages at a time.  Easy.

Well, ttm code wants to process 512 pages at a time for performance.
Memory footprint increased by 512 * sizeof(struct page *) buffer is
only 4096 bytes. What about using static buffer like below?
----------
&gt;From d3cb5393c9c8099d6b37e769f78c31af1541fe8c Mon Sep 17 00:00:00 2001
From: Tetsuo Handa &lt;penguin-kernel@I-love.SAKURA.ne.jp&gt;
Date: Thu, 13 Nov 2014 22:21:54 +0900
Subject: [PATCH] drm/ttm: Avoid memory allocation from shrinker functions.

Commit a91576d7916f6cce ("drm/ttm: Pass GFP flags in order to avoid
deadlock.") caused BUG_ON() due to sc-&gt;gfp_mask containing flags
which are not in GFP_KERNEL.

  https://bugzilla.kernel.org/show_bug.cgi?id=87891

Changing from sc-&gt;gfp_mask to (sc-&gt;gfp_mask &amp; GFP_KERNEL) would
avoid the BUG_ON(), but avoiding memory allocation from shrinker
function is better and reliable fix.

Shrinker function is already serialized by global lock, and
clean up function is called after shrinker function is unregistered.
Thus, we can use static buffer when called from shrinker function
and clean up function.

Signed-off-by: Tetsuo Handa &lt;penguin-kernel@I-love.SAKURA.ne.jp&gt;
Cc: stable &lt;stable@kernel.org&gt; [2.6.35+]
Signed-off-by: Dave Airlie &lt;airlied@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Andrew Morton wrote:
&gt; On Wed, 12 Nov 2014 13:08:55 +0900 Tetsuo Handa &lt;penguin-kernel@i-love.sakura.ne.jp&gt; wrote:
&gt;
&gt; &gt; Andrew Morton wrote:
&gt; &gt; &gt; Poor ttm guys - this is a bit of a trap we set for them.
&gt; &gt;
&gt; &gt; Commit a91576d7916f6cce ("drm/ttm: Pass GFP flags in order to avoid deadlock.")
&gt; &gt; changed to use sc-&gt;gfp_mask rather than GFP_KERNEL.
&gt; &gt;
&gt; &gt; -       pages_to_free = kmalloc(npages_to_free * sizeof(struct page *),
&gt; &gt; -                       GFP_KERNEL);
&gt; &gt; +       pages_to_free = kmalloc(npages_to_free * sizeof(struct page *), gfp);
&gt; &gt;
&gt; &gt; But this bug is caused by sc-&gt;gfp_mask containing some flags which are not
&gt; &gt; in GFP_KERNEL, right? Then, I think
&gt; &gt;
&gt; &gt; -       pages_to_free = kmalloc(npages_to_free * sizeof(struct page *), gfp);
&gt; &gt; +       pages_to_free = kmalloc(npages_to_free * sizeof(struct page *), gfp &amp; GFP_KERNEL);
&gt; &gt;
&gt; &gt; would hide this bug.
&gt; &gt;
&gt; &gt; But I think we should use GFP_ATOMIC (or drop __GFP_WAIT flag)
&gt;
&gt; Well no - ttm_page_pool_free() should stop calling kmalloc altogether.
&gt; Just do
&gt;
&gt; 	struct page *pages_to_free[16];
&gt;
&gt; and rework the code to free 16 pages at a time.  Easy.

Well, ttm code wants to process 512 pages at a time for performance.
Memory footprint increased by 512 * sizeof(struct page *) buffer is
only 4096 bytes. What about using static buffer like below?
----------
&gt;From d3cb5393c9c8099d6b37e769f78c31af1541fe8c Mon Sep 17 00:00:00 2001
From: Tetsuo Handa &lt;penguin-kernel@I-love.SAKURA.ne.jp&gt;
Date: Thu, 13 Nov 2014 22:21:54 +0900
Subject: [PATCH] drm/ttm: Avoid memory allocation from shrinker functions.

Commit a91576d7916f6cce ("drm/ttm: Pass GFP flags in order to avoid
deadlock.") caused BUG_ON() due to sc-&gt;gfp_mask containing flags
which are not in GFP_KERNEL.

  https://bugzilla.kernel.org/show_bug.cgi?id=87891

Changing from sc-&gt;gfp_mask to (sc-&gt;gfp_mask &amp; GFP_KERNEL) would
avoid the BUG_ON(), but avoiding memory allocation from shrinker
function is better and reliable fix.

Shrinker function is already serialized by global lock, and
clean up function is called after shrinker function is unregistered.
Thus, we can use static buffer when called from shrinker function
and clean up function.

Signed-off-by: Tetsuo Handa &lt;penguin-kernel@I-love.SAKURA.ne.jp&gt;
Cc: stable &lt;stable@kernel.org&gt; [2.6.35+]
Signed-off-by: Dave Airlie &lt;airlied@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>drm/ttm: Use only DRM_MM_SEARCH_BELOW for TTM_PL_FLAG_TOPDOWN</title>
<updated>2014-11-12T16:56:33+00:00</updated>
<author>
<name>Michel Dänzer</name>
<email>michel.daenzer@amd.com</email>
</author>
<published>2014-10-28T09:35:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=507d0ca71bcbefd8623eb20f4de1b5f4e103a48b'/>
<id>507d0ca71bcbefd8623eb20f4de1b5f4e103a48b</id>
<content type='text'>
DRM_MM_SEARCH_BEST gets the smallest hole which can fit the BO. That seems
against the idea of TTM_PL_FLAG_TOPDOWN:

* The smallest hole may be in the overall bottom of the area
* If the hole isn't much larger than the BO, it doesn't make much
  difference whether the BO is placed at the bottom or at the top of the
  hole

Reviewed-by: Lauri Kasanen &lt;cand@gmx.com&gt;
Signed-off-by: Michel Dänzer &lt;michel.daenzer@amd.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
DRM_MM_SEARCH_BEST gets the smallest hole which can fit the BO. That seems
against the idea of TTM_PL_FLAG_TOPDOWN:

* The smallest hole may be in the overall bottom of the area
* If the hole isn't much larger than the BO, it doesn't make much
  difference whether the BO is placed at the bottom or at the top of the
  hole

Reviewed-by: Lauri Kasanen &lt;cand@gmx.com&gt;
Signed-off-by: Michel Dänzer &lt;michel.daenzer@amd.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>drm/ttm: Add DRM_MM_SEARCH_BELOW for TTM_PL_FLAG_TOPDOWN</title>
<updated>2014-11-12T16:56:32+00:00</updated>
<author>
<name>Michel Dänzer</name>
<email>michel.daenzer@amd.com</email>
</author>
<published>2014-10-28T09:35:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=c165812cbf6cf4bdd62f174115c01017f55f0933'/>
<id>c165812cbf6cf4bdd62f174115c01017f55f0933</id>
<content type='text'>
If the BO should be placed at the top of the area, we should start looking
for holes from the top.

Reviewed-by: Lauri Kasanen &lt;cand@gmx.com&gt;
Signed-off-by: Michel Dänzer &lt;michel.daenzer@amd.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If the BO should be placed at the top of the area, we should start looking
for holes from the top.

Reviewed-by: Lauri Kasanen &lt;cand@gmx.com&gt;
Signed-off-by: Michel Dänzer &lt;michel.daenzer@amd.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>drm/ttm: Don't evict BOs outside of the requested placement range</title>
<updated>2014-10-16T22:34:08+00:00</updated>
<author>
<name>Michel Dänzer</name>
<email>michel.daenzer@amd.com</email>
</author>
<published>2014-10-09T06:02:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=e300180f71037fd9ed1ca967006fd9f3ee466bcd'/>
<id>e300180f71037fd9ed1ca967006fd9f3ee466bcd</id>
<content type='text'>
The radeon driver uses placement range restrictions for several reasons,
in particular to make sure BOs in VRAM can be accessed by the CPU, e.g.
during a page fault.

Without this change, TTM could evict other BOs while trying to satisfy
the requested placement, even if the evicted BOs were outside of the
requested placement range. Doing so didn't free up any space in the
requested placement range, so the (potentially high) eviction cost was
incurred for no benefit.

Nominating for stable because radeon driver changes in 3.17 made this
much more noticeable than before.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=84662
Cc: stable@vger.kernel.org
Signed-off-by: Michel Dänzer &lt;michel.daenzer@amd.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The radeon driver uses placement range restrictions for several reasons,
in particular to make sure BOs in VRAM can be accessed by the CPU, e.g.
during a page fault.

Without this change, TTM could evict other BOs while trying to satisfy
the requested placement, even if the evicted BOs were outside of the
requested placement range. Doing so didn't free up any space in the
requested placement range, so the (potentially high) eviction cost was
incurred for no benefit.

Nominating for stable because radeon driver changes in 3.17 made this
much more noticeable than before.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=84662
Cc: stable@vger.kernel.org
Signed-off-by: Michel Dänzer &lt;michel.daenzer@amd.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>drm/ttm: Don't skip fpfn check if lpfn is 0 in ttm_bo_mem_compat</title>
<updated>2014-10-16T22:34:08+00:00</updated>
<author>
<name>Michel Dänzer</name>
<email>michel.daenzer@amd.com</email>
</author>
<published>2014-10-09T06:03:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=9ace2ef7b78e573cedead0f08052b028181e6eaf'/>
<id>9ace2ef7b78e573cedead0f08052b028181e6eaf</id>
<content type='text'>
Reviewed-by: Christian König &lt;christian.koenig@amd.com&gt;
Signed-off-by: Michel Dänzer &lt;michel.daenzer@amd.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Reviewed-by: Christian König &lt;christian.koenig@amd.com&gt;
Signed-off-by: Michel Dänzer &lt;michel.daenzer@amd.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>drm/ttm: add reservation_object as argument to ttm_bo_init</title>
<updated>2014-09-30T12:04:00+00:00</updated>
<author>
<name>Maarten Lankhorst</name>
<email>maarten.lankhorst@canonical.com</email>
</author>
<published>2014-01-09T10:03:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=f4f4e3e3e9f3bde110067b9e4487cb267d90055a'/>
<id>f4f4e3e3e9f3bde110067b9e4487cb267d90055a</id>
<content type='text'>
This allows importing reservation objects from dma-bufs.

Signed-off-by: Maarten Lankhorst &lt;maarten.lankhorst@canonical.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This allows importing reservation objects from dma-bufs.

Signed-off-by: Maarten Lankhorst &lt;maarten.lankhorst@canonical.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>drm/ttm: Clean usage of ttm_io_prot() with TTM_PL_FLAG_CACHED</title>
<updated>2014-09-23T05:00:26+00:00</updated>
<author>
<name>Benjamin Herrenschmidt</name>
<email>benh@kernel.crashing.org</email>
</author>
<published>2014-09-04T07:47:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=94318d50ffc84a1ebaf1a83a0a56bbbaf415bacf'/>
<id>94318d50ffc84a1ebaf1a83a0a56bbbaf415bacf</id>
<content type='text'>
Today, most callers of ttm_io_prot() check TTM_PL_FLAG_CACHED before
calling it since on some archs it will unconditionally create non-cached
mappings.

But not all callers do which is incorrect as far as I can tell.

Instead, move that check inside ttm_io_port() itself for all archs
and make powerpc use the same implementation as ia64 and arm

Signed-off-by: Benjamin Herrenschmidt &lt;benh@kernel.crashing.org&gt;
Signed-off-by: Dave Airlie &lt;airlied@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Today, most callers of ttm_io_prot() check TTM_PL_FLAG_CACHED before
calling it since on some archs it will unconditionally create non-cached
mappings.

But not all callers do which is incorrect as far as I can tell.

Instead, move that check inside ttm_io_port() itself for all archs
and make powerpc use the same implementation as ia64 and arm

Signed-off-by: Benjamin Herrenschmidt &lt;benh@kernel.crashing.org&gt;
Signed-off-by: Dave Airlie &lt;airlied@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>drm/ttm: make sure format string cannot leak in</title>
<updated>2014-09-17T01:15:01+00:00</updated>
<author>
<name>Kees Cook</name>
<email>keescook@chromium.org</email>
</author>
<published>2014-09-11T20:53:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=109ab90974995a06aeabab1535b0ce00f26dd24a'/>
<id>109ab90974995a06aeabab1535b0ce00f26dd24a</id>
<content type='text'>
While zone-&gt;name is currently hard coded, the call to kobject_init_and_add()
should follow the more defensive argument list usage (as already done in
other places in ttm_memory.c) where "%s" is used instead of directly passing
in a variable as a format string.

Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Signed-off-by: Dave Airlie &lt;airlied@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
While zone-&gt;name is currently hard coded, the call to kobject_init_and_add()
should follow the more defensive argument list usage (as already done in
other places in ttm_memory.c) where "%s" is used instead of directly passing
in a variable as a format string.

Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Signed-off-by: Dave Airlie &lt;airlied@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>drm/ttm: allow fence to be added as shared</title>
<updated>2014-09-11T14:46:00+00:00</updated>
<author>
<name>Christian König</name>
<email>christian.koenig@amd.com</email>
</author>
<published>2014-09-04T18:01:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=ae9c0af2c0ea92e57013ab2dd7271ba7d6b2a833'/>
<id>ae9c0af2c0ea92e57013ab2dd7271ba7d6b2a833</id>
<content type='text'>
This patch adds a new flag to the ttm_validate_buffer list to
add the fence as shared to the reservation object.

Signed-off-by: Christian König &lt;christian.koenig@amd.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch adds a new flag to the ttm_validate_buffer list to
add the fence as shared to the reservation object.

Signed-off-by: Christian König &lt;christian.koenig@amd.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
