# Re: \[RFC v4 10/11\] vduse: Introduce a workqueue for irq injection

- From: Jason Wang \<hidden\>
- Date: 2021-03-05 03:42:53 
- List: virtualization
- Page: https://ratatoskr.run/virtualization/2021/03/201088
- Thread: https://ratatoskr.run/netdev/2021/02/200438/t.md

```text

On 2021/3/5 11:30 上午, Yongji Xie wrote:
> On Fri, Mar 5, 2021 at 11:05 AM Jason Wang [ref] wrote:
>>
>> On 2021/3/4 4:58 下午, Yongji Xie wrote:
>>> On Thu, Mar 4, 2021 at 2:59 PM Jason Wang [ref] wrote:
>>>> On 2021/2/23 7:50 下午, Xie Yongji wrote:
>>>>> This patch introduces a workqueue to support injecting
>>>>> virtqueue's interrupt asynchronously. This is mainly
>>>>> for performance considerations which makes sure the push()
>>>>> and pop() for used vring can be asynchronous.
>>>> Do you have pref numbers for this patch?
>>>>
>>> No, I can do some tests for it if needed.
>>>
>>> Another problem is the VIRTIO_RING_F_EVENT_IDX feature will be useless
>>> if we call irq callback in ioctl context. Something like:
>>>
>>> virtqueue_push();
>>> virtio_notify();
>>>       ioctl()
>>> -------------------------------------------------
>>>           irq_cb()
>>>               virtqueue_get_buf()
>>>
>>> The used vring is always empty each time we call virtqueue_push() in
>>> userspace. Not sure if it is what we expected.
>>
>> I'm not sure I get the issue.
>>
>> THe used ring should be filled by virtqueue_push() which is done by
>> userspace before?
>>
> After userspace call virtqueue_push(), it always call virtio_notify()
> immediately. In traditional VM (vhost-vdpa) cases, virtio_notify()
> will inject an irq to VM and return, then vcpu thread will call
> interrupt handler. But in container (virtio-vdpa) cases,
> virtio_notify() will call interrupt handler directly. So it looks like
> we have to optimize the virtio-vdpa cases. But one problem is we don't
> know whether we are in the VM user case or container user case.


Yes, but I still don't get why used ring is empty after the ioctl()? Used ring does not use bounce page so it should be visible to the kernel driver. What did I miss :) ?

Thanks



>
> Thanks,
> Yongji
>

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
```
