Received: by 2002:ab2:7b86:0:b0:1f7:5705:b850 with SMTP id q6csp1277675lqh; Mon, 6 May 2024 02:42:24 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWUNh9oQbpkHsi2oWpNwXNCBP/shfYBS1i0h4WDitv3KL/OY2Rph0gyH7buRAcLRwoTNOuP78O/PXlYtcgeNZiXRDeYKo3yfGzO/ivVGQ== X-Google-Smtp-Source: AGHT+IHCxRupLVV9JPAZd+jKHbnrzPxYnZsT0wl7emP5ciDTGNs74VJyIScJOroYU6ul3QVnAMN/ X-Received: by 2002:a05:6214:e4a:b0:6a0:d56e:4b30 with SMTP id o10-20020a0562140e4a00b006a0d56e4b30mr11797306qvc.53.1714988543785; Mon, 06 May 2024 02:42:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714988543; cv=pass; d=google.com; s=arc-20160816; b=ow1bdPFWHu/x5g50bEaj4l2klig+9tnWNXP0DcZhbAprfMDnMwL7/Y3mmhQjtr16UX Ts/0ztPNqzi/aqGxH0l9m7GFHDQjqWjX/zo1qqVI53dzBnGsItBwTmNdnkJ0Vf9xAHZ1 XLE9yYF/tsmfqU3dIgeGEHgUjopL/eBHCTG8qSMC0wbQSIygN63JOM10CP50BzgTZYbu kuWZmRdPS/3QLkqDl648t5PO+duXIMdmkmbPqZRNxNiza8kBTiaXhw8h6kedeD5iB73x 2ejHLdilBu3ygA1qZbt7J5EgH696BKECDVH5zz8LT7/0pktNFh9Gs+Z2yiMCsIjDXiUM 5zzA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=Hu0+xi2WTzIkOlleihmiHJu0ILdAHMc03g8SM730Dx4=; fh=sPQnt5fPNMuuaV0JqIymPNbU/dFu5a0DdRyzOmPMxE4=; b=ltZTDLU/uzvcp4UkCp/bXJia7+aGQeBTdMnucpN2w8JjwHsHWJjjdYD278HEaPSGId kWhqA7rzz3StLy077JMjEkcKqMwXoBm1csex40zkNKhe5xguiePJSD5vYvR1dGuQbgjR lvfq01c3miW6rl1xxAjfIejeb0Wbxm9z4nFO7Lalt3rSPF1ivoB/bDaU5alu8N61uapi cWkdemWGoc1AXTP5uNhSiEsxva9WNuqGCIF/VfFTy5KF1ENlJCidbeFTFpHURC2kIpKG IR5mcCZECxkJAGcVvzyq57er4IkwRxBNupUAK9Z3eSAmhBiJBTdP4D07nrybYndX2eKM 7kIw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-169596-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-169596-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id c3-20020ad45ae3000000b006a09c3fbbf1si7385802qvh.279.2024.05.06.02.42.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 02:42:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-169596-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-169596-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-169596-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 2F8CC1C21FAE for ; Mon, 6 May 2024 09:42:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4E5A1142658; Mon, 6 May 2024 09:41:59 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 11B32142624; Mon, 6 May 2024 09:41:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714988518; cv=none; b=VqtlwvZZaH0ykO+zx7rndVCAnBdl17W3Qep1D/RESVEqr7VGVwmUPtCOM9JuONDFLGxhPxaZm/wKiI4a6R/eaRZhfdZqbfmC9x72s4Sm0uendpsLenhDbUfFyBo0ScbM4e5zEy959VF1D+y41HobU1+u9W6Y3Erw+XmPUPtkU5E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714988518; c=relaxed/simple; bh=+lHk3VtGSNSiz+wqOUZKtrJy7J/Ahy/OEilvl9DQpXU=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=JvtYm8mqt2hat7UF+PKE9pE0+7oyFff6Jawd7EKZVycQ5ynoTvO7VhBKlsZi8jg8sFUqosdJi0l7sAHhJKOTCY6IlpxuBCB0jLV10yZquHPAFHNd3Fd0oGhHHefdy0RBNuWj0pzMCOYjPMdmCCCa72MljVOFQ91GfZ5XrMo1UVI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 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 33FF0106F; Mon, 6 May 2024 02:42:19 -0700 (PDT) Received: from [10.57.66.153] (unknown [10.57.66.153]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B40893F793; Mon, 6 May 2024 02:41:51 -0700 (PDT) Message-ID: <67159a18-3923-4345-bff8-ade49cc769ba@arm.com> Date: Mon, 6 May 2024 10:41:52 +0100 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] thermal/cpufreq: increment i in cpufreq_get_requested_power() To: Dan Carpenter Cc: Amit Daniel Kachhap , Daniel Lezcano , Viresh Kumar , "Rafael J. Wysocki" , Zhang Rui , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org References: Content-Language: en-US From: Lukasz Luba In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hi Dan, On 5/4/24 12:25, Dan Carpenter wrote: > We accidentally deleted the "i++" as part of a cleanup. Restore it. > > Fixes: 3f7ced7ac9af ("drivers/thermal/cpufreq_cooling : Refactor thermal_power_cpu_get_power tracing") > Signed-off-by: Dan Carpenter > --- > This is based on static analysis and not tested. Thank you for the patch. I have analyzed the code and why it haven't trigger an issue when I was testing it. I looks like the function get_load() which is called above that 'i++' and takes the 'i' as the last argument is compiled in 2 versions: 1. for SMP system and the last argument 'cpu_idx' is ignored 2. for !SMP where we use the last argument 'cpu_idx' which is 'i' value. Although, for !SMP system we only have 1 cpu, thus the initialized 'int i = 0' at the beginning of that cpufreq_get_requested_power() is used correctly. The loop for !SMP goes only once. > > drivers/thermal/cpufreq_cooling.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/thermal/cpufreq_cooling.c b/drivers/thermal/cpufreq_cooling.c > index 280071be30b1..a074192896de 100644 > --- a/drivers/thermal/cpufreq_cooling.c > +++ b/drivers/thermal/cpufreq_cooling.c > @@ -249,6 +249,7 @@ static int cpufreq_get_requested_power(struct thermal_cooling_device *cdev, > load = 0; > > total_load += load; > + i++; > } > > cpufreq_cdev->last_load = total_load; Would you agree that I will keep you as 'Reported-by' and send a separate patch to change that !SMP code completely in that get_load() function and get rid of the 'cpu_idx' argument? Or I'm happy that you can develop such code and I can review it. It's up to you. Regards, Lukasz