From patchwork Mon Oct 26 04:18:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 11855671 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,MIME_HEADER_CTYPE_ONLY,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,T_TVD_MIME_NO_HEADERS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CDE59C5517A for ; Mon, 26 Oct 2020 04:18:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 825342224A for ; Mon, 26 Oct 2020 04:18:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="F5k7xKi4" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1420947AbgJZESh (ORCPT ); Mon, 26 Oct 2020 00:18:37 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:33421 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1419349AbgJZESf (ORCPT ); Mon, 26 Oct 2020 00:18:35 -0400 Received: by mail-pg1-f196.google.com with SMTP id l18so5398036pgg.0 for ; Sun, 25 Oct 2020 21:18:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=uleZ8n+JgcCHc/so3hz6bo8kpeWA7SBxQDQu0n8Nwc0=; b=F5k7xKi46sXA42eD+QkeDYwi4eyl5D3qBZ8tdMa8GikVsTlHGWxwtBhAmTtZgj+zPn NQMk9tNLeSuNaV1w1EzsIo4Iv1sMos4da/R6wdxF0pC7eMx9WOFJyWdZtfdEA9dLI0N2 hiyJkpE+hjrzNp2FSqCi6R1NKxxBCt2k8oIYE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=uleZ8n+JgcCHc/so3hz6bo8kpeWA7SBxQDQu0n8Nwc0=; b=fH1NWsOeOi+KcnIZb+8xfFjaLREvTQ9QZ+GISuUkAhG/GFU4aa1GO1CrurVJrJdQGx asUcV1GV6m47SkFCbWx9eeIsZOBtBb6PdZWpiV5VJvbARX4HcqRaupekdflnGIJv/hHx uSAeOg7hcQOTYerycHmo3Ifm97EdfGmX06gxRcslgPeM5p1qR8dAWOExPbvo22fSoQEk WgBb1tN8r1eYdZNic/6OrbFPa9vIXGV14lgLkeiV6TVMulJu3MiuGd61GezwD1t9P1AX fcATrV10jzY41zRq8VNcQFtfxUhktoP1I7Gqqduy1rUydzUCF+lnza3pWrtpvgCj02JS fY3A== X-Gm-Message-State: AOAM533QD68m7wTB2u/+U3RAcOpp73FWbIDOgPrTqvfe9v6XkhC4ag/v XvgPztY2RSsy/D41QHRuRV6kimNymnpjOA== X-Google-Smtp-Source: ABdhPJzwZDWhIWbIU6S4QVMka8wJnqDdokcDMWko8RgWF/pIpy49XMdbKh+/W75CkMgFdjGTcCLcGw== X-Received: by 2002:a63:f343:: with SMTP id t3mr11752446pgj.86.1603685913437; Sun, 25 Oct 2020 21:18:33 -0700 (PDT) Received: from localhost.swdvt.lab.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id 10sm11505835pjt.50.2020.10.25.21.18.32 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 25 Oct 2020 21:18:32 -0700 (PDT) From: Michael Chan To: kuba@kernel.org Cc: netdev@vger.kernel.org, gospo@broadcom.com, Vasundhara Volam Subject: [PATCH net 2/5] bnxt_en: Invoke cancel_delayed_work_sync() for PFs also. Date: Mon, 26 Oct 2020 00:18:18 -0400 Message-Id: <1603685901-17917-3-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1603685901-17917-1-git-send-email-michael.chan@broadcom.com> References: <1603685901-17917-1-git-send-email-michael.chan@broadcom.com> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Vasundhara Volam As part of the commit b148bb238c02 ("bnxt_en: Fix possible crash in bnxt_fw_reset_task()."), cancel_delayed_work_sync() is called only for VFs to fix a possible crash by cancelling any pending delayed work items. It was assumed by mistake that the flush_workqueue() call on the PF would flush delayed work items as well. As flush_workqueue() does not cancel the delayed workqueue, extend the fix for PFs. This fix will avoid the system crash, if there are any pending delayed work items in fw_reset_task() during driver's .remove() call. Unify the workqueue cleanup logic for both PF and VF by calling cancel_work_sync() and cancel_delayed_work_sync() directly in bnxt_remove_one(). Fixes: b148bb238c02 ("bnxt_en: Fix possible crash in bnxt_fw_reset_task().") Reviewed-by: Pavan Chebbi Reviewed-by: Andy Gospodarek Signed-off-by: Vasundhara Volam Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index e4e5ea080391..7be232018015 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -1160,16 +1160,6 @@ static void bnxt_queue_sp_work(struct bnxt *bp) schedule_work(&bp->sp_task); } -static void bnxt_cancel_sp_work(struct bnxt *bp) -{ - if (BNXT_PF(bp)) { - flush_workqueue(bnxt_pf_wq); - } else { - cancel_work_sync(&bp->sp_task); - cancel_delayed_work_sync(&bp->fw_reset_task); - } -} - static void bnxt_sched_reset(struct bnxt *bp, struct bnxt_rx_ring_info *rxr) { if (!rxr->bnapi->in_reset) { @@ -12114,7 +12104,8 @@ static void bnxt_remove_one(struct pci_dev *pdev) unregister_netdev(dev); clear_bit(BNXT_STATE_IN_FW_RESET, &bp->state); /* Flush any pending tasks */ - bnxt_cancel_sp_work(bp); + cancel_work_sync(&bp->sp_task); + cancel_delayed_work_sync(&bp->fw_reset_task); bp->sp_event = 0; bnxt_dl_fw_reporters_destroy(bp, true);