<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p style="margin-top:0;margin-bottom:0"></p>
<div>Hi Christian & Chris</div>
<div><br>
</div>
<div>two question regarding resv:</div>
<div><br>
</div>
<div>1) considering below sequence:</div>
<div><br>
</div>
<div>call reservation_object_add_shared_fence,</div>
<div>now assume old->shared_count is now 3</div>
<div>call reservation_object_add_shared_fence,</div>
<div>now assume old->shared_count is now 4,</div>
<div><br>
</div>
<div>call reservation_object_reserve_shared,</div>
<div>now obj->staged is new allocated, and its shared_max = 8, but not</div>
<div>used by far.</div>
<div><br>
</div>
<div>call reservation_object_add_excl_fence,</div>
<div>it set obj->fence->shared_count to 0, <b>and put all shared fence from obj->fence without waiting signaling.</b></div>
<div>(this action looks inappropriate, I think at least before put all those shared fences</div>
<div>we should dma_wait_fence() on them to make sure they are signaled)</div>
<div><br>
</div>
<div>call reservation_object_reserve_shared,</div>
<div><b>this time obj->staged isn't NULL, and it is freed</b> (nothing bad now</div>
<div>since obj->fence points to other place),</div>
<div>and obj->staged set to NULL,</div>
<div><br>
</div>
<div>call reservation_object_add_shared_fence,</div>
<div>this time should going through reservation_object_add_shared_inplace,</div>
<div><b>But BUG_ON(old->shared_count >= old->shared_max) will hit !</b></div>
<div><b><br>
</b></div>
<div>This looks a design flaw in reservation object, shouldn't we fix it ?</div>
<div><b><br>
</b></div>
<div><br>
</div>
<div></div>
<div>2) in add_excl_fence(), it simply set old->shared_count to 0, and put all shared fences of old</div>
<div>is that correct? if excl fence is really exclusively used, why we still consider both shared fence and</div>
<div>excl fence on wait_timeout_rcu() routine, see blew description of this routine</div>
<div><br>
</div>
<div>
<div style="color: rgb(212, 212, 212); background-color: rgb(30, 30, 30); font-family: "Droid Sans Mono", monospace, monospace, "Droid Sans Fallback"; font-size: 14px; line-height: 19px; white-space: pre;">
<br>
<div><span style="color: #608b4e;">/**</span></div>
<div><span style="color: #608b4e;">* reservation_object_wait_timeout_rcu - Wait on reservation's objects</span></div>
<div><span style="color: #608b4e;">* shared and/or exclusive fences.</span></div>
<div><span style="color: #608b4e;">* @obj: the reservation object</span></div>
<div><span style="color: #608b4e;">* @wait_all: if true, wait on all fences, else wait on just exclusive fence</span></div>
<div><span style="color: #608b4e;">* @intr: if true, do interruptible wait</span></div>
<div><span style="color: #608b4e;">* @timeout: timeout value in jiffies or zero to return immediately</span></div>
<div><span style="color: #608b4e;">*</span></div>
<div><span style="color: #608b4e;">* RETURNS</span></div>
<div><span style="color: #608b4e;">* Returns -ERESTARTSYS if interrupted, 0 if the wait timed out, or</span></div>
<div><span style="color: #608b4e;">* greater than zer on success.</span></div>
<div><span style="color: #608b4e;">*/</span></div>
<div><span style="color: #569cd6;">long</span> <span style="color: #dcdcaa;">reservation_object_wait_timeout_rcu</span>(<span style="color: #569cd6;">struct</span> reservation_object *obj,</div>
<div>                     <span style="color: #569cd6;">bool</span> wait_all, <span style="color: #569cd6;">
bool</span> intr,</div>
<div>                     <span style="color: #569cd6;">unsigned</span> <span style="color: #569cd6;">
long</span> timeout)</div>
</div>
<br>
</div>
<div><span style="font-size: 12pt;"> </span><br>
</div>
<div><span style="font-size: 12pt;">thanks</span></div>
<div>/Monk</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<br>
<p></p>
</div>
</body>
</html>