Jason Wang
2020-Jul-29 09:21 UTC
[PATCH V4 4/6] vhost_vdpa: implement IRQ offloading in vhost_vdpa
On 2020/7/28 ??5:04, Eli Cohen wrote:> On Tue, Jul 28, 2020 at 12:24:03PM +0800, Zhu Lingshan wrote: >> >> +static void vhost_vdpa_setup_vq_irq(struct vhost_vdpa *v, int qid) >> +{ >> + struct vhost_virtqueue *vq = &v->vqs[qid]; >> + const struct vdpa_config_ops *ops = v->vdpa->config; >> + struct vdpa_device *vdpa = v->vdpa; >> + int ret, irq; >> + >> + spin_lock(&vq->call_ctx.ctx_lock); >> + irq = ops->get_vq_irq(vdpa, qid); >> + if (!vq->call_ctx.ctx || irq == -EINVAL) { >> + spin_unlock(&vq->call_ctx.ctx_lock); >> + return; >> + } >> + > If I understand correctly, this will cause these IRQs to be forwarded > directly to the VCPU, e.g. will be handled by the guest/qemu.Yes, if it can bypassed, the interrupt will be delivered to vCPU directly.> Does this mean that the host will not handle this interrupt? How does it > work in case on level triggered interrupts?There's no guarantee that the KVM arch code can make sure the irq bypass work for any type of irq. So if they the irq will still need to be handled by host first. This means we should keep the host interrupt handler as a slowpath (fallback).> > In the case of ConnectX, I need to execute some code to acknowledge the > interrupt.This turns out to be hard for irq bypassing to work. Is it because the irq is shared or what kind of ack you need to do? Thanks> > Can you explain how this should be done? >