All of lore.kernel.org
 help / color / mirror / Atom feed
From: Martin Josefsson <gandalf@wlug.westbo.se>
To: Bart De Schuymer <bdschuym@pandora.be>
Cc: "David S. Miller" <davem@davemloft.net>,
	shemminger@osdl.org, dwmw2@infradead.org, ak@suse.de,
	snort2004@mail.ru, bridge@osdl.org, netdev@oss.sgi.com,
	Rusty Russell <rusty@rustcorp.com.au>
Subject: Re: [PATCH/RFC] Reduce call chain length in netfilter (was: Re: do_IRQ: stack overflow: 872..)
Date: Sun, 23 Jan 2005 00:22:33 +0100	[thread overview]
Message-ID: <1106436153.20995.42.camel@tux.rsn.bth.se> (raw)
In-Reply-To: <1106433059.4486.11.camel@localhost.localdomain>

[-- Attachment #1: Type: text/plain, Size: 1557 bytes --]

On Sat, 2005-01-22 at 23:30 +0100, Bart De Schuymer wrote:

Hi Bart

> @@ -138,23 +139,34 @@ void nf_log_packet(int pf,
>  /* This is gross, but inline doesn't cut it for avoiding the function
>     call in fast path: gcc doesn't inline (needs value tracking?). --RR */
>  #ifdef CONFIG_NETFILTER_DEBUG
> -#define NF_HOOK(pf, hook, skb, indev, outdev, okfn)			\
> - nf_hook_slow((pf), (hook), (skb), (indev), (outdev), (okfn), INT_MIN)
> -#define NF_HOOK_THRESH nf_hook_slow
> +#define NF_HOOK(pf, hook, skb, indev, outdev, okfn)			    \
> +({int __ret = 0;							    \
> +if (!nf_hook_slow(pf, hook, &(skb), indev, outdev, okfn, INT_MIN, &__ret);  \
> +	__ret = (okfn)(skb);						    \
> +__ret;})
> +#define NF_HOOK_THRESH(pf, hook, skb, indev, outdev, okfn, thresh)	    \
> +({int __ret = 0;							    \
> +if (!nf_hook_slow(pf, hook, &(skb), indev, outdev, okfn, thresh, &__ret);   \
> +	__ret = (okfn)(skb);						    \
> +__ret;})
>  #else

I guess you never testcompiled with CONFIG_NETFILTER_DEBUG set :)
The if-statements above needs to have ; replaced with )

> +			if (verdict > NF_MAX_VERDICT) {
> +				NFDEBUG("Evil return from %p(%u).\n",
> +				        elem->hook, hook);
> +				continue;
> +			}

Maybe add unlikely() around the test?

Otherwise the changes look sane.

The reoganisation of things in nf_hook_slow() shouldn't cause any
performance changes, I tried to benchmark various variations of that
code some time ago but the result of the changes were more or less in
the noise.

-- 
/Martin

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Martin Josefsson <gandalf@wlug.westbo.se>
To: Bart De Schuymer <bdschuym@pandora.be>
Cc: netdev@oss.sgi.com, bridge@osdl.org, snort2004@mail.ru,
	Rusty Russell <rusty@rustcorp.com.au>,
	dwmw2@infradead.org, "David S. Miller" <davem@davemloft.net>,
	shemminger@osdl.org, ak@suse.de
Subject: [Bridge] Re: [PATCH/RFC] Reduce call chain length in netfilter (was: Re: do_IRQ: stack overflow: 872..)
Date: Sun, 23 Jan 2005 00:22:33 +0100	[thread overview]
Message-ID: <1106436153.20995.42.camel@tux.rsn.bth.se> (raw)
In-Reply-To: <1106433059.4486.11.camel@localhost.localdomain>

[-- Attachment #1: Type: text/plain, Size: 1557 bytes --]

On Sat, 2005-01-22 at 23:30 +0100, Bart De Schuymer wrote:

Hi Bart

> @@ -138,23 +139,34 @@ void nf_log_packet(int pf,
>  /* This is gross, but inline doesn't cut it for avoiding the function
>     call in fast path: gcc doesn't inline (needs value tracking?). --RR */
>  #ifdef CONFIG_NETFILTER_DEBUG
> -#define NF_HOOK(pf, hook, skb, indev, outdev, okfn)			\
> - nf_hook_slow((pf), (hook), (skb), (indev), (outdev), (okfn), INT_MIN)
> -#define NF_HOOK_THRESH nf_hook_slow
> +#define NF_HOOK(pf, hook, skb, indev, outdev, okfn)			    \
> +({int __ret = 0;							    \
> +if (!nf_hook_slow(pf, hook, &(skb), indev, outdev, okfn, INT_MIN, &__ret);  \
> +	__ret = (okfn)(skb);						    \
> +__ret;})
> +#define NF_HOOK_THRESH(pf, hook, skb, indev, outdev, okfn, thresh)	    \
> +({int __ret = 0;							    \
> +if (!nf_hook_slow(pf, hook, &(skb), indev, outdev, okfn, thresh, &__ret);   \
> +	__ret = (okfn)(skb);						    \
> +__ret;})
>  #else

I guess you never testcompiled with CONFIG_NETFILTER_DEBUG set :)
The if-statements above needs to have ; replaced with )

> +			if (verdict > NF_MAX_VERDICT) {
> +				NFDEBUG("Evil return from %p(%u).\n",
> +				        elem->hook, hook);
> +				continue;
> +			}

Maybe add unlikely() around the test?

Otherwise the changes look sane.

The reoganisation of things in nf_hook_slow() shouldn't cause any
performance changes, I tried to benchmark various variations of that
code some time ago but the result of the changes were more or less in
the noise.

-- 
/Martin

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2005-01-22 23:22 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1131604877.20041218092730@mail.ru.suse.lists.linux.kernel>
2004-12-18  7:50 ` do_IRQ: stack overflow: 872 Andi Kleen
2004-12-18 11:12   ` Bart De Schuymer
2004-12-18 11:14     ` Andi Kleen
2004-12-18 11:51       ` Bart De Schuymer
2004-12-18 13:53         ` Andi Kleen
2004-12-18 16:07           ` Re[2]: " Crazy AMD K7
2004-12-18 16:46             ` Bart De Schuymer
2005-01-07 17:05   ` David Woodhouse
2005-01-07 18:00     ` Stephen Hemminger
2005-01-07 18:00       ` [Bridge] " Stephen Hemminger
2005-01-07 18:06       ` David Woodhouse
2005-01-07 18:06         ` [Bridge] " David Woodhouse
2005-01-07 21:27       ` Bart De Schuymer
2005-01-07 21:27         ` [Bridge] " Bart De Schuymer
2005-01-18 21:57         ` David S. Miller
2005-01-18 21:57           ` [Bridge] " David S. Miller
2005-01-22 22:30           ` [PATCH/RFC] Reduce call chain length in netfilter (was: Re: do_IRQ: stack overflow: 872..) Bart De Schuymer
2005-01-22 22:30             ` [Bridge] " Bart De Schuymer
2005-01-22 23:22             ` Martin Josefsson [this message]
2005-01-22 23:22               ` [Bridge] " Martin Josefsson
2005-01-23 12:40               ` Bart De Schuymer
2005-01-23 12:40                 ` [Bridge] " Bart De Schuymer
2005-01-23 16:08                 ` Martin Josefsson
2005-01-23 16:08                   ` [Bridge] " Martin Josefsson
2005-01-26  6:05                   ` David S. Miller
2005-01-26  6:05                     ` [Bridge] " David S. Miller
2005-01-26  9:08                     ` Bart De Schuymer
2005-01-26  9:08                       ` [Bridge] " Bart De Schuymer
2005-01-26 23:49                       ` [PATCH/RFC] Reduce call chain length in netfilter Patrick McHardy
2005-01-26 23:49                         ` [Bridge] " Patrick McHardy
2005-01-27  7:18                         ` David S. Miller
2005-01-27  7:18                           ` [Bridge] " David S. Miller
2005-01-27 17:50                           ` Patrick McHardy
2005-01-27 17:50                             ` [Bridge] " Patrick McHardy
2005-01-27 19:47                             ` David S. Miller
2005-01-27 19:47                               ` [Bridge] " David S. Miller
2005-01-27 21:16                               ` Bart De Schuymer
2005-01-27 21:16                                 ` [Bridge] " Bart De Schuymer
2005-01-27 22:48                               ` Patrick McHardy
2005-01-27 22:48                                 ` [Bridge] " Patrick McHardy
2005-01-27 23:24                                 ` David S. Miller
2005-01-27 23:24                                   ` [Bridge] " David S. Miller
2005-01-28  0:08                                   ` Patrick McHardy
2005-01-28  0:08                                     ` [Bridge] " Patrick McHardy
2005-01-28  0:29                                   ` Rusty Russell
2005-01-28  0:29                                     ` [Bridge] " Rusty Russell
2005-01-28  1:10                                     ` David S. Miller
2005-01-28  1:10                                       ` [Bridge] " David S. Miller
2005-01-28  1:32                                       ` Rusty Russell
2005-01-28  1:32                                         ` [Bridge] " Rusty Russell
2005-01-28  1:35                                         ` Patrick McHardy
2005-01-28  1:35                                           ` [Bridge] " Patrick McHardy

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=1106436153.20995.42.camel@tux.rsn.bth.se \
    --to=gandalf@wlug.westbo.se \
    --cc=ak@suse.de \
    --cc=bdschuym@pandora.be \
    --cc=bridge@osdl.org \
    --cc=davem@davemloft.net \
    --cc=dwmw2@infradead.org \
    --cc=netdev@oss.sgi.com \
    --cc=rusty@rustcorp.com.au \
    --cc=shemminger@osdl.org \
    --cc=snort2004@mail.ru \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.