I/O queueing (blk-mq)
- request가 block layer에 도달했을 시 hardware dispatch queue로 바로 전달되거나 software staging queue로 전달됨
- Software staging queue로 전달되는 경우는 두가지
- I/O scheduler가 설정되어 있을 때
- request를 merge해야 할 때
- Software staging queue를 거친 request는 그 후 hardware dispatch queue로 전달
- Hardware에 충분한 리소스가 없을 시 temporary queue에 임시로 저장
- Device driver는 hardware dispatch queue를 사용해 각 block device들의 submission queue로 매핑
Submission queue & Completion queue (NVMe device)
- Submission queue는 64-byte command structure의 배열과 두개의 integer (head & tail)로 이루어짐
- Completion queue는 16-byte completion structure의 배열과 두개의 integer (head & tail)로 이루어짐
- 각 queue마다 doorbell이라고 불리는 32-bit register들이 존재
- NVMe driver에 request가 전달 될 시 다음과 같은 순서로 queueing을 진행
- request가 device로 전달 될 시 64-byte의 command structure를 형성해 submission queue의 tail로 전달
- Submissions queue의 doorbell에 새로운 tail을 기록
- Command structure를 fetch/process
- 16-byte의 completion structure를 형성해 completion queue의 tail로 전달
- Completion queue의 head index를 가진 interrupt를 생성
- Head부터 completion structure을 process
- 새로운 head를 completion queue doorbell에 기록
출처:
https://www.kernel.org/doc/html/v5.11/block/blk-mq.html
Multi-Queue Block IO Queueing Mechanism (blk-mq) — The Linux Kernel documentation
The block IO subsystem adds requests in the software staging queues (represented by struct blk_mq_ctx) in case that they weren’t sent directly to the driver. A request is one or more BIOs. They arrived at the block layer through the data structure struct
www.kernel.org
https://spdk.io/doc/nvme_spec.html
SPDK: Submitting I/O to an NVMe Device
The NVMe Specification The NVMe specification describes a hardware interface for interacting with storage devices. The specification includes network transport definitions for remote storage as well as a hardware register layout for local PCIe devices. Wha
spdk.io
'Computer System > Kernel' 카테고리의 다른 글
[Block I/O Layer] 6. I/O scheduler (Elevator) (0) | 2024.06.07 |
---|---|
[Block I/O Layer] 4. request (linux v6.x) (0) | 2024.06.05 |
[Block I/O Layer] 3. bio struct (0) | 2024.06.05 |
[Block I/O Layer] 2. Block layer (0) | 2024.06.05 |
[Block I/O Layer] 1. Block device (0) | 2024.06.04 |