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: 38460 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 38C6720447 for ; Wed, 8 Oct 2014 07:49:34 +0000 (UTC) Received: by mail-wi0-f200.google.com with SMTP id cc10sf3739248wib.7 for ; Wed, 08 Oct 2014 00:49:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=yykRJ4f11Z7o7P5rKGYh6DU5H3a7RuYWWHxR9iZtvWM=; b=WSZdnNafLodpH7wiJEmHJEOB4vyu303sdDiuygsuCreDYcFvChti5c3jkXRzcEYBMW hokwP1/Bj9H5sWGe264rBMYs04Q+7TZRF+PGIC+1Ia5S9flkEy91xny/UsUb4RC9T4eU LZZT527GwAhd/Fw/B/wT9KGf2D0HB9dgvTBldh3Fhkp6c3+1ibQ12GkC14h7Le5jybaw e+n6M8erT/P1UaJEa+/e1op+/ijj+W8JeIdy76Mw2WTjdznopbTl7Jc1yAd9cO8XA5l2 NjNkFoaH/q/E5D4qK42BAw3VX8rdkUD47YU6qdJqAwhyUliOYjJOhQbLXM7LkPNiGXE8 n6aw== X-Gm-Message-State: ALoCoQnLAH02Vt9dNTV/DThzFLM2IPr5MGu9ZxI4cNJz+kRZcHNw0PEnylywZHyFrFE1I6Aba3zL X-Received: by 10.152.42.229 with SMTP id r5mr108452lal.8.1412754573151; Wed, 08 Oct 2014 00:49:33 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.6.227 with SMTP id e3ls29329laa.69.gmail; Wed, 08 Oct 2014 00:49:33 -0700 (PDT) X-Received: by 10.153.4.44 with SMTP id cb12mr9566766lad.35.1412754572986; Wed, 08 Oct 2014 00:49:32 -0700 (PDT) Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com [209.85.217.181]) by mx.google.com with ESMTPS id xr2si6990653lbb.49.2014.10.08.00.49.32 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 08 Oct 2014 00:49:32 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.181 as permitted sender) client-ip=209.85.217.181; Received: by mail-lb0-f181.google.com with SMTP id l4so7452722lbv.26 for ; Wed, 08 Oct 2014 00:49:32 -0700 (PDT) X-Received: by 10.112.130.226 with SMTP id oh2mr1474278lbb.100.1412754572873; Wed, 08 Oct 2014 00:49:32 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.84.229 with SMTP id c5csp17990lbz; Wed, 8 Oct 2014 00:49:31 -0700 (PDT) X-Received: by 10.70.62.74 with SMTP id w10mr8961532pdr.70.1412754569773; Wed, 08 Oct 2014 00:49:29 -0700 (PDT) Received: from mail-pa0-f50.google.com (mail-pa0-f50.google.com [209.85.220.50]) by mx.google.com with ESMTPS id m13si4988511pdj.84.2014.10.08.00.49.28 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 08 Oct 2014 00:49:29 -0700 (PDT) Received-SPF: pass (google.com: domain of mturquette@linaro.org designates 209.85.220.50 as permitted sender) client-ip=209.85.220.50; Received: by mail-pa0-f50.google.com with SMTP id kx10so8616704pab.37 for ; Wed, 08 Oct 2014 00:49:28 -0700 (PDT) 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> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: mturquette@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.181 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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);