<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git/include/linux/reservation.h, branch v5.3.2</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v5.3.2</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v5.3.2'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/'/>
<updated>2019-06-12T14:27:44Z</updated>
<entry>
<title>dma-fence/reservation: Markup rcu protected access for DEBUG_MUTEXES</title>
<updated>2019-06-12T14:27:44Z</updated>
<author>
<name>Chris Wilson</name>
<email>chris@chris-wilson.co.uk</email>
</author>
<published>2019-06-12T13:28:30Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=5740671e596bdc3986a5391997de194300970201'/>
<id>urn:sha1:5740671e596bdc3986a5391997de194300970201</id>
<content type='text'>
Mark the access to reservation_object.fence as being protected to
silence sparse.

Signed-off-by: Chris Wilson &lt;chris@chris-wilson.co.uk&gt;
Reviewed-by: Christian König &lt;christian.koenig@amd.com&gt;
Link: https://patchwork.freedesktop.org/patch/msgid/20190612132830.31221-1-chris@chris-wilson.co.uk
</content>
</entry>
<entry>
<title>dma-buf: clarify locking documentation for reservation_object_get_excl</title>
<updated>2019-02-27T22:51:51Z</updated>
<author>
<name>Lucas Stach</name>
<email>l.stach@pengutronix.de</email>
</author>
<published>2018-01-11T16:48:29Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=372c9329e5aa896683999301d9cb10ef14da92af'/>
<id>urn:sha1:372c9329e5aa896683999301d9cb10ef14da92af</id>
<content type='text'>
The documentation was misleading, as for a lot of use-cases holding
the RCU read side lock is sufficient.

Signed-off-by: Lucas Stach &lt;l.stach@pengutronix.de&gt;
Reviewed-by: Christian König &lt;christian.koenig@amd.com&gt;
Link: https://patchwork.freedesktop.org/patch/msgid/20180111165302.25556-2-l.stach@pengutronix.de
</content>
</entry>
<entry>
<title>dma-buf: test shared slot allocation when mutex debugging is active</title>
<updated>2018-10-25T11:45:23Z</updated>
<author>
<name>Christian König</name>
<email>christian.koenig@amd.com</email>
</author>
<published>2018-10-04T12:45:17Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=99fe21a76f0f2d36e5f9afc95ce6ed5cc354ebad'/>
<id>urn:sha1:99fe21a76f0f2d36e5f9afc95ce6ed5cc354ebad</id>
<content type='text'>
Set shared_max to the number of shared fences right before we release
the lock.

This way every attempt to add a shared fence without previously
reserving a slot will cause an error.

Signed-off-by: Christian König &lt;christian.koenig@amd.com&gt;
Reviewed-by: Huang Rui &lt;ray.huang@amd.com&gt;
Acked-by: Junwei Zhang &lt;Jerry.Zhang@amd.com&gt;
Link: https://patchwork.kernel.org/patch/10626147/
</content>
</entry>
<entry>
<title>dma-buf: allow reserving more than one shared fence slot</title>
<updated>2018-10-25T11:45:07Z</updated>
<author>
<name>Christian König</name>
<email>christian.koenig@amd.com</email>
</author>
<published>2018-09-19T14:12:25Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=ca05359f1e64cf8303ee532e50efe4ab7563d4a9'/>
<id>urn:sha1:ca05359f1e64cf8303ee532e50efe4ab7563d4a9</id>
<content type='text'>
Let's support simultaneous submissions to multiple engines.

Signed-off-by: Christian König &lt;christian.koenig@amd.com&gt;
Reviewed-by: Michel Dänzer &lt;michel.daenzer@amd.com&gt;
Reviewed-by: Junwei Zhang &lt;Jerry.Zhang@amd.com&gt;
Reviewed-by: Huang Rui &lt;ray.huang@amd.com&gt;
Link: https://patchwork.kernel.org/patch/10626149/
</content>
</entry>
<entry>
<title>dma-buf: remove shared fence staging in reservation object</title>
<updated>2018-10-25T11:41:16Z</updated>
<author>
<name>Christian König</name>
<email>christian.koenig@amd.com</email>
</author>
<published>2018-08-08T14:01:22Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=27836b641c1bf693c96c627388497b4e0f57441b'/>
<id>urn:sha1:27836b641c1bf693c96c627388497b4e0f57441b</id>
<content type='text'>
No need for that any more. Just replace the list when there isn't enough
room any more for the additional fence.

Signed-off-by: Christian König &lt;christian.koenig@amd.com&gt;
Reviewed-by: Junwei Zhang &lt;Jerry.Zhang@amd.com&gt;
Reviewed-by: Huang Rui &lt;ray.huang@amd.com&gt;
Link: https://patchwork.kernel.org/patch/10626143/
</content>
</entry>
<entry>
<title>dma-buf: add reservation_object_lock_interruptible()</title>
<updated>2017-11-13T19:50:49Z</updated>
<author>
<name>Christian König</name>
<email>ckoenig.leichtzumerken@gmail.com</email>
</author>
<published>2017-11-09T08:59:05Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=5d276a1acaa80f4b7a76577510a2b1835ce01f4f'/>
<id>urn:sha1:5d276a1acaa80f4b7a76577510a2b1835ce01f4f</id>
<content type='text'>
That's the only wrapper function missing and necessary to cleanup TTM.

Reviewed-and-Tested-by: Michel Dänzer &lt;michel.daenzer@amd.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;
Link: https://patchwork.freedesktop.org/patch/msgid/20171109085909.1653-3-christian.koenig@amd.com
</content>
</entry>
<entry>
<title>dma-buf: add reservation_object_copy_fences (v2)</title>
<updated>2017-08-14T17:00:49Z</updated>
<author>
<name>Christian König</name>
<email>christian.koenig@amd.com</email>
</author>
<published>2017-08-10T17:01:48Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=7faf952a3030d304334fe527be339b63e9e2745f'/>
<id>urn:sha1:7faf952a3030d304334fe527be339b63e9e2745f</id>
<content type='text'>
Allows us to copy all the fences in a reservation object to another one.

v2: handle NULL src_list

Signed-off-by: Christian König &lt;christian.koenig@amd.com&gt;
Reviewed-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
Link: https://patchwork.freedesktop.org/patch/msgid/1502384509-10465-2-git-send-email-alexander.deucher@amd.com
</content>
</entry>
<entry>
<title>dma-buf/reservation: Wrap ww_mutex_trylock</title>
<updated>2017-02-26T21:43:44Z</updated>
<author>
<name>Chris Wilson</name>
<email>chris@chris-wilson.co.uk</email>
</author>
<published>2017-02-21T09:30:00Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=2955b73def6712b693fc7ad82b34b3831faaa146'/>
<id>urn:sha1:2955b73def6712b693fc7ad82b34b3831faaa146</id>
<content type='text'>
In a similar fashion to reservation_object_lock() and
reservation_object_unlock(), ww_mutex_trylock is also useful and so is
worth wrapping for consistency.

Signed-off-by: Chris Wilson &lt;chris@chris-wilson.co.uk&gt;
Cc: Sumit Semwal &lt;sumit.semwal@linaro.org&gt;
Cc: Joonas Lahtinen &lt;joonas.lahtinen@linux.intel.com&gt;
Cc: Daniel Vetter &lt;daniel.vetter@ffwll.ch&gt;
[danvet: Add __must_check Joonas wants.]
Reviewed-by: Joonas Lahtinen &lt;joonas.lahtinen@linux.intel.com&gt;
Signed-off-by: Daniel Vetter &lt;daniel.vetter@ffwll.ch&gt;
Link: http://patchwork.freedesktop.org/patch/msgid/20170221093000.22802-1-chris@chris-wilson.co.uk
</content>
</entry>
<entry>
<title>dma-buf: Provide wrappers for reservation's lock</title>
<updated>2016-12-12T06:54:43Z</updated>
<author>
<name>Chris Wilson</name>
<email>chris@chris-wilson.co.uk</email>
</author>
<published>2016-11-15T15:46:42Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=122020af856181c24fe45903e43e3cc987c175f7'/>
<id>urn:sha1:122020af856181c24fe45903e43e3cc987c175f7</id>
<content type='text'>
Joonas complained that writing ww_mutex_lock(&amp;resv-&gt;lock, ctx) was too
intrusive compared to reservation_object_lock(resv, ctx);

Signed-off-by: Chris Wilson &lt;chris@chris-wilson.co.uk&gt;
Cc: Sumit Semwal &lt;sumit.semwal@linaro.org&gt;
Cc: Joonas Lahtinen &lt;joonas.lahtinen@linux.intel.com&gt;
Reviewed-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
Signed-off-by: Daniel Vetter &lt;daniel.vetter@ffwll.ch&gt;
Link: http://patchwork.freedesktop.org/patch/msgid/20161115154642.31850-1-chris@chris-wilson.co.uk
</content>
</entry>
<entry>
<title>dma-buf: Use fence_get_rcu_safe() for retrieving the exclusive fence</title>
<updated>2016-11-15T07:30:02Z</updated>
<author>
<name>Chris Wilson</name>
<email>chris@chris-wilson.co.uk</email>
</author>
<published>2016-11-14T11:55:40Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=6bfec6d94556683c91c937a20576118183af9e1d'/>
<id>urn:sha1:6bfec6d94556683c91c937a20576118183af9e1d</id>
<content type='text'>
The current code is subject to a race where we may try to acquire a
reference on a stale fence:

[13703.335118] WARNING: CPU: 1 PID: 14975 at ./include/linux/kref.h:46 i915_gem_object_wait+0x1a3/0x1c0
[13703.335184] Modules linked in:
[13703.335202] CPU: 1 PID: 14975 Comm: gem_concurrent_ Not tainted 4.9.0-rc4+ #26
[13703.335216] Hardware name:                  /        , BIOS PYBSWCEL.86A.0027.2015.0507.1758 05/07/2015
[13703.335233]  ffffc90002f5bcc8 ffffffff812807de 0000000000000000 0000000000000000
[13703.335257]  ffffc90002f5bd08 ffffffff81073811 0000002e80000000 ffff88026bf7c780
[13703.335279]  7fffffffffffffff 0000000000000001 ffff88027045a550 ffff88026bf7c780
[13703.335301] Call Trace:
[13703.335316]  [&lt;ffffffff812807de&gt;] dump_stack+0x4d/0x6f
[13703.335331]  [&lt;ffffffff81073811&gt;] __warn+0xc1/0xe0
[13703.335343]  [&lt;ffffffff810738e8&gt;] warn_slowpath_null+0x18/0x20
[13703.335355]  [&lt;ffffffff813ac443&gt;] i915_gem_object_wait+0x1a3/0x1c0
[13703.335367]  [&lt;ffffffff813ae8ec&gt;] i915_gem_set_domain_ioctl+0xcc/0x330
[13703.335386]  [&lt;ffffffff813534ab&gt;] drm_ioctl+0x1cb/0x410
[13703.335400]  [&lt;ffffffff813ae820&gt;] ? i915_gem_obj_prepare_shmem_write+0x1d0/0x1d0
[13703.335416]  [&lt;ffffffff8135359b&gt;] ? drm_ioctl+0x2bb/0x410
[13703.335429]  [&lt;ffffffff8117d32f&gt;] do_vfs_ioctl+0x8f/0x5c0
[13703.335442]  [&lt;ffffffff8117d89c&gt;] SyS_ioctl+0x3c/0x70
[13703.335456]  [&lt;ffffffff815a07a4&gt;] entry_SYSCALL_64_fastpath+0x17/0x98
[13703.335558] ---[ end trace fd24176416ba6981 ]---
[13703.382778] general protection fault: 0000 [#1] SMP
[13703.382802] Modules linked in:
[13703.382816] CPU: 1 PID: 14967 Comm: gem_concurrent_ Tainted: G        W       4.9.0-rc4+ #26
[13703.382828] Hardware name:                  /        , BIOS PYBSWCEL.86A.0027.2015.0507.1758 05/07/2015
[13703.382841] task: ffff880275458000 task.stack: ffffc90002f18000
[13703.382849] RIP: 0010:[&lt;ffffffff813b3534&gt;]  [&lt;ffffffff813b3534&gt;] i915_gem_request_retire+0x2b4/0x320
[13703.382870] RSP: 0018:ffffc90002f1bbc8  EFLAGS: 00010293
[13703.382878] RAX: dead000000000200 RBX: ffff88026bf7dce8 RCX: dead000000000100
[13703.382887] RDX: dead000000000100 RSI: ffff88026bf7c930 RDI: ffff88026bf7dd00
[13703.382897] RBP: ffffc90002f1bbf8 R08: 00000000ffffffff R09: ffff88026b89a000
[13703.382905] R10: 0000000000000001 R11: ffff88026bbe8fe0 R12: ffff88026bf7c000
[13703.382913] R13: ffff880275af8000 R14: ffff88026bf7c180 R15: dead000000000200
[13703.382922] FS:  00007f89e787d740(0000) GS:ffff88027fd00000(0000) knlGS:0000000000000000
[13703.382934] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[13703.382942] CR2: 00007f9053d2e000 CR3: 000000026d414000 CR4: 00000000001006e0
[13703.382951] Stack:
[13703.382958]  ffff880275413000 ffffc90002f1bde8 ffff880275af8000 ffff880274e8a600
[13703.382976]  ffff880276a06000 ffffc90002f1bde8 ffffc90002f1bc38 ffffffff813b48c5
[13703.382995]  ffffc90002f1bc00 ffffc90002f1bde8 ffff88026972a440 0000000000000000
[13703.383021] Call Trace:
[13703.383032]  [&lt;ffffffff813b48c5&gt;] i915_gem_request_alloc+0xa5/0x350
[13703.383043]  [&lt;ffffffff813a17c3&gt;] i915_gem_do_execbuffer.isra.41+0x7b3/0x18b0
[13703.383055]  [&lt;ffffffff813b144c&gt;] ? i915_gem_object_get_sg+0x25c/0x2b0
[13703.383065]  [&lt;ffffffff813b1d4d&gt;] ? i915_gem_object_get_page+0x1d/0x50
[13703.383076]  [&lt;ffffffff813b28cc&gt;] ? i915_gem_pwrite_ioctl+0x66c/0x6d0
[13703.383086]  [&lt;ffffffff813a2c25&gt;] i915_gem_execbuffer2+0x95/0x1e0
[13703.383096]  [&lt;ffffffff813534ab&gt;] drm_ioctl+0x1cb/0x410
[13703.383105]  [&lt;ffffffff813a2b90&gt;] ? i915_gem_execbuffer+0x2d0/0x2d0
[13703.383117]  [&lt;ffffffff810c3df0&gt;] ? hrtimer_start_range_ns+0x1a0/0x310
[13703.383128]  [&lt;ffffffff8117d32f&gt;] do_vfs_ioctl+0x8f/0x5c0
[13703.383140]  [&lt;ffffffff810c60e8&gt;] ? SyS_timer_settime+0x118/0x1a0
[13703.383150]  [&lt;ffffffff8117d89c&gt;] SyS_ioctl+0x3c/0x70
[13703.383162]  [&lt;ffffffff815a07a4&gt;] entry_SYSCALL_64_fastpath+0x17/0x98
[13703.383172] Code: 49 39 c6 48 8d 70 e8 48 8d 5f e8 75 16 eb 47 48 8d 43 18 48 8b 53 18 48 89 de 49 39 c6 48 8d 5a e8 74 33 48 8b 56 08 48 8b 46 10 &lt;48&gt; 89 42 08 48 89 10 f6 46 38 01 48 89 4e 08 4c 89 7e 10 74 cf
[13703.383557] RIP  [&lt;ffffffff813b3534&gt;] i915_gem_request_retire+0x2b4/0x320
[13703.383570]  RSP &lt;ffffc90002f1bbc8&gt;
[13703.383586] ---[ end trace fd24176416ba6982 ]---

This is fixed by using the kref_get_unless_zero() as a full memory
barrier to validate the fence is still the current exclusive fence before
returning it back to the caller. (Note the fix only requires using
dma_fence_get_rcu() and correct handling, but we may as well use the
helper rather than inline equivalent code.)

Note: Issue can only be hit with the i915 driver.

Signed-off-by: Chris Wilson &lt;chris@chris-wilson.co.uk&gt;
Cc: Sumit Semwal &lt;sumit.semwal@linaro.org
Fixes: d07f0e59b2c7 ("drm/i915: Move GEM activity tracking into a common struct reservation_object")
Reviewed-by: Christian König &lt;christian.koenig@amd.com&gt;.
Signed-off-by: Daniel Vetter &lt;daniel.vetter@ffwll.ch&gt;
Link: http://patchwork.freedesktop.org/patch/msgid/20161114115540.31155-1-chris@chris-wilson.co.uk
</content>
</entry>
</feed>
