Skip to contentSkip to conversation

PPC: Enable lightweight exits again

PATCH Applied Alexander Graf 2 participants 2 messages Jan 4, 2010 – Jan 6, 2010 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PPC: Enable lightweight exits again

The PowerPC C ABI defines that registers r14-r31 need to be preserved across function calls. Since our exit handler is written in C, we can make use of that and don't need to reload r14-r31 on every entry/exit cycle.

This technique is also used in the BookE code and is called "lightweight exits" there. To follow the tradition, it's called the same in Book3S.

So far this optimization was disabled though, as the code didn't do what it was expected to do, but failed to work.

This patch fixes and enables lightweight exits again.

---
 arch/powerpc/kvm/book3s.c               |    4 +-
 arch/powerpc/kvm/book3s_64_interrupts.S |  106 ++++++++++++++++---------------
 2 files changed, 57 insertions(+), 53 deletions(-)
arch/powerpc/kvm/book3s.c +1 -3
index 492dcc1..fd2a4d5 100644
@@ -539,8 +539,6 @@ int kvmppc_handle_pagefault(struct kvm_run *run, struct kvm_vcpu *vcpu,
 		r = kvmppc_emulate_mmio(run, vcpu);
 		if ( r == RESUME_HOST_NV )
 			r = RESUME_HOST;
-		if ( r == RESUME_GUEST_NV )
-			r = RESUME_GUEST;
 	}
 
 	return r;
@@ -645,7 +643,7 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
 		er = kvmppc_emulate_instruction(run, vcpu);
 		switch (er) {
 		case EMULATE_DONE:
-			r = RESUME_GUEST;
+			r = RESUME_GUEST_NV;
 			break;
 		case EMULATE_FAIL:
 			printk(KERN_CRIT "%s: emulation at %lx failed (%08x)\n",
arch/powerpc/kvm/book3s_64_interrupts.S +56 -50

161 lines not on this page · raw message

Signature · 1 line
1.6.0.2

A message that is not in the archive (sent off-list or not yet received): 1262639965-21489-1-git-send-email-agraf-l3A5Bk7waGM@public.gmane.org

#2 lore raw
Quoted 7 lines · Alexander Graf

The PowerPC C ABI defines that registers r14-r31 need to be preserved across function calls. Since our exit handler is written in C, we can make use of that and don't need to reload r14-r31 on every entry/exit cycle.

This technique is also used in the BookE code and is called "lightweight exits" there. To follow the tradition, it's called the same in Book3S.

Quoted 6 lines

So far this optimization was disabled though, as the code didn't do what it was expected to do, but failed to work.

This patch fixes and enables lightweight exits again.

Applied, thanks.