Topics

ARM Cortex-R user mode -- should system call handlers be running with external interrupts disabled?

phil.erwin@...
 

I've noticed that on ARM Cortex-R with user mode enabled, that when we enter the system call handlers, such as z_hdlr_k_str_out(), that interrupts are disabled.  It seems to me that external interrupts should be enabled during this time. 

In looking through the Cortex-M support, I don't see where interrupts are enabled there either, so I wanted to poll the community to ask what the expectations are: external interrupts enabled or disabled?

Phil

Boie, Andrew P
 

Interrupts should be unlocked when handling system calls, and indeed a thread in a system call can sleep or be preempted. Sounds like you have found a bug. And a gap in testing, we ought to have a test that validates this.

 

Andrew

 

From: devel@... <devel@...> On Behalf Of phil.erwin@...
Sent: Tuesday, January 14, 2020 4:55 AM
To: devel@...
Subject: [Zephyr-devel] ARM Cortex-R user mode -- should system call handlers be running with external interrupts disabled?

 

I've noticed that on ARM Cortex-R with user mode enabled, that when we enter the system call handlers, such as z_hdlr_k_str_out(), that interrupts are disabled.  It seems to me that external interrupts should be enabled during this time. 

In looking through the Cortex-M support, I don't see where interrupts are enabled there either, so I wanted to poll the community to ask what the expectations are: external interrupts enabled or disabled?

Phil

Boie, Andrew P
 

Phil,

 

I sent a PR which adds a test for this:

 

https://github.com/zephyrproject-rtos/zephyr/pull/21920

 

It passes on all the emulated targets we have (including Cortex-M), but if this is broken for your target please file a bug in GitHub.

 

Regards,

Andrew

 

From: devel@... <devel@...> On Behalf Of Boie, Andrew P
Sent: Tuesday, January 14, 2020 1:39 PM
To: phil.erwin@...; devel@...
Subject: Re: [Zephyr-devel] ARM Cortex-R user mode -- should system call handlers be running with external interrupts disabled?

 

Interrupts should be unlocked when handling system calls, and indeed a thread in a system call can sleep or be preempted. Sounds like you have found a bug. And a gap in testing, we ought to have a test that validates this.

 

Andrew

 

From: devel@... <devel@...> On Behalf Of phil.erwin@...
Sent: Tuesday, January 14, 2020 4:55 AM
To: devel@...
Subject: [Zephyr-devel] ARM Cortex-R user mode -- should system call handlers be running with external interrupts disabled?

 

I've noticed that on ARM Cortex-R with user mode enabled, that when we enter the system call handlers, such as z_hdlr_k_str_out(), that interrupts are disabled.  It seems to me that external interrupts should be enabled during this time. 

In looking through the Cortex-M support, I don't see where interrupts are enabled there either, so I wanted to poll the community to ask what the expectations are: external interrupts enabled or disabled?

Phil