From: Frederic Weisbecker <frederic@kernel.org>
To: Heiko Carstens <hca@linux.ibm.com>
Cc: Alexander Gordeev <agordeev@linux.ibm.com>,
Sven Schnelle <svens@linux.ibm.com>,
Vasily Gorbik <gor@linux.ibm.com>,
Christian Borntraeger <borntraeger@linux.ibm.com>,
linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org
Subject: Re: [PATCH 1/9] s390/idle: Fix cpu idle exit cpu time accounting
Date: Wed, 4 Mar 2026 15:16:42 +0100 [thread overview]
Message-ID: <aag-ypLmdyQk0Zxl@localhost.localdomain> (raw)
In-Reply-To: <20260218142012.863464-2-hca@linux.ibm.com>
Le Wed, Feb 18, 2026 at 03:20:04PM +0100, Heiko Carstens a écrit :
> With the conversion to generic entry [1] cpu idle exit cpu time accounting
> was converted from assembly to C. This introduced an reversed order of cpu
> time accounting.
>
> On cpu idle exit the current accounting happens with the following call
> chain:
>
> -> do_io_irq()/do_ext_irq()
> -> irq_enter_rcu()
> -> account_hardirq_enter()
> -> vtime_account_irq()
> -> vtime_account_kernel()
>
> vtime_account_kernel() accounts the passed cpu time since last_update_timer
> as system time, and updates last_update_timer to the current cpu timer
> value.
>
> However the subsequent call of
>
> -> account_idle_time_irq()
>
> will incorrectly subtract passed cpu time from timer_idle_enter to the
> updated last_update_timer value from system_timer. Then last_update_timer
> is updated to a sys_enter_timer, which means that last_update_timer goes
> back in time.
>
> Subsequently account_hardirq_exit() will account too much cpu time as
> hardirq time. The sum of all accounted cpu times is still correct, however
> some cpu time which was previously accounted as system time is now
> accounted as hardirq time, plus there is the oddity that last_update_timer
> goes back in time.
>
> Restore previous behavior by extracting cpu time accounting code from
> account_idle_time_irq() into a new update_timer_idle() function and call it
> before irq_enter_rcu().
>
> Fixes: 56e62a737028 ("s390: convert to generic entry") [1]
> Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Reviewed-by: Frederic Weisbecker <frederic@kernel.org>
--
Frederic Weisbecker
SUSE Labs
next prev parent reply other threads:[~2026-03-04 14:16 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-18 14:20 [PATCH 0/9] s390/idle/vtime: Minor fixes and cleanups Heiko Carstens
2026-02-18 14:20 ` [PATCH 1/9] s390/idle: Fix cpu idle exit cpu time accounting Heiko Carstens
2026-03-04 14:16 ` Frederic Weisbecker [this message]
2026-02-18 14:20 ` [PATCH 2/9] s390/vtime: Fix virtual timer forwarding Heiko Carstens
2026-03-04 14:23 ` Frederic Weisbecker
2026-02-18 14:20 ` [PATCH 3/9] s390/idle: Add comment for non obvious code Heiko Carstens
2026-03-04 14:38 ` Frederic Weisbecker
2026-02-18 14:20 ` [PATCH 4/9] s390/idle: Slightly optimize idle time accounting Heiko Carstens
2026-02-18 14:20 ` [PATCH 5/9] s390/idle: Inline update_timer_idle() Heiko Carstens
2026-03-04 15:07 ` Frederic Weisbecker
2026-02-18 14:20 ` [PATCH 6/9] s390/irq/idle: Remove psw bits early Heiko Carstens
2026-02-18 14:20 ` [PATCH 7/9] s390/vtime: Use __this_cpu_read() / get rid of READ_ONCE() Heiko Carstens
2026-03-04 14:49 ` Frederic Weisbecker
2026-02-18 14:20 ` [PATCH 8/9] s390/vtime: Use lockdep_assert_irqs_disabled() instead of BUG_ON() Heiko Carstens
2026-03-04 15:08 ` Frederic Weisbecker
2026-02-18 14:20 ` [PATCH 9/9] s390/idle: Remove psw_idle() prototype Heiko Carstens
2026-03-04 15:09 ` Frederic Weisbecker
2026-02-25 9:19 ` [PATCH 0/9] s390/idle/vtime: Minor fixes and cleanups Sven Schnelle
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=aag-ypLmdyQk0Zxl@localhost.localdomain \
--to=frederic@kernel.org \
--cc=agordeev@linux.ibm.com \
--cc=borntraeger@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=hca@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox