public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@suse.de>
To: linux-kernel@vger.kernel.org, stable@kernel.org
Cc: Justin Forbes <jmforbes@linuxtx.org>,
	Zwane Mwaikambo <zwane@arm.linux.org.uk>,
	"Theodore Ts'o" <tytso@mit.edu>,
	Randy Dunlap <rdunlap@xenotime.net>,
	Dave Jones <davej@redhat.com>,
	Chuck Wolber <chuckw@quantumlinux.com>,
	Chris Wedgwood <reviews@ml.cw.f00f.org>,
	Michael Krufky <mkrufky@linuxtv.org>,
	Chuck Ebbert <cebbert@redhat.com>,
	Domenico Andreoli <cavokz@gmail.com>, Willy Tarreau <w@1wt.eu>,
	Rodrigo Rubira Branco <rbranco@la.checkpoint.com>,
	Jake Edge <jake@lwn.net>, Eugene Teo <eteo@redhat.com>,
	torvalds@linux-foundation.org, akpm@linux-foundation.org,
	alan@lxorguk.ukuu.org.uk, "David S. Miller" <davem@davemloft.net>
Subject: [patch 06/29] sparc64: Fix lockdep issues in LDC protocol layer.
Date: Wed, 30 Jul 2008 16:26:55 -0700	[thread overview]
Message-ID: <20080730232655.GG30670@suse.de> (raw)
In-Reply-To: <20080730232451.GA30670@suse.de>

[-- Attachment #1: sparc64-fix-lockdep-issues-in-ldc-protocol-layer.patch --]
[-- Type: text/plain, Size: 4127 bytes --]

2.6.25-stable review patch.  If anyone has any objections, please let us 
know.

------------------
From: David S. Miller <davem@davemloft.net>

[ Upstream commit b7c2a75725dee9b5643a0aae3a4cb47f52e00a49 ]

We're calling request_irq() with a IRQs disabled.

No straightforward fix exists because we want to
enable these IRQs and setup state atomically before
getting into the IRQ handler the first time.

What happens now is that we mark the VIRQ to not be
automatically enabled by request_irq().  Then we
make explicit enable_irq() calls when we grab the
LDC channel.

This way we don't need to call request_irq() illegally
under the LDC channel lock any more.

Bump LDC version and release date.

Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 arch/sparc64/kernel/irq.c |   10 +++++++++-
 arch/sparc64/kernel/ldc.c |   38 +++++++++++++++++++-------------------
 2 files changed, 28 insertions(+), 20 deletions(-)

--- a/arch/sparc64/kernel/irq.c
+++ b/arch/sparc64/kernel/irq.c
@@ -621,8 +621,9 @@ unsigned int sun4v_build_irq(u32 devhand
 unsigned int sun4v_build_virq(u32 devhandle, unsigned int devino)
 {
 	struct irq_handler_data *data;
-	struct ino_bucket *bucket;
 	unsigned long hv_err, cookie;
+	struct ino_bucket *bucket;
+	struct irq_desc *desc;
 	unsigned int virt_irq;
 
 	bucket = kzalloc(sizeof(struct ino_bucket), GFP_ATOMIC);
@@ -643,6 +644,13 @@ unsigned int sun4v_build_virq(u32 devhan
 	if (unlikely(!data))
 		return 0;
 
+	/* In order to make the LDC channel startup sequence easier,
+	 * especially wrt. locking, we do not let request_irq() enable
+	 * the interrupt.
+	 */
+	desc = irq_desc + virt_irq;
+	desc->status |= IRQ_NOAUTOEN;
+
 	set_irq_chip_data(virt_irq, data);
 
 	/* Catch accidental accesses to these things.  IMAP/ICLR handling
--- a/arch/sparc64/kernel/ldc.c
+++ b/arch/sparc64/kernel/ldc.c
@@ -1,6 +1,6 @@
 /* ldc.c: Logical Domain Channel link-layer protocol driver.
  *
- * Copyright (C) 2007 David S. Miller <davem@davemloft.net>
+ * Copyright (C) 2007, 2008 David S. Miller <davem@davemloft.net>
  */
 
 #include <linux/kernel.h>
@@ -23,8 +23,8 @@
 
 #define DRV_MODULE_NAME		"ldc"
 #define PFX DRV_MODULE_NAME	": "
-#define DRV_MODULE_VERSION	"1.0"
-#define DRV_MODULE_RELDATE	"June 25, 2007"
+#define DRV_MODULE_VERSION	"1.1"
+#define DRV_MODULE_RELDATE	"July 22, 2008"
 
 static char version[] __devinitdata =
 	DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n";
@@ -1235,13 +1235,9 @@ int ldc_bind(struct ldc_channel *lp, con
 	unsigned long hv_err, flags;
 	int err = -EINVAL;
 
-	spin_lock_irqsave(&lp->lock, flags);
-
-	if (!name)
-		goto out_err;
-
-	if (lp->state != LDC_STATE_INIT)
-		goto out_err;
+	if (!name ||
+	    (lp->state != LDC_STATE_INIT))
+		return -EINVAL;
 
 	snprintf(lp->rx_irq_name, LDC_IRQ_NAME_MAX, "%s RX", name);
 	snprintf(lp->tx_irq_name, LDC_IRQ_NAME_MAX, "%s TX", name);
@@ -1250,25 +1246,32 @@ int ldc_bind(struct ldc_channel *lp, con
 			  IRQF_SAMPLE_RANDOM | IRQF_SHARED,
 			  lp->rx_irq_name, lp);
 	if (err)
-		goto out_err;
+		return err;
 
 	err = request_irq(lp->cfg.tx_irq, ldc_tx,
 			  IRQF_SAMPLE_RANDOM | IRQF_SHARED,
 			  lp->tx_irq_name, lp);
-	if (err)
-		goto out_free_rx_irq;
+	if (err) {
+		free_irq(lp->cfg.rx_irq, lp);
+		return err;
+	}
+
 
+	spin_lock_irqsave(&lp->lock, flags);
+
+	enable_irq(lp->cfg.rx_irq);
+	enable_irq(lp->cfg.tx_irq);
 
 	lp->flags |= LDC_FLAG_REGISTERED_IRQS;
 
 	err = -ENODEV;
 	hv_err = sun4v_ldc_tx_qconf(lp->id, 0, 0);
 	if (hv_err)
-		goto out_free_tx_irq;
+		goto out_free_irqs;
 
 	hv_err = sun4v_ldc_tx_qconf(lp->id, lp->tx_ra, lp->tx_num_entries);
 	if (hv_err)
-		goto out_free_tx_irq;
+		goto out_free_irqs;
 
 	hv_err = sun4v_ldc_rx_qconf(lp->id, 0, 0);
 	if (hv_err)
@@ -1304,14 +1307,11 @@ out_unmap_rx:
 out_unmap_tx:
 	sun4v_ldc_tx_qconf(lp->id, 0, 0);
 
-out_free_tx_irq:
+out_free_irqs:
 	lp->flags &= ~LDC_FLAG_REGISTERED_IRQS;
 	free_irq(lp->cfg.tx_irq, lp);
-
-out_free_rx_irq:
 	free_irq(lp->cfg.rx_irq, lp);
 
-out_err:
 	spin_unlock_irqrestore(&lp->lock, flags);
 
 	return err;

-- 

  parent reply	other threads:[~2008-07-30 23:34 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20080730231003.655833364@mini.kroah.org>
2008-07-30 23:24 ` [patch 00/29] 2.6.25-stable review Greg KH
2008-07-30 23:26   ` [patch 01/29] quota: fix possible infinite loop in quota code Greg KH
2008-07-30 23:26   ` [patch 02/29] isofs: fix minor filesystem corruption Greg KH
2008-07-30 23:26   ` [patch 03/29] x86: fix crash due to missing debugctlmsr on AMD K6-3 Greg KH
2008-07-30 23:26   ` [patch 04/29] vmlinux.lds: move __attribute__((__cold__)) functions back into final .text section Greg KH
2008-07-30 23:26   ` [patch 05/29] tcp: Clear probes_out more aggressively in tcp_ack() Greg KH
2008-07-30 23:26   ` Greg KH [this message]
2008-07-30 23:26   ` [patch 07/29] sparc64: Fix cpufreq notifier registry Greg KH
2008-07-30 23:26   ` [patch 08/29] sparc64: Do not define BIO_VMERGE_BOUNDARY Greg KH
2008-07-30 23:27   ` [patch 09/29] pata_atiixp: Dont disable Greg KH
2008-07-30 23:27   ` [patch 10/29] markers: fix duplicate modpost entry Greg KH
2008-07-30 23:27   ` [patch 11/29] ide-cd: fix oops when using growisofs Greg KH
2008-07-30 23:27   ` [patch 12/29] Fix build on COMPAT platforms when CONFIG_EPOLL is disabled Greg KH
2008-07-30 23:27   ` [patch 13/29] ARM: fix fls() for 64-bit arguments Greg KH
2008-07-30 23:27   ` [patch 14/29] ALSA: hda - Fix "alc262_sony_unsol" hda_verb array Greg KH
2008-07-30 23:27   ` [patch 15/29] ALSA: trident - pause s/pdif output Greg KH
2008-07-30 23:27   ` [patch 16/29] ahci: retry enabling AHCI a few times before spitting out WARN_ON() Greg KH
2008-07-30 23:27   ` [patch 17/29] x86: fix kernel_physical_mapping_init() for large x86 systems Greg KH
2008-07-30 23:27   ` [patch 18/29] VFS: increase pseudo-filesystem block size to PAGE_SIZE Greg KH
2008-07-30 23:27   ` [patch 19/29] tmpfs: fix kernel BUG in shmem_delete_inode Greg KH
2008-07-30 23:27   ` [patch 20/29] mpc52xx_psc_spi: fix block transfer Greg KH
2008-07-30 23:27   ` [patch 21/29] markers: fix markers read barrier for multiple probes Greg KH
2008-07-30 23:27   ` [patch 22/29] ixgbe: remove device ID for unsupported device Greg KH
2008-07-30 23:27   ` [patch 23/29] eCryptfs: use page_alloc not kmalloc to get a page of memory Greg KH
2008-07-30 23:27   ` [patch 24/29] cpufreq acpi: only call _PPC after cpufreq ACPI init funcs got called already Greg KH
2008-07-30 23:27   ` [patch 25/29] b43legacy: Release mutex in error handling code Greg KH
2008-07-30 23:27   ` [patch 26/29] ath5k: dont enable MSI, we cannot handle it yet Greg KH
2008-07-30 23:27   ` [patch 27/29] Correct hash flushing from huge_ptep_set_wrprotect() Greg KH
2008-07-30 23:27   ` [patch 28/29] netfilter -stable: nf_conntrack_tcp: fix endless loop Greg KH
2008-07-30 23:27   ` [patch 29/29] Fix off-by-one error in iov_iter_advance() Greg KH

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=20080730232655.GG30670@suse.de \
    --to=gregkh@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=cavokz@gmail.com \
    --cc=cebbert@redhat.com \
    --cc=chuckw@quantumlinux.com \
    --cc=davej@redhat.com \
    --cc=davem@davemloft.net \
    --cc=eteo@redhat.com \
    --cc=jake@lwn.net \
    --cc=jmforbes@linuxtx.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mkrufky@linuxtv.org \
    --cc=rbranco@la.checkpoint.com \
    --cc=rdunlap@xenotime.net \
    --cc=reviews@ml.cw.f00f.org \
    --cc=stable@kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=tytso@mit.edu \
    --cc=w@1wt.eu \
    --cc=zwane@arm.linux.org.uk \
    /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