Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2978364ybi; Sun, 26 May 2019 11:44:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqzKGUXtdfCAh9jgEqn4+tHz+MFxWNGMJS01r1ZxXPw6YbwgMMU3srOHfXYQCDw/5ppiNBML X-Received: by 2002:a17:90a:ac0d:: with SMTP id o13mr25925650pjq.139.1558896262714; Sun, 26 May 2019 11:44:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558896262; cv=none; d=google.com; s=arc-20160816; b=dD/2LgyM+rS/21UnfUSmt2EFRauumOTUmZu9/lB6GX8p8sWhrl6/20T6H/A4tAttrJ xPVNVvygtMQJW9PBXcRCwbPKHg0Xr3tIouQyuf3G+p4DZtENh01TOmw7HXmZ/+ykTvGN 5aKtexo4x7gbOwkmTzuB87JLbfc/yFzcUWNyVVsYuyDvM8HkOGFPKiY8wgQPqHVqC3vJ AmK0ppT+h22qPqhlWHinJF3yqokBQk7pwm2LtBHlMMIPRfXEKiJHt7yeKUIGG6+psXQ+ KyKry7bva/aqzMAUuGJywJqTT6RA1t7FLom4SabPlRxOK1HxrAOVcf8ZgpW4hSr8Xj62 +kAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=OLaJRa4hCtuEEMwKNtUZMZ+QEafCBrmCJfsSQcoxk78=; b=b7VOqk3E/W87DcE6+Y0iazt6RrEwbv2tNSViReeu1SuU3nuRvFyIZSC2w7nR87wayF N/KhBAAj9K378Wk2JRqpCl5ID/GUW8WDtWFB/tG+C+N5vhJGM8ReARjevQD0X9arCWD7 LV98NVtvM/NJmhv+20vNpGU6uWBhzHVDlez2JaBiO78FAJDTbgOka5JGJm20K270vyJE 8fCEnV5TM8hcHgdVptN0gyPJphE2X6fSX5npbInxRiVEQKd1CoN/sY95F4FMMG4GGy5S Fk75zmODe+N1mjwcrsbsWrlSCyQIkFVdc/I4Y83jmluulXq3KlXao3Jq65zCORvbaMnv 9leQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=ZpKF+rNt; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h10si14347501pgq.187.2019.05.26.11.44.07; Sun, 26 May 2019 11:44:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=ZpKF+rNt; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728103AbfEZSm3 (ORCPT + 99 others); Sun, 26 May 2019 14:42:29 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:39629 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728074AbfEZSm3 (ORCPT ); Sun, 26 May 2019 14:42:29 -0400 Received: by mail-pg1-f193.google.com with SMTP id w22so7786990pgi.6 for ; Sun, 26 May 2019 11:42:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=OLaJRa4hCtuEEMwKNtUZMZ+QEafCBrmCJfsSQcoxk78=; b=ZpKF+rNte3zJzdktFMth5dLBIMKQN/Wi/DOrVKbWsETZufYdcs05WlRw8s4ebyKPOa vfTyk7yEeJnMKF7ehV4l8z0/1vQvx8YEkx2rBH+Izid83ssvISnn8ifLJs5FyKEQJ0UQ XEXVoZcGBn/ZoT/UAu1KKsgnLnmQSZiSvQhSw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=OLaJRa4hCtuEEMwKNtUZMZ+QEafCBrmCJfsSQcoxk78=; b=lxNPSH9cpXkbQXvLMbgG4eaLVFfPEK8uHB/pXjiStk5bJG33I+6jvBQFm49/wfno92 1jbzu/7wUs1K6ZJEHgLJeGrSKEJ3ZA2GiUXrQ0UaYZ01WAICaijzQoGxH3PHZLyIOe5s U5G7ap3AgV7LgosCR7l1pfSDpcW6LvhZ3nP+gNJ4e86bYGOTYYMNL8to27BMgk6Uk92E xl0MOc2sbYzawR7K2Gycxqb0rTDVonKjhGJEIDp2M9B3ZwO4UIIzgchfQU2PXCcdSKIb AZSly3T/yXvkx7eJUojH1SGV0zJdU2L52J+NYwSuBFS0hmnvYcM1Jir58DQyVgEPJI/X VTxg== X-Gm-Message-State: APjAAAVUu3plFPU6yNQaxfl9UISzXe6YgvnzOXvCO+btZs/F8dSv+5CS FMit3DBJKLfj12P1rPttGsfHxQ== X-Received: by 2002:a62:fb18:: with SMTP id x24mr65735472pfm.76.1558896148261; Sun, 26 May 2019 11:42:28 -0700 (PDT) Received: from [10.230.40.234] ([192.19.215.250]) by smtp.gmail.com with ESMTPSA id d6sm8297881pjo.32.2019.05.26.11.42.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 26 May 2019 11:42:27 -0700 (PDT) Subject: Re: Issue with Broadcom wireless in 5.2rc1 (was Re: [PATCH] mmc: sdhci: queue work after sdhci_defer_done()) To: Brian Masney , Adrian Hunter , Franky Lin , Hante Meuleman , Chi-Hsien Lin , Wright Feng Cc: ulf.hansson@linaro.org, faiz_abbas@ti.com, linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Kalle Valo , linux-wireless@vger.kernel.org, brcm80211-dev-list.pdl@broadcom.com, brcm80211-dev-list@cypress.com, netdev@vger.kernel.org References: <20190524111053.12228-1-masneyb@onstation.org> <70782901-a9ac-5647-1abe-89c86a44a01b@intel.com> <20190524154958.GB16322@basecamp> <20190526122136.GA26456@basecamp> From: Arend Van Spriel Message-ID: Date: Sun, 26 May 2019 20:42:21 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: <20190526122136.GA26456@basecamp> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/26/2019 2:21 PM, Brian Masney wrote: > + Broadcom wireless maintainers > > On Fri, May 24, 2019 at 11:49:58AM -0400, Brian Masney wrote: >> On Fri, May 24, 2019 at 03:17:13PM +0300, Adrian Hunter wrote: >>> On 24/05/19 2:10 PM, Brian Masney wrote: >>>> WiFi stopped working on the LG Nexus 5 phone and the issue was bisected >>>> to the commit c07a48c26519 ("mmc: sdhci: Remove finish_tasklet") that >>>> moved from using a tasklet to a work queue. That patch also changed >>>> sdhci_irq() to return IRQ_WAKE_THREAD instead of finishing the work when >>>> sdhci_defer_done() is true. Change it to queue work to the complete work >>>> queue if sdhci_defer_done() is true so that the functionality is >>>> equilivent to what was there when the finish_tasklet was present. This >>>> corrects the WiFi breakage on the Nexus 5 phone. >>>> >>>> Signed-off-by: Brian Masney >>>> Fixes: c07a48c26519 ("mmc: sdhci: Remove finish_tasklet") >>>> --- >>>> [ ... ] >>>> >>>> drivers/mmc/host/sdhci.c | 2 +- >>>> 1 file changed, 1 insertion(+), 1 deletion(-) >>>> >>>> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c >>>> index 97158344b862..3563c3bc57c9 100644 >>>> --- a/drivers/mmc/host/sdhci.c >>>> +++ b/drivers/mmc/host/sdhci.c >>>> @@ -3115,7 +3115,7 @@ static irqreturn_t sdhci_irq(int irq, void *dev_id) >>>> continue; >>>> >>>> if (sdhci_defer_done(host, mrq)) { >>>> - result = IRQ_WAKE_THREAD; >>>> + queue_work(host->complete_wq, &host->complete_work); >>> >>> The IRQ thread has a lot less latency than the work queue, which is why it >>> is done that way. >>> >>> I am not sure why you say this change is equivalent to what was there >>> before, nor why it fixes your problem. >>> >>> Can you explain some more? >> >> [ ... ] >> >> drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c calls >> sdio_claim_host() and it appears to never return. > > When the brcmfmac driver is loaded, the firmware is requested from disk, > and that's when the deadlock occurs in 5.2rc1. Specifically: > > 1) brcmf_sdio_download_firmware() in > drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c calls > sdio_claim_host() > > 2) brcmf_sdio_firmware_callback() is called and brcmf_sdiod_ramrw() > tries to claim the host, but has to wait since its already claimed > in #1 and the deadlock occurs. This does not make any sense to me. brcmf_sdio_download_firmware() is called from brcmf_sdio_firmware_callback() so they are in the same context. So #2 is not waiting for #1, but something else I would say. Also #2 calls sdio_claim_host() after brcmf_sdio_download_firmware has completed so definitely not waiting for #1. > I tried to release the host before the firmware is requested, however > parts of brcmf_chip_set_active() needs the host to be claimed, and a > similar deadlock occurs in brcmf_sdiod_ramrw() if I claim the host > before calling brcmf_chip_set_active(). > > I started to look at moving the sdio_{claim,release}_host() calls out of > brcmf_sdiod_ramrw() but there's a fair number of callers, so I'd like to > get feedback about the best course of action here. Long ago Franky reworked the sdio critical sections requiring sdio claim/release and I am pretty sure they are correct. Could you try with lockdep kernel and see if that brings any more information. In the mean time I will update my dev branch to 5.2-rc1 and see if I can find any clues. Regards, Arend