--
You received this message because you are subscribed to the Google Groups "Tock Embedded OS Development Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tock-dev+u...@googlegroups.com.
To post to this group, send email to tock...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tock-dev/CACW1YzsUHhBD4GLXSXD4PFSLPZto1NFFQRozR0vhfkUgt5a61g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Tock Embedded OS Development Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tock-dev+u...@googlegroups.com.
To post to this group, send email to tock...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tock-dev/CACW1Yzt3xFe8fsthZrOrOaOvfLsP%3D8q3KmYtMCN_xBmQiB8Q6Q%40mail.gmail.com.
tl;dr I think we have agreement that the current implementation
of `generic_isr` could yield bugs for pulse-triggered peripherals
(which we simply haven't encountered yet), and a simple change
should fix it.
On Tue, Dec 11, 2018 at 1:37 AM Brad Campbell <bra...@gmail.com> wrote:I think, then, that we agree that `generic_isr()` can return without the corresponding pending bit set, and we will miss the interrupt until the interrupt occurs again. However, does manually setting the pending bit inside of `generic_isr()` address this case and ensure that the pending bit will be set when `generic_isr()` ends?AFAICT, for pulse-triggered peripheral, setting the pending bit inside of `generic_isr()` should ensure that the pending bit will be set when `generic_isr()` ends. *Because* we disable the interrupt at NVIC in `generic_isr()`, it will not enter `generic_isr()` again, leaving pending bit set for `service_pending_interrupts()` to be able to process it.
Great, so we all at least agree that pushing all/most interrupt handling to ISRs is unnecessary to get correct semantics.
It's not stated above, but since it came up in a related GitHub PR I'll restate that having logic in ISRs puts type-safety at risk since the compiler would be no-help in preventing data-races that can circumvent the type system (see section 2.1 of https://www.tockos.org/assets/papers/rust-kernel-apsys2017.pdf for an example explanation of why this is the case).
In other words, having programmable ISRs prevents the Tock architecture from ensuring type-safety, and thus isolation, within the kernel, for little benefit. So it should be avoided except in extenuating circumstances
In my mind there are still some open questions. 1. Interrupt latency In [1] Louis has mentioned the use-cases where he needs top-half interrupt handlers. In want to add another use-case. Most secure microcontrollers have tamper detect mechanisms. When tamper detect interrupts are fired, we need to be able to take counter measures in a top-half interrupt handler.
Yes, these seem similar to hard faults to me, which are also handled specially. Though I don't think the issue here is latency but rather a need to immediately stop or somehow recover the system in case of tamper.
I also agree with the Louis comment - "..., there are countless situations where embedded systems need to execute code in the interrupt routine. The quality and safety of drivers will be enhanced if we provide a canonical way of doing so rather than having every other project hack in some idiosyncratic approach."
I feel we should have canonical way of doing split drivers in Tock.
I agree that if it proves useful it makes sense to have a convention for how to break the Tock model. Louis's experiments in CC26x2 are a great start towards that. When we have numbers and use cases that require programmable peripheral ISRs we'll have that as a basis to start from.
2. Behavior of `wfi` when we are in the state - (Line::Pulse(Low), Enabled::Disabled, Pending::Pending) or (Line::Level(High), Enabled::Disabled, Pending::Pending) I took another look at the following code, and it seems to me that we won't be entering sleep in pending state.
...so changing this code in a way that would put the chip to sleep would be a bug that would break most applications.``` chip.atomic(|| { if !chip.has_pending_interrupts() && self.processes_blocked() { chip.sleep(); } }); ``` However, should this part of the code ever change, there is a possibility that we might introduce additional latency.