Skip to content

Commit

Permalink
sched: replace sync pause with async pause for nxsig_process
Browse files Browse the repository at this point in the history
Signed-off-by: hujun5 <[email protected]>
  • Loading branch information
hujun260 committed Sep 30, 2024
1 parent 6111d95 commit 0be7806
Show file tree
Hide file tree
Showing 13 changed files with 115 additions and 398 deletions.
33 changes: 0 additions & 33 deletions arch/arm/src/armv6-m/arm_schedulesigaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,30 +101,6 @@ void up_schedule_sigaction(struct tcb_s *tcb)
}
else
{
/* CASE 2: The task that needs to receive the signal is running.
* This could happen if the task is running on another CPU OR if
* we are in an interrupt handler and the task is running on this
* CPU. In the former case, we will have to PAUSE the other CPU
* first. But in either case, we will have to modify the return
* state as well as the state in the TCB.
*/

/* If we signaling a task running on the other CPU, we have
* to PAUSE the other CPU.
*/

#ifdef CONFIG_SMP
int cpu = tcb->cpu;
int me = this_cpu();

if (cpu != me && tcb->task_state == TSTATE_TASK_RUNNING)
{
/* Pause the CPU */

up_cpu_pause(cpu);
}
#endif

/* Save the return PC, CPSR and either the BASEPRI or PRIMASK
* registers (and perhaps also the LR). These will be restored
* by the signal trampoline after the signal has been delivered.
Expand Down Expand Up @@ -160,14 +136,5 @@ void up_schedule_sigaction(struct tcb_s *tcb)
tcb->xcp.regs[REG_EXC_RETURN] = EXC_RETURN_THREAD;
tcb->xcp.regs[REG_CONTROL] = getcontrol() & ~CONTROL_NPRIV;
#endif

#ifdef CONFIG_SMP
/* RESUME the other CPU if it was PAUSED */

if (cpu != me && tcb->task_state == TSTATE_TASK_RUNNING)
{
up_cpu_resume(cpu);
}
#endif
}
}
33 changes: 0 additions & 33 deletions arch/arm/src/armv7-a/arm_schedulesigaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,30 +99,6 @@ void up_schedule_sigaction(struct tcb_s *tcb)
}
else
{
/* CASE 2: The task that needs to receive the signal is running.
* This could happen if the task is running on another CPU OR if
* we are in an interrupt handler and the task is running on this
* CPU. In the former case, we will have to PAUSE the other CPU
* first. But in either case, we will have to modify the return
* state as well as the state in the TCB.
*/

/* If we signaling a task running on the other CPU, we have
* to PAUSE the other CPU.
*/

#ifdef CONFIG_SMP
int cpu = tcb->cpu;
int me = this_cpu();

if (cpu != me && tcb->task_state == TSTATE_TASK_RUNNING)
{
/* Pause the CPU */

up_cpu_pause(cpu);
}
#endif

/* Save the return lr and cpsr and one scratch register. These
* will be restored by the signal trampoline after the signals
* have been delivered.
Expand Down Expand Up @@ -154,14 +130,5 @@ void up_schedule_sigaction(struct tcb_s *tcb)
#ifdef CONFIG_ARM_THUMB
tcb->xcp.regs[REG_CPSR] |= PSR_T_BIT;
#endif

#ifdef CONFIG_SMP
/* RESUME the other CPU if it was PAUSED */

if (cpu != me && tcb->task_state == TSTATE_TASK_RUNNING)
{
up_cpu_resume(cpu);
}
#endif
}
}
33 changes: 0 additions & 33 deletions arch/arm/src/armv7-m/arm_schedulesigaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,30 +102,6 @@ void up_schedule_sigaction(struct tcb_s *tcb)
}
else
{
/* CASE 2: The task that needs to receive the signal is running.
* This could happen if the task is running on another CPU OR if
* we are in an interrupt handler and the task is running on this
* CPU. In the former case, we will have to PAUSE the other CPU
* first. But in either case, we will have to modify the return
* state as well as the state in the TCB.
*/

/* If we signaling a task running on the other CPU, we have
* to PAUSE the other CPU.
*/

#ifdef CONFIG_SMP
int cpu = tcb->cpu;
int me = this_cpu();

if (cpu != me && tcb->task_state == TSTATE_TASK_RUNNING)
{
/* Pause the CPU */

up_cpu_pause(cpu);
}
#endif

/* Save the return PC, CPSR and either the BASEPRI or PRIMASK
* registers (and perhaps also the LR). These will be restored
* by the signal trampoline after the signal has been delivered.
Expand Down Expand Up @@ -165,14 +141,5 @@ void up_schedule_sigaction(struct tcb_s *tcb)
tcb->xcp.regs[REG_EXC_RETURN] = EXC_RETURN_THREAD;
tcb->xcp.regs[REG_CONTROL] = getcontrol() & ~CONTROL_NPRIV;
#endif

#ifdef CONFIG_SMP
/* RESUME the other CPU if it was PAUSED */

if (cpu != me && tcb->task_state == TSTATE_TASK_RUNNING)
{
up_cpu_resume(cpu);
}
#endif
}
}
25 changes: 0 additions & 25 deletions arch/arm/src/armv7-r/arm_schedulesigaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,22 +97,6 @@ void up_schedule_sigaction(struct tcb_s *tcb)
}
else
{
/* If we signaling a task running on the other CPU, we have
* to PAUSE the other CPU.
*/

#ifdef CONFIG_SMP
int cpu = tcb->cpu;
int me = this_cpu();

if (cpu != me && tcb->task_state == TSTATE_TASK_RUNNING)
{
/* Pause the CPU */

up_cpu_pause(cpu);
}
#endif

/* Save the return lr and cpsr and one scratch register. These
* will be restored by the signal trampoline after the signals
* have been delivered.
Expand Down Expand Up @@ -144,14 +128,5 @@ void up_schedule_sigaction(struct tcb_s *tcb)
#ifdef CONFIG_ARM_THUMB
tcb->xcp.regs[REG_CPSR] |= PSR_T_BIT;
#endif

#ifdef CONFIG_SMP
/* RESUME the other CPU if it was PAUSED */

if (cpu != me && tcb->task_state == TSTATE_TASK_RUNNING)
{
up_cpu_resume(cpu);
}
#endif
}
}
33 changes: 0 additions & 33 deletions arch/arm/src/armv8-m/arm_schedulesigaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,30 +102,6 @@ void up_schedule_sigaction(struct tcb_s *tcb)
}
else
{
/* CASE 2: The task that needs to receive the signal is running.
* This could happen if the task is running on another CPU OR if
* we are in an interrupt handler and the task is running on this
* CPU. In the former case, we will have to PAUSE the other CPU
* first. But in either case, we will have to modify the return
* state as well as the state in the TCB.
*/

/* If we signaling a task running on the other CPU, we have
* to PAUSE the other CPU.
*/

#ifdef CONFIG_SMP
int cpu = tcb->cpu;
int me = this_cpu();

if (cpu != me && tcb->task_state == TSTATE_TASK_RUNNING)
{
/* Pause the CPU */

up_cpu_pause(cpu);
}
#endif

/* Save the return PC, CPSR and either the BASEPRI or PRIMASK
* registers (and perhaps also the LR). These will be restored
* by the signal trampoline after the signal has been delivered.
Expand Down Expand Up @@ -165,14 +141,5 @@ void up_schedule_sigaction(struct tcb_s *tcb)
tcb->xcp.regs[REG_EXC_RETURN] = EXC_RETURN_THREAD;
tcb->xcp.regs[REG_CONTROL] = getcontrol() & ~CONTROL_NPRIV;
#endif

#ifdef CONFIG_SMP
/* RESUME the other CPU if it was PAUSED */

if (cpu != me && tcb->task_state == TSTATE_TASK_RUNNING)
{
up_cpu_resume(cpu);
}
#endif
}
}
25 changes: 0 additions & 25 deletions arch/arm/src/armv8-r/arm_schedulesigaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,22 +97,6 @@ void up_schedule_sigaction(struct tcb_s *tcb)
}
else
{
/* If we signaling a task running on the other CPU, we have
* to PAUSE the other CPU.
*/

#ifdef CONFIG_SMP
int cpu = tcb->cpu;
int me = this_cpu();

if (cpu != me && tcb->task_state == TSTATE_TASK_RUNNING)
{
/* Pause the CPU */

up_cpu_pause(cpu);
}
#endif

/* Save the return lr and cpsr and one scratch register. These
* will be restored by the signal trampoline after the signals
* have been delivered.
Expand Down Expand Up @@ -144,14 +128,5 @@ void up_schedule_sigaction(struct tcb_s *tcb)
#ifdef CONFIG_ARM_THUMB
tcb->xcp.regs[REG_CPSR] |= PSR_T_BIT;
#endif

#ifdef CONFIG_SMP
/* RESUME the other CPU if it was PAUSED */

if (cpu != me && tcb->task_state == TSTATE_TASK_RUNNING)
{
up_cpu_resume(cpu);
}
#endif
}
}
21 changes: 0 additions & 21 deletions arch/arm64/src/common/arm64_schedulesigaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,18 +148,6 @@ void up_schedule_sigaction(struct tcb_s *tcb)
}
else
{
#ifdef CONFIG_SMP
int cpu = tcb->cpu;
int me = this_cpu();

if (cpu != me && tcb->task_state == TSTATE_TASK_RUNNING)
{
/* Pause the CPU */

up_cpu_pause(cpu);
}
#endif

/* Save the return lr and cpsr and one scratch register. These
* will be restored by the signal trampoline after the signals
* have been delivered.
Expand All @@ -173,14 +161,5 @@ void up_schedule_sigaction(struct tcb_s *tcb)
/* create signal process context */

arm64_init_signal_process(tcb, NULL);

#ifdef CONFIG_SMP
/* RESUME the other CPU if it was PAUSED */

if (cpu != me && tcb->task_state == TSTATE_TASK_RUNNING)
{
up_cpu_resume(cpu);
}
#endif
}
}
24 changes: 0 additions & 24 deletions arch/ceva/src/common/ceva_schedulesigaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,21 +115,6 @@ void up_schedule_sigaction(struct tcb_s *tcb)

else
{
#ifdef CONFIG_SMP
/* If we signaling a task running on the other CPU, we have
* to PAUSE the other CPU.
*/

if (cpu != me)
{
/* Pause the CPU */

up_cpu_pause(cpu);
}

/* Now tcb on the other CPU can be accessed safely */
#endif

/* Save the current register context location */

tcb->xcp.saved_regs = up_current_regs();
Expand All @@ -155,15 +140,6 @@ void up_schedule_sigaction(struct tcb_s *tcb)
up_current_regs()[REG_OM] &= ~REG_OM_MASK;
up_current_regs()[REG_OM] |= REG_OM_KERNEL;
#endif

#ifdef CONFIG_SMP
/* RESUME the other CPU if it was PAUSED */

if (cpu != me)
{
up_cpu_resume(cpu);
}
#endif
}
}

Expand Down
20 changes: 0 additions & 20 deletions arch/risc-v/src/common/riscv_schedulesigaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,18 +100,6 @@ void up_schedule_sigaction(struct tcb_s *tcb)
}
else
{
#ifdef CONFIG_SMP
int cpu = tcb->cpu;
int me = this_cpu();

if (cpu != me && tcb->task_state == TSTATE_TASK_RUNNING)
{
/* Pause the CPU */

up_cpu_pause(cpu);
}
#endif

/* Save the return EPC and STATUS registers. These will be
* by the signal trampoline after the signal has been delivered.
*/
Expand Down Expand Up @@ -148,13 +136,5 @@ void up_schedule_sigaction(struct tcb_s *tcb)
#endif

tcb->xcp.regs[REG_INT_CTX] = int_ctx;
#ifdef CONFIG_SMP
/* RESUME the other CPU if it was PAUSED */

if (cpu != me && tcb->task_state == TSTATE_TASK_RUNNING)
{
up_cpu_resume(cpu);
}
#endif
}
}
Loading

0 comments on commit 0be7806

Please sign in to comment.