linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Possible regression in cpuacct.stats system time
@ 2021-01-04 21:24 Nitesh Narayan Lal
  2021-01-05  7:27 ` Paolo Bonzini
  0 siblings, 1 reply; 2+ messages in thread
From: Nitesh Narayan Lal @ 2021-01-04 21:24 UTC (permalink / raw)
  To: linux-kernel, kvm, tglx, alexandre.chartre, peterz, pbonzini,
	w90p710, sean.j.christopherson, vkuznets

Hi,

Last year I reported an issue of "suspicious RCU usage" [1] with the debug
kernel which was fixed with the patch:

    87fa7f3e98 "x86/kvm: Move context tracking where it belongs"

Recently I have come across a possible regression because of this
patch in the cpuacct.stats system time.

With the latest upstream kernel (5.11-rc2) when we set up a VM and start
observing the system time value from cpuacct.stat then it is significantly
higher than value reported with the kernel that doesn't have the
previously mentioned patch.

For instance, the following are the values of cpuacct.stats right after the
VM bring up completion for two cases:

with a kernel that has the patch-
    user 471
    system 6094

with the patch reverted-
    user 498
    system 1873


FWIU the reason behind this increase is the moving of guest_exit_irqoff()
to its proper location (near vmexit). This leads to the accounting
of instructions that were previously accounted into the guest context as a
part of the system time.

IMO this should be an expected behavior after the previously mentioned
change. Is that a right conclusion or I am missing something here?

Another question that I have is about the patch

    d7a08882a0 "KVM: x86: Unconditionally enable irqs in guest context"

considering we are enabling irqs early now in the code path, do we still
need this patch?


[1] https://lore.kernel.org/lkml/ece36eb1-253a-8ec6-c183-309c10bb35d5@redhat.com/

--
Thanks
Nitesh


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Possible regression in cpuacct.stats system time
  2021-01-04 21:24 Possible regression in cpuacct.stats system time Nitesh Narayan Lal
@ 2021-01-05  7:27 ` Paolo Bonzini
  0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2021-01-05  7:27 UTC (permalink / raw)
  To: Nitesh Narayan Lal, linux-kernel, kvm, tglx, alexandre.chartre,
	peterz, w90p710, sean.j.christopherson, vkuznets

On 04/01/21 22:24, Nitesh Narayan Lal wrote:
> Hi,
> 
> Last year I reported an issue of "suspicious RCU usage" [1] with the debug
> kernel which was fixed with the patch:
> 
>      87fa7f3e98 "x86/kvm: Move context tracking where it belongs"
> 
> Recently I have come across a possible regression because of this
> patch in the cpuacct.stats system time.
> 
> With the latest upstream kernel (5.11-rc2) when we set up a VM and start
> observing the system time value from cpuacct.stat then it is significantly
> higher than value reported with the kernel that doesn't have the
> previously mentioned patch.
> 
> FWIU the reason behind this increase is the moving of guest_exit_irqoff()
> to its proper location (near vmexit). This leads to the accounting
> of instructions that were previously accounted into the guest context as a
> part of the system time.
> 
> IMO this should be an expected behavior after the previously mentioned
> change. Is that a right conclusion or I am missing something here?

Yes it's expected and I think it's more precise, since this is host 
overhead rather than guest operation .

> Another question that I have is about the patch
> 
>      d7a08882a0 "KVM: x86: Unconditionally enable irqs in guest context"
> 
> considering we are enabling irqs early now in the code path, do we still
> need this patch?

No, we don't.  Since the code is a bit simpler without it, feel free to 
send a revert.

Thanks,

Paolo

> 
> [1] https://lore.kernel.org/lkml/ece36eb1-253a-8ec6-c183-309c10bb35d5@redhat.com/
> 
> --
> Thanks
> Nitesh
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-01-05  7:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-04 21:24 Possible regression in cpuacct.stats system time Nitesh Narayan Lal
2021-01-05  7:27 ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).