[PATCH v3] powerpc: kvm: optimize "sc 1" as fast return

Alexander Graf agraf at suse.de
Tue Nov 19 21:40:56 EST 2013


On 19.11.2013, at 07:12, Liu Ping Fan <kernelfans at gmail.com> wrote:

> In some scene, e.g openstack CI, PR guest can trigger "sc 1" frequently,
> this patch optimizes the path by directly delivering BOOK3S_INTERRUPT_SYSCALL
> to HV guest, so powernv can return to HV guest without heavy exit, i.e,
> no need to swap TLB, HTAB,.. etc
> 
> Signed-off-by: Liu Ping Fan <pingfank at linux.vnet.ibm.com>
> ---
> v3: add some document

This is v4 I think

> ---
> arch/powerpc/kvm/book3s_hv.c            | 10 ++++------
> arch/powerpc/kvm/book3s_hv_rmhandlers.S | 19 ++++++++++++++++++-
> 2 files changed, 22 insertions(+), 7 deletions(-)
> 
> diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
> index 62a2b5a..1addb1a 100644
> --- a/arch/powerpc/kvm/book3s_hv.c
> +++ b/arch/powerpc/kvm/book3s_hv.c
> @@ -628,12 +628,10 @@ static int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
> 		/* hcall - punt to userspace */
> 		int i;
> 
> -		if (vcpu->arch.shregs.msr & MSR_PR) {
> -			/* sc 1 from userspace - reflect to guest syscall */
> -			kvmppc_book3s_queue_irqprio(vcpu, BOOK3S_INTERRUPT_SYSCALL);
> -			r = RESUME_GUEST;
> -			break;
> -		}
> +		/* hypercall with MSR_PR has already been handled in rmode,
> +		 * and never reaches here.
> +		 */

It would've been nice to also mention the real mode hypercall handling, but I can just post a follow-up patch for that one.


Thanks, applied to kvm-ppc-queue.

Alex



More information about the Linuxppc-dev mailing list