* [PATCH] virtio_ring: remove unnecessary to_vvq call in virtqueue_disable_cb_packed
@ 2022-06-22 7:50 Deming Wang
2022-06-22 12:15 ` Michael S. Tsirkin
0 siblings, 1 reply; 3+ messages in thread
From: Deming Wang @ 2022-06-22 7:50 UTC (permalink / raw)
To: mst, jasowang; +Cc: virtualization, linux-kernel, Deming Wang
It passes '_vq' to virtqueue_use_indirect(), which still calls
to_vvq to get 'vq', let's directly pass 'vq'. It can avoid
unnecessary call of to_vvq in hot path.
Signed-off-by: Deming Wang <wangdeming@inspur.com>
---
drivers/virtio/virtio_ring.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
index 13a7348cedff..af2b7785ed77 100644
--- a/drivers/virtio/virtio_ring.c
+++ b/drivers/virtio/virtio_ring.c
@@ -1475,10 +1475,8 @@ static void *virtqueue_get_buf_ctx_packed(struct virtqueue *_vq,
return ret;
}
-static void virtqueue_disable_cb_packed(struct virtqueue *_vq)
+static void virtqueue_disable_cb_packed(struct vring_virtqueue *vq)
{
- struct vring_virtqueue *vq = to_vvq(_vq);
-
if (vq->packed.event_flags_shadow != VRING_PACKED_EVENT_FLAG_DISABLE) {
vq->packed.event_flags_shadow = VRING_PACKED_EVENT_FLAG_DISABLE;
vq->packed.vring.driver->flags =
@@ -2007,7 +2005,7 @@ void virtqueue_disable_cb(struct virtqueue *_vq)
return;
if (vq->packed_ring)
- virtqueue_disable_cb_packed(_vq);
+ virtqueue_disable_cb_packed(vq);
else
virtqueue_disable_cb_split(_vq);
}
--
2.27.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] virtio_ring: remove unnecessary to_vvq call in virtqueue_disable_cb_packed
2022-06-22 7:50 [PATCH] virtio_ring: remove unnecessary to_vvq call in virtqueue_disable_cb_packed Deming Wang
@ 2022-06-22 12:15 ` Michael S. Tsirkin
2022-06-23 0:21 ` 答复: " tomorrow Wang (王德明)
0 siblings, 1 reply; 3+ messages in thread
From: Michael S. Tsirkin @ 2022-06-22 12:15 UTC (permalink / raw)
To: Deming Wang; +Cc: jasowang, virtualization, linux-kernel
On Wed, Jun 22, 2022 at 03:50:52AM -0400, Deming Wang wrote:
> It passes '_vq' to virtqueue_use_indirect(), which still calls
> to_vvq to get 'vq', let's directly pass 'vq'. It can avoid
> unnecessary call of to_vvq in hot path.
>
> Signed-off-by: Deming Wang <wangdeming@inspur.com>
I do not see the point of any of these patches. Sorry.
If this is supposed to be an optimization, post some numbers pls.
> ---
> drivers/virtio/virtio_ring.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
> index 13a7348cedff..af2b7785ed77 100644
> --- a/drivers/virtio/virtio_ring.c
> +++ b/drivers/virtio/virtio_ring.c
> @@ -1475,10 +1475,8 @@ static void *virtqueue_get_buf_ctx_packed(struct virtqueue *_vq,
> return ret;
> }
>
> -static void virtqueue_disable_cb_packed(struct virtqueue *_vq)
> +static void virtqueue_disable_cb_packed(struct vring_virtqueue *vq)
> {
> - struct vring_virtqueue *vq = to_vvq(_vq);
> -
> if (vq->packed.event_flags_shadow != VRING_PACKED_EVENT_FLAG_DISABLE) {
> vq->packed.event_flags_shadow = VRING_PACKED_EVENT_FLAG_DISABLE;
> vq->packed.vring.driver->flags =
> @@ -2007,7 +2005,7 @@ void virtqueue_disable_cb(struct virtqueue *_vq)
> return;
>
> if (vq->packed_ring)
> - virtqueue_disable_cb_packed(_vq);
> + virtqueue_disable_cb_packed(vq);
> else
> virtqueue_disable_cb_split(_vq);
> }
> --
> 2.27.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* 答复: [PATCH] virtio_ring: remove unnecessary to_vvq call in virtqueue_disable_cb_packed
2022-06-22 12:15 ` Michael S. Tsirkin
@ 2022-06-23 0:21 ` tomorrow Wang (王德明)
0 siblings, 0 replies; 3+ messages in thread
From: tomorrow Wang (王德明) @ 2022-06-23 0:21 UTC (permalink / raw)
To: mst@redhat.com
Cc: jasowang@redhat.com, virtualization@lists.linux-foundation.org,
linux-kernel@vger.kernel.org
[-- Attachment #1: Type: text/plain, Size: 1775 bytes --]
Hi,
The 35c51e093d956f6d058e193711c8d424817a44a9 patch has maked a similar
change
> Re: [PATCH] virtio_ring: remove unnecessary to_vvq call in
> virtqueue_disable_cb_packed
>
> On Wed, Jun 22, 2022 at 03:50:52AM -0400, Deming Wang wrote:
> > It passes '_vq' to virtqueue_use_indirect(), which still calls to_vvq
> > to get 'vq', let's directly pass 'vq'. It can avoid unnecessary call
> > of to_vvq in hot path.
> >
> > Signed-off-by: Deming Wang <wangdeming@inspur.com>
>
> I do not see the point of any of these patches. Sorry.
> If this is supposed to be an optimization, post some numbers pls.
>
>
> > ---
> > drivers/virtio/virtio_ring.c | 6 ++----
> > 1 file changed, 2 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/virtio/virtio_ring.c
> > b/drivers/virtio/virtio_ring.c index 13a7348cedff..af2b7785ed77 100644
> > --- a/drivers/virtio/virtio_ring.c
> > +++ b/drivers/virtio/virtio_ring.c
> > @@ -1475,10 +1475,8 @@ static void
> *virtqueue_get_buf_ctx_packed(struct virtqueue *_vq,
> > return ret;
> > }
> >
> > -static void virtqueue_disable_cb_packed(struct virtqueue *_vq)
> > +static void virtqueue_disable_cb_packed(struct vring_virtqueue *vq)
> > {
> > - struct vring_virtqueue *vq = to_vvq(_vq);
> > -
> > if (vq->packed.event_flags_shadow !=
> VRING_PACKED_EVENT_FLAG_DISABLE) {
> > vq->packed.event_flags_shadow =
> VRING_PACKED_EVENT_FLAG_DISABLE;
> > vq->packed.vring.driver->flags =
> > @@ -2007,7 +2005,7 @@ void virtqueue_disable_cb(struct virtqueue *_vq)
> > return;
> >
> > if (vq->packed_ring)
> > - virtqueue_disable_cb_packed(_vq);
> > + virtqueue_disable_cb_packed(vq);
> > else
> > virtqueue_disable_cb_split(_vq);
> > }
> > --
> > 2.27.0
[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 3780 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-06-23 0:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-22 7:50 [PATCH] virtio_ring: remove unnecessary to_vvq call in virtqueue_disable_cb_packed Deming Wang
2022-06-22 12:15 ` Michael S. Tsirkin
2022-06-23 0:21 ` 答复: " tomorrow Wang (王德明)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox