From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out1-smtp.messagingengine.com ([66.111.4.25]:55449 "EHLO out1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751700AbdHCRzR (ORCPT ); Thu, 3 Aug 2017 13:55:17 -0400 Date: Thu, 3 Aug 2017 10:55:12 -0700 From: Greg KH To: Paul Mackerras Cc: stable@vger.kernel.org Subject: Re: [PATCH 4.4.x] KVM: PPC: Book3S HV: Context-switch EBB registers properly Message-ID: <20170803175512.GD13298@kroah.com> References: <20170725234615.GA23026@fergus.ozlabs.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170725234615.GA23026@fergus.ozlabs.ibm.com> Sender: stable-owner@vger.kernel.org List-ID: On Wed, Jul 26, 2017 at 09:46:15AM +1000, Paul Mackerras wrote: > commit ca8efa1df1d15a1795a2da57f9f6aada6ed6b946 upstream. > > This adds code to save the values of three SPRs (special-purpose > registers) used by userspace to control event-based branches (EBBs), > which are essentially interrupts that get delivered directly to > userspace. These registers are loaded up with guest values when > entering the guest, and their values are saved when exiting the > guest, but we were not saving the host values and restoring them > before going back to userspace. > > On POWER8 this would only affect userspace programs which explicitly > request the use of EBBs and also use the KVM_RUN ioctl, since the > only source of EBBs on POWER8 is the PMU, and there is an explicit > enable bit in the PMU registers (and those PMU registers do get > properly context-switched between host and guest). On POWER9 there > is provision for externally-generated EBBs, and these are not subject > to the control in the PMU registers. > > Since these registers only affect userspace, we can save them when > we first come in from userspace and restore them before returning to > userspace, rather than saving/restoring the host values on every > guest entry/exit. Similarly, we don't need to worry about their > values on offline secondary threads since they execute in the context > of the idle task, which never executes in userspace. > > Fixes: b005255e12a3 ("KVM: PPC: Book3S HV: Context-switch new POWER8 SPRs", 2014-01-08) > Cc: stable@vger.kernel.org # v3.14+ > Signed-off-by: Paul Mackerras > --- > arch/powerpc/kvm/book3s_hv.c | 16 ++++++++++++++++ > 1 file changed, 16 insertions(+) Now applied, thanks. greg k-h