From: "Michael S. Tsirkin" <mst@redhat.com>
To: Zhu Lingshan <lingshan.zhu@intel.com>
Cc: shahafs@mellanox.com, parav@mellanox.com, kvm@vger.kernel.org,
netdev@vger.kernel.org,
virtualization@lists.linux-foundation.org, eli@mellanox.com
Subject: Re: [PATCH 2/2] vhost_vdpa: unified set_vq_irq() and update_vq_irq()
Date: Wed, 5 Aug 2020 07:53:41 -0400 [thread overview]
Message-ID: <20200805075253-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20200805113832.3755-1-lingshan.zhu@intel.com>
On Wed, Aug 05, 2020 at 07:38:32PM +0800, Zhu Lingshan wrote:
> This commit merge vhost_vdpa_update_vq_irq() logics into
> vhost_vdpa_setup_vq_irq(), so that code are unified.
>
> In vhost_vdpa_setup_vq_irq(), added checks for the existence
> for get_vq_irq().
>
> Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com>
which commit should I squash this into?
commit f8e695e9dbd88464bc3d1f01769229dedf8f30d6
Author: Zhu Lingshan <lingshan.zhu@intel.com>
Date: Fri Jul 31 14:55:31 2020 +0800
vhost_vdpa: implement IRQ offloading in vhost_vdpa
this one?
> ---
> drivers/vhost/vdpa.c | 28 ++++++----------------------
> 1 file changed, 6 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c
> index 26f166a8192e..044e1f54582a 100644
> --- a/drivers/vhost/vdpa.c
> +++ b/drivers/vhost/vdpa.c
> @@ -122,8 +122,12 @@ static void vhost_vdpa_setup_vq_irq(struct vhost_vdpa *v, u16 qid)
> struct vdpa_device *vdpa = v->vdpa;
> int ret, irq;
>
> - spin_lock(&vq->call_ctx.ctx_lock);
> + if (!ops->get_vq_irq)
> + return;
> +
> irq = ops->get_vq_irq(vdpa, qid);
> + spin_lock(&vq->call_ctx.ctx_lock);
> + irq_bypass_unregister_producer(&vq->call_ctx.producer);
> if (!vq->call_ctx.ctx || irq < 0) {
> spin_unlock(&vq->call_ctx.ctx_lock);
> return;
> @@ -144,26 +148,6 @@ static void vhost_vdpa_unsetup_vq_irq(struct vhost_vdpa *v, u16 qid)
> spin_unlock(&vq->call_ctx.ctx_lock);
> }
>
> -static void vhost_vdpa_update_vq_irq(struct vhost_virtqueue *vq)
> -{
> - spin_lock(&vq->call_ctx.ctx_lock);
> - /*
> - * if it has a non-zero irq, means there is a
> - * previsouly registered irq_bypass_producer,
> - * we should update it when ctx (its token)
> - * changes.
> - */
> - if (!vq->call_ctx.producer.irq) {
> - spin_unlock(&vq->call_ctx.ctx_lock);
> - return;
> - }
> -
> - irq_bypass_unregister_producer(&vq->call_ctx.producer);
> - vq->call_ctx.producer.token = vq->call_ctx.ctx;
> - irq_bypass_register_producer(&vq->call_ctx.producer);
> - spin_unlock(&vq->call_ctx.ctx_lock);
> -}
> -
> static void vhost_vdpa_reset(struct vhost_vdpa *v)
> {
> struct vdpa_device *vdpa = v->vdpa;
> @@ -452,7 +436,7 @@ static long vhost_vdpa_vring_ioctl(struct vhost_vdpa *v, unsigned int cmd,
> cb.private = NULL;
> }
> ops->set_vq_cb(vdpa, idx, &cb);
> - vhost_vdpa_update_vq_irq(vq);
> + vhost_vdpa_setup_vq_irq(v, idx);
> break;
>
> case VHOST_SET_VRING_NUM:
> --
> 2.18.4
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
WARNING: multiple messages have this Message-ID (diff)
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Zhu Lingshan <lingshan.zhu@intel.com>
Cc: jasowang@redhat.com, virtualization@lists.linux-foundation.org,
netdev@vger.kernel.org, kvm@vger.kernel.org, eli@mellanox.com,
shahafs@mellanox.com, parav@mellanox.com
Subject: Re: [PATCH 2/2] vhost_vdpa: unified set_vq_irq() and update_vq_irq()
Date: Wed, 5 Aug 2020 07:53:41 -0400 [thread overview]
Message-ID: <20200805075253-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20200805113832.3755-1-lingshan.zhu@intel.com>
On Wed, Aug 05, 2020 at 07:38:32PM +0800, Zhu Lingshan wrote:
> This commit merge vhost_vdpa_update_vq_irq() logics into
> vhost_vdpa_setup_vq_irq(), so that code are unified.
>
> In vhost_vdpa_setup_vq_irq(), added checks for the existence
> for get_vq_irq().
>
> Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com>
which commit should I squash this into?
commit f8e695e9dbd88464bc3d1f01769229dedf8f30d6
Author: Zhu Lingshan <lingshan.zhu@intel.com>
Date: Fri Jul 31 14:55:31 2020 +0800
vhost_vdpa: implement IRQ offloading in vhost_vdpa
this one?
> ---
> drivers/vhost/vdpa.c | 28 ++++++----------------------
> 1 file changed, 6 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c
> index 26f166a8192e..044e1f54582a 100644
> --- a/drivers/vhost/vdpa.c
> +++ b/drivers/vhost/vdpa.c
> @@ -122,8 +122,12 @@ static void vhost_vdpa_setup_vq_irq(struct vhost_vdpa *v, u16 qid)
> struct vdpa_device *vdpa = v->vdpa;
> int ret, irq;
>
> - spin_lock(&vq->call_ctx.ctx_lock);
> + if (!ops->get_vq_irq)
> + return;
> +
> irq = ops->get_vq_irq(vdpa, qid);
> + spin_lock(&vq->call_ctx.ctx_lock);
> + irq_bypass_unregister_producer(&vq->call_ctx.producer);
> if (!vq->call_ctx.ctx || irq < 0) {
> spin_unlock(&vq->call_ctx.ctx_lock);
> return;
> @@ -144,26 +148,6 @@ static void vhost_vdpa_unsetup_vq_irq(struct vhost_vdpa *v, u16 qid)
> spin_unlock(&vq->call_ctx.ctx_lock);
> }
>
> -static void vhost_vdpa_update_vq_irq(struct vhost_virtqueue *vq)
> -{
> - spin_lock(&vq->call_ctx.ctx_lock);
> - /*
> - * if it has a non-zero irq, means there is a
> - * previsouly registered irq_bypass_producer,
> - * we should update it when ctx (its token)
> - * changes.
> - */
> - if (!vq->call_ctx.producer.irq) {
> - spin_unlock(&vq->call_ctx.ctx_lock);
> - return;
> - }
> -
> - irq_bypass_unregister_producer(&vq->call_ctx.producer);
> - vq->call_ctx.producer.token = vq->call_ctx.ctx;
> - irq_bypass_register_producer(&vq->call_ctx.producer);
> - spin_unlock(&vq->call_ctx.ctx_lock);
> -}
> -
> static void vhost_vdpa_reset(struct vhost_vdpa *v)
> {
> struct vdpa_device *vdpa = v->vdpa;
> @@ -452,7 +436,7 @@ static long vhost_vdpa_vring_ioctl(struct vhost_vdpa *v, unsigned int cmd,
> cb.private = NULL;
> }
> ops->set_vq_cb(vdpa, idx, &cb);
> - vhost_vdpa_update_vq_irq(vq);
> + vhost_vdpa_setup_vq_irq(v, idx);
> break;
>
> case VHOST_SET_VRING_NUM:
> --
> 2.18.4
next prev parent reply other threads:[~2020-08-05 11:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-05 11:38 [PATCH 2/2] vhost_vdpa: unified set_vq_irq() and update_vq_irq() Zhu Lingshan
2020-08-05 11:53 ` Michael S. Tsirkin [this message]
2020-08-05 11:53 ` Michael S. Tsirkin
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=20200805075253-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=eli@mellanox.com \
--cc=kvm@vger.kernel.org \
--cc=lingshan.zhu@intel.com \
--cc=netdev@vger.kernel.org \
--cc=parav@mellanox.com \
--cc=shahafs@mellanox.com \
--cc=virtualization@lists.linux-foundation.org \
/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: link
Be 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.