Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp6484746rdb; Tue, 2 Jan 2024 03:45:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IG8T7buRnteI2aMsMehfeWPJ2W6oZuI0tYRMTZjggYjGSBLm6C0x5J98xfVjGGDYAhjOiqv X-Received: by 2002:a17:907:c99b:b0:a23:2eae:b879 with SMTP id uj27-20020a170907c99b00b00a232eaeb879mr5933178ejc.148.1704195959432; Tue, 02 Jan 2024 03:45:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704195959; cv=none; d=google.com; s=arc-20160816; b=tCHm4c1ovLvpSCN0FTK8XJQbSzqi22POptbZG6AJqOqJRa9yEdA1GFNkL3SKr3Yrzd OoQyyRKURk9aXa61854q86dbcfvdC4FO0ILT7S9dJglRll+J4cqya/yF4a9HsTmK84oU n5vBx6Z/gdd4NiVqhmsjJFu1lv60wzZMHENV/GXDP+9gSLGLPYpg0YQfIZt8DHKM/Ti/ PciLUIdPlK+et7RpI9SFLcLE/s5cLjAvkyoLSmeGnYKV71rGkV49A+qGrHPLyjtsfL6M uX0v951xvlxzHw75v/EjsabJZo4HTS4lOmxpj2cntiXIfTDivk24eKSw45HnHbi4DTbf jiMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=Jm3C4PX6/G/37PYNcGabaMIatMVzhVqyXhUWsCIR2+s=; fh=YmW56Jjlaak1EaOYEIddWG8QfZwpR67Ad7p8iQIhC54=; b=Le0cFNJNURJg+w06pVFERymS4S03ObkfW7uITDIS2ytejxG5OY6lneUzDFwNLrg0Wp 4cRgZcWiBtRgTiBoIRevP04n4g+nsP4sxL+WT3fIRmOyRTYQHyBFFsfCzNtInjeYH5uy K3QfJfgukxUV8V2o6H6skQ8dTdZLbrFSFMc5er6V/d3ZgNma9MUKmVjcIugmsEfwcCjU yfXiHVKOVviL7UhhaI9zd6r4Lqj1zLx0cX0CYEg/Jerikn4y8NhfJMWPwuX1SnMrg+o4 JpL691ruoIs6f9kGMWGlXiSqVeS3MGYVhp6g+GRJioHVM4OslF4IYLpnfcgJcPaZwc+i GsOQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-14309-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14309-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id pv8-20020a170907208800b00a23458970e7si1229411ejb.576.2024.01.02.03.45.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 03:45:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-14309-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-14309-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14309-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id E90731F21419 for ; Tue, 2 Jan 2024 11:45:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E8CFFEAE5; Tue, 2 Jan 2024 11:45:49 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BD36FEAD6; Tue, 2 Jan 2024 11:45:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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 37011C15; Tue, 2 Jan 2024 03:46:33 -0800 (PST) Received: from [10.57.86.61] (unknown [10.57.86.61]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BE0083F7A6; Tue, 2 Jan 2024 03:45:44 -0800 (PST) Message-ID: Date: Tue, 2 Jan 2024 11:47:02 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v5 15/23] PM: EM: Optimize em_cpu_energy() and remove division Content-Language: en-US To: Qais Yousef Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, rafael@kernel.org, dietmar.eggemann@arm.com, rui.zhang@intel.com, amit.kucheria@verdurent.com, amit.kachhap@gmail.com, daniel.lezcano@linaro.org, viresh.kumar@linaro.org, len.brown@intel.com, pavel@ucw.cz, mhiramat@kernel.org, wvw@google.com References: <20231129110853.94344-1-lukasz.luba@arm.com> <20231129110853.94344-16-lukasz.luba@arm.com> <20231228180647.rwz4u7ebk5p2hjcr@airbuntu> From: Lukasz Luba In-Reply-To: <20231228180647.rwz4u7ebk5p2hjcr@airbuntu> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 12/28/23 18:06, Qais Yousef wrote: > On 11/29/23 11:08, Lukasz Luba wrote: > >> @@ -220,8 +218,9 @@ static int em_compute_costs(struct device *dev, struct em_perf_state *table, >> return -EINVAL; >> } >> } else { >> - power_res = table[i].power; >> - cost = div64_u64(fmax * power_res, table[i].frequency); >> + /* increase resolution of 'cost' precision */ >> + power_res = table[i].power * 10; > > Power is in uW, right? You're just taking advantage here that everything will > use this new cost field so you can add as many 0s to improve resolution without > impact elsewhere that care to compare using the same units? This code doesn't overwrite the 'power' field value. The 'cost' value is only used in EAS, so yes I just want to increase resolution there. I think you mixed 'power' and 'cost' fields. We don't compare 'cost' anywhere. We just use 'cost' in one place em_cpu_energy() and we multiply it (not compare it). > > Did you see a problem or just being extra cautious here? There is no problem, 'cost' is a private coefficient for EAS only. > >> + cost = power_res / table[i].performance; >> } >> >> table[i].cost = cost; >> -- >> 2.25.1 >>