[libvirt] [PATCH] maint: increase stack frame size limit

Currently the stack frame size limit is set to 4096 and it started to cause an error like this: virshtest.c:253:1: error: stack frame size of 5512 bytes in function 'mymain' [-Werror,-Wframe-larger-than=] mymain(void) ^ 1 error generated. Increase it to 6144. --- m4/virt-compile-warnings.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/m4/virt-compile-warnings.m4 b/m4/virt-compile-warnings.m4 index 8aebdb0..1478753 100644 --- a/m4/virt-compile-warnings.m4 +++ b/m4/virt-compile-warnings.m4 @@ -153,7 +153,7 @@ AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[ # This should be < 256 really. Currently we're down to 4096, # but using 1024 bytes sized buffers (mostly for virStrerror) # stops us from going down further - wantwarn="$wantwarn -Wframe-larger-than=4096" + wantwarn="$wantwarn -Wframe-larger-than=6144" dnl wantwarn="$wantwarn -Wframe-larger-than=256" # Extra special flags -- 2.3.7

Roman Bogorodskiy wrote:
Currently the stack frame size limit is set to 4096 and it started to cause an error like this:
virshtest.c:253:1: error: stack frame size of 5512 bytes in function 'mymain' [-Werror,-Wframe-larger-than=] mymain(void) ^ 1 error generated.
Increase it to 6144.
Worth to mention that it's started to show up after updating to clang 3.6. Roman Bogorodskiy

Roman Bogorodskiy wrote:
Roman Bogorodskiy wrote:
Currently the stack frame size limit is set to 4096 and it started to cause an error like this:
virshtest.c:253:1: error: stack frame size of 5512 bytes in function 'mymain' [-Werror,-Wframe-larger-than=] mymain(void) ^ 1 error generated.
Increase it to 6144.
Worth to mention that it's started to show up after updating to clang 3.6.
Any comments on this? Thanks, Roman Bogorodskiy

On 05/08/2015 12:23 AM, Roman Bogorodskiy wrote:
Roman Bogorodskiy wrote:
Roman Bogorodskiy wrote:
Currently the stack frame size limit is set to 4096 and it started to cause an error like this:
virshtest.c:253:1: error: stack frame size of 5512 bytes in function 'mymain' [-Werror,-Wframe-larger-than=] mymain(void) ^ 1 error generated.
Increase it to 6144.
Worth to mention that it's started to show up after updating to clang 3.6.
Any comments on this?
Have you reported a possible clang regression bug to the clang folks? Or is the new clang version the first one to support what was originally only gcc's -Wframe-larger-than? At any rate, why does clang require a larger stack than gcc? It sounds like in addition to fixing the virshtest.c file to quit stack-allocating such a large amount of space, that you should also be letting the clang compiler folks know about their weakness. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

Eric Blake wrote:
On 05/08/2015 12:23 AM, Roman Bogorodskiy wrote:
Roman Bogorodskiy wrote:
Roman Bogorodskiy wrote:
Currently the stack frame size limit is set to 4096 and it started to cause an error like this:
virshtest.c:253:1: error: stack frame size of 5512 bytes in function 'mymain' [-Werror,-Wframe-larger-than=] mymain(void) ^ 1 error generated.
Increase it to 6144.
Worth to mention that it's started to show up after updating to clang 3.6.
Any comments on this?
Have you reported a possible clang regression bug to the clang folks? Or is the new clang version the first one to support what was originally only gcc's -Wframe-larger-than? At any rate, why does clang require a larger stack than gcc? It sounds like in addition to fixing the virshtest.c file to quit stack-allocating such a large amount of space, that you should also be letting the clang compiler folks know about their weakness.
I wasn't absolutely sure that it is a clang problem. However, I did a check now on the same libvirt revision and on the same system with different clang versions and figured out that things work fine with: clang version 3.4.2 (tags/RELEASE_34/dot2-final) but start breaking on: clang version 3.5.2 (tags/RELEASE_352/final) So it indeed makes sense to ask clang developers what's going on; will do that. I'll also try to figure out how to rewrite virshtest.c to quite stack-allocation. Thanks for the feedback! Roman Bogorodskiy

Roman Bogorodskiy wrote:
Eric Blake wrote:
On 05/08/2015 12:23 AM, Roman Bogorodskiy wrote:
Roman Bogorodskiy wrote:
Roman Bogorodskiy wrote:
Currently the stack frame size limit is set to 4096 and it started to cause an error like this:
virshtest.c:253:1: error: stack frame size of 5512 bytes in function 'mymain' [-Werror,-Wframe-larger-than=] mymain(void) ^ 1 error generated.
Increase it to 6144.
Worth to mention that it's started to show up after updating to clang 3.6.
Any comments on this?
Have you reported a possible clang regression bug to the clang folks? Or is the new clang version the first one to support what was originally only gcc's -Wframe-larger-than? At any rate, why does clang require a larger stack than gcc? It sounds like in addition to fixing the virshtest.c file to quit stack-allocating such a large amount of space, that you should also be letting the clang compiler folks know about their weakness.
I wasn't absolutely sure that it is a clang problem. However, I did a check now on the same libvirt revision and on the same system with different clang versions and figured out that things work fine with:
clang version 3.4.2 (tags/RELEASE_34/dot2-final)
but start breaking on:
clang version 3.5.2 (tags/RELEASE_352/final)
So it indeed makes sense to ask clang developers what's going on; will do that.
I'll also try to figure out how to rewrite virshtest.c to quite stack-allocation.
Thanks for the feedback!
I've been playing with virshtest and then figured out that there are other tests using the similar scheme (sockettest for example, and many others). I came to a conclusion that rewriting tests doesn't worth an effort, at least at this point. In the meantime, I've posted a question on the clang mailing list: http://lists.cs.uiuc.edu/pipermail/cfe-dev/2015-May/042890.html Hopefully it'll help to understand why clang behaves this way. Roman Bogorodskiy

Roman Bogorodskiy wrote:
Roman Bogorodskiy wrote:
Eric Blake wrote:
On 05/08/2015 12:23 AM, Roman Bogorodskiy wrote:
Roman Bogorodskiy wrote:
Roman Bogorodskiy wrote:
Currently the stack frame size limit is set to 4096 and it started to cause an error like this:
virshtest.c:253:1: error: stack frame size of 5512 bytes in function 'mymain' [-Werror,-Wframe-larger-than=] mymain(void) ^ 1 error generated.
Increase it to 6144.
Worth to mention that it's started to show up after updating to clang 3.6.
Any comments on this?
Have you reported a possible clang regression bug to the clang folks? Or is the new clang version the first one to support what was originally only gcc's -Wframe-larger-than? At any rate, why does clang require a larger stack than gcc? It sounds like in addition to fixing the virshtest.c file to quit stack-allocating such a large amount of space, that you should also be letting the clang compiler folks know about their weakness.
I wasn't absolutely sure that it is a clang problem. However, I did a check now on the same libvirt revision and on the same system with different clang versions and figured out that things work fine with:
clang version 3.4.2 (tags/RELEASE_34/dot2-final)
but start breaking on:
clang version 3.5.2 (tags/RELEASE_352/final)
So it indeed makes sense to ask clang developers what's going on; will do that.
I'll also try to figure out how to rewrite virshtest.c to quite stack-allocation.
Thanks for the feedback!
I've been playing with virshtest and then figured out that there are other tests using the similar scheme (sockettest for example, and many others). I came to a conclusion that rewriting tests doesn't worth an effort, at least at this point.
In the meantime, I've posted a question on the clang mailing list:
http://lists.cs.uiuc.edu/pipermail/cfe-dev/2015-May/042890.html
Hopefully it'll help to understand why clang behaves this way.
I've got a reply that implies that it's expected behavior for -O0. Unfortunately, once it's replaced with -O1 or higher optimization levels, it triggers the function inlining problem that prevents proper mocking. Frankly, these all make using clang for libvirt development quite onerous and I'm not sure if it makes sense trying to fix it rather than using gcc. Roman Bogorodskiy

On 05/03/2015 10:22 AM, Roman Bogorodskiy wrote:
Currently the stack frame size limit is set to 4096 and it started to cause an error like this:
virshtest.c:253:1: error: stack frame size of 5512 bytes in function 'mymain' [-Werror,-Wframe-larger-than=] mymain(void) ^ 1 error generated.
Increase it to 6144.
NACK. 4096 is there for a reason; we do NOT want to exceed a page size. Instead, we need to fix virshtest.c to quit stack-allocating such a large structure. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
participants (2)
-
Eric Blake
-
Roman Bogorodskiy