Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\debug\debug_core.c Create Date:2022-07-28 11:37:55
Last Modify:2020-03-17 19:04:10 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:kgdb_cpu_enter

Proto:static int kgdb_cpu_enter(struct kgdb_state *ks, struct pt_regs *regs, int exception_state)

Type:int

Parameter:

TypeParameterName
struct kgdb_state *ks
struct pt_regs *regs
intexception_state
560  sstep_tries = 100
563  trace_on = 0
564  online_cpus = num_online_cpus()
567  enter_kgdb++
568  exception_state |= exception_state
570  If exception_state == Waiting to become a master kgdb cpu Then atomic_inc( & We use NR_CPUs not PERCPU, in case kgdb is used to debug early* bootup code (which might not have percpu set up yet):)
572  Else atomic_inc( & slaves_in_kgdb)
575  If disable_hw_break Then disable_hw_break(regs)
578  acquirelock :
583  local_irq_save(flags)
585  cpu = cpu
586  debuggerinfo = regs
587  task = current process
588  ret_state = 0
589  irq_depth = hardirq_count() >> HARDIRQ_SHIFT
592  smp_mb()
594  If Guard for recursive entry == 1 Then
595  If Define the various spin_lock methods. Note we define these* regardless of whether CONFIG_SMP or CONFIG_PREEMPTION are set. The* various methods are defined as nops in the case they are not* required.( & dbg_master_lock) Then atomic_xchg( & The CPU# of the active CPU, or -1 if none:, cpu)
597  Go to cpu_master_loop
604  When 1 cycle
605  cpu_loop :
608  Go to cpu_master_loop
615  dump_stack()
618  If Not raw_spin_is_locked( & dbg_slave_lock) Then Go to return_normal
620  Else
621  return_normal :
627  If trace_on Then tracing_on()
629  debuggerinfo = NULL
630  task = NULL
633  enter_kgdb--
638  Return 0
640  cpu_relax()
649  If atomic_read( & keep track of the CPU which is doing the single stepping) != -1 && task && process id != kgdb_sstep_pid && --sstep_tries Then
652  atomic_set( & The CPU# of the active CPU, or -1 if none:, - 1)
653  raw_spin_unlock( & dbg_master_lock)
654  dbg_touch_watchdogs()
655  local_irq_restore(flags)
657  Go to acquirelock
660  If Not Return true if there is a valid kgdb I/O module Then
661  ret_state = 1
662  Go to kgdb_restore
668  If kgdb_skipexception - Bail out of KGDB when we've been triggered Then Go to kgdb_restore
672  If pre_exception Then pre_exception()
679  If Not kgdb_single_step Then raw_spin_lock( & dbg_slave_lock)
695  time_left = Parameters used to convert the timespec values:
696  When If you are debugging a problem where roundup (the collection of* all other CPUs) is a problem [this should be extremely rare],* then use the nokgdbroundup option to avoid roundup && --time_left && atomic_read( & We use NR_CPUs not PERCPU, in case kgdb is used to debug early* bootup code (which might not have percpu set up yet):) + atomic_read( & slaves_in_kgdb) != online_cpus cycle
699  0x10c7 is 2**32 / 1000000 (rounded up) (1000)
700  If Not time_left Then pr_crit("Timed out waiting for secondary CPUs.\n")
707  dbg_deactivate_sw_breakpoints()
708  kgdb_single_step = 0
709  kgdb_contthread = current process
710  Guard for recursive entry = 0
711  trace_on = tracing_is_on()
712  If trace_on Then tracing_off()
715  When 1 cycle
716  cpu_master_loop :
719  error = kdb_stub(ks)
720  If error == -1 Then Continue
723  Else
729  Else if error == Switch from one cpu to another Then
732  Go to cpu_loop
733  Else
734  ret_state = error
735  Break
740  If post_exception Then post_exception()
743  If Not kgdb_single_step Then
744  raw_spin_unlock( & dbg_slave_lock)
746  When If you are debugging a problem where roundup (the collection of* all other CPUs) is a problem [this should be extremely rare],* then use the nokgdbroundup option to avoid roundup && atomic_read( & slaves_in_kgdb) cycle
747  cpu_relax()
750  kgdb_restore :
751  If atomic_read( & keep track of the CPU which is doing the single stepping) != -1 Then
752  sstep_cpu = atomic_read( & keep track of the CPU which is doing the single stepping)
753  If task Then kgdb_sstep_pid = process id
755  Else kgdb_sstep_pid = 0
758  If correct_hw_break Then correct_hw_break()
760  If trace_on Then tracing_on()
763  debuggerinfo = NULL
764  task = NULL
765  exception_state &= ~(Waiting to become a master kgdb cpu | Slave cpu enter exception )
767  enter_kgdb--
768  smp_mb__before_atomic()
769  atomic_dec( & We use NR_CPUs not PERCPU, in case kgdb is used to debug early* bootup code (which might not have percpu set up yet):)
771  atomic_set( & The CPU# of the active CPU, or -1 if none:, - 1)
772  raw_spin_unlock( & dbg_master_lock)
773  dbg_touch_watchdogs()
774  local_irq_restore(flags)
776  Return ret_state
Caller
NameDescribe
kgdb_handle_exceptionkgdb_handle_exception() - main entry point from a kernel exception* Locking hierarchy:* interface locks, if any (begin_session)* kgdb lock (kgdb_active)