mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: liulongfang <liulongfang@huawei.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: <gregkh@linuxfoundation.org>, <linux-usb@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] USB:ehci:fix an interrupt calltrace error
Date: Fri, 27 Nov 2020 10:29:03 +0800	[thread overview]
Message-ID: <96b4d366-c94c-9708-da12-5693bf16b716@huawei.com> (raw)
In-Reply-To: <20201126160830.GA827745@rowland.harvard.edu>

On 2020/11/27 0:08, Alan Stern Wrote:
> On Thu, Nov 26, 2020 at 11:34:33AM +0800, Longfang Liu wrote:
>> The system goes to suspend when using USB audio player. This causes
>> the USB device continuous send interrupt signal to system, When the
>> number of interrupts exceeds 100000, the system will forcibly close
>> the interrupts and output a calltrace error.
> 
> This description is very confusing.  USB devices do not send interrupt 
> signals to the host.  Do you mean that the device sends a wakeup 
> request?  Or do you mean something else?
The irq type is IRQ_NONE,It's counted in the note_interrupt function.
From the analysis of the driver code, that are indeed  interrupt signals.
> 
>> When the system goes to suspend, the last interrupt is reported to
>> the driver. At this time, the system has set the state to suspend.
>> This causes the last interrupt to not be processed by the system and
>> not clear the interrupt state flag. This uncleared interrupt flag
>> constantly triggers new interrupt event. This causing the driver to
>> receive more than 100,000 interrupts, which causes the system to
>> forcibly close the interrupt report and report the calltrace error.
> 
> If the driver receives an interrupt, it is supposed to process the event 
> even if the host controller is suspended.  And when ehci_irq() runs, it 
> clears the bits that are set in the USBSYS register.
When the host controller is suspended, the ehci_suspend() will clear
the HCD_FLAG_HW_ACCESSIBLE, and then usb_hcd_irq() will return IRQ_NONE
directly without calling ehci_irq().
> 
> Why is your system getting interrupts?  That is, which bits are set in 
> the USBSTS register?
BIT(5) and BIT(3) are setted, STS_IAA and STS_FLR.
> 
>> so, when the driver goes to sleep and changes the system state to
>> suspend, the interrupt flag needs to be cleared.
>>
>> Signed-off-by: Longfang Liu <liulongfang@huawei.com>
>> ---
>>  drivers/usb/host/ehci-hub.c | 5 +++++
>>  1 file changed, 5 insertions(+)
>>
>> diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c
>> index ce0eaf7..5b13825 100644
>> --- a/drivers/usb/host/ehci-hub.c
>> +++ b/drivers/usb/host/ehci-hub.c
>> @@ -348,6 +348,11 @@ static int ehci_bus_suspend (struct usb_hcd *hcd)
>>  
>>  	/* Any IAA cycle that started before the suspend is now invalid */
>>  	end_iaa_cycle(ehci);
>> +
>> +	/* clear interrupt status */
>> +	if (ehci->has_synopsys_hc_bug)
>> +		ehci_writel(ehci, INTR_MASK | STS_FLR, &ehci->regs->status);
> 
> This is a very strange place to add your new code -- right in the middle 
> of the IAA and unlink handling.  Why not put it in a more reasonable 
> place?After the IAA is processed, clear the STS_IAA interrupt state flag.
> 
> Also, the patch description does not mention has_synopsys_hc_bug.  The 
> meaning of this flag has no connection with the interrupt status 
> register, so why do you use it here?
Because of our USB IP comes from Synopsys, and the uncleared flage is also caused by
special hardware design, in addition, we have not tested other manufacturers' USB
controllers.We don’t know if other manufacturers’ designs have this problem,
so this modification is only limited to this kind of design.
> 
>> +
>>  	ehci_handle_start_intr_unlinks(ehci);
>>  	ehci_handle_intr_unlinks(ehci);
>>  	end_free_itds(ehci);
> 
> Alan Stern
> .
> 
Thanks,
Longfang Liu

  reply	other threads:[~2020-11-27  2:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-26  3:34 Longfang Liu
2020-11-26 16:08 ` Alan Stern
2020-11-27  2:29   ` liulongfang [this message]
2020-11-27 15:47     ` Alan Stern
2020-11-28  3:22       ` liulongfang
2021-01-11  9:38         ` liulongfang

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=96b4d366-c94c-9708-da12-5693bf16b716@huawei.com \
    --to=liulongfang@huawei.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=stern@rowland.harvard.edu \
    /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

all inboxes | Powered by JetHome®