On 2024/6/27 18:58, Peter Wang (王信友) wrote:
On Thu, 2024-06-27 at 15:59 +0800, Wenchao Hao wrote:
Hi Peter,
What is queue_num's offset of blk_mq_hw_ctx in your machine?
gdb vmlinux
(gdb) print /x (int)&((struct blk_mq_hw_ctx *)0)->queue_num $5 = 0x164
I read your descriptions and wondered a same race flow as you described following. But I found the offset mismatch, if the racing flow is correct, then the address accessed in blk_mq_unique_tag() should be 0x164, not 0x194. Maybe the offset is different between our machine?
What's more, if the racing flow is correct, I did not get how your changes can address this racing flow.
Hi Wenchao Hao,
Yes, our queue_num's offset of blk_mq_hw_ctx is 0x194. Our kernel version is: Linux version 6.1.68 I think the offset is different by kernel version.
(gdb) print /x (int)&((struct blk_mq_hw_ctx *)0)->queue_num $1 = 0x194
And yes, it only shorten the race window of step3 and step5. Reduce the probability of step 4 appearing between step 3 and step 5.
Hi Peter,
Thanks for your reply, I understand the issue now.
Thanks. Peter