<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-toradex.git/drivers/gpu/drm/radeon/r600_cs.c, branch v4.2.2</title>
<subtitle>Linux kernel for Apalis and Colibri modules</subtitle>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/'/>
<entry>
<title>drm/radeon: use pointers instead of indexes for CS chunks</title>
<updated>2014-12-03T23:26:53+00:00</updated>
<author>
<name>Christian König</name>
<email>christian.koenig@amd.com</email>
</author>
<published>2014-12-03T14:53:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=6d2d13dd0e746a2bbdd2159abbdf603f0e37189e'/>
<id>6d2d13dd0e746a2bbdd2159abbdf603f0e37189e</id>
<content type='text'>
Nobody is interested at which index the chunk is. What's needed is
a pointer to the chunk. Remove unused chunk_id field as well.

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>
Nobody is interested at which index the chunk is. What's needed is
a pointer to the chunk. Remove unused chunk_id field as well.

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/radeon: remove duplicates check</title>
<updated>2014-12-03T23:26:53+00:00</updated>
<author>
<name>Christian König</name>
<email>christian.koenig@amd.com</email>
</author>
<published>2014-12-03T14:46:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=466be3386f1c14451a9a9c0a586a9df5f06eecdf'/>
<id>466be3386f1c14451a9a9c0a586a9df5f06eecdf</id>
<content type='text'>
Completely unnecessary since the ww_mutex used to reserve a buffer
can detect double reservations from the same thread anyway.

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>
Completely unnecessary since the ww_mutex used to reserve a buffer
can detect double reservations from the same thread anyway.

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/radeon: rename radeon_cs_reloc to radeon_bo_list</title>
<updated>2014-12-03T19:26:47+00:00</updated>
<author>
<name>Christian König</name>
<email>christian.koenig@amd.com</email>
</author>
<published>2014-11-27T13:48:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=1d0c094201bd4cae03118a1dfcb45516bb6a3ec7'/>
<id>1d0c094201bd4cae03118a1dfcb45516bb6a3ec7</id>
<content type='text'>
Better match what it is actually doing.

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>
Better match what it is actually doing.

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/radeon: use helpers</title>
<updated>2014-07-18T04:25:23+00:00</updated>
<author>
<name>Rob Clark</name>
<email>robdclark@gmail.com</email>
</author>
<published>2014-07-18T03:30:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=b957f457fbce30cc4901dc28f2b56f2b15dfe84a'/>
<id>b957f457fbce30cc4901dc28f2b56f2b15dfe84a</id>
<content type='text'>
Signed-off-by: Rob Clark &lt;robdclark@gmail.com&gt;
Signed-off-by: Dave Airlie &lt;airlied@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Rob Clark &lt;robdclark@gmail.com&gt;
Signed-off-by: Dave Airlie &lt;airlied@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>drm/radeon: remove struct radeon_bo_list</title>
<updated>2014-03-04T13:34:34+00:00</updated>
<author>
<name>Christian König</name>
<email>christian.koenig@amd.com</email>
</author>
<published>2014-03-03T11:38:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=df0af4403aa8df728a62ccb62a61b3244871068f'/>
<id>df0af4403aa8df728a62ccb62a61b3244871068f</id>
<content type='text'>
Just move all fields into radeon_cs_reloc, removing unused/duplicated fields.

Signed-off-by: Christian König &lt;christian.koenig@amd.com&gt;
Reviewed-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Just move all fields into radeon_cs_reloc, removing unused/duplicated fields.

Signed-off-by: Christian König &lt;christian.koenig@amd.com&gt;
Reviewed-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>drm/radeon: allow geom rings to be setup on r600/r700 (v2)</title>
<updated>2014-02-06T02:13:52+00:00</updated>
<author>
<name>Dave Airlie</name>
<email>airlied@redhat.com</email>
</author>
<published>2014-01-30T04:11:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=7c4c62a04a2a80e3feb5d6c97aca1e413b11c790'/>
<id>7c4c62a04a2a80e3feb5d6c97aca1e413b11c790</id>
<content type='text'>
the evergreen CS parser has allowed this for a while, just port
the code to the r600 one.

This is required before geom shaders can be made work.

v2: agd5f: minor cleanup and add additional 7xx reg.

Signed-off-by: Dave Airlie &lt;airlied@redhat.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
Signed-off-by: Dave Airlie &lt;airlied@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
the evergreen CS parser has allowed this for a while, just port
the code to the r600 one.

This is required before geom shaders can be made work.

v2: agd5f: minor cleanup and add additional 7xx reg.

Signed-off-by: Dave Airlie &lt;airlied@redhat.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
Signed-off-by: Dave Airlie &lt;airlied@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>drm/radeon: skip colorbuffer checking if COLOR_INFO.FORMAT is set to INVALID</title>
<updated>2014-01-08T17:25:43+00:00</updated>
<author>
<name>Marek Olšák</name>
<email>marek.olsak@amd.com</email>
</author>
<published>2014-01-08T17:16:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=56492e0fac2dbaf7735ffd66b206a90624917789'/>
<id>56492e0fac2dbaf7735ffd66b206a90624917789</id>
<content type='text'>
This fixes a bug which was causing rejections of valid GPU commands
from userspace.

Signed-off-by: Marek Olšák &lt;marek.olsak@amd.com&gt;
Cc: stable@vger.kernel.org
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 fixes a bug which was causing rejections of valid GPU commands
from userspace.

Signed-off-by: Marek Olšák &lt;marek.olsak@amd.com&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>drm: Kill DRM_COPY_(TO|FROM)_USER</title>
<updated>2013-12-18T01:35:01+00:00</updated>
<author>
<name>Daniel Vetter</name>
<email>daniel.vetter@ffwll.ch</email>
</author>
<published>2013-12-11T10:34:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=1d6ac185c32134233f77ce44800ceb4ab9361401'/>
<id>1d6ac185c32134233f77ce44800ceb4ab9361401</id>
<content type='text'>
Less yelling ftw!

Signed-off-by: Daniel Vetter &lt;daniel.vetter@ffwll.ch&gt;
Signed-off-by: Dave Airlie &lt;airlied@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Less yelling ftw!

Signed-off-by: Daniel Vetter &lt;daniel.vetter@ffwll.ch&gt;
Signed-off-by: Dave Airlie &lt;airlied@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>drm/radeon: Return -ENOENT when a mode object can't be found</title>
<updated>2013-11-06T03:25:20+00:00</updated>
<author>
<name>Ville Syrjälä</name>
<email>ville.syrjala@linux.intel.com</email>
</author>
<published>2013-10-17T10:35:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=10e10d34eec680490ccba7f9d53ffd0816f107f6'/>
<id>10e10d34eec680490ccba7f9d53ffd0816f107f6</id>
<content type='text'>
Let's be a bit more consistent with our error values.

Signed-off-by: Ville Syrjälä &lt;ville.syrjala@linux.intel.com&gt;
Signed-off-by: Dave Airlie &lt;airlied@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Let's be a bit more consistent with our error values.

Signed-off-by: Ville Syrjälä &lt;ville.syrjala@linux.intel.com&gt;
Signed-off-by: Dave Airlie &lt;airlied@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>drm/radeon: fixup locking inversion between, mmap_sem and reservations</title>
<updated>2013-11-01T19:25:54+00:00</updated>
<author>
<name>Maarten Lankhorst</name>
<email>maarten.lankhorst@canonical.com</email>
</author>
<published>2013-10-09T12:36:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=28a326c592e3e444c59f28b3e60c3b07692928d6'/>
<id>28a326c592e3e444c59f28b3e60c3b07692928d6</id>
<content type='text'>
op 08-10-13 18:58, Thomas Hellstrom schreef:
&gt; On 10/08/2013 06:47 PM, Jerome Glisse wrote:
&gt;&gt; On Tue, Oct 08, 2013 at 06:29:35PM +0200, Thomas Hellstrom wrote:
&gt;&gt;&gt; On 10/08/2013 04:55 PM, Jerome Glisse wrote:
&gt;&gt;&gt;&gt; On Tue, Oct 08, 2013 at 04:45:18PM +0200, Christian König wrote:
&gt;&gt;&gt;&gt;&gt; Am 08.10.2013 16:33, schrieb Jerome Glisse:
&gt;&gt;&gt;&gt;&gt;&gt; On Tue, Oct 08, 2013 at 04:14:40PM +0200, Maarten Lankhorst wrote:
&gt;&gt;&gt;&gt;&gt;&gt;&gt; Allocate and copy all kernel memory before doing reservations. This prevents a locking
&gt;&gt;&gt;&gt;&gt;&gt;&gt; inversion between mmap_sem and reservation_class, and allows us to drop the trylocking
&gt;&gt;&gt;&gt;&gt;&gt;&gt; in ttm_bo_vm_fault without upsetting lockdep.
&gt;&gt;&gt;&gt;&gt;&gt;&gt;
&gt;&gt;&gt;&gt;&gt;&gt;&gt; Signed-off-by: Maarten Lankhorst &lt;maarten.lankhorst@canonical.com&gt;
&gt;&gt;&gt;&gt;&gt;&gt; I would say NAK. Current code only allocate temporary page in AGP case.
&gt;&gt;&gt;&gt;&gt;&gt; So AGP case is userspace -&gt; temp page -&gt; cs checker -&gt; radeon ib.
&gt;&gt;&gt;&gt;&gt;&gt;
&gt;&gt;&gt;&gt;&gt;&gt; Non AGP is directly memcpy to radeon IB.
&gt;&gt;&gt;&gt;&gt;&gt;
&gt;&gt;&gt;&gt;&gt;&gt; Your patch allocate memory memcpy userspace to it and it will then be
&gt;&gt;&gt;&gt;&gt;&gt; memcpy to IB. Which means you introduce an extra memcpy in the process
&gt;&gt;&gt;&gt;&gt;&gt; not something we want.
&gt;&gt;&gt;&gt;&gt; Totally agree. Additional to that there is no good reason to provide
&gt;&gt;&gt;&gt;&gt; anything else than anonymous system memory to the CS ioctl, so the
&gt;&gt;&gt;&gt;&gt; dependency between the mmap_sem and reservations are not really
&gt;&gt;&gt;&gt;&gt; clear to me.
&gt;&gt;&gt;&gt;&gt;
&gt;&gt;&gt;&gt;&gt; Christian.
&gt;&gt;&gt;&gt; I think is that in other code path you take mmap_sem first then reserve
&gt;&gt;&gt;&gt; bo. But here we reserve bo and then we take mmap_sem because of copy
&gt;&gt;&gt; &gt;from user.
&gt;&gt;&gt;&gt; Cheers,
&gt;&gt;&gt;&gt; Jerome
&gt;&gt;&gt;&gt;
&gt;&gt;&gt; Actually the log message is a little confusing. I think the mmap_sem
&gt;&gt;&gt; locking inversion problem is orthogonal to what's being fixed here.
&gt;&gt;&gt;
&gt;&gt;&gt; This patch fixes the possible recursive bo::reserve caused by
&gt;&gt;&gt; malicious user-space handing a pointer to ttm memory so that the ttm
&gt;&gt;&gt; fault handler is called when bos are already reserved. That may
&gt;&gt;&gt; cause a (possibly interruptible) livelock.
&gt;&gt;&gt;
&gt;&gt;&gt; Once that is fixed, we are free to choose the mmap_sem -&gt;
&gt;&gt;&gt; bo::reserve locking order. Currently it's bo::reserve-&gt;mmap_sem(),
&gt;&gt;&gt; but the hack required in the ttm fault handler is admittedly a bit
&gt;&gt;&gt; ugly.  The plan is to change the locking order to
&gt;&gt;&gt; mmap_sem-&gt;bo::reserve
&gt;&gt;&gt;
&gt;&gt;&gt; I'm not sure if it applies to this particular case, but it should be
&gt;&gt;&gt; possible to make sure that copy_from_user_inatomic() will always
&gt;&gt;&gt; succeed, by making sure the pages are present using
&gt;&gt;&gt; get_user_pages(), and release the pages after
&gt;&gt;&gt; copy_from_user_inatomic() is done. That way there's no need for a
&gt;&gt;&gt; double memcpy slowpath, but if the copied data is very fragmented I
&gt;&gt;&gt; guess the resulting code may look ugly. The get_user_pages()
&gt;&gt;&gt; function will return an error if it hits TTM pages.
&gt;&gt;&gt;
&gt;&gt;&gt; /Thomas
&gt;&gt; get_user_pages + copy_from_user_inatomic is overkill. We should just
&gt;&gt; do get_user_pages which fails with ttm memory and then use copy_highpage
&gt;&gt; helper.
&gt;&gt;
&gt;&gt; Cheers,
&gt;&gt; Jerome
&gt; Yeah, it may well be that that's the preferred solution.
&gt;
&gt; /Thomas
&gt;
I still disagree, and shuffled radeon_ib_get around to be called sooner.

How does the patch below look?
8&lt;-------
Allocate and copy all kernel memory before doing reservations. This prevents a locking
inversion between mmap_sem and reservation_class, and allows us to drop the trylocking
in ttm_bo_vm_fault without upsetting lockdep.

Changes since v1:
- Kill extra memcpy for !AGP case.

Signed-off-by: Maarten Lankhorst &lt;maarten.lankhorst@canonical.com&gt;
Reviewed-by: Jerome Glisse &lt;jglisse@redhat.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>
op 08-10-13 18:58, Thomas Hellstrom schreef:
&gt; On 10/08/2013 06:47 PM, Jerome Glisse wrote:
&gt;&gt; On Tue, Oct 08, 2013 at 06:29:35PM +0200, Thomas Hellstrom wrote:
&gt;&gt;&gt; On 10/08/2013 04:55 PM, Jerome Glisse wrote:
&gt;&gt;&gt;&gt; On Tue, Oct 08, 2013 at 04:45:18PM +0200, Christian König wrote:
&gt;&gt;&gt;&gt;&gt; Am 08.10.2013 16:33, schrieb Jerome Glisse:
&gt;&gt;&gt;&gt;&gt;&gt; On Tue, Oct 08, 2013 at 04:14:40PM +0200, Maarten Lankhorst wrote:
&gt;&gt;&gt;&gt;&gt;&gt;&gt; Allocate and copy all kernel memory before doing reservations. This prevents a locking
&gt;&gt;&gt;&gt;&gt;&gt;&gt; inversion between mmap_sem and reservation_class, and allows us to drop the trylocking
&gt;&gt;&gt;&gt;&gt;&gt;&gt; in ttm_bo_vm_fault without upsetting lockdep.
&gt;&gt;&gt;&gt;&gt;&gt;&gt;
&gt;&gt;&gt;&gt;&gt;&gt;&gt; Signed-off-by: Maarten Lankhorst &lt;maarten.lankhorst@canonical.com&gt;
&gt;&gt;&gt;&gt;&gt;&gt; I would say NAK. Current code only allocate temporary page in AGP case.
&gt;&gt;&gt;&gt;&gt;&gt; So AGP case is userspace -&gt; temp page -&gt; cs checker -&gt; radeon ib.
&gt;&gt;&gt;&gt;&gt;&gt;
&gt;&gt;&gt;&gt;&gt;&gt; Non AGP is directly memcpy to radeon IB.
&gt;&gt;&gt;&gt;&gt;&gt;
&gt;&gt;&gt;&gt;&gt;&gt; Your patch allocate memory memcpy userspace to it and it will then be
&gt;&gt;&gt;&gt;&gt;&gt; memcpy to IB. Which means you introduce an extra memcpy in the process
&gt;&gt;&gt;&gt;&gt;&gt; not something we want.
&gt;&gt;&gt;&gt;&gt; Totally agree. Additional to that there is no good reason to provide
&gt;&gt;&gt;&gt;&gt; anything else than anonymous system memory to the CS ioctl, so the
&gt;&gt;&gt;&gt;&gt; dependency between the mmap_sem and reservations are not really
&gt;&gt;&gt;&gt;&gt; clear to me.
&gt;&gt;&gt;&gt;&gt;
&gt;&gt;&gt;&gt;&gt; Christian.
&gt;&gt;&gt;&gt; I think is that in other code path you take mmap_sem first then reserve
&gt;&gt;&gt;&gt; bo. But here we reserve bo and then we take mmap_sem because of copy
&gt;&gt;&gt; &gt;from user.
&gt;&gt;&gt;&gt; Cheers,
&gt;&gt;&gt;&gt; Jerome
&gt;&gt;&gt;&gt;
&gt;&gt;&gt; Actually the log message is a little confusing. I think the mmap_sem
&gt;&gt;&gt; locking inversion problem is orthogonal to what's being fixed here.
&gt;&gt;&gt;
&gt;&gt;&gt; This patch fixes the possible recursive bo::reserve caused by
&gt;&gt;&gt; malicious user-space handing a pointer to ttm memory so that the ttm
&gt;&gt;&gt; fault handler is called when bos are already reserved. That may
&gt;&gt;&gt; cause a (possibly interruptible) livelock.
&gt;&gt;&gt;
&gt;&gt;&gt; Once that is fixed, we are free to choose the mmap_sem -&gt;
&gt;&gt;&gt; bo::reserve locking order. Currently it's bo::reserve-&gt;mmap_sem(),
&gt;&gt;&gt; but the hack required in the ttm fault handler is admittedly a bit
&gt;&gt;&gt; ugly.  The plan is to change the locking order to
&gt;&gt;&gt; mmap_sem-&gt;bo::reserve
&gt;&gt;&gt;
&gt;&gt;&gt; I'm not sure if it applies to this particular case, but it should be
&gt;&gt;&gt; possible to make sure that copy_from_user_inatomic() will always
&gt;&gt;&gt; succeed, by making sure the pages are present using
&gt;&gt;&gt; get_user_pages(), and release the pages after
&gt;&gt;&gt; copy_from_user_inatomic() is done. That way there's no need for a
&gt;&gt;&gt; double memcpy slowpath, but if the copied data is very fragmented I
&gt;&gt;&gt; guess the resulting code may look ugly. The get_user_pages()
&gt;&gt;&gt; function will return an error if it hits TTM pages.
&gt;&gt;&gt;
&gt;&gt;&gt; /Thomas
&gt;&gt; get_user_pages + copy_from_user_inatomic is overkill. We should just
&gt;&gt; do get_user_pages which fails with ttm memory and then use copy_highpage
&gt;&gt; helper.
&gt;&gt;
&gt;&gt; Cheers,
&gt;&gt; Jerome
&gt; Yeah, it may well be that that's the preferred solution.
&gt;
&gt; /Thomas
&gt;
I still disagree, and shuffled radeon_ib_get around to be called sooner.

How does the patch below look?
8&lt;-------
Allocate and copy all kernel memory before doing reservations. This prevents a locking
inversion between mmap_sem and reservation_class, and allows us to drop the trylocking
in ttm_bo_vm_fault without upsetting lockdep.

Changes since v1:
- Kill extra memcpy for !AGP case.

Signed-off-by: Maarten Lankhorst &lt;maarten.lankhorst@canonical.com&gt;
Reviewed-by: Jerome Glisse &lt;jglisse@redhat.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
