Skip to contentSkip to conversation

slip_init and slirp_init using 12K of stack

uml-devel Blaisorblade 2 participants 3 messages Jan 17, 2006 User-mode Linux (UML)

lore
Share & tools
lore
#0 lore raw

I ran by accident scripts/checkstack.pl and found that slip_init and slirp_init are two big offenders.

They are since of such lines:

        *spri = ((struct slip_data)
                { .name         = { '\0' },
                  .addr         = NULL,
                  .gate_addr    = init->gate_addr,
                  .slave        = -1,
                  .slip         = SLIP_PROTO_INIT,
                  .dev          = dev });

This is compiled (as it seems from the assembly, and as I read from a discussion on LKML on how badly GCC optimizes that) compiled as "set this up on the stack, memcpy it on the stack, and memcpy it on the final area".

struct slip_data (and the same for slirp_data) contains slip_proto, which is 6K wide (has two large buffers). Having it twice on the stack gives 12k, which explains this output:

$ objdump -d
/home/paolo/Admin/kernel/6/VCS/um-linux-2.6.15-build/vmlinux| ./scripts/checkstack.pl 
i386|head -20
0xa021e0a6 _IO_vfwprintf:                               37512
0xa0020d62 slirp_init:                                  12880
0xa0020e8a slirp_init:                                  12880
0xa0020258 slip_init:                                   12112
0xa0020351 slip_init:                                   12112
...
0xa000515c make_umid_setup:                             4144
0xa002bc16 make_tempfile:                               4128
0xa002bd29 make_tempfile:                               4128

(I remember these to store a PATH_MAX char array on the stack). But make_umid_setup just disappeared (the rewritten umid abstraction doesn't use significant stack space).

Signature · 24 lines
Inform me of my mistakes, so I can keep imitating Homer Simpson's "Doh!".
Paolo Giarrusso, aka Blaisorblade (Skype ID "PaoloGiarrusso", ICQ 215621894)
http://www.user-mode-linux.org/~blaisorblade


	

	
		
___________________________________ 
Yahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB 
http://mail.yahoo.it



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
#1 lore raw
Quoted 5 lines · Blaisorblade

I ran by accident scripts/checkstack.pl and found that slip_init and slirp_init are two big offenders.

They are since of such lines:

Quoted 7 lines
        *spri = ((struct slip_data)
                { .name         = { '\0' },
                  .addr         = NULL,
                  .gate_addr    = init->gate_addr,
                  .slave        = -1,
                  .slip         = SLIP_PROTO_INIT,
                  .dev          = dev });

Yuck, I guess it's time to initialize that field-by-field.

Jeff

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

#2 lore raw
Quoted 14 lines · Jeff Dike
Quoted 5 lines · Blaisorblade

I ran by accident scripts/checkstack.pl and found that slip_init and slirp_init are two big offenders.

They are since of such lines:

Quoted 7 lines
        *spri = ((struct slip_data)
                { .name         = { '\0' },
                  .addr         = NULL,
                  .gate_addr    = init->gate_addr,
                  .slave        = -1,
                  .slip         = SLIP_PROTO_INIT,
                  .dev          = dev });
Quoted 1 line

Yuck, I guess it's time to initialize that field-by-field.

Yep, done... I'll flush my queue when you're done with yours, there are too many conflicts right now. What about getting TLS in in this cycle (after -rc1, the freeze is less strict for us in practice)? If yes, I'm going to take care at it - I'm cleaning it anyway.

Signature · 23 lines
Inform me of my mistakes, so I can keep imitating Homer Simpson's "Doh!".
Paolo Giarrusso, aka Blaisorblade (Skype ID "PaoloGiarrusso", ICQ 215621894)
http://www.user-mode-linux.org/~blaisorblade

	

	
		
___________________________________ 
Yahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB 
http://mail.yahoo.it



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel