Skip to contentSkip to conversation

(no subject)

DISCUSSION Philippe CARRIERE 3 participants 7 messages Oct 13, 2008 – Jan 29, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi,

following is a report of some tests of alsa.1.0.18rc3 in view of support of Tascam US-122L, which might be of interest for you. As a preliminary information, note that I patched my own Fedora kernel and alsa-plugins with Karsten Wiese'patches a few month ago and use regularly Tascam US-122L under Linux which works very fine; I also provide (experimental) packages for Fedora 9 from june 2008 on my web page.

Test 1: succeeded

- replacement of my own alsa-plugins-usb_stream-1.0.16-4.us122lv05.fc9 by alsa-plugins-usbstream-1.0.18-1.rc3.fc10 on Fedora 9 (using my own patched kernel 2.6.26 including the snd-usb-us122l module). Everything works.

Test 2: succeeded

- replacement of previous alsa-1.0.16 by alsa.1.0.18-1.rc3 (Fedora packages; thus alsa-driver-1.0.18rc3 not included). Everything works, including Tascam US-122L when using my patched kernel (which includes the snd-usb-us122l module).

Test 3: failed

- installation of alsa-driver-1.0.18rc3 (succeeded) on Fedora 9 (as weel, I tested with new Fedora 10 beta which includes kernel 2.6.27.rc3); plug in the US-122L leads to error messages from snd-usb-us122l:

# cat /var/log/messages
...
Oct 11 09:21:51 pollux kernel: usb 2-6: new high speed USB device using ehci_hcd and address 3
Oct 11 09:21:51 pollux kernel: usb 2-6: config 1 interface 1 altsetting 1 bulk endpoint 0x83 has invalid maxpacket 9
Oct 11 09:21:51 pollux kernel: usb 2-6: configuration #1 chosen from 1 choice
Oct 11 09:21:51 pollux kernel: usb 2-6: New USB device found, idVendor=0644, idProduct=800e
Oct 11 09:21:51 pollux kernel: usb 2-6: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Oct 11 09:21:51 pollux kernel: usb 2-6: Product: US-122L
Oct 11 09:21:51 pollux kernel: usb 2-6: Manufacturer: TASCAM
Oct 11 09:21:51 pollux kernel: usb 2-6: SerialNumber: no serial number
Oct 11 09:21:51 pollux kernel: ALSA /home/Test/alsa-driver-1.0.18rc3/usb/usx2y/../../alsa-kernel/usb/usx2y/usb_stream.c:618: 0
Oct 11 09:21:55 pollux kernel: ALSA /home/Test/alsa-driver-1.0.18rc3/usb/usx2y/../../alsa-kernel/usb/usx2y/us122l.c:329: us122l_start error -14 
Oct 11 09:21:55 pollux kernel: snd-usb-us122l: probe of 2-6:1.1 failed with error -5
Oct 11 09:21:55 pollux kernel: usbcore: registered new interface driver snd-usb-us122l

and

# cat /proc/asound/cards
0 [Intel          ]: HDA-Intel - HDA Intel
                      HDA Intel at 0xfebfc000 irq 21

US-122L finally not being recognized.

Test 4: succeded

- same than test 3 for Fedora 9, but using a patched ehci-hcd module (the patch adding some features from the original one by Karsten Wiese not - yet ? - included in kernel 2.6.26). Everything works including of course the US-122L.

Question:

Thus, a patched ehci-hcd module is required. Is the patch scheduled to appear in kernel 2.6.27 or would it be useful to work for providing a kind of kmod ?

Regards

Phil.

Signature · 1 line
Philippe Carriere <[email protected]>
#1 lore raw

At Mon, 13 Oct 2008 12:51:11 +0200 (CEST),

Quoted 41 lines · Philippe CARRIERE

Hi,

following is a report of some tests of alsa.1.0.18rc3 in view of support of Tascam US-122L, which might be of interest for you. As a preliminary information, note that I patched my own Fedora kernel and alsa-plugins with Karsten Wiese'patches a few month ago and use regularly Tascam US-122L under Linux which works very fine; I also provide (experimental) packages for Fedora 9 from june 2008 on my web page.

Test 1: succeeded

- replacement of my own alsa-plugins-usb_stream-1.0.16-4.us122lv05.fc9 by alsa-plugins-usbstream-1.0.18-1.rc3.fc10 on Fedora 9 (using my own patched kernel 2.6.26 including the snd-usb-us122l module). Everything works.

Test 2: succeeded

- replacement of previous alsa-1.0.16 by alsa.1.0.18-1.rc3 (Fedora packages; thus alsa-driver-1.0.18rc3 not included). Everything works, including Tascam US-122L when using my patched kernel (which includes the snd-usb-us122l module).

Test 3: failed

- installation of alsa-driver-1.0.18rc3 (succeeded) on Fedora 9 (as weel, I tested with new Fedora 10 beta which includes kernel 2.6.27.rc3); plug in the US-122L leads to error messages from snd-usb-us122l:

# cat /var/log/messages
...
Oct 11 09:21:51 pollux kernel: usb 2-6: new high speed USB device using ehci_hcd and address 3
Oct 11 09:21:51 pollux kernel: usb 2-6: config 1 interface 1 altsetting 1 bulk endpoint 0x83 has invalid maxpacket 9
Oct 11 09:21:51 pollux kernel: usb 2-6: configuration #1 chosen from 1 choice
Oct 11 09:21:51 pollux kernel: usb 2-6: New USB device found, idVendor=0644, idProduct=800e
Oct 11 09:21:51 pollux kernel: usb 2-6: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Oct 11 09:21:51 pollux kernel: usb 2-6: Product: US-122L
Oct 11 09:21:51 pollux kernel: usb 2-6: Manufacturer: TASCAM
Oct 11 09:21:51 pollux kernel: usb 2-6: SerialNumber: no serial number
Oct 11 09:21:51 pollux kernel: ALSA /home/Test/alsa-driver-1.0.18rc3/usb/usx2y/../../alsa-kernel/usb/usx2y/usb_stream.c:618: 0
Oct 11 09:21:55 pollux kernel: ALSA /home/Test/alsa-driver-1.0.18rc3/usb/usx2y/../../alsa-kernel/usb/usx2y/us122l.c:329: us122l_start error -14 
Oct 11 09:21:55 pollux kernel: snd-usb-us122l: probe of 2-6:1.1 failed with error -5
Oct 11 09:21:55 pollux kernel: usbcore: registered new interface driver snd-usb-us122l

and

# cat /proc/asound/cards
0 [Intel          ]: HDA-Intel - HDA Intel
                      HDA Intel at 0xfebfc000 irq 21

US-122L finally not being recognized.

Quoted 7 lines

Test 4: succeded

- same than test 3 for Fedora 9, but using a patched ehci-hcd module (the patch adding some features from the original one by Karsten Wiese not - yet ? - included in kernel 2.6.26). Everything works including of course the US-122L.

Question:

Thus, a patched ehci-hcd module is required. Is the patch scheduled to appear in kernel 2.6.27 or would it be useful to work for providing a kind of kmod ?

Hm, I thought Karsten mentioned that patch will go to the upstream usb tree, but it seems not done yet.

Karsten, what is the current status of your ehci patch?

thanks,

Takashi

#2 lore raw

Am Montag, 13. Oktober 2008 schrieb Takashi Iwai:

Quoted 6 lines
Quoted 1 line

Thus, a patched ehci-hcd module is required. Is the patch scheduled to appear in kernel 2.6.27 or would it be useful to work for providing a kind of kmod ?

Hm, I thought Karsten mentioned that patch will go to the upstream usb tree, but it seems not done yet.

Karsten, what is the current status of your ehci patch?

has to be adjusted to fit head and submitted to usb-devel again. will get back to it once my current main-project allows me to. that might well be 09. sorry.

thanks,
Karsten

#3 lore raw

Might this patch (the original one, without features yet implemented in 2.6.26, and an extremely slight modification to fit it) I use on Fedora kernel (the patch also applies as it stands to vanilla) save works and time ?

Regards,

Phil.

Quoted 7 lines · Karsten Wiese

Am Montag, 13. Oktober 2008 schrieb Takashi Iwai:

Quoted 5 lines
Quoted 1 line

Thus, a patched ehci-hcd module is required. Is the patch scheduled to appear in kernel 2.6.27 or would it be useful to work for providing a kind of kmod ?

Hm, I thought Karsten mentioned that patch will go to the upstream usb tree, but it seems not done yet.

Quoted 9 lines
Quoted 1 line

Karsten, what is the current status of your ehci patch?

has to be adjusted to fit head and submitted to usb-devel again. will get back to it once my current main-project allows me to. that might well be 09. sorry.

thanks,
Karsten

drivers/usb/host/ehci.h renamed from home/Test/rpmbuild/BUILD/kernel-2.6.26/vanilla-2.6.26/drivers/usb/host/ehci.h +6 -0
diff -uNrp /home/Test/rpmbuild/BUILD/kernel-2.6.26/vanilla-2.6.26/drivers/usb/host/ehci.h vanilla-2.6.26/drivers/usb/host/ehci.h
@@ -86,6 +86,9 @@ struct ehci_hcd {			/* one per controlle
 	union ehci_shadow	*pshadow;	/* mirror hw periodic table */
 	int			next_uframe;	/* scan periodic, start here */
 	unsigned		periodic_sched;	/* periodic activity count */
+	struct list_head	cached_itd_list; /* list of itds completed
+			while frame hadn't yet elapsed */
+	unsigned		hw_frame;
 
 	/* per root hub port */
 	unsigned long		reset_done [EHCI_MAX_ROOT_PORTS];
@@ -205,6 +208,9 @@ timer_action (struct ehci_hcd *ehci, enu
 	}
 }
 
+static void free_cached_itd_list(struct ehci_hcd *ehci);
+
+
 /*-------------------------------------------------------------------------*/
 
 /* EHCI register interface, corresponds to EHCI Revision 0.95 specification */
drivers/usb/host/ehci-hcd.c renamed from home/Test/rpmbuild/BUILD/kernel-2.6.26/vanilla-2.6.26/drivers/usb/host/ehci-hcd.c +2 -0
diff -uNrp /home/Test/rpmbuild/BUILD/kernel-2.6.26/vanilla-2.6.26/drivers/usb/host/ehci-hcd.c vanilla-2.6.26/drivers/usb/host/ehci-hcd.c
@@ -479,6 +479,7 @@ static int ehci_init(struct usb_hcd *hcd
 	 * periodic_size can shrink by USBCMD update if hcc_params allows.
 	 */
 	ehci->periodic_size = DEFAULT_I_TDPS;
+	INIT_LIST_HEAD(&ehci->cached_itd_list);
 	if ((retval = ehci_mem_init(ehci, GFP_KERNEL)) < 0)
 		return retval;
 
@@ -491,6 +492,7 @@ static int ehci_init(struct usb_hcd *hcd
 
 	ehci->reclaim = NULL;
 	ehci->next_uframe = -1;
+	ehci->hw_frame = -1;
 
 	/*
 	 * dedicate a qh for the async ring head, since we couldn't unlink
drivers/usb/host/ehci-mem.c renamed from home/Test/rpmbuild/BUILD/kernel-2.6.26/vanilla-2.6.26/drivers/usb/host/ehci-mem.c +1 -0
diff -uNrp /home/Test/rpmbuild/BUILD/kernel-2.6.26/vanilla-2.6.26/drivers/usb/host/ehci-mem.c vanilla-2.6.26/drivers/usb/host/ehci-mem.c
@@ -128,6 +128,7 @@ static inline void qh_put (struct ehci_q
 
 static void ehci_mem_cleanup (struct ehci_hcd *ehci)
 {
+	free_cached_itd_list(ehci);
 	if (ehci->async)
 		qh_put (ehci->async);
 	ehci->async = NULL;
drivers/usb/host/ehci-sched.c renamed from home/Test/rpmbuild/BUILD/kernel-2.6.26/vanilla-2.6.26/drivers/usb/host/ehci-sched.c +47 -8

93 lines not on this page · raw message

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#4 lore raw

Am Dienstag, 14. Oktober 2008 schrieb Philippe Carriere:

Quoted 4 lines

Might this patch (the original one, without features yet implemented in 2.6.26, and an extremely slight modification to fit it) I use on Fedora kernel (the patch also applies as it stands to vanilla) save works and time ?

maybe.
I guess the patch would have to fit what will become 2.6.28.

regards,
Karsten

#5 lore raw
In reply to Philippe Carriere

Am Dienstag, 14. Oktober 2008 schrieb Philippe Carriere:

Quoted 4 lines

Might this patch (the original one, without features yet implemented in 2.6.26, and an extremely slight modification to fit it) I use on Fedora kernel (the patch also applies as it stands to vanilla) save works and time ?

I resent the patch to [email protected] today. Maybe it helps, if you post a "tested-by:" there.

Regards,
Karsten

Hi,

this is a refresh to let patch fit ontop 2.6.29-rc2.
Changes from previous version:
- use variable clock_frame instead of hw_frame
- Patch Description exactified
snd_usb_us122l (in kernel since .28) needs it, if device is attached to ehci.

thanks,
Karsten

----------------------------------------------------------------------
From: Karsten Wiese <[email protected]>
Date: Wed, 13 Feb 2008 22:22:09 +0100
Subject: [PATCH] USB: Prevent EHCI ITDs reusage while frame is active

ITDs can be detached from urbs, before the frame elapses. Now those ITDs are immediately recycled.
If the ITD is reused before the frame elapses, the ITD becomes invalid regarding the not yet elapsed frame.
Patch takes care of those ITDs by moving them into a new ehci member list cached_itd_list. ITDs resting in cached_itd_list are moved back into their stream's free_list once scan_periodic() detects that the active frame has elapsed.

---
 drivers/usb/host/ehci-hcd.c   |    2 +
 drivers/usb/host/ehci-mem.c   |    1 +
 drivers/usb/host/ehci-sched.c |   54 ++++++++++++++++++++++++++++++++++------
 drivers/usb/host/ehci.h       |    5 ++++
 4 files changed, 54 insertions(+), 8 deletions(-)
drivers/usb/host/ehci-hcd.c +2 -0
index 4725d15..e551bb3 100644
@@ -485,6 +485,7 @@ static int ehci_init(struct usb_hcd *hcd)
 	 * periodic_size can shrink by USBCMD update if hcc_params allows.
 	 */
 	ehci->periodic_size = DEFAULT_I_TDPS;
+	INIT_LIST_HEAD(&ehci->cached_itd_list);
 	if ((retval = ehci_mem_init(ehci, GFP_KERNEL)) < 0)
 		return retval;
 
@@ -497,6 +498,7 @@ static int ehci_init(struct usb_hcd *hcd)
 
 	ehci->reclaim = NULL;
 	ehci->next_uframe = -1;
+	ehci->clock_frame = -1;
 
 	/*
 	 * dedicate a qh for the async ring head, since we couldn't unlink
drivers/usb/host/ehci-mem.c +1 -0
index 0431397..10d5291 100644
@@ -128,6 +128,7 @@ static inline void qh_put (struct ehci_qh *qh)
 
 static void ehci_mem_cleanup (struct ehci_hcd *ehci)
 {
+	free_cached_itd_list(ehci);
 	if (ehci->async)
 		qh_put (ehci->async);
 	ehci->async = NULL;
drivers/usb/host/ehci-sched.c +46 -8

89 lines not on this page · raw message

drivers/usb/host/ehci.h +5 -0
index fb7054c..5262fb7 100644
@@ -86,6 +86,9 @@ struct ehci_hcd {			/* one per controller */
 	union ehci_shadow	*pshadow;	/* mirror hw periodic table */
 	int			next_uframe;	/* scan periodic, start here */
 	unsigned		periodic_sched;	/* periodic activity count */
+	struct list_head	cached_itd_list; /* list of itds completed
+						    while frame hadn't yet elapsed */
+	unsigned		clock_frame;
 
 	/* per root hub port */
 	unsigned long		reset_done [EHCI_MAX_ROOT_PORTS];
@@ -220,6 +223,8 @@ timer_action (struct ehci_hcd *ehci, enum ehci_timer_action action)
 	}
 }
 
+static void free_cached_itd_list(struct ehci_hcd *ehci);
+
 /*-------------------------------------------------------------------------*/
 
 #include <linux/usb/ehci_def.h>
Signature · 1 line
1.6.0.6

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#6 lore raw

Hi Karsten,

I successfully tested your new version of the patch and sent a "tested:by" to [email protected] today (see attached). Hope it will speed up the process.

Regards,

Phil.

Quoted 214 lines · Karsten Wiese

Am Dienstag, 14. Oktober 2008 schrieb Philippe Carriere:

Quoted 4 lines

Might this patch (the original one, without features yet implemented in 2.6.26, and an extremely slight modification to fit it) I use on Fedora kernel (the patch also applies as it stands to vanilla) save works and time ?

I resent the patch to [email protected] today. Maybe it helps, if you post a "tested-by:" there.

Regards,
Karsten

pièce jointe message de courriel (forwarded message), "Karsten Wiese <[email protected]>: [RESEND][PATCH] USB: Prevent EHCI ITDs reusage while frame is active"

Quoted 199 lines

-------- Message transféré --------
De: Karsten Wiese <[email protected]>
À: David Brownell <[email protected]>
Cc: [email protected]
Sujet: [RESEND][PATCH] USB: Prevent EHCI ITDs reusage while frame is active
Date: Mon, 26 Jan 2009 14:32:51 +0100

pièce jointe document texte brut (forwarded message) Hi,

this is a refresh to let patch fit ontop 2.6.29-rc2.
Changes from previous version:
- use variable clock_frame instead of hw_frame
- Patch Description exactified
snd_usb_us122l (in kernel since .28) needs it, if device is attached to ehci.

thanks,
Karsten

----------------------------------------------------------------------
From: Karsten Wiese <[email protected]>
Date: Wed, 13 Feb 2008 22:22:09 +0100
Subject: [PATCH] USB: Prevent EHCI ITDs reusage while frame is active

ITDs can be detached from urbs, before the frame elapses. Now those ITDs are immediately recycled.
If the ITD is reused before the frame elapses, the ITD becomes invalid regarding the not yet elapsed frame.
Patch takes care of those ITDs by moving them into a new ehci member list cached_itd_list. ITDs resting in cached_itd_list are moved back into their stream's free_list once scan_periodic() detects that the active frame has elapsed.

---
 drivers/usb/host/ehci-hcd.c   |    2 +
 drivers/usb/host/ehci-mem.c   |    1 +
 drivers/usb/host/ehci-sched.c |   54 ++++++++++++++++++++++++++++++++++------
 drivers/usb/host/ehci.h       |    5 ++++
 4 files changed, 54 insertions(+), 8 deletions(-)
drivers/usb/host/ehci-hcd.c +2 -0
index 4725d15..e551bb3 100644
@@ -485,6 +485,7 @@ static int ehci_init(struct usb_hcd *hcd)
 	 * periodic_size can shrink by USBCMD update if hcc_params allows.
 	 */
 	ehci->periodic_size = DEFAULT_I_TDPS;
+	INIT_LIST_HEAD(&ehci->cached_itd_list);
 	if ((retval = ehci_mem_init(ehci, GFP_KERNEL)) < 0)
 		return retval;
 
@@ -497,6 +498,7 @@ static int ehci_init(struct usb_hcd *hcd)
 
 	ehci->reclaim = NULL;
 	ehci->next_uframe = -1;
+	ehci->clock_frame = -1;
 
 	/*
 	 * dedicate a qh for the async ring head, since we couldn't unlink
drivers/usb/host/ehci-mem.c +1 -0
index 0431397..10d5291 100644
@@ -128,6 +128,7 @@ static inline void qh_put (struct ehci_qh *qh)
 
 static void ehci_mem_cleanup (struct ehci_hcd *ehci)
 {
+	free_cached_itd_list(ehci);
 	if (ehci->async)
 		qh_put (ehci->async);
 	ehci->async = NULL;
drivers/usb/host/ehci-sched.c +46 -8
index a081ee6..c1f7d5f 100644
@@ -1004,7 +1004,8 @@ iso_stream_put(struct ehci_hcd *ehci, struct ehci_iso_stream *stream)
 
 		is_in = (stream->bEndpointAddress & USB_DIR_IN) ? 0x10 : 0;
 		stream->bEndpointAddress &= 0x0f;
-		stream->ep->hcpriv = NULL;
+		if (stream->ep)
+			stream->ep->hcpriv = NULL;
 
 		if (stream->rescheduled) {
 			ehci_info (ehci, "ep%d%s-iso rescheduled "
@@ -1653,14 +1654,26 @@ itd_complete (
 			(stream->bEndpointAddress & USB_DIR_IN) ? "in" : "out");
 	}
 	iso_stream_put (ehci, stream);
-	/* OK to recycle this ITD now that its completion callback ran. */
+
 done:
 	usb_put_urb(urb);
 	itd->urb = NULL;
-	itd->stream = NULL;
-	list_move(&itd->itd_list, &stream->free_list);
-	iso_stream_put(ehci, stream);
-
+	if (ehci->clock_frame != itd->frame || itd->index[7] != -1) {
+		/* OK to recycle this ITD now. */
+		itd->stream = NULL;
+		list_move(&itd->itd_list, &stream->free_list);
+		iso_stream_put(ehci, stream);
+	} else {
+		/* HW might still start transactions based on this ITD.
+		   If its content changed that is. Move it to a safe place. */
+		list_move(&itd->itd_list, &ehci->cached_itd_list);
+		if (stream->refcount == 2) {
+			/* If iso_stream_put() would be called here, stream
+			   would be freed. Prevent stream's reusage instead. */
+			stream->ep->hcpriv = NULL;
+			stream->ep = NULL;
+		}
+	}
 	return retval;
 }
 
@@ -2101,6 +2114,20 @@ done:
 
 /*-------------------------------------------------------------------------*/
 
+static void free_cached_itd_list(struct ehci_hcd *ehci)
+{
+	struct ehci_itd *itd, *n;
+
+	list_for_each_entry_safe(itd, n, &ehci->cached_itd_list, itd_list) {
+		struct ehci_iso_stream	*stream = itd->stream;
+		itd->stream = NULL;
+		list_move(&itd->itd_list, &stream->free_list);
+		iso_stream_put(ehci, stream);
+	}
+}
+
+/*-------------------------------------------------------------------------*/
+
 static void
 scan_periodic (struct ehci_hcd *ehci)
 {
@@ -2115,10 +2142,17 @@ scan_periodic (struct ehci_hcd *ehci)
 	 * Touches as few pages as possible:  cache-friendly.
 	 */
 	now_uframe = ehci->next_uframe;
-	if (HC_IS_RUNNING (ehci_to_hcd(ehci)->state))
+	if (HC_IS_RUNNING(ehci_to_hcd(ehci)->state)) {
 		clock = ehci_readl(ehci, &ehci->regs->frame_index);
-	else
+		clock_frame = (clock >> 3) % ehci->periodic_size;
+	} else  {
 		clock = now_uframe + mod - 1;
+		clock_frame = -1;
+	}
+	if (ehci->clock_frame != clock_frame) {
+		free_cached_itd_list(ehci);
+		ehci->clock_frame = clock_frame;
+	}
 	clock %= mod;
 	clock_frame = clock >> 3;
 
@@ -2277,6 +2311,10 @@ restart:
 			/* rescan the rest of this frame, then ... */
 			clock = now;
 			clock_frame = clock >> 3;
+			if (ehci->clock_frame != clock_frame) {
+				free_cached_itd_list(ehci);
+				ehci->clock_frame = clock_frame;
+			}
 		} else {
 			now_uframe++;
 			now_uframe %= mod;
drivers/usb/host/ehci.h +5 -0
index fb7054c..5262fb7 100644
@@ -86,6 +86,9 @@ struct ehci_hcd {			/* one per controller */
 	union ehci_shadow	*pshadow;	/* mirror hw periodic table */
 	int			next_uframe;	/* scan periodic, start here */
 	unsigned		periodic_sched;	/* periodic activity count */
+	struct list_head	cached_itd_list; /* list of itds completed
+						    while frame hadn't yet elapsed */
+	unsigned		clock_frame;
 
 	/* per root hub port */
 	unsigned long		reset_done [EHCI_MAX_ROOT_PORTS];
@@ -220,6 +223,8 @@ timer_action (struct ehci_hcd *ehci, enum ehci_timer_action action)
 	}
 }
 
+static void free_cached_itd_list(struct ehci_hcd *ehci);
+
 /*-------------------------------------------------------------------------*/
 
 #include <linux/usb/ehci_def.h>
Signature · 1 line
Philippe Carriere <[email protected]>
Quoted 1 line

From [email protected] Thu Jan 29 09:30:07 2009

Subject: [RESEND][PATCH] USB: Prevent EHCI ITDs reusage while frame is
active: tested by: Philippe Carriere.
From: Philippe Carriere <[email protected]>
To: [email protected]
Content-Type: multipart/mixed; boundary="=-VmmaepDIq/JbLd+TeS0C"
Message-Id: <[email protected]>
Mime-Version: 1.0
X-Mailer: Evolution 2.24.3 (2.24.3-1.fc10)
Date: Thu, 29 Jan 2009 09:30:07 +0100
X-Evolution-Format: text/plain
X-Evolution-Account: [email protected] X-Evolution-Transport:
smtp://philippe-f.carriere;[email protected]/;use_ssl=never
X-Evolution-Fcc: mbox:/home/philippe/.evolution/mail/local#Sent

--=-VmmaepDIq/JbLd+TeS0C
Content-Type: text/plain
Content-Transfer-Encoding: 8bit

Hi,

I successfully tested the refreshed patch of Karsten using Fedora rawhide packages. Following are some informations on the test:

original kernel: 2.6.29-0.53.rc2.git1.fc11.x86_64
patched kernel: Linux 2.6.29-0.53.rc2.git1.ehcius122l.fc11.x86_64 #1 SMP Wed Jan 28 22:48:01 CET 2009 x86_64 x86_64 x86_64 GNU/Linux
alsa: alsa-lib-1.0.19-1.fc11, alsa-plugins-usbstream-1.0.18
jack: jack-audio-connection-kit-0.116.1-3.fc11
qjackctl: qjackctl-0.3.3-1.fc10
audacious: audacious-1.5.1-5.fc11

after plugin the Tascam US-122L:

[root@pollux Test]# tail /var/log/messages

Jan 29 08:05:53 pollux kernel: usb 2-6: new high speed USB device using
ehci_hcd and address 4
Jan 29 08:05:53 pollux kernel: usb 2-6: config 1 interface 1 altsetting
1 bulk endpoint 0x83 has invalid maxpacket 9
Jan 29 08:05:53 pollux kernel: usb 2-6: New USB device found,
idVendor=0644, idProduct=800e
Jan 29 08:05:53 pollux kernel: usb 2-6: New USB device strings: Mfr=1,
Product=2, SerialNumber=3
Jan 29 08:05:53 pollux kernel: usb 2-6: Product: US-122L
Jan 29 08:05:53 pollux kernel: usb 2-6: Manufacturer: TASCAM
Jan 29 08:05:53 pollux kernel: usb 2-6: SerialNumber: no serial number
Jan 29 08:05:53 pollux kernel: usb 2-6: configuration #1 chosen from 1
choice
Jan 29 08:06:08 pollux kernel: ALSA sound/usb/usx2y/usb_stream.c:457:
underrun, status=4294967278
Jan 29 08:06:08 pollux kernel: ALSA sound/usb/usx2y/usb_stream.c:457:

underrun, status=4294967278

[root@pollux Test]# cat /proc/asound/cards
0 [Intel ]: HDA-Intel - HDA Intel

                      HDA Intel at 0xfebfc000 irq 21
1 [US122L         ]: USB US-122L - TASCAM US-122L
                      TASCAM US-122L (644:800e if 0 at 002/004)

and jack messages were

08:50:00.226 /usr/bin/jackd -R -P89 -dalsa -dusb_stream:1 -r48000 -p512 -n2
jackd 0.116.1
Copyright 2001-2005 Paul Davis and others.
jackd comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome to redistribute it under certain conditions; see the file COPYING for details JACK compiled with System V SHM support.
08:50:00.251 JACK was started with PID=6417.
loading driver ..
apparent rate = 48000
creating alsa driver ... usb_stream:1|usb_stream:1|512|2|48000|0|0| nomon|swmeter|-|32bit
ALSA lib control.c:909:(snd_ctl_open_noupdate) Invalid CTL usb_stream:1 control open "usb_stream:1" (No such file or directory) configuring for 48000Hz, period = 512 frames (10.7 ms), buffer = 2 periods
ALSA: final selected sample format for capture: 24bit little-endian
ALSA: use 2 periods for capture
ALSA: final selected sample format for playback: 24bit little-endian
ALSA: use 2 periods for playback
08:50:02.397 Server configuration saved to "/home/Test/.jackdrc". 08:50:02.398 Statistics reset.
08:50:02.547 Client activated.
08:50:02.550 JACK connection change.
08:50:02.558 JACK connection graph change.

Tested by .mp3 file playback using audacious (with plugin jack).

Additional notes: the previous version of the patch is routinely used by
myself, at least some Fedora users using my packages at
http://pagesperso-orange.fr/La-page-Web-of-Phil/Tascam_US-122L/Telechargement_us122l.html , and under Debian and Ubuntu (Federico Briata web site at http://wiki.briata.org/doku.php?id=testing_us122l_under_linux ) under 2.6.26 and 2.6.27 kernel.

Hope it will be soon integrated to 2.6.29 devel.

Regards

Phil.

--=-VmmaepDIq/JbLd+TeS0C
Content-Disposition: attachment; filename="forwarded_message"
Content-Type: message/rfc822; name="forwarded_message"

From: Karsten Wiese <[email protected]>
To: David Brownell <[email protected]>
Subject: [RESEND][PATCH] USB: Prevent EHCI ITDs reusage while frame is
active
Date: Mon, 26 Jan 2009 14:32:51 +0100
User-Agent: KMail/1.9.9
Cc: [email protected]
References: <[email protected]>

	 <[email protected]>
	 <[email protected]>

In-Reply-To: <[email protected]>
MIME-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
Content-Disposition: inline
Message-Id: <[email protected]>
Content-Transfer-Encoding: 8bit

Hi,

this is a refresh to let patch fit ontop 2.6.29-rc2.
Changes from previous version:
- use variable clock_frame instead of hw_frame
- Patch Description exactified
snd_usb_us122l (in kernel since .28) needs it, if device is attached to ehci.

thanks,
Karsten

----------------------------------------------------------------------
From: Karsten Wiese <[email protected]>
Date: Wed, 13 Feb 2008 22:22:09 +0100
Subject: [PATCH] USB: Prevent EHCI ITDs reusage while frame is active

ITDs can be detached from urbs, before the frame elapses. Now those ITDs are immediately recycled.
If the ITD is reused before the frame elapses, the ITD becomes invalid regarding the not yet elapsed frame.
Patch takes care of those ITDs by moving them into a new ehci member list cached_itd_list. ITDs resting in cached_itd_list are moved back into their stream's free_list once scan_periodic() detects that the active frame has elapsed.

---
 drivers/usb/host/ehci-hcd.c   |    2 +
 drivers/usb/host/ehci-mem.c   |    1 +
 drivers/usb/host/ehci-sched.c |   54 ++++++++++++++++++++++++++++++++++------
 drivers/usb/host/ehci.h       |    5 ++++
 4 files changed, 54 insertions(+), 8 deletions(-)
drivers/usb/host/ehci-hcd.c +2 -0
index 4725d15..e551bb3 100644
@@ -485,6 +485,7 @@ static int ehci_init(struct usb_hcd *hcd)
 	 * periodic_size can shrink by USBCMD update if hcc_params allows.
 	 */
 	ehci->periodic_size = DEFAULT_I_TDPS;
+	INIT_LIST_HEAD(&ehci->cached_itd_list);
 	if ((retval = ehci_mem_init(ehci, GFP_KERNEL)) < 0)
 		return retval;
 
@@ -497,6 +498,7 @@ static int ehci_init(struct usb_hcd *hcd)
 
 	ehci->reclaim = NULL;
 	ehci->next_uframe = -1;
+	ehci->clock_frame = -1;
 
 	/*
 	 * dedicate a qh for the async ring head, since we couldn't unlink
drivers/usb/host/ehci-mem.c +1 -0
index 0431397..10d5291 100644
@@ -128,6 +128,7 @@ static inline void qh_put (struct ehci_qh *qh)
 
 static void ehci_mem_cleanup (struct ehci_hcd *ehci)
 {
+	free_cached_itd_list(ehci);
 	if (ehci->async)
 		qh_put (ehci->async);
 	ehci->async = NULL;
drivers/usb/host/ehci-sched.c +46 -8

89 lines not on this page · raw message

drivers/usb/host/ehci.h +5 -0
index fb7054c..5262fb7 100644
@@ -86,6 +86,9 @@ struct ehci_hcd {			/* one per controller */
 	union ehci_shadow	*pshadow;	/* mirror hw periodic table */
 	int			next_uframe;	/* scan periodic, start here */
 	unsigned		periodic_sched;	/* periodic activity count */
+	struct list_head	cached_itd_list; /* list of itds completed
+						    while frame hadn't yet elapsed */
+	unsigned		clock_frame;
 
 	/* per root hub port */
 	unsigned long		reset_done [EHCI_MAX_ROOT_PORTS];
@@ -220,6 +223,8 @@ timer_action (struct ehci_hcd *ehci, enum ehci_timer_action action)
 	}
 }
 
+static void free_cached_itd_list(struct ehci_hcd *ehci);
+
 /*-------------------------------------------------------------------------*/
 
 #include <linux/usb/ehci_def.h>
Signature · 4 lines
1.6.0.6


--=-VmmaepDIq/JbLd+TeS0C--

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel