From patchwork Sat May 21 16:50:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Larry Finger X-Patchwork-Id: 9130617 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 D2DF06048B for ; Sat, 21 May 2016 16:51:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BE74727CCD for ; Sat, 21 May 2016 16:51:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AFA0A28156; Sat, 21 May 2016 16:51:06 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 F402C27CCD for ; Sat, 21 May 2016 16:51:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752458AbcEUQus (ORCPT ); Sat, 21 May 2016 12:50:48 -0400 Received: from mail-oi0-f67.google.com ([209.85.218.67]:35394 "EHLO mail-oi0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752389AbcEUQul (ORCPT ); Sat, 21 May 2016 12:50:41 -0400 Received: by mail-oi0-f67.google.com with SMTP id w198so29955921oiw.2; Sat, 21 May 2016 09:50:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id; bh=FVTLRHxPeGqSoEPmx/AQV0GzNXuUpw7QnAiw35Isbgk=; b=pfeVjHyjX5lPlu0OMeNuwPlBQRe+HtmdpNAAof+5f1zyOk5YHuD5UU49uD24LXaFNK Nyv/E8W2QMfyLmOjY9dnVF8brzCrwsHFNej15loET/ZcHKi7K+CjiWNAhboN91H1HthI 3apRtZlGmFVRQXeCfAlDB7QswqjtCVefSlxF4jAwnpXbV/vyh73TshpOBShbAQ8IS9fw 0qLcwjrfNZdjwmgRcsBgBxJfK/WkjxmZqq8q8BLXUJNZ1pKFPAAQ/TxBqGXy9jIL53QP 3pUjkJ+UP/DWjO6N5eaN1u5XxxbKxPewA/ESKy+jayeUQmZ9M4D8clVNbWHt6/WSTJJw tRgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=FVTLRHxPeGqSoEPmx/AQV0GzNXuUpw7QnAiw35Isbgk=; b=Q0KBQfUjV7UODhHKQh5rwTHPjJnjdjEJoH9Q1uJfrYvaLaiceonLBTICiiN6V2A9mq ceKJwsYQO5f2z153BUS5PQIT0bWloJS92/bTRFqo7l2+MFXBGiC1IOqxSLmiKcZ4NeVZ u0WWf/k+QFf1qWkx/XQCgryS92jkJoEeGFjPQmHOkDhhskjc6FwhScFbVkpMgxrgSi/c XxbOfC23U0tS4X4c5l8L2fCIZ9RLaOkL2C413N/MhhDsD/nvkcrrcsKBKY1O7soqrZku Lhe28h9d0LE+clhLVx2XH8zPyfMHAp0Af57GgUmsEm1YHA4g+oM6giv0j33q8pyjfMEu 3++A== X-Gm-Message-State: AOPr4FVus56uWdbzs4xQ5vpsbFhqbjHwSsOgFs4aiq2MiL1uFdX6fR5iqSA/IRQOQQ1Jag== X-Received: by 10.157.48.89 with SMTP id w25mr4850693otd.32.1463849440512; Sat, 21 May 2016 09:50:40 -0700 (PDT) Received: from linux.site (cpe-24-31-249-175.kc.res.rr.com. [24.31.249.175]) by smtp.gmail.com with ESMTPSA id o6sm7397472obc.4.2016.05.21.09.50.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 21 May 2016 09:50:39 -0700 (PDT) From: Larry Finger To: kvalo@codeaurora.org Cc: devel@driverdev.osuosl.org, linux-wireless@vger.kernel.org, Larry Finger , James Feeney , Stable Subject: [PATCH] rtlwifi: Fix scheduling while atomic error from commit 49f86ec21c01 Date: Sat, 21 May 2016 11:50:35 -0500 Message-Id: <1463849435-2293-1-git-send-email-Larry.Finger@lwfinger.net> X-Mailer: git-send-email 2.1.4 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 Commit 49f86ec21c01 ("rtlwifi: Change long delays to sleeps") was correct for most cases; however, driver rtl8192ce calls the affected routines while in atomic context. The kernel bug output is as follows: BUG: scheduling while atomic: wpa_supplicant/627/0x00000002 [...] [] __schedule+0x899/0xad0 [] schedule+0x3c/0x90 [] schedule_hrtimeout_range_clock+0xa2/0x120 [] ? hrtimer_init+0x120/0x120 [] ? schedule_hrtimeout_range_clock+0x96/0x120 [] schedule_hrtimeout_range+0x13/0x20 [] usleep_range+0x4f/0x70 [] rtl_rfreg_delay+0x38/0x50 [rtlwifi] [] rtl92c_phy_config_rf_with_headerfile+0xc7/0xe0 [rtl8192ce] To fix this bug, three of the changes from delay to sleep are reverted. Unfortunately, one of the changes involves a delay of 50 msec. The calling code will be modified so that this long delay can be avoided; however, this change is being pushed now to fix the problem in kernel 4.6.0. Fixes: 49f86ec21c01 ("rtlwifi: Change long delays to sleeps") Reported-by: James Feeney Signed-off-by: Larry Finger Cc: James Feeney Cc: Stable [4.6+] --- drivers/net/wireless/realtek/rtlwifi/core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/realtek/rtlwifi/core.c b/drivers/net/wireless/realtek/rtlwifi/core.c index 0f48048..3a0faa8 100644 --- a/drivers/net/wireless/realtek/rtlwifi/core.c +++ b/drivers/net/wireless/realtek/rtlwifi/core.c @@ -54,7 +54,7 @@ EXPORT_SYMBOL(channel5g_80m); void rtl_addr_delay(u32 addr) { if (addr == 0xfe) - msleep(50); + mdelay(50); else if (addr == 0xfd) msleep(5); else if (addr == 0xfc) @@ -75,7 +75,7 @@ void rtl_rfreg_delay(struct ieee80211_hw *hw, enum radio_path rfpath, u32 addr, rtl_addr_delay(addr); } else { rtl_set_rfreg(hw, rfpath, addr, mask, data); - usleep_range(1, 2); + udelay(1); } } EXPORT_SYMBOL(rtl_rfreg_delay); @@ -86,7 +86,7 @@ void rtl_bb_delay(struct ieee80211_hw *hw, u32 addr, u32 data) rtl_addr_delay(addr); } else { rtl_set_bbreg(hw, addr, MASKDWORD, data); - usleep_range(1, 2); + udelay(1); } } EXPORT_SYMBOL(rtl_bb_delay);