On Sun, Jan 24, 2016 at 03:56:40PM +0200, Alexandru Ardelean wrote:
> Seems that musl libc's default thread stack size is 80k, which
> causes a segfault (stack overflow actually) when trying to add
> a bridge (via the "ovs-vsctl add-br" command).
> 
> OpenWRT has been switching to musl libc for a few months now.
> So far, we've been using OVS with uClibc, so I did not catch this
> earlier.
> 
> This patch is a RFC:
> - is this thread stack size sufficient ?
> - is this approach acceptable ?

128 kB seems really small for anything other than embedded.  The default
on Linux/x86-32 is 2 MB.

I think it's too small from an absolute perspective, too.  If I run a
command to find large stack allocations (on x86):

    objdump -d vswitchd/ovs-vswitchd|sed -n 
's/.*sub.*\(0x[0-9a-f]*\),%esp/\1/p'|sort -gr|head

then I see, ignoring negative subtractions (!), the following
definitely or potentially problematic sizes:

    0x3662c (~217 kB)
    0x1a1ac (~104 kB)
    0x1004c (~64 kB)

which correspond to the following functions, respectively:

    recv_upcalls()
    dpif_netlink_operate__()
    nl_sock_recv__()

So anything less than about 256 kB is definitely unsafe.  I think that
some of those uses might nest within each other, so I wouldn't recommend
less than about 384 kB, honestly.

But why does this question even come up?  Don't you have a demand-paged
stack?  That is, why does allocating megabytes of virtual address space
for stacks have a cost?
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to