Re: [PR] Fix smp scheduling [nuttx]

2025-07-09 Thread via GitHub
jlaitine commented on PR #16673: URL: https://github.com/apache/nuttx/pull/16673#issuecomment-3052220420 @hujun260 ; I changed the erroneous places which you pointed out, I also added one patch on the top, which tries to address your concern of moving tasks back-and-forth when sched-l

Re: [PR] Fix smp scheduling [nuttx]

2025-07-09 Thread via GitHub
jlaitine commented on code in PR #16673: URL: https://github.com/apache/nuttx/pull/16673#discussion_r2194713589 ## sched/sched/sched_suspend.c: ## @@ -172,7 +173,11 @@ void nxsched_suspend(FAR struct tcb_s *tcb) { switch_needed = nxsched_remove_readytorun(tcb

Re: [PR] Fix smp scheduling [nuttx]

2025-07-08 Thread via GitHub
hujun260 commented on code in PR #16673: URL: https://github.com/apache/nuttx/pull/16673#discussion_r2194000956 ## sched/sched/sched_suspend.c: ## @@ -172,7 +173,11 @@ void nxsched_suspend(FAR struct tcb_s *tcb) { switch_needed = nxsched_remove_readytorun(tcb

Re: [PR] Fix smp scheduling [nuttx]

2025-07-08 Thread via GitHub
hujun260 commented on code in PR #16673: URL: https://github.com/apache/nuttx/pull/16673#discussion_r2194000956 ## sched/sched/sched_suspend.c: ## @@ -172,7 +173,11 @@ void nxsched_suspend(FAR struct tcb_s *tcb) { switch_needed = nxsched_remove_readytorun(tcb

Re: [PR] Fix smp scheduling [nuttx]

2025-07-08 Thread via GitHub
jlaitine commented on PR #16673: URL: https://github.com/apache/nuttx/pull/16673#issuecomment-3051085860 Thanks for the good comments @hujun260 ! I will continue refining this PR later today. -- This is an automated message from the Apache Git Service. To respond to the message, please lo

Re: [PR] Fix smp scheduling [nuttx]

2025-07-08 Thread via GitHub
hujun260 commented on code in PR #16673: URL: https://github.com/apache/nuttx/pull/16673#discussion_r2193984003 ## sched/sched/sched_suspend.c: ## @@ -172,7 +173,11 @@ void nxsched_suspend(FAR struct tcb_s *tcb) { switch_needed = nxsched_remove_readytorun(tcb

Re: [PR] Fix smp scheduling [nuttx]

2025-07-08 Thread via GitHub
jlaitine commented on code in PR #16673: URL: https://github.com/apache/nuttx/pull/16673#discussion_r2193987877 ## sched/sched/sched_setpriority.c: ## @@ -191,10 +133,11 @@ static inline void nxsched_running_setpriority(FAR struct tcb_s *tcb, { FAR struct tcb_s *rtc

Re: [PR] Fix smp scheduling [nuttx]

2025-07-08 Thread via GitHub
hujun260 commented on code in PR #16673: URL: https://github.com/apache/nuttx/pull/16673#discussion_r2193984003 ## sched/sched/sched_suspend.c: ## @@ -172,7 +173,11 @@ void nxsched_suspend(FAR struct tcb_s *tcb) { switch_needed = nxsched_remove_readytorun(tcb

Re: [PR] Fix smp scheduling [nuttx]

2025-07-08 Thread via GitHub
jlaitine commented on code in PR #16673: URL: https://github.com/apache/nuttx/pull/16673#discussion_r2193976614 ## sched/sched/sched_addreadytorun.c: ## @@ -114,7 +114,87 @@ bool nxsched_add_readytorun(FAR struct tcb_s *btcb) return ret; } -#endif /* !CONFIG_SMP */ + +#els

Re: [PR] Fix smp scheduling [nuttx]

2025-07-08 Thread via GitHub
hujun260 commented on code in PR #16673: URL: https://github.com/apache/nuttx/pull/16673#discussion_r2193904597 ## sched/sched/sched_setpriority.c: ## @@ -191,10 +133,11 @@ static inline void nxsched_running_setpriority(FAR struct tcb_s *tcb, { FAR struct tcb_s *rtc

Re: [PR] Fix smp scheduling [nuttx]

2025-07-08 Thread via GitHub
hujun260 commented on code in PR #16673: URL: https://github.com/apache/nuttx/pull/16673#discussion_r2193904597 ## sched/sched/sched_setpriority.c: ## @@ -191,10 +133,11 @@ static inline void nxsched_running_setpriority(FAR struct tcb_s *tcb, { FAR struct tcb_s *rtc

Re: [PR] Fix smp scheduling [nuttx]

2025-07-08 Thread via GitHub
hujun260 commented on code in PR #16673: URL: https://github.com/apache/nuttx/pull/16673#discussion_r2193901479 ## sched/sched/sched_addreadytorun.c: ## @@ -114,7 +114,87 @@ bool nxsched_add_readytorun(FAR struct tcb_s *btcb) return ret; } -#endif /* !CONFIG_SMP */ + +#els

Re: [PR] Fix smp scheduling [nuttx]

2025-07-08 Thread via GitHub
hujun260 commented on code in PR #16673: URL: https://github.com/apache/nuttx/pull/16673#discussion_r2193901017 ## sched/sched/sched_addreadytorun.c: ## @@ -114,7 +114,87 @@ bool nxsched_add_readytorun(FAR struct tcb_s *btcb) return ret; } -#endif /* !CONFIG_SMP */ + +#els

Re: [PR] Fix smp scheduling [nuttx]

2025-07-08 Thread via GitHub
jlaitine commented on PR #16673: URL: https://github.com/apache/nuttx/pull/16673#issuecomment-3048757174 Now there is an initial version, with removed g_pendingtasks for SMP. I didn't test it fully yet, except quick trials with ostest on rv-virt:smp64 and with real application on mpfs

Re: [PR] Fix smp scheduling [nuttx]

2025-07-08 Thread via GitHub
xiaoxiang781216 commented on code in PR #16673: URL: https://github.com/apache/nuttx/pull/16673#discussion_r2191728532 ## sched/sched/sched_addreadytorun.c: ## @@ -196,7 +196,7 @@ bool nxsched_add_readytorun(FAR struct tcb_s *btcb) * situation. */ - if (nxsched_islock

Re: [PR] Fix smp scheduling [nuttx]

2025-07-08 Thread via GitHub
xiaoxiang781216 commented on code in PR #16673: URL: https://github.com/apache/nuttx/pull/16673#discussion_r2191728532 ## sched/sched/sched_addreadytorun.c: ## @@ -196,7 +196,7 @@ bool nxsched_add_readytorun(FAR struct tcb_s *btcb) * situation. */ - if (nxsched_islock

Re: [PR] Fix smp scheduling [nuttx]

2025-07-07 Thread via GitHub
jlaitine commented on code in PR #16673: URL: https://github.com/apache/nuttx/pull/16673#discussion_r2191555409 ## sched/sched/sched_addreadytorun.c: ## @@ -196,7 +196,7 @@ bool nxsched_add_readytorun(FAR struct tcb_s *btcb) * situation. */ - if (nxsched_islocked_tcb(

Re: [PR] Fix smp scheduling [nuttx]

2025-07-07 Thread via GitHub
xiaoxiang781216 commented on code in PR #16673: URL: https://github.com/apache/nuttx/pull/16673#discussion_r2191452164 ## sched/sched/sched_addreadytorun.c: ## @@ -196,7 +196,7 @@ bool nxsched_add_readytorun(FAR struct tcb_s *btcb) * situation. */ - if (nxsched_islock

Re: [PR] Fix smp scheduling [nuttx]

2025-07-07 Thread via GitHub
fdcavalcanti commented on PR #16673: URL: https://github.com/apache/nuttx/pull/16673#issuecomment-3045865199 Will test on ESP32, its been failing for some time. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL a

Re: [PR] Fix smp scheduling [nuttx]

2025-07-05 Thread via GitHub
jlaitine commented on code in PR #16673: URL: https://github.com/apache/nuttx/pull/16673#discussion_r2186967343 ## sched/sched/sched_setpriority.c: ## @@ -259,7 +250,7 @@ static inline void nxsched_running_setpriority(FAR struct tcb_s *tcb, #endif if (nxsched_reprio

Re: [PR] Fix smp scheduling [nuttx]

2025-07-04 Thread via GitHub
hujun260 commented on code in PR #16673: URL: https://github.com/apache/nuttx/pull/16673#discussion_r2186287186 ## sched/sched/sched_setpriority.c: ## @@ -259,7 +250,7 @@ static inline void nxsched_running_setpriority(FAR struct tcb_s *tcb, #endif if (nxsched_reprio

Re: [PR] Fix smp scheduling [nuttx]

2025-07-04 Thread via GitHub
hujun260 commented on code in PR #16673: URL: https://github.com/apache/nuttx/pull/16673#discussion_r2186284177 ## sched/sched/sched_setpriority.c: ## @@ -259,7 +250,7 @@ static inline void nxsched_running_setpriority(FAR struct tcb_s *tcb, #endif if (nxsched_reprio

Re: [PR] Fix smp scheduling [nuttx]

2025-07-04 Thread via GitHub
hujun260 commented on code in PR #16673: URL: https://github.com/apache/nuttx/pull/16673#discussion_r2186285968 ## sched/sched/sched_setpriority.c: ## @@ -231,8 +223,7 @@ static inline void nxsched_running_setpriority(FAR struct tcb_s *tcb, #ifdef CONFIG_SMP int c

Re: [PR] Fix smp scheduling [nuttx]

2025-07-04 Thread via GitHub
hujun260 commented on code in PR #16673: URL: https://github.com/apache/nuttx/pull/16673#discussion_r2186284177 ## sched/sched/sched_setpriority.c: ## @@ -259,7 +250,7 @@ static inline void nxsched_running_setpriority(FAR struct tcb_s *tcb, #endif if (nxsched_reprio

Re: [PR] Fix smp scheduling [nuttx]

2025-07-04 Thread via GitHub
hujun260 commented on code in PR #16673: URL: https://github.com/apache/nuttx/pull/16673#discussion_r2186284177 ## sched/sched/sched_setpriority.c: ## @@ -259,7 +250,7 @@ static inline void nxsched_running_setpriority(FAR struct tcb_s *tcb, #endif if (nxsched_reprio

Re: [PR] Fix smp scheduling [nuttx]

2025-07-04 Thread via GitHub
hujun260 commented on code in PR #16673: URL: https://github.com/apache/nuttx/pull/16673#discussion_r2186284177 ## sched/sched/sched_setpriority.c: ## @@ -259,7 +250,7 @@ static inline void nxsched_running_setpriority(FAR struct tcb_s *tcb, #endif if (nxsched_reprio

Re: [PR] Fix smp scheduling [nuttx]

2025-07-04 Thread via GitHub
jlaitine commented on code in PR #16673: URL: https://github.com/apache/nuttx/pull/16673#discussion_r2185684622 ## sched/sched/sched_setpriority.c: ## @@ -223,29 +230,30 @@ static inline void nxsched_running_setpriority(FAR struct tcb_s *tcb, /* A context switch will

Re: [PR] Fix smp scheduling [nuttx]

2025-07-04 Thread via GitHub
jlaitine commented on code in PR #16673: URL: https://github.com/apache/nuttx/pull/16673#discussion_r2185684622 ## sched/sched/sched_setpriority.c: ## @@ -223,29 +230,30 @@ static inline void nxsched_running_setpriority(FAR struct tcb_s *tcb, /* A context switch will

Re: [PR] Fix smp scheduling [nuttx]

2025-07-04 Thread via GitHub
jlaitine commented on PR #16673: URL: https://github.com/apache/nuttx/pull/16673#issuecomment-3036474072 > In principle, we should not determine whether other cores are in the sched_lock state, because this state is not fixed and can change at any time. Instead, we should modify some global

Re: [PR] Fix smp scheduling [nuttx]

2025-07-04 Thread via GitHub
jlaitine commented on code in PR #16673: URL: https://github.com/apache/nuttx/pull/16673#discussion_r2185451688 ## sched/sched/sched_addreadytorun.c: ## @@ -196,7 +196,7 @@ bool nxsched_add_readytorun(FAR struct tcb_s *btcb) * situation. */ - if (nxsched_islocked_tcb(

Re: [PR] Fix smp scheduling [nuttx]

2025-07-04 Thread via GitHub
jlaitine commented on code in PR #16673: URL: https://github.com/apache/nuttx/pull/16673#discussion_r2185450555 ## sched/sched/sched_setpriority.c: ## @@ -231,8 +223,7 @@ static inline void nxsched_running_setpriority(FAR struct tcb_s *tcb, #ifdef CONFIG_SMP int c

Re: [PR] Fix smp scheduling [nuttx]

2025-07-04 Thread via GitHub
jlaitine commented on code in PR #16673: URL: https://github.com/apache/nuttx/pull/16673#discussion_r2185449179 ## sched/sched/sched_setpriority.c: ## @@ -259,7 +250,7 @@ static inline void nxsched_running_setpriority(FAR struct tcb_s *tcb, #endif if (nxsched_reprio

Re: [PR] Fix smp scheduling [nuttx]

2025-07-04 Thread via GitHub
jlaitine commented on code in PR #16673: URL: https://github.com/apache/nuttx/pull/16673#discussion_r2185295638 ## sched/sched/sched_mergepending.c: ## @@ -190,96 +190,90 @@ bool nxsched_merge_pending(void) { FAR struct tcb_s *rtcb; FAR struct tcb_s *ptcb; - FAR struct t

Re: [PR] Fix smp scheduling [nuttx]

2025-07-04 Thread via GitHub
jlaitine commented on code in PR #16673: URL: https://github.com/apache/nuttx/pull/16673#discussion_r2185295638 ## sched/sched/sched_mergepending.c: ## @@ -190,96 +190,90 @@ bool nxsched_merge_pending(void) { FAR struct tcb_s *rtcb; FAR struct tcb_s *ptcb; - FAR struct t

Re: [PR] Fix smp scheduling [nuttx]

2025-07-04 Thread via GitHub
hujun260 commented on PR #16673: URL: https://github.com/apache/nuttx/pull/16673#issuecomment-3036131751 In principle, we should not determine whether other cores are in the sched_lock state, because this state is not fixed and can change at any time. Instead, we should modify some global o

Re: [PR] Fix smp scheduling [nuttx]

2025-07-04 Thread via GitHub
hujun260 commented on code in PR #16673: URL: https://github.com/apache/nuttx/pull/16673#discussion_r2185251309 ## sched/sched/sched_addreadytorun.c: ## @@ -196,7 +196,7 @@ bool nxsched_add_readytorun(FAR struct tcb_s *btcb) * situation. */ - if (nxsched_islocked_tcb(

Re: [PR] Fix smp scheduling [nuttx]

2025-07-04 Thread via GitHub
hujun260 commented on code in PR #16673: URL: https://github.com/apache/nuttx/pull/16673#discussion_r2185242444 ## sched/sched/sched_addreadytorun.c: ## @@ -196,7 +196,7 @@ bool nxsched_add_readytorun(FAR struct tcb_s *btcb) * situation. */ - if (nxsched_islocked_tcb(

Re: [PR] Fix smp scheduling [nuttx]

2025-07-04 Thread via GitHub
hujun260 commented on code in PR #16673: URL: https://github.com/apache/nuttx/pull/16673#discussion_r2185217336 ## sched/sched/sched_setpriority.c: ## @@ -231,8 +223,7 @@ static inline void nxsched_running_setpriority(FAR struct tcb_s *tcb, #ifdef CONFIG_SMP int c

Re: [PR] Fix smp scheduling [nuttx]

2025-07-04 Thread via GitHub
hujun260 commented on code in PR #16673: URL: https://github.com/apache/nuttx/pull/16673#discussion_r2185205538 ## sched/sched/sched_setpriority.c: ## @@ -259,7 +250,7 @@ static inline void nxsched_running_setpriority(FAR struct tcb_s *tcb, #endif if (nxsched_reprio

Re: [PR] Fix smp scheduling [nuttx]

2025-07-04 Thread via GitHub
jlaitine commented on PR #16673: URL: https://github.com/apache/nuttx/pull/16673#issuecomment-3035898054 I realized that sched_mergepending didn't re-check the minimum priority after every loop. So added that... -- This is an automated message from the Apache Git Service. To respond to th

[PR] Fix smp scheduling [nuttx]

2025-07-04 Thread via GitHub
jlaitine opened a new pull request, #16673: URL: https://github.com/apache/nuttx/pull/16673 ## Summary This fixes scheduling issues found in both code review and testing. The main issues started with nxsched_addreadytorun putting tasks to the pending list on wrong basis; basically ch