All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: Frederic Weisbecker <fweisbec@gmail.com>,
	stable kernel team <stable@vger.kernel.org>
Cc: linux-kernel@vger.kernel.org, torvalds@linux-foundation.org,
	efault@gmx.de, tglx@linutronix.de, peterz@infradead.org,
	cmetcalf@ezchip.com, paulmck@linux.vnet.ibm.com,
	h-shimamoto@ct.jp.nec.com, lcapitulino@redhat.com, hpa@zytor.com,
	riel@redhat.com, cl@linux.com, linux-tip-commits@vger.kernel.org
Subject: Re: [tip:locking/core] sched/cputime: Fix invalid gtime in proc
Date: Tue, 8 Dec 2015 06:34:08 +0100	[thread overview]
Message-ID: <20151208053408.GA13565@gmail.com> (raw)
In-Reply-To: <20151207162132.GA20032@lerouge>


* Frederic Weisbecker <fweisbec@gmail.com> wrote:

> On Fri, Dec 04, 2015 at 03:53:13AM -0800, tip-bot for Hiroshi Shimamoto wrote:
> > Commit-ID:  2541117b0cf79977fa11a0d6e17d61010677bd7b
> > Gitweb:     http://git.kernel.org/tip/2541117b0cf79977fa11a0d6e17d61010677bd7b
> > Author:     Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
> > AuthorDate: Thu, 19 Nov 2015 16:47:28 +0100
> > Committer:  Ingo Molnar <mingo@kernel.org>
> > CommitDate: Fri, 4 Dec 2015 10:18:49 +0100
> > 
> > sched/cputime: Fix invalid gtime in proc
> > 
> > /proc/stats shows invalid gtime when the thread is running in guest.
> > When vtime accounting is not enabled, we cannot get a valid delta.
> > The delta is calculated with now - tsk->vtime_snap, but tsk->vtime_snap
> > is only updated when vtime accounting is runtime enabled.
> > 
> > This patch makes task_gtime() just return gtime without computing the
> > buggy non-existing tickless delta when vtime accounting is not enabled.
> > 
> > Use context_tracking_is_enabled() to check if vtime is accounting on
> > some cpu, in which case only we need to check the tickless delta. This
> > way we fix the gtime value regression on machines not running nohz full.
> > 
> > The kernel config contains CONFIG_VIRT_CPU_ACCOUNTING_GEN=y and
> > CONFIG_NO_HZ_FULL_ALL=n and boot without nohz_full.
> > 
> > I ran and stop a busy loop in VM and see the gtime in host.
> > Dump the 43rd field which shows the gtime in every second:
> > 
> > 	 # while :; do awk '{print $3" "$43}' /proc/3955/task/4014/stat; sleep 1; done
> > 	S 4348
> > 	R 7064566
> > 	R 7064766
> > 	R 7064967
> > 	R 7065168
> > 	S 4759
> > 	S 4759
> > 
> > During running busy loop, it returns large value.
> > 
> > After applying this patch, we can see right gtime.
> > 
> > 	 # while :; do awk '{print $3" "$43}' /proc/10913/task/10956/stat; sleep 1; done
> > 	S 5338
> > 	R 5365
> > 	R 5465
> > 	R 5566
> > 	R 5666
> > 	S 5726
> > 	S 5726
> > 
> > Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
> > Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
> > Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> > Cc: Chris Metcalf <cmetcalf@ezchip.com>
> > Cc: Christoph Lameter <cl@linux.com>
> > Cc: Linus Torvalds <torvalds@linux-foundation.org>
> > Cc: Luiz Capitulino <lcapitulino@redhat.com>
> > Cc: Mike Galbraith <efault@gmx.de>
> > Cc: Paul E . McKenney <paulmck@linux.vnet.ibm.com>
> > Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> > Cc: Peter Zijlstra <peterz@infradead.org>
> > Cc: Rik van Riel <riel@redhat.com>
> > Cc: Thomas Gleixner <tglx@linutronix.de>
> > Link: http://lkml.kernel.org/r/1447948054-28668-2-git-send-email-fweisbec@gmail.com
> > Signed-off-by: Ingo Molnar <mingo@kernel.org>
> > ---
> 
> Thanks for applying the patchset!
> 
> However we may want to backport this one, it's a regression fix affecting
> CONFIG_NO_HZ_FULL=y with nohz_full off (99% of many distros defaults).
> 
> Thanks.

Absolutely, not sure why I forgot that tag - I added it for other recent fixes.

Greg, please consider applying this upstream fix to -stable as well:

  2541117b0cf7 ("sched/cputime: Fix invalid gtime in proc")

Note, the commit will cherry-pick cleanly all the way back to v3.9 (released 2.5+ 
years ago), but it will only build on v3.14 and later kernels.

Thanks,

	Ingo

  reply	other threads:[~2015-12-08  5:34 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-19 15:47 [PATCH 0/7] cputime: A few tickless cputime accounting fixes and improvements Frederic Weisbecker
2015-11-19 15:47 ` [PATCH 1/7] cputime: Fix invalid gtime in proc Frederic Weisbecker
2015-12-04 11:53   ` [tip:locking/core] sched/cputime: " tip-bot for Hiroshi Shimamoto
2015-12-07 16:21     ` Frederic Weisbecker
2015-12-08  5:34       ` Ingo Molnar [this message]
2015-11-19 15:47 ` [PATCH 2/7] cputime: Remove extra cost in task_cputime Frederic Weisbecker
2015-12-04 11:55   ` [tip:sched/core] sched/cputime: Remove extra cost in task_cputime () tip-bot for Hiroshi Shimamoto
2015-11-19 15:47 ` [PATCH 3/7] cputime: Clarify vtime symbols and document them Frederic Weisbecker
2015-12-04 11:55   ` [tip:sched/core] sched/cputime: " tip-bot for Frederic Weisbecker
2015-11-19 15:47 ` [PATCH 4/7] cputime: Correctly handle task guest time on housekeepers Frederic Weisbecker
2015-12-04 11:55   ` [tip:sched/core] sched/cputime: " tip-bot for Frederic Weisbecker
2015-11-19 15:47 ` [PATCH 5/7] cputime: Rename vtime_accounting_enabled to vtime_accounting_cpu_enabled Frederic Weisbecker
2015-12-04 11:56   ` [tip:sched/core] sched/cputime: Rename vtime_accounting_enabled() to vtime_accounting_cpu_enabled() tip-bot for Frederic Weisbecker
2015-11-19 15:47 ` [PATCH 6/7] cputime: Introduce vtime accounting check for readers Frederic Weisbecker
2015-11-19 20:28   ` Peter Zijlstra
2015-11-23 14:19     ` Frederic Weisbecker
2015-11-23 14:35       ` Peter Zijlstra
2015-11-23 15:22         ` Frederic Weisbecker
2015-12-04 11:56   ` [tip:sched/core] sched/cputime: " tip-bot for Frederic Weisbecker
2015-11-19 15:47 ` [PATCH 7/7] cputime: Convert vtime_seqlock to seqcount Frederic Weisbecker
2015-12-04 11:56   ` [tip:sched/core] sched/cputime: " tip-bot for 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=20151208053408.GA13565@gmail.com \
    --to=mingo@kernel.org \
    --cc=cl@linux.com \
    --cc=cmetcalf@ezchip.com \
    --cc=efault@gmx.de \
    --cc=fweisbec@gmail.com \
    --cc=h-shimamoto@ct.jp.nec.com \
    --cc=hpa@zytor.com \
    --cc=lcapitulino@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=peterz@infradead.org \
    --cc=riel@redhat.com \
    --cc=stable@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    /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.