[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250416190630.GA1037529.vipinsh@google.com>
Date: Wed, 16 Apr 2025 12:06:30 -0700
From: Vipin Sharma <vipinsh@...gle.com>
To: Sean Christopherson <seanjc@...gle.com>
Cc: Paolo Bonzini <pbonzini@...hat.com>, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 2/3] KVM: x86: Allocate kvm_vmx/kvm_svm structures
using kzalloc()
On 2025-04-16 11:24:37, Vipin Sharma wrote:
> On 2025-04-01 08:57:13, Sean Christopherson wrote:
> >
> > + BUILD_BUG_ON(get_order(sizeof(struct kvm_svm) != 0));
>
> There is a typo here. It is checking sizeof(struct kvm_svm) != 0, instead
> of checking get_order(...) != 0.
>
> > return 0;
> >
> > err_kvm_init:
> > diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
> > index b70ed72c1783..01264842bf45 100644
> > --- a/arch/x86/kvm/vmx/vmx.c
> > +++ b/arch/x86/kvm/vmx/vmx.c
> > @@ -8755,6 +8755,7 @@ static int __init vmx_init(void)
> > if (r)
> > goto err_kvm_init;
> >
> > + BUILD_BUG_ON(get_order(sizeof(struct kvm_vmx) != 0));
>
> Same as above.
>
After fixing the typo build is failing.
Checked via pahole, sizes of struct have reduced but still not under 4k.
After applying the patch:
struct kvm{} - 4104
struct kvm_svm{} - 4320
struct kvm_vmx{} - 4128
Also, this BUILD_BUG_ON() might not be reliable unless all of the ifdefs
under kvm_[vmx|svm] and its children are enabled. Won't that be an
issue?
Powered by blists - more mailing lists