You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2024/07/01 19:02:38 UTC
(nuttx) branch master updated: irq: remove g_cpu_nestcount in restore_critical_section because 'g_cpu_nestcount[me] > 0' will never happen, in this place
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 1bf4198556 irq: remove g_cpu_nestcount in restore_critical_section because 'g_cpu_nestcount[me] > 0' will never happen, in this place
1bf4198556 is described below
commit 1bf41985564643a38baffe5de50039e0a5dc13c7
Author: hujun5 <hu...@xiaomi.com>
AuthorDate: Sun Jun 30 16:02:08 2024 +0800
irq: remove g_cpu_nestcount in restore_critical_section
because 'g_cpu_nestcount[me] > 0' will never happen, in this place
test:
We can use qemu for testing.
compiling
make distclean -j20; ./tools/configure.sh -l qemu-armv8a:nsh_smp ;make -j20
running
qemu-system-aarch64 -cpu cortex-a53 -smp 4 -nographic -machine virt,virtualization=on,gic-version=3 -net none -chardev stdio,id=con,mux=on -serial chardev:con -mon chardev=con,mode=readline -kernel ./nuttx
Signed-off-by: hujun5 <hu...@xiaomi.com>
---
sched/irq/irq_csection.c | 20 ++------------------
1 file changed, 2 insertions(+), 18 deletions(-)
diff --git a/sched/irq/irq_csection.c b/sched/irq/irq_csection.c
index 224358642d..175ce0dace 100644
--- a/sched/irq/irq_csection.c
+++ b/sched/irq/irq_csection.c
@@ -621,25 +621,9 @@ void restore_critical_section(void)
*/
tcb = current_task(me);
- if (tcb->irqcount > 0)
+ DEBUGASSERT(g_cpu_nestcount[me] <= 0);
+ if (tcb->irqcount <= 0)
{
- /* Do notihing here
- * NOTE: spin_setbit() is done in nxsched_add_readytorun()
- * and nxsched_remove_readytorun()
- */
- }
-
- /* No.. This CPU will be relinquishing the lock. But this works
- * differently if we are performing a context switch from an
- * interrupt handler and the interrupt handler has established
- * a critical section. We can detect this case when
- * g_cpu_nestcount[me] > 0.
- */
-
- else if (g_cpu_nestcount[me] <= 0)
- {
- /* Release our hold on the IRQ lock. */
-
if ((g_cpu_irqset & (1 << me)) != 0)
{
cpu_irqlock_clear();