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

Remove sched_elect in serialchar_callback #29

Merged
merged 1 commit into from
Oct 19, 2017

Conversation

mlouielu
Copy link
Contributor

@mlouielu mlouielu commented Aug 22, 2017

DO NOT USE sched_elect inside the irq.

If a context switch is done inside the irq,
it will make v7m-head.S pop {pc} to a undefined place,
or not able to pop {pc} out.

cc. @yenwu.

DO NOT USE sched_elect inside the irq.

If a context switch is done inside the irq,
it will make v7m-head.S `pop {pc}` to a undefined place.
@iankuan
Copy link
Member

iankuan commented Aug 24, 2017

@mlouielu , let me double-check it. You mean that triggering scheduler in irq context would violate flow of exception handler due to exception return ?

If so, you might be right. How about the result of test suites and behavior of minishell?

@mlouielu
Copy link
Contributor Author

mlouielu commented Aug 24, 2017

Although I think this is a correct fix, please hold off a second.

I still trying to figure out why we can not do a context switch inside a regular ISR....it is weird.

@mlouielu
Copy link
Contributor Author

Confirm that this have some bug inside, reproduce step:

  • type in some words in minishell
  • sleep will failed.

@mlouielu
Copy link
Contributor Author

Currently, I'm working on #36 to ensure that this problem isn't coming from the scheduler.

@jserv
Copy link
Member

jserv commented Aug 25, 2017

The use of sched_elect(0) SHOULD be deprecated. Let's introduce new kernel function schedule().

@iankuan iankuan requested review from jserv and iankuan October 18, 2017 02:40
@jserv
Copy link
Member

jserv commented Oct 18, 2017

+1
I defer to @yenwu.

Copy link
Member

@iankuan iankuan left a comment

Choose a reason for hiding this comment

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

@mlouielu , I already confirmed that that's the reason for serial halted. Please mention what's wrong with that in perspective of exception flow and the benefits to following exception service convention. Unexpected exception return increases the probability of occurrence of faults, such as INVPC, INVSTATE. In this situation, we can't make sure that it wouldn't cause faults or invalid interrupt raising due to unfinished interrupt handling.

@iankuan
Copy link
Member

iankuan commented Oct 18, 2017

Moreover, PendSV handler is involved with sched_elect(). It's in irq context and works well due to the lowest priority of pendsv. It's always at the bottom of interrupt handle stack and only exception return to Thread mode. It fits the requirements of the scheduler.

@iankuan iankuan merged commit 41f0cef into PikoRT:master Oct 19, 2017
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.

3 participants