Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6105112imu; Mon, 21 Jan 2019 03:19:23 -0800 (PST) X-Google-Smtp-Source: ALg8bN7lWgID5IqaR4e3mzF3/ZF8MRCtRzLh9bThuWUWSSMJ8VgwV6paE9FoMj+UNtvo+LicCx3J X-Received: by 2002:a63:f811:: with SMTP id n17mr28453758pgh.23.1548069562983; Mon, 21 Jan 2019 03:19:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548069562; cv=none; d=google.com; s=arc-20160816; b=Z9xZaFB8MtOXB9pHQD8Ub6eLEXWFjzKDNFG+y+5UZGlg+73zRwhRkZa9+ttx39s25b 0xu3i3B/5QLuER1LCB2Jon/Oq1bgxkOKYdf6eoFrHH0NgpS3kT4XlKR/F0NhQu6ggHR5 jZgbBRYQrDE/NgtGHPL2WHAYyeFKj6ufdHhSXlHjYTg2VqNmCx6KykPtPM5N73WYAe4f HK0EgLTUiLNvi6jc34p2wRY4VYK3l1+ch1VXFZaQtwPP2cPlrwEKlG1utl+R3Rflfam1 BNASZJbtTcSClnxTKhoCZOjjV/X77saVZOIc44s0XHwMwf9MUtkMg3Vw1Xf2DmiQBmgD 01Vg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=UgkXNJd0C0ZM9MvUZG64DZtph2N/0Vkjw1NOHgSchfg=; b=inaf9y8iEo+/jGmF0WrnEyxdimgFkyJ1qdPJedV1qml7GAGvqN0uk1IAtfvagT7C2W qk2ebQuZMW7AtLXjLfMjn+VRla2roJIf0vaBjj0bVYpBfTaEKKVIRgFuAqVlPXf0urDi YgzrF+g3myJnIX1cY5PCXLtANgG/WcYhpQiuJk9/87Clf4YZBEKV0bZfwf+8aIovVTHc pzpTyC7wz8IMwIsZqhQpiu97YJzFEM7GrEYE3LgQW4TNcv8mqsHXgESVo2NexOAq7iOa KQmUklGKAwEp13BQkrC1XGoOuLzLiJasfnWcY/YAdySSeG2S/yQozMtTIKLKaaiilZem AxDw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g11si12900241pgu.347.2019.01.21.03.19.07; Mon, 21 Jan 2019 03:19:22 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727795AbfAULLI (ORCPT + 99 others); Mon, 21 Jan 2019 06:11:08 -0500 Received: from mail-oi1-f194.google.com ([209.85.167.194]:44304 "EHLO mail-oi1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727152AbfAULLH (ORCPT ); Mon, 21 Jan 2019 06:11:07 -0500 Received: by mail-oi1-f194.google.com with SMTP id m6so14199488oig.11; Mon, 21 Jan 2019 03:11:07 -0800 (PST) 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; bh=UgkXNJd0C0ZM9MvUZG64DZtph2N/0Vkjw1NOHgSchfg=; b=eN3xGo82zsN3O4NqYdvRWxItEuElTQh0gr//VI0bUf+qKWKd5d3XPnxPpQFfVG2/4G OnceXdpgbabPUb0vxapSWyn1L8zw17+GVr8SeYUUxKRxTS0+vj82q/z0GrIQ024xG27q fDM+wu+2nYCmAtwCsP2URwKf1zEpHJmQTAmMH4bvQ4Jd4zIMXMXkaTz2kp5RbWPa5d+Q s/+6jRVefqTSA4yXppIGFQJSpPx7IFhiV7ZaFZQtHqNmjp2ij3KYug+jQxrQPbze24Kk ppy7TD/5KT3DQyg/XG1wW2CoIDIJQrCKyWp9zzUeg3V1zxwwqVjTkxV6JQX2pLZsK9sY tEDQ== X-Gm-Message-State: AJcUukeJ8nut7Vp6Eb4lC00g2eZJvZSMSReaShtRwBdtZwzthJ+Xg8GF KxR24QjpUCWfuycET9Jzz6VlvekDrba1iUnplb8= X-Received: by 2002:aca:368a:: with SMTP id d132mr5591473oia.193.1548069066819; Mon, 21 Jan 2019 03:11:06 -0800 (PST) MIME-Version: 1.0 References: <20190117131631.GA14385@localhost.localdomain> <20190118123900.GJ14385@localhost.localdomain> In-Reply-To: <20190118123900.GJ14385@localhost.localdomain> From: "Rafael J. Wysocki" Date: Mon, 21 Jan 2019 12:10:55 +0100 Message-ID: Subject: Re: [PATCH 0/3] drivers: Frequency constraint infrastructure To: Juri Lelli Cc: "Rafael J. Wysocki" , Viresh Kumar , Rafael Wysocki , Greg Kroah-Hartman , Viresh Kumar , Linux PM , Vincent Guittot , Matthias Kaehlcke , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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.