Re: [patch 3/5] KVM: MMU: add kvm_mmu_shadow_walk helper

Avi Kivity
2009-06-10T09:17:09Z

Marcelo Tosatti wrote:
> Required by EPT misconfiguration handler.
>
> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
>
> Index: kvm/arch/x86/kvm/mmu.c
> ===================================================================
> --- kvm.orig/arch/x86/kvm/mmu.c
> +++ kvm/arch/x86/kvm/mmu.c
> @@ -3013,6 +3013,26 @@ out:
> return r;
> }
>
> +void kvm_mmu_shadow_walk(struct kvm_vcpu *vcpu, u64 addr,
> + struct mmu_shadow_walk *walk)
> +{
> + struct kvm_shadow_walk_iterator iterator;
> +
> + spin_lock(&vcpu->kvm->mmu_lock);
> + for_each_shadow_entry(vcpu, addr, iterator) {
> + int err;
> +
> + err = walk->fn(vcpu, iterator.sptep, iterator.level, walk);
> + if (err)
> + break;
> +
> + if (!is_shadow_present_pte(*iterator.sptep))
> + break;
> + }
> + spin_unlock(&vcpu->kvm->mmu_lock);
> +}
> +EXPORT_SYMBOL(kvm_mmu_shadow_walk);
> +
>

Isn't it simpler to invoke for_each_shadow_entry(), instead of defining
a callback and calling it?

We had those callbacks once, then switched to for_each.

--
error compiling committee.c: too many arguments to function