No description
  • C 98.2%
  • Assembly 1%
  • Makefile 0.3%
  • Shell 0.2%
  • Python 0.1%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Jack Pham 44775a35a9 usb: dwc3: gadget: delay clearing run/stop when setup just arrived
There still exists a small window in which dwc3_gadget_pullup()
is called while a new control transfer setup packet had newly
arrived. In the case where it needs to be delegated to the gadget
driver, it releases dwc3->lock and allows pullup() to proceed to
call run_stop() to attempt to stop the controller. The lock will
get released again when calling dwc3_stop_active_transfers()
which allows the gadget driver to meanwhile call ep_queue() for
a three-stage control transfer and sneak in a Start Transfer. By
the time the DCTL register is written, the controller will fail
to halt due to having an outstanding transfer in progress.

CPU0                               CPU1
...dwc3->lock held...
dwc3_ep0_inspect_setup()           dwc3_gadget_pullup()
 dwc3_ep0_delegate_req()            spin_lock_irq_save()
  spin_unlock()                     ... unblocked
   composite_setup()                dwc3_gadget_run_stop()
    usb_ep_queue()                      dwc3_stop_active_transfers()
     dwc3_gadget_ep0_queue()          dwc3_gadget_remove_requests()
      spin_lock_irqsave()              dwc3_gadget_giveback()
      ... unblocked                     spin_unlock()
       __dwc3_ep0_do_control_data()     spin_lock()
        issues Start Transfer
      spin_unlock_irqrestore()          ... unblocked
  spin_lock()                        clear DCTL_RUN_STOP
  ...                                wait for DSTS_DEVCTRLHLT
                                     time out

This change attempts to fix the issue by additionally checking
the dwc->ep0_next_event state in dwc3_gadget_pullup() to catch
the case when a SETUP packet had just been received and handled
by dwc3_ep0_inspect_setup but is still waiting to proceed to
either a DATA or STATUS stage. This allows pullup() to wait for
completion of the transfer before moving on to clear run/stop.

Change-Id: Ib2da3c86213ade1a61fb82f95a1f7c9534d9df3f
Signed-off-by: Jack Pham <jackp@codeaurora.org>
2019-10-26 23:24:02 -07:00
arch Merge remote-tracking branch 'remotes/origin/tmp-3fde1dfb006c' into msm-lahaina 2019-10-23 14:22:32 -07:00
block blk-wbt: fix performance regression in wbt scale_up/scale_down 2019-10-06 09:26:41 -06:00
certs
crypto Merge branch 'next-lockdown' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security 2019-09-28 08:14:15 -07:00
Documentation Merge remote-tracking branch 'remotes/origin/tmp-3fde1dfb006c' into msm-lahaina 2019-10-23 14:22:32 -07:00
drivers usb: dwc3: gadget: delay clearing run/stop when setup just arrived 2019-10-26 23:24:02 -07:00
fs Linux 5.4-rc3 2019-10-17 05:28:13 -07:00
include Merge remote-tracking branch 'remotes/origin/tmp-3fde1dfb006c' into msm-lahaina 2019-10-23 14:22:32 -07:00
init Merge remote-tracking branch 'remotes/origin/tmp-3fde1dfb006c' into msm-lahaina 2019-10-23 14:22:32 -07:00
ipc Merge 5.4-rc1-prelrease into android-mainline 2019-10-02 17:58:47 +02:00
kernel Merge remote-tracking branch 'remotes/origin/tmp-3fde1dfb006c' into msm-lahaina 2019-10-23 14:22:32 -07:00
lib Merge remote-tracking branch 'remotes/origin/tmp-3fde1dfb006c' into msm-lahaina 2019-10-23 14:22:32 -07:00
LICENSES
mm Merge remote-tracking branch 'remotes/origin/tmp-3fde1dfb006c' into msm-lahaina 2019-10-23 14:22:32 -07:00
net Merge remote-tracking branch 'remotes/origin/tmp-3fde1dfb006c' into msm-lahaina 2019-10-23 14:22:32 -07:00
patches ANDROID: quilt series: drop cuttlefish config changes 2019-10-22 14:47:59 +01:00
samples rpmsg updates for v5.4 2019-09-22 10:58:15 -07:00
scripts Merge remote-tracking branch 'remotes/origin/tmp-3fde1dfb006c' into msm-lahaina 2019-10-23 14:22:32 -07:00
security Linux 5.4-rc3 2019-10-17 05:28:13 -07:00
sound sound fixes for 5.4-rc1 2019-09-24 16:46:16 -07:00
techpack techpack: Kbuild: Fix to compile the techpack completely 2019-09-13 17:25:11 -07:00
tools Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2019-10-12 15:15:17 -07:00
usr kbuild: update compile-test header list for v5.4-rc2 2019-10-05 15:29:49 +09:00
virt KVM/arm fixes for 5.4, take #1 2019-10-03 12:08:50 +02:00
.clang-format
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore Merge remote-tracking branch 'remotes/origin/tmp-3fde1dfb006c' into msm-lahaina 2019-10-23 14:22:32 -07:00
.mailmap Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next 2019-09-18 12:34:53 -07:00
abi_gki_aarch64.xml Update ABI definition after libabigail upgrade 2019-09-22 10:51:50 +01:00
abi_gki_aarch64_3fde1dfb006c.xml ABI: aarch64: Update ABI snapshot based on v5.4-rc3 2019-10-23 19:57:45 -07:00
build.config.aarch64
build.config.allmodconfig ANDROID: Fix x86_64 allmodconfig build 2019-10-11 14:30:56 +00:00
build.config.allmodconfig.aarch64 ANDROID: create build.configs for allmodconfig 2019-09-04 15:49:40 +00:00
build.config.allmodconfig.x86_64 ANDROID: create build.configs for allmodconfig 2019-09-04 15:49:40 +00:00
build.config.common ANDROID: Move from clang r353983c to r365631c 2019-10-22 17:59:02 +00:00
build.config.gki
build.config.gki.aarch64
build.config.gki.x86_64
build.config.x86_64
COPYING
CREDITS MAINTAINERS: Remove Simon as Renesas SoC Co-Maintainer 2019-10-10 08:12:51 -07:00
Kbuild
Kconfig
MAINTAINERS USB fixes for 5.4-rc3 2019-10-12 15:37:12 -07:00
Makefile Merge remote-tracking branch 'remotes/origin/tmp-3fde1dfb006c' into msm-lahaina 2019-10-23 14:22:32 -07:00
README

Linux kernel
============

There are several guides for kernel developers and users. These guides can
be rendered in a number of formats, like HTML and PDF. Please read
Documentation/admin-guide/README.rst first.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.  The formatted documentation can also be read online at:

    https://www.kernel.org/doc/html/latest/

There are various text files in the Documentation/ subdirectory,
several of them using the Restructured Text markup notation.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.