Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751690AbcCCGAX (ORCPT ); Thu, 3 Mar 2016 01:00:23 -0500 Received: from mail-pa0-f46.google.com ([209.85.220.46]:34852 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750928AbcCCGAV (ORCPT ); Thu, 3 Mar 2016 01:00:21 -0500 Date: Thu, 3 Mar 2016 11:30:03 +0530 From: Viresh Kumar To: "Rafael J. Wysocki" Cc: Linux PM list , Juri Lelli , Steve Muckle , ACPI Devel Maling List , Linux Kernel Mailing List , Peter Zijlstra , Srinivas Pandruvada , Vincent Guittot , Michael Turquette Subject: Re: [PATCH 5/6] cpufreq: Support for fast frequency switching Message-ID: <20160303060003.GJ2891@vireshk-i7> References: <2495375.dFbdlAZmA6@vostro.rjw.lan> <26020775.9hJG2SHiH2@vostro.rjw.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <26020775.9hJG2SHiH2@vostro.rjw.lan> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1855 Lines: 51 On 02-03-16, 03:12, Rafael J. Wysocki wrote: > Index: linux-pm/drivers/cpufreq/cpufreq.c > =================================================================== > --- linux-pm.orig/drivers/cpufreq/cpufreq.c > +++ linux-pm/drivers/cpufreq/cpufreq.c > @@ -1772,6 +1772,39 @@ EXPORT_SYMBOL(cpufreq_unregister_notifie > * GOVERNORS * > *********************************************************************/ > > +/** > + * cpufreq_driver_fast_switch - Carry out a fast CPU frequency switch. > + * @policy: cpufreq policy to switch the frequency for. > + * @target_freq: New frequency to set (may be approximate). > + * @relation: Relation to use for frequency selection. > + * > + * Carry out a fast frequency switch from interrupt context. > + * > + * This function must not be called if policy->fast_switch_possible is unset. > + * > + * Governors calling this function must guarantee that it will never be invoked > + * twice in parallel for the same policy and that it will never be called in > + * parallel with either ->target() or ->target_index() for the same policy. > + * > + * If CPUFREQ_ENTRY_INVALID is returned by the driver's ->fast_switch() > + * callback, the hardware configuration must be preserved. > + */ > +void cpufreq_driver_fast_switch(struct cpufreq_policy *policy, > + unsigned int target_freq, unsigned int relation) > +{ > + unsigned int freq; > + > + if (target_freq == policy->cur) Maybe an unlikely() here ? > + return; > + > + freq = cpufreq_driver->fast_switch(policy, target_freq, relation); > + if (freq != CPUFREQ_ENTRY_INVALID) { > + policy->cur = freq; Hmm.. What will happen to the code relying on the cpufreq-notifiers now ? > + trace_cpu_frequency(freq, smp_processor_id()); > + } > +} > +EXPORT_SYMBOL_GPL(cpufreq_driver_fast_switch); -- viresh