Re: [PATCH v6] cxl/region: Fix wrong logic for finding a free switch cxl decoder

From: Zijun Hu
Date: Wed Oct 16 2024 - 19:35:56 EST


On 2024/10/17 07:02, Dan Williams wrote:
> Zijun Hu wrote:
>> From: Zijun Hu <quic_zijuhu@xxxxxxxxxxx>
>>
>> Provided that all child switch cxl decoders are sorted by ID in ascending
>> order, then it is wrong for current match_free_decoder()'s logic to find
>> a free cxl decoder as explained below:
>>
>> Port
>> ├── cxld A <----> region A
>> ├── cxld B // no region
>> ├── cxld C <----> region C
>>
>> Current logic will find cxld B as a free one, but cxld B is not true
>> free since region C has not been torn down, so current logic is wrong.
>>
>> Fixed by verifying if cxl decoder with ID (@port->commit_end + 1) can
>> be returned as finding result.
>>
>> Link: https://lore.kernel.org/all/670af54931b8_964fe29427@xxxxxxxxxxxxxxxxxxxxxxxxx.notmuch/
>> Suggested-by: Dan Williams <dan.j.williams@xxxxxxxxx>
>> Signed-off-by: Zijun Hu <quic_zijuhu@xxxxxxxxxxx>
>> ---
>> This patch is incremental to below patch series with title "cxl: Initialization and shutdown fixes"
>> http://lore.kernel.org/172862483180.2150669.5564474284074502692.stgit@xxxxxxxxxxxxxxxxxxxxxxxxx
>>
>> This patch is based on Dan's recommendation shown by below link:
>> https://lore.kernel.org/all/670af54931b8_964fe29427@xxxxxxxxxxxxxxxxxxxxxxxxx.notmuch/
>
> ...and Dan and already sent a patch he is happier with here:
>
> http://lore.kernel.org/172895072669.39002.9296583943188706348.stgit@xxxxxxxxxxxxxxxxxxxxxxxxx

this is a optimized one based your recommendation, namely, above link.
please don't hesitate to use it as your V2 if you like this one.

you maybe also have below change when you send V2
Reported-by: Zijun Hu <zijun_hu@xxxxxxxxxx>
to
Reported-by: Zijun Hu <quic_zijuhu@xxxxxxxxxxx>

So let us close discussion for this mail thread and go to your above thread.