Skip to contentSkip to conversation

hyperv: reduce size of ms_hyperv_info

PATCH Superseded Olaf Hering 3 participants 4 messages Sep 18, 2023 – Sep 22, 2023

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hyperv: reduce size of ms_hyperv_info

Use the hole prior shared_gpa_boundary to store the result of get_vtl. This reduces the size by 8 bytes.

---
 include/asm-generic/mshyperv.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/asm-generic/mshyperv.h +1 -1
index cecd2b7bd033..bdee5fbaaf40 100644
@@ -53,8 +53,8 @@ struct ms_hyperv_info {
 			u32 reserved_b2 : 20;
 		};
 	};
-	u64 shared_gpa_boundary;
 	u8 vtl;
+	u64 shared_gpa_boundary;
 };
 extern struct ms_hyperv_info ms_hyperv;
 extern bool hv_nested;
maintainer
#1 lore raw
Quoted 9 lines

From: Olaf Hering <[email protected]>
Sent: Monday, September 18, 2023 9:02 AM
[...]
Use the hole prior shared_gpa_boundary to store the result of get_vtl. This reduces the size by 8 bytes.
[...]

include/asm-generic/mshyperv.h struct ms_hyperv_info { · line 60

Quoted 9 lines
include/asm-generic/mshyperv.h +1 -1
@@ -53,8 +53,8 @@ struct ms_hyperv_info {
 			u32 reserved_b2 : 20;
 		};
 	};
-	u64 shared_gpa_boundary;
 	u8 vtl;
+	u64 shared_gpa_boundary;
 };
 extern struct ms_hyperv_info ms_hyperv;
 extern bool hv_nested;

How about moving the 'vtl' field to an even earlier place:

include/asm-generic/mshyperv.h +3 -1
@@ -36,6 +36,9 @@ struct ms_hyperv_info {
        u32 nested_features;
        u32 max_vp_index;
        u32 max_lp_index;
+
+       u8 vtl;
+
        union {
                u32 isolation_config_a;
                struct {
@@ -54,7 +57,6 @@ struct ms_hyperv_info {
                };
        };
        u64 shared_gpa_boundary;
-       u8 vtl;
 };
 extern struct ms_hyperv_info ms_hyperv;
 extern bool hv_nested;

This also reduces the size by 8 bytes, and keeps
the isolation_config_a/ isolation_config_b/ shared_gpa_boundary together, which are related.

#2 lore raw

Tue, 19 Sep 2023 06:18:53 +0000 Dexuan Cui <[email protected]>:

Quoted 1 line

How about moving the 'vtl' field to an even earlier place:

I have not tried it, but I think this would just move the hole up. The end result will likely be the same, pahole -E vmlinux will show it.

Olaf

maintainer
#3 lore raw
In reply to Dexuan Cui
Quoted 42 lines · Dexuan Cui
Quoted 9 lines

From: Olaf Hering <[email protected]>
Sent: Monday, September 18, 2023 9:02 AM
[...]
Use the hole prior shared_gpa_boundary to store the result of get_vtl. This reduces the size by 8 bytes.
[...]

include/asm-generic/mshyperv.h struct ms_hyperv_info { · line 60

Quoted 9 lines
include/asm-generic/mshyperv.h +1 -1
@@ -53,8 +53,8 @@ struct ms_hyperv_info {
 			u32 reserved_b2 : 20;
 		};
 	};
-	u64 shared_gpa_boundary;
 	u8 vtl;
+	u64 shared_gpa_boundary;
 };
 extern struct ms_hyperv_info ms_hyperv;
 extern bool hv_nested;

How about moving the 'vtl' field to an even earlier place:

include/asm-generic/mshyperv.h +3 -1
@@ -36,6 +36,9 @@ struct ms_hyperv_info {
        u32 nested_features;
        u32 max_vp_index;
        u32 max_lp_index;
+
+       u8 vtl;
+
        union {
                u32 isolation_config_a;
                struct {
@@ -54,7 +57,6 @@ struct ms_hyperv_info {
                };
        };
        u64 shared_gpa_boundary;
-       u8 vtl;
 };
 extern struct ms_hyperv_info ms_hyperv;
 extern bool hv_nested;
Quoted 3 lines

This also reduces the size by 8 bytes, and keeps
the isolation_config_a/ isolation_config_b/ shared_gpa_boundary together, which are related.

Either method works for me.

Will there be a v2 of this patch?

Thanks,
Wei.