Re: [PATCH] blk-mq: Properly init bios from blk_mq_alloc_request_hctx()

From: John Garry
Date: Tue Oct 25 2022 - 07:36:19 EST


On 25/10/2022 12:21, Ming Lei wrote:
Actually if final cpu in hctx->cpumask is going offline, then hctx won't
queue any more requests, right? In this case I don't think we can queue on
that hctx anyway. I need to think about this more.
It can be queued actually, but interrupt may not be delivered if managed
irq is used.

Yes, I think it will be queued elsewhere. I would need to check the code again.


If you just make it one driver private command, there can't be such
issue.
Well we're trying to use reserved requests for EH commands, which that goes
against.

Block layer is supposed for handling common case(normal io and pt io),
I'd suggest to not put such special cases into block layer.
It also supports reserved commands, which I would assume would be suitable
for EH scenarios.
Then you have to be careful, as I mentioned, EH has to provide forward
progress, if you let blk-mq allocate & submit EH request, the implied
dependency from blk-mq has to be payed attention.

OK, thanks, I know that this carries risk, but it seems right approach.

I have been thinking about my HW queue allocation requirement and maybe we can solve in low-level driver instead.

The requirement is to send this abort command on same queue as erroneous command to ensure that they do not race in HW submission, even though chance of this is really tiny. Maybe we can make low-level driver wait until erroneous command is really submitted to HW by checking HW register, etc. before issuing abort on any HW queue (and so would not need blk_mq_alloc_request_hctx() or similar).

BTW, I would still like to fix blk_mq_alloc_request_hctx() to properly init ->bio and other fields - ok?

Thanks,
John