Commit 96f413f4 authored by Madalin Bucur's avatar Madalin Bucur Committed by David S. Miller

soc/fsl/qbman: fix issue in qman_delete_cgr_safe()

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: default avatarMadalin Bucur <madalin.bucur@nxp.com>
Signed-off-by: default avatarRoy Pledge <roy.pledge@nxp.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4dcb31d4
...@@ -2443,39 +2443,21 @@ struct cgr_comp { ...@@ -2443,39 +2443,21 @@ struct cgr_comp {
struct completion completion; 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; qman_delete_cgr((struct qman_cgr *)p);
int ret;
ret = qman_delete_cgr(cgr_comp->cgr);
complete(&cgr_comp->completion);
return ret;
} }
void qman_delete_cgr_safe(struct qman_cgr *cgr) void qman_delete_cgr_safe(struct qman_cgr *cgr)
{ {
struct task_struct *thread;
struct cgr_comp cgr_comp;
preempt_disable(); preempt_disable();
if (qman_cgr_cpus[cgr->cgrid] != smp_processor_id()) { if (qman_cgr_cpus[cgr->cgrid] != smp_processor_id()) {
init_completion(&cgr_comp.completion); smp_call_function_single(qman_cgr_cpus[cgr->cgrid],
cgr_comp.cgr = cgr; qman_delete_cgr_smp_call, cgr, true);
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);
preempt_enable(); preempt_enable();
return; return;
} }
out:
qman_delete_cgr(cgr); qman_delete_cgr(cgr);
preempt_enable(); preempt_enable();
} }
......
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