Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp481509imn; Wed, 27 Jul 2022 11:24:52 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sWhYmkvb9e/96shuScaQIPafG9goGzV6aHPcilaTI+A/EtyvikrhPCzmCzFReSIUC7OPLP X-Received: by 2002:a05:6a00:230a:b0:52a:d0e8:c936 with SMTP id h10-20020a056a00230a00b0052ad0e8c936mr23533181pfh.67.1658946291786; Wed, 27 Jul 2022 11:24:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658946291; cv=none; d=google.com; s=arc-20160816; b=rCCiFMzUkDftVjENO6M/4zReoOBiRTWmtVLYGd/C2EN0QiTF/UDlHxpWDsvUPm/qYZ fIGBj4eE/D2eipCYgNgKSGiq/n3MIF/ZqRare+xK1gEFj6mUKqVkD3Wk3JGIv9IHLhSY PQvSsKomBfhYPHHK/tp7YHS8Yj5HBpSgcK7F+WGltohRSMhPilUcihT5M27EBE4t3e1W aoglovkrc8fSRD8v1wGvU/NeaE0E70gVANiAHKdJaOBXmtZxSzSLH9gimxfbkLSo5/BD 1TnzHjehGZBM1LWhh2lgSR/iLY/hr5z8ieQM+f86nrfVR/eKR56XddbjM7hcoGRPpkpN 1Hpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=M3LUUfEslOEEgY5Cky1PazLuftt/wVfTjGWOXgsG2+Q=; b=gUMuIeEF6vMiWS3ke2ahNzb+UXBb4us9DEXicYu+r/EbA9M0DhPbQn31yCsk3FrJ+u XPr2008uOB64CYl0f0+CynMs8sIVwmSKz1x5J8bVr7Q58Rg+5zeSXHVKvSEnrsjpO3rO kidzqCkqlickwVwBtzi08HqNbbVwyh3j9S6c+9LsMZLEsmLL9N93/4A8JrmpLs4YJBc0 jsRlq/ue7BXyfmQNV83plL6cOcGQuI3qt+iGaQEnCLUMAc3dg9fqw5mEzTmZ1G+1wLHJ j5Ev0zUvxB17JPB9jKu6FYQEO/RoUzSxmTsKwHv0RfeNUuEqWoaGMGmLTqmfU6Ga/2C+ l0XQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FRFIJ0xR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w70-20020a638249000000b0041b2f36475esi4647587pgd.335.2022.07.27.11.24.36; Wed, 27 Jul 2022 11:24:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FRFIJ0xR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239246AbiG0QlC (ORCPT + 99 others); Wed, 27 Jul 2022 12:41:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239363AbiG0Qkb (ORCPT ); Wed, 27 Jul 2022 12:40:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C008B501AE; Wed, 27 Jul 2022 09:29:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6B231619FF; Wed, 27 Jul 2022 16:29:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 76CC8C433D6; Wed, 27 Jul 2022 16:29:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658939355; bh=5AXRbgbAlR8mXXL/6o4SYWYsIuY2c56h7/LdvuOFNFA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FRFIJ0xRGjKEdeez5M6Ut4I68erQeNNE0GHyA57vVMUg4pNsAUTkViAkykylNZChj VtN+V7lY7oRp0dxv2uHGu7E8sLIBziYW10vgtNfIM/LR5af9JcPAVJQraMjQcCKer7 gCXR3JvC/0w4mu3+Ws1RntDLHBZoivU4NBdHojxM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dawid Lukwinski , Jan Sokolowski , Konrad Jankowski , Tony Nguyen , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.4 40/87] i40e: Fix erroneous adapter reinitialization during recovery process Date: Wed, 27 Jul 2022 18:10:33 +0200 Message-Id: <20220727161010.669552423@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220727161008.993711844@linuxfoundation.org> References: <20220727161008.993711844@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dawid Lukwinski [ Upstream commit f838a63369818faadec4ad1736cfbd20ab5da00e ] Fix an issue when driver incorrectly detects state of recovery process and erroneously reinitializes interrupts, which results in a kernel error and call trace message. The issue was caused by a combination of two factors: 1. Assuming the EMP reset issued after completing firmware recovery means the whole recovery process is complete. 2. Erroneous reinitialization of interrupt vector after detecting the above mentioned EMP reset. Fixes (1) by changing how recovery state change is detected and (2) by adjusting the conditional expression to ensure using proper interrupt reinitialization method, depending on the situation. Fixes: 4ff0ee1af016 ("i40e: Introduce recovery mode support") Signed-off-by: Dawid Lukwinski Signed-off-by: Jan Sokolowski Tested-by: Konrad Jankowski Signed-off-by: Tony Nguyen Link: https://lore.kernel.org/r/20220715214542.2968762-1-anthony.l.nguyen@intel.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/ethernet/intel/i40e/i40e_main.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c index 05442bbc218c..0610d344fdbf 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c @@ -10068,7 +10068,7 @@ static int i40e_reset(struct i40e_pf *pf) **/ static void i40e_rebuild(struct i40e_pf *pf, bool reinit, bool lock_acquired) { - int old_recovery_mode_bit = test_bit(__I40E_RECOVERY_MODE, pf->state); + const bool is_recovery_mode_reported = i40e_check_recovery_mode(pf); struct i40e_vsi *vsi = pf->vsi[pf->lan_vsi]; struct i40e_hw *hw = &pf->hw; i40e_status ret; @@ -10076,13 +10076,11 @@ static void i40e_rebuild(struct i40e_pf *pf, bool reinit, bool lock_acquired) int v; if (test_bit(__I40E_EMP_RESET_INTR_RECEIVED, pf->state) && - i40e_check_recovery_mode(pf)) { + is_recovery_mode_reported) i40e_set_ethtool_ops(pf->vsi[pf->lan_vsi]->netdev); - } if (test_bit(__I40E_DOWN, pf->state) && - !test_bit(__I40E_RECOVERY_MODE, pf->state) && - !old_recovery_mode_bit) + !test_bit(__I40E_RECOVERY_MODE, pf->state)) goto clear_recovery; dev_dbg(&pf->pdev->dev, "Rebuilding internal switch\n"); @@ -10109,13 +10107,12 @@ static void i40e_rebuild(struct i40e_pf *pf, bool reinit, bool lock_acquired) * accordingly with regard to resources initialization * and deinitialization */ - if (test_bit(__I40E_RECOVERY_MODE, pf->state) || - old_recovery_mode_bit) { + if (test_bit(__I40E_RECOVERY_MODE, pf->state)) { if (i40e_get_capabilities(pf, i40e_aqc_opc_list_func_capabilities)) goto end_unlock; - if (test_bit(__I40E_RECOVERY_MODE, pf->state)) { + if (is_recovery_mode_reported) { /* we're staying in recovery mode so we'll reinitialize * misc vector here */ -- 2.35.1