[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aCyqs4VdPsw4mA_F@google.com>
Date: Tue, 20 May 2025 09:15:47 -0700
From: Sean Christopherson <seanjc@...gle.com>
To: Paolo Bonzini <pbonzini@...hat.com>, kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
Vipin Sharma <vipinsh@...gle.com>
Subject: Re: [PATCH v3 2/3] KVM: x86: Use kvzalloc() to allocate VM struct
On Fri, May 16, 2025, Sean Christopherson wrote:
> +/*
> + * Assert that "struct kvm_{svm,vmx,tdx}" is an order-0 or order-1 allocation.
> + * Spilling over to an order-2 allocation isn't fundamentally problematic, but
> + * isn't expected to happen in the foreseeable future (O(years)). Assert that
> + * the size is an order-0 allocation when ignoring the memslot hash tables, to
> + * help detect and debug unexpected size increases.
> + */
> +#define KVM_SANITY_CHECK_VM_STRUCT_SIZE(x) \
> +do { \
> + BUILD_BUG_ON(get_order(sizeof(struct x) - SIZE_OF_MEMSLOTS_HASHTABLE) && \
> + !IS_ENABLED(CONFIG_DEBUG_KERNEL) && !IS_ENABLED(CONFIG_KASAN)); \
> + BUILD_BUG_ON(get_order(sizeof(struct x)) < 2 && \
Ugh, I jinxed myself. My severe ineptitude and inability to test persists. I
inverted this check, it should be:
get_order(sizeof(struct x)) >= 2
> + !IS_ENABLED(CONFIG_DEBUG_KERNEL) && !IS_ENABLED(CONFIG_KASAN)); \
> +} while (0)
> +
> #define KVM_NESTED_VMENTER_CONSISTENCY_CHECK(consistency_check) \
> ({ \
> bool failed = (consistency_check); \
> --
> 2.49.0.1112.g889b7c5bd8-goog
>
Powered by blists - more mailing lists