Implement deferred IRQ locking. Adds support for simulator.
This commit is contained in:
parent
729ee7c099
commit
9f7ba21f8a
@ -46,6 +46,7 @@
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Must match definitions in up_testset.c */
|
||||
|
||||
#define SP_UNLOCKED false /* The Un-locked state */
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* arch/sim/src/up_blocktask.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2013, 2015 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2009, 2013, 2015-2016 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -47,6 +47,7 @@
|
||||
#include <nuttx/sched.h>
|
||||
|
||||
#include "sched/sched.h"
|
||||
#include "irq/irq.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
@ -145,6 +146,16 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state)
|
||||
|
||||
sched_resume_scheduler(rtcb);
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
/* In the SMP configuration, critical section management uses a
|
||||
* "voting" algorithm with current task on each CPU casting its
|
||||
* "vote" by the state of the TCB irqcount flag. That irqcount
|
||||
* for the current task on this CPU will be different is a
|
||||
* context switch occurrred.
|
||||
*/
|
||||
|
||||
irq_restore_lock();
|
||||
#endif
|
||||
/* Then switch contexts */
|
||||
|
||||
up_longjmp(rtcb->xcp.regs, 1);
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* arch/sim/src/up_exit.c
|
||||
*
|
||||
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2009, 2016 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -46,6 +46,7 @@
|
||||
|
||||
#include "task/task.h"
|
||||
#include "sched/sched.h"
|
||||
#include "irq/irq.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
@ -92,6 +93,17 @@ void _exit(int status)
|
||||
tcb->xcp.sigdeliver = NULL;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
/* In the SMP configuration, critical section management uses a
|
||||
* "voting" algorithm with current task on each CPU casting its
|
||||
* "vote" by the state of the TCB irqcount flag. That irqcount
|
||||
* for the current task on this CPU will be different is a
|
||||
* context switch occurrred.
|
||||
*/
|
||||
|
||||
irq_restore_lock();
|
||||
#endif
|
||||
|
||||
/* Then switch contexts */
|
||||
|
||||
up_longjmp(tcb->xcp.regs, 1);
|
||||
|
@ -52,7 +52,7 @@
|
||||
# include <arch/irq.h>
|
||||
# ifdef CONFIG_SMP
|
||||
# include <nuttx/sched.h>
|
||||
# include <arch/spinlock.h>
|
||||
# include <nuttx/spinlock.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
@ -47,6 +47,7 @@
|
||||
#include <nuttx/sched.h>
|
||||
|
||||
#include "sched/sched.h"
|
||||
#include "irq/irq.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
@ -128,6 +129,16 @@ void up_release_pending(void)
|
||||
|
||||
sched_resume_scheduler(rtcb);
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
/* In the SMP configuration, critical section management uses a
|
||||
* "voting" algorithm with current task on each CPU casting its
|
||||
* "vote" by the state of the TCB irqcount flag. That irqcount
|
||||
* for the current task on this CPU will be different is a
|
||||
* context switch occurrred.
|
||||
*/
|
||||
|
||||
irq_restore_lock();
|
||||
#endif
|
||||
/* Then switch contexts */
|
||||
|
||||
up_longjmp(rtcb->xcp.regs, 1);
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* arch/sim/src/up_reprioritizertr.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2013, 2015 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2009, 2013, 2015-2016 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -48,6 +48,7 @@
|
||||
#include <nuttx/sched.h>
|
||||
|
||||
#include "sched/sched.h"
|
||||
#include "irq/irq.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
@ -166,6 +167,16 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority)
|
||||
|
||||
sched_resume_scheduler(rtcb);
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
/* In the SMP configuration, critical section management uses a
|
||||
* "voting" algorithm with current task on each CPU casting its
|
||||
* "vote" by the state of the TCB irqcount flag. That irqcount
|
||||
* for the current task on this CPU will be different is a
|
||||
* context switch occurrred.
|
||||
*/
|
||||
|
||||
irq_restore_lock();
|
||||
#endif
|
||||
/* Then switch contexts */
|
||||
|
||||
up_longjmp(rtcb->xcp.regs, 1);
|
||||
|
@ -43,6 +43,7 @@
|
||||
#include <nuttx/spinlock.h>
|
||||
|
||||
#include "sched/sched.h"
|
||||
#include "irq/irq.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
@ -150,6 +151,16 @@ int up_cpu_paused(int cpu)
|
||||
|
||||
sched_resume_scheduler(rtcb);
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
/* In the SMP configuration, critical section management uses a
|
||||
* "voting" algorithm with current task on each CPU casting its
|
||||
* "vote" by the state of the TCB irqcount flag. That irqcount
|
||||
* for the current task on this CPU will be different is a
|
||||
* context switch occurrred.
|
||||
*/
|
||||
|
||||
irq_restore_lock();
|
||||
#endif
|
||||
/* Then switch contexts */
|
||||
|
||||
up_longjmp(rtcb->xcp.regs, 1);
|
||||
|
@ -46,6 +46,7 @@
|
||||
|
||||
#include "clock/clock.h"
|
||||
#include "sched/sched.h"
|
||||
#include "irq/irq.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
@ -125,6 +126,16 @@ void up_unblock_task(FAR struct tcb_s *tcb)
|
||||
|
||||
sched_resume_scheduler(rtcb);
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
/* In the SMP configuration, critical section management uses a
|
||||
* "voting" algorithm with current task on each CPU casting its
|
||||
* "vote" by the state of the TCB irqcount flag. That irqcount
|
||||
* for the current task on this CPU will be different is a
|
||||
* context switch occurrred.
|
||||
*/
|
||||
|
||||
irq_restore_lock();
|
||||
#endif
|
||||
/* Then switch contexts */
|
||||
|
||||
up_longjmp(rtcb->xcp.regs, 1);
|
||||
|
Loading…
Reference in New Issue
Block a user