RE: [RFC v1 5/5] Call irqbypass update routine when updating irqfd

2015-07-10 Thread Wu, Feng


 -Original Message-
 From: Wu, Feng
 Sent: Friday, July 10, 2015 12:13 PM
 To: Alex Williamson
 Cc: kvm@vger.kernel.org; pbonz...@redhat.com; j...@8bytes.org;
 avi.kiv...@gmail.com; eric.au...@linaro.org; Wu, Feng
 Subject: RE: [RFC v1 5/5] Call irqbypass update routine when updating irqfd
 
 
 
  -Original Message-
  From: kvm-ow...@vger.kernel.org [mailto:kvm-ow...@vger.kernel.org] On
  Behalf Of Alex Williamson
  Sent: Friday, July 10, 2015 11:26 AM
  To: Wu, Feng
  Cc: kvm@vger.kernel.org; pbonz...@redhat.com; j...@8bytes.org;
  avi.kiv...@gmail.com; eric.au...@linaro.org
  Subject: Re: [RFC v1 5/5] Call irqbypass update routine when updating irqfd
 
  On Fri, 2015-07-10 at 11:00 +0800, Feng Wu wrote:
   Call update routine when updating irqfd, this can update the
   IRTE for Intel posted-interrupts.
  
   Signed-off-by: Feng Wu feng...@intel.com
   ---
virt/kvm/eventfd.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
  
   diff --git a/virt/kvm/eventfd.c b/virt/kvm/eventfd.c
   index a32cf6c..1226835 100644
   --- a/virt/kvm/eventfd.c
   +++ b/virt/kvm/eventfd.c
   @@ -570,8 +570,10 @@ void kvm_irq_routing_update(struct kvm *kvm)
  
 spin_lock_irq(kvm-irqfds.lock);
  
   - list_for_each_entry(irqfd, kvm-irqfds.items, list)
   + list_for_each_entry(irqfd, kvm-irqfds.items, list) {
 irqfd_update(kvm, irqfd);
   + irqfd-consumer.update(irqfd-consumer);
   + }
  
 spin_unlock_irq(kvm-irqfds.lock);
}
 
  I don't understand why the irq bypass manager needs to know about this
  update callback.  We could just as easily make it be a function pointer
  on the irqfd structure or maybe just open code it.  It's defined by the
  consumer and called by the consumer, the irq bypass manager shouldn't
  know about it.  Thanks,
 
 Yes, you are right. All we need is the producer information which has been
 passed in the register routine. And we can easily make this update logic
 inside the consumer. Thanks for your comments!
 
 Thanks,
 Feng

BTW, Paolo  Alex, in VFIO framework, how can we know a vCPU or a guest
has assigned devices to it?

Thanks,
Feng

 
 
  Alex
 
  --
  To unsubscribe from this list: send the line unsubscribe kvm in
  the body of a message to majord...@vger.kernel.org
  More majordomo info at  http://vger.kernel.org/majordomo-info.html
N�r��yb�X��ǧv�^�)޺{.n�+h����ܨ}���Ơz�j:+v���zZ+��+zf���h���~i���z��w���?��)ߢf

Re: [RFC v1 5/5] Call irqbypass update routine when updating irqfd

2015-07-10 Thread Paolo Bonzini


On 10/07/2015 10:28, Wu, Feng wrote:
  Yes, you are right. All we need is the producer information which has been
  passed in the register routine. And we can easily make this update logic
  inside the consumer. Thanks for your comments!
 
 BTW, Paolo  Alex, in VFIO framework, how can we know a vCPU or a guest
 has assigned devices to it?

See here:
http://article.gmane.org/gmane.comp.emulators.kvm.devel/137930/raw

Paolo
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC v1 5/5] Call irqbypass update routine when updating irqfd

2015-07-10 Thread Alex Williamson
On Fri, 2015-07-10 at 14:47 +0200, Paolo Bonzini wrote:
 
 On 10/07/2015 10:28, Wu, Feng wrote:
   Yes, you are right. All we need is the producer information which has been
   passed in the register routine. And we can easily make this update logic
   inside the consumer. Thanks for your comments!
  
  BTW, Paolo  Alex, in VFIO framework, how can we know a vCPU or a guest
  has assigned devices to it?
 
 See here:
 http://article.gmane.org/gmane.comp.emulators.kvm.devel/137930/raw


In general, VFIO has zero visibility into KVM.  VFIO doesn't know or
care what the userspace driver is, whether it's QEMU/KVM, a set of ruby
bindings for VFIO, a DPDK library, etc.  As Paolo points out, KVM does
have ways to be told about assigned devices from userspace and probe
some properties, like whether the IOMMU allows non-coherent DMA.  These
are handled by the KVM-VFIO pseudo device (virt/kvm/vfio.c).  Thanks,

Alex

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [RFC v1 5/5] Call irqbypass update routine when updating irqfd

2015-07-09 Thread Wu, Feng


 -Original Message-
 From: kvm-ow...@vger.kernel.org [mailto:kvm-ow...@vger.kernel.org] On
 Behalf Of Alex Williamson
 Sent: Friday, July 10, 2015 11:26 AM
 To: Wu, Feng
 Cc: kvm@vger.kernel.org; pbonz...@redhat.com; j...@8bytes.org;
 avi.kiv...@gmail.com; eric.au...@linaro.org
 Subject: Re: [RFC v1 5/5] Call irqbypass update routine when updating irqfd
 
 On Fri, 2015-07-10 at 11:00 +0800, Feng Wu wrote:
  Call update routine when updating irqfd, this can update the
  IRTE for Intel posted-interrupts.
 
  Signed-off-by: Feng Wu feng...@intel.com
  ---
   virt/kvm/eventfd.c | 4 +++-
   1 file changed, 3 insertions(+), 1 deletion(-)
 
  diff --git a/virt/kvm/eventfd.c b/virt/kvm/eventfd.c
  index a32cf6c..1226835 100644
  --- a/virt/kvm/eventfd.c
  +++ b/virt/kvm/eventfd.c
  @@ -570,8 +570,10 @@ void kvm_irq_routing_update(struct kvm *kvm)
 
  spin_lock_irq(kvm-irqfds.lock);
 
  -   list_for_each_entry(irqfd, kvm-irqfds.items, list)
  +   list_for_each_entry(irqfd, kvm-irqfds.items, list) {
  irqfd_update(kvm, irqfd);
  +   irqfd-consumer.update(irqfd-consumer);
  +   }
 
  spin_unlock_irq(kvm-irqfds.lock);
   }
 
 I don't understand why the irq bypass manager needs to know about this
 update callback.  We could just as easily make it be a function pointer
 on the irqfd structure or maybe just open code it.  It's defined by the
 consumer and called by the consumer, the irq bypass manager shouldn't
 know about it.  Thanks,

Yes, you are right. All we need is the producer information which has been
passed in the register routine. And we can easily make this update logic
inside the consumer. Thanks for your comments!

Thanks,
Feng

 
 Alex
 
 --
 To unsubscribe from this list: send the line unsubscribe kvm in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC v1 5/5] Call irqbypass update routine when updating irqfd

2015-07-09 Thread Alex Williamson
On Fri, 2015-07-10 at 11:00 +0800, Feng Wu wrote:
 Call update routine when updating irqfd, this can update the
 IRTE for Intel posted-interrupts.
 
 Signed-off-by: Feng Wu feng...@intel.com
 ---
  virt/kvm/eventfd.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
 
 diff --git a/virt/kvm/eventfd.c b/virt/kvm/eventfd.c
 index a32cf6c..1226835 100644
 --- a/virt/kvm/eventfd.c
 +++ b/virt/kvm/eventfd.c
 @@ -570,8 +570,10 @@ void kvm_irq_routing_update(struct kvm *kvm)
  
   spin_lock_irq(kvm-irqfds.lock);
  
 - list_for_each_entry(irqfd, kvm-irqfds.items, list)
 + list_for_each_entry(irqfd, kvm-irqfds.items, list) {
   irqfd_update(kvm, irqfd);
 + irqfd-consumer.update(irqfd-consumer);
 + }
  
   spin_unlock_irq(kvm-irqfds.lock);
  }

I don't understand why the irq bypass manager needs to know about this
update callback.  We could just as easily make it be a function pointer
on the irqfd structure or maybe just open code it.  It's defined by the
consumer and called by the consumer, the irq bypass manager shouldn't
know about it.  Thanks,

Alex

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html