Hi Wolfram-san, Ulrich-san,
> From: Wolfram Sang, Sent: Saturday, July 31, 2021 12:28 AM
>
> On Fri, May 14, 2021 at 05:53:18PM +0200, Ulrich Hecht wrote:
> > The TMIO core sets a very low latency limit (100 us), but when using R-Car
> > SDHI hosts with SD cards, I have observed typical latencies of around 20-30
> > ms. This prevents runtime PM from working properly, and the devices remain
> > on continuously.
> >
> > This patch sets the default latency limit to 100 ms to avoid that.
> >
> > Signed-off-by: Ulrich Hecht <uli+renesas@xxxxxxxx>
>
> Adding Shimoda-san to CC.
>
> Shimoda-san: can you kindly run your SDHI tests with this patch applied?
Sure!
However, I have a question about this patch.
Would you know how to measure the latencies?
I enabled function trace of rpm and checked the log, but I could not observe
any behavior changes with and without applying this patch.
---
echo 1 > /sys/kernel/debug/tracing/events/rpm/enable
dd if=/dev/mmcblk1 of=/dev/null bs=4k count=1
cat /sys/kernel/debug/tracing/trace
# /root/trace/read.sh
# tracer: nop
#
# entries-in-buffer/entries-written: 36/36 #P:8
#
# _-----=> irqs-off
# / _----=> need-resched
# | / _---=> hardirq/softirq
# || / _--=> preempt-depth
# ||| / delay
# TASK-PID CPU# |||| TIMESTAMP FUNCTION
# | | | |||| | |
kworker/4:1H-307 [004] d..1 125.845356: rpm_resume: mmc0:0001 flags-4 cnt-1 dep-0 auto-1 p-0 irq-0 child-0
kworker/4:1H-307 [004] d..1 125.845401: rpm_resume: ee140000.mmc flags-4 cnt-1 dep-0 auto-1 p-0 irq-0 child-0
kworker/4:1H-307 [004] d..1 125.867766: rpm_idle: ee140000.mmc flags-1 cnt-1 dep-0 auto-1 p-0 irq-0 child-0
kworker/4:1H-307 [004] d..1 125.867774: rpm_return_int: rpm_idle+0x40/0x3d0:ee140000.mmc ret=-11
kworker/4:1H-307 [004] d..1 125.867785: rpm_idle: soc flags-5 cnt-0 dep-1 auto-1 p-0 irq-0 child-27
kworker/4:1H-307 [004] d..1 125.867788: rpm_return_int: rpm_idle+0x40/0x3d0:soc ret=-13
kworker/4:1H-307 [004] d..1 125.867796: rpm_return_int: rpm_resume+0x124/0x6d8:ee140000.mmc ret=0
kworker/4:1H-307 [004] d..1 125.867819: rpm_suspend: ee140000.mmc flags-d cnt-0 dep-0 auto-1 p-0 irq-0 child-0
kworker/4:1H-307 [004] d..1 125.867948: rpm_return_int: rpm_suspend+0x150/0x620:ee140000.mmc ret=0
kworker/4:1H-307 [004] d..1 125.867962: rpm_idle: mmc0:0001 flags-1 cnt-1 dep-0 auto-1 p-0 irq-0 child-0
kworker/4:1H-307 [004] d..1 125.867965: rpm_return_int: rpm_idle+0x40/0x3d0:mmc0:0001 ret=-11
kworker/4:1H-307 [004] d..1 125.867974: rpm_idle: mmc0 flags-5 cnt-0 dep-1 auto-1 p-0 irq-0 child-1
kworker/4:1H-307 [004] d..1 125.867978: rpm_return_int: rpm_idle+0x40/0x3d0:mmc0 ret=-13
kworker/4:1H-307 [004] d..1 125.867985: rpm_return_int: rpm_resume+0x124/0x6d8:mmc0:0001 ret=0
kworker/4:1H-307 [004] d..1 125.868009: rpm_resume: ee140000.mmc flags-4 cnt-1 dep-0 auto-1 p-0 irq-0 child-0
kworker/4:1H-307 [004] d..1 125.868013: rpm_return_int: rpm_resume+0x124/0x6d8:ee140000.mmc ret=1
kworker/0:1H-295 [000] d..1 125.879823: rpm_suspend: ee140000.mmc flags-d cnt-0 dep-0 auto-1 p-0 irq-0 child-0
kworker/0:1H-295 [000] d..1 125.879833: rpm_return_int: rpm_suspend+0x150/0x620:ee140000.mmc ret=0
kworker/0:1H-295 [000] d..1 125.879843: rpm_suspend: mmc0:0001 flags-d cnt-0 dep-0 auto-1 p-0 irq-0 child-0
kworker/0:1H-295 [000] d..1 125.879856: rpm_return_int: rpm_suspend+0x150/0x620:mmc0:0001 ret=0
kworker/4:1H-307 [004] d..1 125.880562: rpm_resume: mmc0:0001 flags-4 cnt-1 dep-0 auto-1 p-0 irq-0 child-0
kworker/4:1H-307 [004] d..1 125.880569: rpm_return_int: rpm_resume+0x124/0x6d8:mmc0:0001 ret=1
kworker/4:1H-307 [004] d..1 125.880591: rpm_resume: ee140000.mmc flags-4 cnt-1 dep-0 auto-1 p-0 irq-0 child-0
kworker/4:1H-307 [004] d..1 125.880594: rpm_return_int: rpm_resume+0x124/0x6d8:ee140000.mmc ret=1
kworker/0:1H-295 [000] d..1 125.883242: rpm_suspend: ee140000.mmc flags-d cnt-0 dep-0 auto-1 p-0 irq-0 child-0
kworker/0:1H-295 [000] d..1 125.883249: rpm_return_int: rpm_suspend+0x150/0x620:ee140000.mmc ret=0
kworker/0:1H-295 [000] d..1 125.883258: rpm_suspend: mmc0:0001 flags-d cnt-0 dep-0 auto-1 p-0 irq-0 child-0
kworker/0:1H-295 [000] d..1 125.883262: rpm_return_int: rpm_suspend+0x150/0x620:mmc0:0001 ret=0
<idle>-0 [004] d.h2 125.928997: rpm_suspend: ee140000.mmc flags-9 cnt-0 dep-0 auto-1 p-0 irq-0 child-0
<idle>-0 [004] d.h2 125.929015: rpm_return_int: rpm_suspend+0x150/0x620:ee140000.mmc ret=0
<idle>-0 [004] d.h2 125.945766: rpm_suspend: ee140000.mmc flags-9 cnt-0 dep-0 auto-1 p-0 irq-0 child-0
<idle>-0 [004] dNh2 125.945808: rpm_return_int: rpm_suspend+0x150/0x620:ee140000.mmc ret=0
kworker/4:2-361 [004] d..1 125.945872: rpm_suspend: ee140000.mmc flags-a cnt-0 dep-0 auto-1 p-0 irq-0 child-0
kworker/4:2-361 [004] d..1 125.945956: rpm_idle: soc flags-1 cnt-0 dep-1 auto-1 p-0 irq-0 child-26
kworker/4:2-361 [004] d..1 125.945960: rpm_return_int: rpm_idle+0x40/0x3d0:soc ret=-13
kworker/4:2-361 [004] d..1 125.945966: rpm_return_int: rpm_suspend+0x150/0x620:ee140000.mmc ret=0
---
Best regards,
Yoshihiro Shimoda
> That would be very kind, thank you!
>
> > ---
> > drivers/mmc/host/renesas_sdhi_core.c | 4 ++++
> > 1 file changed, 4 insertions(+)
> >
> > diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c
> > index 635bf31a6735..4f41616cc6bb 100644
> > --- a/drivers/mmc/host/renesas_sdhi_core.c
> > +++ b/drivers/mmc/host/renesas_sdhi_core.c
> > @@ -32,6 +32,7 @@
> > #include <linux/pinctrl/pinctrl-state.h>
> > #include <linux/platform_device.h>
> > #include <linux/pm_domain.h>
> > +#include <linux/pm_qos.h>
> > #include <linux/regulator/consumer.h>
> > #include <linux/reset.h>
> > #include <linux/sh_dma.h>
> > @@ -1147,6 +1148,9 @@ int renesas_sdhi_probe(struct platform_device *pdev,
> > host->ops.hs400_complete = renesas_sdhi_hs400_complete;
> > }
> >
> > + /* keep tmio_mmc_host_probe() from setting latency limit too low */
> > + dev_pm_qos_expose_latency_limit(&pdev->dev, 100000);
> > +
> > ret = tmio_mmc_host_probe(host);
> > if (ret < 0)
> > goto edisclk;
> > --
> > 2.20.1
> >