Akemi

内核监控dmesg/lstopo/lshw

2025/04/23

dmesg查看内核消息

  • 查看硬件引导信息
  • 查看硬件驱动信息
  • 排查硬件相关错误信息
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
使用方法:
dmesg
journalctl -k

建议使用journalctl -k
默认持久化、直接显示时间,依赖于systemd和journald

dmesg | grep -i "dma"
[ 0.008423] ACPI: DMAR 0x0000000045B8C000 000088 (v02 LENOVO CB-01 00000002 ACPI 00040000)
[ 0.008453] ACPI: Reserving DMAR table memory at [mem 0x45b8c000-0x45b8c087]
[ 0.009145] DMA [mem 0x0000000000001000-0x0000000000ffffff]
[ 0.009146] DMA32 [mem 0x0000000001000000-0x00000000ffffffff]
[ 0.009160] On node 0, zone DMA: 1 pages in unavailable ranges
[ 0.009175] On node 0, zone DMA: 97 pages in unavailable ranges
[ 0.010479] On node 0, zone DMA32: 2304 pages in unavailable ranges
[ 0.010563] On node 0, zone DMA32: 10064 pages in unavailable ranges
[ 0.079590] DMAR: Host address width 39
[ 0.079591] DMAR: DRHD base: 0x000000fed90000 flags: 0x0
[ 0.079594] DMAR: dmar0: reg_base_addr fed90000 ver 4:0 cap 1c0000c40660462 ecap 29a00f0505e
[ 0.079596] DMAR: DRHD base: 0x000000fed91000 flags: 0x1
[ 0.079597] DMAR: dmar1: reg_base_addr fed91000 ver 1:0 cap d2008c40660462 ecap f050da
[ 0.079601] DMAR: RMRR base: 0x0000004c000000 end: 0x000000503fffff
[ 0.079603] DMAR-IR: IOAPIC id 2 under DRHD base 0xfed91000 IOMMU 1
[ 0.079604] DMAR-IR: HPET id 0 under DRHD base 0xfed91000
[ 0.079605] DMAR-IR: Queued invalidation will be enabled to support x2apic and Intr-remapping.
[ 0.084796] DMAR-IR: Enabled IRQ remapping in x2apic mode
[ 0.112330] DMA: preallocated 2048 KiB GFP_KERNEL pool for atomic allocations
[ 0.112404] DMA: preallocated 2048 KiB GFP_KERNEL|GFP_DMA pool for atomic allocations
[ 0.112481] DMA: preallocated 2048 KiB GFP_KERNEL|GFP_DMA32 pool for atomic allocations
[ 0.217766] pci 0000:00:02.0: DMAR: Skip IOMMU disabling for graphics
[ 0.282732] iommu: DMA domain TLB invalidation policy: lazy mode
[ 0.429047] PCI-DMA: Using software bounce buffering for IO (SWIOTLB)
[ 0.680305] ata1: SATA max UDMA/133 abar m2048@0x50513000 port 0x50513100 irq 124
[ 0.680312] ata2: SATA max UDMA/133 abar m2048@0x50513000 port 0x50513180 irq 124
[ 0.684362] idma64 idma64.0: Found Intel integrated DMA 64-bit
[ 0.708624] idma64 idma64.1: Found Intel integrated DMA 64-bit
[ 0.728945] idma64 idma64.2: Found Intel integrated DMA 64-bit
[ 0.749621] idma64 idma64.3: Found Intel integrated DMA 64-bit

dmesg | grep -i 'memory'
dmesg | grep -i 'cpu'
dmesg | grep -i 'huge'

lscpu查看CPU(略)

lspci/lsusb查看pci与usb设备(略)

lstopo搜集系统组件信息

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# 安装
apt install hwloc
yum install hwloc

# 非图形化
lstopo-no-graphics
Machine (15GB total)
Package L#0
NUMANode L#0 (P#0 15GB)
L3 L#0 (8192KB)
L2 L#0 (1280KB) + L1d L#0 (48KB) + L1i L#0 (32KB) + Core L#0
PU L#0 (P#0)
PU L#1 (P#4)
L2 L#1 (1280KB) + L1d L#1 (48KB) + L1i L#1 (32KB) + Core L#1
PU L#2 (P#1)
PU L#3 (P#5)
L2 L#2 (1280KB) + L1d L#2 (48KB) + L1i L#2 (32KB) + Core L#2
PU L#4 (P#2)
PU L#5 (P#6)
L2 L#3 (1280KB) + L1d L#3 (48KB) + L1i L#3 (32KB) + Core L#3
PU L#6 (P#3)
PU L#7 (P#7)
HostBridge
PCI 00:02.0 (VGA)
PCI 00:14.3 (Network)
Net "wlp0s20f3"
PCI 00:17.0 (SATA)
PCIBridge
PCI 01:00.0 (NVMExp)
Block(Disk) "nvme0n1"

# 图形化
lstopo

lshw查看硬件信息

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
lshw -c
-c 指定要查看的类型
-businfo 总线信息
lshw -c net -businfo
Bus info Device Class Description
========================================================
pci@0000:00:03.0 network Virtio network device
virtio@0 eth0 network Ethernet interface
pci@0000:00:04.0 network Virtio network device
virtio@1 eth1 network Ethernet interface
pci@0000:00:05.0 network Virtio network device
virtio@2 eth2 network Ethernet interface
pci@0000:00:06.0 network Virtio network device
virtio@3 eth3 network Ethernet interface

lshw -c net -businfo
Bus info Device Class Description
====================================================
pci@0000:00:12.0 ens18 network RTL-8100/8101L/8139 PCI Fast Ethernet Adapter

lshw -c net -businfo
Bus info Device Class Description
============================================================
pci@0000:03:00.0 enp3s0 network RTL8111/8168/8411 PCI Express Gigabit Ethernet Cont
pci@0000:04:00.0 wlp4s0 network Wi-Fi 6 AX200

lshw -c cpu

ras追踪与报告错误

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
yum -y install rasdaemon
systemctl enable rasdaemon.service --now

默认位置/sys/kernel/debug/tracing下
将由syslog/journald进行报告

ras-mc-ctl --help
Usage: ras-mc-ctl [OPTIONS...]
--quiet Quiet operation.
--mainboard Print mainboard vendor and model for this hardware.
--status Print status of EDAC drivers.
--print-labels Print Motherboard DIMM labels to stdout.
--guess-labels Print DMI labels, when bank locator is available.
--register-labels Load Motherboard DIMM labels into EDAC driver.
--delay=N Delay N seconds before writing DIMM labels.
--labeldb=DB Load label database from file DB.
--layout Display the memory layout.
--summary Presents a summary of the logged errors.
--errors Shows the errors stored at the error database.
--error-count Shows the corrected and uncorrected error counts using sysfs.
--help This help message.

ras-mc-ctl --summary
No Memory errors.
No PCIe AER errors.
No Extlog errors.
No devlink errors.
No disk errors.
No MCE errors.

CATALOG
  1. 1. dmesg查看内核消息
  2. 2. lscpu查看CPU(略)
  3. 3. lspci/lsusb查看pci与usb设备(略)
  4. 4. lstopo搜集系统组件信息
  5. 5. lshw查看硬件信息
  6. 6. ras追踪与报告错误