From patchwork Wed Oct 10 21:20:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raju P L S S S N X-Patchwork-Id: 148583 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp1352658lji; Wed, 10 Oct 2018 14:21:29 -0700 (PDT) X-Google-Smtp-Source: ACcGV63BJG4H0qUl71Hyskh2TI4PRgokW0WLktDw9kbEqzrTrdCD2M/YlD6g6t3gjKBryrG9+4gc X-Received: by 2002:a17:902:9b89:: with SMTP id y9-v6mr34648200plp.239.1539206489772; Wed, 10 Oct 2018 14:21:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539206489; cv=none; d=google.com; s=arc-20160816; b=XXh0zj1GfGoyR8FLsGw07tENR5VncToLElUkMCwNnGi90P43VkVuo67eh1BzkSdn/H r2BxqCC5D4rC8R6OIskpOwUYCZ1b/3HpixfXQEcSEkUL5Ce2EnRp0pLwc1DwZw/Dpfv5 zUxV+APQ8rIqSgMbrtWnRR2ycEDcs6WWUfrTBvWMP25qLDuJacvQfKJv1J8UZUT/1zw0 o/RskI/DKmP8+1Fu73GXwVgar8SeAn6uoKBG4dH7hSrunjmVTKcDIq7+9S/yzOcCo3ym 7wXsbPBPXELvi8E4Ld8cF0GjRBLCr4h9/sZyrZHOksbYBc6XTF2CNvv8lo2EDyYTs/1Z 2Ssw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dmarc-filter:dkim-signature:dkim-signature; bh=MqYjzubgvBe4QUKuswXQMbTAYhRHUk9e1koEWn9kkc0=; b=a/ry3fspvcf1QDf5B5WzHifAsWd0wxXKxAGwFfN73A17EJdrQHJU1QRCvR6b748ZAb a4BQecaunC4mJuXFqOMsGLGoiROl99/hfWmzsrYDA4rGm2Z9JecGoLmkSJn1gZRRIVtl bTq8Y/z8c95ocQgiSCNjrf5wZhdXtQXx6cib/YEpyrokYXEXr5ia1DDA7pEAEnErgiuZ B1B5JhXRIi0aMVakJ2GErpww9Rqs4Jhif7Ep0xcZCqLCbsj+3y5sOfh1iucvrKNHKJz0 UGifCCUsFyELgIEEUo/h/mVt6jHWZyDuxNUPm6V5JVL2+nLfnkfJMpklCxl+INDjk7DH UVTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=IZ3VQmk3; dkim=pass header.i=@codeaurora.org header.s=default header.b=d9ojuZPb; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-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 i4-v6si22915122pgk.564.2018.10.10.14.21.29; Wed, 10 Oct 2018 14:21:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of devicetree-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=@codeaurora.org header.s=default header.b=IZ3VQmk3; dkim=pass header.i=@codeaurora.org header.s=default header.b=d9ojuZPb; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726046AbeJKEp1 (ORCPT + 6 others); Thu, 11 Oct 2018 00:45:27 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:37774 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725868AbeJKEp1 (ORCPT ); Thu, 11 Oct 2018 00:45:27 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id E481B60B7A; Wed, 10 Oct 2018 21:21:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1539206486; bh=Wgz+OIgHIlsxrkWgLNQ317LbpzFWiR/RC4D+psOfXOw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IZ3VQmk3TOej6jV6n0cofbdgIg3lROOm5XS6wZC6PdYDX57VTH6k5c4RBXoO9S2nE PSqmWy7/HP40w4RAoz/3vFI4In+psnijEGQdnCLwPk6q+6iN85U1xWLeFVSy8axDSD ulBObwgreco8wHX+KCvqrvhB8+qfSmtGuvyB/z1A= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.2 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_INVALID, DKIM_SIGNED, FROM_LOCAL_NOVOWEL autolearn=no autolearn_force=no version=3.4.0 Received: from rplsssn-linux.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: rplsssn@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id E68C260B7A; Wed, 10 Oct 2018 21:21:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1539206485; bh=Wgz+OIgHIlsxrkWgLNQ317LbpzFWiR/RC4D+psOfXOw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d9ojuZPbT7cBRMU55SSFE00kOdyYFNO3iSqaANYJa9QgFP25cmibY/D3LrU1u5hsU 7B9TeIDVArDW/wG0lI2XAnMdiKGAUXHXgH4WG+Cq4KUndljgUE+0gX6ETwwzoWVoH8 T3SYKENyyLF0zA7ll1qo3v4T8cETOUDTen/7xty0= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org E68C260B7A Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=rplsssn@codeaurora.org From: "Raju P.L.S.S.S.N" To: andy.gross@linaro.org, david.brown@linaro.org, rjw@rjwysocki.net, ulf.hansson@linaro.org, khilman@kernel.org, linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org Cc: rnayak@codeaurora.org, bjorn.andersson@linaro.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, sboyd@kernel.org, evgreen@chromium.org, dianders@chromium.org, mka@chromium.org, ilina@codeaurora.org, "Raju P.L.S.S.S.N" Subject: [PATCH RFC v1 1/8] PM / Domains: Add helper functions to attach/detach CPUs to/from genpd Date: Thu, 11 Oct 2018 02:50:48 +0530 Message-Id: <1539206455-29342-2-git-send-email-rplsssn@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1539206455-29342-1-git-send-email-rplsssn@codeaurora.org> References: <1539206455-29342-1-git-send-email-rplsssn@codeaurora.org> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org From: Ulf Hansson Introduce two new genpd helper functions, of_genpd_attach|detach_cpu(), which takes the CPU-number as an in-parameter. To attach a CPU to a genpd, of_genpd_attach_cpu() starts by fetching the struct device belonging to the CPU. Then it calls genpd_dev_pm_attach(), which via DT tries to hook up the CPU device to its corresponding PM domain. If it succeeds, of_genpd_attach_cpu() continues to prepare/enable runtime PM of the device. To detach a CPU from its PM domain, of_genpd_attach_cpu() reverse the operations made from of_genpd_attach_cpu(). However, first it checks that the CPU device has a valid PM domain pointer assigned, as to make sure it belongs to genpd. Cc: Lina Iyer Co-developed-by: Lina Iyer Signed-off-by: Ulf Hansson [rplsssn@codeaurora.org: Fix compilation issue] Signed-off-by: Raju P.L.S.S.S.N (am from https://patchwork.kernel.org/patch/10478167/) --- drivers/base/power/domain.c | 70 +++++++++++++++++++++++++++++++++++++++++++++ include/linux/pm_domain.h | 9 ++++++ 2 files changed, 79 insertions(+) -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation. diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 4b57141..82973e3 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -6,6 +6,7 @@ * This file is released under the GPLv2. */ +#include #include #include #include @@ -2398,6 +2399,75 @@ struct device *genpd_dev_pm_attach_by_name(struct device *dev, char *name) return genpd_dev_pm_attach_by_id(dev, index); } +/* + * of_genpd_attach_cpu() - Attach a CPU to its PM domain + * @cpu: The CPU to be attached. + * + * Parses the OF node of the CPU's device, to find a PM domain specifier. If + * such is found, attaches the CPU's device to the retrieved pm_domain ops and + * enables runtime PM for it. This to allow the CPU to be power managed through + * its PM domain. + * + * Returns zero when successfully attached the CPU's device to its PM domain, + * else a negative error code. + */ +int of_genpd_attach_cpu(int cpu) +{ + struct device *dev = get_cpu_device(cpu); + int ret; + + if (!dev) { + pr_warn("genpd: no dev for cpu%d\n", cpu); + return -ENODEV; + } + + ret = genpd_dev_pm_attach(dev); + if (ret != 1) { + dev_warn(dev, "genpd: attach cpu failed %d\n", ret); + return ret < 0 ? ret : -ENODEV; + } + + pm_runtime_irq_safe(dev); + pm_runtime_get_noresume(dev); + pm_runtime_set_active(dev); + pm_runtime_enable(dev); + + dev_info(dev, "genpd: attached cpu\n"); + return 0; +} +EXPORT_SYMBOL(of_genpd_attach_cpu); + +/** + * of_genpd_detach_cpu() - Detach a CPU from its PM domain + * @cpu: The CPU to be detached. + * + * Detach the CPU's device from its corresponding PM domain. If detaching is + * completed successfully, disable runtime PM and restore the runtime PM usage + * count for the CPU's device. + */ +void of_genpd_detach_cpu(int cpu) +{ + struct device *dev = get_cpu_device(cpu); + + if (!dev) { + pr_warn("genpd: no dev for cpu%d\n", cpu); + return; + } + + /* Check that the device is attached to a genpd. */ + if (!(dev->pm_domain && dev->pm_domain->detach == genpd_dev_pm_detach)) + return; + + genpd_dev_pm_detach(dev, true); + + pm_runtime_disable(dev); + pm_runtime_put_noidle(dev); + pm_runtime_reinit(dev); + + dev_info(dev, "genpd: detached cpu\n"); +} +EXPORT_SYMBOL(of_genpd_detach_cpu); + static const struct of_device_id idle_state_match[] = { { .compatible = "domain-idle-state", }, { } diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h index 776c546..48850af 100644 --- a/include/linux/pm_domain.h +++ b/include/linux/pm_domain.h @@ -241,6 +241,8 @@ struct device *genpd_dev_pm_attach_by_id(struct device *dev, unsigned int index); struct device *genpd_dev_pm_attach_by_name(struct device *dev, char *name); +int of_genpd_attach_cpu(int cpu); +void of_genpd_detach_cpu(int cpu); #else /* !CONFIG_PM_GENERIC_DOMAINS_OF */ static inline int of_genpd_add_provider_simple(struct device_node *np, struct generic_pm_domain *genpd) @@ -298,6 +300,13 @@ static inline struct device *genpd_dev_pm_attach_by_name(struct device *dev, return NULL; } +static inline int of_genpd_attach_cpu(int cpu) +{ + return -ENODEV; +} + +static inline void of_genpd_detach_cpu(int cpu) {} + static inline struct generic_pm_domain *of_genpd_remove_last(struct device_node *np) { From patchwork Wed Oct 10 21:20:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raju P L S S S N X-Patchwork-Id: 148585 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp1352884lji; Wed, 10 Oct 2018 14:21:45 -0700 (PDT) X-Google-Smtp-Source: ACcGV61QJec3ok+ghVkRaDCI0HJlthxgZvKDWRofKJsqaVmC8Rjl3JI/BLpkbNjZ2AQ0XYhzy25I X-Received: by 2002:a62:2845:: with SMTP id o66-v6mr36232323pfo.17.1539206505050; Wed, 10 Oct 2018 14:21:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539206505; cv=none; d=google.com; s=arc-20160816; b=e6kqM1nN6J9d8o9OP5/fXRJrwX6jVIp/PScVFG5gqJnemQz4NQb4hsTuCuKZSY6+Ug dxvpkbWPOH0FKNo1yuAm2N798DoZNP7gTEVIO/jp4cSl5/gxU9CTLZkiMvBGmWUT3qW1 Ch1VmynDD/9Gvf3YGaSKr8cW7KzWBJXQWbfA4s1zGUSww32ocM8AGKs+lNhjG8NMRI+Q cNZolsVTeKY2L4g8HMAi8aE8upZHSzPHZJzEDZzGRSRMfA31lbocNVJTHu/ta1iwb6IF YFgFEaQaebI1buB+Q5muF1kKIk131f8SB7q6GwA6hEc//oryGVofLZfxEf0+ThhJFc/y L9ww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dmarc-filter:dkim-signature:dkim-signature; bh=YZDhD01VxzXcehZSf8zIzgMV9+OeTRftFJdCx3rfibc=; b=ZW/ZUm5t2+Nkkffqv7tltFH+oscS1WqQvza5Y5xOQZs3ZYp+HiL+vgFdnxgcSUCJ7W l3NJrhldscflvgV24kvDNYOZmvTO0Q+OyUdqalH/aYCh+GghsLqPsdg4QXvOajw59FwG ifXeNp/e97ODC1x77h+dY/1N8F9qBg9ZYTxb2+lqMdHNyoHHKqxNle68UL/i6lyVLhs6 x+SA1Xbn7kYZgE1CONWS9TGx2aEg8qIO7b4I2e7YRbBDOEZNfjpte1QHbsC/p4M1a02n ES+WF+8IPZFA4ABrKSKbj076gBJEC6bVwWikyu3UvNO7DO8quU9psgNfpRgGauKpBiHi u4pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=TmIudI9P; dkim=pass header.i=@codeaurora.org header.s=default header.b=hyBpp4W1; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-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 m7-v6si27111039pgl.345.2018.10.10.14.21.44; Wed, 10 Oct 2018 14:21:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of devicetree-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=@codeaurora.org header.s=default header.b=TmIudI9P; dkim=pass header.i=@codeaurora.org header.s=default header.b=hyBpp4W1; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725868AbeJKEpn (ORCPT + 6 others); Thu, 11 Oct 2018 00:45:43 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:38184 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725899AbeJKEpn (ORCPT ); Thu, 11 Oct 2018 00:45:43 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 67ACF60C60; Wed, 10 Oct 2018 21:21:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1539206502; bh=S111ydwN3Rpmcs3kPsAcfRoMDUH6nJcnZx4HI+bxqfs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TmIudI9PMtoFEw+unqFA7ehIQ0DQdQCGdgy0fJLLTc+oEpHKv5Fmnp2qQgJjQ1bOO 636jRrg45dSfR3EjzCaOZk8yvFVv9UH8365TpC6XJDssTvne16EsQgkxcgoVsHM/9X FgF+TPADdCFl0ODhp5G+9j5RJ12UqjnAEvqL1M7M= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.2 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_INVALID, DKIM_SIGNED, FROM_LOCAL_NOVOWEL autolearn=no autolearn_force=no version=3.4.0 Received: from rplsssn-linux.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: rplsssn@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id AEF9860B73; Wed, 10 Oct 2018 21:21:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1539206500; bh=S111ydwN3Rpmcs3kPsAcfRoMDUH6nJcnZx4HI+bxqfs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hyBpp4W1fLiyRB3p59reuSEBkaO7ixGKwl8pLoUOUI8RHYE1rtOt9FWC9XML0gbhf U/d6rDESuoaPVvDjAq076q7wzyzRgheqlIoTP2c4yWsXFek/O0EeHlGTZ/PpaPWdHQ kOzd0MTLAjamuxZLr6StaqYyybkO/l85/TH4zalE= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org AEF9860B73 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=rplsssn@codeaurora.org From: "Raju P.L.S.S.S.N" To: andy.gross@linaro.org, david.brown@linaro.org, rjw@rjwysocki.net, ulf.hansson@linaro.org, khilman@kernel.org, linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org Cc: rnayak@codeaurora.org, bjorn.andersson@linaro.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, sboyd@kernel.org, evgreen@chromium.org, dianders@chromium.org, mka@chromium.org, ilina@codeaurora.org, Lina Iyer , Thomas Gleixner , Daniel Lezcano , Frederic Weisbecker , Ingo Molnar , "Raju P.L.S.S.S.N" Subject: [PATCH RFC v1 3/8] timer: Export next wakeup time of a CPU Date: Thu, 11 Oct 2018 02:50:50 +0530 Message-Id: <1539206455-29342-4-git-send-email-rplsssn@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1539206455-29342-1-git-send-email-rplsssn@codeaurora.org> References: <1539206455-29342-1-git-send-email-rplsssn@codeaurora.org> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org From: Lina Iyer Knowing the sleep duration of CPUs, is known to be needed while selecting the most energy efficient idle state for a CPU or a group of CPUs. However, to be able to compute the sleep duration, we need to know at what time the next expected wakeup is for the CPU. Therefore, let's export this information via a new function, tick_nohz_get_next_wakeup(). Following changes make use of it. Cc: Thomas Gleixner Cc: Daniel Lezcano Cc: Lina Iyer Cc: Frederic Weisbecker Cc: Ingo Molnar Signed-off-by: Lina Iyer Co-developed-by: Ulf Hansson Signed-off-by: Ulf Hansson Signed-off-by: Raju P.L.S.S.S.N (am from https://patchwork.kernel.org/patch/10478021/) --- include/linux/tick.h | 8 ++++++++ kernel/time/tick-sched.c | 10 ++++++++++ 2 files changed, 18 insertions(+) -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation. diff --git a/include/linux/tick.h b/include/linux/tick.h index 55388ab..e48f6b2 100644 --- a/include/linux/tick.h +++ b/include/linux/tick.h @@ -125,6 +125,7 @@ enum tick_dep_bits { extern ktime_t tick_nohz_get_sleep_length(ktime_t *delta_next); extern unsigned long tick_nohz_get_idle_calls(void); extern unsigned long tick_nohz_get_idle_calls_cpu(int cpu); +extern ktime_t tick_nohz_get_next_wakeup(int cpu); extern u64 get_cpu_idle_time_us(int cpu, u64 *last_update_time); extern u64 get_cpu_iowait_time_us(int cpu, u64 *last_update_time); @@ -151,6 +152,13 @@ static inline ktime_t tick_nohz_get_sleep_length(ktime_t *delta_next) *delta_next = TICK_NSEC; return *delta_next; } + +static inline ktime_t tick_nohz_get_next_wakeup(int cpu) +{ + /* Next wake up is the tick period, assume it starts now */ + return ktime_add(ktime_get(), TICK_NSEC); +} + static inline u64 get_cpu_idle_time_us(int cpu, u64 *unused) { return -1; } static inline u64 get_cpu_iowait_time_us(int cpu, u64 *unused) { return -1; } diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c index 5b33e2f..bca95f9 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c @@ -1089,6 +1089,16 @@ unsigned long tick_nohz_get_idle_calls(void) return ts->idle_calls; } +/** + * tick_nohz_get_next_wakeup - return the next wake up of the CPU + */ +ktime_t tick_nohz_get_next_wakeup(int cpu) +{ + struct clock_event_device *dev = per_cpu(tick_cpu_device.evtdev, cpu); + + return dev->next_event; +} + static void tick_nohz_account_idle_ticks(struct tick_sched *ts) { #ifndef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE