Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp797986ybm; Wed, 22 May 2019 11:41:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqyMhfwDymUnGSiD6hY69CRv97Bwzpd0Zz5u6DkgYXiKYlmcwo6o+11MnX86FhiH9QKZVxyO X-Received: by 2002:a63:c750:: with SMTP id v16mr90832305pgg.409.1558550483161; Wed, 22 May 2019 11:41:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558550483; cv=none; d=google.com; s=arc-20160816; b=wur6B9qeSfZnC3HtabAX6iPJxm23NPb4X+WH4EUX+bq01SrlNXyfp8uATlPFwqgaFu z6Jl0ogmVCQxjmInWhrSX927h05H67gCwgcN6LSnMyeTeE5Z2YMQYlTixHwfkn7jPcbq AV5BC1TV27viLwxf3rUpjbf9+EEfZyIVkRF3pkmxFF70dGAY+obCNosMfRzfkWklPEZz OhXKKrSHCtqGxDO5W+NUsJC9JV5qzuY53MXJLqetviE5fpiYmoo9igdxIMz7GgzgH4kn u0/vkL2Q1N5Gk/HwquhuN4IttLX6m/m1nXzIYhO632hJN8tlsje+MKs16Xo5tHV+v6+W Gl9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:in-reply-to:subject:cc:to:from:date; bh=iW2w4qUwjgEtP4/DZX05tdgHPN7/mPw8snINFZEOTBI=; b=E/6E7z8cyqzCnXr0VzBWFxLQ/STepBm3/pLmoN3sEs4pvjG7RF+Qbddu8X+UoX7M8E 2QRAl7zOY2PvMV2DVy/lHep00iyTeqsl3UstIxwGuYPnOiqEturmSp6EXtX5bUh3qHCr kVetzu3ppBroDZXvvMrLpkf5PpX7EuV5NfMMuOdSKqw6Ynr/5hMXIB25KVaf5sWfoVDo noOVB70LF0QXZdlf2wdMkR3EJ1YjMNqejHxKPTso+t/9ZS9quk8Kdqwov5IxbKJh2r6M 3IL+3n3thdasiVl1FBA1P/uzPyWqt8YSPXCnEiqrpvsjymXbR/gx6zNtggXYygwU5CTQ UX5A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j63si25266305pge.132.2019.05.22.11.41.06; Wed, 22 May 2019 11:41:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729372AbfEVSj6 (ORCPT + 99 others); Wed, 22 May 2019 14:39:58 -0400 Received: from iolanthe.rowland.org ([192.131.102.54]:56412 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1728533AbfEVSj5 (ORCPT ); Wed, 22 May 2019 14:39:57 -0400 Received: (qmail 10090 invoked by uid 2102); 22 May 2019 14:39:56 -0400 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 22 May 2019 14:39:56 -0400 Date: Wed, 22 May 2019 14:39:56 -0400 (EDT) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: Bjorn Helgaas cc: Kai Heng Feng , Rafael Wysocki , , LKML , Mathias Nyman , Subject: Re: [PATCH] PCI / PM: Don't runtime suspend when device only supports wakeup from D0 In-Reply-To: <20190522181157.GC79339@google.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 22 May 2019, Bjorn Helgaas wrote: > On Wed, May 22, 2019 at 11:46:25PM +0800, Kai Heng Feng wrote: > > > On May 22, 2019, at 9:48 PM, Bjorn Helgaas wrote: > > > On Wed, May 22, 2019 at 11:42:14AM +0800, Kai Heng Feng wrote: > > >> at 6:23 AM, Bjorn Helgaas wrote: > > >>> On Wed, May 22, 2019 at 12:31:04AM +0800, Kai-Heng Feng wrote: > > >>>> There's an xHC device that doesn't wake when a USB device gets plugged > > >>>> to its USB port. The driver's own runtime suspend callback was called, > > >>>> PME signaling was enabled, but it stays at PCI D0. > > > > ... > > > And I guess this patch basically means we wouldn't call the driver's > > > suspend callback if we're merely going to stay at D0, so the driver > > > would have no idea anything happened. That might match > > > Documentation/power/pci.txt better, because it suggests that the > > > suspend callback is related to putting a device in a low-power state, > > > and D0 is not a low-power state. > > > > Yes, the patch is to let the device stay at D0 and don’t run driver’s own > > runtime suspend routine. > > > > I guess I’ll just proceed to send a V2 with updated commit message? > > Now that I understand what "runtime suspended to D0" means, help me > understand what's actually wrong. Kai's point is that the xhci-hcd driver thinks the device is now in runtime suspend, because the runtime_suspend method has been executed. But in fact the device is still in D0, and as a result, PME signalling may not work correctly. On the other hand, it wasn't clear from the patch description whether this actually causes a problem on real systems. The description only said that the problem was theoretical. > The PCI core apparently *does* enable PME when we "suspend to D0". > But somehow calling the xHCI runtime suspend callback makes the driver > unable to notice when the PME is signaled? According to Kai, PME signalling doesn't work in D0 -- or at least, it is _documented_ not to work in D0 -- even though it is enabled and the device claims to support it. In any case, I don't really see any point in "runtime suspending" a device while leaving it in D0. We might as well just leave it alone. Alan Stern