From: Kamal Mostafa <kamal@canonical.com>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org,
kernel-team@lists.ubuntu.com
Cc: Mathias Nyman <mathias.nyman@linux.intel.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Kamal Mostafa <kamal@canonical.com>
Subject: [PATCH 3.19.y-ckt 35/66] xhci: fix 10 second timeout on removal of PCI hotpluggable xhci controllers
Date: Tue, 26 Apr 2016 13:24:26 -0700 [thread overview]
Message-ID: <1461702297-7792-36-git-send-email-kamal@canonical.com> (raw)
In-Reply-To: <1461702297-7792-1-git-send-email-kamal@canonical.com>
3.19.8-ckt20 -stable review patch. If anyone has any objections, please let me know.
---8<------------------------------------------------------------
From: Mathias Nyman <mathias.nyman@linux.intel.com>
commit 98d74f9ceaefc2b6c4a6440050163a83be0abede upstream.
PCI hotpluggable xhci controllers such as some Alpine Ridge solutions will
remove the xhci controller from the PCI bus when the last USB device is
disconnected.
Add a flag to indicate that the host is being removed to avoid queueing
configure_endpoint commands for the dropped endpoints.
For PCI hotplugged controllers this will prevent 5 second command timeouts
For static xhci controllers the configure_endpoint command is not needed
in the removal case as everything will be returned, freed, and the
controller is reset.
For now the flag is only set for PCI connected host controllers.
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
drivers/usb/host/xhci-pci.c | 1 +
drivers/usb/host/xhci-ring.c | 3 ++-
drivers/usb/host/xhci.c | 8 +++++---
drivers/usb/host/xhci.h | 1 +
4 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
index f0e9376..baec4e0 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -286,6 +286,7 @@ static void xhci_pci_remove(struct pci_dev *dev)
struct xhci_hcd *xhci;
xhci = hcd_to_xhci(pci_get_drvdata(dev));
+ xhci->xhc_state |= XHCI_STATE_REMOVING;
if (xhci->shared_hcd) {
usb_remove_hcd(xhci->shared_hcd);
usb_put_hcd(xhci->shared_hcd);
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 007f68d..24bb0bc 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -3805,7 +3805,8 @@ static int queue_command(struct xhci_hcd *xhci, struct xhci_command *cmd,
int reserved_trbs = xhci->cmd_ring_reserved_trbs;
int ret;
- if (xhci->xhc_state) {
+ if ((xhci->xhc_state & XHCI_STATE_DYING) ||
+ (xhci->xhc_state & XHCI_STATE_HALTED)) {
xhci_dbg(xhci, "xHCI dying or halted, can't queue_command\n");
return -ESHUTDOWN;
}
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index af63df1..9efd1b4 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -147,7 +147,8 @@ static int xhci_start(struct xhci_hcd *xhci)
"waited %u microseconds.\n",
XHCI_MAX_HALT_USEC);
if (!ret)
- xhci->xhc_state &= ~(XHCI_STATE_HALTED | XHCI_STATE_DYING);
+ /* clear state flags. Including dying, halted or removing */
+ xhci->xhc_state = 0;
return ret;
}
@@ -2762,7 +2763,8 @@ int xhci_check_bandwidth(struct usb_hcd *hcd, struct usb_device *udev)
if (ret <= 0)
return ret;
xhci = hcd_to_xhci(hcd);
- if (xhci->xhc_state & XHCI_STATE_DYING)
+ if ((xhci->xhc_state & XHCI_STATE_DYING) ||
+ (xhci->xhc_state & XHCI_STATE_REMOVING))
return -ENODEV;
xhci_dbg(xhci, "%s called for udev %p\n", __func__, udev);
@@ -3811,7 +3813,7 @@ static int xhci_setup_device(struct usb_hcd *hcd, struct usb_device *udev,
mutex_lock(&xhci->mutex);
- if (xhci->xhc_state) /* dying or halted */
+ if (xhci->xhc_state) /* dying, removing or halted */
goto out;
if (!udev->slot_id) {
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index 3716b63..ab1e2ec 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -1534,6 +1534,7 @@ struct xhci_hcd {
*/
#define XHCI_STATE_DYING (1 << 0)
#define XHCI_STATE_HALTED (1 << 1)
+#define XHCI_STATE_REMOVING (1 << 2)
/* Statistics */
int error_bitmask;
unsigned int quirks;
--
2.7.4
next prev parent reply other threads:[~2016-04-26 20:25 UTC|newest]
Thread overview: 67+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-26 20:23 [3.19.y-ckt stable] Linux 3.19.8-ckt20 stable review Kamal Mostafa
2016-04-26 20:23 ` [PATCH 3.19.y-ckt 01/66] usbnet: cleanup after bind() in probe() Kamal Mostafa
2016-04-26 20:23 ` [PATCH 3.19.y-ckt 02/66] tunnel: Clear IPCB(skb)->opt before dst_link_failure called Kamal Mostafa
2016-04-26 20:23 ` [PATCH 3.19.y-ckt 03/66] net: jme: fix suspend/resume on JMC260 Kamal Mostafa
2016-04-26 20:23 ` [PATCH 3.19.y-ckt 04/66] net: qca_spi: clear IFF_TX_SKB_SHARING Kamal Mostafa
2016-04-26 20:23 ` [PATCH 3.19.y-ckt 05/66] sctp: lack the check for ports in sctp_v6_cmp_addr Kamal Mostafa
2016-04-26 20:23 ` [PATCH 3.19.y-ckt 06/66] qmi_wwan: add Sierra Wireless EM74xx device ID Kamal Mostafa
2016-04-26 20:23 ` [PATCH 3.19.y-ckt 07/66] cdc_ncm: toggle altsetting to force reset before setup Kamal Mostafa
2016-04-26 20:23 ` [PATCH 3.19.y-ckt 08/66] udp6: fix UDP/IPv6 encap resubmit path Kamal Mostafa
2016-04-26 20:24 ` [PATCH 3.19.y-ckt 09/66] net: validate variable length ll headers Kamal Mostafa
2016-04-26 20:24 ` [PATCH 3.19.y-ckt 10/66] sh_eth: fix NULL pointer dereference in sh_eth_ring_format() Kamal Mostafa
2016-04-26 20:24 ` [PATCH 3.19.y-ckt 11/66] macvtap: always pass ethernet header in linear Kamal Mostafa
2016-04-26 20:24 ` [PATCH 3.19.y-ckt 12/66] farsync: fix off-by-one bug in fst_add_one Kamal Mostafa
2016-04-26 20:24 ` [PATCH 3.19.y-ckt 13/66] qlge: Fix receive packets drop Kamal Mostafa
2016-04-26 20:24 ` [PATCH 3.19.y-ckt 14/66] bonding: fix bond_get_stats() Kamal Mostafa
2016-04-26 20:24 ` [PATCH 3.19.y-ckt 15/66] xfrm: Fix crash observed during device unregistration and decryption Kamal Mostafa
2016-04-26 20:24 ` [PATCH 3.19.y-ckt 16/66] qmi_wwan: add "D-Link DWM-221 B1" device id Kamal Mostafa
2016-04-26 20:24 ` [PATCH 3.19.y-ckt 17/66] rtnl: fix msg size calculation in if_nlmsg_size() Kamal Mostafa
2016-04-26 20:24 ` [PATCH 3.19.y-ckt 18/66] ipv4: l2tp: fix a potential issue in l2tp_ip_recv Kamal Mostafa
2016-04-26 20:24 ` [PATCH 3.19.y-ckt 19/66] ipv6: l2tp: fix a potential issue in l2tp_ip6_recv Kamal Mostafa
2016-04-26 20:24 ` [PATCH 3.19.y-ckt 20/66] HID: usbhid: fix inconsistent reset/resume/reset-resume behavior Kamal Mostafa
2016-04-26 20:24 ` [PATCH 3.19.y-ckt 21/66] ARM: OMAP2+: hwmod: Fix updating of sysconfig register Kamal Mostafa
2016-04-26 20:24 ` [PATCH 3.19.y-ckt 22/66] drm/qxl: fix cursor position with non-zero hotspot Kamal Mostafa
2016-04-26 20:24 ` [PATCH 3.19.y-ckt 23/66] Input: gtco - fix crash on detecting device without endpoints Kamal Mostafa
2016-04-26 20:24 ` [PATCH 3.19.y-ckt 24/66] assoc_array: don't call compare_object() on a node Kamal Mostafa
2016-04-26 20:24 ` [PATCH 3.19.y-ckt 25/66] ALSA: usb-audio: Skip volume controls triggers hangup on Dell USB Dock Kamal Mostafa
2016-04-26 20:24 ` [PATCH 3.19.y-ckt 26/66] nl80211: check netlink protocol in socket release notification Kamal Mostafa
2016-04-26 20:24 ` [PATCH 3.19.y-ckt 27/66] ALSA: hda - Fix regression of monitor_present flag in eld proc file Kamal Mostafa
2016-04-26 20:24 ` [PATCH 3.19.y-ckt 28/66] dmaengine: dw: fix master selection Kamal Mostafa
2016-04-26 20:24 ` [PATCH 3.19.y-ckt 29/66] lib: lz4: fixed zram with lz4 on big endian machines Kamal Mostafa
2016-04-26 20:24 ` [PATCH 3.19.y-ckt 30/66] usb: xhci: applying XHCI_PME_STUCK_QUIRK to Intel BXT B0 host Kamal Mostafa
2016-04-26 20:24 ` [PATCH 3.19.y-ckt 31/66] xhci: resume USB 3 roothub first Kamal Mostafa
2016-04-26 20:24 ` [PATCH 3.19.y-ckt 32/66] usb: host: xhci: add a new quirk XHCI_NO_64BIT_SUPPORT Kamal Mostafa
2016-04-26 20:24 ` [PATCH 3.19.y-ckt 33/66] usb: xhci: fix wild pointers in xhci_mem_cleanup Kamal Mostafa
2016-04-26 20:24 ` [PATCH 3.19.y-ckt 34/66] usb: xhci: fix xhci locking up during hcd remove Kamal Mostafa
2016-04-26 20:24 ` Kamal Mostafa [this message]
2016-04-26 20:24 ` [PATCH 3.19.y-ckt 36/66] USB: uas: Add a new NO_REPORT_LUNS quirk Kamal Mostafa
2016-04-26 20:24 ` [PATCH 3.19.y-ckt 37/66] usb: hcd: out of bounds access in for_each_companion Kamal Mostafa
2016-04-26 20:24 ` [PATCH 3.19.y-ckt 38/66] crypto: sha1-mb - use corrcet pointer while completing jobs Kamal Mostafa
2016-04-26 20:24 ` [PATCH 3.19.y-ckt 39/66] crypto: ccp - Prevent information leakage on export Kamal Mostafa
2016-04-26 20:24 ` [PATCH 3.19.y-ckt 40/66] video: ARM CLCD: runtime check for Versatile Kamal Mostafa
2016-04-26 20:24 ` [PATCH 3.19.y-ckt 41/66] ALSA: hda/realtek - Add ALC3234 headset mode for Optiplex 9020m Kamal Mostafa
2016-04-26 20:24 ` [PATCH 3.19.y-ckt 42/66] powerpc: scan_features() updates incorrect bits for REAL_LE Kamal Mostafa
2016-04-26 20:24 ` [PATCH 3.19.y-ckt 43/66] powerpc: Update cpu_user_features2 in scan_features() Kamal Mostafa
2016-04-26 20:24 ` [PATCH 3.19.y-ckt 44/66] powerpc: Update TM user feature bits " Kamal Mostafa
2016-04-26 20:24 ` [PATCH 3.19.y-ckt 45/66] drm/radeon: add a quirk for a XFX R9 270X Kamal Mostafa
2016-04-26 20:24 ` [PATCH 3.19.y-ckt 46/66] futex: Handle unlock_pi race gracefully Kamal Mostafa
2016-04-26 20:24 ` [PATCH 3.19.y-ckt 47/66] futex: Acknowledge a new waiter in counter before plist Kamal Mostafa
2016-04-26 20:24 ` [PATCH 3.19.y-ckt 48/66] ALSA: pcxhr: Fix missing mutex unlock Kamal Mostafa
2016-04-26 20:24 ` [PATCH 3.19.y-ckt 49/66] drm/dp/mst: Validate port in drm_dp_payload_send_msg() Kamal Mostafa
2016-04-26 20:24 ` [PATCH 3.19.y-ckt 50/66] drm/radeon: forbid mapping of userptr bo through radeon device file Kamal Mostafa
2016-04-26 20:24 ` [PATCH 3.19.y-ckt 51/66] drm: Loongson-3 doesn't fully support wc memory Kamal Mostafa
2016-04-26 20:24 ` [PATCH 3.19.y-ckt 52/66] mm: hugetlb: allow hugepages_supported to be architecture specific Kamal Mostafa
2016-04-26 20:24 ` [PATCH 3.19.y-ckt 53/66] x86/mm/xen: Suppress hugetlbfs in PV guests Kamal Mostafa
2016-04-26 20:24 ` [PATCH 3.19.y-ckt 54/66] x86 EDAC, sb_edac.c: Repair damage introduced when "fixing" channel address Kamal Mostafa
2016-04-26 20:24 ` [PATCH 3.19.y-ckt 55/66] x86 EDAC, sb_edac.c: Take account of channel hashing when needed Kamal Mostafa
2016-04-26 20:24 ` [PATCH 3.19.y-ckt 56/66] s390/scm_blk: fix deadlock for requests != REQ_TYPE_FS Kamal Mostafa
2016-04-26 20:24 ` [PATCH 3.19.y-ckt 57/66] packet: fix heap info leak in PACKET_DIAG_MCLIST sock_diag interface Kamal Mostafa
2016-04-26 20:24 ` [PATCH 3.19.y-ckt 58/66] net: sched: do not requeue a NULL skb Kamal Mostafa
2016-04-26 20:24 ` [PATCH 3.19.y-ckt 59/66] bpf/verifier: reject invalid LD_ABS | BPF_DW instruction Kamal Mostafa
2016-04-26 20:24 ` [PATCH 3.19.y-ckt 60/66] pinctrl: single: Fix pcs_parse_bits_in_pinctrl_entry to use __ffs than ffs Kamal Mostafa
2016-04-26 20:24 ` [PATCH 3.19.y-ckt 61/66] s390/spinlock: avoid yield to non existent cpu Kamal Mostafa
2016-04-26 20:24 ` [PATCH 3.19.y-ckt 62/66] net: bcmgenet: device stats are unsigned long Kamal Mostafa
2016-04-26 20:24 ` [PATCH 3.19.y-ckt 63/66] Input: pmic8xxx-pwrkey - fix algorithm for converting trigger delay Kamal Mostafa
2016-04-26 20:24 ` [PATCH 3.19.y-ckt 64/66] net: ethernet: davinci_emac: Fix Unbalanced pm_runtime_enable Kamal Mostafa
2016-04-26 20:24 ` [PATCH 3.19.y-ckt 65/66] net: ethernet: davinci_emac: Fix platform_data overwrite Kamal Mostafa
2016-04-26 20:24 ` [PATCH 3.19.y-ckt 66/66] atl2: Disable unimplemented scatter/gather feature Kamal Mostafa
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=1461702297-7792-36-git-send-email-kamal@canonical.com \
--to=kamal@canonical.com \
--cc=gregkh@linuxfoundation.org \
--cc=kernel-team@lists.ubuntu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mathias.nyman@linux.intel.com \
--cc=stable@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
all inboxes | Powered by JetHome®