Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp7781870imu; Tue, 22 Jan 2019 11:31:54 -0800 (PST) X-Google-Smtp-Source: ALg8bN6pW3Mwk7N6WNyXjeA6fBForiApLwmSvTXPZJqshGzikWQ8ln5NeqsN1JlcBcjUqC281k2Z X-Received: by 2002:a17:902:112c:: with SMTP id d41mr30716096pla.144.1548185513972; Tue, 22 Jan 2019 11:31:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548185513; cv=none; d=google.com; s=arc-20160816; b=PHiG41AxJZ7JK8i81YvuWvLqQmXSd/esTIjT5T0DeBichMs2Si7WWGcqh9Bw7HSEm5 zIyOS+8akVDccry0yPr9BjywJU9ztfATjf0BynWg24ezpv0gVt97dCUYXDbTUtWC8g2m P3miUIuIuqphC6SZ6/d0ClgmUa1I/WH8i19E5CtDyCZRdhx0Nry1S30pR3sRbi7juipi FSRsuisgfrv3OPNInSeR4f5/XsQFCLkcMOmgMt9cdAUwaF79/lgiE8/PBOjWONprTJv5 9OoRBETkqi+azU8EIuKusTRHBtw5rjKKQvMZ+aF5HQ+UmYdJMtGrlC0WXrTOnTISHest dKRQ== 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; bh=0svbN6i4itkKxNAdYGiwewg99TGL10PzPycLA5Tqml0=; b=E0yVgs3hjUdRvWHYh0tgGFOTqZDE9Rtqay4Iwci5bDJ88g09KSchyVeWv6XkQSh1jK 4yUFbxnRr9iNweqTJ+zOw4ZL7K/PQItYpRyVFQGEHpDLiGAwj2rEx04Pcg4tPkB/lA1r yDse2mtl34xYIM5aJVa4xIM/LK2PCDapdj0eMc7cp9gGRO6TVUeAtoD/r5anq3wFLpb7 fnjxWBQ4vZhFX4QDNqXsdNdSc2lYsJSlK6AwDu7QKnvA3eFazx7jnJtaqOAw9me8DyYa b2GN9OjqeCElJDmBQlmb7a7/BgHF8XdkAJFNzr8mO0EwU+sIk4Cv0B/bRvSAayS5TZ0I dy0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=kliy7H1d; 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 g15si15229223pgl.141.2019.01.22.11.31.38; Tue, 22 Jan 2019 11:31:53 -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=kliy7H1d; 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 S1726291AbfAVTaY (ORCPT + 99 others); Tue, 22 Jan 2019 14:30:24 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:43710 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725925AbfAVTaX (ORCPT ); Tue, 22 Jan 2019 14:30:23 -0500 Received: by mail-pf1-f193.google.com with SMTP id w73so12238728pfk.10 for ; Tue, 22 Jan 2019 11:30:23 -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:in-reply-to:user-agent; bh=0svbN6i4itkKxNAdYGiwewg99TGL10PzPycLA5Tqml0=; b=kliy7H1dEdIGi4NgewX6L2KDp9EZdWGGzwN46i4wtvH7/AUci6vuKXYTw06vXlRUOy htnhEOsPLuDSaztzLQiHiZgWN8MB57wySfDSRT9nghwabyjnfjZ/3jUyQ6wMfs9AWei/ jWoiaUx99vrD3CGC57YHBnYblizEFS0LeVXMk= 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=0svbN6i4itkKxNAdYGiwewg99TGL10PzPycLA5Tqml0=; b=X+jxwWWSGStZMTpkbvER/DvUsQ/8GHkxeJhMhgnnwufK1B4QyHAWV9P4c9WPfp1Ovn esP4oMhfzQ3vXEFh56tGGH03Iq8k/vMarLuGHY9n/9FZ2372MCl2bbYOz6oRvTRvL2SY sCaJJ1vGzM38HN7ZjQLhSVSY+Lp04o0j6R4B5gOS8ly87f+IFygzwXpOIIfhRJu/C+au SUhNEgF5uzjw58OlXF1NOFfUXgz2+8gZHgXJB6L5kTYpF8tSU1GLphcqHDuoCP7mn4n9 u1489LLaxtuo78oe0fHY1xF+EYX8zhNJa9/nBGUv6J/rJRHJTPeg6CWtj0s3spPzcjlY 1+nQ== X-Gm-Message-State: AJcUukdTVJvKOLeUiVv4InMtp5mFF03Fw30qPvVJoyZTNjS8dF9MbaP9 5agxi1wbQvBgGf4nOBUtIqIYQA== X-Received: by 2002:a62:a510:: with SMTP id v16mr34480832pfm.18.1548185422745; Tue, 22 Jan 2019 11:30:22 -0800 (PST) Received: from localhost ([2620:15c:202:1:75a:3f6e:21d:9374]) by smtp.gmail.com with ESMTPSA id d6sm27033224pgc.89.2019.01.22.11.30.21 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 22 Jan 2019 11:30:22 -0800 (PST) Date: Tue, 22 Jan 2019 11:30:21 -0800 From: Matthias Kaehlcke To: "Rafael J. Wysocki" Cc: Juri Lelli , Viresh Kumar , Rafael Wysocki , Greg Kroah-Hartman , Viresh Kumar , Linux PM , Vincent Guittot , Linux Kernel Mailing List Subject: Re: [PATCH 0/3] drivers: Frequency constraint infrastructure Message-ID: <20190122193021.GG261387@google.com> References: <20190117131631.GA14385@localhost.localdomain> <20190118123900.GJ14385@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline 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 On Mon, Jan 21, 2019 at 12:10:55PM +0100, Rafael J. Wysocki wrote: > On Fri, Jan 18, 2019 at 1:39 PM Juri Lelli wrote: > > > > On 17/01/19 15:55, Rafael J. Wysocki wrote: > > > On Thu, Jan 17, 2019 at 2:16 PM Juri Lelli wrote: > > > > > > > > On 11/01/19 10:47, Rafael J. Wysocki wrote: > > > > > On Fri, Jan 11, 2019 at 10:18 AM Viresh Kumar wrote: > > > > > > > > > > > > Hi, > > > > > > > > > > > > This commit introduces the frequency constraint infrastructure, which > > > > > > provides a generic interface for parts of the kernel to constraint the > > > > > > working frequency range of a device. > > > > > > > > > > > > The primary users of this are the cpufreq and devfreq frameworks. The > > > > > > cpufreq framework already implements such constraints with help of > > > > > > notifier chains (for thermal and other constraints) and some local code > > > > > > (for user-space constraints). The devfreq framework developers have also > > > > > > shown interest [1] in such a framework, which may use it at a later > > > > > > point of time. > > > > > > > > > > > > The idea here is to provide a generic interface and get rid of the > > > > > > notifier based mechanism. > > > > > > > > > > > > Only one constraint is added for now for the cpufreq framework and the > > > > > > rest will follow after this stuff is merged. > > > > > > > > > > > > Matthias Kaehlcke was involved in the preparation of the first draft of > > > > > > this work and so I have added him as Co-author to the first patch. > > > > > > Thanks Matthias. > > > > > > > > > > > > FWIW, This doesn't have anything to do with the boot-constraints > > > > > > framework [2] I was trying to upstream earlier :) > > > > > > > > > > This is quite a bit of code to review, so it will take some time. > > > > > > > > > > One immediate observation is that it seems to do quite a bit of what > > > > > is done in the PM QoS framework, so maybe there is an opportunity for > > > > > some consolidation in there. > > > > > > > > Right, had the same impression. :-) > > > > > > > > I was also wondering how this new framework is dealing with > > > > constraints/request imposed/generated by the scheduler and related > > > > interfaces (thinking about schedutil and Patrick's util_clamp). > > > > > > My understanding is that it is orthogonal to them, like adding extra > > > constraints on top of them etc. > > > > Mmm, ok. But, if that is indeed the case, I now wonder why and how > > existing (or hopefully to be added soon) interfaces are not sufficient. > > I'm not against this proposal, just trying to understand if this might > > create unwanted, hard to manage, overlap. > > That is a valid concern IMO. Especially the utilization clamping and > the interconnect framework seem to approach the same problem space > from different directions. > > For cpufreq this work can be regarded as a replacement for notifiers > which are a bandaid of sorts and it would be good to get rid of them. > They are mostly used for thermal management and I guess that devfreq > users also may want to reduce frequency for thermal reasons and I'd > rather not add notifiers to that framework for this purpose. FYI: devfreq already reduces frequency for thermal reasons, however they don't use notifiers, but directly disable OPPs in the cooling driver: https://elixir.bootlin.com/linux/v4.20.3/source/drivers/thermal/devfreq_cooling.c#L78 The idea to have a frequency constraint framework came up in the context of the throttler series (https://lore.kernel.org/patchwork/project/lkml/list/?series=357937) for non-thermal throttling. My initial approach was to copy the notifier bandaid ... > However, as stated previously, this resembles the PM QoS framework > quite a bit to me and whatever thermal entity, say, sets these > constraints, it should not work against schedutil and similar. In > some situations setting a max frequency limit to control thermals is > not the most efficient way to go as it effectively turns into > throttling and makes performance go south. For example, it may cause > things to run at the limit frequency all the time which may be too > slow and it may be more efficient to allow higher frequencies to be > used, but instead control how much of the time they can be used. So > we need to be careful here.