Re: [PATCH v3 2/8] blk-mq: Keep set->nr_hw_queues and set->map[].nr_queues in sync

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Feb 20, 2020 at 07:22:37PM -0800, Bart Van Assche wrote:
> blk_mq_map_queues() and multiple .map_queues() implementations expect that
> set->map[HCTX_TYPE_DEFAULT].nr_queues is set to the number of hardware
> queues. Hence set .nr_queues before calling these functions. This patch
> fixes the following kernel warning:
> 
> WARNING: CPU: 0 PID: 2501 at include/linux/cpumask.h:137
> Call Trace:
>  blk_mq_run_hw_queue+0x19d/0x350 block/blk-mq.c:1508
>  blk_mq_run_hw_queues+0x112/0x1a0 block/blk-mq.c:1525
>  blk_mq_requeue_work+0x502/0x780 block/blk-mq.c:775
>  process_one_work+0x9af/0x1740 kernel/workqueue.c:2269
>  worker_thread+0x98/0xe40 kernel/workqueue.c:2415
>  kthread+0x361/0x430 kernel/kthread.c:255
> 
> Cc: Christoph Hellwig <hch@xxxxxxxxxxxxx>
> Cc: Ming Lei <ming.lei@xxxxxxxxxx>
> Cc: Hannes Reinecke <hare@xxxxxxxx>
> Cc: Johannes Thumshirn <jth@xxxxxxxxxx>
> Reported-by: syzbot+d44e1b26ce5c3e77458d@xxxxxxxxxxxxxxxxxxxxxxxxx
> Fixes: ed76e329d74a ("blk-mq: abstract out queue map") # v5.0
> Signed-off-by: Bart Van Assche <bvanassche@xxxxxxx>
> ---
>  block/blk-mq.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/block/blk-mq.c b/block/blk-mq.c
> index f298500e6dda..a92444c077bc 100644
> --- a/block/blk-mq.c
> +++ b/block/blk-mq.c
> @@ -3023,6 +3023,14 @@ static int blk_mq_alloc_rq_maps(struct blk_mq_tag_set *set)
>  
>  static int blk_mq_update_queue_map(struct blk_mq_tag_set *set)
>  {
> +	/*
> +	 * blk_mq_map_queues() and multiple .map_queues() implementations
> +	 * expect that set->map[HCTX_TYPE_DEFAULT].nr_queues is set to the
> +	 * number of hardware queues.
> +	 */
> +	if (set->nr_maps == 1)
> +		set->map[HCTX_TYPE_DEFAULT].nr_queues = set->nr_hw_queues;
> +
>  	if (set->ops->map_queues && !is_kdump_kernel()) {
>  		int i;
>  
> 

Reviewed-by: Ming Lei <ming.lei@xxxxxxxxxx>

-- 
Ming




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux