All of lore.kernel.org
 help / color / mirror / Atom feed
From: Maris Paupe <marisp@mt.lv>
To: netdev@vger.kernel.org
Subject: [PATCH]  flow_cache_flush soft lockup with heavy ipsec traffic
Date: Wed, 09 Nov 2011 14:21:12 +0200	[thread overview]
Message-ID: <4EBA7038.4050702@mt.lv> (raw)


During ipsec packet processing flow_cache_flush() may get called which 
creates flow_cache_gc_taklet(), this function is guarded by mutex and 
waits until all tasklets are finished before releasing it, another 
softirq may happen during flow_cache_gc_taklet(), in case when this irq 
is packet reading from a device, it can happen that flow_cache_flush() 
gets called again and a deadlock occurs.
Here i purpose a simple fix to this problem by disabling softirqs during 
tasklet process. It could also be fixed in ipsec processing code, but I 
am too unfamiliar with it to touch it.

Signed-off-by: Maris Paupe <marisp@mt.lv>

diff --git a/net/core/flow.c b/net/core/flow.c
index 8ae42de..19ff283 100644
--- a/net/core/flow.c
+++ b/net/core/flow.c
@@ -105,6 +105,7 @@ static void flow_cache_gc_task(struct work_struct *work)
  	struct list_head gc_list;
  	struct flow_cache_entry *fce, *n;

+	local_bh_disable();
  	INIT_LIST_HEAD(&gc_list);
  	spin_lock_bh(&flow_cache_gc_lock);
  	list_splice_tail_init(&flow_cache_gc_list, &gc_list);
@@ -112,6 +113,7 @@ static void flow_cache_gc_task(struct work_struct *work)

  	list_for_each_entry_safe(fce, n, &gc_list, u.gc_list)
  		flow_entry_kill(fce);
+	local_bh_enable();
  }
  static DECLARE_WORK(flow_cache_gc_work, flow_cache_gc_task);

             reply	other threads:[~2011-11-09 12:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-09 12:21 Maris Paupe [this message]
2011-11-09 13:16 ` [PATCH] flow_cache_flush soft lockup with heavy ipsec traffic Eric Dumazet
2011-11-09 13:43   ` Steffen Klassert
2011-11-09 14:41     ` Maris Paupe

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=4EBA7038.4050702@mt.lv \
    --to=marisp@mt.lv \
    --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 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.