Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp752619ybz; Wed, 22 Apr 2020 07:23:50 -0700 (PDT) X-Google-Smtp-Source: APiQypIoRz47NQna6ZadKhH0H0jkP6hhI/4+WpE7ooxX0KthHFWf938j2+Kk6iLsfXjHSYuTZD+m X-Received: by 2002:a17:907:41b3:: with SMTP id na3mr27560048ejb.250.1587565430317; Wed, 22 Apr 2020 07:23:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587565430; cv=none; d=google.com; s=arc-20160816; b=aHF3LEbwoQ38omM3c+OeLTjcF9+KRe+WIMpUILlJUQLIxZNcc0mUEi2OSazhHzZJmq u12feWuGT401+ASd8EjgTNunccdUTkn7hJ6MnUAImvhaX70NQzvnLJkOgrPlvEMGQvTy b8GqMEYKfoOpIZ7ikPhFTB6aS1dhMKULveS7wO/4IpcCMArg52zdg+PO0uTU4wVaPYeu 5uslLGMIs2egrPqOLuCdnFKFsqI8Pzx1iC/lej6rroehLnyXUOzReNoGBX0rMQpdxA5c CZQWeRoX1vIyxCU3xFFjFqWSL74YJJQ4HkGz822HTQFWT2LddRzOSGIyqBNbabtS0pzD 99lw== 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; bh=TH4MbBTcD9eF7C0JZERo6wOrNIuBToWUQATt+xzUiJU=; b=X61s9bCp+he3CBL1AYUVMQGQ5Wv81V7wW47Z54Tvcl6IUwmr9BOpqsme8/yH7Qzwwj vmJoOWNk/QWql2tqk4YBjydPHVM38vuQHpr0wRI5FQvdbhMt5QlSbwtJUrVsNCadTxWV ZtaICEgO+Bo05bZXNoQ3eLx8D9GagQ+oFNMwOxW9d3xR0wCZRgV/2/R+xcJbRbMFHIos JwbwWpk+9n989jRLPteutxn18Nlg3wY6leuaMFtGUxtwuFF4pVJt7oaA+6u/R5GtJtW6 CQHGA4AXyvSsYYDFjSxYhWDArJfAMNbV4yavtDmW3cyX5Al7p5cyd+Lci6yPT4dBF1I5 Tvpw== 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 ci25si3782739ejb.476.2020.04.22.07.23.18; Wed, 22 Apr 2020 07:23:50 -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 S1727862AbgDVOV1 convert rfc822-to-8bit (ORCPT + 99 others); Wed, 22 Apr 2020 10:21:27 -0400 Received: from mail-oo1-f65.google.com ([209.85.161.65]:43250 "EHLO mail-oo1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725648AbgDVOV0 (ORCPT ); Wed, 22 Apr 2020 10:21:26 -0400 Received: by mail-oo1-f65.google.com with SMTP id d21so542414ook.10; Wed, 22 Apr 2020 07:21:25 -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:content-transfer-encoding; bh=zNjUnY94w0UWiXsubeBPALgzfBzt9q3zu5ENZfCjrts=; b=kzMfRMWsG3VKy4zOrZ6AWWh9+VxDQgk3o7R3I3vJGxDuR2m3Ff55DR+qVGM/41INfc SRqtTmc/SPtU898lTlfO6FVqElolwC0KBBORYM7S4V1cbGfEetXQV0rYvx6HEz8IcKAx fnkceX6RjxM0RspmXFvC3Egn2exCU724l4mg5jW+dlVkaVBPkYSC0VQYUhQz9WjTQqgl XCAFoVVwM7KGJ0MPdWtjWxisiIIxDM/j1HOh6pVxbdTWoUvcif6IyLX16jW9MUuK6N7a 51QK97T76ALtCwTqpex/TY4Xqy27+JlGFt/r1/muguVL9i5zzJAaqeqneCrgcPUCDniV NiNw== X-Gm-Message-State: AGi0Pubq9OqcnWDWAWXiKuf0eaZhRasusOLnyNrvOdH+d8HrByKr4f3z 7YsAtydc9QV1gfSMCYBR050QY83CWVH4e4hsggN/cg== X-Received: by 2002:a4a:a286:: with SMTP id h6mr15515496ool.38.1587565284215; Wed, 22 Apr 2020 07:21:24 -0700 (PDT) MIME-Version: 1.0 References: <20200422051529.30757-1-zhang.lyra@gmail.com> In-Reply-To: From: "Rafael J. Wysocki" Date: Wed, 22 Apr 2020 16:21:12 +0200 Message-ID: Subject: Re: [PATCH] PM: sleep: call devfreq_suspend/resume and cpufreq_suspend/resume in pairs. To: Chunyan Zhang Cc: "Rafael J. Wysocki" , "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: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 22, 2020 at 1:19 PM Chunyan Zhang wrote: > > 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 wrote: > > > > 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,we found an issue with cpufreq schedutil governor on kernel4.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 so > 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).