From patchwork Wed Oct 8 07:48:53 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Turquette X-Patchwork-Id: 5051911 Return-Path: X-Original-To: patchwork-linux-arm-msm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 665B1C11AB for ; Wed, 8 Oct 2014 07:49:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 778C620200 for ; Wed, 8 Oct 2014 07:49:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9B3C8201FB for ; Wed, 8 Oct 2014 07:49:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754228AbaJHHtb (ORCPT ); Wed, 8 Oct 2014 03:49:31 -0400 Received: from mail-pa0-f42.google.com ([209.85.220.42]:32847 "EHLO mail-pa0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754594AbaJHHt3 (ORCPT ); Wed, 8 Oct 2014 03:49:29 -0400 Received: by mail-pa0-f42.google.com with SMTP id bj1so8661018pad.15 for ; Wed, 08 Oct 2014 00:49:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=yykRJ4f11Z7o7P5rKGYh6DU5H3a7RuYWWHxR9iZtvWM=; b=k08kEDpwnDWn9ICg2Z1W9TePd1D8hIuc5YJ4YZXpo2OdWlpNATEufquxACCRGHLn0H odqBlsv63cX3JYwaGEeJCtuikULigG42ICaabDSGmBvSdPf0ZYCjcjlkxDxSS7fN9ZhA Nt+8OPoo4kI0CndaIQe2LEiuZditLP3qJ6C4zLHg8e16IKZmJz/IPwGDAS9ziCnEyyN8 TjKvYZSLXlbafX1SU5fhBOuKcd4fLY9vo+ew2fsrYpkafDi+7LPUnKh+xbZUFcCJovdd LhWBdysNAQbIadvJ3tlTAv3xoOWgcDrjSPiH8EbMk3MiC1OVb2Qv47un4wmOx3BBbzNp q2Zw== X-Gm-Message-State: ALoCoQmoRIPir6HT+c7FUnTvuvWre03X0XIgOMjR7mstWUiPdXwTbNaUOJSJ2yUJFEhI8+8RJY0A X-Received: by 10.68.171.33 with SMTP id ar1mr2420235pbc.148.1412754568673; Wed, 08 Oct 2014 00:49:28 -0700 (PDT) Received: from quantum.home (pool-108-47-66-231.lsanca.fios.verizon.net. [108.47.66.231]) by mx.google.com with ESMTPSA id on3sm15663577pdb.71.2014.10.08.00.49.26 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 08 Oct 2014 00:49:28 -0700 (PDT) From: Mike Turquette To: viresh.kumar@linaro.org Cc: thomas.petazzoni@free-electrons.com, rjw@rjwysocki.net, linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, shawn.guo@linaro.org, sboyd@codeaurora.org, linux-arm-msm@vger.kernel.org, spk.linux@gmail.com, pramod.gurav@smartplayin.com, rob.herring@linaro.org, ezequiel.garcia@free-electrons.com, tawfik@marvell.com, nadavh@marvell.com, alior@marvell.com, morten.rasmussen@arm.com, dietmar.eggemann@arm.com, vincent.guittot@linaro.org, nicolas.pitre@linaro.org, linux-kernel@vger.kernel.org, tuukka.tikkanen@linaro.org, Mike Turquette Subject: [PATCH 1/2] cpufreq: add driver flag for sleepable transitions Date: Wed, 8 Oct 2014 00:48:53 -0700 Message-Id: <1412754534-14068-2-git-send-email-mturquette@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1412754534-14068-1-git-send-email-mturquette@linaro.org> References: <1412754534-14068-1-git-send-email-mturquette@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The CPUfreq core does not differentiate between .target & .target_index callbacks that may sleep or block and callbacks that are fast and return immediately. To date this has not mattered much since the typical CPUfreq governor calls the .target callback from process context via a workqueue. When calling the .target callback from a different context, such as a scheduler load balance operation (see Morten's "energy aware scheduler" RFC[0]), this detail matters. This patch introduces a new CPUfreq driver flag for fast .target callbacks that are guaranteed to neither sleep nor block. Setting this flag allows for .target to be called from schedule() and other call sites that have interrupts disabled or other constraints. Drivers may set CPUFREQ_NO_SLEEP at driver registration-time. The default is to not have this flag set, resulting in the need to defer calls to .target and .target_index. [0] http://lkml.kernel.org/r/<1381511957-29776-7-git-send-email-morten.rasmussen@arm.com> Signed-off-by: Mike Turquette --- include/linux/cpufreq.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index 138336b..9034573 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -308,6 +308,19 @@ struct cpufreq_driver { */ #define CPUFREQ_NEED_INITIAL_FREQ_CHECK (1 << 5) +/* + * Set by drivers whose .target or .target_index callback will never sleep or + * block. Setting this flag allows for more optimal code by calling .target + * from a context that otherwise would require deferring the work. + * + * An example use of this flag is when scaling cpu frequency from within a call + * to schedule() with interrupts disabled and runqueue locks held. + * + * This flag is not set by default, causing calls to .target to be done in + * process context. + */ +#define CPUFREQ_NO_SLEEP (1 << 6) + int cpufreq_register_driver(struct cpufreq_driver *driver_data); int cpufreq_unregister_driver(struct cpufreq_driver *driver_data);