Bug 237078 - generic_timer not handling interrupts properly
Summary: generic_timer not handling interrupts properly
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: arm (show other bugs)
Version: CURRENT
Hardware: arm Any
: --- Affects Some People
Assignee: Ian Lepore
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-04-07 19:08 UTC by Andrew "RhodiumToad" Gierth
Modified: 2019-06-09 20:51 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew "RhodiumToad" Gierth 2019-04-07 19:08:29 UTC
generic_timer.c installs interrupt handlers for up to four timer interrupts, causing those interrupts to be enabled on the local PIC. But the handler that it installs assumes that all interrupts come from a specific timer (either the physical one on 32bit or the virtual one on 64bit).

If an interrupt occurs on the other timer, then the interrupt is never masked or cleared, so a CPU is put into a permanent interrupt handling loop; this is commonly observed on RPI2 platforms at least.

The unexpected interrupt can occur because while the driver attach routine tries to mask off both the physical and virtual (on 32bit) interrupts, it does this on only one CPU, when in fact each CPU has its own timer.

I have tested a crude workaround (not installing handlers for the unused interrupts) which fixes the observed problems as far as I can determine.

This bug could potentially apply on 64bit as well, but I am not in a position to test that.
Comment 1 Ian Lepore freebsd_committer freebsd_triage 2019-04-10 00:23:14 UTC
I have posted https://reviews.freebsd.org/D19871 for review as a solution to this problem; it implements the suggested fix of not installing handlers for the unused timers).
Comment 2 Andrew "RhodiumToad" Gierth 2019-06-09 20:51:19 UTC
This was fixed in base r346312, MFC'd to stable/12 as base r346500, stable/11 as base r346561, but apparently nobody bothered to update the bug then or mention it in the commit message.