Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp497998imn; Wed, 27 Jul 2022 11:54:09 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sdU8XcNt849o41TopfQRyF4du+TtYXlIbxFL911Vi/7VgCia6Y+jjxZrdlnRNkhy5C7IqP X-Received: by 2002:a17:907:6092:b0:72f:575:722d with SMTP id ht18-20020a170907609200b0072f0575722dmr19436579ejc.19.1658948048952; Wed, 27 Jul 2022 11:54:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658948048; cv=none; d=google.com; s=arc-20160816; b=G9ImnYqmhh8eBaThvzjY5rdq+CXSELUlnV8BkqPwHOPfl6BmaWUC0IaCREZm/hiChF eUFKoXmrqwjrBuOlH3CNY2Y+l/ajlTgtBX6pRB22WyxMV/fI5Wvc1NEPP8A3roc0SWwA kBq/ZxER+pePUYebQhgmEEtgmdr9V5HzCGX+72R1Pe2WJsrVBr3rWKyrFy/5jJfR7tp9 fiTQPJ3gt1QWseUHb5jZtcnmc9xv4m9SKVm8bjyEWl0t5wbFyrEEWnrEsM/nF6W4sf/j eHpZsYT1Gw0RQcuJ+tJW1PErSaK/13RyUqXoF+VdHhUb4FO/61n8YMas4cXFxOmUhP4C sYDQ== 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=dTmk4xRn1X571lZmINkuDIFB/Gj3C/FFq+IDpDzJuRM=; b=c/fLRpQ2nzHXPq3JhLNtFdCbmm4N0HGYuGi9iCdxnXGj8uI4KgtPeQ8a9ycL9Frwe1 3XNImRwC5olj3FUsMMKCT/obJ7JillsG35gBxmvIYVSxg3RDcomDNI8F29pkL/c7eBv7 Gy5EaRPwO0bI/SjE3Ciy59GBOB4lzb2pMBrafCoUWPqYWOfyF+Foay1vVFil8uilT+km XXbXrKPCG06Y0fug/r5VthD0XnxJa290oIy59KVM7rwJjjbtOd2k4ZRe86vdIzUnp68i PuwjKOz7bXzPA21cwRQj231dChquolILgkt3pkJEOqa4B0deYzLVMNZHajb/7SxSYl5V SZdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=O4u16Nrh; 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 vh6-20020a170907d38600b0072f4b54937asi15790509ejc.182.2022.07.27.11.53.42; Wed, 27 Jul 2022 11:54:08 -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=O4u16Nrh; 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 S241704AbiG0RQ6 (ORCPT + 99 others); Wed, 27 Jul 2022 13:16:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241671AbiG0RQK (ORCPT ); Wed, 27 Jul 2022 13:16:10 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 158CE7858C; Wed, 27 Jul 2022 09:43:03 -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 ams.source.kernel.org (Postfix) with ESMTPS id 529AFB821D6; Wed, 27 Jul 2022 16:43:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A4256C433D7; Wed, 27 Jul 2022 16:42:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658940180; bh=VS7Kwf68vVLhN3/JM0Y6LtduQnkhHZwpCEeasFfSBQA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O4u16NrhH70Wmoc//44IrrAL1bGnEWuuccqKFX+SRD6gOD8i+s/g+OKQLO/bKHZSH T0xs2pwgJEb1YCV1cqSFBGzNeeqcx8cHs9evlgr/NrnQjObyDLxeOi3ZZ7BQTlKMTz PsAXkSR1nopGqfbFToRzBEMskONICtcD3AaQNXiU= 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.15 106/201] i40e: Fix erroneous adapter reinitialization during recovery process Date: Wed, 27 Jul 2022 18:10:10 +0200 Message-Id: <20220727161032.148382227@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220727161026.977588183@linuxfoundation.org> References: <20220727161026.977588183@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 02594e4d6258..c801b128e5b2 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c @@ -10631,7 +10631,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; @@ -10639,13 +10639,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"); @@ -10672,13 +10670,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