NetBSD Problem Report #50219

From prlw1@cam.ac.uk  Mon Sep  7 17:10:39 2015
Return-Path: <prlw1@cam.ac.uk>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id E24ACA6554
	for <gnats-bugs@gnats.NetBSD.org>; Mon,  7 Sep 2015 17:10:39 +0000 (UTC)
Message-Id: <20150907171029.GA12892@quark.internal.precedence.co.uk>
Date: Mon, 7 Sep 2015 18:10:29 +0100
From: Patrick Welche <prlw1@cam.ac.uk>
Reply-To: prlw1@cam.ac.uk
To: gnats-bugs@NetBSD.org
Cc: prlw1@cam.ac.uk
Subject: USB keyboard not detected on server

>Number:         50219
>Category:       kern
>Synopsis:       USB keyboard not detected on server
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Sep 07 17:15:00 +0000 2015
>Last-Modified:  Thu Sep 10 09:50:01 +0000 2015
>Originator:     Patrick Welche
>Release:        NetBSD 7.99.21
>Organization:
>Environment:
NetBSD-7.99.21/amd64 of 6 Sep 2015
>Description:
A standard USB Keyboard which is detected as

uhidev0 at uhub2 port 3 configuration 1 interface 0
uhidev0: NOVATEK USB Keyboard, rev 1.10/1.12, addr 6, iclass 3/1
ukbd0 at uhidev0
wskbd1 at ukbd0 mux 1
wskbd1: connecting to wsdisplay0
uhidev1 at uhub2 port 3 configuration 1 interface 1
uhidev1: NOVATEK USB Keyboard, rev 1.10/1.12, addr 6, iclass 3/0
uhidev1: 4 report ids
uhid0 at uhidev1 reportid 2: input=1, output=0, feature=0
uhid1 at uhidev1 reportid 3: input=3, output=0, feature=0
uhid2 at uhidev1 reportid 4: input=2, output=0, feature=0

on a -current/amd64 laptop is not detected on a System X 3650 M5 server.

With a standard GENERIC kernel:

pckbc0 at isa0 port 0x60-0x64
pckbdprobe: reset error 5
pckbd0 at pckbc0 (kbd slot)
pckbc0: using irq 1 for kbd slot
wskbd0 at pckbd0: console keyboard, using wsdisplay0

Then, try a kernel built with DEBUGGING and

no pckbc
no pckbd
no wskbd* at pckbd?

in order to give wskbd* at ukbd? console ? mux 1 a chance, but no ukbd
appears.

The server's USB controllers are:
  Intel C61x/X99 USB xHCI (USB serial bus, xHCI, revision 0x05)
  Intel C61x/X99 USB EHCI (rev. 0x05)

Looking for "HCI" in the acpi tables, I see:

acpi0: [XHCI] HID -          UID -    STA 0xFFFFFFFF ADR 0x0000000000140000

Trying a kernel with xhci panics when xhci attaches. (old 29th June
backtrace, but panics with yesterday's source too):

breakpoint()
vpanic()
snprintf()
extent_alloc_region()
bus_space_reserve()
bus_space_map()
pci_mapreg_submap()
pci_mapreg_map()
xhci_pci_attach()+0xf8
config_attach_loc()
pci_probe_device()
pci_enumerate_bus()
pcirescan()
pciattach()
config_attach_loc()
mp_pci_scan()
mainbus_attach()
config_attach_loc()
cpu_configure()
main()

Just in case it is an issue with Intel ACPICA 20150717
try boot netbsd -2vx:

cpu0 at mainbus0 apid 0
cpu0: 8 page colors
cpu0: calibrating local timer
cpu0: apic clock running at 100 MHz
timecounter: Timecounter "lapic" frequency 100043537 Hz quality -100
cpu0: Intel(R) Xeon(R) CPU E5-2670 v3 @ 2.30GHz, id 0x306f2
cpu0: PAT enabled
cpu1 at mainbus0 apid 0
cpu1: 2 page colors

 System initializing 
 System initializing memory 

... so we need acpi for multiprocessor support.

try boot netbsd -12vx:

freeze shortly after
cpu0: unknown i686 model 3f, can't get bus clock (0x0)

=> we need ACPI. 

>How-To-Repeat:
Boot a GENERIC kernel on a new server which has no PS/2 ports and try to
get keyboard input.
>Fix:

>Audit-Trail:
From: Nick Hudson <skrll@netbsd.org>
To: gnats-bugs@NetBSD.org, kern-bug-people@netbsd.org, 
 gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Cc: 
Subject: Re: kern/50219: USB keyboard not detected on server
Date: Tue, 08 Sep 2015 11:22:15 +0100

 On 09/07/15 18:15, Patrick Welche wrote:
 [snip]
 > Then, try a kernel built with DEBUGGING and
 >
 > no pckbc
 > no pckbd
 > no wskbd* at pckbd?
 >
 > in order to give wskbd* at ukbd? console ? mux 1 a chance, but no ukbd
 > appears.

 good move.

 > The server's USB controllers are:
 >    Intel C61x/X99 USB xHCI (USB serial bus, xHCI, revision 0x05)
 >    Intel C61x/X99 USB EHCI (rev. 0x05)
 >
 > Looking for "HCI" in the acpi tables, I see:
 >
 > acpi0: [XHCI] HID -          UID -    STA 0xFFFFFFFF ADR 0x0000000000140000
 >
 > Trying a kernel with xhci panics when xhci attaches. (old 29th June
 > backtrace, but panics with yesterday's source too):

 > breakpoint()
 > vpanic()
 > snprintf()
 > extent_alloc_region()
 > bus_space_reserve()
 > bus_space_map()
 > pci_mapreg_submap()
 > pci_mapreg_map()
 > xhci_pci_attach()+0xf8
 > config_attach_loc()
 > pci_probe_device()
 > pci_enumerate_bus()
 > pcirescan()
 > pciattach()
 > config_attach_loc()
 > mp_pci_scan()
 > mainbus_attach()
 > config_attach_loc()
 > cpu_configure()
 > main()


 You didn't post the panic message, but I think you said previously it was

 extent_alloc_region: extent `iomem' (0x0 - 0xffffffff)
 extent_alloc_region: start 0x3bffffe0000, end 0x3bffffeffff
 panic: extent_alloc_region: region lies outside extent

 Can you confirm?

 Nick

From: Nick Hudson <skrll@netbsd.org>
To: gnats-bugs@NetBSD.org, kern-bug-people@netbsd.org, 
 gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Cc: 
Subject: Re: kern/50219: USB keyboard not detected on server
Date: Wed, 09 Sep 2015 16:34:14 +0100

 This is a multi-part message in MIME format.
 --------------030803000706030807080904
 Content-Type: text/plain; charset=windows-1252; format=flowed
 Content-Transfer-Encoding: 7bit

 For the record extending the PCI MEM extent to cover 48bit physical 
 address space helps



 --------------030803000706030807080904
 Content-Type: text/x-patch;
  name="pr50219.diff"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: attachment;
  filename="pr50219.diff"

 Index: sys/arch/x86/x86/bus_space.c
 ===================================================================
 RCS file: /cvsroot/src/sys/arch/x86/x86/bus_space.c,v
 retrieving revision 1.38
 diff -u -p -r1.38 bus_space.c
 --- sys/arch/x86/x86/bus_space.c	27 Jan 2012 18:53:07 -0000	1.38
 +++ sys/arch/x86/x86/bus_space.c	9 Sep 2015 15:31:02 -0000
 @@ -129,7 +129,7 @@ x86_bus_space_init(void)
  	ioport_ex = extent_create("ioport", 0x0, 0xffff,
  	    (void *)ioport_ex_storage, sizeof(ioport_ex_storage),
  	    EX_NOCOALESCE|EX_NOWAIT);
 -	iomem_ex = extent_create("iomem", 0x0, 0xffffffff,
 +	iomem_ex = extent_create("iomem", 0x0, 0xffffffffffff,
  	    (void *)iomem_ex_storage, sizeof(iomem_ex_storage),
  	    EX_NOCOALESCE|EX_NOWAIT);


 --------------030803000706030807080904--

From: Patrick Welche <prlw1@cam.ac.uk>
To: Nick Hudson <skrll@netbsd.org>
Cc: gnats-bugs@NetBSD.org, kern-bug-people@netbsd.org,
	gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Subject: Re: kern/50219: USB keyboard not detected on server
Date: Thu, 10 Sep 2015 10:44:50 +0100

 In brief: your patch cures the panic (though still no devices)

 Back to previous:

 The kernel I mentioned did panic with the same trace:

 xhci0 at pci0 dev 20 function 0: Intel C61x/X99 USB xHCI (rev. 0x05)
 csr: 02900146
 extent_alloc_region: extent `iomem' (0x0 - 0xffffffff)
 extent_alloc_region: start 0x38000010000, end 0x3800001ffff
 panic: extent_alloc_region: region lies outside extent
 fatal breakpoint trap in supervisor mode
 trap type 1 code 0 rip ffffffff80a7a315 cs 8 rflags 246 cr2 0 ilevel 8 rsp ffffffff818638a8
 curlwp 0xffffffff81152f00 pid 0.1 lowest kstack 0xffffffff818602c0
 Stopped in pid 0.1 (system) at  netbsd:breakpoint+0x5:  leave
 breakpoint() at netbsd:breakpoint+0x5
 vpanic() at netbsd:vpanic+0x13c
 snprintf() at netbsd:snprintf
 extent_alloc_region() at netbsd:extent_alloc_region+0x217
 bus_space_reserve() at netbsd:bus_space_reserve+0x5c
 bus_space_map() at netbsd:bus_space_map+0x3d
 pci_mapreg_submap() at netbsd:pci_mapreg_submap+0xba
 pci_mapreg_map() at netbsd:pci_mapreg_map+0x2e
 xhci_pci_attach() at netbsd:xhci_pci_attach+0xf8
 config_attach_loc() at netbsd:config_attach_loc+0x17a
 pci_probe_device() at netbsd:pci_probe_device+0x4fa
 pci_enumerate_bus() at netbsd:pci_enumerate_bus+0x168
 pcirescan() at netbsd:pcirescan+0x43
 pciattach() at netbsd:pciattach+0x193
 config_attach_loc() at netbsd:config_attach_loc+0x17a
 mp_pci_scan() at netbsd:mp_pci_scan+0xa4
 mainbus_attach() at netbsd:mainbus_attach+0x2fa
 config_attach_loc() at netbsd:config_attach_loc+0x17a
 cpu_configure() at netbsd:cpu_configure+0x26
 main() at netbsd:main+0x299

 Just for the record:

 $ strings netbsd | grep _CFG_ | grep xhci
 _CFG_xhci* at pci? dev ? function ?\011# eXtensible Host Controller
 _CFG_\011\011\011\011# xhci is at best experimental
 _CFG_usb*  at xhci?
 _CFG_###> # xhci*\011at pci?\011dev ? function ?\011# eXtensible Host Controller
 _CFG_###> \011\011\011\011\011# xhci is at best experimental
 _CFG_###> # usb*\011at xhci?

 so there is a usb* at xhci? line.

 With your patch, no more panic!

 xhci0 at pci0 dev 20 function 0: Intel C61x/X99 USB xHCI (rev. 0x05)
 csr: 02900146
 xhci0: interrupting at ioapic0 pin 22
 xhci0: xHCI version 1.0
 usb0 at xhci0: USB revision 2.0
 uhub0 at usb0: NetBSD xHCI Root Hub, class 9/0, rev 2.00/1.00, addr 0
 uhub0: 15 ports with 15 removable, self powered
 uhub3 at uhub0 port 1: no manufacturer Gadget USB HUB, class 9/0, rev 2.00/0.00, addr 1
 uhub3: 6 ports with 6 removable, self powered
 uhub3: port 5, device not enabled
 uhub3: device problem, disabling port 5

 uhub7 at uhub0 port 11: Cypress Semiconductor USB2.0 Hub, class 9/0, rev 2.00/32.99, addr 4
 uhub7: single transaction translator
 uhub7: 4 ports with 4 removable, self powered

 usbdev suggests:

   port 5 addr 0 should never happen!

 no sign of "NOVATEK" as per non-xhci laptop dmesg quoted in original report...

 Trying other USB ports, so unplug plug unplug plug:

 uhub7: device problem, disabling port 2
 uhub7: device problem, disabling port 1

 Trying a USB stick:
 uhub6: device problem, disabling port 1

 => actually not keyboard specific
  port 1 addr 0 should never happen!
  port 1 addr 0 should never happen!

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.