<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Now I am confused. I thought the code where empty and skip are
inside the wait_event_timeout leads to empty beeing evaluated every
time that the waiting threads gets awoken.<br>
And since some other thread might change <i>ar->htt.num_pending_tx</i>
it is necessary to check this every time we get awoken, rather than
once before we go to sleep.<br>
<br>
Also the locking part arround empty seems to support my guess (why
sync if you do not have multiple threads accessing a variable).<br>
<br>
These are only guesses without looking at the surrounding code.<br>
Could you please explain why you think it is sufficient to evaluate
the condition only once before sleeping on it? (empty || skip) is a
constant if you do not update either empty or skip, at least from my
point of view.<br>
<br>
<div class="moz-cite-prefix">On 11/03/15 14:40,
<a class="moz-txt-link-abbreviated" href="mailto:Valdis.Kletnieks@vt.edu">Valdis.Kletnieks@vt.edu</a> wrote:<br>
</div>
<blockquote cite="mid:55475.1426084817@turing-police.cc.vt.edu"
type="cite">
<pre wrap="">On Wed, 11 Mar 2015 15:17:44 +0100, Nicholas Mc Guire said:
</pre>
<blockquote type="cite">
<pre wrap="">So the wait_event_timeout condition here ends up being (empty || skip)
but what is the point of puting this code into the parameter list of
wait_event_timeout() ?
Would it not be equivalent to:
        bool empty;
        ...
        spin_lock_bh(&ar->htt.tx_lock);
        empty = (ar->htt.num_pending_tx == 0);
        spin_unlock_bh(&ar->htt.tx_lock);
        skip = (ar->state == ATH10K_STATE_WEDGED) ||
                test_bit(ATH10K_FLAG_CRASH_FLUSH,
                &ar->dev_flags);
        ret = wait_event_timeout(ar->htt.empty_tx_wq, (empty || skip),
                                 ATH10K_FLUSH_TIMEOUT_HZ);
What am I missing here ?
</pre>
</blockquote>
<pre wrap="">
Umm... a Signed-off-by: and formatting it as an actual patch? :)
Seriously - you're right, it's ugly code that needs fixing...
</pre>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Kernelnewbies mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a>
<a class="moz-txt-link-freetext" href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a>
</pre>
</blockquote>
<br>
</body>
</html>