Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nuttx/sched: use pid to check idle task #7459

Merged
merged 1 commit into from Oct 31, 2022

Conversation

zyfeier
Copy link
Contributor

@zyfeier zyfeier commented Oct 28, 2022

Summary

Use pid to determine idle task, this is more robust when we want to use other data structure to optimize the task list.

Impact

NA

Testing

IMX6Q

sched/sched/sched.h Outdated Show resolved Hide resolved
Copy link
Contributor

@pkarashchenko pkarashchenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@masayuki2009
Copy link
Contributor

nuttx/sched: usd pid to check idle task

@zyfeier
Please replace 'usd' with 'use' in the commit message.

Copy link
Contributor

@masayuki2009 masayuki2009 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I noticed that spresense:smp (with CONFIG_DEBUG_ASSERTIONS=y) has a problem when booting.

AEG
[CPU0] up_assert: Assertion failed CPU0 at file:sched/sched_cpuselect.c line: 97 task: AppBringUp
[CPU0] arm_registerdump: R0: 00000000 R1: 2d02b314 R2: 041ac000  R3: 00000000
[CPU0] arm_registerdump: R4: 2d02b314 R5: 2d02e310 R6: 2d02aa58  FP: 2d02ed80
[CPU0] arm_registerdump: R8: 2d02ed80 SB: 00000001 SL: 00000000 R11: 00000000
[CPU0] arm_registerdump: IP: 00000009 SP: 2d02ed68 LR: 0d009371  PC: 0d0095cc
[CPU0] arm_registerdump: xPSR: 61000200 BASEPRI: 00000080 CONTROL: 00000004
[CPU0] arm_registerdump: EXC_RETURN: ffffffe9
[CPU0] arm_dump_stack: IRQ Stack:
[CPU0] arm_dump_stack: sp:     2d02ed80
[CPU0] arm_dump_stack:   base: 2d0299a8
[CPU0] arm_dump_stack:   size: 00000800
[CPU0] arm_dump_stack: ERROR: IRQ Stack pointer is not within the stack
[CPU0] arm_dump_stack: User Stack:
[CPU0] arm_dump_stack: sp:     2d02ed80
[CPU0] arm_dump_stack:   base: 2d02e710
[CPU0] arm_dump_stack:   size: 000007d0
[CPU0] arm_stackdump: 2d02ed80: 000000e0 2d0299a8 00000001 00000000 000000f0 2d02ac14 2d02ab58 0d007455
[CPU0] arm_stackdump: 2d02eda0: 00000000 0d005f7d 00000003 0302acb0 10000000 2d02f290 2d02f290 00000000
[CPU0] arm_stackdump: 2d02edc0: 00000400 0d00136d 00000000 0d00658b 2d02f290 2d02e310 00000000 00000400
[CPU0] arm_stackdump: 2d02ede0: 0d00136d 00000000 00000000 0d00962f 00000001 000000e0 2d02f290 0d005285
[CPU0] arm_stackdump: 2d02ee00: 2d02b2d8 2d02f290 00000003 0d004f1b 00000400 0d00136d 00000000 2d02e620
[CPU0] arm_stackdump: 2d02ee20: 00000000 000000c8 00000000 0d01d848 000000c8 0d004f4d 00000400 0d00136d
[CPU0] arm_stackdump: 2d02ee40: 00000000 2d02e620 00000000 00000101 00000000 00000000 00000000 0d004f61
[CPU0] arm_stackdump: 2d02ee60: 00000000 00000000 00000000 0d001697 00000000 00000000 00000000 0d00a1a5
[CPU0] arm_stackdump: 2d02ee80: 00000000 00000000 00000000 00000000 0d005290 01000000 00000000 00000000
[CPU0] arm_stackdump: 2d02eea0: 00000000 00000000 00000000 00000000 00000101 0d0039a3 00000001 2d02e6f8
[CPU0] arm_stackdump: 2d02eec0: 2d02e6f8 00000000 00000002 0d0052d3 00000000 00000000 00000000 00000000
[CPU0] arm_showtasks:    PID    PRI   CPU     STACK   COMMAND
[CPU0] arm_showtasks:   ----   ----  ----      2048   irq
[CPU0] arm_dump_task:      0      0     0      1000   CPU0 IDLE
[CPU0] arm_dump_task:      1      0     1      1000   CPU1 IDLE
[CPU0] arm_dump_task:      2    240     0      2000   AppBringUp
[CPU0] arm_dump_task:      3    200     0       976   cxd56_pm_task

@masayuki2009
Copy link
Contributor

Hmm, I noticed that spresense:smp (with CONFIG_DEBUG_ASSERTIONS=y) has a problem when booting.

sim:smp has a similar issue.

$ ./nuttx
[CPU0] up_assert: Assertion failed CPU0 at file:sched/sched_cpuselect.c line: 97 task: loop_task
[CPU0] up_assert: Assertion failed CPU0 at file:irq/irq_csection.c line: 347 task: loop_task

@pkarashchenko pkarashchenko self-requested a review October 28, 2022 19:22
Pid is more appropriate than the flink pointer to determine idle task,
when we want to use other data structure to optimize the task list.
@zyfeier
Copy link
Contributor Author

zyfeier commented Oct 31, 2022

Hmm, I noticed that spresense:smp (with CONFIG_DEBUG_ASSERTIONS=y) has a problem when booting.

sim:smp has a similar issue.

$ ./nuttx
[CPU0] up_assert: Assertion failed CPU0 at file:sched/sched_cpuselect.c line: 97 task: loop_task
[CPU0] up_assert: Assertion failed CPU0 at file:irq/irq_csection.c line: 347 task: loop_task

@masayuki2009 fixed this problem, plz check.

@zyfeier zyfeier changed the title nuttx/sched: usd pid to check idle task nuttx/sched: use pid to check idle task Oct 31, 2022
@masayuki2009
Copy link
Contributor

@masayuki2009 fixed this problem, plz check.

@zyfeier
I confirmed that the latest PR fixes the issue.

@masayuki2009 masayuki2009 merged commit 18266c1 into apache:master Oct 31, 2022
@zyfeier zyfeier deleted the idle_task branch November 1, 2022 02:40
@jerpelea jerpelea added this to To-Add in Release Notes - 12.0.0 Dec 29, 2022
@jerpelea jerpelea moved this from To-Add to Added in Release Notes - 12.0.0 Jan 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

4 participants