Re: [PATCH 36/37] KVM: PPC: booke: expose guest registers on irq reinject
flat view
From: Alexander Graf <hidden>
Date: 2012-02-26 12:00:03
Also in:
kvm
On 25.02.2012, at 00:40, Scott Wood wrote:
On 02/24/2012 08:26 AM, Alexander Graf wrote:quoted
+static void kvmppc_fill_pt_regs(struct kvm_vcpu *vcpu, struct =
pt_regs *regs)
quoted
{ - int r =3D RESUME_HOST; + int i; =20 - /* update before a new last_exit_type is rewritten */ - kvmppc_update_timing_stats(vcpu); + for (i =3D 0; i < 32; i++) + regs->gpr[i] =3D kvmppc_get_gpr(vcpu, i); + regs->nip =3D vcpu->arch.pc; + regs->msr =3D vcpu->arch.shared->msr; + regs->ctr =3D vcpu->arch.ctr; + regs->link =3D vcpu->arch.lr; + regs->xer =3D kvmppc_get_xer(vcpu); + regs->ccr =3D kvmppc_get_cr(vcpu); + regs->dar =3D get_guest_dear(vcpu); + regs->dsisr =3D get_guest_esr(vcpu); +}=20 How much overhead does this add to every interrupt? Can't we keep =
this
to the minimum that perf cares about?
I would rather not make assumptions on what perf cares about - maybe we = want to one day implement "perf kvm" and then perf could rely on pretty = much anything in there.
=20quoted
+ +static void kvmppc_restart_interrupt(struct kvm_vcpu *vcpu, + unsigned int exit_nr) +{ + struct pt_regs regs =3D *current->thread.regs; =20 + kvmppc_fill_pt_regs(vcpu, ®s);=20 Why are you copying out of current->thread.regs? That's old junk =
data,
set by some previous exception and possibly overwritten since.
Because it gives us good default values for anything we don't set. Do = you have other recommendations? Alex