aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kernel/lockdep.c38
1 files changed, 15 insertions, 23 deletions
diff --git a/kernel/lockdep.c b/kernel/lockdep.c
index dc4ea4c2b4c..1a5ff2211d8 100644
--- a/kernel/lockdep.c
+++ b/kernel/lockdep.c
@@ -1574,7 +1574,7 @@ valid_state(struct task_struct *curr, struct held_lock *this,
1574 * 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:
1575 */ 1575 */
1576static int mark_lock(struct task_struct *curr, struct held_lock *this, 1576static int mark_lock(struct task_struct *curr, struct held_lock *this,
1577 enum lock_usage_bit new_bit, unsigned long ip) 1577 enum lock_usage_bit new_bit)
1578{ 1578{
1579 unsigned int new_mask = 1 << new_bit, ret = 1; 1579 unsigned int new_mask = 1 << new_bit, ret = 1;
1580 1580
@@ -1597,14 +1597,6 @@ static int mark_lock(struct task_struct *curr, struct held_lock *this,
1597 1597
1598 this->class->usage_mask |= new_mask; 1598 this->class->usage_mask |= new_mask;
1599 1599
1600#ifdef CONFIG_TRACE_IRQFLAGS
1601 if (new_bit == LOCK_ENABLED_HARDIRQS ||
1602 new_bit == LOCK_ENABLED_HARDIRQS_READ)
1603 ip = curr->hardirq_enable_ip;
1604 else if (new_bit == LOCK_ENABLED_SOFTIRQS ||
1605 new_bit == LOCK_ENABLED_SOFTIRQS_READ)
1606 ip = curr->softirq_enable_ip;
1607#endif
1608 if (!save_trace(this->class->usage_traces + new_bit)) 1600 if (!save_trace(this->class->usage_traces + new_bit))
1609 return 0; 1601 return 0;
1610 1602
@@ -1803,7 +1795,7 @@ static int mark_lock(struct task_struct *curr, struct held_lock *this,
1803 * Mark all held locks with a usage bit: 1795 * Mark all held locks with a usage bit:
1804 */ 1796 */
1805static int 1797static int
1806mark_held_locks(struct task_struct *curr, int hardirq, unsigned long ip) 1798mark_held_locks(struct task_struct *curr, int hardirq)
1807{ 1799{
1808 enum lock_usage_bit usage_bit; 1800 enum lock_usage_bit usage_bit;
1809 struct held_lock *hlock; 1801 struct held_lock *hlock;
@@ -1823,7 +1815,7 @@ mark_held_locks(struct task_struct *curr, int hardirq, unsigned long ip)
1823 else 1815 else
1824 usage_bit = LOCK_ENABLED_SOFTIRQS; 1816 usage_bit = LOCK_ENABLED_SOFTIRQS;
1825 } 1817 }
1826 if (!mark_lock(curr, hlock, usage_bit, ip)) 1818 if (!mark_lock(curr, hlock, usage_bit))
1827 return 0; 1819 return 0;
1828 } 1820 }
1829 1821
@@ -1876,7 +1868,7 @@ void trace_hardirqs_on(void)
1876 * We are going to turn hardirqs on, so set the 1868 * We are going to turn hardirqs on, so set the
1877 * usage bit for all held locks: 1869 * usage bit for all held locks:
1878 */ 1870 */
1879 if (!mark_held_locks(curr, 1, ip)) 1871 if (!mark_held_locks(curr, 1))
1880 return; 1872 return;
1881 /* 1873 /*
1882 * If we have softirqs enabled, then set the usage 1874 * If we have softirqs enabled, then set the usage
@@ -1884,7 +1876,7 @@ void trace_hardirqs_on(void)
1884 * this bit from being set before) 1876 * this bit from being set before)
1885 */ 1877 */
1886 if (curr->softirqs_enabled) 1878 if (curr->softirqs_enabled)
1887 if (!mark_held_locks(curr, 0, ip)) 1879 if (!mark_held_locks(curr, 0))
1888 return; 1880 return;
1889 1881
1890 curr->hardirq_enable_ip = ip; 1882 curr->hardirq_enable_ip = ip;
@@ -1952,7 +1944,7 @@ void trace_softirqs_on(unsigned long ip)
1952 * enabled too: 1944 * enabled too:
1953 */ 1945 */
1954 if (curr->hardirqs_enabled) 1946 if (curr->hardirqs_enabled)
1955 mark_held_locks(curr, 0, ip); 1947 mark_held_locks(curr, 0);
1956} 1948}
1957 1949
1958/* 1950/*
@@ -2090,43 +2082,43 @@ static int __lock_acquire(struct lockdep_map *lock, unsigned int subclass,
2090 if (read) { 2082 if (read) {
2091 if (curr->hardirq_context) 2083 if (curr->hardirq_context)
2092 if (!mark_lock(curr, hlock, 2084 if (!mark_lock(curr, hlock,
2093 LOCK_USED_IN_HARDIRQ_READ, ip)) 2085 LOCK_USED_IN_HARDIRQ_READ))
2094 return 0; 2086 return 0;
2095 if (curr->softirq_context) 2087 if (curr->softirq_context)
2096 if (!mark_lock(curr, hlock, 2088 if (!mark_lock(curr, hlock,
2097 LOCK_USED_IN_SOFTIRQ_READ, ip)) 2089 LOCK_USED_IN_SOFTIRQ_READ))
2098 return 0; 2090 return 0;
2099 } else { 2091 } else {
2100 if (curr->hardirq_context) 2092 if (curr->hardirq_context)
2101 if (!mark_lock(curr, hlock, LOCK_USED_IN_HARDIRQ, ip)) 2093 if (!mark_lock(curr, hlock, LOCK_USED_IN_HARDIRQ))
2102 return 0; 2094 return 0;
2103 if (curr->softirq_context) 2095 if (curr->softirq_context)
2104 if (!mark_lock(curr, hlock, LOCK_USED_IN_SOFTIRQ, ip)) 2096 if (!mark_lock(curr, hlock, LOCK_USED_IN_SOFTIRQ))
2105 return 0; 2097 return 0;
2106 } 2098 }
2107 } 2099 }
2108 if (!hardirqs_off) { 2100 if (!hardirqs_off) {
2109 if (read) { 2101 if (read) {
2110 if (!mark_lock(curr, hlock, 2102 if (!mark_lock(curr, hlock,
2111 LOCK_ENABLED_HARDIRQS_READ, ip)) 2103 LOCK_ENABLED_HARDIRQS_READ))
2112 return 0; 2104 return 0;
2113 if (curr->softirqs_enabled) 2105 if (curr->softirqs_enabled)
2114 if (!mark_lock(curr, hlock, 2106 if (!mark_lock(curr, hlock,
2115 LOCK_ENABLED_SOFTIRQS_READ, ip)) 2107 LOCK_ENABLED_SOFTIRQS_READ))
2116 return 0; 2108 return 0;
2117 } else { 2109 } else {
2118 if (!mark_lock(curr, hlock, 2110 if (!mark_lock(curr, hlock,
2119 LOCK_ENABLED_HARDIRQS, ip)) 2111 LOCK_ENABLED_HARDIRQS))
2120 return 0; 2112 return 0;
2121 if (curr->softirqs_enabled) 2113 if (curr->softirqs_enabled)
2122 if (!mark_lock(curr, hlock, 2114 if (!mark_lock(curr, hlock,
2123 LOCK_ENABLED_SOFTIRQS, ip)) 2115 LOCK_ENABLED_SOFTIRQS))
2124 return 0; 2116 return 0;
2125 } 2117 }
2126 } 2118 }
2127#endif 2119#endif
2128 /* mark it as used: */ 2120 /* mark it as used: */
2129 if (!mark_lock(curr, hlock, LOCK_USED, ip)) 2121 if (!mark_lock(curr, hlock, LOCK_USED))
2130 return 0; 2122 return 0;
2131out_calc_hash: 2123out_calc_hash:
2132 /* 2124 /*