Skip to content

fix(x86_64): send the EOI of a preemption IPI that finds no task - #798

Draft
atsushi421 wants to merge 1 commit into
mainfrom
fix/x86-preempt-ipi-eoi
Draft

atsushi421 wants to merge 1 commit into
mainfrom
fix/x86-preempt-ipi-eoi

Conversation

@atsushi421

Copy link
Copy Markdown
Contributor

Description

Without the perf feature, the x86_64 preemption handler returns before eoi() if the CPU runs no task. This PR moves eoi() before that check.

A preemption IPI finds no task if the task of the victim finishes before the IPI arrives. The IPI uses vector 255 with Fixed delivery, so the missing EOI leaves its in-service bit set. Then the local APIC blocks every later interrupt, because no vector has a higher priority class. The CPU gets no more wakeup IPIs or timer interrupts, and it can sleep forever.

The bug is older than #788. With #788, the EDF scheduler preempts even if the set of the woken task has an idle core. So preemption IPIs, and this race, become more frequent.

Related links

How was this PR tested?

  • scripts/ci.sh passes on my machine.

Notes for reviewers

Without the perf feature, the preemption handler returns before `eoi()`
if the CPU runs no task. A preemption IPI finds no task if the task of
the victim finishes before the IPI arrives. The IPI uses vector 255 with
Fixed delivery, so its in-service bit stays set. Then the local APIC
blocks every later interrupt, because no vector has a higher priority
class. The CPU gets no more wakeup IPIs or timer interrupts and can
sleep forever.

Now the handler calls `eoi()` before it checks the current task.

Signed-off-by: atsushi421 <atsushi.yano.2@tier4.jp>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant