All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] hyperv: reduce size of ms_hyperv_info
@ 2023-09-18 16:01 Olaf Hering
  2023-09-19  6:18 ` Dexuan Cui
  0 siblings, 1 reply; 4+ messages in thread
From: Olaf Hering @ 2023-09-18 16:01 UTC (permalink / raw)
  To: linux-hyperv, linux-arch, linux-kernel
  Cc: K. Y. Srinivasan, Haiyang Zhang, Wei Liu, Dexuan Cui, Arnd Bergmann

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

Signed-off-by: Olaf Hering <olaf@aepfle.de>
---
 include/asm-generic/mshyperv.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/asm-generic/mshyperv.h b/include/asm-generic/mshyperv.h
index cecd2b7bd033..bdee5fbaaf40 100644
--- a/include/asm-generic/mshyperv.h
+++ b/include/asm-generic/mshyperv.h
@@ -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;

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

* RE: [PATCH v1] hyperv: reduce size of ms_hyperv_info
  2023-09-18 16:01 [PATCH v1] hyperv: reduce size of ms_hyperv_info Olaf Hering
@ 2023-09-19  6:18 ` Dexuan Cui
  2023-09-19  7:12   ` Olaf Hering
  2023-09-22 18:44   ` Wei Liu
  0 siblings, 2 replies; 4+ messages in thread
From: Dexuan Cui @ 2023-09-19  6:18 UTC (permalink / raw)
  To: Olaf Hering, linux-hyperv, linux-arch, linux-kernel
  Cc: KY Srinivasan, Haiyang Zhang, Wei Liu, Arnd Bergmann

> From: Olaf Hering <olaf@aepfle.de>
> 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.
>  [...]
> --- a/include/asm-generic/mshyperv.h
> +++ b/include/asm-generic/mshyperv.h
> @@ -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:

--- a/include/asm-generic/mshyperv.h
+++ b/include/asm-generic/mshyperv.h
@@ -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.

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

* Re: [PATCH v1] hyperv: reduce size of ms_hyperv_info
  2023-09-19  6:18 ` Dexuan Cui
@ 2023-09-19  7:12   ` Olaf Hering
  2023-09-22 18:44   ` Wei Liu
  1 sibling, 0 replies; 4+ messages in thread
From: Olaf Hering @ 2023-09-19  7:12 UTC (permalink / raw)
  To: Dexuan Cui
  Cc: linux-hyperv, linux-arch, linux-kernel, KY Srinivasan,
	Haiyang Zhang, Wei Liu, Arnd Bergmann

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

Tue, 19 Sep 2023 06:18:53 +0000 Dexuan Cui <decui@microsoft.com>:

> 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

[-- Attachment #2: Digitale Signatur von OpenPGP --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH v1] hyperv: reduce size of ms_hyperv_info
  2023-09-19  6:18 ` Dexuan Cui
  2023-09-19  7:12   ` Olaf Hering
@ 2023-09-22 18:44   ` Wei Liu
  1 sibling, 0 replies; 4+ messages in thread
From: Wei Liu @ 2023-09-22 18:44 UTC (permalink / raw)
  To: Dexuan Cui
  Cc: Olaf Hering, linux-hyperv, linux-arch, linux-kernel,
	KY Srinivasan, Haiyang Zhang, Wei Liu, Arnd Bergmann

On Tue, Sep 19, 2023 at 06:18:53AM +0000, Dexuan Cui wrote:
> > From: Olaf Hering <olaf@aepfle.de>
> > 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.
> >  [...]
> > --- a/include/asm-generic/mshyperv.h
> > +++ b/include/asm-generic/mshyperv.h
> > @@ -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:
> 
> --- a/include/asm-generic/mshyperv.h
> +++ b/include/asm-generic/mshyperv.h
> @@ -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.

Either method works for me.

Will there be a v2 of this patch?

Thanks,
Wei.

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

end of thread, other threads:[~2023-09-22 18:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-18 16:01 [PATCH v1] hyperv: reduce size of ms_hyperv_info Olaf Hering
2023-09-19  6:18 ` Dexuan Cui
2023-09-19  7:12   ` Olaf Hering
2023-09-22 18:44   ` Wei Liu

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.