lkml.org 
[lkml]   [2004]   [Apr]   [3]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateSat, 03 Apr 2004 13:30:28 +0200
FromManfred Spraul <>
SubjectRe: [PATCH] Fix kernel lockup in RTL-8169 gigabit ethernet driver
Andrew wrote:

>The logic is faulty, or at least very odd.
>
>	tx_left = tp->cur_tx - dirty_tx;
>
>	while (tx_left > 0) {
>		int entry = dirty_tx % NUM_TX_DESC;
>
>		if (!(le32_to_cpu(tp->TxDescArray[entry].status) & OWNbit)) {
>			...
>		}
>	}
>
>Why is that `if' test there at all?  If it ever returns false, the box
>locks up.  A BUG_ON(le32_to_cpu(tp->TxDescArray[entry].status) & OWNbit)
>might make more sense.
> 
>
tx_left counts packets submitted by hard_xmit_start to the hardware. 
Initially OWNbit is set, the packet is owned by the nic. The OWNbit is 
cleared by the hardware after the packet was sent. A packet with OWNbit 
set means that the nic didn't send it yet to the wire. I think the "else 
break;" patch is correct, but someone with docs should confirm that.

Adam: did you see deadlocks that disappeared after applying your patch? 
It shouldn't deadlock - it should loop until the nic sends the packet to 
the wire. It might take a few msecs, but then it should continue. 
Perhaps gcc optimized away the reload from memory and loops on a 
register. Or there is another bug that is hidden by your patch.

--
    Manfred

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:02    [from the cache]
©2003-2008