From patchwork Mon Nov 24 14:33:47 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emmanuel Grumbach X-Patchwork-Id: 5366901 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 6FB68C11AC for ; Mon, 24 Nov 2014 14:35:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8FF3B2041C for ; Mon, 24 Nov 2014 14:35:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B353720425 for ; Mon, 24 Nov 2014 14:35:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932141AbaKXOfP (ORCPT ); Mon, 24 Nov 2014 09:35:15 -0500 Received: from mail-wi0-f181.google.com ([209.85.212.181]:61057 "EHLO mail-wi0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932135AbaKXOfO (ORCPT ); Mon, 24 Nov 2014 09:35:14 -0500 Received: by mail-wi0-f181.google.com with SMTP id r20so5974669wiv.14 for ; Mon, 24 Nov 2014 06:35:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=akQfSPBH+tjYens7AcTTJwsC4/nGUgdpdtlK20Kqlmc=; b=T3PBglV2PDYh9VJXdMqI662mWUzmjXIjhkXPdeBx6BRxBD54/0kDfVHG5m5VY/VvRD W13JChZjifnSSW2ZqINaeLTa5c546gRYJy2FFiDRRaIo/+QN4AnDHaIe4aMnmlNWI88Y JrRGJPw6JFYLW7svsa8HIXQejYY7r47b46N48fyoxqrDMTPh+GPFPVWp8wr/e/HpqQtq tsnGTJlycxzPwnWjF4/RksmaQW2vTQ8V/8cC720vqayAe0Whg9qv0Udb1zIMNPNNHnpS Tk4rhYuLXaBWAEwdGbpY8iq3ltzAtAW7BHAAoamZVvRDNB9D5bKf4tHv8Y+XZm/y9gvB Q+lw== X-Received: by 10.180.218.74 with SMTP id pe10mr22561632wic.48.1416839712983; Mon, 24 Nov 2014 06:35:12 -0800 (PST) Received: from localhost.localdomain (46-116-150-134.bb.netvision.net.il. [46.116.150.134]) by mx.google.com with ESMTPSA id n3sm21274744wjz.21.2014.11.24.06.35.11 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 24 Nov 2014 06:35:12 -0800 (PST) From: Emmanuel Grumbach To: linux-wireless@vger.kernel.org Cc: Johannes Berg , Emmanuel Grumbach Subject: [PATCH 11/75] iwlwifi: mvm: don't capture firmware coredump for D3->D0 reconfig Date: Mon, 24 Nov 2014 16:33:47 +0200 Message-Id: <1416839691-28533-11-git-send-email-egrumbach@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: References: Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Johannes Berg The code to capture firmware errors works during the reconfiguration phase after an error. As the D3->D0 transition uses the same flow to get the D0 image reconfigured, this triggered and caused a firmware coredump to be collected. This in turn, if it isn't picked up by userspace, can cause module unloading to fail, which is how the bug was detected. To fix this issue, introduce a new status flag (D3_RECONFIG) and use it to detect that during reconfiguration no coredump should be taken and reported. Reported-by: Avi Kraif Signed-off-by: Johannes Berg Signed-off-by: Emmanuel Grumbach --- drivers/net/wireless/iwlwifi/mvm/d3.c | 1 + drivers/net/wireless/iwlwifi/mvm/mac80211.c | 7 ++++++- drivers/net/wireless/iwlwifi/mvm/mvm.h | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/iwlwifi/mvm/d3.c b/drivers/net/wireless/iwlwifi/mvm/d3.c index 3bbb511..b61075b 100644 --- a/drivers/net/wireless/iwlwifi/mvm/d3.c +++ b/drivers/net/wireless/iwlwifi/mvm/d3.c @@ -1651,6 +1651,7 @@ static int __iwl_mvm_resume(struct iwl_mvm *mvm, bool test) /* return 1 to reconfigure the device */ set_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status); + set_bit(IWL_MVM_STATUS_D3_RECONFIG, &mvm->status); return 1; } diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/iwlwifi/mvm/mac80211.c index 4f9f77f..ed2c219 100644 --- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c @@ -839,7 +839,12 @@ void iwl_mvm_fw_error_dump(struct iwl_mvm *mvm) static void iwl_mvm_restart_cleanup(struct iwl_mvm *mvm) { - iwl_mvm_fw_error_dump(mvm); + /* clear the D3 reconfig, we only need it to avoid dumping a + * firmware coredump on reconfiguration, we shouldn't do that + * on D3->D0 transition + */ + if (!test_and_clear_bit(IWL_MVM_STATUS_D3_RECONFIG, &mvm->status)) + iwl_mvm_fw_error_dump(mvm); iwl_trans_stop_device(mvm->trans); diff --git a/drivers/net/wireless/iwlwifi/mvm/mvm.h b/drivers/net/wireless/iwlwifi/mvm/mvm.h index 105a76b..e56abdd 100644 --- a/drivers/net/wireless/iwlwifi/mvm/mvm.h +++ b/drivers/net/wireless/iwlwifi/mvm/mvm.h @@ -750,6 +750,7 @@ enum iwl_mvm_status { IWL_MVM_STATUS_IN_HW_RESTART, IWL_MVM_STATUS_IN_D0I3, IWL_MVM_STATUS_ROC_AUX_RUNNING, + IWL_MVM_STATUS_D3_RECONFIG, }; static inline bool iwl_mvm_is_radio_killed(struct iwl_mvm *mvm)