From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754653AbdKKBgp (ORCPT ); Fri, 10 Nov 2017 20:36:45 -0500 Received: from mail-ot0-f193.google.com ([74.125.82.193]:56942 "EHLO mail-ot0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750750AbdKKBgm (ORCPT ); Fri, 10 Nov 2017 20:36:42 -0500 X-Google-Smtp-Source: AGs4zMZzQs6aWl0l7Tibz5lms2AQbcmHIG5wHd3RIytltBvjAzvXZqzwVp5VlDCM0AqfSAoZG9N+U29gTGIMD0DpSko= MIME-Version: 1.0 In-Reply-To: References: <3806130.B2KCK0tvef@aspire.rjw.lan> <16592954.7Zo1mAdIIH@aspire.rjw.lan> <6330680.LdxjlP4uri@aspire.rjw.lan> <2932219.eEdIVn6WWf@aspire.rjw.lan> From: "Rafael J. Wysocki" Date: Sat, 11 Nov 2017 02:36:41 +0100 X-Google-Sender-Auth: POTDCx11F9VGIBRI-xu-YZSgsvs Message-ID: Subject: Re: [PATCH v2 1/6] PM / core: Add LEAVE_SUSPENDED driver flag To: Ulf Hansson Cc: "Rafael J. Wysocki" , Linux PM , Bjorn Helgaas , Alan Stern , Greg Kroah-Hartman , LKML , Linux ACPI , Linux PCI , Linux Documentation , Mika Westerberg , Andy Shevchenko , Kevin Hilman Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Nov 11, 2017 at 12:45 AM, Rafael J. Wysocki wrote: > On Fri, Nov 10, 2017 at 10:09 AM, Ulf Hansson wrote: >> On 8 November 2017 at 14:25, Rafael J. Wysocki wrote: [cut] >> Moreover, you should check the return value from >> pm_runtime_set_suspended(). > > This is in "noirq", so failures of that are meaningless here. They *should* be meaningless, but __pm_runtime_set_status() is sort of buggy and checks child_count regardless of whether or not runtime PM is enabled for the children (but when changing the status to "active" it actually checks if runtime PM is enabled for the parent before returning -EBUSY, so it is not event consistent internally). Oh well. >> Then I wonder, what should you do when it fails here? >> >> Perhaps a better idea is to do this in the noirq suspend phase, >> because it allows you to bail out in case pm_runtime_set_suspended() >> fails. > > This doesn't make sense, sorry. Not for the above reason, but that would allow the bug in __pm_runtime_set_status() to be sort of worked around by setting the status to "suspended" for children before doing that for their parents. Moreover, stuff with nonzero usage_counts cannot be left in suspend regardless. Thanks, Rafael