From: Jason Wang <jasowang@redhat.com> To: Xie Yongji <xieyongji@bytedance.com> Cc: linux-kernel@vger.kernel.org, tglx@linutronix.de, virtualization@lists.linux-foundation.org, hch@lst.de, mst@redhat.com Subject: Re: [PATCH v3 09/11] vduse: Signal interrupt's eventfd directly in vhost-vdpa case Date: Thu, 16 Mar 2023 17:30:36 +0800 [thread overview] Message-ID: <CACGkMEsaeAJbTzx0M3DJzt=dwWyWvX79L1tapfZ1O-AKyG73Mw@mail.gmail.com> (raw) In-Reply-To: <20230228094110.37-10-xieyongji@bytedance.com> On Tue, Feb 28, 2023 at 5:42 PM Xie Yongji <xieyongji@bytedance.com> wrote: > > Now the vdpa callback will associate an eventfd in > vhost-vdpa case. I'd suggest avoiding mentioning drivers since vDPA parents should not know which vDPA driver is bound. We could say "signal vq trigger eventfd directly if possible"? With those tweaked. Acked-by: Jason Wang <jasowang@redhat.com> Thanks > For performance reasons, VDUSE can > signal it directly during irq injection. > > Signed-off-by: Xie Yongji <xieyongji@bytedance.com> > --- > drivers/vdpa/vdpa_user/vduse_dev.c | 27 +++++++++++++++++++++++---- > 1 file changed, 23 insertions(+), 4 deletions(-) > > diff --git a/drivers/vdpa/vdpa_user/vduse_dev.c b/drivers/vdpa/vdpa_user/vduse_dev.c > index 869cc7860d82..56f3c2480c2a 100644 > --- a/drivers/vdpa/vdpa_user/vduse_dev.c > +++ b/drivers/vdpa/vdpa_user/vduse_dev.c > @@ -461,6 +461,7 @@ static void vduse_dev_reset(struct vduse_dev *dev) > spin_lock(&vq->irq_lock); > vq->cb.callback = NULL; > vq->cb.private = NULL; > + vq->cb.irq_ctx = NULL; > spin_unlock(&vq->irq_lock); > flush_work(&vq->inject); > flush_work(&vq->kick); > @@ -526,6 +527,7 @@ static void vduse_vdpa_set_vq_cb(struct vdpa_device *vdpa, u16 idx, > spin_lock(&vq->irq_lock); > vq->cb.callback = cb->callback; > vq->cb.private = cb->private; > + vq->cb.irq_ctx = cb->irq_ctx; > spin_unlock(&vq->irq_lock); > } > > @@ -1020,6 +1022,20 @@ static void vduse_vq_irq_inject(struct work_struct *work) > spin_unlock_irq(&vq->irq_lock); > } > > +static bool vduse_vq_signal_irqfd(struct vduse_virtqueue *vq) > +{ > + bool signal = false; > + > + spin_lock_irq(&vq->irq_lock); > + if (vq->ready && vq->cb.irq_ctx) { > + eventfd_signal(vq->cb.irq_ctx, 1); > + signal = true; > + } > + spin_unlock_irq(&vq->irq_lock); > + > + return signal; > +} > + > static int vduse_dev_queue_irq_work(struct vduse_dev *dev, > struct work_struct *irq_work, > int irq_effective_cpu) > @@ -1322,11 +1338,14 @@ static long vduse_dev_ioctl(struct file *file, unsigned int cmd, > if (index >= dev->vq_num) > break; > > + ret = 0; > index = array_index_nospec(index, dev->vq_num); > - > - vduse_vq_update_effective_cpu(dev->vqs[index]); > - ret = vduse_dev_queue_irq_work(dev, &dev->vqs[index]->inject, > - dev->vqs[index]->irq_effective_cpu); > + if (!vduse_vq_signal_irqfd(dev->vqs[index])) { > + vduse_vq_update_effective_cpu(dev->vqs[index]); > + ret = vduse_dev_queue_irq_work(dev, > + &dev->vqs[index]->inject, > + dev->vqs[index]->irq_effective_cpu); > + } > break; > } > case VDUSE_IOTLB_REG_UMEM: { > -- > 2.20.1 > _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
WARNING: multiple messages have this Message-ID (diff)
From: Jason Wang <jasowang@redhat.com> To: Xie Yongji <xieyongji@bytedance.com> Cc: mst@redhat.com, tglx@linutronix.de, hch@lst.de, virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 09/11] vduse: Signal interrupt's eventfd directly in vhost-vdpa case Date: Thu, 16 Mar 2023 17:30:36 +0800 [thread overview] Message-ID: <CACGkMEsaeAJbTzx0M3DJzt=dwWyWvX79L1tapfZ1O-AKyG73Mw@mail.gmail.com> (raw) In-Reply-To: <20230228094110.37-10-xieyongji@bytedance.com> On Tue, Feb 28, 2023 at 5:42 PM Xie Yongji <xieyongji@bytedance.com> wrote: > > Now the vdpa callback will associate an eventfd in > vhost-vdpa case. I'd suggest avoiding mentioning drivers since vDPA parents should not know which vDPA driver is bound. We could say "signal vq trigger eventfd directly if possible"? With those tweaked. Acked-by: Jason Wang <jasowang@redhat.com> Thanks > For performance reasons, VDUSE can > signal it directly during irq injection. > > Signed-off-by: Xie Yongji <xieyongji@bytedance.com> > --- > drivers/vdpa/vdpa_user/vduse_dev.c | 27 +++++++++++++++++++++++---- > 1 file changed, 23 insertions(+), 4 deletions(-) > > diff --git a/drivers/vdpa/vdpa_user/vduse_dev.c b/drivers/vdpa/vdpa_user/vduse_dev.c > index 869cc7860d82..56f3c2480c2a 100644 > --- a/drivers/vdpa/vdpa_user/vduse_dev.c > +++ b/drivers/vdpa/vdpa_user/vduse_dev.c > @@ -461,6 +461,7 @@ static void vduse_dev_reset(struct vduse_dev *dev) > spin_lock(&vq->irq_lock); > vq->cb.callback = NULL; > vq->cb.private = NULL; > + vq->cb.irq_ctx = NULL; > spin_unlock(&vq->irq_lock); > flush_work(&vq->inject); > flush_work(&vq->kick); > @@ -526,6 +527,7 @@ static void vduse_vdpa_set_vq_cb(struct vdpa_device *vdpa, u16 idx, > spin_lock(&vq->irq_lock); > vq->cb.callback = cb->callback; > vq->cb.private = cb->private; > + vq->cb.irq_ctx = cb->irq_ctx; > spin_unlock(&vq->irq_lock); > } > > @@ -1020,6 +1022,20 @@ static void vduse_vq_irq_inject(struct work_struct *work) > spin_unlock_irq(&vq->irq_lock); > } > > +static bool vduse_vq_signal_irqfd(struct vduse_virtqueue *vq) > +{ > + bool signal = false; > + > + spin_lock_irq(&vq->irq_lock); > + if (vq->ready && vq->cb.irq_ctx) { > + eventfd_signal(vq->cb.irq_ctx, 1); > + signal = true; > + } > + spin_unlock_irq(&vq->irq_lock); > + > + return signal; > +} > + > static int vduse_dev_queue_irq_work(struct vduse_dev *dev, > struct work_struct *irq_work, > int irq_effective_cpu) > @@ -1322,11 +1338,14 @@ static long vduse_dev_ioctl(struct file *file, unsigned int cmd, > if (index >= dev->vq_num) > break; > > + ret = 0; > index = array_index_nospec(index, dev->vq_num); > - > - vduse_vq_update_effective_cpu(dev->vqs[index]); > - ret = vduse_dev_queue_irq_work(dev, &dev->vqs[index]->inject, > - dev->vqs[index]->irq_effective_cpu); > + if (!vduse_vq_signal_irqfd(dev->vqs[index])) { > + vduse_vq_update_effective_cpu(dev->vqs[index]); > + ret = vduse_dev_queue_irq_work(dev, > + &dev->vqs[index]->inject, > + dev->vqs[index]->irq_effective_cpu); > + } > break; > } > case VDUSE_IOTLB_REG_UMEM: { > -- > 2.20.1 >
next prev parent reply other threads:[~2023-03-16 9:30 UTC|newest] Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-02-28 9:40 [PATCH v3 00/11] VDUSE: Improve performance Xie Yongji 2023-02-28 9:41 ` [PATCH v3 01/11] lib/group_cpus: Export group_cpus_evenly() Xie Yongji 2023-03-10 8:51 ` Michael S. Tsirkin 2023-03-10 8:51 ` Michael S. Tsirkin 2023-03-16 9:31 ` Jason Wang 2023-03-16 9:31 ` Jason Wang 2023-02-28 9:41 ` [PATCH v3 02/11] vdpa: Add set/get_vq_affinity callbacks in vdpa_config_ops Xie Yongji 2023-03-16 3:27 ` Jason Wang 2023-03-16 3:27 ` Jason Wang 2023-03-17 7:10 ` Yongji Xie 2023-02-28 9:41 ` [PATCH v3 03/11] vdpa: Add set_irq_affinity callback " Xie Yongji 2023-03-16 4:02 ` Jason Wang 2023-03-16 4:02 ` Jason Wang 2023-03-17 7:44 ` Yongji Xie 2023-03-20 9:31 ` Jason Wang 2023-03-20 9:31 ` Jason Wang 2023-03-20 11:17 ` Yongji Xie 2023-02-28 9:41 ` [PATCH v3 04/11] vduse: Refactor allocation for vduse virtqueues Xie Yongji 2023-02-28 9:41 ` [PATCH v3 05/11] vduse: Support automatic irq callback affinity Xie Yongji 2023-02-28 11:12 ` kernel test robot 2023-02-28 11:12 ` kernel test robot 2023-03-01 1:18 ` kernel test robot 2023-03-01 1:18 ` kernel test robot 2023-03-16 9:03 ` Jason Wang 2023-03-16 9:03 ` Jason Wang 2023-03-17 7:04 ` Yongji Xie 2023-02-28 9:41 ` [PATCH v3 06/11] vduse: Support set/get_vq_affinity callbacks Xie Yongji 2023-02-28 9:41 ` [PATCH v3 07/11] vduse: Add sysfs interface for irq callback affinity Xie Yongji 2023-02-28 9:41 ` [PATCH v3 08/11] vdpa: Add eventfd for the vdpa callback Xie Yongji 2023-03-16 9:25 ` Jason Wang 2023-03-16 9:25 ` Jason Wang 2023-03-16 9:40 ` Jason Wang 2023-03-16 9:40 ` Jason Wang 2023-03-17 6:57 ` Yongji Xie 2023-02-28 9:41 ` [PATCH v3 09/11] vduse: Signal interrupt's eventfd directly in vhost-vdpa case Xie Yongji 2023-03-16 9:30 ` Jason Wang [this message] 2023-03-16 9:30 ` Jason Wang 2023-03-17 7:01 ` Yongji Xie 2023-02-28 9:41 ` [PATCH v3 10/11] vduse: Delay iova domain creation Xie Yongji 2023-02-28 9:41 ` [PATCH v3 11/11] vduse: Support specifying bounce buffer size via sysfs Xie Yongji 2023-03-10 8:49 ` [PATCH v3 00/11] VDUSE: Improve performance Michael S. Tsirkin 2023-03-10 8:49 ` Michael S. Tsirkin 2023-03-10 9:41 ` Jason Wang 2023-03-10 9:41 ` Jason Wang
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to='CACGkMEsaeAJbTzx0M3DJzt=dwWyWvX79L1tapfZ1O-AKyG73Mw@mail.gmail.com' \ --to=jasowang@redhat.com \ --cc=hch@lst.de \ --cc=linux-kernel@vger.kernel.org \ --cc=mst@redhat.com \ --cc=tglx@linutronix.de \ --cc=virtualization@lists.linux-foundation.org \ --cc=xieyongji@bytedance.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.