From: Xiaoyao Li <xiaoyao.li@intel.com>
To: Sean Christopherson <seanjc@google.com>,
Paolo Bonzini <pbonzini@redhat.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
Vipin Sharma <vipinsh@google.com>,
James Houghton <jthoughton@google.com>
Subject: Re: [PATCH v4 3/4] KVM: x86: Use kvzalloc() to allocate VM struct
Date: Wed, 28 May 2025 16:35:52 +0800 [thread overview]
Message-ID: <aea0cc02-3b18-4c7e-9108-ab5e923051bf@intel.com> (raw)
In-Reply-To: <20250523001138.3182794-4-seanjc@google.com>
On 5/23/2025 8:11 AM, Sean Christopherson wrote:
> Allocate VM structs via kvzalloc(), i.e. try to use a contiguous physical
> allocation before falling back to __vmalloc(), to avoid the overhead of
> establishing the virtual mappings. For non-debug builds, The SVM and VMX
> (and TDX) structures are now just below 7000 bytes in the worst case
> scenario (see below), i.e. are order-1 allocations, and will likely remain
> that way for quite some time.
>
> Add compile-time assertions in vendor code to ensure the size of the
> structures, sans the memslos hash tables, are order-0 allocations, i.e.
s/memslos/memslots
> are less than 4KiB. There's nothing fundamentally wrong with a larger
> kvm_{svm,vmx,tdx} size, but given that the size of the structure (without
> the memslots hash tables) is below 2KiB after 18+ years of existence,
> more than doubling the size would be quite notable.
>
> Add sanity checks on the memslot hash table sizes, partly to ensure they
> aren't resized without accounting for the impact on VM structure size, and
> partly to document that the majority of the size of VM structures comes
> from the memslots.
>
> Signed-off-by: Sean Christopherson <seanjc@google.com>
Reviewed-by: Xiaoyao Li <xiaoyao.li@intel.com>
next prev parent reply other threads:[~2025-05-28 8:35 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-23 0:11 [PATCH v4 0/4] KVM: x86: Dynamically allocate hashed page list Sean Christopherson
2025-05-23 0:11 ` [PATCH v4 1/4] KVM: TDX: Move TDX hardware setup from main.c to tdx.c Sean Christopherson
2025-05-23 2:27 ` Xiaoyao Li
2025-05-23 6:40 ` Xiaoyao Li
2025-05-23 11:31 ` Huang, Kai
2025-05-23 0:11 ` [PATCH v4 2/4] KVM: x86/mmu: Dynamically allocate shadow MMU's hashed page list Sean Christopherson
2025-05-28 8:04 ` Xiaoyao Li
2025-05-28 12:54 ` Sean Christopherson
2025-06-24 19:48 ` Sean Christopherson
2025-05-23 0:11 ` [PATCH v4 3/4] KVM: x86: Use kvzalloc() to allocate VM struct Sean Christopherson
2025-05-28 8:35 ` Xiaoyao Li [this message]
2025-05-23 0:11 ` [PATCH v4 4/4] KVM: x86/mmu: Defer allocation of shadow MMU's hashed page list Sean Christopherson
2025-06-24 19:38 ` [PATCH v4 0/4] KVM: x86: Dynamically allocate " Sean Christopherson
2025-06-24 21:12 ` 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=aea0cc02-3b18-4c7e-9108-ab5e923051bf@intel.com \
--to=xiaoyao.li@intel.com \
--cc=jthoughton@google.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=vipinsh@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
all inboxes | Powered by JetHome®