* [PATCH v2 0/1] usb: musb: fix vbus_show
@ 2018-02-27 22:27 Merlijn Wajer
2018-02-27 22:27 ` [PATCH v2 1/1] usb: musb: call pm_runtime_{get,put}_sync before reading vbus registers Merlijn Wajer
0 siblings, 1 reply; 6+ messages in thread
From: Merlijn Wajer @ 2018-02-27 22:27 UTC (permalink / raw)
To: linux-omap
Cc: tony, merlijn, Bin Liu, Greg Kroah-Hartman, linux-usb, linux-kernel
Hi,
This fixes reading vbus status in musb.
v2 places the pm_runtime_{get,put}_sync calls outside of the spinlocks, because
pm_runtime_{get,put}_sync would otherwise (sometimes, depending on the platform)
cause deadlocks.
Hopefully this fixes the deadlock issue that Bin Liu ran into. I've tested this
patch on my Nokia N900 and it works for me.
Cheers,
Merlijn
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 1/1] usb: musb: call pm_runtime_{get,put}_sync before reading vbus registers
2018-02-27 22:27 [PATCH v2 0/1] usb: musb: fix vbus_show Merlijn Wajer
@ 2018-02-27 22:27 ` Merlijn Wajer
2018-02-28 21:59 ` Tony Lindgren
0 siblings, 1 reply; 6+ messages in thread
From: Merlijn Wajer @ 2018-02-27 22:27 UTC (permalink / raw)
To: linux-omap
Cc: tony, merlijn, Bin Liu, Greg Kroah-Hartman, linux-usb, linux-kernel
Without pm_runtime_{get,put}_sync calls in place, reading
vbus status via /sys causes the following error:
Unhandled fault: external abort on non-linefetch (0x1028) at 0xfa0ab060
pgd = b333e822
[fa0ab060] *pgd=48011452(bad)
[<c05261b0>] (musb_default_readb) from [<c0525bd0>] (musb_vbus_show+0x58/0xe4)
[<c0525bd0>] (musb_vbus_show) from [<c04c0148>] (dev_attr_show+0x20/0x44)
[<c04c0148>] (dev_attr_show) from [<c0259f74>] (sysfs_kf_seq_show+0x80/0xdc)
[<c0259f74>] (sysfs_kf_seq_show) from [<c0210bac>] (seq_read+0x250/0x448)
[<c0210bac>] (seq_read) from [<c01edb40>] (__vfs_read+0x1c/0x118)
[<c01edb40>] (__vfs_read) from [<c01edccc>] (vfs_read+0x90/0x144)
[<c01edccc>] (vfs_read) from [<c01ee1d0>] (SyS_read+0x3c/0x74)
[<c01ee1d0>] (SyS_read) from [<c0106fe0>] (ret_fast_syscall+0x0/0x54)
Solution was suggested by Tony Lindgren <tony@atomide.com>.
Signed-off-by: Merlijn Wajer <merlijn@wizzup.org>
---
drivers/usb/musb/musb_core.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index eef4ad578b31..c344ef4e5355 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -1756,6 +1756,7 @@ vbus_show(struct device *dev, struct device_attribute *attr, char *buf)
int vbus;
u8 devctl;
+ pm_runtime_get_sync(dev);
spin_lock_irqsave(&musb->lock, flags);
val = musb->a_wait_bcon;
vbus = musb_platform_get_vbus_status(musb);
@@ -1769,6 +1770,7 @@ vbus_show(struct device *dev, struct device_attribute *attr, char *buf)
vbus = 0;
}
spin_unlock_irqrestore(&musb->lock, flags);
+ pm_runtime_put_sync(dev);
return sprintf(buf, "Vbus %s, timeout %lu msec\n",
vbus ? "on" : "off", val);
--
2.16.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/1] usb: musb: call pm_runtime_{get,put}_sync before reading vbus registers
2018-02-27 22:27 ` [PATCH v2 1/1] usb: musb: call pm_runtime_{get,put}_sync before reading vbus registers Merlijn Wajer
@ 2018-02-28 21:59 ` Tony Lindgren
2018-03-05 17:38 ` Bin Liu
0 siblings, 1 reply; 6+ messages in thread
From: Tony Lindgren @ 2018-02-28 21:59 UTC (permalink / raw)
To: Merlijn Wajer
Cc: linux-omap, Bin Liu, Greg Kroah-Hartman, linux-usb, linux-kernel
* Merlijn Wajer <merlijn@wizzup.org> [180227 22:29]:
> Without pm_runtime_{get,put}_sync calls in place, reading
> vbus status via /sys causes the following error:
>
> Unhandled fault: external abort on non-linefetch (0x1028) at 0xfa0ab060
> pgd = b333e822
> [fa0ab060] *pgd=48011452(bad)
>
> [<c05261b0>] (musb_default_readb) from [<c0525bd0>] (musb_vbus_show+0x58/0xe4)
> [<c0525bd0>] (musb_vbus_show) from [<c04c0148>] (dev_attr_show+0x20/0x44)
> [<c04c0148>] (dev_attr_show) from [<c0259f74>] (sysfs_kf_seq_show+0x80/0xdc)
> [<c0259f74>] (sysfs_kf_seq_show) from [<c0210bac>] (seq_read+0x250/0x448)
> [<c0210bac>] (seq_read) from [<c01edb40>] (__vfs_read+0x1c/0x118)
> [<c01edb40>] (__vfs_read) from [<c01edccc>] (vfs_read+0x90/0x144)
> [<c01edccc>] (vfs_read) from [<c01ee1d0>] (SyS_read+0x3c/0x74)
> [<c01ee1d0>] (SyS_read) from [<c0106fe0>] (ret_fast_syscall+0x0/0x54)
>
> Solution was suggested by Tony Lindgren <tony@atomide.com>.
>
> Signed-off-by: Merlijn Wajer <merlijn@wizzup.org>
Thanks for fixing this. Assuming it passes Bin's tests:
Acked-by: Tony Lindgren <tony@atomide.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/1] usb: musb: call pm_runtime_{get,put}_sync before reading vbus registers
2018-02-28 21:59 ` Tony Lindgren
@ 2018-03-05 17:38 ` Bin Liu
2018-03-05 18:35 ` Ivaylo Dimitrov
0 siblings, 1 reply; 6+ messages in thread
From: Bin Liu @ 2018-03-05 17:38 UTC (permalink / raw)
To: Tony Lindgren
Cc: Merlijn Wajer, linux-omap, Greg Kroah-Hartman, linux-usb, linux-kernel
On Wed, Feb 28, 2018 at 01:59:43PM -0800, Tony Lindgren wrote:
> * Merlijn Wajer <merlijn@wizzup.org> [180227 22:29]:
> > Without pm_runtime_{get,put}_sync calls in place, reading
> > vbus status via /sys causes the following error:
> >
> > Unhandled fault: external abort on non-linefetch (0x1028) at 0xfa0ab060
> > pgd = b333e822
> > [fa0ab060] *pgd=48011452(bad)
> >
> > [<c05261b0>] (musb_default_readb) from [<c0525bd0>] (musb_vbus_show+0x58/0xe4)
> > [<c0525bd0>] (musb_vbus_show) from [<c04c0148>] (dev_attr_show+0x20/0x44)
> > [<c04c0148>] (dev_attr_show) from [<c0259f74>] (sysfs_kf_seq_show+0x80/0xdc)
> > [<c0259f74>] (sysfs_kf_seq_show) from [<c0210bac>] (seq_read+0x250/0x448)
> > [<c0210bac>] (seq_read) from [<c01edb40>] (__vfs_read+0x1c/0x118)
> > [<c01edb40>] (__vfs_read) from [<c01edccc>] (vfs_read+0x90/0x144)
> > [<c01edccc>] (vfs_read) from [<c01ee1d0>] (SyS_read+0x3c/0x74)
> > [<c01ee1d0>] (SyS_read) from [<c0106fe0>] (ret_fast_syscall+0x0/0x54)
> >
> > Solution was suggested by Tony Lindgren <tony@atomide.com>.
> >
> > Signed-off-by: Merlijn Wajer <merlijn@wizzup.org>
>
> Thanks for fixing this. Assuming it passes Bin's tests:
>
> Acked-by: Tony Lindgren <tony@atomide.com>
Applied and sent out. Thanks.
-Bin.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/1] usb: musb: call pm_runtime_{get,put}_sync before reading vbus registers
2018-03-05 17:38 ` Bin Liu
@ 2018-03-05 18:35 ` Ivaylo Dimitrov
2018-03-05 18:57 ` Bin Liu
0 siblings, 1 reply; 6+ messages in thread
From: Ivaylo Dimitrov @ 2018-03-05 18:35 UTC (permalink / raw)
To: Bin Liu, Tony Lindgren
Cc: Merlijn Wajer, linux-omap, Greg Kroah-Hartman, linux-usb, linux-kernel
Hi,
On 5.03.2018 19:38, Bin Liu wrote:
> On Wed, Feb 28, 2018 at 01:59:43PM -0800, Tony Lindgren wrote:
>> * Merlijn Wajer <merlijn@wizzup.org> [180227 22:29]:
>>> Without pm_runtime_{get,put}_sync calls in place, reading
>>> vbus status via /sys causes the following error:
>>>
>>> Unhandled fault: external abort on non-linefetch (0x1028) at 0xfa0ab060
>>> pgd = b333e822
>>> [fa0ab060] *pgd=48011452(bad)
>>>
>>> [<c05261b0>] (musb_default_readb) from [<c0525bd0>] (musb_vbus_show+0x58/0xe4)
>>> [<c0525bd0>] (musb_vbus_show) from [<c04c0148>] (dev_attr_show+0x20/0x44)
>>> [<c04c0148>] (dev_attr_show) from [<c0259f74>] (sysfs_kf_seq_show+0x80/0xdc)
>>> [<c0259f74>] (sysfs_kf_seq_show) from [<c0210bac>] (seq_read+0x250/0x448)
>>> [<c0210bac>] (seq_read) from [<c01edb40>] (__vfs_read+0x1c/0x118)
>>> [<c01edb40>] (__vfs_read) from [<c01edccc>] (vfs_read+0x90/0x144)
>>> [<c01edccc>] (vfs_read) from [<c01ee1d0>] (SyS_read+0x3c/0x74)
>>> [<c01ee1d0>] (SyS_read) from [<c0106fe0>] (ret_fast_syscall+0x0/0x54)
>>>
>>> Solution was suggested by Tony Lindgren <tony@atomide.com>.
>>>
>>> Signed-off-by: Merlijn Wajer <merlijn@wizzup.org>
>>
>> Thanks for fixing this. Assuming it passes Bin's tests:
>>
>> Acked-by: Tony Lindgren <tony@atomide.com>
>
> Applied and sent out. Thanks.
>
What about stable kernels? Shouldn't this be fixed there as well?
Ivo
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/1] usb: musb: call pm_runtime_{get,put}_sync before reading vbus registers
2018-03-05 18:35 ` Ivaylo Dimitrov
@ 2018-03-05 18:57 ` Bin Liu
0 siblings, 0 replies; 6+ messages in thread
From: Bin Liu @ 2018-03-05 18:57 UTC (permalink / raw)
To: Ivaylo Dimitrov
Cc: Tony Lindgren, Merlijn Wajer, linux-omap, Greg Kroah-Hartman,
linux-usb, linux-kernel
On Mon, Mar 05, 2018 at 08:35:10PM +0200, Ivaylo Dimitrov wrote:
> Hi,
>
> On 5.03.2018 19:38, Bin Liu wrote:
> >On Wed, Feb 28, 2018 at 01:59:43PM -0800, Tony Lindgren wrote:
> >>* Merlijn Wajer <merlijn@wizzup.org> [180227 22:29]:
> >>>Without pm_runtime_{get,put}_sync calls in place, reading
> >>>vbus status via /sys causes the following error:
> >>>
> >>>Unhandled fault: external abort on non-linefetch (0x1028) at 0xfa0ab060
> >>>pgd = b333e822
> >>>[fa0ab060] *pgd=48011452(bad)
> >>>
> >>>[<c05261b0>] (musb_default_readb) from [<c0525bd0>] (musb_vbus_show+0x58/0xe4)
> >>>[<c0525bd0>] (musb_vbus_show) from [<c04c0148>] (dev_attr_show+0x20/0x44)
> >>>[<c04c0148>] (dev_attr_show) from [<c0259f74>] (sysfs_kf_seq_show+0x80/0xdc)
> >>>[<c0259f74>] (sysfs_kf_seq_show) from [<c0210bac>] (seq_read+0x250/0x448)
> >>>[<c0210bac>] (seq_read) from [<c01edb40>] (__vfs_read+0x1c/0x118)
> >>>[<c01edb40>] (__vfs_read) from [<c01edccc>] (vfs_read+0x90/0x144)
> >>>[<c01edccc>] (vfs_read) from [<c01ee1d0>] (SyS_read+0x3c/0x74)
> >>>[<c01ee1d0>] (SyS_read) from [<c0106fe0>] (ret_fast_syscall+0x0/0x54)
> >>>
> >>>Solution was suggested by Tony Lindgren <tony@atomide.com>.
> >>>
> >>>Signed-off-by: Merlijn Wajer <merlijn@wizzup.org>
> >>
> >>Thanks for fixing this. Assuming it passes Bin's tests:
> >>
> >>Acked-by: Tony Lindgren <tony@atomide.com>
> >
> >Applied and sent out. Thanks.
> >
>
> What about stable kernels? Shouldn't this be fixed there as well?
Yes, it should, but I need to figure out which stables to send to and I
am busy in something at the moment. So I will send it @stable some time
later.
Regards,
-Bin.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-03-05 18:57 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-27 22:27 [PATCH v2 0/1] usb: musb: fix vbus_show Merlijn Wajer
2018-02-27 22:27 ` [PATCH v2 1/1] usb: musb: call pm_runtime_{get,put}_sync before reading vbus registers Merlijn Wajer
2018-02-28 21:59 ` Tony Lindgren
2018-03-05 17:38 ` Bin Liu
2018-03-05 18:35 ` Ivaylo Dimitrov
2018-03-05 18:57 ` Bin Liu
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).