Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2946414imu; Wed, 7 Nov 2018 02:15:37 -0800 (PST) X-Google-Smtp-Source: AJdET5elqqgPNgnFoDyXqsEPkUl2KbjV79+eZzxnkwMNBKTsCoIObbwP/m20vyi8d/w9VrIe7PTH X-Received: by 2002:a63:1342:: with SMTP id 2-v6mr1043127pgt.19.1541585737006; Wed, 07 Nov 2018 02:15:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541585736; cv=none; d=google.com; s=arc-20160816; b=nEJqMdveKhSLM85zZdLXgNPg+Dz33L1bZriM6yViAPTcKGpjV+dyydiWxHv5K0Llj1 JpkmLJxvqhSh35RaBgx0eRusAfkY9+O2Qv4dIBaLx96lY7bzmY7aaYgRoe2sYKzjr3yk enFCZbqfvmtY5aoDQCR9rBknt/aU58ucwHLefA38/LuegJxPqe47jCPZYRnIzvyFEgoE HmqcLqRux4xRQDgz93ywwyTbRn9HQ3UywlB4yPPzn7cZFiqX8DZ1p6YQoRkwl2RMZx+t 8t5aY8vOIMYPNdZ6RjIaiLuVmxCZS9ePkUDUW7nIyZGknEGt69Ogxm9RDr4e+mYdf8ET Ze8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=9fXbxF/K4BVxiGE+fJXIKE7FeF9SJqFRvs4QHVh+Cgg=; b=tVE/dXleh9xDX6EupU3EPZGxA4jYTysy34RE5+WnJ2L6Cfeh7oZiK04WSdZSrFHM3z EnPiBammE2cqVqUHCPNyrWqMAUDDJNbnBIxMRJyA8yJxHEFi3viPZL3uK3G5/qo8zjCV Y/4j/UuEkJHvLpfXgzk2dE0XrFP4zgoPCpfjU5Z9+mJkX5HlNzam7EL3IG2Z9/dgDju7 htngkz/qAPmky+xjXD2V+kV2NzBo1C/kelk0bQOg91IHbVnXofFq6h6ee/UEm1tVTpoM F7VhYSNL3Y3XWtRh9kvabeiN0Xx7XlJqj7SyGFv1afHJhTlYHasebS4/lANgn+sutLOX tFkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=P4uLwq8d; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a3si166695pga.297.2018.11.07.02.15.20; Wed, 07 Nov 2018 02:15:36 -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; dkim=pass header.i=@linaro.org header.s=google header.b=P4uLwq8d; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729972AbeKGTnU (ORCPT + 99 others); Wed, 7 Nov 2018 14:43:20 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:39282 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726218AbeKGTnT (ORCPT ); Wed, 7 Nov 2018 14:43:19 -0500 Received: by mail-wm1-f67.google.com with SMTP id u13-v6so15237253wmc.4 for ; Wed, 07 Nov 2018 02:13:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=9fXbxF/K4BVxiGE+fJXIKE7FeF9SJqFRvs4QHVh+Cgg=; b=P4uLwq8d5Bp4zxpD1RkvYf37e5z8HR4kT2m6zKRyEPsJEzLJZdo+AKOfhZYRTjCEXc xrNDhYnVnqP+sMBR5J97+HLY1b7y5ZZ6n9h8eINGmwrAil0cdd4+VvlrgAAQCjas4FUB nje4zE8DQFTnYQD2jxoCI35us3QnGx5E6lLFg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=9fXbxF/K4BVxiGE+fJXIKE7FeF9SJqFRvs4QHVh+Cgg=; b=SPj8sbZq5voVL0ZXe1H0qDraHHlyzMsM8vmspyqWGq0zjTo78XqGw0ESjVptqglbK8 3cwXHkUpivuI1Sp5RotmA8YwV/NUFmovjLVRycy/V3gtOi08HrroS2aPJh0zDSDImnen ftB91D8L6HvpJHIfulC41oOmGdjgidncPMiV7wMEXoHTXqT4TITCGyg3WnEwujM5tf82 6hpsPZLdIm8igHPy0ksiJqikiCJJaHXiSyUDSemBp+vWZftXwXVkigHmqYMwT/IiPHPp 5UzlGatPQPVJOebNNKeN+5rHRFfILYow9Tv1CT8wvv2lyKjBJLHW9L5DKhSJjFdn78o/ 7KpQ== X-Gm-Message-State: AGRZ1gJVD6YZVfTgQ++RNFR5u/oOKw9KtkT14seBVSfTy0WukCfQWJ4m 9O/HoLlNzk8+aaEJ3we+N3Ozig== X-Received: by 2002:a1c:38c5:: with SMTP id f188-v6mr1368848wma.19.1541585616972; Wed, 07 Nov 2018 02:13:36 -0800 (PST) Received: from [192.168.0.40] (161.230.136.77.rev.sfr.net. [77.136.230.161]) by smtp.googlemail.com with ESMTPSA id j18-v6sm1047784wmf.39.2018.11.07.02.13.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Nov 2018 02:13:36 -0800 (PST) Subject: Re: [RFC/RFT][PATCH v3] cpuidle: New timer events oriented governor for tickless systems To: "Rafael J. Wysocki" , Peter Zijlstra Cc: "Rafael J. Wysocki" , Linux PM , Giovanni Gherdovich , Doug Smythies , Srinivas Pandruvada , Linux Kernel Mailing List , Frederic Weisbecker , Mel Gorman References: <1556808.yKVbhZSazi@aspire.rjw.lan> <20181106170442.GC9781@hirez.programming.kicks-ass.net> <20181106195127.GD9781@hirez.programming.kicks-ass.net> From: Daniel Lezcano Message-ID: <8a2240ab-92e2-e402-a086-1b39d04d5581@linaro.org> Date: Wed, 7 Nov 2018 11:13:34 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/11/2018 00:39, 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. > >>> 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. > > 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. I agree the current irq next event can add an overhead and actually it works well if there are interrupts with regular interrupts but with irregular timings interval we need to search a pattern. The first version called 'anova' I shared with you (Peter and Rafael) privately is pretty good to detect such intervals but the algorithm has a cost in terms of computation in the self-learning phase. I dropped this approach as it could be overkill. I'm working on a different algorithm to detect such patterns which should be faster. That said, the pattern detection process shouldn't be happening every time we enter idle but when the pattern is invalidated. Until the pattern gives a successful prediction, we keep it and the repeating period is used to give the next event. So IMO, the cost to detect the pattern should be compensated by the computation saving we do if the pattern is found successfully. These are all assumptions, hopefully I can provide a patch series and numbers in January ... -- Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog