[vortex-bug] Re: Polling mode race fixed
Bogdan Costescu
Bogdan.Costescu@IWR.Uni-Heidelberg.De
Thu, 14 Dec 2000 14:36:21 +0100 (CET)
On Fri, 15 Dec 2000, Andrew Morton wrote:
> Bogdan Costescu wrote:
> >
> > 3. a mechanism that prevents the Tx ring to be re-filled completely at any
> > time. The mechanism that Don introduced in his drivers where the Tx ring
> > is never completely full is good for this purpose; however, TX_QUEUE_LEN
> > must always be smaller (not equal) to TX_RING_SIZE in order for this
> > mechanism to function properly.
>
> Why is the introduction of TX_QUEUE_LEN a problem?
I don't quite understand the question. But the introduction is mandatory,
I need something to tell that the Tx ring is full before it is actually
filled. Because Don had this in his drivers (and so it was tested 8-)), I
just borrowed it, although for a different purpose.
Basically, if the check at the end of start_xmit() is changed from:
if (vp->cur_tx - vp->dirty_tx > TX_RING_SIZE - 1) to
if (vp->cur_tx - vp->dirty_tx > TX_RING_SIZE - 2) or
if (vp->cur_tx - vp->dirty_tx >= TX_RING_SIZE - 1)
that would be sufficient, preventing the complete re-filling of the
Tx ring.
> I don't understand why TX_QUEUE_LEN was introduced in the first
> place.
There is an older message from Don, where he gives some reasoning:
http://www.scyld.com/pipermail/vortex-bug/2000-May/000804.html
although, I think that he went past his intentions in the message. He was
talking about a "hysterezis", where the Tx ring would be freed in chunks -
more than 1 packet at a time. If the interrupt is only processing/freeing
one ring entry, this entry is not marked as free; after several ring
entries are processed, they are marked as free _all at once_; Don claims
that this gives better performance. This behaviour can be achieved by
modifying _only_ in ISR to check for (at the end of DownComplete branch):
if (vp->tx_full && (vp->cur_tx - dirty_tx < TX_QUEUE_LEN))
However, Don has also modified start_xmit() to check for TX_QUEUE_LEN,
which -I think- is something not related to the "hysterezis" (and the
reason for my "past his intentions" words above). This is the part that
actually fixes the poll race.
IOW, by using Don's ideea, I can protect against the race _and_ introduce
the "hysterezis" behaviour.
Sincerely,
Bogdan Costescu
IWR - Interdisziplinaeres Zentrum fuer Wissenschaftliches Rechnen
Universitaet Heidelberg, INF 368, D-69120 Heidelberg, GERMANY
Telephone: +49 6221 54 8869, Telefax: +49 6221 54 8868
E-mail: Bogdan.Costescu@IWR.Uni-Heidelberg.De