r8169: improve spurious interrupt detection
Heiner Kallweit
maintainerImprove detection of spurious interrupts by checking against the interrupt mask as currently set in the chip.
--- drivers/net/ethernet/realtek/r8169.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/realtek/r8169.c +2 -1
@@ -6405,8 +6405,9 @@ static irqreturn_t rtl8169_interrupt(int irq, void *dev_instance) {struct rtl8169_private *tp = dev_instance;u16 status =rtl_get_events (tp); +u16 irq_mask =RTL_R16 (tp, IntrMask); -if (status ==0xffff || !(status & tp->irq_mask)) +if (status ==0xffff || !(status & irq_mask))return IRQ_NONE ;if (unlikely (status & SYSErr)) {
Signature · 1 line
2.20.0
David Miller
maintainerFrom: Heiner Kallweit <[email protected]>
Date: Sat, 15 Dec 2018 16:24:02 +0100
drivers/net/ethernet/realtek/r8169.c static irqreturn_t rtl8169_interrupt(int irq, void *dev_instance) · line 6411
Quoted 9 lines
drivers/net/ethernet/realtek/r8169.c +2
-1@@ -6405,8 +6405,9 @@ static irqreturn_t rtl8169_interrupt(int irq, void *dev_instance) {struct rtl8169_private *tp = dev_instance;u16 status =rtl_get_events (tp); +u16 irq_mask =RTL_R16 (tp, IntrMask); -if (status ==0xffff || !(status & tp->irq_mask)) +if (status ==0xffff || !(status & irq_mask))return IRQ_NONE ;
Heiner, this is really expensive. Why is the tp->irq_mask value out of sync with the value programmed into IntrMask? Is there some way we can fix that instead?
Heiner Kallweit
maintainerQuoted 9 lines · David Miller
From: Heiner Kallweit <[email protected]>
Date: Sat, 15 Dec 2018 16:24:02 +0100Quoted 6 lines
drivers/net/ethernet/realtek/r8169.c +1
-0@@ -6405,8 +6405,9 @@ static irqreturn_t rtl8169_interrupt(int irq, void *dev_instance) {struct rtl8169_private *tp = dev_instance;u16 status =rtl_get_events (tp); +u16 irq_mask =RTL_R16 (tp, IntrMask);
Quoted 8 lines
drivers/net/ethernet/realtek/r8169.c static irqreturn_t rtl8169_interrupt(int irq, void *dev_instance) · line 6411
Quoted 3 lines
drivers/net/ethernet/realtek/r8169.c +1
-1-if (status ==0xffff || !(status & tp->irq_mask)) +if (status ==0xffff || !(status & irq_mask))return IRQ_NONE ;Heiner, this is really expensive. Why is the
tp->irq_maskvalue out of sync with the value programmed into IntrMask? Is there some way we can fix that instead?
tp->irq_mask holds the chip-specific interrupt mask. It doesn't say whether interrupts are enabled or not. rtl_get_events() reads via PCI(e) anyway, so I was under the impression that one more PCI(e) read doesn't really matter.
We could introduce a flag shadowing the "interrupts are enabled" state and use it here. But I'm not sure whether it's worth it. Alternatively we could also go with the readw_relaxed() version to get the values, this would eliminate the memory barrier at least.
David Miller
maintainerFrom: Heiner Kallweit <[email protected]>
Date: Sat, 15 Dec 2018 19:44:35 +0100
Quoted 8 lines
tp->irq_maskholds the chip-specific interrupt mask. It doesn't say whether interrupts are enabled or not.rtl_get_events()reads via PCI(e) anyway, so I was under the impression that one more PCI(e) read doesn't really matter.
We could introduce a flag shadowing the "interrupts are enabled" state and use it here. But I'm not sure whether it's worth it. Alternatively we could also go with thereadw_relaxed()version to get the values, this would eliminate the memory barrier at least.
Thank for explaining, I thought ->irq_mask shadows IntrMask.
I see what you are saying about rtl8169_irq_mask_and_ack() so maybe adding one more PCIe read won't matter.
I think I'll apply this as-is, this was supposed to be net-next and that's why you reposted it with a corrected Subject correct?
Heiner Kallweit
maintainerQuoted 12 lines · David Miller
From: Heiner Kallweit <[email protected]>
Date: Sat, 15 Dec 2018 19:44:35 +0100Quoted 8 lines
tp->irq_maskholds the chip-specific interrupt mask. It doesn't say whether interrupts are enabled or not.rtl_get_events()reads via PCI(e) anyway, so I was under the impression that one more PCI(e) read doesn't really matter.
We could introduce a flag shadowing the "interrupts are enabled" state and use it here. But I'm not sure whether it's worth it. Alternatively we could also go with thereadw_relaxed()version to get the values, this would eliminate the memory barrier at least.
Quoted 8 lines
Thank for explaining, I thought ->irq_mask shadows IntrMask.
I see what you are saying about
rtl8169_irq_mask_and_ack()so maybe adding one more PCIe read won't matter.I think I'll apply this as-is, this was supposed to be net-next and that's why you reposted it with a corrected Subject correct?
Right, I missed to state net vs. net-next.