All of lore.kernel.org
 help / color / mirror / Atom feed
From: seb@frankengul.org
To: "David S. Miller" <davem@davemloft.net>
Cc: netfilter-devel@lists.netfilter.org, bdschuym@pandora.be
Subject: Re: [PATCH] fix iptables on systems with discontiguous processor ids
Date: Thu, 13 Oct 2005 09:18:51 +0200	[thread overview]
Message-ID: <20051013071851.GA2526@frankengul.org> (raw)
In-Reply-To: <20051012.155419.36023860.davem@davemloft.net>

On Wed, Oct 12, 2005 at 03:54:19PM -0700, David S. Miller wrote:
> From: Harald Welte <laforge@netfilter.org>
> Date: Tue, 11 Oct 2005 19:54:57 +0200
> 
> I think I found the bug in your patch Harald.
> 
> > @@ -716,8 +716,8 @@ static int translate_table(const char *n
> >  	}
> >  
> >  	/* And one copy for every other CPU */
> > -	for (i = 1; i < num_possible_cpus(); i++) {
> > -		memcpy(newinfo->entries + SMP_ALIGN(newinfo->size)*i,
> > +	for_each_cpu_mask(i, cpu_possible_map) {
> > +		memcpy(newinfo->entries + SMP_ALIGN(newinfo->size)*(1+i),
> >  		       newinfo->entries,
> >  		       SMP_ALIGN(newinfo->size));
> >  	}
> 
> This isn't correct I think.  It assumes cpu numbers are
> linear :-)
> 
> In the two cpu case of cpu "0" and cpu "2" what this loop
> will do is:
> 
> 1) copy entry 0 to entry 1
> 2) copy entry 0 to entry 3
> 
> which fails to initialize entry 2 and that's how we crash.
> 
> Maybe the loop is better constructed like this (btw, for_each_cpu()
> walks over cpu_possible_map, no need to expand that by hand):
> 
> 	for_each_cpu(i) {
> 		if (i == 0)
> 			continue;
> 
> 		memcpy(newinfo->entries + SMP_ALIGN(newinfo->size) * i,
> 		       newinfo->entries,
> 		       SMP_ALIGN(newinfo->size));
> 	}
> 
> Here is an updated patch, and it takes care of all of the platforms
> that don't export the necessary cpumask symbols.
> 
> Sebastian can you test this one out please?
> 
> Thanks a lot.

You're welcome :).

I'm pleased to announce that the mail i'm writing is on the machine with
your patch applied, and nothing bad happenned in the 5 first minutes.

So I can reasonnably assert that the patch is correct and fix the
problem.

Just one little point: Should the cpu_possible_map be an exported symbol
for all smp arch or not ?

	Seb

  reply	other threads:[~2005-10-13  7:18 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-10 16:41 [PATCH] fix iptables on systems with discontiguous processor ids Harald Welte
2005-10-10 21:15 ` David S. Miller
2005-10-10 21:41   ` Patrick McHardy
2005-10-10 21:52     ` Patrick McHardy
2005-10-10 22:06       ` David S. Miller
2005-10-11 14:23         ` Harald Welte
2005-10-11 19:39           ` David S. Miller
2005-10-12  6:36             ` Harald Welte
2005-10-10 22:04     ` David S. Miller
2005-10-10 21:46   ` Harald Welte
2005-10-11 13:54     ` Henrik Nordstrom
2005-10-11 14:13       ` Eric Dumazet
2005-10-11 17:45         ` Harald Welte
2005-10-11 22:57           ` David S. Miller
2005-10-12  7:00             ` Harald Welte
2005-10-13 22:01             ` Eric Dumazet
2005-10-17  4:18               ` David S. Miller
2005-10-11 10:44   ` Harald Welte
2005-10-11 17:15     ` Bart De Schuymer
2005-10-11 17:55       ` Harald Welte
2005-10-11 17:54     ` Harald Welte
2005-10-11 21:54       ` Sébastien Bernard
2005-10-11 22:32         ` David S. Miller
2005-10-12  6:22           ` seb
2005-10-12  6:31             ` David S. Miller
2005-10-12  7:04               ` Sébastien Bernard
2005-10-12  7:34                 ` David S. Miller
2005-10-12  6:43         ` Harald Welte
2005-10-12 22:54       ` David S. Miller
2005-10-13  7:18         ` seb [this message]
2005-10-13 19:11           ` David S. Miller
2005-10-13  8:46         ` Herbert Xu
2005-10-13 21:14           ` David S. Miller
2005-10-13 22:37             ` seb
2005-10-14 18:33             ` Harald Welte
2005-10-10 21:48 ` Sébastien Bernard
2005-10-11 14:23   ` Harald Welte
2005-10-11 20:59     ` Sébastien Bernard
2005-10-11 21:33       ` David S. Miller
2005-10-12  6:40       ` Harald Welte

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=20051013071851.GA2526@frankengul.org \
    --to=seb@frankengul.org \
    --cc=bdschuym@pandora.be \
    --cc=davem@davemloft.net \
    --cc=netfilter-devel@lists.netfilter.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 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.