From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 12661C32792 for ; Thu, 3 Oct 2019 19:36:44 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D919D20862 for ; Thu, 3 Oct 2019 19:36:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="IVkbHaYP"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="HiJl3vpe" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D919D20862 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=gk5X2o3J0Bb4BOpWwFY2smng99FOaCz1CQCpuTJNKdA=; b=IVkbHaYPKBAbQK +4/7WzY0D6ECKJPqAKtZTUONpBkpDQ3sO+3B9v7Dm+7M4/6uOqigYB813Gp1lylYAWPFHTYtIq+4k CJMJcA7OtKN4pCzLOWC1iI6kpz7etxcV2QkYtS5QOoJ34/EBxuPr4QVJ0im6prko96xuXwCPKtaiA 9oQMW0PEY+6fCqLuLkBuH2UdyEk9thBHb5Nw/KPBNN6iVnhrrVXgJO+NGqg5X0u6mtEStpYFyRnxl X6tpNY6yPqycxt1WCRyJGcvFWIBNkL20qtH75uz4GlTmKdw4gyyHxZdKrHpZPzihnvl5SUXjDJnEX TT1qTIccc7XOT20+Winw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.2 #3 (Red Hat Linux)) id 1iG6ty-0000yp-TT; Thu, 03 Oct 2019 19:36:38 +0000 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]) by bombadil.infradead.org with esmtps (Exim 4.92.2 #3 (Red Hat Linux)) id 1iG6tv-0000yH-V2 for linux-arm-kernel@lists.infradead.org; Thu, 03 Oct 2019 19:36:37 +0000 Received: by mail-pg1-x542.google.com with SMTP id 23so2366178pgk.3 for ; Thu, 03 Oct 2019 12:36:35 -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=ZvvRP7gkLP5an2LWz9E1ke0Xw4siIdz4im6LiZr9lFg=; b=HiJl3vpesZuqwM+SmijuoPnUumZoAv3sCg/C/WP/jkGClXCnM2cBWZovl6RscYdUa8 5+jMD7PJzdUhWqSgiRtfvuhfbzAn4ClW7xdLx0aP8J0b6h4Dz4vZ04jDjS9ZkxPoadgT T19rufMDohikjY2k/JmG11wzjEX84oHmwq18E= 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=ZvvRP7gkLP5an2LWz9E1ke0Xw4siIdz4im6LiZr9lFg=; b=plTL9gSDrsXvD0mgmn05G1BIxi/w+S+oH6GuhCYiDbsaRUIlSO5H4U7rdUs4HYllhW o0IWZWE1OZ3m+FMTIg0ZlGRJO1JHdsQPQWzxw7WrejSInCfm/+/4G6UHln72mo70gCsZ jc0kLcLP8gmREPfLDpuj8u8vlcqQMQ5dH29Z6oTn9gomL2QJHZekkHq+a9Z54yaQZBBL tTTE3p6/BDJakIfPc33q+AI+ORXLR2CHk0ejJThPmWDYcyXODBsiCU2MQFTcFMnD71HY TmhH/nlf0a+SnF5X5YVslcVn2UyRQaQWRsF1MIReXtOQzut8bMfx8vhJJotVB6K3E1o1 I9tA== X-Gm-Message-State: APjAAAX6R8mEi11JMz8iMX6ngQvmc+tWpA23/uxh3gSMli6aMoZDX7F3 Bzt9w+5YQtDiNkqhsn1yNNOaNA== X-Google-Smtp-Source: APXvYqwjpD8GhUhY20mwLWg8zPZOimPm45NzgOBknYjkymmY6DFCgmmBy/IPHPcV1VlbUvoQTZKccg== X-Received: by 2002:a17:90a:2481:: with SMTP id i1mr12562859pje.77.1570131395126; Thu, 03 Oct 2019 12:36:35 -0700 (PDT) Received: from localhost ([2620:15c:202:1:4fff:7a6b:a335:8fde]) by smtp.gmail.com with ESMTPSA id l189sm3730845pgd.46.2019.10.03.12.36.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 03 Oct 2019 12:36:34 -0700 (PDT) Date: Thu, 3 Oct 2019 12:36:32 -0700 From: Matthias Kaehlcke To: Leonard Crestez Subject: Re: [PATCH v9 6/8] PM / devfreq: Introduce get_freq_range helper Message-ID: <20191003193632.GK87296@google.com> References: <20191003181938.GJ87296@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191003_123636_024147_5DFC1951 X-CRM114-Status: GOOD ( 22.58 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Artur =?utf-8?B?xZp3aWdvxYQ=?= , Abel Vesa , Saravana Kannan , "linux-pm@vger.kernel.org" , Viresh Kumar , dl-linux-imx , Krzysztof Kozlowski , Lukasz Luba , Chanwoo Choi , Kyungmin Park , MyungJoo Ham , Alexandre Bailon , Georgi Djakov , "linux-arm-kernel@lists.infradead.org" , Jacky Bai Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Oct 03, 2019 at 07:16:03PM +0000, Leonard Crestez wrote: > On 03.10.2019 21:19, Matthias Kaehlcke wrote: > > On Wed, Oct 02, 2019 at 10:25:09PM +0300, Leonard Crestez wrote: > >> Moving handling of min/max freq to a single function and call it from > >> update_devfreq and for printing min/max freq values in sysfs. > >> > >> This changes the behavior of out-of-range min_freq/max_freq: clamping > >> is now done at evaluation time. This means that if an out-of-range > >> constraint is imposed by sysfs and it later becomes valid then it will > >> be enforced. > >> > >> Signed-off-by: Leonard Crestez > >> Reviewed-by: Matthias Kaehlcke > >> --- > >> drivers/devfreq/devfreq.c | 110 +++++++++++++++++++++----------------- > >> 1 file changed, 62 insertions(+), 48 deletions(-) > >> > >> diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c > >> index 87eff789ce24..2d63692903ff 100644 > >> --- a/drivers/devfreq/devfreq.c > >> +++ b/drivers/devfreq/devfreq.c > >> > >> ... > >> > >> static ssize_t min_freq_show(struct device *dev, struct device_attribute *attr, > >> char *buf) > >> { > >> struct devfreq *df = to_devfreq(dev); > >> + unsigned long min_freq, max_freq; > >> > >> - return sprintf(buf, "%lu\n", max(df->scaling_min_freq, df->min_freq)); > >> + mutex_lock(&df->lock); > >> + get_freq_range(df, &min_freq, &max_freq); > > > > With this min/max_freq shown aren't necessarily those set through sysfs, > > but the aggregated PM QoS values (plus OPP constraints). > > > > I did some testing with a WIP patch that converts devfreq_cooling.c to > > PM QoS. When reading sysfs min/max values to double check the limits > > set earlier I found it utterly confusing to see the sysfs min/max values > > fluctuating due to thermal throttling, and not being able to see the > > configured values. > > Isn't current devfreq_cooling based on OPP disabling which modifies > scaling_max_freq? This is not a behavior change: reading back always > showed the "effective maximum" rather than the value explicitly written > to max_freq. I stand corrected, for devfreq indeed this isn't a behavioral change, and looking at the diff would have told me. I just expected it to do the reasonable thing and what cpufreq did in the past. > This behavior is indeed confusing but can be fixed by adding two new > files: user_min/max_freq and user_max_freq. These would act like current > min/max_freq on write but on read would only show the value explicitly > configured by the user. It seems the reasonable thing to do, though it's not great to alter userspace visible behavior :( I doubt though that userspace would really depend on it, since any min/max value read might change inmediately afterwards. If there's really value in exposing the aggregate limits it would probably make sense to do this through separate attributes. Let's see what devfreq maintainers think. In any case the patch should be fine as is, since it doesn't introduce the (IMO) odd behavior. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel