From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id DC263A0C4B; Fri, 19 Nov 2021 07:07:55 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 965E640143; Fri, 19 Nov 2021 07:07:55 +0100 (CET) Received: from mail-io1-f43.google.com (mail-io1-f43.google.com [209.85.166.43]) by mails.dpdk.org (Postfix) with ESMTP id C110340140 for ; Fri, 19 Nov 2021 07:07:54 +0100 (CET) Received: by mail-io1-f43.google.com with SMTP id 14so11408242ioe.2 for ; Thu, 18 Nov 2021 22:07:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=wGeY4Y71y0zvTtCkrAUjtFzairEWwOYNmwMs5SZnJqA=; b=W0iaFr67JlIy4hw8I7UtGVy3jYk7MmxVgXo2KDkuzswsl3xJM3dNUXhmf0RelIHs52 dJmvY1C7piGWN4HOp6qduBveVuzcJoskvz/nBPjHLFGrfPywrX+xgiPpu7wzRRT0C+ZE NIcD48M/AAYpmbqMXCgMeK6MZGfB2tMQxTa70= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=wGeY4Y71y0zvTtCkrAUjtFzairEWwOYNmwMs5SZnJqA=; b=R+QRceHng3GerNPljflkzpDmAtNlIb8/U7ZyaDrpDxzFrdR/MOGPA0stbas2HIokVq tHuVb6sY47M9AUSAfh8dPIlAAMSjnpibZf8CVEIyNzX2C5iMlnpEP+PBHqeXhrLjhvXt iEnF27y2RuAQBLD4jxzH1myVCOaVQIHM69LndEsmwfNipYPVKafObsB8Ig9kP6X7Cv/Z Z/qmlrOEj+YHzn30Tyh60XIMBxR1ILanhUVJm3WeoSh/0Tqg6y/v1G+cS8dtjYMdbFAb hIfVjT5NQCUqVckxXs3JwLjQnq3SqCH7v1eEqZHeKPScqK2lZHeSw+Rkp+889LmJ+PoQ Nvjw== X-Gm-Message-State: AOAM533lHjK+j6dyl4ZPzyAVU7TI5EUZoS8kPesr8KjLWU79c9Gwgz6F nnytc1uUCcg9TpVt1W/nzGNHySajaZKRlMd5iffmng== X-Google-Smtp-Source: ABdhPJzw7iE83icQChHbtRKffdHZGkONuvxRmPpPcmjjXKAeS3tQZ9j0gJiMBzQnFUkoOOkG3gfxBYO8CW+VuDLV3zM= X-Received: by 2002:a05:6638:160c:: with SMTP id x12mr25218478jas.60.1637302074011; Thu, 18 Nov 2021 22:07:54 -0800 (PST) MIME-Version: 1.0 References: <20211119035041.4493-1-somnath.kotur@broadcom.com> In-Reply-To: <20211119035041.4493-1-somnath.kotur@broadcom.com> From: Ajit Khaparde Date: Thu, 18 Nov 2021 22:07:38 -0800 Message-ID: Subject: Re: [PATCH] net/bnxt: fix crash caused by error recovery To: Somnath Kotur Cc: dpdk-dev , Ferruh Yigit Content-Type: text/plain; charset="UTF-8" X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Thu, Nov 18, 2021 at 7:57 PM Somnath Kotur wrote: > > bnxt_stop_rxtx() does not stop data path processing as intended > as it does not update the recently introduced fast-path pointers > '(struct rte_eth_fp_ops)->rx_pkt_burst'. Since both the burst routines > only use the fast-path pointer, the real burst routines get invoked > instead of the dummy ones set by bnxt_stop_rxtx() leading to crashes > in the data path (e.g. dereferencing freed structures) > > Fix the segfault by updating the fast-path pointer as well > > Fixes: c87d435a4d79 ("ethdev: copy fast-path API into separate structure") > > Signed-off-by: Somnath Kotur > Reviewed-by: Ajit Khaparde Patch applied to dpdk-next-net-brcm. > --- > drivers/net/bnxt/bnxt_cpr.c | 9 +++++++++ > drivers/net/bnxt/bnxt_ethdev.c | 7 ++++++- > 2 files changed, 15 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/bnxt/bnxt_cpr.c b/drivers/net/bnxt/bnxt_cpr.c > index 6bb70d516e..a43b22a8f8 100644 > --- a/drivers/net/bnxt/bnxt_cpr.c > +++ b/drivers/net/bnxt/bnxt_cpr.c > @@ -387,4 +387,13 @@ void bnxt_stop_rxtx(struct bnxt *bp) > { > bp->eth_dev->rx_pkt_burst = &bnxt_dummy_recv_pkts; > bp->eth_dev->tx_pkt_burst = &bnxt_dummy_xmit_pkts; > + > + rte_eth_fp_ops[bp->eth_dev->data->port_id].rx_pkt_burst = > + bp->eth_dev->rx_pkt_burst; > + rte_eth_fp_ops[bp->eth_dev->data->port_id].tx_pkt_burst = > + bp->eth_dev->tx_pkt_burst; > + rte_mb(); > + > + /* Allow time for threads to exit the real burst functions. */ > + rte_delay_ms(100); > } > diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c > index 4413b5d72e..c1bdf9a921 100644 > --- a/drivers/net/bnxt/bnxt_ethdev.c > +++ b/drivers/net/bnxt/bnxt_ethdev.c > @@ -4323,6 +4323,8 @@ static void bnxt_dev_recover(void *arg) > > /* Clear Error flag so that device re-init should happen */ > bp->flags &= ~BNXT_FLAG_FATAL_ERROR; > + PMD_DRV_LOG(INFO, "Port: %u Starting recovery...\n", > + bp->eth_dev->data->port_id); > > rc = bnxt_check_fw_ready(bp); > if (rc) > @@ -4347,7 +4349,8 @@ static void bnxt_dev_recover(void *arg) > if (rc) > goto err_start; > > - PMD_DRV_LOG(INFO, "Recovered from FW reset\n"); > + PMD_DRV_LOG(INFO, "Port: %u Recovered from FW reset\n", > + bp->eth_dev->data->port_id); > pthread_mutex_unlock(&bp->err_recovery_lock); > > return; > @@ -4372,6 +4375,8 @@ void bnxt_dev_reset_and_resume(void *arg) > int rc; > > bnxt_dev_cleanup(bp); > + PMD_DRV_LOG(INFO, "Port: %u Finished bnxt_dev_cleanup\n", > + bp->eth_dev->data->port_id); > > bnxt_wait_for_device_shutdown(bp); > > -- > 2.28.0.497.g54e85e7 >