Description
Hello,
In Emulator::run_program(), there is the line:
self.tick(40);
Here, the value given (40) essentially controls how tightly the CPU and system emulation are coupled together. A large value allows the CPU emulation to run freely for some time between emulating other system functions. This is similar to the hardware: a fast CPU might well execute a number of instructions between each tick of the system bus.
In the source code for tick(), there is a comment indicating that certain parameters will cause Linux to hang. I wanted to understand this bug better, so I experimented with a number of different values to see what I could learn. Here is what I found:
50, 60 -- boots okay
70 -- boots okay in 5 of 5 attempts
75 -- boots okay
79 -- boots okay in 4 of 5 tries, one freeze after "Run /sbin/init as init process"
80 -- freeze at "VFS: Mounted root (ext2 filesystem) on device 254:0."
90 (1st boot) -- booted okay
90 (2nd boot) -- freeze at "EXT4-fs (vda): mounting ext2 file system using the ext4 subsystem"
95 -- freeze at "EXT4-fs..."
100 (1st boot) -- freeze at "Run /sbin/init as init process"
100 (2nd boot) -- freeze at "EXT4-fs (vda): mounting ext2 file system using the ext4 subsystem"
100 (3rd boot) -- booted okay
200 -- freeze at "Key type dns_resolver registered"
300 -- same as 200
400 -- freeze at "virtio_blk virtio0: [vda] 102400 512-byte logical blocks (52.4 MB/50.0 MiB)"
Most errors seem to involve block devices, which makes me suspect the src/device/virtio_block_disk.rs file. Any other ideas?