Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp3771363rdh; Fri, 29 Sep 2023 01:34:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFrqhocQNW8vId3HGil8F+lS6CroLupICNfL2i2H0Eocnqg5co5ZMDQ91wTsCuQ+kexhXuz X-Received: by 2002:a54:4882:0:b0:3a9:9bb4:485c with SMTP id r2-20020a544882000000b003a99bb4485cmr3712691oic.8.1695976453725; Fri, 29 Sep 2023 01:34:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695976453; cv=none; d=google.com; s=arc-20160816; b=LU8cewlsBVxUVu5YfrBO6Q8nghHZCpy7QbE/RMM85+WiqlS4T5sIiDG7lO8hUqD7MW xJbNgXUh8J5P1i2k36xFg4+QgurQr9QakDHVliEsDGzXTKFfzOkBxD/W9uYkBQCeSE67 VjH12v/AyDGWHywlXzfPC30IM63nHCkTur9aJCQvh/mfJihXWbOZI/LWC9M+NDIOlDyt KllzKlMYMJ4Qwmr7bHMzEhFSulEy+rKGphr0sht38MhVlulOrLacYjbgkhsqUk4JFk3X 1YQnmJ0YfP59uaYYkXErJGrxZOP0s40/HxF+7D/eYX3kJ0mIVkx7BDyna5bZW/LNVZHt PY9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=1YFyaP1WatnOf0Ad6ry8H6l82hbqL1O+WXUM/ZT1oe4=; fh=Sntd+G0CthFoKfHeh5KAtcEJMuc35jsG6LFomUCRudQ=; b=Qglk8OCtGVzaGcaot1ubjOCMFiCNRaMgge7E7ftED3yXBUPuuHICgax4o0/HS4RHrB Nt/2b69riluBgznDUO7ACd+5LuexG7VVBtS8TLajFLzLSvldOFJCFKqcm8tWHs93Ciy8 R0WzOKsPUbM2rGedyEDV1lLRIKeTj2NzgNlPHL0KD1MSBhiLzn82/Sw1u+RXV+b0Hb6U Mf6sBbCwmrn+AlYtKjlGqii1iTbp/c3GiHy5cLPNgzQiF5T9HHClvFuKO1tngf2feddr 5EOO/sSf4IHIJdFQlRuhHg2t5JenMXvQWx+IhLZbMegJmvTFPiOYytR68Fj4ug8J4ALG Fmbw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id a21-20020a63e855000000b00565dd108fd4si21009734pgk.115.2023.09.29.01.34.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 01:34:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 4850980D6A36; Fri, 29 Sep 2023 01:32:00 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232877AbjI2Ibk (ORCPT + 99 others); Fri, 29 Sep 2023 04:31:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232861AbjI2Ibf (ORCPT ); Fri, 29 Sep 2023 04:31:35 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B20FD1A8; Fri, 29 Sep 2023 01:31:32 -0700 (PDT) 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 ACBBA1FB; Fri, 29 Sep 2023 01:32:10 -0700 (PDT) Received: from [10.57.93.169] (unknown [10.57.93.169]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 149023F5A1; Fri, 29 Sep 2023 01:31:29 -0700 (PDT) Message-ID: <8a9a0d27-b714-a884-ae32-728cde21dddd@arm.com> Date: Fri, 29 Sep 2023 09:32:09 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: [PATCH v4 03/18] PM: EM: Find first CPU online while updating OPP efficiency Content-Language: en-US To: "Rafael J. Wysocki" Cc: linux-kernel@vger.kernel.org, linux-pm@vger.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, qyousef@layalina.io, wvw@google.com References: <20230925081139.1305766-1-lukasz.luba@arm.com> <20230925081139.1305766-4-lukasz.luba@arm.com> From: Lukasz Luba In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.2 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Fri, 29 Sep 2023 01:32:00 -0700 (PDT) Hi Rafael, Thank you having reviewing those patches! On 9/26/23 19:32, Rafael J. Wysocki wrote: > On Mon, Sep 25, 2023 at 10:11 AM Lukasz Luba wrote: >> >> The Energy Model might be updated at runtime and the energy efficiency >> for each OPP may change. Thus, there is a need to update also the >> cpufreq framework and make it aligned to the new values. In order to >> do that, use a first online CPU from the Performance Domain. >> >> Signed-off-by: Lukasz Luba >> --- >> kernel/power/energy_model.c | 11 +++++++++-- >> 1 file changed, 9 insertions(+), 2 deletions(-) >> >> diff --git a/kernel/power/energy_model.c b/kernel/power/energy_model.c >> index 42486674b834..3dafdd7731c4 100644 >> --- a/kernel/power/energy_model.c >> +++ b/kernel/power/energy_model.c >> @@ -243,12 +243,19 @@ em_cpufreq_update_efficiencies(struct device *dev, struct em_perf_state *table) >> struct em_perf_domain *pd = dev->em_pd; >> struct cpufreq_policy *policy; >> int found = 0; >> - int i; >> + int i, cpu; >> >> if (!_is_cpu_device(dev) || !pd) >> return; >> >> - policy = cpufreq_cpu_get(cpumask_first(em_span_cpus(pd))); >> + /* Try to get a CPU which is online and in this PD */ >> + cpu = cpumask_first_and(em_span_cpus(pd), cpu_active_mask); > > The comment talks about "online" and cpu_active_mask is used. Isn't > it a bit inconsistent? good point, I'll change the word to 'active' > >> + if (cpu >= nr_cpu_ids) { >> + dev_warn(dev, "EM: No online CPU for CPUFreq policy\n"); >> + return; >> + } >> + >> + policy = cpufreq_cpu_get(cpu); >> if (!policy) { >> dev_warn(dev, "EM: Access to CPUFreq policy failed\n"); >> return; >> -- >> 2.25.1 >>