From: Heiko Carstens <hca@linux.ibm.com>
To: Frederic Weisbecker <frederic@kernel.org>,
Alexander Gordeev <agordeev@linux.ibm.com>,
Sven Schnelle <svens@linux.ibm.com>,
Vasily Gorbik <gor@linux.ibm.com>,
Christian Borntraeger <borntraeger@linux.ibm.com>
Cc: linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org
Subject: [RFC PATCH 1/3] fixup! s390/time: Prepare to stop elapsing in dynticks-idle
Date: Wed, 25 Feb 2026 15:51:44 +0100 [thread overview]
Message-ID: <20260225145146.1031705-2-hca@linux.ibm.com> (raw)
In-Reply-To: <20260225145146.1031705-1-hca@linux.ibm.com>
This should be merged with "s390/time: Prepare to stop elapsing in
dynticks-idle".
It makes sure that idle->clock_idle_enter is always set when loading the
idle psw. Otherwise the idle_time calculation in account_idle_time_irq()
would be incorrect.
Also "revert" some not needed code movements and whitespace changes to keep
the diff minimal.
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
---
arch/s390/include/asm/idle.h | 12 ++++++------
arch/s390/kernel/idle.c | 9 +++------
2 files changed, 9 insertions(+), 12 deletions(-)
diff --git a/arch/s390/include/asm/idle.h b/arch/s390/include/asm/idle.h
index 285b3da318d6..7f2a1240b6ff 100644
--- a/arch/s390/include/asm/idle.h
+++ b/arch/s390/include/asm/idle.h
@@ -13,12 +13,12 @@
#include <linux/device.h>
struct s390_idle_data {
- bool idle_dyntick;
- unsigned long idle_count;
- unsigned long idle_time;
- unsigned long clock_idle_enter;
- unsigned long timer_idle_enter;
- unsigned long mt_cycles_enter[8];
+ bool idle_dyntick;
+ unsigned long idle_count;
+ unsigned long idle_time;
+ unsigned long clock_idle_enter;
+ unsigned long timer_idle_enter;
+ unsigned long mt_cycles_enter[8];
};
DECLARE_PER_CPU(struct s390_idle_data, s390_idle);
diff --git a/arch/s390/kernel/idle.c b/arch/s390/kernel/idle.c
index 614db5ea6ea3..fb4f431342f5 100644
--- a/arch/s390/kernel/idle.c
+++ b/arch/s390/kernel/idle.c
@@ -35,11 +35,10 @@ void account_idle_time_irq(void)
this_cpu_add(mt_cycles[i], cycles_new[i] - idle->mt_cycles_enter[i]);
}
- WRITE_ONCE(idle->idle_count, READ_ONCE(idle->idle_count) + 1);
-
/* Account time spent with enabled wait psw loaded as idle time. */
idle_time = lc->int_clock - idle->clock_idle_enter;
WRITE_ONCE(idle->idle_time, READ_ONCE(idle->idle_time) + idle_time);
+ WRITE_ONCE(idle->idle_count, READ_ONCE(idle->idle_count) + 1);
/* Dyntick idle time accounted by nohz/scheduler */
if (idle->idle_dyntick)
@@ -66,10 +65,8 @@ void noinstr arch_cpu_idle(void)
set_cpu_flag(CIF_ENABLED_WAIT);
if (smp_cpu_mtid)
stcctm(MT_DIAG, smp_cpu_mtid, (u64 *)&idle->mt_cycles_enter);
- if (!idle->idle_dyntick) {
- idle->clock_idle_enter = get_tod_clock_fast();
- idle->timer_idle_enter = get_cpu_timer();
- }
+ idle->clock_idle_enter = get_tod_clock_fast();
+ idle->timer_idle_enter = get_cpu_timer();
bpon();
__load_psw_mask(psw_mask);
}
--
2.51.0
next prev parent reply other threads:[~2026-02-25 14:51 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-25 14:51 [RFC PATCH 0/3] s390: Idle time accounting improvements Heiko Carstens
2026-02-25 14:51 ` Heiko Carstens [this message]
2026-03-11 15:14 ` [RFC PATCH 1/3] fixup! s390/time: Prepare to stop elapsing in dynticks-idle Frederic Weisbecker
2026-02-25 14:51 ` [RFC PATCH 2/3] s390/idle: Provide arch specific kcpustat_field_idle()/kcpustat_field_iowait() Heiko Carstens
2026-03-11 16:13 ` Frederic Weisbecker
2026-03-20 12:30 ` Heiko Carstens
2026-02-25 14:51 ` [RFC PATCH 3/3] s390/idle: Remove idle time and count sysfs files Heiko Carstens
2026-03-11 16:14 ` Frederic Weisbecker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260225145146.1031705-2-hca@linux.ibm.com \
--to=hca@linux.ibm.com \
--cc=agordeev@linux.ibm.com \
--cc=borntraeger@linux.ibm.com \
--cc=frederic@kernel.org \
--cc=gor@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=svens@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.