Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3756204imm; Tue, 29 May 2018 13:03:29 -0700 (PDT) X-Google-Smtp-Source: AB8JxZos6gq6LKX99SDAxFooYUHXXz60fV6M08f399DgMYrVsA1YjSWFYYve3yQh4oCcYeKWns/V X-Received: by 2002:a63:7f4e:: with SMTP id p14-v6mr14759319pgn.27.1527624209365; Tue, 29 May 2018 13:03:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527624209; cv=none; d=google.com; s=arc-20160816; b=YBE9MWwvu9trSDD0HfcGHEyqQ/mOJ6j9ms8p9aAtbnK23DzgEhcKa7tQunJB/rlK0f 0U0ofNOM3lW2Gg8/f8z6tA+cDK9X0vcqSy6akID22lvZxsFIg53P5FOgO/2p9HnvU/fy OY74N63EwSk4mKwVgsGjvGNgfD4S0RH+M35E3P/VDC9tZTf+eE0uPaZhCwqBckWu9LMH DHNy4BbvL4YCB7RYwa/XvKx+uHiWN3TbEaLt0XocG9xQIb7LTBoaYzuDfCfF5DWWIEXe QutSyyLPt7bxErSPzdJqBhLAeuoELBoc83w19O+iPp9/28pjHVtfCsFEiTkfe0lLr3Wm UQGA== 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-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=7rx/wUkfUKhA+Ig+j+aMGVxvQM3GcAYFDGCuZLqofqE=; b=EqX/rWLKylPzzeGKF45e6p1e/WtSXJeSfuBbKpLVc3kw1sMgfgvo1fCbol4bXOW0vH WVxCGJylyq8r7sEAfe8c8Ai0L4+hYVIfCbxloj77u+Z9J2eA4pUEGIZd6G8HVibU0n1v gpUsAl7qV7ZfeCHDOShmxY7mzQFjxcNuWAfDYQd0zAvTdfpBcaAKrZ836MDQDpY7DdXQ knJnt13HZMbcS78pARQ6VTo4Cj3ORSjng/ZRbAQMJNAI6iG+CYh3FPw/llO7HW+NCIXF DfgVt/4KvBGgHS4CYrB8k3VgAUdmDP/oR7xxYH576d+A97GsaCKOqnnKz38yqopzxluL 8sMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=C+Rsnnsz; 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 j123-v6si34590668pfd.207.2018.05.29.13.03.14; Tue, 29 May 2018 13:03:29 -0700 (PDT) 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=C+Rsnnsz; 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 S966562AbeE2UCo (ORCPT + 99 others); Tue, 29 May 2018 16:02:44 -0400 Received: from mail-pl0-f68.google.com ([209.85.160.68]:46675 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966433AbeE2UCm (ORCPT ); Tue, 29 May 2018 16:02:42 -0400 Received: by mail-pl0-f68.google.com with SMTP id 30-v6so9565544pld.13 for ; Tue, 29 May 2018 13:02:42 -0700 (PDT) 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:in-reply-to:user-agent; bh=7rx/wUkfUKhA+Ig+j+aMGVxvQM3GcAYFDGCuZLqofqE=; b=C+RsnnszzOfq/MNb/1CpYanDrSf3WVO7jxlKvgesEQju5WsuAUwj0/iu+EbmAxnUad zlEXc0RCJwCZ5l1VqcqzoIh3OUmhYLgJ0uksgnwhNJ4XUQU05ctavOfawYsZ4IMww6C4 VrZLjEdjiPg8bEH5Zgbyw+RfpSYgxdjC/mIXg= 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:in-reply-to:user-agent; bh=7rx/wUkfUKhA+Ig+j+aMGVxvQM3GcAYFDGCuZLqofqE=; b=hf6bLBGQXKdBClHgBQaq6+JJg2x1mdvwW96DHxO9dM+bVw3tBFzH7fY0oW4bnEAFRb AqFBwX/uieQbxyle3utsEE+/hf+olsfb0sVVR7Q7xYRclw9IQMuTybMB5yqMjnE+RUuj 7d9JuuGS18/OwfEubaL2X6kk1Zi5TLoLMMkIcs2CeHhCbsWM/1oOqB0Fsrw+9mEWMGF2 6epAifhL0yudV8xHFFy3stHOHWy+IxZGW5UQumxIHhZpk9Z80B+z8q2ZKiA21LwlCFLk B5+TLuAiBRJU0aXaE9eCkAnD1OJUnKAH5LAsC/eIsLkg2CDRyQSLJoOjwCnceXHCILFy RIfw== X-Gm-Message-State: ALKqPwfdcfBqGXBzKup4Qia/Af41mSj5OP9vVyyOrpRZjWbBmkn7IM4l vQYeUvUo+34po1Kdsi9HJMa5yg== X-Received: by 2002:a17:902:1004:: with SMTP id b4-v6mr18550370pla.82.1527624161997; Tue, 29 May 2018 13:02:41 -0700 (PDT) Received: from localhost ([2620:0:1000:1501:8e2d:4727:1211:622]) by smtp.gmail.com with ESMTPSA id e87-v6sm83272441pfl.65.2018.05.29.13.02.41 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 May 2018 13:02:41 -0700 (PDT) Date: Tue, 29 May 2018 13:02:40 -0700 From: Matthias Kaehlcke To: MyungJoo Ham Cc: Kyungmin Park , Chanwoo Choi , Arnd Bergmann , Greg Kroah-Hartman , Rob Herring , Mark Rutland , "linux-pm@vger.kernel.org" , "devicetree@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Brian Norris , Douglas Anderson Subject: Re: [PATCH 07/11] PM / devfreg: Add support policy notifiers Message-ID: <20180529200240.GI168650@google.com> References: <20180525203043.249193-8-mka@chromium.org> <20180525203043.249193-1-mka@chromium.org> <20180528051949epcms1p3bedd6ac3e2f20d0bcd8cb082349d97fa@epcms1p3> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20180528051949epcms1p3bedd6ac3e2f20d0bcd8cb082349d97fa@epcms1p3> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 28, 2018 at 02:19:49PM +0900, MyungJoo Ham wrote: > >Policy notifiers are called before a frequency change and may narrow > >the min/max frequency range in devfreq_policy, which is used to adjust > >the target frequency if it is beyond this range. > > > >Also add a few helpers: > > - devfreq_verify_within_[dev_]limits() > > - should be used by the notifiers for policy adjustments. > > - dev_to_devfreq() > > - lookup a devfreq strict from a device pointer > > > >Signed-off-by: Matthias Kaehlcke > >--- > > drivers/devfreq/devfreq.c | 47 +++++++++++++++++++++------- > > include/linux/devfreq.h | 66 +++++++++++++++++++++++++++++++++++++++ > > 2 files changed, 102 insertions(+), 11 deletions(-) > > Hello Matthias, > > > Why should we have yet another notifier from an instance of devfreq? > Wouldn't it better to let the current notifier (transition notifier) > handle new events as well by adding possible event states to it? Honestly the main reason is that I sought inspiration from cpufreq, which uses a dedicated policy notifier. Unfortunately this change predates the git history so I don't know what was the exact rationale to do it this way. Some minor advantages that I see are: - transition notifiers aren't bothered about adjustments and viceversa - different data types are passed for transitions and adjustments, which makes code of notifiers that handle both a bit more messy. > Anyway, is this the reason why you've separated some data of devfreq > into "policy" struct? (I was wondering why while reading commit 6/11). The DEVFREQ_ADJUST is the reason for the "policy struct". With this change we are dealing with 3 types of frequency pairs: user (df->min/max_freq), devinfo (df->scaling_min/max_freq) and the policy/adjustable ones. I think it is cleaner to group them in a struct (and sub-structs), rather than having 6 individual _min/max_freq variables. Also it allows to only pass the policy object to the notifiers, instead of the entire devfreq device. I opted to do the introduction of the struct policy in a separate NOP patch, because I think it is easier to review the 'reorg' churn and the functional change separately. Please let me know if you'd prefer to have certain things done differently. Thanks Matthias