On 25.02.2012, at 00:40, Scott Wood wrote:

> On 02/24/2012 08:26 AM, Alexander Graf wrote:
>> +static void kvmppc_fill_pt_regs(struct kvm_vcpu *vcpu, struct pt_regs *regs)
>> {
>> -    int r = RESUME_HOST;
>> +    int i;
>> 
>> -    /* update before a new last_exit_type is rewritten */
>> -    kvmppc_update_timing_stats(vcpu);
>> +    for (i = 0; i < 32; i++)
>> +            regs->gpr[i] = kvmppc_get_gpr(vcpu, i);
>> +    regs->nip = vcpu->arch.pc;
>> +    regs->msr = vcpu->arch.shared->msr;
>> +    regs->ctr = vcpu->arch.ctr;
>> +    regs->link = vcpu->arch.lr;
>> +    regs->xer = kvmppc_get_xer(vcpu);
>> +    regs->ccr = kvmppc_get_cr(vcpu);
>> +    regs->dar = get_guest_dear(vcpu);
>> +    regs->dsisr = get_guest_esr(vcpu);
>> +}
> 
> 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.

> 
>> +
>> +static void kvmppc_restart_interrupt(struct kvm_vcpu *vcpu,
>> +                                 unsigned int exit_nr)
>> +{
>> +    struct pt_regs regs = *current->thread.regs;
>> 
>> +    kvmppc_fill_pt_regs(vcpu, &regs);
> 
> 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

_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Reply via email to