From: Tom Lendacky <thomas.lendacky@amd.com>
To: Mathias Krause <minipli@grsecurity.net>, kvm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
Sean Christopherson <seanjc@google.com>,
Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [PATCH 2/5] KVM: x86: Shrink struct kvm_queued_exception
Date: Sat, 18 Feb 2023 08:55:38 -0600 [thread overview]
Message-ID: <f4a1531d-954b-ae68-a202-8ae4e7e78485@amd.com> (raw)
In-Reply-To: <20230213163351.30704-3-minipli@grsecurity.net>
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@grsecurity.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 {
next prev parent reply other threads:[~2023-02-18 14:55 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-13 16:33 [PATCH 0/5] KVM: Put struct kvm_vcpu on a diet Mathias Krause
2023-02-13 16:33 ` [PATCH 1/5] KVM: x86: Shrink struct kvm_pmu Mathias Krause
2023-02-13 16:33 ` [PATCH 2/5] KVM: x86: Shrink struct kvm_queued_exception Mathias Krause
2023-02-18 14:55 ` Tom Lendacky [this message]
2023-02-13 16:33 ` [PATCH 3/5] KVM: Shrink struct kvm_mmu_memory_cache Mathias Krause
2023-02-13 17:08 ` Sean Christopherson
2023-02-14 12:20 ` Mathias Krause
2023-02-13 16:33 ` [PATCH 4/5] KVM: x86: Shrink struct kvm_vcpu_arch Mathias Krause
2023-02-13 16:33 ` [PATCH 5/5] KVM: Shrink struct kvm_vcpu Mathias Krause
2023-02-13 17:05 ` [PATCH 0/5] KVM: Put struct kvm_vcpu on a diet Sean Christopherson
2023-02-14 12:19 ` Mathias Krause
2023-02-16 17:32 ` Sean Christopherson
2023-02-17 16:07 ` Mathias Krause
2023-02-17 16:35 ` Sean Christopherson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f4a1531d-954b-ae68-a202-8ae4e7e78485@amd.com \
--to=thomas.lendacky@amd.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=minipli@grsecurity.net \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome