Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.2/patches/2235049/?format=api
{ "id": 2235049, "url": "http://patchwork.ozlabs.org/api/1.2/patches/2235049/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20260508131647.43868-14-frederic@kernel.org/", "project": { "id": 2, "url": "http://patchwork.ozlabs.org/api/1.2/projects/2/?format=api", "name": "Linux PPC development", "link_name": "linuxppc-dev", "list_id": "linuxppc-dev.lists.ozlabs.org", "list_email": "linuxppc-dev@lists.ozlabs.org", "web_url": "https://github.com/linuxppc/wiki/wiki", "scm_url": "https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git", "webscm_url": "https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/", "list_archive_url": "https://lore.kernel.org/linuxppc-dev/", "list_archive_url_format": "https://lore.kernel.org/linuxppc-dev/{}/", "commit_url_format": "https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/commit/?id={}" }, "msgid": "<20260508131647.43868-14-frederic@kernel.org>", "list_archive_url": "https://lore.kernel.org/linuxppc-dev/20260508131647.43868-14-frederic@kernel.org/", "date": "2026-05-08T13:16:45", "name": "[13/15] sched/cputime: Provide get_cpu_[idle|iowait]_time_us() off-case", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "ab21c1efa445800c9f634cf844bd0730c3a0d412", "submitter": { "id": 79411, "url": "http://patchwork.ozlabs.org/api/1.2/people/79411/?format=api", "name": "Frederic Weisbecker", "email": "frederic@kernel.org" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20260508131647.43868-14-frederic@kernel.org/mbox/", "series": [ { "id": 503389, "url": "http://patchwork.ozlabs.org/api/1.2/series/503389/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=503389", "date": "2026-05-08T13:16:32", "name": "tick/sched: Refactor idle cputime accounting", "version": 4, "mbox": "http://patchwork.ozlabs.org/series/503389/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2235049/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2235049/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "\n <linuxppc-dev+bounces-20623-incoming=patchwork.ozlabs.org@lists.ozlabs.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "linuxppc-dev@lists.ozlabs.org" ], "Delivered-To": "patchwork-incoming@legolas.ozlabs.org", "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=pC7lVjxq;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org\n (client-ip=112.213.38.117; helo=lists.ozlabs.org;\n envelope-from=linuxppc-dev+bounces-20623-incoming=patchwork.ozlabs.org@lists.ozlabs.org;\n receiver=patchwork.ozlabs.org)", "lists.ozlabs.org;\n arc=none smtp.remote-ip=\"2600:3c04:e001:324:0:1991:8:25\"", "lists.ozlabs.org;\n dmarc=pass (p=quarantine dis=none) header.from=kernel.org", "lists.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=pC7lVjxq;\n\tdkim-atps=neutral", "lists.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=kernel.org\n (client-ip=2600:3c04:e001:324:0:1991:8:25; helo=tor.source.kernel.org;\n envelope-from=frederic@kernel.org; receiver=lists.ozlabs.org)" ], "Received": [ "from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4gBqSz0fxxz1yJq\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 08 May 2026 23:18:59 +1000 (AEST)", "from boromir.ozlabs.org (localhost [127.0.0.1])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 4gBqSy68Y8z3c1T;\n\tFri, 08 May 2026 23:18:58 +1000 (AEST)", "from tor.source.kernel.org (tor.source.kernel.org\n [IPv6:2600:3c04:e001:324:0:1991:8:25])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 4gBqSx5Qlbz30dn\n\tfor <linuxppc-dev@lists.ozlabs.org>; Fri, 08 May 2026 23:18:57 +1000 (AEST)", "from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58])\n\tby tor.source.kernel.org (Postfix) with ESMTP id AC83B600AE;\n\tFri, 8 May 2026 13:18:55 +0000 (UTC)", "by smtp.kernel.org (Postfix) with ESMTPSA id C9B95C2BCB0;\n\tFri, 8 May 2026 13:18:47 +0000 (UTC)" ], "ARC-Seal": "i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1778246338;\n\tcv=none;\n b=WhvmOyB7CU59D83tJibPeFha8QfRlQxUy1ma73lPWQ9faUgJ7e/stufznXXqc6AWcJB3gvUtyfGpGVMIw7BNGrM2e+0RmNbCkJkvI+18dtA7VxOYq5Opq/oETv41U9gdR6XZSRcLfzsVVCQIF2/w8MjKmgdEzkjCl4i3P9V3C2W8889KibzzgFyL4mhQUCyKHyPm0moXIIEUjpyIQfGDYLUf96dxbYlXJanu4/zuVZWjc7iPOMyvKRgjzpzFvBmEE4vp2neU7PJZiCXgzE+arKN2V6XaUm4WGN/3+TM0GtVV4KSHtWLU6kyimgjkboAF/pVbKIvQSNxF3rJC/1E3kg==", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707;\n\tt=1778246338; c=relaxed/relaxed;\n\tbh=YWa+4bgkFcxoR0dcvhOt3XLLzBH6jOw/JWX0lWsT0zk=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=QgSj0iUy22qUhWPrZni9f25RmW3VBlYpqM4v1cjDQyeHkbS86prYtKoKLhZ6kmwOIvbveyjh8Ga+/Qzo3bj7rKdJR/Hptj0W75TMNQDBOuUhzm2UED2zj5+YSuliQIY4b+vI6SVdr9kRD0wt+C2S200msCGiC1iPM7NKSNDliGa9Q2I1Rf+SCuuW4yz+ImZpMmktQ94LeeH5TTLNJiIhatUkbe7d2zcKX34QigfAlnFjT6rVwo/5Xlw6YgeoNB3oECS/6wjN4ts1WHVCqB61SJ+RS6Re3OYhPLHl6QytT+UB2UK38j+ms6OIxZdh/N+3AmzH8Wt99bx4kDCYjvkuTg==", "ARC-Authentication-Results": "i=1; lists.ozlabs.org;\n dmarc=pass (p=quarantine dis=none) header.from=kernel.org;\n dkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=pC7lVjxq; dkim-atps=neutral;\n spf=pass (client-ip=2600:3c04:e001:324:0:1991:8:25;\n helo=tor.source.kernel.org; envelope-from=frederic@kernel.org;\n receiver=lists.ozlabs.org) smtp.mailfrom=kernel.org", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;\n\ts=k20201202; t=1778246335;\n\tbh=hXs18NJo22xkFsprdONWIHdxUtUkDl4cfFzzNgNwNGM=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=pC7lVjxqNLRLdL/yZEx87pMBKsRgg1BBrueRkNfuR1JQWrR1QGTqH193si0q7sge6\n\t 7dxCbeAvLLLCPvT4DoeWDL6YIhyVrfDbi7foikJJb2MoQ89M9D5v8GSD4Dn/Z5E9GF\n\t Fv2mZ61cg7vq01cDiBnqhg9p8eAHv6oG0109Kpdsd0A4pcu+o/v1u/9k7GYrYwpuOT\n\t /uM6EY6hzViGh3Nyp6jNlHKUcMlX80UHQ9iu89joguve2slA2YPe9l8VLM14ZuX1MP\n\t XwgkBf4Tqjv73yQU1Zn3QtALvZALUFUrizKh9xNxhw8nLbXc8JvDGvMMjItHTfPpIR\n\t MHN8es6mrmxTg==", "From": "Frederic Weisbecker <frederic@kernel.org>", "To": "LKML <linux-kernel@vger.kernel.org>", "Cc": "Frederic Weisbecker <frederic@kernel.org>,\n\t\"Christophe Leroy (CS GROUP)\" <chleroy@kernel.org>,\n\t\"Rafael J. Wysocki\" <rafael@kernel.org>,\n\tAlexander Gordeev <agordeev@linux.ibm.com>,\n\tAnna-Maria Behnsen <anna-maria@linutronix.de>,\n\tBen Segall <bsegall@google.com>, Boqun Feng <boqun.feng@gmail.com>,\n\tChristian Borntraeger <borntraeger@linux.ibm.com>,\n\tDietmar Eggemann <dietmar.eggemann@arm.com>,\n\tHeiko Carstens <hca@linux.ibm.com>, Ingo Molnar <mingo@kernel.org>,\n\tIngo Molnar <mingo@redhat.com>, Jan Kiszka <jan.kiszka@siemens.com>,\n\tJoel Fernandes <joelagnelf@nvidia.com>,\n\tJuri Lelli <juri.lelli@redhat.com>,\n\tKieran Bingham <kbingham@kernel.org>,\n\tMadhavan Srinivasan <maddy@linux.ibm.com>,\n\tMel Gorman <mgorman@suse.de>, Michael Ellerman <mpe@ellerman.id.au>,\n\tNeeraj Upadhyay <neeraj.upadhyay@kernel.org>,\n\tNicholas Piggin <npiggin@gmail.com>,\n\t\"Paul E . McKenney\" <paulmck@kernel.org>,\n\tPeter Zijlstra <peterz@infradead.org>, Sashiko@lists.ozlabs.org,\n\tShrikanth Hegde <sshegde@linux.ibm.com>,\n\tSteven Rostedt <rostedt@goodmis.org>,\n\tSven Schnelle <svens@linux.ibm.com>,\n\tThomas Gleixner <tglx@linutronix.de>,\n\tUladzislau Rezki <urezki@gmail.com>,\n\tValentin Schneider <vschneid@redhat.com>,\n\tVasily Gorbik <gor@linux.ibm.com>,\n\tVincent Guittot <vincent.guittot@linaro.org>,\n\tViresh Kumar <viresh.kumar@linaro.org>,\n\tXin Zhao <jackzxcui1989@163.com>, linux-pm@vger.kernel.org,\n\tlinux-s390@vger.kernel.org, linuxppc-dev@lists.ozlabs.org", "Subject": "[PATCH 13/15] sched/cputime: Provide get_cpu_[idle|iowait]_time_us()\n off-case", "Date": "Fri, 8 May 2026 15:16:45 +0200", "Message-ID": "<20260508131647.43868-14-frederic@kernel.org>", "X-Mailer": "git-send-email 2.53.0", "In-Reply-To": "<20260508131647.43868-1-frederic@kernel.org>", "References": "<20260508131647.43868-1-frederic@kernel.org>", "X-Mailing-List": "linuxppc-dev@lists.ozlabs.org", "List-Id": "<linuxppc-dev.lists.ozlabs.org>", "List-Help": "<mailto:linuxppc-dev+help@lists.ozlabs.org>", "List-Owner": "<mailto:linuxppc-dev+owner@lists.ozlabs.org>", "List-Post": "<mailto:linuxppc-dev@lists.ozlabs.org>", "List-Archive": "<https://lore.kernel.org/linuxppc-dev/>,\n <https://lists.ozlabs.org/pipermail/linuxppc-dev/>", "List-Subscribe": "<mailto:linuxppc-dev+subscribe@lists.ozlabs.org>,\n <mailto:linuxppc-dev+subscribe-digest@lists.ozlabs.org>,\n <mailto:linuxppc-dev+subscribe-nomail@lists.ozlabs.org>", "List-Unsubscribe": "<mailto:linuxppc-dev+unsubscribe@lists.ozlabs.org>", "Precedence": "list", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "X-Spam-Status": "No, score=-0.6 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,\n\tDKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS\n\tautolearn=disabled version=4.0.1 OzLabs 8", "X-Spam-Checker-Version": "SpamAssassin 4.0.1 (2024-03-25) on lists.ozlabs.org" }, "content": "The last reason why get_cpu_idle/iowait_time_us() may return -1 now is\nif the config doesn't support nohz.\n\nThe ad-hoc replacement solution by cpufreq is to compute jiffies minus\nthe whole busy cputime. Although the intention should provide a coherent\nlow resolution estimation of the idle and iowait time, the\nimplementation is buggy because jiffies don't start at 0.\n\nJust provide instead a real get_cpu_[idle|iowait]_time_us() offcase.\n\nSigned-off-by: Frederic Weisbecker <frederic@kernel.org>\nTested-by: Shrikanth Hegde <sshegde@linux.ibm.com>\n---\n drivers/cpufreq/cpufreq.c | 29 +----------------------------\n include/linux/kernel_stat.h | 3 +++\n include/linux/tick.h | 4 ----\n kernel/sched/cputime.c | 12 +++++++++---\n 4 files changed, 13 insertions(+), 35 deletions(-)", "diff": "diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c\nindex 44eb1b7e7fc1..dda0d34d3c02 100644\n--- a/drivers/cpufreq/cpufreq.c\n+++ b/drivers/cpufreq/cpufreq.c\n@@ -130,38 +130,11 @@ struct kobject *get_governor_parent_kobj(struct cpufreq_policy *policy)\n }\n EXPORT_SYMBOL_GPL(get_governor_parent_kobj);\n \n-static inline u64 get_cpu_idle_time_jiffy(unsigned int cpu, u64 *wall)\n-{\n-\tstruct kernel_cpustat kcpustat;\n-\tu64 cur_wall_time;\n-\tu64 idle_time;\n-\tu64 busy_time;\n-\n-\tcur_wall_time = jiffies64_to_nsecs(get_jiffies_64());\n-\n-\tkcpustat_cpu_fetch(&kcpustat, cpu);\n-\n-\tbusy_time = kcpustat.cpustat[CPUTIME_USER];\n-\tbusy_time += kcpustat.cpustat[CPUTIME_SYSTEM];\n-\tbusy_time += kcpustat.cpustat[CPUTIME_IRQ];\n-\tbusy_time += kcpustat.cpustat[CPUTIME_SOFTIRQ];\n-\tbusy_time += kcpustat.cpustat[CPUTIME_STEAL];\n-\tbusy_time += kcpustat.cpustat[CPUTIME_NICE];\n-\n-\tidle_time = cur_wall_time - busy_time;\n-\tif (wall)\n-\t\t*wall = div_u64(cur_wall_time, NSEC_PER_USEC);\n-\n-\treturn div_u64(idle_time, NSEC_PER_USEC);\n-}\n-\n u64 get_cpu_idle_time(unsigned int cpu, u64 *wall, int io_busy)\n {\n \tu64 idle_time = get_cpu_idle_time_us(cpu, io_busy ? wall : NULL);\n \n-\tif (idle_time == -1ULL)\n-\t\treturn get_cpu_idle_time_jiffy(cpu, wall);\n-\telse if (!io_busy)\n+\tif (!io_busy)\n \t\tidle_time += get_cpu_iowait_time_us(cpu, wall);\n \n \treturn idle_time;\ndiff --git a/include/linux/kernel_stat.h b/include/linux/kernel_stat.h\nindex 3680519d7b2c..512104b0ff49 100644\n--- a/include/linux/kernel_stat.h\n+++ b/include/linux/kernel_stat.h\n@@ -133,6 +133,9 @@ static inline bool kcpustat_idle_dyntick(void)\n }\n #endif /* CONFIG_NO_HZ_COMMON */\n \n+extern u64 get_cpu_idle_time_us(int cpu, u64 *last_update_time);\n+extern u64 get_cpu_iowait_time_us(int cpu, u64 *last_update_time);\n+\n /* Fetch cputime values when vtime is disabled on a CPU */\n static inline u64 kcpustat_field_default(enum cpu_usage_stat usage, int cpu)\n {\ndiff --git a/include/linux/tick.h b/include/linux/tick.h\nindex 738007d6f577..1cf4651f09ad 100644\n--- a/include/linux/tick.h\n+++ b/include/linux/tick.h\n@@ -139,8 +139,6 @@ extern bool tick_nohz_idle_got_tick(void);\n extern ktime_t tick_nohz_get_next_hrtimer(void);\n extern ktime_t tick_nohz_get_sleep_length(ktime_t *delta_next);\n extern unsigned long tick_nohz_get_idle_calls_cpu(int cpu);\n-extern u64 get_cpu_idle_time_us(int cpu, u64 *last_update_time);\n-extern u64 get_cpu_iowait_time_us(int cpu, u64 *last_update_time);\n #else /* !CONFIG_NO_HZ_COMMON */\n #define tick_nohz_enabled (0)\n static inline bool tick_nohz_is_active(void) { return false; }\n@@ -162,8 +160,6 @@ static inline ktime_t tick_nohz_get_sleep_length(ktime_t *delta_next)\n \t*delta_next = TICK_NSEC;\n \treturn *delta_next;\n }\n-static inline u64 get_cpu_idle_time_us(int cpu, u64 *unused) { return -1; }\n-static inline u64 get_cpu_iowait_time_us(int cpu, u64 *unused) { return -1; }\n #endif /* !CONFIG_NO_HZ_COMMON */\n \n /*\ndiff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c\nindex c91fd67f93ea..335d2c127763 100644\n--- a/kernel/sched/cputime.c\n+++ b/kernel/sched/cputime.c\n@@ -522,6 +522,13 @@ u64 kcpustat_field_iowait(int cpu)\n \t\t\t\t nr_iowait_cpu(cpu), ktime_get());\n }\n EXPORT_SYMBOL_GPL(kcpustat_field_iowait);\n+#else\n+static u64 kcpustat_field_dyntick(int cpu, enum cpu_usage_stat idx,\n+\t\t\t\t bool compute_delta, ktime_t now)\n+{\n+\treturn kcpustat_cpu(cpu).cpustat[idx];\n+}\n+#endif /* CONFIG_NO_HZ_COMMON */\n \n static u64 get_cpu_sleep_time_us(int cpu, enum cpu_usage_stat idx,\n \t\t\t\t bool compute_delta, u64 *last_update_time)\n@@ -557,7 +564,7 @@ static u64 get_cpu_sleep_time_us(int cpu, enum cpu_usage_stat idx,\n * This time is measured via accounting rather than sampling,\n * and is as accurate as ktime_get() is.\n *\n- * Return: -1 if generic vtime is enabled, else total idle time of the @cpu\n+ * Return: total idle time of the @cpu\n */\n u64 get_cpu_idle_time_us(int cpu, u64 *last_update_time)\n {\n@@ -581,7 +588,7 @@ EXPORT_SYMBOL_GPL(get_cpu_idle_time_us);\n * This time is measured via accounting rather than sampling,\n * and is as accurate as ktime_get() is.\n *\n- * Return: -1 if generic vtime is enabled, else total iowait time of @cpu\n+ * Return: total iowait time of @cpu\n */\n u64 get_cpu_iowait_time_us(int cpu, u64 *last_update_time)\n {\n@@ -589,7 +596,6 @@ u64 get_cpu_iowait_time_us(int cpu, u64 *last_update_time)\n \t\t\t\t nr_iowait_cpu(cpu), last_update_time);\n }\n EXPORT_SYMBOL_GPL(get_cpu_iowait_time_us);\n-#endif /* CONFIG_NO_HZ_COMMON */\n \n /*\n * Use precise platform statistics if available:\n", "prefixes": [ "13/15" ] }