Git Product home page Git Product logo

gasolly / qemu-nvme Goto Github PK

View Code? Open in Web Editor NEW

This project forked from openchannelssd/qemu-nvme

0.0 1.0 0.0 162.79 MB

The LightNVM qemu implementation, based on NVMe

Home Page: http://openchannelssd.readthedocs.org/en/latest/

License: Other

Makefile 0.24% C 90.56% C++ 3.80% Haxe 0.44% Objective-C 0.25% Assembly 0.42% Python 2.70% NSIS 0.01% Shell 1.27% Perl 0.30% GDB 0.01% Emacs Lisp 0.01% GLSL 0.01% SmPL 0.02%

qemu-nvme's Introduction

QEMU Open-Channel SSD 2.0

This repository contains a fork of qemu/qemu with modifications to the NVMe device to allow the device to expose itself as an Open-Channel 2.0 device.

Also included is support for metadata, SGLs, predefined data according to DLFEAT, optional error recovery through the error recovery DULBE-attribute and error injection.

Compiling & Installing

Below is a minimal example of the installation process.

git clone https://github.com/OpenChannelSSD/qemu-nvme.git

cd qemu-nvme
./configure --target-list=x86_64-softmmu --prefix=$HOME/qemu-nvme
make
make install

NOTE Consider using the --enable-trace-backends=log configure option for better debugging.

Configuring the Open-Channel 2.0 SSD device

The device must have a backing file to store its data. An initialized OCSSD backing file must be created using qemu-img:

qemu-img create -f ocssd -o num_grp=2,num_pu=4,num_chk=60 ocssd.img

Besides the geometry options (num_{grp,pu,chk,sec}), qemu-img also supports options related to write characteristics (ws_min, ws_opt and mw_cunits). These options can also be overwritten as parameters to the device. Issue

qemu-img create -f ocssd -o help

to see the full list of supported options.

To add the OCSSD NVMe device, extend the QEMU arguments with something like:

-blockdev ocssd,node-name=nvme01,file.driver=file,file.filename=ocssd.img
-device nvme,drive=nvme01,serial=deadbeef,id=lnvm

To get a complete list of all options supported by the NVMe device, issue

qemu-system-x86_64 -device nvme,help

or look into the source.

There are two QEMU device parameters that change the behavior of the device. The first, learly_reset is enabled by default and allows OPEN chunks to be reset. While the OCSSD 2.0 specification does not allow this most available drives do. The second, lsgl_lbal is disabled by default and governs how the LBAL field should be interpreted if DPTR is an SGL (PSDT is 0x1 or 0x2). By default LBAL will be not be interpreted as an SGL in any case. Enabling this option may be useful for toying around with NVMe over Fabrics.

Chunk State

The emulated device maintains a Chunk Info Log Page on the backing block device. When the device is brought up any state will be restored. The restored chunk states may be overwritten using the lchunkstate parameter. An example chunk state file:

grp=0 pu=0 chk=0 state=OPEN wp=65535 type=W_RAN wi=0
grp=0 pu=0 chk=1 state=OFFLINE wp=65535 type=W_SEQ wi=0
grp=0 pu=0 chk=2 state=CLOSED wp=4096 type=W_SEQ wi=0
grp=0 pu=0 chk=3 state=OPEN wp=2048 type=W_SEQ wi=0

Error Injection

The lresetfail and lwritefail QEMU parameters can be used to do probabilistic error injection. The parameters points to text files.

Write error injection is done per sector.

grp=0 pu=3 chk=0 sec=53 writefail_prob=100

Reset error injection is done per chunk, so exclude the sec parameter.

grp=0 pu=3 chk=5 resetfail_prob=100
grp=0 pu=3 chk=6 resetfail_prob=20

Guest Kernel

You probably want to make sure the following options are enabled in the kernel you are going to use.

CONFIG_BLK_DEV_INTEGRITY=y
CONFIG_HOTPLUG_PCI_PCIE=y
CONFIG_HOTPLUG_PCI_ACPI=y

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.