[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <f4a1531d-954b-ae68-a202-8ae4e7e78485@amd.com>
Date: Sat, 18 Feb 2023 08:55:38 -0600
From: Tom Lendacky <thomas.lendacky@....com>
To: Mathias Krause <minipli@...ecurity.net>, kvm@...r.kernel.org
Cc: linux-kernel@...r.kernel.org,
Sean Christopherson <seanjc@...gle.com>,
Paolo Bonzini <pbonzini@...hat.com>
Subject: Re: [PATCH 2/5] KVM: x86: Shrink struct kvm_queued_exception
On 2/13/23 10:33, Mathias Krause wrote:
> Reshuffle the boolean members of struct kvm_queued_exception and make
> them individual bits, allowing denser packing.
>
> This allows us to shrink the object size from 24 to 16 bytes for 64 bit
> builds.
>
> Signed-off-by: Mathias Krause <minipli@...ecurity.net>
> ---
> arch/x86/include/asm/kvm_host.h | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
> index 43329c60a6b5..040eee3e9583 100644
> --- a/arch/x86/include/asm/kvm_host.h
> +++ b/arch/x86/include/asm/kvm_host.h
> @@ -701,13 +701,13 @@ struct kvm_vcpu_xen {
> };
>
> struct kvm_queued_exception {
> - bool pending;
> - bool injected;
> - bool has_error_code;
> + u8 pending : 1;
> + u8 injected : 1;
> + u8 has_error_code : 1;
> + u8 has_payload : 1;
I find doing something like this is clearer and easier to read:
u8 pending : 1,
injected : 1,
has_error_code : 1,
has_payload : 1,
__reserved : 4;
(you don't have to have the __reserved, though). Just throwing it out there.
Thanks,
Tom
> u8 vector;
> u32 error_code;
> unsigned long payload;
> - bool has_payload;
> };
>
> struct kvm_vcpu_arch {
Powered by blists - more mailing lists