Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp4726656rwb; Tue, 8 Aug 2023 12:50:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHea5EenhVl16k8C5tyB/B2P6xJTHPopSinPTbN+g3w8GjtVdymS9ZJARiMTpx17hYTfOzL X-Received: by 2002:a17:902:d3cd:b0:1b8:95a1:847c with SMTP id w13-20020a170902d3cd00b001b895a1847cmr666024plb.40.1691524242870; Tue, 08 Aug 2023 12:50:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691524242; cv=none; d=google.com; s=arc-20160816; b=g3pz5L5jGa/KOq8I+Qnl2605nJB3YYxNET3w2u8WdAEA3IFFZAzxlOOB/QAfxNquvT YzJit28rybLbKIOC+pXyMOU1rPz2gFa++JumAeT0OY7/CWtywwMN9UJ4rQhSSbdnPQEQ 2TvX+0zDUYu7EUMbMHO5NJOox74mHDcSpEy2lRJDfto6Qm9jzfYP8XhnhCbvn9YybNOF c+m0XpjjpD3bVVR/1lbwVYlPachhGWYUN13aK/q7o8KN1egNFThSdDLwVSXtm3SLlQ7f Kn5kncUBa5oqlwQEBzMua3mng4vGUwhNkHd1Q6NwhkGQbmfNA1JZ6HmSX5m8KhralR0/ ahOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=0rukdIY3bPDDP1NcylPkIUcakIAynKZ50USxA7WGqAw=; fh=ly4JjFDu8Hx+AGveR5pCBUNO/fblAAJZXY3ZK+ouRV4=; b=nggxxmxKod9a1aPaejtRNcSI2EmRlfZkGkLMZqctSjU1aW0Z/q3r6ICfWARohQwpZ8 BZ5SGWDtRay7qV1H1kDYOLeCmcKXcuj243d1QqJ7kBzykf53KXLLSEELsYIpfvXVClPA N6goBNIMF9rxV4eTAIJLVzLZd1ONv5efzfaFsRl/aQFMyi1LklEBL8VShyXCZMtjtgKl WXLh0qFKpw0apyH7QMSia+io7P/HA3HyXo8FAuYWUJZXoYzwvhRMBG38LOEJ7v2yxKUn +nM+r+SsW6/Ei43uqQSwFWOA8e0Uqy1XzAhWaUDxRewUXulR1FmrJA0oXoGrFkFf5/fS JuhA== 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ks5-20020a170903084500b001bb23874273si7617299plb.220.2023.08.08.12.50.31; Tue, 08 Aug 2023 12:50:42 -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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234168AbjHHTUb convert rfc822-to-8bit (ORCPT + 99 others); Tue, 8 Aug 2023 15:20:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232478AbjHHTUI (ORCPT ); Tue, 8 Aug 2023 15:20:08 -0400 Received: from mail-oi1-f169.google.com (mail-oi1-f169.google.com [209.85.167.169]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D9D1445F41; Tue, 8 Aug 2023 09:44:16 -0700 (PDT) Received: by mail-oi1-f169.google.com with SMTP id 5614622812f47-3a751bd3372so678596b6e.0; Tue, 08 Aug 2023 09:44:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691513038; x=1692117838; h=content-transfer-encoding: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=c7fJlZqm7SkL8DNK44l2eawprG/x5eTjs6OofI30rbg=; b=Sn2q+VtCrP+bW3KNjMoMmt4G2r6bBaDP4NWL40tZNZxjNVt7Sy4WkGtwpp6fnE3ErH RYdOSJdTjlDJe5FbBGjx0/SQIVYxXdDRczcK6BW2LQ1qP4drey/saQ9If/4G5Q1McXL7 mB2E5y/8j7O7BwEzJC7CLFhZ73oHjbgb2RIC1eMBHUfil+rNVxSLensVTcqIBGRYxT94 FnonEgRSPN34BlpVO2PQyhpHpAYb0UlTVoU96jjDAx++dbITSnd7c+eVpu1sloPlhtWa KRBSJSR8IgXHBCvoa2zyt0lF1aNZQsRWStzc7SzZ5I8iVN92oMOuRBKB5Z9h5vkLe9qf 2/tg== X-Gm-Message-State: AOJu0YyGTzvkYJz/ET1R6+3uL0JQMiPC2dKQWozn08r38Ej0EH9+W3ta SU5SyzBw1jXDgNcoXOsBvpve9yLzV/bpI0XtYsNkV0jF X-Received: by 2002:a05:6808:150a:b0:394:25b9:db19 with SMTP id u10-20020a056808150a00b0039425b9db19mr296085oiw.2.1691513038157; Tue, 08 Aug 2023 09:43:58 -0700 (PDT) MIME-Version: 1.0 References: <5712331.DvuYhMxLoT@kreacher> <002201d9ca0c$27606f70$76214e50$@telus.net> In-Reply-To: <002201d9ca0c$27606f70$76214e50$@telus.net> From: "Rafael J. Wysocki" Date: Tue, 8 Aug 2023 18:43:45 +0200 Message-ID: Subject: Re: [RFT][PATCH v2 0/3] cpuidle: teo: Do not check timers unconditionally every time To: Doug Smythies Cc: "Rafael J. Wysocki" , Peter Zijlstra , LKML , Frederic Weisbecker , Linux PM , Anna-Maria Behnsen , Kajetan Puchalski Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no 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 On Tue, Aug 8, 2023 at 5:22 PM Doug Smythies wrote: > > On 2023.08.03 14:33 Rafael wrote: > > On Thu, Aug 3, 2023 at 11:12 PM Rafael J. Wysocki wrote: > >> > >> Hi Folks, > >> > >> This is the second iteration of: > >> > >> https://lore.kernel.org/linux-pm/4511619.LvFx2qVVIh@kreacher/ > >> > >> with an additional patch. > >> > >> There are some small modifications of patch [1/3] and the new > >> patch causes governor statistics to play a role in deciding whether > >> or not to stop the scheduler tick. > >> > >> Testing would be much appreciated! > > > > For convenience, this series is now available in the following git branch: > > > > git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git \ > > pm-cpuidle-teo > > Hi Rafael, > > Thank you for the git branch link. > > I did some testing: > > Disclaimer: I used areas of focus derived > from the original teo-util work last fall, > and did not check if they were still the best > places to look for issues. > > CPU: Intel(R) Core(TM) i5-10600K CPU @ 4.10GHz > HWP: enabled > CPU frequency scaling driver: intel_pstate > CPU frequency scaling governor: performance > Kernel 1: 6.5-rc4 (1000 Hz tick rate) > Kernel 2: kernel 1 + this patch series (called "rjw") > System is extremely idle, other than the test work. > > All tests were done with all idle governors: > menu, teo, ladder, rjw. > > Test 1: 2 core ping pong sweep: > > Pass a token between 2 CPUs on 2 different cores. > Do a variable amount of work at each stop. > > Purpose: To utilize the shallowest idle states > and observe the transition from using more of 1 > idle state to another. > > Results: > > teo and rjw track fairly well, with > rjw reducing its use of idle state 0 before > teo as the work packet increases. The menu governor > does best overall, but performs worse over a greater > range of token loop times. > > Details (power and idle stats; times): > http://smythies.com/~doug/linux/idle/teo-util2/ping-sweep/2-1/perf/ > http://smythies.com/~doug/linux/idle/teo-util2/ping-sweep/2-1/2-core-ping-pong-sweep.png > > Test 2: 6 core ping pong sweep: > > Pass a token between 6 CPUs on 6 different cores. > Do a variable amount of work at each stop. > > Purpose: To utilize the midrange idle states > and observe the transitions from between use of > idle states. > > Results: There is some instability in the results > in the early stages. > For unknown reasons, the rjw governor sometimes works > slower and at lower power. The condition is not 100% > repeatable. > > Overall teo completed the test fastest (54.9 minutes) > Followed by menu (56.2 minutes), then rjw (56.7 minutes), > then ladder (58.4 minutes). teo is faster throughout the > latter stages of the test, but at the cost of more power. > The differences seem to be in the transition from idle > state 1 to idle state 2 usage. > > Details (power and idle stats; times): > http://smythies.com/~doug/linux/idle/teo-util2/ping-sweep/6-2/perf/ > http://smythies.com/~doug/linux/idle/teo-util2/ping-sweep/6-2/6-core-ping-pong-sweep.png > http://smythies.com/~doug/linux/idle/teo-util2/ping-sweep/6-2/6-core-ping-pong-sweep-detail-a.png > http://smythies.com/~doug/linux/idle/teo-util2/ping-sweep/6-2/6-core-ping-pong-sweep-detail-b.png > http://smythies.com/~doug/linux/idle/teo-util2/ping-sweep/6-2/6-core-ping-pong-sweep-diffs.png > > a re-run power and idle stats, showing inconsistent behaviour. > teo and rjw only, and no timing data: > http://smythies.com/~doug/linux/idle/teo-util2/ping-sweep/6-1/perf/ > > Test 3: sleeping ebizzy - 128 threads. > > Purpose: This test has given interesting results in the past. > The test varies the sleep interval between record lookups. > The result is varying usage of idle states. > > Results: It can be difficult to see any differences in > the overall timing graph, but a graph of differences > is revealing. teo outperforms rjw in the longer intervals > region of the test, at the cost of more power. > > Details: (power and idle stats; times): > http://smythies.com/~doug/linux/idle/teo-util2/ebizzy/perf/ > http://smythies.com/~doug/linux/idle/teo-util2/ebizzy/ebizzy-128-perf.png > http://smythies.com/~doug/linux/idle/teo-util2/ebizzy/ebizzy-128-perf-diffs.png > > Test 4: 2 X 2 pair token passing. Dwell test. Fast: > > Purpose: Dwell under one set of conditions. Observe > noise and/or any bi-stability. > > Results (reference time is menu): > rjw: 3.0723 usecs/loop average. +3.15% > teo: 2.9917 usecs/loop average. +0.44% > menu: 2.97845 usecs/loop average. Reference > ladder: 4.077375 usecs/loop average. +36.9% > > Powers are all similar, with ladder a bit lower. > > Details: (power and idle stats; times): > http://smythies.com/~doug/linux/idle/teo-util2/many-0-400000000-2/perf/ > http://smythies.com/~doug/linux/idle/teo-util2/many-0-400000000-2/times.txt > > Test 5: 2 X 2 pair token passing. Dwell test. Medium: > > Purpose: Dwell under one set of conditions. Observe > noise and/or any bi-stability. > > Results (reference time is menu): > rjw: 11.3406 usecs/loop average. -0.69% > teo: 11.36765 usecs/loop average. -0.45% > menu: 11.41905 usecs/loop average. reference > ladder: 11.9535 usecs/loop average. +4.68% > > Powers are all similar. > > Details: > http://smythies.com/~doug/linux/idle/teo-util2/many-3000-100000000-2/perf/ > http://smythies.com/~doug/linux/idle/teo-util2/many-3000-100000000-2/times.txt > > Test 6: 2 X 2 pair token passing. Dwell test. Slow: > > Purpose: Dwell under one set of conditions. Observe > noise and/or any bi-stability. > > Results (reference time is menu): > rjw: 2591.70 usecs/loop average. +0.26% > teo: 2566.34 usecs/loop average. -0.72% > menu: 2585.00 usecs/loop average. reference > ladder: 2635.36 usecs/loop average. +1.95% > > Powers are all similar, with ladder a bit lower. > Due to the strong temperature to power use curve, > a much longer dwell test would need to be run to > be sure to get to steady state power usage. > > Details: > http://smythies.com/~doug/linux/idle/teo-util2/many-1000000-342000-2/perf/ > http://smythies.com/~doug/linux/idle/teo-util2/many-1000000-342000-2/times.txt > > Test 7: 500 low load threads. > > Purpose: This test has given interesting results > in the past. > > 500 threads at approximately 10 hertz work/sleep frequency > and about 0.0163 load per thread, 8.15 total. > CPUs about 32% idle. > > Results: > rjw executed 0.01% faster than teo. > rjw used 5% less energy than teo. > > Details: > http://smythies.com/~doug/linux/idle/teo-util2/waiter/perf/ > http://smythies.com/~doug/linux/idle/teo-util2/waiter/times.txt Thanks a lot for doing this work, much appreciated! > Conclusions: Overall, I am not seeing a compelling reason to > proceed with this patch set. On the other hand, if there is a separate compelling reason to do that, it doesn't appear to lead to a major regression.