From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A8706C43387 for ; Fri, 4 Jan 2019 10:40:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 757C8206BB for ; Fri, 4 Jan 2019 10:40:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726122AbfADKkM (ORCPT ); Fri, 4 Jan 2019 05:40:12 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:39788 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726028AbfADKkL (ORCPT ); Fri, 4 Jan 2019 05:40:11 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E78EB15AD; Fri, 4 Jan 2019 02:40:10 -0800 (PST) Received: from [10.1.194.37] (e113632-lin.cambridge.arm.com [10.1.194.37]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id CE0B03F575; Fri, 4 Jan 2019 02:40:08 -0800 (PST) Subject: Re: [PATCH] cpufreq: scpi/scmi: Fix freeing of dynamic OPPs To: Viresh Kumar , Sudeep Holla , "Rafael J. Wysocki" , Nishanth Menon , Stephen Boyd Cc: linux-pm@vger.kernel.org, Vincent Guittot , quentin.perret@arm.com, dietmar.eggemann@arm.com, Douglas.Raillard@arm.com, "4 . 20" , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <7dddbeabb434225d9b3d02600ea4a2313622ca26.1546594910.git.viresh.kumar@linaro.org> From: Valentin Schneider Message-ID: <96b57b5b-7c6f-2118-05a0-8a568d7cb245@arm.com> Date: Fri, 4 Jan 2019 10:40:07 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <7dddbeabb434225d9b3d02600ea4a2313622ca26.1546594910.git.viresh.kumar@linaro.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org Hi, On 04/01/2019 09:44, Viresh Kumar wrote: > Since the commit 2a4eb7358aba ("OPP: Don't remove dynamic OPPs from > _dev_pm_opp_remove_table()"), dynamically created OPP aren't > automatically removed anymore by dev_pm_opp_cpumask_remove_table(). This > affects the scpi and scmi cpufreq drivers which no longer free OPPs on > failures or on invocations of the policy->exit() callback. > > Create a generic OPP helper dev_pm_opp_remove_all_dynamic() which can be > called from these drivers instead of dev_pm_opp_cpumask_remove_table(). > > In dev_pm_opp_remove_all_dynamic(), we need to make sure that the > opp_list isn't getting accessed simultaneously from other parts of the > OPP core while the helper is freeing dynamic OPPs, i.e. we can't drop > the opp_table->lock while traversing through the OPP list. And to > accomplish that, this patch also creates _opp_kref_release_unlocked() > which can be called from this new helper with the opp_table lock already > held. > > Cc: 4.20 # v4.20 > Reported-by: Valentin Schneider > Fixes: 2a4eb7358aba ("OPP: Don't remove dynamic OPPs from _dev_pm_opp_remove_table()") > Signed-off-by: Viresh Kumar Gave it a spin on my Juno, and I don't see the refcount warning anymore so: Tested-by: Valentin Schneider Thanks for having a look at this. [...]