mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-23 23:40:53 +07:00
blk-iocost: fix lockdep warning on blkcg->lock
[ Upstream commit 11431e26c9c43fa26f6b33ee1a90989f57b86024 ] blkcg->lock depends on q->queue_lock which may depend on another driver lock required in irq context, one example is dm-thin: Chain exists of: &pool->lock#3 --> &q->queue_lock --> &blkcg->lock Possible interrupt unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&blkcg->lock); local_irq_disable(); lock(&pool->lock#3); lock(&q->queue_lock); <Interrupt> lock(&pool->lock#3); Fix the issue by using spin_lock_irq(&blkcg->lock) in ioc_weight_write(). Cc: Tejun Heo <tj@kernel.org> Reported-by: Bruno Goncalves <bgoncalv@redhat.com> Link: https://lore.kernel.org/linux-block/CA+QYu4rzz6079ighEanS3Qq_Dmnczcf45ZoJoHKVLVATTo1e4Q@mail.gmail.com/T/#u Signed-off-by: Ming Lei <ming.lei@redhat.com> Acked-by: Tejun Heo <tj@kernel.org> Link: https://lore.kernel.org/r/20210803070608.1766400-1-ming.lei@redhat.com Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
fe0c9e93f5
commit
c6064ee6c2
@ -3039,19 +3039,19 @@ static ssize_t ioc_weight_write(struct kernfs_open_file *of, char *buf,
|
|||||||
if (v < CGROUP_WEIGHT_MIN || v > CGROUP_WEIGHT_MAX)
|
if (v < CGROUP_WEIGHT_MIN || v > CGROUP_WEIGHT_MAX)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
spin_lock(&blkcg->lock);
|
spin_lock_irq(&blkcg->lock);
|
||||||
iocc->dfl_weight = v * WEIGHT_ONE;
|
iocc->dfl_weight = v * WEIGHT_ONE;
|
||||||
hlist_for_each_entry(blkg, &blkcg->blkg_list, blkcg_node) {
|
hlist_for_each_entry(blkg, &blkcg->blkg_list, blkcg_node) {
|
||||||
struct ioc_gq *iocg = blkg_to_iocg(blkg);
|
struct ioc_gq *iocg = blkg_to_iocg(blkg);
|
||||||
|
|
||||||
if (iocg) {
|
if (iocg) {
|
||||||
spin_lock_irq(&iocg->ioc->lock);
|
spin_lock(&iocg->ioc->lock);
|
||||||
ioc_now(iocg->ioc, &now);
|
ioc_now(iocg->ioc, &now);
|
||||||
weight_updated(iocg, &now);
|
weight_updated(iocg, &now);
|
||||||
spin_unlock_irq(&iocg->ioc->lock);
|
spin_unlock(&iocg->ioc->lock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
spin_unlock(&blkcg->lock);
|
spin_unlock_irq(&blkcg->lock);
|
||||||
|
|
||||||
return nbytes;
|
return nbytes;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user