diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-21 15:49:31 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-21 15:49:31 -0400 |
| commit | 31b7eab27a314b153d8fa07ba9e9ec00a98141e1 (patch) | |
| tree | 47415377d5f9bcf8c06e501f1636088548202edf | |
| parent | 1053e6bba091d9d18797f7789df6a7ef8735f20c (diff) | |
| parent | 4ba053c04aece1f4734056f21b751eee47ea3fb1 (diff) | |
Merge branch 'core-locking-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'core-locking-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
lockdep: Check the depth of subclass
lockdep: Add improved subclass caching
affs: Use sema_init instead of init_MUTEX
hfs: Convert tree_lock to mutex
arm: Bcmring: semaphore cleanup
printk: Make console_sem a semaphore not a pseudo mutex
drivers/macintosh/adb: Do not claim that the semaphore is a mutex
parport: Semaphore cleanup
irda: Semaphore cleanup
net: Wan/cosa.c: Convert "mutex" to semaphore
net: Ppp_async: semaphore cleanup
hamradio: Mkiss: semaphore cleanup
hamradio: 6pack: semaphore cleanup
net: 3c527: semaphore cleanup
input: Serio/hp_sdc: semaphore cleanup
input: Serio/hil_mlc: semaphore cleanup
input: Misc/hp_sdc_rtc: semaphore cleanup
lockup_detector: Make callback function static
lockup detector: Fix grammar by adding a missing "to" in the comments
lockdep: Remove __debug_show_held_locks
| -rw-r--r-- | arch/arm/mach-bcmring/dma.c | 4 | ||||
| -rw-r--r-- | drivers/input/misc/hp_sdc_rtc.c | 4 | ||||
| -rw-r--r-- | drivers/input/serio/hil_mlc.c | 6 | ||||
| -rw-r--r-- | drivers/input/serio/hp_sdc.c | 4 | ||||
| -rw-r--r-- | drivers/macintosh/adb.c | 2 | ||||
| -rw-r--r-- | drivers/net/3c527.c | 2 | ||||
| -rw-r--r-- | drivers/net/hamradio/6pack.c | 2 | ||||
| -rw-r--r-- | drivers/net/hamradio/mkiss.c | 2 | ||||
| -rw-r--r-- | drivers/net/irda/sir_dev.c | 2 | ||||
| -rw-r--r-- | drivers/net/ppp_async.c | 2 | ||||
| -rw-r--r-- | drivers/net/wan/cosa.c | 2 | ||||
| -rw-r--r-- | drivers/parport/share.c | 2 | ||||
| -rw-r--r-- | fs/affs/super.c | 4 | ||||
| -rw-r--r-- | fs/hfs/bfind.c | 4 | ||||
| -rw-r--r-- | fs/hfs/btree.c | 2 | ||||
| -rw-r--r-- | fs/hfs/btree.h | 2 | ||||
| -rw-r--r-- | include/linux/debug_locks.h | 5 | ||||
| -rw-r--r-- | include/linux/lockdep.h | 13 | ||||
| -rw-r--r-- | kernel/hung_task.c | 4 | ||||
| -rw-r--r-- | kernel/lockdep.c | 51 | ||||
| -rw-r--r-- | kernel/printk.c | 4 | ||||
| -rw-r--r-- | kernel/watchdog.c | 2 |
22 files changed, 69 insertions, 56 deletions
diff --git a/arch/arm/mach-bcmring/dma.c b/arch/arm/mach-bcmring/dma.c index 29c0a911df26..77eb35c89cd0 100644 --- a/arch/arm/mach-bcmring/dma.c +++ b/arch/arm/mach-bcmring/dma.c | |||
| @@ -691,7 +691,7 @@ int dma_init(void) | |||
| 691 | 691 | ||
| 692 | memset(&gDMA, 0, sizeof(gDMA)); | 692 | memset(&gDMA, 0, sizeof(gDMA)); |
| 693 | 693 | ||
| 694 | init_MUTEX_LOCKED(&gDMA.lock); | 694 | sema_init(&gDMA.lock, 0); |
| 695 | init_waitqueue_head(&gDMA.freeChannelQ); | 695 | init_waitqueue_head(&gDMA.freeChannelQ); |
| 696 | 696 | ||
| 697 | /* Initialize the Hardware */ | 697 | /* Initialize the Hardware */ |
| @@ -1574,7 +1574,7 @@ int dma_init_mem_map(DMA_MemMap_t *memMap) | |||
| 1574 | { | 1574 | { |
| 1575 | memset(memMap, 0, sizeof(*memMap)); | 1575 | memset(memMap, 0, sizeof(*memMap)); |
| 1576 | 1576 | ||
| 1577 | init_MUTEX(&memMap->lock); | 1577 | sema_init(&memMap->lock, 1); |
| 1578 | 1578 | ||
| 1579 | return 0; | 1579 | return 0; |
| 1580 | } | 1580 | } |
diff --git a/drivers/input/misc/hp_sdc_rtc.c b/drivers/input/misc/hp_sdc_rtc.c index c19066479057..7e2c12a5b839 100644 --- a/drivers/input/misc/hp_sdc_rtc.c +++ b/drivers/input/misc/hp_sdc_rtc.c | |||
| @@ -104,7 +104,7 @@ static int hp_sdc_rtc_do_read_bbrtc (struct rtc_time *rtctm) | |||
| 104 | t.endidx = 91; | 104 | t.endidx = 91; |
| 105 | t.seq = tseq; | 105 | t.seq = tseq; |
| 106 | t.act.semaphore = &tsem; | 106 | t.act.semaphore = &tsem; |
| 107 | init_MUTEX_LOCKED(&tsem); | 107 | sema_init(&tsem, 0); |
| 108 | 108 | ||
| 109 | if (hp_sdc_enqueue_transaction(&t)) return -1; | 109 | if (hp_sdc_enqueue_transaction(&t)) return -1; |
| 110 | 110 | ||
| @@ -698,7 +698,7 @@ static int __init hp_sdc_rtc_init(void) | |||
| 698 | return -ENODEV; | 698 | return -ENODEV; |
| 699 | #endif | 699 | #endif |
| 700 | 700 | ||
| 701 | init_MUTEX(&i8042tregs); | 701 | sema_init(&i8042tregs, 1); |
| 702 | 702 | ||
| 703 | if ((ret = hp_sdc_request_timer_irq(&hp_sdc_rtc_isr))) | 703 | if ((ret = hp_sdc_request_timer_irq(&hp_sdc_rtc_isr))) |
| 704 | return ret; | 704 | return ret; |
diff --git a/drivers/input/serio/hil_mlc.c b/drivers/input/serio/hil_mlc.c index c92f4edfee7b..e5624d8f1709 100644 --- a/drivers/input/serio/hil_mlc.c +++ b/drivers/input/serio/hil_mlc.c | |||
| @@ -915,15 +915,15 @@ int hil_mlc_register(hil_mlc *mlc) | |||
| 915 | mlc->ostarted = 0; | 915 | mlc->ostarted = 0; |
| 916 | 916 | ||
| 917 | rwlock_init(&mlc->lock); | 917 | rwlock_init(&mlc->lock); |
| 918 | init_MUTEX(&mlc->osem); | 918 | sema_init(&mlc->osem, 1); |
| 919 | 919 | ||
| 920 | init_MUTEX(&mlc->isem); | 920 | sema_init(&mlc->isem, 1); |
| 921 | mlc->icount = -1; | 921 | mlc->icount = -1; |
| 922 | mlc->imatch = 0; | 922 | mlc->imatch = 0; |
| 923 | 923 | ||
| 924 | mlc->opercnt = 0; | 924 | mlc->opercnt = 0; |
| 925 | 925 | ||
| 926 | init_MUTEX_LOCKED(&(mlc->csem)); | 926 | sema_init(&(mlc->csem), 0); |
| 927 | 927 | ||
| 928 | hil_mlc_clear_di_scratch(mlc); | 928 | hil_mlc_clear_di_scratch(mlc); |
| 929 | hil_mlc_clear_di_map(mlc, 0); | 929 | hil_mlc_clear_di_map(mlc, 0); |
diff --git a/drivers/input/serio/hp_sdc.c b/drivers/input/serio/hp_sdc.c index bcc2d30ec245..8c0b51c31424 100644 --- a/drivers/input/serio/hp_sdc.c +++ b/drivers/input/serio/hp_sdc.c | |||
| @@ -905,7 +905,7 @@ static int __init hp_sdc_init(void) | |||
| 905 | ts_sync[1] = 0x0f; | 905 | ts_sync[1] = 0x0f; |
| 906 | ts_sync[2] = ts_sync[3] = ts_sync[4] = ts_sync[5] = 0; | 906 | ts_sync[2] = ts_sync[3] = ts_sync[4] = ts_sync[5] = 0; |
| 907 | t_sync.act.semaphore = &s_sync; | 907 | t_sync.act.semaphore = &s_sync; |
| 908 | init_MUTEX_LOCKED(&s_sync); | 908 | sema_init(&s_sync, 0); |
| 909 | hp_sdc_enqueue_transaction(&t_sync); | 909 | hp_sdc_enqueue_transaction(&t_sync); |
| 910 | down(&s_sync); /* Wait for t_sync to complete */ | 910 | down(&s_sync); /* Wait for t_sync to complete */ |
| 911 | 911 | ||
| @@ -1039,7 +1039,7 @@ static int __init hp_sdc_register(void) | |||
| 1039 | return hp_sdc.dev_err; | 1039 | return hp_sdc.dev_err; |
| 1040 | } | 1040 | } |
| 1041 | 1041 | ||
| 1042 | init_MUTEX_LOCKED(&tq_init_sem); | 1042 | sema_init(&tq_init_sem, 0); |
| 1043 | 1043 | ||
| 1044 | tq_init.actidx = 0; | 1044 | tq_init.actidx = 0; |
| 1045 | tq_init.idx = 1; | 1045 | tq_init.idx = 1; |
diff --git a/drivers/macintosh/adb.c b/drivers/macintosh/adb.c index 1c4ee6e77937..bf64e49d996a 100644 --- a/drivers/macintosh/adb.c +++ b/drivers/macintosh/adb.c | |||
| @@ -83,7 +83,7 @@ static struct adb_driver *adb_controller; | |||
| 83 | BLOCKING_NOTIFIER_HEAD(adb_client_list); | 83 | BLOCKING_NOTIFIER_HEAD(adb_client_list); |
| 84 | static int adb_got_sleep; | 84 | static int adb_got_sleep; |
| 85 | static int adb_inited; | 85 | static int adb_inited; |
| 86 | static DECLARE_MUTEX(adb_probe_mutex); | 86 | static DEFINE_SEMAPHORE(adb_probe_mutex); |
| 87 | static int sleepy_trackpad; | 87 | static int sleepy_trackpad; |
| 88 | static int autopoll_devs; | 88 | static int autopoll_devs; |
| 89 | int __adb_probe_sync; | 89 | int __adb_probe_sync; |
diff --git a/drivers/net/3c527.c b/drivers/net/3c527.c index 70705d1306b9..eca55c52bdfd 100644 --- a/drivers/net/3c527.c +++ b/drivers/net/3c527.c | |||
| @@ -522,7 +522,7 @@ static int __init mc32_probe1(struct net_device *dev, int slot) | |||
| 522 | lp->tx_len = lp->exec_box->data[9]; /* Transmit list count */ | 522 | lp->tx_len = lp->exec_box->data[9]; /* Transmit list count */ |
| 523 | lp->rx_len = lp->exec_box->data[11]; /* Receive list count */ | 523 | lp->rx_len = lp->exec_box->data[11]; /* Receive list count */ |
| 524 | 524 | ||
| 525 | init_MUTEX_LOCKED(&lp->cmd_mutex); | 525 | sema_init(&lp->cmd_mutex, 0); |
| 526 | init_completion(&lp->execution_cmd); | 526 | init_completion(&lp->execution_cmd); |
| 527 | init_completion(&lp->xceiver_cmd); | 527 | init_completion(&lp->xceiver_cmd); |
| 528 | 528 | ||
diff --git a/drivers/net/hamradio/6pack.c b/drivers/net/hamradio/6pack.c index 4b52c767ad05..3e5d0b6b6516 100644 --- a/drivers/net/hamradio/6pack.c +++ b/drivers/net/hamradio/6pack.c | |||
| @@ -608,7 +608,7 @@ static int sixpack_open(struct tty_struct *tty) | |||
| 608 | 608 | ||
| 609 | spin_lock_init(&sp->lock); | 609 | spin_lock_init(&sp->lock); |
| 610 | atomic_set(&sp->refcnt, 1); | 610 | atomic_set(&sp->refcnt, 1); |
| 611 | init_MUTEX_LOCKED(&sp->dead_sem); | 611 | sema_init(&sp->dead_sem, 0); |
| 612 | 612 | ||
| 613 | /* !!! length of the buffers. MTU is IP MTU, not PACLEN! */ | 613 | /* !!! length of the buffers. MTU is IP MTU, not PACLEN! */ |
| 614 | 614 | ||
diff --git a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c index 66e88bd59caa..4c628393c8b1 100644 --- a/drivers/net/hamradio/mkiss.c +++ b/drivers/net/hamradio/mkiss.c | |||
| @@ -747,7 +747,7 @@ static int mkiss_open(struct tty_struct *tty) | |||
| 747 | 747 | ||
| 748 | spin_lock_init(&ax->buflock); | 748 | spin_lock_init(&ax->buflock); |
| 749 | atomic_set(&ax->refcnt, 1); | 749 | atomic_set(&ax->refcnt, 1); |
| 750 | init_MUTEX_LOCKED(&ax->dead_sem); | 750 | sema_init(&ax->dead_sem, 0); |
| 751 | 751 | ||
| 752 | ax->tty = tty; | 752 | ax->tty = tty; |
| 753 | tty->disc_data = ax; | 753 | tty->disc_data = ax; |
diff --git a/drivers/net/irda/sir_dev.c b/drivers/net/irda/sir_dev.c index 1b051dab7b29..51d74447f8f8 100644 --- a/drivers/net/irda/sir_dev.c +++ b/drivers/net/irda/sir_dev.c | |||
| @@ -909,7 +909,7 @@ struct sir_dev * sirdev_get_instance(const struct sir_driver *drv, const char *n | |||
| 909 | dev->tx_skb = NULL; | 909 | dev->tx_skb = NULL; |
| 910 | 910 | ||
| 911 | spin_lock_init(&dev->tx_lock); | 911 | spin_lock_init(&dev->tx_lock); |
| 912 | init_MUTEX(&dev->fsm.sem); | 912 | sema_init(&dev->fsm.sem, 1); |
| 913 | 913 | ||
| 914 | dev->drv = drv; | 914 | dev->drv = drv; |
| 915 | dev->netdev = ndev; | 915 | dev->netdev = ndev; |
diff --git a/drivers/net/ppp_async.c b/drivers/net/ppp_async.c index af50a530daee..78d70a6481bf 100644 --- a/drivers/net/ppp_async.c +++ b/drivers/net/ppp_async.c | |||
| @@ -184,7 +184,7 @@ ppp_asynctty_open(struct tty_struct *tty) | |||
| 184 | tasklet_init(&ap->tsk, ppp_async_process, (unsigned long) ap); | 184 | tasklet_init(&ap->tsk, ppp_async_process, (unsigned long) ap); |
| 185 | 185 | ||
| 186 | atomic_set(&ap->refcnt, 1); | 186 | atomic_set(&ap->refcnt, 1); |
| 187 | init_MUTEX_LOCKED(&ap->dead_sem); | 187 | sema_init(&ap->dead_sem, 0); |
| 188 | 188 | ||
| 189 | ap->chan.private = ap; | 189 | ap->chan.private = ap; |
| 190 | ap->chan.ops = &async_ops; | 190 | ap->chan.ops = &async_ops; |
diff --git a/drivers/net/wan/cosa.c b/drivers/net/wan/cosa.c index 04c6cd4333f1..10bafd59f9c3 100644 --- a/drivers/net/wan/cosa.c +++ b/drivers/net/wan/cosa.c | |||
| @@ -575,7 +575,7 @@ static int cosa_probe(int base, int irq, int dma) | |||
| 575 | 575 | ||
| 576 | /* Initialize the chardev data structures */ | 576 | /* Initialize the chardev data structures */ |
| 577 | mutex_init(&chan->rlock); | 577 | mutex_init(&chan->rlock); |
| 578 | init_MUTEX(&chan->wsem); | 578 | sema_init(&chan->wsem, 1); |
| 579 | 579 | ||
| 580 | /* Register the network interface */ | 580 | /* Register the network interface */ |
| 581 | if (!(chan->netdev = alloc_hdlcdev(chan))) { | 581 | if (!(chan->netdev = alloc_hdlcdev(chan))) { |
diff --git a/drivers/parport/share.c b/drivers/parport/share.c index dffa5d4fb298..a2d9d1e59260 100644 --- a/drivers/parport/share.c +++ b/drivers/parport/share.c | |||
| @@ -306,7 +306,7 @@ struct parport *parport_register_port(unsigned long base, int irq, int dma, | |||
| 306 | spin_lock_init(&tmp->pardevice_lock); | 306 | spin_lock_init(&tmp->pardevice_lock); |
| 307 | tmp->ieee1284.mode = IEEE1284_MODE_COMPAT; | 307 | tmp->ieee1284.mode = IEEE1284_MODE_COMPAT; |
| 308 | tmp->ieee1284.phase = IEEE1284_PH_FWD_IDLE; | 308 | tmp->ieee1284.phase = IEEE1284_PH_FWD_IDLE; |
| 309 | init_MUTEX_LOCKED (&tmp->ieee1284.irq); /* actually a semaphore at 0 */ | 309 | sema_init(&tmp->ieee1284.irq, 0); |
| 310 | tmp->spintime = parport_default_spintime; | 310 | tmp->spintime = parport_default_spintime; |
| 311 | atomic_set (&tmp->ref_count, 1); | 311 | atomic_set (&tmp->ref_count, 1); |
| 312 | INIT_LIST_HEAD(&tmp->full_list); | 312 | INIT_LIST_HEAD(&tmp->full_list); |
diff --git a/fs/affs/super.c b/fs/affs/super.c index 33c4e7eef470..9581ea94d5a1 100644 --- a/fs/affs/super.c +++ b/fs/affs/super.c | |||
| @@ -109,8 +109,8 @@ static void init_once(void *foo) | |||
| 109 | { | 109 | { |
| 110 | struct affs_inode_info *ei = (struct affs_inode_info *) foo; | 110 | struct affs_inode_info *ei = (struct affs_inode_info *) foo; |
| 111 | 111 | ||
| 112 | init_MUTEX(&ei->i_link_lock); | 112 | sema_init(&ei->i_link_lock, 1); |
| 113 | init_MUTEX(&ei->i_ext_lock); | 113 | sema_init(&ei->i_ext_lock, 1); |
| 114 | inode_init_once(&ei->vfs_inode); | 114 | inode_init_once(&ei->vfs_inode); |
| 115 | } | 115 | } |
| 116 | 116 | ||
diff --git a/fs/hfs/bfind.c b/fs/hfs/bfind.c index 4129cdb3f0d8..571abe97b42a 100644 --- a/fs/hfs/bfind.c +++ b/fs/hfs/bfind.c | |||
| @@ -23,7 +23,7 @@ int hfs_find_init(struct hfs_btree *tree, struct hfs_find_data *fd) | |||
| 23 | fd->search_key = ptr; | 23 | fd->search_key = ptr; |
| 24 | fd->key = ptr + tree->max_key_len + 2; | 24 | fd->key = ptr + tree->max_key_len + 2; |
| 25 | dprint(DBG_BNODE_REFS, "find_init: %d (%p)\n", tree->cnid, __builtin_return_address(0)); | 25 | dprint(DBG_BNODE_REFS, "find_init: %d (%p)\n", tree->cnid, __builtin_return_address(0)); |
| 26 | down(&tree->tree_lock); | 26 | mutex_lock(&tree->tree_lock); |
| 27 | return 0; | 27 | return 0; |
| 28 | } | 28 | } |
| 29 | 29 | ||
| @@ -32,7 +32,7 @@ void hfs_find_exit(struct hfs_find_data *fd) | |||
| 32 | hfs_bnode_put(fd->bnode); | 32 | hfs_bnode_put(fd->bnode); |
| 33 | kfree(fd->search_key); | 33 | kfree(fd->search_key); |
| 34 | dprint(DBG_BNODE_REFS, "find_exit: %d (%p)\n", fd->tree->cnid, __builtin_return_address(0)); | 34 | dprint(DBG_BNODE_REFS, "find_exit: %d (%p)\n", fd->tree->cnid, __builtin_return_address(0)); |
| 35 | up(&fd->tree->tree_lock); | 35 | mutex_unlock(&fd->tree->tree_lock); |
| 36 | fd->tree = NULL; | 36 | fd->tree = NULL; |
| 37 | } | 37 | } |
| 38 | 38 | ||
diff --git a/fs/hfs/btree.c b/fs/hfs/btree.c index 38a0a9917d7f..3ebc437736fe 100644 --- a/fs/hfs/btree.c +++ b/fs/hfs/btree.c | |||
| @@ -27,7 +27,7 @@ struct hfs_btree *hfs_btree_open(struct super_block *sb, u32 id, btree_keycmp ke | |||
| 27 | if (!tree) | 27 | if (!tree) |
| 28 | return NULL; | 28 | return NULL; |
| 29 | 29 | ||
| 30 | init_MUTEX(&tree->tree_lock); | 30 | mutex_init(&tree->tree_lock); |
| 31 | spin_lock_init(&tree->hash_lock); | 31 | spin_lock_init(&tree->hash_lock); |
| 32 | /* Set the correct compare function */ | 32 | /* Set the correct compare function */ |
| 33 | tree->sb = sb; | 33 | tree->sb = sb; |
diff --git a/fs/hfs/btree.h b/fs/hfs/btree.h index cc51905ac21d..2a1d712f85dc 100644 --- a/fs/hfs/btree.h +++ b/fs/hfs/btree.h | |||
| @@ -33,7 +33,7 @@ struct hfs_btree { | |||
| 33 | unsigned int depth; | 33 | unsigned int depth; |
| 34 | 34 | ||
| 35 | //unsigned int map1_size, map_size; | 35 | //unsigned int map1_size, map_size; |
| 36 | struct semaphore tree_lock; | 36 | struct mutex tree_lock; |
| 37 | 37 | ||
| 38 | unsigned int pages_per_bnode; | 38 | unsigned int pages_per_bnode; |
| 39 | spinlock_t hash_lock; | 39 | spinlock_t hash_lock; |
diff --git a/include/linux/debug_locks.h b/include/linux/debug_locks.h index 29b3ce3f2a1d..2833452ea01c 100644 --- a/include/linux/debug_locks.h +++ b/include/linux/debug_locks.h | |||
| @@ -49,7 +49,6 @@ struct task_struct; | |||
| 49 | 49 | ||
| 50 | #ifdef CONFIG_LOCKDEP | 50 | #ifdef CONFIG_LOCKDEP |
| 51 | extern void debug_show_all_locks(void); | 51 | extern void debug_show_all_locks(void); |
| 52 | extern void __debug_show_held_locks(struct task_struct *task); | ||
| 53 | extern void debug_show_held_locks(struct task_struct *task); | 52 | extern void debug_show_held_locks(struct task_struct *task); |
| 54 | extern void debug_check_no_locks_freed(const void *from, unsigned long len); | 53 | extern void debug_check_no_locks_freed(const void *from, unsigned long len); |
| 55 | extern void debug_check_no_locks_held(struct task_struct *task); | 54 | extern void debug_check_no_locks_held(struct task_struct *task); |
| @@ -58,10 +57,6 @@ static inline void debug_show_all_locks(void) | |||
| 58 | { | 57 | { |
| 59 | } | 58 | } |
| 60 | 59 | ||
| 61 | static inline void __debug_show_held_locks(struct task_struct *task) | ||
| 62 | { | ||
| 63 | } | ||
| 64 | |||
| 65 | static inline void debug_show_held_locks(struct task_struct *task) | 60 | static inline void debug_show_held_locks(struct task_struct *task) |
| 66 | { | 61 | { |
| 67 | } | 62 | } |
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h index 06aed8305bf3..2186a64ee4b5 100644 --- a/include/linux/lockdep.h +++ b/include/linux/lockdep.h | |||
| @@ -32,6 +32,17 @@ extern int lock_stat; | |||
| 32 | #define MAX_LOCKDEP_SUBCLASSES 8UL | 32 | #define MAX_LOCKDEP_SUBCLASSES 8UL |
| 33 | 33 | ||
| 34 | /* | 34 | /* |
| 35 | * NR_LOCKDEP_CACHING_CLASSES ... Number of classes | ||
| 36 | * cached in the instance of lockdep_map | ||
| 37 | * | ||
| 38 | * Currently main class (subclass == 0) and signle depth subclass | ||
| 39 | * are cached in lockdep_map. This optimization is mainly targeting | ||
| 40 | * on rq->lock. double_rq_lock() acquires this highly competitive with | ||
| 41 | * single depth. | ||
| 42 | */ | ||
| 43 | #define NR_LOCKDEP_CACHING_CLASSES 2 | ||
| 44 | |||
| 45 | /* | ||
| 35 | * Lock-classes are keyed via unique addresses, by embedding the | 46 | * Lock-classes are keyed via unique addresses, by embedding the |
| 36 | * lockclass-key into the kernel (or module) .data section. (For | 47 | * lockclass-key into the kernel (or module) .data section. (For |
| 37 | * static locks we use the lock address itself as the key.) | 48 | * static locks we use the lock address itself as the key.) |
| @@ -138,7 +149,7 @@ void clear_lock_stats(struct lock_class *class); | |||
| 138 | */ | 149 | */ |
| 139 | struct lockdep_map { | 150 | struct lockdep_map { |
| 140 | struct lock_class_key *key; | 151 | struct lock_class_key *key; |
| 141 | struct lock_class *class_cache; | 152 | struct lock_class *class_cache[NR_LOCKDEP_CACHING_CLASSES]; |
| 142 | const char *name; | 153 | const char *name; |
| 143 | #ifdef CONFIG_LOCK_STAT | 154 | #ifdef CONFIG_LOCK_STAT |
| 144 | int cpu; | 155 | int cpu; |
diff --git a/kernel/hung_task.c b/kernel/hung_task.c index 0c642d51aac2..53ead174da2f 100644 --- a/kernel/hung_task.c +++ b/kernel/hung_task.c | |||
| @@ -98,7 +98,7 @@ static void check_hung_task(struct task_struct *t, unsigned long timeout) | |||
| 98 | printk(KERN_ERR "\"echo 0 > /proc/sys/kernel/hung_task_timeout_secs\"" | 98 | printk(KERN_ERR "\"echo 0 > /proc/sys/kernel/hung_task_timeout_secs\"" |
| 99 | " disables this message.\n"); | 99 | " disables this message.\n"); |
| 100 | sched_show_task(t); | 100 | sched_show_task(t); |
| 101 | __debug_show_held_locks(t); | 101 | debug_show_held_locks(t); |
| 102 | 102 | ||
| 103 | touch_nmi_watchdog(); | 103 | touch_nmi_watchdog(); |
| 104 | 104 | ||
| @@ -111,7 +111,7 @@ static void check_hung_task(struct task_struct *t, unsigned long timeout) | |||
| 111 | * periodically exit the critical section and enter a new one. | 111 | * periodically exit the critical section and enter a new one. |
| 112 | * | 112 | * |
| 113 | * For preemptible RCU it is sufficient to call rcu_read_unlock in order | 113 | * For preemptible RCU it is sufficient to call rcu_read_unlock in order |
| 114 | * exit the grace period. For classic RCU, a reschedule is required. | 114 | * to exit the grace period. For classic RCU, a reschedule is required. |
| 115 | */ | 115 | */ |
| 116 | static void rcu_lock_break(struct task_struct *g, struct task_struct *t) | 116 | static void rcu_lock_break(struct task_struct *g, struct task_struct *t) |
| 117 | { | 117 | { |
diff --git a/kernel/lockdep.c b/kernel/lockdep.c index f2852a510232..42ba65dff7d9 100644 --- a/kernel/lockdep.c +++ b/kernel/lockdep.c | |||
| @@ -639,6 +639,16 @@ look_up_lock_class(struct lockdep_map *lock, unsigned int subclass) | |||
| 639 | } | 639 | } |
| 640 | #endif | 640 | #endif |
| 641 | 641 | ||
| 642 | if (unlikely(subclass >= MAX_LOCKDEP_SUBCLASSES)) { | ||
| 643 | debug_locks_off(); | ||
| 644 | printk(KERN_ERR | ||
| 645 | "BUG: looking up invalid subclass: %u\n", subclass); | ||
| 646 | printk(KERN_ERR | ||
| 647 | "turning off the locking correctness validator.\n"); | ||
| 648 | dump_stack(); | ||
| 649 | return NULL; | ||
| 650 | } | ||
| 651 | |||
| 642 | /* | 652 | /* |
| 643 | * Static locks do not have their class-keys yet - for them the key | 653 | * Static locks do not have their class-keys yet - for them the key |
| 644 | * is the lock object itself: | 654 | * is the lock object itself: |
| @@ -774,7 +784,9 @@ out_unlock_set: | |||
| 774 | raw_local_irq_restore(flags); | 784 | raw_local_irq_restore(flags); |
| 775 | 785 | ||
| 776 | if (!subclass || force) | 786 | if (!subclass || force) |
| 777 | lock->class_cache = class; | 787 | lock->class_cache[0] = class; |
| 788 | else if (subclass < NR_LOCKDEP_CACHING_CLASSES) | ||
| 789 | lock->class_cache[subclass] = class; | ||
| 778 | 790 | ||
| 779 | if (DEBUG_LOCKS_WARN_ON(class->subclass != subclass)) | 791 | if (DEBUG_LOCKS_WARN_ON(class->subclass != subclass)) |
| 780 | return NULL; | 792 | return NULL; |
| @@ -2679,7 +2691,11 @@ static int mark_lock(struct task_struct *curr, struct held_lock *this, | |||
| 2679 | void lockdep_init_map(struct lockdep_map *lock, const char *name, | 2691 | void lockdep_init_map(struct lockdep_map *lock, const char *name, |
| 2680 | struct lock_class_key *key, int subclass) | 2692 | struct lock_class_key *key, int subclass) |
| 2681 | { | 2693 | { |
| 2682 | lock->class_cache = NULL; | 2694 | int i; |
| 2695 | |||
| 2696 | for (i = 0; i < NR_LOCKDEP_CACHING_CLASSES; i++) | ||
| 2697 | lock->class_cache[i] = NULL; | ||
| 2698 | |||
| 2683 | #ifdef CONFIG_LOCK_STAT | 2699 | #ifdef CONFIG_LOCK_STAT |
| 2684 | lock->cpu = raw_smp_processor_id(); | 2700 | lock->cpu = raw_smp_processor_id(); |
| 2685 | #endif | 2701 | #endif |
| @@ -2739,21 +2755,13 @@ static int __lock_acquire(struct lockdep_map *lock, unsigned int subclass, | |||
| 2739 | if (DEBUG_LOCKS_WARN_ON(!irqs_disabled())) | 2755 | if (DEBUG_LOCKS_WARN_ON(!irqs_disabled())) |
| 2740 | return 0; | 2756 | return 0; |
| 2741 | 2757 | ||
| 2742 | if (unlikely(subclass >= MAX_LOCKDEP_SUBCLASSES)) { | ||
| 2743 | debug_locks_off(); | ||
| 2744 | printk("BUG: MAX_LOCKDEP_SUBCLASSES too low!\n"); | ||
| 2745 | printk("turning off the locking correctness validator.\n"); | ||
| 2746 | dump_stack(); | ||
| 2747 | return 0; | ||
| 2748 | } | ||
| 2749 | |||
| 2750 | if (lock->key == &__lockdep_no_validate__) | 2758 | if (lock->key == &__lockdep_no_validate__) |
| 2751 | check = 1; | 2759 | check = 1; |
| 2752 | 2760 | ||
| 2753 | if (!subclass) | 2761 | if (subclass < NR_LOCKDEP_CACHING_CLASSES) |
| 2754 | class = lock->class_cache; | 2762 | class = lock->class_cache[subclass]; |
| 2755 | /* | 2763 | /* |
| 2756 | * Not cached yet or subclass? | 2764 | * Not cached? |
| 2757 | */ | 2765 | */ |
| 2758 | if (unlikely(!class)) { | 2766 | if (unlikely(!class)) { |
| 2759 | class = register_lock_class(lock, subclass, 0); | 2767 | class = register_lock_class(lock, subclass, 0); |
| @@ -2918,7 +2926,7 @@ static int match_held_lock(struct held_lock *hlock, struct lockdep_map *lock) | |||
| 2918 | return 1; | 2926 | return 1; |
| 2919 | 2927 | ||
| 2920 | if (hlock->references) { | 2928 | if (hlock->references) { |
| 2921 | struct lock_class *class = lock->class_cache; | 2929 | struct lock_class *class = lock->class_cache[0]; |
| 2922 | 2930 | ||
| 2923 | if (!class) | 2931 | if (!class) |
| 2924 | class = look_up_lock_class(lock, 0); | 2932 | class = look_up_lock_class(lock, 0); |
| @@ -3559,7 +3567,12 @@ void lockdep_reset_lock(struct lockdep_map *lock) | |||
| 3559 | if (list_empty(head)) | 3567 | if (list_empty(head)) |
| 3560 | continue; | 3568 | continue; |
| 3561 | list_for_each_entry_safe(class, next, head, hash_entry) { | 3569 | list_for_each_entry_safe(class, next, head, hash_entry) { |
| 3562 | if (unlikely(class == lock->class_cache)) { | 3570 | int match = 0; |
| 3571 | |||
| 3572 | for (j = 0; j < NR_LOCKDEP_CACHING_CLASSES; j++) | ||
| 3573 | match |= class == lock->class_cache[j]; | ||
| 3574 | |||
| 3575 | if (unlikely(match)) { | ||
| 3563 | if (debug_locks_off_graph_unlock()) | 3576 | if (debug_locks_off_graph_unlock()) |
| 3564 | WARN_ON(1); | 3577 | WARN_ON(1); |
| 3565 | goto out_restore; | 3578 | goto out_restore; |
| @@ -3775,7 +3788,7 @@ EXPORT_SYMBOL_GPL(debug_show_all_locks); | |||
| 3775 | * Careful: only use this function if you are sure that | 3788 | * Careful: only use this function if you are sure that |
| 3776 | * the task cannot run in parallel! | 3789 | * the task cannot run in parallel! |
| 3777 | */ | 3790 | */ |
| 3778 | void __debug_show_held_locks(struct task_struct *task) | 3791 | void debug_show_held_locks(struct task_struct *task) |
| 3779 | { | 3792 | { |
| 3780 | if (unlikely(!debug_locks)) { | 3793 | if (unlikely(!debug_locks)) { |
| 3781 | printk("INFO: lockdep is turned off.\n"); | 3794 | printk("INFO: lockdep is turned off.\n"); |
| @@ -3783,12 +3796,6 @@ void __debug_show_held_locks(struct task_struct *task) | |||
| 3783 | } | 3796 | } |
| 3784 | lockdep_print_held_locks(task); | 3797 | lockdep_print_held_locks(task); |
| 3785 | } | 3798 | } |
| 3786 | EXPORT_SYMBOL_GPL(__debug_show_held_locks); | ||
| 3787 | |||
| 3788 | void debug_show_held_locks(struct task_struct *task) | ||
| 3789 | { | ||
| 3790 | __debug_show_held_locks(task); | ||
| 3791 | } | ||
| 3792 | EXPORT_SYMBOL_GPL(debug_show_held_locks); | 3799 | EXPORT_SYMBOL_GPL(debug_show_held_locks); |
| 3793 | 3800 | ||
| 3794 | void lockdep_sys_exit(void) | 3801 | void lockdep_sys_exit(void) |
diff --git a/kernel/printk.c b/kernel/printk.c index 8fe465ac008a..2531017795f6 100644 --- a/kernel/printk.c +++ b/kernel/printk.c | |||
| @@ -85,7 +85,7 @@ EXPORT_SYMBOL(oops_in_progress); | |||
| 85 | * provides serialisation for access to the entire console | 85 | * provides serialisation for access to the entire console |
| 86 | * driver system. | 86 | * driver system. |
| 87 | */ | 87 | */ |
| 88 | static DECLARE_MUTEX(console_sem); | 88 | static DEFINE_SEMAPHORE(console_sem); |
| 89 | struct console *console_drivers; | 89 | struct console *console_drivers; |
| 90 | EXPORT_SYMBOL_GPL(console_drivers); | 90 | EXPORT_SYMBOL_GPL(console_drivers); |
| 91 | 91 | ||
| @@ -556,7 +556,7 @@ static void zap_locks(void) | |||
| 556 | /* If a crash is occurring, make sure we can't deadlock */ | 556 | /* If a crash is occurring, make sure we can't deadlock */ |
| 557 | spin_lock_init(&logbuf_lock); | 557 | spin_lock_init(&logbuf_lock); |
| 558 | /* And make sure that we print immediately */ | 558 | /* And make sure that we print immediately */ |
| 559 | init_MUTEX(&console_sem); | 559 | sema_init(&console_sem, 1); |
| 560 | } | 560 | } |
| 561 | 561 | ||
| 562 | #if defined(CONFIG_PRINTK_TIME) | 562 | #if defined(CONFIG_PRINTK_TIME) |
diff --git a/kernel/watchdog.c b/kernel/watchdog.c index 7f9c3c52ecc1..2feb2870d3a1 100644 --- a/kernel/watchdog.c +++ b/kernel/watchdog.c | |||
| @@ -209,7 +209,7 @@ static struct perf_event_attr wd_hw_attr = { | |||
| 209 | }; | 209 | }; |
| 210 | 210 | ||
| 211 | /* Callback function for perf event subsystem */ | 211 | /* Callback function for perf event subsystem */ |
| 212 | void watchdog_overflow_callback(struct perf_event *event, int nmi, | 212 | static void watchdog_overflow_callback(struct perf_event *event, int nmi, |
| 213 | struct perf_sample_data *data, | 213 | struct perf_sample_data *data, |
| 214 | struct pt_regs *regs) | 214 | struct pt_regs *regs) |
| 215 | { | 215 | { |
