lockdep gets unhappy about the not disabling irqs when using the queue_lock around it. Instead of trying to fix that up just switch to an atomic_t and get rid of the lock.
Unified · Split
| @@ -89,7 +89,8 @@ static int blk_mq_queue_enter(struct request_queue *q, gfp_t gfp) · 88 unmodified lines | ||
| 89 | 89 | return -EBUSY; |
| 90 | 90 | |
| 91 | 91 | ret = wait_event_interruptible(q->mq_freeze_wq, |
| 92 | − !q->mq_freeze_depth || blk_queue_dying(q)); | |
| 92 | + !atomic_read(&q->mq_freeze_depth) || | |
| 93 | + blk_queue_dying(q)); | |
| 93 | 94 | if (blk_queue_dying(q)) |
| 94 | 95 | return -ENODEV; |
| 95 | 96 | if (ret) |
| @@ -112,13 +113,10 @@ static void blk_mq_usage_counter_release(struct percpu_ref *ref) · 16 unmodified lines | ||
| 112 | 113 | |
| 113 | 114 | void blk_mq_freeze_queue_start(struct request_queue *q) |
| 114 | 115 | { |
| 115 | − bool freeze; | |
| 116 | + int freeze_depth; | |
| 116 | 117 | |
| 117 | − spin_lock_irq(q->queue_lock); | |
| 118 | − freeze = !q->mq_freeze_depth++; | |
| 119 | − spin_unlock_irq(q->queue_lock); | |
| 120 | − | |
| 121 | − if (freeze) { | |
| 118 | + freeze_depth = atomic_inc_return(&q->mq_freeze_depth); | |
| 119 | + if (freeze_depth == 1) { | |
| 122 | 120 | percpu_ref_kill(&q->mq_usage_counter); |
| 123 | 121 | blk_mq_run_hw_queues(q, false); |
| 124 | 122 | } |
| @@ -143,13 +141,11 @@ EXPORT_SYMBOL_GPL(blk_mq_freeze_queue); · 18 unmodified lines | ||
| 143 | 141 | |
| 144 | 142 | void blk_mq_unfreeze_queue(struct request_queue *q) |
| 145 | 143 | { |
| 146 | − bool wake; | |
| 144 | + int freeze_depth; | |
| 147 | 145 | |
| 148 | − spin_lock_irq(q->queue_lock); | |
| 149 | − wake = !--q->mq_freeze_depth; | |
| 150 | − WARN_ON_ONCE(q->mq_freeze_depth < 0); | |
| 151 | − spin_unlock_irq(q->queue_lock); | |
| 152 | − if (wake) { | |
| 146 | + freeze_depth = atomic_dec_return(&q->mq_freeze_depth); | |
| 147 | + WARN_ON_ONCE(freeze_depth < 0); | |
| 148 | + if (!freeze_depth) { | |
| 153 | 149 | percpu_ref_reinit(&q->mq_usage_counter); |
| 154 | 150 | wake_up_all(&q->mq_freeze_wq); |
| 155 | 151 | } |
| @@ -2081,7 +2077,7 @@ void blk_mq_free_queue(struct request_queue *q) · 1925 unmodified lines | ||
| 2081 | 2077 | /* Basically redo blk_mq_init_queue with queue frozen */ |
| 2082 | 2078 | static void blk_mq_queue_reinit(struct request_queue *q) |
| 2083 | 2079 | { |
| 2084 | − WARN_ON_ONCE(!q->mq_freeze_depth); | |
| 2080 | + WARN_ON_ONCE(!atomic_read(&q->mq_freeze_depth)); | |
| 2085 | 2081 | |
| 2086 | 2082 | blk_mq_sysfs_unregister(q); |
| 2087 | 2083 | |
| @@ -444,7 +444,7 @@ struct request_queue { · 443 unmodified lines | ||
| 444 | 444 | struct mutex sysfs_lock; |
| 445 | 445 | |
| 446 | 446 | int bypass_depth; |
| 447 | − int mq_freeze_depth; | |
| 447 | + atomic_t mq_freeze_depth; | |
| 448 | 448 | |
| 449 | 449 | #if defined(CONFIG_BLK_DEV_BSG) |
| 450 | 450 | bsg_job_fn *bsg_job_fn; |