Import 2.1.116pre2
[davej-history.git] / arch / i386 / lib / lock_check.c
blobe95ca61456914b47921aefca595c3e3d2c63488f
1 #include <linux/sched.h>
2 #include <linux/interrupt.h>
4 unsigned int spinlocks[32];
6 static void show_stack(unsigned int *stack)
8 int i;
10 for (i = 0; i < 40; i++) {
11 extern int get_options, __start_fixup;
12 unsigned int p = stack[i];
13 if (p >= (unsigned int) &get_options && p < (unsigned int)&__start_fixup)
14 printk("[<%08x>] ", p);
18 void __putlock_negative(
19 unsigned int ecx,
20 unsigned int edx,
21 unsigned int eax,
22 unsigned int from_where)
24 static int count = 0;
26 spinlocks[current->processor] = 0;
28 if (count < 5) {
29 count++;
30 printk("negative putlock from %x\n", from_where);
31 show_stack(&ecx);
35 void __check_locks(unsigned int type)
37 static int warned = 0;
39 if (warned < 5) {
40 unsigned int from_where = (&type)[-1];
41 unsigned int this_cpu = current->processor;
42 int bad_irq = 0;
44 if (type) {
45 unsigned long flags;
46 __save_flags(flags);
47 if (!(flags & 0x200) || (global_irq_holder == this_cpu))
48 bad_irq = 1;
51 if (spinlocks[this_cpu] ||
52 local_irq_count[this_cpu] ||
53 local_bh_count[this_cpu] ||
54 bad_irq) {
55 warned++;
56 printk("scheduling with spinlocks=%d at %x\n", spinlocks[this_cpu], from_where);
57 show_stack(&type);