Received: by 2002:a05:7412:bc1a:b0:d7:7d3a:4fe2 with SMTP id ki26csp31202rdb; Fri, 18 Aug 2023 13:13:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFyq5AUZ6KYVzYWoRvEbL9Hfei2oiuMbQwYsqVPsjQsn1/5moJyX0BZu091LZ7utW1cFp2K X-Received: by 2002:aa7:d5d2:0:b0:523:c36e:ec8b with SMTP id d18-20020aa7d5d2000000b00523c36eec8bmr252443eds.9.1692389623246; Fri, 18 Aug 2023 13:13:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692389623; cv=none; d=google.com; s=arc-20160816; b=rphnZ7cMtg4uMqZ5gOjVZ6FdHEzf7oEsWM3Yl9W4/84KRYTDU/0osQnBlZFVUgxnWx QwU54XncTo/cUWJzMz/Xp+VQ7ArQkaT4LQvXpcnia1Hv8gM4K5RoTysu2GkLTOOEzdHO ABhlmQZuawgV6ex5/tclLzrS8R4ZqeX+c2FpIs8CC/r/YF+QQVpqk0Qs8jubGlE/BzvX P9AcrXMQf/5yWyOevhLCTKAIfE0wNdLy3RWIyZQcR0Z8VkEuc33lqATf95Vz/kGPQgTl x6XTM+Qq7nLdQF+z2vgBHrcox7jpc0/EXzUhFQO9StAq4ceVN4BMuKiZChm4BKOx9QrP 51JA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=1CnittJt7oZBtXqbHH5jG5sJu5pHOjg5QjLzA8rVzJ8=; fh=reEYjyP1Mm+PIwHKg06jJJPkJcyvRW+EUfFQCyJnnJw=; b=Nba5CPlLnabXq87JYwp6DDMnJw1ZBGCItOt7hQmjVG2T2AL0+eyo3O7r5lmIhsc3P7 krXAr/XwDTEvGd3NSSzpaudqfG8EaHnVCKE4zhLGwsbeZe3AB3C7pRJ0LOOzke8TNvSB qeAbhA42O8UgfFq9K982Q3guXLLvmzhunpBVwPkjIsNlA1pwk4snv0KJGJ5t76TLVhCE epEdMAzLEMdXu7JSXTJRn2BckZeYibc04W8fr/BwDCRyQsDXQIo2TNcFgmhQyL8npWUM HCoZmESLlhbOyVHcRL1l2vI7J1mTr0ZfMKu8XDY06YhT8xSKypM6Q6JN0yGkypd0wd6/ uvQQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=harvard.edu Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s13-20020aa7c54d000000b005233ded4188si1951275edr.432.2023.08.18.13.13.11; Fri, 18 Aug 2023 13:13:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=harvard.edu Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343839AbjHRDJV (ORCPT + 99 others); Thu, 17 Aug 2023 23:09:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357461AbjHRDI4 (ORCPT ); Thu, 17 Aug 2023 23:08:56 -0400 Received: from netrider.rowland.org (netrider.rowland.org [192.131.102.5]) by lindbergh.monkeyblade.net (Postfix) with SMTP id 267AB3A96 for ; Thu, 17 Aug 2023 20:08:54 -0700 (PDT) Received: (qmail 17988 invoked by uid 1000); 17 Aug 2023 23:08:53 -0400 Date: Thu, 17 Aug 2023 23:08:53 -0400 From: Alan Stern To: Kai-Heng Feng Cc: mathias.nyman@intel.com, Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] xhci: Disable connect, disconnect and over-current wakeup on system suspend Message-ID: References: <20230817093305.212821-1-kai.heng.feng@canonical.com> <59898e32-f2ea-4df7-947b-3d74835ff9b7@rowland.harvard.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 18, 2023 at 08:01:54AM +0800, Kai-Heng Feng wrote: > On Thu, Aug 17, 2023 at 10:22 PM Alan Stern wrote: > > > > On Thu, Aug 17, 2023 at 10:07:37AM -0400, Alan Stern wrote: > > > On Thu, Aug 17, 2023 at 05:33:05PM +0800, Kai-Heng Feng wrote: > > > > HP ProOne 440 G10 AIO sometimes cannot suspend as xHCI wakes up the > > > > system: > > > > [ 445.814574] hub 2-0:1.0: hub_suspend > > > > [ 445.814652] usb usb2: bus suspend, wakeup 0 > > > > [ 445.824629] xhci_hcd 0000:00:14.0: Port change event, 1-11, id 11, portsc: 0x202a0 > > > > > > What is the meaning of the 0x202a0 bits? What caused this wakeup? > > > > And more to the point, given that the previous line says "wakeup 0", why > > should any port change event cause a wakeup? > > I think the controller and roothub have to deal with the interrupt > about disconnecting regardless of the remote wakeup setting. This seems to contradict what you wrote in an earlier email: > > If remote wakeup isn't enabled then the do_wakeup variable will be 0, > > so your patch wouldn't make any difference. The question is what > > happens when remote wakeup _is_ enabled. > > Nothing happens either per my testing. > > For USB keyboard, the remote wakeup is enabled, unplugging it when > suspend is suspended doesn't wake the system up, despite of PORT_WKDISC_E being set. > Plugging it back doesn't wake the system up either, despite of PORT_WKCONN_E. You appear to be saying that when wakeup is disabled, unplugging a device will wake up the system -- but when wakeup is enabled, unplugging a device will not wake up the system! Is that really what you meant? It doesn't make sense. Probably means there's a bug in the HCD. The point I'm trying to get at is that if wakeups are disabled for both the host controller and the root hub then _nothing_ should generate an interrupt or wakeup request. Not pressing a key, not unplugging a device... nothing. But if wakeup _is_ enabled for both the controller and the root hub, then any of those actions should generate an interrupt and wake up the system. If wakeup is enabled for the host controller but not for the root hub, then unplugging a device from the root hub should not generate a wakeup request or an interrupt. But things like pressing a key on a wakeup-enabled keyboard should. (In other words, the root hub shouldn't generate any wakeup requests on its own but it should relay wakeup requests that it receives from downstream devices.) However, it's understandable if the system doesn't behave properly in this case since it's kind of an odd situation. Alan Stern