Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3043525imu; Wed, 7 Nov 2018 04:11:05 -0800 (PST) X-Google-Smtp-Source: AJdET5eAwtlgEeRrfU93HVL12cwCRaB31KR/A1CwQ1BeWcYSJFM/8ahDRSUl1K+0/sxWuAeMwT/+ X-Received: by 2002:a63:a30a:: with SMTP id s10mr1258900pge.234.1541592665904; Wed, 07 Nov 2018 04:11:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541592665; cv=none; d=google.com; s=arc-20160816; b=V8UteU8GC7HNrOiS06f7X8RHrMBqmKlCKrms9pqhnmbeUnPuiDXnykLasJi8OOULZG zOaZ6StA078AlAsb5csTNOxNqdaPSpHxdXUTxapGmmAM8H9W7eZZcseb1MIeHkgEmT4c FIhLigRk0Ad22g6CKAVN5VQ3Y7Y680KhFHUqlZ3VMYbw2QVEJCZWV+DXbASmWRwxd+Ex JI098J1jsV9DEWjvYaU2ti5v+Qcb3pC68d0+ZjMuUAca3aNyhg+PNu6Dr/oprYC6rJxW 7wvk3sbeccVLHVkbawa+sxaluqQK51E2m5zcO0oerSDvYmoWHEyX0DR2uzJu022R0KkG GwXA== 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 :in-reply-to:references:mime-version; bh=aNBV8O4UWxL6yl74jBOnzUsZz7Qhj2Vhoe/FAYVFy90=; b=ml4yPaYDJIExOEh9XtzVyAM4/0jd3XEFlx0wQi8N53Ciq4+0KfAb+hR6+yEgR1yi/I Alltpr38BeVf/mqCNLv2jlnsUl77QtXwn2ABXykmaswoVLJvw1c7u54vCMzGTrF+3Qlx 2BQANxlSWvsZaNlk2sqW5O5O8JChX9Ed7lqc99ISv3UirYgYaES54LCvlGUEJixu6fHK JGZAN42qyBHwDeSoYDgPvVlkFILG5Q1HK1OsYCxRPt6B0mr2dU+e5LrLjq/jQW+qx0dr zaycZ+755iDWQRErSdzbQiRrVhMb9tqsOu10IuSZRCa5LRSBdBD+dzxfnvw/ryDIM1b3 8ncw== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o186-v6si467966pfo.236.2018.11.07.04.10.50; Wed, 07 Nov 2018 04:11:05 -0800 (PST) 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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731007AbeKGVkR (ORCPT + 99 others); Wed, 7 Nov 2018 16:40:17 -0500 Received: from mail-oi1-f195.google.com ([209.85.167.195]:34490 "EHLO mail-oi1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726493AbeKGVkR (ORCPT ); Wed, 7 Nov 2018 16:40:17 -0500 Received: by mail-oi1-f195.google.com with SMTP id i138-v6so10617546oib.1; Wed, 07 Nov 2018 04:10:10 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=aNBV8O4UWxL6yl74jBOnzUsZz7Qhj2Vhoe/FAYVFy90=; b=uea5LH3KLdETiUMMhU4mQWo3cRsiikD33vETbB4Nl074xs8zxhglVukq+SeJkn/G5A SUNiINwETeL5Eu36Lp1+AUQ7Q98GBoCITQuusDUMpQQ+pAeg9A2fTrEtiL2OAJiNA3x7 e94uLHQJKPzDBrPa6K0HTzGqKnj9X8KPPKe5BGd9BouuqEsb1i+6I+s1Jy+gUf2r34iX cOenIciqizXHm2qeS/gw25Ij2QIJ4GVOuaBYGNRiPFwL0xF2Y4I1tUfq94f6tSloeq5c yooObd5ahX3sqRI7v5308eHksijTUC3vQw0Iplxiy6PV0z1f4WFniNZHwhDUqxJtzDMk TDQQ== X-Gm-Message-State: AGRZ1gKOsVqum8ic9cWUXbY8c58ceqJSMu/w15DGzbhyJwBwhsQg+jq8 nfqwkijUs+8u0NwRJxSV2luhp5nrqxgMZ21tKoViTqMQ X-Received: by 2002:aca:c2c3:: with SMTP id s186-v6mr846599oif.193.1541592610035; Wed, 07 Nov 2018 04:10:10 -0800 (PST) MIME-Version: 1.0 References: <1556808.yKVbhZSazi@aspire.rjw.lan> <20181106170442.GC9781@hirez.programming.kicks-ass.net> <20181106195127.GD9781@hirez.programming.kicks-ass.net> <20181107085936.GI9781@hirez.programming.kicks-ass.net> In-Reply-To: <20181107085936.GI9781@hirez.programming.kicks-ass.net> From: "Rafael J. Wysocki" Date: Wed, 7 Nov 2018 13:09:58 +0100 Message-ID: Subject: Re: [RFC/RFT][PATCH v3] cpuidle: New timer events oriented governor for tickless systems To: Peter Zijlstra Cc: "Rafael J. Wysocki" , "Rafael J. Wysocki" , Linux PM , Giovanni Gherdovich , Doug Smythies , Srinivas Pandruvada , Linux Kernel Mailing List , Frederic Weisbecker , Mel Gorman , Daniel Lezcano 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 Wed, Nov 7, 2018 at 9:59 AM Peter Zijlstra wrote: > > On Wed, Nov 07, 2018 at 12:39:31AM +0100, Rafael J. Wysocki wrote: > > On Tue, Nov 6, 2018 at 8:51 PM Peter Zijlstra wrote: > > > > > > On Tue, Nov 06, 2018 at 07:19:24PM +0100, Rafael J. Wysocki wrote: > > > > On Tue, Nov 6, 2018 at 6:04 PM Peter Zijlstra wrote: > > > > > > > > Instead of this detector; why haven't you used the code from > > > > > kernel/irq/timings.c ? > > > > > > > > Because it doesn't help much AFAICS. > > > > > > > > Wakeups need not be interrupts in particular > > > > > > You're alluding to the MWAIT wakeup through the MONITOR address ? > > > > Yes. > > Right, those will not be accounted for and will need something else. Precisely. :-) > > > > and interrupt patterns that show up when the CPU is busy may not be > > > > relevant for when it is idle. > > > > > > I think that is not always true; consider things like the periodic > > > interrupt from frame rendering or audio; if there is nothing more going > > > on in the system than say playing your favourite tune, it gets the > > > 'need more data soon' interrupt from the audio card, wakes up, does a little > > > mp3/flac/ogg/whatever decode to fill up the buffer and goes back to > > > sleep. Same for video playback I assume, the vsync interrupt for buffer > > > flips is fairly predictable. > > > > > > The interrupt predictor we have in kernel/irq/timings.c should be very > > > accurate in predicting those interrupts. > > > > In the above case the interrupts should produce a detectable pattern > > of wakeups anyway. > > Ah, not so. Suppose you have both the audio and video interrupt going at > a steady rate but different rate, then the combined pattern isn't > trivial at all. It isn't trivial, but it will appear as a "pattern" to the pattern detector in v4 of the patch. Basically, all of that is about looking for a reason to select a shallower idle state than indicated by the time till the closest timer alone. From that standpoint it makes sense to look at several most recent wakeups and see if a pattern is forming in there, which is what the code in v4 of the patch does. It also makes sense to look at interrupt patters, but that is costly, so the overhead needs to be justified. The question to me is whether or not there is any additional value in that given that the most recent wakeups are (and IMO need to be) taken into consideration anyway. > > In general, however, I need to be convinced that interrupts that > > didn't wake up the CPU from idle are relevant for next wakeup > > prediction. I see that this may be the case, but to what extent is > > rather unclear to me and it looks like calling > > irq_timings_next_event() would add considerable overhead. > > How about we add a (debug) knob so that people can play with it for now? > If it turns out to be useful, we'll learn. So I'm inclined to try to invoke irq_timings_next_event() in addition to looking at the most recent wakeups and see how far that can get us. With some extra instrumentation in place it should be possible to verify how much value that brings to the table.