Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932274AbcCPPpF (ORCPT ); Wed, 16 Mar 2016 11:45:05 -0400 Received: from [198.137.202.9] ([198.137.202.9]:50363 "EHLO bombadil.infradead.org" rhost-flags-FAIL-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1753431AbcCPPpC (ORCPT ); Wed, 16 Mar 2016 11:45:02 -0400 Date: Wed, 16 Mar 2016 16:43:14 +0100 From: Peter Zijlstra To: "Rafael J. Wysocki" Cc: Linux PM list , Juri Lelli , Steve Muckle , ACPI Devel Maling List , Linux Kernel Mailing List , Srinivas Pandruvada , Viresh Kumar , Vincent Guittot , Michael Turquette , Ingo Molnar Subject: Re: [PATCH v4 6/7] cpufreq: Support for fast frequency switching Message-ID: <20160316154314.GB6344@twins.programming.kicks-ass.net> References: <1711281.bPmSjlBT7c@vostro.rjw.lan> <1989596.XAKfhFj1lz@vostro.rjw.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1989596.XAKfhFj1lz@vostro.rjw.lan> User-Agent: Mutt/1.5.21 (2012-12-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1448 Lines: 44 On Wed, Mar 16, 2016 at 03:52:28PM +0100, Rafael J. Wysocki wrote: > +void cpufreq_enable_fast_switch(struct cpufreq_policy *policy) > +{ > + mutex_lock(&cpufreq_fast_switch_lock); > + if (policy->fast_switch_possible && cpufreq_fast_switch_count >= 0) { > + cpufreq_fast_switch_count++; > + policy->fast_switch_enabled = true; > + } else { > + pr_warn("cpufreq: CPU%u: Fast freqnency switching not enabled\n", > + policy->cpu); This happens because there's transition notifiers, right? Would it make sense to iterate the notifier here and print the notifier function symbol for each? That way we've got a clue as to where to start looking when this happens. > + } > + mutex_unlock(&cpufreq_fast_switch_lock); > +} > @@ -1653,8 +1703,18 @@ int cpufreq_register_notifier(struct not > > switch (list) { > case CPUFREQ_TRANSITION_NOTIFIER: > + mutex_lock(&cpufreq_fast_switch_lock); > + > + if (cpufreq_fast_switch_count > 0) { > + mutex_unlock(&cpufreq_fast_switch_lock); So while theoretically (it has a return code) cpufreq_register_notifier() could fail, it never actually did. Now we do. Do we want to add a WARN here? > + return -EPERM; > + } > ret = srcu_notifier_chain_register( > &cpufreq_transition_notifier_list, nb); > + if (!ret) > + cpufreq_fast_switch_count--; > + > + mutex_unlock(&cpufreq_fast_switch_lock); > break; > case CPUFREQ_POLICY_NOTIFIER: > ret = blocking_notifier_chain_register(