【问题标题】:Unable to run linux 3.10(mips) on qemu 2.5无法在 qemu 2.5 上运行 linux 3.10(mips)
【发布时间】:2019-11-19 20:50:47
【问题描述】:

我想在 qemu 上运行带有 mips64r2 的 linux 3.10。但是失败了,开机日志如下,

我用龙芯修改的gcc 4.9.3编译内核。

内核配置文件是 malta_defconfig,我将其更改为 mips64r2 cpu 和 64 位内核。

qemu 2.5 是 ubuntu 16.04 上的默认应用程序。

zlp@lab302i-ES:~/projs/linux-3.10$ qemu-system-mips64el -M malta -m 1G -cpu 5KEf -kernel vmlinux -nographic
Linux version 3.10.0 (zlp@lab302i-ES) (gcc version 4.9.3 20150626 (Red Hat 4.9.3-2) (GCC) ) #8 SMP Tue Nov 19 19:16:32 CST 2019
Config serial console: console=ttyS0,38400n8r
bootconsole [early0] enabled
CPU revision is: 00018900 (MIPS 5KE)
FPU revision is: 00738900
Checking for the multiply/shift bug... no.
Checking for the daddiu bug... no.
Software DMA cache coherency enabled
Determined physical RAM map:
 memory: 0000000000001000 @ 0000000000000000 (reserved)
 memory: 00000000000ef000 @ 0000000000001000 (ROM data)
 memory: 0000000000539000 @ 00000000000f0000 (reserved)
 memory: 000000000f9d7000 @ 0000000000629000 (usable)
Wasting 88312 bytes for tracking 1577 unused pages
Zone ranges:
  DMA      [mem 0x00000000-0x00ffffff]
  Normal   [mem 0x01000000-0x0fffffff]
Movable zone start for each node
Early memory node ranges
  node   0: [mem 0x00000000-0x0fffffff]
Primary instruction cache 8kB, VIPT, 2-way, linesize 32 bytes.
Primary data cache 8kB, 2-way, VIPT, no aliases, linesize 32 bytes
PERCPU: Embedded 10 pages/cpu @9800000001384000 s10816 r8192 d21952 u40960
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 64640
Kernel command line:  console=ttyS0,38400n8r
PID hash table entries: 1024 (order: 1, 8192 bytes)
Dentry cache hash table entries: 32768 (order: 6, 262144 bytes)
Inode-cache hash table entries: 16384 (order: 5, 131072 bytes)
Cache parity protection disabled
Memory: 251796k/255836k available (3695k kernel code, 4040k reserved, 1150k data, 272k init, 0k highmem)
Hierarchical RCU implementation.
    CONFIG_RCU_FANOUT set to non-default value of 32
    RCU restricting CPUs from NR_CPUS=2 to nr_cpu_ids=1.
NR_IRQS:256
CPU frequency 200.00 MHz
Console: colour dummy device 80x25
Calibrating delay loop... 1076.42 BogoMIPS (lpj=5382144)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 256
Checking for the daddi bug... no.
Brought up 1 CPUs
NET: Registered protocol family 16
bio: create slab <bio-0> at 0
vgaarb: loaded
PCI host bridge to bus 0000:00
pci_bus 0000:00: root bus resource [mem 0x10000000-0x17ffffff]
pci_bus 0000:00: root bus resource [io  0x2000-0x1fffff]
pci_bus 0000:00: No busn resource found for root bus, will use [bus 00-ff]
pci 0000:00:0a.3: no compatible bridge window for [io  0x1100-0x110f]
vgaarb: device added: PCI:0000:00:12.0,decodes=io+mem,owns=none,locks=none
pci 0000:00:0a.3: BAR 8: [io  0x1100-0x110f] has bogus alignment
pci 0000:00:12.0: BAR 0: assigned [mem 0x10000000-0x11ffffff pref]
pci 0000:00:0b.0: BAR 6: assigned [mem 0x12000000-0x1203ffff pref]
pci 0000:00:12.0: BAR 6: assigned [mem 0x12040000-0x1204ffff pref]
pci 0000:00:12.0: BAR 1: assigned [mem 0x12050000-0x12050fff]
pci 0000:00:0a.2: BAR 4: assigned [io  0x2000-0x201f]
pci 0000:00:0b.0: BAR 0: assigned [io  0x2020-0x203f]
pci 0000:00:0b.0: BAR 1: assigned [mem 0x12051000-0x1205101f]
pci 0000:00:0a.1: BAR 4: assigned [io  0x2040-0x204f]
Switching to clocksource pit
NET: Registered protocol family 2
TCP established hash table entries: 2048 (order: 3, 32768 bytes)
TCP bind hash table entries: 2048 (order: 3, 32768 bytes)
TCP: Hash tables configured (established 2048 bind 2048)
TCP: reno registered
UDP hash table entries: 256 (order: 1, 8192 bytes)
UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
NET: Registered protocol family 1
RPC: Registered named UNIX socket transport module.
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
PCI: Enabling device 0000:00:0a.2 (0000 -> 0001)
CPU 0 Unable to handle kernel paging request at virtual address 0000000000000000, epc == ffffffff8016bef4, ra == ffffffff805c51a0
Oops[#1]:
CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.10.0 #8
task: 980000000fc433f0 ti: 980000000fc44000 task.ti: 980000000fc44000
$ 0   : 0000000000000000 0000000000000008 0000000000000000 0000000000000000
$ 4   : 980000000fc47de0 0000000000000000 0000000000000000 0000000000000000
$ 8   : 0000000000000000 980000000fd84e60 fffffffffffffffc ffffffff8061cd30
$12   : 0000000000000010 ffffffff802e3bd4 0000000000000000 000000000000001a
$16   : ffffffff80600000 ffffffff805c5184 0000000000000000 ffffffff80600000
$20   : ffffffff805e6368 ffffffff805e6338 ffffffff805bc1d8 ffffffff805e62f8
$24   : 0000000000000018 ffffffff803451b0                                  
$28   : 980000000fc44000 980000000fc47de0 ffffffff80600000 ffffffff805c51a0
Hi    : 0000000000000001
Lo    : 1111111111111112
epc   : ffffffff8016bef4 cmpxchg_futex_value_locked+0x2c/0x78
    Not tainted
ra    : ffffffff805c51a0 futex_init+0x1c/0x6c
Status: 1400a7e3    KX SX UX KERNEL EXL IE 
Cause : 00800008
BadVA : 0000000000000000
PrId  : 00018900 (MIPS 5KE)
Modules linked in:
Process swapper/0 (pid: 1, threadinfo=980000000fc44000, task=980000000fc433f0, tls=0000000000000000)
Stack : ffffffff805c4f3c 0000000000000000 ffffffff80600000 ffffffff801004f0
      ffffffff805e6368 0000000000000006 0000000000000030 ffffffff805f0a30
      ffffffff80600000 ffffffff805bca24 0000000000000066 0000000000000000
      ffffffff80494a48 0000000000000000 ffffffff80600000 0000000000000000
      0000000000000000 0000000000000000 0000000000000000 0000000000000000
      0000000000000000 ffffffff80494a64 ffffffff80494a48 0000000000000000
      0000000000000000 ffffffff80101f18 0000000000000000 0000000000000000
      0000000000000000 0000000000000000 0000000000000000 0000000000000000
      0000000000000000 0000000000000000 0000000000000000 0000000000000000
      0000000000000000 0000000000000000 0000000000000000 0000000000000000
      ...
Call Trace:
[<ffffffff8016bef4>] cmpxchg_futex_value_locked+0x2c/0x78
[<ffffffff805c51a0>] futex_init+0x1c/0x6c
[<ffffffff801004f0>] do_one_initcall+0xe0/0x160
[<ffffffff805bca24>] kernel_init_freeable+0x16c/0x220
[<ffffffff80494a64>] kernel_init+0x1c/0x160
[<ffffffff80101f18>] ret_from_kernel_thread+0x14/0x1c


Code: 00000000  0000102d  0000000f <c0a30000> 14660005  00000000  00e0082d  e0a10000  1020fff9 
---[ end trace 47a33b7db369802c ]---
note: swapper/0[1] exited with preempt_count 1
Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b

【问题讨论】:

    标签: linux-kernel mips qemu


    【解决方案1】:

    这里有几个可能的问题:

    (1) QEMU 2.5 现在已经很老了。你可以用更现代的东西重试。

    (2) 您正在使用“由龙芯修改的 gcc”构建内核,但实际上并没有在龙芯 CPU 上运行它。尝试使用股票 gcc 构建内核,并确保您的内核配置与您要求 QEMU 模拟的板模型和 CPU 模型相匹配。 (您提供的内核日志显示它在尝试执行原子 cmpxchg 操作的低级函数中崩溃,我模糊记得这是一个不同 MIPS CPU 具有不同支持指令集的区域,并且在特别是龙芯可能在这里做了一些改变。所以我的第一个猜测是你的问题在这里。)

    【讨论】:

    • 谢谢!你的回复太快了,为了避免这个问题,我删除了内核配置中的 futex 功能。
    • 这听起来像是错误的改变。您几乎肯定需要 futex,而删除通用功能只是掩盖了由于它使用的特定于 cpu 的东西与您正在运行的 cpu 不匹配而导致的错误。
    • 感谢您的建议!但是,如果我使用来自codescape.mips.com/components/toolchain/2016.05-01/… 的 GCC,编译失败并显示“arch/mips/kernel/r4k_fpu.S:40: Error: opcode not supported on this processor: mips3 (mips3) `sdc1 $f1,256+8($4 )'" 这个 gcc 的版本是 4.9.2。如果我使用 ubuntu 16.04 中的默认应用程序 mips64el-linux-gnuabi64-gcc(5.4.0),它会出现相同的错误。可能是主线内核的bug?
    • 该错误消息的第一个谷歌点击是这个邮件列表线程:linux-mips.org/archives/linux-mips/2015-07/msg00248.html - 它说问题是一个内核错误,有一个修复程序不在 3.10 中,但在在以后的内核中。尝试使用更高版本的内核而不是 3.10 ?
    • 谢谢!看来这是一个内核错误。由于某种原因,版本无法更改。我暂时使用没有 futex 的 3.10。如有必要,我会尽力向后移植此补丁。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-11-14
    • 2012-06-08
    • 2017-08-20
    • 2014-04-08
    • 2013-05-28
    • 2013-04-10
    • 1970-01-01
    相关资源
    最近更新 更多