linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] dmaengine: usb-dmac: Runtime PM Related Fixes
@ 2015-10-01  7:22 Geert Uytterhoeven
  2015-10-01  7:22 ` [PATCH 1/2] dmaengine: usb-dmac: Fix crash on runtime suspend Geert Uytterhoeven
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Geert Uytterhoeven @ 2015-10-01  7:22 UTC (permalink / raw)
  To: Vinod Koul, Yoshihiro Shimoda
  Cc: Sergei Shtylyov, dmaengine, linux-sh, linux-pm,
	Geert Uytterhoeven

	Hi Vinod, Shimoda-san,

This series fixes a crash and an imbalance in the usb-dmac driver.

Geert Uytterhoeven (2):
  dmaengine: usb-dmac: Fix crash on runtime suspend
  dmaengine: usb-dmac: Fix pm_runtime_{enable,disable}() imbalance

 drivers/dma/sh/usb-dmac.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

-- 
1.9.1

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 1/2] dmaengine: usb-dmac: Fix crash on runtime suspend
  2015-10-01  7:22 [PATCH 0/2] dmaengine: usb-dmac: Runtime PM Related Fixes Geert Uytterhoeven
@ 2015-10-01  7:22 ` Geert Uytterhoeven
  2015-10-01 10:53   ` Yoshihiro Shimoda
  2015-10-01  7:22 ` [PATCH 2/2] dmaengine: usb-dmac: Fix pm_runtime_{enable,disable}() imbalance Geert Uytterhoeven
  2015-10-07 14:01 ` [PATCH 0/2] dmaengine: usb-dmac: Runtime PM Related Fixes Vinod Koul
  2 siblings, 1 reply; 12+ messages in thread
From: Geert Uytterhoeven @ 2015-10-01  7:22 UTC (permalink / raw)
  To: Vinod Koul, Yoshihiro Shimoda
  Cc: Sergei Shtylyov, dmaengine, linux-sh, linux-pm,
	Geert Uytterhoeven

If CONFIG_PREEMPT=y:

    Unable to handle kernel NULL pointer dereference at virtual address 00000014
    pgd = c0003000
    [00000014] *pgd€000040004003, *pmd\0000000
    Internal error: Oops: 206 [#1] PREEMPT SMP ARM
    Modules linked in:
    CPU: 0 PID: 17 Comm: kworker/0:1 Tainted: G        W       4.3.0-rc3-koelsch-022
    71-g705498fc5e6a5da8-dirty #1789
    Hardware name: Generic R8A7791 (Flattened Device Tree)
    Workqueue: pm pm_runtime_work
    task: ef578e40 ti: ef57a000 task.ti: ef57a000
    PC is at usb_dmac_chan_halt+0xc/0xc0
    LR is at usb_dmac_runtime_suspend+0x28/0x38
    pc : [<c023c880>]    lr : [<c023c95c>]    psr: 80000113
    sp : ef57bdf8  ip : 00000008  fp : 00000003
    r10: 00000008  r9 : c06ab928  r8 : ef49e810
    r7 : 00000000  r6 : 000000ac  r5 : ef770010  r4 : 00000000
    r3 : 00000000  r2 : 8ffc2b84  r1 : 00000000  r0 : ef770010
    Flags: Nzcv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
    Control: 30c5307d  Table: 40003000  DAC: fffffffd
    Process kworker/0:1 (pid: 17, stack limit = 0xef57a210)
    Stack: (0xef57bdf8 to 0xef57c000)

    [...

    [<c023c880>] (usb_dmac_chan_halt) from [<c023c95c>] (usb_dmac_runtime_suspend+0x28/0x38)
    [<c023c95c>] (usb_dmac_runtime_suspend) from [<c027b25c>] (pm_genpd_runtime_suspend+0x74/0x23c)

This happens because usb_dmac_probe() calls pm_runtime_put() before
usb_dmac_chan_probe(), leading to the device being suspended before the
DMA channels are initialized, causing a NULL pointer dereference.

Move the call to pm_runtime_put() to the end of usb_dmac_probe() to fix
this.

Add a check to usb_dmac_runtime_suspend() to prevent the crash from
happening in the error path.

Reported-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/dma/sh/usb-dmac.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/sh/usb-dmac.c b/drivers/dma/sh/usb-dmac.c
index ebd8a5f398b08ee2..f305738b5adf8cc9 100644
--- a/drivers/dma/sh/usb-dmac.c
+++ b/drivers/dma/sh/usb-dmac.c
@@ -679,8 +679,11 @@ static int usb_dmac_runtime_suspend(struct device *dev)
 	struct usb_dmac *dmac = dev_get_drvdata(dev);
 	int i;
 
-	for (i = 0; i < dmac->n_channels; ++i)
+	for (i = 0; i < dmac->n_channels; ++i) {
+		if (!dmac->channels[i].iomem)
+			break;
 		usb_dmac_chan_halt(&dmac->channels[i]);
+	}
 
 	return 0;
 }
@@ -803,7 +806,6 @@ static int usb_dmac_probe(struct platform_device *pdev)
 	}
 
 	ret = usb_dmac_init(dmac);
-	pm_runtime_put(&pdev->dev);
 
 	if (ret) {
 		dev_err(&pdev->dev, "failed to reset device\n");
@@ -851,10 +853,12 @@ static int usb_dmac_probe(struct platform_device *pdev)
 	if (ret < 0)
 		goto error;
 
+	pm_runtime_put(&pdev->dev);
 	return 0;
 
 error:
 	of_dma_controller_free(pdev->dev.of_node);
+	pm_runtime_put(&pdev->dev);
 	pm_runtime_disable(&pdev->dev);
 	return ret;
 }
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 2/2] dmaengine: usb-dmac: Fix pm_runtime_{enable,disable}() imbalance
  2015-10-01  7:22 [PATCH 0/2] dmaengine: usb-dmac: Runtime PM Related Fixes Geert Uytterhoeven
  2015-10-01  7:22 ` [PATCH 1/2] dmaengine: usb-dmac: Fix crash on runtime suspend Geert Uytterhoeven
@ 2015-10-01  7:22 ` Geert Uytterhoeven
  2015-10-07 14:01 ` [PATCH 0/2] dmaengine: usb-dmac: Runtime PM Related Fixes Vinod Koul
  2 siblings, 0 replies; 12+ messages in thread
From: Geert Uytterhoeven @ 2015-10-01  7:22 UTC (permalink / raw)
  To: Vinod Koul, Yoshihiro Shimoda
  Cc: Sergei Shtylyov, dmaengine, linux-sh, linux-pm,
	Geert Uytterhoeven

If the call to pm_runtime_get_sync() failed, Runtime PM was left
enabled.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/dma/sh/usb-dmac.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/dma/sh/usb-dmac.c b/drivers/dma/sh/usb-dmac.c
index f305738b5adf8cc9..f1bcc2a163b30cef 100644
--- a/drivers/dma/sh/usb-dmac.c
+++ b/drivers/dma/sh/usb-dmac.c
@@ -802,7 +802,7 @@ static int usb_dmac_probe(struct platform_device *pdev)
 	ret = pm_runtime_get_sync(&pdev->dev);
 	if (ret < 0) {
 		dev_err(&pdev->dev, "runtime PM get sync failed (%d)\n", ret);
-		return ret;
+		goto error_pm;
 	}
 
 	ret = usb_dmac_init(dmac);
@@ -859,6 +859,7 @@ static int usb_dmac_probe(struct platform_device *pdev)
 error:
 	of_dma_controller_free(pdev->dev.of_node);
 	pm_runtime_put(&pdev->dev);
+error_pm:
 	pm_runtime_disable(&pdev->dev);
 	return ret;
 }
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* RE: [PATCH 1/2] dmaengine: usb-dmac: Fix crash on runtime suspend
  2015-10-01  7:22 ` [PATCH 1/2] dmaengine: usb-dmac: Fix crash on runtime suspend Geert Uytterhoeven
@ 2015-10-01 10:53   ` Yoshihiro Shimoda
  2015-10-01 12:26     ` Sergei Shtylyov
  0 siblings, 1 reply; 12+ messages in thread
From: Yoshihiro Shimoda @ 2015-10-01 10:53 UTC (permalink / raw)
  To: Geert Uytterhoeven, Vinod Koul
  Cc: Sergei Shtylyov, dmaengine@vger.kernel.org,
	linux-sh@vger.kernel.org, linux-pm@vger.kernel.org

Hi Geert-san,

> Sent: Thursday, October 01, 2015 4:22 PM
> 
> If CONFIG_PREEMPT=y:
> 
>     Unable to handle kernel NULL pointer dereference at virtual address 00000014
>     pgd = c0003000
>     [00000014] *pgd€000040004003, *pmd\0000000
>     Internal error: Oops: 206 [#1] PREEMPT SMP ARM
>     Modules linked in:
>     CPU: 0 PID: 17 Comm: kworker/0:1 Tainted: G        W       4.3.0-rc3-koelsch-022
>     71-g705498fc5e6a5da8-dirty #1789
>     Hardware name: Generic R8A7791 (Flattened Device Tree)
>     Workqueue: pm pm_runtime_work
>     task: ef578e40 ti: ef57a000 task.ti: ef57a000
>     PC is at usb_dmac_chan_halt+0xc/0xc0
>     LR is at usb_dmac_runtime_suspend+0x28/0x38
>     pc : [<c023c880>]    lr : [<c023c95c>]    psr: 80000113
>     sp : ef57bdf8  ip : 00000008  fp : 00000003
>     r10: 00000008  r9 : c06ab928  r8 : ef49e810
>     r7 : 00000000  r6 : 000000ac  r5 : ef770010  r4 : 00000000
>     r3 : 00000000  r2 : 8ffc2b84  r1 : 00000000  r0 : ef770010
>     Flags: Nzcv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
>     Control: 30c5307d  Table: 40003000  DAC: fffffffd
>     Process kworker/0:1 (pid: 17, stack limit = 0xef57a210)
>     Stack: (0xef57bdf8 to 0xef57c000)
> 
>     [...
> 
>     [<c023c880>] (usb_dmac_chan_halt) from [<c023c95c>] (usb_dmac_runtime_suspend+0x28/0x38)
>     [<c023c95c>] (usb_dmac_runtime_suspend) from [<c027b25c>] (pm_genpd_runtime_suspend+0x74/0x23c)
> 
> This happens because usb_dmac_probe() calls pm_runtime_put() before
> usb_dmac_chan_probe(), leading to the device being suspended before the
> DMA channels are initialized, causing a NULL pointer dereference.
> 
> Move the call to pm_runtime_put() to the end of usb_dmac_probe() to fix
> this.
> 
> Add a check to usb_dmac_runtime_suspend() to prevent the crash from
> happening in the error path.
> 
> Reported-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

I could not duplicate this issue completely on Lager.
Even if I enabled ealyprintk, I didn't see the panic log.
(Several kernel message appeared, and then the kernel hung.)

Anyway, I tested this patch that kernel could boot correctly even if CONFIG_PREEMPT=y.
So,
Tested-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

Best regards,
Yoshihiro Shimoda

> ---
>  drivers/dma/sh/usb-dmac.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/dma/sh/usb-dmac.c b/drivers/dma/sh/usb-dmac.c
> index ebd8a5f398b08ee2..f305738b5adf8cc9 100644
> --- a/drivers/dma/sh/usb-dmac.c
> +++ b/drivers/dma/sh/usb-dmac.c
> @@ -679,8 +679,11 @@ static int usb_dmac_runtime_suspend(struct device *dev)
>  	struct usb_dmac *dmac = dev_get_drvdata(dev);
>  	int i;
> 
> -	for (i = 0; i < dmac->n_channels; ++i)
> +	for (i = 0; i < dmac->n_channels; ++i) {
> +		if (!dmac->channels[i].iomem)
> +			break;
>  		usb_dmac_chan_halt(&dmac->channels[i]);
> +	}
> 
>  	return 0;
>  }
> @@ -803,7 +806,6 @@ static int usb_dmac_probe(struct platform_device *pdev)
>  	}
> 
>  	ret = usb_dmac_init(dmac);
> -	pm_runtime_put(&pdev->dev);
> 
>  	if (ret) {
>  		dev_err(&pdev->dev, "failed to reset device\n");
> @@ -851,10 +853,12 @@ static int usb_dmac_probe(struct platform_device *pdev)
>  	if (ret < 0)
>  		goto error;
> 
> +	pm_runtime_put(&pdev->dev);
>  	return 0;
> 
>  error:
>  	of_dma_controller_free(pdev->dev.of_node);
> +	pm_runtime_put(&pdev->dev);
>  	pm_runtime_disable(&pdev->dev);
>  	return ret;
>  }
> --
> 1.9.1


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/2] dmaengine: usb-dmac: Fix crash on runtime suspend
  2015-10-01 10:53   ` Yoshihiro Shimoda
@ 2015-10-01 12:26     ` Sergei Shtylyov
  2015-10-02  1:00       ` Yoshihiro Shimoda
  0 siblings, 1 reply; 12+ messages in thread
From: Sergei Shtylyov @ 2015-10-01 12:26 UTC (permalink / raw)
  To: Yoshihiro Shimoda, Geert Uytterhoeven, Vinod Koul
  Cc: dmaengine@vger.kernel.org, linux-sh@vger.kernel.org,
	linux-pm@vger.kernel.org

Hello.

On 10/1/2015 1:53 PM, Yoshihiro Shimoda wrote:

>> If CONFIG_PREEMPT=y:

    Actually, it happens even with CONFIG_PREEMPT_VOLUNTARY=y.

>>      Unable to handle kernel NULL pointer dereference at virtual address 00000014
>>      pgd = c0003000
>>      [00000014] *pgd€000040004003, *pmd\0000000
>>      Internal error: Oops: 206 [#1] PREEMPT SMP ARM
>>      Modules linked in:
>>      CPU: 0 PID: 17 Comm: kworker/0:1 Tainted: G        W       4.3.0-rc3-koelsch-022
>>      71-g705498fc5e6a5da8-dirty #1789
>>      Hardware name: Generic R8A7791 (Flattened Device Tree)
>>      Workqueue: pm pm_runtime_work
>>      task: ef578e40 ti: ef57a000 task.ti: ef57a000
>>      PC is at usb_dmac_chan_halt+0xc/0xc0
>>      LR is at usb_dmac_runtime_suspend+0x28/0x38
>>      pc : [<c023c880>]    lr : [<c023c95c>]    psr: 80000113
>>      sp : ef57bdf8  ip : 00000008  fp : 00000003
>>      r10: 00000008  r9 : c06ab928  r8 : ef49e810
>>      r7 : 00000000  r6 : 000000ac  r5 : ef770010  r4 : 00000000
>>      r3 : 00000000  r2 : 8ffc2b84  r1 : 00000000  r0 : ef770010
>>      Flags: Nzcv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
>>      Control: 30c5307d  Table: 40003000  DAC: fffffffd
>>      Process kworker/0:1 (pid: 17, stack limit = 0xef57a210)
>>      Stack: (0xef57bdf8 to 0xef57c000)
>>
>>      [...
>>
>>      [<c023c880>] (usb_dmac_chan_halt) from [<c023c95c>] (usb_dmac_runtime_suspend+0x28/0x38)
>>      [<c023c95c>] (usb_dmac_runtime_suspend) from [<c027b25c>] (pm_genpd_runtime_suspend+0x74/0x23c)
>>
>> This happens because usb_dmac_probe() calls pm_runtime_put() before
>> usb_dmac_chan_probe(), leading to the device being suspended before the
>> DMA channels are initialized, causing a NULL pointer dereference.
>>
>> Move the call to pm_runtime_put() to the end of usb_dmac_probe() to fix
>> this.
>>
>> Add a check to usb_dmac_runtime_suspend() to prevent the crash from
>> happening in the error path.
>>
>> Reported-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
>> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
>
> I could not duplicate this issue completely on Lager.
> Even if I enabled ealyprintk, I didn't see the panic log.
> (Several kernel message appeared, and then the kernel hung.)

    I guess you also need to specify console=. The device tree console 
assignment (from the "stdout-path" prop) happens too late, the console gets 
switched to /dev/tty0 first. I forgot to mention that the pseudo-console 
(CONFIG_VT) should be disabled as well.

> Anyway, I tested this patch that kernel could boot correctly even if CONFIG_PREEMPT=y.
> So,
> Tested-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

    Thank you. :-)

> Best regards,
> Yoshihiro Shimoda

MBR, Sergei


^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: [PATCH 1/2] dmaengine: usb-dmac: Fix crash on runtime suspend
  2015-10-01 12:26     ` Sergei Shtylyov
@ 2015-10-02  1:00       ` Yoshihiro Shimoda
  2015-10-02 10:54         ` Sergei Shtylyov
  0 siblings, 1 reply; 12+ messages in thread
From: Yoshihiro Shimoda @ 2015-10-02  1:00 UTC (permalink / raw)
  To: Sergei Shtylyov, Geert Uytterhoeven, Vinod Koul
  Cc: dmaengine@vger.kernel.org, linux-sh@vger.kernel.org,
	linux-pm@vger.kernel.org

Hi Sergei-san,

> Sent: Thursday, October 01, 2015 9:27 PM
> 
> Hello.
> 
> On 10/1/2015 1:53 PM, Yoshihiro Shimoda wrote:
> 
> >> If CONFIG_PREEMPT=y:
> 
>     Actually, it happens even with CONFIG_PREEMPT_VOLUNTARY=y.
> 
> >>      Unable to handle kernel NULL pointer dereference at virtual address 00000014
> >>      pgd = c0003000
> >>      [00000014] *pgd€000040004003, *pmd\0000000
> >>      Internal error: Oops: 206 [#1] PREEMPT SMP ARM
> >>      Modules linked in:
> >>      CPU: 0 PID: 17 Comm: kworker/0:1 Tainted: G        W       4.3.0-rc3-koelsch-022
> >>      71-g705498fc5e6a5da8-dirty #1789
> >>      Hardware name: Generic R8A7791 (Flattened Device Tree)
> >>      Workqueue: pm pm_runtime_work
> >>      task: ef578e40 ti: ef57a000 task.ti: ef57a000
> >>      PC is at usb_dmac_chan_halt+0xc/0xc0
> >>      LR is at usb_dmac_runtime_suspend+0x28/0x38
> >>      pc : [<c023c880>]    lr : [<c023c95c>]    psr: 80000113
> >>      sp : ef57bdf8  ip : 00000008  fp : 00000003
> >>      r10: 00000008  r9 : c06ab928  r8 : ef49e810
> >>      r7 : 00000000  r6 : 000000ac  r5 : ef770010  r4 : 00000000
> >>      r3 : 00000000  r2 : 8ffc2b84  r1 : 00000000  r0 : ef770010
> >>      Flags: Nzcv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
> >>      Control: 30c5307d  Table: 40003000  DAC: fffffffd
> >>      Process kworker/0:1 (pid: 17, stack limit = 0xef57a210)
> >>      Stack: (0xef57bdf8 to 0xef57c000)
> >>
> >>      [...
> >>
> >>      [<c023c880>] (usb_dmac_chan_halt) from [<c023c95c>] (usb_dmac_runtime_suspend+0x28/0x38)
> >>      [<c023c95c>] (usb_dmac_runtime_suspend) from [<c027b25c>] (pm_genpd_runtime_suspend+0x74/0x23c)
> >>
> >> This happens because usb_dmac_probe() calls pm_runtime_put() before
> >> usb_dmac_chan_probe(), leading to the device being suspended before the
> >> DMA channels are initialized, causing a NULL pointer dereference.
> >>
> >> Move the call to pm_runtime_put() to the end of usb_dmac_probe() to fix
> >> this.
> >>
> >> Add a check to usb_dmac_runtime_suspend() to prevent the crash from
> >> happening in the error path.
> >>
> >> Reported-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
> >> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> >
> > I could not duplicate this issue completely on Lager.
> > Even if I enabled ealyprintk, I didn't see the panic log.
> > (Several kernel message appeared, and then the kernel hung.)
> 
>     I guess you also need to specify console=. The device tree console
> assignment (from the "stdout-path" prop) happens too late, the console gets
> switched to /dev/tty0 first. I forgot to mention that the pseudo-console
> (CONFIG_VT) should be disabled as well.

Thank you for your comment!
I was able to look the panic log if I added specify console= in the bootargs.
(Even if CONFIG_VT=y, the log appeared.)

> > Anyway, I tested this patch that kernel could boot correctly even if CONFIG_PREEMPT=y.
> > So,
> > Tested-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> 
>     Thank you. :-)

You're welcome! And, thank you for the report.

Best regards,
Yoshihiro Shimoda

> > Best regards,
> > Yoshihiro Shimoda
> 
> MBR, Sergei
> 
> --
> To unsubscribe from this list: send the line "unsubscribe dmaengine" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/2] dmaengine: usb-dmac: Fix crash on runtime suspend
  2015-10-02  1:00       ` Yoshihiro Shimoda
@ 2015-10-02 10:54         ` Sergei Shtylyov
  0 siblings, 0 replies; 12+ messages in thread
From: Sergei Shtylyov @ 2015-10-02 10:54 UTC (permalink / raw)
  To: Yoshihiro Shimoda, Geert Uytterhoeven, Vinod Koul
  Cc: dmaengine@vger.kernel.org, linux-sh@vger.kernel.org,
	linux-pm@vger.kernel.org

Hello.

On 10/2/2015 4:00 AM, Yoshihiro Shimoda wrote:

>>>> If CONFIG_PREEMPT=y:
>>
>>      Actually, it happens even with CONFIG_PREEMPT_VOLUNTARY=y.
>>
>>>>       Unable to handle kernel NULL pointer dereference at virtual address 00000014
>>>>       pgd = c0003000
>>>>       [00000014] *pgd€000040004003, *pmd\0000000
>>>>       Internal error: Oops: 206 [#1] PREEMPT SMP ARM
>>>>       Modules linked in:
>>>>       CPU: 0 PID: 17 Comm: kworker/0:1 Tainted: G        W       4.3.0-rc3-koelsch-022
>>>>       71-g705498fc5e6a5da8-dirty #1789
>>>>       Hardware name: Generic R8A7791 (Flattened Device Tree)
>>>>       Workqueue: pm pm_runtime_work
>>>>       task: ef578e40 ti: ef57a000 task.ti: ef57a000
>>>>       PC is at usb_dmac_chan_halt+0xc/0xc0
>>>>       LR is at usb_dmac_runtime_suspend+0x28/0x38
>>>>       pc : [<c023c880>]    lr : [<c023c95c>]    psr: 80000113
>>>>       sp : ef57bdf8  ip : 00000008  fp : 00000003
>>>>       r10: 00000008  r9 : c06ab928  r8 : ef49e810
>>>>       r7 : 00000000  r6 : 000000ac  r5 : ef770010  r4 : 00000000
>>>>       r3 : 00000000  r2 : 8ffc2b84  r1 : 00000000  r0 : ef770010
>>>>       Flags: Nzcv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
>>>>       Control: 30c5307d  Table: 40003000  DAC: fffffffd
>>>>       Process kworker/0:1 (pid: 17, stack limit = 0xef57a210)
>>>>       Stack: (0xef57bdf8 to 0xef57c000)
>>>>
>>>>       [...
>>>>
>>>>       [<c023c880>] (usb_dmac_chan_halt) from [<c023c95c>] (usb_dmac_runtime_suspend+0x28/0x38)
>>>>       [<c023c95c>] (usb_dmac_runtime_suspend) from [<c027b25c>] (pm_genpd_runtime_suspend+0x74/0x23c)
>>>>
>>>> This happens because usb_dmac_probe() calls pm_runtime_put() before
>>>> usb_dmac_chan_probe(), leading to the device being suspended before the
>>>> DMA channels are initialized, causing a NULL pointer dereference.
>>>>
>>>> Move the call to pm_runtime_put() to the end of usb_dmac_probe() to fix
>>>> this.
>>>>
>>>> Add a check to usb_dmac_runtime_suspend() to prevent the crash from
>>>> happening in the error path.
>>>>
>>>> Reported-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
>>>> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
>>>
>>> I could not duplicate this issue completely on Lager.
>>> Even if I enabled ealyprintk, I didn't see the panic log.
>>> (Several kernel message appeared, and then the kernel hung.)
>>
>>      I guess you also need to specify console=. The device tree console
>> assignment (from the "stdout-path" prop) happens too late, the console gets
>> switched to /dev/tty0 first. I forgot to mention that the pseudo-console
>> (CONFIG_VT) should be disabled as well.
>
> Thank you for your comment!
> I was able to look the panic log if I added specify console= in the bootargs.
> (Even if CONFIG_VT=y, the log appeared.)

    Yeah, I got things somewhat mixed up, specifying console= alone should help.

MBR, Sergei


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 0/2] dmaengine: usb-dmac: Runtime PM Related Fixes
  2015-10-01  7:22 [PATCH 0/2] dmaengine: usb-dmac: Runtime PM Related Fixes Geert Uytterhoeven
  2015-10-01  7:22 ` [PATCH 1/2] dmaengine: usb-dmac: Fix crash on runtime suspend Geert Uytterhoeven
  2015-10-01  7:22 ` [PATCH 2/2] dmaengine: usb-dmac: Fix pm_runtime_{enable,disable}() imbalance Geert Uytterhoeven
@ 2015-10-07 14:01 ` Vinod Koul
  2015-10-16 13:10   ` Geert Uytterhoeven
  2 siblings, 1 reply; 12+ messages in thread
From: Vinod Koul @ 2015-10-07 14:01 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Yoshihiro Shimoda, Sergei Shtylyov, dmaengine, linux-sh, linux-pm

On Thu, Oct 01, 2015 at 09:22:16AM +0200, Geert Uytterhoeven wrote:
> 	Hi Vinod, Shimoda-san,
> 
> This series fixes a crash and an imbalance in the usb-dmac driver.

Sorry this fails for me, what was this generated against

-- 
~Vinod

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 0/2] dmaengine: usb-dmac: Runtime PM Related Fixes
  2015-10-07 14:01 ` [PATCH 0/2] dmaengine: usb-dmac: Runtime PM Related Fixes Vinod Koul
@ 2015-10-16 13:10   ` Geert Uytterhoeven
  2015-10-24 12:16     ` Vinod Koul
  0 siblings, 1 reply; 12+ messages in thread
From: Geert Uytterhoeven @ 2015-10-16 13:10 UTC (permalink / raw)
  To: Vinod Koul
  Cc: Geert Uytterhoeven, Yoshihiro Shimoda, Sergei Shtylyov, dmaengine,
	Linux-sh list, Linux PM list

Hi Vinod,

On Wed, Oct 7, 2015 at 4:01 PM, Vinod Koul <vinod.koul@intel.com> wrote:
> On Thu, Oct 01, 2015 at 09:22:16AM +0200, Geert Uytterhoeven wrote:
>>       Hi Vinod, Shimoda-san,
>>
>> This series fixes a crash and an imbalance in the usb-dmac driver.
>
> Sorry this fails for me, what was this generated against

Strange, this series still applies cleanly on top of slave-dma/next and
linus/master.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 0/2] dmaengine: usb-dmac: Runtime PM Related Fixes
  2015-10-16 13:10   ` Geert Uytterhoeven
@ 2015-10-24 12:16     ` Vinod Koul
  2015-10-24 17:59       ` Geert Uytterhoeven
  0 siblings, 1 reply; 12+ messages in thread
From: Vinod Koul @ 2015-10-24 12:16 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Geert Uytterhoeven, Yoshihiro Shimoda, Sergei Shtylyov, dmaengine,
	Linux-sh list, Linux PM list

On Fri, Oct 16, 2015 at 03:10:37PM +0200, Geert Uytterhoeven wrote:
> Hi Vinod,
> 
> On Wed, Oct 7, 2015 at 4:01 PM, Vinod Koul <vinod.koul@intel.com> wrote:
> > On Thu, Oct 01, 2015 at 09:22:16AM +0200, Geert Uytterhoeven wrote:
> >>       Hi Vinod, Shimoda-san,
> >>
> >> This series fixes a crash and an imbalance in the usb-dmac driver.
> >
> > Sorry this fails for me, what was this generated against
> 
> Strange, this series still applies cleanly on top of slave-dma/next and
> linus/master.

I think I applied this to a new topic branch off rc1. But anyway since I dont
have patches on usb-dma it should have been same :(

-- 
~Vinod

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 0/2] dmaengine: usb-dmac: Runtime PM Related Fixes
  2015-10-24 12:16     ` Vinod Koul
@ 2015-10-24 17:59       ` Geert Uytterhoeven
  2015-10-24 22:56         ` Vinod Koul
  0 siblings, 1 reply; 12+ messages in thread
From: Geert Uytterhoeven @ 2015-10-24 17:59 UTC (permalink / raw)
  To: Vinod Koul
  Cc: Geert Uytterhoeven, Yoshihiro Shimoda, Sergei Shtylyov, dmaengine,
	Linux-sh list, Linux PM list

Hi Vinod,

On Sat, Oct 24, 2015 at 2:04 PM, Vinod Koul <vinod.koul@intel.com> wrote:
> On Fri, Oct 16, 2015 at 03:10:37PM +0200, Geert Uytterhoeven wrote:
>> On Wed, Oct 7, 2015 at 4:01 PM, Vinod Koul <vinod.koul@intel.com> wrote:
>> > On Thu, Oct 01, 2015 at 09:22:16AM +0200, Geert Uytterhoeven wrote:
>> >> This series fixes a crash and an imbalance in the usb-dmac driver.
>> >
>> > Sorry this fails for me, what was this generated against
>>
>> Strange, this series still applies cleanly on top of slave-dma/next and
>> linus/master.
>
> I think I applied this to a new topic branch off rc1. But anyway since I dont
> have patches on usb-dma it should have been same :(

So how do we proceed?
Do you want me to resend the patches (they still apply to slave-dma/next)?

Thanks!

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 0/2] dmaengine: usb-dmac: Runtime PM Related Fixes
  2015-10-24 17:59       ` Geert Uytterhoeven
@ 2015-10-24 22:56         ` Vinod Koul
  0 siblings, 0 replies; 12+ messages in thread
From: Vinod Koul @ 2015-10-24 22:56 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Geert Uytterhoeven, Yoshihiro Shimoda, Sergei Shtylyov, dmaengine,
	Linux-sh list, Linux PM list

On Sat, Oct 24, 2015 at 07:59:11PM +0200, Geert Uytterhoeven wrote:
> Hi Vinod,
> 
> On Sat, Oct 24, 2015 at 2:04 PM, Vinod Koul <vinod.koul@intel.com> wrote:
> > On Fri, Oct 16, 2015 at 03:10:37PM +0200, Geert Uytterhoeven wrote:
> >> On Wed, Oct 7, 2015 at 4:01 PM, Vinod Koul <vinod.koul@intel.com> wrote:
> >> > On Thu, Oct 01, 2015 at 09:22:16AM +0200, Geert Uytterhoeven wrote:
> >> >> This series fixes a crash and an imbalance in the usb-dmac driver.
> >> >
> >> > Sorry this fails for me, what was this generated against
> >>
> >> Strange, this series still applies cleanly on top of slave-dma/next and
> >> linus/master.
> >
> > I think I applied this to a new topic branch off rc1. But anyway since I dont
> > have patches on usb-dma it should have been same :(
> 
> So how do we proceed?
> Do you want me to resend the patches (they still apply to slave-dma/next)?

Yes please and also as a backup can you push a branch with these...

-- 
~Vinod

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2015-10-24 22:56 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-01  7:22 [PATCH 0/2] dmaengine: usb-dmac: Runtime PM Related Fixes Geert Uytterhoeven
2015-10-01  7:22 ` [PATCH 1/2] dmaengine: usb-dmac: Fix crash on runtime suspend Geert Uytterhoeven
2015-10-01 10:53   ` Yoshihiro Shimoda
2015-10-01 12:26     ` Sergei Shtylyov
2015-10-02  1:00       ` Yoshihiro Shimoda
2015-10-02 10:54         ` Sergei Shtylyov
2015-10-01  7:22 ` [PATCH 2/2] dmaengine: usb-dmac: Fix pm_runtime_{enable,disable}() imbalance Geert Uytterhoeven
2015-10-07 14:01 ` [PATCH 0/2] dmaengine: usb-dmac: Runtime PM Related Fixes Vinod Koul
2015-10-16 13:10   ` Geert Uytterhoeven
2015-10-24 12:16     ` Vinod Koul
2015-10-24 17:59       ` Geert Uytterhoeven
2015-10-24 22:56         ` Vinod Koul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).