Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp3029287rdg; Tue, 17 Oct 2023 02:17:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHAkDVyX3adAQ1X+AA9MCcMy6Ktdb69UxYaHEntxhpVbgoBghHpfuZA80bj5jC2Hj/q519M X-Received: by 2002:a05:6a21:35c9:b0:17a:e2dd:ea39 with SMTP id ba9-20020a056a2135c900b0017ae2ddea39mr1291006pzc.5.1697534257903; Tue, 17 Oct 2023 02:17:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697534257; cv=none; d=google.com; s=arc-20160816; b=sprDrK6/P6HHjR2qiMtW1v3kLZdlc5ejdt+VmZwEutkkl1tIt3R8D/QXtwk+U8LAx9 R1biVfh4bkHOwcv6F2zTCTKQD0otTWl21IYLNeWg8e5LuO0rKZ02MCoyffz/NbizwviN R6h53Jpb1tP7doie2g0EbrUn/q+RW53gAFDRSyCQZxItakudhy2biRmvF7QHEVtSKb6e OhgwG1vHpDjRYvLm9ApNsf2ccAYENXw+VGZAI1q7O9HE/9duURuTXM3jhq7DotC5xfZO 92Qoop0Sj3Xj+ZoXafy+WDqSp3MQ7n84WQRJ/I0ARGDOEgiVPYPsXxj7k1BBm+TwTMPH RPsQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=thUF/zOkBAQOSeFXjiV9SsOqZHjLOOW8s+B8OrAUscE=; fh=Y2IfAqdjkYQAx7XZcGq/8JceY1atOOwfX771vvMvH7o=; b=Qq+c2oci2UJFu6Bv8TaQxbsbth5LkK+vje8WisJ8VszeLIAnhVTcFo9f1Bz4kUP6Kp awtr9huYnq6tZUiCveuPuIfPizccGs1DUGm6nj/sEmLT77D9YLsQx6FhM/Le28qIrACX hcsyLJMJTK/01wMuYUJD/MZiYYjI3FGmSrmCowWmJRWBO9W2XjPdWwtj1T+g2Y5Gdv56 rquuyFfNssqJqDU4rkYAj7PD03/ca7jv972isabDpJZRM34210fQhBai2hmo1kbIlsLT xVtmHwvNjmwzIb4mIMIQAVdlDPWbNsKSbam/J6oZzdWBW6qSV/pEDMnG+Ca5hWcdoBk+ E2Og== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=fTcaSiPi; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id w4-20020a170902d3c400b001c9dd045ef5si1265079plb.327.2023.10.17.02.17.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Oct 2023 02:17:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=fTcaSiPi; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 1F56A809FA39; Tue, 17 Oct 2023 02:17:33 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234847AbjJQJR1 (ORCPT + 52 others); Tue, 17 Oct 2023 05:17:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343503AbjJQJRY (ORCPT ); Tue, 17 Oct 2023 05:17:24 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8307FED for ; Tue, 17 Oct 2023 02:17:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697534240; x=1729070240; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=2dGltWDP7HxVRgN4zqIONzmCZKGYcbYGTbFFf0FN5/A=; b=fTcaSiPiaOOqTy0JuGFg5bK/rnZPEpGcVneFvejcI2n5c0sTHXRrga0O SWpQupFGW09VM+TowTFOqCoTymzs85SdAy4brFm4Cqkpp6oFNGsSVMWjF 09z6ihFnb4j1fxWaJzGfX7AcNhjOgLHvi45nUl5pGF5JAawRssyffrU4L KFQVOJ5NvEC/M8XGxYoRV7IUsoKUmkiOG9jrzXxZfOf7qQfvmlZxDx8zh v0CHc8kZIe23GTtOBCaLWJOgzK9tghu3gUPfAR8utmxKgc3osbNGRW58+ LNdm5FkGWliUXrR57Bhz669RUMWFDzdvg1SbXgEGudKMIaB6eMsNqckx+ A==; X-IronPort-AV: E=McAfee;i="6600,9927,10865"; a="370808551" X-IronPort-AV: E=Sophos;i="6.03,231,1694761200"; d="scan'208";a="370808551" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Oct 2023 02:17:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10865"; a="759731925" X-IronPort-AV: E=Sophos;i="6.03,231,1694761200"; d="scan'208";a="759731925" Received: from obarinsh-mobl1.ger.corp.intel.com (HELO ggreenma-mobl2.intel.com) ([10.214.213.101]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Oct 2023 02:17:18 -0700 From: gregory.greenman@intel.com To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Johannes Berg , Gregory Greenman Subject: [PATCH 08/14] wifi: iwlwifi: pcie: synchronize IRQs before NAPI Date: Tue, 17 Oct 2023 12:16:43 +0300 Message-Id: <20231017115047.a0f4104b479a.Id5c50a944f709092aa6256e32d8c63b2b8d8d3ac@changeid> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20231017091649.65090-1-gregory.greenman@intel.com> References: <20231017091649.65090-1-gregory.greenman@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Tue, 17 Oct 2023 02:17:33 -0700 (PDT) From: Johannes Berg When we want to synchronize the NAPI, which was added in commit 5af2bb3168db ("wifi: iwlwifi: call napi_synchronize() before freeing rx/tx queues"), we also need to make sure we can't actually reschedule the NAPI. Yes, this happens while interrupts are disabled, but interrupts may still be running or pending. Also call iwl_pcie_synchronize_irqs() to ensure we won't reschedule the NAPI. Fixes: 4cf2f5904d97 ("iwlwifi: queue: avoid memory leak in reset flow") Signed-off-by: Johannes Berg Signed-off-by: Gregory Greenman --- drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c | 1 + drivers/net/wireless/intel/iwlwifi/pcie/trans.c | 1 + 2 files changed, 2 insertions(+) diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c b/drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c index 085c4b49be87..c9e5bda8f0b7 100644 --- a/drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c +++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c @@ -161,6 +161,7 @@ void _iwl_trans_pcie_gen2_stop_device(struct iwl_trans *trans) if (test_and_clear_bit(STATUS_DEVICE_ENABLED, &trans->status)) { IWL_DEBUG_INFO(trans, "DEVICE_ENABLED bit was set and is now cleared\n"); + iwl_pcie_synchronize_irqs(trans); iwl_pcie_rx_napi_sync(trans); iwl_txq_gen2_tx_free(trans); iwl_pcie_rx_stop(trans); diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c index 385e152f04fe..a468e5efeecd 100644 --- a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c +++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c @@ -1264,6 +1264,7 @@ static void _iwl_trans_pcie_stop_device(struct iwl_trans *trans) if (test_and_clear_bit(STATUS_DEVICE_ENABLED, &trans->status)) { IWL_DEBUG_INFO(trans, "DEVICE_ENABLED bit was set and is now cleared\n"); + iwl_pcie_synchronize_irqs(trans); iwl_pcie_rx_napi_sync(trans); iwl_pcie_tx_stop(trans); iwl_pcie_rx_stop(trans); -- 2.38.1