On 5/5/25 7:47 PM, Ming Lei wrote: > Move elv_register[unregister]_queue out of ->elevator_lock & queue freezing, > so we can kill many lockdep warnings. > > elv_register[unregister]_queue() is serialized, and just dealing with sysfs/ > debugfs things, no need to be done with queue frozen: > > - when it is called from adding disk, elevator switch isn't possible > because ->queue_kobj isn't added yet > > - when it is called from deleting disk, disable_elv_switch() is > responsible for preventing new elevator switch and draining old > elevator switch. > > - when it is called from blk_mq_update_nr_hw_queues(), adding/removing > disk and elevator switch can't be allowed or in-progress > > With this change, elevator's ->exit() is called before calling > elv_unregister_queue, then user may call into ->show()/store() of elevator's > sysfs attributes, and we have covered this issue by adding `ELEVATOR_FLAG_DYNG`. > > For blk-mq debugfs, hctx->sched_tags is always checked with ->elevator_lock by > debugfs code, meantime hctx->sched_tags is updated with ->elevator_lock, so > there isn't such issue. > > Reviewed-by: Hannes Reinecke <hare@xxxxxxx> > Signed-off-by: Ming Lei <ming.lei@xxxxxxxxxx> Looks good to me: Reviewed-by : Nilay Shroff <nilay@xxxxxxxxxxxxx>