Skip to content

sched: replace up_cpu_index with this_cpu - #13211

Merged
anchao merged 1 commit into
apache:masterfrom
fxysunshine:replace_this_cpu
Sep 5, 2024
Merged

anchao merged 1 commit into
apache:masterfrom
fxysunshine:replace_this_cpu

Conversation

@fxysunshine

@fxysunshine fxysunshine commented Aug 28, 2024 •

Copy link
Copy Markdown
Contributor

Summary

Make this_cpu is arch independent and up_cpu_index do that. In AMP mode, up_cpu_index() may return the index of the physical core, this_cpu() will always return 0.

In SMP mode, up_cpu_index()/this_cpu() are the same, both return the index of the physical core.

Impact

In AMP mode, carefully check risc-v/xtensa arch.

Testing

FC7300 board for armv7-m in AMP mode to customize up_cpu_index().

@xiaoxiang781216
xiaoxiang781216 requested a review from anchao August 28, 2024 06:34
@fxysunshine
fxysunshine force-pushed the replace_this_cpu branch 2 times, most recently from bfc0321 to b454009 Compare August 28, 2024 07:47
@xiaoxiang781216 xiaoxiang781216 changed the title sched: replace up_cpu_index with get_cpu sched: replace up_cpu_index with this_cpu Aug 28, 2024

@anchao anchao left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Some changes need to be carefully reviewed. If the core id needs to be included in the hardware register calculation, up_cpu_index() should be used instead of this_cpu().

Comment thread drivers/syslog/vsyslog.c Resolved
Comment thread arch/arm/src/armv8-r/arm_gicv3.c Resolved
Comment thread arch/arm/src/armv8-r/arm_gicv3.c Resolved
Comment thread arch/arm64/src/common/arm64_gicv3.c Resolved
Comment thread arch/arm64/src/common/arm64_gicv3.c Resolved
@fxysunshine
fxysunshine force-pushed the replace_this_cpu branch 2 times, most recently from 7054168 to 0c061e7 Compare September 2, 2024 13:24
Make this_cpu is arch independent and up_cpu_index do that.
In AMP mode, up_cpu_index() may return the index of the physical core.

Signed-off-by: fangxinyong <[email protected]>
@acassis

acassis commented Sep 3, 2024

Copy link
Copy Markdown
Contributor

@fxysunshine please test in real board, passing CI is not a real test!

@fxysunshine

Copy link
Copy Markdown
Contributor Author

@fxysunshine please test in real board, passing CI is not a real test!

Thanks for reminder. Updated the testing comment.

We are testing in FC7300 board for armv7-m in AMP mode and customized up_cpu_index() to return the index of the physical core, and result is OK.

@fxysunshine

fxysunshine commented Sep 3, 2024 •

Copy link
Copy Markdown
Contributor Author

CI failed

Building NuttX...
error: RPC failed; curl 92 HTTP/2 stream 0 was not closed cleanly: CANCEL (err 8)
error: 3609 bytes of body are still expected
fetch-pack: unexpected disconnect while reading sideband packet
fatal: early EOF
fatal: fetch-pack: invalid index-pack output
make[1]: *** [common/espressif/Make.defs:149: chip/esp-hal-3rdparty] Error 128
make[1]: Target 'context' not remade because of errors.
make: *** [tools/Unix.mk:452: arch/risc-v/src/.context] Error 2
make: Target 'all' not remade because of errors.

@fxysunshine
fxysunshine requested a review from anchao September 4, 2024 01:19
@anchao
anchao merged commit 7b05a55 into apache:master Sep 5, 2024
@fxysunshine
fxysunshine deleted the replace_this_cpu branch December 1, 2025 07:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants