- fix-deadlock-in-pcmcia-as-found-by-lockdep.patch removed from -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled

     Fix deadlock in pcmcia as found by lockdep

has been removed from the -mm tree.  Its filename is

     fix-deadlock-in-pcmcia-as-found-by-lockdep.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
Subject: Fix deadlock in pcmcia as found by lockdep
From: Arjan van de Ven <arjan@xxxxxxxxxxxxxxx>

On Thu, 2006-06-29 at 23:18 -0700, Miles Lane wrote:
> To trigger this, I booted with a U.S. Robotics USR2210 Wifi card
> plugged into my cardbus slot.  I then ran "pccardctl eject" and then
> removed and then reinserted the card.  After looking at the latest
> PCMCIA info, it seems that I may need to add some kernel boot options
> to work around a BIOS or other problem that causes trouble when
> removing a card.
>
> PM: Removing info for pci:0000:02:00.0
> PCMCIA: socket c1ebc9e0: *** DANGER *** unable to remove socket power

ok this looks like a real bug:

void pcmcia_parse_events(struct pcmcia_socket *s, u_int events)
{
        cs_dbg(s, 4, "parse_events: events %08x\n", events);
        if (s->thread) {
                spin_lock(&s->thread_lock);
                s->thread_events |= events;
                spin_unlock(&s->thread_lock);

                wake_up(&s->thread_wait);
        }
} /* pcmcia_parse_events */

that function gets called from both user context and irq context!

user context:
[<c1181270>] pcmcia_parse_events+0x3e/0x6b
[<c1181945>] pcmcia_register_socket+0x29b/0x2fc
[<c118a8d1>] yenta_probe+0x51b/0x55c
[<c110d537>] pci_device_probe+0x39/0x5b

eg in pcmcia_register_socket:

        ret = kernel_thread(pccardd, socket, CLONE_KERNEL);
        if (ret < 0)
                goto err;

        wait_for_completion(&socket->thread_done);
        if(!socket->thread) {
                printk(KERN_WARNING "PCMCIA: warning: socket thread for
socket %p did not start\n", socket);
                return -EIO;
        }
        pcmcia_parse_events(socket, SS_DETECT);

clearly sleeping/user context

interrupt context:
yenta_interrupt calls pcmcia_parse_events like this:
....
        if (events)
                pcmcia_parse_events(&socket->socket, events);

        return IRQ_HANDLED;
}

and that's the irq handler.


This really wants to have _irqsave versions of the spinlock like this:

The PCMCIA layer calls pcmcia_parse_events both from user context and IRQ
context; the lock thus needs to be irqsave to avoid deadlocks

Signed-off-by: Arjan van de Ven <arjan@xxxxxxxxxxxxxxx>
Cc: Dominik Brodowski <linux@xxxxxxxxxxxxxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

 drivers/pcmcia/cs.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff -puN drivers/pcmcia/cs.c~fix-deadlock-in-pcmcia-as-found-by-lockdep drivers/pcmcia/cs.c
--- a/drivers/pcmcia/cs.c~fix-deadlock-in-pcmcia-as-found-by-lockdep
+++ a/drivers/pcmcia/cs.c
@@ -697,11 +697,12 @@ static int pccardd(void *__skt)
  */
 void pcmcia_parse_events(struct pcmcia_socket *s, u_int events)
 {
+	unsigned long flags;
 	cs_dbg(s, 4, "parse_events: events %08x\n", events);
 	if (s->thread) {
-		spin_lock(&s->thread_lock);
+		spin_lock_irqsave(&s->thread_lock, flags);
 		s->thread_events |= events;
-		spin_unlock(&s->thread_lock);
+		spin_unlock_irqrestore(&s->thread_lock, flags);
 
 		wake_up(&s->thread_wait);
 	}
_

Patches currently in -mm which might be from arjan@xxxxxxxxxxxxxxx are

origin.patch
lock-validator-fix-ns83820c-irq-flags-bug.patch
delay-accounting-taskstats-interface-send-tgid-once-locking.patch
lockdep-floppyc-irq-release-fix.patch
lockdep-add-is_module_address.patch
lockdep-add-per_cpu_offset.patch
lockdep-better-lock-debugging.patch
lockdep-mutex-section-binutils-workaround.patch
lockdep-locking-init-debugging-improvement.patch
lockdep-beautify-x86_64-stacktraces.patch
lockdep-x86_64-document-stack-frame-internals.patch
lockdep-stacktrace-subsystem-core.patch
lockdep-stacktrace-subsystem-i386-support.patch
lockdep-stacktrace-subsystem-x86_64-support.patch
lockdep-irqtrace-subsystem-core.patch
lockdep-irqtrace-cleanup-of-include-asm-i386-irqflagsh.patch
lockdep-irqtrace-cleanup-of-include-asm-x86_64-irqflagsh.patch
lockdep-locking-api-self-tests.patch
lockdep-core.patch
lockdep-core-improve-bug-messages.patch
lockdep-core-add-set_class_and_name.patch
lockdep-design-docs.patch
lockdep-procfs.patch
lockdep-prove-rwsem-locking-correctness.patch
lockdep-prove-spinlock-rwlock-locking-correctness.patch
lockdep-prove-mutex-locking-correctness.patch
lockdep-kconfig.patch
lockdep-print-all-lock-classes-on-sysrq-d.patch
lockdep-x86_64-early-init.patch
lockdep-x86-smp-alternatives-workaround.patch
lockdep-do-not-recurse-in-printk.patch
lockdep-fix-rt_hash_lock_sz.patch
lockdep-annotate-direct-io.patch
lockdep-annotate-serial.patch
lockdep-annotate-dcache.patch
lockdep-annotate-i_mutex.patch
lockdep-annotate-futex.patch
lockdep-annotate-genirq.patch
lockdep-annotate-waitqueues.patch
lockdep-annotate-mm.patch
lockdep-annotate-serio.patch
lockdep-annotate-skb_queue_head_init.patch
lockdep-annotate-timer-base-locks.patch
lockdep-annotate-scheduler-runqueue-locks.patch
lockdep-annotate-hrtimer-base-locks.patch
lockdep-annotate-sock_lock_init.patch
lockdep-annotate-af_unix-locking.patch
lockdep-annotate-bh_lock_sock.patch
lockdep-annotate-mmap_sem.patch
lockdep-annotate-sunrpc-code.patch
lockdep-annotate-the-quota-code.patch
lockdep-annotate-usbfs.patch
lockdep-annotate-sound-core-seq-seq_portsc.patch
lockdep-annotate-sound-core-seq-seq_devicec.patch
lockdep-annotate-8390c-disable_irq.patch
lockdep-annotate-3c59xc-disable_irq.patch
lockdep-annotate-forcedethc-disable_irq.patch
lockdep-annotate-enable_in_hardirq.patch
lockdep-annotate-s_lock.patch
lockdep-annotate-sb-s_umount.patch
lockdep-annotate-slab-code.patch
lockdep-annotate-blkdev-nesting.patch
lockdep-annotate-blkdev-nesting-fix.patch
lockdep-annotate-vlan-net-device-as-being-a-special-class.patch
lockdep-annotate-on-stack-completions-mmc.patch
make-more-file_operation-structs-static.patch
make-more-file_operation-structs-static-fix.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux