Re: [PATCH] blk-mq: only run mapped hw queues in blk_mq_run_hw_queues()

Christian Borntraeger
2018-04-06T10:19:19Z

On 04/06/2018 11:23 AM, Ming Lei wrote:
> On Fri, Apr 06, 2018 at 10:51:28AM +0200, Christian Borntraeger wrote:
>>
>>
>> On 04/06/2018 10:41 AM, Ming Lei wrote:
>>> On Thu, Apr 05, 2018 at 07:39:56PM +0200, Christian Borntraeger wrote:
>>>>
>>>>
>>>> On 04/05/2018 06:11 PM, Ming Lei wrote:
>>>>>>
>>>>>> Could you please apply the following patch and provide the dmesg boot log?
>>>>>
>>>>> And please post out the 'lscpu' log together from the test machine too.
>>>>
>>>> attached.
>>>>
>>>> As I said before this seems to go way with CONFIG_NR_CPUS=64 or smaller.
>>>> We have 282 nr_cpu_ids here (max 141CPUs on that z13 with SMT2) but only 8 Cores
>>>> == 16 threads.
>>>
>>> OK, thanks!
>>>
>>> The most weird thing is that hctx->next_cpu is computed as 512 since
>>> nr_cpu_id is 282, and hctx->next_cpu should have pointed to one of
>>> possible CPU.
>>>
>>> Looks like it is a s390 specific issue, since I can setup one queue
>>> which has same mapping with yours:
>>>
>>> - nr_cpu_id is 282
>>> - CPU 0~15 is online
>>> - 64 queues null_blk
>>> - still run all hw queues in .complete handler
>>>
>>> But can't reproduce this issue at all.
>>>
>>> So please test the following patch, which may tell us why hctx->next_cpu
>>> is computed wrong:
>>
>> I see things like
>>
>> [ 8.196907] wrong next_cpu 512, blk_mq_map_swqueue, first_and
>> [ 8.196910] wrong next_cpu 512, blk_mq_map_swqueue, first_and
>> [ 8.196912] wrong next_cpu 512, blk_mq_map_swqueue, first_and
>> [ 8.196913] wrong next_cpu 512, blk_mq_map_swqueue, first_and
>> [ 8.196914] wrong next_cpu 512, blk_mq_map_swqueue, first_and
>> [ 8.196915] wrong next_cpu 512, blk_mq_map_swqueue, first_and
>> [ 8.196916] wrong next_cpu 512, blk_mq_map_swqueue, first_and
>> [ 8.196916] wrong next_cpu 512, blk_mq_map_swqueue, first_and
>> [ 8.196917] wrong next_cpu 512, blk_mq_map_swqueue, first_and
>> [ 8.196918] wrong next_cpu 512, blk_mq_map_swqueue, first_and
>>
>> which is exactly what happens if the find and and operation fails (returns size of bitmap).
>
> Given both 'cpu_online_mask' and 'hctx->cpumask' are shown as correct
> in your previous debug log, it means the following function returns
> totally wrong result on S390.
>
> cpumask_first_and(hctx->cpumask, cpu_online_mask);
>
> The debugfs log shows that each hctx->cpumask includes one online
> CPU(0~15).

Really? the last log (with the latest patch applied shows a lot of contexts
that do not have CPUs in 0-15:

e.g.
[ 4.049828] dump CPUs mapped to this hctx:
[ 4.049829] 18
[ 4.049829] 82
[ 4.049830] 146
[ 4.049830] 210
[ 4.049831] 274

>
> So looks it isn't one issue in block MQ core.
>
> Thanks,
> Ming
>