netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: Eric Dumazet <edumazet@google.com>
Cc: Florian Westphal <fw@strlen.de>, netdev <netdev@vger.kernel.org>,
	Dan Williams <dcbw@redhat.com>
Subject: Re: [PATCH v2 nf-next 1/2] netfilter: x_tables: make xt_replace_table wait until old rules are not used anymore
Date: Wed, 11 Oct 2017 15:45:30 +0200	[thread overview]
Message-ID: <20171011134530.GA26835@breakpoint.cc> (raw)
In-Reply-To: <CANn89i+Y9CtNq6qTGAWi7fNfk9RRyxsuY1e2+SBCd1xRYx77zw@mail.gmail.com>

Eric Dumazet <edumazet@google.com> wrote:
> > +       /* ... so wait for even xt_recseq on all cpus */
> > +       for_each_possible_cpu(cpu) {
> > +               seqcount_t *s = &per_cpu(xt_recseq, cpu);
> > +
> > +               while (raw_read_seqcount(s) & 1)
> > +                       cpu_relax();
> > +
> > +               cond_resched();
> > +       }
> 
> It seems that we could also check :
> 
> 1) If low order bit of sequence is 0
>
> Or
> 
> 2) the value has changed
>        for_each_possible_cpu(cpu) {
>                 seqcount_t *s = &per_cpu(xt_recseq, cpu);
>                  u32 seq = raw_read_seqcount(s) ;
> 
>                  if (seq & 1) {
>                         do {
>                             cpu_relax();
>                           } while (seq == raw_read_seqcount(s));
> 

Actually I first used

for_each_possible_cpu(cpu) {
  seqcount_t *s = &per_cpu(xt_recseq, cpu);

  (void)__read_seqcount_begin(s);
}

but it looked confusing (not paired with a _retry function).
I'll respin with a loop like your suggestion above.  Thanks!

  reply	other threads:[~2017-10-11 13:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-10 21:39 [PATCH v2 nf-next] netfilter: x_tables: speed up iptables-restore Florian Westphal
2017-10-10 21:39 ` [PATCH v2 nf-next 1/2] netfilter: x_tables: make xt_replace_table wait until old rules are not used anymore Florian Westphal
2017-10-11 13:23   ` Eric Dumazet
2017-10-11 13:45     ` Florian Westphal [this message]
2017-10-10 21:39 ` [PATCH v2 nf-next 2/2] netfilter: x_tables: don't use seqlock when fetching old counters Florian Westphal

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=20171011134530.GA26835@breakpoint.cc \
    --to=fw@strlen.de \
    --cc=dcbw@redhat.com \
    --cc=edumazet@google.com \
    --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).