nuttx icon indicating copy to clipboard operation
nuttx copied to clipboard

esp32s3/smp: Dual Core Scheduling Problem.

Open w2016561536 opened this issue 1 year ago • 6 comments

At first, thank you for reading this issue. I'm not quite sure if it occurred by NuttX scheduling. Perhaps applications cause this issue.

dual_core Here is the process information of my board. It is running PX4-Autopilot, which is based on NuttX. On CPU0, there is one task taking up all the resources. And no new task can be scheduled on CPU0 (if I run smp test at this moment). Howerver this application has no problem on single core. The process information below. single_core

And what makes me puzzled that ALWAYS CPU0 happens this problem and it never happens on CPU1. And, the task stuck on the CPU0 is random. It could change after reset. But sometimes the app runs well and no task stuck on one core.

w2016561536 avatar Jan 19 '24 17:01 w2016561536

HI @w2016561536 !

I didn't get exactly what is your problem, but I saw no problems regarding your process scheduling in the images you shared. Could you please elaborate what is the problem?

tmedicci avatar Jan 19 '24 17:01 tmedicci

In picture 1, wq:rate_ctrl take up all the cpu resources. But actually, it does not run, just stuck there. It look like cpu 0 is dead

w2016561536 avatar Jan 19 '24 18:01 w2016561536

In picture 1, wq:rate_ctrl take up all the cpu resources. But actually, it does not run, just stuck there. It look like cpu 0 is dead

The picture does not show that. It shows that wq:rate_ctrl takes 50.2% of the CPU time. It is expected it to be that high because this task takes the highest priority (perhaps you should lower it). About being stuck: you would need to analyze the app itself: try to attach the debugger and check where it is being stuck.

tmedicci avatar Jan 19 '24 18:01 tmedicci

In picture 1, wq:rate_ctrl take up all the cpu resources. But actually, it does not run, just stuck there. It look like cpu 0 is dead

The picture does not show that. It shows that wq:rate_ctrl takes 50.2% of the CPU time. It is expected it to be that high because this task takes the highest priority (perhaps you should lower it). About being stuck: you would need to analyze the app itself: try to attach the debugger and check where it is being stuck.

In NuttX,when dual core is enabled and system has very low load, each Idle task takes 50% time. Thank you for your advice. I will use debugger to inspect what happens on Core 0 next day. Here is middle night. I need to go to bed. Have a nice day. @tmedicci

w2016561536 avatar Jan 19 '24 18:01 w2016561536

@masayuki2009 since you did many improvements over original SMP, maybe you can have some suggestion to help here.

acassis avatar Jan 20 '24 23:01 acassis

@acassis

@masayuki2009 since you did many improvements over original SMP, maybe you can have some suggestion to help here.

I think @tmedicci's comments are correct. However, we should clarify which version of the nuttx @w2016561536 is using. Also, we should clarify the defconfig (i.e. esp32s3-devkit:smp) that @w2016561536 modified.

masayuki2009 avatar Jan 22 '24 02:01 masayuki2009