Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp241743lqt; Thu, 6 Jun 2024 02:06:29 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXut5bP/yO5lbbKllwpVajnKuhrVu9a1VnB1fnbbBl7mw2QieoIOdVfQyTs0sBhxlyXYnAzRdMhhW9+jXy40+9or2b2h3jJ6mVF1Gvv/w== X-Google-Smtp-Source: AGHT+IFVsoCeDgqwyv9IofD4ggNfvE2cccjlAcOKNa80qZsPYbin7VlLD94wSoCLzrEFDM1Z2OjM X-Received: by 2002:a17:906:6cd:b0:a68:9097:748a with SMTP id a640c23a62f3a-a6c7650adbemr165078066b.26.1717664788970; Thu, 06 Jun 2024 02:06:28 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717664788; cv=pass; d=google.com; s=arc-20160816; b=CO+ax27zL0uYdye7duNlLCHK+KpW4X+XX9pKtPiIeXf7yGYMlMbqS/Bv/ELHjA90lC 8ysXY9KXnVzn4GF53GN/yMYLPHKnx3mD8KDoTVzeoBjp3mazB13W41DaZI2J4e5RT0oW Dma5P3LW9J27zzw0P4B+/WLtKKOZsKnaixahQ+ZkTHxabVCDeWFDTfkUXXw3oihkzt+f SMH970OiQjLgPMvtzAezonFeW0rrH8HDT/PyV1IpcrpcUcNluG8H1vswxXgmnd72acf1 Zgl78k0eeddyAUWmZ4NLGx99NadkSmBQ5cV/zk3dGI72SqcHt4N5+CKfrxANCMzSXjUz jOgw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=fgXn85g8MjnecWAKUseQpayFVIVFPZe9EroEggG6Eeg=; fh=GPlquE77/S3b4C9fO90iprJj+9gU4YTMgqpxD3SPTHY=; b=JTAYoCeSaWpsbaanmqUiiq568+WkrUyDm3krTfkHlF3T3VKgr+H5W/qBYASDP1TZjs Zn7E1aEmhecbR+q0WDVTUPwzKGkz0q5Ri91JYbJkez/cPjMiHUfyJ/66k6NdtjTOfxN8 kR7K9yQofSZ2loYsJXDVxWL+SICq3k8Ml0JUCHkoRle4JDMAqCOAOACRBcqtjZzJo7cF RieA4WBdQUyWy5b76wEZRkIKLHjUJYBkm+I/eM+mH08dDkya11h18LmPCv7vddA7Vq9Q j+bLQLuUZ5I7ZUg9E2IADEU40BVmym26bpdjSovbGI2opY/i+UX35e41rdvRfZdOMJrX vwCQ==; 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-203925-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-203925-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a6c8072a487si48048666b.895.2024.06.06.02.06.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 02:06:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-203925-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; 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-203925-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-203925-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 am.mirrors.kernel.org (Postfix) with ESMTPS id ACBB51F27B98 for ; Thu, 6 Jun 2024 09:06:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CB404152168; Thu, 6 Jun 2024 09:01:27 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E604A14EC71; Thu, 6 Jun 2024 09:01:25 +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=1717664487; cv=none; b=WLkiBQ/yLfm4AIuHwSVOtY2s/J7FpZG++YpKzpr2aLSwIFq8mBQg1dVTf6l7yLio+Ha3OVe4CR9//gsgsACZuvmUpJe2wHvzQfVS6TcGc7xnNgvQ5kidAe0Npag5Zf2aJkRtc9/Y4Wg3m7H4PSBUTV4THYRnhCfFeZXTJhOErns= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717664487; c=relaxed/simple; bh=Iy/Jw+bQQcXAeMSukRlrF4oA2JnT/oc9lz2u483pIYs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=uBlYPvVBfXR91nvRVRLUEhX1EKVzBLx0IzBz6ZiBa+fLi+aDBsp1GYfrMXcKKYCM6n5gq916H91FRdTftSQOQM/RvTK/5TT6Th82elyodBxTa2xs5aMMy6Rq+RB2Zih+5kTQ4DfaUDd2COMAu2sEyCkkIAoi60n85XTu7kwCyl8= 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 A6AC0339; Thu, 6 Jun 2024 02:01:49 -0700 (PDT) Received: from e127648.arm.com (unknown [10.57.71.137]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 8B4023F762; Thu, 6 Jun 2024 02:01:22 -0700 (PDT) From: Christian Loehle To: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, rafael@kernel.org Cc: vincent.guittot@linaro.org, qyousef@layalina.io, peterz@infradead.org, daniel.lezcano@linaro.org, anna-maria@linutronix.de, kajetan.puchalski@arm.com, lukasz.luba@arm.com, dietmar.eggemann@arm.com, Christian Loehle Subject: [PATCH 3/6] cpuidle: teo: Don't always stop tick on one state Date: Thu, 6 Jun 2024 10:00:47 +0100 Message-Id: <20240606090050.327614-4-christian.loehle@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240606090050.327614-1-christian.loehle@arm.com> References: <20240606090050.327614-1-christian.loehle@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Even if we have only one state, we unfortunately still need to query expected sleep length if state0 is a proper sleep state like WFI. This enables teo to save energy even in that scenario. Signed-off-by: Christian Loehle --- drivers/cpuidle/governors/teo.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/cpuidle/governors/teo.c b/drivers/cpuidle/governors/teo.c index 2c427dd4cac0..216d34747e3b 100644 --- a/drivers/cpuidle/governors/teo.c +++ b/drivers/cpuidle/governors/teo.c @@ -403,7 +403,14 @@ static int teo_select(struct cpuidle_driver *drv, struct cpuidle_device *dev, /* Check if there is any choice in the first place. */ if (drv->state_count < 2) { idx = 0; - goto out_tick; + if (drv->states[0].flags & CPUIDLE_FLAG_POLLING) + goto out_tick; + /* + * If we only have one state and it is a proper one, check if + * disabling the tick would be worth it. + */ + duration_ns = tick_nohz_get_sleep_length(&delta_tick); + goto end; } if (!dev->states_usage[0].disable) -- 2.34.1