Re: [PATCH v2] arm/arm64: KVM: vgic: kick the specific vcpu instead of iterating through all

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 18/11/14 10:12, Shannon Zhao wrote:
> When call kvm_vgic_inject_irq to inject irq, we can known which vcpu
> the IRQ for by the irq_num and the cpuid. So we should just kick
> this vcpu to avoid iterating through all.
> 
> Signed-off-by: Shannon Zhao <zhaoshenglong@xxxxxxxxxx>
> ---
>  virt/kvm/arm/vgic.c |   32 ++++++++++++++++++++++++--------
>  1 files changed, 24 insertions(+), 8 deletions(-)
> 
> diff --git a/virt/kvm/arm/vgic.c b/virt/kvm/arm/vgic.c
> index 82db9d6..9dad67a 100644
> --- a/virt/kvm/arm/vgic.c
> +++ b/virt/kvm/arm/vgic.c
> @@ -95,6 +95,7 @@ static void vgic_retire_disabled_irqs(struct kvm_vcpu *vcpu);
>  static void vgic_retire_lr(int lr_nr, int irq, struct kvm_vcpu *vcpu);
>  static void vgic_update_state(struct kvm *kvm);
>  static void vgic_kick_vcpus(struct kvm *kvm);
> +static void vgic_kick_vcpu(struct kvm *kvm, int cpuid);
>  static u8 *vgic_get_sgi_sources(struct vgic_dist *dist, int vcpu_id, int sgi);
>  static void vgic_dispatch_sgi(struct kvm_vcpu *vcpu, u32 reg);
>  static struct vgic_lr vgic_get_lr(const struct kvm_vcpu *vcpu, int lr);
> @@ -1589,6 +1590,21 @@ static void vgic_kick_vcpus(struct kvm *kvm)
>  	}
>  }
>  
> +static void vgic_kick_vcpu(struct kvm *kvm, int cpuid)
> +{
> +	struct kvm_vcpu *vcpu;
> +
> +	/*
> +	 * We've injected an interrupt, kick the specified vcpu
> +	 */
> +	if (cpuid < atomic_read(&kvm->online_vcpus)) {
> +		vcpu = kvm_get_vcpu(kvm, cpuid);
> +		if (vcpu != NULL) {
> +			kvm_vcpu_kick(vcpu);
> +		}
> +	}

Why do you need all these checks? Why would cpuid be wrong at any time
here, given that we've extracted it from supposedly valid information?
Can you give an example of such a situation?

Thanks,

	M.
-- 
Jazz is not dead. It just smells funny...

_______________________________________________
kvmarm mailing list
kvmarm@xxxxxxxxxxxxxxxxxxxxx
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm




[Index of Archives]     [Linux KVM]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux