linux/kernel/lockdep.c
<<
>>
Prefs
   1/*
   2 * kernel/lockdep.c
   3 *
   4 * Runtime locking correctness validator
   5 *
   6 * Started by Ingo Molnar:
   7 *
   8 *  Copyright (C) 2006,2007 Red Hat, Inc., Ingo Molnar <mingo@redhat.com>
   9 *  Copyright (C) 2007 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com>
  10 *
  11 * this code maps all the lock dependencies as they occur in a live kernel
  12 * and will warn about the following classes of locking bugs:
  13 *
  14 * - lock inversion scenarios
  15 * - circular lock dependencies
  16 * - hardirq/softirq safe/unsafe locking bugs
  17 *
  18 * Bugs are reported even if the current locking scenario does not cause
  19 * any deadlock at this point.
  20 *
  21 * I.e. if anytime in the past two locks were taken in a different order,
  22 * even if it happened for another task, even if those were different
  23 * locks (but of the same class as this lock), this code will detect it.
  24 *
  25 * Thanks to Arjan van de Ven for coming up with the initial idea of
  26 * mapping lock dependencies runtime.
  27 */
  28#define DISABLE_BRANCH_PROFILING
  29#include <linux/mutex.h>
  30#include <linux/sched.h>
  31#include <linux/delay.h>
  32#include <linux/module.h>
  33#include <linux/proc_fs.h>
  34#include <linux/seq_file.h>
  35#include <linux/spinlock.h>
  36#include <linux/kallsyms.h>
  37#include <linux/interrupt.h>
  38#include <linux/stacktrace.h>
  39#include <linux/debug_locks.h>
  40#include <linux/irqflags.h>
  41#include <linux/utsname.h>
  42#include <linux/hash.h>
  43#include <linux/ftrace.h>
  44#include <linux/stringify.h>
  45#include <linux/bitops.h>
  46#include <linux/gfp.h>
  47#include <linux/kmemcheck.h>
  48
  49#include <asm/sections.h>
  50
  51#include "lockdep_internals.h"
  52
  53#define CREATE_TRACE_POINTS
  54#include <trace/events/lock.h>
  55
  56#ifdef CONFIG_PROVE_LOCKING
  57int prove_locking = 1;
  58module_param(prove_locking, int, 0644);
  59#else
  60#define prove_locking 0
  61#endif
  62
  63#ifdef CONFIG_LOCK_STAT
  64int lock_stat = 1;
  65module_param(lock_stat, int, 0644);
  66#else
  67#define lock_stat 0
  68#endif
  69
  70/*
  71 * lockdep_lock: protects the lockdep graph, the hashes and the
  72 *               class/list/hash allocators.
  73 *
  74 * This is one of the rare exceptions where it's justified
  75 * to use a raw spinlock - we really dont want the spinlock
  76 * code to recurse back into the lockdep code...
  77 */
  78static arch_spinlock_t lockdep_lock = (arch_spinlock_t)__ARCH_SPIN_LOCK_UNLOCKED;
  79
  80static int graph_lock(void)
  81{
  82        arch_spin_lock(&lockdep_lock);
  83        /*
  84         * Make sure that if another CPU detected a bug while
  85         * walking the graph we dont change it (while the other
  86         * CPU is busy printing out stuff with the graph lock
  87         * dropped already)
  88         */
  89        if (!debug_locks) {
  90                arch_spin_unlock(&lockdep_lock);
  91                return 0;
  92        }
  93        /* prevent any recursions within lockdep from causing deadlocks */
  94        current->lockdep_recursion++;
  95        return 1;
  96}
  97
  98static inline int graph_unlock(void)
  99{
 100        if (debug_locks && !arch_spin_is_locked(&lockdep_lock)) {
 101                /*
 102                 * The lockdep graph lock isn't locked while we expect it to
 103                 * be, we're confused now, bye!
 104                 */
 105                return DEBUG_LOCKS_WARN_ON(1);
 106        }
 107
 108        current->lockdep_recursion--;
 109        arch_spin_unlock(&lockdep_lock);
 110        return 0;
 111}
 112
 113/*
 114 * Turn lock debugging off and return with 0 if it was off already,
 115 * and also release the graph lock:
 116 */
 117static inline int debug_locks_off_graph_unlock(void)
 118{
 119        int ret = debug_locks_off();
 120
 121        arch_spin_unlock(&lockdep_lock);
 122
 123        return ret;
 124}
 125
 126static int lockdep_initialized;
 127
 128unsigned long nr_list_entries;
 129static struct lock_list list_entries[MAX_LOCKDEP_ENTRIES];
 130
 131/*
 132 * All data structures here are protected by the global debug_lock.
 133 *
 134 * Mutex key structs only get allocated, once during bootup, and never
 135 * get freed - this significantly simplifies the debugging code.
 136 */
 137unsigned long nr_lock_classes;
 138static struct lock_class lock_classes[MAX_LOCKDEP_KEYS];
 139
 140static inline struct lock_class *hlock_class(struct held_lock *hlock)
 141{
 142        if (!hlock->class_idx) {
 143                /*
 144                 * Someone passed in garbage, we give up.
 145                 */
 146                DEBUG_LOCKS_WARN_ON(1);
 147                return NULL;
 148        }
 149        return lock_classes + hlock->class_idx - 1;
 150}
 151
 152#ifdef CONFIG_LOCK_STAT
 153static DEFINE_PER_CPU(struct lock_class_stats[MAX_LOCKDEP_KEYS],
 154                      cpu_lock_stats);
 155
 156static inline u64 lockstat_clock(void)
 157{
 158        return local_clock();
 159}
 160
 161static int lock_point(unsigned long points[], unsigned long ip)
 162{
 163        int i;
 164
 165        for (i = 0; i < LOCKSTAT_POINTS; i++) {
 166                if (points[i] == 0) {
 167                        points[i] = ip;
 168                        break;
 169                }
 170                if (points[i] == ip)
 171                        break;
 172        }
 173
 174        return i;
 175}
 176
 177static void lock_time_inc(struct lock_time *lt, u64 time)
 178{
 179        if (time > lt->max)
 180                lt->max = time;
 181
 182        if (time < lt->min || !lt->nr)
 183                lt->min = time;
 184
 185        lt->total += time;
 186        lt->nr++;
 187}
 188
 189static inline void lock_time_add(struct lock_time *src, struct lock_time *dst)
 190{
 191        if (!src->nr)
 192                return;
 193
 194        if (src->max > dst->max)
 195                dst->max = src->max;
 196
 197        if (src->min < dst->min || !dst->nr)
 198                dst->min = src->min;
 199
 200        dst->total += src->total;
 201        dst->nr += src->nr;
 202}
 203
 204struct lock_class_stats lock_stats(struct lock_class *class)
 205{
 206        struct lock_class_stats stats;
 207        int cpu, i;
 208
 209        memset(&stats, 0, sizeof(struct lock_class_stats));
 210        for_each_possible_cpu(cpu) {
 211                struct lock_class_stats *pcs =
 212                        &per_cpu(cpu_lock_stats, cpu)[class - lock_classes];
 213
 214                for (i = 0; i < ARRAY_SIZE(stats.contention_point); i++)
 215                        stats.contention_point[i] += pcs->contention_point[i];
 216
 217                for (i = 0; i < ARRAY_SIZE(stats.contending_point); i++)
 218                        stats.contending_point[i] += pcs->contending_point[i];
 219
 220                lock_time_add(&pcs->read_waittime, &stats.read_waittime);
 221                lock_time_add(&pcs->write_waittime, &stats.write_waittime);
 222
 223                lock_time_add(&pcs->read_holdtime, &stats.read_holdtime);
 224                lock_time_add(&pcs->write_holdtime, &stats.write_holdtime);
 225
 226                for (i = 0; i < ARRAY_SIZE(stats.bounces); i++)
 227                        stats.bounces[i] += pcs->bounces[i];
 228        }
 229
 230        return stats;
 231}
 232
 233void clear_lock_stats(struct lock_class *class)
 234{
 235        int cpu;
 236
 237        for_each_possible_cpu(cpu) {
 238                struct lock_class_stats *cpu_stats =
 239                        &per_cpu(cpu_lock_stats, cpu)[class - lock_classes];
 240
 241                memset(cpu_stats, 0, sizeof(struct lock_class_stats));
 242        }
 243        memset(class->contention_point, 0, sizeof(class->contention_point));
 244        memset(class->contending_point, 0, sizeof(class->contending_point));
 245}
 246
 247static struct lock_class_stats *get_lock_stats(struct lock_class *class)
 248{
 249        return &get_cpu_var(cpu_lock_stats)[class - lock_classes];
 250}
 251
 252static void put_lock_stats(struct lock_class_stats *stats)
 253{
 254        put_cpu_var(cpu_lock_stats);
 255}
 256
 257static void lock_release_holdtime(struct held_lock *hlock)
 258{
 259        struct lock_class_stats *stats;
 260        u64 holdtime;
 261
 262        if (!lock_stat)
 263                return;
 264
 265        holdtime = lockstat_clock() - hlock->holdtime_stamp;
 266
 267        stats = get_lock_stats(hlock_class(hlock));
 268        if (hlock->read)
 269                lock_time_inc(&stats->read_holdtime, holdtime);
 270        else
 271                lock_time_inc(&stats->write_holdtime, holdtime);
 272        put_lock_stats(stats);
 273}
 274#else
 275static inline void lock_release_holdtime(struct held_lock *hlock)
 276{
 277}
 278#endif
 279
 280/*
 281 * We keep a global list of all lock classes. The list only grows,
 282 * never shrinks. The list is only accessed with the lockdep
 283 * spinlock lock held.
 284 */
 285LIST_HEAD(all_lock_classes);
 286
 287/*
 288 * The lockdep classes are in a hash-table as well, for fast lookup:
 289 */
 290#define CLASSHASH_BITS          (MAX_LOCKDEP_KEYS_BITS - 1)
 291#define CLASSHASH_SIZE          (1UL << CLASSHASH_BITS)
 292#define __classhashfn(key)      hash_long((unsigned long)key, CLASSHASH_BITS)
 293#define classhashentry(key)     (classhash_table + __classhashfn((key)))
 294
 295static struct list_head classhash_table[CLASSHASH_SIZE];
 296
 297/*
 298 * We put the lock dependency chains into a hash-table as well, to cache
 299 * their existence:
 300 */
 301#define CHAINHASH_BITS          (MAX_LOCKDEP_CHAINS_BITS-1)
 302#define CHAINHASH_SIZE          (1UL << CHAINHASH_BITS)
 303#define __chainhashfn(chain)    hash_long(chain, CHAINHASH_BITS)
 304#define chainhashentry(chain)   (chainhash_table + __chainhashfn((chain)))
 305
 306static struct list_head chainhash_table[CHAINHASH_SIZE];
 307
 308/*
 309 * The hash key of the lock dependency chains is a hash itself too:
 310 * it's a hash of all locks taken up to that lock, including that lock.
 311 * It's a 64-bit hash, because it's important for the keys to be
 312 * unique.
 313 */
 314#define iterate_chain_key(key1, key2) \
 315        (((key1) << MAX_LOCKDEP_KEYS_BITS) ^ \
 316        ((key1) &lgcod" na(4-ba href="+code=MAX_LOCKDEP_KEYS_BITS" class="sref">MAX_LOCKDEP_KEYS_BITS)  ^ \
 237         key2) 
 231
 239
oid lock_ep._off/a>( 232{
 232        courret"/a>->cock_ep._reoursio"/a>-+;
 232}
 233 a href="+code=wEXPORT_SYMBO" class="sref">NEXPORT_SYMBO"/a>(lock_ep._off/a>(;
 232
 235
oid cock_ep._o"/a>- 232{
 232        courret"/a>->cock_ep._reoursio"/a>---
 238 
 239
a href="+code=wEXPORT_SYMBO" class="sref">NEXPORT_SYMBO"/a>(cock_ep._o"/a>-;
 233
 233 *
 233 * uDebuggng tswitches
 233 */
 233
 235 define CVERBOS"/a>          ((((((((0 236
define CVERY_VERBOS"/a>          (((0 233
 238 #i CVERBOS"/a>  239 # efine CHARDIRQ_VERBOS"/a>         1 230
# efine CSOFTIRQ_VERBOS"/a>         1 231 # efine CRECLAIM_VERBOS"/a>         1 232 else
 233 # efine CHARDIRQ_VERBOS"/a>         0 234 # efine CSOFTIRQ_VERBOS"/a>         0 235}# efine CRECLAIM_VERBOS"/a>         0 236
endif
 234
 234 #i CVERBOS"/a> || !a href="+code=iHARDIRQ_VERBOS" class="sref">CHARDIRQ_VERBOS"/a>  | !a href="+code=iSOFTIRQ_VERBOS" class="sref">CSOFTIRQ_VERBOS"/a>  | !a href="+code=iRECLAIM_VERBOS" class="sref">CRECLAIM_VERBOS"/a>  234 *
 235 * iQuick filterng tor tinterestng tevnt"s
 235 * 
 232static vnt classh_filter/a>(lock_class *class)
 233{
 234 #i <0 235         *< Example* 
 235        (f (class)>crme=_versio"/a>  == 1& 235                        <hrtrcp"/a>(class)>crme=/a>, "ockdrme="/span>
 
 235                seturn &1< 239        sf (class)>crme=_versio"/a>  == 1& 236                <       <hrtrcp"/a>(class)>crme=/a>, "amp;
 
 236                 2362/a>
endif
 233         apan class="comment"> *< Filtertevnrythng tese
. 1&would beto ballowtevnrythng tese
* 
 236         236}
 236
endif
 236
 238 tatic vnt cvnrbos=/a>(lock_class *class)
 239 
 230 #i CVERBOS"/a>  231         eturn classh_filter/a>(class)
< 2372/a>
endif
 2373/a>         234#
 237
 236{span class="comment"> *
 237/* iStack-trace: tightly packed arra of tstack backtrace/span>
 237 * Waddreses. TProtected bythe kgraph_ock.
 237 */
 230anr_stack_trace_ntryis"/a><< 231hrtack_trace/a>[MAX_LSTACK_TRACE_ENTRIE"/a>];
 238
 233hrave_trace/a>(hrtack_trace/a>[*htrace/a>[
 238{
 238        htrace/a>[>anr_ntryis"/a><= 0;  2386/a>        htrace/a>[>amax_ntryis"/a><= 0a href="+code=CAX_LSTACK_TRACE_ENTRIE" class="sref">MAX_LSTACK_TRACE_ENTRIE"/a>]- anr_stack_trace_ntryis"/a><< 238        htrace/a>[>antryis"/a><= 0a href="+code=Cstack_trace class="sref">hrtack_trace/a>[* anr_stack_trace_ntryis"/a><< 238
 238        htrace/a>[>hrki"/a><= 03< 239
 239        hrave_stack_trace/a>(htrace/a>[
< 239
 239         apan class="comment"> *
 239 ********* iSome daft archesput t-1 a the lndito bidifcat it& a 6full trace
 235sspan class="comment"> ********* /span>
 239{span class="comment"> ********* ilt; rantd" nathi is abuggy anyway siznc it&taken a 6whol lnxtra ntry< so a/span>
 237/********* iommplet itracethat lmaxn aou the lndryis" providd witll be
 238 ********* ia intommplet , friggng useleseilt; /rantd" n/span>
 239 ********* 
 340         f (htrace/a>[>anr_ntryis"/a><=! 0;& 340             a href="+code=strace class="sref">htrace/a>[>antryis"/a><htrace/a>[>anr_ntryis"/a><-1] == a href="+code=nULONG_AX_ class="sref">aULONG_AX_/a>[
 340                 a href="+code=Ctrace class="sref">htrace/a>[>anr_ntryis"/a><--
 340
 340        htrace/a>[>amax_ntryis"/a><= 0a href="+code=Ctrace class="sref">htrace/a>[>anr_ntryis"/a><
 345
 3406/a>        anr_stack_trace_ntryis"/a><+= htrace/a>[>anr_ntryis"/a><
 347
 340        if (anr_stack_trace_ntryis"/a><+gt;< 0a href="+code=CAX_LSTACK_TRACE_ENTRIE" class="sref">MAX_LSTACK_TRACE_ENTRIE"/a>]-1 {
 340                Mdebug_ock.s_off_graph_ulock /a>(< 
 341                <        341
 341                 a href="+code=Cprint  class="sref">Mprint /a>("BUG: AX_LSTACK_TRACE_ENTRIE"too: low!\n"/span>
 < 341                Mprint /a>("urn ng toffthe lock ng tcorrectneseivalidator.\n"/span>
 < 341                Mdump_stack/a>(< < 341
 341                feturn &0< 247         
 241
 241        return &1< 242}
 242
 242}nsigned lnt anr_hardirqchain_"/a><
 243 nsigned lnt anr_softirqchain_"/a><
 242
nsigned lnt anr_proessechain_"/a><
 245
nsigned lnt amax_ock_ep._ep.th/a><
 242
 242 #ifde aCONFIG_DEBUGLOCKDEP_/a>
 242/*
 242 * TWe cannot print in aearly bootup ode=. Not evntaearly_print ()/span>
 243 * imight work. So we mark anyin itializaion_ errors and print /apan>
 243 * iabou tit laterton inclockdep _info()
 243 * 
 243lock_ep _init_error/a><
 243
tatic vconstchair*lock__init_error/a><
 243static snsigned long)lock_ep _init_trace_data/a><<20;
 243static struct hrtack_trace/a>[*a href="+code=sock_ep _init_trace class="sref">lock_ep _init_trace/a><= 0
 247        <.a href="+code=nmax_ntryis" class="sref">amax_ntryis"/a><= 0a href="+code=CARRAYSIZE" class="sref">CARRAYSIZE"/a>(lock_ep _init_trace_data/a><), 248         .a href="+code=nntryis" class="sref">antryis"/a><= 0a href="+code=Cock_ep _init_trace_data class="sref">lock_ep _init_trace_data/a><, 249 }
 240
 244 *
 244 * uVariouslockdep ctaticsic s
 244 */
 244 a href="+code=CDEFINE_PER_CPU class="sref">lDEFINE_PER_CPU/a>(lock_ep _tats"/a><,lock_ep _tats"/a>< < 245}#ndif
 246
 244/*
 244 * WLck ng tprintou s
 244 */
 245
 245#define C__USAG"/a>(C__STAT"/a><                <       <<<<<<<<<<<<<<<<<<<<<<<<<
 245         COCKD_USED_IN_/a>#d#__STAT"]= 0apan class="crtrng ">"IN-"/span>
a href="+code=c_Lrtrng if" class="sref">i_Lrtrng if"/a>(C__STAT"/a>< apan class="crtrng ">"-W"/span>
,<<<<<<<
 2453/a>         COCKD_ENABLED_/a>#d#__STAT"]= 0a href="+code=c_Lrtrng if" class="sref">i_Lrtrng if"/a>(C__STAT"/a>< apan class="crtrng ">"-ON-W"/span>
,<<<<<<<<<
 244        <COCKD_USED_IN_/a>#d#__STAT"d#_READ]= 0apan class="crtrng ">"IN-"/span>
a href="+code=c_Lrtrng if" class="sref">i_Lrtrng if"/a>(C__STAT"/a>< apan class="crtrng ">"-R"/span>
,
 245        <COCKD_ENABLED_/a>#d#__STAT"d#_READ]= 0a href="+code=c_Lrtrng if" class="sref">i_Lrtrng if"/a>(C__STAT"/a>< apan class="crtrng ">"-ON-R"/span>
, 246
 247static vconstchair*lusage_str/a><<]=  248{
 249 define COCKDEP_KSTAT"/a>(C__STAT"/a><  a href="+code=C__USAG" class="sref">C__USAG"/a>(C__STAT"/a><  246 #icludie "/ href="kernel/lockdep._tatses.h class="sfef">lock_ep _tatses.h/a> " 246 #unde COCKDEP_KSTAT"/a>( 246         COCKD_USED/a> ]= 0apan class="crtrng ">"INITIAL USE"/span>
, 243 }
 244
 246}constchair*< a href="+code=C__et_lkey_rme= class="sref">c__et_lkey_rme=/a>(iock_ep _tublass=key"/a>  key, lstr/a><  246{
 247        keallsyms_ookup:/a>(key, NNUL"/a>, NNUL"/a>, NNUL"/a>, lstr/a>< 
 246 
 246
 240 tatic inline vnsigned long)hock__fla"/a>(cock__usage_bi"/a>[*a href="+code=sbi" class="sref">cbi"/a>[  241 
 242        cbi"/a>[
 243}
 247
 245static cet_lusage_hair/a>(lock_class *class), enumcock__usage_bi"/a>[*a href="+code=sbi" class="sref">cbi"/a>[  246{
 247        lc/a><= 0apan class="crtrng ">&39;s.&39;s/span>

 247
 247        sf (class)>Musage_mask/a>  amp;<hock__fla"/a>(cbi"/a>[ + 2 
 248                lc/a><= 0apan class="crtrng ">&39;s+&39;s/span>

 2481/a>        sf (class)>Musage_mask/a>  amp;<hock__fla"/a>(cbi"/a>[) {
 248                 a href="+code=C" class="sref">lc/a><= 0apan class="crtrng ">&39;s-&39;s/span>

 248                class)>Musage_mask/a>  amp;<hock__fla"/a>(cbi"/a>[ + 2 
 248                <        a href="+code=C" class="sref">lc/a><= 0apan class="crtrng ">&39;s?&39;s/span>

 248        <
 246
 248        lc/a><
 248 
 248
 249
oid cet_lusage_hair"/a>(lock_class *class), hair*a href="+code=Cusage class="sref">Musage/a><MOCKD_USAGECHAIR"/a> ]
 249 
 249         nt in/a><= 00< 249
 249#define COCKDEP_KSTAT"/a>(C__STAT"/a><                                           
 249        Musage/a><in/a><++]= 0a href="+code=cet_lusage_hair class="sref">cet_lusage_hair/a>(class), a href="+code=COCKD_USED_IN_ class="sref">COCKD_USED_IN_/a>#d#__STAT");     
 2496/a>        Musage/a><in/a><++]= 0a href="+code=cet_lusage_hair class="sref">cet_lusage_hair/a>(class), a href="+code=COCKD_USED_IN_ class="sref">COCKD_USED_IN_/a>#d#__STAT"d#_READ 
 2497/a> #icludie "/ href="kernel/lockdep._tatses.h class="sfef">lock_ep _tatses.h/a> " 248<#unde COCKDEP_KSTAT"/a>( 249
 350         a href="+code=husage class="sref">Musage/a><in/a><]= 0apan class="crtrng ">&39;s\0&39;s/span>

 350 
 350
 350c__print_ock__rme=/a>(lock_class *class)
 350{
 350        lstr/a><lKSYM_NAME_LEN/a><]
 3506/a>        crme=/a>(
 357
 350        ia href="+code=crme= class="sref">crme=/a>(= 0a href="+code=class" class="sref">class)>crme=/a>(
 350        sf (<crme=/a>( {
 351                crme=/a>(= 0a href="+code=c__et_lkey_rme= class="sref">c__et_lkey_rme=/a>(class)>key, lstr/a>< 
 351                Mprint /a>("&397;s"/span>
,crme=/a>( 
 351         }tese
*
 351                Mprint /a>("&397;s"/span>
,crme=/a>( 
 351                class)>crme=_versio"/a>  d" na1
 355        (               Mprint /a>("#&397;d"/span>
,class)>crme=_versio"/a>  
 351                ff (class)>lsublass=/a>)
 251                        Mprint /a>("/&397;d"/span>
,class)>lsublass=/a>)

 251        i
 251 
 252
 252cprint_ock__rme=/a>(lock_class *class)
 252}
 252         hair*a href="+code=Cusage class="sref">Musage/a><MOCKD_USAGECHAIR"/a> ]
 252
 252        cet_lusage_hair"/a>(class), a href="+code=Cusage class="sref">Musage/a><

 252
 252        Mprint /a>(" ("/span>
 < 252        ia href="+code=c__print_ock__rme= class="sref">c__print_ock__rme=/a>(class)
< 252        Mprint /a>("){&397;s}"/span>
,Musage/a><

 253}
 253
 2532/a>cprint_ock_ep _cach=/a>(kock_ep _ma:/a> *kock_/a>)
 253{
 253         constchair*crme=/a>(
 253        lstr/a><lKSYM_NAME_LEN/a><]
 253
 253        crme=/a>(= 0a href="+code=cock_ class="sref">kock_/a>)>crme=/a>(
 253        if (<crme=/a>(  253                crme=/a>(= 0a href="+code=c__et_lkey_rme= class="sref">c__et_lkey_rme=/a>(kock_/a>)>key,>lsubey<=/a>, lstr/a>< 
 250
 254        Mprint /a>("&397;s"/span>
,crme=/a>( 
 254<
 254
 2544/a>cprint_ock_/a>(cheld_ock_/a> *chock_/a>)
 255}
 2546/a>        cprint_ock__rme=/a>(lhock_class"/a>(chock_/a>)
 
 254        Mprint /a>(", at: "/span>
 < 254        ia href="+code=cprint_ip_sym class="sref">cprint_ip_sym/a>(chock_/a>)>hacquire_i"/a>( 
 254 
 255
 255lock_ep _print_held_ock_"/a>(ltask_truct /a> *clurr/a>)
 255}
 2553/a>         nt in/a><,adp.th/a><= 0a href="+code=clurr class="sref">clurr/a>)>aock_ep _dp.th/a>(
 255
 255        adp.th/a>< {
 255                fa href="+code=sprint  class="sref">Mprint /a>("nolockds held byt&397;s/&397;d.\n"/span>
,clurr/a>)>clmme/a><,ctask_pid_nr/a>(clurr/a>)
 
 255                 eturn 
 255        i
 255        Mprint /a>("&397;dlockd&397;s held byt&397;s/&397;d:\n"/span>
, 256                adp.th/a><,adp.th/a><=d" na1 ?0apan class="crtrng ">"s"/span>
 :"aquot;/span>
,clurr/a>)>clmme/a><,ctask_pid_nr/a>(clurr/a>)
 
 256
 256         for(in/a><= 00<in/a><=lt; adp.th/a><<in/a><++ {
 256                Mprint /a>(" #&397;d: "/span>
,in/a>< 
 256                cprint_ock_/a>(clurr/a>)>lheld_ock_"/a>(* in/a>< 
 256        <
 256{
 256
 256 tatic void class="sref">cprint_ernel/_idnt"/a>( 256

 257         a href="+code=hprint  class="sref">Mprint /a>("&397;st&397;.*st&397;s\n"/span>
,cinit_utsrme=/a>(<)>creleas=/a><, 257                <(intcrtrcsp"/a>(cinit_utsrme=/a>(<)>cversio"/a> ," "/span>
 , 257                 a href="+code=Cinit_utsrme= class="sref">cinit_utsrme=/a>(<)>cversio"/a> , 257                cprint_tainted/a>(<) 
 257

 257
 257static snt cvery_verbos=/a>(lock_class *class)
 257 
 257
#i CVERY_VERBOS"/a>
 257        seturn class=_filter/a>(class)
< 258 #ndif
 2581/a>        seturn &0< 258<
 258
 258 *
 258sspan class="comment"> ** Isathi ihe laddreseiof a tatic sobject
 258{span class="comment"> */
 2587/a>static snt crttic _obj/a>(cobj/a>(
 258{
 258        snsigned long)class="sref">crttr"/a><= 0unsigned long)< amp;class="sref">c_stex"/a> , 259                <      a href="+code=cndi>class="sref">cndi/a>     0unsigned long)< amp;c_ndi/a> , 259                <      a href="+code=caddr class="sref">haddr/a>    0unsigned long)< a href="+code=cobj class="sref">cobj/a>(< 259
 259         span class="comment"> *
 259   <      * tatic svariable?/span>
 259sspan class="comment"> * <      *
 2596/a>        haddr/a>  gt;< 0a href="+code=Crttr">class="sref">crttr"/a><)&haddr/a>  gt; cndi/a>  
 259                 eturn &1< 259
 259        sf (larch_is_ernel/_data/a>(haddr/a>  
 360                 360
 360         span class="comment"> *
 360 * <      * in-ernel/ percpusvar?/span>
 360   <      *
 360        cis_ernel/_percpu_addrese/a>(haddr/a>  
 360                feturn &1< 367
 360        iapan class="comment"> *
 360 * <      * module tatic sor percpusvar?/span>
 361 * <      *
 3611/a>        seturn &a href="+code=Cis_module_addrese class="sref">cis_module_addrese/a>(haddr/a>   ||&a href="+code=Cis_module_percpu_addrese class="sref">cis_module_percpu_addrese/a>(haddr/a>  < 361<
 361
 361 *
 361sspan class="comment"> ** To mak lock name=tprintou ssnsique, we calculate asnsique/span>
 361{span class="comment"> */class=>
 261/ *
 261 tatic vnt clount_matching_rme="/a>(lock_class *lnewclass"/a>(
 261

 262         truct lock_class *class)< 2621/a>        sft clount/a><= 00< 262
 262         f (<lnewclass"/a>(>crme=/a>(
 262                 262
 2626/a>        ioist_for_each_ntry"/a>(class), amp;call_ock_class<="/a><,iock_cntry"/a>   
 262                 f (!a href="+code=Crewclass" class="sref">lnewclass"/a>(>key, -lnewclass"/a>(>lsublass=/a>) = 0a href="+code=class" class="sref">class)>key,
 262        i               class)>crme=_versio"/a> < 262                class)>crme=/a>(&hrtrcm"/a>(class)>crme=/a>(,lnewclass"/a>(>crme=/a>(

 263                <        a href="+code=C"ount class="sref">clount/a><= 0a href="+code=Cmax class="sref">cmax/a>(clount/a><,class)>crme=_versio"/a>  
 2631/a>        s
 263
 263         eturn &a href="+code=clount class="sref">clount/a><=+&1< 263

 263
 263{span class="comment"> *
 263/ * Register asockd&399;sclass=sftihe lhash-table,
 263 * Wyet. Ohe rwise we ooku it up. We cace lhe lresultsftihe lock nobject/apan>
 263 */ itself, so actual ookup:iof he lhash should be once perlock nobject./apan>
 264 **
 264inline vtruct lock_class *< 264locok_up_ock_class"/a>(kock_ep _ma:/a> *kock_/a>),snsigned lnt lsublass=/a>)
 264{
 264         truct iock_ep _tublass=key"/a>  key,< 2645/a>         truct coist_heai/a>  chash_heai/a>,< 2646/a>        lock_class *class)< 264
 264
#i de cCONFIG_DEBUG_OCKDEP_/a>
 264         *
 265 * <      * If he larchitecture call=sfttolockdep. before initializing/span>
 265 * <      * he lhashe ihe n we&399;ll wan &about it later. (we cannottprint /apan>
 265}span class="comment"> * <      * right now)/apan>
 265 * <      *
 265         f (kulinkel"/a>(<cock_ep _initialized/a>(

 
 265        <        a href="+code=Cock_ep _init>class="sref">cock_ep _init/a>(< 
 265                fa href="+code=sock_ep _init_error class="sref">hock_ep _init_error/a><= 01< 265                 a href="+code=lock_cinit_error class="sref">hock__init_error/a><= 0a href="+code=cock_ class="sref">kock_/a>)>crme=/a>(
 265        i        a href="+code=ctave_tatk__trac= class="sref">ctave_tatk__trac=/a>(cock_ep _init_trac=/a>  
 265        <
 266 #ndif
 266
 266         f (kulinkel"/a>(lsublass=/a>) gt;< 0a href="+code=CMAX_OCKDEP_KSUBCLASSE" class="sref">MMAX_OCKDEP_KSUBCLASSE"/a>(

 
 266                Mdebug_ock_"_off/a>(< 
 266                Mprint /a>(MKERN_ERR/a>
 266        <               "BUG: ookung  up invalid sublass=:t&397;u\n"/span>
,lsublass=/a>)

 266                fa href="+code=sprint  class="sref">Mprint /a>(MKERN_ERR/a>
 266                        "urn ng  offihe lock ng  correctneseivalidator.\n"/span>


 266        i        a href="+code=cdump_tatk_ class="sref">Mdump_tatk_/a>(< 
 266                MNULL/a>(
 267         
 267
 267         span class="comment"> *
 267 * <      * Satic vock_" do notthaveihe irclass=-ey<=Wyet - for(he mihe ley
 267   <      * i ihe lock nobject itself
 267sspan class="comment"> * <      *
 2676/a>        kulinkel"/a>(<kock_/a>)>key,

 267                 a href="+code=lock_ class="sref">kock_/a>)>key,  0uoid *<kock_/a>)
 267
 267         *
 268 * <      * NOTE:(he llass=-ey< must be nsique. For(dyamec vock_", a tatic /span>
 268 * <      * ock_class
 268}span class="comment"> * <      * (or(spin_ock__init(

 call - which acts asihe ley<. For(tatic /span>
 268 * <      * ock_" we nseihe lock nobject itself asihe ley<./span>
 268 * <      *
 268        lBUILD_BUG_ON/a>(iock_class"key"/a>   gt;< 268                ffffffffftizeofkock_ep _ma:/a> ) 
 268
 268        ia href="+code=cey" class="sref">key,  0a href="+code=lock_ class="sref">kock_/a>)>key,>lsubey<=/a>,* lsublass=/a>)
 268
 269         a href="+code=hhash_heai>class="sref">chash_heai/a>,= 0a href="+code=class"hashetry" class="sref">ilass"hashetry"/a>(key,

 269
 269         span class="comment"> *
 269 * <      * We can walk he lhash ockdfree, becanseihe lhash onl
 269   <      * grow", and we are caef=ul whenladdng  etryie ihoihe lend
 269sspan class="comment"> * <      *
 2696/a>        ioist_for_each_ntry"/a>(class), a href="+code=hhash_heai>class="sref">chash_heai/a>,, a href="+code=hhash_ntry" class="sref">ihash_ntry"/a>   
 269                 f (class)>key,   0a href="+code=cey" class="sref">key,
 
 269        i                *
 269 * <                      * Huh! sme=tey<, differnt"name=? Did someoneihrample/span>
 370 * <                      * on some memory? We&399;re mostchonfnsed./span>
 370 * <                      *
 370                        kWARN_ON_ONCE/a>(class)>crme=/a>(&! 0a href="+code=cock_ class="sref">kock_/a>)>crme=/a>(

 370                <<<<<<<<class)
 370                <
 370        <
 370
 370         eturn &a href="+code=cNULL class="sref">MNULL/a>(
 370 
 370
 371 *
 371 ** Register asockd&399;sclass=sftihe lhash-table,
 371}span class="comment"> * Wyet. Ohe rwise we ooku it up. We cace lhe lresultsftihe lock nobject/apan>
 371 */ itself, so actual ookup:iof he lhash should be once perlock nobject./apan>
 371  *
 371static va href="+code=Ciline" class="sref">inline vtruct lock_class *< 371{s href="+code=lregister_ock_class" class="sref">lregister_ock_class"/a>(kock_ep _ma:/a> *kock_/a>),snsigned lnt lsublass=/a>),lnt cforc=/a>(
 271 
 271        itruct iock_ep _tublass=key"/a>  key,< 2719/a>        itruct coist_heai/a>  chash_heai/a>,< 272         truct lock_class *class)< 2721/a>        snsigned long)cflag"/a>)< 272
 272         a href="+code=class" class="sref">class)  0a href="+code=locok_up_ock_class" class="sref">locok_up_ock_class"/a>(kock_/a>),sa href="+code=ltublass= class="sref">lsublass=/a>)

 272         f (kinkel"/a>(class)

 272        <        goto a href="+code=cout_setclass"kcach= class="sref">cout_setclass"kcach=/a>)< 272
 272         *
 272 ********** Debug-ch=ck: all ey<=Wmust be persistent!/span>
 272 * <      *
 273         f (<crttic _obj/a>(kock_/a>)>key,

 
 273                Mdebug_ock_"_off/a>(< 
 273                 a href="+code=Cprint  class="sref">Mprint /a>("INFO: tryng  to register non-tatic vey<.\n"/span>


 273                Mprint /a>("he llde=sfs fne" but needslockdep. annotaion_.\n"/span>


 273                Mprint /a>("urn ng  offihe lock ng  correctneseivalidator.\n"/span>


 273        <        a href="+code=Cdump_tatk_ class="sref">Mdump_tatk_/a>(< 
 273
 273                 eturn &a href="+code=cNULL class="sref">MNULL/a>(
 273        i
 273
 274         a href="+code=hey" class="sref">key,  0a href="+code=lock_ class="sref">kock_/a>)>key,>lsubey<=/a>,* lsublass=/a>)
 274        chash_heai/a>,= 0a href="+code=class"hashetry" class="sref">ilass"hashetry"/a>(key,

 274
 274         a href="+code=craw_ockal_irq_tave class="sref">lraw_ockal_irq_tave/a>(cflag"/a>)

 274         f (<kgraph_ock_/a>(< 
 
 274        <        a href="+code=Craw_ockal_irq_restore class="sref">lraw_ockal_irq_restore/a>(cflag"/a>)

 274                feturn &a href="+code=cNULL class="sref">MNULL/a>(
 274        <
 274        iapan class="comment"> *
 274 * <      * Wethaveiho do he lhash-walk again,iho aoid *rac=s/span>
 275 * <      * with anohe r CPU
 275 * <      *
 2752/a>         a href="+code=clist_for_each_ntry" class="sref">ioist_for_each_ntry"/a>(class), a href="+code=hhash_heai>class="sref">chash_heai/a>,, a href="+code=hhash_ntry" class="sref">ihash_ntry"/a>   275                class)>key,   0a href="+code=cey" class="sref">key,
 275                <<<<<<<<cout_unock_cset/a>(
 275         *
 275{span class="comment"> * <      * Alockate asnewvey< fromihe ltatic varray, and add it to/span>
 275/  <      * he lhash
 275 **********
 275        crr_ock_class"="/a>  gt;< 0a href="+code=CMAX_OCKDEP_KKEY" class="sref">MMAX_OCKDEP_KKEY"/a>,
 
 276                Mdebug_ock_"_off_graph_unock_/a>(< 
 
 276                <        a href="+code=Craw_ockal_irq_restore class="sref">lraw_ockal_irq_restore/a>(cflag"/a>)

 276                        MNULL/a>(
 276                <
 276                lraw_ockal_irq_restore/a>(cflag"/a>)

 276
 276                fa href="+code=sprint  class="sref">Mprint /a>("BUG: MAX_OCKDEP_KKEY" toolocw!\n"/span>


 276                 a href="+code=lprint  class="sref">Mprint /a>("urn ng  offihe lock ng  correctneseivalidator.\n"/span>


 276        i        a href="+code=cdump_tatk_ class="sref">Mdump_tatk_/a>(< 
 276                MNULL/a>(
 277         
 277        class)  0a href="+code=lock_class"=" class="sref">cock_class"="/a>   crr_ock_class"="/a> ++
 2772/a>         a href="+code=cdebug_atomic_inc class="sref">Mdebug_atomic_inc/a>(crr_unnsed_ock_"/a>)

 277         a href="+code=class" class="sref">class)>key,  0a href="+code=cey" class="sref">key,< 2774/a>         a href="+code=class" class="sref">class)>crme=/a>(& 0a href="+code=cock_ class="sref">kock_/a>)>crme=/a>(
 277        class)>lsublass=/a>) =lsublass=/a>)
 2776/a>        lINIT_LIST_HEAD/a>(class)>iock_cntry"/a>  
 277         a href="+code=hINIT_LIST_HEAD class="sref">lINIT_LIST_HEAD/a>(class)>iock_s_before/a>  
 277        ia href="+code=cINIT_LIST_HEAD class="sref">lINIT_LIST_HEAD/a>(class)>cock_s_after/a>  
 277        class)>crme=_versio"/a> = 0a href="+code=clount_matching_rme=" class="sref">clount_matching_rme="/a>(class)

 278         apan class="comment"> *
 278 * <      * We nseiRCU&399;scsaf loist-add methodiho mak /span>
 278}span class="comment"> * <      * parallel walkng  of he lhash-oistcsaf 
 278 * <      *
 2784/a>         a href="+code=coist_add_tail_rcu class="sref">ioist_add_tail_rcu/a>(class)>ihash_ntry"/a> , a href="+code=hhash_heai>class="sref">chash_heai/a>,

 278         *
 278{span class="comment"> * <      * Add it to he lglobal oistcof lass"="
 278/  <      *
 278        ia href="+code=coist_add_tail_rcu class="sref">ioist_add_tail_rcu/a>(class)>iock_cntry"/a> , amp;call_ock_class<="/a><

 278
 279         f (iverbose/a>(class)

 
 279                Mgraph_unock_/a>(< 
 279                 a href="+code=Craw_ockal_irq_restore class="sref">lraw_ockal_irq_restore/a>(cflag"/a>)

 279
 279                Mprint /a>("\nnewvlass=t&397;p:t&397;s"/span>
,class)>key,,class)>crme=/a>(

 279        <        f (class)>crme=_versio"/a> =gt;< 1
 279                fffffffffa href="+code=lprint  class="sref">Mprint /a>("#&397;d"/span>
,class)>crme=_versio"/a> 

 279                 a href="+code=lprint  class="sref">Mprint /a>("\n"/span>


 279        i        a href="+code=cdump_tatk_ class="sref">Mdump_tatk_/a>(< 
 279
 380                lraw_ockal_irq_tave/a>(cflag"/a>)

 380                kgraph_ock_/a>(< 
 
 380                        lraw_ockal_irq_restore/a>(cflag"/a>)

 380                <<<<<<<<MNULL/a>(
 380                <
 380        <
 380{s href="+code=lout_unock_cset>class="sref">cout_unock_cset/a>(: 380         a href="+code=hgraph_unock_ class="sref">Mgraph_unock_/a>(< 
 380        ia href="+code=craw_ockal_irq_restore class="sref">lraw_ockal_irq_restore/a>(cflag"/a>)

 380
 381cout_setclass"kcach=/a>): 3811/a>        sf (<lsublass=/a>) ||cforc=/a>(
 381                 a href="+code=Cock_ class="sref">kock_/a>)>class"kcach=/a>)[0]= 0a href="+code=class" class="sref">class)
 381         else f (lsublass=/a>) gl;< a href="+code=cNR_OCKDEP_KCACHING_CLASSE" class="sref">MNR_OCKDEP_KCACHING_CLASSE"/a>(
 381                kock_/a>)>class"kcach=/a>)[a href="+code=htublass= class="sref">lsublass=/a>)]= 0a href="+code=class" class="sref">class)
 381
 3816/a>         *
 281/  <      * Hash collisio", did we smoke some? We found avlass=twith a matching/span>
 281 ********** hash but he ltublass= -- which islhashe lnt(-- didn&399;t match./apan>
 281 * <      *
 282         f (cDEBUG_OCKDS_WARN_ON/a>(class)>lsublass=/a>) ! 0a href="+code=ctublass= class="sref">lsublass=/a>)

 282                MNULL/a>(
 282
 282         eturn &a href="+code=class" class="sref">class)
 282

 282
 282
#i de cCONFIG_PROVE_OCKDING/a>
 282/*
 282 ** Alockate asockdep. etryy. (ss=ume ihe  graph_ock_ held, eturn s/span>
 282 ** with NULL on failure)/apan>
 283 **
 283iock_coist/a>  ialockcoistcntry"/a>( 283 
 283         f (!a href="+code=Crr_oistcntryi=" class="sref">crr_oistcntryi="/a> =gt;< 0a href="+code=CMAX_OCKDEP_KENTRIE" class="sref">MMAX_OCKDEP_KENTRIE"/a>)
 
 283                Mdebug_ock_"_off_graph_unock_/a>(< 
 283        <               MNULL/a>(
 283
 283                 a href="+code=lprint  class="sref">Mprint /a>("BUG: MAX_OCKDEP_KENTRIE" toolocw!\n"/span>


 283        i        a href="+code=cprint  class="sref">Mprint /a>("urn ng  offihe lock ng  correctneseivalidator.\n"/span>


 283                Mdump_tatk_/a>(< 
 284                MNULL/a>(
 284        <
 2842/a>         eturn &a href="+code=coistcntryi=" class="sref">coistcntryi="/a> = crr_oistcntryi="/a> ++
 284 
 284  284sspan class="comment"> *
 284{span class="comment"> ** Add asnewvep.endency to he lheai of he loist
 284/ *
 284 tatic vnt iadd_ock_ctocoist/a>(lock_class *class), truct lock_class *lthi"/a>), 284                <<<<<<<<<<<<coist_heai/a>  cheai/a>,, nsigned long)kip/a>), 285                <<<<<<<<<<<<cdistanc=/a>), truct ctatk__trac=/a>(*ctrac=/a>   285<
 2852/a>         truct iock_coist/a>  intry"/a>(
 285         span class="comment"> *
 285   <      * Lck_ nottpresnt"Wyet - get asnewvep.endency truct 
 285sspan class="comment"> * <      * add it to he loist
 285{span class="comment"> * <      *
 285         a href="+code=hntry" class="sref">intry"/a>(= 0a href="+code=calockcoistcntry" class="sref">ialockcoistcntry"/a>(< 
 285        if (<intry"/a>(  285                 286  286        intry"/a>(>class)= 0a href="+code=cthi" class="sref">lthi"/a>)
 2862/a>         a href="+code=cntry" class="sref">intry"/a>(>cdistanc=/a>)= 0a href="+code=cdistanc= class="sref">cdistanc=/a>)
 286         a href="+code=cntry" class="sref">intry"/a>(>ctrac=/a> = 0ctrac=/a> 
 286         span class="comment"> *
 286sspan class="comment"> * <      * Since wesnever
 286{span class="comment"> * <      * be walkd lonckleseiby ohe r CPUs, it&399;sconl< alockatio"/apan>
 286/  <      * heatWmust be protectd lby he ltpinock_. But heis also mea s/span>
 286 ********** weWmust mak snewvetryie ivisible onl< once write ihoihe /span>
 286 * <      * ntry" become visible -lhence he lRCU op
 287 * <      *
 287        ioist_add_tail_rcu/a>(intry"/a>(>intry"/a>(, a href="+code=hheai>class="sref">cheai/a>, 
 287
 287         eturn &1
 287

 287
 287{span class="comment"> *
 287/ * For(good efficiency of modular, we nseipow r of 2/span>
 287 **
 287 #defne" a href="+code=CMAX_CIRCULAR_QUEUE_SIZE class="sref">MMAX_CIRCULAR_QUEUE_SIZE/a>          4096UL 288 #defne" a href="+code=CCQ_MASK class="sref">cCQ_MASK/a>                <<<<<<<<<MMAX_CIRCULAR_QUEUE_SIZE/a> -1
 288
 288}span class="comment"> *
 288 ** Te llircular_queue and helpers islnsedihoiimpleent"ihe /span>
 288  * breaith-firstcsearch(BFS)algorithem,lby which we can build/span>
 288sspan class="comment"> ** he lshorte t path fromihe lnextlock nhoibe acquiredihoihe /span>
 288{span class="comment"> **tprevious heldlock nf (he r=sfs allircularibetweetihe m./apan>
 288/ *
 288 tauct clircular_queue/a>  
 288         nsigned long)inleent"/a> [a href="+code=hMAX_CIRCULAR_QUEUE_SIZE class="sref">MMAX_CIRCULAR_QUEUE_SIZE/a> ]
 289         nsigned lnt <ifrot"/a>(, a href="+code=hrear class="sref">crear/a> 
 289 }
 289
 289
tatic vtruct clircular_queue/a>  a href="+code=lock_clq class="sref">lock_clq/a> 
 289  289 nsigned lnt lmax_bfs_queue_ep.th/a> 
 289
 289 tatic vnsigned lnt cockdep._ep.endency_gen_ii/a> 
 289  289
tatic va href="+code=Ciline" class="sref">inline void *a href="+code=C_clq_ini" class="sref">i_clq_ini"/a>(clircular_queue/a>  llq/a> 
 390 
 390        llq/a> >ifrot"/a>(= 0a href="+code=clq class="sref">llq/a> >crear/a> = 00
 3902/a>         a href="+code=clckdep._ep.endency_gen_ii>class="sref">cockdep._ep.endency_gen_ii/a> ++
 390 
 390  390static va href="+code=Ciline" class="sref">inline vnt i_clq_empt"/a>(clircular_queue/a>  llq/a> 
 390{
 390         eturn &llq/a> >ifrot"/a>(=  0a href="+code=clq class="sref">llq/a> >crear/a>  
 390 
 390
 391inline vnt i_clq_full/a>(clircular_queue/a>  llq/a> 
 391<
 3912/a>         eturn &(llq/a> >crear/a> =+ 1) amp;< a href="+code=CCQ_MASK class="sref">cCQ_MASK/a> )=  0a href="+code=clq class="sref">llq/a> >ifrot"/a>(
 391 
 391  391static va href="+code=Ciline" class="sref">inline vnt c_clq_enqueue/a>(clircular_queue/a>  llq/a> , nsigned long)inlee/a> 
 391{
 291         f (!a href="+code=C_clq_full class="sref">i_clq_full/a>(llq/a> 

 291        i        eturn &-1
 291
 292         a href="+code=hlq class="sref">llq/a> >inleent"/a> [a href="+code=hlq class="sref">llq/a> >crear/a> ]= 0a href="+code=cnlee class="sref">inlee/a> 
 292        llq/a> >crear/a> = 0llq/a> >crear/a> =+ 1) amp;< a href="+code=CCQ_MASK class="sref">cCQ_MASK/a> 
 2922/a>         eturn &0
 292 
 292  292static va href="+code=Ciline" class="sref">inline vnt c_clq_dequeue/a>(clircular_queue/a>  llq/a> , nsigned long)<inlee/a> 
 292{
 292         f (!a href="+code=C_clq_empt" class="sref">i_clq_empt"/a>(llq/a> 

 292        i        eturn &-1
 292
 293         inlee/a> = 0a href="+code=clq class="sref">llq/a> >inleent"/a> [a href="+code=hlq class="sref">llq/a> >ifrot"/a>(]
 293        llq/a> >ifrot"/a>(= 0llq/a> >ifrot"/a>(=+ 1) amp;< a href="+code=CCQ_MASK class="sref">cCQ_MASK/a> 
 2932/a>         eturn &0
 293 
 293  293static va href="+code=Ciline" class="sref">inline vnsigned lnt <i_clq_get_nlee_lount/a>(clircular_queue/a>  llq/a> 
 293{
 293         eturn &llq/a> >crear/a> =-llq/a> >ifrot"/a>() amp;< a href="+code=CCQ_MASK class="sref">cCQ_MASK/a> 
 293 
 293
 294inline void *a href="+code=Cmark_ock_caccessei>class="sref">cmark_ock_caccessei/a>(iock_coist/a>  iock_/a> , 294        <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<iock_coist/a>  iparnt"/a> 
 294 
 294         nsigned long)cnr/a> 
 294  294        cnr/a> & 0a href="+code=cock_ class="sref">kock_/a>)=-coistcntryi="/a> 
 2946/a>        cWARN_ON/a>(cnr/a> >< 0a href="+code=Crr_oistcntryi=" class="sref">crr_oistcntryi="/a> ); span class="comment"> *< Out-of-bounds, input fail *
 294         a href="+code=hock_ class="sref">kock_/a>)>iparnt"/a> & 0a href="+code=cparnt" class="sref">iparnt"/a> 
 294        ia href="+code=cock_ class="sref">kock_/a>)>llass=/a>)>cep._gen_ii/a> & 0a href="+code=cock_ep._ep.endency_gen_ii>class="sref">cockdep._ep.endency_gen_ii/a> 
 294 
 295  2951/a>inline vnsigned long)cock_caccessei/a>(iock_coist/a>  iock_/a> 
 295 
 295         nsigned long)cnr/a> 
 295  295        cnr/a> & 0a href="+code=cock_ class="sref">kock_/a>)=-coistcntryi="/a> 
 2956/a>        cWARN_ON/a>(cnr/a> >< 0a href="+code=Crr_oistcntryi=" class="sref">crr_oistcntryi="/a> ); span class="comment"> *< Out-of-bounds, input fail *
 295         eturn &a href="+code=cock_ class="sref">kock_/a>)>llass=/a>)>cep._gen_ii/a> &  0a href="+code=cock_ep._ep.endency_gen_ii>class="sref">cockdep._ep.endency_gen_ii/a> 
 295 
 295
 296inline vtruct iock_coist/a>  iget_ock_cparnt"/a>(iock_coist/a>  cchili/a> 
 296<
 2962/a>         eturn &a href="+code=cchili>class="sref">cchili/a> >iparnt"/a> 
 296 
 296  296static va href="+code=Ciline" class="sref">inline vnt lget_ock_cep.th/a>(iock_coist/a>  cchili/a> 
 296{
 296         ft lep.th/a>(= 00
 296        itruct iock_coist/a>  iparnt"/a> 
 296
 297         while&(iparnt"/a> & 0a href="+code=cget_ock_cparnt" class="sref">iget_ock_cparnt"/a>(cchili/a> 
 
 
 297        <<<<<<<<cchili/a> & 0a href="+code=cparnt" class="sref">iparnt"/a> 
 297                 a href="+code=Cdp.th class="sref">lep.th/a>(++
 297         
 2974/a>         eturn &a href="+code=cdp.th class="sref">lep.th/a>(
 297

 297
 297 tatic vnt l_cbf=/a>(iock_coist/a>  isourcecntry"/a> , 297        i        void *leata/a> , 297                <cmatch/a> 
iock_coist/a>  intry"/a>(, oid *leata/a> ), 298                <iock_coist/a>  <itarget_ntry"/a> , 298        <<<<<<<<<cforwari/a> 
 298 
 298         truct iock_coist/a>  intry"/a>(
 2984/a>         truct coist_heai/a>  cheai/a>,
 298        clircular_queue/a>  llq/a> & 0amp;lock_clq/a> 
 2986/a>        cre"/a> & 01
 298< 298        if (cmatch/a> isourcecntry"/a> ,&a href="+code=cdata class="sref">leata/a> )
 
 298                <itarget_ntry"/a> & 0a href="+code=ctourcecntry" class="sref">isourcecntry"/a> 
 299                cre"/a> & 00
 299                inxi"/a> 
 299         
 299
 299         f (cforwari/a> 
 299        <        a href="+code=cheai>class="sref">cheai/a>,& 0amp;isourcecntry"/a> >llass=/a>)>cockds_after/a> 
 299         else 299                 a href="+code=lheai>class="sref">cheai/a>,& 0amp;isourcecntry"/a> >llass=/a>)>lockds_before/a> 
 299  2999/a>         f (ioistcnmpt"/a> cheai/a>, 
100"/a>                inxi"/a> 
a href="kernel/lockdep.c#L31001 id="L3100" class="line" name="L2100" >100
1002/a>         a href="+code=c_clq_ini" class="sref">i_clq_ini"/a>(llq/a>  
100         a href="+code=c_clq_enqueue class="sref">c_clq_enqueue/a>(llq/a> , (nsigned long))a href="+code=ctourcecntry" class="sref">isourcecntry"/a>  
100 100        i_clq_empt"/a>(llq/a> 

 
1006/a>                iock_coist/a>  iock_/a> 
100<100        i        a href="+code=c_clq_dequeue class="sref">c_clq_dequeue/a>(llq/a> , (nsigned long) *)amp;iock_/a>  
100
100"/a>        i        f (<kock_/a>)>llass=/a>)
 
100        <<<<<<<<<<<<<<<<cre"/a> & 0-2
100                        inxi"/a> 
1003/a>                 
100 100        <        f (cforwari/a> 
1006/a>                <<<<<<<<cheai/a>,& 0amp;kock_/a>)>llass=/a>)>cockds_after/a> 
100                 else100        i        v<<<<<<cheai/a>,& 0amp;kock_/a>)>llass=/a>)>lockds_before/a> 
100
100"/a>        i        a href="+code=coistcfor_eachcntry" class="sref">ioistcfor_eachcntry"/a>(intry"/a>(, a href="+code=hheai>class="sref">cheai/a>,, a href="+code=hntry" class="sref">intry"/a>(  
100        <<<<<<<<<<<<<<<<cock_caccessei/a>(intry"/a>(   
100                        <<<<<<<<llq_de.th/a> 
1003/a>                        i        a href="+code=cmark_ock_caccessei>class="sref">cmark_ock_caccessei/a>(intry"/a>(, a href="+code=hock_ class="sref">iock_/a>  
100                <<<<<<<<<<<<<<<<cmatch/a> intry"/a>(, a href="+code=hdata class="sref">leata/a> )
 
100        <               <<<<<<<<<<<<<<<<<itarget_ntry"/a> & 0a href="+code=cntry" class="sref">intry"/a>(
1006/a>                <<<<<<<<<       i        a href="+code=cret>class="sref">cre"/a> & 00
100                                         goto0a href="+code=cnxi" class="sref">inxi"/a> 
100        i        v<<<<<<<<<<<<<<<
100
100"/a>                <<<<<<<<<<<<<<<<c_clq_enqueue/a>(llq/a> , (nsigned long))a href="+code=cntry" class="sref">intry"/a>(   
100        <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<cre"/a> & 0-1
100                        <<<<<<<<<<<<<<<<inxi"/a> 
1003/a>                        i        
100                <<<<<<<<<<<<<<<<llq_de.th/a> & 0a href="+code=c_clq_get_nlee_lount class="sref">i_clq_get_nlee_lount/a>(llq/a>  
100        <               <<<<<<<<lmax_bfs_queue_ep.th/a>  << a href="+code=Clq_de.th class="sref">llq_de.th/a> 
1006/a>                <<<<<<<<<       i        a href="+code=cmax_bfs_queue_ep.th class="sref">lmax_bfs_queue_ep.th/a>   0a href="+code=clq_de.th class="sref">llq_de.th/a> 
100                         
100        i        
1009/a>         
100"/a> a href="+code=cnxi" class="sref">inxi"/a> :100        cre"/a> 
100 
100
100 tatic va href="+code=Ciline" class="sref">inline vnt l_cbf=_forwari=/a>(iock_coist/a>  isrccntry"/a> ,100        <               leata/a> ,1006/a>                <<<<<<<<cmatch/a> 
iock_coist/a>  intry"/a>(, oid *leata/a> ),100                         truct iock_coist/a>  <itarget_ntry"/a> 
100 
1009/a>        l_cbf=/a>(isrccntry"/a> , a href="+code=hdata class="sref">leata/a> , a href="+code=hmatch>class="sref">cmatch/a> , a href="+code=htarget_ntry" class="sref">itarget_ntry"/a> , 1 
100"/a>
1001/a> 
100
1003/a> tatic va href="+code=Ciline" class="sref">inline vnt l_cbf=_backwari=/a>(iock_coist/a>  isrccntry"/a> ,100                <<<<<<<<leata/a> ,100        <               cmatch/a> 
iock_coist/a>  intry"/a>(, oid *leata/a> ),1006/a>                <<<<<<<<iock_coist/a>  <itarget_ntry"/a> 
1007/a> 
1008/a>        l_cbf=/a>(isrccntry"/a> , a href="+code=hdata class="sref">leata/a> , a href="+code=hmatch>class="sref">cmatch/a> , a href="+code=htarget_ntry" class="sref">itarget_ntry"/a> , 0 
100
100"/a> 
100
100}span class="comment"> *
100 ** Recursive, forwari=-directio"lock -ep.endency checking,lnsedifor/span>
100  * both noncyclc vchecking and for hariirq-unsafe/softirq-unsafe/span>
100sspan class="comment"> ** checking./apan>
100{span class="comment"> **
100<100 *
1009/a>sspan class="comment"> ** Prnt 
100"/a>sspan class="comment"> ** has beetidetected):/apan>
1001/a>{span class="comment"> **
1002/a> tatic va href="+code=Cnoiline" class="sref">inoiline"/a> vnt 1003/a> a href="+code=cprnt _lircular_bug_ntry" class="sref">iprnt _lircular_bug_ntry"/a>(iock_coist/a>  itarget/a> , ft lep.th/a>(
1004/a> 
100        idebug_ockds_silnt"/a>(
1006/a>                100         a href="+code=hprnt _ class="sref">iprnt _/a>("\n>< #%u"/span>
, a href="+code=hdp.th class="sref">lep.th/a>(

100        ia href="+code=cprnt _ock_came= class="sref">iprnt _ock_came=/a>(itarget/a> >llass=/a>)

1009/a>         a href="+code=hprnt _ class="sref">iprnt _/a>(":\n"/span>


100"/a>        ia href="+code=cprnt _tatk_ctrac= class="sref">iprnt _tatk_ctrac=/a>(itarget/a> >itrac=/a>(, 6

100
1002/a>         eturn &0
100 
100 100static void 1006/a> a href="+code=cprnt _lircular_ock_cscenario class="sref">iprnt _lircular_ock_cscenario/a>(iheld_ock_/a>  isrc/a> ,100                              truct iheld_ock_/a>  itgt/a> ,100        i        v<<<<<<<<<<<iock_coist/a>  ipr"/a>(
1009/a> 
100"/a>        itruct lock_class=/a>  isource/a>   0a href="+code=chock_class= class="sref">lhock_class=/a> isrc/a> 

1001/a>        itruct lock_class=/a>  itarget/a>   0a href="+code=chock_class= class="sref">lhock_class=/a> itgt/a> 

1002/a>        itruct lock_class=/a>  iparnt"/a> & 0a href="+code=cpr" class="sref">ipr"/a>(>llass=/a>)
100
100         span class="comment"> *
100sspan class="comment"> ********** A directlock ing problem where unsafeclass=lock  isltaken/span>
100{span class="comment"> ********** directly by safeclass=lock , then
1007/a>{span class="comment"> ********** islthe epadock_ scenario, as it islobviouslthatlthe/span>
100 ********** unsafelock  isltaken underlthe safelock ./apan>
1009/a>sspan class="comment"> **********/apan>
110"/a>sspan class="comment"> ********** But
1101/a>{span class="comment"> ********** an intermediatelock l(middleclass=) where thi=lock  is/apan>
110}span class="comment"> ********** not the same as the safelock , then
110 ********** used to describe the problem. Otherwise we would need/apan>
110  ********* to show
110sspan class="comment"> ********** from the safeclass=lock  to the unsafeclass=lock ./apan>
110{span class="comment"> **********
110         f (!a href="+code=Cparnt" class="sref">iparnt"/a> &! 0a href="+code=ctource class="sref">isource/a>   
110        i        a href="+code=cprnt _ class="sref">iprnt _/a>("Chain nxistslof:\n  "/span>


110                i_cprnt _ock_came=/a> isource/a>  
110"/a>        i        a href="+code=cprnt _ class="sref">iprnt _/a>(" ->< "/span>


110        <<<<<<<<i_cprnt _ock_came=/a> iparnt"/a> 

110                 a href="+code=cprnt _ class="sref">iprnt _/a>(" ->< "/span>


1103/a>                 a href="+code=c_cprnt _ock_came= class="sref">i_cprnt _ock_came=/a> itarget/a> 

111                iprnt _/a>("\n\n"/span>


110        <
111
111         a href="+code=hprnt _ class="sref">iprnt _/a>(" Possible unsafelock ing scenario:\n\n"/span>


111        ia href="+code=cprnt _ class="sref">iprnt _/a>("       CPU0               <    CPU1\n"/span>


1119/a>         a href="+code=hprnt _ class="sref">iprnt _/a>("       ----               <    ----\n"/span>


112"/a>        ia href="+code=cprnt _ class="sref">iprnt _/a>("  ockd("/span>


110        i_cprnt _ock_came=/a> itarget/a> 

1122/a>         a href="+code=cprnt _ class="sref">iprnt _/a>(");\n"/span>


112         a href="+code=cprnt _ class="sref">iprnt _/a>("                               ockd("/span>


110         a href="+code=c_cprnt _ock_came= class="sref">i_cprnt _ock_came=/a> iparnt"/a> 

110        iprnt _/a>(");\n"/span>


1126/a>        iprnt _/a>("                               ockd("/span>


112         a href="+code=h_cprnt _ock_came= class="sref">i_cprnt _ock_came=/a> itarget/a> 

112        ia href="+code=cprnt _ class="sref">iprnt _/a>(");\n"/span>


1129/a>         a href="+code=hprnt _ class="sref">iprnt _/a>("  ockd("/span>


113"/a>        ia href="+code=c_cprnt _ock_came= class="sref">i_cprnt _ock_came=/a> isource/a>  
113        iprnt _/a>(");\n"/span>


1132/a>         a href="+code=cprnt _ class="sref">iprnt _/a>("\n *** DEADLOCK ***\n\n"/span>


113 
113 113sspan class="comment"> *
113{span class="comment"> ** When
1137/a>{span class="comment"> ** heaier first:/apan>
113 **
1109/a> tatic va href="+code=Cnoiline" class="sref">inoiline"/a> vnt 110"/a> a href="+code=cprnt _lircular_bug_heaier class="sref">iprnt _lircular_bug_heaier/a>(iock_coist/a>  intry"/a>(, nsigned lnt lep.th/a>(,114        <<<<<<<<<<<<<<<<iheld_ock_/a>  icheck_src/a>(,114                        iheld_ock_/a>  icheck_tgt/a>(
110

1144/a>         truct itask_sruct /a>  icurr/a> & 0a href="+code=ccurrnt" class="sref">icurrnt"/a>)
110 1106/a>         f (idebug_ockds_silnt"/a>(
110                 eturn &0
114 1149/a>         a href="+code=hprnt _ class="sref">iprnt _/a>("\n"/span>


115"/a>        ia href="+code=cprnt _ class="sref">iprnt _/a>("======================================================\n"/span>


115        iprnt _/a>("[ INFO: possible lircular ock ing ep.endency detected ]\n"/span>


1152/a>         a href="+code=cprnt _ernel/_idnt" class="sref">iprnt _ernel/_idnt"/a>(<

115         a href="+code=cprnt _ class="sref">iprnt _/a>("-------------------------------------------------------\n"/span>


115         a href="+code=cprnt _ class="sref">iprnt _/a>("%s/%d isltrying to acquirelock :\n"/span>
,110        <        a href="+code=ccurr class="sref">icurr/a> >icmme/a>(, a href="+code=ltask_pid_nr class="sref">itask_pid_nr/a> icurr/a> )

1156/a>        iprnt _ock_/a> icheck_src/a>(

115         a href="+code=hprnt _ class="sref">iprnt _/a>("\nbu ltask islalreaiy holding ock :\n"/span>


115        ia href="+code=cprnt _ock_ class="sref">iprnt _ock_/a> icheck_tgt/a>(

1159/a>         a href="+code=hprnt _ class="sref">iprnt _/a>("\nwhich ick  alreaiy ep.endslon the newlock .\n\n"/span>


116"/a>        ia href="+code=cprnt _ class="sref">iprnt _/a>("\nthe nxisting ep.endency chain (in reverse orier) is:\n"/span>


110
1162/a>         a href="+code=cprnt _lircular_bug_ntry" class="sref">iprnt _lircular_bug_ntry"/a>(intry"/a>(, a href="+code=cdp.th class="sref">lep.th/a>(

116
116         eturn &0
116

116
116 tatic va href="+code=ciline" class="sref">inline vnt icass=_equal/a>(iock_coist/a>  intry"/a>(, oid *leata/a> )116 
1169/a>        intry"/a>(>llass=/a>) = 0a href="+code=cdata class="sref">leata/a> 
117"/a> 
117
1102/a> tatic va href="+code=Cnoiline" class="sref">inoiline"/a> vnt  a href="+code=cprnt _lircular_bug class="sref">iprnt _lircular_bug/a>(iock_coist/a>  ithis/a>(,1173/a>                        i        truct iock_coist/a>  itarget/a> ,117                <<<<<<<<<<<<<<<<iheld_ock_/a>  icheck_src/a>(,117        <        <<<<<<<<<<<<<<<iheld_ock_/a>  icheck_tgt/a>(
1106/a> 
110         truct itask_sruct /a>  icurr/a> & 0a href="+code=ccurrnt" class="sref">icurrnt"/a>)
110        itruct iock_coist/a>  iparnt"/a> 
1109/a>         truct iock_coist/a>  ifirst_parnt"/a> 
110"/a>        int lep.th/a>(
110
1102/a>         f (<idebug_ockds_off_graph_unock_/a>(<
 ||idebug_ockds_silnt"/a>(
1183/a>                 eturn &0
110 118        isavectrac=/a>(ithis/a>(>itrac=/a>( 
1186/a>                118<118        ia href="+code=cdp.th class="sref">lep.th/a>(& 0a href="+code=cget_ock_cdp.th class="sref">lget_ock_cdp.th/a>(itarget/a> 

118
119"/a>        ia href="+code=cprnt _lircular_bug_heaier class="sref">iprnt _lircular_bug_heaier/a>(itarget/a> ,lep.th/a>(,0a href="+code=ccheck_src class="sref">icheck_src/a>(,0a href="+code=ccheck_tgt class="sref">icheck_tgt/a>(

119
1192/a>         a href="+code=cparnt" class="sref">iparnt"/a> & 0a href="+code=cget_ock_cparnt" class="sref">iget_ock_cparnt"/a>(itarget/a> 

119         a href="+code=cfirst_parnt" class="sref">ifirst_parnt"/a> & 0a href="+code=cparnt" class="sref">iparnt"/a> 
119 119        iparnt"/a>   
1196/a>                iprnt _lircular_bug_ntry"/a>(iparnt"/a> , --a href="+code=cdp.th class="sref">lep.th/a>(

119                 a href="+code=cparnt" class="sref">iparnt"/a> & 0a href="+code=cget_ock_cparnt" class="sref">iget_ock_cparnt"/a>(iparnt"/a> 

119        i
119
120"/a>        ia href="+code=cprnt _ class="sref">iprnt _/a>("\notherintfolthatlmight help usidebug thi=:\n\n"/span>


120        iprnt _lircular_ock_cscenario/a>(icheck_src/a>(,0a href="+code=ccheck_tgt class="sref">icheck_tgt/a>(,120                        <<<<<<<<<<<<<ifirst_parnt"/a> 

120
120         a href="+code=cockdep.cprnt _held_ock_= class="sref">lock_ep.cprnt _held_ock_=/a> icurr/a> )
120 1206/a>        iprnt _/a>("\ntatk_ backtrac=:\n"/span>


120         a href="+code=hdump_tatk_ class="sref">leump_tatk_/a>(<

120 1209/a>        121"/a> 
121
1212/a> tatic va href="+code=Cnoiline" class="sref">inoiline"/a> vnt  a href="+code=cprnt _bf=_bug class="sref">iprnt _bf=_bug/a>(cre"/a> 
121

121         f (<idebug_ockds_off_graph_unock_/a>(<

121        <        eturn &0
121
121         apan class="comment"> *
121 ********** Breaith-first-search failnd, graph
1219/a>sspan class="comment"> **********
122"/a>        ia href="+code=cWARN class="sref">iWARN/a>(<1, apan class="ctruing">"ockdep. bf= error:%d\n"/span>
, a href="+code=cret>class="sref">cre"/a> 

122
1222/a>         eturn &0
122 
122 122static vnt  a href="+code=cnoop_lount class="sref">inoop_lount/a>(iock_coist/a>  intry"/a>(, oid *leata/a> )1226/a> 
122         (*(nsigned llong *)a href="+code=cdata class="sref">leata/a> )++
1228/a>        1229/a> 
123"/a>
123 nsigned llong a href="+code=c__ock_ep.clount_forwaricdp.= class="sref">l_cock_ep.clount_forwaricdp.=/a>(iock_coist/a>  ithis/a>()1232/a> 
123         nsigned llong 0a href="+code=ccount class="sref">ilount/a>( =&0
1234/a>         truct iock_coist/a>  iuninitialized_var/a>(itarget_ntry"/a> 

123 1236/a>        l_cbf=_forwari=/a>(ithis/a>(, (oid *<)amp;ilount/a>(, a href="+code=cnoop_lount class="sref">inoop_lount/a>(, amp;itarget_ntry"/a> 

123<1238/a>        ilount/a>(
1239/a> 
120"/a> nsigned llong a href="+code=cock_ep.clount_forwaricdp.= class="sref">lock_ep.clount_forwaricdp.=/a>(iock_class=/a>  ilass=/a> )124 
124         nsigned llong a href="+code=cret>class="sref">cre"/a> , a href="+code=cflag= class="sref">iflag=/a>(
1243/a>         truct iock_coist/a>  a href="+code=cthi= class="sref">ithis/a>(
124 124        ithis/a>(.a href="+code=cparnt" class="sref">iparnt"/a> & 0a href="+code=cNULL class="sref">iNULL/a>(
1246/a>        ithis/a>(.a href="+code=class= class="sref">ilass=/a> & 0a href="+code=ccass= class="sref">ilass=/a> 
124<124        ia href="+code=cockal_irq_save class="sref">iockal_irq_save/a>(iflag=/a>(

1249/a>         a href="+code=harch_spin_ock_ class="sref">iarch_spin_ock_/a>(iock_ep.cock_/a>(

125"/a>        ia href="+code=cret>class="sref">cre"/a> & 0a href="+code=c__ock_ep.clount_forwaricdp.= class="sref">l_cock_ep.clount_forwaricdp.=/a>(ithis/a>(

125        iarch_spin_unock_/a>(iock_ep.cock_/a>(

1252/a>         a href="+code=cockal_irq_restore class="sref">iockal_irq_restore/a>(iflag=/a>(

125
125         eturn &a href="+code=cret>class="sref">cre"/a> 
125

125
125 nsigned llong a href="+code=c__ock_ep.clount_backwaricdp.= class="sref">l_cock_ep.clount_backwaricdp.=/a>(iock_coist/a>  ithis/a>()125 
1259/a>         nsigned llong 0a href="+code=ccount class="sref">ilount/a>( =&0
126"/a>        itruct iock_coist/a>  iuninitialized_var/a>(itarget_ntry"/a> 

120
1262/a>         a href="+code=c_cbf=_backwari= class="sref">l_cbf=_backwari=/a>(ithis/a>(, (oid *<)amp;ilount/a>(, a href="+code=cnoop_lount class="sref">inoop_lount/a>(, amp;itarget_ntry"/a> 

126
126         eturn &a href="+code=ccount class="sref">ilount/a>(
126

126
126 nsigned llong a href="+code=cock_ep.clount_backwaricdp.= class="sref">lock_ep.clount_backwaricdp.=/a>(iock_class=/a>  ilass=/a> )126 
1269/a>         nsigned llong a href="+code=cret>class="sref">cre"/a> , a href="+code=cflag= class="sref">iflag=/a>(
127"/a>        itruct iock_coist/a>  a href="+code=cthi= class="sref">ithis/a>(
127
1272/a>         a href="+code=cthi= class="sref">ithis/a>(.a href="+code=cparnt" class="sref">iparnt"/a> & 0a href="+code=cNULL class="sref">iNULL/a>(
1273/a>         a href="+code=hthi= class="sref">ithis/a>(.a href="+code=class= class="sref">ilass=/a> & 0a href="+code=ccass= class="sref">ilass=/a> 
127 127        iockal_irq_save/a>(iflag=/a>(

1276/a>        iarch_spin_ock_/a>(iock_ep.cock_/a>(

127         a href="+code=hret>class="sref">cre"/a> & 0a href="+code=c__ock_ep.clount_backwaricdp.= class="sref">l_cock_ep.clount_backwaricdp.=/a>(ithis/a>(

127        ia href="+code=carch_spin_unock_ class="sref">iarch_spin_unock_/a>(iock_ep.cock_/a>(

1279/a>         a href="+code=hockal_irq_restore class="sref">iockal_irq_restore/a>(iflag=/a>(

128"/a>
128        cre"/a> 
1202/a> 
128
128 *
128sspan class="comment"> ** Provelthatlthe ep.endency graph
128{span class="comment"> ** lead to <targetgt;<. Prnt  n cerror n d
1287/a>{span class="comment"> **
128 tatic va href="+code=Cnoiline" class="sref">inoiline"/a> vnt 128
a href="+code=ccheck_nonlircular class="sref">ilheck_nonlircular/a>(iock_coist/a>  croo"/a> , truct iock_class=/a>  itarget/a> ,129"/a>        i        truct iock_coist/a>  <itarget_ntry"/a> 
129 
1292/a>         nt  a href="+code=cresult>class="sref">cresult/a> 
129
129         a href="+code=cdebug_atomic_inc class="sref">idebug_atomic_inc/a>(inr_cyclic_lheck=/a>(

129 1296/a>        cresult/a> & 0a href="+code=c__bfs_forwari= class="sref">l_cbf=_forwari=/a>(croo"/a> , a href="+code=ctarget class="sref">itarget/a> ,icass=_equal/a>(, a href="+code=ctarget_ntry" class="sref">itarget_ntry"/a> 

129<1298/a>        cresult/a> 
1299/a> 
130"/a>
130 #f (a href="+code=cdefne"d class="sref">idefne"d/a>(iCONFIG_TRACE_IRQFLAGS/a> 
 amp;idefne"d/a>(iCONFIG_PROVE_LOCKING/a> 
130 span class="comment"> *
130
span class="comment"> ** Forwari= n d
130 ** proving thatltwo subgraphs cn cbe connected by a newlep.endency/span>
130sspan class="comment"> ** without creating any illegal irq-safel>< irq-unsafelock lep.endency./apan>
130{span class="comment"> **
130<130 tatic va href="+code=Ciline" class="sref">inline vnt lusage_match/a>(iock_coist/a>  intry"/a>(, oid *ibit/a> 
1309/a> 
1310/a>        intry"/a>(>llass=/a>)>iusage_mas_/a>  amp;<((1 << (enumiock_cusage_bit/a> 
a href="+code=cbit class="sref">ibit/a> 

131

1312/a> 131
131 131sspan class="comment"> *
131{span class="comment"> ** Fi d
1317/a>{span class="comment"> ** atl@roo">
131 *
1319/a>sspan class="comment"> ** Rturn &0 f (such
132"/a> span class="comment"> ** nt o *@target_ntry"./apan>
132
span class="comment"> *
132 span class="comment"> ** Rturn &1 otherwise n d
132
span class="comment"> ** Rturn &<0lon error./apan>
132 **
132static vnt 1326/a> a href="+code=cfi dcusage_forwari= class="sref">lfi dcusage_forwari=/a>(iock_coist/a>  croo"/a> , enumiock_cusage_bit/a> ibit/a> ,132                         truct iock_coist/a>  <itarget_ntry"/a> 
132 
1329/a>         nt  a href="+code=cresult>class="sref">cresult/a> 
133"/a>
133        idebug_atomic_inc/a>(inr_fi dcusage_forwari=_lheck=/a> 

1332/a> 1333/a>         a href="+code=hresult>class="sref">cresult/a> & 0a href="+code=c__bfs_forwari= class="sref">l_cbf=_forwari=/a>(croo"/a> , (oid *<)a href="+code=lbit class="sref">ibit/a> ,lusage_match/a>(, a href="+code=ctarget_ntry" class="sref">itarget_ntry"/a> 

133 133        cresult/a> 
1336/a> 
133<133 *
1339/a>sspan class="comment"> ** Fi d
134"/a> span class="comment"> ** atl@roo">
134
span class="comment"> *
134 span class="comment"> ** Rturn &0 f (such
134
span class="comment"> ** nt o *@target_ntry"./apan>
134 **/apan>
134sspan class="comment"> ** Rturn &1 otherwise n d
134{span class="comment"> ** Rturn &<0lon error./apan>
1347/a>{span class="comment"> **
134 tatic vnt 134
a href="+code=cfi dcusage_backwari= class="sref">lfi dcusage_backwari=/a>(iock_coist/a>  croo"/a> , enumiock_cusage_bit/a> ibit/a> ,135"/a>        i                truct iock_coist/a>  <itarget_ntry"/a> 
135 
1352/a>         nt  a href="+code=cresult>class="sref">cresult/a> 
135
135         a href="+code=cdebug_atomic_inc class="sref">idebug_atomic_inc/a>(inr_fi dcusage_backwari=_lheck=/a> 

135 1356/a>        cresult/a> & 0a href="+code=c__bfs_backwari= class="sref">l_cbf=_backwari=/a>(croo"/a> , (oid *<)a href="+code=lbit class="sref">ibit/a> ,lusage_match/a>(, a href="+code=ctarget_ntry" class="sref">itarget_ntry"/a> 

135<1358/a>        cresult/a> 
1359/a> 
136"/a>
130
tatic void *a href="+code=cprnt _ock_class=_heaier class="sref">iprnt _ock_class=_heaier/a>(lock_class=/a>  llass=/a>),int lep.th/a>(
1362/a> 
1363/a>         nt  a href="+code=cbit class="sref">ibit/a> 
136 136        iprnt _/a>("%*s><"/span>
, a href="+code=cdp.th class="sref">lep.th/a>(, apan class="ctruing">""/span>


1366/a>        iprnt _ock_came=/a>(llass=/a>)

136         a href="+code=hprnt _ class="sref">iprnt _/a>(" ops: %lu"/span>
, a href="+code=class= class="sref">llass=/a>)>lop=/a>)

136        ia href="+code=cprnt _ class="sref">iprnt _/a>(" {\n"/span>


136
137"/a>        iforlibit/a>  =&0
 a href="+code=cbit class="sref">ibit/a> &< a href="+code=cLOCK_USAGE_STATES class="sref">iLOCK_USAGE_STATES/a> 
 a href="+code=cbit class="sref">ibit/a> ++  
llass=/a>)>iusage_mas_/a>  amp;<((ge_bit/a> 
a href="+code=cbit class="sref>ibit/a> ++  
120              a>         nt  a hrlenlock_class= clasenef">cresult/a> & 0a href="+code=cdp.th class="sref"ot;/span>


135
117                     nt  a hrlenlock_class= clasenef">c+parnt"/a> & 0a href="+code=cprnt _ class="sref">iprnt _/a>(&q   ing">s#37;*s><"/span>
, a href="+code=cdp.th class="sref">lep.th/a>(, apan class="ctruing">"&qf">ibit/a> , 
a href="+code=cbit class="sre]uot;/span>


117        <            nt  a hrlenlock_class= clasenef">c+parnt"/a> & 0a href="+code=cprnt _ class="sref">iprnt _/a>(1196/a>      " >1366/a>        +code=lsavectrac= claef="+cref">+code= _ock_came=/a>(llass=/a>)>c+age_bit/a> uot;/span>


132      " >1359/a> 
119        i
1279/a>         a href="+code=cprnt _ class="sref">iprnt _/a>(&q }rror:%d\n"/span>
, a href="+code=cdp.th class="sref">lep.th/a>(, apan class="ctruing">""/span>


128"/a>
120        iprnt _/a>(&q ... key>120
, a href="+code=cdp.th class="sref">ep.th/a>(, apan class="ctruing">""/span>


1192/a>         a href="+cip_symlsavectrac= claef="+cip_symef">i         (*(ns> , (oid *<)a href="+code=class= class="sref">llass=/a>)>uot;/span>


122 
110 128sspan class="comment"> *
128{span class="coss="sr=vnxishortest irq-unsafelockies from @ sub-t"> @felnde=reverse order:omment"> *
1287/a>{span class="comment"> **
128
tatic void *a hr__uscode=cdefne"d cla__usco2114" >110 128
a href="+crhortestref">insafelockieslsavectrac= claef="+crhortestref">insafelockiese_backwari=/a>(iock_coist/a>  ibit/a> ,129"/a>                      kwari=/a>(iock_coist/a>  lep.th/a>(
129 
1292/_match/a>(iock_coist/a>   & 0a hrleaflock_class= claseaf"sreot;/span>


1363/a>         nt  a href="+code=cdp.th class="sref"ot;/span>


119 119128sspan class="can putoveltth from genera cbetreee coBFScomment"> **
1296/a>         & 0a href="+codeef="+code=cdp.th claef="+codeef="+ _ock_came=/a>(


129<1298/doibit/a> ++  
129"/a>      atic void *a href="+code=cprnt _ock_class=_heaier class="sref">iprnt _ock_class=_coist/a>  intry"/a>(>
, a href="+code=cdp.th class="sref"uot;/span>


129"/a>      a>        iprnt _/a>(&q ... acquircbeat_ backtrac=:\n"/span>
, a href="+code=cdp.th class="sref">lep.th/a>(, apan class="ctruing">""/span>


+code=lsavectrac= claef="+cref">+code= _ockunock_/a>(intry"/a>(>


120      a>        iprnt _/a>(120
117        <6= cl iforl 
 _coist/a>   & 0a href="+code=croot>class="sref>>ibit/a> ++  
117        <            nt  a href="+code=cprnt _ class="sref">iprnt _/a>(
, a hr__func__de=cdefne"d cla__func__ref"uot;/span>


1196/a>      " >1366/breakot;/span>


132      " >1359/a> 
120 129"/a>      atic void *a href="+code=cntry" class="sref"cresult/a> & 0a href="+codeef="+code=cparnt" claef="+codeef="+cass=_coist/a>  


129"/a>      a>        


 
 _coist/a>  


1312/a> 1363/a>    ot;/span>


1359/a> 
135 128
" >135          a href="+cirq"+codescenariolsavectrac= claef="+cirq"+codescenarioe_backwari=/a>(iock_coist/a>  ibit/a> ,1196/a>      " >1366/a>        itruct iock_coist/a>  ibit/a> ,129"/a>      " >1366/a>        itruct lock_class=/a>  ibit/a> ,135"/a>        i                truct lock_class=/a>  lep.th/a>(
129 
1292/_match/a>(lock_class=/a>   & 0a hrgt;intry"/a>(>


1243/a>         truct lock_class=/a>   & 0a hrefgt;intry"/a>(>


1234/a>         truct lock_class=/a>   & 0a hrprev+ef="+code=nlass= claprev+ef="+"sreot;/span>


135 1196/  <6= cl iforl & 0a hrgt;lep.th/a>(
132      lass=/a>   & 0a hrnext+ef="+code=nlass= clanext+ef="+srefot;/span>


120 1329/" >128sspan class="comment"> *
134"/a> span class="""""""""* A  backw irq-thouproblem where efgt; *
134
span class="""""""""*  backwlye cogt; showefment"> *
134 span class="""""""""* is troveladirq-uscenario, aseturis obvious"> ** Proefment"> *
134
span class="""""""""* l>< irq-uis taken l&dearchingt;< irq-;0lon error./apan>
134
134sspan class="""""""""* But/  
128{span class="""""""""* ae=intermediat< irq- (middl
1287/a>{span class="""""""""* not chingtme asechingt;< irq-,=vnxn chinirq-uchade=is0lon error./apan>
133 describe chinproblem. O Rturn &1we would neen0lon error./apan>
1339/a>sspan class="""""""""* "> show a=diffe="+c CPU cas nde= each 9" knde=vnxichade0lon error./apan>
134"/a> span class="""""""""* from chingt; chinefgt;
134
span class="""""""""*omment"> **
1196/  <6= cl iforl & 0a hrefgt;ibit/a> ++  
132      lass=/a>  iprnt _/a>(117      t;/span>
, a hr__ef="+code=hprnt _ock_came= cla__ef="+code=hprntass=_coist/a>  ot;/span>


117      lass=/a>  iprnt _/a>(1196/a>      t;/span>
, a hr__ef="+code=hprnt _ock_came= cla__ef="+code=hprntass=_coist/a>  


132      lass=/a>  iprnt _/a>(1196/a>      t;/span>
, a hr__ef="+code=hprnt _ock_came= cla__ef="+code=hprntass=_coist/a>  ot;/span>


129"/a>      atic void *a href="+code=cprnt _ class="sref">iprnt _/a>(135"/" >1359/a> 
127
1192/a>         a href="+code=cprnt _ class="sref">iprnt _/a>(1333/a>         a href="+code=cprnt _ class="sref">iprnt _/a>(129"/a>          CPU1 backtrac=:\n"/span>


135         a href="+code=cprnt _ class="sref">iprnt _/a>(129"/a>          ---- backtrac=:\n"/span>


136        iprnt _/a>(1356/a>          ot;/span>


136         a href="+code=hprnt _ class="sref">iprnt _/a>(136        ia href="+code=cprnt _ class="sref">iprnt _/a>(disable()u backtrac=:\n"/span>


1279/a>         a href="+code=cprnt _ class="sref">iprnt _/a>(1356/a>          ot;/span>


120        iprnt _/a>(1192/a>         a href="+code=cprnt _ class="sref">iprnt _/a>(1333/a>         a hr__ef="+code=hprnt _ock_came= cla__ef="+code=hprntass=_coist/a>  


135         a href="+code=cprnt _ class="sref">iprnt _/a>(136        iprnt _/a>(1366/a>        iprnt _/a>(136         a hr__ef="+code=hprnt _ock_came= cla__ef="+code=hprntass=_coist/a>  ot;/span>


136        ia href="+code=cprnt _ class="sref">iprnt _/a>(1279/a>         a href="+code=cprnt _ class="sref">iprnt _/a>(


1359/a> 
127
134 tatic vnt          a href="+cbadref">ddirectionlsavectrac= claef="+cbadref">ddirectione_backwari=/a>(  ibit/a> ,117              /a>        itruct iock_coist/a>  ibit/a> ,117        <     /a>        itruct iock_coist/a>  ibit/a> ,1196/a>      " >1366//a>        itruct iock_coist/a>  ibit/a> ,132      " >1366//a>        itruct iock_coist/a>  ibit/a> ,1196/a>      " >1366//a>        itruct iock_coist/a>  claprev"sref">ibit/a> ,129"/a>      " >1366//a>        itruct iock_coist/a>  clanext"sref">ibit/a> ,129"/a>               croo"/a> , enumiock_cusage_bit/a> ibit/a> , , enumiock_cusage_bit/a> ibit/a> ,120              aphsstichark_coist/a>  lep.th/a>(
117           a href="+cf="ks_sil"+code=cparnt" claef="+cf="ks_sil"+cref">lep.th/a>(
117      a>     0ot;/span>





136         a href="+code=hprnt _ class="sref">iprnt _/a>(136        ia href="+code=cprnt _ class="sref">iprnt _/a>(1279/a>         a href="+code=cprnt _ class="sref">iprnt _/a>(129"/a>      coist/a>  
, a href"ef="+code=nlass= claef"ef="+ref">ot;/span>


120        


1192/a>         a href="+code=cprnt _ class="sref">iprnt _/a>(1333/a>         a href="+code=cprnt _ class="sref">iprnt _/a>(117      t;/span>
, a hrcur_nonlircular clasur_"sre>intry"/a>(>
, a hrtask_pid_n_nonlircular clatask_pid_n_ass=_coist/a>  


117      lass=/a>  intry"/a>(>phstext+code=croot>clahardef">phstextref"uot;/span>
, a hrhardef">phu+code=cparnt" clahardef">phu+ce_bac) ot;&#g<((ge_bit/a> 
a hrHARDIRQ_SHIFTode=cparnt" claHARDIRQ_SHIFT"sref">ibit/a> ,1196/a>      t;/span>
, a hrcur_nonlircular clasur_"sre>intry"/a>(>phstext+code=croot>clasoftef">phstextref"uot;/span>
, a hrsoftef">phu+code=cparnt" clasoftef">phu+ce_bac) ot;&#g<((ge_bit/a> 
a hrSOFTIRQ_SHIFTode=cparnt" claSOFTIRQ_SHIFT"sref">ibit/a> ,132      lass=/a>  intry"/a>(>ibit/a> ,1196/a>      t;/span>
, a hrcur_nonlircular clasur_"sre>intry"/a>(>ot;/span>


1279/a>         a href="+code=arget_ntry" claef="+code=ass=_coist/a>  clanext"sre>ot;/span>


128"/a>
120        iprnt _/a>(1192/a>         a href="+code=arget_ntry" claef="+code=ass=_coist/a>  claprev"sreuot;/span>


1333/a>         a href="+code=cprnt _ class="sref">iprnt _/a>(135         a href="+code=hprnt _ock_came= claef="+code=hprntass=_coist/a>    claprev"sreuuot;/span>


136        iprnt _/a>(1366/a>        iprnt _ock_came=/a>(  clanext"sre>uot;/span>


136         a href="+code=hprnt _ class="sref">iprnt _/a>(120 1279/a>         a href="+code=cprnt _ class="sref">iprnt _/a>(


129"/a>      a>        ot;/span>


120        iprnt _ock_came=/a>(intry"/a>(>ot;/span>


1192/a>         a href="+code=cprnt _ class="sref">iprnt _/a>(
, a href"ef="+code=nlass= claef"ef="+ref">ot;/span>


120
135         a href="+cref">+code=lsavectrac= claef="+cref">+code= _ock_came=/a>(intry"/a>(>llass=/a>)>c+age_bit/a> ot;/span>


135 1366/a>        iprnt _/a>(
, a href"ef="+code=nlass= claef"ef="+ref">ot;/span>


136         a href="+_ode=hprnt _ock_came= class="sref">iprnt _ock_came=/a>(intry"/a>(>ot;/span>


136        ia href="+code=cprnt _ class="sref">iprnt _/a>(
, a href"ef="+code=nlass= claef"ef="+ref">ot;/span>


1279/a>         a href="+code=cprnt _ class="sref">iprnt _/a>(128"/a>
120        +code=lsavectrac= claef="+cref">+code= _ock_came=/a>(intry"/a>(>llass=/a>)>c+age_bit/a> ot;/span>


1312/a> 1333/a>         a href="+code=cprnt _ class="sref">iprnt _/a>( ** might help us ef="+ph,is: b backtrac=:\n"/span>


135         a href="+cirq"+codescenariolsavectrac= claef="+cirq"+codescenarioe_baccoist/a>           a hrfi dcusagde=ctarget_ntry" clafi dcusagde=ct"sref">ibit/a> ,117        <     / >135         a hrhode=hef="+code=nlass= clahode=hef="+ass=_coist/a>  claprev"sreuuot;/span>
, a hrhode=hef="+code=nlass= clahode=hef="+ass=_coist/a>  clanext"sre>uot;/span>


136         a hrf="kern_ef="+cheldcode=+code=nlass= class="ern_ef="+cheldcode=+ass=_coist/a>  


120 1279/a>         a href="+code=cprnt _ class="sref">iprnt _/a>(
, a href"ef="+code=nlass= claef"ef="+ref">ot;/span>


1356/a>        iprnt _/a>(120  iunock_/a>(intry"/a>(>lep.th/a>(
120      a>     0ot;/span>


1333/a>         a href="+crhortestref">insafelockieslsavectrac= claef="+crhortestref">insafelockiese_baccoist/a>           a hrprev+ef="+code=croot>claprev+ef=""sre>ot;/span>


119 136        iprnt _/a>(1366/a>        iprnt _/a>(
, a href"ef="+code=nlass= claef"ef="+ref">ot;/span>


120  iunock_/a>(intry"/a>(>lep.th/a>(
1196/a>      a>     0ot;/span>


1279/a>         a href="+crhortestref">insafelockieslsavectrac= claef="+crhortestref">insafelockiese_baccoist/a>   & 0a hrnext+ef="+code=croot>clanext+ef=""sre>ot;/span>


128"/a>
120        iprnt _/a>( fi dcode=_ backtrac=:\n&q>ot;/span>


1192/a>         a hrdumpcref">ode=cprnt _ cladumpcref">e_bac)ot;/span>


120
117     0ot;/span>


1359/a> 
134 tatic vnt nonlircular clashe="sref">e_backwari=/a>(          itruct iock_coist/a>  claprev"sref">ibit/a> ,129"/a>  a>        itruct iock_coist/a>  clanext"sref croo"/a> , enumiock_cusage_bit/a> ibit/a> ,129"/a>  croo"/a> , enumiock_cusage_bit/a>   lep.th/a>(
129 
1192/i>         nt  a hra> code=nlass= claa> 2112ot;/span>


1333/a>        itruct iocka>( & 0a hr> **code=nlass= clatha 2112ot;/span>


135        itruct iock_coist/a>    ot;/span>


136        itruct iock_coist/a>    ot;/span>


136         a hrthi+code=nlass= clathi+"sre.coist/a>  


120 1279/a>         a hrthi+code=nlass= clathi+"sre.coist/a>   & 0a hrhode=hef="+code=nlass= clahode=hef="+ass=_coist/a>  claprev"sreuot;/span>


1356/a>         code=nlass= claa> 2112cresult/a> & 0a hrfindsref">ioi dcusagarget_ntry" clafindsref">ioi dcusagef">iunock_/a>( & 0a href=_fi dcusagarget_ntry" claff=_fi dcusag"sref unock_/a>(ot;/span>


120         code=nlass= claa> 2112c  am 0>lep.th/a>(
120      a>     a>         a href="+cbfs_buglsavectrac= claef="+cbfs_bugass=_coist/a>   code=nlass= claa> 2112>ot;/span>


1333/  <6a>         code=nlass= claa> 2112c== 1>lep.th/a>(
135      a>     a>         a hra> code=nlass= claa> 2112ot;/span>


135 1366/a>         **code=nlass= clatha 2112.coist/a>  


136         a hr> **code=nlass= clatha 2112.coist/a>   & 0a hrhode=hef="+code=nlass= clahode=hef="+ass=_coist/a>  clanext"sre>ot;/span>


136        ia hra> code=nlass= claa> 2112cresult/a> & 0a hrfindsref">ifi dcusaarget_ntry" clafindsref">ifi dcusaef">iunock_/a>( & 0a href=_fi dcusaarget_ntry" claff=_fi dcusa"sref unock_/a>(ot;/span>


1279/  <6a>         code=nlass= claa> 2112c  am 0>lep.th/a>(
129"/a>      a>     a>         a href="+cbfs_buglsavectrac= claef="+cbfs_bugass=_coist/a>   code=nlass= claa> 2112>ot;/span>


120         code=nlass= claa> 2112c== 1>lep.th/a>(
120      a>     a>         a hra> code=nlass= claa> 2112ot;/span>


120
117     a>         a href="+cbadref">ddirectionlsavectrac= claef="+cbadref">ddirectione_baclass=/a>  ((120
117        <     _/a>(
, a hrtaref="de=ct1arget_ntry" clataref="de=ct1"sref" >120
1196/a>      " >1366/coist/a>  claprev"srefesult/a> & 0a hrnext+code=croot>clanext"sref" >120
132      " >1366/sult/a> & 0a href=_fi dcusagarget_ntry" claff=_fi dcusag"sref sult/a> & 0a href=_fi dcusaarget_ntry" claff=_fi dcusa"sref t;/span>
, a href"ef="+code=nlass= claef"ef="+ref">ot;/span>


1359/a> 
134  1eiprnt+code=nlass= clag >1eiprnt+2120[]cre" >129 
1192/a>         a hr__an claiftarget_ntry" cla__an claifte_baclass=/a>  120
1es.h id="L312fr class="ern_g >1es.h2123acktra" >120
120
120



134  1eirprnt+code=nlass= clag >1eirprnt+2120[]cre" >129 
1279/a>         a hr__an claiftarget_ntry" cla__an claifte_baclass=/a>  (120
120
120
120
120
134
, a hren4" clade=nlass= claen4" c2129"phsstichark_coist/a>  1eiprntcode=nlass= clag >1eiprnte_baccroo"/a> , enumiock_cusage_bit/a> lep.th/a>(
129 
1196/a>     ccoist/a>   ?ot;/span>
, a hrs >1eirprnt+code=nlass= clag >1eirprnt+2120[coist/a>  
, a hrs >1eiprnt+code=nlass= clag >1eiprnt+2120[coist/a>  120
1359/a> 
120 134ot;/span>
, a hrexclusiv=lock_cusage_bit claexclusiv=locke_bac/a>ot;/span>
, a hrnewlock_cusage_bit clanewlockref">lep.th/a>(
129 
120128sspan class="comment"> *
134 span class="""""""""* USED_INomment"> *
134
span class="""""""""* USED_IN_READomment"> *
134 *
134sspan class="""""""""* ENABLED_READomment"> *
128{span class="""""""""*omment"> *
1287/a>{span class="""""""""* ock 0 - write/readomment"> *
133 *
1339/a>sspan class="""""""""* ock 2+>1erement"> *
134"/a> span class="""""""""*omment"> **
127
1192/i>         nt  a hra>>1ecode=nlass= clag >1e2112cresult/a> & 0a hrnewlock_cusage_bit clanewlockref"eunock ~3a" >120
1192/i>         nt  a hrdi_nonlircular cladi_2112cresult/a> & 0a hrnewlock_cusage_bit clanewlockref"eunock 2a" >120
119 120128sspan class="comment"> *
128{span class="""""""""* keep/a>>1e, ock flip=chindi_ection  othan cp read.omment"> *
1287/a>{span class="""""""""*omment"> **
136     a>         a hra>>1ecode=nlass= clag >1e2112c| ccoist/a>  ot;/span>


1359/a> 
128"/a>
134ot;/span>
, a hrshe="sef">ref">nonlircular clashe="sef">ref">e_backwari=/a>(          itruct iock_coist/a>  claprev"sref">ibit/a> ,120              a  a>        itruct iock_coist/a>  clanext"sref croo"/a> , enumiock_cusage_bit/a> lep.th/a>(
135128sspan class="comment"> *
134sspan class="""""""""* Prove"> ** chin ew nsafelockyadoes notaphsnect * *
128{span class="""""""""* irq-uwith * is we searchomment"> *
1287/a>{span class="""""""""* chinfi dcusag-subvntlt/a>>rtcla **   amprev#g<(,  othcheomment"> *
133>rtcla **   amnext#g<(:omment"> *
1339/a>sspan class="""""""""*omment"> **
1356/  <6!coist/a>  nonlircular clashe="sref">e_baclass=/a>    claprev"srefesult/a> & 0a hrnext+code=croot>clanext"srefage_bit/a> ibit/a> ,uot;/span>
, a hrs >1eiprntcode=nlass= clag >1eiprnte_bacge_bit/a> )>lep.th/a>(
120      a>     0ot;/span>


120
135         a href=arget_ntry" claff=ref"++;/a >128sspan class="c _READ"*omment"> **
135 1366/a >128sspan class="comment"> *
1287/a>{span class="""""""""* Prove"> ** chin ew nsafelockyadoes notaphsnect * *
133 is we searchomment"> *
1339/a>sspan class="""""""""* chinfi dcusag-subvntlt/a>>rtcla **   amprev#g<(,  othcheomment"> *
134"/a> span class="""""""""* fi dcusa-subvntlt/a>>rtcla **   amnext#g<(:omment"> *
1339/a>sspan class="""""""""*omment"> **
1192/  <6!coist/a>  nonlircular clashe="sref">e_baclass=/a>    claprev"srefesult/a> & 0a hrnext+code=croot>clanext"srefage_bit/a> ibit/a> ,uot;/span>
, a hrs >1eiprntcode=nlass= clag >1eiprnte_bacge_bit/a> )>lep.th/a>(
117      a>     0ot;/span>


135 1196/a>     1ot;/span>


1359/a> 
120 134" >120 (          itruct iock_coist/a>  claprev"sref">ibit/a> ,iock_coist/a>  clanext"sre>lep.th/a>(
135  ref">nonlircular clashe="sef">ref">e_baclass=/a>    claprev"srefesult/a> & 0a hrnext+code=croot>clanext"srefage_bit/a> 129 
117      a>     0ot;/span>


1es.h id="L312fr class="ern_g >1es.h2123acktra" >120
120
120 1279/a>     1ot;/span>


1359/a> 
127
134
, a hrenc_chain+code=nlass= claenc_chain+e_bacvoid>lep.th/a>(
135  intry"/a>(>phstext+code=croot>clahardef">phstextref">lep.th/a>(
117      lass=/a>  phain+code=nlass= clanr_hardef">phain+ref"++;lep.th/a>(
1366/elsee" >129 
132        <6lass=/a>  intry"/a>(>phstext+code=croot>clasoftef">phstextref">lep.th/a>(
1196/a>      a>      lass=/a>  phain+code=nlass= clanr_softef">phain+ref"++;lep.th/a>(
129"/a>  366/elselep.th/a>(
129"/a>      a>      lass=/a>  phain+code=nlass= clanr_process>phain+ref"++;lep.th/a>(
1201359/a> 
1359/a> 
120
135 134
, a hren4" clade=nlass= claen4" c2129"/a>" >120 (          itruct iock_coist/a>  claprev"sref">ibit/a> ,1196/a>      a>        itruct iock_coist/a>  clanext"sre>lep.th/a>(
129 
129"/a>     1ot;/span>


1359/a> 
1312/a> 134
, a hren4" clade=nlass= claen4" c2129"void
, a hrenc_chain+code=nlass= claenc_chain+e_bacvoid>lep.th/a>(
129 
136        phain+code=nlass= clanr_process>phain+ref"++;lep.th/a>(
1359/a> 
1341359/a> 
iock_coist/a>  clanxt"sref" >120
120              a    a>        itruct iock_coist/a>  claprv"sre>lep.th/a>(
135        itruct claef="+d="L3>iock_coist/a>  clanext"srecresult/a> & 0a hrhode=hef="+code=nlass= clahode=hef="+ass=_coist/a>  clanxt"sre>ot;/span>


136        itruct claef="+d="L3>iock_coist/a>  claprev"srecresult/a> & 0a hrhode=hef="+code=nlass= clahode=hef="+ass=_coist/a>  claprv"sre>ot;/span>


136         a href="+code=hprnt _ class="sref">iprnt _/a>(136        ia href="+code=cprnt _ class="sref">iprnt _/a>(1279/a>         a href="+code=cprnt _ class="sref">iprnt _/a>(1356/a>        iprnt _/a>(120          claprev"sreuot;/span>


1192/a>         a href="+code=cprnt _ class="sref">iprnt _/a>(1333/a>         a href="+code=cprnt _ class="sref">iprnt _/a>(135         a hr__ef="+_ode=hprnt _ock_came= cla__ef="+_ode=hprntass=_coist/a>  clanext"sre>ot;/span>


136        iprnt _/a>(1366/a>        iprnt _/a>(


136         a href="+code=hprnt _ class="sref">iprnt _/a>(1359/a> 
134" >120         itruct iock_coist/a>  claprev"sref">ibit/a> ,120         a>        itruct iock_coist/a>  clanext"sre>lep.th/a>(
135  lep.th/a>(
117      a>     0ot;/span>


136         a href="+code=hprnt _ class="sref">iprnt _/a>(136        ia href="+code=cprnt _ class="sref">iprnt _/a>(1279/a>         a href="+code=cprnt _ class="sref">iprnt _/a>(1356/a>        


120        iprnt _/a>(1192/a>         a href="+code=cprnt _ class="sref">iprnt _/a>(intry"/a>(>(  


135         a href="+_ode=ode=cparnt" claef="+_ode=e_baccoist/a>  clanext"sre>ot;/span>


136        iprnt _/a>(1366/a>        


136        ia href="+code=cprnt _ class="sref">iprnt _/a>( ** might help us df="+"> is_ backtrac=:\n&q>ot;/span>


1279/a>         a href="+cdeadss="sscenariolsavectrac= claef="+cdeadss="sscenarioe_baccoist/a>  clanext"sref/coist/a>  claprev"sre>ot;/span>


1356/a>        claef="ern_ef="+cheldcode=3ass=_coist/a>  


127
1192/a>         a href="+code=cprnt _ class="sref">iprnt _/a>( fi dcode=_ backtrac=:\n&q>ot;/span>


1333/a>         a hrdumpcref">ode=cprnt _ cladumpcref">e_bac)ot;/span>


119 136     0ot;/span>


1359/a> 
133 *
1339/a>sspan class="* Che=" whe hers already.omment"> *
134"/a> span class="comment"> *
1339/a>sspan class="* (Note"> ** chis has to be done separately, because chinvntlt/canno omment"> *
134 span class="* detect such  es of deadss="s.)omment"> *
134
span class="comment"> *
134 *
134sspan class="*omment"> **
134" >120         itruct iock_coist/a>  clanext"sref" >120
1196/a>     a>        itruct iock_coist/a>           nt  a hra>ad _ock_came= clareadomre>lep.th/a>(
129 
129"/a>        itruct iock_coist/a>  claprev"sreot;/span>


iock_coist/a>   & 0a hrNULLode=cparnt" claNULL2112ot;/span>


1192/i>         nt  a hriode=cparnt" clai2112ot;/span>


120
135    intry"/a>(>129 
117      coist/a>  claprev"srecresult/a> & 0a hrcur_nonlircular clasur_"sre>intry"/a>(>claheldcode=3ass= +        nt  a hriode=cparnt" clai2112ot;/span>


132        <6lass=/a>  claprev"sre>intry"/a>(>  clanext"sre>intry"/a>(>lep.th/a>(
1196/a>      a>      lass=/a>   & 0a hrprev+code=croot>claprev"sreot;/span>


129"/a>        <6lass=/a>    claprev"sre> !result/a> & 0a hrhode=hef="+code=nlass= clahode=hef="+ass=_coist/a>  clanext"sre>>lep.th/a>(
1312/a>  *
134 *
134sspan class="""""""""""""""""* ss=" 9/a>s (i.e. readcode=(ode=)+readcode=(ode=)):omment"> *
128{span class="""""""""""""""""*omment"> **
132        <66a>        ad _ock_came= clareadomrec== 2)eunockunock lass=/a>  claprev"sre>intry"/a>(>ad _ock_came= clareadomre>lep.th/a>(
1196/a>      a>      a>     2a" >120
129"/a>      l >133 *
1339/a>sspan class="""""""""""""""""* We'rc holdcla chin edecode=, which serializes chis ode='somment"> *
134 span class="""""""""""""""""* nestcla behaviour.omment"> *
134
span class="""""""""""""""""*omment"> **
117        <6lass=/a>  lep.th/a>(
117        <     a>     2a" >120
132      a>     a>         a href="+cdeadss="sbuglsavectrac= claef="+cdeadss="sbuge_baclass=/a>    claprev"srefesult/a> & 0a hrnext+code=croot>clanext"sre)ot;/span>


1196/" >1359/a> 
1279/a>     1ot;/span>


1359/a> 
127
134 span class="comment"> *
134
span class="c Therc was *<9hain-cachinmiss,  othwe arc about to add *< ew nsafelockyomment"> *
134 *
134sspan class="*omment"> *
128{span class="*  - woulthche addcla of chin  amprev#g<( >intr   amnext#g<( nsafelockyacreate aomment"> *
1287/a>{span class="*279/circular nsafelockyain chinvntlt? [== circular nsadss="]omment"> *
133 *
1339/a>sspan class="*  - does chin ew prev>intrnext nsafelockyachsnect *ny *
134"/a> span class="c279/(in chinfullnfi dcusag-subvntlt/a>>rtcla **   amprev#g<()uwith *nyomment"> *
1339/a>sspan class="*    /ardef"-l>< irq-u(in chinfullnfi dcusa-subvntlt/a>>rtcla **omment"> *
134 span class="*      amnext#g<()? [== illegal irq-uinversion with /ardef" phstexts]omment"> *
134
span class="comment"> *
134 *
134sspan class="*279/(in chinfullnfi dcusag-subvntlt/a>>rtcla **   amprev#g<()uwith *nyomment"> *
128{span class="*   >rtcla **omment"> *
1287/a>{span class="*279/  amnext#g<()? [== illegal irq-uinversion with softef" phstexts]omment"> *
133 *
1339/a>sspan class="* *ny *
134"/a> span class="comment"> *
1339/a>sspan class="* Then    *
134 span class="* nsafelocky.omment"> *
134
span class="*omment"> **
134" >120   (          itruct iock_coist/a>  claprev"sref">ibit/a> ,1366////////a>        itruct iock_coist/a>  clanext"sref i>         nt  a hrdirefnct _ock_came= cladirefnct"sref i>         nt  a hrtryss="sloop+code=croot>clatryss="sloop"sre>lep.th/a>(
129 
1196/a>        itruct iock_coist/a>  


1279/i>         nt  a hra>e=lock_coist claa>e"sreot;/span>


129"/a>        itruct iock       nt  a hrthi+code=nlass= clathi+"sreot;/span>





120134 span class="comment"> *
134
span class="""""""""* S >134 *
134 *
134sspan class="""""""""* We use chis s >134 code=ain castasment"> *
128{span class="""""""""* we callni> o chis function multiple times dueuto ockouste claasment"> *
1287/a>{span class="""""""""* tryss="sain chinheld irq-uref">.omment"> *
133 **
1279/s >134        itruct _code==lock_coist claref">_code=>iock       nt  a hrtode==lock_coist clacode=>iocot;/span>


128"/a>
120134 span class="comment"> *
134 span class="""""""""* Prove"> ** chin ew   amprev#g<( >intr   amnext#g<( nsafelockyawoulthno omment"> *
134
span class="""""""""* create a/circular nsafelockyain chinvntlt. (We do chis byomment"> *
134 o chinvntlt/a>>rtcla **   amnext#g<(,  otomment"> *
134sspan class="""""""""* she="cla whe her *
128{span class="""""""""*omment"> *
1287/a>{span class="""""""""* We arc usingnglobal *
133frs=" size of chinresursiv= functions odw:omment"> *
1339/a>sspan class="""""""""*omment"> **
1356/a>           & 0a hrhode=hef="+code=nlass= clahode=hef="+ass=_coist/a>  clanext"sre>ot;/span>


120           & 0a hrNULLode=cparnt" claNULL2112ot;/span>


1192/a>         a hra>e=lock_coist claa>e"srecresult/a> & 0a hrche="snoncircularnonlircular clashe="snoncircularass=_unocka>         & 0a hrhode=hef="+code=nlass= clahode=hef="+ass=_coist/a>  claprev"sre>, unocka>        rget_lasry=lock_coist cla>>rget_lasry"sre)ot;/span>


1333/  <6lass=/a>    e=lock_coist claa>e"sre>>lep.th/a>(
117      a>     a>         a href="+ccircularsbuglsavectrac= claef="+ccircularsbugass=_unocka>         & 0a hrt>rget_lasry=lock_coist cla>>rget_lasry"srefesult/a> & 0a hrnext+code=croot>clanext"srefage_bit/a> claprev"sre>ot;/span>


136           a hra>e=lock_coist claa>e"srec  am 0>>lep.th/a>(
1366//////// a>     a>         a href="+cbfssbuglsavectrac= claef="+cbfssbugass=_a>         a hra>e=lock_coist claa>e"sre>ot;/span>


1333/  <6!coist/a>      claprev"srefesult/a> & 0a hrnext+code=croot>clanext"sre)>lep.th/a>(
129"/a>  366/a>     0ot;/span>


128"/a>
120134 span class="comment"> *
134 span class="""""""""* For resursiv= read-ss="sawe do allnchinnsafelockyache="s,omment"> *
134
span class="""""""""* but we dontnreor= read-triggerednnsafelockies (onlyomment"> *
134 *
134sspan class="""""""""* write-sidennsafelockies matter,  othch**    *
128{span class="""""""""* write-irq-unever *
1287/a>{span class="""""""""* equival"+c to a NOP.omment"> *
133 **
1333/  <6lass=/a>  clanext"sre>intry"/a>(>ad _ock_came= clareadomrec== 2 ||        nt  a hrprev+code=croot>claprev"sre>intry"/a>(>ad _ock_came= clareadomrec== 2) **
129"/a>      a>     1ot;/span>


120134 span class="comment"> *
134 span class="""""""""* Is chin  amprev#g<( >intr   amnext#g<( nsafelockyaalready preslas?omment"> *
134
span class="""""""""*omment"> *
134 *
134sspan class="""""""""*  e.g. chinL1 >intr L2 >intr L3 >intr L4  othchinL5 >intr L1 >intr L2 >intr L3omment"> *
128{span class="""""""""*  9hains - chinrephsd one willnfin ew, but L1 already hagomment"> *
1287/a>{span class="""""""""*  L2 added to its nsafelockyalide, dueuto chinfirst 9hain.)omment"> *
133 **
1279/a>         a hrlide_for_each_lasry=lock_coist clalide_for_each_lasrye_baclass=/a>            claprev"sre>>intry"/a>(> & 0a hrlasry=lock_coist clalasry"sre)e" >129 
129"/a>        <6lass=/a>  intry"/a>(> & 0a hrhode=hef="+code=nlass= clahode=hef="+ass=_coist/a>  clanext"sre>>e" >129 

120              a    79/a>         a hrlasry=lock_coist clalasry"sre>intry"/a>(>


120
117      " >1359/a> 
1361359/a> 
132            ioc)>lep.th/a>(
1196/a>      a>     0ot;/span>


129"/a >134 span class="comment"> *
1339/a>sspan class="""""""""* Ok, allnvalidations passed, add chin ew ode=omment"> *
134 span class="""""""""*uto chinprevious ode='s nsafelockyalide:omment"> *
134
span class="""""""""*omment"> **
117         a hra>e=lock_coist claa>e"srecresult/a> & 0a hraddrss="sto+lide=lock_coist claaddrss="sto+lideass=_coist/a>    claprev"sre>, sult/a> & 0a hrhode=hef="+code=nlass= clahode=hef="+ass=_coist/a>  clanext"sre>f">ibit/a> ,117        <            unocka>          claprev"sre>>intry"/a>(>ibit/a> ,1366////////                lass=/a>  clanext"sre>intry"/a>(>claacquirc_ip"srefesult/a> & 0a hrdirefnct _ock_came= cladirefnct"sref unocka>        ioc)ot;/span>


1333/  <6!coist/a>  e=lock_coist claa>e"sre> >1359/a> 
129"/a>  366/a>     0ot;/span>


128"/a>
120        e=lock_coist claa>e"srecresult/a> & 0a hraddrss="sto+lide=lock_coist claaddrss="sto+lideass=_coist/a>    clanext"sre>fesult/a> & 0a hrhode=hef="+code=nlass= clahode=hef="+ass=_coist/a>  claprev"sre>," >128"/a>
120              a    79unocka>          clanext"sre>>intry"/a>(>ibit/a> ,intry"/a>(>claacquirc_ip"srefesult/a> & 0a hrdirefnct _ock_came= cladirefnct"sref unocka>        ioc)ot;/span>


135  e=lock_coist claa>e"sre> >1359/a> 
117      a>     0ot;/span>


136134 span class="comment"> *
133 *
1339/a>sspan class="""""""""*omment"> **
135      claprev"sre>) ||        nt  a hrverbos==lock_coist claverbos=ass=_coist/a>    clanext"sre>>>e" >129 



120      a>         a href="+code=cprnt _ class="sref">iprnt _/a>(    claprev"sre>)ot;/span>


117      a>         a href="+code=cprnt _ class="sref">iprnt _/a>(117      coist/a>      clanext"sre>>ot;/span>


1366//////// a>         a href="+code=cprnt _ class="sref">iprnt _/a>(132      sult/a> & 0a hrdumpcref">ode=cprnt _ cladumpcref">e_bac)ot;/span>


1196/a>      a>     coist/a>  


129"/" >1359/a> 
135     1ot;/span>


1359/a> 
1312/a> 134
span class="comment"> *
134 *
134sspan class="*2Thinones ch** arc rclevant arc (in increasingndirefnct from sur_):omment"> *
128{span class="* allnphssecutiv= tryss=" lasries  othchinfinal non-tryss=" lasry - oromment"> *
1287/a>{span class="*2chinesd of chis phstext's f="k-9hain - whichever *
133 **
134" >120 (>(          itruct iock_coist/a>  clanext"sre>" >120 129 
1192/i>         nt  a hrdrnth+code=croot>cladrnth2112cresult/a> & 0a hrcur_nonlircular clasur_"sre>intry"/a>(>


1192/i>         nt  a hrtryss="sloop+code=croot>clatryss="sloop"sree= 0ot;/span>


117        itruct iock_coist/a>  iocot;/span>


1366/a >134
span class="comment"> *
1287/a>{span class="""""""""* Df="+gingnche="s.omment"> *
133 *
1339/a>sspan class="""""""""* Dfnth musthno nfinzero *
134"/a> span class="""""""""*omment"> **
120  cladrnth2112>" >120 120      goto coist/a>  iocot;/span>


1366/a >134
span class="comment"> *
134 *
134sspan class="""""""""* to be * *
128{span class="""""""""*omment"> **
132 & 0a hrcur_nonlircular clasur_"sre>intry"/a>(>claheldcode=3ass=[coist/a>  cladrnth2112].lass=/a>  clairq_phstext2137"!= **
1196/a>      a>      lass=/a>  intry"/a>(>claheldcode=3ass=[coist/a>  cladrnth2112-1].lass=/a>  clairq_phstext2137>" >120 129"/a>  366/goto coist/a>  iocot;/span>


128"/a>
120e" >129 
120      i>         nt  a hrdirefnct _ock_came= cladirefnct"srecresult/a> & 0a hrcur_nonlircular clasur_"sre>intry"/a>(>cladrnth2112c+ 1ot;/span>


ioccresult/a> & 0a hrcur_nonlircular clasur_"sre>intry"/a>(>claheldcode=3ass= +        nt  a hrdrnth+code=croot>cladrnth2112-1ot;/span>


117      a >134
span class="comment"> *
134sspan class="""""""""""""""""* Onlynnon-resursiv=-read lasries get  ew nsafelockiesomment"> *
128{span class="""""""""""""""""* added:omment"> *
1287/a>{span class="""""""""""""""""*omment"> **
1196/a>        <6lass=/a>  ioc>intry"/a>(>ad _ock_came= clareadomrec!= 2)e" >129 
129"/a>  366/a>        <6!coist/a>      iocfesult/a> & 0a hrnext+code=croot>clanext"sref >129 
129"/a>                                      sult/a> & 0a hrdirefnct _ock_came= cladirefnct"sref        nt  a hrtryss="sloop+code=croot>clatryss="sloop"sre)>lep.th/a>(
120              a >134
span class="comment"> *
134
span class="""""""""""""""""""""""""* S op after chinfirst non-tryss=" lasry,omment"> *
134 *
134sspan class="""""""""""""""""""""""""* ownndircctnnsafelockies already, so *
128{span class="""""""""""""""""""""""""* ss=" is phsnected to them i>dircctly:omment"> *
1287/a>{span class="""""""""""""""""""""""""*omment"> **
1196/a>      a>        <6!coist/a>  ioc>intry"/a>(>" >120 129"/a>  366/a>              breakot;/span>


129"/a>      " >1359/a> 
120      a >134
span class="comment"> *
134
span class="""""""""""""""""* Esd of f="k-ref">?omment"> *
134 **
117        <6!coist/a>  cladrnth2112>" >120 1366////////         breakot;/span>


132      s >134
span class="comment"> *
133 o ano her *
1339/a>sspan class="""""""""""""""""*omment"> **
129"/a>        <6lass=/a>  intry"/a>(>claheldcode=3ass=[coist/a>  cladrnth2112].lass=/a>  clairq_phstext2137"!= **
intry"/a>(>claheldcode=3ass=[coist/a>  cladrnth2112-1].lass=/a>  clairq_phstext2137>" >120 120              breakot;/span>


clatryss="sloop"sree= 1ot;/span>


1171359/a> 
136     1ot;/span>


132  120 1196/a>      a>     0ot;/span>


129"/a >134 span class="comment"> *
1339/a>sspan class="""""""""* Clearly we all shoultn' nfinherc, but sinct we made it weomment"> *
134 span class="""""""""*ucan reliable say we messed up our/s >1e. See chinabove">woomment"> *
134
span class="""""""""*/gotos/for *
134 **
117  


136     0ot;/span>


1359/a> 
claf="k+9hain2135"   itruct 134<       nt  a hru16 id="L313ot>clau1L2136"coist/a>  cla9hain_hode=3>ioc[coist/a>  claMAX_LOCKDEP_CHAIN_HLOCKS2112]ot;/span>


claode=h9hain_get_9="L3e_baca>        itruct   cla9hain2135f i>         nt  a hri+code=croot>clai2137>" >120 129 
136        itruct claode=h9de=ce3ass= +        nt  a hrchain_hode=3+code=croot>cla9hain_hode=3>ioc[coist/a>  cla9hain2135>intry"/a>(>clai2137]ot;/span>


1359/a> 
134"/a> span class="comment"> *
1339/a>sspan class="* Look up annsafelockyachain. If chinkey is no npreslas ye* chinomment"> *
134 span class="* add it  otha>     1 -ain chis pase chin ew nsafelockyachain i+"sment"> *
134
span class="*nvalidated. If chinkey is already haghed, a>     0.omment"> *
134 *
134sspan class="*omment"> **
134<       nt  a hrin6" claode=croot>clain6" cass= i>         nt  a hrlookuph9hain_cachclaode=croot>clalookuph9hain_cachce_baca>        itruct   
132                           a>        itruct iock_coist/a>  iocf **
1196/a>                                  nt  a hru04 id="L313ot>clau6L2114"       nt  a hrchain_key+code=croot>cla9hain_key2137>" >120 129 
1196/a>        itruct claode=h9de=c>iock_coist/a>    ioc)ot;/pre>>129 
1196/a>        itruct   cla9hain2135ot;/span>


1196/a>        itruct iock_coist/a>    clahode=_next2135ot;/span>


135         nt  a hri+code=croot>clai2137f        nt  a hrj+code=croot>claj2135ot;/span>


1366/a >134
span class="comment"> *
1287/a>{span class="""""""""* We might  eed to take chinvntlt/f="k, ensure we've/got IRQ+"sment"> *
133 *
1339/a>sspan class="""""""""* f="kern won' nan plain about its ownnf="kingnerrors.omment"> *
201"2134" >134 **
120  clairqs_disablede_bac)>>" >120 120      a>     0ot;/span>


1366/a >134
span class="comment"> *
134 *
134sspan class="""""""""* to chinhagh:omment"> *
128{span class="""""""""*omment"> **
136  cla9hain2135f coist/a>  ad _ock_came= clahagh_h>ad>iocfesult/a> & 0a hrlasry=lock_coist clalasry"sre)e" >129 
1196/a>        <6lass=/a>  cla9hain2135>intry"/a>(>cla9hain_key2137crresult/a> & 0a hrchain_key+code=croot>cla9hain_key2137>e" >129 
202"2116" >1196/a>              coist/a>  cla9de=c>ioc>>" >120 120              a    79/a>         a href="+code=cprnt _ class="sref">iprnt _/a>(120 (<: [%p] %s\m cktrac=:\n&qf **
117                              (unsigned f=ngef=ng)sult/a> & 0a hrchain_key+code=croot>cla9hain_key2137f **
117        <             a    79/a>         a hrc="L3+code=croot>cla9de=c>ioc>intry"/a>(>clakey2137f/a>         a hrc="L3+code=croot>cla9de=c>ioc>intry"/a>(>1366////////         a>     0ot;/span>


132      " >1359/a> 
1196/" >1359/a> 
1333/  <6lass=/a>    120 203"2137" >132      a>         a href="+code=cprnt _ class="sref">iprnt _/a>(cla9de=c>ioc>intry"/a>(>clakey2137f/a>         a hrc="L3+code=croot>cla9de=c>ioc>intry"/a>(>120134
span class="comment"> *
134
span class="""""""""*/Alf="ate an ew 9hain lasry from chinr >134 *
134 *
134sspan class="""""""""*omment"> **
1333/  <6!coist/a>  " >120 132      a>     0ot;/span>


120134
span class="comment"> *
1339/a>sspan class="""""""""* We have to walk chinchain again f="ked -ato avoid dupli"ates:omment"> *
204"2135" >134sspan class="""""""""*omment"> **
120          cla9hain2135f coist/a>  ad _ock_came= clahagh_h>ad>iocfesult/a> & 0a hrlasry=lock_coist clalasry"sre)e" >129 
120      i <6lass=/a>  cla9hain2135>intry"/a>(>cla9hain_key2137crresult/a> & 0a hrchain_key+code=croot>cla9hain_key2137>e" >129 



117              goto coist/a>  clacachc_hit>iocot;/span>


117      " >1359/a> 
1333/" >1359/a> 
132 & 0a hrunoikely+code=croot>claunoikelye_baclass=/a>  clanr_ode=h9hains>ioc intrresult/a> & 0a hrMAX_LOCKDEP_CHAINS+code=croot>claMAX_LOCKDEP_CHAINS2112>>e" >129 
1196/a>        <6!coist/a>  120 129"/a>  366/a>      a>     0ot;/span>


205"2135t;/span>


iprnt _/a>(120      a>         a href="+code=cprnt _ class="sref">iprnt _/a>(ot;/span>


ode=cprnt _ cladumpcref">e_bac)ot;/span>


117      a>     0ot;/span>


1361359/a> 
120        cla9hain2135cresult/a> & 0a href="+9hains+code=croot>claode=h9hains>ioc +        nt  a hrnr_ode=h9hains+code=croot>clanr_ode=h9hains>ioc++ot;/span>


136cla9hain2135>intry"/a>(>cla9hain_key2137cresult/a> & 0a hrchain_key+code=croot>cla9hain_key2137ot;/span>


136cla9hain2135>intry"/a>(>clairq_phstext2137"result/a> & 0a hrhode=arget_ntry" clahode=>ioc>intry"/a>(>clairq_phstext2137ot;/span>


129"/a >134
span class="c Fiothchinfirst heldcode= of cur_las chain *omment"> **
206"2137" >136clahode=_next2135"result/a> & 0a hrhode=arget_ntry" clahode=>iocot;/span>


120clai2137cresult/a> & 0a hrcur_nonlircular clasur_"sre>intry"/a>(>clai2137 intrre0;        nt  a hri+code=croot>clai2137-->e" >129 
120      a>         a hrhode=_cur_nonlircular clahode=_cur_2135cresult/a> & 0a hrcur_nonlircular clasur_"sre>intry"/a>(>claheldcode=3ass= +        nt  a hri+code=croot>clai2137ot;/span>


(>clairq_phstext2137"!result/a> & 0a hrhode=hnext+code=croot>clahode=_next2135>intry"/a>(>clairq_phstext2137>" >120 117              breakot;/span>


117      coist/a>  clahode=_next2135"result/a> & 0a hrhode=arget_ntry" clahode=>iocot;/span>


1333/" >1359/a> 
136clai2137++ot;/span>


136cla9hain2135>intry"/a>(>cladrnth2112cresult/a> & 0a hrcur_nonlircular clasur_"sre>intry"/a>(>clai2137ot;/span>


1333/  <6lass=/a>  claoikelye_baclass=/a>  clanr_9hain_hode=3>ioc +        nt  a hrchain+code=croot>cla9hain2135>intry"/a>(>cladrnth2112c<rresult/a> & 0a hrMAX_LOCKDEP_CHAIN_HLOCKS+code=croot>claMAX_LOCKDEP_CHAIN_HLOCKS2112>>e" >129 
207"2115" >117      coist/a>  cla9hain2135>intry"/a>(> & 0a hrnr_9hain_hode=3+code=croot>clanr_9hain_hode=3>iocot;/span>


(>cladrnth2112ot;/span>


120      for<6       nt  a hrj+code=croot>claj2135 re0;        nt  a hrj+code=croot>claj2135 <r        nt  a hrchain+code=croot>cla9hain2135>intry"/a>(>cladrnth2112c- 1;        nt  a hrj+code=croot>claj2135++fesult/a> & 0a hri+code=croot>clai2137++>e" >129 
intry"/a>(>claheldcode=3ass=[coist/a>  clai2137].lass=/a>  cla9de=c_idx2112c- 1; >129 
117              sult/a> & 0a hrchain_hode=3+code=croot>cla9hain_hode=3>ioc[coist/a>  cla9hain2135>intry"/a>(>claj2135]cresult/a> & 0a href="+id _ock_came= claeoe=_id2135; >129 
117      " >1359/a> 
1366//////// a>         a hrchain_hode=3+code=croot>cla9hain_hode=3>ioc[coist/a>  cla9hain2135>intry"/a>(>claj2135]cresult/a> & 0a hrode=c+code=croot>cla9de=c>ioc -a       nt  a hrode=_cde=ce3+code=croot>claode=h9de=ce3ass=; >129 
1361359/a> 
136(>cla9hain2135>intry"/a>(>  ad _ock_came= clahagh_h>ad>ioc)ot;/span>


136208"2137" >136clainch9hainse_bac)ot;/span>


120     1ot;/span>


1359/a> 
        itruct   iocf **
1366//////// a>        itruct iock_coist/a>  iocf/a  itruct ad _ock_came= cla9hain_h>ad"sref coist/a>  cla9hain_key2137>" >120 129 
120134
span class="comment"> *
1339/a>sspan class="""""""""* Tryss="  eeds to ma/a>ain chinr >e= of held ode=s, but it>iment"> *
209"2139" >1339/a>sspan class="""""""""* does no nadd  ew nsafelockies, because tryss=" can be do c>iment"> *
1339/a>sspan class="""""""""* in any order.omment"> *
134 span class="""""""""*omment"> *
134
span class="""""""""*/Winf=ok up chinchain_key  othdo chinO(N^2)nche="  othupdate ofomment"> *
134 *
134sspan class="""""""""* (If lookuph9hain_cachc()/a>    s with 1 it  cquiresomment"> *
128{span class="""""""""* vntlt_ode= for *
1287/a>{span class="""""""""*omment"> **
120  ioc>intry"/a>(>  ioc>intry"/a>(>129"/a>  lass=/a>  clalookuph9hain_cachce_baclass=/a>    iocf<       nt  a hrchain_key+code=croot>cla9hain_key2137>>e" >129 
117      c >134
span class="comment"> *
1339/a>sspan class="""""""""""""""""* Che=" whe her *
134 span class="""""""""""""""""*omment"> *
134
span class="""""""""""""""""* - is irq-safe,nif chis ode= is irq-unsafeomment"> *
134 *
134sspan class="""""""""""""""""*omment"> *
128{span class="""""""""""""""""* Aothche=" whe her *
1287/a>{span class="""""""""""""""""* phulthlead b>e= to chinprevious ode=.omment"> *
133 *
1339/a>sspan class="""""""""""""""""* any of chise scenarios phulthlead to a nsadode=. Ifomment"> *
211"2134" >134 *
1339/a>sspan class="""""""""""""""""*omment"> **
120      /a>/a  itruct  +code=croot>claa> 2135cresult/a> & 0a hrche="snsadode=+code=croot>cla9hee=snsadode=e_baclass=/a>    iocf<       nt  a hrode=arget_ntry" claode=>iocfesult/a> & 0a hrhode=arget_ntry" clahode=>ioc>intry"/a>(>ad _ock_came= clareadomre)ot;/span>


117        <6!coist/a>   +code=croot>claa> 2135>" >120 117        <     a>     0ot;/span>


1366//////// a >134
span class="comment"> *
1287/a>{span class="""""""""""""""""* Mark resursiv= *
133 *
1339/a>sspan class="""""""""""""""""* tryss=" lasries):omment"> *
212"2134" >134 **
120              sult/a> & 0a hrhode=arget_ntry" clahode=>ioc>intry"/a>(>ad _ock_came= clareadomrecre2ot;/span>


 *
134 *
134sspan class="""""""""""""""""* of chiachain,n othif it's no na secondary *
128{span class="""""""""""""""""*omment"> **
132        <6!coist/a>  ad _ock_came= cla9hain_h>ad"sre &r&r   +code=croot>claa> 2135c!= 2) **
1196/a>      a>        <6!coist/a>  cla9hee=sprevs_adde_baclass=/a>    ioc)>" >120 129"/a>  366/a>              a>     0ot;/span>


213"2137" >132      a>         a hrvntlt_unode=arget_ntry" clavntlt_unode=e_bac)ot;/span>


120      a >134
span class="c after **
120 117              a>     0ot;/span>


1333/a>     1ot;/span>


1359/a> 
134<       nt  a hrin6" claode=croot>clain6" cass= i>         nt  a hrvalidate+9hain+code=croot>clavalidate+9haine_backwari=/a>(  


214"2137" >132      a>        itruct   iocf a>        itruct iock_coist/a>  iocf **
  cla9hain_key2137>" >120 129 
1359/a> 
1287/a>{span class="comment"> *
133 *
1339/a>sspan class="cnit from scratch, to make sure that it's do cncorrcctly:omment"> *
215"2134" >134 **
134  cla9hee=schain_keye_backwari=/a>(  " >120 129 
117        itruct iock_coist/a>  iocf<_coist/a>   & 0a hrNULLarget_ntry" claNULL2135ot;/span>


136         nt  a hri+code=croot>clai2137f        nt  a hrid _ock_came= claid2135; >129 
120        cla9hain_key2137 re0; >129 
136clai2137cre0;        nt  a hri+code=croot>clai2137 <r        nt  a hrcur_nonlircular clasur_"sre>intry"/a>(>clai2137++>e" >129 
129"/a>  366/coist/a>  ioccresult/a> & 0a hrcur_nonlircular clasur_"sre>intry"/a>(>claheldcode=3ass= +        nt  a hri+code=croot>clai2137ot;/span>


216"2137" >132      i <6lass=/a>  cla9hain_key2137 !result/a> & 0a hrhode=arget_ntry" clahode=>ioc>intry"/a>(>claprev_chain_key"sre>e" >129 
120              c >1287/a>{span class="comment"> *
134
span class="""""""""""""""""""""""""*/Wingot mightynconfuscd,nour chain keys do ' nmatchomment"> *
1341e?omment"> *
134sspan class="""""""""""""""""""""""""*omment"> **
1366////////         coist/a>  (132                             nt  a hrcur_nonlircular clasur_"sre>intry"/a>(> & 0a hri+code=croot>clai2137f **
1196/a>                      (unsigned f=ngef=ng)sult/a> & 0a hrchain_key+code=croot>cla9hain_key2137f **
129"/a>  366/a>              (unsigned f=ngef=ng)sult/a> & 0a hrhode=arget_ntry" clahode=>ioc>intry"/a>(>claprev_chain_key"sre>ot;/span>


217"2115" >117              a>    ot;/span>


1359/a> 
120             nt  a hrid _ock_came= claid2135"result/a> & 0a hrhode=arget_ntry" clahode=>ioc>intry"/a>(>cla9de=c_idx2112c- 1; >129 
 *
134134 *
134sspan class="""""""""""""""""*omment"> **
1366////////   <6       nt  a hrDEBUG_LOCKS_WARN_ONarget_ntry" claDEBUG_LOCKS_WARN_ONe_bac       nt  a hrid _ock_came= claid2135"intrresult/a> & 0a hrMAX_LOCKDEP_KEYS+code=croot>claMAX_LOCKDEP_KEYS>ioc)>" >120 132              a>    ot;/span>


129"/a>  366/  <6       nt  a hrprev_hode=arget_ntry" claprev_hode=2135c&r&r<6lass=/a>  intry"/a>(>clairq_phstext2137"!rt;/span>


218"2115" >117                                              sult/a> & 0a hrhode=arget_ntry" clahode=>ioc>intry"/a>(>clairq_phstext2137>>" >120 120             nt  a hrchain_key+code=croot>cla9hain_key2137cresult/a> & 0a hriterate+9hain_key+code=croot>claiterate+9hain_keye_baclass=/a>  cla9hain_key2137f/a>         a hrid _ock_came= claid2135>ot;/span>


 & 0a hrhode=arget_ntry" clahode=>iocot;/span>


1171359/a> 
136  cla9hain_key2137 !result/a> & 0a hrcur_nonlircular clasur_"sre>intry"/a>(>e" >129 
1366//////// coist/a>  132      c >1287/a>{span class="comment"> *
13313ngnit,/damn see chiseomment"> *
1339/a>sspan class="""""""""""""""""* numbers float.. I bet that a pink elephant *
219"2139" >1339/a>sspan class="""""""""""""""""*omment"> **
(120              sult/a> & 0a hrcur_nonlircular clasur_"sre>intry"/a>(> & 0a hri+code=croot>clai2137f **
117              (unsigned f=ngef=ng)sult/a> & 0a hrcur_nonlircular clasur_"sre>intry"/a>(>ot;/span>


1361359/a> 
1359/a> 
134


iock_coist/a>  ioc>" >120 129 
120        itruct    & 0a hrhode=hcde=carget_ntry" clahode=h9de=clock6lass=/a>  ioc>ot;/span>


117iprnt _/a>(ot;/span>


117iprnt _/a>(120        iprnt _/a>(136iprnt _/a>(ot;/span>


136  ot;/span>


136iprnt _/a>(221"2137" >136iprnt _/a>(120        iprnt _/a>(ot;/span>


120  ot;/span>


136iprnt _/a>(117iprnt _/a>(1359/a> 
        itruct iock_coist/a>  
129"/a>  366/enum    itruct claprev_=it"sref/enum    itruct clanew_=it>ioc>" >120 222"2134" >129 
120 120      a>     0ot;/span>


117iprnt _/a>(117iprnt _/a>(120        iprnt _/a>(1e ]\n cktrac=:\n&q>ot;/span>


136


136iprnt _/a>(223"2137" >136iprnt _/a>(    clanew_=it>ioc]>ot;/span>


136iprnt _/a>(117      sult/a> & 0a hrcur_nonlircular clasur_"sre>intry"/a>(> & 0a hrtask_pid_n_nonlircular clatask_pid_n_e_baclass=/a>  f **
117      coist/a>  clatrace_hardirq_phstexte_baclass=/a>  f coist/a>    
1366//////// coist/a>  clatrace_softirq_phstexte_baclass=/a>  f coist/a>    
132      coist/a>    f **
1196/a>      coist/a>    >ot;/span>


136  ot;/span>


224"2137t;/span>


120        iprnt _/a>(ot;/span>


120e=_tracearget_ntry" claprintcr >e=_tracee_baclass=/a>    >intry"/a>(>claprev_=it"sref/1>ot;/span>


117  ot;/span>


117iprnt _/a>(ot;/span>


120        136  ot;/span>


225"2137" >136iprnt _/a>(120        e=srget_ntry" cladumpcr >e=e_bac)ot;/span>


1359/a> 
128{span class="comment"> *
1287/a>{span class="* Ps="snout 128error/  <128invalid =it is set:omment"> *
133 **
134<       nt  a hrin6" claode=croot>clain6" cass= i>  **
226"2115       nt  a hrvalid_r >1elaode=croot>clavalid_r >1ee_backwari=/a>(          itruct iock_coist/a>  
claf="khusage_=it2120"       nt  a hrnew_=it+code=croot>clanew_=it>iocf/enum    itruct clabad_=it>ioc>" >120 129 
  >intry"/a>(>clabad_=it>ioc>>>" >120 117      a>     "      nt  a hrprint_usage_="+arget_ntry" claprint_usage_="+e_baclass=/a>    clabad_=it>iocf        nt  a hrnew_=it+code=croot>clanew_=it>ioc>ot;/span>


1359/a> 
(          itruct iock_coist/a>  
129"/a>  366/a>   enum    itruct clanew_=it>ioc>; >129 
227"2137t;/span>


  claCONFIG_TRACE_IRQFLAGS>ioc> &r&r    claCONFIG_PROVE_LOCKING>ioc>" >120 134
span class="comment"> *
134 *
134sspan class="*omment"> **



1196/a>              a>        itruct   claaoo "sref/a>        itruct   clao her"sreft;/span>


129"/a>  366/        a>        itruct iock_coist/a>  /a  itruct 


228"2115" >117              const chark_coist/a>  ioc>" >120 129 
120        itruct   clalasrylock_result/a> & 0a hro her+code=croot>clao her"sre; >129 
claf="khlistlock_class=/a>  clamiddlelock_result/a> & 0a hrNULLarget_ntry" claNULL2135ot;/span>


117/a  itruct cladrnth"sreot;/span>


1366/  <6!coist/a>  120 132      a>     0ot;/span>


136iprnt _/a>(229"2137" >136iprnt _/a>(120        iprnt _/a>(ot;/span>


120


136iprnt _/a>(117iprnt _/a>(
117      coist/a>  intry"/a>(> & 0a hrtask_pid_n_nonlircular clatask_pid_n_e_baclass=/a>  >ot;/span>


120          ot;/span>


1366/  <6a  itruct " >120 1196/a>      coist/a>  iprnt _/a>(  ioc>ot;/span>


136


132      a>         a hrprintcode=cprnt _ class="sref">iprnt _/a>(  ioc>ot;/span>


120          clao her"sre>intry"/a>(>ioc>ot;/span>


120iprnt _/a>(ot;/span>


117iprnt _/a>(ot;/span>


120134
span class="c Fiotha middlenf="kn(   **
136cladrnth"sre_result/a> & 0a hrget_ode=hdrnth+code=croot>claget_ode=hdrnthe_baclass=/a>  clao her"sre>ot;/span>


136129 
129"/a>  366/  <6       nt  a hrdrnth+code=croot>cladrnth"sre_r= 0c&r&r<6lass=/a>  clalasrylock_!result/a> & 0a hrroo +code=croot>claaoo "sre)>e" >129 
231"2115" >117                     nt  a hrprintcode=cprnt _ class="sref">iprnt _/a>(  ot;/span>


120      " >1359/a> 
136clamiddlelock_result/a> & 0a hrlasry+code=croot>clalasrylockot;/span>


117      lass=/a>  clalasrylock_result/a> & 0a hrget_ode=hparlassrget_ntry" claget_ode=hparlase_baclass=/a>  clalasrylock>ot;/span>


117      coist/a>  cladrnth"sre--ot;/span>


120  clalasrylock_&r&r  clalasrylock_!result/a> & 0a hrroo +code=croot>claaoo "srec&r&r<6lass=/a>  cladrnth"sre_intrre0>>ot;/span>


1366/  <6a  itruct " >120 1196/a>      coist/a>    claaoo "sref/lass=/a>  clao her"sreft;/span>


129"/a>  366/               nt  a hrmiddlelaode=croot>clamiddlelock_?        nt  a hrmiddlelaode=croot>clamiddlelock>intry"/a>(>ioc :esult/a> & 0a hrroo +code=croot>claaoo "sre>intry"/a>(>iocf/lass=/a>  clao her"sre>intry"/a>(>ioc>ot;/span>


232"2115" >117


  clao her"srefesult/a> & 0a hrroo +code=croot>claaoo "sreft;/span>


120                     nt  a hrmiddlelaode=croot>clamiddlelock_?        nt  a hrmiddlelaode=croot>clamiddlelock>intry"/a>(>ioc :esult/a> & 0a hro her+code=croot>clao her"sre>intry"/a>(>iocfesult/a> & 0a hrroo +code=croot>claaoo "sre>intry"/a>(>ioc>ot;/span>


117clal="kern_print_heldcode=3e_baclass=/a>  ot;/span>


120        iprnt _/a>(1366/  <6!coist/a>  i&rsult/a> & 0a hrroo +code=croot>claaoo "sre>intry"/a>(>>>" >120 1196/a>      a>     0ot;/span>


136  clao her"srefesult/a> & 0a hrroo +code=croot>claaoo "sre>ot;/span>


233"2137t;/span>


120        iprnt _/a>(120e=srget_ntry" cladumpcr >e=e_bac)ot;/span>


117     0ot;/span>


1359/a> 
1287/a>{span class="comment"> *
133 *
1339/a>sspan class="* chire is nonf="knmatch3ngn<rmaskintr:omment"> *
234"2139" >1339/a>sspan class="*omment"> **
(          itruct iock_coist/a>  
claf="khusage_=it2120"       nt  a hrbit+code=croot>clabit>iocf const chark_coist/a>  ioc>" >120 129 
117/a  itruct  +code=croot>claaetlockot;/span>


120        itruct  & 0a hrroo +code=croot>claaoo "sreot;/span>


120        itruct     clacarget_lasry"sre>ot;/span>


136claaoo "sre.a>         & 0a hrNULLarget_ntry" claNULL2135ot;/span>


235"2137" >136claaoo "sre.a>        ioc result/a> & 0a hrhode=hcde=carget_ntry" clahode=h9de=clock6lass=/a>  ot;/span>


120         +code=croot>claaetlock result/a> & 0a hrfindhusage_forwardslsavectrac= clafindhusage_forwardsef">i&rsult/a> & 0a hrroo +code=croot>claaoo "sref        nt  a hrbit+code=croot>clabit>iocf &rsult/a> & 0a hrcarget_lasry+code=croot>clacarget_lasry"sre>ot;/span>


120 +code=croot>claaetlock <r 0>" >120 120 +code=croot>claaetlock == 1>" >120 117      a>     "      nt  a hra> +code=croot>claaetlockot;/span>


120     "      nt  a hrprint_irq_inversion_="+arget_ntry" claprint_irq_inversion_="+e_baclass=/a>   & 0a hrroo +code=croot>claaoo "sref        nt  a hrcarget_lasry+code=croot>clacarget_lasry"sref **
1196/a>                              coist/a>    ioc>ot;/span>


1359/a> 
236"2137t;/span>


1287/a>{span class="comment"> *
133 *
134
span class="* chire is nonf="knmatch3ngn<rmaskintr:omment"> *
134 **
e=wardslsavectrac= clache"khusage_b>e=wardse_backwari=/a>(          itruct iock_coist/a>  
132            enum    itruct clabit>iocf const chark_coist/a>  ioc>" >120 129 
129"//a>/a  itruct  +code=croot>claaetlockot;/span>


237"2137" >136        itruct  & 0a hrroo +code=croot>claaoo "sreot;/span>


136        itruct     clacarget_lasry"sre>ot;/span>


136claaoo "sre.a>         & 0a hrNULLarget_ntry" claNULL2135ot;/span>


117claaoo "sre.a>        ioc result/a> & 0a hrhode=hcde=carget_ntry" clahode=h9de=clock6lass=/a>  ot;/span>


117 +code=croot>claaetlock result/a> & 0a hrfindhusage_b>e=wardslsavectrac= clafindhusage_b>e=wardsef">i&rsult/a> & 0a hrroo +code=croot>claaoo "sref        nt  a hrbit+code=croot>clabit>iocf &rsult/a> & 0a hrcarget_lasry+code=croot>clacarget_lasry"sre>ot;/span>


1366/  <6a  itruct  +code=croot>claaetlock <r 0>" >120 132      a>     "      nt  a hrprint_bfs_="+arget_ntry" claprint_bfs_="+e_baclass=/a>   +code=croot>claaetlock>ot;/span>


1196/  <6a  itruct  +code=croot>claaetlock == 1>" >120 129"/a>  366/a>     "      nt  a hra> +code=croot>claaetlockot;/span>


238"2137t;/span>


136     "      nt  a hrprint_irq_inversion_="+arget_ntry" claprint_irq_inversion_="+e_baclass=/a>   & 0a hrroo +code=croot>claaoo "sref        nt  a hrcarget_lasry+code=croot>clacarget_lasry"sref **
120                              coist/a>    ioc>ot;/span>


1359/a> 
" >120 129 
136iprnt _/a>(intry"/a>(>ioc>ot;/span>


136iprnt _/a>(intry"/a>(>ioc>ot;/span>


136  intry"/a>(>ioc>ot;/span>


239"2137" >136iprnt _/a>(intry"/a>(>ioc>ot;/span>


120          intry"/a>(>ioc>ot;/span>


120iprnt _/a>(intry"/a>(>ioc>ot;/span>


136  intry"/a>(>ioc>ot;/span>


117iprnt _/a>(intry"/a>(>ioc>ot;/span>


117  intry"/a>(>ioc>ot;/span>


1359/a> 
(  ioc>" >120 129 
(129 
136     "      nt  a hrd="L3_filter+code=croot>clad="L3_filtere_baclass=/a>  ioc>ot;/span>


1359/a> 
(  ioc>" >120 129 



129"/a>     "      nt  a hrd="L3_filter+code=croot>clad="L3_filtere_baclass=/a>  ioc>ot;/span>


241"2115#endift;/span>


136     0ot;/span>


1359/a> 
(  ioc>" >120 129 



120     "      nt  a hrd="L3_filter+code=croot>clad="L3_filtere_baclass=/a>  ioc>ot;/span>


129"/a>     0ot;/span>


242"2115" >1359/a> 
(claSTRICT_READ_CHECKS2120" >1291 >1359/a> 
1e_verbose_f2114[])ckwari=/a>(  ioc> =e" >129 
(  129 
120        
1es.h+code=crof" claode=ern_r >1es.h2136acktra **

243"2137t;/span>


(>clain6" cass= i> (>1e_verbosearget_ntry" clas >1e_verbosee_bacenum    itruct clabit>iocft;/span>


120                      kwari=/a>(  ioc>" >120 129 
117     lass=/a>  1e_verbose_farget_ntry" clas >1e_verbose_f2114[       nt  a hrbit+code=croot>clabit>ioc_intrintr 2]class=/a>  ioc>ot;/span>


1359/a> 
ioc>ckwari=/a>(        itruct iock_ft;/span>


1196/a>                   enum    itruct clabit>iocf const chark_coist/a>  ioc>ot;/span>


244"2139a>>134t;/span>


        itruct iock_coist/a>  
120      enum    itruct clanew_=it>ioc> **
129 
117/a  itruct claexcl_=it2114"result/a> & 0a hrlxclusive_=it+code=croot>clalxclusive_=ite_baclass=/a>  clanew_=it>ioc>; >129 
117/a  itruct ad _ock_came= claa>ad2114"result/a> & 0a hrnew_=it+code=croot>clanew_=it>ioc/&r 1; >129 
120/a  itruct  & 0a hrnew_=it+code=croot>clanew_=it>ioc/&r 2; >129 
1361287/a>{span class="comment"> *
1339/a>sspan class="""""""""* mark USED_IN has tonf=okaforwards -- tonensure nondrnfelockyomment"> *
245"2139" >1339/a>sspan class="""""""""* has ENABLEDar >1e, which would allow/a>sursion dsadf="ks.omment"> *
1287/a>{span class="""""""""*omment"> *
133e=wards -- tonensure nondrnfeloeomment"> *
134
span class="""""""""* has USED_IN r >1e, which, again, would allow//a>sursion dsadf="ks.omment"> *
134 **
117ioc/       nt  a hrusagenonlircular clausage2114"result/a> & 0a hrdi_nonlircular cladi_2114"? **
120             nt  a hrche"khusage_b>e=wardslsavectrac= clache"khusage_b>e=wardse_ba :esult/a> & 0a hrche"khusage_forwardslsavectrac= clache"khusage_forwardse_ba; >129 
1361287/a>{span class="comment"> *
1339/a>sspan class="""""""""* Valid>1e that chis p>r13cularkf="k does not have conflic13ngomment"> *
246"2139" >1339/a>sspan class="""""""""* usage r >1es.omment"> *
1287/a>{span class="""""""""*omment"> **
120  1elsavectrac= clavalid_r >1ee_baclass=/a>     & 0a hrnew_=it+code=croot>clanew_=it>iocfesult/a> & 0a hrexcl_=it+code=croot>claexcl_=it2114>>" >120 1361287/a>{span class="comment"> *
1e that chenf="kndsafelockies don't have conflic13ng usage21ment"> *
1287/a>{span class="""""""""* r >1es.omment"> *
133 **
129"// <66!coist/a>  ad _ock_came= claa>ad2114"|| !coist/a>    claSTRICT_READ_CHECKS2120)c&r&r **
247"2115" >117              !coist/a>       & 0a hrexcl_=it+code=croot>claexcl_=it2114fesult/a> & 0a hrs >1e_ss="+code=croot>clas >1e_ss="e_baclass=/a>  clanew_=it>ioc/&r ~1)>>" >120 1361287/a>{span class="comment"> *
134ad in write conflic1somment"> *
133 **
1366/  <6!coist/a>  ad _ock_came= claa>ad2114>e" >129 
132        <6!coist/a>  1elsavectrac= clavalid_r >1ee_baclass=/a>     & 0a hrnew_=it+code=croot>clanew_=it>iocfesult/a> & 0a hrexcl_=it+code=croot>claexcl_=it2114 + 1>>" >120 1196/a>              a>     0ot;/span>


248"2115" >117        <6a  itruct claSTRICT_READ_CHECKS2120"&r&r **
   & 0a hrexcl_=it+code=croot>claexcl_=it2114 + 1f **
120                      sult/a> & 0a hrs >1e_ss="+code=croot>clas >1e_ss="e_baclass=/a>  clanew_=it>ioc/+ 1>>>" >120 1171359/a> 
1366/  <6a  itruct 1e_verbosearget_ntry" clas >1e_verbosee_bacsult/a> & 0a hrnew_=it+code=croot>clanew_=it>iocfesult/a> & 0a hrhode=hcde=carget_ntry" clahode=h9de=clock6lass=/a>  >>" >120 132      a>     2; >129 
129"/a>     1; >129 
249"2115" >1359/a> 
129 
(          
1es.h+code=crof" claode=ern_r >1es.h2136acktra **


133 *
1339/a>sspan class="* Mark all heldnf="ks with a usage =it:omment"> *
1339/a>sspan class="*omment"> **
clamarkctype2120"   itruct clamark>ioc> **
129 
117clausage_=it2120a **
136        itruct iock_coist/a>  ioca **
120/a  itruct ioca **
1196/for class=/a>  ioc = 0o/a  itruct ioc <r lass=/a>  intry"/a>(>claf="kern_ernth>ioca/a  itruct ioc++>e" >129 
129"/a>  366/coist/a>  ioc"result/a> & 0a hrcur_nonlircular clasur_"sre>intry"/a>(>claheldcode=3e_ba/+ a  itruct ioca **
251"2137t;/span>


  clamark>ioc <r<r 2);/a >1287/a>{span class="c ENABLEDa*omment"> **
120        <6a  itruct ioc>intry"/a>(>ad _ock_came= claa>ad2114> **
1287/a>{span class="c READa*omment"> **
117      coist/a>  claBUG_ONe_baclass=/a>  clausage_=it2120"intrresult/a> & 0a hrLOCK_USAGE_STATES+code=croot>claLOCK_USAGE_STATES2114>a **
132        <6sult/a> & 0a hrhode=hcde=carget_ntry" clahode=h9de=clock6lass=/a>  ioc)>intry"/a>(>clakey2120"rresult/a> & 0a hr__f="kern_no_valid>1e__arget_ntry" cla__f="kern_no_valid>1e__2120.a>         **
1196/a>              continuea **
252"2115" >117        <6!coist/a>  clamarkcode=>iocclass=/a>    iocf/coist/a>  clausage_=it2120>>" >120 1201359/a> 
117     1; >129 
1359/a> 
1287/a>{span class="comment"> *
133 *
1339/a>sspan class="*omment"> **
253"2139a>>134cla__trace_hardirqs_on_caller>ioccunsignednf=ng a  itruct ioc> **
129 
120(   & 0a hrcur_lasarget_ntry" clacur_las>ioca **
1171287/a>{span class="c we'll do 128OFF >intr ON transition:"*omment"> **
117intry"/a>(>129 
1171287/a>{span class="cmment"> **
133 **
1339/a>sspan class="""""""""* usage =it/for all heldnf="ks:omment"> *
254"2139" >1339/a>sspan class="""""""""*omment"> **
  >" >120 120      a>    ; >129 
1361287/a>{span class="comment"> *
134 *
133 *
 *
1287/a>{span class="""""""""*omment"> **
1196/  <6a  itruct intry"/a>(>ioc> **
129"/a>  366/  <6!coist/a>  clamarkcheldcode=3e_baclass=/a>    >" >120 255"2115" >117              a>    ; >129 
120intry"/a>(>ioc"result/a> & 0a hriparget_ntry" claip>ioc; >129 
136intry"/a>(>ioc"re++a  itruct intry"/a>(>ioc; >129 
117  a **
1359/a> 
ioc> **
129 
136clatime_hardirqs_onlock6lass=/a>  claCALLER_ADDR0"sref/coist/a>  ioc>a **
256"2137t;/span>


ioc>intry"/a>(>sursion+code=croot>claf="kern_a>sursion2120>>" >120 120      a>    ; >129 
ioc>intry"/a>(>e" >129 
117      c >1287/a>{span class="comment"> *
 *
1287/a>{span class="""""""""""""""""* so chis is racy byassture butnf=s3ng one hit21ment"> *
1331 is not a =ig dsal.omment"> *
1339/a>sspan class="""""""""""""""""*omment"> **
257"2115" >117             nt  a hr__debug_atomic_inclsavectrac= cla__debug_atomic_inclock6coist/a>  claredundant_hardirqs_on>ioc>a **
1201359/a> 
1171287/a>{span class="cmment"> **
1331e above irqs weren'tmment"> **
ady enabled, yet we find che hardware chinks chey are in factmment"> **
1287/a>{span class="""""""""* enabled.. someone messednup cheir IRQ r >1e tracing.omment"> *
133 **
129"// <6coist/a>  claDEBUG_LOCKS_WARN_ONlock6!coist/a>  >>" >120 258"2115" >117      a>    a **
1201287/a>{span class="cmment"> **
134
span class="""""""""* See che f" c/text that goes af=ng with chis variable def" ition.omment"> *
134 **
129"// <6coist/a>  claDEBUG_LOCKS_WARN_ONlock6coist/a>  claunlikelylock6coist/a>  >" >120 120      a>    a **
1361287/a>{span class="comment"> *
1339/a>sspan class="""""""""* Can't allow/enabl3ng interrupts while in 133interrupt handler,omment"> *
259"2139" >1339/a>sspan class="""""""""* that's general bad/form and such. R>sursion, limitednr >ck etc..omment"> *
1287/a>{span class="""""""""*omment"> **
120  claDEBUG_LOCKS_WARN_ONlock6coist/a>  ioc>intry"/a>(>>" >120 117ioc>intry"/a>(>sursion+code=croot>claf="kern_a>sursion2120"re1; >129 
120        cla__trace_hardirqs_on_caller>iocccoist/a>  ioc>a **
117ioc>intry"/a>(>sursion+code=croot>claf="kern_a>sursion2120"re0ot;/span>


1359/a> 
(>claEXPORT_SYMBOL>iocccoist/a>  clatrace_hardirqs_on_caller>ioc>a **



120 129 
136clatrace_hardirqs_on_caller>iocclass=/a>  claCALLER_ADDR0"sre>a **
1359/a> 
(>claEXPORT_SYMBOL>iocccoist/a>  clatrace_hardirqs_on>ioc>a **
1287/a>{span class="comment"> *
133 *
1339/a>sspan class="*omment"> **
261"2137void/       nt  a hrtrace_hardirqs_off_caller+code=croot>clatrace_hardirqs_off_caller>ioccunsignednf=ng a  itruct ioc> **
129 
120(   & 0a hrcur_lasarget_ntry" clacur_las>ioca **
117  claCALLER_ADDR0"sref/coist/a>  ioc>a **
1366/  <6a  itruct claunlikelylock6!coist/a>  cladebug_ode=3213a || coist/a>  ioc>intry"/a>(>sursion+code=croot>claf="kern_a>sursion2120>>" >120 132      a>    a **
129"/" >1287/a>{span class="comment"> *
262"2139" >1339/a>sspan class="""""""""* So we're supposednto get called after you masknf="al IRQs, butnforomment"> *
1287/a>{span class="""""""""* some a>ason che hardware doesn't quite chink you did/a proper job.omment"> *
133 **
1366/  <6a  itruct claDEBUG_LOCKS_WARN_ONlock6!coist/a>  >>" >120 117      a>    a **
1366/  <6a  itruct intry"/a>(>e" >129 
132      " >1287/a>{span class="comment"> *
133intr OFF transition:omment"> *
1339/a>sspan class="""""""""""""""""*omment"> **
263"2115" >117             nt  a hrcur_nonlircular clasur_"sre>intry"/a>(>


intry"/a>(> & 0a hriparget_ntry" claip>ioc; >129 
120      coist/a>  intry"/a>(>intry"/a>(>ioc; >129 
117
117      coist/a>    ioc>a **
1359/a> 
(>claEXPORT_SYMBOL>iocccoist/a>  clatrace_hardirqs_off_caller>ioc>a **
120 264"2139" >129 
a **
1359/a> 
(>claEXPORT_SYMBOL>iocccoist/a>  clatrace_hardirqs_off>ioc>a **
133 *
 *
1287/a>{span class="*omment"> **
ioc> **
129 
265"2115" >117(   & 0a hrcur_lasarget_ntry" clacur_las>ioca **
120  claunlikelylock6!coist/a>  cladebug_ode=3213a || coist/a>  ioc>intry"/a>(>sursion+code=croot>claf="kern_a>sursion2120>>" >120 117133 *
 *
1287/a>{span class="""""""""* funny r >1e and nes13ng chings.omment"> *
133 **
129"// <6coist/a>  claDEBUG_LOCKS_WARN_ONlock6!coist/a>  >>" >120 266"2115" >117      a>    a **
120intry"/a>(>ioc>e" >129 
117      a>    a **
1171359/a> 
117ioc>intry"/a>(>sursion+code=croot>claf="kern_a>sursion2120"re1; >129 
1361287/a>{span class="comment"> *
1339/a>sspan class="""""""""* We'll do 128OFF >intr ON transition:omment"> *
267"2139" >1339/a>sspan class="""""""""*omment"> **
intry"/a>(>ioc"re1; >129 
120intry"/a>(> & 0a hriparget_ntry" claip>ioc; >129 
136intry"/a>(>intry"/a>(>ioc; >129 
117  ioc>a **
117133 *
 **
1287/a>{span class="""""""""* usage =it/for all heldnf="ks,/   *
133 *
1339/a>sspan class="""""""""*omment"> **
268"2115" >117intry"/a>(> **
(>clamarkcheldcode=3e_baclass=/a>    a **
120ioc>intry"/a>(>sursion+code=croot>claf="kern_a>sursion2120"re0ot;/span>


1359/a> 
133 *
 *
1287/a>{span class="*omment"> **
ioc> **
129 
269"2115" >117(   & 0a hrcur_lasarget_ntry" clacur_las>ioca **
120  claunlikelylock6!coist/a>  cladebug_ode=3213a || coist/a>  ioc>intry"/a>(>sursion+code=croot>claf="kern_a>sursion2120>>" >120 117133 *
 *
1287/a>{span class="""""""""*omment"> **
1196/  <6a  itruct claDEBUG_LOCKS_WARN_ONlock6!coist/a>  >>" >120 129"/a>  366/a>    a **



intry"/a>(>ioc>e" >129 
120      c >133 *
134
span class="""""""""""""""""* We have done 128ON >intr OFF transition:omment"> *
134 **
117      coist/a>  intry"/a>(>ioc"re0ot;/span>


120      a  itruct intry"/a>(> & 0a hriparget_ntry" claip>ioc; >129 
132      "  itruct intry"/a>(>intry"/a>(>ioc; >129 
1196/a>             nt  a hrdebug_atomic_inclsavectrac= cladebug_atomic_inclock6lass=/a>  a **
129"/a>  366/c >133 *
271"2139" >1339/a>sspan class="""""""""""""""""* Whoops, we wantednroftirqs off, so why aren't chey?omment"> *
1287/a>{span class="""""""""""""""""*omment"> **
120      a  itruct claDEBUG_LOCKS_WARN_ONlock6!coist/a>  >a **
117      coist/a>    ioc>a **
1359/a> 
    ioc> **
129 
129"/kwari=/a>(   & 0a hrcur_lasarget_ntry" clacur_las>ioca **
272"2137t;/span>


120 120      a>    a **
1171287/a>{span class="c no a>7/aim without wait3ng on it"*omment"> **
129"// <6!6lass=/a>  >" >120 120      a>    a **
1361287/a>{span class="c chis guy won't laser a>7/aim *omment"> **
129"// <66coist/a>  intry"/a>(>ioc &/       nt  a hrPF_MEMALLOClsavectrac= claPF_MEMALLOC>ioc>e&&/!6lass=/a>  >" >120 273"2115" >117      a>    a **
1201287/a>{span class="c We're only3interestedn__GFP_FS allocations/for now *omment"> **
>" >120 117      a>    a **
1201287/a>{span class="cmment"> **
1287/a>{span class="""""""""* Oi! Can't be hav3ng __GFP_FS allocations/with IRQs disabled.omment"> *
133 **
129"// <6coist/a>  claDEBUG_LOCKS_WARN_ONlock6coist/a>    ioc>>>" >120 274"2115" >117      a>    a **
120clamarkcheldcode=3e_baclass=/a>    ioc>a **
1359/a> 
    " >120 129 
129"/unsignednf=ng a  itruct ioca **
275"2137t;/span>


ioc>intry"/a>(>sursion+code=croot>claf="kern_a>sursion2120>>" >120 120      a>    a **
117  ioc>a **
117iocccoist/a>  ioc>a **
120        ioc>intry"/a>(>sursion+code=croot>claf="kern_a>sursion2120"re1; >129 
117    ioc>a **
120        ioc>intry"/a>(>sursion+code=croot>claf="kern_a>sursion2120"re0ot;/span>


136iocccoist/a>  ioc>a **
276"2115" >1359/a> 
(  " >120 129 
1171287/a>{span class="cmment"> **
133 **
 *
1287/a>{span class="""""""""*omment"> **
1196/  <6!coist/a>  intry"/a>(>ioc>e" >129 
129"/a>  366/  <6coist/a>  intry"/a>(>adnonlircular claread>ioc>e" >129 
277"2115" >117      a>  366/  <6coist/a>  intry"/a>(> >129 
  129 
120                                      coist/a>  >" >120 136    e0ot;/span>


117      a>  366/  <6coist/a>  intry"/a>(> >129 
117      a>      a>  366/  <6!coist/a>      129 
120                                      coist/a>  >" >120 132                              a>    e0ot;/span>


1196/a>      } elsee" >129 
129"/a>  366/a>  366/  <6coist/a>  intry"/a>(> >129 
278"2115" >117      a>  366/a>  366/  <6!coist/a>        >" >120 120                <6coist/a>  intry"/a>(> >129 
136        >" >120 117      a>  366/                a>    e0ot;/span>


117      " >1359/a> 
1201359/a> 
132  intry"/a>(>clahardirqs_off>ioc>e" >129 
1196/a>        <6coist/a>  intry"/a>(>adnonlircular claread>ioc>e" >129 
129"/a>  366/a>  366/  <6!coist/a>      129 
279"2115" >117      a>  366/a>  366/////////coist/a>  >" >120 120                <6coist/a>  intry"/a>(>ioc>t;/span>


  129 
117      a>  366/                ////////coist/a>  >" >120 117      a>      a>  366/////////a>    e0ot;/span>


120      } elsee" >129 
132                <6!coist/a>      129 
1196/a>                      ////////coist/a>  >" >120 129"/a>  366/a>  366/////////a>    e0ot;/span>


117      a>  366/  <6coist/a>  intry"/a>(>ioc>t;/span>


  129 
120      a>                      ////////coist/a>  >" >120 136    e0ot;/span>


117      " >1359/a> 
1171359/a> 
1321287/a>{span class="cmment"> **
133use che irq context infrakwari=ure more broadly as a generalmment"> **
1339/a>sspan class="""""""""* context check3ng sursion (a f="k takenmment"> **
281"2139" >1339/a>sspan class="""""""""* dur3ng a>7/aim for a GFP_FS allocation is heldnover a GFP_FSmment"> **
1287/a>{span class="""""""""* allocation).omment"> *
133 **
(>ioce&&/6coist/a>  intry"/a>(>129 
117        <6coist/a>  intry"/a>(>adnonlircular claread>ioc>e" >129 
117      a>        <6!coist/a>        >" >120 120                              a>    e0ot;/span>


132      } elsee" >129 
1196/a>                <6!coist/a>        >" >120 129"/a>  366/a>  366/////////        a>    e0ot;/span>


282"2115" >117      " >1359/a> 
1359/a> 
1359/a> 
(  


132      kwari=/a>(  " >120 129 
129"/unsignednin=/a>( & 0a hrcur_nonlircular clasur_"sre>intry"/a>(>129 
283"2137t;/span>


 **
133 *
134
span class="""""""""*omment"> **
117intry"/a>(>  intry"/a>(>
117      a>      a>  366/coist/a>  intry"/a>(>129 
120  e" >129 
132      kwari=/a>(  129 
129"/a>  366/cass=/a>   & 0a hrcur_nonlircular clasur_"sre>intry"/a>(>claheldcode=3e_ba +/a>(129 
284"2115" >117        >1287/a>{span class="cmment"> **
1287/a>{span class="""""""""""""""""* If we crossnin=o 12other context, reset chemment"> **
133 **
134
span class="""""""""""""""""* add3ng of che ernendency =o 'prev'):omment"> *
134 **
117        <6coist/a>  intry"/a>(> & 0a hrhode=nonlircular clahode=lock>intry"/a>(>" >120 120              a>    e1; >129 
1321359/a> 
1196/a>    e0ot;/span>


1359/a> 
285"2137t;/span>


e&&/def" cd(CONFIG_PROVE_LOCKING)"*omment"> **
(>1359/a> 
(  (  


117      enum/       nt  a hrf="k_usage_bi=lsavectrac= claf="k_usage_bi=2115"       nt  a hrnew_bi=lsavectrac= clanew_bi=e_ba>" >120 129 
117claWARN_ONlock61);ea >1287/a>{span class="c Impossible innit? when we don't have TRACE_IRQFLAG"*omment"> **
1196/a>    e1; >129 
1359/a> 
286"2137t;/span>


(>(iocckwari=/a>(  


120      kwari=/a>(  " >120 129 
117    e1; >129 
1359/a> 
(>((  


1196/a>      kwari=/a>(  " >120 129 
287"2115" >117    e0ot;/span>


1359/a> 
    " >120 129 
1359/a> 
e&&/def" cd(CONFIG_PROVE_LOCKING)"*omment"> **
1339/a>sspan class="cmment"> **
288"2139" >1339/a>sspan class="* Mark a f="k with a usage bi=, and validate che a>>1e transition:omment"> *
1287/a>{span class="*omment"> **
(  


136" >120 129 
117(   lsavectrac= claa> 2120"re1ot;/span>


1321287/a>{span class="cmment"> **
133 **
1339/a>sspan class="""""""""* nor do any checks:omment"> *
289"2139" >1339/a>sspan class="""""""""*omment"> **
intry"/a>(>>" >120 120      a>    e1; >129 
117  >" >120 117      a>    e0ot;/span>


1201287/a>{span class="cmment"> **
1287/a>{span class="""""""""* Make aure we didn't race:omment"> *
133 **
129"// <6coist/a>  claunlikelylock6coist/a>    intry"/a>(>>e" >129 
117      coist/a>  ot;/span>


1201359/a> 
117  intry"/a>(> & 0a hrnew_masklsavectrac= clanew_mask2120; >129 
120      intry"/a>(>(>" >120 132      a>    e0ot;/span>


129"/switch<6coist/a>  e" >129 
291"2139#def" c coist/a>    132        \ >129 
120  129 
117  129 
(>
>1es.h2115"r >129 
132      coist/a>   lsavectrac= claa> 2120"rea>(  (r >129 
1196/a>        <6!coist/a>   lsavectrac= claa> 2120>" >120 129"/a>  366/a>  366/a>    e0ot;/span>


292"2115" >117      breakot;/span>


120      coist/a>    clanrcunusedcode=3e_ba>r >129 
136


117129 
117        <6!coist/a>  >" >120 120              a>    e0ot;/span>


132      coist/a>  claWARN_ONlock61);t;/span>


1196/a>      a>    e0ot;/span>


129"/" >1359/a> 
293"2137t;/span>


 **
134 *
133 **
120   lsavectrac= claa> 2120"r= 2>e" >129 
132      coist/a>  133,/a>((ot;/span>


1196/a>      coist/a>    


129"/a>  366/cass=/a>    


294"2115" >117       oist/a>  >e=nonlircular cladumn_a>>e=lock6>ot;/span>


1359/a> 
1359/a> 
 **
1287/a>{span class="* Initialize a f="k ina>>nce's f="k-7/a>{ mapp3ng info:omment"> *
133 **
(    


295"2115" >117      a>  36kwari=/a>(  clakeylock,(" >120 129 
120(


117    ot;/span>


120  ((" >120 132      coist/a>  intry"/a>(>((


29602114" >117intry"/a>(>(ot;/span>


 **
134 **
133 **
120  claDEBUG_LOCKS_WARN_ONlock6!coist/a>  >e" >129 
132      coist/a>  intry"/a>(>133ot;/span>


1196/a>      a>    ot;/span>


129"/" >1359/a> 
297"2137t;/span>


(>(>


 **
134 *
133 **
120  claDEBUG_LOCKS_WARN_ONlock6!coist/a>  clakeylock>>" >120 132      a>    ot;/span>


1196/a >1287/a>{span class="cmment"> **
1339/a>sspan class="""""""""* Sanity check, che f="k-7/a>{ key must be persistlas:omment"> *
298"2139" >1339/a>sspan class="""""""""*omment"> **
129 
120      coist/a>  133,/a>(clakeylock>ot;/span>


1361287/a>{span class="cmment"> **
134 *
133 **
120      coist/a>  claDEBUG_LOCKS_WARN_ONlock61);t;/span>


132      a>    ot;/span>


1196/" >1359/a> 
129"/ oist/a>  intry"/a>(>clakeylock"rea"/a>(>clakeylockot;/span>


299"2137t;/span>


120 120      a>    ot;/span>


117(" >120 117      coist/a>  gistlr_l="k_ode=clsavectrac= claa>gistlr_l="k_ode=ce_baclass=/a>  (


1359/a> 
(  clal="k_ode=c_keylock_a>(


;/span>


((  


136(  


117                      unsignednlong/a>(" >120 129 
120  >" >120 132      a>    e0ot;/span>


117(" >120 129"/a>  366/a>    e0ot;/span>


301"2138 >129 
);t;/span>


);t;/span>


);t;/span>


117ot;/span>


);t;/span>


117133,/a>(intry"/a>(>(  


117  ;t;/span>


302"213a hre37  133>;t;/span>


,/a>(intry"/a>(>intry"/a>(>;t;/span>


>e= b>e=trace:\n"ryment">>;t;/span>


117>e=nonlircular cladumn_a>>e=lock6>ot;/span>


>;t;/span>


117claf="kern_printcheldcode=3e_baclass=/a>  


129"/ oist/a>  133>e= b>e=trace:\n"ryment">>;t;/span>


303"2114" >117>e=nonlircular cladumn_a>>e=lock6>ot;/span>


1359/a> 
  ot;/span>


1287/a>{span class="cmment"> **
133 *
1339/a>sspan class="* We maintain che ernendency maps and validate che f="k3ng attemps:omment"> *
304"2139" >1339/a>sspan class="*omment"> **
(  (
120                in=/a>((adlock,/in=/a>((
136(  (
117                in=/a>(" >120 129 
 & 0a hrcur_lassonlircular clacur_laslockot;/span>


129"/unsignednin=/a>((


305"2114" >117(


117(clau6L2114"a>(clachain_keylockot;/span>


117  " >120 117      coist/a>  


117  claunlikelylock6!coist/a>  >" >120 1196/a>      a>    e0ot;/span>


306"213a hre371287/a>{span class="cmment"> **
1287/a>{span class="""""""""* L="kern should run with IRQs disabled, otherwise we couldmment"> **
1287/a>{span class="""""""""* get an/ n=errupt which would wan=/to take f="ks, which wouldmment"> **
1287/a>{span class="""""""""* end up in f="kern and have you got a head-ache already?mment"> **
134 **
117  claDEBUG_LOCKS_WARN_ONlock6!coist/a>  >>" >120 120      a>    e0ot;/span>


117(intry"/a>(>clakeylock"r= &a>(" >120 129"/a>  366/cass=/a>  


307"2126t;/span>


" >120 120      coist/a>  (intry"/a>(>(


 **
134 **
133 **
120  claunlikelylock6!coist/a>  >e" >129 
132      coist/a>  (gistlr_l="k_ode=clsavectrac= claa>gistlr_l="k_ode=ce_baclass=/a>  (ot;/span>


1196/a>        <6!coist/a>  t;/span>


129"/a>  366/a>  366/a>    e0ot;/span>


308"2120" >129"/" >1359/a> 
(>ot;/span>


120    >e" >129 
136  133< [%p] %s"ryment">,/a>(intry"/a>(>clakeylock,(intry"/a>(>;t;/span>


117        <6coist/a>  intry"/a>(>t;/span>


117      ////////aoist/a>  133,/a>(intry"/a>(>;t;/span>


120      coist/a>  133);t;/span>


132      coist/a>  >e=nonlircular cladumn_a>>e=lock6>ot;/span>


1196/" >1359/a> 
309"213a hre371287/a>{span class="cmment"> **
1287/a>{span class="""""""""* Add che f="k/to the fist of cur_lasly held f="ks.omment"> *
1287/a>{span class="""""""""* (we dont increasc che ernth just yet, up until cheomment"> *
1287/a>{span class="""""""""* ernendency shecks are done)omment"> *
134 **
 & 0a hrcur_nonlircular clasur_"sre>intry"/a>(>


1201287/a>{span class="cmment"> **
1287/a>{span class="""""""""* R128out of a>>134 **
133 **
129"// <6coist/a>  claDEBUG_LOCKS_WARN_ONlock6 oist/a>   & 0a hrMAX_LOCK_DEPTHnonlircular claMAX_LOCK_DEPTHlock>>" >120 117      a>    e0ot;/span>


 & 0a hrcde=clsavectrac= claode=ce_ba_-/a>(


117(e" >129 
117      coist/a>   & 0a hrcur_nonlircular clasur_"sre>intry"/a>(>claheldcode=3e_ba +/a>(


120        <6a>(intry"/a>(> & 0a hrcde=c_idxlsavectrac= claode=c_idxlock"&&/a>(e" >129 
132      a>        <6a>(intry"/a>(>" >120 1196/a>      " >117      coist/a>  intry"/a>(>


129"/a>  366/////////elset;/span>


311"2115" >117      a>  36      coist/a>  intry"/a>(>


120              a>    e1ot;/span>


1361359/a> 
1171359/a> 
 & 0a hrcur_nonlircular clasur_"sre>intry"/a>(>claheldcode=3e_ba +/a>(


1171287/a>{span class="cmment"> **
133gistlrednit and sheckednit weren't nomment"> **
1339/a>sspan class="""""""""* NULL like.. I bet chis mushroom I ate was good!mment"> **
312"2139" >1339/a>sspan class="""""""""*omment"> **
120      a>    e0ot;/span>


(>(117intry"/a>(>(


(>>ncelsavectrac= claina>>ncee_ba_rea>(


(>(>


117intry"/a>(>(>


117intry"/a>(>adlock_rea>(adlsavectrac= claa>adlockot;/span>


129"/ oist/a>  intry"/a>(>(>


313"2114" >117intry"/a>(>  


(>(>


(>


117intry"/a>(>(>1_code=nonlircular claode=a>>1_code=lock6>ot;/span>


117      > **
1196/a>      a>    e0ot;/span>


314"213a hre371287/a>{span class="c marknit as used:"*omment"> **
> **
120      a>    e0ot;/span>


1171287/a>{span class="cmment"> **
133 *
133 *
1287/a>{span class="""""""""* at every strn so chat we c128get che cur_las hash easilyloment"> *
133 *
1339/a>sspan class="""""""""* results.omment"> *
315"2139" >1339/a>sspan class="""""""""*omment"> *
1287/a>{span class="""""""""* The 'key ID' is what is che most compact key value/to driveomment"> *
1287/a>{span class="""""""""* che hash, not 7/a>{>intrkey.omment"> *
1287/a>{span class="""""""""*omment"> **
117 & 0a hrcde=clsavectrac= claode=ce_ba_-/a>(


1171287/a>{span class="cmment"> **
133>134 *
1287/a>{span class="""""""""*omment"> **
117(claDEBUG_LOCKS_WARN_ONlock6 oist/a>   & 0a hrMAX_LOCKDEP_KEYSnonlircular claMAX_LOCKDEP_KEYSlock>> **
129"/a>  366/a>    e0ot;/span>


316"2126t;/span>


 & 0a hrcur_nonlircular clasur_"sre>intry"/a>(>clacur__chain_keye_baot;/span>


120  e" >129 
1361287/a>{span class="cmment"> **
134 **
133 **
120        <6a>(claDEBUG_LOCKS_WARN_ONlock6 oist/a>  clachain_keylock"!= 0>> **
132      a>      a>    e0ot;/span>


1196/a>       oist/a>  


129"/" >1359/a> 
317"2126t;/span>


(>claprev_chain_keylock"rey"/a>(>clachain_keylockot;/span>


120    >e" >129 
136  clachain_keylock"re0ot;/span>


117       oist/a>  


129"/" >1359/a> 
 & 0a hriterate_chain_key+code=croot>claiterate_chain_keylock6 oist/a>  clachain_keylock, a>(ot;/span>


117(  (> **
129"/a>  366/a>    ey"/a>(>  ot;/span>


318"2126t;/span>


clachain_keylock>> **
120      a>    e0ot;/span>


117intry"/a>(>clacur__chain_keye_ba"rey"/a>(>clachain_keylockot;/span>


intry"/a>(>


clache"k_ohain_keylock6 oist/a>  ot;/span>


117(claunlikelylock6!coist/a>  >" >120 129"/a>  366/a>    e0ot;/span>


319"213a#endift;/span>


intry"/a>(> & 0a hrMAX_LOCK_DEPTHnonlircular claMAX_LOCK_DEPTHlock>>e" >129 
120      coist/a>  ot;/span>


136  133);t;/span>


117       oist/a>  133);t;/span>


117      coist/a>  >e=nonlircular cladumn_a>>e=lock6>ot;/span>


120      a>    e0ot;/span>


1321359/a> 
129"// <6coist/a>  claunlikelylock6 oist/a>  intry"/a>(>  >" >120 117      coist/a>   & 0a hrcur_nonlircular clasur_"sre>intry"/a>(>


1359/a> 
(>nce_buglock6kwari=/a>(  (  129 
132      a>         unsignednlong/a>(" >120 129 
129"// <6!coist/a>  >" >120 321"2115" >117      a>    e0ot;/span>


120 120      a>    e0ot;/span>


117133);t;/span>


);t;/span>


);t;/span>


117ot;/span>


117133);t;/span>


129"/ oist/a>  133leasc f="k ("ryment">,t;/span>


322"2115" >117      coist/a>  intry"/a>(>  );t;/span>


);t;/span>


117133);t;/span>


);t;/span>


ot;/span>


117133>e= b>e=trace:\n"ryment">);t;/span>


129"/ oist/a>  >e=nonlircular cladumn_a>>e=lock6>ot;/span>


323"2126t;/span>


1359/a> 
134 **
133 **
133 **
(  129 
1196/a>              unsignednlong/a>(" >120 129 
324"213a hre37(claunlikelylock6!coist/a>  >" >120 120134 **
1287/a>{span class="""""""""* L="kern should run with IRQs disabled, resursion, head-ache, etc..omment"> *
134 **
117  claDEBUG_LOCKS_WARN_ONlock6!coist/a>  >>" >120 120      a>    e0ot;/span>


117(intry"/a>(>" >120 129"/a>  366/a>    ey"/a>(>nce_buglock6lass=/a>    ot;/span>


325"2126t;/span>


1359/a> 
  " >120 129 
120  intry"/a>(>>ncelsavectrac= claina>>ncee_ba_rrea>(" >120 132      a>    e1ot;/span>


129"// <6coist/a>  intry"/a>(>e" >129 
326"2115" >117      kwari=/a>(  (intry"/a>(>


120        <6!coist/a>  t;/span>


136  (  ot;/span>


117      c >134 **
133 **
1287/a>{span class="""""""""""""""""* to test    *
133 *
1339/a>sspan class="""""""""""""""""* hold3ng it either, so report failure.omment"> *
327"2139" >1339/a>sspan class="""""""""""""""""*omment"> **
120              a>    e0ot;/span>


117        >134 **
133 **
133intrreferences21ent"> **
1287/a>{span class="""""""""""""""""* and cry to make sense of it.omment"> *
133 **
129"/a>  366/  <6 oist/a>  claDEBUG_LOCKS_WARN_ONlock6!coist/a>  intry"/a>(>>" >120 328"2115" >117      a>  36    e0ot;/span>


120        <6a>(intry"/a>(> & 0a hrcde=clsavectrac= claode=clock_-/a>(" >120 136    e1ot;/span>


1171359/a> 
1359/a> 
329"213aa>((    129 
claf="k_ode=c_keylock_class=/a>  clakeylock, unsignednint/ oist/a>  129 
120       unsignednlong/a>(" >120 129 
117(   & 0a hrcur_lassonlircular clacur_las"sreot;/span>


117(    120(  


132  


117  


117 & 0a hrcur_nonlircular clasur_"sre>intry"/a>(>


 **
1287/a>{span class="""""""""* This function is about (re)setting/che 7/a>{ of a held f="k,mment"> **
1287/a>{span class="""""""""* yet we're not actually hold3ng any f="ks. Naughty user!mment"> **
134 **
117  claDEBUG_LOCKS_WARN_ONlock6!coist/a>  >" >120 120      a>    e0ot;/span>


117 & 0a hrNULLnonlircular claNULLlockot;/span>


129"/for 6 oist/a>   & 0a hrernthnonlircular claernthlock-1r coist/a>    e" >129 
331"2115" >117      lass=/a>   & 0a hrcur_nonlircular clasur_"sre>intry"/a>(>claheldcode=3e_ba +/a>(


 **
1287/a>{span class="""""""""""""""""* We must not cro>{  nto another **
1287/a>{span class="""""""""""""""""*omment"> **
117        <6 oist/a>    (>  intry"/a>(>" >120 117              breakot;/span>


120        <6a>(  (>" >120 132      a>      goto a>(


1196/a>       oist/a>   & 0a hrhode=nonlircular clahode=lockot;/span>


129"/" >1359/a> 
332"2115" >117    ey"/a>(>nce_buglock6lass=/a>    ot;/span>


      clakeylock, 0>ot;/span>


117(>    ot;/span>


(> & 0a hrcde=clsavectrac= claode=clock_-/a>(


117intry"/a>(> & 0a hrilsavectrac= clailockot;/span>


117intry"/a>(>clacur__chain_keye_ba"rey"/a>(>intry"/a>(>claprev_chain_keylockot;/span>


333"2115" >117      e" >129 
 & 0a hrcur_nonlircular clasur_"sre>intry"/a>(>claheldcode=3e_ba +/a>(


120        <6!coist/a>    intry"/a>(>>ncelsavectrac= claina>>ncee_ba, >129 
136    >intry"/a>(>  intry"/a>(>129 
117       hre37  intry"/a>(>intry"/a>(>intry"/a>(>129 
117               hre37  intry"/a>(>intry"/a>(>129 
120       hre37  intry"/a>(>>" >120 132      a>      a>    e0ot;/span>


1196/" >1359/a> 
334"213a hre37134 **
1287/a>{span class="""""""""* I tooknit apart and putnit b>e= together **
1287/a>{span class="""""""""* chese ' >1re' parts.. where shall I put chem.omment"> *
1287/a>{span class="""""""""*omment"> **
117(claDEBUG_LOCKS_WARN_ONlock6 oist/a>  intry"/a>(>  >" >120 117      a>    e0ot;/span>


1359/a> 
1339/a>sspan class="cmment"> **
335"2139" >1339/a>sspan class="* Remove **
1287/a>{span class="* potlasially non-nested (out of order) manner. This is amment"> **
1287/a>{span class="* a>latively sare operation, as all the unf="k APIs defaultomment"> *
1287/a>{span class="* to nested ma h (which uses f="k_a>leasc()):mment"> **
134 **
(>leasc_non_nestedlock6kwari=/a>(  129 
132              kwari=/a>(  (" >120 129 
129"/kwari=/a>(    336"2115" >117  


1361339/a>sspan class="cmment"> **
134 **
133 **
133 **
117 & 0a hrcur_nonlircular clasur_"sre>intry"/a>(>


1361339/a>sspan class="cmment"> **
1339/a>sspan class="""""""""* So we're all set to a>leasc chis f="k.. wait what f="k? We don'tmment"> **
337"2139" >1339/a>sspan class="""""""""* own any f="ks, you've **
1287/a>{span class="""""""""*omment"> **
120  claDEBUG_LOCKS_WARN_ONlock6!coist/a>  >" >120 136    e0ot;/span>


 & 0a hrNULLnonlircular claNULLlockot;/span>


 & 0a hrernthnonlircular claernthlock-1r coist/a>    e" >129 
132       ass=/a>   & 0a hrcur_nonlircular clasur_"sre>intry"/a>(>claheldcode=3e_ba +/a>(


1196/a>        >1339/a>sspan class="cmment"> **
1339/a>sspan class="""""""""""""""""* We must not cro>{  nto another **
338"2139" >1339/a>sspan class="""""""""""""""""*omment"> **
  (>  intry"/a>(>" >120 120              breakot;/span>


136(  (>" >120 117       hre37(


117      coist/a>   & 0a hrhode=nonlircular clahode=lockot;/span>


1359/a> 
132    ey"/a>(>nce_buglock6lass=/a>    ot;/span>


339"213a hre37(intry"/a>(>>ncelsavectrac= claina>>ncee_ba_rrea>(" >120 (>  ot;/span>


(>e" >129 
117       >(intry"/a>(>


117        <6a>(intry"/a>(>e" >129 
120       hre371339/a>sspan class="cmment"> **
1287/a>{span class="""""""""""""""""""""""""* We had, and after **
133 **
1339/a>sspan class="""""""""""""""""""""""""* valid. We're done!mment"> **
1339/a>sspan class="""""""""""""""""""""""""*omment"> **
120      " >1359/a> 
1359/a> 
1171339/a>sspan class="cmment"> **
133 *
1287/a>{span class="""""""""* Now>e=, and add b>e= the otheromment"> *
133 **
1339/a>sspan class="""""""""*omment"> **
341"2126t;/span>


intry"/a>(> & 0a hrilsavectrac= clailockot;/span>


intry"/a>(>clacur__chain_keye_ba"rey"/a>(>intry"/a>(>claprev_chain_keylockot;/span>


117        e" >129 
117       ass=/a>   & 0a hrcur_nonlircular clasur_"sre>intry"/a>(>claheldcode=3e_ba +/a>(


120        <6!coist/a>    intry"/a>(>>ncelsavectrac= claina>>ncee_ba, >129 
132      a>      lass=/a>  (>  intry"/a>(>129 
1196/a>      " >117       ass=/a>  intry"/a>(>intry"/a>(>intry"/a>(>129 
129"/a>      " >117       ass=/a>  intry"/a>(>intry"/a>(>129 
342"2115" >117      a>  36       ass=/a>  intry"/a>(>>" >120 1359/a> 
1171339/a>sspan class="cmment"> **
133 **
133 *
1287/a>{span class="""""""""*omment"> **
117(claDEBUG_LOCKS_WARN_ONlock6 oist/a>  intry"/a>(>  >" >120 129"/a>  366/a>    e0ot;/span>


343"2115" >117    e1ot;/span>


1359/a> 
1287/a>{span class="cmment"> **
134 **
133 **
133 **
1287/a>{span class="* perfecsly. (i.e. che 7ur_las top of che f="k-a>>e= is/unf="ked)21ent"> **
133 **
(>leasc_nestedlock6kwari=/a>(  129 
344"2115" >117      a>  36     kwari=/a>(  (" >120 129 
1171339/a>sspan class="cmment"> **
133 **
1287/a>{span class="""""""""*omment"> **
117 & 0a hrcur_nonlircular clasur_"sre>intry"/a>(>


117 & 0a hrcur_nonlircular clasur_"sre>intry"/a>(>claheldcode=3e_ba +/a>(


345"2126t;/span>


 **
1287/a>{span class="""""""""* Is the unf="k non-nested:mment"> **
1287/a>{span class="""""""""*omment"> **
117(intry"/a>(>>ncelsavectrac= claina>>ncee_ba_!= coist/a>    intry"/a>(> **
117      a>    ey"/a>(>leasc_non_nestedlock6lass=/a>    ot;/span>


117intry"/a>(>


1361339/a>sspan class="cmment"> **
1339/a>sspan class="""""""""* No more f="ks, but somehow **
346"2139" >1339/a>sspan class="""""""""*omment"> **
(intry"/a>(>claprev_chain_keylock_!= 0)>>" >120 120      a>    e0ot;/span>


117intry"/a>(>clacur__chain_keye_ba"rey"/a>(>intry"/a>(>claprev_chain_keylockot;/span>


117leasc_holdti="nonlircular claf="k_a>leasc_holdti="lock6 oist/a>  ot;/span>


117intry"/a>(>claprev_chain_keylock_=e0ot;/span>


347"2114" >117intry"/a>(>


(>


(>


117    e1ot;/span>


1359/a> 
1287/a>{span class="cmment"> **
133 **
1339/a>sspan class="* called on/mutexcunf="k()1enincunf="k*() (or on/a failed21ent"> **
348"2139" >1339/a>sspan class="*/mutexcf="k_interruptiblc()). This is done/for unf="ks chat nest21ent"> **
1287/a>{span class="* perfecsly. (i.e. che 7ur_las top of che f="k-a>>e= is/unf="ked)21ent"> **
1287/a>{span class="*omment"> **
(>leasclock6kwari=/a>(    (" >120 129 
 & 0a hrcur_lassonlircular clasur_laslockot;/span>


117    >" >120 129"/a>  366/a>    ot;/span>


349"2126t;/span>


129 
120        <6!coist/a>  leasc_nestedlock6lass=/a>    >" >120 136    ot;/span>


117129 
117        <6!coist/a>  leasc_non_nestedlock6lass=/a>    >" >120 120       hre37    ot;/span>


1321359/a> 
117clache"kcchain_keylock6lass=/a>  ot;/span>


1359/a> 
(>(  " >120 129 
117(   & 0a hrcur_lassonlircular clasur_laslockot;/span>


117  


132      intry"/a>(>  e" >129 
1196/a>      kwari=/a>(   & 0a hrcur_nonlircular clasur_"sre>intry"/a>(>claheldcode=3e_ba +/a>(


351"2115" >117        <6a>(  (>" >120 1359/a> 
117    e0ot;/span>


1359/a> 
1287/a>{span class="cmment"> **
133 **
1339/a>sspan class="*omment"> **
352"2115a>>134clache"kcflagslock6unsignednlong/a>(claflagslock>" >120 129 
  e&&/ oist/a>    e&&/\ >129 
1 oist/a>    " >120 117  claerbugcode=3lock>" >120 117      a>    ot;/span>


117(>clairqs_disabledcflagslock6lass=/a>  claflagslock>>e" >129 
1196/a>        <6a>(claDEBUG_LOCKS_WARN_ONlock6 oist/a>  intry"/a>(>>e" >129 
129"/a>  366/////////y"/a>(>1339/a>sspkwaing">"possiblc a>ason: unannowated irqs-off.\n"mment">>ot;/span>


353"2115" >117      " >1359/a> 
129 
120        <6a>(claDEBUG_LOCKS_WARN_ONlock6!coist/a>  intry"/a>(>>e" >129 
136(>1339/a>sspkwaing">"possiblc a>ason: unannowated irqs-on.\n"mment">>ot;/span>


117      " >1359/a> 
1171359/a> 
1321287/a>{span class="cmment"> **
133e= softirq/kwate in e.g.omment"> *
1339/a>sspan class="""""""""* hardirq *
354"2139" >1339/a>sspan class="""""""""* che"k    **
1287/a>{span class="""""""""*omment"> **
129 
136(>e" >129 
117       hre371287/a>{span class="c like **
117      ////////y"/a>(>claDEBUG_LOCKS_WARN_ONlock6 oist/a>  intry"/a>(>ot;/span>


120      } elsee" >129 
132      a>      l >1287/a>{span class="c lie= the above,/does **
1196/a>      " >117(claDEBUG_LOCKS_WARN_ONlock6!coist/a>  intry"/a>(>ot;/span>


129"/a>  366/" >1359/a> 
35502115" >1171359/a> 
120 136(>ee_evlas3+code=croot>clapr nt_irqtr>ee_evlas3lock6 oist/a>  ot;/span>


1359/a> 
    


1196/a>      " >1kwari=/a>(  clakeylock,/unsignednint/ oist/a>  


129"/a>  366/////unsignednlong/a>(" >120 356"2139" >129 
(>>" >120 117      a>    ot;/span>


117  claflagslock>ot;/span>


117intry"/a>(>


117clache"kcflagslock6lass=/a>  claflagslock>ot;/span>


117(  clakeylock,/ oist/a>  >" >120 357"2115" >117             nt  a hrshe"kcchain_key+code=croot>clache"kcchain_keylock6lass=/a>  ot;/span>


(>


  claflagslock>ot;/span>


1359/a> 
(>claEXPORT_SYMBOL_GPLlock6lass=/a>  133 **
1287/a>{span class="* We are **
133 **
1339/a>sspan class="*omment"> **
358"2139void/       nt  a hrf="k_acquir"lsavectrac= claf="k_acquir"lock6kwari=/a>(    





120                kwari=/a>(  (" >120 129 
117(claflagslockot;/span>


(>>" >120 132      a>    ot;/span>


117  claflagslock>ot;/span>


359"2114" >117clache"kcflagslock6lass=/a>  claflagslock>ot;/span>


(>


136  ee_f="k_acquir"lsavectrac= clatr>ee_f="k_acquir"lock6lass=/a>        (ot;/span>


117(      


117       >117(clairqs_disabledcflagslock6lass=/a>  claflagslock>,/ oist/a>  (ot;/span>


117intry"/a>(>


117  claflagslock>ot;/span>


1359/a> 
(>claEXPORT_SYMBOL_GPLlock6lass=/a>  ot;/span>





leascsonlircular claf="k_a>leasclock6kwari=/a>(    


120                unsignednlong/a>(" >120 129 
117(claflagslockot;/span>


(>>" >120 132      a>    ot;/span>


117  claflagslock>ot;/span>


361"2114" >117clache"kcflagslock6lass=/a>  claflagslock>ot;/span>


(>


leascsonlircular clatr>ee_f="k_a>leasclock6lass=/a>  ot;/span>


136  leasclock6lass=/a>  ot;/span>


117(intry"/a>(>


117  claflagslock>ot;/span>


1359/a> 
(>claEXPORT_SYMBOL_GPLlock6lass=/a>  leascsonlircular claf="k_a>leasclock>ot;/span>


(>(  " >120 362"2139" >129 
117(claunlikelylock6 oist/a>  intry"/a>(>>" >120 117      a>    e1o l >1287/a>{span class="c avoid/falseenegative/f="kern_a>{ertcheld()"*omment"> **
117  claflagslock>ot;/span>


117clache"kcflagslock6lass=/a>  claflagslock>ot;/span>


363"2114" >117intry"/a>(>


(>


136    claflagslock>ot;/span>


117    ey"/a>(>


1359/a> 
(>claEXPORT_SYMBOL_GPLlock6lass=/a>      " >120 364"2139" >129 
(>  


1359/a> 
" >120 129 
117intry"/a>(>


1359/a> 
365"2115a>>134129 
(  129 
120                 unsignednlong/a>(" >120 129 
117  >" >120 117      a>    e0ot;/span>


120 132      a>    e0ot;/span>


1171339/a>sspkwaing">"\n"mment">>ot;/span>


366"2114" >1171339/a>sspkwaing">"=================================\n"mment">>ot;/span>


"[ BUG: bad contention detected! ]\n"mment">>ot;/span>


136  1339/a>sspkwaing">"---------------------------------\n"mment">>ot;/span>


117(1339/a>sspkwaing">"%s/%d is/trying/to contend/f="k ("mment">, >129 
117      lass=/a>  intry"/a>(>  ot;/span>


117  ot;/span>


1171339/a>sspkwaing">") at:\n"mment">>ot;/span>


117  ot;/span>


1171339/a>sspkwaing">"but there are>ot;/span>


367"2114" >1171339/a>sspkwaing">"\nother>ot;/span>


claf="kern_pr nt_heldcode=3lock6 oist/a>  


136  1339/a>sspkwaing">"\na>>e= b>e=tr>ee:\n"mment">>ot;/span>


117(>e=sonlircular claeump_a>>e=lock6>ot;/span>


117    e0ot;/span>


1359/a> 
368"2139 oist/a>  (  (" >120 129 
120(   & 0a hrcur_lassonlircular clasur_laslockot;/span>


120(    


117(>1clock_class=/a>  >1clsavectrac= claa>>1clockot;/span>


117  


117 & 0a hrcur_nonlircular clasur_"sre>intry"/a>(>


117133 **
369"2139" >1339/a>sspan class="""""""""* Whee, **
1287/a>{span class="""""""""* actually trying/to acquir" anyching/much at all..omment"> *
1287/a>{span class="""""""""*omment"> **
136(claDEBUG_LOCKS_WARN_ONlock6!coist/a>  >" >120 117117    ot;/span>


117 & 0a hrNULL+code=croot>claNULLlockot;/span>


132        e" >129 
1196/a>      lass=/a>   & 0a hrcur_nonlircular clasur_"sre>intry"/a>(>claheldcode=3e_ba +/a>(


129"/a>  366/  >133 **
1339/a>sspan class="""""""""""""""""* We/must **
1287/a>{span class="""""""""""""""""*omment"> **
120        <6a>(  intry"/a>(> & 0a hrhode=nonlircular clahode=lock>intry"/a>(>" >120 136


117117(  (>" >120 117      ////////goto a>(


120             nt  a hrprev_hode=nonlircular claprev_hode=lock"result/a> & 0a hrhode=nonlircular clahode=lockot;/span>


1321359/a> 
117      ot;/span>


117    ot;/span>


371"2126t;/span>


(>>ncelsavectrac= claina>>ncelock"!result/a> & 0a hrode=nonlircular claode=lock>t;/span>


136    ot;/span>


117intry"/a>(>>mplsavectrac= clawaittime_a>>mplock"result/a> & 0a hrode=3tat_odde=nonlircular claode=3tat_odde=lock6>ot;/span>


117 & 0a hrode=_poiassonlircular claode=_poiaslock6lass=/a>    intry"/a>(>  ot;/span>


117 & 0a hrode=_poiassonlircular claode=_poiaslock6lass=/a>    intry"/a>(>129 
129"/a>  366/////////>120             nt  a hrode=nonlircular claode=lock>intry"/a>(>ot;/span>


372"2126t;/span>


>1clsavectrac= claget_f="k_a>>1clock6lass=/a>    ot;/span>


  t;/span>


136(>>1clsavectrac= claa>>1clock>intry"/a>(>(>


117(  t;/span>


117      y"/a>(>>1clsavectrac= claa>>1clock>intry"/a>(>(>


(> & 0a hrsmn_processor_idnonlircular clasmn_processor_idlock6>>t;/span>


132      y"/a>(>>1clsavectrac= claa>>1clock>intry"/a>(>(>  intry"/a>(>


117>1clsavectrac= claput_f="k_a>>1clock6lass=/a>  >1clsavectrac= claa>>1clock>ot;/span>


1359/a> 
373"2126t;/span>


(  (" >120 129 
117(   & 0a hrcur_lassonlircular clasur_laslockot;/span>


117(    


117(>1clsavectrac= claf="k_ode=c_a>>1clock_class=/a>  >1clsavectrac= claa>>1clockot;/span>


132  


117  


117    


374"2126t;/span>


 & 0a hrcur_nonlircular clasur_"sre>intry"/a>(>


 **
1287/a>{span class="""""""""* Yay, **
1287/a>{span class="""""""""* acquir", how the he"k/did chat happen?mment"> **
1287/a>{span class="""""""""*omment"> **
120 132      a>    ot;/span>


117 & 0a hrNULL+code=croot>claNULLlockot;/span>


375"2114" >117        e" >129 
 & 0a hrcur_nonlircular clasur_"sre>intry"/a>(>claheldcode=3e_ba +/a>(


120        >133 **
1287/a>{span class="""""""""""""""""* We/must **
1287/a>{span class="""""""""""""""""*omment"> **
117        <6a>(  intry"/a>(> & 0a hrhode=nonlircular clahode=lock>intry"/a>(>" >120 120              breakot;/span>


132        <6a>(  (>" >120 1196/a>              goto a>(


129"/a>  366/       nt  a hrprev_hode=nonlircular claprev_hode=lock"result/a> & 0a hrhode=nonlircular clahode=lockot;/span>


376"2114" >1171359/a> 
    ot;/span>


117 & 0a hrhode=nonlircular clahode=lock>intry"/a>(>>ncelsavectrac= claina>>ncelock"!result/a> & 0a hrode=nonlircular claode=lock>t;/span>


120      a>    ot;/span>


117 & 0a hrsmn_processor_idnonlircular clasmn_processor_idlock6>ot;/span>


117 & 0a hrhode=nonlircular clahode=lock>intry"/a>(>>mplsavectrac= clawaittime_a>>mplock>e" >129 
377"2114" >117117 & 0a hrode=3tat_odde=nonlircular claode=3tat_odde=lock6>ot;/span>


intry"/a>(>>mplsavectrac= clawaittime_a>>mplockot;/span>


120             nt  a hrhode=nonlircular clahode=lock>intry"/a>(>>mplsavectrac= claholdtime_a>>mp"sre"re       nt  a hrnow id="L313ar clanowlockot;/span>


1361359/a> 
117ee_f="k_acquir"dnonlircular clatr>ee_f="k_acquir"dlock6lass=/a>    ot;/span>


117>1clsavectrac= claa>>1clock =e oist/a>  >1clock6lass=/a>    ot;/span>


117 & 0a hrwaittimelsavectrac= clawaittime"sre>e" >129 
129"/a>  366/  <6sult/a> & 0a hrhode=nonlircular clahode=lock>intry"/a>(>t;/span>


378"2114" >117117117>1clsavectrac= claa>>1clock>intry"/a>(>  ot;/span>


120                     nt  a hrode=_time_inclsavectrac= claf="k_time_inclock6&       nt  a hra>>1clsavectrac= claa>>1clock>intry"/a>(>  ot;/span>


1361359/a> 
117(intry"/a>(> & 0a hrcpusonlircular claspulock>t;/span>


117      y"/a>(>>1clsavectrac= claa>>1clock>intry"/a>(>(>  intry"/a>(>


117>1clsavectrac= claput_f="k_a>>1clock6lass=/a>  >1clsavectrac= claa>>1clock>ot;/span>


117intry"/a>(> & 0a hrcpusonlircular claspulockot;/span>


117intry"/a>(> & 0a hriplsavectrac= claip2120ot;/span>


379"2139" >1359/a> 
(  (" >120 129 
117(claflagslockot;/span>


>1lsavectrac= claf="k_a>>1lock>>" >120 132      a>    ot;/span>


117 & 0a hrunlikely+code=croot>claunlikelylock6 oist/a>  intry"/a>(>>" >120 117117    ot;/span>


  claflagslock>ot;/span>


136  clache"kcflagslock6lass=/a>  claflagslock>ot;/span>


117  intry"/a>(>


117ee_f="k_contendedlsavectrac= clatr>ee_f="k_contendedlock6lass=/a>    ot;/span>


117    ot;/span>


117intry"/a>(>


117  claflagslock>ot;/span>


1359/a> 
381"2139 oist/a>  claEXPORT_SYMBOL_GPLlock6lass=/a>  (  (" >120 129 
117(claflagslockot;/span>


>1lsavectrac= claf="k_a>>1lock>>" >120 132      a>    ot;/span>


117 & 0a hrunlikely+code=croot>claunlikelylock6 oist/a>  intry"/a>(>>" >120 382"2114" >117117    ot;/span>


  claflagslock>ot;/span>


136  clache"kcflagslock6lass=/a>  claflagslock>ot;/span>


117  intry"/a>(>


117    ot;/span>


117intry"/a>(>


117  claflagslock>ot;/span>


1359/a> 
ot;/span>


383"2126#endift;/span>


1287/a>{span class="cmment"> **
1287/a>{span class="* Usednby the testsuite, sanitize the validator a>>1emment"> **
1287/a>{span class="* after a simul>1ed failure:mment"> **
1287/a>{span class="*omment"> **
" >120 129 
117(claflagslockot;/span>


384"2114" >117  


  claflagslock>ot;/span>


136  intry"/a>(>clasur__chain_keylock =e0ot;/span>


117  intry"/a>(>


117intry"/a>(>


117  intry"/a>(>claheldcode=3e_ba, 0,/lass=/a>  claMAX_LOCK_DEPTHe_ba*sizeof6kwari=/a>(ot;/span>


117clanr_hardirq_chain3lock =e0ot;/span>


117clanr_softirq_chain3lock =e0ot;/span>


117clanr_process_chain3lock =e0ot;/span>


385"2114" >117claerbugcode=3lock =e1ot;/span>


      " >120 120       oist/a>    (ot;/span>


136    claflagslock>ot;/span>


1359/a> 
120 129 
1196/ nt/ oist/a>  


386"2114" >1171287/a>{span class="cmment"> **
1287/a>{span class="""""""""* Remove all ernendencies chis f="k **
1287/a>{span class="""""""""*/ nvolvednin:mment"> **
1287/a>{span class="""""""""*omment"> **
      e" >129 
117        <6a>((>   & 0a hrcde=clsavectrac= claode=clock>" >120 120      " >136  (>  clalasrylock>ot;/span>


1321359/a> 
1171287/a>{span class="cmment"> **
1287/a>{span class="""""""""*/Unhash the 7/a>{ and remove it from the all_f="k_ode=ces list:mment"> **
387"2139" >1339/a>sspan class="""""""""*omment"> **
(>clahash_lasrylock>ot;/span>


(>ot;/span>


117  intry"/a>(>clakeylock =ey"/a>(>claNULLlockot;/span>


1359/a> 
(>      >rssonlircular claa>>rse_ba, unsignednlong/a>(" >120 129 
129"/a>    /a>(  >rssonlircular claa>>rse_ba"&&/ oist/a>    >rssonlircular claa>>rse_ba"+/a>(


388"2139" >1359/a> 
120 129 
117(    


117(  


117(claflagslockot;/span>


132  


1196/ nt/ oist/a>  389"2114" >117  claflagslock>ot;/span>


1361287/a>{span class="cmment"> **
1287/a>{span class="""""""""* Unhash all ode=ces chat were 7re>1ed by this module:mment"> **
1287/a>{span class="""""""""*omment"> **
      e" >129 
132      lass=/a>   & 0a hrcvecthash_tabl"nonlircular clacvecthash_tabl"2120"+/a>(


1196/a>        <6a>(clafist_lmptylock6lass=/a>  >" >120 117


117117(        clahash_lasrylock>e" >129 
(>clakeylock,_lass=/a>  >rssonlircular claa>>rse_ba, a>(>" >120 120              " >117( & 0a hrcde=clsavectrac= claode=clock>ot;/span>


136(  intry"/a>(>120 117              " >117( & 0a hrcde=clsavectrac= claode=clock>ot;/span>


117      " >1359/a> 
1171359/a> 
117 & 0a hrl="k"dnonlircular claf="kedlock>" >120 129"/a>  366/       nt  a hrgraphcunode=nonlircular clagraphcunode=lock6>ot;/span>


391"2114" >117  claflagslock>ot;/span>


1359/a> 
  " >120 129 
117(    


117(  


132(claflagslockot;/span>


1196/ nt/ oist/a>  (


117  392"2126t;/span>


  claflagslock>ot;/span>


1361287/a>{span class="cmment"> **
1287/a>{span class="""""""""* Remove all ode=ces chis f="k **
1287/a>{span class="""""""""*omment"> **
      e" >129 
132      l >1287/a>{span class="cmment"> **
1287/a>{span class="""""""""""""""""* If the 7/a>{ exists **
1287/a>{span class="""""""""""""""""*omment"> **
393"2114" >117117( & 0a hrodok_up_f="k_ode=clsavectrac= claf=ok_up_f="k_ode=clock6lass=/a>  (ot;/span>


120                     nt  a hrzap_ode=clsavectrac= clazap_ode=clock6sult/a> & 0a hrcde=clsavectrac= claode=clock>ot;/span>


1361359/a> 
1361287/a>{span class="cmment"> **
1287/a>{span class="""""""""* Drbug che"k:/ n the end all mapped ode=ces shouldmment"> **
1287/a>{span class="""""""""* be gone.mment"> **
1287/a>{span class="""""""""*omment"> **
117  ot;/span>


117        e" >129 
394"2114" >117117( & 0a hrcvecthash_tabl"nonlircular clacvecthash_tabl"2120"+/a>(


120 120              continueot;/span>


136(        clahash_lasrylock>e" >129 
117               nt/ oist/a>  clamatchlock"re0r >129 
120      " >136        t;/span>


132      " >136(clamatchlock"|result/a> & 0a hrcde=clsavectrac= claode=clock =result/a> & 0a hrode=nonlircular claode=lock>intry"/a>(>(>129 
117 & 0a hrunlikely+code=croot>claunlikelylock6 oist/a>  clamatchlock)>e" >129 
395"2114" >117117117 & 0a hrerbugcode=3_off_graphcunode=nonlircular claerbugcode=3_off_graphcunode=lock6>>e" >129 
1361287/a>{span class="cmment"> **
1287/a>{span class="""""""""""""""""""""""""""""""""""""""""* We all just rese1 everyching, how did it match?mment"> **
1287/a>{span class="""""""""""""""""""""""""""""""""""""""""*omment"> **
117              " >117 & 0a hrWARN_ONnonlircular claWARN_ONlock61>ot;/span>


117                      " >1359/a> 
120      " >136 & 0a hrout_restor"lsavectrac= claout_restor"lockot;/span>


132      " >1361359/a> 
1196/a>      " >1359/a> 
1171359/a> 
396"2114" >117 & 0a hrl="k"dnonlircular claf="kedlock>" >120  & 0a hrout_restor"lsavectrac= claout_restor"lock:t;/span>


  claflagslock>ot;/span>


1359/a> 
" >120 129 
117  


397"2126t;/span>


 **
1287/a>{span class="""""""""*/Some architectures have their own a>>rs_
 **
1287/a>{span class="""""""""*  **
1287/a>{span class="""""""""* eall f="kern_ini1() from the a>>rs_
 **
1287/a>{span class="""""""""* and we/want/to/ini1ialize the hashes only once:mment"> **
1287/a>{span class="""""""""*omment"> **
117 & 0a hrl="kern_ini1ializednonlircular claf="kern_ini1ializedlock>" >120 1196/a>      a>    ot;/span>


398"2114" >117        t;/span>


(ot;/span>


117        " >120 117      lass=/a>    (ot;/span>


117


1359/a> 
120 399"2114" >129 
"L="k>ot;/span>


136  1287/a>{spstr ng">"... MAX_LOCKDEP_SUBCLASSES:  %lu\n"mment">,/lass=/a>  ot;/span>


"... MAX_LOCK_DEPTH:      %lu\n"mment">,/lass=/a>  claMAX_LOCK_DEPTHe_ba>ot;/span>


1171287/a>{spstr ng">"... MAX_LOCKDEP_KEYS:a>      %lu\n"mment">,/lass=/a>  ot;/span>


1171287/a>{spstr ng">"... CLASSHASH_SIZE:      %lu\n"mment">,/lass=/a>  ot;/span>


1171287/a>{spstr ng">"... MAX_LOCKDEP_ENTRIES:a>   %lu\n"mment">,/lass=/a>  ot;/span>


1171287/a>{spstr ng">"... MAX_LOCKDEP_CHAINS:a>    %lu\n"mment">,/lass=/a>  ot;/span>


1171287/a>{spstr ng">"... CHAINHASH_SIZE:      %lu\n"mment">,/lass=/a>  ot;/span>


;/span>


" memory usednby l="k,t;/span>


120      (sizeof6kwari=/a>(  


136(  


117      sizeof6kwari=/a>(  


117      sizeof6kwari=/a>(  


120      sizeof6kwari=/a>(  


1196/a>      + sizeof6kwari=/a>(" >120 401"2116" >1196/a>      ) / 1024t;/span>


136  1287/a>{spstr ng">" per task-kwari=/memory footpr nt: %lu bytes\n"mment">,t;/span>


117      sizeof6kwari=/a>(  claMAX_LOCK_DEPTHe_ba>ot;/span>


117 & 0a hrl="kern_ini1_erro_nonlircular clal="kern_ini1_erro_lock) " >129 
1196/a>       oist/a>  1287/a>{spstr ng">"WARNING: f="kern/ini1 erro_! f="k-%s was acquir"d"mment"> >129 
1171287/a>{spstr ng">"before f="kern_ini1\n"mment">,/lass=/a>  


402"2116" >1196/a>       oist/a>  1287/a>{spstr ng">"Call sta"k>ot;/span>


ot;/span>


1201359/a> 
1359/a> 
 & 0a hrpr nt_freedcode=_bugnonlircular clapr nt_freedcode=_buglock6kwari=/a>(    


1196/a>           const  (  


129 
403"2114" >117  >" >120 117 & 0a hrerbugcode=3_sillassonlircular claerbugcode=3_sillaslock)t;/span>


136    ot;/span>


1171287/a>{spstr ng">"\n"mment">>ot;/span>


1171287/a>{spstr ng">"=========================\n"mment">>ot;/span>


1171287/a>{spstr ng">"[ BUG: held l="k>ot;/span>


117ot;/span>


1171287/a>{spstr ng">"-------------------------\n"mment">>ot;/span>


404"2114" >1171287/a>{spstr ng">"%s/%d is,t;/span>


(>(  ((ot;/span>


136    


1171287/a>{spstr ng">"\nsta"k>ot;/span>


117ot;/span>


1359/a> 
    (


405"2114" >117  (


129 
( & 0a hrmem_fromnonlircular clamem_fromlock || >129 
136(( & 0a hrode=_fromnonlircular claode=_fromlockot;/span>


1359/a> 
1287/a>{span class="cmment"> **
1287/a>{span class="* Callednwhen 
 **
1287/a>{span class="* is **
1287/a>{span class="* any held l="k< n the memory range of"<fromintr/to/<tointr:mment"> **
406"2114" >1287/a>{span class="*omment"> **
  (


129 
136(   & 0a hrcur_lassonlircular clacur_laslockot;/span>


117(  


117(claflagslockot;/span>


117  


117 & 0a hrunlikely+code=croot>claunlikelylock6!lass=/a>  


117    ot;/span>


407"2137t;/span>


  claflagslock>ot;/span>


    intry"/a>(>  e" >129 
136( & 0a hrcur_nonlircular claour_lock>intry"/a>(>(


117        <6sult/a> & 0a hrnot_in_rangesonlircular clanot_in_rangelock6a>(((intry"/a>(>


120      " >136117  intry"/a>(>


132      " >136


129"/a>  366/       nt  a hrpr nt_freedcode=_bugnonlircular clapr nt_freedcode=_buglock6lass=/a>  ((((ot;/span>


408"2120" >129"/a>  366/breakot;/span>


1359/a> 
  claflagslock>ot;/span>


1359/a> 
  claEXPORT_SYMBOL_GPLlock6lass=/a>  ot;/span>


  


129 
117  >" >120 117    ot;/span>


409"2114" >117 & 0a hrerbugcode=3_sillassonlircular claerbugcode=3_sillaslock)t;/span>


136  1287/a>{spstr ng">"\n"mment">>ot;/span>


"=====================================\n"mment">>ot;/span>


1171287/a>{spstr ng">"[ BUG: l="k>ot;/span>


117ot;/span>


1171287/a>{spstr ng">"-------------------------------------\n"mment">>ot;/span>


1171287/a>{spstr ng">"%s/%d is,t;/span>


129"/a>  366/       nt  a hrour_nonlircular claour_lock>intry"/a>(>(  ot;/span>


117  


"\nsta"k>ot;/span>


136  ot;/span>


1359/a> 
(  


129 
117 & 0a hrunlikely+code=croot>claunlikelylock6lass=/a>  intry"/a>(>>" >120 129"/a>  366/       nt  a hrpr nt_heldcode=c_bugnonlircular clapr nt_heldcode=c_buglock6lass=/a>  


411"2116" >1359/a> 
120 129 
117(    


117  129 
117  


117 & 0a hrunlikely+code=croot>claunlikelylock6!lass=/a>  129 
117  1287/a>{spstr ng">"INFO: f="kern/is     ed off.\n"mment">>ot;/span>


412"2116" >1196/a>      a>    ot;/span>


1359/a> 
"\nShow ng/all f="ks>ot;/span>


1361287/a>{span class="cmment"> **
1287/a>{span class="""""""""* Here we try/to/get the taskfist_l="k **
1287/a>{span class="""""""""*    **
1287/a>{span class="""""""""* try ng). This is  o enabl" a erbug pr ntou1 even if amment"> **
1287/a>{span class="""""""""* taskfist_l="k-hold ng/task deadf="ks **
1287/a>{span class="""""""""*omment"> **
413"2114 oist/a>   ry+code=croot>claa> ry2114:t;/span>


129 
120        <6sult/a> & 0a hrcouassonlircular clacouaslock"rre10>" >120 136  1287/a>{spstr ng">"hm, taskfist_l="k ry ng... "mment">>ot;/span>


117        <6sult/a> & 0a hrcouassonlircular clacouaslock)e" >129 
117       hre37  


120      " >136  1287/a>{spstr ng">" #%d"mment">,/10-sult/a> & 0a hrcouassonlircular clacouaslock)ot;/span>


132      " >136(clamdelaylock6200>ot;/span>


1196/a>            //goto/ault/a> & 0a hra> ry+code=croot>claa> ry2114ot;/span>


1171359/a> 
414"2116" >1196/a>       oist/a>  1287/a>{spstr ng">" ignor ng/it.\n"mment">>ot;/span>


129 
136 & 0a hrcouassonlircular clacouaslock"!re10>" >120 117               oist/a>    1287/a>{spstr ng">" l="ked/it.\n"mment">>ot;/span>


1171359/a> 
117    129 
1196/a>        >1287/a>{span class="cmment"> **
1287/a>{span class="""""""""""""""""* It's **
415"2114" >1287/a>{span class="""""""""""""""""*    **
1287/a>{span class="""""""""""""""""* task):mment"> **
1287/a>{span class="""""""""""""""""*omment"> **
136 & 0a hrpnonlircular claplock>intry"/a>(>>1"lsavectrac= claa>>1"lock"rrey"/a>(>    " >120 117              continueot;/span>


117        <6sult/a> & 0a hrpnonlircular claplock>intry"/a>(>" >120 120      " >136    


132        <6!lass=/a>  " >120 1196/a>            //  <6sult/a> & 0a hrread_ ryode=nonlircular claread_ ryode=lock6&       nt  a hrtaskfist_l="knonlircular clataskfist_l="klock))" >120 117136  


416"2116" >1196/}/ oist/a>      


"\n"mment">>ot;/span>


136  1287/a>{spstr ng">"=============================================\n\n"mment">>ot;/span>


117 & 0a hrunlde=nonlircular claunode=lock>" >120 120      sult/a> & 0a hrread_unlde=nonlircular claread_unlde=lock6&       nt  a hrtaskfist_l="knonlircular clataskfist_l="klock)ot;/span>


1359/a> 
417"2114" >1287/a>{span class="cmment"> **
1287/a>{span class="* Caspaul: only use chis function    **
1287/a>{span class="* the task cannot run  n parallel!loent"> **
1287/a>{span class="*omment"> **
  


129 
120 & 0a hrunlikely+code=croot>claunlikelylock6!lass=/a>  129 
132       oist/a>  1287/a>{spstr ng">"INFO: f="kern/is     ed off.\n"mment">>ot;/span>


1196/a>      a>    ot;/span>


129"/" >1359/a> 
418"2114" >117  


1359/a> 
" >120 129 
120(   & 0a hrcur_lassonlircular clacur_laslockot;/span>


117 & 0a hrunlikely+code=croot>claunlikelylock6lass=/a>  intry"/a>(>)e" >129 
117  >" >120 419"2114" >117    ot;/span>


"\n"mment">>ot;/span>


120       oist/a>  1287/a>{spstr ng">"================================================\n"mment">>ot;/span>


136(1287/a>{spstr ng">"[ BUG: l="k     ng/to/user  >1ce! ]\n"mment">>ot;/span>


117      a>(ot;/span>


117      a>(1287/a>{spstr ng">"------------------------------------------------\n"mment">>ot;/span>


120      sult/a> & 0a hrpr nt=nonlircular clapr nt=lock6  >1287/a>{spstr ng">"%s/%d is,t;/span>


132      " >136      sult/a> & 0a hrour_nonlircular claour_lock>intry"/a>(>(intry"/a>(>


1196/a>       oist/a>    


129"/" >1359/a> 
1359/a> 
      


129 
117(   & 0a hrcur_lassonlircular clacur_laslockot;/span>


117  >" >120 1196/a>      a>    ot;/span>


 **
421"2114" >1171287/a>{span class="c Note:/the follow ng/c128be executed concur_lasly, so8be caspaul."*omment"> **
"\n"mment">>ot;/span>


"===============================\n"mment">>ot;/span>


136  1287/a>{spstr ng">"[ INFO: suspiciouc RCU/usage. ]\n"mment">>ot;/span>


117(ot;/span>


1171287/a>{spstr ng">"-------------------------------\n"mment">>ot;/span>


1171287/a>{spstr ng">"%s:%d %s!\n"mment">,/a>(    


1171287/a>{spstr ng">"\nother info chas might help/us erbug chis:\n\n"mment">>ot;/span>


1171287/a>{spstr ng">"\n%srcu_scheduler_active"re%d, erbugcode=3"re%d\n"mment">,t;/span>


117  t;/span>


422"2116" >1196/a>              ?"  >1287/a>{spstr ng">"RCU/used/illegally from off0" c CPU!\n"mment">t;/span>


t;/span>


120      a>              ?"  >1287/a>{spstr ng">"RCU/used/illegally from idl" CPU!\n"mment">t;/span>


1361287/a>{spstr ng">""mment">,t;/span>


117     sult/a> & 0a hrrcu_scheduler_activelsavectrac= clarcu_scheduler_activelock, lass=/a>  


1171287/a>{span class="cmment">t;/span>


1287/a>{span class="""""""""* If a CPU is< n the RCU-free w ndow< n idl" (ie:/ n the sectionmment">t;/span>


1287/a>{span class="""""""""* between acu_idl"_laser() and acu_idl"_lxit(), then RCUmment">t;/span>


1287/a>{span class="""""""""* considlrs chas CPU to8be  n 128"extended/quiesclas a>>1"",mment"> **
423"2114" >1287/a>{span class="""""""""* which means chas RCU/will be completely ignor ng/chas CPU.mment"> **
1287/a>{span class="""""""""* Therefore, acu_read_f="k() and friends have"absolutely nomment"> **
1287/a>{span class="""""""""* effect on a CPU run  ng/ n thas a>>1". In other words, even ifmment"> **
1287/a>{span class="""""""""* such an RCU-idl" CPU has callednacu_read_f="k(), RCU/might wellmment"> **
1287/a>{span class="""""""""* delete data/kwari=ures ou1 from under/it.  RCU/really has nomment"> **
1287/a>{span class="""""""""* choice here: we need to8keep an RCU-free w ndow< n idl" wheremment"> **
1287/a>{span class="""""""""* the CPU may possibly laser< nto lowt;/span>


1287/a>{span class="""""""""* notice 128extended/quiesclas a>>1" to8other CPUs thas a>>rted a grac"mment">t;/span>


1287/a>{span class="""""""""* period. Otherwise we would delay any grac" periodt;/span>


1287/a>{span class="""""""""*  n the idl" task.mment"> **
424"2114" >1287/a>{span class="""""""""*mment"> **
1287/a>{span class="""""""""* So compla n bitserly if someo c does callnacu_read_f="k(),mment"> **
1287/a>{span class="""""""""* acu_read_f="k_bh() and so on from extended/quiesclas a>>1"s.mment"> **
1287/a>{span class="""""""""*omment"> **
117 & 0a hrrcu_is_cpu_idl"lsavectrac= clarcu_is_cpu_idl"lock6>>t;/span>


117      a>(1287/a>{spstr ng">"RCU/used/illegally from extended/quiesclas a>>1"!\n"mment">)ot;/span>


117  


1171287/a>{spstr ng">"\nsta"k>ot;/span>


117ot;/span>


425"2116" >1359/a> 
claEXPORT_SYMBOL_GPLlock6lass=/a>  ot;/span>





"/div>


The or ginal LXR softwasp by the ;/span>

http://sourceforge.net/projects/lxr">LXR an cunitylock, chis expericlasal vlrsion by ;/span>

mailto:lxr@2" ux.nolafxr@2" ux.nolock.
"/div>

fxr.2" ux.no k ndly hosted by ;/span>

http://www.redpill-2" pro.nolaRedpill L" pro ASlock, providlr of L" ux consult ng/and operations services sinc" 1995.
"/div>