All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ursula Braun <braunu@de.ibm.com>
To: davem@davemloft.net, netdev@vger.kernel.org, linux-s390@vger.kernel.org
Cc: Frank Pavlic <fpavlic@de.ibm.com>
Subject: [patch 2/3] s390: iucv - avoid deadlock between iucv_path_connect and tasklet
Date: Fri, 13 Jul 2007 10:50:55 +0200	[thread overview]
Message-ID: <20070713085245.495093000@linux.vnet.ibm.com> (raw)
In-Reply-To: 20070713085053.530802000@linux.vnet.ibm.com

[-- Attachment #1: 201-iucv-trylock.diff --]
[-- Type: text/plain, Size: 1113 bytes --]

From: Ursula Braun <braunu@de.ibm.com>

An iucv deadlock may occur, where one CPU is spinning on the
iucv_table_lock for iucv_tasklet_fn(), while another CPU is holding
the iucv_table_lock for an iucv_path_connect() and is waiting for
the first CPU in an smp_call_function.
Solution: replace spin_lock in iucv_tasklet_fn by spin_trylock and
reschedule tasklet in case of non-granted lock.

Signed-off-by: Ursula Braun <braunu@de.ibm.com>
Acked-by: Frank Pavlic <fpavlic@de.ibm.com>
---

 net/iucv/iucv.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletion(-)

Index: net-2.6-uschi/net/iucv/iucv.c
===================================================================
--- net-2.6-uschi.orig/net/iucv/iucv.c
+++ net-2.6-uschi/net/iucv/iucv.c
@@ -1494,7 +1494,10 @@ static void iucv_tasklet_fn(unsigned lon
 	struct iucv_irq_list *p, *n;
 
 	/* Serialize tasklet, iucv_path_sever and iucv_path_connect. */
-	spin_lock(&iucv_table_lock);
+	if (!spin_trylock(&iucv_table_lock)) {
+		tasklet_schedule(&iucv_tasklet);
+		return;
+	}
 	iucv_active_cpu = smp_processor_id();
 
 	spin_lock_irq(&iucv_queue_lock);

-- 

  parent reply	other threads:[~2007-07-13  8:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-13  8:50 [patch 0/3] [AF_IUCV/IUCV] fixes for net-2.6.23 Ursula Braun
2007-07-13  8:50 ` [patch 1/3] From: Jennifer Hunt <jenhunt@us.ibm.com> Ursula Braun
2007-07-15  2:03   ` David Miller
2007-07-13  8:50 ` Ursula Braun [this message]
2007-07-15  2:03   ` [patch 2/3] s390: iucv - avoid deadlock between iucv_path_connect and tasklet David Miller
2007-07-13  8:50 ` [patch 3/3] s390: af_iucv: add lock when updating accept_q Ursula Braun
2007-07-15  2:05   ` David Miller

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=20070713085245.495093000@linux.vnet.ibm.com \
    --to=braunu@de.ibm.com \
    --cc=davem@davemloft.net \
    --cc=fpavlic@de.ibm.com \
    --cc=linux-s390@vger.kernel.org \
    --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.