Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753430Ab2KTAwv (ORCPT ); Mon, 19 Nov 2012 19:52:51 -0500 Received: from mga03.intel.com ([143.182.124.21]:17531 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753049Ab2KTAwt (ORCPT ); Mon, 19 Nov 2012 19:52:49 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.83,282,1352102400"; d="scan'208";a="219936541" Message-ID: <1353372766.26072.21.camel@yhuang-dev> Subject: Re: [RFC] PCI/PM: Keep runtime PM enabled for unbound PCI devices From: Huang Ying To: "Rafael J. Wysocki" Cc: Alan Stern , Bjorn Helgaas , linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-pm@vger.kernel.org, "Rafael J. Wysocki" Date: Tue, 20 Nov 2012 08:52:46 +0800 In-Reply-To: <1521498.PJusLS7B2o@vostro.rjw.lan> References: <1521498.PJusLS7B2o@vostro.rjw.lan> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.4.4-1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2302 Lines: 50 On Mon, 2012-11-19 at 23:00 +0100, Rafael J. Wysocki wrote: > On Monday, November 19, 2012 11:31:01 AM Alan Stern wrote: > > On Mon, 19 Nov 2012, Huang Ying wrote: > > > > > For unbound PCI devices, what we need is: > > > > > > - Always in D0 state, because some devices does not work again after > > > being put into D3 by the PCI bus. > > > > > > - In SUSPENDED state if allowed, so that the parent devices can still > > > be put into low power state. > > > > > > To satisfy these requirement, the runtime PM for the unbound PCI > > > devices are disabled and set to SUSPENDED state. One issue of this > > > solution is that the PCI devices will be put into SUSPENDED state even > > > if the SUSPENDED state is forbidden via the sysfs interface > > > (.../power/control) of the device. This is not an issue for most > > > devices, because most PCI devices are not used at all if unbounded. > > > But there are exceptions. For example, unbound VGA card can be used > > > for display, but suspend its parents make it stop working. > > > > > > To fix the issue, we keep the runtime PM enabled when the PCI devices > > > are unbound. But the runtime PM callbacks will do nothing if the PCI > > > devices are unbound. This way, we can put the PCI devices into > > > SUSPENDED state without put the PCI devices into D3 state. > > > > > > Known issue: after some changing, pci_dev->driver is used to indicate > > > whether the PCI devices are bound and whether the runtime PM callbacks > > > should do nothing. Maybe it is better to use a dedicated flag such as > > > .skip_rtpm_callbacks. That may improve code readability. > > > > I think it's okay like this, especially if you add a comment in > > pci_runtime_suspend, pci_runtime_resume, and pci_runtime_idle > > explaining that when pci_dev->driver isn't set, the device should > > always remain in D0 regardless of the runtime status. > > Yes, I agree with Alan. Please add comments as Alan's suggesting and it > should be fine. Sure. Will do that. Best Regards, Huang Ying -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/