Re: linux-next crash in xhci_add_ep_to_interval

2014-06-05 Thread Dan Williams
[ adding Mathias ]

On Thu, Jun 5, 2014 at 8:22 AM, Valdis Kletnieks
valdis.kletni...@vt.edu wrote:
 Dell Latitude E6530, BIOS A11, seeing a crash in xhci_add_ep_to_interval
 when it's docked in a newer dock that has USB3.

 It's very possible that the BIOS is buggy - it isn't like I haven't found
 BIOS bugs in every single Dell laptop I've had. :)  But that shouldn't
 make the kernel crash

 lsusb reports:

 Bus 002 Device 004: ID 0a5c:5801 Broadcom Corp. BCM5880 Secure Applications 
 Processor with fingerprint swipe sensor
 Bus 002 Device 003: ID 413c:2513 Dell Computer Corp. internal USB Hub of 
 E-Port Replicator
 Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
 Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
 Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
 Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
 Bus 004 Device 002: ID 413c:5534 Dell Computer Corp.
 Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
 Bus 003 Device 003: ID 0e8f:0020 GreenAsia Inc. USB to PS/2 Adapter
 Bus 003 Device 002: ID 413c:2134 Dell Computer Corp.
 Bus 003 Device 004: ID 045e:0023 Microsoft Corp. Trackball Optical
 Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub


 Git bisect comes down to this:

 commit d8521afe35862f4fbe3ccd6ca37897c0a304edf3
 Author: Dan Williams dan.j.willi...@intel.com
 Date:   Tue May 20 18:08:28 2014 -0700

 usb: assign default peer ports for root hubs

 Assume that the peer of a superspeed port is the port with the same id
 on the shared_hcd root hub.  This identification scheme is required of
 external hubs by the USB3 spec [1].  However, for root hubs, tier mismatch
 may be in effect [2].  Tier mismatch can only be enumerated via platform
 firmware.  For now, simply perform the nominal association.

 Thanks to pstore, we have the explosion:

 [3.974159] usb 3-4.1: New USB device found, idVendor=0e8f, idProduct=0020
 [3.974173] usb 3-4.1: New USB device strings: Mfr=1, Product=2, 
 SerialNumber=0
 [3.974247] usb 3-4.1: Product: PS2toUSB Adapter
 [3.974259] usb 3-4.1: Manufacturer: GASIA
 [3.975475] BUG: unable to handle kernel NULL pointer dereference at 
 0080
 [3.975643] IP: [8139abd4] 
 xhci_add_ep_to_interval_table+0xc8/0x172
 [3.975795] PGD 0
 [3.975849] Oops: 0002 [#1] PREEMPT SMP
 [3.975954] Modules linked in:
 [3.976029] CPU: 0 PID: 37 Comm: khubd Not tainted 
 3.15.0-rc5-00299-g7e73be2 #234
 [3.976169] Hardware name: Dell Inc. Latitude E6530/07Y85M, BIOS A11 
 03/12/2013
 [3.976304] task: 880128e809d0 ti: 880128e84000 task.ti: 
 880128e84000
 [3.976441] RIP: 0010:[8139abd4]  [8139abd4] 
 xhci_add_ep_to_interval_table+0xc8/0x172
 [3.976631] RSP: 0018:880128e85608  EFLAGS: 00010006
 [3.976732] RAX: 0003 RBX:  RCX: 
 8800c5861800
 [3.976863] RDX: 0001 RSI: 0078 RDI: 
 0005
 [3.976997] RBP: 880128e85640 R08: 8801288f2228 R09: 
 
 [3.977125] R10: 880128e85968 R11: 0004 R12: 
 8801288f22fc
 [3.977255] R13: 8800c5861800 R14: 88003f878000 R15: 
 0007
 [3.977353] FS:  () GS:88012dc0() 
 knlGS:
 [3.977440] CS:  0010 DS:  ES:  CR0: 80050033
 [3.977503] CR2: 0080 CR3: c5eb4000 CR4: 
 001407f0
 [3.977578] Stack:
 [3.977606]  8801288f2228  8801288f2000 
 8801288f22fc
 [3.977708]  88003f878000 8800c5d8b000 0003 
 880128e85990
 [3.977808]  8139c76d 880128e85700 880128e85680 
 00010007
 [3.977910] Call Trace:
 [3.977948]  [8139c76d] xhci_reserve_bandwidth+0x158/0x534
 [3.978022]  [8107d810] ? mark_held_locks+0x5d/0x74
 [3.978086]  [8107d5da] ? mark_lock+0x2a/0x203
 [3.978148]  [8107e313] ? __lock_acquire+0x696/0xedf
 [3.978215]  [8112256b] ? dma_pool_alloc+0x188/0x225
 [3.978281]  [8107d5da] ? mark_lock+0x2a/0x203
 [3.980065]  [8107d5da] ? mark_lock+0x2a/0x203
 [3.981976]  [8107d810] ? mark_held_locks+0x5d/0x74
 [3.984302]  [8107d5da] ? mark_lock+0x2a/0x203
 [3.986919]  [8107e313] ? __lock_acquire+0x696/0xedf
 [3.989317]  [8139cb84] ? xhci_configure_endpoint+0x3b/0x4b0
 [3.991817]  [8107d5da] ? mark_lock+0x2a/0x203
 [3.994396]  [8107d810] ? mark_held_locks+0x5d/0x74
 [3.996896]  [8107eebf] ? lock_acquire+0xc1/0x14e
 [3.998795]  [8139cb84] ? xhci_configure_endpoint+0x3b/0x4b0
 [4.000407]  [813a84b0] ? xhci_dbg_trace+0x3f/0x47
 [4.002724]  [8139cc88] xhci_configure_endpoint+0x13f/0x4b0
 [4.005076]  

Re: linux-next crash in xhci_add_ep_to_interval

2014-06-05 Thread Dan Williams
On Thu, Jun 5, 2014 at 9:24 AM,  valdis.kletni...@vt.edu wrote:
 On Thu, 05 Jun 2014 08:55:07 -0700, Dan Williams said:

  On a working boot, it progresses:

 Is a working boot after reverting that change, or it intermittently
 works?  If it's the latter I'm not sure I trust the bisect result,
 yet.

 Oh, it's a 100% guaranteed crash.  The following is from a good kernel:

  [3.823139] usb 3-4.1: New USB device found, idVendor=0e8f, 
  idProduct=0020
  [3.823160] usb 3-4.1: New USB device strings: Mfr=1, Product=2, 
  SerialNumber=0
  [3.823174] usb 3-4.1: Product: PS2toUSB Adapter
  [3.823187] usb 3-4.1: Manufacturer: GASIA
  [3.842836] input: GASIA PS2toUSB Adapter as 
  /devices/pci:00/:00:14.0/usb3/3-4/3-4.1/3-4.1:1.0/0003:0E8F:0020.0001/input/input14
  [3.848598] hid-generic 0003:0E8F:0020.0001: input,hidraw0: USB HID 
  v1.10 Keyboard [GASIA PS2toUSB Adapter] on usb-:00:14.0-4.1/input0
  [3.863592] input: GASIA PS2toUSB Adapter as 
  /devices/pci:00/:00:14.0/usb3/3-4/3-4.1/3-4.1:1.1/0003:0E8F:0020.0002/input/input15
  [3.878608] hid-generic 0003:0E8F:0020.0002: input,hidraw1: USB HID 
  v1.10 Mouse [GASIA PS2toUSB Adapter] on usb-:00:14.0-4.1/input1

 I'm booted on next-20140519


 It's a really odd place to crash relative to the peer port changes
 since those do not affect any xhci internals.  At first glance this
 also does not look related to the command queue changes.  Mathias, any
 ideas?

 Valdis, can you get me the output of:

 $ gdb drivers/usb/host/xhci-hcd.ko
 (gdb) li *(xhci_add_ep_to_interval_table+0xc8)

 (gdb) li *(xhci_add_ep_to_interval_table+0xc8)
 0x10c9 is in xhci_add_ep_to_interval_table (drivers/usb/host/xhci.c:2446).
 2441normalized_interval = ep_bw-ep_interval - 3;
 2442
 2443if (normalized_interval == 0)
 2444bw_table-interval0_esit_payload += 
 ep_bw-max_esit_payload;
 2445interval_bw = bw_table-interval_bw[normalized_interval];
 2446interval_bw-num_packets += ep_bw-num_packets;
 2447switch (udev-speed) {
 2448case USB_SPEED_LOW:
 2449interval_bw-overhead[LS_OVERHEAD_TYPE] += 1;
 2450break;

 Note that's as of the end of the git bisect.  Looks like it picked up
 a duff value for interval_bw somehow, but I have no idea why.

 Yeah, you're right, the bisected commit doesn't seem to have anything
 to do with it.  Weird. ;)

Actually, on second look I bet xhci_alloc_tt_info() is being called
while hdev-maxchild is not set.  Let me throw together a debug
patch...
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: linux-next crash in xhci_add_ep_to_interval

2014-06-05 Thread Valdis . Kletnieks
On Thu, 05 Jun 2014 09:35:48 -0700, Dan Williams said:

 Actually, on second look I bet xhci_alloc_tt_info() is being called
 while hdev-maxchild is not set.  Let me throw together a debug
 patch...

Sure, no problem - just let me know what variant of linux-next you
want it applied against. :)


pgp9PIoAPZAjs.pgp
Description: PGP signature


Re: linux-next crash in xhci_add_ep_to_interval

2014-06-05 Thread Dan Williams
On Thu, 2014-06-05 at 13:29 -0400, valdis.kletni...@vt.edu wrote:
 On Thu, 05 Jun 2014 09:35:48 -0700, Dan Williams said:
 
  Actually, on second look I bet xhci_alloc_tt_info() is being called
  while hdev-maxchild is not set.  Let me throw together a debug
  patch...
 
 Sure, no problem - just let me know what variant of linux-next you
 want it applied against. :)

This should apply to -next.  Use git am -c, but I have attached it for
convenience as well.  Boots for me, but more importantly does it boot
for you :-).

8--
Subject: usb: fix -update_hub_device() vs hdev-maxchild

From: Dan Williams dan.j.willi...@intel.com

Commit d8521afe3586 usb: assign default peer ports for root hubs
delayed marking a hub valid (set hdev-maxchild) until it had been fully
configured and to enable the publishing of valid hubs to be serialized
by usb_port_peer_mutex.

However, xhci_update_hub_device() in some cases depends on
hdev-maxchild already being set.  Do the minimal fix and move it after
the setting of hdev-maxchild.

Cc: Mathias Nyman mathias.ny...@linux.intel.com
Reported-by: Valdis Kletnieks valdis.kletni...@vt.edu
Signed-off-by: Dan Williams dan.j.willi...@intel.com
---
 drivers/usb/core/hub.c |   24 
 1 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index db6287025c06..971d95745e2a 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -1526,18 +1526,6 @@ static int hub_configure(struct usb_hub *hub,
dev_dbg(hub_dev, %umA bus power budget for each child\n,
hub-mA_per_port);
 
-   /* Update the HCD's internal representation of this hub before khubd
-* starts getting port status changes for devices under the hub.
-*/
-   if (hcd-driver-update_hub_device) {
-   ret = hcd-driver-update_hub_device(hcd, hdev,
-   hub-tt, GFP_KERNEL);
-   if (ret  0) {
-   message = can't update HCD hub info;
-   goto fail;
-   }
-   }
-
ret = hub_hub_status(hub, hubstatus, hubchange);
if (ret  0) {
message = can't get hub status;
@@ -1593,6 +1581,18 @@ static int hub_configure(struct usb_hub *hub,
if (ret  0)
goto fail;
 
+   /* Update the HCD's internal representation of this hub before khubd
+* starts getting port status changes for devices under the hub.
+*/
+   if (hcd-driver-update_hub_device) {
+   ret = hcd-driver-update_hub_device(hcd, hdev,
+   hub-tt, GFP_KERNEL);
+   if (ret  0) {
+   message = can't update HCD hub info;
+   goto fail;
+   }
+   }
+
usb_hub_adjust_deviceremovable(hdev, hub-descriptor);
 
hub_activate(hub, HUB_INIT);

usb: fix -update_hub_device() vs hdev-maxchild

From: Dan Williams dan.j.willi...@intel.com

Commit d8521afe3586 usb: assign default peer ports for root hubs
delayed marking a hub valid (set hdev-maxchild) until it had been fully
configured and to enable the publishing of valid hubs to be serialized
by usb_port_peer_mutex.

However, xhci_update_hub_device() in some cases depends on
hdev-maxchild already being set.  Do the minimal fix and move it after
the setting of hdev-maxchild.

Cc: Mathias Nyman mathias.ny...@linux.intel.com
Reported-by: Valdis Kletnieks valdis.kletni...@vt.edu
Signed-off-by: Dan Williams dan.j.willi...@intel.com
---
 drivers/usb/core/hub.c |   24 
 1 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index db6287025c06..971d95745e2a 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -1526,18 +1526,6 @@ static int hub_configure(struct usb_hub *hub,
 		dev_dbg(hub_dev, %umA bus power budget for each child\n,
 hub-mA_per_port);
 
-	/* Update the HCD's internal representation of this hub before khubd
-	 * starts getting port status changes for devices under the hub.
-	 */
-	if (hcd-driver-update_hub_device) {
-		ret = hcd-driver-update_hub_device(hcd, hdev,
-hub-tt, GFP_KERNEL);
-		if (ret  0) {
-			message = can't update HCD hub info;
-			goto fail;
-		}
-	}
-
 	ret = hub_hub_status(hub, hubstatus, hubchange);
 	if (ret  0) {
 		message = can't get hub status;
@@ -1593,6 +1581,18 @@ static int hub_configure(struct usb_hub *hub,
 	if (ret  0)
 		goto fail;
 
+	/* Update the HCD's internal representation of this hub before khubd
+	 * starts getting port status changes for devices under the hub.
+	 */
+	if (hcd-driver-update_hub_device) {
+		ret = hcd-driver-update_hub_device(hcd, hdev,
+hub-tt, GFP_KERNEL);
+		if (ret  0) {
+			message = can't update HCD hub info;
+			goto fail;
+		}
+	}
+
 	usb_hub_adjust_deviceremovable(hdev, hub-descriptor);
 
 	hub_activate(hub, HUB_INIT);


Re: linux-next crash in xhci_add_ep_to_interval

2014-06-05 Thread Valdis . Kletnieks
On Thu, 05 Jun 2014 12:05:56 -0700, Dan Williams said:

 Subject: usb: fix -update_hub_device() vs hdev-maxchild

 From: Dan Williams dan.j.willi...@intel.com

 Commit d8521afe3586 usb: assign default peer ports for root hubs
 delayed marking a hub valid (set hdev-maxchild) until it had been fully
 configured and to enable the publishing of valid hubs to be serialized
 by usb_port_peer_mutex.

 However, xhci_update_hub_device() in some cases depends on
 hdev-maxchild already being set.  Do the minimal fix and move it after
 the setting of hdev-maxchild.

 Cc: Mathias Nyman mathias.ny...@linux.intel.com
 Reported-by: Valdis Kletnieks valdis.kletni...@vt.edu
 Signed-off-by: Dan Williams dan.j.willi...@intel.com

Applied cleanly, booted without complaint, the keyboard that's behind
the PS2-USB converter works.

uname -r reports 3.15.0-rc8-next-20140605-dirty as expected.

So feel free to stick a Tested-By: on there. :)


pgpHluJIkfaj6.pgp
Description: PGP signature


Re: linux-next crash in xhci_add_ep_to_interval

2014-06-05 Thread Dan Williams
On Thu, Jun 5, 2014 at 2:10 PM,  valdis.kletni...@vt.edu wrote:
 On Thu, 05 Jun 2014 12:05:56 -0700, Dan Williams said:

 Subject: usb: fix -update_hub_device() vs hdev-maxchild

 From: Dan Williams dan.j.willi...@intel.com

 Commit d8521afe3586 usb: assign default peer ports for root hubs
 delayed marking a hub valid (set hdev-maxchild) until it had been fully
 configured and to enable the publishing of valid hubs to be serialized
 by usb_port_peer_mutex.

 However, xhci_update_hub_device() in some cases depends on
 hdev-maxchild already being set.  Do the minimal fix and move it after
 the setting of hdev-maxchild.

 Cc: Mathias Nyman mathias.ny...@linux.intel.com
 Reported-by: Valdis Kletnieks valdis.kletni...@vt.edu
 Signed-off-by: Dan Williams dan.j.willi...@intel.com

 Applied cleanly, booted without complaint, the keyboard that's behind
 the PS2-USB converter works.

 uname -r reports 3.15.0-rc8-next-20140605-dirty as expected.

 So feel free to stick a Tested-By: on there. :)

Thank you, much appreciated!
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html