* [PATCH] hyperv: Remove unused union and structs
@ 2025-03-10 19:26 Thorsten Blum
2025-03-10 20:21 ` Michael Kelley
0 siblings, 1 reply; 4+ messages in thread
From: Thorsten Blum @ 2025-03-10 19:26 UTC (permalink / raw)
To: K. Y. Srinivasan, Haiyang Zhang, Wei Liu, Dexuan Cui
Cc: Thorsten Blum, linux-hyperv, linux-kernel
The union vmpacket_largest_possible_header and several structs have not
been used for a long time afaict - remove them.
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
include/linux/hyperv.h | 47 ------------------------------------------
1 file changed, 47 deletions(-)
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index 4179add2864b..bff91788c8a3 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -371,19 +371,6 @@ struct vmtransfer_page_packet_header {
struct vmtransfer_page_range ranges[];
} __packed;
-struct vmgpadl_packet_header {
- struct vmpacket_descriptor d;
- u32 gpadl;
- u32 reserved;
-} __packed;
-
-struct vmadd_remove_transfer_page_set {
- struct vmpacket_descriptor d;
- u32 gpadl;
- u16 xfer_pageset_id;
- u16 reserved;
-} __packed;
-
/*
* This structure defines a range in guest physical space that can be made to
* look virtually contiguous.
@@ -394,30 +381,6 @@ struct gpa_range {
u64 pfn_array[];
};
-/*
- * This is the format for an Establish Gpadl packet, which contains a handle by
- * which this GPADL will be known and a set of GPA ranges associated with it.
- * This can be converted to a MDL by the guest OS. If there are multiple GPA
- * ranges, then the resulting MDL will be "chained," representing multiple VA
- * ranges.
- */
-struct vmestablish_gpadl {
- struct vmpacket_descriptor d;
- u32 gpadl;
- u32 range_cnt;
- struct gpa_range range[1];
-} __packed;
-
-/*
- * This is the format for a Teardown Gpadl packet, which indicates that the
- * GPADL handle in the Establish Gpadl packet will never be referenced again.
- */
-struct vmteardown_gpadl {
- struct vmpacket_descriptor d;
- u32 gpadl;
- u32 reserved; /* for alignment to a 8-byte boundary */
-} __packed;
-
/*
* This is the format for a GPA-Direct packet, which contains a set of GPA
* ranges, in addition to commands and/or data.
@@ -438,16 +401,6 @@ struct vmadditional_data {
unsigned char data[1];
} __packed;
-union vmpacket_largest_possible_header {
- struct vmpacket_descriptor simple_hdr;
- struct vmtransfer_page_packet_header xfer_page_hdr;
- struct vmgpadl_packet_header gpadl_hdr;
- struct vmadd_remove_transfer_page_set add_rm_xfer_page_hdr;
- struct vmestablish_gpadl establish_gpadl_hdr;
- struct vmteardown_gpadl teardown_gpadl_hdr;
- struct vmdata_gpa_direct data_gpa_direct_hdr;
-};
-
#define VMPACKET_DATA_START_ADDRESS(__packet) \
(void *)(((unsigned char *)__packet) + \
((struct vmpacket_descriptor)__packet)->offset8 * 8)
--
2.48.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* RE: [PATCH] hyperv: Remove unused union and structs
2025-03-10 19:26 [PATCH] hyperv: Remove unused union and structs Thorsten Blum
@ 2025-03-10 20:21 ` Michael Kelley
2025-03-10 20:40 ` Thorsten Blum
0 siblings, 1 reply; 4+ messages in thread
From: Michael Kelley @ 2025-03-10 20:21 UTC (permalink / raw)
To: Thorsten Blum, K. Y. Srinivasan, Haiyang Zhang, Wei Liu,
Dexuan Cui
Cc: linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org
From: Thorsten Blum <thorsten.blum@linux.dev> Sent: Monday, March 10, 2025 12:26 PM
>
> The union vmpacket_largest_possible_header and several structs have not
> been used for a long time afaict - remove them.
>
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> ---
> include/linux/hyperv.h | 47 ------------------------------------------
> 1 file changed, 47 deletions(-)
>
> diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
> index 4179add2864b..bff91788c8a3 100644
> --- a/include/linux/hyperv.h
> +++ b/include/linux/hyperv.h
> @@ -371,19 +371,6 @@ struct vmtransfer_page_packet_header {
> struct vmtransfer_page_range ranges[];
> } __packed;
>
> -struct vmgpadl_packet_header {
> - struct vmpacket_descriptor d;
> - u32 gpadl;
> - u32 reserved;
> -} __packed;
> -
> -struct vmadd_remove_transfer_page_set {
> - struct vmpacket_descriptor d;
> - u32 gpadl;
> - u16 xfer_pageset_id;
> - u16 reserved;
> -} __packed;
> -
> /*
> * This structure defines a range in guest physical space that can be made to
> * look virtually contiguous.
> @@ -394,30 +381,6 @@ struct gpa_range {
> u64 pfn_array[];
> };
>
> -/*
> - * This is the format for an Establish Gpadl packet, which contains a handle by
> - * which this GPADL will be known and a set of GPA ranges associated with it.
> - * This can be converted to a MDL by the guest OS. If there are multiple GPA
> - * ranges, then the resulting MDL will be "chained," representing multiple VA
> - * ranges.
> - */
> -struct vmestablish_gpadl {
> - struct vmpacket_descriptor d;
> - u32 gpadl;
> - u32 range_cnt;
> - struct gpa_range range[1];
> -} __packed;
> -
> -/*
> - * This is the format for a Teardown Gpadl packet, which indicates that the
> - * GPADL handle in the Establish Gpadl packet will never be referenced again.
> - */
> -struct vmteardown_gpadl {
> - struct vmpacket_descriptor d;
> - u32 gpadl;
> - u32 reserved; /* for alignment to a 8-byte boundary */
> -} __packed;
> -
> /*
> * This is the format for a GPA-Direct packet, which contains a set of GPA
> * ranges, in addition to commands and/or data.
> @@ -438,16 +401,6 @@ struct vmadditional_data {
> unsigned char data[1];
> } __packed;
It appears to me that struct vmdata_gpa_direct and struct
vmadditional_data are also unused. Did you keep them for
some reason? Or could they also be deleted in this patch?
>
> -union vmpacket_largest_possible_header {
> - struct vmpacket_descriptor simple_hdr;
> - struct vmtransfer_page_packet_header xfer_page_hdr;
> - struct vmgpadl_packet_header gpadl_hdr;
> - struct vmadd_remove_transfer_page_set add_rm_xfer_page_hdr;
> - struct vmestablish_gpadl establish_gpadl_hdr;
> - struct vmteardown_gpadl teardown_gpadl_hdr;
> - struct vmdata_gpa_direct data_gpa_direct_hdr;
> -};
> -
> #define VMPACKET_DATA_START_ADDRESS(__packet) \
> (void *)(((unsigned char *)__packet) + \
> ((struct vmpacket_descriptor)__packet)->offset8 * 8)
> --
> 2.48.1
>
I can see from "git blame" that these structs originated back
in 2011 when the Hyper-V drivers were still in staging. Going
back as far as the 3.4 kernel, I don't see any references to them.
I don't know anything more about the history, and lacking such
information, I'm certainly OK with deleting them as unnecessary.
Reviewed-by: Michael Kelley <mhklinux@outlook.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] hyperv: Remove unused union and structs
2025-03-10 20:21 ` Michael Kelley
@ 2025-03-10 20:40 ` Thorsten Blum
2025-03-10 20:52 ` Michael Kelley
0 siblings, 1 reply; 4+ messages in thread
From: Thorsten Blum @ 2025-03-10 20:40 UTC (permalink / raw)
To: Michael Kelley
Cc: K. Y. Srinivasan, Haiyang Zhang, Wei Liu, Dexuan Cui,
linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org
On 10. Mar 2025, at 21:21, Michael Kelley wrote:
>
> It appears to me that struct vmdata_gpa_direct and struct
> vmadditional_data are also unused. Did you keep them for
> some reason? Or could they also be deleted in this patch?
I kept vmdata_gpa_direct because it is referenced in multiple comments
of other structs, for example:
/* The format must be the same as struct vmdata_gpa_direct */
struct vmbus_channel_packet_page_buffer {
...
}
I only checked the structs used in the union and didn't check
vmadditional_data or any others, but I'll submit a v2 and remove it.
Thanks,
Thorsten
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH] hyperv: Remove unused union and structs
2025-03-10 20:40 ` Thorsten Blum
@ 2025-03-10 20:52 ` Michael Kelley
0 siblings, 0 replies; 4+ messages in thread
From: Michael Kelley @ 2025-03-10 20:52 UTC (permalink / raw)
To: Thorsten Blum
Cc: K. Y. Srinivasan, Haiyang Zhang, Wei Liu, Dexuan Cui,
linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org
From: Thorsten Blum <thorsten.blum@linux.dev> Sent: Monday, March 10, 2025 1:41 PM
>
> On 10. Mar 2025, at 21:21, Michael Kelley wrote:
> >
> > It appears to me that struct vmdata_gpa_direct and struct
> > vmadditional_data are also unused. Did you keep them for
> > some reason? Or could they also be deleted in this patch?
>
> I kept vmdata_gpa_direct because it is referenced in multiple comments
> of other structs, for example:
>
> /* The format must be the same as struct vmdata_gpa_direct */
> struct vmbus_channel_packet_page_buffer {
> ...
> }
Ah, OK. Thanks. There's marginal value in keeping
struct vmdata_gpa_direct so the three comments provide a
text-only reference for keeping these three struct's in sync:
1) vmbus_channel_packet_page_buffer
2) vmbus_channel_packet_multipage_buffer
3) vmbus_packet_mpb_array
I don't know why an actual structure isn't used as the first
part of these three that must be the same. But changing that
is bigger lift because of the field references that would need to
be updated. So I'm good with leaving struct vmdata_gpa_direct,
even though it isn't directly used in C code.
Michael
>
> I only checked the structs used in the union and didn't check
> vmadditional_data or any others, but I'll submit a v2 and remove it.
>
> Thanks,
> Thorsten
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-03-10 20:52 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-10 19:26 [PATCH] hyperv: Remove unused union and structs Thorsten Blum
2025-03-10 20:21 ` Michael Kelley
2025-03-10 20:40 ` Thorsten Blum
2025-03-10 20:52 ` Michael Kelley
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.