Skip to content

Virtual Machine Time Accounting

Laurent Vivier lkml 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v1 Latest posting 3/33 of 4 patches 26 repliesIn review
  2. v1 posting 2/33 of 4 patches 8 repliesSuperseded
  3. v1 posting 1/34 patches 40 repliesSuperseded

3 of 4 patches are in this archive. The cover letter announces 4.

Patches in v1 posting 3/3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4Introduce a new field "guest" in cpustatfs/proc/proc_misc.c include/linux/kernel_stat.h+12 -40 replies
3/4modify account_system_time() to update guest time in cpustat and task_structinclude/linux/sched.h kernel/sched.c+26 -03 replies
4/4Modify KVM to update guest time accounting.drivers/kvm/kvm.h drivers/kvm/svm.c drivers/kvm/vmx.c+17 -032 replies

Reviews trailers per patch

1 of 3 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchRik van RielIngo MolnarAvi KivityChristian Borntraeger
SeriesA-b A-b
1/4
3/4
4/4A-b A-b A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 4 reviewers.

Read the v1 thread

Cover letter [RESEND 2][PATCH 0/4] Virtual Machine Time Accounting

This new version remove conditional compilation on GUEST_ACCOUNTING.

----------

The aim of these four patches is to introduce Virtual Machine time accounting.

[PATCH 1/4] as recent CPUs introduce a third running state, after "user" and "system", we need a new field, "guest", in cpustat to store the time used by the CPU to run virtual CPU. Modify /proc/stat to display this new field.

[PATCH 2/4] like for cpustat, introduce the "gtime" (guest time of the task) and "cgtime" (guest time of the task children) fields for the
tasks. Modify signal_struct and task_struct. Modify /proc/<pid>/stat to display these new fields.

[PATCH 3/4] modify account_system_time() to add cputime to cpustat->guest if we are running a VCPU. We add this cputime to cpustat->user instead of cpustat->system because this part of KVM code is in fact user code although it is executed in the kernel. We duplicate VCPU time between guest and user to allow an unmodified "top(1)" to display correct value. A modified "top(1)" is able to display good cpu user time and cpu guest time by subtracting cpu guest time from cpu user time. Update "gtime" and "cgtime" in signal_struct and task_struct accordingly.

[PATCH 4/4] Modify KVM to update guest time accounting.

Signature · 2 lines
------------- [email protected]  --------------
          "Software is hard" - Donald Knuth