[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <3d76e432d17f5d579a866191a4a33be189781b60.camel@redhat.com>
Date: Fri, 21 Jan 2022 18:40:20 +0100
From: Nicolas Saenz Julienne <nsaenzju@...hat.com>
To: Mark Rutland <mark.rutland@....com>, linux-kernel@...r.kernel.org
Cc: aleksandar.qemu.devel@...il.com, alexandru.elisei@....com,
anup.patel@....com, aou@...s.berkeley.edu, atish.patra@....com,
borntraeger@...ux.ibm.com, bp@...en8.de, catalin.marinas@....com,
chenhuacai@...nel.org, dave.hansen@...ux.intel.com,
frankja@...ux.ibm.com, frederic@...nel.org, gor@...ux.ibm.com,
hca@...ux.ibm.com, james.morse@....com, jmattson@...gle.com,
joro@...tes.org, luto@...nel.org, maz@...nel.org, mingo@...hat.com,
mpe@...erman.id.au, palmer@...belt.com, paulmck@...nel.org,
paul.walmsley@...ive.com, pbonzini@...hat.com,
peterz@...radead.org, seanjc@...gle.com, suzuki.poulose@....com,
svens@...ux.ibm.com, tglx@...utronix.de, tsbogend@...ha.franken.de,
vkuznets@...hat.com, wanpengli@...cent.com, will@...nel.org
Subject: Re: [PATCH v2 7/7] kvm/x86: rework guest entry logic
On Wed, 2022-01-19 at 10:58 +0000, Mark Rutland wrote:
> For consistency and clarity, migrate x86 over to the generic helpers for
> guest timing and lockdep/RCU/tracing management, and remove the
> x86-specific helpers.
>
> Prior to this patch, the guest timing was entered in
> kvm_guest_enter_irqoff() (called by svm_vcpu_enter_exit() and
> svm_vcpu_enter_exit()), and was exited by the call to
> vtime_account_guest_exit() within vcpu_enter_guest().
>
> To minimize duplication and to more clearly balance entry and exit, both
> entry and exit of guest timing are placed in vcpu_enter_guest(), using
> the new guest_timing_{enter,exit}_irqoff() helpers. When context
> tracking is used a small amount of additional time will be accounted
> towards guests; tick-based accounting is unnaffected as IRQs are
> disabled at this point and not enabled until after the return from the
> guest.
>
> This also corrects (benign) mis-balanced context tracking accounting
> introduced in commits:
>
> ae95f566b3d22ade ("KVM: X86: TSCDEADLINE MSR emulation fastpath")
> 26efe2fd92e50822 ("KVM: VMX: Handle preemption timer fastpath")
>
> Where KVM can enter a guest multiple times, calling vtime_guest_enter()
> without a corresponding call to vtime_account_guest_exit(), and with
> vtime_account_system() called when vtime_account_guest() should be used.
> As account_system_time() checks PF_VCPU and calls account_guest_time(),
> this doesn't result in any functional problem, but is unnecessarily
> confusing.
>
> Signed-off-by: Mark Rutland <mark.rutland@....com>
> Cc: Borislav Petkov <bp@...en8.de>
> Cc: Dave Hansen <dave.hansen@...ux.intel.com>
> Cc: Ingo Molnar <mingo@...hat.com>
> Cc: Jim Mattson <jmattson@...gle.com>
> Cc: Joerg Roedel <joro@...tes.org>
> Cc: Paolo Bonzini <pbonzini@...hat.com>
> Cc: Sean Christopherson <seanjc@...gle.com>
> Cc: Thomas Gleixner <tglx@...utronix.de>
> Cc: Vitaly Kuznetsov <vkuznets@...hat.com>
> Cc: Wanpeng Li <wanpengli@...cent.com>
> ---
Reviewed-by: Nicolas Saenz Julienne <nsaenzju@...hat.com>
Thanks,
--
Nicolás Sáenz
Powered by blists - more mailing lists