Skip to content

Commit

Permalink
xtensa: add fairness to IRQ handling
Browse files Browse the repository at this point in the history
Track which IRQs have been served at each level to make sure that no IRQ
is served more than once while other IRQs at the same level are pending.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
  • Loading branch information
Max Filippov committed Aug 11, 2021
1 parent ed5aacc commit 43ba223
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions arch/xtensa/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ void do_interrupt(struct pt_regs *regs)
XCHAL_INTLEVEL7_MASK,
};
struct pt_regs *old_regs;
unsigned unhandled = ~0u;

trace_hardirqs_off();

Expand All @@ -283,13 +284,19 @@ void do_interrupt(struct pt_regs *regs)
for (level = LOCKLEVEL; level > 0; --level) {
if (int_at_level & int_level_mask[level]) {
int_at_level &= int_level_mask[level];
if (int_at_level & unhandled)
int_at_level &= unhandled;
else
unhandled |= int_level_mask[level];
break;
}
}

if (level == 0)
break;

/* clear lowest pending irq in the unhandled mask */
unhandled ^= (int_at_level & -int_at_level);
do_IRQ(__ffs(int_at_level), regs);
}

Expand Down

0 comments on commit 43ba223

Please sign in to comment.