lkml.org 
[lkml]   [2018]   [Oct]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] stm class: increase pos if no free channels found
Date
Zhi Jin <zhi.jin@intel.com> writes:

> Considering this case in find_free_channels():
>
> bitmap:
> +------------------+-+-+-+-+-+-+-+-+-+-+
> | ...... |0|0|0|0|0|0|0|1|0|0|
> +------------------+-+-+-+-+-+-+-+-+-+-+
>
> 1. Channel #2 has been occupied, so bit #2 is 1, and the others
> are all 0.
> 2. Another thread tries to find 4 free channels from #0.
> 3. In the 1st loop, pos starts from 0, and then it checks if the
> following 4 bits are all 0, but fails, as bit#2 is 1.
> 4. In the 2st loop, pos is not updated, and still starts from 0,
> so nothing changes against loop #1.
> 5. Dead loop ...
>
> This patch is to update the pos in step #3 to avoid the issue.

The description is slightly confusing, but the patch looks correct and
the original code is clearly wrong. Thank you for finding this!

Basically, if you request 1 channel 3 times, release the first two and
then request 4 channels, you'll be stuck, right?

Thanks,
--
Alex

\
 
 \ /
  Last update: 2018-10-15 09:43    [W:0.092 / U:1.020 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site