netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Giacomo <delleceste@gmail.com>
To: netfilter-devel <netfilter-devel@vger.kernel.org>
Subject: linked lists, locking in softirq context -- no ideas ??
Date: Fri, 27 Feb 2009 09:07:31 +0100	[thread overview]
Message-ID: <885896af0902270007i7d3c5750n2c2c80f9a559665d@mail.gmail.com> (raw)

Hi to all...
do not know if the mailing list received this message - nobody can answer?

Thanks so much

giacomo


---------- Forwarded message ----------
From: Giacomo <delleceste@gmail.com>
Date: 2009/2/23
Subject: linked lists, locking in softirq context
To: netfilter-devel <netfilter-devel@vger.kernel.org>



Harald Welte's "The journey of a packet through the Linux 2.6.10
network stack" article says that packet travelling inside
linux kernel 2.6 (the receive / input part) runs in softirq context.

Hooking with netfilter's hooks in a kernel module, i need to read for
each packet received a list of rules.

Since in input and prerouting hooks the context is softirq (perhaps
also in forward?), I need some read lock
feature.

I currently use RCU lists and, while reading lists I use

READ

read_lock_bh()

together with list_for_each_rcu()

When changing, or flushing, rules, I use

WRITE

spin_lock() + list_add_tail_rcu() (adding)

or spin_lock() + list_for_each_entry() (for listing and then freeing
with list_del_rcu() and call_rcu() )

The question is:

- is the read part above correct? - do I really need _bh()? or should
I use simply read_lock() ?

Thanks in advance

Giacomo



--
Giacomo S.
http://www.giacomos.it

- - - - - - - - - - - - - - - - - - - - - -

* Aprile 2008: iqfire-wall, un progetto
 open source che implementa un
 filtro di pacchetti di rete per Linux,
 e` disponibile per il download qui:
 http://sourceforge.net/projects/ipfire-wall

* Informazioni e pagina web ufficiale:
 http://www.giacomos.it/iqfire/index.html

- - - - - - - - - - - - - - - - - - - - - -

 . ''  `.
:   :'    :
 `.  ` '
   `- Debian GNU/Linux -- The power of freedom
       http://www.debian.org



-- 
Giacomo S.
http://www.giacomos.it

- - - - - - - - - - - - - - - - - - - - - -

* Aprile 2008: iqfire-wall, un progetto
  open source che implementa un
  filtro di pacchetti di rete per Linux,
  e` disponibile per il download qui:
  http://sourceforge.net/projects/ipfire-wall

* Informazioni e pagina web ufficiale:
  http://www.giacomos.it/iqfire/index.html

- - - - - - - - - - - - - - - - - - - - - -

 . ''  `.
:   :'    :
 `.  ` '
    `- Debian GNU/Linux -- The power of freedom
        http://www.debian.org
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

                 reply	other threads:[~2009-02-27  8:07 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=885896af0902270007i7d3c5750n2c2c80f9a559665d@mail.gmail.com \
    --to=delleceste@gmail.com \
    --cc=netfilter-devel@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).