Closed BottCode closed 4 years ago
I've just solved changing the Overrun_Inspector
spec to:
protected Overrun_Inspector is
pragma Priority (System.Max_Interrupt_Priority);
procedure Inform_Inspector (For_Time : Ada.Real_Time.Time_Span);
procedure React_To_Overrun (E : in out Timing_Event);
end Overrun_Inspector;
This solution works, of course, but I'm wondering if it this the "right way". In that document, there's no any priority setting on the protected object. Maybe that example is wrong?
Hi @BottCode,
This is actually a rule from the Reference manual:
If the Ceiling_Locking policy (see D.3) is in effect when a procedure Set_Handler is called, a check is made that the ceiling priority of Handler.all is Interrupt_Priority'Last. If the check fails, Program_Error is raised.
https://www.adaic.org/resources/add_content/standards/12rm/html/RM-D-15.html
Hi, I'm getting trouble implementing the budget overrun detection mechanism at pages 26-29 of this document.
I've a task T which calls
Boil procedure.
This procedure set the handler. The problem arise when a budget overrun is detected: the attempt to invokeIs_Done
procedure raises an exception. Debugging the program, I found that the exception is raised due to priority ceiling protocol (PCP) violation. In s-taprob.adb provided by Adacore, the execution falls into row 99 because a PCP is detected. So, whyCaller_Priority > Object.Ceiling
isTrue
(and hence program error is raised)? Maybe because the budget overrun handler is being executed by the alarm interrupt? In Adacore's ravenscar implementation, interrupts have a strictly higher priority than normal tasks. Therefore, if an interrupt calls a protected procedure of a protected object belonging to a normal task, a PCP violation will always occur. Isn't it?Let me know if my explanation isn't clear enough. Below you can see a toy application reproducing the issue.
main.adb
budget_overrun_detection.ads
budget_overrun_detection.adb
project file demo.gpr
I'm using GNAT-arm-elf 2018 CE edition.