* Re: [PATCH] blk-mq: fix selecting software ctx for request
[not found] <20200202102004.19132-1-hdanton@sina.com>
@ 2020-02-03 9:16 ` Ming Lei
[not found] ` <20200203102815.3940-1-hdanton@sina.com>
1 sibling, 0 replies; 2+ messages in thread
From: Ming Lei @ 2020-02-03 9:16 UTC (permalink / raw)
To: Hillf Danton
Cc: linux-block, Jens Axboe, Ming Lin, Christoph Hellwig,
linux-kernel
On Sun, Feb 02, 2020 at 06:20:04PM +0800, Hillf Danton wrote:
>
> Select the current cpu if it's mapped to hardware to make helpers like
> blk_mq_rq_cpu() return correct value.
>
> Signed-off-by: Hillf Danton <hdanton@sina.com>
> ---
>
> --- a/block/blk-mq.c
> +++ b/block/blk-mq.c
> @@ -454,7 +454,10 @@ struct request *blk_mq_alloc_request_hct
> blk_queue_exit(q);
> return ERR_PTR(-EXDEV);
> }
> - cpu = cpumask_first_and(alloc_data.hctx->cpumask, cpu_online_mask);
> + cpu = raw_smp_processor_id();
> + if (!cpumask_test_cpu(cpu, alloc_data.hctx->cpumask))
> + cpu = cpumask_first_and(alloc_data.hctx->cpumask,
> + cpu_online_mask);
How can you know if there is any online CPU available for this hctx?
> alloc_data.ctx = __blk_mq_get_ctx(q, cpu);
>
> rq = blk_mq_get_request(q, NULL, &alloc_data);
>
It is really one NVMe specific issue, see the following discussion:
https://lore.kernel.org/linux-block/8f4402a0-967d-f12d-2f1a-949e1dda017c@grimberg.me/#r
Thanks,
Ming
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] blk-mq: fix selecting software ctx for request
[not found] ` <20200203102815.3940-1-hdanton@sina.com>
@ 2020-02-03 12:29 ` Ming Lei
0 siblings, 0 replies; 2+ messages in thread
From: Ming Lei @ 2020-02-03 12:29 UTC (permalink / raw)
To: Hillf Danton; +Cc: linux-block, Jens Axboe, Christoph Hellwig, linux-kernel
On Mon, Feb 03, 2020 at 06:28:15PM +0800, Hillf Danton wrote:
>
> Hi Ming
>
> On Mon, 3 Feb 2020 17:16:02 +0800 Ming Lei wrote:
> > On Sun, Feb 02, 2020 at 06:20:04PM +0800, Hillf Danton wrote:
> > >
> > > Select the current cpu if it's mapped to hardware to make helpers like
> > > blk_mq_rq_cpu() return correct value.
> > >
> > > Signed-off-by: Hillf Danton <hdanton@sina.com>
> > > ---
> > >
> > > --- a/block/blk-mq.c
> > > +++ b/block/blk-mq.c
> > > @@ -454,7 +454,10 @@ struct request *blk_mq_alloc_request_hct
> > > blk_queue_exit(q);
> > > return ERR_PTR(-EXDEV);
> > > }
> > > - cpu = cpumask_first_and(alloc_data.hctx->cpumask, cpu_online_mask);
> > > + cpu = raw_smp_processor_id();
> > > + if (!cpumask_test_cpu(cpu, alloc_data.hctx->cpumask))
> > > + cpu = cpumask_first_and(alloc_data.hctx->cpumask,
> > > + cpu_online_mask);
> >
> > How can you know if there is any online CPU available for this hctx?
>
> I don't except for the current cpu.
The current CPU may not belong to hctx->cpumask for blk_mq_alloc_request_hctx(),
that is why I think this API is very weird.
Thanks,
Ming
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-02-03 12:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20200202102004.19132-1-hdanton@sina.com>
2020-02-03 9:16 ` [PATCH] blk-mq: fix selecting software ctx for request Ming Lei
[not found] ` <20200203102815.3940-1-hdanton@sina.com>
2020-02-03 12:29 ` Ming Lei
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox