Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp6681815ybl; Mon, 23 Dec 2019 09:52:25 -0800 (PST) X-Google-Smtp-Source: APXvYqzmhJYJhsLVUAEiGQjqnAF0CKWoTHZ+na1kLCytJK8mGIDJTqbQ4AmxjQrSuB83XjLXA7TY X-Received: by 2002:a05:6830:1e37:: with SMTP id t23mr34308840otr.16.1577123545559; Mon, 23 Dec 2019 09:52:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577123545; cv=none; d=google.com; s=arc-20160816; b=TwR9Kyflwv8jGt5K8Ioe0I5Uw4l8AdyT5dsg0sfT/kresYF1qx130pJExbqpjFX+4C w9wqWfLgce4FfHePqkFRSd/RBg6zBV6ZKpvCTYqjN3GN6hIrIHBdx3rZwo/xhZV1G/xY AuIT5/88ontREfb7M7GqqcAIuSfpGPZ0GVIgsBlDsKBdaaL1kCL6hV+lKJ6yXufq885u AETcQCV8SuTCpziwKmzCqw/bU2hxBC7mtFyPQsMWmI8pGV2ckc9Uf4U1CbIipGsOe6kq FKF54Y9rIIMK46HI1HYMH8NMbhjZGfND3/Km5mJa6uNXDHpoktYFRLFNfwqTbkp3kmJT sKJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=F+ZQvooYVt7R1v0BhmmHaTyG7LVa401DMLp6GNJP1co=; b=MGr1Lwuf7TeimxiA7gAx0qPunGTF9C7IlwR3O/8ONVUDEfRQ8gNsv067lS2TQpS3O6 sOFG8/xsUrU1VOfg+HBCpVeoFIpB0aWpW8ZKWVT51pgnZCLY4JVTvElixx20MA4ceXdM RITrlkY0hQLGwXj4N6BoZjWl3Hb49j4SlSk6sJJL2A6iblmB7oQ/UIQCMuRcI2z4iMmg pGYZQe8jSo0u7fMM+h8EPzVUKcq6csg1cwUuTfaxO5Hhqsrw8UzdyMB1ZFwoichI+1cZ 46uinOftIPy8ovezvn6+H/8M0wqbEQtzLI1P07SsgN5CaHV0vAC5lkntXRtF9vp4LfQc 1oWg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w2si10172966otq.31.2019.12.23.09.52.13; Mon, 23 Dec 2019 09:52:25 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726861AbfLWRuX (ORCPT + 99 others); Mon, 23 Dec 2019 12:50:23 -0500 Received: from foss.arm.com ([217.140.110.172]:47474 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726754AbfLWRuX (ORCPT ); Mon, 23 Dec 2019 12:50:23 -0500 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 52FCF1FB; Mon, 23 Dec 2019 09:50:22 -0800 (PST) Received: from localhost (e108754-lin.cambridge.arm.com [10.1.198.81]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E55103F68F; Mon, 23 Dec 2019 09:50:21 -0800 (PST) Date: Mon, 23 Dec 2019 17:50:20 +0000 From: Ionela Voinescu To: Thara Gopinath Cc: mingo@redhat.com, peterz@infradead.org, vincent.guittot@linaro.org, rui.zhang@intel.com, qperret@google.com, daniel.lezcano@linaro.org, viresh.kumar@linaro.org, linux-kernel@vger.kernel.org, amit.kachhap@gmail.com, javi.merino@kernel.org, amit.kucheria@verdurent.com Subject: Re: [Patch v6 3/7] Add infrastructure to store and update instantaneous thermal pressure Message-ID: <20191223175005.GA31446@arm.com> References: <1576123908-12105-1-git-send-email-thara.gopinath@linaro.org> <1576123908-12105-4-git-send-email-thara.gopinath@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1576123908-12105-4-git-send-email-thara.gopinath@linaro.org> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Thara, On Wednesday 11 Dec 2019 at 23:11:44 (-0500), Thara Gopinath wrote: > Add architecture specific APIs to update and track thermal pressure on a > per cpu basis. A per cpu variable thermal_pressure is introduced to keep > track of instantaneous per cpu thermal pressure. Thermal pressure is the > delta between maximum capacity and capped capacity due to a thermal event. > capacity and capped capacity due to a thermal event. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This line seems to be a duplicate (initially I thought I was seeing double :) ). > topology_get_thermal_pressure can be hooked into the scheduler specified > arch_scale_thermal_capacity to retrieve instantaneius thermal pressure of > a cpu. > > arch_set_thermal_presure can be used to update the thermal pressure by > providing a capped maximum capacity. > > Considering topology_get_thermal_pressure reads thermal_pressure and > arch_set_thermal_pressure writes into thermal_pressure, one can argue for > some sort of locking mechanism to avoid a stale value. But considering > topology_get_thermal_pressure_average can be called from a system critical > path like scheduler tick function, a locking mechanism is not ideal. This > means that it is possible the thermal_pressure value used to calculate > average thermal pressure for a cpu can be stale for upto 1 tick period. > > Signed-off-by: Thara Gopinath [...] > diff --git a/arch/arm/include/asm/topology.h b/arch/arm/include/asm/topology.h > index 8a0fae9..90b18c3 100644 > --- a/arch/arm/include/asm/topology.h > +++ b/arch/arm/include/asm/topology.h > @@ -16,6 +16,9 @@ > /* Enable topology flag updates */ > #define arch_update_cpu_topology topology_update_cpu_topology > > +/* Replace task scheduler's defalut thermal pressure retrieve API */ s/defalut/default > +#define arch_scale_thermal_capacity topology_get_thermal_pressure > + I also think this is deserving of a better name. I would drop the 'scale' part as well as it is not used as a scale factor, as freq_scale or cpu_scale, but it's used as a reduction in capacity (thermal capacity pressure) due to a thermal event. It might be too much but what do you think about: arch_thermal_capacity_pressure? > #else > > static inline void init_cpu_topology(void) { } > diff --git a/arch/arm64/include/asm/topology.h b/arch/arm64/include/asm/topology.h > index a4d945d..ccb277b 100644 > --- a/arch/arm64/include/asm/topology.h > +++ b/arch/arm64/include/asm/topology.h > @@ -25,6 +25,9 @@ int pcibus_to_node(struct pci_bus *bus); > /* Enable topology flag updates */ > #define arch_update_cpu_topology topology_update_cpu_topology > > +/* Replace task scheduler's defalut thermal pressure retrieve API */ s/defalut/default Regards, Ionela.