From owner-freebsd-usb@FreeBSD.ORG Thu May 8 11:45:17 2014 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A3CE62F3 for ; Thu, 8 May 2014 11:45:17 +0000 (UTC) Received: from mail-oa0-x22f.google.com (mail-oa0-x22f.google.com [IPv6:2607:f8b0:4003:c02::22f]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6A0CD25C for ; Thu, 8 May 2014 11:45:17 +0000 (UTC) Received: by mail-oa0-f47.google.com with SMTP id i7so2891826oag.34 for ; Thu, 08 May 2014 04:45:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bluelife.at; s=google; h=mime-version:sender:date:message-id:subject:from:to:content-type; bh=TrdFuz3EqSkPVwaJsbumh886aHYHZ0a0M706BofDQrU=; b=OXzWLW00mj/hVpDYU9ArWxut1/52pkixU/D9soE51IO/8EbIvtfN+v4Z5C89K1Lr4o xP+xGDEhlt7wKK7SJTFz2AGka5VqSEpt2V3HfWe9B8wMZBb20hTe8+0LyqSVhWsZIOeO E3C7X5MAnCBBfOBjM30ODup0/efj7EgtbnWEY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:date:message-id:subject:from :to:content-type; bh=TrdFuz3EqSkPVwaJsbumh886aHYHZ0a0M706BofDQrU=; b=k9Y2+/3ho7ZvqllqpisQVHEmvMWpYD1EJdl0XxoyIByXarwKiBGMzXjs0collGS/De BjDuGxzqej/I/S0saT7/n5oSxTG5UvkUaJl+2OK+rTLyNPdl9imuZZ+WMC7NvbzWCIgA tipT86Kh8dEI+RmDe+8jAKxWwJMFYSOyJXgJJrCNKDoy7wxzZSM3GOjbQvgzc5ck8zCW gKA8lcEja8tL+Td0mqZg7iNJbXONLfeVEfMKxvBT6/XKQOs8G1SeTI0R6Oz/7hCwSh7E bQA+PHSGgN3IjSjKf33OWauhZJgWX+/mulL/pIohPh7U4EjrKF9R18PRRcC03XXPBWPH gqQQ== X-Gm-Message-State: ALoCoQmm3D0WvHUJu2JFW1Flnl3du8fGGJx5rBGJc8VrUNzW3QIfre24QNFHL52gdOlUGtfKBTC+ MIME-Version: 1.0 X-Received: by 10.60.176.9 with SMTP id ce9mr3523141oec.55.1399549516573; Thu, 08 May 2014 04:45:16 -0700 (PDT) Sender: decke@bluelife.at Received: by 10.76.154.136 with HTTP; Thu, 8 May 2014 04:45:16 -0700 (PDT) X-Originating-IP: [2001:470:1f15:673::1000] Date: Thu, 8 May 2014 13:45:16 +0200 X-Google-Sender-Auth: ik89wlUCYwGdInUPU9WkUh6C8P0 Message-ID: Subject: xHCI driver in FreeBSD 10.0 causing interrupt storm in VirtualBox From: =?UTF-8?Q?Bernhard_Fr=C3=B6hlich?= To: "freebsd-usb@FreeBSD.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 May 2014 11:45:17 -0000 Hi guys, I just got a bugreport from a virtualbox developer who has noticed a problem with the xHCI driver in FreeBSD 10.0. The irc transcript follows to not loose any information from the analysis and how this could be addressed. (01:22:20 PM) MichalN: decke: I ran into a funny problem with the xHCI driver in FreeBSD 10.0. It only works if the host uses MSIs, but doesn't make sure. No such problem in 9.2. (01:23:28 PM) MichalN: It probably doesn't come up on physical hardware, or at least it'd require something fairly unusual (an old system with add-on xHCI adapter). michael-vb MichalN (01:23:39 PM) MichalN: But it's a problem in a virtualized environment :) (01:24:13 PM) MichalN: The default VirtualBox config doesn't do MSIs. (01:25:10 PM) klaus-vb: it emulates an old system ;) (01:25:26 PM) MichalN: The driver should either work (just like the 9.2 one does), or at least fail to load if it can't enable MSIs. As it is, it gets an interrupt storm. (01:25:38 PM) MichalN: (which FreeBSD duly detects and reports) (01:26:39 PM) MichalN: Actually if I can find it, I can point you at the code that was removed... (01:27:07 PM) klaus-vb: the standard vbox chipset can't do MSI. only the experimental ICH9 chipset code does MSI, and we generally don't test it much (01:27:52 PM) MichalN: Because there's not a huge advantage to MSIs in a virtualized environment, unlike physical systems. (01:29:47 PM) MichalN: OK, here's some older version of the code: http://www.leidinger.net/FreeBSD/dox/dev_usb/html/d0/d15/xhci_8c_source.html In function xhci_interrupt() the code writing the XHCI_IMAN_INTR_PEND bit was removed in 10.0. (01:30:51 PM) MichalN: For your background - the xHCI controller behaves slightly differently depending on whether MSIs are used or not. If not, that bit (called XHCI_IMAN_INTR_PEND in the FreeBSD driver) must be written to clear an interrupt. (01:31:22 PM) MichalN: If MSIs are used then it doesn't need to be done. It seems someone removed the code which was unconditional and unnecessary on systems with MSI. (01:31:31 PM) MichalN: But that breaks on systems with no MSI. (01:33:07 PM) MichalN: Basically it should still be done, but only conditionally if MSIs aren't used. Otherwise if the driver loads on a system which for whatever reason doesn't use MSIs for xHCI, it'll cause an interrupt storm. -- Bernhard Froehlich http://www.bluelife.at/