Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1271211pxb; Fri, 27 Aug 2021 05:25:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyQWoBZ32H+XQCXy4JOPf91hY5b+ePufNX7NZrDA1Yu2jjgpw8WImSzvsKIyMaYfKapFkuO X-Received: by 2002:a05:6402:1cbc:: with SMTP id cz28mr9602760edb.370.1630067157129; Fri, 27 Aug 2021 05:25:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630067157; cv=none; d=google.com; s=arc-20160816; b=wpArLwLvJQNLyhaAN4gzI+9lc2iiRS5uxlNei0P/LFb/ie0GhnXu1v91ZhWdlqO9R3 +mAvkzj4npIvVAuxpCXprwgDRlONUnh240dPFF2QqGQBOtlm6lSUiB5hUz+WGWU5gxJ8 xGj3RzERBMhgNPsUBKAvAUk55QOAmJdkTkj4d7/9jhE0WUMZYGx5ho4pXj7a9iqQh60Z SPGtVBoW3jv1xReXrtRHD9c4Nq9HQJtLMgSwBIeVfODj9MD2OPTfW14TZXIt4ZV1x4JZ pzNIJYu+zUfDs86q5ysimXILyrMWG+WvrHdJUtVvaOJwqSExSKo1jvn0nbcDavEEA+eD 2qVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=XVmv4+HY+RT64ljpEZdINU3ktCc0DXVmgySFxtLtPPM=; b=qGPjKLOhg/UuGswvt5trT96gaYgRupABWrW/zoM5kQA+99puiyaPZDdm1/HsM4rR// TsjH8ThWeSDgzdbUzvEOIqLlWfuF3uM6sJeTgBsSAXVdTnOxnTmI7TrowrX+ca8Qkpq9 FdWuPM36cqaNNj+nLlftZqkJ9z9H0cVyrAUstD+Di3dmR46oBXvq5wMtLPbcei7fqZJi fr1o3/pIs5LlZmtANcIBYpAHGksuWnNZ3WzbWw2FPELrI1q6uV0LFHbEAT+CE8RWX3AA qAlbA9vji7X+mQbNwA2hWSrnJjEGUWmeJiz1TT7j3xHw9FxijioKYwbNZsYKw9up9eF6 2S3Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cr11si6639090ejc.106.2021.08.27.05.25.31; Fri, 27 Aug 2021 05:25:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245100AbhH0MWB (ORCPT + 99 others); Fri, 27 Aug 2021 08:22:01 -0400 Received: from mail-oi1-f174.google.com ([209.85.167.174]:33738 "EHLO mail-oi1-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231124AbhH0MWB (ORCPT ); Fri, 27 Aug 2021 08:22:01 -0400 Received: by mail-oi1-f174.google.com with SMTP id n27so9640236oij.0; Fri, 27 Aug 2021 05:21:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=XVmv4+HY+RT64ljpEZdINU3ktCc0DXVmgySFxtLtPPM=; b=rmghF+vFts+I6boLvWm0XOlvxPDYO66cy3xa+lwh3VfmE5dZ2ckTCGm1CyUQTRrkbL kv2JjYBPJixYhpO5aH6JYBZp0qZ0koKMFuLzrjQh8UeaWc8O8TnDIwW5f64FQpJMzR2F VISvEQtn39qb8jhal9iscQ5foiz7M+F4zqkf6px+mtggl2Z3/3zAHrIJ+KvIvavd+PcI l7VxjceLI6F9WiOqbhRC/1MobYZhHDiBlOAUMk/xIwCS5hw8wAXw8p/hjJOgO3lbgNYL 7cTeLQ31SZlzY24wkVUDXWjNf1Tc3yllDC4PARa1WIAFdYlH/09/TBu6DtM6w2JjpuQ2 fApA== X-Gm-Message-State: AOAM531rF01PjwPrB54aBNbw4UVOWCcLRlQm3f2wX97imzXhnsIDdt9N JsCYb6TIDe91WZI3nyp0pJPqE5TWpPkWwNCr5D2ZwZNatKI1kg== X-Received: by 2002:a05:6808:10ce:: with SMTP id s14mr15252176ois.157.1630066872134; Fri, 27 Aug 2021 05:21:12 -0700 (PDT) MIME-Version: 1.0 References: <1629732470-155444-1-git-send-email-psodagud@codeaurora.org> In-Reply-To: From: "Rafael J. Wysocki" Date: Fri, 27 Aug 2021 14:21:00 +0200 Message-ID: Subject: Re: [PATCH v4] PM: sleep: core: Avoid setting power.must_resume to false To: Greg KH Cc: Prasad Sodagudi , "Rafael J. Wysocki" , Len Brown , Linux Kernel Mailing List , Linux PM , Pavel Machek Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 27, 2021 at 10:58 AM Greg KH wrote: > > On Mon, Aug 23, 2021 at 08:27:50AM -0700, Prasad Sodagudi wrote: > > There are variables(power.may_skip_resume and dev->power.must_resume) > > and DPM_FLAG_MAY_SKIP_RESUME flags to control the resume of devices after > > a system wide suspend transition. > > > > Setting the DPM_FLAG_MAY_SKIP_RESUME flag means that the driver allows > > its "noirq" and "early" resume callbacks to be skipped if the device > > can be left in suspend after a system-wide transition into the working > > state. PM core determines that the driver's "noirq" and "early" resume > > callbacks should be skipped or not with dev_pm_skip_resume() function by > > checking power.may_skip_resume variable. > > > > power.must_resume variable is getting set to false in __device_suspend() > > function without checking device's DPM_FLAG_MAY_SKIP_RESUME settings. > > In problematic scenario, where all the devices in the suspend_late > > stage are successful and some device can fail to suspend in > > suspend_noirq phase. So some devices successfully suspended in suspend_late > > stage are not getting chance to execute __device_suspend_noirq() > > to set dev->power.must_resume variable to true and not getting > > resumed in early_resume phase. > > > > Add a check for device's DPM_FLAG_MAY_SKIP_RESUME flag before > > setting power.must_resume variable in __device_suspend function. > > > > Fixes: 6e176bf8d461 ("PM: sleep: core: Do not skip callbacks in the resume phase") > > Signed-off-by: Prasad Sodagudi > > --- > > V3 -> V4: Remove dev->power.usage_count variable check > > V2 -> V3: Format issues patch posting > > V1 -> V2: Fixed indentation and commit text to include scenario > > drivers/base/power/main.c | 5 ++++- > > 1 file changed, 4 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c > > index d568772..50e8ea3 100644 > > --- a/drivers/base/power/main.c > > +++ b/drivers/base/power/main.c > > @@ -1642,7 +1642,10 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async) > > } > > > > dev->power.may_skip_resume = true; > > - dev->power.must_resume = false; > > + if (dev_pm_test_driver_flags(dev, DPM_FLAG_MAY_SKIP_RESUME)) > > + dev->power.must_resume = false; > > + else > > + dev->power.must_resume = true; > > > > dpm_watchdog_set(&wd, dev); > > device_lock(dev); > > Seems sane, Rafael, any comments? Yup, please see my response: https://lore.kernel.org/linux-pm/CAJZ5v0hAuZmaB6j4qA7P43J4TshBrYa8UsX3KtH7hkxWZPU2wA@mail.gmail.com/T/#t Cheers!