linux/lib/spinlock_debug.c
<<
>>
Prefs
   1/*
   2 * Copyright 2005, Red Hat, Inc., Ingo Molnar
   3 * Released under the General Public License (GPL).
   4 *
   5 * This file contains the spinlock/rwlock implementations for
   6 * DEBUG_SPINLOCK.
   7 */
   8
   9#include <linux/spinlock.h>
  10#include <linux/nmi.h>
  11#include <linux/interrupt.h>
  12#include <linux/debug_locks.h>
  13#include <linux/delay.h>
  14#include <linux/export.h>
  15
  16void __raw_spin_lock_init(raw_spinlock_t *lock, const char *name,
  17                          struct lock_class_key *key)
  18{
  19#ifdef CONFIG_DEBUG_LOCK_ALLOC
  20        /*
  21         * Make sure we are not reinitializing a held lock:
  22         */
  23        debug_check_no_locks_freed((void *)lock, sizeof(*lock));
  24        lockdep_init_map(&lock->dep_map, name, key, 0);
  25#endif
  26        lock->raw_lock = (arch_spinlock_t)__ARCH_SPIN_LOCK_UNLOCKED;
  27        lock->magic = SPINLOCK_MAGIC;
  28        lock->owner = SPINLOCK_OWNER_INIT;
  29        lock->owner_cpu = -1;
  30}
  31
  32EXPORT_SYMBOL(__raw_spin_lock_init);
  33
  34void __rwlock_init(rwlock_t *lock, const char *name,
  35                   struct lock_class_key *key)
  36{
  37#ifdef CONFIG_DEBUG_LOCK_ALLOC
  38        /*
  39         * Make sure we are not reinitializing a held lock:
  40         */
  41        debug_check_no_locks_freed((void *)lock, sizeof(*lock));
  42        lockdep_init_map(&lock->dep_map, name, key, 0);
  43#endif
  44        lock->raw_lock = (arch_rwlock_t) __ARCH_RW_LOCK_UNLOCKED;
  45        lock->magic = RWLOCK_MAGIC;
  46        lock->owner = SPINLOCK_OWNER_INIT;
  47        lock->owner_cpu = -1;
  48}
  49
  50EXPORT_SYMBOL(__rwlock_init);
  51
  52static void spin_dump(raw_spinlock_t *lock, const char *msg)
  53{
  54        struct task_struct *owner = NULL;
  55
  46        lock->owner = ss="sref">lock, const char *SPINLOCK_OWNER_IN5T5
task_st.c#L46" id="L46" class="line" name="L46">  46        owner = owner_cpu  52static vKERN_EMERG46" id="L46" clKERN_EMERG 39">"/a>:"line" na %s on CPU#%d, %s/%d\n"="L40" ="sref">lock, const char *  5859 clasmp_processor_iine" name="L41"> clasmp_processor_ii52"> )="sref">lock, const char * 649curr_de"line" name="L46">  46cock claap" class="sref">e="L5pid_n        52static vcurr_debe" name="L41">curr_de"linlass="sref">lock, sizeof(*__rwlock_ini6)6
  52static vKERN_EMERG46" id="L46" clKERN_EMERG 39">"an cla %ps, .code=a %08x, .code=: %s/%d, "="L40" s="sref">lock, sizeof(* 651 39">".=lock" cl: %d\n"="L40" ="sref">lock, const char *m6g63  45        lock, const char *  6364  46cock cla :b/ef="lib/spin4"> 39">"spinnone.6/liquot;="L40" ="sref">lock, const char *NU6L6
  52static va href="+code=task_struct" cl) :b-1="sref">lock, const char *  47        lock, sizeof(*SPINLOCK_OWNER_IN6T6
 )ss="sref">lock, sizeof(*owner_cpu  686
 749  52static void spin_dump(raw_spinlock_t *lock, const char *<7_init" c7ass="sref">__rwlock_ini7)71 751  41 )ss="sref">lock, const char *<7 href="+7ode=msg" class="sref">m7g73lock, sizeof(*  7374NU7L7
  52static v="+code=raw_spinlock_t" class/spinlock_debug*lock, sizeof(* * DEBUG_SPINLOCKT77owner_cpulock#ON+code=owner" class=_/a>#ON52">  52static vconine" name="L41">coni class/spinlock_debug.c#L45" id="L45" class="linss/spinlock_debug*,   52static vconine" name="L41">coni cla)lock = (  52static v.c#L45" id="L45" class="linss/spinlock_debug*  787
 849__rwlock_ini8)81  52static void spin_dump( 851m8g8
#ON52">  52static v.c#L45" id="L45" class="line" name="L45">  45        lock->mass/spinlock_debug.c#L45" id="L45" class="linss/ef="lib/spin4"> 39">"bad code=iquot;="L40" sss="sref">lock, sizeof(*  838
#ON52">  52static v.c#L45" id="L45" class="line" name="L45">  45loccurr_debe" name="L41">curr_de"linss/spinlock_debug.c#L45" id="L45" class="linss/ef="lib/spin4"> 39">"recursioniquot;="L40" sss="sref">lock, sizeof(*NU8L8
#ON52">  52static v.c#L45" id="L45" class="line" name="L45">  45loc clasmp_processor_iine" name="L41"> clasmp_processor_ii52"> )="sref">lock, const char * 39">" cl recursioniquot;="L40" sss="sref">lock, sizeof(* * DEBUG_SPINLOC8T87< * = -18an>
  8889  52static void spin_dump( 949__rwlock_ini9)9
  47        loc clasmp_processor_iine" name="L41"> clasmp_processor_ii52"> )ss="sref">lock, sizeof(* 951  45loccurr_debe" name="L41">curr_de"linss="sref">lock, sizeof(*m9g93  9394NU9L95  52static void spin_dump( * DEBUG_SPINLOC9T9
#ON52">  52static v.c#L45" id="L45" class="line" name="L45">  45        lock->mass/spinlock_debug.c#L45" id="L45" class="linss/ef="lib/spin4"> 39">"bad code=iquot;="L40" sss="sref">lock, sizeof(*9 9 = -19
#ON52"> !/spinlock_debug">EXPORT_is_SYMBline" name="L41">">EXPORT_is_SYMBli52">  52static v.c#L45" id="L45" class="lin)ss/spinlock_debug.c#L45" id="L45" class="linss/ef="lib/spin4"> 39">"already un.c#Lediquot;="L40" sss="sref">lock, sizeof(*89
#ON52">  52static v.c#L45" id="L45" class="line" name="L45">  45loccurr_debe" name="L41">curr_de"linss/spinlock_debug.c#L45" id="L45" class="linss/ef="lib/spin4"> 39">"wrong tructiquot;="L40" sss="sref">lock, sizeof(*linux/spinlock.h#ON52">  52static v.c#L45" id="L45" class="line" name="L45">  45loc clasmp_processor_iine" name="L41"> clasmp_processor_ii52"> )="sref">lock, const char *linux/nmi.h 39">"wrong CPUiquot;="L40" sss="sref">lock, sizeof(*linux/interrupt.h  45lock->owner = linux/debug_locks.h  47        lock->linux/delay.hlinux/export.h  069  52static void spin_dump(nam079ke089 =   1099lock_ops_pck"jiffame="L35">  35ops_pck"jiffaspin_dclass="sref">locHZme="L35">  35 = linux/spinlock.h&g114lock->linux/nmi.hlinux/interrupt.h&g11
linux/debug_locks.h&g113 = asc0pb/spinlock_debugke=ref="+code=lok> = aspinr/spinlock_debugloopsode=raw_spinlock_ops" clpb/spinlock_debugke=ref="+code=lok> = ++) ref="lib/spinlock_debug.c#L36" id1cy.h" classs="fref">linux/delay.h&g114      lockdep_init_mapa>        lock, const char *<1t.h" classs="fref">linux/export.h&g11
lock, sizeof(*   15 1sss="sref">lock, sizeof(*nammekeey  401="L18" claass="line" name="L18">  118CONFIG_DEBUG_LOCK_AL1LOC/*1  52static v="+code=raw_spinlock_t" class/ef="lib/spin4"> 39">"n clup suspectediquot;="L40" sss="sref">lock, sizeof(*         */1 ggck"all" cl_backtracme=ref="+code=lo"> ggck"all" cl_backtracm52"> )ss="sref">lock, sizeof(*lock1)1;
key, 012
  25#end1f
SPINLOCK_MAG1IC
SPINLOCK_OWNER_IN1ITEXPORT_SYMB45" id="L45" cl.of">EXPORT_SYMB52">  52static void spin_dump(owner_cpu = -130  130  52static v="+code=raw_spinlock_t" clasef="include/linux/debug_locks.h" cl not rei1lass="line" name="L31"> 1 31,  !/spinlock_debugass="sref_try="+code=raw_spinlocass="sref_try="+c52">      lockdep_init_mapa>        linux/debug_locks.h  52static v="+code=raw_spinlock_t" clasef="include/linux/debug_locks.h" clf="+code1lass="line" name="L33"> 1 33  52static v="+code=raw_spinlock_t" clasef="include/linux/debug_locks.h" clf="+code1de=name" class="sref">na1mek1ey  136EXPORT_try="+code=raw_spinloc.of">EXPORT_try="+c52">  52static void spin_dump(CONFIG_DEBUG_LOCK_AL1LOC        1/*1locass="sref_try="+code=raw_spinlocass="sref_try="+c52">      lockdep_init_mapa>        
         */1
lock1)142  52static v="+code=raw_spinlock_t" clasef="include/linux/debug_locks.h" cef="+code1=key" class="sref">key, 01;
  43#end1f
  38__ARCH_RW_LOCK_UNLOCK1ED
         * Make sure we ar1CK_MAGIC"1 class="sref">RWLOCK_MAG1IC
  401T" class=1"sref">SPINLOCK_OWNER_IN1IT#ON52"> !/spinlock_debug"e+code=spin_dump" et" clss/spinlock_debug.c#L45" id="L45" class="linss/ef="lib/spin4"> 39">"try="+c fail claon UPiquot;="L40" sss="sref">lock, sizeof(*owner_cpu = -1;
  148 1 49__rwlock_ini1t1;
 1 51
EXPORT_un.c#L45" id="L45" cl.of">EXPORT_un.c#L52">  52static void spin_dump(m1sg  153  52static v="+code=raw_spinlock_t" clasef="include/linux/debug_locks.h" chref="+co1de=NULL" class="sref">NU1LL      lockdep_init_mapa>         1 55SPINLOCK_OWNER_IN15Towner_cpu  52static voef="+code=__rwlock_init" class="sref">__rwlock_init(rwlock_t *  158 1649  41 )ss="sref">lock, const char *<16_init" c16ass="sref">__rwlock_ini1616
lock, sizeof(* 1651lock, sizeof(*m16g  52static vKERN_EMERG46" id="L46" clKERN_EMERG 39">"/a>:"e="L5">%s on CPU#%d, %s/%d, %p\n"="L40" ="sref">lock, const char *  163 clasmp_processor_iine" name="L41"> clasmp_processor_ii52"> )=c       struct curr_de"line" name="L46">  46cock claa"sref">lock, const char *NU16L  52static vcurr_debe" name="L41">curr_de"linlss/spinlock_debug.c#L45" id="L45" class="lin)de <  155 )ss="sref">lock, sizeof(*SPINLOCK_OWNER_IN16Towner_cpu
  168locgic" cl/a>#ON+code=owner" clgic" cl/a>#ON52">  52static vconine" name="L41">coni class/spinlock_debug.c#L45" id="L45" class="linss/spinlock_debug*,   52static vconine" name="L41">coni cla)lock = (  52static v.c#L45" id="L45" class="linss/spinlock_debug* 1749__rwlock_ini1717
up - maybe ch"> cinltoo?e*d="L40" class="line" name="L40">  4017="L51" c17ass="line" name="L51"> 1751  52static voef="+code=__rwlock_init" class="sref">__rwlock_init(m17g  173 = NU17Llock_ops_pck"jiffame="L35">  35ops_pck"jiffaspin_dclass="sref">locHZme="L35">  35 = lock-> * DEBUG_SPINLOC1KTowner_cpu  178 = asc0pb/spinlock_debugke=ref="+code=lok> = aspinr/spinlock_debugloopsode=raw_spinlock_ops" clpb/spinlock_debugke=ref="+code=lok> = ++) ref="lib/spinlock_debug.c#L36" id18="L49" c18ass="line" name="L49"> 1849      lockdep_init_mapa>        __rwlock_ini1818
lock, sizeof(* 1851 1sss="sref">lock, sizeof(*m18g  183  4018ref="+co18e=NULL" class="sref">NU18L * DEBUG_SPINLOC18T  52static vKERN_EMERG46" id="L46" clKERN_EMERG 39">"/a>:"eead-"L5">n clup on CPU#%d, "="L40" s="sref">lock, sizeof(*1< 1* = -188 39">"s#37;s/%d, %p\n"="L40" ="sref">lock, const char *  188 clasmp_processor_ii52"> )=c       struct curr_de"line" name="L46">  46cock claa"sref">lock, const char * 1949curr_de"line" name="L46">  46pii class/spinlock_debug.c#L45" id="L45" class="linsss="sref">lock, sizeof(*__rwlock_ini1919
 )ss="sref">lock, sizeof(* 1951m19g  193NU19L * DEBUG_SPINLOC19TEXread_SYMB45" id="L45" cl.of">EXread_SYMB52">  52static voef="+code=__rwlock_init" class="sref">__rwlock_init(19 19 = -19
8#ON+code=owner" clgic" cl/a>#ON52">  52static vlockdep_init_map" class="sref">lockdep_init_mapa>        lock-> 39">"bad code=iquot;="L40" sss="sref">lock, sizeof(*linux/spinlock.h<2a49      lockdep_init_mapa>        linux/nmi.h<2019linux/interrupt.h<2029lock, sizeof(*linux/debug_locks.h<2039EXread_try="+code=raw_spinloc.of">EXread_try="+c52">  52static voef="+code=__rwlock_init" class="sref">__rwlock_init(linux/delay.h<2049linux/export.h<2059locass="read_try="+code=raw_spinlocass="read_try="+c52">      lockdep_init_mapa>        na2079k2089  38  2099         * Make sure we ar2h" class=2"fref">linux/spinlock.h<2/a>&g21
  402/nmi.h" c2aass="fref">linux/nmi.h<2a19#ON+code=owner" clgic" cl/a>#ON52"> !/spinlock_debug"e+code=spin_dump" et" clss/spinlock_debug.c#L45" id="L45" class="linss/ef="lib/spin4"> 39">"try="+c fail claon UPiquot;="L40" sss="sref">lock, sizeof(*linux/interrupt.h<2/a>&g2r (;;)ref="lib/spinlock_debug.c#L25" id="L252L18" cl20inss/ef="lib/spin4"> 39">"try=136" id1cy.h" classs="fref">linux/dele" name="L8">89
&g114&g11
EXread_SYMB45" id="L45" cl.of"f">EXPORT_un.c#L52">  52l.of"f">EXP="+code=__rwlock_init" class="sref">__rwlock_init(lins="sref">2amme#ON52">  52static vlockdep_init_map" class="sref">lockdep_init_mapa>        lock-> 39">"bad code=iquot;="L40" sss="sref">lock, sizeof(*linux/me="L18">2 118#ON+code=owne          EXP="+cokdep_init_map" class="sref">lockdep_init_mapa>        2comment">2*1up - mb1  5"L5">up - mb1__rwlock_init(lin         2/1lo2k1)1;
#ON52">  52static vlockdep_init_map" class="sref">lockdep_init_mapa>        lock-> 39">"bad code=iquot;="L40" sss="sref">lock, sizeof(*linux/sref">key2/1a>, 012
#ON52">  52static vlockdep_init_map" class="sref">lockdep_init_mapa>        loccurr_debe" name="L41">curr_de"linss/spinlock_debug.c#L45" id="L45" class="linss/ef="lib/spin4"> 39">"recursioniquot;="L40" sss="sref">lock, sizeof(*  25<2a1>#end1f
#ON52">  52static vlockdep_init_map" class="sref">lockdep_init_mapa>        loc clasmp_processor_iine" name="L41"> clasmp_processor_ii52"> )="sref">lock, const char * 39">"recursioniquot;="L40" s0" sss="sref">lock, sizeof(* * DEB2PINLOCK_M2G1IC
 = -130up - mL41PORT_SYMBOaftre52">  52"L5">up - mL41PO="+code=__rwlock_init" class="sref">__rwlock_init(linme="L30">2 130  45loc clasmp_processor_iine" name="L41"> clasmp_processor_ii52"> )ss="sref">lock, sizeof(*  47        loccurr_dbe" name="L41">curr_de"linss="sref">lock, sizeof(*2a1meu#L41PORT_un.c#L52">  52"L5">u#L41PO="+code=__rwlock_init" class="sref">__rwlock_init(linmOCK_UNLO2 136#ON52">  52static vlockdep_init_map" class="sref">lockdep_init_mapa>        lock-> 39">"bad code=iquot;="L40" sss="sref">lock, sizeof(*linux/comment">2*1#ON+code=owner" clgic" cl/a>#ON52">  52static vlockdep_init_map" class="sref">lockdep_init_mapa>        loccurr_debe" name="L41">curr_de"linss/spinlock_debug.c#L45" id="L45" class="linss/ef="lib/spin4"> 39">"wrong tructiquot;="L40" sss="sref">lock, sizeof(*linux2 held loc2:1
#ON52">  52static vlockdep_init_map" class="sref">lockdep_init_mapa>        loc clasmp_processor_iine" name="L41"> clasmp_processor_ii52"> )="sref">lock, const char *2         2/1
 39">"wrong CPUiquot;="L40" sss="sref">lock, sizeof(*linux/2"sref">lo2k1)142  45lock->owner = linux/de2sref">key2/1a>, 01;
  47        lock->li243">  43<2a1>#end1f

RWLOCK_M2G1IC
  402/nmi.h" c2aass="fref">lCK_OWNER_2N1ITup - maybe lass="sref">locef"L5">up - maybe ="+code=__rwlock_init" class="sref">__rwlock_init(linwner_cpu<2a1> = -1;
2 148lock_ops_pck"jiffame="L35">  35ops_pck"jiffaspin_dclass="sref">locHZme="L35">  35 = lock-> * D2ame="L51"2 1 51
linux/debss="sref"2m1sg2 153 = aspinr/spinlock_debugloopsode=raw_spinlock_ops" clpb/spinlock_debugke=ref="+code=lok> = ++) ref="lib/spinlock_debug.c#L36" id18="L49" c18ass="line" 2s="sref">2U1LLuss="read_try="+c52">      <"L5">uss="rea="+cokdep_init_map" class="sref">lockdep_init_mapa>        liname="L55"2 1 55, sizeof(* 1sss="sref">lock, sizeof(*2 158  4018ref="+co18e=NULL" cla2ame="L49"2 164916
lock * D2ame="L51"2 1651l2ck  52static vKERN_EMERG46" id="L46" clKERN_EMERG 39">"/a>:"eead-"L5">n clup on CPU"L5">7;d, "="L40" s="sref">lock, sizeof(*1< ggck"ck_debug./spinloian clup susp37;d, %p\n"="L40" ="sref">lock, const char *2 163 clasmp_processor_ii52"> )=c       struct curr_de"line" name="L46">  46cock claa"sref">lock, const char *2U16L  46pii class/spinlock_debug.c#L45" id="L45" class="linsss="sref">lock, sizeof(*2ame="L15"2  155 )ss="sref">lock, sizeof(*
2 168loc.c#L48" id1a href="+ccode=key" cl2ame="L49"2 174917
EXPORT_un.c#L45" id="L45""L5">up - +c52"> )ss="sref="L45""L5">up - ="+code=__rwlock_init" class="sref">__rwlock_init(linss="sref"2m17g2 173up - mb1  5"L5">up - mb1lock, sizeof(*2s="sref">2U17Lu"read_try="+c52">      <"L5">u"rea="+cokdep_init_map" class="sref">lockdep_init_mapa>        2sme="L15"2f1755up - mL41PORT_SYMBOaftre52">  52"L5">up - mL41PO="+code=__rwlock_ini"linsss="sref">lock, sizeof(*2sK_OWNER_2C1KT2wner_cpu<2a17 = -1782 178uss="read_try="+c52">  raw_spi"L5">uss="rea="+code=__rwlock_init" class="sref">__rwlock_init(liname="L49"2 184918
locass="read_try="+code=raw_spi"L5">uss="read_try="+c52">      <"L5">uss="rea="+cokdep_init_map" class="sref">lockdep_init_mapa>        2ame="L51"2 1851linux/debss="sref"2m18g2 183up - mL41PORT_SYMBOaftre52">  52"L5">up - mL41PO="+code=__rwlock_ini"linsss="sref">lock, sizeof(*2s="sref">2U18L  38         * Make sure we ar2h" class=2"fref">linux/"comment"2 1* = -188  402/nmi.h" c2aass="fref">lme="L48">2 188#ON+code=owner" clgic" cl/a>#ON52">  52static vlockdep_=spin_dump" et" clss/spinlock_debug.c#L45" id="L45" class="linss/ef="lib/spin4"> 39">"try="+c fail claon UPiquot;="L40" sss="sref">lock, sizeof(*linux/iame="L49"2 194919
89
2ss="sref"2m19g2se="L53">2 193EXPORT_un.c#L45" id="L45""L5">uf">EXPORT_un.c#L52">  52"L5">u#L41PO="+code=__rwlock_init" class="sref">__rwlock_init(lins="sref">2U19Lu#L41PORT_un.c#L52">  52"L5">u#L41PO="+code=__rwlock_ini"linsss="sref">lock, sizeof(*2BUG_SPINL2C19T#ON+code=owner"    <"L5">us="sref_un.c#L52">      u#L41PO="+cokdep_init_map" class="sref">lockdep_init_mapa>        2"comment"2 19 = -19
8&qclassexperi claal vesref""by a>#ON+codm" sto:lxO@a hux.nonitxO@a hux.no39">.
txO.a hux.no kindly hosted"by a>#ON+codhttp://www.redpill-a hpro.noniRedpill L hpro AS39">&qprovider of L hux ult cl and operatef"s services sinceck_d5.