netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yanjun Zhu <yanjun.zhu@oracle.com>
To: root <root@shipfan.cn.oracle.com>,
	ariel.elior@cavium.com, everest-linux-l2@cavium.com,
	netdev@vger.kernel.org
Cc: Joe Jin <joe.jin@oracle.com>, Junxiao Bi <junxiao.bi@oracle.com>
Subject: Re: [PATCH 1/1] bnx2x: fix slowpath null crash
Date: Wed, 8 Nov 2017 10:12:48 +0800	[thread overview]
Message-ID: <5b09d7b8-a6d7-fe6d-c7ae-35a16a2e59d8@oracle.com> (raw)
In-Reply-To: <1510106327-17111-1-git-send-email-root@shipfan.cn.oracle.com>

Please ignore this mail.

Zhu Yanjun


On 2017/11/8 9:58, root wrote:
> From: Zhu Yanjun <yanjun.zhu@oracle.com>
>
> When "NETDEV WATCHDOG: em4 (bnx2x): transmit queue 2 timed out" occurs,
> BNX2X_SP_RTNL_TX_TIMEOUT is set. In the function bnx2x_sp_rtnl_task,
> bnx2x_nic_unload and bnx2x_nic_load are executed to shutdown and open
> NIC. In the function bnx2x_nic_load, bnx2x_alloc_mem allocates dma
> failure. The message "bnx2x: [bnx2x_alloc_mem:8399(em4)]Can't
> allocate memory" pops out. The variable slowpath is set to NULL.
> When shutdown the NIC, the function bnx2x_nic_unload is called. In
> the function bnx2x_nic_unload, the following functions are executed.
> bnx2x_chip_cleanup
>      bnx2x_set_storm_rx_mode
>          bnx2x_set_q_rx_mode
>              bnx2x_set_q_rx_mode
>                  bnx2x_config_rx_mode
>                      bnx2x_set_rx_mode_e2
> In the function bnx2x_set_rx_mode_e2, the variable slowpath is operated.
> Then the crash occurs.
> To fix this crash, the variable slowpath is checked. And in the function
> bnx2x_sp_rtnl_task, after dma memory allocation fails, another shutdown
> and open NIC is executed.
>
> CC: Joe Jin <joe.jin@oracle.com>
> CC: Junxiao Bi <junxiao.bi@oracle.com>
> Signed-off-by: Zhu Yanjun <yanjun.zhu@oracle.com>
> ---
>   drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 14 +++++++++++---
>   1 file changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
> index c12b4d3..5929324 100644
> --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
> +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
> @@ -9332,7 +9332,7 @@ void bnx2x_chip_cleanup(struct bnx2x *bp, int unload_mode, bool keep_link)
>   	/* Schedule the rx_mode command */
>   	if (test_bit(BNX2X_FILTER_RX_MODE_PENDING, &bp->sp_state))
>   		set_bit(BNX2X_FILTER_RX_MODE_SCHED, &bp->sp_state);
> -	else
> +	else if (!bp->slowpath)
>   		bnx2x_set_storm_rx_mode(bp);
>   
>   	/* Cleanup multicast configuration */
> @@ -10271,8 +10271,16 @@ static void bnx2x_sp_rtnl_task(struct work_struct *work)
>   		smp_mb();
>   
>   		bnx2x_nic_unload(bp, UNLOAD_NORMAL, true);
> -		bnx2x_nic_load(bp, LOAD_NORMAL);
> -
> +		/*When ret value shows failure of allocation failure,
> +		 *the nic is rebooted again. If open still fails, a error
> +		 *message to notify the user.
> +		 */
> +		if (bnx2x_nic_load(bp, LOAD_NORMAL) == -ENOMEM) {
> +			bnx2x_nic_unload(bp, UNLOAD_NORMAL, true);
> +			if (bnx2x_nic_load(bp, LOAD_NORMAL)) {
> +				BNX2X_ERR("Open the NIC fails again!\n");
> +			}
> +		}
>   		rtnl_unlock();
>   		return;
>   	}

       reply	other threads:[~2017-11-08  2:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1510106327-17111-1-git-send-email-root@shipfan.cn.oracle.com>
2017-11-08  2:12 ` Yanjun Zhu [this message]
2017-11-08  2:56 [PATCH 1/1] bnx2x: fix slowpath null crash Zhu Yanjun
     [not found] ` <CY1PR0701MB13374A62C11CABB1A930453090560@CY1PR0701MB1337.namprd07.prod.outlook.com>
2017-11-08  4:26   ` Yanjun Zhu
2017-11-11  3:28 ` 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=5b09d7b8-a6d7-fe6d-c7ae-35a16a2e59d8@oracle.com \
    --to=yanjun.zhu@oracle.com \
    --cc=ariel.elior@cavium.com \
    --cc=everest-linux-l2@cavium.com \
    --cc=joe.jin@oracle.com \
    --cc=junxiao.bi@oracle.com \
    --cc=netdev@vger.kernel.org \
    --cc=root@shipfan.cn.oracle.com \
    /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).