aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/lockdep.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/lockdep.c')
-rw-r--r--kernel/lockdep.c51
1 files changed, 20 insertions, 31 deletions
diff --git a/kernel/lockdep.c b/kernel/lockdep.c
index 7065a687ac54..1a5ff2211d88 100644
--- a/kernel/lockdep.c
+++ b/kernel/lockdep.c
@@ -257,9 +257,8 @@ static int save_trace(struct stack_trace *trace)
257 trace->entries = stack_trace + nr_stack_trace_entries; 257 trace->entries = stack_trace + nr_stack_trace_entries;
258 258
259 trace->skip = 3; 259 trace->skip = 3;
260 trace->all_contexts = 0;
261 260
262 save_stack_trace(trace, NULL); 261 save_stack_trace(trace);
263 262
264 trace->max_entries = trace->nr_entries; 263 trace->max_entries = trace->nr_entries;
265 264
@@ -341,10 +340,7 @@ static const char *usage_str[] =
341 340
342const char * __get_key_name(struct lockdep_subclass_key *key, char *str) 341const char * __get_key_name(struct lockdep_subclass_key *key, char *str)
343{ 342{
344 unsigned long offs, size; 343 return kallsyms_lookup((unsigned long)key, NULL, NULL, NULL, str);
345 char *modname;
346
347 return kallsyms_lookup((unsigned long)key, &size, &offs, &modname, str);
348} 344}
349 345
350void 346void
@@ -1313,8 +1309,9 @@ out_unlock_set:
1313 1309
1314/* 1310/*
1315 * Look up a dependency chain. If the key is not present yet then 1311 * Look up a dependency chain. If the key is not present yet then
1316 * add it and return 0 - in this case the new dependency chain is 1312 * add it and return 1 - in this case the new dependency chain is
1317 * validated. If the key is already hashed, return 1. 1313 * validated. If the key is already hashed, return 0.
1314 * (On return with 1 graph_lock is held.)
1318 */ 1315 */
1319static inline int lookup_chain_cache(u64 chain_key, struct lock_class *class) 1316static inline int lookup_chain_cache(u64 chain_key, struct lock_class *class)
1320{ 1317{
@@ -1577,7 +1574,7 @@ valid_state(struct task_struct *curr, struct held_lock *this,
1577 * Mark a lock with a usage bit, and validate the state transition: 1574 * Mark a lock with a usage bit, and validate the state transition:
1578 */ 1575 */
1579static int mark_lock(struct task_struct *curr, struct held_lock *this, 1576static int mark_lock(struct task_struct *curr, struct held_lock *this,
1580 enum lock_usage_bit new_bit, unsigned long ip) 1577 enum lock_usage_bit new_bit)
1581{ 1578{
1582 unsigned int new_mask = 1 << new_bit, ret = 1; 1579 unsigned int new_mask = 1 << new_bit, ret = 1;
1583 1580
@@ -1600,14 +1597,6 @@ static int mark_lock(struct task_struct *curr, struct held_lock *this,
1600 1597
1601 this->class->usage_mask |= new_mask; 1598 this->class->usage_mask |= new_mask;
1602 1599
1603#ifdef CONFIG_TRACE_IRQFLAGS
1604 if (new_bit == LOCK_ENABLED_HARDIRQS ||
1605 new_bit == LOCK_ENABLED_HARDIRQS_READ)
1606 ip = curr->hardirq_enable_ip;
1607 else if (new_bit == LOCK_ENABLED_SOFTIRQS ||
1608 new_bit == LOCK_ENABLED_SOFTIRQS_READ)
1609 ip = curr->softirq_enable_ip;
1610#endif
1611 if (!save_trace(this->class->usage_traces + new_bit)) 1600 if (!save_trace(this->class->usage_traces + new_bit))
1612 return 0; 1601 return 0;
1613 1602
@@ -1806,7 +1795,7 @@ static int mark_lock(struct task_struct *curr, struct held_lock *this,
1806 * Mark all held locks with a usage bit: 1795 * Mark all held locks with a usage bit:
1807 */ 1796 */
1808static int 1797static int
1809mark_held_locks(struct task_struct *curr, int hardirq, unsigned long ip) 1798mark_held_locks(struct task_struct *curr, int hardirq)
1810{ 1799{
1811 enum lock_usage_bit usage_bit; 1800 enum lock_usage_bit usage_bit;
1812 struct held_lock *hlock; 1801 struct held_lock *hlock;
@@ -1826,7 +1815,7 @@ mark_held_locks(struct task_struct *curr, int hardirq, unsigned long ip)
1826 else 1815 else
1827 usage_bit = LOCK_ENABLED_SOFTIRQS; 1816 usage_bit = LOCK_ENABLED_SOFTIRQS;
1828 } 1817 }
1829 if (!mark_lock(curr, hlock, usage_bit, ip)) 1818 if (!mark_lock(curr, hlock, usage_bit))
1830 return 0; 1819 return 0;
1831 } 1820 }
1832 1821
@@ -1879,7 +1868,7 @@ void trace_hardirqs_on(void)
1879 * We are going to turn hardirqs on, so set the 1868 * We are going to turn hardirqs on, so set the
1880 * usage bit for all held locks: 1869 * usage bit for all held locks:
1881 */ 1870 */
1882 if (!mark_held_locks(curr, 1, ip)) 1871 if (!mark_held_locks(curr, 1))
1883 return; 1872 return;
1884 /* 1873 /*
1885 * If we have softirqs enabled, then set the usage 1874 * If we have softirqs enabled, then set the usage
@@ -1887,7 +1876,7 @@ void trace_hardirqs_on(void)
1887 * this bit from being set before) 1876 * this bit from being set before)
1888 */ 1877 */
1889 if (curr->softirqs_enabled) 1878 if (curr->softirqs_enabled)
1890 if (!mark_held_locks(curr, 0, ip)) 1879 if (!mark_held_locks(curr, 0))
1891 return; 1880 return;
1892 1881
1893 curr->hardirq_enable_ip = ip; 1882 curr->hardirq_enable_ip = ip;
@@ -1955,7 +1944,7 @@ void trace_softirqs_on(unsigned long ip)
1955 * enabled too: 1944 * enabled too:
1956 */ 1945 */
1957 if (curr->hardirqs_enabled) 1946 if (curr->hardirqs_enabled)
1958 mark_held_locks(curr, 0, ip); 1947 mark_held_locks(curr, 0);
1959} 1948}
1960 1949
1961/* 1950/*
@@ -2093,43 +2082,43 @@ static int __lock_acquire(struct lockdep_map *lock, unsigned int subclass,
2093 if (read) { 2082 if (read) {
2094 if (curr->hardirq_context) 2083 if (curr->hardirq_context)
2095 if (!mark_lock(curr, hlock, 2084 if (!mark_lock(curr, hlock,
2096 LOCK_USED_IN_HARDIRQ_READ, ip)) 2085 LOCK_USED_IN_HARDIRQ_READ))
2097 return 0; 2086 return 0;
2098 if (curr->softirq_context) 2087 if (curr->softirq_context)
2099 if (!mark_lock(curr, hlock, 2088 if (!mark_lock(curr, hlock,
2100 LOCK_USED_IN_SOFTIRQ_READ, ip)) 2089 LOCK_USED_IN_SOFTIRQ_READ))
2101 return 0; 2090 return 0;
2102 } else { 2091 } else {
2103 if (curr->hardirq_context) 2092 if (curr->hardirq_context)
2104 if (!mark_lock(curr, hlock, LOCK_USED_IN_HARDIRQ, ip)) 2093 if (!mark_lock(curr, hlock, LOCK_USED_IN_HARDIRQ))
2105 return 0; 2094 return 0;
2106 if (curr->softirq_context) 2095 if (curr->softirq_context)
2107 if (!mark_lock(curr, hlock, LOCK_USED_IN_SOFTIRQ, ip)) 2096 if (!mark_lock(curr, hlock, LOCK_USED_IN_SOFTIRQ))
2108 return 0; 2097 return 0;
2109 } 2098 }
2110 } 2099 }
2111 if (!hardirqs_off) { 2100 if (!hardirqs_off) {
2112 if (read) { 2101 if (read) {
2113 if (!mark_lock(curr, hlock, 2102 if (!mark_lock(curr, hlock,
2114 LOCK_ENABLED_HARDIRQS_READ, ip)) 2103 LOCK_ENABLED_HARDIRQS_READ))
2115 return 0; 2104 return 0;
2116 if (curr->softirqs_enabled) 2105 if (curr->softirqs_enabled)
2117 if (!mark_lock(curr, hlock, 2106 if (!mark_lock(curr, hlock,
2118 LOCK_ENABLED_SOFTIRQS_READ, ip)) 2107 LOCK_ENABLED_SOFTIRQS_READ))
2119 return 0; 2108 return 0;
2120 } else { 2109 } else {
2121 if (!mark_lock(curr, hlock, 2110 if (!mark_lock(curr, hlock,
2122 LOCK_ENABLED_HARDIRQS, ip)) 2111 LOCK_ENABLED_HARDIRQS))
2123 return 0; 2112 return 0;
2124 if (curr->softirqs_enabled) 2113 if (curr->softirqs_enabled)
2125 if (!mark_lock(curr, hlock, 2114 if (!mark_lock(curr, hlock,
2126 LOCK_ENABLED_SOFTIRQS, ip)) 2115 LOCK_ENABLED_SOFTIRQS))
2127 return 0; 2116 return 0;
2128 } 2117 }
2129 } 2118 }
2130#endif 2119#endif
2131 /* mark it as used: */ 2120 /* mark it as used: */
2132 if (!mark_lock(curr, hlock, LOCK_USED, ip)) 2121 if (!mark_lock(curr, hlock, LOCK_USED))
2133 return 0; 2122 return 0;
2134out_calc_hash: 2123out_calc_hash:
2135 /* 2124 /*