Received: by 10.213.65.68 with SMTP id h4csp599133imn; Tue, 20 Mar 2018 10:30:32 -0700 (PDT) X-Google-Smtp-Source: AG47ELuL8TCaDcpK5aGbiCdQgVhUKV3sgsfBW9RxpRuLy0s2zW5m8wRb1OS4emc7IIeo61v3luIT X-Received: by 2002:a17:902:4481:: with SMTP id l1-v6mr17605062pld.43.1521567032508; Tue, 20 Mar 2018 10:30:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521567032; cv=none; d=google.com; s=arc-20160816; b=EbiDRDQifUDk+RA3MuyP9T92uioTC/S2SNXrTBNPGyU13X+sJNfLhjKBvr5IzIEVZr LocZ/3XwMIutHsOaSFsIVdiS3KMkvZU2baxewmWaRdrN3ojfVYlDa0yLKQbGD7kvYyWI 4oJRSt78402kLvTVrdKkR0bM7ayhRZGcXAyg2sA7VvgpJ9YkLbADy6VVsol+fcKKkWgC ZMWR2CJlG1xMn2cysVucFI/pyujs9/MUb8zgrC047jgt8wjp/wi9pcRU6bHts8g561pa fkfX7Op6uy3VtQMo5qy5S5zWUo13H5j7+2OvcLTK9zPdRThO5eFJwwHZZgIppsAy32lG XpIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=qfovTLlxGQxczkcD9+0PVFCZ4l9/0mMdIWXCwL8SEWc=; b=iWMMMbzJGYCvaRoqIcSDqnJjsLQFi5wYqdGvjP+fbAaU4ul4qIoZipjEUnwDnC23Dd SzCzbw/WraFnTcgmYvltmIquZGxNtXmsase9yKDf9MQ9xStZ50+BpRYRydQFWn3QsnLV g3G5zj+4HmRb5CALgIuK5Gl1SejrrqxXDSon2zDQwXmSjkOoruFrlG4fBwnlkRFQumFZ XB/BCgCIIwIp6zVre1hZHWD0oba+YxLL8xg7TSm4Ci+YRzR1xiFwvJAysrvRjsNZQtqZ fnapj6bzqsKP40Di+ReVL/HtCxJpB5dTaWa4ncVUI4F18uoogsxLxw+sOqjhgQc6eX17 sH7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=TZdYXpHG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z1-v6si2054540plb.162.2018.03.20.10.30.18; Tue, 20 Mar 2018 10:30:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=TZdYXpHG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751751AbeCTR21 (ORCPT + 99 others); Tue, 20 Mar 2018 13:28:27 -0400 Received: from mail-oi0-f47.google.com ([209.85.218.47]:37256 "EHLO mail-oi0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751531AbeCTR2W (ORCPT ); Tue, 20 Mar 2018 13:28:22 -0400 Received: by mail-oi0-f47.google.com with SMTP id f186-v6so2029971oig.4; Tue, 20 Mar 2018 10:28:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=qfovTLlxGQxczkcD9+0PVFCZ4l9/0mMdIWXCwL8SEWc=; b=TZdYXpHGMAV5DrWp9lsQG5Z5h5+g8Y4erPrWVzkET2gCPXR1nqYjWfLMn1T44mgVGS SC++9GDavb5EA60+aaXdtjZpIJAMAIn0CI/0WNrnhuhmsfvcElfj+vv6+tcIlIW9TOhU XKl8ADlxnmiuipynzRmr8wc911WztE59e5XcGVeP7VvsoZUKbVjcLX5ONM3jD2B8uIpg 63xNVvtrLbqlZMX5p86b8jgnvuR8bwM5YwpbBpYaORWFQz1lhZOyF7p2ngNZ57LsjqXq xoReEbXNRwYkLUfH3LVjffaV4a6zHkTjMRtRQ6+6YibvkYPpE79fstdIfEtVXL+73QXo SuNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=qfovTLlxGQxczkcD9+0PVFCZ4l9/0mMdIWXCwL8SEWc=; b=XEM14r04Vbnnwfilwqxlh7zjNEx+OsfgTWKrd8JEY4Nnq1aiSHZoMsnOQXWhqbWVSq m9NBk3Qm/EpirqN0/bWymvF1mC2aawTry4OqoTAYl+aqrAnFQmaSJrWdguTRsG2PUh+p 0lI+XuTBR2Ncxh9Z3A3xklh8PzNyRYoNmgdqx1WnnaX/TWIT34Zaq7PsYdOjvHMofI3H R7LBGRaI/7UCb/UMIVuQ2NdE+di1y/2SZaeO6+SfcK+PU58Ez02QpYmbW5wt8Puw7rNP cJwETOpRl7v8n+9h4feIpRCVymHKRD3/GvoUFi+FPFwjc7VzLd0lQYzcebNyF186P6a5 OQow== X-Gm-Message-State: AElRT7Hi2wbElgDQ9aAmRxT5OZZVHbLlj6tsExXHndDZEb5AcmMs50Tp NQPbpyGMyIEOMxzIlfJ7NA1rpQjDYQ6qA1KrqK0= X-Received: by 10.202.108.73 with SMTP id h70mr9579483oic.282.1521566901575; Tue, 20 Mar 2018 10:28:21 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a9d:9f7:0:0:0:0:0 with HTTP; Tue, 20 Mar 2018 10:28:21 -0700 (PDT) In-Reply-To: <002401d3c06e$fed035b0$fc70a110$@net> References: <2142751.3U6XgWyF8u@aspire.rjw.lan> <2148754.TY7qXgFyZy@aspire.rjw.lan> <002401d3c06e$fed035b0$fc70a110$@net> From: "Rafael J. Wysocki" Date: Tue, 20 Mar 2018 18:28:21 +0100 X-Google-Sender-Auth: 5IKYuoBreazpXjwvFYV3Ldf1NPU Message-ID: Subject: Re: [RFT][PATCH v5 7/7] cpuidle: menu: Avoid selecting shallow states with stopped tick To: Doug Smythies Cc: Thomas Ilsche , "Rafael J. Wysocki" , Thomas Gleixner , Paul McKenney , Rik van Riel , Peter Zijlstra , Aubrey Li , Mike Galbraith , Frederic Weisbecker , LKML , Linux PM Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 20, 2018 at 6:15 PM, Doug Smythies wrote: > On 2018.03.20 11:22 Doug Smythies wrote: >> On 2018.03.19 05:47 Thomas Ilsche wrote: >>> On 2018-03-15 23:19, Rafael J. Wysocki wrote: >>>> From: Rafael J. Wysocki >>>> >>>> If the scheduler tick has been stopped already and the governor >>>> selects a shallow idle state, the CPU can spend a long time in that >>>> state if the selection is based on an inaccurate prediction of idle >>>> time. That effect turns out to be noticeable, so it needs to be >>>> mitigated. >>> >>> What are some common causes for that situation? >>> How could I trigger this for testing? >> >> It appeared quite readily with my simple 100% load >> on one CPU test. Back then (V3) there only 6 patches in the set, >> and before the re-spin there ended up being a patch 7 of 6, which >> made a significant difference in both package power and the >> histograms of times in each idle state. >> >> Reference: >> https://marc.info/?l=linux-pm&m=152075419526696&w=2 > > I made a kernel (4.16-rc5) with only patches 1 to 6 of 7 (V6) > and also with the poll fix. > > I took an old graph: > http://fast.smythies.com/rjwv3pp_100.png > > and removed an obsolete line and added a line from this > kernel: > > http://fast.smythies.com/rjwv6m_100.png > > I also acquired a trace during the test and observe: > > Report: Summary: > > Idle State 0: Total Entries: 699 : PowerNightmares: 0 : Not PN time (seconds): 0.031169 : PN time: 0.000000 : Ratio: 0.000000 > Idle State 1: Total Entries: 3855 : PowerNightmares: 106 : Not PN time (seconds): 0.123759 : PN time: 43.511914 : Ratio: 351.585856 > Idle State 2: Total Entries: 3688 : PowerNightmares: 181 : Not PN time (seconds): 1.303237 : PN time: 63.241424 : Ratio: 48.526418 > Idle State 3: Total Entries: 528 : PowerNightmares: 115 : Not PN time (seconds): 0.276290 : PN time: 44.764111 : Ratio: 162.018571 > > Where "PowerNightmare" is defined as spending excessive time in an idle state, > and arbitrarily defined for my processor as: > > #define THRESHOLD_0 100 /* Idle state 0 PowerNightmare threshold in microseconds */ > #define THRESHOLD_1 1000 /* Idle state 1 PowerNightmare threshold in microseconds */ > #define THRESHOLD_2 2000 /* Idle state 2 PowerNightmare threshold in microseconds */ > #define THRESHOLD_3 4000 /* Idle state 3 PowerNightmare threshold in microseconds */ > > While this trace file was only about 15 megabytes, I have several 10s of gigabytes of trace data for > V4 + poll fix and never see any excessive time spent in any idle state. Thanks for this work! I prefer it with patch [7/7]. :-)