From: Thomas Graf <tgraf@suug.ch>
To: "Nordlund Kim (Nokia-NET/Helsinki)" <Kim.Nordlund@nokia.com>
Cc: Patrick McHardy <kaber@trash.net>,
davem@davemloft.net, netdev@vger.kernel.org
Subject: Re: [PKT_SCHED] cls_basic: Use unsigned int when generating handle
Date: Wed, 27 Sep 2006 11:33:01 +0200 [thread overview]
Message-ID: <20060927093301.GY18349@postel.suug.ch> (raw)
In-Reply-To: <Pine.LNX.4.44.0609271104470.9010-100000@dhcp09282.ntc.nokia.com>
* Nordlund Kim (Nokia-NET/Helsinki) <Kim.Nordlund@nokia.com> 2006-09-27 11:50
> basic_change() won't work without this patch if we compile the
> kernel with the GCC version in RHEL5...
>
> gcc version 4.1.1 20060817 (Red Hat 4.1.1-18)
>
> which optimizes the code like this (objdump -S inttest.c) ...
>
> int main()
> {
> 0: 55 push %ebp
> 1: 89 e5 mov %esp,%ebp
> int i = 0x80000000;
> do {
> printf(KERN_ERR "in do %d\n", i);
> 3: 68 00 00 00 80 push $0x80000000
> 8: 68 00 00 00 00 push $0x0
> d: e8 fc ff ff ff call e <main+0xe>
> } while (--i > 0);
> printf(KERN_ERR "out of do %d\n", i);
> 12: 68 00 00 00 80 push $0x80000000
> 17: 68 0a 00 00 00 push $0xa
> 1c: e8 fc ff ff ff call 1d <main+0x1d>
> return 0;
> }
> 21: 31 c0 xor %eax,%eax
> 23: c9 leave
> 24: c3 ret
>
> # ./inttest
> in do -2147483648
> out of do -2147483648
Very interesting, naturally I tried the same after Patrick's
comment but gcc 20060901 produced code as expected, thus
staying in the loop. But now after specifying -Os gcc seems
to turn on some optimziation which produces the same code as
above.
I'm not sure I understand this optimization :-)
> So I would suggest to apply this patch to be compatible with the
> GCC version in RHEL5, and simply to make code clearer (to the
> intended idea).
Yes.
next prev parent reply other threads:[~2006-09-27 9:32 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-26 11:59 [PKT_SCHED] cls_basic: Use unsigned int when generating handle Thomas Graf
2006-09-26 13:32 ` Patrick McHardy
2006-09-26 18:36 ` Thomas Graf
2006-09-27 8:50 ` Nordlund Kim (Nokia-NET/Helsinki)
2006-09-27 9:33 ` Thomas Graf [this message]
2006-09-27 9:44 ` Patrick McHardy
2006-09-27 10:09 ` Thomas Graf
2006-09-27 11:45 ` Nordlund Kim (Nokia-NET/Helsinki)
2006-09-27 23:18 ` David Miller
2006-09-27 23:21 ` David Miller
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=20060927093301.GY18349@postel.suug.ch \
--to=tgraf@suug.ch \
--cc=Kim.Nordlund@nokia.com \
--cc=davem@davemloft.net \
--cc=kaber@trash.net \
--cc=netdev@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).