virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: David Edmondson <david.edmondson@oracle.com>
To: Feng Liu <feliu@nvidia.com>, virtualization@lists.linux-foundation.org
Cc: Bodong Wang <bodong@nvidia.com>, Jiri Pirko <jiri@nvidia.com>,
	Gavin Li <gavinl@nvidia.com>,
	"Michael S . Tsirkin" <mst@redhat.com>
Subject: Re: [PATCH 2/3] virtio_ring: Avoid using inline for small functions
Date: Tue, 07 Mar 2023 09:11:35 +0000	[thread overview]
Message-ID: <m2wn3tylh4.fsf@oracle.com> (raw)
In-Reply-To: <20230307035705.4479-3-feliu@nvidia.com>

Feng Liu via Virtualization <virtualization@lists.linux-foundation.org>
writes:

> According to kernel coding style [1], defining inline functions is not
> necessary and beneficial for simple functions. Hence clean up the code
> by removing the inline keyword.
>
> It is verified with GCC 12.2.0, the generated code with/without inline
> is same. Additionally tested with pktgen and iperf, and verified the
> result, the pps test results are the same in the cases of with/without
> inline.
>
> Iperf and pps of pktgen for virtio-net didn't change before and after
> the change.
>
> [1]
> https://www.kernel.org/doc/html/v6.2-rc3/process/coding-style.html#the-inline-disease
>
> Signed-off-by: Feng Liu <feliu@nvidia.com>
> Reviewed-by: Jiri Pirko <jiri@nvidia.com>
> Reviewed-by: Parav Pandit <parav@nvidia.com>
> Reviewed-by: Gavin Li <gavinl@nvidia.com>
> Reviewed-by: Bodong Wang <bodong@nvidia.com>

Reviewed-by: David Edmondson <david.edmondson@oracle.com>

> ---
>  drivers/virtio/virtio_ring.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
> index 41144b5246a8..806cc44eae64 100644
> --- a/drivers/virtio/virtio_ring.c
> +++ b/drivers/virtio/virtio_ring.c
> @@ -233,7 +233,7 @@ static void vring_free(struct virtqueue *_vq);
>  
>  #define to_vvq(_vq) container_of(_vq, struct vring_virtqueue, vq)
>  
> -static inline bool virtqueue_use_indirect(struct vring_virtqueue *vq,
> +static bool virtqueue_use_indirect(struct vring_virtqueue *vq,
>  					  unsigned int total_sg)
>  {
>  	/*
> @@ -349,7 +349,7 @@ static void vring_free_queue(struct virtio_device *vdev, size_t size,
>   * making all of the arch DMA ops work on the vring device itself
>   * is a mess.
>   */
> -static inline struct device *vring_dma_dev(const struct vring_virtqueue *vq)
> +static struct device *vring_dma_dev(const struct vring_virtqueue *vq)
>  {
>  	return vq->dma_dev;
>  }
> @@ -784,7 +784,7 @@ static void detach_buf_split(struct vring_virtqueue *vq, unsigned int head,
>  	}
>  }
>  
> -static inline bool more_used_split(const struct vring_virtqueue *vq)
> +static inline more_used_split(const struct vring_virtqueue *vq)
>  {
>  	return vq->last_used_idx != virtio16_to_cpu(vq->vq.vdev,
>  			vq->split.vring.used->idx);
> @@ -1172,12 +1172,12 @@ static int virtqueue_resize_split(struct virtqueue *_vq, u32 num)
>  /*
>   * Packed ring specific functions - *_packed().
>   */
> -static inline bool packed_used_wrap_counter(u16 last_used_idx)
> +static bool packed_used_wrap_counter(u16 last_used_idx)
>  {
>  	return !!(last_used_idx & (1 << VRING_PACKED_EVENT_F_WRAP_CTR));
>  }
>  
> -static inline u16 packed_last_used(u16 last_used_idx)
> +static u16 packed_last_used(u16 last_used_idx)
>  {
>  	return last_used_idx & ~(-(1 << VRING_PACKED_EVENT_F_WRAP_CTR));
>  }
> @@ -1612,7 +1612,7 @@ static inline bool is_used_desc_packed(const struct vring_virtqueue *vq,
>  	return avail == used && used == used_wrap_counter;
>  }
>  
> -static inline bool more_used_packed(const struct vring_virtqueue *vq)
> +static bool more_used_packed(const struct vring_virtqueue *vq)
>  {
>  	u16 last_used;
>  	u16 last_used_idx;
> -- 
> 2.34.1
>
> _______________________________________________
> Virtualization mailing list
> Virtualization@lists.linux-foundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/virtualization
-- 
Would you offer your throat to the wolf with the red roses?
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

  reply	other threads:[~2023-03-07  9:11 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-07  3:57 [PATCH 0/3] virtio_ring: Clean up code for virtio ring and pci Feng Liu via Virtualization
2023-03-07  3:57 ` [PATCH 1/3] virtio_pci_modern: Remove unnecessary num zero check Feng Liu via Virtualization
2023-03-07  9:10   ` David Edmondson
2023-03-08  5:52   ` Jason Wang
2023-03-08  6:57     ` Michael S. Tsirkin
2023-03-08 14:23   ` Michael S. Tsirkin
2023-03-08 14:33     ` Feng Liu via Virtualization
2023-03-07  3:57 ` [PATCH 2/3] virtio_ring: Avoid using inline for small functions Feng Liu via Virtualization
2023-03-07  9:11   ` David Edmondson [this message]
2023-03-08  5:55   ` Jason Wang
2023-03-07  3:57 ` [PATCH 3/3] virtio_ring: Use const to annotate read-only pointer params Feng Liu via Virtualization
2023-03-07  9:14   ` David Edmondson
2023-03-07 21:17     ` Feng Liu via Virtualization
2023-03-08 14:13       ` Michael S. Tsirkin
2023-03-08 15:59         ` Feng Liu via Virtualization
2023-03-08 16:25           ` Michael S. Tsirkin
2023-03-08 16:44             ` Feng Liu via Virtualization
2023-03-08 16:49             ` Michael S. Tsirkin
2023-03-08 17:26               ` Feng Liu via Virtualization
2023-03-08  5:58   ` Jason Wang
2023-03-08 14:07     ` Feng Liu via Virtualization
2023-03-08 14:13       ` Feng Liu via Virtualization
2023-03-08 14:16       ` Michael S. Tsirkin
2023-03-08 14:19         ` Feng Liu via Virtualization
2023-03-08 14:28           ` Michael S. Tsirkin
2023-03-08 14:40             ` Feng Liu via Virtualization
2023-03-08 14:47               ` Michael S. Tsirkin
2023-03-08 15:47                 ` Feng Liu via Virtualization
     [not found]             ` <ZAmlwyVfz+IK1b6T@nanopsycho>
2023-03-09 14:27               ` Michael S. Tsirkin
2023-03-08  6:59   ` 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=m2wn3tylh4.fsf@oracle.com \
    --to=david.edmondson@oracle.com \
    --cc=bodong@nvidia.com \
    --cc=feliu@nvidia.com \
    --cc=gavinl@nvidia.com \
    --cc=jiri@nvidia.com \
    --cc=mst@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).