Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp1741108rdb; Tue, 20 Feb 2024 05:52:35 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXJJh2+li/xfiVdjT2kvzDwL95XHb/wg9ipkTyxykO7IuewAU3sz8wgVADyxGfWclZ0zI0JFkPexn4+kOjhuqQLJpHbTcgOfK+Jta0UQg== X-Google-Smtp-Source: AGHT+IHvBaeMqQ52Ks0jTXGqxLnjDwdFjl7p8iyYdLz2ZPwn3ZFQKELRXQo+WGco/mh8WqtxyKNU X-Received: by 2002:a05:6359:4581:b0:176:d552:c681 with SMTP id no1-20020a056359458100b00176d552c681mr17800876rwb.21.1708437155578; Tue, 20 Feb 2024 05:52:35 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708437155; cv=pass; d=google.com; s=arc-20160816; b=MP3trteWZKug4LMgMhzBay1y0y0M0Y9EPk64q8Q2WcoXjd4wqf2cvf2zkOfg8kgdKo bECUkc2st8m3hkjQoMn50f9Dgxzrjxq+41u+btZAbLs0slYNgIla7+vBjR/ArMqUJ8uG OQCXA0y5fxY2GwNoTNv5qczGGcpgr+oxllWUdCNbmGJ8zbn8yM9zXur6ZUocTfMPzJEg p0iBDrH76udDBsXR7Rb8YoHM+THtm9vUUsfvH6beTINtOev4gof6ikTjW/uzA7dBVLeE mw9FcjShvpKis3SYRJxcwVsmipK162cXGGFLjSMsdtqfTX24fVmVF8979XIyI4Bf4fP0 kBfw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=3ilid/e5sP7UghfGnEg/Cgg4pyAzEewQR8WBetW5rMY=; fh=GGQIpORDztwhVUS9FXDhynwJ8WYfY8OKoRfNgHKHnbY=; b=XokOpOlpDvjIPBMuMY490CHd2vVWC9PwbpVcdndsnMUK1qsp2HL04icD4sW6vcWQkJ twGoZF2F694X5HRAU6ecE2FPBIIeZoW70vO1xMHroeFcZR7BHCV9Z6ZW6q+gf2OMVpPT pU8htuo2U90jfNepz4leXl0HK7i6/2zs2SlVVlrQ2O7lteDb/GWqN3B6iddvfbGSGlPk eXS3Bfiaif/HryvXory+slUG88qGQ+ENrXia7XOvxD11uQK+z4HQQgG1lYSjiXd9ol8K LcI+LYXdmyO8M5GkPrLvXl5r9eFqd1ysLHx0XQMK1KQTAx8DrPM0C1168g66BU8wb+y/ 67lw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@layalina-io.20230601.gappssmtp.com header.s=20230601 header.b=yRUccnPe; arc=pass (i=1 spf=pass spfdomain=layalina.io dkim=pass dkdomain=layalina-io.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-73108-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-73108-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id w125-20020a636283000000b005cf268638f4si6168244pgb.156.2024.02.20.05.52.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Feb 2024 05:52:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-73108-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@layalina-io.20230601.gappssmtp.com header.s=20230601 header.b=yRUccnPe; arc=pass (i=1 spf=pass spfdomain=layalina.io dkim=pass dkdomain=layalina-io.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-73108-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-73108-linux.lists.archive=gmail.com@vger.kernel.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 3F201283821 for ; Tue, 20 Feb 2024 13:52:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id ED0EB6EB77; Tue, 20 Feb 2024 13:50:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=layalina-io.20230601.gappssmtp.com header.i=@layalina-io.20230601.gappssmtp.com header.b="yRUccnPe" Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) (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 216946D1B8 for ; Tue, 20 Feb 2024 13:50:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708437042; cv=none; b=JKQcyK/3qjXiSWwZbFU6uWWKQHo7dq5PPMFpIBUC+rrFtRrEevoQeM71BHee2G5Lj0cTp1pze2TRAgorFDuLf6BAVwHe0309XYVPByIWkBEpqcCJ8OMKXf3sY29p+MB8j9RKkv4vonXcfU9+C6H9SlwZ4d5+26XOzIBZ7sWk9eQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708437042; c=relaxed/simple; bh=Jrx11QzEIynH7Lc7JLpWcoYA3bkny4IBJMQqUSnWar8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=bBxIFlvsrIbgWCR6G/iUCOZCrsPga1GN6XQJTj9EXX1qyFZRdhqW6mWAi1WKjtBz+BLUqiRqC4I9HlcD6TF8nOlHiIkE0DpxbY1nC7NM8oXfU1qDUPrLFkjASuSU3henJsCyK0DuKH8xjVE01GqsePfHaeJoO9L0qbivV5bF+SM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=layalina.io; spf=pass smtp.mailfrom=layalina.io; dkim=pass (2048-bit key) header.d=layalina-io.20230601.gappssmtp.com header.i=@layalina-io.20230601.gappssmtp.com header.b=yRUccnPe; arc=none smtp.client-ip=209.85.221.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=layalina.io Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=layalina.io Received: by mail-wr1-f44.google.com with SMTP id ffacd0b85a97d-33d146737e6so3384010f8f.0 for ; Tue, 20 Feb 2024 05:50:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=layalina-io.20230601.gappssmtp.com; s=20230601; t=1708437039; x=1709041839; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=3ilid/e5sP7UghfGnEg/Cgg4pyAzEewQR8WBetW5rMY=; b=yRUccnPeog/jnLc+M9IUavyWKAlW5ZuP1b1WyaBWS2BZVO15pXWViLDSXEdyV1nbQ8 fkouReYc27gGGg7d6KTcAEumdAQveEoZhxP6sYGYElXR8+zoArEQzD0CndSueqLxmYKB REmVvv/bSI/V5D7TUl+myZu3WZ0VI3S1B5vqvUsEkHwj3k4NEVsz9y9eYjSKqIo6Ukp6 pl8oJ13tiqyBbx6BkZymob6AbY723o3guVUZ8bQ/x5d1hb0xJHBGuvUR+uydtZ/7BQ1v Qw49zxuFL27pu84rkzvSI5Ie/tz1+tgNi7j/cRzHr2BdRo2mosoj3O8Eao/xV8NHQ0Sp YaMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708437039; x=1709041839; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=3ilid/e5sP7UghfGnEg/Cgg4pyAzEewQR8WBetW5rMY=; b=FTtd+r4H1YZM2071vfIIbjnLbq6NlV8x6nDLcNJ76W/UJYxSR89VIQHzVFJ3bDHUDM 7RtDkLesgHNge06aXrNB04gFFui1woTRiSpdDSRMe5w5xMC1FMTReqLRTSlRJnfZET79 brGN9cFBMT/XsXZQk65JmSzyDyWx1tsEEyd69tLwgEQpwuTXc61mugCja8sxu2iE1EJi AdCOoVAAsrEp9CA2mJcqzU4PdQKtEnOKOH8kwVm2TxEhX3MVsHVKQp5F+IMeRbtQrTzW rxfOn4yR0pBp/JpunhKN+WdyBDPomVvmBwOS5cl/6bPK7Cb3YmHtjIb8VguA63Jtz8Dn N/Og== X-Forwarded-Encrypted: i=1; AJvYcCU8AuaL/XsVfP//fr1R0R78EsXCSnqVSOTnWJvsBOI9EpN6tqEBIs6u103hbXrdEe4/hpIdVHL8ZYm3l3mFbtkNb4PbbYxaj5FkdwhA X-Gm-Message-State: AOJu0YxiqjBRpWAEFysJmVZPSfxrumNEjdY/l2AjpfuZRlHTbPp1iOgD gBzDm3KMpcnR+EypEu7RswJ70tpktGoEWltAh28WK7pQYBcGagmYDCN2BDkgg60= X-Received: by 2002:adf:fdd1:0:b0:33d:2dd4:7f5b with SMTP id i17-20020adffdd1000000b0033d2dd47f5bmr6529768wrs.45.1708437039043; Tue, 20 Feb 2024 05:50:39 -0800 (PST) Received: from airbuntu ([87.127.96.170]) by smtp.gmail.com with ESMTPSA id bn7-20020a056000060700b0033d3ff1cb67sm8199683wrb.66.2024.02.20.05.50.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Feb 2024 05:50:38 -0800 (PST) Date: Tue, 20 Feb 2024 13:50:37 +0000 From: Qais Yousef To: Pierre Gondois Cc: "Rafael J. Wysocki" , Viresh Kumar , linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Ingo Molnar , Peter Zijlstra , Vincent Guittot , Dietmar Eggemann , Christian.Loehle@arm.com Subject: Re: [PATCH] cpufreq: Change default transition delay to 2ms Message-ID: <20240220135037.qriyapwrznz2wdni@airbuntu> References: <20240205022500.2232124-1-qyousef@layalina.io> <20240205074514.kiolurpounokalum@vireshk-i7> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On 02/14/24 10:19, Pierre Gondois wrote: > Hello, > > On 2/12/24 16:53, Rafael J. Wysocki wrote: > > On Mon, Feb 5, 2024 at 8:45 AM Viresh Kumar wrote: > > > > > > On 05-02-24, 02:25, Qais Yousef wrote: > > > > 10ms is too high for today's hardware, even low end ones. This default > > > > end up being used a lot on Arm machines at least. Pine64, mac mini and > > > > pixel 6 all end up with 10ms rate_limit_us when using schedutil, and > > > > it's too high for all of them. > > > > > > > > Change the default to 2ms which should be 'pessimistic' enough for worst > > > > case scenario, but not too high for platforms with fast DVFS hardware. > > > > > > > > Signed-off-by: Qais Yousef > > > > --- > > > > drivers/cpufreq/cpufreq.c | 4 ++-- > > > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > > > > > diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c > > > > index 44db4f59c4cc..8207f7294cb6 100644 > > > > --- a/drivers/cpufreq/cpufreq.c > > > > +++ b/drivers/cpufreq/cpufreq.c > > > > @@ -582,11 +582,11 @@ unsigned int cpufreq_policy_transition_delay_us(struct cpufreq_policy *policy) > > > > * for platforms where transition_latency is in milliseconds, it > > > > * ends up giving unrealistic values. > > > > * > > > > - * Cap the default transition delay to 10 ms, which seems to be > > > > + * Cap the default transition delay to 2 ms, which seems to be > > > > * a reasonable amount of time after which we should reevaluate > > > > * the frequency. > > > > */ > > > > - return min(latency * LATENCY_MULTIPLIER, (unsigned int)10000); > > > > + return min(latency * LATENCY_MULTIPLIER, (unsigned int)(2*MSEC_PER_SEC)); > > > > > > Please add spaces around '*'. > > > > > > Acked-by: Viresh Kumar > > > > I've adjusted the whitespace as suggested above and applied the patch > > as 5.9 material. > > > > Thanks! > > > > To add some numbers, on a Juno-r2, with latency measured between the frequency > request on the kernel side and the SCP actually making the frequency update. > > The SCP is the firmware responsible of making the frequency updates. It receives > the kernel requests and coordinate them/make the actual changes. The SCP also has > a mechanism called 'fast channel' (FC) where the kernel writes the requested > frequency to a memory area shared with the SCP. Every 4ms, the SCP polls/reads > these memory area and make the required modifications. > > Latency values (in ms) > Workload: > Idle system, during ~30s > +---------------------------------------+ > | | Without FC | With FC | > +-------+---------------+---------------+ > | count | 1663 | 1102 | > | mean | 2.92 | 2.10 | > | std | 1.90 | 1.58 | > | min | 0.21 | 0.00 | > | 25% | 1.64 | 0.91 | > | 50% | 2.57 | 1.68 | > | 75% | 3.66 | 2.97 | > | max | 14.37 | 13.50 | > +-------+---------------+---------------+ > > Latency values (in ms) > Workload: > One 1% task per CPU, period = 32ms. This allows to wake up the CPU > every 32ms and send more requests/give more work to the SCP. Indeed > the SCP is also responsible of idle state transitions. > Test duration ~=30s. > +---------------------------------------+ > | | Without FC | With FC | > +-------+---------------+---------------+ > | count | 1629 | 1446 | > | mean | 3.23 | 2.31 | > | std | 2.40 | 1.73 | > | min | 0.05 | 0.02 | > | 25% | 1.91 | 0.98 | > | 50% | 2.65 | 2.00 | > | 75% | 3.65 | 3.23 | > | max | 20.56 | 16.73 | > +-------+---------------+---------------+ > > --- > > The latency increases when fast channels are not used and when there is an actual > workload. On average it is always > 2ms. Juno's release date seems to be 2014, > so the platform is quite old, but it should also have benefited from regular > firmware updates. Thanks for sharing the numbers > > Regards, > Pierre