From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Greg KH <gregkh@linuxfoundation.org>,
torvalds@linux-foundation.org, akpm@linux-foundation.org,
alan@lxorguk.ukuu.org.uk,
Sarah Sharp <sarah.a.sharp@linux.intel.com>
Subject: [ 033/122] USB: Fix LPM disable/enable during device reset.
Date: Tue, 7 Aug 2012 15:25:21 -0700 [thread overview]
Message-ID: <20120807221951.222501057@linuxfoundation.org> (raw)
In-Reply-To: <20120807221948.220495155@linuxfoundation.org>
From: Greg KH <gregkh@linuxfoundation.org>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sarah Sharp <sarah.a.sharp@linux.intel.com>
commit 6d1d051330ee096f575523647fbd8ffe703600b5 upstream.
The USB 3.0 specification says that sending a Set Feature or Clear
Feature for U1/U2 Enable is not a valid request when the device is in
the Default or Addressed state. It is only valid when the device is in
the Configured state.
The original LPM patch attempted to disable LPM after the device had
been reset by hub_port_init(), before it had the configuration
reinstalled. The TI hub I tested with did not fail the Clear Feature
U1/U2 Enable request that khubd sent while it was in the addressed
state, which is why I didn't catch it.
Move the LPM disable before the device reset, so that we can send the
Clear Feature U1/U2 Enable successfully, and balance the LPM disable
count.
Also delete any calls to usb_enable_lpm() on error paths that lead to
re-enumeration. The calls will fail because the device isn't
configured, and it's not useful to balance the LPM disable count because
the usb_device is about to be destroyed before re-enumeration.
Fix the early exit path ("done" label) to call usb_enable_lpm() to
balance the LPM disable count.
Note that calling usb_reset_and_verify_device() with an unconfigured
device may fail on the first call to usb_disable_lpm(). That's because
the LPM disable count is initialized to 0 (LPM enabled), and
usb_disable_lpm() will attempt to send a Clear Feature U1/U2 request to
a device in the Addressed state. The next patch will fix that.
This commit should be backported to kernels as old as 3.5, that contain
the commit 8306095fd2c1100e8244c09bf560f97aca5a311d "USB: Disable USB
3.0 LPM in critical sections."
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/usb/core/hub.c | 26 ++++++++++++--------------
1 file changed, 12 insertions(+), 14 deletions(-)
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -4672,6 +4672,16 @@ static int usb_reset_and_verify_device(s
}
parent_hub = hdev_to_hub(parent_hdev);
+ /* Disable LPM while we reset the device and reinstall the alt settings.
+ * Device-initiated LPM settings, and system exit latency settings are
+ * cleared when the device is reset, so we have to set them up again.
+ */
+ ret = usb_unlocked_disable_lpm(udev);
+ if (ret) {
+ dev_err(&udev->dev, "%s Failed to disable LPM\n.", __func__);
+ goto re_enumerate;
+ }
+
set_bit(port1, parent_hub->busy_bits);
for (i = 0; i < SET_CONFIG_TRIES; ++i) {
@@ -4699,22 +4709,11 @@ static int usb_reset_and_verify_device(s
goto done;
mutex_lock(hcd->bandwidth_mutex);
- /* Disable LPM while we reset the device and reinstall the alt settings.
- * Device-initiated LPM settings, and system exit latency settings are
- * cleared when the device is reset, so we have to set them up again.
- */
- ret = usb_disable_lpm(udev);
- if (ret) {
- dev_err(&udev->dev, "%s Failed to disable LPM\n.", __func__);
- mutex_unlock(hcd->bandwidth_mutex);
- goto done;
- }
ret = usb_hcd_alloc_bandwidth(udev, udev->actconfig, NULL, NULL);
if (ret < 0) {
dev_warn(&udev->dev,
"Busted HC? Not enough HCD resources for "
"old configuration.\n");
- usb_enable_lpm(udev);
mutex_unlock(hcd->bandwidth_mutex);
goto re_enumerate;
}
@@ -4726,7 +4725,6 @@ static int usb_reset_and_verify_device(s
dev_err(&udev->dev,
"can't restore configuration #%d (error=%d)\n",
udev->actconfig->desc.bConfigurationValue, ret);
- usb_enable_lpm(udev);
mutex_unlock(hcd->bandwidth_mutex);
goto re_enumerate;
}
@@ -4765,17 +4763,17 @@ static int usb_reset_and_verify_device(s
desc->bInterfaceNumber,
desc->bAlternateSetting,
ret);
- usb_unlocked_enable_lpm(udev);
goto re_enumerate;
}
}
+done:
/* Now that the alt settings are re-installed, enable LPM. */
usb_unlocked_enable_lpm(udev);
-done:
return 0;
re_enumerate:
+ /* LPM state doesn't matter when we're about to destroy the device. */
hub_port_logical_disconnect(parent_hub, port1);
return -ENODEV;
}
next prev parent reply other threads:[~2012-08-07 22:28 UTC|newest]
Thread overview: 127+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
2012-08-07 22:24 ` [ 001/122] target: Add generation of LOGICAL BLOCK ADDRESS OUT OF RANGE Greg Kroah-Hartman
2012-08-07 22:24 ` [ 002/122] iscsi-target: Drop bogus struct file usage for iSCSI/SCTP Greg Kroah-Hartman
2012-08-07 22:24 ` [ 003/122] mmc: sdhci-pci: CaFe has broken card detection Greg Kroah-Hartman
2012-08-07 22:24 ` [ 004/122] mmc: sdhci: fix incorrect command used in tuning Greg Kroah-Hartman
2012-08-07 22:24 ` [ 005/122] powerpc/ftrace: Fix assembly trampoline register usage Greg Kroah-Hartman
2012-08-07 22:24 ` [ 006/122] powerpc: Add "memory" attribute for mfmsr() Greg Kroah-Hartman
2012-08-07 22:24 ` [ 007/122] powerpc/eeh: Check handle_eeh_events() return value Greg Kroah-Hartman
2012-08-07 22:24 ` [ 008/122] be2net: Missing byteswap in be_get_fw_log_level causes oops on PowerPC Greg Kroah-Hartman
2012-08-07 22:24 ` [ 009/122] powerpc/85xx: use the BRx registers to enable indirect mode on the P1022DS Greg Kroah-Hartman
2012-08-07 22:24 ` [ 010/122] smack: off by one error Greg Kroah-Hartman
2012-08-07 22:53 ` Casey Schaufler
2012-08-08 0:11 ` Casey Schaufler
2012-08-07 22:24 ` [ 011/122] SCSI: libsas: continue revalidation Greg Kroah-Hartman
2012-08-07 22:25 ` [ 012/122] SCSI: libsas: fix sas_discover_devices return code handling Greg Kroah-Hartman
2012-08-07 22:25 ` [ 013/122] SCSI: fix eh wakeup (scsi_schedule_eh vs scsi_restart_operations) Greg Kroah-Hartman
2012-08-07 22:25 ` [ 014/122] SCSI: fix hot unplug vs async scan race Greg Kroah-Hartman
2012-08-07 22:25 ` [ 015/122] SCSI: Fix device removal NULL pointer dereference Greg Kroah-Hartman
2012-08-07 22:25 ` [ 016/122] SCSI: Avoid dangling pointer in scsi_requeue_command() Greg Kroah-Hartman
2012-08-07 22:25 ` [ 017/122] rt2800usb: 2001:3c17 is an RT3370 device Greg Kroah-Hartman
2012-08-07 22:25 ` [ 018/122] ARM: dt: tegra trimslice: enable USB2 port Greg Kroah-Hartman
2012-08-07 22:25 ` [ 019/122] ARM: OMAP2+: OPP: Fix to ensure check of right oppdef after bad one Greg Kroah-Hartman
2012-08-07 22:25 ` [ 020/122] ARM: dt: tegra trimslice: add vbus-gpio property Greg Kroah-Hartman
2012-08-07 22:25 ` [ 021/122] ASoC: dapm: Fix locking during codec shutdown Greg Kroah-Hartman
2012-08-07 22:25 ` [ 022/122] ASoC: dapm: Fix _PRE and _POST events for DAPM performance improvements Greg Kroah-Hartman
2012-08-07 22:25 ` [ 023/122] ASoC: wm8962: Redo early init of the part on resume Greg Kroah-Hartman
2012-08-07 22:25 ` [ 024/122] ALSA: hda - Add support for Realtek ALC282 Greg Kroah-Hartman
2012-08-07 22:25 ` [ 025/122] ALSA: hda - Turn on PIN_OUT from hdmi playback prepare Greg Kroah-Hartman
2012-08-07 22:25 ` [ 026/122] ALSA: hda - Dont power up when not powered down Greg Kroah-Hartman
2012-08-07 22:25 ` [ 027/122] HID: hid-multitouch: fix input mode feature command Greg Kroah-Hartman
2012-08-07 22:25 ` [ 028/122] usbdevfs: Correct amount of data copied to user in processcompl_compat Greg Kroah-Hartman
2012-08-07 22:25 ` [ 029/122] usb: gadget: Fix g_ether interface link status Greg Kroah-Hartman
2012-08-07 22:25 ` [ 030/122] USB: option: add ZTE MF821D Greg Kroah-Hartman
2012-08-07 22:25 ` [ 031/122] Revert "usb/uas: make sure data urb is gone if we receive status before that" Greg Kroah-Hartman
2012-08-07 22:25 ` [ 032/122] USB: Disable LPM while the device is unconfigured Greg Kroah-Hartman
2012-08-07 22:25 ` Greg Kroah-Hartman [this message]
2012-08-07 22:25 ` [ 034/122] USB: Remove unused LPM variable Greg Kroah-Hartman
2012-08-07 22:25 ` [ 035/122] USB: Fix LPM disable count mismatch on driver unbind Greg Kroah-Hartman
2012-08-07 22:25 ` [ 036/122] ALSA: hda - add dock support for Thinkpad X230 Tablet Greg Kroah-Hartman
2012-08-07 22:25 ` [ 037/122] x86, microcode: Sanitize per-cpu microcode reloading interface Greg Kroah-Hartman
2012-08-07 22:25 ` [ 038/122] x86/mce: Fix siginfo_t->si_addr value for non-recoverable memory faults Greg Kroah-Hartman
2012-08-07 22:25 ` [ 039/122] locks: fix checking of fcntl_setlease argument Greg Kroah-Hartman
2012-08-07 22:25 ` [ 040/122] batman-adv: fix skb->data assignment Greg Kroah-Hartman
2012-08-09 3:13 ` Ben Hutchings
2012-08-09 15:17 ` Greg Kroah-Hartman
2012-08-07 22:25 ` [ 041/122] ftrace: Disable function tracing during suspend/resume and hibernation, again Greg Kroah-Hartman
2012-08-07 22:25 ` [ 042/122] PM / Sleep: Require CAP_BLOCK_SUSPEND to use wake_lock/wake_unlock Greg Kroah-Hartman
2012-08-07 22:25 ` [ 043/122] PM / Sleep: call early resume handlers when suspend_noirq fails Greg Kroah-Hartman
2012-08-07 22:25 ` [ 044/122] TPM: chip disabled state erronously being reported as error Greg Kroah-Hartman
2012-08-07 22:25 ` [ 045/122] tun: fix a crash bug and a memory leak Greg Kroah-Hartman
2012-08-07 22:25 ` [ 046/122] mac80211: fix crash with single-queue drivers Greg Kroah-Hartman
2012-08-07 22:25 ` [ 047/122] b43: fix crash with OpenFWWF Greg Kroah-Hartman
2012-08-07 22:25 ` [ 048/122] mac80211: fix read outside array bounds Greg Kroah-Hartman
2012-08-07 22:25 ` [ 049/122] mac80211: fail authentication when AP denied authentication Greg Kroah-Hartman
2012-08-07 22:25 ` [ 050/122] iwlwifi: Check BSS ctx active before call mac80211 Greg Kroah-Hartman
2012-08-07 22:25 ` [ 051/122] iwlwifi: fix debug print in iwl_sta_calc_ht_flags Greg Kroah-Hartman
2012-08-07 22:25 ` [ 052/122] atl1c: fix issue of io access mode for AR8152 v2.1 Greg Kroah-Hartman
2012-08-07 22:25 ` [ 053/122] rtlwifi: rtl8192cu: Change buffer allocation for synchronous reads Greg Kroah-Hartman
2012-08-07 22:25 ` [ 054/122] rtlwifi: rtl8192de: Fix phy-based version calculation Greg Kroah-Hartman
2012-08-07 22:25 ` [ 055/122] mwifiex: correction in mcs index check Greg Kroah-Hartman
2012-08-07 22:25 ` [ 056/122] s390/idle: fix sequence handling vs cpu hotplug Greg Kroah-Hartman
2012-08-07 22:25 ` [ 057/122] s390/mm: downgrade page table after fork of a 31 bit process Greg Kroah-Hartman
2012-08-07 22:25 ` [ 058/122] s390/mm: fix fault handling for page table walk case Greg Kroah-Hartman
2012-08-07 22:25 ` [ 059/122] cgroup: cgroup_rm_files() was calling simple_unlink() with the wrong inode Greg Kroah-Hartman
2012-08-07 22:25 ` [ 060/122] iommu/amd: Add missing spin_lock initialization Greg Kroah-Hartman
2012-08-07 22:25 ` [ 061/122] iommu/amd: Fix hotplug with iommu=pt Greg Kroah-Hartman
2012-08-07 22:25 ` [ 062/122] udf: Improve table length check to avoid possible overflow Greg Kroah-Hartman
2012-08-07 22:25 ` [ 063/122] stable: update references to older 2.6 versions for 3.x Greg Kroah-Hartman
2012-08-07 22:25 ` [ 064/122] staging: zsmalloc: Finish conversion to a separate module Greg Kroah-Hartman
2012-08-07 22:25 ` [ 065/122] workqueue: perform cpu down operations from low priority cpu_notifier() Greg Kroah-Hartman
2012-08-07 22:25 ` [ 066/122] ACPI, APEI: Fixup common access width firmware bug Greg Kroah-Hartman
2012-08-07 22:25 ` [ 067/122] ACPI/AC: prevent OOPS on some boxes due to missing check power_supply_register() return value check Greg Kroah-Hartman
2012-08-07 22:25 ` [ 068/122] kmsg - properly print over-long continuation lines Greg Kroah-Hartman
2012-08-07 22:25 ` [ 069/122] Btrfs: call the ordered free operation without any locks held Greg Kroah-Hartman
2012-08-07 22:25 ` [ 070/122] cifs: reinstate sec=ntlmv2 mount option Greg Kroah-Hartman
2012-08-07 22:25 ` [ 071/122] cifs: ensure that we always do cifsFileInfo_get under the spinlock Greg Kroah-Hartman
2012-08-07 22:26 ` [ 072/122] spi/pl022: disable port when unused Greg Kroah-Hartman
2012-08-07 22:26 ` [ 073/122] qeth: repair crash in qeth_l3_vlan_rx_kill_vid() Greg Kroah-Hartman
2012-08-07 22:26 ` [ 074/122] tg3: add device id of Apple Thunderbolt Ethernet device Greg Kroah-Hartman
2012-08-07 22:26 ` [ 075/122] tg3: Fix Read DMA workaround for 5719 A0 Greg Kroah-Hartman
2012-08-07 22:26 ` [ 076/122] tg3: Fix race condition in tg3_get_stats64() Greg Kroah-Hartman
2012-08-07 22:26 ` [ 077/122] drm/radeon: fix fence related segfault in CS Greg Kroah-Hartman
2012-08-07 22:26 ` [ 078/122] drm/radeon: fix bo creation retry path Greg Kroah-Hartman
2012-08-07 22:26 ` [ 079/122] drm/radeon: Try harder to avoid HW cursor ending on a multiple of 128 columns Greg Kroah-Hartman
2012-08-07 22:26 ` [ 080/122] drm/radeon: fix non revealent error message Greg Kroah-Hartman
2012-08-07 22:26 ` [ 081/122] drm/radeon: fix hotplug of DP to DVI|HDMI passive adapters (v2) Greg Kroah-Hartman
2012-08-07 22:26 ` [ 082/122] drm/radeon: on hotplug force link training to happen (v2) Greg Kroah-Hartman
2012-08-07 22:26 ` [ 083/122] drm/radeon: fix dpms on/off on trinity/aruba v2 Greg Kroah-Hartman
2012-08-07 22:26 ` [ 084/122] drm/nouveau: init vblank requests list Greg Kroah-Hartman
2012-08-07 22:26 ` [ 085/122] posix_types.h: Cleanup stale __NFDBITS and related definitions Greg Kroah-Hartman
2012-08-07 22:26 ` [ 086/122] dm thin: reduce endio_hook pool size Greg Kroah-Hartman
2012-08-07 22:26 ` [ 087/122] dm thin: fix memory leak in process_prepared_mapping error paths Greg Kroah-Hartman
2012-08-07 22:26 ` [ 088/122] nfsd4: our filesystems are normally case sensitive Greg Kroah-Hartman
2012-08-07 22:26 ` [ 089/122] nfsd4: fix cr_principal comparison check in same_creds Greg Kroah-Hartman
2012-08-07 22:26 ` [ 090/122] nfs: skip commit in releasepage if were freeing memory for fs-related reasons Greg Kroah-Hartman
2012-08-07 22:26 ` [ 091/122] NFS: Fix a number of bugs in the idmapper Greg Kroah-Hartman
2012-08-07 22:26 ` [ 092/122] nouveau: Fix alignment requirements on src and dst addresses Greg Kroah-Hartman
2012-08-07 22:26 ` [ 093/122] ext4: pass a char * to ext4_count_free() instead of a buffer_head ptr Greg Kroah-Hartman
2012-08-07 22:26 ` [ 094/122] ext4: fix overhead calculation used by ext4_statfs() Greg Kroah-Hartman
2012-08-07 22:26 ` [ 095/122] ext4: fix hole punch failure when depth is greater than 0 Greg Kroah-Hartman
2012-08-07 22:26 ` [ 096/122] ext4: dont let i_reserved_meta_blocks go negative Greg Kroah-Hartman
2012-08-07 22:26 ` [ 097/122] ext4: undo ext4_calc_metadata_amount if we fail to claim space Greg Kroah-Hartman
2012-08-07 22:26 ` [ 098/122] ext4: use proper csum calculation in ext4_rename Greg Kroah-Hartman
2012-08-07 22:26 ` [ 099/122] ext4: use s_csum_seed instead of i_csum_seed for xattr block Greg Kroah-Hartman
2012-08-07 22:26 ` [ 100/122] net: Fix references to out-of-scope variables in put_cmsg_compat() Greg Kroah-Hartman
2012-08-07 22:26 ` [ 101/122] r8169: revert "add byte queue limit support" Greg Kroah-Hartman
2012-08-07 22:26 ` [ 102/122] caif: fix NULL pointer check Greg Kroah-Hartman
2012-08-07 22:26 ` [ 103/122] wanmain: comparing array with NULL Greg Kroah-Hartman
2012-08-07 22:26 ` [ 104/122] tcp: Add TCP_USER_TIMEOUT negative value check Greg Kroah-Hartman
2012-08-07 22:26 ` [ 105/122] USB: kaweth.c: use GFP_ATOMIC under spin_lock Greg Kroah-Hartman
2012-08-07 22:26 ` [ 106/122] net: fix rtnetlink IFF_PROMISC and IFF_ALLMULTI handling Greg Kroah-Hartman
2012-08-07 22:26 ` [ 107/122] tcp: perform DMA to userspace only if there is a task waiting for it Greg Kroah-Hartman
2012-08-07 22:26 ` [ 108/122] net/tun: fix ioctl() based info leaks Greg Kroah-Hartman
2012-08-07 22:26 ` [ 109/122] USB: echi-dbgp: increase the controller wait time to come out of halt Greg Kroah-Hartman
2012-08-07 22:26 ` [ 110/122] ALSA: snd-usb: fix clock source validity index Greg Kroah-Hartman
2012-08-07 22:26 ` [ 111/122] ALSA: mpu401: Fix missing initialization of irq field Greg Kroah-Hartman
2012-08-07 22:26 ` [ 112/122] ALSA: hda - Fix invalid D3 of headphone DAC on VT202x codecs Greg Kroah-Hartman
2012-08-07 22:26 ` [ 113/122] ALSA: hda - Fix mute-LED GPIO setup for HP Mini 210 Greg Kroah-Hartman
2012-08-07 22:26 ` [ 114/122] ALSA: hda - Fix polarity of mute LED on " Greg Kroah-Hartman
2012-08-07 22:26 ` [ 115/122] ALSA: hda - Fix mute-LED GPIO initialization for IDT codecs Greg Kroah-Hartman
2012-08-07 22:26 ` [ 116/122] ALSA: hda - Support dock on Lenovo Thinkpad T530 with ALC269VC Greg Kroah-Hartman
2012-08-07 22:26 ` [ 117/122] ASoC: wm8962: Allow VMID time to fully ramp Greg Kroah-Hartman
2012-08-07 22:26 ` [ 118/122] ASoC: wm8994: Ensure there are enough BCLKs for four channels Greg Kroah-Hartman
2012-08-07 22:26 ` [ 119/122] m68k: Make sys_atomic_cmpxchg_32 work on classic m68k Greg Kroah-Hartman
2012-08-07 22:26 ` [ 120/122] futex: Test for pi_mutex on fault in futex_wait_requeue_pi() Greg Kroah-Hartman
2012-08-07 22:26 ` [ 121/122] futex: Fix bug in WARN_ON for NULL q.pi_state Greg Kroah-Hartman
2012-08-07 22:26 ` [ 122/122] futex: Forbid uaddr == uaddr2 in futex_wait_requeue_pi() Greg Kroah-Hartman
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=20120807221951.222501057@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=akpm@linux-foundation.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=sarah.a.sharp@linux.intel.com \
--cc=stable@vger.kernel.org \
--cc=torvalds@linux-foundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.