linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] vmci deadcode
@ 2025-06-14  1:03 linux
  2025-06-14  1:03 ` [PATCH 1/3] misc: vmw_vmci: Remove unused vmci_ctx functions linux
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: linux @ 2025-06-14  1:03 UTC (permalink / raw)
  To: bryan-bt.tan, vishnu.dasa
  Cc: bcm-kernel-feedback-list, arnd, gregkh, linux-kernel,
	Dr. David Alan Gilbert

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

Hi,
  This is a set of deadcode removal in vmw_vmci; all of
the removals are whole function removals for functions
that were added in 2013 but haven't been used.

Build tested only.

Dave
Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>


Dr. David Alan Gilbert (3):
  misc: vmw_vmci: Remove unused vmci_ctx functions
  misc: vmw_vmci: Remove unused vmci_doorbell_notify
  misc: vmw_vmci: Remove unused qpair functions

 drivers/misc/vmw_vmci/vmci_context.c    |  54 ----------
 drivers/misc/vmw_vmci/vmci_context.h    |   2 -
 drivers/misc/vmw_vmci/vmci_doorbell.c   |  53 ----------
 drivers/misc/vmw_vmci/vmci_queue_pair.c | 133 ------------------------
 include/linux/vmw_vmci_api.h            |   7 --
 5 files changed, 249 deletions(-)

-- 
2.49.0


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

* [PATCH 1/3] misc: vmw_vmci: Remove unused vmci_ctx functions
  2025-06-14  1:03 [PATCH 0/3] vmci deadcode linux
@ 2025-06-14  1:03 ` linux
  2025-06-14  1:03 ` [PATCH 2/3] misc: vmw_vmci: Remove unused vmci_doorbell_notify linux
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: linux @ 2025-06-14  1:03 UTC (permalink / raw)
  To: bryan-bt.tan, vishnu.dasa
  Cc: bcm-kernel-feedback-list, arnd, gregkh, linux-kernel,
	Dr. David Alan Gilbert

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

vmci_ctx_dbell_destroy_all() and vmci_ctx_pending_datagrams()
were added in 2013 by
commit 28d6692cd8fb ("VMCI: context implementation.")

but have remained unused.

Remove them.

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
---
 drivers/misc/vmw_vmci/vmci_context.c | 54 ----------------------------
 drivers/misc/vmw_vmci/vmci_context.h |  2 --
 2 files changed, 56 deletions(-)

diff --git a/drivers/misc/vmw_vmci/vmci_context.c b/drivers/misc/vmw_vmci/vmci_context.c
index f22b44827e92..843f98fb17f6 100644
--- a/drivers/misc/vmw_vmci/vmci_context.c
+++ b/drivers/misc/vmw_vmci/vmci_context.c
@@ -268,28 +268,6 @@ static int ctx_fire_notification(u32 context_id, u32 priv_flags)
 	return VMCI_SUCCESS;
 }
 
-/*
- * Returns the current number of pending datagrams. The call may
- * also serve as a synchronization point for the datagram queue,
- * as no enqueue operations can occur concurrently.
- */
-int vmci_ctx_pending_datagrams(u32 cid, u32 *pending)
-{
-	struct vmci_ctx *context;
-
-	context = vmci_ctx_get(cid);
-	if (context == NULL)
-		return VMCI_ERROR_INVALID_ARGS;
-
-	spin_lock(&context->lock);
-	if (pending)
-		*pending = context->pending_datagrams;
-	spin_unlock(&context->lock);
-	vmci_ctx_put(context);
-
-	return VMCI_SUCCESS;
-}
-
 /*
  * Queues a VMCI datagram for the appropriate target VM context.
  */
@@ -991,38 +969,6 @@ int vmci_ctx_dbell_destroy(u32 context_id, struct vmci_handle handle)
 	    VMCI_ERROR_NOT_FOUND : VMCI_SUCCESS;
 }
 
-/*
- * Unregisters all doorbell handles that were previously
- * registered with vmci_ctx_dbell_create.
- */
-int vmci_ctx_dbell_destroy_all(u32 context_id)
-{
-	struct vmci_ctx *context;
-	struct vmci_handle handle;
-
-	if (context_id == VMCI_INVALID_ID)
-		return VMCI_ERROR_INVALID_ARGS;
-
-	context = vmci_ctx_get(context_id);
-	if (context == NULL)
-		return VMCI_ERROR_NOT_FOUND;
-
-	spin_lock(&context->lock);
-	do {
-		struct vmci_handle_arr *arr = context->doorbell_array;
-		handle = vmci_handle_arr_remove_tail(arr);
-	} while (!vmci_handle_is_invalid(handle));
-	do {
-		struct vmci_handle_arr *arr = context->pending_doorbell_array;
-		handle = vmci_handle_arr_remove_tail(arr);
-	} while (!vmci_handle_is_invalid(handle));
-	spin_unlock(&context->lock);
-
-	vmci_ctx_put(context);
-
-	return VMCI_SUCCESS;
-}
-
 /*
  * Registers a notification of a doorbell handle initiated by the
  * specified source context. The notification of doorbells are
diff --git a/drivers/misc/vmw_vmci/vmci_context.h b/drivers/misc/vmw_vmci/vmci_context.h
index 4db8701c9781..980fdece0f7d 100644
--- a/drivers/misc/vmw_vmci/vmci_context.h
+++ b/drivers/misc/vmw_vmci/vmci_context.h
@@ -132,7 +132,6 @@ bool vmci_ctx_supports_host_qp(struct vmci_ctx *context);
 int vmci_ctx_enqueue_datagram(u32 cid, struct vmci_datagram *dg);
 int vmci_ctx_dequeue_datagram(struct vmci_ctx *context,
 			      size_t *max_size, struct vmci_datagram **dg);
-int vmci_ctx_pending_datagrams(u32 cid, u32 *pending);
 struct vmci_ctx *vmci_ctx_get(u32 cid);
 void vmci_ctx_put(struct vmci_ctx *context);
 bool vmci_ctx_exists(u32 cid);
@@ -153,7 +152,6 @@ void vmci_ctx_unset_notify(struct vmci_ctx *context);
 
 int vmci_ctx_dbell_create(u32 context_id, struct vmci_handle handle);
 int vmci_ctx_dbell_destroy(u32 context_id, struct vmci_handle handle);
-int vmci_ctx_dbell_destroy_all(u32 context_id);
 int vmci_ctx_notify_dbell(u32 cid, struct vmci_handle handle,
 			  u32 src_priv_flags);
 
-- 
2.49.0


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

* [PATCH 2/3] misc: vmw_vmci: Remove unused vmci_doorbell_notify
  2025-06-14  1:03 [PATCH 0/3] vmci deadcode linux
  2025-06-14  1:03 ` [PATCH 1/3] misc: vmw_vmci: Remove unused vmci_ctx functions linux
@ 2025-06-14  1:03 ` linux
  2025-06-14  1:03 ` [PATCH 3/3] misc: vmw_vmci: Remove unused qpair functions linux
  2025-06-19 14:54 ` [PATCH 0/3] vmci deadcode Geethu Joseph
  3 siblings, 0 replies; 5+ messages in thread
From: linux @ 2025-06-14  1:03 UTC (permalink / raw)
  To: bryan-bt.tan, vishnu.dasa
  Cc: bcm-kernel-feedback-list, arnd, gregkh, linux-kernel,
	Dr. David Alan Gilbert

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

vmci_doorbell_notify() was added in 2013 by
commit 83e2ec765be0 ("VMCI: doorbell implementation.")

but has remained unused.

Remove it.

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
---
 drivers/misc/vmw_vmci/vmci_doorbell.c | 53 ---------------------------
 include/linux/vmw_vmci_api.h          |  1 -
 2 files changed, 54 deletions(-)

diff --git a/drivers/misc/vmw_vmci/vmci_doorbell.c b/drivers/misc/vmw_vmci/vmci_doorbell.c
index fa8a7fce4481..53eeb9e6cb56 100644
--- a/drivers/misc/vmw_vmci/vmci_doorbell.c
+++ b/drivers/misc/vmw_vmci/vmci_doorbell.c
@@ -257,23 +257,6 @@ static int dbell_unlink(struct vmci_handle handle)
 	return vmci_send_datagram(&unlink_msg.hdr);
 }
 
-/*
- * Notify another guest or the host.  We send a datagram down to the
- * host via the hypervisor with the notification info.
- */
-static int dbell_notify_as_guest(struct vmci_handle handle, u32 priv_flags)
-{
-	struct vmci_doorbell_notify_msg notify_msg;
-
-	notify_msg.hdr.dst = vmci_make_handle(VMCI_HYPERVISOR_CONTEXT_ID,
-					      VMCI_DOORBELL_NOTIFY);
-	notify_msg.hdr.src = VMCI_ANON_SRC_HANDLE;
-	notify_msg.hdr.payload_size = sizeof(notify_msg) - VMCI_DG_HEADERSIZE;
-	notify_msg.handle = handle;
-
-	return vmci_send_datagram(&notify_msg.hdr);
-}
-
 /*
  * Calls the specified callback in a delayed context.
  */
@@ -566,39 +549,3 @@ int vmci_doorbell_destroy(struct vmci_handle handle)
 	return VMCI_SUCCESS;
 }
 EXPORT_SYMBOL_GPL(vmci_doorbell_destroy);
-
-/*
- * vmci_doorbell_notify() - Ring the doorbell (and hide in the bushes).
- * @dst:        The handlle identifying the doorbell resource
- * @priv_flags: Priviledge flags.
- *
- * Generates a notification on the doorbell identified by the
- * handle. For host side generation of notifications, the caller
- * can specify what the privilege of the calling side is.
- */
-int vmci_doorbell_notify(struct vmci_handle dst, u32 priv_flags)
-{
-	int retval;
-	enum vmci_route route;
-	struct vmci_handle src;
-
-	if (vmci_handle_is_invalid(dst) ||
-	    (priv_flags & ~VMCI_PRIVILEGE_ALL_FLAGS))
-		return VMCI_ERROR_INVALID_ARGS;
-
-	src = VMCI_INVALID_HANDLE;
-	retval = vmci_route(&src, &dst, false, &route);
-	if (retval < VMCI_SUCCESS)
-		return retval;
-
-	if (VMCI_ROUTE_AS_HOST == route)
-		return vmci_ctx_notify_dbell(VMCI_HOST_CONTEXT_ID,
-					     dst, priv_flags);
-
-	if (VMCI_ROUTE_AS_GUEST == route)
-		return dbell_notify_as_guest(dst, priv_flags);
-
-	pr_warn("Unknown route (%d) for doorbell\n", route);
-	return VMCI_ERROR_DST_UNREACHABLE;
-}
-EXPORT_SYMBOL_GPL(vmci_doorbell_notify);
diff --git a/include/linux/vmw_vmci_api.h b/include/linux/vmw_vmci_api.h
index f28907345c80..28a3b6a9e1ca 100644
--- a/include/linux/vmw_vmci_api.h
+++ b/include/linux/vmw_vmci_api.h
@@ -35,7 +35,6 @@ int vmci_doorbell_create(struct vmci_handle *handle, u32 flags,
 			 u32 priv_flags,
 			 vmci_callback notify_cb, void *client_data);
 int vmci_doorbell_destroy(struct vmci_handle handle);
-int vmci_doorbell_notify(struct vmci_handle handle, u32 priv_flags);
 u32 vmci_get_context_id(void);
 bool vmci_is_context_owner(u32 context_id, kuid_t uid);
 int vmci_register_vsock_callback(vmci_vsock_cb callback);
-- 
2.49.0


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

* [PATCH 3/3] misc: vmw_vmci: Remove unused qpair functions
  2025-06-14  1:03 [PATCH 0/3] vmci deadcode linux
  2025-06-14  1:03 ` [PATCH 1/3] misc: vmw_vmci: Remove unused vmci_ctx functions linux
  2025-06-14  1:03 ` [PATCH 2/3] misc: vmw_vmci: Remove unused vmci_doorbell_notify linux
@ 2025-06-14  1:03 ` linux
  2025-06-19 14:54 ` [PATCH 0/3] vmci deadcode Geethu Joseph
  3 siblings, 0 replies; 5+ messages in thread
From: linux @ 2025-06-14  1:03 UTC (permalink / raw)
  To: bryan-bt.tan, vishnu.dasa
  Cc: bcm-kernel-feedback-list, arnd, gregkh, linux-kernel,
	Dr. David Alan Gilbert

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

vmci_qpair_dequeue(), vmci_qpair_enqueue() and vmci_qpair_peek()
were added in 2013 by
commit 06164d2b72aa ("VMCI: queue pairs implementation.")

but have remained unused.

Remove them.

(The iov version of those functions is used)

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
---
 drivers/misc/vmw_vmci/vmci_queue_pair.c | 133 ------------------------
 include/linux/vmw_vmci_api.h            |   6 --
 2 files changed, 139 deletions(-)

diff --git a/drivers/misc/vmw_vmci/vmci_queue_pair.c b/drivers/misc/vmw_vmci/vmci_queue_pair.c
index 73d71c4ec139..b88ac144ad32 100644
--- a/drivers/misc/vmw_vmci/vmci_queue_pair.c
+++ b/drivers/misc/vmw_vmci/vmci_queue_pair.c
@@ -3022,139 +3022,6 @@ s64 vmci_qpair_consume_buf_ready(const struct vmci_qp *qpair)
 }
 EXPORT_SYMBOL_GPL(vmci_qpair_consume_buf_ready);
 
-/*
- * vmci_qpair_enqueue() - Throw data on the queue.
- * @qpair:      Pointer to the queue pair struct.
- * @buf:        Pointer to buffer containing data
- * @buf_size:   Length of buffer.
- * @buf_type:   Buffer type (Unused).
- *
- * This is the client interface for enqueueing data into the queue.
- * Returns number of bytes enqueued or < 0 on error.
- */
-ssize_t vmci_qpair_enqueue(struct vmci_qp *qpair,
-			   const void *buf,
-			   size_t buf_size,
-			   int buf_type)
-{
-	ssize_t result;
-	struct iov_iter from;
-	struct kvec v = {.iov_base = (void *)buf, .iov_len = buf_size};
-
-	if (!qpair || !buf)
-		return VMCI_ERROR_INVALID_ARGS;
-
-	iov_iter_kvec(&from, ITER_SOURCE, &v, 1, buf_size);
-
-	qp_lock(qpair);
-
-	do {
-		result = qp_enqueue_locked(qpair->produce_q,
-					   qpair->consume_q,
-					   qpair->produce_q_size,
-					   &from);
-
-		if (result == VMCI_ERROR_QUEUEPAIR_NOT_READY &&
-		    !qp_wait_for_ready_queue(qpair))
-			result = VMCI_ERROR_WOULD_BLOCK;
-
-	} while (result == VMCI_ERROR_QUEUEPAIR_NOT_READY);
-
-	qp_unlock(qpair);
-
-	return result;
-}
-EXPORT_SYMBOL_GPL(vmci_qpair_enqueue);
-
-/*
- * vmci_qpair_dequeue() - Get data from the queue.
- * @qpair:      Pointer to the queue pair struct.
- * @buf:        Pointer to buffer for the data
- * @buf_size:   Length of buffer.
- * @buf_type:   Buffer type (Unused).
- *
- * This is the client interface for dequeueing data from the queue.
- * Returns number of bytes dequeued or < 0 on error.
- */
-ssize_t vmci_qpair_dequeue(struct vmci_qp *qpair,
-			   void *buf,
-			   size_t buf_size,
-			   int buf_type)
-{
-	ssize_t result;
-	struct iov_iter to;
-	struct kvec v = {.iov_base = buf, .iov_len = buf_size};
-
-	if (!qpair || !buf)
-		return VMCI_ERROR_INVALID_ARGS;
-
-	iov_iter_kvec(&to, ITER_DEST, &v, 1, buf_size);
-
-	qp_lock(qpair);
-
-	do {
-		result = qp_dequeue_locked(qpair->produce_q,
-					   qpair->consume_q,
-					   qpair->consume_q_size,
-					   &to, true);
-
-		if (result == VMCI_ERROR_QUEUEPAIR_NOT_READY &&
-		    !qp_wait_for_ready_queue(qpair))
-			result = VMCI_ERROR_WOULD_BLOCK;
-
-	} while (result == VMCI_ERROR_QUEUEPAIR_NOT_READY);
-
-	qp_unlock(qpair);
-
-	return result;
-}
-EXPORT_SYMBOL_GPL(vmci_qpair_dequeue);
-
-/*
- * vmci_qpair_peek() - Peek at the data in the queue.
- * @qpair:      Pointer to the queue pair struct.
- * @buf:        Pointer to buffer for the data
- * @buf_size:   Length of buffer.
- * @buf_type:   Buffer type (Unused on Linux).
- *
- * This is the client interface for peeking into a queue.  (I.e.,
- * copy data from the queue without updating the head pointer.)
- * Returns number of bytes dequeued or < 0 on error.
- */
-ssize_t vmci_qpair_peek(struct vmci_qp *qpair,
-			void *buf,
-			size_t buf_size,
-			int buf_type)
-{
-	struct iov_iter to;
-	struct kvec v = {.iov_base = buf, .iov_len = buf_size};
-	ssize_t result;
-
-	if (!qpair || !buf)
-		return VMCI_ERROR_INVALID_ARGS;
-
-	iov_iter_kvec(&to, ITER_DEST, &v, 1, buf_size);
-
-	qp_lock(qpair);
-
-	do {
-		result = qp_dequeue_locked(qpair->produce_q,
-					   qpair->consume_q,
-					   qpair->consume_q_size,
-					   &to, false);
-
-		if (result == VMCI_ERROR_QUEUEPAIR_NOT_READY &&
-		    !qp_wait_for_ready_queue(qpair))
-			result = VMCI_ERROR_WOULD_BLOCK;
-
-	} while (result == VMCI_ERROR_QUEUEPAIR_NOT_READY);
-
-	qp_unlock(qpair);
-
-	return result;
-}
-EXPORT_SYMBOL_GPL(vmci_qpair_peek);
-
 /*
  * vmci_qpair_enquev() - Throw data on the queue using iov.
  * @qpair:      Pointer to the queue pair struct.
diff --git a/include/linux/vmw_vmci_api.h b/include/linux/vmw_vmci_api.h
index 28a3b6a9e1ca..41764a684423 100644
--- a/include/linux/vmw_vmci_api.h
+++ b/include/linux/vmw_vmci_api.h
@@ -60,12 +60,6 @@ s64 vmci_qpair_produce_free_space(const struct vmci_qp *qpair);
 s64 vmci_qpair_produce_buf_ready(const struct vmci_qp *qpair);
 s64 vmci_qpair_consume_free_space(const struct vmci_qp *qpair);
 s64 vmci_qpair_consume_buf_ready(const struct vmci_qp *qpair);
-ssize_t vmci_qpair_enqueue(struct vmci_qp *qpair,
-			   const void *buf, size_t buf_size, int mode);
-ssize_t vmci_qpair_dequeue(struct vmci_qp *qpair,
-			   void *buf, size_t buf_size, int mode);
-ssize_t vmci_qpair_peek(struct vmci_qp *qpair, void *buf, size_t buf_size,
-			int mode);
 ssize_t vmci_qpair_enquev(struct vmci_qp *qpair,
 			  struct msghdr *msg, size_t iov_size, int mode);
 ssize_t vmci_qpair_dequev(struct vmci_qp *qpair,
-- 
2.49.0


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

* Re: [PATCH 0/3] vmci deadcode
  2025-06-14  1:03 [PATCH 0/3] vmci deadcode linux
                   ` (2 preceding siblings ...)
  2025-06-14  1:03 ` [PATCH 3/3] misc: vmw_vmci: Remove unused qpair functions linux
@ 2025-06-19 14:54 ` Geethu Joseph
  3 siblings, 0 replies; 5+ messages in thread
From: Geethu Joseph @ 2025-06-19 14:54 UTC (permalink / raw)
  To: linux
  Cc: bryan-bt.tan, vishnu.dasa, bcm-kernel-feedback-list, arnd, gregkh,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1013 bytes --]

On Sat, Jun 14, 2025 at 6:33 AM <linux@treblig.org> wrote:
>
> From: "Dr. David Alan Gilbert" <linux@treblig.org>
>
> Hi,
>   This is a set of deadcode removal in vmw_vmci; all of
> the removals are whole function removals for functions
> that were added in 2013 but haven't been used.
>
> Build tested only.
>
> Dave
> Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
>

Acked-by Geethu Joseph <geethu.joseph@broadcom.com>

>
> Dr. David Alan Gilbert (3):
>   misc: vmw_vmci: Remove unused vmci_ctx functions
>   misc: vmw_vmci: Remove unused vmci_doorbell_notify
>   misc: vmw_vmci: Remove unused qpair functions
>
>  drivers/misc/vmw_vmci/vmci_context.c    |  54 ----------
>  drivers/misc/vmw_vmci/vmci_context.h    |   2 -
>  drivers/misc/vmw_vmci/vmci_doorbell.c   |  53 ----------
>  drivers/misc/vmw_vmci/vmci_queue_pair.c | 133 ------------------------
>  include/linux/vmw_vmci_api.h            |   7 --
>  5 files changed, 249 deletions(-)
>
> --
> 2.49.0
>

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 5473 bytes --]

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

end of thread, other threads:[~2025-06-19 14:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-14  1:03 [PATCH 0/3] vmci deadcode linux
2025-06-14  1:03 ` [PATCH 1/3] misc: vmw_vmci: Remove unused vmci_ctx functions linux
2025-06-14  1:03 ` [PATCH 2/3] misc: vmw_vmci: Remove unused vmci_doorbell_notify linux
2025-06-14  1:03 ` [PATCH 3/3] misc: vmw_vmci: Remove unused qpair functions linux
2025-06-19 14:54 ` [PATCH 0/3] vmci deadcode Geethu Joseph

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