From a569eef6ba36dc445e14cd91342ae54e8d0ab7ef Mon Sep 17 00:00:00 2001 From: buxiasen Date: Wed, 7 Aug 2024 14:39:53 +0800 Subject: [PATCH] arch: cpu pause when sigaction only necessary if tcb running Signed-off-by: buxiasen --- arch/arm/src/armv6-m/arm_schedulesigaction.c | 4 ++-- arch/arm/src/armv7-a/arm_schedulesigaction.c | 4 ++-- arch/arm/src/armv7-m/arm_schedulesigaction.c | 4 ++-- arch/arm/src/armv7-r/arm_schedulesigaction.c | 4 ++-- arch/arm/src/armv8-m/arm_schedulesigaction.c | 4 ++-- arch/arm/src/armv8-r/arm_schedulesigaction.c | 4 ++-- arch/arm64/src/common/arm64_schedulesigaction.c | 4 ++-- arch/risc-v/src/common/riscv_schedulesigaction.c | 4 ++-- arch/x86_64/src/intel64/intel64_schedulesigaction.c | 4 ++-- arch/xtensa/src/common/xtensa_schedsigaction.c | 4 ++-- 10 files changed, 20 insertions(+), 20 deletions(-) diff --git a/arch/arm/src/armv6-m/arm_schedulesigaction.c b/arch/arm/src/armv6-m/arm_schedulesigaction.c index 4e5da4c5ef..855dacdcc1 100644 --- a/arch/arm/src/armv6-m/arm_schedulesigaction.c +++ b/arch/arm/src/armv6-m/arm_schedulesigaction.c @@ -123,7 +123,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver) int cpu = tcb->cpu; int me = this_cpu(); - if (cpu != me) + if (cpu != me && tcb->task_state == TSTATE_TASK_RUNNING) { /* Pause the CPU */ @@ -170,7 +170,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver) #ifdef CONFIG_SMP /* RESUME the other CPU if it was PAUSED */ - if (cpu != me) + if (cpu != me && tcb->task_state == TSTATE_TASK_RUNNING) { up_cpu_resume(cpu); } diff --git a/arch/arm/src/armv7-a/arm_schedulesigaction.c b/arch/arm/src/armv7-a/arm_schedulesigaction.c index 187af9b18b..ef98b8e1a8 100644 --- a/arch/arm/src/armv7-a/arm_schedulesigaction.c +++ b/arch/arm/src/armv7-a/arm_schedulesigaction.c @@ -121,7 +121,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver) int cpu = tcb->cpu; int me = this_cpu(); - if (cpu != me) + if (cpu != me && tcb->task_state == TSTATE_TASK_RUNNING) { /* Pause the CPU */ @@ -164,7 +164,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver) #ifdef CONFIG_SMP /* RESUME the other CPU if it was PAUSED */ - if (cpu != me) + if (cpu != me && tcb->task_state == TSTATE_TASK_RUNNING) { up_cpu_resume(cpu); } diff --git a/arch/arm/src/armv7-m/arm_schedulesigaction.c b/arch/arm/src/armv7-m/arm_schedulesigaction.c index 531e295bbd..c7cbf9a8d1 100644 --- a/arch/arm/src/armv7-m/arm_schedulesigaction.c +++ b/arch/arm/src/armv7-m/arm_schedulesigaction.c @@ -124,7 +124,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver) int cpu = tcb->cpu; int me = this_cpu(); - if (cpu != me) + if (cpu != me && tcb->task_state == TSTATE_TASK_RUNNING) { /* Pause the CPU */ @@ -175,7 +175,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver) #ifdef CONFIG_SMP /* RESUME the other CPU if it was PAUSED */ - if (cpu != me) + if (cpu != me && tcb->task_state == TSTATE_TASK_RUNNING) { up_cpu_resume(cpu); } diff --git a/arch/arm/src/armv7-r/arm_schedulesigaction.c b/arch/arm/src/armv7-r/arm_schedulesigaction.c index b21a0c9188..b58ef10d26 100644 --- a/arch/arm/src/armv7-r/arm_schedulesigaction.c +++ b/arch/arm/src/armv7-r/arm_schedulesigaction.c @@ -111,7 +111,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver) int cpu = tcb->cpu; int me = this_cpu(); - if (cpu != me) + if (cpu != me && tcb->task_state == TSTATE_TASK_RUNNING) { /* Pause the CPU */ @@ -154,7 +154,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver) #ifdef CONFIG_SMP /* RESUME the other CPU if it was PAUSED */ - if (cpu != me) + if (cpu != me && tcb->task_state == TSTATE_TASK_RUNNING) { up_cpu_resume(cpu); } diff --git a/arch/arm/src/armv8-m/arm_schedulesigaction.c b/arch/arm/src/armv8-m/arm_schedulesigaction.c index 42b0ccfb06..f13fa3dcf0 100644 --- a/arch/arm/src/armv8-m/arm_schedulesigaction.c +++ b/arch/arm/src/armv8-m/arm_schedulesigaction.c @@ -124,7 +124,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver) int cpu = tcb->cpu; int me = this_cpu(); - if (cpu != me) + if (cpu != me && tcb->task_state == TSTATE_TASK_RUNNING) { /* Pause the CPU */ @@ -175,7 +175,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver) #ifdef CONFIG_SMP /* RESUME the other CPU if it was PAUSED */ - if (cpu != me) + if (cpu != me && tcb->task_state == TSTATE_TASK_RUNNING) { up_cpu_resume(cpu); } diff --git a/arch/arm/src/armv8-r/arm_schedulesigaction.c b/arch/arm/src/armv8-r/arm_schedulesigaction.c index 1ceba997f7..099d313de5 100644 --- a/arch/arm/src/armv8-r/arm_schedulesigaction.c +++ b/arch/arm/src/armv8-r/arm_schedulesigaction.c @@ -111,7 +111,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver) int cpu = tcb->cpu; int me = this_cpu(); - if (cpu != me) + if (cpu != me && tcb->task_state == TSTATE_TASK_RUNNING) { /* Pause the CPU */ @@ -154,7 +154,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver) #ifdef CONFIG_SMP /* RESUME the other CPU if it was PAUSED */ - if (cpu != me) + if (cpu != me && tcb->task_state == TSTATE_TASK_RUNNING) { up_cpu_resume(cpu); } diff --git a/arch/arm64/src/common/arm64_schedulesigaction.c b/arch/arm64/src/common/arm64_schedulesigaction.c index 5f1dbe63b8..ce145980df 100644 --- a/arch/arm64/src/common/arm64_schedulesigaction.c +++ b/arch/arm64/src/common/arm64_schedulesigaction.c @@ -141,7 +141,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver) int cpu = tcb->cpu; int me = this_cpu(); - if (cpu != me) + if (cpu != me && tcb->task_state == TSTATE_TASK_RUNNING) { /* Pause the CPU */ @@ -163,7 +163,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver) #ifdef CONFIG_SMP /* RESUME the other CPU if it was PAUSED */ - if (cpu != me) + if (cpu != me && tcb->task_state == TSTATE_TASK_RUNNING) { up_cpu_resume(cpu); } diff --git a/arch/risc-v/src/common/riscv_schedulesigaction.c b/arch/risc-v/src/common/riscv_schedulesigaction.c index d886443d9e..cb4263e8bd 100644 --- a/arch/risc-v/src/common/riscv_schedulesigaction.c +++ b/arch/risc-v/src/common/riscv_schedulesigaction.c @@ -107,7 +107,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver) int cpu = tcb->cpu; int me = this_cpu(); - if (cpu != me) + if (cpu != me && tcb->task_state == TSTATE_TASK_RUNNING) { /* Pause the CPU */ @@ -154,7 +154,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver) #ifdef CONFIG_SMP /* RESUME the other CPU if it was PAUSED */ - if (cpu != me) + if (cpu != me && tcb->task_state == TSTATE_TASK_RUNNING) { up_cpu_resume(cpu); } diff --git a/arch/x86_64/src/intel64/intel64_schedulesigaction.c b/arch/x86_64/src/intel64/intel64_schedulesigaction.c index d846ed3798..03b5ecae19 100644 --- a/arch/x86_64/src/intel64/intel64_schedulesigaction.c +++ b/arch/x86_64/src/intel64/intel64_schedulesigaction.c @@ -222,7 +222,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver) * to PAUSE the other CPU. */ - if (cpu != me) + if (cpu != me && tcb->task_state == TSTATE_TASK_RUNNING) { /* Pause the CPU */ @@ -286,7 +286,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver) /* RESUME the other CPU if it was PAUSED */ - if (cpu != me) + if (cpu != me && tcb->task_state == TSTATE_TASK_RUNNING) { up_cpu_resume(cpu); } diff --git a/arch/xtensa/src/common/xtensa_schedsigaction.c b/arch/xtensa/src/common/xtensa_schedsigaction.c index 2d3a381583..591c70ade2 100644 --- a/arch/xtensa/src/common/xtensa_schedsigaction.c +++ b/arch/xtensa/src/common/xtensa_schedsigaction.c @@ -107,7 +107,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver) int cpu = tcb->cpu; int me = this_cpu(); - if (cpu != me) + if (cpu != me && tcb->task_state == TSTATE_TASK_RUNNING) { /* Pause the CPU */ @@ -161,7 +161,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver) #ifdef CONFIG_SMP /* RESUME the other CPU if it was PAUSED */ - if (cpu != me) + if (cpu != me && tcb->task_state == TSTATE_TASK_RUNNING) { up_cpu_resume(cpu); }