Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp26316956rwd; Mon, 3 Jul 2023 08:08:04 -0700 (PDT) X-Google-Smtp-Source: APBJJlEs9RjIegtIYCuv87wYFb3eT99umASkzzGgqTyKZ0XI1QqR5jFENfwpD8o3LTvcaei7/PvD X-Received: by 2002:a17:903:1c5:b0:1b8:560a:aa18 with SMTP id e5-20020a17090301c500b001b8560aaa18mr10492754plh.16.1688396884096; Mon, 03 Jul 2023 08:08:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688396884; cv=none; d=google.com; s=arc-20160816; b=ycPqZ6ygJMK1w5Yc5MXbcLL6yyO4dCdT6wuLXC/CEPI1N+FKdb5l7mtgDpUOmb/A8T ft+Rutja1W7yha1MNgBRGhNeYYhEsZgjEQLChTf6AWRTcFkM4OG/gKeRtOL9X0C/jruV zS+w0ztTW+RYSv7SC+Q5oER4IXgGzfJGMG8DYbC0nx5EzurWsSwx6ARr7fBIm/quHGSe W7KMUIkppX8nM4KNxE2A047HXY9JU38oZ1oMtMfseZ+LJeFbglXPtoKkozChmOh4KRiu XLpdKg0Loppgt/yRtDCwppn2Y7in/Ci38jpvu+zj6QRiqHkGNLSeWLirZvpMx90yXs2a zEog== 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=aF5eO/H7MeknjjIhTGSmBEaMmnCN3aw80/bORbVUPaQ=; fh=Wo22gSJCRwTLyDzb41myy9Bl+2SFoGi1RZ4iP0fKd98=; b=Lb/gFXfEHmYIvwNMrTxUaqjgOm9zkXYHXIQCOKcXG4hXIgKmZlkKnE7hsj8WyTF4JM dvqPDKjRtM3sJer9tD/F4dQBvDqLhs958Lx4/s13NozyLliqhmhVLDwdV2NoIDutqqUf jZL+huhzo99d0ugwREy6TENzwCVYpu9QQ258E8O+ra30VqWbH3euaBhNrUfOgKqvYecz Tnf2dqRssS9+thxFbcaBWcybJU64hog8pqVKmNrfKkt+/cmbyzjv4Z+Tk5kHivb3F8En jcmsJqbc8giL0o3+pdPs+bEa6CBwVjx9NshZQXRv64RevWshwxVO3Bp/sWfl3HpdKT/R sS1w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ik10-20020a170902ab0a00b001ac84f87b0fsi10302253plb.339.2023.07.03.08.07.48; Mon, 03 Jul 2023 08:08:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230246AbjGCPGe (ORCPT + 99 others); Mon, 3 Jul 2023 11:06:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229853AbjGCPGd (ORCPT ); Mon, 3 Jul 2023 11:06:33 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 285C0EE; Mon, 3 Jul 2023 08:06: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 3343C2F4; Mon, 3 Jul 2023 08:07:14 -0700 (PDT) Received: from [10.57.27.93] (unknown [10.57.27.93]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id EED223F663; Mon, 3 Jul 2023 08:06:28 -0700 (PDT) Message-ID: <57a5dc82-f2c9-5190-e3fa-702b2eb2de5e@arm.com> Date: Mon, 3 Jul 2023 16:06:46 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH v2 06/17] PM: EM: Add update_power() callback for runtime modifications Content-Language: en-US To: Dietmar Eggemann Cc: 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, Pierre.Gondois@arm.com, ionela.voinescu@arm.com, rostedt@goodmis.org, mhiramat@kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, rafael@kernel.org References: <20230512095743.3393563-1-lukasz.luba@arm.com> <20230512095743.3393563-7-lukasz.luba@arm.com> <70e630b8-e577-a148-0179-61aedf910c09@arm.com> From: Lukasz Luba In-Reply-To: <70e630b8-e577-a148-0179-61aedf910c09@arm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Dietmar, On 5/30/23 10:31, Dietmar Eggemann wrote: > On 12/05/2023 11:57, Lukasz Luba wrote: >> The Energy Model (EM) is going to support runtime modifications. This >> new callback would be used in the upcoming EM changes. The drivers >> or frameworks which want to modify the EM have to implement the >> update_power() callback and provide it via EM API >> em_dev_update_perf_domain(). The callback is then used by the EM >> framework to get new power values for each frequency in existing EM. > > Do we have any numbers or feedback that the chosen design (i.e. update > per performance state through update_power()) is performant enough for > the anticipated use case on real devices? > Yes, we have. I have a testing kernel module which updates the EM with queue_delayed_work() every 100ms. That update is for Little's EM where we have 11 OPPs. We call the new callback for each OPP in the em_dev_update_perf_domain(). I have measured that total function time. When we fix all CPUs freq to max freq on pixel6 and disable deep idle states and leave only WFI, then we can run some tracing and capture the results: (The 4 CPUs from top are the little (1.8MHz), than 2 Mid (2.2GHz) and then 2 big (2.8GHz)) ------------------------------------ Function Hit Time Avg s^2 -------- --- ---- --- --- em_dev_update_perf_domain 3104 51236.39 us 16.506 us 75.344 us Function Hit Time Avg s^2 -------- --- ---- --- --- em_dev_update_perf_domain 1264 20768.15 us 16.430 us 62.257 us Function Hit Time Avg s^2 -------- --- ---- --- --- em_dev_update_perf_domain 1166 18632.95 us 15.980 us 70.707 us Function Hit Time Avg s^2 -------- --- ---- --- --- em_dev_update_perf_domain 770 12334.43 us 16.018 us 66.337 us Function Hit Time Avg s^2 -------- --- ---- --- --- em_dev_update_perf_domain 101 920.613 us 9.114 us 21.380 us Function Hit Time Avg s^2 -------- --- ---- --- --- em_dev_update_perf_domain 20 211.830 us 10.591 us 23.998 us Function Hit Time Avg s^2 -------- --- ---- --- --- Function Hit Time Avg s^2 -------- --- ---- --- --- em_dev_update_perf_domain 15 78.085 us 5.205 us 7.444 us ------------------------------------ As you can see in avg on Little CPUs it takes ~16us, on Mid ~10us and on Big ~5us. If such updating kernel module is implemented correctly, it would be most often scheduled on the Littles as you can see based on 'Hit' column. Therefore, IMO this cost can be OK for the upstream. This EM runtime change won't be triggered very often. If it would be e.g. every 100ms than the cost ~1.5us per 1 OPP is negligible. Regards, Lukasz