Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760200AbcCDWTA (ORCPT ); Fri, 4 Mar 2016 17:19:00 -0500 Received: from mail-qg0-f47.google.com ([209.85.192.47]:35837 "EHLO mail-qg0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758796AbcCDWS5 (ORCPT ); Fri, 4 Mar 2016 17:18:57 -0500 Subject: Re: [PATCH v2 6/10] cpufreq: Support for fast frequency switching To: "Rafael J. Wysocki" , Linux PM list References: <2495375.dFbdlAZmA6@vostro.rjw.lan> <2409306.qzzMXcm4dm@vostro.rjw.lan> <15684081.T4iOMUSHCY@vostro.rjw.lan> Cc: Juri Lelli , ACPI Devel Maling List , Linux Kernel Mailing List , Peter Zijlstra , Srinivas Pandruvada , Viresh Kumar , Vincent Guittot , Michael Turquette , Ingo Molnar From: Steve Muckle X-Enigmail-Draft-Status: N1110 Message-ID: <56DA09B1.4010005@linaro.org> Date: Fri, 4 Mar 2016 14:18:25 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <15684081.T4iOMUSHCY@vostro.rjw.lan> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1472 Lines: 36 On 03/03/2016 07:07 PM, Rafael J. Wysocki wrote: > +void cpufreq_driver_fast_switch(struct cpufreq_policy *policy, > + unsigned int target_freq, unsigned int relation) > +{ > + unsigned int freq; > + > + freq = cpufreq_driver->fast_switch(policy, target_freq, relation); > + if (freq != CPUFREQ_ENTRY_INVALID) { > + policy->cur = freq; > + trace_cpu_frequency(freq, smp_processor_id()); > + } > +} Even if there are platforms which may change the CPU frequency behind cpufreq's back, breaking the transition notifiers, I'm worried about the addition of an interface which itself breaks them. The platforms which do change CPU frequency on their own have probably evolved to live with or work around this behavior. As other platforms migrate to fast frequency switching they might be surprised when things don't work as advertised. I'm not sure what the easiest way to deal with this is. I see the transition notifiers are the srcu type, which I understand to be blocking. Going through the tree and reworking everyone's callbacks and changing the type to atomic is obviously not realistic. How about modifying cpufreq_register_notifier to return an error if the driver has a fast_switch callback installed and an attempt to register a transition notifier is made? In the future, perhaps an additional atomic transition callback type can be added, which platform/driver owners can switch to if they wish to use fast transitions with their platform. thanks, Steve