From patchwork Fri Mar 8 21:20:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 160001 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp9204437jad; Fri, 8 Mar 2019 13:21:07 -0800 (PST) X-Google-Smtp-Source: APXvYqyzMdKgxgnh7nF8U6EcVi0eov2S2RKcGCtc2wA0r+QIcwpwzL+mbVHRfUqyAzvMJIdvRfIO X-Received: by 2002:a63:f310:: with SMTP id l16mr18537271pgh.72.1552080067559; Fri, 08 Mar 2019 13:21:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1552080067; cv=none; d=google.com; s=arc-20160816; b=MehR33zuRG9YMbFcPvO4pE4GSry3whax/jHYQqMjy+xRZwtlwcGT9UF7In8Wlm4fxx L4A6jh/qTdG5Up3fwTZrFMFoGYP5bmVqe6H61g6zpFWTVcnIY7+KtsEbiGGMFFwIdNlE ZnybyyKl7ARSH5zTpaxQzreiwT5+aaiKrQgIEMelhN0bkLTMxztozjTsTNghyrjys5u9 fxUx1NRWn9+RxpWYXgUAM35ojfKLWyF3MtR6s38HQ6Qgf8WHwiTWBUmp5F0wlAGwBySq rkQ6SXuJ7QcBaRvbzDQ7bMQf6kMizlo6OTX6kqoHCmxT7IZW2/AoG36cFkJcEPfMLJIN 1b8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=Ne9yb9VUqbc5mhujnU04vF9d+jUVhs1WNFkzZ9SVc1I=; b=jxDS6RKDJ6Na/7ExYrDfbjW7HtUFdmaYLep2yK0kW4sKagVqJ2DWo1DTyPodIYpZjC V2GmP79sBbtG9f9pPSGgUMEpLgt3XG41nWbnghgzrmF30wnWoiAyQPWJMyhqIGfcDf0E mbQmYztQ9wdPvvZ8R66Arc0s8v2BQ2ZWbLS9BxJ1fokEU4bTjfeQ1x9X8R6+tQhufvd1 DkxHBu4LoL4gS5YYPJCxcIfIqWxgzOYiEz4QRdDTD4ZPPyCOqNgDk1v1zTIPbyxgzGrV NLVQktF+UkEFQw0ASiRwOBV+8OCwBUzimBaa1dmqj/1/56ipXW5w8xUtWR6tmBn/7cVD yOKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=j5eVKL1Y; 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 z20si7598214pgf.324.2019.03.08.13.21.07; Fri, 08 Mar 2019 13:21:07 -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=j5eVKL1Y; 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 S1726531AbfCHVVF (ORCPT + 31 others); Fri, 8 Mar 2019 16:21:05 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:40928 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726275AbfCHVVF (ORCPT ); Fri, 8 Mar 2019 16:21:05 -0500 Received: by mail-wr1-f68.google.com with SMTP id t6so3609380wrw.7 for ; Fri, 08 Mar 2019 13:21:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=Ne9yb9VUqbc5mhujnU04vF9d+jUVhs1WNFkzZ9SVc1I=; b=j5eVKL1YtiJo+d4hr1Y8V48gVOeI68d2COvxTtMyUTN2ne0EUUqkCxWw/rhq4x1jwV b5waafFFke5yiJCgmu0tIKVv42kGWWXctVwqaKoKs7vCVq8gwL3q+junKGytIIDPV3qF amCBWScoo7+1Yw3sWw3/Gu0pvSMPO0nu6DKmBzEVCR7gF2M7b58Am0C98i4wHHQ01qyk bb+CEJ/FhBXC6nN+v3e5/EQOp/RJ+VRT+yZ2L880aQ8Y7vPHkx0rN0sHV1O4wjBuLbMs QtDZ+NcYEjfBtngv4l3B18d5kJLllNbZFLss7FZNLSm0FJl6zlRMcXcq6oZYczUL2qx2 KyVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Ne9yb9VUqbc5mhujnU04vF9d+jUVhs1WNFkzZ9SVc1I=; b=WUNkTX86s2uH8uVwh7QgKxmQm/RlexhSjsDVdnzGmcqaL0kN8BxL2928ho5F4/hUMO r7tq28QdZ+da3jLhQBfh8iw+aEihVLwuXwHBjSMbQ7lQod28fh7ZiKPyJsYN5SJk7Srl 5vfeLeb67nHsQiz7Awt5f8rbNBMLm9C2R6PtSzxNCvG8KQQT23F/NshqTjXDcZRMrRFk lVqib8S+fTU+CzHT3jN8/prTxme0eXjW6vyxmUP0BivreVBI//F8PS5l93EwnjGKC6YH 5/c0Gytj0IeVc2LFpTOBUyud79CQgfL0qy17t5EAD6G302HixgxP9hK5oVla/qIkWQCW WEqw== X-Gm-Message-State: APjAAAUJhOP9qufhNGxlDCVHkwXPvP9tZOA9RBW61DjiRSXMaIXl3J12 HAoh29WwNslR1CEismpxH6oPlQ== X-Received: by 2002:adf:f711:: with SMTP id r17mr4243207wrp.38.1552080063146; Fri, 08 Mar 2019 13:21:03 -0800 (PST) Received: from clegane.local (246.127.130.77.rev.sfr.net. [77.130.127.246]) by smtp.gmail.com with ESMTPSA id d2sm13568507wrq.94.2019.03.08.13.21.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Mar 2019 13:21:02 -0800 (PST) From: Daniel Lezcano To: rjw@rjwysocki.net, tglx@linutronix.de Cc: ulf.hansson@linaro.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 0/3] IRQ next prediction and mbed governor Date: Fri, 8 Mar 2019 22:20:44 +0100 Message-Id: <20190308212047.28767-1-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following patchset provides the missing bits to predict the next event on the the current CPU by identifying three categories of wakeup sources, the interrupts from the devices, the timers and the IPI rescheduling. Initially, the interrupt prediction was based on the statistical normal law, discarding interrupt intervals out of the gaussian curve, thus allowing to predict only interrupts coming in regular intervals. Unfortunately this approach prevents to handle any kind of irregular intervals, closing the door for more accuracy in the prediction. With a derived array suffixes algorithm, it is possible to quickly detect the repeating patterns in less than 1us per interrupt on x86. The algorithm is described in the documentation. It is simple in in apparence but it needs some attention to understand how it allows to detect the pattern and return a guess estimate of the next event. And finally, a new cpuidle governor is added to make use of these predictions for the different wake up sources but targetting embedded systems. Daniel Lezcano (3): genirq/timings: Remove variance computation code genirq/timings: Add array suffix computation code cpuidle/drivers/mbed: Add new governor for embedded systems drivers/cpuidle/Kconfig | 11 +- drivers/cpuidle/governors/Makefile | 1 + drivers/cpuidle/governors/mbed.c | 143 +++++++++ kernel/irq/timings.c | 488 +++++++++++++++++++---------- 4 files changed, 485 insertions(+), 158 deletions(-) create mode 100644 drivers/cpuidle/governors/mbed.c -- 2.17.1