From patchwork Thu Jun 20 07:35:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 167297 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp1725164ilk; Thu, 20 Jun 2019 00:35:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqxHQ87eHRhFWwfACGxGvISXHLhuO4CQ0YL1NvL3lsKz+kC2+P8G11slttMbSBxwGSyonNbs X-Received: by 2002:a17:902:f216:: with SMTP id gn22mr104909015plb.118.1561016147358; Thu, 20 Jun 2019 00:35:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561016147; cv=none; d=google.com; s=arc-20160816; b=z21g6B9Q4KZaVrh/+ZEVknRgKN3NmJGRMAKElo3F6EwN4lH7q3seGW0Mmwh7ntDhga jQiwa32KTdHHDx0KUVG9fd82ju3JQr2hE+OHq012CgJNNMnBKlg1f5pcsOJaBE6KeODJ UP7gameY6xGTAtMbkJODYQzGF9WoAVr6EN+i666IaU3D1mVvdABOnSYyIoZ8yTKVs+uw dNefHzNidEaZ6ujvsHAV1V3z0d3ikVmKRJHY+ShZER4adZmGB8Tb0gJFg4bz5AUp3+BW HMpyf5TplKA/PBqbu8pKUSd9IhKvYuxHkLbxLZ0QBEOEBkW+aR9AcDdFM3wRj22j4pLS NW9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=+ZHoXqHDnWQNNxjeBIgVIp/1BFcAyIjpzOAOe/B47LU=; b=PNmkzBNzy+6JAsfgsCOsuZP3sk/xe6Oh9kIBk9q7S4AvsffvZGXz8qX67M+Xe3da5G ylNswQVM5Eue9ufMCbCcqOVfQql9a1jg7dC2QJuzz0ZVo0xM3R1js+LE5H522LpdyXXR dikmF+dyIzxsfRfYCGx0XmGJWjFumXHiTubMVzh3Pv5S545DNw8pJGhBScAf+Po3epyL xdg7DZUvFmt2NKrvZQ25eY3C1BR1UEFRfHmGztIIhzXNQIUBXOKyO0wnXKLj2AAZe3Nj Mg65idxjt88+LQJX19SqiRSMD0KIs4nDRBsymEWbM2N+LRQgW4VPkatV/ZhYNVYtyLCK lVpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cD8fnPFb; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x4si600857pjn.93.2019.06.20.00.35.46; Thu, 20 Jun 2019 00:35:47 -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=@linaro.org header.s=google header.b=cD8fnPFb; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727244AbfFTHfp (ORCPT + 30 others); Thu, 20 Jun 2019 03:35:45 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:42526 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725872AbfFTHfp (ORCPT ); Thu, 20 Jun 2019 03:35:45 -0400 Received: by mail-pf1-f194.google.com with SMTP id q10so1157258pff.9 for ; Thu, 20 Jun 2019 00:35:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+ZHoXqHDnWQNNxjeBIgVIp/1BFcAyIjpzOAOe/B47LU=; b=cD8fnPFbjnlUcmEq/d+FBOHDffPKPfMy/d2kvSq77Vua582eT8LCrDSAp9hlwJR4AZ zxa/VGNkp8W6/Fv0ozb6t67/DDp9dxYR6iKdRYrPBXk6XEXrsjIHRiLR9Qm89e5xCwyC rBWVsWZa6QIkZI9Y3wbB8eTA0L/6ae9JTUvD0z0ZITIoGdFrarDXGlifMpUloS++VWUA 8WLizucE8MFI11UUaA4AQSxQY8oVCqzjpEXLQ9bva2fz68lsZlySzdiORYrTa8jHtGmr atfb4z2VakxSUBV7ui7f7s/yVx0gHQDc00Q2i2PivUwJd+63wd+lnSaHsI9oMYVkY4pe br3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+ZHoXqHDnWQNNxjeBIgVIp/1BFcAyIjpzOAOe/B47LU=; b=pPVLWFhl5jxNqwg9+oGu1kLh1W7DErHIN+36X1746HY/NYympHZZ8JybrCWyTLd9uI FvgzuViqidkzoYtKOmzgP26ILljv5y7Ff/lPD+uwGG7G/XCSf3Kk/+Jb+TOBzqdXlM4e 7Cob74SoBKmM/qDnccYEHCI0AkNh7PBDRQCcGcdpFs7EtR9q1jDU36T5+4ltwD15cdnA yUKq3ffsGEHpx3VFUEJ6qpbT7U1QJ4Gp+aRrOQJhEvwJ4S0WKxOpMyHww7KfgjVrZZ26 FgmKwvtF6WgY6bwd4Ihh18RnX2c/gSWuJZ61Pfo62QuNuYH0WF0lkQD+H8RTPJA4TPuk vviQ== X-Gm-Message-State: APjAAAVCFYLN6xkDZ5+ERVnZwOMrCd5WttspaEch6XQRP2jme205Xuk9 fdIsYinozCE47Bq8ZRHGOWBw+w== X-Received: by 2002:a63:8ac3:: with SMTP id y186mr5976672pgd.198.1561016144144; Thu, 20 Jun 2019 00:35:44 -0700 (PDT) Received: from localhost ([122.172.66.84]) by smtp.gmail.com with ESMTPSA id c129sm23187235pfa.106.2019.06.20.00.35.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Jun 2019 00:35:43 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Len Brown , Pavel Machek , Kevin Hilman , Ulf Hansson Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , Qais.Yousef@arm.com, mka@chromium.org, juri.lelli@gmail.com, linux-kernel@vger.kernel.org Subject: [PATCH V4 1/6] PM / QOS: Pass request type to dev_pm_qos_{add|remove}_notifier() Date: Thu, 20 Jun 2019 13:05:24 +0530 Message-Id: <9c6f189e4853b332ac3e28d40d7ef6e310501e9e.1561014965.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.21.0.rc0.269.g1a574e7a288b In-Reply-To: References: MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In order to use the same set of routines to register notifiers for different request types, update the existing dev_pm_qos_{add|remove}_notifier() routines with an additional parameter: request-type. For now, it only supports resume-latency request type but will be extended to frequency limit (min/max) constraints later on. Reviewed-by: Matthias Kaehlcke Reviewed-by: Ulf Hansson Signed-off-by: Viresh Kumar --- Documentation/power/pm_qos_interface.txt | 10 ++++++---- drivers/base/power/domain.c | 8 +++++--- drivers/base/power/qos.c | 14 ++++++++++++-- include/linux/pm_qos.h | 12 ++++++++---- 4 files changed, 31 insertions(+), 13 deletions(-) -- 2.21.0.rc0.269.g1a574e7a288b diff --git a/Documentation/power/pm_qos_interface.txt b/Documentation/power/pm_qos_interface.txt index 19c5f7b1a7ba..ec7d662d1707 100644 --- a/Documentation/power/pm_qos_interface.txt +++ b/Documentation/power/pm_qos_interface.txt @@ -164,12 +164,14 @@ directory. Notification mechanisms: The per-device PM QoS framework has a per-device notification tree. -int dev_pm_qos_add_notifier(device, notifier): -Adds a notification callback function for the device. +int dev_pm_qos_add_notifier(device, notifier, type): +Adds a notification callback function for the device for a particular request +type. + The callback is called when the aggregated value of the device constraints list -is changed (for resume latency device PM QoS only). +is changed. -int dev_pm_qos_remove_notifier(device, notifier): +int dev_pm_qos_remove_notifier(device, notifier, type): Removes the notification callback function for the device. diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 33c30c1e6a30..b063bc41b0a9 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -1536,7 +1536,8 @@ static int genpd_add_device(struct generic_pm_domain *genpd, struct device *dev, if (ret) genpd_free_dev_data(dev, gpd_data); else - dev_pm_qos_add_notifier(dev, &gpd_data->nb); + dev_pm_qos_add_notifier(dev, &gpd_data->nb, + DEV_PM_QOS_RESUME_LATENCY); return ret; } @@ -1569,7 +1570,8 @@ static int genpd_remove_device(struct generic_pm_domain *genpd, pdd = dev->power.subsys_data->domain_data; gpd_data = to_gpd_data(pdd); - dev_pm_qos_remove_notifier(dev, &gpd_data->nb); + dev_pm_qos_remove_notifier(dev, &gpd_data->nb, + DEV_PM_QOS_RESUME_LATENCY); genpd_lock(genpd); @@ -1597,7 +1599,7 @@ static int genpd_remove_device(struct generic_pm_domain *genpd, out: genpd_unlock(genpd); - dev_pm_qos_add_notifier(dev, &gpd_data->nb); + dev_pm_qos_add_notifier(dev, &gpd_data->nb, DEV_PM_QOS_RESUME_LATENCY); return ret; } diff --git a/drivers/base/power/qos.c b/drivers/base/power/qos.c index 6c91f8df1d59..cfd463212513 100644 --- a/drivers/base/power/qos.c +++ b/drivers/base/power/qos.c @@ -467,6 +467,7 @@ EXPORT_SYMBOL_GPL(dev_pm_qos_remove_request); * * @dev: target device for the constraint * @notifier: notifier block managed by caller. + * @type: request type. * * Will register the notifier into a notification chain that gets called * upon changes to the target value for the device. @@ -474,10 +475,14 @@ EXPORT_SYMBOL_GPL(dev_pm_qos_remove_request); * If the device's constraints object doesn't exist when this routine is called, * it will be created (or error code will be returned if that fails). */ -int dev_pm_qos_add_notifier(struct device *dev, struct notifier_block *notifier) +int dev_pm_qos_add_notifier(struct device *dev, struct notifier_block *notifier, + enum dev_pm_qos_req_type type) { int ret = 0; + if (WARN_ON(type != DEV_PM_QOS_RESUME_LATENCY)) + return -EINVAL; + mutex_lock(&dev_pm_qos_mtx); if (IS_ERR(dev->power.qos)) @@ -500,15 +505,20 @@ EXPORT_SYMBOL_GPL(dev_pm_qos_add_notifier); * * @dev: target device for the constraint * @notifier: notifier block to be removed. + * @type: request type. * * Will remove the notifier from the notification chain that gets called * upon changes to the target value. */ int dev_pm_qos_remove_notifier(struct device *dev, - struct notifier_block *notifier) + struct notifier_block *notifier, + enum dev_pm_qos_req_type type) { int retval = 0; + if (WARN_ON(type != DEV_PM_QOS_RESUME_LATENCY)) + return -EINVAL; + mutex_lock(&dev_pm_qos_mtx); /* Silently return if the constraints object is not present. */ diff --git a/include/linux/pm_qos.h b/include/linux/pm_qos.h index 6ea1ae373d77..1f4d456e8fff 100644 --- a/include/linux/pm_qos.h +++ b/include/linux/pm_qos.h @@ -146,9 +146,11 @@ int dev_pm_qos_add_request(struct device *dev, struct dev_pm_qos_request *req, int dev_pm_qos_update_request(struct dev_pm_qos_request *req, s32 new_value); int dev_pm_qos_remove_request(struct dev_pm_qos_request *req); int dev_pm_qos_add_notifier(struct device *dev, - struct notifier_block *notifier); + struct notifier_block *notifier, + enum dev_pm_qos_req_type type); int dev_pm_qos_remove_notifier(struct device *dev, - struct notifier_block *notifier); + struct notifier_block *notifier, + enum dev_pm_qos_req_type type); void dev_pm_qos_constraints_init(struct device *dev); void dev_pm_qos_constraints_destroy(struct device *dev); int dev_pm_qos_add_ancestor_request(struct device *dev, @@ -202,10 +204,12 @@ static inline int dev_pm_qos_update_request(struct dev_pm_qos_request *req, static inline int dev_pm_qos_remove_request(struct dev_pm_qos_request *req) { return 0; } static inline int dev_pm_qos_add_notifier(struct device *dev, - struct notifier_block *notifier) + struct notifier_block *notifier, + enum dev_pm_qos_req_type type); { return 0; } static inline int dev_pm_qos_remove_notifier(struct device *dev, - struct notifier_block *notifier) + struct notifier_block *notifier, + enum dev_pm_qos_req_type type) { return 0; } static inline void dev_pm_qos_constraints_init(struct device *dev) { From patchwork Thu Jun 20 07:35:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 167298 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp1725209ilk; Thu, 20 Jun 2019 00:35:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqyRZ04QfpvNNI/wwI5ASZVLkmN1cG57S9OatQPdBmOBAtHAWHHrtYZ5yZT3x0TYnReHqkd5 X-Received: by 2002:a63:2a0f:: with SMTP id q15mr11902965pgq.163.1561016150595; Thu, 20 Jun 2019 00:35:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561016150; cv=none; d=google.com; s=arc-20160816; b=MraxiAFXgssQdxjXkHXMusVBZjjurFYKUmRDg1lXARVLIXJEkt1vsu9m6vYwbaGut0 HZRj/9MSaAj/Hqu1guRfm1bVHAc4wzxSmgxFyU5e2+jYTb7JtSs2658w2h9XMib30G6R nSm67yZmH7dtm3Cu3EU+2cOtn1XbCSC05fkxaumbTm5nrqB5NFbIJCwHEbOKkieAlRl4 WrByqqpUngtgmosgPIykoOjZz/4WlVfclXnLaxLz21/wktuyygdaO7CLdNZJ2QKGHStl xhM6/8PustV67WXWV1ExmsTZ1ETmNLE0CfHZ2pZ+xRg3d9sy7ufcDBssfo058omkymbF uTMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=PlxocW5hWVYXfPkN8RZ8vxi1sxzrmOenQcvIcTZd5kM=; b=q7RuMgrvh/dqQeINe5pcGiq6cRvtcof0K2SkMWTvMMCyQlf7hQIjceJjy6ynVx9Yzn avMWPJlplsrHWFgJT1zpHHwzjPVwlP70qDzZ78Cdvc0WK2ZWrtW+S7s+pbfPJ/Hhr0hg ebjcnqhwYxy/OPpzxV25uaGZbQwaqh5RTxn4Uge+3nsRS10SBCfNqvPqE4xr4jg6WHlQ ko2WykIBg8TUXPQGssRIpOe6PBiR4tdil0HA5b9XB9nm5zMPh+ZEznaPgC8peJBu0HlZ bcY7wNYtN7lNpkt0yhFam2VF+CKnWY8rhqaQzP7R6EK8oiPvSz0nh1zb5hbLO7fVfbkU st9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=neDtkbnB; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x2si3487586pjp.105.2019.06.20.00.35.50; Thu, 20 Jun 2019 00:35:50 -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=@linaro.org header.s=google header.b=neDtkbnB; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730533AbfFTHfs (ORCPT + 30 others); Thu, 20 Jun 2019 03:35:48 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:35195 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725872AbfFTHfs (ORCPT ); Thu, 20 Jun 2019 03:35:48 -0400 Received: by mail-pl1-f194.google.com with SMTP id p1so1042977plo.2 for ; Thu, 20 Jun 2019 00:35:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=PlxocW5hWVYXfPkN8RZ8vxi1sxzrmOenQcvIcTZd5kM=; b=neDtkbnB32fNUiWRtuM8IA9wvANTqdn4GCX0BHaSi+sZp9pJZWz/+yK7URvT057gpm mOAiBkCY6b10Dx1M2aVrWFGT6vV1dxhR68qH/LnfIQ2WPEKkdHHWXOap0WA58bsC7jSY KQkbIe6ps7Q35RT0ophUMWBQy3N+2HWmgvFDiSvceXN1/NBol+47TtuDZe+mFyYCdoW6 UA65wyMnKnZTheqEexkIEmd9m8cTGMdhm6TA9ojLwZvKPmPLH9SG8kOHGG3IzIVHIg5d y6iVMu1LqXFH9srEDq/cEBy7ssJot4+oVARC+N6rZGVBXlKdu6gO1axEQLhxX9KMUYfC FkVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=PlxocW5hWVYXfPkN8RZ8vxi1sxzrmOenQcvIcTZd5kM=; b=T0kZL0pXE4bjPBP5+m1p2G4mRkZe09RYDaUtR7mF/Rq/9JZ/u4SRgJvctexb3/X8wx I6pclufquPvcrh6lroCsUBnCKAeJyNjS7FsggAd0gTZNNQH3gCRhQdJNXqVuf2AyFi4T DTLDN0vUCA5o6TsBfAWwVNpDDnfMHjxXb70zYMFVBlPzJm3teGQqPhO6hmcW+bw6DefC EMXPXVmRY7LdwDYn3wiJa7Rx2N4D4wREJJ6QWgJ+Qq2qERj3at1VFGPlj3igOgdOampT 2XUWvCbm9qlVeUxcmG0MThSvtnsgxZ4E6a808hsdYgAfZfrMTmXJDpW0+9MZNUM6meSX 4TgA== X-Gm-Message-State: APjAAAUngNTlsEDs8EI5yWo8LDlSVAQ/X8CetpvJ5ODK5mAyxv8gGWud An9WbnUwhbTTHRJxispvanmygg== X-Received: by 2002:a17:902:e65:: with SMTP id 92mr117937368plw.13.1561016147164; Thu, 20 Jun 2019 00:35:47 -0700 (PDT) Received: from localhost ([122.172.66.84]) by smtp.gmail.com with ESMTPSA id s24sm20879349pfh.133.2019.06.20.00.35.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Jun 2019 00:35:46 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Kevin Hilman , Ulf Hansson , Pavel Machek , Len Brown , Daniel Lezcano Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , Qais.Yousef@arm.com, mka@chromium.org, juri.lelli@gmail.com, linux-kernel@vger.kernel.org Subject: [PATCH V4 2/6] PM / QOS: Rename __dev_pm_qos_read_value() and dev_pm_qos_raw_read_value() Date: Thu, 20 Jun 2019 13:05:25 +0530 Message-Id: <4597b5639f58b8a55f97241abcbdd49f9dea34e8.1561014965.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.21.0.rc0.269.g1a574e7a288b In-Reply-To: References: MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org dev_pm_qos_read_value() will soon need to support more constraint types (min/max frequency) and will have another argument to it, i.e. type of the constraint. While that is fine for the existing users of dev_pm_qos_read_value(), but not that optimal for the callers of __dev_pm_qos_read_value() and dev_pm_qos_raw_read_value() as all the callers of these two routines are only looking for resume latency constraint. Lets make these two routines care only about the resume latency constraint and rename them to __dev_pm_qos_resume_latency() and dev_pm_qos_raw_resume_latency(). Suggested-by: Rafael J. Wysocki Signed-off-by: Viresh Kumar --- drivers/base/power/domain_governor.c | 2 +- drivers/base/power/qos.c | 13 +++++++++---- drivers/base/power/runtime.c | 2 +- drivers/cpuidle/governor.c | 2 +- include/linux/pm_qos.h | 8 ++++---- 5 files changed, 16 insertions(+), 11 deletions(-) -- 2.21.0.rc0.269.g1a574e7a288b diff --git a/drivers/base/power/domain_governor.c b/drivers/base/power/domain_governor.c index 3838045c9277..20e56a5be01f 100644 --- a/drivers/base/power/domain_governor.c +++ b/drivers/base/power/domain_governor.c @@ -66,7 +66,7 @@ static bool default_suspend_ok(struct device *dev) td->constraint_changed = false; td->cached_suspend_ok = false; td->effective_constraint_ns = 0; - constraint_ns = __dev_pm_qos_read_value(dev); + constraint_ns = __dev_pm_qos_resume_latency(dev); spin_unlock_irqrestore(&dev->power.lock, flags); diff --git a/drivers/base/power/qos.c b/drivers/base/power/qos.c index cfd463212513..7a0d197f0809 100644 --- a/drivers/base/power/qos.c +++ b/drivers/base/power/qos.c @@ -90,16 +90,16 @@ enum pm_qos_flags_status dev_pm_qos_flags(struct device *dev, s32 mask) EXPORT_SYMBOL_GPL(dev_pm_qos_flags); /** - * __dev_pm_qos_read_value - Get PM QoS constraint for a given device. + * __dev_pm_qos_resume_latency - Get resume latency constraint for a given device. * @dev: Device to get the PM QoS constraint value for. * * This routine must be called with dev->power.lock held. */ -s32 __dev_pm_qos_read_value(struct device *dev) +s32 __dev_pm_qos_resume_latency(struct device *dev) { lockdep_assert_held(&dev->power.lock); - return dev_pm_qos_raw_read_value(dev); + return dev_pm_qos_raw_resume_latency(dev); } /** @@ -112,7 +112,12 @@ s32 dev_pm_qos_read_value(struct device *dev) s32 ret; spin_lock_irqsave(&dev->power.lock, flags); - ret = __dev_pm_qos_read_value(dev); + + if (IS_ERR_OR_NULL(dev->power.qos)) + ret = PM_QOS_RESUME_LATENCY_NO_CONSTRAINT; + else + ret = pm_qos_read_value(&dev->power.qos->resume_latency); + spin_unlock_irqrestore(&dev->power.lock, flags); return ret; diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c index 952a1e7057c7..b75335508d2c 100644 --- a/drivers/base/power/runtime.c +++ b/drivers/base/power/runtime.c @@ -275,7 +275,7 @@ static int rpm_check_suspend_allowed(struct device *dev) || (dev->power.request_pending && dev->power.request == RPM_REQ_RESUME)) retval = -EAGAIN; - else if (__dev_pm_qos_read_value(dev) == 0) + else if (__dev_pm_qos_resume_latency(dev) == 0) retval = -EPERM; else if (dev->power.runtime_status == RPM_SUSPENDED) retval = 1; diff --git a/drivers/cpuidle/governor.c b/drivers/cpuidle/governor.c index 9fddf828a76f..2e3e14192bee 100644 --- a/drivers/cpuidle/governor.c +++ b/drivers/cpuidle/governor.c @@ -110,7 +110,7 @@ int cpuidle_governor_latency_req(unsigned int cpu) { int global_req = pm_qos_request(PM_QOS_CPU_DMA_LATENCY); struct device *device = get_cpu_device(cpu); - int device_req = dev_pm_qos_raw_read_value(device); + int device_req = dev_pm_qos_raw_resume_latency(device); return device_req < global_req ? device_req : global_req; } diff --git a/include/linux/pm_qos.h b/include/linux/pm_qos.h index 1f4d456e8fff..06aa88496761 100644 --- a/include/linux/pm_qos.h +++ b/include/linux/pm_qos.h @@ -139,7 +139,7 @@ s32 pm_qos_read_value(struct pm_qos_constraints *c); #ifdef CONFIG_PM enum pm_qos_flags_status __dev_pm_qos_flags(struct device *dev, s32 mask); enum pm_qos_flags_status dev_pm_qos_flags(struct device *dev, s32 mask); -s32 __dev_pm_qos_read_value(struct device *dev); +s32 __dev_pm_qos_resume_latency(struct device *dev); s32 dev_pm_qos_read_value(struct device *dev); int dev_pm_qos_add_request(struct device *dev, struct dev_pm_qos_request *req, enum dev_pm_qos_req_type type, s32 value); @@ -176,7 +176,7 @@ static inline s32 dev_pm_qos_requested_flags(struct device *dev) return dev->power.qos->flags_req->data.flr.flags; } -static inline s32 dev_pm_qos_raw_read_value(struct device *dev) +static inline s32 dev_pm_qos_raw_resume_latency(struct device *dev) { return IS_ERR_OR_NULL(dev->power.qos) ? PM_QOS_RESUME_LATENCY_NO_CONSTRAINT : @@ -189,7 +189,7 @@ static inline enum pm_qos_flags_status __dev_pm_qos_flags(struct device *dev, static inline enum pm_qos_flags_status dev_pm_qos_flags(struct device *dev, s32 mask) { return PM_QOS_FLAGS_UNDEFINED; } -static inline s32 __dev_pm_qos_read_value(struct device *dev) +static inline s32 __dev_pm_qos_resume_latency(struct device *dev) { return PM_QOS_RESUME_LATENCY_NO_CONSTRAINT; } static inline s32 dev_pm_qos_read_value(struct device *dev) { return PM_QOS_RESUME_LATENCY_NO_CONSTRAINT; } @@ -245,7 +245,7 @@ static inline s32 dev_pm_qos_requested_resume_latency(struct device *dev) return PM_QOS_RESUME_LATENCY_NO_CONSTRAINT; } static inline s32 dev_pm_qos_requested_flags(struct device *dev) { return 0; } -static inline s32 dev_pm_qos_raw_read_value(struct device *dev) +static inline s32 dev_pm_qos_raw_resume_latency(struct device *dev) { return PM_QOS_RESUME_LATENCY_NO_CONSTRAINT; } From patchwork Thu Jun 20 07:35:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 167299 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp1725267ilk; Thu, 20 Jun 2019 00:35:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqwtIub/yRPpAmJzeDatfvxMJes3Am6lETbQKlnjkl1TF9q4bipL0zxI34fkopMsC2FPRSw4 X-Received: by 2002:aa7:8d98:: with SMTP id i24mr61305284pfr.199.1561016154290; Thu, 20 Jun 2019 00:35:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561016154; cv=none; d=google.com; s=arc-20160816; b=dHXhoL94sj68uQlVU9GQv8S/CF+IB4lND9EvJXGSQTq9O02eIa0GKObm6hB4dIG8RR u2vVHBj4JWCD8hlQDjC/g88qCpxH2OCDkUQEhDKXeWIBKRU3cRH5RaXFDsDhp88llq12 zG4vnmWb1ZYpChDU/8yClzH3I8OP0swmB/lqKyjyUACSJmpDhqpu2aVxJBeJ0BwdL1/I xjLk2wpUqr1G/V0XZK2lglIZ6sUjTGvbZgMzOykX3TgivdXEzmRlPQYJDUmEkPzzhPll f5OS0zdqgGJihw37uv7a4+KcfscaNX836bHM5i5lK8ITtIvu81b/bpd1w1fusKOXvNSc 0aKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=mFea1NB8cblkfncT7oG1ziy//jPVykLkqdpiv/Sj2rY=; b=Dwxk3OPBNgF7lJzvEDHBEnjKtLQ5ulZw8iHGlqcdg8orlb9rBKtw6iTL72vN42HdUp 36redtd9TVChFurq1kAA+8siolCux0mQM0vDhNGyyW7Mc34K9vk3ZMh3RlvlK+AQcE7m MDXQw64VoAHJfVEsiQp3vnL0whPaK5h8+x9EjMfOpIKq+FzPn+330+gaOJXweMzay50S w3CAJmGvX72cpi/fzcfP2fEgZqWUJitYYAwW0iI7tgdgX9s1Tp/6ZRd6AYNNNiBeh62c vA+rTvA37Ogzu6SOPCqmZFiEv10JscvX1UT1qp7+MhAlMy/9C4Tq+lDKtPPNxI+kMsSZ wpOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OOTIOuNB; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v25si18994450pff.274.2019.06.20.00.35.54; Thu, 20 Jun 2019 00:35:54 -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=@linaro.org header.s=google header.b=OOTIOuNB; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730628AbfFTHfw (ORCPT + 30 others); Thu, 20 Jun 2019 03:35:52 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:39174 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730561AbfFTHfu (ORCPT ); Thu, 20 Jun 2019 03:35:50 -0400 Received: by mail-pg1-f194.google.com with SMTP id 196so1117312pgc.6 for ; Thu, 20 Jun 2019 00:35:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mFea1NB8cblkfncT7oG1ziy//jPVykLkqdpiv/Sj2rY=; b=OOTIOuNBVoc/plqifbqrBTSSXmNakHwestFW6A2YysPYs4Vlc7duA3jFanwE2V9IeU 56gCclEffi02AbZ2RfA0mt79kOdt4JwcpXftyAaPSyc/plIPmIU1zOTBX1JGHD8BuSA2 IOivuhwkgMYoGgDVCB8cyJhJNKvp7TFkFyPYlKN5xhCOJ49DvrOu3uzyMw8zwRjdKEER 4DNsVGH+gQj66S39tUAO9EmGfBoplClGS1FqDPoRVIvFGQiBYX/LO1qIVr1zv5miWhJ9 NWrI01a1UhVuD/+r8ZXmedbvS6HPkNLQZ0nR/I8iaeQUTwuUeJzeM5pOYYP23nomHqPr rZcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mFea1NB8cblkfncT7oG1ziy//jPVykLkqdpiv/Sj2rY=; b=DFQ0LvU0s0Dj3kIF9V3OJ/RhMfCXeMtN+tHSx2NXbeB9AUVpVEV+iZs0GgwVbCY6Bq 7Z8PCPx5l84PFnINCbyFCgXvYDduUvOyQFzsbV81IEzaTlyz8G0r4ec79sud2b6LVcNx o2y+Nh8wEKCJ5YauOngKCzj8hbh8xOBMdYHBlejFMcJU/y3z00hZ+pxUwquP3DzypGdU LYIjL88D5bSU585bRMYJ5ywQrBY88/7udhQZXUItVwLLUcQKPUjbIFa0hcuypXutYmwQ Hx1SCWw2kk2f21T+wLV4mvulWZ50roML+QkavhDWIaxYoSRjBSnlGxq/s/M0WUYzIKd0 STNw== X-Gm-Message-State: APjAAAXpJsbYRboRoI7HuJAqeS/8iidYl57mfSNa8w3bDu4SWsEsH5Un GynKjkDsb53JcUWG4LpcINgMng== X-Received: by 2002:aa7:972a:: with SMTP id k10mr95648994pfg.116.1561016150170; Thu, 20 Jun 2019 00:35:50 -0700 (PDT) Received: from localhost ([122.172.66.84]) by smtp.gmail.com with ESMTPSA id j14sm20915268pfe.10.2019.06.20.00.35.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Jun 2019 00:35:49 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Len Brown , Pavel Machek , Kevin Hilman , Ulf Hansson Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , Qais.Yousef@arm.com, mka@chromium.org, juri.lelli@gmail.com, linux-kernel@vger.kernel.org Subject: [PATCH V4 3/6] PM / QOS: Pass request type to dev_pm_qos_read_value() Date: Thu, 20 Jun 2019 13:05:26 +0530 Message-Id: <8ab3d45109443c381a417ee1d019516781216a48.1561014965.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.21.0.rc0.269.g1a574e7a288b In-Reply-To: References: MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In order to allow dev_pm_qos_read_value() to read values for different QoS requests, pass request type as a parameter to these routines. For now, it only supports resume-latency request type but will be extended to frequency limit (min/max) constraints later on. Reviewed-by: Matthias Kaehlcke Reviewed-by: Ulf Hansson Signed-off-by: Viresh Kumar --- Documentation/power/pm_qos_interface.txt | 2 +- drivers/base/power/domain_governor.c | 2 +- drivers/base/power/qos.c | 17 ++++++++++++----- include/linux/pm_qos.h | 16 +++++++++++++--- 4 files changed, 27 insertions(+), 10 deletions(-) -- 2.21.0.rc0.269.g1a574e7a288b diff --git a/Documentation/power/pm_qos_interface.txt b/Documentation/power/pm_qos_interface.txt index ec7d662d1707..cfcb1df39799 100644 --- a/Documentation/power/pm_qos_interface.txt +++ b/Documentation/power/pm_qos_interface.txt @@ -123,7 +123,7 @@ Will remove the element. After removal it will update the aggregate target and call the notification trees if the target was changed as a result of removing the request. -s32 dev_pm_qos_read_value(device): +s32 dev_pm_qos_read_value(device, type): Returns the aggregated value for a given device's constraints list. enum pm_qos_flags_status dev_pm_qos_flags(device, mask) diff --git a/drivers/base/power/domain_governor.c b/drivers/base/power/domain_governor.c index 20e56a5be01f..daa8c7689f7e 100644 --- a/drivers/base/power/domain_governor.c +++ b/drivers/base/power/domain_governor.c @@ -33,7 +33,7 @@ static int dev_update_qos_constraint(struct device *dev, void *data) * take its current PM QoS constraint (that's the only thing * known at this point anyway). */ - constraint_ns = dev_pm_qos_read_value(dev); + constraint_ns = dev_pm_qos_read_value(dev, DEV_PM_QOS_RESUME_LATENCY); constraint_ns *= NSEC_PER_USEC; } diff --git a/drivers/base/power/qos.c b/drivers/base/power/qos.c index 7a0d197f0809..2461fed0efa0 100644 --- a/drivers/base/power/qos.c +++ b/drivers/base/power/qos.c @@ -105,18 +105,25 @@ s32 __dev_pm_qos_resume_latency(struct device *dev) /** * dev_pm_qos_read_value - Get PM QoS constraint for a given device (locked). * @dev: Device to get the PM QoS constraint value for. + * @type: QoS request type. */ -s32 dev_pm_qos_read_value(struct device *dev) +s32 dev_pm_qos_read_value(struct device *dev, enum dev_pm_qos_req_type type) { + struct dev_pm_qos *qos = dev->power.qos; unsigned long flags; s32 ret; spin_lock_irqsave(&dev->power.lock, flags); - if (IS_ERR_OR_NULL(dev->power.qos)) - ret = PM_QOS_RESUME_LATENCY_NO_CONSTRAINT; - else - ret = pm_qos_read_value(&dev->power.qos->resume_latency); + switch (type) { + case DEV_PM_QOS_RESUME_LATENCY: + ret = IS_ERR_OR_NULL(qos) ? PM_QOS_RESUME_LATENCY_NO_CONSTRAINT + : pm_qos_read_value(&qos->resume_latency); + break; + default: + WARN_ON(1); + ret = 0; + } spin_unlock_irqrestore(&dev->power.lock, flags); diff --git a/include/linux/pm_qos.h b/include/linux/pm_qos.h index 06aa88496761..5ce1c310373e 100644 --- a/include/linux/pm_qos.h +++ b/include/linux/pm_qos.h @@ -140,7 +140,7 @@ s32 pm_qos_read_value(struct pm_qos_constraints *c); enum pm_qos_flags_status __dev_pm_qos_flags(struct device *dev, s32 mask); enum pm_qos_flags_status dev_pm_qos_flags(struct device *dev, s32 mask); s32 __dev_pm_qos_resume_latency(struct device *dev); -s32 dev_pm_qos_read_value(struct device *dev); +s32 dev_pm_qos_read_value(struct device *dev, enum dev_pm_qos_req_type type); int dev_pm_qos_add_request(struct device *dev, struct dev_pm_qos_request *req, enum dev_pm_qos_req_type type, s32 value); int dev_pm_qos_update_request(struct dev_pm_qos_request *req, s32 new_value); @@ -191,8 +191,18 @@ static inline enum pm_qos_flags_status dev_pm_qos_flags(struct device *dev, { return PM_QOS_FLAGS_UNDEFINED; } static inline s32 __dev_pm_qos_resume_latency(struct device *dev) { return PM_QOS_RESUME_LATENCY_NO_CONSTRAINT; } -static inline s32 dev_pm_qos_read_value(struct device *dev) - { return PM_QOS_RESUME_LATENCY_NO_CONSTRAINT; } +static inline s32 dev_pm_qos_read_value(struct device *dev, + enum dev_pm_qos_req_type type) +{ + switch type { + case DEV_PM_QOS_RESUME_LATENCY: + return PM_QOS_RESUME_LATENCY_NO_CONSTRAINT; + default: + WARN_ON(1); + return 0; + } +} + static inline int dev_pm_qos_add_request(struct device *dev, struct dev_pm_qos_request *req, enum dev_pm_qos_req_type type, From patchwork Thu Jun 20 07:35:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 167300 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp1725311ilk; Thu, 20 Jun 2019 00:35:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqwqosIR6a2ZHgQpON6jTDndYPQkHZjjmeJWQwB7FHIEHglD3jSjbRqpTri8EDyrjpJ0OoBl X-Received: by 2002:a17:902:8649:: with SMTP id y9mr46122323plt.289.1561016156543; Thu, 20 Jun 2019 00:35:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561016156; cv=none; d=google.com; s=arc-20160816; b=MVLzzvh236ZICJFLgFpQV6N5fNO3A269BZJRLfYXCajnhXv2eVhbSNuzCZqpcpZRVn nr/VNlpR2iZf3YcRX8lIao8NbQUe8h7tu3LQXcig628XLdBHhOtplZ2KaXCp+DgDFddR zGxHMLMPk+JhJSBRrC+2oorodmgLlHhIuLlZAsqK/naEYigDN4eMNqc05Siq/joMNUtG lHGNHCdle2lORUbrhks2g8jMrIGq7Yk/cV9oKlN6pGGILJ5tSOJo99BAev7OItqtoR4b wQyWPkIGLuhsvHislIweT8Xy24RCJwrsLlJ6dD2RE4wQOUSs7lNIcVbZr4KdFlWH0COU //Vw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=iLaNaNEqpEZ8RJPh9tk4QDLad7h0DvU5BxSRq4ruwcY=; b=kJGFJtEvpOJ0BfOG4kSUlvUaxiNGXcqrSBMC17WJWNtWSPqN0W8AS1ngDqCOj8D0pc CnJmURQFAoXwTyglQt2NcFaFs1gCvMSWc+z2vtlxb8VCtMGjnlseVhO7bAFO6JlCdvnq aibMRAxkazSjJsjlw9PbxYRke9AqjluIR5dyw05xc7hN/Ojf1gyvKFL5ADc0k0MF34qw d8kJS5xVpoZx0b4Zf3yxR6yG5UIbvzwVqwZl4KeOjkLtlWVPQ5sfZoiyeQfDs0nj69wD EadRuWTzAysqS4rcqYkuzfDh9ZtcyRhHR0c/HyBT7eSfTy4MXlYDBwl/tdnA0xmRtogr d1cQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yY1ZZsuy; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z19si17132190pfa.260.2019.06.20.00.35.56; Thu, 20 Jun 2019 00:35:56 -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=@linaro.org header.s=google header.b=yY1ZZsuy; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730752AbfFTHfz (ORCPT + 30 others); Thu, 20 Jun 2019 03:35:55 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:35326 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730561AbfFTHfy (ORCPT ); Thu, 20 Jun 2019 03:35:54 -0400 Received: by mail-pg1-f194.google.com with SMTP id s27so1130762pgl.2 for ; Thu, 20 Jun 2019 00:35:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=iLaNaNEqpEZ8RJPh9tk4QDLad7h0DvU5BxSRq4ruwcY=; b=yY1ZZsuyKdtPw903JxGgNQsy2aDPxahuWxuhCKMkAf1zXMSkpedA43zQqof3czMSeI jughIv+YkgL57nI9Auug2CM2nVPSihI12ob6EkWe+/Uf5ISFMFvG/XsnECj58XlQgdT8 P+E+H/uCyZ7Uattuhucgm9g/Pp0P0qbmrnKi0E87E6pVCW1m6Je8lAWhCcYOhehZYT8M pwntS8wGLiX5JPP5npbS0hhK2fAfX8AbAvtC+9HMsV5F7rjZX8aaNxXfjEC7jjxFZihs x0wnD3rb5VZN/K2HMzn2uaf5Z97fN/bMKNYUYppxJ6nph9Rci/LNrDctmQpBgeLPjJru EUBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=iLaNaNEqpEZ8RJPh9tk4QDLad7h0DvU5BxSRq4ruwcY=; b=oPJJLyuNyYFjBeBIUbM/njOYd+nZjPJtb8uZg2ThudFM642s4lCiuuvhTsL1X1zcAh zGhH7H9UJk2zr/l78xBNBKAA0EilVGdT3A5x93qGzR7PZWiksnJPikbjjSSCAMDPsgXo MY/VTWSSXySuXcii4p8IGc2nSOJW/vA5cg1PY2kRLwVLFHE4m05rpLvfTs/qTwvamb27 sI4FB24u08fEe72xMSUQgHYHyEGiAluJGcIu16k5YToWIjsGyFHyrOFZLSp8e7ZHlplA 7k3a9qIJTGZajkdiPGnZA723VYIrVoTZa9ryJzFwPOcqWbyFYEPWyQ/lt6YC3qL1a+Ma zSMw== X-Gm-Message-State: APjAAAVFqmiXBl7KA/c64iEWYRU3OI/YnGVK83h11Yu1c9TJunR4GSwO 6vlqkeedUlSmXeS54NpqomTaAg== X-Received: by 2002:aa7:9092:: with SMTP id i18mr14045331pfa.101.1561016153151; Thu, 20 Jun 2019 00:35:53 -0700 (PDT) Received: from localhost ([122.172.66.84]) by smtp.gmail.com with ESMTPSA id e16sm27403304pga.11.2019.06.20.00.35.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Jun 2019 00:35:52 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Pavel Machek , Len Brown Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , Qais.Yousef@arm.com, mka@chromium.org, juri.lelli@gmail.com, Ulf Hansson , linux-kernel@vger.kernel.org Subject: [PATCH V4 4/6] PM / QoS: Add support for MIN/MAX frequency constraints Date: Thu, 20 Jun 2019 13:05:27 +0530 Message-Id: X-Mailer: git-send-email 2.21.0.rc0.269.g1a574e7a288b In-Reply-To: References: MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch introduces the min-frequency and max-frequency device constraints, which will be used by the cpufreq core to begin with. Reviewed-by: Matthias Kaehlcke Reviewed-by: Ulf Hansson Signed-off-by: Viresh Kumar --- drivers/base/power/qos.c | 111 ++++++++++++++++++++++++++++++++++----- include/linux/pm_qos.h | 12 +++++ 2 files changed, 109 insertions(+), 14 deletions(-) -- 2.21.0.rc0.269.g1a574e7a288b diff --git a/drivers/base/power/qos.c b/drivers/base/power/qos.c index 2461fed0efa0..6c90fd7e2ff8 100644 --- a/drivers/base/power/qos.c +++ b/drivers/base/power/qos.c @@ -120,6 +120,14 @@ s32 dev_pm_qos_read_value(struct device *dev, enum dev_pm_qos_req_type type) ret = IS_ERR_OR_NULL(qos) ? PM_QOS_RESUME_LATENCY_NO_CONSTRAINT : pm_qos_read_value(&qos->resume_latency); break; + case DEV_PM_QOS_MIN_FREQUENCY: + ret = IS_ERR_OR_NULL(qos) ? PM_QOS_MIN_FREQUENCY_DEFAULT_VALUE + : pm_qos_read_value(&qos->min_frequency); + break; + case DEV_PM_QOS_MAX_FREQUENCY: + ret = IS_ERR_OR_NULL(qos) ? PM_QOS_MAX_FREQUENCY_DEFAULT_VALUE + : pm_qos_read_value(&qos->max_frequency); + break; default: WARN_ON(1); ret = 0; @@ -161,6 +169,14 @@ static int apply_constraint(struct dev_pm_qos_request *req, req->dev->power.set_latency_tolerance(req->dev, value); } break; + case DEV_PM_QOS_MIN_FREQUENCY: + ret = pm_qos_update_target(&qos->min_frequency, + &req->data.pnode, action, value); + break; + case DEV_PM_QOS_MAX_FREQUENCY: + ret = pm_qos_update_target(&qos->max_frequency, + &req->data.pnode, action, value); + break; case DEV_PM_QOS_FLAGS: ret = pm_qos_update_flags(&qos->flags, &req->data.flr, action, value); @@ -189,12 +205,11 @@ static int dev_pm_qos_constraints_allocate(struct device *dev) if (!qos) return -ENOMEM; - n = kzalloc(sizeof(*n), GFP_KERNEL); + n = kzalloc(3 * sizeof(*n), GFP_KERNEL); if (!n) { kfree(qos); return -ENOMEM; } - BLOCKING_INIT_NOTIFIER_HEAD(n); c = &qos->resume_latency; plist_head_init(&c->list); @@ -203,6 +218,7 @@ static int dev_pm_qos_constraints_allocate(struct device *dev) c->no_constraint_value = PM_QOS_RESUME_LATENCY_NO_CONSTRAINT; c->type = PM_QOS_MIN; c->notifiers = n; + BLOCKING_INIT_NOTIFIER_HEAD(n); c = &qos->latency_tolerance; plist_head_init(&c->list); @@ -211,6 +227,24 @@ static int dev_pm_qos_constraints_allocate(struct device *dev) c->no_constraint_value = PM_QOS_LATENCY_TOLERANCE_NO_CONSTRAINT; c->type = PM_QOS_MIN; + c = &qos->min_frequency; + plist_head_init(&c->list); + c->target_value = PM_QOS_MIN_FREQUENCY_DEFAULT_VALUE; + c->default_value = PM_QOS_MIN_FREQUENCY_DEFAULT_VALUE; + c->no_constraint_value = PM_QOS_MIN_FREQUENCY_DEFAULT_VALUE; + c->type = PM_QOS_MAX; + c->notifiers = ++n; + BLOCKING_INIT_NOTIFIER_HEAD(n); + + c = &qos->max_frequency; + plist_head_init(&c->list); + c->target_value = PM_QOS_MAX_FREQUENCY_DEFAULT_VALUE; + c->default_value = PM_QOS_MAX_FREQUENCY_DEFAULT_VALUE; + c->no_constraint_value = PM_QOS_MAX_FREQUENCY_DEFAULT_VALUE; + c->type = PM_QOS_MIN; + c->notifiers = ++n; + BLOCKING_INIT_NOTIFIER_HEAD(n); + INIT_LIST_HEAD(&qos->flags.list); spin_lock_irq(&dev->power.lock); @@ -264,11 +298,25 @@ void dev_pm_qos_constraints_destroy(struct device *dev) apply_constraint(req, PM_QOS_REMOVE_REQ, PM_QOS_DEFAULT_VALUE); memset(req, 0, sizeof(*req)); } + c = &qos->latency_tolerance; plist_for_each_entry_safe(req, tmp, &c->list, data.pnode) { apply_constraint(req, PM_QOS_REMOVE_REQ, PM_QOS_DEFAULT_VALUE); memset(req, 0, sizeof(*req)); } + + c = &qos->min_frequency; + plist_for_each_entry_safe(req, tmp, &c->list, data.pnode) { + apply_constraint(req, PM_QOS_REMOVE_REQ, PM_QOS_MIN_FREQUENCY_DEFAULT_VALUE); + memset(req, 0, sizeof(*req)); + } + + c = &qos->max_frequency; + plist_for_each_entry_safe(req, tmp, &c->list, data.pnode) { + apply_constraint(req, PM_QOS_REMOVE_REQ, PM_QOS_MAX_FREQUENCY_DEFAULT_VALUE); + memset(req, 0, sizeof(*req)); + } + f = &qos->flags; list_for_each_entry_safe(req, tmp, &f->list, data.flr.node) { apply_constraint(req, PM_QOS_REMOVE_REQ, PM_QOS_DEFAULT_VALUE); @@ -380,6 +428,8 @@ static int __dev_pm_qos_update_request(struct dev_pm_qos_request *req, switch(req->type) { case DEV_PM_QOS_RESUME_LATENCY: case DEV_PM_QOS_LATENCY_TOLERANCE: + case DEV_PM_QOS_MIN_FREQUENCY: + case DEV_PM_QOS_MAX_FREQUENCY: curr_value = req->data.pnode.prio; break; case DEV_PM_QOS_FLAGS: @@ -492,9 +542,6 @@ int dev_pm_qos_add_notifier(struct device *dev, struct notifier_block *notifier, { int ret = 0; - if (WARN_ON(type != DEV_PM_QOS_RESUME_LATENCY)) - return -EINVAL; - mutex_lock(&dev_pm_qos_mtx); if (IS_ERR(dev->power.qos)) @@ -502,10 +549,28 @@ int dev_pm_qos_add_notifier(struct device *dev, struct notifier_block *notifier, else if (!dev->power.qos) ret = dev_pm_qos_constraints_allocate(dev); - if (!ret) + if (ret) + goto unlock; + + switch (type) { + case DEV_PM_QOS_RESUME_LATENCY: ret = blocking_notifier_chain_register(dev->power.qos->resume_latency.notifiers, notifier); + break; + case DEV_PM_QOS_MIN_FREQUENCY: + ret = blocking_notifier_chain_register(dev->power.qos->min_frequency.notifiers, + notifier); + break; + case DEV_PM_QOS_MAX_FREQUENCY: + ret = blocking_notifier_chain_register(dev->power.qos->max_frequency.notifiers, + notifier); + break; + default: + WARN_ON(1); + ret = -EINVAL; + } +unlock: mutex_unlock(&dev_pm_qos_mtx); return ret; } @@ -526,20 +591,35 @@ int dev_pm_qos_remove_notifier(struct device *dev, struct notifier_block *notifier, enum dev_pm_qos_req_type type) { - int retval = 0; - - if (WARN_ON(type != DEV_PM_QOS_RESUME_LATENCY)) - return -EINVAL; + int ret = 0; mutex_lock(&dev_pm_qos_mtx); /* Silently return if the constraints object is not present. */ - if (!IS_ERR_OR_NULL(dev->power.qos)) - retval = blocking_notifier_chain_unregister(dev->power.qos->resume_latency.notifiers, - notifier); + if (IS_ERR_OR_NULL(dev->power.qos)) + goto unlock; + + switch (type) { + case DEV_PM_QOS_RESUME_LATENCY: + ret = blocking_notifier_chain_unregister(dev->power.qos->resume_latency.notifiers, + notifier); + break; + case DEV_PM_QOS_MIN_FREQUENCY: + ret = blocking_notifier_chain_unregister(dev->power.qos->min_frequency.notifiers, + notifier); + break; + case DEV_PM_QOS_MAX_FREQUENCY: + ret = blocking_notifier_chain_unregister(dev->power.qos->max_frequency.notifiers, + notifier); + break; + default: + WARN_ON(1); + ret = -EINVAL; + } +unlock: mutex_unlock(&dev_pm_qos_mtx); - return retval; + return ret; } EXPORT_SYMBOL_GPL(dev_pm_qos_remove_notifier); @@ -599,6 +679,9 @@ static void __dev_pm_qos_drop_user_request(struct device *dev, req = dev->power.qos->flags_req; dev->power.qos->flags_req = NULL; break; + default: + WARN_ON(1); + return; } __dev_pm_qos_remove_request(req); kfree(req); diff --git a/include/linux/pm_qos.h b/include/linux/pm_qos.h index 5ce1c310373e..17132b10b233 100644 --- a/include/linux/pm_qos.h +++ b/include/linux/pm_qos.h @@ -40,6 +40,8 @@ enum pm_qos_flags_status { #define PM_QOS_RESUME_LATENCY_NO_CONSTRAINT PM_QOS_LATENCY_ANY #define PM_QOS_RESUME_LATENCY_NO_CONSTRAINT_NS PM_QOS_LATENCY_ANY_NS #define PM_QOS_LATENCY_TOLERANCE_DEFAULT_VALUE 0 +#define PM_QOS_MIN_FREQUENCY_DEFAULT_VALUE 0 +#define PM_QOS_MAX_FREQUENCY_DEFAULT_VALUE (-1) #define PM_QOS_LATENCY_TOLERANCE_NO_CONSTRAINT (-1) #define PM_QOS_FLAG_NO_POWER_OFF (1 << 0) @@ -58,6 +60,8 @@ struct pm_qos_flags_request { enum dev_pm_qos_req_type { DEV_PM_QOS_RESUME_LATENCY = 1, DEV_PM_QOS_LATENCY_TOLERANCE, + DEV_PM_QOS_MIN_FREQUENCY, + DEV_PM_QOS_MAX_FREQUENCY, DEV_PM_QOS_FLAGS, }; @@ -99,10 +103,14 @@ struct pm_qos_flags { struct dev_pm_qos { struct pm_qos_constraints resume_latency; struct pm_qos_constraints latency_tolerance; + struct pm_qos_constraints min_frequency; + struct pm_qos_constraints max_frequency; struct pm_qos_flags flags; struct dev_pm_qos_request *resume_latency_req; struct dev_pm_qos_request *latency_tolerance_req; struct dev_pm_qos_request *flags_req; + struct dev_pm_qos_request *min_frequency_req; + struct dev_pm_qos_request *max_frequency_req; }; /* Action requested to pm_qos_update_target */ @@ -197,6 +205,10 @@ static inline s32 dev_pm_qos_read_value(struct device *dev, switch type { case DEV_PM_QOS_RESUME_LATENCY: return PM_QOS_RESUME_LATENCY_NO_CONSTRAINT; + case DEV_PM_QOS_MIN_FREQUENCY: + return PM_QOS_MIN_FREQUENCY_DEFAULT_VALUE; + case DEV_PM_QOS_MAX_FREQUENCY: + return PM_QOS_MAX_FREQUENCY_DEFAULT_VALUE; default: WARN_ON(1); return 0; From patchwork Thu Jun 20 07:35:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 167301 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp1725371ilk; Thu, 20 Jun 2019 00:36:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqxz863Ot3DTn3cCmKhAqB26ZcFezBMHJ+gGQ91z28xCrs5PcwudjBG31/P7VKiVP2EJW8tb X-Received: by 2002:a65:42c4:: with SMTP id l4mr11610539pgp.436.1561016159990; Thu, 20 Jun 2019 00:35:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561016159; cv=none; d=google.com; s=arc-20160816; b=bLiR69ilj1lZhVF7KqKlxhodVjSqA1gw28B5gxnW7WzwV6N6Ch9Ocb5jZ1sA0foSWv r/55xIeabJBWt8XLpEC4TsRWhuIJPuuRnf3h19xUNYsA7DdVnsgGzq4HqSBqKU9FMEmE 0KhDRxyfEqCp1dDpA55hIkx3WuJVrPo0dusxZkXybaB0h65ypMrNAl2lGBEGHV/q6lTr Uzx8GyNLbHavsHBWYn6HqgmIXU18PK43DyQXHUbDEqNu/38RuwUsZIbnVLSosLtTaxxF Er34nDdrK+bMm14UtJ6KdHRfg+KqsUMDMxuInWt6L14eZZwIshxTTvtiq+drlzVyPrIB L8YA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Q7XNmBdwQm+dBsBPtwMr7szEH/wj3wd0LWW4VkxG2rw=; b=pTdN6v/91ta/92OXjvC4paBmYDKxE6hUG61z2XBrXGlAaNGDY8qApTTaqOLkNkRzjb 69rizHxjvYPsRAXtkO1L2LXjV2c107+dp1J1XsedgFWS8eQyAmE5L1HPDlrYG/ARuu46 46INTy5geBw5dtufCqY1j5hOdG+F3UVjPvMP3wgcYCmfkdvn0mjWTPl3pi3/3nHyHwKu U4nfKojQGXEIsN2p8c43m4AOknfoGSAaWWLyA2Krh8bZqa6yXgiqmMZfB0IG5bqrVGKn 38to2FXOyLI5xJ7v6nKKXp0YrfqEyQ2/NvM7zcoXN5jkJzmku2rJmSmfoYTKGjeupWme gCXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HjYvJ6ue; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i9si5151353pgl.452.2019.06.20.00.35.59; Thu, 20 Jun 2019 00:35:59 -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=@linaro.org header.s=google header.b=HjYvJ6ue; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730821AbfFTHf6 (ORCPT + 30 others); Thu, 20 Jun 2019 03:35:58 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:38063 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730561AbfFTHf5 (ORCPT ); Thu, 20 Jun 2019 03:35:57 -0400 Received: by mail-pg1-f193.google.com with SMTP id v11so1119346pgl.5 for ; Thu, 20 Jun 2019 00:35:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Q7XNmBdwQm+dBsBPtwMr7szEH/wj3wd0LWW4VkxG2rw=; b=HjYvJ6ue2K2Acl/XwIMFG3LHfXLqVjFsrxV67UxP8KH2GSwObFwnvbfpZyMD1NVQH4 SyUPOY9JU/nZjYMODPgrHgRDQ+00ktkf+EoKIjac623Mq2g09LeSvxN51bxZmEfatMS7 AiSbIfUHeXKPfzOEulyD+h/bViuv54b1RsyuaSd0ck6WJwN4PWOSs6Sa85sfI0ZAlBIg +DWJQy/4FceijhaW9op0Z9DMT7R1t2mlIsEgFj0kzUiWa0OnnoINoUXqKfN/R8yKA7jE Vl6ZtmFOPXAihgnJNWhHahSaCD+cuAZhZyf9U1lFnRpxRexhokxGdlt+Nybl5qTEB731 yfwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Q7XNmBdwQm+dBsBPtwMr7szEH/wj3wd0LWW4VkxG2rw=; b=Vbs0bLflP5RVkOlFzI3X8gcIrTN2xEm7xD+6fnp8n8Lmha8aCLxZxkZLhiRVmPdpwl Usnsh5mvgazcoQ5+NUinNcHJ95uK+GpuZfJ/iTOnMepX25yIgIEB7oCC2W9ZYoROMgK1 TtfxDSZusuDO+yNhsHOu26bvru4AvU7raUyAfk0olKajjKPFg5z1+GQQjKplZ1/a+qqt q6tEeDBWQd44A3v+N8sycfKeoklHSIg+lirGaxK/OOEq0ItIbnfTk1jXi1Z4fWsoGaXC dOITYq2iZRaI3bJrGoLHsP3cUuspuA/yXEIAziXasdVhv4j/emU5gWTVER9yReBymsnP s+jQ== X-Gm-Message-State: APjAAAUm0UHoRfa0BXPknLNMx+g9ryQMlRKhd+ZHcTLyyqRqea/CI8u5 9gMePX1E80JfROsKMG8bVCeCJA== X-Received: by 2002:a17:90a:26a1:: with SMTP id m30mr1668273pje.59.1561016156058; Thu, 20 Jun 2019 00:35:56 -0700 (PDT) Received: from localhost ([122.172.66.84]) by smtp.gmail.com with ESMTPSA id e16sm27403448pga.11.2019.06.20.00.35.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Jun 2019 00:35:55 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , Qais.Yousef@arm.com, mka@chromium.org, juri.lelli@gmail.com, Ulf Hansson , linux-kernel@vger.kernel.org Subject: [PATCH V4 5/6] cpufreq: Register notifiers with the PM QoS framework Date: Thu, 20 Jun 2019 13:05:28 +0530 Message-Id: <8290454213d8f3749b8091b8e4e53995efa0da87.1561014965.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.21.0.rc0.269.g1a574e7a288b In-Reply-To: References: MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This registers the notifiers for min/max frequency constraints with the PM QoS framework. The constraints are also taken into consideration in cpufreq_set_policy(). This also relocates cpufreq_policy_put_kobj() as it is required to be called from cpufreq_policy_alloc() now. reeval_frequency_limits() is updated to have proper locking in place and avoid calling cpufreq_set_policy() for inactive policies. No constraints are added until now though. Reviewed-by: Matthias Kaehlcke Reviewed-by: Ulf Hansson Signed-off-by: Viresh Kumar --- drivers/cpufreq/cpufreq.c | 135 ++++++++++++++++++++++++++++++-------- include/linux/cpufreq.h | 3 + 2 files changed, 109 insertions(+), 29 deletions(-) -- 2.21.0.rc0.269.g1a574e7a288b diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 0a73de7aae54..b47a6c094171 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -999,7 +1000,7 @@ static void add_cpu_dev_symlink(struct cpufreq_policy *policy, unsigned int cpu) { struct device *dev = get_cpu_device(cpu); - if (!dev) + if (unlikely(!dev)) return; if (cpumask_test_and_set_cpu(cpu, policy->real_cpus)) @@ -1117,14 +1118,20 @@ static int cpufreq_add_policy_cpu(struct cpufreq_policy *policy, unsigned int cp static void reeval_frequency_limits(struct cpufreq_policy *policy) { - struct cpufreq_policy new_policy = *policy; + struct cpufreq_policy new_policy; - pr_debug("updating policy for CPU %u\n", policy->cpu); + down_write(&policy->rwsem); + + if (!policy_is_inactive(policy)) { + new_policy = *policy; + pr_debug("updating policy for CPU %u\n", policy->cpu); - new_policy.min = policy->user_policy.min; - new_policy.max = policy->user_policy.max; + new_policy.min = policy->user_policy.min; + new_policy.max = policy->user_policy.max; + cpufreq_set_policy(policy, &new_policy); + } - cpufreq_set_policy(policy, &new_policy); + up_write(&policy->rwsem); } static void handle_update(struct work_struct *work) @@ -1136,11 +1143,55 @@ static void handle_update(struct work_struct *work) reeval_frequency_limits(policy); } +static int cpufreq_notifier_min(struct notifier_block *nb, unsigned long freq, + void *data) +{ + struct cpufreq_policy *policy = container_of(nb, struct cpufreq_policy, nb_min); + + schedule_work(&policy->update); + return 0; +} + +static int cpufreq_notifier_max(struct notifier_block *nb, unsigned long freq, + void *data) +{ + struct cpufreq_policy *policy = container_of(nb, struct cpufreq_policy, nb_max); + + schedule_work(&policy->update); + return 0; +} + +static void cpufreq_policy_put_kobj(struct cpufreq_policy *policy) +{ + struct kobject *kobj; + struct completion *cmp; + + down_write(&policy->rwsem); + cpufreq_stats_free_table(policy); + kobj = &policy->kobj; + cmp = &policy->kobj_unregister; + up_write(&policy->rwsem); + kobject_put(kobj); + + /* + * We need to make sure that the underlying kobj is + * actually not referenced anymore by anybody before we + * proceed with unloading. + */ + pr_debug("waiting for dropping of refcount\n"); + wait_for_completion(cmp); + pr_debug("wait complete\n"); +} + static struct cpufreq_policy *cpufreq_policy_alloc(unsigned int cpu) { struct cpufreq_policy *policy; + struct device *dev = get_cpu_device(cpu); int ret; + if (!dev) + return NULL; + policy = kzalloc(sizeof(*policy), GFP_KERNEL); if (!policy) return NULL; @@ -1157,7 +1208,7 @@ static struct cpufreq_policy *cpufreq_policy_alloc(unsigned int cpu) ret = kobject_init_and_add(&policy->kobj, &ktype_cpufreq, cpufreq_global_kobject, "policy%u", cpu); if (ret) { - pr_err("%s: failed to init policy->kobj: %d\n", __func__, ret); + dev_err(dev, "%s: failed to init policy->kobj: %d\n", __func__, ret); /* * The entire policy object will be freed below, but the extra * memory allocated for the kobject name needs to be freed by @@ -1167,6 +1218,25 @@ static struct cpufreq_policy *cpufreq_policy_alloc(unsigned int cpu) goto err_free_real_cpus; } + policy->nb_min.notifier_call = cpufreq_notifier_min; + policy->nb_max.notifier_call = cpufreq_notifier_max; + + ret = dev_pm_qos_add_notifier(dev, &policy->nb_min, + DEV_PM_QOS_MIN_FREQUENCY); + if (ret) { + dev_err(dev, "Failed to register MIN QoS notifier: %d (%*pbl)\n", + ret, cpumask_pr_args(policy->cpus)); + goto err_kobj_remove; + } + + ret = dev_pm_qos_add_notifier(dev, &policy->nb_max, + DEV_PM_QOS_MAX_FREQUENCY); + if (ret) { + dev_err(dev, "Failed to register MAX QoS notifier: %d (%*pbl)\n", + ret, cpumask_pr_args(policy->cpus)); + goto err_min_qos_notifier; + } + INIT_LIST_HEAD(&policy->policy_list); init_rwsem(&policy->rwsem); spin_lock_init(&policy->transition_lock); @@ -1177,6 +1247,11 @@ static struct cpufreq_policy *cpufreq_policy_alloc(unsigned int cpu) policy->cpu = cpu; return policy; +err_min_qos_notifier: + dev_pm_qos_remove_notifier(dev, &policy->nb_min, + DEV_PM_QOS_MIN_FREQUENCY); +err_kobj_remove: + cpufreq_policy_put_kobj(policy); err_free_real_cpus: free_cpumask_var(policy->real_cpus); err_free_rcpumask: @@ -1189,30 +1264,9 @@ static struct cpufreq_policy *cpufreq_policy_alloc(unsigned int cpu) return NULL; } -static void cpufreq_policy_put_kobj(struct cpufreq_policy *policy) -{ - struct kobject *kobj; - struct completion *cmp; - - down_write(&policy->rwsem); - cpufreq_stats_free_table(policy); - kobj = &policy->kobj; - cmp = &policy->kobj_unregister; - up_write(&policy->rwsem); - kobject_put(kobj); - - /* - * We need to make sure that the underlying kobj is - * actually not referenced anymore by anybody before we - * proceed with unloading. - */ - pr_debug("waiting for dropping of refcount\n"); - wait_for_completion(cmp); - pr_debug("wait complete\n"); -} - static void cpufreq_policy_free(struct cpufreq_policy *policy) { + struct device *dev = get_cpu_device(policy->cpu); unsigned long flags; int cpu; @@ -1224,6 +1278,11 @@ static void cpufreq_policy_free(struct cpufreq_policy *policy) per_cpu(cpufreq_cpu_data, cpu) = NULL; write_unlock_irqrestore(&cpufreq_driver_lock, flags); + dev_pm_qos_remove_notifier(dev, &policy->nb_max, + DEV_PM_QOS_MAX_FREQUENCY); + dev_pm_qos_remove_notifier(dev, &policy->nb_min, + DEV_PM_QOS_MIN_FREQUENCY); + cpufreq_policy_put_kobj(policy); free_cpumask_var(policy->real_cpus); free_cpumask_var(policy->related_cpus); @@ -2285,6 +2344,8 @@ int cpufreq_set_policy(struct cpufreq_policy *policy, struct cpufreq_policy *new_policy) { struct cpufreq_governor *old_gov; + struct device *cpu_dev = get_cpu_device(policy->cpu); + unsigned long min, max; int ret; pr_debug("setting new policy for CPU %u: %u - %u kHz\n", @@ -2299,11 +2360,27 @@ int cpufreq_set_policy(struct cpufreq_policy *policy, if (new_policy->min > new_policy->max) return -EINVAL; + /* + * PM QoS framework collects all the requests from users and provide us + * the final aggregated value here. + */ + min = dev_pm_qos_read_value(cpu_dev, DEV_PM_QOS_MIN_FREQUENCY); + max = dev_pm_qos_read_value(cpu_dev, DEV_PM_QOS_MAX_FREQUENCY); + + if (min > new_policy->min) + new_policy->min = min; + if (max < new_policy->max) + new_policy->max = max; + /* verify the cpu speed can be set within this limit */ ret = cpufreq_driver->verify(new_policy); if (ret) return ret; + /* + * The notifier-chain shall be removed once all the users of + * CPUFREQ_ADJUST are moved to use the QoS framework. + */ /* adjust if necessary - all reasons */ blocking_notifier_call_chain(&cpufreq_policy_notifier_list, CPUFREQ_ADJUST, new_policy); diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index d01a74fbc4db..d8622cf3f46c 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -147,6 +147,9 @@ struct cpufreq_policy { /* Pointer to the cooling device if used for thermal mitigation */ struct thermal_cooling_device *cdev; + + struct notifier_block nb_min; + struct notifier_block nb_max; }; struct cpufreq_freqs { From patchwork Thu Jun 20 07:35:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 167302 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp1725471ilk; Thu, 20 Jun 2019 00:36:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqwNHvseMQdIs46/dDn7zQK88VBbprfgitudobH//XIpl320v9IgVvDy/6mbR4YYBDGgjfKS X-Received: by 2002:a17:90a:2562:: with SMTP id j89mr1619605pje.123.1561016165853; Thu, 20 Jun 2019 00:36:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561016165; cv=none; d=google.com; s=arc-20160816; b=ZeUxMtbjdRBTaWHNVWubWG4syqurf1yY8bG9zo3jKhVHvUFxzWpt5aCva13tNGBfwt cvLaX8J06ik/8qE9cLs506Tj5zHi4HRAwXQh3Pfn3WbSz4QZClc6O0eBgouUl4wr/c/s mR3UfDQ6NMk5xc11w2vOP6D9M6VmXhu7n4NxssO1ly/IkIyRSLxUgl31NWd0bnY7FnKw nlmbMZ8n6e1b25dUn9IBIqT8Xr7k271p1/+iuqa2DnRsVqzYx4u+xyYLvrVfXAjKOLae 8f9PmYeqzYDuplRY49DQtwEGil1X7fQ2rR4SgUxedbiT5y/r/BxFhPlSsV/8Jlsy7mWl mjfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=3L+AYr9wx391racengGEmm+lT+bdqXhQKRHKGNTBvxQ=; b=jMJwYmNkmyiNhWM4rEcg4bLQvM7YYXa+IoGurthC1TNSjohtXGb9YR68wNC046+9nT yx/BxjOcQq9lVE7NBIMHiWo1WnuqctB8fhef+bDXFzwl60HZZZCXni2pfhDlGwEA0D+x LwnlqZ+tCF9YDD/oqfC09tZ8XHU3exvv+Mcz38MsWr9A88QgfSRRCshOt36HH+ibYrun d7f9Jw10fzbRzdlfJvjup4WqrKk9YAjMwqWKPD5kD+0z5t8MSRiFeZ3HqbGpfaQjtI27 z/VO032CjbjS6ccQyNq1lxR8S6F6EisyPYIa5BvsiRdPMQfjuG7PRvV0+uKc1UbL2sNb 4zAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zu1fg8kg; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p62si3416368pjp.66.2019.06.20.00.36.05; Thu, 20 Jun 2019 00:36:05 -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=@linaro.org header.s=google header.b=zu1fg8kg; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730885AbfFTHgD (ORCPT + 30 others); Thu, 20 Jun 2019 03:36:03 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:37665 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730842AbfFTHf7 (ORCPT ); Thu, 20 Jun 2019 03:35:59 -0400 Received: by mail-pg1-f195.google.com with SMTP id 145so1120554pgh.4 for ; Thu, 20 Jun 2019 00:35:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3L+AYr9wx391racengGEmm+lT+bdqXhQKRHKGNTBvxQ=; b=zu1fg8kg7hEc8Jjw0MVXRCmifTHxWow3WTVmw9QFiG8FO9FDwNLSi8vWXr2ClfwSm6 SUCsYlWTCLjYXePNm8WIq3U2fVNeotMHnimkHdqbnmjLMT3iHWU836r3URFDCQnz6xgy 0XAy1bYWI/WZdjuz0pOACjj2qRRUHgmbCDs4ObCSIsqLAq298Q+jfZyaM9wiMoE2O28l Ae1vwwarnxTn0njvqBT54dUJmJZN5xzkUvVhH6KfThkU6f8zRSzeVOEWe7MFCQAYmJEB PUr1z9lQpmhj19vNO3nAYHodWIXVUekO5fS20t0S01enlqzEMqs1uiJoXo5h8i8gFHrv 1WGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3L+AYr9wx391racengGEmm+lT+bdqXhQKRHKGNTBvxQ=; b=TiwscL447xYvDZoyXtq/uT8erJqYf9kem/4kwgtx7UFcoCxK+hbj8TS8SdRSFS/Zgb aQTQMpd+hy6X198x2vQrXAUGhIr0c9o6w12PyDWl7kt7kZlxr5mBQ3CgXgcYphncRsnb YxcpjR2Fzosvz2/xWVAcry2yj/q0sd/UHjpMlJe2Edmx2mB/sr9tcEaPZbMg1kgHXQ8o xBOclLN5diBW9XY9koU+fX9NtnGVHL2Y9o/B4gV6gezSR4YZdXjH8WRZMrpYxDT2KSkp 9LziqGzi9fRn916FmL2cQJd24Q4XGqY1CsO7FwCGP17MGQzHmHFDgxumV0HYiQCwe4hN aWaA== X-Gm-Message-State: APjAAAWEycOqSNGlc80xyjOCQKfhEzzj7op1ct2TV/fEdpSNIGdVXxfF K8mKWEfmmI3+65J1asJJuucV+Ai0E0I= X-Received: by 2002:a17:90a:21cc:: with SMTP id q70mr1719543pjc.56.1561016158823; Thu, 20 Jun 2019 00:35:58 -0700 (PDT) Received: from localhost ([122.172.66.84]) by smtp.gmail.com with ESMTPSA id p67sm10475789pfg.124.2019.06.20.00.35.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Jun 2019 00:35:58 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , Qais.Yousef@arm.com, mka@chromium.org, juri.lelli@gmail.com, Ulf Hansson , linux-kernel@vger.kernel.org Subject: [PATCH V4 6/6] cpufreq: Add QoS requests for userspace constraints Date: Thu, 20 Jun 2019 13:05:29 +0530 Message-Id: <9495cc2133740450884c9c79a89a3b9fd5ae6969.1561014965.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.21.0.rc0.269.g1a574e7a288b In-Reply-To: References: MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This implements QoS requests to manage userspace configuration of min and max frequency. Reviewed-by: Matthias Kaehlcke Reviewed-by: Ulf Hansson Signed-off-by: Viresh Kumar --- drivers/cpufreq/cpufreq.c | 87 ++++++++++++++++++++------------------- include/linux/cpufreq.h | 8 +--- 2 files changed, 46 insertions(+), 49 deletions(-) -- 2.21.0.rc0.269.g1a574e7a288b diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index b47a6c094171..5d050b4a3806 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -718,23 +718,15 @@ static ssize_t show_scaling_cur_freq(struct cpufreq_policy *policy, char *buf) static ssize_t store_##file_name \ (struct cpufreq_policy *policy, const char *buf, size_t count) \ { \ - int ret, temp; \ - struct cpufreq_policy new_policy; \ + unsigned long val; \ + int ret; \ \ - memcpy(&new_policy, policy, sizeof(*policy)); \ - new_policy.min = policy->user_policy.min; \ - new_policy.max = policy->user_policy.max; \ - \ - ret = sscanf(buf, "%u", &new_policy.object); \ + ret = sscanf(buf, "%lu", &val); \ if (ret != 1) \ return -EINVAL; \ \ - temp = new_policy.object; \ - ret = cpufreq_set_policy(policy, &new_policy); \ - if (!ret) \ - policy->user_policy.object = temp; \ - \ - return ret ? ret : count; \ + ret = dev_pm_qos_update_request(policy->object##_freq_req, val);\ + return ret >= 0 ? count : ret; \ } store_one(scaling_min_freq, min); @@ -1126,8 +1118,6 @@ static void reeval_frequency_limits(struct cpufreq_policy *policy) new_policy = *policy; pr_debug("updating policy for CPU %u\n", policy->cpu); - new_policy.min = policy->user_policy.min; - new_policy.max = policy->user_policy.max; cpufreq_set_policy(policy, &new_policy); } @@ -1237,6 +1227,12 @@ static struct cpufreq_policy *cpufreq_policy_alloc(unsigned int cpu) goto err_min_qos_notifier; } + policy->min_freq_req = kzalloc(2 * sizeof(*policy->min_freq_req), + GFP_KERNEL); + if (!policy->min_freq_req) + goto err_max_qos_notifier; + + policy->max_freq_req = policy->min_freq_req + 1; INIT_LIST_HEAD(&policy->policy_list); init_rwsem(&policy->rwsem); spin_lock_init(&policy->transition_lock); @@ -1247,6 +1243,9 @@ static struct cpufreq_policy *cpufreq_policy_alloc(unsigned int cpu) policy->cpu = cpu; return policy; +err_max_qos_notifier: + dev_pm_qos_remove_notifier(dev, &policy->nb_max, + DEV_PM_QOS_MAX_FREQUENCY); err_min_qos_notifier: dev_pm_qos_remove_notifier(dev, &policy->nb_min, DEV_PM_QOS_MIN_FREQUENCY); @@ -1282,6 +1281,9 @@ static void cpufreq_policy_free(struct cpufreq_policy *policy) DEV_PM_QOS_MAX_FREQUENCY); dev_pm_qos_remove_notifier(dev, &policy->nb_min, DEV_PM_QOS_MIN_FREQUENCY); + dev_pm_qos_remove_request(policy->max_freq_req); + dev_pm_qos_remove_request(policy->min_freq_req); + kfree(policy->min_freq_req); cpufreq_policy_put_kobj(policy); free_cpumask_var(policy->real_cpus); @@ -1360,16 +1362,30 @@ static int cpufreq_online(unsigned int cpu) cpumask_and(policy->cpus, policy->cpus, cpu_online_mask); if (new_policy) { - policy->user_policy.min = policy->min; - policy->user_policy.max = policy->max; + struct device *dev = get_cpu_device(cpu); for_each_cpu(j, policy->related_cpus) { per_cpu(cpufreq_cpu_data, j) = policy; add_cpu_dev_symlink(policy, j); } - } else { - policy->min = policy->user_policy.min; - policy->max = policy->user_policy.max; + + ret = dev_pm_qos_add_request(dev, policy->min_freq_req, + DEV_PM_QOS_MIN_FREQUENCY, + policy->min); + if (ret < 0) { + dev_err(dev, "Failed to add min-freq constraint (%d)\n", + ret); + goto out_destroy_policy; + } + + ret = dev_pm_qos_add_request(dev, policy->max_freq_req, + DEV_PM_QOS_MAX_FREQUENCY, + policy->max); + if (ret < 0) { + dev_err(dev, "Failed to add max-freq constraint (%d)\n", + ret); + goto out_destroy_policy; + } } if (cpufreq_driver->get && has_target()) { @@ -2345,7 +2361,6 @@ int cpufreq_set_policy(struct cpufreq_policy *policy, { struct cpufreq_governor *old_gov; struct device *cpu_dev = get_cpu_device(policy->cpu); - unsigned long min, max; int ret; pr_debug("setting new policy for CPU %u: %u - %u kHz\n", @@ -2353,24 +2368,12 @@ int cpufreq_set_policy(struct cpufreq_policy *policy, memcpy(&new_policy->cpuinfo, &policy->cpuinfo, sizeof(policy->cpuinfo)); - /* - * This check works well when we store new min/max freq attributes, - * because new_policy is a copy of policy with one field updated. - */ - if (new_policy->min > new_policy->max) - return -EINVAL; - /* * PM QoS framework collects all the requests from users and provide us * the final aggregated value here. */ - min = dev_pm_qos_read_value(cpu_dev, DEV_PM_QOS_MIN_FREQUENCY); - max = dev_pm_qos_read_value(cpu_dev, DEV_PM_QOS_MAX_FREQUENCY); - - if (min > new_policy->min) - new_policy->min = min; - if (max < new_policy->max) - new_policy->max = max; + new_policy->min = dev_pm_qos_read_value(cpu_dev, DEV_PM_QOS_MIN_FREQUENCY); + new_policy->max = dev_pm_qos_read_value(cpu_dev, DEV_PM_QOS_MAX_FREQUENCY); /* verify the cpu speed can be set within this limit */ ret = cpufreq_driver->verify(new_policy); @@ -2459,10 +2462,9 @@ int cpufreq_set_policy(struct cpufreq_policy *policy, * @cpu: CPU to re-evaluate the policy for. * * Update the current frequency for the cpufreq policy of @cpu and use - * cpufreq_set_policy() to re-apply the min and max limits saved in the - * user_policy sub-structure of that policy, which triggers the evaluation - * of policy notifiers and the cpufreq driver's ->verify() callback for the - * policy in question, among other things. + * cpufreq_set_policy() to re-apply the min and max limits, which triggers the + * evaluation of policy notifiers and the cpufreq driver's ->verify() callback + * for the policy in question, among other things. */ void cpufreq_update_policy(unsigned int cpu) { @@ -2522,10 +2524,9 @@ static int cpufreq_boost_set_sw(int state) break; } - down_write(&policy->rwsem); - policy->user_policy.max = policy->max; - cpufreq_governor_limits(policy); - up_write(&policy->rwsem); + ret = dev_pm_qos_update_request(policy->max_freq_req, policy->max); + if (ret) + break; } return ret; diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index d8622cf3f46c..b6245f512a26 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -50,11 +50,6 @@ struct cpufreq_cpuinfo { unsigned int transition_latency; }; -struct cpufreq_user_policy { - unsigned int min; /* in kHz */ - unsigned int max; /* in kHz */ -}; - struct cpufreq_policy { /* CPUs sharing clock, require sw coordination */ cpumask_var_t cpus; /* Online CPUs only */ @@ -84,7 +79,8 @@ struct cpufreq_policy { struct work_struct update; /* if update_policy() needs to be * called, but you're in IRQ context */ - struct cpufreq_user_policy user_policy; + struct dev_pm_qos_request *min_freq_req; + struct dev_pm_qos_request *max_freq_req; struct cpufreq_frequency_table *freq_table; enum cpufreq_table_sorting freq_table_sorted;