Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp2521909lqb; Tue, 28 May 2024 02:29:24 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXSwt0lBgk4RCYYzfWO498HqGjq0/cyZz/ZWiC8EWqNPSZ4Sd08xlZY+Cif9rSQGK/leDGcIbkDFsgPrtP3/55obI6ql84kLYzj4ImImg== X-Google-Smtp-Source: AGHT+IEwS9FNAG0SLenQZeSjBmupMrOe3QFO+tdhx/CERJSOsdVS4JzbBlZoeyk4AFV9r7qjqG7e X-Received: by 2002:a05:6214:3f89:b0:6ad:5b75:5227 with SMTP id 6a1803df08f44-6ad5b75527amr203155586d6.5.1716888564056; Tue, 28 May 2024 02:29:24 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716888564; cv=pass; d=google.com; s=arc-20160816; b=yyRJgQfoiw8QU28j+q1UNiiDltOOHPuiU3XEYr/CxOV7WMGgMXLIkcjv5RIHpPs0na 35mo9hDLkbuf6hY/6PPJWrHTyLIVD/80OtOTzu7H+U1ir8ulMFkF3WTOr3bgrhWyZ4pL 77rFqtHNTMeFlqwwAudEa5Il8XA3akiBsjgaOctHGGH6E28AJ03piHF4u2YHFl5p3jv1 PPcXLXBkUX8xTZZXWOvCHqRCmtbCSzOKZaGrVlFInd0BPb36F8axbttfRbQzYgPgyNnq ZqlMI5kTGJ5gq4DZtgf9JQhHw85XWrafYVy+d0QC8CbVDYzlw2P8vHAIBz5MB3zpzgG0 EycQ== 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=fpXBqoA8ceS6poGGWklE+vI0T/nfCFs37lamBJ9RBv0=; fh=kRU378YCBhaf5jEv4KOM3T2EY+qc4yWhuTVWVkJWQZI=; b=iaKXNW19NWJKwQdtJ5Ra/m7m6RZL8uwK8ecQlwttvat/q6rsgN09uU415VR/2ebuxM oB1ajdyv/FFQOiGcUmW4Ip7Vu8qPWxxD4pmmrZQF/ZhW3hXsbxI4vh6ZYA9aX1VSbR9D FQkn4thLstD1ljKjs9pNJL/g5hGXAJG1cj7NWSr4y1Wfcx2jbi32aSYfBJ+YwyBFnVcT GYJj5R1oPFCcdkC6PP2nDV/KefR4UsuJSCxbAhcpRobdkVZgOQmh0x/WyH3iRUiMr7Yy L729C1mf8XL7RJ0fJt/vyXO3ip9/6ZNERMcgTOhJQ1MUDoENh/k87YgC8c8pHLLGb7JL kcPQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=toqHVMvg; 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-192015-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-192015-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. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 6a1803df08f44-6ad76819b7csi62275106d6.238.2024.05.28.02.29.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 May 2024 02:29:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-192015-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=toqHVMvg; 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-192015-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-192015-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 B07CC1C22FAB for ; Tue, 28 May 2024 09:29:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D1F66155C8B; Tue, 28 May 2024 09:29:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="toqHVMvg" Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) (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 66EC1155A4F for ; Tue, 28 May 2024 09:29:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716888555; cv=none; b=jF9BPnMt702fwnVHiPG4rWaEwD22I1FAurTM0GYoWAl+NxCoA6h4LsiwnEyVvo9j+90ZkQtCU5GJCIpQyw2x7wrAiNITE686U0fWEopA7Jwub9mwgXO1KaQKU2GE5alw9/bKqlPA63WRL24OvzWAwd+06tVg/rmPGiY201ah6gQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716888555; c=relaxed/simple; bh=FW+O/dnOrX2cRzlvBKosMIgX6/Jg/BO6pQfm9wfnB2U=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=UIFYts1M0L8HgWYIf3aOPDMwjcr8ZDwP81hm0/5Iqm9rHSXZ7FIOM6SIObXaWpSVFK8108EePZVUF46OfnXqQzZFXGvHAfXBGZef1EyPBF4rZYb2haS8CxKHECyYz/HYfdm6k9pUQ3UHtOSvRyLSnC+bgJIlQglvpiZHSt7TXzk= 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=toqHVMvg; arc=none smtp.client-ip=209.85.216.53 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-f53.google.com with SMTP id 98e67ed59e1d1-2bf5e0d8df9so2570234a91.1 for ; Tue, 28 May 2024 02:29:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716888554; x=1717493354; 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=fpXBqoA8ceS6poGGWklE+vI0T/nfCFs37lamBJ9RBv0=; b=toqHVMvgr+bixKmX/pXrpdFLR0Vk1EpLGxt/R5vphbAl8SHcu7wgxyhjo4XFWbFZlW cGgqTXhlbGi2aMx6vkDCCEicD6pXAEUFmdbdkbfNgd2Tne2jlrE2Rk94ZcdTZwHVBWN+ f12jDhIvTzo1X8VRhaA3cDFWFw5NXtnpLizBRaiDA5qmABc2zg/ZRrl/emkwcOHCxOhj 7efrvS469F8t9TLRi2np42bTONgdEMOR/KECzl+ZxTCy/zMvw4VubA1oob4nIu7WqxNz kbnKNvyrtLY7oBiqMNddWusXTVpUPj9JUNO3ShoW0T6/joEnHzoQDo0EgMrULlhIf0Nk S1fA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716888554; x=1717493354; 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=fpXBqoA8ceS6poGGWklE+vI0T/nfCFs37lamBJ9RBv0=; b=lZXKwRV4OzMj37ApGfMEUNJ7OVVTfCThA3ZtgaEBZTzmcljq5vhInuXYWF2ib+Vu/H JUfjGHkxMuZZ5vgd3s1cYrTvLVRvPk9vEs/caGzMc3UdtSHgOiXJ2wKcdOzBVZiA7+1e XkuPwfk15nxBNdNNEfD+OjlT83uUTZAEKXjA4asNm40HzOzgyDzG78xI+0pFTcG/YI7r W4i7zITb+4gsC3+WvANIsCoJ//6q4Zc9vQMrC7aSC0EMTCiYoBRMSzFRX4BVf7fxoDnZ hzk0oEVkSFAEu03kmCzlf8QC9LG8q2UI20AbVsHdNB06rmnOrso+g2FKRWMlowLE6bML 8kEQ== X-Forwarded-Encrypted: i=1; AJvYcCXxJqE6izTiqWaxu5fg4O2pcGR0waFUbhKm0HgeX7M2KgNSIln7aSiAfPVPnemXzy88Jg43zCrIaojcfr+ItcXci/XyIqJ6WTBq7BK4 X-Gm-Message-State: AOJu0YzzA/+kjnAbEVllPQR+FgZvUB4nh9Cv4Ktql9ZujMLUkYWEq1KK tfWzoc+s0K9wAB8jFpEO+ym+AN2/y9Y5lMuSwL4+a/JY0fyLMF3vXLX5nBq8BPDBoUbt5EIyAGq tAZXba3fkw8zGgLVUx9AWlF2C+BnYIoAD9ouydg== X-Received: by 2002:a17:90a:f2c1:b0:2bf:8824:d0a5 with SMTP id 98e67ed59e1d1-2bf8824f30amr11307027a91.6.1716888553554; Tue, 28 May 2024 02:29:13 -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> In-Reply-To: <20230917010516.54dgcmms44wyfrvx@airbuntu> From: Vincent Guittot Date: Tue, 28 May 2024 11:29:02 +0200 Message-ID: Subject: Re: [PATCH v6 2/2] cpuidle: teo: Introduce util-awareness To: Qais Yousef Cc: Kajetan Puchalski , rafael@kernel.org, daniel.lezcano@linaro.org, lukasz.luba@arm.com, 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 Content-Type: text/plain; charset="UTF-8" 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. IMO, we should at least increase the utilization level Regards, Vincent On Sun, 17 Sept 2023 at 03:05, Qais Yousef wrote: > > Hi Kajetan > > On 07/18/23 14:24, Qais Yousef wrote: > > > These patches are in GKI. So we'll if there are uncaught problems I guess :) > > > > No appetite for a knob, but the very low value for littles did strike me and > > thought I better ask at least. Today's littles are too tiny for their own good > > and it seemed the threshold could end up being too aggressive especially in low > > activity state. You effectively are saying that if we have few 100us of > > activity, normal TEO predictions based on timers are no good and better to stay > > shallower anyway. > > > > Note that due to NOHZ, if we go to idle for an extended period the util value > > might not decay for a while and miss some opportunities. Especially that when > > it next wakes up, it's enough for this wake up to run for few 100s us to block > > a deeper state before going back to sleep for extended period of time. > > > > But we shall see. I got the answer I was looking for for now. > > Unfortunately not too long after the patches got merged I got regression report > of worse power. As you know on Android things are not as mainline, so I need to > untangle this to make sure it's not a red herring. But if you want to take my > word for it, I think the chances of it being a true regression is high. I had > to introduce knobs to allow controlling the thresholds for now, so the good > news they do help and it's not a total revert. I don't have a lot of info to > share, but it's the low activity use cases that seem to got impacted. Like > video playback for instance. > > Generally, I'm trying to remove some hardcoded values from the scheduler that > enforces a behavior that is not universally desired on all systems/workloads. > And I think the way the util awareness threshold are done today fall into the > same category. > > As I tried to highlight before, it is easy to trick the threshold by a task > that runs for a short time then goes back to sleep for a long time. > > And when the system runs full throttle for a while, it'll take around 150+ms > for the util to decay to the threshold value. That's a long time to block > entering deeper idle states for. I'm not sure how NOHZ and blocked averaged > updates can make this potentially worse. > > In my view, the absolute comparison against util can be misleading. Even when > util is 512 for example, we still have 50% of idle time. How this time is > distributed can't be known from util alone. It could be one task waking up and > sleeping. It could be multiple tasks at many combination of patterns all > leading to the same outcome of CPU util being 512. > > IIUC the idea is that if we have even small activity, then erring on the > shallow side is better. But given that target-residency is usually in few ms > range, do we really need to be that quite? With a target-residency of 3ms for > example, even at util of 900 there can be opportunities to enter it. > > Can't we instead sample util at entry to idle loop and see if it is on a rising > or falling trend? When rising it makes sense to say there's demand, let's block > deeper idle state. But if it is falling, then if the decay time is longer than > target-residency we can say it's okay to permit the deeper idle states? > > I need to think more about this; but I think it's worth trying to make these > thresholds more deterministic and quantifiable. There are too many workloads > and system variations. I'm not sure if a knob to control these thresholds is > good for anything but a workaround like I had to do. These hardcoded values > can be improved IMHO. Happy to help to find alternatives. > > > Cheers > > -- > Qais Yousef