Skip to content

Commit e50792e

Browse files
authored
Merge pull request #640 from clingfei/master
lkl: irq: atomically drain pending IRQs
2 parents 91ecb83 + 17a1086 commit e50792e

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

arch/lkl/kernel/irq.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,11 @@ static unsigned long irq_index_status;
2727

2828
static inline unsigned long test_and_clear_irq_index_status(void)
2929
{
30-
if (!irq_index_status)
31-
return 0;
3230
return __sync_fetch_and_and(&irq_index_status, 0);
3331
}
3432

3533
static inline unsigned long test_and_clear_irq_status(int index)
3634
{
37-
if (!irq_status[index])
38-
return 0;
3935
return __sync_fetch_and_and(&irq_status[index], 0);
4036
}
4137

@@ -128,7 +124,11 @@ static inline void check_irq_status(int i, int unused)
128124

129125
void run_irqs(void)
130126
{
131-
for_each_bit(test_and_clear_irq_index_status(), check_irq_status, 0);
127+
unsigned long pending;
128+
129+
/* Drain IRQs published while earlier pending IRQs are being handled. */
130+
while ((pending = test_and_clear_irq_index_status()))
131+
for_each_bit(pending, check_irq_status, 0);
132132
}
133133

134134
int show_interrupts(struct seq_file *p, void *v)

0 commit comments

Comments
 (0)