Re: [PATCH 1/3] Make kvm_cpu_(has|get)_interrupt() work for userspace irqchip too.

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

 



> >   * check if there are pending timer events
> > @@ -48,14 +49,17 @@ int kvm_cpu_has_interrupt(struct kvm_vcpu *v)
> >  {
> >  	struct kvm_pic *s;
> >
> > -	if (kvm_apic_has_interrupt(v) == -1) {	/* LAPIC */
> > -		if (kvm_apic_accept_pic_intr(v)) {
> > -			s = pic_irqchip(v->kvm);	/* PIC */
> > -			return s->output;
> > -		} else
> > -			return 0;
> > +	if (irqchip_in_kernel(v->kvm)) {
> > +		if (kvm_apic_has_interrupt(v) == -1) {	/* LAPIC */
> > +			if (kvm_apic_accept_pic_intr(v)) {
> > +				s = pic_irqchip(v->kvm);	/* PIC */
> > +				return s->output;
> > +			} else
> > +				return 0;
> > +		}
> > +		return 1;
> >  	}
> > -	return 1;
> > +	return v->arch.irq_summary;
> >  }
> 
> Use if (!irqchip_in_kernel(v->kvm)) for userspace seems more simple(rather 
> than a series of indention...).
> 
As long as lines are smaller then 80 chars I don't care much :) If new
version of the patch will be needed I'll change this.

> >
> > @@ -2976,8 +2975,9 @@ static int handle_interrupt_window(struct kvm_vcpu
> > *vcpu, * If the user space waits to inject interrupts, exit as soon as *
> > possible
> >  	 */
> > -	if (kvm_run->request_interrupt_window &&
> > -	    !vcpu->arch.irq_summary) {
> > +	if (!irqchip_in_kernel(vcpu->kvm) &&
> > +	    kvm_run->request_interrupt_window &&
> 
> I think kvm_run->request_interrupt_window can indicate it's userspace irqchip?
> 
You are correct, but this value is directly controlled by userspase, so
I added irqchip_in_kernel() check to protect from buggy userspace.
 
--
			Gleb.
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux