NVMe over PCIe最新的NVMe协议是1.3。 在7.2.1讲了Command Processing流程。有图有真相。

This section describes command submission and completion processing. Figure 251 shows the steps that are followed to submit and complete a command. The steps are:
本节描述了命令提交和命令完成处理。图251列出了提交和完成一个命令的步骤。

  • 1. The host places one or more commands for execution in the next free Submission Queue slot(s) in memory. 主机将一个或多个命令放置在位于内存中的提交队列(SQ)的下一个可用的槽位中执行。
  • 2. The host updates the Submission Queue Tail Doorbell register with the new value of the Submission Queue Tail entry pointer. This indicates to the controller that a new command(s) is submitted for processing. Host用SQ尾部指针的新值去更新SQ的TailDB寄存器。这告诉了SSD控制器有一个新的命令被提交需要被处理。
  • 3. The controller transfers the command(s) from in the Submission Queue slot(s) into the controller for future execution. Arbitration is the method used to determine the Submission Queue from which the controller starts processing the next candidate command(s), refer to section 4.11. SSD控制器将命令从SQ中转移到控制器中以供下一步执行。(从哪一个SQ中取出下一条候选命令去执行的仲裁方法,请参见4.11一节。)
  • 4. The controller then proceeds with execution of the next command(s). Commands may complete out of order (the order submitted or started execution). 控制器接下来执行下一条命令。命令的执行完成可能是乱序的(与提交或开始执行的时间点无关)。
  • 5. After a command has completed execution, the controller places a completion queue entry in the next free slot in the associated Completion Queue. As part of the completion queue entry, the controller indicates the most recent Submission Queue entry that has been consumed by advancing the Submission Queue Head pointer in the completion entry. Each new completion queue entry has a Phase Tag inverted from the previous entry to indicate to the host that this completion queue entry is a new entry. 在命令完成执行之后,SSD控制器将一个完成队列条目(CQE)放在相关的完成队列(CQ)的下一个空闲槽位中。作为CQE的一部分,SSD控制器通过修改完成条目的SQ头指针指示最新的SQE已经被消费了。每一个新的CQE都有一个从前一个条目中反转的相位标记(Phase Tag), 以向Host表明这个CQE是一个新条目。
  • 6. The controller optionally generates an interrupt to the host to indicate that there is a new completion queue entry to consume and process. In the figure, this is shown as an MSI-X interrupt, however, it could also be a pin-based or MSI interrupt. Note that based on interrupt coalescing settings, an interrupt may or may not be generated for each new completion queue entry. 可选地,SSD控制器给Host产生一个中断,以表明有一个新的CQE已经产生,可以被消费和处理了。在图中演示的是MSI-X中断,然而,中断也可以是基于PIN或者MSI的中断。注意:基于中断联合设置,可能或不能为每一个新的CQE产生一个中断。
  • 7. The host consumes and then processes the new completion queue entries in the Completion Queue. This includes taking any actions based on error conditions indicated. The host continues consuming and processing completion queue entries until it encounters a previously consumed entry with a Phase Tag inverted from the value of the current completion queue entries. Host消费和处理在CQ中放置的新的CQE。包括基于错误情况采取的任何操作。Host继续消耗和处理CQE,直到它遇到以前消费的一个条目的相位标签(Phase Tag)从当前完成队列条目(CQEs)的值中反转。
  • 8. The host writes the Completion Queue Head Doorbell register to indicate that the completion queue entry has been consumed. The host may consume many entries before updating the associated Completion Queue Head Doorbell register. Host更新CQ的HeadDB寄存器,表明CQE已经被消费了。在更新相关联的CQ的HeadDB寄存器之前,Host可能消费了多个CQE。

以上8步,写得比较具体,稍微优点罗嗦,那么,用更通俗易懂的话总结一下就是:

  • 1. Host写命令到SQ
  • 2. Host更新SQ的TailDB, 通知SSD取命令
  • 3. SSD收到命令,于是从SQ中取出命令
  • 4. SSD执行命令
  • 5. 命令执行完成后,SSD往CQ中写入命令执行结果,同时修改CQ的TailDB
  • 6. SSD发短信通知Host命令已经执行完成
  • 7. Host收到命令后,到CQ中查看命令完成状态
  • 8. Host处理完CQ中的命令执行结果,更新CQ中的HeadDB, 回复SSD, "命令执行结果已经处理完毕,辛苦啦"

P.S. NVMe over PCIe和我们前面提到的RDMA本质上都是“玩队列”。 NVMe over PCIe有两条队列,一条提交队列(SQ)和一条完成队列(CQ);而RDMA有三条队列,一条发送队列(SQ),一条接收队列(RQ)和一条完成队列(CQ),而一个SQ和一个RQ被称之为一个QP(队列对)。

If you don't aim high you will never hit high.

[SPDK/NVMe存储技术分析]014 - (NVMe over PCIe)Host端的命令处理流程的更多相关文章

  1. [SPDK/NVMe存储技术分析]008 - RDMA概述

    毫无疑问地,用来取代iSCSI/iSER(iSCSI Extensions for RDMA)技术的NVMe over Fabrics着实让RDMA又火了一把.在介绍NVMe over Fabrics ...

  2. [SPDK/NVMe存储技术分析]003 - NVMeDirect论文

    说明: 之所以要翻译这篇论文,是因为参考此论文可以很好地理解SPDK/NVMe的设计思想. NVMeDirect: A User-space I/O Framework for Application ...

  3. [SPDK/NVMe存储技术分析]002 - SPDK官方介绍

    Introduction to the Storage Performance Development Kit (SPDK) | SPDK概述 By Jonathan S. (Intel), Upda ...

  4. [SPDK/NVMe存储技术分析]004 - SSD设备的发现

    源代码及NVMe协议版本 SPDK : spdk-17.07.1 DPDK : dpdk-17.08 NVMe Spec: 1.2.1 基本分析方法 01 - 到官网http://www.spdk.i ...

  5. [SPDK/NVMe存储技术分析]001 - SPDK/NVMe概述

    1. NVMe概述 NVMe是一个针对基于PCIe的固态硬盘的高性能的.可扩展的主机控制器接口. NVMe的显著特征是提供多个队列来处理I/O命令.单个NVMe设备支持多达64K个I/O 队列,每个I ...

  6. [SPDK/NVMe存储技术分析]012 - 用户态ibv_post_send()源码分析

    OFA定义了一组标准的Verbs,并提供了一个标准库libibvers.在用户态实现NVMe over RDMA的Host(i.e. Initiator)和Target, 少不了要跟OFA定义的Ver ...

  7. [SPDK/NVMe存储技术分析]006 - 内存屏障(MB)

    在多核(SMP)多线程的情况下,如果不知道CPU乱序执行的话,将会是一场噩梦,因为无论怎么进行代码Review也不可能发现跟内存屏障(MB)相关的Bug.内存屏障分为两类: 跟编译有关的内存屏障: 告 ...

  8. [SPDK/NVMe存储技术分析]005 - DPDK概述

    注: 之所以要中英文对照翻译下面的文章,是因为SPDK严重依赖于DPDK的实现. Introduction to DPDK: Architecture and PrinciplesDPDK概论:体系结 ...

  9. [SPDK/NVMe存储技术分析]010 - 理解SGL

    在NVMe over PCIe中,I/O命令支持SGL(Scatter Gather List 分散聚合表)和PRP(Physical Region Page 物理(内存)区域页), 而管理命令只支持 ...

随机推荐

  1. MySQL5.7 库、表结构、表字段的查询、更改操作

    1.查询所有数据库 SHOW DATABASES; 2.查询库中所有表 写法1: ① USE [DATABASE_NAME]; ② SHOW TABLES; 写法2: SHOW TABLES FROM ...

  2. vue 定义全局函数和变量

    背景 最近我在整一个网站,介绍一些有意思的网站和实用工具的网站并且把他们收集起来,网站刚建有些不成熟希望给点意见 我用的是前端框架的vue, 但是我没有打包,直接甩到服务器上了, 不想扯了, 步骤 1 ...

  3. 3、前端--伪元素选择器、选择器优先级、字体、背景、边框、display、盒子模型

    伪元素选择器 # 首字调整>>>:也是一种文档布局的方式 p:first-letter { font-size: 48px; /*字体大小*/ color: red; } # 在文本 ...

  4. HMS Core携手厦门大学打造AR增强现实技术

    HMS Core AR Engine团队联手厦门大学信息学院,与专业学生面对面深度交流行业发展与前沿成果.双方共同编写行业知识教材,引导学生开发AR游戏实践,为未来AR.VR人才培养培育可复制的教学模 ...

  5. Solution -「UR #21」「UOJ #632」挑战最大团

    \(\mathcal{Description}\)   Link.   对于简单无向图 \(G=(V,E)\),定义它是"优美"的,当且仅当 \[\forall\{a,b,c,d\ ...

  6. CentOS8 固定IP无法访问外网问题解决(ping: www.hao123.com: Name or service not known)

    CentOS8虚拟机用了一段时间后,需要安装telnet-server服务,却无法正常安装.之前安装ftp服务是没有问题的,安装问题如下: 错误提示,无法下载相关元数据:网上也是0.0B/s.那么可能 ...

  7. JVM学习——垃圾回收GC(学习过程)

    JVM学习-垃圾回收(GC) 2020年02月19日06:03:56,开始学习垃圾回收,学习资料来源(张龙老师的JVM课程) JVM内存数据区域知识复习 学习垃圾回收之前,要对JVM内部的内存区域有详 ...

  8. Eclipse插件开发demo

    一.安装 1. 下载安装JDk 2. 下载安装PDE(Plugin-in Development Environment) 访问eclipse官网,点击Download,选择Download Pack ...

  9. flag_in_your_hand1

    给了两个 文件 index.html 和 一个js文件 ,考察js代码审计能力首先借助浏览器来运行js 程序.用浏览器打开index.html,分析 js 代码: 首先无论在 token 输入框中输入 ...

  10. [Java]Java中的自动包装

    来源:https://www.cnblogs.com/cheapcrook/archive/2012/04/25/2470478.html 自动拆装箱(AutoBoxing) 是JDK1.5中新增加的 ...