From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CD220C433B4 for ; Thu, 6 May 2021 15:59:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9037A61177 for ; Thu, 6 May 2021 15:59:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235358AbhEFQAl (ORCPT ); Thu, 6 May 2021 12:00:41 -0400 Received: from netrider.rowland.org ([192.131.102.5]:46715 "HELO netrider.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S235231AbhEFQAi (ORCPT ); Thu, 6 May 2021 12:00:38 -0400 Received: (qmail 741677 invoked by uid 1000); 6 May 2021 11:59:39 -0400 Date: Thu, 6 May 2021 11:59:39 -0400 From: Alan Stern To: Bjorn Helgaas Cc: Greg Kroah-Hartman , Paul Menzel , linux-usb@vger.kernel.org, LKML , Mathias Nyman , linux-pci@vger.kernel.org Subject: Re: `quirk_usb_handoff_xhci` takes 60 ms with ASM1042 Message-ID: <20210506155939.GA738638@rowland.harvard.edu> References: <20210506152300.GA1405893@bjorn-Precision-5520> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210506152300.GA1405893@bjorn-Precision-5520> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org On Thu, May 06, 2021 at 10:23:00AM -0500, Bjorn Helgaas wrote: > On Wed, May 05, 2021 at 05:53:18PM +0200, Greg Kroah-Hartman wrote: > > I think, if we don't do the handoff, then the BIOS/firmware tries to > > send the OS fake keyboard/mouse commands, and Linux isn't ready for that > > as we didn't allow hotplug PS/2 stuff. But I could be wrong, it's been > > a long time since we did that logic. > > I have no idea what "BIOS/firmware sending OS fake keyboard/mouse > commands" means. From the OS point of view, does that look like USB > events that cause PCI interrupts? PS/2 interrupts? Are these > commands caused by the user typing or moving the mouse? Or does BIOS > fabricate commands for other reasons? Think of an old MSDOS operating system without USB support. The BIOS tries to be helpful by translating mouse and keyboard input it receives over USB into PS/2 events that the operating system can handle. Originally this was done using SMI; now it presumably is still a legacy part of UEFI. > The way you describe it, this *sounds* like a race, where Linux > mishandles commands that happen before the handoff quirk. Do you > remember what happens if BIOS sends a fake command before Linux is > ready for it? Unexpected interrupt? I would be surprised if anybody still knows. :-) Perhaps a reasonable experiment would be to boot a kernel with PS/2 support but not USB support (or at least, without CONFIG_USB_PCI) and see what happens when you type on the USB keyboard or move the USB mouse. It might very well turn out that the handoff operation can safely be delayed until driver probe time. Alan Stern