Commit 584c2a91 authored by Sean Anderson's avatar Sean Anderson Committed by David S. Miller

soc: fsl: qbman: Always disable interrupts when taking cgr_lock

smp_call_function_single disables IRQs when executing the callback. To
prevent deadlocks, we must disable IRQs when taking cgr_lock elsewhere.
This is already done by qman_update_cgr and qman_delete_cgr; fix the
other lockers.

Fixes: 96f413f4 ("soc/fsl/qbman: fix issue in qman_delete_cgr_safe()")
CC: stable@vger.kernel.org
Signed-off-by: default avatarSean Anderson <sean.anderson@linux.dev>
Reviewed-by: default avatarCamelia Groza <camelia.groza@nxp.com>
Tested-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 67072c31
...@@ -1456,11 +1456,11 @@ static void qm_congestion_task(struct work_struct *work) ...@@ -1456,11 +1456,11 @@ static void qm_congestion_task(struct work_struct *work)
union qm_mc_result *mcr; union qm_mc_result *mcr;
struct qman_cgr *cgr; struct qman_cgr *cgr;
spin_lock(&p->cgr_lock); spin_lock_irq(&p->cgr_lock);
qm_mc_start(&p->p); qm_mc_start(&p->p);
qm_mc_commit(&p->p, QM_MCC_VERB_QUERYCONGESTION); qm_mc_commit(&p->p, QM_MCC_VERB_QUERYCONGESTION);
if (!qm_mc_result_timeout(&p->p, &mcr)) { if (!qm_mc_result_timeout(&p->p, &mcr)) {
spin_unlock(&p->cgr_lock); spin_unlock_irq(&p->cgr_lock);
dev_crit(p->config->dev, "QUERYCONGESTION timeout\n"); dev_crit(p->config->dev, "QUERYCONGESTION timeout\n");
qman_p_irqsource_add(p, QM_PIRQ_CSCI); qman_p_irqsource_add(p, QM_PIRQ_CSCI);
return; return;
...@@ -1476,7 +1476,7 @@ static void qm_congestion_task(struct work_struct *work) ...@@ -1476,7 +1476,7 @@ static void qm_congestion_task(struct work_struct *work)
list_for_each_entry(cgr, &p->cgr_cbs, node) list_for_each_entry(cgr, &p->cgr_cbs, node)
if (cgr->cb && qman_cgrs_get(&c, cgr->cgrid)) if (cgr->cb && qman_cgrs_get(&c, cgr->cgrid))
cgr->cb(p, cgr, qman_cgrs_get(&rr, cgr->cgrid)); cgr->cb(p, cgr, qman_cgrs_get(&rr, cgr->cgrid));
spin_unlock(&p->cgr_lock); spin_unlock_irq(&p->cgr_lock);
qman_p_irqsource_add(p, QM_PIRQ_CSCI); qman_p_irqsource_add(p, QM_PIRQ_CSCI);
} }
...@@ -2440,7 +2440,7 @@ int qman_create_cgr(struct qman_cgr *cgr, u32 flags, ...@@ -2440,7 +2440,7 @@ int qman_create_cgr(struct qman_cgr *cgr, u32 flags,
preempt_enable(); preempt_enable();
cgr->chan = p->config->channel; cgr->chan = p->config->channel;
spin_lock(&p->cgr_lock); spin_lock_irq(&p->cgr_lock);
if (opts) { if (opts) {
struct qm_mcc_initcgr local_opts = *opts; struct qm_mcc_initcgr local_opts = *opts;
...@@ -2477,7 +2477,7 @@ int qman_create_cgr(struct qman_cgr *cgr, u32 flags, ...@@ -2477,7 +2477,7 @@ int qman_create_cgr(struct qman_cgr *cgr, u32 flags,
qman_cgrs_get(&p->cgrs[1], cgr->cgrid)) qman_cgrs_get(&p->cgrs[1], cgr->cgrid))
cgr->cb(p, cgr, 1); cgr->cb(p, cgr, 1);
out: out:
spin_unlock(&p->cgr_lock); spin_unlock_irq(&p->cgr_lock);
put_affine_portal(); put_affine_portal();
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment