Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:arch\x86\kernel\cpu\mce\core.c Create Date:2022-07-28 08:00:45
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:The actual machine check handler. This only handles real* exceptions when something got corrupted coming in through int 18.* This is executed in NMI context not subject to normal locking rules. This* implies that most kernel services cannot be safely used

Proto:void do_machine_check(struct pt_regs *regs, long error_code)

Type:void

Parameter:

TypeParameterName
struct pt_regs *regs
longerror_code
1231  DECLARE_BITMAP(valid_banks, Maximum banks number.* This is the limit of the current register layout on* Intel CPUs.)
1232  DECLARE_BITMAP(toclear, Maximum banks number.* This is the limit of the current register layout on* Intel CPUs.)
1233  cfg = mca_cfg
1234  cpu = smp_processor_id()
1235  msg = "Unknown"
1237  worst = 0
1243  order = -1
1249  no_way_out = 0
1255  kill_it = 0
1261  lmce = 1
1263  If Cases where we avoid rendezvous handler timeout:* 1) If this CPU is offline Then Return
1266  In IST context, we explicitly disable preemption. This serves two* purposes: it makes it much less likely that we would accidentally* schedule in IST context and it will force a warning if we somehow* manage to schedule by accident.
1268  this_cpu_inc(mce_exception_count)
1270  Collect all global (w.r.t. this processor) status about this machine* check into our "mce" struct so that we can use it later to assess* the severity of the problem as we read per-bank specific details.
1271  CPU time stamp counter = dtsc() - returns the current TSC without ordering constraints* rdtsc() returns the result of RDTSC as a 64-bit integer
1273  final = this_cpu_ptr( & mces_seen)
1274  final = m
1276  memset(valid_banks, 0, size of valid_banks )
1277  no_way_out = Do a quick check if any of the events requires a panic.* This decides if we keep the events around or clear them.
1279  The "volatile" is due to gcc bugs ()
1286  If Not (Machine Check Global Status MSR & start ip valid ) Then kill_it = 1
1293  If Kernel's X86_VENDOR enum == X86_VENDOR_INTEL || Kernel's X86_VENDOR enum == X86_VENDOR_ZHAOXIN Then lmce = Machine Check Global Status MSR & LMCE signaled
1304  If lmce Then
1305  If no_way_out Then mce_panic("Fatal local machine check", & m, msg)
1307  Else
1308  order = Start of Monarch synchronization. This waits until all CPUs have* entered the exception handler and then determines if any of them* saw a fatal event that requires panic. Then it executes them* in the entry order.* TBD double check parallel CPU hotunplug
1311  __mc_scan_banks( & m, final, toclear, valid_banks, no_way_out, & worst)
1313  If Not no_way_out Then mce_clear_state(toclear)
1320  If Not lmce Then
1321  If Synchronize between CPUs after main scanning loop.* This invokes the bulk of the Monarch processing. < 0 Then no_way_out = worst >= MCE_PANIC_SEVERITY
1323  Else
1332  If worst >= MCE_PANIC_SEVERITY && tolerant < 3 Then
1333  mce_severity( & m, tolerant, & msg, true)
1334  mce_panic("Local fatal machine check!", & m, msg)
1342  If tolerant == 3 Then kill_it = 0
1344  Else if no_way_out Then mce_panic("Fatal machine check on current CPU", & m, msg)
1347  If worst > 0 Then irq_work_queue( & mce_irq_work)
1350  mce_wrmsrl(MSR_IA32_MCG_STATUS, 0)
1352  This function forces the icache and prefetched instruction stream to* catch up with reality in two very specific cases:* a) Text was modified using one virtual address and is about to be executed* from the same physical page at a different virtual address
1354  If worst != MCE_AR_SEVERITY && Not kill_it Then Go to out_ist
1358  If (Code segment & 3) == 3 Then
1359  st_begin_non_atomic() - begin a non-atomic section in an IST exception*@regs: regs passed to the IST exception handler* IST exception handlers normally cannot schedule
1360  The local_irq_*() APIs are equal to the raw_local_irq*()* if !TRACE_IRQFLAGS.()
1362  If kill_it || do_memory_failure( & m) Then force_sig(SIGBUS)
1364  local_irq_disable()
1365  st_end_non_atomic() - begin a non-atomic section in an IST exception* Ends a non-atomic section started with ist_begin_non_atomic().
1366  Else
1367  If Not fixup_exception(regs, X86_TRAP_MC, error_code, 0) Then mce_panic("Failed kernel mode recovery", & m, NULL)
1371  out_ist :
1372  ist_exit(regs)