This made me wonder:

> In the stock linux kernel, as far as I can see, there's no counting for this 
> info for x86
> architecture, - it is only counted for ia64, powerpc and s390x architectures.

And for [1] account_guest_time it indeed seems that way.
But while ia64/s390/powerpc have special code on their entry/exit path

$ grep -Hrn account_guest_time *
arch/ia64/kernel/time.c:77: account_guest_time(tsk, cycle_to_nsec(ti->gtime));
arch/powerpc/kernel/time.c:430: account_guest_time(tsk,
cputime_to_nsecs(acct->gtime));
arch/s390/kernel/vtime.c:172: account_guest_time(tsk, cputime_to_nsecs(guest));
include/linux/kernel_stat.h:99:extern void account_guest_time(struct
task_struct *, u64);
kernel/sched/cputime.c:140:void account_guest_time(struct task_struct
*p, u64 cputime)

There also are these calls from generic code:

kernel/sched/cputime.c:190: account_guest_time(p, cputime);
kernel/sched/cputime.c:388: account_guest_time(p, cputime);
kernel/sched/cputime.c:678: account_guest_time(tsk, vtime->gtime);

Which match these functions irqtime_account_process_tick,
account_guest_time, vtime_account_guest

Double checked x86 in Ubuntu 5.8.0-49-generic  (groovy) worked fine.
But indeed 5.11.0-13-generic (hirsute) seemed to not account for these
values anymore.

I haven't chased this further down, but these functions sound pretty generic.
@MJT - have you checked those and they all end up only being used in
arch-code/calls?

And as I said, there doesn't seem to be Ubuntu Delta for it [2][3],
yet there it is working.
IMHO this might be an upstream change between 5.8 and 5.10 introducing
the issue.
I'm afraid this really has to be looked at more in depth why it isn't
accounting anymore.

[1]: 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/kernel/sched/cputime.c#n140
[2]: 
https://kernel.ubuntu.com/git/ubuntu/ubuntu-hirsute.git/log/kernel/sched/cputime.c
[3]: 
https://kernel.ubuntu.com/git/ubuntu/ubuntu-groovy.git/log/kernel/sched/cputime.c

-- 
Christian Ehrhardt
Staff Engineer, Ubuntu Server
Canonical Ltd

Reply via email to