SimpleSSD / SimpleSSD-FullSystem

Open-Source Licensed Educational SSD Simulator for High-Performance Storage and Full-System Evaluations
BSD 3-Clause "New" or "Revised" License
93 stars 47 forks source link

cannot create a new partition in nvme0n1 #14

Closed MingzheL1u closed 4 years ago

MingzheL1u commented 4 years ago

Running Environment:

Execution information

Explain what you want to ask here:

I want to run SimpleSSD-FullSystem with the default settings. So I follow the website you provided: https://docs.simplessd.org/en/v2.0.12/index.html. To avoid anything unexpected, I did not change anything in the source code, and I downloaded the kernel image and disk image in the website: https://drive.google.com/drive/folders/14b-kJmGXOhltX9Aqr8XV9i48KkZk4Lzs?usp=sharing. I use the command above to boot the SimpleSSD-FS. After booting the system successfully, I use "cat /proc/partitions" to show the partitions, and the result is:

root@genericarmv8:~# cat /proc/partitions 
major minor  #blocks  name

 259        0  402653184 nvme0n1
   8        0    1048576 sda
   8        1    1047552 sda1

And I use "fdisk /dev/nvme0n1" to create a new partition. When I want to write the settings and exit from the menu of fdisk. Errors happened. The stdout of the GEM5 is:

root@genericarmv8:~# fdisk /dev/nvme0n1
...(omit)
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-393216, default 1): Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-393216, default 393216): Using default value 393216

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.

And the stdout of SimpleSSD is:

Global frequency set at 1000000000000 ticks per second
warn: DRAM device capacity (16384 Mbytes) does not match the address range assigned (4096 Mbytes)
info: kernel located at: /home/mzliu/m5/binaries/aarch64-vmlinux-4.9.92
warn: Bootloader entry point 0x10 overriding reset address 0
warn: Highest ARM exception-level set to AArch32 but bootloader is for AArch64. Assuming you wanted these to match.
0: PAL: Channel |   Way   |   Die   |  Plane  |  Block  |   Page  
0: PAL:       8 |       4 |       2 |       2 |     512 |     512
...(omit)
1097169245711: ICL: WRITE | LCA 0 + 1 | 1097169245711 - 1097172315791 (3070080)
1097172668291: HIL::NVMe: NVM     | WRITE | CQ 4 | SQ 4:44 | CID 990 | NSID 1     | 0 + 8 | 1097164428211 - 1097172668291 (8240080)
1097177630711: HIL::NVMe: INTR    | MSI-X sent | vector 3
1097179959500: HIL::NVMe: CQ 4    | Completion Queue Head Doorbell | Item count in queue 1 -> 0 | head 44 -> 45 | tail 45
...(omit)
17868695134987500: HIL::NVMe: BAR0    | READ  | Controller Status
17868695134987500: HIL::NVMe: DMAPORT | READ  | DATA 00000001
17869687124288000: HIL::NVMe: BAR0    | READ  | Controller Status
17869687124288000: HIL::NVMe: DMAPORT | READ  | DATA 00000001
17870711113088500: HIL::NVMe: BAR0    | READ  | Controller Status
17870711113088500: HIL::NVMe: DMAPORT | READ  | DATA 00000001
17871703102376500: HIL::NVMe: BAR0    | READ  | Controller Status
17871703102376500: HIL::NVMe: DMAPORT | READ  | DATA 00000001

It seems that everything goes well at the beginning of the SimpleSSD-FS, and the log shows that admin and I/O queues are successfully create. The stdout of GEM5 is:

==== m5 slave terminal: Terminal 0 ====
[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.9.92.CAMELab (kukdh1@kukdh1-dorm.iptime.org) (gcc version 7.2.1 20171011 (Linaro GCC 7.2-2017.11) ) #6 SMP PREEMPT Thu Apr 19 14:30:50 KST 2018
...(omit)
[    0.381850] nvme nvme0: pci function 0000:00:02.0
[    0.381861] nvme 0000:00:02.0: enabling device (0000 -> 0002)
[    0.381869] nvme 0000:00:02.0: enabling bus mastering
...(omit)
[    0.541603] scsi 0:0:0:0: Direct-Access     ATA      M5 IDE Disk      n/a  PQ: 0 ANSI: 5
[    0.573640] sd 0:0:0:0: [sda] 2097152 512-byte logical blocks: (1.07 GB/1.00 GiB)
[    0.573689] sd 0:0:0:0: Attached scsi generic sg0 type 0
[    0.573722] sd 0:0:0:0: [sda] Write Protect is off
[    0.573728] sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00
[    0.573753] sd 0:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[    0.574043]  sda: sda1
[    0.574391] sd 0:0:0:0: [sda] Attached SCSI disk
[    0.589548] EXT4-fs (sda1): couldn't mount as ext3 due to feature incompatibilities
[    0.590336] EXT4-fs (sda1): mounted filesystem with ordered data mode. Opts: (null)
[    0.590348] VFS: Mounted root (ext4 filesystem) on device 8:1.
[    0.590716] devtmpfs: mounted
[    0.590793] Freeing unused kernel memory: 512K
[    0.593705] random: fast init done
INIT: version 2.88 booting
Starting udev
starting version 232
[    0.740012] EXT4-fs (sda1): re-mounted. Opts: data=ordered
hwclock: can't open '/dev/misc/rtc': No such file or directory
Mon Dec 12 07:18:58 UTC 2016
hwclock: can't open '/dev/misc/rtc': No such file or directory
INIT: Entering runlevel: 3
haveged: listening socket at 3
haveged: haveged starting up
Configuring network interfaces... ifconfig: SIOCGIFFLAGS: No such device
Prefare for gem5-specific works...
Mon Dec 12 07:18:58 UTC 2016
Reading scripts...
[    0.897589] input: PS/2 Generic Mouse as /devices/platform/1c070000.kmi/serio1/input/input2
...

So could you help me find out what the problem is? Looking forward to your reply.

kukdh1 commented 4 years ago

Hi,

By default, SimpleSSD only calculates timing (latency) of I/O and does not store any data written to the SSD. To create filesystem, you need to change configuration file to make SimpleSSD to store data to backing file.

I don't recommend you to run fdisk and mkfs inside of gem5 simulation (VERY, VERY SLOW). Please check following steps:

  1. Create disk image as usual. See here.
  2. Update SimpleSSD configuration as following: Check comments in the configuration file for details
    [nvme]
    LBASize = 512       # You MUST set LBA size as 512, not 4096.
    EnableDiskImage = 1 # Change this to one.
    StrictSizeCheck = 0 # Let this zero, if your disk image has different size with simulated SSD.
    DiskImageFile1 = <path to your disk image. This path is relative to your working directory, not M5_PATH.>
    UseCopyOnWriteDisk = 1 # Change this to one.
  3. Run simulation.

P.S. 1. If you set [nvme] UseCopyOnWriteDisk as zero, data written during simulation will be stored to backing file -- which makes filesystem corruption when running multiple simulation with same disk image. P.S. 2. If disk image is not exists on the path, SimpleSSD will create zero-filled disk image file.

If your problem solved, please close the issue.

Thanks.

MingzheL1u commented 4 years ago

Thanks for your reply.

I created a disk image to store data, and modified the configuration file of the SimpleSSD following your tips. Particularly, I configured the DiskImageFile1 with "nvme.img", and put nvme.img in the same directory of sample.config. Then I run simulation with the command as before with nothing change.

I am not clear about whether I should use absolute or relative paths of "DiskImageFile1". But it doesn't matter, because SimpleSSD will create a disk image file if my disk image is not exists.

So where is the disk image after I boot the system? Where should I go to find it?

root@genericarmv8:~# cat /proc/partitions
major minor  #blocks  name

 259        0  402653184 nvme0n1
   8        0    1048576 sda
   8        1    1047552 sda1
root@genericarmv8:~# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root               990.9M    233.5M    690.2M  25% /
devtmpfs                  1.9G         0      1.9G   0% /dev
tmpfs                     1.9G     16.0K      1.9G   0% /run
tmpfs                     1.9G     36.0K      1.9G   0% /var/volatile
root@genericarmv8:~# fdisk -l

Disk /dev/nvme0n1: 412.3 GB, 412316860416 bytes
64 heads, 32 sectors/track, 393216 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes

Disk /dev/nvme0n1 doesn't contain a valid partition table

Disk /dev/sda: 1073 MB, 1073741824 bytes
139 heads, 8 sectors/track, 1885 cylinders
Units = cylinders of 1112 * 512 = 569344 bytes

   Device Boot      Start         End      Blocks  Id System
/dev/sda1               2        1886     1047552  83 Linux

Thanks!

kukdh1 commented 4 years ago

Hi,

SimpleSSD should create empty disk image file when file does not exists, but this file is zero-filled so there is no partition table and no filesystem.

Please put the nvme.img at the working directory where you run the simulation if you set [nvme] DiskImageFile1 = nvme.img. (I assume you created partition table and file system on nvme.img)

cd <your simplessd-fullsystem directory>
mv <your nvme.img> .
./build/ARM/gem5.opt --debug-flag=M5Print --debug-file=debug.txt ./configs/example/fs.py \
  --kernel=aarch64-vmlinux-4.9.92 --dtb-file=armv8_gem5_v1_4cpu.dtb --machine-type=VExpress_GEM5_V1 \
  --num-cpu=4 --cpu-clock=2GHz --caches --l2cache --cpu-type=AtomicSimpleCPU --mem-size=4GB \
  --mem-type=DDR4_2400_8x8 --ssd-interface=nvme --ssd-config=./src/dev/storage/simplessd/config/sample.cfg \
  --disk-image=linaro-aarch64-linux.img

And check that stdout of gem5 contains following message as coded here:

0: ICL::GenericCache: CREATE  | line count in super page 8 | line count in max I/O 64
0: info: Using disk image at nvme.img for NSID 1
0: HIL::NVMe: NS 1    | CREATE | LBA size 512 | Capacity 805306368

If Linux Kernel detects your disk image correctly, you can find relevant kernel log in m5term:

[    0.381836] nvme nvme0: pci function 0000:00:02.0
[    0.381847] nvme 0000:00:02.0: enabling device (0000 -> 0002)
[    0.381855] nvme 0000:00:02.0: enabling bus mastering
...
[    0.383017]  nvme0n1: p1

And can be mounted by following command (I used linaro-aarch64-linux.img as nvme.img):

root@genericarmv8:~# cat /proc/partitions
major minor  #blocks  name

 259        0  402653184 nvme0n1
 259        1    1047552 nvme0n1p1
   8        0    1048576 sda
   8        1    1047552 sda1
root@genericarmv8:~# mkdir mnt
root@genericarmv8:~# mount /dev/nvme0n1p1 mnt/
[    1.333278] EXT4-fs (nvme0n1p1): mounted filesystem with ordered data mode. Opts: (null)
root@genericarmv8:~# ls mnt
bin         data        etc         lib         media       opt         run         sys         usr
boot        dev         home        lost+found  mnt         proc        sbin        tmp         var
root@genericarmv8:~#

You can even boot Linux from SimpleSSD by using linaro-aarch64-linux.img as DiskImageFile1 and add --disable-ide --root-device=/dev/nvme0n1p1 option when running gem5.

Thanks.

MingzheL1u commented 4 years ago

Thanks for your reply and your answer.

I booted the system and find the nvme disk successfully follow your guide. And I also boot Linux by using linaro-aarch64-linux.img.

It's very kind of you. Thank you very much.