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. Solution -「JOISC 2020」「UOJ #509」迷路的猫

    \(\mathcal{Decription}\)   Link.   这是一道通信题.   给定一个 \(n\) 个点 \(m\) 条边的连通无向图与两个限制 \(A,B\).   程序 Anthon ...

  2. 关于IDA无法从symbol server下载pdb的问题

    在ida目录下,symsrv.dll同目录下创建一个symsrv.yes文件. symsrv.yes将可下载: symsrv.no将失败: 没有相关文件将会弹出授权询问,选择yes和no将创建对应文件 ...

  3. suse 12 二进制部署 Kubernetets 1.19.7 - 第13章 - 部署metrics-server插件

    文章目录 1.13.0.创建metrics-server证书和私钥 1.13.1.生成metrics-server证书和私钥 1.13.2.开启kube-apiserver聚合配置 1.13.3.分发 ...

  4. 猜猜我在哪里-linux查找命令

    文章目录 find findfs locate slocate which whereis pwd pwdx find: # 这是一个很强大的查找命令 findfs: # 依据卷标(LABEL)和UU ...

  5. kali linux 中python2不带pip的解决方法

    在使用kali2020版本时,发现pip只能安装python3的模块,没办法安装python2模块,但是我有需要用到python2来运行脚本,在此贴出解决办法 https://bootstrap.py ...

  6. ensp常用命令

    display ip int brief 查看接口ip地址display interface brief 查看接口的简要信息display current-configuration 显示当前配置文件 ...

  7. 主流的商业智能BI工具推荐,学会数据分析没难度

    伴随着大数据概念的深入企业越来越重视大数据,商业智能BI工具已经成为许多企业数据分析的首选.也许有些小伙伴对商业智能BI工具还是有些陌生,在了解商业智能BI工具之前,先来了解一下什么是商业智能. 百度 ...

  8. Specified cast is not valid(C#) 引发的思考(装箱,拆箱本质)

    没有很华丽的语言,直接拿代码说事情把. 这段代码,会报错吗?  结论:当然不会 这段代码会报错了.原因是为啥? 这里面的水比较深.也要提醒各位写代码的适合要引起注意.异常:System.Invalid ...

  9. (转载)C 中static 和inline

    https://www.cnblogs.com/lxlx1798/articles/9996521.html

  10. angular项目grunt serve报错Cannot find where you keep your Bower packages

    运行angular项目grunt serve一直报错,截图如下: 无法找到报错Bower包的位置. 解决方法: 1.全局安装bower npm install bower -g 2.检查是否安装成功 ...