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

查看:18
本文介绍了为什么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.

作为健全性检查,我尝试检查我使用的命令行参数是否有效,因此我尝试了以下建议的各种方法:https://superuser.com/questions/55776/finding-l2-cache-size-in-linux/1298808#1298808

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

需要 175M 个周期,如果我使用完全相同的命令但具有 1024MB 的巨大缓存,则只需要 16M 个周期.

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.

我正在使用这个测试基础设施:https://github.com/cirosantilli/linux-kernel-module-cheat/tree/05d8a324f74849f03404eb847f8da748e2e4502c#gem5-change-system-parameters 这意味着:

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:

推荐答案

有人告诉我:

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天全站免登陆