public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: buckzhangwh@gmail.com
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drivers:usb:disable usb hub&port async suspend
Date: Wed, 28 Feb 2024 10:05:17 +0100	[thread overview]
Message-ID: <2024022815-coping-ultra-b3c3@gregkh> (raw)
In-Reply-To: <20240228085607.3275-1-buckzhangwh@gmail.com>

On Wed, Feb 28, 2024 at 12:56:07AM -0800, buckzhangwh@gmail.com wrote:
> From: weihui zhang <buckzhangwh@gmail.com>
> 
> we prepare 30 mobile phones only for usb plugg in and out.
> testers plug USB in and out very frequently after phone in deep.
> Repeat the test again and again,some phones are crashed.
> our analysis:

Odd colon character...

Anyway, you sent a v2, and now this, why?  What changed from v2 to this
one?

Please properly version things otherwise we have no idea what to do with
this.

> We analyze ten kernel-dumps,we found something common kernel is blocked.
> pasre in crash,all the dump are directed to usb(device port/hub).
> here is a kdump,task 446 &365&4511 are UN.
> 446:
> .... ->|kobj_attr_store
>           |state_store
>             |pm_suspend
>               |enter_state
>                 |suspend_devices_and_enter
>                  |dpm_resume_end
>                    |dpm_resume
>                     |dpm_resume
>                      |async_synchronize_full
>                       |async_synchronize_cookie_domain
>                        |schedule
> 446 is waiting for 365&4511,no doubtful usb thread.
> here is some warning log:
> [83.958310] musb device disconnect detected from VBUS GPIO.
> ..........
> [84.908017] musb device connection detected from VBUS GPIO.
> [84.911946] typec port1-partner: parent port1 should not be sleeping
> task 365 & 4511:
> ... ->worker_thread
>        |process_one_work
>         |async_run_entry_fn
>           |async_resume
>             |device_resume
>               |dpm_wait_for_superior
>                 |wait_for_completion
>                   |wait_for_common
>                      |schedule_timeout
> I guess usb async resume/suspend are disordered,So I try to disable.
> After that,we tested the case for a month,the bug never happened again.
> the fn device_enable_async_suspend set the dev->power.async_suspend= 1.
> dev->power.async_suspend=1&pm_async_enabled=1,fork task like 365
>    ---> dpm_resume
>            |dpm_async_fn
>              |async_resume  
> dev->power.async_suspend=0,disable async
>      --->dpm_resume
>             |device_resume
>               |call device resume fn.
> here is a demo:
> Only few devices such as scsi/pci/usb call device_enable_async_suspend.
> but scsi call device_disable_async_suspend at drivers/scsi/hosts.c
> 
> Signed-off-by: weihui zhang <buckzhangwh@gmail.com>
> ---
>  drivers/usb/core/hub.c  | 2 +-
>  drivers/usb/core/port.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
> index e38a4124f..de74f70e5 100644
> --- a/drivers/usb/core/hub.c
> +++ b/drivers/usb/core/hub.c
> @@ -2602,7 +2602,7 @@ int usb_new_device(struct usb_device *udev)
>  		add_device_randomness(udev->manufacturer,
>  				      strlen(udev->manufacturer));
>  
> -	device_enable_async_suspend(&udev->dev);
> +	device_disable_async_suspend(&udev->dev);

Also, I do not think you addressed my previous comments about this type
of change, did you?  You can not just disable this for no real reason.
And what are you disabling, are you sure it was enabled in the first
place?

thanks,

greg k-h

      reply	other threads:[~2024-02-28  9:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-28  8:56 [PATCH] drivers:usb:disable usb hub&port async suspend buckzhangwh
2024-02-28  9:05 ` Greg Kroah-Hartman [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2024022815-coping-ultra-b3c3@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=buckzhangwh@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox