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: "Michael S . Tsirkin" <mst@redhat.com>,
	Jiri Pirko <jiri@nvidia.com>, Bodong Wang <bodong@nvidia.com>,
	Gavin Li <gavinl@nvidia.com>
Subject: Re: [PATCH v2 2/3] virtio_ring: Avoid using inline for small functions
Date: Fri, 17 Mar 2023 09:16:57 +0000	[thread overview]
Message-ID: <m2ttyjhh4m.fsf@oracle.com> (raw)
In-Reply-To: <20230315185458.11638-3-feliu@nvidia.com>

Feng Liu <feliu@nvidia.com> writes:

> Remove the inline keyword, according to kernel coding style [1], defining
> inline functions is not necessary for samll functions.
>
> It is verified with GCC 12.2.0, the generated code with/without inline
> is the same. Additionally tested with kernel pktgen and iperf, and
> verified the result, pps of the results are the same in the cases of
> with/without inline.
>
> [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: David Edmondson <david.edmondson@oracle.com>

> ---
>  drivers/virtio/virtio_ring.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
> index 41144b5246a8..a26fab91c59f 100644
> --- a/drivers/virtio/virtio_ring.c
> +++ b/drivers/virtio/virtio_ring.c
> @@ -233,8 +233,8 @@ 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,
> -					  unsigned int total_sg)
> +static bool virtqueue_use_indirect(struct vring_virtqueue *vq,
> +				   unsigned int total_sg)
>  {
>  	/*
>  	 * If the host supports indirect descriptor tables, and we have multiple
> @@ -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 bool 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
-- 
But are you safe Miss Gradenko?
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

  parent reply	other threads:[~2023-03-17  9:17 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-15 18:54 [PATCH v2 0/3] virtio_ring: Clean up code for virtio ring and pci Feng Liu via Virtualization
2023-03-15 18:54 ` [PATCH v2 1/3] virtio_ring: Allow non power of 2 sizes for packed virtqueue Feng Liu via Virtualization
2023-03-17  3:16   ` Jason Wang
2023-03-30 18:21     ` Feng Liu via Virtualization
2023-03-17  9:16   ` David Edmondson
2023-03-15 18:54 ` [PATCH v2 2/3] virtio_ring: Avoid using inline for small functions Feng Liu via Virtualization
2023-03-17  3:16   ` Jason Wang
2023-03-30 18:22     ` Feng Liu via Virtualization
2023-03-17  9:16   ` David Edmondson [this message]
2023-03-15 18:54 ` [PATCH v2 3/3] virtio_ring: Use const to annotate read-only pointer params Feng Liu via Virtualization
2023-03-17  3:17   ` Jason Wang
2023-03-30 18:22     ` Feng Liu via Virtualization
2023-03-30 20:27       ` Michael S. Tsirkin
2023-03-30 23:46         ` Feng Liu via Virtualization
2023-03-17  9:20   ` David Edmondson
2023-03-31  4:20 ` [PATCH v2 0/3] virtio_ring: Clean up code for virtio ring and pci Xuan Zhuo
  -- strict thread matches above, loose matches on Subject: below --
2023-03-10  5:34 Feng Liu via Virtualization
2023-03-10  5:34 ` [PATCH v2 2/3] virtio_ring: Avoid using inline for small functions Feng Liu via Virtualization

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=m2ttyjhh4m.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).