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

ARM Cortex_R: CONFIG_USERSPACE: external interrupts are disabled during system calls #22131

Closed
pderwin opened this issue Jan 23, 2020 · 9 comments
Assignees
Labels
Enhancement Changes/Updates/Additions to existing features priority: low Low impact/importance bug

Comments

@pderwin
Copy link
Contributor

pderwin commented Jan 23, 2020

While processing a system call, the HANDLER code should run with external interrupts enabled. This is not the case for Cortex R.

To Reproduce

Steps to reproduce the behavior:

Produce a build for Cortex R CPU with CONFIG_USERSPACE enabled. Run test that Andrew Boie has added which checks for interrupts enabled in system call context. It will fail the following assert:
zassert_true(arch_irq_unlocked(key), "irqs locked during syscall");

his new test:
tests: userspace: test syscall irq context #21920

Expected behavior
Interrupts should be enabled during the system call, so the assert should pass.

Impact
Anyone using CONFIG_USERSPACE with Cortex_R will suffer from having interrupts disabled during system calls. This could be catastrophic depending on the user's environment.

Screenshots or console output
N/A

Environment (please complete the following information):

  • OS: Linux build environment
  • Toolchain Zephyr SDK
  • V 1.14.0 : cebe115

Additional context
We have a fix for the problem. Ready for submission.

@pderwin pderwin added the bug The issue is a bug, or the PR is fixing a bug label Jan 23, 2020
@jhedberg
Copy link
Member

You're mentioning Zephyr 1.14, however cortex r wasn't supported then?

@pderwin
Copy link
Contributor Author

pderwin commented Jan 28, 2020

We have been using Z on Cortex-R for some time. Official support may not be claimed, but we are using it and reporting/fixing bugs as we see them.

@jhedberg jhedberg added the priority: low Low impact/importance bug label Jan 28, 2020
@andrewboie
Copy link
Contributor

We have been using Z on Cortex-R for some time. Official support may not be claimed, but we are using it and reporting/fixing bugs as we see them.

@pderwin I'm wondering if there's a better way to track bugs in Cortex-R code that isn't upstreamed yet?

The problem with filing these bugs in the main Zephyr bug backlog, is that it gives the impression that these are issues in the main Zephyr master branch. And it will mess up our bug counts when we count them up when preparing a release.

Would it be possible to track these elsewhere, perhaps in a fork of the Zephyr project where you maintain your yet-to-be-upstreamed code, and only file issues here if they have been determined to affect the open source tree as well (such as the issue with MPU->RNR locking on Cortex-M)?

@pderwin
Copy link
Contributor Author

pderwin commented Jan 28, 2020

I talked with my partner here. We're going to get our R code upstreamed ASAP. Actually, t has already been submitted, but not accepted due to a couple of merge conflicts.

There is a usermode test that I will get that functioning on our platform as 'proof of life'.

We believe that someone is working towards having a QEMU implementation for R4, so a regression will be possible when that's ready.

Hopefully still will all be completed before a new bug arises.

Phil

@andrewboie
Copy link
Contributor

I talked with my partner here. We're going to get our R code upstreamed ASAP. Actually, t has already been submitted, but not accepted due to a couple of merge conflicts.

Works for me. Please add me as a reviewer.

@stephanosio
Copy link
Member

Most of the Cortex-R port issues should be addressed by #20594. I suspect this bug might have something to do with #20474.

@ioannisg
Copy link
Member

@pderwin should this bug issue be closer or treated as enhancement, as well?

@pderwin
Copy link
Contributor Author

pderwin commented Jul 24, 2020 via email

@ioannisg ioannisg added Enhancement Changes/Updates/Additions to existing features and removed bug The issue is a bug, or the PR is fixing a bug labels Jul 24, 2020
@stephanosio stephanosio assigned bbolen and unassigned stephanosio Aug 13, 2021
@bbolen
Copy link
Collaborator

bbolen commented Aug 18, 2021

This should be addressed with #28231. The Cortex-R implementation enables interrupts while handling the system call.

@bbolen bbolen closed this as completed Aug 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Changes/Updates/Additions to existing features priority: low Low impact/importance bug
Projects
None yet
Development

No branches or pull requests

6 participants