[PATCH] lockdep: annotate on-stack completions
authorIngo Molnar <mingo@elte.hu>
Mon, 3 Jul 2006 07:25:26 +0000 (00:25 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Mon, 3 Jul 2006 22:27:09 +0000 (15:27 -0700)
lockdep needs to have the waitqueue lock initialized for on-stack waitqueues
implicitly initialized by DECLARE_COMPLETION().  Annotate on-stack completions
accordingly.

Has no effect on non-lockdep kernels.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
arch/x86_64/kernel/smpboot.c
block/ll_rw_blk.c
drivers/ide/ide-io.c
drivers/scsi/libata-core.c
drivers/spi/spi.c
kernel/kmod.c

index 9705a6a384f1c67c252defd24945f5546c0817d1..b7c70596979143f5ec70af8b38a2de656b424dcd 100644 (file)
@@ -775,6 +775,8 @@ static int __cpuinit do_boot_cpu(int cpu, int apicid)
        };
        DECLARE_WORK(work, do_fork_idle, &c_idle);
 
+       lockdep_set_class(&c_idle.done.wait.lock, &waitqueue_lock_key);
+
        /* allocate memory for gdts of secondary cpus. Hotplug is considered */
        if (!cpu_gdt_descr[cpu].address &&
                !(cpu_gdt_descr[cpu].address = get_zeroed_page(GFP_KERNEL))) {
index 5813d63c20afba7ed7d993ce47f1cb66f037d6fc..ab17c7224bb67677325196c2dd2724aa55508619 100644 (file)
@@ -2516,7 +2516,7 @@ EXPORT_SYMBOL_GPL(blk_execute_rq_nowait);
 int blk_execute_rq(request_queue_t *q, struct gendisk *bd_disk,
                   struct request *rq, int at_head)
 {
-       DECLARE_COMPLETION(wait);
+       DECLARE_COMPLETION_ONSTACK(wait);
        char sense[SCSI_SENSE_BUFFERSIZE];
        int err = 0;
 
index d6bf1ec9632251f00c1d801e187ebb6a218d5785..fb6795236e76c677c9bf990a48dc62ec675da8da 100644 (file)
@@ -1705,7 +1705,7 @@ int ide_do_drive_cmd (ide_drive_t *drive, struct request *rq, ide_action_t actio
 {
        unsigned long flags;
        ide_hwgroup_t *hwgroup = HWGROUP(drive);
-       DECLARE_COMPLETION(wait);
+       DECLARE_COMPLETION_ONSTACK(wait);
        int where = ELEVATOR_INSERT_BACK, err;
        int must_wait = (action == ide_wait || action == ide_head_wait);
 
index 82caba464291e7aa8a193c94254a1f39a733b70d..1c960ac1617f00665eea8ea8d87f2e0b18af64b5 100644 (file)
@@ -1001,7 +1001,7 @@ unsigned ata_exec_internal(struct ata_device *dev,
        struct ata_queued_cmd *qc;
        unsigned int tag, preempted_tag;
        u32 preempted_sactive, preempted_qc_active;
-       DECLARE_COMPLETION(wait);
+       DECLARE_COMPLETION_ONSTACK(wait);
        unsigned long flags;
        unsigned int err_mask;
        int rc;
index ed1cdf6ac8f34dbe5d61a6b172b49ccea1bfdddd..146298ad73718189c6fd32b4af9f55ad0edba66c 100644 (file)
@@ -510,7 +510,7 @@ static void spi_complete(void *arg)
  */
 int spi_sync(struct spi_device *spi, struct spi_message *message)
 {
-       DECLARE_COMPLETION(done);
+       DECLARE_COMPLETION_ONSTACK(done);
        int status;
 
        message->complete = spi_complete;
index 1b7157af051c44f01f4d928728e819c80c12edc3..1d32defa38abe5ab08114281e93d92ccf947ecb3 100644 (file)
@@ -233,7 +233,7 @@ static void __call_usermodehelper(void *data)
 int call_usermodehelper_keys(char *path, char **argv, char **envp,
                             struct key *session_keyring, int wait)
 {
-       DECLARE_COMPLETION(done);
+       DECLARE_COMPLETION_ONSTACK(done);
        struct subprocess_info sub_info = {
                .complete       = &done,
                .path           = path,