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=-5.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no 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 E7FEAC388F7 for ; Fri, 13 Nov 2020 12:56:06 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 75C02206D9 for ; Fri, 13 Nov 2020 12:56:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="XxGv2UcW" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 75C02206D9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=u87EVVsvfKIdSzuo0NB7lo3/Fib9MGIwN5RcKGsp+vg=; b=XxGv2UcW2mBOzJR3H4fEjJMkS WuWyX1TV5bJzf/aAcMOQZu+Fv392q57Rn4Q5P8cYXwhAYVHxn1eEUO1MOFn2YaPMDmbgwi5aALU+P D58XaBRLL1Ip7XLOayTh5vuZZ+LXXyYIvO3kfNZySgeKey1o4+k+ysSCEPpqviUiujj0vTYfFyD7a tmkNca5sAh3c8SDeQBZk8VCQJjKdBOf3YkoGfVYJes5KMmAtDhyQoKz4nKl0YsVQ02zIIFcPzfPC4 8ehn2V3xpd5RgiBn6hltTkmbSHgG9HHbTttokFN/7IVpI2OCSKrVLha6PmqY2vf8BR0zORRjYft6Q Puh7EQjIA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kdYbG-0000Ys-L2; Fri, 13 Nov 2020 12:54:46 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kdYb8-0000VV-Ik for linux-arm-kernel@lists.infradead.org; Fri, 13 Nov 2020 12:54:40 +0000 Received: from gaia (unknown [2.26.170.190]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6713E206D9; Fri, 13 Nov 2020 12:54:36 +0000 (UTC) Date: Fri, 13 Nov 2020 12:54:33 +0000 From: Catalin Marinas To: Ionela Voinescu Subject: Re: [PATCH v4 3/3] arm64: implement CPPC FFH support using AMUs Message-ID: <20201113125432.GE3212@gaia> References: <20201106125334.21570-1-ionela.voinescu@arm.com> <20201106125334.21570-4-ionela.voinescu@arm.com> <20201112180045.GO29613@gaia> <20201113122846.GA31212@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20201113122846.GA31212@arm.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201113_075438_747279_3DC0989D X-CRM114-Status: GOOD ( 24.19 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, linux-kernel@vger.kernel.org, sudeep.holla@arm.com, will@kernel.org, morten.rasmussen@arm.com, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Nov 13, 2020 at 12:28:46PM +0000, Ionela Voinescu wrote: > On Thursday 12 Nov 2020 at 18:00:46 (+0000), Catalin Marinas wrote: > > On Fri, Nov 06, 2020 at 12:53:34PM +0000, Ionela Voinescu wrote: > > > +static inline > > > +int counters_read_on_cpu(int cpu, smp_call_func_t func, u64 *val) > > > +{ > > > + if (!cpu_has_amu_feat(cpu)) > > > + return -EOPNOTSUPP; > > > + > > > + smp_call_function_single(cpu, func, val, 1); > > > + > > > + return 0; > > > +} > > > > I got lost in the cpufreq call chains. Can this function ever be called > > with interrupts disabled? > > The short answer is: not with the current implementation of its only > user, the cppc_cpufreq driver (given the current cpufreq implementation). > > The long answer is: there is a case where the cpufreq .get function is > called with local interrupts disabled - cpufreq_quick_get(), but there > are a few "if"s in between this becoming a problem: > > 1. If cppc_cpufreq ever implements .setpolicy or, > 1.1 Current implementation of cpufreq_quick_get() changes. > 2. If one of the few users of cpufreq_quick_get() is used: cppc_cpufreq > ends up being used as CPU cooling device(+IPA governor) or > devfreq/tegra30 is used. > > In this potential case, smp_call_function_single() will warn us of call > with irqs_disable() and if the stars align there could be a potential > deadlock if two CPUs try to IPI (get counter reads of) each other. > > So it could be called with irqs disabled, but a few code changes are > needed before that happens. > > I can bail out of counters_read_on_cpu() if irqs_disabled() to be on the > safe side. Thanks for the explanation. In case we forget two years from now and the core code changes, I think it's safe to bail out early with an error. You can add a patch on top of this series, no need to resend the whole. -- Catalin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel