函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:arch\x86\kernel\cpu\mce\core.c Create Date:2022-07-27 09:01:22
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称: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

函数原型:void do_machine_check(struct pt_regs *regs, long error_code)

返回类型:void

参数:

类型参数名称
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等于当前cpu ID()
1235  msg等于"Unknown"
1237  worst等于0
1243  order等于负1
1249  no_way_out等于0
1255  kill_it等于0
1261  lmce等于1
1263  如果Cases where we avoid rendezvous handler timeout:* 1) If this CPU is offline则返回
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, 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  如果非Machine Check Global Status MSR 按位与start ip valid 的值则kill_it等于1
1293  如果Kernel's X86_VENDOR enum 恒等于X86_VENDOR_INTELKernel's X86_VENDOR enum 恒等于X86_VENDOR_ZHAOXINlmce等于Machine Check Global Status MSR 按位与LMCE signaled
1304  如果lmce
1305  如果no_way_outmce_panic("Fatal local machine check", & m, msg)
1307  否则
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  如果非no_way_outmce_clear_state(toclear)
1320  如果非lmce
1321  如果Synchronize between CPUs after main scanning loop.* This invokes the bulk of the Monarch processing.小于0则no_way_out等于worst大于等于MCE_PANIC_SEVERITY
1323  否则
1332  如果worst大于等于MCE_PANIC_SEVERITYtolerant小于3则
1333  mce_severity( & m, tolerant, & msg, true)
1334  mce_panic("Local fatal machine check!", & m, msg)
1342  如果tolerant恒等于3则kill_it等于0
1344  否则如果no_way_outmce_panic("Fatal machine check on current CPU", & m, msg)
1347  如果worst大于0则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  如果worst不等于MCE_AR_SEVERITY且非kill_it则转到:out_ist
1358  如果Code segment 按位与3的值恒等于3则
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  开中断()
1362  如果kill_itdo_memory_failure( & m)则force_sig(SIGBUS)
1364  禁止中断()
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  否则
1367  如果非fixup_exception(regs, X86_TRAP_MC, error_code, 0)则mce_panic("Failed kernel mode recovery", & m, NULL)
1371  out_ist :
1372  ist_exit(regs)