kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] vringh small unused functions
@ 2025-06-17  0:18 linux
  2025-06-17  0:18 ` [PATCH v2 1/2] vhost: vringh: Remove unused iotlb functions linux
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: linux @ 2025-06-17  0:18 UTC (permalink / raw)
  To: mst, horms, jasowang, eperezma, xuanzhuo
  Cc: kvm, virtualization, netdev, linux-kernel, Dr. David Alan Gilbert

From: "Dr. David Alan Gilbert" <linux@treblig.org>

Hi,
  The following pair of patches remove a bunch of small functions
that have been unused for a long time.

Dave

v2
  Remove the xfer_kern() and kern_xfer() helpers that are now
  unused. (As spotted by Simon's review)

Dr. David Alan Gilbert (2):
  vhost: vringh: Remove unused iotlb functions
  vhost: vringh: Remove unused functions

 drivers/vhost/vringh.c | 118 -----------------------------------------
 include/linux/vringh.h |  12 -----
 2 files changed, 130 deletions(-)

-- 
2.49.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2 1/2] vhost: vringh: Remove unused iotlb functions
  2025-06-17  0:18 [PATCH v2 0/2] vringh small unused functions linux
@ 2025-06-17  0:18 ` linux
  2025-06-17  0:18 ` [PATCH v2 2/2] vhost: vringh: Remove unused functions linux
  2025-06-17 12:30 ` [PATCH v2 0/2] vringh small " Eugenio Perez Martin
  2 siblings, 0 replies; 6+ messages in thread
From: linux @ 2025-06-17  0:18 UTC (permalink / raw)
  To: mst, horms, jasowang, eperezma, xuanzhuo
  Cc: kvm, virtualization, netdev, linux-kernel, Dr. David Alan Gilbert

From: "Dr. David Alan Gilbert" <linux@treblig.org>

The functions:
  vringh_abandon_iotlb()
  vringh_notify_disable_iotlb() and
  vringh_notify_enable_iotlb()

were added in 2020 by
commit 9ad9c49cfe97 ("vringh: IOTLB support")
but have remained unused.

Remove them.

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Reviewed-by: Simon Horman <horms@kernel.org>
---
 drivers/vhost/vringh.c | 43 ------------------------------------------
 include/linux/vringh.h |  5 -----
 2 files changed, 48 deletions(-)

diff --git a/drivers/vhost/vringh.c b/drivers/vhost/vringh.c
index bbce65452701..67a028d6fb5f 100644
--- a/drivers/vhost/vringh.c
+++ b/drivers/vhost/vringh.c
@@ -1534,23 +1534,6 @@ ssize_t vringh_iov_push_iotlb(struct vringh *vrh,
 }
 EXPORT_SYMBOL(vringh_iov_push_iotlb);
 
-/**
- * vringh_abandon_iotlb - we've decided not to handle the descriptor(s).
- * @vrh: the vring.
- * @num: the number of descriptors to put back (ie. num
- *	 vringh_get_iotlb() to undo).
- *
- * The next vringh_get_iotlb() will return the old descriptor(s) again.
- */
-void vringh_abandon_iotlb(struct vringh *vrh, unsigned int num)
-{
-	/* We only update vring_avail_event(vr) when we want to be notified,
-	 * so we haven't changed that yet.
-	 */
-	vrh->last_avail_idx -= num;
-}
-EXPORT_SYMBOL(vringh_abandon_iotlb);
-
 /**
  * vringh_complete_iotlb - we've finished with descriptor, publish it.
  * @vrh: the vring.
@@ -1571,32 +1554,6 @@ int vringh_complete_iotlb(struct vringh *vrh, u16 head, u32 len)
 }
 EXPORT_SYMBOL(vringh_complete_iotlb);
 
-/**
- * vringh_notify_enable_iotlb - we want to know if something changes.
- * @vrh: the vring.
- *
- * This always enables notifications, but returns false if there are
- * now more buffers available in the vring.
- */
-bool vringh_notify_enable_iotlb(struct vringh *vrh)
-{
-	return __vringh_notify_enable(vrh, getu16_iotlb, putu16_iotlb);
-}
-EXPORT_SYMBOL(vringh_notify_enable_iotlb);
-
-/**
- * vringh_notify_disable_iotlb - don't tell us if something changes.
- * @vrh: the vring.
- *
- * This is our normal running state: we disable and then only enable when
- * we're going to sleep.
- */
-void vringh_notify_disable_iotlb(struct vringh *vrh)
-{
-	__vringh_notify_disable(vrh, putu16_iotlb);
-}
-EXPORT_SYMBOL(vringh_notify_disable_iotlb);
-
 /**
  * vringh_need_notify_iotlb - must we tell the other side about used buffers?
  * @vrh: the vring we've called vringh_complete_iotlb() on.
diff --git a/include/linux/vringh.h b/include/linux/vringh.h
index c3a8117dabe8..af8bd2695a7b 100644
--- a/include/linux/vringh.h
+++ b/include/linux/vringh.h
@@ -319,13 +319,8 @@ ssize_t vringh_iov_push_iotlb(struct vringh *vrh,
 			      struct vringh_kiov *wiov,
 			      const void *src, size_t len);
 
-void vringh_abandon_iotlb(struct vringh *vrh, unsigned int num);
-
 int vringh_complete_iotlb(struct vringh *vrh, u16 head, u32 len);
 
-bool vringh_notify_enable_iotlb(struct vringh *vrh);
-void vringh_notify_disable_iotlb(struct vringh *vrh);
-
 int vringh_need_notify_iotlb(struct vringh *vrh);
 
 #endif /* CONFIG_VHOST_IOTLB */
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2 2/2] vhost: vringh: Remove unused functions
  2025-06-17  0:18 [PATCH v2 0/2] vringh small unused functions linux
  2025-06-17  0:18 ` [PATCH v2 1/2] vhost: vringh: Remove unused iotlb functions linux
@ 2025-06-17  0:18 ` linux
  2025-06-17 11:28   ` Simon Horman
  2025-06-17 12:30 ` [PATCH v2 0/2] vringh small " Eugenio Perez Martin
  2 siblings, 1 reply; 6+ messages in thread
From: linux @ 2025-06-17  0:18 UTC (permalink / raw)
  To: mst, horms, jasowang, eperezma, xuanzhuo
  Cc: kvm, virtualization, netdev, linux-kernel, Dr. David Alan Gilbert

From: "Dr. David Alan Gilbert" <linux@treblig.org>

The functions:
  vringh_abandon_kern()
  vringh_abandon_user()
  vringh_iov_pull_kern() and
  vringh_iov_push_kern()
were all added in 2013 by
commit f87d0fbb5798 ("vringh: host-side implementation of virtio rings.")
but have remained unused.

Remove them and the two helper functions they used.

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
---
 drivers/vhost/vringh.c | 75 ------------------------------------------
 include/linux/vringh.h |  7 ----
 2 files changed, 82 deletions(-)

diff --git a/drivers/vhost/vringh.c b/drivers/vhost/vringh.c
index 67a028d6fb5f..9f27c3f6091b 100644
--- a/drivers/vhost/vringh.c
+++ b/drivers/vhost/vringh.c
@@ -779,22 +779,6 @@ ssize_t vringh_iov_push_user(struct vringh_iov *wiov,
 }
 EXPORT_SYMBOL(vringh_iov_push_user);
 
-/**
- * vringh_abandon_user - we've decided not to handle the descriptor(s).
- * @vrh: the vring.
- * @num: the number of descriptors to put back (ie. num
- *	 vringh_get_user() to undo).
- *
- * The next vringh_get_user() will return the old descriptor(s) again.
- */
-void vringh_abandon_user(struct vringh *vrh, unsigned int num)
-{
-	/* We only update vring_avail_event(vr) when we want to be notified,
-	 * so we haven't changed that yet. */
-	vrh->last_avail_idx -= num;
-}
-EXPORT_SYMBOL(vringh_abandon_user);
-
 /**
  * vringh_complete_user - we've finished with descriptor, publish it.
  * @vrh: the vring.
@@ -900,20 +884,6 @@ static inline int putused_kern(const struct vringh *vrh,
 	return 0;
 }
 
-static inline int xfer_kern(const struct vringh *vrh, void *src,
-			    void *dst, size_t len)
-{
-	memcpy(dst, src, len);
-	return 0;
-}
-
-static inline int kern_xfer(const struct vringh *vrh, void *dst,
-			    void *src, size_t len)
-{
-	memcpy(dst, src, len);
-	return 0;
-}
-
 /**
  * vringh_init_kern - initialize a vringh for a kernelspace vring.
  * @vrh: the vringh to initialize.
@@ -998,51 +968,6 @@ int vringh_getdesc_kern(struct vringh *vrh,
 }
 EXPORT_SYMBOL(vringh_getdesc_kern);
 
-/**
- * vringh_iov_pull_kern - copy bytes from vring_iov.
- * @riov: the riov as passed to vringh_getdesc_kern() (updated as we consume)
- * @dst: the place to copy.
- * @len: the maximum length to copy.
- *
- * Returns the bytes copied <= len or a negative errno.
- */
-ssize_t vringh_iov_pull_kern(struct vringh_kiov *riov, void *dst, size_t len)
-{
-	return vringh_iov_xfer(NULL, riov, dst, len, xfer_kern);
-}
-EXPORT_SYMBOL(vringh_iov_pull_kern);
-
-/**
- * vringh_iov_push_kern - copy bytes into vring_iov.
- * @wiov: the wiov as passed to vringh_getdesc_kern() (updated as we consume)
- * @src: the place to copy from.
- * @len: the maximum length to copy.
- *
- * Returns the bytes copied <= len or a negative errno.
- */
-ssize_t vringh_iov_push_kern(struct vringh_kiov *wiov,
-			     const void *src, size_t len)
-{
-	return vringh_iov_xfer(NULL, wiov, (void *)src, len, kern_xfer);
-}
-EXPORT_SYMBOL(vringh_iov_push_kern);
-
-/**
- * vringh_abandon_kern - we've decided not to handle the descriptor(s).
- * @vrh: the vring.
- * @num: the number of descriptors to put back (ie. num
- *	 vringh_get_kern() to undo).
- *
- * The next vringh_get_kern() will return the old descriptor(s) again.
- */
-void vringh_abandon_kern(struct vringh *vrh, unsigned int num)
-{
-	/* We only update vring_avail_event(vr) when we want to be notified,
-	 * so we haven't changed that yet. */
-	vrh->last_avail_idx -= num;
-}
-EXPORT_SYMBOL(vringh_abandon_kern);
-
 /**
  * vringh_complete_kern - we've finished with descriptor, publish it.
  * @vrh: the vring.
diff --git a/include/linux/vringh.h b/include/linux/vringh.h
index af8bd2695a7b..49e7cbc9697a 100644
--- a/include/linux/vringh.h
+++ b/include/linux/vringh.h
@@ -175,9 +175,6 @@ int vringh_complete_multi_user(struct vringh *vrh,
 			       const struct vring_used_elem used[],
 			       unsigned num_used);
 
-/* Pretend we've never seen descriptor (for easy error handling). */
-void vringh_abandon_user(struct vringh *vrh, unsigned int num);
-
 /* Do we need to fire the eventfd to notify the other side? */
 int vringh_need_notify_user(struct vringh *vrh);
 
@@ -235,10 +232,6 @@ int vringh_getdesc_kern(struct vringh *vrh,
 			u16 *head,
 			gfp_t gfp);
 
-ssize_t vringh_iov_pull_kern(struct vringh_kiov *riov, void *dst, size_t len);
-ssize_t vringh_iov_push_kern(struct vringh_kiov *wiov,
-			     const void *src, size_t len);
-void vringh_abandon_kern(struct vringh *vrh, unsigned int num);
 int vringh_complete_kern(struct vringh *vrh, u16 head, u32 len);
 
 bool vringh_notify_enable_kern(struct vringh *vrh);
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 2/2] vhost: vringh: Remove unused functions
  2025-06-17  0:18 ` [PATCH v2 2/2] vhost: vringh: Remove unused functions linux
@ 2025-06-17 11:28   ` Simon Horman
  0 siblings, 0 replies; 6+ messages in thread
From: Simon Horman @ 2025-06-17 11:28 UTC (permalink / raw)
  To: linux
  Cc: mst, jasowang, eperezma, xuanzhuo, kvm, virtualization, netdev,
	linux-kernel

On Tue, Jun 17, 2025 at 01:18:37AM +0100, linux@treblig.org wrote:
> From: "Dr. David Alan Gilbert" <linux@treblig.org>
> 
> The functions:
>   vringh_abandon_kern()
>   vringh_abandon_user()
>   vringh_iov_pull_kern() and
>   vringh_iov_push_kern()
> were all added in 2013 by
> commit f87d0fbb5798 ("vringh: host-side implementation of virtio rings.")
> but have remained unused.
> 
> Remove them and the two helper functions they used.
> 
> Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>

Thanks for the update.

Reviewed-by: Simon Horman <horms@kernel.org>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 0/2] vringh small unused functions
  2025-06-17  0:18 [PATCH v2 0/2] vringh small unused functions linux
  2025-06-17  0:18 ` [PATCH v2 1/2] vhost: vringh: Remove unused iotlb functions linux
  2025-06-17  0:18 ` [PATCH v2 2/2] vhost: vringh: Remove unused functions linux
@ 2025-06-17 12:30 ` Eugenio Perez Martin
  2025-06-24 10:21   ` Lei Yang
  2 siblings, 1 reply; 6+ messages in thread
From: Eugenio Perez Martin @ 2025-06-17 12:30 UTC (permalink / raw)
  To: linux
  Cc: mst, horms, jasowang, xuanzhuo, kvm, virtualization, netdev,
	linux-kernel

On Tue, Jun 17, 2025 at 2:18 AM <linux@treblig.org> wrote:
>
> From: "Dr. David Alan Gilbert" <linux@treblig.org>
>
> Hi,
>   The following pair of patches remove a bunch of small functions
> that have been unused for a long time.
>

Acked-by: Eugenio Pérez <eperezma@redhat.com>

Thanks!


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 0/2] vringh small unused functions
  2025-06-17 12:30 ` [PATCH v2 0/2] vringh small " Eugenio Perez Martin
@ 2025-06-24 10:21   ` Lei Yang
  0 siblings, 0 replies; 6+ messages in thread
From: Lei Yang @ 2025-06-24 10:21 UTC (permalink / raw)
  To: Eugenio Perez Martin
  Cc: linux, mst, horms, jasowang, xuanzhuo, kvm, virtualization,
	netdev, linux-kernel

Tested this series of patches with virtio-net regression tests,
everything works fine.

Tested-by: Lei Yang <leiyang@redhat.com>

On Tue, Jun 17, 2025 at 8:31 PM Eugenio Perez Martin
<eperezma@redhat.com> wrote:
>
> On Tue, Jun 17, 2025 at 2:18 AM <linux@treblig.org> wrote:
> >
> > From: "Dr. David Alan Gilbert" <linux@treblig.org>
> >
> > Hi,
> >   The following pair of patches remove a bunch of small functions
> > that have been unused for a long time.
> >
>
> Acked-by: Eugenio Pérez <eperezma@redhat.com>
>
> Thanks!
>
>


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-06-24 10:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-17  0:18 [PATCH v2 0/2] vringh small unused functions linux
2025-06-17  0:18 ` [PATCH v2 1/2] vhost: vringh: Remove unused iotlb functions linux
2025-06-17  0:18 ` [PATCH v2 2/2] vhost: vringh: Remove unused functions linux
2025-06-17 11:28   ` Simon Horman
2025-06-17 12:30 ` [PATCH v2 0/2] vringh small " Eugenio Perez Martin
2025-06-24 10:21   ` Lei Yang

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