mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kamal Mostafa <kamal@canonical.com>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org,
	kernel-team@lists.ubuntu.com
Cc: Alan Stern <stern@rowland.harvard.edu>,
	Clemens Ladisch <clemens@ladisch.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Kamal Mostafa <kamal@canonical.com>
Subject: [PATCH 11/58] USB: EHCI: accept very late isochronous URBs
Date: Tue,  3 Sep 2013 09:23:15 -0700	[thread overview]
Message-ID: <1378225442-20654-12-git-send-email-kamal@canonical.com> (raw)
In-Reply-To: <1378225442-20654-1-git-send-email-kamal@canonical.com>

3.8.13.8 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Alan Stern <stern@rowland.harvard.edu>

commit 24f531371de17010f2b1b57d90e42240032e7733 upstream.

Since commits 4005ad4390bf (EHCI: implement new semantics for
URB_ISO_ASAP) and c75c5ab575af (ALSA: USB: adjust for changed 3.8 USB
API) became widely distributed, people have been experiencing problems
with audio transfers.  The slightest underrun causes complete failure,
requiring the audio stream to be restarted.

It turns out that the current isochronous API doesn't handle underruns
in the best way.  The ALSA developers would much rather have transfers
that are submitted too late be accepted and complete in the normal
fashion, rather than being refused outright.

This patch implements the requested approach.  When an isochronous URB
submission is so late that all its scheduled slots have already
expired, a debugging message will be printed in the log and the URB
will be accepted as usual.  Assuming it was submitted by a completion
handler (which is normally the case), it will complete shortly
thereafter with all the usb_iso_packet_descriptor status fields marked
-EXDEV.

This fixes (for ehci-hcd)

	https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1191603

It should be applied to all kernels that include commit 4005ad4390bf.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Tested-by: Maksim Boyko <maksboyko@yandex.ru>
CC: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/usb/host/ehci-sched.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c
index 5a00ef3..64a9c97 100644
--- a/drivers/usb/host/ehci-sched.c
+++ b/drivers/usb/host/ehci-sched.c
@@ -1394,21 +1394,20 @@ iso_stream_schedule (
 
 		/* Behind the scheduling threshold? */
 		if (unlikely(start < next)) {
+			unsigned now2 = (now - base) & (mod - 1);
 
 			/* USB_ISO_ASAP: Round up to the first available slot */
 			if (urb->transfer_flags & URB_ISO_ASAP)
 				start += (next - start + period - 1) & -period;
 
 			/*
-			 * Not ASAP: Use the next slot in the stream.  If
-			 * the entire URB falls before the threshold, fail.
+			 * Not ASAP: Use the next slot in the stream,
+			 * no matter what.
 			 */
-			else if (start + span - period < next) {
-				ehci_dbg(ehci, "iso urb late %p (%u+%u < %u)\n",
+			else if (start + span - period < now2) {
+				ehci_dbg(ehci, "iso underrun %p (%u+%u < %u)\n",
 						urb, start + base,
-						span - period, next + base);
-				status = -EXDEV;
-				goto fail;
+						span - period, now2 + base);
 			}
 		}
 
-- 
1.8.1.2


  parent reply	other threads:[~2013-09-03 16:24 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-03 16:23 [ 3.8.y.z extended stable ] Linux 3.8.13.8 stable review Kamal Mostafa
2013-09-03 16:23 ` [PATCH 01/58] mac80211: fix infinite loop in ieee80211_determine_chantype Kamal Mostafa
2013-09-03 16:23 ` [PATCH 02/58] cfg80211/mac80211: disconnect on suspend Kamal Mostafa
2013-09-03 16:23 ` [PATCH 03/58] cfg80211: fix P2P GO interface teardown Kamal Mostafa
2013-09-03 16:23 ` [PATCH 04/58] iwl4965: set power mode early Kamal Mostafa
2013-09-03 16:23 ` [PATCH 05/58] iwl4965: reset firmware after rfkill off Kamal Mostafa
2013-09-03 16:23 ` [PATCH 06/58] ASoC: cs42l52: Reorder Min/Max and update to SX_TLV for Beep Volume Kamal Mostafa
2013-09-03 16:23 ` [PATCH 07/58] can: pcan_usb: fix wrong memcpy() bytes length Kamal Mostafa
2013-09-03 16:23 ` [PATCH 08/58] ALSA: 6fire: make buffers DMA-able (pcm) Kamal Mostafa
2013-09-03 16:23 ` [PATCH 09/58] ALSA: 6fire: make buffers DMA-able (midi) Kamal Mostafa
2013-09-03 16:23 ` [PATCH 10/58] jbd2: Fix use after free after error in jbd2_journal_dirty_metadata() Kamal Mostafa
2013-09-03 16:23 ` Kamal Mostafa [this message]
2013-09-03 16:23 ` [PATCH 12/58] USB-Serial: Fix error handling of usb_wwan Kamal Mostafa
2013-09-03 16:23 ` [PATCH 13/58] USB: mos7840: fix big-endian probe Kamal Mostafa
2013-09-03 16:23 ` [PATCH 14/58] USB: adutux: fix big-endian device-type reporting Kamal Mostafa
2013-09-03 16:23 ` [PATCH 15/58] USB: ti_usb_3410_5052: fix big-endian firmware handling Kamal Mostafa
2013-09-03 16:23 ` [PATCH 16/58] ARM: 7809/1: perf: fix event validation for software group leaders Kamal Mostafa
2013-09-03 16:23 ` [PATCH 17/58] m68k/atari: ARAnyM - Fix NatFeat module support Kamal Mostafa
2013-09-03 16:23 ` [PATCH 18/58] m68k: Truncate base in do_div() Kamal Mostafa
2013-09-03 16:23 ` [PATCH 19/58] usb: add two quirky touchscreen Kamal Mostafa
2013-09-03 16:23 ` [PATCH 20/58] USB: mos7720: fix broken control requests Kamal Mostafa
2013-09-03 16:23 ` [PATCH 21/58] USB: keyspan: fix null-deref at disconnect and release Kamal Mostafa
2013-09-03 16:23 ` [PATCH 22/58] ASoC: tegra: fix Tegra30 I2S capture parameter setup Kamal Mostafa
2013-09-03 16:23 ` [PATCH 23/58] ALSA: hda - Add a fixup for Gateway LT27 Kamal Mostafa
2013-09-03 16:23 ` [PATCH 24/58] mm: fix the TLB range flushed when __tlb_remove_page() runs out of slots Kamal Mostafa
2013-09-03 16:23 ` [PATCH 25/58] arch, mm: Remove tlb_fast_mode() Kamal Mostafa
2013-09-03 16:23 ` [PATCH 26/58] Fix TLB gather virtual address range invalidation corner cases Kamal Mostafa
2013-09-03 16:23 ` [PATCH 27/58] s390: Fix broken build Kamal Mostafa
2013-09-03 16:23 ` [PATCH 28/58] x86 get_unmapped_area: Access mmap_legacy_base through mm_struct member Kamal Mostafa
2013-09-03 16:23 ` [PATCH 29/58] Bluetooth: Add support for Foxconn/Hon Hai [0489:e04d] Kamal Mostafa
2013-09-03 16:23 ` [PATCH 30/58] Bluetooth: ath3k: Add support for Fujitsu Lifebook UH5x2 [04c5:1330] Kamal Mostafa
2013-09-03 16:23 ` [PATCH 31/58] Bluetooth: ath3k: Add support for ID 0x13d3/0x3402 Kamal Mostafa
2013-09-03 16:23 ` [PATCH 32/58] Bluetooth: Add support for Atheros [0cf3:3121] Kamal Mostafa
2013-09-03 16:23 ` [PATCH 33/58] Bluetooth: Add support for Atheros [0cf3:e003] Kamal Mostafa
2013-09-03 16:23 ` [PATCH 34/58] iwlwifi: dvm: fix calling ieee80211_chswitch_done() with NULL Kamal Mostafa
2013-09-03 16:23 ` [PATCH 35/58] iwlwifi: pcie: disable L1 Active after pci_enable_device Kamal Mostafa
2013-09-03 16:23 ` [PATCH 36/58] zd1201: do not use stack as URB transfer_buffer Kamal Mostafa
2013-09-03 16:23 ` [PATCH 37/58] Hostap: copying wrong data prism2_ioctl_giwaplist() Kamal Mostafa
2013-09-03 16:23 ` [PATCH 38/58] ARM: at91/DT: fix at91sam9n12ek memory node Kamal Mostafa
2013-09-03 16:23 ` [PATCH 39/58] drm/i915: Move num_pipes to intel info Kamal Mostafa
2013-09-03 16:23 ` [PATCH 40/58] drm/i915: Don't deref pipe->cpu_transcoder in the hangcheck code Kamal Mostafa
2013-09-03 16:23 ` [PATCH 41/58] drm/i915: Invalidate TLBs for the rings after a reset Kamal Mostafa
2013-09-03 16:23 ` [PATCH 42/58] libata: apply behavioral quirks to sil3826 PMP Kamal Mostafa
2013-09-03 16:23 ` [PATCH 43/58] ARM: davinci: nand: specify ecc strength Kamal Mostafa
2013-09-03 16:23 ` [PATCH 44/58] ARM: allow kuser helpers to be removed from the vector page Kamal Mostafa
2013-09-03 16:23 ` [PATCH 45/58] ARM: 7816/1: CONFIG_KUSER_HELPERS: fix help text Kamal Mostafa
2013-09-03 16:23 ` [PATCH 46/58] arm64: perf: fix array out of bounds access in armpmu_map_hw_event() Kamal Mostafa
2013-09-03 16:23 ` [PATCH 47/58] arm64: perf: fix event validation for software group leaders Kamal Mostafa
2013-09-03 16:23 ` [PATCH 48/58] sata_fsl: save irqs while coalescing Kamal Mostafa
2013-09-03 16:23 ` [PATCH 49/58] xen/events: initialize local per-cpu mask for all possible events Kamal Mostafa
2013-09-03 16:23 ` [PATCH 50/58] xen/events: mask events when changing their VCPU binding Kamal Mostafa
2013-09-03 16:23 ` [PATCH 51/58] block: Add bio_for_each_segment_all() Kamal Mostafa
2013-09-03 16:23 ` [PATCH 52/58] [SCSI] sg: Fix user memory corruption when SG_IO is interrupted by a signal Kamal Mostafa
2013-09-03 16:23 ` [PATCH 53/58] of: fdt: fix memory initialization for expanded DT Kamal Mostafa
2013-09-03 16:23 ` [PATCH 54/58] [SCSI] zfcp: fix lock imbalance by reworking request queue locking Kamal Mostafa
2013-09-03 16:23 ` [PATCH 55/58] [SCSI] zfcp: fix schedule-inside-lock in scsi_device list loops Kamal Mostafa
2013-09-03 16:24 ` [PATCH 56/58] drivers/platform/olpc/olpc-ec.c: initialise earlier Kamal Mostafa
2013-09-03 16:24 ` [PATCH 57/58] nilfs2: remove double bio_put() in nilfs_end_bio_write() for BIO_EOPNOTSUPP error Kamal Mostafa
2013-09-03 16:24 ` [PATCH 58/58] nilfs2: fix issue with counting number of bio requests for BIO_EOPNOTSUPP error detection 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=1378225442-20654-12-git-send-email-kamal@canonical.com \
    --to=kamal@canonical.com \
    --cc=clemens@ladisch.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel-team@lists.ubuntu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@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®