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=-0.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 E7A50C433E1 for ; Sun, 5 Jul 2020 14:19:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BF3602068F for ; Sun, 5 Jul 2020 14:19:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726996AbgGEOT4 (ORCPT ); Sun, 5 Jul 2020 10:19:56 -0400 Received: from foss.arm.com ([217.140.110.172]:55728 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726781AbgGEOT4 (ORCPT ); Sun, 5 Jul 2020 10:19:56 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 1C87C1042; Sun, 5 Jul 2020 07:19:55 -0700 (PDT) Received: from e113632-lin (e113632-lin.cambridge.arm.com [10.1.194.46]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 377F83F718; Sun, 5 Jul 2020 07:19:53 -0700 (PDT) References: <20200614010755.9129-1-valentin.schneider@arm.com> <20200614010755.9129-2-valentin.schneider@arm.com> <20200620174912.GA18358@arm.com> User-agent: mu4e 0.9.17; emacs 26.3 From: Valentin Schneider To: Vincent Guittot Cc: Ionela Voinescu , Juri Lelli , "open list\:THERMAL" , Peter Zijlstra , Viresh Kumar , Amit Daniel Kachhap , Daniel Lezcano , Russell King , Thara Gopinath , linux-kernel , Sudeep Holla , Dietmar Eggemann , Ingo Molnar , LAK Subject: Re: [PATCH 1/3] thermal/cpu-cooling, sched/core: Cleanup thermal pressure definition In-reply-to: Date: Sun, 05 Jul 2020 15:19:44 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Sorry for getting back to this only now; On 22/06/20 09:37, Vincent Guittot wrote: > On Sun, 21 Jun 2020 at 00:28, Valentin Schneider wrote: >> On 20/06/20 18:49, Ionela Voinescu wrote: >> > On Thursday 18 Jun 2020 at 17:03:24 (+0200), Vincent Guittot wrote: >> >> Having this weak function declared in cpufreq_cooling is weird. This >> >> means that we will have to do so for each one that wants to use it. >> >> >> >> Can't you declare an empty function in a common header file ? >> > >> > Do we expect anyone other than cpufreq_cooling to call >> > arch_set_thermal_pressure()? >> > >> > I'm not against any of the options, either having it here as a week >> > default definition (same as done for arch_set_freq_scale() in cpufreq.c) >> > or in a common header (as done for arch_scale_freq_capacity() in sched.h). >> > >> >> Same thoughts here; I was going for the arch_set_freq_scale() way. >> >> > But for me, Valentin's implementation seems more natural as setters are >> > usually only called from within the framework that does the control >> > (throttling for thermal or frequency setting for cpufreq) and we >> > probably want to think twice if we want to call them from other places. >> > >> >> Well TBH I was tempted to go the other way and keep the definition in >> core.c, given a simple per-cpu value is fairly generic. More precisely, it > > Having all definitions in the same place is my main concern here. > If topology.c defines arch_set_thermal_pressure it should also provide > the empty function when the feature is not available or possible > instead of relying of each user of the interface to define a weak > function just in case. > include/linux/sched/topology.h already defines a stub for arch_scale_thermal_pressure(), I suppose we could have one for arch_set_thermal_pressure() there. That would require having something like #define arch_set_thermal_pressure topology_set_thermal_pressure in the arm & arm64 include/asm/topology.h headers, with topology_set_thermal_pressure() being what arch_set_thermal_pressure() currently is in this patchset. This would set an odd precedent in that so far we only ever had to #define getter functions, the setters being either: - entirely contained within arch_topology. (for the CPU scale) - defined in arch_topology, declared in cpufreq and contained there (for the freq scale). It made the most sense to me to follow the arch_set_freq_scale() pattern and contain the thermal pressure setter within cpufreq_cooling, especially since I didn't see a strong point in breaking the current patterns.