driver inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I9SI44
---------------------------------------------------------------------- xa_lock of qp_table_xa may be acquired in interrupt context. Replace xa_lock()/xa_unlock() with xa_lock_irq()/xa_unlock_irq() to avoid deadlock.
Fixes: a21781182f77 ("RDMA/hns: Add debugfs support for DCA") Signed-off-by: Chengchang Tang tangchengchang@huawei.com Signed-off-by: Guofeng Yue yueguofeng@h-partners.com --- drivers/infiniband/hw/hns/hns_roce_debugfs.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/infiniband/hw/hns/hns_roce_debugfs.c b/drivers/infiniband/hw/hns/hns_roce_debugfs.c index c8294a836ee3..85fa88e8a657 100644 --- a/drivers/infiniband/hw/hns/hns_roce_debugfs.c +++ b/drivers/infiniband/hw/hns/hns_roce_debugfs.c @@ -353,19 +353,19 @@ static void dca_stats_dev_qp_in_seqfile(struct hns_roce_dev *hr_dev, seq_printf(file, "%-10s %-10s %-10s %s\n", "QPN", "Size(kB)", "PID", "State");
- xa_lock(&hr_dev->qp_table_xa); + xa_lock_irq(&hr_dev->qp_table_xa); xa_for_each(&hr_dev->qp_table_xa, id, hr_qp) { stats.total_size = 0; dca_setup_qp_stats(hr_qp, &stats); if (!stats.total_size) continue;
- xa_unlock(&hr_dev->qp_table_xa); + xa_unlock_irq(&hr_dev->qp_table_xa); seq_printf(file, "%-10u %-10u %-10s %-s\n", stats.qpn, stats.total_size / KB, stats.name, stats.state); - xa_lock(&hr_dev->qp_table_xa); + xa_lock_irq(&hr_dev->qp_table_xa); } - xa_unlock(&hr_dev->qp_table_xa); + xa_unlock_irq(&hr_dev->qp_table_xa); }
static void dca_stats_ctx_qp_in_seqfile(struct hns_roce_dev *hr_dev, @@ -391,11 +391,11 @@ static void dca_stats_ctx_qp_in_seqfile(struct hns_roce_dev *hr_dev, dca_ctx_stats_qp(ctx, bitmap, nbits); for_each_set_bit(qpn, bitmap, nbits) { stats.total_size = 0; - xa_lock(&hr_dev->qp_table_xa); + xa_lock_irq(&hr_dev->qp_table_xa); hr_qp = __hns_roce_qp_lookup(hr_dev, qpn); if (hr_qp) dca_setup_qp_stats(hr_qp, &stats); - xa_unlock(&hr_dev->qp_table_xa); + xa_unlock_irq(&hr_dev->qp_table_xa); if (!stats.total_size) continue;