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 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E1047C433EF for ; Thu, 28 Oct 2021 07:20:32 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 A6FF260F70 for ; Thu, 28 Oct 2021 07:20:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A6FF260F70 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:Cc:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=gj+tPvR2PvrlT4le+WcZ2ZNEMUbtAeM6ZEiIKNOf378=; b=GXkBCJc7FDCdeFdNib7+upOz4W nGSveCLBnOuuGWOPQ2ogUObAWDLH6S4N25oLxcGZAHV3R/V9EGEMOtkP7tUI3JHzi00Oh25YSDlG5 qsdkXVLS1TAIyG1L2JivmcXoNamGn80QIOBv2JLiEtbEWFH7u1f3l02diSJ+cBGwIrIzngBSq7XTF A0s+zkqKT/rHEFFam5anjXnuzzFf2T5TZBalI3iWfK7D/Ov3fJ/YGqNnfrM7NRvGMPgaZEpkqLDc7 N1Uydq7Mm3ittKluHpNPJnfeYRfNIN4k3ulzC1HV4BxMXpbiDGira/zcBs8ZYDp9r4acY8Q/FO139 ok2EK39A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mfzgy-0075fi-Qm; Thu, 28 Oct 2021 07:19:16 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mfzgv-0075f7-6v for linux-arm-kernel@lists.infradead.org; Thu, 28 Oct 2021 07:19:14 +0000 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 965D01063; Thu, 28 Oct 2021 00:19:11 -0700 (PDT) Received: from [10.57.25.153] (unknown [10.57.25.153]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id DF1B13F73D; Thu, 28 Oct 2021 00:19:07 -0700 (PDT) Subject: Re: [PATCH v2 1/5] arch_topology: Introduce thermal pressure update function To: Viresh Kumar Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, sudeep.holla@arm.com, will@kernel.org, catalin.marinas@arm.com, linux@armlinux.org.uk, gregkh@linuxfoundation.org, rafael@kernel.org, amitk@kernel.org, daniel.lezcano@linaro.org, amit.kachhap@gmail.com, thara.gopinath@linaro.org, bjorn.andersson@linaro.org, agross@kernel.org References: <20211015144550.23719-1-lukasz.luba@arm.com> <20211015144550.23719-2-lukasz.luba@arm.com> <20211028054459.dve6s2my2tq7odem@vireshk-i7> From: Lukasz Luba Message-ID: <3e1807d3-82cd-7ade-d361-e1982a4848a9@arm.com> Date: Thu, 28 Oct 2021 08:19:05 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <20211028054459.dve6s2my2tq7odem@vireshk-i7> Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211028_001913_344072_7B59B3D8 X-CRM114-Status: GOOD ( 16.02 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 10/28/21 6:44 AM, Viresh Kumar wrote: > On 15-10-21, 15:45, Lukasz Luba wrote: >> +/** >> + * topology_thermal_pressure_update() - Update thermal pressure for CPUs >> + * @cpus : The related CPUs for which capacity has been reduced >> + * @capped_freq : The maximum allowed frequency that CPUs can run at > > Maybe replace tabs with spaces here ? Sure > >> + * >> + * Update the value of thermal pressure for all @cpus in the mask. The >> + * cpumask should include all (online+offline) affected CPUs, to avoid >> + * operating on stale data when hot-plug is used for some CPUs. The >> + * @capped_freq must be less or equal to the max possible frequency and >> + * reflects the currently allowed max CPUs frequency due to thermal capping. >> + * The @capped_freq must be provided in kHz. >> + */ >> +void topology_thermal_pressure_update(const struct cpumask *cpus, >> + unsigned long capped_freq) >> +{ >> + unsigned long max_capacity, capacity; >> + int cpu; >> + >> + if (!cpus) > > I will drop this and let the kernel crash :) OK :) > >> + return; >> + >> + cpu = cpumask_first(cpus); >> + max_capacity = arch_scale_cpu_capacity(cpu); >> + >> + /* Convert to MHz scale which is used in 'freq_factor' */ >> + capped_freq /= 1000; > > We should make sure capped_freq > freq_factor and WARN if not. This will also > get rid of similar checks at the users. OK, I'll change that. Thank you for the review. Regards, Lukasz _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel