Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp195348imj; Thu, 14 Feb 2019 18:26:00 -0800 (PST) X-Google-Smtp-Source: AHgI3IZwRVvuSYexqkWxl+HwxII+pXJuiCQRFh04jT25vnceBpbRPffC8B/PpJly3JdQ8IXIud7r X-Received: by 2002:a63:7f46:: with SMTP id p6mr6945233pgn.54.1550197560278; Thu, 14 Feb 2019 18:26:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550197560; cv=none; d=google.com; s=arc-20160816; b=Luf8MIzTTQPhj2mb3E4pHON7WC3zIgBwTVR64D7Kag79QtYCt/LUCuus5f9Zcd6UJr 2EtyBM+s+UIEOTQcs2o9Qg9h9l4SBPKGT81kyf4IWrn6nhIxR+ILjzpNu6O34bTyAy34 vUcxQzvjwOGq4qvkEmyCpspPegMcInEKU7ofeyQ4hgq4xGlUXwSZmNhbCBZDLMwNWzrT pS5Cdtj7xm3tmTrnpdu5XQtQIH3RwKsmrQiyrCLjvPYx1kVNMJbpQnQMm4d6BEGYE4Za WFx/5ZjCiE/lt6qXb+bMDWSc10VIXZ2oAtafYPwPSiZKlkL90q/oXQwDEl1m17t2NHbd 1ZEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=/1zJlt70pEOWMDY89z1Jrc2U17E1dixZLwzhSqJa9Sw=; b=AZQA86iX5rt0nql+bjfhtrWs54BmEdlcelBCf/fXcXEbeSpY/r1awBDw+WdcdfmCoM KdaUPAcJeMwcT+hbJUPQusMZstcRX+1x541FMS7vAUMWzDZG+4K4EXX8eJv7StWCTVHO E988Hlj+5Z5i/lqw553Es3QrC+EycppfVZjP42Py7034i1BM5RlNa2DYeelH4x5RAo2O 4lKTwgmxs5uYHW+wdLIp2QQTRYgosgew6ihMrE3/YZgy4mrvBvWR+kPzwAZafMeLYYmN dpHCIV0V8NM9BAjutWdt8LOlB79CJUXcCJ3xq62fJMhY2Hc81nR3C4dpRgt5yjaN0X80 tX4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="bi/zA0Di"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b70si4111543pfe.168.2019.02.14.18.25.44; Thu, 14 Feb 2019 18:26:00 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="bi/zA0Di"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730055AbfBOATu (ORCPT + 99 others); Thu, 14 Feb 2019 19:19:50 -0500 Received: from mail-pg1-f193.google.com ([209.85.215.193]:44240 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726342AbfBOATt (ORCPT ); Thu, 14 Feb 2019 19:19:49 -0500 Received: by mail-pg1-f193.google.com with SMTP id y1so3900250pgk.11 for ; Thu, 14 Feb 2019 16:19:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=/1zJlt70pEOWMDY89z1Jrc2U17E1dixZLwzhSqJa9Sw=; b=bi/zA0Di8mxoLwo6LmEwMiDYyU1uxg9BM/DXP3U+d6+pk9EJxX90SU07prTOcuqQXE pb1NpemfQVYvmlvnpVQGXZMnFhPbkdGMwTSzH5jnLmSDyOU6Z5R5BCvYU8nr7VVCcBjS j1+wdNp/N9hL7TZYgkTAN/84yWgKbjeeJQ3Aw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=/1zJlt70pEOWMDY89z1Jrc2U17E1dixZLwzhSqJa9Sw=; b=tfUySojPXVIXBneiKteNOes4sKDyKyaVY67JL38bkpGMTmIKhJIzS7nqDgxIolvWtV OSYQpV50fY8smVnEt7MtPOA969qobdAxXvx5ri6YxSQTDC2jqOjeoRE1r06hqgLQ6icj EyeP63g/krUex9RScTO+uNXiYetSdrHVsRPFUxqbBjUf5hB+e4nrXXMIscz/alyM8Ydk z40Wan3Hjjmtn+SUv6u+JE3mVAFEFw4DZt9Nll/ULmnqN6nZq32HkejzkU0yMTU8p1hy KylCqVmh7W7xzqmF7fIvXNAgEhKVSCVqYG1a06h9QsRDAU85oMiYg7kCa7a6v72eVd+u E/TA== X-Gm-Message-State: AHQUAuas1FJadMgBn0sQSTXfrFwTGp1NvYqMn4nCBZKh3DdbXkCx8faZ uSu2tS0MUpQNPlqEHan0YWVgSw== X-Received: by 2002:a65:4101:: with SMTP id w1mr2609218pgp.257.1550189988494; Thu, 14 Feb 2019 16:19:48 -0800 (PST) Received: from localhost ([2620:15c:202:1:75a:3f6e:21d:9374]) by smtp.gmail.com with ESMTPSA id 62sm4122568pgc.61.2019.02.14.16.19.47 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 14 Feb 2019 16:19:47 -0800 (PST) Date: Thu, 14 Feb 2019 16:19:47 -0800 From: Matthias Kaehlcke To: Chanwoo Choi Cc: Chanwoo Choi , MyungJoo Ham , Kyungmin Park , Thierry Reding , Jonathan Hunter , Linux PM list , linux-kernel , linux-tegra@vger.kernel.org, Lukasz Luba Subject: Re: [PATCH 4/4] PM / devfreq: Handle monitor start/stop in the devfreq core Message-ID: <20190215001947.GF117604@google.com> References: <20190214013042.254790-1-mka@chromium.org> <20190214013042.254790-5-mka@chromium.org> <20190214192855.GD117604@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Chanwoo, On Fri, Feb 15, 2019 at 08:42:30AM +0900, Chanwoo Choi wrote: > Hi Matthias, > > On 19. 2. 15. 오전 4:28, Matthias Kaehlcke wrote: > > Hi Chanwoo, > > > > On Thu, Feb 14, 2019 at 11:17:36PM +0900, Chanwoo Choi wrote: > >> Hi Matthias, > >> > >> As I commented on the first patch, it is not possible to call some codes > >> according to the intention of each governor between 'devfreq_moniotr_*()' > >> and some codes which are executed before or after 'devfreq_moniotr_*()' > >> > >> For example, if some governor requires the following sequence, > >> after this patch, it is not possible. > >> > >> case DEVFREQ_GOV_xxx: > >> /* execute some code before devfreq_monitor_xxx() */ > >> devfreq_monitor_xxx() > >> /* execute some code after devfreq_monitor_xxx() */ > > > > As for the suspend/resume case I agree that the patch introduces this > > limitation, but I'm not convinced that this is an actual problem. > > > > For governor_start(): why can't the governor execute the code > > before polling started, does it make any difference to the governor > > that a work is scheduled? > > The some governors might want to do something before starting > the work and do something after work started. I think that > the existing style is more flexible. Could you provide a practical example that answers my question above: "why can't the governor execute the code before polling started, does it make any difference to the governor that a work is scheduled?" > And, > It has one more problem when changing the governor on the fly > from simple_ondemand to other governors like performance, > powersave and so on. > > Even if other governors don't need to monitor the utilization, > the work timer will be executed continually because the devfreq > device has the polling_ms value. It is not necessary > of the other governors such as performance, powersave. > > It means that only specific governor like simple_ondemand > have to call the devfreq_monitor_start() by itself > instead of calling it on devfreq core. yes, I noticed that too, it can be easily fixed with a flag in the governor. > > For governor_stop(): why would the governor require polling to be > > active during stop? If it needs update_devfreq() to run (called by > > devfreq_monitor()) it can call it directly, instead of waiting for the > > monitor to run at some later time. > > As I knew, if the current governors are performance/powersave/ > userspace, the monitoring is already stopped and not used. > Because they don't need to handle the codes related to the work > like queue_delayed_work(), cancel_delayed_work_sync(). > > And, > In case of the existing style for calling devfreq_monitor_*(), > other governors like performance/powersave/userspace/passice > don't need to call the devfreq_monitor_stop() because they > didn't use the work timer. As per above, the governor could have a flag indicating that it doesn't need load monitoring. I think it should be avoided to expect the governors to do the right thing if certain actions are mandatory and common for all governors (unless the feature in question is not used). It should be handled in the core code, unless there are good reasons not to do this. With thispatch set the amount of code remains essentially the same, and no new code needs to be added for governors that don't do anything special in start/stop/suspend/resume. TBH I think probably the entire event handler multiplexing should go away and be changed to a struct devfreq_ops with optional callbacks for start, stop, suspend, resume and update interval. As far as I can tell the multiplexing isn't needed and separate ops would result in cleaner code, in both the devfreq core and the governors. Cheers Matthias