[PATCH 0/8] Decrease stack size below 2048 bytes

Michal Privoznik via Devel posted 8 patches 8 months, 2 weeks ago
Failed in applying to current master (apply log)
meson.build                |   5 -
src/remote/remote_driver.c | 182 ++++---
src/vbox/vbox_common.c     | 946 ++++++++++++++++++++-----------------
3 files changed, 636 insertions(+), 497 deletions(-)
[PATCH 0/8] Decrease stack size below 2048 bytes
Posted by Michal Privoznik via Devel 8 months, 2 weeks ago
Inspired by Roman's patch:

https://lists.libvirt.org/archives/list/devel@lists.libvirt.org/thread/FNAFORLGXFBL7KPI7RTBWV2ERHX57RIR/

There are two functions where clang produces stack greater than 2048
bytes (our current limit - see @stack_frame_size in meson.build):

  1) doRemoteOpen()
  2) vboxSnapshotRedefine()

It took me a while to realize why a function with a dozen variables
requires ~2300 bytes of stack, until the usual suspect turned in - glib.

Anyway, green pipeline:

https://gitlab.com/MichalPrivoznik/libvirt/-/pipelines/1752604895

and I've verified this compiles cleanly on my FreeBSD-14.1-RELEASE-p4
VM.

Michal Prívozník (8):
  remote_driver: Move URI arg extraction into a separate function
  doRemoteOpen: Move RPC talk to a separate function
  doRemoteOpen: Drop needless typecast of @transport
  vbox: Move parts of vboxSnapshotRedefine() into a separate function
  vbox: Move parts of vboxSnapshotRedefine() into a separate function
  vbox: Move parts of vboxSnapshotRedefine() into a separate function
  vbox: Move parts of vboxSnapshotRedefine() into a separate function
  meson: Drop workaround for -Wframe-larger-than and clang

 meson.build                |   5 -
 src/remote/remote_driver.c | 182 ++++---
 src/vbox/vbox_common.c     | 946 ++++++++++++++++++++-----------------
 3 files changed, 636 insertions(+), 497 deletions(-)

-- 
2.49.0
Re: [PATCH 0/8] Decrease stack size below 2048 bytes
Posted by Ján Tomko via Devel 8 months, 2 weeks ago
On a Friday in 2025, Michal Privoznik via Devel wrote:
>Inspired by Roman's patch:
>
>https://lists.libvirt.org/archives/list/devel@lists.libvirt.org/thread/FNAFORLGXFBL7KPI7RTBWV2ERHX57RIR/
>
>There are two functions where clang produces stack greater than 2048
>bytes (our current limit - see @stack_frame_size in meson.build):
>
>  1) doRemoteOpen()
>  2) vboxSnapshotRedefine()
>
>It took me a while to realize why a function with a dozen variables
>requires ~2300 bytes of stack, until the usual suspect turned in - glib.
>
>Anyway, green pipeline:
>
>https://gitlab.com/MichalPrivoznik/libvirt/-/pipelines/1752604895
>
>and I've verified this compiles cleanly on my FreeBSD-14.1-RELEASE-p4
>VM.
>
>Michal Prívozník (8):
>  remote_driver: Move URI arg extraction into a separate function
>  doRemoteOpen: Move RPC talk to a separate function
>  doRemoteOpen: Drop needless typecast of @transport
>  vbox: Move parts of vboxSnapshotRedefine() into a separate function
>  vbox: Move parts of vboxSnapshotRedefine() into a separate function
>  vbox: Move parts of vboxSnapshotRedefine() into a separate function
>  vbox: Move parts of vboxSnapshotRedefine() into a separate function
>  meson: Drop workaround for -Wframe-larger-than and clang
>
> meson.build                |   5 -
> src/remote/remote_driver.c | 182 ++++---
> src/vbox/vbox_common.c     | 946 ++++++++++++++++++++-----------------
> 3 files changed, 636 insertions(+), 497 deletions(-)
>

Reviewed-by: Ján Tomko <jtomko@redhat.com>

Jano