crash —— 获取cpuinfo信息

简介: crash —— 获取cpuinfo信息
crash> mach -c
CPU 0:
struct cpuinfo_x86 {
  x86 = 6 '\006',
  x86_vendor = 0 '\000',
  x86_model = 85 'U',
  x86_stepping = 7 '\a',
  x86_tlbsize = 0,
  x86_virt_bits = 48 '0',
  x86_phys_bits = 46 '.',
  x86_coreid_bits = 6 '\006',
  cu_id = 255 '\377',
  extended_cpuid_level = 2147483656,
  cpuid_level = 22,
  x86_capability = {3219913727, 739248128, 0, 326483200, 2147417087, 0, 289, 1309081818, 31, 3550478331, 15, 15, 0, 0, 119, 0, 2072, 0, 3154117632, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14909440, 0},
  x86_vendor_id = "GenuineIntel\000\000\000",
  x86_model_id = "Intel(R) Xeon(R) Gold 5220R CPU @ 2.20GHz\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000",
  x86_cache_size = 36608,
  x86_cache_alignment = 64,
  x86_cache_max_rmid = 207,
  x86_cache_occ_scale = 106496,
  x86_power = 256,
  loops_per_jiffy = 8800000,
  x86_max_cores = 24,
  apicid = 0,
  initial_apicid = 0,
  x86_clflush_size = 64,
  booted_cores = 24,
  phys_proc_id = 0,
  logical_proc_id = 0,
  cpu_core_id = 0,
  cpu_index = 0,
  microcode = 83898626,
  x86_cache_bits = 46 '.',
  initialized = 1,
  cpuinfo_x86_extended_size_rh = 0,
  cpuinfo_x86_extended_rh = {
    cpu_die_id = 0,
    logical_die_id = 0
  }
}
...
CPU 95:
struct cpuinfo_x86 {
  x86 = 6 '\006',
  x86_vendor = 0 '\000',
  x86_model = 85 'U',
  x86_stepping = 7 '\a',
  x86_tlbsize = 0,
  x86_virt_bits = 48 '0',
  x86_phys_bits = 46 '.',
  x86_coreid_bits = 6 '\006',
  cu_id = 255 '\377',
  extended_cpuid_level = 2147483656,
  cpuid_level = 22,
  x86_capability = {3219913727, 739248128, 0, 326483200, 2147417087, 0, 289, 1309081818, 31, 3550478331, 15, 15, 0, 0, 119, 0, 2072, 0, 3154117632, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14909440, 0},
  x86_vendor_id = "GenuineIntel\000\000\000",
  x86_model_id = "Intel(R) Xeon(R) Gold 5220R CPU @ 2.20GHz\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000",
  x86_cache_size = 36608,
  x86_cache_alignment = 64,
  x86_cache_max_rmid = 207,
  x86_cache_occ_scale = 106496,
  x86_power = 256,
  loops_per_jiffy = 8802902,
  x86_max_cores = 24,
  apicid = 123,
  initial_apicid = 123,
  x86_clflush_size = 64,
  booted_cores = 24,
  phys_proc_id = 1,
  logical_proc_id = 1,
  cpu_core_id = 29,
  cpu_index = 95,
  microcode = 83898626,
  x86_cache_bits = 46 '.',
  initialized = 1,
  cpuinfo_x86_extended_size_rh = 0,
  cpuinfo_x86_extended_rh = {
    cpu_die_id = 0,
    logical_die_id = 1
  }
}

可以看到,这里实际读取的是结构体cpuinfo_x86中的内容,内核定义了一个percpu变量:

DECLARE_PER_CPU_READ_MOSTLY(struct cpuinfo_x86, cpu_info);

所以可以通过p读取cpu_info的内容:

crash> p cpu_info
PER-CPU DATA TYPE:
struct cpuinfo_x86 cpu_info;
PER-CPU ADDRESSES:
  [0]: ffff88debf80f040
  [1]: ffff88debf88f040
  [2]: ffff88debf90f040
...
crash> p cpu_info:1
per_cpu(cpu_info, 1) = $348 = {
  x86 = 6 '\006',
  x86_vendor = 0 '\000',
  x86_model = 85 'U',
  x86_stepping = 7 '\a',
  x86_tlbsize = 0,
  x86_virt_bits = 48 '0',
  x86_phys_bits = 46 '.',
  x86_coreid_bits = 6 '\006',
  cu_id = 255 '\377',
  extended_cpuid_level = 2147483656,
  cpuid_level = 22,
  x86_capability = {3219913727, 739248128, 0, 326483200, 2147417087, 0, 289, 1309081818, 31, 3550478331, 15, 15, 0, 0, 119, 0, 2072, 0, 3154117632, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14909440, 0},
  x86_vendor_id = "GenuineIntel\000\000\000",
  x86_model_id = "Intel(R) Xeon(R) Gold 5220R CPU @ 2.20GHz\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000",
  x86_cache_size = 36608,
  x86_cache_alignment = 64,
  x86_cache_max_rmid = 207,
  x86_cache_occ_scale = 106496,
  x86_power = 256,
  loops_per_jiffy = 8800000,
  x86_max_cores = 24,
  apicid = 2,
  initial_apicid = 2,
  x86_clflush_size = 64,
  booted_cores = 24,
  phys_proc_id = 0,
  logical_proc_id = 0,
  cpu_core_id = 1,
  cpu_index = 1,
  microcode = 83898626,
  x86_cache_bits = 46 '.',
  initialized = 1,
  cpuinfo_x86_extended_size_rh = 0,
  cpuinfo_x86_extended_rh = {
    cpu_die_id = 0,
    logical_die_id = 0
  }
}
相关文章
|
2月前
|
Linux
crash命令 —— runq
crash命令 —— runq
|
2月前
crash命令 —— sym
crash命令 —— sym
|
2月前
|
分布式计算 关系型数据库 Ruby
crash命令 —— rd
crash命令 —— rd
|
2月前
|
Linux
crash —— 获取slub的详细信息
crash —— 获取slub的详细信息
|
2月前
crash —— 获取vmalloc分配信息
crash —— 获取vmalloc分配信息
|
2月前
|
Linux
crash工具使用 —— 查看DMI信息
crash工具使用 —— 查看DMI信息
|
2月前
crash命令 —— vtop
crash命令 —— vtop
|
2月前
crash命令 —— ptob/btop
crash命令 —— ptob/btop
|
2月前
crash命令 —— kmem
crash命令 —— kmem
|
2月前
crash命令 —— ptov
crash命令 —— ptov