Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1367424ybz; Wed, 22 Apr 2020 19:45:10 -0700 (PDT) X-Google-Smtp-Source: APiQypI15Gi+5HokeCOuzvs1gOkmeiV3ttAiFhvsHplbdNTMTDWtqRfnVDA8aS8DMnXZvBRn4Ffh X-Received: by 2002:a17:906:d14b:: with SMTP id br11mr999941ejb.213.1587609910735; Wed, 22 Apr 2020 19:45:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587609910; cv=none; d=google.com; s=arc-20160816; b=B+t3qhG0gJiGSACbhIVUmK1MJcadBZoCJq0mRbnR+Bl70ijR77e69bKptCliauGum7 vFpcBGDIxpXQyTC/uyldYbtHXUL3XE/NuRoGC8CBv8K9DP2mhZxxaTw+tCJ4ewV6bqU5 xhP4aAAyjqQZsQyt08yhhBfdFTsmxcv5hivchcTXWQaDXT8rZPvDNgw5wShzee3teLHr EsVpfSh8WIOYO9kfFOUncUu9N1H/unYRXJ4kQYm4qb/spGcNGu304lOFj6yQMw8EuD2b OkfUBoXOj9dzVvM/IhGFBn5V1Y8HQyauS7NAUeS+X3pF7l8ymwiM0kLkBMywH+oZ1ydn Nrkw== 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:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=+E1Vpl6owsWhbt4oEdMFH6LpaqhM5KtB6JWE9dlZYRY=; b=wPIPkBUQjGgxXjcaYQz2VewcoqhIgeUY4BUUK1w8FVgpGha9GyysTvI421UFGcbj86 aZBSdJxaZmvo2d3jZAdXdpK093DBU3s++d47X5jRAWAk0ZENMJyiJgIhAZyZ26ydRjBH usuyIP6qJhKRjNeDEeDjyK/AG9hg+2kS1ViTmvPNetT4erZgplAWY5cwN0wCzP6On2w7 6TRcVDgAueDoryaGqg+rz3U1i14rH70usZRf06VLnaY/sObR4sqFjqgnHsytPQ53djUP Y65MViHoh2lzvX6kVeCX55AVkD01fYnyhwutws5Cl1lZcrFiOFiPKWnVb05NgeiOsf6K Kjfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=DbYLdPIs; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id sb9si535383ejb.156.2020.04.22.19.44.48; Wed, 22 Apr 2020 19:45:10 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=DbYLdPIs; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726599AbgDWClq (ORCPT + 99 others); Wed, 22 Apr 2020 22:41:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726401AbgDWClp (ORCPT ); Wed, 22 Apr 2020 22:41:45 -0400 Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3572AC03C1AB; Wed, 22 Apr 2020 19:41:45 -0700 (PDT) Received: by mail-wm1-x343.google.com with SMTP id u127so4871127wmg.1; Wed, 22 Apr 2020 19:41:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=+E1Vpl6owsWhbt4oEdMFH6LpaqhM5KtB6JWE9dlZYRY=; b=DbYLdPIsz5Ec24KSUtplycQbYhICIHFOjMX+ccSHDmiHKcEKTQ25ZcSr142eSm2zI/ B5hzTgrN1a5XdBUvc/zfkFX7APm3YAw6T48wbriQvyiNa34E6BIYJgAU2WmqQQCMYKLV K6FBLeLekyMO/nUnHANBCHhZsIYumwS+jpV+TkO+Kk5g0QDNbPUOgXq37ULQ1LS2XAcw pUxUBlrkpHJI7Dra8vLb9qdvqfwrHEVYqLpZdbUoEiG7hl+cQbY0ReYYzIpWK6aLtpba sZKaOgzKHf1mSpuxB9UukvpnjLZT4Ub7ypyISs8UcZdJckZfgOb+7WJsBNwvzWRuVPws RzDw== 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:content-transfer-encoding; bh=+E1Vpl6owsWhbt4oEdMFH6LpaqhM5KtB6JWE9dlZYRY=; b=TlRIcy53wvcwTY36rLF1lET5BBs3cfhNNIgOYUVPSFii9aperzKlF8OWI9bCToFd4d uTZzkGaqDewFFam/iF0bKmXhRbYb6igMIAQ2ArWEPbeC4f9DPFhVscgJBKPrvaMuByxa vWlukiHErTfkWGG1+QjiHZmy2TTwNfdFYzNaNSuKyTO077qSEwyO8j6bTJWG25rP1shC JsJEKVcGCgLDltRyKh/z16272eUKdDMkOC0nK8ZhP60iCYEnCXdcN9pLs2XsX6xCv4Oq szmlXGHz+NiBEHa1bfOjgqlLsY3CZ0S3BgeuKqLQ6hUoAfT8E4YICql2suhfr6JpkBHf 5vUA== X-Gm-Message-State: AGi0PuZatZBk2qqAV6sZVvrxIV9SC1+6wdW8Qcgtzzg4sSfTqGl4DtTv CrzOeMxn5fUlkkOHSxCUaHLiLkQvbfu8nJ3ONQQ= X-Received: by 2002:a1c:3b0a:: with SMTP id i10mr1516959wma.26.1587609703900; Wed, 22 Apr 2020 19:41:43 -0700 (PDT) MIME-Version: 1.0 References: <20200422051529.30757-1-zhang.lyra@gmail.com> In-Reply-To: From: Chunyan Zhang Date: Thu, 23 Apr 2020 10:41:07 +0800 Message-ID: Subject: Re: [PATCH] PM: sleep: call devfreq_suspend/resume and cpufreq_suspend/resume in pairs. To: "Rafael J. Wysocki" Cc: "Rafael J . Wysocki" , Greg Kroah-Hartman , Len Brown , Pavel Machek , Linux PM , Linux Kernel Mailing List , Orson Zhai , Vincent Wang , Samer Xie , Chunyan Zhang Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 22 Apr 2020 at 22:21, Rafael J. Wysocki wrote: > > On Wed, Apr 22, 2020 at 1:19 PM Chunyan Zhang wrot= e: > > > > Hi Rafael, > > > > (Behalf Of Vincent Wang) > > > > Thanks for your comments, please see my answers below. > > > > On Wed, 22 Apr 2020 at 17:05, Rafael J. Wysocki wro= te: > > > > > > On Wed, Apr 22, 2020 at 7:15 AM Chunyan Zhang = wrote: > > > > > > > > From: Vincent Wang > > > > > > > > If dpm_prepare() fails in dpm_suspend_start(), dpm_suspend() can't = be > > > > called. > > > > > > That's correct. > > > > > > > And then, devfreq_suspend() and cpufreq_suspend() will not be > > > > called in the suspend flow. > > > > > > Right. > > > > > > > But in the resiume flow, devfreq_resume() and cpufreq_resume() will > > > > be called. > > > > > > Right, and they are expected to cope with the situation. > > > > > > > This patch will ensure that devfreq_suspend/devfreq_resume and > > > > cpufreq_suspend/cpufreq_resume are called in pairs. > > > > > > So why is it better to do this than to make devfreq_resume() meet the > > > expectations? > > > > Yes=EF=BC=8Cwe found an issue with cpufreq schedutil governor on kernel= 4.14, > > and I think the issue should haven't been changed on the latest > > version of kernel. > > > > In the function dpm_suspend_start(), dpm_suspend() would not be > > exceuted if return error from device_prepare() [1]. So > > cpufreq_cpufreq() will not be called, > > I guess you mean cpufreq_suspend(). > > That should be OK . > > > then cpufreq_remove_update_util_hook() will not be called either, and s= o > > cpufreq_update_util_data will not be NULL. > > > > In the dpm resume flow, sugov_start() will be called, in which > > sg_cpu.update_util will be set to 0. > > Which code patch does this? > > Surely not cpufreq_resume(), because that checks cpufreq_suspended which > cannot be set if cpufreq_suspend() has not been called (because it is the= only > place setting cpufreq_suspended). Right, I saw that, then there's no issue indeed. I just need to backport the patch which added checking of cpufreq_suspended to cpufreq_resume. Thanks for your review!