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

cpu: native: fix thread_yield_higher isr_is_in() case #6660

Merged
merged 1 commit into from
Mar 2, 2017

Conversation

kaspar030
Copy link
Contributor

Previously, native created a new "setcontext" context whenever thread_yield_higher() was called. That's unnecessary and broken. At the end of interrupt our interrupt handlers, sched_context_switch_request is checked and triggers an eventually needed context switch.

Fixes #6642.

@kaspar030 kaspar030 added Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) Platform: native Platform: This PR/issue effects the native platform labels Feb 27, 2017
@OlegHahm
Copy link
Member

I came to a similar solution. What I don't quite understand:
at the end of native's IRQ handler (native_irq_handler()) the function cpu_switch_context_exit() gets called. However, the documentation of this function says: "Call context switching at thread exit". Apparently, this function serves more than this purpose on native.

@OlegHahm
Copy link
Member

The change seems valid to me, but I'd like to run a few more tests before I ACK.

@@ -225,7 +225,7 @@ void thread_yield_higher(void)
irq_enable();
}
else {
isr_thread_yield();
sched_context_switch_request = 1;
Copy link
Member

Choose a reason for hiding this comment

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

I think isr_thread_yield is not called from anywhere else - please remove if this is correct.

Copy link
Member

Choose a reason for hiding this comment

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

@kaspar030
Copy link
Contributor Author

What I don't quite understand:
at the end of native's IRQ handler (native_irq_handler()) the function cpu_switch_context_exit() gets called.

Yeah, that's weird. IMHO unrelated, though.

@OlegHahm
Copy link
Member

OlegHahm commented Mar 2, 2017

True

@OlegHahm OlegHahm added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Mar 2, 2017
Copy link
Member

@OlegHahm OlegHahm left a comment

Choose a reason for hiding this comment

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

ACK

@OlegHahm OlegHahm merged commit 1af1727 into RIOT-OS:master Mar 2, 2017
@kaspar030 kaspar030 deleted the fix_native_thread_yield_higher branch March 2, 2017 12:08
@kaspar030
Copy link
Contributor Author

@OlegHahm Does this patch also solve the stability issues you had when testing yout thesis?

@OlegHahm
Copy link
Member

OlegHahm commented Mar 6, 2017

Trying hard to remember which issues you're talking about...

@OlegHahm
Copy link
Member

OlegHahm commented Mar 6, 2017

I thought they were already fixed with #2071.

@OlegHahm
Copy link
Member

OlegHahm commented Mar 6, 2017

But I found 9930e17 in my working branch that may be related.

@kaspar030
Copy link
Contributor Author

But I found 9930e17 in my working branch that may be related.

Yes, that's the one I meant, also in #6135.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Platform: native Platform: This PR/issue effects the native platform Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants