From owner-freebsd-usb@FreeBSD.ORG Sun Oct 28 14:07:59 2012 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 01462FC8 for ; Sun, 28 Oct 2012 14:07:59 +0000 (UTC) (envelope-from yoitsmeremember@gmail.com) Received: from mail-ia0-f182.google.com (mail-ia0-f182.google.com [209.85.210.182]) by mx1.freebsd.org (Postfix) with ESMTP id B5E638FC0C for ; Sun, 28 Oct 2012 14:07:58 +0000 (UTC) Received: by mail-ia0-f182.google.com with SMTP id k10so4316468iag.13 for ; Sun, 28 Oct 2012 07:07:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=TdMUWUMwMGp6FrG4R4xsS3rRJfqEOgzjXFqzBHsB9i0=; b=FoyZf9qg+oDug3P7KDyVSo6i7LpKFd4iwCaTdbOx+7KUmSPHgPsZQpUupHthVGt9Bc FGKWbmg5Wy1xQnCsMNx+llSvk6TGIQcnoPcqI1eeWsP6BeUEWSrz2PjvnMCf14D4zD4o tNqJEtMMGLgWkprh4GO5FAAnS1SEJJWCpv6gozlfNj4oZ99bc1udjHEWM/Y88EzaL+1o hK2zK8zPhv7wwk/GtcElfsCVDY4r5EgrG+tujlpCEqY9iT7xOO4uijIV2lPO6Lazh1F+ nLBYg80I5cYiheaR1kiaKJmyLfjP14lPtF6aa+RPC13dXSC+DHM40tX9Dx11L1BzpQtf H/0A== Received: by 10.50.33.232 with SMTP id u8mr6956743igi.39.1351433278138; Sun, 28 Oct 2012 07:07:58 -0700 (PDT) Received: from [192.168.0.124] (68-114-220-143.dhcp.mdsn.wi.charter.com. [68.114.220.143]) by mx.google.com with ESMTPS id gz10sm3746136igc.9.2012.10.28.07.07.56 (version=SSLv3 cipher=OTHER); Sun, 28 Oct 2012 07:07:57 -0700 (PDT) Message-ID: <508D3C3B.2000506@gmail.com> Date: Sun, 28 Oct 2012 09:07:55 -0500 From: Ian User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20121010 Thunderbird/16.0.1 MIME-Version: 1.0 To: freebsd-usb@freebsd.org Subject: Hardware failure or bug in ehci? Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Oct 2012 14:07:59 -0000 I recently plugged in a new KVM (Monoprice KCF-181S) to my FreeBSD machines (the machine in question a Jetway NF9A-Q67), and found a high interrupt rate when using top. The usb and KVM appear like so in dmesg: ehci0: mem 0xfe523000-0xfe5233ff irq 16 at device 26.0 on pci0 usbus0: EHCI version 1.0 usbus0 on ehci0 ... ehci1: mem 0xfe522000-0xfe5223ff irq 23 at device 29.0 on pci0 usbus1: EHCI version 1.0 usbus1 on ehci1 ... usbus0: 480Mbps High Speed USB v2.0 usbus1: 480Mbps High Speed USB v2.0 ugen0.1: at usbus0 uhub0: on usbus0 ugen1.1: at usbus1 uhub1: on usbus1 ... ugen0.2: at usbus0 uhub2: on usbus0 ugen1.2: at usbus1 uhub3: on usbus1 ... uhub2: 6 ports with 6 removable, self powered uhub3: 8 ports with 8 removable, self powered ... ugen0.3: at usbus0 ukbd0: on usbus0 kbd2 at ukbd0 ums0: on usbus0 ums0: 5 buttons and [XYZ] coordinates ID=1 Investigating further, I found this: % uname -a FreeBSD pyrite 9.1-RC2 FreeBSD 9.1-RC2 #0 r241608: Tue Oct 16 18:18:23 UTC 2012 root@pyrite:/usr/obj/usr/src/sys/PYRITE amd64 % vmstat -i interrupt total rate irq1: atkbd0 29 0 irq4: uart0 395 0 irq16: ehci0 14852890008 61807 irq23: ehci1 626348 2 cpu0:timer 267891392 1114 irq264: em0 66802 0 irq265: em1:rx 0 844347 3 irq266: em1:tx 0 292193 1 irq267: em1:link 9 0 irq268: ahci0 221681 0 cpu1:timer 221101117 920 cpu3:timer 1504868 6 cpu2:timer 1336765 5 Total 15346775954 63862 # usbconfig ugen0.1: at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE ugen1.1: at usbus1, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE ugen0.2: at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE ugen1.2: at usbus1, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE ugen0.3: at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON Nearly 62K interrupts/second on ehci0! After much testing, I've found that this is an intermittent problem. I'll summarize: - Even in identical hardware configurations (i.e. everything plugged into the same port), sometimes I see the high interrupt rate, and sometimes I don't. - Once I see the high interrupt rate, there is no way to make it stop without rebooting. Even if I unplug the KVM, I will continue to see the interrupt rate climb until I reboot. - The easiest way to reproduce the issue is to unplug everything KVM related (the VGA, the PS/2 keyboard port, and the USB), and plug it all back in (VGA first, followed by PS/2 keyboard, followed by USB--though I'm unsure if order matters). Often, though not always, unplugging and replugging the USB alone is not enough to cause the high interrupt rate. - Perhaps the strangest of all, the high interrupt rate always appears on ehci0 even if I only plugged the KVM into a usbus1 (and therefore ehci1) port! - I can't reproduce the issue on any other machines the KVM is plugged into (all also running FreeBSD 9.1-RC2/amd64), but they all feature uhci in addition to ehci, and use a different ehci controller. However, on the problematic machine, it appears to be able to happen regardless of the port/cable of the KVM I use (despite those ports working fine with my other machines). So, my questions are: 1. Most importantly, where do you think the problem lies? The KVM itself, the FreeBSD machine's hardware, or a bug in the kernel/driver? 2. Why would it appear as a high interrupt rate on ehci0 when it's only plugged into usbus1 which is on ehci1? 3. Why doesn't the issue appear on any of the other machines I have plugged into the KVM? Simply because they use different controllers, or does the presence of uhci (which shares an interrupt with ehci0 on those machines) potentially have something to do with it? I know the last question may be unanswerable, as there are so many variables in play.