<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Am 25.10.18 um 11:28 schrieb zhoucm1:<br>
</div>
<blockquote type="cite" cite="mid:b8d900fc-43e6-e3cc-4573-1f91660be37f@amd.com">
<p><br>
</p>
<br>
<div class="moz-cite-prefix">On 2018年10月25日 17:23, Koenig, Christian wrote:<br>
</div>
<blockquote type="cite" cite="mid:01456f6c-88c3-5b4e-bc07-d3a202ae2dd3@amd.com">
<div class="moz-cite-prefix">Am 25.10.18 um 11:20 schrieb zhoucm1:<br>
</div>
<blockquote type="cite" cite="mid:a95c3630-f8b8-b7d4-2354-64d8c091ecb7@amd.com">
<p><br>
</p>
<br>
<div class="moz-cite-prefix">On 2018年10月25日 17:11, Koenig, Christian wrote:<br>
</div>
<blockquote type="cite" cite="mid:0d33f030-aa41-0cdc-bd47-9018436d3e73@amd.com">
<div class="moz-cite-prefix">Am 25.10.18 um 11:03 schrieb zhoucm1:<br>
</div>
<blockquote type="cite" cite="mid:14a02772-5277-3ef2-91f8-1ef3858c1bbe@amd.com">
<p><br>
</p>
<br>
<div class="moz-cite-prefix">On 2018年10月25日 16:56, Christian König wrote:<br>
</div>
<blockquote type="cite" cite="mid:6f63db7a-e51b-5829-9eb0-265ebd6dd99c@gmail.com">
<blockquote type="cite" style="color: #000000;">+++ b/drivers/gpu/drm/drm_syncobj.c
<br>
@@ -111,15 +111,16 @@ static struct dma_fence <br>
                        uint64_t point) <br>
  { <br>
      struct drm_syncobj_signal_pt *signal_pt; <br>
+    struct dma_fence *f = NULL; <br>
+    struct drm_syncobj_stub_fence *fence = <br>
+        kzalloc(sizeof(struct drm_syncobj_stub_fence), <br>
+            GFP_KERNEL); <br>
  +    if (!fence) <br>
+        return NULL; <br>
+    spin_lock(&syncobj->pt_lock); <br>
</blockquote>
<br>
How about using a single static stub fence like I suggested? </blockquote>
Sorry, I don't get your meanings, how to do that?<br>
</blockquote>
<br>
Add a new function drm_syncobj_stub_fence_init() which is called from drm_core_init() when the module is loaded.<br>
<br>
In drm_syncobj_stub_fence_init() you initialize one static stub_fence which is then used over and over again.<br>
</blockquote>
Seems it would not work, we could need more than one stub fence.<br>
</blockquote>
<br>
Mhm, why? I mean it is just a signaled fence,</blockquote>
<br>
If A gets the global stub fence, doesn't put it yet, then B is coming, how does B re-use the global stub fence?  anything I misunderstand?<br>
</blockquote>
<br>
dma_fence_get()? The whole thing is reference counted, every time you need it you grab another reference.<br>
<br>
Since we globally initialize it the reference never becomes zero, so it is never released.<br>
<br>
Christian.<br>
<br>
<blockquote type="cite" cite="mid:b8d900fc-43e6-e3cc-4573-1f91660be37f@amd.com"><br>
David<br>
<blockquote type="cite" cite="mid:01456f6c-88c3-5b4e-bc07-d3a202ae2dd3@amd.com">context and sequence number are irrelevant.<br>
<br>
Christian.<br>
<br>
<blockquote type="cite" cite="mid:a95c3630-f8b8-b7d4-2354-64d8c091ecb7@amd.com"><br>
David <br>
<blockquote type="cite" cite="mid:0d33f030-aa41-0cdc-bd47-9018436d3e73@amd.com"><br>
Since its reference count never goes down to zero it should never be freed. In doubt maybe add a .free callback which just calls BUG() to catch reference count issues.<br>
<br>
Christian.<br>
<br>
<blockquote type="cite" cite="mid:14a02772-5277-3ef2-91f8-1ef3858c1bbe@amd.com"><br>
Thanks,<br>
David <br>
</blockquote>
<br>
</blockquote>
<br>
</blockquote>
<br>
</blockquote>
<br>
</blockquote>
<br>
</body>
</html>