Skip to contentSkip to conversation

r8169 OOPSen in rtl_rx

DISCUSSION Peter Zijlstra 2 participants 6 messages Aug 13, 2013 – Sep 5, 2013

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

Hi r8169 people,

I've got an AMD x86_64 machine with two realtek NICs:

01:08.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-8169 Gigabit Ethernet (rev 10)
03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 06)

I currently run a 3.10.0.6 based kernel on the machine and frequently (several times a week) get OOPSen in the rtl_rx path. Now the horribly sad part is that this machine doesn't (currently) have a working serial line -- its got pins on the board but I need to go hunt for an expansion bracket for it :/

I recently added the RTL8111 (rev 6) card so that this machine could do firewall duties (it was a general server using the RTL-8169 for a long time before that and always ran without problems).

I have tried netconsole, but that's not working, which leads me to believe its the inward-facing NIC that's buggered -- which would be the RTL-8169 (rev 10) -- pure speculation though, it could just crash hard enough for nothing to really work anymore.

The video-card also doesn't support 80x50/60 text modes and KMS/framebuffer also didn't work (as in, I get graphics based text at high res but OOPSen don't actually make it to the screen).

So all I've got to offer currently is a partial backtrace -- see attached image. Partial transcribe:

? rtl8169_try_rx_copy.isra.77
rtl_rx
rtl8169_poll
net_rx_action
? get_vtime_delta
__do_softirq
irq_exit
do_IRQ
common_interrupt
? native_safe_halt
? rcu_eqs_enter_common.isra.48
default_idle
amd_e400_idle
arch_cpu_idle
cpu_idle_loop
...

I did look at the r8169 log between 3.10 and current head and there wasn't anything obviously related to RX crashes so I haven't upgraded to 3.11-rc; if you think I should try please say so.

I'm also willing to try patches -- although as said, reproduction can take a few days -- although sometimes I'm 'lucky' and it crashes multiple times a day :/

~ Peter

#1 lore raw

Peter Zijlstra <[email protected]> :
[...]

Quoted 4 lines

I've got an AMD x86_64 machine with two realtek NICs:

01:08.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-8169 Gigabit Ethernet (rev 10)
03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 06)

Which XID (see kernel dmesg) ?

[...]

Quoted 2 lines

So all I've got to offer currently is a partial backtrace -- see attached image.

(no attachment)

Quoted 3 lines

Partial transcribe:

? rtl8169_try_rx_copy.isra.77

/me scratches head.

You may check that pkt_size is > 0, <= ETH_FRAME_LEN (no jumbo ?) and see if it helps.

Signature · 1 line
Ueimor
#2 lore raw
Quoted 8 lines · Francois Romieu

Peter Zijlstra <[email protected]> :
[...]

Quoted 4 lines

I've got an AMD x86_64 machine with two realtek NICs:

01:08.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-8169 Gigabit Ethernet (rev 10)
03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 06)

Which XID (see kernel dmesg) ?

$ dmesg | grep -i xid
[    1.706427] r8169 0000:01:08.0 eth0: RTL8110s at 0xffffc9000063ac00, 00:0e:2e:87:8b:70, XID 04000000 IRQ 18
[    1.717012] r8169 0000:03:00.0 eth1: RTL8168e/8111e at 0xffffc90000646000, a0:f3:c1:00:74:a3, XID 0c200000 IRQ 43
Quoted 4 lines
Quoted 2 lines

So all I've got to offer currently is a partial backtrace -- see attached image.

(no attachment)

Oh, duh..

Quoted 8 lines
Quoted 3 lines

Partial transcribe:

? rtl8169_try_rx_copy.isra.77

/me scratches head.

You may check that pkt_size is > 0, <= ETH_FRAME_LEN (no jumbo ?) and see if it helps.

So eth0 runs at 1000Mb/s but has a MTU:1500, eth1 runs at 100Mb/s also MTU:1500.

I'll try a kernel with the below. Hopefully the change in dumpstack_64.c will avoid printing the 'process' stack and give a little more useful information.

Will let you know.

Thanks

---
 arch/x86/kernel/dumpstack_64.c       | 7 ++++---
 drivers/net/ethernet/realtek/r8169.c | 2 ++
 2 files changed, 6 insertions(+), 3 deletions(-)
arch/x86/kernel/dumpstack_64.c +4 -3
index addb207..f76e98f 100644
@@ -182,7 +182,7 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs,
 				stack = (unsigned long *) (irq_stack_end[-1]);
 				irq_stack_end = NULL;
 				ops->stack(data, "EOI");
-				continue;
+				goto out;
 			}
 		}
 		break;
@@ -192,6 +192,7 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs,
 	 * This handles the process stack:
 	 */
 	bp = ops->walk_stack(tinfo, stack, bp, ops, data, NULL, &graph);
+out:
 	put_cpu();
 }
 EXPORT_SYMBOL(dump_trace);
@@ -231,8 +232,8 @@ show_stack_log_lvl(struct task_struct *task, struct pt_regs *regs,
 				pr_cont(" <EOI> ");
 			}
 		} else {
-		if (((long) stack & (THREAD_SIZE-1)) == 0)
-			break;
+			if (((long) stack & (THREAD_SIZE-1)) == 0)
+				break;
 		}
 		if (i && ((i % STACKSLOTS_PER_LINE) == 0))
 			pr_cont("\n");
drivers/net/ethernet/realtek/r8169.c +2 -0
index 393f961..76d1c18 100644
@@ -6185,6 +6185,8 @@ static int rtl_rx(struct net_device *dev, struct rtl8169_private *tp, u32 budget
 			else
 				pkt_size = status & 0x00003fff;
 
+			WARN_ON(!(pkt_size > 0 && pkt_size <= ETH_FRAME_LEN));
+
 			/*
 			 * The driver does not support incoming fragmented
 			 * frames. They are seen as a symptom of over-mtu
#3 lore raw

drivers/net/ethernet/realtek/r8169.c static int rtl_rx(struct net_device *dev, struct rtl8169_private *tp, u32 budget · line 6192

Quoted 13 lines · Peter Zijlstra
drivers/net/ethernet/realtek/r8169.c +2 -0
index 393f961..76d1c18 100644
@@ -6185,6 +6185,8 @@ static int rtl_rx(struct net_device *dev, struct rtl8169_private *tp, u32 budget
 			else
 				pkt_size = status & 0x00003fff;
 
+			WARN_ON(!(pkt_size > 0 && pkt_size <= ETH_FRAME_LEN));
+
 			/*
 			 * The driver does not support incoming fragmented
 			 * frames. They are seen as a symptom of over-mtu

OK, I changed that to:

drivers/net/ethernet/realtek/r8169.c +6 -0
index 393f961..81e0bf4 100644
@@ -6185,6 +6185,12 @@ static int rtl_rx(struct net_device *dev, struct rtl8169_private *tp, u32 budget
 			else
 				pkt_size = status & 0x00003fff;
 
+			if (!(pkt_size > 0 && pkt_size <= ETH_FRAME_LEN)) {
+				dev->stats.rx_dropped++;
+				printk("%s Funny sized packet: %d\n", dev->name, pkt_size);
+				goto release_descriptor;
+			}
+
 			/*
 			 * The driver does not support incoming fragmented
 			 * frames. They are seen as a symptom of over-mtu
#4 lore raw
Quoted 7 lines · Peter Zijlstra
drivers/net/ethernet/realtek/r8169.c +0 -0
index 393f961..81e0bf4 100644
@@ -6185,6 +6185,12 @@ static int rtl_rx(struct net_device *dev, struct rtl8169_private *tp, u32 budget
 			else
 				pkt_size = status & 0x00003fff;

drivers/net/ethernet/realtek/r8169.c static int rtl_rx(struct net_device *dev, struct rtl8169_private *tp, u32 budget · line 6196

Quoted 10 lines
drivers/net/ethernet/realtek/r8169.c +6 -0
 
+			if (!(pkt_size > 0 && pkt_size <= ETH_FRAME_LEN)) {
+				dev->stats.rx_dropped++;
+				printk("%s Funny sized packet: %d\n", dev->name, pkt_size);
+				goto release_descriptor;
+			}
+
 			/*
 			 * The driver does not support incoming fragmented
 			 * frames. They are seen as a symptom of over-mtu

Yay, it triggered..

$ dmesg | awk '/Funny sized packet/ { t[$6]++ } END { for (i in t) {
printf "%d %d\n", t[i], i; } }' | sort -n
1 4237
1 4983
1 5811
1 6062
1 6594
2 10709
2 12073
2 9197
4 14624
4 14870
266 16364

dev->name is always the same and the internal NIC (eth0, RTL8110s).

When it happens the NIC stops working as every packet is mal-sized, however an ifconfig down; ifconfig up will restore it to working order.

It appears to happen when I saturate my outside link such that all packets are fwd to the internal network -- I've got a 30Mbit/s down link which isn't all that much given its a GBE capable card.

When I try and saturate the internal nic, with traffic from the firewall to an internal machine we reach GBE speeds but nothing falls over.

#5 lore raw

Peter Zijlstra <[email protected]> :
[...]

Quoted 1 line

Yay, it triggered..

Bingo.

Can you display the whole descriptor entry (opts1 and opts2) and its index (cur_rx) when abnormal packets are detected ?
We can always check the packet size but I'd welcome some more specific pattern in the remaining bits of the descriptor.

Btw, you may try to revert aee77e4accbeb2c86b1d294cd84fec4a12dde3bd ("r8169: use unlimited DMA burst for TX") and see if it changes the Rx / Tx balance. It would only be a bandaid though.

Signature · 1 line
Ueimor