netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: xiaojiangfeng@huawei.com
Cc: yisen.zhuang@huawei.com, salil.mehta@huawei.com,
	zhangfei.gao@linaro.org, arnd@arndb.de, dingtianhong@huawei.com,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	jakub.kicinski@netronome.com, leeyou.li@huawei.com,
	nixiaoming@huawei.com
Subject: Re: [PATCH v4] net: hisilicon: Fix a BUG trigered by wrong bytes_compl
Date: Fri, 20 Dec 2019 21:15:43 -0800 (PST)	[thread overview]
Message-ID: <20191220.211543.940622133336540668.davem@davemloft.net> (raw)
In-Reply-To: <1576721287-68102-1-git-send-email-xiaojiangfeng@huawei.com>

From: Jiangfeng Xiao <xiaojiangfeng@huawei.com>
Date: Thu, 19 Dec 2019 10:08:07 +0800

> When doing stress test, we get the following trace:
 ...
> Pre-modification code:
> int hip04_mac_start_xmit(struct sk_buff *skb, struct net_device *ndev)
> {
> [...]
> [1]	priv->tx_head = TX_NEXT(tx_head);
> [2]	count++;
> [3]	netdev_sent_queue(ndev, skb->len);
> [...]
> }
> An rx interrupt occurs if hip04_mac_start_xmit just executes to the line 2,
> tx_head has been updated, but corresponding 'skb->len' has not been
> added to dql_queue.
> 
> And then
> hip04_mac_interrupt->__napi_schedule->hip04_rx_poll->hip04_tx_reclaim
> 
> In hip04_tx_reclaim, because tx_head has been updated,
> bytes_compl will plus an additional "skb-> len"
> which has not been added to dql_queue. And then
> trigger the BUG_ON(bytes_compl > num_queued - dql->num_completed).
> 
> To solve the problem described above, we put
> "netdev_sent_queue(ndev, skb->len);"
> before
> "priv->tx_head = TX_NEXT(tx_head);"
> 
> Fixes: a41ea46a9a12 ("net: hisilicon: new hip04 ethernet driver")
> Signed-off-by: Jiangfeng Xiao <xiaojiangfeng@huawei.com>

Applied, thanks.

      reply	other threads:[~2019-12-21  5:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-19  2:08 [PATCH v4] net: hisilicon: Fix a BUG trigered by wrong bytes_compl Jiangfeng Xiao
2019-12-21  5:15 ` 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=20191220.211543.940622133336540668.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=arnd@arndb.de \
    --cc=dingtianhong@huawei.com \
    --cc=jakub.kicinski@netronome.com \
    --cc=leeyou.li@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nixiaoming@huawei.com \
    --cc=salil.mehta@huawei.com \
    --cc=xiaojiangfeng@huawei.com \
    --cc=yisen.zhuang@huawei.com \
    --cc=zhangfei.gao@linaro.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).