Hello all, I have recently been running a workload in full system mode that attempts to figure out some information about the system by accessing various nodes in /sys. The issue occurs when the library tries to access the PCI device config of the IDE controller through sysfs. The kernel attempts to read all 256 bytes of the config out of the device in 32-bit chunks and gem5 panics when the kernel tries to read above the 64 byte boundary. Using a 32bit ARM Ubuntu image, the behavior can be reproduced by running the command:
cat /sys/bus/pci/devices/0000\:00\:01.0/config The resulting error in gem5 is: panic: No 32bit reads implemented for this device. And the kernel backtrace is: #0 pci_generic_config_read (bus=0xbe220c00, devfn=8, where=68, size=4, val=0xbb207e3c) at drivers/pci/access.c:72 #1 0x8027ba08 in pci_user_read_config_dword (dev=0xbe3e8800, pos=8, val=0xbb207e6c) at drivers/pci/access.c:273 #2 0x802869d4 in pci_read_config (filp=<optimized out>, kobj=<optimized out>, bin_attr=<optimized out>, buf=0xbe31e000 "\206\200\021qE", off=102400, count=256) at drivers/pci/pci-sysfs.c:672 #3 0x8017d054 in sysfs_kf_bin_read (of=<optimized out>, buf=<optimized out>, count=<optimized out>, pos=0) at fs/sysfs/file.c:102 #4 0x8017cab4 in kernfs_file_direct_read (ppos=<optimized out>, count=<optimized out>, user_buf=<optimized out>, of=<optimized out>) at fs/kernfs/file.c:213 #5 kernfs_fop_read (file=<optimized out>, user_buf=0x8 <__vectors_start+8> <error: Cannot access memory at address 0x8>, count=<optimized out>, ppos=0x4 <__vectors_start+4>) at fs/kernfs/file.c:251 #6 0x8011c964 in __vfs_read (file=0xbe220c00, buf=<optimized out>, count=<optimized out>, pos=<optimized out>) at fs/read_write.c:432 #7 0x8011d134 in vfs_read (file=0xbe220c00, buf=0x19000 <error: Cannot access memory at address 0x19000>, count=<optimized out>, pos=0xbb207f80) at fs/read_write.c:454 #8 0x8011dabc in SYSC_read (count=<optimized out>, buf=<optimized out>, fd=<optimized out>) at fs/read_write.c:569 #9 SyS_read (Cannot access memory at address 0x0 Looking at the PIIX4 documentation[1], it looks like the config above 64 bytes is either reserved or things related to UDMA/33. However, it appears to me that it is perfectly valid behavior for the kernel to read these bytes above the 64 byte boundary. My solution was to replace the panic with a warning and to simply return zeros in the packet. This allows my workload to correctly run without crashing gem5. If this is an acceptable solution, I will submit a patch. My one doubt here is that when I do a similar read operation on the sysfs config of a local virtual machine (which also has a PIIX4 IDE controller in it), I only get back 64 bytes: $ cat /sys/bus/pci/devices/0000\:00\:01.1/config | xxd 0000000: 8680 1171 0700 0000 018a 0101 0040 0000 ...q.........@.. 0000010: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0000020: 01d0 0000 0000 0000 0000 0000 0000 0000 ................ 0000030: 0000 0000 0000 0000 0000 0000 0000 0000 ................ and so I'm slightly worried about this discrepancy in behavior (granted, it's an x86 VM with a much earlier version of the linux kernel). Regards, Paul [1] https://www.intel.com/Assets/PDF/datasheet/290562.pdf , page 47 _______________________________________________ gem5-dev mailing list gem5-dev@gem5.org http://m5sim.org/mailman/listinfo/gem5-dev