Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp4275213pxf; Tue, 23 Mar 2021 07:06:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx+uhKiqTdm1grWX7JjBcY6Zk7+myAVKflOBAwE5wTpH/bZEWiojwEKoK5Xjb5MUJhcAjxR X-Received: by 2002:a17:906:da0e:: with SMTP id fi14mr5287651ejb.188.1616508398770; Tue, 23 Mar 2021 07:06:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616508398; cv=none; d=google.com; s=arc-20160816; b=OF+OYdv3Bppx83KveJtr/xn3CFkKDFSwuMrl8ip+vTDteSxxkXv0F2tUGdaRyzX1N7 yaStYhDRU7jv/mw+KGQI/d0KqU91XHTqkoAuCm4yYnyf1K9DYJ3xu1/NNNyAXfK6FoFi 8bPpFQe1INyy00MbFrwJyrAE9BI6zoQs58elHi/QBZ+wIanUTnBSyJaUmeFIp57Q7RoT ZS05m8UxOL6EzqYzO4LCSJygsRnZxCyLMroSJkIxI+Ap3rHJbUKOWx8AUN8o0I+PrVdu jlo/vQFq4jiIwzXg4iIEVgEbZj88ZcTLkAKFploz3jSdRqdM7HA+/MrufB/GYvVufjxB MSMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=EFM8vj54tYKb1Jf8bEnuuvv/LY9C1ofZG/2jctBPMnI=; b=hwo7ncr/LFdSKDtDw5a1QzD2qH++HwiV8/1c8KysUFwJSWbLXqqitoJxnLsKa87D6h Uuvz78BrXXs42qcGWEGxx03B8XIq/O9MqIDWHce82eXoosHYLksXlCXWlKM/VT7zVxFF YxqQtqFLN5FoMjodvEHKypmlqml0ZKFzXmYy7LEu9puEsJY1W1TZqD84jKkiT6rO1ytX KdEKBy1KjRLEGsNF8WvBB6wCyjLglEPhUr77CzTZJmgce2RTLfSWcZbL8tNrcJT4sSco WupOa7G+H7ZXsr1j4PT+c8BygWDEdcUy2rlfhCRRY8IaRox4MZeEXedKFZ1oslkyrB7d 23hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zqmUyKoJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ss27si13729350ejb.322.2021.03.23.07.06.10; Tue, 23 Mar 2021 07:06:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zqmUyKoJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232132AbhCWOCC (ORCPT + 99 others); Tue, 23 Mar 2021 10:02:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232076AbhCWOBe (ORCPT ); Tue, 23 Mar 2021 10:01:34 -0400 Received: from mail-ua1-x92e.google.com (mail-ua1-x92e.google.com [IPv6:2607:f8b0:4864:20::92e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E59A9C061574 for ; Tue, 23 Mar 2021 07:01:33 -0700 (PDT) Received: by mail-ua1-x92e.google.com with SMTP id g5so6708060uan.8 for ; Tue, 23 Mar 2021 07:01:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=EFM8vj54tYKb1Jf8bEnuuvv/LY9C1ofZG/2jctBPMnI=; b=zqmUyKoJFPC8TdMrKTiIDMwIaUgF9x15Z+0hCvB4ZRJFRt86l737p/WyEUPJYTATkP g8NN5+n4vYOXnyjS50D/et/YnT7b5vq4Netv/bp1hgbau1DWDUnlXsIdXClA6mdRwPEb JAgSB9/am/t5ifJw0YMb/8jIM+WHoY6/KTi9hwfhW+J+mO7e7OY0Nr2vb42L7uRPoOz+ 3A9K0jkts+XWogYM8oWCO2U4h3kXwsvZwkF2fnTV6uJAQfIo7zIoGMuanyJpcq+Bhh9w BJ0b7YiOqQl8Zn0AJy2wCie7GTrMIJERWIQodppGLzdwNcsO1faV0tEtC/5+IPQuDgF+ y2cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=EFM8vj54tYKb1Jf8bEnuuvv/LY9C1ofZG/2jctBPMnI=; b=RVYy6hRDqq42pkRGjeTYyF0qUV0vWOLdnnaanXVuCTIBgHqCuZd1zUZibrpuIr8VMp sOczu3GN6ZqIrwJBrjAqsJoNKS/Of9xwQQ59Rq8NZmsvn5VquwRJ13pjnNu8cdQLrNrx 5cE5mzCCazew5CQEw6Us7rfnweUyYtKLGakvPIOqCv49zy8+a4rREObdhT2juHDRR5ij DKODPwiQ+A9SXL+zxjNLlZp7zh1GZUWptqTo+tB6OsKd9Gr980HzzM5XiKT2zRsU4Dbe X2l32cLWtGesOEAX5YIKGEFnG2ezUR2BnnPCcVMW3Sp0usbxIuBg0mzvzZmUcH6kxlZz N7+A== X-Gm-Message-State: AOAM531HLMEJH+PgAbhHG9VPSwdTHEMr/YNjYhb/7nwyP6Li9wSK+Z5R 7Dl7Ne0QvEGeF0SIj1bAsFATl73aDVtRxt7nmFZO3w== X-Received: by 2002:ab0:7a68:: with SMTP id c8mr3397238uat.104.1616508093043; Tue, 23 Mar 2021 07:01:33 -0700 (PDT) MIME-Version: 1.0 References: <20210320045720.11872-1-chgokhl@gmail.com> In-Reply-To: From: Ulf Hansson Date: Tue, 23 Mar 2021 15:00:56 +0100 Message-ID: Subject: Re: [PATCH] mmc: core: Mark mmc_host device with pm_runtime_no_callbacks To: chgokhl@163.com Cc: linux-mmc , Linux Kernel Mailing List , kehuanlin@fishsemi.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 23 Mar 2021 at 11:49, hieagle wrote: > > We encounter a resume issue in our device sometimes. The mmc device's > parent list is > mmc0:0001->mmc_host mmc0->fa630000.mmc->soc in our soc. We found in the b= low > case with mmc0->power.disable_depth=3D0 the mmc_runtime_resume will be sk= ipped, > which cause subsequent mmc command fail. > > mmc_get_card(mmc0:0001)->pm_runtime_get_sync->rpm_resume(mmc0:0001)->rpm_= resume(mmc0) > The rpm_resume(mmc0) return -ENOSYS due to no callback and > mmc0->power.runtime_status > keep RPM_SUSPENDED. This lead to rpm_resume(mmc0:0001) return -EBUSY and = skip > rpm_callback which call mmc_runtime_resume, the mmc is still in > suspended and the > subsequent mmc command fail. > > [ 198.856157] Call trace: > [ 198.858917] [] dump_backtrace+0x0/0x1cc > [ 198.864966] [] show_stack+0x14/0x1c > [ 198.870627] [] dump_stack+0xa8/0xe0 > [ 198.876288] [] rpm_resume+0x850/0x938 > [ 198.882141] [] rpm_resume+0x250/0x938 > [ 198.887994] [] __pm_runtime_resume+0x50/0x74 > [ 198.894530] [] mmc_get_card+0x3c/0xb8 > [ 198.900388] [] mmc_blk_issue_rq+0x2b0/0x4d8 > [ 198.906824] [] mmc_queue_thread+0xdc/0x198 > [ 198.913165] [] kthread+0xec/0x100 > [ 198.918632] [] ret_from_fork+0x10/0x40 > [ 198.924582] mmc0 callback (null) > [ 198.935837] mmcblk mmc0:0001: __pm_runtime_resume ret -16 > > Mark mmc_host device with pm_runtime_no_callbacks will solve the issue. > Thanks. > Huanlin Ke Thanks for sharing more details! I have to admit, that this sounds quite weird to me. I wonder if this is a problem that deserves to be fixed in the runtime PM core.... Let me have a closer look a get back to you again. Please be patient though, I have a busy week in front of me. Kind regards Uffe > > Ulf Hansson =E4=BA=8E2021=E5=B9=B43=E6=9C=8822= =E6=97=A5=E5=91=A8=E4=B8=80 =E4=B8=8B=E5=8D=886:26=E5=86=99=E9=81=93=EF=BC= =9A > > > > On Sat, 20 Mar 2021 at 05:57, kehuanlin wrote: > > > > > > The rpm_resume() will call parent's resume callback recursively. > > > Since mmc_host has no its own pm_runtime callbacks, the mmc devices > > > may fail to resume (-ENOSYS in rpm_callback) sometimes. Mark mmc_host > > > device with pm_runtime_no_callbacks can fix the issue. > > > > Can you please elaborate more on this? What do you mean by "sometimes"? > > > > More precisely, how do you trigger the rpm_callback() for mmc class > > device to return -ENOSYS? > > > > Don't get me wrong, the patch is fine, but I want to understand if it > > actually solves a problem for you - or that it's better considered as > > an optimization? > > > > Kind regards > > Uffe > > > > > > > > Signed-off-by: kehuanlin > > > --- > > > drivers/mmc/core/host.c | 2 ++ > > > 1 file changed, 2 insertions(+) > > > > > > diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c > > > index 9b89a91b6b47..177bebd9a6c4 100644 > > > --- a/drivers/mmc/core/host.c > > > +++ b/drivers/mmc/core/host.c > > > @@ -15,6 +15,7 @@ > > > #include > > > #include > > > #include > > > +#include > > > #include > > > #include > > > #include > > > @@ -480,6 +481,7 @@ struct mmc_host *mmc_alloc_host(int extra, struct= device *dev) > > > host->class_dev.class =3D &mmc_host_class; > > > device_initialize(&host->class_dev); > > > device_enable_async_suspend(&host->class_dev); > > > + pm_runtime_no_callbacks(&host->class_dev); > > > > > > if (mmc_gpio_alloc(host)) { > > > put_device(&host->class_dev); > > > -- > > > 2.30.0 > > >