On Mon, Oct 07, 2019 at 08:23:29AM +0200, Hannes Reinecke wrote: > On 10/6/19 4:45 AM, Ming Lei wrote: > > Most of blk-mq drivers depend on managed IRQ's auto-affinity to setup > > up queue mapping. Thomas mentioned the following point[1]: > > > > " > > That was the constraint of managed interrupts from the very beginning: > > > > The driver/subsystem has to quiesce the interrupt line and the associated > > queue _before_ it gets shutdown in CPU unplug and not fiddle with it > > until it's restarted by the core when the CPU is plugged in again. > > " > > > > However, current blk-mq implementation doesn't quiesce hw queue before > > the last CPU in the hctx is shutdown. Even worse, CPUHP_BLK_MQ_DEAD is > > one cpuhp state handled after the CPU is down, so there isn't any chance > > to quiesce hctx for blk-mq wrt. CPU hotplug. > > > > Add new cpuhp state of CPUHP_AP_BLK_MQ_ONLINE for blk-mq to stop queues > > and wait for completion of in-flight requests. > > > > [1] https://lore.kernel.org/linux-block/alpine.DEB.2.21.1904051331270.1802@xxxxxxxxxxxxxxxxxxxxxxx/ > > > > Cc: Bart Van Assche <bvanassche@xxxxxxx> > > Cc: Hannes Reinecke <hare@xxxxxxxx> > > Cc: Christoph Hellwig <hch@xxxxxx> > > Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx> > > Cc: Keith Busch <keith.busch@xxxxxxxxx> > > Signed-off-by: Ming Lei <ming.lei@xxxxxxxxxx> > > --- > > block/blk-mq-tag.c | 2 +- > > block/blk-mq-tag.h | 2 ++ > > block/blk-mq.c | 65 ++++++++++++++++++++++++++++++++++++++ > > include/linux/blk-mq.h | 1 + > > include/linux/cpuhotplug.h | 1 + > > 5 files changed, 70 insertions(+), 1 deletion(-) > > > I really don't like the zillions of 'XXX_in_flight()' helper in blk-mq; > blk_mq_queue_inflight(), blk_mq_in_flight(), blk_mq_in_flight_rw() et al. > Can't you implement your one on top of the already existing? This one returns in-flight rqs on specific tags(hctx), so far no such kind of interface, that is why blk_mq_all_tag_busy_iter is exported out in this patch. Thanks, Ming