Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2218142/?format=api
{ "id": 2218142, "url": "http://patchwork.ozlabs.org/api/patches/2218142/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20260331131622.30505-6-frederic@kernel.org/", "project": { "id": 2, "url": "http://patchwork.ozlabs.org/api/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": "<20260331131622.30505-6-frederic@kernel.org>", "list_archive_url": "https://lore.kernel.org/linuxppc-dev/20260331131622.30505-6-frederic@kernel.org/", "date": "2026-03-31T13:16:13", "name": "[05/14] s390/time: Prepare to stop elapsing in dynticks-idle", "commit_ref": null, "pull_url": null, "state": "handled-elsewhere", "archived": false, "hash": "dfdf2aeb3441545a0e36e2948b8f082c485f9605", "submitter": { "id": 79411, "url": "http://patchwork.ozlabs.org/api/people/79411/?format=api", "name": "Frederic Weisbecker", "email": "frederic@kernel.org" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20260331131622.30505-6-frederic@kernel.org/mbox/", "series": [ { "id": 498198, "url": "http://patchwork.ozlabs.org/api/series/498198/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=498198", "date": "2026-03-31T13:16:08", "name": "tick/sched: Refactor idle cputime accounting", "version": 3, "mbox": "http://patchwork.ozlabs.org/series/498198/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2218142/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2218142/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "\n <linuxppc-dev+bounces-19085-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=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=QOr8z5aO;\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-19085-incoming=patchwork.ozlabs.org@lists.ozlabs.org;\n receiver=patchwork.ozlabs.org)", "lists.ozlabs.org;\n arc=none smtp.remote-ip=\"2600:3c0a:e001:78e: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=QOr8z5aO;\n\tdkim-atps=neutral", "lists.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=kernel.org\n (client-ip=2600:3c0a:e001:78e:0:1991:8:25; helo=sea.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 4flTDV4C6fz1y1q\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 01 Apr 2026 00:17:14 +1100 (AEDT)", "from boromir.ozlabs.org (localhost [127.0.0.1])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 4flTDT3qqXz2yh4;\n\tWed, 01 Apr 2026 00:17:13 +1100 (AEDT)", "from sea.source.kernel.org (sea.source.kernel.org\n [IPv6:2600:3c0a:e001:78e: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 4flTDS3wgZz2ydn\n\tfor <linuxppc-dev@lists.ozlabs.org>; Wed, 01 Apr 2026 00:17:12 +1100 (AEDT)", "from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58])\n\tby sea.source.kernel.org (Postfix) with ESMTP id 74369436D4;\n\tTue, 31 Mar 2026 13:17:10 +0000 (UTC)", "by smtp.kernel.org (Postfix) with ESMTPSA id 7ECAEC19423;\n\tTue, 31 Mar 2026 13:17:03 +0000 (UTC)" ], "ARC-Seal": "i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1774963033;\n\tcv=none;\n b=Wz+qjYjHasb7Zy21SI8EpIotxho/c9HH2quv+Ww6ipMgQ3WjLAanIGCG+nPAXWJrLPbhyUFN/R53zyUwj+bCeuDonzk0OPWxjTkLmX5s3Oz+Z0+THhz+zY6xDUdyGRvqPvscwlZKywnFvMIH3aN7bIGxADQmH/f6pmiWtixGS5vT3iAyt1eqdceIL3wbU8NokgieIqxgQ2NuHvPVo8TXGFL6Gdq+87SCznWyLwwmBYYyCI9VoasL3G22NN81vllFKqwUJfP8JEoOHvxZ+5zrVGYAPMgYnX+bFH34kQET8/IYrUYOnhuMaN3IEDlFLqyJJZCTY5coBiQefaGtPnWcxQ==", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707;\n\tt=1774963033; c=relaxed/relaxed;\n\tbh=6RGMHeFO1V15n+G7RgAQJvta3XjFaEIddwAG7yQBIpM=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=fSX+MOUnzOOwj31H3+z5rtP+WqJaiO20NHGiZ0IIXtRvaoTdZSEpDGVFHG+szj5e5s3jTqCIXm+u0q0dKjg0CPUvCQ9VB/HBZCWbJSTxmre0TsihWu7/57YbFU6Kn2pQbwVmvjENs3WKyJuptwMDYeEuzhf96DU3Mt6dKDvFwiClm9VK5pBFFTitBmTeySxG7XBl99cmJUAAd6Ga62pfWO4wNj6jt50JHyU5RitW/JC8xjsUaKGFOET9FaeMz8lGwrXmrwD1r/XdouuUwrgqh3o8YqCz8r5fqsZvIxWhIBS1QF9Uf3mI+8ghfGtTbCYpwG5NLdvv1g7kCEqFF0WG1w==", "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=QOr8z5aO; dkim-atps=neutral;\n spf=pass (client-ip=2600:3c0a:e001:78e:0:1991:8:25;\n helo=sea.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=1774963030;\n\tbh=bK9FrHwYdtzlfjtR+gYpB517UvY6FDy8GPtD0U1/TCo=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=QOr8z5aObamx4kProSnztxVwdQlHn9xLwz3QWRSh54AQnpHHqbKZLhGNZ8tOlSwht\n\t aJGFYaGh7Q8hKi6bouEvSeeWyEytZ8tkdEXdbWJeS17SWm9fmh2LJgL2pGW/wVorf+\n\t YdlB4Zfd9HeHHgTa5TyngS/chK8jPejZkVxL69tKzNc7I0fQRRml/6UTYbWisjBoS1\n\t xNp9oJkag50xrbV02FIhJ324cQz44XqfTCYVw9H+j3NYGcZWEGWNYp/YjAwqdhjjMp\n\t 1LF9/OTtA4QLU8bI0+lmlPgD8uU4C7vLjIiylBJx9BlT/+3U2dCvQd0TySn++3HPIo\n\t fCmn8xbE6Rdkg==", "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>,\n\tBoqun 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>,\n\tIngo Molnar <mingo@redhat.com>,\n\tJan 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>,\n\tMichael 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>,\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>,\n\tlinux-pm@vger.kernel.org,\n\tlinux-s390@vger.kernel.org,\n\tlinuxppc-dev@lists.ozlabs.org", "Subject": "[PATCH 05/14] s390/time: Prepare to stop elapsing in dynticks-idle", "Date": "Tue, 31 Mar 2026 15:16:13 +0200", "Message-ID": "<20260331131622.30505-6-frederic@kernel.org>", "X-Mailer": "git-send-email 2.53.0", "In-Reply-To": "<20260331131622.30505-1-frederic@kernel.org>", "References": "<20260331131622.30505-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.2 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": "Currently the tick subsystem stores the idle cputime accounting in\nprivate fields, allowing cohabitation with architecture idle vtime\naccounting. The former is fetched on online CPUs, the latter on offline\nCPUs.\n\nFor consolidation purpose, architecture vtime accounting will continue\nto account the cputime but will make a break when the idle tick is\nstopped. The dyntick cputime accounting will then be relayed by the tick\nsubsystem so that the idle cputime is still seen advancing coherently\neven when the tick isn't there to flush the idle vtime.\n\nPrepare for that and introduce three new APIs which will be used in\nsubsequent patches:\n\n_ vtime_dynticks_start() is deemed to be called when idle enters in\n dyntick mode. The idle cputime that elapsed so far is accumulated\n and accounted. Also idle time accounting is ignored.\n\n- vtime_dynticks_stop() is deemed to be called when idle exits from\n dyntick mode. The vtime entry clocks are fast-forward to current time\n so that idle accounting restarts elapsing from now. Also idle time\n accounting is resumed.\n\n- vtime_reset() is deemed to be called from dynticks idle IRQ entry to\n fast-forward the clock to current time so that the IRQ time is still\n accounted by vtime while nohz cputime is paused.\n\nAlso accumulated vtime won't be flushed from dyntick-idle ticks to avoid\naccounting twice the idle cputime, along with nohz accounting.\n\nSigned-off-by: Frederic Weisbecker <frederic@kernel.org>\nCo-developed-by: Heiko Carstens <hca@linux.ibm.com>\nSigned-off-by: Heiko Carstens <hca@linux.ibm.com>\nTested-by: Shrikanth Hegde <sshegde@linux.ibm.com>\n---\n arch/s390/include/asm/idle.h | 2 ++\n arch/s390/kernel/idle.c | 5 +++-\n arch/s390/kernel/vtime.c | 57 ++++++++++++++++++++++++++++++++----\n 3 files changed, 57 insertions(+), 7 deletions(-)", "diff": "diff --git a/arch/s390/include/asm/idle.h b/arch/s390/include/asm/idle.h\nindex 32536ee34aa0..e4ad09a22400 100644\n--- a/arch/s390/include/asm/idle.h\n+++ b/arch/s390/include/asm/idle.h\n@@ -8,10 +8,12 @@\n #ifndef _S390_IDLE_H\n #define _S390_IDLE_H\n \n+#include <linux/percpu-defs.h>\n #include <linux/types.h>\n #include <linux/device.h>\n \n struct s390_idle_data {\n+\tbool\t idle_dyntick;\n \tunsigned long idle_count;\n \tunsigned long idle_time;\n \tunsigned long clock_idle_enter;\ndiff --git a/arch/s390/kernel/idle.c b/arch/s390/kernel/idle.c\nindex 1f1b06b6b4ef..4685d7c5bc51 100644\n--- a/arch/s390/kernel/idle.c\n+++ b/arch/s390/kernel/idle.c\n@@ -31,7 +31,10 @@ void account_idle_time_irq(void)\n \t/* Account time spent with enabled wait psw loaded as idle time. */\n \t__atomic64_add(idle_time, &idle->idle_time);\n \t__atomic64_add_const(1, &idle->idle_count);\n-\taccount_idle_time(cputime_to_nsecs(idle_time));\n+\n+\t/* Dyntick idle time accounted by nohz/scheduler */\n+\tif (!idle->idle_dyntick)\n+\t\taccount_idle_time(cputime_to_nsecs(idle_time));\n }\n \n void noinstr arch_cpu_idle(void)\ndiff --git a/arch/s390/kernel/vtime.c b/arch/s390/kernel/vtime.c\nindex bf48744d0912..b1c7700d082c 100644\n--- a/arch/s390/kernel/vtime.c\n+++ b/arch/s390/kernel/vtime.c\n@@ -17,6 +17,7 @@\n #include <asm/vtimer.h>\n #include <asm/vtime.h>\n #include <asm/cpu_mf.h>\n+#include <asm/idle.h>\n #include <asm/smp.h>\n \n #include \"entry.h\"\n@@ -110,6 +111,16 @@ static void account_system_index_scaled(struct task_struct *p, u64 cputime,\n \taccount_system_index_time(p, cputime_to_nsecs(cputime), index);\n }\n \n+static inline void vtime_reset_last_update(struct lowcore *lc)\n+{\n+\tasm volatile(\n+\t\t\"\tstpt\t%0\\n\"\t/* Store current cpu timer value */\n+\t\t\"\tstckf\t%1\"\t/* Store current tod clock value */\n+\t\t: \"=Q\" (lc->last_update_timer),\n+\t\t \"=Q\" (lc->last_update_clock)\n+\t\t: : \"cc\");\n+}\n+\n /*\n * Update process times based on virtual cpu times stored by entry.S\n * to the lowcore fields user_timer, system_timer & steal_clock.\n@@ -121,12 +132,9 @@ static int do_account_vtime(struct task_struct *tsk)\n \n \ttimer = lc->last_update_timer;\n \tclock = lc->last_update_clock;\n-\tasm volatile(\n-\t\t\"\tstpt\t%0\\n\"\t/* Store current cpu timer value */\n-\t\t\"\tstckf\t%1\"\t/* Store current tod clock value */\n-\t\t: \"=Q\" (lc->last_update_timer),\n-\t\t \"=Q\" (lc->last_update_clock)\n-\t\t: : \"cc\");\n+\n+\tvtime_reset_last_update(lc);\n+\n \tclock = lc->last_update_clock - clock;\n \ttimer -= lc->last_update_timer;\n \n@@ -239,6 +247,43 @@ void vtime_account_hardirq(struct task_struct *tsk)\n \tget_lowcore()->hardirq_timer += vtime_delta();\n }\n \n+#ifdef CONFIG_NO_HZ_COMMON\n+/**\n+ * vtime_reset - Fast forward vtime entry clocks\n+ *\n+ * Called from dynticks idle IRQ entry to fast-forward the clocks to current time\n+ * so that the IRQ time is still accounted by vtime while nohz cputime is paused.\n+ */\n+void vtime_reset(void)\n+{\n+\tvtime_reset_last_update(get_lowcore());\n+}\n+\n+/**\n+ * vtime_dyntick_start - Inform vtime about entry to idle-dynticks\n+ *\n+ * Called when idle enters in dyntick mode. The idle cputime that elapsed so far\n+ * is flushed and the tick subsystem takes over the idle cputime accounting.\n+ */\n+void vtime_dyntick_start(void)\n+{\n+\t__this_cpu_write(s390_idle.idle_dyntick, true);\n+\tvtime_flush(current);\n+}\n+\n+/**\n+ * vtime_dyntick_stop - Inform vtime about exit from idle-dynticks\n+ *\n+ * Called when idle exits from dyntick mode. The vtime entry clocks are\n+ * fast-forward to current time and idle accounting resumes.\n+ */\n+void vtime_dyntick_stop(void)\n+{\n+\tvtime_reset_last_update(get_lowcore());\n+\t__this_cpu_write(s390_idle.idle_dyntick, false);\n+}\n+#endif /* CONFIG_NO_HZ_COMMON */\n+\n /*\n * Sorted add to a list. List is linear searched until first bigger\n * element is found.\n", "prefixes": [ "05/14" ] }