From 36ed8be684cab68cfd3c9abcbb894ab053eaba89 Mon Sep 17 00:00:00 2001 From: zhujiale <945386260@qq.com> Date: Fri, 13 Sep 2024 18:01:40 +0800 Subject: [PATCH] smp --- components/drivers/smp/smp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/components/drivers/smp/smp.c b/components/drivers/smp/smp.c index 765d143061..aa0071c576 100644 --- a/components/drivers/smp/smp.c +++ b/components/drivers/smp/smp.c @@ -71,6 +71,7 @@ void rt_smp_call_func_cond(int cpu_mask, rt_smp_call_func_back func, void *data, int cpuid = 1 << cur_cpu; int tmp_id = 0, cpu_nr = 0; int tmp_mask; + int irq_flag; if (flag == SMP_CALL_WAIT_ALL) { @@ -101,9 +102,9 @@ void rt_smp_call_func_cond(int cpu_mask, rt_smp_call_func_back func, void *data, event.func = func; event.data = data; event.cpu_mask = cpu_mask; - rt_spin_lock(&rt_smp_work[tmp_id].lock); + irq_flag = rt_spin_lock_irqsave(&rt_smp_work[tmp_id].lock); rt_smp_work[tmp_id].event = event; - rt_spin_unlock(&rt_smp_work[tmp_id].lock); + rt_spin_unlock_irqrestore(&rt_smp_work[tmp_id].lock,irq_flag); } tmp_id++; tmp_mask = tmp_mask >> 1;