netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: haokexin@gmail.com
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH net-next] net: fec: fix the race between xmit and bdp reclaiming path
Date: Mon, 10 Aug 2015 13:28:35 -0700 (PDT)	[thread overview]
Message-ID: <20150810.132835.492224591558177468.davem@davemloft.net> (raw)
In-Reply-To: <1438926757-24447-1-git-send-email-haokexin@gmail.com>

From: Kevin Hao <haokexin@gmail.com>
Date: Fri,  7 Aug 2015 13:52:37 +0800

> When we transmit a fragmented skb, we may run into a race like the
> following scenario (assume txq->cur_tx is next to txq->dirty_tx):
>            cpu 0                                          cpu 1
>   fec_enet_txq_submit_skb
>     reserve a bdp for the first fragment
>     fec_enet_txq_submit_frag_skb
>        update the bdp for the other fragment
>        update txq->cur_tx
>                                                    fec_enet_tx_queue
>                                                      bdp = fec_enet_get_nextdesc(txq->dirty_tx, fep, queue_id);
>                                                      This bdp is the bdp reserved for the first segment. Given
>                                                      that this bdp BD_ENET_TX_READY bit is not set and txq->cur_tx
>                                                      is already pointed to a bdp beyond this one. We think this is a
>                                                      completed bdp and try to reclaim it.
>     update the bdp for the first segment
>     update txq->cur_tx
> 
> So we shouldn't update the txq->cur_tx until all the update to the
> bdps used for fragments are performed. Also add the corresponding
> memory barrier to guarantee that the update to the bdps, dirty_tx and
> cur_tx performed in the proper order.
> 
> Signed-off-by: Kevin Hao <haokexin@gmail.com>

Applied, thanks.

      reply	other threads:[~2015-08-10 20:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-07  5:52 [PATCH net-next] net: fec: fix the race between xmit and bdp reclaiming path Kevin Hao
2015-08-10 20:28 ` David Miller [this message]

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=20150810.132835.492224591558177468.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=haokexin@gmail.com \
    --cc=netdev@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).