[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7d13da7d25282de0668fa3df5ee92c61b4b41ce2.camel@redhat.com>
Date: Fri, 21 Jan 2022 18:37:07 +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 3/7] kvm/arm64: rework guest entry logic
On Wed, 2022-01-19 at 10:58 +0000, Mark Rutland wrote:
> In kvm_arch_vcpu_ioctl_run() we enter an RCU extended quiescent state
> (EQS) by calling guest_enter_irqoff(), and unmasked IRQs prior to
> exiting the EQS by calling guest_exit(). As the IRQ entry code will not
> wake RCU in this case, we may run the core IRQ code and IRQ handler
> without RCU watching, leading to various potential problems.
>
> Additionally, we do not inform lockdep or tracing that interrupts will
> be enabled during guest execution, which caan lead to misleading traces
> and warnings that interrupts have been enabled for overly-long periods.
>
> This patch fixes these issues by using the new timing and context
> entry/exit helpers to ensure that interrupts are handled during guest
> vtime but with RCU watching, with a sequence:
>
> guest_timing_enter_irqoff();
>
> guest_state_enter_irqoff();
> < run the vcpu >
> guest_state_exit_irqoff();
>
> < take any pending IRQs >
>
> guest_timing_exit_irqoff();
>
> Since instrumentation may make use of RCU, we must also ensure that no
> instrumented code is run during the EQS. I've split out the critical
> section into a new kvm_arm_enter_exit_vcpu() helper which is marked
> noinstr.
>
> Fixes: 1b3d546daf85ed2b ("arm/arm64: KVM: Properly account for guest CPU time")
> Reported-by: Nicolas Saenz Julienne <nsaenzju@...hat.com>
> Signed-off-by: Mark Rutland <mark.rutland@....com>
> Reviewed-by: Marc Zyngier <maz@...nel.org>
> Cc: Alexandru Elisei <alexandru.elisei@....com>
> Cc: Catalin Marinas <catalin.marinas@....com>
> Cc: Frederic Weisbecker <frederic@...nel.org>
> Cc: James Morse <james.morse@....com>
> Cc: Paolo Bonzini <pbonzini@...hat.com>
> Cc: Paul E. McKenney <paulmck@...nel.org>
> Cc: Suzuki K Poulose <suzuki.poulose@....com>
> Cc: Will Deacon <will@...nel.org>
> ---
Reviewed-by: Nicolas Saenz Julienne <nsaenzju@...hat.com>
Thanks,
--
Nicolás Sáenz
Powered by blists - more mailing lists