Re: [PATCH 1/2] usb/xhci: release xhci->lock during turning on/off usb port's acpi power resource

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Tianyu,

These patches look fine to me.  Since Greg reverted the sysfs interface
patch, no one can trigger this deadlock yet, right?  It's still
important to fix it before the new interface goes in, but not really
urgent.

It's too close to the merge window to queue things right now, so I'll
send them off to Greg after the 3.7 merge window.  That will be a couple
weeks.

Sarah Sharp

On Tue, Sep 25, 2012 at 02:52:21PM +0800, Lan Tianyu wrote:
> When setting usb port's acpi power resource, there will be some xhci hub requests.
> This will cause dead lock since xhci->lock has been held before setting acpi power
> resource in the xhci_hub_control().
> 
> Signed-off-by: Lan Tianyu <tianyu.lan@xxxxxxxxx>
> ---
>  drivers/usb/host/xhci-hub.c |   10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
> index aa90ad4..25a1a5e 100644
> --- a/drivers/usb/host/xhci-hub.c
> +++ b/drivers/usb/host/xhci-hub.c
> @@ -811,9 +811,12 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
>  
>  			temp = usb_acpi_power_manageable(hcd->self.root_hub,
>  					wIndex);
> -			if (temp)
> +			if (temp) {
> +				spin_unlock_irqrestore(&xhci->lock, flags);
>  				usb_acpi_set_power_state(hcd->self.root_hub,
>  						wIndex, true);
> +				spin_lock_irqsave(&xhci->lock, flags);
> +			}
>  			break;
>  		case USB_PORT_FEAT_RESET:
>  			temp = (temp | PORT_RESET);
> @@ -919,9 +922,12 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
>  
>  			temp = usb_acpi_power_manageable(hcd->self.root_hub,
>  					wIndex);
> -			if (temp)
> +			if (temp) {
> +				spin_unlock_irqrestore(&xhci->lock, flags);
>  				usb_acpi_set_power_state(hcd->self.root_hub,
>  						wIndex, false);
> +				spin_lock_irqsave(&xhci->lock, flags);
> +			}
>  			break;
>  		default:
>  			goto error;
> -- 
> 1.7.9.5
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux