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

zero-latency IRQ behavior is not documented? #21185

Closed
pabigot opened this issue Dec 4, 2019 · 6 comments · Fixed by #21765
Closed

zero-latency IRQ behavior is not documented? #21185

pabigot opened this issue Dec 4, 2019 · 6 comments · Fixed by #21765
Assignees
Labels
area: Documentation Enhancement Changes/Updates/Additions to existing features priority: medium Medium impact/importance bug
Milestone

Comments

@pabigot
Copy link
Collaborator

pabigot commented Dec 4, 2019

ARM zero-latency IRQ functionality was added some time this year, but there appears to be no documentation on what it does and its interaction with other thread and interrupt behavior.

From what I can tell, zero-latency IRQs will be taken even when interrupts are disabled, and there is a hint that meta-irq priority threads in the future may be given control from a zero-latency IRQ.

It would help if the behavior of this feature were documented, and suggestions provided about how to mitigate latency induced as a result of such an interrupt, and perhaps restrictions on what is permitted within a ZLI handler to prevent breaking otherwise working code due to broken locks.

@pabigot pabigot added the bug The issue is a bug, or the PR is fixing a bug label Dec 4, 2019
@aescolar aescolar added area: Documentation priority: low Low impact/importance bug labels Dec 4, 2019
@aescolar
Copy link
Member

aescolar commented Dec 4, 2019

Triaging as low: This would seem borderline and enhancement

@aescolar
Copy link
Member

aescolar commented Dec 4, 2019

CC: @ioannisg

@nashif
Copy link
Member

nashif commented Dec 4, 2019

config ZERO_LATENCY_IRQS
        bool "Enable zero-latency interrupts"
        depends on CPU_CORTEX_M_HAS_BASEPRI
        help
          The kernel may reserve some of the highest interrupts priorities in
          the system for its own use. These interrupts will not be masked
          by interrupt locking.
          When connecting interrupts the kernel will offset all interrupts
          to lower priority than those reserved by the kernel.
          Zero-latency interrupt can be used to set up an interrupt at the
          highest interrupt priority which will not be blocked by interrupt
          locking.
          Since Zero-latency ISRs will run in the same priority or possibly at
          higher priority than the rest of the kernel they cannot use any
          kernel functionality.

Maybe should be extracted and expanded on in https://docs.zephyrproject.org/latest/reference/kernel/other/interrupts.html

@pabigot pabigot added priority: medium Medium impact/importance bug and removed priority: low Low impact/importance bug labels Dec 13, 2019
@pabigot
Copy link
Collaborator Author

pabigot commented Dec 13, 2019

As I learn more about this feature I think the documentation needs to expand on this:

...cannot use any kernel functionality.

Somebody might read that and think it's not really different from other ISRs, where you can do things like k_sem_give().

If that's not true, it should be explicitly mentioned.

If non-sleeping kernel API calls that reschedule are permitted in ZLI handlers there seems to be a problem because ZLIs will break spinlocks on non-SMP builds. If somebody's also using meta-irq threads to process the bottom half of the interrupt, that lock may be broken for a very long time.

ZLIs are extremely powerful and correspondingly dangerous. I don't really think clearly describing how they may be used should be a low priority, so I'm going to bump it. @aescolar if you disagree let's discuss next triage. I do think this might be converted to an enhancement, if that wasn't treated as a signal that it can be ignored. We don't seem to have a clear category for "feature works but only the people who implemented it are likely to be able to use it correctly".

@aescolar
Copy link
Member

aescolar commented Dec 13, 2019

I do think this might be converted to an enhancement, if that wasn't treated as a signal that it can be ignored.

@pabigot I'd say this is an enhancement. But indeed how to motivate people to work on fixing/improving any area can be tricky. Something being an enhancement certainly does not mean it should be ignored.

@jhedberg jhedberg added Enhancement Changes/Updates/Additions to existing features and removed bug The issue is a bug, or the PR is fixing a bug labels Dec 17, 2019
@sslupsky
Copy link
Contributor

I'll jump in here and ask that this be given some attention soon. I've been debugging some driver issues with the i2c_sam0 driver and I would like to understand this topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Documentation Enhancement Changes/Updates/Additions to existing features priority: medium Medium impact/importance bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants