From: Sean Christopherson <seanjc@google.com>
To: avinashlalotra <abinashlalotra@gmail.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
vkuznets@redhat.com, pbonzini@redhat.com, tglx@linutronix.de,
mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com,
x86@kernel.org, hpa@zytor.com,
avinashlalotra <abinashsinghlalotra@gmail.com>
Subject: Re: [RFC PATCH] KVM: x86: Dynamically allocate bitmap to fix -Wframe-larger-than error
Date: Fri, 13 Jun 2025 06:58:02 -0700 [thread overview]
Message-ID: <aEwualvoLvbtbqef@google.com> (raw)
In-Reply-To: <20250613111023.786265-1-abinashsinghlalotra@gmail.com>
On Fri, Jun 13, 2025, avinashlalotra wrote:
> Building the kernel with LLVM fails due to
> a stack frame size overflow in `kvm_hv_flush_tlb()`:
>
> arch/x86/kvm/hyperv.c:2001:12: error: stack frame size (1336) exceeds limit (1024) in 'kvm_hv_flush_tlb' [-Werror,-Wframe-larger-than]
>
> The issue is caused by a large bitmap allocated on the stack. To resolve
> this, dynamically allocate the bitmap using `bitmap_zalloc()` and free it with
> `bitmap_free()` after use. This reduces the function's stack usage and avoids
> the compiler error when `-Werror` is set.
Can you provide your full .config? It's not at all difficult to get this function
(and others) to exceed the frame size with various sanitizers and/or deubg options
enabled, which is why KVM_WERROR depends on EXPERT=y or KASAN=n.
config KVM_WERROR
bool "Compile KVM with -Werror"
# Disallow KVM's -Werror if KASAN is enabled, e.g. to guard against
# randomized configs from selecting KVM_WERROR=y, which doesn't play
# nice with KASAN. KASAN builds generates warnings for the default
# FRAME_WARN, i.e. KVM_WERROR=y with KASAN=y requires special tuning.
# Building KVM with -Werror and KASAN is still doable via enabling
# the kernel-wide WERROR=y.
depends on KVM && ((EXPERT && !KASAN) || WERROR)
And also why kernel/configs/debug.config bumps the size to 2048.
CONFIG_FRAME_WARN=2048
> Please provide me feedback about this patch . There were more warnings like
> that, So If this is the correct way to fic such issues then I will submit
> patches for them.
As above, this may just be a "bad" .config.
next prev parent reply other threads:[~2025-06-13 13:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-13 11:10 [RFC PATCH] KVM: x86: Dynamically allocate bitmap to fix -Wframe-larger-than error avinashlalotra
2025-06-13 11:25 ` Paolo Bonzini
2025-06-13 13:58 ` Sean Christopherson [this message]
2025-06-13 17:17 ` Abinash
2025-06-13 22:24 ` Sean Christopherson
2025-06-24 19:36 ` 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=aEwualvoLvbtbqef@google.com \
--to=seanjc@google.com \
--cc=abinashlalotra@gmail.com \
--cc=abinashsinghlalotra@gmail.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=tglx@linutronix.de \
--cc=vkuznets@redhat.com \
--cc=x86@kernel.org \
/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