From patchwork Mon May 22 21:02:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arend van Spriel X-Patchwork-Id: 9741391 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id ADA5E6034C for ; Mon, 22 May 2017 21:02:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9FD282871D for ; Mon, 22 May 2017 21:02:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9492228751; Mon, 22 May 2017 21:02:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0A1A62871D for ; Mon, 22 May 2017 21:02:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933847AbdEVVCk (ORCPT ); Mon, 22 May 2017 17:02:40 -0400 Received: from mail-pf0-f174.google.com ([209.85.192.174]:33448 "EHLO mail-pf0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933846AbdEVVCi (ORCPT ); Mon, 22 May 2017 17:02:38 -0400 Received: by mail-pf0-f174.google.com with SMTP id e193so93319615pfh.0 for ; Mon, 22 May 2017 14:02:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=Z3De8SL+3kziCOt4nCoCZEuuGF7QA7RoQM24Gfjkd0g=; b=RjSzUNLBe9mIusEPc4gbIelYCNTkp7tJmOtTuJncR13YuWxWptaFhGfQhPMzEn6rw9 RFtCF6viv5nBRI8vx8CXyratNrmuU+ZDURruDihqzlxOa7h5oS/YQ1H+GpUwjZqGK/2k VuQ3tzKbJvACTzgOjicYHNDLHtSHPj2kHf/Fc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=Z3De8SL+3kziCOt4nCoCZEuuGF7QA7RoQM24Gfjkd0g=; b=nxtQAKZl3ypTl7henYiEp5lJkTOzfzVvf9c88VBI1tDZdUdRowUiHIkzr4d44lWm50 qyUN0IZvsfmKJicRfHy+uDbJ2vtSaVdWpr4LDNvLemYMxmsSbpUSrNFeJlW49oRbpB/8 0Kn5gBYtVaT3z7Q9lbeeXmbfgp4GZpdepkI/pE+GwO2A9aFJ3TecmAftP6KKLO9choAB SrJndYkrl5DIwrZcers4pox4I0clhX2sdufMDN+5NnGFmh3yXagEQ/yCz9RqpMHpuU/5 2bYSy1wrW6PeBiByhj6LB3lPPUoiSdJJNmRqEiQ2CYqdlAgk5Dd+ahsPleafLrehK+NB eMAA== X-Gm-Message-State: AODbwcD9+26LODTuaBxrZtY4/WjNIsSFOHCnzlp+/SpeMcoOnhI+XbLX 72HVKqgIrrhtJ/1f X-Received: by 10.98.70.17 with SMTP id t17mr28157280pfa.229.1495486958007; Mon, 22 May 2017 14:02:38 -0700 (PDT) Received: from [10.177.251.3] ([192.19.248.250]) by smtp.gmail.com with ESMTPSA id q9sm29423678pfg.77.2017.05.22.14.02.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 May 2017 14:02:37 -0700 (PDT) Subject: Re: 4.12-RC2 BUG: scheduling while atomic: irq/47-iwlwifi To: Johannes Berg , Sander Eikelenboom References: <1495450628.2653.14.camel@sipsolutions.net> <764a929c-ce8a-c859-a49e-2f20cb05ae44@broadcom.com> Cc: linux-wireless , netdev@vger.kernel.org From: Arend Van Spriel Message-ID: <532c257e-52a0-18c1-1afe-04d37c28e072@broadcom.com> Date: Mon, 22 May 2017 23:02:34 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <764a929c-ce8a-c859-a49e-2f20cb05ae44@broadcom.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On 22-5-2017 14:09, Arend van Spriel wrote: > On 5/22/2017 12:57 PM, Johannes Berg wrote: >> On Mon, 2017-05-22 at 12:36 +0200, Sander Eikelenboom wrote: >>> Hi, >>> >>> I encountered this splat with 4.12-RC2. >> >> Ugh, yeah, I should've seen that in the review. >> >> Arend, please take a look at this. cfg80211_sched_scan_results() cannot >> sleep, so you can't rtnl_lock() in there. Looks like you can just rely >> on RCU though? > > I see. I think you are right on RCU. Don't have the code in front of me > now, but I think the lookup has an ASSERT_RTNL. Will look into it after > my monday meeting :-p I realized I have a laptop lying around with intel 3160 wifi chip and tried to reproduce the issue. Did not run into the splat running 4.12-rc1 from wireless-drivers-next repo. I did not get the email from Sander so I don't know any details. Here is what I changed based on the info Johannes provided. Can you please check if this get rid of the splat and let me know. Regards, Arend --- } @@ -398,13 +396,13 @@ void cfg80211_sched_scan_results(struct wiphy *wiphy, u64 trace_cfg80211_sched_scan_results(wiphy, reqid); /* ignore if we're not scanning */ - rtnl_lock(); + rcu_read_lock(); request = cfg80211_find_sched_scan_req(rdev, reqid); if (request) { request->report_results = true; queue_work(cfg80211_wq, &rdev->sched_scan_res_wk); } - rtnl_unlock(); + rcu_read_unlock(); } EXPORT_SYMBOL(cfg80211_sched_scan_results); diff --git a/net/wireless/scan.c b/net/wireless/scan.c index 14d5f0c..04833bb 100644 --- a/net/wireless/scan.c +++ b/net/wireless/scan.c @@ -322,9 +322,7 @@ static void cfg80211_del_sched_scan_req(struct cfg80211_regi { struct cfg80211_sched_scan_request *pos; - ASSERT_RTNL(); - - list_for_each_entry(pos, &rdev->sched_scan_req_list, list) { + list_for_each_entry_rcu(pos, &rdev->sched_scan_req_list, list) { if (pos->reqid == reqid) return pos;