Hello everyone, I am trying to use MSR registers for experimenting on caches. I want to add a custom MSR to the system which is simulated by Gem5 with Linux v5.4.84 kernel. I have added entries in src/arch/x86/regs/msr.cc and src/arch/x86/regs/misc.hh on some unused register index, say 0xc0010118. After compiling and building gem5.opt, when I run sudo rdmsr 0xc0010118, it says, rdmsr: CPU 0 cannot read MSR 0xc0010118 Analysing it with strace shows that pread64 returns EIO (input/output error).
execve("/usr/sbin/rdmsr", ["rdmsr", "0xc0010118"], 0x7fff6cbbe848 /* 12 > vars */) = 0 > brk(NULL) = 0x55774d0c6000 > arch_prctl(0x3001 /* ARCH_??? */, 0x7fff2fb9f220) = -1 EINVAL (Invalid > argument) > access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or > directory) > openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 > fstat(3, {st_mode=S_IFREG|0644, st_size=25560, ...}) = 0 > mmap(NULL, 25560, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f4602db7000 > close(3) = 0 > openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3 > read(3, > "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\360A\2\0\0\0\0\0"..., 832) > = 832 > pread64(3, "\6\0\0\0\4\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0"..., > 784, 64) = 784 > pread64(3, > "\4\0\0\0\20\0\0\0\5\0\0\0GNU\0\2\0\0\300\4\0\0\0\3\0\0\0\0\0\0\0", 32, > 848) = 32 > pread64(3, > "\4\0\0\0\24\0\0\0\3\0\0\0GNU\0\237\333t\347\262\27\320l\223\27*\202C\370T\177"..., > 68, 880) = 68 > fstat(3, {st_mode=S_IFREG|0755, st_size=2029560, ...}) = 0 > mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = > 0x7f4602db5000 > pread64(3, "\6\0\0\0\4\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0"..., > 784, 64) = 784 > pread64(3, > "\4\0\0\0\20\0\0\0\5\0\0\0GNU\0\2\0\0\300\4\0\0\0\3\0\0\0\0\0\0\0", 32, > 848) = 32 > pread64(3, > "\4\0\0\0\24\0\0\0\3\0\0\0GNU\0\237\333t\347\262\27\320l\223\27*\202C\370T\177"..., > 68, 880) = 68 > mmap(NULL, 2037344, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = > 0x7f4602bc3000 > mmap(0x7f4602be5000, 1540096, PROT_READ|PROT_EXEC, > MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x22000) = 0x7f4602be5000 > mmap(0x7f4602d5d000, 319488, PROT_READ, > MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x19a000) = 0x7f4602d5d000 > mmap(0x7f4602dab000, 24576, PROT_READ|PROT_WRITE, > MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1e7000) = 0x7f4602dab000 > mmap(0x7f4602db1000, 13920, PROT_READ|PROT_WRITE, > MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f4602db1000 > close(3) = 0 > arch_prctl(ARCH_SET_FS, 0x7f4602db6580) = 0 > mprotect(0x7f4602dab000, 16384, PROT_READ) = 0 > mprotect(0x55774d0c4000, 4096, PROT_READ) = 0 > mprotect(0x7f4602deb000, 4096, PROT_READ) = 0 > munmap(0x7f4602db7000, 25560) = 0 > openat(AT_FDCWD, "/dev/cpu/0/msr", O_RDONLY) = 3 > pread64(3, 0x7fff2fb9f138, 8, 3221291288) = -1 EIO (Input/output error) > write(2, "rdmsr: CPU 0 cannot read MSR 0xc"..., 40rdmsr: CPU 0 cannot read > MSR 0xc0010118 > ) = 40 > exit_group(4) = ? > +++ exited with 4 +++ > Does anyone have any experience with this or any ideas what I may be missing? -- Sarthak Rout, B.Tech(CSE) '23 IIT Kanpur
_______________________________________________ gem5-users mailing list -- gem5-users@gem5.org To unsubscribe send an email to gem5-users-le...@gem5.org