Skip to contentSkip to conversation

usb: musb: Fix locking errors for host only mode

PATCH In review Tony Lindgren 2 participants 11 messages Aug 18, 2016 – Aug 26, 2016 5 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: musb: Fix locking errors for host only mode

If we have USB gadgets disabled and USB_MUSB_HOST set, we get errors "possible irq lock inverssion dependency detected" errors during boot.

Let's fix the issue by adding start_musb flag and start the controller after we're out of the spinlock protected section.

---
 drivers/usb/musb/musb_virthub.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/usb/musb/musb_virthub.c +6 -1
index 192248f..fe08e77 100644
@@ -290,6 +290,7 @@ int musb_hub_control(
 	u32		temp;
 	int		retval = 0;
 	unsigned long	flags;
+	bool		start_musb = false;
 
 	spin_lock_irqsave(&musb->lock, flags);
 
@@ -390,7 +391,7 @@ int musb_hub_control(
 			 * logic relating to VBUS power-up.
 			 */
 			if (!hcd->self.is_b_host && musb_has_gadget(musb))
-				musb_start(musb);
+				start_musb = true;
 			break;
 		case USB_PORT_FEAT_RESET:
 			musb_port_reset(musb, true);
@@ -451,5 +452,9 @@ error:
 		retval = -EPIPE;
 	}
 	spin_unlock_irqrestore(&musb->lock, flags);
+
+	if (start_musb)
+		musb_start(musb);
+
 	return retval;
 }
Signature · 6 lines
2.8.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 1471560038-6243-1-git-send-email-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org

#2 lore raw

Hi,

Quoted 3 lines · Tony Lindgren

If we have USB gadgets disabled and USB_MUSB_HOST set, we get errors "possible irq lock inverssion dependency detected" errors during boot.

On which platform was this issue found? I am trying to replicate the issue on am335x, but have no luck yet - musb-hdrc does not load at all when usb gadget support is disabled.

Regards,
-Bin.

Quoted 46 lines

Let's fix the issue by adding start_musb flag and start the controller after we're out of the spinlock protected section.

---
 drivers/usb/musb/musb_virthub.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/usb/musb/musb_virthub.c +6 -1
index 192248f..fe08e77 100644
@@ -290,6 +290,7 @@ int musb_hub_control(
 	u32		temp;
 	int		retval = 0;
 	unsigned long	flags;
+	bool		start_musb = false;
 
 	spin_lock_irqsave(&musb->lock, flags);
 
@@ -390,7 +391,7 @@ int musb_hub_control(
 			 * logic relating to VBUS power-up.
 			 */
 			if (!hcd->self.is_b_host && musb_has_gadget(musb))
-				musb_start(musb);
+				start_musb = true;
 			break;
 		case USB_PORT_FEAT_RESET:
 			musb_port_reset(musb, true);
@@ -451,5 +452,9 @@ error:
 		retval = -EPIPE;
 	}
 	spin_unlock_irqrestore(&musb->lock, flags);
+
+	if (start_musb)
+		musb_start(musb);
+
 	return retval;
 }
Signature · 1 line
2.8.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
Quoted 10 lines · Bin Liu

Hi,

Quoted 3 lines · Tony Lindgren

If we have USB gadgets disabled and USB_MUSB_HOST set, we get errors "possible irq lock inverssion dependency detected" errors during boot.

On which platform was this issue found? I am trying to replicate the issue on am335x, but have no luck yet - musb-hdrc does not load at all when usb gadget support is disabled.

It seems to be with a built-in MUSB and gadgets in the .config, I'll forward you the one I got earlier from Ladis.

Regards,

Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 20160824191508.nf63okevka5kkfks-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org

#5 lore raw
Quoted 8 lines · Tony Lindgren
Quoted 7 lines · Bin Liu

Hi,

Quoted 3 lines · Tony Lindgren

If we have USB gadgets disabled and USB_MUSB_HOST set, we get errors "possible irq lock inverssion dependency detected" errors during boot.

Quoted 6 lines
Quoted 3 lines

On which platform was this issue found? I am trying to replicate the issue on am335x, but have no luck yet - musb-hdrc does not load at all when usb gadget support is disabled.

It seems to be with a built-in MUSB and gadgets in the .config, I'll forward you the one I got earlier from Ladis.

And probably specifically CONFIG_USB_MUSB_HOST=y.

Regards,

Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 20160824192926.bjfgzbzhaj5cg4o5-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org

#7 lore raw
Quoted 9 lines · Tony Lindgren
Quoted 8 lines · Tony Lindgren
Quoted 7 lines · Bin Liu

Hi,

Quoted 3 lines · Tony Lindgren

If we have USB gadgets disabled and USB_MUSB_HOST set, we get errors "possible irq lock inverssion dependency detected" errors during boot.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

On which platform was this issue found? I am trying to replicate the issue on am335x, but have no luck yet - musb-hdrc does not load at all when usb gadget support is disabled.

It seems to be with a built-in MUSB and gadgets in the .config, I'll forward you the one I got earlier from Ladis.

And probably specifically CONFIG_USB_MUSB_HOST=y.

yes, I had gadget support disabled and CONFIG_USB_MUSB_HOST=y, but MUSB_HDRC=m. I will try your .config once I have time.

Thanks,
-Bin.

Quoted 4 lines

Regards,

Tony

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#8 lore raw
In reply to a message not in the archive

Hi,

Quoted 11 lines · Tony Lindgren

If we have USB gadgets disabled and USB_MUSB_HOST set, we get errors "possible irq lock inverssion dependency detected" errors during boot.

Let's fix the issue by adding start_musb flag and start the controller after we're out of the spinlock protected section.

Regards,
-Bin.

Quoted 38 lines
---
 drivers/usb/musb/musb_virthub.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/usb/musb/musb_virthub.c +6 -1
index 192248f..fe08e77 100644
@@ -290,6 +290,7 @@ int musb_hub_control(
 	u32		temp;
 	int		retval = 0;
 	unsigned long	flags;
+	bool		start_musb = false;
 
 	spin_lock_irqsave(&musb->lock, flags);
 
@@ -390,7 +391,7 @@ int musb_hub_control(
 			 * logic relating to VBUS power-up.
 			 */
 			if (!hcd->self.is_b_host && musb_has_gadget(musb))
-				musb_start(musb);
+				start_musb = true;
 			break;
 		case USB_PORT_FEAT_RESET:
 			musb_port_reset(musb, true);
@@ -451,5 +452,9 @@ error:
 		retval = -EPIPE;
 	}
 	spin_unlock_irqrestore(&musb->lock, flags);
+
+	if (start_musb)
+		musb_start(musb);
+
 	return retval;
 }
Signature · 1 line
2.8.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#9 lore raw

Hi,

Quoted 11 lines · Bin Liu

Hi,

Quoted 8 lines · Tony Lindgren

If we have USB gadgets disabled and USB_MUSB_HOST set, we get errors "possible irq lock inverssion dependency detected" errors during boot.

Let's fix the issue by adding start_musb flag and start the controller after we're out of the spinlock protected section.

Quoted 5 lines
Quoted 3 lines

Bin, your Signed-off-by here suggests you've committed this to a fixes branch somewhere but I can't see it in next. Are you going to send a pull request for it or what's the plan? Just wondering.. Also added Greg to Cc.

Regards,

Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 20160826143904.ew3cufraegj7rbjm-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org

#11 lore raw
Quoted 18 lines · Tony Lindgren

Hi,

Quoted 15 lines · Bin Liu

Hi,

Quoted 11 lines · Tony Lindgren

If we have USB gadgets disabled and USB_MUSB_HOST set, we get errors "possible irq lock inverssion dependency detected" errors during boot.

Let's fix the issue by adding start_musb flag and start the controller after we're out of the spinlock protected section.

Quoted 6 lines
Quoted 1 line

Bin, your Signed-off-by here suggests you've committed this to a fixes branch somewhere but I can't see it in next. Are you going to send a pull request for it or what's the plan? Just wondering.. Also added Greg to Cc.

I don't have a public git repo to host my musb maintenance work yet, and I don't have a plan to create one since there aren't many musb patches from the community. So far I have been managing all the patches in my local tree, and sending patch bombs to Greg. Your this patch will be sent to Greg today or tomorrow.

Quoted 4 lines

Regards,

Tony

Regards,
-Bin.

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#12 lore raw
Quoted 26 lines · Bin Liu
Quoted 18 lines · Tony Lindgren

Hi,

Quoted 15 lines · Bin Liu

Hi,

Quoted 11 lines · Tony Lindgren

If we have USB gadgets disabled and USB_MUSB_HOST set, we get errors "possible irq lock inverssion dependency detected" errors during boot.

Let's fix the issue by adding start_musb flag and start the controller after we're out of the spinlock protected section.

Quoted 6 lines
Quoted 1 line

Bin, your Signed-off-by here suggests you've committed this to a fixes branch somewhere but I can't see it in next. Are you going to send a pull request for it or what's the plan? Just wondering.. Also added Greg to Cc.

Quoted 5 lines

I don't have a public git repo to host my musb maintenance work yet, and I don't have a plan to create one since there aren't many musb patches from the community. So far I have been managing all the patches in my local tree, and sending patch bombs to Greg. Your this patch will be sent to Greg today or tomorrow.

OK so no need for me to do anything then. Thanks for the update.

Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 20160826145738.ptsdhdbcn3vudszb-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org

#14 lore raw
Quoted 27 lines · Tony Lindgren
Quoted 26 lines · Bin Liu
Quoted 24 lines · Tony Lindgren

Hi,

Quoted 11 lines · Bin Liu

Hi,

Quoted 8 lines · Tony Lindgren

If we have USB gadgets disabled and USB_MUSB_HOST set, we get errors "possible irq lock inverssion dependency detected" errors during boot.

Let's fix the issue by adding start_musb flag and start the controller after we're out of the spinlock protected section.

Quoted 5 lines
Quoted 3 lines

Bin, your Signed-off-by here suggests you've committed this to a fixes branch somewhere but I can't see it in next. Are you going to send a pull request for it or what's the plan? Just wondering.. Also added Greg to Cc.

Quoted 7 lines
Quoted 5 lines

I don't have a public git repo to host my musb maintenance work yet, and I don't have a plan to create one since there aren't many musb patches from the community. So far I have been managing all the patches in my local tree, and sending patch bombs to Greg. Your this patch will be sent to Greg today or tomorrow.

OK so no need for me to do anything then. Thanks for the update.

No, nothing no your side now, the patch is good to go ;)

BTY, sorry for beeing slow on reviewing patches lately. There are a few critical things in my work coming up during my vacation. (maintaining musb is not part of my paid job...)

Quoted 2 lines

Tony

Regards,
-Bin.
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#15 lore raw
Quoted 4 lines · Bin Liu

BTY, sorry for beeing slow on reviewing patches lately. There are a few critical things in my work coming up during my vacation. (maintaining musb is not part of my paid job...)

No problem, we all know how that goes.

Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html