Skip to content

Commit

Permalink
soc/fsl/qbman: fix issue in qman_delete_cgr_safe()
Browse files Browse the repository at this point in the history
The wait_for_completion() call in qman_delete_cgr_safe()
was triggering a scheduling while atomic bug, replacing the
kthread with a smp_call_function_single() call to fix it.

Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
Signed-off-by: Roy Pledge <roy.pledge@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
madalinbucur authored and davem330 committed Mar 14, 2018
1 parent 4dcb31d commit 96f413f
Showing 1 changed file with 5 additions and 23 deletions.
28 changes: 5 additions & 23 deletions drivers/soc/fsl/qbman/qman.c
Original file line number Diff line number Diff line change
Expand Up @@ -2443,39 +2443,21 @@ struct cgr_comp {
struct completion completion;
};

static int qman_delete_cgr_thread(void *p)
static void qman_delete_cgr_smp_call(void *p)
{
struct cgr_comp *cgr_comp = (struct cgr_comp *)p;
int ret;

ret = qman_delete_cgr(cgr_comp->cgr);
complete(&cgr_comp->completion);

return ret;
qman_delete_cgr((struct qman_cgr *)p);
}

void qman_delete_cgr_safe(struct qman_cgr *cgr)
{
struct task_struct *thread;
struct cgr_comp cgr_comp;

preempt_disable();
if (qman_cgr_cpus[cgr->cgrid] != smp_processor_id()) {
init_completion(&cgr_comp.completion);
cgr_comp.cgr = cgr;
thread = kthread_create(qman_delete_cgr_thread, &cgr_comp,
"cgr_del");

if (IS_ERR(thread))
goto out;

kthread_bind(thread, qman_cgr_cpus[cgr->cgrid]);
wake_up_process(thread);
wait_for_completion(&cgr_comp.completion);
smp_call_function_single(qman_cgr_cpus[cgr->cgrid],
qman_delete_cgr_smp_call, cgr, true);
preempt_enable();
return;
}
out:

qman_delete_cgr(cgr);
preempt_enable();
}
Expand Down

0 comments on commit 96f413f

Please sign in to comment.