Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp4031834pxb; Tue, 7 Sep 2021 13:06:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzI209VDneemphzbP1PDExh42zodu1xG4Ycz5HyBUka94Pmkmr6AqjcplKjHPPnGc7Zsjjj X-Received: by 2002:a5e:c609:: with SMTP id f9mr15835908iok.127.1631045167208; Tue, 07 Sep 2021 13:06:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631045167; cv=none; d=google.com; s=arc-20160816; b=vHZCn+ZtCnCcfUXjpKkSEuWGQQiBj3pMtZP+IZJ13ru2+HLxY7llCEjYUz1W2vpPVZ xPSKQ/excE3g25K35nJgVbF127Ny1Ab8MNca8MR1SupK2pIGpBf7OfQ8P+KF2e5UVEOy oPJ7WjsCtpq3XbSbSEqLSTQkiHWiv5kZuayWkd1Mlfg2QiNg9Mkc/HX9kDhz7OxurA5u XTPeHBwk3PcCyf7man/XTNM6f1rrBbAH3FWu8qr/pA6NUAzLOzatmfO/HkGj9CxbArrd 2VPuBrehtvmYvitCNBpMMEFE5LQKvE9yubFt9CPIHzRwPa+60Et3SFWhrYGFG6I+kPdJ vTDg== 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=6BJUSy7ZuZKYt9ryvhuAcYMqADTMlcTk8t8PG14IBng=; b=TX1UcaJkqkhzT890jx7edqk1IoJC0hVW0NBjkunOZIVJp/xH2ftrhMdPYPql3bzPwk rk5J70zK9J774o+3yuokurBvjZHve7p7hJm/mV8ezUpjDHngmsoQssyhZuwq5lMpaVHD m59QxWaZI3JTwR1sfPW/qTNZCmGeTqGU8RKXSo90w622gq+/UX+0j9N5uNKWPNeW/UD3 icJzChcQHWRHFC3nB8L5tsYMYJxX8BjlNGGJBa+9oIxKzxAe0W7ODH+QkVciTLYGvS6e TGYRt0QOLlR+uPIODHmqbTROGnAhh33E7wAGFV9Yqmt1CVqCzCYU3+MSJr4bC6iLCQFZ y08Q== 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 d188si13817087iog.62.2021.09.07.13.05.24; Tue, 07 Sep 2021 13:06:07 -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 S1346031AbhIGTYV (ORCPT + 99 others); Tue, 7 Sep 2021 15:24:21 -0400 Received: from mail-oi1-f173.google.com ([209.85.167.173]:46970 "EHLO mail-oi1-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346056AbhIGTYR (ORCPT ); Tue, 7 Sep 2021 15:24:17 -0400 Received: by mail-oi1-f173.google.com with SMTP id w144so214210oie.13; Tue, 07 Sep 2021 12:23:11 -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=6BJUSy7ZuZKYt9ryvhuAcYMqADTMlcTk8t8PG14IBng=; b=eP6G28L09y11NyH9/uCYG/00IkSb0fMlsSZXg3vyHbbVenVT+y6dxef5wVrM98pAe6 1uSk37OHdbsdPApCrGi6rYu+xjkmhu0735HN9uZUtZhs1zAe5mVqfzkcuyHBVdBxM0pr Bkq0LTKYuVKo9A/OSpNOm7kHGE4CdhrVkAD3SYicXxIHcmvWmdIMccebcGfM9gCjx53T lGOUAbPh2S/t84rzV0vjd92VktPE3jPxuCV5tOd81YDNcq2wIqD0WOjVBEEIesddZE4V FJlyWRjDtXWeNVmXG2vZkN/v8wI7jdWObu5ZdS5O1eanDfGOn0NPm6WpbNmP1FsIuOEl dtXQ== X-Gm-Message-State: AOAM531qmDdtxVTwGKPbLWjm+c+XR5z8wq39T0oAg58tV3mXPmZmMoe3 ZGZhl+1Urm2N/VbsZuBe2qqMiHdVcsHe2f1f/Y2PDI8K X-Received: by 2002:a05:6808:10c1:: with SMTP id s1mr4058235ois.69.1631042590849; Tue, 07 Sep 2021 12:23:10 -0700 (PDT) MIME-Version: 1.0 References: <1631013863-43141-1-git-send-email-psodagud@codeaurora.org> In-Reply-To: <1631013863-43141-1-git-send-email-psodagud@codeaurora.org> From: "Rafael J. Wysocki" Date: Tue, 7 Sep 2021 21:22:59 +0200 Message-ID: Subject: Re: [PATCH v5] PM: sleep: core: Avoid setting power.must_resume to false To: Prasad Sodagudi Cc: Greg Kroah-Hartman , "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 Tue, Sep 7, 2021 at 1:24 PM 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 > --- > V4 -> V5: Fix coding style > 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 | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c > index d568772..cbea78e 100644 > --- a/drivers/base/power/main.c > +++ b/drivers/base/power/main.c > @@ -1642,7 +1642,7 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async) > } > > dev->power.may_skip_resume = true; > - dev->power.must_resume = false; > + dev->power.must_resume = !dev_pm_test_driver_flags(dev, DPM_FLAG_MAY_SKIP_RESUME); > > dpm_watchdog_set(&wd, dev); > device_lock(dev); > -- > The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, > a Linux Foundation Collaborative Project Applied as 5.15-rc material, thanks!