From patchwork Tue Sep 20 06:30:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jaehoon Chung X-Patchwork-Id: 9341091 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 690FC6077A for ; Tue, 20 Sep 2016 06:32:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 559CB290EA for ; Tue, 20 Sep 2016 06:32:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 47D2F29282; Tue, 20 Sep 2016 06:32:54 +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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 67F3A290EA for ; Tue, 20 Sep 2016 06:32:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932500AbcITGco (ORCPT ); Tue, 20 Sep 2016 02:32:44 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:56652 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932423AbcITGab (ORCPT ); Tue, 20 Sep 2016 02:30:31 -0400 MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Received: from epcpsbgr1.samsung.com (u141.gpu120.samsung.co.kr [203.254.230.141]) by mailout2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0ODS01L80I2SOE40@mailout2.samsung.com> for linux-mmc@vger.kernel.org; Tue, 20 Sep 2016 15:30:28 +0900 (KST) Received: from epcpsbgm2new.samsung.com ( [172.20.52.112]) by epcpsbgr1.samsung.com (EPCPMTA) with SMTP id 3C.25.31386.487D0E75; Tue, 20 Sep 2016 15:30:28 +0900 (KST) X-AuditID: cbfee68d-f79286d000007a9a-fb-57e0d784f4be Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2new.samsung.com (EPCPMTA) with SMTP id 93.19.07740.487D0E75; Mon, 19 Sep 2016 23:30:28 -0700 (MST) Received: from [10.113.62.216] by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0ODS00A9JI2SPK10@mmp1.samsung.com>; Tue, 20 Sep 2016 15:30:28 +0900 (KST) Subject: Re: mmc: dw_mmc: log spamming To: Tobias Jakobi , sw0312.kim@samsung.com References: <57DADA85.2000200@math.uni-bielefeld.de> <57DF396E.9050503@samsung.com> <6dd25843-3852-b059-4c42-6c720887db38@samsung.com> <57DF96C3.7050706@math.uni-bielefeld.de> <5d370fba-e4ec-d70a-a949-a955e86d61b1@samsung.com> <57DFB75A.3030106@math.uni-bielefeld.de> Cc: Ulf Hansson , "linux-mmc@vger.kernel.org" From: Jaehoon Chung Message-id: <25a3a5a5-da21-dc71-45fd-d9b3f2a2b2bc@samsung.com> Date: Tue, 20 Sep 2016 15:30:28 +0900 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 In-reply-to: <57DFB75A.3030106@math.uni-bielefeld.de> Content-transfer-encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFuphkeLIzCtJLcpLzFFi42JZI2JSoNty/UG4weseE4sj//sZLWZMfslm 0bb6A6vF8bXhDiwed67tYfP4d4zdo2/LKkaPz5vkAliiuGxSUnMyy1KL9O0SuDJurnYpuGFT cWzbG5YGxi69LkZODgkBE4kFc2YzQdhiEhfurWfrYuTiEBJYwShxdlMPE0xR16O/7BCJpYwS zcv/M4IkeAUEJX5MvsfSx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EwSvPWSYwCsxCct8shPtmIalawMi8ilEitSC5oDgp PdcoL7Vcrzgxt7g0L10vOT93EyM4Wp9J72A8vMv9EKMAB6MSD2/Aw/vhQqyJZcWVuYcYJTiY lUR4Va48CBfiTUmsrEotyo8vKs1JLT7EaAp070RmKdHkfGAiySuJNzQ2MTOyNDI3tDAyNlcS 5338f12YkEB6YklqdmpqQWoRTB8TB6dUA+O6l+Fci4yDGc4Xbkspyuu+7vP16LLPFVtfzJHX vHPm18vFLU47I+Z/vs2zIvoK09rs06nnlFf8de/Rz1lWyVJ0SfGrTtrUC3J/P6aJaa6aULb0 zsG7Rs4bE1zm2h59vHry2witSh0Pp6l9l/Muz33z+ffMK4a9sX8OdxbOvbKsy3GbyAIdvo+d SizFGYmGWsxFxYkAT2tlyuwCAAA= DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi Tobias, On 09/19/2016 07:00 PM, Tobias Jakobi wrote: > Hey Jaehoon, > > > Jaehoon Chung wrote: >> Hi Tobias, >> >> On 09/19/2016 04:41 PM, Tobias Jakobi wrote: >>> Hello Jaehoon, >>> >>> >>> Jaehoon Chung wrote: >>>> Hi Tobias, >>>> >>>> CC'd mmc mailing. >>>> >>>> On 09/19/2016 10:03 AM, Seung-Woo Kim wrote: >>>>> Hello Jaehoon, >>>>> >>>>> On 2016년 09월 19일 09:32, Jaehoon Chung wrote: >>>>>> Hi Tobias, >>>>>> >>>>>> On 09/16/2016 02:29 AM, Tobias Jakobi wrote: >>>>>>> Hello everyone, >>>>>>> >>>>>>> I'm experiencing massive kernel log spamming by dw_mmc, the commit that >>>>>>> causes this is the following one. >>>>>>> >>>>>>> 65257a0deed5aee66b4e3708944f0be62a64cabc >>>>>>> >>>>>>> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=65257a0deed5aee66b4e3708944f0be62a64cabc >>>>>>> >>>>>>> I've briefly checked the commit and I think the rationale behind >>>>>>> removing the check is incorrect. While MMC_CLKGATE was certainly >>>>>>> removed, runtime PM has "replaced" it (the commit >>>>>>> 9eadcc0581a8ccaf4c2378aa1c193fb164304f1d even mentions this). >>>>>>> >>>>>>> This is on an Exynos4412 board, kernel is 4.8-rc6. Nothing is connected >>>>>>> to the eMMC connector. >>>>>> >>>>>> Thanks for reporting this. >>>>>> >>>>>> Seung-Woo, Could you check your patch? I will also check this. >>>> >>>> Did you test after reverting this commit? or previous version is working fine? >>> yes, reverting the commit fixes the log spamming. I'm aware though that >>> the check is more of less broken (undefined behaviour because of >>> bit-shifting with large values), so I have also tried the following >>> thing: Just checking against 'div' instead of 'clock << div'. Anyway, >>> this also works for me. >>> >>> >>>> Which exynos4412 board do you use? I think it's related with "broken-cd". >>>> (If you can share which board and dts you are using, we can check in more detail.) >>> This is an Odroid-X2 board. >>> >> >> When i have checked on odroid-u3, it's reproduced very easy. > good to hear! I also worry that I'm the only one with these issues on > the X2. :) > > Anyway, do you seen any other message on the U3 that are related to the > eMMC. I'm asking because I have also experience some warning/error from > the regulator subsystem: >> Sep 15 17:19:56 chidori kernel: [ 4.976690] vddf_emmc_2.85V: voltage operation not allowed >> Sep 15 17:19:56 chidori kernel: [ 4.995417] mmc_host mmc1: Bus speed (slot 0) = 50000000Hz (slot req 400000Hz, actual 396825HZ div = 63) > > I'm sending you a patch shortly which fixes the warning, but I'm not > sure if this is the right approach. Maybe you can take a look? I didn't see this..what is vddf_emmc_2.85V? I can't find this anywhere. > > >>>> As you mentioned, you didn't insert the eMMC card on board. >>>> Then it should be polling whether card is inserted/removed. (If broken-cd is set...) >>> I can check the callstack leading to dw_mci_setup_bus() I guess. Would >>> that should make it easier for you guys to understand where the issue >>> originates from? >> >> Not need to share the callstack. Because i understood what is problem. >> But checking 'div' instead of 'clock << div' should also have the unexpected behavior. > Why is that? If I understood the initial problem correctly, then > shifting with 'div' produces undefined behaviour since we don't know an > upper bound for it. That's not the case if we just compare old and new > divisor. This problem is because of "polling" method. ("broken-cd" property in device-tree) If can't find the eMMC card, mmc_rescan_try_freq() is running four times. Because it's looping with freqs array size in mmc_rescan(). At that time, clock and current_speed is 400KHz..and if didn't find any cards, clock is set to 0. After HZ, mmc_rescan is running again..and repeat above behavior. I didn't consider about this case. (removable case and polling method.) I think we can fix the below code..Could you check the below? I have tested with exynos4412/exynos5422 boards. If there is no issue, i will send the patch. Or if there is a problem, let me know, plz. Best Regards, Jaehoon Chung > > >> If needs to fix, i want to go ahead the correct way at this time. >> Anyway, thanks for reporting this! > > Also thanks, and let me know if I can test anything else. > > With best wishes, > Tobias > > >> Best Regards, >> Jaehoon Chung >> >>> >>> >>>> I think it's not related with runtime PM. >>>> >>>> Best Regards, >>>> Jaehoon Chung >>> >>> WIth best wishes, >>> Tobias >>> >>> >>> >>> >>>>> Ok, I will check on Exynos4412 SpC boards. >>>>> >>>>> By the way, to check no condition case, when I posted after v2[1], I >>>>> checked with Exynos5422 and Exynos5433 SoC boards and they didn't show >>>>> duplicated log, so I agreed not to check condition for logging. >>>>> >>>>> [1] https://patchwork.kernel.org/patch/9182469/ >>>>> >>>>> Best Regards, >>>>> - Seung-Woo Kim >>>>> >>>>>> >>>>>> Best Regards, >>>>>> Jaehoon Chung >>>>>> >>>>>>> >>>>>>> With best wishes, >>>>>>> Tobias >>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>>> >>>>>> >>>>> >>>> >>> >>> >>> >>> >> > > > > --- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index 22dacae..41306d1 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -1112,11 +1112,12 @@ static void dw_mci_setup_bus(struct dw_mci_slot *slot, bool force_clkinit) div = (host->bus_hz != clock) ? DIV_ROUND_UP(div, 2) : 0; - dev_info(&slot->mmc->class_dev, - "Bus speed (slot %d) = %dHz (slot req %dHz, actual %dHZ div = %d)\n", - slot->id, host->bus_hz, clock, - div ? ((host->bus_hz / div) >> 1) : - host->bus_hz, div); + if (clock != slot->__clk_old || force_clkinit) + dev_info(&slot->mmc->class_dev, + "Bus speed (slot %d) = %dHz (slot req %dHz, actual %dHZ div = %d)\n", + slot->id, host->bus_hz, clock, + div ? ((host->bus_hz / div) >> 1) : + host->bus_hz, div); /* disable clock */ mci_writel(host, CLKENA, 0); @@ -1139,6 +1140,9 @@ static void dw_mci_setup_bus(struct dw_mci_slot *slot, bool force_clkinit) /* inform CIU */ mci_send_cmd(slot, sdmmc_cmd_bits, 0); + + /* keep the last clock value that requested from core */ + slot->__clk_old = clock; } host->current_speed = clock; diff --git a/drivers/mmc/host/dw_mmc.h b/drivers/mmc/host/dw_mmc.h index 9e740bc..0f12e15 100644 --- a/drivers/mmc/host/dw_mmc.h +++ b/drivers/mmc/host/dw_mmc.h @@ -249,6 +249,8 @@ extern int dw_mci_resume(struct dw_mci *host); * @queue_node: List node for placing this node in the @queue list of * &struct dw_mci. * @clock: Clock rate configured by set_ios(). Protected by host->lock. + * @__clk_old: The last clock value that requested from core. + * Keeping track of this helps us to avoid spamming the console. * @flags: Random state bits associated with the slot. * @id: Number of this slot. * @sdio_id: Number of this slot in the SDIO interrupt registers. @@ -263,6 +265,7 @@ struct dw_mci_slot { struct list_head queue_node; unsigned int clock; + unsigned int __clk_old; unsigned long flags; #define DW_MMC_CARD_PRESENT 0