mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mathias Nyman <mathias.nyman@linux.intel.com>
To: Hongyu Xie <xy521521@gmail.com>,
	mathias.nyman@intel.com, gregkh@linuxfoundation.org
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	125707942@qq.com, wangqi@kylinos.cn, xiongxin@kylinos.cn,
	Hongyu Xie <xiehongyu1@kylinos.cn>
Subject: Re: [PATCH v2 -next] usb: xhci: disable irq during initialization
Date: Wed, 15 Jun 2022 17:32:39 +0300	[thread overview]
Message-ID: <9075b67b-9290-8d31-abe5-3755d4c93d97@linux.intel.com> (raw)
In-Reply-To: <20220615090703.1812560-1-xiehongyu1@kylinos.cn>

On 15.6.2022 12.07, Hongyu Xie wrote:
> irq is disabled in xhci_quiesce(called by xhci_halt, with bit:2 cleared
> in USBCMD register), but xhci_run(called by usb_add_hcd) re-enable it.
> It's possible that you will receive thousands of interrupt requests
> after initialization for 2.0 roothub. And you will get a lot of
> warning like, "xHCI dying, ignoring interrupt. Shouldn't IRQs be
> disabled?". This amount of interrupt requests will cause the entire
> system to freeze.
> This problem was first found on a device with ASM2142 host controller
> on it
I see, makes sense to enable interrupts as close as possible to where we
start the host.

For some unknown reason xHCI specification recommends enabling interrupts
(INTE and IE bits) before setting the Run/Stop bit, see xhci 4.2
Host Controller Initialization, "Note" part

So the order here needs to be swapped to comply with spec.
This unfortunately also creates a small window where xHC can interrupt
before xHC is running, but it's better than current situation.

This small window could be solved by protecting this part with a
spin_lock_irqsave().

Thanks
-Mathias

      reply	other threads:[~2022-06-15 14:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-15  9:07 Hongyu Xie
2022-06-15 14:32 ` Mathias Nyman [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=9075b67b-9290-8d31-abe5-3755d4c93d97@linux.intel.com \
    --to=mathias.nyman@linux.intel.com \
    --cc=125707942@qq.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mathias.nyman@intel.com \
    --cc=wangqi@kylinos.cn \
    --cc=xiehongyu1@kylinos.cn \
    --cc=xiongxin@kylinos.cn \
    --cc=xy521521@gmail.com \
    /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®