Received: by 2002:ab2:6c55:0:b0:1fd:c486:4f03 with SMTP id v21csp306376lqp; Wed, 12 Jun 2024 02:04:48 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXdJUJoOiZtrvSpsD66s0ScP62pwp6rHkGdux55bX64BAYdXDDbfhGIJfitPVdnI7qFVEJO2uiRu/2FiCHYIhiK5evJiozzWrqnGLtHoQ== X-Google-Smtp-Source: AGHT+IHylfwCnybQfA+3l7h4iZfG5B5upla0wpFu1XMakMKCHnsWuqJ604q6hJq0vaRNfEKGNUrJ X-Received: by 2002:a05:6214:4598:b0:6b0:7687:813b with SMTP id 6a1803df08f44-6b191778f67mr11570746d6.2.1718183087959; Wed, 12 Jun 2024 02:04:47 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718183087; cv=pass; d=google.com; s=arc-20160816; b=08DXQO9ls+02As4digtfr3qnQ+d76PZe4gR4WNfD1VXVZM7KD1ywdu/o83oqmNvhgf 0TZFyRIrAnnACt/h2ueDBL3b9cWQDVMvlRYYgwPo9izNG/FYnpnY4k33CviUw6x8bqOg 0L23V02gEo4xKaO02FIanQ/kE1Mnf4ZsuetwuWtoect22okIMNOXkw1Ednooi+Pe3vMV wyUl0CRCLyN92BkuE9TC/pB3uCrAn1xAk8dsEc0yICzNo/bRHUBO2rdBe1BHCUaLaRrb 1cBschZaqfVBw8Mb6oXIDu5+z6tBvyBZhfNi6itqjvim80L/q0Gu0QnSh154fp7bBceQ bMyw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=D2c+AHF5AjtrC8bNsb8AFd3OXBUEz9kIG1oPb2NfBAM=; fh=UhqowULpUfzJ08XQGa+WEFNS7U418dWfPLGNQj6jCHg=; b=RjB9X4KWhxOXFxfTuTx+Lg+UpgV2du1tAX+FV7Z8PGmtjukO6rxk/64Gy3kS1F5Xny wpE2KG+IOO5CvHZafPNhC4ttqv1DGBBXVGGVjIbmzQ2FPmFVKSH0na4F/C80wjZxK5xV OoqRstjO+vIY0kRke7QMe2N2mO/ec5yTW0BKK0HyRYLOZZYwdttaB205bu56Q8/DBbRu BaN3MOSGlJ9hejLtNyaO1wkzMHI27UZONiHWfqO9O0917D6tjnPtR0Is1eDNAK0vjJ9z vuMfM7infpCmEwLgzGvSBISBuE87K6MzLGIBnrPumfjoBhvWg9CzRH+6ChWhIVkkhYaa GDNA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JUvT4dFo; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-211231-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-211231-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id d75a77b69052e-4415e80a00csi3604131cf.316.2024.06.12.02.04.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 02:04:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-211231-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; dkim=pass header.i=@linaro.org header.s=google header.b=JUvT4dFo; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-211231-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-211231-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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 9964E1C22BDE for ; Wed, 12 Jun 2024 09:04:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E906116D4F3; Wed, 12 Jun 2024 09:04:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="JUvT4dFo" Received: from mail-pj1-f50.google.com (mail-pj1-f50.google.com [209.85.216.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6F2A9155CA9 for ; Wed, 12 Jun 2024 09:04:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718183080; cv=none; b=ZPni2pkJd0XL8Z+zO9iAoghWD5ox0PAf4JYVNT1hvta6nsc/BP99OPoWmm0f1f7/uYrrtJeXdkFCF6VkLg2aaYC1RjNy2ylLBZo8iQJQE7vSyRPHc0rFpu5rV16YSrsl34cE3NO6GvB90B75xtlHj4QgOgrwdNM54o0h5MNfsxM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718183080; c=relaxed/simple; bh=KCTdHWjxcSbj0CbGUAMYO0DJrx9aXUjvKSjsWIPb264=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=cWWjgFZe7sfntpsXaWOHLmVfYyu4JRB1D1LmseVUYaBGkE8zc5OyfFTLriQ3SZQxc13kBMUrg1hQDCn1Rfp5+mJ4f76isQi9VRZ28g1y1a0icKDM5esBXKl7ftfug/q2+Lvw1xMUw9oYaFQvgaP1S5iCX/q/pglkjJ5CqSU5J4A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=JUvT4dFo; arc=none smtp.client-ip=209.85.216.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-pj1-f50.google.com with SMTP id 98e67ed59e1d1-2c313edc316so2326794a91.2 for ; Wed, 12 Jun 2024 02:04:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718183078; x=1718787878; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=D2c+AHF5AjtrC8bNsb8AFd3OXBUEz9kIG1oPb2NfBAM=; b=JUvT4dFoH7fEBbKluHLRtA1d3ii3a2uNcB6uKv+SbCcQ8OmALCaaRBYwgPY2I2wCtP IblW94ndQSjSU75LiJlM33PrPNonnvfyR+mrG4iT85CzpNm4jxFdrHm0fOHTKGPiHaCP YDHjKtF8IthMoRFKiHHYB6sdlGawQAx3ujgwgnOdDkcoNuq8iy8wv5IJaLh8A0k78OlA mUnKbN/dyjMUGc2Jd8cGLW8gAmqd6ZVNF25NbzIeecixiuzikcqjN3bADEMXfUXFjJmF FXDl+P06zyN+gXxPLdL7nXQesGFKzDl1LfwXO78JXLCB/hcl+r4YWne16hbn8W94gGVP +Ftw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718183078; x=1718787878; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=D2c+AHF5AjtrC8bNsb8AFd3OXBUEz9kIG1oPb2NfBAM=; b=fAfIsdhGX1B8Xt0ahNL2jwFGttpITxQbR0ogk4LHcMGuxUb2/ZCbWyxi0XFUIpZazi 7AilD6YAjOxoR9vj5DmK1UdOR98s7SI+/PqgQuozECUFbiM7pEp6p1oSw5ta0DdUEImL V4GrDB3GjY9yRBQcabYjLGiMF6HiAhAtCW2zzNfJ/f5u/b96D44JkuvcKdgv7w6ix0wQ W0z7DDnEB1E4fbiZ1hq8Rp3Gj95gs2IvmhAnIgI2f74NckXf4mPqKYgDGEuX/XqBA3eV iMj5ioeuHc0FmQ9U8C6WuPThDKwaUxqINOhCxP8tcshJa+jUaUsOZcoXwzknE19FFoNO FDTQ== X-Forwarded-Encrypted: i=1; AJvYcCUQpdHlCOXZsj8iESJSDNSC2fqS/goyrPNyHZb9vO/hfkyZjF67UWtYqV+Jgyd7oAFqZh3+3OaaIfbsszURGpdHuQHoS/DG03gbXDdb X-Gm-Message-State: AOJu0Yxy5cXqnq7pul6lm16zr1IXBRgb+qPD6zHyHpkuseKF+qimk1zT dKfB/ndM8aQEvRbqGOUcr2YnoQoWkIdZm5Txs01A7cXwxdjaoOj6c4n/AXzoWLEnGq3CBqe8/+6 YUA7qaKMiGjpapieFUvzwaVFQi0gT3tGFpOasmQ== X-Received: by 2002:a17:90a:986:b0:2c2:7bbe:d6ba with SMTP id 98e67ed59e1d1-2c4a7601665mr1276181a91.8.1718183077662; Wed, 12 Jun 2024 02:04:37 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20230105145159.1089531-1-kajetan.puchalski@arm.com> <20230105145159.1089531-3-kajetan.puchalski@arm.com> <20230711175814.zfavcn7xn3ia5va4@airbuntu> <20230718132432.w5xoxbqm54jmu6n5@airbuntu> <20230917010516.54dgcmms44wyfrvx@airbuntu> <286d4cf8-814b-41a2-8d5f-2673dc737f45@arm.com> In-Reply-To: <286d4cf8-814b-41a2-8d5f-2673dc737f45@arm.com> From: Vincent Guittot Date: Wed, 12 Jun 2024 11:04:26 +0200 Message-ID: Subject: Re: [PATCH v6 2/2] cpuidle: teo: Introduce util-awareness To: Lukasz Luba Cc: Kajetan Puchalski , rafael@kernel.org, daniel.lezcano@linaro.org, Dietmar.Eggemann@arm.com, dsmythies@telus.net, yu.chen.surf@gmail.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Peter Zijlstra , Ulf Hansson , Qais Yousef Content-Type: text/plain; charset="UTF-8" On Wed, 12 Jun 2024 at 09:25, Lukasz Luba wrote: > > Hi Vincent, > > My apologies for delay, I was on sick leave. > > On 5/28/24 15:07, Vincent Guittot wrote: > > On Tue, 28 May 2024 at 11:59, Lukasz Luba wrote: > >> > >> Hi Vincent, > >> > >> On 5/28/24 10:29, Vincent Guittot wrote: > >>> Hi All, > >>> > >>> I'm quite late on this thread but this patchset creates a major > >>> regression for psci cpuidle driver when using the OSI mode (OS > >>> initiated mode). In such a case, cpuidle driver takes care only of > >>> CPUs power state and the deeper C-states ,which includes cluster and > >>> other power domains, are handled with power domain framework. In such > >>> configuration ,cpuidle has only 2 c-states : WFI and cpu off states > >>> and others states that include the clusters, are managed by genpd and > >>> its governor. > >>> > >>> This patch selects cpuidle c-state N-1 as soon as the utilization is > >>> above CPU capacity / 64 which means at most a level of 16 on the big > >>> core but can be as low as 4 on little cores. These levels are very low > >>> and the main result is that as soon as there is very little activity > >>> on a CPU, cpuidle always selects WFI states whatever the estimated > >>> sleep duration and which prevents any deeper states. Another effect is > >>> that it also keeps the tick firing every 1ms in my case. > >> > >> Thanks for reporting this. > >> Could you add what regression it's causing, please? > >> Performance or higher power? > > > > It's not a perf but rather a power regression. I don't have a power > > counter so it's difficult to give figures but I found it while running > > a unitary test below on my rb5: > > run 500us every 19457ms on medium core (uclamp_min: 600). > > Mid cores are built differently, they have low static power (leakage). > Therefore, for them the residency in deeper idle state should be > longer than for Big CPU. When you power off the CPU you loose your > cache data/code. The data needs to be stored in the L3 or > further memory. When the cpu is powered on again, it needs code & data. > Thus, it will transfer that data/code from L3 or from DDR. That > information transfer has energy cost (it's not for free). The cost > of data from DDR is very high. > Then we have to justify if the energy lost while sleeping in shallower > idle state can be higher than loading data/code from outside. > For different CPU it would be different. I'm aware of these points and the residency time of an idle state is set to reflect this cost. In my case, the idle time is far above the residency time which means that we should get some energy saving. cpu off 4.488ms cluster off 9.987ms vs sleep duration 18.000ms Also, the policy of selecting a shallower idle state than the final selected one doesn't work with PSCI OSI because cpuidle is only aware of per CPU idle states but it is not aware of the cluster or deeper/wider idle states so cpuidle doesn't know what will be the final selected idle state. This is a major problem, in addition to keep the tick firing > > > > > With this use case, the idle time is more than 18ms (the 500us becomes > > 1ms as we don't run at max capacity) but the tick fires every 1ms > > while the system is fully idle (all 8 cpus are idle) and as cpuidle > > selects WFI, it prevents the full cluster power down. So even if WFI > > is efficient, the power impact should be significant. > > I would say it's a problem of the right threshold. In this situation > the tick would be bigger issue IMO. > > Because you don't have energy meter on that board, it's hard to say > if the power impact is significant. > > Let's estimate something, when the system is not much loaded: > Mig CPU often has low freq at ~300-400MHz and Energy Model power > ~for that OPP is ~30mW. > If you are loaded in e.g. 1% at lowest frequency than your > avg power would be ~0.3mW, so ~1mW would be at ~3% load for > that frequency. That's dynamic power if you need to serve some IRQ, > like the tick. > The static power would be ~5% of total power (for these low-power > cells in Mid core) of this ~30mW, so something ~1.5mW. > I wouldn't say it's significant, it's some small power which might > be tackled. > > This is when the system is not much loaded. When it's loaded then > we might pick higher OPP for the Mid cluster, but also quite often > get tasks in those CPUs. Then the WFI is better in such situations. > > > > > For a 5 sec test duration, the system doesn't spend any time in > > cluster power down state with this patch but spent 3.9 sec in cluster > > power down state without > > I think this can be achieved with just changing the thresholds. > > Regards, > Lukasz