netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Michael Chan" <mchan@broadcom.com>
To: "David Laight" <David.Laight@ACULAB.COM>
Cc: "Nithin Nayak Sujir" <nsujir@broadcom.com>,
	"Eric Dumazet" <eric.dumazet@gmail.com>,
	davem@davemloft.net, netdev@vger.kernel.org,
	stable@vger.kernel.org
Subject: RE: [PATCH v2 net 2/2] tg3: Fix data corruption on 5725 with TSO
Date: Tue, 14 May 2013 09:19:05 -0700	[thread overview]
Message-ID: <1368548345.12268.76.camel@LTIRV-MCHAN1.corp.ad.broadcom.com> (raw)
In-Reply-To: <AE90C24D6B3A694183C094C60CF0A2F6026B7237@saturn3.aculab.com>

On Tue, 2013-05-14 at 16:20 +0100, David Laight wrote: 
> > On Tue, 2013-05-14 at 09:40 +0100, David Laight wrote:
> > > > >>>> +        if (tg3_asic_rev(tp) == ASIC_REV_5762 && mss) {
> > > > >>>> +                u32 base = (u32) mapping & 0xffffffff;
> > > > >>>> +
> > > > >>>> +                return ((base + len + (mss & 0x3fff)) < base);
> > > ...
> > > > For the bug to occur, the fragment does not have to span a 4G boundary. If it is
> > > > within MSS bytes (9.6k) of a 4G boundary, it triggers the failure.
> > >
> > > Would it be worth simplifying the test to assume that 'len'
> > > is 64k and 'mss' 9.6k?
> > > (commenting on the actual condition.)
> > > The number of false positives would be small, but the test
> > > a lot quicker.
> > > The '(u32)mapping + (0x10000 + 9600) < (u32)mapping' test might
> > > even be faster than the ' tg3_asic_rev(tp) == ASIC_REV_5762' one.
> > 
> > I think that if we do this and detect a false positive, it may be very
> > far from the 4G boundary.
> 
> It can't be very far away, approx 1 in 65k checks would fail.
> You could do the finer test afterwards.

If we do a 2nd level test, it will be ok.  But I'm not sure if it is
worth the complexity.

> 
> > The new skb that we allocate to workaround the condition may be
> > even closer to 4G and may hit the real bug condition.
> 
> If the 'fix' is to relocate the skb you are doomed to lose regardless
> of the check - unless you are willing to reallocate a lot of times,
> and without freeing the old skb.
> I'd assumed the 'fix' was to disable the relevant offload.

We relocate once and then drop the packet if we encounter additional
errors, including OOM, DMA mapping error, 4G boundary, etc.  The new
linear skb should not hit the 4G boundary again.  The room between the
end of this current buffer and 4G isn't big enough for the new linear
skb.

> 
> > The mss and len values are accessed many times in this immediate code
> > path just before setting the TX BD, gcc should be able to optimize this
> > quite nicely.
> 
> I was looking at the number of branches in the hot path, not whether
> the values were already in registers.
> 

Isn't the number of branches the same whether we use actual values in
registers or fixed values?

  reply	other threads:[~2013-05-14 16:19 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-13 21:04 [PATCH v2 net 0/2] tg3: 2 bugfixes - TSO data corruption and phy power down Nithin Nayak Sujir
2013-05-13 21:04 ` [PATCH v2 net 1/2] tg3: Skip powering down function 0 on certain serdes devices Nithin Nayak Sujir
2013-05-14 18:08   ` Joe Perches
2013-05-14 18:17     ` Nithin Nayak Sujir
2013-05-13 21:04 ` [PATCH v2 net 2/2] tg3: Fix data corruption on 5725 with TSO Nithin Nayak Sujir
2013-05-13 21:14   ` Eric Dumazet
2013-05-13 21:34     ` Nithin Nayak Sujir
2013-05-13 21:40       ` Eric Dumazet
2013-05-13 21:47         ` Nithin Nayak Sujir
2013-05-13 22:10           ` Eric Dumazet
2013-05-14  8:40           ` David Laight
2013-05-14 15:04             ` Michael Chan
2013-05-14 15:20               ` David Laight
2013-05-14 16:19                 ` Michael Chan [this message]
2013-05-14 16:46                   ` Eric Dumazet
2013-05-15  8:56                   ` David Laight
2013-05-15 15:12                     ` Michael Chan
2013-05-15 15:23                       ` Eric Dumazet
2013-05-15 15:51                         ` Michael Chan
2013-05-14 18:32 ` [PATCH v2 net 0/2] tg3: 2 bugfixes - TSO data corruption and phy power down David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1368548345.12268.76.camel@LTIRV-MCHAN1.corp.ad.broadcom.com \
    --to=mchan@broadcom.com \
    --cc=David.Laight@ACULAB.COM \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=nsujir@broadcom.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).