为什么Linux内核在完整系统模式下看不到gem5仿真器中的缓存大小? [英] Why doesn't the Linux kernel see the cache sizes in the gem5 emulator in full system mode?

查看:167
本文介绍了为什么Linux内核在完整系统模式下看不到gem5仿真器中的缓存大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在gem5模拟器中试用缓存大小,以了解它如何影响程序性能,并可能在运行时调整程序.

I want to play around with cache sizes in my gem5 simulator to see how it affects performance of programs, and possibly tune programs at runtime.

作为健全性检查,我尝试检查所使用的命令行参数是否有效,因此我尝试了在以下位置建议的各种方法:

As a sanity check, I tried to check that the command lines arguments I used were working , and so I tried the various methods proposed at: https://superuser.com/questions/55776/finding-l2-cache-size-in-linux/1298808#1298808

cat /sys/devices/system/cpu/cpu0/cache/index2/size
getconf LEVEL2_CACHE_SIZE

但是我发现:

  • 文件/sys/devices/system/cpu/cpu0/cache/index2/size不存在
  • getconf为空
  • the file /sys/devices/system/cpu/cpu0/cache/index2/size does not exist
  • getconf is empty

那是为什么?

但是,我确定缓存已经存在,因为我已经对简单程序进行了基准测试,并且当我减少缓存时,周期数会增加.

I am certain however that the caches are being, since I've benchmarked simple programs, and the cycle counts increase when I decrease the caches.

例如,我的基本命令是:

For example, my base command is:

M5_PATH='/data/git/linux-kernel-module-cheat/gem5/gem5-system'  '/data/git/linux-kernel-module-cheat/gem5/gem5/build/ARM/gem5.opt'  '/data/git/linux-kernel-module-cheat/gem5/gem5/configs/example/fs.py' --command-line='earlyprintk=pl011,0x1c090000 console=ttyAMA0 lpj=19988480 rw loglevel=8 mem=512MB root=/dev/sda nokaslr norandmaps printk.devkmsg=on printk.time=y' --disk-image='/data/git/linux-kernel-module-cheat/buildroot/output.arm-gem5~/images/rootfs.ext2' --dtb-file='/data/git/linux-kernel-module-cheat/gem5/gem5/system/arm/dt/armv7_gem5_v1_1cpu.dtb' --kernel='/data/git/linux-kernel-module-cheat/buildroot/output.arm-gem5~/build/linux-custom/vmlinux' --machine-type=VExpress_GEM5_V1 --num-cpus=1  --caches --l1d_size=1024 --l1i_size=1024 --l2cache --l2_size=1024 --l3_size=1024 --cpu-type=HPI

使用这些微小的缓存,运行以下命令:

With those tiny caches, running the following:

m5 resetstats && dhrystone 10000 && m5 dumpstats

需要1亿7千5百万个周期,如果我使用完全相同的命令但具有1024MB大小的巨大缓存,则只有1600万个周期.

takes 175M cycles, and only 16M cycles if I use the exact same command but with huge caches of size 1024MB.

对于x86,我观察到类似的行为.

I observe a similar behavior for x86.

我正在使用此测试基础结构:

I'm using this testing infrastructure: https://github.com/cirosantilli/linux-kernel-module-cheat/tree/05d8a324f74849f03404eb847f8da748e2e4502c#gem5-change-system-parameters which implies:

邮件列表上的相关主题: http://gem5- users.gem5.narkive.com/4xVBlf3c/verify-cache-configuration

Related thread on the mailing list: http://gem5-users.gem5.narkive.com/4xVBlf3c/verify-cache-configuration

为了进行比较,QEMU v2.11.0 x86确实显示了缓存大小,但没有显示ARM大小.

For comparison, QEMU v2.11.0 x86 did show the cache sizes, but not the ARM one.

也许对于ARM,我们需要修改引导程序以告知内核?但是我不知道这些事情如何很好地工作:

Maybe for ARM we would need to modify the bootloaders to tell that to kernel? But I don't know how those things work very well:

  • https://github.com/gem5/gem5/blob/fbe63074e3a8128bdbe1a5e8f6509c565a3abbd4/system/arm/simple_bootloader/simple.S
  • https://github.com/gem5/gem5/blob/fbe63074e3a8128bdbe1a5e8f6509c565a3abbd4/system/arm/aarch64_bootloader/boot.S

推荐答案

有人告诉我:

gem5没有实现缓存大小发现寄存器.

gem5 doesn't implement the cache size discovery registers.

问题在于,通常情况下配置它们确实很困难,它们甚至可能无法表示gem5中的层次结构.

The problem is that it is really hard to configure them in the general case, and they might not even be able to represent the hierarchy in gem5.

这篇关于为什么Linux内核在完整系统模式下看不到gem5仿真器中的缓存大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆