linux-um archives
 help / color / mirror / Atom feed
From: Blaisorblade <blaisorblade@yahoo.it>
To: user-mode-linux-devel@lists.sourceforge.net
Subject: [uml-devel] slip_init and slirp_init using 12K of stack
Date: Tue, 17 Jan 2006 01:26:12 +0100	[thread overview]
Message-ID: <200601170126.12774.blaisorblade@yahoo.it> (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).
-- 
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
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

             reply	other threads:[~2006-01-17  1:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-17  0:26 Blaisorblade [this message]
2006-01-17  3:41 ` [uml-devel] slip_init and slirp_init using 12K of stack Jeff Dike
2006-01-17 14:11   ` Blaisorblade

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=200601170126.12774.blaisorblade@yahoo.it \
    --to=blaisorblade@yahoo.it \
    --cc=user-mode-linux-devel@lists.sourceforge.net \
    /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