[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <11D2FE4DB4B8114EA7D818424F28D1414289C3B9@SHSMSX104.ccr.corp.intel.com>
Date: Mon, 15 Oct 2018 08:16:26 +0000
From: "Jin, Zhi" <zhi.jin@...el.com>
To: Alexander Shishkin <alexander.shishkin@...ux.intel.com>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] stm class: increase pos if no free channels found
> -----Original Message-----
> From: Alexander Shishkin [mailto:alexander.shishkin@...ux.intel.com]
> Sent: Monday, October 15, 2018 3:43 PM
> To: Jin, Zhi <zhi.jin@...el.com>
> Cc: linux-kernel@...r.kernel.org; Jin, Zhi <zhi.jin@...el.com>
> Subject: Re: [PATCH] stm class: increase pos if no free channels found
>
> Zhi Jin <zhi.jin@...el.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?
Yes, you are right.
But the real case that I reproduced the issue is a little different:
I have 2 stp-policy:
"console": masters "256 259" channels "7 10"
"user" : masters "256 1024" channels "0 127"
I understand the policies should not be overlapped, which is caused by some
other issues.
So if someone uses "console" to request a channel (who will get Channel #7)
and then another uses "user" to request more than 8 channels, it will be stuck.
The commit message is what I trying to abstract the above case, sorry for the
confusion.
>
> Thanks,
> --
> Alex
Powered by blists - more mailing lists