sched_smp:sync refcount before enqueue smp call queue
Signed-off-by: dulibo1 <dulibo1@xiaomi.com> 1.call_data->refcount is not remote_cpus; 2.nxsched_smp_call_add enqueue the call_data; 3.maybe nxsched_smp_call_handler is just doing; 4.dequeue the call_data but call_data->refcount is not corret; 5.unpredictability case will occur;
This commit is contained in:
parent
a26051e7bc
commit
6fd1ca64a1
@ -239,7 +239,8 @@ int nxsched_smp_call(cpu_set_t cpuset, nxsched_smp_call_t func,
|
|||||||
CPU_CLR(this_cpu(), &cpuset);
|
CPU_CLR(this_cpu(), &cpuset);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CPU_COUNT(&cpuset) == 0)
|
remote_cpus = CPU_COUNT(&cpuset);
|
||||||
|
if (remote_cpus == 0)
|
||||||
{
|
{
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@ -261,22 +262,17 @@ int nxsched_smp_call(cpu_set_t cpuset, nxsched_smp_call_t func,
|
|||||||
|
|
||||||
call_data->func = func;
|
call_data->func = func;
|
||||||
call_data->arg = arg;
|
call_data->arg = arg;
|
||||||
|
call_data->refcount = remote_cpus;
|
||||||
|
|
||||||
for (i = 0; i < CONFIG_SMP_NCPUS; i++)
|
for (i = 0; i < CONFIG_SMP_NCPUS; i++)
|
||||||
{
|
{
|
||||||
if (CPU_ISSET(i, &cpuset))
|
if (CPU_ISSET(i, &cpuset))
|
||||||
{
|
{
|
||||||
nxsched_smp_call_add(i, call_data);
|
nxsched_smp_call_add(i, call_data);
|
||||||
remote_cpus++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
call_data->refcount = remote_cpus;
|
up_send_smp_call(cpuset);
|
||||||
|
|
||||||
if (remote_cpus > 0)
|
|
||||||
{
|
|
||||||
up_send_smp_call(cpuset);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (wait)
|
if (wait)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user