Frederic Weisbecker | 4 Aug 2012 17:22
Picon

[PATCH 0/5] cputime: Generic virtual based cputime accounting v3

Hi,

Changes since v2 (https://lwn.net/Articles/509575/) are only about
converting the "code domain tracking" naming to "context tracking"
as per Ingo's suggestion. And the result indeed looks much better.

Ring 0 dark knights can pull from:

git://github.com/fweisbec/linux-dynticks.git
	vtime/generic-v3

Warning: this includes dependencies on rcu/idle and vtime
consolidation patchset.

Frederic Weisbecker (5):
  context_tracking: New context tracking susbsystem
  cputime: Don't allow virtual and irq finegrained cputime accounting
    simultaneously
  cputime: Allow dynamic switch between tick/virtual based cputime
    accounting
  cputime: Rename account_system_vtime to account_vtime
  cputime: Generic on-demand virtual cputime accounting

 arch/Kconfig                                       |   12 +-
 arch/ia64/include/asm/cputime.h                    |    5 +
 arch/ia64/kernel/time.c                            |    6 +-
 arch/powerpc/include/asm/cputime.h                 |    5 +
 arch/powerpc/kernel/time.c                         |   10 +-
 arch/s390/include/asm/cputime.h                    |    5 +
 arch/s390/kernel/vtime.c                           |    6 +-
(Continue reading)

Frederic Weisbecker | 4 Aug 2012 17:22
Picon

[PATCH 1/5] context_tracking: New context tracking susbsystem

Create a new subsystem that probes on kernel boundaries
to keep track of the transitions between level contexts
with two basic initial contexts: user or kernel.

This is an abstraction of some RCU code that use such tracking
to implement its userspace extended quiescent state.

We need to pull this up from RCU into this new level of indirection
because this tracking is also going to be used to implement an "on
demand" generic virtual cputime accounting. A necessary step to
shutdown the tick while still accounting the cputime.

Signed-off-by: Frederic Weisbecker <fweisbec <at> gmail.com>
Cc: Alessio Igor Bogani <abogani <at> kernel.org>
Cc: Andrew Morton <akpm <at> linux-foundation.org>
Cc: Avi Kivity <avi <at> redhat.com>
Cc: Chris Metcalf <cmetcalf <at> tilera.com>
Cc: Christoph Lameter <cl <at> linux.com>
Cc: Geoff Levand <geoff <at> infradead.org>
Cc: Gilad Ben Yossef <gilad <at> benyossef.com>
Cc: Hakan Akkan <hakanakkan <at> gmail.com>
Cc: H. Peter Anvin <hpa <at> zytor.com>
Cc: Ingo Molnar <mingo <at> kernel.org>
Cc: Kevin Hilman <khilman <at> ti.com>
Cc: Max Krasnyansky <maxk <at> qualcomm.com>
Cc: Paul E. McKenney <paulmck <at> linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz <at> infradead.org>
Cc: Stephen Hemminger <shemminger <at> vyatta.com>
Cc: Steven Rostedt <rostedt <at> goodmis.org>
Cc: Sven-Thorsten Dietrich <thebigcorporation <at> gmail.com>
(Continue reading)

Frederic Weisbecker | 4 Aug 2012 17:22
Picon

[PATCH 2/5] cputime: Don't allow virtual and irq finegrained cputime accounting simultaneously

We may soon be able to run both at the same time. But we need
to rework a bit the irq finegrained accounting before that.
Just do a mutual exclusion for now.

Signed-off-by: Frederic Weisbecker <fweisbec <at> gmail.com>
Cc: Alessio Igor Bogani <abogani <at> kernel.org>
Cc: Andrew Morton <akpm <at> linux-foundation.org>
Cc: Avi Kivity <avi <at> redhat.com>
Cc: Chris Metcalf <cmetcalf <at> tilera.com>
Cc: Christoph Lameter <cl <at> linux.com>
Cc: Geoff Levand <geoff <at> infradead.org>
Cc: Gilad Ben Yossef <gilad <at> benyossef.com>
Cc: Hakan Akkan <hakanakkan <at> gmail.com>
Cc: H. Peter Anvin <hpa <at> zytor.com>
Cc: Ingo Molnar <mingo <at> kernel.org>
Cc: Kevin Hilman <khilman <at> ti.com>
Cc: Max Krasnyansky <maxk <at> qualcomm.com>
Cc: Paul E. McKenney <paulmck <at> linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz <at> infradead.org>
Cc: Stephen Hemminger <shemminger <at> vyatta.com>
Cc: Steven Rostedt <rostedt <at> goodmis.org>
Cc: Sven-Thorsten Dietrich <thebigcorporation <at> gmail.com>
Cc: Thomas Gleixner <tglx <at> linutronix.de>
---
 init/Kconfig |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/init/Kconfig b/init/Kconfig
index 6f59452..e1c64c2 100644
--- a/init/Kconfig
(Continue reading)

Frederic Weisbecker | 4 Aug 2012 17:22
Picon

[PATCH 3/5] cputime: Allow dynamic switch between tick/virtual based cputime accounting

Allow to dynamically switch between tick and virtual based cputime accounting.
This way we can provide a kind of "on-demand" virtual based cputime
accounting. In this mode, the kernel will rely on the user hooks
subsystem to dynamically hook on kernel boundaries.

This is in preparation for beeing able to stop the timer tick further
idle. Doing so will depend on CONFIG_VIRT_CPU_ACCOUNTING which makes
it possible to account the cputime without the tick by hooking on
kernel/user boundaries.

Depending whether the tick is stopped or not, we can switch between
tick and vtime based accounting anytime in order to minimize the
overhead associated to user hooks.

Signed-off-by: Frederic Weisbecker <fweisbec <at> gmail.com>
Cc: Alessio Igor Bogani <abogani <at> kernel.org>
Cc: Andrew Morton <akpm <at> linux-foundation.org>
Cc: Avi Kivity <avi <at> redhat.com>
Cc: Chris Metcalf <cmetcalf <at> tilera.com>
Cc: Christoph Lameter <cl <at> linux.com>
Cc: Geoff Levand <geoff <at> infradead.org>
Cc: Gilad Ben Yossef <gilad <at> benyossef.com>
Cc: Hakan Akkan <hakanakkan <at> gmail.com>
Cc: H. Peter Anvin <hpa <at> zytor.com>
Cc: Ingo Molnar <mingo <at> kernel.org>
Cc: Kevin Hilman <khilman <at> ti.com>
Cc: Max Krasnyansky <maxk <at> qualcomm.com>
Cc: Paul E. McKenney <paulmck <at> linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz <at> infradead.org>
Cc: Stephen Hemminger <shemminger <at> vyatta.com>
(Continue reading)

Frederic Weisbecker | 4 Aug 2012 17:22
Picon

[PATCH 4/5] cputime: Rename account_system_vtime to account_vtime

account_system_vtime() can be called from random places:
hard/softirq entry/exit, kvm guest entry/exit, and even
context switches on powerpc.

Rename it to the even more generic account_vtime() name,
this reflect well that we are in a random place in the
kernel where we have either system, idle or user time
to account.

This way we can reuse the "system" version and expand it
with other domains such as "user" or "idle" to prepare
for the user hooks based virtual cputime accounting that
knows better when to flush the time for which domain of
execution.

Signed-off-by: Frederic Weisbecker <fweisbec <at> gmail.com>
Cc: Alessio Igor Bogani <abogani <at> kernel.org>
Cc: Andrew Morton <akpm <at> linux-foundation.org>
Cc: Avi Kivity <avi <at> redhat.com>
Cc: Chris Metcalf <cmetcalf <at> tilera.com>
Cc: Christoph Lameter <cl <at> linux.com>
Cc: Geoff Levand <geoff <at> infradead.org>
Cc: Gilad Ben Yossef <gilad <at> benyossef.com>
Cc: Hakan Akkan <hakanakkan <at> gmail.com>
Cc: H. Peter Anvin <hpa <at> zytor.com>
Cc: Ingo Molnar <mingo <at> kernel.org>
Cc: Kevin Hilman <khilman <at> ti.com>
Cc: Max Krasnyansky <maxk <at> qualcomm.com>
Cc: Paul E. McKenney <paulmck <at> linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz <at> infradead.org>
(Continue reading)

Frederic Weisbecker | 4 Aug 2012 17:22
Picon

[PATCH 5/5] cputime: Generic on-demand virtual cputime accounting

If we want to stop the tick further idle, we need to be
able to account the cputime without using the tick.

Virtual based cputime accounting solves that problem by
hooking into kernel/user boundaries.

However implementing CONFIG_VIRT_CPU_ACCOUNTING requires
to set low level hooks and involves more overhead. But
we already have a generic context tracking subsystem
that is required for RCU needs by archs which will want to
shut down the tick outside idle.

This patch implements a generic virtual based cputime
accounting that relies on these generic kernel/user hooks.

There are some upsides of doing this:

- This requires no arch code to implement CONFIG_VIRT_CPU_ACCOUNTING
if context tracking is already built (already necessary for RCU in full
tickless mode).

- We can rely on the generic context tracking subsystem to dynamically
(de)activate the hooks, so that we can switch anytime between virtual
and tick based accounting. This way we don't have the overhead
of the virtual accounting when the tick is running periodically.

And a few downsides:

- It relies on jiffies and the hooks are set in high level code. This
results in less precise cputime accounting than with a true native
(Continue reading)


Gmane